Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(pi): 精确定位桥接主 tool_call 拦截器

david3e56e3de2c8e
diff --git a/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts b/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts
index 552d7c1223..806a22b808 100644
--- a/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts
+++ b/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts
@@ -52,7 +52,7 @@ it('keeps text-only policy local and ordinary tools independent of host UI failu
const source = CINDY_BRIDGE_EXTENSION_SOURCE;
const helperStart = source.indexOf('let textOnlyTurnActive = false');
const helperEnd = source.indexOf('function currentPermissionState', helperStart);
- const handlerStart = source.indexOf(" pi.on('tool_call'");
+ const handlerStart = source.indexOf(" pi.on('tool_call', async");
const handlerEnd = source.indexOf('\n });', handlerStart) + '\n });'.length;
const handlers = new Map<string, (event: any, ctx: any) => any>();
let permissionReads = 0;
@@ -108,7 +108,7 @@ it('lets a shared user\'s Pi call only tools that Cindy extensions registered',
const source = CINDY_BRIDGE_EXTENSION_SOURCE;
const gateStart = source.indexOf('function createCindyGuestToolGate');
const gateEnd = source.indexOf('\nconst PERMISSION_TITLE', gateStart);
- const handlerStart = source.indexOf(" pi.on('tool_call'");
+ const handlerStart = source.indexOf(" pi.on('tool_call', async");
const handlerEnd = source.indexOf('\n });', handlerStart) + '\n });'.length;
// 子代理扩展的工具名在生成时写进源码。
expect(source).toContain('createCindyGuestToolGate(piApi, ["subagent"])');