Omniscio

Plugin Bridge Capabilities (part 3)

Part 3 of the plugin bridge: the session capabilities — spawning and driving a Claude session, reading the user's granted past session history, watching a session live or through an ambient status feed, and ctx.email.send for mail a plugin sends without any session.

On this page

What it is

This is part 3 of the Plugin Bridge Capabilities page. Part 1 covers the permission model and the host-primitive capabilities; part 2 covers the data, file and output capabilities. This part covers everything a plugin can do with a session: start and drive one, read the user's granted history, and observe activity as it happens.

Where to find it

There is no Omniscio menu that opens this surface — a plugin reaches it through the sandboxed bridge object it is handed. What a user meets directly is the consent: each capability below names the permission it takes, and the resulting grants are managed in Settings → Plugins.

How it behaves

ctx.sessions.* — start and drive a Claude session (permission: sessions)

Lets a plugin spawn a Claude Code session and talk to it — the "go do this work and tell me when it's done" capability (e.g. Test Tracker running a suite and reading back the failures). Every session it starts spends the user's own Claude quota or API credit, so this is the one namespace where a loop bug costs real money.

One optional argument decides the blast radius:

  • No scope → the plugin's own sandbox. The session runs in the plugin's private virtual project (__plugin_<id>__), which is not a directory in any repository of the user's. This is the original behaviour and rides on the sessions permission alone.

  • With a scope → a real repository the user granted. { projectId, worktree } puts the session in an actual working copy, where it writes files and runs commands as far as its tool grant and the plugin session floor allow (see access below). Three things must hold at once, and any one missing refuses the spawn:

    1. the sessions permission, declared in manifest.json;
    2. the workspace.exec tier in that same manifest — a session that writes and runs cannot be authorized by a grant whose consent copy told the user "it cannot change or delete anything, and it cannot run anything";
    3. a live per-project workspace grant for that exact project — the same grant ctx.workspace uses, revocable from Settings → Plugins → "Folders this plugin can reach".
  • The grant is re-checked on every later call, not just at spawn. sendMessage, getMessages, getStatus, stop and archive each re-read it, so revoking a project stops a plugin driving a session that is already running.

  • worktree: null means the project's main checkout; a named worktree means that working copy. The host resolves the directory from the grant itself and never re-derives it from what the caller asked for, so a path outside the granted set cannot be reached.

  • Ownership is enforced per call. A plugin reaches only the sessions it started; another plugin's session id — or one of the user's own — is refused.

  • archive files away a session the plugin owns — worker backend only. ctx.sessions.archive(sessionId) runs the same ownership check as stop, ends a running session first, and archives it through the host's one end-of-life path with the plugin-owner trigger, so the Archive view names the plugin as the reason. A foreign id is refused (does not belong to plugin) and an unknown or deleted one with Session not found; in both cases nothing is archived. The host's own refusals pass through as the error text: an actively shared session, one holding unshipped work, or a needs_you session whose final card the user has not read stays put, and the plugin may retry later. Archiving is reversible and keeps the transcript. A panel has no session.archive.

  • delete erases a hidden session the plugin owns, for good — panel and worker backend. Omniscio.session.delete(sessionId) and ctx.sessions.delete(sessionId) stop the session and remove it and everything stored for it at once — its messages, search entries, summaries and attachments — through the same removal the person's own Delete chat runs. Nothing is kept as a hidden row, so a deck's uploaded file text is gone the moment the deck is deleted. It works only on a background session the plugin created in its own sandbox and never revealed: a session a person can see (started with userInitiated, or revealed), one launched into a real project, or another plugin's session is refused (Archive it instead) and nothing is removed. A session that cannot be stopped is not deleted, and the refusal text says so. It is a desktop call: a paired phone cannot reach it.

  • deleteVisible erases the plugin's own chats a person can see, after the person confirms — panel only. Omniscio.session.deleteVisible(sessionIds) (up to 100 ids, repeats counted once) first checks every id is a chat in the plugin's own sandbox project; one unknown, foreign or real-project id refuses the whole call with the ids named, no dialog, nothing deleted. Then Omniscio shows ONE dialog of its own — how many chats, and the first twelve titles — that the plugin cannot answer or reword; no open window, or Cancel, rejects with nothing deleted. On OK each chat is erased through the same removal as delete (messages, search entries, attachments), one after another, and the call resolves when all are gone. An erase that fails part-way rejects with erasedIds and notErasedIds on the error (and the same ids in its message), because an erase cannot be undone: all-or-nothing is guaranteed up to the confirm, not through the erase. A refusal carries refusedIds; a Cancel carries none of the three. There is no ctx.sessions version and a paired phone cannot reach it.

  • A background session is read by your plugin, not a person. A sandbox session the user did not open (userInitiated unset) is hidden from the inbox, so Omniscio gives it none of its person-facing instructions or standing reminders and sends it no check-ins: the last assistant message is the agent's own answer (hidden-plugin-session-contract.md). The stored text can still open with the app's activity lines (▸ …) and a [[OMNISCIO_FINAL]] line — strip those before showing it.

  • One size cap for every message. create's prompt, launchBuild's prompt and each sendMessage accept up to 200,000 characters (PLUGIN_SESSION_MESSAGE_MAX); a longer one is refused with a bridge argument error.

  • A daily ceiling on background sessions, set by the person. A plugin may start 20 background sessions in a rolling 24 hours, except Foundry, the prdstack plugin, which gets 50 because one autopilot run uses about 14; the person can set a different number for one plugin in Settings → Plugins (0 stops that plugin's background sessions) and every other plugin's default stays 20. Every way of asking for a hidden session counts against the same ceiling — the worker backend's ctx.sessions.create and the panel's session.create alike — so the number on the plugin's card is the number every road checks. A create past the ceiling is refused with a rate-limit error naming that number, carrying reason: 'plugin-session-budget-spent' on every road — the worker's thrown error and the panel's err.reason alike — so a plugin can show its own message instead of matching the sentence. Retrying changes nothing until the window passes. A session the person asked for (userInitiated) or one launched into a real project is not a background session and is not counted. The count is of the plugin's background sessions that still exist, so a plugin that deletes its own finished session frees that slot: the ceiling stops runaway background work, and it is not a billing ledger. No plugin can raise the ceiling: it lives with the person's own settings, not in the plugin's settings.

const { sessionId } = await ctx.sessions.create({
  prompt: 'run the test suite and summarise the failures',
  scope: { projectId, worktree: null } // omit `scope` entirely for the plugin's own sandbox
})

await ctx.sessions.sendMessage(sessionId, 'now fix the first failure')
const status = await ctx.sessions.getStatus(sessionId)
await ctx.sessions.stop(sessionId)
await ctx.sessions.archive(sessionId)
await ctx.sessions.delete(sessionId) // permanent: a hidden sandbox session only

Saying an AI started the session — worker backend only. ctx.sessions.create takes an optional startedBy: 'me' | 'agent' beside userInitiated: true. 'agent' keeps the session visible but makes it screened by the Agent Firewall; 'me' or leaving it out changes nothing; anything else is refused. The answer carries startedBy: 'agent' when Omniscio honoured it, so a plugin on an older Omniscio (which ignores the key) can notice the field is missing and refuse to forward untrusted text:

const created = await ctx.sessions.create({ prompt, userInitiated: true, startedBy: 'agent' })
if (created.startedBy !== 'agent') throw new Error('This Omniscio cannot screen AI-started sessions.')

A retried create returns the first session. ctx.sessions.create takes an optional clientRequestId (1 to 128 characters; anything else is refused), the same one the webview create takes. A create that repeats it within 10 minutes, from a retry after a timeout or a restart, gets the first session's id back instead of starting a second paid one, even if that session has since ended; a create that threw left nothing behind, so its retry starts one. Leave it out and every call starts its own session, as before.

const { sessionId } = await ctx.sessions.create({ prompt, clientRequestId: 'weekly-digest-2026-10-27' })

access narrows a hidden session (the plugin session floor). Unless the person switched the floor off or gave the plugin full access, every new plugin agent session gets none of the person's setup, a folder of its own, and never more tools than its sessionTools grant. A hidden session (a webview create with no scope, or a worker create without userInitiated: true) answers in text only: the host stamps the tool lock as floor:<pluginId>. create({ prompt, access: 'web' }) lets it search the web and read public pages, nothing more; 'text' is the default. A visible session ignores the option, any other value is refused by the bridge schema on both legs, and an older host strips it, so it is safe to send anywhere.

A web session needs the network permission and nothing else. A plugin that declares network gets its access: 'web' sessions with web search and public pages even without sessionTools; a plugin without network is refused with a plain sentence. The web limit holds with the floor switched off or under full access, even for a plugin that also declares sessionTools: asking for web means web. A web session runs only on a Claude-family engine and only on this computer, whatever the switches say.

A visible session (a webview create with a scope, a worker create with userInitiated: true, or launchBuild) asks the person before every command and web request and is refused any commit or push to main or master. While floored, the host refuses with a plain sentence: an engine outside the Claude family (at create, launchBuild and each sendMessage, including an unnamed engine whose host default is outside it), fanout, an aside, and any SSH or cloud run. The exact sentences, and the person's two switches, are on Plugin agent safety floor.

Polling a transcript by cursor — worker backend only. On the worker leg, ctx.sessions.getMessages(id, { after, limit }) lets a plugin ask "what's new since I last looked" instead of re-reading the whole conversation:

const first = await ctx.sessions.getMessages(sessionId) // newest page; no cursor needed
let cursor = first.at(-1)?.cursor
const next = await ctx.sessions.getMessages(sessionId, { after: cursor, limit: 200 })
  • A message is { id, role, text, answer, partial, timestamp, cursor } — the body field is text, not content. Each message carries the opaque cursor pointing at it, so a poller resumes by handing back the last one it saw.
  • Read answer for what the AI said. text is the stored transcript: Omniscio's activity lines (▸ Bash: …, ← result received, ▸ Extended thinking), the final-message marker and any summary card sit in it, and a plugin that parses those keeps them. answer is the AI's own words with all of that removed — '' for a row that is only activity. On your own messages answer equals text.
  • The cursor survives an app restart — both halves of the position are persisted database values, unlike an in-memory high-water mark.
  • A cursor-less call returns the NEWEST page, not the start of the transcript, so a plugin's first tick sees the present rather than ancient history.
  • Partial (streaming) rows are included here, and only here. With no push primitive on the worker leg, a partial row is how a poller sees a turn in progress rather than a silent gap until it completes. The webview reads filter them; the divergence is deliberate.
  • partial says whether a row is still being written. It is true on a streaming row and false once the row is final. Treat a reply as finished only when its row is not partial: a turn can settle (an interruption, a rate limit) with its last row still partial, and that text is cut off, not an answer. The status can also settle a moment before the final row lands, so give a settled-but-partial row a short grace before calling it cut off. A host older than this field sends no partial.

The webview leg differs. Omniscio.sessions.create takes the same scope under the same three gates, but Omniscio.sessions.getMessages(id) is the older full-transcript read — no cursor, partials filtered, and its body field is content, next to the same answer — show answer, not content, when you display what the AI said. It also exposes rename, getCost, launchBuild and launchWithDraft, which the worker leg does not; the worker leg exposes onStatusChange / offStatusChange, which the webview does not.

The plugin data fence (storage/CLI side). The host's generic POST/PATCH/DELETE /plugins/:id/db/:collection write routes refuse a WHOLE collection (403 PLUGIN_COLLECTION_NOT_AGENT_WRITABLE, whatever key the caller holds) unless the manifest opts it in with agentWritable: true; cliReadOnlyColumns then narrows an opted-in collection. READS have their own fence, and it keys on the door, never on which key the caller holds or what it declared: a collection the manifest marks agentReadable: false answers 403 PLUGIN_COLLECTION_NOT_AGENT_READABLE on GET /plugins/:id/db/:collection and its single-row read to every caller — an install-wide-key call included, with or without X-AMC-Source-Session-Id (a host older than 19 November 2026 still admits the one that names no session) — and refuses outside writes too, so a write's row echo cannot hand back a fenced row. The plugin's own panel and backend read normally over the in-process bridge, and a host that predates the key drops it and serves the rows anyway (the one manifest key that fails OPEN when stripped). The key-value store (ctx.storage) is fenced on writes the same way as a table: PUT/DELETE /plugins/:id/kv/:key answer 403 PLUGIN_KV_NOT_AGENT_WRITABLE unless the manifest sets storage.kv.agentWritable: true. Its READS carry their own fence: storage.kv.agentReadable: false refuses GET /plugins/:id/kv and the single-key read to every caller, the install-wide key included, with 403 PLUGIN_KV_NOT_AGENT_READABLE, and storage.kv.agentHidden does the same for named keys (a trailing * matches a prefix) — a fenced key is never fetched, the list omits it rather than handing back its value, and an outside write to it is refused too (T-395), so an agent cannot erase a value it may not read. A plugin action can carry the same rule: cli.endpoints[].agentReadable: false refuses that action (403 PLUGIN_CLI_NOT_AGENT_READABLE) to every caller, the install-wide key included, which is how an action serving a fenced table is closed to agents — and the refusal keys on the path, never the verb, because a plugin's handler is reached by path alone. The plugin's own panel and backend read normally either way, and a host that predates these keys strips them and serves the data anyway (they fail OPEN); ctx.secrets is still the encrypted store. A setting may carry agentWritable: true too: a CLI PATCH /plugins/:id/settings applies at once only when every named setting has it, otherwise it becomes the person's approval card, and a password setting is never writable from the CLI. Older hosts strip these keys but still require storage.collections. Rules: plugin-command-trust-contract.md.

Telling Omniscio a session works on a pull request (worker only). ctx.sessions.linkPullRequest(sessionId, { url, snapshot?, refresh? }) records that one of your own sessions belongs to a pull request, so Omniscio's pull-request badge, panel and watch can find it. url is the pull request page; snapshot optionally carries title, state, headBranch, baseBranch and isDraft, and a field you leave out keeps what Omniscio already had. The link is recorded as made by the session (created). Pass refresh: true from anything that runs on a timer: a refresh never brings back a pull request the person unlinked. The answer is { linked: true, link } or { linked: false, reason } with reason bad-url, no-session or dismissed; a session your plugin does not own is refused outright. An older Omniscio has no such method, so check typeof ctx.sessions.linkPullRequest === 'function' first.

fanout is a separate permission. Batch-spawning across arbitrary projects is gated on sessions.launchAny rather than sessions, because it fires paid sessions into projects the user never picked.


sessionHistory — read the user's past Omniscio work (permission: sessions.readHistory)

Lets a plugin read the user's past session/project conversation history — the "build something from my existing work" capability (e.g. Decks turning your sessions into a deck). Because that history can contain anything the user ever typed, it is governed by a strict scoped + audited + persisted privacy model, which the host enforces:

  • Default-deny, user-scoped. A plugin reads nothing until the user grants it. Call requestAccess to pop a picker; the user chooses which projects/sessions to hand over. A project grant transitively covers that project's (non-hidden) sessions.
  • Text-only. getMessages returns a { id, role, content, timestamp }[] projection with content reduced to plain text and system rows dropped — raw tool-use / tool-result blocks (which can carry shell output, file contents, secrets) are never handed over. An AI message's content is its answer alone, never the app's activity lines; this rule is stated once on the main page.
  • Audited + revocable. Every read is appended to a host-owned audit table the plugin cannot touch, and grants persist and are revocable from Settings → Plugins → "Session history access", which also shows the read log.
// 1) ask the user to grant scope (opens the picker; resolves with what they granted)
await Omniscio.sessionHistory.requestAccess({ kinds: ['session', 'project'] }) // kinds optional

// 2) enumerate what you're allowed to see
const projects = await Omniscio.sessionHistory.listProjects() // granted projects
const sessions = await Omniscio.sessionHistory.listSessions() // granted sessions (silent lanes filtered out)

// 3) read a granted session's transcript (throws if not granted)
const messages = await Omniscio.sessionHistory.getMessages({ sessionId })

Watching a session live — host.sessionOutput and sessions.observeStatus

Two separate, deliberately narrow ways to see activity as it happens. They are not interchangeable, and neither one hands over a transcript.

host.sessionOutput — live output from a session your plugin OWNS (no extra permission)

A plugin panel that launched a session (via ctx.sessions.create) can watch that session's output as it streams, instead of polling getMessages:

const unsubscribe = Omniscio.events.on('host.sessionOutput', (data) => {
  // data = { sessionId, text, source, messageId?, streaming?, timestamp? }
  appendToMyView(data.text)
})
// later
unsubscribe()

Omniscio.events.on(channel, cb) returns an unsubscribe function — call it when your view unmounts. (Subscriptions are also released automatically when the panel reloads or closes.)

Webview panels only, today. Delivery is scoped to the plugin's panel webContents. A v2 worker backend does not receive this channel — its ctx.events namespace exposes emit only. A headless plugin that wants to follow a session should page the durable ctx.sessions.getMessages(id, { after }) cursor instead, which is the reliable path either way.

What the host guarantees:

  • Owner-only. Delivery is scoped to the plugin whose ownership tag is on that session. A plugin never receives output from a session it did not launch, and this rides the per-plugin dispatch, never the all-plugins broadcast.
  • Revocable. For a scope-spawned session the project's workspace grant is re-checked before each delivery, so revoking that project in Settings stops the stream.
  • Trimmed. You get the text and its timing. You do not get attachments (which carry the user's real on-disk filenames), the free-form metadata record, sidechain ids, or the comment/tool counts. It can be widened on request; it will not be narrowed back.
  • Batched, not per-fragment. Output is gathered over a short window and delivered as one event with the text concatenated, so a busy session does not become an event storm.
  • Not a correctness channel. Treat it as a progress hint. If your plugin misses an event it must still be correct from the durable ctx.sessions.getMessages(id, { after }) cursor read.

sessions.observeStatus — the ambient status feed for an overlay (standard tier)

An overlay plugin (a companion, a status pet, an activity HUD) can react to every session starting, finishing, or needing attention. Declare it in your manifest:

{ "permissions": ["sessions.observeStatus"] }
  • It carries status only — never message text. The consent copy says exactly that.
  • Unlike host.sessionOutput it is not scoped to your own sessions: reacting to the user's whole workspace is the point of an ambient overlay. That breadth is why it takes its own declared permission rather than riding the broad sessions one, which now also gates spawning agents.
  • An overlay whose plugin does not declare it receives nothing (the host logs the refusal once).
  • Do not confuse it with ctx.sessions.onStatusChange, which is a per-session subscription for a session you own and rides the plain sessions permission.

ctx.email.send — email one reader from the user's agent address (email.send, Tier-1 elevated)

Lets a plugin's backend code send an email — a newsletter issue, a booking confirmation — with no AI session on the path. It replaces the old pattern of asking a session to post to the agent-email route, which stopped working once plugin sessions lost their tools and was never safe: that session held the app's master key while reading text a stranger could influence.

const result = await ctx.email?.send({
  to: 'reader@example.com',
  subject: 'Issue 7',
  html: issueHtml,
  idempotencyKey: `${issueId}:reader@example.com`
})
if (result?.ok) markSent(result.id)
else if (result?.reason === 'recipient-unsubscribed') removeReader()
  • Tier-1 elevated permission (email.send). The consent copy is "Send email from your Omniscio agent address to people it chooses, up to 500 a day. Every email has a one-click unsubscribe, and anyone who unsubscribed is never emailed again." Without it the call is refused and nothing is sent.
  • Backend only. The plugin panel and the phone view cannot reach it.
  • The host picks the sender — the user's own claimed agent address. A plugin cannot set From, Reply-To, Cc, Bcc or headers, and sends to exactly one address per call.
  • An optional sender name (fromName, permission email.fromName). A plugin granted the elevated email.fromName permission (consent copy: "Choose the sender name") may pass fromName: 'Weekly Digest' so inboxes show that name beside the unchanged agent address. The host strips quotes, angle brackets, @ and address-like words, cuts it to 64 characters, and refuses a name that reads as Omniscio (from-name-not-allowed); without the permission the call is refused (from-name-not-permitted). schedule takes the same fromName, and the cloud checks the stored name again at send time.
  • Always list mail. Every email carries a one-click unsubscribe; anyone who unsubscribed from the user's agent address, bounced or complained is refused by the mail service, and the plugin is told so with a typed reason.
  • The HTML is cleaned first — scripts, forms, frames, embedded objects, event handlers and unsafe links are removed; styling and layout survive.
  • Limits. A burst of 10, then one per second, and 500 a day per plugin (UTC day, counted in the cloud for immediate and scheduled mail together). Plugins may use at most 80% of the account's own daily email allowance, so the user's own agent mail always has room (free plan: 80 sends and 20 new readers a day).
  • Every outcome is typed — { ok: true, id, deduped } or { ok: false, reason } — never a sentence to parse. The full reason table is on the SDK's Email API page.

Scheduled sends. ctx.email.schedule({ to, subject, html, sendAt, idempotencyKey? }) hands a finished issue (up to 2000 readers, one minute to 30 days ahead) to Omniscio's cloud, which sends it on time even when the computer is off; cancel, status and list manage the plugin's own issues. At send time every reader passes the same checks as a live send, so a reader who unsubscribed after scheduling is skipped. The issue and the readers' addresses stay in the cloud only until the issue has been sent, then are deleted automatically. When a daily limit stops an issue part-way it shows continuing and resumes after the next UTC midnight; the plugin tells the user with its own inbox alert.

When a plugin goes away. Uninstalling or disabling a plugin, or an update that drops email.send, cancels every email it has waiting. If the plugin store removes a plugin, its waiting emails are held instead: nothing is sent until the user decides. A cancel that cannot reach the cloud is retried at start-up, hourly and on sign-in. Omniscio remembers which account each plugin's waiting emails belong to, so turning a plugin off while signed out (or signed in as someone else) still stops them the next time that account signs in, and an email the plugin was handing over at that very moment is stopped too.

While a stop is still owed the inbox shows "Scheduled emails from {plugin} may still go out", saying how many may still be sent when Omniscio knows. If the account is not signed in, its Sign in button opens Settings > Accounts; if the email service could not be reached, Try again retries straight away. The notice goes away by itself once the emails are stopped.

Where the user sees them. Settings > Plugins > the plugin's card shows a "Scheduled emails" panel listing each waiting email (subject, send time, readers, state) with a Cancel that asks first. The top of the Plugins page shows "Held emails from removed plugins" with Send (or Send now) and Cancel for each held email. A held email nobody decides on is deleted 33 days after its send time.

Locked by plugin-email-primitive-contract.md, plugin-email-service.test.ts and plugin-email-schedule.test.ts.

reports.submit — report a picture the plugin made (permission: reports)

A panel can let the person report a bad picture, such as a meme they do not want made, to Omniscio's own review queue. Only a panel can call it, and only under the reports permission.

const result = await Omniscio.reports.submit({
  picture: { type: 'image/png', base64 },
  reason: 'hateful',
  note: 'Mocks a group of people'
})
  • Omniscio asks first, every time. The app draws its own consent inside the window, never a system dialog and never in words the plugin chose. It shows the plugin's name, the picture, the reason and the note, and nothing leaves unless the person presses Send report. Cancel, a closed panel or five minutes without an answer all send nothing. Built-in plugins get the same consent.
  • What is sent: the plugin id, the one picture (PNG or JPEG, at most 1024 pixels on its long side and 1 MB), the reason (hateful, sexual, violent, harassment, someone-elses-work, other), the note (at most 500 characters) and the time. No account, no install id, no signed-in token, and nothing else the plugin holds. Any other field is refused as a malformed call.
  • Limits: 20 sent reports a day per plugin on one computer; one consent open at a time per plugin.
  • The answer is { ok: true }, or { ok: false, code, message } with code one of declined, report-limit, invalid-picture, busy, no-window, unavailable, and message a plain sentence to show as is.
  • Where it goes: the public share service's POST /plugin-report, into the owner-only queue beside page reports, kept 90 days (Share abuse reports).

Locked by share-abuse-report-takedown-contract.md ("Reports from inside a plugin") and plugin-report-intake.test.ts.

Last verified 2026-11-26