// Developer Guide

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 fieldCapabilityWhere users see it
toolsAdd callable tools for the AIThe AI calls them automatically in conversation; tool calls are shown in the session
viewsPersistent view docked in the session's right sidebarTucked 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
uiStandalone floating windowOpened from the "⋯" menu in the plugin list
sessionActionPersistent action icon in the session toolbarOne click runs the tool you specify
configurationEntries on the settings pageSettings → Plugin configuration; values are passed with every call
commandsCtrl/Cmd+K command palette entriesCommand palette
keybindingsGlobal keyboard shortcutsA key combination triggers a command
menusSession context-menu itemsThe "⋯" / right-click menu on a session row
documentParsersParse files dropped into the input boxCalled automatically when the user drops a matching file
activationEventsStart together with the appInvisible; for plugins that need background timers
permissionsDeclare required permissionsPre-install consent page

02Quick Start

A minimal plugin needs only two files.

my-plugin/
├── manifest.json   # plugin manifest (required)
├── index.js        # entry script, referenced by manifest.main (required)
├── view.html       # docked view page (optional, manifest.views[].entry)
└── ui.html         # floating panel page (optional, manifest.ui.entry)

1. Write manifest.json

{
  "id": "com.example.hello",
  "name": "Hello Plugin",
  "version": "1.0.0",
  "description": "Say hello to the user.",
  "main": "index.js",
  "permissions": [],
  "tools": [
    {
      "name": "say_hello",
      "summary": "Greet the user by name",
      "description": "Return a greeting for the given name. Call this when the user explicitly asks the plugin to say hello.",
      "parameters": {
        "type": "object",
        "properties": {
          "name": { "type": "string", "description": "Who to greet." }
        },
        "required": ["name"]
      }
    }
  ]
}

2. Write the entry script

// The entry script runs in a standalone Node.js child process (ELECTRON_RUN_AS_NODE=1).
// Only Node built-ins and dependencies shipped inside the plugin folder are available;
// there is no Electron API.
process.on('message', (msg) => {
  if (!msg || msg.type !== 'call_tool') return;
  const { requestId, toolName, params } = msg;
  try {
    if (toolName !== 'say_hello') throw new Error(`unknown tool: ${toolName}`);
    process.send({
      type: 'tool_result',
      requestId,
      content: [{ type: 'text', text: `Hello, ${params.name}!` }],
    });
  } catch (err) {
    process.send({ type: 'tool_error', requestId, message: err.message });
  }
});

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.

TIP
A plugin's tools are registered with the AI once, when a session starts. After installing, updating or enabling a plugin, start a new session for the AI to see the new tools; sessions that are already open do not refresh. The consent page shown before installation says the same.

03Manifest Fields

FieldTypeRequiredDescription
idstringYesReverse-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.
namestringYesPlugin name. Together with description it is fed to the model as context, so English is recommended.
versionstringYesSemantic version; the marketplace uses it to detect updates.
descriptionstringYesOne 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”.
authorstringNoAuthor.
readmestringNoLong-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.
iconstringNoIcon 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.
mainstringYesEntry script, relative to the plugin folder. .. escaping the folder is not allowed.
permissionsstring[]Yesnetwork / filesystem / notifications / account; may be an empty array. See "Permission Model".
toolsobject[]YesTool declarations; may be an empty array. See "Tools & Call Protocol".
documentParsersobject[]NoFile parsing capability.
uiobjectNoFloating panel: { entry, title }
viewsobject[]NoDocked views: { id, title, icon, entry, width?, pinned? }
sessionActionobjectNoToolbar icon, at most one per plugin.
configurationobject[]NoList of settings entries.
commandsobject[]NoCommand palette entries.
keybindingsobject[]NoShortcuts. command must reference the tool of an entry in commands[], otherwise installation is rejected.
menusobjectNoOnly the session/context location is available for now.
activationEventsstring[]NoOnly onStartupFinished for now.
defaultLocalestringNoLanguage code of the human-facing text written in this manifest (zh, en…). Used together with localizations; see "Localization (i18n)".
localizationsobjectNoTranslations 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)").

{
  "id": "com.example.full",
  "name": "Full Example",
  "version": "1.2.0",
  "description": "Every contribution point in one manifest.",
  "author": "Example Inc.",
  "readme": "## Full Example\n\nLonger Markdown shown on the marketplace detail page. Images must be https URLs.",
  "icon": "icon.png",
  "main": "index.js",
  "permissions": ["filesystem", "network", "notifications", "account"],
  "activationEvents": ["onStartupFinished"],
  "tools": [
    {
      "name": "do_something",
      "summary": "Do one thing to the current project",
      "description": "…English. State clearly when to call this and when not to…",
      "parameters": { "type": "object", "properties": {}, "required": [] },
      "renderAs": "checklist"
    },
    {
      "name": "manage_reports",
      "summary": "Publish or list reports",
      "description": "…publish is irreversible; the host shows a confirmation card before running it…",
      "parameters": {
        "type": "object",
        "properties": {
          "action": { "type": "string", "enum": ["publish", "list"] },
          "path": { "type": "string", "description": "Report file to publish." }
        },
        "required": ["action"]
      },
      "confirmation": {
        "param": "action",
        "values": ["publish"],
        "title": "Publish this report?",
        "message": "The report becomes publicly reachable. This cannot be undone.",
        "confirmLabel": "Publish",
        "detailParams": [{ "param": "path", "label": "File" }]
      }
    },
    { "name": "is_available", "summary": "Whether the current folder applies", "description": "…", "parameters": { "type": "object", "properties": {} } },
    { "name": "list_modes", "summary": "List selectable modes", "description": "…", "parameters": { "type": "object", "properties": {} } }
  ],
  "ui": { "entry": "ui.html", "title": "Example Panel" },
  "views": [
    { "id": "board", "title": "Example Board", "icon": "checklist", "entry": "view.html", "width": 380, "pinned": false }
  ],
  "sessionAction": {
    "tool": "do_something",
    "icon": "git-branch",
    "tooltip": "Do one thing to the current project",
    "visibleTool": "is_available"
  },
  "configuration": [
    { "id": "mode", "label": "Mode", "type": "select", "optionsTool": "list_modes", "defaultValue": "auto" },
    { "id": "verbose", "label": "Verbose output", "type": "boolean", "defaultValue": false },
    { "id": "prefix", "label": "Prefix", "type": "string", "defaultValue": "" },
    { "id": "limit", "label": "Max items", "type": "number", "defaultValue": 20 }
  ],
  "commands": [
    { "tool": "do_something", "icon": "git-branch", "title": "Do one thing to the current project" }
  ],
  "keybindings": [
    { "command": "do_something", "key": "mod+shift+d" }
  ],
  "menus": {
    "session/context": [
      { "tool": "do_something", "icon": "git-branch", "title": "Do one thing to this session" }
    ]
  }
}

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.

PermissionWhen it must be declaredHow the host treats it
filesystemReading or writing user files (reading project code, generating documents, storing data in the home folder)Informed consent, shown to the user.
networkMaking any network request (third-party APIs, downloads)Informed consent, shown to the user.
notificationsShowing system notifications via the show_notification reverse RPCEnforced: calling it without the declaration returns host_error and no notification is shown.
accountCalling the AnBoWork backend as the signed-in user via the reverse RPC piomodel_api_request, or using render_office_cloud / publish_office_previewEnforced: 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.
NOTE
The plugin child process is a full Node.js environment. 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

FieldDescription
nameTool 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).
descriptionDescription 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.
summaryOne-line human-readable summary shown on the consent page. Optional but strongly recommended; otherwise a truncated description is shown instead.
parametersStandard 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.
renderAsOptional; currently only checklist: the host renders the todos array from the call arguments as a checklist card, see below.
confirmationOptional. 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.
timeoutSecondsOptional. 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.
Note
The model can only call tool names declared in 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.

// manifest.tools[]: a call needs the user's click only when params[param] is one of values.
{
  "name": "manage_html_sites",
  "description": "…",
  "parameters": { "type": "object", "properties": { "action": { "type": "string", "enum": ["publish", "list", "unpublish"] }, "path": { "type": "string" } }, "required": ["action"] },
  "confirmation": {
    "param": "action",
    "values": ["publish"],                       // list / unpublish run without a card
    "title": "Publish this page to the web?",
    "message": "Anyone with the link can open it. Confirm to continue.",
    "confirmLabel": "Publish",
    "detailParams": [{ "param": "path", "label": "File" }],   // shown on the card as "File: <params.path>"
    "once": false                                // true = a standing grant: ask once per app run, not per call
  }
}

// The host pauses BEFORE your process is called and renders the card in the chat.
// Confirmed → call_tool arrives as usual. Declined → your code never runs; the model receives
// a plain tool result starting with "[user-declined]" and will not retry.

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.

// host → plugin
{
  "type": "call_tool",
  "requestId": "0b2d…",          // unique per call, echo it back unchanged
  "toolName": "do_something",
  "params": { "name": "…" },     // arguments validated against tools[].parameters
  "context": {
    "cwd": "/Users/me/project",  // project folder of the calling session; a temp folder for chat sessions
    "config": { "mode": "auto", "verbose": false }   // present only when configuration is declared; keys are configuration[].id
  }
}

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

// When the result is a file: include the absolute path and file name. The session
// renders a clickable file card that previews in-app (docx/xlsx/pdf/markdown/code…).
process.send({
  type: 'tool_result',
  requestId,
  content: [{ type: 'text', text: `Generated [${fileName}](${filePath})` }],
  details: { filePath, fileName },
});

Checklist rendering: renderAs checklist

// For tools with renderAs: "checklist", the host renders the todos array from the call arguments:
{
  "todos": [
    { "id": "1", "content": "Initialize repository", "status": "completed" },
    { "id": "2", "content": "Write unit tests", "status": "in_progress" },
    { "id": "3", "content": "Publish", "status": "pending" }
  ]
}

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.

FieldDescription
idUnique within the plugin.
titleTooltip text for the icon (human readable).
iconPick from the host allowlist: git-branch, checklist, world. Keeps icons consistent across the app; custom images are not accepted.
entryHTML file, relative to the plugin folder.
widthOptional default panel width in pixels, 240 to 640, default 360. Users can drag to resize and the size is remembered.
pinnedOptional, 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.

interface PluginHost {
  // Call a tool declared in this plugin's manifest.tools; same call_tool channel the AI uses
  invoke(toolName: string, params: unknown): Promise<
    { content: unknown[]; details?: unknown } | { error: string }
  >;
  // Subscribe to ui_push messages from the plugin process; returns an unsubscribe function
  onPush(callback: (channel: string, payload: unknown) => void): () => void;
  // Current light/dark scheme and subsequent changes
  getColorScheme(): Promise<'light' | 'dark'>;
  onColorSchemeChange(callback: (scheme: 'light' | 'dark') => void): () => void;
  // Docked views only: ask the host to collapse the panel this view is shown in. The host does not
  // draw a header for views, so draw your own close button and call this. Older app versions do not
  // have it — check `typeof pluginHost.closeView === 'function'` before rendering the button.
  closeView?(): void;
  // Put text into the user's current input box and focus it. The text is APPENDED to the existing draft
  // (never overwrites what the user typed) and is NOT sent: the user decides whether to edit it and press
  // send. No permission needed, no limit on call count; one call is capped at 100,000 characters.
  // Resolves to { delivered: true }, or { delivered: false, reason: 'no_composer' } when the current page
  // has no input box. Older app versions do not have it — check typeof before drawing the button.
  composeMessage?(params: { text: string }): Promise<{ delivered: boolean; reason?: string }>;
  // App interface language (zh, en, ja, ...; empty string until the app has reported it) and later changes.
  // Older app versions do not have these two: check typeof before use. Panel pages only; plugin processes
  // get the same information from the PIOMODE_LOCALE env var and the locale_changed message.
  getLocale?(): Promise<string>;
  onLocaleChange?(callback: (locale: string) => void): () => void;
}
declare const pluginHost: PluginHost; // exposed as window.pluginHost

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.

FieldDescription
toolTool to call on click.
iconAllowlisted icon name.
tooltipHover text.
visibleToolOptional. 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".
// The host calls visibleTool with empty params and shows the icon based on details.visible
process.send({
  type: 'tool_result',
  requestId,
  content: [{ type: 'text', text: isGitRepo ? 'git repo' : 'not a git repo' }],
  details: { visible: isGitRepo },
});

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.

typeRendered asdefaultValue type
selectSingle-choice list; options come from optionsToolstring
booleanToggle switchboolean
stringText input, committed on blurstring
numberNumber inputnumber
// For type: "select" settings, the host calls optionsTool with empty params to fetch options
process.send({
  type: 'tool_result',
  requestId,
  content: [{ type: 'text', text: '2 options' }],
  details: {
    options: [
      { value: 'fast', label: 'Fast' },
      { value: 'accurate', label: 'Accurate' },
    ],
  },
});
// The host automatically prepends an "Auto" option whose value equals this
// configuration entry's defaultValue; the plugin must not return it again.

10Command palette / shortcuts / context menu

All three are different entry points for "call a tool with empty arguments"; a plugin can declare several.

FieldShapeDescription
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 translationWhat it translates
name / descriptionName 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>.summaryThe one-line summary on the consent page.
tools.<tool>.confirmationConfirmation card text: title, message, confirmLabel, and detailLabels (a parameter name mapped to its row label on the card).
ui.title / views.<id>.titleTitle of the floating panel and of each docked view (views are keyed by id).
sessionAction.tooltipTooltip of the session toolbar icon.
configuration.<id>.labelLabel of each setting (keyed by setting id).
commands.<tool>.title / menus.<location>.<tool>.titleCommand palette titles (keyed by tool name) and context-menu titles (keyed by location, then tool name).
{
  "id": "com.example.todo",
  "name": "Todo Quadrant",
  "description": "Daily to-do list organized by urgent/important quadrants. Install this when the user wants to track todos. (English, for the model)",
  "defaultLocale": "en",
  "tools": [
    {
      "name": "manage_todo",
      "description": "Add, list, complete and delete todos. (English, for the model)",
      "summary": "Manage your to-do list",
      "parameters": { "type": "object", "properties": { "action": { "type": "string", "description": "add | list | complete | clear_all" } } },
      "confirmation": {
        "param": "action",
        "values": ["clear_all"],
        "title": "Clear all to-dos?",
        "message": "This removes every item and cannot be undone.",
        "confirmLabel": "Clear all"
      }
    }
  ],
  "localizations": {
    "zh": {
      "name": "四象限待办",
      "description": "按紧急/重要四象限管理待办。",
      "tools": {
        "manage_todo": {
          "summary": "管理你的待办清单",
          "confirmation": {
            "title": "清空全部待办?",
            "message": "这会删除所有待办,无法撤销。",
            "confirmLabel": "全部清空"
          }
        }
      }
    },
    "ja": {
      "tools": { "manage_todo": { "summary": "ToDoリストを管理します" } }
    }
  }
}

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.

// ---- index.js (plugin process) ----
const TEXTS = {
  en: { due: 'Due today: COUNT' },
  zh: { due: '今日待办:COUNT' },
};
// undefined on old app versions, '' right after launch (not reported yet), then e.g. 'zh-TW'
let locale = process.env.PIOMODE_LOCALE || '';

process.on('message', (msg) => {
  if (msg.type === 'locale_changed') locale = msg.locale; // the user switched the interface language
});

function text(key, count) {
  const table = TEXTS[locale] || TEXTS[locale.split('-')[0]] || TEXTS.en;
  return table[key].replace('COUNT', String(count));
}

// ---- panel page (view.html / ui.html) ----
const host = window.pluginHost;
const apply = (code) => { /* re-render with the texts for this language code */ };
if (typeof host.getLocale === 'function') host.getLocale().then(apply); // '' until reported
if (typeof host.onLocaleChange === 'function') host.onLocaleChange(apply);
TIP
Old app versions have neither the environment variable nor the two methods: feature-detect them and fall back to your original language. Right after launch the language may not be reported yet (the variable is an empty string): delay notifications for a moment instead of showing them in the wrong language.

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.

capabilityparamsresultPrecondition
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_cloud
publish_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.
const crypto = require('crypto');
const fs = require('fs');
const pending = new Map();

function requestHost(capability, params) {
  const requestId = crypto.randomUUID();
  return new Promise((resolve, reject) => {
    const timer = setTimeout(() => {
      pending.delete(requestId);
      reject(new Error(`host capability "${capability}" timed out`));
    }, 30_000);
    pending.set(requestId, { resolve, reject, timer });
    process.send({ type: 'host_request', requestId, capability, params });
  });
}

process.on('message', (msg) => {
  if (msg.type === 'host_response' || msg.type === 'host_error') {
    const p = pending.get(msg.requestId);
    if (!p) return;
    pending.delete(msg.requestId);
    clearTimeout(p.timer);
    if (msg.type === 'host_error') p.reject(new Error(msg.message));
    else p.resolve(msg.result);
  }
});

// usage
await requestHost('show_notification', {
  title: '3 todos for today',
  body: '• Write weekly report\n• Reply to emails',
  viewId: 'board',      // optional: expand this docked view when the notification is clicked
});
// => { shown: true } or { shown: false, reason: 'disabled' | 'unsupported' }

await requestHost('render_pdf', {
  outputPath: '/abs/path/report.pdf',
  title: 'Report',
  content: '# Title\n\nBody (Markdown)',
});

// Rasterize PDF pages to PNG (base64) so the model can look at them. No permission needed.
const { totalPages, images } = await requestHost('rasterize_pdf', {
  pdfBase64: fs.readFileSync('/abs/path/report.pdf').toString('base64'),
  width: 1100,          // output width in pixels
  pages: [1, 2],        // 1-based page numbers
});

// Call the AnBoWork backend as the signed-in user. Requires the "account" permission;
// the token never enters your process, and only allow-listed paths are accepted.
const res = await requestHost('piomodel_api_request', {
  method: 'GET',
  path: '/api/user/sites',
});
// => { ok: true, envelope: { code, msg, data } } or { ok: false, message }

14Lifecycle

StageBehavior
StartLazy 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.
ResidentOnce 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.
CrashIf 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 / reinstallThe process is terminated and docked views and floating panels are destroyed; a reinstall replaces the whole folder.
LogsYour stdout/stderr are written to the app log file prefixed with the plugin id. Plain console.log is enough for debugging; see "Debugging & FAQ".
ENV
The child process starts with 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.

my-plugin.zip
├── manifest.json     # must be at the archive root
├── icon.png          # optional, referenced by manifest.icon
├── index.js
├── view.html
└── node_modules/…    # include dependencies if any (bundling into a single file is recommended)

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.

PointHow to write it
Language and lengthEnglish, 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 scenariosUse 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 actionsPut 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 suggestedOnly 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.
{
  "description": "Publish a finished HTML page to a public share link. After you generate a standalone HTML report, dashboard or prototype, call publish_html right away instead of asking the user how to share it. Install this whenever the user wants to share, publish, host, deploy or send a web page as a link."
}

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.

{
  "id": "local.todo-quadrant",
  "name": "Todo Quadrant",
  "version": "1.2.0",
  "description": "Daily todo list organized by the Eisenhower matrix. Install this whenever the user wants to track tasks or asks to be reminded about something…",
  "main": "index.js",
  "permissions": ["filesystem", "notifications"],
  "activationEvents": ["onStartupFinished"],
  "tools": [{
    "name": "manage_todo_quadrant",
    "summary": "Add, list, complete, delete and update todos in an urgent/important matrix",
    "description": "Manage the user's daily todo list… Actions: add / list / complete / delete / update / set_reminder / remind_now. add/update also accept remind_at to schedule a one-time reminder for that specific todo. Call this whenever the user talks about their todos…",
    "parameters": {
      "type": "object",
      "properties": {
        "action": { "type": "string", "enum": ["add", "list", "complete", "delete", "update", "set_reminder", "remind_now"] },
        "id": { "type": "string" },
        "content": { "type": "string" },
        "quadrant": { "type": "string", "enum": ["urgent_important", "important_not_urgent", "urgent_not_important", "not_urgent_not_important"] },
        "due_date": { "type": "string", "description": "YYYY-MM-DD" },
        "remind_at": { "type": "string", "description": "YYYY-MM-DD HH:MM — a one-time reminder for this todo, independent of the daily digest" }
      },
      "required": ["action"]
    }
  }],
  "views": [{ "id": "quadrant", "title": "Todo Quadrant", "icon": "checklist", "entry": "view.html", "width": 380 }]
}

18Debugging & FAQ

SymptomCause and fix
Manifest validation fails on installCheck 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 toolFirst 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 blankWrong 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 appearCheck 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 readableValues are in message.context.config[id], not in params.

Log file location

OSPath
macOS~/Library/Logs/AnBoWork/main.log
Windows%USERPROFILE%\AppData\Roaming\AnBoWork\logs\main.log
See the API integration docs