SpaceMIX v0.1.0 (latest)

Manifest

stablefor bothsince protocol 1

Every field of ExtensionManifest and of the collection, action, event and notification declarations, with defaults, limits and where each is checked.

The manifest says who the extension is and everything it may do: its permissions, the data it gives the assistant, the events it emits and the notifications it sends. The store shows it to people before they install, and the host refuses anything it doesn't declare.

It is a plain object of type ExtensionManifest (packages/sdk/src/index.ts), usually written with defineExtension, and it travels inside the package as JSON. Write it as data: no functions, no values computed from host.

import { defineExtension } from "@spacemix/sdk";

export const manifest = defineExtension({
  id: "com.acme.tasks",
  name: "Tasks",
  version: "1.0.0",
  description: "A task board.",
  icon: "check-square",
  permissions: ["storage"],
  collections: [
    {
      name: "items",
      itemName: "task",
      description: "Cards on the team's task board.",
      schema: {
        type: "object",
        properties: {
          title: { type: "string", description: "What needs doing." },
          done: { type: "boolean", description: "Whether it's finished.", default: false },
        },
        required: ["title"],
      },
    },
  ],
  actions: [
    {
      name: "complete",
      title: "Complete task",
      description: "Mark a task done and tell whoever is watching.",
      inputSchema: { type: "object", properties: { id: { type: "string", description: "The task's id, from tasks_items_list." } }, required: ["id"] },
    },
  ],
  events: [
    {
      name: "task_completed",
      title: "Task completed",
      description: "A task was marked done. The payload is the task.",
      schema: { type: "object", properties: { id: { type: "string" }, title: { type: "string" } }, required: ["id"] },
    },
  ],
  notifications: [{ name: "task_assigned", title: "Tasks assigned to you", description: "When someone assigns you a task." }],
});

ExtensionManifest

interface ExtensionManifest {
  id: string;
  name: string;
  version: string;
  description: string;
  icon: string;
  order?: number;
  permissions: Permission[];
  collections?: CollectionDefinition[];
  actions?: ActionDefinition[];
  events?: EventDefinition[];
  notifications?: NotificationKind[];
  search?: SearchDefinition;
  categories?: ExtensionCategory[];
  entry?: string;
}
Field Required Rules Used for
id yes Reverse-DNS: defineExtension requires ^[a-z0-9]+(\.[a-z0-9-]+)+$; install and the registry require lowercase letters, digits and hyphens between dots, at most 100 characters. A server refuses to install the ids SpaceMIX uses itself (core.extensions, core.files, core.git, core.studio_folder, core.widgets, core.account, core.studio and core.projects, registry::CORE_NAMESPACES in src-tauri/src/registry.rs: <id> is reserved for SpaceMIX itself.) and ai.spacemix.api (<id> is reserved for SpaceMIX's API.), from SpaceMIX Hub, a file or a dev build. Other core.* ids install, but don't use one: SpaceMIX may reserve more later, and an extension under a newly reserved id can no longer be installed or updated. SpaceMIX Hub reserves core. for publishing (see Publishing). The extension's identity everywhere: storage, notifications, events, the registry listing, the address (#/@<server>/<id>/<route>, see Routes). Never change it: a new id is a new extension with no data.. The dev.operator. prefix from before the rename is refused everywhere.
name yes Non-empty after trimming. Navigation, store, messages. Notices cut it to 80 characters. The registry listing can override it (ListingPatch.name, up to 60 characters).
version yes Semver MAJOR.MINOR.PATCH with an optional -prerelease of letters, digits, . and -; at most 64 characters; no surrounding spaces. Updates and publishing; see Versions.
description yes A string. The store. The registry listing can override it (ListingPatch.description, up to 500 characters).
icon yes A string: a Lucide icon name in kebab-case, "check-square". Navigation, store, notifications, command palette. An unknown name shows a puzzle piece.
order no A number. Ignored today. Navigation order is install order, then the order each person drags into.
permissions yes A list of strings; see Permissions. What people approve; what the host allows.
collections no See CollectionDefinition. Records the extension owns and the five tools each gets.
actions no See ActionDefinition. Operations the assistant can run as tools.
events no See EventDefinition. Events the extension emits besides its collections' own.
notifications no See NotificationKind. Kinds of notification it may send.
search no See SearchDefinition. What the app's Search finds inside the extension. Without it, Search looks through its collections.
categories no Up to 3 ids from EXTENSION_CATEGORIES, no duplicates. SpaceMIX Hub refuses an unknown id on publish; hosts ignore it. Where the SpaceMIX Hub Marketplace files the extension. Missing or empty counts as other.
entry no A string. Ignored today. The package format has exactly one bundle.

Categories

categories files the extension in the Marketplace's category filter. Name the one to three that fit best, most fitting first:

export const manifest = defineExtension({
  // ...
  categories: ["crm", "communication"],
});

The ids are EXTENSION_CATEGORIES (packages/sdk/src/index.ts), in the order the Marketplace shows them; ExtensionCategory is their union and MAX_EXTENSION_CATEGORIES is 3.

id Label
productivity Productivity
communication Communication
crm CRM & Sales
finance Finance
marketing Marketing
content Content & Publishing
developer Developer tools
data Data & Analytics
automation Automation
ai AI
files Files & Storage
other Other

An extension whose manifest has no categories, or an empty list, is filed under other, and so is one that names other. The list of ids may grow; an id is never removed or renamed within protocol 1. So that an extension using a newer id still loads and installs on an older host, defineExtension and install check only the shape (a list of at most 3 strings, no duplicates) and let ids they don't know through. SpaceMIX Hub decides where a listing is filed (an empty list goes under other); an older client that doesn't know an id the Hub sends leaves it out of that listing's categories and shows no chip for it. SpaceMIX Hub refuses unknown ids on publish, and the Studio's build fails on one, so a published listing only names ids from the list. The registry gives each listing its latest non-withdrawn version's categories (Listing.categories) and filters search by them (Search).

Where the manifest is checked

The same manifest is checked in four places, and they don't check the same things:

Where When Checks
defineExtension When the bundle runs in a frame (the frame provides the real SDK), and in the Studio's build id pattern; snake_case ^[a-z][a-z0-9_]*$ names for collections, actions, events and notification kinds; no id, createdAt or updatedAt in a collection schema; no event named like a collection event; no event or notification kind declared twice; search.action names a declared action with readOnly: true; a collection route contains {id}; categories, when present, is a list of at most 3 strings without duplicates (unknown ids pass). The Studio's build also refuses an unknown category id.
Install (check_local in src-tauri/src/registry.rs) and publish (on SpaceMIX Hub) Install on this server (after Import from file), dev builds, publishing format is 2; id, version, name, description, icon as in the table; permissions is a list of strings; categories, when present, as defineExtension checks it, and on publish only ids from EXTENSION_CATEGORIES; js, css, readme are strings; builtAt is a non-negative integer; hash matches.
The frame runtime Every load The module sets __opExtension with a manifest whose id is a string, and a View.
The host After the frame says loaded The module's manifest.id and manifest.version equal the installed package's.

The build script (scripts/build-extensions.mjs) replaces defineExtension with a pass-through while it reads the manifest out of the bundle, so a manifest that breaks its rules still builds and installs; it then fails when the frame runs it. Run the Studio build or load the extension once before you publish.

Nothing checks: two collections or two actions with the same name, an action named like a collection tool (items_list next to a collection items), or the length of derived tool names. See Tool names.

After install, the host uses the package's manifest (with the approved permissions) for tools, events, notifications and host.manifest. The manifest the module exports is only compared on id and version.

CollectionDefinition

interface CollectionDefinition {
  name: string;
  itemName: string;
  itemNamePlural?: string;
  description?: string;
  schema: ObjectSchema;
  searchFields?: string[];
  route?: string;
  operations?: CollectionOperation[];
  requireApproval?: CollectionOperation[];
}

type CollectionOperation = "list" | "get" | "create" | "update" | "delete";
Field Default Meaning
name required snake_case, unique in the extension. Also the storage key: renaming it loses access to the existing records.
itemName required Noun for one record, "task". Used in tool titles, descriptions and errors.
itemNamePlural `${itemName}s` Plural noun.
description none What the records are, for the model. Appended to the list tool's description; when operations has no list, to the create tool's instead.
schema required The record's own fields as an ObjectSchema. Never id, createdAt, updatedAt.
searchFields every type: "string" field Fields the free-text query matches (case-insensitive substring). The first one is a record's title in Search (its first line, without a markdown heading's #s).
route none Where one record opens in the view: a route with {id} for the record's id, "note/{id}". Search opens a found record there; without it, a result opens the view where it was. Your view must understand the route.
operations all five Which tools the assistant gets. ["list", "get"] makes a read-only collection for the assistant; the extension's own host.collection API always has all five.
requireApproval ["delete"] Operations the user must approve before the assistant in the SpaceMIX app runs them. Giving a list replaces the default, so ["update"] means delete runs without asking. host.tools.call and a SpaceMIX API key with tools:write never ask.

Every record gets id (string), createdAt and updatedAt (milliseconds since the epoch) from the host: the RecordBase fields.

Tools derived from a collection

For an extension with namespace <ns> (see namespaceOf) and a collection <c>:

Tool Arguments Returns readOnly
<ns>_<c>_list query?, where? (exact match on any subset of the scalar fields: string, number, integer, boolean; a value for an array or object field, which is stored as JSON, or for a field not in the schema never matches; the tool's schema offers only the scalar fields, by type and enum), limit? (default 20) { total, items }, newest updatedAt first yes
<ns>_<c>_get id The record, or { error } when there's none yes
<ns>_<c>_create The schema's fields; defaults filled in The new record no
<ns>_<c>_update id plus only the fields to change The updated record no
<ns>_<c>_delete id { deleted: id } no

Each collection also emits three events on its own (see collectionEvents).

Storage and limits

A collection is stored one record at a time, shared by everyone on the server who may use the extension (who can), and every write touches only the record it changes, so a collection can grow large. From a browser, the server takes at most 2 MB per write (the HTTP layer's default body limit), so a single record must stay well under that to stay writable from the web. The layout is internal: read records only through host.collection and useCollection.

Each write is applied atomically on the server. update merges its patch into the record as stored, so two windows or browsers changing different fields of the same record at the same moment both land; for the same field, the later write wins.

ActionDefinition

interface ActionDefinition {
  name: string;
  title: string;
  description: string;
  inputSchema: ObjectSchema;
  requiresApproval?: boolean;
  readOnly?: boolean;
}
Field Default Meaning
name required snake_case, unique in the extension. The tool is <ns>_<name>; the handler is actions[name] in the module.
title required Short imperative label people see: "Send email".
description required What it does, for the model.
inputSchema required The arguments, an ObjectSchema. The host validates arguments against it before the handler runs.
requiresApproval false The user confirms each call the assistant in the SpaceMIX app makes. Set it on anything outward-facing or destructive. Calls through host.tools.call are never asked, and neither are calls with a SpaceMIX API key that has tools:write.
readOnly false Changes nothing anywhere. Read-only actions can feed widgets, which call them on a timer without asking.

A declared action without a handler fails when called: <Name> declares "<action>" but doesn't implement it. The handler type is ActionHandler; see Actions.

EventDefinition

interface EventDefinition {
  name: string;
  title: string;
  description: string;
  schema?: ObjectSchema;
}
Field Meaning
name snake_case, unique, at most 64 characters, past tense: task_completed. Also the type passed to host.events.emit. Can't be one of the collection events.
title Short label, past tense: "Task completed".
description When it happens and what the payload holds.
schema The payload's fields. On emit, fields the schema doesn't declare are dropped and the rest is validated like a record. Without a schema, emitting with a non-empty payload is an error.

The host refuses an emit whose type isn't declared. Payloads are at most 16 KB as JSON. See Events.

NotificationKind

interface NotificationKind {
  name: string;
  title: string;
  description: string;
  badge?: boolean;
}
Field Default Meaning
name required snake_case, unique, at most 64 characters. Passed as kind to host.notifications.send.
title required Plural label in the store: "Direct messages".
description required "When …", one sentence.
badge true Unread notifications of this kind count on the extension's navigation item.

An extension that declares no kinds can't send notifications. See Notifications.

JSONSchema

interface JSONSchema {
  type?: "object" | "string" | "number" | "integer" | "boolean" | "array";
  title?: string;
  description?: string;
  enum?: readonly (string | number)[];
  properties?: Record<string, JSONSchema>;
  required?: readonly string[];
  items?: JSONSchema;
  default?: unknown;
  options?: OptionsSource;
}

interface ObjectSchema extends JSONSchema {
  type: "object";
  properties: Record<string, JSONSchema>;
}

This subset is what the host validates against (validate in apps/desktop/src/lib/data.ts) and what the model is given. What validation does, exactly:

  • The input must be an object. Fields not in properties are an error: unknown field(s) "x"; allowed: …. (Event payloads are the exception: undeclared fields are dropped first.)
  • A field that is undefined or null counts as absent. Absent required fields are an error, except in updates and where filters.
  • Before checking, strings are coerced: "true"/"false" for boolean, numeric strings for number and integer, and "a, b" split on commas for array.
  • enum is checked first, then type: number must be finite, integer must be an integer.
  • Only the top level is checked. properties of a nested object and items of an array are passed to the model but not validated.
  • default is filled in on create only.

title labels the field in the host's forms. options is a form hint and is removed before the schema reaches the model (modelSchema).

OptionsSource

interface OptionsSource {
  tool: string;
  args?: Record<string, unknown>;
  value?: string;   // default "id"
  label?: string;   // default "name", then "title", then the value
  group?: string;
}

Names a read-only tool whose result lists the values a field can take, so host forms (Automation's "Run a tool") show a dropdown. tool is the extension's own short name ("conversations", "columns_list") or any full tool name. Collection id arguments get one on their own.

Tool names

const namespaceOf: (manifest: Pick<ExtensionManifest, "id">) => string;

namespaceOf

The tool prefix is the last segment of the id with hyphens turned into underscores: com.acme.my-crm → my_crm. Collection tools are <ns>_<collection>_<op>, action tools <ns>_<action>, MCP tools <ns>_<tool> (characters outside A-Z a-z 0-9 _ - replaced, cut to 64).

Two installed extensions whose ids end in the same segment get the same prefix, and their tools collide: whichever comes first in the navigation order wins, and the other's same-named tools can't be reached by the assistant or host.tools.call. A member's build loses every clash, whichever came first (see Tool names). Pick a last segment that is unlikely to be taken. A tool with the exact name of one of SpaceMIX's own (the project_* tools in Projects tools, the extension_* tools in The Studio's tools, the widget_* and dashboard_* tools in Widget tools, studio_switch in Switching the Studio session, tools_load and tool_result_read in How the assistant gets its tools, and material_query, material_save and material_refresh in Materials) is left out of the assistant's chats, with a notice in the chat; an extension whose id ends in .project, .widget, .dashboard, .extension or .studio risks that with an action like list (or switch, for .studio), and one whose id ends in .tools (an action load), .tool (an action result_read), .tool-result (an action read) or .material (an action query, save or refresh). See Tool names SpaceMIX keeps. Most model APIs cap tool names at 64 characters, and only MCP names are cut to fit, so keep <ns>_<collection>_<op> under that.

SearchDefinition

interface SearchDefinition {
  action: string;
}

interface SearchInput {
  query: string;
  limit: number;
}

interface SearchResult {
  title: string;
  subtitle?: string;
  route?: string;
  icon?: string;
}

How the app's Search (the command palette) asks an extension whose data isn't in its collections: an API, a repository, files. With search, Search calls that action and only it; the collections aren't searched.

Field Meaning
action A declared action with readOnly: true. Its inputSchema should accept { query: string, limit?: number }; the assistant can call it like any other read-only action.
SearchInput.query What the person typed, trimmed; never empty.
SearchInput.limit Most results Search shows from this extension (5 today). Return at most this many.
SearchResult.title One line of plain text, the thing's name or subject. Never interpreted as markup.
SearchResult.subtitle A quieter second line of plain text: where it is, who it's from, a snippet.
SearchResult.route Where it opens in the view (see host.view). Without it, the view opens where it was.
SearchResult.icon A Lucide icon name. Defaults to the extension's icon.

Search calls the action after a short pause in typing, for every installed extension at once, starting the extension's frame without showing it if it isn't running. Return results best first. An extension has 4 seconds; a slow answer, an error or a result without a title just leaves it (or that result) out. Return [] when there's nothing to search yet, like an account that isn't connected. See Search.

Helpers

defineExtension

function defineExtension(manifest: ExtensionManifest): ExtensionManifest;

Returns the manifest unchanged, or throws on the rules in Where the manifest is checked. Errors read Invalid extension id "…", <id>: invalid collection name "…" — use snake_case, <id>/<collection>: "id" is managed by the host, <id>: event "…" is declared twice, and so on.

collectionEvents

function collectionEvents(c: CollectionDefinition): EventDefinition[];

The three events the host emits for a collection: <name>_created, <name>_updated (payload adds changed, the names of the fields whose values changed) and <name>_deleted. Each payload is { id, ...fields }. An update that changes nothing emits nothing.

eventsOf

function eventsOf(manifest: Pick<ExtensionManifest, "collections" | "events">): EventDefinition[];

Every event an extension can emit: its collections' events, then its declared ones. This is what host.events.catalog() lists per extension.

modelSchema

function modelSchema<T extends JSONSchema>(schema: T): T;

The schema without options, recursively: what the model sees.

ToolDefinition

interface ToolDefinition {
  name: string;
  title: string;
  description: string;
  inputSchema: ObjectSchema;
  requiresApproval?: boolean;
}

A tool as the host hands it to the model. Derived from the manifest, never declared. HostTool (from host.tools.list) adds extensionId and readOnly.

Versions

version is your extension's own version and your promise to whoever depends on it: people, automations that call your tools, extensions that react to your events.

  • The registry orders versions by the three numbers, then a prerelease before its release. Two prereleases of the same version compare as plain strings, so 1.0.0-beta.10 sorts before 1.0.0-beta.9; use beta.09 or bump the patch.
  • Publishing needs a version strictly higher than every version published before, withdrawn ones included.
  • Dev builds install on every rebuild, whatever the version. A local install replaces whatever is installed, for the owner; see What a member may install.

Treat these as breaking for your users, and bump the major version: removing or renaming a collection, a field, an action or an event; changing what a field means; tightening an inputSchema; adding a permission (an update from the registry then waits for someone with server:extensions to approve it; a local install applies at once, and someone's own build then runs only for them until the owner approves it for the team). Renaming a collection or a field does not migrate stored records: old records keep the old field, and list and get return records as they were stored.

Stability

ExtensionManifest, CollectionDefinition, ActionDefinition, EventDefinition, NotificationKind, JSONSchema, ObjectSchema, OptionsSource, RecordBase, CollectionOperation, ToolDefinition, defineExtension, namespaceOf, collectionEvents, eventsOf and modelSchema are stable. order and entry are stable but unused: they stay accepted, and may get a meaning only through an additive change.

This page as markdown · All pages as one file