Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(teammates): confirm helper hook command installation
Chrise435a6ea8535
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.tsindex 2110f5dc7d..d12a004b8f 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/taskActionAuthorization.test.ts@@ -984,6 +984,27 @@ describe('teammate turn principal', () => {expect(h.confirm).not.toHaveBeenCalled();});+ // r4409346213: the helper forwards to the same installing/self-testing handler.+ // Unit tier: a valid helper script must wait before any installer effect.+ it('requires the same command decision for the helper hook installer', async () => {+ const h = desktopFixture('automatic');+ live(h);+ const request = helper('schedule_set_pre_run_hook', { script: 'process.exit(2)' });+ const install = vi.fn(async () => 'installed');+ h.confirm.mockResolvedValue(false);+ expect(JSON.stringify(await withToolCallAuthority(h.authorize, request, install))).toContain('USER_CANCELLED');+ expect(install).not.toHaveBeenCalled();+ expect(h.confirm).toHaveBeenCalledWith('companion', request.tool, request.args,+ { server: 'cindy_helper', risk: 'command' });+ h.confirm.mockResolvedValue(true);+ expect(await withToolCallAuthority(h.authorize, request, install)).toBe('installed');+ expect(install).toHaveBeenCalledTimes(1);+ h.confirm.mockClear();+ h.activeInput.ownerInput = true;+ expect(await withToolCallAuthority(h.authorize, request, install)).toBe('installed');+ expect(h.confirm).not.toHaveBeenCalled();+ });+// Review #7782: approval must describe and bind the child's exact request, not// whichever request is current after the parent card is answered. Unit tier.it.each(['request-id', 'arguments'] as const)('expires a permission answer when child %s changes', async change => {diff --git a/apps/desktop/src/main/maker-ipc/taskActionAuthorization.ts b/apps/desktop/src/main/maker-ipc/taskActionAuthorization.tsindex 6a71df772b..731ccba01a 100644--- a/apps/desktop/src/main/maker-ipc/taskActionAuthorization.ts+++ b/apps/desktop/src/main/maker-ipc/taskActionAuthorization.ts@@ -141,10 +141,11 @@ export function taskActionRisk(call: Pick<Call, 'server' | 'tool' | 'args'>,? call.args as Record<string, unknown> : {};// The local scheduler is a trusted MCP, but its script runner bypasses the// harness's shell approval. Classify the command effect, not all scheduler writes.+ if ((call.server === 'cindy_helper' || call.server === 'cindy_scheduler') &&+ call.tool === 'schedule_set_pre_run_hook' &&+ [args.script, args.description].some(value => typeof value === 'string' && value.trim()))+ return 'command'; // both surfaces install and self-test through the same handlerif (call.server === 'cindy_scheduler') {- if (call.tool === 'schedule_set_pre_run_hook' &&- [args.script, args.description].some(value => typeof value === 'string' && value.trim()))- return 'command'; // installs and self-tests codeif (['schedule_create', 'schedule_update', 'schedule_run_now'].includes(call.tool)) {const definition = call.tool === 'schedule_run_now' ? facts?.schedule: { ...facts?.schedule, ...args };diff --git a/docs/product-rules/teammate-authority.md b/docs/product-rules/teammate-authority.mdindex f54b066429..3a83b22fcb 100644--- a/docs/product-rules/teammate-authority.md+++ b/docs/product-rules/teammate-authority.md@@ -19,7 +19,7 @@| 风险 | 实际入口 || --- | --- |-| 本机调度命令 | `schedule_create` / `schedule_update` 保存脚本执行或命令前置检查、`schedule_run_now` 执行含此类命令的已存定义、`schedule_set_pre_run_hook` 安装并自测脚本 |+| 本机调度命令 | `schedule_create` / `schedule_update` 保存脚本执行或命令前置检查、`schedule_run_now` 执行含此类命令的已存定义、`cindy_helper` 和 `cindy_scheduler` 两个入口的 `schedule_set_pre_run_hook` 安装并自测脚本 || 删除自动化 | `routine_delete`、`schedule_delete` || 代用户回答权限请求 | `message_session_task` 携带 `decision` || 恢复暂停执行 | `message_session_task(mode=resume)`、`schedule_resume`,以及 `routine_save` 将已有停用规则保存为启用(含内置规则) |