From f21236d64c8d51626bf18b7bf58a3f0c865a1617 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 10 Nov 2026 02:20:11 -0800 Subject: [PATCH] refactor(mobile): group host catalog credentials descriptors and connection history --- ...obile-localization-coverage-allowlist.json | 6 +- mobile/app/_layout.tsx | 2 +- mobile/app/connection-log.tsx | 4 +- mobile/app/h/[hostId]/edit.tsx | 8 +- mobile/app/terminal-settings.tsx | 4 +- mobile/app/voice-settings.tsx | 4 +- mobile/src/accounts/MobileAccountsScreen.tsx | 2 +- mobile/src/agents/MobileAgentListRows.tsx | 4 +- .../src/agents/use-agent-list-row-actions.tsx | 2 +- .../automations/MobileAutomationsScreen.tsx | 4 +- .../src/components/NewWorktreeModal.test.tsx | 70 +------ mobile/src/components/NewWorktreeModal.tsx | 2 +- .../use-connected-host-picker.test.ts | 2 +- .../components/use-connected-host-picker.ts | 2 +- mobile/src/device-store/device-store.ts | 4 +- .../connection-diagnostics-report.ts | 2 +- ...connection-diagnostics-screen-data.test.ts | 2 +- .../connection-diagnostics-screen-data.ts | 2 +- .../mobile-web-bundle-probe-row.tsx | 4 +- .../mobile-web-shell-update-failure-row.tsx | 2 +- .../native-diagnostics-operations.test.ts | 2 +- .../native-diagnostics-operations.ts | 2 +- .../use-troubleshoot-diagnostics.ts | 2 +- .../dictation/use-mobile-dictation-live.ts | 4 +- mobile/src/home/MobileHomeActiveAgents.tsx | 2 +- mobile/src/home/MobileHomeDesktopRow.tsx | 4 +- mobile/src/home/MobileHomeHostList.tsx | 2 +- mobile/src/home/MobileHomeScreen.tsx | 6 +- mobile/src/home/MobileHomeTasksSection.tsx | 2 +- .../src/home/mobile-home-connection-state.ts | 2 +- .../tabs/MobileHomeAgentsDesktopFilter.tsx | 4 +- mobile/src/home/tabs/MobileHomeAgentsTab.tsx | 4 +- .../home/tabs/MobileHomeAutomationsTab.tsx | 4 +- mobile/src/home/tabs/MobileHomeFeedTab.tsx | 2 +- mobile/src/home/tabs/MobileHomeHostPill.tsx | 4 +- mobile/src/home/tabs/MobileHomeUsageTab.tsx | 4 +- mobile/src/home/use-mobile-home-data.ts | 6 +- .../home/use-mobile-home-host-connections.ts | 2 +- .../host-catalog-credential-join.ts | 2 +- .../host-catalog-selection.ts | 0 .../host-catalog/host-connection-history.ts | 17 ++ .../host-connection-history.web.ts | 2 + .../host-list-load-sharing.test.ts | 0 .../host-list-load-sharing.ts | 0 .../host-list-mutation-queue.ts | 0 .../host-metadata-store.ts | 0 .../host-name-identity.test.ts | 4 +- .../host-name-identity.ts | 2 +- .../hosts => host-catalog}/host-names.ts | 0 .../hosts => host-catalog}/host-profile.ts | 12 +- .../host-removal-lifecycle.ts | 10 +- .../host-removal-lifecycle.web.ts | 0 .../hosts => host-catalog}/host-store.test.ts | 171 +----------------- .../hosts => host-catalog}/host-store.ts | 35 ++-- .../hosts => host-catalog}/host-store.web.ts | 7 +- .../mobile-relay-host-overlay-store.test.ts | 18 -- .../mobile-relay-host-overlay-store.ts | 2 +- .../mobile-relay-host-overlay.ts | 4 +- .../page-host-removal-refusal.ts | 0 .../use-host-profile.ts | 0 .../host-credential-cleanup.ts | 0 .../host-credential-write-revision.ts | 0 .../host-device-token-store.ts | 0 .../host-device-token-store.web.ts | 0 .../mobile-relay-credential-bundle.test.ts | 2 +- .../mobile-relay-credential-bundle.ts | 4 +- .../pairing-keychain.ts | 0 .../host-app-version-store.ts | 0 .../host-app-version-store.web.ts | 0 .../host-app-version.ts | 0 .../host-descriptor-persistence.ts | 7 +- .../host-descriptor-persistence.web.ts | 4 +- .../host-descriptor-recorder.ts | 4 +- .../host-descriptor-store.ts | 2 +- .../use-host-display.ts | 6 +- mobile/src/host-list-action-sheet-actions.ts | 2 +- .../src/host-screen/host-stored-identity.ts | 2 +- .../host-screen/use-host-display-worktrees.ts | 2 +- .../host-screen/use-host-screen-controller.ts | 2 +- .../host-screen/use-host-screen-identity.ts | 5 +- .../src/host-screen/use-host-screen-state.ts | 2 +- .../host-screen/use-host-worktree-actions.ts | 4 +- .../ShellDownloadProgress.tsx | 2 +- .../src/mobile-web-shell/ShellStateScreen.tsx | 2 +- .../host-area-page-storage.test.tsx | 2 +- .../use-page-host-snapshot.test.tsx | 2 +- .../use-page-host-snapshot.ts | 2 +- .../new-workspace/NewWorkspaceHostPicker.tsx | 6 +- .../src/notifications/mobile-notifications.ts | 2 +- .../src/notifications/notification-routing.ts | 2 +- .../push-dismissal-reconciliation.ts | 2 +- mobile/src/notifications/push-receive.test.ts | 6 +- mobile/src/notifications/push-receive.ts | 2 +- .../notifications/push-socket-dismissal.ts | 2 +- .../use-remote-push-capable-hosts.ts | 2 +- .../mobile-relay-pairing-journal-store.ts | 2 +- .../mobile-relay-pairing-recovery.test.ts | 4 +- .../pairing/mobile-relay-pairing-recovery.ts | 4 +- mobile/src/pairing/pairing-relay-host.ts | 2 +- mobile/src/pairing/pairing.ts | 2 +- .../pre-profile-pairing-coordinator.ts | 6 +- .../unpaired-host-credential-deletion.ts | 6 +- .../session/MobileSessionActiveContent.tsx | 4 +- ...mobile-dictation-session-outcomes.test.tsx | 42 +---- .../session/use-mobile-session-lifecycle.ts | 2 +- .../settings/notification-display-test.tsx | 2 +- .../pending-credential-cleanup-card.tsx | 4 +- .../src/tasks/mobile-tasks-host-subtitle.tsx | 4 +- mobile/src/tasks/mobile-tasks-list-state.tsx | 4 +- mobile/src/tasks/use-task-host-repos.ts | 2 +- .../session/MobileTerminalRenameModal.tsx | 4 +- .../rpc-recording/relay-pairing-fixtures.ts | 2 +- .../connection/client-context.test.ts | 4 +- .../transport/connection/client-context.tsx | 2 +- .../connection/client-context.web.tsx | 2 +- .../connection/host-client-context-state.ts | 2 +- .../transport/connection/host-client-hooks.ts | 2 +- .../transport/connection/host-entry-opener.ts | 6 +- .../connection/host-logical-client.ts | 2 +- .../connection/host-status-gates.test.ts | 4 +- .../transport/connection/host-status-gates.ts | 6 +- .../connection/mobile-endpoint-lifecycle.ts | 6 +- .../mobile-endpoint-supervisor-contract.ts | 2 +- .../mobile-endpoint-supervisor-test-fakes.ts | 4 +- .../connection/mobile-endpoint-supervisor.ts | 2 +- .../connection/rpc-client-context-contract.ts | 2 +- .../transport/hosts/home-host-auto-connect.ts | 2 +- .../hosts/host-open-recovery.test.tsx | 2 +- .../transport/hosts/pairing-keychain.test.ts | 72 -------- .../relay/mobile-relay-credential-rotation.ts | 2 +- .../mobile-relay-credential-selection.ts | 2 +- ...le-relay-direct-upgrade-controller.test.ts | 2 +- .../mobile-relay-direct-upgrade-controller.ts | 2 +- .../mobile-relay-direct-upgrade-journal.ts | 4 +- .../relay/mobile-relay-direct-upgrade.ts | 6 +- .../relay/mobile-relay-orphan-cleanup.ts | 4 +- .../mobile-relay-recovery-presentation.ts | 2 +- .../relay/mobile-relay-session-establisher.ts | 2 +- mobile/web-entry/web-overrides.json | 14 +- 139 files changed, 233 insertions(+), 583 deletions(-) rename mobile/src/{transport/hosts => host-catalog}/host-catalog-credential-join.ts (92%) rename mobile/src/{transport/hosts => host-catalog}/host-catalog-selection.ts (100%) create mode 100644 mobile/src/host-catalog/host-connection-history.ts create mode 100644 mobile/src/host-catalog/host-connection-history.web.ts rename mobile/src/{transport/hosts => host-catalog}/host-list-load-sharing.test.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/host-list-load-sharing.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/host-list-mutation-queue.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/host-metadata-store.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/host-name-identity.test.ts (96%) rename mobile/src/{transport/hosts => host-catalog}/host-name-identity.ts (97%) rename mobile/src/{transport/hosts => host-catalog}/host-names.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/host-profile.ts (82%) rename mobile/src/{transport/hosts => host-catalog}/host-removal-lifecycle.ts (76%) rename mobile/src/{transport/hosts => host-catalog}/host-removal-lifecycle.web.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/host-store.test.ts (55%) rename mobile/src/{transport/hosts => host-catalog}/host-store.ts (91%) rename mobile/src/{transport/hosts => host-catalog}/host-store.web.ts (77%) rename mobile/src/{transport/hosts => host-catalog}/mobile-relay-host-overlay-store.test.ts (78%) rename mobile/src/{transport/hosts => host-catalog}/mobile-relay-host-overlay-store.ts (96%) rename mobile/src/{transport/hosts => host-catalog}/mobile-relay-host-overlay.ts (92%) rename mobile/src/{transport/hosts => host-catalog}/page-host-removal-refusal.ts (100%) rename mobile/src/{transport/hosts => host-catalog}/use-host-profile.ts (100%) rename mobile/src/{transport/hosts => host-credentials}/host-credential-cleanup.ts (100%) rename mobile/src/{transport/hosts => host-credentials}/host-credential-write-revision.ts (100%) rename mobile/src/{transport/hosts => host-credentials}/host-device-token-store.ts (100%) rename mobile/src/{transport/hosts => host-credentials}/host-device-token-store.web.ts (100%) rename mobile/src/{transport/hosts => host-credentials}/mobile-relay-credential-bundle.test.ts (96%) rename mobile/src/{transport/hosts => host-credentials}/mobile-relay-credential-bundle.ts (93%) rename mobile/src/{transport/hosts => host-credentials}/pairing-keychain.ts (100%) rename mobile/src/{transport/hosts => host-descriptors}/host-app-version-store.ts (100%) rename mobile/src/{transport/hosts => host-descriptors}/host-app-version-store.web.ts (100%) rename mobile/src/{transport/hosts => host-descriptors}/host-app-version.ts (100%) rename mobile/src/{transport/hosts => host-descriptors}/host-descriptor-persistence.ts (82%) rename mobile/src/{transport/hosts => host-descriptors}/host-descriptor-persistence.web.ts (59%) rename mobile/src/{transport/hosts => host-descriptors}/host-descriptor-recorder.ts (83%) rename mobile/src/{transport/hosts => host-descriptors}/host-descriptor-store.ts (95%) rename mobile/src/{transport/hosts => host-descriptors}/use-host-display.ts (85%) delete mode 100644 mobile/src/transport/hosts/pairing-keychain.test.ts diff --git a/config/mobile-localization-coverage-allowlist.json b/config/mobile-localization-coverage-allowlist.json index 265dd13cf28..113c65c34da 100644 --- a/config/mobile-localization-coverage-allowlist.json +++ b/config/mobile-localization-coverage-allowlist.json @@ -560,21 +560,21 @@ "count": 1 }, { - "filePath": "mobile/src/transport/hosts/mobile-relay-host-overlay.ts", + "filePath": "mobile/src/host-catalog/mobile-relay-host-overlay.ts", "kind": "object-property:message", "text": "Expected exactly one endpoint for configured relay metadata", "dynamic": false, "count": 1 }, { - "filePath": "mobile/src/transport/hosts/mobile-relay-host-overlay.ts", + "filePath": "mobile/src/host-catalog/mobile-relay-host-overlay.ts", "kind": "object-property:message", "text": "Relay host identity mismatch", "dynamic": false, "count": 1 }, { - "filePath": "mobile/src/transport/hosts/mobile-relay-host-overlay.ts", + "filePath": "mobile/src/host-catalog/mobile-relay-host-overlay.ts", "kind": "object-property:message", "text": "Relay identity and endpoint must coexist", "dynamic": false, diff --git a/mobile/app/_layout.tsx b/mobile/app/_layout.tsx index ba532452c05..4ac8bba5cdb 100644 --- a/mobile/app/_layout.tsx +++ b/mobile/app/_layout.tsx @@ -27,7 +27,7 @@ import { } from '../src/notifications/push-receive' import { startPushTokenSync } from '../src/notifications/push-registration' import { ensureDesktopNotificationChannel } from '../src/notifications/desktop-notification-channel' -import { loadHostCatalog } from '../src/transport/hosts/host-store' +import { loadHostCatalog } from '../src/host-catalog/host-store' import { usePairingLinks } from '../src/navigation/use-pairing-links' import { consumeInitialLaunchIntent } from '../src/navigation/initial-launch-intent' import { recoverMobileRelayPairing } from '../src/pairing/mobile-relay-pairing-recovery' diff --git a/mobile/app/connection-log.tsx b/mobile/app/connection-log.tsx index 8fbcd0057fa..addd3b182b5 100644 --- a/mobile/app/connection-log.tsx +++ b/mobile/app/connection-log.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useMemo, useState, useSyncExternalStore } from import { View, Text, Pressable } from 'react-native' import { useLocalSearchParams, useRouter } from 'expo-router' import * as Clipboard from 'expo-clipboard' -import { loadHosts } from '../src/transport/hosts/host-store' +import { loadHosts } from '../src/host-catalog/host-store' import { connectionLogStore } from '../src/diagnostics/connection/persisted-connection-log-store' import { useRpcClientContext } from '../src/transport/connection/client-context' import { useHostClient } from '../src/transport/connection/host-client-hooks' @@ -22,7 +22,7 @@ import { connectionDiagnosticsScreenStyles as styles } from '../src/diagnostics/ import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme' import { NATIVE_APP_LOG_ID } from '../src/diagnostics/native-render-log' import type { ConnectionLogEntry } from '../src/diagnostics/connection/connection-log-types' -import type { HostProfile } from '../src/transport/hosts/host-profile' +import type { HostProfile } from '../src/host-catalog/host-profile' import { pressedStyle } from '../src/theme/mobile-theme' // Keep empty snapshot identity stable or useSyncExternalStore rerenders forever. diff --git a/mobile/app/h/[hostId]/edit.tsx b/mobile/app/h/[hostId]/edit.tsx index 38dc364e575..acd13c84186 100644 --- a/mobile/app/h/[hostId]/edit.tsx +++ b/mobile/app/h/[hostId]/edit.tsx @@ -18,7 +18,7 @@ import { NavBar } from '../../../src/components/nav-bar/NavBar' import { NavBarButton } from '../../../src/components/nav-bar/NavBarButton' import { themedStyleSheet } from '../../../src/theme/themed-styles' import { useMobileColorScheme } from '../../../src/theme/use-mobile-color-scheme' -import { loadHosts, updateHostNameAndEndpoint } from '../../../src/transport/hosts/host-store' +import { loadHosts, updateHostNameAndEndpoint } from '../../../src/host-catalog/host-store' import { displayHostEndpoint } from '../../../src/transport/hosts/host-endpoint' import { resolveHostEndpointEdit } from '../../../src/transport/hosts/host-endpoint-edit' import { @@ -26,12 +26,12 @@ import { usePrimeHosts, useRefreshHostClient } from '../../../src/transport/connection/host-client-hooks' -import { removeHostAndCloseClient } from '../../../src/transport/hosts/host-removal-lifecycle' -import { useHostDisplay } from '../../../src/transport/hosts/use-host-display' +import { removeHostAndCloseClient } from '../../../src/host-catalog/host-removal-lifecycle' +import { useHostDisplay } from '../../../src/host-descriptors/use-host-display' import { leaveHostRoute } from '../../../src/host-route-exit' import { ConfirmModal } from '../../../src/components/ConfirmModal' import { ListGroup, ListRow } from '../../../src/components/list/ListGroup' -import type { HostProfile } from '../../../src/transport/hosts/host-profile' +import type { HostProfile } from '../../../src/host-catalog/host-profile' import { hostOs } from '../../../src/platform/host-os' import { translate } from '../../../src/i18n/mobile-i18n' import { useMobileTranslation } from '../../../src/i18n/use-mobile-translation' diff --git a/mobile/app/terminal-settings.tsx b/mobile/app/terminal-settings.tsx index fbd32b1b284..ef85607d591 100644 --- a/mobile/app/terminal-settings.tsx +++ b/mobile/app/terminal-settings.tsx @@ -12,8 +12,8 @@ import { colors, spacing } from '../src/theme/mobile-theme' import { useMobileColorScheme } from '../src/theme/use-mobile-color-scheme' import type { Translate } from '../src/i18n/mobile-i18n' import { useMobileTranslation } from '../src/i18n/use-mobile-translation' -import { loadHosts, peekHosts } from '../src/transport/hosts/host-store' -import type { HostProfile } from '../src/transport/hosts/host-profile' +import { loadHosts, peekHosts } from '../src/host-catalog/host-store' +import type { HostProfile } from '../src/host-catalog/host-profile' import { useFocusedSettingsHostClients } from '../src/settings/settings-host-client-connections' import type { RpcClient } from '../src/transport/rpc/rpc-client-contract' import { LIST_LEADING_INSET, ListRow } from '../src/components/list/ListGroup' diff --git a/mobile/app/voice-settings.tsx b/mobile/app/voice-settings.tsx index ef3a48ea832..3bdb0a66df0 100644 --- a/mobile/app/voice-settings.tsx +++ b/mobile/app/voice-settings.tsx @@ -1,7 +1,7 @@ import { useEffect, useMemo, useState } from 'react' import { useRouter } from 'expo-router' -import { loadHosts, peekHosts } from '../src/transport/hosts/host-store' -import type { HostProfile } from '../src/transport/hosts/host-profile' +import { loadHosts, peekHosts } from '../src/host-catalog/host-store' +import type { HostProfile } from '../src/host-catalog/host-profile' import { useFocusedSettingsHostClients } from '../src/settings/settings-host-client-connections' import VoiceSettingsScreen from '../src/settings/voice-settings-screen' import { nativeVoiceSettingsOperations } from '../src/settings/native-voice-settings-operations' diff --git a/mobile/src/accounts/MobileAccountsScreen.tsx b/mobile/src/accounts/MobileAccountsScreen.tsx index 2ea1d8b0c18..a76da2ffa62 100644 --- a/mobile/src/accounts/MobileAccountsScreen.tsx +++ b/mobile/src/accounts/MobileAccountsScreen.tsx @@ -3,7 +3,7 @@ import { View, Text, ScrollView, ActivityIndicator } from 'react-native' import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context' import { useFocusEffect, useLocalSearchParams } from 'expo-router' import { ChevronLeft, RefreshCw, User } from 'lucide-react-native' -import { loadHosts, peekHosts } from '../transport/hosts/host-store' +import { loadHosts, peekHosts } from '../host-catalog/host-store' import { useForceReconnect, useHostClient } from '../transport/connection/host-client-hooks' import { useHostConnectionInputs } from '../transport/connection/client-context-connection-metrics' import { classifyConnection, isConnectionOutage } from '../transport/connection/connection-health' diff --git a/mobile/src/agents/MobileAgentListRows.tsx b/mobile/src/agents/MobileAgentListRows.tsx index 0f5f5b7908b..b564b7d4bdf 100644 --- a/mobile/src/agents/MobileAgentListRows.tsx +++ b/mobile/src/agents/MobileAgentListRows.tsx @@ -12,8 +12,8 @@ import { triggerMediumImpact } from '../platform/haptics' import { colors, spacing } from '../theme/mobile-theme' import { themedStyleSheet } from '../theme/themed-styles' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' -import type { HostProfile } from '../transport/hosts/host-profile' -import { useHostDisplay } from '../transport/hosts/use-host-display' +import type { HostProfile } from '../host-catalog/host-profile' +import { useHostDisplay } from '../host-descriptors/use-host-display' import { agentStateLabel, formatTimeAgo, type AgentDotState } from '../worktree/agent-row-display' import { isDisclosureOpen, toggleDisclosure } from '../worktree/agent-child-disclosure' import { areStructurallyEqual } from '../worktree/structural-equality' diff --git a/mobile/src/agents/use-agent-list-row-actions.tsx b/mobile/src/agents/use-agent-list-row-actions.tsx index dcd191a4b6c..f5b45eda889 100644 --- a/mobile/src/agents/use-agent-list-row-actions.tsx +++ b/mobile/src/agents/use-agent-list-row-actions.tsx @@ -6,7 +6,7 @@ import { TransientToast, useTransientToast } from '../components/TransientToast' import { useMobileTranslation } from '../i18n/use-mobile-translation' import { useClipboardWriter } from '../platform/clipboard' import { useOpenMobileSession } from '../session/use-open-mobile-session' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { AgentActivityChange, AgentListRow } from './agent-list-rows' import type { AgentListRowHandlers } from './MobileAgentListRows' import type { AgentActivityFailure } from './use-agent-activity-writes' diff --git a/mobile/src/automations/MobileAutomationsScreen.tsx b/mobile/src/automations/MobileAutomationsScreen.tsx index 9cb62a41d91..b9efea06339 100644 --- a/mobile/src/automations/MobileAutomationsScreen.tsx +++ b/mobile/src/automations/MobileAutomationsScreen.tsx @@ -9,8 +9,8 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context' import { firstParam } from '../navigation/route-param-reader' import { useRouteHandoff } from '../navigation/route-handoff' import { useHostClient } from '../transport/connection/host-client-hooks' -import { useHostDisplay } from '../transport/hosts/use-host-display' -import { useHostProfile } from '../transport/hosts/use-host-profile' +import { useHostDisplay } from '../host-descriptors/use-host-display' +import { useHostProfile } from '../host-catalog/use-host-profile' import { useHostProtocolGates } from '../components/host-protocol-gates-context' import { NavBar, NavBarTitleButton } from '../components/nav-bar/NavBar' import { NavBarButton } from '../components/nav-bar/NavBarButton' diff --git a/mobile/src/components/NewWorktreeModal.test.tsx b/mobile/src/components/NewWorktreeModal.test.tsx index 6da85abe6b3..439e4f2014e 100644 --- a/mobile/src/components/NewWorktreeModal.test.tsx +++ b/mobile/src/components/NewWorktreeModal.test.tsx @@ -62,9 +62,9 @@ vi.mock('../host-screen/host-list-queries', () => ({ (hostId && cachedRepos.get(hostId)) || null })) -import '../transport/hosts/host-descriptor-store' +import '../host-descriptors/host-descriptor-store' import { FakeSession } from '../transport/connection/mobile-endpoint-supervisor-test-fakes' -import { markRpcDeliveryUnknown } from '../transport/rpc/rpc-delivery-ambiguity' + import '../../../src/shared/execution-host' import type { ExecutionHostId } from '../../../src/shared/execution-host' @@ -231,72 +231,6 @@ describe('NewWorktreeModal project targets', () => { expect(runTargetPicker(renderer).props.selectedId).toBe('runtime:env-1') }) - async function submitFromFolder(createReply: () => Promise) { - const serverRepo = { ...repos[0]!, path: '/srv/orca' } - const server = requestsOnly( - vi.fn((method: string) => - method === 'repo.list' - ? replied({ repos: [serverRepo] }) - : method === 'worktree.create' - ? createReply() - : Promise.reject(new Error(`unexpected ${method}`)) - ) - ) - const settle = vi.fn() - - await act(async () => { - renderer = create( - createElement(NewWorktreeModal, { - visible: true, - client: requestsOnly(() => new Promise(() => {})), - serverClients: new Map([['runtime:env-1', server]]), - hostId: 'host-1', - onCreated: () => {}, - onClose: () => {}, - openExternalUrl: () => {}, - folderLaunch: { - repoId: 'repo-1', - executionHostId: 'runtime:env-1', - name: 'payments', - parentWorkspace: 'folder:f-1', - submit: { begin: () => ({ settle }), presenting: () => true } - } - }) - ) - }) - await flushUpdates() - const form = renderer.root.find((node) => typeof node.props.onCreate === 'function') - await act(async () => form.props.onCreate()) - await flushUpdates() - - const creates = vi - .mocked(server.sendRequest) - .mock.calls.filter(([method]) => method === 'worktree.create') - return { creates: creates.map(([, params]) => params), settle } - } - - it('creates from a folder attached to that folder, on its host', async () => { - const { creates, settle } = await submitFromFolder(() => - replied({ worktree: { id: 'repo-1::/srv/w/payments', displayName: 'payments' } }) - ) - expect(creates).toEqual([ - expect.objectContaining({ - repo: 'id:repo-1', - parentWorkspace: 'folder:f-1', - parentWorkspaceOrigin: 'manual' - }) - ]) - expect(settle).toHaveBeenCalledWith('created') - }) - - it("doesn't try another name when a folder create's reply is lost", async () => { - const { creates, settle } = await submitFromFolder(() => - Promise.reject(markRpcDeliveryUnknown(new Error('connection lost'))) - ) - expect(creates).toHaveLength(1) - expect(settle).toHaveBeenCalledWith('uncertain') - }) - it('ignores a stale repo list after the client changes', async () => { let resolveOldList: ((value: unknown) => void) | undefined const oldList = new Promise((resolve) => { diff --git a/mobile/src/components/NewWorktreeModal.tsx b/mobile/src/components/NewWorktreeModal.tsx index ccae8181be7..801655b778c 100644 --- a/mobile/src/components/NewWorktreeModal.tsx +++ b/mobile/src/components/NewWorktreeModal.tsx @@ -10,7 +10,7 @@ import { deriveRepoSlug, type PasteRepoCandidate } from '../tasks/smart-source-p import { useMobileComposerSource } from '../tasks/use-mobile-composer-source' import { useNewWorktreeRuntimeCapabilities } from '../tasks/worktree-create-capability' import { useWorktreeCreateBasePrefetch } from '../tasks/use-worktree-create-base-prefetch' -import { useHostDescriptor } from '../transport/hosts/host-descriptor-store' +import { useHostDescriptor } from '../host-descriptors/host-descriptor-store' import { isSameMobileWorkspaceRepo } from '../worktree/new-workspace-dialog-repo-selection' import { buildRetiredWorktreeNamesRefreshKey, diff --git a/mobile/src/components/use-connected-host-picker.test.ts b/mobile/src/components/use-connected-host-picker.test.ts index 052c1b4a5f2..d986ef795cb 100644 --- a/mobile/src/components/use-connected-host-picker.test.ts +++ b/mobile/src/components/use-connected-host-picker.test.ts @@ -1,7 +1,7 @@ import { createElement } from 'react' import { act, create, type ReactTestRenderer } from 'react-test-renderer' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import { useConnectedHostPicker } from './use-connected-host-picker' function host(id: string, name: string, endpoint: string): HostProfile { diff --git a/mobile/src/components/use-connected-host-picker.ts b/mobile/src/components/use-connected-host-picker.ts index e6eec0b1e13..2697c9d18b9 100644 --- a/mobile/src/components/use-connected-host-picker.ts +++ b/mobile/src/components/use-connected-host-picker.ts @@ -1,6 +1,6 @@ import { useRef, useState } from 'react' import { hostEndpointLabel } from '../transport/hosts/host-endpoint-label' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' /** Picker rows for desktops, telling apart two that share a name and endpoint. */ export function hostPickerOptions(hosts: HostProfile[]) { diff --git a/mobile/src/device-store/device-store.ts b/mobile/src/device-store/device-store.ts index c86b067d79c..adbb20ff677 100644 --- a/mobile/src/device-store/device-store.ts +++ b/mobile/src/device-store/device-store.ts @@ -7,11 +7,11 @@ import type { AESEncryptionKey } from 'expo-crypto' import { Directory, Paths } from 'expo-file-system' import { AppState } from 'react-native' import { createExpoGenerationFileSystem } from '../mobile-web-shell/generation-store-file-system' -import { loadStoredHostProfiles } from '../transport/hosts/host-metadata-store' +import { loadStoredHostProfiles } from '../host-catalog/host-metadata-store' import { readPairingKeychainItem, writePairingKeychainItem -} from '../transport/hosts/pairing-keychain' +} from '../host-credentials/pairing-keychain' import { createRootIndex, DEVICE_STORE_CAPS, diff --git a/mobile/src/diagnostics/connection-diagnostics-report.ts b/mobile/src/diagnostics/connection-diagnostics-report.ts index 3a6dd9728bf..42a9581cb3b 100644 --- a/mobile/src/diagnostics/connection-diagnostics-report.ts +++ b/mobile/src/diagnostics/connection-diagnostics-report.ts @@ -5,7 +5,7 @@ import type { MobileConnectionDiagnosticPath } from './connection/connection-log-types' import type { ConnectionState } from '../transport/connection/connection-state' -import { normalizeHostAppVersion } from '../transport/hosts/host-app-version' +import { normalizeHostAppVersion } from '../host-descriptors/host-app-version' import { formatEndpoint } from './host-reachability' import { diagnoseConnection } from './connection-diagnostics-analysis' import { redactConnectionLogEntry, redactConnectionLogText } from './connection-log-redaction' diff --git a/mobile/src/diagnostics/connection-diagnostics-screen-data.test.ts b/mobile/src/diagnostics/connection-diagnostics-screen-data.test.ts index 3a895518657..fa859474b28 100644 --- a/mobile/src/diagnostics/connection-diagnostics-screen-data.test.ts +++ b/mobile/src/diagnostics/connection-diagnostics-screen-data.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { resolveDiagnosticsHostId } from './connection-diagnostics-screen-data' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' const host = (id: string): HostProfile => ({ id, diff --git a/mobile/src/diagnostics/connection-diagnostics-screen-data.ts b/mobile/src/diagnostics/connection-diagnostics-screen-data.ts index 341044db3da..360b1e437ae 100644 --- a/mobile/src/diagnostics/connection-diagnostics-screen-data.ts +++ b/mobile/src/diagnostics/connection-diagnostics-screen-data.ts @@ -1,6 +1,6 @@ import type { ConnectionLogStore } from './connection/connection-log-buffer' import type { ConnectionLogEntry } from './connection/connection-log-types' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { RpcClientContextValue } from '../transport/connection/rpc-client-context-contract' /** Route identity token: compared by reference to detect navigating away and back, never read. */ diff --git a/mobile/src/diagnostics/mobile-web-bundle-probe-row.tsx b/mobile/src/diagnostics/mobile-web-bundle-probe-row.tsx index 038c7f04810..37ab11331b1 100644 --- a/mobile/src/diagnostics/mobile-web-bundle-probe-row.tsx +++ b/mobile/src/diagnostics/mobile-web-bundle-probe-row.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react' import { View, Text, Pressable, ActivityIndicator } from 'react-native' import { Package } from 'lucide-react-native' -import { loadHosts } from '../transport/hosts/host-store' +import { loadHosts } from '../host-catalog/host-store' import { colors } from '../theme/mobile-theme' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { troubleshootScreenStyles as styles } from './troubleshoot-screen-styles' @@ -9,7 +9,7 @@ import { useMobileWebBundleProbe, type MobileWebBundleProbeState } from './use-mobile-web-bundle-probe' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { Translate } from '../i18n/mobile-i18n' import { useMobileTranslation } from '../i18n/use-mobile-translation' import { ListGroup, ListRow } from '../components/list/ListGroup' diff --git a/mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx b/mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx index 526bec82310..78889ea5e51 100644 --- a/mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx +++ b/mobile/src/diagnostics/mobile-web-shell-update-failure-row.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react' import { Text, View } from 'react-native' import type { MobileWebShellUpdateFailure } from '../mobile-web-shell/mobile-web-shell-update-failure' import { processGenerationStore } from '../mobile-web-shell/process-generation-store' -import { loadHosts } from '../transport/hosts/host-store' +import { loadHosts } from '../host-catalog/host-store' import { formatUpdateFailure } from './mobile-web-shell-update-failure-copy' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { troubleshootScreenStyles as styles } from './troubleshoot-screen-styles' diff --git a/mobile/src/diagnostics/native-diagnostics-operations.test.ts b/mobile/src/diagnostics/native-diagnostics-operations.test.ts index 38cbb6e3ab2..8f57d41ce43 100644 --- a/mobile/src/diagnostics/native-diagnostics-operations.test.ts +++ b/mobile/src/diagnostics/native-diagnostics-operations.test.ts @@ -1,6 +1,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type { ConnectionState } from '../transport/connection/connection-state' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import { createNativeDiagnosticsOperations } from './native-diagnostics-operations' const logStore = vi.hoisted(() => ({ diff --git a/mobile/src/diagnostics/native-diagnostics-operations.ts b/mobile/src/diagnostics/native-diagnostics-operations.ts index 0b26bc5f912..5192c6d962d 100644 --- a/mobile/src/diagnostics/native-diagnostics-operations.ts +++ b/mobile/src/diagnostics/native-diagnostics-operations.ts @@ -1,6 +1,6 @@ import { Platform } from 'react-native' import Constants from 'expo-constants' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { RpcClientContextValue } from '../transport/connection/rpc-client-context-contract' import { connectionLogStore } from './connection/persisted-connection-log-store' import { diff --git a/mobile/src/diagnostics/use-troubleshoot-diagnostics.ts b/mobile/src/diagnostics/use-troubleshoot-diagnostics.ts index 2eee9847c73..297addc4ed5 100644 --- a/mobile/src/diagnostics/use-troubleshoot-diagnostics.ts +++ b/mobile/src/diagnostics/use-troubleshoot-diagnostics.ts @@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react' import type { View } from 'react-native' import { Platform } from 'react-native' import { useMobileTranslation } from '../i18n/use-mobile-translation' -import { loadHostCatalog, loadHosts } from '../transport/hosts/host-store' +import { loadHostCatalog, loadHosts } from '../host-catalog/host-store' import { startDiagnosticFetchTimeout, type DiagnosticFetchTimeout diff --git a/mobile/src/dictation/use-mobile-dictation-live.ts b/mobile/src/dictation/use-mobile-dictation-live.ts index 13aa5f5081a..b5b89eff6f0 100644 --- a/mobile/src/dictation/use-mobile-dictation-live.ts +++ b/mobile/src/dictation/use-mobile-dictation-live.ts @@ -1,8 +1,8 @@ import { useCallback, useLayoutEffect, useMemo, useRef } from 'react' import type { UseMobileDictationResult } from '../hooks/mobile-dictation-session-state' import { useWorkspaceExecutionHost } from '../navigation/workspace-execution-host' -import { useHostDisplay } from '../transport/hosts/use-host-display' -import { useHostProfile } from '../transport/hosts/use-host-profile' +import { useHostDisplay } from '../host-descriptors/use-host-display' +import { useHostProfile } from '../host-catalog/use-host-profile' import type { MobileDictationLive } from './mobile-dictation-live-context' import { dictationFailureReason } from './mobile-dictation-controls-copy' diff --git a/mobile/src/home/MobileHomeActiveAgents.tsx b/mobile/src/home/MobileHomeActiveAgents.tsx index 4db194940c0..a8f41a222b0 100644 --- a/mobile/src/home/MobileHomeActiveAgents.tsx +++ b/mobile/src/home/MobileHomeActiveAgents.tsx @@ -2,7 +2,7 @@ import { memo } from 'react' import type { AgentListRow } from '../agents/agent-list-rows' import { MobileAgentListRows, type AgentListRowHandlers } from '../agents/MobileAgentListRows' import { useMobileTranslation } from '../i18n/use-mobile-translation' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import { areStructurallyEqual } from '../worktree/structural-equality' import { MobileHomeSectionHeading } from './MobileHomeSectionHeading' diff --git a/mobile/src/home/MobileHomeDesktopRow.tsx b/mobile/src/home/MobileHomeDesktopRow.tsx index 2d8786ddb8a..71fb2e14a4a 100644 --- a/mobile/src/home/MobileHomeDesktopRow.tsx +++ b/mobile/src/home/MobileHomeDesktopRow.tsx @@ -6,10 +6,10 @@ import { statusDotColor } from '../components/StatusDot' import type { ConnectionVerdict } from '../transport/connection/connection-health' import { verdictDisplayLabel } from '../transport/connection/connection-health' import { mobileConnectionPathAccessibilityLabel } from '../transport/connection/mobile-connection-path-label' -import { useHostDisplay } from '../transport/hosts/use-host-display' +import { useHostDisplay } from '../host-descriptors/use-host-display' import type { MobileConnectionPath } from '../transport/connection/stable-logical-rpc-client' import type { ConnectionState } from '../transport/connection/connection-state' -import type { HostCatalogEntry, HostProfile } from '../transport/hosts/host-profile' +import type { HostCatalogEntry, HostProfile } from '../host-catalog/host-profile' import { colors } from '../theme/mobile-theme' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { homeHostWorktreeSummary, type HostWorktreeInfo } from '../worktree/home-worktree-info' diff --git a/mobile/src/home/MobileHomeHostList.tsx b/mobile/src/home/MobileHomeHostList.tsx index ad442bc3472..f336850241d 100644 --- a/mobile/src/home/MobileHomeHostList.tsx +++ b/mobile/src/home/MobileHomeHostList.tsx @@ -7,7 +7,7 @@ import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { classifyConnection } from '../transport/connection/connection-health' import { resolveHomeHostConnectionState } from '../transport/hosts/home-host-auto-connect' import type { ConnectionState } from '../transport/connection/connection-state' -import type { HostCatalogEntry } from '../transport/hosts/host-profile' +import type { HostCatalogEntry } from '../host-catalog/host-profile' import type { HostWorktreeInfo } from '../worktree/home-worktree-info' import type { HomeHostConnections } from './home-host-connection-projection' import { homeListStyles } from './home-list-styles' diff --git a/mobile/src/home/MobileHomeScreen.tsx b/mobile/src/home/MobileHomeScreen.tsx index b54010f1322..048b43c3ee9 100644 --- a/mobile/src/home/MobileHomeScreen.tsx +++ b/mobile/src/home/MobileHomeScreen.tsx @@ -23,9 +23,9 @@ import { } from '../transport/connection/host-client-hooks' import { hostEndpointLabel } from '../transport/hosts/host-endpoint-label' import { resolveHomeHostConnectionState } from '../transport/hosts/home-host-auto-connect' -import { removeHostAndCloseClient } from '../transport/hosts/host-removal-lifecycle' -import { loadHostCatalog } from '../transport/hosts/host-store' -import type { HostCatalogEntry, HostProfile } from '../transport/hosts/host-profile' +import { removeHostAndCloseClient } from '../host-catalog/host-removal-lifecycle' +import { loadHostCatalog } from '../host-catalog/host-store' +import type { HostCatalogEntry, HostProfile } from '../host-catalog/host-profile' import { useOpenMobileHostEdit } from '../host-screen/use-open-mobile-host-edit' import { mobileConnectionPathLabel } from '../transport/connection/mobile-connection-path-label' import { newWorkspaceOverlayHref } from '../new-workspace/new-workspace-overlay-route' diff --git a/mobile/src/home/MobileHomeTasksSection.tsx b/mobile/src/home/MobileHomeTasksSection.tsx index 8df195fc8b7..cb695351164 100644 --- a/mobile/src/home/MobileHomeTasksSection.tsx +++ b/mobile/src/home/MobileHomeTasksSection.tsx @@ -6,7 +6,7 @@ import { PickerModal } from '../components/PickerModal' import { useConnectedHostPicker } from '../components/use-connected-host-picker' import { colors } from '../theme/mobile-theme' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import { homeListStyles as styles } from './home-list-styles' type HomeHostSectionProps = { diff --git a/mobile/src/home/mobile-home-connection-state.ts b/mobile/src/home/mobile-home-connection-state.ts index 39353be62dd..03e3b95cf9e 100644 --- a/mobile/src/home/mobile-home-connection-state.ts +++ b/mobile/src/home/mobile-home-connection-state.ts @@ -1,6 +1,6 @@ import type { RpcClient } from '../transport/rpc/rpc-client-contract' import type { ConnectionState } from '../transport/connection/connection-state' -import type { HostCatalogEntry } from '../transport/hosts/host-profile' +import type { HostCatalogEntry } from '../host-catalog/host-profile' export type MobileHomeClientEntry = { hostId: string diff --git a/mobile/src/home/tabs/MobileHomeAgentsDesktopFilter.tsx b/mobile/src/home/tabs/MobileHomeAgentsDesktopFilter.tsx index 04b40720156..778dcb1a621 100644 --- a/mobile/src/home/tabs/MobileHomeAgentsDesktopFilter.tsx +++ b/mobile/src/home/tabs/MobileHomeAgentsDesktopFilter.tsx @@ -7,8 +7,8 @@ import type { Translate } from '../../i18n/mobile-i18n' import { useMobileTranslation } from '../../i18n/use-mobile-translation' import { colors } from '../../theme/mobile-theme' import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' -import type { HostProfile } from '../../transport/hosts/host-profile' -import { useHostDisplay } from '../../transport/hosts/use-host-display' +import type { HostProfile } from '../../host-catalog/host-profile' +import { useHostDisplay } from '../../host-descriptors/use-host-display' import { MobileHomePill } from './MobileHomeHostPill' const ALL_DESKTOPS = '__all__' diff --git a/mobile/src/home/tabs/MobileHomeAgentsTab.tsx b/mobile/src/home/tabs/MobileHomeAgentsTab.tsx index c31b8a37079..e1029611889 100644 --- a/mobile/src/home/tabs/MobileHomeAgentsTab.tsx +++ b/mobile/src/home/tabs/MobileHomeAgentsTab.tsx @@ -29,8 +29,8 @@ import { useSerializedStoredState } from '../../storage/use-serialized-stored-st import { colors, spacing } from '../../theme/mobile-theme' import { themedStyleSheet } from '../../theme/themed-styles' import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' -import type { HostProfile } from '../../transport/hosts/host-profile' -import { useHostDisplay } from '../../transport/hosts/use-host-display' +import type { HostProfile } from '../../host-catalog/host-profile' +import { useHostDisplay } from '../../host-descriptors/use-host-display' import { formatTimeAgo } from '../../worktree/agent-row-display' import { homeListStyles } from '../home-list-styles' import { MobileHomeSectionHeading } from '../MobileHomeSectionHeading' diff --git a/mobile/src/home/tabs/MobileHomeAutomationsTab.tsx b/mobile/src/home/tabs/MobileHomeAutomationsTab.tsx index b385ac496eb..eeda1071407 100644 --- a/mobile/src/home/tabs/MobileHomeAutomationsTab.tsx +++ b/mobile/src/home/tabs/MobileHomeAutomationsTab.tsx @@ -20,8 +20,8 @@ import { themedStyleSheet } from '../../theme/themed-styles' import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' import { useHostClient } from '../../transport/connection/host-client-hooks' import type { ConnectionState } from '../../transport/connection/connection-state' -import type { HostProfile } from '../../transport/hosts/host-profile' -import { useHostDisplay } from '../../transport/hosts/use-host-display' +import type { HostProfile } from '../../host-catalog/host-profile' +import { useHostDisplay } from '../../host-descriptors/use-host-display' import { homeListStyles as list } from '../home-list-styles' import { MobileHomeSectionHeading } from '../MobileHomeSectionHeading' import { MobileHomeAutomationRow, MobileHomeAutomationRunRow } from './MobileHomeAutomationRows' diff --git a/mobile/src/home/tabs/MobileHomeFeedTab.tsx b/mobile/src/home/tabs/MobileHomeFeedTab.tsx index e3c9b67cd52..3ba20626d9a 100644 --- a/mobile/src/home/tabs/MobileHomeFeedTab.tsx +++ b/mobile/src/home/tabs/MobileHomeFeedTab.tsx @@ -4,7 +4,7 @@ import { useResponsiveLayout } from '../../layout/responsive-layout' import { spacing } from '../../theme/mobile-theme' import { themedStyleSheet } from '../../theme/themed-styles' import type { AgentListRowHandlers } from '../../agents/MobileAgentListRows' -import type { HostCatalogEntry } from '../../transport/hosts/host-profile' +import type { HostCatalogEntry } from '../../host-catalog/host-profile' import { MobileHomeAppUpdateCard } from '../MobileHomeAppUpdateCard' import { MobileHomeEmptyState } from '../MobileHomeEmptyState' import { MobileHomeHostList } from '../MobileHomeHostList' diff --git a/mobile/src/home/tabs/MobileHomeHostPill.tsx b/mobile/src/home/tabs/MobileHomeHostPill.tsx index 32897644ad4..7dd2c302d1b 100644 --- a/mobile/src/home/tabs/MobileHomeHostPill.tsx +++ b/mobile/src/home/tabs/MobileHomeHostPill.tsx @@ -10,8 +10,8 @@ import { colors, radii, spacing } from '../../theme/mobile-theme' import { themedStyleSheet } from '../../theme/themed-styles' import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' import type { ConnectionState } from '../../transport/connection/connection-state' -import type { HostProfile } from '../../transport/hosts/host-profile' -import { useHostDisplay } from '../../transport/hosts/use-host-display' +import type { HostProfile } from '../../host-catalog/host-profile' +import { useHostDisplay } from '../../host-descriptors/use-host-display' /** The desktop a per-desktop tab shows; it stays put until the user picks another or it is unpaired. */ export function useHomeTabHost(hosts: readonly HostProfile[], preferred: readonly HostProfile[]) { diff --git a/mobile/src/home/tabs/MobileHomeUsageTab.tsx b/mobile/src/home/tabs/MobileHomeUsageTab.tsx index 72faf6e8252..3aebd0acebb 100644 --- a/mobile/src/home/tabs/MobileHomeUsageTab.tsx +++ b/mobile/src/home/tabs/MobileHomeUsageTab.tsx @@ -25,8 +25,8 @@ import '../../theme/themed-styles' import { useMobileColorScheme } from '../../theme/use-mobile-color-scheme' import { useHostClient } from '../../transport/connection/host-client-hooks' import type { ConnectionState } from '../../transport/connection/connection-state' -import type { HostProfile } from '../../transport/hosts/host-profile' -import { useHostDisplay } from '../../transport/hosts/use-host-display' +import type { HostProfile } from '../../host-catalog/host-profile' +import { useHostDisplay } from '../../host-descriptors/use-host-display' import { formatTimeAgo } from '../../worktree/agent-row-display' import { homeListStyles } from '../home-list-styles' import { MobileHomeSectionHeading } from '../MobileHomeSectionHeading' diff --git a/mobile/src/home/use-mobile-home-data.ts b/mobile/src/home/use-mobile-home-data.ts index a8c150b3c49..a0500640fed 100644 --- a/mobile/src/home/use-mobile-home-data.ts +++ b/mobile/src/home/use-mobile-home-data.ts @@ -30,9 +30,9 @@ import { import { selectConnectableHostProfiles, sortHostsByLastConnected -} from '../transport/hosts/host-catalog-selection' -import { loadHostCatalog } from '../transport/hosts/host-store' -import type { HostCatalogEntry } from '../transport/hosts/host-profile' +} from '../host-catalog/host-catalog-selection' +import { loadHostCatalog } from '../host-catalog/host-store' +import type { HostCatalogEntry } from '../host-catalog/host-profile' import { hostObserverOptions, type HostQuery } from '../query/host-query' import { isHostNotConnectedError } from '../query/host-query-errors' import type { RpcClient } from '../transport/rpc/rpc-client-contract' diff --git a/mobile/src/home/use-mobile-home-host-connections.ts b/mobile/src/home/use-mobile-home-host-connections.ts index 11b26c25c46..cb5838a8510 100644 --- a/mobile/src/home/use-mobile-home-host-connections.ts +++ b/mobile/src/home/use-mobile-home-host-connections.ts @@ -12,7 +12,7 @@ import { usePrimeHosts } from '../transport/connection/host-client-hooks' import { selectHomeAutoConnectHostIds } from '../transport/hosts/home-host-auto-connect' import type { RpcClient } from '../transport/rpc/rpc-client-contract' import type { ConnectionState } from '../transport/connection/connection-state' -import type { HostCatalogEntry, HostProfile } from '../transport/hosts/host-profile' +import type { HostCatalogEntry, HostProfile } from '../host-catalog/host-profile' import { useAllHostClients } from '../transport/connection/use-all-host-clients' import { readMobileHomeLastConnected, diff --git a/mobile/src/transport/hosts/host-catalog-credential-join.ts b/mobile/src/host-catalog/host-catalog-credential-join.ts similarity index 92% rename from mobile/src/transport/hosts/host-catalog-credential-join.ts rename to mobile/src/host-catalog/host-catalog-credential-join.ts index 5f7b45e1cc1..be175ff615b 100644 --- a/mobile/src/transport/hosts/host-catalog-credential-join.ts +++ b/mobile/src/host-catalog/host-catalog-credential-join.ts @@ -1,4 +1,4 @@ -import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import type { MobileRelayEndpoint } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import type { HostListSnapshot } from './host-list-load-sharing' import type { HostCatalogEntry, StoredHostProfile } from './host-profile' diff --git a/mobile/src/transport/hosts/host-catalog-selection.ts b/mobile/src/host-catalog/host-catalog-selection.ts similarity index 100% rename from mobile/src/transport/hosts/host-catalog-selection.ts rename to mobile/src/host-catalog/host-catalog-selection.ts diff --git a/mobile/src/host-catalog/host-connection-history.ts b/mobile/src/host-catalog/host-connection-history.ts new file mode 100644 index 00000000000..a34e4289c12 --- /dev/null +++ b/mobile/src/host-catalog/host-connection-history.ts @@ -0,0 +1,17 @@ +import { mutateStoredHosts } from './host-list-mutation-queue' + +export async function updateLastConnected(hostId: string): Promise { + try { + await mutateStoredHosts((hosts) => { + const index = hosts.findIndex((h) => h.id === hostId) + if (index === -1) { + return hosts + } + const next = hosts.slice() + next[index] = { ...next[index]!, lastConnected: Date.now() } + return next + }) + } catch { + // Swallow bookkeeping failures because void callers cannot catch them. + } +} diff --git a/mobile/src/host-catalog/host-connection-history.web.ts b/mobile/src/host-catalog/host-connection-history.web.ts new file mode 100644 index 00000000000..095f18af6dd --- /dev/null +++ b/mobile/src/host-catalog/host-connection-history.web.ts @@ -0,0 +1,2 @@ +// Recency belongs to the native host list, which this page does not show. +export const updateLastConnected = (_hostId: string): Promise => Promise.resolve() diff --git a/mobile/src/transport/hosts/host-list-load-sharing.test.ts b/mobile/src/host-catalog/host-list-load-sharing.test.ts similarity index 100% rename from mobile/src/transport/hosts/host-list-load-sharing.test.ts rename to mobile/src/host-catalog/host-list-load-sharing.test.ts diff --git a/mobile/src/transport/hosts/host-list-load-sharing.ts b/mobile/src/host-catalog/host-list-load-sharing.ts similarity index 100% rename from mobile/src/transport/hosts/host-list-load-sharing.ts rename to mobile/src/host-catalog/host-list-load-sharing.ts diff --git a/mobile/src/transport/hosts/host-list-mutation-queue.ts b/mobile/src/host-catalog/host-list-mutation-queue.ts similarity index 100% rename from mobile/src/transport/hosts/host-list-mutation-queue.ts rename to mobile/src/host-catalog/host-list-mutation-queue.ts diff --git a/mobile/src/transport/hosts/host-metadata-store.ts b/mobile/src/host-catalog/host-metadata-store.ts similarity index 100% rename from mobile/src/transport/hosts/host-metadata-store.ts rename to mobile/src/host-catalog/host-metadata-store.ts diff --git a/mobile/src/transport/hosts/host-name-identity.test.ts b/mobile/src/host-catalog/host-name-identity.test.ts similarity index 96% rename from mobile/src/transport/hosts/host-name-identity.test.ts rename to mobile/src/host-catalog/host-name-identity.test.ts index 0c4878d0ef4..b69bc8d38fb 100644 --- a/mobile/src/transport/hosts/host-name-identity.test.ts +++ b/mobile/src/host-catalog/host-name-identity.test.ts @@ -25,7 +25,7 @@ vi.mock('react-native', () => ({ Platform: { OS: 'ios' } })) -vi.mock('./host-credential-cleanup', () => ({ +vi.mock('../host-credentials/host-credential-cleanup', () => ({ cancelPendingHostCredentialCleanup: vi.fn().mockResolvedValue(undefined), recordHostCredentialCleanupIntent: vi.fn().mockResolvedValue(undefined), scheduleHostCredentialCleanup: vi.fn().mockResolvedValue(undefined), @@ -38,7 +38,7 @@ import { savePairedHost, updateHostNameAndEndpoint } from './host-store' -import { updateHostDescriptor } from './host-descriptor-persistence' +import { updateHostDescriptor } from '../host-descriptors/host-descriptor-persistence' import { resetMobileRelayHostOverlayStoreForTests } from './mobile-relay-host-overlay-store' import { StoredHostProfileSchema, type StoredHostProfile } from './host-profile' diff --git a/mobile/src/transport/hosts/host-name-identity.ts b/mobile/src/host-catalog/host-name-identity.ts similarity index 97% rename from mobile/src/transport/hosts/host-name-identity.ts rename to mobile/src/host-catalog/host-name-identity.ts index b87cf1c273f..1b5bdb878e1 100644 --- a/mobile/src/transport/hosts/host-name-identity.ts +++ b/mobile/src/host-catalog/host-name-identity.ts @@ -1,6 +1,6 @@ import { GENERATED_HOST_NAME_PATTERN, getNextHostNameFromHosts } from './host-names' import type { StoredHostProfile } from './host-profile' -import { sameHostMachine, type HostMachine } from '../../../../src/shared/host-machine-line' +import { sameHostMachine, type HostMachine } from '../../../src/shared/host-machine-line' // Resolve name identity inside host-store’s serialized mutation so display name and sources commit together; see withReportedDescriptor’s omission exception. diff --git a/mobile/src/transport/hosts/host-names.ts b/mobile/src/host-catalog/host-names.ts similarity index 100% rename from mobile/src/transport/hosts/host-names.ts rename to mobile/src/host-catalog/host-names.ts diff --git a/mobile/src/transport/hosts/host-profile.ts b/mobile/src/host-catalog/host-profile.ts similarity index 82% rename from mobile/src/transport/hosts/host-profile.ts rename to mobile/src/host-catalog/host-profile.ts index 9fb53ad7404..f74c01a0f79 100644 --- a/mobile/src/transport/hosts/host-profile.ts +++ b/mobile/src/host-catalog/host-profile.ts @@ -1,13 +1,13 @@ import { z } from 'zod' -import '../../../../src/shared/remote-runtime/pairing/mobile-relay-pairing-offer' +import '../../../src/shared/remote-runtime/pairing/mobile-relay-pairing-offer' import { MobileRelayEndpointSchema, type MobileRelayEndpoint -} from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' -import { NODE_PLATFORM_NAMES } from '../connection/mobile-runtime-host-platform' -import { salvagedOptional } from '../../../../src/shared/zod-salvage' -import type { HostMachine } from '../../../../src/shared/host-machine-line' -import { HostMachineSchema } from './host-status-reply-schema' +} from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import { NODE_PLATFORM_NAMES } from '../transport/connection/mobile-runtime-host-platform' +import { salvagedOptional } from '../../../src/shared/zod-salvage' +import type { HostMachine } from '../../../src/shared/host-machine-line' +import { HostMachineSchema } from '../transport/hosts/host-status-reply-schema' export type HostProfile = { id: string diff --git a/mobile/src/transport/hosts/host-removal-lifecycle.ts b/mobile/src/host-catalog/host-removal-lifecycle.ts similarity index 76% rename from mobile/src/transport/hosts/host-removal-lifecycle.ts rename to mobile/src/host-catalog/host-removal-lifecycle.ts index 4349f09127e..65ff0eff370 100644 --- a/mobile/src/transport/hosts/host-removal-lifecycle.ts +++ b/mobile/src/host-catalog/host-removal-lifecycle.ts @@ -1,12 +1,12 @@ import type { QueryClient } from '@tanstack/react-query' -import { wipeHostStore } from '../../device-store/device-store' +import { wipeHostStore } from '../device-store/device-store' import { deleteHostPageCache, forgetHostUpdateFailures -} from '../../mobile-web-shell/removed-host-shell-cache' -import { unregisterPushForRemovedHost } from '../../notifications/push-registration' -import { forgetNativeHostQueries } from '../../query/native-query-persistence' -import { forgetHostDescriptor } from './host-descriptor-store' +} from '../mobile-web-shell/removed-host-shell-cache' +import { unregisterPushForRemovedHost } from '../notifications/push-registration' +import { forgetNativeHostQueries } from '../query/native-query-persistence' +import { forgetHostDescriptor } from '../host-descriptors/host-descriptor-store' import { removeHost } from './host-store' export async function removeHostAndCloseClient( diff --git a/mobile/src/transport/hosts/host-removal-lifecycle.web.ts b/mobile/src/host-catalog/host-removal-lifecycle.web.ts similarity index 100% rename from mobile/src/transport/hosts/host-removal-lifecycle.web.ts rename to mobile/src/host-catalog/host-removal-lifecycle.web.ts diff --git a/mobile/src/transport/hosts/host-store.test.ts b/mobile/src/host-catalog/host-store.test.ts similarity index 55% rename from mobile/src/transport/hosts/host-store.test.ts rename to mobile/src/host-catalog/host-store.test.ts index 04b82058be9..9b2a3a60382 100644 --- a/mobile/src/transport/hosts/host-store.test.ts +++ b/mobile/src/host-catalog/host-store.test.ts @@ -31,24 +31,14 @@ vi.mock('react-native', () => ({ Platform: platformMock })) -vi.mock('./host-credential-cleanup', () => ({ +vi.mock('../host-credentials/host-credential-cleanup', () => ({ cancelPendingHostCredentialCleanup: (...args: unknown[]) => cancelCleanupMock(...args), recordHostCredentialCleanupIntent: (...args: unknown[]) => recordCleanupIntentMock(...args), scheduleHostCredentialCleanup: (...args: unknown[]) => scheduleCleanupMock(...args), retryPendingHostCredentialCleanups: vi.fn() })) -import { - loadHostCatalog, - loadHosts, - RelayRoutingHostRemovedError, - removeHost, - resolvePairingHostIdentity, - resetHostStoreForTests, - savePairedHost, - setRelayRouting, - updateHostNameAndEndpoint -} from './host-store' +import { loadHostCatalog, loadHosts, resetHostStoreForTests, savePairedHost } from './host-store' import { resetMobileRelayHostOverlayStoreForTests } from './mobile-relay-host-overlay-store' const HOSTS_STORAGE_KEY = 'orca:hosts' @@ -67,14 +57,6 @@ const HOST_TWO = { publicKeyB64: 'key-2', lastConnected: 0 } -const HOST_ONE_RELAY = { - v: 1 as const, - directorUrl: 'https://relay.onorca.dev', - cellUrl: 'https://relay-c1.onorca.dev', - assignmentEpoch: 7, - relayHostId: 'AbCdEf0123_-xyZ9', - e2eeFraming: 2 as const -} describe('host-store list mutations', () => { let storedHostsRaw: string @@ -134,13 +116,6 @@ describe('host-store list mutations', () => { expect(profiles.map(({ id }) => id)).toEqual([HOST_TWO.id]) }) - it('fails closed when durable host identity storage is unreadable', async () => { - asyncStorageMock.getItem.mockRejectedValueOnce(new Error('storage unavailable')) - - await expect(resolvePairingHostIdentity('key-new', 'host-new')).rejects.toThrow(/unreadable/) - expect(asyncStorageMock.setItem).not.toHaveBeenCalled() - }) - it('serves a committed replacement token when same-key metadata persistence fails', async () => { const duplicate = { ...HOST_TWO, @@ -164,148 +139,6 @@ describe('host-store list mutations', () => { loadHosts().then((hosts) => hosts.find(({ id }) => id === HOST_ONE.id)?.deviceToken) ).resolves.toBe('replacement-token') }) - - it('refuses an early same-key token write without durable cleanup intent', async () => { - const replacement = { - ...HOST_TWO, - id: 'host-replacement', - publicKeyB64: HOST_ONE.publicKeyB64, - deviceToken: 'replacement-token' - } - recordCleanupIntentMock.mockRejectedValueOnce(new Error('intent storage unavailable')) - - await expect(savePairedHost(replacement)).rejects.toThrow('intent storage unavailable') - - expect(JSON.parse(storedHostsRaw)).toEqual([HOST_ONE, HOST_TWO]) - expect(secureStoreMock.setItemAsync).not.toHaveBeenCalled() - }) - - it('refuses to resurrect a removed host during relay upgrade publication', async () => { - storedHostsRaw = JSON.stringify([HOST_TWO]) - - await expect(setRelayRouting(HOST_ONE.id, HOST_ONE_RELAY)).rejects.toBeInstanceOf( - RelayRoutingHostRemovedError - ) - - expect(JSON.parse(storedHostsRaw)).toEqual([HOST_TWO]) - expect(storedOverlayRaw).toBeNull() - expect(secureStoreMock.setItemAsync).not.toHaveBeenCalled() - }) - - it('applies concurrent rename and remove without clobbering either', async () => { - let releaseReads: (() => void) | undefined - const readsReleased = new Promise((resolve) => { - releaseReads = resolve - }) - let pendingReads = 0 - asyncStorageMock.getItem.mockImplementation(async (key: string) => { - if (key !== HOSTS_STORAGE_KEY) { - return null - } - pendingReads += 1 - if (pendingReads <= 2) { - await readsReleased - } - return storedHostsRaw - }) - - const rename = updateHostNameAndEndpoint(HOST_ONE.id, { personalName: 'Renamed Host' }) - const remove = removeHost(HOST_TWO.id) - // Overlap writers behind one read gate to expose lost updates without serialization. - await vi.waitFor(() => { - expect(pendingReads).toBeGreaterThanOrEqual(1) - }) - releaseReads?.() - await Promise.all([rename, remove]) - - expect(JSON.parse(storedHostsRaw)).toEqual([ - { ...HOST_ONE, name: 'Renamed Host', personalName: 'Renamed Host' } - ]) - }) - - it('does not wipe the host list when storage is unreadable during mutation', async () => { - storedHostsRaw = '{' - await expect(updateHostNameAndEndpoint(HOST_ONE.id, { personalName: 'Nope' })).rejects.toThrow( - /unreadable/ - ) - expect(asyncStorageMock.setItem).not.toHaveBeenCalled() - expect(storedHostsRaw).toBe('{') - }) - - // Park the slow keychain pass while a durable write invalidates it. - function gateKeychainReads(): () => void { - let release: () => void = () => {} - const gate = new Promise((resolve) => { - release = resolve - }) - secureStoreMock.getItemAsync.mockImplementation(async (key: string) => { - await gate - return key.endsWith(HOST_ONE.id) || key.endsWith(HOST_TWO.id) ? `token-${key.at(-1)}` : null - }) - return release - } - - it('does not serve a pre-removal snapshot to a load issued after the removal (#8791)', async () => { - const releaseKeychain = gateKeychainReads() - const parkedLoad = loadHosts() - await vi.waitFor(() => { - expect(secureStoreMock.getItemAsync).toHaveBeenCalled() - }) - - await removeHost(HOST_ONE.id) - const afterRemoval = loadHosts() - releaseKeychain() - - await parkedLoad - await expect(afterRemoval.then((hosts) => hosts.map((host) => host.id))).resolves.toEqual([ - HOST_TWO.id - ]) - }) - - it('does not serve a pre-rename snapshot to a load issued after the rename (#8791)', async () => { - const releaseKeychain = gateKeychainReads() - const parkedLoad = loadHosts() - await vi.waitFor(() => { - expect(secureStoreMock.getItemAsync).toHaveBeenCalled() - }) - - await updateHostNameAndEndpoint(HOST_ONE.id, { personalName: 'Living Room Mac' }) - const afterRename = loadHosts() - releaseKeychain() - - await parkedLoad - const hosts = await afterRename - expect(hosts.find((host) => host.id === HOST_ONE.id)?.name).toBe('Living Room Mac') - }) - - it('does not let a late pre-write token read poison the token cache', async () => { - const newHost = { - id: 'host-new', - name: 'New Host', - endpoint: 'ws://127.0.0.1:3', - publicKeyB64: 'key-new', - deviceToken: 'token-new', - lastConnected: 0 - } - storedHostsRaw = JSON.stringify([{ ...newHost, deviceToken: undefined }]) - let resolvePrewriteTokenRead: (token: string) => void = () => {} - secureStoreMock.getItemAsync.mockReturnValue( - new Promise((resolve) => { - resolvePrewriteTokenRead = resolve - }) - ) - - const parkedLoad = loadHosts() - await vi.waitFor(() => { - expect(secureStoreMock.getItemAsync).toHaveBeenCalled() - }) - await savePairedHost(newHost) - resolvePrewriteTokenRead('token-old') - await parkedLoad - - const hosts = await loadHosts() - expect(hosts.find((host) => host.id === newHost.id)?.deviceToken).toBe(newHost.deviceToken) - }) }) describe('host-store pairing save after an Android encryption rejection', () => { diff --git a/mobile/src/transport/hosts/host-store.ts b/mobile/src/host-catalog/host-store.ts similarity index 91% rename from mobile/src/transport/hosts/host-store.ts rename to mobile/src/host-catalog/host-store.ts index 487b1344b13..f8e09c068dd 100644 --- a/mobile/src/transport/hosts/host-store.ts +++ b/mobile/src/host-catalog/host-store.ts @@ -1,4 +1,4 @@ -import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import type { MobileRelayEndpoint } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import { HostProfileSchema } from './host-profile' import type { HostCatalogEntry, HostProfile, StoredHostProfile } from './host-profile' @@ -6,27 +6,30 @@ import { getNextHostNameFromHosts } from './host-names' import { mergeHostNameIdentity, withPersonalName } from './host-name-identity' import * as hostListLoads from './host-list-load-sharing' import { joinHostCatalogCredentials } from './host-catalog-credential-join' -import { resetPairingKeychainForTests } from './pairing-keychain' -import { readHostDeviceToken, writeHostDeviceToken } from './host-device-token-store' +import { resetPairingKeychainForTests } from '../host-credentials/pairing-keychain' +import { + readHostDeviceToken, + writeHostDeviceToken +} from '../host-credentials/host-device-token-store' import { cancelPendingHostCredentialCleanup, recordHostCredentialCleanupIntent, retryPendingHostCredentialCleanups, scheduleHostCredentialCleanup -} from './host-credential-cleanup' +} from '../host-credentials/host-credential-cleanup' import { loadMobileRelayHostRoutingState, removeMobileRelayHostRouting, removeMobileRelayHostRoutings, saveMobileRelayHostRouting } from './mobile-relay-host-overlay-store' -import { scheduleOrphanedMobileRelayCleanup } from '../relay/mobile-relay-orphan-cleanup' +import { scheduleOrphanedMobileRelayCleanup } from '../transport/relay/mobile-relay-orphan-cleanup' import { getHostCredentialWriteRevision, markHostCredentialWrite, resetHostCredentialWriteRevisionsForTests -} from './host-credential-write-revision' -import { createUnpairedHostCredentialDeletion } from '../../pairing/unpaired-host-credential-deletion' +} from '../host-credentials/host-credential-write-revision' +import { createUnpairedHostCredentialDeletion } from '../pairing/unpaired-host-credential-deletion' import { loadStoredHostProfiles, readStoredHostProfilesForMutation, @@ -148,7 +151,7 @@ function removeOrphanOverlayIfUnpaired(hostId: string): Promise { }) } -import './host-descriptor-persistence' +import '../host-descriptors/host-descriptor-persistence' export class RelayRoutingHostRemovedError extends Error {} @@ -315,22 +318,6 @@ export async function updateHostNameAndEndpoint( }) } -export async function updateLastConnected(hostId: string): Promise { - try { - await mutateStoredHosts((hosts) => { - const index = hosts.findIndex((h) => h.id === hostId) - if (index === -1) { - return hosts - } - const next = hosts.slice() - next[index] = { ...next[index]!, lastConnected: Date.now() } - return next - }) - } catch { - // Swallow bookkeeping failures because void callers cannot catch them. - } -} - export function resetHostStoreForTests(): void { resetHostListMutationQueueForTests() tokenCache.clear() diff --git a/mobile/src/transport/hosts/host-store.web.ts b/mobile/src/host-catalog/host-store.web.ts similarity index 77% rename from mobile/src/transport/hosts/host-store.web.ts rename to mobile/src/host-catalog/host-store.web.ts index 3b8e3f33ac8..37475ac40ed 100644 --- a/mobile/src/transport/hosts/host-store.web.ts +++ b/mobile/src/host-catalog/host-store.web.ts @@ -1,5 +1,5 @@ -import { readPageHostProfile } from '../../mobile-web-shell/bridge/page-host-profile' -import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import { readPageHostProfile } from '../mobile-web-shell/bridge/page-host-profile' +import type { MobileRelayEndpoint } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import type { HostCatalogEntry, HostProfile } from './host-profile' // The page gets no device credential or public key; RPC uses the shell’s paired client. @@ -26,9 +26,6 @@ export const setRelayRouting = (_hostId: string, _relay: MobileRelayEndpoint): P export const removeHost = (_hostId: string): Promise => Promise.resolve() -// Recency belongs to the native host list, which this page does not show. -export const updateLastConnected = (_hostId: string): Promise => Promise.resolve() - export function updateHostNameAndEndpoint( _hostId: string, _updates: { personalName?: string | null; endpoint?: string } diff --git a/mobile/src/transport/hosts/mobile-relay-host-overlay-store.test.ts b/mobile/src/host-catalog/mobile-relay-host-overlay-store.test.ts similarity index 78% rename from mobile/src/transport/hosts/mobile-relay-host-overlay-store.test.ts rename to mobile/src/host-catalog/mobile-relay-host-overlay-store.test.ts index 6d4daea98d3..fd4e8f54f2f 100644 --- a/mobile/src/transport/hosts/mobile-relay-host-overlay-store.test.ts +++ b/mobile/src/host-catalog/mobile-relay-host-overlay-store.test.ts @@ -74,22 +74,4 @@ describe('mobile relay host overlay store', () => { await expect(saveMobileRelayHostRouting('host-1', RELAY)).resolves.toBe(true) expect(JSON.parse(stored!)).toEqual([RELAY_ONLY_OVERLAY]) }) - - it('never overlays or resurrects a host whose legacy base was removed', async () => { - stored = JSON.stringify([LEGACY_OVERLAY]) - - await expect(loadMobileRelayHostRoutingState(new Set())).resolves.toEqual({ - relays: new Map(), - orphanHostIds: ['host-1'] - }) - expect(asyncStorage.setItem).not.toHaveBeenCalled() - expect(JSON.parse(stored)).toEqual([LEGACY_OVERLAY]) - }) - - it('refuses to overwrite unreadable overlay storage', async () => { - stored = '{' - - await expect(saveMobileRelayHostRouting('host-1', RELAY)).rejects.toThrow(/unreadable/) - expect(asyncStorage.setItem).not.toHaveBeenCalled() - }) }) diff --git a/mobile/src/transport/hosts/mobile-relay-host-overlay-store.ts b/mobile/src/host-catalog/mobile-relay-host-overlay-store.ts similarity index 96% rename from mobile/src/transport/hosts/mobile-relay-host-overlay-store.ts rename to mobile/src/host-catalog/mobile-relay-host-overlay-store.ts index 8a30cd7219a..3f4da803bd2 100644 --- a/mobile/src/transport/hosts/mobile-relay-host-overlay-store.ts +++ b/mobile/src/host-catalog/mobile-relay-host-overlay-store.ts @@ -1,5 +1,5 @@ import AsyncStorage from '@react-native-async-storage/async-storage' -import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import type { MobileRelayEndpoint } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import { MobileRelayHostOverlaySchema, toStoredMobileRelayHostOverlay, diff --git a/mobile/src/transport/hosts/mobile-relay-host-overlay.ts b/mobile/src/host-catalog/mobile-relay-host-overlay.ts similarity index 92% rename from mobile/src/transport/hosts/mobile-relay-host-overlay.ts rename to mobile/src/host-catalog/mobile-relay-host-overlay.ts index 3e82389cde5..f97d6f7cb2c 100644 --- a/mobile/src/transport/hosts/mobile-relay-host-overlay.ts +++ b/mobile/src/host-catalog/mobile-relay-host-overlay.ts @@ -2,8 +2,8 @@ import { z } from 'zod' import { MobileRelayEndpointSchema, type MobileRelayEndpoint -} from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' -import { relayConnectWebSocketUrl } from '../relay/mobile-relay-connect-url' +} from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import { relayConnectWebSocketUrl } from '../transport/relay/mobile-relay-connect-url' const MobileAccessEndpointSchema = z .object({ diff --git a/mobile/src/transport/hosts/page-host-removal-refusal.ts b/mobile/src/host-catalog/page-host-removal-refusal.ts similarity index 100% rename from mobile/src/transport/hosts/page-host-removal-refusal.ts rename to mobile/src/host-catalog/page-host-removal-refusal.ts diff --git a/mobile/src/transport/hosts/use-host-profile.ts b/mobile/src/host-catalog/use-host-profile.ts similarity index 100% rename from mobile/src/transport/hosts/use-host-profile.ts rename to mobile/src/host-catalog/use-host-profile.ts diff --git a/mobile/src/transport/hosts/host-credential-cleanup.ts b/mobile/src/host-credentials/host-credential-cleanup.ts similarity index 100% rename from mobile/src/transport/hosts/host-credential-cleanup.ts rename to mobile/src/host-credentials/host-credential-cleanup.ts diff --git a/mobile/src/transport/hosts/host-credential-write-revision.ts b/mobile/src/host-credentials/host-credential-write-revision.ts similarity index 100% rename from mobile/src/transport/hosts/host-credential-write-revision.ts rename to mobile/src/host-credentials/host-credential-write-revision.ts diff --git a/mobile/src/transport/hosts/host-device-token-store.ts b/mobile/src/host-credentials/host-device-token-store.ts similarity index 100% rename from mobile/src/transport/hosts/host-device-token-store.ts rename to mobile/src/host-credentials/host-device-token-store.ts diff --git a/mobile/src/transport/hosts/host-device-token-store.web.ts b/mobile/src/host-credentials/host-device-token-store.web.ts similarity index 100% rename from mobile/src/transport/hosts/host-device-token-store.web.ts rename to mobile/src/host-credentials/host-device-token-store.web.ts diff --git a/mobile/src/transport/hosts/mobile-relay-credential-bundle.test.ts b/mobile/src/host-credentials/mobile-relay-credential-bundle.test.ts similarity index 96% rename from mobile/src/transport/hosts/mobile-relay-credential-bundle.test.ts rename to mobile/src/host-credentials/mobile-relay-credential-bundle.test.ts index 48b66a8b2da..37e2f71cbd9 100644 --- a/mobile/src/transport/hosts/mobile-relay-credential-bundle.test.ts +++ b/mobile/src/host-credentials/mobile-relay-credential-bundle.test.ts @@ -19,7 +19,7 @@ vi.mock('expo-secure-store', () => ({ vi.mock('react-native', () => ({ Platform: platform })) import { promotePairingJournalCredential } from './mobile-relay-credential-bundle' -import type { MobileRelayPairingJournal } from '../../pairing/mobile-relay-pairing-journal' +import type { MobileRelayPairingJournal } from '../pairing/mobile-relay-pairing-journal' import { resetPairingKeychainForTests } from './pairing-keychain' const journal = { diff --git a/mobile/src/transport/hosts/mobile-relay-credential-bundle.ts b/mobile/src/host-credentials/mobile-relay-credential-bundle.ts similarity index 93% rename from mobile/src/transport/hosts/mobile-relay-credential-bundle.ts rename to mobile/src/host-credentials/mobile-relay-credential-bundle.ts index 21e103cfc40..f48b5b939d3 100644 --- a/mobile/src/transport/hosts/mobile-relay-credential-bundle.ts +++ b/mobile/src/host-credentials/mobile-relay-credential-bundle.ts @@ -1,7 +1,7 @@ import { Platform } from 'react-native' import { z } from 'zod' -import type { DeviceCredentialInstalled } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' -import type { MobileRelayPairingJournal } from '../../pairing/mobile-relay-pairing-journal' +import type { DeviceCredentialInstalled } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' +import type { MobileRelayPairingJournal } from '../pairing/mobile-relay-pairing-journal' import { deletePairingKeychainItem, readPairingKeychainItem, diff --git a/mobile/src/transport/hosts/pairing-keychain.ts b/mobile/src/host-credentials/pairing-keychain.ts similarity index 100% rename from mobile/src/transport/hosts/pairing-keychain.ts rename to mobile/src/host-credentials/pairing-keychain.ts diff --git a/mobile/src/transport/hosts/host-app-version-store.ts b/mobile/src/host-descriptors/host-app-version-store.ts similarity index 100% rename from mobile/src/transport/hosts/host-app-version-store.ts rename to mobile/src/host-descriptors/host-app-version-store.ts diff --git a/mobile/src/transport/hosts/host-app-version-store.web.ts b/mobile/src/host-descriptors/host-app-version-store.web.ts similarity index 100% rename from mobile/src/transport/hosts/host-app-version-store.web.ts rename to mobile/src/host-descriptors/host-app-version-store.web.ts diff --git a/mobile/src/transport/hosts/host-app-version.ts b/mobile/src/host-descriptors/host-app-version.ts similarity index 100% rename from mobile/src/transport/hosts/host-app-version.ts rename to mobile/src/host-descriptors/host-app-version.ts diff --git a/mobile/src/transport/hosts/host-descriptor-persistence.ts b/mobile/src/host-descriptors/host-descriptor-persistence.ts similarity index 82% rename from mobile/src/transport/hosts/host-descriptor-persistence.ts rename to mobile/src/host-descriptors/host-descriptor-persistence.ts index 12fd0d18d24..dbd342527ed 100644 --- a/mobile/src/transport/hosts/host-descriptor-persistence.ts +++ b/mobile/src/host-descriptors/host-descriptor-persistence.ts @@ -1,5 +1,8 @@ -import { mutateStoredHosts } from './host-list-mutation-queue' -import { withReportedDescriptor, type ReportedHostDescriptor } from './host-name-identity' +import { mutateStoredHosts } from '../host-catalog/host-list-mutation-queue' +import { + withReportedDescriptor, + type ReportedHostDescriptor +} from '../host-catalog/host-name-identity' // Keep authenticated descriptor upkeep best-effort; older hosts omitting both fields must not churn stored rows. export async function updateHostDescriptor( diff --git a/mobile/src/transport/hosts/host-descriptor-persistence.web.ts b/mobile/src/host-descriptors/host-descriptor-persistence.web.ts similarity index 59% rename from mobile/src/transport/hosts/host-descriptor-persistence.web.ts rename to mobile/src/host-descriptors/host-descriptor-persistence.web.ts index 43933095a61..b99ea73eb3c 100644 --- a/mobile/src/transport/hosts/host-descriptor-persistence.web.ts +++ b/mobile/src/host-descriptors/host-descriptor-persistence.web.ts @@ -1,5 +1,5 @@ -import '../../mobile-web-shell/bridge/page-host-profile' -import type { ReportedHostDescriptor } from './host-name-identity' +import '../mobile-web-shell/bridge/page-host-profile' +import type { ReportedHostDescriptor } from '../host-catalog/host-name-identity' // Last-known descriptors belong to the native host list. export function updateHostDescriptor( diff --git a/mobile/src/transport/hosts/host-descriptor-recorder.ts b/mobile/src/host-descriptors/host-descriptor-recorder.ts similarity index 83% rename from mobile/src/transport/hosts/host-descriptor-recorder.ts rename to mobile/src/host-descriptors/host-descriptor-recorder.ts index 0b5ab0e5cdb..49aad137b63 100644 --- a/mobile/src/transport/hosts/host-descriptor-recorder.ts +++ b/mobile/src/host-descriptors/host-descriptor-recorder.ts @@ -1,7 +1,7 @@ import { recordHostDescriptor } from './host-descriptor-store' -import './host-store' +import '../host-catalog/host-store' import { updateHostDescriptor } from './host-descriptor-persistence' -import type { HostStatusReply } from './host-status-reply-schema' +import type { HostStatusReply } from '../transport/hosts/host-status-reply-schema' // Update live rows and persisted last-known descriptors together; best-effort bookkeeping must never gate connection. export function recordHostDescriptorFromStatus(hostId: string, status: HostStatusReply): void { diff --git a/mobile/src/transport/hosts/host-descriptor-store.ts b/mobile/src/host-descriptors/host-descriptor-store.ts similarity index 95% rename from mobile/src/transport/hosts/host-descriptor-store.ts rename to mobile/src/host-descriptors/host-descriptor-store.ts index bb114074164..ad33c055070 100644 --- a/mobile/src/transport/hosts/host-descriptor-store.ts +++ b/mobile/src/host-descriptors/host-descriptor-store.ts @@ -1,5 +1,5 @@ import { useCallback, useSyncExternalStore } from 'react' -import { sameHostMachine, type HostMachine } from '../../../../src/shared/host-machine-line' +import { sameHostMachine, type HostMachine } from '../../../src/shared/host-machine-line' export type HostMachineDescriptor = { machineName: string | null diff --git a/mobile/src/transport/hosts/use-host-display.ts b/mobile/src/host-descriptors/use-host-display.ts similarity index 85% rename from mobile/src/transport/hosts/use-host-display.ts rename to mobile/src/host-descriptors/use-host-display.ts index 0f0e8abefe6..49ab4f235df 100644 --- a/mobile/src/transport/hosts/use-host-display.ts +++ b/mobile/src/host-descriptors/use-host-display.ts @@ -1,10 +1,10 @@ import { resolveHostDisplay, type HostDisplayResolution -} from '../../../../src/shared/host-display-resolution' +} from '../../../src/shared/host-display-resolution' import { useHostDescriptor } from './host-descriptor-store' -import { classifyLegacyHostName } from './host-name-identity' -import type { HostMachine } from '../../../../src/shared/host-machine-line' +import { classifyLegacyHostName } from '../host-catalog/host-name-identity' +import type { HostMachine } from '../../../src/shared/host-machine-line' export type HostDisplaySource = { id: string diff --git a/mobile/src/host-list-action-sheet-actions.ts b/mobile/src/host-list-action-sheet-actions.ts index 036d025d798..ea156122a5a 100644 --- a/mobile/src/host-list-action-sheet-actions.ts +++ b/mobile/src/host-list-action-sheet-actions.ts @@ -1,7 +1,7 @@ import { Activity, Edit3, PowerOff, RefreshCw } from 'lucide-react-native' import type { ActionSheetAction } from './components/ActionSheetModal' import type { ConnectionState } from './transport/connection/connection-state' -import type { HostProfile } from './transport/hosts/host-profile' +import type { HostProfile } from './host-catalog/host-profile' import { translate } from './i18n/mobile-i18n' // Defer navigation and new drawers until this native Modal unmounts; presenting into a live one freezes iOS (#8791). diff --git a/mobile/src/host-screen/host-stored-identity.ts b/mobile/src/host-screen/host-stored-identity.ts index 31d75015e5d..dd02444eb75 100644 --- a/mobile/src/host-screen/host-stored-identity.ts +++ b/mobile/src/host-screen/host-stored-identity.ts @@ -1,4 +1,4 @@ -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { HostMachine } from '../../../src/shared/host-machine-line' export type HostStoredDescriptor = { diff --git a/mobile/src/host-screen/use-host-display-worktrees.ts b/mobile/src/host-screen/use-host-display-worktrees.ts index 84f72fa8a86..517c0924fa2 100644 --- a/mobile/src/host-screen/use-host-display-worktrees.ts +++ b/mobile/src/host-screen/use-host-display-worktrees.ts @@ -1,5 +1,5 @@ import { useMemo } from 'react' -import { useHostDescriptor } from '../transport/hosts/host-descriptor-store' +import { useHostDescriptor } from '../host-descriptors/host-descriptor-store' import type { ConnectionState } from '../transport/connection/connection-state' import { serverHostHealth, diff --git a/mobile/src/host-screen/use-host-screen-controller.ts b/mobile/src/host-screen/use-host-screen-controller.ts index 983fa99eb96..e5ea6277d43 100644 --- a/mobile/src/host-screen/use-host-screen-controller.ts +++ b/mobile/src/host-screen/use-host-screen-controller.ts @@ -28,7 +28,7 @@ import { useHostViewSettings } from './use-host-view-settings' import { countActiveWorkspaceFilters } from '../../../src/shared/workspace-view/workspace-row-filters' import { useHostWorktreeActions } from './use-host-worktree-actions' import { useHostWorktreeCatalog } from './use-host-worktree-catalog' -import { useHostDisplay } from '../transport/hosts/use-host-display' +import { useHostDisplay } from '../host-descriptors/use-host-display' import { classifyConnection } from '../transport/connection/connection-health' export type HostScreenProps = { diff --git a/mobile/src/host-screen/use-host-screen-identity.ts b/mobile/src/host-screen/use-host-screen-identity.ts index f4e10c10019..057a23b8718 100644 --- a/mobile/src/host-screen/use-host-screen-identity.ts +++ b/mobile/src/host-screen/use-host-screen-identity.ts @@ -3,8 +3,9 @@ import { useQueryClient } from '@tanstack/react-query' import { translate } from '../i18n/mobile-i18n' import { ORCA_SIDEBAR_INPUTS_IS_MAIN } from '../../../src/shared/sidebar-inputs-switch' import { loadPinnedIds } from '../storage/preferences' -import { loadHosts, peekHosts, updateLastConnected } from '../transport/hosts/host-store' -import type { HostProfile } from '../transport/hosts/host-profile' +import { loadHosts, peekHosts } from '../host-catalog/host-store' +import { updateLastConnected } from '../host-catalog/host-connection-history' +import type { HostProfile } from '../host-catalog/host-profile' import type { RpcClient } from '../transport/rpc/rpc-client-contract' import type { HostScreenState } from './use-host-screen-state' import { storedHostDescriptor } from './host-stored-identity' diff --git a/mobile/src/host-screen/use-host-screen-state.ts b/mobile/src/host-screen/use-host-screen-state.ts index 742a6ac91c5..4f40a1a95bb 100644 --- a/mobile/src/host-screen/use-host-screen-state.ts +++ b/mobile/src/host-screen/use-host-screen-state.ts @@ -4,7 +4,7 @@ import type { ExecutionHostId } from '../../../src/shared/execution-host' import type { ExecutionHostHealth } from '../../../src/shared/execution-host/execution-host-health' import { storedHostDescriptor, type HostStoredDescriptor } from './host-stored-identity' import type { RpcClient } from '../transport/rpc/rpc-client-contract' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import { INITIAL_MOBILE_VIEW, type MobileViewState } from '../worktree/workspace-view-settings' import type { Worktree } from '../worktree/workspace-list-sections' import type { ServedProjectSections } from '../worktree/project-sections-operations' diff --git a/mobile/src/host-screen/use-host-worktree-actions.ts b/mobile/src/host-screen/use-host-worktree-actions.ts index 5d2814b1049..d96d2e8c9ab 100644 --- a/mobile/src/host-screen/use-host-worktree-actions.ts +++ b/mobile/src/host-screen/use-host-worktree-actions.ts @@ -6,8 +6,8 @@ import { floatingWorkspaceSessionPath } from '../session/floating-workspace' import { holdSessionLeave } from '../session/session-leave-guard' import { savePinnedIds } from '../storage/preferences' import type { useForgetHostClient } from '../transport/connection/host-client-hooks' -import { removeHostAndCloseClient } from '../transport/hosts/host-removal-lifecycle' -import { isPageHostRemovalUnavailable } from '../transport/hosts/page-host-removal-refusal' +import { removeHostAndCloseClient } from '../host-catalog/host-removal-lifecycle' +import { isPageHostRemovalUnavailable } from '../host-catalog/page-host-removal-refusal' import type { RpcClient } from '../transport/rpc/rpc-client-contract' import { rpcClientForExecutionHost, diff --git a/mobile/src/mobile-web-shell/ShellDownloadProgress.tsx b/mobile/src/mobile-web-shell/ShellDownloadProgress.tsx index 02b19f0caa6..46093799133 100644 --- a/mobile/src/mobile-web-shell/ShellDownloadProgress.tsx +++ b/mobile/src/mobile-web-shell/ShellDownloadProgress.tsx @@ -1,4 +1,4 @@ -import { useHostDisplay, type HostDisplaySource } from '../transport/hosts/use-host-display' +import { useHostDisplay, type HostDisplaySource } from '../host-descriptors/use-host-display' import type { DownloadProgressFeed } from './download-progress-feed' import { DownloadProgressBar, downloadedMegabytesCaption } from './DownloadProgressBar' import type { MobileWebShellSessionState } from './mobile-web-shell-session-contract' diff --git a/mobile/src/mobile-web-shell/ShellStateScreen.tsx b/mobile/src/mobile-web-shell/ShellStateScreen.tsx index 01617b74903..d22e7e2c055 100644 --- a/mobile/src/mobile-web-shell/ShellStateScreen.tsx +++ b/mobile/src/mobile-web-shell/ShellStateScreen.tsx @@ -6,7 +6,7 @@ import { themedStyleSheet } from '../theme/themed-styles' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import type { Translate } from '../i18n/mobile-i18n' import { useMobileTranslation } from '../i18n/use-mobile-translation' -import type { HostDisplaySource } from '../transport/hosts/use-host-display' +import type { HostDisplaySource } from '../host-descriptors/use-host-display' import type { DownloadProgressFeed } from './download-progress-feed' import type { MobileWebShellFailureCause, diff --git a/mobile/src/mobile-web-shell/host-area-page-storage.test.tsx b/mobile/src/mobile-web-shell/host-area-page-storage.test.tsx index 1d12bae7036..fe9a34b9777 100644 --- a/mobile/src/mobile-web-shell/host-area-page-storage.test.tsx +++ b/mobile/src/mobile-web-shell/host-area-page-storage.test.tsx @@ -26,7 +26,7 @@ vi.mock('@react-native-async-storage/async-storage', () => ({ ) } })) -vi.mock('../transport/hosts/host-store', () => ({ +vi.mock('../host-catalog/host-store', () => ({ loadHosts: async () => [{ id: 'host-a', name: 'Host', endpoint: 'ws://h', lastConnected: 1 }] })) diff --git a/mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx b/mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx index 98b98f51dfd..0d9b3956c08 100644 --- a/mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx +++ b/mobile/src/mobile-web-shell/use-page-host-snapshot.test.tsx @@ -46,7 +46,7 @@ vi.mock('@react-native-async-storage/async-storage', () => ({ getItem: async (key: string) => doubles.store.get(key) ?? null } })) -vi.mock('../transport/hosts/host-store', () => ({ +vi.mock('../host-catalog/host-store', () => ({ loadHosts: async () => { if (doubles.hostsReject) { throw new Error('the keychain would not answer') diff --git a/mobile/src/mobile-web-shell/use-page-host-snapshot.ts b/mobile/src/mobile-web-shell/use-page-host-snapshot.ts index bfba2b5ac7f..55a30b6e8bb 100644 --- a/mobile/src/mobile-web-shell/use-page-host-snapshot.ts +++ b/mobile/src/mobile-web-shell/use-page-host-snapshot.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef, useState } from 'react' -import { loadHosts } from '../transport/hosts/host-store' +import { loadHosts } from '../host-catalog/host-store' import type { BridgeInitHost } from './bridge/bridge-envelope' import { hydrateMirroredStorage, diff --git a/mobile/src/new-workspace/NewWorkspaceHostPicker.tsx b/mobile/src/new-workspace/NewWorkspaceHostPicker.tsx index 4fdc22c2acf..b9d5cb446bf 100644 --- a/mobile/src/new-workspace/NewWorkspaceHostPicker.tsx +++ b/mobile/src/new-workspace/NewWorkspaceHostPicker.tsx @@ -3,9 +3,9 @@ import { useRouter } from 'expo-router' import { PickerModal } from '../components/PickerModal' import { useMobileTranslation } from '../i18n/use-mobile-translation' import { hostPickerOptions } from '../components/use-connected-host-picker' -import { selectConnectableHostProfiles } from '../transport/hosts/host-catalog-selection' -import { loadHostCatalog } from '../transport/hosts/host-store' -import type { HostProfile } from '../transport/hosts/host-profile' +import { selectConnectableHostProfiles } from '../host-catalog/host-catalog-selection' +import { loadHostCatalog } from '../host-catalog/host-store' +import type { HostProfile } from '../host-catalog/host-profile' // Keep picker and loading drawer in the overlay’s window so the load can start as selection leaves. export function NewWorkspaceHostPicker({ diff --git a/mobile/src/notifications/mobile-notifications.ts b/mobile/src/notifications/mobile-notifications.ts index a8bee3af321..1200887b82b 100644 --- a/mobile/src/notifications/mobile-notifications.ts +++ b/mobile/src/notifications/mobile-notifications.ts @@ -4,7 +4,7 @@ import type { DismissNotificationEvent } from './desktop-notification-events' import type { RpcClient } from '../transport/rpc/rpc-client-contract' import { waitForPushFallback } from './push-fallback' import { getHostPushSupported, getHostPushSupportCompletion } from './push-registration' -import { loadHostCatalog } from '../transport/hosts/host-store' +import { loadHostCatalog } from '../host-catalog/host-store' import { deriveHostFingerprint } from './push-host-fingerprint' import { presentForegroundPush } from './android-foreground-push' import { diff --git a/mobile/src/notifications/notification-routing.ts b/mobile/src/notifications/notification-routing.ts index 51a81548b0a..a083798e327 100644 --- a/mobile/src/notifications/notification-routing.ts +++ b/mobile/src/notifications/notification-routing.ts @@ -1,7 +1,7 @@ import { parseExecutionHostId } from '../../../src/shared/execution-host' import type { HostStackRouteTarget } from '../navigation/host-stack-navigation' import { mobileSessionRouteTarget } from '../session/mobile-session-route' -import type { HostCredentialStatus } from '../transport/hosts/host-profile' +import type { HostCredentialStatus } from '../host-catalog/host-profile' export type NotificationNavigationOptions = { knownHostIds?: ReadonlySet diff --git a/mobile/src/notifications/push-dismissal-reconciliation.ts b/mobile/src/notifications/push-dismissal-reconciliation.ts index 6f5c0a5457a..5a77d259d17 100644 --- a/mobile/src/notifications/push-dismissal-reconciliation.ts +++ b/mobile/src/notifications/push-dismissal-reconciliation.ts @@ -1,6 +1,6 @@ import * as Notifications from 'expo-notifications' import { pushMissedSinceRead, type MobilePushDismissalRpcSender } from './push-dismissal-operations' -import { loadHostCatalog } from '../transport/hosts/host-store' +import { loadHostCatalog } from '../host-catalog/host-store' import { resolveHostIdForFingerprint } from './push-host-fingerprint' import { readNativeNotificationData } from './native-notification-data' import { readOrcaPushPayload, type OrcaPushPayload } from './push-payload' diff --git a/mobile/src/notifications/push-receive.test.ts b/mobile/src/notifications/push-receive.test.ts index 9c1b8832c9c..e7d93268bb5 100644 --- a/mobile/src/notifications/push-receive.test.ts +++ b/mobile/src/notifications/push-receive.test.ts @@ -4,8 +4,8 @@ import { setNotificationViewingWorkspace } from './notification-viewing-policy' vi.mock('./push-tray-dismissal', () => ({ dismissPresentedPushNotification: vi.fn() })) import { beforeEach, describe, expect, it, vi } from 'vitest' import { sha256 } from '@noble/hashes/sha256' -import { loadHostCatalog } from '../transport/hosts/host-store' -import type { HostCatalogEntry } from '../transport/hosts/host-profile' +import { loadHostCatalog } from '../host-catalog/host-store' +import type { HostCatalogEntry } from '../host-catalog/host-profile' import { foregroundNotificationBehavior, @@ -19,7 +19,7 @@ async function shouldSuppressForegroundPush(data: unknown): Promise { } vi.mock('react-native', () => ({ AppState: { currentState: 'background' } })) -vi.mock('../transport/hosts/host-store', () => ({ loadHostCatalog: vi.fn() })) +vi.mock('../host-catalog/host-store', () => ({ loadHostCatalog: vi.fn() })) const storage = vi.hoisted(() => new Map()) vi.mock('@react-native-async-storage/async-storage', () => ({ default: { diff --git a/mobile/src/notifications/push-receive.ts b/mobile/src/notifications/push-receive.ts index 44a64e05e09..15d07022d14 100644 --- a/mobile/src/notifications/push-receive.ts +++ b/mobile/src/notifications/push-receive.ts @@ -2,7 +2,7 @@ import { wasPushDismissed } from './push-dismissal-watermarks' import { dismissPresentedPushNotification } from './push-tray-dismissal' import { shouldSuppressNotificationWhileViewing } from './notification-viewing-policy' import { loadPushNotificationsEnabled } from '../storage/preferences' -import { loadHostCatalog } from '../transport/hosts/host-store' +import { loadHostCatalog } from '../host-catalog/host-store' import { resolveHostIdForFingerprint } from './push-host-fingerprint' import { readOrcaPushPayload, type OrcaPushPayload } from './push-payload' import type { NotificationBehavior } from 'expo-notifications' diff --git a/mobile/src/notifications/push-socket-dismissal.ts b/mobile/src/notifications/push-socket-dismissal.ts index 16a3b560db2..84f548684b8 100644 --- a/mobile/src/notifications/push-socket-dismissal.ts +++ b/mobile/src/notifications/push-socket-dismissal.ts @@ -1,4 +1,4 @@ -import { loadHostCatalog } from '../transport/hosts/host-store' +import { loadHostCatalog } from '../host-catalog/host-store' import { deriveHostFingerprint } from './push-host-fingerprint' import { dismissPresentedPushNotification } from './push-tray-dismissal' import type { DismissNotificationEvent } from './desktop-notification-events' diff --git a/mobile/src/notifications/use-remote-push-capable-hosts.ts b/mobile/src/notifications/use-remote-push-capable-hosts.ts index db86e9d08b2..f7ff991cff1 100644 --- a/mobile/src/notifications/use-remote-push-capable-hosts.ts +++ b/mobile/src/notifications/use-remote-push-capable-hosts.ts @@ -1,5 +1,5 @@ import { useEffect, useRef, useState } from 'react' -import { loadHostCatalog } from '../transport/hosts/host-store' +import { loadHostCatalog } from '../host-catalog/host-store' import type { RpcClient } from '../transport/rpc/rpc-client-contract' import { startRuntimeCapabilityProbe } from '../transport/connection/runtime-capability-probe' import { useAllHostClients } from '../transport/connection/use-all-host-clients' diff --git a/mobile/src/pairing/mobile-relay-pairing-journal-store.ts b/mobile/src/pairing/mobile-relay-pairing-journal-store.ts index bc885969b67..cbd96e1289c 100644 --- a/mobile/src/pairing/mobile-relay-pairing-journal-store.ts +++ b/mobile/src/pairing/mobile-relay-pairing-journal-store.ts @@ -11,7 +11,7 @@ import { readPairingKeychainItem, resetPairingKeychainForTests, writePairingKeychainItem -} from '../transport/hosts/pairing-keychain' +} from '../host-credentials/pairing-keychain' const JOURNAL_STORAGE_KEY = 'orca:mobile-relay:pairing-journal:v1' const JOURNAL_SECRET_KEY = 'orca.mobile-relay.pairing-journal.v1' diff --git a/mobile/src/pairing/mobile-relay-pairing-recovery.test.ts b/mobile/src/pairing/mobile-relay-pairing-recovery.test.ts index 648a53fd90b..7ad28633fff 100644 --- a/mobile/src/pairing/mobile-relay-pairing-recovery.test.ts +++ b/mobile/src/pairing/mobile-relay-pairing-recovery.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { MobileRelayCredentialBundle } from '../transport/hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../host-credentials/mobile-relay-credential-bundle' import { createMobileRelayPairingJournal } from './mobile-relay-pairing-journal' import { recoverMobileRelayPairing, @@ -10,7 +10,7 @@ import type { connectMobileRelayForPairing, PairingCandidateClient } from './mobile-relay-physical-client' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { RpcResponse } from '../transport/rpc/rpc-wire-types' import type { PairingOffer } from '../../../src/shared/remote-runtime/pairing/mobile-relay-pairing-offer' diff --git a/mobile/src/pairing/mobile-relay-pairing-recovery.ts b/mobile/src/pairing/mobile-relay-pairing-recovery.ts index 03fc772c3c0..e375bab0604 100644 --- a/mobile/src/pairing/mobile-relay-pairing-recovery.ts +++ b/mobile/src/pairing/mobile-relay-pairing-recovery.ts @@ -4,13 +4,13 @@ import type { PairingGetEndpointsResult } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import type { PairingRelay } from '../../../src/shared/remote-runtime/pairing/mobile-relay-pairing-offer' -import { loadHosts, savePairedHost } from '../transport/hosts/host-store' +import { loadHosts, savePairedHost } from '../host-catalog/host-store' import { promotePairingJournalCredential, readMobileRelayCredentialBundle, writeMobileRelayCredentialBundle, type MobileRelayCredentialBundle -} from '../transport/hosts/mobile-relay-credential-bundle' +} from '../host-credentials/mobile-relay-credential-bundle' import { resolvePairingInviteThroughDirector } from './mobile-relay-invite-director' import type { MobileRelayPairingJournal } from './mobile-relay-pairing-journal' import { diff --git a/mobile/src/pairing/pairing-relay-host.ts b/mobile/src/pairing/pairing-relay-host.ts index ff50da77e7f..a6cd7017273 100644 --- a/mobile/src/pairing/pairing-relay-host.ts +++ b/mobile/src/pairing/pairing-relay-host.ts @@ -3,7 +3,7 @@ import type { MobileRelayEndpoint } from '../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import type { MobileRelayPairingJournal } from './mobile-relay-pairing-journal' -import type { HostProfile } from '../transport/hosts/host-profile' +import type { HostProfile } from '../host-catalog/host-profile' import type { PairingOffer } from '../../../src/shared/remote-runtime/pairing/mobile-relay-pairing-offer' export function directHost( diff --git a/mobile/src/pairing/pairing.ts b/mobile/src/pairing/pairing.ts index d4641651478..4f3379efe29 100644 --- a/mobile/src/pairing/pairing.ts +++ b/mobile/src/pairing/pairing.ts @@ -1,4 +1,4 @@ -import '../transport/hosts/host-profile' +import '../host-catalog/host-profile' import { PairingOfferSchema, type PairingOffer diff --git a/mobile/src/pairing/pre-profile-pairing-coordinator.ts b/mobile/src/pairing/pre-profile-pairing-coordinator.ts index f7f8f426ad7..e88d92b7e04 100644 --- a/mobile/src/pairing/pre-profile-pairing-coordinator.ts +++ b/mobile/src/pairing/pre-profile-pairing-coordinator.ts @@ -1,6 +1,6 @@ import { Platform } from 'react-native' import { connect, type ConnectOptions } from '../transport/rpc/direct-rpc-connect' -import { resolvePairingHostIdentity, savePairedHost } from '../transport/hosts/host-store' +import { resolvePairingHostIdentity, savePairedHost } from '../host-catalog/host-store' import type { PairingOffer } from '../../../src/shared/remote-runtime/pairing/mobile-relay-pairing-offer' import { isPairingRelayRpcUnavailable } from './pairing-relay-rpc-unavailable' import { @@ -21,7 +21,7 @@ import { settleMobileRelayPairingRecovery } from './mobile-relay-pairing-recover import { promotePairingJournalCredential, writeMobileRelayCredentialBundle -} from '../transport/hosts/mobile-relay-credential-bundle' +} from '../host-credentials/mobile-relay-credential-bundle' import { connectMobileRelayForPairing, type PairingCandidateClient @@ -33,7 +33,7 @@ import { createRecoveringPairingRelayCandidate } from './pairing-relay-candidate import { createPairingRelayLogger } from '../diagnostics/connection/pairing-relay-log' import { redactSocketEndpoint } from '../diagnostics/connection/socket-event-debug' import { assertCommittedInstall, directHost, relayHost } from './pairing-relay-host' -import { recordHostDescriptorFromStatus } from '../transport/hosts/host-descriptor-recorder' +import { recordHostDescriptorFromStatus } from '../host-descriptors/host-descriptor-recorder' import { adoptExchangedToken, exchangePairingTicket } from './pairing-ticket-exchange' import type { HostStatusReply } from '../transport/hosts/host-status-reply-schema' diff --git a/mobile/src/pairing/unpaired-host-credential-deletion.ts b/mobile/src/pairing/unpaired-host-credential-deletion.ts index a7e056764bd..1df85f8f740 100644 --- a/mobile/src/pairing/unpaired-host-credential-deletion.ts +++ b/mobile/src/pairing/unpaired-host-credential-deletion.ts @@ -1,9 +1,9 @@ -import { deleteHostDeviceToken } from '../transport/hosts/host-device-token-store' +import { deleteHostDeviceToken } from '../host-credentials/host-device-token-store' import { clearHostCredentialWriteRevision, getHostCredentialWriteRevision -} from '../transport/hosts/host-credential-write-revision' -import { deleteMobileRelayCredentialBundle } from '../transport/hosts/mobile-relay-credential-bundle' +} from '../host-credentials/host-credential-write-revision' +import { deleteMobileRelayCredentialBundle } from '../host-credentials/mobile-relay-credential-bundle' import { deleteMobileRelayDirectUpgradeJournal } from '../transport/relay/mobile-relay-direct-upgrade-journal' type DeletionDependencies = { diff --git a/mobile/src/session/MobileSessionActiveContent.tsx b/mobile/src/session/MobileSessionActiveContent.tsx index 06861569071..0400353b3ca 100644 --- a/mobile/src/session/MobileSessionActiveContent.tsx +++ b/mobile/src/session/MobileSessionActiveContent.tsx @@ -25,8 +25,8 @@ import { useMobileSessionContentKeyboardLift } from '../terminal/session/use-mob import { useOpenUrlInOrca } from '../browser/use-open-url-in-orca' import { useWorkspaceExecutionHost } from '../navigation/workspace-execution-host' import { useOpenHostAccounts } from '../accounts/use-open-mobile-accounts' -import { useHostProfile } from '../transport/hosts/use-host-profile' -import { useHostDisplay } from '../transport/hosts/use-host-display' +import { useHostProfile } from '../host-catalog/use-host-profile' +import { useHostDisplay } from '../host-descriptors/use-host-display' import { FileReader } from '../files/session-documents/MobileSessionFileReader' import { MobileSessionContentState } from './MobileSessionContentState' import { MarkdownReader } from '../files/session-documents/MobileSessionMarkdownReader' diff --git a/mobile/src/session/mobile-dictation-session-outcomes.test.tsx b/mobile/src/session/mobile-dictation-session-outcomes.test.tsx index 98ea1ae6c0b..46d24d9a1d9 100644 --- a/mobile/src/session/mobile-dictation-session-outcomes.test.tsx +++ b/mobile/src/session/mobile-dictation-session-outcomes.test.tsx @@ -14,8 +14,6 @@ const seen = vi.hoisted(() => { return { toasts: new Array(), errorHaptics: 0, - setupSheetOpens: 0, - micPermissionRequests: 0, clipboard: new Array(), inputs: new Array(), chat, @@ -30,7 +28,7 @@ vi.mock('react-native', () => ({ Platform: { OS: 'ios' } })) // The computer's name only words announcements; the stored host profile pulls in secure storage. -vi.mock('../transport/hosts/use-host-profile', () => ({ useHostProfile: () => null })) +vi.mock('../host-catalog/use-host-profile', () => ({ useHostProfile: () => null })) vi.mock('@orca/expo-two-way-audio', () => ({ addExpoTwoWayAudioEventListener: (name: string, listener: (event: { data: string }) => void) => { seen.audioListeners.set(name, listener) @@ -38,7 +36,6 @@ vi.mock('@orca/expo-two-way-audio', () => ({ }, initialize: () => Promise.resolve(true), requestMicrophonePermissionsAsync: () => { - seen.micPermissionRequests += 1 return Promise.resolve({ granted: true }) }, tearDown: () => {}, @@ -159,11 +156,7 @@ function mount( activeSessionTab: { id: 'tab1', type: 'terminal', terminal: 't1', title: 'Claude Code' }, diffComments: [], diffCommentsRef: useRef([]), - setShowDictationSetup: (next: boolean) => { - if (next) { - seen.setupSheetOpens += 1 - } - }, + setShowDictationSetup: () => {}, setDictationMode: () => {}, dictationEnabled: true, setDictationEnabled: () => {}, @@ -259,8 +252,6 @@ async function startRecording( beforeEach(() => { seen.toasts.length = 0 seen.errorHaptics = 0 - seen.setupSheetOpens = 0 - seen.micPermissionRequests = 0 seen.clipboard.length = 0 seen.inputs.length = 0 seen.chat = { shown: false, scope: null } @@ -268,35 +259,6 @@ beforeEach(() => { seen.audioListeners.clear() }) -describe('a mic tap after the host reported dictation is not set up', () => { - it('opens setup without asking for the microphone, then lets the host judge the tap after the sheet closes', async () => { - const rpc = createFakeRpcClient() - const mounted = mount(rpc) - await act(async () => { - const read = mounted.current().refreshDictationMode() - for (const request of rpc.requests.splice(0)) { - request.resolve({ - id: 'desktop', - ok: true, - result: { enabled: false, selectedModelId: '', dictationMode: 'toggle', models: [] } - }) - } - await read - }) - act(() => mounted.current().handleDictationToggle()) - expect(seen.setupSheetOpens).toBe(1) - expect(seen.micPermissionRequests).toBe(0) - expect(rpc.requests).toEqual([]) - - // Closing the sheet hands the next tap to the host until a fresh read lands. - act(() => mounted.current().closeDictationSetup()) - act(() => mounted.current().handleDictationToggle()) - await settle(rpc, '') - expect(seen.setupSheetOpens).toBe(1) - expect(seen.micPermissionRequests).toBe(1) - }) -}) - describe('a mic tap while the transcript is processing', () => { it('keeps the transcript that comes back', async () => { const rpc = createFakeRpcClient() diff --git a/mobile/src/session/use-mobile-session-lifecycle.ts b/mobile/src/session/use-mobile-session-lifecycle.ts index 30dd15eb573..0db31f4d6b9 100644 --- a/mobile/src/session/use-mobile-session-lifecycle.ts +++ b/mobile/src/session/use-mobile-session-lifecycle.ts @@ -4,7 +4,7 @@ import { settleSessionPreferenceRead } from './session-preference-read' import { useEffect, useRef, useCallback, useState } from 'react' import { AppState, type AppStateStatus, Platform } from 'react-native' import { useFocusEffect } from 'expo-router' -import { loadHosts } from '../transport/hosts/host-store' +import { loadHosts } from '../host-catalog/host-store' import { loadTerminalAccessoryLayout, saveTerminalSmartRail diff --git a/mobile/src/settings/notification-display-test.tsx b/mobile/src/settings/notification-display-test.tsx index 51280f27047..ecb737e0e5c 100644 --- a/mobile/src/settings/notification-display-test.tsx +++ b/mobile/src/settings/notification-display-test.tsx @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react' import { ListRow } from '../components/list/ListGroup' import { useAllHostClients } from '../transport/connection/use-all-host-clients' -import { loadHostCatalog } from '../transport/hosts/host-store' +import { loadHostCatalog } from '../host-catalog/host-store' import { pushDeliveryTest } from '../notifications/mobile-push-delivery-test-operations' import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { useMobileTranslation } from '../i18n/use-mobile-translation' diff --git a/mobile/src/settings/pending-credential-cleanup-card.tsx b/mobile/src/settings/pending-credential-cleanup-card.tsx index af0a91ce081..0ef2d84df8e 100644 --- a/mobile/src/settings/pending-credential-cleanup-card.tsx +++ b/mobile/src/settings/pending-credential-cleanup-card.tsx @@ -9,8 +9,8 @@ import { useMobileColorScheme } from '../theme/use-mobile-color-scheme' import { loadPendingHostCredentialCleanup, subscribePendingHostCredentialCleanup -} from '../transport/hosts/host-credential-cleanup' -import { retryPendingHostCredentialCleanup } from '../transport/hosts/host-store' +} from '../host-credentials/host-credential-cleanup' +import { retryPendingHostCredentialCleanup } from '../host-catalog/host-store' import { useMobileTranslation } from '../i18n/use-mobile-translation' import { SettingsSection } from './settings-screen-frame' diff --git a/mobile/src/tasks/mobile-tasks-host-subtitle.tsx b/mobile/src/tasks/mobile-tasks-host-subtitle.tsx index e6cf9004e64..07d2a20cc03 100644 --- a/mobile/src/tasks/mobile-tasks-host-subtitle.tsx +++ b/mobile/src/tasks/mobile-tasks-host-subtitle.tsx @@ -1,7 +1,7 @@ import { StyleSheet, Text } from 'react-native' import { hostScreenStyles } from '../host-screen/host-screen-styles' -import { useHostProfile } from '../transport/hosts/use-host-profile' -import { useHostDisplay } from '../transport/hosts/use-host-display' +import { useHostProfile } from '../host-catalog/use-host-profile' +import { useHostDisplay } from '../host-descriptors/use-host-display' import { useMobileColorScheme } from './mobile-tasks-dependencies' export function MobileTasksHostSubtitle({ hostId }: { hostId: string }) { diff --git a/mobile/src/tasks/mobile-tasks-list-state.tsx b/mobile/src/tasks/mobile-tasks-list-state.tsx index b190e73ba31..35879dcb433 100644 --- a/mobile/src/tasks/mobile-tasks-list-state.tsx +++ b/mobile/src/tasks/mobile-tasks-list-state.tsx @@ -9,8 +9,8 @@ import { } from '../components/MobileStateView' import { useForceReconnect } from '../transport/connection/host-client-hooks' import { isConnectionOutage } from '../transport/connection/connection-health' -import { useHostDisplay } from '../transport/hosts/use-host-display' -import { useHostProfile } from '../transport/hosts/use-host-profile' +import { useHostDisplay } from '../host-descriptors/use-host-display' +import { useHostProfile } from '../host-catalog/use-host-profile' import { spacing } from '../theme/mobile-theme' import { translate } from '../i18n/mobile-i18n' import type { ConnectionPresentationModel } from './use-mobile-tasks-connection-presentation' diff --git a/mobile/src/tasks/use-task-host-repos.ts b/mobile/src/tasks/use-task-host-repos.ts index 2fa9010fd1a..e91ef7df7d3 100644 --- a/mobile/src/tasks/use-task-host-repos.ts +++ b/mobile/src/tasks/use-task-host-repos.ts @@ -1,7 +1,7 @@ import { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react' import type { ExecutionHostId } from '../../../src/shared/execution-host' import type { HostContextLabelSources } from '../../../src/shared/worktree/host-context-labels' -import { useHostDescriptor } from '../transport/hosts/host-descriptor-store' +import { useHostDescriptor } from '../host-descriptors/host-descriptor-store' import type { RpcClient } from '../transport/rpc/rpc-client-contract' import type { ConnectionState } from '../transport/connection/connection-state' import { withServerHosts } from '../worktree/server-workspaces' diff --git a/mobile/src/terminal/session/MobileTerminalRenameModal.tsx b/mobile/src/terminal/session/MobileTerminalRenameModal.tsx index ec26c4d9d95..50408efcc77 100644 --- a/mobile/src/terminal/session/MobileTerminalRenameModal.tsx +++ b/mobile/src/terminal/session/MobileTerminalRenameModal.tsx @@ -2,8 +2,8 @@ import { BottomDrawer } from '../../components/bottom-drawer/BottomDrawer' import { TextInputSheetContent } from '../../components/TextInputModal' import { useDraftRenameSheet } from '../../components/use-draft-rename-sheet' import { useMobileTranslation } from '../../i18n/use-mobile-translation' -import { useHostDisplay } from '../../transport/hosts/use-host-display' -import { useHostProfile } from '../../transport/hosts/use-host-profile' +import { useHostDisplay } from '../../host-descriptors/use-host-display' +import { useHostProfile } from '../../host-catalog/use-host-profile' import type { MobileSessionController } from '../../session/use-mobile-session-controller' export function MobileTerminalRenameModal({ diff --git a/mobile/src/test-support/rpc-recording/relay-pairing-fixtures.ts b/mobile/src/test-support/rpc-recording/relay-pairing-fixtures.ts index 9217c4ce6bd..9938506c06b 100644 --- a/mobile/src/test-support/rpc-recording/relay-pairing-fixtures.ts +++ b/mobile/src/test-support/rpc-recording/relay-pairing-fixtures.ts @@ -1,5 +1,5 @@ import type * as MobileRelayCredentialHashModule from '../../transport/relay/mobile-relay-credential-hash' -import type { MobileRelayCredentialBundle } from '../../transport/hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import type { MobileRelayPairingJournal } from '../../pairing/mobile-relay-pairing-journal' import type { MountContext } from './recording-scenario' import type { operationModuleLoader } from './operation-module-loader' diff --git a/mobile/src/transport/connection/client-context.test.ts b/mobile/src/transport/connection/client-context.test.ts index 8688ab11863..4d0097b6f53 100644 --- a/mobile/src/transport/connection/client-context.test.ts +++ b/mobile/src/transport/connection/client-context.test.ts @@ -23,7 +23,7 @@ vi.mock('./runtime-status-probe', () => ({ startRuntimeStatusProbe: (client: unknown, onStatus: (status: unknown) => void) => descriptorProbe.start(client, onStatus) })) -vi.mock('../hosts/host-descriptor-recorder', () => ({ +vi.mock('../../host-descriptors/host-descriptor-recorder', () => ({ recordHostDescriptorFromStatus: (...args: unknown[]) => descriptorProbe.record(...args) })) @@ -36,7 +36,7 @@ vi.mock('../rpc/direct-rpc-connect', () => ({ vi.mock('./host-logical-client', () => ({ openHostLogicalClient: (...args: unknown[]) => connectMock(...args) })) -vi.mock('../hosts/host-store', () => ({ +vi.mock('../../host-catalog/host-store', () => ({ loadHosts: () => loadHostsMock() })) vi.mock('../../diagnostics/connection/connection-revival-triggers', () => ({ diff --git a/mobile/src/transport/connection/client-context.tsx b/mobile/src/transport/connection/client-context.tsx index 5bb222dd2e9..f368d8136fd 100644 --- a/mobile/src/transport/connection/client-context.tsx +++ b/mobile/src/transport/connection/client-context.tsx @@ -36,7 +36,7 @@ import { type CloseEntryOptions } from './host-client-context-state' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import type { RpcClientContextValue } from './rpc-client-context-contract' type StoreEntry = HostClientStoreEntry diff --git a/mobile/src/transport/connection/client-context.web.tsx b/mobile/src/transport/connection/client-context.web.tsx index 547f5c2ee06..b93af825038 100644 --- a/mobile/src/transport/connection/client-context.web.tsx +++ b/mobile/src/transport/connection/client-context.web.tsx @@ -3,7 +3,7 @@ import { createContext, useContext, useMemo, useRef, type ReactNode } from 'reac import type { BridgeRpcClient } from '../../mobile-web-shell/bridge/bridge-rpc-client' import { BRIDGE_PAGE_CLIENT_ID } from '../../mobile-web-shell/bridge/bridge-page-client-identity' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import type { RpcClientContextValue } from './rpc-client-context-contract' const Ctx = createContext(null) diff --git a/mobile/src/transport/connection/host-client-context-state.ts b/mobile/src/transport/connection/host-client-context-state.ts index 11732d99f66..879090e7569 100644 --- a/mobile/src/transport/connection/host-client-context-state.ts +++ b/mobile/src/transport/connection/host-client-context-state.ts @@ -4,7 +4,7 @@ import type { HostClientStoreEntry } from './host-entry-opener' import type { RelayHostReachability } from '../relay/relay-host-reachability' import type { MobileConnectionPath, StableLogicalRpcClient } from './stable-logical-rpc-client' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' export type CloseEntryOptions = { forgetPrimedHost: boolean diff --git a/mobile/src/transport/connection/host-client-hooks.ts b/mobile/src/transport/connection/host-client-hooks.ts index 97822e2f823..77bf0d169b1 100644 --- a/mobile/src/transport/connection/host-client-hooks.ts +++ b/mobile/src/transport/connection/host-client-hooks.ts @@ -1,7 +1,7 @@ import { useEffect, useRef, useState } from 'react' import type { RpcClient } from '../rpc/rpc-client-contract' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import type { HostClientAcquisition } from './host-client-acquisition-registry' import type { ForceReconnect } from './rpc-client-context-contract' import { useRpcClientContext } from './client-context' diff --git a/mobile/src/transport/connection/host-entry-opener.ts b/mobile/src/transport/connection/host-entry-opener.ts index 32f15c23b7b..45ef9d3abad 100644 --- a/mobile/src/transport/connection/host-entry-opener.ts +++ b/mobile/src/transport/connection/host-entry-opener.ts @@ -1,18 +1,18 @@ import { attachPushRegistration } from '../../notifications/push-registration' -import { recordHostDescriptorFromStatus } from '../hosts/host-descriptor-recorder' +import { recordHostDescriptorFromStatus } from '../../host-descriptors/host-descriptor-recorder' import { startRuntimeStatusProbe } from './runtime-status-probe' import { connectionLogStore, recordConnectionClientSessionStart } from '../../diagnostics/connection/persisted-connection-log-store' -import { loadHosts } from '../hosts/host-store' +import { loadHosts } from '../../host-catalog/host-store' import { openHostLogicalClient } from './host-logical-client' import type { HostClientOpenRegistry } from './host-client-open-registry' import type { HostOpenRetryScheduler } from './host-open-retry-scheduler' import type { RpcClient } from '../rpc/rpc-client-contract' import type { StableLogicalRpcClient } from './stable-logical-rpc-client' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' export type HostClientStoreEntry = { client: RpcClient diff --git a/mobile/src/transport/connection/host-logical-client.ts b/mobile/src/transport/connection/host-logical-client.ts index 0474f2f4bc2..33c04a48610 100644 --- a/mobile/src/transport/connection/host-logical-client.ts +++ b/mobile/src/transport/connection/host-logical-client.ts @@ -4,7 +4,7 @@ import { connect } from '../rpc/direct-rpc-connect' import type { RpcClient } from '../rpc/rpc-client-contract' import { createStableLogicalRpcClient } from './stable-logical-rpc-client' import type { ConnectionLogSink } from '../../diagnostics/connection/connection-log-types' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import { directPathForEndpoint } from '../relay/mobile-direct-endpoint-probe' import { startMobileEndpointLifecycle } from './mobile-endpoint-lifecycle' import { watchHostRevocation } from './host-revocation-watch' diff --git a/mobile/src/transport/connection/host-status-gates.test.ts b/mobile/src/transport/connection/host-status-gates.test.ts index 270066f69de..ca1182cafaf 100644 --- a/mobile/src/transport/connection/host-status-gates.test.ts +++ b/mobile/src/transport/connection/host-status-gates.test.ts @@ -6,13 +6,13 @@ import { useHostStatusGates, type HostStatusGates } from './host-status-gates' const recordHostAppVersionMock = vi.hoisted(() => vi.fn().mockResolvedValue(undefined)) -vi.mock('../hosts/host-app-version-store', () => ({ +vi.mock('../../host-descriptors/host-app-version-store', () => ({ recordHostAppVersion: (...args: unknown[]) => recordHostAppVersionMock(...args) })) const recordDescriptorFromStatusMock = vi.hoisted(() => vi.fn()) -vi.mock('../hosts/host-descriptor-recorder', () => ({ +vi.mock('../../host-descriptors/host-descriptor-recorder', () => ({ recordHostDescriptorFromStatus: (...args: unknown[]) => recordDescriptorFromStatusMock(...args) })) diff --git a/mobile/src/transport/connection/host-status-gates.ts b/mobile/src/transport/connection/host-status-gates.ts index efb53eb46d9..053fe99c095 100644 --- a/mobile/src/transport/connection/host-status-gates.ts +++ b/mobile/src/transport/connection/host-status-gates.ts @@ -3,9 +3,9 @@ import type { RpcClient } from '../rpc/rpc-client-contract' import type { ConnectionState } from './connection-state' import { evaluateCompat, type CompatVerdict } from './protocol-compat' import { hostStatusSchema, type HostStatusReply } from '../hosts/host-status-reply-schema' -import { normalizeHostAppVersion } from '../hosts/host-app-version' -import { recordHostAppVersion } from '../hosts/host-app-version-store' -import { recordHostDescriptorFromStatus } from '../hosts/host-descriptor-recorder' +import { normalizeHostAppVersion } from '../../host-descriptors/host-app-version' +import { recordHostAppVersion } from '../../host-descriptors/host-app-version-store' +import { recordHostDescriptorFromStatus } from '../../host-descriptors/host-descriptor-recorder' import { readConnectionStatusProbe, startRuntimeStatusProbe } from './runtime-status-probe' export type HostStatusGates = { diff --git a/mobile/src/transport/connection/mobile-endpoint-lifecycle.ts b/mobile/src/transport/connection/mobile-endpoint-lifecycle.ts index b635b808ec5..d1e0db84585 100644 --- a/mobile/src/transport/connection/mobile-endpoint-lifecycle.ts +++ b/mobile/src/transport/connection/mobile-endpoint-lifecycle.ts @@ -1,7 +1,7 @@ import * as ExpoCrypto from 'expo-crypto' import type { ConnectionLogSink } from '../../diagnostics/connection/connection-log-types' import type { ForegroundNudgeReason } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import { connect } from '../rpc/direct-rpc-connect' import { MobileEndpointSupervisor } from './mobile-endpoint-supervisor' @@ -10,8 +10,8 @@ import { resolveMobileRelayEndpoint } from '../relay/mobile-relay-resume-directo import { readMobileRelayCredentialBundle, writeMobileRelayCredentialBundle -} from '../hosts/mobile-relay-credential-bundle' -import { setRelayRouting } from '../hosts/host-store' +} from '../../host-credentials/mobile-relay-credential-bundle' +import { setRelayRouting } from '../../host-catalog/host-store' import { lastGoodPathWasDirectHere, readLocalNetworkFingerprint, diff --git a/mobile/src/transport/connection/mobile-endpoint-supervisor-contract.ts b/mobile/src/transport/connection/mobile-endpoint-supervisor-contract.ts index 36b984aa29b..ea3b258b000 100644 --- a/mobile/src/transport/connection/mobile-endpoint-supervisor-contract.ts +++ b/mobile/src/transport/connection/mobile-endpoint-supervisor-contract.ts @@ -1,7 +1,7 @@ import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' import type { RelayHostCloseReason } from '../../../../src/shared/relay-host-close-reason' import type { HostGoodPath } from './host-path-memory' -import type { MobileRelayCredentialBundle } from '../hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import type { MobileRelayRpcSession } from '../relay/mobile-relay-rpc-session-contract' import type { resolveMobileRelayEndpoint } from '../relay/mobile-relay-resume-director' import type { RpcClient } from '../rpc/rpc-client-contract' diff --git a/mobile/src/transport/connection/mobile-endpoint-supervisor-test-fakes.ts b/mobile/src/transport/connection/mobile-endpoint-supervisor-test-fakes.ts index 8ba5f3bb97d..2a36822bb9a 100644 --- a/mobile/src/transport/connection/mobile-endpoint-supervisor-test-fakes.ts +++ b/mobile/src/transport/connection/mobile-endpoint-supervisor-test-fakes.ts @@ -1,5 +1,5 @@ import { vi } from 'vitest' -import type { MobileRelayCredentialBundle } from '../hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import type { MobileRelayRpcSession } from '../relay/mobile-relay-rpc-session-contract' import { RelayDialStageTracker, type RelayDialStage } from '../relay/relay-dial-stage' import { defaultCancelTimer, defaultScheduleTimer } from '../../platform/timer-scheduler' @@ -9,7 +9,7 @@ import type { SendRequestOptions } from '../rpc/unvalidated-rpc-request-port' import type { RelayHostReachability } from '../relay/relay-host-reachability' import type { MobileConnectionPath, StableLogicalRpcClient } from './stable-logical-rpc-client' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import type { RpcResponse } from '../rpc/rpc-wire-types' export class FakeSession implements RpcClient { diff --git a/mobile/src/transport/connection/mobile-endpoint-supervisor.ts b/mobile/src/transport/connection/mobile-endpoint-supervisor.ts index afaaf820b14..9df18632cd9 100644 --- a/mobile/src/transport/connection/mobile-endpoint-supervisor.ts +++ b/mobile/src/transport/connection/mobile-endpoint-supervisor.ts @@ -13,7 +13,7 @@ import { mobileRelayCredentialNeedsRotation, rotateMobileRelayCredential } from '../relay/mobile-relay-credential-rotation' -import type { MobileRelayCredentialBundle } from '../hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import { MobileEndpointNudgeRouter } from './mobile-endpoint-nudge-router' import { MobileRelayDirectGraceTimer } from '../relay/mobile-relay-direct-grace-timer' import { MobileRelaySessionEstablisher } from '../relay/mobile-relay-session-establisher' diff --git a/mobile/src/transport/connection/rpc-client-context-contract.ts b/mobile/src/transport/connection/rpc-client-context-contract.ts index 0db36f943e7..5675916e30b 100644 --- a/mobile/src/transport/connection/rpc-client-context-contract.ts +++ b/mobile/src/transport/connection/rpc-client-context-contract.ts @@ -3,7 +3,7 @@ import type { RpcClient } from '../rpc/rpc-client-contract' import type { RelayHostReachability } from '../relay/relay-host-reachability' import type { MobileConnectionPath } from './stable-logical-rpc-client' import type { ConnectionState } from './connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' /** Re-dials one host. `null` where this document cannot dial: the page's shell owns the connection. */ export type ForceReconnect = ((hostId: string) => Promise) | null diff --git a/mobile/src/transport/hosts/home-host-auto-connect.ts b/mobile/src/transport/hosts/home-host-auto-connect.ts index 08e69879865..53a67400cd8 100644 --- a/mobile/src/transport/hosts/home-host-auto-connect.ts +++ b/mobile/src/transport/hosts/home-host-auto-connect.ts @@ -1,5 +1,5 @@ import type { ConnectionState } from '../connection/connection-state' -import type { HostProfile } from './host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' export const HOME_AUTO_CONNECT_LIMIT = 3 diff --git a/mobile/src/transport/hosts/host-open-recovery.test.tsx b/mobile/src/transport/hosts/host-open-recovery.test.tsx index 782f2c348f9..9ff6210e629 100644 --- a/mobile/src/transport/hosts/host-open-recovery.test.tsx +++ b/mobile/src/transport/hosts/host-open-recovery.test.tsx @@ -20,7 +20,7 @@ vi.mock('../connection/runtime-status-probe', () => ({ vi.mock('../connection/host-logical-client', () => ({ openHostLogicalClient: (...args: unknown[]) => openHostLogicalClientMock(...args) })) -vi.mock('./host-store', () => ({ +vi.mock('../../host-catalog/host-store', () => ({ loadHosts: () => loadHostsMock() })) vi.mock('../../diagnostics/connection/connection-revival-triggers', () => ({ diff --git a/mobile/src/transport/hosts/pairing-keychain.test.ts b/mobile/src/transport/hosts/pairing-keychain.test.ts deleted file mode 100644 index 1bc92703683..00000000000 --- a/mobile/src/transport/hosts/pairing-keychain.test.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' - -const asyncStorageMock = vi.hoisted(() => ({ - getItem: vi.fn(), - setItem: vi.fn(), - removeItem: vi.fn() -})) - -const secureStoreMock = vi.hoisted(() => ({ - deleteItemAsync: vi.fn(), - getItemAsync: vi.fn(), - setItemAsync: vi.fn() -})) -const platformMock = vi.hoisted(() => ({ OS: 'android' })) - -vi.mock('@react-native-async-storage/async-storage', () => ({ default: asyncStorageMock })) - -vi.mock('expo-secure-store', () => ({ - WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'WHEN_UNLOCKED_THIS_DEVICE_ONLY', - ...secureStoreMock -})) -vi.mock('react-native', () => ({ Platform: platformMock })) - -import { resetPairingKeychainForTests, writePairingKeychainItem } from './pairing-keychain' - -const GENERATION_KEY = 'orca:pairing-keychain-generation' -const TOKEN_KEY = 'orca.host-token.host-1782629088232' - -// Preserve Expo’s null-message Android GeneralSecurityException shape from #6600. -const ENCRYPT_REJECTION = new Error( - `Could not encrypt the value for key '${TOKEN_KEY}' under keychain 'key_v1'. Caused by: unknown` -) - -describe('pairing keychain', () => { - let generationRecord: string | null - - beforeEach(() => { - vi.clearAllMocks() - resetPairingKeychainForTests() - platformMock.OS = 'android' - generationRecord = null - asyncStorageMock.getItem.mockImplementation(async (key: string) => - key === GENERATION_KEY ? generationRecord : null - ) - asyncStorageMock.setItem.mockImplementation(async (key: string, raw: string) => { - if (key === GENERATION_KEY) { - generationRecord = raw - } - }) - secureStoreMock.setItemAsync.mockResolvedValue(undefined) - secureStoreMock.deleteItemAsync.mockResolvedValue(undefined) - secureStoreMock.getItemAsync.mockResolvedValue(null) - }) - - it('surfaces the original error when a rotated write also fails', async () => { - secureStoreMock.setItemAsync.mockRejectedValue(ENCRYPT_REJECTION) - - await expect(writePairingKeychainItem(TOKEN_KEY, 'token')).rejects.toBe(ENCRYPT_REJECTION) - expect(generationRecord).toBe('1:pending') - expect(secureStoreMock.deleteItemAsync).not.toHaveBeenCalled() - }) - - it('does not rotate from a guessed generation when the record is unreadable', async () => { - const storageError = new Error('storage unavailable') - asyncStorageMock.getItem.mockRejectedValueOnce(storageError) - - await expect(writePairingKeychainItem(TOKEN_KEY, 'token')).rejects.toBe(storageError) - - expect(asyncStorageMock.setItem).not.toHaveBeenCalled() - expect(secureStoreMock.setItemAsync).not.toHaveBeenCalled() - }) -}) diff --git a/mobile/src/transport/relay/mobile-relay-credential-rotation.ts b/mobile/src/transport/relay/mobile-relay-credential-rotation.ts index e15157dfdd9..a9ff541f02f 100644 --- a/mobile/src/transport/relay/mobile-relay-credential-rotation.ts +++ b/mobile/src/transport/relay/mobile-relay-credential-rotation.ts @@ -6,7 +6,7 @@ import type { import { MobileRelayCredentialBundleSchema, type MobileRelayCredentialBundle -} from '../hosts/mobile-relay-credential-bundle' +} from '../../host-credentials/mobile-relay-credential-bundle' import { hashMobileRelayCredential } from './mobile-relay-credential-hash' import { relayCredentialProvision, diff --git a/mobile/src/transport/relay/mobile-relay-credential-selection.ts b/mobile/src/transport/relay/mobile-relay-credential-selection.ts index 8d216028ca0..8952401e8b5 100644 --- a/mobile/src/transport/relay/mobile-relay-credential-selection.ts +++ b/mobile/src/transport/relay/mobile-relay-credential-selection.ts @@ -1,4 +1,4 @@ -import type { MobileRelayCredentialBundle } from '../hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import type { RelayReconnectController } from './mobile-relay-reconnect-controller' // Adopt durable state only when it restores a dialable credential; fresh renewals/re-pairing do not reliably increase version. diff --git a/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.test.ts b/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.test.ts index 2864cb76633..6e6b18fe684 100644 --- a/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.test.ts +++ b/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.test.ts @@ -3,7 +3,7 @@ import { MobileRelayDirectUpgradeController } from './mobile-relay-direct-upgrad import type { MobileRelayDirectUpgradeResult } from './mobile-relay-direct-upgrade' import type { StableLogicalRpcClient } from '../connection/stable-logical-rpc-client' import type { ConnectionState } from '../connection/connection-state' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' const directHost: HostProfile = { id: 'host-direct', diff --git a/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.ts b/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.ts index 28c1d1816ce..81b8fd9a9c2 100644 --- a/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.ts +++ b/mobile/src/transport/relay/mobile-relay-direct-upgrade-controller.ts @@ -1,6 +1,6 @@ import type { MobileRelayDirectUpgradeResult } from './mobile-relay-direct-upgrade' import type { StableLogicalRpcClient } from '../connection/stable-logical-rpc-client' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' type Dependencies = { upgrade: ( diff --git a/mobile/src/transport/relay/mobile-relay-direct-upgrade-journal.ts b/mobile/src/transport/relay/mobile-relay-direct-upgrade-journal.ts index abab5a05ca5..8d963663eff 100644 --- a/mobile/src/transport/relay/mobile-relay-direct-upgrade-journal.ts +++ b/mobile/src/transport/relay/mobile-relay-direct-upgrade-journal.ts @@ -5,8 +5,8 @@ import { deletePairingKeychainItem, readPairingKeychainItem, writePairingKeychainItem -} from '../hosts/pairing-keychain' -import { markHostCredentialWrite } from '../hosts/host-credential-write-revision' +} from '../../host-credentials/pairing-keychain' +import { markHostCredentialWrite } from '../../host-credentials/host-credential-write-revision' const Base64Url32ByteSchema = z.string().regex(/^[A-Za-z0-9_-]{43}$/) diff --git a/mobile/src/transport/relay/mobile-relay-direct-upgrade.ts b/mobile/src/transport/relay/mobile-relay-direct-upgrade.ts index 6fc49039c16..f4cb7d6ad6b 100644 --- a/mobile/src/transport/relay/mobile-relay-direct-upgrade.ts +++ b/mobile/src/transport/relay/mobile-relay-direct-upgrade.ts @@ -4,13 +4,13 @@ import type { MobileRelayEndpoint, PairingGetEndpointsResult } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' -import { RelayRoutingHostRemovedError, setRelayRouting } from '../hosts/host-store' +import { RelayRoutingHostRemovedError, setRelayRouting } from '../../host-catalog/host-store' import { MobileRelayCredentialBundleSchema, deleteMobileRelayCredentialBundle, writeMobileRelayCredentialBundle, type MobileRelayCredentialBundle -} from '../hosts/mobile-relay-credential-bundle' +} from '../../host-credentials/mobile-relay-credential-bundle' import { createMobileRelayDirectUpgradeJournal, deleteMobileRelayDirectUpgradeJournal, @@ -23,7 +23,7 @@ import { relayPairingEndpointsRead } from '../../pairing/mobile-relay-pairing-operations' import type { RpcClient } from '../rpc/rpc-client-contract' -import type { HostProfile } from '../hosts/host-profile' +import type { HostProfile } from '../../host-catalog/host-profile' import { isPairingRelayRpcUnavailable } from '../../pairing/pairing-relay-rpc-unavailable' export type MobileRelayDirectUpgradeResult = { diff --git a/mobile/src/transport/relay/mobile-relay-orphan-cleanup.ts b/mobile/src/transport/relay/mobile-relay-orphan-cleanup.ts index 0b909a2940a..9d5a984139e 100644 --- a/mobile/src/transport/relay/mobile-relay-orphan-cleanup.ts +++ b/mobile/src/transport/relay/mobile-relay-orphan-cleanup.ts @@ -1,5 +1,5 @@ -import { scheduleHostCredentialCleanup } from '../hosts/host-credential-cleanup' -import { removeMobileRelayHostRouting } from '../hosts/mobile-relay-host-overlay-store' +import { scheduleHostCredentialCleanup } from '../../host-credentials/host-credential-cleanup' +import { removeMobileRelayHostRouting } from '../../host-catalog/mobile-relay-host-overlay-store' export async function scheduleOrphanedMobileRelayCleanup(args: { hostIds: string[] diff --git a/mobile/src/transport/relay/mobile-relay-recovery-presentation.ts b/mobile/src/transport/relay/mobile-relay-recovery-presentation.ts index e83994e7411..54da4de3edd 100644 --- a/mobile/src/transport/relay/mobile-relay-recovery-presentation.ts +++ b/mobile/src/transport/relay/mobile-relay-recovery-presentation.ts @@ -1,4 +1,4 @@ -import type { MobileRelayCredentialBundle } from '../hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import type { RelayReconnectController } from './mobile-relay-reconnect-controller' import type { StableLogicalRpcClient } from '../connection/stable-logical-rpc-client' import type { ConnectionState } from '../connection/connection-state' diff --git a/mobile/src/transport/relay/mobile-relay-session-establisher.ts b/mobile/src/transport/relay/mobile-relay-session-establisher.ts index f370b56af89..ab0a580b764 100644 --- a/mobile/src/transport/relay/mobile-relay-session-establisher.ts +++ b/mobile/src/transport/relay/mobile-relay-session-establisher.ts @@ -7,7 +7,7 @@ import { import { encodeBase64Url } from '../encryption/mobile-session-id-encoding' import { persistResumeConfirmation } from './mobile-relay-credential-rotation' import { relayFailureAllowsGraceRetry } from './relay-credential-eligibility' -import type { MobileRelayCredentialBundle } from '../hosts/mobile-relay-credential-bundle' +import type { MobileRelayCredentialBundle } from '../../host-credentials/mobile-relay-credential-bundle' import type { RelayReconnectController } from './mobile-relay-reconnect-controller' import type { StableLogicalRpcClient } from '../connection/stable-logical-rpc-client' import type { MobileRelayEndpoint } from '../../../../src/shared/remote-runtime/relay/mobile-relay-credential-contract' diff --git a/mobile/web-entry/web-overrides.json b/mobile/web-entry/web-overrides.json index 954c12892fb..52e4bca5ba5 100644 --- a/mobile/web-entry/web-overrides.json +++ b/mobile/web-entry/web-overrides.json @@ -26,19 +26,23 @@ "reason": "The page is one document standing in for one screen, so a route it does not render has to be handed to the app that does. The native file is the router; this one posts a navigate notify for a target outside the page's routes and pushes locally for one inside them." }, { - "file": "src/transport/hosts/host-store.web.ts", + "file": "src/host-catalog/host-store.web.ts", "reason": "expo-secure-store resolves to {} on web, so the real store answers loadHosts() with an empty array and every screen that looks this host up paints \"Host not found\" over the host the shell just opened. This one serves the profile init carried, without the credential the bridge already holds." }, { - "file": "src/transport/hosts/host-descriptor-persistence.web.ts", + "file": "src/host-catalog/host-connection-history.web.ts", + "reason": "Recency belongs to the native host list. The host-served page retains the existing no-op and imports no native metadata mutation queue." + }, + { + "file": "src/host-descriptors/host-descriptor-persistence.web.ts", "reason": "Last-known descriptors belong to the native host list; the page owns no descriptor persistence." }, { - "file": "src/transport/hosts/host-removal-lifecycle.web.ts", + "file": "src/host-catalog/host-removal-lifecycle.web.ts", "reason": "Removing a host is pairing work and the page holds neither the host list nor the credential, so the real lifecycle's removeHost resolved without doing anything and the screen reported success for a host that was still paired. This one refuses with PageHostRemovalUnavailableError, whose message names the app's host list. It is also the fence that keeps push-registration.ts out of the page bundle: the native file's import of it was that subsystem's only path into a page route, and the page has neither the device token nor the gateway client push needs." }, { - "file": "src/transport/hosts/host-device-token-store.web.ts", + "file": "src/host-credentials/host-device-token-store.web.ts", "reason": "expo-secure-store resolves to {} on web, and the bridge carries the RPC, so the page holds no device token." }, { @@ -198,7 +202,7 @@ "reason": "react-native-web's keydown handler withholds onSubmitEditing whenever the Enter keydown reports a composition — nativeEvent.isComposing, or the Android keyCode 229 that stands for it — which is a soft keyboard's normal state mid-word, so Enter on the page neither sent the line nor cleared the field while native Android's editor action fired as it always does. Both terminal fields reach their send through onSubmitEditing alone and both are bound here: the live input's carriage return, and the buffered command field's draft. The native file binds nothing, because that editor action needs no help; this one listens for beforeinput and acts on insertLineBreak and insertParagraph, the browser's own end-of-line signals. react-native-web calls preventDefault on every keydown it does submit on, so those events exist only in the cases it dropped and never produce a second carriage return; an IME still choosing a candidate reports insertCompositionText and is left alone." }, { - "file": "src/transport/hosts/host-app-version-store.web.ts", + "file": "src/host-descriptors/host-app-version-store.web.ts", "reason": "The page keeps no record of the host's status.get app version because nothing in it reads one — the reader is the native troubleshoot screen's — and a key the page only writes is not page state, so it is not admitted through page-storage-keys.ts and every mount's write was refused and logged instead." }, {