Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): synchronize Cindy Make workflow cards
Lizidd316fcb5499
diff --git a/apps/desktop/src/main/bootstrap-electron.ts b/apps/desktop/src/main/bootstrap-electron.tsindex 3540219c6e..89fb4dba99 100644--- a/apps/desktop/src/main/bootstrap-electron.ts+++ b/apps/desktop/src/main/bootstrap-electron.ts@@ -364,7 +364,8 @@ import {isCindyMakeManagedWorktreePath,} from './cindy-make/sourcePaths.js';import { prepareCindyMakeWorkspace } from './cindy-make/taskWorkspace.js';-import { restoreCindyMakeTaskState, startCindyMakeTask } from './cindy-make/taskRuntime.js';+import { restoreCindyMakeTaskState, startCindyMakeTask, configureCindyMakeEditingGuard } from './cindy-make/taskRuntime.js';+import { registerMakeRemoteResources } from './cindy-make/remoteRuntime.js';import {configureCindyMakeTaskManagement,manageCindyMakeTask,@@ -7639,6 +7640,8 @@ const registerIpcHandlers = () => {configureCindyMakeTestRuntime((id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false,);+ configureCindyMakeEditingGuard((id) => cindyMakeTestController.isUsingSession(id));+ registerMakeRemoteResources((id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false);configureMakeHistory((id) => getMakerIfReady()?.getSession(id)?.isTurnRunning() ?? false);ipcMain.handle('app:cindy-make-history', async (event, selected?: unknown) => {assertTrustedAppRendererEvent(event);diff --git a/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.tsindex 1a990b21ff..adc749b993 100644--- a/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts+++ b/apps/desktop/src/main/cindy-make/__tests__/historyRuntime.test.ts@@ -18,6 +18,10 @@ const h = vi.hoisted(() => ({artifactPath: vi.fn(),showItem: vi.fn(),build: vi.fn(),+ testBuild: undefined as+ | { buildId: string; status: string; stopping?: boolean }+ | undefined,+ cancelTestBuild: vi.fn(),}));const store = {readBuild: vi.fn(),@@ -73,7 +77,12 @@ vi.mock('../upstreamMergeRuntime.js', () => ({vi.mock('../taskManagement.js', () => ({ manageCindyMakeTask: h.end }));vi.mock('../testRuntime.js', () => ({actCindyMakeTest: vi.fn(),- cindyMakeTestController: { hasActiveJobs: () => false, isBuilding: () => false },+ cindyMakeTestController: {+ hasActiveJobs: () => !!h.testBuild,+ isBuilding: () => !!h.testBuild,+ activeBuild: () => h.testBuild,+ cancelBuild: h.cancelTestBuild,+ },}));vi.mock('../testRunner.js', () => ({ verifyMakeTestWorkspace: h.verify }));vi.mock('../personalBuild.js', () => ({@@ -95,14 +104,8 @@ vi.mock('../sourceGit.js', () => ({runSourceGit: async (_env: unknown, args: string[]) =>args[0] === 'branch' ? 'cindy-personal' : '',}));-vi.mock('../manager.js', () => ({- cindyMakeManager: {- getState: () => h.state,- hasActiveWork: () => h.busy,- isTaskPreparing: () => false,- withProjectUse: async (_root: string, operation: () => unknown) => operation(),- },-}));+import { cindyMakeManager } from '../manager';+const realHasActiveWork = cindyMakeManager.hasActiveWork.bind(cindyMakeManager);import { sessions } from '../../localDb/schema';import {configureMakeHistory,@@ -148,10 +151,16 @@ beforeEach(() => {h.current = true;h.running = false;h.busy = false;+ h.testBuild = undefined;+ h.cancelTestBuild.mockReset();+ vi.spyOn(cindyMakeManager, 'getState').mockImplementation(() => h.state);h.exists = true;h.records.clear();h.state = {};h.verify.mockResolvedValue(undefined);+ vi.spyOn(cindyMakeManager, 'hasActiveWork').mockImplementation(+ () => h.busy || realHasActiveWork(),+ );configureMakeHistory(() => h.running);h.rows = [{@@ -186,6 +195,65 @@ beforeEach(() => {];});describe('history Main admission and owner boundary', () => {+ it('releases history integration and builds after real manager preparation and failed cleanup settle', async () => {+ const runId = 'prepared-history';+ const report = {+ runId,+ platform: 'win32',+ arch: 'x64',+ checks: [],+ status: 'running' as const,+ task: { sessionId: 'prepared-session', phase: 'waiting' as const },+ };+ let release!: () => void;+ await cindyMakeManager.startTask(+ { runId, request: 'fix', title: 'fix' },+ {+ create: async () => report,+ persist: async () => {},+ start: async () => {},+ prepare: () =>+ new Promise<void>((resolve) => {+ release = resolve;+ }),+ isCurrent: () => true,+ onError: () => {},+ },+ );+ expect((await getCindyMakeHistory('aaaa')).busy).toBe(true);+ release();+ await cindyMakeManager.waitForTask(runId);+ expect(cindyMakeManager.taskReport(runId)?.status).toBe('completed');+ await expect(+ cindyMakeManager.runTaskAction(+ 'failed-cleanup',+ 'delete',+ () => true,+ async () => {+ throw new Error('locked');+ },+ ),+ ).rejects.toThrow('locked');+ const state = await getCindyMakeHistory('aaaa');+ expect(state).toMatchObject({ busy: false, canBuild: true });+ expect(state.items[0].actions).toContain('integrate');+ cindyMakeManager.forgetTask(runId);+ });+ it('shows and stops a completion-card build by the same identity without marking it interrupted', async () => {+ h.testBuild = { buildId: 'card-build', status: 'packaging' };+ store.readBuild.mockImplementation(() => h.testBuild);+ expect(await getCindyMakeHistory()).toMatchObject({ busy: true, build: h.testBuild });+ expect(store.saveBuild).not.toHaveBeenCalled();+ await cancelHistoryPersonalVersion('old-build');+ expect(h.cancelTestBuild).not.toHaveBeenCalled();+ h.cancelTestBuild.mockImplementation(async () => {+ h.testBuild!.stopping = true;+ });+ expect(await cancelHistoryPersonalVersion('card-build')).toMatchObject({+ build: { stopping: true },+ });+ expect(h.cancelTestBuild).toHaveBeenCalledWith('card-build');+ });it('settles a failed background build with its known cause and releases controls for retry', async () => {let buildState: any;store.readBuild.mockImplementation(() => buildState);diff --git a/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.ts b/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.tsnew file mode 100644index 0000000000..db53f2d7a5--- /dev/null+++ b/apps/desktop/src/main/cindy-make/__tests__/remoteProvider.test.ts@@ -0,0 +1,187 @@+import { describe, expect, it, vi } from 'vitest';+import { projectMakeRemoteCard, makeRemoteRef, type MakeRemoteSnapshot } from '../remoteProjection';+import { createMakeRemoteProvider } from '../remoteProvider';+import { RemoteResourceRegistry } from '../../device-link/remoteResourceRegistry';+import en from '../../../renderer/i18n/locales/en/common.json';+import zh from '../../../renderer/i18n/locales/zh-CN/common.json';+import tw from '../../../renderer/i18n/locales/zh-TW/common.json';+import ja from '../../../renderer/i18n/locales/ja/common.json';+import ko from '../../../renderer/i18n/locales/ko/common.json';++const context = { controllerDeviceId: 'phone' };+const client = { protocolVersion: 1, primitives: ['session-controls'], locale: 'en' };+const snapshot = (): MakeRemoteSnapshot => ({+ sessionId: 'task',+ revision: 'revision',+ busy: false,+ recoverable: false,+ completion: { id: 'done', meta: { reportedAt: 1, commit: 'a'.repeat(40) } },+});+const project = (state: MakeRemoteSnapshot, dictionary: Record<string, unknown> = en) =>+ projectMakeRemoteCard(state, (key, values) => {+ const text = key+ .split('.')+ .reduce<unknown>((value, part) => (value as Record<string, unknown>)?.[part], dictionary);+ expect(typeof text, key).toBe('string');+ return Object.entries(values ?? {}).reduce(+ (text, [name, value]) => text.replaceAll('{{' + name + '}}', value),+ text as string,+ );+ });++describe('portable Cindy Make cards', () => {+ it.each([en, zh, tw, ja, ko])(+ 'translates preparation, test steps, failure and recovery without leaking local details',+ (dictionary) => {+ const state = snapshot();+ state.preparation = {+ runId: 'run',+ platform: 'win32',+ arch: 'x64',+ status: 'running',+ checks: [+ {+ id: 'node',+ status: 'downloading',+ path: 'C:/private/tool',+ progress: { loaded: 5, total: 10, percent: 50 },+ },+ ],+ task: {+ sessionId: 'task',+ phase: 'dependencies',+ request: 'private prompt',+ dependencies: { added: 2 },+ },+ };+ const prep = project(state, dictionary);+ expect(prep.blocks?.[0].data).toMatchObject({ input: 'blocked', busy: true });+ expect(prep.actions?.[0].id).toBe('prepare:run:stop');+ expect(JSON.stringify(prep)).not.toContain('private');+ expect(prep.blocks?.[0].fallbackMarkdown).toContain('50%');+ state.preparation.status = 'failed';+ state.preparation.task!.phase = 'completed';+ expect(project(state, dictionary).actions?.[0].id).toBe('prepare:run:retry');+ delete state.preparation;+ state.completion!.meta.test = { status: 'starting', step: 'dependencies' };+ const starting = project(state, dictionary);+ expect(starting.actions?.every((action) => action.disabled)).toBe(true);+ expect(starting.blocks?.[0].data).toMatchObject({ input: 'blocked', busy: true });+ state.completion!.meta.test = {+ status: 'failed',+ step: 'dependencies',+ error: 'environment',+ };+ const failed = project(state, dictionary);+ expect(failed.display.status?.tone).toBe('critical');+ expect(failed.actions?.find((action) => action.id === 'test:done:start')?.disabled).toBe(+ false,+ );+ state.completion!.meta.continuedAt = 2;+ state.recoverable = true;+ const resumed = project(state, dictionary);+ expect(resumed.blocks?.[0].data).toMatchObject({ input: 'available' });+ expect(resumed.actions?.map((action) => action.id)).toEqual(['resume:revision']);+ },+ );++ it('locks editing during the shared build and identifies the exact build to stop', () => {+ const state = snapshot();+ state.sharedBuild = { buildId: 'build', status: 'checking', checkStep: 'dependencies' };+ const card = project(state);+ expect(card.actions?.slice(0, 3).every((action) => action.disabled)).toBe(true);+ expect(card.actions?.at(-1)).toMatchObject({ id: 'build:build:stop', disabled: false });+ state.sharedBuild.stopping = true;+ expect(project(state).actions?.at(-1)?.disabled).toBe(true);+ });++ it('keeps the current test visible over an older build receipt', () => {+ const state = snapshot();+ state.completion!.meta.lastAction = 'test';+ state.completion!.meta.test = { status: 'starting', step: 'launching' };+ state.sharedBuild = { status: 'ready', buildId: 'old' };+ expect(project(state).display.title).toBe(en.cindyMake.test.status.starting);+ state.busy = true;+ expect(project(state).actions).toEqual([]);+ expect(project(state).blocks).toEqual([]);+ });+});++describe('host validates portable task actions', () => {+ function harness() {+ const state = snapshot();+ let current = true;+ const act = vi.fn(async () => {});+ const registry = new RemoteResourceRegistry();+ registry.register(+ createMakeRemoteProvider({+ load: async () => ({ snapshot: state, isCurrent: () => current }),+ translate: (_locale, key) => key,+ act,+ }),+ );+ const invoke = (actionId: string) =>+ registry.invoke(context, {+ client,+ collectionId: 'cindy-make',+ resourceRef: makeRemoteRef('task'),+ actionId,+ });+ return {+ state,+ act,+ registry,+ invoke,+ changeOwner: () => {+ current = false;+ },+ };+ }+ it('rejects stale completion, arbitrary actions and disabled startup actions', async () => {+ const h = harness();+ await expect(h.invoke('test:previous:start')).rejects.toThrow('Task changed');+ await expect(h.invoke('delete-everything')).rejects.toThrow('Task changed');+ h.state.completion!.meta.test = { status: 'starting' };+ await expect(h.invoke('test:done:continue')).rejects.toThrow('Task changed');+ expect(h.act).not.toHaveBeenCalled();+ });+ it('does not dispatch a prior owner or a superseded recovery revision', async () => {+ const h = harness();+ h.state.completion = undefined;+ h.state.recoverable = true;+ await expect(h.invoke('resume:old')).rejects.toThrow('Task changed');+ h.changeOwner();+ await expect(h.invoke('resume:revision')).rejects.toThrow('Task changed');+ expect(h.act).not.toHaveBeenCalled();+ });+ it('coalesces two controllers and returns only invalidation effects', async () => {+ const h = harness();+ let finish!: () => void;+ h.act.mockImplementationOnce(+ () =>+ new Promise<void>((resolve) => {+ finish = resolve;+ }),+ );+ const first = h.invoke('test:done:start');+ await vi.waitFor(() => expect(h.act).toHaveBeenCalledOnce());+ await expect(h.invoke('test:done:start')).rejects.toThrow('already running');+ finish();+ await expect(first).resolves.toEqual({+ effects: [{ kind: 'refresh-resource', ref: makeRemoteRef('task') }],+ });+ expect(h.act).toHaveBeenCalledOnce();+ });+ it('rejects resources outside the registered kind', async () => {+ const h = harness();+ await expect(+ h.registry.invoke(context, {+ client,+ collectionId: 'cindy-make',+ resourceRef: { ...makeRemoteRef('task'), kind: 'bot' },+ actionId: 'test:done:start',+ }),+ ).rejects.toThrow('does not exist');+ expect(h.act).not.toHaveBeenCalled();+ });+});diff --git a/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.tsnew file mode 100644index 0000000000..57379d3472--- /dev/null+++ b/apps/desktop/src/main/cindy-make/__tests__/remoteRuntime.test.ts@@ -0,0 +1,210 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';+import type { MakeDoctorReport } from '../../../shared/cindyMakeDoctor';+import type { RemoteResourceProvider } from '../../device-link/remoteResourceRegistry';++const h = vi.hoisted(() => ({+ owner: 1,+ running: false,+ session: {} as Record<string, unknown>,+ rows: [] as Array<{ clientId: string; role: string; agentMeta: string | null }>,+ prep: undefined as MakeDoctorReport | undefined,+ restore: vi.fn(),+ test: vi.fn(),+ history: vi.fn(),+ start: vi.fn(),+ stop: vi.fn(),+ send: vi.fn(),+ changed: vi.fn(),+ readBuild: vi.fn(),+ cancel: vi.fn(),+ beforeRead: vi.fn(),+}));+vi.mock('../../localDb/client/current.js', () => ({ getDbClient: () => clientDb }));+vi.mock('../../device-link/broadcast-tap.js', () => ({+ captureDataOwnerBroadcastScope: () => ({ ownerScopeKey: String(h.owner) }),+ isDataOwnerBroadcastScopeCurrent: (scope: { ownerScopeKey: string }) =>+ scope.ownerScopeKey === String(h.owner),+}));+vi.mock('../../i18n.js', () => ({ t: (key: string, locale: string) => locale + ':' + key }));+vi.mock('../manager.js', () => ({+ cindyMakeManager: {+ getState: () => ({ tasks: h.prep ? { run: h.prep } : {} }),+ cancelTasksForSession: h.cancel,+ },+}));+vi.mock('../taskRuntime.js', () => ({+ restoreCindyMakeTaskState: h.restore,+ dispatchCindyMakeTask: h.send,+ startCindyMakeTask: h.start,+}));+vi.mock('../testRuntime.js', () => ({ actCindyMakeTest: h.test }));+vi.mock('../historyRuntime.js', () => ({+ getCindyMakeHistory: h.history,+ cancelHistoryPersonalVersion: h.stop,+ readCindyMakeBuildState: h.readBuild,+}));+vi.mock('../remoteBroadcast.js', () => ({ broadcastMakeRemoteChanged: h.changed }));+import { sessions } from '../../localDb/schema';+import { remoteResourceRegistry } from '../../device-link/remoteResourceRegistry';+import { registerMakeRemoteResources } from '../remoteRuntime';++const clientDb = {+ drizzle: {+ select: () => {+ let sessionTable = false;+ const query = {+ from: (table: unknown) => {+ sessionTable = table === sessions;+ return query;+ },+ where: () => query,+ orderBy: () => query,+ limit: async () => {+ await h.beforeRead(sessionTable);+ return structuredClone(sessionTable ? [h.session] : h.rows);+ },+ };+ return query;+ },+ },+};+const context = { controllerDeviceId: 'phone' };+const client = { protocolVersion: 1, primitives: ['session-controls'], locale: 'ja' };+const ref = { collectionId: 'cindy-make', kind: 'session', id: 'task' };+let provider: RemoteResourceProvider;+const get = () => provider.get!(context, { client, ref });+const invoke = (actionId: string) =>+ provider.invoke!(context, { client, collectionId: ref.collectionId, resourceRef: ref, actionId });+const completion = (continuedAt?: number) => ({+ clientId: 'done',+ role: 'assistant',+ agentMeta: JSON.stringify({+ cindyMakeCompletion: { reportedAt: 1, commit: 'a'.repeat(40), continuedAt },+ }),+});+beforeEach(() => {+ vi.restoreAllMocks();+ vi.resetAllMocks();+ h.owner = 1;+ h.running = false;+ h.prep = undefined;+ h.session = {+ id: 'task',+ status: 'active',+ source: 'cindy-make',+ workingDir: '/managed/task',+ agentKind: 'codex',+ model: 'chosen',+ lastTurnEndedAt: 10,+ };+ h.rows = [completion()];+ h.restore.mockResolvedValue(undefined);+ h.test.mockImplementation(+ async (_id, completionId) =>+ JSON.parse(h.rows.find((row) => row.clientId === completionId)!.agentMeta!)+ .cindyMakeCompletion,+ );+ vi.spyOn(remoteResourceRegistry, 'register').mockImplementation((next) => {+ provider = next;+ return () => {};+ });+ registerMakeRemoteResources(() => h.running);+});++describe('Cindy Make mobile host adapter', () => {+ it('restores preparation once per owner and normalizes a persisted interrupted test through the shared controller', async () => {+ h.test.mockResolvedValue({+ reportedAt: 1,+ commit: 'a'.repeat(40),+ test: { status: 'stopped', step: 'assets', error: 'interrupted' },+ });+ const card = await get();+ expect(h.test).toHaveBeenCalledWith('task', 'done', 'status');+ expect(card.blocks?.[0].fallbackMarkdown).toContain('cindyMake.test.failedStep');+ await get();+ expect(h.restore).toHaveBeenCalledOnce();+ h.owner += 1;+ await get();+ expect(h.restore).toHaveBeenCalledTimes(2);+ });+ it('keeps Continue Editing and a later successful reply recoverable, but not an interrupted reply', async () => {+ h.rows = [completion(2)];+ expect((await get()).actions?.[0].id).toMatch(/^resume:/);+ expect(h.test).not.toHaveBeenCalled();+ h.rows = [+ { clientId: 'reply', role: 'assistant', agentMeta: JSON.stringify({ turnCompleted: true }) },+ { clientId: 'user', role: 'user', agentMeta: null },+ completion(),+ ];+ const card = await get();+ expect(card.actions?.[0].id).toMatch(/^resume:/);+ await invoke(card.actions![0].id);+ expect(h.send).toHaveBeenCalledWith(+ 'task',+ 'ja:cindyMake.test.resume.request',+ expect.objectContaining({ model: 'chosen', agentKind: 'codex', workingDir: '/managed/task' }),+ expect.any(Function),+ expect.any(String),+ );+ h.rows[0].agentMeta = JSON.stringify({ turnCompleted: false });+ expect((await get()).actions).toEqual([]);+ });+ it('does not show a previous completion after a new user message or offer actions during execution', async () => {+ h.rows.unshift({ clientId: 'user', role: 'user', agentMeta: null });+ expect((await get()).actions).toEqual([]);+ h.rows.shift();+ h.running = true;+ expect((await get()).actions).toEqual([]);+ });+ it.each([{ source: 'chat' }, { remoteHostId: 'ssh' }, { status: 'archived' }])(+ 'rejects a nonlocal or inactive Make task: %s',+ async (change) => {+ Object.assign(h.session, change);+ await expect(get()).rejects.toThrow('unavailable');+ expect(h.test).not.toHaveBeenCalled();+ },+ );+ it('rechecks identity after an asynchronous account switch before taking any action', async () => {+ h.beforeRead.mockImplementationOnce(async () => {+ h.owner += 1;+ });+ await expect(invoke('test:done:start')).rejects.toThrow('unavailable');+ expect(h.test).not.toHaveBeenCalled();+ });+ it('checks the action again if the desktop advances during the second load', async () => {+ let reads = 0;+ h.beforeRead.mockImplementation(async (sessionTable) => {+ if (sessionTable && ++reads === 2) h.rows = [completion(2)];+ });+ await expect(invoke('test:done:start')).rejects.toThrow('unavailable');+ expect(h.test.mock.calls.every((call) => call[2] === 'status')).toBe(true);+ expect(h.send).not.toHaveBeenCalled();+ });+ it('offers retry for saved preparation failures through the normal preparation flow', async () => {+ h.session.lastTurnEndedAt = null;+ h.rows = [];+ h.prep = {+ runId: 'run',+ platform: 'win32',+ arch: 'x64',+ status: 'failed',+ checks: [],+ task: { sessionId: 'task', phase: 'dependencies' },+ };+ expect((await get()).actions?.[0].id).toBe('prepare:run:retry');+ h.history.mockResolvedValue({ items: [{+ runId: 'run', sessionId: 'task', request: 'original request', title: 'Original task',+ actions: ['retry-prepare'],+ }] });+ await invoke('prepare:run:retry');+ expect(h.start).toHaveBeenCalledWith({+ runId: 'run', request: 'original request', title: 'Original task',+ }, 0);+ h.history.mockImplementationOnce(async () => {+ h.owner += 1;+ return { items: [] };+ });+ await expect(invoke('prepare:run:retry')).rejects.toThrow('unavailable');+ expect(h.start).toHaveBeenCalledOnce();+ });+});diff --git a/apps/desktop/src/main/cindy-make/__tests__/taskLifecycle.test.ts b/apps/desktop/src/main/cindy-make/__tests__/taskLifecycle.test.tsindex 2b67b3d8c6..11995a09e2 100644--- a/apps/desktop/src/main/cindy-make/__tests__/taskLifecycle.test.ts+++ b/apps/desktop/src/main/cindy-make/__tests__/taskLifecycle.test.ts@@ -64,6 +64,56 @@ function sourceFixture() {}describe('Main-owned Cindy Make task lifecycle', () => {+ it('reserves one build across entry points and ignores an old release after retry', () => {+ const manager = new CindyMakeManager();+ const release = manager.claimPersonalBuild();+ expect(manager.hasActiveWork()).toBe(true);+ expect(() => manager.claimPersonalBuild()).toThrow('personal build is running');+ release();+ const releaseRetry = manager.claimPersonalBuild();+ release();+ expect(manager.hasActiveWork()).toBe(true);+ releaseRetry();+ expect(manager.hasActiveWork()).toBe(false);+ });+ it.each(['completed', 'failed', 'cancelled'] as const)(+ 'keeps the lock through final persistence, then retains %s history without staying busy',+ async (status) => {+ const manager = new CindyMakeManager();+ const f = fixture();+ const persisted = deferred();+ f.lifecycle.persist = vi.fn(async (report) => {+ if (report.status !== 'running') await persisted.promise;+ });+ if (status === 'failed')+ f.lifecycle.start = async () => {+ throw new Error('dispatch failed');+ };+ const created = manager.startTask(f.input, f.lifecycle);+ expect(manager.hasActiveWork()).toBe(true);+ await created;+ if (status === 'cancelled') manager.cancel(f.input.runId, 1);+ f.gate.resolve();+ await vi.waitFor(() => expect(manager.taskReport(f.input.runId)?.status).toBe(status));+ expect(manager.hasActiveWork()).toBe(true);+ persisted.resolve();+ await manager.waitForTask(f.input.runId);+ expect(manager.hasActiveWork()).toBe(false);+ expect(manager.getState().tasks?.[f.input.runId]?.status).toBe(status);+ vi.mocked(f.lifecycle.isCurrent).mockReturnValue(false);+ expect(manager.hasActiveWork()).toBe(false);+ },+ );+ it('keeps cancelled old-owner work busy until its actual cleanup settles', async () => {+ const manager = new CindyMakeManager();+ const f = fixture();+ await manager.startTask(f.input, f.lifecycle);+ vi.mocked(f.lifecycle.isCurrent).mockReturnValue(false);+ expect(manager.hasActiveWork()).toBe(true);+ f.gate.resolve();+ await manager.waitForTask(f.input.runId);+ expect(manager.hasActiveWork()).toBe(false);+ });it('keeps one cleanup running without renderer subscribers and shares duplicate requests', async () => {const manager = new CindyMakeManager();const gate = deferred();@@ -109,6 +159,7 @@ describe('Main-owned Cindy Make task lifecycle', () => {status: 'failed',error: 'directoryBusy',});+ expect(manager.hasActiveWork()).toBe(false);const gate = deferred();const retry = manager.runTaskAction('session',diff --git a/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.tsindex 6a004ca5e8..3c7740f086 100644--- a/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts+++ b/apps/desktop/src/main/cindy-make/__tests__/taskRuntime.test.ts@@ -68,6 +68,7 @@ import {assertCindyMakeTaskReady,CINDY_MAKE_TASK_DISPATCH,configureCindyMakeTaskSender,+ configureCindyMakeEditingGuard,restoreCindyMakeTaskState,startCindyMakeTask,validateCindyMakeTaskStart,@@ -111,6 +112,7 @@ function initialReads() {}beforeEach(() => {+ configureCindyMakeEditingGuard(() => false);vi.restoreAllMocks();vi.clearAllMocks();harness.current = true;@@ -177,6 +179,66 @@ beforeEach(() => {});describe('Cindy Make task runtime', () => {+ it.each([false, true])(+ 'retries from history without origin identity after restart=%s',+ async (restart) => {+ const start = input();+ initialReads();+ harness.send.mockResolvedValueOnce({ accepted: false, reason: 'unavailable' });+ const sessionId = await startCindyMakeTask(start, 1);+ await cindyMakeManager.waitForTask(start.runId);+ const content = harness.cards.get('cindy-make-preparation-' + start.runId);+ if (restart) cindyMakeManager.forgetTask(start.runId);+ harness.reads.push(+ [+ {+ sessionId,+ status: 'active',+ content: JSON.stringify(content),+ clearedAt: null,+ createdAt: Date.now(),+ },+ ],+ () => [harness.rows[0]],+ );+ expect(await startCindyMakeTask({ ...start, originSessionId: undefined }, 2)).toBe(sessionId);+ await cindyMakeManager.waitForTask(start.runId);+ expect(cindyMakeManager.taskReport(start.runId)).toMatchObject({+ status: 'completed',+ task: { originSessionId: origin.id },+ });+ expect(harness.rows).toHaveLength(1);+ expect(harness.send).toHaveBeenCalledTimes(2);+ },+ );+ it.each([false, true])(+ 'rejects conflicting history retry identity after restart=%s',+ async (restart) => {+ const start = input();+ initialReads();+ harness.send.mockResolvedValueOnce({ accepted: false, reason: 'unavailable' });+ const sessionId = await startCindyMakeTask(start, 1);+ await cindyMakeManager.waitForTask(start.runId);+ const content = harness.cards.get('cindy-make-preparation-' + start.runId);+ if (restart) cindyMakeManager.forgetTask(start.runId);+ harness.reads.push(+ [],+ [+ {+ sessionId,+ status: 'active',+ content: JSON.stringify(content),+ clearedAt: null,+ createdAt: Date.now(),+ },+ ],+ );+ await expect(+ startCindyMakeTask({ ...start, originSessionId: 'different' }, 2),+ ).rejects.toThrow(/does not match/);+ expect(harness.send).toHaveBeenCalledOnce();+ },+ );it('creates exactly one task from home preferences and exposes it before dependencies finish', async () => {const start = {...input(),@@ -881,6 +943,16 @@ describe('Cindy Make task runtime', () => {},);+ it('blocks stale controller sends while a test owns the workspace, then permits editing after release', async () => {+ let held = true;+ configureCindyMakeEditingGuard((id) => held && id === 'testing');+ await expect(assertCindyMakeTaskReady('testing')).rejects.toThrow('before editing');+ expect(harness.select).not.toHaveBeenCalled();+ await expect(assertCindyMakeTaskReady('ordinary')).resolves.toBeUndefined();+ held = false;+ await expect(assertCindyMakeTaskReady('testing')).resolves.toBeUndefined();+ });+it('rejects remote origins and invalid run ids before creating a task', async () => {const start = input();expect(() => validateCindyMakeTaskStart({ ...start, runId: '../escape' })).toThrow();diff --git a/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testController.test.tsindex 1d29c0bcff..26025953a4 100644--- a/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts+++ b/apps/desktop/src/main/cindy-make/__tests__/testController.test.ts@@ -52,7 +52,7 @@ function harness(initial: Partial<CindyMakeCompletionMeta> = {}) {meta = { ...meta, ...patch };return meta;});- const launch = vi.fn(async (_context, signal: AbortSignal) => {+ const launch = vi.fn<MakeTestControllerDeps['launch']>(async (_context, signal) => {signal.addEventListener('abort', stop, { once: true });return { ready: ready.promise, closed: closed.promise, stop };});@@ -92,6 +92,62 @@ function harness(initial: Partial<CindyMakeCompletionMeta> = {}) {afterEach(() => vi.useRealTimers());describe('Main-owned Cindy Make test lifecycle', () => {+ it('blocks Continue Editing during startup, then allows it once the test is ready', async () => {+ const h = harness();+ await h.controller.act('session', 'completion', 'start');+ await expect(h.controller.act('session', 'completion', 'continue')).rejects.toMatchObject({+ code: 'unavailable',+ });+ expect(h.stop).not.toHaveBeenCalled();+ expect(h.meta().continuedAt).toBeUndefined();+ h.ready.resolve();+ await vi.waitFor(() => expect(h.meta().test?.status).toBe('ready'));+ await h.controller.act('session', 'completion', 'continue');+ expect(h.controller.isUsingSession('session')).toBe(false);+ expect(h.leased()).toBe(false);+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ expect(h.meta().continuedAt).toBe(123);+ });+ it('orders slow progress writes before readiness and ignores progress after readiness', async () => {+ const h = harness();+ const persistence = deferred<void>();+ const original = h.save.getMockImplementation()!;+ h.save.mockImplementation(async (context, patch) => {+ if (patch.test?.step === 'dependencies') await persistence.promise;+ return original(context, patch);+ });+ await h.controller.act('session', 'completion', 'start');+ const publish = h.launch.mock.calls[0][2];+ publish('dependencies');+ publish('assets');+ h.ready.resolve();+ expect(h.meta().test?.status).toBe('starting');+ persistence.resolve();+ await vi.waitFor(() => expect(h.meta().test).toEqual({ status: 'ready' }));+ const count = h.save.mock.calls.length;+ publish('launching');+ await Promise.resolve();+ expect(h.save).toHaveBeenCalledTimes(count);+ h.closed.resolve();+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ });+ it('retains the failed step and starts a fresh attempt on retry', async () => {+ const h = harness();+ h.launch.mockImplementationOnce(async (_context, _signal, publish) => {+ publish('dependencies');+ throw makeTestError('environment');+ });+ await h.controller.act('session', 'completion', 'start');+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ expect(h.meta().test).toEqual({ status: 'failed', step: 'dependencies', error: 'environment' });+ await h.controller.act('session', 'completion', 'start');+ expect(h.launch).toHaveBeenCalledTimes(2);+ expect(h.meta().test).toEqual({ status: 'starting', step: 'waiting' });+ h.ready.resolve();+ await vi.waitFor(() => expect(h.meta().test?.status).toBe('ready'));+ h.closed.resolve();+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ });it('coalesces repeated starts, broadcasts readiness and keeps a workspace lease until exit', async () => {const h = harness();await h.controller.act('session', 'completion', 'start');@@ -131,9 +187,11 @@ describe('Main-owned Cindy Make test lifecycle', () => {const h = harness();h.launch.mockRejectedValueOnce(makeTestError('changed'));await h.controller.act('session', 'completion', 'start');- await vi.waitFor(() => expect(h.meta().test).toEqual({ status: 'failed', error: 'changed' }));- expect(h.leased()).toBe(false);- expect(h.controller.isUsingWorkspace('/profile/task')).toBe(false);+ await vi.waitFor(() => {+ expect(h.meta().test).toEqual({ status: 'failed', step: 'waiting', error: 'changed' });+ expect(h.leased()).toBe(false);+ expect(h.controller.isUsingWorkspace('/profile/task')).toBe(false);+ });void h.ready.promise.catch(() => {});});it('stops owned processes on account change without publishing to the new owner', async () => {@@ -164,6 +222,77 @@ const installer: PersonalArtifact = {};describe('personal build completion choices', () => {+ it('does not let a concurrent stop overwrite the final adopted artifact', async () => {+ const h = harness();+ h.build.mockImplementationOnce(async () => h.artifact.promise);+ const entered = deferred<void>();+ const persistence = deferred<void>();+ const save = h.save.getMockImplementation()!;+ h.save.mockImplementation(async (context, patch) => {+ if (patch.personal?.status === 'ready') {+ entered.resolve();+ await persistence.promise;+ }+ return save(context, patch);+ });+ await h.controller.act('session', 'completion', 'build');+ const id = h.meta().personal!.buildId!;+ h.artifact.resolve(installer);+ await entered.promise;+ const stopping = h.controller.cancelBuild(id);+ persistence.resolve();+ await stopping;+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ expect(h.meta().personal).toMatchObject({ buildId: id, status: 'ready', ...installer });+ expect(h.meta().personal?.stopping).toBeUndefined();+ });+ it('preserves cleanup failures instead of reporting a completed cancellation', async () => {+ const h = harness();+ h.build.mockImplementationOnce(async (_context, signal) => {+ await new Promise<void>((resolve) =>+ signal.addEventListener('abort', () => resolve(), { once: true }),+ );+ throw Object.assign(new Error('locked'), { code: 'cleanupFailed' });+ });+ await h.controller.act('session', 'completion', 'build');+ await h.controller.cancelBuild(h.meta().personal!.buildId!);+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ expect(h.meta().personal).toMatchObject({ status: 'failed', error: 'cleanupFailed' });+ });+ it('stops only the current build, keeps cleanup leased, and gives retry a new identity', async () => {+ const h = harness();+ const cleanup = deferred<void>();+ let signal!: AbortSignal;+ h.build.mockImplementationOnce(async (_context, abort, publish) => {+ signal = abort;+ await publish({ status: 'packaging' });+ await cleanup.promise;+ abort.throwIfAborted();+ throw new Error('unreachable');+ });+ await h.controller.act('session', 'completion', 'build');+ await vi.waitFor(() => expect(h.meta().personal?.status).toBe('packaging'));+ const id = h.meta().personal!.buildId!;+ await h.controller.cancelBuild('stale-build');+ expect(signal.aborted).toBe(false);+ await h.controller.cancelBuild(id);+ expect(signal.aborted).toBe(true);+ expect(h.meta().personal).toMatchObject({ buildId: id, stopping: true });+ expect(h.leased()).toBe(true);+ cleanup.resolve();+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ expect(h.meta()).toMatchObject({+ personal: { buildId: id, status: 'failed', error: 'cancelled' },+ });+ expect(h.meta().continuedAt).toBeUndefined();+ await h.controller.act('session', 'completion', 'build');+ await vi.waitFor(() => expect(h.meta().personal?.status).toBe('packaging'));+ expect(h.meta().personal?.buildId).not.toBe(id);+ await h.controller.cancelBuild(id);+ expect(h.meta().personal?.stopping).toBeUndefined();+ await h.controller.cancelBuild(h.meta().personal!.buildId!);+ await vi.waitFor(() => expect(h.controller.hasActiveJobs()).toBe(false));+ });it('coalesces build clicks, persists progress and opens only the recorded installer', async () => {const h = harness();await Promise.all([@@ -244,7 +373,7 @@ describe('personal build completion choices', () => {h.build.mockRejectedValueOnce(Object.assign(new Error('conflict'), { code: 'conflict' }));await h.controller.act('session', 'completion', 'build');await vi.waitFor(() =>- expect(h.meta().personal).toEqual({ status: 'failed', error: 'conflict' }),+ expect(h.meta().personal).toMatchObject({ status: 'failed', error: 'conflict' }),);expect(h.leased()).toBe(false);});diff --git a/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.tsindex a830dd087c..803d71d080 100644--- a/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts+++ b/apps/desktop/src/main/cindy-make/__tests__/testRunner.test.ts@@ -42,6 +42,7 @@ function processHarness() {}) as unknown as IPty,);const controller = new AbortController();+ const progress = vi.fn();const process = launchMakeTest(task,path.join(profile, 'node'),@@ -49,6 +50,7 @@ function processHarness() {'global',controller.signal,spawn,+ progress,);void process.ready.catch(() => {});const verdict = (extra: Partial<Record<string, string>> = {}) => {@@ -71,6 +73,7 @@ function processHarness() {};return {process,+ progress,spawn,kill,controller,@@ -97,6 +100,52 @@ beforeEach(() => {afterEach(() => vi.useRealTimers());describe('isolated Make test runner', () => {+ it('reports bounded known steps across PTY chunks and ignores raw output and late progress', async () => {+ const h = processHarness();+ h.emit('DESKTOP_DEV_ST');+ h.emit('EP=dependencies\r\nDESKTOP_DEV_STEP=dependencies\r\n');+ h.emit('DESKTOP_DEV_STEP=/private/path\r\ncompiler output\r\n');+ h.emit('DESKTOP_DEV_STEP=assets\r\nDESKTOP_DEV_STEP=launching\r\n');+ expect(h.progress.mock.calls).toEqual([['dependencies'], ['assets'], ['launching']]);+ h.emit(h.verdict());+ await h.process.ready;+ h.emit('DESKTOP_DEV_STEP=dependencies\r\n');+ expect(h.progress).toHaveBeenCalledTimes(3);+ h.exit();+ await h.process.closed;+ });+ it('supports the fixed stage prefixes from older source checkouts', async () => {+ const h = processHarness();+ h.emit('[ensure-deps] checking\r\n[ensure-deps] done\r\n');+ h.emit('[ensure-dev-runtime-assets] checking\r\n==> Starting desktop remote dev...\r\n');+ expect(h.progress.mock.calls).toEqual([['dependencies'], ['assets'], ['launching']]);+ h.emit('DESKTOP_DEV_VERDICT=failed\r\nDESKTOP_DEV_STEP=assets\r\n');+ await expect(h.process.ready).rejects.toMatchObject({ code: 'launchFailed' });+ expect(h.progress).toHaveBeenCalledTimes(3);+ });+ it('preserves Linux desktop connections without forwarding credentials or injection hooks', () => {+ const desktop = {+ DISPLAY: ':1',+ WAYLAND_DISPLAY: 'wayland-0',+ XAUTHORITY: '/session/Xauthority',+ XDG_RUNTIME_DIR: '/run/user/1000',+ XDG_SESSION_TYPE: 'wayland',+ XDG_CURRENT_DESKTOP: 'Hyprland',+ XDG_SESSION_DESKTOP: 'Hyprland',+ DESKTOP_SESSION: 'hyprland',+ DBUS_SESSION_BUS_ADDRESS: 'unix:path=/run/user/1000/bus',+ };+ const env = makeTestEnvironment({+ ...desktop,+ LD_PRELOAD: '/bad.so',+ NODE_OPTIONS: '--require bad',+ XDT_USER_DATA_DIR: '/host',+ OPENAI_API_KEY: 'fake-secret',+ });+ expect(env).toMatchObject(desktop);+ for (const key of ['LD_PRELOAD', 'NODE_OPTIONS', 'XDT_USER_DATA_DIR', 'OPENAI_API_KEY'])+ expect(env).not.toHaveProperty(key);+ });it('keeps OS/tool paths while dropping host profiles, auth and Node injection', () => {expect(makeTestEnvironment({diff --git a/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts b/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.tsindex f8f9187a9e..7f8c18112d 100644--- a/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts+++ b/apps/desktop/src/main/cindy-make/__tests__/testRuntime.test.ts@@ -12,7 +12,9 @@ const h = vi.hoisted(() => ({write: vi.fn(),broadcast: vi.fn(),launch: vi.fn(),+ verify: vi.fn(),build: vi.fn(),+ saveBuild: vi.fn(),artifactPath: vi.fn(),showItem: vi.fn(),rememberOriginal: vi.fn(async () => {}),@@ -20,7 +22,12 @@ const h = vi.hoisted(() => ({history: vi.fn(async () => ({ items: [{ runId: 'run', integration: 'integrated' }] })),}));vi.mock('../historyOwner.js', () => ({- captureMakeHistoryStore: () => ({ completion: vi.fn(), version: vi.fn(), list: () => [] }),+ captureMakeHistoryStore: () => ({+ completion: vi.fn(),+ version: vi.fn(),+ list: () => [],+ saveBuild: h.saveBuild,+ }),}));vi.mock('../historyRuntime.js', () => ({getCindyMakeHistory: h.history,@@ -62,6 +69,7 @@ vi.mock('../../localDb/ipc/messages.js', () => ({ broadcastMessageAgentMetaUpdatvi.mock('../testRunner.js', async (original) => ({...(await original<typeof import('../testRunner.js')>()),launchMakeTest: h.launch,+ verifyMakeTestWorkspace: h.verify,}));import { sessions } from '../../localDb/schema';import {@@ -131,6 +139,7 @@ const client = {};beforeEach(() => {vi.clearAllMocks();+ h.verify.mockReset().mockResolvedValue(undefined);h.build.mockReset().mockResolvedValue(installer);h.artifactPath.mockReset().mockResolvedValue(path.join(os.tmpdir(), 'installer.exe'));h.current = true;@@ -157,6 +166,87 @@ beforeEach(() => {afterEach(() => cindyMakeTestController.stopAll());describe('Cindy Make test IPC ownership and persistence', () => {+ it('pushes environment, workspace and child progress through the same completion receipt', async () => {+ const steps: string[] = [];+ h.broadcast.mockImplementationOnce(() => {});+ h.broadcast.mockImplementation(() => {+ const test = JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.test;+ if (test?.step) steps.push(test.step);+ });+ let close!: () => void;+ const closed = new Promise<void>((resolve) => {+ close = resolve;+ });+ h.launch.mockImplementationOnce((_context, _node, _env, _region, _signal, _spawn, publish) => {+ publish('assets');+ publish('launching');+ return { ready: Promise.resolve(), closed, stop: close };+ });+ try {+ await actCindyMakeTest('session', 'completion', 'start');+ await vi.waitFor(() =>+ expect(JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.test).toEqual({+ status: 'ready',+ }),+ );+ expect(steps).toEqual(['environment', 'workspace', 'stopping', 'assets', 'launching']);+ expect(h.verify).toHaveBeenCalledOnce();+ expect(JSON.parse(String(h.card.agentMeta)).otherMetadata).toBe('preserved');+ } finally {+ close();+ await vi.waitFor(() => expect(cindyMakeTestController.hasActiveJobs()).toBe(false));+ h.broadcast.mockReset();+ }+ });+ it('does not start a completion build while Settings owns another build', async () => {+ const release = cindyMakeManager.claimPersonalBuild();+ try {+ await expect(actCindyMakeTest('session', 'completion', 'build')).rejects.toThrow(+ 'unavailable',+ );+ expect(h.build).not.toHaveBeenCalled();+ expect(cindyMakeTestController.hasActiveJobs()).toBe(false);+ } finally {+ release();+ }+ });+ it('publishes one build identity to Settings and persists cancellation for a reopened card', async () => {+ let release!: () => void;+ h.build.mockImplementationOnce(+ async (_context, _node, _env, _region, signal: AbortSignal, publish) => {+ await publish({ status: 'packaging' });+ await new Promise<void>((resolve) => {+ release = resolve;+ });+ signal.throwIfAborted();+ return installer;+ },+ );+ await actCindyMakeTest('session', 'completion', 'build');+ await vi.waitFor(() => expect(release).toBeTypeOf('function'));+ const buildId = cindyMakeTestController.activeBuild()!.buildId!;+ expect(h.saveBuild).toHaveBeenLastCalledWith(+ expect.objectContaining({ buildId, status: 'packaging' }),+ );+ expect(h.build.mock.calls[0][0].completionId).toBe(buildId);+ await cindyMakeTestController.cancelBuild(buildId);+ expect((await actCindyMakeTest('session', 'completion', 'status')).personal).toMatchObject({+ buildId,+ stopping: true,+ });+ expect(cindyMakeManager.hasActiveWork()).toBe(true);+ release();+ await vi.waitFor(() => expect(cindyMakeTestController.hasActiveJobs()).toBe(false));+ expect(h.saveBuild).toHaveBeenLastCalledWith(+ expect.objectContaining({ buildId, status: 'failed', error: 'cancelled' }),+ );+ expect((await actCindyMakeTest('session', 'completion', 'status')).personal).toMatchObject({+ buildId,+ status: 'failed',+ error: 'cancelled',+ });+ expect(cindyMakeManager.hasActiveWork()).toBe(false);+ });it('only reads a valid completion on status requests', async () => {expect(await actCindyMakeTest('session', 'completion', 'status')).toMatchObject({reportedAt: 123,@@ -207,15 +297,19 @@ describe('Cindy Make test IPC ownership and persistence', () => {expect(JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.personal).toEqual({status: 'ready',...installer,+ buildId: expect.any(String),+ startedAt: expect.any(Number),generatedAt: expect.any(Number),}),);expect(h.rememberOriginal).toHaveBeenCalledWith(process.execPath);expect(h.build.mock.calls[0][0].profile.userData).toBe(h.profile);await actCindyMakeTest('session', 'completion', 'open-build');- expect(h.artifactPath).toHaveBeenCalledWith(h.profile, 'completion', {+ expect(h.artifactPath).toHaveBeenCalledWith(h.profile, expect.any(String), {status: 'ready',...installer,+ buildId: expect.any(String),+ startedAt: expect.any(Number),generatedAt: expect.any(Number),});expect(h.showItem).toHaveBeenCalledWith(path.join(os.tmpdir(), 'installer.exe'));@@ -296,7 +390,7 @@ describe('Cindy Make test IPC ownership and persistence', () => {configureCindyMakeTestRuntime(() => true);await actCindyMakeTest('session', 'completion', 'build');await vi.waitFor(() =>- expect(JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.personal).toEqual({+ expect(JSON.parse(String(h.card.agentMeta)).cindyMakeCompletion.personal).toMatchObject({status: 'failed',error: 'unavailable',}),diff --git a/apps/desktop/src/main/cindy-make/historyRuntime.ts b/apps/desktop/src/main/cindy-make/historyRuntime.tsindex 0e6abfae0c..e0f187d41f 100644--- a/apps/desktop/src/main/cindy-make/historyRuntime.ts+++ b/apps/desktop/src/main/cindy-make/historyRuntime.ts@@ -81,6 +81,10 @@ export async function cancelHistoryPersonalVersion(const h = context();const job = buildJob;const build = h.store.readBuild();+ if (!job && build?.buildId === buildId) {+ await cindyMakeTestController.cancelBuild(buildId);+ h.check();+ }let stoppingState: CindyMakePersonalBuildState | undefined;if (job &&@@ -492,11 +496,7 @@ export async function getCindyMakeHistory(selectedRunId?: string): Promise<Cindy: undefined,});}- let build = h.store.readBuild();- if (build && !buildJob && !['ready', 'failed'].includes(build.status)) {- build = { status: 'failed', error: 'interrupted' };- h.store.saveBuild(build);- }+ const build = readCindyMakeBuildState();h.check();return {items,@@ -506,6 +506,20 @@ export async function getCindyMakeHistory(selectedRunId?: string): Promise<Cindy};}+/** The same restart reconciliation for local history and portable task cards. */+export function readCindyMakeBuildState(): CindyMakePersonalBuildState | undefined {+ const h = context();+ let build = h.store.readBuild();+ const activeBuild = cindyMakeTestController.activeBuild();+ if (build && !buildJob && !(activeBuild?.buildId && activeBuild.buildId === build.buildId)+ && !['ready', 'failed'].includes(build.status)) {+ build = { ...build, status: 'failed', stopping: undefined, error: 'interrupted' };+ h.store.saveBuild(build);+ }+ h.check();+ return build;+}+export async function actCindyMakeHistory(runId: unknown,action: unknown,@@ -610,7 +624,14 @@ export async function generateHistoryPersonalVersion(): Promise<CindyMakeHistoryconst h = context();const state = await getCindyMakeHistory();h.check();- if (!state.canBuild || buildJob) throwIpcError('PRECONDITION_FAILED', 'busy');+ if (+ !state.canBuild ||+ buildJob ||+ cindyMakeTestController.hasActiveJobs() ||+ cindyMakeManager.hasActiveWork()+ )+ throwIpcError('PRECONDITION_FAILED', 'busy');+ const releaseBuild = cindyMakeManager.claimPersonalBuild();const abort = new AbortController();const buildId = randomUUID();const startedAt = Date.now();@@ -626,6 +647,7 @@ export async function generateHistoryPersonalVersion(): Promise<CindyMakeHistoryawait publish({ status: 'waiting' });} catch (error) {if (buildJob === job) buildJob = undefined;+ releaseBuild();throw error;}job.done = cindyMakeManager@@ -687,6 +709,7 @@ export async function generateHistoryPersonalVersion(): Promise<CindyMakeHistory}).finally(() => {if (buildJob === job) buildJob = undefined;+ releaseBuild();});return getCindyMakeHistory();}diff --git a/apps/desktop/src/main/cindy-make/manager.ts b/apps/desktop/src/main/cindy-make/manager.tsindex e040d3adc1..a976652bb8 100644--- a/apps/desktop/src/main/cindy-make/manager.ts+++ b/apps/desktop/src/main/cindy-make/manager.ts@@ -98,12 +98,16 @@ export class CindyMakeManager {private readonly sourceJobs = new Map<string, SharedSourceJob>();private readonly projectJobs = new Map<string, Promise<unknown>>();private readonly projectUsers = new Map<string, number>();+ private personalBuild: object | undefined;private readonly reports = new Map<string,{ report: MakeDoctorReport; isCurrent: () => boolean }>();private readonly tasks = new Map<string, ActiveTask>();+ // Retained reports are history; only unsettled work owns the application lock.+ private readonly preparingTasks = new Set<ActiveTask>();private readonly taskActions = new Map<string, TaskAction>();+ private readonly runningTaskActions = new Set<TaskAction>();private readonly restoredTasks = new Map<string,{ report: MakeDoctorReport; isCurrent: () => boolean }@@ -117,16 +121,43 @@ export class CindyMakeManager {}private projectInUse(root: string): boolean {- return (this.projectUsers.get(root) ?? 0) > 0 || this.isProjectBusy(root) ||- (!!this.states.upstreamMerge && this.states.upstreamMerge.status !== 'merged' &&- (this.states.upstreamMerge.hasWorkspace === true || this.states.upstreamMerge.status !== 'failed'));+ return (+ (this.projectUsers.get(root) ?? 0) > 0 ||+ this.isProjectBusy(root) ||+ (!!this.states.upstreamMerge &&+ this.states.upstreamMerge.status !== 'merged' &&+ (this.states.upstreamMerge.hasWorkspace === true ||+ this.states.upstreamMerge.status !== 'failed'))+ );}/** Active preparation/cleanup must finish before a local application version switch. */hasActiveWork(): boolean {- return this.active.size > 0 || this.sourceJobs.size > 0 || this.tasks.size > 0 || this.taskActions.size > 0 || this.projectUsers.size > 0;+ return (+ this.active.size > 0 ||+ this.sourceJobs.size > 0 ||+ this.preparingTasks.size > 0 ||+ this.runningTaskActions.size > 0 ||+ this.projectUsers.size > 0 ||+ !!this.personalBuild ||+ this.projectJobs.size > 0+ );+ }++ /** Both entry points reserve synchronously, before any asynchronous build work. */+ claimPersonalBuild(): () => void {+ if (this.personalBuild)+ throw Object.assign(new Error('personal build is running'), { code: 'busy' });+ const claim = {};+ this.personalBuild = claim;+ return () => {+ if (this.personalBuild === claim) this.personalBuild = undefined;+ };}- setUpstreamMerge(state: CindyMakeGlobalState['upstreamMerge'], isCurrent: () => boolean = () => true): void {+ setUpstreamMerge(+ state: CindyMakeGlobalState['upstreamMerge'],+ isCurrent: () => boolean = () => true,+ ): void {this.states.upstreamMerge = state;this.mergeSessionCurrent = isCurrent;this.notify();@@ -193,8 +224,7 @@ export class CindyMakeManager {return revision === this.sourceRevision;};const status = await read(publish);- if (!publish(status) && this.states.source)- return structuredClone(this.states.source);+ if (!publish(status) && this.states.source) return structuredClone(this.states.source);return status;}@@ -322,6 +352,12 @@ export class CindyMakeManager {const existing = previous?.lifecycle.isCurrent() ? previous : undefined;if (previous && !existing) previous.controller.abort('owner-changed');if (existing) {+ // History retry callers need only the run identity. Explicit conflicting origins+ // still fail; an omitted origin comes from the Main-owned preparation.+ input = {+ ...input,+ originSessionId: input.originSessionId ?? existing.input.originSessionId,+ };if (existing.input.originSessionId !== input.originSessionId ||existing.input.request !== input.request@@ -331,6 +367,7 @@ export class CindyMakeManager {);}if (+ this.preparingTasks.has(existing) ||existing.report?.status === 'running' ||existing.report?.status === 'completed' ||!existing.report@@ -340,6 +377,7 @@ export class CindyMakeManager {const controller = new AbortController();const task: ActiveTask = { input, controller, created: Promise.resolve(''), lifecycle };this.tasks.set(input.runId, task);+ this.preparingTasks.add(task);task.created = (async () => {const report = await lifecycle.create(existing?.report);if (!report.task) throw new Error('task identity missing');@@ -348,9 +386,13 @@ export class CindyMakeManager {await lifecycle.persist(report);lifecycle.onCreated?.();this.publishTask(task);- task.done = this.runTask(task);+ task.done = this.runTask(task).finally(() => {+ this.preparingTasks.delete(task);+ this.notify();+ });return report.task.sessionId;})().catch((error) => {+ this.preparingTasks.delete(task);if (task.report) {task.report = { ...task.report, status: 'failed' };this.publishTask(task);@@ -416,6 +458,7 @@ export class CindyMakeManager {recycleOnly: nestedRecycle,};this.taskActions.set(sessionId, entry);+ this.runningTaskActions.add(entry);entry.promise = Promise.resolve().then(() => {if (!isCurrent()) throw Object.assign(new Error('owner changed'), { code: 'unavailable' });@@ -436,6 +479,7 @@ export class CindyMakeManager {},).finally(() => {+ this.runningTaskActions.delete(entry);if (isCurrent()) this.notify();});this.notify();@@ -587,9 +631,15 @@ export class CindyMakeManager {};return structuredClone({...this.states,- ...(this.states.upstreamMerge && !this.mergeSessionCurrent() ? { upstreamMerge: {- ...this.states.upstreamMerge, sessionId: undefined, ownedByAnotherAccount: true,- } } : {}),+ ...(this.states.upstreamMerge && !this.mergeSessionCurrent()+ ? {+ upstreamMerge: {+ ...this.states.upstreamMerge,+ sessionId: undefined,+ ownedByAnotherAccount: true,+ },+ }+ : {}),reports: Object.fromEntries([...this.reports].flatMap(([runId, entry]) =>entry.isCurrent() ? [[runId, entry.report]] : [],diff --git a/apps/desktop/src/main/cindy-make/remoteBroadcast.ts b/apps/desktop/src/main/cindy-make/remoteBroadcast.tsnew file mode 100644index 0000000000..217c985422--- /dev/null+++ b/apps/desktop/src/main/cindy-make/remoteBroadcast.ts@@ -0,0 +1,27 @@+import { REMOTE_RESOURCE_CHANGED_CHANNEL } from '@cindy/device-link';+import {+ tapWindowBroadcast,+ captureDataOwnerBroadcastScope,+ isDataOwnerBroadcastScopeCurrent,+} from '../device-link/broadcast-tap.js';+import { makeRemoteRef, MAKE_REMOTE_COLLECTION } from './remoteProjection.js';++/** Invalidate, never duplicate, the host-owned snapshot on remote controllers. */+export function broadcastMakeRemoteChanged(+ sessionId: string,+ scope = captureDataOwnerBroadcastScope(),+): void {+ if (!isDataOwnerBroadcastScopeCurrent(scope)) return;+ try {+ tapWindowBroadcast(+ REMOTE_RESOURCE_CHANGED_CHANNEL,+ {+ collectionId: MAKE_REMOTE_COLLECTION,+ resourceRefs: [makeRemoteRef(sessionId)],+ },+ scope.ownerStamp,+ );+ } catch {+ // A disconnected controller must not fail a persisted local operation.+ }+}diff --git a/apps/desktop/src/main/cindy-make/remoteProjection.ts b/apps/desktop/src/main/cindy-make/remoteProjection.tsnew file mode 100644index 0000000000..28fe962fb2--- /dev/null+++ b/apps/desktop/src/main/cindy-make/remoteProjection.ts@@ -0,0 +1,188 @@+import type { RemoteResource, RemoteActionDescriptor } from '@cindy/device-link';+import type { MakeDoctorReport } from '../../shared/cindyMakeDoctor.js';+import type {+ CindyMakeCompletionMeta,+ CindyMakePersonalBuildState,+} from '../../shared/cindyMakeSession.js';++export const MAKE_REMOTE_COLLECTION = 'cindy-make';+export const makeRemoteRef = (sessionId: string) => ({+ collectionId: MAKE_REMOTE_COLLECTION,+ kind: 'session',+ id: sessionId,+});+export interface MakeRemoteSnapshot {+ sessionId: string;+ revision: string;+ busy: boolean;+ preparation?: MakeDoctorReport;+ completion?: { id: string; meta: CindyMakeCompletionMeta };+ sharedBuild?: CindyMakePersonalBuildState;+ recoverable: boolean;+}+type Translate = (key: string, values?: Record<string, string>) => string;++/** Portable projection of Main-owned facts. Paths, prompts and process output stay on the host. */+export function projectMakeRemoteCard(source: MakeRemoteSnapshot, t: Translate): RemoteResource {+ let title = t('cindyMake.history.lifecycle.running');+ let description = '';+ let blocked = false;+ let busy = source.busy;+ let failed = false;+ const details: string[] = [];+ const actions: RemoteActionDescriptor[] = [];+ const action = (id: string, key: string, disabled = false) =>+ actions.push({ id, label: t(key), disabled });+ const prep = source.preparation;+ if (+ prep &&+ prep.status !== 'completed' &&+ !(prep.status === 'running' && prep.task?.phase === 'completed')+ ) {+ blocked = true;+ busy = prep.status === 'running';+ failed = prep.status === 'failed';+ title = t(+ busy+ ? 'cindyMake.code.phases.' + (prep.task?.phase ?? 'waiting')+ : failed+ ? 'cindyMake.code.preparationFailed'+ : 'cindyMake.prepare.cancelled',+ );+ description = t(busy ? 'cindyMake.code.inputLocked.hint' : 'cindyMake.code.inputLocked.retry');+ for (const check of prep.checks) {+ if (['passed', 'pending'].includes(check.status)) continue;+ let detail =+ t('cindyMakeDoctor.checks.' + check.id) ++ ': ' ++ t('cindyMakeDoctor.checkStatus.' + check.status);+ if (check.progress?.percent != null && Number.isFinite(check.progress.percent))+ detail += ' ' + Math.round(check.progress.percent) + '%';+ details.push(detail);+ if (check.reason === 'timeout') details.push(t('cindyMakeDoctor.timeout'));+ else if (+ check.reason &&+ ['downloadFailed', 'checksum', 'installFailed'].includes(check.reason)+ )+ details.push(t('cindyMake.prepare.errors.' + check.reason));+ }+ const progress = prep.task?.dependencies;+ if (progress)+ details.push(+ t(+ 'cindyMake.code.dependencyProgress',+ Object.fromEntries(+ ['resolved', 'reused', 'downloaded', 'added'].map((key) => [+ key,+ String(progress[key as keyof typeof progress] ?? 0),+ ]),+ ),+ ),+ );+ if (prep.source?.error) details.push(t('cindyMake.source.errors.' + prep.source.error));+ action(+ `prepare:${prep.runId}:${busy ? 'stop' : 'retry'}`,+ busy ? 'cindyMake.history.stop' : 'cindyMake.history.actions.retry-prepare',+ );+ } else if (!source.busy && source.completion && !source.completion.meta.continuedAt) {+ blocked = true;+ const { id, meta } = source.completion;+ const testStatus = meta.test?.status ?? 'waiting';+ const shared = source.sharedBuild;+ const personal =+ shared?.buildId === meta.personal?.buildId &&+ meta.personal &&+ ['ready', 'failed'].includes(meta.personal.status)+ ? meta.personal+ : (shared ?? meta.personal);+ const building =+ !!personal &&+ ['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(personal.status);+ const starting = testStatus === 'starting';+ const buildMode =+ !starting &&+ ((!!shared && (building || meta.lastAction !== 'test')) ||+ (meta.lastAction ?? (meta.personal ? 'build' : 'test')) === 'build');+ busy = buildMode ? building : starting;+ const error =+ starting || building+ ? undefined+ : ((buildMode ? personal?.error : meta.test?.error) ??+ (!meta.commit ? 'unavailable' : undefined));+ failed = !!error;+ title = t(+ buildMode && personal+ ? personal.stopping+ ? 'cindyMake.history.stopping'+ : personal.status === 'checking' && personal.checkStep+ ? 'cindyMake.personal.checkStep.' + personal.checkStep+ : 'cindyMake.personal.status.' + personal.status+ : 'cindyMake.test.status.' + testStatus,+ );+ description = t(+ buildMode && building+ ? 'cindyMake.personal.description'+ : buildMode && personal?.status === 'ready'+ ? 'cindyMake.versions.readyHint'+ : starting+ ? 'cindyMake.test.startingHint'+ : testStatus === 'ready'+ ? 'cindyMake.test.readyHint'+ : 'cindyMake.test.description',+ );+ if (!buildMode && (starting || (meta.test?.step && meta.test.error)))+ details.push(+ t(starting ? 'cindyMake.test.currentStep' : 'cindyMake.test.failedStep', {+ step: t('cindyMake.test.steps.' + (meta.test?.step ?? 'waiting')),+ }),+ );+ if (error)+ details.push(+ t((buildMode ? 'cindyMake.personal.errors.' : 'cindyMake.test.errors.') + error),+ );+ action(`test:${id}:continue`, 'cindyMake.test.continue', starting || building);+ action(+ `test:${id}:start`,+ testStatus === 'ready'+ ? 'cindyMake.test.started'+ : ['failed', 'stopped'].includes(testStatus)+ ? 'cindyMake.test.retry'+ : 'cindyMake.test.start',+ starting || building || testStatus === 'ready' || !meta.commit,+ );+ action(`test:${id}:build`, 'cindyMake.personal.generate', starting || building || !meta.commit);+ if (building && personal?.buildId)+ action(+ `build:${personal.buildId}:stop`,+ personal.stopping ? 'cindyMake.history.stopping' : 'cindyMake.history.stop',+ !!personal.stopping,+ );+ } else if (!source.busy && source.recoverable) {+ title = t('cindyMake.test.resume.title');+ description = t('cindyMake.test.resume.description');+ action(`resume:${source.revision}`, 'cindyMake.test.resume.action');+ }+ const fallbackMarkdown = [title, description, ...details].filter(Boolean).join('\n\n');+ return {+ ref: makeRemoteRef(source.sessionId),+ revision: source.revision,+ display: {+ title,+ subtitle: description,+ status: { label: title, tone: failed ? 'critical' : busy ? 'warning' : 'neutral' },+ },+ links: [{ rel: 'conversation', target: { kind: 'session', sessionId: source.sessionId } }],+ blocks:+ blocked || (!source.busy && source.recoverable)+ ? [+ {+ id: 'workflow',+ primitive: 'session-controls',+ fallbackMarkdown,+ data: { input: blocked ? 'blocked' : 'available', busy },+ },+ ]+ : [],+ actions,+ };+}diff --git a/apps/desktop/src/main/cindy-make/remoteProvider.ts b/apps/desktop/src/main/cindy-make/remoteProvider.tsnew file mode 100644index 0000000000..186d81df5e--- /dev/null+++ b/apps/desktop/src/main/cindy-make/remoteProvider.ts@@ -0,0 +1,72 @@+import type { RemoteResourceProvider } from '../device-link/remoteResourceRegistry.js';+import { RemoteResourceRegistryError } from '../device-link/remoteResourceRegistry.js';+import {+ MAKE_REMOTE_COLLECTION,+ projectMakeRemoteCard,+ type MakeRemoteSnapshot,+} from './remoteProjection.js';++export interface MakeRemoteProviderDeps {+ load(sessionId: string): Promise<{ snapshot: MakeRemoteSnapshot; isCurrent(): boolean }>;+ translate(locale: string | undefined, key: string, values?: Record<string, string>): string;+ act(+ sessionId: string,+ actionId: string,+ isCurrent: () => boolean,+ locale?: string,+ ): Promise<void>;+}++/** Remote controllers use the same business actions; stale descriptors never authorize a mutation. */+export function createMakeRemoteProvider(deps: MakeRemoteProviderDeps): RemoteResourceProvider {+ const pending = new Set<string>();+ return {+ collection: {+ id: MAKE_REMOTE_COLLECTION,+ resourceKind: 'session',+ title: 'Cindy Make',+ placement: 'session:cindy-make',+ },+ async list() {+ return { collectionId: MAKE_REMOTE_COLLECTION, revision: '1', items: [] };+ },+ async get(_context, request) {+ const source = await deps.load(request.ref.id);+ if (!source.isCurrent())+ throw new RemoteResourceRegistryError('NOT_FOUND', 'Task is unavailable');+ return projectMakeRemoteCard(source.snapshot, (key, values) =>+ deps.translate(request.client.locale, key, values),+ );+ },+ async invoke(_context, request) {+ if (!request.resourceRef || (request.input && Object.keys(request.input).length))+ throw new RemoteResourceRegistryError('NOT_FOUND', 'Invalid task action');+ const sessionId = request.resourceRef.id;+ if (pending.has(sessionId))+ throw new RemoteResourceRegistryError('NOT_FOUND', 'Task action is already running');+ pending.add(sessionId);+ try {+ const source = await deps.load(request.resourceRef.id);+ const card = projectMakeRemoteCard(source.snapshot, (key) => key);+ if (+ !source.isCurrent() ||+ !card.actions?.some((action) => action.id === request.actionId && !action.disabled)+ )+ throw new RemoteResourceRegistryError(+ 'NOT_FOUND',+ 'Task changed; refresh before continuing',+ );+ await deps.act(+ source.snapshot.sessionId,+ request.actionId,+ source.isCurrent,+ request.client.locale,+ );+ if (!source.isCurrent()) return { effects: [] };+ return { effects: [{ kind: 'refresh-resource', ref: card.ref }] };+ } finally {+ pending.delete(sessionId);+ }+ },+ };+}diff --git a/apps/desktop/src/main/cindy-make/remoteRuntime.ts b/apps/desktop/src/main/cindy-make/remoteRuntime.tsnew file mode 100644index 0000000000..f3edf349d3--- /dev/null+++ b/apps/desktop/src/main/cindy-make/remoteRuntime.ts@@ -0,0 +1,200 @@+import { createHash, randomUUID } from 'node:crypto';+import { and, desc, eq, gt, isNull, or, sql } from 'drizzle-orm';+import { getDbClient } from '../localDb/client/current.js';+import { sessions, messages } from '../localDb/schema.js';+import {+ captureDataOwnerBroadcastScope,+ isDataOwnerBroadcastScopeCurrent,+} from '../device-link/broadcast-tap.js';+import {+ remoteResourceRegistry,+ RemoteResourceRegistryError,+} from '../device-link/remoteResourceRegistry.js';+import { resolvePreferredSystemLocale } from '../../shared/locale.js';+import { dbToMakerAgentKind } from '../../shared/agentKindConversion.js';+import { t } from '../i18n.js';+import { cindyMakeManager } from './manager.js';+import { actCindyMakeTest } from './testRuntime.js';+import {+ getCindyMakeHistory,+ cancelHistoryPersonalVersion,+ readCindyMakeBuildState,+} from './historyRuntime.js';+import { dispatchCindyMakeTask, restoreCindyMakeTaskState, startCindyMakeTask } from './taskRuntime.js';+import { createMakeRemoteProvider } from './remoteProvider.js';+import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';+import { projectMakeRemoteCard, type MakeRemoteSnapshot } from './remoteProjection.js';+import type { CindyMakeCompletionMeta } from '../../shared/cindyMakeSession.js';++const unavailable = () =>+ new RemoteResourceRegistryError('NOT_FOUND', 'Cindy Make task is unavailable');+const parse = (raw: string | null): Record<string, unknown> => {+ try {+ const value = JSON.parse(raw ?? '{}');+ return value && typeof value === 'object' ? value : {};+ } catch {+ return {};+ }+};++/** Account-bound adapter. Only the explicit portable projection leaves this module. */+export function registerMakeRemoteResources(isRunning: (id: string) => boolean): void {+ let restored:+ { client: ReturnType<typeof getDbClient>; stamp: string; ready: Promise<void> } | undefined;+ const load = async (sessionId: string) => {+ if (!/^[A-Za-z0-9-]{1,128}$/.test(sessionId)) throw unavailable();+ const client = getDbClient();+ const scope = captureDataOwnerBroadcastScope();+ const isCurrent = () => {+ try {+ return isDataOwnerBroadcastScopeCurrent(scope) && getDbClient() === client;+ } catch {+ return false;+ }+ };+ const stamp = JSON.stringify(scope);+ if (!restored || restored.client !== client || restored.stamp !== stamp) {+ const ready = restoreCindyMakeTaskState();+ restored = { client, stamp, ready };+ void ready.catch(() => {+ if (restored?.ready === ready) restored = undefined;+ });+ }+ await restored.ready;+ if (!isCurrent()) throw unavailable();+ const db = client.drizzle;+ const [session] = await db.select().from(sessions).where(eq(sessions.id, sessionId)).limit(1);+ if (+ !session ||+ !isCurrent() ||+ session.source !== 'cindy-make' ||+ session.remoteHostId ||+ session.status !== 'active'+ )+ throw unavailable();+ const rows = await db+ .select({+ clientId: messages.clientId,+ role: messages.role,+ agentMeta: messages.agentMeta,+ createdAt: messages.createdAt,+ })+ .from(messages)+ .where(+ and(+ eq(messages.sessionId, sessionId),+ isNull(messages.rewindAt),+ or(eq(messages.role, 'assistant'), eq(messages.role, 'user')),+ session.clearedAt ? gt(messages.createdAt, session.clearedAt) : undefined,+ ),+ )+ .orderBy(desc(messages.createdAt), sql`rowid DESC`)+ .limit(100);+ if (!isCurrent()) throw unavailable();+ let completion: MakeRemoteSnapshot['completion'];+ let recoverable = false;+ let sawTurnEnd = false;+ for (const row of rows) {+ const meta = parse(row.agentMeta);+ if (meta.parentUuid) continue;+ if (row.role === 'user') break;+ const done = meta.cindyMakeCompletion as CindyMakeCompletionMeta | undefined;+ if (done && typeof done.reportedAt === 'number' && Number.isFinite(done.reportedAt)) {+ completion = { id: row.clientId, meta: done };+ if (!sawTurnEnd) recoverable = typeof done.continuedAt === 'number';+ break;+ }+ if (!sawTurnEnd && typeof meta.turnCompleted === 'boolean') {+ sawTurnEnd = true;+ recoverable = meta.turnCompleted;+ }+ }+ if (completion && !completion.meta.continuedAt) {+ completion.meta = await actCindyMakeTest(sessionId, completion.id, 'status');+ if (!isCurrent()) throw unavailable();+ }+ const prep = Object.values(cindyMakeManager.getState().tasks ?? {}).find(+ (report) => report.task?.sessionId === sessionId,+ );+ const sharedBuild = readCindyMakeBuildState();+ const snapshot: MakeRemoteSnapshot = {+ sessionId,+ revision: '',+ busy: isRunning(sessionId),+ completion,+ preparation: session.lastTurnEndedAt == null && !session.clearedAt ? prep : undefined,+ sharedBuild:+ sharedBuild &&+ (!['ready', 'failed'].includes(sharedBuild.status) ||+ sharedBuild.buildId === completion?.meta.personal?.buildId)+ ? sharedBuild+ : undefined,+ recoverable,+ };+ snapshot.revision = createHash('sha256')+ .update(JSON.stringify([snapshot, rows[0]?.clientId, session.clearedAt]))+ .digest('hex')+ .slice(0, 24);+ return { snapshot, session, isCurrent, scope };+ };+ remoteResourceRegistry.register(+ createMakeRemoteProvider({+ load,+ translate(locale, key, values) {+ let text = t(key, locale ? resolvePreferredSystemLocale([locale]) : undefined);+ for (const [name, value] of Object.entries(values ?? {}))+ text = text.replaceAll(`{{${name}}}`, value);+ return text;+ },+ async act(sessionId, actionId, isCurrent, locale) {+ const state = await load(sessionId);+ if (+ !isCurrent() ||+ !state.isCurrent() ||+ !projectMakeRemoteCard(state.snapshot, (key) => key).actions?.some(+ (action) => action.id === actionId && !action.disabled,+ )+ )+ throw unavailable();+ const [kind, id, action] = actionId.split(':');+ if (kind === 'test') await actCindyMakeTest(sessionId, id, action);+ else if (kind === 'build' && action === 'stop') await cancelHistoryPersonalVersion(id);+ else if (kind === 'prepare' && action === 'stop')+ cindyMakeManager.cancelTasksForSession(sessionId);+ else if (kind === 'prepare' && action === 'retry') {+ const history = await getCindyMakeHistory(id);+ const item = history.items.find((entry) => entry.runId === id);+ if (!isCurrent() || !state.isCurrent() || item?.sessionId !== sessionId ||+ !item.actions.includes('retry-prepare')) throw unavailable();+ await startCindyMakeTask({+ runId: item.runId, request: item.request, title: item.title.slice(0, 200),+ }, 0);+ }+ else if (kind === 'resume' && id === state.snapshot.revision) {+ const row = state.session;+ await dispatchCindyMakeTask(+ sessionId,+ t(+ 'cindyMake.test.resume.request',+ locale ? resolvePreferredSystemLocale([locale]) : undefined,+ ),+ {+ id: sessionId,+ agentKind: dbToMakerAgentKind(row.agentKind),+ workingDir: row.workingDir,+ model: row.model,+ effort: row.effort,+ providerId: row.providerId,+ fastMode: row.fastMode,+ permissionMode: row.permissionMode,+ planMode: row.planModeEnabled,+ },+ () => isCurrent() && state.isCurrent(),+ randomUUID(),+ );+ } else throw unavailable();+ broadcastMakeRemoteChanged(sessionId, state.scope);+ },+ }),+ );+}diff --git a/apps/desktop/src/main/cindy-make/stateBroadcast.ts b/apps/desktop/src/main/cindy-make/stateBroadcast.tsindex 67d8db0830..709af2d383 100644--- a/apps/desktop/src/main/cindy-make/stateBroadcast.ts+++ b/apps/desktop/src/main/cindy-make/stateBroadcast.ts@@ -3,9 +3,12 @@ import { BrowserWindow } from 'electron';import { MAKER_PUSH } from '../maker-ipc/channels.js';import { captureDataOwnerBroadcastScope } from '../device-link/broadcast-tap.js';import type { CindyMakeGlobalState } from '../../shared/cindyMakeDoctor.js';+import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';/** Push the Main-owned Cindy Make snapshot to every trusted renderer window. */export function broadcastCindyMakeState(state: CindyMakeGlobalState): void {+ for (const report of Object.values(state.tasks ?? {}))+ if (report.task?.sessionId) broadcastMakeRemoteChanged(report.task.sessionId);for (const window of BrowserWindow.getAllWindows()) {if (window.isDestroyed()) continue;try {diff --git a/apps/desktop/src/main/cindy-make/taskRuntime.ts b/apps/desktop/src/main/cindy-make/taskRuntime.tsindex 915d6f5448..394ec0035b 100644--- a/apps/desktop/src/main/cindy-make/taskRuntime.ts+++ b/apps/desktop/src/main/cindy-make/taskRuntime.ts@@ -48,21 +48,37 @@ type SendTask = () => Promise<DesktopMakerSendResult>;let sendTask: SendTask | undefined;let readClearBoundary: ((sessionId: string) => number | null) | undefined;+let isEditingBlocked: (sessionId: string) => boolean = () => false;++/** Every sender, including a phone with stale UI, must respect the same workspace lease. */+export function configureCindyMakeEditingGuard(probe: typeof isEditingBlocked): void {+ isEditingBlocked = probe;+}/** Dispatch a Main-created task without opting it into the personal-build lifecycle. */-export async function dispatchCindyMakeMergeTask(- sessionId: string, message: string, createOpts: Record<string, unknown>,- isCurrent: () => boolean, clientId: string,+export async function dispatchCindyMakeTask(+ sessionId: string,+ message: string,+ createOpts: Record<string, unknown>,+ isCurrent: () => boolean,+ clientId: string,): Promise<void> {if (!sendTask || !isCurrent()) throwIpcError('PRECONDITION_FAILED', 'Task runner is not ready');const expectedClearBoundaryMs = readClearBoundary?.(sessionId) ?? null;const sent = await sendTask(sessionId, message, createOpts, {expectedClearBoundaryMs,- persistUserMessage: { clientId, content: message, expectedClearBoundaryMs, shouldBroadcast: isCurrent },+ persistUserMessage: {+ clientId,+ content: message,+ expectedClearBoundaryMs,+ shouldBroadcast: isCurrent,+ },});- if (!sent.accepted) throwIpcError('PRECONDITION_FAILED', 'Could not start upstream merge task');+ if (!sent.accepted) throwIpcError('PRECONDITION_FAILED', 'Could not start Cindy Make task');}+export const dispatchCindyMakeMergeTask = dispatchCindyMakeTask;+export function configureCindyMakeTaskSender(sender: SendTask,getClearBoundary: (sessionId: string) => number | null,@@ -148,6 +164,8 @@ export async function restoreCindyMakeTaskState(): Promise<void> {}export async function assertCindyMakeTaskReady(sessionId: string): Promise<void> {+ if (isEditingBlocked(sessionId))+ throwIpcError('PRECONDITION_FAILED', 'Stop Cindy Make testing or building before editing');const [card] = await getDbClient().drizzle.select({ content: messages.content }).from(messages)@@ -339,10 +357,12 @@ export async function startCindyMakeTask(raw: unknown, sender: number): Promise<throwIpcError('PRECONDITION_FAILED', 'Task preparation was cleared');const data = JSON.parse(previous.content).__cindyMakeCard?.data;if (- data?.report?.task?.originSessionId !== input.originSessionId ||+ (input.originSessionId !== undefined &&+ data?.report?.task?.originSessionId !== input.originSessionId) ||data?.request !== input.request)throwIpcError('INVALID_PARAMS', 'Task run does not match');+ input.originSessionId = data.report.task?.originSessionId;sessionId = previous.sessionId;expectedClearBoundaryMs = previous.clearedAt;checkPreparationCurrent();diff --git a/apps/desktop/src/main/cindy-make/testController.ts b/apps/desktop/src/main/cindy-make/testController.tsindex 91b5fdc888..554374e086 100644--- a/apps/desktop/src/main/cindy-make/testController.ts+++ b/apps/desktop/src/main/cindy-make/testController.ts@@ -1,8 +1,11 @@+import { randomUUID } from 'node:crypto';import type {CindyMakeCompletionMeta,CindyMakeTestAction,+ CindyMakeTestStep,CindyMakePersonalBuildState,} from '../../shared/cindyMakeSession.js';+import { parseCindyMakeBuildError } from '../../shared/cindyMakeSession.js';import type { PersonalArtifact } from './personalBuild.js';import { makeTestError, type MakeTestProcess, type MakeTestWorkspace } from './testRunner.js';@@ -20,7 +23,11 @@ export interface MakeTestControllerDeps {context: MakeTestContext,patch: Partial<CindyMakeCompletionMeta>,): Promise<CindyMakeCompletionMeta>;- launch(context: MakeTestContext, signal: AbortSignal): Promise<MakeTestProcess>;+ launch(+ context: MakeTestContext,+ signal: AbortSignal,+ publish: (step: CindyMakeTestStep) => void,+ ): Promise<MakeTestProcess>;withUse(context: MakeTestContext, run: () => Promise<void>): Promise<void>;build?(context: MakeTestContext,@@ -28,6 +35,9 @@ export interface MakeTestControllerDeps {publish: (state: CindyMakePersonalBuildState) => Promise<void>,): Promise<PersonalArtifact>;openBuild?(context: MakeTestContext): Promise<void>;+ /** Publish the same build receipt to Settings and the completion card. */+ onBuildState?(context: MakeTestContext, state: CindyMakePersonalBuildState): void;+ claimBuild?(): () => void;now?: () => number;}@@ -36,8 +46,14 @@ interface TestJob {context: MakeTestContext;controller: AbortController;process?: MakeTestProcess;+ testReady?: boolean;accepted: Promise<CindyMakeCompletionMeta>;finished: Promise<void>;+ buildId?: string;+ startedAt?: number;+ cancelled?: boolean;+ persistence: Promise<unknown>;+ releaseBuild?: () => void;}/** Owns test launches independently of any renderer, and never replays a launch after restart. */@@ -47,8 +63,22 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {job.controller.abort();job.process?.stop();};+ const saveBuild = (job: TestJob, state: CindyMakePersonalBuildState) => {+ const pending = job.persistence.then(async () => {+ if (!job.context.isCurrent()) throw makeTestError('unavailable');+ if (state.stopping && ['ready', 'failed'].includes(job.context.meta.personal?.status ?? ''))+ return;+ if (job.cancelled && !state.stopping && !['ready', 'failed'].includes(state.status)) return;+ const next = { ...state, buildId: job.buildId, startedAt: job.startedAt };+ job.context.meta = await deps.save(job.context, { lastAction: 'build', personal: next });+ deps.onBuildState?.(job.context, next);+ });+ job.persistence = pending.catch(() => {});+ return pending;+ };const execute = async (job: TestJob) => {const { context, controller } = job;+ let acceptingProgress = true;const check = () => {controller.signal.throwIfAborted();if (!context.isCurrent()) throw makeTestError('unavailable');@@ -64,21 +94,36 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {if (!deps.build) throw makeTestError('unavailable');const artifact = await deps.build(context, controller.signal, async (state) => {check();- context.meta = await deps.save(context, { personal: state });+ await saveBuild(job, state);});// The builder returns only after publishing the verified artifact. Preserve that// receipt even if Continue Editing arrived during its final publication.if (!context.isCurrent()) throw makeTestError('unavailable');- context.meta = await deps.save(context, {- personal: { status: 'ready', ...artifact, generatedAt: (deps.now ?? Date.now)() },+ await saveBuild(job, {+ status: 'ready',+ ...artifact,+ generatedAt: (deps.now ?? Date.now)(),});return;}- job.process = await deps.launch(context, controller.signal);+ job.process = await deps.launch(context, controller.signal, (step) => {+ if (!acceptingProgress || controller.signal.aborted || !context.isCurrent()) return;+ // Serialize step writes with the terminal receipt so late progress cannot revive startup.+ job.persistence = job.persistence+ .then(async () => {+ check();+ if (context.meta.test?.step === step) return;+ context.meta = await deps.save(context, { test: { status: 'starting', step } });+ })+ .catch(() => stop(job));+ });try {await job.process.ready;+ acceptingProgress = false;+ await job.persistence;check();context.meta = await deps.save(context, { test: { status: 'ready' } });+ job.testReady = true;await job.process.closed;if (context.isCurrent())context.meta = await deps.save(context, { test: { status: 'stopped' } });@@ -88,28 +133,21 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {}});} catch (error) {+ acceptingProgress = false;+ await job.persistence;job.process?.stop();if (context.isCurrent()) {const code = (error as { code?: unknown })?.code;if (job.kind === 'build') {- const known = [- 'unavailable',- 'changed',- 'environment',- 'missingShell',- 'checksFailed',- 'conflict',- 'baselineChanged',- 'interrupted',- ];- const failure = controller.signal.aborted- ? 'interrupted'- : typeof code === 'string' && known.includes(code)- ? (code as CindyMakePersonalBuildState['error'])- : 'buildFailed';- await deps- .save(context, { personal: { status: 'failed', error: failure } })- .catch(() => {});+ const failure =+ code === 'cleanupFailed'+ ? 'cleanupFailed'+ : controller.signal.aborted+ ? job.cancelled+ ? 'cancelled'+ : 'interrupted'+ : parseCindyMakeBuildError(code);+ await saveBuild(job, { status: 'failed', error: failure }).catch(() => {});return;}const errorCode =@@ -123,17 +161,39 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {.save(context, {test: controller.signal.aborted? { status: 'stopped' }- : { status: 'failed', error: errorCode },+ : { status: 'failed', step: context.meta.test?.step, error: errorCode },}).catch(() => {});}} finally {clearInterval(ownerWatch);if (jobs.get(context.sessionId) === job) jobs.delete(context.sessionId);+ job.releaseBuild?.();}};return {hasActiveJobs: () => jobs.size > 0,+ isUsingSession: (sessionId: string) => jobs.has(sessionId),+ activeBuild: () => {+ const job = [...jobs.values()].find(+ (entry) => entry.kind === 'build' && entry.context.isCurrent(),+ );+ return job?.context.meta.personal;+ },+ async cancelBuild(buildId: string): Promise<void> {+ const job = [...jobs.values()].find((entry) => entry.buildId === buildId);+ if (!job || !job.context.isCurrent() || job.cancelled) return;+ await job.accepted;+ const state = job.context.meta.personal;+ if (!job.context.isCurrent() || !state || ['ready', 'failed'].includes(state.status)) return;+ job.cancelled = true;+ // Keep the lease until execute settles cleanup, and publish Stop before aborting.+ try {+ await saveBuild(job, { ...state, stopping: true });+ } finally {+ stop(job);+ }+ },isBuilding: (sessionId: string) => jobs.get(sessionId)?.kind === 'build',async stopTestForBuild(sessionId: string): Promise<void> {const job = jobs.get(sessionId);@@ -160,20 +220,30 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {const matching =previous?.context.completionId === completionId && previous.context.isCurrent();if (action === 'continue') {- if (previous && previous.context.isCurrent()) stop(previous);+ if (previous?.kind === 'test' && previous.context.isCurrent() && !previous.testReady)+ throw makeTestError('unavailable');+ if (previous && previous.context.isCurrent()) {+ stop(previous);+ if (previous.kind === 'test') await previous.finished;+ }return deps.save(context, { continuedAt: (deps.now ?? Date.now)() });}if (action === 'status') {if (matching) return previous!.accepted.then(() => previous!.context.meta);const patch: Partial<CindyMakeCompletionMeta> = {};if (['starting', 'ready'].includes(context.meta.test?.status ?? ''))- patch.test = { status: 'stopped', error: 'interrupted' };+ patch.test = { ...context.meta.test, status: 'stopped', error: 'interrupted' };if (['waiting', 'checking', 'merging', 'packaging', 'publishing'].includes(context.meta.personal?.status ?? '',))- patch.personal = { status: 'failed', error: 'interrupted' };+ patch.personal = {+ ...context.meta.personal,+ status: 'failed',+ stopping: undefined,+ error: 'interrupted',+ };if (Object.keys(patch).length) return deps.save(context, patch);return context.meta;}@@ -187,6 +257,13 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {throw makeTestError('unavailable');const kind = action === 'build' ? 'build' : 'test';if (kind === 'build' && !deps.build) throw makeTestError('unavailable');+ if (+ kind === 'build' &&+ [...jobs.values()].some(+ (job) => job.kind === 'build' && job.context.sessionId !== sessionId,+ )+ )+ throw makeTestError('unavailable');while (previous) {if (previous.context.completionId === completionId &&@@ -208,26 +285,32 @@ export function createMakeTestController(deps: MakeTestControllerDeps) {controller: new AbortController(),accepted: Promise.resolve(context.meta),finished: Promise.resolve(),+ persistence: Promise.resolve(),+ releaseBuild: kind === 'build' ? deps.claimBuild?.() : undefined,+ ...(kind === 'build' ? { buildId: randomUUID(), startedAt: (deps.now ?? Date.now)() } : {}),};jobs.set(sessionId, job);job.accepted = deps.save(context,kind === 'test'- ? { lastAction: 'test', test: { status: 'starting' } }- : { lastAction: 'build', personal: { status: 'waiting' } },+ ? { lastAction: 'test', test: { status: 'starting', step: 'waiting' } }+ : {+ lastAction: 'build',+ personal: { status: 'waiting', buildId: job.buildId, startedAt: job.startedAt },+ },)- .then(- (meta) => {- context.meta = meta;- job.finished = execute(job);- return meta;- },- (error) => {- if (jobs.get(sessionId) === job) jobs.delete(sessionId);- throw error;- },- );+ .then((meta) => {+ context.meta = meta;+ if (kind === 'build') deps.onBuildState?.(context, meta.personal!);+ job.finished = execute(job);+ return meta;+ })+ .catch((error) => {+ if (jobs.get(sessionId) === job) jobs.delete(sessionId);+ job.releaseBuild?.();+ throw error;+ });return job.accepted;},};diff --git a/apps/desktop/src/main/cindy-make/testRunner.ts b/apps/desktop/src/main/cindy-make/testRunner.tsindex 74addd9a2d..c569cf905f 100644--- a/apps/desktop/src/main/cindy-make/testRunner.ts+++ b/apps/desktop/src/main/cindy-make/testRunner.ts@@ -12,7 +12,7 @@ import {makeTaskWorktreePath,makeWorktreesRoot,} from './sourcePaths.js';-import type { CindyMakeTestState } from '../../shared/cindyMakeSession.js';+import type { CindyMakeTestState, CindyMakeTestStep } from '../../shared/cindyMakeSession.js';export type MakeTestError = NonNullable<CindyMakeTestState['error']>;export function makeTestError(code: MakeTestError): Error & { code: MakeTestError } {@@ -43,6 +43,17 @@ const OS_ENV_KEYS = new Set(['lang','lc_all','lc_ctype',+ // The child must reconnect to the user's desktop session on X11 and Wayland.+ // Keep this explicit: XDT overrides, credentials and loader hooks stay excluded.+ 'display',+ 'wayland_display',+ 'xauthority',+ 'xdg_runtime_dir',+ 'xdg_session_type',+ 'xdg_current_desktop',+ 'xdg_session_desktop',+ 'desktop_session',+ 'dbus_session_bus_address','pnpm_home','corepack_home','node_extra_ca_certs',@@ -176,6 +187,7 @@ export function launchMakeTest(region: 'cn' | 'global',signal: AbortSignal,spawn: PtySpawnFn = defaultPtySpawn,+ onStep?: (step: CindyMakeTestStep) => void,): MakeTestProcess {signal.throwIfAborted();const sandbox =@@ -217,6 +229,7 @@ export function launchMakeTest(let stopping = false;let pending = '';let verdict: Record<string, string> | undefined;+ let lastStep: CindyMakeTestStep | undefined;const timeout = setTimeout(() => fail('timeout'), 25 * 60_000);const finish = () => {if (stopped) return;@@ -266,6 +279,27 @@ export function launchMakeTest(pending = lines.pop() ?? '';for (const raw of lines) {const line = raw.replace(/\u001b\[[0-?]*[ -/]*[@-~]/g, '').trim();+ if (!settled && !stopping) {+ // Older checkouts have no step protocol. Read only fixed stage prefixes;+ // arbitrary terminal output is never forwarded or persisted.+ const step = /^DESKTOP_DEV_STEP=(stopping|dependencies|assets|launching)$/.exec(+ line,+ )?.[1] as CindyMakeTestStep | undefined;+ const next =+ step ??+ (line.startsWith('[ensure-deps]')+ ? 'dependencies'+ : line.startsWith('[ensure-dev-runtime-assets]')+ ? 'assets'+ : line === '==> Starting desktop remote dev...' ||+ line === '==> Starting desktop local dev...'+ ? 'launching'+ : undefined);+ if (next && next !== lastStep) {+ lastStep = next;+ onStep?.(next);+ }+ }if (line === 'DESKTOP_DEV_VERDICT=failed') {fail('launchFailed');return;diff --git a/apps/desktop/src/main/cindy-make/testRuntime.ts b/apps/desktop/src/main/cindy-make/testRuntime.tsindex dcc42201f2..7e39e45bfd 100644--- a/apps/desktop/src/main/cindy-make/testRuntime.ts+++ b/apps/desktop/src/main/cindy-make/testRuntime.ts@@ -33,6 +33,7 @@ import { untilAborted } from './doctor.js';import { currentVersionProfile, rememberOriginalVersion } from './versionStartup.js';import { captureMakeHistoryStore } from './historyOwner.js';import { captureMakeHistoryCompletion } from './historyCapture.js';+import { broadcastMakeRemoteChanged } from './remoteBroadcast.js';let isRunning: (sessionId: string) => boolean = () => true;export function configureCindyMakeTestRuntime(probe: typeof isRunning): void {@@ -158,6 +159,7 @@ async function save(next,);await broadcastMessageAgentMetaUpdate(context.sessionId, context.completionId, fresh.scope);+ broadcastMakeRemoteChanged(context.sessionId, fresh.scope);return next;});}@@ -165,6 +167,21 @@ async function save(export const cindyMakeTestController = createMakeTestController({load,save,+ claimBuild: () => cindyMakeManager.claimPersonalBuild(),+ onBuildState: (context, state) => {+ if (!context.isCurrent()) throw makeTestError('unavailable');+ const store = captureMakeHistoryStore();+ store.saveBuild(state);+ if (state.status === 'ready' && state.commit) {+ for (const feature of state.includedFeatures ?? [])+ store.version(feature.runId, {+ operationId: feature.operationId,+ commit: state.commit,+ versionId: state.versionId,+ at: state.generatedAt ?? Date.now(),+ });+ }+ },withUse: (context, run) => cindyMakeManager.withProjectUse(makeSourceRoot(context.userData), run),build: (context, signal, publish) => {let entered = false;@@ -207,7 +224,7 @@ export const cindyMakeTestController = createMakeTestController({{mode: 'personal',userData: context.userData,- completionId: context.completionId,+ completionId: context.meta.personal?.buildId ?? context.completionId,title: context.title,profile: currentVersionProfile(),},@@ -239,7 +256,7 @@ export const cindyMakeTestController = createMakeTestController({try {const artifact = await personalArtifactPath(context.userData,- context.completionId,+ context.meta.personal?.buildId ?? context.completionId,context.meta.personal as PersonalArtifact,);if (!context.isCurrent()) throw makeTestError('unavailable');@@ -250,10 +267,11 @@ export const cindyMakeTestController = createMakeTestController({throw makeTestError('unavailable');}},- launch: (context, signal) =>+ launch: (context, signal, publish) =>cindyMakeManager.withProject(makeSourceRoot(context.userData),async () => {+ publish('environment');signal.throwIfAborted();const fresh = await load(context.sessionId, context.completionId);if (@@ -272,18 +290,22 @@ export const cindyMakeTestController = createMakeTestController({).catch(() => {throw makeTestError('environment');});+ publish('workspace');await verifyMakeTestWorkspace(context, env, signal);const node = await environment.probe('node', ['--version'], signal);if (node.status !== 'ok' || !node.path || !path.isAbsolute(node.path))throw makeTestError('environment');signal.throwIfAborted();if (!context.isCurrent()) throw makeTestError('unavailable');+ publish('stopping');return launchMakeTest(context,node.path,env,CURRENT_CINDY_REGION === 'cn' ? 'cn' : 'global',signal,+ undefined,+ publish,);},signal,@@ -311,6 +333,7 @@ export async function actCindyMakeTest(const { getCindyMakeHistory, actCindyMakeHistory } = await import('./historyRuntime.js');const history = await getCindyMakeHistory(context.runId);if (!context.isCurrent()) throw makeTestError('unavailable');+ if (history.busy) throw makeTestError('unavailable');if (!['integrated', 'unchanged'].includes(history.items.find((item) => item.runId === context.runId)?.integration ?? '',diff --git a/apps/desktop/src/main/i18n.ts b/apps/desktop/src/main/i18n.tsindex 32acf5fe4c..de6112a672 100644--- a/apps/desktop/src/main/i18n.ts+++ b/apps/desktop/src/main/i18n.ts@@ -111,8 +111,8 @@ function lookup(bundle: Record<string, unknown>, key: string): string | null {* {{appName}} 由品牌常量注入(本迷你 i18n 不支持其它变量,main 消费的 key 若* 需要更多插值,应像 bootstrap 菜单那样在调用点自行 replace)。*/-export function t(key: string): string {- const loc = getMainLocale();+export function t(key: string, locale?: SupportedLocale): string {+ const loc = locale ?? getMainLocale();let raw: string | null = null;for (const chainLocale of FALLBACK_CHAIN[loc]) {raw = lookup(resources[chainLocale], key);diff --git a/apps/desktop/src/main/maker-host/index.ts b/apps/desktop/src/main/maker-host/index.tsindex 3e9676630f..d53977a5c3 100644--- a/apps/desktop/src/main/maker-host/index.ts+++ b/apps/desktop/src/main/maker-host/index.ts@@ -56,6 +56,7 @@ import { createMessage } from '../localDb/ipc/messages.js';import { createCindyMakeMcpProvider } from '../cindy-make/mcpProvider.js';import { captureMakeHistoryStore } from '../cindy-make/historyOwner.js';import { captureMakeHistoryCompletion } from '../cindy-make/historyCapture.js';+import { broadcastMakeRemoteChanged } from '../cindy-make/remoteBroadcast.js';import { captureDataOwnerBroadcastScope, isDataOwnerBroadcastScopeCurrent } from '../device-link/broadcast-tap.js';import {collectCindyMakeChanges,@@ -1101,6 +1102,7 @@ export function getMaker(): Maker {});if (isDataOwnerBroadcastScopeCurrent(scope) && session?.workDir)captureMakeHistoryCompletion(history, path.basename(session.workDir), clientId, meta);+ broadcastMakeRemoteChanged(sessionId, scope);},logger: desktopMakerLogger,});diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.jsonindex ef0659c24e..c5a4daea18 100644--- a/apps/desktop/src/renderer/i18n/locales/en/common.json+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json@@ -12968,6 +12968,13 @@}},"test": {+ "resume": {+ "title": "Continue testing",+ "description": "Check the current changes to restore the test and personal build options.",+ "action": "Check and continue",+ "failed": "Could not start the checks. Please try again.",+ "request": "Check the current changes, then restore the test and personal build options and wait for me to choose the next step."+ },"title": "Changes Complete — Choose Next Step","description": "Continue editing, try an isolated test build, or build your personal installer.","readyHint": "Try the changes in the test window. Continue Editing closes it and restores input.",@@ -12988,6 +12995,19 @@"launchFailed": "The test build could not start. Retry or return to editing.","timeout": "The test build took too long to start. Retry the launch.","interrupted": "The previous test was interrupted. Launch the isolated build again."+ },+ "retry": "Retry Launch",+ "startingHint": "Editing is paused until startup finishes. Wait for the current step to complete.",+ "currentStep": "Current step: {{step}}",+ "failedStep": "Interrupted step: {{step}}",+ "steps": {+ "waiting": "Waiting to start",+ "environment": "Checking the test environment",+ "workspace": "Verifying the changes",+ "stopping": "Preparing the isolated instance",+ "dependencies": "Checking and preparing dependencies",+ "assets": "Checking and preparing runtime assets",+ "launching": "Compiling and opening the test window"}},"history": {diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.jsonindex 1632339fa4..8096e0fed6 100644--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json@@ -12951,6 +12951,13 @@}},"test": {+ "resume": {+ "title": "テストを続ける",+ "description": "現在の変更を確認し、問題がなければテストと個人版の作成を選べるようにします。",+ "action": "確認して続ける",+ "failed": "確認を開始できませんでした。もう一度お試しください。",+ "request": "現在の変更を確認し、完了したらテストと個人版の作成を選べるようにして、次の操作を選ぶまで待ってください。"+ },"title": "変更完了・次の操作を選択","description": "編集を続けるか、隔離テスト版を起動するか、個人版のインストーラーを作成できます。","readyHint": "テスト用ウィンドウで変更を確認してください。「編集を続ける」を選ぶとテスト版を閉じ、入力に戻ります。",@@ -12971,6 +12978,19 @@"launchFailed": "テスト版を起動できませんでした。再試行するか、編集に戻ってください。","timeout": "テスト版の起動がタイムアウトしました。再試行してください。","interrupted": "前回のテストは中断されました。隔離テスト版を再起動してください。"+ },+ "retry": "起動を再試行",+ "startingHint": "起動が完了するまで編集は一時停止されます。現在の手順が完了するまでお待ちください。",+ "currentStep": "現在の手順: {{step}}",+ "failedStep": "中断した手順: {{step}}",+ "steps": {+ "waiting": "起動を待機",+ "environment": "テスト環境を確認",+ "workspace": "変更内容を検証",+ "stopping": "隔離インスタンスを準備",+ "dependencies": "依存関係を確認・準備",+ "assets": "実行時リソースを確認・準備",+ "launching": "コンパイルしてテスト用ウィンドウを開く"}},"history": {diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.jsonindex ddbeb97fc8..905d12015d 100644--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json@@ -12951,6 +12951,13 @@}},"test": {+ "resume": {+ "title": "테스트 계속하기",+ "description": "현재 변경 사항을 확인한 뒤 테스트와 개인 버전 생성 옵션을 다시 표시합니다.",+ "action": "확인 후 계속",+ "failed": "확인을 시작하지 못했습니다. 다시 시도해 주세요.",+ "request": "현재 변경 사항을 확인한 뒤 테스트와 개인 버전 생성 옵션을 다시 표시하고, 제가 다음 단계를 선택할 때까지 기다려 주세요."+ },"title": "수정 완료 · 다음 단계 선택","description": "수정을 계속하거나, 격리 테스트 버전을 실행하거나, 개인 버전 설치 파일을 생성할 수 있습니다.","readyHint": "테스트 창에서 수정 사항을 확인하세요. 계속 수정을 선택하면 테스트 버전이 종료되고 입력창으로 돌아갑니다.",@@ -12971,6 +12978,19 @@"launchFailed": "테스트 버전을 실행하지 못했습니다. 다시 시도하거나 편집으로 돌아가세요.","timeout": "테스트 버전 실행 시간이 초과되었습니다. 다시 시도하세요.","interrupted": "이전 테스트가 중단되었습니다. 격리 테스트 버전을 다시 실행하세요."+ },+ "retry": "실행 다시 시도",+ "startingHint": "실행 준비가 끝날 때까지 수정이 일시 중지됩니다. 현재 단계가 완료될 때까지 기다려 주세요.",+ "currentStep": "현재 단계: {{step}}",+ "failedStep": "중단된 단계: {{step}}",+ "steps": {+ "waiting": "실행 대기",+ "environment": "테스트 환경 확인",+ "workspace": "수정 내용 검증",+ "stopping": "격리 인스턴스 준비",+ "dependencies": "종속성 확인 및 준비",+ "assets": "런타임 리소스 확인 및 준비",+ "launching": "컴파일 및 테스트 창 열기"}},"history": {diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.jsonindex 84f3c039b4..5f5d8e7554 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json@@ -12951,6 +12951,13 @@}},"test": {+ "resume": {+ "title": "继续测试",+ "description": "先检查当前修改,通过后恢复测试和生成个人版的选项。",+ "action": "检查并继续",+ "failed": "未能开始检查,请重试。",+ "request": "请检查当前修改,完成后恢复测试和生成个人版的选项,等待我选择下一步。"+ },"title": "修改已完成,选择下一步","description": "可以继续修改、启动隔离版测试,或直接生成个人版安装包。","readyHint": "请在测试窗口体验修改。点击“继续修改”会关闭测试版并恢复输入。",@@ -12971,6 +12978,19 @@"launchFailed": "未能启动隔离版,请重试;仍失败可返回继续修改。","timeout": "隔离版启动超时,请重试。","interrupted": "上次测试已中断,请重新启动隔离版。"+ },+ "retry": "重试启动",+ "startingHint": "启动完成前暂时不能继续修改,请等待当前步骤完成。",+ "currentStep": "当前步骤:{{step}}",+ "failedStep": "中断步骤:{{step}}",+ "steps": {+ "waiting": "等待启动",+ "environment": "检查测试环境",+ "workspace": "核验修改内容",+ "stopping": "准备隔离实例",+ "dependencies": "检查并准备依赖",+ "assets": "检查并准备运行资源",+ "launching": "编译并打开测试窗口"}},"history": {diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.jsonindex 6edaa41b27..ae3f1322bc 100644--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json@@ -12951,6 +12951,13 @@}},"test": {+ "resume": {+ "title": "繼續測試",+ "description": "先檢查目前的修改,通過後恢復測試和產生個人版的選項。",+ "action": "檢查並繼續",+ "failed": "未能開始檢查,請重試。",+ "request": "請檢查目前的修改,完成後恢復測試和產生個人版的選項,等待我選擇下一步。"+ },"title": "修改已完成,選擇下一步","description": "可以繼續修改、啟動隔離版測試,或直接產生個人版安裝套件。","readyHint": "請在測試視窗體驗修改。點擊「繼續修改」會關閉測試版並恢復輸入。",@@ -12971,6 +12978,19 @@"launchFailed": "未能啟動隔離版,請重試;仍失敗可返回繼續修改。","timeout": "隔離版啟動逾時,請重試。","interrupted": "上次測試已中斷,請重新啟動隔離版。"+ },+ "retry": "重試啟動",+ "startingHint": "啟動完成前暫時無法繼續修改,請等待目前步驟完成。",+ "currentStep": "目前步驟:{{step}}",+ "failedStep": "中斷步驟:{{step}}",+ "steps": {+ "waiting": "等待啟動",+ "environment": "檢查測試環境",+ "workspace": "核驗修改內容",+ "stopping": "準備隔離執行個體",+ "dependencies": "檢查並準備依賴",+ "assets": "檢查並準備執行資源",+ "launching": "編譯並開啟測試視窗"}},"history": {diff --git a/apps/desktop/src/shared/cindyMakeSession.ts b/apps/desktop/src/shared/cindyMakeSession.tsindex fcd747aa93..7c21a71bd6 100644--- a/apps/desktop/src/shared/cindyMakeSession.ts+++ b/apps/desktop/src/shared/cindyMakeSession.ts@@ -49,9 +49,14 @@ export interface CindyMakeCompletionMeta {export interface CindyMakeTestState {status: 'starting' | 'ready' | 'failed' | 'stopped';+ /** Optional startup detail; older completions retain the broad status. */+ step?: CindyMakeTestStep;error?: 'unavailable' | 'changed' | 'environment' | 'launchFailed' | 'timeout' | 'interrupted';}+export type CindyMakeTestStep =+ 'waiting' | 'environment' | 'workspace' | 'stopping' | 'dependencies' | 'assets' | 'launching';+export interface CindyMakePersonalBuildState {status: 'waiting' | 'checking' | 'merging' | 'packaging' | 'publishing' | 'ready' | 'failed';/** Optional detail within checking; old records/clients retain the broad status. */diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsxindex 6843638272..ac74f85a0c 100644--- a/apps/mobile/app/sessions/[sessionId].tsx+++ b/apps/mobile/app/sessions/[sessionId].tsx@@ -4,6 +4,8 @@ import { getActiveMobileSessionRealm } from '@/config/env';import { FailedScheduleNotice } from '@/session/FailedScheduleNotice';import { shouldShowFailedScheduleNotice, type FailedScheduleRunSnapshot } from '@cindy/maker-shared/schedule-model';import { useRemoteResourceSession } from '@/session/useRemoteResourceSession';+import { useSessionResourceCards } from '@/session/useSessionResourceCards';+import { SessionResourceCards } from '@/session/SessionResourceCards';import { mobileDebugLog } from '@/debug/mobileDebugLog';import { isInFlightDeviceLinkError } from '@cindy/device-link';import { takeRefinementContextTail, truncateRefinementReply } from '@cindy/voice-input-core';@@ -2224,6 +2226,9 @@ export default function SessionScreen() {&& contentRecoveryKey !== null && contentSyncedKey === contentRecoveryKey&& !outboxRecoverySyncHeld && !loading);const lastAckKeyRef = useRef<string | null>(null);+ const sessionResourceCards = useSessionResourceCards(+ deviceId, deviceName, sessionId, currentSession?.source, remoteSessionRunning,+ );// AppState 门槛:锁屏 / 切后台时导航焦点不变,useFocusEffect 的 cleanup 不会跑,// 驻留计时器可能在没有真实前台展示的情况下(甚至后台恢复补跑时)发出 explicit// 回执。把 AppState 作为回执 effect 的重算信号:离开 active 立刻取消未到期的@@ -2399,7 +2404,7 @@ export default function SessionScreen() {setPendingPlanViewerState('half');}}, [activePendingKind, activePendingRequestId, sessionOperationLayout.composerSlot]);- const canUseComposer = sessionOperationLayout.canUseComposer;+ const canUseComposer = sessionOperationLayout.canUseComposer && !sessionResourceCards.blocked;const canUseRemoteSessionControls = canUseComposer&& !sessionSettingsLocked&& !remoteRealtimeControlsUnavailable;@@ -2412,7 +2417,9 @@ export default function SessionScreen() {);const composerDisabledReason = composerDisabledReasonKey? t(composerDisabledReasonKey)- : sessionOperationLayout.composerDisabledReason;+ : sessionOperationLayout.composerDisabledReason+ ?? (sessionResourceCards.blocked+ ? sessionResourceCards.blockedReason ?? t('shared.syncing') : null);// inline 队列操作可用性:旧队列弹层由 showQueue 整体隐藏(离线/被撤销、pending// interaction 等),inline 化后气泡必须留在消息流里,故改为保留渲染、按同一规则// 禁用操作(取消/编辑/插话/重试/恢复),禁用理由沿用 composerDisabledReason。@@ -9640,7 +9647,8 @@ export default function SessionScreen() {<Text style={styles.queueEditBarText}>{composerAgentAuthHint}</Text></View>) : null}- <SessionComposerInput+ <SessionResourceCards state={sessionResourceCards} />+ {!sessionResourceCards.blocked ? <SessionComposerInputpromptRecommendation={promptRecommendation}onDismissPromptRecommendation={dismissPromptRecommendation}key={activeComposerDraftScopeKey}@@ -9678,7 +9686,7 @@ export default function SessionScreen() {onPasteImages={(uris) => void addPastedImageAttachments(uris)}onDragActiveChange={handleComposerDragActiveChange}renderControls={renderComposerControls}- />+ /> : null}</>)}{shareSelectionActive ? (diff --git a/apps/mobile/src/__tests__/remoteResources.test.ts b/apps/mobile/src/__tests__/remoteResources.test.tsindex 110fb9894a..39ffbbfceb 100644--- a/apps/mobile/src/__tests__/remoteResources.test.ts+++ b/apps/mobile/src/__tests__/remoteResources.test.ts@@ -3,6 +3,7 @@ import { DeviceLinkError } from '@cindy/device-link';import {MOBILE_REMOTE_RESOURCE_PRIMITIVES,+ getRemoteResource,discoverRemoteHomeCollections,remoteResourceDiscoveryTargets,isRemoteResourcesUnsupported,@@ -33,7 +34,7 @@ describe('remote resource discovery', () => {});it('advertises only primitives implemented by the current mobile shell', () => {- expect(MOBILE_REMOTE_RESOURCE_PRIMITIVES).toEqual(['status', 'session-link']);+ expect(MOBILE_REMOTE_RESOURCE_PRIMITIVES).toEqual(['status', 'session-link', 'session-controls']);});it('merges host-advertised home collections without knowing their feature module', async () => {@@ -200,3 +201,27 @@ describe('remote resource route targets', () => {.toEqual([]);});});++describe('portable task controls', () => {+ it('preserves only bounded actions and known primitive data, keeping unknown blocks readable', async () => {+ const ref = { collectionId: 'workflow', kind: 'session', id: 'task' };+ const invoke = vi.fn(async () => ({+ ref, revision: '2', display: { title: 'Test' }, links: [],+ actions: [+ { id: 'start', label: 'Start' }, { id: 'continue', label: 'Continue', disabled: true },+ { id: 'form', label: 'Form', fields: [{ id: 'secret' }] },+ { id: 'confirm', label: 'Confirm', confirmation: { title: 'Sure?' } },+ { id: 'x'.repeat(161), label: 'Too long' },+ ],+ blocks: [+ { id: 'workflow', primitive: 'session-controls', fallbackMarkdown: 'Installing dependencies', data: { input: 'blocked', busy: true, path: '/private' } },+ { id: 'future', primitive: 'future-widget', fallbackMarkdown: 'Readable fallback', data: { html: '<script>' } },+ ],+ })) as RemoteInvoke;+ const card = await getRemoteResource(invoke, targets[0], ref);+ expect(card.actions).toEqual([{ id: 'start', label: 'Start', disabled: false }, { id: 'continue', label: 'Continue', disabled: true }]);+ expect(card.blocks?.[0].data).toEqual({ input: 'blocked', busy: true });+ expect(card.blocks?.[1]).toEqual({ id: 'future', primitive: 'future-widget', fallbackMarkdown: 'Readable fallback' });+ expect(JSON.stringify(card)).not.toContain('/private');+ });+});diff --git a/apps/mobile/src/__tests__/useSessionResourceCards.test.tsx b/apps/mobile/src/__tests__/useSessionResourceCards.test.tsxnew file mode 100644index 0000000000..9b29784d3d--- /dev/null+++ b/apps/mobile/src/__tests__/useSessionResourceCards.test.tsx@@ -0,0 +1,307 @@+// @vitest-environment jsdom+import { act, createElement } from 'react';+import { createRoot, type Root } from 'react-dom/client';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import type {+ RemoteResource,+ RemoteResourceChangedPayload,+} from '@cindy/device-link';++const h = vi.hoisted(() => ({+ get: vi.fn(),+ manifest: vi.fn(),+ action: vi.fn(),+ changes: new Set<+ (device: string, payload: RemoteResourceChangedPayload) => void+ >(),+ app: { currentState: 'active', listeners: new Set<(next: string) => void>() },+ auth: { accountGeneration: 1 },+ link: {+ invoke: vi.fn(),+ connectionEpoch: 1,+ status: 'online',+ subscribe: vi.fn(),+ unsubscribe: vi.fn(),+ },+}));+vi.mock('react-native', () => ({+ AppState: {+ get currentState() {+ return h.app.currentState;+ },+ addEventListener: (_name: string, listener: (next: string) => void) => {+ h.app.listeners.add(listener);+ return { remove: () => h.app.listeners.delete(listener) };+ },+ },+}));+vi.mock('expo-router', async () => {+ const { useEffect } = await import('react');+ return {+ useFocusEffect: (effect: () => void | (() => void)) =>+ useEffect(effect, [effect]),+ };+});+vi.mock('react-i18next', () => ({+ useTranslation: () => ({ i18n: { language: 'en' } }),+}));+vi.mock('@/auth/AuthContext', () => ({ useAuth: () => h.auth }));+const onChange = (+ listener: (device: string, payload: RemoteResourceChangedPayload) => void,+) => {+ h.changes.add(listener);+ return () => h.changes.delete(listener);+};+vi.mock('@/device-link/DeviceLinkContext', () => ({+ useDeviceLink: () => ({ ...h.link, onRemoteResourceChanged: onChange }),+}));+vi.mock('@/device-link/remoteResources', () => ({+ getRemoteResource: h.get,+ loadRemoteResourceManifest: h.manifest,+ invokeRemoteResourceAction: h.action,+}));+vi.mock('@/device-link/focusedTopicSubscription', () => ({+ startFocusedTopicSubscription: () => () => {},+}));+import { useSessionResourceCards } from '@/session/useSessionResourceCards';++Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });+let root: Root | undefined;+const views = new Map<string, ReturnType<typeof useSessionResourceCards>>();+const resource = (revision = '1', input = 'blocked'): RemoteResource => ({+ ref: { collectionId: 'workflow', kind: 'session', id: 'task' },+ revision,+ display: { title: 'Preparing test' },+ links: [],+ blocks: [+ {+ id: 'controls',+ primitive: 'session-controls',+ fallbackMarkdown: 'Preparing test',+ data: { input, busy: true },+ },+ ],+ actions: [{ id: 'start', label: 'Start' }],+});+function deferred<T>() {+ let resolve!: (value: T) => void;+ let reject!: (error: Error) => void;+ const promise = new Promise<T>((yes, no) => {+ resolve = yes;+ reject = no;+ });+ return { promise, resolve, reject };+}+function Probe({+ device,+ session = 'task',+}: {+ device: string;+ session?: string;+}) {+ views.set(+ device,+ useSessionResourceCards(device, device, session, 'host-feature', false),+ );+ return null;+}+async function render(session = 'task', second = false) {+ root ??= createRoot(document.createElement('div'));+ await act(async () =>+ root!.render(+ createElement(+ 'div',+ {},+ createElement(Probe, { device: 'mac', session }),+ second ? createElement(Probe, { device: 'pc' }) : null,+ ),+ ),+ );+}+async function advance(ms = 160) {+ await act(async () => {+ await vi.advanceTimersByTimeAsync(ms);+ });+}+function push(device = 'mac') {+ act(() =>+ h.changes.forEach((listener) =>+ listener(device, {+ collectionId: 'workflow',+ resourceRefs: [resource().ref],+ }),+ ),+ );+}+function foreground(next: string) {+ act(() => {+ h.app.currentState = next;+ h.app.listeners.forEach((listener) => listener(next));+ });+}+beforeEach(() => {+ vi.useFakeTimers();+ vi.resetAllMocks();+ views.clear();+ h.auth.accountGeneration = 1;+ h.link.connectionEpoch = 1;+ h.link.status = 'online';+ h.app.currentState = 'active';+ h.manifest.mockResolvedValue({+ collections: [+ {+ id: 'workflow',+ resourceKind: 'session',+ placement: 'session:host-feature',+ },+ ],+ });+ h.get.mockResolvedValue(resource());+ h.action.mockResolvedValue({ effects: [] });+});+afterEach(() => {+ act(() => root?.unmount());+ root = undefined;+ vi.useRealTimers();+});++describe('host task cards on Mobile', () => {+ it('keeps available input mounted during progress refresh but blocks after a failed read', async () => {+ h.get.mockResolvedValue(resource('1', 'available'));+ await render();+ const slow = deferred<RemoteResource>();+ h.get.mockReturnValueOnce(slow.promise);+ push();+ expect(views.get('mac')?.fresh).toBe(false);+ expect(views.get('mac')?.blocked).toBe(false);+ await advance();+ expect(views.get('mac')?.blocked).toBe(false);+ await act(async () => slow.reject(new Error('offline')));+ expect(views.get('mac')?.blocked).toBe(true);+ });+ it('holds input after an action until the host has confirmed its resulting state', async () => {+ h.get.mockResolvedValue(resource('1', 'available'));+ await render();+ await act(async () => views.get('mac')!.act(resource(), 'start'));+ expect(views.get('mac')?.blocked).toBe(true);+ h.get.mockResolvedValue(resource('2', 'available'));+ await advance();+ expect(views.get('mac')?.blocked).toBe(false);+ });+ it('uses desktop invalidation to replace progress and unlock editing', async () => {+ await render();+ expect(views.get('mac')?.blocked).toBe(true);+ h.get.mockResolvedValue(resource('2', 'available'));+ push();+ expect(views.get('mac')?.fresh).toBe(false);+ await advance();+ expect(views.get('mac')?.resources[0].revision).toBe('2');+ expect(views.get('mac')?.blocked).toBe(false);+ });+ it('coalesces progress pushes and discards reads superseded by the desktop', async () => {+ await render();+ const old = deferred<RemoteResource>();+ h.get.mockReturnValueOnce(old.promise);+ push();+ await advance();+ push();+ push();+ push();+ expect(h.get).toHaveBeenCalledTimes(2);+ await act(async () => old.resolve(resource('old')));+ expect(views.get('mac')?.resources[0].revision).toBe('1');+ h.get.mockResolvedValue(resource('new'));+ await advance();+ expect(h.get).toHaveBeenCalledTimes(3);+ expect(views.get('mac')?.resources[0].revision).toBe('new');+ });+ it('does not starve a read slower than the polling interval', async () => {+ const slow = deferred<RemoteResource>();+ h.get.mockReturnValueOnce(slow.promise);+ await render();+ await advance(12_000);+ expect(h.get).toHaveBeenCalledOnce();+ await act(async () => slow.resolve(resource('slow')));+ expect(views.get('mac')?.fresh).toBe(true);+ });+ it('keeps another device usable when one read fails; retries reads only', async () => {+ await render('task', true);+ h.get.mockImplementation(async (_invoke, target) => {+ if (target.deviceId === 'mac') throw new Error('timeout');+ return resource('pc-new', 'available');+ });+ push();+ push('pc');+ await advance();+ expect(views.get('mac')?.failed).toBe(true);+ expect(views.get('pc')?.blocked).toBe(false);+ expect(h.action).not.toHaveBeenCalled();+ h.get.mockResolvedValue(resource('recovered', 'available'));+ act(() => views.get('mac')?.refresh());+ await advance();+ expect(views.get('mac')?.failed).toBe(false);+ });+ it.each(['account', 'session', 'reconnect'])(+ 'ignores late results after %s changes',+ async (change) => {+ const old = deferred<RemoteResource>();+ h.get.mockReturnValueOnce(old.promise);+ await render();+ h.get.mockResolvedValue(resource('current'));+ if (change === 'account') h.auth.accountGeneration += 1;+ if (change === 'reconnect') h.link.connectionEpoch += 1;+ await render(change === 'session' ? 'new-task' : 'task');+ await act(async () => old.resolve(resource('old-owner')));+ expect(views.get('mac')?.resources[0].revision).toBe('current');+ },+ );+ it('refreshes after foreground and reconnect without replaying a timed-out action', async () => {+ await render();+ h.action.mockRejectedValueOnce(new Error('timeout after host accepted'));+ await act(async () => views.get('mac')!.act(resource(), 'start'));+ await advance();+ expect(views.get('mac')?.failed).toBe(true);+ expect(h.action).toHaveBeenCalledOnce();+ foreground('background');+ const before = h.get.mock.calls.length;+ await advance(10_000);+ expect(h.get).toHaveBeenCalledTimes(before);+ foreground('active');+ await advance();+ h.link.status = 'offline';+ await render();+ expect(views.get('mac')?.fresh).toBe(false);+ h.link.status = 'online';+ h.link.connectionEpoch += 1;+ await render();+ expect(h.action).toHaveBeenCalledOnce();+ act(() => views.get('mac')!.refresh());+ await advance();+ expect(views.get('mac')?.failed).toBe(false);+ });+ it('prevents a double tap and does not carry its pending state to another task', async () => {+ await render();+ const pending = deferred<{ effects: [] }>();+ h.action.mockReturnValueOnce(pending.promise);+ let first!: Promise<void>;+ act(() => {+ first = views.get('mac')!.act(resource(), 'start');+ void views.get('mac')!.act(resource(), 'start');+ });+ expect(h.action).toHaveBeenCalledOnce();+ await render('other');+ expect(views.get('mac')?.pending).toBeNull();+ await act(async () => {+ pending.resolve({ effects: [] });+ await first;+ });+ expect(views.get('mac')?.pending).toBeNull();+ });+ it('keeps an ordinary task unchanged when the host has no matching provider', async () => {+ h.manifest.mockResolvedValue(null);+ await render();+ expect(views.get('mac')?.resources).toEqual([]);+ expect(views.get('mac')?.blocked).toBe(false);+ expect(h.get).not.toHaveBeenCalled();+ });+});diff --git a/apps/mobile/src/device-link/remoteResources.ts b/apps/mobile/src/device-link/remoteResources.tsindex 4bded502c9..1149abed33 100644--- a/apps/mobile/src/device-link/remoteResources.ts+++ b/apps/mobile/src/device-link/remoteResources.ts@@ -18,6 +18,8 @@ import {type RemoteResourceRef,type RemoteResourceStatus,type RemoteText,+ type RemoteActionDescriptor,+ type RemoteResourceBlock,} from '@cindy/device-link';import type { RemoteInvoke } from './mobileMakerTransport';@@ -25,6 +27,7 @@ import type { RemoteInvoke } from './mobileMakerTransport';export const MOBILE_REMOTE_RESOURCE_PRIMITIVES = ['status','session-link',+ 'session-controls',] as const;export interface RemoteResourceHostTarget {@@ -332,7 +335,16 @@ export async function getRemoteResource(throw new Error('invalid remote resource response');}const source = recordOf(raw);- const blocks = Array.isArray(source?.blocks) ? source.blocks.slice(0, 256).flatMap((rawBlock) => {+ const actions: RemoteActionDescriptor[] = Array.isArray(source?.actions)+ ? source.actions.slice(0, 16).flatMap((value) => {+ const entry = recordOf(value);+ const id = boundedString(entry?.id, MAX_REMOTE_ID_CHARS);+ const label = normalizeRemoteText(entry?.label, 512);+ // Forms/confirmations require their own supported interaction. Never execute them silently.+ if (!entry || !id || !label || entry.fields || entry.confirmation) return [];+ return [{ id, label, disabled: entry.disabled !== undefined && entry.disabled !== false }];+ }) : [];+ const blocks: RemoteResourceBlock[] | undefined = Array.isArray(source?.blocks) ? source.blocks.slice(0, 256).flatMap<RemoteResourceBlock>((rawBlock) => {const block = recordOf(rawBlock);const id = boundedString(block?.id, 256);const primitive = boundedString(block?.primitive, 64);@@ -340,11 +352,13 @@ export async function getRemoteResource(if (!id || !primitive || fallbackMarkdown === null || fallbackMarkdown.length > 131072) return [];// Only the inert media URL primitive is needed here. Never copy arbitrary host data.const data = recordOf(block?.data);+ if (primitive === 'session-controls') return [{ id, primitive, fallbackMarkdown,+ data: { input: data?.input === 'available' ? 'available' : 'blocked', busy: data?.busy === true } }];const inlineIcon = ref.collectionId === 'plugin-identities' && id === 'icon' && primitive === 'image';const url = boundedString(data?.url, inlineIcon ? 256_000 : 4096);return [{ id, primitive, fallbackMarkdown, ...(url ? { data: { url } } : {}) }];}) : undefined;- return { ...normalized, ...(blocks ? { blocks } : {}) };+ return { ...normalized, ...(actions.length ? { actions } : {}), ...(blocks ? { blocks } : {}) };}function normalizeRemoteCollectionItem(diff --git a/apps/mobile/src/session/SessionResourceCards.tsx b/apps/mobile/src/session/SessionResourceCards.tsxnew file mode 100644index 0000000000..3204a17b27--- /dev/null+++ b/apps/mobile/src/session/SessionResourceCards.tsx@@ -0,0 +1,129 @@+import {+ ActivityIndicator,+ ScrollView,+ StyleSheet,+ View,+ useWindowDimensions,+} from 'react-native';+import { useTranslation } from 'react-i18next';+import { resolveRemoteText } from '@cindy/device-link';+import { Text } from '@/components/AppText';+import { MainWindowActionButton } from '@/components/MobilePrimitives';+import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';+import { radius, spacing, typeScale, fontWeight } from '@/theme/tokens';+import type { useSessionResourceCards } from './useSessionResourceCards';++/** Native presentation of bounded host resource primitives; action ids stay opaque. */+export function SessionResourceCards({+ state,+}: {+ state: ReturnType<typeof useSessionResourceCards>;+}) {+ const { t, i18n } = useTranslation();+ const { colors } = useTheme();+ const styles = useThemedStyles(makeStyles);+ const { height } = useWindowDimensions();+ const cards = state.resources.filter(+ (resource) => resource.blocks?.length || resource.actions?.length,+ );+ if (!cards.length && !state.failed && !state.blocked) return null;+ return (+ <ScrollView+ style={{ maxHeight: height * 0.4 }}+ contentContainerStyle={styles.stack}+ keyboardShouldPersistTaps="handled"+ >+ {!cards.length && state.blocked && !state.failed ? (+ <View style={[styles.card, styles.heading]}>+ <ActivityIndicator color={colors.textSecondary} />+ <Text style={styles.body}>{t('shared.syncing')}</Text>+ </View>+ ) : null}+ {cards.map((resource) => {+ const title = resolveRemoteText(resource.display.title, i18n.language);+ const body =+ resource.blocks+ ?.map((block) => block.fallbackMarkdown)+ .join('\n\n') ??+ resolveRemoteText(resource.display.subtitle ?? '', i18n.language);+ const busy = resource.blocks?.some(+ (block) =>+ block.primitive === 'session-controls' &&+ (block.data as { busy?: boolean })?.busy,+ );+ return (+ <View+ key={`${resource.ref.collectionId}:${resource.ref.kind}:${resource.ref.id}`}+ style={styles.card}+ testID="session.resourceCard"+ >+ <View style={styles.heading}>+ {(busy && state.fresh) || (!state.fresh && !state.failed) ? (+ <ActivityIndicator color={colors.textSecondary} />+ ) : null}+ <Text style={styles.title}>{title}</Text>+ </View>+ {!state.fresh && !state.failed ? (+ <Text style={styles.body}>{t('shared.syncing')}</Text>+ ) : null}+ {body ? (+ <Text style={styles.body}>+ {body.startsWith(title + '\n\n')+ ? body.slice(title.length + 2)+ : body === title+ ? ''+ : body}+ </Text>+ ) : null}+ <View style={styles.actions}>+ {resource.actions?.map((action) => (+ <MainWindowActionButton+ key={action.id}+ action={{+ label: resolveRemoteText(action.label, i18n.language),+ disabled:+ !state.fresh || !!state.pending || action.disabled,+ busy: state.pending === action.id,+ onPress: () => void state.act(resource, action.id),+ }}+ />+ ))}+ </View>+ </View>+ );+ })}+ {state.failed ? (+ <View style={styles.card}>+ <Text style={styles.body}>{t('session.screen.operationFailed')}</Text>+ <MainWindowActionButton+ action={{+ label: t('devices.resources.retry'),+ onPress: state.refresh,+ }}+ />+ </View>+ ) : null}+ </ScrollView>+ );+}+const makeStyles = (colors: ThemeColors) =>+ StyleSheet.create({+ stack: { gap: spacing.sm, paddingHorizontal: spacing.md },+ card: {+ borderWidth: 1,+ borderColor: colors.border,+ borderRadius: radius.container,+ backgroundColor: colors.surfaceElevated,+ padding: spacing.md,+ gap: spacing.sm,+ },+ heading: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm },+ title: {+ flex: 1,+ color: colors.textPrimary,+ fontSize: typeScale.body,+ fontWeight: fontWeight.medium,+ },+ body: { color: colors.textSecondary, fontSize: typeScale.footnote },+ actions: { flexDirection: 'row', flexWrap: 'wrap', gap: spacing.sm },+ });diff --git a/apps/mobile/src/session/useSessionResourceCards.ts b/apps/mobile/src/session/useSessionResourceCards.tsnew file mode 100644index 0000000000..7bd8b5361e--- /dev/null+++ b/apps/mobile/src/session/useSessionResourceCards.ts@@ -0,0 +1,288 @@+import { useCallback, useRef, useState } from 'react';+import { AppState } from 'react-native';+import { useFocusEffect } from 'expo-router';+import { useTranslation } from 'react-i18next';+import {+ resolveRemoteText,+ type RemoteCollectionDescriptor,+ type RemoteResource,+} from '@cindy/device-link';+import { useAuth } from '@/auth/AuthContext';+import { useDeviceLink } from '@/device-link/DeviceLinkContext';+import {+ loadRemoteResourceManifest,+ getRemoteResource,+ invokeRemoteResourceAction,+} from '@/device-link/remoteResources';+import { startFocusedTopicSubscription } from '@/device-link/focusedTopicSubscription';++export function sessionResourceInputBlocked(+ resources: readonly RemoteResource[],+): boolean {+ return resources.some((resource) =>+ resource.blocks?.some(+ (block) =>+ block.primitive === 'session-controls' &&+ (block.data as { input?: unknown } | undefined)?.input !== 'available',+ ),+ );+}++interface Snapshot {+ binding: string;+ scope: string;+ resources: RemoteResource[];+ failed: boolean;+ known: boolean;+ stale?: boolean;+}++/** The host owns the workflow. Refresh reads facts; reconnect never replays actions. */+export function useSessionResourceCards(+ deviceId: string,+ deviceName: string,+ sessionId: string,+ source: string | undefined,+ running: boolean,+) {+ const {+ invoke,+ status,+ connectionEpoch,+ subscribe,+ unsubscribe,+ onRemoteResourceChanged,+ } = useDeviceLink();+ const { accountGeneration } = useAuth();+ const { i18n } = useTranslation();+ const binding = JSON.stringify([+ accountGeneration,+ deviceId,+ sessionId,+ source,+ i18n.language,+ ]);+ const scope = JSON.stringify([binding, connectionEpoch, status, running]);+ const current = useRef(scope);+ current.current = scope;+ const refresh = useRef<() => void>(() => undefined);+ const [state, setState] = useState<Snapshot>();+ const [pending, setPending] = useState<{ binding: string; id: string }>();+ const [actionError, setActionError] = useState<string>();+ const request = useRef<{ binding: string } | null>(null);+ useFocusEffect(+ useCallback(() => {+ if (!deviceId || !sessionId || !source || status !== 'online') return;+ let disposed = false;+ let reading = false;+ let dirty = false;+ let generation = 0;+ let collections: RemoteCollectionDescriptor[] | undefined;+ let timer: ReturnType<typeof setTimeout> | undefined;+ const valid = () =>+ !disposed &&+ current.current === scope &&+ AppState.currentState === 'active';+ const load = async () => {+ if (!valid() || reading) return;+ reading = true;+ dirty = false;+ const expected = generation;+ try {+ collections ??=+ (+ await loadRemoteResourceManifest(+ invoke,+ { deviceId, deviceName },+ i18n.language,+ )+ )?.collections+ .filter((item) => item.placement === 'session:' + source)+ .slice(0, 4) ?? [];+ if (!valid()) return;+ // Wait for every member before releasing the in-flight slot, even on failure.+ const results = await Promise.allSettled(+ collections.map((item) =>+ getRemoteResource(+ invoke,+ { deviceId, deviceName },+ {+ collectionId: item.id,+ kind: item.resourceKind,+ id: sessionId,+ },+ i18n.language,+ ),+ ),+ );+ if (results.some((result) => result.status === 'rejected'))+ throw new Error('resource read failed');+ const resources = results.flatMap((result) =>+ result.status === 'fulfilled' ? [result.value] : [],+ );+ if (valid() && expected === generation)+ setState({+ binding,+ scope,+ resources,+ failed: false,+ known: collections.length > 0,+ });+ } catch {+ if (valid() && expected === generation)+ setState((previous) => ({+ binding,+ scope,+ resources:+ previous?.binding === binding ? previous.resources : [],+ failed: true,+ known:+ !!collections?.length ||+ (previous?.binding === binding && previous.known),+ }));+ } finally {+ reading = false;+ if (valid() && dirty) schedule(false);+ }+ };+ const schedule = (invalidate = true, blockInput = false) => {+ if (!valid()) return;+ if (invalidate) {+ generation += 1;+ setState((previous) =>+ previous?.binding === binding+ ? { ...previous, stale: true, scope: blockInput ? '' : previous.scope }+ : previous,+ );+ }+ if (reading) {+ if (invalidate) dirty = true;+ return;+ }+ if (timer) clearTimeout(timer);+ timer = setTimeout(() => {+ timer = undefined;+ void load();+ }, 150);+ };+ refresh.current = () => schedule(true, true);+ void load();+ const stop = startFocusedTopicSubscription({+ deviceId,+ owner: 'session-resources:' + sessionId,+ topic: 'sessions',+ subscribe,+ unsubscribe,+ });+ const off = onRemoteResourceChanged((changedDevice, payload) => {+ if (+ changedDevice === deviceId &&+ collections?.some((item) => item.id === payload.collectionId) &&+ (!payload.resourceRefs?.length ||+ payload.resourceRefs.some(+ (ref) =>+ ref.id === sessionId &&+ collections?.some((item) => item.resourceKind === ref.kind),+ ))+ )+ schedule();+ });+ const app = AppState.addEventListener('change', (next) => {+ generation += 1;+ if (next === 'active') schedule(true, true);+ else+ setState((previous) =>+ previous?.binding === binding+ ? { ...previous, scope: '' }+ : previous,+ );+ });+ // Poll only discovered cards in the foreground; a slow read is never superseded by a timer.+ const poll = setInterval(() => {+ if (collections?.length) schedule(false);+ }, 5000);+ return () => {+ disposed = true;+ generation += 1;+ refresh.current = () => undefined;+ if (timer) clearTimeout(timer);+ clearInterval(poll);+ app.remove();+ off();+ stop();+ };+ }, [+ binding,+ scope,+ deviceId,+ deviceName,+ sessionId,+ source,+ status,+ invoke,+ subscribe,+ unsubscribe,+ onRemoteResourceChanged,+ i18n.language,+ ]),+ );++ const visible = state?.binding === binding ? state : undefined;+ const fresh =+ visible?.scope === scope && status === 'online' && !visible.failed && !visible.stale;+ const pendingId = pending?.binding === binding ? pending.id : null;+ const act = async (resource: RemoteResource, actionId: string) => {+ if (+ !fresh ||+ current.current !== scope ||+ request.current?.binding === binding ||+ !resource.actions?.some(+ (action) => action.id === actionId && !action.disabled,+ )+ )+ return;+ const token = { binding };+ request.current = token;+ setPending({ binding, id: actionId });+ setActionError(undefined);+ try {+ await invokeRemoteResourceAction(+ invoke,+ { deviceId, deviceName },+ {+ collectionId: resource.ref.collectionId,+ resourceRef: resource.ref,+ actionId,+ },+ i18n.language,+ );+ } catch {+ if (current.current === scope) setActionError(binding);+ } finally {+ if (request.current === token) {+ request.current = null;+ setPending(undefined);+ }+ if (current.current === scope) refresh.current();+ }+ };+ return {+ resources: visible?.resources ?? [],+ failed: visible?.failed === true || actionError === binding,+ fresh: !!fresh,+ pending: pendingId,+ act,+ refresh: () => {+ setActionError(undefined);+ refresh.current();+ },+ blocked:+ sessionResourceInputBlocked(visible?.resources ?? []) ||+ !!pendingId ||+ (visible?.known === true &&+ (visible.scope !== scope || status !== 'online' || visible.failed)),+ blockedReason: visible?.resources[0]+ ? resolveRemoteText(visible.resources[0].display.title, i18n.language)+ : undefined,+ };+}diff --git a/docs/cindy-make-upstream.md b/docs/cindy-make-upstream.mdindex c2662adad2..b4938ae86a 100644--- a/docs/cindy-make-upstream.md+++ b/docs/cindy-make-upstream.md@@ -143,8 +143,10 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)“继续修改”不作为生成期间的取消入口。继续修改会停止本次测试进程,退出宿主会取消构建;文件合入已经开始时完成合入记录并保留源码,成品登记完成时保留成功产物及回执。运行与清理完成前保持工作目录占用,避免误删。应用重启不自动重放启动或构建,- 旧在途状态按已中断呈现,可显式重试。入口仅本机 Desktop 提供;远端 Desktop 保留完成记录与输入框,手机可读取- 已有消息投影,不新增远程 invoke 白名单,也不改变 SSH 或 device-link 恢复策略。+ 旧在途状态按已中断呈现,可显式重试。手机在已有 Cindy Make 任务中显示同一份准备、测试与生成状态,+ 包括测试启动步骤、失败重试、继续修改及缺少完成登记时的“检查并继续”。操作由被控电脑执行;+ 手机通过 Remote Resource 通道读取状态、调用已登记操作,不新增业务 invoke 白名单。+ 个人版创建入口、成品启用/切换仍在本机 Desktop;远端 Desktop 保留完成记录与输入框。设置页制作历史在生成期间收敛为一个状态卡,显示合并、检查(依赖/测试/类型)、打包和保存步骤,提供“停止制作”。停止只中止本次构建进程,并清理临时合并目录、未完成安装包、打包输出和构建元数据;不回退个人源码、已合入提交、历史记录或已生成版本。历史记录没有安全动作时,Main 返回不可用原因,@@ -239,10 +241,14 @@ rebase 到新官方基线(禁止 update-refs 自动改动其他任务分支)实现见 [taskManagement](../apps/desktop/src/main/cindy-make/taskManagement.ts),[真实 Git 回归](../apps/desktop/src/main/cindy-make/__tests__/taskCleanup.git-integration.test.ts)覆盖普通归档保留、显式丢弃未采纳改动、忽略目录与分支回收。-- 此流程仍是本地 Desktop Cindy Make:拒绝 SSH 任务作为来源,不新增 device-link invoke- 白名单。手机可通过已有任务/消息同步读取保存的阶段文本,但没有新增原生准备控制卡,- 实时多端准备操作需单独适配。远端 Desktop 的准备卡只读,不能误调用查看端的停止/重试。- 本次不改 device-link 重试、超时或连接恢复策略。+- 制作仍由本地 Desktop 执行,拒绝 SSH 任务作为来源。手机的已有任务卡使用通用+ Remote Resource 的任务内 placement 和 session-controls 原语,支持查看准备进度、停止与重试,+ 不改变原生配置或 runtime fingerprint。测试/构建占用工作目录时,主机发送入口也拦截修改,+ 手机未收到最新进度时同样生效。远端 Desktop 的准备卡保持只读。+- 主机推送资源失效后,手机合并通知并重新读取;前台恢复和重连读取当前主机状态,+ 账号、电脑或任务切换后丢弃旧响应。读取失败可重试,操作超时不自动重放写操作;+ 前台卡片另有低频读取补偿。故障处理限于本任务的资源请求,不重置设备或共享连接,+ 多设备用例验证一个资源读取失败不影响另一设备,不改变 device-link 的传输恢复策略。## 获取官方更新与解决冲突diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex 9da915fe80..53b099d71b 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -55,7 +55,7 @@| `mobile.auth` | mobile | 登录与添加账号 | app/(auth)/login.tsx / app/add-account.tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, IncomingShareBridge, LoginCaptchaWebView, LoginSkinControls, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, StartupSplashOverlay, 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/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/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/gestureHandler.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/IncomingShareBridge.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 | 177 | 76 || `mobile.automations` | mobile | 自动化 | app/automations/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, 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/chrome/HomeNativeStackHeader.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/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/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 | 170 | 71 || `mobile.chat.new` | mobile | 新建任务 | app/sessions/new.tsx | 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, HomeEntryProvider, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, MobileAgentMark, MobileAgentSwitcher, MobileChoicePickerList, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, NewTaskSelectionSheet, NewTaskSelectionSheet.ios, PaperPlaneIcon, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, 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/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/chrome/HomeNativeStackHeader.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/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/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/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/NewTaskSelectionSheet.ios.tsx, apps/mobile/src/session/NewTaskSelectionSheet.tsx, apps/mobile/src/session/PlanModeChip.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 | 202 | 110 |-| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionMessageCard, 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, HomeEntryProvider, HomeGlassMenuPanel, HomeNativeStackHeader, HomeSearchBar, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RewindPreviewPanel, SentInlineAtomBody, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale | 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/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.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/chrome/HomeNativeStackHeader.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/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/AuthorizationMessageCard.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionMessageCard.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/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeSearchBar.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/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/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/RewindPreviewPanel.tsx, apps/mobile/src/session/SentInlineAtomBody.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/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/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 203 | 232 |+| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionMessageCard, 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, HomeEntryProvider, HomeGlassMenuPanel, HomeNativeStackHeader, HomeSearchBar, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RewindPreviewPanel, SentInlineAtomBody, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale | 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/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.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/chrome/HomeNativeStackHeader.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/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/AuthorizationMessageCard.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionMessageCard.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/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeSearchBar.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/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/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/RewindPreviewPanel.tsx, apps/mobile/src/session/SentInlineAtomBody.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/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/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 203 | 233 || `mobile.companions.direct` | mobile | 伙伴私聊回看 | app/companions/direct/[threadId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [threadId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/direct/[threadId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.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/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/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 | 170 | 50 || `mobile.device-management` | mobile | 设备管理 | app/devices/manage.tsx / app/devices/manage/[deviceId].tsx | AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceInformationFields, DeviceInformationFields.ios, DeviceLinkContext, DeviceManagementDialogs, DeviceManagementList, DeviceManagementList.ios, HomeEntryProvider, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, 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, 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/chrome/HomeNativeStackHeader.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/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/RenameDeviceModal.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 | 170 | 53 || `mobile.devices` | mobile | 主机详情 | app/devices/[deviceId].tsx | AccountSwitcherSheet, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeNativeStackHeader, HomeProjectMachineLabel, HomeSearchBar, IncomingShareBridge, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobilePrimitives, MobileVendorIcon, NativePullDownMenu, NativeRemoteDesktopView, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, 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, SessionActionSheet, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, ThemeProvider, [deviceId], _layout, gestureHandler, index, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/[deviceId].tsx, apps/mobile/app/devices/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/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/chrome/HomeNativeStackHeader.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/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/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.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/SessionActionSheet.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/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 170 | 96 |diff --git a/docs/dev-rules/remote-and-mobile-adaptation.md b/docs/dev-rules/remote-and-mobile-adaptation.mdindex afe96f7938..a23c880ff0 100644--- a/docs/dev-rules/remote-and-mobile-adaptation.md+++ b/docs/dev-rules/remote-and-mobile-adaptation.md@@ -114,6 +114,12 @@ enum 编译分支,也不接受任意 HTML、React 或无限 UI DSL。结构化 Session 内容必须携带可读 `fallbackMarkdown`,旧客户端至少能阅读并继续任务。只有新增移动端此前无法表达的内容或交互原语时,才要求客户端发版。+任务内状态卡使用 collection placement `session:<source>`,资源 id 为任务 id。+Mobile 根据 manifest 发现卡片,不写死具体业务状态;`session-controls` 原语仅声明+输入是否可用与是否忙碌,详情保留可读 fallback,动作 id 为不透明标识。+动作的 disabled 是呈现提示,主机仍须按最新状态、账号与任务身份复核。重连只重读,+不得重放写操作;旧客户端不识别此 placement 时继续原有消息流程。+## 本机与远程共用查询策略本机独立使用、远程操作、两端同时使用应共享数据语义与通用查询策略;远程连接状态diff --git a/packages/device-link/src/remoteResources.ts b/packages/device-link/src/remoteResources.tsindex 2596768bdc..3b4ecf8f41 100644--- a/packages/device-link/src/remoteResources.ts+++ b/packages/device-link/src/remoteResources.ts@@ -109,6 +109,8 @@ export interface RemoteActionField {export interface RemoteActionDescriptor {id: string;label: RemoteText;+ /** Presentation only: the host still checks current state at invocation. */+ disabled?: boolean;tone?: 'neutral' | 'primary' | 'destructive' | string;confirmation?: {title: RemoteText;@@ -124,6 +126,10 @@ export interface RemoteResourceBlock {primitive: string;title?: RemoteText;fallbackMarkdown: string;+ /** 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.+ */data?: unknown;}@@ -144,6 +150,7 @@ export interface RemoteCollectionDescriptor {id: string;resourceKind: string;title: RemoteText;+ /** session:<source> places a resource keyed by Session id beside its composer. */placement?: string;icon?: {name: string;diff --git a/scripts/__tests__/restart-desktop-remote.test.mjs b/scripts/__tests__/restart-desktop-remote.test.mjsindex 20a46052e8..5c60c58431 100644--- a/scripts/__tests__/restart-desktop-remote.test.mjs+++ b/scripts/__tests__/restart-desktop-remote.test.mjs@@ -601,6 +601,23 @@ test("desktop restart runner keeps the kill-before-deps order by default", () =>]);});+test("desktop restart reports each real step before running it and stops progress on failure", () => {+ const events = [];+ const run = (step) => {+ events.push('run:' + step.progress);+ if (step.progress === 'assets') throw new Error('missing runtime');+ };+ assert.throws(() => runDesktopRestart(+ ['--isolated=progress-test'], '/repo/cindy', run,+ (step) => events.push('step:' + step),+ ), /missing runtime/);+ assert.deepEqual(events, [+ 'step:stopping', 'run:stopping',+ 'step:dependencies', 'run:dependencies',+ 'step:assets', 'run:assets',+ ]);+});+test("desktop restart process-control phase does not initialize startup configuration", () => {const processControlEnv = {};assert.equal(diff --git a/scripts/desktop-restart-runner.mjs b/scripts/desktop-restart-runner.mjsindex 313d93ec15..0f19d6f591 100644--- a/scripts/desktop-restart-runner.mjs+++ b/scripts/desktop-restart-runner.mjs@@ -35,6 +35,7 @@ export function buildDesktopRestartSteps(argv, root = rootDir) {return [...(preserveRunning ? [] : [{label: 'stop existing desktop dev processes',+ progress: 'stopping',command: process.execPath,// 用户参数(尤其 --isolated)必须跟进 kill 阶段:userData 冲突门要在// 杀任何进程之前就按目标沙箱判定,不能等到最终启动阶段才发现冲突。@@ -42,16 +43,19 @@ export function buildDesktopRestartSteps(argv, root = rootDir) {}]),{label: 'verify desktop dependencies',+ progress: 'dependencies',command: process.execPath,args: [path.join(root, 'scripts', 'ensure-deps.mjs')],},{label: 'verify desktop runtime assets',+ progress: 'assets',command: process.execPath,args: [path.join(root, 'scripts', 'ensure-dev-runtime-assets.mjs')],},{label: 'start desktop and wait for readiness',+ progress: 'launching',command: process.execPath,args: [restartScript, ...modeArgs, ...forwarded, '--wait-ready'],},@@ -93,12 +97,20 @@ function runStep(step) {assertDesktopRestartStepSucceeded(step, result);}-export function runDesktopRestart(argv, root = rootDir, stepRunner = runStep) {+export function runDesktopRestart(+ argv,+ root = rootDir,+ stepRunner = runStep,+ reportStep = (step) => process.stdout.write('DESKTOP_DEV_STEP=' + step + '\n'),+) {const normalizedArgv = normalizeDesktopRestartArgv(argv);const conflict = desktopRestartArgvConflictMessage(normalizedArgv);if (conflict) throw new Error(conflict);assertSharedDevMigrationPolicy(root, normalizedArgv);- for (const step of buildDesktopRestartSteps(normalizedArgv, root)) stepRunner(step);+ for (const step of buildDesktopRestartSteps(normalizedArgv, root)) {+ reportStep(step.progress);+ stepRunner(step);+ }}function main() {