Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(chat): switch off before the server read; unknown @ goes to the organizer; phone shows auto handoff
Chris643f8c138e02
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 040ce082d5..c71f1adbf8 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -240,6 +240,10 @@ describe('Chat Server result delivery and refresh', () => {await stepEnded('2');expect(continues()).toHaveLength(0);});+ it('turning it off while the 分工 is read stops the handoff before the group is re-read', async () => {+ await serve(division(), { autoContinue: true }, undefined, () => { void service.updateGroup({ groupId: roomId, autoContinue: false }); });+ expect(continues()).toHaveLength(0);+ });it('does not offer the switch on a server that cannot tell a 分工 from a queue', async () => {workspaceSettings.set(roomId, { projectDir: null, plans: {}, autoContinue: true });const result = await service.getGroup(roomId);diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.tsindex 381e61972b..37194bbd6b 100644--- a/apps/desktop/src/main/maker-ipc/chatServer.ts+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts@@ -2685,6 +2685,8 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDconst i = z.object({ groupId: id, name: z.string().min(1).max(40).optional(), replyMode: z.enum(['all', 'mentioned']).optional(),speakingMode: z.enum(['auto', 'sequential']).optional(), organizerBotId: z.string().nullable().optional(), projectDir: z.string().max(4096).nullable().optional(), autoContinue: z.boolean().optional(), expectedRevision: z.number().int().positive().optional() }).parse(input);i.groupId = await resolveGroup(i.groupId);+ // Local only, so saved before any server read: a handoff deciding meanwhile must already see it.+ if (i.autoContinue !== undefined) workspaces().save(i.groupId, { projectDir: null, plans: {}, ...workspaces().read(i.groupId), autoContinue: i.autoContinue });if (i.organizerBotId) await register();const s = await groupSnapshot(i.groupId);let projectDir = i.projectDir;@@ -2693,7 +2695,6 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDif (i.name !== undefined || i.replyMode !== undefined || i.speakingMode !== undefined || organizerId !== undefined) await api(`/conversations/${i.groupId}`, 'PATCH', { operationId: randomUUID(), expectedRevision: i.expectedRevision ?? s.room.revision,name: i.name, responseMode: i.replyMode, speakingMode: i.speakingMode, organizerId }, managementActor(s));if (projectDir !== undefined) workspaces().save(i.groupId, { ...workspaces().read(i.groupId) ?? { plans: {} }, projectDir });- if (i.autoContinue !== undefined) workspaces().save(i.groupId, { projectDir: null, plans: {}, ...workspaces().read(i.groupId), autoContinue: i.autoContinue });changed(i.groupId);// Turned on while a step waits for 继续: go on now rather than at the next change.if (i.autoContinue) autoContinuePlans(i.groupId);diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botGroupMentions.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/botGroupMentions.test.tsindex ab29c85d79..6ff3a5c7b3 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/botGroupMentions.test.ts+++ b/apps/desktop/src/renderer/features/bots/__tests__/botGroupMentions.test.ts@@ -202,6 +202,9 @@ describe('splitBotGroupRelaySteps', () => {['a step without a task', '@阿布,@小满 实现'],['everyone', '@所有人 出方案,@小满 实现'],['no mention', '做一个登录页'],+ // A teammate renamed after being picked no longer reads as one: its step must not vanish.+ ['an @ that is no longer a teammate', '@Old 出方案,@小满 实现,@阿布 测一遍'],+ ['an @ inside a task', '@小满 实现,@Old 测一遍'],])('leaves %s to the organizer', (_label, text) => {expect(split(text)).toBeNull();});diff --git a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsxindex ff86cfe076..1db1add04d 100644--- a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx@@ -500,6 +500,13 @@ describe('group timeline', () => {expect(h.chat.act).toHaveBeenLastCalledWith('plan-edit', { planId: 'p1', position: 0, action: 'remove' });});+ // The computer's 自动交接 survives the phone's parse, so the card does not promise a 继续 that never comes.+ it.each([[true, 'groupChat.plan.autoNote'], [undefined, 'groupChat.plan.pauseNote']] as const)('says how steps hand on (autoContinue=%s)', async (autoContinue, note) => {+ const data = group();+ await render(parseBotGroupChatData({ ...data, plans: data.plans.map(plan => ({ ...plan, ...(autoContinue ? { autoContinue } : {}) })) })!);+ expect(byId('botGroup.message.plan')?.textContent).toContain(note);+ });+it.each([undefined, true, false])('renders human-signed plans as organizer cards with working actions and read-only old plans (isSelf=%s)', async (isSelf) => {const data = group();data.messages = data.messages.map(message => message.kind === 'plan'diff --git a/apps/mobile/src/i18n/locales/en/groupChat.json b/apps/mobile/src/i18n/locales/en/groupChat.jsonindex 133974157c..4ed30b4fa4 100644--- a/apps/mobile/src/i18n/locales/en/groupChat.json+++ b/apps/mobile/src/i18n/locales/en/groupChat.json@@ -113,6 +113,7 @@"start": "Start Plan","dismiss": "Skip Plan","editHint": "To change who does what, just say so",+ "autoNote": "Each finished step starts the next one automatically.","pauseNote": "Work pauses after each step until you click “Start Next Step”.","superseded": "Updated","dismissed": "Skipped",diff --git a/apps/mobile/src/i18n/locales/ja/groupChat.json b/apps/mobile/src/i18n/locales/ja/groupChat.jsonindex d29ad02f6c..490d90eb82 100644--- a/apps/mobile/src/i18n/locales/ja/groupChat.json+++ b/apps/mobile/src/i18n/locales/ja/groupChat.json@@ -113,6 +113,7 @@"start": "開始する","dismiss": "今回はやめる","editHint": "担当や手順を変えたいときは、そのまま話しかけてください",+ "autoNote": "ステップが終わると自動で次へ進みます。","pauseNote": "1 ステップ終わるごとに止まり、「次へ進む」を押すまで待ちます。","superseded": "更新済み","dismissed": "見送りました",diff --git a/apps/mobile/src/i18n/locales/ko/groupChat.json b/apps/mobile/src/i18n/locales/ko/groupChat.jsonindex a8e3bbb7a5..4724d1735a 100644--- a/apps/mobile/src/i18n/locales/ko/groupChat.json+++ b/apps/mobile/src/i18n/locales/ko/groupChat.json@@ -113,6 +113,7 @@"start": "시작하기","dismiss": "필요 없어요","editHint": "담당이나 단계를 바꾸려면 그냥 말해 주세요",+ "autoNote": "단계가 끝나면 자동으로 다음 단계가 시작됩니다.","pauseNote": "한 단계가 끝날 때마다 멈추고, ‘다음 단계 시작’을 누를 때까지 기다립니다.","superseded": "업데이트됨","dismissed": "사용 안 함",diff --git a/apps/mobile/src/i18n/locales/zh-CN/groupChat.json b/apps/mobile/src/i18n/locales/zh-CN/groupChat.jsonindex dc1f87240f..e28c5e40a4 100644--- a/apps/mobile/src/i18n/locales/zh-CN/groupChat.json+++ b/apps/mobile/src/i18n/locales/zh-CN/groupChat.json@@ -113,6 +113,7 @@"start": "开始","dismiss": "不用了","editHint": "想换人或改步骤,直接说",+ "autoNote": "做完一步会自动交给下一位。","pauseNote": "每做完一步会停下来,等你点「继续」。","superseded": "已更新","dismissed": "不用了",diff --git a/apps/mobile/src/i18n/locales/zh-TW/groupChat.json b/apps/mobile/src/i18n/locales/zh-TW/groupChat.jsonindex 4991fb7997..78aa706ad1 100644--- a/apps/mobile/src/i18n/locales/zh-TW/groupChat.json+++ b/apps/mobile/src/i18n/locales/zh-TW/groupChat.json@@ -113,6 +113,7 @@"start": "開始","dismiss": "不用了","editHint": "想換人或改步驟,直接說",+ "autoNote": "做完一步會自動交給下一位。","pauseNote": "每做完一步會停下來,等你點「繼續」。","superseded": "已更新","dismissed": "不用了",diff --git a/apps/mobile/src/session/BotGroupPlan.tsx b/apps/mobile/src/session/BotGroupPlan.tsxindex 1e2cce002d..bb60800edd 100644--- a/apps/mobile/src/session/BotGroupPlan.tsx+++ b/apps/mobile/src/session/BotGroupPlan.tsx@@ -211,7 +211,7 @@ export function BotGroupPlanCard({</View>{actionable ? <>{/* Two sentences: Chinese and Japanese run them together, other languages need a space. */}- <Text style={styles.note}>{[t('groupChat.plan.pauseNote'), t('groupChat.plan.editHint')].join(/^(zh|ja)/.test(i18n.language) ? '' : ' ')}</Text>+ <Text style={styles.note}>{[t(plan.autoContinue ? 'groupChat.plan.autoNote' : 'groupChat.plan.pauseNote'), t('groupChat.plan.editHint')].join(/^(zh|ja)/.test(i18n.language) ? '' : ' ')}</Text><CompanionCardActions><CompanionCardButton label={t('groupChat.plan.dismiss')} busy={pending === 'dismiss'} disabled={busy || !online}onPress={onDismiss} testID="botGroup.plan.dismiss" />diff --git a/apps/mobile/src/session/botGroupRemote.ts b/apps/mobile/src/session/botGroupRemote.tsindex 3e4222855a..70f3da679f 100644--- a/apps/mobile/src/session/botGroupRemote.ts+++ b/apps/mobile/src/session/botGroupRemote.ts@@ -273,6 +273,8 @@ function parsePlan(value: unknown): BotGroupPlanView | null {status,kind: record.kind === 'talk' || record.kind === 'work' ? record.kind : undefined,canAdd: typeof record.canAdd === 'boolean' ? record.canAdd : undefined,+ // The computer's 自动交接 for a 分工 it started; changed only there.+ autoContinue: typeof record.autoContinue === 'boolean' ? record.autoContinue : undefined,organizerBotId: id(record.organizerBotId) ?? '',organizerName: text(record.organizerName, MAX_NAME) ?? '',steps: steps as BotGroupPlanStepView[],diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 76eff9e359..f54a105f61 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -306,8 +306,8 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下- **写好了步骤就照写的建卡并直接开始**,不调辅助模型:每个 @ 后面写这位伙伴做什么,后一位从新的一行或标点之后开始(「登录页:@A 出方案,然后 @B 按方案实现;@C 测一遍」)。第一个 @ 前的话是共同背景;「然后、接着、最后、再」这类引出下一步的连接词不算进任何一步(最后一步照原话保留);同一位伙伴相邻的几步合成一步;最多 6 步,每步任务最多 200 字(服务端上限)。- @ 夹在句子里(「@A 和 @B 一起做」)、某个 @ 后面没写活、@所有人、重名分不清、点到不能派活的伙伴,或点选的伙伴在- 文字里认不出(发出前改了名)时,不当作写好的步骤。+ @ 夹在句子里(「@A 和 @B 一起做」)、某个 @ 后面没写活、@所有人、重名分不清、点到不能派活的伙伴,或文字里有认不出的 @+ (点选后伙伴改了名)时,不当作写好的步骤。解析在 `@cindy/maker-shared/botGroupMentions` 的 `splitBotGroupRelaySteps`。- **没写成步骤就交给负责人**出安排卡(「开始 / 不用了」),沿用 7.2 手动分工的流程与每候选 20 秒的预算;开始前不 @ 人说话仍是修改意见(7.3;回复模式为「只有被 @ 的回答」时不算,照 4.0 不叫任何人)。安排不出来、或负责人认为不用分工时,这条请求立即按 4.0 回答(点名的依次答,@@ -377,7 +377,7 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下- 自动交接(服务器群,可选,默认关):群设置「分工交接」与安排卡底的开关是同一个设置,开着时**在这台电脑发起的**分工做完一步就由这台电脑像点「继续」一样交给下一位,不出现「继续」那一行。设置只存在本机(与项目文件夹相同,不同步到别的电脑或手机),别人发起的分工不受影响;同一账号在另一台电脑发起的分工也不受影响(本机记下在这里建的卡,最近 50 张)。- 读取安排期间关掉开关,这次交接取消。这一步没做完(等「重试」)、分工已停止或最后一步做完时照常停下;等继续时打开+ 读取安排期间关掉开关,这次交接取消。手机经电脑看到的安排卡按电脑的开关写「做完一步会自动交给下一位」,开关只能在电脑上改。这一步没做完(等「重试」)、分工已停止或最后一步做完时照常停下;等继续时打开开关立即交给下一位。交接以安排的版本号为准,别人先点了「继续」或改了安排,这次自动交接放弃,不会让一步做两次。这台电脑离线时不会自动交接,分工停在「继续」,有权限的人仍可手动继续;电脑重新连上、打开群之前就已做完的一步也会接着交出去。只在一次一位伙伴的服务器群(`groupSingleSpeaker`)提供这个开关,旧服务器分不清分工与讨论队列。diff --git a/packages/maker-shared/src/botGroupMentions.ts b/packages/maker-shared/src/botGroupMentions.tsindex bcaccbd9e6..bfa79d96b5 100644--- a/packages/maker-shared/src/botGroupMentions.ts+++ b/packages/maker-shared/src/botGroupMentions.ts@@ -168,6 +168,8 @@ export function splitBotGroupRelaySteps(): BotGroupRelayStep[] | null {const tokens = scanMentionTokens(text, buildLabelEntries(input.members, input.allLabels, []));if (!tokens.length) return null;+ // An @ that is not a teammate (renamed since it was picked) would drop or garble a step.+ if (/@\S/.test(text.slice(0, tokens[0]!.start))) return null;const steps: BotGroupRelayStep[] = [];for (const [index, token] of tokens.entries()) {if (token.entry.all || token.entry.botIds.length !== 1) return null;@@ -175,7 +177,7 @@ export function splitBotGroupRelaySteps(// A connector only leads into the next step; the last step keeps its words.const span = text.slice(token.end, tokens[index + 1]?.start ?? text.length);const task = (index + 1 < tokens.length ? span.replace(STEP_CONNECTOR, '') : span).replace(STEP_EDGE, '');- if (!task) return null;+ if (!task || /@\S/.test(task)) return null;steps.push({ botId: token.entry.botIds[0]!, task });}return steps;