Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(chat): restore independent mention-only reply control
Chrisaa3987585283
diff --git a/apps/desktop/scripts/fixtures/group-control/ui-page.mjs b/apps/desktop/scripts/fixtures/group-control/ui-page.mjsindex 2e004aae73..e8b51e124a 100644--- a/apps/desktop/scripts/fixtures/group-control/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/group-control/ui-page.mjs@@ -56,7 +56,7 @@ export default {data: { ...base, members: QUEUE_CROWD, arrangement: 'long' },},settings: {- about: 'Single-speaker group settings: no 回复方式, 发言方式, 负责人 or project folder',+ about: 'Single-speaker group settings: reply mode remains independent; no speaking mode, organizer or project folder',data: { ...base, arrangement: 'running', settings: true },},'thread-unread': {@@ -112,10 +112,13 @@ export default {if (ui.case === 'settings') {const drawer = page.getByRole('dialog');- await drawer.getByText('群名称', { exact: true }).waitFor();- // Who answers follows @ (everyone queues when nobody is named); no group modes, no organizer.- for (const label of ['发言方式', '没有 @ 人的时候', '负责人', '项目文件夹'])- assert.equal(await drawer.getByText(label, { exact: true }).count(), 0, label);+ await drawer.getByText(await ui.t('bots.groupChat.server.settings.name'), { exact: true }).waitFor();+ const replyMode = drawer.getByRole('combobox', { name: await ui.t('bots.groupChat.settings.replyMode'), exact: true });+ await replyMode.click();+ await page.getByRole('option', { name: await ui.t('bots.groupChat.settings.replyModeMentioned'), exact: true }).click();+ assert.equal(await replyMode.innerText(), await ui.t('bots.groupChat.settings.replyModeMentioned'));+ for (const key of ['bots.groupChat.settings.speakingMode', 'bots.groupChat.organizer', 'bots.groupChat.settings.projectDir'])+ assert.equal(await drawer.getByText(await ui.t(key), { exact: true }).count(), 0, key);return;}if (ui.case.startsWith('arrangement')) {diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.tsindex 0676c2f4b3..263ab5ab08 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts@@ -1625,11 +1625,13 @@ describe('Chat Server result delivery and refresh', () => {it.each([['waiting for 继续: a new request replaces it', 'waiting', `/conversations/${roomId}/messages`],['mid-turn: the words go to the teammate answering', 'running', `/conversations/${roomId}/plans/80000000-0000-4000-8000-000000000002/messages`],- ] as const)('with an open queue %s', async (_label, status, route) => {+ ['mention-only mid-turn: unmentioned words stay ordinary messages', 'running', `/conversations/${roomId}/messages`, 'mentioned'],+ ] as const)('with an open queue %s', async (_label, status, route, responseMode: string = 'all') => {const queue = { id: '80000000-0000-4000-8000-000000000002', revision: 1, source_message_id: execution.source_message_id, request_text: 'Q', organizer_id: botId,creator_id: selfId, note_message_ids: [], status, current_step: 0, kind: 'talk', created_at: '2026-10-03T00:00:00Z', updated_at: '2026-10-03T00:00:00Z',steps: [{ position: 0, botId, botName: 'Bot', task: '', status: status === 'waiting' ? 'done' : 'running' }, { position: 1, botId: otherBot, botName: 'Peer', task: '', status: 'pending' }] };- singleSpeaker(route => route === `/conversations/${roomId}/plans` ? { body: [queue] } : undefined);+ singleSpeaker(route => route === `/conversations/${roomId}/plans` ? { body: [queue] }+ : route.endsWith('/snapshot') ? { body: { room: { ...room(roomId), response_mode: responseMode }, members: members(), messages: [], cursor: '1' } } : undefined);expect(await service.sendMessage({ groupId: roomId, text: 'Another thing', clientId: `queue-${status}`, mentions: { all: false, botIds: [] } })).toMatchObject({ ok: true });await vi.advanceTimersByTimeAsync(0);diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.tsindex c131dc7eaf..dc54875354 100644--- a/apps/desktop/src/main/maker-ipc/chatServer.ts+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts@@ -2419,8 +2419,8 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD// A single-speaker server arranges turns itself (several named teammates, or everyone when// nobody is named); the send no longer asks a helper model whether to divide the work first.if (i.division && openPlan && !proposed && !singleSpeaker) throw new Error('PLAN_OPEN');- // A single-speaker server has no reply modes: every request is answered, named or not (§4.0).- const canTrigger = singleSpeaker || i.division || s.room.response_mode !== 'mentioned' || !namesNobody(i.mentions);+ // Reply mode decides whether a message triggers work; single-speaker only decides its order.+ const canTrigger = (!singleSpeaker && i.division) || s.room.response_mode !== 'mentioned' || !namesNobody(i.mentions);// A queue waiting for 继续 gives way to a new request; only a turn under way takes additions (§4.0).const commentPlan = canTrigger && openPlan && openPlan.status !== 'proposed' && !(singleSpeaker && openPlan.kind === 'talk' && openPlan.status === 'waiting') && !i.mentions.botIds.length && !i.mentions.all && (openPlan.creator_id === selfId || s.members.some(m => m.id === selfId && ['owner','admin'].includes(m.role))) ? openPlan : undefined;const shouldPlan = canTrigger && !singleSpeaker && !!deps.decidePlan && (i.division || (!i.mentions.botIds.length && (!proposed || !i.mentions.all)))diff --git a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsxindex b4a8634b2e..46047fe73e 100644--- a/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx+++ b/apps/desktop/src/renderer/features/bots/BotGroupChatView.tsx@@ -1238,7 +1238,7 @@ function BotGroupChatContent({ groupId }: { groupId: string }) {draftKey={attachmentScope}members={group.members}running={running}- planState={botGroupComposerPlanState(openPlan)}+ planState={botGroupComposerPlanState(openPlan, group.replyMode)}divisionAvailable={!group.singleSpeaker}attachments={attachmentState}attachmentScope={attachmentScope}diff --git a/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx b/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsxindex c4398970ea..f2c3bb2994 100644--- a/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx+++ b/apps/desktop/src/renderer/features/bots/ChatGroupSettings.tsx@@ -130,11 +130,11 @@ export function ChatGroupSettings({ group }: { group: BotGroupSummary }) {onChange={event => { editGroup(); setTopic(event); }} />}</FormField><FormField label={t(key('description'))}>{props => <Input {...props} value={description} maxLength={2000} disabled={!manager || busy}onChange={event => { editGroup(); setDescription(event); }} />}</FormField>- {/* One teammate at a time: who answers follows @ (everyone queues when nobody is named), not a group mode. */}- {group.singleSpeaker ? null : <>+ {/* Whether unmentioned messages trigger replies is independent of the speaking order. */}<FormField label={t(shared('replyMode'))}>{props => <Select {...props} label={t(shared('replyMode'))} value={replyMode}disabled={!manager || busy} options={(['all', 'mentioned'] as const).map(value => ({ value, label: t(REPLY_MODE_LABELS[value]) }))}onValueChange={value => { editGroup(); setReplyMode(value as typeof replyMode); }} />}</FormField>+ {group.singleSpeaker ? null : <><FormField label={t(shared('speakingMode'))}>{props => <Select {...props} label={t(shared('speakingMode'))} value={speakingMode}disabled={!manager || busy} options={(['auto', 'sequential'] as const).map(value => ({ value, label: t(SPEAKING_MODE_LABELS[value]) }))}onValueChange={value => { editGroup(); setSpeakingMode(value as typeof speakingMode); }} />}</FormField>diff --git a/apps/desktop/src/renderer/features/bots/__tests__/ChatGroupSettings.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/ChatGroupSettings.test.tsxindex 40ce96abd5..dd61d60731 100644--- a/apps/desktop/src/renderer/features/bots/__tests__/ChatGroupSettings.test.tsx+++ b/apps/desktop/src/renderer/features/bots/__tests__/ChatGroupSettings.test.tsx@@ -95,6 +95,19 @@ it('labels reply and speaking modes with the same words as the local group settiexpect(screen.queryByText(key('replyMode'))).toBeNull();});+it('saves mention-only replies for single-speaker groups without restoring orchestration settings', async () => {+ render(<MemoryRouter><ChatGroupSettings group={{ ...group(true), singleSpeaker: true, replyMode: 'all', speakingMode: 'auto' }} /></MemoryRouter>);+ fireEvent.click(screen.getByRole('combobox', { name: 'bots.groupChat.settings.replyMode' }));+ fireEvent.click(screen.getByRole('option', { name: 'bots.groupChat.settings.replyModeMentioned' }));+ expect(screen.queryByRole('combobox', { name: 'bots.groupChat.settings.speakingMode' })).toBeNull();+ expect(screen.queryByRole('combobox', { name: 'bots.groupChat.organizer' })).toBeNull();+ fireEvent.submit(screen.getByRole('textbox', { name: key('name') }).closest('form')!);+ await waitFor(() => expect(mocks.manage).toHaveBeenCalledWith({ groupId: 'room', action: expect.objectContaining({+ type: 'update', responseMode: 'mentioned', expectedRevision: 1,+ }) }));+ expect(mocks.refresh).toHaveBeenCalledOnce();+});+it('does not offer leaving when this account owns every group owner, including its companion', async () => {render(<MemoryRouter><ChatGroupSettings group={group(true)} /></MemoryRouter>);expect(screen.queryByRole('button', { name: key('leave') })).toBeNull();diff --git a/apps/mobile/src/session/BotGroupChatScreen.tsx b/apps/mobile/src/session/BotGroupChatScreen.tsxindex 56012e32ff..1ffdaf2551 100644--- a/apps/mobile/src/session/BotGroupChatScreen.tsx+++ b/apps/mobile/src/session/BotGroupChatScreen.tsx@@ -371,7 +371,7 @@ export function BotGroupChatScreen({ deviceId, deviceName, groupId }: { deviceIdonInteractionError={(message) => { if (message) Alert.alert(message); }} /></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))}+ running={group.round.status === 'running'} planState={botGroupComposerPlanState(openBotGroupPlan(group), group.replyMode)}divisionSupported={!chat.server} attachmentsSupported={group.supportsAttachments === true} onSend={send} onStop={stop} /></KeyboardAvoidingView>;}diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.mdindex 7d6aebe4dc..145f230433 100644--- a/docs/product-rules/bot-group-chat.md+++ b/docs/product-rules/bot-group-chat.md@@ -124,17 +124,19 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下宿主代码执行,不靠提示词约束;Chris 2026-10-21 定稿(去掉负责人,原型见设计资产 `group-coordination`)。- **一次只有一位伙伴说话,没有负责人**。@ 一位伙伴,只有它回答;@ 多位伙伴或 @所有人,按 @ 的先后排队;- **没有 @ 人时,群里所有能回答的伙伴排成一个队列**(按成员列表顺序)。群里只有一位伙伴能回答时不排队,+ **没有 @ 人时按群设置决定是否回答**:`all`(默认,「大家都可以接话」)让所有能回答的伙伴排成一个队列+ (按成员列表顺序);`mentioned`(「只有被 @ 的回答」)不唤醒伙伴、不新建或替换队列。群里只有一位伙伴能回答时不排队,它直接回答。伙伴的回复不叫醒任何伙伴,也不能替自己往队列里加人。- **排队的形态只有一种:队列卡**(即第 7 节的安排卡)。卡上一步一位伙伴、一次模型调用,宿主按顺序依次派发,不另调模型来排顺序。**前 5 位依次自动回答,第 6 位起每位等用户点「继续」**;用户觉得够了就点停止、「结束」或不再继续。轮到的伙伴没什么可补充时回复 `NO_REPLY`,群里不显示,但这一步照样算说完。- 每位伙伴的回复都是独立消息;安排卡单独一条,只表达顺序与进度,不并入谁的回复。-- 不再有群设置「没有 @ 人的时候」「发言方式」「负责人」「项目文件夹」,群头像行不再标「负责人」,+- 群设置保留独立的「没有 @ 人的时候」,控制是否响应无 @ 消息,与排队顺序无关(2026-10-23 修正)。+ 不再有「发言方式」「负责人」「项目文件夹」,群头像行不再标「负责人」,也不再自动第 2、3 圈;继续由队列卡的「继续」完成。-- 队列停着等「继续」时又发了新消息,就是新问题:旧队列结束,按新消息另排。队列里正有伙伴在答时,发起人- 不 @ 人说的话作为这一步的补充交给正在答的伙伴;@ 了人则按 @ 依次普通回复、没 @ 人只由第一位伙伴回答,- 不另开队列。话题里的消息不排队列:@ 多位依次回答,没 @ 人只由第一位伙伴回答。+- 队列停着等「继续」时又发了符合回复条件的新消息,就是新问题:旧队列结束,按新消息另排。队列里正有伙伴在答时,发起人+ 不 @ 人说的话仅在 `all` 时作为这一步的补充交给正在答的伙伴;@ 了人则按 @ 依次普通回复、`all` 且没 @ 人只由第一位伙伴回答,+ 不另开队列。话题里的消息不排队列:@ 多位依次回答,`all` 且没 @ 人只由第一位伙伴回答,`mentioned` 且没 @ 人保持安静。- 主群里的普通回复只带最近 12 条主群消息、每条截至 600 字(更早的标为已省略),群专线自带此前的轮次;当前请求本身完整送达。- **停止只停自己的**:普通成员点停止,停掉自己发起的请求与安排、以及自己的伙伴在替别人做的事;@@ -285,7 +287,7 @@ Chat Server 声明 `capabilities.groupSingleSpeaker: 1` 时,服务器群按下不暗示「让上一位改改」。- 每一步跑在这张卡自己的 Session 里,上下文只有原问题、前面各位的回答、以及这一步期间你补的话,不带主群历史;不准备项目文件夹或 worktree,不收集产物文件。-- 队列有伙伴正在答时,发起人或管理员不 @ 人说的话并入这一步;队列停着等继续时,新消息另起队列(4.0)。+- 队列有伙伴正在答时,`all` 模式下发起人或管理员不 @ 人说的话并入这一步;队列停着等继续时,符合回复条件的新消息另起队列(4.0)。- 队列卡作为独立一条显示在请求下面,不挂任何伙伴名义;每位伙伴的回答是各自独立的消息。用户心智:照常说话。事情需要几位伙伴一起做时,负责人先回一个安排,用户点「开始」;伙伴一位接一位做,diff --git a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts b/packages/maker-shared/src/__tests__/botGroupPresentation.test.tsindex c539e45ea4..19c771187c 100644--- a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts+++ b/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts@@ -140,11 +140,12 @@ describe('plan follow-up and composer state', () => {// 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);+ ['who may add to it', 'running', true, 'all', { kind: 'running', botName: 'A', talk: true }],+ ['who cannot add to it', 'running', false, 'all', null],+ ['waiting for 继续', 'waiting', true, 'all', null],+ ['requiring an explicit mention', 'running', true, 'mentioned', null],+ ] as const)('gives a queue %s the matching composer state', (_label, status, canAdd, replyMode, expected) => {+ expect(botGroupComposerPlanState(plan({ kind: 'talk', status, canAdd }), replyMode)).toEqual(expected);});});diff --git a/packages/maker-shared/src/botGroupPresentation.ts b/packages/maker-shared/src/botGroupPresentation.tsindex 272c2afd8f..4593521aa3 100644--- a/packages/maker-shared/src/botGroupPresentation.ts+++ b/packages/maker-shared/src/botGroupPresentation.ts@@ -14,6 +14,7 @@ import {type BotGroupNoticeCode,type BotGroupPlanStepView,type BotGroupPlanView,+ type BotGroupReplyMode,type BotGroupSummary,} from './botGroupChat.js';@@ -222,13 +223,13 @@ export type BotGroupComposerPlanState =| { kind: 'running'; botName: string; talk?: boolean }| { kind: 'waiting'; botName: string; stepDone: boolean };-export function botGroupComposerPlanState(plan: BotGroupPlanView | null): BotGroupComposerPlanState | null {+export function botGroupComposerPlanState(plan: BotGroupPlanView | null, replyMode: BotGroupReplyMode = 'all'): BotGroupComposerPlanState | null {if (!plan) return null;if (plan.status === 'proposed') return { kind: 'proposed' };const current = currentBotGroupPlanStep(plan);const botName = current?.botName.trim() ?? '';- // 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 };+ // Only promise additions when unmentioned words actually reach the speaking teammate.+ if (plan.status === 'running' && plan.kind === 'talk') return plan.canAdd === false || replyMode === 'mentioned' ? 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;