Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): promise queue additions and stop scopes only where they apply
zqchrisf452fb7e7192
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 02f8eff92b..9a575d6719 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -1533,6 +1533,12 @@ describe('Chat Server result delivery and refresh', () => {// Without the capability the server still runs rounds: Stop ends the whole round and replies read the full main group.const olderServer = (extra: (route: string) => unknown = () => undefined) =>singleSpeaker(route => route === '/me' ? { body: { actor: { id: selfId } } } : extra(route));+ it.each([['single-speaker', true], ['older', false]] as const)('offers an owner the stop-scope choice only on a %s server', async (_label, offered) => {+ if (offered) singleSpeaker(undefined, 'owner'); else singleSpeaker(route => route === '/me' ? { body: { actor: { id: selfId } } } : undefined, 'owner');+ await vi.advanceTimersByTimeAsync(0);+ const result = await service.getGroup(roomId);+ expect(result.ok && !!result.group.canStopAll).toBe(offered);+ });it('keeps the whole-round stop on an older server', async () => {olderServer(route => route === `/conversations/${roomId}/executions` ? { body: [{ ...execution, id: '40000000-0000-4000-8000-00000000000a', status: 'queued', bot_id: foreignBot, requester_id: selfId },diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.tsindex 7b1c2abb32..e01c91dda6 100644--- a/apps/desktop/src/main/maker-ipc/chatServer.ts+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts@@ -1285,7 +1285,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, 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: !!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, 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,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,@@ -1316,7 +1316,9 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceDsteps: plan.steps.map(s => ({ ...s, botId: localBot(s.botId)?.id ?? s.botId })), currentStep: plan.current_step,workDir: workspace?.plans[plan.id]?.workDir ?? null, branch: workspace?.plans[plan.id]?.branch ?? null,...(plan.kind ? { kind: plan.kind,- canManage: plan.creator_id === selfId || members.some(m => m.ownerActorId === selfId && m.state === 'joined' && ['owner', 'admin'].includes(m.role)) } : {}),+ canManage: plan.creator_id === selfId || members.some(m => m.ownerActorId === selfId && m.state === 'joined' && ['owner', 'admin'].includes(m.role)),+ // 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)) } : {}),createdAt: Date.parse(plan.created_at), updatedAt: Date.parse(plan.updated_at) };}async function actPlan(input: unknown, action: string) {diff --git a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts b/packages/maker-shared/src/__tests__/botGroupPresentation.test.tsindex e2062553e2..c6168638a0 100644--- a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts+++ b/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts@@ -136,4 +136,13 @@ describe('plan follow-up and composer state', () => {expect(isBotGroupDivisionBlocked(botGroupComposerPlanState(plan({ status: 'proposed' })))).toBe(false);expect(botGroupComposerPlanState(plan())).toEqual({ kind: 'waiting', botName: 'A', stepDone: true });});++ // bot-group-chat.md §4.0: only words that will reach the speaking teammate are promised to it.+ it.each([+ ['who may add to it', 'running', true, { kind: 'running', botName: 'A', talk: true }],+ ['who cannot add to it', 'running', false, null],+ ['waiting for 继续', 'waiting', true, null],+ ] as const)('gives a queue %s the matching composer state', (_label, status, canAdd, expected) => {+ expect(botGroupComposerPlanState(plan({ kind: 'talk', status, canAdd }))).toEqual(expected);+ });});diff --git a/packages/maker-shared/src/botGroupChat.ts b/packages/maker-shared/src/botGroupChat.tsindex af710d345c..2061bf1bec 100644--- a/packages/maker-shared/src/botGroupChat.ts+++ b/packages/maker-shared/src/botGroupChat.ts@@ -379,6 +379,8 @@ export interface BotGroupPlanView {kind?: 'talk' | 'work';/** Server groups: the viewer may continue or stop it (creator, owner or admin). */canManage?: boolean;+ /** Server groups: what the viewer sends without naming anyone goes to the step under way (creator, or a human owner/admin). */+ canAdd?: boolean;createdAt: number;updatedAt: number;}diff --git a/packages/maker-shared/src/botGroupPresentation.ts b/packages/maker-shared/src/botGroupPresentation.tsindex 9fc71be786..78001e3e94 100644--- a/packages/maker-shared/src/botGroupPresentation.ts+++ b/packages/maker-shared/src/botGroupPresentation.ts@@ -226,7 +226,9 @@ export function botGroupComposerPlanState(plan: BotGroupPlanView | null): BotGroif (plan.status === 'proposed') return { kind: 'proposed' };const current = currentBotGroupPlanStep(plan);const botName = current?.botName.trim() ?? '';- if (plan.status === 'running') return { kind: 'running', botName, ...(plan.kind === 'talk' ? { talk: true } : {}) };+ // Someone who cannot add to a queue sends a new request: the composer must not promise otherwise.+ if (plan.status === 'running' && plan.kind === 'talk') return plan.canAdd === false ? null : { kind: 'running', botName, talk: true };+ if (plan.status === 'running') return { kind: 'running', botName };// A queue waiting for 继续 takes a new request, not changes to the last answer (bot-group-chat.md §4.0).if (plan.status === 'waiting' && plan.kind === 'talk') return null;if (plan.status === 'waiting') return { kind: 'waiting', botName, stepDone: current?.status === 'done' };