Files
Agent-System-Backend/policy/modules/cmdbus.md
weichen 5c52c71f9c Add cmdbus: registry-driven command dispatch with audit and inline confirm
Why: T3 of the interaction foundation - unify button/card/slash/chat entries onto one command bus (D27) composing the Agent-Command library (D30), with danger=high commands gated behind inline confirm cards and every dispatch leaving the same audit envelope.
Evidence: go test green - cmdbus suite (four-entrance audit symmetry, high-danger confirm lifecycle incl. cancel/expiry/handler-reject, audit-unavailable yields unknown, plugin spec fail-closed, schema scalar validation) and server e2e (danger command via POST /api/commands -> confirm card -> card action confirm -> committed receipt -> audit query ordered accepted->committed); legacy /help,/new,/mock,/model,/profile contract preserved through the bus; store migration v7 command_audit (both dialects) with roundtrip test updated.
Impact: new internal/cmdbus (L1 package per D33), server routes POST /api/commands/{id} + GET /api/commands/audit + registry-driven GET /api/commands, postMessage chat-entrance dispatch when the intent gate matches a registered command, plugins host OnCommands overlay, module cards policy/modules/{cmdbus,cardsvc}.md; pending confirm state is process-local (documented limitation).
Refs: docs/proposals/2026-09-30-ui-inbox-command-workspace.md T3; task card feature/command-bus-r1
2026-09-30 07:51:31 +00:00

1.2 KiB
Raw Permalink Blame History

模块卡:internal/cmdbuf(命令总线)

  • 状态:active(T3 落地,提案 D27/D30/D33)
  • 职责:组合 Agent-Command 生态库——命令注册(builtin/plugin/user)、四入口同源分发(button/card/slash/chat→api 归一)、params JSON-Schema 子集校验、危险命令(danger=high)的内联确认卡收口、审计信封落盘(四态回执)。
  • 公开面:New(AuditStore, CardPort, now)、RegisterBuiltin/RegisterPluginCommands、Dispatch(ctx, Request) Response、Confirm(owner, cardID, actionID)、ResolveSlash/SlashTable/HasCommand/List。
  • 依赖:agent-command(生态库,嵌套 submodule + replace);core(ActivityCard/UIAction);不依赖 server/runmgr(server 依赖它;端口注入避免反向依赖)。
  • 隔离档位:L1 包(仓内);纯编排无自有存储——审计走 store 端口、确认卡走 cardsvc 端口。
  • 已知限制:确认挂起态为进程内(重启后确认返回 rejected expired);params 校验为 draft-07 标量子集。
  • 升级拆仓触发条件:出现第二宿主(非 backend)需要同一命令总线时,随 Agent-Command 生态位评估拆出(同 cardsvc 判据)。