Skip to content

API Reference ​

The Omniscio Plugin SDK exposes 41 APIs to plugins. Some are available on both the frontend (via the Omniscio bridge) and the backend (via the PluginContext); others are backend-only or frontend-only.

API Summary ​

APIDescriptionAvailabilityPermission
StorageKey-value storageBothstorage
SecretsKeychain-encrypted credentialsBothsecrets
DatabaseCollection-based CRUDBothstorage
SessionsSpawn and manage Claude sessionsBothsessions
AIGenerate text with AI modelsBothai
FilesystemRead and write filesBackend onlystorage
HTTPFetch external URLsBackend onlynetwork
CronSchedule recurring tasksBackend onlycron
CLI EndpointsRegister REST endpointsBackend onlycli
SidebarBadge count and item listBothNone
TrayRows in the system tray menu, and their clicksBothNone
ToastIn-app and OS notificationsBothnotifications (for notify)
SettingsRead plugin settingsBothNone
EventsMessaging between your UI and backendBothNone
LoggingStructured log outputBackend onlyNone
InboxSurface items in Omniscio's inbox, and see the titles of what is waiting for the userBothinbox / inbox.read
AuthSigned-in identity and scoped account tokensBothauth (auth.session for tokens)
RecordingScreen recording, host-mediatedBackend onlyrecording
EmailSend one email from the user's agent addressBackend onlyemail.send
Text to SpeechSpeak text with the user's configured voiceWebview onlytts
Session HistoryRead past sessions the user has grantedWebview onlysessions.readHistory
FirebaseThe user's Firebase accounts and projectsWebview onlyfirebase
TasksChoose the task lists the user shares with the plugin, then read and change their tasksBothtasks.read / tasks.write
Session ControlChoose the sessions and projects the user lets the plugin manage, then message, pause, snooze and archive themBothsessions.control
VaultChoose the Vault folders the user shares with the plugin, then search, read and change their notesBothvault.read / vault.write
CalendarChoose the Google and Outlook calendars the user shares with the plugin, then read their events and free time and change eventsBothcalendar.read / calendar.write
Team ChatChoose the Team Chat channels and direct messages the user shares with the plugin, then read, search and post in them; offer custom emoji and read the workspace's custom emojiBothteamChat.read, teamChat.write, teamChat.emoji
SpendRead-only AI cost and usage totalsBackend onlyspend
WorkspaceThe user's real project checkouts and worktreesBackend onlyworkspace.read / .write / .exec
Backend CallsCall your backend's handlers from your panelBothNone
Host CapabilitiesFeature-detect what this Omniscio supportsBothNone
CoreRead-only view of the user's sessions, projects and message textBackend onlycoreRead
WidgetA live status widget in the Omniscio titlebarWebview onlychrome + chrome.widget
BoardsChoose the boards the user shares with the plugin, then read and change themBothboards.read / boards.write
Board LinksLink board items to things your plugin ownsWebview onlyboards.link
ChannelLong-lived outbound WebSocketBackend onlychannel
ClipboardRead and write the system clipboardWebview onlysystem (has needs none)
LaunchOpen links and documents, run programs the user confirmsBackend onlylaunch
MembersPeople in the active workspaceBothmembers.read
PeopleWhen the people in the workspace work and when they are awayBackend onlypeople.read (with members.read)
NavigationMove the user to a session or a teammate chatWebview onlynavigation
NotificationsSystem notifications with tags and Focus ModeWebview onlyNone
OAuthThird-party sign-in with your own clientBackend onlyoauth
ProcessRun programs listed in the manifestBothsystem
RSSFetch feeds and read the user's collected articlesBackend onlyrss
SharePublish an HTML page as a public linkWebview onlyfirebase
ShellOpen links and files, system dialogsWebview onlyNone for links and dialogs; system for openPath and showItemInFolder
Speech to TextTranscribe a recordingWebview onlystt
FilmMake MP4 videos from a film page, in the plugin's own folderWebview onlyfilm

Access Patterns ​

Backend -- the PluginContext object is passed to your plugin's activate() function:

typescript
// src/backend/index.ts
import type { PluginContext } from '@omniscio/plugin-sdk'

export function activate(ctx: PluginContext) {
  ctx.storage.set('initialized', true)
  ctx.log.info('Plugin activated')
}

Frontend -- the global Omniscio bridge is available in your UI code:

typescript
// src/ui/plugin.ts
const value = await Omniscio.storage.get('initialized')
Omniscio.toast.show({ type: 'info', message: 'Hello from the UI' })

One bridge, two names

The bridge is window.Omniscio. The same object is also installed as window.AgentMC, its name before SDK 3.4.0, so plugins written against the old name keep working. An Omniscio released before 3.4.0 only installs window.AgentMC; if your plugin should run there too, read the bridge as const omniscio = window.Omniscio ?? window.AgentMC.

Backend Calls ​

Your backend registers a handler with ctx.rpc, and your panel calls it with Omniscio.backend.invoke. The call resolves to whatever the handler returns.

typescript
// backend
ctx.rpc?.handle('notes:count', async () => (await ctx.db.query('notes')).length)

// panel
const count = await Omniscio.backend?.invoke('notes:count')
MemberDescription
ctx.rpc.handle(method, handler)Register (or replace) the handler for method
ctx.rpc.removeHandler(method)Remove it
ctx.rpc.callOrigin()Where the current handler call came from: { where: 'desktop' }, { where: 'phone', device }, or null
Omniscio.backend.invoke(method, ...args)Call it from your panel
  • Needs Omniscio v0.1.92. Both members are undefined on older hosts, so check before you call.
  • Read ctx.rpc.callOrigin() at the top of the handler and pass it down: it is reset on every call, and a timer or interval started inside a phone call keeps the phone origin when it fires. Call it as ctx.rpc.callOrigin?.(); it is undefined on older hosts.
  • Arguments and the result travel as JSON, and a thrown error reaches the panel as its message only.
  • The host gives up on a call after 240 seconds, and refuses more than 100 calls in flight per plugin.
  • For anything that changes data, use the command channel instead: it checks input, runs changes one at a time and reports honest outcomes on top of these calls.

Host Capabilities ​

Omniscio.host.getCapabilities() resolves to the capability tokens this Omniscio supports, such as 'ai-engine-choice'. A missing token means no. It needs no permission and exists from Omniscio v0.1.89.

typescript
const tokens = (await Omniscio.host?.getCapabilities()) ?? []
const canPickEngine = tokens.includes('ai-engine-choice')

The backend twin, ctx.host.getCapabilities(), is typed ahead of the Omniscio release that adds it, and is undefined until then.

Model Picker ​

Omniscio.modelPicker.open(request) opens Omniscio's own model picker over your button and resolves to the row picked ('' = the default row) or null when dismissed. Never draw your own engine or model picker. It needs no permission: check for the 'model-picker' token first, and show a plain select on an older host or when the call rejects.

typescript
const picked = await Omniscio.modelPicker.open({
  value: stored,
  defaultLabel: 'Claude, Sonnet',
  options: [{ value: 'deepseek:v4', label: 'V4', group: 'DeepSeek' }],
  anchor: button.getBoundingClientRect().toJSON()
})

Every row needs a group (its heading); disabled + reason shows a row that cannot be picked yet. Only '', null or one of your enabled values ever comes back.

Bridge-Only APIs ​

The following APIs are available only on the frontend through the Omniscio bridge. They do not have backend equivalents and do not require permissions.

Theme ​

Read and react to Omniscio's current theme.

typescript
// Get the current theme — this is a PROMISE
const theme = await Omniscio.theme.get()
// theme: { mode: string; accent: string; surfaces: Record<string, unknown> }
// NOTE: static placeholder host-side — mode is always 'dark' today.

// Listen for theme changes
const unsubscribe = Omniscio.theme.onChange((theme) => {
  document.body.className = theme.mode
})
MethodReturnsDescription
get()Promise<{ mode: string; accent: string; surfaces: Record<string, unknown> }>Current theme. visualTheme never existed; get() is async
onChange(callback)() => voidSubscribe to theme changes. Returns an unsubscribe function

Locale ​

Show your text in the language the user picked for Omniscio, and switch when they change it.

typescript
// At load: the language Omniscio was in when your panel opened
const loc = window.__AMC_LOCALE__
// loc: { uiLanguage: 'zh-TW', formattingLocale: 'zh-TW', dir: 'ltr', timeZone: 'Asia/Taipei' }

// Later changes, without a reload
const unsubscribe = Omniscio.locale.onChange((loc) => {
  loadCatalog(loc.uiLanguage)
  document.documentElement.dir = loc.dir
})
FieldMeaning
uiLanguageThe app language code exactly as the user chose it (zh-TW, zh-CN, pt-BR, tl, es). Pick your catalog with this
formattingLocaleThe locale for dates, numbers and money (tl formats as fil-PH). Format with this, never with uiLanguage
dirrtl for Arabic, Hebrew, Persian, Urdu and the other right-to-left scripts, else ltr
timeZoneThe computer's IANA time zone, when known
MethodReturnsDescription
onChange(callback)() => voidFires once each time the app language changes, with the object above. Works the same in a panel, an overlay window and on a paired phone. Returns an unsubscribe function

window.__AMC_LOCALE__ is fixed at load; onChange is the only live source. No permission is needed.

Export ​

Save files, generate PDFs, and interact with the user's filesystem through system dialogs.

typescript
// Save a text file (shows Save As dialog)
await Omniscio.export.saveFile({
  filename: 'report.md',
  content: markdownContent,
  type: 'text/markdown',
})

// Generate and save a PDF — note the casing, and it takes HTML
const saved = await Omniscio.export.savePdf({
  filename: 'report.pdf',
  html: renderedHtml,
})
if (!saved.saved) console.log('user cancelled')

// Let the user pick a folder
const folder = await Omniscio.export.pickFolder({
  title: 'Choose output directory',
})

// Write multiple files to a directory
await Omniscio.export.writeFiles({
  directory: folder,
  files: [
    { name: 'index.ts', content: tsCode },
    { name: 'styles.css', content: cssCode },
  ],
})

// Verify files exist
await Omniscio.export.verifyFiles({
  directory: folder,
  files: ['index.ts', 'styles.css'],
})

// Open a folder in the system file manager
await Omniscio.export.openFolder({ path: folder })
MethodDescription
saveFile(opts)Show a Save As dialog and write a file. Resolves { saved } — never the file's path
savePdf(opts)Render HTML to PDF and save. Resolves { saved } — never the file's path. (savePDF with that casing does not exist)
pickFolder(opts?)Show a folder picker dialog, returns the selected path
writeFiles(opts)Write multiple files to a directory
verifyFiles(opts)Check that files exist in a directory
openFolder(opts)Open a folder in the OS file manager

Project ​

Query and create Omniscio projects.

typescript
// List all projects
const projects = await Omniscio.project.listAll()

// Find a project by folder path
const project = await Omniscio.project.findByFolder('/path/to/repo')

// Create a new project
const newProject = await Omniscio.project.create({
  name: 'My App',
  folderPath: '/path/to/my-app',
})

// Open Omniscio's Add Project dialog with a folder pre-selected
await Omniscio.project.openAddDialog({
  preselectedFolder: '/path/to/repo',
})
MethodDescription
listAll()List all projects in Omniscio
findByFolder(folderPath)Find a project by its folder path
create(opts)Create a new project
openAddDialog(opts)Open the native Add Project dialog

Assets ​

Read files bundled with your plugin (from the assets/ directory in your plugin package).

typescript
// Read a bundled file
const template = await Omniscio.assets.readFile('templates/default.md')

// List files in a directory
const files = await Omniscio.assets.listFiles('templates')
MethodReturnsDescription
readFile(path)Promise<string>Read a bundled asset file as text
listFiles(path)Promise<string[]>List files in a bundled asset directory

Documents ​

Read and append to files the user picked from the OS file picker, and hand the user new files they choose a place for. Webview-only — there is no ctx.documents — and it needs no permission, because the native window itself is the consent.

typescript
// Ask for a file. Resolves [] if the user cancels.
const [doc] = await Omniscio.documents.open({
  mode: 'readwrite',
  title: 'Choose a PDF',
  filters: [{ name: 'PDF', extensions: ['pdf'] }]
})
if (!doc) return

// Read the bytes via fetch. `url` is opaque — never parse it.
const bytes = await (await fetch(doc.url)).arrayBuffer()

// Append. Always stat() first — expectedLength is only loosely checked.
const base64Delta = btoa('appended text')
const { length } = await Omniscio.documents.stat(doc.id)
await Omniscio.documents.append(doc.id, base64Delta, { expectedLength: length })

// Recover Handles after a webview reload, and release when done.
console.log(`${(await Omniscio.documents.list()).length} still open`)
await Omniscio.documents.close(doc.id)

// Hand the user a NEW file. The Save window is the consent; nothing else is created.
const one = await Omniscio.documents.saveCopy({ name: 'summary.pdf', base64 })
if (one.saved) console.log(one.names) // ['summary.pdf'] — a bare name, never a path

// Several at once, into a folder they pick. Never replaces an existing file.
const many = await Omniscio.documents.saveCopies({
  title: 'Where should the parts go?',
  files: [{ name: 'part 1.pdf', base64 }, { name: 'part 2.pdf', base64 }]
})
MethodReturnsDescription
open(options)Promise<DocumentHandle[]>Show the file picker and mint a Handle per chosen file; [] if cancelled
list()Promise<DocumentHandle[]>The Handles this plugin still holds, with freshly re-stat'd sizes
stat(handleId)Promise<{ length: number }>The Document's current length — the value to pass as expectedLength
append(handleId, base64, options)Promise<{ length: number }>The only write to a picked file; resolves the new length
close(handleId)Promise<void>Drop the Handle; the file itself is untouched
saveCopy(options)Promise<{ saved: false } | { saved: true, names: string[] }>Save one NEW file where the user chooses; may replace, atomically
saveCopies(options)Promise<{ saved: false } | { saved: true, names: string[] }>Save several NEW files into a folder the user chooses; never replaces

saveCopy and saveCopies are the copy half of the namespace. Neither takes a path or a folder, neither leaves a folder grant or a Handle behind, and neither touches the document you opened — so a helper that saves three files asks the user three times, and should be designed to do so. saveCopy may replace a file the user picked in the Save window, but only once the whole new copy is ready, so an interrupted save leaves the old file intact. saveCopies reserves every name exclusively and adds a number on a clash (report (2).pdf); the names in the reply are what was actually written. A call that fails part-way removes the copies it had already written. Names must be bare file names, and one call carries about 24 MiB of decoded bytes.

A DocumentHandle is { id, name, size, mode, url } and carries no path. Two of those fields mislead if you skim them:

  • size is live when the Handle is serialized, not when the file was picked — but it freezes the moment the call resolves. Never pass a size you are holding as expectedLength; call stat() each time. A stale length is not reliably an error: the host refuses only when the region you would discard is larger than the payload you write, so a slightly stale one silently overwrites your own recent bytes.
  • url is opaque, and only works through fetch. Never parse, log, or persist it. Documents are served as application/octet-stream with nosniff and Content-Disposition: attachment, so it is not usable as an <img src> or <iframe src>. Its path shape is not a contract, and it is on its way to carrying a capability token that grants read access to the file.

append takes its arguments as (handleId, base64, options). Both leading arguments are strings, so transposing them still typechecks — the host rejects the id at runtime instead.

A read Handle refuses append; the mode is fixed when the Handle is minted. And if the file is replaced on disk — which an ordinary Save in Preview or Word does — append refuses not-the-picked-document and that Handle is finished: call open() again for a fresh gesture.

No offline mock yet

The SDK ships no mock for documents. Both its mocks — createTestContext() and the dev shell's context — implement PluginContext, the backend type, and documents is deliberately absent from it, so neither can host this namespace without typing a capability a plugin backend cannot call. Faking it would repeat the ctx.events failure, where an in-memory fake kept plugin tests green for months while the production path was dead in both directions. Stub it yourself until a webview mock surface exists.

Gating is in flux

documents is live and ungated on Omniscio master, but an in-flight host change puts it behind an in-development plugin-documents-io flag that defaults off. On a build with that flag, every call rejects with This capability is not available. — a passing typecheck here is not evidence the host will answer.

Omniscio Plugin SDK