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。

feat(mobile): 手机伙伴设置补齐已存记忆页并对齐桌面细节 (#5072)

Chris Zhangce0178dd34d2
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteEditors.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteEditors.test.ts
index 5d7bea01d3..5ce8f173a8 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteEditors.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteEditors.test.ts
@@ -1,6 +1,9 @@
import { describe, expect, it, vi } from 'vitest';
import { createBotRemoteEditors, type BotRemoteEditorDeps } from '../botRemoteEditors.js';
import { createBotRemoteSettingsResource } from '../botRemoteSettingsResource.js';
+import { RemoteResourceRegistryError } from '../../../device-link/remoteResourceRegistry.js';
+import { createIpcError } from '../../../../shared/ipc-errors.js';
+import type { BotMemoryDetail } from '../../../../shared/botMemory.js';
function fixture() {
let owner = 'a';
@@ -8,12 +11,35 @@ function fixture() {
const settings = { source, identity: '', userContext: '', memory: true, permissions: 'auto', modelChain: [], followsDefault: true, skills: ['existing'], connections: [], toolsets: [] };
let skill = { slug: 'learned', name: '写简报', description: '写简报时使用', body: '保留准确来源。', updatedAt: '1' };
const catalog = [{ id: 'existing', name: 'Existing', description: 'A skill', available: false, joined: true }, { id: 'new', name: 'New', description: 'Available skill', available: true, joined: false }];
+ let clock = 0;
+ const stamp = () => new Date(Date.UTC(2026, 8, 1, 0, 0, clock++)).toISOString();
+ const memories = new Map<string, BotMemoryDetail>([
+ ['user_coffee.md', { filename: 'user_coffee.md', type: 'user', title: '喝咖啡', body: '早上喝美式,不加糖。', updatedAt: stamp() }],
+ ['feedback_short.md', { filename: 'feedback_short.md', type: 'feedback', title: '简短回复', body: '回复先给结论。'.repeat(40), updatedAt: stamp() }],
+ ['feedback_sources.md', { filename: 'feedback_sources.md', type: 'feedback', title: '注明来源', body: '引用要带链接。', updatedAt: stamp() }],
+ ]);
+ const gone = () => createIpcError('NOT_FOUND', 'Memory not found');
+ const changed = () => createIpcError('PRECONDITION_FAILED', 'bot-memory-changed');
+ const memory: BotRemoteEditorDeps['memory'] = {
+ list: vi.fn(async (_botId: string, query?: string) => [...memories.values()]
+ .filter(item => !query || item.title.includes(query) || item.body.includes(query))
+ .map(({ body, ...item }) => ({ ...item, preview: body }))),
+ read: vi.fn(async (_botId: string, filename: string) => { const item = memories.get(filename); if (!item) throw gone(); return { ...item }; }),
+ update: vi.fn(async input => {
+ const item = memories.get(input.filename); if (!item) throw gone(); if (item.updatedAt !== input.expectedUpdatedAt) throw changed();
+ const next = { ...item, title: input.title, body: input.body, updatedAt: stamp() }; memories.set(input.filename, next); return next;
+ }),
+ delete: vi.fn(async input => {
+ const item = memories.get(input.filename); if (!item) throw gone(); if (item.updatedAt !== input.expectedUpdatedAt) throw changed();
+ memories.delete(input.filename);
+ }),
+ };
const deps: BotRemoteEditorDeps = {
owner: () => owner, assertOwner: captured => { if (captured !== owner) throw Error('OWNER_CHANGED'); },
read: vi.fn(async () => settings), update: vi.fn(async () => { source.currentVersion++; }),
create: vi.fn(async () => {}), avatar: vi.fn(async () => {}),
skills: vi.fn(async () => [skill]), skill: vi.fn(async () => skill), saveSkill: vi.fn(async (_bot, value) => { skill = value; }),
- removeSkill: vi.fn(async () => {}), capabilities: vi.fn(async () => catalog),
+ removeSkill: vi.fn(async () => {}), capabilities: vi.fn(async () => catalog), memory,
};
const host = createBotRemoteSettingsResource({ ...deps, lifecycle: vi.fn(async () => ({})) });
const get = createBotRemoteEditors(deps, host.bindResource);
@@ -22,7 +48,8 @@ function fixture() {
const resource = (id: string) => get(context, id, 'zh-CN');
const send = (resource: Awaited<ReturnType<typeof get>>, input: Record<string, unknown>, index = 0) => host.invoke(context, { collectionId: 'teammates', resourceRef: resource.ref, actionId: resource.actions![index].id, input, client });
const entries = (resource: Awaited<ReturnType<typeof get>>) => (resource.blocks![0].data as { entries: Array<{ resourceId: string }> }).entries;
- return { resource, send, entries, deps, settings, catalog, changeSkill: () => { skill = { ...skill, body: '在电脑上修改后的正文。' }; }, owner: (next: string) => { owner = next; } };
+ const teammateWrites = (filename: string) => { memories.set(filename, { ...memories.get(filename)!, body: '伙伴刚写入的新内容。', updatedAt: stamp() }); };
+ return { resource, get, context, send, entries, deps, settings, catalog, memories, teammateWrites, changeSkill: () => { skill = { ...skill, body: '在电脑上修改后的正文。' }; }, owner: (next: string) => { owner = next; } };
}
describe('portable teammate editors', () => {
it('keeps the same durable create identity across a lost ACK, but separates paired controllers and owners', async () => {
@@ -86,3 +113,95 @@ describe('portable teammate editors', () => {
expect(f.deps.avatar).not.toHaveBeenCalled();
});
});
+
+describe('portable teammate memory pages', () => {
+ type Group = { id: string; data: { count: number; entries: Array<{ id: string; title: string; subtitle: string; timestamp?: number; resourceId: string }> } };
+ const groups = (resource: { blocks?: unknown[] }) => (resource.blocks as Group[]).filter(block => block.id.startsWith('memory-'));
+ it('lists far more than a fixed page of memories and stays inside one device-link frame', async () => {
+ const f = fixture(); f.memories.clear();
+ for (let i = 0; i < 1200; i++) f.memories.set(`project_m${i}.md`, { filename: `project_m${i}.md`, type: 'project', title: `Project ${i}`, body: 'x'.repeat(140), updatedAt: new Date(Date.UTC(2026, 8, 1) + i).toISOString() });
+ const [project] = groups(await f.resource('settings:bot-a/memory'));
+ expect(project.data.count).toBe(1200);
+ expect(project.data.entries).toHaveLength(1200);
+ expect(project.data.entries.every(entry => entry.subtitle === 'x'.repeat(140))).toBe(true);
+ f.memories.clear();
+ for (let i = 0; i < 3000; i++) f.memories.set(`project_m${i}.md`, { filename: `project_m${i}.md`, type: 'project', title: `Project ${i}`, body: '记'.repeat(200), updatedAt: new Date(Date.UTC(2026, 8, 1) + i).toISOString() });
+ const large = await f.resource('settings:bot-a/memory');
+ const [bounded] = groups(large);
+ // Previews stop first; the mobile per-list ceiling (2000) bounds the rest.
+ expect(bounded.data.count).toBe(3000);
+ expect(bounded.data.entries).toHaveLength(2000);
+ expect(bounded.data.entries[0].subtitle).toBeTruthy();
+ expect(bounded.data.entries.at(-1)).not.toHaveProperty('subtitle');
+ expect(Buffer.byteLength(JSON.stringify(large))).toBeLessThan(2 * 1024 * 1024);
+ });
+ it('groups saved memories by kind with counts and excerpts, and offers search only to declaring controllers', async () => {
+ const f = fixture();
+ const plain = await f.resource('settings:bot-a/memory');
+ expect(groups(plain).map(group => [group.id, group.data.count])).toEqual([['memory-user', 1], ['memory-feedback', 2]]);
+ expect(plain.blocks!.some(block => block.id === 'search')).toBe(false);
+ const [coffee] = groups(plain)[0].data.entries;
+ expect(coffee).toMatchObject({ id: 'user_coffee', title: '喝咖啡', subtitle: '早上喝美式,不加糖。', resourceId: 'settings:bot-a/memory/user_coffee' });
+ expect(typeof coffee.timestamp).toBe('number');
+ expect(Array.from(groups(plain)[1].data.entries[0].subtitle).length).toBeLessThanOrEqual(141);
+ expect(plain.actions ?? []).toEqual([]);
+ expect(JSON.stringify(plain)).not.toMatch(/filename|\.md|digest/);
+ const searched = await f.get(f.context, 'settings:bot-a/memory', 'zh-CN', { query: '链接', primitives: ['form', 'search'] });
+ expect(f.deps.memory.list).toHaveBeenLastCalledWith('bot-a', '链接');
+ expect(searched.blocks![0]).toMatchObject({ id: 'search', primitive: 'search', data: { query: '链接' } });
+ expect(groups(searched).map(group => group.data.entries.map(entry => entry.id))).toEqual([['feedback_sources']]);
+ expect(searched.revision).not.toBe(plain.revision);
+ });
+ it('saves only against the updatedAt it was opened at and never overwrites or deletes a newer teammate write', async () => {
+ const f = fixture();
+ const detail = await f.resource('settings:bot-a/memory/user_coffee');
+ const opened = f.memories.get('user_coffee.md')!.updatedAt;
+ expect(detail.revision).toBe(opened);
+ expect(detail.display).toMatchObject({ title: '喝咖啡', subtitle: { fallback: 'About you' } });
+ expect(detail.blocks![0].data).toMatchObject({ values: { title: '喝咖啡', body: '早上喝美式,不加糖。' } });
+ const receipt = await f.send(detail, { body: '只喝美式。' });
+ expect(f.deps.memory.update).toHaveBeenCalledWith({ botId: 'bot-a', filename: 'user_coffee.md', title: '喝咖啡', body: '只喝美式。', expectedUpdatedAt: opened });
+ expect(receipt.effects).toContainEqual({ kind: 'refresh-resource', ref: { collectionId: 'teammates', kind: 'bot', id: 'settings:bot-a/memory' } });
+ const stale = await f.resource('settings:bot-a/memory/user_coffee');
+ f.teammateWrites('user_coffee.md');
+ await expect(f.send(stale, { body: '手机上的旧草稿' })).rejects.toThrow();
+ await expect(f.send(stale, {}, 1)).rejects.toThrow();
+ expect(f.deps.memory.update).toHaveBeenCalledTimes(1);
+ expect(f.deps.memory.delete).not.toHaveBeenCalled();
+ expect(f.memories.get('user_coffee.md')!.body).toBe('伙伴刚写入的新内容。');
+ });
+ it('confirms deletion with the teammate and memory names and deletes through the service', async () => {
+ const f = fixture();
+ const detail = await f.resource('settings:bot-a/memory/feedback_sources');
+ expect(detail.actions![1]).toMatchObject({ tone: 'destructive', confirmation: { body: { translations: { 'zh-CN': 'Cindy之后不会再参考「注明来源」。' } } } });
+ await f.send(detail, {}, 1);
+ expect(f.deps.memory.delete).toHaveBeenCalledWith({ botId: 'bot-a', filename: 'feedback_sources.md', expectedUpdatedAt: detail.revision });
+ await expect(f.resource('settings:bot-a/memory/feedback_sources')).rejects.toBeInstanceOf(RemoteResourceRegistryError);
+ });
+ it('rejects internal kinds, traversal and fields outside the memory form before writes', async () => {
+ const f = fixture();
+ for (const id of ['settings:bot-a/memory/digest_x', 'settings:bot-a/memory/../secret', 'settings:bot-a/memory/user_coffee.md', 'settings:bot-a/memory/user_coffee/x', 'settings:bot-a/memory/hzzzz'])
+ await expect(f.resource(id)).rejects.toThrow();
+ for (const input of [{ description: 'hidden digest' }, {}, { filename: 'feedback_short.md', body: 'x' }, { body: 42 }])
+ await expect(f.send(await f.resource('settings:bot-a/memory/user_coffee'), input)).rejects.toThrow();
+ await expect(f.send(await f.resource('settings:bot-a/memory/user_coffee'), { confirm: true }, 1)).rejects.toThrow();
+ expect(f.deps.memory.update).not.toHaveBeenCalled();
+ expect(f.deps.memory.delete).not.toHaveBeenCalled();
+ });
+ it('keeps entries of a long teammate id addressable within the protocol id limit', async () => {
+ const f = fixture(); const botId = `bot_${'x'.repeat(124)}`;
+ const list = await f.resource(`settings:${botId}/memory`);
+ const ids = groups(list).flatMap(group => group.data.entries.map(entry => entry.resourceId));
+ expect(ids.every(id => id.length <= 160)).toBe(true);
+ const hashed = ids.find(id => /\/h[a-f0-9]{12}$/.test(id));
+ expect(hashed).toBeDefined();
+ const detail = await f.resource(hashed!);
+ expect(detail.ref.id).toBe(hashed);
+ expect(f.deps.memory.read).toHaveBeenLastCalledWith(botId, expect.stringMatching(/\.md$/));
+ });
+ it('drops a memory read that finishes after the account changed', async () => {
+ const f = fixture();
+ vi.mocked(f.deps.memory.read).mockImplementationOnce(async () => { f.owner('b'); return { ...f.memories.get('user_coffee.md')! }; });
+ await expect(f.resource('settings:bot-a/memory/user_coffee')).rejects.toThrow('OWNER_CHANGED');
+ });
+});
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteResourceProviderMemory.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteResourceProviderMemory.test.ts
new file mode 100644
index 0000000000..5ee898565c
--- /dev/null
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteResourceProviderMemory.test.ts
@@ -0,0 +1,42 @@
+import { expect, it, vi } from 'vitest';
+
+vi.mock('../../../agent-island/service.js', () => ({ getAgentIslandService: () => null }));
+vi.mock('../../../maker-ipc/botRemoteResourceInvalidation.js', () => ({ scheduleBotRemoteResourceChangedForSession: vi.fn() }));
+vi.mock('../../../maker-ipc/workingStatus.js', () => ({ getWorkingStatusCopy: vi.fn() }));
+vi.mock('../../client/current.js', () => ({ getDbClient: () => null }));
+vi.mock('../../../device-link/broadcast-tap.js', () => ({ captureDataOwnerBroadcastScope: () => ({}), isDataOwnerBroadcastScopeCurrent: () => true }));
+const source = vi.hoisted(() => ({ id: 'bot-1', name: 'Sora', description: '', avatar: '', avatarColor: 'teal', status: 'active',
+ canonicalSessionId: 'session-1', lastMessagePreview: null, lastMessageAt: null, lastMessageRole: null, needsAttention: false,
+ hiddenAt: null, pinnedAt: null, activityAt: 1, currentVersion: 1, updatedAt: 1 }));
+vi.mock('../bots.js', () => ({ getBotRemoteResourceSource: async () => ({ ...source }), listBotRemoteResourceSources: async () => [{ ...source }] }));
+
+import { remoteResourceRegistry } from '../../../device-link/remoteResourceRegistry.js';
+import { registerBotRemoteResourceProvider } from '../botRemoteResourceProvider.js';
+import type { botRemoteManagement } from '../botRemoteManagement.js';
+
+const ref = (id: string) => ({ collectionId: 'teammates', kind: 'bot', id });
+const management = {
+ get: vi.fn(async (_context: unknown, id: string) => ({ ref: ref(id), revision: 'r1', display: { title: 'Sora' }, links: [],
+ blocks: [{ id: 'memory', primitive: 'form', fallbackMarkdown: 'Memory', data: { actionId: 'grant', values: { memory: true, userContext: '' } } }] })),
+ getEditor: vi.fn(async (_context: unknown, id: string) => ({ ref: ref(id), revision: 'list', display: { title: 'Saved Memories' }, links: [], blocks: [] })),
+ getInvitation: vi.fn(), invoke: vi.fn(), bindResource: vi.fn(),
+};
+registerBotRemoteResourceProvider(management as unknown as typeof botRemoteManagement);
+const context = { controllerDeviceId: 'phone' };
+
+it('adds a saved-memories page beside the memory toggle form only for form-capable controllers', async () => {
+ const settings = await remoteResourceRegistry.get(context, { client: { protocolVersion: 1, primitives: ['form', 'list'] }, ref: ref('bot-1') });
+ expect(settings.blocks?.find(block => block.id === 'memory')).toMatchObject({ primitive: 'form' });
+ expect(settings.blocks?.find(block => block.id === 'memories')).toMatchObject({ primitive: 'list',
+ data: { entries: [{ id: 'memories', resourceId: 'settings:bot-1/memory', title: { fallback: 'Saved Memories' } }] } });
+ const readOnly = await remoteResourceRegistry.get(context, { client: { protocolVersion: 1, primitives: ['markdown'] }, ref: ref('bot-1') });
+ expect(readOnly.blocks?.some(block => block.id === 'memories') ?? false).toBe(false);
+});
+
+it('forwards the optional query and the declared primitives to the memory page', async () => {
+ const client = { protocolVersion: 1, primitives: ['form', 'search'], locale: 'zh-CN' };
+ await remoteResourceRegistry.get(context, { client, ref: ref('settings:bot-1/memory'), query: '咖啡' });
+ expect(management.getEditor).toHaveBeenLastCalledWith(context, 'settings:bot-1/memory', 'zh-CN', { query: '咖啡', primitives: ['form', 'search'] });
+ await remoteResourceRegistry.get(context, { client, ref: ref('settings:bot-1/memory') });
+ expect(management.getEditor).toHaveBeenLastCalledWith(context, 'settings:bot-1/memory', 'zh-CN', { query: undefined, primitives: ['form', 'search'] });
+});
diff --git a/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteSettingsResource.test.ts b/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteSettingsResource.test.ts
index 1dd11dc871..c1d66785fa 100644
--- a/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteSettingsResource.test.ts
+++ b/apps/desktop/src/main/localDb/ipc/__tests__/botRemoteSettingsResource.test.ts
@@ -111,6 +111,18 @@ describe('opaque teammate settings actions', () => {
expect(JSON.stringify(result)).not.toContain('PRIVATE');
expect(result.effects.some(effect => effect.kind === 'refresh-resource')).toBe(false);
});
+ it('confirms resuming a paused teammate with resume copy, not the restart warning', async () => {
+ const f = fixture(); const active = await f.get();
+ const restart = active.actions!.find(action => action.id === actionId(active, 'restart'))!;
+ f.source.status = 'paused';
+ const paused = await f.get();
+ expect(paused.blocks!.some(block => block.id === 'restart')).toBe(false);
+ const resume = paused.actions!.find(action => action.id === actionId(paused, 'resume'))!;
+ expect(resume.confirmation?.title).toMatchObject({ fallback: 'Resume Teammate' });
+ expect(resume.confirmation?.body).not.toEqual(restart.confirmation?.body);
+ expect(resume.confirmation?.body).toMatchObject({ translations: { 'zh-CN': expect.stringContaining('恢复后伙伴重新接收消息') } });
+ for (const locale of ['zh-CN', 'zh-TW', 'ja', 'ko']) expect((resume.confirmation?.body as { translations: Record<string, string> }).translations[locale]).toBeTruthy();
+ });
it('does not misreport shelf failure as an empty shelf', async () => {
const f = fixture(); vi.mocked(f.deps.skills).mockRejectedValue(new Error('unavailable'));
const result = await f.get();
diff --git a/apps/desktop/src/main/localDb/ipc/botRemoteEditors.ts b/apps/desktop/src/main/localDb/ipc/botRemoteEditors.ts
index befe7b1e80..6d0d65f185 100644
--- a/apps/desktop/src/main/localDb/ipc/botRemoteEditors.ts
+++ b/apps/desktop/src/main/localDb/ipc/botRemoteEditors.ts
@@ -4,6 +4,7 @@ import type { BotRemoteSettingsDeps, createBotRemoteSettingsResource } from './b
import type { RemoteResourceHostContext } from '../../device-link/remoteResourceRegistry.js';
import type { BotSkillDetail } from '../../../shared/botSkill.js';
import { throwIpcError } from '../../utils/ipcValidate.js';
+import { createBotRemoteMemoryEditor, memoryCopy, type BotRemoteMemoryService } from './botRemoteMemory.js';
type Kind = 'skill' | 'mcp' | 'toolset';
type Capability = { id: string; name: string; description: string; available: boolean; joined: boolean };
@@ -14,6 +15,12 @@ export interface BotRemoteEditorDeps extends Pick<BotRemoteSettingsDeps, 'owner'
saveSkill(botId: string, skill: BotSkillDetail): Promise<void>;
removeSkill(botId: string, slug: string): Promise<void>;
capabilities(sessionId: string, kind: Kind): Promise<Capability[]>;
+ memory: BotRemoteMemoryService;
+}
+export interface BotRemoteEditorOptions {
+ /** `RemoteResourceGetRequest.query`, honored only by pages that advertise `search`. */
+ query?: string;
+ primitives?: readonly string[];
}
const text = (fallback: string, cn: string, tw: string, ja: string, ko: string): RemoteLocalizedText => ({ fallback, translations: { 'zh-CN': cn, 'zh-TW': tw, ja, ko } });
export const editorCopy = {
@@ -22,6 +29,7 @@ export const editorCopy = {
avatar: text('Avatar', '头像', '頭像', 'アバター', '아바타'),
skills: text('Personal Skills', '学会的技能', '學會的技能', '学習したスキル', '학습한 스킬'),
connections: text('Skills & Connections', '技能与连接', '技能與連接', 'スキルと接続', '스킬 및 연결'),
+ memories: memoryCopy.memories,
skill: text('Skill References', '引用的技能', '引用的技能', '参照スキル', '참조 스킬'),
mcp: text('Connections', '连接', '連接', '接続', '연결'),
toolset: text('Toolsets', '工具集', '工具集', 'ツールセット', '도구 모음'),
@@ -49,7 +57,8 @@ const receipt = (id: string): RemoteActionInvokeResponse => ({ effects: [
/** Finite settings resources over existing owner-bound services; no global installation or credentials. */
export function createBotRemoteEditors(deps: BotRemoteEditorDeps, bind: ReturnType<typeof createBotRemoteSettingsResource>['bindResource']) {
- return async (context: RemoteResourceHostContext, id: string, locale?: string): Promise<RemoteResource> => {
+ const memoryEditor = createBotRemoteMemoryEditor(deps, bind);
+ return async (context: RemoteResourceHostContext, id: string, locale?: string, options: BotRemoteEditorOptions = {}): Promise<RemoteResource> => {
const owner = deps.owner(); deps.assertOwner(owner);
if (id === 'create') {
const panel = form('create', editorCopy.create, [
@@ -70,6 +79,11 @@ export function createBotRemoteEditors(deps: BotRemoteEditorDeps, bind: ReturnTy
return { effects: [{ kind: 'refresh-collection', collectionId: 'teammates' }, { kind: 'navigate', target: { kind: 'resource', ref: ref(botId) } }] };
});
}
+ const memory = /^settings:([A-Za-z0-9_-]{1,128})\/memory(?:\/([a-z0-9_-]{1,80}))?$/.exec(id);
+ if (memory) {
+ const settings = await deps.read(memory[1]); deps.assertOwner(owner);
+ return memoryEditor(context, { botId: memory[1], botName: settings.source.name, entry: memory[2], locale, query: options.query, primitives: options.primitives ?? [] });
+ }
const match = /^settings:([A-Za-z0-9_-]{1,128})\/(skills|connections|avatar)(?:\/([a-z0-9-]+))?(?:\/([a-f0-9]{64}))?$/.exec(id);
if (!match) throwIpcError('NOT_FOUND', 'Unknown teammate editor');
const [, botId, page, section, entryId] = match;
diff --git a/apps/desktop/src/main/localDb/ipc/botRemoteManagement.ts b/apps/desktop/src/main/localDb/ipc/botRemoteManagement.ts
index 6af80eb5c2..a2ab8b464d 100644
--- a/apps/desktop/src/main/localDb/ipc/botRemoteManagement.ts
+++ b/apps/desktop/src/main/localDb/ipc/botRemoteManagement.ts
@@ -3,7 +3,7 @@ import { botRemoteResourceFromSource } from './botRemoteResourceProjection.js';
import { inspectAppDefaultModel } from '../../maker-ipc/appDefaultModelControl.js';
import type { BotModelRoute } from '../../../shared/botModelChain.js';
import { createBotRemoteSettingsResource } from './botRemoteSettingsResource.js';
-import { createBotProfile, createBotCanonicalSession, getBotRemoteResourceSource, getBotRemoteSettingsSource, setBotProfileAvatar, updateBotProfile } from './bots.js';
+import { createBotProfile, createBotCanonicalSession, getBotMemoryService, getBotRemoteResourceSource, getBotRemoteSettingsSource, setBotProfileAvatar, updateBotProfile } from './bots.js';
import { activeOwnerScopeKey, isAppSessionBoundaryPending } from '../../appSessionState.js';
import { throwIpcError } from '../../utils/ipcValidate.js';
import { listBotSkillsForBot, readBotSkillForBot, saveBotSkillForSession, deleteBotSkillForBot } from '../../maker-ipc/botSkillService.js';
@@ -82,6 +82,13 @@ const getEditor = createBotRemoteEditors({ ...deps,
async capabilities(callerSessionId, kind) {
return listBotSettingsCapabilities({ callerSessionId, kind });
},
+ // Resolved per call: the same service (locks, refresh coalescing) as the local Memory page.
+ memory: {
+ list: (botId, query) => getBotMemoryService().list(botId, query),
+ read: (botId, filename) => getBotMemoryService().read(botId, filename),
+ update: input => getBotMemoryService().update(input),
+ delete: input => getBotMemoryService().delete(input),
+ },
}, settings.bindResource);
async function getInvitation(context: RemoteResourceHostContext, botId: string) {
const owner = deps.owner();
diff --git a/apps/desktop/src/main/localDb/ipc/botRemoteMemory.ts b/apps/desktop/src/main/localDb/ipc/botRemoteMemory.ts
new file mode 100644
index 0000000000..98879adaef
--- /dev/null
+++ b/apps/desktop/src/main/localDb/ipc/botRemoteMemory.ts
@@ -0,0 +1,192 @@
+import { createHash } from 'node:crypto';
+import type { RemoteActionInvokeResponse, RemoteLocalizedText, RemoteResource, RemoteResourceBlock } from '@cindy/device-link';
+import {
+ BOT_MEMORY_TYPES,
+ type BotMemoryDeleteInput,
+ type BotMemoryDetail,
+ type BotMemorySummary,
+ type BotMemoryType,
+ type BotMemoryUpdateInput,
+} from '../../../shared/botMemory.js';
+import { isIpcError } from '../../../shared/ipc-errors.js';
+import { RemoteResourceRegistryError, type RemoteResourceHostContext } from '../../device-link/remoteResourceRegistry.js';
+import type { createBotRemoteSettingsResource } from './botRemoteSettingsResource.js';
+import { throwIpcError } from '../../utils/ipcValidate.js';
+
+/** The same service instance the local settings page uses (serialization + refresh coalescing). */
+export interface BotRemoteMemoryService {
+ list(botId: string, query?: string): Promise<BotMemorySummary[]>;
+ read(botId: string, filename: string): Promise<BotMemoryDetail>;
+ update(input: BotMemoryUpdateInput): Promise<BotMemoryDetail>;
+ delete(input: BotMemoryDeleteInput): Promise<void>;
+}
+export interface BotRemoteMemoryDeps {
+ owner(): string;
+ assertOwner(owner: string): void;
+ memory: BotRemoteMemoryService;
+}
+export interface BotRemoteMemoryRequest {
+ botId: string;
+ botName: string;
+ /** Entry segment of `settings:<botId>/memory/<entry>`; absent for the list. */
+ entry?: string;
+ locale?: string;
+ query?: string;
+ primitives: readonly string[];
+}
+
+const text = (fallback: string, cn: string, tw: string, ja: string, ko: string): RemoteLocalizedText =>
+ ({ fallback, translations: { 'zh-CN': cn, 'zh-TW': tw, ja, ko } });
+export const memoryCopy = {
+ memories: text('Saved Memories', '已存记忆', '已存記憶', '保存した記憶', '저장된 기억'),
+ search: text('Search memories', '搜索记忆', '搜尋記憶', '記憶を検索', '기억 검색'),
+ types: {
+ user: text('About you', '关于你', '關於你', 'あなたについて', '나에 대해'),
+ feedback: text('Your preferences', '你的要求', '你的要求', 'あなたの要望', '요청 사항'),
+ project: text('Projects', '项目', '專案', 'プロジェクト', '프로젝트'),
+ reference: text('References', '参考', '參考', '参考', '참고'),
+ } satisfies Record<BotMemoryType, RemoteLocalizedText>,
+ edit: text('Edit', '编辑', '編輯', '編集', '편집'),
+ title: text('Title', '标题', '標題', 'タイトル', '제목'),
+ body: text('Content', '内容', '內容', '内容', '내용'),
+ remove: text('Delete Memory', '删除记忆', '刪除記憶', '記憶を削除', '기억 삭제'),
+ removeTitle: text('Delete this memory?', '删除这条记忆?', '刪除這條記憶?', 'この記憶を削除しますか?', '이 기억을 삭제할까요?'),
+ delete: text('Delete', '删除', '刪除', '削除', '삭제'),
+ saved: text('Memory saved', '记忆已保存', '記憶已儲存', '記憶を保存しました', '기억을 저장했습니다'),
+ deleted: text('Memory deleted', '记忆已删除', '記憶已刪除', '記憶を削除しました', '기억을 삭제했습니다'),
+};
+const removeBody = (name: string, title: string) => text(
+ `${name} will no longer refer to “${title}”.`,
+ `${name}之后不会再参考「${title}」。`,
+ `${name}之後不會再參考「${title}」。`,
+ `${name}は今後「${title}」を参照しません。`,
+ `${name}은(는) 앞으로 “${title}”을(를) 참고하지 않습니다.`,
+);
+
+/** `parseRemoteResourceRef` rejects longer ids; long teammate ids use a digest segment (fits a 128-char id). */
+const MAX_REF_ID_CHARS = 160;
+/**
+ * The list must fit one device-link frame (2 MB), so it is bounded by bytes, not a fixed count:
+ * previews stop first, then the oldest titles. Mobile keeps at most 2000 entries per list block.
+ */
+const LIST_BUDGET_BYTES = 1_000_000;
+const PREVIEW_BUDGET_BYTES = 400_000;
+const MAX_GROUP_ENTRIES = 2_000;
+const PREVIEW_CHARS = 140;
+const ENTRY_RE = /^(?:(?:user|feedback|project|reference)_[a-z0-9_-]{1,64}|h[a-f0-9]{12})$/;
+
+const ref = (id: string) => ({ collectionId: 'teammates', kind: 'bot', id });
+const fail = (): never => throwIpcError('INVALID_PARAMS', 'Invalid memory input');
+/** Provider IPC errors reach controllers as INTERNAL; a registry NOT_FOUND tells them the entry is gone. */
+const missing = (): never => { throw new RemoteResourceRegistryError('NOT_FOUND', 'Memory not found'); };
+const digest = (filename: string) => createHash('sha256').update(filename).digest('hex').slice(0, 12);
+const listId = (botId: string) => `settings:${botId}/memory`;
+export function botMemoryEntryResourceId(botId: string, filename: string): string {
+ const direct = `${listId(botId)}/${filename.replace(/\.md$/, '')}`;
+ return direct.length <= MAX_REF_ID_CHARS ? direct : `${listId(botId)}/h${digest(filename)}`;
+}
+const timestamp = (iso: string) => {
+ const value = Date.parse(iso);
+ return Number.isFinite(value) ? { timestamp: value } : {};
+};
+const preview = (value: string) => {
+ const chars = Array.from(value);
+ return chars.length > PREVIEW_CHARS ? `${chars.slice(0, PREVIEW_CHARS).join('').trimEnd()}…` : value;
+};
+
+/**
+ * Remote face of the teammate Memory page. Everything goes through the owner-bound memory
+ * service: no digest entries, no paths, no descriptions. Detail actions are bound to the
+ * entry's `updatedAt`, so a save or delete never overwrites what the teammate changed meanwhile.
+ */
+export function createBotRemoteMemoryEditor(deps: BotRemoteMemoryDeps, bind: ReturnType<typeof createBotRemoteSettingsResource>['bindResource']) {
+ return async (context: RemoteResourceHostContext, request: BotRemoteMemoryRequest): Promise<RemoteResource> => {
+ const owner = deps.owner(); deps.assertOwner(owner);
+ const { botId, entry } = request;
+ const base = listId(botId);
+ if (!entry) {
+ const query = request.query?.trim().slice(0, 200) ?? '';
+ const summaries = await deps.memory.list(botId, query || undefined); deps.assertOwner(owner);
+ const shown: Array<{ item: (typeof summaries)[number]; entry: Record<string, unknown> }> = [];
+ const perType = new Map<string, number>();
+ let used = 0;
+ for (const item of summaries) {
+ if ((perType.get(item.type) ?? 0) >= MAX_GROUP_ENTRIES) continue;
+ const entry = { id: item.filename.replace(/\.md$/, ''), title: item.title,
+ ...(used < PREVIEW_BUDGET_BYTES ? { subtitle: preview(item.preview) } : {}),
+ ...timestamp(item.updatedAt), resourceId: botMemoryEntryResourceId(botId, item.filename) };
+ // The block's fallback Markdown repeats each title once.
+ const bytes = Buffer.byteLength(JSON.stringify(entry)) + Buffer.byteLength(item.title) + 3;
+ if (used + bytes > LIST_BUDGET_BYTES) break;
+ used += bytes; perType.set(item.type, (perType.get(item.type) ?? 0) + 1); shown.push({ item, entry });
+ }
+ const blocks: RemoteResourceBlock[] = request.primitives.includes('search')
+ ? [{ id: 'search', primitive: 'search', fallbackMarkdown: '', data: { query, placeholder: memoryCopy.search } }]
+ : [];
+ for (const type of BOT_MEMORY_TYPES) {
+ const items = shown.filter(({ item }) => item.type === type);
+ if (!items.length) continue;
+ blocks.push({ id: `memory-${type}`, primitive: 'list', title: memoryCopy.types[type],
+ fallbackMarkdown: items.map(({ item }) => `- ${item.title}`).join('\n'),
+ data: {
+ count: summaries.filter(item => item.type === type).length,
+ entries: items.map(({ entry }) => entry),
+ } });
+ }
+ const revision = createHash('sha256').update(JSON.stringify([query, shown.map(({ item }) => [item.filename, item.updatedAt, item.title])])).digest('hex');
+ return { ref: ref(base), revision, display: { title: memoryCopy.memories }, links: [], blocks };
+ }
+ if (!ENTRY_RE.test(entry)) missing();
+ let filename = `${entry}.md`;
+ if (entry.startsWith('h')) {
+ const match = (await deps.memory.list(botId)).find(item => digest(item.filename) === entry.slice(1));
+ deps.assertOwner(owner);
+ filename = match?.filename ?? missing();
+ }
+ const read = async () => {
+ const value = await deps.memory.read(botId, filename).catch((error: unknown) => {
+ if (isIpcError(error) && error.code === 'NOT_FOUND') missing();
+ throw error;
+ });
+ deps.assertOwner(owner);
+ return value;
+ };
+ const detail = await read();
+ const id = `${base}/${entry}`;
+ const resource: RemoteResource = {
+ ref: ref(id),
+ // The service compares this exact value again inside its storage lock.
+ revision: detail.updatedAt,
+ display: { title: detail.title, subtitle: memoryCopy.types[detail.type], ...timestamp(detail.updatedAt) },
+ links: [],
+ blocks: [
+ { id: 'entry', primitive: 'form', title: memoryCopy.edit, fallbackMarkdown: detail.body, data: { actionId: 'entry', values: { title: detail.title, body: detail.body } } },
+ { id: 'remove', primitive: 'action', fallbackMarkdown: memoryCopy.remove.fallback, data: { actionId: 'remove' } },
+ ],
+ actions: [
+ { id: 'entry', label: memoryCopy.edit, fields: [
+ { id: 'title', label: memoryCopy.title, kind: 'text', required: true },
+ { id: 'body', label: memoryCopy.body, kind: 'multiline', required: true },
+ ] },
+ { id: 'remove', label: memoryCopy.remove, tone: 'destructive',
+ confirmation: { title: memoryCopy.removeTitle, body: removeBody(request.botName, detail.title), confirmLabel: memoryCopy.delete } },
+ ],
+ };
+ return bind(context, resource, async () => (await read()).updatedAt, async (invocation): Promise<RemoteActionInvokeResponse> => {
+ const input = invocation.input ?? {};
+ if (invocation.actionId === 'remove') {
+ if (Object.keys(input).length) fail();
+ await deps.memory.delete({ botId, filename, expectedUpdatedAt: detail.updatedAt }); deps.assertOwner(owner);
+ return { effects: [{ kind: 'refresh-resource', ref: ref(base) }, { kind: 'toast', message: memoryCopy.deleted }] };
+ }
+ if (Object.keys(input).some(key => key !== 'title' && key !== 'body') || !('title' in input || 'body' in input)) fail();
+ // Length limits and normalization stay with the service shared with the Desktop page.
+ const field = (key: 'title' | 'body', fallback: string) => key in input
+ ? typeof input[key] === 'string' && (input[key] as string).length <= 65_536 ? input[key] as string : fail()
+ : fallback;
+ await deps.memory.update({ botId, filename, title: field('title', detail.title), body: field('body', detail.body), expectedUpdatedAt: detail.updatedAt });
+ deps.assertOwner(owner);
+ return { effects: [{ kind: 'refresh-resource', ref: ref(id) }, { kind: 'refresh-resource', ref: ref(base) }, { kind: 'toast', message: memoryCopy.saved }] };
+ });
+ };
+}
diff --git a/apps/desktop/src/main/localDb/ipc/botRemoteResourceProvider.ts b/apps/desktop/src/main/localDb/ipc/botRemoteResourceProvider.ts
index bb4cfd5ee9..205f6d58b2 100644
--- a/apps/desktop/src/main/localDb/ipc/botRemoteResourceProvider.ts
+++ b/apps/desktop/src/main/localDb/ipc/botRemoteResourceProvider.ts
@@ -87,7 +87,7 @@ export function registerBotRemoteResourceProvider(management?: typeof botRemoteM
},
async get(context, request) {
if (management && (request.ref.id === 'create' || request.ref.id.startsWith('settings:'))) {
- return management.getEditor(context, request.ref.id, request.client.locale);
+ return management.getEditor(context, request.ref.id, request.client.locale, { query: request.query, primitives: request.client.primitives });
}
if (request.ref.id.startsWith('working:')) {
const [botId, phase, extra] = request.ref.id.slice('working:'.length).split('/');
@@ -119,6 +119,10 @@ export function registerBotRemoteResourceProvider(management?: typeof botRemoteM
if (block) block.data = data;
else resource.blocks?.push({ id: page, primitive: 'list', fallbackMarkdown: '', data });
}
+ // The `memory` block stays the toggle/USER.md form; saved entries are a separate list page.
+ resource.blocks?.push({ id: 'memories', primitive: 'list', fallbackMarkdown: '', data: {
+ entries: [{ id: 'memories', title: editorCopy.memories, resourceId: `settings:${source.id}/memory` }],
+ } });
}
return { ...resource, teammateMessaging: { version: 1, available: source.status === 'active' } };
},
diff --git a/apps/desktop/src/main/localDb/ipc/botRemoteSettingsResource.ts b/apps/desktop/src/main/localDb/ipc/botRemoteSettingsResource.ts
index 5cbb7e9e70..6c52c5208e 100644
--- a/apps/desktop/src/main/localDb/ipc/botRemoteSettingsResource.ts
+++ b/apps/desktop/src/main/localDb/ipc/botRemoteSettingsResource.ts
@@ -42,6 +42,7 @@ const copy = {
delete: text('Delete Teammate', '删除伙伴', '刪除夥伴', 'チームメイトを削除', '팀원 삭제'),
deleteBody: text('Permanently delete this teammate’s profile, memory, skills and workspace. Task history and independent worktrees are retained. Type the full name to delete.', '永久删除伙伴的资料、记忆、技能和工作区。任务记录和独立 worktree 保留。输入完整名字后删除。', '永久刪除夥伴的資料、記憶、技能和工作區。任務記錄和獨立 worktree 保留。輸入完整名字後刪除。', 'プロフィール、記憶、スキル、ワークスペースを完全に削除します。セッション履歴と独立した worktree は保持されます。削除するには名前全体を入力してください。', '프로필, 기억, 스킬, 작업 공간을 영구 삭제합니다. 세션 기록과 독립 worktree는 유지됩니다. 삭제하려면 전체 이름을 입력하세요.'),
resume: text('Resume Teammate', '恢复伙伴', '恢復夥伴', 'チームメイトを再開', '팀원 재개'),
+ resumeBody: text('Your teammate starts taking messages and background work again. History, memory and files are unchanged; automations you paused yourself stay paused.', '恢复后伙伴重新接收消息和后台工作。记录、记忆和文件不变,你手动暂停的自动化仍保持暂停。', '恢復後夥伴重新接收訊息和背景工作。記錄、記憶和檔案不變,你手動暫停的自動化仍保持暫停。', '再開すると、チームメイトはメッセージとバックグラウンド作業を再び受け付けます。履歴、記憶、ファイルは変わらず、手動で一時停止した自動化は一時停止のままです。', '재개하면 팀원이 메시지와 백그라운드 작업을 다시 받습니다. 기록, 기억, 파일은 그대로이며 직접 일시 중지한 자동화는 계속 일시 중지됩니다.'),
save: text('Save Changes', '保存更改', '儲存變更', '変更を保存', '변경 사항 저장'),
saved: text('Teammate settings saved', '伙伴设置已保存', '夥伴設定已儲存', 'チームメイトの設定を保存しました', '팀원 설정을 저장했습니다'),
restarted: text('Teammate restarted; send a message to continue', '伙伴已重启,发送消息即可继续', '夥伴已重新啟動,傳送訊息即可繼續', 'チームメイトを再起動しました。メッセージを送って続行できます', '팀원을 다시 시작했습니다. 메시지를 보내 계속하세요'),
@@ -142,7 +143,7 @@ export function createBotRemoteSettingsResource(deps: BotRemoteSettingsDeps) {
}
for (const operation of (source.status === 'paused' ? ['resume', 'delete'] : ['restart', 'delete']) as Array<'restart' | 'delete' | 'resume'>) {
actions.push({ id: issue(context, owner, settings, operation), label: copy[operation], tone: operation === 'delete' ? 'destructive' : 'neutral',
- confirmation: { title: copy[operation], body: operation === 'delete' ? copy.deleteBody : copy.restartBody, confirmLabel: copy[operation] },
+ confirmation: { title: copy[operation], body: { restart: copy.restartBody, delete: copy.deleteBody, resume: copy.resumeBody }[operation], confirmLabel: copy[operation] },
...(operation === 'delete' ? { fields: [{ id: 'confirmName', label: copy.name, kind: 'text', required: true }] } : {}) });
resource.blocks.push({ id: operation, primitive: 'action', fallbackMarkdown: copy[operation].fallback, data: { actionId: actions.at(-1)!.id } });
}
diff --git a/apps/desktop/src/main/localDb/ipc/bots.ts b/apps/desktop/src/main/localDb/ipc/bots.ts
index ab06068f39..987f68ce0e 100644
--- a/apps/desktop/src/main/localDb/ipc/bots.ts
+++ b/apps/desktop/src/main/localDb/ipc/bots.ts
@@ -120,6 +120,35 @@ function captureBotOperationOwner() {
return { userDataDir, assertCurrent };
}
+let botMemoryService: ReturnType<typeof createBotMemoryService> | null = null;
+/**
+ * 伙伴记忆页的唯一服务实例。本机设置页 IPC 与设备互联的远程设置共用它,
+ * 同一条记忆的保存 / 删除串行与运行时刷新合并才不会分成两份。
+ */
+export function getBotMemoryService(): ReturnType<typeof createBotMemoryService> {
+ botMemoryService ??= createBotMemoryService({
+ async getStore(scopeKey) {
+ const manager = getMakerIfReady()?.makerMemory;
+ if (!manager) throwIpcError('MAKER_MEMORY_NOT_READY', 'Memory is not ready');
+ return manager.getStore(scopeKey, { skipDisabledCheck: true });
+ },
+ async readBot(botId) {
+ const owner = captureBotOperationOwner();
+ const [row] = await getDbClient()
+ .drizzle.select({ status: botProfiles.status, canonicalSessionId: botProfiles.canonicalSessionId })
+ .from(botProfiles)
+ .where(eq(botProfiles.id, botId))
+ .limit(1);
+ owner.assertCurrent();
+ return row && row.status !== 'deleting'
+ ? { canonicalSessionId: row.canonicalSessionId, assertCurrent: owner.assertCurrent }
+ : null;
+ },
+ requestRefresh: (sessionId) => requestBotRuntimeEpochRefresh(sessionId, 'resource'),
+ });
+ return botMemoryService;
+}
+
/**
* 把这份档案摊到伙伴自己的家(`<userData>/bots/<botId>/`)。
*
@@ -1812,26 +1841,7 @@ export function registerBotIpc(): void {
});
});
- const memory = createBotMemoryService({
- async getStore(scopeKey) {
- const manager = getMakerIfReady()?.makerMemory;
- if (!manager) throwIpcError('MAKER_MEMORY_NOT_READY', 'Memory is not ready');
- return manager.getStore(scopeKey, { skipDisabledCheck: true });
- },
- async readBot(botId) {
- const owner = captureBotOperationOwner();
- const [row] = await getDbClient()
- .drizzle.select({ status: botProfiles.status, canonicalSessionId: botProfiles.canonicalSessionId })
- .from(botProfiles)
- .where(eq(botProfiles.id, botId))
- .limit(1);
- owner.assertCurrent();
- return row && row.status !== 'deleting'
- ? { canonicalSessionId: row.canonicalSessionId, assertCurrent: owner.assertCurrent }
- : null;
- },
- requestRefresh: (sessionId) => requestBotRuntimeEpochRefresh(sessionId, 'resource'),
- });
+ const memory = getBotMemoryService();
/** Bind each memory operation to the account that started it. */
const withMemoryOwner = async <T>(run: () => Promise<T>): Promise<T> => {
const owner = captureBotOperationOwner();
diff --git a/apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx b/apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx
index cda92e42cc..6b58933cf8 100644
--- a/apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx
+++ b/apps/desktop/src/renderer/features/bots/RemoteBotSettings.tsx
@@ -573,7 +573,9 @@ function RemoteBotSettingsContent({ bot, beforeCloseRef, onDeleted }: Props) {
null,
resourceId === bot.id
? bot.id
- : resourceId.includes('/connections/') || resourceId.includes('/skills/')
+ : resourceId.includes('/connections/') ||
+ resourceId.includes('/skills/') ||
+ resourceId.includes('/memory/')
? resourceId.slice(0, resourceId.lastIndexOf('/'))
: bot.id,
)
diff --git a/apps/mobile/src/__tests__/CompanionMemoryPage.test.tsx b/apps/mobile/src/__tests__/CompanionMemoryPage.test.tsx
new file mode 100644
index 0000000000..e01a8f49a4
--- /dev/null
+++ b/apps/mobile/src/__tests__/CompanionMemoryPage.test.tsx
@@ -0,0 +1,225 @@
+// @vitest-environment jsdom
+import { act, useRef } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+const h = vi.hoisted(() => ({ alert: vi.fn(), invoke: vi.fn(), read: vi.fn(), perform: vi.fn(), openLink: vi.fn(async () => {}), state: null as any }));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ i18n: { language: 'en' },
+ t: (key: string, values?: Record<string, string>) => `${key.split('.').at(-1)}${values?.name ? `:${values.name}` : ''}` }) }));
+vi.mock('react-native', () => ({
+ Platform: { OS: 'android' }, StyleSheet: { create: (value: unknown) => value, hairlineWidth: 1 }, Alert: { alert: h.alert },
+ View: ({ children }: any) => <div>{children}</div>,
+ Pressable: ({ children, onPress, testID }: any) => <button data-testid={testID} onClick={onPress}>{children}</button>,
+}));
+vi.mock('@/components/AppText', () => ({
+ Text: ({ children }: any) => <span>{children}</span>,
+ TextInput: (p: any) => <input aria-label={p.accessibilityLabel} value={p.value} disabled={p.editable === false} onInput={e => p.onChangeText(e.currentTarget.value)} onChange={() => {}} />,
+}));
+vi.mock('@/components/MobilePrimitives', () => ({ MainWindowActionButton: ({ action }: any) => <button disabled={!!action.disabled || !!action.busy} onClick={action.onPress}>{action.label}</button> }));
+vi.mock('@/theme', async () => ({ ...await import('@/theme/tokens'), useTheme: () => ({ colors: {} }), useThemedStyles: () => ({}) }));
+vi.mock('@/device-link/remoteResources', async original => ({ ...await original<object>(), invokeRemoteResourceAction: (...args: unknown[]) => h.invoke(...args) }));
+vi.mock('@/session/companionProfileData', async original => ({ ...await original<object>(), loadCompanionProfile: (...args: unknown[]) => h.read(...args) }));
+vi.mock('@/session/ComposerNativeSection', () => ({ ComposerNativeSection: ({ title, children }: any) => <section aria-label={title}>{children}</section> }));
+vi.mock('@expo/ui/swift-ui/modifiers', () => ({
+ ...Object.fromEntries(['accessibilityLabel', 'autocorrectionDisabled', 'buttonStyle', 'contentShape', 'disabled', 'font', 'foregroundStyle', 'frame', 'lineLimit', 'listRowInsets', 'textInputAutocapitalization', 'textSelection'].map(name => [name, (value: unknown) => ({ name, value })])),
+ shapes: { rectangle: () => ({}) },
+}));
+vi.mock('@expo/ui/swift-ui', () => {
+ const Container = ({ children }: any) => <div>{children}</div>;
+ const mod = (props: any, name: string) => props.modifiers?.find((m: any) => m.name === name)?.value;
+ return {
+ HStack: Container, VStack: Container, Image: () => null, Spacer: () => null, ProgressView: () => <span>Loading</span>,
+ Text: ({ children }: any) => <span>{children}</span>,
+ Button: (props: any) => <button data-testid={props.testID} disabled={!!mod(props, 'disabled')} onClick={props.onPress}>{props.children}</button>,
+ useNativeState: (initial: string) => {
+ const state = useRef<any>(null);
+ state.current ??= { value: initial, get() { return this.value; }, set(value: string) { this.value = value; } };
+ return state.current;
+ },
+ TextField: (props: any) => <input aria-label={mod(props, 'accessibilityLabel')} defaultValue={props.text.get()} disabled={!!mod(props, 'disabled')}
+ onInput={e => { props.text.value = e.currentTarget.value; props.onTextChange(e.currentTarget.value); }} />,
+ };
+});
+
+import { parseCompanionProfileData } from '@/session/companionProfileData';
+import { useCompanionMemory } from '@/session/useCompanionMemory';
+import { CompanionMemoryPage } from '@/session/CompanionMemoryPage';
+import { CompanionMemoryPage as NativeCompanionMemoryPage } from '@/session/CompanionMemoryPage.ios';
+Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
+
+type Memory = { stem: string; type: 'user' | 'feedback'; title: string; body: string; revision: number };
+const kinds = { user: 'About you', feedback: 'Your preferences' };
+let memories: Memory[] = [];
+let grantId = 0;
+const grants = new Map<string, { stem: string; operation: 'entry' | 'remove'; revision: number }>();
+const ref = (id: string) => ({ collectionId: 'teammates', kind: 'bot', id });
+/** Host-shaped resources, with one-use actions bound to the entry revision like `bindResource`. */
+function hostResource(id: string, query = '') {
+ if (id === 'settings:bot/memory') {
+ const shown = memories.filter(item => !query || item.title.includes(query) || item.body.includes(query));
+ const blocks: unknown[] = [{ id: 'search', primitive: 'search', fallbackMarkdown: '', data: { query, placeholder: 'Search memories' } }];
+ for (const type of ['user', 'feedback'] as const) {
+ const items = shown.filter(item => item.type === type);
+ if (items.length) blocks.push({ id: `memory-${type}`, primitive: 'list', title: kinds[type], fallbackMarkdown: '', data: { count: items.length,
+ entries: items.map(item => ({ id: item.stem, title: item.title, subtitle: item.body, timestamp: Date.UTC(2026, 0, 2), resourceId: `settings:bot/memory/${item.stem}` })) } });
+ }
+ return { ref: ref(id), revision: 'list', display: { title: 'Saved Memories' }, links: [], blocks };
+ }
+ const memory = memories.find(item => `settings:bot/memory/${item.stem}` === id);
+ if (!memory) throw new Error('[NOT_FOUND] Memory not found');
+ const entry = `grant-${++grantId}`; const remove = `grant-${++grantId}`;
+ grants.set(entry, { stem: memory.stem, operation: 'entry', revision: memory.revision });
+ grants.set(remove, { stem: memory.stem, operation: 'remove', revision: memory.revision });
+ return { ref: ref(id), revision: String(memory.revision), display: { title: memory.title, subtitle: kinds[memory.type], timestamp: Date.UTC(2026, 0, 2) }, links: [],
+ actions: [{ id: entry, label: 'Edit', fields: [{ id: 'title', label: 'Title', kind: 'text', required: true }, { id: 'body', label: 'Content', kind: 'multiline', required: true }] },
+ { id: remove, label: 'Delete Memory', tone: 'destructive', confirmation: { title: 'Delete this memory?', body: `Sora will no longer refer to “${memory.title}”.`, confirmLabel: 'Delete' } }],
+ blocks: [{ id: 'entry', primitive: 'form', title: 'Edit', fallbackMarkdown: memory.body, data: { actionId: entry, values: { title: memory.title, body: memory.body } } },
+ { id: 'remove', primitive: 'action', fallbackMarkdown: 'Delete Memory', data: { actionId: remove } }] };
+}
+const teammateWrites = (stem: string, body: string) => { const memory = memories.find(item => item.stem === stem)!; memory.body = body; memory.revision++; };
+
+let root: Root; let container: HTMLDivElement;
+function Harness({ platform }: { platform: string }) {
+ const memory = useCompanionMemory({ invoke: vi.fn() as never, openLink: h.openLink, deviceId: 'host', deviceName: 'Mac', collectionId: 'teammates',
+ resourceKind: 'bot', listResourceId: 'settings:bot/memory', online: true, active: true, binding: 'account-1' });
+ h.state = memory;
+ const Page = platform === 'ios' ? NativeCompanionMemoryPage : CompanionMemoryPage;
+ return <Page memory={memory} online botName="Sora" memoryEnabled />;
+}
+const settle = () => act(async () => { for (let i = 0; i < 3; i++) await new Promise(resolve => setTimeout(resolve, 0)); });
+async function render(platform: string) { await act(async () => root.render(<Harness platform={platform} />)); await settle(); }
+const buttons = () => [...container.querySelectorAll('button')];
+/** Visible copy, including native Section titles (rendered as headers, not body text). */
+const shown = (text: string) => container.textContent!.includes(text)
+ || [...container.querySelectorAll('section')].some(section => section.getAttribute('aria-label')?.includes(text));
+async function click(text: string) {
+ const button = buttons().find(node => node.textContent === text || node.dataset.testid === text);
+ if (!button) throw new Error(`Missing ${text}`);
+ await act(async () => { button.click(); }); await settle();
+}
+async function type(label: string, value: string) {
+ const field = container.querySelector<HTMLInputElement>(`input[aria-label="${label}"]`);
+ if (!field) throw new Error(`Missing ${label}`);
+ await act(async () => { field.value = value; field.dispatchEvent(new Event('input', { bubbles: true })); });
+}
+async function openEditor(platform: string, stem = 'user_coffee') {
+ await render(platform); await click(`companionMemory.${stem}`); await click('memoryEdit');
+}
+
+beforeEach(() => {
+ vi.clearAllMocks(); grants.clear(); grantId = 0;
+ memories = [
+ { stem: 'user_coffee', type: 'user', title: 'Coffee', body: 'Black, no sugar.', revision: 1 },
+ { stem: 'feedback_short', type: 'feedback', title: 'Short replies', body: 'Lead with the answer.', revision: 1 },
+ { stem: 'feedback_sources', type: 'feedback', title: 'Cite sources', body: 'Link every quote.', revision: 1 },
+ ];
+ h.read.mockImplementation(async (_invoke: unknown, _device: string, target: { id: string }, _locale: string, options?: { query?: string }) =>
+ parseCompanionProfileData(hostResource(target.id, options?.query), ref(target.id)));
+ h.invoke.mockImplementation(async (_invoke: unknown, _target: unknown, request: { actionId: string; input: Record<string, string> }) => {
+ const grant = grants.get(request.actionId); const memory = memories.find(item => item.stem === grant?.stem);
+ // Provider conflicts reach the controller only as an opaque failure.
+ if (!grant || !memory || memory.revision !== grant.revision) throw new Error('[INTERNAL] remote resource provider failed');
+ grants.delete(request.actionId);
+ h.perform(grant.operation, request.input);
+ if (grant.operation === 'remove') memories = memories.filter(item => item !== memory);
+ else { Object.assign(memory, request.input); memory.revision++; }
+ return { effects: [{ kind: 'toast', message: grant.operation === 'remove' ? 'Memory deleted' : 'Memory saved' }] };
+ });
+ container = document.createElement('div'); document.body.append(container); root = createRoot(container);
+});
+afterEach(() => { act(() => root.unmount()); container.remove(); });
+
+it.each(['android', 'ios'])('groups memories by kind and searches through host retrieval on %s', async platform => {
+ await render(platform);
+ expect(shown('About you')).toBe(true); expect(shown('Your preferences')).toBe(true);
+ expect(container.textContent).toContain('Lead with the answer.');
+ if (platform === 'ios') expect(container.querySelector('section[aria-label="Your preferences 2"]')).not.toBeNull();
+ await type('memorySearch', 'Link');
+ await act(async () => { await new Promise(resolve => setTimeout(resolve, 350)); }); await settle();
+ expect(h.read).toHaveBeenLastCalledWith(expect.anything(), 'host', ref('settings:bot/memory'), 'en', { query: 'Link' });
+ expect(container.textContent).toContain('Cite sources'); expect(container.textContent).not.toContain('Coffee');
+ await type('memorySearch', 'nothing matches');
+ await act(async () => { await new Promise(resolve => setTimeout(resolve, 350)); }); await settle();
+ expect(container.textContent).toContain('memoryNoResults');
+});
+
+it.each(['android', 'ios'])('never overwrites a newer teammate write and saves mine only after I choose on %s', async platform => {
+ await openEditor(platform);
+ await type('Content', 'Oat latte.');
+ teammateWrites('user_coffee', 'Espresso, written by Sora.');
+ await click(platform === 'ios' ? 'companionMemory.done' : 'memoryDone');
+ expect(h.perform).not.toHaveBeenCalled();
+ expect(h.state.saveState).toBe('conflict');
+ expect(shown('memoryChanged:Sora')).toBe(true); expect(container.textContent).toContain('Espresso, written by Sora.');
+ expect(h.state.draft.body).toBe('Oat latte.');
+ await click(platform === 'ios' ? 'companionMemory.keepMine' : 'memoryKeepMine');
+ expect(h.perform).toHaveBeenCalledOnce(); expect(h.perform).toHaveBeenCalledWith('entry', { body: 'Oat latte.' });
+ expect(memories[0].body).toBe('Oat latte.'); expect(h.state.saveState).toBe('saved'); expect(h.state.dirty).toBe(false);
+});
+
+it.each(['android', 'ios'])('can take the teammate’s latest version instead of my draft on %s', async platform => {
+ await openEditor(platform);
+ await type('Content', 'Oat latte.');
+ teammateWrites('user_coffee', 'Espresso, written by Sora.');
+ await click(platform === 'ios' ? 'companionMemory.done' : 'memoryDone');
+ await click(platform === 'ios' ? 'companionMemory.useLatest' : 'memoryUseLatest');
+ expect(h.perform).not.toHaveBeenCalled();
+ expect(h.state.draft.body).toBe('Espresso, written by Sora.'); expect(h.state.dirty).toBe(false);
+ expect(container.querySelector<HTMLInputElement>('input[aria-label="Content"]')!.value).toBe('Espresso, written by Sora.');
+});
+
+it.each(['android', 'ios'])('deletes only after confirmation and not over a newer teammate write on %s', async platform => {
+ await render(platform); await click('companionMemory.feedback_sources');
+ await click(platform === 'ios' ? 'companionMemory.delete' : 'Delete Memory');
+ const [title, body, choices] = h.alert.mock.calls[0];
+ expect([title, body]).toEqual(['Delete this memory?', 'Sora will no longer refer to “Cite sources”.']);
+ teammateWrites('feedback_sources', 'Changed on the computer.');
+ await act(async () => { choices[1].onPress(); }); await settle();
+ expect(h.perform).not.toHaveBeenCalled(); expect(container.textContent).toContain('memoryChanged:Sora');
+ expect(container.textContent).toContain('Changed on the computer.');
+ await click(platform === 'ios' ? 'companionMemory.delete' : 'Delete Memory');
+ await act(async () => { h.alert.mock.calls[1][2][1].onPress(); }); await settle();
+ expect(h.perform).toHaveBeenCalledWith('remove', {});
+ expect(h.state.view).toBe('list'); expect(container.textContent).not.toContain('Cite sources'); expect(container.textContent).toContain('Memory deleted');
+});
+
+it('reconciles a lost save acknowledgement by reading instead of replaying', async () => {
+ await openEditor('android');
+ const perform = h.invoke.getMockImplementation()!;
+ h.invoke.mockImplementationOnce(async (...args: any[]) => { await perform(...args); throw new Error('request timed out'); });
+ await type('Content', 'Oat latte.'); await click('memoryDone');
+ expect(h.invoke).toHaveBeenCalledOnce(); expect(memories[0].body).toBe('Oat latte.');
+ expect(h.state.view).toBe('detail'); expect(container.textContent).toContain('Oat latte.');
+});
+
+it('keeps the draft after an ordinary failure and steps back through edit, detail and list', async () => {
+ await openEditor('android');
+ h.invoke.mockRejectedValueOnce(new Error('[INTERNAL] remote resource provider failed'));
+ await type('Content', 'Oat latte.'); await click('memoryDone');
+ expect(h.state.saveState).toBe('error'); expect(h.state.draft.body).toBe('Oat latte.'); expect(h.state.view).toBe('edit');
+ let handled = false;
+ await act(async () => { handled = await h.state.back(); }); await settle();
+ expect(handled).toBe(true); expect(memories[0].body).toBe('Oat latte.'); expect(h.state.view).toBe('detail');
+ await act(async () => { handled = await h.state.back(); }); await settle();
+ expect(handled).toBe(true); expect(h.state.view).toBe('list');
+ await act(async () => { handled = await h.state.back(); });
+ expect(handled).toBe(false);
+});
+
+it('asks before discarding an unsavable draft when leaving', async () => {
+ await openEditor('android');
+ await type('Content', ' ');
+ let left: Promise<boolean> | undefined;
+ await act(async () => { left = h.state.flush(); }); await settle();
+ expect(h.alert).toHaveBeenCalledOnce(); expect(h.invoke).not.toHaveBeenCalled();
+ await act(async () => { h.alert.mock.calls[0][2][0].onPress(); });
+ await expect(left).resolves.toBe(false);
+ expect(h.state.draft.body).toBe(' ');
+});
+
+it('shows a memory that disappeared as missing rather than as a failure', async () => {
+ await render('android');
+ memories = memories.filter(item => item.stem !== 'user_coffee');
+ await click('companionMemory.user_coffee');
+ expect(h.state.missing).toBe(true); expect(container.textContent).toContain('memoryMissing');
+});
diff --git a/apps/mobile/src/__tests__/CompanionModelChain.test.tsx b/apps/mobile/src/__tests__/CompanionModelChain.test.tsx
index cfad8dcf2a..90fa19efa1 100644
--- a/apps/mobile/src/__tests__/CompanionModelChain.test.tsx
+++ b/apps/mobile/src/__tests__/CompanionModelChain.test.tsx
@@ -30,7 +30,7 @@ vi.mock("react-i18next", () => ({
}));
vi.mock("lucide-react-native", () =>
Object.fromEntries(
- ["ChevronRight", "MinusCircle", "Plus", "ArrowUp"].map((key) => [
+ ["ChevronRight", "ChevronDown", "ChevronUp", "MinusCircle", "Plus", "ArrowUp"].map((key) => [
key,
() => null,
]),
@@ -125,17 +125,29 @@ it("shows the selected remote account and catalog model name without changing it
expect(node.textContent).not.toContain("openai:second");
expect(h.change).not.toHaveBeenCalled();
});
-it("keeps separate same-model accounts while reordering candidates", async () => {
- await render("remote-mac", [{ ...route, providerId: "openai" }, route]);
- const move = node.querySelector(
- '[aria-label="devices.companionProfile.moveModelUp"]',
- ) as HTMLButtonElement;
- await act(async () => move.click());
+it("keeps the primary first and reorders separate same-model backup accounts inside the folded chain", async () => {
+ const third = { ...route, providerId: "openai:third" };
+ h.catalog.providers.push(provider("openai:third", "[email protected]"));
+ await render("remote-mac", [{ ...route, providerId: "openai" }, route, third]);
+ const moves = () => node.querySelectorAll('[aria-label="devices.companionProfile.moveModelUp"]');
+ const removes = () => node.querySelectorAll('[aria-label="devices.companionProfile.removeModel"]');
+ // Folded: only the primary shows, and it can be neither moved nor removed.
+ expect(node.textContent).toContain("devices.companionProfile.backupModels");
+ expect(node.textContent).not.toContain("[email protected]");
+ expect(moves()).toHaveLength(0);
+ expect(removes()).toHaveLength(0);
+ const toggle = [...node.querySelectorAll('button')].find(button => button.textContent === 'devices.companionProfile.backupModels')!;
+ await act(async () => toggle.click());
+ expect(node.textContent).toContain("[email protected]");
+ // Backup 1 cannot move above the primary; backup 2 moves above backup 1.
+ expect(moves()).toHaveLength(1);
+ expect(removes()).toHaveLength(2);
+ await act(async () => (moves()[0] as HTMLButtonElement).click());
expect(
JSON.parse(h.change.mock.lastCall![0].modelChain).map(
(r: any) => r.providerId,
),
- ).toEqual(["openai:second", "openai"]);
+ ).toEqual(["openai", "openai:third", "openai:second"]);
});
it("does not expose the previous device account while the new catalog is loading", async () => {
await render();
diff --git a/apps/mobile/src/__tests__/CompanionProfileSheet.test.tsx b/apps/mobile/src/__tests__/CompanionProfileSheet.test.tsx
index 27d608326f..b5fc478895 100644
--- a/apps/mobile/src/__tests__/CompanionProfileSheet.test.tsx
+++ b/apps/mobile/src/__tests__/CompanionProfileSheet.test.tsx
@@ -132,3 +132,111 @@ it('leaves a deleted teammate only after the native sheet closes', async () => {
await act(async () => h.view.onClosed());
expect(h.deleted).toHaveBeenCalledOnce();
});
+
+const memoryForm = { id: 'memory', values: { memory: true, userContext: 'Prefers tea' }, action: { id: 'memory-grant', label: 'Save', fields: [{ id: 'memory', label: 'Remember', kind: 'toggle' }, { id: 'userContext', label: 'About me', kind: 'multiline' }] } };
+const memoriesEntry = { id: 'memories', values: {}, entries: [{ id: 'memories', title: 'Saved Memories', resourceId: 'settings:bot/memory' }] };
+it('opens the host saved-memories page from Memory and steps back to the toggle', async () => {
+ h.read.mockResolvedValue({ resource, panels: [panel, memoryForm, memoriesEntry] });
+ await render(); await act(async () => h.view.onOpen('memory'));
+ expect(h.view.hasMemoryEntries).toBe(true);
+ await act(async () => h.view.onOpen('memoryEntries'));
+ expect(h.view.page).toBe('memoryEntries'); expect(h.view.memoryPage).toBeTruthy();
+ expect(h.read).toHaveBeenLastCalledWith(h.invoke, 'host', { collectionId: 'teammates', kind: 'bot', id: 'settings:bot/memory' }, 'en', { query: '' });
+ await act(async () => h.view.onBack());
+ expect(h.view.page).toBe('memory');
+});
+it('keeps the upgrade path when the host has no saved-memories page', async () => {
+ h.read.mockResolvedValue({ resource, panels: [panel, memoryForm] });
+ await render(); await act(async () => h.view.onOpen('memory'));
+ expect(h.view.hasMemoryEntries).toBe(false);
+ expect(h.read.mock.calls.every(call => !String(call[2]?.id).includes('/memory'))).toBe(true);
+});
+it('saves a changed memory toggle before leaving for the saved-memories page', async () => {
+ h.read.mockResolvedValue({ resource, panels: [panel, memoryForm, memoriesEntry] });
+ await render(); await act(async () => h.view.onOpen('memory'));
+ await act(async () => h.view.onChange({ ...memoryForm.values, memory: false }));
+ h.invoke.mockRejectedValueOnce(new Error('offline'));
+ await act(async () => h.view.onOpen('memoryEntries'));
+ expect(h.view.page).toBe('memory'); expect(h.view.dirty).toBe(true);
+ await act(async () => h.view.onOpen('memoryEntries'));
+ expect(h.invoke.mock.calls.at(-1)?.[2]).toMatchObject({ actionId: 'memory-grant', input: { memory: false } });
+ expect(h.view.page).toBe('memoryEntries');
+});
+
+it('explains a rename collision instead of an ambiguous save failure', async () => {
+ await render(); await act(async () => h.view.onOpen('profile'));
+ await act(async () => h.view.onChange({ name: 'Aster' }));
+ h.invoke.mockRejectedValueOnce(new Error('[ALREADY_EXISTS] teammate name'));
+ await act(async () => h.view.onSubmit(h.view.panel));
+ expect(h.view.error).toBe(true);
+ expect(h.view.errorLabel).toBe('devices.companionProfile.nameTaken');
+ expect(h.view.values.name).toBe('Aster');
+ // The next attempt starts without the stale collision notice.
+ await act(async () => h.view.onChange({ name: 'Aster 2' }));
+ await act(async () => h.view.onSubmit(h.view.panel));
+ expect(h.view.errorLabel).toBeUndefined();
+});
+
+it('turns a stale save into the existing conflict choice and keeps the draft', async () => {
+ await render(); await act(async () => h.view.onOpen('profile'));
+ await act(async () => h.view.onChange({ name: 'Local edit' }));
+ h.read.mockResolvedValue({ resource: { ...resource, revision: 'v2' }, panels: [{ ...panel, values: { name: 'Desktop edit' } }] });
+ h.invoke.mockRejectedValueOnce(new Error('[PRECONDITION_FAILED] resource changed'));
+ await act(async () => h.view.onSubmit(h.view.panel));
+ expect(h.view.conflict).toBe(true); expect(h.view.error).toBe(false);
+ expect(h.view.values.name).toBe('Local edit');
+});
+
+it('offers the conflict choice when an editor save is stale, instead of failing silently', async () => {
+ await render();
+ const skillRef = { ...resource.ref, id: 'settings:bot/skills/learned' };
+ const skill = { id: 'skill', values: { body: 'Original' }, action: { id: 'skill-save', label: 'Save', fields: [{ id: 'body', label: 'Content', kind: 'multiline' }] } };
+ h.read.mockResolvedValue({ resource: { ...resource, ref: skillRef }, panels: [skill] });
+ await act(async () => h.view.onEditor('settings:bot/skills/learned'));
+ await act(async () => h.view.onChange({ body: 'My edit' }));
+ h.read.mockResolvedValue({ resource: { ...resource, ref: skillRef, revision: 'v2' }, panels: [{ ...skill, values: { body: 'Desktop edit' } }] });
+ h.invoke.mockRejectedValueOnce(new Error('[PRECONDITION_FAILED] resource changed'));
+ const reads = h.read.mock.calls.length;
+ await act(async () => h.view.onSubmit(h.view.panel));
+ expect(h.read.mock.calls.length).toBe(reads + 1);
+ expect(h.view.conflict).toBe(true); expect(h.view.error).toBe(false);
+ expect(h.view.values.body).toBe('My edit');
+});
+
+it('resends the exact unconfirmed teammate and only unlocks edits after a host rejection', async () => {
+ await renderCreate();
+ await act(async () => h.create.onChange({ ...h.create.values, name: 'Nova' }));
+ h.invoke.mockRejectedValueOnce(new Error('TIMEOUT'));
+ await act(async () => h.create.onSubmit());
+ // The host may already hold Nova under this request: an edit now would be silently dropped.
+ expect(h.create.locked).toBe(true);
+ await act(async () => h.create.onChange({ ...h.create.values, name: 'Nova 2' }));
+ expect(h.create.values.name).toBe('Nova');
+ h.invoke.mockRejectedValueOnce(new Error('[INVALID_PARAMS] Invalid teammate editor input'));
+ await act(async () => h.create.onSubmit());
+ expect(h.invoke.mock.calls[1][2].input).toEqual(h.invoke.mock.calls[0][2].input);
+ // A rejection proves nothing was created; the user can correct the form.
+ expect(h.create.locked).toBe(false);
+ await act(async () => h.create.onChange({ ...h.create.values, name: 'Nova 2' }));
+ expect(h.create.values.name).toBe('Nova 2');
+});
+
+it('blocks a duplicate name before submitting and keeps the form after a failed attempt', async () => {
+ const cache = await import('@/device-link/remoteResourceAvailability');
+ cache.readRemoteCollectionCache(':1', 'teammates');
+ cache.writeRemoteCollectionCache(':1', 'teammates', [{ key: 'k', host: { deviceId: 'host', deviceName: 'Mac' },
+ item: { ref: { collectionId: 'teammates', kind: 'bot', id: 'aster' }, revision: '1', links: [], display: { title: 'Aster' } } } as any]);
+ await renderCreate();
+ await act(async () => h.create.onChange({ ...h.create.values, name: ' aster ' }));
+ expect(h.create.duplicate).toBe(true);
+ await act(async () => h.create.onSubmit());
+ expect(h.invoke).not.toHaveBeenCalled();
+ await act(async () => h.create.onChange({ ...h.create.values, name: 'Nova' }));
+ expect(h.create.duplicate).toBe(false);
+ h.invoke.mockRejectedValueOnce(new Error('[ALREADY_EXISTS] hidden teammate'));
+ await act(async () => h.create.onSubmit());
+ // The host can still reject names this list does not show; the form stays for a new name.
+ expect(h.create.nameTaken).toBe(true); expect(h.create.error).toBe(true);
+ expect(h.create.panel).toBeDefined(); expect(h.create.values.name).toBe('Nova');
+ cache.writeRemoteCollectionCache(':1', 'teammates', []);
+});
diff --git a/apps/mobile/src/__tests__/companionProfileData.test.ts b/apps/mobile/src/__tests__/companionProfileData.test.ts
index 2c78326bee..ab609573bd 100644
--- a/apps/mobile/src/__tests__/companionProfileData.test.ts
+++ b/apps/mobile/src/__tests__/companionProfileData.test.ts
@@ -43,7 +43,30 @@ describe('companion profile finite resource primitives', () => {
it('reads only through the generic get channel and negotiates form support', async () => {
const invoke = vi.fn(async () => raw());
await loadCompanionProfile(invoke as never, 'host-a', ref, 'en');
- expect(invoke).toHaveBeenCalledWith('host-a', 'maker:remote-resources:get', [{ client: { protocolVersion: 1, primitives: ['status', 'session-link', 'markdown', 'form', 'action', 'list'], locale: 'en' }, ref }]);
+ expect(invoke).toHaveBeenCalledWith('host-a', 'maker:remote-resources:get', [{ client: { protocolVersion: 1, primitives: ['status', 'session-link', 'markdown', 'form', 'action', 'list', 'search'], locale: 'en' }, ref }]);
+ });
+ it('sends a search query only when one is typed', async () => {
+ const invoke = vi.fn(async () => raw());
+ await loadCompanionProfile(invoke as never, 'host-a', ref, 'en', { query: ' ' });
+ expect((invoke.mock.calls[0] as unknown[])[2]).toEqual([expect.not.objectContaining({ query: expect.anything() })]);
+ await loadCompanionProfile(invoke as never, 'host-a', ref, 'en', { query: ' 咖啡 ' });
+ expect((invoke.mock.calls[1] as unknown[])[2]).toEqual([expect.objectContaining({ query: '咖啡' })]);
+ });
+ it('keeps additive list metadata and the search block while ignoring malformed extras', () => {
+ const list = { ...raw(), actions: [], blocks: [
+ { id: 'search', primitive: 'search', fallbackMarkdown: '', data: { query: '咖啡', placeholder: { fallback: 'Search memories' } } },
+ { id: 'memory-user', primitive: 'list', title: 'About you', fallbackMarkdown: '- Coffee', data: { count: 3, entries: [
+ { id: 'user_coffee', title: 'Coffee', resourceId: 'settings:bot-a/memory/user_coffee', subtitle: 'Black, no sugar', timestamp: 1_000 },
+ { id: 'user_tea', title: 'Tea', resourceId: 'settings:bot-a/memory/user_tea', subtitle: 42, timestamp: 'yesterday' },
+ ] } },
+ ] };
+ const [search, group] = parseCompanionProfileData(list, ref).panels;
+ expect(search).toMatchObject({ primitive: 'search', query: '咖啡', placeholder: { fallback: 'Search memories' } });
+ expect(group).toMatchObject({ primitive: 'list', count: 3, title: 'About you' });
+ expect(group.entries).toEqual([
+ { id: 'user_coffee', title: 'Coffee', resourceId: 'settings:bot-a/memory/user_coffee', subtitle: 'Black, no sugar', timestamp: 1_000 },
+ { id: 'user_tea', title: 'Tea', resourceId: 'settings:bot-a/memory/user_tea' },
+ ]);
});
});
it('preserves a host-disabled action rather than silently enabling it', () => {
diff --git a/apps/mobile/src/i18n/locales/en/devices.json b/apps/mobile/src/i18n/locales/en/devices.json
index 087fad2f59..3e6ce99565 100644
--- a/apps/mobile/src/i18n/locales/en/devices.json
+++ b/apps/mobile/src/i18n/locales/en/devices.json
@@ -995,7 +995,25 @@
"searchOptions": "Search",
"changed": "Changed elsewhere. Your unsaved edits are retained.",
"discardAndReload": "Discard edits and reload",
- "notes": "Memory Notes",
+ "memoryEntries": "Saved Memories",
+ "memorySearch": "Search memories",
+ "memoryEmpty": "No memories yet",
+ "memoryNoResults": "No matching memories",
+ "memoryDisabled": "Memory is off. Your teammate won’t read or save memories; saved ones can still be viewed and deleted.",
+ "memoryLoadFailed": "Memories couldn’t be loaded",
+ "memoryToday": "Today",
+ "memoryUpdated": "Updated {{time}}",
+ "memoryEdit": "Edit",
+ "memoryDone": "Done",
+ "memoryTooLong": "Too long. Shorten it to save.",
+ "memoryRequired": "A title and content are required.",
+ "memoryChanged": "{{name}} just updated this memory",
+ "memoryUseLatest": "Use latest",
+ "memoryKeepMine": "Keep my changes",
+ "memorySaved": "Saved",
+ "memorySaveFailed": "Not saved. Your edits are retained.",
+ "memoryMissing": "This memory no longer exists.",
+ "memoryDeleteFailed": "The memory couldn’t be deleted",
"create": "New Teammate",
"createFailed": "Creation is not confirmed yet. Retry to check.",
"title": "Teammate",
@@ -1030,6 +1048,7 @@
"addModel": "Add fallback model",
"removeModel": "Remove model",
"moveModelUp": "Move model up",
+ "backupModels": "Backup models ({{count}})",
"settingsTitle": "Teammate settings",
"name": "Name",
"portraitNumber": "Portrait {{number}}",
diff --git a/apps/mobile/src/i18n/locales/ja/devices.json b/apps/mobile/src/i18n/locales/ja/devices.json
index 7d1c736f51..97eed25ad8 100644
--- a/apps/mobile/src/i18n/locales/ja/devices.json
+++ b/apps/mobile/src/i18n/locales/ja/devices.json
@@ -995,7 +995,25 @@
"searchOptions": "検索",
"changed": "別の場所で変更されました。未保存の編集は保持されています。",
"discardAndReload": "編集を破棄して再読み込み",
- "notes": "記憶ノート",
+ "memoryEntries": "保存した記憶",
+ "memorySearch": "記憶を検索",
+ "memoryEmpty": "まだ記憶はありません",
+ "memoryNoResults": "一致する記憶はありません",
+ "memoryDisabled": "記憶はオフです。チームメイトは記憶を読み取ったり保存したりしません。保存済みの記憶は引き続き表示・削除できます。",
+ "memoryLoadFailed": "記憶を読み込めませんでした",
+ "memoryToday": "今日",
+ "memoryUpdated": "{{time}} に更新",
+ "memoryEdit": "編集",
+ "memoryDone": "完了",
+ "memoryTooLong": "長すぎます。短くすると保存されます",
+ "memoryRequired": "タイトルと内容は必須です。",
+ "memoryChanged": "{{name}}がこの記憶を更新しました",
+ "memoryUseLatest": "最新の内容を使う",
+ "memoryKeepMine": "自分の変更を残す",
+ "memorySaved": "保存しました",
+ "memorySaveFailed": "保存できませんでした。編集内容は保持されています。",
+ "memoryMissing": "この記憶はもう存在しません。",
+ "memoryDeleteFailed": "削除できませんでした",
"create": "新しいチームメイト",
"createFailed": "作成結果を確認できていません。再試行して確認してください。",
"title": "チームメイト",
@@ -1030,6 +1048,7 @@
"addModel": "予備モデルを追加",
"removeModel": "モデルを削除",
"moveModelUp": "モデルを上へ",
+ "backupModels": "予備のモデル({{count}})",
"settingsTitle": "チームメイトの設定",
"name": "名前",
"portraitNumber": "アバター {{number}}",
diff --git a/apps/mobile/src/i18n/locales/ko/devices.json b/apps/mobile/src/i18n/locales/ko/devices.json
index 6028570762..60c88e9ac9 100644
--- a/apps/mobile/src/i18n/locales/ko/devices.json
+++ b/apps/mobile/src/i18n/locales/ko/devices.json
@@ -995,7 +995,25 @@
"searchOptions": "검색",
"changed": "다른 곳에서 변경되었습니다. 저장하지 않은 편집 내용은 유지됩니다.",
"discardAndReload": "편집 취소 후 다시 불러오기",
- "notes": "기억 노트",
+ "memoryEntries": "저장된 기억",
+ "memorySearch": "기억 검색",
+ "memoryEmpty": "아직 기억이 없습니다",
+ "memoryNoResults": "일치하는 기억이 없습니다",
+ "memoryDisabled": "기억이 꺼져 있어 팀원이 기억을 읽거나 저장하지 않습니다. 저장된 기억은 계속 보고 삭제할 수 있습니다.",
+ "memoryLoadFailed": "기억을 불러오지 못했습니다",
+ "memoryToday": "오늘",
+ "memoryUpdated": "{{time}} 업데이트",
+ "memoryEdit": "편집",
+ "memoryDone": "완료",
+ "memoryTooLong": "너무 깁니다. 줄이면 저장됩니다",
+ "memoryRequired": "제목과 내용을 입력해야 합니다.",
+ "memoryChanged": "{{name}}이(가) 방금 이 기억을 업데이트했습니다",
+ "memoryUseLatest": "최신 내용 사용",
+ "memoryKeepMine": "내 변경 유지",
+ "memorySaved": "저장됨",
+ "memorySaveFailed": "저장하지 못했습니다. 편집 내용은 유지됩니다.",
+ "memoryMissing": "이 기억은 더 이상 없습니다.",
+ "memoryDeleteFailed": "삭제하지 못했습니다",
"create": "새 팀원",
"createFailed": "생성 결과를 아직 확인하지 못했습니다. 다시 시도해 확인하세요.",
"title": "팀원",
@@ -1030,6 +1048,7 @@
"addModel": "대체 모델 추가",
"removeModel": "모델 제거",
"moveModelUp": "모델 위로 이동",
+ "backupModels": "예비 모델 ({{count}})",
"settingsTitle": "팀원 설정",
"name": "이름",
"portraitNumber": "아바타 {{number}}",
diff --git a/apps/mobile/src/i18n/locales/zh-CN/devices.json b/apps/mobile/src/i18n/locales/zh-CN/devices.json
index 7ccca1853c..9a039435c1 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/devices.json
+++ b/apps/mobile/src/i18n/locales/zh-CN/devices.json
@@ -995,7 +995,25 @@
"searchOptions": "搜索",
"changed": "内容已在别处更改,你未保存的编辑已保留。",
"discardAndReload": "放弃编辑并重新加载",
- "notes": "记忆笔记",
+ "memoryEntries": "已存记忆",
+ "memorySearch": "搜索记忆",
+ "memoryEmpty": "还没有记忆",
+ "memoryNoResults": "没有找到相关记忆",
+ "memoryDisabled": "记忆已关闭,伙伴不会读取或保存记忆;已存记忆仍可查看和删除。",
+ "memoryLoadFailed": "记忆读取失败",
+ "memoryToday": "今天",
+ "memoryUpdated": "{{time}} 更新",
+ "memoryEdit": "编辑",
+ "memoryDone": "完成",
+ "memoryTooLong": "内容太长,缩短后才会保存",
+ "memoryRequired": "标题和内容都不能为空。",
+ "memoryChanged": "{{name}}刚更新了这条记忆",
+ "memoryUseLatest": "用最新内容",
+ "memoryKeepMine": "保留我的修改",
+ "memorySaved": "已保存",
+ "memorySaveFailed": "没有保存成功,你的编辑已保留。",
+ "memoryMissing": "这条记忆已不存在。",
+ "memoryDeleteFailed": "删除失败",
"create": "新伙伴",
"createFailed": "暂未确认创建结果,请重试核对。",
"title": "伙伴资料",
@@ -1030,6 +1048,7 @@
"addModel": "添加备用模型",
"removeModel": "移除模型",
"moveModelUp": "上移模型",
+ "backupModels": "备用模型({{count}})",
"settingsTitle": "伙伴设置",
"name": "名字",
"portraitNumber": "头像 {{number}}",
diff --git a/apps/mobile/src/i18n/locales/zh-TW/devices.json b/apps/mobile/src/i18n/locales/zh-TW/devices.json
index 6c13215ebf..3d24944224 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/devices.json
+++ b/apps/mobile/src/i18n/locales/zh-TW/devices.json
@@ -995,7 +995,25 @@
"searchOptions": "搜尋",
"changed": "內容已在別處變更,你未儲存的編輯已保留。",
"discardAndReload": "放棄編輯並重新載入",
- "notes": "記憶筆記",
+ "memoryEntries": "已存記憶",
+ "memorySearch": "搜尋記憶",
+ "memoryEmpty": "還沒有記憶",
+ "memoryNoResults": "找不到相關記憶",
+ "memoryDisabled": "記憶已關閉,夥伴不會讀取或儲存記憶;已存記憶仍可查看和刪除。",
+ "memoryLoadFailed": "無法讀取記憶",
+ "memoryToday": "今天",
+ "memoryUpdated": "{{time}} 更新",
+ "memoryEdit": "編輯",
+ "memoryDone": "完成",
+ "memoryTooLong": "內容太長,縮短後才會儲存",
+ "memoryRequired": "標題和內容都不能為空。",
+ "memoryChanged": "{{name}}剛更新了這條記憶",
+ "memoryUseLatest": "使用最新內容",
+ "memoryKeepMine": "保留我的修改",
+ "memorySaved": "已儲存",
+ "memorySaveFailed": "沒有儲存成功,你的編輯已保留。",
+ "memoryMissing": "這條記憶已不存在。",
+ "memoryDeleteFailed": "刪除失敗",
"create": "新夥伴",
"createFailed": "尚未確認建立結果,請重試核對。",
"title": "夥伴資料",
@@ -1030,6 +1048,7 @@
"addModel": "新增備用模型",
"removeModel": "移除模型",
"moveModelUp": "上移模型",
+ "backupModels": "備用模型({{count}})",
"settingsTitle": "夥伴設定",
"name": "名字",
"portraitNumber": "頭像 {{number}}",
diff --git a/apps/mobile/src/session/CompanionCreateNativeView.ios.tsx b/apps/mobile/src/session/CompanionCreateNativeView.ios.tsx
index ab1ded435f..6a820dffa6 100644
--- a/apps/mobile/src/session/CompanionCreateNativeView.ios.tsx
+++ b/apps/mobile/src/session/CompanionCreateNativeView.ios.tsx
@@ -16,14 +16,14 @@ export function CompanionCreateNativeView(p: CompanionCreateNativeViewProps) {
useEffect(() => { if (state.get() !== name) state.set(name); }, [name, state]);
const tr = (key: string) => t(`devices.companionProfile.${key}`, { deviceName: p.deviceName });
return <ComposerSheet visible={p.visible} onClose={p.onClose} onClosed={p.onClosed} title={tr('create')} nativeContent preventDismiss={p.dirty || p.busy}>
- {!p.online || p.error ? <Section><Text modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(colors.textSecondary)]}>{tr(!p.online ? 'offline' : p.nameTaken ? 'nameTaken' : 'createFailed')}</Text></Section> : null}
+ {!p.online || p.error || p.duplicate ? <Section><Text modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(colors.textSecondary)]}>{tr(!p.online ? 'offline' : p.duplicate || p.nameTaken ? 'nameTaken' : 'createFailed')}</Text></Section> : null}
{p.loading ? <Section><ProgressView /></Section> : null}
{p.panel ? <>
- <Section title={tr('name')}><TextField text={state} onTextChange={name => p.onChange({ ...p.values, name })} maxLength={200} testID="companionCreate.name" modifiers={[accessibilityLabel(tr('name')), disabled(p.busy || !p.online)]} /></Section>
- <Section title={tr('avatar')}><CompanionNativeContent><CompanionPortraitPicker value={String(p.values.avatarImageBase64 ?? '')} onChange={avatarImageBase64 => p.onChange({ ...p.values, avatarImageBase64 })} disabled={p.busy || !p.online} /></CompanionNativeContent></Section>
+ <Section title={tr('name')}><TextField text={state} onTextChange={name => p.onChange({ ...p.values, name })} maxLength={200} testID="companionCreate.name" modifiers={[accessibilityLabel(tr('name')), disabled(p.busy || !p.online || !!p.locked)]} /></Section>
+ <Section title={tr('avatar')}><CompanionNativeContent><CompanionPortraitPicker value={String(p.values.avatarImageBase64 ?? '')} onChange={avatarImageBase64 => p.onChange({ ...p.values, avatarImageBase64 })} disabled={p.busy || !p.online || !!p.locked} /></CompanionNativeContent></Section>
</> : null}
<Section>{!p.panel && !p.loading && p.online ? <Button onPress={p.onRetry} modifiers={[buttonStyle('plain'), disabled(p.busy), frame({ minHeight: 44 })]}><HStack modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}><Text>{t('devices.resources.retry')}</Text><Spacer /></HStack></Button> : null}
- <Button onPress={p.onSubmit} testID="companionCreate.submit" modifiers={[buttonStyle('plain'), frame({ minHeight: 44 }), disabled(p.busy || !p.online || !p.panel?.action || p.panel.action.disabled || !name.trim() || !p.values.avatarImageBase64)]}><HStack modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}><Text>{tr('create')}</Text><Spacer /></HStack></Button>
+ <Button onPress={p.onSubmit} testID="companionCreate.submit" modifiers={[buttonStyle('plain'), frame({ minHeight: 44 }), disabled(p.busy || !p.online || !p.panel?.action || p.panel.action.disabled || !name.trim() || !p.values.avatarImageBase64 || !!p.duplicate)]}><HStack modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}><Text>{tr('create')}</Text><Spacer /></HStack></Button>
<Button onPress={p.onClose} modifiers={[buttonStyle('plain'), frame({ minHeight: 44 }), disabled(p.busy)]}><HStack modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}><Text>{t('devices.common.cancel')}</Text><Spacer /></HStack></Button>
</Section>
</ComposerSheet>;
diff --git a/apps/mobile/src/session/CompanionCreateNativeView.tsx b/apps/mobile/src/session/CompanionCreateNativeView.tsx
index 94a2bb4f15..9a7df50c80 100644
--- a/apps/mobile/src/session/CompanionCreateNativeView.tsx
+++ b/apps/mobile/src/session/CompanionCreateNativeView.tsx
@@ -3,5 +3,9 @@ export interface CompanionCreateNativeViewProps {
deviceName: string; nameTaken: boolean; visible: boolean; onClose(): void; onClosed?(): void; panel?: ProfilePanel;
values: ProfileValues; onChange(values: ProfileValues): void; onSubmit(): void; onRetry(): void;
online: boolean; busy: boolean; loading: boolean; error: boolean; dirty: boolean;
+ /** The typed name already belongs to a teammate on this computer (NFKC, case-insensitive). */
+ duplicate?: boolean;
+ /** The last create is unconfirmed; the retry resends exactly what was sent. */
+ locked?: boolean;
}
export function CompanionCreateNativeView(_props: CompanionCreateNativeViewProps) { return null; }
diff --git a/apps/mobile/src/session/CompanionMemoryPage.ios.tsx b/apps/mobile/src/session/CompanionMemoryPage.ios.tsx
new file mode 100644
index 0000000000..eaa3a9d590
--- /dev/null
+++ b/apps/mobile/src/session/CompanionMemoryPage.ios.tsx
@@ -0,0 +1,116 @@
+import { Fragment, useEffect } from 'react';
+import { Button, HStack, Image, ProgressView, Spacer, Text, TextField, VStack, useNativeState } from '@expo/ui/swift-ui';
+import { accessibilityLabel, autocorrectionDisabled, buttonStyle, contentShape, disabled, font, foregroundStyle, frame, lineLimit, listRowInsets, shapes, textInputAutocapitalization, textSelection } from '@expo/ui/swift-ui/modifiers';
+import { useTranslation } from 'react-i18next';
+import { resolveRemoteText } from '@cindy/device-link';
+import { iconSize, spacing, useTheme } from '@/theme';
+import { ComposerNativeSection as Section } from './ComposerNativeSection';
+import type { CompanionMemoryPageProps } from './CompanionMemoryPage';
+import { COMPANION_MEMORY_TITLE_MAX, companionMemoryDate, companionMemoryFieldLabel } from './useCompanionMemory';
+
+/** Native owns the text while typing; a replaced draft remounts it through `draftGeneration`. */
+function Field({ label, value, onChange, busy, multiline = false }: { label: string; value: string; onChange(value: string): void; busy: boolean; multiline?: boolean }) {
+ const text = useNativeState(value);
+ return <TextField text={text} onTextChange={onChange} axis={multiline ? 'vertical' : 'horizontal'} maxLength={multiline ? undefined : COMPANION_MEMORY_TITLE_MAX}
+ testID={`companionMemory.field.${multiline ? 'body' : 'title'}`}
+ modifiers={[accessibilityLabel(label), disabled(busy), ...(multiline ? [lineLimit({ min: 6, max: 16 })] : [])]} />;
+}
+
+function SearchField({ query, placeholder, label, clearLabel, onChange }: { query: string; placeholder: string; label: string; clearLabel: string; onChange(value: string): void }) {
+ const text = useNativeState(query);
+ useEffect(() => { if (text.get() !== query) text.set(query); }, [query, text]);
+ return <HStack>
+ <Image size={iconSize.lg} systemName="magnifyingglass" />
+ <TextField text={text} onTextChange={onChange} placeholder={placeholder} testID="companionMemory.search"
+ modifiers={[accessibilityLabel(label), autocorrectionDisabled(), textInputAutocapitalization('never'), frame({ maxWidth: Infinity })]} />
+ {query ? <Button onPress={() => { text.set(''); onChange(''); }} modifiers={[buttonStyle('plain'), accessibilityLabel(clearLabel)]}>
+ <Image size={iconSize.lg} systemName="xmark.circle.fill" modifiers={[frame({ width: 44, height: 44 }), contentShape(shapes.rectangle())]} />
+ </Button> : null}
+ </HStack>;
+}
+
+/** SwiftUI rendering of the saved-memories page inside the teammate settings Form. */
+export function CompanionMemoryPage({ memory: m, online, botName, memoryEnabled }: CompanionMemoryPageProps) {
+ const { t, i18n } = useTranslation();
+ const { colors } = useTheme();
+ const tr = (key: string, values?: Record<string, string>) => t(`devices.companionProfile.${key}`, values);
+ const date = (timestamp: number | undefined, withTime = false) => companionMemoryDate(timestamp, i18n.language, tr('memoryToday'), withTime);
+ const note = (text: string, error = false) => <Section><Text modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(error ? colors.errorText : colors.textSecondary), textSelection(error)]}>{text}</Text></Section>;
+ const action = (label: string, onPress: () => void, blocked = false, destructive = false, testID?: string) => <Button onPress={onPress} testID={testID}
+ modifiers={[buttonStyle('plain'), listRowInsets({ top: 4, bottom: 4, leading: 16, trailing: 16 }), disabled(blocked), frame({ minHeight: 44 }), ...(destructive ? [foregroundStyle(colors.destructive)] : [])]}>
+ <HStack modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}><Text>{label}</Text><Spacer /></HStack>
+ </Button>;
+ const receipt = m.receipt ? note(m.receipt) : null;
+
+ if (m.view === 'list') {
+ const showSearch = !!m.searchPanel && (m.groups.length > 0 || !!m.query);
+ return <>
+ {!memoryEnabled ? note(tr('memoryDisabled')) : null}
+ {receipt}
+ {showSearch ? <Section><SearchField query={m.query} onChange={m.setQuery} label={tr('memorySearch')} clearLabel={t('devices.detail.search.clearA11y')}
+ placeholder={m.searchPanel?.placeholder ? resolveRemoteText(m.searchPanel.placeholder, i18n.language) : tr('memorySearch')} /></Section> : null}
+ {m.listFailed ? <>{note(tr('memoryLoadFailed'), true)}<Section>{action(t('devices.resources.retry'), m.retry, !online)}</Section></>
+ : !m.listLoaded ? (online ? <Section><ProgressView /></Section> : null)
+ : m.groups.length ? m.groups.map(group => <Section key={group.id} title={`${group.title} ${group.count}`}>
+ {group.entries.map(entry => <Button key={entry.resourceId} onPress={() => m.open(entry.resourceId)} testID={`companionMemory.${entry.id}`}
+ modifiers={[buttonStyle('plain'), accessibilityLabel(entry.title)]}>
+ <HStack alignment="top" spacing={spacing.md} modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}>
+ <VStack alignment="leading" spacing={spacing.xs}>
+ <Text modifiers={[lineLimit(2), foregroundStyle(memoryEnabled ? colors.textPrimary : colors.textSecondary)]}>{entry.title}</Text>
+ {entry.preview ? <Text modifiers={[font({ textStyle: 'caption' }), foregroundStyle(colors.textSecondary), lineLimit(2)]}>{entry.preview}</Text> : null}
+ </VStack>
+ <Spacer />
+ <Text modifiers={[font({ textStyle: 'caption2' }), foregroundStyle(colors.textTertiary)]}>{date(entry.timestamp)}</Text>
+ </HStack>
+ </Button>)}
+ </Section>)
+ : note(tr(m.query.trim() ? 'memoryNoResults' : 'memoryEmpty'))}
+ </>;
+ }
+
+ if (m.view === 'detail') {
+ const detail = m.detail;
+ return <>
+ {receipt}
+ {m.changed ? note(tr('memoryChanged', { name: botName }), true) : null}
+ {m.missing ? note(tr('memoryMissing'), true)
+ : m.detailFailed ? <>{note(tr('memoryLoadFailed'), true)}<Section>{action(t('devices.resources.retry'), m.retry, !online)}</Section></>
+ : !detail ? <Section><ProgressView /></Section>
+ : <>
+ <Section><VStack alignment="leading" spacing={spacing.sm} modifiers={[frame({ maxWidth: Infinity, alignment: 'leading' })]}>
+ <Text modifiers={[font({ textStyle: 'headline' }), textSelection(true)]}>{detail.title}</Text>
+ <Text modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(colors.textSecondary)]}>
+ {[detail.kind, detail.timestamp !== undefined ? tr('memoryUpdated', { time: date(detail.timestamp, true) }) : ''].filter(Boolean).join(' · ')}
+ </Text>
+ </VStack></Section>
+ <Section><Text modifiers={[textSelection(true)]}>{detail.body}</Text></Section>
+ {m.deleteFailed ? note(tr('memoryDeleteFailed'), true) : null}
+ <Section>
+ {detail.form?.action ? action(tr('memoryEdit'), m.edit, m.busy || !online || !!detail.form.action.disabled, false, 'companionMemory.edit') : null}
+ {detail.remove?.action ? action(resolveRemoteText(detail.remove.action.label, i18n.language), m.remove, m.busy || !online || !!detail.remove.action.disabled, true, 'companionMemory.delete') : null}
+ </Section>
+ </>}
+ </>;
+ }
+
+ const blocked = m.busy || !online || m.saveState === 'conflict';
+ const titleLabel = companionMemoryFieldLabel(m.detail, 'title', i18n.language);
+ const bodyLabel = companionMemoryFieldLabel(m.detail, 'body', i18n.language);
+ return <>
+ {m.missing ? note(tr('memoryMissing'), true) : null}
+ {m.saveState === 'conflict' ? <Section title={tr('memoryChanged', { name: botName })}>
+ {m.latest ? <Text modifiers={[font({ textStyle: 'footnote' }), foregroundStyle(colors.textSecondary), lineLimit(8), textSelection(true)]}>{m.latest.body}</Text> : null}
+ {action(tr('memoryUseLatest'), m.useLatest, m.busy, false, 'companionMemory.useLatest')}
+ {action(tr('memoryKeepMine'), m.keepMine, m.busy || !online, false, 'companionMemory.keepMine')}
+ </Section> : null}
+ <Fragment key={m.draftGeneration}>
+ <Section title={titleLabel}><Field label={titleLabel} value={m.draft.title} onChange={title => m.change({ title })} busy={blocked} /></Section>
+ <Section title={bodyLabel}><Field label={bodyLabel} value={m.draft.body} onChange={body => m.change({ body })} busy={blocked} multiline /></Section>
+ </Fragment>
+ {m.tooLong ? note(tr('memoryTooLong'), true) : m.titleMissing || m.bodyMissing ? note(tr('memoryRequired')) : null}
+ {m.saveState === 'saving' ? <Section><ProgressView /></Section>
+ : m.saveState === 'saved' ? note(m.receipt ?? tr('memorySaved'))
+ : m.saveState === 'error' ? note(tr('memorySaveFailed'), true) : null}
+ <Section>{action(tr('memoryDone'), () => { void m.done(); }, !online || m.busy || m.saveState === 'conflict' || m.dirty && (m.titleMissing || m.bodyMissing || m.tooLong), false, 'companionMemory.done')}</Section>
+ </>;
+}
diff --git a/apps/mobile/src/session/CompanionMemoryPage.tsx b/apps/mobile/src/session/CompanionMemoryPage.tsx
new file mode 100644
index 0000000000..aed6f4ec5f
--- /dev/null
+++ b/apps/mobile/src/session/CompanionMemoryPage.tsx
@@ -0,0 +1,131 @@
+import { Pressable, StyleSheet, View } from 'react-native';
+import { useTranslation } from 'react-i18next';
+import { resolveRemoteText } from '@cindy/device-link';
+import { Text, TextInput } from '@/components/AppText';
+import { MainWindowActionButton } from '@/components/MobilePrimitives';
+import { fontWeight, lineHeight, radius, spacing, typeScale, useTheme, useThemedStyles, type ThemeColors } from '@/theme';
+import { COMPANION_MEMORY_TITLE_MAX, companionMemoryDate, companionMemoryFieldLabel, type CompanionMemoryState } from './useCompanionMemory';
+
+export interface CompanionMemoryPageProps {
+ memory: CompanionMemoryState;
+ online: boolean;
+ botName: string;
+ memoryEnabled: boolean;
+}
+
+/** Android / default rendering of the saved-memories page; state lives in `useCompanionMemory`. */
+export function CompanionMemoryPage({ memory: m, online, botName, memoryEnabled }: CompanionMemoryPageProps) {
+ const { t, i18n } = useTranslation();
+ const styles = useThemedStyles(makeStyles);
+ const { colors } = useTheme();
+ const tr = (key: string, values?: Record<string, string>) => t(`devices.companionProfile.${key}`, values);
+ // Same as iOS: failures and conflicts read in the error colour; neutral states stay secondary.
+ const note = (text: string, alert = false, error = alert) => <Text selectable accessibilityRole={alert ? 'alert' : undefined} style={[styles.note, error && styles.error]}>{text}</Text>;
+ const date = (timestamp: number | undefined, withTime = false) => companionMemoryDate(timestamp, i18n.language, tr('memoryToday'), withTime);
+ const receipt = m.receipt ? <Text accessibilityLiveRegion="polite" style={styles.note}>{m.receipt}</Text> : null;
+
+ if (m.view === 'list') {
+ const showSearch = !!m.searchPanel && (m.groups.length > 0 || !!m.query);
+ return <View style={styles.content}>
+ {!memoryEnabled ? note(tr('memoryDisabled')) : null}
+ {receipt}
+ {showSearch ? <TextInput accessibilityLabel={tr('memorySearch')} value={m.query} onChangeText={m.setQuery} autoCorrect={false}
+ placeholder={m.searchPanel?.placeholder ? resolveRemoteText(m.searchPanel.placeholder, i18n.language) : tr('memorySearch')}
+ placeholderTextColor={colors.textTertiary} maxLength={200} returnKeyType="search" style={styles.input} /> : null}
+ {m.listFailed ? <View accessibilityRole="alert" style={styles.stack}>{note(tr('memoryLoadFailed'), false, true)}
+ <MainWindowActionButton action={{ label: t('devices.resources.retry'), disabled: !online, onPress: m.retry }} /></View>
+ : !m.listLoaded ? (online ? note(t('devices.resources.loading')) : null)
+ : m.groups.length ? m.groups.map(group => <View key={group.id} style={styles.stack} accessibilityLabel={group.title}>
+ <Text accessibilityRole="header" style={styles.groupTitle}>{group.title}<Text style={styles.count}>{` ${group.count}`}</Text></Text>
+ <View style={[styles.group, !memoryEnabled && styles.dimmed]}>{group.entries.map((entry, index) =>
+ <Pressable key={entry.resourceId} accessibilityRole="button" accessibilityLabel={entry.title} onPress={() => m.open(entry.resourceId)}
+ style={({ pressed }) => [styles.row, index > 0 && styles.separator, pressed && styles.pressed]} testID={`companionMemory.${entry.id}`}>
+ <View style={styles.rowHeader}>
+ <Text numberOfLines={2} style={styles.rowTitle}>{entry.title}</Text>
+ <Text style={styles.date}>{date(entry.timestamp)}</Text>
+ </View>
+ {entry.preview ? <Text numberOfLines={2} style={styles.preview}>{entry.preview}</Text> : null}
+ </Pressable>)}
+ </View>
+ </View>)
+ : note(tr(m.query.trim() ? 'memoryNoResults' : 'memoryEmpty'))}
+ </View>;
+ }
+
+ if (m.view === 'detail') {
+ const detail = m.detail;
+ return <View style={styles.content}>
+ {receipt}
+ {m.changed ? note(tr('memoryChanged', { name: botName }), true) : null}
+ {m.missing ? note(tr('memoryMissing'), true)
+ : m.detailFailed ? <View accessibilityRole="alert" style={styles.stack}>{note(tr('memoryLoadFailed'), false, true)}
+ <MainWindowActionButton action={{ label: t('devices.resources.retry'), disabled: !online, onPress: m.retry }} /></View>
+ : !detail ? note(t('devices.resources.loading'))
+ : <>
+ <View style={styles.stack}>
+ <Text selectable accessibilityRole="header" style={styles.title}>{detail.title}</Text>
+ <Text style={styles.note}>{[detail.kind, detail.timestamp !== undefined ? tr('memoryUpdated', { time: date(detail.timestamp, true) }) : ''].filter(Boolean).join(' · ')}</Text>
+ </View>
+ <Text selectable style={styles.body}>{detail.body}</Text>
+ {m.deleteFailed ? note(tr('memoryDeleteFailed'), true) : null}
+ <View style={styles.stack}>
+ {detail.form?.action ? <MainWindowActionButton action={{ label: tr('memoryEdit'), disabled: m.busy || !online || detail.form.action.disabled, onPress: m.edit }} /> : null}
+ {detail.remove?.action ? <MainWindowActionButton action={{ label: resolveRemoteText(detail.remove.action.label, i18n.language), tone: 'danger', busy: m.busy, disabled: !online || detail.remove.action.disabled, onPress: m.remove }} /> : null}
+ </View>
+ </>}
+ </View>;
+ }
+
+ const editable = !m.busy && online && m.saveState !== 'conflict';
+ return <View style={styles.content}>
+ {m.missing ? note(tr('memoryMissing'), true) : null}
+ {m.saveState === 'conflict' ? <View accessibilityRole="alert" style={[styles.group, styles.notice]}>
+ <Text style={styles.heading}>{tr('memoryChanged', { name: botName })}</Text>
+ {m.latest ? <Text selectable numberOfLines={8} style={styles.preview}>{m.latest.body}</Text> : null}
+ <MainWindowActionButton action={{ label: tr('memoryUseLatest'), disabled: m.busy, onPress: m.useLatest }} />
+ <MainWindowActionButton action={{ label: tr('memoryKeepMine'), disabled: m.busy || !online, onPress: m.keepMine }} />
+ </View> : null}
+ <View style={styles.field}>
+ <Text style={styles.heading}>{companionMemoryFieldLabel(m.detail, 'title', i18n.language)}</Text>
+ <TextInput accessibilityLabel={companionMemoryFieldLabel(m.detail, 'title', i18n.language)} value={m.draft.title} editable={editable}
+ maxLength={COMPANION_MEMORY_TITLE_MAX} onChangeText={title => m.change({ title })} placeholderTextColor={colors.textTertiary} style={styles.input} />
+ </View>
+ <View style={styles.field}>
+ <Text style={styles.heading}>{companionMemoryFieldLabel(m.detail, 'body', i18n.language)}</Text>
+ <TextInput accessibilityLabel={companionMemoryFieldLabel(m.detail, 'body', i18n.language)} value={m.draft.body} editable={editable} multiline
+ onChangeText={body => m.change({ body })} placeholderTextColor={colors.textTertiary} style={[styles.input, styles.multiline]} />
+ </View>
+ {m.tooLong ? note(tr('memoryTooLong'), true) : m.titleMissing || m.bodyMissing ? note(tr('memoryRequired')) : null}
+ {m.saveState === 'saving' ? note(t('devices.resources.loading'))
+ : m.saveState === 'saved' ? <Text accessibilityLiveRegion="polite" style={styles.note}>{m.receipt ?? tr('memorySaved')}</Text>
+ : m.saveState === 'error' ? note(tr('memorySaveFailed'), true) : null}
+ <MainWindowActionButton action={{ label: tr('memoryDone'), tone: 'primary', busy: m.busy,
+ disabled: !online || m.saveState === 'conflict' || m.dirty && (m.titleMissing || m.bodyMissing || m.tooLong), onPress: () => { void m.done(); } }} />
+ </View>;
+}
+
+const makeStyles = (colors: ThemeColors) => StyleSheet.create({
+ // Rendered inside the settings sheet's padded content column.
+ content: { gap: spacing.lg },
+ stack: { gap: spacing.sm },
+ field: { gap: spacing.sm },
+ note: { fontSize: typeScale.footnote, lineHeight: lineHeight.caption, color: colors.textSecondary },
+ error: { color: colors.errorText },
+ heading: { fontSize: typeScale.body, color: colors.textPrimary, fontWeight: fontWeight.medium },
+ title: { fontSize: typeScale.subtitle, lineHeight: lineHeight.subtitle, color: colors.textPrimary, fontWeight: fontWeight.medium },
+ body: { fontSize: typeScale.body, lineHeight: lineHeight.bodyRelaxed, color: colors.textPrimary },
+ groupTitle: { fontSize: typeScale.footnote, color: colors.textSecondary, fontWeight: fontWeight.medium, paddingHorizontal: spacing.xs },
+ count: { color: colors.textTertiary, fontWeight: fontWeight.regular },
+ group: { backgroundColor: colors.surfaceElevated, borderRadius: radius.container, overflow: 'hidden' },
+ dimmed: { opacity: 0.6 },
+ notice: { padding: spacing.lg, gap: spacing.sm },
+ row: { minHeight: 44, paddingHorizontal: spacing.lg, paddingVertical: spacing.md, gap: spacing.xs },
+ separator: { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: colors.border },
+ pressed: { opacity: 0.72 },
+ rowHeader: { flexDirection: 'row', alignItems: 'flex-start', gap: spacing.md },
+ rowTitle: { flex: 1, fontSize: typeScale.listBody, lineHeight: lineHeight.listBody, color: colors.textPrimary, fontWeight: fontWeight.medium },
+ date: { fontSize: typeScale.micro, lineHeight: lineHeight.listBody, color: colors.textTertiary },
+ preview: { fontSize: typeScale.caption, lineHeight: lineHeight.caption, color: colors.textSecondary },
+ input: { minHeight: 44, borderRadius: radius.pill, borderColor: colors.border, borderWidth: 1, padding: spacing.md, color: colors.textPrimary, backgroundColor: colors.surfaceElevated, fontSize: typeScale.body },
+ multiline: { minHeight: 180, borderRadius: radius.control, textAlignVertical: 'top' },
+});
diff --git a/apps/mobile/src/session/CompanionModelChain.tsx b/apps/mobile/src/session/CompanionModelChain.tsx
index 0538916348..2ac50bec91 100644
--- a/apps/mobile/src/session/CompanionModelChain.tsx
+++ b/apps/mobile/src/session/CompanionModelChain.tsx
@@ -2,8 +2,9 @@ import { findCatalogModel } from '@cindy/model-providers';
import { buildMobileModelSections } from './providerModelSections';
import { mobileProviderAccountTitle } from './mobileModelRowPresentation';
import { iconSize } from '@/theme';
+import { useState } from 'react';
import { Pressable, StyleSheet, Switch, View } from 'react-native';
-import { ChevronRight, MinusCircle, Plus, ArrowUp } from 'lucide-react-native';
+import { ChevronDown, ChevronRight, ChevronUp, MinusCircle, Plus, ArrowUp } from 'lucide-react-native';
import { useTranslation } from 'react-i18next';
import { Text } from '@/components/AppText';
import { useDeviceProviders } from '@/device-link/useDeviceProviders';
@@ -31,22 +32,35 @@ export function CompanionModelChain({ deviceId, values, onChange, onPick, disabl
const chain = readCompanionModelChain(values.modelChain);
const following = values.followsDefault === true;
const update = (chain: CompanionModelRoute[]) => onChange({ ...values, modelChain: JSON.stringify(chain) });
- return <View style={{ gap: spacing.sm }}>
- <View style={styles.row}><Text style={{ color: colors.textPrimary, flex: 1 }}>{t('devices.companionProfile.modelFollowsDefault')}</Text><Switch accessibilityLabel={t('devices.companionProfile.modelFollowsDefault')} value={following} disabled={disabled} onValueChange={value => onChange({ ...values, followsDefault: value })} /></View>
- {chain.map((route, index) => {
- const agent = route.harness === 'claude' ? 'claude-code' : route.harness;
- const providerId = route.providerId ?? buildMobileModelSections({ providers, agentKind: agent, selectedModelId: route.model, selectedProviderId: null, existingSessionRoute: true, visibilityOverrides: catalog.modelVisibilityOverrides }).activeSourceId;
- const provider = providers.find(item => item.id === providerId);
- const model = provider ? findCatalogModel(provider, route.model, agent) : undefined;
- const source = provider ? mobileProviderAccountTitle(provider) : route.providerId;
- return <View key={`${route.harness}:${route.providerId}:${route.model}`} style={styles.row}>
+ const [showBackups, setShowBackups] = useState(false);
+ const routeRow = (route: CompanionModelRoute, index: number) => {
+ const agent = route.harness === 'claude' ? 'claude-code' : route.harness;
+ const providerId = route.providerId ?? buildMobileModelSections({ providers, agentKind: agent, selectedModelId: route.model, selectedProviderId: null, existingSessionRoute: true, visibilityOverrides: catalog.modelVisibilityOverrides }).activeSourceId;
+ const provider = providers.find(item => item.id === providerId);
+ const model = provider ? findCatalogModel(provider, route.model, agent) : undefined;
+ const source = provider ? mobileProviderAccountTitle(provider) : route.providerId;
+ return <View key={`${route.harness}:${route.providerId}:${route.model}`} style={styles.row}>
<Pressable accessibilityRole="button" disabled={disabled || following} onPress={() => onPick(index)} style={[styles.row, { flex: 1 }]}>
<Text style={{ color: colors.textSecondary }}>{index + 1}</Text><View style={{ flex: 1 }}><Text style={{ color: colors.textPrimary, fontSize: typeScale.body }}>{model?.name ?? route.model}</Text><Text style={{ color: colors.textSecondary, fontSize: typeScale.footnote }}>{[source, route.harness === 'claude' ? 'Claude Code' : route.harness === 'codex' ? 'Codex' : 'Pi', route.effort ? t(`models.options.effortLevels.${route.effort}`, { defaultValue: route.effort }) : '', route.fastMode ? 'Fast' : ''].filter(Boolean).join(' · ')}</Text></View><ChevronRight size={iconSize.md} color={colors.textSecondary} />
</Pressable>
- {!following && index > 0 ? <Pressable accessibilityRole="button" accessibilityLabel={t('devices.companionProfile.moveModelUp')} disabled={disabled} style={styles.hit} onPress={() => { const next = [...chain]; [next[index - 1], next[index]] = [next[index], next[index - 1]]; update(next); }}><ArrowUp size={iconSize.lg} color={colors.textSecondary} /></Pressable> : null}
- {!following && chain.length > 1 ? <Pressable accessibilityRole="button" accessibilityLabel={t('devices.companionProfile.removeModel')} disabled={disabled} style={styles.hit} onPress={() => update(chain.filter((_, i) => index !== i))}><MinusCircle size={iconSize.lg} color={colors.textSecondary} /></Pressable> : null}
- </View>; })}
- {!following && chain.length < 5 ? <Pressable accessibilityRole="button" disabled={disabled} style={styles.row} onPress={() => onPick(chain.length)}><Plus size={iconSize.action} color={colors.textPrimary} /><Text style={{ color: colors.textPrimary }}>{t('devices.companionProfile.addModel')}</Text></Pressable> : null}
+ {/* Desktop BotModelChainEditor: the first model stays primary (change it with the picker);
+ backups reorder among themselves and can be removed. */}
+ {!following && index > 1 ? <Pressable accessibilityRole="button" accessibilityLabel={t('devices.companionProfile.moveModelUp')} disabled={disabled} style={styles.hit} onPress={() => { const next = [...chain]; [next[index - 1], next[index]] = [next[index], next[index - 1]]; update(next); }}><ArrowUp size={iconSize.lg} color={colors.textSecondary} /></Pressable> : null}
+ {!following && index > 0 ? <Pressable accessibilityRole="button" accessibilityLabel={t('devices.companionProfile.removeModel')} disabled={disabled} style={styles.hit} onPress={() => update(chain.filter((_, i) => index !== i))}><MinusCircle size={iconSize.lg} color={colors.textSecondary} /></Pressable> : null}
+ </View>;
+ };
+ const addRow = !following && chain.length < 5 ? <Pressable accessibilityRole="button" disabled={disabled} style={styles.row} onPress={() => onPick(chain.length)}><Plus size={iconSize.action} color={colors.textPrimary} /><Text style={{ color: colors.textPrimary }}>{t('devices.companionProfile.addModel')}</Text></Pressable> : null;
+ return <View style={{ gap: spacing.sm }}>
+ <View style={styles.row}><Text style={{ color: colors.textPrimary, flex: 1 }}>{t('devices.companionProfile.modelFollowsDefault')}</Text><Switch accessibilityLabel={t('devices.companionProfile.modelFollowsDefault')} value={following} disabled={disabled} onValueChange={value => onChange({ ...values, followsDefault: value })} /></View>
+ {chain.length ? routeRow(chain[0], 0) : addRow}
+ {chain.length ? <>
+ {/* The backup chain stays folded inside this editor, as on Desktop. */}
+ <Pressable accessibilityRole="button" accessibilityState={{ expanded: showBackups }} onPress={() => setShowBackups(value => !value)} style={styles.row} testID="companionModels.backups">
+ <Text style={{ color: colors.textSecondary, fontSize: typeScale.footnote, flex: 1 }}>{t('devices.companionProfile.backupModels', { count: chain.length - 1 })}</Text>
+ {showBackups ? <ChevronUp size={iconSize.md} color={colors.textSecondary} /> : <ChevronDown size={iconSize.md} color={colors.textSecondary} />}
+ </Pressable>
+ {showBackups ? <>{chain.slice(1).map((route, offset) => routeRow(route, offset + 1))}{addRow}</> : null}
+ </> : null}
</View>;
}
export function CompanionModelPicker({ visible, deviceId, route, onClose, onClosed, onSelect }: {
diff --git a/apps/mobile/src/session/CompanionProfileNativeView.ios.tsx b/apps/mobile/src/session/CompanionProfileNativeView.ios.tsx
index 368fd7a89e..d8e3e7c848 100644
--- a/apps/mobile/src/session/CompanionProfileNativeView.ios.tsx
+++ b/apps/mobile/src/session/CompanionProfileNativeView.ios.tsx
@@ -58,6 +58,8 @@ export function CompanionProfileNativeView(p: CompanionProfileNativeViewProps) {
<Section>{row('profile', 'person.crop.circle')}{row('memory', 'brain')}{row('models', 'slider.horizontal.3')}{row('skills', 'sparkles')}</Section>
<Section>{row('automation', 'clock', p.onAutomation)}{row('artifacts', 'doc.text')}{row('search', 'magnifyingglass', p.onSearch)}{row('permissions', 'hand.raised')}</Section>
<Section>{p.data?.panels.filter(item => ['restart', 'resume', 'delete'].includes(item.id) && item.action).map(item => <Button key={item.id} onPress={() => p.onConfirm(item)} modifiers={[buttonStyle('plain'), listRowInsets({ top: 4, bottom: 4, leading: 16, trailing: 16 }), disabled(p.busy || !p.online), frame({ minHeight: 44 }), ...(item.id === 'delete' ? [foregroundStyle(colors.destructive)] : [])]}><HStack modifiers={[frame({ maxWidth: Infinity, minHeight: 44 }), contentShape(shapes.rectangle())]}><Text>{label(item.action!.label)}</Text><Spacer /></HStack></Button>)}</Section>
+ {/* Same as Android: a host without the settings forms asks for a Cindy update on that computer. */}
+ {p.online && p.data && !p.data.panels.some(item => item.id === 'profile') ? note(tr('hostUpgrade')) : null}
</>;
return <ComposerSheet visible={p.visible} title={p.title} onClose={p.onClose} onClosed={p.onClosed} onBack={p.onBack}
nativeContent preventDismiss={p.dirty || p.busy || !!p.confirmation} testID="companionProfile">
@@ -70,10 +72,14 @@ export function CompanionProfileNativeView(p: CompanionProfileNativeViewProps) {
{p.confirmation.action.fields?.map(field => <Field key={field.id} field={field} values={p.values} onChange={p.onChange} busy={p.busy || !p.online} />)}
<Section>{action(label(p.confirmation.action.confirmation.confirmLabel ?? p.confirmation.action.label), () => p.onSubmit(p.confirmation!, true), !p.online || p.confirmation.id === 'delete' && p.values.confirmName !== p.name, p.confirmation.action.tone === 'destructive')}
{action(t('devices.common.cancel'), () => p.onConfirm(null))}</Section>
+ {p.busy ? <Section><ProgressView /></Section> : null}
</> : p.page === 'home' ? home : p.loading ? <Section><ProgressView /></Section> : p.page === 'editor' ? p.panel ? <>{panel(p.panel)}{p.editor?.panels.filter(item => item.id === 'remove' && item.action).map(item => <Section key={item.id}>{action(label(item.action!.label), () => p.onConfirm(item), !p.online, true)}</Section>)}</> : <Section>{p.editor?.panels.flatMap(item => item.entries?.length ? item.entries.map(entry => <Fragment key={`${item.id}:${entry.resourceId}`}>{action(label(entry.title), () => p.onEditor(entry.resourceId))}</Fragment>) : [item.action ? <Fragment key={item.id}>{action(label(item.title ?? item.action.label), () => p.onEditorPanel(item))}</Fragment> : <Text key={item.id}>{item.text || tr('emptyEditor')}</Text>])}</Section>
: p.page === 'models' ? <>{p.panel?.action ? <Section><CompanionNativeContent>{p.models}</CompanionNativeContent></Section> : null}{p.panel?.action ? <Section>{action(tr('save'), () => p.onSubmit(p.panel!), !p.dirty || !p.online || p.conflict)}</Section> : note(p.panel?.text || tr('hostUpgrade'))}</>
: p.page === 'settings' ? <Section>{row('permissions', 'hand.raised')}</Section>
: p.page === 'skills' ? <>{p.data?.panels.find(item => item.id === 'skills')?.entries?.length ? <Section>{row('personalSkills', 'sparkles')}</Section> : note(p.data?.panels.find(item => item.id === 'skills')?.text || tr('skillsEmpty'))}{p.data?.panels.find(item => item.id === 'connections')?.entries?.length ? <Section>{row('connections', 'link')}</Section> : note(p.data?.panels.find(item => item.id === 'connections')?.text || tr('emptyEditor'))}</>
- : p.page === 'artifacts' ? <Section><CompanionNativeContent>{p.artifacts}</CompanionNativeContent></Section> : <>{p.page === 'profile' && p.data?.panels.find(item => item.id === 'avatar')?.entries?.length ? <Section>{row('avatar', 'person.crop.circle')}</Section> : null}{panel(p.panel)}</>}
+ : p.page === 'artifacts' ? <Section><CompanionNativeContent>{p.artifacts}</CompanionNativeContent></Section> : p.page === 'memoryEntries' ? p.memoryPage
+ : <>{p.page === 'profile' && p.data?.panels.find(item => item.id === 'avatar')?.entries?.length ? <Section>{row('avatar', 'person.crop.circle')}</Section> : null}{panel(p.panel)}
+ {(p.page === 'profile' || p.page === 'memory') && p.panel && !p.panel.action ? note(tr('largeProfileRecovery')) : null}
+ {p.page === 'memory' && p.data ? p.hasMemoryEntries ? <Section>{row('memoryEntries', 'brain')}</Section> : p.panel?.action ? note(tr('hostUpgrade')) : null : null}</>}
</ComposerSheet>;
}
diff --git a/apps/mobile/src/session/CompanionProfileNativeView.tsx b/apps/mobile/src/session/CompanionProfileNativeView.tsx
index 017d1ccedf..066fd6ee64 100644
--- a/apps/mobile/src/session/CompanionProfileNativeView.tsx
+++ b/apps/mobile/src/session/CompanionProfileNativeView.tsx
@@ -7,6 +7,8 @@ export interface CompanionProfileNativeViewProps {
panel?: ProfilePanel; values: ProfileValues; busy: boolean; online: boolean; dirty: boolean;
loading: boolean; error: boolean; errorLabel?: string; conflict: boolean; receipt: string | null;
confirmation: ProfilePanel | null; deleted: boolean; artifacts: ReactNode; models: ReactNode;
+ /** Saved-memories page (list / detail / edit), and whether the host offers it. */
+ memoryPage: ReactNode; hasMemoryEntries: boolean;
onClose(): void; onClosed?(): void; onBack?(): void; onOpen(page: string): void;
onChange(values: ProfileValues): void; onSubmit(panel: ProfilePanel, confirmed?: boolean): void;
onConfirm(panel: ProfilePanel | null): void; onRetry(): void; onDiscard(reload: boolean): void;
diff --git a/apps/mobile/src/session/CompanionProfileSheet.tsx b/apps/mobile/src/session/CompanionProfileSheet.tsx
index debdfe6176..926ab93215 100644
--- a/apps/mobile/src/session/CompanionProfileSheet.tsx
+++ b/apps/mobile/src/session/CompanionProfileSheet.tsx
@@ -12,6 +12,7 @@ import { NativePullDownMenu, usesNativePullDownMenu } from '@/platform/chrome';
import { RemoteCompanionAvatar } from '@/components/RemoteCompanionAvatar';
import { useDeviceLink } from '@/device-link/DeviceLinkContext';
import { invokeRemoteResourceAction } from '@/device-link/remoteResources';
+import { readRemoteCollectionCache } from '@/device-link/remoteResourceAvailability';
import { CompanionSettingsRow as ContextSheetRow } from './CompanionSettingsRow';
import { CompanionSheet } from './CompanionSheet';
import { fontWeight, iconSize, radius, spacing, typeScale, useTheme, useThemedStyles, type ThemeColors } from '@/theme';
@@ -21,8 +22,12 @@ import { CompanionPortraitPicker, randomCompanionPortrait } from './CompanionPor
import { CompanionProfileNativeView } from './CompanionProfileNativeView';
import { CompanionProfileArtifacts } from './CompanionProfileArtifacts';
import { loadCompanionProfile, profileFormDirty, type CompanionProfileData, type ProfilePanel, type ProfileValues } from './companionProfileData';
+import { CompanionMemoryPage } from './CompanionMemoryPage';
+import { useCompanionMemory } from './useCompanionMemory';
const AVATAR_SIZE = 56;
+/** Same identity rule as the host and Desktop `normalizeBotName`. */
+const normalizeTeammateName = (name: string) => name.normalize('NFKC').trim().toLowerCase();
export interface CompanionProfileSheetProps {
visible: boolean;
@@ -69,6 +74,8 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
const [error, setError] = useState(false);
const [deleteFailure, setDeleteFailure] = useState(false);
const [conflict, setConflict] = useState<{ page: string; next: CompanionProfileData } | null>(null);
+ // A rename rejected because another teammate on this computer has the name (host NFKC check).
+ const [nameTakenOnSave, setNameTakenOnSave] = useState(false);
const [receipt, setReceipt] = useState<RemoteText | null>(null);
const [confirmation, setConfirmation] = useState<ProfilePanel | null>(null);
const [deleted, setDeleted] = useState(false);
@@ -85,6 +92,10 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
draftScope.current = { dirty, page, base: page === 'editor' ? editor : data };
const label = (value: RemoteText) => resolveRemoteText(value, i18n.language);
const name = label(data?.resource.display.title ?? resource?.display.title ?? '');
+ // Saved memories are a host page of their own; hosts without it keep the upgrade note.
+ const memoryList = data?.panels.find(item => item.id === 'memories')?.entries?.[0]?.resourceId;
+ const memory = useCompanionMemory({ invoke, openLink, deviceId, deviceName, collectionId, resourceKind: resource?.ref.kind ?? 'bot',
+ listResourceId: memoryList, online, active: page === 'memoryEntries', binding });
const read = useCallback(async () => {
if (!online || !resource) return null;
await openLink(deviceId);
@@ -94,7 +105,7 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
const started = binding;
const sequence = ++generation.current;
setError(false);
- setDeleteFailure(false);
+ setDeleteFailure(false); setNameTakenOnSave(false);
try {
const next = await read();
if (current.current === started && generation.current === sequence) {
@@ -108,7 +119,7 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
}
}, [binding, read]);
useEffect(() => {
- setModelStage('profile'); setConflict(null); setEditor(null); setEditorPanel(null); setEditorLoading(false); setData(null); setPage('home'); setValues({}); setReceipt(null); setConfirmation(null); setDeleted(false); setError(false); setDeleteFailure(false); setEditing(false); setBusy(false);
+ setModelStage('profile'); setConflict(null); setEditor(null); setEditorPanel(null); setEditorLoading(false); setData(null); setPage('home'); setValues({}); setReceipt(null); setConfirmation(null); setDeleted(false); setError(false); setDeleteFailure(false); setNameTakenOnSave(false); setEditing(false); setBusy(false);
return () => { generation.current++; };
}, [binding]);
useEffect(() => { if (visible && online) void refresh(); }, [visible, online, refresh]);
@@ -116,7 +127,7 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
const openEditor = async (resourceId: string) => {
if (inFlight.current || !online || !resource) return;
const started = binding; const sequence = ++generation.current;
- setConflict(null); setEditorResourceId(resourceId); setPage('editor'); setEditor(null); setEditorPanel(null); setEditorLoading(true); setEditing(false); setError(false); setDeleteFailure(false);
+ setConflict(null); setEditorResourceId(resourceId); setPage('editor'); setEditor(null); setEditorPanel(null); setEditorLoading(true); setEditing(false); setError(false); setDeleteFailure(false); setNameTakenOnSave(false);
try {
await openLink(deviceId);
const next = await loadCompanionProfile(invoke, deviceId, { ...resource.ref, collectionId, id: resourceId }, i18n.language);
@@ -130,20 +141,28 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
};
const open = (next: string) => {
if (inFlight.current) return;
- if (next === 'avatar' || next === 'notes' || next === 'connections' || next === 'personalSkills') {
+ if (next === 'memoryEntries') {
+ void (async () => {
+ if (dirty && panel && !(await submit(panel))) return;
+ setReceipt(null); setError(false); setDeleteFailure(false); setNameTakenOnSave(false); setConfirmation(null); setEditing(false); setPage(next);
+ })(); return;
+ }
+ if (next === 'avatar' || next === 'connections' || next === 'personalSkills') {
void (async () => {
if (dirty && panel && !(await submit(panel))) return;
await openEditor(`settings:${resource?.ref.id}/${next === 'personalSkills' ? 'skills' : next}`);
})(); return;
}
- setConflict(null); setEditor(null); setEditorPanel(null); setPage(next); setReceipt(null); setError(false); setDeleteFailure(false); setConfirmation(null); setEditing(false);
+ setConflict(null); setEditor(null); setEditorPanel(null); setPage(next); setReceipt(null); setError(false); setDeleteFailure(false); setNameTakenOnSave(false); setConfirmation(null); setEditing(false);
setValues(data?.panels.find(item => item.id === next)?.values ?? {});
};
const submit = async (target: ProfilePanel, confirmed = false): Promise<boolean> => {
if (!target.action || target.action.disabled || inFlight.current || !online || !resource || conflict?.page === page) return false;
if (target.action.confirmation && !confirmed) { setConfirmation(target); return false; }
- inFlight.current = true; generation.current++; setBusy(true); setError(false); setDeleteFailure(false); setReceipt(null);
+ inFlight.current = true; generation.current++; setBusy(true); setError(false); setDeleteFailure(false); setNameTakenOnSave(false); setReceipt(null);
const started = binding;
+ // A version conflict re-reads only after the submit lock is released; the readers refuse to run under it.
+ let rereadAfterConflict = false;
try {
const response = await invokeRemoteResourceAction(invoke, { deviceId, deviceName }, {
collectionId, resourceRef: page === 'editor' ? editor!.resource.ref : resource.ref, actionId: target.action.id,
@@ -176,24 +195,40 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
setData(next); setValues(next?.panels.find(item => item.id === target.id)?.values ?? {});
} catch { setError(true); }
return true;
- } catch {
- if (current.current === started) { setError(true); setDeleteFailure(target.id === 'delete'); setConfirmation(null); }
+ } catch (cause) {
+ if (current.current === started) {
+ const message = cause instanceof Error ? cause.message : String(cause);
+ setConfirmation(null);
+ if (target.id !== 'delete' && message.includes('ALREADY_EXISTS')) { setNameTakenOnSave(true); setError(true); }
+ else if (target.id !== 'delete' && message.includes('PRECONDITION_FAILED')) {
+ // The teammate changed meanwhile. Keep the draft; the re-read offers the latest version.
+ rereadAfterConflict = true;
+ } else { setError(true); setDeleteFailure(target.id === 'delete'); }
+ }
return false;
} finally {
inFlight.current = false;
- if (current.current === started) setBusy(false);
+ if (current.current === started) {
+ setBusy(false);
+ if (rereadAfterConflict) void (page === 'editor' ? retryEditor() : refresh());
+ }
}
};
const leave = async (close: boolean) => {
if (inFlight.current) return;
if (confirmation) { setConfirmation(null); return; }
+ if (page === 'memoryEntries') {
+ if (close) { if (await memory.flush()) onClose(); }
+ else if (!(await memory.back())) open('memory');
+ return;
+ }
if (dirty && panel && !(await submit(panel))) return;
if (close) { onClose(); return; }
if (page === 'editor' && editor) {
if (editorPanel && editor.panels.filter(item => item.action && item.id !== 'remove').length > 1) { setEditorPanel(null); setEditing(false); return; }
const parts = editor.resource.ref.id.split('/');
if (parts.length > 2) { await openEditor(parts.slice(0, -1).join('/')); return; }
- open(parts[1] === 'notes' ? 'memory' : parts[1] === 'skills' || parts[1] === 'connections' ? 'skills' : parts[1] === 'models' ? 'settings' : 'home');
+ open(parts[1] === 'skills' || parts[1] === 'connections' ? 'skills' : parts[1] === 'models' ? 'settings' : 'home');
} else open('home');
};
const dismiss = () => { void leave(true); };
@@ -228,7 +263,7 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
const conversation = data?.resource.links.find(link => link.rel === 'conversation' && link.target.kind === 'session');
const sessionId = conversation?.target.kind === 'session' ? conversation.target.sessionId : '';
const actionPanel = (id: string) => data?.panels.find(item => item.id === id);
- const editorTitles: Record<string, string> = { avatar: 'avatar', models: 'models', notes: 'notes', skills: 'personalSkills', connections: 'connections' };
+ const editorTitles: Record<string, string> = { avatar: 'avatar', models: 'models', skills: 'personalSkills', connections: 'connections' };
const titleKey = page === 'home' ? 'settingsTitle' : page === 'editor' ? editorTitles[editorResourceId.split('/')[1]] ?? 'title' : page;
const note = (key: string) => <Text selectable style={styles.note}>{t(`devices.companionProfile.${key}`, { deviceName })}</Text>;
const row = (id: string, Icon: typeof Brain) => <ContextSheetRow key={id} trailing="chevron" label={t(`devices.companionProfile.${id}`)} icon={<Icon size={iconSize.lg} color={colors.textSecondary} />} onPress={() => open(id)} />;
@@ -236,6 +271,7 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
? <CompanionProfileForm panel={target} values={editing ? values : target.values} onChange={next => { if (!editing) draftBase.current = target.values; setValues(next); setEditing(true); }} disabled={busy || !online} />
: target?.text ? <Text selectable style={styles.body}>{target.text}</Text> : !data && online ? <Text style={styles.note}>{t('devices.resources.loading')}</Text> : note('hostUpgrade');
+ const memoryPage = <CompanionMemoryPage memory={memory} online={online} botName={name} memoryEnabled={actionPanel('memory')?.values.memory !== false} />;
const modelValues = editing ? values : panel?.values ?? {};
const changeValues = (next: ProfileValues) => { if (!editing) draftBase.current = panel?.values ?? {}; setValues(next); setEditing(true); };
const models = <CompanionModelChain deviceId={deviceId} values={modelValues} disabled={busy || !online || !panel?.action} onChange={changeValues}
@@ -258,9 +294,10 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
if (Platform.OS === 'ios') return <>{modelPicker}<CompanionProfileNativeView models={models}
visible={visible && modelStage === 'profile'} title={confirmation?.action?.confirmation ? label(confirmation.action.confirmation.title) : page === 'editor' && editor ? label(editor.resource.display.title) : t(`devices.companionProfile.${titleKey}`)}
name={name} page={page} deviceId={deviceId} deviceName={deviceName} resource={resource} data={data} editor={editor} panel={panel}
- values={editing ? values : panel?.values ?? values} busy={busy} online={online} dirty={dirty} loading={editorLoading}
- error={error} errorLabel={deleteFailure ? t('devices.companionProfile.deleteFailed') : undefined} conflict={conflict?.page === page} receipt={receipt && !confirmation ? label(receipt) : null} confirmation={confirmation} deleted={deleted}
+ values={editing ? values : panel?.values ?? values} busy={busy || memory.busy} online={online} dirty={dirty || memory.dirty} loading={editorLoading}
+ error={error} errorLabel={deleteFailure ? t('devices.companionProfile.deleteFailed') : nameTakenOnSave ? t('devices.companionProfile.nameTaken') : undefined} conflict={conflict?.page === page} receipt={receipt && !confirmation ? label(receipt) : null} confirmation={confirmation} deleted={deleted}
artifacts={sessionId && resource ? <CompanionProfileArtifacts deviceId={deviceId} botId={resource.ref.id} sessionId={sessionId} online={online} onOpenTask={openArtifactTask} /> : note('artifactsRecovery')}
+ memoryPage={memoryPage} hasMemoryEntries={!!memoryList}
onClose={dismiss} onClosed={afterClosed} onBack={page !== 'home' || confirmation ? () => void leave(false) : undefined}
onOpen={open}
onChange={next => { if (!editing) draftBase.current = panel?.values ?? {}; setValues(next); setEditing(true); }}
@@ -271,12 +308,12 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
onSearch={onOpenSearch} onAutomation={onOpenAutomation} /></>;
return <>{modelPicker}<CompanionSheet visible={visible && modelStage === 'profile'} onClosed={afterClosed} onClose={dismiss}
- preventDismiss={dirty || busy || !!confirmation}
+ preventDismiss={dirty || busy || !!confirmation || memory.dirty || memory.busy}
onBack={page !== 'home' || confirmation ? () => void leave(false) : undefined}
title={confirmation?.action?.confirmation ? label(confirmation.action.confirmation.title) : page === 'editor' && editor ? label(panel?.title ?? editor.resource.display.title) : t(`devices.companionProfile.${titleKey}`)} testID="companionProfile">
<View style={styles.content}>
{!online ? note('offline') : null}
- {error ? <View accessibilityRole="alert">{note(deleteFailure ? 'deleteFailed' : 'readFailed')}<MainWindowActionButton action={{ label: t('devices.resources.retry'), disabled: busy || !online, onPress: () => { if (page === 'editor') void retryEditor(); else void refresh(); } }} />
+ {error ? <View accessibilityRole="alert">{note(deleteFailure ? 'deleteFailed' : nameTakenOnSave ? 'nameTaken' : 'readFailed')}<MainWindowActionButton action={{ label: t('devices.resources.retry'), disabled: busy || !online, onPress: () => { if (page === 'editor') void retryEditor(); else void refresh(); } }} />
{dirty ? <MainWindowActionButton action={{ label: t('devices.companions.automation.discard'), tone: 'danger', disabled: busy, onPress: () => discardDraft(false) }} /> : null}
</View> : null}
{conflict?.page === page ? <View accessibilityRole="alert">{note('changed')}<MainWindowActionButton action={{ label: t('devices.companionProfile.discardAndReload'), tone: 'danger', disabled: busy, onPress: () => discardDraft(true) }} /></View> : null}
@@ -310,19 +347,19 @@ function CompanionProfileSheetContent(props: CompanionProfileSheetProps) {
</View>
<View style={styles.group}>{(['resume', 'restart', 'delete'] as const).map(id => {
const item = actionPanel(id);
- return item?.action ? <ContextSheetRow key={id} icon={null} disabled={busy || !online} label={label(item.action.label)} onPress={() => { setValues({}); setEditing(false); setConfirmation(item); }} /> : null;
+ return item?.action ? <ContextSheetRow key={id} icon={null} disabled={busy || !online} destructive={id === 'delete'} label={label(item.action.label)} onPress={() => { setValues({}); setEditing(false); setConfirmation(item); }} /> : null;
})}</View>
{online && data && !actionPanel('profile') ? note('hostUpgrade') : null}
</> : page === 'settings' ? <>
<View style={styles.group}>{row('models', Settings2)}{row('permissions', UserRound)}</View>
</> : page === 'skills' ? <>
{actionPanel('skills')?.entries?.length ? row('personalSkills', Sparkles) : renderPanel(actionPanel('skills'))}{actionPanel('connections')?.entries?.length ? row('connections', Settings2) : renderPanel(actionPanel('connections'))}
- </> : page === 'artifacts' ? sessionId && resource ? <CompanionProfileArtifacts deviceId={deviceId} botId={resource.ref.id} sessionId={sessionId} online={online} onOpenTask={openArtifactTask} /> : note('artifactsRecovery') : page === 'direct' ? actionPanel('direct') ? <><Text selectable style={styles.body}>{actionPanel('direct')!.text || t('devices.companionProfile.directEmpty')}</Text></> : note('directRecovery') : <>
+ </> : page === 'memoryEntries' ? memoryPage : page === 'artifacts' ? sessionId && resource ? <CompanionProfileArtifacts deviceId={deviceId} botId={resource.ref.id} sessionId={sessionId} online={online} onOpenTask={openArtifactTask} /> : note('artifactsRecovery') : page === 'direct' ? actionPanel('direct') ? <><Text selectable style={styles.body}>{actionPanel('direct')!.text || t('devices.companionProfile.directEmpty')}</Text></> : note('directRecovery') : <>
{page === 'profile' && actionPanel('avatar')?.entries?.length ? row('avatar', UserRound) : null}
{page === 'models' && panel?.action ? models : renderPanel(panel)}
{(page === 'profile' || page === 'memory') && panel && !panel.action ? note('largeProfileRecovery') : null}
- {page === 'memory' && actionPanel('notes')?.action ? row('notes', Brain) : null}
{panel?.action ? <MainWindowActionButton action={{ label: t('devices.companionProfile.save'), busy, disabled: !online || !dirty || conflict?.page === page, onPress: () => void submit(panel) }} /> : null}
+ {page === 'memory' && data ? memoryList ? row('memoryEntries', Brain) : panel?.action ? note('hostUpgrade') : null : null}
</>}
</View>
</CompanionSheet></>;
@@ -344,14 +381,27 @@ function CompanionCreateSheetContent({ visible, onClose, onClosed, deviceId, dev
const [busy, setBusy] = useState(false);
const [error, setError] = useState(false);
const [nameTaken, setNameTaken] = useState(false);
+ // The host may already hold the sent teammate under this request; a retry must resend exactly it.
+ const [unconfirmed, setUnconfirmed] = useState(false);
const inFlight = useRef(false);
const current = useRef(0);
// Intent identity survives an ambiguous ACK, capability reload and reconnect.
// The account-keyed component and an explicit new opening are reset boundaries.
const requestId = useRef<string | null>(null);
const ref = { collectionId, kind: 'bot', id: 'create' };
- const reload = async () => {
- const sequence = ++current.current; setError(false); setLoading(true);
+ // Desktop BotRosterView: names must be distinguishable before submitting (NFKC, trimmed, case-insensitive).
+ // The host still rejects collisions with teammates this list does not show.
+ const { user, accountGeneration } = useAuth();
+ const takenNames = useMemo(() => new Set(readRemoteCollectionCache(`${user?.id ?? ''}:${accountGeneration}`, collectionId)
+ .filter(row => row.host.deviceId === deviceId && row.item.ref.kind === 'bot')
+ .map(row => normalizeTeammateName(resolveRemoteText(row.item.display.title, i18n.language)))),
+ // Re-read whenever the sheet opens; the roster cache is not reactive.
+ [accountGeneration, collectionId, deviceId, i18n.language, user?.id, visible]);
+ const typedName = typeof values.name === 'string' ? values.name : '';
+ const duplicate = !!typedName.trim() && takenNames.has(normalizeTeammateName(typedName));
+ // A one-use create action is consumed by a failed attempt; re-read it without clearing the form or the notice.
+ const reload = async (keepError = false) => {
+ const sequence = ++current.current; if (!keepError) setError(false); setLoading(true);
try {
await openLink(deviceId);
const next = await loadCompanionProfile(invoke, deviceId, ref, i18n.language);
@@ -360,7 +410,7 @@ function CompanionCreateSheetContent({ visible, onClose, onClosed, deviceId, dev
finally { if (current.current === sequence) setLoading(false); }
};
useEffect(() => {
- if (visible) { requestId.current = null; setPortraitChanged(false); setNameTaken(false); setValues({ name: '', avatarImageBase64: randomCompanionPortrait() }); }
+ if (visible) { requestId.current = null; setPortraitChanged(false); setNameTaken(false); setUnconfirmed(false); setValues({ name: '', avatarImageBase64: randomCompanionPortrait() }); }
}, [visible]);
useEffect(() => {
setData(null); setError(false);
@@ -368,7 +418,7 @@ function CompanionCreateSheetContent({ visible, onClose, onClosed, deviceId, dev
return () => { current.current++; };
}, [visible, online, deviceId, collectionId]);
const dirty = !!String(values.name ?? '').trim() || portraitChanged;
- const change = (next: ProfileValues) => { if (next.avatarImageBase64 !== values.avatarImageBase64) setPortraitChanged(true); setValues(next); };
+ const change = (next: ProfileValues) => { if (unconfirmed) return; if (next.avatarImageBase64 !== values.avatarImageBase64) setPortraitChanged(true); setValues(next); };
const close = () => {
if (inFlight.current) return;
if (!dirty) { onClose(); return; }
@@ -379,7 +429,7 @@ function CompanionCreateSheetContent({ visible, onClose, onClosed, deviceId, dev
};
const submit = async () => {
const panel = data?.panels[0];
- if (!panel?.action || panel.action.disabled || inFlight.current || !online) return;
+ if (!panel?.action || panel.action.disabled || inFlight.current || !online || duplicate) return;
inFlight.current = true; setBusy(true); setError(false); setNameTaken(false);
const sequence = current.current;
try {
@@ -391,24 +441,28 @@ function CompanionCreateSheetContent({ visible, onClose, onClosed, deviceId, dev
onCreated(navigation.target.ref); onClose();
} catch (cause) {
if (current.current === sequence) {
- const collision = cause instanceof Error && cause.message.includes('ALREADY_EXISTS');
- setNameTaken(collision); setError(true); setData(null);
- if (collision) requestId.current = null;
+ const message = cause instanceof Error ? cause.message : String(cause);
+ const collision = message.includes('ALREADY_EXISTS');
+ // Only a host rejection proves nothing was created; then edits get a fresh request.
+ const rejected = collision || message.includes('INVALID_PARAMS');
+ setNameTaken(collision); setError(true); setUnconfirmed(!rejected);
+ if (rejected) requestId.current = null;
+ void reload(true);
}
} finally {
inFlight.current = false;
setBusy(false);
}
};
- if (Platform.OS === 'ios') return <CompanionCreateNativeView deviceName={deviceName} nameTaken={nameTaken} visible={visible} onClose={close} onClosed={onClosed} panel={data?.panels[0]} values={values} onChange={change} onSubmit={() => void submit()} onRetry={() => void reload()} online={online} busy={busy} loading={loading} error={error} dirty={dirty} />;
+ if (Platform.OS === 'ios') return <CompanionCreateNativeView deviceName={deviceName} nameTaken={nameTaken} duplicate={duplicate} locked={unconfirmed} visible={visible} onClose={close} onClosed={onClosed} panel={data?.panels[0]} values={values} onChange={change} onSubmit={() => void submit()} onRetry={() => void reload()} online={online} busy={busy} loading={loading} error={error} dirty={dirty} />;
return <CompanionSheet visible={visible} onClose={close} onClosed={onClosed} preventDismiss={dirty || busy} title={t('devices.companionProfile.create')}>
<View style={styles.content}>
{!online ? <Text style={styles.note}>{t('devices.companionProfile.offline', { deviceName })}</Text> : null}
- {error ? <Text accessibilityRole="alert" style={styles.note}>{t(nameTaken ? 'devices.companionProfile.nameTaken' : 'devices.companionProfile.createFailed')}</Text> : null}
- {data?.panels[0] ? <CompanionProfileForm panel={data.panels[0]} values={values} onChange={change} disabled={busy || !online} /> : null}
+ {error || duplicate ? <Text accessibilityRole="alert" style={styles.note}>{t(duplicate || nameTaken ? 'devices.companionProfile.nameTaken' : 'devices.companionProfile.createFailed')}</Text> : null}
+ {data?.panels[0] ? <CompanionProfileForm panel={data.panels[0]} values={values} onChange={change} disabled={busy || !online || unconfirmed} /> : null}
{loading ? <Text style={styles.note}>{t('devices.resources.loading')}</Text> : null}
{!data && online && !loading ? <MainWindowActionButton action={{ label: t('devices.resources.retry'), disabled: busy, onPress: () => void reload() }} /> : null}
- <MainWindowActionButton action={{ label: t('devices.companionProfile.create'), busy, disabled: !online || !data || typeof values.name !== 'string' || !values.name.trim(), onPress: () => void submit() }} />
+ <MainWindowActionButton action={{ label: t('devices.companionProfile.create'), busy, disabled: !online || !data || typeof values.name !== 'string' || !values.name.trim() || duplicate, onPress: () => void submit() }} />
</View>
</CompanionSheet>;
}
diff --git a/apps/mobile/src/session/ContextSheet.tsx b/apps/mobile/src/session/ContextSheet.tsx
index 58c1b7e858..6de6fa9398 100644
--- a/apps/mobile/src/session/ContextSheet.tsx
+++ b/apps/mobile/src/session/ContextSheet.tsx
@@ -154,6 +154,8 @@ export interface ContextSheetRowProps {
busy?: boolean;
accessibilityHint?: string;
testID?: string;
+ /** Destructive actions (delete) read in the destructive text color. */
+ destructive?: boolean;
}
export function ContextSheetRow({
@@ -165,6 +167,7 @@ export function ContextSheetRow({
busy,
accessibilityHint,
testID,
+ destructive = false,
}: ContextSheetRowProps) {
const styles = useThemedStyles(makeContextSheetStyles);
const { colors } = useTheme();
@@ -181,7 +184,7 @@ export function ContextSheetRow({
>
<View style={styles.rowLeft}>
{icon}
- <Text style={styles.rowLabel}>{label}</Text>
+ <Text style={[styles.rowLabel, destructive && { color: colors.destructive }]}>{label}</Text>
</View>
<View style={styles.rowTrailing}>
{busy ? (
diff --git a/apps/mobile/src/session/companionProfileData.ts b/apps/mobile/src/session/companionProfileData.ts
index f0d470caff..818bb176a1 100644
--- a/apps/mobile/src/session/companionProfileData.ts
+++ b/apps/mobile/src/session/companionProfileData.ts
@@ -10,8 +10,15 @@ export interface ProfilePanel {
values: ProfileValues;
followsDefault?: boolean;
title?: RemoteText;
- entries?: Array<{ id: string; title: RemoteText; resourceId: string }>;
+ entries?: Array<{ id: string; title: RemoteText; resourceId: string; subtitle?: RemoteText; timestamp?: number }>;
portraits?: Array<{ value: string; uri: string }>;
+ /** Open primitive name, kept so pages can recognize portable blocks such as `search`. */
+ primitive?: string;
+ /** Host-counted list size; the entries may be a bounded page of it. */
+ count?: number;
+ /** `search` block: the query this read was filtered by, and host-owned placeholder copy. */
+ query?: string;
+ placeholder?: RemoteText;
}
export interface CompanionProfileData { resource: RemoteResource; panels: ProfilePanel[] }
const record = (value: unknown): Record<string, unknown> | null => value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : null;
@@ -76,7 +83,9 @@ export function parseCompanionProfileData(raw: unknown, ref: RemoteResourceRef):
const entries = Array.isArray(payload?.entries) ? payload.entries.slice(0, 2000).flatMap(item => {
const entry = record(item);
return entry && string(entry.id, 160) && text(entry.title) && string(entry.resourceId, 256)
- ? [{ id: entry.id, title: entry.title, resourceId: entry.resourceId }] : [];
+ ? [{ id: entry.id, title: entry.title, resourceId: entry.resourceId,
+ ...(text(entry.subtitle) ? { subtitle: entry.subtitle } : {}),
+ ...(typeof entry.timestamp === 'number' && Number.isFinite(entry.timestamp) ? { timestamp: entry.timestamp } : {}) }] : [];
}) : undefined;
const portraits = Array.isArray(payload?.portraits) ? payload.portraits.slice(0, 16).flatMap(item => {
const portrait = record(item);
@@ -84,13 +93,20 @@ export function parseCompanionProfileData(raw: unknown, ref: RemoteResourceRef):
? [{ value: portrait.value, uri: portrait.uri }] : [];
}) : undefined;
panels.push({ id: block.id, text: block.fallbackMarkdown, action: formAction, values, entries, portraits,
+ ...(string(block.primitive, 64) ? { primitive: block.primitive } : {}),
+ ...(Number.isSafeInteger(payload?.count) && Number(payload?.count) >= 0 ? { count: Number(payload?.count) } : {}),
+ ...(block.primitive === 'search' && string(payload?.query, 1_000) ? { query: payload?.query as string } : {}),
+ ...(block.primitive === 'search' && text(payload?.placeholder) ? { placeholder: payload?.placeholder as RemoteText } : {}),
...(text(block.title) ? { title: block.title } : {}),
...(typeof payload?.followsDefault === 'boolean' ? { followsDefault: payload.followsDefault } : {}) });
}
return { resource, panels };
}
-export async function loadCompanionProfile(invoke: RemoteInvoke, deviceId: string, ref: RemoteResourceRef, locale: string): Promise<CompanionProfileData> {
- const raw = await invoke<unknown>(deviceId, REMOTE_RESOURCE_GET_CHANNEL, [{ client: { protocolVersion: REMOTE_RESOURCE_PROTOCOL_VERSION, primitives: ['status', 'session-link', 'markdown', 'form', 'action', 'list'], locale }, ref }]);
+/** `search` is declared so hosts may add a search block; the query is only sent where one was advertised. */
+export const COMPANION_PROFILE_PRIMITIVES = ['status', 'session-link', 'markdown', 'form', 'action', 'list', 'search'] as const;
+export async function loadCompanionProfile(invoke: RemoteInvoke, deviceId: string, ref: RemoteResourceRef, locale: string, options: { query?: string } = {}): Promise<CompanionProfileData> {
+ const query = options.query?.trim();
+ const raw = await invoke<unknown>(deviceId, REMOTE_RESOURCE_GET_CHANNEL, [{ client: { protocolVersion: REMOTE_RESOURCE_PROTOCOL_VERSION, primitives: [...COMPANION_PROFILE_PRIMITIVES], locale }, ref, ...(query ? { query } : {}) }]);
return parseCompanionProfileData(raw, ref);
}
/** Task output inventory is already host-authorized; project only relative display names and source links. */
diff --git a/apps/mobile/src/session/useCompanionMemory.ts b/apps/mobile/src/session/useCompanionMemory.ts
new file mode 100644
index 0000000000..8487e9ab51
--- /dev/null
+++ b/apps/mobile/src/session/useCompanionMemory.ts
@@ -0,0 +1,376 @@
+import { useCallback, useEffect, useRef, useState } from 'react';
+import { Alert } from 'react-native';
+import { useTranslation } from 'react-i18next';
+import { resolveRemoteText, type RemoteText } from '@cindy/device-link';
+import type { RemoteInvoke } from '@/device-link/mobileMakerTransport';
+import { invokeRemoteResourceAction } from '@/device-link/remoteResources';
+import { loadCompanionProfile, type CompanionProfileData, type ProfilePanel } from './companionProfileData';
+
+/** Mirrors the host store limits; the host service validates again before writing. */
+export const COMPANION_MEMORY_TITLE_MAX = 100;
+export const COMPANION_MEMORY_BODY_MAX_BYTES = 8192;
+const SEARCH_DEBOUNCE_MS = 300;
+
+export interface CompanionMemoryEntry { id: string; title: string; preview: string; timestamp?: number; resourceId: string }
+export interface CompanionMemoryGroup { id: string; title: string; count: number; entries: CompanionMemoryEntry[] }
+export interface CompanionMemoryDetail {
+ resourceId: string; revision: string; title: string; body: string; kind: string; timestamp?: number;
+ form?: ProfilePanel; remove?: ProfilePanel; data: CompanionProfileData;
+}
+export type CompanionMemoryView = 'list' | 'detail' | 'edit';
+export type CompanionMemorySaveState = 'idle' | 'saving' | 'saved' | 'error' | 'conflict';
+interface Content { title: string; body: string }
+
+const utf8Bytes = (value: string) => {
+ let bytes = 0;
+ for (const char of value) {
+ const code = char.codePointAt(0) ?? 0;
+ bytes += code <= 0x7f ? 1 : code <= 0x7ff ? 2 : code <= 0xffff ? 3 : 4;
+ }
+ return bytes;
+};
+export const memoryBodyTooLong = (body: string) => utf8Bytes(body.trim()) > COMPANION_MEMORY_BODY_MAX_BYTES;
+/** Same normalization the host applies on save, so whitespace alone never counts as an edit. */
+const normalized = ({ title, body }: Content): Content => ({ title: title.replace(/\s+/g, ' ').trim(), body: body.trim() });
+const sameContent = (left: Content, right: Content) => {
+ const a = normalized(left); const b = normalized(right);
+ return a.title === b.title && a.body === b.body;
+};
+/** Provider failures arrive as INTERNAL; only a stable NOT_FOUND says the memory is gone. */
+const isNotFound = (error: unknown) => /(^|\[|\s)NOT_FOUND(\]|\s|:|$)/.test(error instanceof Error ? error.message : String(error));
+
+function toDetail(data: CompanionProfileData, locale: string): CompanionMemoryDetail {
+ const block = data.panels.find(panel => panel.id === 'entry');
+ const form = block?.action ? block : undefined;
+ const remove = data.panels.find(panel => panel.id === 'remove' && panel.action);
+ return {
+ resourceId: data.resource.ref.id, revision: data.resource.revision,
+ title: typeof block?.values.title === 'string' ? block.values.title : resolveRemoteText(data.resource.display.title, locale),
+ body: typeof block?.values.body === 'string' ? block.values.body : block?.text ?? '',
+ kind: data.resource.display.subtitle ? resolveRemoteText(data.resource.display.subtitle, locale) : '',
+ timestamp: data.resource.display.timestamp, form, remove, data,
+ };
+}
+export function companionMemoryGroups(data: CompanionProfileData | null, locale: string): CompanionMemoryGroup[] {
+ return (data?.panels ?? []).filter(panel => panel.primitive === 'list' && panel.entries?.length).map(panel => ({
+ id: panel.id, title: panel.title ? resolveRemoteText(panel.title, locale) : '', count: panel.count ?? panel.entries!.length,
+ entries: panel.entries!.map(entry => ({ id: entry.id, title: resolveRemoteText(entry.title, locale),
+ preview: entry.subtitle ? resolveRemoteText(entry.subtitle, locale) : '', timestamp: entry.timestamp, resourceId: entry.resourceId })),
+ }));
+}
+
+/** "Today" or a short date, optionally with the time, in the UI language. */
+export function companionMemoryDate(timestamp: number | undefined, locale: string, today: string, withTime = false): string {
+ if (timestamp === undefined) return '';
+ const date = new Date(timestamp);
+ if (Number.isNaN(date.getTime())) return '';
+ try {
+ const day = date.toDateString() === new Date().toDateString() ? today
+ : new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric' }).format(date);
+ return withTime ? `${day} ${new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit' }).format(date)}` : day;
+ } catch {
+ return withTime ? date.toLocaleString() : date.toLocaleDateString();
+ }
+}
+/** Host-owned form field copy for the editor, keyed by field id. */
+export function companionMemoryFieldLabel(detail: CompanionMemoryDetail | null, id: 'title' | 'body', locale: string): string {
+ const field = detail?.form?.action?.fields?.find(item => item.id === id);
+ return field ? resolveRemoteText(field.label, locale) : '';
+}
+
+export interface CompanionMemoryOptions {
+ invoke: RemoteInvoke;
+ openLink(deviceId: string): Promise<unknown>;
+ deviceId: string;
+ deviceName: string;
+ collectionId: string;
+ resourceKind: string;
+ /** Host-provided saved-memories page; absent on hosts that predate it. */
+ listResourceId?: string;
+ online: boolean;
+ /** The page is shown; leaving it resets to the list. */
+ active: boolean;
+ /** Account / device / teammate / visibility identity. Late results from another binding are dropped. */
+ binding: string;
+}
+
+/**
+ * Saved-memories page state shared by the SwiftUI and React Native views: list (grouped,
+ * host search) → detail → edit. Every write first re-reads the entry: a changed revision
+ * means the teammate wrote meanwhile, so nothing is overwritten and the user chooses.
+ */
+export function useCompanionMemory(o: CompanionMemoryOptions) {
+ const { t, i18n } = useTranslation();
+ const locale = i18n.language;
+ const [view, setViewState] = useState<CompanionMemoryView>('list');
+ const [list, setList] = useState<CompanionProfileData | null>(null);
+ const [listLoading, setListLoading] = useState(false);
+ const [listFailed, setListFailed] = useState(false);
+ const [query, setQueryState] = useState('');
+ const [detailId, setDetailId] = useState('');
+ const [detail, setDetail] = useState<CompanionMemoryDetail | null>(null);
+ const [detailFailed, setDetailFailed] = useState(false);
+ const [missing, setMissing] = useState(false);
+ const [changed, setChanged] = useState(false);
+ const [deleteFailed, setDeleteFailed] = useState(false);
+ const [draft, setDraftState] = useState<Content>({ title: '', body: '' });
+ const [draftGeneration, setDraftGeneration] = useState(0);
+ const [saveState, setSaveStateValue] = useState<CompanionMemorySaveState>('idle');
+ const [latest, setLatest] = useState<CompanionMemoryDetail | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [receipt, setReceipt] = useState<RemoteText | null>(null);
+ const viewRef = useRef<CompanionMemoryView>('list');
+ const draftRef = useRef<Content>(draft);
+ const saveStateRef = useRef<CompanionMemorySaveState>('idle');
+ /** Host version the draft is based on; every write is checked against it. */
+ const base = useRef<CompanionMemoryDetail | null>(null);
+ /** Content accepted by the host whose post-save read did not arrive yet. */
+ const accepted = useRef<Content | null>(null);
+ const queryRef = useRef('');
+ const listStale = useRef(false);
+ const inFlight = useRef(false);
+ const generation = useRef(0);
+ const listSequence = useRef(0);
+ const detailSequence = useRef(0);
+ const searchTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
+ const setView = (next: CompanionMemoryView) => { viewRef.current = next; setViewState(next); };
+ const setSaveState = (next: CompanionMemorySaveState) => { saveStateRef.current = next; setSaveStateValue(next); };
+ const setDraft = (next: Content) => { draftRef.current = next; setDraftState(next); };
+ const label = (value: RemoteText) => resolveRemoteText(value, locale);
+ const ref = (id: string) => ({ collectionId: o.collectionId, kind: o.resourceKind, id });
+
+ const loadList = useCallback(async (nextQuery: string) => {
+ if (!o.listResourceId || !o.online) return;
+ const sequence = ++listSequence.current; const started = generation.current;
+ const current = () => sequence === listSequence.current && started === generation.current;
+ setListLoading(true); setListFailed(false);
+ try {
+ await o.openLink(o.deviceId);
+ const next = await loadCompanionProfile(o.invoke, o.deviceId, ref(o.listResourceId), locale, { query: nextQuery });
+ if (!current()) return;
+ listStale.current = false; setList(next);
+ } catch { if (current()) setListFailed(true); }
+ finally { if (current()) setListLoading(false); }
+ }, [o.listResourceId, o.online, o.openLink, o.deviceId, o.invoke, o.collectionId, o.resourceKind, locale]);
+
+ // A new account, teammate or sheet opening, or leaving the page starts from a fresh list.
+ useEffect(() => {
+ generation.current++; inFlight.current = false; base.current = null; accepted.current = null; queryRef.current = '';
+ if (searchTimer.current) clearTimeout(searchTimer.current);
+ setView('list'); setList(null); setListFailed(false); setListLoading(false); setQueryState(''); setDetail(null); setDetailId('');
+ setDetailFailed(false); setMissing(false); setChanged(false); setDeleteFailed(false); setLatest(null); setSaveState('idle'); setBusy(false); setReceipt(null);
+ if (o.active && o.online) void loadList('');
+ return () => { generation.current++; if (searchTimer.current) clearTimeout(searchTimer.current); };
+ }, [o.binding, o.active, o.listResourceId]);
+ // Reconnecting shows what the list page could not read while offline; drafts are untouched.
+ useEffect(() => { if (o.active && o.online && viewRef.current === 'list') void loadList(queryRef.current); }, [o.online]);
+
+ const setQuery = (value: string) => {
+ queryRef.current = value; setQueryState(value);
+ if (searchTimer.current) clearTimeout(searchTimer.current);
+ searchTimer.current = setTimeout(() => { searchTimer.current = null; void loadList(value); }, SEARCH_DEBOUNCE_MS);
+ };
+ const readDetail = async (resourceId: string) => {
+ await o.openLink(o.deviceId);
+ return toDetail(await loadCompanionProfile(o.invoke, o.deviceId, ref(resourceId), locale), locale);
+ };
+ const loadDetail = async (resourceId: string) => {
+ const sequence = ++detailSequence.current; const started = generation.current;
+ const current = () => sequence === detailSequence.current && started === generation.current;
+ setDetailFailed(false);
+ try {
+ const next = await readDetail(resourceId);
+ if (!current()) return;
+ base.current = next; accepted.current = null; setDetail(next);
+ } catch (error) {
+ if (!current()) return;
+ if (isNotFound(error)) setMissing(true); else setDetailFailed(true);
+ }
+ };
+ const open = (resourceId: string) => {
+ if (inFlight.current) return;
+ setDetailId(resourceId); setDetail(null); setMissing(false); setChanged(false); setDeleteFailed(false); setLatest(null); setSaveState('idle'); setReceipt(null);
+ setView('detail'); void loadDetail(resourceId);
+ };
+ const edit = () => {
+ if (!detail?.form?.action || inFlight.current) return;
+ base.current = detail; setDraft({ title: detail.title, body: detail.body }); setDraftGeneration(value => value + 1);
+ setLatest(null); setSaveState('idle'); setReceipt(null); setView('edit');
+ };
+ const change = (patch: Partial<Content>) => {
+ if (inFlight.current) return;
+ setDraft({ ...draftRef.current, ...patch });
+ if (saveStateRef.current === 'saved' || saveStateRef.current === 'error') setSaveState('idle');
+ };
+ const isDirty = () => viewRef.current === 'edit' && !!base.current && !sameContent(draftRef.current, base.current);
+ const isValid = () => {
+ const { title, body } = normalized(draftRef.current);
+ return !!title && Array.from(title).length <= COMPANION_MEMORY_TITLE_MAX && !!body && !memoryBodyTooLong(body);
+ };
+ const adopt = (next: CompanionMemoryDetail) => { base.current = next; accepted.current = null; setDetail(next); };
+ const conflict = (next: CompanionMemoryDetail) => { setLatest(next); setSaveState('conflict'); };
+ const markMissing = () => { setMissing(true); setSaveState('idle'); };
+
+ const save = async (): Promise<boolean> => {
+ const current = base.current;
+ if (!isDirty() || !current) return true;
+ if (inFlight.current || saveStateRef.current === 'conflict' || !isValid() || !o.online) return false;
+ inFlight.current = true; setBusy(true); setSaveState('saving'); setReceipt(null);
+ const started = generation.current; const stale = () => started !== generation.current;
+ const submitted = normalized(draftRef.current);
+ let expected = current.revision;
+ try {
+ // Renew the one-use host action only against the version this draft started from.
+ const fresh = await readDetail(current.resourceId);
+ if (stale()) return false;
+ if (fresh.revision !== current.revision && !(accepted.current && sameContent(fresh, accepted.current))) { conflict(fresh); return false; }
+ adopt(fresh); expected = fresh.revision;
+ const action = fresh.form?.action;
+ if (!action || action.disabled) { setSaveState('error'); return false; }
+ const input: Record<string, string> = {};
+ if (submitted.title !== normalized(fresh).title) input.title = submitted.title;
+ if (submitted.body !== normalized(fresh).body) input.body = submitted.body;
+ if (Object.keys(input).length) {
+ const response = await invokeRemoteResourceAction(o.invoke, { deviceId: o.deviceId, deviceName: o.deviceName },
+ { collectionId: o.collectionId, resourceRef: fresh.data.resource.ref, actionId: action.id, input }, locale);
+ if (stale()) return false;
+ const toast = response.effects.find(effect => effect.kind === 'toast');
+ if (toast?.kind === 'toast') setReceipt(toast.message);
+ accepted.current = submitted; listStale.current = true;
+ // The receipt is authoritative; a failed follow-up read only delays the new base version.
+ try { const next = await readDetail(current.resourceId); if (!stale()) adopt(next); } catch { /* keep `accepted` */ }
+ if (stale()) return false;
+ }
+ setSaveState('saved');
+ return true;
+ } catch (error) {
+ if (stale()) return false;
+ if (isNotFound(error)) { markMissing(); return false; }
+ // An ambiguous failure (e.g. lost acknowledgement) is reconciled by reading, never by replaying.
+ try {
+ const next = await readDetail(current.resourceId);
+ if (stale()) return false;
+ if (sameContent(next, submitted)) { adopt(next); listStale.current = true; setSaveState('saved'); return true; }
+ if (next.revision !== expected) { conflict(next); return false; }
+ } catch (readError) {
+ if (stale()) return false;
+ if (isNotFound(readError)) { markMissing(); return false; }
+ }
+ setSaveState('error');
+ return false;
+ } finally {
+ inFlight.current = false;
+ if (!stale()) setBusy(false);
+ }
+ };
+ const useLatest = () => {
+ if (!latest || inFlight.current) return;
+ adopt(latest); setDraft({ title: latest.title, body: latest.body }); setDraftGeneration(value => value + 1);
+ setLatest(null); setSaveState('idle');
+ };
+ const keepMine = async () => {
+ if (!latest || inFlight.current) return;
+ // The user has seen the newer version and still chooses theirs: save against that version.
+ adopt(latest); setLatest(null); setSaveState('idle');
+ await save();
+ };
+ const confirmDiscard = () => new Promise<boolean>(resolve => {
+ Alert.alert(t('devices.companions.automation.unsavedTitle'), t('devices.companions.automation.unsavedBody'), [
+ { text: t('devices.common.cancel'), style: 'cancel', onPress: () => resolve(false) },
+ { text: t('devices.companions.automation.discard'), style: 'destructive', onPress: () => resolve(true) },
+ ], { cancelable: true, onDismiss: () => resolve(false) });
+ });
+ /** Before leaving the editor: save when possible, otherwise the user decides to discard or stay. */
+ const settle = async (): Promise<boolean> => {
+ if (viewRef.current !== 'edit') return !inFlight.current;
+ if (await save()) return true;
+ if (inFlight.current) return false;
+ return confirmDiscard();
+ };
+ const done = async () => {
+ if (isDirty() && !isValid()) return;
+ if (await save()) { setLatest(null); setSaveState('idle'); setView('detail'); }
+ };
+ const finishDeleted = () => {
+ base.current = null; setDetail(null); listStale.current = true; setView('list');
+ void loadList(queryRef.current);
+ };
+ const performRemove = async (current: CompanionMemoryDetail) => {
+ if (inFlight.current || !o.online) return;
+ inFlight.current = true; setBusy(true); setDeleteFailed(false); setChanged(false); setReceipt(null);
+ const started = generation.current; const stale = () => started !== generation.current;
+ const changedMeanwhile = (next: CompanionMemoryDetail) => { adopt(next); setChanged(true); };
+ try {
+ const fresh = await readDetail(current.resourceId);
+ if (stale()) return;
+ if (fresh.revision !== current.revision) { changedMeanwhile(fresh); return; }
+ const action = fresh.remove?.action;
+ if (!action || action.disabled) { setDeleteFailed(true); return; }
+ const response = await invokeRemoteResourceAction(o.invoke, { deviceId: o.deviceId, deviceName: o.deviceName },
+ { collectionId: o.collectionId, resourceRef: fresh.data.resource.ref, actionId: action.id, input: {} }, locale);
+ if (stale()) return;
+ const toast = response.effects.find(effect => effect.kind === 'toast');
+ if (toast?.kind === 'toast') setReceipt(toast.message);
+ finishDeleted();
+ } catch (error) {
+ if (stale()) return;
+ if (isNotFound(error)) { finishDeleted(); return; }
+ try {
+ const next = await readDetail(current.resourceId);
+ if (stale()) return;
+ if (next.revision !== current.revision) { changedMeanwhile(next); return; }
+ } catch (readError) {
+ if (stale()) return;
+ if (isNotFound(readError)) { finishDeleted(); return; }
+ }
+ setDeleteFailed(true);
+ } finally {
+ inFlight.current = false;
+ if (!stale()) setBusy(false);
+ }
+ };
+ const remove = () => {
+ const current = detail; const action = current?.remove?.action;
+ if (!current || !action || inFlight.current) return;
+ const confirmation = action.confirmation;
+ Alert.alert(label(confirmation?.title ?? action.label), confirmation?.body ? label(confirmation.body) : undefined, [
+ { text: t('devices.common.cancel'), style: 'cancel' },
+ { text: label(confirmation?.confirmLabel ?? action.label), style: 'destructive', onPress: () => { void performRemove(current); } },
+ ]);
+ };
+ /** Sheet back: step out of edit, then detail; `false` means the list should leave the page. */
+ const back = async (): Promise<boolean> => {
+ if (inFlight.current) return true;
+ if (viewRef.current === 'edit') {
+ if (!(await settle())) return true;
+ if (base.current) setDraft({ title: base.current.title, body: base.current.body });
+ setLatest(null); setSaveState('idle'); setView('detail');
+ return true;
+ }
+ if (viewRef.current === 'detail') {
+ setView('list'); setDetail(null); setMissing(false); setChanged(false); setDeleteFailed(false);
+ if (listStale.current || !list) void loadList(queryRef.current);
+ return true;
+ }
+ return false;
+ };
+ const retry = () => {
+ if (inFlight.current) return;
+ if (viewRef.current === 'list') void loadList(queryRef.current);
+ else if (detailId) void loadDetail(detailId);
+ };
+
+ const dirty = view === 'edit' && !!base.current && !sameContent(draft, base.current);
+ const content = normalized(draft);
+ return {
+ view, query, setQuery, busy, dirty, receipt: receipt ? label(receipt) : null,
+ groups: companionMemoryGroups(list, locale),
+ searchPanel: list?.panels.find(panel => panel.primitive === 'search'),
+ listLoaded: !!list, listLoading, listFailed,
+ detail, detailFailed, missing, changed, deleteFailed,
+ draft, draftGeneration, saveState, latest,
+ titleMissing: !content.title, bodyMissing: !content.body, tooLong: memoryBodyTooLong(draft.body),
+ open, edit, change, done, useLatest, keepMine: () => { void keepMine(); }, remove, back, flush: settle, retry,
+ };
+}
+export type CompanionMemoryState = ReturnType<typeof useCompanionMemory>;
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index 825be11288..ba7b3878c7 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -55,13 +55,13 @@
| `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, 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, WorkingStatusText, [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/WorkingStatusText.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 | 306 |
+| `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, CompanionMemoryPage, CompanionMemoryPage.ios, 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, WorkingStatusText, [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/CompanionMemoryPage.ios.tsx, apps/mobile/src/session/CompanionMemoryPage.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/WorkingStatusText.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 | 309 |
| `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, 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, 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/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/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 | 56 |
| `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 |
| `mobile.devices` | mobile | 主机详情 | app/devices/[deviceId].tsx | AccountSwitcherSheet, AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, IncomingShareBridge, LoginNativeButton, LoginNativeButton.ios, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, MobileVendorIcon, ModalContentArea, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteAccessGuide, 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, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, TaskTags, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/[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/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/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.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/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/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.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/ConversationSearchFilterSheet.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/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.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/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/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.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 | 113 |
| `mobile.files` | mobile | 任务文件与预览 | app/files/[sessionId].tsx / app/files/preview/[sessionId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FileTypeIcon, FileTypeTile, FoldTouchpad, HomeEntryProvider, HtmlBrowserChrome, HtmlBrowserChrome.ios, HtmlFileReader, HtmlWebsiteBrowser, ImageLightbox, IncomingShareBridge, MarkdownFileReader, 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, ResidentHomeList, SheetModal, SheetSurface, StartupSplashOverlay, SystemNavigationBack, ThemeProvider, [sessionId], _layout, gestureHandler, mediaPlayerWebView, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/files/[sessionId].tsx, apps/mobile/app/files/preview/[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/FileTypeTile.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/ModalContentArea.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/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/HtmlBrowserChrome.ios.tsx, apps/mobile/src/session/HtmlBrowserChrome.tsx, apps/mobile/src/session/HtmlFileReader.tsx, apps/mobile/src/session/HtmlWebsiteBrowser.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MarkdownFileReader.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/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, 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 | 79 |
-| `mobile.home` | mobile | 主机与资源首页 | app/index.tsx / app/devices/index.tsx | AccountSwitcherSheet, AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionModelChain, CompanionNativeContent.ios, CompanionPortraitPicker, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModePanes, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, IncomingShareBridge, LoginNativeButton, LoginNativeButton.ios, MobileAgentMark, MobileAgentSwitcher, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, 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, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, TaskTags, TeammateCreateButton, TeammateGenerationLabel, TeammateHomeScreen, TeammateList, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, WorkingStatusText, _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/index.tsx, apps/mobile/app/index.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/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/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/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/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionModelChain.tsx, apps/mobile/src/session/CompanionNativeContent.ios.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/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/ConversationSearchFilterSheet.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/HomeModePanes.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/IncomingShareBridge.tsx, apps/mobile/src/session/MobileAgentSwitcher.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/NativeResidentHistory.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/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/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TeammateCreateButton.tsx, apps/mobile/src/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateHomeScreen.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/WorkingStatusText.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 | 136 |
+| `mobile.home` | mobile | 主机与资源首页 | app/index.tsx / app/devices/index.tsx | AccountSwitcherSheet, AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionMemoryPage, CompanionMemoryPage.ios, CompanionModelChain, CompanionNativeContent.ios, CompanionPortraitPicker, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModePanes, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, IncomingShareBridge, LoginNativeButton, LoginNativeButton.ios, MobileAgentMark, MobileAgentSwitcher, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, 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, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, TaskTags, TeammateCreateButton, TeammateGenerationLabel, TeammateHomeScreen, TeammateList, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, WorkingStatusText, _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/index.tsx, apps/mobile/app/index.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/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/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/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/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionMemoryPage.ios.tsx, apps/mobile/src/session/CompanionMemoryPage.tsx, apps/mobile/src/session/CompanionModelChain.tsx, apps/mobile/src/session/CompanionNativeContent.ios.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/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/ConversationSearchFilterSheet.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/HomeModePanes.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/IncomingShareBridge.tsx, apps/mobile/src/session/MobileAgentSwitcher.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/NativeResidentHistory.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/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/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TeammateCreateButton.tsx, apps/mobile/src/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateHomeScreen.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/WorkingStatusText.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 | 139 |
| `mobile.overlay.connection-startup` | mobile | 根布局挂载的启动与连接反馈 | app/_layout.tsx → StartupSplashOverlay / ConnectionNoticeProvider;各页面 ConnectionBanner | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ConnectionNoticeProvider, 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, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.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/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/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 | 50 |
| `mobile.remote-desktop` | mobile | 远程桌面 | app/devices/desktop/[deviceId].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, SheetModal, SheetSurface, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/desktop/[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/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/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/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 | 50 |
| `mobile.resources` | mobile | 远程资源列表与详情 | app/resources/[collectionId].tsx / app/resources/[collectionId]/[resourceId].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, 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, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, TeammateGenerationLabel, TeammateList, ThemeProvider, WorkingStatusText, [collectionId], [resourceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/resources/[collectionId].tsx, apps/mobile/app/resources/[collectionId]/[resourceId].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/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/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/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/WorkingStatusText.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 | 63 |
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index 61c696c9f3..0835f421d7 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -407,3 +407,19 @@ canonical 主任务时,宿主额外追加 `resourceCollectionId=teammates&reso
会话来源与主机校验;这些参数不授予任何权限。已发布的手机版本本来就识别这组参数,不需要升级;
不识别它们的旧控制端仍按普通任务打开。拼接后超过 `NOTIFY_DEEP_LINK_MAX_LENGTH` 时回退为原深链。
委派的独立 Session 任务和普通任务不带这组参数。不修改 notify 帧结构、relay 或协议版本。
+
+## 伙伴记忆远程页面与资源内搜索
+
+伙伴设置主资源(声明 `form` 的控制端)追加 `memories` list 块,入口指向 `settings:<botId>/memory`;
+原 `memory` 表单(开关与 USER.md)不变。列表页按类别输出多个 `list` 块:块 `title` 为类别名,`data.count`
+为该类条数,条目追加可选 `subtitle`(正文开头)与 `timestamp`(毫秒)。详情页
+`settings:<botId>/memory/<entry>` 由 `entry` 表单(标题、正文)与 `remove` 动作组成,revision 即该条
+`updatedAt`,动作经既有 `bindResource` 绑定该值;主机服务在存储锁内再次核对。`entry` 取文件名去掉
+`.md`,拼出的 id 超过 160 字符时改为 `h<12 位摘要>`。记忆已不存在时回 registry `NOT_FOUND`,其余 provider
+失败仍按既有边界显示为 `INTERNAL`,控制端据复读判断冲突,不依赖错误码。
+
+`maker:remote-resources:get` 请求可选携带 `query`(同 list,最长 1000 字符,空串等同未传)。新增可移植
+原语 `search`:主机只对声明 `search` 的控制端输出该块(`data.query`、`data.placeholder`),控制端仅在看到
+该块后带 `query` 重读同一资源。旧控制端不声明也不传 `query`,列表页原样可用;旧主机忽略 `query`,也不
+提供记忆页面,新手机显示原有升级提示。未新增 channel、relay 类型、allowlist、权限、数据库迁移或
+Mobile 原生 fingerprint 输入,服务端无需改动。
diff --git a/docs/product-rules/cindy-bots-runtime.md b/docs/product-rules/cindy-bots-runtime.md
index 48e51ac2e4..722c93d12c 100644
--- a/docs/product-rules/cindy-bots-runtime.md
+++ b/docs/product-rules/cindy-bots-runtime.md
@@ -197,7 +197,14 @@ harness + provider + model + effort + fastMode
按关于你 / 你的要求 / 项目 / 参考分组列出标题与正文开头,搜索复用记忆检索,内部 `digest` 不展示;
详情显示全文,编辑自动保存,单条标题与正文沿用存储上限。改正文时摘要按正文首句确定性刷新,
不调用模型。保存与删除前核对打开时的更新时间,伙伴期间改过则不覆盖,由用户选择最新内容或
- 保留自己的修改;改动合并后请求主任务在安全边界刷新记忆目录。手机端记忆列表另行跟进。
+ 保留自己的修改;改动合并后请求主任务在安全边界刷新记忆目录。
+ 手机(iOS 与 Android)与桌面设备互联控制端读写伙伴所在电脑的同一份记忆:「记忆」页保留开关与
+ 「关于我的记忆」表单,主机提供「已存记忆」页面时在下方进入,同样按四类分组显示条数、标题、正文开头与
+ 日期,并用同一记忆检索搜索;详情显示全文与类别、更新时间。手机编辑在点「完成」或返回、关闭时保存,
+ 不逐字自动保存,标题与正文沿用同样上限;删除经系统确认,文案带伙伴名与记忆标题。保存与删除前先复读,
+ 更新时间变了就不覆盖、不删除:编辑时由用户选「用最新内容」或「保留我的修改」,删除时先展示最新内容。
+ 远程读写与本机设置页共用同一个记忆服务实例,内部 `digest`、摘要与文件路径不离开主机;主机未提供
+ 该页面时,手机显示原有升级提示。实现见 Mobile `CompanionMemoryPage` 与 Desktop `botRemoteMemory.ts`。
### 6.1 后台任务与伙伴消息:两条边界,不做混合 action
diff --git a/packages/device-link/src/__tests__/remoteResources.test.ts b/packages/device-link/src/__tests__/remoteResources.test.ts
index c41f49feda..e40f426b6d 100644
--- a/packages/device-link/src/__tests__/remoteResources.test.ts
+++ b/packages/device-link/src/__tests__/remoteResources.test.ts
@@ -64,6 +64,18 @@ describe('remote resource request parsing', () => {
.toBeNull();
});
+ it('passes a bounded optional search query through resource reads', () => {
+ const ref = { collectionId: 'teammates', kind: 'bot', id: 'settings:bot-1/memory' };
+ expect(parseRemoteResourceGetRequest({ client, ref, query: '咖啡' })).toEqual({
+ client: { protocolVersion: 1, primitives: ['markdown', 'action'], locale: 'zh-CN' }, ref, query: '咖啡',
+ });
+ // Old controllers never send it; an empty query is the same as no filter.
+ expect(parseRemoteResourceGetRequest({ client, ref })).not.toHaveProperty('query');
+ expect(parseRemoteResourceGetRequest({ client, ref, query: '' })).not.toHaveProperty('query');
+ expect(parseRemoteResourceGetRequest({ client, ref, query: 42 })).toBeNull();
+ expect(parseRemoteResourceGetRequest({ client, ref, query: 'x'.repeat(1_001) })).toBeNull();
+ });
+
it('validates generic invalidation payload scope', () => {
expect(parseRemoteResourceChangedPayload({
collectionId: 'teammates',
diff --git a/packages/device-link/src/remoteResources.ts b/packages/device-link/src/remoteResources.ts
index cd46a25fbe..f2a8fdc9eb 100644
--- a/packages/device-link/src/remoteResources.ts
+++ b/packages/device-link/src/remoteResources.ts
@@ -131,6 +131,8 @@ export interface RemoteResourceBlock {
/** session-controls: { input: 'blocked' | 'available', busy: boolean }.
* Controllers may hide their composer while blocked. Hosts must independently
* enforce workspace use; this presentation hint never grants permission.
+ * search: { query?: string, placeholder?: RemoteText }. Sent only to controllers
+ * declaring `search`; they re-read the same resource with `RemoteResourceGetRequest.query`.
*/
data?: unknown;
}
@@ -188,6 +190,12 @@ export interface RemoteCollectionListResponse {
export interface RemoteResourceGetRequest {
client: RemoteResourceClientDescriptor;
ref: RemoteResourceRef;
+ /**
+ * Optional filter for a resource that advertised a `search` block. Hosts that do
+ * not understand it ignore it and return the unfiltered resource; controllers
+ * only send it after the host declared searchability.
+ */
+ query?: string;
}
export interface RemoteActionInvokeRequest {
@@ -344,7 +352,11 @@ export function parseRemoteResourceGetRequest(value: unknown): RemoteResourceGet
if (!record) return null;
const client = parseRemoteResourceClientDescriptor(record.client);
const ref = parseRemoteResourceRef(record.ref);
- return client && ref ? { client, ref } : null;
+ if (!client || !ref) return null;
+ // Same bound as collection list queries; an empty query means "no filter".
+ if (record.query === undefined || record.query === '') return { client, ref };
+ const query = boundedText(record.query, MAX_QUERY_CHARS);
+ return query ? { client, ref, query } : null;
}
export function parseRemoteActionInvokeRequest(value: unknown): RemoteActionInvokeRequest | null {