From 0249174cb9c6de044470cc077e0446fe087889f3 Mon Sep 17 00:00:00 2001 From: Neil <4138956+nwparker@users.noreply.github.com> Date: Sun, 18 Oct 2026 01:58:25 -0700 Subject: [PATCH] refactor(runtime): import mobile-cloud-relay and browser-host helpers from their owning modules (#30279) Removes the re-export lines in relay-region-preference, relay-session-broker, browser-host-page-placement and browser-host-page-reconciliation-plan (no barrels). --- .../browser-host/browser-host-client-page-adoption.ts | 2 +- .../browser-host-lease-placement-retirement.test.ts | 6 ++---- .../runtime/browser-host/browser-host-lease-registry.ts | 8 +++++--- .../runtime/browser-host/browser-host-page-placement.ts | 6 ------ .../browser-host-page-reconciliation-actions.ts | 4 ++-- .../browser-host-page-reconciliation-executor.test.ts | 2 +- .../browser-host-page-reconciliation-orchestration.ts | 6 ++---- .../browser-host-page-reconciliation-plan.test.ts | 2 +- .../browser-host/browser-host-page-reconciliation-plan.ts | 2 -- .../runtime/mobile-cloud-relay/desktop-relay-service.ts | 3 ++- .../runtime/mobile-cloud-relay/relay-auth-coordinator.ts | 3 +-- src/main/runtime/mobile-cloud-relay/relay-http-client.ts | 2 +- .../mobile-cloud-relay/relay-origin-pool-options.ts | 2 +- .../runtime/mobile-cloud-relay/relay-region-preference.ts | 2 -- .../mobile-cloud-relay/relay-session-broker-contract.ts | 2 +- .../mobile-cloud-relay/relay-session-broker.test.ts | 3 ++- .../runtime/mobile-cloud-relay/relay-session-broker.ts | 3 --- .../runtime/runtime-browser-client-page-creation.test.ts | 6 ++---- src/main/runtime/runtime-browser-client-page-creation.ts | 2 +- src/main/startup/main-process-state.ts | 2 +- 20 files changed, 26 insertions(+), 42 deletions(-) diff --git a/src/main/runtime/browser-host/browser-host-client-page-adoption.ts b/src/main/runtime/browser-host/browser-host-client-page-adoption.ts index 2c978cfed9b..21dea2044b3 100644 --- a/src/main/runtime/browser-host/browser-host-client-page-adoption.ts +++ b/src/main/runtime/browser-host/browser-host-client-page-adoption.ts @@ -1,7 +1,7 @@ import type { BrowserClientHostedPageInventory } from '../../../shared/browser-client-host-protocol' import type { BrowserClientPageExecutionHostGrant } from './browser-host-client-page-creation' import type { BrowserHostLeaseState } from './browser-host-lease-records' -import type { RuntimeBrowserPlacement } from './browser-host-page-placement' +import type { RuntimeBrowserPlacement } from '../../../shared/runtime-browser-placement' import type { BrowserHostRuntimePageIntent } from './browser-host-page-reconciliation-plan' /** diff --git a/src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts b/src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts index 479e04ea628..8f0c0044135 100644 --- a/src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts +++ b/src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts @@ -1,9 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { BrowserHostLeaseRegistry } from './browser-host-lease-registry' -import type { - BrowserClientPageAuthority, - RuntimeBrowserClientPlacement -} from './browser-host-page-placement' +import type { BrowserClientPageAuthority } from './browser-host-page-placement' +import type { RuntimeBrowserClientPlacement } from '../../../shared/runtime-browser-placement' const registry = (reconnectGraceMs?: number): BrowserHostLeaseRegistry => new BrowserHostLeaseRegistry({ diff --git a/src/main/runtime/browser-host/browser-host-lease-registry.ts b/src/main/runtime/browser-host/browser-host-lease-registry.ts index e30e1644c44..f50f7f9faa3 100644 --- a/src/main/runtime/browser-host/browser-host-lease-registry.ts +++ b/src/main/runtime/browser-host/browser-host-lease-registry.ts @@ -19,10 +19,12 @@ import { issueBrowserHostClientPageCommand } from './browser-host-client-page-co import { BrowserHostPagePlacementRegistry, type BrowserClientPageAuthority, - type BrowserPageRetirement, - type RuntimeBrowserClientPlacement, - type RuntimeBrowserPlacement + type BrowserPageRetirement } from './browser-host-page-placement' +import type { + RuntimeBrowserClientPlacement, + RuntimeBrowserPlacement +} from '../../../shared/runtime-browser-placement' import { requireLiveBrowserClientPage } from './browser-host-page-authority' import type { BrowserHostFenceReason } from './browser-host-lease-fence' import { dispatchBrowserHostLeaseFence } from './browser-host-lease-fence-dispatch' diff --git a/src/main/runtime/browser-host/browser-host-page-placement.ts b/src/main/runtime/browser-host/browser-host-page-placement.ts index ff43c99d995..2990c206dd7 100644 --- a/src/main/runtime/browser-host/browser-host-page-placement.ts +++ b/src/main/runtime/browser-host/browser-host-page-placement.ts @@ -11,12 +11,6 @@ import { type BrowserHostPlacementIdentity } from './browser-host-page-placement-validation' -export type { - RuntimeBrowserClientPlacement, - RuntimeBrowserPlacement, - RuntimeBrowserServerPlacement -} from '../../../shared/runtime-browser-placement' - const DEFAULT_MAX_PAGE_PLACEMENTS = 256 export type BrowserPageRetirement = Readonly<{ diff --git a/src/main/runtime/browser-host/browser-host-page-reconciliation-actions.ts b/src/main/runtime/browser-host/browser-host-page-reconciliation-actions.ts index c862600980d..b97767f904e 100644 --- a/src/main/runtime/browser-host/browser-host-page-reconciliation-actions.ts +++ b/src/main/runtime/browser-host/browser-host-page-reconciliation-actions.ts @@ -7,9 +7,9 @@ import { assertBrowserHostPageCommandAdmission } from './browser-host-page-comma import type { BrowserHostLeaseState } from './browser-host-lease-records' import type { BrowserClientPagePlacementReservation, - BrowserHostPagePlacementRegistry, - RuntimeBrowserPlacement + BrowserHostPagePlacementRegistry } from './browser-host-page-placement' +import type { RuntimeBrowserPlacement } from '../../../shared/runtime-browser-placement' import type { BrowserHostPageReconciliationActions as ActionHandlers } from './browser-host-page-reconciliation-executor' import type { BrowserHostPageReconciliationPlan, diff --git a/src/main/runtime/browser-host/browser-host-page-reconciliation-executor.test.ts b/src/main/runtime/browser-host/browser-host-page-reconciliation-executor.test.ts index 27a13a8e746..a3aed06a00d 100644 --- a/src/main/runtime/browser-host/browser-host-page-reconciliation-executor.test.ts +++ b/src/main/runtime/browser-host/browser-host-page-reconciliation-executor.test.ts @@ -5,9 +5,9 @@ import { } from './browser-host-page-reconciliation-executor' import { planBrowserHostPageReconciliation, - type BrowserClientHostedPageInventory, type BrowserHostRuntimePageIntent } from './browser-host-page-reconciliation-plan' +import type { BrowserClientHostedPageInventory } from '../../../shared/browser-client-host-protocol' const inventorySource = { inventoryPairedDeviceId: 'device-a' } diff --git a/src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.ts b/src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.ts index 585a7d34a08..ebbee5f2293 100644 --- a/src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.ts +++ b/src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.ts @@ -1,9 +1,7 @@ import type { BrowserClientHostedPageInventory } from '../../../shared/browser-client-host-protocol' import type { BrowserHostLeaseState } from './browser-host-lease-records' -import type { - BrowserHostPagePlacementRegistry, - RuntimeBrowserPlacement -} from './browser-host-page-placement' +import type { BrowserHostPagePlacementRegistry } from './browser-host-page-placement' +import type { RuntimeBrowserPlacement } from '../../../shared/runtime-browser-placement' import { BrowserHostPageReconciliationActions } from './browser-host-page-reconciliation-actions' import { executeBrowserHostPageReconciliation, diff --git a/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts b/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts index 2d02424b98e..51f190df06d 100644 --- a/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts +++ b/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from 'vitest' import { planBrowserHostPageReconciliation, - type BrowserClientHostedPageInventory, type BrowserHostRuntimePageIntent } from './browser-host-page-reconciliation-plan' +import type { BrowserClientHostedPageInventory } from '../../../shared/browser-client-host-protocol' const inventorySource = { inventoryPairedDeviceId: 'device-a' } diff --git a/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.ts b/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.ts index 13c8561ed96..d8914aec687 100644 --- a/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.ts +++ b/src/main/runtime/browser-host/browser-host-page-reconciliation-plan.ts @@ -23,8 +23,6 @@ export type BrowserHostRuntimePageIntent = BrowserHostPageAuthority & reclaimFrom?: BrowserHostPageAuthority & Readonly<{ pairedDeviceId: string }> }> -export type { BrowserClientHostedPageInventory } from '../../../shared/browser-client-host-protocol' - type PagePair = Readonly<{ intent: BrowserHostRuntimePageIntent page: BrowserClientHostedPageInventory diff --git a/src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts b/src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts index 3bb317b0fdc..894ca729e92 100644 --- a/src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts +++ b/src/main/runtime/mobile-cloud-relay/desktop-relay-service.ts @@ -11,7 +11,8 @@ import { readRelayAuthContext } from './relay-auth-context' import { relayIdentityKey } from './relay-auth-identity' import { RelayAuthCoordinator } from './relay-auth-coordinator' import { RelayUnavailableError } from './relay-readiness' -import { RelaySessionBroker, type RelayBrokerStatus } from './relay-session-broker' +import { RelaySessionBroker } from './relay-session-broker' +import type { RelayBrokerStatus } from './relay-session-broker-contract' import type { PairingRelay } from '../../../shared/mobile-relay-pairing-offer' import type { RelayRevokeOutbox, diff --git a/src/main/runtime/mobile-cloud-relay/relay-auth-coordinator.ts b/src/main/runtime/mobile-cloud-relay/relay-auth-coordinator.ts index 6a1e7f6c322..7a3baf24cf2 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-auth-coordinator.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-auth-coordinator.ts @@ -3,8 +3,7 @@ import { type RelayHostCloseReason } from '../../../shared/relay-host-close-reason' import { relayStatusCellUrl } from '../../../shared/mobile-relay-status' -import type { RelayBrokerStatus } from './relay-session-broker' -import type { RelayAccessTokenRefresh } from './relay-session-broker-contract' +import type { RelayBrokerStatus, RelayAccessTokenRefresh } from './relay-session-broker-contract' import { shouldRetryRelayConnectionError } from './relay-http-client' import { RelayReadinessWaiters, diff --git a/src/main/runtime/mobile-cloud-relay/relay-http-client.ts b/src/main/runtime/mobile-cloud-relay/relay-http-client.ts index 297a9c1e513..2eb7c3aa976 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-http-client.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-http-client.ts @@ -10,7 +10,7 @@ import { sharedRelayAssignRateGate, type RelayAssignRateGate } from './relay-assign-rate-gate' -import type { RelayRegion } from './relay-region-preference' +import type { RelayRegion } from './relay-region-probe' import { RelayRegionCorrectionResponseSchema, type RelayRegionCorrectionRequest diff --git a/src/main/runtime/mobile-cloud-relay/relay-origin-pool-options.ts b/src/main/runtime/mobile-cloud-relay/relay-origin-pool-options.ts index ffb5455d1f4..0196254483c 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-origin-pool-options.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-origin-pool-options.ts @@ -2,7 +2,7 @@ import type WebSocket from 'ws' import type { E2EEKeypair } from '../e2ee-keypair' import type { MobileSocketWiring } from '../rpc/mobile-socket-wiring' import type { RelayBrokerStatus, RelayIdentity } from './relay-session-broker-contract' -import type { RelayRegion } from './relay-region-preference' +import type { RelayRegion } from './relay-region-probe' export type RelayOriginPoolOptions = { directorUrl: string diff --git a/src/main/runtime/mobile-cloud-relay/relay-region-preference.ts b/src/main/runtime/mobile-cloud-relay/relay-region-preference.ts index 882684c48ec..f91ae616ec5 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-region-preference.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-region-preference.ts @@ -31,8 +31,6 @@ import { type RelayRegionProbeReport } from './relay-region-probe' -export { RELAY_REGIONS, type RelayRegion } from './relay-region-probe' - const RELAY_REGION_CACHE_FILENAME = 'orca-relay-region-preference.json' const CACHE_MAX_BYTES = 8 * 1024 const CACHE_TTL_MS = 24 * 60 * 60_000 diff --git a/src/main/runtime/mobile-cloud-relay/relay-session-broker-contract.ts b/src/main/runtime/mobile-cloud-relay/relay-session-broker-contract.ts index d1415c69d13..ff6f923f0ae 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-session-broker-contract.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-session-broker-contract.ts @@ -4,7 +4,7 @@ import type { MobileRelayStatus } from '../../../shared/mobile-relay-status' import type { E2EEKeypair } from '../e2ee-keypair' import type { MobileSocketWiring } from '../rpc/mobile-socket-wiring' import type { RelayHostCloseReason } from '../../../shared/relay-host-close-reason' -import type { RelayRegion } from './relay-region-preference' +import type { RelayRegion } from './relay-region-probe' import type { RelayRegionDecision, RelayRegionWindow } from './relay-region-correction-protocol' export type RelayBrokerStatus = MobileRelayStatus diff --git a/src/main/runtime/mobile-cloud-relay/relay-session-broker.test.ts b/src/main/runtime/mobile-cloud-relay/relay-session-broker.test.ts index d68c9593569..c07ee1ca659 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-session-broker.test.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-session-broker.test.ts @@ -88,7 +88,8 @@ vi.mock('../rpc/relay-transport', () => ({ } })) -import { RelaySessionBroker, StaleRelayBrokerError } from './relay-session-broker' +import { RelaySessionBroker } from './relay-session-broker' +import { StaleRelayBrokerError } from './relay-session-broker-contract' import { RelayHttpError } from './relay-http-client' import { RelayAuthCoordinator } from './relay-auth-coordinator' import type { RelayAuthContext } from './relay-auth-identity' diff --git a/src/main/runtime/mobile-cloud-relay/relay-session-broker.ts b/src/main/runtime/mobile-cloud-relay/relay-session-broker.ts index 920467986d7..299e87a7983 100644 --- a/src/main/runtime/mobile-cloud-relay/relay-session-broker.ts +++ b/src/main/runtime/mobile-cloud-relay/relay-session-broker.ts @@ -1,5 +1,4 @@ import { StaleRelayBrokerError } from './relay-session-broker-contract' -export { StaleRelayBrokerError } from './relay-session-broker-contract' import { relayStatusCellUrl } from '../../../shared/mobile-relay-status' import type { PairingRelay } from '../../../shared/mobile-relay-pairing-offer' import type { @@ -24,8 +23,6 @@ import { RelayRegionRefresh } from './relay-region-refresh' import { relayRenewalDelayMs } from './relay-renewal-jitter' import type { RelayBrokerStatus, RelaySessionBrokerOptions } from './relay-session-broker-contract' -export type { RelayBrokerStatus } from './relay-session-broker-contract' - export class RelaySessionBroker { private readonly options: RelaySessionBrokerOptions private readonly relayHostId: string diff --git a/src/main/runtime/runtime-browser-client-page-creation.test.ts b/src/main/runtime/runtime-browser-client-page-creation.test.ts index 2d4ae71b28d..3b97b184d1c 100644 --- a/src/main/runtime/runtime-browser-client-page-creation.test.ts +++ b/src/main/runtime/runtime-browser-client-page-creation.test.ts @@ -1,8 +1,6 @@ import { describe, expect, it, vi } from 'vitest' -import { - BrowserHostPagePlacementRegistry, - type RuntimeBrowserClientPlacement -} from './browser-host/browser-host-page-placement' +import { BrowserHostPagePlacementRegistry } from './browser-host/browser-host-page-placement' +import type { RuntimeBrowserClientPlacement } from '../../shared/runtime-browser-placement' import { closeRuntimeBrowserClientPage, createRuntimeBrowserClientPage, diff --git a/src/main/runtime/runtime-browser-client-page-creation.ts b/src/main/runtime/runtime-browser-client-page-creation.ts index 5674e8d8e5b..d2f65a7fa08 100644 --- a/src/main/runtime/runtime-browser-client-page-creation.ts +++ b/src/main/runtime/runtime-browser-client-page-creation.ts @@ -2,7 +2,7 @@ import type { BrowserNetworkExecutionHost } from '../../shared/browser-client-ho import { BROWSER_CLIENT_AUTOMATION_HOST_CAPABILITY } from '../../shared/browser-client-automation-protocol' import { browserNetworkExecutionHostKey } from '../browser/browser-network-execution-route' import type { BrowserHostLeaseRegistry } from './browser-host/browser-host-lease-registry' -import type { RuntimeBrowserClientPlacement } from './browser-host/browser-host-page-placement' +import type { RuntimeBrowserClientPlacement } from '../../shared/runtime-browser-placement' type RuntimeBrowserClientPageAuthority = Pick< BrowserHostLeaseRegistry, diff --git a/src/main/startup/main-process-state.ts b/src/main/startup/main-process-state.ts index 9adc5c1fc0a..94f2b1bb0e2 100644 --- a/src/main/startup/main-process-state.ts +++ b/src/main/startup/main-process-state.ts @@ -25,7 +25,7 @@ import type { PluginKillListService } from '../plugins/plugin-kill-list-service' import type { PluginMarketplaceService } from '../plugins/plugin-marketplace-service' import type { PluginMarketplaceInstaller } from '../plugins/plugin-marketplace-installer' import type { KeybindingService } from '../keybindings/keybinding-service' -import type { RelayBrokerStatus } from '../runtime/mobile-cloud-relay/relay-session-broker' +import type { RelayBrokerStatus } from '../runtime/mobile-cloud-relay/relay-session-broker-contract' import type { AgentBrowserBridge } from '../browser/agent-browser-bridge' import type { EmulatorBridge } from '../emulator/emulator-bridge' import type { GpuFallbackMarker, GpuFallbackEnvironment } from './gpu-fallback-marker'