A plugin is a folder with manifest.json and one self-contained ES module, plugin.js, that exports inject (the service names it needs) and apply(ctx). It runs as ordinary, unsandboxed code inside the Buzz desktop app. apply must finish within 10 seconds.
API v1 loads one file from a blob URL: no CSS, no assets and no runtime imports. React comes from ctx.react, so use classic React.createElement; the automatic JSX runtime and bundler chunks don't work.
Every specific here is a preview and can change between versions. The reference is the code: the author types in src/plugins/author.ts and the bundled plugins in src/bundled/. Plugins says which parts change least. It describes the latest Buzz, which can have services this app doesn't.
- Write a small first version as plain JS in a folder in your workspace, with no build step. A bundler is worth it only if it emits a single
plugin.jswith classic JSX and no runtime imports. - The owner installs it the first time. Either call
plugin_requestwithactioninstalland the folder's absolute path asrepository, or ask them to open Settings → Plugins → Manage plugins, choose Add, then Browse under Add from folder. It must be Browse: a dragged-in folder is copied, so there's nothing to reload. - After that, edit the files and call
plugin_reloadwith the manifest id. If the new code fails to start, the running revision comes back. Read itsapplicationresult (applied,savedorfailed, withnextStep).plugin_statusshows state, errors and what the plugin registered. - Reload refuses a changed
manifest.hostorid. The owner applies a host change with the plugin's Update in Settings; a new id is a new plugin. - Check what the user will see, then refine.
manifest.json
{ "id": "example.hello", "name": "Hello", "apiVersion": 1, "description": "Say hello from a plugin page." }plugin.js
export const inject = ["react", "pages"];
export function apply(ctx) {
const React = ctx.react;
ctx.pages.register({
id: "main",
title: "Hello",
primary: true, // adds a navigation entry; without it the page is search/deep-link only
component: function Hello() {
const [count, setCount] = React.useState(0);
return React.createElement(
"section",
{ className: "ui-card", style: { padding: "var(--space-panel-inset)" } },
React.createElement("h1", null, "Hello"),
React.createElement("button", { type: "button", onClick: () => setCount(count + 1) }, `Clicked ${count} times`),
);
},
});
}- Manifest:
id,name,apiVersion(1), and optionaldescription,discoveryandhost. Unknown keys reject the whole folder. - Plugin id: lowercase letters, digits,
.and-, starting with a letter, at most 80 bytes, no empty segments, no underscores. Bundled plugins' ids are reserved. Updates match onid. - Contribution ids (pages, panels, shortcuts and so on) match
/^[a-z0-9][a-z0-9._-]*$/and are unique within the plugin. - No work at module top level. Do everything in
apply. Enabled plugins activate even when their page is never opened. - Declare every service in
inject.applyruns only once all are available, so a missing one means it never runs; checkplugin_statusafter installing. Optional services (sidebarSections,subjectLift,notices,pluginInstaller,seen,ui,communityJoin) aren't listed ininject: read them withctx.reflect.get("name"), which returnsundefinedon hosts without them. - Own everything you start with
ctx.effect(() => { start(); return () => stop(); }). Everything you register throughctxis removed when the plugin is disabled or replaced. - State: React state resets on reload. The module is evaluated once per revision per app session. Use the
seenservice to remember a one-time experience. - Errors: an invalid
registercall fails activation, and the error shows in Settings andplugin_status. Pages and panels render in error boundaries, but loops and global side effects aren't contained.
Each line is the main call. Read the types for every field.
| Inject | For | Main call |
|---|---|---|
pages |
A page, optionally in navigation | ctx.pages.register({ id, title, component, primary? }) |
panels |
A side panel for a link or target | ctx.panels.register({ id, title, matches(target), component }) |
settingsCards |
A Settings destination | ctx.settingsCards.register({ id, title, component }). The host supplies navigation and the column, not a heading. |
accountActions |
An account menu entry | ctx.accountActions.register({ id, title, component }) |
sidebarSections (optional) |
A Team sidebar section | register({ version: 1, id, title, icon, rows, select }) |
conversation |
Composer and message UI | registerAccessory, registerMessage, registerMessageAction, registerLink, registerLinkPreview (a link-preview renderer that needs setup first adds status(), subscribe(listener) and settings, its Settings card id; while status() is "needs-setup" the host draws a card that opens that Settings card), registerSendGate, and host components under ctx.conversation.ui (Markdown, DocumentEditor, ImageViewer, MembersDialog, Workspace) |
agents |
Agent tools and instructions | ctx.agents.addTool({ name, description, inputSchema, call }); addInstructions({ id, text }); wake; hooks need host.agentHooks |
shortcuts |
Key bindings | ctx.shortcuts.register({ id, title, binding, run }) |
navigation |
Open a destination | await ctx.navigation.open({ version: 1, kind: "plugin", pluginId, pageId? }) |
notifications |
OS notifications | ctx.notifications.register({ id, label }).submit({ sourceKey, target, title?, body? }) |
decisions |
Typed judgments about text | await ctx.decisions.decide({ state, questions, community }). It never rejects. |
speech |
Speech to text | ctx.speech.listen({ community, onText, onPause?, onEnd, onError? }) returns { stop, cancel }; failures arrive on onError. To be a provider, ctx.speech.registerProvider(...), below. |
browser |
An embedded website (macOS) | ctx.browser.View inside a panel |
notices (optional) |
A notice on any page, with up to three buttons | await ctx.reflect.get("notices")?.show({ title, description?, actions? }, { signal? }) resolves with the picked action's id, or undefined if dismissed or aborted. Proceed only on an allow id. Pass a tool call's client.signal to ask the owner before it runs. |
ui (optional) |
The host's own controls | Button, Input, Field, Switch, Dialog, and Menu (newer hosts: check ui.Menu). Menu takes items (label, onSelect, tone: "destructive", disabled), a label or aria-label, icon and align. Fall back to plain elements when missing. |
host |
Commands, HTTPS, processes, files | Needs manifest.host, below |
Agent tool names match /^[a-z][a-z0-9_]{0,63}$/ and are unique across plugins; prefix them with your plugin. Changing a tool's name, description or schema restarts some agent sessions. addInstructions text is sent on every turn, so keep it short.
In a Solo region, check ui.headerMenuActions === true before passing
headerMenuActions to ui.Workspace or ui.ChannelGroup. Each Actions
entry has a unique id, a label, and an onSelect callback.
onSelect can return a promise. The host reports callback failures in the
heading.
In a Solo channel group, entries follow View channel details. An optional
icon supplies decorative artwork and hint adds short help on focus or hover.
The host rechecks the row’s channel membership before calling onSelect.
With placement: "team-row", the channel group uses the native
Team menu and ignores these entries.
Check ctx.conversation.workspaceSlots?.headerActions === true when you
render, before passing headerActions to ui.Workspace. The Channels
workspace renders those controls in the main tab's toolbar, before the
three-dot menu. The flag is absent on an older host or when the active
workspace provider does not declare the slot; keep the controls in your page
then. Use compact icon buttons with an aria-label and title, and set
aria-pressed or aria-expanded on a toggle. A plugin that replaces the
workspace with registerWorkspace(component, { slots }) names the optional
props its component renders.
Check ctx.conversation.workspaceSlots?.trailing === true in the same way
before passing trailing to ui.Workspace. The Channels workspace shows that
content as a card over the
bottom of the channel timeline, in its own scroll layer: scrolling over the
card grows it, then slides it up. Render the whole card at rest too, since
growing scrolls it into view: let expanded change labels, not what the card
holds. Keep its controls in view with position: sticky; bottom: 0 and an
opaque background, and draw its outline with a box shadow rather than a bottom
border.
Check ctx.conversation.workspaceSlots?.aside === true before passing aside
to ui.Workspace. The host places it in a box of asideWidth (default 320)
over the history's end edge, left of its scrollbar. Docked, it runs from the
history's top to the reader's bottom, and the history's rows and the composer
keep to the width beside it; when the reader would get too narrow, it floats
over the history instead, above the composer. The box
draws nothing in either mode: draw your own card, let it size to its content,
and scroll inside it when it is taller than the box. Only your content takes
pointer input, so the wheel beside or below it scrolls the history. A popover
escapes over the history only from a portal, as ui.Menu's does.
Drive it from your own header control with asideOpen and
onAsideOpenChange: docked, it shows by default; floating, it shows only once
opened. The host closes it as it floats, restores the docked state when the
reader widens, and closes the overlay on Escape or a press elsewhere in the
reader, reporting each change. Without that control a floating aside stays
closed. onAsideFloatingChange tells you whether it floats, for example to
close it after a pick. Messages under the overlay are not marked read.
For ctx.agents.ui.Transcript, give each turn a unique turnId that stays the same across reads. Return a new turn when it changes. Leave previously returned turns and their items untouched.
The host owns speech to text end to end: the microphone, a WebRTC peer
connection with one audio track and an oai-events data channel, the
transcript, pauses and the end of a listen. A provider only answers the call.
ctx.speech.registerProvider({ id, label, description, status, subscribe, connect, Settings? }) adds it to Settings > Speech to text, and the user
chooses it there. Builderlab is the default; audio never goes to a provider
the user didn't choose.
connect({ offer, community?, maxSeconds?, timeoutMs }, { signal }) gets the
host's SDP offer and resolves with { outcome: "answered", sdp, maxSeconds? },
an OpenAI Realtime transcription session's SDP answer, or { outcome: "failed", reason }. The session must send Realtime transcription events (…delta,
…completed, input_audio_buffer.committed) and leave turn detection off: the
host commits the audio at each pause and at the end. status() reports
ready, checking, unconfirmed or needs-setup, and Settings is its
sign-in or setup UI.
Check ctx.relay.snapshot().session.supportsMigrationWrites === true before
starting an import that needs migration labels. Older hosts omit this property.
The property confirms that the host signs the label. Relay support for throttling
depends on the connected community.
Pass migration: "example-import" in session.channelCreation.create(input)
and in session.memberAdditions.add(channelId, pubkey, options). The host signs
["migration", source] on channel creation (kind 9007) and membership additions
(kind 9000). The source must be a nonempty string. The tag classifies workload.
The normal access checks still apply.
The host batches membership additions by source. A migration batch that fails
delivery stops and reports the error. If a successful batch only adds some of
its members, the host keeps the source on individual additions for the rest.
Both calls report relay migration throttling with an error that starts with
rate-limited:. Pause the import before issuing another write when you see it.
Declare in manifest.json the commands, processes, network origins and files your plugin uses, then add "host" to inject. The host's own APIs only do what's declared, so this is how they get wired up. It isn't a security boundary: plugin code runs in the app and can reach past it.
{
"id": "example.status",
"name": "Status",
"apiVersion": 1,
"host": {
"commands": [{ "id": "status", "program": "git", "args": ["status", "--short"] }],
"networkOrigins": ["https://api.example.com"],
"processes": [{ "id": "agent", "program": "example-agent" }],
"files": true
}
}await ctx.host.runCommand("status", input?)runs a declared command with no shell and a 5 s deadline. It returns stdout, ornullon failure. The command's environment hasBUZZ_PLUGIN_ID, the calling plugin's manifest id. It names a well-behaved plugin, not proof: an unsandboxed plugin can call the host command with another plugin's id.await ctx.host.request({ url, method?, headers?, body? })calls a declared HTTPS origin and returns{ status, headers, body }. Plainfetchto other origins is blocked, so use this.await ctx.host.writeClipboardText?.(text)copies plain text the way Buzz does. It needs no grant; check it exists.ctx.host.spawn?.(id, { args?, onStdout? })starts a declared process (desktop only).files: trueenablesctx.host.readFileandctx.host.resolveDirectory.
Other grants (mcp, managedFiles, publicImages, publicPages, agentHooks, agentPromptSections) are in the types. A host that doesn't know a host field refuses the whole manifest.
- The host supplies the shell, navigation, error boundaries, and the outer surface of panels and Settings. Don't add your own page frame, overlays, global styles or theme. Panels sit in a host card, so render only the body. Pages own their padding and scrolling.
- Use the
uicontrols for buttons, fields, switches, dialogs and action menus. UseclassName="ui-card"for a card,var(--space-panel-inset)andvar(--space-2)for spacing, and inline styles for layout. Plainh1–h3,pandbuttonget host styling. - Use host color tokens (
var(--...)) so light and dark themes both work. Rely only on thecoreroles insrc/shared/design-system/tokens/registry.ts; other custom properties, classes anddata-*attributes are internal. - Avoid fixed widths; pages can be narrow.
- The legacy
buzz.relay-notes/notespage uses the host's Notes icon even when installed as an external plugin. - A canonical plugin page link can open beside a conversation if the named
plugin registers a matching panel with
addressable: true. Links fall back to the plugin page if the panel does not qualify. - Call
ctx.panels.useTabTitle(label, icon?, actions?)inside a panel to set its tab title. Optional{ label, run }actions appear in its context menu while the panel is mounted. Keep the actions array stable across renders. - For
ctx.agents.ui.Transcript, setendedAton a finished turn, or supplyoutcomeif its end time is unknown. Useat: 0for an unknown item timestamp. OmitcompletedAtwhen a tool's start time is unknown.
- Any runtime import, including
reactorreact/jsx-runtime. - A service missing from
inject, or an optional one listed there instead of read withctx.reflect.get. - Work at module top level, or
ctx.reactused outsideapply. - Timers, listeners or subscriptions without
ctx.effect, so they leak across reloads. - A bundler emitting several chunks, CSS or assets. Only
plugin.jsloads. - Expecting
plugin_reloadto apply amanifest.hostchange. - Invalid ids, or an unknown manifest key.
- Expecting React state to survive a reload, or a dragged-in folder to be reloadable.