SpaceMIX v0.1.0 (latest)

With or without SpaceMIX Hub

experimentalfor bothsince protocol 1

What a SpaceMIX server does with and without SpaceMIX Hub: SPACEMIX_HUB_URL and its default, what you get without the Hub and what it adds, the two separate states Hub off and hasn't used the Hub, what \"uses the Hub\" means (usesHub), when a server asks the Hub on its own, preferences that follow a SpaceMIX ID (/api/me/preferences), and every route that answers 503 hub_off.

A SpaceMIX server stands alone. It has its own email and password accounts, serves its own web app, and needs nothing else to run. SpaceMIX Hub is a separate service you can use with it: read this page when you run a server, or when you need to know whether a server will ask the Hub for something.

Server and Hub behaviour, not part of the extension contract. The pages that describe what an extension sees (Registry, Marketplace, Permissions) link here for the definition. Setting a server up is in DEPLOY.md at the repository root.

What you get without the Hub, and what it adds

Without the Hub The Hub adds
Everything on your own server: the data, the assistant, extensions, widgets, Projects, the SpaceMIX API
Accounts with an email and password, invite links, permissions SpaceMIX ID: one account shared across servers, and the desktop app's saved list of them
Each person's preferences (theme, sidebar), kept on this server With a SpaceMIX ID, the same preferences on every server: see Preferences that follow a SpaceMIX ID
Install from a package file, always (Import from file in Extensions)
Free extensions from the public registry, with no account, while the Hub isn't turned off The Marketplace and buying: a paid extension needs a SpaceMIX ID (Marketplace)
Any model you connect: OpenAI-compatible endpoints and CLI agents Hub models, paid from the server's credit

The public registry is on the Hub, so browsing it reaches the Hub, with no account. Only with the Hub off is a package file the one way to install.

SPACEMIX_HUB_URL

Value Means
unset The official Hub, https://spacemix.ai. The server asks it nothing until someone uses a Hub feature (see When the server asks on its own).
An address That Hub, without a trailing slash. It is the only issuer whose tokens the server trusts, and has to equal the issuer (iss) in that Hub's tokens.
off (any case), or empty Hub off.

The source is identity::issuer in apps/desktop/src-tauri/src/identity.rs. The server states what it read in its discovery document, as auth.hub (see What a client reads), and a browser page takes the Hub's address from there at run time (apps/desktop/src/lib/hub.ts). The desktop app starts from VITE_SPACEMIX_HUB_URL (default https://spacemix.ai, off for none) and follows the active server's answer. It only links to the Hub it signs in with: another Hub a server names is shown as text, never opened.

Two separate states

Hub off Hasn't used the Hub
How SPACEMIX_HUB_URL=off The Hub is on, and nothing on the server uses it
The server asks on its own Never Not yet
Someone asks (Browse, Check now, Show models, the SpaceMIX tab of Connect a model, signing in with a SpaceMIX ID) Nothing to ask: no such button, or the route answers 503 hub_off It asks, as asked
/.well-known/spacemix auth.hub null The Hub's address

What "uses the Hub" means

A server uses the Hub while the Hub isn't off and any of these is true (Registry::uses_hub in apps/desktop/src-tauri/src/registry.rs):

  • an extension installed from the registry;
  • an installed extension marked ever_registry, or an id on the server's record of ids that ever came from the registry;
  • an installed extension with a licence;
  • an account that has a SpaceMIX ID now;
  • a Hub model among the connected models.

It is worked out from what's on the server each time it's needed, not stored as a switch. GET /api/extensions/registry-status answers it as usesHub.

When the server asks on its own

Only once it uses the Hub:

What When Page
The update check, GET /v1/registry/updates At startup and every 10 minutes Registry
The install report, POST /v1/registry/installs After each install, update or uninstall, and at least daily Registry
Its purchases and the installed ids' listings At startup and about every 6 hours, when it has anything installed Marketplace
Looking up an id before installing a package file At that install What a member may install
A member's preferences, GET and PATCH /v1/server-accounts/{account}/preferences When a member with a SpaceMIX ID opens the app or comes back to its tab (GET), and when they change one (PATCH) Preferences that follow a SpaceMIX ID

On a server that hasn't used the Hub:

  • The server doesn't ask on its own. An installed extension's page makes no listing read and offers Look it up on SpaceMIX Hub. Open in Studio and export skip the read for an installed id. These do read the public registry directly from the browser, so the viewer's address reaches the Hub then: that button; Browse; an extension's page reached from Browse or from ?via=hub, or for an id that isn't installed; Open in Studio or export of an id that isn't installed, which is opened from the registry and whose price the paid-copy guard needs; and the Studio's Publish tab in the desktop app signed in with a SpaceMIX ID.
  • Opening Extensions → Updates doesn't check. Check now does (apps/desktop/src/shell/store/Updates.tsx), and it sends every installed id, including builds as <id>@0 (update_installed in registry.rs; which installs), so a listing under a build's id can be held for the owner then.
  • The Hub's keys are fetched only to check a real token (identity.rs).
  • A paid extension installed from a file runs unchecked. It can turn off within 10 minutes of the server's first use of the Hub (see Turned off until it's paid for). Two exceptions: a server that stopped using the Hub keeps what it last heard, which still applies every 10 minutes, and an owner arriving at an extension's page from the Hub runs the purchase check, which can turn a paid file off.
  • A member's build isn't looked up, so it installs under an id that also has a listing (see What a member may install).

Preferences that follow a SpaceMIX ID

A member's personal preferences are the theme and the sidebar's mode in Settings → Preferences. The web app reads them from its server with GET /api/me/preferences when it opens and when its tab is shown again (at most every 5 seconds), and saves each change with PATCH /api/me/preferences (apps/desktop/src/lib/store.ts). The browser's localStorage is only a cache, so the page opens looking right before the server answers.

The member Where the server keeps them
Has a SpaceMIX ID, and the Hub is on In SpaceMIX Hub, with the SpaceMIX ID, so they're the same on every server the person uses. The server asks the Hub on each read and change, signed with its own key, and keeps the last answer in the member's personal namespace (key preferences).
Has only a local account, or the Hub is off Only on this server, in the same place.

Both routes answer:

Field Type Means
preferences object The preferences, one JSON object (theme, sidebar).
hub boolean true when they follow the member's SpaceMIX ID.
hubError string, optional The Hub couldn't be asked this time, so the server's own copy was used, and a change was kept on this server only. The Hub's copy wins the next time it answers.

A PATCH is a merge: each name in the body is set, and null removes it. Names are 1 to 64 characters (Preference names are 1 to 64 characters.) and the whole object is at most 16 KB as JSON (Your preferences are too large to save.); a body that isn't an object is refused with Send the preferences to change as a JSON object. The server waits at most 5 seconds for the Hub. The source is apps/desktop/src-tauri/src/preferences.rs.

The Hub answers only for an account it has seen sign in to that server, so a server can't read the preferences of someone who never used it.

Hub off

With SPACEMIX_HUB_URL=off the server sends the Hub nothing, on its own or when asked. A link with ?via=hub opens the sign-in form as usual (Links that open a server's page). No screen names a Hub: no Continue with SpaceMIX ID, no Browse, no Marketplace, no Hub models. /.well-known/spacemix answers auth: { "local": true, "hub": null } and an empty issuer.

These keep working:

  • Everything on the server, and local accounts, linked ones included (a linked local account keeps its password).
  • Installing from a file (POST /api/extensions/install-package), and every extension already installed.
  • Taking a SpaceMIX ID off your account (POST /api/auth/local/unlink).
  • Each person's preferences, kept on this server only, from the copy it last had (/api/me/preferences never answers hub_off).

An account with only a SpaceMIX ID can't sign in again. spacemix-server reset-password <email> gives it a password (Password resets).

Licences. A licensed extension still expires with the Hub off: the server applies the deadlines it already knows every 10 minutes, against its own clock, and asks nobody. Renewing needs the Hub back on. See What a server does.

The hub_off answer

Everything that needs the Hub answers 503 with:

{ "error": "SpaceMIX Hub is turned off on this server.", "code": "hub_off" }
Route Needs the Hub for
POST /api/auth/challenge, POST /api/auth/connect, POST /api/auth/link, POST /api/auth/local/link Signing in with, or linking, a SpaceMIX ID
POST /api/extensions/install, POST /api/extensions/approve A version from the registry
POST /api/extensions/check The update check
GET /api/extensions/essentials, POST /api/extensions/install-essentials The registry's recommended set
POST /api/extensions/entitlements/refresh Asking about purchases
/api/hub-models, /api/credit and the routes under it Hub models and credit

The routes are in apps/desktop/src-tauri/src/server.rs (require_hub) and hub_models.rs; the sentence and the code are HUB_OFF and HUB_OFF_CODE in identity.rs. Access checks come first, so someone who may not use a route gets that refusal instead.

A Hub model still in the connected models doesn't run: Settings → Models says Can't run: this server has SpaceMIX Hub turned off, and a chat on it fails with the same sentence as the route. An extension's host.ai.complete fails with The default model is a SpaceMIX Hub model, and this server has SpaceMIX Hub turned off. Connect another one in Settings. (apps/desktop/src/lib/extensionHost.ts; see AI).

Stability: experimental. Which things count as using the Hub, and when the server asks, may change as the Hub's features do.

This page as markdown · All pages as one file