Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 保留伙伴工作过程与流式最终回复 (#6507)
Chris Zhangd6f02d96d62b
diff --git a/apps/mobile/src/__tests__/companionConversationPresentation.test.ts b/apps/mobile/src/__tests__/companionConversationPresentation.test.tsindex 3e96ede7b5..622af3c4c2 100644--- a/apps/mobile/src/__tests__/companionConversationPresentation.test.ts+++ b/apps/mobile/src/__tests__/companionConversationPresentation.test.ts@@ -35,19 +35,32 @@ it.each(['retrying', 'completed', 'exhausted'] as const)(expect(source[1].content).toContain('# Failed opening');expect(source[1].agentMeta?.failedSamplingAttempt).toBeDefined();});-it('has no process entry or commentary during generation, and retains the completed answer', () => {+// Regression: the mobile companion filter discarded the work groups restored on+// Desktop. Unit entry is the real normalize → group → companion projection;+// a user row, progress and one tool suffice to lose the only process entry.+it('keeps live work and completed process details reachable like Desktop', () => {const active = bodies(base, true);- expect(active.map(item => item.type)).toEqual(['message']);- expect(JSON.stringify(active)).not.toMatch(/Public progress|technical details/);+ expect(active.map(item => item.type)).toEqual(['message', 'work_group']);+ expect(JSON.stringify(active)).toContain('technical details');const complete = bodies([...base, row('a4', 'assistant', 'Answer', { turnCompleted: true })], false);expect(complete.filter(item => item.type === 'message').map(item => item.message.body)).toEqual(['Help', 'Answer']);+ expect(JSON.stringify(complete)).toContain('Public progress');expect(base[1].content).toBe('Public progress');});+it('keeps a provider final reply visible while streaming and after tool/history updates', () => {+ const answer = row('a1', 'assistant', 'Visible first reply', { assistantPhase: 'final_answer', isStreaming: true });+ for (const source of [[base[0], answer], [base[0], answer, ...base.slice(2)],+ [base[0], { ...answer, agentMeta: { assistantPhase: 'final_answer' } }, ...base.slice(2),+ row('a4', 'assistant', 'Done', { turnCompleted: true })]]) {+ expect(bodies(source, true).filter(item => item.type === 'message').map(item => item.message.body))+ .toContain('Visible first reply');+ }+});it('retains an interrupted/no-final reply and the actual error', () => {const items = bodies([...base, row('a4', 'assistant', 'Useful partial answer'), row('e5', 'error', 'Model failed')], false);expect(JSON.stringify(items)).toContain('Useful partial answer');expect(JSON.stringify(items)).toContain('Model failed');- expect(items.some(item => item.type === 'work_group')).toBe(false);+ expect(items.some(item => item.type === 'work_group')).toBe(true);});it('keeps all contiguous blocks of a sealed final answer', () => {const items = bodies([...base, row('a4', 'assistant', 'Part one'), row('a5', 'assistant', 'Part two', { turnCompleted: true })], false);@@ -67,7 +80,8 @@ it('keeps every sealed reply block after a continuation even when the main timelit('keeps delivered attachments without their preamble', () => {const items = bodies([...base, row('a4', 'assistant', '')], false);expect(JSON.stringify(items)).toContain('picture.png');- expect(JSON.stringify(items)).not.toContain('Public progress');+ expect(items.filter(item => item.type === 'message').map(item => item.message.body)).not.toContain('Public progress');+ expect(JSON.stringify(items)).toContain('Public progress');});it('retains required questions and plan decisions in the actual message projection', () => {const items = bodies([...base,@@ -123,7 +137,7 @@ it.each([{ turnCompleted: true }, { turnUsageDetails: { totalTokens: 12 } }])('kfor (const running of [true, false]) {const items = bodies(complete, running);expect(items.filter(item => item.type === 'message').map(item => item.message.body)).toEqual(['Help', 'Delivered answer']);- expect(items.some(item => item.type === 'work_group' || item.type === 'tool_group')).toBe(false);+ expect(items.some(item => item.type === 'work_group')).toBe(true);}});@@ -135,8 +149,9 @@ it('drops persisted auto-resume separators like Desktop, keeping only the live rexpect(buildMobileMessageRenderItems(resumed, { isSessionStreaming: false }).some(isResumeCard)).toBe(true);const items = bodies(resumed, false);expect(items.some(isResumeCard)).toBe(false);- // The hidden separator still ends the interrupted turn, whose useful partial prose stays readable.- expect(items.filter(item => item.type === 'message').map(item => item.message.body)).toEqual(['Help', 'Public progress', 'Answer']);+ // The interrupted process remains readable inside its original work group.+ expect(items.filter(item => item.type === 'message').map(item => item.message.body)).toEqual(['Help', 'Answer']);+ expect(JSON.stringify(items)).toContain('Public progress');const live = companionConversationItems(buildMobileMessageRenderItems(base, {isSessionStreaming: true, autoResumePending: { attempt: 2, maxAttempts: 3 },}));diff --git a/apps/mobile/src/__tests__/messageActionDesktopFirst.test.ts b/apps/mobile/src/__tests__/messageActionDesktopFirst.test.tsindex c3f10f169b..43cf3c72a6 100644--- a/apps/mobile/src/__tests__/messageActionDesktopFirst.test.ts+++ b/apps/mobile/src/__tests__/messageActionDesktopFirst.test.ts@@ -24,7 +24,7 @@ const leaf = () => null;const child = vi.fn(({ item }: any) => React.createElement('span', null, item.key));const source = ['ToolActionRow', 'WorkGroupCard'].map(name => rendererFunction(name).getText(rendererSource)).join(String.fromCharCode(10));const components = executeRenderer<Record<string, React.ComponentType<any>>>(source + '; return { ToolActionRow, WorkGroupCard };', {- useState: React.useState, useRef: React.useRef, useEffect: React.useEffect, useMemo: React.useMemo,+ useState: React.useState, useRef: React.useRef, useEffect: React.useEffect, useLayoutEffect: React.useLayoutEffect, useMemo: React.useMemo,useTranslation, useFoldableExpandedState, summarizeWorkGroupPresentation,mobilePresentationLocalizer, buildMessageHierarchyLayout, buildMessageContentLayout, readToolProcessMedia,View, Text: View, Pressable: View, useTheme: () => ({ colors: lightColors }),diff --git a/apps/mobile/src/__tests__/mobileHistoryRender.test.ts b/apps/mobile/src/__tests__/mobileHistoryRender.test.tsindex 7ac4eb692f..9b32345542 100644--- a/apps/mobile/src/__tests__/mobileHistoryRender.test.ts+++ b/apps/mobile/src/__tests__/mobileHistoryRender.test.ts@@ -6,6 +6,7 @@ import type { RemoteMessage } from '../session/types';import { reconcileMobileMessageRenderItems } from '../session/messageRenderReconcile';import { buildMobileStreamingRenderWindow } from '../session/messageRenderStreamingCache';import { CONTINUE_AFTER_ERROR_PROMPT } from '@cindy/maker-shared/synthetic-trigger';+import { companionConversationItems } from '../session/companionConversationPresentation';function row(index: number, role: RemoteMessage['role'], content: unknown, toolUseId: string | null = null): RemoteMessage {return { id: `id-${index}`, clientId: `client-${index}`, sessionId: 'session', role, content, toolUseId,@@ -34,6 +35,28 @@ function harness(rows: RemoteMessage[], streaming = false, lazyDetails = false)}describe('remote history preserves original folding', () => {+ // Regression: mobile's companion projection used to flatten away deferred+ // work after history takeover. Verify the production controller's expansion+ // still reads the original thinking/tool rows and never hides a provider final.+ it('preserves companion replies and lazy work through history takeover and expansion', async () => {+ const rows = [row(0, 'user', 'Work'),+ { ...row(1, 'assistant', 'First reply'), agentMeta: { assistantPhase: 'final_answer' } },+ thought(2), call(3), row(4, 'tool_result', 'Read result', 'tool-3')];+ const { view, render, details } = harness(rows, true, true);+ const raw = companionConversationItems(buildMobileMessageRenderItems(rows, { isSessionStreaming: true }));+ await view.refresh();+ const loaded = companionConversationItems(render());+ expect(loaded.map(item => item.key)).toEqual(raw.map(item => item.key));+ const work = loaded.find(item => item.type === 'work_group');+ if (work?.type !== 'work_group') throw new Error('Missing companion work');+ expect(details).not.toHaveBeenCalled();+ work.deferred!.setVisible!(true, false);+ await vi.waitFor(() => expect([...view.getSnapshot().details.values()].some(state => state.complete)).toBe(true));+ expect(JSON.stringify(companionConversationItems(render()))).toContain('reasoning');+ expect(companionConversationItems(render()).filter(item => item.type === 'message').map(item => item.message.body))+ .toEqual(['Work', 'First reply']);+ view.setActive(false);+ });it.each([false, true])('keeps the earlier answer when recovery follows an unloaded gap (streaming=%s)', async (streaming) => {const rows = [row(0, 'user', 'Work'), thought(1), row(2, 'assistant', 'Earlier answer'),row(4000, 'user', JSON.stringify({ text: CONTINUE_AFTER_ERROR_PROMPT })),diff --git a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsxindex 9a8845a269..4e1b32b6fa 100644--- a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx+++ b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx@@ -22,7 +22,7 @@ vi.mock('react-native', async () => {Platform: { OS: 'ios', select: (s: any) => s.ios ?? s.default },StyleSheet: { create: (s: any) => s, flatten: (s: any) => s, hairlineWidth: 1 },Easing: { linear: (n: number) => n, bezier: () => (n: number) => n },- AccessibilityInfo: {}, Alert: {}, Linking: {}, StatusBar: {},+ AccessibilityInfo: { isReduceMotionEnabled: () => Promise.resolve(true), addEventListener: () => ({ remove() {} }) }, Alert: {}, Linking: {}, StatusBar: {},useWindowDimensions: () => ({ width: 402, height: 874, scale: 3, fontScale: 1 }),};});@@ -150,6 +150,30 @@ describe('partner work feedback', () => {});describe('running work group expansion', () => {+ // Missing preview regression: actual MessageRenderer must expose raw/old-Host+ // activity while folded, not just Host-projected lines. Native views are adapters.+ it('shows the latest thinking without Host lines in ordinary and companion tasks', () => {+ const messages = [msg('u', 'user', 'Check this'), ...Array.from({ length: 6 }, (_, n) =>+ msg(`thought-${n}`, 'thinking', { text: `Thinking step ${n}`, durationMs: 1 }))];+ const items = buildMobileMessageRenderItems(messages, { isSessionStreaming: true }).filter(item => item.type === 'work_group');+ for (const companion of [false, true]) {+ const html = renderToStaticMarkup(<MessageRenderer+ items={companion ? companionConversationItems(items) : items} companion={companion} isSessionStreaming />);+ expect(html).toContain('Thinking step 5');+ expect(html).not.toContain('Thinking step 0');+ }+ });+ it.each([undefined, []])('requests an old-Host preview only when running lines are absent: %j', (lines) => {+ const setVisible = vi.fn();+ const items = buildMobileMessageRenderItems([+ msg('thought', 'thinking', { text: 'Cached thinking', durationMs: 1 }),+ ], { isSessionStreaming: true }).filter(item => item.type === 'work_group')+ .map(item => ({ ...item, deferred: { owner: {}, key: item.key, expanded: false,+ loading: false, failed: false, lines, setVisible, toggle() {}, retry() {} } }));+ const html = renderClient(<MessageRenderer items={companionConversationItems(items)} companion isSessionStreaming />);+ expect(setVisible).toHaveBeenCalledWith(false, lines === undefined);+ expect(html.includes('Cached thinking')).toBe(lines === undefined);+ });const render = (awaitingDetails: boolean) => {const messages = [msg('u', 'user', 'Fix it'), msg('c', 'tool_use', {toolName: 'Bash', toolUseId: 'c', input: { command: 'pnpm test' },@@ -228,6 +252,27 @@ describe('partner conversation presentation', () => {for (const element of cases) expect(renderClient(element)).not.toContain('companion.taskResult');});+ // Regression: expanding process prose must not duplicate the final reply's portrait.+ // Exercise the production projection and renderer, including nested work groups.+ it('keeps expanded companion work readable without repeating the reply portrait', () => {+ const items = companionConversationItems(buildMobileMessageRenderItems([+ msg('u', 'user', 'Check it'),+ msg('p', 'assistant', 'Checking the details', { agentMeta: { assistantPhase: 'commentary' } }),+ msg('t', 'tool_use', { toolName: 'Bash', toolUseId: 't', input: { command: 'pwd' } }, { toolUseId: 't' }),+ msg('f', 'assistant', 'Here is the result', { agentMeta: { assistantPhase: 'final_answer' } }),+ ], { isSessionStreaming: false }));+ viewportHarness.expanded = true;+ try {+ const html = renderClient(<MessageRenderer items={items} companion companionAvatar={<i data-testid="partner-portrait" />} />);+ expect(html.match(/message\.agentBubble/g)).toHaveLength(2);+ expect(html).toContain('message.toolRow');+ expect(html.match(/companion\.replyRow/g)).toHaveLength(1);+ expect(html.match(/partner-portrait/g)).toHaveLength(1);+ } finally {+ viewportHarness.expanded = false;+ }+ });+it('hangs replies from the partner portrait and stamps five-minute groups like Desktop', () => {const messages = [msg('u1', 'user', 'Hi', { createdAt: '2026-01-01T09:00:00Z' }),diff --git a/apps/mobile/src/session/MessageRenderer.tsx b/apps/mobile/src/session/MessageRenderer.tsxindex 59c89fa9f3..f8ef041bf3 100644--- a/apps/mobile/src/session/MessageRenderer.tsx+++ b/apps/mobile/src/session/MessageRenderer.tsx@@ -355,6 +355,7 @@ import {import type { ContinuationInFlightProjectionCapability } from '@/session/types';import {projectMobileWorkActivities,+ projectRecentMobileWorkActivities,type MobileProjectedToolActivity,sameMobileWorkToolActivity,} from '@/session/workActivityProjection';@@ -3025,10 +3026,9 @@ const RenderItemView = memo(function RenderItemView({}const groupTimestamp = actions.companion && item.type === 'message'? actions.companionTimeGroups?.get(item.key) : undefined;- // K1: every companion card (task, result, teammate-message pill) hangs on the replies' column,- // left-aligned with the reply text behind an invisible avatar.- const alignWithReplies = !!actions.companionAvatar && actions.companion && item.type === 'message'- && !!item.message.companion;+ // Cards and work groups share the reply text column, leaving the avatar slot empty.+ const alignWithReplies = !!actions.companionAvatar && actions.companion+ && (item.type === 'work_group' || (item.type === 'message' && !!item.message.companion));const aligned = alignWithReplies ? <View style={styles.companionAvatarInset}>{node}</View> : node;// Companion chats: a new message or finished reply eases in once (M4 / M5); everything else stays still.const entering = actions.companion && item.type === 'message' && !item.message.systemCardType@@ -4703,20 +4703,26 @@ function WorkGroupCard({const isStreaming = item.isStreaming === true;const [rememberedExpanded, toggleExpanded] = useFoldableExpandedState(item.key, false);const expanded = item.deferred?.setVisible ? rememberedExpanded : item.deferred?.expanded ?? rememberedExpanded;+ const lines = isStreaming ? item.deferred?.lines : undefined;+ const lineMode = lines !== undefined;const deferredRef = useRef(item.deferred);deferredRef.current = item.deferred;- useEffect(() => {+ useLayoutEffect(() => {const current = deferredRef.current;- current?.setVisible?.(expanded, false);+ current?.setVisible?.(expanded, isStreaming && !lineMode);return () => current?.setVisible?.(false, false);- }, [item.deferred?.owner, item.deferred?.key, expanded]);+ }, [item.deferred?.owner, item.deferred?.key, expanded, isStreaming, lineMode]);const layout = useMemo(() => buildMessageHierarchyLayout({screenWidth: actions.screenWidth,summaryCount: header.summaryCount,}), [actions.screenWidth, header.summaryCount]);- const contentLayout = useMemo(() => (expanded- ? buildMessageContentLayout({ screenWidth: actions.screenWidth })- : null), [actions.screenWidth, expanded]);+ const contentLayout = useMemo(() => buildMessageContentLayout({ screenWidth: actions.screenWidth }), [actions.screenWidth]);+ const liveActivities = useMemo(() => isStreaming && !lineMode+ ? projectRecentMobileWorkActivities(item.children, true, 5) : [], [item.children, isStreaming, lineMode]);+ // The outer group already occupies the reply column. Keep companion actions,+ // but neither repeat its portrait nor indent nested work groups a second time.+ const childActions = useMemo(() => actions.companion && actions.companionAvatar+ ? { ...actions, companionAvatar: undefined } : actions, [actions]);const activityProjection = useMemo(() => (expanded? projectMobileWorkActivities(item.children, isStreaming)@@ -4755,13 +4761,18 @@ function WorkGroupCard({const pluginWork = actions.companionPluginWork?.get(item.key);// The Host projects running lines for this view; folded groups render them as they are,// without building the hidden activity tree or reading any work details.- const lines = isStreaming ? item.deferred?.lines : undefined;// Expanding keeps these lines on screen until the detail read has rows to replace them.const holdLines = expanded && item.deferred?.awaitingDetails === true && !!lines?.length;const lineRows = lines?.length ? (<View style={styles.workActivityStack}>{lines.map((line) => <WorkLineRow key={line.key} line={line} onPress={onToggle} />)}</View>+ ) : !lineMode && liveActivities.length ? (+ <View style={styles.workActivityStack}>+ {liveActivities.map((activity) => activity.kind === 'tool'+ ? <WorkToolActivityRow key={activity.key} activity={activity} actions={toolActions} contentLayout={contentLayout} />+ : <WorkLineRow key={activity.key} line={{ kind: 'thinking', key: activity.key, text: activity.content }} onPress={onToggle} />)}+ </View>) : null;return (<>@@ -4820,7 +4831,7 @@ function WorkGroupCard({</View>);}- return <RenderItemView key={child.key} item={child} actions={actions} />;+ return <RenderItemView key={child.key} item={child} actions={childActions} />;})}</View></Rail>diff --git a/apps/mobile/src/session/companionConversationPresentation.ts b/apps/mobile/src/session/companionConversationPresentation.tsindex 25e8c14681..1cbc2e8005 100644--- a/apps/mobile/src/session/companionConversationPresentation.ts+++ b/apps/mobile/src/session/companionConversationPresentation.ts@@ -2,7 +2,7 @@ import { hasRichAnswer } from '@cindy/maker-shared/rich-answer';import { botTaskResultKey, readBotTaskResults } from '@cindy/maker-shared/botCollaboration';import { HISTORY_GAP_SPLIT_MS } from '@cindy/maker-shared/history-gap';import { collectMobileMarkdownImages } from './messageMarkdown';-import type { MobileMessageRenderItem } from './messageRenderModel';+import type { MobileMessageRenderItem, MobileWorkGroupItem, MobileWorkChildItem } from './messageRenderModel';const isDelivery = (item: MobileMessageRenderItem) => (item.type === 'message' && !item.message.failedSamplingAttempt && item.message.kind === 'assistant' && hasRichAnswer(item.message.body)) || item.type === 'tool_media' && item.tools.some(tool => !!tool.media?.length || !!tool.files?.length)|| item.type === 'message' && !item.message.failedSamplingAttempt && (item.message.companion?.kind === 'task' && item.message.companion.meta.role === 'delegation-result'@@ -12,6 +12,39 @@ const isDelivery = (item: MobileMessageRenderItem) => (item.type === 'message' &const expandWorkGroups = (items: readonly MobileMessageRenderItem[]): MobileMessageRenderItem[] =>items.flatMap(item => item.type === 'work_group' ? expandWorkGroups(item.children) : [item]);+/** Lift addressed replies without destroying the process tree or its lazy loader. */+function liftReplies(group: MobileWorkGroupItem, isReply: (item: MobileMessageRenderItem) => boolean): MobileMessageRenderItem[] {+ if (!group.children.some(isReply)) return [group];+ const result: MobileMessageRenderItem[] = [];+ let pending: MobileWorkChildItem[] = [];+ let chunk = 0;+ let start = group.startedAtMs;+ const groupEnd = start !== undefined && group.durationMs !== undefined ? start + group.durationMs : undefined;+ const flush = (end: number | undefined) => {+ if (!pending.length) return;+ if (!group.deferred && pending.length === 1 && pending[0].type === 'work_group') result.push(pending[0]);+ else result.push({+ ...group, key: chunk === 0 ? group.key : `${group.key}~${pending[0].key}`,+ children: pending, startedAtMs: start,+ durationMs: start !== undefined && end !== undefined && end >= start ? end - start : undefined,+ deferred: chunk === 0 ? group.deferred : undefined,+ });+ pending = [];+ chunk++;+ };+ for (const child of group.children) {+ if (isReply(child) && child.type === 'message') {+ const time = Date.parse(child.message.createdAt);+ const at = Number.isFinite(time) ? time : undefined;+ flush(at);+ result.push(child);+ start = at;+ } else pending.push(child);+ }+ flush(groupEnd);+ return result;+}+/** Presentation only. The host's persisted messages and lazy history remain intact. */export function companionConversationItems(items: readonly MobileMessageRenderItem[]): MobileMessageRenderItem[] {// The main timeline folds earlier background-wake seals into work groups; teammate chats@@ -35,7 +68,13 @@ export function companionConversationItems(items: readonly MobileMessageRenderItif (sealedRun) sealed.add(item.key);}}- const flattened = items.flatMap(item => item.type === 'work_group' ? companionConversationItems(item.children) : [item]);+ const isAddressedReply = (item: MobileMessageRenderItem) => item.type === 'message'+ && item.message.kind === 'assistant' && !item.message.failedSamplingAttempt+ && !!item.message.body.trim()+ && (item.message.source.agentMeta?.assistantPhase !== 'commentary' || item.message.explicitDelivery || hasRichAnswer(item.message.body))+ && (item.message.source.agentMeta?.assistantPhase === 'final_answer' || item.message.turnCompleted+ || sealed.has(item.key) || Boolean(item.message.sourceGroup) || item.message.explicitDelivery || hasRichAnswer(item.message.body));+ const flattened = items.flatMap(item => item.type === 'work_group' ? liftReplies(item, isAddressedReply) : [item]);// A later delivery is already the result. Do not restore its unsealed preamble.const deliveredAfter = new Set<string>();let delivery = false;@@ -60,12 +99,10 @@ export function companionConversationItems(items: readonly MobileMessageRenderItif (item.type === 'message' && item.message.companion?.kind === 'task'&& item.message.companion.meta.role === 'delegation-result'&& attached.has(botTaskResultKey(item.message.companion.meta))) return false;- if (item.type === 'thinking' || item.type === 'tool_group' || item.type === 'agent_task'- || item.type === 'subagent_group' || item.type === 'todo') return false;+ if (item.type === 'thinking') return false;if (item.type !== 'message') return true;const message = item.message;- // Companion chats omit process prose; the original failed rows remain in- // persisted history and the ordinary task's expandable work group.+ // Failed samples remain available inside the preserved work group, never as replies.if (message.kind === 'assistant' && message.failedSamplingAttempt) return false;// Desktop drops persisted synthetic resume separators from teammate chats; only the live// reconnect card (still in progress) remains. The composer status carries recovery copy.@@ -74,7 +111,9 @@ export function companionConversationItems(items: readonly MobileMessageRenderIt}if (message.systemCardType) return true;if (message.kind === 'thinking' || message.kind === 'tool') return false;- return message.kind !== 'assistant' || Boolean(message.sourceGroup) || message.explicitDelivery || message.turnCompleted || sealed.has(item.key) || isDelivery(item)+ if (message.kind === 'assistant' && message.source.agentMeta?.assistantPhase === 'commentary'+ && !message.explicitDelivery && !isDelivery(item)) return false;+ return message.kind !== 'assistant' || isAddressedReply(item) || isDelivery(item)|| message.isTurnFinalAssistant && !deliveredAfter.has(item.key);});}diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.mdindex a56f154549..9fe1c9e4f0 100644--- a/docs/product-rules/cindy-bots-runtime.md+++ b/docs/product-rules/cindy-bots-runtime.md@@ -189,6 +189,12 @@ tool 副作用时自动重放。原生后台工作尚未结束时不自动关闭**伙伴聊天显示工作过程(2026-10-15,Chris:「你这么做不如改回当年 session 的思考了」→ 直接用 session 同一套)**:伙伴的回复列与普通任务共用同一个工作过程折叠块(`WorkGroupBlock`)——运行中露出最近几步(工具名/文件/命令/思考首句)与计时,完成后折叠成「已工作 Xs」,点开可见思考与工具行;不再在渲染前删掉 thinking、tool 与 work_group。伙伴明确说给用户听的回复(provider 标为 final、群投递、显式投递或已收尾的回复)永远不藏进折叠里:工作过程在这类回复前后分段。输入框上方不再有只会说大类词的「正在处理…」状态行;运行状态走普通任务同一条 `RunningStatusBar`。工作过程与回复正文同列(头像列留空),不重复画脸。实现见 `botConversationPresentation.ts` 与 `MessageStream.tsx`。+手机端遵守同一展示规则:`companionConversationPresentation.ts` 保留工作组及其历史详情加载入口,+`MessageRenderer.tsx` 在运行中展示最近五条活动;旧电脑未下发活动行时读取已有预览范围。+provider 的 `final_answer` 从首段正文起可见,历史视图接管、后续工具调用和完成收口均不得把它过滤掉。+本链路验收同时覆盖普通任务与伙伴入口、实时消息转历史、折叠展开及重开;不能用桌面验收代替手机验收。+回归见 Mobile `companionConversationPresentation.test.ts`、`mobileHistoryRender.test.ts` 与 `pluginAttachmentBubble.test.tsx`。+普通设置不显示“永久 Session”“手动压缩”“自动换 Session”或运行时 fallback 开关。健康、归档和故障信息可以在需要时呈现,但维护动作默认由系统完成。用户只管理伙伴,不管理容器。