Repository navigation
feat(approval): 审批卡片按 Claude Code 简化,拒绝后光标回到输入框 - #1106
Merged
AlphaCatMeow merged 1 commit intoNov 1, 2026
Merged
Conversation
- 去掉「允许并记住」的作用域下拉:2 记到后端给的默认作用域,卡片写明 「记住:<规则> · 本项目」;改作用域或删除规则到「设置 → 权限」。 - 去掉「拒绝并说明」按钮和卡片上的说明框:Esc 与 3 都是拒绝。 - 审批栏消失时,光标原本在审批栏上才还给输入框,用户可直接写下一步; 用原生 focusin/focusout 跟踪(卡片在挂载 effect 里聚焦时 React onFocus 不触发)。 - 输入框有未发送草稿时,新来的审批卡片不抢焦点,草稿里的 2 或回车不会被当成回答。 Closes Stack-Cairn#1105 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LA-2b(#1098)的审批卡片比 Claude Code 多了两样东西:「允许并记住」的作用域下拉,和单独的「拒绝并说明」按钮加输入框。Claude Code 的审批只有三个选项,拒绝后直接在输入框里告诉模型接下来怎么做。本 PR 把卡片改成和 Claude Code 一样,并且拒绝后把光标还给输入框。
Closes #1105
Depends-On: none
Stack-Root: #1106
改动
ToolApprovalBar.tsxdefaultScope(后端suggestion.default_scope),卡片上写明「记住:<规则> · 本项目」。去掉「拒绝并说明」和说明输入框,Esc 与 3 都是拒绝。1 或回车仍然是允许本次,▾ 里的全部允许、全部拒绝不变。卡片挂载时,如果焦点在有草稿的输入框里,就不抢焦点ChatComposerBar.tsxdisplay: contents的容器。审批栏消失时,只有光标原本在审批栏上,并且现在落在 body,才调用composerRef.focus()。光标是否在审批栏上,靠原生focusin/focusout和捕获阶段的pointerdown判断。输入卡片有草稿时带上data-composer-draftdenyWithReason、denyReasonPlaceholder、rememberScope,两种语言的 key 仍然一致后端接口和协议没有改动:
reason和scope的数据通路还保留着,只是卡片不再提供这两个入口。改作用域、删除规则走「设置 → 权限」(#1102 / #1104)。截图(调试版真实客户端)
桌面 1280:

桌面 480:

WebUI 390:

验证
tool-approval-card:没有作用域下拉,2 记到 defaultScope;3 和 Esc 一样拒绝,卡片上没有说明框。composer-approval-focus-return:审批栏消失后输入框拿回光标,用户把光标移到别处时不抢la-full-testscrates/agent-gui下重跑能通过pnpm --filter @liveagent/gateway-webui testcheck-mirror.mjs、git diff --checkonFocus不会触发,拒绝后光标不再回到输入框(jsdom 里测不出来)。改用原生 focusin/focusout 后,真机复验恢复正常未覆盖:
🤖 Generated with Claude Code