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): 命令确认保留工作目录
Dash037f4d9df6f4
diff --git a/apps/desktop/src/renderer/components/new-chat/__tests__/formatToolInput.test.ts b/apps/desktop/src/renderer/components/new-chat/__tests__/formatToolInput.test.tsindex d1c7075f2d..fd01d8c5b4 100644--- a/apps/desktop/src/renderer/components/new-chat/__tests__/formatToolInput.test.ts+++ b/apps/desktop/src/renderer/components/new-chat/__tests__/formatToolInput.test.ts@@ -32,7 +32,7 @@ describe('formatToolInput (harness-agnostic)', () => {it('shows MCP and Codex exec calls as the operation, not JSON', () => {expect(formatToolInput('mcp__x__y', { a: 1 })).toBe('y {"a":1}');- expect(formatToolInput('exec', { command: 'git status', cwd: '/repo' })).toBe('git status');+ expect(formatToolInput('exec', { command: 'git status', cwd: '/repo' })).toBe('git status\n# cwd: /repo');});it('falls back to truncated JSON for unknown tools / missing fields', () => {diff --git a/packages/maker-shared/src/__tests__/interaction.test.ts b/packages/maker-shared/src/__tests__/interaction.test.tsindex 86dfce3083..61ad3d09af 100644--- a/packages/maker-shared/src/__tests__/interaction.test.ts+++ b/packages/maker-shared/src/__tests__/interaction.test.ts@@ -285,7 +285,7 @@ describe('interaction shared model', () => {});expect(exec).toMatchObject({title: '允许运行这条命令?',- code: 'xcrun simctl delete all',+ code: 'xcrun simctl delete all\n# cwd: /repo',autoReviewReason: '这会删除电脑上的所有 iOS 模拟器,你只让我排查键盘问题。',});@@ -308,6 +308,8 @@ describe('interaction shared model', () => {expect(describePermissionAction('mcp:cindy_browser:call_tool', {name: 'browser', args: { action: 'recipe', recipeId: 'post-reply', site: 'x.com', text: 'hello' },}).preview).toBe('recipe {"recipeId":"post-reply","site":"x.com","text":"hello"}');+ expect(describePermissionAction('exec', { command: 'rm -rf build', cwd: '/repo/app' }).preview)+ .toBe('rm -rf build\n# cwd: /repo/app');expect(describePermissionAction('Grep', { pattern: 'AKIA', path: '/Users/me' }).preview).toBe('AKIA \u2192 /Users/me');expect(describePermissionAction('grep', { pattern: 'TODO' }).preview).toBe('TODO');// call_tool.args stringified by the caller (issue #350) is parsed like the approval policy does.diff --git a/packages/maker-shared/src/interaction.ts b/packages/maker-shared/src/interaction.tsindex 35620420ff..313aa8de3d 100644--- a/packages/maker-shared/src/interaction.ts+++ b/packages/maker-shared/src/interaction.ts@@ -973,7 +973,9 @@ export function describePermissionAction(toolName: string, input: Record<string,}if (COMMAND_TOOLS.has(name)) {const command = commandText(input);- if (command) return { kind: 'command', preview: command };+ // The same relative command in two repositories is not the same operation: keep the cwd.+ const cwd = readString(input.cwd) ?? readString(input.workdir);+ if (command) return { kind: 'command', preview: cwd ? `${command}\n# cwd: ${cwd}` : command };}if (FILE_READ_TOOLS.has(name) || FILE_WRITE_TOOLS.has(name)) {const paths = filePaths(input, FILE_READ_TOOLS.has(name) && name !== 'read');