SpaceMIX v0.1.0 (latest)

Registry

stablefor bothsince protocol 1

The extension registry in SpaceMIX Hub: its HTTP API, JSON types, signing, version ordering, how servers install and update from it, and where the paid Marketplace's routes are.

The registry lives in SpaceMIX Hub. It is where a package is published, found, downloaded, updated from and reviewed. SpaceMIX servers install every extension from it (or from a package file). The JSON shapes are in packages/sdk/src/registry.ts, camelCase on the wire.

The base URL is SpaceMIX Hub's address (SPACEMIX_HUB_URL on servers, default https://spacemix.ai, off for none). Every route below is under /v1/registry.

Listings can also have a price. Prices, purchases and paid downloads belong to the Marketplace (/v1/market/*, experimental); this page names the parts of the registry they change.

Conventions

  • Auth. Routes marked signed in need Authorization: Bearer <refreshToken>, the refresh token from POST /v1/login ({ email, password } → { refreshToken, account }). Without it: 401 Sign in to continue.; with an expired one: 401 Your session has ended. Sign in again. Public routes ignore a bad token.
  • Errors. Every error is JSON { "error": "<sentence>" } with the status. Some also carry a stable code for clients to act on (the registry's own 404s carry not_found or taken_down), and some carry more fields (a paid download's 402 has listingId); read the ones you need and ignore the rest. A body that isn't valid JSON for the route answers The request body isn't valid JSON for this endpoint.
  • Times are milliseconds since the epoch.
  • CORS allows any origin, with Authorization and Content-Type.
  • Body size. At most 8 MB + 256 KB per request: That's too large to send. (413).
  • Ids are extension ids as in the manifest; put them in paths URL-encoded.

Routes

Method and path Auth Does
GET /v1/registry/extensions public Search listings
GET /v1/registry/categories public How many listings each category and price filter finds
POST /v1/registry/extensions signed in Publish a new listing with its first version
GET /v1/registry/extensions/{id} public (more when signed in) One listing in full
PATCH /v1/registry/extensions/{id} publisher Change the listing's description or visibility
POST /v1/registry/extensions/{id}/versions publisher Publish a new version
GET /v1/registry/extensions/{id}/versions/{version} public Download a signed package
DELETE /v1/registry/extensions/{id}/versions/{version} publisher Withdraw a version
GET /v1/registry/extensions/{id}/reviews public Reviews, newest change first
PUT /v1/registry/extensions/{id}/review signed in Write or replace your review
DELETE /v1/registry/extensions/{id}/review signed in Delete your review
POST /v1/registry/extensions/{id}/reviews/{account}/reply publisher Reply to a review
GET /v1/registry/mine signed in Your listings
PUT /v1/registry/extensions/{id}/versions/{version}/screenshots publisher Pick which review screenshots show, in order
GET /v1/registry/screenshots/{id} public (more for the publisher and admins) A screenshot's image
GET /v1/registry/notices signed in Your review notices
POST /v1/registry/notices/{id}/read signed in Mark a notice read
GET /v1/registry/updates public Update check for a list of installs
GET /v1/registry/defaults public The recommended extensions
POST /v1/registry/installs public A server reports what it runs
/v1/market/* varies Prices, checkout, purchases and server entitlements: see Marketplace
GET /v1/registry/extensions?q=&sort=popular&category=crm&price=free&limit=50&offset=0
→ 200 { items: Listing[], total: number }
  • q: case-insensitive substring of the id, name, description or publisher name. Empty lists everything.
  • sort: popular (default: installs, then review count, then name), new (created), rating (average, then count), name. Anything else: 400 Sort by popular, new, rating or name.
  • category (experimental): one category id; only listings whose categories include it. other also finds listings with no categories. Absent means every category. Anything else: 400 Category is one of productivity, communication, ….
  • price (experimental): free (no price) or paid (has a price). Absent means both. Anything else: 400 Price is free or paid.
  • limit: default 50, clamped to 1–100. offset: default 0.

The filters combine: total counts the listings that match all of them, before paging. Older Hubs ignore category and price and answer as if they were absent. Unlisted and taken-down listings are left out.

Categories

GET /v1/registry/categories
→ 200 RegistryCategories
interface RegistryCategories {
  categories: { id: ExtensionCategory; count: number }[];
  free: number;
  paid: number;
}

Counts over the same listings search sees (listed, not taken down). categories has every id of EXTENSION_CATEGORIES, in its order, zero counts included; other counts the listings with no categories too, and a listing in two categories counts in both. free and paid add up to the number of listings. Experimental, with the Marketplace.

Publish

POST /v1/registry/extensions
{ package: ExtensionPackage, releaseNotes?: string }
→ 201 ListingDetail

The package is checked as on install (Package format, Where the manifest is checked) and must be at most 8 MB as JSON. Release notes: plain text, trimmed, control characters other than newlines and tabs dropped, at most 5,000 characters. The listing belongs to the account that publishes it first.

Status Error
400 Only package format 2 can be published; …, The manifest has no id., The manifest needs a description and an icon., The manifest's permissions should be a list of strings., The manifest's categories should be a list of category ids., The manifest names an unknown category; use …., The manifest names the category "<id>" twice., The manifest can name at most 3 categories., The extension id should look like "com.example.notes": …, The version should look like 1.2.3 (optionally 1.2.3-beta.1)., The package needs its js and css., The package needs a readme and builtAt., The package hash doesn't match its contents., Release notes can be at most 5000 characters.
403 That id is reserved.: the id starts with a reserved prefix (by default ai.spacemix., dev.operator. and core.; dev.operator., the ids from before the rename, is refused for everyone) and the account isn't one of the Hub's named publishers or admins.
409 An extension with that id is already in the registry. Publish a new version of it, or pick another id.
413 Packages can be at most 8 MB.

Publish a version

POST /v1/registry/extensions/{id}/versions
{ package: ExtensionPackage, releaseNotes?: string }
→ 200 ListingDetail

Only the listing's publisher. Same checks as publishing, plus:

Status Error
400 The package is <other id>, not <id>.
403 Only the extension's publisher can change it., This extension was taken down., That id is reserved. (as for publishing: a reserved id needs a publisher or admin, even for a listing made before its prefix was reserved)
404 There's no extension with that id in the registry.
409 Version <v> isn't newer than <highest>. Raise the version in the manifest and rebuild.: the version must be higher than every published version, withdrawn ones included.

Listing

GET /v1/registry/extensions/{id}
→ 200 ListingDetail

404 for an unknown id (code: "not_found", There's no extension with that id in the registry.) or a taken-down one (code: "taken_down", This extension was taken down from the registry.); reviews and writing a review answer the same. With a valid bearer token, myReview, canReview and mine describe the caller; without one they are absent, false and false.

PATCH /v1/registry/extensions/{id}
{ description?: string, unlisted?: boolean }
→ 200 ListingDetail

ListingPatch. name (at most 60 characters) is shown instead of the manifest's; an empty string goes back to the manifest's. description (at most 500 characters) is shown instead of the manifest's; an empty string goes back to the manifest's. unlisted hides the listing from search; it stays installable by id and keeps getting updates.

Download

GET /v1/registry/extensions/{id}/versions/{version}?server=<server id>
→ 200 SignedPackage
Status Error
402 code: "payment_required", with listingId: a paid version (VersionInfo.paid) and the request isn't a signed one from a server that may have it. See Downloading a paid version.
404 code: "not_found" for an unknown id or There's no such version of that extension.; code: "taken_down" for a taken-down listing.
410 The publisher withdrew this version.: unless server names a server that reported running that version.

A free version downloads with no headers. A paid one needs server and the server's signed request for exactly this id and version, and that server needs an entitlement or the listing's publisher on it. A server can tell the Hub's own 404 from a proxy's by its code.

Withdraw

DELETE /v1/registry/extensions/{id}/versions/{version}
→ 200 ListingDetail

A withdrawn version is never offered as an update or as latest, and is downloadable only by servers that reported running it. Withdrawing an already withdrawn version does nothing. 409 That's the only version left. Publish a newer one before withdrawing it. There is no un-withdraw.

Reviews

GET /v1/registry/extensions/{id}/reviews?limit=50&offset=0
→ 200 { items: Review[], total: number }

PUT /v1/registry/extensions/{id}/review
{ stars: 1..5, text?: string, server: string }      // ReviewInput
→ 200 Review

DELETE /v1/registry/extensions/{id}/review
→ 204

POST /v1/registry/extensions/{id}/reviews/{account}/reply
{ text: string }
→ 200 Review
  • One review per account and extension; PUT replaces it.
  • The reviewer must have connected to server, as confirmed by the server's signed receipt that the client hands to POST /v1/me/servers/{id}/connected after connecting; being issued a sign-in token for it is not enough. Records from before receipts name the server's old id, and every server's id changes once when it moves to key-based identity, so people who connected before count again after their next connect. That server must also have reported the extension installed in the last 30 days: otherwise 403 Only people on a server that has this extension installed can review it. The review records the version that server runs.
  • 400 Give 1 to 5 stars.; review text at most 2,000 characters, plain text.
  • 403 You can't review your own extension.
  • Replies: the publisher only, at most 1,000 characters, not empty (400 Write a reply first.); a second reply replaces the text and keeps the first reply's time. 404 That review doesn't exist any more.

Mine

GET /v1/registry/mine
→ 200 { items: Listing[] }

The caller's listings, newest first, unlisted and taken-down included.

Updates

GET /v1/registry/updates?installed=<id>@<version>,<id>@<version>,…
→ 200 { updates: UpdateInfo[] }

For each entry, the newest non-withdrawn version when it is higher than the one given. For a taken-down listing, an entry with takenDown: true. A paid version has paid: true: downloading it needs an entitlement for the server, and a server from before the Marketplace gets a 402 when it tries, so it can't update to it. Unknown ids and malformed entries (no @) are skipped. A version that doesn't parse isn't malformed: it sorts lowest (see compareVersions), so <id>@0 always gets the newest version back. Servers rely on this to find a listing under a build made on this server, whatever version the build says it is. At most 500 entries: 400 Ask about at most 500 extensions at once.

Defaults

GET /v1/registry/defaults
→ 200 { ids: string[] }

The Hub's list of recommended extensions, in its order, without ids that are unknown, unlisted, taken down or paid (a listing with a price is never an essential). Servers install these unless their owner sets their own list.

Install reports

POST /v1/registry/installs
{ server: string, installs: { id: string, version: string }[] }    // InstallReport
→ 204

A server's complete list; it replaces what that server reported before. server must be 32 lowercase hex characters (400 otherwise); at most 500 installs (400). Unknown ids and versions over 64 characters are skipped. Install counts (Listing.installs) are the distinct servers that reported the extension in the last 30 days. The route has no authentication.

Studio homes (internal)

SpaceMIX's own Studio uses these routes to remember, per account, which server holds the newest edits to each of the account's Studio projects (apps/desktop/src/lib/studioHomes.ts). They are internal: not for extensions or tools, and not covered by the promise below.

GET    /v1/registry/homes                       → 200 { items: { extension, server, serverName, serverUrl, editedAt }[] }, newest edit first
PUT    /v1/registry/homes/{id}   { server, serverName?, serverUrl? }   → 200 the stored home
DELETE /v1/registry/homes/{id}?server=<server id>                      → 204

All three are signed in and reach only the caller's own homes. PUT makes server (32 lowercase hex characters) the home of extension {id}, stamped with SpaceMIX Hub's clock; serverName is kept to 80 characters and serverUrl must be empty or an http:///https:// address of at most 512 characters (400 That isn't an extension id., That isn't a server id. or That isn't a server address. otherwise). DELETE forgets the home only while it is still that server.

Version review

Every new version is reviewed before anyone can install it. A review runner checks the package in a throwaway sandbox and takes screenshots; a clean pass that the Hub's own rules allow is approved on its own, anything else waits for one of the Hub's admins. Each version's state is a ReviewState:

State Means
in_review Published, waiting for the runner or being reviewed. Publishing answers with the new version in this state.
needs_admin Waiting for an admin: the runner flagged it, failed it, was unsure, or didn't finish after 3 tries; or the review was clean but the Hub holds it (below).
approved Installable by anyone.
rejected An admin turned it down, with a reason the publisher sees. Final for that version number: publish a newer one. An admin may still approve it later.

A clean pass is verdict: "pass", uncertain not true and no finding of medium or above. The runner never rejects on its own. A clean pass still goes to needs_admin when the version is:

  • the listing's first version: the listing has no approved version yet;
  • asking for more: a permission, net: hosts included, that the last approved version didn't ask for;
  • asking for broad access: net:*, a wildcard host (net:*.<domain>), tools or git, even when an approved version already had it.

The Hub decides this from the manifests it stores, never from what the runner says. The reasons go in the version's review.reason and the publisher's needs_admin notice, as Waiting for an admin: and the reasons joined with ; , such as Waiting for an admin: new permissions: net:api.b.com, ai:invoke. or Waiting for an admin: broad access: net:*.. An admin's approval or rejection replaces it with their own note, or none. An admin may also approve or reject straight from in_review, and re-run any version's review: a version that isn't approved goes back to in_review, an approved one stays installable until the new result. Withdrawing a version still in review cancels its review.

Every version published before review existed was migrated to approved, so existing listings, installs and updates are unchanged.

Only approved versions exist for anyone but the publisher and the Hub's admins: search, GET /v1/registry/categories, a listing's latest, versions and readme, GET /v1/registry/updates, GET /v1/registry/defaults, reviews and install reports all skip the others. A listing with no approved version yet isn't listed and answers 404 not_found to anyone but its publisher and admins. A download of a version that isn't approved answers 404 not_found, whoever asks; nothing unapproved is ever signed.

For the publisher and admins (GET /v1/registry/extensions/{id} with their token, and GET /v1/registry/mine), every version carries review (a VersionReview), versions lists every version, Listing.pending is the newest version above latest that isn't approved, and a listing with no approved version has its newest one as latest.

The review's screenshots are the only images a listing shows; publishers can't upload their own, only pick which of a version's show and in what order:

PUT /v1/registry/extensions/{id}/versions/{version}/screenshots
{ shown: string[] }   // ScreenshotOrder: ids from that version's review, at most 12, no duplicates
→ 200 ListingDetail

Leaving one out hides it; [] hides them all. Not for a rejected version. A re-run of the review starts again from showing all of the new ones, in the runner's order. A review has at most 12 screenshots, PNG or WebP.

GET /v1/registry/screenshots/{id} answers the image (image/png or image/webp). To anyone, only a shown screenshot of an approved version, so it works in an <img>; the publisher's or an admin's bearer token also gets the others, which a client fetches and shows as a blob.

GET /v1/registry/notices
→ 200 { items: RegistryNotice[], unread: number }   // newest first, at most 50
POST /v1/registry/notices/{id}/read
→ 204

The publisher's notices about their versions' reviews: one each time a version enters in_review, needs_admin, approved or rejected, to the listing's owner only. SpaceMIX Hub's own site shows them under the bell; the Hub sends no email.

Types

Publisher

interface Publisher {
  id: string;   // SpaceMIX ID account id
  name: string; // first and last name, or the email's local part
}

Rating

interface Rating {
  average: number; // rounded to 2 decimals; 0 without reviews
  count: number;
  histogram: [number, number, number, number, number]; // index 0 = one star
}

VersionInfo

interface VersionInfo {
  version: string;
  hash: string;
  permissions: Permission[];
  releaseNotes: string;
  publishedAt: number;
  withdrawn: boolean;
  size: number; // bytes of js + css
  paid?: boolean; // present only when true
}

paid (experimental): published while the listing had a price, which it still has; a server needs an entitlement to download it. See Free and paid versions.

review?: VersionReview (experimental): only for the publisher and the Hub's admins; see Version review.

Listing

interface Listing {
  id: string;
  name: string;        // from the latest version's manifest
  description: string; // the listing's own, else the manifest's
  icon: string;
  publisher: Publisher;
  latest: VersionInfo; // newest version that isn't withdrawn
  rating: Rating;
  installs: number;
  unlisted: boolean;
  takenDown: boolean;
  createdAt: number;
  updatedAt: number;
  price?: ListingPrice; // absent when free
  categories?: ExtensionCategory[];
  screenshot?: Screenshot; // the first shown screenshot of latest
  pending?: VersionInfo;   // publisher and admins only
}

screenshot and pending (experimental): see Version review.

price (experimental): what it costs in the Marketplace, on search, listing and mine responses; ListingPrice is on the Marketplace page.

categories (experimental): the latest non-withdrawn version's manifest.categories. SpaceMIX Hub always sends it, [] when the manifest names none (the Marketplace files those under other); it is optional in the type because older Hubs don't send it.

ListingDetail

interface ListingDetail extends Listing {
  manifest: ExtensionManifest; // the latest version's
  readme: string;              // the latest version's
  versions: VersionInfo[];     // newest first, withdrawn included; approved only, except for the publisher and admins
  screenshots?: Screenshot[];  // latest's shown screenshots, in the publisher's order
  myReview?: Review;
  canReview: boolean;
  mine: boolean;
}

ReviewState, VersionReview, ReviewFinding, FindingSeverity, Screenshot, ScreenshotOrder

type ReviewState = "in_review" | "needs_admin" | "approved" | "rejected";
type FindingSeverity = "info" | "low" | "medium" | "high" | "critical";

interface VersionReview {
  state: ReviewState;
  reason?: string;      // needs_admin: why the Hub holds a clean review; else the admin's note (for rejected, the reason)
  decidedAt?: number;
  verdict?: "pass" | "flag" | "fail";
  uncertain?: boolean;
  summary?: string;
  findings: ReviewFinding[];
  screenshots: (Screenshot & { shown: boolean })[]; // shown ones in order, then the hidden ones
  reviewedAt?: number;
}

interface ReviewFinding { severity: FindingSeverity; title: string; detail: string; file: string } // detail, file may be ""

interface Screenshot {
  id: string;
  url: string;     // a path on the Hub: /v1/registry/screenshots/{id}
  caption: string;
  route: string;   // the view it shows; may be ""
  width: number;
  height: number;
  type: string;    // image/png or image/webp
}

interface ScreenshotOrder { shown: string[] }

A clean pass is verdict: "pass", not uncertain, and no finding of medium or above.

RegistryNotice, RegistryNoticeKind

type RegistryNoticeKind = "in_review" | "needs_admin" | "approved" | "rejected";

interface RegistryNotice {
  id: number;
  extension: string; // the extension id
  version: string;
  kind: RegistryNoticeKind | (string & {});
  reason: string | null; // needs_admin: why the Hub holds it; else the admin's note (for rejected, the reason)
  createdAt: number;
  readAt: number | null;
}

Review

interface Review {
  accountId: string;
  authorName: string;
  stars: number;
  text: string;
  version: string;
  createdAt: number;
  updatedAt: number;
  reply?: { text: string; createdAt: number };
}

UpdateInfo

interface UpdateInfo {
  id: string;
  version: string;
  hash: string;
  permissions: Permission[];
  releaseNotes: string;
  publishedAt: number;
  takenDown?: boolean; // present only when true
  paid?: boolean;      // present only when true
}

permissions here is not signed. Servers decide on an update from the downloaded package's own manifest, never from this field.

SignedPackage

interface SignedPackage {
  package: ExtensionPackage; // exactly as published
  signature: string;
  kid: string;
}

signature is base64url (no padding) Ed25519 over the bytes of

spacemix-extension-package\n{id}\n{version}\n{hash}

made with SpaceMIX Hub's signing key kid, the same key set it publishes at /.well-known/jwks.json for sign-in tokens (package_signing_input in spacemix-auth). A server installs a download only if the key is in that set, the signature verifies, the package's id and version are the ones it asked for, format is 1, and hash matches the bundle. The signature covers hash, and hash covers id, version, js and css; the rest of the package (manifest fields other than id and version, readme, source) is protected only by being served from SpaceMIX Hub over its transport.

PublishRequest, ListingPatch, ReviewInput, InstallReport

interface PublishRequest { package: ExtensionPackage; releaseNotes?: string }
interface ListingPatch { name?: string; description?: string; unlisted?: boolean }
interface ReviewInput { stars: number; text?: string; server: string }
interface InstallReport { server: string; installs: { id: string; version: string }[] }

PendingUpdate

interface PendingUpdate {
  id: string;
  version: string;
  added: Permission[];
  releaseNotes: string;
  foundAt: number;
}

Not a registry route: what a server keeps (a row of its extension_updates table) for a newer version waiting for someone with server:extensions to update it. added is what it asks for beyond the approved permissions, often empty. See Permissions. The row also has paymentRequired: true for a paid version this server hasn't bought; its added is then empty because the package wasn't downloaded (see What a server does). A listing under the id of a build made on this server has replacesBuild: true and asks, every permission the listing asks for (absent while it can't be downloaded), with added still what the installed record doesn't cover; only the owner may approve or skip it, and such a row can exist with no install under the id. See When a listing takes a build's id.

Versions

function compareVersions(a: string, b: string): number;
function isSemver(v: string): boolean;

compareVersions

Orders major.minor.patch numerically, then a prerelease (-beta.1) before its release. Two prereleases of the same version compare as plain strings, not by semver precedence: 1.0.0-beta.10 < 1.0.0-beta.9. Anything that doesn't parse sorts lowest. SpaceMIX Hub and servers use the same order.

isSemver

^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$ after trimming. Publishing also requires no surrounding whitespace and at most 64 characters.

What a server does with the registry

src-tauri/src/registry.rs, on a SpaceMIX server with the Hub on. With the Hub off none of this happens, and the routes that would need the registry answer 503 hub_off:

  • Installs a version when someone with server:extensions and access to that extension picks Install (the latest unless a version is named), approving its permissions. Over a build made on this server (the owner's too, also once uninstalled, until its data is erased or it is installed again), it holds that version for the owner instead and answers 403 held_for_owner (see When a listing takes a build's id).
  • Checks for updates at startup and every 10 minutes, once it uses the Hub: GET /updates with every non-dev install and every dev install that is a build made on this server (at most 100 ids and about 6,000 bytes of query per request; a build as <id>@0, in requests of their own after the others, so one failing stops nothing else), then downloads and verifies each newer version and holds it for the people with server:extensions who may use that extension, not counting a build withheld from them (they get a notice that opens that extension's page, and update from there), or installs it right away when automatic updates are on and it asks for no new permissions (see Permissions). Opening that list runs the check right away on a server that uses the Hub; on one that doesn't, Check now in that list does. A taken-down listing drops any held update and leaves the install alone. A paid update this server isn't entitled to is held as needing a purchase, without downloading it. A listing under a build made on this server is never installed from here, whatever the automatic-update setting says: it is held for the owner.
  • Signs every download with its key (see Signed server requests), so the paid versions it has bought come through.
  • Checks its purchases, once it uses the Hub, and turns off paid extensions it isn't entitled to; see What a server does.
  • Installs the essentials (GET /defaults, ids that aren't installed and that the person may use, each at its latest) when someone with server:extensions clicks Install essentials. Never on its own, and an id that is a build made on this server is held for the owner instead.
  • Reports its installs (POST /installs, dev builds and members' builds excluded, at most 500) after each install, update or uninstall, and at least daily, once it uses the Hub.
  • Downloads at most 9 MB per package.

Stability

The routes (except the internal Studio homes), their request and response shapes, and the types on this page (Publisher, Rating, VersionInfo, Listing, ListingDetail, Review, InstallReport, UpdateInfo, SignedPackage, PublishRequest, ListingPatch, ReviewInput, PendingUpdate, compareVersions, isSemver) are stable within /v1: fields and routes are only added. The signing input spacemix-extension-package\n{id}\n{version}\n{hash} is stable. Error wording, sort tie-breaks and the default page size are not part of the promise.

Everything the paid Marketplace adds is experimental while the Marketplace is being built: on this page Listing.price, Listing.categories, the category and price search parameters, GET /v1/registry/categories and RegistryCategories, VersionInfo.paid, UpdateInfo.paid, PendingUpdate's paymentRequired, the 402 payment_required answer and the signed download, the 404 codes not_found and taken_down, and the paid-listing rule for GET /v1/registry/defaults; and everything Version review adds (VersionInfo.review, Listing.screenshot, Listing.pending, ListingDetail.screenshots, ReviewState, VersionReview, ReviewFinding, FindingSeverity, Screenshot, ScreenshotOrder, RegistryNotice, RegistryNoticeKind and their routes); and everything on the Marketplace page (ListingPrice, PriceModel, PriceInterval, PriceInput, DuplicatePurchase, MarketConfig, SellerStatus, CheckoutRequest, Purchase, EntitlementStatus, ServerEntitlement, ServerEntitlements and the /v1/market/* routes).

The server row's replacesBuild and asks (not fields of the SDK's PendingUpdate) are experimental too, with the rest of When a listing takes a build's id.

This page as markdown · All pages as one file