Skip to Content
Plugins

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

ImportYou import it when you
@conciv/backend-plugin-apiwrite an engine part with async and await
@conciv/backend-plugin-api/effectwrite an engine part with Effect
@conciv/backend-plugin-api/effect/plugintype a helper function that takes the Effect ctx
@conciv/backend-plugin-api/effect/rpctype the registration your RPC handlers belong to, in Effect
@conciv/protocol/schema/rpcdeclare an RPC contract that both parts import
@conciv/protocol/schema/toolfail a tool call with a Tool.Error in Effect
@conciv/frontend-plugin-apiwrite a browser part: panels, slots, pills, cards, settings
@conciv/frontend-plugin-api/vitebuild a browser part into the bundle the engine serves
@conciv/reactdraw a browser part's UI with React components, in your app
@conciv/preactdraw a browser part's UI with Preact components, in your app
@conciv/clientread data in a browser part through the widget's query cache
@conciv/backend-test-utilsstart 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 for ctx.ui.Icon.
  • beforeRegister: runs once with the options, before any plugin's setup, for hooks the page needs early.
  • enforce: orders beforeRegister calls: every pre, then the rest, then every post.
  • setup: runs once when the widget loads the browser part. It has no id. 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. Its directory is 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, with resolveId, load and transform.
  • experimental: APIs that can still change. Its generate asks a model for text, decisions or an image. It is undefined in 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's output.
  • options: codemode, namespace, permission and pinned. See Tools and code mode.
  • execute: runs one call. It returns a Promise or an Effect of 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: chat for the widget, hub for 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 the output schema.
  • content: text or files for the agent, in place of or beside output.
  • 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) and client.event.subscribe.
  • add: adds an entry to a registry, such as Panel or ToolRegistry. list reads a registry.
  • provide and use: 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 as Icon, Button, Switch and SettingsRow.
  • 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.
  • attention and commands: not implemented yet, always undefined.

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, closed and restore: run as the user closes a tab, and bring it back.
  • focus: runs when one of your tabs is selected.
  • normalize, mobile and transient: 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 no label.
  • label: what the tab strip draws.
  • pinned: always in the strip.
  • closable, draggable and tabbable: how the user can close, move and reach the tab.
  • transient, fallback, group, missing, hidden and file: how the strip treats the tab.

Slot

Prop

Type

  • at: the place: session.header, session.status, window.bottom or page.overlay.
  • order: sorts the slot among others at the same place.
  • render: draws the content once. A page.overlay slot also takes hides.

ComposerPill

Prop

Type

  • id: the pill's name.
  • order: sorts it among the other pills.
  • show: what the pill looks like for one composer, or undefined to hide it.
  • menu: your own content for the popover the pill opens.

What show returns:

Prop

Type

  • label: the pill's text, and title the popover's heading.
  • icon and tone: 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 own run, in place of run.

SettingsPage

Prop

Type

  • id: the entry's name.
  • page and section: put it on the General page, or in its General section.
  • title and icon: 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, input and status: 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:

HelperImportDraws with
mountRender@conciv/frontend-plugin-apiplain DOM, or any framework you mount by hand
reactRender@conciv/reacta React component, inside your app's React tree
preactRender@conciv/preacta 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.

  • mountRender calls 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. Set widget: false on 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 a Plugin.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 to ctx.add, which runs again when they change.

Learn more in Build your first plugin.

Next steps

On this page