WeKnora/frontend/src
wizardchen 5510ea8f5a feat(agent): human-in-the-loop approval for MCP tool calls (#1173)
Add an opt-in human approval gate so Agent runs pause before executing
MCP tools that operators flag as dangerous, surface an approval card in
the chat UI, and only resume after the user approves (optionally with
edited args) or rejects.

Backend
- New mcp_tool_approvals table + repo/service to mark per-tool approval
  required (PG migration 000042 + sqlite init).
- approval.Gate coordinates RequestAndWait / Resolve with sync.Once
  delivery, configurable timeout, and Redis Pub/Sub fan-out so multi-
  replica deployments work without sticky sessions.
- MCPTool.Execute integrates the gate; uses a round-level ApprovalCtx
  (without the per-tool 60s timeout) for the wait, and re-derives a
  fresh 60s exec ctx after approval so CallTool keeps a full window.
- New SSE response types (tool_approval_required / _resolved) and
  EventBus events plumb approval state to AgentStreamDisplay.
- REST: list/set per-tool approval flag, resolve pending approval.
- Configurable via agent.tool_approval_timeout_seconds (yaml) or
  WEKNORA_AGENT_TOOL_APPROVAL_TIMEOUT env (accepts seconds or Go
  duration).

Frontend
- MCP settings: per-tool "require approval" switch on the test panel.
- Chat: ToolApprovalCard renders the pause point with editable JSON
  args, validation feedback, mm:ss countdown that turns warning/danger
  near deadline, and a resolved state that retains context.
- i18n strings added for zh-CN / en-US / ko-KR / ru-RU.

Docs
- docs/zh/mcp-approval.md covering behavior, config, API, deployment
  considerations (Redis cross-instance, restart limitations).
2026-05-10 22:57:12 +08:00
..
api feat(agent): human-in-the-loop approval for MCP tool calls (#1173) 2026-05-10 22:57:12 +08:00
assets fix(frontend): polish model settings UI and fix disabled brand color 2026-05-07 21:51:22 +08:00
components fix(frontend): polish model settings UI and fix disabled brand color 2026-05-07 21:51:22 +08:00
composables fix(frontend): make general-settings font picker actually work 2026-05-07 15:07:24 +08:00
hooks fix(frontend): knowledge document list layout, batch bar, and selection 2026-04-29 15:20:41 +08:00
i18n feat(agent): human-in-the-loop approval for MCP tool calls (#1173) 2026-05-10 22:57:12 +08:00
router feat(frontend): replace standalone search page with global command palette 2026-05-06 16:26:22 +08:00
stores feat(frontend): replace standalone search page with global command palette 2026-05-06 16:26:22 +08:00
types feat(frontend): chunking debug panel with live preview 2026-05-06 17:17:07 +08:00
utils fix(agent): hide trailing thinking event when it duplicates final answer 2026-05-07 17:33:03 +08:00
views feat(agent): human-in-the-loop approval for MCP tool calls (#1173) 2026-05-10 22:57:12 +08:00
wailsjs feat: implement automatic update checking and downloading functionality in the desktop app, enhancing user experience with seamless updates and corresponding UI settings 2026-04-11 18:51:16 +08:00
App.vue fix(frontend): make general-settings font picker actually work 2026-05-07 15:07:24 +08:00
main.ts perf(wiki): lazy-load sidebar page list with virtual-scroll tabs 2026-05-08 15:07:59 +08:00