Skip to content

feat: 人类接管回路(动作状态、wait-control)与虚拟光标 - #252

Open
fish0710 wants to merge 2 commits into
Tencent:mainfrom
fish0710:feat/human-takeover-loop
Open

fish0710 wants to merge 2 commits into
Tencent:mainfrom
fish0710:feat/human-takeover-loop

Conversation

@fish0710

Copy link
Copy Markdown

背景

当人类在 Agent Window 旁边观察 agent 操作时,目前缺两件事:一是看不出 agent 正在做什么、下一步要点哪里;二是想临时接手页面时,只能"中断",中断后没有一个干净的交还入口。

这个 PR 加入了一个完整的「人类接管」回路,以及配套的虚拟光标。

改动

虚拟光标(feat(extension): visible virtual agent cursor before CDP input

  • 每次 click / hover 之前,background 向标签页发一条 bsk/cursor 消息,content script 把一个箭头滑向目标(120–500 ms,按距离计算),点击时带一圈涟漪。
  • 纯装饰性:光标相关的失败不会影响工具结果;截图期间 overlay host 依然隐藏,agent 的截图保持干净。

接管回路(feat: human takeover loop with action status, wait-control and cursor wiring

Extension 侧:

  • 状态胶囊显示当前动作("点击 @e3"、"输入 …"),由每个输入类工具前后发出的 bsk/action-status 驱动。
  • "中断" 改为 "接管":取消进行中的工具并发出 session.control_taken;暂停态的胶囊提供备注框和"交还给 Agent",交还时发出 session.control_returned { note }
  • 暂停 / 正在中断的会话不再因为被动读取而自动恢复;接管请求失败时回滚到"已接管"状态,而不是把页面锁死。

Daemon / CLI 侧:

  • 会话新增 held 状态:control=user 期间所有输入类工具都会被拒绝,并在报错里指向 bsk session wait-control
  • 新增 bsk session statusbsk session wait-control --timeout(上限 30 分钟),返回控制权状态和用户备注;交还控制权时会同时清掉一次性的 interrupt 标记。
  • 来自非会话所有者浏览器的事件、以及未知会话的事件一律忽略;备注长度上限 4 KiB。
  • 协议版本 1.3 → 1.4,同步更新 schema、CHANGELOG 和 SKILL.md。

测试

新增 / 更新了覆盖上述行为的单测与集成测试,包括 crates/bsk-cli/tests/session_takeover.rsaction-status-bridgecursor-bridge、dispatcher 与 interaction 的测试。

🤖 Generated with Claude Code

zhongyy40 and others added 2 commits September 15, 2026 15:27
Add a cosmetic in-page cursor so a human watching the Agent Window can see
what the agent is about to do. Before each click/hover the background sends
a `bsk/cursor` message to the tab; the content script glides an arrow to the
target (120-500 ms, distance based) and ripples on click. Failures never
affect the tool result, and the overlay host is still hidden during
captures so agent screenshots stay clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTT2U726RDMrj22dDy1YMF
… wiring

Extension:
- Status pill shows the current action ("点击 @e3", "输入 …") via a
  `bsk/action-status` message sent around every input tool.
- "中断" becomes "接管": it cancels inflight tools and emits
  `session.control_taken`; the paused pill offers a note box and
  "交还给 Agent", which emits `session.control_returned { note }`.
- Paused/interrupting sessions no longer auto-resume on passive reads;
  a failed take-over request rolls back to control instead of locking
  the page.
- Wire the virtual cursor into the dispatcher and content script.

Daemon / CLI:
- Sessions gain a held state: while control=user every input tool is
  rejected with a message pointing at `bsk session wait-control`.
- New `bsk session status` and `bsk session wait-control --timeout`
  (max 30m) return control state and the user's note; returning control
  also clears the one-shot interrupt marker.
- Events from browsers that do not own the session, or for unknown
  sessions, are ignored; notes are capped at 4 KiB.
- Protocol version 1.3 -> 1.4; schemas, CHANGELOG and SKILL.md updated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LTT2U726RDMrj22dDy1YMF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant