Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(cindy-helper): send_to_session 接受非 UUID 的不透明 session id (#4528)
Yecheng Fu7f9ff40b70ac
diff --git a/packages/lizi-mcps/src/__tests__/sendToSessionTool.test.ts b/packages/lizi-mcps/src/__tests__/sendToSessionTool.test.tsindex a3ca1b2693..d71cf522cf 100644--- a/packages/lizi-mcps/src/__tests__/sendToSessionTool.test.ts+++ b/packages/lizi-mcps/src/__tests__/sendToSessionTool.test.ts@@ -76,10 +76,28 @@ describe('send_to_session tool', () => {expect(sendToSession).not.toHaveBeenCalled();});- it('target_session_id 非 uuid → INVALID_ARGS', async () => {+ // session id 是不透明字符串(见 apps/desktop/src/main/sessionIds.ts):新建 desktop+ // session 是 UUID,历史行可能是 cuid2 或 IM 确定性 id。工具层校验格式会让 UUID+ // session 无法 jump 回 cuid/IM session,使 handoff 变成单向。+ it.each([+ ['cuid2', 'v9lsxy1qlojy6x3z3y7drhxh'],+ ['IM 确定性 id', 'feishu_cli_abc_ou_xyz'],+ ])('target_session_id 为非 UUID 的 %s → 透传给 host, 不在 schema 层拦截', async (_kind, id) => {+ const { registry, sendToSession } = setup();+ const res = await registry.call('send_to_session', {+ target_session_id: id,+ message: 'hi',+ });+ expect(res.isError).toBeUndefined();+ expect(sendToSession).toHaveBeenCalledWith(+ expect.objectContaining({ targetSessionId: id }),+ );+ });++ it('target_session_id 为空串 → INVALID_ARGS, host 不被调', async () => {const { registry, sendToSession } = setup();const res = await registry.call('send_to_session', {- target_session_id: 'not-a-uuid',+ target_session_id: '',message: 'hi',});expect(parse(res)).toMatchObject({ ok: false, errorCode: 'INVALID_ARGS' });diff --git a/packages/lizi-mcps/src/xdt-helper/send_to_session.ts b/packages/lizi-mcps/src/xdt-helper/send_to_session.tsindex 3af4fb0b46..14b9a6a5af 100644--- a/packages/lizi-mcps/src/xdt-helper/send_to_session.ts+++ b/packages/lizi-mcps/src/xdt-helper/send_to_session.ts@@ -136,10 +136,11 @@ export function registerSendToSessionTool(inputShape: {target_session_id: z.string()- .uuid()+ .min(1).optional().describe(- `目标 ${BRAND_NAME} session 的 business id(UUID)。` ++ `目标 ${BRAND_NAME} session 的 business id(新建 desktop session 是 UUID,` ++ "历史 session 可能是 cuid 或 IM 确定性 id,一律按不透明字符串处理、不校验格式)。" +"要发给已有任务时必传(不知道 id 先用 list_sessions 查);提供 → jump 到该既有 session。" +"省略 → create:静默新建一个专属 session 并立刻跑一轮,返回里回传新建 id——仅在明确要新建专属任务时省略。",),