Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(chat): align mention-only work hints and remote division controls
Chrisbfd76f00b6f4
diff --git a/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx b/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsxindex 7166ccc447..ce92841491 100644--- a/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx+++ b/apps/desktop/scripts/fixtures/group-control/group-control-fixture.tsx@@ -18,6 +18,8 @@ interface GroupData {wrappedReactions?: boolean;/** A single-speaker server group: nobody was named, so everyone answers in turn (bot-group-chat.md §4.0/§7.0). */arrangement?: Queue;+ /** A preserved work plan whose ordinary messages must stay quiet. */+ workMentioned?: boolean;/** Open the group settings drawer as its owner. */settings?: boolean;/** Server read state: unread thread entries and the in-chat 话题 hint. */@@ -191,10 +193,11 @@ function threadSummaries() {function groupFrom(data: GroupData) {const bubbles = data.bubbles ? bubbleMessages(data.wrappedReactions) : null;+ const planKind = data.workMentioned ? 'work' : 'talk';return {id: 'fixture-group',name: data.name,- replyMode: 'all',+ replyMode: data.workMentioned ? 'mentioned' : 'all',speakingMode: 'auto',members: [...(data.settings ? [{ botId: '', actorId: 'me', actorKind: 'user', name: 'You', isSelf: true, isOwned: true, role: 'owner', avatar: '', avatarColor: 'gray', status: 'active' }] : []),...data.members.map((member) => ({@@ -213,10 +216,10 @@ function groupFrom(data: GroupData) {openPlan: null,createdAt: 1,updatedAt: 1,- plans: data.arrangement ? [arrangementPlan(data.arrangement)] : [],+ plans: data.arrangement ? [{ ...arrangementPlan(data.arrangement), kind: planKind }] : [],...(data.arrangement ? { openPlan: data.arrangement === 'long'- ? { id: 'p1', status: 'waiting', currentStep: 4, stepCount: 7, currentBotName: 'Pax', currentStepStatus: 'done', kind: 'talk' }- : data.arrangement === 'running' ? { id: 'p1', status: 'running', currentStep: 1, stepCount: 2, currentBotName: 'Nova', currentStepStatus: 'running', kind: 'talk' } : null,+ ? { id: 'p1', status: 'waiting', currentStep: 4, stepCount: 7, currentBotName: 'Pax', currentStepStatus: 'done', kind: planKind }+ : data.arrangement === 'running' ? { id: 'p1', status: 'running', currentStep: 1, stepCount: 2, currentBotName: 'Nova', currentStepStatus: 'running', kind: planKind } : null,singleSpeaker: true } : {}),...(data.bubbles || data.arrangement ? { serverBacked: true } : {}),...(data.threadUnread ? { threads: threadSummaries() } : {}),diff --git a/apps/desktop/scripts/fixtures/group-control/ui-page.mjs b/apps/desktop/scripts/fixtures/group-control/ui-page.mjsindex e8b51e124a..df09a2e719 100644--- a/apps/desktop/scripts/fixtures/group-control/ui-page.mjs+++ b/apps/desktop/scripts/fixtures/group-control/ui-page.mjs@@ -47,6 +47,10 @@ export default {about: 'Single-speaker server group, nobody named: the queue card stands on its own, Aster answered and Nova is speaking next by itself',data: { ...base, arrangement: 'running' },},+ 'work-mentioned': {+ about: 'Preserved running work plan in mentioned mode: ordinary text has no implicit worker recipient',+ data: { ...base, arrangement: 'running', workMentioned: true },+ },'arrangement-done': {about: 'The same queue once every turn is done: no 继续 row',data: { ...base, arrangement: 'done' },@@ -121,6 +125,10 @@ export default {assert.equal(await drawer.getByText(await ui.t(key), { exact: true }).count(), 0, key);return;}+ if (ui.case === 'work-mentioned') {+ assert.equal(await input.getAttribute('placeholder'), await ui.t('bots.groupChat.composer.placeholder'));+ return;+ }if (ui.case.startsWith('arrangement')) {const card = page.getByTestId('bot-group-arrangement');await card.waitFor();diff --git a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsxindex dda1c7f2a0..d35a20aeb1 100644--- a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx@@ -740,17 +740,27 @@ describe('group composer', () => {expect(last).not.toHaveProperty('division');});- it('explains why 安排分工 is unavailable while a plan runs, and stops the round when empty', async () => {+ // Remote resource -> screen regression: transport through Desktop must not expose+ // unsupported division in a single-speaker room (component tier).+ it.each([true, false])('gates remote 安排分工 using singleSpeaker=%s', async singleSpeaker => {+ h.chat.server = false;+ await render(parseBotGroupChatData(group({ serverBacked: true, singleSpeaker, replyMode: 'mentioned', openPlan: null }))!);+ expect(!!byId('botGroup.composer.menu.action.division')).toBe(!singleSpeaker);+ });++ it.each(['all', 'mentioned'] as const)('keeps the running work-plan gate and uses truthful %s copy', async replyMode => {const data = group({+ replyMode,openPlan: { id: 'p1', status: 'running', currentStep: 0, stepCount: 2, currentBotName: '咪咪', currentStepStatus: 'running' },round: { status: 'running', speakers: [{ botId: 'mimi', sessionId: 's1', activity: 'step' }], canContinue: false },});- data.plans[0] = { ...data.plans[0]!, status: 'running', currentStep: 0, steps: [{ ...data.plans[0]!.steps[0]!, status: 'running' }, data.plans[0]!.steps[1]!] };+ data.plans[0] = { ...data.plans[0]!, kind: 'work', status: 'running', currentStep: 0, steps: [{ ...data.plans[0]!.steps[0]!, status: 'running' }, data.plans[0]!.steps[1]!] };await render(data);expect(byId('botGroup.composer.menu')).toBeNull();await click('botGroup.composer.more');expect(h.alert).toHaveBeenCalledWith('groupChat.composer.division', 'groupChat.composer.divisionBusy');- expect(byId('placeholder')?.textContent).toBe('groupChat.composer.placeholderPlanRunning(name=咪咪)');+ expect(byId('placeholder')?.textContent).toBe(replyMode === 'mentioned'+ ? 'groupChat.composer.placeholder' : 'groupChat.composer.placeholderPlanRunning(name=咪咪)');await click('botGroup.composer.stop');expect(h.chat.act).toHaveBeenLastCalledWith('stop');});diff --git a/apps/mobile/src/__tests__/botGroupRemote.test.ts b/apps/mobile/src/__tests__/botGroupRemote.test.tsindex ccea41732d..037416a36c 100644--- a/apps/mobile/src/__tests__/botGroupRemote.test.ts+++ b/apps/mobile/src/__tests__/botGroupRemote.test.ts@@ -52,7 +52,7 @@ describe('parseBotGroupChatData', () => {['all', 'talk', true, { kind: 'running', botName: '咪咪', talk: true }],['mentioned', 'talk', true, null],['all', 'talk', false, null],- ['mentioned', 'future', 'true', { kind: 'running', botName: '咪咪' }],+ ['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)!;diff --git a/apps/mobile/src/session/BotGroupChatScreen.tsx b/apps/mobile/src/session/BotGroupChatScreen.tsxindex 1ffdaf2551..7aebc90a44 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} 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 94b35b3b20..19e4352557 100644--- a/apps/mobile/src/session/botGroupRemote.ts+++ b/apps/mobile/src/session/botGroupRemote.ts@@ -364,6 +364,7 @@ export function parseBotGroupChatData(value: unknown): BotGroupRemoteChatData |id: groupId,name,serverBacked: record.serverBacked === true,+ singleSpeaker: record.singleSpeaker === 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 2fc7169a7c..4da23e82f3 100644--- a/docs/dev-rules/protocol-compatibility.md+++ b/docs/dev-rules/protocol-compatibility.md@@ -2652,7 +2652,8 @@ Chat Server `/me` 追加 `capabilities.groupSingleSpeaker: 1`,服务端派发队列停着等继续时新消息按新请求发送(不作为补充)。队列前 5 位由服务端自动接续,无需客户端参与。`chat_plan.kind` 是附加字段,旧客户端忽略;新客户端缺字段时按旧分工卡呈现。手机解析电脑的群资源时,保留经校验的可选 `kind`(talk/work)与 `canAdd`(boolean);缺失或非法时沿用旧分工呈现,不把字符串当作补充权限。-`mentioned` 的运行中 talk 队列不接受普通无 @ 消息作为自动补充,两端输入框不得承诺交给正在答的伙伴。+`mentioned` 的运行中 talk 队列及存量 work 分工不接受普通无 @ 消息作为自动补充,两端输入框不得承诺交给正在答的伙伴;存量 work 分工仍保留未结束时阻止新建分工的限制。+手机须保留电脑投影的 `singleSpeaker: true`,据此隐藏不支持的「安排分工」;远程电脑传输不等于旧群。缺字段的旧电脑沿用原入口。停止的范围收窄与主群上下文精简都只在看到该能力时启用,旧服务器保留整轮停止与完整主群历史;收窄只在执行端实现(成员只停自己的请求与伙伴,群主或管理员——含本账号拥有的管理员伙伴——可 `all`),沿用既有 control /plan action 的服务端权限,IPC `bot-group:stop` 追加可选 `scope`;手机经电脑的远程动作不变(停止为本人范围)。发布顺序:服务端整集群先上,再发客户端。diff --git a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts b/packages/maker-shared/src/__tests__/botGroupPresentation.test.tsindex 19c771187c..6d6ce582d8 100644--- a/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts+++ b/packages/maker-shared/src/__tests__/botGroupPresentation.test.ts@@ -139,6 +139,13 @@ 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.+ // Legacy work plans still block a new division even when ordinary text stays quiet (unit).+ it.each(['running', 'waiting'] as const)('keeps the %s work-plan gate without promising unmentioned delivery', status => {+ const state = botGroupComposerPlanState(plan({ kind: 'work', status }), 'mentioned');+ expect(state).toMatchObject({ kind: status, botName: '' });+ expect(isBotGroupDivisionBlocked(state)).toBe(true);+ });+it.each([['who may add to it', 'running', true, 'all', { kind: 'running', botName: 'A', talk: true }],['who cannot add to it', 'running', false, 'all', null],diff --git a/packages/maker-shared/src/botGroupPresentation.ts b/packages/maker-shared/src/botGroupPresentation.tsindex 4593521aa3..14e061584c 100644--- a/packages/maker-shared/src/botGroupPresentation.ts+++ b/packages/maker-shared/src/botGroupPresentation.ts@@ -227,7 +227,9 @@ export function botGroupComposerPlanState(plan: BotGroupPlanView | null, replyMoif (!plan) return null;if (plan.status === 'proposed') return { kind: 'proposed' };const current = currentBotGroupPlanStep(plan);- const botName = current?.botName.trim() ?? '';+ // Keep the work-plan state for the division gate, but name a recipient only when+ // ordinary text is actually forwarded to that worker (including legacy plans).+ const botName = replyMode === 'mentioned' ? '' : current?.botName.trim() ?? '';// 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 };