Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(chat): keep held 分工 requests and auto handoff where they belong
Chrisc5a6ff7ae64a
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 9925f1adea..b3657874db 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -183,10 +183,11 @@ describe('Chat Server result delivery and refresh', () => {changes: [{ type: 'execution.updated', entityId: execution.id }] }));await vi.advanceTimersByTimeAsync(0);};- async function serve(plan: Record<string, unknown>, settings: { autoContinue?: boolean } | null, onContinue?: () => { status: number; body: unknown }) {- if (settings) workspaceSettings.set(roomId, { projectDir: null, plans: {}, ...settings });+ async function serve(plan: Record<string, unknown>, settings: { autoContinue?: boolean; startedHere?: string[] } | null,+ onContinue?: () => { status: number; body: unknown }, onRead?: () => void) {+ if (settings) workspaceSettings.set(roomId, { projectDir: null, plans: {}, startedHere: [planId], ...settings });fixture.handle.mockImplementation((route, method) => route === `/conversations/${roomId}/plans/${planId}` && method === 'POST'- ? onContinue?.() ?? { body: {} } : route.startsWith(`/conversations/${roomId}/plans`) ? { body: [plan] } : response(route));+ ? onContinue?.() ?? { body: {} } : route.startsWith(`/conversations/${roomId}/plans`) ? (onRead?.(), { body: [plan] }) : response(route));await service.getGroup(roomId);await vi.advanceTimersByTimeAsync(2000);}@@ -204,6 +205,8 @@ describe('Chat Server result delivery and refresh', () => {['nothing was chosen on this computer', division(), null],['the step failed and waits for 重试', division({}, 'failed'), { autoContinue: true }],['someone else started the 分工', division({ creator_id: otherHuman }), { autoContinue: true }],+ // The account is the creator on each of its computers: another one of them asked for this 分工.+ ['it was asked for on another computer', division(), { autoContinue: true, startedHere: [] }],['it is a discussion queue, not a 分工', division({ kind: 'talk' }), { autoContinue: true }],['the 分工 was stopped', division({ status: 'stopped' }), { autoContinue: true }],['the last step is done', division({ current_step: 1, status: 'waiting', steps: [@@ -214,7 +217,7 @@ describe('Chat Server result delivery and refresh', () => {expect(continues()).toHaveLength(0);});it('turning it on while a step waits goes on now, and shows the choice on the group and its 分工 card', async () => {- await serve(division(), null);+ await serve(division(), { autoContinue: false });const before = await service.getGroup(roomId);expect(before.ok && [before.group.autoContinue, before.group.plans[0]?.autoContinue]).toEqual([false, false]);expect(await service.updateGroup({ groupId: roomId, autoContinue: true })).toEqual({ ok: true });@@ -224,6 +227,14 @@ describe('Chat Server result delivery and refresh', () => {const after = await service.getGroup(roomId);expect(after.ok && [after.group.autoContinue, after.group.plans[0]?.autoContinue]).toEqual([true, true]);});+ it('does not go on when the switch is turned off while the 分工 is read', async () => {+ let reads = 0;+ await serve(division(), { autoContinue: true }, undefined, () => {+ if (++reads > 1) workspaceSettings.set(roomId, { ...workspaceSettings.get(roomId) as object, autoContinue: false });+ });+ await stepEnded('2');+ expect(continues()).toHaveLength(0);+ });it('does not try again after someone else went on first', async () => {await serve(division(), { autoContinue: true }, () => ({ status: 409, body: { error: { code: 'REVISION_CONFLICT' } } }));await stepEnded('2');@@ -1683,6 +1694,32 @@ describe('Chat Server result delivery and refresh', () => {expect(deliveries()[0][2]).not.toHaveProperty('continueDiscussion');});+ // A queue turn builds on the answer just before it (a 分工 hand-off's 2000 characters); older+ // answers get a main-group message's 600, so a long queue does not resend every answer in full.+ it('shortens the earlier answers a queue turn reads', async () => {+ const planId = '80000000-0000-4000-8000-000000000003';+ const ids = ['50000000-0000-4000-8000-000000000041', '50000000-0000-4000-8000-000000000042', '50000000-0000-4000-8000-000000000043'];+ const texts = ['a'.repeat(601), 'b'.repeat(600), 'c'.repeat(2001)];+ const plan = { id: planId, revision: 1, source_message_id: execution.source_message_id, request_text: 'Q', organizer_id: otherBot, creator_id: selfId,+ note_message_ids: [], status: 'running', current_step: 3, kind: 'talk', created_at: '2026-10-03T00:00:00Z', updated_at: '2026-10-03T00:00:00Z',+ steps: [...ids.map((resultMessageId, position) => ({ position, botId: otherBot, botName: 'Peer', task: '', status: 'done', resultMessageId })),+ { position: 3, botId, botName: 'Bot', task: '', status: 'running' }] };+ singleSpeaker(route => {+ if (route === '/executions/claim' && !claimed) { claimed = true; return { body: { execution: { ...execution, access_mode: 'owner', plan_id: planId, plan_step: 3 } } }; }+ if (route.includes('/plans?ids=')) return { body: [plan] };+ if (route.includes('/messages?all=true')) return { body: ids.map((id, index) => message(id, texts[index]!, { authorId: otherBot, author: { kind: 'bot', name: 'Peer' }, origin: 'bot' })) };+ if (route.endsWith(`/messages/${execution.source_message_id}`)) return { body: message(execution.source_message_id, 'Q') };+ return undefined;+ });+ await start();+ const block = prompt().split('<untrusted-data>\n').map(part => part.split('\n</untrusted-data>')[0]!).find(part => part.includes('earlierAnswers'))!;+ expect(JSON.parse(block).earlierAnswers).toEqual([+ { from: 'Peer', text: `${'a'.repeat(600)}…`, shortened: true },+ { from: 'Peer', text: 'b'.repeat(600) },+ { from: 'Peer', text: `${'c'.repeat(2000)}…`, shortened: true },+ ]);+ });+// bot-group-chat.md §7.0 (2026-10-23): 「安排分工」 is back on these servers. A request that writes// out who does what becomes that card and starts, with no helper model; otherwise the organizer// arranges it. The request is held so the server's own queue does not answer it first.@@ -1714,6 +1751,29 @@ describe('Chat Server result delivery and refresh', () => {steps: [{ botId, task: '出方案' }, { botId: otherBot, task: '按方案实现' }] });expect(posts().find(([route]) => route === `/conversations/${roomId}/plans/${planId}`)![2]).toMatchObject({ action: 'start', expectedRevision: 1 });expect(deps.decidePlan).not.toHaveBeenCalled();+ // Only a 分工 asked for here follows this computer's 自动交接.+ expect(workspaceSettings.get(roomId)).toMatchObject({ startedHere: [planId] });+ });++ it('lets the organizer arrange it when a picked teammate no longer reads in the text', async () => {+ divisionServer();+ deps.decidePlan = vi.fn(async () => ({ needsPlan: true as const, steps: [{ botId, task: 'design' }, { botId: otherBot, task: 'build' }] }));+ // Bot was picked as @OldName and renamed before sending: its step must not be dropped.+ expect(await service.sendMessage({ groupId: roomId, text: '@OldName 出方案,然后 @Nova (Owner) 按方案实现', clientId: 'division-renamed',+ mentions: { all: false, botIds: [botId, otherBot] }, division: true })).toMatchObject({ ok: true });+ await vi.advanceTimersByTimeAsync(0);+ expect(deps.decidePlan).toHaveBeenCalled();+ expect(posts().some(([route]) => route === `/conversations/${roomId}/plans/${planId}`)).toBe(false);+ });++ // The server cannot release a held request, so a newer message must not replace one still being arranged.+ it('refuses a newer message while the organizer is arranging', async () => {+ divisionServer();+ deps.decidePlan = vi.fn(() => new Promise<never>(() => {}));+ await send('Make a draft');+ expect(await service.sendMessage({ groupId: roomId, text: 'Another thing', clientId: 'after-division', mentions: { all: false, botIds: [] } }))+ .toMatchObject({ ok: false, errorCode: 'PLAN_OPEN' });+ expect(posts().filter(([route]) => route === `/conversations/${roomId}/messages`)).toHaveLength(1);});it('asks the organizer when the steps are not written out', async () => {diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.tsindex 4f72a92871..271f01188b 100644--- a/apps/desktop/src/main/maker-ipc/chatServer.ts+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts@@ -1318,7 +1318,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDconst lastView = last ? messageView(last, s.members) : null;// The sidebar never resolves shares: it names the sharer and never quotes the card's text.const lastIsShare = !!last && !!readBotGroupThreadShareCard(last);- return { serverBacked: true, reactionRevision: reactionRevisions.get(roomId)?.room ?? runtimeReactionRevision, reactionRevisions: { ...reactionRevisions.get(roomId)?.messages }, supportsGroupLeave: true, supportsDissolve, supportsListRemoval, supportsMemberAvatar, dissolvedAt: s.room.dissolved_at ?? null, migrationPending: [...upgradeErrors.keys()].some(source => upgradedGroups.get(source) === roomId), archived: s.room.archived, selfActorId: selfId, topic: s.room.topic, description: s.room.description, revision: s.room.revision, canInvite: !s.room.dissolved_at && s.members.some(m => m.ownerActorId === selfId && m.state === 'joined' && ['owner', 'admin'].includes(m.role)), canStopAll: singleSpeaker && !!managementActor(s), ...(singleSpeaker ? { singleSpeaker: true } : {}), id: s.room.id, name: s.room.name, replyMode: s.room.response_mode, speakingMode: s.room.speaking_mode,+ return { serverBacked: true, reactionRevision: reactionRevisions.get(roomId)?.room ?? runtimeReactionRevision, reactionRevisions: { ...reactionRevisions.get(roomId)?.messages }, supportsGroupLeave: true, supportsDissolve, supportsListRemoval, supportsMemberAvatar, dissolvedAt: s.room.dissolved_at ?? null, migrationPending: [...upgradeErrors.keys()].some(source => upgradedGroups.get(source) === roomId), archived: s.room.archived, selfActorId: selfId, topic: s.room.topic, description: s.room.description, revision: s.room.revision, canInvite: !s.room.dissolved_at && s.members.some(m => m.ownerActorId === selfId && m.state === 'joined' && ['owner', 'admin'].includes(m.role)), canStopAll: singleSpeaker && !!managementActor(s), ...(singleSpeaker ? { singleSpeaker: true, supportsDivision: true } : {}), id: s.room.id, name: s.room.name, replyMode: s.room.response_mode, speakingMode: s.room.speaking_mode,members: s.members.filter(m => m.state === 'joined').map(m => {const p = localBot(m.id);return { botId: p?.id ?? m.id, actorId: m.id, actorKind: m.kind, isSelf: m.id === selfId,@@ -1353,7 +1353,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD// Same rule as sendMessage's commentPlan: additions are written as the human, so a teammate's role does not count.canAdd: plan.creator_id === selfId || members.some(m => m.id === selfId && ['owner', 'admin'].includes(m.role)) } : {}),// Only a 分工 started here follows this computer's choice; its 继续 is pressed from here.- ...(plan.kind === 'work' && plan.creator_id === selfId ? { autoContinue: workspace?.autoContinue === true } : {}),+ ...(startedHere(plan, workspace) ? { autoContinue: workspace?.autoContinue === true } : {}),createdAt: Date.parse(plan.created_at), updatedAt: Date.parse(plan.updated_at) };}async function actPlan(input: unknown, action: string) {@@ -1380,6 +1380,17 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD* The expected revision keeps a concurrent 继续 or edit from starting a step twice.*/const autoContinueRuns = new Map<string, boolean>();+ /**+ * The account is the creator on each of its computers, so the card remembers where it was+ * asked for (a phone through this computer counts as here).+ */+ function startedHere(plan: ServerPlan, workspace: ReturnType<ReturnType<typeof chatServerWorkspaces>['read']>) {+ return plan.kind === 'work' && plan.creator_id === selfId && workspace?.startedHere?.includes(plan.id) === true;+ }+ function markStartedHere(roomId: string, planId: string) {+ const settings = workspaces().read(roomId) ?? { projectDir: null, plans: {} };+ workspaces().save(roomId, { ...settings, startedHere: [...(settings.startedHere ?? []).filter(known => known !== planId), planId].slice(-50) });+ }const autoContinued = new Set<string>();function autoContinuePlans(roomId: string) {if (!current()) return;@@ -1390,15 +1401,18 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDautoContinueRuns.set(roomId, false);if (!workspaces().read(roomId)?.autoContinue) return;const plans = await api<ServerPlan[]>(`/conversations/${roomId}/plans`);+ const workspace = workspaces().read(roomId);for (const plan of plans) {const at = plan.current_step ?? 0;- if (plan.kind !== 'work' || plan.creator_id !== selfId || plan.status !== 'waiting'+ if (!startedHere(plan, workspace) || plan.status !== 'waiting'|| plan.steps[at]?.status !== 'done' || at + 1 >= plan.steps.length) continue;const key = `${plan.id}:${at}`;if (autoContinued.has(key)) continue;autoContinued.add(key);if (autoContinued.size > 1000) autoContinued.delete(autoContinued.values().next().value!);try {+ // The switch may have been turned off while the plans were read; the revision cannot tell.+ if (!workspaces().read(roomId)?.autoContinue) { autoContinued.delete(key); return; }await api(`/conversations/${roomId}/plans/${plan.id}`, 'POST', { operationId: randomUUID(), expectedRevision: plan.revision, action: 'continue' });changed(roomId);} catch (error) {@@ -1436,8 +1450,8 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD...(quote ? { requestQuote: { from: quote.authorName, text: quote.excerpt, ...quoteAttachments(quote.attachmentCount, quote.attachmentName) } } : {}) }, controller.signal);const request = planRequest(text, quote);if (!current() || controller.signal.aborted || planIntents.get(s.room.id) !== intent) return;- if (decision?.needsPlan) await api(`/conversations/${s.room.id}/plans`, 'POST', {- operationId: `plan:${sourceId}`, sourceMessageId: sourceId, organizerId: organizer.id, request, steps: decision.steps });+ if (decision?.needsPlan) markStartedHere(s.room.id, (await api<ServerPlan>(`/conversations/${s.room.id}/plans`, 'POST', {+ operationId: `plan:${sourceId}`, sourceMessageId: sourceId, organizerId: organizer.id, request, steps: decision.steps })).id);else if (explicit) await settleExplicitRequest(s.room.id, sourceId, forced && !proposed);else await api(`/conversations/${s.room.id}/messages/${sourceId}/continue`, 'POST', { operationId: `discuss:${sourceId}`, ...(groupDiscussionParity ? { automatic: true } : {}) });} catch (error) {@@ -1465,10 +1479,13 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDif (answer) await api(`/conversations/${roomId}/messages/${sourceId}/continue`, 'POST', { operationId: `discuss:${sourceId}` });}/** Steps a 分工 request wrote out (§7.0), as teammates this account may give work to. */- function writtenPlanSteps(s: Snapshot, text: string): PlanStepDraft[] | null {+ function writtenPlanSteps(s: Snapshot, text: string, picked: string[]): PlanStepDraft[] | null {const bots = s.members.filter(m => m.kind === 'bot' && m.state === 'joined');const written = splitBotGroupRelaySteps(text, { allLabels: [],members: bots.map(m => ({ botId: m.id, name: memberName(m), displayName: m.name, nickname: m.nickname })) });+ // A picked teammate whose name no longer reads in the text (renamed meanwhile) would silently+ // drop its step: let the organizer arrange it instead.+ if (written && !picked.every(target => written.some(step => step.botId === target || localBot(step.botId)?.id === target))) return null;// A step for a teammate you may not give work to goes to the organizer, not into a neighbour's task.const assignable = (botId: string) => bots.some(m => m.id === botId && (m.ownerActorId === selfId || m.guestAccess !== 'none')&& (!localBot(m.id) || localBot(m.id)?.status === 'active'));@@ -1484,6 +1501,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDtry {plan = await api<ServerPlan>(`/conversations/${s.room.id}/plans`, 'POST', {operationId: `plan:${sourceId}`, sourceMessageId: sourceId, organizerId, request, steps });+ markStartedHere(s.room.id, plan.id);} catch (error) {await settleExplicitRequest(s.room.id, sourceId, true);throw error;@@ -2486,6 +2504,9 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDquote: z.object({ messageId: id }).strict().optional() }).parse(input);i.groupId = await resolveGroup(i.groupId);if (!i.text.trim() && !i.attachments?.length) throw new Error('INVALID_INPUT');+ // A single-speaker server cannot release a held request (no cancel-planning): a newer message+ // replacing a 分工 still being arranged would leave it to be queued two minutes later. Wait for its card.+ if (singleSpeaker && planIntents.get(i.groupId)?.sourceId) throw new Error('PLAN_OPEN');// An attempted send must not cancel a valid decision until its message exists.const intentVersion = ++nextIntentVersion;// The reads a send needs share one round trip (none for a snapshot the live subscription@@ -2579,7 +2600,7 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDif (settleQueue) await api(`/conversations/${roomId}/plans/${settleQueue.id}`, 'POST', {operationId: `settle:${settleQueue.id}:${messageId}`, expectedRevision: settleQueue.revision, action: 'stop' }).catch(error => deps.log?.warn('Waiting queue could not be ended', { groupId: roomId, ...chatErrorDiagnostic(error) }));- const written = singleSpeaker && i.division && !i.mentions.all ? writtenPlanSteps(s, i.text) : null;+ const written = singleSpeaker && i.division && !i.mentions.all ? writtenPlanSteps(s, i.text, i.mentions.botIds) : null;if (written) await openWrittenPlan(s, messageId, planRequest(i.text, quote), written, intent);else await decideArrangement(s, messageId, i.text, i.division === true, prepared?.ok ? prepared.attachments : [], intent, quote);};diff --git a/apps/desktop/src/main/maker-ipc/chatServerWorkspaces.ts b/apps/desktop/src/main/maker-ipc/chatServerWorkspaces.tsindex 93e370cf8a..4be00a5418 100644--- a/apps/desktop/src/main/maker-ipc/chatServerWorkspaces.ts+++ b/apps/desktop/src/main/maker-ipc/chatServerWorkspaces.ts@@ -6,8 +6,9 @@ import { z } from 'zod';import { ownerScopedUserDataPath } from '../appSessionState.js';import { atomicWriteFileSync, readAtomicFileSync } from '../utils/atomicWriteFile.js';const workspace = z.object({ workDir: z.string(), branch: z.string().nullable(), ownerSessionId: z.string().nullable() });-// autoContinue: 分工 started here go on to the next step by themselves (bot-group-chat.md §7.4).-const record = z.object({ projectDir: z.string().nullable(), plans: z.record(z.string(), workspace), autoContinue: z.boolean().optional() });+// autoContinue: 分工 started here (startedHere, the latest 50) go on to the next step by themselves (bot-group-chat.md §7.4).+const record = z.object({ projectDir: z.string().nullable(), plans: z.record(z.string(), workspace), autoContinue: z.boolean().optional(),+ startedHere: z.array(z.string()).max(50).optional() });export function chatServerWorkspaces(endpoint: string, actorId: string, current: () => boolean) {const root = ownerScopedUserDataPath('chat-workspace-settings', createHash('sha256').update(`${endpoint}\n${actorId}`).digest('hex'));const file = (room: string) => path.join(root, `${z.string().uuid().parse(room)}.json`);diff --git a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsxindex 5e09fd9b20..ff86cfe076 100644--- a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx@@ -741,10 +741,12 @@ describe('group composer', () => {});// bot-group-chat.md §7.0 (2026-10-23): the computer arranges a 分工 in single-speaker rooms too,- // so a phone working through it keeps 安排分工; a phone talking to the server directly does not (component tier).- it.each([[true, false, true], [false, false, true], [true, true, false]])('offers 安排分工 (singleSpeaker=%s, direct=%s)', async (singleSpeaker, direct, offered) => {+ // so a phone working through it keeps 安排分工; a phone talking to the server directly does not, nor one+ // whose older computer would answer the request as a queue (no supportsDivision) (component tier).+ it.each([[true, true, false, true], [true, false, false, false], [false, false, false, true], [true, true, true, false]])(+ 'offers 安排分工 (singleSpeaker=%s, supportsDivision=%s, direct=%s)', async (singleSpeaker, supportsDivision, direct, offered) => {h.chat.server = direct;- await render(parseBotGroupChatData(group({ serverBacked: true, singleSpeaker, replyMode: 'mentioned', openPlan: null }))!);+ await render(parseBotGroupChatData(group({ serverBacked: true, singleSpeaker, ...(supportsDivision ? { supportsDivision } : {}), replyMode: 'mentioned', openPlan: null }))!);expect(!!byId('botGroup.composer.menu.action.division')).toBe(offered);});diff --git a/apps/mobile/src/session/BotGroupChatScreen.tsx b/apps/mobile/src/session/BotGroupChatScreen.tsxindex 1ffdaf2551..37f845679c 100644--- a/apps/mobile/src/session/BotGroupChatScreen.tsx+++ b/apps/mobile/src/session/BotGroupChatScreen.tsx@@ -372,7 +372,7 @@ export function BotGroupChatScreen({ deviceId, deviceName, groupId }: { deviceId</ScrollView><BotGroupComposer members={group.members} identityFor={identityFor} deviceId={deviceId} online={chat.online && !group.archived && !group.dissolvedAt}running={group.round.status === 'running'} planState={botGroupComposerPlanState(openBotGroupPlan(group), group.replyMode)}- divisionSupported={!chat.server} attachmentsSupported={group.supportsAttachments === true} onSend={send} onStop={stop} />+ divisionSupported={!chat.server && (!group.singleSpeaker || group.supportsDivision === true)} attachmentsSupported={group.supportsAttachments === true} onSend={send} onStop={stop} /></KeyboardAvoidingView>;}diff --git a/apps/mobile/src/session/botGroupRemote.ts b/apps/mobile/src/session/botGroupRemote.tsindex 19e4352557..3e4222855a 100644--- a/apps/mobile/src/session/botGroupRemote.ts+++ b/apps/mobile/src/session/botGroupRemote.ts@@ -365,6 +365,7 @@ export function parseBotGroupChatData(value: unknown): BotGroupRemoteChatData |name,serverBacked: record.serverBacked === true,singleSpeaker: record.singleSpeaker === true,+ supportsDivision: record.supportsDivision === true,archived: record.archived === true,dissolvedAt: text(record.dissolvedAt, 64),supportsDissolve: record.supportsDissolve === true,diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.mdindex 321f16dcda..bf28b8d0c0 100644--- a/docs/dev-rules/protocol-compatibility.md+++ b/docs/dev-rules/protocol-compatibility.md@@ -2681,7 +2681,9 @@ Chat Server `/me` 追加 `capabilities.groupSingleSpeaker: 1`,服务端派发主群消息带 `deferExecution: true` 挂起;请求写好步骤时 `POST /plans`(`kind` 缺省为 `work`)后立即`action: start`,否则负责人出卡;没有卡时 `POST /messages/:id/continue` 立即回答(该服务端没有 `cancel-planning`,不处理会在两分钟后被排成讨论队列)。本人等继续的 `talk` 队列先 `action: stop` 再建卡,否则服务端返回 `PLAN_OPEN`。-手机经电脑发起分工走同一路径;手机直连服务器不提供「安排分工」。+手机经电脑发起分工走同一路径;手机直连服务器不提供「安排分工」。Chat Server wire 不变;电脑给手机的群投影追加可选+`supportsDivision: true`(仅 `singleSpeaker` 群),手机只在看到它时于该类群显示「安排分工」——更早的电脑会把分工请求+当普通排队消息处理,缺字段即不显示。停止的范围收窄与主群上下文精简都只在看到该能力时启用,旧服务器保留整轮停止与完整主群历史;收窄只在执行端实现(成员只停自己的请求与伙伴,群主或管理员——含本账号拥有的管理员伙伴——可 `all`),沿用既有 control /plan action 的服务端权限,IPC `bot-group:stop` 追加可选 `scope`;手机经电脑的远程动作不变(停止为本人范围)。发布顺序:服务端整集群先上,再发客户端。diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 3f30b8fe2f..fd131c8953 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -306,13 +306,17 @@ 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 回答(点名的依次答,否则第一位伙伴答),不让它干等服务端两分钟后再排队。- 发出前宿主让消息先挂起,服务端不会先拿它去排讨论队列;建卡后挂起解除。你自己的讨论队列停着等「继续」时,先把它结束再建分工卡;还有别人的卡或正在进行的卡时拒绝(`PLAN_OPEN`),与旧版一致。+- 负责人还在出安排卡时,这台电脑(含经它的手机)拒绝再发新消息(`PLAN_OPEN`),等卡出来再说:该服务端无法撤销挂起,+ 新消息顶掉这次安排会让原请求两分钟后被排成讨论队列。已知遗留:安排中途点停止或操作别的卡仍会留下挂起,需服务端+ 恢复 `cancel-planning` 后才能根治。- 执行、返工、换人、重试、停止与工作目录沿用 7.3–7.5:每一步在这位伙伴自己的分工 Session 里做,保留它自己的技能、记忆、工具与模型;做完一步停下等「继续」;等继续时不 @ 人说话就是让刚做完的伙伴返工(输入框写「想让 X 改改,直接说…」;「只有被 @ 的回答」的群里不适用,见 4.0)。- 负责人与项目文件夹回到群设置;负责人只在请求没写步骤时排分工,群头像行仍不标「负责人」。@@ -372,7 +376,8 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下- 做完停下:时间线出现「下一步:谁 做什么 · 继续」;最后一步做完出现「N 步都做完了」,安排结束。- 自动交接(服务器群,可选,默认关):群设置「分工交接」与安排卡底的开关是同一个设置,开着时**在这台电脑发起的**分工做完一步就由这台电脑像点「继续」一样交给下一位,不出现「继续」那一行。设置只存在本机(与项目文件夹相同,不同步到别的- 电脑或手机),别人发起的分工不受影响。这一步没做完(等「重试」)、分工已停止或最后一步做完时照常停下;等继续时打开+ 电脑或手机),别人发起的分工不受影响;同一账号在另一台电脑发起的分工也不受影响(本机记下在这里建的卡,最近 50 张)。+ 读取安排期间关掉开关,这次交接取消。这一步没做完(等「重试」)、分工已停止或最后一步做完时照常停下;等继续时打开开关立即交给下一位。交接以安排的版本号为准,别人先点了「继续」或改了安排,这次自动交接放弃,不会让一步做两次。这台电脑离线时不会自动交接,分工停在「继续」,有权限的人仍可手动继续。- 等「继续」时用户不 @ 任何伙伴直接说话 = 让刚做完的伙伴按意见返工,返工完成后再出现「继续」。diff --git a/packages/maker-shared/src/botGroupChat.ts b/packages/maker-shared/src/botGroupChat.tsindex 6623876c9a..72e8c5833a 100644--- a/packages/maker-shared/src/botGroupChat.ts+++ b/packages/maker-shared/src/botGroupChat.ts@@ -459,9 +459,11 @@ export interface BotGroupSummary {canStopAll?: boolean;/*** Server groups whose server gives each request one teammate (the lead when nobody is named)- * and arranges turns itself; no reply/speaking modes and no 安排分工 entry (bot-group-chat.md §4).+ * and arranges turns itself; no speaking modes (bot-group-chat.md §4).*/singleSpeaker?: boolean;+ /** A single-speaker group whose computer arranges 「安排分工」 (older computers answered it as a queue). */+ supportsDivision?: boolean;selfActorId?: string;topic?: string;description?: string;