Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(bots): show final reply previews and latest task results (#4920)

Chris Zhange81209fabf5a
diff --git a/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts b/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts
index a4c604e213..2903382c5f 100644
--- a/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts
+++ b/apps/desktop/src/main/__tests__/messagePersistBroadcaster.test.ts
@@ -82,6 +82,7 @@ import {
onToolResultFullEvent,
prepareSyntheticToolEventForBroadcast,
onAssistantTextEvent,
+ drainPersistQueue,
onStandaloneTextEvent,
getSessionTextSnapshot,
onInteractionMessage,
@@ -3753,3 +3754,12 @@ describe('Pi extension notification and assistant reply isolation', () => {
expect(vi.mocked(createMessage).mock.calls.at(-1)?.[1].content).toBe('First second');
});
});
+
+
+it('retains explicit commentary/final phases in durable assistant metadata for notification selection', async () => {
+ onAssistantTextEvent('notification-phases', { text: 'Checking…', isFinal: true, phase: 'commentary', agentMessageId: 'commentary' }, null);
+ onAssistantTextEvent('notification-phases', { text: 'Finished.', isFinal: true, phase: 'final_answer', agentMessageId: 'answer' }, null);
+ await drainPersistQueue();
+ expect(createMessage).toHaveBeenCalledWith('notification-phases', expect.objectContaining({ content: 'Checking…', agentMeta: expect.objectContaining({ assistantPhase: 'commentary' }) }), expect.anything());
+ expect(createMessage).toHaveBeenCalledWith('notification-phases', expect.objectContaining({ content: 'Finished.', agentMeta: expect.objectContaining({ assistantPhase: 'final_answer' }) }), expect.anything());
+});
diff --git a/apps/desktop/src/main/__tests__/notificationPreview.test.ts b/apps/desktop/src/main/__tests__/notificationPreview.test.ts
new file mode 100644
index 0000000000..0229825aba
--- /dev/null
+++ b/apps/desktop/src/main/__tests__/notificationPreview.test.ts
@@ -0,0 +1,42 @@
+import { describe, expect, it } from 'vitest';
+import { notificationPreview } from '../notificationPreview';
+import { selectNotificationReply, type NotificationMessage } from '../localDb/sessionNotificationPreview.logic';
+
+describe('notification plain text', () => {
+ it.each([
+ ['纯文本 hello 2 * 3 foo_bar', '纯文本 hello 2 * 3 foo_bar'],
+ ['# 标题\n\n**加粗 _斜体_** [报告 **完成**](https://example.com)', '标题 加粗 斜体 报告 完成'],
+ ['`a_b * 2`\n\n```ts\nconst a_b = 2 * 3;\n```', 'a_b * 2 const a_b = 2 * 3;'],
+ ['> 已完成\n\n- 第一项\n- 第二项\n\n~~旧内容~~', '已完成 第一项 第二项 旧内容'],
+ ['![private filename](/private/file.png)', ''],
+ ['**日本語** / _한국어_ / [繁體中文](url)', '日本語 / 한국어 / 繁體中文'],
+ ])('converts %s', (markdown, expected) => expect(notificationPreview(markdown)).toBe(expected));
+ it('shortens after parsing, without splitting Unicode characters', () => {
+ expect(notificationPreview('**😀中文abc**', 4)).toBe('😀中文');
+ expect(notificationPreview('abc😀', 4)).toBe('abc');
+ expect(notificationPreview('😀', 1)).toBe('');
+ expect(notificationPreview('😀'.repeat(240))).toBe('😀'.repeat(120));
+ });
+});
+
+const row = (clientId: string, text: string, agentMeta: Record<string, unknown> = {}, createdAt = 20): NotificationMessage => ({ clientId, text, role: 'assistant', topLevel: true, agentMeta, createdAt });
+describe('current final reply selection', () => {
+ it('selects the latest sealed final, skipping host results and unsealed tool commentary', () => {
+ expect(selectNotificationReply([
+ row('receipt', 'task contents', { botCollaboration: { role: 'delegation-result' } }),
+ row('final', 'latest', { turnCompleted: true, assistantPhase: 'final_answer' }),
+ row('other-block', 'first block'),
+ row('old', 'old answer', { turnCompleted: true }, 1),
+ ], 10)).toEqual({ clientId: 'final', text: 'latest' });
+ });
+ it('does not present a pre-tool preamble as the reply when no answer followed', () => {
+ expect(selectNotificationReply([{ ...row('tool', 'tool output'), role: 'tool_result' },
+ row('preamble', 'Let me check', { turnCompleted: true })], 10)).toBeUndefined();
+ });
+ it('never falls back to commentary, subagents, failed turns or historical finals', () => {
+ expect(selectNotificationReply([row('comment', 'working', { turnCompleted: true, assistantPhase: 'commentary' })], 10)).toBeUndefined();
+ expect(selectNotificationReply([row('failed', 'partial', { turnCompleted: false }), row('old', 'old answer', { turnCompleted: true }, 1)], 10)).toBeUndefined();
+ expect(selectNotificationReply([{ ...row('subagent', 'secret', { turnCompleted: true }), topLevel: false }], 10)).toBeUndefined();
+ expect(selectNotificationReply([{ ...row('input', 'new user input'), role: 'user' }, row('old', 'old', { turnCompleted: true })], 10)).toBeUndefined();
+ });
+});
diff --git a/apps/desktop/src/main/__tests__/notificationService.test.ts b/apps/desktop/src/main/__tests__/notificationService.test.ts
index 2a22bafb3d..9313b1ce44 100644
--- a/apps/desktop/src/main/__tests__/notificationService.test.ts
+++ b/apps/desktop/src/main/__tests__/notificationService.test.ts
@@ -110,19 +110,35 @@ const latestMessageText = vi.fn<
vi.mock('../localDb/latestMessageText', () => ({
latestMessageText: (sessionId: string, role: string) => latestMessageText(sessionId, role),
}));
+const readSessionNotificationPreview = vi.fn(async (_sessionId: string, _includeReply = true): Promise<import('../localDb/sessionNotificationPreview').SessionNotificationPreview> => ({}));
+vi.mock('../localDb/sessionNotificationPreview', () => ({ readSessionNotificationPreview }));
+let ownerScopeCurrent = true;
+let ownerScopeKey = 'account-a:1';
+vi.mock('../device-link/broadcast-tap', () => ({
+ captureDataOwnerBroadcastScope: () => ({ ownerScopeKey }),
+ isDataOwnerBroadcastScopeCurrent: () => ownerScopeCurrent,
+}));
const drainPersistQueue = vi.fn((): Promise<void> => Promise.resolve());
vi.mock('../messagePersistBroadcaster', () => ({
drainPersistQueue: () => drainPersistQueue(),
}));
+const drainSessionActiveTurnWrites = vi.fn((_sessionId: string): Promise<void> => Promise.resolve());
+const getSessionNotificationTurnSignal = vi.fn((_sessionId: string): { id: string; fallbackEventId: string; ended: boolean } | undefined => undefined);
+vi.mock('../localDb/sessionActiveTurn', () => ({
+ drainSessionActiveTurnWrites: (sessionId: string) => drainSessionActiveTurnWrites(sessionId),
+ getSessionNotificationTurnSignal: (sessionId: string) => getSessionNotificationTurnSignal(sessionId),
+}));
interface FakeFeishuIM {
getOwnerOpenId: ReturnType<typeof vi.fn>;
+ sendText: ReturnType<typeof vi.fn>;
sendMarkdownText: ReturnType<typeof vi.fn>;
}
function makeFeishuIm(ownerOpenId: string | null): FakeFeishuIM {
return {
getOwnerOpenId: vi.fn(() => ownerOpenId),
+ sendText: vi.fn(async () => ({ messageId: 'msg-plain' })),
sendMarkdownText: vi.fn(async () => ({ messageId: 'msg-1' })),
};
}
@@ -134,11 +150,20 @@ async function freshService() {
notificationCtor.mockClear();
warn.mockClear();
notificationSupported = true;
+ ownerScopeCurrent = true;
+ ownerScopeKey = 'account-a:1';
markSessionNeedsAttention.mockClear();
- sendMobileSessionNotify.mockClear();
+ sendMobileSessionNotify.mockReset().mockReturnValue(true);
getMobileNotifyGeneration.mockClear();
latestMessageText.mockClear();
+ readSessionNotificationPreview.mockReset().mockImplementation(async (sessionId, includeReply = true) => {
+ if (!includeReply) return {};
+ const text = await latestMessageText(sessionId, 'assistant');
+ return text ? { reply: { clientId: 'reply-id', text }, eventId: 'reply-id' } : {};
+ });
drainPersistQueue.mockClear();
+ drainSessionActiveTurnWrites.mockReset().mockResolvedValue(undefined);
+ getSessionNotificationTurnSignal.mockReset().mockReturnValue(undefined);
const service = await import('../notificationService');
const { setMainLocale } = await import('../i18n');
// 既有分发断言以简中为基准;需要验证其它语言的用例会在调用前显式切换。
@@ -150,6 +175,7 @@ async function invokeHandler(payload: unknown): Promise<void> {
const handler = registeredHandlers.get('notification:show-session-event');
if (!handler) throw new Error('handler not registered');
await handler({} as unknown, payload);
+ await flushAsync();
}
/** mobile 分支是 fire-and-forget 的独立 async 块;断言它之前先把微任务队列排空。 */
@@ -158,7 +184,7 @@ const flushAsync = () => new Promise<void>((resolve) => setTimeout(resolve, 0));
const baseDeps = (feishuIm: FakeFeishuIM) => ({
getWindow: () => null,
// 实参在主进程是 FeishuIM, 测试里用结构兼容的 fake 就够 — 仅访问
- // getOwnerOpenId / sendMarkdownText 两个方法。
+ // getOwnerOpenId / sendText / sendMarkdownText 三个方法。
feishuIm: feishuIm as unknown as Parameters<
Awaited<ReturnType<typeof freshService>>['initNotificationService']
>[0]['feishuIm'],
@@ -240,25 +266,186 @@ describe('notificationService — channels 分发', () => {
expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
});
- it('持久化队列挂死时不阻塞 invoke 与飞书分支(mobile 摘要 fire-and-forget)', async () => {
+ it('delivers a bounded fallback when persistence stalls, without a late or retried duplicate', async () => {
const { initNotificationService } = await freshService();
const feishuIm = makeFeishuIm('ou_owner');
initNotificationService(baseDeps(feishuIm));
- // 队列 pending 不 resolve —— 模拟别的会话慢写入长期占住全局队列。
+ vi.useFakeTimers();
+ let release!: () => void;
+ drainPersistQueue.mockReturnValueOnce(new Promise<void>((resolve) => { release = resolve; }));
+ readSessionNotificationPreview.mockImplementation(async (_id, includeReply = true) => ({
+ teammateName: 'Cindy', eventId: 'turn:100:200',
+ ...(includeReply ? { reply: { clientId: 'final-2', text: '**Finished**' } } : {}),
+ }));
+ const payload = { sessionId: 's1', title: 'Cindy', kind: 'done', channels: { desktop: true, feishu: true, mobile: true } };
+ await registeredHandlers.get('notification:show-session-event')!({}, payload);
+ expect(feishuIm.sendText).not.toHaveBeenCalled();
+ await vi.advanceTimersByTimeAsync(1_000);
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ title: 'Cindy', body: '有新回复' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledWith(expect.objectContaining({ fallbackBody: '有新回复' }));
+ expect(feishuIm.sendText).toHaveBeenCalledWith('ou_owner', 'Cindy\n有新回复');
+ expect((sendMobileSessionNotify.mock.calls[0] as unknown as [Record<string, unknown>])[0]).not.toHaveProperty('eventId');
+ release();
+ await vi.advanceTimersByTimeAsync(0);
+ await registeredHandlers.get('notification:show-session-event')!({}, payload);
+ await vi.advanceTimersByTimeAsync(0);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not treat a pre-drain running snapshot as a reason to lose the completion fallback', async () => {
+ const { initNotificationService } = await freshService();
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ vi.useFakeTimers();
+ let release!: () => void;
+ drainPersistQueue.mockReturnValueOnce(new Promise<void>((resolve) => { release = resolve; }));
+ readSessionNotificationPreview.mockResolvedValueOnce({ teammateName: 'Cindy', suppress: true });
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+
+ await registeredHandlers.get('notification:show-session-event')!({}, payload);
+ await vi.advanceTimersByTimeAsync(1_000);
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ title: 'Cindy', body: '有新回复' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ release();
+ await vi.advanceTimersByTimeAsync(0);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ });
+
+ it('sends the current turn fallback when its terminal marker write failed', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ initNotificationService(baseDeps(feishuIm));
+ getSessionNotificationTurnSignal.mockReturnValue({
+ id: 'signal:ended', fallbackEventId: 'turn:100:200:signal-ended', ended: true,
+ });
+ // The write chain drained, but its swallowed UPDATE failure left SQLite
+ // with startedAt > endedAt. No old final may be used as the preview.
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', suppress: true });
+ const payload = {
+ sessionId: 'bot-main', title: 'Cindy', kind: 'done',
+ channels: { desktop: true, mobile: true, feishu: true },
+ };
+
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ body: '有新回复' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledWith(expect.objectContaining({
+ fallbackBody: '有新回复', eventId: 'turn:100:200:signal-ended',
+ }));
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ expect(feishuIm.sendText).toHaveBeenCalledWith('owner', 'Cindy\n有新回复');
+ });
+
+ it('drops the bounded fallback after the data owner changes', async () => {
+ const { initNotificationService } = await freshService();
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ vi.useFakeTimers();
drainPersistQueue.mockReturnValueOnce(new Promise<void>(() => {}));
+ await registeredHandlers.get('notification:show-session-event')!({}, {
+ sessionId: 's1', title: 'Old account', kind: 'done', channels: { desktop: true, mobile: true },
+ });
+ ownerScopeCurrent = false;
+ await vi.advanceTimersByTimeAsync(1_000);
+ expect(notificationCtor).not.toHaveBeenCalled();
+ expect(sendMobileSessionNotify).not.toHaveBeenCalled();
+ });
- await expect(
- invokeHandler({
- sessionId: 's1',
- title: 'Hello',
- kind: 'done',
- channels: { desktop: false, feishu: true, mobile: true },
- }),
- ).resolves.toBeUndefined();
+ it('device-link handoff does not resend accepted desktop or Feishu replies', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ initNotificationService(baseDeps(feishuIm));
+ getSessionNotificationTurnSignal.mockReturnValue({ id: 'turn:100:200', fallbackEventId: 'turn:100:200', ended: true });
+ getMobileNotifyGeneration.mockReturnValueOnce(7).mockReturnValueOnce(8);
+ const payload = {
+ sessionId: 's1', title: 'Cindy', kind: 'done',
+ channels: { desktop: true, mobile: true, feishu: true },
+ };
+
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
expect(feishuIm.sendMarkdownText).toHaveBeenCalledTimes(1);
- // mobile 发送仍卡在队列上,不应已触发
- await flushAsync();
+ // Mobile retains its own generation so a new link can accept the signal.
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ expect(sendMobileSessionNotify).toHaveBeenLastCalledWith(expect.objectContaining({ generation: 8 }));
+ });
+
+ it('a new data owner keeps its own desktop and Feishu dedupe scope', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ initNotificationService(baseDeps(feishuIm));
+ getSessionNotificationTurnSignal.mockReturnValue({ id: 'turn:100:200', fallbackEventId: 'turn:100:200', ended: true });
+ const payload = { sessionId: 's1', title: 'Cindy', kind: 'done', channels: { desktop: true, feishu: true } };
+
+ await invokeHandler(payload);
+ ownerScopeKey = 'account-b:2';
+ await invokeHandler(payload);
+
+ expect(notificationCtor).toHaveBeenCalledTimes(2);
+ expect(feishuIm.sendMarkdownText).toHaveBeenCalledTimes(2);
+ });
+
+ it('late done cannot consume a newer running turn’s notification identity', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ initNotificationService(baseDeps(feishuIm));
+ const payload = {
+ sessionId: 's1', title: 'Cindy', kind: 'done',
+ channels: { desktop: true, mobile: true, feishu: true },
+ };
+ getSessionNotificationTurnSignal.mockReturnValue({
+ id: 'signal:2', fallbackEventId: 'turn:300:300:signal-2', ended: false,
+ });
+
+ await invokeHandler(payload); // delayed turn A terminal while turn B runs
+ expect(notificationCtor).not.toHaveBeenCalled();
expect(sendMobileSessionNotify).not.toHaveBeenCalled();
+ expect(feishuIm.sendMarkdownText).not.toHaveBeenCalled();
+
+ getSessionNotificationTurnSignal.mockReturnValue({
+ id: 'signal:2', fallbackEventId: 'turn:300:400:signal-2', ended: true,
+ });
+ await invokeHandler(payload); // turn B's own terminal
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ expect(feishuIm.sendMarkdownText).toHaveBeenCalledTimes(1);
+ });
+
+ it.each(['error', 'needs-reply'])('%s desktop notice does not wait for the transcript', async (kind) => {
+ const { initNotificationService } = await freshService();
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ vi.useFakeTimers();
+ drainPersistQueue.mockReturnValueOnce(new Promise<void>(() => {}));
+ await registeredHandlers.get('notification:show-session-event')!({}, {
+ sessionId: 's1', title: 'Hello', kind, channels: { desktop: true, mobile: true },
+ });
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ await vi.advanceTimersByTimeAsync(1_000);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ drainPersistQueue.mockReset().mockResolvedValue();
+ });
+
+ it('keeps the teammate fallback when final preview lookup rejects', async () => {
+ const { initNotificationService } = await freshService();
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ readSessionNotificationPreview.mockResolvedValueOnce({ teammateName: 'Cindy', eventId: 'turn:100:200' })
+ .mockRejectedValueOnce(new Error('read unavailable'));
+ await invokeHandler({ sessionId: 's1', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } });
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ title: 'Cindy', body: '有新回复' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledWith(expect.objectContaining({ fallbackBody: '有新回复' }));
+ });
+
+ it('still delivers the base notice if even the initial lookup fails', async () => {
+ const { initNotificationService } = await freshService();
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ readSessionNotificationPreview.mockRejectedValueOnce(new Error('read unavailable'));
+ await invokeHandler({ sessionId: 's1', title: 'Task', kind: 'done' });
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
});
it('channels.mobile === true → 调用手机推送分发(标题兜底后的 safeTitle)', async () => {
@@ -304,6 +491,7 @@ describe('notificationService — channels 分发', () => {
kind: 'done',
generation: 7,
detail: '修好了,共改了 3 个文件。',
+ eventId: 'reply-id',
});
sendMobileSessionNotify.mockClear();
@@ -423,6 +611,82 @@ describe('notificationService — channels 分发', () => {
'ou_owner',
'Cindy · 任务「Hello」已完成 ✓',
);
+ expect(feishuIm.sendText).not.toHaveBeenCalled();
+ });
+
+ it('伙伴飞书通知使用本轮最终答复的纯文本摘要,重复终态不重发', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('ou_owner');
+ initNotificationService(baseDeps(feishuIm));
+ readSessionNotificationPreview.mockImplementation(async (_id, includeReply = true) => ({
+ teammateName: 'Cindy', eventId: 'turn:100:200',
+ ...(includeReply ? { reply: { clientId: 'final-1', text: '## **修好了**\n[结果](https://example.com)' } } : {}),
+ }));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: false, feishu: true } };
+
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ expect(feishuIm.sendText).toHaveBeenCalledWith('ou_owner', 'Cindy\n修好了 结果');
+ expect(feishuIm.sendMarkdownText).not.toHaveBeenCalled();
+ });
+
+ it('伙伴最终答复没有可读正文时飞书使用本地化新回复兜底', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('ou_owner');
+ initNotificationService(baseDeps(feishuIm));
+ readSessionNotificationPreview.mockImplementation(async (_id, includeReply = true) => ({
+ teammateName: 'Mika', eventId: 'turn:300:400',
+ ...(includeReply ? { reply: { clientId: 'final-2', text: '![image](https://example.com/chart.png)' } } : {}),
+ }));
+
+ await invokeHandler({ sessionId: 'bot-main', title: 'Old title', kind: 'done', channels: { desktop: false, feishu: true } });
+
+ expect(feishuIm.sendText).toHaveBeenCalledWith('ou_owner', 'Mika\n有新回复');
+ expect(feishuIm.sendMarkdownText).not.toHaveBeenCalled();
+ });
+
+ it('飞书发送失败不消耗伙伴回复去重标记,恢复后重试一次', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('ou_owner');
+ feishuIm.sendText.mockRejectedValueOnce(new Error('offline'));
+ initNotificationService(baseDeps(feishuIm));
+ readSessionNotificationPreview.mockImplementation(async (_id, includeReply = true) => ({
+ teammateName: 'Cindy', eventId: 'turn:500:600',
+ ...(includeReply ? { reply: { clientId: 'final-3', text: '继续处理' } } : {}),
+ }));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: false, feishu: true } };
+
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(2);
+ expect(feishuIm.sendText).toHaveBeenLastCalledWith('ou_owner', 'Cindy\n继续处理');
+ });
+
+ it('飞书发送尚未确认时,同一轮并发终态只发送一次', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('ou_owner');
+ let accept!: () => void;
+ feishuIm.sendText.mockImplementationOnce(() => new Promise((resolve) => {
+ accept = () => resolve({ messageId: 'msg-pending' });
+ }));
+ initNotificationService(baseDeps(feishuIm));
+ readSessionNotificationPreview.mockImplementation(async (_id, includeReply = true) => ({
+ teammateName: 'Cindy', eventId: 'turn:700:800',
+ ...(includeReply ? { reply: { clientId: 'final-4', text: '并发完成' } } : {}),
+ }));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: false, feishu: true } };
+
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ accept();
+ await flushAsync();
+ await invokeHandler(payload);
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
});
it('error kind → 桌面与飞书都显示执行失败', async () => {
@@ -521,6 +785,285 @@ describe('notificationService — channels 分发', () => {
expect(notificationCtor).toHaveBeenCalledTimes(1);
expect(warn).toHaveBeenCalledTimes(1);
- expect(warn.mock.calls[0]![0]).toContain('feishu sendMarkdownText failed');
+ expect(warn.mock.calls[0]![0]).toContain('feishu send failed');
+ });
+});
+
+
+describe('teammate reply previews', () => {
+ it('drops a completion whose preview wait spans a later completed turn', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ initNotificationService(baseDeps(feishuIm));
+ const payload = {
+ sessionId: 'bot-main', title: 'Cindy', kind: 'done',
+ channels: { desktop: true, mobile: true, feishu: true },
+ };
+ const turnA = { id: 'signal:A', fallbackEventId: 'turn:100:200:signal-A', ended: true };
+ const turnB = { id: 'signal:B', fallbackEventId: 'turn:300:400:signal-B', ended: true };
+ let currentSignal = turnA;
+ getSessionNotificationTurnSignal.mockImplementation(() => currentSignal);
+ let releaseFirstDrain!: () => void;
+ drainPersistQueue.mockImplementationOnce(() => new Promise<void>(resolve => {
+ releaseFirstDrain = resolve;
+ }));
+ readSessionNotificationPreview.mockImplementation(async (_id, includeReply = true) => ({
+ teammateName: 'Cindy', eventId: 'turn:300:400',
+ ...(includeReply ? { reply: { clientId: 'final-B', text: 'Turn B answer' } } : {}),
+ }));
+
+ await invokeHandler(payload); // A is waiting for persistence.
+ currentSignal = turnB;
+ await invokeHandler(payload); // B completes and sends its own reply.
+ releaseFirstDrain();
+ await flushAsync();
+
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ body: 'Turn B answer' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledWith(expect.objectContaining({ detail: 'Turn B answer' }));
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ expect(feishuIm.sendText).toHaveBeenCalledWith('owner', 'Cindy\nTurn B answer');
+ });
+
+ it('delivers a later turn when its preview fails after the previous turn was identified', async () => {
+ const { initNotificationService } = await freshService();
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+ getSessionNotificationTurnSignal.mockReturnValue({ id: 'signal:1', fallbackEventId: 'turn:100:200:signal-1', ended: true });
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+ await invokeHandler(payload);
+
+ getSessionNotificationTurnSignal.mockReturnValue({ id: 'signal:2', fallbackEventId: 'turn:300:400:signal-2', ended: true });
+ readSessionNotificationPreview.mockRejectedValue(new Error('db busy'));
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(2);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ expect(sendMobileSessionNotify).toHaveBeenLastCalledWith(expect.objectContaining({ eventId: 'turn:300:400:signal-2' }));
+
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:300:400' });
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(2);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ });
+
+ it('keeps a fallback Feishu send in flight under the same turn signal after preview recovery', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ let accept!: () => void;
+ feishuIm.sendText.mockImplementationOnce(() => new Promise((resolve) => {
+ accept = () => resolve({ messageId: 'sent' });
+ }));
+ initNotificationService(baseDeps(feishuIm));
+ getSessionNotificationTurnSignal.mockReturnValue({ id: 'signal:3', fallbackEventId: 'turn:500:600:signal-3', ended: true });
+ readSessionNotificationPreview.mockImplementationOnce(async () => ({ teammateName: 'Cindy' }))
+ .mockRejectedValueOnce(new Error('db busy'));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: false, feishu: true } };
+ await invokeHandler(payload);
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+
+ readSessionNotificationPreview.mockResolvedValue({
+ teammateName: 'Cindy', eventId: 'turn:500:600', reply: { clientId: 'final', text: 'Current answer' },
+ });
+ await invokeHandler(payload);
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ accept();
+ await flushAsync();
+ await invokeHandler(payload);
+ expect(feishuIm.sendText).toHaveBeenCalledTimes(1);
+ });
+
+ it('reconciles an unidentified Feishu send still in flight when a durable turn ID appears', async () => {
+ const { initNotificationService } = await freshService();
+ const feishuIm = makeFeishuIm('owner');
+ let accept!: () => void;
+ feishuIm.sendMarkdownText.mockImplementationOnce(() => new Promise((resolve) => {
+ accept = () => resolve({ messageId: 'sent' });
+ }));
+ initNotificationService(baseDeps(feishuIm));
+ readSessionNotificationPreview.mockRejectedValueOnce(new Error('db busy'));
+ const payload = { sessionId: 'legacy', title: 'Task', kind: 'done', channels: { desktop: false, feishu: true } };
+ await invokeHandler(payload);
+ expect(feishuIm.sendMarkdownText).toHaveBeenCalledTimes(1);
+
+ readSessionNotificationPreview.mockResolvedValue({ eventId: 'turn:100:200' });
+ await invokeHandler(payload);
+ expect(feishuIm.sendMarkdownText).toHaveBeenCalledTimes(1);
+ accept();
+ await flushAsync();
+ await invokeHandler(payload);
+ expect(feishuIm.sendMarkdownText).toHaveBeenCalledTimes(1);
+ });
+
+ it('waits for the current turn marker before using a persisted reply identity', async () => {
+ const { initNotificationService } = await freshService();
+ const oldPreview = {
+ teammateName: 'Cindy', eventId: 'turn:100:200',
+ reply: { clientId: 'old-final', text: 'Previous answer' },
+ };
+ const newPreview = {
+ teammateName: 'Cindy', eventId: 'turn:300:400',
+ reply: { clientId: 'new-final', text: 'Current answer' },
+ };
+ readSessionNotificationPreview.mockResolvedValue(oldPreview);
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+
+ let releaseMarker!: () => void;
+ let markerPersisted = false;
+ const markerBarrier = new Promise<void>((resolve) => {
+ releaseMarker = () => { markerPersisted = true; resolve(); };
+ });
+ drainSessionActiveTurnWrites.mockReturnValueOnce(markerBarrier);
+ readSessionNotificationPreview.mockImplementation(async () => markerPersisted ? newPreview : oldPreview);
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+
+ releaseMarker();
+ await vi.waitFor(() => expect(notificationCtor).toHaveBeenCalledTimes(2));
+ expect(notificationCtor).toHaveBeenLastCalledWith(expect.objectContaining({ body: 'Current answer' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ expect(sendMobileSessionNotify).toHaveBeenLastCalledWith(expect.objectContaining({ eventId: 'turn:300:400' }));
+ });
+
+ it('reconciles an accepted fallback after preview recovery without hiding the next turn', async () => {
+ const { initNotificationService } = await freshService();
+ const clock = vi.spyOn(Date, 'now').mockReturnValue(1_000);
+ try {
+ readSessionNotificationPreview.mockRejectedValueOnce(new Error('db busy'));
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+
+ readSessionNotificationPreview.mockResolvedValue({
+ teammateName: 'Cindy', eventId: 'turn:900:950',
+ reply: { clientId: 'old-final', text: 'Already delivered' },
+ });
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+
+ readSessionNotificationPreview.mockResolvedValue({
+ teammateName: 'Cindy', eventId: 'turn:1100:1200',
+ reply: { clientId: 'new-final', text: 'New answer' },
+ });
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(2);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ } finally {
+ clock.mockRestore();
+ }
+ });
+
+ it('does not consume fallback dedupe when no channel accepted it', async () => {
+ const { initNotificationService } = await freshService();
+ readSessionNotificationPreview.mockRejectedValueOnce(new Error('db busy'));
+ sendMobileSessionNotify.mockReturnValueOnce(false);
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: false, mobile: true } };
+
+ await invokeHandler(payload);
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+ await invokeHandler(payload);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ await invokeHandler(payload);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ });
+
+ it('retries the same final reply after a mobile-only send was rejected, then dedupes the accepted send', async () => {
+ const { initNotificationService } = await freshService();
+ readSessionNotificationPreview.mockResolvedValue({
+ teammateName: 'Cindy', eventId: 'turn:100:200',
+ reply: { clientId: 'final-2', text: '**Ready**' },
+ });
+ sendMobileSessionNotify.mockReturnValueOnce(false);
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: false, mobile: true } };
+
+ await invokeHandler(payload);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ await invokeHandler(payload);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ await invokeHandler(payload);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ expect(notificationCtor).not.toHaveBeenCalled();
+ });
+
+ it('does not repeat an accepted desktop toast when the mobile channel rejects the same reply', async () => {
+ const { initNotificationService } = await freshService();
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+ sendMobileSessionNotify.mockReturnValueOnce(false);
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+
+ await invokeHandler(payload);
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ });
+
+ it('retries only the missing channel after a fallback was delivered', async () => {
+ const { initNotificationService } = await freshService();
+ readSessionNotificationPreview.mockRejectedValueOnce(new Error('db busy'));
+ sendMobileSessionNotify.mockReturnValueOnce(false);
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+
+ await invokeHandler(payload);
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ });
+
+ it('does not mark an unsupported desktop toast as delivered when mobile is also offline', async () => {
+ const { initNotificationService } = await freshService();
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+ notificationSupported = false;
+ sendMobileSessionNotify.mockReturnValueOnce(false);
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy', kind: 'done', channels: { desktop: true, mobile: true } };
+
+ await invokeHandler(payload);
+ expect(notificationCtor).not.toHaveBeenCalled();
+ await invokeHandler(payload);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(2);
+ });
+
+ it('shows current final Markdown as plain text on desktop and keeps mobile routing/fallback', async () => {
+ const { initNotificationService } = await freshService();
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Cindy', eventId: 'turn:100:200', reply: { clientId: 'final-2', text: '**完成**:[报告](https://example.com) `a_b * 2`' } });
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ const payload = { sessionId: 'bot-main', title: 'Cindy · Old title', kind: 'done', channels: { desktop: true, mobile: true } };
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ title: 'Cindy', body: '完成:报告 a_b * 2' }));
+ expect(sendMobileSessionNotify).toHaveBeenCalledWith(expect.objectContaining({ sessionId: 'bot-main', title: 'Cindy', eventId: 'turn:100:200', fallbackBody: '有新回复' }));
+ await invokeHandler(payload);
+ expect(notificationCtor).toHaveBeenCalledTimes(1);
+ expect(sendMobileSessionNotify).toHaveBeenCalledTimes(1);
+ });
+ it('uses localized reply fallback without inventing task completion when there is no body', async () => {
+ const { initNotificationService } = await freshService();
+ const { setMainLocale } = await import('../i18n');
+ setMainLocale('en');
+ readSessionNotificationPreview.mockResolvedValue({ teammateName: 'Mochi' });
+ initNotificationService(baseDeps(makeFeishuIm('owner')));
+ await invokeHandler({ sessionId: 'bot-main', title: 'Mochi', kind: 'done' });
+ expect(notificationCtor).toHaveBeenCalledWith(expect.objectContaining({ title: 'Cindy · Mochi', body: 'New reply' }));
});
});
diff --git a/apps/desktop/src/main/__tests__/sessionNotificationCopy.test.ts b/apps/desktop/src/main/__tests__/sessionNotificationCopy.test.ts
index 80018e2911..81099fdeeb 100644
--- a/apps/desktop/src/main/__tests__/sessionNotificationCopy.test.ts
+++ b/apps/desktop/src/main/__tests__/sessionNotificationCopy.test.ts
@@ -12,6 +12,7 @@ import {
getSessionExternalNotificationText,
getSessionNotificationBody,
getSessionNotificationUntitled,
+ getTeammateNotificationFallback,
} from '../sessionNotificationCopy';
import type { SupportedLocale } from '../../shared/locale';
@@ -121,3 +122,11 @@ describe('session notification copy', () => {
},
);
});
+
+
+it.each([
+ ['en', 'New reply'], ['zh-CN', '有新回复'], ['zh-TW', '有新回覆'], ['ja', '新しい返信'], ['ko', '새 답장'],
+] as const)('uses the current %s locale for a reply with no preview', (locale, expected) => {
+ setMainLocale(locale);
+ expect(getTeammateNotificationFallback()).toBe(expected);
+});
diff --git a/apps/desktop/src/main/__tests__/sessionNotificationPreview.test.ts b/apps/desktop/src/main/__tests__/sessionNotificationPreview.test.ts
new file mode 100644
index 0000000000..a96b5078b7
--- /dev/null
+++ b/apps/desktop/src/main/__tests__/sessionNotificationPreview.test.ts
@@ -0,0 +1,62 @@
+import { afterEach, beforeEach, expect, it } from 'vitest';
+import Database from 'better-sqlite3';
+import { getTableConfig } from 'drizzle-orm/sqlite-core';
+import { sessions, botProfiles, messages, botSessionLinks } from '../localDb/schema';
+import { drizzle } from 'drizzle-orm/better-sqlite3';
+import type { DbClient } from '../localDb/client/DbClient';
+import { setCurrentDbClient, clearCurrentDbClient } from '../localDb/client/current';
+import { readSessionNotificationPreview } from '../localDb/sessionNotificationPreview';
+
+let sqlite: Database.Database;
+let client: DbClient;
+beforeEach(() => {
+ sqlite = new Database(':memory:');
+ for (const table of [sessions, botProfiles, messages, botSessionLinks]) {
+ const { name, columns } = getTableConfig(table);
+ sqlite.exec(`CREATE TABLE "${name}" (${columns.map((column) => `"${column.name}" ${column.getSQLType()}`).join(', ')})`);
+ }
+ const db = drizzle(sqlite);
+ db.insert(sessions).values({ id: 'main', createdAt: 0, updatedAt: 0, source: 'bot', activeTurnStartedAt: 100, lastTurnEndedAt: 200 }).run();
+ db.insert(botProfiles).values({ id: 'bot-1', createdAt: 0, updatedAt: 0, displayName: 'Cindy' }).run();
+ db.insert(botSessionLinks).values({ id: 'link-1', createdAt: 0, sessionId: 'main', botId: 'bot-1', role: 'canonical' }).run();
+ client = { drizzle: db } as unknown as DbClient;
+ setCurrentDbClient(client, 'test-user');
+});
+afterEach(() => { clearCurrentDbClient(client); sqlite.close(); });
+function add(id: string, role: string, content: string, createdAt: number, meta = {}) {
+ sqlite.prepare('INSERT INTO messages (id, client_id, session_id, role, content, created_at, agent_meta) VALUES (?, ?, ?, ?, ?, ?, ?)').run(id, id, 'main', role, content, createdAt, JSON.stringify(meta));
+}
+it('reads canonical teammate identity and this turn final from the durable transcript', async () => {
+ add('final-2', 'assistant', '**完成**', 150, { turnCompleted: true, assistantPhase: 'final_answer' });
+ expect(await readSessionNotificationPreview('main')).toEqual({ teammateName: 'Cindy', reply: { clientId: 'final-2', text: '**完成**' }, eventId: 'turn:100:200' });
+});
+it('suppresses an old idle event after a new input started', async () => {
+ drizzle(sqlite).update(sessions).set({ activeTurnStartedAt: 300 }).run();
+ expect(await readSessionNotificationPreview('main')).toEqual({ teammateName: 'Cindy', suppress: true });
+});
+it('does not reuse an older final in a tool-only completed turn', async () => {
+ add('old', 'assistant', 'Old answer', 10, { turnCompleted: true });
+ expect(await readSessionNotificationPreview('main')).toEqual({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+});
+it('uses insertion order for a tool and final arriving in the same millisecond', async () => {
+ add('z-tool', 'tool_result', 'tool output', 150);
+ add('a-final', 'assistant', 'Current answer', 150, { turnCompleted: true, assistantPhase: 'final_answer' });
+ expect(await readSessionNotificationPreview('main')).toMatchObject({ reply: { clientId: 'a-final', text: 'Current answer' } });
+ // A subsequent tool at the same timestamp must still prevent a stale preamble.
+ add('0-next-tool', 'tool_use', 'next action', 150);
+ expect(await readSessionNotificationPreview('main')).toHaveProperty('reply', undefined);
+});
+it('keeps completion identity stable before and after the final reply is persisted', async () => {
+ const before = await readSessionNotificationPreview('main', false);
+ add('final-2', 'assistant', 'Finished', 150, { turnCompleted: true });
+ const after = await readSessionNotificationPreview('main');
+ expect(before).toEqual({ teammateName: 'Cindy', eventId: 'turn:100:200' });
+ expect(after.eventId).toBe(before.eventId);
+ expect(after.reply?.text).toBe('Finished');
+});
+
+it('does not preview a final reply removed by rewind', async () => {
+ add('removed', 'assistant', 'Retracted private answer', 150, { turnCompleted: true });
+ sqlite.exec("UPDATE messages SET rewind_at = 201 WHERE client_id = 'removed'");
+ expect((await readSessionNotificationPreview('main')).reply).toBeUndefined();
+});
diff --git a/apps/desktop/src/main/device-link/__tests__/mobileNotify.test.ts b/apps/desktop/src/main/device-link/__tests__/mobileNotify.test.ts
index adb25c8db3..c06dc1b825 100644
--- a/apps/desktop/src/main/device-link/__tests__/mobileNotify.test.ts
+++ b/apps/desktop/src/main/device-link/__tests__/mobileNotify.test.ts
@@ -1,6 +1,6 @@
import { createHash } from 'node:crypto';
import { describe, expect, it } from 'vitest';
-import { NOTIFY_TITLE_MAX_LENGTH } from '@cindy/device-link';
+import { NOTIFY_TITLE_MAX_LENGTH, NOTIFY_BODY_MAX_LENGTH } from '@cindy/device-link';
import { MobileNotifyDeduper, buildSessionNotifyPayload } from '../mobileNotify';
describe('buildSessionNotifyPayload', () => {
@@ -42,6 +42,14 @@ describe('buildSessionNotifyPayload', () => {
).toBe('需要你回覆');
});
+ it.each(['😀'.repeat(240), 'a'.repeat(239) + '😀', '**中文😀** '.repeat(100)])('keeps emoji and mixed Markdown within the wire limit (case %#)', (detail) => {
+ const { body } = buildSessionNotifyPayload({ ...base, detail });
+ expect(body).toBeDefined();
+ expect(body!.length).toBeLessThanOrEqual(NOTIFY_BODY_MAX_LENGTH);
+ expect(body).not.toMatch(/[\uD800-\uDBFF]$/u);
+ expect(body).not.toContain('**');
+ });
+
it('collapseId 哈希压缩:长 deviceId 也稳定在 32 hex(APNs 64B 上限内),不同会话不同键', () => {
const longDevice = { ...base, selfDeviceId: 'f'.repeat(64) };
const a = buildSessionNotifyPayload(longDevice).collapseId;
@@ -66,9 +74,16 @@ describe('buildSessionNotifyPayload', () => {
});
describe('MobileNotifyDeduper', () => {
+ it('uses the terminal boundary of a fallback signal to distinguish a later turn from scheduler output', () => {
+ const deduper = new MobileNotifyDeduper();
+ deduper.recordSent('session', 'done', 250);
+ expect(deduper.shouldSend('session', 'done', 260, 'turn:100:200:signal-1')).toBe(false);
+ expect(deduper.shouldSend('session', 'done', 410, 'turn:300:400:signal-2')).toBe(true);
+ });
it('同 session + kind 窗口内只放行一次,窗口滚动后恢复', () => {
const deduper = new MobileNotifyDeduper(5_000);
expect(deduper.shouldSend('s1', 'done', 0)).toBe(true);
+ deduper.recordSent('s1', 'done', 0);
expect(deduper.shouldSend('s1', 'done', 4_999)).toBe(false);
expect(deduper.shouldSend('s1', 'done', 5_000)).toBe(true);
});
@@ -79,4 +94,37 @@ describe('MobileNotifyDeduper', () => {
expect(deduper.shouldSend('s1', 'done', 1)).toBe(true);
expect(deduper.shouldSend('s2', 'done', 2)).toBe(true);
});
+
+ it('reconciles an accepted anonymous scheduler push with the same durable turn', () => {
+ const deduper = new MobileNotifyDeduper();
+ deduper.recordSent('session', 'done', 1_000);
+ expect(deduper.shouldSend('session', 'done', 1_001, 'turn:900:950')).toBe(false);
+ expect(deduper.shouldSend('session', 'done', 10_000, 'turn:900:950')).toBe(false);
+ expect(deduper.shouldSend('session', 'done', 1_200, 'turn:950:1100')).toBe(true);
+ expect(deduper.shouldSend('session', 'done', 10_100, 'turn:10050:10075')).toBe(true);
+ });
+
+ it('keeps an anonymous scheduler push out of the recent identified completion window', () => {
+ const deduper = new MobileNotifyDeduper();
+ deduper.recordSent('session', 'done', 1_000, 'turn:900:950');
+ expect(deduper.shouldSend('session', 'done', 1_001)).toBe(false);
+ expect(deduper.shouldSend('session', 'done', 6_000)).toBe(true);
+ });
+});
+
+it('uses final-message identity for completed replies, allowing distinct replies within five seconds', () => {
+ const dedupe = new MobileNotifyDeduper();
+ expect(dedupe.shouldSend('bot', 'done', 100, 'answer-1')).toBe(true);
+ // A relay rejection leaves the first answer eligible for a later attempt.
+ expect(dedupe.shouldSend('bot', 'done', 101, 'answer-1')).toBe(true);
+ dedupe.recordSent('bot', 'done', 101, 'answer-1');
+ expect(dedupe.shouldSend('bot', 'done', 102, 'answer-1')).toBe(false);
+ expect(dedupe.shouldSend('bot', 'done', 101, 'answer-2')).toBe(true);
+ dedupe.recordSent('bot', 'done', 101, 'answer-2');
+ expect(dedupe.shouldSend('bot', 'done', 100_000, 'answer-2')).toBe(false);
+});
+it('sends plain text to APNs, not Markdown or image paths', () => {
+ const payload = { sessionId: 'bot', title: 'Cindy', kind: 'done' as const, selfDeviceId: 'home', fallbackBody: 'New reply' };
+ expect(buildSessionNotifyPayload({ ...payload, detail: '**Report** [ready](https://example.com) `a_b`' }).body).toBe('Report ready a_b');
+ expect(buildSessionNotifyPayload({ ...payload, detail: '![private](/private/file.png)' }).body).toBe('New reply');
});
diff --git a/apps/desktop/src/main/device-link/index.ts b/apps/desktop/src/main/device-link/index.ts
index ae59743afe..8f74beaaf3 100644
--- a/apps/desktop/src/main/device-link/index.ts
+++ b/apps/desktop/src/main/device-link/index.ts
@@ -1874,6 +1874,8 @@ export function sendMobileSessionNotify(payload: {
kind: MobileSessionEventKind;
/** 内容摘要(最近一条 assistant 内容 / 定时任务结果),缺省回退终态短文案 */
detail?: string;
+ fallbackBody?: string;
+ eventId?: string;
/**
* 发起时捕获的 getMobileNotifyGeneration()。调用路径里有 await(取正文/等
* 其它通道)时必传:与当前代次不一致说明期间发生过登出/失去持有权,任务
@@ -1896,18 +1898,20 @@ export function sendMobileSessionNotify(payload: {
);
return false;
}
- if (!mobileNotifyDeduper.shouldSend(payload.sessionId, payload.kind)) return false;
+ const now = Date.now();
+ if (!mobileNotifyDeduper.shouldSend(payload.sessionId, payload.kind, now, payload.eventId)) return false;
const sent = client.sendNotify(
buildSessionNotifyPayload({
sessionId: payload.sessionId,
title: payload.title,
kind: payload.kind,
selfDeviceId,
- fallbackBody: getSessionNotificationBody(payload.kind),
+ fallbackBody: payload.fallbackBody ?? getSessionNotificationBody(payload.kind),
detail: payload.detail,
}),
);
if (sent) {
+ mobileNotifyDeduper.recordSent(payload.sessionId, payload.kind, now, payload.eventId);
log.debug(`mobile notify sent: session=${payload.sessionId.slice(0, 8)} kind=${payload.kind}`);
}
return sent;
diff --git a/apps/desktop/src/main/device-link/mobileNotify.ts b/apps/desktop/src/main/device-link/mobileNotify.ts
index 2b63d9fed8..5401f59ce7 100644
--- a/apps/desktop/src/main/device-link/mobileNotify.ts
+++ b/apps/desktop/src/main/device-link/mobileNotify.ts
@@ -1,4 +1,5 @@
import { createHash } from 'node:crypto';
+import { notificationPreview } from '../notificationPreview.js';
import {
NOTIFY_BODY_MAX_LENGTH,
NOTIFY_TITLE_MAX_LENGTH,
@@ -41,7 +42,7 @@ export function buildSessionNotifyPayload(opts: {
0,
NOTIFY_TITLE_MAX_LENGTH,
);
- const detail = opts.detail?.replace(/\s+/g, ' ').trim().slice(0, NOTIFY_BODY_MAX_LENGTH);
+ const detail = opts.detail ? notificationPreview(opts.detail, NOTIFY_BODY_MAX_LENGTH) : '';
return {
category: CATEGORY_BY_KIND[opts.kind],
title: safeTitle,
@@ -60,22 +61,50 @@ export function buildSessionNotifyPayload(opts: {
}
/**
- * 短窗去重:同 session + 同 kind 在窗口内只发一条。覆盖 renderer 事件源的重复触发
+ * 有回复标识时按同 session + 同 kind + 回复去重;不同回复不受时间窗口限制。
+ * 无标识的调度事件保留短窗兜底,并与同轮的持久 turn 标识对账。覆盖 renderer 事件源的重复触发
* (如 needs-reply 连续弹多个审批);不同 kind 不互压 —— done 紧跟 error 各有信息量,
* 系统层还有 collapseId 合并兜底。
*/
export class MobileNotifyDeduper {
+ private readonly lastEvent = new Map<string, string>();
private readonly lastSentAt = new Map<string, number>();
+ private readonly lastAnonymousSentAt = new Map<string, number>();
constructor(private readonly windowMs = 5_000) {}
- shouldSend(sessionId: string, kind: MobileSessionEventKind, now = Date.now()): boolean {
+ shouldSend(sessionId: string, kind: MobileSessionEventKind, now = Date.now(), eventId?: string): boolean {
const key = `${sessionId}:${kind}`;
+ if (eventId) {
+ if (this.lastEvent.get(key) === eventId) return false;
+ const anonymousAt = this.lastAnonymousSentAt.get(key);
+ if (anonymousAt !== undefined) {
+ // Scheduler still sends an unlabelled completion. Its accepted frame
+ // and the renderer's durable turn ID can describe the same run. A turn
+ // already finished when that frame was sent is the same completion;
+ // a later completed turn keeps its own notification even if it started earlier.
+ const endedAt = /^turn:\d+:(\d+)(?::signal-\d+)?$/.exec(eventId)?.[1];
+ if (endedAt ? Number(endedAt) <= anonymousAt : now - anonymousAt < this.windowMs) {
+ this.lastEvent.set(key, eventId);
+ return false;
+ }
+ }
+ return true;
+ }
const last = this.lastSentAt.get(key);
- if (last !== undefined && now - last < this.windowMs) return false;
+ return last === undefined || now - last >= this.windowMs;
+ }
+
+ /** Record only a frame accepted by the local relay client. */
+ recordSent(sessionId: string, kind: MobileSessionEventKind, now = Date.now(), eventId?: string): void {
+ const key = `${sessionId}:${kind}`;
this.lastSentAt.set(key, now);
+ if (eventId) {
+ this.lastEvent.set(key, eventId);
+ } else {
+ this.lastAnonymousSentAt.set(key, now);
+ }
this.sweep(now);
- return true;
}
/** 顺路清理过期条目(记录量 = 活跃会话数,轻量,无需独立定时器)。 */
diff --git a/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts b/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts
index e38605d41f..4a65784a98 100644
--- a/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts
+++ b/apps/desktop/src/main/localDb/__tests__/sessionActiveTurn.test.ts
@@ -118,21 +118,31 @@ describe('sessionActiveTurn', () => {
}
it('markSessionTurnStarted / markSessionTurnEnded write the two timestamps', async () => {
- const { markSessionTurnStarted, markSessionTurnEnded } = await import('../sessionActiveTurn.js');
+ const { markSessionTurnStarted, markSessionTurnEnded, getSessionNotificationTurnSignal, drainSessionActiveTurnWrites } = await import('../sessionActiveTurn.js');
const client = createTestDbClient();
await seedSession(client, 's-1');
markSessionTurnStarted('s-1');
+ const firstSignal = getSessionNotificationTurnSignal('s-1');
+ expect(firstSignal?.id).toMatch(/^signal:\d+$/);
+ expect(firstSignal?.ended).toBe(false);
await vi.waitFor(async () => {
expect((await readMarks(client, 's-1'))?.active_turn_started_at).toBeTypeOf('number');
});
markSessionTurnEnded('s-1');
+ expect(getSessionNotificationTurnSignal('s-1')?.id).toBe(firstSignal?.id);
+ expect(getSessionNotificationTurnSignal('s-1')?.ended).toBe(true);
+ expect(getSessionNotificationTurnSignal('s-1')?.fallbackEventId).toMatch(/^turn:\d+:\d+:signal-\d+$/);
await vi.waitFor(async () => {
const row = await readMarks(client, 's-1');
expect(row?.last_turn_ended_at).toBeTypeOf('number');
expect(row!.last_turn_ended_at!).toBeGreaterThanOrEqual(row!.active_turn_started_at!);
});
+ markSessionTurnStarted('s-1');
+ expect(getSessionNotificationTurnSignal('s-1')?.id).not.toBe(firstSignal?.id);
+ expect(getSessionNotificationTurnSignal('s-1')?.ended).toBe(false);
+ await drainSessionActiveTurnWrites('s-1');
});
it('per-session write chain keeps started/ended landing order for very short turns', async () => {
@@ -154,6 +164,21 @@ describe('sessionActiveTurn', () => {
expect(row!.last_turn_ended_at!).toBeGreaterThanOrEqual(row!.active_turn_started_at!);
});
+ it('drains the queued turn markers before a completion reader uses them', async () => {
+ const { markSessionTurnStarted, markSessionTurnEnded, drainSessionActiveTurnWrites } =
+ await import('../sessionActiveTurn.js');
+ const client = createTestDbClient();
+ await seedSession(client, 's-notification');
+
+ markSessionTurnStarted('s-notification');
+ markSessionTurnEnded('s-notification');
+ await drainSessionActiveTurnWrites('s-notification');
+
+ const row = await readMarks(client, 's-notification');
+ expect(row?.active_turn_started_at).toBeTypeOf('number');
+ expect(row?.last_turn_ended_at).toBeGreaterThanOrEqual(row!.active_turn_started_at!);
+ });
+
it('markSessionTurnEnded honors endedAtOverride so deferred writes keep the frozen timestamp', async () => {
const { markSessionTurnStarted, markSessionTurnEnded } = await import('../sessionActiveTurn.js');
const client = createTestDbClient();
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
index e9580908d3..1479fa2402 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botCanonicalSession.test.ts
@@ -6,6 +6,7 @@ import { setMainLocale } from '../../../i18n';
import Database from 'better-sqlite3';
import { AgentInputCoordinator } from '../../../maker-ipc/agent-input-coordinator';
import { createSessionQueueControlService } from '../../../maker-ipc/sessionQueueControl';
+import { createMessage } from '../messages';
import { authorizeSessionQueueItem, rebuildSessionQueueItem } from '../../../maker-ipc/sessionControlService';
import type { AgentInputQueuedMessage } from '../../../../shared/agentInputQueue';
import type { ProviderView } from '@cindy/model-providers';
@@ -3468,6 +3469,8 @@ describe('Bot Session task end-to-end runtime', () => {
resolveInteraction?: NonNullable<
Parameters<typeof createBotDelegationService>[0]['resolveInteraction']
>;
+ onResultReceiptPersisted?: () => Promise<void>;
+ onCompletionDispatched?: () => Promise<void>;
} = {}) {
const accountReady = options.accountReady ?? (() => true);
const started: StartedTurn[] = [];
@@ -3659,7 +3662,11 @@ describe('Bot Session task end-to-end runtime', () => {
return { ok: true as const, targetSessionId: params.targetSessionId, wakeKind: 'queued' as const };
}
}
- return dispatchDirect(params);
+ const result = await dispatchDirect(params);
+ if (result.ok && params.clientId?.startsWith('bot-delegation-completion:')) {
+ await options.onCompletionDispatched?.();
+ }
+ return result;
});
const abortSession = vi.fn(async (id: string): Promise<void> => { coordinator?.stop(id); });
@@ -3701,6 +3708,18 @@ describe('Bot Session task end-to-end runtime', () => {
} } : {}),
readCallerRuntime: options.readCallerRuntime,
readCallerPermission: options.readCallerPermission,
+ persistTimelineMessage: options.onResultReceiptPersisted ? async params => {
+ await createMessage(params.sessionId, {
+ clientId: params.clientId,
+ role: params.role,
+ content: params.content,
+ createdAt: params.createdAt,
+ agentMeta: params.agentMeta as Parameters<typeof createMessage>[1]['agentMeta'],
+ });
+ if (params.clientId.startsWith('bot-delegation-result:')) {
+ await options.onResultReceiptPersisted?.();
+ }
+ } : undefined,
dispatch,
abortSession,
closeSession,
@@ -5887,6 +5906,157 @@ describe('Bot Session task end-to-end runtime', () => {
} finally { runtime.dispose(); }
});
+ it('persists independent receipts before queued wakeups for simultaneous results and an interleaved input', async () => {
+ await seedPair();
+ const runtime = createDelegationRuntime({ collectArtifacts: async () => [{ path: 'report.pdf', absolutePath: '/reports/report.pdf', status: 'added' }] });
+ try {
+ const first = await runtime.delegation.startSessionTask({ callerSessionId: 'session-1', objective: 'First report' });
+ const second = await runtime.delegation.startSessionTask({ callerSessionId: 'session-1', objective: 'Second report' });
+ if (!first.ok || !second.ok) throw new Error('Tasks did not start');
+ h.sqlite!.prepare('UPDATE sessions SET working_dir = ? WHERE id IN (?, ?)').run('/child-task', first.childSessionId, second.childSessionId);
+ await runtime.dispatch({ targetSessionId: 'session-1', message: 'Another input', clientId: 'interleaved' });
+ await Promise.all([
+ runtime.settleChild(first.childSessionId, '![chart](https://example.com/chart.png)'),
+ runtime.settleChild(second.childSessionId, '[Report](https://example.com/report.pdf)'),
+ ]);
+ const results = h.sqlite!.prepare('SELECT client_id, agent_meta FROM messages WHERE session_id = ? AND client_id LIKE ? ORDER BY created_at')
+ .all('session-1', 'bot-delegation-result:%') as { agent_meta: string }[];
+ expect(results).toHaveLength(2);
+ expect(results.every(row => JSON.parse(row.agent_meta).botCollaboration.result.workingDir === '/child-task')).toBe(true);
+ expect(results.map(row => JSON.parse(row.agent_meta).botCollaboration.result.text).sort()).toEqual([
+ '![chart](https://example.com/chart.png)', '[Report](https://example.com/report.pdf)',
+ ].sort());
+ expect(results.every(row => JSON.parse(row.agent_meta).botCollaboration.result.artifacts[0].absolutePath === '/reports/report.pdf')).toBe(true);
+ expect(runtime.started.filter(turn => turn.sessionId === first.childSessionId)).toHaveLength(1);
+ expect(runtime.started.filter(turn => turn.sessionId === second.childSessionId)).toHaveLength(1);
+ } finally { runtime.dispose(); }
+ });
+
+ it('rehomes a result receipt when its parent is physically deleted after persistence', async () => {
+ await seedPair();
+ let replacementSessionId: string | undefined;
+ const runtime = createDelegationRuntime({
+ onResultReceiptPersisted: async () => {
+ if (replacementSessionId) return;
+ // The receipt was committed, then parent deletion cascades it away
+ // before the completion wake-up can be delivered.
+ h.sqlite!.prepare("DELETE FROM sessions WHERE id = 'session-1'").run();
+ const recovered = await invoke('local-db:bots:create-canonical-session', {
+ botId: 'bot-a',
+ expectedCanonicalSessionId: null,
+ expectedProfileVersion: 1,
+ });
+ replacementSessionId = recovered.canonicalSessionId as string;
+ },
+ });
+ try {
+ const started = await runtime.delegation.startSessionTask({
+ callerSessionId: 'session-1', objective: 'Preserve the final report',
+ });
+ if (!started.ok) throw new Error('Task did not start');
+ await runtime.settleChild(started.childSessionId, '[Report](https://example.com/report.pdf)');
+
+ expect(replacementSessionId).toBeTruthy();
+ expect(h.sqlite!.prepare('SELECT session_id, agent_meta FROM messages WHERE client_id = ?')
+ .get(`bot-delegation-result:${started.delegationId}:1`)).toMatchObject({
+ session_id: replacementSessionId,
+ agent_meta: expect.stringContaining('https://example.com/report.pdf'),
+ });
+ expect(h.sqlite!.prepare('SELECT completion_delivered_at FROM bot_delegations WHERE id = ?')
+ .pluck().get(started.delegationId)).not.toBeNull();
+ expect(runtime.started.some(turn => turn.sessionId === replacementSessionId)).toBe(true);
+ } finally { runtime.dispose(); }
+ });
+
+ it('retries the completion wake when its original target disappears after dispatch', async () => {
+ await seedPair();
+ let replacementSessionId: string | undefined;
+ const runtime = createDelegationRuntime({
+ onCompletionDispatched: async () => {
+ if (replacementSessionId) return;
+ h.sqlite!.prepare("DELETE FROM sessions WHERE id = 'session-1'").run();
+ const recovered = await invoke('local-db:bots:create-canonical-session', {
+ botId: 'bot-a', expectedCanonicalSessionId: null, expectedProfileVersion: 1,
+ });
+ replacementSessionId = recovered.canonicalSessionId as string;
+ },
+ });
+ try {
+ const started = await runtime.delegation.startSessionTask({
+ callerSessionId: 'session-1', objective: 'Keep the report and wake its requester',
+ });
+ if (!started.ok) throw new Error('Task did not start');
+ await runtime.settleChild(started.childSessionId, 'The final report.');
+
+ expect(replacementSessionId).toBeTruthy();
+ expect(h.sqlite!.prepare('SELECT session_id FROM messages WHERE client_id = ?')
+ .get(`bot-delegation-result:${started.delegationId}:1`)).toEqual({ session_id: replacementSessionId });
+ expect(h.sqlite!.prepare('SELECT completion_delivered_at FROM bot_delegations WHERE id = ?')
+ .pluck().get(started.delegationId)).toBeNull();
+ expect(h.sqlite!.prepare('SELECT 1 FROM messages WHERE session_id = ? AND client_id = ?')
+ .get(replacementSessionId, `bot-delegation-completion:${started.delegationId}`)).toBeUndefined();
+
+ await runtime.delegation.restore();
+ expect(h.sqlite!.prepare('SELECT 1 FROM messages WHERE session_id = ? AND client_id = ?')
+ .get(replacementSessionId, `bot-delegation-completion:${started.delegationId}`)).toBeTruthy();
+ expect(h.sqlite!.prepare('SELECT completion_delivered_at FROM bot_delegations WHERE id = ?')
+ .pluck().get(started.delegationId)).not.toBeNull();
+ } finally { runtime.dispose(); }
+ });
+
+ it.each(['paused-bot', 'archived-parent'] as const)(
+ 'keeps the result in the original conversation when the requester is %s',
+ async (requesterState) => {
+ await seedPair();
+ const runtime = createDelegationRuntime({
+ collectArtifacts: async () => [{ path: 'report.pdf', absolutePath: '/reports/report.pdf', status: 'added' }],
+ });
+ try {
+ const started = await runtime.delegation.startSessionTask({
+ callerSessionId: 'session-1', objective: 'Produce a report',
+ });
+ if (!started.ok) throw new Error('Task did not start');
+ if (requesterState === 'paused-bot') {
+ h.sqlite!.prepare("UPDATE bot_profiles SET status = 'paused' WHERE id = 'bot-a'").run();
+ } else {
+ h.sqlite!.prepare("UPDATE sessions SET status = 'archived' WHERE id = 'session-1'").run();
+ }
+
+ await runtime.settleChild(started.childSessionId, '[Report](https://example.com/report.pdf)');
+ const receipt = h.sqlite!.prepare(
+ 'SELECT session_id, agent_meta FROM messages WHERE client_id = ?',
+ ).get(`bot-delegation-result:${started.delegationId}:1`) as {
+ session_id: string; agent_meta: string;
+ };
+ expect(receipt.session_id).toBe('session-1');
+ expect(JSON.parse(receipt.agent_meta).botCollaboration.result).toMatchObject({
+ runSequence: 1,
+ status: 'completed',
+ text: '[Report](https://example.com/report.pdf)',
+ artifacts: [{ absolutePath: '/reports/report.pdf' }],
+ });
+ expect(h.sqlite!.prepare('SELECT completion_delivered_at FROM bot_delegations WHERE id = ?')
+ .pluck().get(started.delegationId)).toBeNull();
+ expect(runtime.dispatch.mock.calls.some(([input]) => input.clientId ===
+ `bot-delegation-completion:${started.delegationId}`)).toBe(false);
+ await runtime.delegation.restore();
+ expect(h.sqlite!.prepare('SELECT COUNT(*) FROM messages WHERE client_id = ?').pluck()
+ .get(`bot-delegation-result:${started.delegationId}:1`)).toBe(1);
+
+ if (requesterState === 'paused-bot') {
+ h.sqlite!.prepare("UPDATE bot_profiles SET status = 'active' WHERE id = 'bot-a'").run();
+ } else {
+ h.sqlite!.prepare("UPDATE sessions SET status = 'active' WHERE id = 'session-1'").run();
+ }
+ await runtime.delegation.restore();
+ expect(h.sqlite!.prepare('SELECT COUNT(*) FROM messages WHERE client_id = ?').pluck()
+ .get(`bot-delegation-result:${started.delegationId}:1`)).toBe(1);
+ expect(runtime.dispatch.mock.calls.filter(([input]) => input.clientId ===
+ `bot-delegation-completion:${started.delegationId}`)).toHaveLength(1);
+ } finally { runtime.dispose(); }
+ },
+ );
+
it('delivers every continued run once without reusing the previous completion receipt', async () => {
await seedPair();
const runtime = createDelegationRuntime();
@@ -5934,6 +6104,16 @@ describe('Bot Session task end-to-end runtime', () => {
content: expect.stringContaining('第二版结果,含风险清单。'),
}),
]);
+ const resultCards = h.sqlite!.prepare(
+ 'SELECT client_id, agent_meta FROM messages WHERE session_id = ? AND client_id LIKE ? ORDER BY created_at',
+ ).all('session-1', `bot-delegation-result:${started.delegationId}:%`) as Array<{ client_id: string; agent_meta: string }>;
+ const workingDir = h.sqlite!.prepare('SELECT working_dir FROM sessions WHERE id = ?').pluck().get(started.childSessionId);
+ expect(resultCards.map(row => JSON.parse(row.agent_meta).botCollaboration.result)).toEqual([
+ { workingDir, runSequence: 1, status: 'completed', text: '第一版结果。', artifacts: [] },
+ { workingDir, runSequence: 2, status: 'completed', text: '第二版结果,含风险清单。', artifacts: [] },
+ ]);
+ expect(h.sqlite!.prepare('SELECT COUNT(*) AS n FROM messages WHERE client_id = ?')
+ .get(`bot-delegation-request:${started.delegationId}`)).toEqual({ n: 1 });
await expect(
runtime.delegation.getSessionTask('session-1', started.delegationId),
).resolves.toMatchObject({
@@ -6010,7 +6190,7 @@ describe('Bot Session task end-to-end runtime', () => {
}
});
- it('recovers the child answer from the transcript when done.result is empty', async () => {
+ it.each(['delegation-request', 'interjection', 'delegation-result'])('recovers the child answer without promoting a nested %s receipt', async (nestedRole) => {
await seedPair();
const runtime = createDelegationRuntime();
try {
@@ -6029,6 +6209,9 @@ describe('Bot Session task end-to-end runtime', () => {
'三个版本都兼容。交付物:cindy-media://blobs/recovered-result.png',
20_000,
);
+ h.sqlite!.prepare(`INSERT INTO messages (id, client_id, session_id, role, content, created_at, agent_meta)
+ VALUES ('nested', 'nested', ?, 'assistant', 'Nested result, not the outer answer', 21000, ?)`)
+ .run(childSessionId, JSON.stringify({ botCollaboration: { role: nestedRole } }));
await runtime.delegation.settleSession({
childSessionId,
outcome: 'done',
@@ -6069,6 +6252,16 @@ describe('Bot Session task end-to-end runtime', () => {
const receipt = h.sqlite!.prepare(
'SELECT content FROM messages WHERE session_id = ? AND client_id = ?',
).pluck().get('session-1', `bot-delegation-completion:${delegated.delegationId}`);
+ const resultCard = h.sqlite!.prepare('SELECT agent_meta FROM messages WHERE client_id = ?')
+ .get(`bot-delegation-result:${delegated.delegationId}:1`) as { agent_meta: string };
+ expect(JSON.parse(resultCard.agent_meta).botCollaboration.result).toMatchObject({
+ status: 'failed', text: '已确认前两个版本兼容,第三个版本', error: 'Pi reached the model output limit.',
+ });
+ await expect(runtime.delegation.messageSessionTask('session-1', delegated.delegationId, { kind: 'message', text: 'Continue' }))
+ .resolves.toMatchObject({ ok: true, resumed: true });
+ await runtime.settleChild(delegated.childSessionId, 'Recovered result');
+ expect(h.sqlite!.prepare('SELECT agent_meta FROM messages WHERE client_id = ?').pluck()
+ .get(`bot-delegation-result:${delegated.delegationId}:1`)).toBe(resultCard.agent_meta);
expect(receipt).toContain('已确认前两个版本兼容,第三个版本');
expect(receipt).toContain('Pi reached the model output limit.');
} finally {
@@ -6428,6 +6621,11 @@ describe('Bot Session task end-to-end runtime', () => {
error: '到了约定时间后台任务还没有交回结果',
},
});
+ const resultCard = h.sqlite!.prepare('SELECT agent_meta FROM messages WHERE client_id = ?').pluck()
+ .get(`bot-delegation-result:${started.delegationId}:1`) as string;
+ expect(JSON.parse(resultCard).botCollaboration.result).toMatchObject({
+ status: 'timed-out', error: 'TIMEOUT: 到了约定时间后台任务还没有交回结果',
+ });
} finally {
runtime.dispose();
vi.useRealTimers();
@@ -6533,6 +6731,8 @@ describe('Bot Session task end-to-end runtime', () => {
const afterRestart = createDelegationRuntime();
try {
await afterRestart.delegation.restore();
+ expect(h.sqlite!.prepare('SELECT COUNT(*) AS n FROM messages WHERE client_id = ?')
+ .get(`bot-delegation-result:${started.delegationId}:1`)).toEqual({ n: 1 });
expect(
h.sqlite!.prepare('SELECT content FROM messages WHERE session_id = ? AND client_id = ?')
.pluck().get('session-1', `bot-delegation-completion:${started.delegationId}`),
diff --git a/apps/desktop/src/main/localDb/latestMessageText.logic.ts b/apps/desktop/src/main/localDb/latestMessageText.logic.ts
index b6a6fa5031..f5d9ecbe0e 100644
--- a/apps/desktop/src/main/localDb/latestMessageText.logic.ts
+++ b/apps/desktop/src/main/localDb/latestMessageText.logic.ts
@@ -107,7 +107,7 @@ function isBotCollaborationCardRow(meta: Record<string, unknown>): boolean {
return false;
}
const role = (collaboration as { role?: unknown }).role;
- return role === 'delegation-request' || role === 'interjection';
+ return role === 'delegation-request' || role === 'delegation-result' || role === 'interjection';
}
/** Only an explicit user send starts a new title turn; steer stays inside the current turn. */
diff --git a/apps/desktop/src/main/localDb/sessionActiveTurn.ts b/apps/desktop/src/main/localDb/sessionActiveTurn.ts
index 8464d7d020..ba2717a715 100644
--- a/apps/desktop/src/main/localDb/sessionActiveTurn.ts
+++ b/apps/desktop/src/main/localDb/sessionActiveTurn.ts
@@ -152,6 +152,28 @@ function notifyTurnEndedPersisted(sessionId: string, endedAt: number, context: u
/** started / ended 的 per-session 写链:只做 UPDATE 排队保序,无读改写。 */
const _writeChains = new Map<string, Promise<void>>();
+// Captured synchronously at the running edge, before either durable queue can
+// stall. Notification delivery uses this turn boundary when its DB preview is
+// unavailable; a later turn must never inherit the previous turn's dedupe key.
+const _notificationTurns = new Map<string, { startedAt: number; sequence: number; endedAt?: number }>();
+let _notificationTurnSequence = 0;
+
+export function getSessionNotificationTurnSignal(sessionId: string): { id: string; fallbackEventId: string; ended: boolean } | undefined {
+ const turn = _notificationTurns.get(sessionId);
+ if (!turn) return undefined;
+ return {
+ id: `signal:${turn.sequence}`,
+ ended: turn.endedAt !== undefined,
+ // The mobile deduper can reconcile an anonymous scheduler completion by
+ // terminal time even while SQLite is unavailable.
+ fallbackEventId: `turn:${turn.startedAt}:${turn.endedAt ?? turn.startedAt}:signal-${turn.sequence}`,
+ };
+}
+
+/** Wait for the turn-marker writes already queued for this session. */
+export function drainSessionActiveTurnWrites(sessionId: string): Promise<void> {
+ return _writeChains.get(sessionId) ?? Promise.resolve();
+}
/** 返回链上本次写完成(含失败吞错)的 promise,供需要落库确认的调用方 await。 */
function chainWrite(sessionId: string, op: () => Promise<void>): Promise<void> {
@@ -165,6 +187,7 @@ function chainWrite(sessionId: string, op: () => Promise<void>): Promise<void> {
export function markSessionTurnStarted(sessionId: string): void {
if (_quitFrozen) return;
const startedAt = Date.now();
+ _notificationTurns.set(sessionId, { startedAt, sequence: ++_notificationTurnSequence });
chainWrite(sessionId, async () => {
try {
await getDbClient()
@@ -196,9 +219,12 @@ export function markSessionTurnStarted(sessionId: string): void {
export function markSessionTurnEnded(sessionId: string, endedAtOverride?: number): void {
if (isEndedWriteSuppressed()) return;
const notifyContext = captureTurnEndedPersistedContext();
+ const endedAt = Math.min(endedAtOverride ?? Date.now(), Date.now());
+ const notificationTurn = _notificationTurns.get(sessionId);
+ if (notificationTurn && notificationTurn.endedAt === undefined) notificationTurn.endedAt = endedAt;
enqueueEndedWrite(
sessionId,
- Math.min(endedAtOverride ?? Date.now(), Date.now()),
+ endedAt,
notifyContext,
);
}
@@ -216,6 +242,8 @@ export function markSessionTurnEndedAfterBarrier(sessionId: string, barrier: Pro
if (isEndedWriteSuppressed()) return;
const endedAt = Date.now();
const notifyContext = captureTurnEndedPersistedContext();
+ const notificationTurn = _notificationTurns.get(sessionId);
+ if (notificationTurn && notificationTurn.endedAt === undefined) notificationTurn.endedAt = endedAt;
void barrier.then(
() => enqueueEndedWrite(sessionId, endedAt, notifyContext),
() => enqueueEndedWrite(sessionId, endedAt, notifyContext),
diff --git a/apps/desktop/src/main/localDb/sessionNotificationPreview.logic.ts b/apps/desktop/src/main/localDb/sessionNotificationPreview.logic.ts
new file mode 100644
index 0000000000..ea0c4aa311
--- /dev/null
+++ b/apps/desktop/src/main/localDb/sessionNotificationPreview.logic.ts
@@ -0,0 +1,24 @@
+export interface NotificationMessage {
+ clientId: string;
+ role: string;
+ createdAt: number;
+ text: string;
+ agentMeta: Record<string, unknown>;
+ topLevel: boolean;
+}
+
+/** Rows are newest first. A current successful seal is required; no legacy fallback. */
+export function selectNotificationReply(rows: NotificationMessage[], startedAt: number) {
+ for (const row of rows) {
+ if (row.createdAt < startedAt || row.role === 'user') return undefined;
+ // A sealed pre-tool preamble is not a final reply, even on adapters without phases.
+ if (row.role === 'tool_use' || row.role === 'tool_result') return undefined;
+ if (row.role !== 'assistant' || !row.topLevel) continue;
+ const meta = row.agentMeta;
+ if (meta.botCollaboration || meta.botDirectMessage || meta.cindyMakeCompletion || meta.reviewRun) continue;
+ if (meta.turnCompleted !== true) continue;
+ if (meta.assistantPhase === 'commentary') return undefined;
+ return { clientId: row.clientId, text: row.text };
+ }
+ return undefined;
+}
diff --git a/apps/desktop/src/main/localDb/sessionNotificationPreview.ts b/apps/desktop/src/main/localDb/sessionNotificationPreview.ts
new file mode 100644
index 0000000000..cb499a1992
--- /dev/null
+++ b/apps/desktop/src/main/localDb/sessionNotificationPreview.ts
@@ -0,0 +1,46 @@
+import { and, desc, eq, isNull, sql } from 'drizzle-orm';
+import { getDbClient } from './client/current.js';
+import { botProfiles, botSessionLinks, messages, sessions } from './schema.js';
+import { isTopLevelTitleAssistant } from './latestMessageText.logic.js';
+import { extractText } from '../sessionTaskSummary.logic.js';
+import { selectNotificationReply } from './sessionNotificationPreview.logic.js';
+
+export interface SessionNotificationPreview {
+ teammateName?: string;
+ reply?: { clientId: string; text: string };
+ eventId?: string;
+ suppress?: boolean;
+}
+
+/** Use the durable current turn, never the previous answer or an internal task receipt. */
+export async function readSessionNotificationPreview(sessionId: string, includeReply = true): Promise<SessionNotificationPreview> {
+ const db = getDbClient().drizzle;
+ const rows = await db.select().from(sessions).where(eq(sessions.id, sessionId)).limit(1);
+ const current = rows[0];
+ if (!current) return {};
+ const profile = current.source === 'bot' ? await db.select({ name: botProfiles.displayName })
+ .from(botProfiles).innerJoin(botSessionLinks, eq(botSessionLinks.botId, botProfiles.id))
+ .where(and(eq(botSessionLinks.sessionId, sessionId), eq(botSessionLinks.role, 'canonical'))).get() : undefined;
+ const teammateName = profile?.name;
+ // A delayed idle event may arrive after the next input has already started.
+ // Do not notify that unfinished turn or reuse a pre-upgrade historical final.
+ const startedAt = current.activeTurnStartedAt ?? 0;
+ const endedAt = current.lastTurnEndedAt ?? 0;
+ if (startedAt > endedAt) return { teammateName, suppress: true };
+ if (startedAt <= 0) return { teammateName };
+ // Stable across preview readiness: a retry after a fallback must not notify twice.
+ const eventId = `turn:${startedAt}:${endedAt}`;
+ if (!includeReply) return { teammateName, eventId };
+ const recent = await db.select().from(messages).where(and(eq(messages.sessionId, sessionId), isNull(messages.rewindAt)))
+ .orderBy(desc(messages.createdAt), desc(sql`rowid`)).limit(100);
+ const reply = selectNotificationReply(recent.map((row) => {
+ let meta: Record<string, unknown> = {};
+ try { meta = row.agentMeta ? JSON.parse(row.agentMeta) : {}; } catch { /* fail closed */ }
+ return {
+ clientId: row.clientId, role: row.role, createdAt: row.createdAt,
+ text: extractText(row.content, row.role), agentMeta: meta,
+ topLevel: isTopLevelTitleAssistant(meta),
+ };
+ }), Math.max(startedAt, current.clearedAt ?? 0));
+ return { teammateName, reply, eventId };
+}
diff --git a/apps/desktop/src/main/maker-ipc/botDelegationService.ts b/apps/desktop/src/main/maker-ipc/botDelegationService.ts
index d55c9fde38..7bafd72a2f 100644
--- a/apps/desktop/src/main/maker-ipc/botDelegationService.ts
+++ b/apps/desktop/src/main/maker-ipc/botDelegationService.ts
@@ -788,7 +788,7 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
*
* 投递目标:优先冻结的父任务;父任务已被恢复流程替换时,改投发起 Bot 当前的
* 主任务。完成信号属于 Bot 本人,不属于损坏的旧任务。两者都不在(Bot 已
- * 暂停/归档)才放弃投递,此时卡片终态仍然可见,不算静默丢失。
+ * 暂停/归档)时只延后模型唤醒;每次执行的结果回执仍写入冻结的父任务。
*/
const deliverCompletion = async (params: {
id: string;
@@ -834,16 +834,6 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
clearCompletionRetryTimer(params.id);
return false;
}
- const targetSessionId = await requesterLiveSessionId(params.requestingBotId, params.parentSessionId);
- if (!targetSessionId) {
- log.warn('skip Bot delegation completion: requester has no live task', {
- delegationId: params.id,
- requestingBotId: params.requestingBotId,
- parentSessionId: params.parentSessionId,
- });
- scheduleCompletionRetry(params, attempt);
- return false;
- }
const taskSubject = '后台任务';
const statusLine =
params.status === 'completed'
@@ -871,6 +861,80 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
clearCompletionRetryTimer(params.id);
return false;
}
+ // Preserve the result in the conversation that started this execution.
+ // Its requester need not still be live to show this receipt in history.
+ // A deleted parent's FK may have been cleared after this completion
+ // snapshot was taken. Recheck existence on every retry, then use the
+ // replacement canonical task if the original history is gone.
+ const originalParent = params.parentSessionId ? await getDbClient().drizzle
+ .select({ id: sessions.id }).from(sessions)
+ .where(eq(sessions.id, params.parentSessionId)).get() : undefined;
+ const initialReceiptSessionId = originalParent?.id
+ ?? await requesterLiveSessionId(params.requestingBotId, null);
+ if (!initialReceiptSessionId) {
+ scheduleCompletionRetry(params, attempt);
+ return false;
+ }
+ let receiptSessionId: string = initialReceiptSessionId;
+ const child = params.childSessionId ? await getDbClient().drizzle
+ .select({ workingDir: sessions.workingDir }).from(sessions)
+ .where(eq(sessions.id, params.childSessionId)).get() : undefined;
+ // Durable, per-execution receipt: retries reuse the same message identity.
+ // Publish before waking the teammate so queued/hidden model work cannot hide results.
+ const receiptClientId = BOT_DELEGATION_CLIENT_ID.resultRun(params.id, params.runSequence);
+ const persistResultReceipt = async (sessionId: string): Promise<void> => persistTimelineMessage({
+ sessionId,
+ clientId: receiptClientId,
+ role: 'assistant',
+ content: params.resultSummary || params.objective,
+ agentMeta: {
+ botCollaboration: {
+ ...await collaborationMeta(params, 'delegation-result'),
+ parentSessionId: sessionId,
+ result: {
+ workingDir: child?.workingDir ?? '',
+ runSequence: params.runSequence,
+ status: sessionTaskViewStatus({ status: params.status, lastError: params.lastError ?? null }),
+ // A receipt is the in-app result, not a lock-screen preview. Keep
+ // image and link targets so a result with no prose remains usable.
+ text: params.resultSummary ?? '',
+ ...(params.lastError ? { error: params.lastError.slice(0, 4_000) } : {}),
+ artifacts: artifacts.filter((file) => file.status !== 'deleted')
+ .map((file) => ({ absolutePath: file.absolutePath })),
+ },
+ },
+ },
+ });
+ await persistResultReceipt(receiptSessionId);
+ const ensureResultReceipt = async (): Promise<boolean> => {
+ const existing = await getDbClient().drizzle.select({ id: messages.id })
+ .from(messages)
+ .where(and(eq(messages.sessionId, receiptSessionId), eq(messages.clientId, receiptClientId)))
+ .get();
+ if (existing) return true;
+ // The parent may have been physically removed after the first write.
+ // Rehome the immutable receipt before accepting its completion wake-up.
+ const replacement = await requesterLiveSessionId(params.requestingBotId, null);
+ if (!replacement) return false;
+ receiptSessionId = replacement;
+ await persistResultReceipt(replacement);
+ return true;
+ };
+ if (!(await completionStillPending())) return false;
+ if (!(await ensureResultReceipt())) {
+ scheduleCompletionRetry(params, attempt);
+ return false;
+ }
+ const targetSessionId = await requesterLiveSessionId(params.requestingBotId, params.parentSessionId);
+ if (!targetSessionId) {
+ log.warn('defer Bot delegation wake-up: requester has no live task', {
+ delegationId: params.id,
+ requestingBotId: params.requestingBotId,
+ parentSessionId: params.parentSessionId,
+ });
+ scheduleCompletionRetry(params, attempt);
+ return false;
+ }
const dispatched = await deps.dispatch({
targetSessionId,
message: completionMessage,
@@ -885,6 +949,18 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
scheduleCompletionRetry(params, attempt);
return false;
}
+ if (!(await ensureResultReceipt())) {
+ scheduleCompletionRetry(params, attempt);
+ return false;
+ }
+ // The target may have been deleted while dispatch was accepting the
+ // hidden message. A rehomed receipt alone does not wake its replacement.
+ // Leave this run pending so the stable completion ID is dispatched there.
+ const currentTargetSessionId = await requesterLiveSessionId(params.requestingBotId, params.parentSessionId);
+ if (currentTargetSessionId !== targetSessionId) {
+ scheduleCompletionRetry(params, attempt);
+ return false;
+ }
const [marked] = await getDbClient().drizzle
.update(botDelegations)
.set({ completionDeliveredAt: now(), updatedAt: now() })
@@ -896,8 +972,14 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
? isNull(botDelegations.childSessionId)
: eq(botDelegations.childSessionId, params.childSessionId),
isNull(botDelegations.completionDeliveredAt),
+ sql`exists (select 1 from ${messages} where ${messages.sessionId} = ${receiptSessionId} and ${messages.clientId} = ${receiptClientId})`,
+ sql`exists (select 1 from ${sessions} where ${sessions.id} = ${targetSessionId} and ${sessions.status} = 'active')`,
))
.returning({ id: botDelegations.id });
+ if (!marked && await completionStillPending()) {
+ scheduleCompletionRetry(params, attempt);
+ return false;
+ }
clearCompletionRetryTimer(params.id);
return !!marked;
} catch (error) {
@@ -1074,7 +1156,7 @@ export function createBotDelegationService(deps: BotDelegationServiceDeps) {
${messages.agentMeta} IS NULL
OR json_extract(${messages.agentMeta}, '$.botCollaboration.role') IS NULL
OR json_extract(${messages.agentMeta}, '$.botCollaboration.role')
- NOT IN ('delegation-request', 'interjection')
+ NOT IN ('delegation-request', 'interjection', 'delegation-result')
)`,
),
)
diff --git a/apps/desktop/src/main/messagePersistBroadcaster.ts b/apps/desktop/src/main/messagePersistBroadcaster.ts
index c1c5f29a83..b083cf0dca 100644
--- a/apps/desktop/src/main/messagePersistBroadcaster.ts
+++ b/apps/desktop/src/main/messagePersistBroadcaster.ts
@@ -2070,9 +2070,12 @@ export function onStandaloneTextEvent(
*/
export function onAssistantTextEvent(
sessionId: string,
- data: { text?: unknown; isFinal?: unknown; isFullText?: unknown; agentMessageId?: unknown },
+ data: { text?: unknown; isFinal?: unknown; isFullText?: unknown; agentMessageId?: unknown; phase?: string; runtimeRecovery?: boolean },
agentMeta: AgentMeta | null,
): string | undefined {
+ if (typeof data.phase === 'string' || data.runtimeRecovery === true) {
+ agentMeta = { ...agentMeta, assistantPhase: data.runtimeRecovery === true ? 'commentary' : data.phase as string };
+ }
const rawText = typeof data.text === 'string' ? data.text : '';
const isFinal = data.isFinal === true;
const isFullText = data.isFullText === true;
diff --git a/apps/desktop/src/main/notificationPreview.ts b/apps/desktop/src/main/notificationPreview.ts
new file mode 100644
index 0000000000..32559f3b55
--- /dev/null
+++ b/apps/desktop/src/main/notificationPreview.ts
@@ -0,0 +1,32 @@
+import { Lexer, type Tokens, type Token } from 'marked';
+
+/** Parse Markdown before shortening it: punctuation in ordinary text/code is content. */
+export function notificationPlainText(markdown: string): string {
+ const render = (tokens: Token[]): string => tokens.map((token): string => {
+ switch (token.type) {
+ case 'space': case 'br': return ' ';
+ case 'html': case 'image': case 'def': case 'hr': return '';
+ case 'code': case 'codespan': return token.text;
+ case 'list': return (token as Tokens.List).items.map((item) => render(item.tokens)).join(' ');
+ case 'table': return [(token as Tokens.Table).header, ...(token as Tokens.Table).rows]
+ .map((row) => row.map((cell) => render(cell.tokens)).join(' ')).join(' ');
+ default: {
+ const value = token as Token & { tokens?: Token[]; text?: string };
+ const text = value.tokens ? render(value.tokens) : (value.text ?? '');
+ return ['paragraph', 'heading', 'blockquote', 'list_item'].includes(token.type)
+ ? ` ${text} ` : text;
+ }
+ }
+ }).join('');
+ return render(Lexer.lex(markdown)).replace(/\s+/gu, ' ').trim();
+}
+
+export function notificationPreview(markdown: string, limit = 240): string {
+ // The notify protocol measures JS string length (UTF-16), not code points.
+ let preview = '';
+ for (const character of notificationPlainText(markdown)) {
+ if (preview.length + character.length > limit) break;
+ preview += character;
+ }
+ return preview;
+}
diff --git a/apps/desktop/src/main/notificationService.ts b/apps/desktop/src/main/notificationService.ts
index d51b52c06b..9fa7427426 100644
--- a/apps/desktop/src/main/notificationService.ts
+++ b/apps/desktop/src/main/notificationService.ts
@@ -5,9 +5,8 @@
* - macOS / Linux / Windows:统一走 Electron 原生 `Notification`。
* - 点通知后把窗口拉到前台,并通过 `notification:focus-session` 把 sessionId
* 广播给 renderer,由 renderer 路由跳转。
- * - 新增飞书通道:payload.channels.feishu === true 时,额外通过 feishuIm
- * 给当前 bot owner 私聊发一条 markdown 文本(复用 scheduler-host/notifier
- * 的同源 API,不新增通道机制)。
+ * - 飞书通道:payload.channels.feishu === true 时通过 feishuIm 给当前 owner
+ * 私聊发通知。伙伴回复用纯文本,普通任务沿用 markdown;复用现有 IM API。
*
* Windows AUMID(AppUserModelID)契约:
* - 运行时由 main/bootstrap-electron.ts 通过 `app.setAppUserModelId(WINDOWS_APP_USER_MODEL_ID)`
@@ -29,12 +28,17 @@ import * as path from 'node:path';
import { markSessionNeedsAttention } from './appBadgeService';
import { getMobileNotifyGeneration, sendMobileSessionNotify } from './device-link';
+import { notificationPreview } from './notificationPreview';
+import { readSessionNotificationPreview, type SessionNotificationPreview } from './localDb/sessionNotificationPreview';
+import { drainSessionActiveTurnWrites, getSessionNotificationTurnSignal } from './localDb/sessionActiveTurn';
+import { captureDataOwnerBroadcastScope, isDataOwnerBroadcastScopeCurrent } from './device-link/broadcast-tap';
import { latestMessageText } from './localDb/latestMessageText';
import { drainPersistQueue } from './messagePersistBroadcaster';
import { createLogger } from './logger';
import {
getSessionExternalNotificationText,
getSessionNotificationBody,
+ getTeammateNotificationFallback,
getSessionNotificationUntitled,
type SessionEventKind,
} from './sessionNotificationCopy';
@@ -93,6 +97,41 @@ interface ShowSessionEventPayload {
// 时就回收掉,导致 click handler 丢失甚至触发异常事件。用 Set 持引用,等
// close/click 后再 release。
const liveNotifications = new Set<Notification>();
+type NotifiedReply = { eventId: string } | { fallbackSentAt: number };
+const notifiedReplies = new Map<string, NotifiedReply>();
+const pendingFeishuReplies = new Set<string>();
+const pendingFeishuFallbacks = new Map<string, number>();
+type ReplyNotificationChannel = 'desktop' | 'mobile' | 'feishu';
+
+function replyNotificationKey(scope: string | number, sessionId: string, channel: ReplyNotificationChannel): string {
+ return `${scope}:${sessionId}:${channel}`;
+}
+
+function wasReplyNotified(key: string, eventId: string | undefined): boolean {
+ const notified = notifiedReplies.get(key);
+ if (!notified) return false;
+ if (!eventId) return !('eventId' in notified);
+ if ('eventId' in notified) return notified.eventId === eventId;
+ // An accepted fallback had no DB identity. Once persistence recovers,
+ // reconcile it with the turn that was already running when sent.
+ // A turn started afterwards is new, even if it finishes immediately.
+ const startedAt = /^turn:(\d+):\d+$/.exec(eventId)?.[1];
+ if (startedAt && Number(startedAt) < notified.fallbackSentAt) {
+ notifiedReplies.set(key, { eventId });
+ return true;
+ }
+ return false;
+}
+
+function isFeishuReplyPending(key: string, eventId: string | undefined): boolean {
+ if (pendingFeishuReplies.has(`${key}:${eventId ?? 'pending'}`)) return true;
+ const fallbackSentAt = pendingFeishuFallbacks.get(key);
+ if (fallbackSentAt === undefined || !eventId) return false;
+ const startedAt = /^turn:(\d+):\d+$/.exec(eventId)?.[1];
+ return startedAt !== undefined && Number(startedAt) < fallbackSentAt;
+}
+// A slow transcript must not indefinitely hide a completion or an action request.
+const NOTIFICATION_PREVIEW_WAIT_MS = 1_000;
/**
* 把窗口拉到前台并广播 sessionId 给 renderer 路由跳转。
@@ -124,12 +163,12 @@ function focusWindow(getWindow: () => BrowserWindow | null, sessionId: string):
*/
export function showDesktopSessionEvent(
getWindow: () => BrowserWindow | null,
- payload: Pick<ShowSessionEventPayload, 'sessionId' | 'title' | 'kind'>,
-): void {
+ payload: Pick<ShowSessionEventPayload, 'sessionId' | 'title' | 'kind'> & { body?: string; teammate?: boolean },
+): boolean {
const { sessionId, title, kind } = payload;
if (sessionId) markSessionNeedsAttention(sessionId);
const safeTitle = title?.trim() || sessionId.slice(0, 8) || getSessionNotificationUntitled();
- showDesktopToast(safeTitle, kind, () => focusWindow(getWindow, sessionId));
+ return showDesktopToast(safeTitle, kind, () => focusWindow(getWindow, sessionId), payload.body, payload.teammate);
}
export interface NotificationServiceDeps {
@@ -161,53 +200,136 @@ export function initNotificationService(deps: NotificationServiceDeps): void {
// 去重与「被远程观看则不推」收口。
assertValidSessionEventPayload(payload);
const { sessionId, title, kind, channels } = payload;
- // 兜底:title 为空(极早期 session 还没生成标题)也别炸,用 sessionId 前 8 位顶上。
- const safeTitle = title?.trim() || sessionId.slice(0, 8);
-
- // channels 缺省/未传 → 默认仅桌面 (防御漏传,见 ShowSessionEventPayload 注释)。
+ const generation = getMobileNotifyGeneration();
+ // Capture at IPC arrival, not after the asynchronous preview: a newer
+ // turn can begin while the current completion waits on persistence.
+ const signal = kind === 'done' ? getSessionNotificationTurnSignal(sessionId) : undefined;
+ // A late idle for the previous turn must not claim the identity of a
+ // newer turn that is still running, even if preview persistence stalls.
+ if (signal && !signal.ended) return;
+ const ownerScope = captureDataOwnerBroadcastScope();
+ const safeTitle = title.trim() || sessionId.slice(0, 8);
const wantDesktop = channels?.desktop ?? true;
const wantFeishu = channels?.feishu === true;
+ markSessionNeedsAttention(sessionId);
- if (wantDesktop) {
+ // Action/error desktop notices have no transcript preview and must be immediate.
+ if (wantDesktop && kind !== 'done') {
showDesktopSessionEvent(getWindow, { sessionId, title: safeTitle, kind });
- } else {
- // Dock/taskbar 角标独立于外发通道;即便只开飞书或两个通知开关都关闭,
- // session 进入终态后仍要在 Cindy 内标记为需要关注。
- markSessionNeedsAttention(sessionId);
- }
-
- if (channels?.mobile === true) {
- // fire-and-forget;离线 / 老 relay / 正被远程观看 / 短窗重复时静默跳过。
- // 整段放进独立 async 块不 await:persist 队列是全会话共享且无超时的,
- // 在这里同步等它会让别的会话的慢写入拖延本次飞书分支;半死 socket 的
- // ws.send 同步 throw 也一并落到 catch,不 reject 整个 invoke。
- // 代次在 await 之前捕获:等待期间发生登出/换号,发送侧按代次不一致丢弃,
- // 旧账号的会话标题不会经新账号的链路推出去。
- const generation = getMobileNotifyGeneration();
- void (async () => {
- // 体验优先(2026-07 产品决策):正文带该会话最近一条 assistant 内容,
- // 用户不打开 App 也能看到结果/提问。error 终态没有可靠的错误正文来源,
- // 回退终态短文案。先 drain 持久化队列:turn-done 时本轮 assistant 块
- // 可能仍在 writeChain 里,立刻读库会拿到上一轮文本(与摘要生成同口径)。
- const detail =
- kind === 'error'
- ? undefined
- : await drainPersistQueue()
- .then(() => latestMessageText(sessionId, 'assistant'))
- .catch(() => '');
- sendMobileSessionNotify({
- sessionId,
- title: safeTitle,
- kind,
- generation,
- ...(detail ? { detail } : {}),
- });
- })().catch((err) => {
- log.warn('[notification] mobile push failed (non-fatal)', err);
- });
}
+ // Content is read from main's transcript. Bound only enrichment, not delivery;
+ // a timeout is not a dedupe window and never causes a second late toast.
+ void (async () => {
+ let preview: SessionNotificationPreview | undefined;
+ let postDrainPreviewReady = false;
+ let detail: string | undefined;
+ if (kind === 'done' || (kind === 'needs-reply' && channels?.mobile === true)) {
+ let finished = false;
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ try {
+ await Promise.race([
+ (async () => {
+ if (kind === 'done') {
+ // Read the teammate identity first so a blocked write still
+ // has the correct fallback. This snapshot may predate the
+ // terminal marker, so its turn ID is not authoritative.
+ const identity = await readSessionNotificationPreview(sessionId, false);
+ // The turn marker may still be queued separately from the
+ // message broadcaster. Keep only the teammate name here;
+ // an old event ID must never identify this completion.
+ preview = { teammateName: identity.teammateName };
+ }
+ if (finished || !isDataOwnerBroadcastScopeCurrent(ownerScope)) return;
+ await drainPersistQueue();
+ if (kind === 'done') await drainSessionActiveTurnWrites(sessionId);
+ if (finished || !isDataOwnerBroadcastScopeCurrent(ownerScope)) return;
+ if (kind === 'done') {
+ preview = await readSessionNotificationPreview(sessionId);
+ postDrainPreviewReady = true;
+ detail = preview.reply?.text;
+ } else {
+ detail = await latestMessageText(sessionId, 'assistant');
+ }
+ })(),
+ new Promise<void>((resolve) => { timer = setTimeout(resolve, NOTIFICATION_PREVIEW_WAIT_MS); }),
+ ]);
+ } catch (err) {
+ log.warn('[notification] preview unavailable; using fallback', err);
+ } finally {
+ finished = true;
+ clearTimeout(timer);
+ }
+ }
+ if (!isDataOwnerBroadcastScopeCurrent(ownerScope)) return;
+ // Preview enrichment can outlive an entire later turn. Never send that
+ // later reply under the terminal signal captured for this IPC event.
+ const currentSignal = kind === 'done' ? getSessionNotificationTurnSignal(sessionId) : undefined;
+ if (kind === 'done') {
+ if (currentSignal?.id !== signal?.id || (currentSignal && !currentSignal.ended)) return;
+ }
+ if (postDrainPreviewReady && preview?.suppress) {
+ // The terminal marker write may have failed after the in-memory turn
+ // already ended. Keep its generic notice, but never use old DB text.
+ if (kind !== 'done' || !signal?.ended || currentSignal?.id !== signal.id) return;
+ detail = undefined;
+ }
+ const teammate = !!preview?.teammateName;
+ const notificationTitle = preview?.teammateName ?? safeTitle;
+ const eventId = signal?.id ?? preview?.eventId;
+ const mobileEventId = preview?.eventId ?? signal?.fallbackEventId;
+ // A device-link handoff advances only the mobile send generation. It
+ // must not make an already accepted desktop/Feishu reply eligible again.
+ const ownerKey = ownerScope.ownerScopeKey ?? JSON.stringify(ownerScope.ownerStamp ?? null);
+ const desktopKey = replyNotificationKey(ownerKey, sessionId, 'desktop');
+ const mobileKey = replyNotificationKey(generation, sessionId, 'mobile');
+ const feishuKey = replyNotificationKey(ownerKey, sessionId, 'feishu');
+ const fallbackBody = teammate ? getTeammateNotificationFallback() : undefined;
+ if (wantDesktop && kind === 'done' && !wasReplyNotified(desktopKey, eventId)) {
+ try {
+ const accepted = showDesktopSessionEvent(getWindow, {
+ sessionId, title: notificationTitle, kind, teammate,
+ body: teammate ? notificationPreview(detail ?? '') || fallbackBody : undefined,
+ });
+ if (accepted) {
+ notifiedReplies.set(desktopKey, eventId ? { eventId } : { fallbackSentAt: Date.now() });
+ }
+ } catch (err) {
+ log.warn('[notification] desktop reply notification failed (non-fatal)', err);
+ }
+ }
+ if (channels?.mobile === true && (kind !== 'done' || !wasReplyNotified(mobileKey, eventId))) {
+ try {
+ const accepted = sendMobileSessionNotify({
+ sessionId, title: notificationTitle, kind, generation, ...(detail ? { detail } : {}),
+ ...(fallbackBody ? { fallbackBody } : {}), ...(mobileEventId ? { eventId: mobileEventId } : {}),
+ });
+ if (kind === 'done' && accepted) {
+ notifiedReplies.set(mobileKey, eventId ? { eventId } : { fallbackSentAt: Date.now() });
+ }
+ } catch (err) {
+ log.warn('[notification] mobile reply notification failed (non-fatal)', err);
+ }
+ }
+ if (wantFeishu && kind === 'done' && !wasReplyNotified(feishuKey, eventId)) {
+ const pendingKey = `${feishuKey}:${eventId ?? 'pending'}`;
+ if (!isFeishuReplyPending(feishuKey, eventId)) {
+ pendingFeishuReplies.add(pendingKey);
+ if (!eventId) pendingFeishuFallbacks.set(feishuKey, Date.now());
+ try {
+ const body = teammate ? notificationPreview(detail ?? '') || fallbackBody : undefined;
+ const accepted = await sendFeishuMessage(feishuIm, notificationTitle, kind, body);
+ if (accepted) {
+ notifiedReplies.set(feishuKey, eventId ? { eventId } : { fallbackSentAt: Date.now() });
+ }
+ } finally {
+ pendingFeishuReplies.delete(pendingKey);
+ if (!eventId) pendingFeishuFallbacks.delete(feishuKey);
+ }
+ }
+ }
+ })().catch((err) => log.warn('[notification] reply notification failed (non-fatal)', err));
- if (wantFeishu) {
+ if (wantFeishu && kind !== 'done') {
await sendFeishuMessage(feishuIm, safeTitle, kind);
}
},
@@ -240,17 +362,18 @@ function assertValidSessionEventPayload(
}
/** 桌面 toast 分支 — 原实现保持不变,只是拆出来便于 channels 选择性执行。 */
-function showDesktopToast(safeTitle: string, kind: SessionEventKind, onClick: () => void): void {
- const body = getSessionNotificationBody(kind);
+function showDesktopToast(safeTitle: string, kind: SessionEventKind, onClick: () => void, previewBody?: string, teammate = false): boolean {
+ const body = previewBody ?? getSessionNotificationBody(kind);
// Electron Notification 在某些 Linux 桌面环境下可能不可用——静默兜底。
if (!Notification.isSupported()) {
log.warn('[notification] Notification.isSupported() === false, skip');
- return;
+ return false;
}
const notif = new Notification({
- title: `${CLIENT_NOTIFICATION_NAME} · ${safeTitle}`,
+ title: teammate && safeTitle.trim().toLowerCase() === 'cindy'
+ ? CLIENT_NOTIFICATION_NAME : `${CLIENT_NOTIFICATION_NAME} · ${safeTitle}`,
body,
// silent 默认 false——发声音,与 Electron 默认一致。
// icon 仅在 dev 下传值;packaged 时为 undefined,回到原行为(由 AUMID/.icns 兜底)。
@@ -270,6 +393,7 @@ function showDesktopToast(safeTitle: string, kind: SessionEventKind, onClick: ()
release();
});
notif.show();
+ return true;
}
/**
@@ -283,23 +407,30 @@ async function sendFeishuMessage(
feishuIm: FeishuIM,
safeTitle: string,
kind: SessionEventKind,
-): Promise<void> {
+ teammateBody?: string,
+): Promise<boolean> {
const ownerOpenId = feishuIm.getOwnerOpenId();
if (!ownerOpenId) {
log.warn('[notification] feishu skipped: no bot owner bound (user must DM the bot once)');
- return;
+ return false;
}
try {
- await feishuIm.sendMarkdownText(
- ownerOpenId,
- getSessionExternalNotificationText(safeTitle, kind),
- );
+ if (teammateBody) {
+ await feishuIm.sendText(ownerOpenId, `${safeTitle}\n${teammateBody}`);
+ } else {
+ await feishuIm.sendMarkdownText(
+ ownerOpenId,
+ getSessionExternalNotificationText(safeTitle, kind),
+ );
+ }
+ return true;
} catch (err) {
// 飞书 SDK 包了一层 axios; 400 等业务错误的真正 message 在 response.data 里,
// 显式拆出来 log。与 scheduler-host/notifier.ts 的 catch 写法对齐。
const r = (err as { response?: { data?: unknown; status?: number } }).response;
log.warn(
- `[notification] feishu sendMarkdownText failed status=${r?.status ?? 'n/a'} body=${JSON.stringify(r?.data ?? null)} target=...${ownerOpenId.slice(-8)}`,
+ `[notification] feishu send failed status=${r?.status ?? 'n/a'} body=${JSON.stringify(r?.data ?? null)} target=...${ownerOpenId.slice(-8)}`,
);
+ return false;
}
}
diff --git a/apps/desktop/src/main/sessionNotificationCopy.ts b/apps/desktop/src/main/sessionNotificationCopy.ts
index 938df47aa2..0c2a704d90 100644
--- a/apps/desktop/src/main/sessionNotificationCopy.ts
+++ b/apps/desktop/src/main/sessionNotificationCopy.ts
@@ -34,3 +34,7 @@ export function getSessionExternalNotificationText(title: string, kind: SessionE
// 等 JavaScript replacement token 不能被解释成模板控制符。
return t(EXTERNAL_KEY_BY_KIND[kind]).replaceAll('{{title}}', () => title);
}
+
+export function getTeammateNotificationFallback(): string {
+ return t('settings.notifications.sessionEvent.newReply');
+}
diff --git a/apps/desktop/src/renderer/__tests__/unreadCount.test.ts b/apps/desktop/src/renderer/__tests__/unreadCount.test.ts
index 79d95c4950..a60c8dd13d 100644
--- a/apps/desktop/src/renderer/__tests__/unreadCount.test.ts
+++ b/apps/desktop/src/renderer/__tests__/unreadCount.test.ts
@@ -144,3 +144,11 @@ describe('countUnreadAdded', () => {
).toBe(0);
});
});
+
+it('counts new result receipts in history, but not replayed receipts or paginated old cards', () => {
+ const messages = [{ clientId: 'older-result', role: 'assistant' }, { clientId: 'anchor', role: 'assistant' },
+ { clientId: 'user-input', role: 'user' }, { clientId: 'result-1', role: 'assistant' },
+ { clientId: 'hidden-wake', role: 'user', isSyntheticTrigger: true }, { clientId: 'result-2', role: 'assistant' }];
+ expect(countUnreadAdded({ prevIds: new Set(['anchor']), messages, nearBottom: false })).toBe(2);
+ expect(countUnreadAdded({ prevIds: new Set(messages.map(message => message.clientId)), messages, nearBottom: false })).toBe(0);
+});
diff --git a/apps/desktop/src/renderer/components/chat/SystemCard.tsx b/apps/desktop/src/renderer/components/chat/SystemCard.tsx
index c2fa61f6be..b7b0de87ad 100644
--- a/apps/desktop/src/renderer/components/chat/SystemCard.tsx
+++ b/apps/desktop/src/renderer/components/chat/SystemCard.tsx
@@ -1,4 +1,5 @@
import { Button } from '@/components/ui/button';
+import { BotSessionTaskResultCard } from '@/features/bots/BotSessionTaskResultCard';
/**
* SystemCard
* ---------------------------------------------------------------------------
@@ -74,6 +75,7 @@ interface SystemCardProps {
| 'agent-switch'
| 'bot-session-task-message'
| 'bot-session-task'
+ | 'bot-session-task-result'
| 'bot-direct-message'
| 'bot-authorization'
| 'context-rebuild';
@@ -1380,6 +1382,8 @@ export function SystemCard({
return <ReviewCard data={data} workingDir={workingDir} />;
case 'bot-session-task-message':
return <BotSessionTaskMessageTrace data={data} />;
+ case 'bot-session-task-result':
+ return <BotSessionTaskResultCard data={data} />;
case 'bot-session-task':
return <BotSessionTaskCard data={data} sessionId={sessionId} />;
case 'bot-authorization':
diff --git a/apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx b/apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx
new file mode 100644
index 0000000000..5c834eb5e5
--- /dev/null
+++ b/apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx
@@ -0,0 +1,40 @@
+import { useTranslation } from 'react-i18next';
+import { FileText } from 'lucide-react';
+import { readBotCollaborationMeta } from '../../../shared/botCollaboration';
+import { ChatSessionFileProvider, useChatSessionFile } from '@/components/chat/ChatSessionFileContext';
+import { MarkdownRenderer } from '@/components/chat/MarkdownRenderer';
+
+/** A frozen execution receipt; expanding it never restarts or fetches the task. */
+export function BotSessionTaskResultCard({ data }: { data?: Record<string, unknown> }) {
+ const { t } = useTranslation();
+ const fileContext = useChatSessionFile();
+ const card = readBotCollaborationMeta(data);
+ if (card?.role !== 'delegation-result' || !card.result) return null;
+ const { result } = card;
+ const workingDir = result.workingDir ?? fileContext.workingDir;
+ return (
+ <details className="my-2 rounded-xl border border-[var(--border-default)] bg-[var(--surface-elevated)] text-14 text-[var(--text-primary)]">
+ <summary className="flex min-h-11 cursor-pointer items-center gap-2 rounded-xl px-3 py-2 focus-visible:outline focus-visible:outline-2">
+ <FileText size={16} className="shrink-0 text-[var(--text-secondary)]" aria-hidden="true" />
+ <span className="min-w-0 flex-1 truncate">{card.objective}</span>
+ <span className="shrink-0 text-12 text-[var(--text-secondary)]">{t(`bots.collab.status.${result.status}`)}</span>
+ <span className="shrink-0 text-12">{t('bots.collab.viewResult')}</span>
+ </summary>
+ <div className="space-y-2 border-t border-[var(--border-default)] px-3 py-3">
+ <ChatSessionFileProvider value={{ ...fileContext, workingDir, sessionId: card.childSessionId ?? undefined }}>
+ {result.text
+ ? <MarkdownRenderer workingDir={workingDir} currentSessionId={card.childSessionId ?? undefined} content={result.text} />
+ : <p className="whitespace-pre-wrap break-words">{t('bots.collab.noWrittenResult')}</p>}
+ {result.artifacts.map((artifact) => (
+ <MarkdownRenderer key={artifact.absolutePath} workingDir={workingDir} currentSessionId={card.childSessionId ?? undefined}
+ content={`[${artifact.absolutePath.split(/[\\/]/).pop()?.replace(/[\[\]\\]/g, '\\$&') ?? t('bots.collab.viewResult')}](<${encodeURI(artifact.absolutePath).replace(/[<>?#]/g, encodeURIComponent)}>)`} />
+ ))}
+ </ChatSessionFileProvider>
+ {result.error && <details>
+ <summary className="flex min-h-11 cursor-pointer items-center rounded-xl text-[var(--text-secondary)] focus-visible:outline focus-visible:outline-2">{t('appError.details')}</summary>
+ <p className="whitespace-pre-wrap break-words text-12 text-[var(--text-secondary)]">{result.error}</p>
+ </details>}
+ </div>
+ </details>
+ );
+}
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/BotSessionTaskResultCard.test.tsx b/apps/desktop/src/renderer/features/bots/__tests__/BotSessionTaskResultCard.test.tsx
new file mode 100644
index 0000000000..12eb11687a
--- /dev/null
+++ b/apps/desktop/src/renderer/features/bots/__tests__/BotSessionTaskResultCard.test.tsx
@@ -0,0 +1,57 @@
+import { readBotCollaborationMeta } from '../../../../shared/botCollaboration';
+// @vitest-environment jsdom
+import { render, screen, cleanup } from '@testing-library/react';
+import { afterEach, expect, it, vi } from 'vitest';
+import { BotSessionTaskResultCard } from '../BotSessionTaskResultCard';
+import { SystemCard } from '@/components/chat/SystemCard';
+import { makerChatStore } from '@/lib/makerChatStore';
+import type { Message } from '@/lib/ccAgent.types';
+vi.mock('react-i18next', async (importOriginal) => ({
+ ...await importOriginal<typeof import('react-i18next')>(),
+ useTranslation: () => ({ t: (key: string) => key }),
+}));
+vi.mock('@/components/chat/MarkdownRenderer', () => ({ MarkdownRenderer: ({ content, currentSessionId, workingDir }: any) => <a data-session={currentSessionId} data-workdir={workingDir}>{content}</a> }));
+vi.mock('@/components/chat/ChatSessionFileContext', () => ({ useChatSessionFile: () => ({ origin: { kind: 'device', deviceId: 'home' }, sessionId: 'parent', workingDir: '/parent-task' }), ChatSessionFileProvider: ({ children }: any) => children }));
+vi.mock('@/features/bots/BotCollaborationCard', () => ({ BotSessionTaskCard: () => null, BotSessionTaskMessageTrace: () => null }));
+vi.mock('@/features/learn/LearnStatusCard', () => ({ LearnStatusCard: () => null }));
+afterEach(cleanup);
+const card = { v: 1, role: 'delegation-result', delegationId: 'task-1', fromBotId: 'cindy', fromBotName: 'Cindy', toBotId: null, toBotName: 'Cindy', parentSessionId: 'parent', childSessionId: 'child', objective: 'Report', result: { workingDir: '/child-task', runSequence: 2, status: 'completed', text: 'Second result', artifacts: [{ absolutePath: '/reports/second.pdf' }] } };
+it('keeps the execution result and its files in the receipt, without fetching or restarting', () => {
+ expect(readBotCollaborationMeta(card)).toMatchObject({ role: 'delegation-result' });
+ const [mapped] = makerChatStore.__mapServerMessagesForTest([{
+ id: 'result-row', clientId: 'result-row', sessionId: 'parent', role: 'assistant', content: '',
+ createdAt: '2026-09-23T00:00:00.000Z', agentMeta: { botCollaboration: card },
+ } as Message]);
+ expect(mapped.systemCardType).toBe('bot-session-task-result');
+ expect(mapped.systemCardData).toMatchObject({ role: 'delegation-result', delegationId: 'task-1' });
+ const { container } = render(<SystemCard cardType={mapped.systemCardType!} data={mapped.systemCardData} />);
+ expect(container.querySelector('details')?.open).toBe(false);
+ expect(screen.getByText('Second result')).toBeTruthy();
+ expect(container.querySelector('a')?.dataset.session).toBe('child');
+ expect(container.querySelector('a')?.dataset.workdir).toBe('/child-task');
+ expect([...container.querySelectorAll('a')].some(link => link.textContent?.includes('/reports/second.pdf'))).toBe(true);
+});
+it('renders image-only and linked results in the child file context', () => {
+ const text = '![chart](/child-task/chart.png) [Report](https://example.com/report.pdf)';
+ const { container } = render(<BotSessionTaskResultCard data={{ ...card, result: { ...card.result, text, artifacts: [] } }} />);
+ const result = container.querySelector('a');
+ expect(result?.textContent).toBe(text);
+ expect(result?.dataset.session).toBe('child');
+ expect(result?.dataset.workdir).toBe('/child-task');
+ expect(screen.queryByText('bots.collab.noWrittenResult')).toBeNull();
+});
+it('uses human fallback for a stopped task with no result and rejects malformed receipts', () => {
+ const { rerender } = render(<BotSessionTaskResultCard data={{ ...card, result: { ...card.result, status: 'cancelled', text: '', artifacts: [] } }} />);
+ expect(screen.getByText('bots.collab.noWrittenResult')).toBeTruthy();
+ rerender(<BotSessionTaskResultCard data={{ ...card, result: {} }} />);
+ expect(screen.queryByText('Report')).toBeNull();
+});
+
+it('keeps frozen failure details behind their own disclosure', () => {
+ const { container } = render(<BotSessionTaskResultCard data={{ ...card, result: { ...card.result, status: 'timed-out', error: 'TIMEOUT: upstream did not finish' } }} />);
+ expect(container.querySelector('summary')?.textContent).toContain('bots.collab.status.timed-out');
+ expect(container.querySelector('summary')?.textContent).not.toContain('TIMEOUT:');
+ const details = screen.getByText('TIMEOUT: upstream did not finish').closest('details');
+ expect(details?.open).toBe(false);
+ expect(details?.querySelector('summary')?.textContent).toBe('appError.details');
+});
diff --git a/apps/desktop/src/renderer/features/bots/__tests__/botConversationPresentation.test.ts b/apps/desktop/src/renderer/features/bots/__tests__/botConversationPresentation.test.ts
index 8bb6d37aca..ee30c430fb 100644
--- a/apps/desktop/src/renderer/features/bots/__tests__/botConversationPresentation.test.ts
+++ b/apps/desktop/src/renderer/features/bots/__tests__/botConversationPresentation.test.ts
@@ -88,6 +88,17 @@ describe('teammate final-result presentation', () => {
}
});
+ it('keeps a persisted task result receipt visible while process rows are hidden', () => {
+ const receipt = message('receipt', 'assistant', '', {
+ systemCardType: 'bot-session-task-result',
+ systemCardData: { botCollaboration: { role: 'delegation-result' } },
+ });
+ const input = [message('u', 'user'), message('progress', 'assistant'), tool('t'), receipt];
+ for (const streaming of [true, false]) {
+ expect(allKeys(project(input, streaming))).toEqual(['msg-u', 'msg-receipt']);
+ }
+ });
+
it('retains a later explanation after partial delivery and ignores unverified file candidates', () => {
const result = project([message('u', 'user'),
message('file', 'assistant', '', { files: [{ name: 'partial.pdf', path: '/partial.pdf' }] }),
@@ -178,3 +189,15 @@ describe('teammate final-result presentation', () => {
expect(group.deferred).toBe(deferred);
});
});
+
+it('keeps appended result receipts visible while the teammate is busy, across hidden wakeups', () => {
+ const input = [message('old-card', 'assistant', '', { systemCardType: 'bot-session-task' }),
+ message('new-input', 'user'),
+ message('result-1', 'assistant', '', { systemCardType: 'bot-session-task-result' }),
+ message('wake', 'user', '', { isSyntheticTrigger: true }),
+ message('result-2', 'assistant', '', { systemCardType: 'bot-session-task-result' }),
+ message('working', 'assistant')];
+ const result = project(input, true);
+ expect(result.filter(item => item.type === 'message' && item.message.systemCardType === 'bot-session-task-result').map(item => item.key))
+ .toEqual(['msg-result-1', 'msg-result-2']);
+});
diff --git a/apps/desktop/src/renderer/features/bots/botConversationPresentation.ts b/apps/desktop/src/renderer/features/bots/botConversationPresentation.ts
index 5936f92086..8b3303c92e 100644
--- a/apps/desktop/src/renderer/features/bots/botConversationPresentation.ts
+++ b/apps/desktop/src/renderer/features/bots/botConversationPresentation.ts
@@ -93,6 +93,7 @@ function projectWindow(
if (isProse(item) && item.message.content.trim()) lastProse = index;
if ((isProse(item) && (hasAttachments(item.message)
|| extractRenderedMarkdownImageTargets(item.message.content).length > 0))
+ || (item.type === 'message' && item.message.systemCardType === 'bot-session-task-result')
|| (item.type === 'generated_files' && visibleGeneratedFileKeys?.has(item.key))
|| (item.type === 'tool_media' && item.items.length > 0)
|| (item.type === 'ghost_card' && (item.settled || Boolean(item.media?.length)))) {
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index c06c32366e..98da87d93a 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -836,7 +836,8 @@
"needsReply": "Reply needed",
"externalDone": "Cindy · Session “{{title}}” completed ✓",
"externalError": "Cindy · Session “{{title}}” failed",
- "externalNeedsReply": "Cindy · Session “{{title}}” needs your reply"
+ "externalNeedsReply": "Cindy · Session “{{title}}” needs your reply",
+ "newReply": "New reply"
},
"wecomGroupLabel": "WeCom group notifications",
"wecomGroupHint": "Used for automation completion notifications. Paste a WeCom group bot Webhook URL; it is encrypted on this device.",
@@ -7837,7 +7838,9 @@
"seconds": "{{n}}s",
"minutes": "{{n}} min",
"hoursMinutes": "{{h}} h {{m}} min"
- }
+ },
+ "viewResult": "View Result",
+ "noWrittenResult": "No written result."
},
"directMessage": {
"sentTo": "Sent a message to {{name}}",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 6cda17e1eb..8e9cba4b46 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -836,7 +836,8 @@
"needsReply": "返信が必要です",
"externalDone": "Cindy · セッション「{{title}}」が完了しました ✓",
"externalError": "Cindy · セッション「{{title}}」の実行に失敗しました",
- "externalNeedsReply": "Cindy · セッション「{{title}}」への返信が必要です"
+ "externalNeedsReply": "Cindy · セッション「{{title}}」への返信が必要です",
+ "newReply": "新しい返信"
},
"wecomGroupLabel": "WeCom グループ通知",
"wecomGroupHint": "自動操作の完了通知に使用します。WeCom グループボットの Webhook URL を貼り付けると、このデバイスに暗号化保存されます。",
@@ -7835,7 +7836,9 @@
"seconds": "{{n}} 秒",
"minutes": "{{n}} 分",
"hoursMinutes": "{{h}} 時間 {{m}} 分"
- }
+ },
+ "viewResult": "結果を見る",
+ "noWrittenResult": "テキストの結果はありません。"
},
"directMessage": {
"sentTo": "{{name}} にメッセージを送信",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 7d95995dff..f0c01f3106 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -836,7 +836,8 @@
"needsReply": "답변이 필요합니다",
"externalDone": "Cindy · 세션 “{{title}}” 완료됨 ✓",
"externalError": "Cindy · 세션 “{{title}}” 실행 실패",
- "externalNeedsReply": "Cindy · 세션 “{{title}}”에 답변이 필요합니다"
+ "externalNeedsReply": "Cindy · 세션 “{{title}}”에 답변이 필요합니다",
+ "newReply": "새 답장"
},
"wecomGroupLabel": "WeCom 그룹 알림",
"wecomGroupHint": "자동 작업 완료 알림에 사용됩니다. WeCom 그룹 봇 Webhook URL을 붙여넣으면 이 기기에 암호화되어 저장됩니다.",
@@ -7835,7 +7836,9 @@
"seconds": "{{n}}초",
"minutes": "{{n}}분",
"hoursMinutes": "{{h}}시간 {{m}}분"
- }
+ },
+ "viewResult": "결과 보기",
+ "noWrittenResult": "텍스트 결과가 없습니다."
},
"directMessage": {
"sentTo": "{{name}}에게 메시지를 보냄",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index 74bb8690e3..2d805da4c5 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -836,7 +836,8 @@
"needsReply": "需要你回复",
"externalDone": "Cindy · 任务「{{title}}」已完成 ✓",
"externalError": "Cindy · 任务「{{title}}」执行失败",
- "externalNeedsReply": "Cindy · 任务「{{title}}」需要你回复"
+ "externalNeedsReply": "Cindy · 任务「{{title}}」需要你回复",
+ "newReply": "有新回复"
},
"wecomGroupLabel": "企业微信群通知",
"wecomGroupHint": "用于自动操作的完成通知。粘贴企微群机器人的 Webhook URL,URL 会加密保存在本机。",
@@ -7835,7 +7836,9 @@
"seconds": "{{n}} 秒",
"minutes": "{{n}} 分钟",
"hoursMinutes": "{{h}} 小时 {{m}} 分"
- }
+ },
+ "viewResult": "查看结果",
+ "noWrittenResult": "没有文字结果。"
},
"directMessage": {
"sentTo": "已发消息给 {{name}}",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index d2f7026260..e2a76f164b 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -836,7 +836,8 @@
"needsReply": "需要你回覆",
"externalDone": "Cindy · 任務「{{title}}」已完成 ✓",
"externalError": "Cindy · 任務「{{title}}」執行失敗",
- "externalNeedsReply": "Cindy · 任務「{{title}}」需要你回覆"
+ "externalNeedsReply": "Cindy · 任務「{{title}}」需要你回覆",
+ "newReply": "有新回覆"
},
"wecomGroupLabel": "企業微信群通知",
"wecomGroupHint": "用於自動操作的完成通知。貼上企微群機器人的 Webhook URL,URL 會加密儲存在本機。",
@@ -7835,7 +7836,9 @@
"seconds": "{{n}} 秒",
"minutes": "{{n}} 分鐘",
"hoursMinutes": "{{h}} 小時 {{m}} 分"
- }
+ },
+ "viewResult": "查看結果",
+ "noWrittenResult": "沒有文字結果。"
},
"directMessage": {
"sentTo": "已傳訊息給 {{name}}",
diff --git a/apps/desktop/src/renderer/lib/ccAgent.types.ts b/apps/desktop/src/renderer/lib/ccAgent.types.ts
index 5ced75a51f..d566f007cb 100644
--- a/apps/desktop/src/renderer/lib/ccAgent.types.ts
+++ b/apps/desktop/src/renderer/lib/ccAgent.types.ts
@@ -52,6 +52,8 @@ export interface MessageAutomationOrigin {
* 只接受 SDK 自己分配的 uuid,所以这是 fork 的唯一主键。
*/
export interface CcMeta {
+ /** Provider text phase, retained to exclude commentary from notification previews. */
+ assistantPhase?: string;
uuid?: string;
parentUuid?: string;
/** Claude transcript chain parent. Do not confuse with parentUuid, which is parent_tool_use_id. */
diff --git a/apps/desktop/src/renderer/lib/makerChatStore.ts b/apps/desktop/src/renderer/lib/makerChatStore.ts
index 9567bbd064..126c2b6870 100644
--- a/apps/desktop/src/renderer/lib/makerChatStore.ts
+++ b/apps/desktop/src/renderer/lib/makerChatStore.ts
@@ -510,6 +510,7 @@ export interface ChatMessage {
| 'bot-session-task-message'
/** 伙伴发起的可追踪后台任务。 */
| 'bot-session-task'
+ | 'bot-session-task-result'
/**
* 伙伴之间的私聊入口:消息正文单独存储,这里只投影一枚可打开的时间线痕迹。
* 它不进入左栏,也不与后台任务卡混用。
@@ -17777,6 +17778,7 @@ function mapServerMessages(serverMsgs: Message[]): ChatMessage[] {
m.role === 'assistant'
&& (
collaboration?.role === 'delegation-request'
+ || collaboration?.role === 'delegation-result'
|| collaboration?.role === 'interjection')
) {
return {
@@ -17785,7 +17787,9 @@ function mapServerMessages(serverMsgs: Message[]): ChatMessage[] {
content: '',
isStreaming: false,
systemCardType:
- collaboration.role === 'interjection'
+ collaboration.role === 'delegation-result'
+ ? ('bot-session-task-result' as const)
+ : collaboration.role === 'interjection'
? ('bot-session-task-message' as const)
: ('bot-session-task' as const),
systemCardData: {
diff --git a/apps/mobile/src/__tests__/CompanionMessageCard.test.tsx b/apps/mobile/src/__tests__/CompanionMessageCard.test.tsx
index 8b99bcd095..cc7cadf928 100644
--- a/apps/mobile/src/__tests__/CompanionMessageCard.test.tsx
+++ b/apps/mobile/src/__tests__/CompanionMessageCard.test.tsx
@@ -4,6 +4,7 @@ import { createRoot, type Root } from 'react-dom/client';
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
const h = vi.hoisted(() => ({
invoke: vi.fn(),
+ openLink: vi.fn(),
push: vi.fn(),
openURL: vi.fn(),
changed: null as any,
@@ -42,7 +43,8 @@ vi.mock('expo-router', () => ({
useLocalSearchParams: () => ({ deviceId: 'home' }),
useRouter: () => ({ push: h.push }),
}));
-vi.mock('react-i18next', () => ({
+vi.mock('react-i18next', async (importOriginal) => ({
+ ...await importOriginal<typeof import('react-i18next')>(),
useTranslation: () => ({ t: (key: string) => key }),
}));
vi.mock('@/components/AppText', () => ({
@@ -66,6 +68,7 @@ vi.mock('@/auth/AuthContext', () => ({
vi.mock('@/device-link/DeviceLinkContext', () => ({
useDeviceLink: () => ({
invoke: h.invoke,
+ openLink: h.openLink,
status: h.status,
connectionEpoch: h.epoch,
getPresenceAvailability: () => true,
@@ -81,6 +84,7 @@ vi.mock('@/device-link/DeviceLinkContext', () => ({
},
}));
import { CompanionMessageCard } from '@/session/CompanionMessageCard';
+import { _clearRemotePathVerdictCache } from '@/session/remotePathVerdict';
import type { NormalizedRemoteMessage } from '@/session/messageNormalize';
const message = {
source: { sessionId: 'parent' },
@@ -109,6 +113,7 @@ beforeEach(() => {
h.epoch = 1;
h.status = 'online';
h.invoke.mockReset();
+ h.openLink.mockReset().mockResolvedValue({});
h.push.mockReset();
h.openURL.mockReset().mockResolvedValue(undefined);
h.invoke.mockResolvedValue({
@@ -125,6 +130,7 @@ beforeEach(() => {
});
afterEach(async () => {
await act(async () => root.unmount());
+ _clearRemotePathVerdictCache();
node.remove();
vi.useRealTimers();
});
@@ -514,3 +520,97 @@ it('shows only delivery status even when a legacy task trace contains full instr
expect(node.textContent).toBe('devices.companions.messageSent');
expect(h.invoke).not.toHaveBeenCalled();
});
+
+it('opens a stable completed result inline and routes its artifact to the child task', async () => {
+ h.invoke.mockImplementation(async (_device, channel) => channel === 'fs:stat-path'
+ ? { kind: 'file', resolvedPath: '/reports/result.pdf' } : { ok: true });
+ const resultMessage = {
+ ...message,
+ key: 'receipt-2',
+ companion: { kind: 'task', meta: { ...message.companion!.meta,
+ role: 'delegation-result', result: { runSequence: 2, status: 'completed', text: 'Second execution result', artifacts: [{ absolutePath: '/reports/result.pdf' }] },
+ } },
+ } as NormalizedRemoteMessage;
+ await act(async () => root.render(createElement(CompanionMessageCard, { message: resultMessage })));
+ expect(node.textContent).not.toContain('Second execution result');
+ await act(async () => node.querySelector('button')!.click());
+ expect(node.textContent).toContain('Second execution result');
+ const file = [...node.querySelectorAll('button')].find(button => button.textContent === 'result.pdf')!;
+ await act(async () => file.click());
+ expect(h.push).toHaveBeenCalledWith({ pathname: '/files/preview/[sessionId]', params: { sessionId: 'child', deviceId: 'home', absPath: '/reports/result.pdf' } });
+ expect(h.invoke).not.toHaveBeenCalledWith('home', 'maker:bot-delegations-list', expect.anything());
+});
+
+it('keeps image-only and linked results available from the mobile receipt', async () => {
+ h.invoke.mockImplementation(async (_device, channel) => channel === 'fs:stat-path'
+ ? { kind: 'file', resolvedPath: '/child-task/chart.png' } : { ok: true });
+ const { CompanionTaskResultCard } = await import('@/session/CompanionTaskResultCard');
+ const meta = { ...message.companion!.meta, role: 'delegation-result', childSessionId: 'child',
+ result: { runSequence: 1, status: 'completed', workingDir: '/child-task',
+ text: '![chart](./chart.png) [Report](https://example.com/report.pdf)', artifacts: [] } } as any;
+ await act(async () => root.render(createElement(CompanionTaskResultCard, { meta, deviceId: 'home' })));
+ await act(async () => node.querySelector('button')!.click());
+ expect(node.textContent).toContain('![chart](./chart.png)');
+ expect(node.textContent).not.toContain('devices.companions.noWrittenResult');
+ const chart = [...node.querySelectorAll('button')].find(button => button.textContent === 'chart')!;
+ await act(async () => chart.click());
+ expect(h.push).toHaveBeenCalledWith({ pathname: '/files/preview/[sessionId]', params: {
+ sessionId: 'child', deviceId: 'home', absPath: '/child-task/./chart.png',
+ } });
+ const report = [...node.querySelectorAll('button')].find(button => button.textContent === 'Report')!;
+ await act(async () => report.click());
+ expect(h.openURL).toHaveBeenCalledWith('https://example.com/report.pdf');
+});
+
+it('does not offer a local result link until the child file is verified', async () => {
+ let completeStat!: (result: { kind: 'file'; resolvedPath: string }) => void;
+ h.invoke.mockImplementation(async (_device, channel) => channel === 'fs:stat-path'
+ ? new Promise((resolve) => { completeStat = resolve; }) : { ok: true });
+ const { CompanionTaskResultCard } = await import('@/session/CompanionTaskResultCard');
+ const meta = { ...message.companion!.meta, role: 'delegation-result', childSessionId: 'child',
+ result: { runSequence: 1, status: 'completed', workingDir: '/child-task',
+ text: '[Chart](./chart.png)', artifacts: [] } } as any;
+ await act(async () => root.render(createElement(CompanionTaskResultCard, { meta, deviceId: 'home' })));
+ await act(async () => node.querySelector('button')!.click());
+ expect(node.textContent).toContain('Chart');
+ expect([...node.querySelectorAll('button')].some(button => button.textContent === 'Chart')).toBe(false);
+ await act(async () => completeStat({ kind: 'file', resolvedPath: '/child-task/chart.png' }));
+ const chart = [...node.querySelectorAll('button')].find(button => button.textContent === 'Chart')!;
+ await act(async () => chart.click());
+ expect(h.push).toHaveBeenCalledWith({ pathname: '/files/preview/[sessionId]', params: {
+ sessionId: 'child', deviceId: 'home', absPath: '/child-task/./chart.png',
+ } });
+});
+
+it('keeps missing and offline result files readable without dead preview actions', async () => {
+ h.invoke.mockImplementation(async (_device, channel, args) => {
+ if (channel !== 'fs:stat-path') return { ok: true };
+ if (args[0].path.endsWith('offline.png')) throw new Error('offline');
+ return { kind: 'missing', resolvedPath: args[0].path };
+ });
+ const { CompanionTaskResultCard } = await import('@/session/CompanionTaskResultCard');
+ const meta = { ...message.companion!.meta, role: 'delegation-result', childSessionId: 'child',
+ result: { runSequence: 1, status: 'completed', workingDir: '/child-task',
+ text: '[Missing](./missing.png) [Offline](./offline.png)',
+ artifacts: [{ absolutePath: '/child-task/gone.pdf' }] } } as any;
+ await act(async () => root.render(createElement(CompanionTaskResultCard, { meta, deviceId: 'home' })));
+ await act(async () => node.querySelector('button')!.click());
+ expect(node.textContent).toContain('Missing');
+ expect(node.textContent).toContain('Offline');
+ expect(node.textContent).toContain('gone.pdf');
+ expect([...node.querySelectorAll('button')].some(button => ['Missing', 'Offline', 'gone.pdf'].includes(button.textContent ?? ''))).toBe(false);
+ expect(h.push).not.toHaveBeenCalled();
+});
+
+it('reveals frozen failure details only after opening the result and its details', async () => {
+ const { CompanionTaskResultCard } = await import('@/session/CompanionTaskResultCard');
+ const meta = { result: { status: 'timed-out', text: '', error: 'TIMEOUT: upstream did not finish', artifacts: [] }, objective: 'Report' } as any;
+ await act(async () => root.render(createElement(CompanionTaskResultCard, { meta, deviceId: 'home' })));
+ expect(node.textContent).toContain('devices.companions.status.timed-out');
+ expect(node.textContent).not.toContain('TIMEOUT:');
+ await act(async () => node.querySelector('button')!.click());
+ expect(node.textContent).not.toContain('TIMEOUT:');
+ const details = Array.from(node.querySelectorAll('button')).find(button => button.textContent === 'interaction.companion.details');
+ await act(async () => details!.click());
+ expect(node.textContent).toContain('TIMEOUT: upstream did not finish');
+});
diff --git a/apps/mobile/src/i18n/locales/en/devices.json b/apps/mobile/src/i18n/locales/en/devices.json
index 293db288cc..8cc605a88e 100644
--- a/apps/mobile/src/i18n/locales/en/devices.json
+++ b/apps/mobile/src/i18n/locales/en/devices.json
@@ -979,7 +979,9 @@
"retryFailed": "Couldn’t retry just now. Please try again shortly.",
"leave": "Step away",
"avatarSkipped": "Using the default portrait for now. You can change it anytime."
- }
+ },
+ "viewResult": "View Result",
+ "noWrittenResult": "No written result."
},
"companionProfile": {
"avatar": "Avatar",
diff --git a/apps/mobile/src/i18n/locales/ja/devices.json b/apps/mobile/src/i18n/locales/ja/devices.json
index e5b680c133..04c411aa3e 100644
--- a/apps/mobile/src/i18n/locales/ja/devices.json
+++ b/apps/mobile/src/i18n/locales/ja/devices.json
@@ -979,7 +979,9 @@
"retryFailed": "再試行できませんでした。少し待ってお試しください。",
"leave": "いったん離れる",
"avatarSkipped": "今は初期アバターを使っています。いつでも変更できます。"
- }
+ },
+ "viewResult": "結果を見る",
+ "noWrittenResult": "テキストの結果はありません。"
},
"companionProfile": {
"avatar": "アバター",
diff --git a/apps/mobile/src/i18n/locales/ko/devices.json b/apps/mobile/src/i18n/locales/ko/devices.json
index 8ff409ed4a..223012e431 100644
--- a/apps/mobile/src/i18n/locales/ko/devices.json
+++ b/apps/mobile/src/i18n/locales/ko/devices.json
@@ -979,7 +979,9 @@
"retryFailed": "지금은 다시 시도할 수 없어요. 잠시 후 시도해 주세요.",
"leave": "잠시 나가기",
"avatarSkipped": "지금은 기본 아바타를 사용해요. 언제든 바꿀 수 있어요."
- }
+ },
+ "viewResult": "결과 보기",
+ "noWrittenResult": "텍스트 결과가 없습니다."
},
"companionProfile": {
"avatar": "아바타",
diff --git a/apps/mobile/src/i18n/locales/zh-CN/devices.json b/apps/mobile/src/i18n/locales/zh-CN/devices.json
index b262df9a61..cd548af6f6 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/devices.json
+++ b/apps/mobile/src/i18n/locales/zh-CN/devices.json
@@ -979,7 +979,9 @@
"retryFailed": "暂时无法重试,请稍后再试。",
"leave": "先去忙",
"avatarSkipped": "暂时用了默认头像,你随时可以换一张。"
- }
+ },
+ "viewResult": "查看结果",
+ "noWrittenResult": "没有文字结果。"
},
"companionProfile": {
"avatar": "头像",
diff --git a/apps/mobile/src/i18n/locales/zh-TW/devices.json b/apps/mobile/src/i18n/locales/zh-TW/devices.json
index 0d6e51ae80..cecddf6bb9 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/devices.json
+++ b/apps/mobile/src/i18n/locales/zh-TW/devices.json
@@ -979,7 +979,9 @@
"retryFailed": "暫時無法重試,請稍後再試。",
"leave": "先去忙",
"avatarSkipped": "暫時用了預設頭像,你隨時可以換一張。"
- }
+ },
+ "viewResult": "查看結果",
+ "noWrittenResult": "沒有文字結果。"
},
"companionProfile": {
"avatar": "頭像",
diff --git a/apps/mobile/src/session/CompanionMessageCard.tsx b/apps/mobile/src/session/CompanionMessageCard.tsx
index 81bd7904e2..ffa947ba0c 100644
--- a/apps/mobile/src/session/CompanionMessageCard.tsx
+++ b/apps/mobile/src/session/CompanionMessageCard.tsx
@@ -1,3 +1,4 @@
+import { CompanionTaskResultCard } from './CompanionTaskResultCard';
import { Component, useEffect, useState, type ReactNode } from 'react';
import { useLocalSearchParams, useRouter } from 'expo-router';
import { Linking, Pressable, StyleSheet, View, type LayoutChangeEvent } from 'react-native';
@@ -74,6 +75,9 @@ function CompanionMessageCardContent({ message }: { message: NormalizedRemoteMes
const styles = useThemedStyles(makeStyles);
const card = message.companion;
if (!card) return null;
+ if (card.kind === 'task' && card.meta.role === 'delegation-result') {
+ return <CompanionTaskResultCard meta={card.meta} deviceId={deviceId} />;
+ }
if (card.kind === 'task' && card.meta.role === 'delegation-request') {
return (
<CompanionTaskCard
diff --git a/apps/mobile/src/session/CompanionTaskResultCard.tsx b/apps/mobile/src/session/CompanionTaskResultCard.tsx
new file mode 100644
index 0000000000..2286bb934a
--- /dev/null
+++ b/apps/mobile/src/session/CompanionTaskResultCard.tsx
@@ -0,0 +1,125 @@
+import { useEffect, useState } from 'react';
+import { Linking, Pressable, View, StyleSheet } from 'react-native';
+import { useRouter } from 'expo-router';
+import { useTranslation } from 'react-i18next';
+import type { BotCollaborationMeta } from '@cindy/maker-shared/botCollaboration';
+import { Text } from '@/components/AppText';
+import { useThemedStyles, type ThemeColors } from '@/theme';
+import { radius, spacing, typeScale } from '@/theme/tokens';
+import { classifyChatPathLinkTarget, isAbsolutePathShape, resolveChatAbsPath } from '@/session/chatPathCandidate';
+import { parseMobileMarkdown } from '@/session/messageMarkdown';
+import { useDeviceLink } from '@/device-link/DeviceLinkContext';
+import type { RemotePathStatResult } from '@/device-link/mobileMakerTransport';
+import {
+ peekRemotePathVerdict,
+ peekRemotePathVerdictForRender,
+ remotePathVerdictKey,
+ subscribeRemotePathVerdictChange,
+ verifyRemotePathCached,
+} from '@/session/remotePathVerdict';
+
+function resultLinks(text: string): Array<{ label: string; url: string }> {
+ const seen = new Set<string>();
+ const links: Array<{ label: string; url: string }> = [];
+ for (const block of parseMobileMarkdown(text)) {
+ if (!('inlines' in block)) continue;
+ for (const inline of block.inlines) {
+ if (inline.type !== 'link' && inline.type !== 'image') continue;
+ if (seen.has(inline.url)) continue;
+ seen.add(inline.url);
+ links.push({ label: (inline.type === 'image' ? inline.alt : inline.text) || inline.url, url: inline.url });
+ }
+ }
+ return links;
+}
+
+function ResultFileAction({
+ label, absPath, workdir, childSessionId, deviceId,
+}: {
+ label: string;
+ absPath: string;
+ workdir: string;
+ childSessionId?: string | null;
+ deviceId: string;
+}) {
+ const { openLink, invoke } = useDeviceLink();
+ const router = useRouter();
+ const styles = useThemedStyles(makeStyles);
+ const [cacheGen, setCacheGen] = useState(0);
+ useEffect(() => {
+ if (!deviceId || !childSessionId) return;
+ const key = remotePathVerdictKey(deviceId, workdir, absPath);
+ return subscribeRemotePathVerdictChange((changed) => {
+ if (changed === key) setCacheGen((generation) => generation + 1);
+ });
+ }, [absPath, childSessionId, deviceId, workdir]);
+ useEffect(() => {
+ if (!deviceId || !childSessionId || peekRemotePathVerdict(deviceId, workdir, absPath)) return;
+ void verifyRemotePathCached(deviceId, workdir, absPath, async (path) => {
+ await openLink(deviceId);
+ return invoke<RemotePathStatResult>(deviceId, 'fs:stat-path', [{ path }]);
+ });
+ }, [absPath, cacheGen, childSessionId, deviceId, invoke, openLink, workdir]);
+ // A lexical path (or an offline/unknown verdict) is not an actionable result.
+ // Keep the label readable and selectable until the child file is confirmed.
+ const verified = !!childSessionId && !!deviceId
+ && peekRemotePathVerdictForRender(deviceId, workdir, absPath) === 'file';
+ if (!verified || !childSessionId) return <View style={styles.action}>
+ <Text selectable style={styles.title}>{label}</Text>
+ </View>;
+ return <Pressable accessibilityRole="link" style={styles.action}
+ onPress={() => router.push({ pathname: '/files/preview/[sessionId]', params: {
+ sessionId: childSessionId, deviceId, absPath,
+ } })}>
+ <Text style={[styles.title, styles.link]}>{label}</Text>
+ </Pressable>;
+}
+
+export function CompanionTaskResultCard({ meta, deviceId }: { meta: BotCollaborationMeta; deviceId: string }) {
+ const [expanded, setExpanded] = useState(false);
+ const [showError, setShowError] = useState(false);
+ const { t } = useTranslation();
+ const styles = useThemedStyles(makeStyles);
+ const result = meta.result;
+ if (!result) return null;
+ const links = resultLinks(result.text);
+ return <View style={styles.card}>
+ <Pressable accessibilityRole="button" accessibilityState={{ expanded }} onPress={() => setExpanded(!expanded)} style={styles.action}>
+ <Text numberOfLines={2} style={styles.title}>{meta.objective}</Text>
+ <Text style={styles.secondary}>{t(`devices.companions.status.${result.status}`)} · {t('devices.companions.viewResult')}</Text>
+ </Pressable>
+ {expanded && <View style={styles.content}>
+ <Text selectable style={styles.body}>{result.text || t('devices.companions.noWrittenResult')}</Text>
+ {links.map(({ label, url }) => {
+ if (/^https?:\/\//i.test(url)) return <Pressable key={url} accessibilityRole="link" style={styles.action}
+ onPress={() => { void Linking.openURL(url).catch(() => undefined); }}>
+ <Text style={[styles.title, styles.link]}>{label}</Text>
+ </Pressable>;
+ const path = classifyChatPathLinkTarget(url);
+ if (!path || (!result.workingDir && !isAbsolutePathShape(path.href) && !path.href.startsWith('file://'))) return null;
+ return <ResultFileAction key={url} label={label} absPath={resolveChatAbsPath(path.href, result.workingDir ?? '')}
+ workdir={result.workingDir ?? ''} childSessionId={meta.childSessionId} deviceId={deviceId} />;
+ })}
+ {result.error && <View>
+ <Pressable accessibilityRole="button" accessibilityState={{ expanded: showError }} onPress={() => setShowError(!showError)} style={styles.action}>
+ <Text style={styles.secondary}>{t('interaction.companion.details')}</Text>
+ </Pressable>
+ {showError && <Text selectable style={styles.secondary}>{result.error}</Text>}
+ </View>}
+ {result.artifacts.map((artifact) => <ResultFileAction key={artifact.absolutePath}
+ label={artifact.absolutePath.split(/[\\/]/).pop() ?? artifact.absolutePath}
+ absPath={artifact.absolutePath} workdir={result.workingDir ?? ''}
+ childSessionId={meta.childSessionId} deviceId={deviceId} />)}
+ </View>}
+ </View>;
+}
+
+const makeStyles = (colors: ThemeColors) => StyleSheet.create({
+ card: { borderWidth: StyleSheet.hairlineWidth, borderColor: colors.border, backgroundColor: colors.surface, borderRadius: radius.container, overflow: 'hidden' },
+ action: { minHeight: 44, padding: spacing.md, gap: spacing.xs },
+ title: { fontSize: typeScale.body, color: colors.textPrimary },
+ link: { textDecorationLine: 'underline' },
+ secondary: { fontSize: typeScale.caption, color: colors.textSecondary },
+ body: { fontSize: typeScale.body, color: colors.textPrimary },
+ content: { padding: spacing.md, borderTopWidth: StyleSheet.hairlineWidth, borderColor: colors.border },
+});
diff --git a/apps/mobile/src/session/messageNormalize.ts b/apps/mobile/src/session/messageNormalize.ts
index ff60ec8296..388a97b6e9 100644
--- a/apps/mobile/src/session/messageNormalize.ts
+++ b/apps/mobile/src/session/messageNormalize.ts
@@ -242,7 +242,7 @@ export function normalizeRemoteMessages(
const task = readBotCollaborationMeta(message.agentMeta?.botCollaboration);
const direct = readBotDirectMessageMeta(message.agentMeta?.botDirectMessage);
- const isTaskTrace = task?.role === 'delegation-request' || task?.role === 'interjection';
+ const isTaskTrace = task?.role === 'delegation-request' || task?.role === 'delegation-result' || task?.role === 'interjection';
if (isTaskTrace || direct) {
result.push({
key: messageNormalizeKey(message), source: message, kind: 'system', role: message.role,
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index c819a5f5eb..bda6d36a12 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -18,7 +18,7 @@
| `desktop.auth.add-account` | desktop | 添加账号 | hash `/add-account`(ProtectedRoute → AddAccountLoginPage) | AddAccountLoginPage | apps/desktop/src/renderer/components/login/AddAccountLoginPage.tsx, apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/login/LoginCaptchaOverlay.tsx, apps/desktop/src/renderer/components/login/LoginControls.tsx, apps/desktop/src/renderer/components/login/LoginPage.tsx, apps/desktop/src/renderer/components/login/loginDesignTokens.ts | 59 | 0 | 20 |
| `desktop.auth.legacy-migration` | desktop | 首登数据迁移弹窗 | App 顶层挂载 LegacyMigrationDialog(仅主窗;main 检测到旧版 userData 经 `legacy-migration:state` 驱动) | LegacyMigrationDialog | apps/desktop/src/renderer/components/auth/LegacyMigrationDialog.tsx | 8 | 0 | 2 |
| `desktop.auth.login` | desktop | 登录页 | hash `/login`(GuestRoute → LoginPage) | LoginBrandStage, LoginCaptchaOverlay, LoginControls, LoginPage | apps/desktop/src/renderer/components/login/LoginBrandStage.tsx, apps/desktop/src/renderer/components/login/LoginCaptchaOverlay.tsx, apps/desktop/src/renderer/components/login/LoginControls.tsx, apps/desktop/src/renderer/components/login/LoginPage.tsx, apps/desktop/src/renderer/components/login/loginDesignTokens.ts | 59 | 0 | 20 |
-| `desktop.bots` | desktop | 伙伴(列表 / 对话 / 设置 / 历史 / 伙伴私聊) | hash `/bots`、`/bots/list`、`/bots/:botId`、`/bots/roster` 及伙伴当前/历史任务、伙伴私聊路由(BotsFeatureLayout) | BotBasicProfileFields, BotCollaborationCard, BotDirectMessageView, BotHistorySessionView, BotLifecycleSettings, BotModelChainEditor, BotRosterView, BotSessionView, BotSettingsDrawer, BotsHomeView, BotsListView, RemoteBotSessionView | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/bots/BotAuthorizationCard.tsx, apps/desktop/src/renderer/features/bots/BotAvatar.tsx, apps/desktop/src/renderer/features/bots/BotBasicProfileFields.tsx, apps/desktop/src/renderer/features/bots/BotCapabilitySettings.tsx, apps/desktop/src/renderer/features/bots/BotCollaborationCard.tsx, apps/desktop/src/renderer/features/bots/BotConnectionStatus.tsx, apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx, apps/desktop/src/renderer/features/bots/BotDeleteDialog.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageCard.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageView.tsx, apps/desktop/src/renderer/features/bots/BotGenerationLabel.tsx, apps/desktop/src/renderer/features/bots/BotHistorySessionView.tsx, apps/desktop/src/renderer/features/bots/BotInvitationWelcome.tsx, apps/desktop/src/renderer/features/bots/BotLifecycleSettings.tsx, apps/desktop/src/renderer/features/bots/BotMemorySettings.tsx, apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx, apps/desktop/src/renderer/features/bots/BotPortraitPicker.tsx, apps/desktop/src/renderer/features/bots/BotRosterView.tsx, apps/desktop/src/renderer/features/bots/BotRoutines.tsx, apps/desktop/src/renderer/features/bots/BotSessionContentHeader.tsx, apps/desktop/src/renderer/features/bots/BotSessionView.tsx, apps/desktop/src/renderer/features/bots/BotSettingsBlock.tsx, apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotWorkingStatus.tsx, apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx, apps/desktop/src/renderer/features/bots/BotsGlobalSettingsSection.tsx, apps/desktop/src/renderer/features/bots/BotsHomeView.tsx, apps/desktop/src/renderer/features/bots/BotsListView.tsx, apps/desktop/src/renderer/features/bots/BotsSidebar.tsx, apps/desktop/src/renderer/features/bots/CindyDevicePicker.tsx, apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSessionView.tsx, apps/desktop/src/renderer/features/bots/botAvatarIdentity.ts, apps/desktop/src/renderer/features/bots/botCapabilityDefaults.ts, apps/desktop/src/renderer/features/bots/botChatPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationTimeline.ts, apps/desktop/src/renderer/features/bots/botDelegationLive.ts, apps/desktop/src/renderer/features/bots/botGeneratedArtifacts.ts, apps/desktop/src/renderer/features/bots/botListDisplay.ts, apps/desktop/src/renderer/features/bots/botNavigation.ts, apps/desktop/src/renderer/features/bots/botPronounContext.tsx, apps/desktop/src/renderer/features/bots/botReadState.ts, apps/desktop/src/renderer/features/bots/botRosterDisplay.ts, apps/desktop/src/renderer/features/bots/botSessionOwners.ts, apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/botStore.ts, apps/desktop/src/renderer/features/bots/botWelcomeContext.ts, apps/desktop/src/renderer/features/bots/cindyDeviceRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotRoster.ts, apps/desktop/src/renderer/features/bots/useBotGeneratedFileDeliveries.ts, apps/desktop/src/renderer/features/bots/useBotIslandVisibleSession.ts, apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/useRemoteBots.ts, apps/desktop/src/renderer/features/bots/useWorkingStatusCopy.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 276 | 43 | 443 |
+| `desktop.bots` | desktop | 伙伴(列表 / 对话 / 设置 / 历史 / 伙伴私聊) | hash `/bots`、`/bots/list`、`/bots/:botId`、`/bots/roster` 及伙伴当前/历史任务、伙伴私聊路由(BotsFeatureLayout) | BotBasicProfileFields, BotCollaborationCard, BotDirectMessageView, BotHistorySessionView, BotLifecycleSettings, BotModelChainEditor, BotRosterView, BotSessionView, BotSettingsDrawer, BotsHomeView, BotsListView, RemoteBotSessionView | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/bots/BotAuthorizationCard.tsx, apps/desktop/src/renderer/features/bots/BotAvatar.tsx, apps/desktop/src/renderer/features/bots/BotBasicProfileFields.tsx, apps/desktop/src/renderer/features/bots/BotCapabilitySettings.tsx, apps/desktop/src/renderer/features/bots/BotCollaborationCard.tsx, apps/desktop/src/renderer/features/bots/BotConnectionStatus.tsx, apps/desktop/src/renderer/features/bots/BotCreateMenu.tsx, apps/desktop/src/renderer/features/bots/BotDeleteDialog.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageCard.tsx, apps/desktop/src/renderer/features/bots/BotDirectMessageView.tsx, apps/desktop/src/renderer/features/bots/BotGenerationLabel.tsx, apps/desktop/src/renderer/features/bots/BotHistorySessionView.tsx, apps/desktop/src/renderer/features/bots/BotInvitationWelcome.tsx, apps/desktop/src/renderer/features/bots/BotLifecycleSettings.tsx, apps/desktop/src/renderer/features/bots/BotMemorySettings.tsx, apps/desktop/src/renderer/features/bots/BotModelChainEditor.tsx, apps/desktop/src/renderer/features/bots/BotPortraitPicker.tsx, apps/desktop/src/renderer/features/bots/BotRosterView.tsx, apps/desktop/src/renderer/features/bots/BotRoutines.tsx, apps/desktop/src/renderer/features/bots/BotSessionContentHeader.tsx, apps/desktop/src/renderer/features/bots/BotSessionTaskResultCard.tsx, apps/desktop/src/renderer/features/bots/BotSessionView.tsx, apps/desktop/src/renderer/features/bots/BotSettingsBlock.tsx, apps/desktop/src/renderer/features/bots/BotSettingsDrawer.tsx, apps/desktop/src/renderer/features/bots/BotWorkingStatus.tsx, apps/desktop/src/renderer/features/bots/BotsFeatureLayout.tsx, apps/desktop/src/renderer/features/bots/BotsGlobalSettingsSection.tsx, apps/desktop/src/renderer/features/bots/BotsHomeView.tsx, apps/desktop/src/renderer/features/bots/BotsListView.tsx, apps/desktop/src/renderer/features/bots/BotsSidebar.tsx, apps/desktop/src/renderer/features/bots/CindyDevicePicker.tsx, apps/desktop/src/renderer/features/bots/CindyDeviceRow.tsx, apps/desktop/src/renderer/features/bots/RemoteBotSessionView.tsx, apps/desktop/src/renderer/features/bots/botAvatarIdentity.ts, apps/desktop/src/renderer/features/bots/botCapabilityDefaults.ts, apps/desktop/src/renderer/features/bots/botChatPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationPresentation.ts, apps/desktop/src/renderer/features/bots/botConversationTimeline.ts, apps/desktop/src/renderer/features/bots/botDelegationLive.ts, apps/desktop/src/renderer/features/bots/botGeneratedArtifacts.ts, apps/desktop/src/renderer/features/bots/botListDisplay.ts, apps/desktop/src/renderer/features/bots/botNavigation.ts, apps/desktop/src/renderer/features/bots/botPronounContext.tsx, apps/desktop/src/renderer/features/bots/botReadState.ts, apps/desktop/src/renderer/features/bots/botRosterDisplay.ts, apps/desktop/src/renderer/features/bots/botSessionOwners.ts, apps/desktop/src/renderer/features/bots/botSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/botStore.ts, apps/desktop/src/renderer/features/bots/botWelcomeContext.ts, apps/desktop/src/renderer/features/bots/cindyDeviceRoster.ts, apps/desktop/src/renderer/features/bots/remoteBotRoster.ts, apps/desktop/src/renderer/features/bots/useBotGeneratedFileDeliveries.ts, apps/desktop/src/renderer/features/bots/useBotIslandVisibleSession.ts, apps/desktop/src/renderer/features/bots/useBotSettingsAutosave.ts, apps/desktop/src/renderer/features/bots/useRemoteBots.ts, apps/desktop/src/renderer/features/bots/useWorkingStatusCopy.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx | 276 | 43 | 446 |
| `desktop.chat.files` | desktop | 工作目录文件浏览 | hash `/cc-agent/files/:sessionId`(WorkdirBrowseRoute) | FileBodyView, FileTreeView, WorkdirBrowseRoute | apps/desktop/src/renderer/features/cc-agent/workdir-browse/DocSearchBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/DrawioPreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileBodyView.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileFilterInput.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileTabsBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FileTreeView.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/FilterResultList.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/ImagePreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/OpenInSystemActions.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/PdfPreview.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/SessionTabsBar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/UnrenderablePlaceholder.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/WorkdirBrowseRoute.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/WorkdirBrowseSidebar.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useChatRailCollapsed.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useChatRailResize.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useConfirmSwitchAwayIfDirty.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useDelayedFlag.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useFileContent.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useFileTree.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useOpenTabs.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useProjectFileList.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/hooks/useRevealFileInTree.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/activeFileBodyHandle.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/docModeSwitchProjects.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/drawioExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/expandedStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileContentCache.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileIcon.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileMeta.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileScrollStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/fileSelectionParams.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/filterFiles.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/imageExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/markdownAutosave.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/openTabsStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/pdfExt.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/lib/selectedFileStore.ts, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchInput.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchPanel.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/SearchResults.tsx, apps/desktop/src/renderer/features/cc-agent/workdir-browse/search/hooks/useProjectSearch.ts | 17 | 7 | 62 |
| `desktop.chat.new-draft` | desktop | 新建任务草稿页 | hash `/cc-agent/new`(NewMakerDraftRoute) | NewMakerDraftRoute | apps/desktop/src/renderer/features/cc-agent/NewMakerDraftRoute.tsx | 15 | 0 | 2 |
| `desktop.chat.orca-workflow` | desktop | Orca 协同工作台 | hash `/cc-agent/orca/:sessionId`(OrcaWorkflowRoute) | CCAgentSessionView, OrcaSplitView, OrcaWorkerPanel, OrcaWorkflowRoute | apps/desktop/src/renderer/components/chat/AgentActionRow.tsx, apps/desktop/src/renderer/components/chat/AgentActionsBlock.tsx, apps/desktop/src/renderer/components/chat/AgentTaskCard.tsx, apps/desktop/src/renderer/components/chat/AskUserQuestionBubble.tsx, apps/desktop/src/renderer/components/chat/AssistantMessage.tsx, apps/desktop/src/renderer/components/chat/AutomationOriginBadge.tsx, apps/desktop/src/renderer/components/chat/ChatAudioCard.tsx, apps/desktop/src/renderer/components/chat/ChatDisplaySnapshotContext.tsx, apps/desktop/src/renderer/components/chat/ChatImageView.tsx, apps/desktop/src/renderer/components/chat/ChatSessionFileContext.tsx, apps/desktop/src/renderer/components/chat/ChatSoundEffectCard.tsx, apps/desktop/src/renderer/components/chat/ChatVideoView.tsx, apps/desktop/src/renderer/components/chat/CindyMakeDoctorCard.tsx, apps/desktop/src/renderer/components/chat/CopyAsImageBlock.tsx, apps/desktop/src/renderer/components/chat/CredentialSwitchWaitBanner.tsx, apps/desktop/src/renderer/components/chat/DiffView.tsx, apps/desktop/src/renderer/components/chat/ErrorBanner.tsx, apps/desktop/src/renderer/components/chat/ErrorMessageCard.tsx, apps/desktop/src/renderer/components/chat/GeneratedFilesCard.tsx, apps/desktop/src/renderer/components/chat/GhostSummonCard.tsx, apps/desktop/src/renderer/components/chat/GhostToolCard.tsx, apps/desktop/src/renderer/components/chat/HookTaskCard.tsx, apps/desktop/src/renderer/components/chat/ImageGalleryContext.tsx, apps/desktop/src/renderer/components/chat/ImageHoverPreview.tsx, apps/desktop/src/renderer/components/chat/ImageLightbox.tsx, apps/desktop/src/renderer/components/chat/ImageMissingPlaceholder.tsx, apps/desktop/src/renderer/components/chat/InlineReferenceChip.tsx, apps/desktop/src/renderer/components/chat/InterruptedTurnBanner.tsx, apps/desktop/src/renderer/components/chat/JumpToBottomChip.tsx, apps/desktop/src/renderer/components/chat/MarkdownDiffBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownMermaidBlock.tsx, apps/desktop/src/renderer/components/chat/MarkdownRenderer.tsx, apps/desktop/src/renderer/components/chat/MermaidLightbox.tsx, apps/desktop/src/renderer/components/chat/MessageActionBar.tsx, apps/desktop/src/renderer/components/chat/MessageNavRail.tsx, apps/desktop/src/renderer/components/chat/MessageStream.tsx, apps/desktop/src/renderer/components/chat/ModelLightbox.tsx, apps/desktop/src/renderer/components/chat/NewMessageIndicator.tsx, apps/desktop/src/renderer/components/chat/PlanReviewBubble.tsx, apps/desktop/src/renderer/components/chat/PrevMessageJumpChip.tsx, apps/desktop/src/renderer/components/chat/ProjectLinkChip.tsx, apps/desktop/src/renderer/components/chat/QuoteChip.tsx, apps/desktop/src/renderer/components/chat/RewindPreviewDialog.tsx, apps/desktop/src/renderer/components/chat/SelectionQuoteButton.tsx, apps/desktop/src/renderer/components/chat/SentAgentReferenceChip.tsx, apps/desktop/src/renderer/components/chat/SentInlineAtomBody.tsx, apps/desktop/src/renderer/components/chat/SessionHandoffCard.tsx, apps/desktop/src/renderer/components/chat/SessionLinkChip.tsx, apps/desktop/src/renderer/components/chat/ShareMessageCheckbox.tsx, apps/desktop/src/renderer/components/chat/ShareSelectionBar.tsx, apps/desktop/src/renderer/components/chat/SlackIcon.tsx, apps/desktop/src/renderer/components/chat/StreamFadeSpan.tsx, apps/desktop/src/renderer/components/chat/StreamingMarkdownChunk.tsx, apps/desktop/src/renderer/components/chat/SystemCard.tsx, apps/desktop/src/renderer/components/chat/TextLightbox.tsx, apps/desktop/src/renderer/components/chat/ThinkingCard.tsx, apps/desktop/src/renderer/components/chat/ThinkingText.tsx, apps/desktop/src/renderer/components/chat/TodoListCard.tsx, apps/desktop/src/renderer/components/chat/ToolCallCard.tsx, apps/desktop/src/renderer/components/chat/ToolPayloadLightbox.tsx, apps/desktop/src/renderer/components/chat/TopRightChipStack.tsx, apps/desktop/src/renderer/components/chat/TurnChangesCard.tsx, apps/desktop/src/renderer/components/chat/UnreadFailedScheduleBanner.tsx, apps/desktop/src/renderer/components/chat/UpgradeBanner.tsx, apps/desktop/src/renderer/components/chat/UserMessage.tsx, apps/desktop/src/renderer/components/chat/UserMessageEditBox.tsx, apps/desktop/src/renderer/components/chat/UserMessageUrlLink.tsx, apps/desktop/src/renderer/components/chat/VideoLightbox.tsx, apps/desktop/src/renderer/components/chat/WorkGroupBlock.tsx, apps/desktop/src/renderer/components/chat/WorktreeRestoreBanner.tsx, apps/desktop/src/renderer/components/chat/XIcon.tsx, apps/desktop/src/renderer/components/chat/activityRowChrome.ts, apps/desktop/src/renderer/components/chat/autoFollowIntent.ts, apps/desktop/src/renderer/components/chat/chatChrome.ts, apps/desktop/src/renderer/components/chat/errorReasonI18n.ts, apps/desktop/src/renderer/components/chat/generatedFilesProjection.ts, apps/desktop/src/renderer/components/chat/imageDisplaySize.ts, apps/desktop/src/renderer/components/chat/lightboxAnnotations.ts, apps/desktop/src/renderer/components/chat/lightboxGestures.ts, apps/desktop/src/renderer/components/chat/markdownImageTargets.ts, apps/desktop/src/renderer/components/chat/messageNavRailModel.ts, apps/desktop/src/renderer/components/chat/messageNavRailWheel.ts, apps/desktop/src/renderer/components/chat/messageProjectionCache.ts, apps/desktop/src/renderer/components/chat/messageStreamIndicatorPosition.ts, apps/desktop/src/renderer/components/chat/messageViewportCompensation.ts, apps/desktop/src/renderer/components/chat/messageWorkGroups.ts, apps/desktop/src/renderer/components/chat/rehypeFencedCodeMarker.ts, apps/desktop/src/renderer/components/chat/rehypeMathBlockMarker.ts, apps/desktop/src/renderer/components/chat/rehypeStreamWordFade.ts, apps/desktop/src/renderer/components/chat/remarkHtmlImages.ts, apps/desktop/src/renderer/components/chat/remarkLocalPathLinks.ts, apps/desktop/src/renderer/components/chat/remarkPreserveRawLocalDestinations.ts, apps/desktop/src/renderer/components/chat/remarkSessionLinks.ts, apps/desktop/src/renderer/components/chat/remarkStrictInlineMath.ts, apps/desktop/src/renderer/components/chat/remarkTruncateCjkUrls.ts, apps/desktop/src/renderer/components/chat/repairStreamingMarkdown.ts, apps/desktop/src/renderer/components/chat/scrollAnchoringDetect.ts, apps/desktop/src/renderer/components/chat/shareSelectionStore.ts, apps/desktop/src/renderer/components/chat/streamingMarkdownBlocks.tsx, apps/desktop/src/renderer/components/chat/streamingMarkdownChunks.ts, apps/desktop/src/renderer/components/chat/toolLoopI18n.ts, apps/desktop/src/renderer/components/chat/unreadCount.ts, apps/desktop/src/renderer/components/chat/useAutomaticHistoryLoadBudget.ts, apps/desktop/src/renderer/components/chat/useCopyAsImage.tsx, apps/desktop/src/renderer/components/chat/useDeleteMessage.ts, apps/desktop/src/renderer/components/chat/useFileChipContextMenu.tsx, apps/desktop/src/renderer/components/chat/useForkAtMessage.ts, apps/desktop/src/renderer/components/chat/useNavigationKeyListener.ts, apps/desktop/src/renderer/components/chat/useOpenWithMenu.tsx, apps/desktop/src/renderer/components/chat/usePrevUserMessageInView.ts, apps/desktop/src/renderer/components/chat/useTurnChangeSets.ts, apps/desktop/src/renderer/components/chat/userMessageCollapse.ts, apps/desktop/src/renderer/components/chat/userMessageDisplayText.ts, apps/desktop/src/renderer/components/chat/userMessageLinkify.ts, apps/desktop/src/renderer/components/chat/viewportFillDetect.ts, apps/desktop/src/renderer/components/new-chat/AddRemoteProjectDialog.tsx, apps/desktop/src/renderer/components/new-chat/AgentSelect.tsx, apps/desktop/src/renderer/components/new-chat/AskUserQuestionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/AtMentionPanel.tsx, apps/desktop/src/renderer/components/new-chat/AttachmentTypeThumb.tsx, apps/desktop/src/renderer/components/new-chat/ChatInput.tsx, apps/desktop/src/renderer/components/new-chat/CjkPunctDecoration.ts, apps/desktop/src/renderer/components/new-chat/CjkPunctuationUtils.ts, apps/desktop/src/renderer/components/new-chat/ComposerListIndentDecoration.ts, apps/desktop/src/renderer/components/new-chat/ComposerListNodes.ts, apps/desktop/src/renderer/components/new-chat/ComposerQuoteNode.tsx, apps/desktop/src/renderer/components/new-chat/DeviceSwitcherPill.tsx, apps/desktop/src/renderer/components/new-chat/EffortSlider.tsx, apps/desktop/src/renderer/components/new-chat/EmptyDocSelectionGuard.ts, apps/desktop/src/renderer/components/new-chat/ExtraDirsButton.tsx, apps/desktop/src/renderer/components/new-chat/FastModeToggle.tsx, apps/desktop/src/renderer/components/new-chat/FolderPickerPopover.tsx, apps/desktop/src/renderer/components/new-chat/FullAccessConfirmContent.tsx, apps/desktop/src/renderer/components/new-chat/GhostCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/GoalAdvancedLimits.tsx, apps/desktop/src/renderer/components/new-chat/GoalIndicator.tsx, apps/desktop/src/renderer/components/new-chat/HomeUsageDashboard.tsx, apps/desktop/src/renderer/components/new-chat/ListComposerTextarea.tsx, apps/desktop/src/renderer/components/new-chat/LocalModelCatalogNotice.tsx, apps/desktop/src/renderer/components/new-chat/MentionChipNode.tsx, apps/desktop/src/renderer/components/new-chat/MentionDragCaretDecoration.ts, apps/desktop/src/renderer/components/new-chat/ModelCompatibilityNotice.tsx, apps/desktop/src/renderer/components/new-chat/ModelConfigFlyout.tsx, apps/desktop/src/renderer/components/new-chat/ModelHarnessPicker.tsx, apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx, apps/desktop/src/renderer/components/new-chat/ModelSourceDetails.tsx, apps/desktop/src/renderer/components/new-chat/NewGoalDialog.tsx, apps/desktop/src/renderer/components/new-chat/PastedTextChipNode.tsx, apps/desktop/src/renderer/components/new-chat/PendingQueuePanel.tsx, apps/desktop/src/renderer/components/new-chat/PermissionPrompt.tsx, apps/desktop/src/renderer/components/new-chat/PermissionSelector.tsx, apps/desktop/src/renderer/components/new-chat/PinnedPlanPanel.tsx, apps/desktop/src/renderer/components/new-chat/PlanActionCard.tsx, apps/desktop/src/renderer/components/new-chat/PlanModeIndicator.tsx, apps/desktop/src/renderer/components/new-chat/PlanViewerCard.tsx, apps/desktop/src/renderer/components/new-chat/PluginConnectionForm.tsx, apps/desktop/src/renderer/components/new-chat/PluginOauthDeviceCode.tsx, apps/desktop/src/renderer/components/new-chat/PluginSetupPrompt.tsx, apps/desktop/src/renderer/components/new-chat/QuickStartPillMark.ts, apps/desktop/src/renderer/components/new-chat/RemoteOauthSetupCard.tsx, apps/desktop/src/renderer/components/new-chat/SendButton.tsx, apps/desktop/src/renderer/components/new-chat/SlashCommandDecoration.ts, apps/desktop/src/renderer/components/new-chat/SlashCommandPalette.tsx, apps/desktop/src/renderer/components/new-chat/TakeoverMask.tsx, apps/desktop/src/renderer/components/new-chat/ThinkingToggle.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedFlyoutHost.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelPanel.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx, apps/desktop/src/renderer/components/new-chat/UnifiedModelRow.tsx, apps/desktop/src/renderer/components/new-chat/UsageDailyBars.tsx, apps/desktop/src/renderer/components/new-chat/UsageHeatmap.tsx, apps/desktop/src/renderer/components/new-chat/VendorSegmentedSwitcher.tsx, apps/desktop/src/renderer/components/new-chat/VoiceInputDraftDecoration.ts, apps/desktop/src/renderer/components/new-chat/WindowsSelectionReplacement.ts, apps/desktop/src/renderer/components/new-chat/WorktreeChipsRow.tsx, apps/desktop/src/renderer/components/new-chat/WorktreeCreatingOverlay.tsx, apps/desktop/src/renderer/components/new-chat/agentOptions.ts, apps/desktop/src/renderer/components/new-chat/agentSwitchConfirmation.ts, apps/desktop/src/renderer/components/new-chat/branchPick.ts, apps/desktop/src/renderer/components/new-chat/composerBlankPointerFocus.ts, apps/desktop/src/renderer/components/new-chat/composerContentSerialization.ts, apps/desktop/src/renderer/components/new-chat/composerDocState.ts, apps/desktop/src/renderer/components/new-chat/composerFrameScheduler.ts, apps/desktop/src/renderer/components/new-chat/composerHistoryProjection.ts, apps/desktop/src/renderer/components/new-chat/composerModelSelection.ts, apps/desktop/src/renderer/components/new-chat/composerPromptRecommendation.ts, apps/desktop/src/renderer/components/new-chat/composerRenderGate.ts, apps/desktop/src/renderer/components/new-chat/composerSendOwnership.ts, apps/desktop/src/renderer/components/new-chat/composerSendSnapshot.ts, apps/desktop/src/renderer/components/new-chat/effortChangeQueue.ts, apps/desktop/src/renderer/components/new-chat/extraDirsActions.ts, apps/desktop/src/renderer/components/new-chat/ghostComposerPlacement.ts, apps/desktop/src/renderer/components/new-chat/localAttachmentPicker.ts, apps/desktop/src/renderer/components/new-chat/mentionChipInsertion.ts, apps/desktop/src/renderer/components/new-chat/modelWindowErrorToast.ts, apps/desktop/src/renderer/components/new-chat/pastePipeline.ts, apps/desktop/src/renderer/components/new-chat/pathPaste.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueLocks.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowActivity.ts, apps/desktop/src/renderer/components/new-chat/pendingQueueRowPresentation.ts, apps/desktop/src/renderer/components/new-chat/planModeComposerCommand.ts, apps/desktop/src/renderer/components/new-chat/priceTierMarks.tsx, apps/desktop/src/renderer/components/new-chat/remoteBrowseAdapters.ts, apps/desktop/src/renderer/components/new-chat/remoteExistingProjects.ts, apps/desktop/src/renderer/components/new-chat/restoreComposerDocument.ts, apps/desktop/src/renderer/components/new-chat/sessionLinkPaste.ts, apps/desktop/src/renderer/components/new-chat/sourceSwitch.ts, apps/desktop/src/renderer/components/new-chat/unifiedModelSelection.ts, apps/desktop/src/renderer/components/new-chat/usagePalette.ts, apps/desktop/src/renderer/components/new-chat/useComposerSendFocusRestore.ts, apps/desktop/src/renderer/components/new-chat/useModelDiscoveryPending.ts, apps/desktop/src/renderer/components/new-chat/useProviderWeeklyQuota.ts, apps/desktop/src/renderer/components/new-chat/useUnifiedRowActions.ts, apps/desktop/src/renderer/features/cc-agent/CCAgentFeatureLayout.tsx, apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaSplitView.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaWorkerPanel.tsx, apps/desktop/src/renderer/features/cc-agent/OrcaWorkflowRoute.tsx | 256 | 43 | 356 |
@@ -55,7 +55,7 @@
| `mobile.auth` | mobile | 登录与添加账号 | app/(auth)/login.tsx / app/add-account.tsx | AccountSwitcherSheet, AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, IncomingShareBridge, LoginCaptchaWebView, LoginNativeButton, LoginNativeButton.ios, LoginSkinControls, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, StartupSplashOverlay, SystemNavigationBack, ThemeProvider, _layout, add-account, gestureHandler, login, peerFileTransport, useLocale | apps/mobile/app/(auth)/login.tsx, apps/mobile/app/_layout.tsx, apps/mobile/app/add-account.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/LoginCaptchaWebView.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/LoginNativeButton.ios.tsx, apps/mobile/src/components/LoginNativeButton.tsx, apps/mobile/src/components/LoginSkinControls.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SystemNavigationBack.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 211 | 80 |
| `mobile.automations` | mobile | 自动化 | app/automations/[deviceId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/automations/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 74 |
| `mobile.chat.new` | mobile | 新建任务 | app/sessions/new.tsx | AdaptiveWindow, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerAttachmentTray, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, DeviceLinkContext, FileTypeIcon, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, MobileAgentMark, MobileAgentSwitcher, MobileChoicePickerList, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, NewTaskSelectionSheet, NewTaskSelectionSheet.ios, PaperPlaneIcon, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, _layout, gestureHandler, new, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/new.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/FileTypeIcon.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileChoicePickerList.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx, apps/mobile/src/session/NewTaskSelectionSheet.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 236 | 113 |
-| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AccountSwitcherSheet, AdaptiveWindow, AgentErrorDetails, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionAutomationNativeView, CompanionAutomationNativeView.ios, CompanionAutomationSheet, CompanionChoice, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionHeader, CompanionMessageActions, CompanionMessageCard, CompanionModelChain, CompanionNativeContent.ios, CompanionNavigationDrawer, CompanionPortraitPicker, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, CompanionWorkingStatus, ComposerAttachmentTray, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, FileTypeIcon, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, LoginNativeButton, LoginNativeButton.ios, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RecentMessageHistories, RemoteAccessGuide, RemoteCompanionAvatar, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, ResidentHomeList, RewindPreviewPanel, RunningTokenRatePopover, SentInlineAtomBody, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionOptionsExpoSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, SwipeableSessionRow, SwipeableSessionRow.ios, SystemNavigationBack, TaskTags, TaskTagsSheet, TeammateGenerationLabel, TeammateList, TeammatePicker, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/FileTypeIcon.tsx, apps/mobile/src/components/LoginNativeButton.ios.tsx, apps/mobile/src/components/LoginNativeButton.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/RemoteCompanionAvatar.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/ModalContentArea.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/chrome/SystemNavigationBack.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AgentErrorDetails.tsx, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionAutomationNativeView.ios.tsx, apps/mobile/src/session/CompanionAutomationNativeView.tsx, apps/mobile/src/session/CompanionAutomationSheet.tsx, apps/mobile/src/session/CompanionChoice.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionHeader.tsx, apps/mobile/src/session/CompanionMessageActions.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/CompanionModelChain.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/CompanionNavigationDrawer.tsx, apps/mobile/src/session/CompanionPortraitPicker.tsx, apps/mobile/src/session/CompanionProfileArtifacts.tsx, apps/mobile/src/session/CompanionProfileNativeView.ios.tsx, apps/mobile/src/session/CompanionProfileNativeView.tsx, apps/mobile/src/session/CompanionProfileSheet.tsx, apps/mobile/src/session/CompanionSettingsRow.ios.tsx, apps/mobile/src/session/CompanionSettingsRow.tsx, apps/mobile/src/session/CompanionSheet.ios.tsx, apps/mobile/src/session/CompanionSheet.tsx, apps/mobile/src/session/CompanionWorkingStatus.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerExpandButton.ios.tsx, apps/mobile/src/session/ComposerExpandButton.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeInput.ios.tsx, apps/mobile/src/session/ComposerNativeInput.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerRichInput.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/ConversationShareSvg.tsx, apps/mobile/src/session/ConversationShareWebView.tsx, apps/mobile/src/session/FailedScheduleNotice.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeListVisuals.tsx, apps/mobile/src/session/HomeModeSwitch.tsx, apps/mobile/src/session/HomeNewTaskButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/HomeSurface.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/InlineQueueSection.tsx, apps/mobile/src/session/InlineQuoteChip.tsx, apps/mobile/src/session/InlineReferenceChip.tsx, apps/mobile/src/session/InteractionPanel.tsx, apps/mobile/src/session/MarkdownBlockContent.tsx, apps/mobile/src/session/MessageActionSheet.tsx, apps/mobile/src/session/MessageRenderer.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/PromptRecommendation.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/RewindPreviewPanel.tsx, apps/mobile/src/session/RunningTokenRatePopover.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionListDrawer.tsx, apps/mobile/src/session/SessionMenuSheet.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SessionResourceCards.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionUsageSummary.tsx, apps/mobile/src/session/ShareImageNativeButton.ios.tsx, apps/mobile/src/session/ShareImageNativeButton.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/ShareSelectAllButton.tsx, apps/mobile/src/session/ShareSelectionBar.tsx, apps/mobile/src/session/SharedTaskEndedState.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TaskTagsSheet.tsx, apps/mobile/src/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/TeammatePicker.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/session/useSharedTaskConfirmation.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 237 | 302 |
+| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AccountSwitcherSheet, AdaptiveWindow, AgentErrorDetails, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionAutomationNativeView, CompanionAutomationNativeView.ios, CompanionAutomationSheet, CompanionChoice, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionHeader, CompanionMessageActions, CompanionMessageCard, CompanionModelChain, CompanionNativeContent.ios, CompanionNavigationDrawer, CompanionPortraitPicker, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, CompanionTaskResultCard, CompanionWorkingStatus, ComposerAttachmentTray, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, FileTypeIcon, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, LoginNativeButton, LoginNativeButton.ios, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RecentMessageHistories, RemoteAccessGuide, RemoteCompanionAvatar, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, ResidentHomeList, RewindPreviewPanel, RunningTokenRatePopover, SentInlineAtomBody, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionOptionsExpoSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, SwipeableSessionRow, SwipeableSessionRow.ios, SystemNavigationBack, TaskTags, TaskTagsSheet, TeammateGenerationLabel, TeammateList, TeammatePicker, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/FileTypeIcon.tsx, apps/mobile/src/components/LoginNativeButton.ios.tsx, apps/mobile/src/components/LoginNativeButton.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/RemoteCompanionAvatar.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/ModalContentArea.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/chrome/SystemNavigationBack.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AgentErrorDetails.tsx, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionAutomationNativeView.ios.tsx, apps/mobile/src/session/CompanionAutomationNativeView.tsx, apps/mobile/src/session/CompanionAutomationSheet.tsx, apps/mobile/src/session/CompanionChoice.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionHeader.tsx, apps/mobile/src/session/CompanionMessageActions.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/CompanionModelChain.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/CompanionNavigationDrawer.tsx, apps/mobile/src/session/CompanionPortraitPicker.tsx, apps/mobile/src/session/CompanionProfileArtifacts.tsx, apps/mobile/src/session/CompanionProfileNativeView.ios.tsx, apps/mobile/src/session/CompanionProfileNativeView.tsx, apps/mobile/src/session/CompanionProfileSheet.tsx, apps/mobile/src/session/CompanionSettingsRow.ios.tsx, apps/mobile/src/session/CompanionSettingsRow.tsx, apps/mobile/src/session/CompanionSheet.ios.tsx, apps/mobile/src/session/CompanionSheet.tsx, apps/mobile/src/session/CompanionTaskResultCard.tsx, apps/mobile/src/session/CompanionWorkingStatus.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerExpandButton.ios.tsx, apps/mobile/src/session/ComposerExpandButton.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeInput.ios.tsx, apps/mobile/src/session/ComposerNativeInput.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerRichInput.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/ConversationShareSvg.tsx, apps/mobile/src/session/ConversationShareWebView.tsx, apps/mobile/src/session/FailedScheduleNotice.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeListVisuals.tsx, apps/mobile/src/session/HomeModeSwitch.tsx, apps/mobile/src/session/HomeNewTaskButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/HomeSurface.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/InlineQueueSection.tsx, apps/mobile/src/session/InlineQuoteChip.tsx, apps/mobile/src/session/InlineReferenceChip.tsx, apps/mobile/src/session/InteractionPanel.tsx, apps/mobile/src/session/MarkdownBlockContent.tsx, apps/mobile/src/session/MessageActionSheet.tsx, apps/mobile/src/session/MessageRenderer.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/PromptRecommendation.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/RewindPreviewPanel.tsx, apps/mobile/src/session/RunningTokenRatePopover.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionListDrawer.tsx, apps/mobile/src/session/SessionMenuSheet.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SessionResourceCards.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionUsageSummary.tsx, apps/mobile/src/session/ShareImageNativeButton.ios.tsx, apps/mobile/src/session/ShareImageNativeButton.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/ShareSelectAllButton.tsx, apps/mobile/src/session/ShareSelectionBar.tsx, apps/mobile/src/session/SharedTaskEndedState.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TaskTagsSheet.tsx, apps/mobile/src/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/TeammatePicker.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/session/useSharedTaskConfirmation.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 237 | 303 |
| `mobile.chat.sharing` | mobile | 共享任务邀请与成员 | app/shared-session.tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, shared-session, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/shared-session.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SharedTaskEndedState.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/useSharedTaskConfirmation.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 61 |
| `mobile.companions.direct` | mobile | 伙伴私聊回看 | app/companions/direct/[threadId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [threadId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/direct/[threadId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 53 |
| `mobile.device-management` | mobile | 设备管理 | app/devices/manage.tsx / app/devices/manage/[deviceId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceInformationFields, DeviceInformationFields.ios, DeviceLinkContext, DeviceManagementDialogs, DeviceManagementList, DeviceManagementList.ios, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, ModalContentArea, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RenameDeviceModal, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, manage, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/manage.tsx, apps/mobile/app/devices/manage/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceInformationFields.ios.tsx, apps/mobile/src/device-link/DeviceInformationFields.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/DeviceManagementDialogs.tsx, apps/mobile/src/device-link/DeviceManagementList.ios.tsx, apps/mobile/src/device-link/DeviceManagementList.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/ModalContentArea.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RenameDeviceModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 56 |
diff --git a/docs/pr-assets/teammate-reply-results/desktop-failure-details.png b/docs/pr-assets/teammate-reply-results/desktop-failure-details.png
new file mode 100644
index 0000000000..9134fbec1c
Binary files /dev/null and b/docs/pr-assets/teammate-reply-results/desktop-failure-details.png differ
diff --git a/docs/pr-assets/teammate-reply-results/desktop-result-receipts.png b/docs/pr-assets/teammate-reply-results/desktop-result-receipts.png
new file mode 100644
index 0000000000..6d38354ee7
Binary files /dev/null and b/docs/pr-assets/teammate-reply-results/desktop-result-receipts.png differ
diff --git a/docs/pr-assets/teammate-reply-results/mobile-failure-details.png b/docs/pr-assets/teammate-reply-results/mobile-failure-details.png
new file mode 100644
index 0000000000..3ddfdbdbd0
Binary files /dev/null and b/docs/pr-assets/teammate-reply-results/mobile-failure-details.png differ
diff --git a/docs/pr-assets/teammate-reply-results/mobile-result-receipts.png b/docs/pr-assets/teammate-reply-results/mobile-result-receipts.png
new file mode 100644
index 0000000000..2130b6d923
Binary files /dev/null and b/docs/pr-assets/teammate-reply-results/mobile-result-receipts.png differ
diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.md
index d54845006f..8bdd6a1b25 100644
--- a/docs/product-rules/cindy-bots-runtime.md
+++ b/docs/product-rules/cindy-bots-runtime.md
@@ -410,8 +410,9 @@ Codex 切模型重建时,线程索引里的路径不等于文件已经落盘
伙伴可发现、调用用户已有插件,保留实时授权限制;普通 Bot 无 Orca / harness subagent 入口。
- 后台任务承接 ask / auto / bypassPermissions 三档,权限变更中不读旧值;既有计划快照可恢复。
- 伙伴会话的上下文里没有项目 / 全局 AGENTS.md、CLAUDE.md 与 Cindy 产品提示词。
-- `start_session_task` 能:任务卡实时更新到终态、挂起交互回到伙伴代答、完成信号对用户不可见、
+- `start_session_task` 能:任务卡实时更新到终态、挂起交互回到伙伴代答、完成唤醒信号对用户不可见;每次执行收口另存可展开的结果入口(按任务与执行轮次去重),历史原卡不移动。结果入口直接展示该次结果与文件,超时复用既有终态归一;当次失败原因随回执保存,桌面与手机仅在用户展开错误详情后显示,续跑不改写旧回执。忙时排队、过程收拢和重新打开不影响读取;阅读历史时沿用新消息提示,不强拉到底部。
父任务异常恢复后仍投递到当前主任务;check / message / stop 都只能控制它创建的 Session 任务。
+- 伙伴主聊天通知优先使用当前已完成轮次的最终回复纯文本摘要;Markdown 转为可读文字后才截断,遵守推送协议的 UTF-16 长度上限且不拆分代理对。无可用正文时使用本地化新回复兜底;沿用通知开关及系统预览隐私,静默自动化仍不外发。普通任务保留任务通知语义。
- 完成信号临时失败与 Host 重启后会幂等补投;等待事项在重启恢复期间保持可见且不消耗执行期限。
- `send_to_agent` 的同一伙伴对最多 12 条、单方最多连续 2 条;达到上限和空闲超时都会结束本轮。
- 伙伴私聊不进左栏;双方 canonical 时间线都能打开同一份只读记录,接收方正常 turn 的结果
diff --git a/packages/maker-shared/src/botCollaboration.ts b/packages/maker-shared/src/botCollaboration.ts
index c1ffdb3ebc..fdbf30d078 100644
--- a/packages/maker-shared/src/botCollaboration.ts
+++ b/packages/maker-shared/src/botCollaboration.ts
@@ -15,6 +15,8 @@
export type BotCollaborationRole =
/** 父任务:启动时写下的任务卡锚点(空正文,只为承载卡片)。 */
| 'delegation-request'
+ /** Immutable receipt of one completed execution, separate from the original task anchor. */
+ | 'delegation-result'
/** 历史:父任务里的目标伙伴结果。 */
| 'guest-result'
/** 父任务:发起方给进行中任务追加消息的留痕。 */
@@ -40,10 +42,21 @@ export interface BotCollaborationMeta {
childSessionId: string | null;
/** 委派目标摘要,用于卡片折叠态文案。 */
objective: string;
+ result?: {
+ /** Child task directory on its host; used to resolve remote artifact links. */
+ workingDir?: string;
+ runSequence: number;
+ status: 'completed' | 'failed' | 'cancelled' | 'timed-out';
+ text: string;
+ /** Frozen failure detail, only revealed on demand; never the primary label. */
+ error?: string;
+ artifacts: Array<{ absolutePath: string }>;
+ };
}
const ROLES = new Set<BotCollaborationRole>([
'delegation-request',
+ 'delegation-result',
'guest-result',
'interjection',
'guest-request',
@@ -73,6 +86,13 @@ export function readBotCollaborationMeta(value: unknown): BotCollaborationMeta |
const parentSessionId = optionalId(raw.parentSessionId);
const childSessionId = optionalId(raw.childSessionId);
if (parentSessionId === undefined || childSessionId === undefined) return null;
+ const receipt = raw as unknown as BotCollaborationMeta;
+ if (receipt.role === 'delegation-result' && (!receipt.result || !Number.isSafeInteger(receipt.result.runSequence)
+ || receipt.result.runSequence < 1 || !['completed', 'failed', 'cancelled', 'timed-out'].includes(receipt.result.status)
+ || (receipt.result.workingDir !== undefined && typeof receipt.result.workingDir !== 'string')
+ || (receipt.result.error !== undefined && typeof receipt.result.error !== 'string')
+ || typeof receipt.result.text !== 'string' || !Array.isArray(receipt.result.artifacts)
+ || receipt.result.artifacts.some((file) => !file || typeof file.absolutePath !== 'string'))) return null;
return {
v: 1,
role: raw.role as BotCollaborationRole,
@@ -83,12 +103,15 @@ export function readBotCollaborationMeta(value: unknown): BotCollaborationMeta |
toBotName: raw.toBotName,
parentSessionId,
childSessionId,
+ ...(receipt.result ? { result: receipt.result } : {}),
objective: raw.objective,
};
}
/** 委派相关消息的幂等 clientId 前缀,main 与测试共用同一份常量。 */
export const BOT_DELEGATION_CLIENT_ID = {
+ resultRun: (delegationId: string, runSequence: number) =>
+ `bot-delegation-result:${delegationId}:${runSequence}`,
/** 父任务里的任务卡锚点。 */
parentRequest: (delegationId: string) => `bot-delegation-request:${delegationId}`,
/** 父任务里的结果回传(历史值,不可改)。 */