Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(cindy-make): close mobile home and file entry gaps
MagicLizi987c1afa3135
diff --git a/apps/mobile/app/files/[sessionId].tsx b/apps/mobile/app/files/[sessionId].tsxindex d7b82ac7fd..a1db16e51b 100644--- a/apps/mobile/app/files/[sessionId].tsx+++ b/apps/mobile/app/files/[sessionId].tsx@@ -125,9 +125,9 @@ const NOTICE_DISMISS_MS = 2500;const SEARCH_FILES_CAP = 20000;export default function RemoteFileBrowserScreen() {- const { sessionId } = useLocalSearchParams<{ sessionId: string }>();+ const { sessionId, deviceId } = useLocalSearchParams<{ sessionId: string; deviceId?: string }>();return (- <CindyMakeSessionGate sessionId={String(sessionId ?? '')}>+ <CindyMakeSessionGate sessionId={String(sessionId ?? '')} deviceId={readRouteString(deviceId) ?? undefined}><RemoteFileBrowserContent /></CindyMakeSessionGate>);diff --git a/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts b/apps/mobile/src/__tests__/filePreviewPagerWiring.test.tsindex 404be45c92..9532a381bd 100644--- a/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts+++ b/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts@@ -22,6 +22,12 @@ function readSource(rel: string): string {const source = readSource('app/files/preview/[sessionId].tsx');describe('remote file preview pager wiring', () => {+ it.each(['app/files/[sessionId].tsx', 'app/files/preview/[sessionId].tsx'])('passes the route device ID into the source gate for %s', (path) => {+ const routeSource = readSource(path).split('export default function ')[1]?.split('\n}\n')[0] ?? '';+ expect(routeSource).toContain('const { sessionId, deviceId } = useLocalSearchParams<');+ expect(routeSource).toContain('deviceId={readRouteString(deviceId) ?? undefined}');+ });+it('exposes source readiness only on the visible loaded text page', () => {const textPage = source.slice(source.indexOf('function TextPreviewPage('), source.indexOf('function ImagePreviewPage('));const sourceList = textPage.match(/<FlatList\s[\s\S]*?data=\{state.lines\}[\s\S]*?testID=\{visible \? 'filePreview.sourceReady' : undefined\}/);diff --git a/apps/mobile/src/__tests__/remoteSessionStore.test.ts b/apps/mobile/src/__tests__/remoteSessionStore.test.tsindex 245848c5c4..266557a649 100644--- a/apps/mobile/src/__tests__/remoteSessionStore.test.ts+++ b/apps/mobile/src/__tests__/remoteSessionStore.test.ts@@ -146,14 +146,36 @@ describe('remoteSessionStore', () => {expect(remoteSessionStore.getSessionDeviceId('make')).toBe('dev-1');const visible = remoteSessionStore.getVisibleSessions();expect(visible.map(item => item.id)).toEqual(['ordinary']);+ const home = remoteSessionStore.getHomeSessions();+ expect(home.map(item => item.id)).toEqual(['ordinary']);remoteSessionStore.applySessionPatch('dev-1', 'make', { totalCostUsd: 1 });expect(remoteSessionStore.getVisibleSessions()).toBe(visible);+ expect(remoteSessionStore.getHomeSessions()).toBe(home);remoteSessionStore.applySessionPatch('dev-1', 'ordinary', { totalCostUsd: 2 });expect(remoteSessionStore.getVisibleSessions()[0].totalCostUsd).toBe(2);+ expect(remoteSessionStore.getHomeSessions()).toBe(home);remoteSessionStore.applySessionPatch('dev-1', 'ordinary', { source: 'cindy-make-merge' });expect(remoteSessionStore.getVisibleSessions()).toEqual([]);+ expect(remoteSessionStore.getHomeSessions()).toEqual([]);remoteSessionStore.clear();expect(remoteSessionStore.getVisibleSessions()).toEqual([]);+ expect(remoteSessionStore.getHomeSessions()).toEqual([]);+ });++ it.each(['cindy-make', 'cindy-make-merge'])('removes %s from Home when source metadata arrives late', (source) => {+ remoteSessionStore.setDeviceSessions('dev-1', 'Mac', [+ session('unknown'),+ session('ordinary', { source: 'desktop' }),+ ]);+ const ordinary = remoteSessionStore.getHomeSessions()[1];+ remoteSessionStore.applySessionActivity('dev-1', { sessionId: 'unknown', phase: 'error', attention: true });+ remoteSessionStore.applySessionPatch('dev-1', 'unknown', { source });+ expect(remoteSessionStore.getHomeSessions()).toEqual([ordinary]);+ expect(remoteSessionStore.getHomeSessions()[0]).toBe(ordinary);+ expect(remoteSessionStore.getSessions()).toHaveLength(2);+ expect(remoteSessionStore.getSessionLiveActivity('unknown')).toMatchObject({ phase: 'error', attention: true });+ remoteSessionStore.applySessionActivity('dev-1', { sessionId: 'unknown', phase: 'completed', attention: true });+ expect(remoteSessionStore.getHomeSessions()).toEqual([ordinary]);});it('releases a large persisted tool input when the matching result is appended', () => {diff --git a/apps/mobile/src/session/remoteSessionStore.ts b/apps/mobile/src/session/remoteSessionStore.tsindex d76208665a..4a3ef8f27e 100644--- a/apps/mobile/src/session/remoteSessionStore.ts+++ b/apps/mobile/src/session/remoteSessionStore.ts@@ -1364,7 +1364,7 @@ const homeSessionProjectionCache = new Map<string, {function reconcileHomeSessions(): void {const activeSessionIds = new Set<string>();- const next = mergedSessions.map((session) => {+ const next = visibleSessions.map((session) => {activeSessionIds.add(session.id);const cached = homeSessionProjectionCache.get(session.id);if (cached?.source === session) return cached.projected;