feat(agent): support non-YOLO session modes at ACP start#1894
feat(agent): support non-YOLO session modes at ACP start#1894piorpua merged 6 commits intoiOfficeAI:mainfrom
Conversation
Claude Code CLI supports 6 permission modes but AionUi only exposed 3 (default, plan, bypassPermissions). Add the missing 3 modes with descriptions to help users understand each mode's behavior. Constraint: ACP session/set_mode accepts arbitrary mode strings — no backend changes needed Confidence: high Scope-risk: narrow
New Claude permission modes need i18n keys across all 6 locales. acceptEdits already had translations; only auto and dontAsk are new. Confidence: high Scope-risk: narrow
Regenerate i18n-keys.d.ts to include agentMode.auto and agentMode.dontAsk. Apply oxfmt formatting to test file. Confidence: high Scope-risk: narrow
…modes Extract applySessionMode helper to reduce duplication between YOLO and non-YOLO session mode paths. Non-YOLO modes (acceptEdits, auto, dontAsk, plan) are now applied at session start, matching user selection on the Guid page. Constraint: YOLO mode failures remain fatal; non-YOLO failures are non-fatal Rejected: Keeping inline duplication | two nearly identical try-catch blocks with same perf logging Confidence: high Scope-risk: narrow
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Cover the new applySessionMode private method and the else-if branch that applies non-YOLO session modes (acceptEdits, auto, dontAsk, plan) at ACP start. Fixes 0% patch coverage reported by Codecov.
Inline vi.hoisted() arrow function to match oxfmt formatting rules. Confidence: high Scope-risk: narrow
Code Review:feat(agent): support non-YOLO session modes at ACP start (#1894)变更概述本 PR 为 Claude 后端在 ACP 会话启动时增加了对非 YOLO 权限模式(acceptEdits、auto、dontAsk、plan)的支持。核心改动是提取了 方案评估结论:✅ 方案合理
问题清单🔵 LOW — 测试 mock 中存在空构造函数(lint 警告)文件: 问题代码: vi.mock('../../src/process/agent/acp/AcpAdapter', () => ({
AcpAdapter: class {
constructor() {} // lint: no-useless-constructor / no-extraneous-class
},
}));
vi.mock('../../src/process/agent/acp/ApprovalStore', () => ({
AcpApprovalStore: class {
constructor() {} // lint: no-useless-constructor / no-extraneous-class
},
createAcpApprovalKey: vi.fn(),
}));问题说明:oxlint 报 修复建议: vi.mock('../../src/process/agent/acp/AcpAdapter', () => ({
AcpAdapter: class {},
}));
vi.mock('../../src/process/agent/acp/ApprovalStore', () => ({
AcpApprovalStore: class {},
createAcpApprovalKey: vi.fn(),
}));汇总
结论✅ 批准合并 — 无阻塞性问题,主体逻辑和测试均干净,lint 警告仅在测试 mock 中。 本报告由本地 |
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
Summary
acceptEdits,auto,dontAskpermission modes to Claude backend session mode mappingapplySessionModeprivate helper to deduplicate YOLO/non-YOLO session mode code pathsChanges
9512083d606f3a3f4f1316b5ec4f3600applySessionModehelper, reduce duplicationFollow-up Issues
enableYoloMode()to useapplySessionModeTest Plan
bunx tsc --noEmit— no type errorsprek run --from-ref origin/main --to-ref HEAD— all checks passbunx vitest run— 2023/2023 pass (8 pre-existing failures inpreviewFileWatch.dom.test.tsunrelated to this PR, confirmed on main)node scripts/check-i18n.js— passedgit diff --stat— onlyacp/index.tsandAcpAgentManager.tsmodified