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。

fix(bots): 群任务卡不再带伙伴写下的完整任务目标

Chris5c56f1795dd0
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
index 6b17f1d229..f404f4c711 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
@@ -4306,6 +4306,21 @@ describe('Bot Session task end-to-end runtime', () => {
} finally { release(); runtime.dispose(); }
});
+ it('keeps the teammate\'s full objective out of the group task card that every member can read', async () => {
+ await seedPair(); seedGroupLane();
+ const release = registerGroupToolAuthority('group-lane', { botId: 'bot-a', mode: 'owner', isCurrent: () => true, validate: async () => {} });
+ const postGroupTaskMessage = vi.fn(async (input: { clientId: string }) => ({ ok: true as const, messageId: `posted:${input.clientId}` }));
+ const runtime = createDelegationRuntime({ postGroupTaskMessage });
+ try {
+ const task = await runtime.delegation.startSessionTask({ callerSessionId: 'group-lane', objective: 'Redo the launch page\nUse the private pricing notes in ~/owner-only.md' });
+ if (!task.ok) throw new Error(task.message);
+ await vi.waitFor(() => expect(postGroupTaskMessage).toHaveBeenCalled());
+ const { card } = postGroupTaskMessage.mock.calls[0]![0] as unknown as { card: unknown };
+ expect(JSON.stringify(card)).not.toContain('private pricing');
+ expect(card).toMatchObject({ data: { title: 'Redo the launch page', meta: { objective: 'Redo the launch page', delegationId: task.delegationId } } });
+ } finally { release(); runtime.dispose(); }
+ });
+
it('tells the teammate a task from an old local-only group reports to the owner privately', async () => {
await seedPair(); seedGroupLane();
const release = registerGroupToolAuthority('group-lane', { botId: 'bot-a', mode: 'owner', isCurrent: () => true, validate: async () => {} });
diff --git a/apps/desktop/src/main/maker-ipc/botDelegationService.ts b/apps/desktop/src/main/maker-ipc/botDelegationService.ts
index f906785176..a541641376 100644
--- a/apps/desktop/src/main/maker-ipc/botDelegationService.ts
+++ b/apps/desktop/src/main/maker-ipc/botDelegationService.ts
@@ -847,15 +847,19 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
event: { clientId: string; text: string; state: BotGroupTaskCardState; summary?: string; files?: Array<{ absolutePath: string }> },
): Promise<BotGroupTaskPostResult> => {
if (!deps.postGroupTaskMessage) return { ok: false, errorCode: 'GROUP_CHANNEL_UNAVAILABLE', retryable: false };
- const meta = await collaborationMeta(row, 'delegation-request');
const child = row.childSessionId ? await getDbClient().drizzle
.select({ title: sessions.title }).from(sessions)
.where(eq(sessions.id, row.childSessionId)).get() : undefined;
+ // The card builder clips the title on a character boundary; clipping here could split an emoji.
+ const title = child?.title?.trim() || row.objective.split('\n')[0]!;
+ // Every group member can read the card's data: the objective the teammate wrote may hold what
+ // was never said in the group, so the card carries only its title (the owner's live card reads
+ // the task itself).
+ const meta = { ...await collaborationMeta(row, 'delegation-request'), objective: title };
const card = buildBotGroupTaskCard({
meta,
state: event.state,
- // The card builder clips the title on a character boundary; clipping here could split an emoji.
- title: child?.title?.trim() || row.objective.split('\n')[0]!,
+ title,
...(event.summary ? { summary: event.summary } : {}),
}, groupTaskCardLabels());
return deps.postGroupTaskMessage({
diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.md
index 3c1fd6f5d3..3aee84583e 100644
--- a/docs/product-rules/bot-group-chat.md
+++ b/docs/product-rules/bot-group-chat.md
@@ -350,7 +350,7 @@ Chris 已明确扩展到多人各带伙伴,并选择「主人按群预先授
群专线的 `role=group` 是来源身份,不等于只读历史任务,也不单独构成授权。读取自己的 Profile、能力与 Skill 目录时,必须核对活跃执行、伙伴归属、成员状态、授权版本及执行租约;只聊天的专线仍不可读取私人资料。群主身份不能替代伙伴主人身份。
-只有伙伴主人发起且当前授权有效的执行,才能从群里启动独立开发任务或发送私聊。独立任务保留群内调用身份与来源范围,沿用普通任务的权限档、审批、隔离目录和工作目录注册。**从群里启动的任务住在这个群里**:父任务就是发起它的群专线,不再改挂或新建私聊。任务一建立,伙伴就以自己的身份在群里发一条带任务卡(`cindy.task` 卡片块,带 fallback 文字;fallback 由发送端按本机界面语言生成,卡片数据本身不含语言)的消息;群通道暂时不可用时,这条「进行中」卡在任务仍在进行期间按退避持续重试,应用重启后由启动恢复再发一次(按幂等 ID 去重,不会重复出现),任务已结束就不再补发;子任务要确认时再发一条「等你确认」的卡(权限请求只说需要批准,不带工具名和参数;提问带问题原文),主人从卡片打开任务作答;任务结束后结果正文、终态卡与交付文件作为伙伴的群消息回到群里。终态卡与主人实时任务卡同一口径:超时任务显示「已超时」,不是「失败了」。交付文件逐个上传,本机发不出去的文件(空文件、超过 100 MB)和服务端明确拒绝的文件跳过并记日志,其余照常送达;只有临时故障才整条稍后重试。超过一条消息 20 个附件上限的文件,与超长正文一样,在同一幂等 ID 家族的后续消息里继续发,不截断。这些消息在任何执行之外以伙伴 actor 发出,不唤醒群专线,也不唤醒私聊;工具返回 `completion_destination=group`,伙伴只需告诉群里开了什么;从本机旧式群(没有服务器房间)启动时返回 `completion_destination=private`,伙伴告诉群里结果会私下交给主人,不承诺在群里更新。群的消息通道明确拒绝(伙伴已不在群、群已归档、本机旧式群)时,结果退回该主人与该伙伴的私聊,不丢失。主人的桌面与手机看到的是实时任务卡(桌面在伙伴的主力电脑上读本机委派行,主人在自己的其他电脑上打开群时看快照;手机按该伙伴的主力电脑读,不论群是经哪台电脑打开还是直接从 Chat Server 进入;主力电脑未知时,经电脑打开的群读那台电脑,直接进入的群退回快照),其他成员看到卡片发出时的标题与状态。非主人获得的群工具授权不包含此独立任务能力。群内只能查询或控制由同一授权专线创建的独立任务;主人仍可从私聊管理已启动的任务。群执行结束不会取消已经正式启动的独立任务,后续群内操作必须重新验证当前执行。主人在桌面或手机上从群里的实时任务卡点「停止任务」是主人自己的操作,不是群工具调用:只要求这张卡所在的专线能看到该任务,不要求发起它的群执行仍在进行。
+只有伙伴主人发起且当前授权有效的执行,才能从群里启动独立开发任务或发送私聊。独立任务保留群内调用身份与来源范围,沿用普通任务的权限档、审批、隔离目录和工作目录注册。**从群里启动的任务住在这个群里**:父任务就是发起它的群专线,不再改挂或新建私聊。任务一建立,伙伴就以自己的身份在群里发一条带任务卡(`cindy.task` 卡片块,带 fallback 文字;fallback 由发送端按本机界面语言生成,卡片数据本身不含语言;群里每位成员都读得到卡片数据,所以卡片只带任务标题,不带伙伴写下的完整任务目标)的消息;群通道暂时不可用时,这条「进行中」卡在任务仍在进行期间按退避持续重试,应用重启后由启动恢复再发一次(按幂等 ID 去重,不会重复出现),任务已结束就不再补发;子任务要确认时再发一条「等你确认」的卡(权限请求只说需要批准,不带工具名和参数;提问带问题原文),主人从卡片打开任务作答;任务结束后结果正文、终态卡与交付文件作为伙伴的群消息回到群里。终态卡与主人实时任务卡同一口径:超时任务显示「已超时」,不是「失败了」。交付文件逐个上传,本机发不出去的文件(空文件、超过 100 MB)和服务端明确拒绝的文件跳过并记日志,其余照常送达;只有临时故障才整条稍后重试。超过一条消息 20 个附件上限的文件,与超长正文一样,在同一幂等 ID 家族的后续消息里继续发,不截断。这些消息在任何执行之外以伙伴 actor 发出,不唤醒群专线,也不唤醒私聊;工具返回 `completion_destination=group`,伙伴只需告诉群里开了什么;从本机旧式群(没有服务器房间)启动时返回 `completion_destination=private`,伙伴告诉群里结果会私下交给主人,不承诺在群里更新。群的消息通道明确拒绝(伙伴已不在群、群已归档、本机旧式群)时,结果退回该主人与该伙伴的私聊,不丢失。主人的桌面与手机看到的是实时任务卡(桌面在伙伴的主力电脑上读本机委派行,主人在自己的其他电脑上打开群时看快照;手机按该伙伴的主力电脑读,不论群是经哪台电脑打开还是直接从 Chat Server 进入;主力电脑未知时,经电脑打开的群读那台电脑,直接进入的群退回快照),其他成员看到卡片发出时的标题与状态。非主人获得的群工具授权不包含此独立任务能力。群内只能查询或控制由同一授权专线创建的独立任务;主人仍可从私聊管理已启动的任务。群执行结束不会取消已经正式启动的独立任务,后续群内操作必须重新验证当前执行。主人在桌面或手机上从群里的实时任务卡点「停止任务」是主人自己的操作,不是群工具调用:只要求这张卡所在的专线能看到该任务,不要求发起它的群执行仍在进行。
非主人群工具授权仅允许读取伙伴自身资料、已选能力和自己的技能;应用级能力目录与默认模型查询仍须当前主人执行授权。