Plugin Developer Docs
Build plugins for the AnBoWork desktop app: add new tools for the AI, dock your own panel next to a session, send system notifications, parse new file formats. One manifest.json plus one entry script is enough to get started.
01Overview
A AnBoWork plugin is a plain Node.js program. After installation the app forks it as a standalone child process (pure Node, no Electron API) and talks to it over inter-process messages. No SDK package is required; all you need is process.on('message') and process.send().
Everything a plugin can do is declared statically in manifest.json: the pre-install consent page and marketplace review can tell which tools it adds and which permissions it needs without running any plugin code. All UI (toolbar icons, settings, command palette, context menus) is rendered by the host from the declaration; plugin code never runs inside the main window. Only docked views and floating panels are your own HTML, and they run in isolated sandboxed pages.
Capabilities at a glance
| Manifest field | Capability | Where users see it |
|---|---|---|
tools | Add callable tools for the AI | The AI calls them automatically in conversation; tool calls are shown in the session |
views | Persistent view docked in the session's right sidebar | Tucked into the session toolbar's "⋮" menu by default; opening it shows your page on the right. Only views declared pinned get their own toolbar icon |
ui | Standalone floating window | Opened from the "⋯" menu in the plugin list |
sessionAction | Persistent action icon in the session toolbar | One click runs the tool you specify |
configuration | Entries on the settings page | Settings → Plugin configuration; values are passed with every call |
commands | Ctrl/Cmd+K command palette entries | Command palette |
keybindings | Global keyboard shortcuts | A key combination triggers a command |
menus | Session context-menu items | The "⋯" / right-click menu on a session row |
documentParsers | Parse files dropped into the input box | Called automatically when the user drops a matching file |
activationEvents | Start together with the app | Invisible; for plugins that need background timers |
permissions | Declare required permissions | Pre-install consent page |
02Quick Start
A minimal plugin needs only two files.
1. Write manifest.json
2. Write the entry script
3. Install into the app
Open AnBoWork → top bar "Tools" → "Plugins" → "Install locally" in the top-right corner, then pick the plugin folder (or a zip of it). A consent page lists the declared permissions and every tool before installation; confirm to enable.
4. Try it
In any session, tell the AI "ask the plugin to say hello to Alice". Based on the tool description the AI decides to call say_hello, and the call and its result appear in the session.
03Manifest Fields
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Reverse-domain style, e.g. com.example.my-plugin. Letters, digits, dots and hyphens only. Immutable once created; installing the same id again is treated as a reinstall. |
name | string | Yes | Plugin name. Together with description it is fed to the model as context, so English is recommended. |
version | string | Yes | Semantic version; the marketplace uses it to detect updates. |
description | string | Yes | One sentence describing what the plugin does (English, up to 700 characters). It is also what the AI uses to decide whether to suggest installing it; see “Recommendation text”. |
author | string | No | Author. |
readme | string | No | Long-form description shown on the marketplace detail page, supports Markdown. Images inside it must be https URLs — relative paths to files bundled in the zip are not supported. |
icon | string | No | Icon shown in the marketplace list and detail page — a relative path to a file bundled in the zip (e.g. icon.png). Must be PNG, not SVG, at least 128×128. |
main | string | Yes | Entry script, relative to the plugin folder. .. escaping the folder is not allowed. |
permissions | string[] | Yes | network / filesystem / notifications / account; may be an empty array. See "Permission Model". |
tools | object[] | Yes | Tool declarations; may be an empty array. See "Tools & Call Protocol". |
documentParsers | object[] | No | File parsing capability. |
ui | object | No | Floating panel: { entry, title } |
views | object[] | No | Docked views: { id, title, icon, entry, width?, pinned? } |
sessionAction | object | No | Toolbar icon, at most one per plugin. |
configuration | object[] | No | List of settings entries. |
commands | object[] | No | Command palette entries. |
keybindings | object[] | No | Shortcuts. command must reference the tool of an entry in commands[], otherwise installation is rejected. |
menus | object | No | Only the session/context location is available for now. |
activationEvents | string[] | No | Only onStartupFinished for now. |
defaultLocale | string | No | Language code of the human-facing text written in this manifest (zh, en…). Used together with localizations; see "Localization (i18n)". |
localizations | object | No | Translations of the human-facing text, keyed by language code. See "Localization (i18n)". |
Language conventions for text
Text in the manifest has two audiences. For the model: name, description, tools[].description, tools[].parameters.*.description. Write these in English and never translate them; models understand English tool descriptions and fill parameters more reliably. For people: tools[].summary (one-line summary on the consent page), tools[].confirmation, ui.title, views[].title, sessionAction.tooltip, configuration[].label, commands[].title and title inside menus. Write the original in any language, declare it with defaultLocale and add translations under localizations so it follows the app's interface language (see "Localization (i18n)").
04Permission Model
permissions must honestly reflect what the code actually does. The pre-install consent page lists each one so users can decide whether to install; marketplace review also checks the declaration against the code.
| Permission | When it must be declared | How the host treats it |
|---|---|---|
filesystem | Reading or writing user files (reading project code, generating documents, storing data in the home folder) | Informed consent, shown to the user. |
network | Making any network request (third-party APIs, downloads) | Informed consent, shown to the user. |
notifications | Showing system notifications via the show_notification reverse RPC | Enforced: calling it without the declaration returns host_error and no notification is shown. |
account | Calling the AnBoWork backend as the signed-in user via the reverse RPC piomodel_api_request, or using render_office_cloud / publish_office_preview | Enforced: without the declaration the host returns host_error. The login token stays in the main process, which attaches it on your behalf; it never enters the plugin process. Only allow-listed API paths are accepted (/api/user/sites, /api/user/office-authoring, /api/user/office-documents, /api/user/office-previews/:id/source), so even with this permission a plugin cannot change the user's password or email. |
filesystem and network are currently consent-level declarations, not a runtime sandbox: the host does not intercept fs or fetch. That is exactly why declarations must be honest. Plugins that under-declare are rejected in marketplace review and lose user trust when discovered. Do not over-declare either (unused permissions make users hesitate).Privacy and data
context.cwd is the user's project folder and may contain source code and sensitive configuration; tool arguments may contain the user's conversation. Do not send this data over the network unless the feature requires it, and when you do, state in description and summary what is sent and to whom. Keep the plugin's own persistent data in a file under the user's home folder named after the plugin id, so it is easy to find when uninstalling.
05Tools & Call Protocol
Declaration
| Field | Description |
|---|---|
name | Tool name in lowercase letters and underscores, unique across the whole app (it is registered with the model alongside built-in tools and other plugins' tools). |
description | Description for the model (English). State three things: what the tool does, what the user says when it should be called, and when it must not be called. This is the single most important field for whether the AI uses your plugin. |
summary | One-line human-readable summary shown on the consent page. Optional but strongly recommended; otherwise a truncated description is shown instead. |
parameters | Standard JSON Schema object with a description on every property. The model fills arguments from it and the host passes them through without extra validation, so check required fields in your code. |
renderAs | Optional; currently only checklist: the host renders the todos array from the call arguments as a checklist card, see below. |
confirmation | Optional. When declared, a call whose params[param] is one of values runs only after the user clicks a confirmation card in the chat; see "Confirmation before execution" below. |
timeoutSeconds | Optional. Seconds a single call may run before the host gives up (default 30, clamped to 30–900). Only for tools that keep making progress for a long time, such as uploading a large folder; do not use it to mask a hang. |
tools[] here — sessionAction.tool, commands[].tool, and the tool field inside menus are only checked to be non-empty strings at install time; the host does not verify the name is declared in tools[], and still dispatches a call under that name when the button, shortcut, or menu item is triggered. So a purely UI-triggered action can be handled entirely in your own index.js without ever appearing in tools[] — but then the AI can never see or call it. If you want the same action to be triggerable both by clicking and by the AI acting on a chat request, declare that same name in tools[] too, so both entry points share one handler; if it's meant to stay UI-only, leave it undeclared — there's no need to add an entry just to look complete.Confirmation before execution: confirmation
Irreversible actions such as publishing or deleting must not rely on the model "asking first" — prompts cannot guarantee that. Declare confirmation on the tool and the host suspends the call before touching your process, renders a confirmation card with buttons in the message stream, and sends call_tool only after the user confirms. If the user cancels, your code never runs and the model receives an ordinary result starting with [user-declined] (not an error, so it will not retry). title, message, confirmLabel and detailParams[].label are shown to people; write them in your users' language. once: true marks a standing grant (for example "allow uploading documents to the cloud"): after one confirmation, later calls to the same tool in this app run no longer show the card. Do not set once for one-off actions such as publishing or deleting.
Message protocol
The host sends call_tool; the plugin must reply with a tool_result or tool_error carrying the same requestId. A call with no reply within 30 seconds times out and the model receives an error.
content accepts only text and image blocks (image as base64 data plus mimeType); other types are dropped. details is arbitrary structured data that is never fed to the model; it is for host UI rendering and your own docked views.
File results: file cards
Checklist rendering: renderAs checklist
Writing a good description
Describe the trigger in the imperative ("Call this when the user asks to…") and state exclusions ("Do not call this for…"). If the result is a file, ask the model to reference the returned file link rather than claiming it was generated. If arguments are forwarded to an external generation API, say which language they should be in. Avoid one-liners like "manage todos"; the model will not know when to use the tool.
06Docked views (views)
A docked view is a persistent page in the session's right sidebar: an extra icon appears in the session toolbar and your HTML shows on the right when opened. Page state (scroll position, drafts) survives switching sessions and collapsing/expanding, the same semantics as a VS Code sidebar view.
| Field | Description |
|---|---|
id | Unique within the plugin. |
title | Tooltip text for the icon (human readable). |
icon | Pick from the host allowlist: git-branch, checklist, world. Keeps icons consistent across the app; custom images are not accepted. |
entry | HTML file, relative to the plugin folder. |
width | Optional default panel width in pixels, 240 to 640, default 360. Users can drag to resize and the size is remembered. |
pinned | Optional, default false. By default every plugin view is collected into the session toolbar's "⋮" overflow menu instead of taking a permanent icon; only pinned: true gives the view its own permanent toolbar icon. Do not set it to true just for visibility — a toolbar that grows one icon per installed plugin is exactly what the default avoids. |
Page runtime
The page runs in a sandbox (sandbox + contextIsolation, no Node, no access to host app data) and can only talk to its own plugin process through the few methods on window.pluginHost. Bring your own styles; following the app's light/dark scheme as in the example below is recommended.
Recommended pattern: on first load call one of your own query tools with invoke() and have it return structured data in details; afterwards push every change from the plugin process with ui_push instead of polling. When the AI changes data in the conversation, the panel refreshes immediately.
The host does not draw a header for docked views, so draw the close button in your own page and call <code>window.pluginHost.closeView()</code> on click; older app versions lack this method, so check <code>typeof host.closeView === 'function'</code> before rendering the button. Links with <code>target="_blank"</code> need no handling: on the session page they open in the in-app browser panel, on the new-session page they fall back to the system browser.
A page can also draw a “Send to chat” button that calls <code>window.pluginHost.composeMessage({ text })</code>: the host <strong>appends</strong> the text to the end of the draft in the user's current input box (it never overwrites what they have typed) and focuses the box, but <strong>does not send it</strong> — the user decides whether to edit it and press send. No permission is needed and there is no limit on how many times you can call it; a single call is capped at 100,000 characters. It resolves to <code>{ delivered: true }</code>, or <code>{ delivered: false, reason: 'no_composer' }</code> when the current page has no input box. Older app versions lack this method, so check <code>typeof host.composeMessage === 'function'</code> before drawing the button.
07Floating panel (ui)
ui: { entry, title } declares a standalone floating window (900×700) that users open from the "⋯" menu in the plugin list; it is destroyed on close. The page environment and the window.pluginHost API are identical to docked views, and ui_push is delivered to both the floating panel and docked views. Suited to large panels opened occasionally; use views for content that should stay next to the session.
08Session toolbar icon (sessionAction)
At most one persistent icon per plugin. Clicking it calls tool with empty arguments, so that tool must do something meaningful without parameters.
| Field | Description |
|---|---|
tool | Tool to call on click. |
icon | Allowlisted icon name. |
tooltip | Hover text. |
visibleTool | Optional. When set, it is called with empty arguments before rendering and the boolean details.visible in the result decides whether the icon shows. Useful for runtime checks such as "is the current folder a git repository". |
09Settings (configuration)
Declared entries appear under plugin configuration on the settings page. The host stores values changed by the user and passes them as context.config on every call_tool (keyed by id, falling back to defaultValue), whether the call comes from the AI, the toolbar icon or your panel. You never need to ask for them.
| type | Rendered as | defaultValue type |
|---|---|---|
select | Single-choice list; options come from optionsTool | string |
boolean | Toggle switch | boolean |
string | Text input, committed on blur | string |
number | Number input | number |
10Command palette / shortcuts / context menu
All three are different entry points for "call a tool with empty arguments"; a plugin can declare several.
| Field | Shape | Description |
|---|---|---|
commands | { tool, icon, title }[] | Shown in the Ctrl/Cmd+K command palette and triggered after the user searches for it. |
keybindings | { command, key }[] | command must equal the tool of an entry in commands[]. key uses the mod+shift+g notation, where mod is Cmd on macOS and Ctrl elsewhere. Conflicts with other shortcuts are not checked statically, so pick uncommon combinations. |
menus | { "session/context": { tool, icon, title }[] } | Added to the menu on a session row. Only this location is available for now. |
11Localization (i18n)
The app has 19 interface languages. Human-facing plugin text (consent summaries, confirmation cards, panel titles, tooltips, setting labels, command titles, plus your own panel page and system notifications) should follow the interface language. Text for the model is never localized: keep name, description, tools[].description, parameter descriptions and the text your tools return to the model in English.
Text in the manifest
Write the original text in the usual fields and declare its language with defaultLocale. Put translations under localizations, keyed by language code, and list only the fields you translate. Entries are keyed by tool name, view id and setting id instead of array position, so reordering declarations never mixes up translations.
| Field inside a translation | What it translates |
|---|---|
name / description | Name and one-sentence blurb shown in the plugin list and install page. For people only: the model keeps reading the top-level English fields. Every language, including the original one, may have its own. |
tools.<tool>.summary | The one-line summary on the consent page. |
tools.<tool>.confirmation | Confirmation card text: title, message, confirmLabel, and detailLabels (a parameter name mapped to its row label on the card). |
ui.title / views.<id>.title | Title of the floating panel and of each docked view (views are keyed by id). |
sessionAction.tooltip | Tooltip of the session toolbar icon. |
configuration.<id>.label | Label of each setting (keyed by setting id). |
commands.<tool>.title / menus.<location>.<tool>.title | Command palette titles (keyed by tool name) and context-menu titles (keyed by location, then tool name). |
Resolution order
The host picks text in this order: the interface language itself, then a close relative (zh-TW and zh-HK back each other up, pt-BR falls back to pt), then en, then the original text. Resolution stops at defaultLocale and uses the original text there, so a plugin whose original is Chinese is never overridden by an English translation. Missing fields fall back one by one. App interface languages: zh, en, zh-TW, zh-HK, ja, ko, vi, id, tr, de, fr, es, pt-BR, hi, ar, ru, fa, pl, he. Old app versions do not know these two fields and keep showing the original text.
Text your plugin shows at runtime
System notifications and your panel page are produced by your own code, so you localize them yourself. The host reports the interface language in three ways: the PIOMODE_LOCALE environment variable when your process is forked; a locale_changed message with a locale field whenever the user switches language; and pluginHost.getLocale() / pluginHost.onLocaleChange() in panel pages. Put your translation tables directly in index.js and your page HTML, because publishing only packages the manifest, the main file and page HTML.
12Document parsers (documentParsers)
This capability is effectively retired. For files dropped into the input box that have a path on disk, the client now only records the path and sends it as an @path reference for the official CLI to read itself; plugin parsers are no longer invoked. documentParsers is only used to decide whether any plugin could parse a MIME type, which drives the status shown on the attachment chip — the parsing itself never happens. New plugins do not need to implement it; existing declarations are harmless, but do not add parser tools to tools.
13Reverse RPC (host_request)
The plugin process has no Electron API. When it needs a real system capability it sends host_request to the host, which replies with host_response or host_error. This channel is fully independent of call_tool; you can use it while handling a tool call or from a timer.
| capability | params | result | Precondition |
|---|---|---|---|
show_notification | { title, body?, viewId? } | { shown: true } / { shown: false, reason: "disabled" | "unsupported" } | Requires the notifications permission. Returns disabled instead of an error when the user turned off desktop notifications in settings. When viewId points to one of your docked views, clicking the notification brings the app to the front and expands that view. |
render_pdf | { outputPath, title, content } | {} | content is Markdown; the host renders a PDF to outputPath with its built-in renderer. |
rasterize_pdf | { pdfBase64, width, pages: number[] } | { totalPages, images: string[] } | No permission needed. Renders the PDF in pdfBase64 to PNGs width pixels wide for the given pages (1-based); images is an array of base64 strings. Useful for rendering your output into images the model can inspect. |
piomodel_api_request | { method, path, body? } | { ok: true, envelope: { code, msg, data? } } / { ok: false, message } | Declare the account permission. Requests the AnBoWork backend as the signed-in user: the main process attaches the login token (it never enters the plugin process) and only allow-listed paths are accepted (see "Permission Model"); other paths return host_error. envelope is the backend response as-is. |
compose_message | { text } | { delivered: true } / { delivered: false, reason: "no_composer" } | No permission needed. Appends text to the end of the draft in the user's current input box and focuses it, without sending; the user decides whether to edit it and press send. It never overwrites existing content, has no call-count limit, and one call is capped at 100,000 characters. When the current page has no input box (for example Settings) it returns no_composer instead of failing. Panel pages use window.pluginHost.composeMessage(), which goes through the same path. |
open_external | { url } | { opened: true } / { opened: false, reason: "invalid_params" | "permission_denied" | "not_allowed" } | Declare the <code>account</code> permission (no new permission name is added). Opens a payment page in the system browser, but <strong>only</strong> the <code>redirect_url</code> your plugin has just received from the allow-listed <code>orders/link</code> / <code>renew-orders/link</code> endpoints (VPS purchase and renewal): the host records it when it relays the response, and it works once, within 20 minutes, only for the plugin that received it, and only if it is an https <code>/pay?k=…</code> checkout link. Any other URL is refused. Returns <code>{ opened: true }</code>, or <code>{ opened: false, reason }</code> (<code>invalid_params</code> / <code>permission_denied</code> / <code>not_allowed</code>) without throwing. Older app versions do not have this capability (the call fails with <code>host_error</code>), so probe it first (for example with an empty <code>url</code>) and fall back to a plain explanation instead of creating an order that cannot be paid. |
render_office_cloudpublish_office_preview | { filePath | url, pages: number[] }{ filePath } | { status: "ready" | "pending" | "failed", … }{ ok: true, url, … } | Declare the account permission; both upload the file to the server. render_office_cloud converts a docx/xlsx/pptx (a local filePath or an already-online url) into page images and returns them; while conversion is still running it returns pending, call again later. publish_office_preview publishes a local Office file as an online preview and returns its link. The user's consent to upload must be gated by your own tool's confirmation card. |
14Lifecycle
| Stage | Behavior |
|---|---|
| Start | Lazy by default: not started with the app, forked on the first call to one of your tools (AI, toolbar icon, panel, command). Plugins declaring activationEvents: ["onStartupFinished"] start right after the app finishes launching; use this only for plugins that need background timers (reminders, polling), not for ordinary tool plugins. |
| Resident | Once started the process stays alive and is reused across tool calls. You may cache state in memory, but assume it can be restarted at any time. |
| Crash | If the process exits unexpectedly the host restarts it: immediately, then after 5 and 15 seconds. After 3 consecutive failures it is marked "crashed" and no longer retried; users see the status on the plugin page. In-flight calls all return errors. |
| Disable / uninstall / reinstall | The process is terminated and docked views and floating panels are destroyed; a reinstall replaces the whole folder. |
| Logs | Your stdout/stderr are written to the app log file prefixed with the plugin id. Plain console.log is enough for debugging; see "Debugging & FAQ". |
ELECTRON_RUN_AS_NODE=1, cwd is the plugin install folder, and the Node version matches the Electron bundled with the app. Do not depend on any globally installed package and do not assume npx exists.15Packaging & Publishing
Packaging
Zip the plugin folder with manifest.json at the archive root. If you have third-party dependencies, bundle them into a single file with esbuild/webpack first instead of shipping the whole node_modules.
Publishing to the marketplace
AnBoWork → Tools → Plugins → "Marketplace" tab → "Publish plugin" in the top-right corner, then upload the zip. Submissions enter review, which checks that the manifest declaration matches the code (especially permissions). Review progress and rejection reasons are shown under "My submissions" in the same "Publish plugin" drawer. Once approved, other users can find and install it in the marketplace, and the AI can install verified or built-in plugins for users automatically when it deems them needed.
Review and resubmission
There is exactly one record per plugin id + version: a rejected version can be fixed and resubmitted under the same version number (the record is reset to pending); a version that is under review or approved cannot be submitted again, bump version instead. A plugin can have only one version under review at a time — wait for the result before submitting the next.
Updates
Bump version and publish again. The app compares the installed version with the marketplace version and prompts to update. If the plugin is enabled and the new version declares no new permissions, the update installs directly in the enabled state without showing the consent page again (the user's original consent still covers it); only a first install or expanded permissions ask again. Reinstalling keeps the user's enabled state and settings values. Sessions that are already open do not get the new tools after an update — start a new session.
16Recommendation text (get your plugin suggested)
Before a plugin is installed the AI cannot see its tool descriptions. It decides whether to suggest or auto-install the plugin from the top-level description in the manifest alone, so that sentence is your plugin’s recommendation text and deserves its own polish.
| Point | How to write it |
|---|---|
| Language and length | English, up to 700 characters. The AI reads this original text; the name and summary users see go into localizations separately (see “Localization”) and do not affect it. |
| Trigger scenarios | Use trigger wording such as Install this whenever the user wants to… and list concrete scenarios and synonyms (share, publish, host, deploy…). A bare noun like “a todo plugin” gives the model nothing to match, so it never thinks of installing it. |
| Proactive actions | Put what the model should do on its own (for example, publish right after generating HTML) first, as an imperative. Writing it only in the tool description does not work: the model cannot see tool descriptions before install. |
| Who gets suggested | Only official built-in plugins and plugins from verified developers are proactively suggested and installed by the AI; all others can only be installed by users from the market. A confirmation card always appears in the chat before an install, and nothing is installed until the user clicks Install. |
17Full example: Todo Quadrant
A real, working plugin (trimmed): the AI can add and remove todos, the right sidebar shows a board that refreshes in real time, and it can send system notification reminders. Chaining these three covers the tool protocol, docked-view pushes and reverse RPC.
18Debugging & FAQ
| Symptom | Cause and fix |
|---|---|
| Manifest validation fails on install | Check each field against the "Manifest Fields" table as the message indicates: id format, main/entry must not contain .., icon must be allowlisted, keybindings command must point to an existing tool in commands, width between 240 and 640. |
| The AI never calls my tool | First make sure you are testing in a session created after installing/enabling — tools are registered with the AI when a session starts, older sessions cannot see them. Beyond that it is almost always a description problem: the trigger is unclear or it is not written in English. See "Writing a good description". Also check that the tool name does not collide with another tool. |
| Call times out (30 s) | The entry script did not reply with tool_result. Usually requestId was not echoed back, the message type is misspelled, or the script threw on startup and exited. Look for lines prefixed with [plugin:your-id] in the app log. |
| Plugin status shows "crashed" | 3 consecutive failed starts. Commonly a require of a missing package; running node index.js in the plugin folder reproduces it. After fixing, toggle the plugin off and on again on the plugin page. |
| Panel opens blank | Wrong entry path, or a JS error on the page. The page runs in a sandbox without Node's require; only window.pluginHost is available. |
| Notification does not appear | Check in order: the manifest declares notifications; the result is not shown:false (the user turned off desktop notifications); the OS allows notifications from AnBoWork. |
| Settings values are not readable | Values are in message.context.config[id], not in params. |
Log file location
| OS | Path |
|---|---|
| macOS | ~/Library/Logs/AnBoWork/main.log |
| Windows | %USERPROFILE%\AppData\Roaming\AnBoWork\logs\main.log |