Plugin API reference
What to import for each part of a plugin, and every field of Plugin.define, ctx, a tool and the browser registries, generated from the plugin API's own types.
Look up an import or a field here. Each table is generated from the published packages' types. The list under it says what each row is for. The guides show each one in use.
What to import
| Import | You import it when you |
|---|---|
@conciv/backend-plugin-api | write an engine part with async and await |
@conciv/backend-plugin-api/effect | write an engine part with Effect |
@conciv/backend-plugin-api/effect/plugin | type a helper function that takes the Effect ctx |
@conciv/backend-plugin-api/effect/rpc | type the registration your RPC handlers belong to, in Effect |
@conciv/protocol/schema/rpc | declare an RPC contract that both parts import |
@conciv/protocol/schema/tool | fail a tool call with a Tool.Error in Effect |
@conciv/frontend-plugin-api | write a browser part: panels, slots, pills, cards, settings |
@conciv/frontend-plugin-api/vite | build a browser part into the bundle the engine serves |
@conciv/react | draw a browser part's UI with React components, in your app |
@conciv/preact | draw a browser part's UI with Preact components, in your app |
@conciv/client | read data in a browser part through the widget's query cache |
@conciv/backend-test-utils | start a real engine in a test and script the agent |
Plugin.define
What the engine part's Plugin.define takes:
Prop
Type
id: the plugin's name. A config entry turns it off as-<id>.setup: runs once when the engine loads the plugin. It can return a cleanup that runs when the plugin unloads.
Prop
Type
id: the plugin's name. A config entry turns it off as-<id>.effect: runs once when the engine loads the plugin. Its scope closes when the plugin unloads.
What the browser part's Plugin.define takes:
Prop
Type
stores: values the widget keeps for the plugin. See Add settings.icons: SVG icons of your own, named forctx.ui.Icon.beforeRegister: runs once with the options, before any plugin's setup, for hooks the page needs early.enforce: ordersbeforeRegistercalls: everypre, then the rest, then everypost.setup: runs once when the widget loads the browser part. It has noid. It takes the engine part's.
Engine ctx
What setup or effect gets as ctx. In the Promise style each domain returns a Promise. In the Effect style the
same fields return an Effect.
Prop
Type
Prop
Type
app: the running conciv, with its version, release channel and platform.location: where the engine runs. Itsdirectoryis your project folder.options: the options from the plugin's config entry, as JSON.agent: change the agent profiles, such as their permission rules.event: follow the engine's events.model: list the models, and add or change them.permission: ask the user before an action. See Ask for permission.plugin: list the plugins the engine loaded.rpc: answer an RPC contract, or call another plugin's. See Share an RPC method.browserTabs: list the browser tabs a session's page plugin sees.job: start, wait on and cancel background jobs.session: list, create and drive sessions.skill: add, change and remove skills. See Add a skill.storage: a key-value store kept for your plugin, and a folder for its files.tool: add, change and remove tools, and hook into their calls. See Add a tool.servers: the dev servers the engine knows about.bundler: hook into your app's bundler, withresolveId,loadandtransform.experimental: APIs that can still change. Itsgenerateasks a model for text, decisions or an image. It isundefinedin the Effect style.
A tool
What tools.add takes:
Prop
Type
Prop
Type
name: what the agent calls. Use letters, digits and_.description: how the agent decides when to call it.input: the schema the agent's input must match. The engine checks it before your code runs.output: the schema of the result'soutput.options:codemode,namespace,permissionandpinned. See Tools and code mode.execute: runs one call. It returns aPromiseor anEffectof the result.
What execute gets as its second argument:
Prop
Type
Prop
Type
sessionId: the chat the call runs in.agent: the agent profile running the call.messageId: the agent message that holds the call, when there is one.id: the call's own id.origin: where the call came from:chatfor the widget,hubfor an agent outside it.progress: sends an update the card can show while the call runs.signal(Promise): aborts when the user stops the turn.cancel(Effect): set when the call can be cancelled.
What execute returns:
Prop
Type
output: the result the agent reads, matching theoutputschema.content: text or files for the agent, in place of or besideoutput.metadata: data for the card. The agent does not read it.
What tools is inside ctx.tool.transform:
Prop
Type
Prop
Type
list: every tool, with its full id.get: one tool by its id.namespace: describe a group of tools once.add: add one tool.update: change a tool, such as another plugin's.remove: remove a tool by its id.
An RPC method
One entry of a contract's methods:
Prop
Type
input: the schema the caller's input must match.output: the schema of what the method returns.errors: the failures callers can tell apart, each with the schema of its data.
Browser ctx
What the browser part's setup gets as ctx:
Prop
Type
id: the plugin's id, from its engine part.options: the options from the plugin's config entry.signal: aborts when the plugin reloads or stops.client: calls the engine:client.rpc(contract)andclient.event.subscribe.add: adds an entry to a registry, such asPanelorToolRegistry.listreads a registry.provideanduse: share an in-process contract with another plugin.layout: panel tabs, scroll offsets and the settings page.sessions: the sessions of open tabs, and the mounted one.screen: the mounted session's screen and its composer.storage: stores for keys known only at run time.system: the clipboard, saving files and opening URLs.desktop: opens a file in the user's editor, when the engine can.dialogs: opens dialogs that close with their owner.toast: short messages in a corner of the window.tabs: the open session tabs, across engines.links: routes local links to the plugins that handle them.ui: the widget's own Solid components, such asIcon,Button,SwitchandSettingsRow.app: the widget's version, release channel and platform.appearance: the user's appearance settings.overlay: a layer over the page, under the widget.router: the widget's route.keybinds: the keybinds of published commands.servers: the dev servers the engine knows about.attentionandcommands: not implemented yet, alwaysundefined.
Browser registries
Panel
Prop
Type
id: the panel's name, unique in your plugin.region: where the tabs go. It is required, and'pane'is the only value.list: the tabs to show. It runs again when what it reads changes.render: draws a tab's content once.close,closedandrestore: run as the user closes a tab, and bring it back.focus: runs when one of your tabs is selected.normalize,mobileandtransient: how stored tabs are matched, shown on a phone, and kept.
One tab that list returns:
Prop
Type
id: the tab's id, stored in the user's open tabs.title: the tab's name, shown when it has nolabel.label: what the tab strip draws.pinned: always in the strip.closable,draggableandtabbable: how the user can close, move and reach the tab.transient,fallback,group,missing,hiddenandfile: how the strip treats the tab.
Slot
Prop
Type
at: the place:session.header,session.status,window.bottomorpage.overlay.order: sorts the slot among others at the same place.render: draws the content once. Apage.overlayslot also takeshides.
ComposerPill
Prop
Type
id: the pill's name.order: sorts it among the other pills.show: what the pill looks like for one composer, orundefinedto hide it.menu: your own content for the popover the pill opens.
What show returns:
Prop
Type
label: the pill's text, andtitlethe popover's heading.iconandtone: the pill's icon, and its colour for success, warning or danger.run: what a click does.rows: a menu of rows, each with its ownrun, in place ofrun.
SettingsPage
Prop
Type
id: the entry's name.pageandsection: put it on the General page, or in its General section.titleandicon: how the entry reads.entries: what the settings search finds.render: draws the page, section or row.
ToolRegistry
Prop
Type
name: the tool whose calls this card draws.render: draws one call.errorComponent: draws a failed call.
What render gets:
Prop
Type
tool,inputandstatus: the tool's name, the agent's input, and where the call is.output: the result as JSON text, once the call ends.error: the message of a failed call.metadata: the call's metadata, such as progress updates.- The other props are how the widget opens, locks and lays out the card.
Load a part lazily
Any render above can draw a component made with Solid's lazy(), such as
render: lazy(() => import('./ticket-card.js')). The part loads the first time it shows, and the widget shows its own
loader until then.
Render in any framework
Every render above takes a Solid component. Three helpers turn your own UI into one, so a browser part can draw in
another framework:
| Helper | Import | Draws with |
|---|---|---|
mountRender | @conciv/frontend-plugin-api | plain DOM, or any framework you mount by hand |
reactRender | @conciv/react | a React component, inside your app's React tree |
preactRender | @conciv/preact | a Preact component, inside your app's Preact tree |
Each one fits every render a registry takes: a panel, a slot, a settings page, a pill's menu, a code block and a tool card.
mountRendercalls your mount function with an element and the props, once the element is in the page. The mount returns a cleanup, which runs when the widget removes the contribution.props.current()gives the props as they are now.props.subscribe(listener)calls the listener at once and on every change, and returns a stop function.- The React and Preact helpers draw through a portal into your app's tree, so your providers reach the component.
They need a
<ConcivWidget>from the same package above them, and throw without one. <ConcivWidget>mounts the widget itself. Setwidget: falseon the conciv bundler plugin, so the page does not get a second one.- A plugin folder's browser part is built with
experimental(), which compiles Solid. React and Preact UI lives in your app as aPlugin.Setup. You give it to<ConcivWidget>in its plugins. - The widget's reactive values, such as
run.status(), are Solid signals. So is a store's value. Outside Solid, read them in the function you pass toctx.add, which runs again when they change.
Learn more in Build your first plugin.
Next steps
- Build your first plugin: every part in one tutorial.
- Plugins: every guide.