Files
e48591bd82 feat: bot message policy, message lifecycle hooks, command routing and Chat rename (supersedes #2831, #2833) (#2966)
* feat(bot): support direct binding of plugin commands (LANG-240)

Co-authored-by: multica-agent <github@multica.ai>

* fix(bot): address review feedback on command routing and migration (LANG-240)

- Remove redundant cmd_mgr.is_admin call in routing layer
- Move legacy YAML command config migration to startup build_app stage with idempotency flag
- Validate that command_settings.plugins are installed in current workspace
- Cache bot command_settings in memory via platform_mgr helper
- Wrap command matching and execution inside _run_event_delivery for cloud tenant scope
- Preserve original launcher_id type in session resolution

Co-authored-by: multica-agent <github@multica.ai>

* style(bot): apply ruff format to command routing changes (LANG-240)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* wip(command): command processor instances and per-command config (LANG-238)

Work in progress handed off for completion; backend and tests are done,
web pieces are partially written and not yet type-checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(command): complete command processor configuration UI

Co-authored-by: multica-agent <github@multica.ai>

* fix(command): retain saved bot command settings when editing

Co-authored-by: multica-agent <github@multica.ai>

* test(command): exclude command instances from runner operations

Co-authored-by: multica-agent <github@multica.ai>

* test(command): verify bot prefixes and manage async test lifecycle

Co-authored-by: multica-agent <github@multica.ai>

* feat(platform): register Telegram and Discord plugin commands

Co-authored-by: multica-agent <github@multica.ai>

* fix(platform): align registration metadata and selected command diagnostics

Co-authored-by: multica-agent <github@multica.ai>

* fix(plugin): keep platform command refresh best-effort after runner refresh

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* refactor(web): simplify bot event routing card with tabs

Split routes, plugin commands and plugin processors into tabs, collapse
the supported events panel into a dialog, keep rule rows on a stable
two-line grid, and show bound commands as compact chips.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* refactor(web): move command prefixes behind a small popover button

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* refactor(web): show commands, routes and plugin processors as separate routing layers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(command): record command processor runs and support debugging

Bot command executions and debug runs are written to the run ledger as
command_processor runs, so processors get run history and traces. Debug
runs a command line once with admin privilege without platform delivery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): command processor logs, debug and plugin marketplace select

Group plugin processors and command processors under a From plugin option
on the processor creation page, redraw the processor type diagrams, add
logs and debugging to the command processor detail page, list installed
and marketplace command plugins with one-click install, and use a Remix
icon for command processors in the sidebar.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* test(web): count new command processor locale keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): illustrate processor types with animated scenes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* revert(web): restore original processor line diagrams and add a command one

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* test(web): count command diagram locale keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): progressive plugin options and a code-bearing plugin processor diagram

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(web): command plugin wording in the plugin selector

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* test(web): count command plugin selector locale keys

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* test(pipeline): pin outer-stage behaviour before moving it to the message policy

Baseline cases state a legacy pipeline config and the behaviour it must
produce (group respond rules, access control, ignore rules, content filter,
rate limit, long text, sending, user notices, aggregation). They reach the
stages only through outer_stage_harness, so the same cases keep guarding
behaviour once the configuration moves to the bot.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(message-policy): add the bot message policy schema, runtime and manager

A message policy says which messages a bot answers (trigger), what is checked
on the way in and out (safety) and how replies are sent (output). It keeps the
key names these settings had inside a Messaging (pipeline) config.

- schema: neutral and default policies, bot + route merge, validation, and the
  single legacy conversion (split_legacy_config / restore_legacy_config).
- runtime: the logic of the outer stages, compiled per effective policy
  (admission, group rules, rate limit, content filter, long text, sending).
- manager: resolves the policy of a bot route and caches the compiled runtime
  per bot and route; the debug chat and unknown bots get the neutral policy.

Group respond rules and the rate limit gain an explicit enabled switch so a
policy can express "do nothing"; converted legacy settings state it as on.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(message-policy): store policies on bots and migrate them out of Messaging

- bots.message_policy (JSON) and an optional policy override on each route in
  event_bindings; BotService validates both. A route resubmitted without the
  policy key keeps its stored override, so older clients cannot drop it.
- Migration 0049: existing bots get the neutral policy and every route to a
  Messaging processor receives that processor's former settings as its
  override; the moved keys are kept verbatim in
  legacy_pipelines.message_policy_backup and restored on downgrade.
- Messaging writes accept and ignore trigger / safety / general output keys;
  its template and form metadata keep only AI, speech and AI-specific output.
- New bots start with the defaults new Messaging processors used to get.
- GET /api/v1/platform/bots/_/message-policy/metadata serves the form metadata;
  MCP bot tools describe message_policy and route overrides.
- The group-filter migration helper reads and updates the route policy.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* refactor(pipeline): run the outer stages through the message policy runtime

Stage order and position are unchanged. The group rule, access control,
content filter, rate limit, long text and send stages become thin shells over
the policy runtime of the route a message matched; user notices and the
scheduler's steering gate use it too. The effective policy is laid over
query.pipeline_config under the legacy key names, so plugins reading those
keys keep working. Message aggregation reads the policy as well.

The matched route id travels from routing through the aggregator to the query
(_message_route_id, host-reserved). Messages that reach Messaging without one
(web page widget, form callbacks) use the bot's first route to that processor.

The baseline cases now run on legacy configs converted the way the migration
converts them.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* chore(persistence): renumber message policy migrations after master (0054-0056)

Master added 0047-0053, so the bot command settings, platform command sync
and bot message policy migrations now follow 0053_knowledge_artifact_sources.
Also bind a message policy in the agent run recovery test, whose replayed
output stages now read output and safety settings from the bot route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(sdk): expose command processor configuration in execution contexts

Co-authored-by: multica-agent <github@multica.ai>

* feat(bot): dispatch plugin lifecycle hooks with route-scoped query and policy

Co-authored-by: multica-agent <github@multica.ai>

* fix(messaging): dispatch received hooks for direct pipeline queries

Co-authored-by: multica-agent <github@multica.ai>

* fix(messaging): tolerate queries without bound plugins in the received-hook fallback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(messaging): apply bot policies to agent delivery

Co-authored-by: multica-agent <github@multica.ai>

* feat(web): bot plugins and message policy tabs, Chat rename

- Bot event routing becomes three tabs: Routes, Plugins, Message policy.
- Plugins tab: message lifecycle strip (received → command → admission →
  before reply → process → after reply → send) with the enabled plugins
  acting at each step; one row per plugin with its switch, command tags and
  hook tags. Hooks a route cannot use are struck through with the reason
  (prompt hooks on Agent routes, observe-only after-reply hook when
  streaming). Enable-all switch plus manual selection, as on Chat. Command
  settings and plugin processors live in the same tab.
- Message policy tab: entry / safety / reply forms from the policy metadata,
  bot default or per-route override (use default / custom), route overview,
  "make bot default" which also clears routes left identical to it.
- New routes show a hint that they inherit the bot policy.
- Chat editor drops Trigger and Safety; Output keeps AI-only options with a
  pointer to the bot policy; the plugin list is "Tools the AI can call".
- Installing a plugin with commands or listeners reports on how many bots it
  is enabled, or offers to go enable it.
- User-visible "Pipeline/流水线" renamed to "Chat/聊天" in all eight WebUI
  locales (identifiers, paths and keys unchanged).
- plugin-registrations (HTTP and MCP) accepts include_disabled to list every
  installed plugin for the editor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(i18n): call the pipeline Chat in backend user-facing text

Default name, runner authorization notice, operation catalog labels and
summaries, alert email rule label, adapter streaming descriptions and
MCP tool descriptions say Chat (pipeline). Identifiers keep pipeline.
The group filter migration tools describe the message-policy at-bot rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): finish the Chat rename in locales and the migration dialog

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* chore(sdk): regenerate workspace proxy for monitoring.sessions launcher_id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* docs: message lifecycle events, bot message policy and the Chat rename

- Plugin docs: 'Pipeline events' become message lifecycle events with
  the lifecycle order, where plugins are enabled, which processors each
  hook applies to, known limits and platform notifications.
- Command docs: matching before routes, route policy, *CommandSent.
- Bots page: event routing tabs, plugin enablement, message policy.
- Chat page and the rest of docs/ (zh/en/ja, regenerated recipes) use
  Chat instead of Pipeline; URLs and identifiers are unchanged.
- langbot-mcp-ops skill, ARCHITECTURE.md and dev-docs/architecture/
  message-policy.md describe the new contracts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(bot): keep the platform command clear in update_bot after the master merge

The merge carried the branch's platform-command check into master's new
_apply_bot_configuration, where update_data does not exist, so every
runtime-affecting bot update returned 500. Run the check in update_bot
before applying. Command admin checks now pass the sender ID.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* test(persistence): register all entities in the startup command migration test

The test created bots without the tables its foreign keys reference and
only passed when other tests had imported those entities first. Also
apply prettier to AgentCreateContent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(messaging): use one listener list per query when no bot policy applies

Queries entering a Chat without a bot (debug chat, pipeline.run) bound
the neutral policy, so later hooks went to every plugin while the
fallback *MessageReceived used the Chat's plugin list. Use the Chat's
list for all hooks there. The contract test now carries the plugin
selection the way migration 0060 stores it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): move plugin command settings into the plugin list

Drop the separate plugin command binding section from the bot's Plugins tab.
The command switch and prefixes now sit in the plugin list header, per-bot
command settings open from a plugin's row (only when its commands declare
spec.config), and platform command registration follows the enabled plugins.

Duplicate command names now resolve in the order of the bot's effective plugin
list, the same order lifecycle hooks run in; the WebUI keeps that list in
display order.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): mark plugin hook badges with the event listener icon

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): explain AI routes versus plugin handling on the bot tabs

Routes now say they send events to configurable LangBot processors that use
AI, and that a plugin-only bot can delete or disable its routes. The Plugins
tab explains that plugins handle their lifecycle steps as each plugin defines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): optional route notes and auto-described routes

Routes get an optional note, edited in the route's expanded panel and shown
under the route. Wherever routes are listed (scope picker, policy route list)
a second line now says when the route applies, derived from its conditions,
plus its target when the name is a note, so routes stay distinguishable
without any user input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): compact route cards and labelled message template routes

Saved routes collapse to a two-line summary (note or processor, then event,
conditions and target); event, conditions, processor and note are edited in
the expanded card. Unsaved routes open expanded. The "Reply to messages"
template and the setup wizard now label their routes as private messages and
group messages that mention the bot.

Also move the plugin processor compatibility e2e onto the Plugins tab, where
plugin processors live since the message policy refactor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): keep bot-wide command settings read-only on route scope

The plugin command switch, prefixes and per-plugin command settings apply to
the whole bot, so they are read-only (with a hint) while a route is selected.
Turning commands off crosses out every command badge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* style(bots): make the crossed-out command badges easier to see

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(agents): stop offering command processors on the create page

Command settings are created from a plugin's row on the bot's Plugins tab.
The "From plugin" card now selects plugin processors directly; existing
command processors keep their detail page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): install plugin processors from the marketplace in place

The add-plugin-processor dialog's new-configuration tab keeps the installed
processor list (with event compatibility) and adds a marketplace picker for
plugins that declare processor support; installing one selects it. Bound and
existing processors show their plugin icon, and the empty state points to the
marketplace. Plugin-subscription e2e now opens the Plugins tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(plugins): point command and listener plugins to bots after install

Commands and event listeners are enabled on a bot's Plugins tab now, so the
post-install next step for them links to bots; tools still lead to a Chat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(bots): pick plugin processors from a single picker

The new-configuration tab drops the separate installed-processor list: one
picker lists installed processors and marketplace plugins (installable in
place), and the chosen processor's events and compatibility show below it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(plugins): show next steps on first visit and reload after confirming permissions

- The plugin detail page opens a next-steps dialog the first time a ready
  plugin is visited (remembered per plugin).
- After permissions are confirmed, the page polls until the plugin is mounted
  and remounts its settings, readme and log panels, so no manual refresh is
  needed.
- The install dialog shows next steps under the permission-review link
  instead of hiding them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(plugins): say why plugin settings and docs are unavailable

While a plugin waits for permission confirmation its settings and docs cannot
load; show a dedicated notice pointing to Plugin permissions (or a starting
indicator while it boots) instead of the generic load error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(plugins): confirm permissions inside the install dialog

A plugin awaiting permission review now shows the permission card in the
install dialog; granting there opens the usual confirmation, and the dialog
then switches to the success banner with its next steps. The first-visit
next-steps popup on the plugin page is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(plugins): show next steps right after granting in the install dialog

The plugin restarts after a grant, so re-reading it could fail or still report
pending, leaving the dialog on the review banner. Trust the successful grant,
keep the already loaded manifest, and retry loading it if it was missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(plugins): treat initialized plugins as running on the detail page

The runtime moves plugins unmounted -> mounted -> initialized; initialized is
the ready state. The detail page only accepted mounted, so running plugins
showed "starting" forever. Also fix the misspelled status in the type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(plugins): re-read the plugin until it lists components before showing install next steps

A plugin awaiting permissions is not started and reports no components, so
the post-grant guide stayed empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): add bot plugins from a list and the Marketplace; rename event listeners to chat event hooks

The bot Plugins tab now lists added plugins as cards (all of them when
'enable all' is on) instead of per-plugin switches, with an Add plugin
dialog for installed plugins and Marketplace plugins that provide commands
or chat event hooks. EventListener is shown as 'Chat event hook' in the UI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): with all plugins enabled, the bot plugin list offers installing new plugins only

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): bot plugin Marketplace tab lists only uninstalled or updatable plugins

Installed plugins with a newer Marketplace version get an inline Update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(web): no 'not enabled on any bot' toast for plugins installed from a bot's plugin list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): move plugin dev docs link from the routing help popover to the Plugins tab

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): open a plugin's settings page from its card in the bot plugin list

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): describe commands, chat event hooks and plugin processors by how each handles events

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): drop the route overview list from the bot message policy tab

The scope selector already marks which routes are customised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): regroup bot message policy settings by what the owner decides

The policy tab now groups settings into who gets replies, how messages are
read, safety and rate limits, how the bot replies, and what happens on
errors. Each setting shows a plain-language summary and expands to purpose-
built controls; stored trigger/safety/output keys are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* refactor(web): use shadcn Button and Label for this branch's new UI

Replace raw button, link and label elements added on this branch with
shadcn Button (ghost / link / asChild) and Label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(commands): add bot system commands and sender permissions

Co-authored-by: multica-agent <github@multica.ai>

* fix(commands): honor session model, replay text turns and gate denial replies

Co-authored-by: multica-agent <github@multica.ai>

* feat(web): one-page Chat settings with prompt, tools and knowledge up front

Replace the Chat editor's section tabs with a single page: the runner,
then primary blocks for model, prompt, tools (summary + side sheet) and
knowledge, then folded rows with one-line summaries for context, run
limits, sandbox, speech, reply content, notices, advanced and manage.
Runner fields are placed by type and name, so any runner works; values and
stored keys are unchanged. Folded rows stay mounted so invalid drafts still
block saving. SettingRow/SettingGroup are shared with the bot policy tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(web): keep folded setting rows mounted but hidden

Radix forceMount forces content open; render the row body ourselves with
the hidden attribute so folded rows stay collapsed while their fields keep
validating.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): system commands and command permissions in the bot Plugins tab

A small 'System commands · n/m' entry in the command bar opens a sheet with
the admin list (person_ IDs, /whoami hint), the no-permission reply, every
built-in command's switch and permission grouped by session/info/admin,
and per-command permissions for enabled plugins' commands. Admin-only plugin
commands show a lock on their chips; the lifecycle Command step marks the
system commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): one-page Agent settings matching the Chat layout

Replace the Agent editor's Runner / Events & tools tabs with one page: the
runner, then model and prompt, the events the Agent handles, a tool access
summary (editing in a side sheet), knowledge and runner settings, then
folded rows for context, run limits, sandbox and advanced fields. The
runner field layout is shared with Chat (runner-layout/RunnerConfigLayout).
Loading fills the active runner's schema defaults before the clean snapshot,
so required-field status and revert-to-clean keep working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): 'Plugins & commands' tab with its own Commands section

Rename the bot tab to Plugins & commands. Commands get their own section
above plugins: one global switch, the shared prefixes (with an example, as
they apply to system and plugin commands alike), the system commands entry
and the plugin command list. Admins are no longer edited in the system
commands sheet; it shows the bot admin count and links to the session
monitor where admins are managed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): give system and plugin commands their own sheets

The System commands sheet now lists only built-in commands; plugin command
access moves to a 'Set access' sheet on the plugin commands row. Admins and
the no-permission reply apply to both kinds, so they become rows of the
Commands section instead of living in the system sheet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(web): keep dividers between command access rows

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): link plugin processor dev docs from the processors section

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(commands): use session monitoring admins for command permissions

Co-authored-by: multica-agent <github@multica.ai>

* chore(web): drop retired command_settings.admins from the bot command type

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* Record message policy decisions and add workspace upgrade checks

Co-authored-by: multica-agent <github@multica.ai>

* fix(message-policy): queue EssentialCommands uninstall through plugin.delete task

The upgrade-check action called the plugin connector directly, skipping the
tenant-scoped fence and task tracking used by the regular uninstall path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* feat(web): message policy monitoring badges, timeline, route counts and upgrade checks

- Monitoring: handling badges (system/plugin command, denied, policy drop,
  plugin interception), a handling filter (AI / command / plugin / policy)
  and a message policy timeline in the execution detail.
- Backend: executions accept handling= (HTTP + MCP, not plugin-visible) and
  rows carry handling, policy_layer/item, command and hook facts.
- Bot routes show last-24h handling counts.
- Upgrade check banner + Sheet on bot and Chat pages with one-click
  actions, per-item and acknowledge-all; eight locales.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(monitoring): name layer and rule for policy drops recorded before structured fields

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(web): name command/policy/plugin ingress rows and dedupe output actions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(message-policy): preserve drop notices, Windows fallback, 0060 enabled filter, and ignore-rules hint

Co-authored-by: multica-agent <github@multica.ai>

* docs(message-policy): update trilingual user, upgrade, telemetry and command docs

Co-authored-by: multica-agent <github@multica.ai>

* Document bot command permissions and Chat event hooks in skills

Co-authored-by: multica-agent <github@multica.ai>

* Distinguish Chat debugging from bot admission tests

Co-authored-by: multica-agent <github@multica.ai>

* Navigate to Chats from Processors in skills and QA flows

Co-authored-by: multica-agent <github@multica.ai>

* Restore bot ingress tracing and align CI with route-owned message policies

Co-authored-by: multica-agent <github@multica.ai>

* fix(web): stop the bot plugins tab crashing without runtime registrations; align e2e with the Chat UI

pluginCommandList read descriptorMap before its declaration, so the Plugins &
commands tab threw a TDZ error whenever an enabled plugin had no Runtime
registration (older Runtimes). Compute it after the map.

Update stale Playwright specs to the current UI: Chat migration labels,
one-page Chat editor (no AI tab, Runner field), 'Create processor' heading,
and the in-dialog permission review after plugin installation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(telemetry): count builtin_disabled_bots only for built-ins turned off from their default

/model is off by default, so counting any disabled built-in counted every
bot and the heartbeat field carried no signal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(migration): preserve empty legacy chat settings on downgrade

Co-authored-by: multica-agent <github@multica.ai>

* fix(migration): initialize bot policies when resuming 0059

Co-authored-by: multica-agent <github@multica.ai>

* test(commands): exercise LocalAgent over signed HTTP ingress

Co-authored-by: multica-agent <github@multica.ai>

* fix(api): report ignored legacy settings in chat copy requests

Co-authored-by: multica-agent <github@multica.ai>

* test(commands): cover alternate prefixes and unrouted group commands

Co-authored-by: multica-agent <github@multica.ai>

* fix(web): policy timeline says MessageReceived already ran when admission blocks

MessageReceived fires at the bot entry before admission, so a policy drop
still ran it. The hooks step now says so instead of 'not run'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* fix(commands): consume silently denied commands before primary routing

Co-authored-by: multica-agent <github@multica.ai>

* Test upgrade assistant actions and command telemetry against a local Core

Co-authored-by: multica-agent <github@multica.ai>

* Verify lifecycle hooks and command bypass during message aggregation

Co-authored-by: multica-agent <github@multica.ai>

* Verify native Agent reply chunks and proactive delivery through signed callbacks

Co-authored-by: multica-agent <github@multica.ai>

* Cover subscriber replies on denied ingress and concurrent command rate limits

Co-authored-by: multica-agent <github@multica.ai>

* Verify LocalAgent records missing model failures for signed messages

Co-authored-by: multica-agent <github@multica.ai>

* Skip runtime synchronization for empty event selections after validating workspace scope

Co-authored-by: multica-agent <github@multica.ai>

* Verify route access overrides, removal and telemetry using signed bot messages

Co-authored-by: multica-agent <github@multica.ai>

* Exercise signed command admission and reply policies in a running Core

Co-authored-by: multica-agent <github@multica.ai>

* Compare dashboard debug chat with signed messages on the same Chat

Co-authored-by: multica-agent <github@multica.ai>

* Validate unavailable Agent runners and verify native quotes and Agent policy traces

Co-authored-by: multica-agent <github@multica.ai>

* Correlate successful Agent output with telemetry and exercise command hook order

Co-authored-by: multica-agent <github@multica.ai>

* Honor Chat exception policy for Runner failures and verify streaming observers

Co-authored-by: multica-agent <github@multica.ai>

* Verify OneBot membership events bypass message admission and reply policies

Co-authored-by: multica-agent <github@multica.ai>

* Exercise command name precedence and processor instance isolation in runtime

Co-authored-by: multica-agent <github@multica.ai>

* Accept ISO source times in runner events and verify long-text boundaries

Co-authored-by: multica-agent <github@multica.ai>

* Compare Chat output filtering on OneBot and HTTP Bot

Co-authored-by: multica-agent <github@multica.ai>

* Trace matched deliveries intercepted by message listeners

Co-authored-by: multica-agent <github@multica.ai>

* Record Chat execution owner with the first success update

Co-authored-by: multica-agent <github@multica.ai>

* Admit matched commands before recording listener interception

Co-authored-by: multica-agent <github@multica.ai>

* Handle stop on a Chat without a Runner and verify built-in command permissions

Co-authored-by: multica-agent <github@multica.ai>

* Link command processor runs to ingress routes and identify denied plugin commands

Co-authored-by: multica-agent <github@multica.ai>

* Report ignored legacy operation keys and limit Runner error replies to a redacted summary

Co-authored-by: multica-agent <github@multica.ai>

* style(web): wrap long monitoring timeline strings for prettier

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

* Dispatch QA Runner by envelope type and verify remaining command conflicts after uninstall

Co-authored-by: multica-agent <github@multica.ai>

* fix(persistence): chain bot command settings after master's 0057 migration

master added 0057_agent_event_index on top of 0056, which left two Alembic
heads. Run 0057_bot_command_settings after it; revision ids are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>

---------

Co-authored-by: multica-agent <github@multica.ai>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 08:20:44 +08:00

314 lines
22 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 工作区 API
description: 在插件中读取和管理 Agent、聊天、机器人、模型、知识库等工作区资源。
---
工作区 API 让插件可以操作它所安装的工作区:列出和修改 Agent 与聊天、查询机器人、管理模型和知识库、读取监控数据等。它开放的操作与 LangBot 的 HTTP API、MCP 服务和工作区助手完全相同,因此成员能通过这些途径完成的事,插件都可以在成员授权的范围内自动完成。
每个操作都有一个稳定的 ID,例如 `pipeline.list` 或 `knowledge.base.retrieve`。插件只能调用自己[在 manifest 中声明](/zh/plugin/dev/permissions#声明权限)、并且已由成员授予该安装的操作。
插件可显式申请 `artifact.create`、`artifact.get`、`artifact.read`、`artifact.read_content`、`artifact.retain`、`artifact.release` 和 `artifact.delete`。请逐项列出所需操作 ID:`artifact.*` 还包含仅供账户使用的发布和 Skill 来源操作,因此会被拒绝。类型化调用使用 `self.plugin.workspace.artifact.<method>(...)`,或 run 绑定的 `ctx.api.workspace` 代理。
这些 Artifact 属于安装 UUID,不属于插件作者/名称、账户或 run。每次操作均重新检查当前安装是否启用及有效授权;撤销权限或以新 UUID 重装后不能访问旧资产。知道 ID 或保留引用并不分享权限。插件操作不能导入账户上传、Skill 来源或 run 句柄。`artifact.skill_resource.create` 和 `artifact.publication.get/set/disable` 仍仅供账户/API key 使用。参见 [Artifact 接口](/zh/develop/artifacts)。
JSON RPC 创建使用 `filename`、`content_base64`、可选的 `mime_type` 和 `ttl_seconds`。解码后的输入最多 256 KiB;插件原始读取同样限制为 256 KiB,返回 `metadata` 和 `content_base64`。有界文本/结构化媒体优先使用 `read_content`。较小的传输限制不改变原已认证 HTTP 上传/下载契约。保留/释放只操作此安装的保留引用;存在有效业务引用时拒绝删除。
## 调用操作
在任意组件中通过 `self.plugin.workspace` 调用。每个操作都有一个按 ID 命名、带类型标注的方法:
```python
from langbot_plugin.api.definition.components.tool.tool import Tool
class WorkspaceSummary(Tool):
async def call(self, params, session, query_id):
result = await self.plugin.workspace.pipeline.list()
if not result["ok"]:
return f"无法获取流水线列表:{result['error']['message']}"
names = [pipeline["name"] for pipeline in result["result"]]
return "流水线:" + "、".join(names)
```
方法以关键字参数传参,参数与操作的输入结构一一对应,编辑器里能看到它们的类型和说明。少数名称会被调整为合法的 Python 标识符:如果某一段恰好是 Python 关键字,会在末尾加下划线(例如 `import_`),其他非法字符会替换为下划线。发送时仍使用原始参数名。
如果需要在运行时决定调用哪个操作,可以直接按 ID 调用,效果与类型化方法完全相同:
```python
result = await self.plugin.workspace.call("knowledge.base.retrieve", kb_uuid=kb_uuid, query="退款政策")
```
`await self.plugin.workspace.list()` 返回该安装已获授权的操作及其输入结构,并按 `domains` 分组。可以用它动态生成工具列表,或在提供某项功能前先确认是否已获授权。
### 在运行器中
运行器通过 `ctx.api.workspace` 拿到与本次运行绑定的代理。它提供相同的方法,也由相同的安装授权控制;区别在于 LangBot 会把每次调用记录到当前运行下。
发起本次运行的 Agent 或聊天,可能限定了模型应当看到哪些工作区操作,这个选择通过 `ctx.resources.workspace_operations` 传入。如果运行器要把工作区操作作为工具提供给模型,应当只提供这些操作;列表为空时,一个都不要提供。LangBot 内置的 LocalAgent 就是这样做的。
## 返回结果与错误
工作区调用不会因为业务错误抛出异常,而是始终返回一个字典:
```python
# 成功
{"ok": True, "result": ..., "operation": {"id": "pipeline.list", ...}}
# 失败
{"ok": False, "error": {"code": "permission_denied", "message": "...", "details": {...}}}
```
读取 `result` 之前先检查 `ok`。常见错误码:
| 错误码 | 含义 |
| --- | --- |
| `permission_denied` | 该安装没有获得这个操作的授权,或者安装已停用。`details.denied_operations` 列出缺少的操作 ID。 |
| `invalid_input` | 参数不符合操作的输入结构。 |
| `not_found` | 引用的资源在当前工作区中不存在。 |
| `application_error` | 操作已执行但失败,`message` 中说明原因。 |
权限不足是预料之中的情况,因为成员可能只授予插件所声明权限的一部分。遇到时应说明缺少什么,而不是让整个命令或运行失败。
## 选择要声明的操作
每个操作都有风险等级,成员确认时可以看到:
- **读**:只返回数据,例如 `pipeline.list`、`stats.basic`。
- **写**:修改工作区配置,例如 `pipeline.update`、`knowledge.file.store`。
- **高危**:删除资源、影响 LangBot 之外的对象,或消耗大量资源,例如 `bot.delete`、`pipeline.chat.broadcast`。确认对话框会单独标出这类操作。
授予某个操作的成员,自己必须具备该操作要求的权限(见下表最后一列)。只申请插件真正需要的操作;申请大量高危操作,很可能会被拒绝或被删减。
`knowledge.*` 这类通配符会申请某个前缀下的所有操作,但并不是每个前缀都可以这样用,详见[通配符](/zh/plugin/dev/permissions#通配符)。
## 操作列表
下表按领域列出当前 LangBot 版本中插件可以申请的全部操作。方法写作 `workspace.…`:在组件中是 `self.plugin.workspace`,在运行器中是 `ctx.api.workspace`。SDK 的类型化方法就是根据这份目录生成的,因此表中的每个操作都有对应的方法。
### 适配器 (`adapter`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 适配器详情 | `adapter.get`<br/>`workspace.adapter.get()` | 读 | `resource.view` |
| 适配器列表 | `adapter.list`<br/>`workspace.adapter.list()` | 读 | `resource.view` |
### 智能体 (`agent`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 创建智能体 | `agent.create`<br/>`workspace.agent.create()` | 写 | `resource.manage` |
| 调试智能体 | `agent.debug`<br/>`workspace.agent.debug()` | 写 | `runtime.operate` |
| 删除智能体 | `agent.delete`<br/>`workspace.agent.delete()` | 高危 | `resource.manage` |
| 智能体详情 | `agent.get`<br/>`workspace.agent.get()` | 读 | `resource.view` |
| 智能体列表 | `agent.list`<br/>`workspace.agent.list()` | 读 | `resource.view` |
| 智能体元数据 | `agent.metadata`<br/>`workspace.agent.metadata()` | 读 | `resource.view` |
| 运行事件流 | `agent.runs.events`<br/>`workspace.agent.runs.events()` | 读 | `resource.view` |
| 智能体运行列表 | `agent.runs.list`<br/>`workspace.agent.runs.list()` | 读 | `resource.view` |
| 更新智能体 | `agent.update`<br/>`workspace.agent.update()` | 写 | `resource.manage` |
### 机器人 (`bot`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 机器人管理员列表 | `bot.admins.list`<br/>`workspace.bot.admins.list()` | 读 | `resource.view` |
| 创建机器人 | `bot.create`<br/>`workspace.bot.create()` | 写 | `resource.manage` |
| 删除机器人 | `bot.delete`<br/>`workspace.bot.delete()` | 高危 | `resource.manage` |
| 机器人详情 | `bot.get`<br/>`workspace.bot.get()` | 读 | `resource.view` |
| 应用群组过滤 | `bot.group_filter.apply`<br/>`workspace.bot.group_filter.apply()` | 写 | `resource.manage` |
| 群组过滤预览 | `bot.group_filter.preview`<br/>`workspace.bot.group_filter.preview()` | 读 | `resource.manage` |
| 机器人列表 | `bot.list`<br/>`workspace.bot.list()` | 读 | `resource.view` |
| 机器人运行日志 | `bot.logs`<br/>`workspace.bot.logs()` | 读 | `resource.view` |
| 发送机器人消息 | `bot.message.send`<br/>`workspace.bot.message.send()` | 高危 | `runtime.operate` |
| 测试发送消息 | `bot.message.test`<br/>`workspace.bot.message.test()` | 写 | `resource.manage` |
| 路由预览 | `bot.routes.preview`<br/>`workspace.bot.routes.preview()` | 读 | `resource.manage` |
| 路由状态 | `bot.routes.status`<br/>`workspace.bot.routes.status()` | 读 | `resource.view` |
| 机器人运行时状态 | `bot.runtime.get`<br/>`workspace.bot.runtime.get()` | 读 | `resource.view` |
| 更新机器人 | `bot.update`<br/>`workspace.bot.update()` | 写 | `resource.manage` |
### 扩展 (`extension`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 扩展全览列表 | `extension.list`<br/>`workspace.extension.list()` | 读 | `resource.view` |
### 知识库 (`knowledge`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 创建知识库 | `knowledge.base.create`<br/>`workspace.knowledge.base.create()` | 写 | `resource.manage` |
| 删除知识库 | `knowledge.base.delete`<br/>`workspace.knowledge.base.delete()` | 高危 | `resource.manage` |
| 知识库详情 | `knowledge.base.get`<br/>`workspace.knowledge.base.get()` | 读 | `resource.view` |
| 知识库列表 | `knowledge.base.list`<br/>`workspace.knowledge.base.list()` | 读 | `resource.view` |
| 检索知识库 | `knowledge.base.retrieve`<br/>`workspace.knowledge.base.retrieve()` | 读 | `resource.view` |
| 更新知识库 | `knowledge.base.update`<br/>`workspace.knowledge.base.update()` | 写 | `resource.manage` |
| 引擎创建配置结构 | `knowledge.engine.creation_schema`<br/>`workspace.knowledge.engine.creation_schema()` | 读 | `resource.view` |
| 知识引擎列表 | `knowledge.engine.list`<br/>`workspace.knowledge.engine.list()` | 读 | `resource.view` |
| 引擎检索配置结构 | `knowledge.engine.retrieval_schema`<br/>`workspace.knowledge.engine.retrieval_schema()` | 读 | `resource.view` |
| 删除知识库文件 | `knowledge.file.delete`<br/>`workspace.knowledge.file.delete()` | 高危 | `resource.manage` |
| 知识库文件列表 | `knowledge.file.list`<br/>`workspace.knowledge.file.list()` | 读 | `resource.view` |
| 导入知识库文件 | `knowledge.file.store`<br/>`workspace.knowledge.file.store()` | 写 | `resource.manage` |
| 文档解析器列表 | `knowledge.parser.list`<br/>`workspace.knowledge.parser.list()` | 读 | `resource.view` |
### MCP 服务 (`mcp`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| MCP资源列表 | `mcp.resource.list`<br/>`workspace.mcp.resource.list()` | 读 | `resource.view` |
| 读取MCP资源 | `mcp.resource.read`<br/>`workspace.mcp.resource.read()` | 读 | `resource.view` |
| MCP资源模板列表 | `mcp.resource.templates`<br/>`workspace.mcp.resource.templates()` | 读 | `resource.view` |
| 删除MCP服务 | `mcp.server.delete`<br/>`workspace.mcp.server.delete()` | 高危 | `resource.manage` |
| MCP服务详情 | `mcp.server.get`<br/>`workspace.mcp.server.get()` | 读 | `resource.view` |
| MCP服务列表 | `mcp.server.list`<br/>`workspace.mcp.server.list()` | 读 | `resource.view` |
| MCP服务日志 | `mcp.server.logs`<br/>`workspace.mcp.server.logs()` | 读 | `audit.view` |
| MCP服务运行时状态 | `mcp.server.runtime`<br/>`workspace.mcp.server.runtime()` | 读 | `resource.view` |
| 测试MCP服务连接 | `mcp.server.test`<br/>`workspace.mcp.server.test()` | 写 | `resource.manage` |
### 模型 (`model`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 创建嵌入模型 | `model.embedding.create`<br/>`workspace.model.embedding.create()` | 写 | `provider_secret.manage` |
| 删除嵌入模型 | `model.embedding.delete`<br/>`workspace.model.embedding.delete()` | 高危 | `resource.manage` |
| 嵌入模型详情 | `model.embedding.get`<br/>`workspace.model.embedding.get()` | 读 | `resource.view` |
| 嵌入模型列表 | `model.embedding.list`<br/>`workspace.model.embedding.list()` | 读 | `resource.view` |
| 按供应商列出嵌入模型 | `model.embedding.list_by_provider`<br/>`workspace.model.embedding.list_by_provider()` | 读 | `resource.view` |
| 测试嵌入模型 | `model.embedding.test`<br/>`workspace.model.embedding.test()` | 写 | `provider_secret.manage` |
| 更新嵌入模型 | `model.embedding.update`<br/>`workspace.model.embedding.update()` | 写 | `provider_secret.manage` |
| 创建大语言模型 | `model.llm.create`<br/>`workspace.model.llm.create()` | 写 | `provider_secret.manage` |
| 获取默认LLM模型 | `model.llm.default.get`<br/>`workspace.model.llm.default.get()` | 读 | `resource.manage` |
| 删除大语言模型 | `model.llm.delete`<br/>`workspace.model.llm.delete()` | 高危 | `resource.manage` |
| 大语言模型详情 | `model.llm.get`<br/>`workspace.model.llm.get()` | 读 | `resource.view` |
| 大语言模型列表 | `model.llm.list`<br/>`workspace.model.llm.list()` | 读 | `resource.view` |
| 按供应商列出LLM模型 | `model.llm.list_by_provider`<br/>`workspace.model.llm.list_by_provider()` | 读 | `resource.view` |
| 获取标星LLM模型 | `model.llm.starred.get`<br/>`workspace.model.llm.starred.get()` | 读 | `resource.view` |
| 设置标星LLM模型 | `model.llm.starred.set`<br/>`workspace.model.llm.starred.set()` | 写 | `provider_secret.manage` |
| 测试大语言模型 | `model.llm.test`<br/>`workspace.model.llm.test()` | 写 | `provider_secret.manage` |
| 更新大语言模型 | `model.llm.update`<br/>`workspace.model.llm.update()` | 写 | `provider_secret.manage` |
| 创建重排模型 | `model.rerank.create`<br/>`workspace.model.rerank.create()` | 写 | `provider_secret.manage` |
| 删除重排模型 | `model.rerank.delete`<br/>`workspace.model.rerank.delete()` | 高危 | `resource.manage` |
| 重排模型详情 | `model.rerank.get`<br/>`workspace.model.rerank.get()` | 读 | `resource.view` |
| 重排模型列表 | `model.rerank.list`<br/>`workspace.model.rerank.list()` | 读 | `resource.view` |
| 按供应商列出重排模型 | `model.rerank.list_by_provider`<br/>`workspace.model.rerank.list_by_provider()` | 读 | `resource.view` |
| 测试重排模型 | `model.rerank.test`<br/>`workspace.model.rerank.test()` | 写 | `provider_secret.manage` |
| 更新重排模型 | `model.rerank.update`<br/>`workspace.model.rerank.update()` | 写 | `provider_secret.manage` |
### 监控审计 (`monitoring`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 嵌入模型调用统计 | `monitoring.embedding_calls`<br/>`workspace.monitoring.embedding_calls()` | 读 | `resource.view` |
| 错误日志 | `monitoring.errors`<br/>`workspace.monitoring.errors()` | 读 | `resource.view` |
| 执行详情 | `monitoring.execution.detail`<br/>`workspace.monitoring.execution.detail()` | 读 | `resource.view` |
| 执行记录列表 | `monitoring.executions`<br/>`workspace.monitoring.executions()` | 读 | `resource.view` |
| 用户反馈列表 | `monitoring.feedback.list`<br/>`workspace.monitoring.feedback.list()` | 读 | `resource.view` |
| 用户反馈统计 | `monitoring.feedback.stats`<br/>`workspace.monitoring.feedback.stats()` | 读 | `resource.view` |
| 进行中任务监控 | `monitoring.inflight`<br/>`workspace.monitoring.inflight()` | 读 | `resource.view` |
| 大模型调用统计 | `monitoring.llm_calls`<br/>`workspace.monitoring.llm_calls()` | 读 | `resource.view` |
| 消息详情 | `monitoring.message.detail`<br/>`workspace.monitoring.message.detail()` | 读 | `resource.view` |
| 消息历史查询 | `monitoring.messages`<br/>`workspace.monitoring.messages()` | 读 | `resource.view` |
| 监控总览 | `monitoring.overview`<br/>`workspace.monitoring.overview()` | 读 | `resource.view` |
| 会话分析 | `monitoring.session.analysis`<br/>`workspace.monitoring.session.analysis()` | 读 | `resource.view` |
| 重置会话 | `monitoring.session.reset`<br/>`workspace.monitoring.session.reset()` | 高危 | `resource.manage` |
| 会话列表 | `monitoring.sessions`<br/>`workspace.monitoring.sessions()` | 读 | `resource.view` |
| 代币消耗统计 | `monitoring.tokens`<br/>`workspace.monitoring.tokens()` | 读 | `resource.view` |
| 工具调用统计 | `monitoring.tool_calls`<br/>`workspace.monitoring.tool_calls()` | 读 | `resource.view` |
### 聊天 (`pipeline`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 广播聊天消息 | `pipeline.chat.broadcast`<br/>`workspace.pipeline.chat.broadcast()` | 高危 | `runtime.operate` |
| 聊天连接状态 | `pipeline.chat.connections`<br/>`workspace.pipeline.chat.connections()` | 读 | `runtime.operate` |
| 聊天调试历史 | `pipeline.chat.history`<br/>`workspace.pipeline.chat.history()` | 读 | `runtime.operate` |
| 重置聊天会话 | `pipeline.chat.reset`<br/>`workspace.pipeline.chat.reset()` | 高危 | `runtime.operate` |
| 复制聊天 | `pipeline.copy`<br/>`workspace.pipeline.copy()` | 写 | `resource.manage` |
| 创建聊天 | `pipeline.create`<br/>`workspace.pipeline.create()` | 写 | `resource.manage` |
| 聊天默认配置 | `pipeline.defaults`<br/>`workspace.pipeline.defaults()` | 读 | `resource.view` |
| 删除聊天 | `pipeline.delete`<br/>`workspace.pipeline.delete()` | 高危 | `resource.manage` |
| 获取聊天扩展 | `pipeline.extensions.get`<br/>`workspace.pipeline.extensions.get()` | 读 | `resource.view` |
| 更新聊天扩展 | `pipeline.extensions.update`<br/>`workspace.pipeline.extensions.update()` | 写 | `resource.manage` |
| 聊天详情 | `pipeline.get`<br/>`workspace.pipeline.get()` | 读 | `resource.view` |
| 聊天列表 | `pipeline.list`<br/>`workspace.pipeline.list()` | 读 | `resource.view` |
| 聊天元数据 | `pipeline.metadata`<br/>`workspace.pipeline.metadata()` | 读 | `resource.view` |
| 执行聊天 | `pipeline.run`<br/>`workspace.pipeline.run()` | 写 | `runtime.operate` |
| 更新聊天 | `pipeline.update`<br/>`workspace.pipeline.update()` | 写 | `resource.manage` |
### 插件 (`plugin`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 获取插件配置 | `plugin.config.get`<br/>`workspace.plugin.config.get()` | 读 | `resource.view` |
| 插件调试信息 | `plugin.debug_info`<br/>`workspace.plugin.debug_info()` | 读 | `resource.manage` |
| 插件详情 | `plugin.get`<br/>`workspace.plugin.get()` | 读 | `resource.view` |
| GitHub发布包资源 | `plugin.github.assets`<br/>`workspace.plugin.github.assets()` | 读 | `resource.view` |
| GitHub 分支、标签和默认分支 | `plugin.github.refs`<br/>`workspace.plugin.github.refs()` | 读 | `resource.view` |
| GitHub发布版本 | `plugin.github.releases`<br/>`workspace.plugin.github.releases()` | 读 | `resource.view` |
| 从市场安装插件 | `plugin.install.marketplace`<br/>`workspace.plugin.install.marketplace()` | 高危 | `resource.manage` |
| 插件列表 | `plugin.list`<br/>`workspace.plugin.list()` | 读 | `resource.view` |
| 插件运行日志 | `plugin.logs`<br/>`workspace.plugin.logs()` | 读 | `audit.view` |
| 搜索插件市场 | `plugin.marketplace.search`<br/>`workspace.plugin.marketplace.search()` | 读 | `resource.view` |
| 插件说明文档 | `plugin.readme`<br/>`workspace.plugin.readme()` | 读 | `resource.view` |
### 模型供应商 (`provider`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 创建供应商 | `provider.create`<br/>`workspace.provider.create()` | 写 | `provider_secret.manage` |
| 删除供应商 | `provider.delete`<br/>`workspace.provider.delete()` | 高危 | `resource.manage` |
| 供应商详情 | `provider.get`<br/>`workspace.provider.get()` | 读 | `resource.view` |
| 供应商列表 | `provider.list`<br/>`workspace.provider.list()` | 读 | `resource.view` |
| 供应商模型数量 | `provider.models.count`<br/>`workspace.provider.models.count()` | 读 | `resource.view` |
| 扫描供应商可用模型 | `provider.models.scan`<br/>`workspace.provider.models.scan()` | 写 | `provider_secret.manage` |
| 更新供应商 | `provider.update`<br/>`workspace.provider.update()` | 写 | `provider_secret.manage` |
### 请求器 (`requester`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 请求器详情 | `requester.get`<br/>`workspace.requester.get()` | 读 | `resource.view` |
| 请求器列表 | `requester.list`<br/>`workspace.requester.list()` | 读 | `resource.view` |
### 技能 (`skill`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 创建技能 | `skill.create`<br/>`workspace.skill.create()` | 写 | `resource.manage` |
| 删除技能 | `skill.delete`<br/>`workspace.skill.delete()` | 高危 | `resource.manage` |
| 技能文件列表 | `skill.file.list`<br/>`workspace.skill.file.list()` | 读 | `resource.view` |
| 读取技能文件 | `skill.file.read`<br/>`workspace.skill.file.read()` | 读 | `resource.view` |
| 写入技能文件 | `skill.file.write`<br/>`workspace.skill.file.write()` | 写 | `resource.manage` |
| 技能详情 | `skill.get`<br/>`workspace.skill.get()` | 读 | `resource.view` |
| 预览GitHub技能 | `skill.github.preview`<br/>`workspace.skill.github.preview()` | 读 | `resource.manage` |
| 技能列表 | `skill.list`<br/>`workspace.skill.list()` | 读 | `resource.view` |
| 重新加载技能 | `skill.reload`<br/>`workspace.skill.reload()` | 写 | `resource.manage` |
| 更新技能 | `skill.update`<br/>`workspace.skill.update()` | 写 | `resource.manage` |
### 数据统计 (`stats`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 基础数据统计 | `stats.basic`<br/>`workspace.stats.basic()` | 读 | `resource.view` |
### 任务 (`task`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 查询任务 | `task.get`<br/>`workspace.task.get()` | 读 | `resource.view` |
### 工具 (`tool`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 工具详情 | `tool.get`<br/>`workspace.tool.get()` | 读 | `resource.view` |
| 工具列表 | `tool.list`<br/>`workspace.tool.list()` | 读 | `resource.view` |
### 工作区 (`workspace`)
| 操作 | ID 与方法 | 风险 | 授予者需要 |
| --- | --- | --- | --- |
| 工作区语言 | `workspace.language.get`<br/>`workspace.workspace.language.get()` | 读 | `workspace.view` |
`workspace.language.get` 返回 `{"language": "zh_Hans", "supported_languages": [...]}`。`language` 是工作区设置中的消息语言(默认 `en_US`),与成员个人的 WebUI 语言无关。插件和 Agent 可据此本地化回复与生成内容;修改语言仍只能由成员操作。