Files
ai-agent/docs/plugins.md
gabrielvidalandClaude Opus 5.5 118b6db0df feat(plugins): the lab Chrome leaves the core for the lab-chrome plugin
Settings → Browser, the conversation's Browser dock (noVNC live view and
take-over) and the container's on-demand life move into the lab-chrome
live plugin (ai-agent-plugins). The core keeps the Chrome chip (the
harness capability chrome) and gains three generic hooks:

- sockets[] + aiAgentPlugin.openSocket(id): a frame's websocket, opened by
  the host with the reader's cookies and relayed over postMessage to
  WS /api/plugins/{pid}/sockets/{sid}, which bridges only to the declared
  upstream (owner only, the gate's handshake rules, never the guest host;
  operator approval). GET …/sockets/{sid}/probe → {up, open, lastActiveAt}
  for the plugin's handlers.
- provides chrome.lab (plugins/chrome_bridge.py): {op: status} → the chip
  default and whether guests' runs keep --chrome; {op: ensure} before a
  lab --chrome run launches (spawn and resume).
- ui.slots[].size on app.modal (full = near full screen, frame filling it);
  conversation.gizmos' update and hub/conversations rows carry chrome.

Gone: backend/chrome/, /api/chrome*, schemas/chrome.py, the SSE chrome
event, the lab.integrations permission, BrowserDock/BrowserSettings/store,
the Browser header button and eye switch, @novnc/novnc. /settings/browser
redirects to /settings/plugin/lab-chrome; carryover.chrome moves
/data/chrome.json into the plugin's config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 00:18:31 +01:00

101 KiB
Raw Permalink Blame History

Live User Plugins (v1 + v2 + v3)

Live plugins let anyone with permission (plugins.install / plugins.create) build, install, reload, and share self-contained extensions for ai-agent without rebuilding the Docker image or running untrusted code inside the hub process.

Storage layout

Runtime state never lives in git; plugin sources live outside ai-agent core.

  • Hub / owner plugins repo: ~/projects/ai-agent-plugins (private Gitea repo gabrielvidal/ai-agent-plugins), one folder per plugin under plugins/<id>/.
  • User-created plugins: created inside the app (Settings → Plugins → + New plugin), living in their own folder/Gitea repo (or any local path / git URL).
  • Hub runtime data (under PLUGINS_DIR, default /data/plugins):
    • installed.json — per-user installs, capability approval fingerprint, enabled flag, non-secret config, webhook tokens, schedule status, plus the operator's hub catalog.
    • secrets/<uid>/<id>.json (0600) — write-only per-user secrets (secrets/_hub/<id>.json for hub-scoped secrets set by the operator). Never returned by any GET API.
    • data/<uid>/<id>/ — per-user plugin storage and scheduled snapshots (quota-enforced).
    • live-skills/<uid>/<id>/ — materialized copy of each enabled plugin's skill/ folder, injected live into lab runs (shared_skills.py) and synced to paired computers (labsync.py).
    • repos/<hash>/ — shallow git clones for plugins installed by git URL.

Plugin folder layout

<plugin-dir>/
├── plugin.json          # required manifest (schema: 1)
├── skill/               # optional — live-injected skill for agent runs + workers
│   ├── SKILL.md
│   └── scripts/...      # calls AIA_TOOLS_URL/plugins/<id>/...
├── ui/                  # optional — v2 sandboxed HTML documents (/sandbox-frame.html)
├── jobs/                # optional — v1/v2 non-LLM scheduled scripts
└── handlers/            # optional — v3 sandboxed action scripts

Manifest (plugin.json)

{
  "schema": 1,
  "id": "meta",
  "name": "Meta Business",
  "version": "1.0.0",
  "description": "Read-only Meta ads, Instagram & Page insights",
  "icon": "megaphone",
  "color": "#545e91",
  "illustration": "illustration.webp",
  "readme": "README.md",

  "skill": { "dir": "skill", "name": "meta" },

  "secrets": [
    {
      "key": "token",
      "label": "System-user token",
      "placeholder": "EAA...",
      "help": "Stored write-only on the hub.",
      "scope": "user",
      "required": true
    }
  ],

  "settings": {
    "subtitle": "Read-only ads, Instagram and Page insights",
    "instructions": "## Setup\n1. Create a read-only system user token…",
    "fields": [
      { "key": "timezone", "label": "Timezone", "type": "text", "default": "Europe/Paris" }
    ],
    "links": [
      { "label": "Business settings", "url": "https://business.facebook.com/settings/system-users?tz={{config.timezone}}" }
    ],
    "testAction": "inspect",
    "statusAction": "status"
  },

  "proxy": {
    "baseUrl": "https://graph.facebook.com/v27.0",
    "internal": false,
    "stream": false,
    "auth": { "in": "header", "name": "Authorization", "prefix": "Bearer ", "secret": "token" },
    "headers": { "X-Example": "guest-{{user.id}}" },
    "allow": [
      { "method": "GET", "path": "^me(/(adaccounts|accounts|permissions))?$" }
    ],
    "denyParams": ["access_token", "method"],
    "stripResponseKeys": ["access_token"],
    "scrubSecrets": true,
    "maxBytes": 20971520,
    "inspect": {
      "method": "GET",
      "path": "me/permissions",
      "requireOnlyScopes": ["ads_read", "read_insights"]
    },
    "wake": null
  },

  "managed": {
    "defaultForGuests": false,
    "allowUserSecretOverride": false,
    "metered": false,
    "grantFields": [
      { "key": "allowPro", "label": "Allow Pro models", "type": "checkbox", "default": false }
    ],
    "limits": { "inFlight": 4, "jobsPerDay": 40, "defaultMonthlyBudgetUsd": 5.0 },
    "keyHealth": { "alertLimit": 20.0, "currency": "EUR", "pushAtPct": 80, "pushOnBreak": true,
                   "secretKey": "token", "legacyLedgerTool": null }
  },

  "storage": { "maxMb": 50 },

  "schedules": [
    { "id": "daily-snapshot", "cron": "0 7 * * *", "script": "jobs/snapshot.py", "timeoutSec": 180 }
  ],

  "ui": {
    "settingsHtml": "ui/settings.html",
    "pages": [
      { "id": "board", "label": "Board", "nav": "dashboards", "html": "ui/board.html" }
    ],
    "toolCards": [
      { "id": "card", "match": { "tool": "shell", "commandRegex": "\\bmytool\\b" }, "label": "My Tool", "html": "ui/card.html" }
    ],
    "slots": [
      { "id": "proj", "where": "project.detail", "html": "ui/slot.html", "height": 140 }
    ],
    "fences": [
      { "id": "chart-fence", "lang": "chart", "html": "ui/chart.html", "height": 330 }
    ]
  },

  "events": [
    { "id": "done-hook", "on": ["conversation.finished"], "url": "https://example.com/hook", "secret": "hook_secret" }
  ],

  "webhooks": [
    { "id": "inbound", "mode": "notify", "titleTemplate": "Update: {{title}}" }
  ],

  "actions": {
    "inspect": { "script": "handlers/inspect.py", "timeoutSec": 30 },
    "status":  { "script": "handlers/status.py",  "timeoutSec": 20 }
  },

  "resources": [
    { "id": "jira", "label": "Jira issue", "urlRegex": "^https://[a-z0-9-]+\\.atlassian\\.net/browse/(?P<key>[A-Z]+-\\d+)",
      "idTemplate": "{key}", "color": "#0052CC", "priority": 10, "hueRole": "hue" }
  ],

  "capabilities": ["conversations.read"]
}

Art and the info page (since 2026-11-25)

Every plugin has a card in Settings → Plugins (a grid with a search box, tabs Installed / Hub catalog) and its own page: the illustration, its settings, then its info — the README, what it can access (the capability list), what runs on its own (schedules, webhooks), its pages, version, author and source. A catalog entry's page is the info and an Install button.

Field What Default when not declared
icon a lucide name, or a path to an .svg (≤ 32 KB, 24×24, strokes in currentColor) icon.svg at the root, else puzzle
illustration .webp / .png / .jpg / .svg, ≤ 1 MB, about 16:9 (cropped to a banner) illustration.{svg,webp,png,jpg} at the root
color hex accent of the icon's tile (the illustration's background) a neutral tile
readme a .md (≤ 64 KB) — the info page's text, for people, not agents README.md at the root
  • The icon is drawn as a CSS mask, so it follows the tile's colour; no plugin markup reaches the DOM. An SVG with scripts, event handlers, foreignObject, external or data: references is refused at install, and refused again when served if it changed on disk.
  • GET /api/plugins/{id}/asset/{icon|illustration} serves them sandboxed (CSP: sandbox, nosniff), for an install of the caller, a managed plugin granted to them, or a catalog entry they can see; the URLs carry ?v=<artVersion>. GET /api/plugins/{id}/info returns the info page.
  • Art is not in the approval fingerprint: changing it never asks for re-approval. A record installed before art existed gets it from its source once, on the next list.
  • Hub plugins use soft-clay 3D illustrations (Nano Banana Pro, 16:9, a muted gradient background, the tile colour sampled from its darker edge).

Host data and slots (since 2026-11-25, the Services plugin)

  • ui.slots[] render: service.detail on a service's page (init {slug}), conversation.details in a conversation's Details drawer (init {sessionId, conversationId}, one pluginSlots card for all of them) and machine.detail on a machine page's Tools tab (init {machineId, name, kind: "lab"|"worker"}, the owner's machines only — see "Machines, relays and attention"), through PluginSlots (frontend/src/business/plugins/components/) — a borderless sandboxed frame sized by aiAgentPlugin.resize(px); a slot with nothing to show calls resize(0) and folds to no height. Every plugin frame (pages, slots, settings, tool cards) now gets the app's theme tokens on :root (--background, --foreground, --card, --border, --primary…, lib/sandboxTheme.ts), so hsl(var(--card)) follows light / dark and the accent.
  • provides: data the host asks a plugin for and merges into its own answer — {"service.cards": "<action>"}: the host runs that action as the owner (cached 30 s) and merges each services[dir] object's whitelisted fields into /api/services and /api/service (backend/services/enrich.py: urls, containers, containerCount, images, profiles, auth, hasCompose, hasTraefik, routerCount, icon, group; homepageDescription only fills an empty description). In the fingerprint.
  • services.read (capability, operator-approved): the owner's handler runs get AIA_SERVICES_DIR (the host's services dir, read-only); a guest's never.
  • provides: {"plans.index": "<action>"} (since 2026-11-25, the Plans plugin — data/plans left the core): the plan summaries, read by backend/plugins/plans_bridge.py as the owner for the Graph's plan nodes (graph.read); plans_bridge.get_plan runs the same plugin's get. The CLI (ai-agent plugin plans ls|show) and the MCP tools plugin_plans_ls / plugin_plans_show are the plugin's own commands (below, "Commands"). No plugin, no plans: every reader gets [] / 404. The old /plans and /plans/<slug> routes redirect to /plugins/plans/plans[/<slug>].
  • provides: {"memories.index": "<action>"} (since 2026-11-26, the Memories plugin — backend/memories/ and core/filecache.py left the core): the memory summaries (slug, name, description, type, originSessionId, projects, services, links, words, bytes, updatedAt), read by plugins/memories_bridge.py for the Graph's memory nodes. The CLI (ai-agent plugin memories ls|show) and the MCP tools plugin_memories_ls / plugin_memories_show are the plugin's own commands. The conversation Details drawer's memories card and a service page's memories are the plugin's conversation.details / service.detail slots; ConversationDetail no longer carries memoriesRead / memoriesCreated (the indexer still records the slugs a transcript read — the plugin reads them through hub/conversations?memories=1). /memories[/<slug>] redirect to /plugins/memories/memories[/<slug>].
  • provides: {"notify.channel": "<action>"} (since 2026-11-25, the Home Assistant push plugin): the plugin delivers its installer's pushes — run as that person for every push, question and clear they get, stdin {"event": "notify"|"ask"|"clear", "push": {id, title, message, question, options, url, image, type, importance, channel, actions, tag, spoken…}}, stdout {"ok": bool, "status"?: int, "error"?: str}. Tried once (a notify / ask on the request thread, a clear off it), never retried; the app and browser push still reach the person without one. Buttons answer the hub (/api/ask/{id}/answer, /api/notify/{id}/action). Host side: backend/notifications/channels.py; example: home-assistant-push.
  • Plugin dependencies (requires, exports, emits, plugin:<dep>:<event>): a plugin can declare "requires": ["ask-form"] (checked at install / enable / disable / uninstall; in the approval fingerprint). A base plugin opts actions into cross-plugin calls with "exports": ["create", "get"] (a dependent plugin's handler token aiah1 can then POST to /proxy/tools/plugins/<base>/actions/<act>, capped at call depth 4, with AIA_USER_CONTEXT.callerPlugin set) and declares events in "emits": […] (fired via POST /proxy/tools/plugins/<base>/hub/emit and delivered to enabled dependents subscribing to "plugin:<base>:<event>").
  • Declarative Claude subagents (agents[]) & default+override prefs: a plugin can declare "agents": [{name, description, promptFile, tools, omitClaudeMd?, enabledPref?, modelPref?, effortPref?}] loaded in-process by backend/runs/extras.py (0 ms overhead). ui.prefs[] supports "scope": "default+override" (operator's setting is everyone's default; guests can override or reset to default) and "optionsFrom": "user.modelFamilies" (clamped to each user's allowed Claude model families). First user: the clarifier plugin.
  • provides: {"composer.shortcuts": "<action>"}: additive prompt shortcuts rendered natively by the core composer's RichInput (GET /api/plugins/composer-shortcuts, cached and invalidated on plugin mutations).

Commands: the ai-agent CLI and the MCP server (since 2026-11-26)

A plugin adds its own commands to the ai-agent CLI and, opt-in, tools to the hub's MCP server (Claude.ai, ChatGPT, a Mac's Claude Code) with a commands block — no core edit, no plugin id in core. Gabriel's choices (form ai-agent-cli-and-mcp-for-live-plugins_fevcts): manifest-declared commands, namespaced under plugin, MCP opt-in per command, guests follow their plugin grants. Code: backend/plugins/commands.py (validation + catalogue), cli/plugin_commands.py (parser, printing, MCP tools), cli/mcp_tools.py (plugin_tools). Before this, each move from core hard-coded its plugin's id in cli/ai_agent.py + cli/mcp_tools.py (plans_call, memories_call): gone, and ai-agent goals / MCP work_on_goal / browse plans|goals|memories / read_document with them.

"commands": {
  "ls":   { "action": "index", "summary": "Every plan, newest first: slug, status, title",
            "output": { "rows": "plans", "columns": ["slug", "status", "title"] },
            "mcp": true },
  "show": { "action": "get", "summary": "One plan's markdown",
            "description": "Longer text for --help and the MCP tool description.",
            "args": [ { "name": "slug", "positional": true, "required": true,
                        "help": "The plan's slug, as `ls` lists it." },
                      { "name": "conversations", "type": "boolean", "default": false } ],
            "output": { "text": "content" }, "mcp": true }
}
  • A command = one declared action (action), a one-line summary (required: the --help line and the MCP description), an optional description, its args and output. At most 16 commands, 12 args each. Names: commands [a-z][a-z0-9-]{0,31}, args [a-z][a-z0-9_]{0,31} (not json, not query).
  • args[]: type string (default) · integer · number · boolean · array (of strings); positional (a boolean can't be; only the last positional may be an array; a required positional never follows an optional one), required, enum (strings), default (sent when the argument isn't given — how memories show asks for no conversations by default), help. Flags are --kebab-case of the name; a boolean is a switch (--no-x when its default is true); an array flag repeats.
  • output: {"text": "<field>"} prints that field of the answer, {"rows": "<list field>", "columns": [...]} prints the rows as an aligned table (MCP: one JSON line per row with only those columns, and an implicit query argument that keeps the rows containing every word), absent = the JSON answer. --json always prints the raw answer.
  • mcp: true offers it as the tool plugin_<id>_<command> (≤ 64 characters, refused at validation otherwise). Group read when the action is readOnly, else run (a read-only connection sees only the read ones); destructive: true sets the hint. Never on a worker-bound connection (its scopes have no plugins.use).
  • Calls: a readOnly action goes by GET …/actions/{action}?payload= (8 KB), anything else by POST — the same route the plugin's pages use, so the caller's grants, ownerOnly and runAs apply unchanged. That is why commands is not in the approval fingerprint: it adds no reach. The consent card / info page lists them (kind: "commands").
  • Catalogue: GET /api/plugins/commands (plugins.use) — the commands of the plugins active for the caller: the owner's installs; a guest's own installs plus the owner's managed plugins granted to them, minus any ownerOnly action. A guest's CLI (the guard's broker) and AI-app connection get exactly those.
  • A plugin whose id is a core ai-agent plugin verb (ls, install, commands, call, …) can't declare commands.

On the CLI:

ai-agent plugin commands                    # every command you have, with its MCP tool
ai-agent plugin plans ls                    # a plugin's command
ai-agent plugin memories show SLUG --json   # raw answer
ai-agent plugin plans --help                # that plugin's commands
ai-agent plugin call movies op --payload '{"op":"status","id":7}' [--get]   # any action, raw
ai-agent memories                           # → "is the Memories plugin's — ai-agent plugin memories <command>"

Batch 1 platform hooks (since 2026-11-26)

Shared hooks for the templates, memories, desk-phone, activity, project-env, ship and blue-green-deploy plugins (the legacy core modules stay until each plugin replaces them).

  • Owner-only capabilities (operator approval; a guest's run never gets them): templates.read → AIA_TEMPLATES_DIR (TEMPLATES_DIR), memories.read → AIA_MEMORIES_DIR (MEMORIES_DIR), projects.env → AIA_PROJECTS_DIR (projects.catalog.PROJECTS_DIR), set in the owner's handler env only (plugins/runner.py); activity.read, usage.read, usage.calibrate and ship.run are hub bridges (below).
  • provides keys: memories.index (plugins/memories_bridge.py, the plans_bridge twin: list_memories, get_memory via the plugin's get, has_provider; the Graph's only source of memory nodes since the memories plugin, below), notify.audio (a push's spoken audio — the desk-phone plugin: the owner's provider gets {spoken, type, title, message, audio} and answers {ok, wavBase64, contentType}; POST /api/notifications/audio decodes it, 503 without one — notifications/channels.render_audio), app.banner (below). GET /api/plugins (and its ui) carries provides: [...], the sorted keys active for the caller (usePluginProvides(key) in the frontend); a guest's list never has app.banner.
  • app.banner (plugins/banner.py): the owner's plugin answers {active, title, label, status: running|done|failed|info, phaseNum, totalPhases, phase, steps: [{n, label, state?}], startedAt, updatedAt, sessionId?, maintenance?} (a missing step state is derived from phaseNum + status); GET /api/app-banner (owner only, lab.read) serves it cached 5 s with sessionId resolved to conversationId / convTitle / convUrl; frontend/src/technical/StatusBanner.tsx draws it while active. Any webhook or (non-GET) action of the providing plugin drops the cache and publishes SSE {"type": "banner"}; while a banner shows, the app also polls it (6 s once done/failed, 1 min while running), so a provider can let a snapshot expire with no webhook (blue-green-deploy hides done/failed after 10 s, a silent running after 30 min). banner.is_maintenance(deps) (maintenance: true or status: "running") pauses guest-job push delivery (cron/guests.py).
  • Webhooks, mode: "action": runs the named action as the installer with {"trigger": "webhook", "hookId", "body"} on stdin; internalOnly → 404 on the public guest host.
  • hub/conversations: memories=1 adds memoriesRead (slugs) and model to each row; memory=<slug> scans the whole archive (no days window) for the conversations that read it.
  • activity.read — GET …/hub/activity?account=<scope>&tzOffset=<min>: the Activity rollup (days, binsByDay, models, totals, account, byAccount) plus profiles (plugins/activitydata.py). Read by the activity plugin since 2026-11-26, which replaced core's /api/activity and /dashboards/activity (that path now redirects to the plugin page, else to the Dashboards overview). Local-day helpers live in dashboards/timebins.py. Home's usage card reads the slim core GET /api/usage/daily?days=7&tzOffset=&account= ({days: [{date, cost, tokens, conversations}]}, 1–90 days, owner only).
  • usage.read — GET …/hub/usage/overview?scope=<all|profile:id>&days=<1–120>: one scope's Plan usage in one answer (plugins/usagedata.py) — accounts (the scope's accounts with a /usage source, /api/accounts' rows plus the live plan's planWindows / planLabel / planTier and subscription: Settings → Logins' plan, monthly price and start date, or null), and per account limits (/api/usage/limits' entry), history (/api/usage/history), plans (/api/usage/plans) and calibration (/api/usage/calibration), plus the scope switch's profiles. all = every account; a profile = its ★ seats; the Guests profile = the default profile's. usage.calibrate — POST …/hub/usage/calibrate {backfill?}: POST /api/usage/calibrate's fit ({calibrations, shifted}), then an SSE usage. Read by the plan-usage plugin since 2026-11-26, which replaced core's /dashboards/plan page (PlanUsage.tsx + planViz.tsx; that path now redirects to /plugins/plan-usage/board, else to the Dashboards overview). usage/ itself — poller, store, calibration, budget, burn and every /api/usage/* route — stays core: Home's strip and burn tile, the composer's rings, ai-agent usage / budget and the rate-shift pushes read it. Home's half-ring gauge is dashboards/components/ArcGauge.tsx.
  • ship.run (owner's handler token only — a guest reaches it through a runAs: "owner" action, whose AIA_USER_CONTEXT.requester carries uid, isOwner, name, lang, domains, sessionId, grant): POST …/hub/ship/deploy {project, host, dir?, actor?, sessionId?} (host sidecar /ship/deploy, dir defaulting to package.json zipgo.deploy[host] else dist, then a ship_deploy security event naming actor), POST …/hub/ship/audit {kind: guard_block|ship_deploy, actor, project?, host?, detail?, sessionId?}, GET …/hub/ship/scan?project= → {hosts, buildDirs}. The plugin enforces who may deploy where. Since 2026-11-26 the ship plugin (ai-agent-plugins) is the only broker: backend/ship/, /api/ship/*, the guard's ship-deploy catch and the guest prompt's deploy line are gone; carryover.ship copies /data/deploy-hosts.json into its shared dir once.
  • GET …/hub/scaffold/templates no longer imports backend/templates/.
  • Templates is the templates plugin (owner-only, templates.read): core backend/templates/, /api/templates, /api/template, /api/template-file and the Projects panel's Templates tab are gone; /templates[?t=<name>] redirects to /plugins/templates/templates[/<name>].
  • Slots: project.detail is mounted on a project's page (init {slug, isRoot, isWorker}). Its first user is the owner-only project-env plugin (since 2026-11-26): the .env editor (get / save actions over AIA_PROJECTS_DIR, the # --- secrets --- section write-only) — the core GET|PUT /api/project-env, projects/envfile.py and EnvEditor.tsx are gone; the slot folds to 0 px on the root and worker projects. Frames get aiAgentPlugin.copy(text) (the host writes the clipboard; a string ≤ 100 000 chars).

Machines, relays and attention (since 2026-11-26, the MCP servers plugin)

What the mcp-servers plugin (~/projects/ai-agent-plugins/plugins/mcp-servers) builds on — generic, nothing MCP-specific but the sidecar routes it reaches. Contract: homelab spec data/log/2026-11-26-ai-agent-mcp-plugin-spec.md §4. Both capabilities are owner only, operator-approved, and reach only the plugin's own handlers (aiah1 handler token, else 403 handler_only).

  • machines.mcp (plugins/hubmachines.py):
    • GET …/hub/machines → [{id: "local", name: "Homelab", kind: "lab", status, toolsUrl}, {id, name, kind: "worker", status, platform, account, toolsUrl}] — local first, then the owner's paired workers (never a guest's computer, never a pending one); status online|offline (the lab: the host sidecar's /health, cached 15 s). toolsUrl is the AIA_TOOLS_URL that machine's runs get (the lab TOOLS_PROXY_LAB_URL, default http://127.0.0.1:8096/proxy/tools; a worker core/state.tool_hub_url) — where it reaches a relay.
    • GET|POST|DELETE …/hub/machines/{machine}/mcp[/{rest}] → that machine's sidecar /mcp-servers[/{rest}] (the host sidecar for local), the JSON body and query passed through, the sidecar's status and JSON passed back as they are (its errors: {"detail": {message, kind}}). The bridge's own refusals carry the same detail (and error): offline or pending 409 worker_offline, a guest's computer 403 forbidden, unknown 404 unknown_machine, a machine refusing the hub's token 502 worker_auth, one that doesn't answer in time 504 timeout. Timeouts: POST /mcp-servers 300 s, login 60 s, login/callback 90 s, else 30 s.
  • relay.serve (plugins/relay.py) — authenticated streaming relays to upstreams whose credentials the plugin manages (the hub gateway: sign in once on the hub, every harness and machine goes through it). Stored in PLUGINS_DIR/relay/<pluginId>.json (0600; a purged uninstall deletes it).
    • PUT …/hub/relay/routes/{name} {upstream: "https://…", headers: {…}} (header values are secrets: stored, never returned; hop-by-hop names, Host and Accept-Encoding refused) → {ok, route}; DELETE …/hub/relay/routes/{name} → {ok}; GET …/hub/relay/routes → [{name, upstream (no query, no userinfo), headerNames, updatedAt, lastUsedAt, lastStatus}].
    • POST …/hub/relay/tokens {label, routes: [name]} → {id, token} — aiar1.<id>.<secret>, shown once, stored as a SHA-256; PUT …/hub/relay/tokens/{id} {routes?, label?} → {ok, token}; DELETE …/hub/relay/tokens/{id} → {ok}; GET …/hub/relay/tokens → [{id, label, routes, createdAt, lastUsedAt}].
    • The public route — GET|POST|DELETE /proxy/tools/relay/{pluginId}/{name} and …/{name}/{path}, Authorization: Bearer aiar1…. A token that isn't the plugin's or doesn't list name → 403 relay_auth (and counts toward the address's bad-token lock); a plugin not the owner's, disabled, unapproved or without relay.serve, or a route nobody made → 404; 404 on the owner's internet address, and 404 on the guest host except for a public token — machines come over the tailnet, but a dial-out worker (link, off the tailnet: the Orus devbox) reaches the hub only on the guest host, like its link. POST …/hub/relay/tokens {label, routes, public: true} mints such a token (PUT can flip it); GET hub/machines marks those machines public: true and gives them the guest host's tools URL (GUEST_PUBLIC_URL/proxy/tools). A wrong token on the guest host is a 404 as well.
    • Forwards to upstream (+ /{path}, + the caller's query after the upstream's own) with only Content-Type, Accept, Mcp-Session-Id, MCP-Protocol-Version and Last-Event-ID from the caller, plus the route's headers and Accept-Encoding: identity. Answers the upstream's status with only Content-Type, Mcp-Session-Id, MCP-Protocol-Version and Cache-Control (+ X-Accel-Buffering: no on an event stream). The answer body is streamed as it comes — an SSE event reaches the caller when the upstream sends it; no read timeout on an event stream, a JSON answer may idle 300 s between chunks (RELAY_IDLE_TIMEOUT_S) and take 600 s to start (RELAY_RESPONSE_TIMEOUT_S); connect 15 s. A request body with a Content-Length (≤ 16 MB) is read and sent whole, a chunked one streamed.
    • An upstream 401/403 becomes the relay's own 403 {"error": "relay_unauthorized", "message": "signed out on the hub — sign in again in MCP servers"}, without WWW-Authenticate: a harness must not start an OAuth flow of its own against the hub. Every refusal of the relay is a 403, never a 401 — a 401 sends an MCP client looking for the hub's own /.well-known/oauth-protected-resource (the hub's MCP server).
    • lastUsedAt / lastStatus are kept at once in memory and written at most once per route per 60 s, or when the status changes.
    • The owner's plugin: no egress filter (like the owner's proxies); https or http upstreams.
  • provides: {"machine.attention": "<action>"} (plugins/machine_attention.py) — what waits for the owner on each of his machines. The owner's providers run as the owner (stdin {"trigger": "machine.attention"}, ≤ 20 s) and answer {"items": [{machine, key, title, detail?, tone: "warn"|"error"}]} (machine = local or a worker id; ≤ 200). GET /api/machines/attention (owner, lab.read) → {items: [{pluginId, machine, key, title, detail?, tone}]}, cached 30 s. A provider's action that isn't readOnly, its webhook or scheduled job, and any install / reload / enable / disable / uninstall by the owner drop the cache and publish SSE {"type": "machine-attention"}. The machine page's Needs you strip draws each item of its machine (Open → the Tools tab, scrolled to the plugin's slot: ?slot=<pluginId> / #plugin-slot-<pluginId> — PluginSlots anchors); a worker's Setup checklist gets one row per provider ("2 MCP servers need a sign-in +1": the first item's title, +N for the others). The frontend fetches it only while /api/plugins lists the key in provides.
  • machines.wake (plugins/hubwake.py, the wake-on-lan plugin) — owner only, operator approval, handler only; each route answers at …/hub/… and at the alias …/bridge/…:
    • POST …/hub/wol (= …/bridge/wol) {mac, broadcast = "192.168.1.255", port = 9} → the host sidecar's POST /wol (sidecar/routes_wol.py: a UDP magic packet with SO_BROADCAST — the container can't broadcast on the LAN) → {ok, mac (normalised aa:bb:…), broadcast, port}. The MAC (aa:bb:cc:dd:ee:ff, : or -), a literal IPv4 broadcast and 1–65535 are checked in both places (400 bad_request).
    • POST …/hub/workers/{wid}/probe (= …/bridge/workers/{wid}/probe) → one workers.probe now (SSE workers when it moved) → {online, status, lastSeen}; a guest's, pending or unknown worker 404 unknown_machine.
    • GET …/hub/wake/workers (= …/bridge/workers) → {workers: [{id, name, host, hostname, status, running, lastSeen}]} — the owner's paired workers, no token, no URL (workers.read's GET …/hub/workers stays the harness view).
  • provides: {"machine.wake": "<action>"} (plugins/machine_wake.py) — the owner's first provider runs with {"trigger": "machine.wake", "op": "list"} → {machines: {<workerId>: {configured, mac, broadcast, autoWake, timeoutSec, lastWokenAt}}} (cached 30 s, dropped like attention's, SSE {"type": "machine-wake"}) and {"op": "wake", "machineId"} → {ok, sent, configured, autoWake, timeoutSec, …}. A run pinned to an offline worker (route_new_run's worker) and a resume of a session living on one call maybe_wake_and_wait: an autoWake worker is woken and probed every 2.5 s for its timeoutSec (clamped 10–120 s, default 60) before the 409 worker_offline; an unpinned run never waits — it takes the profile's next runner up. GET /api/machines/wakeable (owner, lab.read) → {machines}; POST /api/machines/{id}/wake (owner, workers.manage) wakes it and probes it every 3 s for 60 s (the card flips on SSE workers). Settings → Machines draws ⚡ Wake on an offline worker the plugin has configured (business/machines/components/WakeButton.tsx).
  • Carry-over — carryover.mcp_servers: once mcp-servers is installed and enabled for the owner (at start, and right after its install / enable), an old /data/mcp-servers.json (MCP_SERVERS_PATH) becomes its shared _private/servers.json (accounts: ["x"] → ["claude:x"], mode: "direct") and _private/overrides.json (lab.overrides → "local", each owner worker's mcpServerOverrides → its id), merged under what the plugin already has, then .carried-over. The old file is never deleted.

Scheduled conversations: drawer, send menu, app modal (since 2026-11-26)

What the scheduled-conversations plugin (Send later — the core's backend/scheduled/ and frontend/src/business/scheduled/ are gone) builds on. Every piece is generic; the plugin id appears in the core only in the legacy ?scheduled=<id> link and the CLI's door below.

  • Slot places (ui.slots[].where), each optional key written only when set:
    • conversations.drawer — a toggle in the conversations drawer's count row (icon: a lucide name; label: its tooltip; badge: a readOnly action answering {count} for {scope}, drawn on the icon). Toggled on, the drawer's body is a slim header row (the frame's setHeader({subtitle}), the toggle) and the frame filling the rest. init / update {scope} (the profile scope: all | profile:<id>). The choice is the drawer filter store's drawerSlot (plugin:<pid>:<slot>).
    • composer.send — one more item (label, icon) in both composers' send menus (not a guest's, not a New project). A tap freezes the payload the send would have made and opens the slot in the app's modal with init {send, spec, followUp} — send: {prompt, text, model, harness, thinking, effort, account, projects, worker, profile} (a reply box's: {prompt, text, targetSessionId, cwd, model, harness, thinking, effort}); spec: what the chips show (account / worker as routing would pick them, workerName, target = the conversation's title). Its result {sent: true} clears the composer like a send; anything else gives the draft back; drawer: true opens the plugin's drawer slot.
    • app.modal — a document in the app's modal (no host title; the close X sits top-right, keep ~40 px clear). Opened by aiAgentPlugin.openModal (slotId, init?) from any of the plugin's frames, or by the address ?modal=<pluginId>:<slotId> (the other params → init.query; a push's link). Closing drops those params from the address as it is then.
  • Bridge: openModal(slotId, init), and in a modal frame modal.setResult(obj) / modal.close(obj?) (no object: the last setResult); elsewhere they reject.
  • POST …/hub/changed (no capability) — "my data changed": SSE {"type": "plugin-data", id} to the installer, and the app refetches every read of that plugin (frames' query, the drawer badge). Call it after a write a job or another device made.
  • notify.action (event, the owner's installs): a push button was tapped — {notifyId, index, title}. hub/notify takes actions (≤ 3 button titles), spoken, and an app path as url (/… → the viewer's address), and answers {ok, id}.
  • conversations.title (capability, owner only, operator approval) — POST …/hub/title {text, kind?, ref?, account?} → the conversation.title provider's {title, summary}, {} when there is none.
  • runs.start, more of the composer's payload: worker: "auto" (+ profile: routed when it starts, like an unpinned prompt), account, projects, cwd, newProject, scheduled ({id, scheduledAt, shouldStartAt, manual?} → meta.scheduled, the card's pill); the answer adds where it went (worker) and who it bills (account). POST …/hub/runs/resolve {runners: [{key, harness, account, worker, profile, model, mode: "freeze"|"now"}], sessions: [sid], workers: true} → what routing would pick (or its refusal), each session's conversation id, title, runner and harness, the owner's machines (name, online, profile) and the profiles' labels. conversations.send takes model, harness, thinking, effort, cwd.
  • provides: {"runs.schedule": "<action>"} — {op: list | get | create | edit | cancel | start | title | upcoming, …} (plugins/schedule_bridge.py): /api/scheduled* forwards to it (the ai-agent later / scheduled / unschedule CLI and the MCP tools; a connection bound to a worker comes with AIA_USER_CONTEXT.viaWorker, viaWorkerName, workerMode — the plugin keeps it to that worker), the week's budget asks upcoming (30 s cache), and the stopped-run card's Resume at… calls it from the app. GET /api/plugins/ui names each key's plugin and action: providers: {key: {pluginId, action}} (usePluginProvider).
  • runScript(..., context=): host-vouched AIA_USER_CONTEXT keys (never uid / isOwner).
  • Carry-over carryover.scheduled: /data/scheduled.json → the plugin's shared scheduled.json, once, then .migrated.
  • Commands: the plugin declares ai-agent plugin scheduled-conversations ls | show | add | cancel | start (CLI only, no mcp). The core's ai-agent later / scheduled / unschedule and the MCP schedule_conversation / cancel_scheduled / browse scheduled stay on /api/scheduled for now: a connection bound to a worker gets no plugin tools (no plugins.use), and scheduling from the Orus Mac is one of its uses.
  • The plugin scheduler wakes a second past each half minute: a * * * * * job fires at :01.

Websockets, the lab browser and a full modal (since 2026-11-26, the Lab Chrome plugin)

What the lab-chrome plugin (~/projects/ai-agent-plugins/plugins/lab-chrome) is built on — the core's backend/chrome/ (Settings → Browser, the noVNC proxy, the on-demand life, the idle reaper) and the frontend's Browser dock are gone. Every piece is generic but chrome.lab, which is the core's own Chrome chip (the harness capability chrome) asking who runs the browser a lab --chrome run drives.

  • sockets[] (plugins/sockets.py) — a websocket a plugin's frames open through the host, to a target the plugin declares (≤ 4):

    "sockets": [{ "id": "vnc", "url": "ws://chrome:6080/websockify",
                  "subprotocols": ["binary"], "label": "The lab Chrome's screen" }]
    

    url is ws:// / wss:// host, port and path — no query, no credentials. A declared socket reaches the host's network: operator approval, in the approval fingerprint (only when declared), a consent line per socket.

    • The frame: aiAgentPlugin.openSocket(id, {protocols?}) returns a WebSocket-like channel at once (send(ArrayBuffer | typed array | string), close(code?, reason?), onopen / onmessage (e.data an ArrayBuffer, or a string) / onclose (code, reason, wasClean) / onerror, readyState connecting|open|closing|closed, protocol, binaryType) — what noVNC's RFB takes as its channel. ≤ 4 open per frame; a bad id closes it at once (4400), a fifth too (4429).
    • The host (frontend/src/business/plugins/frameSockets.ts, wired in PluginSandboxFrame) opens the real websocket, with the reader's cookies, and relays it over postMessage (aia-plugin-socket-open|send|close in, aia-plugin-socket out — binary as transferred ArrayBuffers); a frame that goes away closes its sockets.
    • The route: WS /api/plugins/{pid}/sockets/{sid} bridges to the declared url and nothing else. Owner only — the gate's rules on the handshake (sockets.ws_caller, formerly the chrome proxy's: same origin, the owner's Authelia user, never a read-only account, never the guest host; on the owner's internet address the session is re-checked every 5 s and the socket closed when it ends); the owner's enabled, approved install only. Refusals close before accepting (the browser sees a 403): 4403 who, 4404 an undeclared socket, 4502 the upstream is down.
    • Its life: GET /proxy/tools/plugins/{pid}/sockets/{sid}/probe (the plugin's own handlers, the owner's) → {up, open, lastActiveAt} — a TCP connect to the upstream now, the relays open, when one last carried a frame (epoch seconds, in memory: 0 since the hub started). The lab Chrome reads it for "reachable" and for its idle job ("someone is watching").
  • provides: {"chrome.lab": "<action>"} (plugins/chrome_bridge.py) — the browser a lab --chrome run drives. The host asks the owner's provider:

    • {op: "status"} → {reachable, chipDefault: off|running|always, guests} (cached 10 s, dropped when the plugin runs a non-read action or any owner plugin changes): runs/routes.py _guest_chrome keeps a guest's --chrome only with guests: true; the composer's chip default reads the same action itself (usePluginProvider("chrome.lab") + usePluginRead, payload {op: "status"}), so the action is readOnly.
    • {op: "ensure", sessionId, resume} — before a lab claude run launches with --chrome (runs/service.py, spawn and resume): bring it up and wait (≤ 120 s; a failure is logged, the run launches anyway). No provider: no guest keeps --chrome, nothing is started, the chip starts off.
  • ui.slots[].size on an app.modal slot: sm · md (default, not written) · lg · full — the app modal's width; full is near the whole screen and the frame fills its height (fill, its resize ignored): a live view, a canvas.

  • conversation.gizmos' update adds how the run was launched: chrome (meta.chrome) and worker (null = the lab).

  • hub/conversations rows carry chrome (launched with --chrome).

  • A module script in a frame: a frame's document is written with document.write, which never runs a <script type="module"> it parses. Keep a module (noVNC has a top-level await) as text and run it with createElement("script") + type = "module" (the lab Chrome's loadRFB).

  • Carry-over carryover.chrome: /data/chrome.json → the plugin's shared legacy-settings.json at once (read under its saved config), and into the owner's config once installed (at the install — _plugin_changed — or the next start; a key still at its field's default takes the old value), then ….migrated.

Resources: conversation pills from data (since 2026-11-26)

A plugin declares resource kinds — what a conversation can be about (a PR, an issue, a thread) — as pure data in resources[]. The host's in-process registry (backend/plugins/resources.py) matches them; no code of the plugin runs for it, ever. The core itself knows only branch and url: every link in a transcript is stored raw, so installing a plugin lights up every past conversation at view time with no re-parse. The reference manifests are the github / linear / slack fixtures in backend/fixtures/resource_plugins/ (the shapes the hub plugins ship).

Field What
id the kind (pr, linear, slack, jira…; not branch / url); one plugin per kind
label its noun (Pull request) — tooltips
urlRegex a link → this kind; its named groups feed the templates ((?P<repo>…), (?P<num>…))
idRegex an id → its groups (a stored / recorded id, conv add 13722); urlRegex or idRegex required
idTemplate the canonical id from the groups — a template or up to 4 tried in order: ["{repo|config.githubRepo}#{num}", "#{num}"]
urlTemplate the link of a record named by id only: https://linear.app/{workspace|config.linearWorkspace}/issue/{team:upper}-{num}
labelTemplate / titleToken the pill text / how it reads in a composite title — a template, or rules [{"match": "<regex on the id>", "template"}] (first hit wins; "" = none)
slugTitleGroup a group that is the title, slugged (separate-tenant → Separate tenant)
bareKeyRegex + bareKeyTeamGroup keys typed in prose (INS-2229) — kept only for teams seen in a real link (UTF-8 never)
branchKeyPattern what a git branch / a PR's head / what a PR body closes names (ins-2229-slug → INS-2229): cross-links between plugins that never import each other
ignoreUrlRegex this vendor's other links, dropped instead of shown as plain links (a repo's blob URLs)
namesGroup / dateGroup a group whose display name is learned (channelMap, channelMapRegex) — {name} in the label; a group holding an epoch (several pills of one label get their date)
needles templates ai-agent past searches excerpts for (pull/{num})
toolExtractors[] {tool, commandRegex?, inputTemplate?, tagOnCall?, kind?, idFields?, urlFields?, titleFields?, stateFields?, stateFlags?, metaFields?, xrefFields?, channelMapRegex?, textHint?} — tool is shell, a glob (mcp__*__get_issue) or *; field paths a.b, labels[].name; metaFields (labels, project, team) draw the card's work icon and Settings → Tags; a long xrefFields text contributes what it closes / fixes / resolves
icon, color a lucide name (linear = Linear's mark), a tone key (sky, violet…) or a hex
stateTones {"open": "emerald", "merged": "violet"…} — the pill by its state (Resource state switch)
clickAction open (default) or copy (its id)
priority lower = the primary first (linear 10, pr 20, slack 30; default 100)
hueRole hue / shade: the card colour's subject (issue hue, its PRs shades — conversations/look.py)

Templates: {group}, {a|b|config.key} (first non-empty), {{config.key}}, filters :upper :lower :nodot :title. Every regex is compiled at install and refused with nested quantifiers ((a+)+ — they run over every prompt and tool result). Only (id, urlRegex) enter the approval fingerprint.

Scope is the plugin's settings (declare the fields in settings.fields): workers (runner ids; local = the lab) and cwdGlobs — empty = every conversation — notifPills (pills on its conversations' pushes), channelMap (C0123=name lines); any other text setting is {config.<key>}. A setting never saved reads as its field's default. GET /api/plugins → ui.resources lists the display descriptors (id, label, icon, color, stateTones, clickAction, priority, hueRole, pluginId) the app draws pills with; a kind whose plugin is gone still draws as a link. conv add <url|key> sends links and keys raw — the hub's registry reads them.

Harness hooks (harnessHooks[], since 2026-11-26)

A plugin hooks into the agent harness's own hook points (Claude Code's --settings hooks) on the lab and on paired workers — the first user is the gcloud-reauth plugin, which replaced the core's sidecar/gcloud_reauth.py. Validation, scope and materialization: backend/plugins/harness_hooks.py; the sidecar's side: sidecar/plugin_hooks.py.

"harnessHooks": [
  { "id": "gcloud-expired", "harness": "claude", "event": "PostToolUse", "matcher": "Bash",
    "excludeCommandRegex": "gcloud\\s+auth\\b",
    "outputRegex": "invalid_rapt|reauthentication failed|gcloud\\s+auth\\s+login",
    "message": "Google sign-in expired on this machine: use the gcloud-login skill, then retry." },
  { "id": "custom", "harness": "claude", "event": "PostToolUse", "matcher": "Bash",
    "script": "hooks/my_hook.py", "timeoutSec": 10 }
]
  • Declarative (message + commandRegex / excludeCommandRegex / outputRegex, ignoreCase default true; PreToolUse / PostToolUse): the sidecar's stdlib runner evaluates it — a match adds message as the call's additionalContext. No plugin code runs anywhere, so the owner may approve it. Output is scanned on its last 200 KB; the runner always exits 0.
  • Script (script: a .py file inside the plugin, ≤ 256 KB; timeoutSec 1–60; also UserPromptSubmit / Stop / SessionStart): the harness runs it as the hook (python -I). Code on every machine it reaches: operator approval (requires_operator).
  • matcher (a tool-name regex) is required on tool events. Every regex is compiled at install and refused with nested quantifiers, as resources[]; paths can't leave the plugin dir; at most 16 hooks. The whole declaration (regexes, message, script, guestAllowed) is in the approval fingerprint — a plugin without the key keeps its old one.
  • Where — the plugin's settings (declare the fields): where (workers | lab | all, default all), profiles (profile ids; empty = any), workers (runner ids, local = the lab; non-empty overrides the other two). A value never saved reads as its field's default. Only the owner's enabled, approved installs count.
  • Guests — a guest's computer, and a guest's scoped run on the lab, get a hook only with guestAllowed: true (default false; a guest's computer is in no profile, so a profiles filter leaves it out too).
  • Delivery — the lab: PluginStore.sync_hooks() writes /data/plugins/live-hooks/ (index.json with the rules that apply to local, + script copies under <plugin>/<path>) on every owner plugin change and at the backend's start; the host sidecar reads it at each launch (SIDECAR_LIVE_HOOKS_DIR). A worker: its /sync bundle carries hooks ({hash, rules, files}, filtered by its runner id and profile — the bundle hash moves with it, {} clears), written to ~/.ai-agent-worker/hooks. SIDECAR_PLUGIN_HOOKS=0 turns them off on a machine.

Handlers vs callers (since 2026-11-25)

A plugin has two doors: its actions (handler scripts, where its rules — ownership, quotas, pricing, Pro gating — live) and its raw proxy. A handler subprocess gets a handler token (AIA_TOOLS_TOKEN = aiah1.<uid>.<pid>.<exp>.<sig>, toolproxy/access.mint_handler), valid only for its own plugin's routes and never on the public guest host; a guest's run keeps its aiat1 token. So the proxy can tell the plugin's code from a guest calling upstream directly:

  • proxy.handlerOnly (default for every rule) / per-rule handlerOnly — refuse callers (403 handler_only); open only the rules a skill must stream itself (uploads, big downloads).
  • per rule: query (param → regex, matched on the query string or a form body; rules are first-match, so a narrow rule goes first), forcedParams (set server-side for callers: {{user.id}}, {{user.tag}} = owner / guest-<uid>, {{user.domains}}, {{config.k}}), noAuth (no secret injected), units (ledger units), creates (checks and counts jobsPerDay), owned ({group, file, key}: the path's named group must be in json(<data dir>/<file>)[key] for a guest).
  • Data paths under _private/ are written only by handlers.
  • Handler calls to their own proxy skip the limits, the in-flight slot and the ledger row — the outer action did all three (its _meter).
  • Streams enforce proxy.maxBytes both ways.
  • Handler env adds AIA_PLUGIN_SHARED_DIR (one hub-scoped dir per plugin, never on the data API — use it instead of reading other users' dirs) and AIA_USER_CONTEXT.{name, lang, sessionId}. A handler may answer {"_error": {"status", "kind", "message"}} to choose its HTTP status. Action timeoutSec ≤ 900.
  • An action marked "readOnly": true (it only reads: list, get, health…) also answers GET /api/plugins/{id}/actions/{name}?payload=<json> (≤ 8 KB). A read-only account (the screenshot skills' bot) may only use safe methods, so its plugin pages send every action as a GET: a readOnly one runs, any other gets 405. Mark every action a page calls on load.
  • Hub events a plugin can subscribe to (events[].on, the owner's installs): conversation.started — {sessionId, prompt (≤ 4 000 chars), projects, worker ("local" = the lab), owner, origin}, when a new run launches (runs/service._dispatch_started; Plans links the run its Implement opened) — and conversation.finished — {sessionId, state, exitedAt} (runs/sidecar_client._mark_run_exited).
  • hub/notify takes session (push in that conversation; a guest only their own), i18n ({"fr": {title, message}}) and to (a user, when no session).
  • webhooks[i].internalOnly → 404 on the public guest host.
  • UI bridge: window.aiAgentPlugin.navigate(path) opens an app path.

Waking a sleeping service (proxy.wake, since 2026-11-26)

A plugin whose internal: true proxy calls a container the homelab's services-manager stops when idle (a Dynamic service — a call on its name fails with a ConnectError: a stopped container has no Docker DNS entry) declares the service to wake:

"proxy": {
  "baseUrl": "http://music-dl:8080",
  "internal": true,
  "wake": { "service": "music-dl", "holdMinutes": 15 },
  "allow": [{ "method": "GET", "path": "^api/.*$" }]
}
  • service — the services-manager name, ^[a-z0-9][a-z0-9_.-]{0,62}$; holdMinutes — an integer 1..240 (default 15): services-manager won't put it back to sleep before then. Refused without internal: true.
  • Before each forward / open_stream (so proxy.inspect too), the proxy POSTs $SERVICES_MANAGER_URL/api/services/<service>/wake?hold=<holdMinutes>&wait=60&trigger=cli (default http://services-manager:8080, 70 s timeout). At most one wake per service per 60 s (a 2xx answer is cached; concurrent calls share one wake); on an awake service it only extends the hold, so it keeps sliding while the plugin is used.
  • A call that still gets a ConnectError forces a wake (past the cache) and is retried once — a streamed upload only if none of its body was read.
  • services-manager down or refusing (e.g. a service set to Always on → 400) is logged and the call goes ahead; a failed wake isn't cached.
  • In the approval fingerprint only when declared: plugins without it keep theirs. The install screen's proxy line adds "wakes service <name>".

Tool cards that stand in the chat (inThread, since 2026-11-26)

By default a plugin tool card (ui.toolCards[]) renders inside the expanded body of the call it matches — so it folds away with the tools (the summary's "3 tools", a "Ran 2 commands" group). A card the reader comes back for (the Music plugin's download card) declares:

{ "id": "music-card", "match": { "tool": "shell", "commandRegex": "\\bmusic\\s+(get|status)\\b" },
  "html": "ui/music-card.html", "height": 110,
  "inThread": true, "keyRegex": "\\bjob ([a-f0-9]{12})\\b|\\bmusic\\s+status\\s+([a-f0-9]{12})\\b" }
  • inThread: true — the card stands in the chat where its call happened, in place of the call's row, never folded into a tool group or the summary; a small details toggle under it opens the call's command and output (without drawing the card twice). Behind the Rich widgets switch.
  • keyRegex (only with inThread; needs a capture group) — one card per key: the key is the first non-empty group, matched over the command and the output (a job id is often only in what the call printed). A later call on the same key is a plain row that folds away with the tools; a call with no key yet (still running) is its own card.

The frontend marks the calls before grouping the thread (planPluginThread, business/plugins/components/PluginToolCard.tsx); the Conversation page renders them with PluginThreadCard (ToolUse.tsx). The fields join the manifest's ui only when set (existing fingerprints don't move). Form music-card-placement-in-the-chat_e3rhec.

Fenced blocks in messages (ui.fences, since 2026-11-26)

A plugin can draw a fenced block of an agent's message — ```chart → the Charts plugin's frame, inside the message, where the agent talks about it (form charts-plugin-how-the-agent-draws-it_aveht1):

"ui": { "fences": [
  { "id": "chart-fence", "lang": "chart", "label": "Chart", "html": "ui/chart.html", "height": 330,
    "vis": { "key": "charts", "label": "Charts", "hint": "the charts agents draw in the thread" } }
] }
  • lang is the block's info string (2–32 of a-z 0-9 _ + -). A language people write code in (python, json, sh, csv, sql…) and notify (the closing push) are refused (_FENCE_RESERVED); at most 8 per plugin, one per language. Two active plugins on one language: the first keeps it.
  • The frame's init is {fence, code, sessionId, conversationId, lang} — code is the block's text without its fences. It has no update: a block never changes once written. Drawn with the tool cards' border, sized by resize(px) (height is the first paint's).
  • Only assistant messages in the thread (PluginFenceScope around AnimatedMessage, business/plugins/components/PluginFences.tsx); a user's message, a tool output and a subagent's report keep their code blocks. While the block is still being typed (no closing fence yet) a dashed placeholder holds its room, so the frame loads once.
  • Behind the Rich widgets switch and the fence's own vis switch (a tool card of the same plugin may share the key: one switch for both).
  • Host side: technical/Markdown.tsx's pre renderer asks the FenceRendererProvider (null → the code block as before), fenceOf reads the language, the code and whether the closing fence is there (the pre node's source offsets). GET /api/plugins → ui.fences (no html), the document is /api/plugins/{id}/ui/fence/{fenceId}. An older hub ignores the key, so a plugin can ship it before the hub does.

The widget platform: slots, live updates, home tiles (since 2026-11-26)

The core widgets of the home page and the conversation page move into plugins through these points (backend/plugins/manifest.py, home_tiles.py; frontend/src/business/plugins/ — PluginSandboxFrame, PluginSlots, hostBridges, ConversationPluginPlaces). Every optional key below is only written into the normalized manifest when set, so a plugin that doesn't use it keeps its approval fingerprint.

More slot places (ui.slots[].where): home.section (a full-width section of the home feed, above Waiting for feedback; init/update {profileScope, scope, guests}), conversation.pinned (a slim bar above the composer; update {sessionId, conversationId, running, thread: {commands}} — the last 200 shell calls, results cut at 800 chars), conversation.threadFooter (the strip under the last message; update {sessionId, running, genProgress, motionOn}), conversation.gizmos (a pill in the thread's corner row, sized both ways by resize(h, w); update {sessionId, running, deployedUrl, deploys}), conversation.threadHeader / conversation.threadEnd (the thread's first and last line; update {sessionId, conversationId, running, pluginData} — see "Menu items, thread places and conversation data"). A typed (kind: "provider") plugin may declare slots too.

Optional slot keys: label (≤ 48 chars — its card's name in the Details drawer; default the plugin's name), defaultStashed (starts benched), vis: {key, label, hint, defaultOff?} (a switch under Plugins in the conversation's eye popover, stored as plugin:<pluginId>:<key>; off = the slot isn't drawn), events (a subset of askform, meta, transcript, usage: the host forwards those SSE events — {type, id?, ids?} only — to aiAgentPlugin.onEvent).

Tool cards also take vis and events, and match.hasField (deploy, commits, subagent, bashDiff: the thread item must carry that field — e.g. {"tool": "shell", "hasField": "deploy"} is every call the backend's deploycmd recognised). A card's init is the call (tool, toolUseId, mi, ts, sessionId, conversationId, input, result, isError, deploy, deployedUrl, lang); its update is what moves (result, isError, deployedUrl, running). A call an inThread card claims is the plugin's.

conversation.details: one card per slot. Each slot is its own rearrangeable card (plugin:<pid>:<slotId>); the retired core cards' ids map onto the plugin cards that replaced them (DETAIL_CARD_RENAMES in Conversation.tsx), so a saved arrangement keeps its slots. Every such slot gets the conversation's compact snapshot as update (cost, tokens, usage, models, byModel, byTool, plan units / %, fast calls, the price book, local, artefacts, per-turn turns, the reader's currency and language) — enough to draw without a subprocess.

The bridge (window.aiAgentPlugin), besides the v2 calls: onUpdate(cb) (the latest update is replayed to a late subscriber; a new one never reloads the frame), setEmpty(bool) (a bare slot's resize(0) means the same — the slot then takes no room but stays mounted, so a later update brings it back), onEvent(cb), scrollTo({formId | toolUseId | mi}), openMediaViewer({slides, index}) (hub media paths or https://), openPreview({url, title}) (http(s)), mediaUrl(url) → a blob: URL of a hub media file (/api/artefact, /api/screenshot, /api/upload-file, /api/data-asset, /api/scratchpad-asset; image or video, ≤ 25 MB) fetched by the host with the reader's cookies — the frame's "null" origin can't.

provides: {"home.tiles": "<action>"} → GET /api/plugins/home-tiles?scope= &profileScope=&composerHarness=&tzOffset= (app.read). The action gets {trigger: "home.tiles", scope, profileScope, composerHarness, tzOffset} and answers {tiles: [...]}; each tile is {id, kind, label, fixed?, defaultBench?, to?, title?, stale?, sub?} plus its kind's fields — arc (pct, resetsAt, goal), burn (usdPerHour, pctPerHour, neededUsdPerHour, neededPctPerHour, projected, goal, windowMinutes), stat (value, or valueUsd / subUsdPerDay formatted in the reader's currency), sparkline (days [{date, value, label?}], isCost), bar (value, max, text, over). Sanitized server-side; cached 5 s and on any plugin change. The home strip draws them natively; reusing a retired core tile's id (h5:<acct>, week:<acct>, fable:<acct>, burn:<acct>, billing:<acct>, spark, today, week_cost, convs, tokens — tokens starts benched) keeps its saved slot. Two read-only owner bridges feed such an action: GET /proxy/tools/plugins/{pid}/hub/usage/home (usage.read: {limits, burn, accounts, profiles}) and GET …/hub/activity/daily?days=&scope=&tzOffset= (activity.read: {days: [{date, cost, tokens, conversations}]}).

The core widgets this retired (2026-11-26)

With the nine plugins built on these points, the core copies are gone — no plugin installed means no such widget (the data stays: deploycmd still stamps deploy / deployedUrl, the backend routes are unchanged):

was core now
home strip: the owner's plan gauges, burn rate, renewal, sparkline, $ today / 7 days, conversations, tokens plan-usage + activity home tiles (the core keeps a guest's own Claude gauges + budget and the Guests profile's budget bars)
Waiting for feedback / the bell / ] u: pending ask-forms read from /api/ask-form/forms the ask-form plugin's inbox.waiting (usePluginInboxWaiting)
Details: Footprint, Plan usage, EVOX2 time, Forms, Artefacts, Cost by activity, Cost growth environment, plan-usage, provider-evox2, ask-form, artefacts, cost-charts detail slots
thread: movie cards + pinned films, screenshot card, deploy card + corner gizmo, ask-form CLI card, the EVOX2 generation strip movies, artefacts, deploy-preview, ask-form tool cards / pinned / gizmo slots, provider-evox2 thread footer

Kept core: ArcGauge / BurnGauge / PluginTile, ImageWidget / VideoWidget, FormDock + AskFormFrame, the hoisted subagent forms (AgentFormCard → AskFormCard), lib/footprint.ts (a guest's Stats), and the host-side previewSandbox / threadDeployUrl (lib/previewSandbox.ts). The eye popover's Footprint, Movie cards and Deploy preview switches went with their widgets (the plugins' own vis switches replace them).

Menu items, thread places and conversation data (since 2026-11-26, the Handoff plugin)

Handoffs left the core for the handoff plugin (~/projects/ai-agent-plugins/plugins/handoff); these generic points are what it is built on — nothing in them knows about handoffs.

  • ui.menuItems[] — {id, where: "conversation.menu", label (1–40), icon?, html, height? (80–900), title? (1–60)}, at most 8 (manifest._menu_items, only written when set). The conversation list's right-click / long-press menu (ConversationMenu) draws one row per active plugin's item after its own rows; a click closes the menu and opens a Modal holding the item's sandboxed frame (PluginMenuItems.tsx, html at GET /api/plugins/{pid}/ui/menuItem/{id}), init {where, itemId, conversationId, sessionId, title, harness, worker, running, archived}. GET /api/plugins/ui → ui.menuItems lists them (with pluginId / pluginName).
  • Frame bridges: aiAgentPlugin.close() closes the dialog the frame is in (answers {ok: false} elsewhere); aiAgentPlugin.toast(message, tone) shows the app's toast (tone success / error / info, ≤ 300 chars).
  • Thread places: conversation.threadHeader (the thread's first line, under the fork banner) and conversation.threadEnd (its last, after the summary) — ThreadPluginSlots in ConversationPluginPlaces.tsx. init {sessionId, conversationId}; each slot's update is {sessionId, conversationId, running, pluginData}, pluginData being its own plugin's meta.plugins.<id> on the conversation (null when it wrote none) — so a slot draws with no call when there is nothing, and resize(0) folds it away. vis / events work as on the other slots.
  • ConversationDetail.pluginData — {<pluginId>: object}, meta.plugins as it is, for the owner only (null for a guest: only the owner's bridges write it).
  • conversations.data (capability, operator approval, the plugin's own handlers, owner only — plugins/hubconvdata.py): GET …/hub/conversations/{sid}/data → {sessionId, data}; POST the same path {data: {…} | null, merge = true} (≤ 16 KB) sets meta.plugins.<id> — merge merges the top-level keys (a null value drops one), data: null without merge clears it — then publishes SSE meta for the conversation (its page refetches; the slots get the new pluginData). sid is a session or a conversation id; 404 not_found when the hub knows neither its transcript nor its meta (a run just spawned has its meta); a guest's conversation 403. A runs.start run's data lands in the same key.
  • runs.start also takes test: true (stamped meta.test: archived once its turn ends — the Handoff plugin's cold-path writer).
  • hub/conversations rows carry model (the context model, else the model) and harness (meta, else the transcript's, else claude).
  • Carry-over: carryover.handoffs copies the core's old meta.handoffFrom / meta.handoffTo stamps (2026-11-24 → 26) into meta.plugins.handoff.from / .to at start, where they aren't yet; the old keys stay, unread.

Pages: full-height and themed (since 2026-11-25, the Graph plugin)

  • A ui.pages[i] with "fill": true takes the whole area under the page header (a canvas, a map) instead of growing with its content; its resize() calls are ignored. The key is only written when true, so pages installed before keep their approval fingerprint.
  • Every sandboxed frame gets the app's palette: aiAgentPlugin.init.theme ({scheme: "dark"|"light", tokens: {"--primary": "24 95% 53%", …}}), the tokens set on its <html> (use hsl(var(--card))…) with the dark class, and aiAgentPlugin.onTheme(cb) when the app switches theme or accent.
  • The frame has no network and no app CSS: keep the page self-contained (inline script and style, no CDN) and get data through an action.
  • A frame no longer reloads when its host re-renders (its init is compared by value).
  • A page's init.scope is the app's profile scope as the dashboards send it (profile:<id> | all, since 2026-11-25, the Environment plugin), so a dashboard page opens on the profile the app is on.
  • init.query is the page address's search params as an object (a repeated key keeps its last value) and init.origin the app's window.location.origin (since 2026-11-26, the MCP servers plugin's OAuth callback: /plugins/mcp-servers/callback?code=…&state=…).
  • ui.pages[].nav is dashboards (default), tools, main, files or none: routable at /plugins/<id>/<page>, listed in no nav nor on the plugin's info page — a page a flow opens (an OAuth redirect target). A tools page is also a target of the settings search (under Settings → Plugins).

Pages that feel native: reads, header, kit (since 2026-11-26)

A plugin page is drawn as one of the app's own pages: the app's header carries its title, subtitle and buttons; the frame is borderless across the content area; a skeleton holds its place until it has painted, then it fades in. Three bridge calls make that happen, and one stylesheet.

aiAgentPlugin.query(action, payload, onData) — reads that paint at once

const q = aiAgentPlugin.query("list", { scope: init.scope }, (data, meta) => {
  if (meta.error && !data) return showError(meta.error);
  render(data);            // called again when a fresher answer lands
});
// q.refresh() — this read again · q.stop() — unsubscribe
  • onData(data, meta) runs at once with the last answer this device kept (meta.fromCache: true, meta.fetching: true) and again with the fresh one (fetching: false). meta.at is when the answer was made; meta.error is set when the last fetch failed (data is then the last good answer, or null). An identical answer isn't delivered twice.
  • The host keeps the answers (memory, then its own IndexedDB store — frontend/src/business/plugins/pluginData.ts, not busted by app deploys; at most 150 answers, least recently used dropped). The same read from two frames (a page and its slot) is one request.
  • Learned preload: the reads a page makes in its first 8 s are remembered per page; the next visit starts them as the route mounts — in parallel with the page's document loading and its frame booting — so the frame's query usually finds its answer already there or in flight.
  • The header's refresh button (shown once the page has a read; hide it with setHeader({refresh: false})) runs every read of the page again and spins while any of them runs — a page drops its own refresh button.
  • Use it for what a page reads on load and on filter changes; keep action() for writes (save, delete, run). Mark the action "readOnly": true in the manifest (the screenshot bot's GETs need it, and the hub then shares identical calls in flight — below).

ready(), setHeader(h), onHeaderAction(cb), onRefresh(cb)

  • Readiness: the skeleton goes when the frame's first read has answered and its callback has run (automatic), when the page calls aiAgentPlugin.ready(), or when it booted without any read (an older page that loads with action() shows at once with its own "Loading…"). 8 s at most.
  • aiAgentPlugin.setHeader({subtitle, actions, refresh}) — the page's line in the app's header: subtitle (≤ 140 chars: a count, the scope — "302 memories"), actions (≤ 4: {id, label, icon?, primary?, disabled?}, icon a lucide name), refresh (false hides the refresh button). Call it again whenever it changes. A page that sets a header drops its own title row: the app's header already names the page.
  • aiAgentPlugin.onHeaderAction(id => …) — one of those buttons was pressed.
  • aiAgentPlugin.onRefresh(() => …) — the refresh button was pressed (reads made with query are re-run by the host on their own; this is for the rest).

The UI kit (aia-* classes)

Every plugin frame gets the kit before its own styles (frontend/src/business/plugins/pluginKit.ts): the app's font and colours, and classes a page opts into — nothing changes under a page that uses none.

Class What
aia-page (+ aia-narrow) the page's container: centred, 1080 px (768 px) wide, 16 px padding, border-box inside
aia-stack · aia-row · aia-toolbar · aia-spacer · aia-grid (--aia-col: 260px) layout
aia-card (+ aia-link, aia-active) a card in the app's look; aia-link = clickable
aia-title · aia-subtitle · aia-section · aia-muted · aia-small · aia-mono · aia-truncate text
aia-btn (+ aia-btn-primary, -danger, -ghost, -sm, -icon) buttons
aia-input · aia-select · aia-textarea fields
aia-seg (buttons inside; aia-active / aria-pressed) · aia-chip (+ aia-count) segmented control, filter chips
aia-badge (`data-tone="primary success
aia-table (+ aia-num cells) tables
aia-empty (with a <strong>) · aia-error · aia-note empty state, error, callout
aia-skeleton · aia-spin · aia-hidden placeholders, a spinning icon

A page's own loading state is the host's skeleton: don't draw a "Loading…" line for the first paint (draw aia-skeleton blocks for a later, partial load).

The hub side

  • GET /api/plugins/ui — what every app page reads: the live UI descriptors, the provides keys and each active plugin's {id, name, kind, description, icon, iconUrl, color, config} (a few KB; GET /api/plugins, ~250 KB with every manifest and the catalog, is for Settings → Plugins only). A page's descriptor carries its plugin's description — the Dashboards / Files nav subtitle; plugin pages sit in the same rearrangeable list as the app's.
  • Identical readOnly actions in flight (same caller, plugin, action and payload) run once and share the answer (backend/plugins/singleflight.py).
  • composer.shortcuts / composer.mode providers are stale-while-revalidate (backend/plugins/swr.py): past their TTL (60 s / 30 s) the last answer is served while the plugin runs again behind it (up to 1 h / 10 min old); inbox.waiting is always asked fresh but concurrent calls share one run.

Overlays: drawing over a page (since 2026-11-25, the Pets plugin)

ui.overlays[] puts a transparent sandboxed frame over a whole page — the app's content area, everything above the navbar — for a plugin that draws on top of it (the pets plugin's hamsters). Decided with Gabriel in forms pets-as-an-overlay-plugin_wl2w72 and how-the-pet-moves-on-the-page_6k4gry.

"ui": {
  "overlays": [
    { "id": "conversation", "where": "conversation", "html": "ui/overlay.html", "pointer": "hits", "cursor": true },
    { "id": "home", "where": "home", "html": "ui/overlay.html", "pointer": "hits" }
  ],
  "prefs": [
    { "key": "enabled", "type": "switch", "label": "Pets", "default": true },
    { "key": "size", "type": "range", "label": "Size", "min": 28, "max": 96, "step": 2, "default": 46, "unit": "px" },
    { "key": "color", "type": "color", "label": "Your hamster", "default": "#f4b66a", "swatches": ["#f4b66a"],
      "labels": { "fr": { "label": "Ton hamster" } } }
  ]
}
  • Places (where, one overlay per place and plugin): conversation (a conversation page) and home (the home page). The host (frontend/src/business/plugins/overlay/) mounts the frame fixed over [data-overlay-world], z 30 (popovers stay above), only while the Animations switch is on (reduced motion counts) and the eye menu's Plugin overlays switch is on.
  • Never on an iPhone or iPad (overlaysSupported(), since 2026-11-26). iOS hit-tests a swipe against the frame's own document, not against the page under it. So a frame over a scroller swallows every scroll gesture, even at pointer-events: none, while taps still go through. Guests on iPhone (pets on by default; off for the owner) couldn't scroll a conversation. The plugin's Your preferences says it isn't shown there. Bringing them back needs a test in the iOS Simulator first (Mac perso).
  • What the frame gets — and nothing else (aiAgentPlugin.overlay.on(kind, cb); the last value of each kind is replayed to a late subscriber):
    • layout — {w, h, surfaces: [{id, x, y, w, h, anchor?}], anchors: {key: box}}: the outlines of the page's solid boxes (cards, code blocks, buttons, the composer — pet-pet's own "solid" rule) near the screen, frame px, ≤ 400; rescanned on DOM changes, re-measured on scroll and 4×/s, posted only when it changed. A home Running card carries its conversation id (data-overlay-anchor → anchor). Never text.
    • members — the page's conversations: {id, color (#rrggbb), state, mood, ending?}; mood = busy | waiting (a form waits) | error | done | free (feed.ts). The conversation page has one; home has the running cards (ending while a card leaves the rail).
    • event — {type: "stamp", id, stamp} (committed / pushed / merged / deployed / notified, as they land) and {type: "message", id} (Claude wrote a new message — conversation page).
    • prefs — the person's ui.prefs values; pointer — {x, y} while the page has the pointer (cursor: true only; replayed in the frame as a synthetic pointermove).
    • aiAgentPlugin.init = {where, lang, theme}.
  • Clicks (pointer): none — the frame never takes the pointer. hits — the frame reports the boxes it draws (overlay.setHits([{x, y, w, h}])); the host keeps ≤ 16 boxes, ≤ 240 px a side, ≤ 15 % of the frame together (hits.ts), and flips the frame to pointer-events: auto only while the pointer is inside one, or a press that started there is down. The bridge reports that itself from the frame's own events; a frame that goes quiet for 1.5 s, or holds a press past 60 s, loses the pointer. Every other click reaches the page.
  • Preferences (ui.prefs[]: switch · range · color · select, ≤ 12): per person, kept in their own settings blob (settings.pluginPrefs[<id>], server-side ui-state, so guests have theirs), drawn as Your preferences on the plugin's page (a guest's provided-plugin page too). A switch named enabled is the overlay's off switch. Not in the approval fingerprint.
  • The consent card says what each overlay sees and whether it takes clicks.
  • The frame has no network: inline everything (the pets plugin's build.sh inlines pet-pet's IIFE build).

Typed plugins: providers and harnesses (since 2026-11-26, Wave 1A)

A plugin's "kind" says what it is: "app" (the default — every plugin before this), "provider" (a model vendor: its models, pricing, plan meter, accounts, an optional sidecar usage reader) or "harness" (an agent CLI the sidecar drives: knobs, caps, login, the vendors it runs with their --model templates, its sidecar driver). The contract is the homelab spec data/log/2026-11-26-ai-agent-typed-plugins-spec.md; the validators are backend/plugins/typed_manifest.py.

  • Operator only: requires_operator() is true for both kinds, the id must start with provider- / harness-, and only the owner installs one (a guest's install is refused). Their kind and what their block can reach (sidecar dirs, URLs, accounts, caps, login) are in the capability fingerprint — an app plugin's fingerprint is unchanged.
  • Live bundles (PluginStore.sync_typed, after every install / reload / enable / disable / config change / uninstall of one): the enabled harnesses' sidecar/ (+ runner/) and plugin.json into PLUGINS_DIR/live-harnesses/<id>/, the providers' usage reader, plugin.json and non-secret config.json into live-providers/<id>/, each with an index.json ({version, hash, harnesses|providers: {…, hash}}). A change asks the host sidecar for POST /harnesses/reload (best effort, off the request thread). live_harness_bundle(guest_only=True) keeps the guestAllowed harnesses (what a guest's computer gets).
  • Accounts are editable from the provider's settings: PUT /api/plugins/<id> {config: {accounts: [{id, …}]}} — an override of a declared account, a new one, or {id, removed: true} (store.clean_provider_accounts, a 400 on anything invalid).
  • ProviderRegistry (backend/plugins/providers.py, cached on PluginStore.version, bound in build_state so providers.current() works without deps): ids, accounts (aliases: opencode-lab → evox2; guest-<uid>), canonical models (Anthropic / APPE discovery in a background thread, 6 h, disk copy under PLUGINS_DIR/discovery/), catalog_entries() (the /api/models list, synthesized from provider models × harness supports), rates_for / usage_cost / price_call / plan_units / local_call — the same floats as conversations/pricing.py (test_typed_plugins checks every book row) — and the pricing of a provider since disabled (PLUGINS_DIR/pricing-snapshot.json). GET /api/providers is its api_payload() (app.read; a guest gets the guest-allowed harnesses and no accounts).
  • Pricing reads only the registry (Wave 3B): conversations/pricing.py holds no table — it is a facade over plugins/seed_registry.effective(): the bound store's registry when it has ever known a provider (strict), else the seed dir's (PLUGINS_SEED_DIR, the plugins checkout, then backend/fixtures/typed_plugins/) — for standalone parses, scripts and unit tests. The usage poller reads each usageReader vendor at GET /usage/{vendor} (legacy /claude|opencode|agy/usage on a 404).
  • Seeding: at start carryover.seed_typed_plugins installs (and promotes to the catalog) every provider-* / harness-* plugin of PLUGINS_SEED_DIR (else ~/projects/ai-agent-plugins/plugins) the owner doesn't have, once each — an uninstalled one is never seeded again (installed.json → seeded). PLUGINS_SEED_DIR="" turns it off.
  • Reference plugins mirroring the hard-coded tables of 2026-11-26: backend/fixtures/typed_plugins/. Until the Wave 3 cutover, conversations/pricing.py, models/catalog.py and accounts/profiles.py still answer every caller.

The sidecar hooks of a typed plugin (2026-11-26, Workstream A)

What the sidecar core leaves to its typed plugins, and the names it calls them by (sidecar/harness_base.py, usage_loader.py, routes_harnesses.py) — every one optional, a plugin that lacks it is simply skipped:

  • provider.sidecar {dir, entry} — a provider's sidecar module that is no usage reader (one module per provider: declare this or usageReader, not both; typed_manifest.py). Materialized and synced like a reader, loaded by usage_loader; the hub never polls /usage/<vendor> for it. provider-evox2 ships one: sidecar/driver.py + gen_progress.py / local_room.py / local_ready.py (they were the core's).
    • live_progress(sid) -> dict | None — GET /sessions' progress of a run (usage_loader.live_progress, first non-empty answer);
    • before_launch(harness, model) — called by launch._launch before every launch (usage_loader.before_launch; the EVOX2: free the other server's idle model);
    • extra_routers() — mounted like a harness driver's (/local-ready, host only: the module returns [] on a worker).
  • Harness driver hooks beside the spec's §3.2 methods:
    • health_meta() is merged into /health — harness-claude adds agentsMax, agentKeys, codeMode and, on a worker, ownLogin (they were the core's);
    • session_meta(sid, rec) -> dict — merged into the run's GET /sessions row (harness-claude: codeMode, the Code Mode banner);
    • extra_routers() — harness-claude: POST /tasks/output / /tasks/stop (bgtasks.py); startup(ctx) installs its account-wide hooks (turn_hook.py, conv_ref_hook.py);
    • setup_check(tc) -> dict — the harness CLI's row of a worker's Setup checklist; tc is the core's tools_check module (_run, _which, _first_line, _own, _status, harness_row). No hook: a bare "on PATH" row (tools_check.check_plain).
  • harness.workerSetup {tool, order, guestAllowed, update, enablesHarness, installerEnv, recipe} — what a worker's Setup checklist may install for this harness, by name only. Exactly one of: recipe (a bash file in the plugin's sidecar dir, sourced by the core's worker/tools.sh — its helpers say, fetch, verify, older, latest_tag, arch_of, mine and $ACTION, $BIN_DIR, $SHARE, $OS, $ARCH, $PY in scope — then its tool_main: harness-claude, harness-pi) or enablesHarness + installerEnv (install.sh update with WORKER_<X>=1, one restart: harness-opencode, harness-agy). guestAllowed needs harness.guestAllowed (only those harnesses reach a guest's computer — pi left a guest's checklist with this). update: the hub may ask for an update. In the capability fingerprint. Core keeps gh and ask-form.
  • Claude's own argv is harness-claude's sidecar/claude_launch.py (the --settings hooks, scope rules + sandbox, extras, lean flags, /compact, --remote-control, Code Mode); the core's launch.py keeps valid_scope, valid_lean / lean_prompt, _launch (now extra_env= instead of code_mode=) and _stop_run. Its stop_guard.py hook ships in the plugin too.
  • The OpenRouter catalogue (GET /api/models/openrouter) is the openrouter_appe discovery of the registry (providers.appe_catalogue, the plugin's catalogueUrl setting) — backend/models/openrouter.py is gone.

One-shot completions and conversation labels (since 2026-11-26)

The hub's own small model calls — a conversation's action badge, a long title's short header title, a Send later prompt's title — are a plugin's job now, on any model. First user: the conversation-labels plugin (~/projects/ai-agent-plugins/plugins/conversation-labels). The sidecar's Haiku-only /title and /look and the core's look_labeler.py thread are gone.

  • Host sidecar POST /complete (sidecar/complete.py, host only): {system, prompt, model, harness?, account?, fallbackModel?, fallbackHarness?, fallbackAccount?, wakeLocal?: false, timeout?: 30} → {text, model, harness, account, usage?, costUsd?, fallbackUsed, primaryError?, seconds}. A model the EVOX2 serves (named under pi, opencode, evox2 or no harness) goes straight to its llama-server's /v1/chat/completions — with wakeLocal: false an asleep box or an unloaded model fails at once (never a Wake-on-LAN, never a model load that would evict a live run's) and the fallback answers. A vendor/model id (pi or no harness) goes to OpenRouter on pi's key. Any other harness asks its driver's optional SidecarHarness.complete(system, prompt, model, account, timeout) → {text, model, account, usage?, costUsd?}: harness-claude (claude -p --no-session-persistence --tools "" --setting-sources "" --strict-mcp-config --output-format json, the account's login), harness-agy (agy --print --output-format json; the mirror held off and the conversation deleted after), harness-opencode (opencode run on a throwaway database — a ChatGPT-login model is a 409: its rotating refresh token can't be copied), harness-pi (the EVOX2 / OpenRouter directly). A driver without it is a 409 unsupported. usage comes back in Anthropic's shape.
  • complete.run (capability, owner only, operator approval) — POST …/hub/complete {system, prompt, model, harness, account, fallback…, wakeLocal, timeout, kind, ref} calls /complete and books the spend in the side-call ledger (usage_store.add_side_call(kind, ref, account, model, cost, units, usage)): claude / agy / opencode priced from their tokens with the provider book, OpenRouter at its own figure, the EVOX2 at 0 (plugins/hubcomplete.py).
  • conversations.label (capability, owner only, operator approval):
    • GET …/hub/labels/pending?days=&limit=&sid= → {items: [{sessionId, title, firstPrompt, labels, account, profile, isolated, startedAt}], actions, system} — top-level conversations with a user turn and neither lookAuto nor a set look.action nor cron (conversations/look_pending.py); account is the Claude login the conversation bills (a Work run's is the Work seat), isolated = not the default login. sid answers one conversation from its meta even before its transcript is indexed.
    • POST …/hub/labels/look {sessionId, action, model} → meta.lookAuto = {action, at, model, source} (an action outside look.ACTIONS is stored as null — never asked again) and SSE {"type": "meta", "id"}.
    • POST …/hub/labels/short-title {id, title, source} → the short_titles cache (source = the long title it stands for) and SSE {"type": "short-title", id, title}.
  • provides: {"conversation.title": "<action>"} — run as the owner with {text, kind: "scheduled-title"|"short-title", ref, account?, isolated?}, answers {title, summary} (plugins/labels_bridge.py). Called by the scheduled-conversations plugin's hub/title (Send later) and conversations/short_title.py. No provider, a failure or {}: the scheduled title is the prompt's first words and no short title is asked or stored.
  • provides: {"conversation.look": "<action>"} — {sessionId?}: label that conversation (or what is pending) now (labels_bridge.look). The plugin also subscribes to conversation.started and runs a 2-minute catch-up schedule for the terminal and worker sessions no start event names.
  • GET /api/look/pending (scripts/look-backfill.py) reads the same list.

Hub capabilities

Capability Bridge (AIA_TOOLS_URL/plugins/<id>/hub/…) Who
conversations.read GET conversations?days&limit, GET conversations/<sid> the caller's own
conversations.spawn — operator approval
goals.read / goals.work GET goals, POST goals/work owner only
graph.read GET graph — projects, services, conversations, subagents, plans and memories as small node lists (plugins/graphdata.py) plus prefs, the Graph page's settings from before it was a plugin owner only
footprint.read GET footprint?account=<scope>&range=24h|7d|30d|90d|sub|all — each conversation's estimated carbon, water and energy (id, t, family, projects, co2eKg, waterL, energyKwh) in a profile scope and range, plus the scope switch's profiles and subscriptionStart (plugins/footprintdata.py, the twin of lib/footprint.ts, checked by test_plugin_footprint.py) owner only
telemetry.read GET telemetry/usage?range=7d|30d|90d&who=all|owner|guests|guest:<uid> — /api/telemetry/usage's answer (feature use by person and device, What's new seen, where conversations start) plus registry, the app's feature registry (telemetry/features.json, generated from lib/telemetry/features.ts) owner only
analytics.read GET analytics?account=<scope>&range=24h|7d|30d|90d|sub|all&tzOffset=<min>&cron=0|1 — one row per top-level conversation (no spawnedBy children; cron / Run now / test runs only with cron=1): start, t, workMin (distinct 5-minute active bins, subagents included) and byDay, wallSec, turns, model, harness, projects, machine, person, guest, origin — usage, never cost (plugins/analyticsdata.py) owner only
activity.read GET activity?account=<scope>&tzOffset=<min> — the Activity rollup plus profiles (plugins/activitydata.py) owner only
usage.read GET usage/overview?scope=<all|profile:id>&days=<1–120> — the scope's accounts and, per account, limits, history, plans and calibration, plus profiles (plugins/usagedata.py) owner only
usage.calibrate POST usage/calibrate {backfill?} — refit every account now ({calibrations, shifted}) owner only
ship.run POST ship/deploy, POST ship/audit, GET ship/scan?project= (handler only) owner only
notify.send POST notify the caller, the owner, a named user
complete.run POST complete — one short answer from any model through the host sidecar's /complete, booked in the side-call ledger owner only
conversations.label GET labels/pending, POST labels/look, POST labels/short-title owner only
machines.mcp GET machines, GET|POST|DELETE machines/<id>/mcp[/<rest>] — the owner's machines and each one's sidecar /mcp-servers (handler only) owner only
conversations.title POST title — a prompt's title from the conversation.title provider owner only
machines.wake POST wol, POST workers/<id>/probe, GET wake/workers (each also under bridge/ — bridge/wol, bridge/workers/<id>/probe, bridge/workers) — Wake-on-LAN through the host sidecar (handler only) owner only
relay.serve GET relay/routes, PUT|DELETE relay/routes/<name>, GET|POST relay/tokens, PUT|DELETE relay/tokens/<id> (handler only); machines connect to /proxy/tools/relay/<plugin>/<name> with an aiar1 token owner only
conversations.data GET|POST conversations/<sid>/data — the plugin's own meta.plugins.<id> on a conversation ({data, merge}; handler only — see "Menu items, thread places and conversation data") owner only

Security model

  • Capability consent & fingerprint: installing a plugin computes a deterministic SHA-256 fingerprint over its declared capabilities (secrets, outbound host/methods/paths, internal flag, skill, schedules, UI, events, webhooks, actions, harness hooks, hub capabilities). Reloading keeps approval automatically if the fingerprint did not change; widening capabilities requires re-approval.
  • No SSRF: non-owner proxy and event webhook requests pass through plugins/egress.py (public globally-routable IPs only, redirects re-validated). proxy.internal: true requires operator approval.
  • Write-only secrets: stored 0600, injected server-side by the proxy, scrubbed from responses/errors, never returned to the browser or agent run.
  • Sandboxed UI: custom HTML renders inside /sandbox-frame.html (opaque "null" origin) with a scoped postMessage bridge (aia-plugin-req / aia-plugin-res).
  • Sandboxed jobs & actions: run in a stripped environment with only AIA_TOOLS_URL, AIA_TOOLS_TOKEN, AIA_PLUGIN_ID, AIA_PLUGIN_DATA_DIR, AIA_PLUGIN_CONFIG, and AIA_USER_CONTEXT — never host tokens or other users' secrets.

Runtime APIs

Tool proxy (used by skills, jobs & actions via AIA_TOOLS_URL + AIA_TOOLS_TOKEN)

  • ALL /proxy/tools/plugins/{id}/proxy/{path} — allowlisted outbound HTTP proxy (wakes the proxy.wake service first — see "Waking a sleeping service")
  • GET /proxy/tools/plugins/{id}/data — list files in caller's plugin data dir
  • GET|PUT|DELETE /proxy/tools/plugins/{id}/data/{path} — read/write/delete a file in plugin data dir
  • GET /proxy/tools/plugins/{id}/config — read caller's non-secret plugin config
  • POST /proxy/tools/plugins/{id}/actions/{action} — run a v3 sandboxed action
  • POST /proxy/tools/plugins/{id}/webhook/{hook_id} — inbound webhook (?token=… or X-Plugin-Webhook-Token)
  • GET|POST|DELETE /proxy/tools/relay/{id}/{name}[/{path}] — a relay.serve plugin's streaming relay (aiar1 token; never on the public hosts)

Hub bridges (declared in capabilities)

  • conversations.read — GET /proxy/tools/plugins/{id}/hub/conversations?days=&limit= (≤ 2000; the owner's own conversations, a guest's theirs): id (what /conversation/<id> takes), sessionId, title, startedAt, endedAt, state, projects, isSidechain, archived, userTurns, turnEnded, cron, agentRun, test, spawnedBy, worker ("local" = the lab); GET …/hub/conversations/{sid} adds finalAnswer (the newest transcript's last assistant text, ≤ 32 000 chars).
  • goals.read / goals.work (owner) — GET …/hub/goals, POST …/hub/goals/work.
  • notify.send — POST …/hub/notify.
  • Run bridges (owner only, operator approval; plugins/hubruns.py, first used by mail-agents):
    • runs.start — POST …/hub/runs {prompt, model, harness, effort, thinking, worker, lean, fallback: {model, harness, effort, wait}, title, services, data} starts a conversation through the composer's send path. A local (pi / opencode) model with a fallback on the lab is probed first (the EVOX2 woken, /local-ready, ≤ 30 min); when it can't take the run it goes to the fallback and the answer's fallback says why. data lands on meta.plugins.<id>. Answers {sessionId, fallback, harness, model}.
    • conversations.send — POST …/hub/conversations/{sid}/send {prompt, inboxOnly?}: a turn into the owner's conversation (its live run's inbox, else a resume).
    • models.read — GET …/hub/models: /api/models' owner shape (models + presets).
    • workers.read — GET …/hub/workers: local first, the owner's machines, status, the harnesses each runs.
  • machines.mcp / machines.wake / relay.serve (owner only, operator approval, handler only) — see "Machines, relays and attention".

App API (/api/plugins/*)

  • GET /api/plugins — caller's installed plugins, hub catalog, and UI/resource/tool-card descriptors (Settings → Plugins)
  • GET /api/plugins/ui — the slim list every page reads: UI descriptors, provides, active plugins' glyph + config
  • POST /api/plugins/validate — inspect a path or git URL before installing (returns manifest, capabilities, fingerprint)
  • POST /api/plugins/install — install/approve a plugin live
  • POST /api/plugins/{id}/reload — reload from source
  • PUT /api/plugins/{id} — toggle enabled, update config, or (operator) manage catalog promotion
  • DELETE /api/plugins/{id} — uninstall (?purge=1 also removes data & secrets)
  • GET /api/plugins/{id}/settings — declarative Settings model + secret presence + schedules + webhooks
  • GET /api/plugins/{id}/info — the info page (README, capabilities, schedules, webhooks, actions, pages, source)
  • GET /api/plugins/{id}/asset/{icon|illustration} — the plugin's art
  • PUT|DELETE /api/plugins/{id}/secrets/{key} — set/delete write-only secret
  • POST /api/plugins/{id}/test — run testAction or proxy.inspect (for a managed.keyHealth plugin, as the owner: the verdict is recorded as the hub key's health)
  • GET /api/plugins/{id}/spend — operator only, a managed.keyHealth plugin's hub key: health + last-4 hint, alert settings, this month, by caller / model, 30 days, recent calls, settings.links filled in (see "The hub key" below)
  • PUT /api/plugins/{id}/key-settings — operator only: alertLimit, currency (EUR|USD), pushAtPct, pushOnBreak
  • POST /api/plugins/{id}/actions/{action} — run a v3 action from the UI / sandbox bridge (identical readOnly calls in flight share one run); GET with ?payload= for a readOnly one
  • GET /api/plugins/commands — the caller's plugin commands (the ai-agent plugin <id> <command> CLI and the plugin_<id>_<command> MCP tools; "Commands" above)
  • GET /api/plugins/{id}/ui/{kind}/{sub_id} — fetch sandboxed HTML document
  • GET /api/machines/attention — the owner's machine.attention items (owner only)
  • GET /api/machines/wakeable, POST /api/machines/{worker_id}/wake — the machine.wake provider's list, and a wake now (owner only)
  • POST /api/plugins/create-session — scaffold a plugin folder and open a conversation with create-plugin

The hub key (managed.keyHealth)

A managed plugin that pays for its callers with one hub key (scope: "hub" secret — Nano Banana's Gemini key) declares managed.keyHealth, and its Settings page gets a Hub key section for the owner (what Settings → API keys was until 2026-11-26): the key's state and last four characters, Test and Replace, the month against the alert line, by caller and by model, 30 days and the recent calls (GET /api/plugins/{id}/spend, plugins/keyspend.py).

  • Manifest: alertLimit + currency (EUR|USD; alertLimitEur is the older spelling), pushAtPct, pushOnBreak — the defaults, which the owner overrides at runtime (PUT …/key-settings, kept in installed.json → keySettings); secretKey (default: the first hub secret); legacyLedgerTool — a core ledger tool the plugin took over, whose rows count as the plugin's spend (nanobanana → plugin:nanobanana).
  • settings.links: [{label, url}], https:// only, with {{config.<field>}} placeholders (URL-quoted; a link whose field is empty is left out) — the provider's console, billing…
  • Health: an action's _meter.keyHealth: {status, message} — ok, or a broken state no-credit / invalid / denied / capped — moves the key's state; any other status (a rate limit, an outage) is listed as a failure only. A move into a broken state pushes the owner once (type: error), the way back to ok once (✅ <Plugin> key works again, type: success). The monthly spend pushes once at pushAtPct and once at 100 % (an alert only).
  • Test (POST …/test, settings.testAction): its _meter is billed (via test) and its keyHealth recorded; a handler _error whose kind is a key state is recorded too.
  • Replace (PUT …/secrets/<secretKey> by the owner): the new key is checked with testAction before it is saved — the run's handler token carries the candidate in memory (plugins.proxy.register_candidate), so that run's proxy calls use it. invalid / denied → 400, nothing saved; no-credit / capped → saved (the key is right, the billing isn't); anything else → 502, nothing saved. The secret's last four characters are kept beside it as a non-secret hint (installed.json → secretHints).