Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(auto-review): 渠道策略优先于可信 MCP 放行;Hook 审核移交卡不再提供总是允许
Dash7e62f0dcf727
diff --git a/apps/desktop/src/main/hook-control/interactions.ts b/apps/desktop/src/main/hook-control/interactions.tsindex b999fa0319..1d29b62e28 100644--- a/apps/desktop/src/main/hook-control/interactions.ts+++ b/apps/desktop/src/main/hook-control/interactions.ts@@ -139,6 +139,7 @@ export function composeInteractionCard(req: InteractionRequest): ComposedInteracconst inputSummary = action.kind === 'tool'? summarizeInput(model.input): truncate(action.preview, HOOK_PERMISSION_INPUT_SUMMARY_MAX);+ const handoff = autoReviewUnavailablePromptLine(req) !== null;const body = [permissionPromptDescription(req) ?? '',autoReviewUnavailablePromptLine(req) ?? '',@@ -154,13 +155,14 @@ export function composeInteractionCard(req: InteractionRequest): ComposedInteracbody,buttons: [{ id: 'perm:allow', label: '允许一次', style: allowOnce.style },- { id: 'perm:always', label: '本任务总是允许', style: allowAlways.style },+ // Auto-review handoffs (AI ask or unavailable) only ever allow this one call.+ ...(handoff ? [] : [{ id: 'perm:always', label: '本任务总是允许', style: allowAlways.style }]),{ id: 'perm:deny', label: '拒绝', style: deny.style },],},decisions: new Map<string, InteractionDecision>([['perm:allow', allowOnce.decision],- ['perm:always', allowAlways.decision],+ ...(handoff ? [] : [['perm:always', allowAlways.decision] as [string, InteractionDecision]]),['perm:deny', deny.decision],]),defaultDecision: model.buildDefaultDecision(TIMEOUT_REASON),diff --git a/apps/desktop/src/main/im/shared/__tests__/interactionCardModel.test.ts b/apps/desktop/src/main/im/shared/__tests__/interactionCardModel.test.tsindex b7dba9b426..930c09bde9 100644--- a/apps/desktop/src/main/im/shared/__tests__/interactionCardModel.test.ts+++ b/apps/desktop/src/main/im/shared/__tests__/interactionCardModel.test.ts@@ -434,7 +434,10 @@ describe('跨实现一致性 — IM cardBuilders vs hook composeInteractionCard'const im = cards.buildPermissionCard(request);expect(im.body).toContain('自动审批需要你决定:这会删除所有 iOS 模拟器,你只让我排查键盘问题。');expect(im.buttons.map((b) => b.id)).toEqual(['permission:allow:once', 'permission:deny']);- expect(composeInteractionCard(request)?.card.body).toContain('自动审批需要你决定:');+ const hook = composeInteractionCard(request);+ expect(hook?.card.body).toContain('自动审批需要你决定:');+ expect(hook?.card.buttons.map((b) => b.id)).toEqual(['perm:allow', 'perm:deny']);+ expect(hook?.decisions.has('perm:always')).toBe(false);});it('安全默认: IM cancelPending 与 hook defaultDecision 同形(只有 reason 由渠道给)', async () => {diff --git a/packages/maker-core/src/agents/claude-code/__tests__/auto-review-wiring.test.ts b/packages/maker-core/src/agents/claude-code/__tests__/auto-review-wiring.test.tsindex 1d0ab76068..03011a0939 100644--- a/packages/maker-core/src/agents/claude-code/__tests__/auto-review-wiring.test.ts+++ b/packages/maker-core/src/agents/claude-code/__tests__/auto-review-wiring.test.ts@@ -322,8 +322,8 @@ describe('Auto-review wiring: native first, Cindy fallback', () => {const { handle, preToolUse } = await startSession('auto', {providerId: 'anthropic',authSource: 'oauth',- mcpProviderNames: ['custom_prompt_mcp'],- mcpToolApprovalPolicy: () => 'prompt',+ mcpProviderNames: ['custom_prompt_mcp', 'cindy_orca'],+ mcpToolApprovalPolicy: ({ serverName }) => (serverName === 'cindy_orca' ? 'auto-approve' : 'prompt'),});await handle.send({ type: 'user', content: 'group request' }, {turnPermissionPolicy: {@@ -335,7 +335,9 @@ describe('Auto-review wiring: native first, Cindy fallback', () => {expect(handle.getAutoReviewOwner?.()).toBe('cindy');expect(await preToolUse('Bash', { command: 'npm test' })).toEqual(['ask']);expect(await preToolUse('mcp__custom_prompt_mcp__write_record', { value: 1 })).toEqual(['ask']);- expect(await preToolUse('Read', { file_path: 'README.md' })).toEqual([]);+ // A channel policy outranks trusted-MCP approval and read-only shortcuts.+ expect(await preToolUse('Read', { file_path: 'README.md' })).toEqual(['ask']);+ expect(await preToolUse('mcp__cindy_orca__create_workers', { workers: [] })).toEqual(['ask']);await handle.close();});diff --git a/packages/maker-core/src/agents/claude-code/index.ts b/packages/maker-core/src/agents/claude-code/index.tsindex 93b016031e..4143a38f77 100644--- a/packages/maker-core/src/agents/claude-code/index.ts+++ b/packages/maker-core/src/agents/claude-code/index.ts@@ -2215,10 +2215,9 @@ export class ClaudeCodeAgent extends BaseAgent {});const isMcp = resolveMcpToolTarget(toolName, registeredMcpServerNames) !== null;const mcpPolicy = isMcp ? classifyMcpApprovalPolicy(toolName, pre.tool_input) : null;- // Requester authority (owner / group guest) is only known to Cindy.- if (activeTurnPermissionPolicy && !isReadOnlyClaudeTool(toolName) && mcpPolicy !== 'auto-approve') {- return decide('ask', 'Cindy reviews tool calls in channel turns.');- }+ // Requester authority (owner / group guest) and forceConfirmToolCall are only known to+ // Cindy, and a channel policy outranks trusted-MCP approval: route every call to canUseTool.+ if (activeTurnPermissionPolicy) return decide('ask', 'Cindy reviews tool calls in channel turns.');if (mcpPolicy === 'auto-approve') return decide('allow', 'Trusted Cindy tool.');if (mcpPolicy === 'prompt-each-time') return decide('ask', 'This tool requires Cindy confirmation.');return { continue: true };