Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(chat): preserve mobile queue metadata and clarify directed replies
Chris2f81ca4f25c5
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 263ab5ab08..d804b99ab8 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -346,11 +346,11 @@ describe('Chat Server result delivery and refresh', () => {buildBotGroupQuoteCard({ messageId: '70000000-0000-4000-8000-000000000009', authorName: 'Someone', authorKind: 'user',excerpt: 'nested quote', attachmentCount: 0, attachmentName: null, sequence: 3 }),{ type: 'text', text: 'Original\n\nwords' }, { type: 'media', mediaId, caption: 'plan.pdf' }], ...overrides });- function quoteResponse(original: unknown) {+ function quoteResponse(original: unknown, responseMode = 'all') {return (route: string, method: string) => {if (route === `/conversations/${roomId}/messages/${quotedId}`) return original ? { body: original } : { status: 404, body: { error: { code: 'MESSAGE_NOT_FOUND' } } };if (route.endsWith('/members')) return { body: [botMember] };- if (route.endsWith('/snapshot')) return { body: { room: room(roomId), members: [botMember], messages: [], cursor: '1' } };+ if (route.endsWith('/snapshot')) return { body: { room: { ...room(roomId), response_mode: responseMode }, members: [botMember], messages: [], cursor: '1' } };if (route.endsWith('/messages') && method === 'POST') return { body: { id: 'saved-quote' } };return response(route);};@@ -373,8 +373,11 @@ describe('Chat Server result delivery and refresh', () => {expect(body).not.toHaveProperty('replyToId');});- it.each([['quote', false], ['thread', false], ['quote', true], ['thread', true]] as const)('addresses the server-read bot author through %s (explicit=%s)', async (entry, explicit) => {- fixture.handle.mockImplementation(quoteResponse(quoted()));+ it.each([+ ['quote', false, 'all'], ['thread', false, 'all'], ['quote', true, 'all'], ['thread', true, 'all'],+ ['quote', false, 'mentioned'], ['thread', false, 'mentioned'],+ ] as const)('addresses the server-read bot author through %s (explicit=%s, mode=%s)', async (entry, explicit, responseMode) => {+ fixture.handle.mockImplementation(quoteResponse(quoted(), responseMode));const input = { groupId: roomId, text: 'Please continue', clientId: `reply-author-${entry}`, mentions: { all: false, botIds: explicit ? [botId] : [] } };const result = entry === 'thread'? await service.chatServer!.reply({ ...input, rootId: quotedId })@@ -384,7 +387,7 @@ describe('Chat Server result delivery and refresh', () => {});it.each(['quote', 'thread'] as const)('does not infer a bot recipient from a human-authored %s', async entry => {- fixture.handle.mockImplementation(quoteResponse(quoted({ authorId: selfId, author: { kind: 'human', name: 'Bot' } })));+ fixture.handle.mockImplementation(quoteResponse(quoted({ authorId: selfId, author: { kind: 'human', name: 'Bot' } }), 'mentioned'));const input = { groupId: roomId, text: 'Agreed', clientId: `reply-human-${entry}`, mentions: { all: false, botIds: [] } };expect(entry === 'thread'? await service.chatServer!.reply({ ...input, rootId: quotedId })diff --git a/apps/mobile/src/__tests__/botGroupRemote.test.ts b/apps/mobile/src/__tests__/botGroupRemote.test.tsindex da61354d7a..ccea41732d 100644--- a/apps/mobile/src/__tests__/botGroupRemote.test.ts+++ b/apps/mobile/src/__tests__/botGroupRemote.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from 'vitest';import type { HostedRemoteCollectionItem } from '@/device-link/remoteResources';-import { chatGroupMembership } from '@cindy/maker-shared/botGroupPresentation';+import { botGroupComposerPlanState, chatGroupMembership, openBotGroupPlan } from '@cindy/maker-shared/botGroupPresentation';import {botGroupChatDataFromResource,botGroupErrorCode,@@ -47,6 +47,20 @@ function chatData(overrides: Record<string, unknown> = {}) {}describe('parseBotGroupChatData', () => {+ // The remote resource must preserve the queue semantics before choosing composer copy.+ it.each([+ ['all', 'talk', true, { kind: 'running', botName: '咪咪', talk: true }],+ ['mentioned', 'talk', true, null],+ ['all', 'talk', false, null],+ ['mentioned', 'future', 'true', { kind: 'running', botName: '咪咪' }],+ ] as const)('keeps the host queue reply policy through parsing (%s, %s, %s)', (replyMode, kind, canAdd, expected) => {+ const data = chatData({ replyMode, plans: [{ ...chatData().plans[0], status: 'running', kind, canAdd }] });+ const parsed = parseBotGroupChatData(data)!;+ expect(botGroupComposerPlanState(openBotGroupPlan(parsed), parsed.replyMode)).toEqual(expected);+ expect(parsed.plans[0].kind).toBe(kind === 'talk' ? 'talk' : undefined);+ expect(parsed.plans[0].canAdd).toBe(typeof canAdd === 'boolean' ? canAdd : undefined);+ });+// The new public group image field must not turn a host path, credentialed URL// or malformed input into a phone image source; keep the legacy fallback (unit).it.each([null, 7, 'http://example.invalid/avatar.png', 'file:///avatar.png',diff --git a/apps/mobile/src/session/botGroupRemote.ts b/apps/mobile/src/session/botGroupRemote.tsindex 2dd067dc41..94b35b3b20 100644--- a/apps/mobile/src/session/botGroupRemote.ts+++ b/apps/mobile/src/session/botGroupRemote.ts@@ -271,6 +271,8 @@ function parsePlan(value: unknown): BotGroupPlanView | null {return {id: planId,status,+ kind: record.kind === 'talk' || record.kind === 'work' ? record.kind : undefined,+ canAdd: typeof record.canAdd === 'boolean' ? record.canAdd : undefined,organizerBotId: id(record.organizerBotId) ?? '',organizerName: text(record.organizerName, MAX_NAME) ?? '',steps: steps as BotGroupPlanStepView[],diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.mdindex fc6a2ca52d..2fc7169a7c 100644--- a/docs/dev-rules/protocol-compatibility.md+++ b/docs/dev-rules/protocol-compatibility.md@@ -2643,17 +2643,28 @@ Chat Server `/me` 追加 `capabilities.groupDiscussionParity: 1`。Desktop 只### 服务器伙伴群一次一位伙伴(`groupSingleSpeaker`,2026-10-21)Chat Server `/me` 追加 `capabilities.groupSingleSpeaker: 1`,服务端派发随之改变且对所有客户端生效:-主群里 @ 多位或没 @ 人都直接建 `kind=talk` 的队列(没 @ 人时排全部伙伴)、不再自动续圈。旧客户端照常可用——+主群里 @ 多位直接建 `kind=talk` 的队列;没有定向接收人的普通消息由现有 `responseMode` 决定:+`all` 排全部可答伙伴,`mentioned` 不产生执行、不创建或替换队列。只有一位可答伙伴时直接回答,不建队列;不再自动续圈。旧客户端照常可用——它们本就声明 `planVersion: 1` 领取安排步骤、渲染安排卡并能「继续」;仍发送的 `deferExecution` /`continueDiscussion` 被接受(后者只记录、不续圈),旧的「继续讨论」只叫被 @ 的伙伴或第一位伙伴。新 Desktop 只在看到该能力时:不再发 `deferExecution`、不做发送前的辅助判断、不发 `continueDiscussion`;队列停着等继续时新消息按新请求发送(不作为补充)。队列前 5 位由服务端自动接续,无需客户端参与。-`chat_plan.kind` 是附加字段,旧客户端忽略;新客户端缺字段时按旧分工卡呈现。+`chat_plan.kind` 是附加字段,旧客户端忽略;新客户端缺字段时按旧分工卡呈现。手机解析电脑的群资源时,+保留经校验的可选 `kind`(talk/work)与 `canAdd`(boolean);缺失或非法时沿用旧分工呈现,不把字符串当作补充权限。+`mentioned` 的运行中 talk 队列不接受普通无 @ 消息作为自动补充,两端输入框不得承诺交给正在答的伙伴。停止的范围收窄与主群上下文精简都只在看到该能力时启用,旧服务器保留整轮停止与完整主群历史;收窄只在执行端实现(成员只停自己的请求与伙伴,群主或管理员——含本账号拥有的管理员伙伴——可 `all`),沿用既有 control /plan action 的服务端权限,IPC `bot-group:stop` 追加可选 `scope`;手机经电脑的远程动作不变(停止为本人范围)。发布顺序:服务端整集群先上,再发客户端。+2026-10-23 回复模式恢复(客户端 #6888 / cindy-server #1030):`groupSingleSpeaker` 只表示回答顺序,+不代表每条普通消息必有回答;主群、线程与过期 `deferExecution` 恢复共用 `responseMode` 判断,显式继续不受影响。+仍保留定向回复规则:宿主把引用回复伙伴或伙伴根消息下话题回复的原作者加入 `mentions`,即使没有手打 @,+服务端也按非空 `mentions` 处理;人类根消息下的普通话题回复不隐式点名伙伴。服务端不从正文猜接收人。+不新增字段、能力版本或迁移;先部署服务端整集群以恢复已存模式,再发布客户端入口与补充消息修复。+受影响的旧服务端仍忽略 `mentioned`,旧 Desktop 也可能把闲聊作为队列补充发送;能力位本身不能证明修复已部署,+仅客户端或仅服务端合并均不代表完整生产修复上线,发布后须复验普通消息、定向回复与运行中队列补充。+### 伙伴群聊引用回复(`cindy.quote` v1)主时间线的引用回复不使用服务器 `replyToId`:现行服务端要求它与 `threadRootId` 指向同一 Thread,diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 145f230433..c0af3f433a 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -136,7 +136,9 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下也不再自动第 2、3 圈;继续由队列卡的「继续」完成。- 队列停着等「继续」时又发了符合回复条件的新消息,就是新问题:旧队列结束,按新消息另排。队列里正有伙伴在答时,发起人不 @ 人说的话仅在 `all` 时作为这一步的补充交给正在答的伙伴;@ 了人则按 @ 依次普通回复、`all` 且没 @ 人只由第一位伙伴回答,- 不另开队列。话题里的消息不排队列:@ 多位依次回答,`all` 且没 @ 人只由第一位伙伴回答,`mentioned` 且没 @ 人保持安静。+ 不另开队列。话题里的消息不排队列:点名多位依次回答,`all` 且没有接收人只由第一位伙伴回答,`mentioned` 且没有接收人保持安静。+ 这里的「没有 @」指没有定向接收人的普通消息;保留第 10 节已有的定向回复例外:引用回复伙伴,或在伙伴消息下回复话题时,+ 宿主会把仍在群里的原作者加入接收人,所以无需再手动 @,`mentioned` 下也会回答。回复人类根消息的话题不增加伙伴接收人。- 主群里的普通回复只带最近 12 条主群消息、每条截至 600 字(更早的标为已省略),群专线自带此前的轮次;当前请求本身完整送达。- **停止只停自己的**:普通成员点停止,停掉自己发起的请求与安排、以及自己的伙伴在替别人做的事;