diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 4d16c67520b..80dc0e59a03 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1109,16 +1109,16 @@ jobs: run: >- xvfb-run --auto-servernum pnpm exec vitest run --config config/vitest.config.ts --no-file-parallelism - src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts - src/main/browser/browser-route-webrtc-egress.electron.test.ts + src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts + src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts src/main/browser/cookies/browser-google-cookie-clear.electron.test.ts - src/main/browser/popup-origin-chrome.electron.test.ts + src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts src/main/browser/browser-link-materialization.electron.test.ts - src/main/browser/browser-popup-compatibility.electron.test.ts - src/main/browser/browser-popup-adapter-compatibility.electron.test.ts - src/main/browser/browser-popup-native-compatibility.electron.test.ts - src/main/browser/browser-popup-background-compatibility.electron.test.ts + src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts + src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts + src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts + src/main/browser/guest-lifecycle/popups/browser-popup-background-compatibility.electron.test.ts src/main/browser/extensions/browser-extension-api.electron.test.ts src/main/browser/extensions/browser-extension-persistence.electron.test.ts src/main/browser/extensions/browser-extension-lifecycle.electron.test.ts diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 0dfeb84ae9d..a8369ff4119 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -63,7 +63,7 @@ 1 test-no-polling-loop:config/scripts/happy-dom-mutation-observer-retention.test.ts 1 test-no-polling-loop:config/scripts/mobile-web-app/mobile-web-app-frame-budget-sweep.test.ts 1 test-no-polling-loop:mobile/src/transport/rpc-client-live-recovery.test.ts -1 test-no-polling-loop:src/main/browser/cdp-ws-proxy.test.ts +1 test-no-polling-loop:src/main/browser/cdp/transport/cdp-ws-proxy.test.ts 1 test-no-polling-loop:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts 1 test-no-polling-loop:src/main/claude/claude-stop-ack-race.test.ts 1 test-no-polling-loop:src/main/claude/claude-stream-json-connection.test.ts @@ -229,18 +229,18 @@ 2 test-no-real-time-wait:src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-scan-scope.test.ts 1 test-no-real-time-wait:src/main/antigravity/windows-hook-json-post.test.ts 1 test-no-real-time-wait:src/main/antigravity/windows-hook-payload-delivery.test.ts -2 test-no-real-time-wait:src/main/browser/browser-popup-compatibility.electron.test.ts -1 test-no-real-time-wait:src/main/browser/browser-popup-native-compatibility.electron.test.ts +2 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts +1 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts 1 test-no-real-time-wait:src/main/browser/browser-session-ua-cloudflare-live.electron.test.ts 1 test-no-real-time-wait:src/main/browser/browser-session-ua-wire-identity-cross-context.electron.test.ts 1 test-no-real-time-wait:src/main/browser/browser-session-ua-wire-identity.electron.test.ts -10 test-no-real-time-wait:src/main/browser/cdp-ws-proxy-focus-replay.test.ts -12 test-no-real-time-wait:src/main/browser/cdp-ws-proxy.test.ts +10 test-no-real-time-wait:src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts +12 test-no-real-time-wait:src/main/browser/cdp/transport/cdp-ws-proxy.test.ts 4 test-no-real-time-wait:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts -1 test-no-real-time-wait:src/main/browser/execution-route-socket-duplex.test.ts -1 test-no-real-time-wait:src/main/browser/guest-focused-frame-route.test.ts -1 test-no-real-time-wait:src/main/browser/paired-runtime-browser-network-route.test.ts -1 test-no-real-time-wait:src/main/browser/remote-browser-socks-server.test.ts +1 test-no-real-time-wait:src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts +1 test-no-real-time-wait:src/main/browser/cdp/input/guest-focused-frame-route.test.ts +1 test-no-real-time-wait:src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts +1 test-no-real-time-wait:src/main/browser/network/tunnels/remote-browser-socks-server.test.ts 1 test-no-real-time-wait:src/main/claude-accounts/claude-login-session.test.ts 2 test-no-real-time-wait:src/main/claude-accounts/claude-profile-router.test.ts 3 test-no-real-time-wait:src/main/claude-accounts/claude-profile-wsl-router.test.ts @@ -742,9 +742,9 @@ 1 test-no-wall-clock:src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process.test.ts 2 test-no-wall-clock:src/main/antigravity/posix-hook-invocation.test.ts 2 test-no-wall-clock:src/main/browser/browser-session-registry.test.ts -2 test-no-wall-clock:src/main/browser/cdp-ws-proxy.test.ts +2 test-no-wall-clock:src/main/browser/cdp/transport/cdp-ws-proxy.test.ts 2 test-no-wall-clock:src/main/browser/cookies/browser-cookie-import-partition-reland.electron.test.ts -2 test-no-wall-clock:src/main/browser/wsl-browser-network-execution-route.test.ts +2 test-no-wall-clock:src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts 1 test-no-wall-clock:src/main/claude-accounts/claude-account-folder.test.ts 1 test-no-wall-clock:src/main/claude-usage/persisted-source-authority.test.ts 1 test-no-wall-clock:src/main/claude/claude-background-wake-retention.test.ts @@ -1133,9 +1133,9 @@ 2 test-timeout-needs-reason:src/main/antigravity/windows-hook-json-post.test.ts 3 test-timeout-needs-reason:src/main/antigravity/windows-hook-payload-delivery.test.ts 1 test-timeout-needs-reason:src/main/browser/agent-browser/agent-browser-bridge-raw-process.test.ts -1 test-timeout-needs-reason:src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts +1 test-timeout-needs-reason:src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/browser-find-frame-traversal.electron.test.ts -1 test-timeout-needs-reason:src/main/browser/browser-route-webrtc-egress.electron.test.ts +1 test-timeout-needs-reason:src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/browser-session-ua-cloudflare-live.electron.test.ts 2 test-timeout-needs-reason:src/main/browser/browser-session-ua-wire-identity-cross-context.electron.test.ts 5 test-timeout-needs-reason:src/main/browser/browser-session-ua-wire-identity.electron.test.ts diff --git a/config/main-sync-spawn-baseline.txt b/config/main-sync-spawn-baseline.txt index efcac62eab0..9ec42ee2a36 100644 --- a/config/main-sync-spawn-baseline.txt +++ b/config/main-sync-spawn-baseline.txt @@ -7,8 +7,8 @@ # Prune after removing launches: pnpm check:main-sync-spawn-ratchet --prune 1 src/main/agent-hooks/installer-utils.ts 2 src/main/browser/cookies/sources/browser-cookie-key.ts -1 src/main/browser/browser-route-egress-electron-launch.ts -1 src/main/browser/browser-route-partition-binding-store.ts +1 src/main/browser/network/egress/browser-route-egress-electron-launch.ts +1 src/main/browser/routing/partitions/browser-route-partition-binding-store.ts 1 src/main/claude-accounts/runtime-auth-service.ts 3 src/main/codex-accounts/fs-utils.ts 2 src/main/codex-accounts/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts diff --git a/config/process-host-direct-import-baseline.txt b/config/process-host-direct-import-baseline.txt index 443defa374c..d47279a44b1 100644 --- a/config/process-host-direct-import-baseline.txt +++ b/config/process-host-direct-import-baseline.txt @@ -17,7 +17,7 @@ src/main/browser/agent-browser/agent-browser-bridge-execution.ts src/main/browser/agent-browser/agent-browser-bridge-raw-process.ts src/main/browser/agent-browser/agent-browser-bridge-state.ts src/main/browser/agent-browser/agent-browser-bridge-types.ts -src/main/browser/browser-route-egress-electron-launch.ts +src/main/browser/network/egress/browser-route-egress-electron-launch.ts src/main/codex-accounts/legacy-wsl-runtime-auth-drain-recovery-script-harness.ts src/main/codex-accounts/legacy-wsl-runtime-auth-drain-script-harness.ts src/main/codex-accounts/service.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 0101802dfa3..1885ee182b5 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -6633,37 +6633,37 @@ "invariant": "A client-hosted browser network route exists only for an exact live server-owned browser-host lease, authority epoch, host generation, paired identity, execution-host revision or SSH provider authority, and server-owned route generation. A client page is usable only when its runtime ID, authority epoch, host identity and generation, logical page ID, page-host generation, current placement, and still-live lease all match atomically; a retired, retirement-pending, or server-placed page cannot be claimed as live client placement. Live logical placements and their identities are bounded, an occupied logical page cannot change placement until exact two-phase retirement completes, cancellation restores the same authority, and the runtime-wide page generation stays monotonic without tombstones. Server-issued page commands and results remain bounded, FIFO per page, immutable after admission, authenticated to the exact paired lease, attach connection, and live placement, and replayable only when byte-equivalent. Negotiated transient result-transport loss retains exact authority and replays unsettled commands through the preserved client dedupe cache; terminal authority loss makes outstanding outcomes unknown and makes only the exact host generation's placements non-cancellable retirement-pending until exact cleanup or reconciliation proof. Desktop composition installs exact command authority before delivery, keeps result settlements below nested-request capacity, suspends every tunnel without closing guests on negotiated loss, gates handlers through route recovery, and synchronously suspends routes and revokes exact retained navigation grants before asynchronous transport or handler cleanup on terminal loss. Navigation-revocation failure remains observable without preventing guest destruction and route cleanup. One environment pairing revision owns at most one composed desktop host and one reference-counted route per canonical execution-host key; pairing replacement and shutdown close control transport before pages and force-close routes even when guest cleanup remains ambiguous. Non-native descriptors require explicit capability negotiation and an exact runtime-minted lease-bound execution-host grant. Host selection never chooses arbitrarily, stale cleanup or settlement cannot remove a replacement, destination names remain unresolved until the execution host, credit returns only after writes settle, and route loss never falls back to desktop DNS or sockets. A main-owned local listener remains stable across upstream transport loss, rejects CONNECT while offline, accepts only a strictly newer tunnel generation, ignores superseded callbacks, and never reuses a stream ID within one generation. Pending opens, admitted open rate, nested control requests, per-route application bytes, aggregate browser-host/process bytes, claims, and socket sources remain bounded with exact release on settlement and retirement. Queued transport drain yields after a bounded quantum. The local SOCKS endpoint accepts only loopback CONNECT and rejects unsupported commands.", "oracle": "Attach two browser hosts and require unqualified selection to fail ambiguous while exact selection succeeds. Reject a second identity on one connection and a fifth identity for one paired device, release one exact lease, then admit its replacement without starving another device. Admit four hosts from one authenticated device and a host from a second, reject the first device's fifth host, and release only the first device's exact counters while the second remains live. Fill asks and hosts to their shared ceiling, retain a quarter of the total budget for ordinary waits, close both sockets, and prove every global, class, and device counter releases. Reject one initial host attach with the unchanged runtime_busy response, then require bounded client-specific jitter to attach when capacity returns; repeated rejection and explicit close must release every timer and subscription. Replace one same-device connection, require the old subscription and route to fence, then prove late old cleanup leaves the new generation live. Mint an exact execution-host grant, reject a different key, prove late old grant cleanup leaves its replacement, and invalidate every grant with lease replacement. Reject client-to-client, client-to-server, server-to-server, and server-to-client placement overwrite until exact retirement. Begin retirement once idempotently, reject client use and every replacement while pending, cancel the exact token to restore the same placement, and reject delayed cancellation or completion after a newer retirement begins. On explicit release, replacement, legacy disconnect, and reconnect-grace expiry, require only the exact host generation's client placements to become non-cancellable retirement-pending before lease settlement; preserve negotiated grace, other hosts, server placements, replacements, and capacity until exact completion. Complete only the exact pending token, retain capacity until completion, and require a reused client page ID to receive a higher global generation without retaining a tombstone. Require a client page through the exact runtime, epoch, host, and page tuple; reject every mismatch, released or replaced leases, retirement-pending pages, retired pages, server placements, invalid identities, and the 257th live placement. Admit 1024 opens in one monotonic 10-second window and reject the 1025th until the window expires. Fill 8 MiB across destination-to-client queues and separately across unsettled client-to-destination writes, release one exact retired stream, admit one replacement, and require the next byte claim to close the route without stale-callback or reentrant-close underflow. Across multiple routes, charge application copies, encrypted queue entries, and dynamic native socket bytes to one 32 MiB browser-host and 128 MiB process ceiling; reject zero-byte claim/socket-source floods, fence released leases, synchronously release JavaScript queue claims while retaining native claims through exact socket close, and yield a parked queue after four frames without reordering. Route nested responses by exact ID under reordering, reject unknown and duplicate IDs, cap pending requests and queued bytes, and tear down every concurrent waiter once on timeout or close. Drive one real paired attach, command, and result through one exact connection ID; reject missing send support and malformed or wrong-runtime acknowledgements while preserving old non-v1 attaches. Drop an authenticated transport, require the same listener to reject CONNECT before and during reconnect, attach the exact existing native v1 payload and capability pair to a strictly newer generation, ignore late old callbacks, and roll an exhausted stream-ID ledger only by replacing the generation. Require SSH descriptors to add an execution-host capability and exact grant, reject missing grants and stale provider authority before resolver or binary registration, pass exact domains to ssh2 and system-SSH SOCKS without local resolution, sanitize connector diagnostics, and close every stream and standalone route process once on timeout, synchronous failure, or rotation. Drive the accepted lease through real paired E2EE native SOCKS-to-HTTP and ephemeral Docker ssh2 remote-only DNS journeys, then exercise exact frame, credit, half-close, stale-stream, remote-DNS, unsupported-command, offline, and teardown assertions.", "commands": [ - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-webcontents-registry.test.ts src/main/browser/browser-client-page-unavailability.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/runtime/runtime-browser-client-page-recovery.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/runtime/runtime-browser-client-page-recovery.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-page-retirement.test.ts src/main/runtime/browser-host/browser-host-page-placement-replacement.test.ts src/main/runtime/browser-host/browser-host-page-placement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-page-retirement.test.ts src/main/runtime/browser-host/browser-host-page-placement-replacement.test.ts src/main/runtime/browser-host/browser-host-page-placement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-executor.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-page-placement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-reconciliation-protocol.test.ts src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts src/main/runtime/rpc/methods/browser-client-host-reconciliation.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-inventory.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-host-reconciliation-command-order.test.ts src/main/browser/browser-client-page-reconciliation-adapters.test.ts src/main/browser/browser-route-prepared-page-rekey.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-network-tunnel-protocol.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/remote-browser-socks-server.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/runtime-binary-message-router.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/remote-browser-socks-server.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/remote-browser-socks-server.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-reconciliation-protocol.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts src/main/runtime/rpc/methods/browser-client-host-reconciliation.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-network-tunnel-protocol.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/runtime-binary-message-router.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/remote-runtime/remote-runtime-client.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/remote-runtime/requests/remote-runtime-subscription-request.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host-registry.test.ts src/main/browser/paired-runtime-browser-client-host-runtime.test.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-session-startup.test.ts src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/browser-session-startup.test.ts src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/browser/browser-network-deferred-socket.test.ts src/main/browser/browser-network-execution-route.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/ssh-browser-network-execution-route.test.ts src/main/browser/system-ssh-socks-client-socket.test.ts src/main/ssh/system-transport/system-ssh-dynamic-forward-process.test.ts src/shared/browser-client-host-protocol.test.ts src/main/ssh/system-transport/system-ssh-forward-process.test.ts src/main/ssh/system-transport/system-ssh-operations.test.ts src/main/ssh/port-forwarding/ssh-port-forward.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts src/main/browser/network/execution-routes/browser-network-execution-route.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts src/main/ssh/system-transport/system-ssh-dynamic-forward-process.test.ts src/shared/browser-client-host-protocol.test.ts src/main/ssh/system-transport/system-ssh-forward-process.test.ts src/main/ssh/system-transport/system-ssh-operations.test.ts src/main/ssh/port-forwarding/ssh-port-forward.test.ts", "ORCA_RUN_DOCKER_SSH_BROWSER_E2E=1 pnpm exec vitest run --config config/vitest.config.ts tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts", "ORCA_RUN_DOCKER_SSH_BROWSER_E2E=1 node_modules/.bin/vitest run --config config/vitest.config.ts tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts" ], "testFiles": [ - "src/main/browser/browser-route-webcontents-registry.test.ts", - "src/main/browser/browser-client-page-unavailability.test.ts", + "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", + "src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts", "src/main/runtime/runtime-browser-client-page-recovery.test.ts", "src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts", "src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts", @@ -6683,37 +6683,37 @@ "src/main/runtime/runtime-rpc-browser-host-admission.test.ts", "src/main/runtime/rpc/methods/browser-client-host.test.ts", "src/main/runtime/rpc/methods/browser-client-host-reconciliation.test.ts", - "src/main/browser/paired-runtime-browser-host-lease.test.ts", - "src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts", - "src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts", - "src/main/browser/paired-runtime-browser-client-host.test.ts", - "src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts", - "src/main/browser/browser-client-network-route-registry.test.ts", - "src/main/browser/paired-runtime-browser-client-host-composition.test.ts", - "src/main/browser/paired-runtime-browser-client-host-registry.test.ts", - "src/main/browser/paired-runtime-browser-client-host-runtime.test.ts", - "src/main/browser/browser-client-host-reconciliation-command-order.test.ts", - "src/main/browser/browser-client-page-command-executor.test.ts", - "src/main/browser/browser-client-page-command-integration.test.ts", - "src/main/browser/browser-client-page-reconciliation-adapters.test.ts", - "src/main/browser/browser-client-page-inventory.test.ts", - "src/main/browser/browser-route-prepared-page-rekey.test.ts", + "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts", + "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts", + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts", + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts", + "src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts", + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts", + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts", + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts", + "src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts", + "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", + "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", + "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", + "src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts", + "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", "src/main/browser/browser-session-startup.test.ts", "src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts", - "src/main/browser/browser-client-host-command-dispatcher.test.ts", - "src/main/browser/browser-network-tunnel-session.test.ts", - "src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts", - "src/main/browser/browser-network-tunnel-client.test.ts", - "src/main/browser/browser-network-tunnel-client-memory-budget.test.ts", - "src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts", - "src/main/browser/browser-network-deferred-socket.test.ts", - "src/main/browser/browser-network-execution-route.test.ts", - "src/main/browser/paired-runtime-browser-network-route.test.ts", - "src/main/browser/ssh-browser-network-execution-route.test.ts", - "src/main/browser/system-ssh-socks-client-socket.test.ts", + "src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", + "src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts", + "src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts", + "src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts", + "src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts", + "src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts", + "src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts", + "src/main/browser/network/execution-routes/browser-network-execution-route.test.ts", + "src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts", + "src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts", + "src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts", "src/main/ssh/system-transport/system-ssh-dynamic-forward-process.test.ts", "src/main/ssh/port-forwarding/ssh-port-forward.test.ts", - "src/main/browser/remote-browser-socks-server.test.ts", + "src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "src/main/runtime/runtime-binary-message-router.test.ts", "src/main/runtime/rpc/methods/browser-network-tunnel.test.ts", "src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts", @@ -6827,7 +6827,7 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-host-lease.test.ts", + "file": "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts", "assertions": [ "a client requests commands only with a delivery handler and accepts them only after an exact v1 echo", "an old host that omits the echo cannot deliver a command", @@ -6840,7 +6840,7 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts", + "file": "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", "assertions": [ "initial runtime_busy admission retries on bounded deterministic jitter and attaches when capacity returns", "initial admission expiry and explicit close release every timer and subscription", @@ -6855,7 +6855,7 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts", "assertions": [ "the optional reconciliation request is retained only after exact ready echo", "an older host can omit the echo without enabling reconciliation", @@ -6864,7 +6864,7 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-client-host.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts", "assertions": [ "reconciliation is advertised only when the composed host explicitly enables it beside complete inventory", "exact dispatcher authority exists before the first same-socket command can arrive", @@ -6877,13 +6877,13 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts", "assertions": [ "an acknowledged mutation replay uses the preserved dispatcher result without rerunning its handler" ] }, { - "file": "src/main/browser/paired-runtime-browser-client-host-composition.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts", "assertions": [ "exact route authority activates before the first page command", "each initial or reconnect attach samples a fresh exact executor inventory while the compatibility gate binds to the latest published snapshot", @@ -6902,7 +6902,7 @@ ] }, { - "file": "src/main/browser/browser-client-host-reconciliation-command-order.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts", "assertions": [ "reclaim, restore, and close are valid first commands only after exact reconciliation negotiation", "reclaim and restore failure cancels later navigation without running it", @@ -6911,7 +6911,7 @@ ] }, { - "file": "src/main/browser/browser-client-page-command-executor.test.ts", + "file": "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", "assertions": [ "in-flight create, ambiguous cleanup, and stale renderer authority snapshot as outcome unknown", "a destroyed exact guest snapshots as outcome unknown before executor retirement", @@ -6929,7 +6929,7 @@ ] }, { - "file": "src/main/browser/browser-client-page-reconciliation-adapters.test.ts", + "file": "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", "assertions": [ "reclaim moves one exact retained guest to a new authority without remounting", "DOM-preserving reclaim is rejected when the runtime authority changes", @@ -6939,27 +6939,27 @@ ] }, { - "file": "src/main/browser/browser-route-prepared-page-rekey.test.ts", + "file": "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", "assertions": [ "prepared authority rekeys without changing its opaque capability token", "stale, occupied, cross-page, and cross-renderer targets fail without mutation" ] }, { - "file": "src/main/browser/browser-client-page-command-integration.test.ts", + "file": "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", "assertions": [ "spontaneous exact guest destruction revokes active inventory before explicit page retirement" ] }, { - "file": "src/main/browser/browser-client-page-inventory.test.ts", + "file": "src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts", "assertions": [ "optional URLs compact by deterministic codepoint order without dropping required page identity", "an unencodable complete snapshot declines inventory negotiation instead of dropping a page" ] }, { - "file": "src/main/browser/paired-runtime-browser-client-host-registry.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts", "assertions": [ "one environment pairing revision shares one host composition", "a same-pairing runtime change preserves that composition and delegates exact authority replacement", @@ -6972,7 +6972,7 @@ ] }, { - "file": "src/main/browser/browser-client-network-route-registry.test.ts", + "file": "src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts", "assertions": [ "canonical execution-host keys share one route until the final page release", "native routes must name the exact authority runtime", @@ -6987,11 +6987,11 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-client-host-runtime.test.ts", + "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts", "assertions": ["pairing resolution failures preserve the asynchronous start contract"] }, { - "file": "src/main/browser/browser-client-host-command-dispatcher.test.ts", + "file": "src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", "assertions": [ "commands execute FIFO per page while only exact payload-matched duplicates replay without rerunning side effects", "authority, sequence, generation, and create dependencies fence stale or ambiguous commands", @@ -7056,7 +7056,7 @@ ] }, { - "file": "src/main/browser/browser-network-tunnel-session.test.ts", + "file": "src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts", "assertions": [ "destination writes replenish client credit only after settlement", "stale generations and reused stream IDs cannot replace the current destination", @@ -7067,14 +7067,14 @@ ] }, { - "file": "src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts", + "file": "src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts", "assertions": [ "multiple execution-host routes share browser-host application-byte admission in both traffic directions", "route close releases aggregate claims exactly before stale destination-write callbacks" ] }, { - "file": "src/main/browser/browser-network-tunnel-client.test.ts", + "file": "src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts", "assertions": [ "source writes never exceed granted credit or the bounded data-frame size", "destination credit tracks only browser-facing socket writes that settle after readable consumption", @@ -7086,7 +7086,7 @@ ] }, { - "file": "src/main/browser/browser-network-tunnel-client-memory-budget.test.ts", + "file": "src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts", "assertions": [ "multiple client routes on one browser host share source-write application admission", "destination copies remain charged through browser-facing socket settlement", @@ -7094,7 +7094,7 @@ ] }, { - "file": "src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts", + "file": "src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts", "assertions": [ "application, encrypted-queue, and native socket bytes share one host ceiling", "distinct hosts share one process ceiling with exact release", @@ -7110,7 +7110,7 @@ ] }, { - "file": "src/main/browser/remote-browser-socks-server.test.ts", + "file": "src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "assertions": [ "domain CONNECT preserves the final execution-host DNS target", "unsupported commands and unavailable routes open no fallback destination" @@ -7133,7 +7133,7 @@ ] }, { - "file": "src/main/browser/paired-runtime-browser-network-route.test.ts", + "file": "src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts", "assertions": [ "route teardown closes a subscription that resolves after startup cancellation", "close after subscription acquisition settles the pending readiness wait", @@ -7150,21 +7150,21 @@ ] }, { - "file": "src/main/browser/browser-network-deferred-socket.test.ts", + "file": "src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts", "assertions": [ "destroy before source attachment emits one close and destroys a late source", "source close after destroy cannot emit duplicate wrapper close" ] }, { - "file": "src/main/browser/browser-network-execution-route.test.ts", + "file": "src/main/browser/network/execution-routes/browser-network-execution-route.test.ts", "assertions": [ "execution-host route keys cannot collide on delimiter-containing identities", "native routing accepts only the exact runtime revision without retaining an invalidation callback" ] }, { - "file": "src/main/browser/ssh-browser-network-execution-route.test.ts", + "file": "src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts", "assertions": [ "missing and stale SSH provider authority is rejected before destination open", "ssh2 forwardOut receives the exact domain and port without desktop resolution", @@ -7175,7 +7175,7 @@ ] }, { - "file": "src/main/browser/system-ssh-socks-client-socket.test.ts", + "file": "src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts", "assertions": [ "the internal SOCKS5 client encodes the exact destination as a domain request" ] @@ -7244,7 +7244,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-host-lease-reconnect-delay.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", "result": "passed", "durationSeconds": 3.61, "summary": "On the #14753 tip, sixteen files passed 167 exact terminal navigation/route fencing, retained reconnect grace, placement retirement, attach, command, result, route recovery, admission, and mixed-version protocol assertions. The new composition oracle was 1 failed / 10 passed before implementation because terminal host loss started asynchronous close without first suspending routes or revoking navigation." @@ -7263,6 +7263,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", "result": "passed", "durationSeconds": 7.89, "summary": "On origin/main@5b7f44278a, two files passed 16 authenticated per-device/global browser-host admission, shared wait reservation, exact socket-counter release, bounded initial runtime_busy retry, explicit-close cleanup, and reconnect-grace authority-preservation tests." @@ -7272,7 +7273,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-host-lease-reconnect-delay.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", "result": "passed", "durationSeconds": 7.18, "summary": "On origin/main@5b7f44278a, fifteen files passed 159 mixed-version attach, exact authority, bounded admission and recovery, reconnect, route suspension, page-command replay, result-ledger, and authenticated lease tests." @@ -7282,7 +7283,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-host-lease-reconnect-delay.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", "result": "passed", "durationSeconds": 2.23, "summary": "Fourteen files passed 150 negotiated same-client reconnect, legacy skew, active takeover, exact authority, immediate route suspension, independently bounded route retry, stable fail-closed SOCKS, ready-before-replay, completed-mutation dedupe, partial-replay delivery recovery, repeated-loss, stale-callback, explicit-revocation, grace cleanup, and deterministic jittered-backoff tests." @@ -7292,7 +7293,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-inventory.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-inventory.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-plan.test.ts", "result": "passed", "durationSeconds": 7.3, "summary": "Eleven files passed 145 exact inventory negotiation, 256-page and 768 KiB atomic bounds, worst-case JSON-escaped inventory identities, deterministic optional-URL compaction, legacy-command preservation when inventory is unencodable, legacy strip, immutable authenticated lease snapshot, strict v1/duplicate/foreign-client rejection, paired-device-bound previous-runtime restart admission, missing and unsolicited echo, create-to-active deduplication, renderer/guest-stale outcome-unknown classification, normalized URL bounds, composition sampling, RPC retention, and reconciliation tests." @@ -7302,6 +7303,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", "result": "passed", "durationSeconds": 0.8, "summary": "Fifty tests passed synchronous authority activation, hard 16/256 result bounds, exact transport-close-before-handler-abort ordering, cleanup rejection with guaranteed abort, same-socket result settlement, exact page retirement and forgetting, and late non-cooperative retirement settlement. The broader runtime/browser/shared run passed 9,711 tests with 24 existing skips." @@ -7320,6 +7322,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", "result": "passed", "durationSeconds": 0.2, "summary": "Sixteen tests passed immutable lease/command/result snapshots, exact-authority FIFO dispatch, payload-matched duplicate replay, transactional bounded admission, create dependency failure, stale and forgotten-generation fencing, scheduler replacement, retired-cache release, per-page and global cached-result expiry, pre-abort shared retirement publication, deduplicated/reentrant joining, cancellation, and bounded close." @@ -7338,7 +7341,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/remote-browser-socks-server.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/remote-browser-socks-server.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "result": "passed", "durationSeconds": 3.9, "summary": "Sixteen files passed 154 bounded page-command negotiation, legacy ready/revoked compatibility, exact authority, unnegotiated and stale-command delivery, lease, tunnel, memory, flow-control, SOCKS, and paired E2EE tests." @@ -7366,7 +7369,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/remote-browser-socks-server.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/remote-browser-socks-server.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "result": "passed", "durationSeconds": 7.7, "summary": "Sixteen files passed 131 route, lease, aggregate application/encrypted/native memory, exact release, bounded-drain, stable-listener and protocol-failure reconnect, v1 reattach compatibility, generation/stream-ID fencing, SOCKS, and real paired E2EE tests; the full runtime-RPC suite separately passed 1,349 tests with one skip." @@ -7376,6 +7379,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/remote-browser-socks-server.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "result": "passed", "durationSeconds": 6.9, "summary": "Eleven files passed 73 admission, lease, route-generation, bidirectional retained-byte/chunk, pending-open/rate, exact-release, SOCKS, and real paired E2EE tests; the full runtime-RPC suite separately passed 1,347 tests with one skip." @@ -7385,6 +7389,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/browser-network-tunnel-session.test.ts src/main/browser/remote-browser-socks-server.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "result": "passed", "durationSeconds": 3.4, "summary": "Eleven files passed 67 lease, reserved long-poll and host admission, token-safe placement retirement, authority, capability, route-generation, adversarial-revocation, lifecycle, flow-control, SOCKS, and real paired E2EE tests." @@ -7394,6 +7399,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-network-tunnel-client.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/runtime-binary-message-router.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/runtime-binary-message-router.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts", "result": "passed", "durationSeconds": 4.7, "summary": "Five files passed 19 source-flow, settled-consumption, chunk-bound, ordered-close, readiness-deadline, cleanup-failure, binary-routing, attach-authorization, and real paired-runtime E2EE SOCKS-to-HTTP tests." @@ -7482,22 +7488,22 @@ "invariant": "A client-hosted partition is derived only in main from stable Orca-profile, browser-profile, authority-connection, and execution-host identities. Raw identities and individually linkable component hashes never enter its path-safe partition name. Durable binding metadata must match and precede Chromium partition data before reuse. One live partition never changes execution host or proxy endpoint. Fixed SOCKS5 setup starts immediately after Session creation, before policy installation can yield or a persisted worker is awakened; no partition enters the webview allowlist until browser policy is installed, inherited connections are closed, and resolveProxy returns exactly that one listener. Initial route-partition attachment is blank-only. Its exact WebContents is quarantined before applying non-proxied WebRTC denial and remains navigation- and popup-denied if policy application or cleanup fails. Distinct live partitions, retained logical page generations, durable bindings, and binding-file reads remain bounded. No UDP transport a route-partition page can reach — WebRTC, WebTransport, or forced QUIC — emits a datagram to the desktop, the Direct Sockets constructors stay absent from every guest so no page can kill its renderer, and the process never enables a DoH host-resolver mode.", "oracle": "Derive two delimiter-adversarial identities and require distinct full-digest path-safe partitions with no raw IDs or component hashes. Persist one binding, reload it, and reject replacement, malformed or oversized state, Chromium data without matching metadata, and the 513th binding. Prepare one partition and require setProxy with <-loopback> to be invoked immediately after getSession and before policy setup, then closeAllConnections and exact SOCKS5 resolveProxy while isAllowedPartition remains false; only then may it become live. Reject DIRECT, endpoint retargeting, and capacity overflow. Require quarantine before disable_non_proxied_udp and admission; under real Electron require the unprotected control to emit STUN and the protected guest to emit zero direct UDP packets.", "commands": [ - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-identity.test.ts src/main/browser/browser-route-partition-binding-store.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-session-registry.test.ts src/main/browser/browser-session-startup.test.ts src/main/window/createMainWindow.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-webcontents-registry.test.ts src/main/browser/browser-route-webrtc-egress.electron.test.ts" + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/partitions/browser-route-identity.test.ts src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/browser-session-registry.test.ts src/main/browser/browser-session-startup.test.ts src/main/window/createMainWindow.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts" ], "testFiles": [ - "src/main/browser/browser-route-identity.test.ts", - "src/main/browser/browser-route-partition-binding-store.test.ts", - "src/main/browser/browser-route-session-registry.test.ts", - "src/main/browser/browser-route-webrtc-egress.electron.test.ts", - "src/main/browser/browser-route-webcontents-registry.test.ts", + "src/main/browser/routing/partitions/browser-route-identity.test.ts", + "src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts", + "src/main/browser/routing/sessions/browser-route-session-registry.test.ts", + "src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts", + "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", "src/main/browser/browser-session-registry.test.ts", "src/main/browser/browser-session-startup.test.ts", "src/main/window/createMainWindow.test.ts" ], "assertionRefs": [ { - "file": "src/main/browser/browser-route-identity.test.ts", + "file": "src/main/browser/routing/partitions/browser-route-identity.test.ts", "assertions": [ "aggregate partition and durable binding fingerprints are stable and opaque", "delimiter-containing identities remain structurally distinct", @@ -7506,7 +7512,7 @@ ] }, { - "file": "src/main/browser/browser-route-partition-binding-store.test.ts", + "file": "src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts", "assertions": [ "opaque bindings survive restart", "replacement and malformed metadata fail closed", @@ -7515,7 +7521,7 @@ ] }, { - "file": "src/main/browser/browser-route-session-registry.test.ts", + "file": "src/main/browser/routing/sessions/browser-route-session-registry.test.ts", "assertions": [ "policy, proxy, connection closure, and verification finish before allowlisting", "DIRECT and endpoint retargeting are rejected", @@ -7527,14 +7533,14 @@ ] }, { - "file": "src/main/browser/browser-route-webrtc-egress.electron.test.ts", + "file": "src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts", "assertions": [ "the unprotected SOCKS-partition control emits direct STUN packets", "disable_non_proxied_udp leaves the exact guest with zero direct UDP packets" ] }, { - "file": "src/main/browser/browser-route-webcontents-registry.test.ts", + "file": "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", "assertions": [ "route guests apply non-proxied WebRTC denial before admission", "policy failure remains quarantined through delayed or failed guest close" @@ -7554,6 +7560,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-webcontents-registry.test.ts src/main/browser/browser-route-webrtc-egress.electron.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts", "result": "passed", "durationSeconds": 8, "summary": "Two files passed 24 assertions; the real Electron control emitted direct STUN, while the exact per-guest policy emitted zero desktop UDP packets and policy failure remained quarantined through delayed or failed close." @@ -7563,6 +7570,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-identity.test.ts src/main/browser/browser-route-partition-binding-store.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-session-registry.test.ts src/main/browser/browser-session-startup.test.ts src/main/window/createMainWindow.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/partitions/browser-route-identity.test.ts src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/browser-session-registry.test.ts src/main/browser/browser-session-startup.test.ts src/main/window/createMainWindow.test.ts", "result": "passed", "durationSeconds": 0.5, "summary": "Six files passed 150 opaque identity, durable collision binding, bounded partition/page, proxy-before-allowlist, policy reuse, profile startup, and blank-only attach tests." @@ -7578,7 +7586,7 @@ }, "redGreenEvidence": { "status": "partial", - "evidence": "The TCP A/B control first reached all six target paths directly, while the fixed SOCKS arm routed the same HTTP, HTTPS, WebSocket, redirect, subresource, and download traffic plus remote DNS with zero direct target connections. The two-launch worker control reached desktop localhost before setProxy; immediate setProxy routed the same wake and later fetch through SOCKS. The WebRTC control emitted four direct STUN packets until disable_non_proxied_udp reduced the capture to zero. Non-WebRTC UDP and network-service restart remain explicit residuals. Historical receipts before removing the source-only tests, preserved verbatim with their originally executed commands (the narrowed commands were not rerun here): [{\"date\":\"2026-08-20\",\"runner\":\"local\",\"platform\":\"macos\",\"command\":\"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-h3-egress.electron.test.ts src/main/browser/browser-route-dns-prefetch.electron.test.ts src/main/startup/secure-dns-census.test.ts\",\"result\":\"passed\",\"durationSeconds\":21,\"summary\":\"The direct control emitted 5 WebTransport and 6 forced-QUIC datagrams while the SOCKS route partition emitted zero of each. With Direct Sockets explicitly enabled the control exposed TCPSocket/UDPSocket/TCPServerSocket and constructing one killed the guest renderer; the shipped disable-features list left all three undefined and the renderer alive. The dns-prefetch tripwire recorded HOST_RESOLVER_SYSTEM_TASK for the prefetched host with zero events for an unreferenced control host, documenting the accepted local-resolution residual.\",\"notes\":\"The dns-prefetch expectation intentionally asserts the leak. Flip it to an empty event list when the upstream Electron PrefetchDNS fix lands.\"}] Archived provider-experiment receipts after removing the standalone TCP and persisted-worker suites, preserved verbatim with their originally executed commands (remaining and narrowed commands were not rerun here): [\n {\n \"date\": \"2026-08-17\",\n \"runner\": \"local\",\n \"platform\": \"macos\",\n \"command\": \"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-tcp-egress.electron.test.ts\",\n \"result\": \"passed\",\n \"durationSeconds\": 1,\n \"summary\": \"The real Electron direct control reached all six TCP request surfaces; the fixed SOCKS session carried HTTP, HTTPS, WebSocket, redirects, subresources, downloads, and remote DNS with zero direct target connections.\"\n },\n {\n \"date\": \"2026-08-16\",\n \"runner\": \"local\",\n \"platform\": \"macos\",\n \"command\": \"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-persisted-worker-egress.electron.test.ts src/main/browser/browser-route-webrtc-egress.electron.test.ts\",\n \"result\": \"passed\",\n \"durationSeconds\": 10,\n \"summary\": \"Three files passed 28 tests. The two-launch worker control reached desktop localhost before proxy setup; immediate setProxy invocation routed the same wake and a later worker fetch through SOCKS with path-attributed direct counts remaining zero. Both resolved and rejected proxy setup keep failed-policy retries joined through connection cleanup. The protected WebRTC guest emitted zero direct UDP packets.\"\n }\n ]" + "evidence": "The TCP A/B control first reached all six target paths directly, while the fixed SOCKS arm routed the same HTTP, HTTPS, WebSocket, redirect, subresource, and download traffic plus remote DNS with zero direct target connections. The two-launch worker control reached desktop localhost before setProxy; immediate setProxy routed the same wake and later fetch through SOCKS. The WebRTC control emitted four direct STUN packets until disable_non_proxied_udp reduced the capture to zero. Non-WebRTC UDP and network-service restart remain explicit residuals. Historical receipts before removing the source-only tests, preserved verbatim with their originally executed commands (the narrowed commands were not rerun here): [{\"date\":\"2026-08-20\",\"runner\":\"local\",\"platform\":\"macos\",\"command\":\"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-h3-egress.electron.test.ts src/main/browser/browser-route-dns-prefetch.electron.test.ts src/main/startup/secure-dns-census.test.ts\",\"result\":\"passed\",\"durationSeconds\":21,\"summary\":\"The direct control emitted 5 WebTransport and 6 forced-QUIC datagrams while the SOCKS route partition emitted zero of each. With Direct Sockets explicitly enabled the control exposed TCPSocket/UDPSocket/TCPServerSocket and constructing one killed the guest renderer; the shipped disable-features list left all three undefined and the renderer alive. The dns-prefetch tripwire recorded HOST_RESOLVER_SYSTEM_TASK for the prefetched host with zero events for an unreferenced control host, documenting the accepted local-resolution residual.\",\"notes\":\"The dns-prefetch expectation intentionally asserts the leak. Flip it to an empty event list when the upstream Electron PrefetchDNS fix lands.\"}] Archived provider-experiment receipts after removing the standalone TCP and persisted-worker suites, preserved verbatim with their originally executed commands (remaining and narrowed commands were not rerun here): [\n {\n \"date\": \"2026-08-17\",\n \"runner\": \"local\",\n \"platform\": \"macos\",\n \"command\": \"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-route-tcp-egress.electron.test.ts\",\n \"result\": \"passed\",\n \"durationSeconds\": 1,\n \"summary\": \"The real Electron direct control reached all six TCP request surfaces; the fixed SOCKS session carried HTTP, HTTPS, WebSocket, redirects, subresources, downloads, and remote DNS with zero direct target connections.\"\n },\n {\n \"date\": \"2026-08-16\",\n \"runner\": \"local\",\n \"platform\": \"macos\",\n \"command\": \"pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/browser-route-persisted-worker-egress.electron.test.ts src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts\",\n \"result\": \"passed\",\n \"durationSeconds\": 10,\n \"summary\": \"Three files passed 28 tests. The two-launch worker control reached desktop localhost before proxy setup; immediate setProxy invocation routed the same wake and a later worker fetch through SOCKS with path-attributed direct counts remaining zero. Both resolved and rejected proxy setup keep failed-policy retries joined through connection cleanup. The protected WebRTC guest emitted zero direct UDP packets.\"\n }\n ]" }, "performanceBudget": { "required": true, @@ -7632,20 +7640,20 @@ "invariant": "A prepared route page binds its opaque authority to one exact main-observed renderer WebContents while that page generation is active or retiring. Before requesting a blank guest, the production command executor must retain the exact execution-host route, verify its key, and prepare the route/profile partition for one still-current renderer generation. Main sends the approved opaque partition and exact page generation, but no target URL, through one bounded request admitted against the exact current renderer object and document generation; only a schema-valid reply from that same object, request, operation, and page generation can settle it. Preload accepts requests only in the top frame, binds outcomes to the admitted request, fails overflow and unavailable subscribers within a bounded interval, and fences callbacks replaced by a newer document subscriber. Renderer retains each blank webview under one non-React document host keyed by the exact partition, page ID, and generation, never reparents it, and holds an attached or process-lost generation until exact destruction. Renderer replacement, WebContents-ID reuse, abort, timeout, malformed reply, disposal, and process loss fence pending work without admitting a late reply. Renderer-document replacement retires before commit, while blocked external navigation is ignored and failed or cancelled provisional navigation restores only the exact surviving frame. A WebContents whose Electron Session has belonged to a prepared route partition is quarantined synchronously after generic guest policy installation, including when page authority disappears between will-attach and did-attach. It must be a live blank webview owned by the exact renderer WebContents. Nonblank navigation remains denied until main matches the exact partition, browser page, page-host generation, guest WebContents, renderer WebContents, and opaque live page authority, then issues a separate grant. Every later navigation rechecks the same opaque guest incarnation and page authority, so reusing a logical tuple or WebContents ID cannot revive a stale guest. Releasing that authority, losing or destroying the guest process, or losing its owning renderer before, during, or after registration synchronously fences pending authority admission, ends exact logical authority, revokes navigation, and closes any attached guest through the same retirement barrier. Failed, aborted, or retired creation attempts revoke the exact guest and renderer mount before releasing the Session and route, attempt every safe cleanup, and never clear or admit a replacement generation after uncertain cleanup. Session and route release require exact guest destruction proof; an ambiguous mount outcome retains them. If close is delayed or fails, the partition stays outside attachment admission and route policies remain installed until the exact destroyed acknowledgement. Route popups remain denied throughout. Active and retiring page maps and pending renderer requests are bounded, stale callbacks cannot retire or clear replacements, and non-route browser guests retain existing behavior.", "oracle": "Prepare a page for one renderer and require authority lookup and registration by a sibling renderer to fail; reject owner replacement while the generation is active or retiring, then lose the owning renderer before guest registration and require only its prepared pages to retire. Pause partition setup, lose the owner, and require its waiter to fail without authority; add a live sibling waiter to the same pending setup and require only that waiter to admit; exceed the configured waiter cap and require immediate refusal. Make policy cleanup throw in the first of two owned partitions and require the sweep to retire both without restoring admission. Through the production executor, retain one exact route, prepare its partition, mount blank on one current renderer, register and grant the exact guest in order, then load only its normalized HTTP(S) URL. Queue renderer requests before subscription, replace one subscriber, overflow both request and page budgets, race attachment with retirement, delay guest identity until DOM readiness, lose the guest renderer, and require exact bounded settlement without reparenting or cross-partition collision. Under real Electron, require the main bridge to accept only the actual main-frame reply, match the positive renderer WebContents ID to did-attach-webview, destroy it on retirement, and reject and remove a denied unprepared guest. Reject a mismatched route, stale renderer or page generation, and file URL without touching Chromium. Abort or fail registration after mount and require exact guest, renderer, Session, and route cleanup in that order; make renderer cleanup reject but require destruction before later release, and keep the generation fenced from replacement. Make guest retirement fail or mount outcome ambiguous and require every safe cleanup while Session and route remain retained. Destroy a guest spontaneously before command cleanup, reuse its WebContents identity, and require the old opaque claim not to retire the replacement while the replacement claim still can. Attach a blank route guest and require nonblank navigation plus every popup to be denied. Reject a wrong renderer, wrong page generation, nonblank initial document, wrong WebContents type, destroyed guest, and excess attachment; delay or fail its close and require navigation and popups to remain denied. Register the exact prepared tuple and prove navigation remains denied until a second grant; then allow repeated HTTP(S) navigation while continuing to deny file navigation and popups. Release logical page authority with delayed guest close; require immediate navigation revocation, one exact close, no partition admission, no policy cleanup, and same-tuple preparation refusal until destroyed acknowledgement. Make destroyed inspection throw and require retirement plus navigation to remain fail-closed until the explicit destroyed event. Acknowledge destruction, require one policy cleanup, reprepare the tuple, replay stale acknowledgement, and prove the replacement remains admitted. Make retirement startup throw and require policy plus capacity to remain fail-closed. Retire two pages sharing one partition and require cleanup only after both exact acknowledgements. Emit guest render-process-gone and destroyed, and emit owning-renderer process loss through the main-window boundary; require exact logical retirement, close, and grant revocation while unrelated renderer guests and prepared pages survive. Reject retirement for the wrong opaque authority. Reprepare after ordinary release, require a new opaque authority, deny the stale guest, and admit an exact replacement. Destroy a registered guest under real destroyed state, verify best-effort listener release, replay stale cleanup, and prove its replacement remains grantable. Mutate caller input after registration and prove main-owned authority is unchanged. Attach a normal browser Session and require no route-registry mutation.", "commands": [ - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-renderer-bridge.test.ts src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/browser-client-page-renderer-runtime.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-renderer-bridge.test.ts src/main/browser/browser-client-page-renderer-runtime.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-reconciliation-adapters.test.ts src/main/browser/browser-route-prepared-page-rekey.test.ts" + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts" ], "testFiles": [ - "src/main/browser/browser-client-page-command-executor.test.ts", - "src/main/browser/browser-client-page-command-integration.test.ts", - "src/main/browser/browser-client-page-reconciliation-adapters.test.ts", - "src/main/browser/browser-client-page-renderer-bridge.test.ts", - "src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts", - "src/main/browser/browser-client-page-renderer-runtime.test.ts", - "src/main/browser/browser-route-session-registry.test.ts", - "src/main/browser/browser-route-prepared-page-rekey.test.ts", - "src/main/browser/browser-route-webcontents-registry.test.ts", + "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", + "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", + "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", + "src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts", + "src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts", + "src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts", + "src/main/browser/routing/sessions/browser-route-session-registry.test.ts", + "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", + "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", "src/preload/browser-client-page-renderer-requests.test.ts", "src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts", "src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts", @@ -7654,7 +7662,7 @@ ], "assertionRefs": [ { - "file": "src/main/browser/browser-client-page-command-executor.test.ts", + "file": "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", "assertions": [ "exact execution route and trusted renderer precede blank guest registration and grant", "navigation targets only the retained opaque guest incarnation and exact generation and rejects local files", @@ -7664,20 +7672,20 @@ ] }, { - "file": "src/main/browser/browser-client-page-command-integration.test.ts", + "file": "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", "assertions": [ "a fresh new-authority dispatcher reclaims an old-authority executor page while real route Session and WebContents registries preserve exact cleanup" ] }, { - "file": "src/main/browser/browser-client-page-reconciliation-adapters.test.ts", + "file": "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", "assertions": [ "exact reclaim preserves the guest while rekeying renderer, Session, lifecycle claim, and navigation authority", "rekey uncertainty retires both possible renderer identities and failed restore navigation destroys the affected guest before releasing retained resources" ] }, { - "file": "src/main/browser/browser-client-page-renderer-bridge.test.ts", + "file": "src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts", "assertions": [ "mount requests carry only the main-approved partition and exact page generation to the exact current main-frame document", "sender spoofing, subframe replies, stale document frames, malformed replies, renderer replacement, WebContents-ID reuse, abort, and late replies fail closed", @@ -7686,14 +7694,14 @@ ] }, { - "file": "src/main/browser/browser-client-page-renderer-runtime.test.ts", + "file": "src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts", "assertions": [ "one app-lifetime reply listener binds the exact current Electron renderer to the bridge", "mount settlement and renderer retirement use the production IPC channel wiring" ] }, { - "file": "src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts", + "file": "src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts", "assertions": [ "real Electron binds replies to the current main frame and matches the renderer guest ID to did-attach-webview", "a document-owned blank webview survives attachment and is destroyed without reparenting on retirement", @@ -7716,7 +7724,7 @@ ] }, { - "file": "src/main/browser/browser-route-session-registry.test.ts", + "file": "src/main/browser/routing/sessions/browser-route-session-registry.test.ts", "assertions": [ "a prepared Electron Session remains recognizable for late-attachment quarantine", "prepared authority is bound to one renderer and owner loss retires unregistered pages", @@ -7725,14 +7733,14 @@ ] }, { - "file": "src/main/browser/browser-route-prepared-page-rekey.test.ts", + "file": "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", "assertions": [ "prepared authority moves only across an exact same-page same-renderer generation change", "rekey preserves the opaque authority and leaves stale or conflicting input unchanged" ] }, { - "file": "src/main/browser/browser-route-webcontents-registry.test.ts", + "file": "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", "assertions": [ "route guests remain blank and popup-denied before exact registration and grant", "guest, renderer, partition, and logical page generation must all match", @@ -7770,6 +7778,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-renderer-bridge.test.ts src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/browser-client-page-renderer-runtime.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", "result": "passed", "durationSeconds": 1.22, "summary": "On the candidate atop #14753, twelve files passed 132 exact opaque-claim navigation revocation, in-flight create fencing, revocation-error cleanup, retained guest destruction separation, route Session, renderer bridge/registry, Electron lifecycle, and main-window document assertions." @@ -7779,6 +7788,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-renderer-bridge.test.ts src/main/browser/browser-client-page-renderer-runtime.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", "result": "passed", "durationSeconds": 0.8, "summary": "Eight files and 174 tests passed deterministic route retention, trusted-renderer create ordering, exact renderer WebContents and main-frame-document fencing, subframe and stale-frame rejection, wrong-page and wrong-operation rejection, timeout/send/collision settlement, renderer-document replacement retirement, blocked external and same-document preservation, failed provisional restoration, stale same-URL failure rejection during a live replacement, concurrent failure plus blocked replacement convergence, production IPC wiring, composed real Session/WebContents registry lifecycle, abort and cleanup fencing, Session-index and prepared-owner fencing, bounded pending waiters, late/rejected route-WebContents quarantine, opaque-authority and process-loss fencing, fail-closed shared-partition release barriers, exact registration and navigation, popup denial, and main-window ordering tests." @@ -7788,6 +7798,7 @@ "runner": "local", "platform": "macos", "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-renderer-bridge.test.ts src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/browser-client-page-renderer-runtime.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", "result": "passed", "durationSeconds": 2.7, "summary": "Twelve files and 199 tests passed the existing main authority gate plus top-frame preload queueing, bounded outcomes, exact retained renderer tuples, delayed guest-ID readiness, idempotent retirement, resource budgets, process-loss fencing, and real Electron main-frame reply, blank attachment, denial, and destruction lifecycle." @@ -7857,8 +7868,8 @@ "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orca-runtime-browser-client-hosted.test.ts src/main/runtime/runtime-browser-client-page-creation.test.ts src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts src/main/runtime/browser-host/browser-host-capability-selection.test.ts src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts", "SKIP_BUILD=1 ORCA_CROSS_VERSION_PACKAGED_EXECUTABLE=/Applications/Orca.app/Contents/MacOS/Orca pnpm exec playwright test tests/e2e/packaged-mixed-version-browser-placement.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1", - "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/browser/browser-network-execution-route.test.ts src/main/browser/wsl-browser-network-execution-route.test.ts src/main/browser/wsl-browser-network-relay-launch.test.ts src/main/runtime/runtime-browser-network-execution-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-screencast-lifecycle.test.ts src/main/browser/browser-screencast-stream.test.ts src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/browser/network/execution-routes/browser-network-execution-route.test.ts src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.test.ts src/main/runtime/runtime-browser-network-execution-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/cdp/screencast/browser-screencast-lifecycle.test.ts src/main/browser/cdp/screencast/browser-screencast-stream.test.ts src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts", "ORCA_RUN_DOCKER_SSH_BROWSER_E2E=1 pnpm exec vitest run --config config/vitest.config.ts tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts", "Manual iOS 26.5 simulator: pair current mobile code to packaged Orca 1.4.184; create Browser; navigate to https://example.com; require one visible Example Domain tab on the server-hosted surface", "ORCA_RUN_DOCKER_SSH_BROWSER_E2E=1 node_modules/.bin/vitest run --config config/vitest.config.ts tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts" @@ -7875,13 +7886,13 @@ "src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts", "tests/e2e/packaged-mixed-version-browser-placement.spec.ts", "src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts", - "src/main/browser/paired-runtime-browser-network-route.test.ts", - "src/main/browser/browser-network-execution-route.test.ts", - "src/main/browser/wsl-browser-network-execution-route.test.ts", - "src/main/browser/wsl-browser-network-relay-launch.test.ts", + "src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts", + "src/main/browser/network/execution-routes/browser-network-execution-route.test.ts", + "src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts", + "src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.test.ts", "src/main/runtime/runtime-browser-network-execution-host.test.ts", - "src/main/browser/browser-screencast-lifecycle.test.ts", - "src/main/browser/browser-screencast-stream.test.ts", + "src/main/browser/cdp/screencast/browser-screencast-lifecycle.test.ts", + "src/main/browser/cdp/screencast/browser-screencast-stream.test.ts", "src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts", "tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts" ], @@ -7972,7 +7983,7 @@ "result": "passed", "durationSeconds": 1.2, "summary": "22 screencast lifecycle, stream, and shared-fanout tests passed; the suite confirms one physical CDP stream fans out independently to multiple viewers, preserves viewport ownership, and cleans up without cross-viewer eviction.", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-screencast-lifecycle.test.ts src/main/browser/browser-screencast-stream.test.ts src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts" + "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/cdp/screencast/browser-screencast-lifecycle.test.ts src/main/browser/cdp/screencast/browser-screencast-stream.test.ts src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts" }, { "date": "2026-09-06", diff --git a/config/scripts/browser-session-startup-metadata-benchmark.mjs b/config/scripts/browser-session-startup-metadata-benchmark.mjs index e1b5ca1cdca..7fcc4b184b0 100644 --- a/config/scripts/browser-session-startup-metadata-benchmark.mjs +++ b/config/scripts/browser-session-startup-metadata-benchmark.mjs @@ -57,6 +57,14 @@ const stubs = new Map([ const registryByVersion = {} try { for (const [version, source] of Object.entries(sources)) { + const versionStubs = new Map( + [...stubs].map(([specifier, body]) => [ + version === 'after' && specifier === './browser-session-route-policies' + ? './routing/sessions/browser-session-route-policies' + : specifier, + body + ]) + ) const output = join(scratch, `${version}.cjs`) await build({ stdin: { contents: source, sourcefile: target, resolveDir: dirname(target), loader: 'ts' }, @@ -69,7 +77,7 @@ try { name: 'isolate-startup-metadata', setup(builder) { builder.onResolve({ filter: /.*/ }, (args) => { - if (args.importer === target && stubs.has(args.path)) { + if (args.importer === target && versionStubs.has(args.path)) { return { path: args.path, namespace: 'startup-stub' } } if ( @@ -83,7 +91,7 @@ try { contents: args.path === 'fs-probe' ? `import * as fs from 'node:fs'; export const {mkdirSync,renameSync,writeFileSync}=fs; export function readFileSync(...args){const result=fs.readFileSync(...args);globalThis.__metaBench.reads++;globalThis.__metaBench.bytes+=Buffer.byteLength(result);return result}` - : stubs.get(args.path), + : versionStubs.get(args.path), loader: 'js' })) } diff --git a/config/scripts/ci-e2e-job-selection.test.mjs b/config/scripts/ci-e2e-job-selection.test.mjs index 3e83fb7243a..431c1fd0347 100644 --- a/config/scripts/ci-e2e-job-selection.test.mjs +++ b/config/scripts/ci-e2e-job-selection.test.mjs @@ -72,7 +72,7 @@ it('retains allocations when selection evidence is incomplete', () => { it('preserves the requested specs across source-routed and mixed selections', () => { for (const files of [ - ['src/main/browser/ssh-browser-network-execution-route.ts'], + ['src/main/browser/network/execution-routes/ssh-browser-network-execution-route.ts'], ['src/shared/terminal-unicode-provider.ts'], [NODE_NETWORK_E2E_SPEC, 'tests/e2e/future-unclassified.spec.ts'] ]) { diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index eb95334fad0..2efb8ff1bd3 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -1268,59 +1268,59 @@ "src/main/browser/agent-browser/agent-browser-bridge-tab-routing.test.ts": 441, "src/main/browser/agent-browser/agent-browser-bridge-text-input.test.ts": 575, "src/main/browser/agent-browser/agent-browser-orphan-sweep.test.ts": 59, - "src/main/browser/agent-input-focus-guard.test.ts": 54, - "src/main/browser/agent-input-injection.test.ts": 299, - "src/main/browser/browser-agent-activity.test.ts": 128, + "src/main/browser/cdp/input/agent-input-focus-guard.test.ts": 54, + "src/main/browser/cdp/input/agent-input-injection.test.ts": 299, + "src/main/browser/guest-lifecycle/browser-agent-activity.test.ts": 128, "src/main/browser/browser-certificate-trust-controller.test.ts": 496, - "src/main/browser/browser-client-download-relay.test.ts": 124, - "src/main/browser/browser-client-download-routing.test.ts": 124, - "src/main/browser/browser-client-file-channel-negotiation.test.ts": 116, - "src/main/browser/browser-client-file-channel-reconnect.test.ts": 556, - "src/main/browser/browser-client-host-authority-replacement.test.ts": 47, - "src/main/browser/browser-client-host-command-dispatcher.test.ts": 156, - "src/main/browser/browser-client-host-command-retention.test.ts": 799, - "src/main/browser/browser-client-host-id.test.ts": 82, - "src/main/browser/browser-client-host-placement-preparation.test.ts": 161, - "src/main/browser/browser-client-host-reconciliation-command-order.test.ts": 169, - "src/main/browser/browser-client-network-route-registry.test.ts": 286, - "src/main/browser/browser-client-page-automation-runtime.test.ts": 53, - "src/main/browser/browser-client-page-command-executor-fencing.test.ts": 319, - "src/main/browser/browser-client-page-command-executor.test.ts": 320, - "src/main/browser/browser-client-page-command-integration.test.ts": 315, - "src/main/browser/browser-client-page-creation-cancellation.test.ts": 334, - "src/main/browser/browser-client-page-execution-host-supersession.test.ts": 322, - "src/main/browser/browser-client-page-inventory.test.ts": 186, - "src/main/browser/browser-client-page-metadata-transport.test.ts": 100, - "src/main/browser/browser-client-page-profile-binding.test.ts": 530, - "src/main/browser/browser-client-page-profile-switch.test.ts": 312, - "src/main/browser/browser-client-page-reconciliation-adapters.test.ts": 252, - "src/main/browser/browser-client-page-renderer-bridge.test.ts": 163, - "src/main/browser/browser-client-page-renderer-runtime.test.ts": 107, - "src/main/browser/browser-client-page-unavailability.test.ts": 258, - "src/main/browser/browser-client-page-upload-routing.test.ts": 303, - "src/main/browser/browser-client-route-cookie-import-partition-parity.test.ts": 374, - "src/main/browser/browser-client-route-cookie-import.test.ts": 101, - "src/main/browser/browser-client-upload-buffer-retention.test.ts": 736, - "src/main/browser/browser-client-upload-command.test.ts": 115, - "src/main/browser/browser-client-upload-staging.test.ts": 140, - "src/main/browser/browser-client-upload-transfer.test.ts": 93, - "src/main/browser/browser-command-cache-byte-retention.test.ts": 499, - "src/main/browser/browser-download-destination.test.ts": 66, - "src/main/browser/browser-element-functions.test.ts": 228, - "src/main/browser/browser-external-app-launch.test.ts": 96, + "src/main/browser/client-hosts/file-transfers/browser-client-download-relay.test.ts": 124, + "src/main/browser/client-hosts/file-transfers/browser-client-download-routing.test.ts": 124, + "src/main/browser/client-hosts/file-transfers/browser-client-file-channel-negotiation.test.ts": 116, + "src/main/browser/client-hosts/file-transfers/browser-client-file-channel-reconnect.test.ts": 556, + "src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement.test.ts": 47, + "src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts": 156, + "src/main/browser/client-hosts/commands/browser-client-host-command-retention.test.ts": 799, + "src/main/browser/client-hosts/lifecycle/browser-client-host-id.test.ts": 82, + "src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts": 161, + "src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts": 169, + "src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts": 286, + "src/main/browser/client-pages/execution/browser-client-page-automation-runtime.test.ts": 53, + "src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts": 319, + "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts": 320, + "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts": 315, + "src/main/browser/client-pages/lifecycle/browser-client-page-creation-cancellation.test.ts": 334, + "src/main/browser/client-pages/lifecycle/browser-client-page-execution-host-supersession.test.ts": 322, + "src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts": 186, + "src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.test.ts": 100, + "src/main/browser/client-pages/lifecycle/browser-client-page-profile-binding.test.ts": 530, + "src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts": 312, + "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts": 252, + "src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts": 163, + "src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts": 107, + "src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts": 258, + "src/main/browser/client-pages/lifecycle/browser-client-page-upload-routing.test.ts": 303, + "src/main/browser/cookies/client-route/browser-client-route-cookie-import-partition-parity.test.ts": 374, + "src/main/browser/cookies/client-route/browser-client-route-cookie-import.test.ts": 101, + "src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts": 736, + "src/main/browser/client-hosts/file-transfers/browser-client-upload-command.test.ts": 115, + "src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts": 140, + "src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.test.ts": 93, + "src/main/browser/client-hosts/commands/browser-command-cache-byte-retention.test.ts": 499, + "src/main/browser/downloads/browser-download-destination.test.ts": 66, + "src/main/browser/cdp/input/browser-element-functions.test.ts": 228, + "src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.test.ts": 96, "src/main/browser/browser-find-frame-traversal.electron.test.ts": 1807, - "src/main/browser/browser-google-cookie-clear-target.test.ts": 6235, + "src/main/browser/cookies/browser-google-cookie-clear-target.test.ts": 6235, "src/main/browser/browser-grab-payload.test.ts": 55, - "src/main/browser/browser-guest-devtools-dock.test.ts": 57, - "src/main/browser/browser-guest-shortcut-forwarding.test.ts": 320, - "src/main/browser/browser-guest-shortcut-plugin-frame.test.ts": 280, - "src/main/browser/browser-guest-shortcut-precedence.test.ts": 411, - "src/main/browser/browser-guest-target-url.test.ts": 50, - "src/main/browser/browser-guest-wheel-zoom-scroll.test.ts": 45, - "src/main/browser/browser-host-client-identity.test.ts": 97, - "src/main/browser/browser-http-auth-prompt.test.ts": 74, + "src/main/browser/guest-lifecycle/browser-guest-devtools-dock.test.ts": 57, + "src/main/browser/guest-lifecycle/input/browser-guest-shortcut-forwarding.test.ts": 320, + "src/main/browser/guest-lifecycle/input/browser-guest-shortcut-plugin-frame.test.ts": 280, + "src/main/browser/guest-lifecycle/input/browser-guest-shortcut-precedence.test.ts": 411, + "src/main/browser/guest-lifecycle/input/browser-guest-target-url.test.ts": 50, + "src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom-scroll.test.ts": 45, + "src/main/browser/client-hosts/leases/browser-host-client-identity.test.ts": 97, + "src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.test.ts": 74, "src/main/browser/browser-identity-mode-store.test.ts": 95, - "src/main/browser/browser-javascript-dialogs.test.ts": 54, + "src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.test.ts": 54, "src/main/browser/browser-manager-annotation-bridge.test.ts": 603, "src/main/browser/browser-manager-auth-user-agent.test.ts": 555, "src/main/browser/browser-manager-client-hosted-downloads.test.ts": 670, @@ -1347,42 +1347,42 @@ "src/main/browser/browser-manager-viewport-ownership.test.ts": 550, "src/main/browser/browser-manager-viewport-partial-failure.test.ts": 547, "src/main/browser/browser-manager-worker-request-user-agent.test.ts": 498, - "src/main/browser/browser-network-deferred-socket.test.ts": 101, - "src/main/browser/browser-network-execution-route.test.ts": 272, - "src/main/browser/browser-network-tunnel-client-memory-budget.test.ts": 116, - "src/main/browser/browser-network-tunnel-client.test.ts": 127, - "src/main/browser/browser-network-tunnel-conformance.test.ts": 136, - "src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts": 66, - "src/main/browser/browser-network-tunnel-proxy-dial-error.test.ts": 264, - "src/main/browser/browser-network-tunnel-proxy.test.ts": 312, - "src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts": 76, - "src/main/browser/browser-network-tunnel-session-stream-scoped-failure.test.ts": 74, - "src/main/browser/browser-network-tunnel-session.test.ts": 157, - "src/main/browser/browser-page-initiated-tab-budget.test.ts": 43, - "src/main/browser/browser-page-input-credit.test.ts": 50, - "src/main/browser/browser-page-prompts.test.ts": 74, - "src/main/browser/browser-partition-cookie-copy.test.ts": 159, - "src/main/browser/browser-popup-native-window.test.ts": 109, + "src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts": 101, + "src/main/browser/network/execution-routes/browser-network-execution-route.test.ts": 272, + "src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts": 116, + "src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts": 127, + "src/main/browser/network/tunnels/browser-network-tunnel-conformance.test.ts": 136, + "src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts": 66, + "src/main/browser/network/tunnels/browser-network-tunnel-proxy-dial-error.test.ts": 264, + "src/main/browser/network/tunnels/browser-network-tunnel-proxy.test.ts": 312, + "src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts": 76, + "src/main/browser/network/tunnels/browser-network-tunnel-session-stream-scoped-failure.test.ts": 74, + "src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts": 157, + "src/main/browser/guest-lifecycle/popups/browser-page-initiated-tab-budget.test.ts": 43, + "src/main/browser/routing/input-ownership/browser-page-input-credit.test.ts": 50, + "src/main/browser/guest-lifecycle/prompts/browser-page-prompts.test.ts": 74, + "src/main/browser/cookies/browser-partition-cookie-copy.test.ts": 159, + "src/main/browser/guest-lifecycle/popups/browser-popup-native-window.test.ts": 109, "src/main/browser/browser-process-user-agent.test.ts": 45, - "src/main/browser/browser-route-guest-popups.test.ts": 306, - "src/main/browser/browser-route-identity.test.ts": 47, - "src/main/browser/browser-route-partition-binding-capacity.test.ts": 81, - "src/main/browser/browser-route-partition-binding-store.test.ts": 133, - "src/main/browser/browser-route-partition-migration.test.ts": 157, - "src/main/browser/browser-route-partition-pending-deletes.test.ts": 64, - "src/main/browser/browser-route-partition-stability.test.ts": 305, - "src/main/browser/browser-route-partition-storage-dependencies.test.ts": 287, - "src/main/browser/browser-route-partition-storage-lifecycle.test.ts": 96, - "src/main/browser/browser-route-partition-storage-retirement.test.ts": 139, - "src/main/browser/browser-route-partition-storage-runtime.test.ts": 76, - "src/main/browser/browser-route-prepared-page-rekey.test.ts": 42, - "src/main/browser/browser-route-session-registry.test.ts": 161, - "src/main/browser/browser-route-webcontents-registry.test.ts": 311, - "src/main/browser/browser-screencast-first-frame-timeout.test.ts": 160, - "src/main/browser/browser-screencast-guest-view-limit.test.ts": 684, - "src/main/browser/browser-screencast-lifecycle.test.ts": 162, - "src/main/browser/browser-screencast-live-frame-allocation.test.ts": 111, - "src/main/browser/browser-screencast-stream.test.ts": 223, + "src/main/browser/routing/guest-authority/browser-route-guest-popups.test.ts": 306, + "src/main/browser/routing/partitions/browser-route-identity.test.ts": 47, + "src/main/browser/routing/partitions/browser-route-partition-binding-capacity.test.ts": 81, + "src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts": 133, + "src/main/browser/routing/partitions/browser-route-partition-migration.test.ts": 157, + "src/main/browser/routing/partitions/browser-route-partition-pending-deletes.test.ts": 64, + "src/main/browser/routing/partitions/browser-route-partition-stability.test.ts": 305, + "src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.test.ts": 287, + "src/main/browser/routing/partitions/browser-route-partition-storage-lifecycle.test.ts": 96, + "src/main/browser/routing/partitions/browser-route-partition-storage-retirement.test.ts": 139, + "src/main/browser/routing/partitions/browser-route-partition-storage-runtime.test.ts": 76, + "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts": 42, + "src/main/browser/routing/sessions/browser-route-session-registry.test.ts": 161, + "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts": 311, + "src/main/browser/cdp/screencast/browser-screencast-first-frame-timeout.test.ts": 160, + "src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.test.ts": 684, + "src/main/browser/cdp/screencast/browser-screencast-lifecycle.test.ts": 162, + "src/main/browser/cdp/screencast/browser-screencast-live-frame-allocation.test.ts": 111, + "src/main/browser/cdp/screencast/browser-screencast-stream.test.ts": 223, "src/main/browser/browser-session-cookie-staging.scoped.test.ts": 3741, "src/main/browser/browser-session-cookie-staging.test.ts": 308, "src/main/browser/browser-session-meta-store.test.ts": 43, @@ -1401,24 +1401,24 @@ "src/main/browser/browser-session-user-agent-migration-inspection.test.ts": 229, "src/main/browser/browser-site-display-controller.test.ts": 95, "src/main/browser/browser-site-permission-prompt.test.ts": 338, - "src/main/browser/browser-text-insertion.test.ts": 51, + "src/main/browser/cdp/input/browser-text-insertion.test.ts": 51, "src/main/browser/browser-webauthn-account-picker.test.ts": 78, "src/main/browser/browser-webauthn-profile-delete.test.ts": 358, - "src/main/browser/cdp-bridge-integration.test.ts": 28361, - "src/main/browser/cdp-client-response-writer.test.ts": 279, - "src/main/browser/cdp-keyboard-us-layout.test.ts": 84, - "src/main/browser/cdp-print-to-pdf.test.ts": 68, - "src/main/browser/cdp-screenshot.test.ts": 415, - "src/main/browser/cdp-ws-proxy-first-paint.test.ts": 366, - "src/main/browser/cdp-ws-proxy-focus-replay.test.ts": 489, - "src/main/browser/cdp-ws-proxy-host-admission.test.ts": 576, - "src/main/browser/cdp-ws-proxy-input-focus.test.ts": 360, - "src/main/browser/cdp-ws-proxy-malformed-messages.test.ts": 305, - "src/main/browser/cdp-ws-proxy-origin.test.ts": 262, - "src/main/browser/cdp-ws-proxy-startup-lifetime.test.ts": 326, - "src/main/browser/cdp-ws-proxy.test.ts": 2756, + "src/main/browser/cdp/commands/cdp-bridge-integration.test.ts": 28361, + "src/main/browser/cdp/transport/cdp-client-response-writer.test.ts": 279, + "src/main/browser/cdp/input/cdp-keyboard-us-layout.test.ts": 84, + "src/main/browser/cdp/commands/cdp-print-to-pdf.test.ts": 68, + "src/main/browser/cdp/commands/cdp-screenshot.test.ts": 415, + "src/main/browser/cdp/transport/cdp-ws-proxy-first-paint.test.ts": 366, + "src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts": 489, + "src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts": 576, + "src/main/browser/cdp/transport/cdp-ws-proxy-input-focus.test.ts": 360, + "src/main/browser/cdp/transport/cdp-ws-proxy-malformed-messages.test.ts": 305, + "src/main/browser/cdp/transport/cdp-ws-proxy-origin.test.ts": 262, + "src/main/browser/cdp/transport/cdp-ws-proxy-startup-lifetime.test.ts": 326, + "src/main/browser/cdp/transport/cdp-ws-proxy.test.ts": 2756, "src/main/browser/chromium-cookie-snapshot.test.ts": 457, - "src/main/browser/client-route-cookie-import-source-store.test.ts": 147, + "src/main/browser/cookies/client-route/client-route-cookie-import-source-store.test.ts": 147, "src/main/browser/cookies/browser-cookie-clear-preserve.test.ts": 133, "src/main/browser/cookies/browser-cookie-clear-store-lifecycle.test.ts": 183, "src/main/browser/cookies/browser-cookie-clear-store.test.ts": 93, @@ -1457,8 +1457,8 @@ "src/main/browser/doc-preview-protocol.test.ts": 86, "src/main/browser/doc-preview-response-allocation.test.ts": 181, "src/main/browser/doc-preview-terminal-file-reader.test.ts": 101, - "src/main/browser/electron-debugger-lease.test.ts": 44, - "src/main/browser/execution-route-socket-duplex.test.ts": 87, + "src/main/browser/cdp/debugger/electron-debugger-lease.test.ts": 44, + "src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts": 87, "src/main/browser/extensions/api/declarative-net-request.test.ts": 678, "src/main/browser/extensions/api/downloads.test.ts": 577, "src/main/browser/extensions/api/management.test.ts": 213, @@ -1523,39 +1523,39 @@ "src/main/browser/extensions/declarative-net-request/url-pattern.test.ts": 84, "src/main/browser/grab-guest-overlay-follow.test.ts": 332, "src/main/browser/grab-guest-script.test.ts": 107, - "src/main/browser/guest-cdp-command.test.ts": 105, - "src/main/browser/guest-direct-key-input.test.ts": 183, - "src/main/browser/guest-focused-frame-route.test.ts": 78, - "src/main/browser/local-ssh-browser-partition-identity.test.ts": 479, - "src/main/browser/local-ssh-browser-partitions.probe-cache.test.ts": 110, - "src/main/browser/local-ssh-browser-profile-retirement.test.ts": 287, - "src/main/browser/local-ssh-browser-route-target.test.ts": 65, - "src/main/browser/local-ssh-browser-route.test.ts": 92, + "src/main/browser/cdp/debugger/guest-cdp-command.test.ts": 105, + "src/main/browser/cdp/input/guest-direct-key-input.test.ts": 183, + "src/main/browser/cdp/input/guest-focused-frame-route.test.ts": 78, + "src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts": 479, + "src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.probe-cache.test.ts": 110, + "src/main/browser/routing/local-host-partitions/local-ssh-browser-profile-retirement.test.ts": 287, + "src/main/browser/routing/local-host-partitions/local-ssh-browser-route-target.test.ts": 65, + "src/main/browser/routing/local-host-partitions/local-ssh-browser-route.test.ts": 92, "src/main/browser/offscreen-browser-backend-lifecycle.test.ts": 341, - "src/main/browser/paired-runtime-browser-client-host-composition.test.ts": 165, - "src/main/browser/paired-runtime-browser-client-host-identity-wiring.test.ts": 1368, - "src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts": 568, - "src/main/browser/paired-runtime-browser-client-host-registry.test.ts": 53, - "src/main/browser/paired-runtime-browser-client-host-route-identity.test.ts": 1404, - "src/main/browser/paired-runtime-browser-client-host-runtime.test.ts": 657, - "src/main/browser/paired-runtime-browser-client-host.test.ts": 370, - "src/main/browser/paired-runtime-browser-host-command-admission.test.ts": 213, - "src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts": 945, - "src/main/browser/paired-runtime-browser-host-lease.test.ts": 973, - "src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts": 269, - "src/main/browser/paired-runtime-browser-network-route.test.ts": 1150, - "src/main/browser/popup-identity-electron-probe.test.ts": 144, - "src/main/browser/popup-origin-bar-window.test.ts": 118, - "src/main/browser/remote-browser-socks-buffering.test.ts": 384, - "src/main/browser/remote-browser-socks-server.test.ts": 309, - "src/main/browser/snapshot-engine-iframe-sessions.test.ts": 90, - "src/main/browser/snapshot-engine.test.ts": 48, - "src/main/browser/ssh-browser-network-execution-route.test.ts": 643, - "src/main/browser/system-ssh-socks-client-socket.test.ts": 53, - "src/main/browser/wsl-browser-network-execution-route.test.ts": 678, - "src/main/browser/wsl-browser-network-relay-launch.test.ts": 146, - "src/main/browser/wsl-host-browser-jar-identity.test.ts": 806, - "src/main/browser/wsl-host-browser-route-partition.test.ts": 753, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts": 165, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-identity-wiring.test.ts": 1368, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts": 568, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts": 53, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts": 1404, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts": 657, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts": 370, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-command-admission.test.ts": 213, + "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts": 945, + "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts": 973, + "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts": 269, + "src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts": 1150, + "src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.test.ts": 144, + "src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.test.ts": 118, + "src/main/browser/network/tunnels/remote-browser-socks-buffering.test.ts": 384, + "src/main/browser/network/tunnels/remote-browser-socks-server.test.ts": 309, + "src/main/browser/cdp/snapshots/snapshot-engine-iframe-sessions.test.ts": 90, + "src/main/browser/cdp/snapshots/snapshot-engine.test.ts": 48, + "src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts": 643, + "src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts": 53, + "src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts": 678, + "src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.test.ts": 146, + "src/main/browser/routing/local-host-partitions/wsl-host-browser-jar-identity.test.ts": 806, + "src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.test.ts": 753, "src/main/claude-accounts/claude-account-folder.test.ts": 153, "src/main/claude-accounts/claude-account-service.test.ts": 1207, "src/main/claude-accounts/claude-command-process-windows-only.test.ts": 90, diff --git a/config/scripts/ci-unit-files.mjs b/config/scripts/ci-unit-files.mjs index 39ecc7b8932..d19295e58cf 100644 --- a/config/scripts/ci-unit-files.mjs +++ b/config/scripts/ci-unit-files.mjs @@ -48,15 +48,15 @@ export const UNIT_EXCLUDE = [ 'tests/e2e/relay-region-correction.unit.test.ts', 'src/main/browser/cookies/browser-google-cookie-clear.electron.test.ts', // Electron probes with in-process deadlines; the package job runs them serially. - 'src/main/browser/popup-origin-chrome.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts', 'src/main/browser/browser-link-materialization.electron.test.ts', - 'src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts', - 'src/main/browser/browser-route-webrtc-egress.electron.test.ts', + 'src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts', + 'src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts', 'src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts', - 'src/main/browser/browser-popup-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-adapter-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-native-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-background-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-background-compatibility.electron.test.ts', 'src/main/browser/extensions/browser-extension-api.electron.test.ts', 'src/main/browser/extensions/browser-extension-persistence.electron.test.ts', 'src/main/browser/extensions/browser-extension-lifecycle.electron.test.ts', diff --git a/config/scripts/pr-e2e-gate-contract.test.mjs b/config/scripts/pr-e2e-gate-contract.test.mjs index 45674bbc680..ea4a9384c30 100644 --- a/config/scripts/pr-e2e-gate-contract.test.mjs +++ b/config/scripts/pr-e2e-gate-contract.test.mjs @@ -31,8 +31,8 @@ describe('restart-survival E2E routing', () => { 'src/main/runtime/browser-host/browser-host-client-page-adoption.ts', 'src/main/runtime/browser-host/browser-host-page-reconciliation-orchestration.ts', 'src/main/runtime/rpc/methods/browser-client-host.ts', - 'src/main/browser/browser-client-host-authority-replacement-wait.ts', - 'src/main/browser/paired-runtime-browser-client-host-composition.ts', + 'src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement-wait.ts', + 'src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.ts', 'src/renderer/src/runtime/web-session-tabs-sync/snapshot-api.ts', 'src/renderer/src/runtime/host-session-snapshot-authority.ts', 'src/renderer/src/runtime/restored-client-hosted-browser-host-attach.ts', diff --git a/config/scripts/pr-e2e-source-routing.mjs b/config/scripts/pr-e2e-source-routing.mjs index a5429f9a5b1..a809a66d8f1 100644 --- a/config/scripts/pr-e2e-source-routing.mjs +++ b/config/scripts/pr-e2e-source-routing.mjs @@ -234,7 +234,7 @@ export const PR_E2E_SOURCE_ROUTES = [ specs: ['tests/e2e/ssh-orcad-browser-routing.spec.ts'], matches: (file) => isProductSource(file) && - /^src\/(?:main\/browser\/local-ssh-browser|main\/ipc\/browser\.ts$|renderer\/src\/(?:lib\/(?:ssh-workspace-browser-route-eligibility|worktree-host-connection-phase)|components\/browser-pane\/use-ssh-workspace-browser-route|store\/repos\/converted-ssh-browser-pages|store\/slices\/browser\/browser-tab-actions|hooks\/ipc-events\/ssh-managed-server-state-effects))/.test( + /^src\/(?:main\/browser\/routing\/local-host-partitions\/local-ssh-browser|main\/ipc\/browser\.ts$|renderer\/src\/(?:lib\/(?:ssh-workspace-browser-route-eligibility|worktree-host-connection-phase)|components\/browser-pane\/use-ssh-workspace-browser-route|store\/repos\/converted-ssh-browser-pages|store\/slices\/browser\/browser-tab-actions|hooks\/ipc-events\/ssh-managed-server-state-effects))/.test( file ) }, @@ -395,7 +395,7 @@ export const PR_E2E_SOURCE_ROUTES = [ file === 'tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts' || /^tests\/e2e\/helpers\/docker-ssh-host-(?:image|target)\.ts$/.test(file) || (isProductSource(file) && - /^src\/main\/(?:browser\/(?:ssh-browser-network-execution-route|browser-network-deferred-socket|browser-network-execution-route|system-ssh-socks-client-socket)|ssh\/system-transport\/system-ssh-dynamic-forward-process)\.ts$/.test( + /^src\/main\/(?:browser\/network\/(?:execution-routes\/(?:ssh-browser-network-execution-route|browser-network-deferred-socket|browser-network-execution-route)|tunnels\/system-ssh-socks-client-socket)|ssh\/system-transport\/system-ssh-dynamic-forward-process)\.ts$/.test( file )) }, diff --git a/config/scripts/pr-package-test-paths.mjs b/config/scripts/pr-package-test-paths.mjs index b14e5f9a4a2..3b5745708d0 100644 --- a/config/scripts/pr-package-test-paths.mjs +++ b/config/scripts/pr-package-test-paths.mjs @@ -4,15 +4,15 @@ import { pathToFileURL } from 'node:url' export const LINUX_PACKAGE_TESTS = [ 'src/main/browser/cookies/browser-google-cookie-clear.electron.test.ts', 'config/scripts/packaged-repository-input-exclusion.test.mjs', - 'src/main/browser/popup-origin-chrome.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts', 'src/main/browser/browser-link-materialization.electron.test.ts', - 'src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts', - 'src/main/browser/browser-route-webrtc-egress.electron.test.ts', + 'src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts', + 'src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts', 'src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts', - 'src/main/browser/browser-popup-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-adapter-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-native-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-background-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-background-compatibility.electron.test.ts', 'src/main/browser/extensions/browser-extension-api.electron.test.ts', 'src/main/browser/extensions/browser-extension-persistence.electron.test.ts', 'src/main/browser/extensions/browser-extension-lifecycle.electron.test.ts', @@ -47,8 +47,8 @@ export const WINDOWS_BOUNDARY_TESTS = [ 'config/scripts/windows-process-tree-gyp-rebuild.test.mjs', 'config/scripts/package-electron-runtime-contract.test.mjs', 'config/scripts/electron-builder-runtime-resources.test.mjs', - 'src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts', - 'src/main/browser/browser-route-webrtc-egress.electron.test.ts', + 'src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts', + 'src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts', 'src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts', 'src/main/providers/windows-conpty-wide-char-duplication.node-pty.test.ts', 'src/main/providers/pty-repaint-wide-char-buffer.node-pty.test.ts', diff --git a/config/scripts/pr-plugin-e2e-source-routes.mjs b/config/scripts/pr-plugin-e2e-source-routes.mjs index 3461c00770c..a6d10375935 100644 --- a/config/scripts/pr-plugin-e2e-source-routes.mjs +++ b/config/scripts/pr-plugin-e2e-source-routes.mjs @@ -127,7 +127,7 @@ const SPECIFIC_PLUGIN_ROUTES = [ 'src\\/main\\/ipc\\/(?:plugins|plugin-frame-entry-ipc)\\.ts$', 'src\\/main\\/startup\\/main-process-plugins', 'config\\/build-plugins\\/main-build-entry-points', - 'src\\/main\\/browser\\/browser-guest-shortcut-(?:forwarding|dispatch)', + 'src\\/main\\/browser\\/guest-lifecycle\\/input\\/browser-guest-shortcut-(?:forwarding|dispatch)', 'src\\/renderer\\/src\\/components\\/right-sidebar\\/(?:plugin-frame-|use-plugin-frame-|PluginPanel\\.tsx$|plugin-panel-design-token-css|use-plugin-panel-theme-revision)', 'src\\/renderer\\/src\\/components\\/editor\\/(?:PluginCustomEditorFrame\\.tsx$|plugin-custom-editor-host)' ].join('|'), diff --git a/config/scripts/pr-unit-support-routing.test.mjs b/config/scripts/pr-unit-support-routing.test.mjs index 6b50ca830ce..5517f928438 100644 --- a/config/scripts/pr-unit-support-routing.test.mjs +++ b/config/scripts/pr-unit-support-routing.test.mjs @@ -66,7 +66,7 @@ describe('unit support routing', () => { 'src/renderer/src/components/native-chat/NativeChatStructuredSession.next-test-harness.tsx', 'src/renderer/src/components/native-chat/NativeChatStructuredSession.tsx', 'src/main/providers/windows-conpty-wide-char-duplication.node-pty.test.ts', - 'src/main/browser/browser-route-webrtc-egress.electron.test.ts' + 'src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts' ]) { const result = classifyPrJobs([unitHarness, file]) expect(result.should_run, file).toBe(true) diff --git a/config/scripts/vitest-node-runtime-files.mjs b/config/scripts/vitest-node-runtime-files.mjs index a4aac63a158..ab4b7f7820d 100644 --- a/config/scripts/vitest-node-runtime-files.mjs +++ b/config/scripts/vitest-node-runtime-files.mjs @@ -144,16 +144,17 @@ const NODE_RUNTIME_INCLUDE = [ 'src/main/foreign-sqlite-readers/**/*.test.ts', 'src/main/browser/*cookie*.test.ts', 'src/main/browser/cookies/*cookie*.test.ts', + 'src/main/browser/cookies/client-route/*cookie*.test.ts', 'src/main/browser/cookies/sources/browser-cookie-decryption.test.ts', 'src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts', 'src/main/browser/cookies/sources/browser-cookie-source-partition.test.ts', // Playwright's CDP transport needs Node's WebSocket implementation. - 'src/main/browser/browser-popup-adapter-compatibility.electron.test.ts', - 'src/main/browser/popup-origin-chrome.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts', 'src/main/browser/browser-link-materialization.electron.test.ts', - 'src/main/browser/browser-popup-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-native-compatibility.electron.test.ts', - 'src/main/browser/browser-popup-background-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts', + 'src/main/browser/guest-lifecycle/popups/browser-popup-background-compatibility.electron.test.ts', 'src/main/ai-vault/scanners/devin/session-scanner-devin-db.test.ts', 'src/shared/workspace-session-salvage.test.ts', 'src/main/git/repo-detection.test.ts', diff --git a/src/main/browser/agent-browser/agent-browser-action-effects.test.ts b/src/main/browser/agent-browser/agent-browser-action-effects.test.ts index 32a0cae35a4..d68ffa94c25 100644 --- a/src/main/browser/agent-browser/agent-browser-action-effects.test.ts +++ b/src/main/browser/agent-browser/agent-browser-action-effects.test.ts @@ -2,10 +2,10 @@ import { EventEmitter } from 'node:events' import { describe, expect, it, vi } from 'vitest' import type { WebContents } from 'electron' import { runWithActionEffects, type ActionEffectsHost } from './agent-browser-action-effects' -import type { BrowserPageEvent } from '../browser-page-events' +import type { BrowserPageEvent } from '../guest-lifecycle/browser-page-events' import { readBrowserActionEffects } from '../../../shared/browser-action-effects' -vi.mock('../remote-cli-page-admission', () => ({ +vi.mock('../routing/input-ownership/remote-cli-page-admission', () => ({ readRemoteCliAdmittedPage: (_id: number, read: () => Promise) => read() })) diff --git a/src/main/browser/agent-browser/agent-browser-action-effects.ts b/src/main/browser/agent-browser/agent-browser-action-effects.ts index bd36a3d6694..3b4e451c868 100644 --- a/src/main/browser/agent-browser/agent-browser-action-effects.ts +++ b/src/main/browser/agent-browser/agent-browser-action-effects.ts @@ -3,8 +3,8 @@ import type { WebContents } from 'electron' import type { BrowserActionEffects } from '../../../shared/runtime-browser-contracts' import { isRecord } from '../../../shared/agent-status-child-work-value-guards' import { withTimeout } from '../../../shared/promise-timeout-fallback' -import type { BrowserPageEvent } from '../browser-page-events' -import { readRemoteCliAdmittedPage } from '../remote-cli-page-admission' +import type { BrowserPageEvent } from '../guest-lifecycle/browser-page-events' +import { readRemoteCliAdmittedPage } from '../routing/input-ownership/remote-cli-page-admission' import { readPageChange } from './agent-browser-snapshot-delta' import { isLoadingMainFrame } from './agent-browser-bridge-process' diff --git a/src/main/browser/agent-browser/agent-browser-bridge-action-effects.ts b/src/main/browser/agent-browser/agent-browser-bridge-action-effects.ts index 11afbf8a7f8..3da02ea5575 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-action-effects.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-action-effects.ts @@ -1,7 +1,7 @@ import { BrowserError } from '../browser-error' import { AgentBrowserBridgeShutdown } from './agent-browser-bridge-shutdown' import type { ResolvedBrowserCommandTarget } from './agent-browser-bridge-types' -import { assertRemoteCliPageAccess } from '../remote-cli-page-admission' +import { assertRemoteCliPageAccess } from '../routing/input-ownership/remote-cli-page-admission' import type { ActionEffectsHost } from './agent-browser-action-effects' const EFFECTS_SNAPSHOT_TIMEOUT_MS = 5_000 diff --git a/src/main/browser/agent-browser/agent-browser-bridge-capture-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-capture-commands.ts index 108f1cf62be..a23b9e62cef 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-capture-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-capture-commands.ts @@ -6,14 +6,18 @@ import type { BrowserEvalResult } from '../../../shared/runtime-browser-contracts' import { BrowserError } from '../browser-error' -import { captureFullPageScreenshot, SCREENSHOT_TIMEOUT_MS, withTimeout } from '../cdp-screenshot' +import { + captureFullPageScreenshot, + SCREENSHOT_TIMEOUT_MS, + withTimeout +} from '../cdp/commands/cdp-screenshot' import { agentBrowserScreenshotArgs, readAgentBrowserScreenshot } from './agent-browser-screenshot-arguments' import { readRasterImageDimensions } from '../../../shared/raster-image-dimensions' -import { acquireElectronDebugger } from '../electron-debugger-lease' -import { sendGuestCdpCommand } from '../guest-cdp-command' +import { acquireElectronDebugger } from '../cdp/debugger/electron-debugger-lease' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' import { AgentBrowserBridgeUtilityCommands } from './agent-browser-bridge-page-commands' import { ORCA_TAB_SESSION_PREFIX } from './agent-browser-orphan-sweep' import { captureRemoteCliBrowserWorkBound } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' diff --git a/src/main/browser/agent-browser/agent-browser-bridge-capture-paint-hold.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-capture-paint-hold.test.ts index 16bf4480679..74d2d54dd5b 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-capture-paint-hold.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-capture-paint-hold.test.ts @@ -40,7 +40,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -53,7 +53,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-command-transport.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-command-transport.test.ts index 9a42e9d356b..5fa2a3fe1a5 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-command-transport.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-command-transport.test.ts @@ -53,7 +53,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -66,7 +66,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-core-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-core-commands.ts index aa295f799fc..84774bde69c 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-core-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-core-commands.ts @@ -9,14 +9,14 @@ import { assertClipboardTextWriteWithinLimitWithYield } from '../../../shared/cl import { normalizeBrowserNavigationUrl } from '../../../shared/browser-url' import { BrowserError } from '../browser-error' import { ORCA_TAB_SESSION_PREFIX } from './agent-browser-orphan-sweep' -import { FILL_ELEMENT_FUNCTION } from '../browser-element-functions' +import { FILL_ELEMENT_FUNCTION } from '../cdp/input/browser-element-functions' import { EMBEDDED_NAVIGATION_TIMEOUT_MS } from './agent-browser-bridge-types' import { isAbortedNavigationError, waitForAbortedNavigationReplacement } from './agent-browser-bridge-process' import { AgentBrowserBridgeQueue } from './agent-browser-bridge-queue' -import { assertRemoteCliPageAccess } from '../remote-cli-page-admission' +import { assertRemoteCliPageAccess } from '../routing/input-ownership/remote-cli-page-admission' import { agentBrowserSnapshotArgs } from './agent-browser-snapshot-arguments' export abstract class AgentBrowserBridgeCoreCommands extends AgentBrowserBridgeQueue { diff --git a/src/main/browser/agent-browser/agent-browser-bridge-element-calls.ts b/src/main/browser/agent-browser/agent-browser-bridge-element-calls.ts index 886e090cbe3..cda545a3a4e 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-element-calls.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-element-calls.ts @@ -1,9 +1,9 @@ import type { WebContents } from 'electron' import { BrowserError } from '../browser-error' -import type { CapturedElement } from '../cdp-element-capture' -import { assertExpectedPageUrlForStep } from '../browser-expected-page-url' -import { sendGuestCdpCommand } from '../guest-cdp-command' -import { readRecord, readString } from '../guest-frame-input-sessions' +import type { CapturedElement } from '../cdp/commands/cdp-element-capture' +import { assertExpectedPageUrlForStep } from '../cdp/input/browser-expected-page-url' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' +import { readRecord, readString } from '../cdp/input/guest-frame-input-sessions' import { AgentBrowserBridgeExecution } from './agent-browser-bridge-execution' export type CapturedTarget = { wc: WebContents; captured: CapturedElement } diff --git a/src/main/browser/agent-browser/agent-browser-bridge-execution.ts b/src/main/browser/agent-browser/agent-browser-bridge-execution.ts index f5fffdf2c37..25659513431 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-execution.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-execution.ts @@ -13,7 +13,7 @@ import { } from './agent-browser-batch-command' import { AgentBrowserBridgeTabs } from './agent-browser-bridge-tabs' import { assertRemoteCliBrowserAccess } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' -import { assertExpectedPageUrlForStep } from '../browser-expected-page-url' +import { assertExpectedPageUrlForStep } from '../cdp/input/browser-expected-page-url' import { ORCA_TAB_SESSION_PREFIX } from './agent-browser-orphan-sweep' import { canSkipAgentBrowserSessionReset } from './agent-browser-session-reset' import { diff --git a/src/main/browser/agent-browser/agent-browser-bridge-expected-url.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-expected-url.test.ts index 3e8558a0cf1..459b5f98f77 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-expected-url.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-expected-url.test.ts @@ -35,11 +35,11 @@ const { CdpWsProxyMock } = vi.hoisted(() => { }) return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) import { isRecord } from '../../../shared/agent-status-child-work-value-guards' import { runInRemoteCliBrowserScope } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' -import { runWithRequestedPageUrl } from '../browser-expected-page-url' +import { runWithRequestedPageUrl } from '../cdp/input/browser-expected-page-url' import { AgentBrowserBridge } from './agent-browser-bridge' import { answerAgentBrowserCommands, diff --git a/src/main/browser/agent-browser/agent-browser-bridge-host-revocation.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-host-revocation.test.ts index 2eed40a3570..f9712b67a4f 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-host-revocation.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-host-revocation.test.ts @@ -36,7 +36,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { }) return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) import { AgentBrowserBridge } from './agent-browser-bridge' import { @@ -46,7 +46,7 @@ import { import { assertRemoteCliPageAccess, runUnderRemoteCliPageAdmission -} from '../remote-cli-page-admission' +} from '../routing/input-ownership/remote-cli-page-admission' import { answerAgentBrowserCommands, createFakeAgentBrowserChild, diff --git a/src/main/browser/agent-browser/agent-browser-bridge-input-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-input-commands.ts index 5356f217da4..c95f79e7196 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-input-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-input-commands.ts @@ -6,7 +6,7 @@ import { assertClipboardTextWriteWithinLimitWithYield } from '../../../shared/cl import { iterateBrowserTextInsertionChunks } from '../../../shared/browser-text-insertion-chunks' import { AGENT_BROWSER_TEXT_ARGUMENT_MAX_BYTES } from './agent-browser-bridge-types' import { AgentBrowserBridgeCoreCommands } from './agent-browser-bridge-core-commands' -import { SELECT_OPTION_TARGET_FUNCTION } from '../browser-element-functions' +import { SELECT_OPTION_TARGET_FUNCTION } from '../cdp/input/browser-element-functions' export abstract class AgentBrowserBridgeInputCommands extends AgentBrowserBridgeCoreCommands { async select( diff --git a/src/main/browser/agent-browser/agent-browser-bridge-interaction-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-interaction-commands.ts index ab888a48a92..b9547e6f7d4 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-interaction-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-interaction-commands.ts @@ -15,18 +15,18 @@ import { FILE_UPLOAD_TARGET_FUNCTION, FILL_ELEMENT_FUNCTION, SELECT_ALL_ELEMENT_FUNCTION -} from '../browser-element-functions' -import { assertUploadFilesExist } from '../browser-upload-files' +} from '../cdp/input/browser-element-functions' +import { assertUploadFilesExist } from '../cdp/input/browser-upload-files' import type { WebContents } from 'electron' -import type { CapturedElement } from '../cdp-element-capture' -import { interceptFileChooser, type OpenedFileChooser } from '../guest-file-chooser' -import { readRecord, readString } from '../guest-frame-input-sessions' +import type { CapturedElement } from '../cdp/commands/cdp-element-capture' +import { interceptFileChooser, type OpenedFileChooser } from '../cdp/input/guest-file-chooser' +import { readRecord, readString } from '../cdp/input/guest-frame-input-sessions' import { agentBrowserWaitArguments, type AgentBrowserWaitOptions } from './agent-browser-wait-arguments' -import { parseCdpKeyEvent } from '../cdp-keyboard-us-layout' -import { readRemoteCliAdmittedPage } from '../remote-cli-page-admission' +import { parseCdpKeyEvent } from '../cdp/input/cdp-keyboard-us-layout' +import { readRemoteCliAdmittedPage } from '../routing/input-ownership/remote-cli-page-admission' import { AgentBrowserBridgeKeyCommands } from './agent-browser-bridge-key-commands' export abstract class AgentBrowserBridgeInteractionCommands extends AgentBrowserBridgeKeyCommands { diff --git a/src/main/browser/agent-browser/agent-browser-bridge-javascript-dialog.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-javascript-dialog.test.ts index d852927daba..f57b532729f 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-javascript-dialog.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-javascript-dialog.test.ts @@ -33,10 +33,10 @@ const { CdpWsProxyMock } = vi.hoisted(() => { }) return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) import { AgentBrowserBridge } from './agent-browser-bridge' -import { installBrowserJavaScriptDialogs } from '../browser-javascript-dialogs' +import { installBrowserJavaScriptDialogs } from '../guest-lifecycle/prompts/browser-javascript-dialogs' import { runInRemoteCliBrowserScope } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' import { createFakeAgentBrowserChild, diff --git a/src/main/browser/agent-browser/agent-browser-bridge-key-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-key-commands.ts index 561f656616c..70f303341d1 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-key-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-key-commands.ts @@ -4,21 +4,21 @@ import type { } from '../../../shared/runtime-browser-contracts' import { assertClipboardTextWriteWithinLimitWithYield } from '../../../shared/clipboard-text' import { BrowserError } from '../browser-error' -import { acquireElectronDebugger } from '../electron-debugger-lease' +import { acquireElectronDebugger } from '../cdp/debugger/electron-debugger-lease' import { parseCdpKeyEvent, imeFallbackKeyEvent, typedInputSteps, type TypedInputStep -} from '../cdp-keyboard-us-layout' +} from '../cdp/input/cdp-keyboard-us-layout' import type { ResolvedBrowserCommandTarget } from './agent-browser-bridge-types' import { dispatchPageKeyEvents, routePageTextInsertion, type GuestCdpSender -} from '../guest-direct-key-input' -import { assertExpectedPageUrlForStep } from '../browser-expected-page-url' -import { sendGuestCdpCommand } from '../guest-cdp-command' +} from '../cdp/input/guest-direct-key-input' +import { assertExpectedPageUrlForStep } from '../cdp/input/browser-expected-page-url' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' import { AgentBrowserBridgeCaptureCommands } from './agent-browser-bridge-capture-commands' // Bounds the events a typed run holds and how long it keeps the main loop busy. diff --git a/src/main/browser/agent-browser/agent-browser-bridge-keypress-input.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-keypress-input.test.ts index 0256a7ed77c..da67f208439 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-keypress-input.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-keypress-input.test.ts @@ -42,7 +42,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-lifecycle.ts b/src/main/browser/agent-browser/agent-browser-bridge-lifecycle.ts index 54f1727fe5b..f8c442f9349 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-lifecycle.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-lifecycle.ts @@ -1,4 +1,4 @@ -import { CdpWsProxy } from '../cdp-ws-proxy' +import { CdpWsProxy } from '../cdp/transport/cdp-ws-proxy' import { BrowserError } from '../browser-error' import { ORCA_TAB_SESSION_PREFIX } from './agent-browser-orphan-sweep' import { AgentBrowserBridgeRawProcess } from './agent-browser-bridge-raw-process' diff --git a/src/main/browser/agent-browser/agent-browser-bridge-mouse-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-mouse-commands.ts index 52760ad7522..762d664e0d5 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-mouse-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-mouse-commands.ts @@ -1,15 +1,15 @@ -import type { BrowserMouseModifier } from './agent-browser-bridge-types' +import type { BrowserMouseModifier } from '../cdp/input/cdp-pointer-targets' import { BrowserError } from '../browser-error' import { normalizeCdpMouseButton, cdpPointerButtonMask, cdpMouseModifierMask, resolveMobileTouchClickPoint -} from './agent-browser-bridge-mouse' -import { acquireElectronDebugger } from '../electron-debugger-lease' -import { assertExpectedPageUrlForStep } from '../browser-expected-page-url' -import { sendGuestCdpCommand } from '../guest-cdp-command' -import { touchEmulationParams } from '../guest-touch-emulation' +} from '../cdp/input/cdp-pointer-targets' +import { acquireElectronDebugger } from '../cdp/debugger/electron-debugger-lease' +import { assertExpectedPageUrlForStep } from '../cdp/input/browser-expected-page-url' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' +import { touchEmulationParams } from '../cdp/input/guest-touch-emulation' import { assertRemoteCliBrowserAccess } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' import { AgentBrowserBridgePointerCommands } from './agent-browser-bridge-pointer-commands' import { agentBrowserSetMediaArguments } from './agent-browser-set-media-arguments' diff --git a/src/main/browser/agent-browser/agent-browser-bridge-mouse-input.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-mouse-input.test.ts index e3d17bd1dc0..f0e98f596e0 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-mouse-input.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-mouse-input.test.ts @@ -40,7 +40,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -53,7 +53,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-navigation.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-navigation.test.ts index c3d220455cc..55a1c5b5484 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-navigation.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-navigation.test.ts @@ -40,7 +40,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -53,7 +53,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-page-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-page-commands.ts index 6ebed6a23d7..e70478bb3f7 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-page-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-page-commands.ts @@ -16,9 +16,9 @@ import { AgentBrowserBridgeMouseCommands } from './agent-browser-bridge-mouse-co import { answerBrowserJavaScriptDialog, getBrowserJavaScriptDialog -} from '../browser-javascript-dialogs' +} from '../guest-lifecycle/prompts/browser-javascript-dialogs' import { captureRemoteCliBrowserRevocation } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' -import { ExpectedPageUrlGuard, getRequestedPageUrl } from '../browser-expected-page-url' +import { ExpectedPageUrlGuard, getRequestedPageUrl } from '../cdp/input/browser-expected-page-url' /** Keep JSON results stable across CLI payload versions. */ export type BrowserDialogAnswer = { accepted: boolean; browserPageId?: string; checkedUrl?: string } diff --git a/src/main/browser/agent-browser/agent-browser-bridge-pointer-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-pointer-commands.ts index 9cf5d760622..c6cff4c0244 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-pointer-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-pointer-commands.ts @@ -1,6 +1,6 @@ import type { ResolvedBrowserCommandTarget } from './agent-browser-bridge-types' import { BrowserError } from '../browser-error' -import { normalizeCdpPointerButton } from './agent-browser-bridge-mouse' +import { normalizeCdpPointerButton } from '../cdp/input/cdp-pointer-targets' import { assertFinitePointerValues, cdpPointerStateFor, @@ -8,14 +8,14 @@ import { releaseCdpPointerButton, resolveCdpPointerReleaseButton, type CdpPointerState -} from '../cdp-pointer-input' -import { acquireElectronDebugger } from '../electron-debugger-lease' -import { assertExpectedPageUrlForStep } from '../browser-expected-page-url' -import { sendGuestCdpCommand } from '../guest-cdp-command' +} from '../cdp/input/cdp-pointer-input' +import { acquireElectronDebugger } from '../cdp/debugger/electron-debugger-lease' +import { assertExpectedPageUrlForStep } from '../cdp/input/browser-expected-page-url' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' import { AgentBrowserBridgeInputCommands } from './agent-browser-bridge-input-commands' -import { isEmbeddedGuest } from '../guest-direct-key-input' -import { enablePageFocusEmulation } from '../agent-input-focus-guard' -import { waitForGuestFirstPaint } from '../guest-first-paint' +import { isEmbeddedGuest } from '../cdp/input/guest-direct-key-input' +import { enablePageFocusEmulation } from '../cdp/input/agent-input-focus-guard' +import { waitForGuestFirstPaint } from '../cdp/debugger/guest-first-paint' type CdpPointerEventParams = { type: 'mouseMoved' | 'mousePressed' | 'mouseReleased' | 'mouseWheel' diff --git a/src/main/browser/agent-browser/agent-browser-bridge-pointer-input.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-pointer-input.test.ts index 80b403bbf70..04c82b0f1f1 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-pointer-input.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-pointer-input.test.ts @@ -44,7 +44,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -57,7 +57,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-queue.ts b/src/main/browser/agent-browser/agent-browser-bridge-queue.ts index e165d9882c8..b03111968d8 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-queue.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-queue.ts @@ -6,12 +6,12 @@ import type { EnqueueTargetedCommandOptions, ResolvedBrowserCommandTarget } from './agent-browser-bridge-types' -import { runWithRemoteCliPageAdmission } from '../remote-cli-page-admission' +import { runWithRemoteCliPageAdmission } from '../routing/input-ownership/remote-cli-page-admission' import { runWithActionEffects } from './agent-browser-action-effects' -import { getRequestedPageUrl, runExpectingPageUrl } from '../browser-expected-page-url' +import { getRequestedPageUrl, runExpectingPageUrl } from '../cdp/input/browser-expected-page-url' import { AGENT_BROWSER_CLEANUP_TIMEOUT_MS } from './agent-browser-bridge-types' -import { releaseHeldPageInput } from '../guest-direct-key-input' -import { onBrowserJavaScriptDialogOpened } from '../browser-javascript-dialogs' +import { releaseHeldPageInput } from '../cdp/input/guest-direct-key-input' +import { onBrowserJavaScriptDialogOpened } from '../guest-lifecycle/prompts/browser-javascript-dialogs' import { assertNoJavaScriptDialog, dialogAnswerHint, diff --git a/src/main/browser/agent-browser/agent-browser-bridge-session-lifecycle.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-session-lifecycle.test.ts index c8938b59906..db6258e6831 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-session-lifecycle.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-session-lifecycle.test.ts @@ -48,7 +48,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -61,7 +61,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-state-commands.ts b/src/main/browser/agent-browser/agent-browser-bridge-state-commands.ts index dc195955e1a..465a29c2374 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-state-commands.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-state-commands.ts @@ -15,14 +15,14 @@ import type { import { BrowserError } from '../browser-error' import { parseShellArgs, stripAgentBrowserTargetArgs } from './agent-browser-bridge-process' import { AgentBrowserBridgeInteractionCommands } from './agent-browser-bridge-interaction-commands' -import { sendGuestCdpCommand } from '../guest-cdp-command' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' import { toBrowserConsoleResult, toBrowserNetworkLogResult, type AgentBrowserConsoleOutput, type AgentBrowserNetworkOutput } from './agent-browser-log-entries' -import { touchEmulationParams } from '../guest-touch-emulation' +import { touchEmulationParams } from '../cdp/input/guest-touch-emulation' export abstract class AgentBrowserBridgeStateCommands extends AgentBrowserBridgeInteractionCommands { async cookieGet( diff --git a/src/main/browser/agent-browser/agent-browser-bridge-tab-routing.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-tab-routing.test.ts index 615ff0f5d2a..922a2ddc39d 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-tab-routing.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-tab-routing.test.ts @@ -40,7 +40,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -53,7 +53,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-text-input.test.ts b/src/main/browser/agent-browser/agent-browser-bridge-text-input.test.ts index 3b6baec9ba0..5b120bdcf37 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-text-input.test.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-text-input.test.ts @@ -49,7 +49,7 @@ const { CdpWsProxyMock } = vi.hoisted(() => { return { CdpWsProxyMock: Object.assign(MockClass, { instances }) } }) -vi.mock('../cdp-ws-proxy', () => ({ +vi.mock('../cdp/transport/cdp-ws-proxy', () => ({ CdpWsProxy: CdpWsProxyMock })) vi.mock('../browser-error', () => ({ @@ -62,7 +62,7 @@ vi.mock('../browser-error', () => ({ } })) -vi.mock('../cdp-bridge', async () => { +vi.mock('../cdp/commands/cdp-bridge', async () => { const { BrowserError } = await vi.importMock('../browser-error') return { BrowserError } }) @@ -89,7 +89,7 @@ import { FILE_INPUT_FRAME_URL_FUNCTION, FILE_UPLOAD_TARGET_FUNCTION, FILL_ELEMENT_FUNCTION -} from '../browser-element-functions' +} from '../cdp/input/browser-element-functions' overrideBridgeWebContentsLookup(AgentBrowserBridge.prototype, webContentsFromIdMock) diff --git a/src/main/browser/agent-browser/agent-browser-bridge-types.ts b/src/main/browser/agent-browser/agent-browser-bridge-types.ts index 732449ca5de..8a784e0eba5 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-types.ts +++ b/src/main/browser/agent-browser/agent-browser-bridge-types.ts @@ -1,5 +1,5 @@ import type { ChildProcess } from 'node:child_process' -import type { CdpWsProxy } from '../cdp-ws-proxy' +import type { CdpWsProxy } from '../cdp/transport/cdp-ws-proxy' import type { BrowserError } from '../browser-error' // Exceed agent-browser's internal navigation (30s) and default wait (25s) timeouts. @@ -51,8 +51,6 @@ export type AgentBrowserCleanupOptions = { keepQueuedCommands?: boolean } -export type BrowserMouseModifier = 'cmd' | 'ctrl' | 'alt' | 'shift' - export type AgentBrowserExecOptions = { envOverrides?: NodeJS.ProcessEnv timeoutMs?: number diff --git a/src/main/browser/agent-browser/agent-browser-dialog-errors.ts b/src/main/browser/agent-browser/agent-browser-dialog-errors.ts index 2fdc3dff12d..8da7e150ced 100644 --- a/src/main/browser/agent-browser/agent-browser-dialog-errors.ts +++ b/src/main/browser/agent-browser/agent-browser-dialog-errors.ts @@ -1,5 +1,5 @@ import { BrowserError } from '../browser-error' -import { getBrowserJavaScriptDialog } from '../browser-javascript-dialogs' +import { getBrowserJavaScriptDialog } from '../guest-lifecycle/prompts/browser-javascript-dialogs' import type { BrowserJavaScriptDialog } from '../../../shared/browser-javascript-dialog' const DIALOG_MESSAGE_QUOTE_MAX_CHARS = 500 diff --git a/src/main/browser/browser-link-materialization.electron.test.ts b/src/main/browser/browser-link-materialization.electron.test.ts index dfb6c4e7182..ce8b646bd2b 100644 --- a/src/main/browser/browser-link-materialization.electron.test.ts +++ b/src/main/browser/browser-link-materialization.electron.test.ts @@ -7,7 +7,7 @@ import { buildPopupIdentityProbe, createPopupIdentityProbeRoot, launchPopupIdentityProbe -} from './popup-identity-electron-probe' +} from './guest-lifecycle/popups/popup-identity-electron-probe' const root = createPopupIdentityProbeRoot() let probe: Awaited> diff --git a/src/main/browser/browser-manager-annotation-bridge.test.ts b/src/main/browser/browser-manager-annotation-bridge.test.ts index a4a7aba8fe9..a5da1daee30 100644 --- a/src/main/browser/browser-manager-annotation-bridge.test.ts +++ b/src/main/browser/browser-manager-annotation-bridge.test.ts @@ -25,7 +25,7 @@ vi.mock('electron', () => ({ webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-auth-user-agent.test.ts b/src/main/browser/browser-manager-auth-user-agent.test.ts index c7787d25c5b..f6c11b15006 100644 --- a/src/main/browser/browser-manager-auth-user-agent.test.ts +++ b/src/main/browser/browser-manager-auth-user-agent.test.ts @@ -37,7 +37,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-bindings.ts b/src/main/browser/browser-manager-bindings.ts index b96aa086604..141e93f462a 100644 --- a/src/main/browser/browser-manager-bindings.ts +++ b/src/main/browser/browser-manager-bindings.ts @@ -1,9 +1,9 @@ -import { resolveRendererWebContents } from './browser-guest-renderer-target' -import { setupGuestContextMenu } from './browser-guest-context-menu' -import { setupGrabShortcutForwarding } from './browser-guest-grab-shortcuts' -import { setupGuestMouseWheelZoomForwarding } from './browser-guest-wheel-zoom' -import { setupGuestShortcutForwarding } from './browser-guest-shortcut-forwarding' -import { setupGuestTargetUrlForwarding } from './browser-guest-target-url' +import { resolveRendererWebContents } from './guest-lifecycle/browser-guest-renderer-target' +import { setupGuestContextMenu } from './guest-lifecycle/input/browser-guest-context-menu' +import { setupGrabShortcutForwarding } from './guest-lifecycle/input/browser-guest-grab-shortcuts' +import { setupGuestMouseWheelZoomForwarding } from './guest-lifecycle/input/browser-guest-wheel-zoom' +import { setupGuestShortcutForwarding } from './guest-lifecycle/input/browser-guest-shortcut-forwarding' +import { setupGuestTargetUrlForwarding } from './guest-lifecycle/input/browser-guest-target-url' import { BrowserManagerGrab } from './browser-manager-grab' export abstract class BrowserManagerBindings extends BrowserManagerGrab { diff --git a/src/main/browser/browser-manager-client-hosted-downloads.test.ts b/src/main/browser/browser-manager-client-hosted-downloads.test.ts index 8763c0efbe3..11ab261f6b2 100644 --- a/src/main/browser/browser-manager-client-hosted-downloads.test.ts +++ b/src/main/browser/browser-manager-client-hosted-downloads.test.ts @@ -25,7 +25,7 @@ vi.mock('electron', () => ({ webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) @@ -37,19 +37,19 @@ import { BrowserClientDownloadRelay, type BrowserClientDownloadRoute, type BrowserClientDownloadRouteOutcome -} from './browser-client-download-relay' -import { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' +} from './client-hosts/file-transfers/browser-client-download-relay' +import { BrowserClientFileChannelTransport } from './client-hosts/file-transfers/browser-client-file-channel-transport' import type { BrowserClientHostedPageInventory } from '../../shared/browser-client-host-protocol' import { registerBrowserClientDownloadRouter, resetBrowserClientDownloadRouting, setBrowserClientRouteWebContentsProbe -} from './browser-client-download-routing' -import { createBrowserClientPageGuestBinding } from './browser-client-page-guest-binding' +} from './client-hosts/file-transfers/browser-client-download-routing' +import { createBrowserClientPageGuestBinding } from './client-pages/lifecycle/browser-client-page-guest-binding' import { registerBrowserRouteGuestPopup, resetBrowserRouteGuestPopupOwnership -} from './browser-route-guest-popup-ownership' +} from './routing/guest-authority/browser-route-guest-popup-ownership' import { createDownloadItem, getDownloadItemEventHandler, diff --git a/src/main/browser/browser-manager-destroyed-guest-downloads.test.ts b/src/main/browser/browser-manager-destroyed-guest-downloads.test.ts index 28b228d6f43..829fb663da2 100644 --- a/src/main/browser/browser-manager-destroyed-guest-downloads.test.ts +++ b/src/main/browser/browser-manager-destroyed-guest-downloads.test.ts @@ -10,7 +10,9 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: () => ({ x: 0, y: 0 }) }, webContents: { fromId: (id: number) => mocks.contents.get(id) ?? null } })) -vi.mock('./popup-origin-bar-window', () => ({ openPopupWithOriginBar: vi.fn() })) +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ + openPopupWithOriginBar: vi.fn() +})) import { DestroyedGuestTestContents, diff --git a/src/main/browser/browser-manager-destroyed-guest.test.ts b/src/main/browser/browser-manager-destroyed-guest.test.ts index c46901ad349..ce28cd233e8 100644 --- a/src/main/browser/browser-manager-destroyed-guest.test.ts +++ b/src/main/browser/browser-manager-destroyed-guest.test.ts @@ -10,7 +10,9 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: () => ({ x: 0, y: 0 }) }, webContents: { fromId: (id: number) => mocks.guests.get(id) ?? null } })) -vi.mock('./popup-origin-bar-window', () => ({ openPopupWithOriginBar: vi.fn() })) +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ + openPopupWithOriginBar: vi.fn() +})) import { DestroyedGuestTestContents, diff --git a/src/main/browser/browser-manager-devtools-retirement.test.ts b/src/main/browser/browser-manager-devtools-retirement.test.ts index 94a87db0ec3..33850354275 100644 --- a/src/main/browser/browser-manager-devtools-retirement.test.ts +++ b/src/main/browser/browser-manager-devtools-retirement.test.ts @@ -45,7 +45,9 @@ vi.mock('electron', () => { webContents: { fromId: (id: number) => native.byId.get(id) } } }) -vi.mock('./popup-origin-bar-window', () => ({ openPopupWithOriginBar: vi.fn() })) +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ + openPopupWithOriginBar: vi.fn() +})) import { BrowserManager } from './browser-manager' diff --git a/src/main/browser/browser-manager-download-creation.ts b/src/main/browser/browser-manager-download-creation.ts index f61c19fb323..b93d31b1641 100644 --- a/src/main/browser/browser-manager-download-creation.ts +++ b/src/main/browser/browser-manager-download-creation.ts @@ -1,8 +1,8 @@ import { randomUUID } from 'node:crypto' import path from 'node:path' import { BrowserError } from './browser-error' -import { browserDownloadDestinationReservations } from './browser-download-destination' -import { routeBrowserClientDownload } from './browser-client-download-routing' +import { browserDownloadDestinationReservations } from './downloads/browser-download-destination' +import { routeBrowserClientDownload } from './client-hosts/file-transfers/browser-client-download-routing' import { safeOrigin, type ActiveDownload, diff --git a/src/main/browser/browser-manager-download-lifecycle.ts b/src/main/browser/browser-manager-download-lifecycle.ts index 8fa4bd11db6..0194e635fd1 100644 --- a/src/main/browser/browser-manager-download-lifecycle.ts +++ b/src/main/browser/browser-manager-download-lifecycle.ts @@ -1,4 +1,4 @@ -import { browserDownloadDestinationReservations } from './browser-download-destination' +import { browserDownloadDestinationReservations } from './downloads/browser-download-destination' import type { BrowserDownloadFinishedEvent, BrowserDownloadProgressEvent, diff --git a/src/main/browser/browser-manager-downloads.test.ts b/src/main/browser/browser-manager-downloads.test.ts index e780548b327..c29a7f303fb 100644 --- a/src/main/browser/browser-manager-downloads.test.ts +++ b/src/main/browser/browser-manager-downloads.test.ts @@ -36,12 +36,12 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) import { browserManager } from './browser-manager' -import { browserDownloadDestinationReservations } from './browser-download-destination' +import { browserDownloadDestinationReservations } from './downloads/browser-download-destination' import { createDownloadItem, getDownloadItemEventHandler, diff --git a/src/main/browser/browser-manager-guest-lifecycle.test.ts b/src/main/browser/browser-manager-guest-lifecycle.test.ts index 616755e5003..81eb0654801 100644 --- a/src/main/browser/browser-manager-guest-lifecycle.test.ts +++ b/src/main/browser/browser-manager-guest-lifecycle.test.ts @@ -49,7 +49,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-guest-navigation-policy.ts b/src/main/browser/browser-manager-guest-navigation-policy.ts index b16d1655bbe..8091be0753a 100644 --- a/src/main/browser/browser-manager-guest-navigation-policy.ts +++ b/src/main/browser/browser-manager-guest-navigation-policy.ts @@ -8,8 +8,8 @@ import { BrowserManagerGuestPopupPolicy, isLocalFileLinkFromLocalPage } from './browser-manager-guest-popup-policy' -import { allowPageUnload } from './browser-guest-unload-policy' -import { initiatingFrameUrl } from './browser-external-app-launch' +import { allowPageUnload } from './guest-lifecycle/browser-guest-unload-policy' +import { initiatingFrameUrl } from './guest-lifecycle/prompts/browser-external-app-launch' import { isSameExtensionNavigation } from '../../shared/browser-extension-url' export abstract class BrowserManagerGuestNavigationPolicy extends BrowserManagerGuestPopupPolicy { diff --git a/src/main/browser/browser-manager-guest-policy-profile.test.ts b/src/main/browser/browser-manager-guest-policy-profile.test.ts index 3c92f6d12c0..bfad47ea36e 100644 --- a/src/main/browser/browser-manager-guest-policy-profile.test.ts +++ b/src/main/browser/browser-manager-guest-policy-profile.test.ts @@ -24,7 +24,7 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: browserMocks.screenGetCursorScreenPointMock }, webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-guest-policy.ts b/src/main/browser/browser-manager-guest-policy.ts index 98706c6a849..41b9631def5 100644 --- a/src/main/browser/browser-manager-guest-policy.ts +++ b/src/main/browser/browser-manager-guest-policy.ts @@ -4,9 +4,9 @@ import { type PopupOwnerContext } from './browser-manager-types' import { BrowserManagerGuestCleanup } from './browser-manager-guest-cleanup' -import { allowPageUnload } from './browser-guest-unload-policy' +import { allowPageUnload } from './guest-lifecycle/browser-guest-unload-policy' import { installDocPreviewGuestPolicy } from './doc-preview-guest-policy' -import { installGuestDevToolsCloseShortcut } from './browser-guest-devtools-close-shortcut' +import { installGuestDevToolsCloseShortcut } from './guest-lifecycle/browser-guest-devtools-close-shortcut' export abstract class BrowserManagerGuestPolicy extends BrowserManagerGuestCleanup { attachGuestPolicies( diff --git a/src/main/browser/browser-manager-guest-popup-policy.ts b/src/main/browser/browser-manager-guest-popup-policy.ts index 5cd9555154f..9119c44553f 100644 --- a/src/main/browser/browser-manager-guest-popup-policy.ts +++ b/src/main/browser/browser-manager-guest-popup-policy.ts @@ -1,21 +1,24 @@ import { shell } from 'electron' import { normalizeExternalBrowserUrl, redactKagiSessionToken } from '../../shared/browser-url' -import { trackBrowserGuestInputGesture } from './browser-guest-input-gesture' +import { trackBrowserGuestInputGesture } from './guest-lifecycle/input/browser-guest-input-gesture' import { isNewBrowserTabPopupIntent, isBrowserTabPopupRequest, normalizeBrowserPopupUrl -} from './browser-popup-new-tab-intent' +} from './guest-lifecycle/popups/browser-popup-new-tab-intent' import { SAFE_POPUP_WINDOW_OPTIONS, safeOrigin } from './browser-manager-types' -import { openPopupWithOriginBar, type PopupChildWindowOptions } from './popup-origin-bar-window' +import { + openPopupWithOriginBar, + type PopupChildWindowOptions +} from './guest-lifecycle/popups/popup-origin-bar-window' import { BrowserManagerNavigation } from './browser-manager-navigation' import { allowNativeBrowserPopup, discardBrowserPopupContents, isNativeBrowserPopupRequest -} from './browser-popup-native-window' -import { isBrowserRouteGuestPopup } from './browser-route-guest-popup-ownership' -import { requestBrowserExternalAppLaunch } from './browser-external-app-launch' +} from './guest-lifecycle/popups/browser-popup-native-window' +import { isBrowserRouteGuestPopup } from './routing/guest-authority/browser-route-guest-popup-ownership' +import { requestBrowserExternalAppLaunch } from './guest-lifecycle/prompts/browser-external-app-launch' export abstract class BrowserManagerGuestPopupPolicy extends BrowserManagerNavigation { protected installGuestPopupPolicy(guest: Electron.WebContents): () => void { diff --git a/src/main/browser/browser-manager-guest-shortcuts.test.ts b/src/main/browser/browser-manager-guest-shortcuts.test.ts index 471282d93ca..79ca0733879 100644 --- a/src/main/browser/browser-manager-guest-shortcuts.test.ts +++ b/src/main/browser/browser-manager-guest-shortcuts.test.ts @@ -35,7 +35,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-guest-unload.test.ts b/src/main/browser/browser-manager-guest-unload.test.ts index 8411a03635d..378f03f60f6 100644 --- a/src/main/browser/browser-manager-guest-unload.test.ts +++ b/src/main/browser/browser-manager-guest-unload.test.ts @@ -9,7 +9,9 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: () => ({ x: 0, y: 0 }) }, webContents: { fromId: () => null } })) -vi.mock('./popup-origin-bar-window', () => ({ openPopupWithOriginBar: vi.fn() })) +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ + openPopupWithOriginBar: vi.fn() +})) import { BrowserManager } from './browser-manager' import { DestroyedGuestTestContents } from './browser-manager-destroyed-guest-test-fixture' diff --git a/src/main/browser/browser-manager-guest-visibility.test.ts b/src/main/browser/browser-manager-guest-visibility.test.ts index f5225a9b97c..ce76f40d2b8 100644 --- a/src/main/browser/browser-manager-guest-visibility.test.ts +++ b/src/main/browser/browser-manager-guest-visibility.test.ts @@ -35,7 +35,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-load-failure-replay.test.ts b/src/main/browser/browser-manager-load-failure-replay.test.ts index b2946221591..34e9f8039c1 100644 --- a/src/main/browser/browser-manager-load-failure-replay.test.ts +++ b/src/main/browser/browser-manager-load-failure-replay.test.ts @@ -35,7 +35,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-navigation.ts b/src/main/browser/browser-manager-navigation.ts index cc5ca7ab294..28fee9d2575 100644 --- a/src/main/browser/browser-manager-navigation.ts +++ b/src/main/browser/browser-manager-navigation.ts @@ -1,4 +1,7 @@ -import { openPopupWithOriginBar, type PopupChildWindowOptions } from './popup-origin-bar-window' +import { + openPopupWithOriginBar, + type PopupChildWindowOptions +} from './guest-lifecycle/popups/popup-origin-bar-window' import { getBrowserProcessUserAgentIdentity } from './browser-process-user-agent' import type { BrowserSessionRequestUserAgentResolver } from './browser-session-ua' import { isGoogleAuthUrl } from './browser-google-auth-ua' diff --git a/src/main/browser/browser-manager-page-prompt-routing.test.ts b/src/main/browser/browser-manager-page-prompt-routing.test.ts index f7e2790b72c..3ae4d8125cf 100644 --- a/src/main/browser/browser-manager-page-prompt-routing.test.ts +++ b/src/main/browser/browser-manager-page-prompt-routing.test.ts @@ -37,13 +37,13 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) import { browserManager } from './browser-manager' -import { respondToBrowserPagePrompt } from './browser-page-prompts' -import { handleBrowserGuestLogin } from './browser-http-auth-prompt' +import { respondToBrowserPagePrompt } from './guest-lifecycle/prompts/browser-page-prompts' +import { handleBrowserGuestLogin } from './guest-lifecycle/prompts/browser-http-auth-prompt' import { rendererWebContentsId, resetBrowserManagerMocks, diff --git a/src/main/browser/browser-manager-popup-child.test.ts b/src/main/browser/browser-manager-popup-child.test.ts index 9861de4aa01..b894868266d 100644 --- a/src/main/browser/browser-manager-popup-child.test.ts +++ b/src/main/browser/browser-manager-popup-child.test.ts @@ -25,7 +25,7 @@ vi.mock('electron', () => ({ webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-popup-openerless-tab.test.ts b/src/main/browser/browser-manager-popup-openerless-tab.test.ts index b8c5047f1a1..e9ab4a8286d 100644 --- a/src/main/browser/browser-manager-popup-openerless-tab.test.ts +++ b/src/main/browser/browser-manager-popup-openerless-tab.test.ts @@ -30,7 +30,7 @@ vi.mock('electron', () => ({ webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-popup-routing.test.ts b/src/main/browser/browser-manager-popup-routing.test.ts index 4e70fde4a58..4a84c306d47 100644 --- a/src/main/browser/browser-manager-popup-routing.test.ts +++ b/src/main/browser/browser-manager-popup-routing.test.ts @@ -37,7 +37,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) @@ -45,7 +45,7 @@ import { browserManager } from './browser-manager' import { MAX_PAGE_INITIATED_TABS_PER_WINDOW, PAGE_INITIATED_TAB_WINDOW_MS -} from './browser-page-initiated-tab-budget' +} from './guest-lifecycle/popups/browser-page-initiated-tab-budget' import { rendererWebContentsId, resetBrowserManagerMocks, diff --git a/src/main/browser/browser-manager-queries.ts b/src/main/browser/browser-manager-queries.ts index c78933a7370..f237b7f52ee 100644 --- a/src/main/browser/browser-manager-queries.ts +++ b/src/main/browser/browser-manager-queries.ts @@ -10,8 +10,11 @@ import { BrowserManagerRegistration } from './browser-manager-registration' import { isBrowserRouteGuestPopup, listBrowserRouteGuestPopups -} from './browser-route-guest-popup-ownership' -import { browserPopupPageId, browserPopupPageWebContentsId } from './browser-popup-page-id' +} from './routing/guest-authority/browser-route-guest-popup-ownership' +import { + browserPopupPageId, + browserPopupPageWebContentsId +} from './guest-lifecycle/popups/browser-popup-page-id' export abstract class BrowserManagerQueries extends BrowserManagerRegistration { getGuestWebContentsId(browserTabId: string): number | null { diff --git a/src/main/browser/browser-manager-registration.ts b/src/main/browser/browser-manager-registration.ts index 53b1d6a2c14..4db744f55c9 100644 --- a/src/main/browser/browser-manager-registration.ts +++ b/src/main/browser/browser-manager-registration.ts @@ -1,12 +1,12 @@ import { webContents } from 'electron' -import { browserDownloadDestinationReservations } from './browser-download-destination' +import { browserDownloadDestinationReservations } from './downloads/browser-download-destination' import { isWorkspaceDocPageId } from './doc-preview-guest-policy' import type { BrowserGuestRegistration } from './browser-manager-types' import { BrowserManagerGuestPolicy } from './browser-manager-guest-policy' import { cancelBrowserPagePrompts, showBrowserPagePromptsAwaitingRegistration -} from './browser-page-prompts' +} from './guest-lifecycle/prompts/browser-page-prompts' export abstract class BrowserManagerRegistration extends BrowserManagerGuestPolicy { registerGuest( diff --git a/src/main/browser/browser-manager-state.ts b/src/main/browser/browser-manager-state.ts index b3dc6078e64..c3d6ca5ede3 100644 --- a/src/main/browser/browser-manager-state.ts +++ b/src/main/browser/browser-manager-state.ts @@ -4,11 +4,11 @@ import type { BrowserSiteDisplayController } from './browser-site-display-contro import { createPageInitiatedTabBudget, type PageInitiatedTabBudget -} from './browser-page-initiated-tab-budget' +} from './guest-lifecycle/popups/browser-page-initiated-tab-budget' import type { KeybindingOverrides } from '../../shared/keybindings' import type { BrowserLoadError } from '../../shared/browser-workspace-types' -import { resolveBrowserRouteGuestPopupOpener } from './browser-route-guest-popup-ownership' -import type { BrowserPagePromptTarget } from './browser-page-prompts' +import { resolveBrowserRouteGuestPopupOpener } from './routing/guest-authority/browser-route-guest-popup-ownership' +import type { BrowserPagePromptTarget } from './guest-lifecycle/prompts/browser-page-prompts' import type { ActiveDownload, CdpUserAgentOverrideState, @@ -25,7 +25,7 @@ import type { } from '../../shared/browser-guest-events' import type { BrowserGrabCancelReason } from '../../shared/browser-grab-types' import { BrowserManagerViewportScrollState } from './browser-manager-viewport-scroll-state' -import { BrowserGuestDevToolsDock } from './browser-guest-devtools-dock' +import { BrowserGuestDevToolsDock } from './guest-lifecycle/browser-guest-devtools-dock' /** A link a headless serve page asked to open as an Orca tab beside it. */ export type OffscreenBrowserTabOpenRequest = { diff --git a/src/main/browser/browser-manager-tab-identity.test.ts b/src/main/browser/browser-manager-tab-identity.test.ts index 9987ef79171..9f28a1133bc 100644 --- a/src/main/browser/browser-manager-tab-identity.test.ts +++ b/src/main/browser/browser-manager-tab-identity.test.ts @@ -26,7 +26,7 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: mocks.screenGetCursorScreenPointMock }, webContents: { fromId: mocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: mocks.openPopupWithOriginBarMock })) vi.mock('./browser-process-user-agent', () => ({ diff --git a/src/main/browser/browser-manager-types.ts b/src/main/browser/browser-manager-types.ts index fafdcf0dc32..b97574b72e0 100644 --- a/src/main/browser/browser-manager-types.ts +++ b/src/main/browser/browser-manager-types.ts @@ -13,8 +13,8 @@ import type { BrowserGrabResult, BrowserGrabScreenshot } from '../../shared/browser-grab-types' -import type { BrowserClientDownloadRoute } from './browser-client-download-relay' -import type { PageInitiatedTabBudget } from './browser-page-initiated-tab-budget' +import type { BrowserClientDownloadRoute } from './client-hosts/file-transfers/browser-client-download-relay' +import type { PageInitiatedTabBudget } from './guest-lifecycle/popups/browser-page-initiated-tab-budget' import type { BrowserCertificateFailure, BrowserLoadError, diff --git a/src/main/browser/browser-manager-viewport-override.test.ts b/src/main/browser/browser-manager-viewport-override.test.ts index e1cd778c43f..4b533da27aa 100644 --- a/src/main/browser/browser-manager-viewport-override.test.ts +++ b/src/main/browser/browser-manager-viewport-override.test.ts @@ -38,7 +38,7 @@ vi.mock('electron', () => ({ } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-viewport-ownership.test.ts b/src/main/browser/browser-manager-viewport-ownership.test.ts index c6e2d36d08e..40922c1e591 100644 --- a/src/main/browser/browser-manager-viewport-ownership.test.ts +++ b/src/main/browser/browser-manager-viewport-ownership.test.ts @@ -26,7 +26,7 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: mocks.screenGetCursorScreenPointMock }, webContents: { fromId: mocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: mocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-viewport-partial-failure.test.ts b/src/main/browser/browser-manager-viewport-partial-failure.test.ts index 53dd189b29e..1f33a96ebfd 100644 --- a/src/main/browser/browser-manager-viewport-partial-failure.test.ts +++ b/src/main/browser/browser-manager-viewport-partial-failure.test.ts @@ -24,7 +24,7 @@ vi.mock('electron', () => ({ screen: { getCursorScreenPoint: mocks.screenGetCursorScreenPointMock }, webContents: { fromId: mocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: mocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-manager-viewport.ts b/src/main/browser/browser-manager-viewport.ts index 3b1a3e8f534..f8bd7d78e5d 100644 --- a/src/main/browser/browser-manager-viewport.ts +++ b/src/main/browser/browser-manager-viewport.ts @@ -6,8 +6,8 @@ import { } from '../../shared/browser-annotation-viewport-bridge' import type { BrowserViewportOverride } from '../../shared/browser-workspace-types' import { BrowserManagerDownloadLifecycle } from './browser-manager-download-lifecycle' -import { sendGuestCdpCommand } from './guest-cdp-command' -import { touchEmulationParams } from './guest-touch-emulation' +import { sendGuestCdpCommand } from './cdp/debugger/guest-cdp-command' +import { touchEmulationParams } from './cdp/input/guest-touch-emulation' import type { BrowserDevToolsDockBounds } from '../../shared/browser-devtools-dock' export abstract class BrowserManagerViewport extends BrowserManagerDownloadLifecycle { diff --git a/src/main/browser/browser-manager-visibility.ts b/src/main/browser/browser-manager-visibility.ts index 0207fe32a27..3a9616b8333 100644 --- a/src/main/browser/browser-manager-visibility.ts +++ b/src/main/browser/browser-manager-visibility.ts @@ -1,15 +1,18 @@ import { webContents } from 'electron' import { rendererPublicationThrottle } from '../window/renderer-publication-throttle' import { BrowserManagerState } from './browser-manager-state' -import { focusGuardUnavailableError, guardPaneFocusForAgentInput } from './agent-input-focus-guard' +import { + focusGuardUnavailableError, + guardPaneFocusForAgentInput +} from './cdp/input/agent-input-focus-guard' import { BrowserAgentActivity, type AgentCommandLease, type AgentPointerInput -} from './browser-agent-activity' -import { BrowserPageEvents, type BrowserPageEvent } from './browser-page-events' -import { BrowserPageInputCredit } from './browser-page-input-credit' -import { browserPopupPageId } from './browser-popup-page-id' +} from './guest-lifecycle/browser-agent-activity' +import { BrowserPageEvents, type BrowserPageEvent } from './guest-lifecycle/browser-page-events' +import { BrowserPageInputCredit } from './routing/input-ownership/browser-page-input-credit' +import { browserPopupPageId } from './guest-lifecycle/popups/browser-popup-page-id' import type { RpcCallerIdentity } from '../runtime/rpc/rpc-caller-identity' export abstract class BrowserManagerVisibility extends BrowserManagerState { diff --git a/src/main/browser/browser-manager-worker-request-user-agent.test.ts b/src/main/browser/browser-manager-worker-request-user-agent.test.ts index f32413f6f11..efb844ed712 100644 --- a/src/main/browser/browser-manager-worker-request-user-agent.test.ts +++ b/src/main/browser/browser-manager-worker-request-user-agent.test.ts @@ -28,7 +28,7 @@ vi.mock('electron', () => ({ webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('./guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) diff --git a/src/main/browser/browser-session-partition-policies.test.ts b/src/main/browser/browser-session-partition-policies.test.ts index fc7f163829f..6517ab27d73 100644 --- a/src/main/browser/browser-session-partition-policies.test.ts +++ b/src/main/browser/browser-session-partition-policies.test.ts @@ -346,7 +346,8 @@ describe('partition permission policy', () => { const install = await loadInstaller() const store = await import('./browser-site-permission-store') store.configureBrowserSitePermissionStore(mkdtempSync(join(tmpdir(), 'orca-site-permissions-'))) - const { respondToBrowserPagePrompt } = await import('./browser-page-prompts') + const { respondToBrowserPagePrompt } = + await import('./guest-lifecycle/prompts/browser-page-prompts') const send = vi.fn() // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: prompts only read id, isDestroyed, send and subscribe to the window's lifecycle events. const renderer = { @@ -452,7 +453,7 @@ describe('partition permission policy', () => { it('gives browsing pages File System Access but keeps it from pages another machine can script', async () => { const install = await loadInstaller() const { installBrowserRoutePartitionPolicies } = - await import('./browser-session-route-policies') + await import('./routing/sessions/browser-session-route-policies') const routed = `persist:orca-browser-v1-${'a'.repeat(64)}` install(profileFor('persist:browsing-5')) void installBrowserRoutePartitionPolicies(profileFor('persist:browsing-5'), routed) diff --git a/src/main/browser/browser-session-proxy.ts b/src/main/browser/browser-session-proxy.ts index 8390ccdae24..fd5cc3e0ab9 100644 --- a/src/main/browser/browser-session-proxy.ts +++ b/src/main/browser/browser-session-proxy.ts @@ -8,7 +8,7 @@ import type { NetworkProxySettings } from '../../shared/network-proxy' import { readNetworkProxySettings, setNetworkProxySettingsSource -} from './browser-network-proxy-settings-source' +} from './network/execution-routes/browser-network-proxy-settings-source' let proxyPolicyGeneration = 0 // Stop stale readiness loops before a removed partition's queued proxy release. diff --git a/src/main/browser/browser-session-registry.ts b/src/main/browser/browser-session-registry.ts index 87b273516dc..3290c2bf895 100644 --- a/src/main/browser/browser-session-registry.ts +++ b/src/main/browser/browser-session-registry.ts @@ -30,7 +30,7 @@ import { import { clearBrowserRoutePartitionPolicies, installBrowserRoutePartitionPolicies -} from './browser-session-route-policies' +} from './routing/sessions/browser-session-route-policies' import { retireDeletedBrowserSessionProfile, retireFailedBrowserSessionProfile diff --git a/src/main/browser/browser-session-startup.test.ts b/src/main/browser/browser-session-startup.test.ts index b643f8264e1..d6b7d0fdcc5 100644 --- a/src/main/browser/browser-session-startup.test.ts +++ b/src/main/browser/browser-session-startup.test.ts @@ -22,13 +22,13 @@ function installRegistryMock(): { initializeBrowserSessionsFromPersistedState: initializeBrowserSessionsFromPersistedStateMock } })) - vi.doMock('./browser-route-session-runtime', () => ({ + vi.doMock('./routing/sessions/browser-route-session-runtime', () => ({ configureRouteSessionsForOrcaProfile: configureRouteSessionsForOrcaProfileMock })) - vi.doMock('./browser-route-partition-storage-runtime', () => ({ + vi.doMock('./routing/partitions/browser-route-partition-storage-runtime', () => ({ collectOrphanedBrowserRoutePartitionStorage: collectOrphanedBrowserRoutePartitionStorageMock })) - vi.doMock('./paired-runtime-browser-client-host-runtime', () => ({ + vi.doMock('./client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ configurePairedRuntimeBrowserClientHostsForOrcaProfile: configurePairedRuntimeBrowserClientHostsForOrcaProfileMock })) diff --git a/src/main/browser/browser-session-startup.ts b/src/main/browser/browser-session-startup.ts index 3e0159ab0f8..f3c822801da 100644 --- a/src/main/browser/browser-session-startup.ts +++ b/src/main/browser/browser-session-startup.ts @@ -1,11 +1,11 @@ import { browserSessionRegistry } from './browser-session-registry' import type { BrowserSessionRegistryProfileOptions } from './browser-session-registry' -import { collectOrphanedBrowserRoutePartitionStorage } from './browser-route-partition-storage-runtime' -import { configureRouteSessionsForOrcaProfile } from './browser-route-session-runtime' +import { collectOrphanedBrowserRoutePartitionStorage } from './routing/partitions/browser-route-partition-storage-runtime' +import { configureRouteSessionsForOrcaProfile } from './routing/sessions/browser-route-session-runtime' import { configureBrowserSitePermissionStore } from './browser-site-permission-store' import { configureBrowserSiteDisplayStore } from './browser-site-display-store' import { configureBrowserExtensionProfileDataDirectory } from './extensions/browser-extension-profile-data-directory' -import { configurePairedRuntimeBrowserClientHostsForOrcaProfile } from './paired-runtime-browser-client-host-runtime' +import { configurePairedRuntimeBrowserClientHostsForOrcaProfile } from './client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' let initialized = false diff --git a/src/main/browser/browser-site-display-controller.ts b/src/main/browser/browser-site-display-controller.ts index 3b577316c2b..a06ad363017 100644 --- a/src/main/browser/browser-site-display-controller.ts +++ b/src/main/browser/browser-site-display-controller.ts @@ -1,4 +1,7 @@ -import { acquireElectronDebugger, type ElectronDebuggerLease } from './electron-debugger-lease' +import { + acquireElectronDebugger, + type ElectronDebuggerLease +} from './cdp/debugger/electron-debugger-lease' import { getBrowserSiteDisplay, updateBrowserSiteDisplay } from './browser-site-display-store' import { browserSiteDisplayKey, diff --git a/src/main/browser/browser-site-permission-prompt.test.ts b/src/main/browser/browser-site-permission-prompt.test.ts index beb77a44edf..4de2ce9c8c5 100644 --- a/src/main/browser/browser-site-permission-prompt.test.ts +++ b/src/main/browser/browser-site-permission-prompt.test.ts @@ -16,7 +16,10 @@ vi.mock('./browser-manager', () => ({ import type { BrowserPagePromptRequest } from '../../shared/browser-page-prompt' import type { BrowserSitePermission } from '../../shared/browser-site-permission' -import { BROWSER_PAGE_PROMPT_TIMEOUT_MS, respondToBrowserPagePrompt } from './browser-page-prompts' +import { + BROWSER_PAGE_PROMPT_TIMEOUT_MS, + respondToBrowserPagePrompt +} from './guest-lifecycle/prompts/browser-page-prompts' import { decideBrowserSitePermissions, isBrowserSitePermissionAllowed, diff --git a/src/main/browser/browser-site-permission-prompt.ts b/src/main/browser/browser-site-permission-prompt.ts index 17f9f09cc32..d7ea11dc1b4 100644 --- a/src/main/browser/browser-site-permission-prompt.ts +++ b/src/main/browser/browser-site-permission-prompt.ts @@ -7,7 +7,10 @@ import { } from '../../shared/browser-site-permission' import { isEligibleLocalCertificateHost } from '../../shared/browser-url' import { browserManager } from './browser-manager' -import { browserPagePromptOrigin, openBrowserPagePrompt } from './browser-page-prompts' +import { + browserPagePromptOrigin, + openBrowserPagePrompt +} from './guest-lifecycle/prompts/browser-page-prompts' import { getBrowserSitePermissionDecision, setBrowserSitePermissionDecisions diff --git a/src/main/browser/cdp-auxiliary-commands.ts b/src/main/browser/cdp/commands/cdp-auxiliary-commands.ts similarity index 97% rename from src/main/browser/cdp-auxiliary-commands.ts rename to src/main/browser/cdp/commands/cdp-auxiliary-commands.ts index 713333db155..358a2909ba6 100644 --- a/src/main/browser/cdp-auxiliary-commands.ts +++ b/src/main/browser/cdp/commands/cdp-auxiliary-commands.ts @@ -15,8 +15,8 @@ import type { BrowserNetworkEntry, BrowserNetworkLogResult, BrowserViewportResult -} from '../../shared/runtime-types' -import type { CdpCommandSender, SnapshotResult } from './snapshot-engine' +} from '../../../../shared/runtime-browser-contracts' +import type { CdpCommandSender, SnapshotResult } from '../snapshots/snapshot-engine' export type CdpTabState = { navigationId: string | null diff --git a/src/main/browser/cdp-bridge-command-module.ts b/src/main/browser/cdp/commands/cdp-bridge-command-module.ts similarity index 95% rename from src/main/browser/cdp-bridge-command-module.ts rename to src/main/browser/cdp/commands/cdp-bridge-command-module.ts index b6cbbb424c3..30ca2a53e7b 100644 --- a/src/main/browser/cdp-bridge-command-module.ts +++ b/src/main/browser/cdp/commands/cdp-bridge-command-module.ts @@ -1,7 +1,10 @@ import type { WebContents } from 'electron' -import type { BrowserScreenshotResult, BrowserScrollResult } from '../../shared/runtime-types' +import type { + BrowserScreenshotResult, + BrowserScrollResult +} from '../../../../shared/runtime-browser-contracts' import type { CdpTabState } from './cdp-auxiliary-commands' -import type { CdpCommandSender, RefEntry } from './snapshot-engine' +import type { CdpCommandSender, RefEntry } from '../snapshots/snapshot-engine' import type { CdpBridgeState, CdpQueuedCommand } from './cdp-bridge-state' import type { CdpDebuggerLifecycle } from './cdp-debugger-lifecycle' import type { CdpNavigationOperations } from './cdp-navigation-operations' diff --git a/src/main/browser/cdp-bridge-command-set.ts b/src/main/browser/cdp/commands/cdp-bridge-command-set.ts similarity index 92% rename from src/main/browser/cdp-bridge-command-set.ts rename to src/main/browser/cdp/commands/cdp-bridge-command-set.ts index 988c69a2258..bd159a95c42 100644 --- a/src/main/browser/cdp-bridge-command-set.ts +++ b/src/main/browser/cdp/commands/cdp-bridge-command-set.ts @@ -1,15 +1,15 @@ import type { WebContents } from 'electron' import { CdpAuxiliaryCommands, type CdpTabState } from './cdp-auxiliary-commands' -import type { CdpCommandSender } from './snapshot-engine' +import type { CdpCommandSender } from '../snapshots/snapshot-engine' import type { CdpBridgeState } from './cdp-bridge-state' import { CdpDebuggerLifecycle } from './cdp-debugger-lifecycle' import { CdpElementStateCommands } from './cdp-element-state-commands' import { CdpNavigationOperations } from './cdp-navigation-operations' import { CdpPageCommands } from './cdp-page-commands' -import { CdpPointerCommands } from './cdp-pointer-commands' +import { CdpPointerCommands } from '../input/cdp-pointer-commands' import { CdpRefResolution } from './cdp-ref-resolution' import { CdpTabCommands } from './cdp-tab-commands' -import { CdpTextInputCommands } from './cdp-text-input-commands' +import { CdpTextInputCommands } from '../input/cdp-text-input-commands' export class CdpBridgeCommandSet { readonly auxiliary: CdpAuxiliaryCommands diff --git a/src/main/browser/cdp-bridge-integration.test.ts b/src/main/browser/cdp/commands/cdp-bridge-integration.test.ts similarity index 95% rename from src/main/browser/cdp-bridge-integration.test.ts rename to src/main/browser/cdp/commands/cdp-bridge-integration.test.ts index 10018fb16d9..a07c91b37ec 100644 --- a/src/main/browser/cdp-bridge-integration.test.ts +++ b/src/main/browser/cdp/commands/cdp-bridge-integration.test.ts @@ -1,9 +1,9 @@ -import type * as WorktreeScanCacheModule from '../git/worktrees/catalog/worktree-scan-cache' -import type * as WorktreeListingModule from '../git/worktrees/catalog/worktree-listing' -import '../runtime/desktop-browser-bridge/desktop-browser-bridge-allowlist.spec' +import type * as WorktreeScanCacheModule from '../../../git/worktrees/catalog/worktree-scan-cache' +import type * as WorktreeListingModule from '../../../git/worktrees/catalog/worktree-listing' +import '../../../runtime/desktop-browser-bridge/desktop-browser-bridge-allowlist.spec' import { mkdtempSync } from 'node:fs' -import { RuntimeBrowserCommands } from '../runtime/browser/browser-commands' -import { setRuntimeBrowserCommandsFactory } from '../runtime/runtime-browser-commands-factory' +import { RuntimeBrowserCommands } from '../../../runtime/browser/browser-commands' +import { setRuntimeBrowserCommandsFactory } from '../../../runtime/runtime-browser-commands-factory' import { tmpdir } from 'node:os' import { join } from 'node:path' import { createConnection } from 'node:net' @@ -13,7 +13,7 @@ const { webContentsFromIdMock } = vi.hoisted(() => ({ webContentsFromIdMock: vi.fn() })) -vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) => { +vi.mock('../../../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) => { const facade = getWorktreeListingMocks() return { ...(await importOriginal()), @@ -21,7 +21,7 @@ vi.mock('../git/worktrees/catalog/worktree-scan-cache', async (importOriginal) = } }) -vi.mock('../git/worktrees/catalog/worktree-listing', async (importOriginal) => { +vi.mock('../../../git/worktrees/catalog/worktree-listing', async (importOriginal) => { const facade = getWorktreeListingMocks() return { ...(await importOriginal()), @@ -45,12 +45,12 @@ const { getWorktreeListingMocks } = vi.hoisted(() => { return { getWorktreeListingMocks: () => (listings ??= createWorktreeListingMocks()) } }) -import { BrowserManager } from './browser-manager' +import { BrowserManager } from '../../browser-manager' import { CdpBridge } from './cdp-bridge' -import { BROWSER_TEXT_INSERT_CHUNK_BYTES } from '../../shared/browser-text-insertion-chunks' -import { OrcaRuntimeService } from '../runtime/orca-runtime' -import { OrcaRuntimeRpcServer } from '../runtime/runtime-rpc' -import { readRuntimeMetadata } from '../runtime/runtime-metadata' +import { BROWSER_TEXT_INSERT_CHUNK_BYTES } from '../../../../shared/browser-text-insertion-chunks' +import { OrcaRuntimeService } from '../../../runtime/orca-runtime' +import { OrcaRuntimeRpcServer } from '../../../runtime/runtime-rpc' +import { readRuntimeMetadata } from '../../../runtime/runtime-metadata' type AXNode = { nodeId: string diff --git a/src/main/browser/cdp-bridge-state.ts b/src/main/browser/cdp/commands/cdp-bridge-state.ts similarity index 98% rename from src/main/browser/cdp-bridge-state.ts rename to src/main/browser/cdp/commands/cdp-bridge-state.ts index c65901fe0ec..630bee7652b 100644 --- a/src/main/browser/cdp-bridge-state.ts +++ b/src/main/browser/cdp/commands/cdp-bridge-state.ts @@ -1,5 +1,5 @@ import { webContents } from 'electron' -import { BrowserError } from './browser-error' +import { BrowserError } from '../../browser-error' import type { CdpTabState } from './cdp-auxiliary-commands' export type CdpQueuedCommand = { diff --git a/src/main/browser/cdp-bridge.ts b/src/main/browser/cdp/commands/cdp-bridge.ts similarity index 98% rename from src/main/browser/cdp-bridge.ts rename to src/main/browser/cdp/commands/cdp-bridge.ts index ac2048cd54a..c56d1f5d367 100644 --- a/src/main/browser/cdp-bridge.ts +++ b/src/main/browser/cdp/commands/cdp-bridge.ts @@ -32,14 +32,13 @@ import type { BrowserUploadResult, BrowserViewportResult, BrowserWaitResult -} from '../../shared/runtime-types' -import type { BrowserManager } from './browser-manager' +} from '../../../../shared/runtime-browser-contracts' +import type { BrowserManager } from '../../browser-manager' import type { CdpAuxiliaryCommands, CdpTabState } from './cdp-auxiliary-commands' import { CdpBridgeCommandSet } from './cdp-bridge-command-set' import { CdpBridgeState, type CdpQueuedCommand } from './cdp-bridge-state' // Preserve existing imports; runtime code uses browser-error without loading Chromium. -export { BrowserError } from './browser-error' export class CdpBridge { private activeWebContentsId: number | null = null diff --git a/src/main/browser/cdp-client-command.ts b/src/main/browser/cdp/commands/cdp-client-command.ts similarity index 100% rename from src/main/browser/cdp-client-command.ts rename to src/main/browser/cdp/commands/cdp-client-command.ts diff --git a/src/main/browser/cdp-debugger-channel.ts b/src/main/browser/cdp/commands/cdp-debugger-channel.ts similarity index 92% rename from src/main/browser/cdp-debugger-channel.ts rename to src/main/browser/cdp/commands/cdp-debugger-channel.ts index 9bb4d1f27c4..661e2bb2c2a 100644 --- a/src/main/browser/cdp-debugger-channel.ts +++ b/src/main/browser/cdp/commands/cdp-debugger-channel.ts @@ -1,10 +1,13 @@ import { WebSocket } from 'ws' import type { WebContents } from 'electron' -import { acquireElectronDebugger, type ElectronDebuggerLease } from './electron-debugger-lease' -import type { CdpClientResponseWriter } from './cdp-client-response-writer' +import { + acquireElectronDebugger, + type ElectronDebuggerLease +} from '../debugger/electron-debugger-lease' +import type { CdpClientResponseWriter } from '../transport/cdp-client-response-writer' import type { CdpSyntheticSessionRegistry } from './cdp-synthetic-session-registry' -import { sendGuestCdpCommand } from './guest-cdp-command' -import { isOrcaFrameSessionTraffic } from './guest-focused-frame-route' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' +import { isOrcaFrameSessionTraffic } from '../input/guest-frame-input-sessions' export class CdpDebuggerChannel { private nativeDebugger: WebContents['debugger'] | null = null diff --git a/src/main/browser/cdp-debugger-events.ts b/src/main/browser/cdp/commands/cdp-debugger-events.ts similarity index 98% rename from src/main/browser/cdp-debugger-events.ts rename to src/main/browser/cdp/commands/cdp-debugger-events.ts index e76e59b9912..ea44c713279 100644 --- a/src/main/browser/cdp-debugger-events.ts +++ b/src/main/browser/cdp/commands/cdp-debugger-events.ts @@ -1,5 +1,5 @@ import type { WebContents } from 'electron' -import type { BrowserNetworkEntry } from '../../shared/runtime-types' +import type { BrowserNetworkEntry } from '../../../../shared/runtime-browser-contracts' import type { CdpTabState } from './cdp-auxiliary-commands' const CAPTURE_LOG_LIMIT = 1000 diff --git a/src/main/browser/cdp-debugger-lifecycle.ts b/src/main/browser/cdp/commands/cdp-debugger-lifecycle.ts similarity index 94% rename from src/main/browser/cdp-debugger-lifecycle.ts rename to src/main/browser/cdp/commands/cdp-debugger-lifecycle.ts index da0ed2a1c4a..a7bfba9cce2 100644 --- a/src/main/browser/cdp-debugger-lifecycle.ts +++ b/src/main/browser/cdp/commands/cdp-debugger-lifecycle.ts @@ -1,10 +1,10 @@ import type { WebContents } from 'electron' -import { BrowserError } from './browser-error' +import { BrowserError } from '../../browser-error' import type { CdpTabState } from './cdp-auxiliary-commands' -import type { CdpCommandSender } from './snapshot-engine' +import type { CdpCommandSender } from '../snapshots/snapshot-engine' import type { CdpBridgeState } from './cdp-bridge-state' import { createCdpDebuggerMessageListener } from './cdp-debugger-events' -import { sendGuestCdpCommand } from './guest-cdp-command' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' export class CdpDebuggerLifecycle { constructor(private readonly bridgeState: CdpBridgeState) {} diff --git a/src/main/browser/cdp-dom-focus-replay.ts b/src/main/browser/cdp/commands/cdp-dom-focus-replay.ts similarity index 96% rename from src/main/browser/cdp-dom-focus-replay.ts rename to src/main/browser/cdp/commands/cdp-dom-focus-replay.ts index a7924578d76..45045e5fbd3 100644 --- a/src/main/browser/cdp-dom-focus-replay.ts +++ b/src/main/browser/cdp/commands/cdp-dom-focus-replay.ts @@ -1,8 +1,8 @@ import type { WebSocket } from 'ws' import type { WebContents } from 'electron' -import type { CdpClientResponseWriter } from './cdp-client-response-writer' +import type { CdpClientResponseWriter } from '../transport/cdp-client-response-writer' import type { CdpDebuggerChannel } from './cdp-debugger-channel' -import type { TextInsertionRoute } from './guest-direct-key-input' +import type { TextInsertionRoute } from '../input/guest-direct-key-input' /** Replay DOM.focus before insertion because native focusing can blur the target. */ export class CdpDomFocusReplay { diff --git a/src/main/browser/cdp-element-capture.ts b/src/main/browser/cdp/commands/cdp-element-capture.ts similarity index 100% rename from src/main/browser/cdp-element-capture.ts rename to src/main/browser/cdp/commands/cdp-element-capture.ts diff --git a/src/main/browser/cdp-element-state-commands.ts b/src/main/browser/cdp/commands/cdp-element-state-commands.ts similarity index 98% rename from src/main/browser/cdp-element-state-commands.ts rename to src/main/browser/cdp/commands/cdp-element-state-commands.ts index 073b2998141..93948aa6006 100644 --- a/src/main/browser/cdp-element-state-commands.ts +++ b/src/main/browser/cdp/commands/cdp-element-state-commands.ts @@ -2,7 +2,7 @@ import type { BrowserCheckResult, BrowserSelectResult, BrowserUploadResult -} from '../../shared/runtime-types' +} from '../../../../shared/runtime-browser-contracts' import { CdpBridgeCommandModule } from './cdp-bridge-command-module' export class CdpElementStateCommands extends CdpBridgeCommandModule { diff --git a/src/main/browser/cdp-navigation-operations.ts b/src/main/browser/cdp/commands/cdp-navigation-operations.ts similarity index 96% rename from src/main/browser/cdp-navigation-operations.ts rename to src/main/browser/cdp/commands/cdp-navigation-operations.ts index 487c9baa771..e74512f3269 100644 --- a/src/main/browser/cdp-navigation-operations.ts +++ b/src/main/browser/cdp/commands/cdp-navigation-operations.ts @@ -1,6 +1,6 @@ import type { WebContents } from 'electron' -import { BrowserError } from './browser-error' -import type { CdpCommandSender } from './snapshot-engine' +import { BrowserError } from '../../browser-error' +import type { CdpCommandSender } from '../snapshots/snapshot-engine' export class CdpNavigationOperations { async getNavigationId(sender: CdpCommandSender): Promise { diff --git a/src/main/browser/cdp-page-capture-commands.ts b/src/main/browser/cdp/commands/cdp-page-capture-commands.ts similarity index 93% rename from src/main/browser/cdp-page-capture-commands.ts rename to src/main/browser/cdp/commands/cdp-page-capture-commands.ts index ad8d73fa373..a0bd4f0e525 100644 --- a/src/main/browser/cdp-page-capture-commands.ts +++ b/src/main/browser/cdp/commands/cdp-page-capture-commands.ts @@ -2,8 +2,8 @@ import type { WebSocket } from 'ws' import type { WebContents } from 'electron' import { captureScreenshot, type CapturePaintHold } from './cdp-screenshot' import { buildPrintToPdfOptions, CdpPdfStreamStore } from './cdp-print-to-pdf' -import type { CdpClientResponseWriter } from './cdp-client-response-writer' -import { readRemoteCliAdmittedPage } from './remote-cli-page-admission' +import type { CdpClientResponseWriter } from '../transport/cdp-client-response-writer' +import { readRemoteCliAdmittedPage } from '../../routing/input-ownership/remote-cli-page-admission' export class CdpPageCaptureCommands { private readonly pdfStreams = new CdpPdfStreamStore() diff --git a/src/main/browser/cdp-page-commands.ts b/src/main/browser/cdp/commands/cdp-page-commands.ts similarity index 97% rename from src/main/browser/cdp-page-commands.ts rename to src/main/browser/cdp/commands/cdp-page-commands.ts index 1fa94ffa0d8..626f504e66b 100644 --- a/src/main/browser/cdp-page-commands.ts +++ b/src/main/browser/cdp/commands/cdp-page-commands.ts @@ -6,14 +6,14 @@ import type { BrowserScrollResult, BrowserSnapshotResult, BrowserWaitResult -} from '../../shared/runtime-types' -import { BrowserError } from './browser-error' +} from '../../../../shared/runtime-browser-contracts' +import { BrowserError } from '../../browser-error' import { CdpBridgeCommandModule, type CdpScreenshotFormat, type CdpScrollDirection } from './cdp-bridge-command-module' -import { buildSnapshot } from './snapshot-engine' +import { buildSnapshot } from '../snapshots/snapshot-engine' export class CdpPageCommands extends CdpBridgeCommandModule { snapshot(): Promise { diff --git a/src/main/browser/cdp-page-input-commands.ts b/src/main/browser/cdp/commands/cdp-page-input-commands.ts similarity index 93% rename from src/main/browser/cdp-page-input-commands.ts rename to src/main/browser/cdp/commands/cdp-page-input-commands.ts index c80c3baf714..d69a65caf74 100644 --- a/src/main/browser/cdp-page-input-commands.ts +++ b/src/main/browser/cdp/commands/cdp-page-input-commands.ts @@ -1,6 +1,6 @@ import type { WebSocket } from 'ws' import type { WebContents } from 'electron' -import type { CdpClientResponseWriter } from './cdp-client-response-writer' +import type { CdpClientResponseWriter } from '../transport/cdp-client-response-writer' import type { CdpDebuggerChannel } from './cdp-debugger-channel' import type { CdpDomFocusReplay } from './cdp-dom-focus-replay' import { @@ -8,17 +8,17 @@ import { isFocusRoutedCdpInput, isFocusTakingCdpInput, type AgentInputFocusGuard -} from './agent-input-focus-guard' +} from '../input/agent-input-focus-guard' import { dispatchPageKeyEvent, isEmbeddedGuest, routePageTextInsertion, type GuestCdpSender -} from './guest-direct-key-input' -import { withAgentInputInjection } from './agent-input-injection' -import type { AgentPointerInput } from './browser-agent-activity' +} from '../input/guest-direct-key-input' +import { withAgentInputInjection } from '../input/agent-input-injection' +import type { AgentPointerInput } from '../../guest-lifecycle/browser-agent-activity' import type { CapturePaintHold } from './cdp-screenshot' -import { waitForGuestFirstPaint } from './guest-first-paint' +import { waitForGuestFirstPaint } from '../debugger/guest-first-paint' /** Shows the agent's pointer at an input's point and resolves once it has landed. */ export type ShowAgentPointer = (input: AgentPointerInput) => Promise diff --git a/src/main/browser/cdp-page-navigation-commands.ts b/src/main/browser/cdp/commands/cdp-page-navigation-commands.ts similarity index 97% rename from src/main/browser/cdp-page-navigation-commands.ts rename to src/main/browser/cdp/commands/cdp-page-navigation-commands.ts index 90b0d10fd9d..fa0edcddabb 100644 --- a/src/main/browser/cdp-page-navigation-commands.ts +++ b/src/main/browser/cdp/commands/cdp-page-navigation-commands.ts @@ -1,6 +1,6 @@ import type { WebSocket } from 'ws' import type { WebContents } from 'electron' -import type { CdpClientResponseWriter } from './cdp-client-response-writer' +import type { CdpClientResponseWriter } from '../transport/cdp-client-response-writer' import type { CdpSyntheticSessionRegistry } from './cdp-synthetic-session-registry' import type { CdpDebuggerChannel } from './cdp-debugger-channel' diff --git a/src/main/browser/cdp-print-to-pdf.test.ts b/src/main/browser/cdp/commands/cdp-print-to-pdf.test.ts similarity index 100% rename from src/main/browser/cdp-print-to-pdf.test.ts rename to src/main/browser/cdp/commands/cdp-print-to-pdf.test.ts diff --git a/src/main/browser/cdp-print-to-pdf.ts b/src/main/browser/cdp/commands/cdp-print-to-pdf.ts similarity index 100% rename from src/main/browser/cdp-print-to-pdf.ts rename to src/main/browser/cdp/commands/cdp-print-to-pdf.ts diff --git a/src/main/browser/cdp-ref-resolution.ts b/src/main/browser/cdp/commands/cdp-ref-resolution.ts similarity index 98% rename from src/main/browser/cdp-ref-resolution.ts rename to src/main/browser/cdp/commands/cdp-ref-resolution.ts index 48391a78ffc..d469296379b 100644 --- a/src/main/browser/cdp-ref-resolution.ts +++ b/src/main/browser/cdp/commands/cdp-ref-resolution.ts @@ -1,7 +1,7 @@ import type { WebContents } from 'electron' -import { BrowserError } from './browser-error' +import { BrowserError } from '../../browser-error' import type { CdpTabState } from './cdp-auxiliary-commands' -import type { CdpCommandSender, RefEntry } from './snapshot-engine' +import type { CdpCommandSender, RefEntry } from '../snapshots/snapshot-engine' import type { CdpBridgeState } from './cdp-bridge-state' import type { CdpDebuggerLifecycle } from './cdp-debugger-lifecycle' import type { CdpNavigationOperations } from './cdp-navigation-operations' diff --git a/src/main/browser/cdp-screenshot.test.ts b/src/main/browser/cdp/commands/cdp-screenshot.test.ts similarity index 99% rename from src/main/browser/cdp-screenshot.test.ts rename to src/main/browser/cdp/commands/cdp-screenshot.test.ts index ab303dad338..62f452dfa8a 100644 --- a/src/main/browser/cdp-screenshot.test.ts +++ b/src/main/browser/cdp/commands/cdp-screenshot.test.ts @@ -1,7 +1,7 @@ import type { WebContents } from 'electron' import { afterEach, describe, expect, it, vi } from 'vitest' -import { runInRemoteCliBrowserScope } from '../runtime/desktop-browser-bridge/remote-cli-browser-scope' +import { runInRemoteCliBrowserScope } from '../../../runtime/desktop-browser-bridge/remote-cli-browser-scope' import { captureFullPageScreenshot, captureScreenshot } from './cdp-screenshot' function createMockWebContents() { diff --git a/src/main/browser/cdp-screenshot.ts b/src/main/browser/cdp/commands/cdp-screenshot.ts similarity index 97% rename from src/main/browser/cdp-screenshot.ts rename to src/main/browser/cdp/commands/cdp-screenshot.ts index 1995c6a43e8..a629bf1c690 100644 --- a/src/main/browser/cdp-screenshot.ts +++ b/src/main/browser/cdp/commands/cdp-screenshot.ts @@ -1,6 +1,9 @@ import type { WebContents } from 'electron' -import { sendGuestCdpCommand } from './guest-cdp-command' -import { assertRemoteCliPageAccess, readRemoteCliAdmittedPage } from './remote-cli-page-admission' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' +import { + assertRemoteCliPageAccess, + readRemoteCliAdmittedPage +} from '../../routing/input-ownership/remote-cli-page-admission' /** Draws a hidden guest while a capture or agent input needs its frames; returns its release. */ export type CapturePaintHold = () => () => void diff --git a/src/main/browser/cdp-synthetic-session-registry.ts b/src/main/browser/cdp/commands/cdp-synthetic-session-registry.ts similarity index 100% rename from src/main/browser/cdp-synthetic-session-registry.ts rename to src/main/browser/cdp/commands/cdp-synthetic-session-registry.ts diff --git a/src/main/browser/cdp-tab-commands.ts b/src/main/browser/cdp/commands/cdp-tab-commands.ts similarity index 96% rename from src/main/browser/cdp-tab-commands.ts rename to src/main/browser/cdp/commands/cdp-tab-commands.ts index dfb09877b10..35e865b3d0a 100644 --- a/src/main/browser/cdp-tab-commands.ts +++ b/src/main/browser/cdp/commands/cdp-tab-commands.ts @@ -3,8 +3,8 @@ import type { BrowserTabInfo, BrowserTabListResult, BrowserTabSwitchResult -} from '../../shared/runtime-types' -import { BrowserError } from './browser-error' +} from '../../../../shared/runtime-browser-contracts' +import { BrowserError } from '../../browser-error' import { CdpBridgeCommandModule } from './cdp-bridge-command-module' export class CdpTabCommands extends CdpBridgeCommandModule { diff --git a/src/main/browser/electron-debugger-lease.test.ts b/src/main/browser/cdp/debugger/electron-debugger-lease.test.ts similarity index 100% rename from src/main/browser/electron-debugger-lease.test.ts rename to src/main/browser/cdp/debugger/electron-debugger-lease.test.ts diff --git a/src/main/browser/electron-debugger-lease.ts b/src/main/browser/cdp/debugger/electron-debugger-lease.ts similarity index 100% rename from src/main/browser/electron-debugger-lease.ts rename to src/main/browser/cdp/debugger/electron-debugger-lease.ts diff --git a/src/main/browser/guest-cdp-command.test.ts b/src/main/browser/cdp/debugger/guest-cdp-command.test.ts similarity index 94% rename from src/main/browser/guest-cdp-command.test.ts rename to src/main/browser/cdp/debugger/guest-cdp-command.test.ts index 3726d8853d3..c6ed672ecee 100644 --- a/src/main/browser/guest-cdp-command.test.ts +++ b/src/main/browser/cdp/debugger/guest-cdp-command.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' import { sendGuestCdpCommand } from './guest-cdp-command' -import { runInRemoteCliBrowserScope } from '../runtime/desktop-browser-bridge/remote-cli-browser-scope' +import { runInRemoteCliBrowserScope } from '../../../runtime/desktop-browser-bridge/remote-cli-browser-scope' function makeGuest(state: { crashed?: boolean; destroyed?: boolean } = {}) { const sendCommand = vi.fn(async () => ({ ok: true })) diff --git a/src/main/browser/guest-cdp-command.ts b/src/main/browser/cdp/debugger/guest-cdp-command.ts similarity index 87% rename from src/main/browser/guest-cdp-command.ts rename to src/main/browser/cdp/debugger/guest-cdp-command.ts index cf55db5315d..93c7c7b0269 100644 --- a/src/main/browser/guest-cdp-command.ts +++ b/src/main/browser/cdp/debugger/guest-cdp-command.ts @@ -1,7 +1,10 @@ import type { WebContents } from 'electron' -import { BrowserError } from './browser-error' -import { withAgentInputInjection } from './agent-input-injection' -import { readRemoteCliAdmittedPage, trackRemoteCliInput } from './remote-cli-page-admission' +import { BrowserError } from '../../browser-error' +import { withAgentInputInjection } from '../input/agent-input-injection' +import { + readRemoteCliAdmittedPage, + trackRemoteCliInput +} from '../../routing/input-ownership/remote-cli-page-admission' // Resizing a crashed guest dereferences its missing Chromium view and can segfault main. const VIEW_RESIZING_CDP_METHODS: ReadonlySet = new Set([ diff --git a/src/main/browser/guest-first-paint.ts b/src/main/browser/cdp/debugger/guest-first-paint.ts similarity index 89% rename from src/main/browser/guest-first-paint.ts rename to src/main/browser/cdp/debugger/guest-first-paint.ts index 91c8cb6932a..6d3527147bb 100644 --- a/src/main/browser/guest-first-paint.ts +++ b/src/main/browser/cdp/debugger/guest-first-paint.ts @@ -1,7 +1,7 @@ import type { WebContents } from 'electron' -import type { CapturePaintHold } from './cdp-screenshot' -import { isEmbeddedGuest, type GuestCdpSender } from './guest-direct-key-input' -import { readRecord, settleWithin } from './guest-frame-input-sessions' +import type { CapturePaintHold } from '../commands/cdp-screenshot' +import { isEmbeddedGuest, type GuestCdpSender } from '../input/guest-direct-key-input' +import { readRecord, settleWithin } from '../input/guest-frame-input-sessions' const PAINTED_EXPRESSION = "performance.getEntriesByType('paint').length > 0" const AWAIT_FIRST_PAINT_EXPRESSION = `new Promise((resolve) => { diff --git a/src/main/browser/agent-input-focus-guard.test.ts b/src/main/browser/cdp/input/agent-input-focus-guard.test.ts similarity index 100% rename from src/main/browser/agent-input-focus-guard.test.ts rename to src/main/browser/cdp/input/agent-input-focus-guard.test.ts diff --git a/src/main/browser/agent-input-focus-guard.ts b/src/main/browser/cdp/input/agent-input-focus-guard.ts similarity index 98% rename from src/main/browser/agent-input-focus-guard.ts rename to src/main/browser/cdp/input/agent-input-focus-guard.ts index c3796044ec8..f67b63254be 100644 --- a/src/main/browser/agent-input-focus-guard.ts +++ b/src/main/browser/cdp/input/agent-input-focus-guard.ts @@ -1,6 +1,6 @@ import { randomUUID } from 'node:crypto' import { ipcMain, type WebContents } from 'electron' -import { BrowserError } from './browser-error' +import { BrowserError } from '../../browser-error' // Guest presses take Chromium focus; only the hosting pane can restore it (#20595). diff --git a/src/main/browser/agent-input-injection.test.ts b/src/main/browser/cdp/input/agent-input-injection.test.ts similarity index 94% rename from src/main/browser/agent-input-injection.test.ts rename to src/main/browser/cdp/input/agent-input-injection.test.ts index 87c16c5b3b5..0df16edb302 100644 --- a/src/main/browser/agent-input-injection.test.ts +++ b/src/main/browser/cdp/input/agent-input-injection.test.ts @@ -6,8 +6,8 @@ vi.mock('electron', () => ({ })) import { isAgentInjectingInput, withAgentInputInjection } from './agent-input-injection' -import { setupGuestShortcutForwarding } from './browser-guest-shortcut-forwarding' -import { setupGrabShortcutForwarding } from './browser-guest-grab-shortcuts' +import { setupGuestShortcutForwarding } from '../../guest-lifecycle/input/browser-guest-shortcut-forwarding' +import { setupGrabShortcutForwarding } from '../../guest-lifecycle/input/browser-guest-grab-shortcuts' type BeforeInputHandler = (event: Electron.Event, input: Electron.Input) => void diff --git a/src/main/browser/agent-input-injection.ts b/src/main/browser/cdp/input/agent-input-injection.ts similarity index 91% rename from src/main/browser/agent-input-injection.ts rename to src/main/browser/cdp/input/agent-input-injection.ts index 680692ddba7..b93f5009646 100644 --- a/src/main/browser/agent-input-injection.ts +++ b/src/main/browser/cdp/input/agent-input-injection.ts @@ -1,5 +1,5 @@ import type { WebContents } from 'electron' -import { assertRemoteCliPageAccess } from './remote-cli-page-admission' +import { assertRemoteCliPageAccess } from '../../routing/input-ownership/remote-cli-page-admission' // Agent keys must bypass Orca shortcuts, grab handlers, and app menus (#20595). type InjectionTarget = Pick diff --git a/src/main/browser/browser-element-functions.test.ts b/src/main/browser/cdp/input/browser-element-functions.test.ts similarity index 100% rename from src/main/browser/browser-element-functions.test.ts rename to src/main/browser/cdp/input/browser-element-functions.test.ts diff --git a/src/main/browser/browser-element-functions.ts b/src/main/browser/cdp/input/browser-element-functions.ts similarity index 100% rename from src/main/browser/browser-element-functions.ts rename to src/main/browser/cdp/input/browser-element-functions.ts diff --git a/src/main/browser/browser-expected-page-url.ts b/src/main/browser/cdp/input/browser-expected-page-url.ts similarity index 93% rename from src/main/browser/browser-expected-page-url.ts rename to src/main/browser/cdp/input/browser-expected-page-url.ts index 21c8b0f3c69..e965ba845a6 100644 --- a/src/main/browser/browser-expected-page-url.ts +++ b/src/main/browser/cdp/input/browser-expected-page-url.ts @@ -1,13 +1,13 @@ import { AsyncLocalStorage } from 'node:async_hooks' -import { isRecord } from '../../shared/agent-status-child-work-value-guards' +import { isRecord } from '../../../../shared/agent-status-child-work-value-guards' import { BROWSER_EXPECTED_URL_MISMATCH_CODE, clipUrlForMismatch, expectedUrlMismatchMessage, isSameBrowserUrl, type BrowserExpectedUrlMismatch -} from '../../shared/browser-expected-url' -import { BrowserError } from './browser-error' +} from '../../../../shared/browser-expected-url' +import { BrowserError } from '../../browser-error' export function browserExpectedUrlMismatchError( mismatch: BrowserExpectedUrlMismatch diff --git a/src/main/browser/browser-text-insertion.test.ts b/src/main/browser/cdp/input/browser-text-insertion.test.ts similarity index 94% rename from src/main/browser/browser-text-insertion.test.ts rename to src/main/browser/cdp/input/browser-text-insertion.test.ts index 76678629728..d936521e94f 100644 --- a/src/main/browser/browser-text-insertion.test.ts +++ b/src/main/browser/cdp/input/browser-text-insertion.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest' import { BROWSER_TEXT_INSERT_CHUNK_BYTES, splitBrowserTextInsertionChunks -} from '../../shared/browser-text-insertion-chunks' +} from '../../../../shared/browser-text-insertion-chunks' import { insertTextThroughCdp } from './browser-text-insertion' describe('browser text insertion chunking', () => { diff --git a/src/main/browser/browser-text-insertion.ts b/src/main/browser/cdp/input/browser-text-insertion.ts similarity index 70% rename from src/main/browser/browser-text-insertion.ts rename to src/main/browser/cdp/input/browser-text-insertion.ts index 48cc5298fa3..b5bd0d56e84 100644 --- a/src/main/browser/browser-text-insertion.ts +++ b/src/main/browser/cdp/input/browser-text-insertion.ts @@ -1,6 +1,6 @@ -import { iterateBrowserTextInsertionChunks } from '../../shared/browser-text-insertion-chunks' -import { yieldToEventLoop } from '../../shared/event-loop-yield' -import type { CdpCommandSender } from './snapshot-engine' +import { iterateBrowserTextInsertionChunks } from '../../../../shared/browser-text-insertion-chunks' +import { yieldToEventLoop } from '../../../../shared/event-loop-yield' +import type { CdpCommandSender } from '../snapshots/snapshot-engine' export async function insertTextThroughCdp( sender: CdpCommandSender, diff --git a/src/main/browser/browser-upload-files.ts b/src/main/browser/cdp/input/browser-upload-files.ts similarity index 91% rename from src/main/browser/browser-upload-files.ts rename to src/main/browser/cdp/input/browser-upload-files.ts index d5e68250230..91220a8be98 100644 --- a/src/main/browser/browser-upload-files.ts +++ b/src/main/browser/cdp/input/browser-upload-files.ts @@ -1,5 +1,5 @@ import { stat } from 'node:fs/promises' -import { BrowserError } from './browser-error' +import { BrowserError } from '../../browser-error' /** Chromium attaches a missing path as an empty file, so check the paths before handing them over. */ export async function assertUploadFilesExist(filePaths: readonly string[]): Promise { diff --git a/src/main/browser/cdp-keyboard-us-layout.test.ts b/src/main/browser/cdp/input/cdp-keyboard-us-layout.test.ts similarity index 100% rename from src/main/browser/cdp-keyboard-us-layout.test.ts rename to src/main/browser/cdp/input/cdp-keyboard-us-layout.test.ts diff --git a/src/main/browser/cdp-keyboard-us-layout.ts b/src/main/browser/cdp/input/cdp-keyboard-us-layout.ts similarity index 100% rename from src/main/browser/cdp-keyboard-us-layout.ts rename to src/main/browser/cdp/input/cdp-keyboard-us-layout.ts diff --git a/src/main/browser/cdp-pointer-commands.ts b/src/main/browser/cdp/input/cdp-pointer-commands.ts similarity index 96% rename from src/main/browser/cdp-pointer-commands.ts rename to src/main/browser/cdp/input/cdp-pointer-commands.ts index 8bc5ecdc193..c59348df172 100644 --- a/src/main/browser/cdp-pointer-commands.ts +++ b/src/main/browser/cdp/input/cdp-pointer-commands.ts @@ -2,8 +2,8 @@ import type { BrowserClickResult, BrowserDragResult, BrowserHoverResult -} from '../../shared/runtime-types' -import { CdpBridgeCommandModule } from './cdp-bridge-command-module' +} from '../../../../shared/runtime-browser-contracts' +import { CdpBridgeCommandModule } from '../commands/cdp-bridge-command-module' export class CdpPointerCommands extends CdpBridgeCommandModule { click(element: string): Promise { diff --git a/src/main/browser/cdp-pointer-input.ts b/src/main/browser/cdp/input/cdp-pointer-input.ts similarity index 96% rename from src/main/browser/cdp-pointer-input.ts rename to src/main/browser/cdp/input/cdp-pointer-input.ts index c4301f2a4a7..2ec2527fcab 100644 --- a/src/main/browser/cdp-pointer-input.ts +++ b/src/main/browser/cdp/input/cdp-pointer-input.ts @@ -1,10 +1,10 @@ import type { WebContents } from 'electron' -import { BrowserError } from './cdp-bridge' +import { BrowserError } from '../../browser-error' import { type CdpPointerButton, cdpPointerButtonMask, cdpPointerButtonFromMask -} from './agent-browser/agent-browser-bridge-mouse' +} from './cdp-pointer-targets' const MULTI_CLICK_INTERVAL_MS = 500 const MULTI_CLICK_SLOP_PX = 2 diff --git a/src/main/browser/agent-browser/agent-browser-bridge-mouse.ts b/src/main/browser/cdp/input/cdp-pointer-targets.ts similarity index 98% rename from src/main/browser/agent-browser/agent-browser-bridge-mouse.ts rename to src/main/browser/cdp/input/cdp-pointer-targets.ts index 021a8e3e167..b3d6451f93e 100644 --- a/src/main/browser/agent-browser/agent-browser-bridge-mouse.ts +++ b/src/main/browser/cdp/input/cdp-pointer-targets.ts @@ -1,5 +1,5 @@ import type { WebContents } from 'electron' -import type { BrowserMouseModifier } from './agent-browser-bridge-types' +export type BrowserMouseModifier = 'cmd' | 'ctrl' | 'alt' | 'shift' type CdpMouseButton = 'left' | 'middle' | 'right' diff --git a/src/main/browser/cdp-text-input-commands.ts b/src/main/browser/cdp/input/cdp-text-input-commands.ts similarity index 98% rename from src/main/browser/cdp-text-input-commands.ts rename to src/main/browser/cdp/input/cdp-text-input-commands.ts index dcefa054515..198d01b56a8 100644 --- a/src/main/browser/cdp-text-input-commands.ts +++ b/src/main/browser/cdp/input/cdp-text-input-commands.ts @@ -5,9 +5,9 @@ import type { BrowserKeypressResult, BrowserSelectAllResult, BrowserTypeResult -} from '../../shared/runtime-types' +} from '../../../../shared/runtime-browser-contracts' import { insertTextThroughCdp } from './browser-text-insertion' -import { CdpBridgeCommandModule } from './cdp-bridge-command-module' +import { CdpBridgeCommandModule } from '../commands/cdp-bridge-command-module' export class CdpTextInputCommands extends CdpBridgeCommandModule { fill(element: string, value: string): Promise { diff --git a/src/main/browser/guest-direct-key-input.test.ts b/src/main/browser/cdp/input/guest-direct-key-input.test.ts similarity index 100% rename from src/main/browser/guest-direct-key-input.test.ts rename to src/main/browser/cdp/input/guest-direct-key-input.test.ts diff --git a/src/main/browser/guest-direct-key-input.ts b/src/main/browser/cdp/input/guest-direct-key-input.ts similarity index 95% rename from src/main/browser/guest-direct-key-input.ts rename to src/main/browser/cdp/input/guest-direct-key-input.ts index fdc6fb35510..c4d0c32b6e1 100644 --- a/src/main/browser/guest-direct-key-input.ts +++ b/src/main/browser/cdp/input/guest-direct-key-input.ts @@ -2,22 +2,22 @@ import { assertExpectedPageUrlForStep } from './browser-expected-page-url' import type { WebContents } from 'electron' import { enablePageFocusEmulation, type AgentInputFocusGuard } from './agent-input-focus-guard' import { withAgentInputInjection } from './agent-input-injection' +import { resolveFocusedFrameRoute } from './guest-focused-frame-route' import { - resolveFocusedFrameRoute, settleWithin, - type GuestSessionCdpSender -} from './guest-focused-frame-route' -import { sendFrameSessionInput } from './guest-frame-input-sessions' + type GuestSessionCdpSender, + sendFrameSessionInput +} from './guest-frame-input-sessions' import { planCdpKeyEvent, planInsertText, type GuestEditCommand } from './guest-key-event-plan' -import { sendGuestCdpCommand } from './guest-cdp-command' -import { acquireElectronDebugger } from './electron-debugger-lease' -import { normalizeCdpPointerButton } from './agent-browser/agent-browser-bridge-mouse' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' +import { acquireElectronDebugger } from '../debugger/electron-debugger-lease' +import { normalizeCdpPointerButton } from './cdp-pointer-targets' import { cdpPointerStateFor, releaseCdpPointerButton } from './cdp-pointer-input' import { assertRemoteCliPageAccess, trackRemoteCliInput, type HeldInputRelease -} from './remote-cli-page-admission' +} from '../../routing/input-ownership/remote-cli-page-admission' // Main-session CDP keys follow window focus; guest widget events protect the user's input (#20595). diff --git a/src/main/browser/guest-file-chooser.ts b/src/main/browser/cdp/input/guest-file-chooser.ts similarity index 94% rename from src/main/browser/guest-file-chooser.ts rename to src/main/browser/cdp/input/guest-file-chooser.ts index 85c6f5fc4e9..fbd17bbdbe2 100644 --- a/src/main/browser/guest-file-chooser.ts +++ b/src/main/browser/cdp/input/guest-file-chooser.ts @@ -1,6 +1,6 @@ import type { WebContents } from 'electron' -import { withTimeout } from '../../shared/promise-timeout-fallback' -import { sendGuestCdpCommand } from './guest-cdp-command' +import { withTimeout } from '../../../../shared/promise-timeout-fallback' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' // A click's user activation lasts 5s in Chromium, so its picker cannot open any later. const FILE_CHOOSER_OPEN_TIMEOUT_MS = 5_000 diff --git a/src/main/browser/guest-focused-frame-route.test.ts b/src/main/browser/cdp/input/guest-focused-frame-route.test.ts similarity index 97% rename from src/main/browser/guest-focused-frame-route.test.ts rename to src/main/browser/cdp/input/guest-focused-frame-route.test.ts index e56f0efb075..64047ca8d0f 100644 --- a/src/main/browser/guest-focused-frame-route.test.ts +++ b/src/main/browser/cdp/input/guest-focused-frame-route.test.ts @@ -1,10 +1,7 @@ import { describe, expect, it, vi } from 'vitest' import type { WebContents } from 'electron' -import { - isOrcaFrameSessionTraffic, - resolveFocusedFrameRoute, - type GuestSessionCdpSender -} from './guest-focused-frame-route' +import { isOrcaFrameSessionTraffic, type GuestSessionCdpSender } from './guest-frame-input-sessions' +import { resolveFocusedFrameRoute } from './guest-focused-frame-route' function fakeGuest(): WebContents { // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the route only uses the guest as a cache key. diff --git a/src/main/browser/guest-focused-frame-route.ts b/src/main/browser/cdp/input/guest-focused-frame-route.ts similarity index 96% rename from src/main/browser/guest-focused-frame-route.ts rename to src/main/browser/cdp/input/guest-focused-frame-route.ts index e9ab9c03b6b..6d957cf5c1a 100644 --- a/src/main/browser/guest-focused-frame-route.ts +++ b/src/main/browser/cdp/input/guest-focused-frame-route.ts @@ -11,9 +11,6 @@ import { // Cross-site frames need their own CDP session; widget input only reaches the guest renderer. -export { isOrcaFrameSessionTraffic, settleWithin } from './guest-frame-input-sessions' -export type { GuestSessionCdpSender } from './guest-frame-input-sessions' - export type FocusedFrameRoute = | { kind: 'widget' } | { kind: 'session'; sessionId: string } diff --git a/src/main/browser/guest-frame-input-sessions.ts b/src/main/browser/cdp/input/guest-frame-input-sessions.ts similarity index 100% rename from src/main/browser/guest-frame-input-sessions.ts rename to src/main/browser/cdp/input/guest-frame-input-sessions.ts diff --git a/src/main/browser/guest-key-event-plan.ts b/src/main/browser/cdp/input/guest-key-event-plan.ts similarity index 100% rename from src/main/browser/guest-key-event-plan.ts rename to src/main/browser/cdp/input/guest-key-event-plan.ts diff --git a/src/main/browser/guest-touch-emulation.ts b/src/main/browser/cdp/input/guest-touch-emulation.ts similarity index 100% rename from src/main/browser/guest-touch-emulation.ts rename to src/main/browser/cdp/input/guest-touch-emulation.ts diff --git a/src/main/browser/browser-screencast-cdp-events.ts b/src/main/browser/cdp/screencast/browser-screencast-cdp-events.ts similarity index 95% rename from src/main/browser/browser-screencast-cdp-events.ts rename to src/main/browser/cdp/screencast/browser-screencast-cdp-events.ts index d2c4accbfdd..91358d8c4ea 100644 --- a/src/main/browser/browser-screencast-cdp-events.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-cdp-events.ts @@ -1,6 +1,6 @@ import { Buffer } from 'node:buffer' import type { WebContents } from 'electron' -import type { BrowserScreencastFrameMetadata } from '../../shared/browser-screencast-protocol' +import type { BrowserScreencastFrameMetadata } from '../../../../shared/browser-screencast-protocol' import { sendDebuggerCommand } from './browser-screencast-debugger-command' import { enrichFrameMetadata, readFrameMetadata } from './browser-screencast-frame-metadata' import { readBrowserScreencastImageSize } from './browser-screencast-image-size' @@ -9,7 +9,7 @@ import type { PendingScreencastFrame } from './browser-screencast-stream-types' import { isLiveFrameCompatibleWithViewport } from './browser-screencast-viewport-fit' -import type { BrowserJavaScriptDialog } from '../../shared/browser-javascript-dialog' +import type { BrowserJavaScriptDialog } from '../../../../shared/browser-javascript-dialog' type BrowserScreencastMessageHandlerDeps = { dbg: WebContents['debugger'] diff --git a/src/main/browser/browser-screencast-debugger-command.ts b/src/main/browser/cdp/screencast/browser-screencast-debugger-command.ts similarity index 100% rename from src/main/browser/browser-screencast-debugger-command.ts rename to src/main/browser/cdp/screencast/browser-screencast-debugger-command.ts diff --git a/src/main/browser/browser-screencast-device-metrics.ts b/src/main/browser/cdp/screencast/browser-screencast-device-metrics.ts similarity index 97% rename from src/main/browser/browser-screencast-device-metrics.ts rename to src/main/browser/cdp/screencast/browser-screencast-device-metrics.ts index 748b7515080..f64a3866370 100644 --- a/src/main/browser/browser-screencast-device-metrics.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-device-metrics.ts @@ -3,7 +3,7 @@ import { runDebuggerCommandWithTimeout, sendDebuggerCommand } from './browser-screencast-debugger-command' -import { sendGuestCdpCommand } from './guest-cdp-command' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' import type { BrowserScreencastOptions } from './browser-screencast-stream-types' import { positiveInteger, positiveNumber } from './browser-screencast-viewport-fit' diff --git a/src/main/browser/browser-screencast-first-frame-timeout.test.ts b/src/main/browser/cdp/screencast/browser-screencast-first-frame-timeout.test.ts similarity index 100% rename from src/main/browser/browser-screencast-first-frame-timeout.test.ts rename to src/main/browser/cdp/screencast/browser-screencast-first-frame-timeout.test.ts diff --git a/src/main/browser/browser-screencast-frame-budget.ts b/src/main/browser/cdp/screencast/browser-screencast-frame-budget.ts similarity index 100% rename from src/main/browser/browser-screencast-frame-budget.ts rename to src/main/browser/cdp/screencast/browser-screencast-frame-budget.ts diff --git a/src/main/browser/browser-screencast-frame-metadata.ts b/src/main/browser/cdp/screencast/browser-screencast-frame-metadata.ts similarity index 95% rename from src/main/browser/browser-screencast-frame-metadata.ts rename to src/main/browser/cdp/screencast/browser-screencast-frame-metadata.ts index 08628d44b45..9b7547343c7 100644 --- a/src/main/browser/browser-screencast-frame-metadata.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-frame-metadata.ts @@ -1,4 +1,4 @@ -import type { BrowserScreencastFrameMetadata } from '../../shared/browser-screencast-protocol' +import type { BrowserScreencastFrameMetadata } from '../../../../shared/browser-screencast-protocol' import type { BrowserScreencastOptions, ScreencastImageSize diff --git a/src/main/browser/browser-screencast-frame-pacer.ts b/src/main/browser/cdp/screencast/browser-screencast-frame-pacer.ts similarity index 98% rename from src/main/browser/browser-screencast-frame-pacer.ts rename to src/main/browser/cdp/screencast/browser-screencast-frame-pacer.ts index 9ebc45e17d8..cbb06350d3f 100644 --- a/src/main/browser/browser-screencast-frame-pacer.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-frame-pacer.ts @@ -2,7 +2,7 @@ import type { WebContents } from 'electron' import { BrowserScreencastOpcode, encodeBrowserScreencastFrame -} from '../../shared/browser-screencast-protocol' +} from '../../../../shared/browser-screencast-protocol' import { sendDebuggerCommand } from './browser-screencast-debugger-command' import type { BrowserScreencastOptions, diff --git a/src/main/browser/browser-screencast-guest-view-limit.test.ts b/src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.test.ts similarity index 98% rename from src/main/browser/browser-screencast-guest-view-limit.test.ts rename to src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.test.ts index 979c097553f..6a4955ccfb9 100644 --- a/src/main/browser/browser-screencast-guest-view-limit.test.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.test.ts @@ -1,7 +1,7 @@ import { Buffer } from 'node:buffer' import { describe, expect, it, vi } from 'vitest' -import { decodeBrowserScreencastFrame } from '../../shared/browser-screencast-protocol' +import { decodeBrowserScreencastFrame } from '../../../../shared/browser-screencast-protocol' import { clampScreencastViewportToGuestView } from './browser-screencast-guest-view-limit' import { startBrowserScreencast } from './browser-screencast-stream' import { createMockScreencastWebContents } from './browser-screencast-web-contents-test-double' diff --git a/src/main/browser/browser-screencast-guest-view-limit.ts b/src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.ts similarity index 95% rename from src/main/browser/browser-screencast-guest-view-limit.ts rename to src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.ts index 5a3a7914a9e..60380e76f7c 100644 --- a/src/main/browser/browser-screencast-guest-view-limit.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-guest-view-limit.ts @@ -1,5 +1,5 @@ import type { WebContents } from 'electron' -import type { BrowserScreencastFrameMetadata } from '../../shared/browser-screencast-protocol' +import type { BrowserScreencastFrameMetadata } from '../../../../shared/browser-screencast-protocol' import type { BrowserScreencastViewport } from './browser-screencast-stream-types' export type BrowserScreencastGuestViewSize = { diff --git a/src/main/browser/browser-screencast-image-size.ts b/src/main/browser/cdp/screencast/browser-screencast-image-size.ts similarity index 95% rename from src/main/browser/browser-screencast-image-size.ts rename to src/main/browser/cdp/screencast/browser-screencast-image-size.ts index 20a889fea05..31032740add 100644 --- a/src/main/browser/browser-screencast-image-size.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-image-size.ts @@ -1,4 +1,4 @@ -import type { BrowserScreencastFormat } from '../../shared/browser-screencast-protocol' +import type { BrowserScreencastFormat } from '../../../../shared/browser-screencast-protocol' type ImageSize = { width: number diff --git a/src/main/browser/browser-screencast-lifecycle.test.ts b/src/main/browser/cdp/screencast/browser-screencast-lifecycle.test.ts similarity index 100% rename from src/main/browser/browser-screencast-lifecycle.test.ts rename to src/main/browser/cdp/screencast/browser-screencast-lifecycle.test.ts diff --git a/src/main/browser/browser-screencast-live-frame-allocation.test.ts b/src/main/browser/cdp/screencast/browser-screencast-live-frame-allocation.test.ts similarity index 99% rename from src/main/browser/browser-screencast-live-frame-allocation.test.ts rename to src/main/browser/cdp/screencast/browser-screencast-live-frame-allocation.test.ts index c560d578829..880d8bffdb1 100644 --- a/src/main/browser/browser-screencast-live-frame-allocation.test.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-live-frame-allocation.test.ts @@ -7,7 +7,7 @@ import { describe, expect, it, vi } from 'vitest' import { decodeBrowserScreencastFrame, type BrowserScreencastFormat -} from '../../shared/browser-screencast-protocol' +} from '../../../../shared/browser-screencast-protocol' import { createBrowserScreencastMessageHandler } from './browser-screencast-cdp-events' import { createBrowserScreencastFramePacer } from './browser-screencast-frame-pacer' import type { BrowserScreencastOptions } from './browser-screencast-stream-types' diff --git a/src/main/browser/browser-screencast-snapshot-capture.ts b/src/main/browser/cdp/screencast/browser-screencast-snapshot-capture.ts similarity index 98% rename from src/main/browser/browser-screencast-snapshot-capture.ts rename to src/main/browser/cdp/screencast/browser-screencast-snapshot-capture.ts index 2bef529e7f8..733a4cb542a 100644 --- a/src/main/browser/browser-screencast-snapshot-capture.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-snapshot-capture.ts @@ -7,7 +7,7 @@ import type { PendingScreencastFrame } from './browser-screencast-stream-types' import { positiveInteger, scaleSnapshotToFit } from './browser-screencast-viewport-fit' -import { withTimeout } from '../../shared/promise-timeout-fallback' +import { withTimeout } from '../../../../shared/promise-timeout-fallback' // Bound capture time so queued viewport updates and stop can proceed. const SNAPSHOT_CAPTURE_TIMEOUT_MS = 10_000 diff --git a/src/main/browser/browser-screencast-stream-types.ts b/src/main/browser/cdp/screencast/browser-screencast-stream-types.ts similarity index 96% rename from src/main/browser/browser-screencast-stream-types.ts rename to src/main/browser/cdp/screencast/browser-screencast-stream-types.ts index a692d32d025..3d8b9295d6b 100644 --- a/src/main/browser/browser-screencast-stream-types.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-stream-types.ts @@ -1,7 +1,7 @@ import type { BrowserScreencastFormat, BrowserScreencastFrameMetadata -} from '../../shared/browser-screencast-protocol' +} from '../../../../shared/browser-screencast-protocol' export type BrowserScreencastOptions = { format: BrowserScreencastFormat diff --git a/src/main/browser/browser-screencast-stream.test.ts b/src/main/browser/cdp/screencast/browser-screencast-stream.test.ts similarity index 98% rename from src/main/browser/browser-screencast-stream.test.ts rename to src/main/browser/cdp/screencast/browser-screencast-stream.test.ts index 847cf9892d5..d642eeda3e2 100644 --- a/src/main/browser/browser-screencast-stream.test.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-stream.test.ts @@ -2,9 +2,9 @@ import { Buffer } from 'node:buffer' import { EventEmitter } from 'node:events' import { describe, expect, it, vi } from 'vitest' -import { decodeBrowserScreencastFrame } from '../../shared/browser-screencast-protocol' +import { decodeBrowserScreencastFrame } from '../../../../shared/browser-screencast-protocol' import { startBrowserScreencast } from './browser-screencast-stream' -import { installBrowserJavaScriptDialogs } from './browser-javascript-dialogs' +import { installBrowserJavaScriptDialogs } from '../../guest-lifecycle/prompts/browser-javascript-dialogs' import { createMockScreencastWebContents as createMockWebContents } from './browser-screencast-web-contents-test-double' function jpegWithSize(width: number, height: number): Buffer { diff --git a/src/main/browser/browser-screencast-stream.ts b/src/main/browser/cdp/screencast/browser-screencast-stream.ts similarity index 97% rename from src/main/browser/browser-screencast-stream.ts rename to src/main/browser/cdp/screencast/browser-screencast-stream.ts index a0e6aebdba8..130031924ae 100644 --- a/src/main/browser/browser-screencast-stream.ts +++ b/src/main/browser/cdp/screencast/browser-screencast-stream.ts @@ -1,6 +1,9 @@ import type { WebContents } from 'electron' -import { BrowserError } from './cdp-bridge' -import { acquireElectronDebugger, type ElectronDebuggerLease } from './electron-debugger-lease' +import { BrowserError } from '../../browser-error' +import { + acquireElectronDebugger, + type ElectronDebuggerLease +} from '../debugger/electron-debugger-lease' import { createBrowserScreencastMessageHandler } from './browser-screencast-cdp-events' import { sendDebuggerCommand } from './browser-screencast-debugger-command' import { createBrowserScreencastDeviceMetrics } from './browser-screencast-device-metrics' @@ -9,7 +12,7 @@ import { createBrowserScreencastSnapshotCapture } from './browser-screencast-sna import { answerBrowserJavaScriptDialog, getBrowserJavaScriptDialog -} from './browser-javascript-dialogs' +} from '../../guest-lifecycle/prompts/browser-javascript-dialogs' import { clampScreencastViewportToGuestView, isEmbedderSizedScreencastGuest, diff --git a/src/main/browser/browser-screencast-viewport-fit.ts b/src/main/browser/cdp/screencast/browser-screencast-viewport-fit.ts similarity index 100% rename from src/main/browser/browser-screencast-viewport-fit.ts rename to src/main/browser/cdp/screencast/browser-screencast-viewport-fit.ts diff --git a/src/main/browser/browser-screencast-web-contents-test-double.ts b/src/main/browser/cdp/screencast/browser-screencast-web-contents-test-double.ts similarity index 100% rename from src/main/browser/browser-screencast-web-contents-test-double.ts rename to src/main/browser/cdp/screencast/browser-screencast-web-contents-test-double.ts diff --git a/src/main/browser/snapshot-ax-tree-walk.ts b/src/main/browser/cdp/snapshots/snapshot-ax-tree-walk.ts similarity index 100% rename from src/main/browser/snapshot-ax-tree-walk.ts rename to src/main/browser/cdp/snapshots/snapshot-ax-tree-walk.ts diff --git a/src/main/browser/snapshot-cursor-interactive-elements.ts b/src/main/browser/cdp/snapshots/snapshot-cursor-interactive-elements.ts similarity index 100% rename from src/main/browser/snapshot-cursor-interactive-elements.ts rename to src/main/browser/cdp/snapshots/snapshot-cursor-interactive-elements.ts diff --git a/src/main/browser/snapshot-engine-iframe-sessions.test.ts b/src/main/browser/cdp/snapshots/snapshot-engine-iframe-sessions.test.ts similarity index 100% rename from src/main/browser/snapshot-engine-iframe-sessions.test.ts rename to src/main/browser/cdp/snapshots/snapshot-engine-iframe-sessions.test.ts diff --git a/src/main/browser/snapshot-engine.test.ts b/src/main/browser/cdp/snapshots/snapshot-engine.test.ts similarity index 100% rename from src/main/browser/snapshot-engine.test.ts rename to src/main/browser/cdp/snapshots/snapshot-engine.test.ts diff --git a/src/main/browser/snapshot-engine.ts b/src/main/browser/cdp/snapshots/snapshot-engine.ts similarity index 97% rename from src/main/browser/snapshot-engine.ts rename to src/main/browser/cdp/snapshots/snapshot-engine.ts index 2d9242d3c31..c8d7090ed69 100644 --- a/src/main/browser/snapshot-engine.ts +++ b/src/main/browser/cdp/snapshots/snapshot-engine.ts @@ -1,4 +1,4 @@ -import type { BrowserSnapshotRef } from '../../shared/runtime-types' +import type { BrowserSnapshotRef } from '../../../../shared/runtime-browser-contracts' import { walkTree, type AXNode, type SnapshotEntry } from './snapshot-ax-tree-walk' import { findCursorInteractiveElements } from './snapshot-cursor-interactive-elements' diff --git a/src/main/browser/cdp-client-response-writer.test.ts b/src/main/browser/cdp/transport/cdp-client-response-writer.test.ts similarity index 100% rename from src/main/browser/cdp-client-response-writer.test.ts rename to src/main/browser/cdp/transport/cdp-client-response-writer.test.ts diff --git a/src/main/browser/cdp-client-response-writer.ts b/src/main/browser/cdp/transport/cdp-client-response-writer.ts similarity index 98% rename from src/main/browser/cdp-client-response-writer.ts rename to src/main/browser/cdp/transport/cdp-client-response-writer.ts index 49e693e09c1..1fb8011bd3c 100644 --- a/src/main/browser/cdp-client-response-writer.ts +++ b/src/main/browser/cdp/transport/cdp-client-response-writer.ts @@ -2,7 +2,7 @@ import { WebSocket } from 'ws' import { createWsOutboundBackpressureQueue, type WsOutboundBackpressureQueue -} from '../../shared/ws-outbound-backpressure-queue' +} from '../../../../shared/ws-outbound-backpressure-queue' export class CdpClientResponseWriter { private readonly responseSessionIdsByClient = new WeakMap>() diff --git a/src/main/browser/cdp-loopback-request-guard.ts b/src/main/browser/cdp/transport/cdp-loopback-request-guard.ts similarity index 100% rename from src/main/browser/cdp-loopback-request-guard.ts rename to src/main/browser/cdp/transport/cdp-loopback-request-guard.ts diff --git a/src/main/browser/cdp-target-discovery.ts b/src/main/browser/cdp/transport/cdp-target-discovery.ts similarity index 97% rename from src/main/browser/cdp-target-discovery.ts rename to src/main/browser/cdp/transport/cdp-target-discovery.ts index 68ff5ee1b78..703771fd413 100644 --- a/src/main/browser/cdp-target-discovery.ts +++ b/src/main/browser/cdp/transport/cdp-target-discovery.ts @@ -2,7 +2,7 @@ import type { WebSocket } from 'ws' import type { IncomingMessage, ServerResponse } from 'node:http' import type { WebContents } from 'electron' import type { CdpClientResponseWriter } from './cdp-client-response-writer' -import type { CdpSyntheticSessionRegistry } from './cdp-synthetic-session-registry' +import type { CdpSyntheticSessionRegistry } from '../commands/cdp-synthetic-session-registry' export class CdpTargetDiscovery { constructor( diff --git a/src/main/browser/cdp-ws-proxy-first-paint.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-first-paint.test.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy-first-paint.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-first-paint.test.ts diff --git a/src/main/browser/cdp-ws-proxy-focus-replay.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy-focus-replay.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts diff --git a/src/main/browser/cdp-ws-proxy-host-admission.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts similarity index 97% rename from src/main/browser/cdp-ws-proxy-host-admission.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts index 18795ffa7be..a8a920ca219 100644 --- a/src/main/browser/cdp-ws-proxy-host-admission.test.ts +++ b/src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' import { CdpWsProxy } from './cdp-ws-proxy' -import { runWithRemoteCliPageAdmission } from './remote-cli-page-admission' -import { sendGuestCdpCommand } from './guest-cdp-command' -import { releaseHeldPageInput } from './guest-direct-key-input' +import { runWithRemoteCliPageAdmission } from '../../routing/input-ownership/remote-cli-page-admission' +import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' +import { releaseHeldPageInput } from '../input/guest-direct-key-input' import { connect, createMockWebContents, diff --git a/src/main/browser/cdp-ws-proxy-input-focus.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-input-focus.test.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy-input-focus.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-input-focus.test.ts diff --git a/src/main/browser/cdp-ws-proxy-malformed-messages.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-malformed-messages.test.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy-malformed-messages.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-malformed-messages.test.ts diff --git a/src/main/browser/cdp-ws-proxy-origin.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-origin.test.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy-origin.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-origin.test.ts diff --git a/src/main/browser/cdp-ws-proxy-startup-lifetime.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-startup-lifetime.test.ts similarity index 98% rename from src/main/browser/cdp-ws-proxy-startup-lifetime.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-startup-lifetime.test.ts index 07479bfa45b..64e498dd788 100644 --- a/src/main/browser/cdp-ws-proxy-startup-lifetime.test.ts +++ b/src/main/browser/cdp/transport/cdp-ws-proxy-startup-lifetime.test.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'node:events' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { CdpWsProxy } from './cdp-ws-proxy' -import { acquireElectronDebugger } from './electron-debugger-lease' +import { acquireElectronDebugger } from '../debugger/electron-debugger-lease' import { createMockWebContents, mockAsWebContents } from './cdp-ws-proxy-test-harness' const { createServerMock, webSocketServerMock } = vi.hoisted(() => ({ diff --git a/src/main/browser/cdp-ws-proxy-test-harness.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-test-harness.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy-test-harness.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy-test-harness.ts diff --git a/src/main/browser/cdp-ws-proxy.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy.test.ts similarity index 100% rename from src/main/browser/cdp-ws-proxy.test.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy.test.ts diff --git a/src/main/browser/cdp-ws-proxy.ts b/src/main/browser/cdp/transport/cdp-ws-proxy.ts similarity index 92% rename from src/main/browser/cdp-ws-proxy.ts rename to src/main/browser/cdp/transport/cdp-ws-proxy.ts index b5d84a5ee2c..709a223518f 100644 --- a/src/main/browser/cdp-ws-proxy.ts +++ b/src/main/browser/cdp/transport/cdp-ws-proxy.ts @@ -2,22 +2,22 @@ import { WebSocketServer, type WebSocket } from 'ws' import { createServer, type Server } from 'node:http' import type { WebContents } from 'electron' import { CdpClientResponseWriter } from './cdp-client-response-writer' -import { CdpSyntheticSessionRegistry } from './cdp-synthetic-session-registry' +import { CdpSyntheticSessionRegistry } from '../commands/cdp-synthetic-session-registry' import { CdpTargetDiscovery } from './cdp-target-discovery' -import { CdpDebuggerChannel } from './cdp-debugger-channel' -import { CdpPageNavigationCommands } from './cdp-page-navigation-commands' -import { CdpDomFocusReplay } from './cdp-dom-focus-replay' -import { CdpElementCapture } from './cdp-element-capture' -import { CdpPageCaptureCommands } from './cdp-page-capture-commands' -import type { CapturePaintHold } from './cdp-screenshot' -import type { AgentInputFocusGuard } from './agent-input-focus-guard' -import { CdpPageInputCommands, type ShowAgentPointer } from './cdp-page-input-commands' +import { CdpDebuggerChannel } from '../commands/cdp-debugger-channel' +import { CdpPageNavigationCommands } from '../commands/cdp-page-navigation-commands' +import { CdpDomFocusReplay } from '../commands/cdp-dom-focus-replay' +import { CdpElementCapture } from '../commands/cdp-element-capture' +import { CdpPageCaptureCommands } from '../commands/cdp-page-capture-commands' +import type { CapturePaintHold } from '../commands/cdp-screenshot' +import type { AgentInputFocusGuard } from '../input/agent-input-focus-guard' +import { CdpPageInputCommands, type ShowAgentPointer } from '../commands/cdp-page-input-commands' import { isTrustedCdpLoopbackRequest } from './cdp-loopback-request-guard' -import { parseCdpClientCommand } from './cdp-client-command' +import { parseCdpClientCommand } from '../commands/cdp-client-command' import { assertRemoteCliPageAccess, runUnderRemoteCliPageAdmission -} from './remote-cli-page-admission' +} from '../../routing/input-ownership/remote-cli-page-admission' export class CdpWsProxy { private httpServer: Server | null = null diff --git a/src/main/browser/browser-client-host-command-authority.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-authority.ts similarity index 97% rename from src/main/browser/browser-client-host-command-authority.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-authority.ts index da88b15c4d4..d852b1a8a04 100644 --- a/src/main/browser/browser-client-host-command-authority.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-authority.ts @@ -2,7 +2,7 @@ import type { BrowserClientHostedPageInventory, BrowserClientHostCommandEvent, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' type BrowserClientPageAuthority = Pick< BrowserClientHostedPageInventory, diff --git a/src/main/browser/browser-client-host-command-dispatcher.test.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts similarity index 99% rename from src/main/browser/browser-client-host-command-dispatcher.test.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts index 6f8b3242656..424ba57ed55 100644 --- a/src/main/browser/browser-client-host-command-dispatcher.test.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts @@ -3,7 +3,7 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BrowserClientHostCommandDispatcher } from './browser-client-host-command-dispatcher' const authority: BrowserClientHostLeaseAuthority = { diff --git a/src/main/browser/browser-client-host-command-dispatcher.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.ts similarity index 99% rename from src/main/browser/browser-client-host-command-dispatcher.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.ts index d6fbc4b7199..f0c5bb40b46 100644 --- a/src/main/browser/browser-client-host-command-dispatcher.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.ts @@ -3,7 +3,7 @@ import { type BrowserClientHostCommandEvent, type BrowserClientHostCommandResult, type BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { assertBrowserClientHostCommandAuthority, snapshotBrowserClientHostLeaseAuthority diff --git a/src/main/browser/browser-client-host-command-join.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-join.ts similarity index 100% rename from src/main/browser/browser-client-host-command-join.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-join.ts diff --git a/src/main/browser/browser-client-host-command-page.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-page.ts similarity index 99% rename from src/main/browser/browser-client-host-command-page.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-page.ts index 58439e07ee5..e59592af3cb 100644 --- a/src/main/browser/browser-client-host-command-page.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-page.ts @@ -1,7 +1,7 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { createPageState, type CommandRecord, diff --git a/src/main/browser/browser-client-host-command-result-cache.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-result-cache.ts similarity index 100% rename from src/main/browser/browser-client-host-command-result-cache.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-result-cache.ts diff --git a/src/main/browser/browser-client-host-command-retention.test.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-retention.test.ts similarity index 94% rename from src/main/browser/browser-client-host-command-retention.test.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-retention.test.ts index 1b00a40c330..78f29a5c49f 100644 --- a/src/main/browser/browser-client-host-command-retention.test.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-retention.test.ts @@ -3,11 +3,14 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BrowserClientHostCommandDispatcher } from './browser-client-host-command-dispatcher' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' -import { createCommand, createHarness } from './browser-client-page-command-executor-test-harness' -import { closeBrowserClientHostComposition } from './paired-runtime-browser-client-host-teardown' +import { BrowserClientPageCommandExecutor } from '../../client-pages/execution/browser-client-page-command-executor' +import { + createCommand, + createHarness +} from '../../client-pages/execution/browser-client-page-command-executor-test-harness' +import { closeBrowserClientHostComposition } from '../lifecycle/paired-runtime-browser-client-host-teardown' const authority: BrowserClientHostLeaseAuthority = { authorityRuntimeId: 'runtime-a', diff --git a/src/main/browser/browser-client-host-command-state.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-state.ts similarity index 99% rename from src/main/browser/browser-client-host-command-state.ts rename to src/main/browser/client-hosts/commands/browser-client-host-command-state.ts index 24f487edbb5..6763f9fa867 100644 --- a/src/main/browser/browser-client-host-command-state.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-state.ts @@ -2,7 +2,7 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BROWSER_COMMAND_CACHE_MAX_BYTES, diff --git a/src/main/browser/browser-command-cache-byte-retention.test.ts b/src/main/browser/client-hosts/commands/browser-command-cache-byte-retention.test.ts similarity index 97% rename from src/main/browser/browser-command-cache-byte-retention.test.ts rename to src/main/browser/client-hosts/commands/browser-command-cache-byte-retention.test.ts index bebb004eb8b..20fb35a713f 100644 --- a/src/main/browser/browser-command-cache-byte-retention.test.ts +++ b/src/main/browser/client-hosts/commands/browser-command-cache-byte-retention.test.ts @@ -3,8 +3,8 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' -import { BrowserHostCommandLedger } from '../runtime/browser-host/browser-host-command-ledger' +} from '../../../../shared/browser-client-host-protocol' +import { BrowserHostCommandLedger } from '../../../runtime/browser-host/browser-host-command-ledger' import { BrowserClientHostCommandDispatcher } from './browser-client-host-command-dispatcher' const authority: BrowserClientHostLeaseAuthority = { diff --git a/src/main/browser/browser-command-cache-bytes.ts b/src/main/browser/client-hosts/commands/browser-command-cache-bytes.ts similarity index 91% rename from src/main/browser/browser-command-cache-bytes.ts rename to src/main/browser/client-hosts/commands/browser-command-cache-bytes.ts index 76fcfd2a02c..3a3e8d9e8a5 100644 --- a/src/main/browser/browser-command-cache-bytes.ts +++ b/src/main/browser/client-hosts/commands/browser-command-cache-bytes.ts @@ -1,7 +1,7 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' export const BROWSER_COMMAND_CACHE_MAX_BYTES = 32 * 1024 * 1024 export const BROWSER_COMMAND_CACHE_MAX_BYTES_PER_PAGE = 8 * 1024 * 1024 diff --git a/src/main/browser/browser-host-command-result-settler.ts b/src/main/browser/client-hosts/commands/browser-host-command-result-settler.ts similarity index 98% rename from src/main/browser/browser-host-command-result-settler.ts rename to src/main/browser/client-hosts/commands/browser-host-command-result-settler.ts index 7a52da4a6f8..3d92c769f94 100644 --- a/src/main/browser/browser-host-command-result-settler.ts +++ b/src/main/browser/client-hosts/commands/browser-host-command-result-settler.ts @@ -1,7 +1,7 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' // Preserve half of the subscription's 32 nested-request slots for future control traffic. const DEFAULT_MAX_CONCURRENT_COMMAND_RESULTS = 16 diff --git a/src/main/browser/browser-host-command-result-submission.ts b/src/main/browser/client-hosts/commands/browser-host-command-result-submission.ts similarity index 85% rename from src/main/browser/browser-host-command-result-submission.ts rename to src/main/browser/client-hosts/commands/browser-host-command-result-submission.ts index b0b0b703720..2e7c35eb6e1 100644 --- a/src/main/browser/browser-host-command-result-submission.ts +++ b/src/main/browser/client-hosts/commands/browser-host-command-result-submission.ts @@ -3,9 +3,9 @@ import { BrowserClientHostCommandResultAck, type BrowserClientHostCommandEvent, type BrowserClientHostCommandResult as BrowserClientHostCommandResultType -} from '../../shared/browser-client-host-protocol' -import type { RemoteRuntimeSubscription } from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +} from '../../../../shared/browser-client-host-protocol' +import type { RemoteRuntimeSubscription } from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' export async function submitBrowserHostCommandResult( sendRequest: NonNullable, diff --git a/src/main/browser/browser-client-download-relay.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-download-relay.test.ts similarity index 98% rename from src/main/browser/browser-client-download-relay.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-download-relay.test.ts index da011d4b345..a22edeae8fc 100644 --- a/src/main/browser/browser-client-download-relay.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-download-relay.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import type { BrowserClientHostedPageInventory } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostedPageInventory } from '../../../../shared/browser-client-host-protocol' import { BrowserClientDownloadRelay, type BrowserClientDownloadRoute diff --git a/src/main/browser/browser-client-download-relay.ts b/src/main/browser/client-hosts/file-transfers/browser-client-download-relay.ts similarity index 98% rename from src/main/browser/browser-client-download-relay.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-download-relay.ts index ff8d194d293..ad3e966d482 100644 --- a/src/main/browser/browser-client-download-relay.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-download-relay.ts @@ -8,8 +8,8 @@ import { BROWSER_CLIENT_FILE_CHANNEL_PROTOCOL_VERSION, BROWSER_CLIENT_FILE_CHANNEL_TRANSFER_MAX_BYTES, BrowserClientFileChannelWriteResult -} from '../../shared/browser-client-file-channel-protocol' -import type { BrowserClientHostedPageInventory } from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-file-channel-protocol' +import type { BrowserClientHostedPageInventory } from '../../../../shared/browser-client-host-protocol' import type { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' export const BROWSER_CLIENT_FILE_CHANNEL_WRITE_METHOD = 'browser.clientHost.fileChannel.write' diff --git a/src/main/browser/browser-client-download-routing.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-download-routing.test.ts similarity index 98% rename from src/main/browser/browser-client-download-routing.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-download-routing.test.ts index cd4697c6699..596bb47b872 100644 --- a/src/main/browser/browser-client-download-routing.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-download-routing.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it } from 'vitest' -import type { BrowserClientHostedPageInventory } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostedPageInventory } from '../../../../shared/browser-client-host-protocol' import { BrowserClientDownloadRelay } from './browser-client-download-relay' import { registerBrowserClientDownloadRouter, diff --git a/src/main/browser/browser-client-download-routing.ts b/src/main/browser/client-hosts/file-transfers/browser-client-download-routing.ts similarity index 100% rename from src/main/browser/browser-client-download-routing.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-download-routing.ts diff --git a/src/main/browser/browser-client-file-channel-negotiation.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-file-channel-negotiation.test.ts similarity index 95% rename from src/main/browser/browser-client-file-channel-negotiation.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-file-channel-negotiation.test.ts index 8da654744a1..35fd00bf180 100644 --- a/src/main/browser/browser-client-file-channel-negotiation.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-file-channel-negotiation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { BrowserClientHostAttachParams } from '../../shared/browser-client-host-protocol' +import { BrowserClientHostAttachParams } from '../../../../shared/browser-client-host-protocol' import { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' describe('browser file channel negotiation', () => { diff --git a/src/main/browser/browser-client-file-channel-reconnect.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-file-channel-reconnect.test.ts similarity index 92% rename from src/main/browser/browser-client-file-channel-reconnect.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-file-channel-reconnect.test.ts index 3bf069f6d7b..6ed00d86cc9 100644 --- a/src/main/browser/browser-client-file-channel-reconnect.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-file-channel-reconnect.test.ts @@ -1,21 +1,21 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../shared/pairing' +import type { PairingOffer } from '../../../../shared/mobile-relay-pairing-offer' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) -import { PairedRuntimeBrowserHostLease } from './paired-runtime-browser-host-lease' +import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' const pairing = { v: 2, diff --git a/src/main/browser/browser-client-file-channel-transport.ts b/src/main/browser/client-hosts/file-transfers/browser-client-file-channel-transport.ts similarity index 88% rename from src/main/browser/browser-client-file-channel-transport.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-file-channel-transport.ts index 155797e3bef..876595e2bd6 100644 --- a/src/main/browser/browser-client-file-channel-transport.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-file-channel-transport.ts @@ -1,6 +1,6 @@ -import { BROWSER_CLIENT_FILE_CHANNEL_REQUIRED_ERROR } from '../../shared/browser-client-file-channel-methods' -import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +import { BROWSER_CLIENT_FILE_CHANNEL_REQUIRED_ERROR } from '../../../../shared/browser-client-file-channel-methods' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' /** Only unsupported legacy hosts permit local saves; unavailable channels must refuse transfers. */ export type BrowserClientFileChannelAvailability = 'negotiated' | 'unsupported' | 'unavailable' diff --git a/src/main/browser/browser-client-upload-buffer-retention.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts similarity index 95% rename from src/main/browser/browser-client-upload-buffer-retention.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts index 9d9d1c05733..b332c40ae5d 100644 --- a/src/main/browser/browser-client-upload-buffer-retention.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts @@ -4,10 +4,13 @@ import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, beforeEach, expect, it } from 'vitest' -import { BrowserClientFileChannelReadParams } from '../../shared/browser-client-file-channel-protocol' +import { BrowserClientFileChannelReadParams } from '../../../../shared/browser-client-file-channel-protocol' import { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' -import { createCommand, createHarness } from './browser-client-page-command-executor-test-harness' +import { BrowserClientPageCommandExecutor } from '../../client-pages/execution/browser-client-page-command-executor' +import { + createCommand, + createHarness +} from '../../client-pages/execution/browser-client-page-command-executor-test-harness' import { executeBrowserClientUploadCommand } from './browser-client-upload-command' import { BrowserClientUploadStaging } from './browser-client-upload-staging' import { diff --git a/src/main/browser/browser-client-upload-command.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-command.test.ts similarity index 96% rename from src/main/browser/browser-client-upload-command.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-command.test.ts index 829236b3934..d1823626c32 100644 --- a/src/main/browser/browser-client-upload-command.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-command.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' import { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' import { executeBrowserClientUploadCommand } from './browser-client-upload-command' import { BrowserClientUploadStaging } from './browser-client-upload-staging' diff --git a/src/main/browser/browser-client-upload-command.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-command.ts similarity index 86% rename from src/main/browser/browser-client-upload-command.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-command.ts index d167ee31569..a8debfa555c 100644 --- a/src/main/browser/browser-client-upload-command.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-command.ts @@ -1,6 +1,6 @@ -import { BROWSER_CLIENT_FILE_CHANNEL_REQUIRED_ERROR } from '../../shared/browser-client-file-channel-methods' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import { BrowserClientPageCommandError } from './browser-client-page-command-failure' +import { BROWSER_CLIENT_FILE_CHANNEL_REQUIRED_ERROR } from '../../../../shared/browser-client-file-channel-methods' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import { BrowserClientPageCommandError } from '../../client-pages/execution/browser-client-page-command-failure' import type { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' import type { BrowserClientUploadStaging } from './browser-client-upload-staging' import { diff --git a/src/main/browser/browser-client-upload-staging.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts similarity index 100% rename from src/main/browser/browser-client-upload-staging.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts diff --git a/src/main/browser/browser-client-upload-staging.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.ts similarity index 96% rename from src/main/browser/browser-client-upload-staging.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.ts index 360de392794..0f342128223 100644 --- a/src/main/browser/browser-client-upload-staging.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.ts @@ -6,9 +6,9 @@ import path from 'node:path' import { BROWSER_CLIENT_FILE_CHANNEL_MAX_FILES_PER_COMMAND, BROWSER_CLIENT_FILE_CHANNEL_TRANSFER_MAX_BYTES -} from '../../shared/browser-client-file-channel-protocol' -import { normalizeBrowserDownloadFilename } from '../../shared/browser-download-filename' -import { removeTree } from '../../shared/windows-transient-lock-removal' +} from '../../../../shared/browser-client-file-channel-protocol' +import { normalizeBrowserDownloadFilename } from '../../../../shared/browser-download-filename' +import { removeTree } from '../../../../shared/windows-transient-lock-removal' export type BrowserClientStagedUpload = { stagingId: string diff --git a/src/main/browser/browser-client-upload-transfer.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.test.ts similarity index 94% rename from src/main/browser/browser-client-upload-transfer.test.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.test.ts index 3c80d39cbf3..98c96a699f1 100644 --- a/src/main/browser/browser-client-upload-transfer.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' import { fetchBrowserClientUploadFiles } from './browser-client-upload-transfer' const event = { diff --git a/src/main/browser/browser-client-upload-transfer.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.ts similarity index 95% rename from src/main/browser/browser-client-upload-transfer.ts rename to src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.ts index 14beef93001..223197632c7 100644 --- a/src/main/browser/browser-client-upload-transfer.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-transfer.ts @@ -5,8 +5,8 @@ import { BROWSER_CLIENT_FILE_CHANNEL_TRANSFER_MAX_BYTES, BrowserClientFileChannelReadResult, decodeBrowserClientFileChannelChunk -} from '../../shared/browser-client-file-channel-protocol' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-file-channel-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' export const BROWSER_CLIENT_FILE_CHANNEL_READ_METHOD = 'browser.clientHost.fileChannel.read' diff --git a/src/main/browser/browser-host-admission-recovery.ts b/src/main/browser/client-hosts/leases/browser-host-admission-recovery.ts similarity index 88% rename from src/main/browser/browser-host-admission-recovery.ts rename to src/main/browser/client-hosts/leases/browser-host-admission-recovery.ts index 364e1f8980b..8f45709242b 100644 --- a/src/main/browser/browser-host-admission-recovery.ts +++ b/src/main/browser/client-hosts/leases/browser-host-admission-recovery.ts @@ -1,9 +1,9 @@ -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' import { isRecoverableRemoteRuntimeConnectionError, toRemoteRuntimeClientErrorLike -} from '../../shared/remote-runtime/remote-runtime-client-error-classification' +} from '../../../../shared/remote-runtime/remote-runtime-client-error-classification' import { nextBrowserHostReconnectDelay } from './browser-host-lease-reconnect-delay' import type { BrowserHostReconnectDelay } from './browser-host-lease-reconnect-delay' diff --git a/src/main/browser/browser-host-client-identity.test.ts b/src/main/browser/client-hosts/leases/browser-host-client-identity.test.ts similarity index 100% rename from src/main/browser/browser-host-client-identity.test.ts rename to src/main/browser/client-hosts/leases/browser-host-client-identity.test.ts diff --git a/src/main/browser/browser-host-client-identity.ts b/src/main/browser/client-hosts/leases/browser-host-client-identity.ts similarity index 95% rename from src/main/browser/browser-host-client-identity.ts rename to src/main/browser/client-hosts/leases/browser-host-client-identity.ts index 1c23f4a4768..44abc7b119c 100644 --- a/src/main/browser/browser-host-client-identity.ts +++ b/src/main/browser/client-hosts/leases/browser-host-client-identity.ts @@ -1,7 +1,7 @@ import { mkdirSync, readFileSync } from 'node:fs' import { randomUUID } from 'node:crypto' import { dirname, join } from 'node:path' -import { durableWriteTempPath, writeFileDurableSync } from '../filesystem/durable-file-write' +import { durableWriteTempPath, writeFileDurableSync } from '../../../filesystem/durable-file-write' export const BROWSER_HOST_CLIENT_IDENTITY_FILE_NAME = 'browser-host-client-identity.json' diff --git a/src/main/browser/browser-host-lease-inventory-refresh.ts b/src/main/browser/client-hosts/leases/browser-host-lease-inventory-refresh.ts similarity index 91% rename from src/main/browser/browser-host-lease-inventory-refresh.ts rename to src/main/browser/client-hosts/leases/browser-host-lease-inventory-refresh.ts index 618099192fa..e556510ec7b 100644 --- a/src/main/browser/browser-host-lease-inventory-refresh.ts +++ b/src/main/browser/client-hosts/leases/browser-host-lease-inventory-refresh.ts @@ -1,4 +1,4 @@ -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' type InventoryRefreshState = { closed: boolean diff --git a/src/main/browser/browser-host-lease-reconnect-attempts.ts b/src/main/browser/client-hosts/leases/browser-host-lease-reconnect-attempts.ts similarity index 93% rename from src/main/browser/browser-host-lease-reconnect-attempts.ts rename to src/main/browser/client-hosts/leases/browser-host-lease-reconnect-attempts.ts index 266f1cbe17f..ded2a0425c7 100644 --- a/src/main/browser/browser-host-lease-reconnect-attempts.ts +++ b/src/main/browser/client-hosts/leases/browser-host-lease-reconnect-attempts.ts @@ -1,4 +1,4 @@ -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' import { type BrowserHostReconnectDelay, nextBrowserHostReconnectDelay diff --git a/src/main/browser/browser-host-lease-reconnect-delay.ts b/src/main/browser/client-hosts/leases/browser-host-lease-reconnect-delay.ts similarity index 100% rename from src/main/browser/browser-host-lease-reconnect-delay.ts rename to src/main/browser/client-hosts/leases/browser-host-lease-reconnect-delay.ts diff --git a/src/main/browser/browser-host-lease-request-sender.ts b/src/main/browser/client-hosts/leases/browser-host-lease-request-sender.ts similarity index 68% rename from src/main/browser/browser-host-lease-request-sender.ts rename to src/main/browser/client-hosts/leases/browser-host-lease-request-sender.ts index b3dc6011e28..075a4d70cd9 100644 --- a/src/main/browser/browser-host-lease-request-sender.ts +++ b/src/main/browser/client-hosts/leases/browser-host-lease-request-sender.ts @@ -1,5 +1,5 @@ -import type { RemoteRuntimeSubscription } from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +import type { RemoteRuntimeSubscription } from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' /** Page traffic must use the lease's connection; ordinary runtime calls are rejected as stale. */ export function requireBrowserHostLeaseSendRequest( diff --git a/src/main/browser/paired-runtime-browser-authority-identity.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-authority-identity.ts similarity index 89% rename from src/main/browser/paired-runtime-browser-authority-identity.ts rename to src/main/browser/client-hosts/leases/paired-runtime-browser-authority-identity.ts index eb5164642a9..e32a7cba7d3 100644 --- a/src/main/browser/paired-runtime-browser-authority-identity.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-authority-identity.ts @@ -1,7 +1,7 @@ import { createHash } from 'node:crypto' -import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection' -import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments' -import type { BrowserClientPageAuthorityIdentity } from './browser-client-page-command-executor-dependencies' +import type { PairedRuntimeConnection } from '../../../../shared/paired-runtime-connection' +import type { KnownRuntimeEnvironment } from '../../../../shared/runtime-environments' +import type { BrowserClientPageAuthorityIdentity } from '../../client-pages/execution/browser-client-page-command-executor-dependencies' export function derivePairedRuntimeBrowserAuthorityIdentity(input: { orcaProfileId: string diff --git a/src/main/browser/paired-runtime-browser-host-lease-connection.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-connection.ts similarity index 95% rename from src/main/browser/paired-runtime-browser-host-lease-connection.ts rename to src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-connection.ts index 0574bce8fa1..daeabeabef1 100644 --- a/src/main/browser/paired-runtime-browser-host-lease-connection.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-connection.ts @@ -2,19 +2,19 @@ import { BrowserClientHostEvent, type BrowserClientHostCommandEvent, type BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY -} from '../../shared/protocol-version' +} from '../../../../shared/browser-runtime-capabilities' import { subscribeRemoteRuntimeRequest, type RemoteRuntimeSubscription, type RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' -import { createBrowserClientHostAttachRequest } from './browser-client-host-attach-request' -import { sameBrowserClientHostLeaseAuthority } from './browser-client-host-command-authority' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' +import { createBrowserClientHostAttachRequest } from '../lifecycle/browser-client-host-attach-request' +import { sameBrowserClientHostLeaseAuthority } from '../commands/browser-client-host-command-authority' import type { PairedRuntimeBrowserHostLeaseOptions } from './paired-runtime-browser-host-lease-options' type PairedRuntimeBrowserHostLeaseConnectionOptions = { diff --git a/src/main/browser/paired-runtime-browser-host-lease-options.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-options.ts similarity index 80% rename from src/main/browser/paired-runtime-browser-host-lease-options.ts rename to src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-options.ts index 6d87bc3fedc..47eacddfcd7 100644 --- a/src/main/browser/paired-runtime-browser-host-lease-options.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-options.ts @@ -3,9 +3,9 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' -import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection' -import type { RemoteRuntimeSubscriptionOptions } from '../../shared/remote-runtime/requests/remote-runtime-subscription-contract' +} from '../../../../shared/browser-client-host-protocol' +import type { PairedRuntimeConnection } from '../../../../shared/paired-runtime-connection' +import type { RemoteRuntimeSubscriptionOptions } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' export type PairedRuntimeBrowserHostLeaseOptions = { connection: PairedRuntimeConnection diff --git a/src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts similarity index 97% rename from src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts rename to src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts index 6bbcbe3c5e9..277be4eb3dc 100644 --- a/src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts @@ -1,18 +1,18 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../shared/pairing' +import type { PairingOffer } from '../../../../shared/mobile-relay-pairing-offer' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' -import type { BrowserClientHostCommandResult } from '../../shared/browser-client-host-protocol' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' +import type { BrowserClientHostCommandResult } from '../../../../shared/browser-client-host-protocol' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) diff --git a/src/main/browser/paired-runtime-browser-host-lease.test.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts similarity index 98% rename from src/main/browser/paired-runtime-browser-host-lease.test.ts rename to src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts index 2d3c08fc263..686a26302d6 100644 --- a/src/main/browser/paired-runtime-browser-host-lease.test.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts @@ -1,28 +1,28 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' import type { BrowserClientHostedPageInventory, BrowserClientHostCommandEvent, BrowserClientHostCommandResult -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BROWSER_CLIENT_HOST_PAGE_INVENTORY_MAX_BYTES, browserClientHostedPageInventoryByteLength -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY -} from '../../shared/protocol-version' +} from '../../../../shared/browser-runtime-capabilities' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' +} from '../../../../shared/remote-runtime/remote-runtime-client' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) diff --git a/src/main/browser/paired-runtime-browser-host-lease.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.ts similarity index 96% rename from src/main/browser/paired-runtime-browser-host-lease.ts rename to src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.ts index 80c8173dfa5..bc304e604b4 100644 --- a/src/main/browser/paired-runtime-browser-host-lease.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.ts @@ -3,20 +3,20 @@ import { type BrowserClientHostCommandEvent, type BrowserClientHostCommandResult as BrowserClientHostCommandResultType, type BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' -import { BROWSER_CLIENT_PAGE_METADATA_METHOD } from '../../shared/browser-client-page-metadata-protocol' -import { assertBrowserClientHostAttachOptions } from './browser-client-host-attach-request' +} from '../../../../shared/browser-client-host-protocol' +import { BROWSER_CLIENT_PAGE_METADATA_METHOD } from '../../../../shared/browser-client-page-metadata-protocol' +import { assertBrowserClientHostAttachOptions } from '../lifecycle/browser-client-host-attach-request' import { BrowserHostReconnectDelay, resolveBrowserHostReconnectDelay } from './browser-host-lease-reconnect-delay' import { reconnectBrowserHostLeaseUntil } from './browser-host-lease-reconnect-attempts' import { requireBrowserHostLeaseSendRequest } from './browser-host-lease-request-sender' -import { submitBrowserHostCommandResult } from './browser-host-command-result-submission' +import { submitBrowserHostCommandResult } from '../commands/browser-host-command-result-submission' import { BrowserHostCommandResultSettler, type BrowserHostCommandResultAdmission -} from './browser-host-command-result-settler' +} from '../commands/browser-host-command-result-settler' import { requestBrowserHostLeaseInventoryRefresh } from './browser-host-lease-inventory-refresh' import { PairedRuntimeBrowserHostLeaseConnection } from './paired-runtime-browser-host-lease-connection' import type { PairedRuntimeBrowserHostLeaseOptions } from './paired-runtime-browser-host-lease-options' diff --git a/src/main/browser/browser-client-host-attach-request.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-attach-request.ts similarity index 89% rename from src/main/browser/browser-client-host-attach-request.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-attach-request.ts index c1e78841599..0381666bcbe 100644 --- a/src/main/browser/browser-client-host-attach-request.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-attach-request.ts @@ -1,6 +1,6 @@ -import { BrowserClientHostAttachParams } from '../../shared/browser-client-host-protocol' -import { prepareBrowserClientPageInventoryForAttach } from './browser-client-page-inventory' -import type { PairedRuntimeBrowserHostLeaseOptions } from './paired-runtime-browser-host-lease-options' +import { BrowserClientHostAttachParams } from '../../../../shared/browser-client-host-protocol' +import { prepareBrowserClientPageInventoryForAttach } from '../../client-pages/lifecycle/browser-client-page-inventory' +import type { PairedRuntimeBrowserHostLeaseOptions } from '../leases/paired-runtime-browser-host-lease-options' export function assertBrowserClientHostAttachOptions( options: PairedRuntimeBrowserHostLeaseOptions diff --git a/src/main/browser/browser-client-host-authority-replacement-wait.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement-wait.ts similarity index 100% rename from src/main/browser/browser-client-host-authority-replacement-wait.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement-wait.ts diff --git a/src/main/browser/browser-client-host-authority-replacement.test.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement.test.ts similarity index 100% rename from src/main/browser/browser-client-host-authority-replacement.test.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement.test.ts diff --git a/src/main/browser/browser-client-host-authority-replacement.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement.ts similarity index 92% rename from src/main/browser/browser-client-host-authority-replacement.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement.ts index 8b58dcc98ed..248f7b23690 100644 --- a/src/main/browser/browser-client-host-authority-replacement.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-authority-replacement.ts @@ -1,4 +1,4 @@ -import { BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE } from '../../shared/browser-client-host-protocol' +import { BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE } from '../../../../shared/browser-client-host-protocol' /** Authority replacement preserves live guests for the successor to reclaim. */ export function isBrowserClientHostAuthorityReplaced(error: unknown): boolean { diff --git a/src/main/browser/browser-client-host-environment-routes.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-environment-routes.ts similarity index 87% rename from src/main/browser/browser-client-host-environment-routes.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-environment-routes.ts index 8c9f4838257..7721b968b93 100644 --- a/src/main/browser/browser-client-host-environment-routes.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-environment-routes.ts @@ -1,11 +1,11 @@ import { registerBrowserClientDownloadRouter, type BrowserClientDownloadRouter -} from './browser-client-download-routing' +} from '../file-transfers/browser-client-download-routing' import { BrowserClientPageMetadataTransport, registerBrowserClientPageMetadataTransport -} from './browser-client-page-metadata-transport' +} from '../../client-pages/renderer/browser-client-page-metadata-transport' export type BrowserClientHostEnvironmentRoutes = { pageMetadata: BrowserClientPageMetadataTransport diff --git a/src/main/browser/browser-client-host-id.test.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-id.test.ts similarity index 100% rename from src/main/browser/browser-client-host-id.test.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-id.test.ts diff --git a/src/main/browser/browser-client-host-id.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-id.ts similarity index 90% rename from src/main/browser/browser-client-host-id.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-id.ts index 6db4e4792bd..29d9a441a64 100644 --- a/src/main/browser/browser-client-host-id.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-id.ts @@ -1,5 +1,5 @@ import { randomUUID } from 'node:crypto' -import { readOrCreateBrowserHostClientId } from './browser-host-client-identity' +import { readOrCreateBrowserHostClientId } from '../leases/browser-host-client-identity' let browserHostClientId: string | null = null diff --git a/src/main/browser/browser-client-host-placement-preparation.test.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts similarity index 96% rename from src/main/browser/browser-client-host-placement-preparation.test.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts index 7b222565534..8d81529c098 100644 --- a/src/main/browser/browser-client-host-placement-preparation.test.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts @@ -6,10 +6,10 @@ import { BROWSER_NETWORK_EXECUTION_HOSTS_RUNTIME_CAPABILITY, BROWSER_NETWORK_TUNNEL_RUNTIME_CAPABILITY, BROWSER_SCREENCAST_RUNTIME_CAPABILITY -} from '../../shared/protocol-version' -import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments' -import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' -import type { RuntimeStatus } from '../../shared/runtime-types' +} from '../../../../shared/browser-runtime-capabilities' +import type { KnownRuntimeEnvironment } from '../../../../shared/runtime-environments' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' +import type { RuntimeStatus } from '../../../../shared/runtime-session-contracts' import { prepareBrowserClientHostPlacement } from './browser-client-host-placement-preparation' const REQUIRED_CAPABILITIES = [ diff --git a/src/main/browser/browser-client-host-placement-preparation.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.ts similarity index 85% rename from src/main/browser/browser-client-host-placement-preparation.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.ts index 60b78f761b8..efe0048cc80 100644 --- a/src/main/browser/browser-client-host-placement-preparation.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.ts @@ -1,12 +1,12 @@ -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' import type { BrowserClientHostPlacementPreference, BrowserPageCreationPlacement -} from '../../shared/browser-client-host-placement' -import { expectsBrowserClientHosting } from '../../shared/browser-client-hosting-eligibility' -import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments' -import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' -import type { RuntimeStatus } from '../../shared/runtime-types' +} from '../../../../shared/browser-client-host-placement' +import { expectsBrowserClientHosting } from '../../../../shared/browser-client-hosting-eligibility' +import type { KnownRuntimeEnvironment } from '../../../../shared/runtime-environments' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' +import type { RuntimeStatus } from '../../../../shared/runtime-session-contracts' const SERVER_PLACEMENT = Object.freeze({ kind: 'server' as const }) diff --git a/src/main/browser/browser-client-host-reconciliation-command-order.test.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts similarity index 97% rename from src/main/browser/browser-client-host-reconciliation-command-order.test.ts rename to src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts index a5927fc6a01..fc253fc3fd5 100644 --- a/src/main/browser/browser-client-host-reconciliation-command-order.test.ts +++ b/src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts @@ -1,10 +1,10 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { describe, expect, it, vi } from 'vitest' -import { BrowserHostCommandLedger } from '../runtime/browser-host/browser-host-command-ledger' -import { BrowserClientHostCommandDispatcher } from './browser-client-host-command-dispatcher' +import { BrowserHostCommandLedger } from '../../../runtime/browser-host/browser-host-command-ledger' +import { BrowserClientHostCommandDispatcher } from '../commands/browser-client-host-command-dispatcher' const authority: BrowserClientHostLeaseAuthority & { pageCommandProtocolVersion: 1 diff --git a/src/main/browser/paired-runtime-browser-client-host-composition.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts similarity index 99% rename from src/main/browser/paired-runtime-browser-client-host-composition.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts index 36c068805e2..539bc6107e3 100644 --- a/src/main/browser/paired-runtime-browser-client-host-composition.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts @@ -3,9 +3,9 @@ import type { BrowserClientHostedPageInventory, BrowserClientHostCommandEvent, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { BrowserClientHostAuthorityReplacementWait } from './browser-client-host-authority-replacement-wait' -import { BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE } from '../../shared/browser-client-host-protocol' +import { BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE } from '../../../../shared/browser-client-host-protocol' import { PairedRuntimeBrowserClientHostComposition } from './paired-runtime-browser-client-host-composition' const authority: BrowserClientHostLeaseAuthority = { diff --git a/src/main/browser/paired-runtime-browser-client-host-composition.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.ts similarity index 97% rename from src/main/browser/paired-runtime-browser-client-host-composition.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.ts index 1364f1ca09f..e2215c68851 100644 --- a/src/main/browser/paired-runtime-browser-client-host-composition.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.ts @@ -3,7 +3,7 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { isBrowserClientHostAuthorityReplaced } from './browser-client-host-authority-replacement' import { BrowserClientHostAuthorityReplacementWait } from './browser-client-host-authority-replacement-wait' import { @@ -11,8 +11,8 @@ import { closeBrowserClientHostComposition, fenceBrowserClientHostComposition } from './paired-runtime-browser-client-host-teardown' -import type { BrowserClientPageNetworkRoute } from './browser-client-page-cleanup' -import type { BrowserClientPageAuthorityIdentity as BrowserClientHostAuthorityTransitionInput } from './browser-client-page-command-executor-dependencies' +import type { BrowserClientPageNetworkRoute } from '../../client-pages/lifecycle/browser-client-page-cleanup' +import type { BrowserClientPageAuthorityIdentity as BrowserClientHostAuthorityTransitionInput } from '../../client-pages/execution/browser-client-page-command-executor-dependencies' import { type ComposedBrowserClientNetworkRoutes, PairedRuntimeBrowserClientHostRouteSets diff --git a/src/main/browser/paired-runtime-browser-client-host-identity-wiring.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-identity-wiring.test.ts similarity index 96% rename from src/main/browser/paired-runtime-browser-client-host-identity-wiring.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-identity-wiring.test.ts index 7999021fd66..655396dd4de 100644 --- a/src/main/browser/paired-runtime-browser-client-host-identity-wiring.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-identity-wiring.test.ts @@ -2,7 +2,7 @@ import { mkdtempSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments' +import type { KnownRuntimeEnvironment } from '../../../../shared/runtime-environments' vi.mock('electron', () => ({ app: { getPath: () => tmpdir() }, @@ -25,7 +25,7 @@ vi.mock('./paired-runtime-browser-client-host', () => ({ } })) -vi.mock('./browser-client-file-channel-transport', () => ({ +vi.mock('../file-transfers/browser-client-file-channel-transport', () => ({ BrowserClientFileChannelTransport: class { bind(): void {} } diff --git a/src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts similarity index 93% rename from src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts index dc652288d4a..2a6e67dec11 100644 --- a/src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts @@ -1,17 +1,17 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../shared/pairing' +import type { PairingOffer } from '../../../../shared/mobile-relay-pairing-offer' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) diff --git a/src/main/browser/paired-runtime-browser-client-host-registry.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts similarity index 98% rename from src/main/browser/paired-runtime-browser-client-host-registry.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts index 977eaaf8068..4d573c3a278 100644 --- a/src/main/browser/paired-runtime-browser-client-host-registry.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' import { PairedRuntimeBrowserClientHostRegistry } from './paired-runtime-browser-client-host-registry' const authority: BrowserClientHostLeaseAuthority = { diff --git a/src/main/browser/paired-runtime-browser-client-host-registry.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.ts similarity index 98% rename from src/main/browser/paired-runtime-browser-client-host-registry.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.ts index 1a566e1a0b2..c0337a9b52e 100644 --- a/src/main/browser/paired-runtime-browser-client-host-registry.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.ts @@ -1,4 +1,4 @@ -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' export type PairedRuntimeBrowserClientHostStart = { environmentId: string diff --git a/src/main/browser/paired-runtime-browser-client-host-route-identity.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts similarity index 97% rename from src/main/browser/paired-runtime-browser-client-host-route-identity.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts index 557d0bc6f6e..2545129ed9a 100644 --- a/src/main/browser/paired-runtime-browser-client-host-route-identity.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts @@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import type { KnownRuntimeEnvironment, OrcadDeploymentLink -} from '../../shared/runtime-environments' +} from '../../../../shared/runtime-environments' vi.mock('electron', () => ({ app: { getPath: () => tmpdir() }, @@ -45,9 +45,9 @@ vi.mock('./paired-runtime-browser-client-host-composition', () => ({ } })) -import { deriveBrowserRoutePartition } from './browser-route-identity' -import { BrowserRoutePartitionBindingStore } from './browser-route-partition-binding-store' -import { resolveBrowserRoutePartitionBinding } from './browser-route-partition-migration' +import { deriveBrowserRoutePartition } from '../../routing/partitions/browser-route-identity' +import { BrowserRoutePartitionBindingStore } from '../../routing/partitions/browser-route-partition-binding-store' +import { resolveBrowserRoutePartitionBinding } from '../../routing/partitions/browser-route-partition-migration' import { configurePairedRuntimeBrowserClientHostsForOrcaProfile, getPairedRuntimeBrowserClientRouteIdentity, diff --git a/src/main/browser/paired-runtime-browser-client-host-route-sets.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-sets.ts similarity index 94% rename from src/main/browser/paired-runtime-browser-client-host-route-sets.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-sets.ts index d16a4702ed7..0220735e6ca 100644 --- a/src/main/browser/paired-runtime-browser-client-host-route-sets.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-sets.ts @@ -1,6 +1,6 @@ -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import type { BrowserClientPageNetworkRoute } from './browser-client-page-cleanup' -import { sameBrowserClientHostLeaseAuthority } from './browser-client-host-command-authority' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import type { BrowserClientPageNetworkRoute } from '../../client-pages/lifecycle/browser-client-page-cleanup' +import { sameBrowserClientHostLeaseAuthority } from '../commands/browser-client-host-command-authority' export type ComposedBrowserClientNetworkRoutes = { retain(key: string, signal: AbortSignal): Promise diff --git a/src/main/browser/paired-runtime-browser-client-host-runtime.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts similarity index 92% rename from src/main/browser/paired-runtime-browser-client-host-runtime.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts index 057e4452345..5bd70eb7192 100644 --- a/src/main/browser/paired-runtime-browser-client-host-runtime.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments' +import type { KnownRuntimeEnvironment } from '../../../../shared/runtime-environments' vi.mock('electron', () => ({ ipcMain: { diff --git a/src/main/browser/paired-runtime-browser-client-host-runtime.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.ts similarity index 84% rename from src/main/browser/paired-runtime-browser-client-host-runtime.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.ts index 7ed3ccc1e11..dbda6b2a840 100644 --- a/src/main/browser/paired-runtime-browser-client-host-runtime.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime.ts @@ -1,51 +1,51 @@ -import { BROWSER_CLIENT_PROFILE_SWITCH_CAPABILITY } from '../../shared/browser-client-profile-switch-protocol' +import { BROWSER_CLIENT_PROFILE_SWITCH_CAPABILITY } from '../../../../shared/browser-client-profile-switch-protocol' import { createHash } from 'node:crypto' import path from 'node:path' import { app } from 'electron' import { BROWSER_CLIENT_AUTOMATION_HOST_CAPABILITY, BROWSER_CLIENT_EXPECT_URL_HOST_CAPABILITY -} from '../../shared/browser-client-automation-protocol' -import { BROWSER_CLIENT_FILE_CHANNEL_HOST_CAPABILITY } from '../../shared/browser-client-file-channel-protocol' -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection' +} from '../../../../shared/browser-client-automation-protocol' +import { BROWSER_CLIENT_FILE_CHANNEL_HOST_CAPABILITY } from '../../../../shared/browser-client-file-channel-protocol' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import type { PairedRuntimeConnection } from '../../../../shared/paired-runtime-connection' import { getPreferredPairedRuntimeConnection, type KnownRuntimeEnvironment -} from '../../shared/runtime-environments' -import { BrowserClientNetworkRouteRegistry } from './browser-client-network-route-registry' +} from '../../../../shared/runtime-environments' +import { BrowserClientNetworkRouteRegistry } from '../../network/client-routes/browser-client-network-route-registry' import { browserAuthorityExecutionHostStorageIdentity, legacyBrowserNativeExecutionHostStorageIdentity -} from './browser-execution-host-storage-identity' +} from '../../routing/identity/browser-execution-host-storage-identity' import { getBrowserClientHostId } from './browser-client-host-id' -import { deriveBrowserRoutePartitionStorageScope } from './browser-route-identity' -import { BrowserClientDownloadRelay } from './browser-client-download-relay' -import { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' +import { deriveBrowserRoutePartitionStorageScope } from '../../routing/partitions/browser-route-identity' +import { BrowserClientDownloadRelay } from '../file-transfers/browser-client-download-relay' +import { BrowserClientFileChannelTransport } from '../file-transfers/browser-client-file-channel-transport' import { registerBrowserClientHostEnvironmentRoutes } from './browser-client-host-environment-routes' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' -import { createBrowserClientPageGuestBinding } from './browser-client-page-guest-binding' -import { browserManager } from './browser-manager' -import { browserSessionRegistry } from './browser-session-registry' -import { BrowserClientUploadStaging } from './browser-client-upload-staging' +import { BrowserClientPageCommandExecutor } from '../../client-pages/execution/browser-client-page-command-executor' +import { createBrowserClientPageGuestBinding } from '../../client-pages/lifecycle/browser-client-page-guest-binding' +import { browserManager } from '../../browser-manager' +import { browserSessionRegistry } from '../../browser-session-registry' +import { BrowserClientUploadStaging } from '../file-transfers/browser-client-upload-staging' import { executeBrowserClientPageAutomation, retireBrowserClientPageAutomation -} from './browser-client-page-automation-runtime' -import { selectBrowserClientPageRenderer } from './browser-client-page-renderer-runtime' +} from '../../client-pages/execution/browser-client-page-automation-runtime' +import { selectBrowserClientPageRenderer } from '../../client-pages/renderer/browser-client-page-renderer-runtime' import { PairedRuntimeBrowserClientHostComposition } from './paired-runtime-browser-client-host-composition' import { PairedRuntimeBrowserClientHost } from './paired-runtime-browser-client-host' import { PairedRuntimeBrowserClientHostRegistry, type PairedRuntimeBrowserClientHostStart } from './paired-runtime-browser-client-host-registry' -import { PairedRuntimeBrowserNetworkRoute } from './paired-runtime-browser-network-route' -import { derivePairedRuntimeBrowserAuthorityIdentity } from './paired-runtime-browser-authority-identity' -import type { BrowserClientPageAuthorityIdentity } from './browser-client-page-command-executor-dependencies' +import { PairedRuntimeBrowserNetworkRoute } from '../../network/execution-routes/paired-runtime-browser-network-route' +import { derivePairedRuntimeBrowserAuthorityIdentity } from '../leases/paired-runtime-browser-authority-identity' +import type { BrowserClientPageAuthorityIdentity } from '../../client-pages/execution/browser-client-page-command-executor-dependencies' import { browserRouteSessionRegistry, browserRouteWebContentsRegistry -} from './browser-route-session-runtime' +} from '../../routing/sessions/browser-route-session-runtime' export type ClientHostRouteIdentity = BrowserClientPageAuthorityIdentity & { orcaProfileId: string diff --git a/src/main/browser/paired-runtime-browser-client-host-teardown.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-teardown.ts similarity index 100% rename from src/main/browser/paired-runtime-browser-client-host-teardown.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-teardown.ts diff --git a/src/main/browser/paired-runtime-browser-client-host.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts similarity index 96% rename from src/main/browser/paired-runtime-browser-client-host.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts index 6885d250d5e..bb4f0ee463b 100644 --- a/src/main/browser/paired-runtime-browser-client-host.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts @@ -1,26 +1,26 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' import type { BrowserClientHostedPageInventory, BrowserClientHostCommandEvent, BrowserClientHostCommandResult -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) import { PairedRuntimeBrowserClientHost } from './paired-runtime-browser-client-host' -import { PairedRuntimeBrowserHostLease } from './paired-runtime-browser-host-lease' +import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' const pairing = pairedRuntimeConnectionFromOffer({ endpoint: 'ws://127.0.0.1:6768', diff --git a/src/main/browser/paired-runtime-browser-client-host.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.ts similarity index 88% rename from src/main/browser/paired-runtime-browser-client-host.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.ts index dc60937a51c..269a4e9c734 100644 --- a/src/main/browser/paired-runtime-browser-client-host.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.ts @@ -3,14 +3,17 @@ import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, BrowserClientHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' -import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection' -import type { RemoteRuntimeSubscriptionOptions } from '../../shared/remote-runtime/requests/remote-runtime-subscription-contract' -import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' -import type { BrowserClientFileChannelAvailability } from './browser-client-file-channel-transport' -import { BrowserClientHostCommandDispatcher } from './browser-client-host-command-dispatcher' -import type { CommandHandler, DispatcherOptions } from './browser-client-host-command-state' -import { PairedRuntimeBrowserHostLease } from './paired-runtime-browser-host-lease' +} from '../../../../shared/browser-client-host-protocol' +import type { PairedRuntimeConnection } from '../../../../shared/paired-runtime-connection' +import type { RemoteRuntimeSubscriptionOptions } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' +import type { BrowserClientFileChannelAvailability } from '../file-transfers/browser-client-file-channel-transport' +import { BrowserClientHostCommandDispatcher } from '../commands/browser-client-host-command-dispatcher' +import type { + CommandHandler, + DispatcherOptions +} from '../commands/browser-client-host-command-state' +import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' type DispatcherLimits = Omit diff --git a/src/main/browser/paired-runtime-browser-host-command-admission.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-command-admission.test.ts similarity index 92% rename from src/main/browser/paired-runtime-browser-host-command-admission.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-command-admission.test.ts index 14e9db55743..67542daf30f 100644 --- a/src/main/browser/paired-runtime-browser-host-command-admission.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-command-admission.test.ts @@ -1,21 +1,21 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../shared/pairing' +import type { PairingOffer } from '../../../../shared/mobile-relay-pairing-offer' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' +} from '../../../../shared/remote-runtime/remote-runtime-client' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) -import { PairedRuntimeBrowserHostLease } from './paired-runtime-browser-host-lease' -import type { PairedRuntimeBrowserHostLeaseOptions } from './paired-runtime-browser-host-lease-options' +import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' +import type { PairedRuntimeBrowserHostLeaseOptions } from '../leases/paired-runtime-browser-host-lease-options' const pairing = { v: 2, diff --git a/src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts similarity index 92% rename from src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts rename to src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts index 48edc2c2511..b935093b784 100644 --- a/src/main/browser/paired-runtime-browser-host-reconciliation-negotiation.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts @@ -1,22 +1,22 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../shared/pairing' +import type { PairingOffer } from '../../../../shared/mobile-relay-pairing-offer' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) -import { PairedRuntimeBrowserHostLease } from './paired-runtime-browser-host-lease' -import type { PairedRuntimeBrowserHostLeaseOptions } from './paired-runtime-browser-host-lease-options' +import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' +import type { PairedRuntimeBrowserHostLeaseOptions } from '../leases/paired-runtime-browser-host-lease-options' const pairing = { v: 2, diff --git a/src/main/browser/browser-client-page-automation-runtime.test.ts b/src/main/browser/client-pages/execution/browser-client-page-automation-runtime.test.ts similarity index 100% rename from src/main/browser/browser-client-page-automation-runtime.test.ts rename to src/main/browser/client-pages/execution/browser-client-page-automation-runtime.test.ts diff --git a/src/main/browser/browser-client-page-automation-runtime.ts b/src/main/browser/client-pages/execution/browser-client-page-automation-runtime.ts similarity index 91% rename from src/main/browser/browser-client-page-automation-runtime.ts rename to src/main/browser/client-pages/execution/browser-client-page-automation-runtime.ts index cc354a780ec..1df2906242b 100644 --- a/src/main/browser/browser-client-page-automation-runtime.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-automation-runtime.ts @@ -1,8 +1,9 @@ -import type { BrowserClientAutomationMethod } from '../../shared/browser-client-automation-protocol' -import type { AgentBrowserBridge } from './agent-browser/agent-browser-bridge' -import type { BrowserGuestRegistration, BrowserManager } from './browser-manager' +import type { BrowserClientAutomationMethod } from '../../../../shared/browser-client-automation-protocol' +import type { AgentBrowserBridge } from '../../agent-browser/agent-browser-bridge' +import type { BrowserGuestRegistration } from '../../browser-manager-types' +import type { BrowserManager } from '../../browser-manager' import { BrowserClientPageCommandError } from './browser-client-page-command-failure' -import type { BrowserRoutePageGuestIdentity } from './browser-route-page-authority' +import type { BrowserRoutePageGuestIdentity } from '../../routing/guest-authority/browser-route-page-authority' type AutomationPageInput = { browserPageId: string diff --git a/src/main/browser/browser-client-page-command-admission.ts b/src/main/browser/client-pages/execution/browser-client-page-command-admission.ts similarity index 86% rename from src/main/browser/browser-client-page-command-admission.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-admission.ts index 66b32969be9..476df49fead 100644 --- a/src/main/browser/browser-client-page-command-admission.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-admission.ts @@ -1,8 +1,8 @@ -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' import type { BrowserClientPageRenderer, BrowserClientPageRendererIdentity -} from './browser-client-page-cleanup' +} from '../lifecycle/browser-client-page-cleanup' import { BrowserClientPageCommandError } from './browser-client-page-command-failure' export function browserClientPageIdentity( diff --git a/src/main/browser/browser-client-page-command-execution.ts b/src/main/browser/client-pages/execution/browser-client-page-command-execution.ts similarity index 77% rename from src/main/browser/browser-client-page-command-execution.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-execution.ts index 7cae348356e..249dd8502da 100644 --- a/src/main/browser/browser-client-page-command-execution.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-execution.ts @@ -1,21 +1,21 @@ -import type { BrowserClientAutomationMethod } from '../../shared/browser-client-automation-protocol' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import { requiresBrowserClientFileChannel } from '../../shared/browser-client-file-channel-methods' -import { normalizeBrowserNavigationUrl } from '../../shared/browser-url' -import { executeBrowserClientUploadCommand } from './browser-client-upload-command' -import type { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' -import type { BrowserClientUploadStaging } from './browser-client-upload-staging' +import type { BrowserClientAutomationMethod } from '../../../../shared/browser-client-automation-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import { requiresBrowserClientFileChannel } from '../../../../shared/browser-client-file-channel-methods' +import { normalizeBrowserNavigationUrl } from '../../../../shared/browser-url' +import { executeBrowserClientUploadCommand } from '../../client-hosts/file-transfers/browser-client-upload-command' +import type { BrowserClientFileChannelTransport } from '../../client-hosts/file-transfers/browser-client-file-channel-transport' +import type { BrowserClientUploadStaging } from '../../client-hosts/file-transfers/browser-client-upload-staging' import { assertBrowserClientPageCommandNotAborted, assertCurrentBrowserClientPageRenderer } from './browser-client-page-command-admission' import { BrowserClientPageCommandError } from './browser-client-page-command-failure' -import { sameBrowserClientPageAuthority } from './browser-client-host-command-authority' +import { sameBrowserClientPageAuthority } from '../../client-hosts/commands/browser-client-host-command-authority' import type { BrowserClientPageLifecycleRegistry, BrowserClientRetainedPage -} from './browser-client-page-retained-state' -import { updateBrowserClientPageInventoryCurrentUrl } from './browser-client-page-inventory' +} from '../lifecycle/browser-client-page-retained-state' +import { updateBrowserClientPageInventoryCurrentUrl } from '../lifecycle/browser-client-page-inventory' export async function navigateBrowserClientPageCommand( pages: Map, diff --git a/src/main/browser/browser-client-page-command-executor-dependencies.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor-dependencies.ts similarity index 77% rename from src/main/browser/browser-client-page-command-executor-dependencies.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-executor-dependencies.ts index 9b2c4e62ac7..13461a40e7a 100644 --- a/src/main/browser/browser-client-page-command-executor-dependencies.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-executor-dependencies.ts @@ -1,16 +1,16 @@ -import type { BrowserClientAutomationMethod } from '../../shared/browser-client-automation-protocol' -import type { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' -import type { BrowserClientPageGuestBinding } from './browser-client-page-guest-binding' -import type { BrowserClientUploadStaging } from './browser-client-upload-staging' +import type { BrowserClientAutomationMethod } from '../../../../shared/browser-client-automation-protocol' +import type { BrowserClientFileChannelTransport } from '../../client-hosts/file-transfers/browser-client-file-channel-transport' +import type { BrowserClientPageGuestBinding } from '../lifecycle/browser-client-page-guest-binding' +import type { BrowserClientUploadStaging } from '../../client-hosts/file-transfers/browser-client-upload-staging' import type { BrowserClientPageNetworkRoute, BrowserClientPageRenderer -} from './browser-client-page-cleanup' -import type { BrowserRouteSessionRegistry } from './browser-route-session-registry' +} from '../lifecycle/browser-client-page-cleanup' +import type { BrowserRouteSessionRegistry } from '../../routing/sessions/browser-route-session-registry' import type { BrowserClientPageLifecycleRegistry, BrowserClientRetainedPage -} from './browser-client-page-retained-state' +} from '../lifecycle/browser-client-page-retained-state' /** Superseded connection identities let upgrades adopt populated partitions. */ export type BrowserClientPageAuthorityIdentity = { diff --git a/src/main/browser/browser-client-page-command-executor-fencing.test.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts similarity index 100% rename from src/main/browser/browser-client-page-command-executor-fencing.test.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts diff --git a/src/main/browser/browser-client-page-command-executor-test-harness.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor-test-harness.ts similarity index 93% rename from src/main/browser/browser-client-page-command-executor-test-harness.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-executor-test-harness.ts index 2854a14a64f..8175de8fc10 100644 --- a/src/main/browser/browser-client-page-command-executor-test-harness.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-executor-test-harness.ts @@ -1,11 +1,11 @@ -import type { BrowserRoutePreparePageInput } from './browser-route-session-state' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +import type { BrowserRoutePreparePageInput } from '../../routing/sessions/browser-route-session-state' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' import { vi } from 'vitest' import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' import type { BrowserRouteGuestLifecycleClaim, BrowserRoutePageGuestIdentity -} from './browser-route-page-authority' +} from '../../routing/guest-authority/browser-route-page-authority' export const partition = `persist:orca-browser-v1-${'a'.repeat(64)}` diff --git a/src/main/browser/browser-client-page-command-executor.test.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts similarity index 100% rename from src/main/browser/browser-client-page-command-executor.test.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts diff --git a/src/main/browser/browser-client-page-command-executor.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor.ts similarity index 92% rename from src/main/browser/browser-client-page-command-executor.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-executor.ts index 14155cf1b62..2cb7a5a9aec 100644 --- a/src/main/browser/browser-client-page-command-executor.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-executor.ts @@ -2,42 +2,42 @@ import { closeBrowserClientExecutorPages } from './browser-client-page-executor- import { BrowserClientProfileSwitches, switchBrowserClientPageProfile -} from './browser-client-page-profile-switch' +} from '../lifecycle/browser-client-page-profile-switch' import { BROWSER_CLIENT_HOST_PAGE_INVENTORY_MAX_PAGES, type BrowserClientHostedPageInventory, type BrowserClientHostCommandEvent, type BrowserClientHostCommandResult -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { cleanupRetainedBrowserClientPage, type BrowserClientPageRendererIdentity -} from './browser-client-page-cleanup' -import { assertBrowserClientPageAdmission } from './browser-client-page-admission' -import { createReservedBrowserClientPage } from './browser-client-page-creation' -import { retireSupersededExecutionHostPages } from './browser-client-page-execution-host-supersession' +} from '../lifecycle/browser-client-page-cleanup' +import { assertBrowserClientPageAdmission } from '../lifecycle/browser-client-page-admission' +import { createReservedBrowserClientPage } from '../lifecycle/browser-client-page-creation' +import { retireSupersededExecutionHostPages } from '../lifecycle/browser-client-page-execution-host-supersession' import { browserClientPageCommandFailure, BrowserClientPageCommandError, isBrowserClientPageCleanupFailure } from './browser-client-page-command-failure' -import { BrowserClientPageNavigationFence } from './browser-client-page-navigation-fence' -import { executeBrowserClientPageReconciliationCommand } from './browser-client-page-reconciliation' +import { BrowserClientPageNavigationFence } from '../lifecycle/browser-client-page-navigation-fence' +import { executeBrowserClientPageReconciliationCommand } from '../lifecycle/browser-client-page-reconciliation' import { findBrowserClientPageByWebContentsId, retireBrowserClientRetainedPage, type BrowserClientRetainedPage -} from './browser-client-page-retained-state' +} from '../lifecycle/browser-client-page-retained-state' import { createBrowserClientPageInventory, recordBrowserClientPagePublishedUrl, snapshotBrowserClientPageInventoryList -} from './browser-client-page-inventory' +} from '../lifecycle/browser-client-page-inventory' import { executeBrowserClientPageAutomationCommand, navigateBrowserClientPageCommand } from './browser-client-page-command-execution' -import { publishBrowserClientRetainedPage } from './browser-client-page-availability' +import { publishBrowserClientRetainedPage } from '../lifecycle/browser-client-page-availability' import { pageAuthorityIdentity, type BrowserClientPageAuthorityIdentity, diff --git a/src/main/browser/browser-client-page-command-failure.ts b/src/main/browser/client-pages/execution/browser-client-page-command-failure.ts similarity index 86% rename from src/main/browser/browser-client-page-command-failure.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-failure.ts index b9c9a1db742..a77ebbee985 100644 --- a/src/main/browser/browser-client-page-command-failure.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-failure.ts @@ -1,5 +1,5 @@ -import type { BrowserClientHostCommandResult } from '../../shared/browser-client-host-protocol' -import type { BrowserExpectedUrlMismatch } from '../../shared/browser-expected-url' +import type { BrowserClientHostCommandResult } from '../../../../shared/browser-client-host-protocol' +import type { BrowserExpectedUrlMismatch } from '../../../../shared/browser-expected-url' export class BrowserClientPageCommandError extends Error { readonly expectedUrlMismatch?: BrowserExpectedUrlMismatch diff --git a/src/main/browser/browser-client-page-command-integration.test.ts b/src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts similarity index 93% rename from src/main/browser/browser-client-page-command-integration.test.ts rename to src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts index 6e5a4997234..416130af3d7 100644 --- a/src/main/browser/browser-client-page-command-integration.test.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts @@ -1,11 +1,11 @@ import type { Session, WebContents } from 'electron' import { describe, expect, it, vi } from 'vitest' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import { BrowserClientHostCommandDispatcher } from './browser-client-host-command-dispatcher' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import { BrowserClientHostCommandDispatcher } from '../../client-hosts/commands/browser-client-host-command-dispatcher' import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' -import { createBrowserRoutePartitionBindingStoreFake } from './browser-route-partition-binding-store-fake' -import { BrowserRouteSessionRegistry } from './browser-route-session-registry' -import { BrowserRouteWebContentsRegistry } from './browser-route-webcontents-registry' +import { createBrowserRoutePartitionBindingStoreFake } from '../../routing/partitions/browser-route-partition-binding-store-fake' +import { BrowserRouteSessionRegistry } from '../../routing/sessions/browser-route-session-registry' +import { BrowserRouteWebContentsRegistry } from '../../routing/guest-authority/browser-route-webcontents-registry' const partition = `persist:orca-browser-v1-${'b'.repeat(64)}` diff --git a/src/main/browser/browser-client-page-executor-close.ts b/src/main/browser/client-pages/execution/browser-client-page-executor-close.ts similarity index 77% rename from src/main/browser/browser-client-page-executor-close.ts rename to src/main/browser/client-pages/execution/browser-client-page-executor-close.ts index 9176ecf846b..c36a32b9767 100644 --- a/src/main/browser/browser-client-page-executor-close.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-executor-close.ts @@ -1,7 +1,7 @@ -import type { BrowserClientRetainedPage } from './browser-client-page-retained-state' -import type { BrowserClientUploadStaging } from './browser-client-upload-staging' -import { forgetBrowserClientRetainedPage } from './browser-client-page-retained-state' -import type { BrowserClientProfileSwitches } from './browser-client-page-profile-switch' +import type { BrowserClientRetainedPage } from '../lifecycle/browser-client-page-retained-state' +import type { BrowserClientUploadStaging } from '../../client-hosts/file-transfers/browser-client-upload-staging' +import { forgetBrowserClientRetainedPage } from '../lifecycle/browser-client-page-retained-state' +import type { BrowserClientProfileSwitches } from '../lifecycle/browser-client-page-profile-switch' export async function closeBrowserClientExecutorPages(input: { profileSwitches: Pick diff --git a/src/main/browser/browser-client-page-admission.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-admission.ts similarity index 84% rename from src/main/browser/browser-client-page-admission.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-admission.ts index ba0b28d966c..bb3a48fc796 100644 --- a/src/main/browser/browser-client-page-admission.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-admission.ts @@ -1,4 +1,4 @@ -import { BrowserClientPageCommandError } from './browser-client-page-command-failure' +import { BrowserClientPageCommandError } from '../execution/browser-client-page-command-failure' export function assertBrowserClientPageAdmission( trackedPages: readonly ReadonlyMap[], diff --git a/src/main/browser/browser-client-page-availability.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-availability.ts similarity index 90% rename from src/main/browser/browser-client-page-availability.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-availability.ts index f6f8140bdde..983d24855ed 100644 --- a/src/main/browser/browser-client-page-availability.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-availability.ts @@ -1,5 +1,5 @@ -import type { BrowserClientPageCommandExecutorDependencies } from './browser-client-page-command-executor-dependencies' -import type { BrowserRoutePageGuestIdentity } from './browser-route-page-authority' +import type { BrowserClientPageCommandExecutorDependencies } from '../execution/browser-client-page-command-executor-dependencies' +import type { BrowserRoutePageGuestIdentity } from '../../routing/guest-authority/browser-route-page-authority' import type { BrowserClientRetainedPage } from './browser-client-page-retained-state' export function markBrowserClientPageUnavailable( diff --git a/src/main/browser/browser-client-page-cleanup.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-cleanup.ts similarity index 90% rename from src/main/browser/browser-client-page-cleanup.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-cleanup.ts index 81caa84ebd8..4d7f211c930 100644 --- a/src/main/browser/browser-client-page-cleanup.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-cleanup.ts @@ -1,8 +1,8 @@ -import type { BrowserRouteGuestLifecycleClaim } from './browser-route-page-authority' -import type { BrowserRouteSessionHandle } from './browser-route-session-state' -import type { BrowserRouteProxyEndpoint } from './browser-route-session-policy' -import type { BrowserRouteWebContentsRegistry } from './browser-route-webcontents-registry' -import { browserClientPageIdentity } from './browser-client-page-command-admission' +import type { BrowserRouteGuestLifecycleClaim } from '../../routing/guest-authority/browser-route-page-authority' +import type { BrowserRouteSessionHandle } from '../../routing/sessions/browser-route-session-state' +import type { BrowserRouteProxyEndpoint } from '../../routing/sessions/browser-route-session-policy' +import type { BrowserRouteWebContentsRegistry } from '../../routing/guest-authority/browser-route-webcontents-registry' +import { browserClientPageIdentity } from '../execution/browser-client-page-command-admission' import type { BrowserClientRetainedPage } from './browser-client-page-retained-state' export type BrowserClientPageNetworkRoute = { diff --git a/src/main/browser/browser-client-page-creation-cancellation.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-creation-cancellation.test.ts similarity index 95% rename from src/main/browser/browser-client-page-creation-cancellation.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-creation-cancellation.test.ts index 82487d35612..ae5d0469986 100644 --- a/src/main/browser/browser-client-page-creation-cancellation.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-creation-cancellation.test.ts @@ -4,12 +4,12 @@ import { createCommand, createHarness, createLifecycleClaim -} from './browser-client-page-command-executor-test-harness' +} from '../execution/browser-client-page-command-executor-test-harness' import { completeRendererMount, createRendererBridgeTestRig, sentRendererRequest -} from './browser-client-page-renderer-bridge-test-rig' +} from '../renderer/browser-client-page-renderer-bridge-test-rig' it('claims a canceled mount reply and withholds release until exact native destruction', async () => { const { dependencies, order, route, routeSession } = createHarness() diff --git a/src/main/browser/browser-client-page-creation.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-creation.ts similarity index 90% rename from src/main/browser/browser-client-page-creation.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-creation.ts index 14304179230..19a1467df37 100644 --- a/src/main/browser/browser-client-page-creation.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-creation.ts @@ -1,4 +1,4 @@ -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' import { cleanupBrowserClientPage, type BrowserClientPageNetworkRoute as RetainedNetworkRoute, @@ -8,9 +8,9 @@ import { assertBrowserClientPageCommandNotAborted, assertCurrentBrowserClientPageRenderer, browserClientPageIdentity -} from './browser-client-page-command-admission' -import type { BrowserClientPageAuthorityIdentity } from './browser-client-page-command-executor-dependencies' -import { BrowserClientPageCommandError } from './browser-client-page-command-failure' +} from '../execution/browser-client-page-command-admission' +import type { BrowserClientPageAuthorityIdentity } from '../execution/browser-client-page-command-executor-dependencies' +import { BrowserClientPageCommandError } from '../execution/browser-client-page-command-failure' import type { BrowserClientPageGuestBinding } from './browser-client-page-guest-binding' import { createBrowserClientPageInventory } from './browser-client-page-inventory' import type { @@ -20,9 +20,9 @@ import type { import type { BrowserRouteGuestLifecycleClaim, BrowserRoutePageGuestIdentity -} from './browser-route-page-authority' -import type { BrowserRouteSessionRegistry } from './browser-route-session-registry' -import type { BrowserRouteSessionHandle } from './browser-route-session-state' +} from '../../routing/guest-authority/browser-route-page-authority' +import type { BrowserRouteSessionRegistry } from '../../routing/sessions/browser-route-session-registry' +import type { BrowserRouteSessionHandle } from '../../routing/sessions/browser-route-session-state' type BrowserClientPageCreationDependencies = BrowserClientPageAuthorityIdentity & { orcaProfileId: string diff --git a/src/main/browser/browser-client-page-execution-host-supersession.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-execution-host-supersession.test.ts similarity index 89% rename from src/main/browser/browser-client-page-execution-host-supersession.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-execution-host-supersession.test.ts index 65b66aedf80..e222ce735c6 100644 --- a/src/main/browser/browser-client-page-execution-host-supersession.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-execution-host-supersession.test.ts @@ -1,16 +1,14 @@ import { describe, expect, it, vi } from 'vitest' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import { BrowserClientPageCommandExecutor } from '../execution/browser-client-page-command-executor' import { createCommand, createLifecycleClaim -} from './browser-client-page-command-executor-test-harness' -import { createBrowserRoutePartitionBindingStoreFake } from './browser-route-partition-binding-store-fake' -import { - BrowserRouteSessionRegistry, - type BrowserRouteElectronSession -} from './browser-route-session-registry' -import type { BrowserRoutePageGuestIdentity } from './browser-route-page-authority' +} from '../execution/browser-client-page-command-executor-test-harness' +import { createBrowserRoutePartitionBindingStoreFake } from '../../routing/partitions/browser-route-partition-binding-store-fake' +import { BrowserRouteSessionRegistry } from '../../routing/sessions/browser-route-session-registry' +import type { BrowserRouteElectronSession } from '../../routing/sessions/browser-route-session-policy' +import type { BrowserRoutePageGuestIdentity } from '../../routing/guest-authority/browser-route-page-authority' const SSH_HOST_STORAGE = 'storage-ssh-target-a' const OTHER_HOST_STORAGE = 'storage-ssh-target-b' diff --git a/src/main/browser/browser-client-page-execution-host-supersession.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-execution-host-supersession.ts similarity index 100% rename from src/main/browser/browser-client-page-execution-host-supersession.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-execution-host-supersession.ts diff --git a/src/main/browser/browser-client-page-guest-binding.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-guest-binding.ts similarity index 93% rename from src/main/browser/browser-client-page-guest-binding.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-guest-binding.ts index ee3c4e46f95..4e25bc771e7 100644 --- a/src/main/browser/browser-client-page-guest-binding.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-guest-binding.ts @@ -1,5 +1,5 @@ -import type { BrowserManager } from './browser-manager' -import type { BrowserRoutePageGuestIdentity } from './browser-route-page-authority' +import type { BrowserManager } from '../../browser-manager' +import type { BrowserRoutePageGuestIdentity } from '../../routing/guest-authority/browser-route-page-authority' export type BrowserClientPageGuestBindingInput = { registration: BrowserRoutePageGuestIdentity diff --git a/src/main/browser/browser-client-page-inventory.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts similarity index 95% rename from src/main/browser/browser-client-page-inventory.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts index 0df2d73b5da..3fb8f4532f6 100644 --- a/src/main/browser/browser-client-page-inventory.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest' -import type { BrowserClientHostedPageInventory } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostedPageInventory } from '../../../../shared/browser-client-host-protocol' import { prepareBrowserClientPageInventoryForAttach } from './browser-client-page-inventory' describe('browser client page inventory', () => { diff --git a/src/main/browser/browser-client-page-inventory.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-inventory.ts similarity index 94% rename from src/main/browser/browser-client-page-inventory.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-inventory.ts index 3b0a69a0e2f..93a52b3b5da 100644 --- a/src/main/browser/browser-client-page-inventory.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-inventory.ts @@ -6,11 +6,11 @@ import { browserClientHostedPageInventoryByteLength, type BrowserClientHostedPageInventory, type BrowserClientHostCommandEvent -} from '../../shared/browser-client-host-protocol' -import { BrowserClientPageMetadataParams } from '../../shared/browser-client-page-metadata-protocol' +} from '../../../../shared/browser-client-host-protocol' +import { BrowserClientPageMetadataParams } from '../../../../shared/browser-client-page-metadata-protocol' import type { BrowserClientPageRenderer } from './browser-client-page-cleanup' -import { BrowserClientPageCommandError } from './browser-client-page-command-failure' -import type { BrowserRouteGuestLifecycleClaim } from './browser-route-page-authority' +import { BrowserClientPageCommandError } from '../execution/browser-client-page-command-failure' +import type { BrowserRouteGuestLifecycleClaim } from '../../routing/guest-authority/browser-route-page-authority' export function createBrowserClientPageInventory( event: BrowserClientHostCommandEvent, diff --git a/src/main/browser/browser-client-page-navigation-fence.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-navigation-fence.ts similarity index 89% rename from src/main/browser/browser-client-page-navigation-fence.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-navigation-fence.ts index 2524f20961c..38f2ca3aa08 100644 --- a/src/main/browser/browser-client-page-navigation-fence.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-navigation-fence.ts @@ -1,5 +1,5 @@ -import type { BrowserRouteGuestLifecycleClaim } from './browser-route-page-authority' -import { BrowserClientPageCommandError } from './browser-client-page-command-failure' +import type { BrowserRouteGuestLifecycleClaim } from '../../routing/guest-authority/browser-route-page-authority' +import { BrowserClientPageCommandError } from '../execution/browser-client-page-command-failure' type BrowserClientPageNavigationClaim = { lifecycleClaim: BrowserRouteGuestLifecycleClaim } diff --git a/src/main/browser/browser-client-page-profile-binding.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-binding.test.ts similarity index 93% rename from src/main/browser/browser-client-page-profile-binding.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-profile-binding.test.ts index fc0c1ff140d..77ea16f4db2 100644 --- a/src/main/browser/browser-client-page-profile-binding.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-binding.test.ts @@ -25,13 +25,16 @@ vi.mock('electron', () => ({ webContents: { fromId: browserMocks.webContentsFromIdMock } })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('../../guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: browserMocks.openPopupWithOriginBarMock })) -import { browserManager } from './browser-manager' +import { browserManager } from '../../browser-manager' import { createBrowserClientPageGuestBinding } from './browser-client-page-guest-binding' -import { resetBrowserManagerMocks, resetBrowserManagerState } from './browser-manager-test-harness' +import { + resetBrowserManagerMocks, + resetBrowserManagerState +} from '../../browser-manager-test-harness' const registration = (webContentsId: number, pageHostGeneration: number) => ({ partition: 'persist:route', diff --git a/src/main/browser/browser-client-page-profile-switch.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts similarity index 97% rename from src/main/browser/browser-client-page-profile-switch.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts index 0351a94ec44..9cf2a27a8af 100644 --- a/src/main/browser/browser-client-page-profile-switch.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts @@ -1,11 +1,11 @@ -import { BrowserRoutePageAvailability } from './browser-route-page-availability' +import { BrowserRoutePageAvailability } from '../../routing/guest-authority/browser-route-page-availability' import { describe, expect, it, vi } from 'vitest' import { createCommand, createHarness, createLifecycleClaim -} from './browser-client-page-command-executor-test-harness' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +} from '../execution/browser-client-page-command-executor-test-harness' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' const switchCommand = (): BrowserClientHostCommandEvent => createCommand('navigate', { diff --git a/src/main/browser/browser-client-page-profile-switch.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.ts similarity index 93% rename from src/main/browser/browser-client-page-profile-switch.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.ts index a015122d168..1cf0169f126 100644 --- a/src/main/browser/browser-client-page-profile-switch.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.ts @@ -1,15 +1,15 @@ -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import { BrowserClientProfileMetadata } from '../../shared/browser-client-profile-switch-protocol' -import { sameBrowserClientPageAuthority } from './browser-client-host-command-authority' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import { BrowserClientProfileMetadata } from '../../../../shared/browser-client-profile-switch-protocol' +import { sameBrowserClientPageAuthority } from '../../client-hosts/commands/browser-client-host-command-authority' import { assertBrowserClientPageCommandNotAborted, assertCurrentBrowserClientPageRenderer -} from './browser-client-page-command-admission' +} from '../execution/browser-client-page-command-admission' import { BrowserClientPageCommandError, isBrowserClientPageCleanupFailure -} from './browser-client-page-command-failure' -import type { BrowserClientPageCommandExecutorDependencies } from './browser-client-page-command-executor-dependencies' +} from '../execution/browser-client-page-command-failure' +import type { BrowserClientPageCommandExecutorDependencies } from '../execution/browser-client-page-command-executor-dependencies' import { createReservedBrowserClientPage } from './browser-client-page-creation' import type { BrowserClientRetainedPage } from './browser-client-page-retained-state' import { updateBrowserClientPageInventoryCurrentUrl } from './browser-client-page-inventory' diff --git a/src/main/browser/browser-client-page-reconciliation-adapters.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts similarity index 97% rename from src/main/browser/browser-client-page-reconciliation-adapters.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts index 8f73aebcd04..07a11b83f1a 100644 --- a/src/main/browser/browser-client-page-reconciliation-adapters.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts @@ -1,10 +1,10 @@ -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' import { describe, expect, it, vi } from 'vitest' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' +import { BrowserClientPageCommandExecutor } from '../execution/browser-client-page-command-executor' import type { BrowserRouteGuestLifecycleClaim, BrowserRoutePageGuestIdentity -} from './browser-route-page-authority' +} from '../../routing/guest-authority/browser-route-page-authority' const partition = `persist:orca-browser-v1-${'a'.repeat(64)}` diff --git a/src/main/browser/browser-client-page-reconciliation.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation.ts similarity index 96% rename from src/main/browser/browser-client-page-reconciliation.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation.ts index 1fd253099fb..a48638ec5d3 100644 --- a/src/main/browser/browser-client-page-reconciliation.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation.ts @@ -1,14 +1,14 @@ import type { BrowserClientHostedPageInventory, BrowserClientHostCommandEvent -} from '../../shared/browser-client-host-protocol' +} from '../../../../shared/browser-client-host-protocol' import { assertBrowserClientPageCommandNotAborted, assertCurrentBrowserClientPageRenderer, browserClientPageIdentity -} from './browser-client-page-command-admission' -import { sameBrowserClientPageAuthority } from './browser-client-host-command-authority' -import { BrowserClientPageCommandError } from './browser-client-page-command-failure' +} from '../execution/browser-client-page-command-admission' +import { sameBrowserClientPageAuthority } from '../../client-hosts/commands/browser-client-host-command-authority' +import { BrowserClientPageCommandError } from '../execution/browser-client-page-command-failure' import { createBrowserClientPageInventory, updateBrowserClientPageInventoryCurrentUrl diff --git a/src/main/browser/browser-client-page-retained-state.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-retained-state.ts similarity index 85% rename from src/main/browser/browser-client-page-retained-state.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-retained-state.ts index 366040caf80..9ff7f1944ce 100644 --- a/src/main/browser/browser-client-page-retained-state.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-retained-state.ts @@ -1,4 +1,4 @@ -import type { BrowserClientHostedPageInventory } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostedPageInventory } from '../../../../shared/browser-client-host-protocol' import type { BrowserClientPageNetworkRoute, BrowserClientPageRenderer @@ -6,9 +6,9 @@ import type { import type { BrowserRouteGuestLifecycleClaim, BrowserRoutePageGuestIdentity -} from './browser-route-page-authority' -import type { BrowserRouteSessionHandle } from './browser-route-session-state' -import type { BrowserRouteWebContentsRegistry } from './browser-route-webcontents-registry' +} from '../../routing/guest-authority/browser-route-page-authority' +import type { BrowserRouteSessionHandle } from '../../routing/sessions/browser-route-session-state' +import type { BrowserRouteWebContentsRegistry } from '../../routing/guest-authority/browser-route-webcontents-registry' export type BrowserClientPageLifecycleRegistry = Pick< BrowserRouteWebContentsRegistry, diff --git a/src/main/browser/browser-client-page-unavailability.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts similarity index 93% rename from src/main/browser/browser-client-page-unavailability.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts index a3b156008a5..541b69c0bfb 100644 --- a/src/main/browser/browser-client-page-unavailability.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from 'vitest' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import type { BrowserRoutePageGuestIdentity } from './browser-route-page-authority' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import type { BrowserRoutePageGuestIdentity } from '../../routing/guest-authority/browser-route-page-authority' +import { BrowserClientPageCommandExecutor } from '../execution/browser-client-page-command-executor' const partition = `persist:orca-browser-v1-${'a'.repeat(64)}` const registration = { diff --git a/src/main/browser/browser-client-page-upload-routing.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-upload-routing.test.ts similarity index 94% rename from src/main/browser/browser-client-page-upload-routing.test.ts rename to src/main/browser/client-pages/lifecycle/browser-client-page-upload-routing.test.ts index 4c7550e2846..039631a2558 100644 --- a/src/main/browser/browser-client-page-upload-routing.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-upload-routing.test.ts @@ -3,11 +3,11 @@ import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { BrowserClientHostCommandEvent } from '../../shared/browser-client-host-protocol' -import { BrowserClientFileChannelTransport } from './browser-client-file-channel-transport' -import { BrowserClientPageCommandExecutor } from './browser-client-page-command-executor' -import { BrowserClientUploadStaging } from './browser-client-upload-staging' -import type { BrowserRoutePageGuestIdentity } from './browser-route-page-authority' +import type { BrowserClientHostCommandEvent } from '../../../../shared/browser-client-host-protocol' +import { BrowserClientFileChannelTransport } from '../../client-hosts/file-transfers/browser-client-file-channel-transport' +import { BrowserClientPageCommandExecutor } from '../execution/browser-client-page-command-executor' +import { BrowserClientUploadStaging } from '../../client-hosts/file-transfers/browser-client-upload-staging' +import type { BrowserRoutePageGuestIdentity } from '../../routing/guest-authority/browser-route-page-authority' const partition = `persist:orca-browser-v1-${'a'.repeat(64)}` let stagingRoot = '' diff --git a/src/main/browser/browser-client-page-metadata-transport.test.ts b/src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.test.ts similarity index 96% rename from src/main/browser/browser-client-page-metadata-transport.test.ts rename to src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.test.ts index 7197f908c73..07acdc4e690 100644 --- a/src/main/browser/browser-client-page-metadata-transport.test.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.test.ts @@ -1,6 +1,6 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' -import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' import { BrowserClientPageMetadataTransport, publishBrowserClientPageMetadata, diff --git a/src/main/browser/browser-client-page-metadata-transport.ts b/src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.ts similarity index 90% rename from src/main/browser/browser-client-page-metadata-transport.ts rename to src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.ts index eef1cfb2d82..0097698de34 100644 --- a/src/main/browser/browser-client-page-metadata-transport.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-metadata-transport.ts @@ -1,6 +1,6 @@ -import { BrowserClientPageMetadataAck } from '../../shared/browser-client-page-metadata-protocol' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' -import type { RuntimeRpcResponse } from '../../shared/runtime-rpc-envelope' +import { BrowserClientPageMetadataAck } from '../../../../shared/browser-client-page-metadata-protocol' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' +import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' export type BrowserClientPageMetadataSender = { sendPageMetadataRequest(params: unknown, timeoutMs: number): Promise> diff --git a/src/main/browser/browser-client-page-renderer-bridge-test-rig.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge-test-rig.ts similarity index 88% rename from src/main/browser/browser-client-page-renderer-bridge-test-rig.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge-test-rig.ts index 4a879ab6cd4..a8e17c712e8 100644 --- a/src/main/browser/browser-client-page-renderer-bridge-test-rig.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge-test-rig.ts @@ -2,12 +2,12 @@ import { vi } from 'vitest' import type { BrowserClientPageRendererReply, BrowserClientPageRendererRequest -} from '../../shared/browser-client-page-renderer-protocol' -import { - BrowserClientPageRendererBridgeRegistry, - type BrowserClientPageRendererEndpoint, - type BrowserClientPageRendererReplyEvent -} from './browser-client-page-renderer-bridge' +} from '../../../../shared/browser-client-page-renderer-protocol' +import { BrowserClientPageRendererBridgeRegistry } from './browser-client-page-renderer-bridge' +import type { + BrowserClientPageRendererEndpoint, + BrowserClientPageRendererReplyEvent +} from './browser-client-page-renderer-reply-admission' export const rendererPage = { partition: 'persist:orca-browser-route:v1:partition-a', diff --git a/src/main/browser/browser-client-page-renderer-bridge.test.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts similarity index 99% rename from src/main/browser/browser-client-page-renderer-bridge.test.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts index 211c337141f..3e7e4b80765 100644 --- a/src/main/browser/browser-client-page-renderer-bridge.test.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest' -import type { BrowserClientPageRendererReply } from '../../shared/browser-client-page-renderer-protocol' +import type { BrowserClientPageRendererReply } from '../../../../shared/browser-client-page-renderer-protocol' import { completeRendererMount as completeMount, createRendererBridgeTestRig as createHarness, diff --git a/src/main/browser/browser-client-page-renderer-bridge.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.ts similarity index 97% rename from src/main/browser/browser-client-page-renderer-bridge.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.ts index 663bc6347b1..4e4b4d1eb4f 100644 --- a/src/main/browser/browser-client-page-renderer-bridge.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.ts @@ -7,8 +7,8 @@ import { type BrowserClientPageRendererIdentity as RendererPageIdentity, type BrowserClientPageRendererReply as RendererReply, type BrowserClientPageRendererRequest as RendererRequest -} from '../../shared/browser-client-page-renderer-protocol' -import type { BrowserClientPageRenderer } from './browser-client-page-cleanup' +} from '../../../../shared/browser-client-page-renderer-protocol' +import type { BrowserClientPageRenderer } from '../lifecycle/browser-client-page-cleanup' import { readCurrentRendererFrame, readRendererReplyRequestId, @@ -18,11 +18,6 @@ import { type BrowserClientPageRendererReplyEvent } from './browser-client-page-renderer-reply-admission' -export type { - BrowserClientPageRendererEndpoint, - BrowserClientPageRendererReplyEvent -} from './browser-client-page-renderer-reply-admission' - const DEFAULT_MAX_PENDING_REQUESTS = 512 const DEFAULT_REQUEST_TIMEOUT_MS = 15_000 diff --git a/src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts similarity index 97% rename from src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts index fbace14ab71..a9a41fc95e9 100644 --- a/src/main/browser/browser-client-page-renderer-lifecycle.electron.test.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts @@ -5,7 +5,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterAll, describe, expect, it } from 'vitest' import { build as buildVite } from 'vite' -import { resolveElectronProbeLaunch } from './electron-probe-display-launch' +import { resolveElectronProbeLaunch } from '../../electron-probe-display-launch' const electronBinary = createRequire(import.meta.url)('electron') as string const fixtureRoots: string[] = [] @@ -242,7 +242,10 @@ async function runFixture(): Promise { writeFileSync(htmlPath, '') await Promise.all([ buildFixtureBundle({ - entry: join(process.cwd(), 'src/main/browser/browser-client-page-renderer-bridge.ts'), + entry: join( + process.cwd(), + 'src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.ts' + ), fileName: 'bridge.cjs', format: 'cjs', root, diff --git a/src/main/browser/browser-client-page-renderer-reply-admission.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-reply-admission.ts similarity index 96% rename from src/main/browser/browser-client-page-renderer-reply-admission.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-reply-admission.ts index 1663e1cc098..db8134b5e02 100644 --- a/src/main/browser/browser-client-page-renderer-reply-admission.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-reply-admission.ts @@ -1,7 +1,7 @@ import type { BrowserClientPageRendererReply as RendererReply, BrowserClientPageRendererRequest as RendererRequest -} from '../../shared/browser-client-page-renderer-protocol' +} from '../../../../shared/browser-client-page-renderer-protocol' export type BrowserClientPageRendererFrame = object diff --git a/src/main/browser/browser-client-page-renderer-runtime.test.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts similarity index 97% rename from src/main/browser/browser-client-page-renderer-runtime.test.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts index 4734e3927ea..618c398ee16 100644 --- a/src/main/browser/browser-client-page-renderer-runtime.test.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.test.ts @@ -3,7 +3,7 @@ import { BROWSER_CLIENT_PAGE_RENDERER_REPLY_CHANNEL, BROWSER_CLIENT_PAGE_RENDERER_REQUEST_CHANNEL, type BrowserClientPageRendererRequest -} from '../../shared/browser-client-page-renderer-protocol' +} from '../../../../shared/browser-client-page-renderer-protocol' const { ipcMainOn, ipcMainRemoveListener } = vi.hoisted(() => ({ ipcMainOn: vi.fn(), diff --git a/src/main/browser/browser-client-page-renderer-runtime.ts b/src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.ts similarity index 75% rename from src/main/browser/browser-client-page-renderer-runtime.ts rename to src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.ts index 35cd33d24e5..eaa00c0506c 100644 --- a/src/main/browser/browser-client-page-renderer-runtime.ts +++ b/src/main/browser/client-pages/renderer/browser-client-page-renderer-runtime.ts @@ -1,10 +1,8 @@ import { ipcMain } from 'electron' -import { BROWSER_CLIENT_PAGE_RENDERER_REPLY_CHANNEL } from '../../shared/browser-client-page-renderer-protocol' -import type { BrowserClientPageRenderer } from './browser-client-page-cleanup' -import { - BrowserClientPageRendererBridgeRegistry, - type BrowserClientPageRendererEndpoint -} from './browser-client-page-renderer-bridge' +import { BROWSER_CLIENT_PAGE_RENDERER_REPLY_CHANNEL } from '../../../../shared/browser-client-page-renderer-protocol' +import type { BrowserClientPageRenderer } from '../lifecycle/browser-client-page-cleanup' +import { BrowserClientPageRendererBridgeRegistry } from './browser-client-page-renderer-bridge' +import type { BrowserClientPageRendererEndpoint } from './browser-client-page-renderer-reply-admission' let rendererBridges: BrowserClientPageRendererBridgeRegistry | null = null diff --git a/src/main/browser/browser-cdp-cookie.ts b/src/main/browser/cookies/browser-cdp-cookie.ts similarity index 100% rename from src/main/browser/browser-cdp-cookie.ts rename to src/main/browser/cookies/browser-cdp-cookie.ts diff --git a/src/main/browser/cookies/browser-cookie-clear-store-lifecycle.test.ts b/src/main/browser/cookies/browser-cookie-clear-store-lifecycle.test.ts index 6a98e165f78..9bf51821433 100644 --- a/src/main/browser/cookies/browser-cookie-clear-store-lifecycle.test.ts +++ b/src/main/browser/cookies/browser-cookie-clear-store-lifecycle.test.ts @@ -39,7 +39,7 @@ vi.mock('electron', () => ({ BrowserWindow: electron.BrowserWindow, webContents: { getAllWebContents: electron.getAllWebContents } })) -vi.mock('../electron-debugger-lease', () => ({ +vi.mock('../cdp/debugger/electron-debugger-lease', () => ({ acquireElectronDebugger: vi.fn(() => lease) })) diff --git a/src/main/browser/cookies/browser-cookie-clear-store.ts b/src/main/browser/cookies/browser-cookie-clear-store.ts index db38c7141de..653d36427d5 100644 --- a/src/main/browser/cookies/browser-cookie-clear-store.ts +++ b/src/main/browser/cookies/browser-cookie-clear-store.ts @@ -13,7 +13,7 @@ import type { } from './browser-cookie-import-clear' import { restoreEveryCookieIdentity } from './browser-cookie-identity-restore' import { normalizeCookiePartitionSite } from './sources/browser-cookie-source-partition' -import type { CdpCookie } from '../browser-cdp-cookie' +import type { CdpCookie } from './browser-cdp-cookie' function cdpSameSite(sameSite: Cookie['sameSite']): 'Strict' | 'Lax' | 'None' | undefined { if (sameSite === 'strict') { diff --git a/src/main/browser/cookies/browser-cookie-debugger-session.ts b/src/main/browser/cookies/browser-cookie-debugger-session.ts index dc4cee0ddbc..9daf886de85 100644 --- a/src/main/browser/cookies/browser-cookie-debugger-session.ts +++ b/src/main/browser/cookies/browser-cookie-debugger-session.ts @@ -1,5 +1,5 @@ import { BrowserWindow, type Session } from 'electron' -import { acquireElectronDebugger } from '../electron-debugger-lease' +import { acquireElectronDebugger } from '../cdp/debugger/electron-debugger-lease' export type CookieClearDebugger = { sendCommand: (method: string, params?: Record) => Promise diff --git a/src/main/browser/cookies/browser-cookie-import-clear.ts b/src/main/browser/cookies/browser-cookie-import-clear.ts index cc7f1c49284..8e49a2d7845 100644 --- a/src/main/browser/cookies/browser-cookie-import-clear.ts +++ b/src/main/browser/cookies/browser-cookie-import-clear.ts @@ -1,6 +1,6 @@ import type { Cookie, Cookies } from 'electron' import { mapSettledWithConcurrency } from '../../../shared/map-with-concurrency' -import type { CdpCookie } from '../browser-cdp-cookie' +import type { CdpCookie } from './browser-cdp-cookie' import type { ImportedDomainScope } from './browser-cookie-import-policy' import { cookieRemovalUrl, diff --git a/src/main/browser/cookies/browser-cookie-import-partition-fidelity.test.ts b/src/main/browser/cookies/browser-cookie-import-partition-fidelity.test.ts index 3949f312f0c..f2ed0411c47 100644 --- a/src/main/browser/cookies/browser-cookie-import-partition-fidelity.test.ts +++ b/src/main/browser/cookies/browser-cookie-import-partition-fidelity.test.ts @@ -67,7 +67,7 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs' import { dirname, join } from 'node:path' import { tmpdir } from 'node:os' import { DatabaseSync } from 'node:sqlite' -import type { DetectedBrowser } from './sources/browser-cookie-detection-types' +import type { DetectedBrowser } from './sources/browser-cookie-source-profiles' function chromeBrowser(cookiesPath: string): DetectedBrowser { return { diff --git a/src/main/browser/cookies/browser-cookie-import-route-partition-staging.test.ts b/src/main/browser/cookies/browser-cookie-import-route-partition-staging.test.ts index 23a9a75f5f7..22bef291ab5 100644 --- a/src/main/browser/cookies/browser-cookie-import-route-partition-staging.test.ts +++ b/src/main/browser/cookies/browser-cookie-import-route-partition-staging.test.ts @@ -61,7 +61,7 @@ import { existsSync, mkdtempSync, realpathSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { importCookiesFromBrowser } from './browser-cookie-import' -import type { DetectedBrowser } from './sources/browser-cookie-detection-types' +import type { DetectedBrowser } from './sources/browser-cookie-source-profiles' import { createChromiumCookieTestDatabase } from './browser-cookie-import-test-database' diff --git a/src/main/browser/cookies/browser-cookie-import-scope.test.ts b/src/main/browser/cookies/browser-cookie-import-scope.test.ts index fd01bfcbe45..f111d577b28 100644 --- a/src/main/browser/cookies/browser-cookie-import-scope.test.ts +++ b/src/main/browser/cookies/browser-cookie-import-scope.test.ts @@ -53,7 +53,7 @@ import { mkdtempSync, rmSync } from 'node:fs' import { join } from 'node:path' import { tmpdir } from 'node:os' import { importCookiesFromBrowser } from './browser-cookie-import' -import type { DetectedBrowser } from './sources/browser-cookie-detection-types' +import type { DetectedBrowser } from './sources/browser-cookie-source-profiles' import { createChromiumCookieTestDatabase } from './browser-cookie-import-test-database' diff --git a/src/main/browser/cookies/browser-cookie-import-snapshot-ownership.test.ts b/src/main/browser/cookies/browser-cookie-import-snapshot-ownership.test.ts index a3ac679d3b2..52642fd1fe3 100644 --- a/src/main/browser/cookies/browser-cookie-import-snapshot-ownership.test.ts +++ b/src/main/browser/cookies/browser-cookie-import-snapshot-ownership.test.ts @@ -1,7 +1,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type * as NodeSqlite from 'node:sqlite' import type * as ChromiumCookieSnapshotModule from '../chromium-cookie-snapshot' -import type { DetectedBrowser } from './sources/browser-cookie-detection-types' +import type { DetectedBrowser } from './sources/browser-cookie-source-profiles' import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync } from 'node:fs' import { dirname, join } from 'node:path' import { tmpdir } from 'node:os' diff --git a/src/main/browser/cookies/browser-cookie-import.test.ts b/src/main/browser/cookies/browser-cookie-import.test.ts index 51b69ea69c8..b6a5ba5476b 100644 --- a/src/main/browser/cookies/browser-cookie-import.test.ts +++ b/src/main/browser/cookies/browser-cookie-import.test.ts @@ -73,7 +73,7 @@ import { importCookiesFromBrowser, detectInstalledBrowsers } from './browser-cookie-import' -import type { DetectedBrowser } from './sources/browser-cookie-detection-types' +import type { DetectedBrowser } from './sources/browser-cookie-source-profiles' import { summarizeCookieImportError } from './browser-cookie-import-diagnostics' diff --git a/src/main/browser/cookies/browser-cookie-import.ts b/src/main/browser/cookies/browser-cookie-import.ts index 0ebbdf8a6e7..6c536c42cdc 100644 --- a/src/main/browser/cookies/browser-cookie-import.ts +++ b/src/main/browser/cookies/browser-cookie-import.ts @@ -4,7 +4,7 @@ import { detectInstalledBrowsers as detectBrowsers, selectBrowserProfile as selectProfile } from './sources/browser-cookie-detection' -import type { DetectedBrowser } from './sources/browser-cookie-detection-types' +import type { DetectedBrowser } from './sources/browser-cookie-source-profiles' import { pickCookieFile as pickFile, importCookiesFromFile as importFile, diff --git a/src/main/browser/browser-google-cookie-clear-target.test.ts b/src/main/browser/cookies/browser-google-cookie-clear-target.test.ts similarity index 90% rename from src/main/browser/browser-google-cookie-clear-target.test.ts rename to src/main/browser/cookies/browser-google-cookie-clear-target.test.ts index 20f0c5bba1f..8156d34db35 100644 --- a/src/main/browser/browser-google-cookie-clear-target.test.ts +++ b/src/main/browser/cookies/browser-google-cookie-clear-target.test.ts @@ -1,10 +1,10 @@ -import type * as ClientHostRuntime from './paired-runtime-browser-client-host-runtime' -import type { PublicKnownRuntimeEnvironment } from '../../shared/runtime-environments' +import type * as ClientHostRuntime from '../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' +import type { PublicKnownRuntimeEnvironment } from '../../../shared/runtime-environments' import { z } from 'zod' import type { GoogleCookieClearLocalTarget, GoogleCookieClearTarget -} from '../../shared/browser-google-cookie-clear' +} from '../../../shared/browser-google-cookie-clear' import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' @@ -12,7 +12,7 @@ import { afterEach, beforeEach, expect, it, vi } from 'vitest' import type { BrowserCookieImportResult, BrowserSessionProfile -} from '../../shared/browser-workspace-types' +} from '../../../shared/browser-workspace-types' type ImportExecution = BrowserCookieImportResult & { executionMachine: 'client' | 'remote' @@ -45,26 +45,26 @@ vi.mock('electron', () => ({ mocks.handlers.set(channel, handler) } })) -vi.mock('./paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ getPairedRuntimeBrowserClientRouteIdentity: mocks.route })) -vi.mock('./cookies/browser-cookie-import', () => ({ +vi.mock('./browser-cookie-import', () => ({ importCookiesFromBrowser: mocks.import, importCookiesFromFile: mocks.import, pickCookieFile: mocks.pick, detectInstalledBrowsers: mocks.detect, selectBrowserProfile: vi.fn() })) -vi.mock('./browser-manager', () => ({ browserManager: {} })) -vi.mock('./client-route-cookie-import-source-store', () => ({ +vi.mock('../browser-manager', () => ({ browserManager: {} })) +vi.mock('./client-route/client-route-cookie-import-source-store', () => ({ recordClientRouteCookieImportSource: vi.fn() })) -vi.mock('@/store', () => ({ useAppStore: { getState: () => importStore.getState() } })) +vi.mock('@/store/index', () => ({ useAppStore: { getState: () => importStore.getState() } })) vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn(), warning: vi.fn() } })) -import { browserSessionRegistry } from './browser-session-registry' -vi.mock('./paired-runtime-browser-client-host-registry', () => ({ +import { browserSessionRegistry } from '../browser-session-registry' +vi.mock('../client-hosts/lifecycle/paired-runtime-browser-client-host-registry', () => ({ PairedRuntimeBrowserClientHostRegistry: class { start = async () => ({}) closeEnvironment = async () => true @@ -75,17 +75,17 @@ const { publicRuntimeEnvironment } = await vi.importActual<{ publicRuntimeEnvironment( fields: Pick & Partial ): PublicKnownRuntimeEnvironment -}>('../../renderer/src/runtime/paired-runtime-environment-test-fixture') +}>('../../../renderer/src/runtime/paired-runtime-environment-test-fixture') const runtime = await vi.importActual( - './paired-runtime-browser-client-host-runtime' + '../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' ) const { replaceRuntimeEnvironmentRevisions } = await vi.importActual<{ replaceRuntimeEnvironmentRevisions(environments: PublicKnownRuntimeEnvironment[]): void -}>('../../renderer/src/runtime/runtime-environment-revision') +}>('../../../renderer/src/runtime/runtime-environment-revision') const { createTestStore } = await vi.importActual<{ createTestStore(): BrowserTestStore -}>('../../renderer/src/store/slices/browser-slice-test-harness') +}>('../../../renderer/src/store/slices/browser-slice-test-harness') const { captureGoogleCookieClearTarget, confirmAndClearGoogleCookies } = await vi.importActual<{ captureGoogleCookieClearTarget( hostId: string, @@ -97,17 +97,17 @@ const { captureGoogleCookieClearTarget, confirmAndClearGoogleCookies } = await v target: GoogleCookieClearTarget, confirm: () => Promise ): Promise -}>('../../renderer/src/lib/browser-google-cookie-clear') -import { registerBrowserHandlers } from '../ipc/browser/browser' -import { setTrustedBrowserRendererWebContentsId } from '../ipc/browser/browser-renderer-trust' +}>('../../../renderer/src/lib/browser-google-cookie-clear') +import { registerBrowserHandlers } from '../../ipc/browser/browser' +import { setTrustedBrowserRendererWebContentsId } from '../../ipc/browser/browser-renderer-trust' import { bindRoutePartition, importCookiesIntoClientRoutePartition -} from './browser-client-route-cookie-import' -import { clearGoogleCookies } from './cookies/browser-google-cookie-clear' -import { acquireCookieMutationLock } from './cookies/browser-cookie-import-clear' -import { deriveBrowserRoutePartition } from './browser-route-identity' -import * as bindingFile from './browser-route-partition-binding-file' +} from './client-route/browser-client-route-cookie-import' +import { clearGoogleCookies } from './browser-google-cookie-clear' +import { acquireCookieMutationLock } from './browser-cookie-import-clear' +import { deriveBrowserRoutePartition } from '../routing/partitions/browser-route-identity' +import * as bindingFile from '../routing/partitions/browser-route-partition-binding-file' const profile: BrowserSessionProfile = { id: 'work', @@ -319,8 +319,8 @@ it.each(['between selectors', 'queued profile'])( } ) -import { browserProfileRpcFixture } from '../runtime/browser/browser-profile-rpc-test-fixture' -import { RuntimeBrowserProfiles } from '../runtime/browser/browser-profiles' +import { browserProfileRpcFixture } from '../../runtime/browser/browser-profile-rpc-test-fixture' +import { RuntimeBrowserProfiles } from '../../runtime/browser/browser-profiles' it('validates required executor params at the dispatcher before owner entry', async () => { const clear = vi.spyOn(RuntimeBrowserProfiles.prototype, 'browserProfileClearGoogleCookies') const { dispatcher } = browserProfileRpcFixture('S1') diff --git a/src/main/browser/browser-google-cookie-clear-target.ts b/src/main/browser/cookies/browser-google-cookie-clear-target.ts similarity index 80% rename from src/main/browser/browser-google-cookie-clear-target.ts rename to src/main/browser/cookies/browser-google-cookie-clear-target.ts index d2353c13d4f..b9e95a49dfd 100644 --- a/src/main/browser/browser-google-cookie-clear-target.ts +++ b/src/main/browser/cookies/browser-google-cookie-clear-target.ts @@ -1,12 +1,12 @@ import type { BrowserCookieImportResult, BrowserSessionProfile -} from '../../shared/browser-workspace-types' -import type { GoogleCookieClearLocalTarget } from '../../shared/browser-google-cookie-clear' -import { bindRoutePartition } from './browser-client-route-cookie-import' -import { browserSessionRegistry } from './browser-session-registry' -import { getPairedRuntimeBrowserClientRouteIdentity } from './paired-runtime-browser-client-host-runtime' -import { clearGoogleCookiesFromPartition } from './cookies/browser-google-cookie-clear' +} from '../../../shared/browser-workspace-types' +import type { GoogleCookieClearLocalTarget } from '../../../shared/browser-google-cookie-clear' +import { bindRoutePartition } from './client-route/browser-client-route-cookie-import' +import { browserSessionRegistry } from '../browser-session-registry' +import { getPairedRuntimeBrowserClientRouteIdentity } from '../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' +import { clearGoogleCookiesFromPartition } from './browser-google-cookie-clear' export function googleCookieClearLocalTarget( profileId: string, diff --git a/src/main/browser/browser-partition-cookie-copy.test.ts b/src/main/browser/cookies/browser-partition-cookie-copy.test.ts similarity index 99% rename from src/main/browser/browser-partition-cookie-copy.test.ts rename to src/main/browser/cookies/browser-partition-cookie-copy.test.ts index 1019c3f7dd5..0c73ce5c310 100644 --- a/src/main/browser/browser-partition-cookie-copy.test.ts +++ b/src/main/browser/cookies/browser-partition-cookie-copy.test.ts @@ -89,7 +89,7 @@ vi.mock('electron', () => { } } }) -vi.mock('./electron-debugger-lease', () => ({ +vi.mock('../cdp/debugger/electron-debugger-lease', () => ({ acquireElectronDebugger: () => ({ release: () => {} }) })) diff --git a/src/main/browser/browser-partition-cookie-copy.ts b/src/main/browser/cookies/browser-partition-cookie-copy.ts similarity index 93% rename from src/main/browser/browser-partition-cookie-copy.ts rename to src/main/browser/cookies/browser-partition-cookie-copy.ts index 93622c21c42..01e36762bfc 100644 --- a/src/main/browser/browser-partition-cookie-copy.ts +++ b/src/main/browser/cookies/browser-partition-cookie-copy.ts @@ -7,17 +7,14 @@ import { session } from 'electron' import { emptyWslMoveBrowserCookieCopyCounts, type WslMoveBrowserCookieCopyCounts -} from '../../shared/wsl-move/wsl-move-browser-cookie-copy' +} from '../../../shared/wsl-move/wsl-move-browser-cookie-copy' import type { CdpCookie } from './browser-cdp-cookie' -import { identityFromCdpCookie, openCookieClearStore } from './cookies/browser-cookie-clear-store' -import { - withCookieMutationLock, - type CookieClearIdentity -} from './cookies/browser-cookie-import-clear' +import { identityFromCdpCookie, openCookieClearStore } from './browser-cookie-clear-store' +import { withCookieMutationLock, type CookieClearIdentity } from './browser-cookie-import-clear' import { isNonTransplantableCookieDomain, normalizeCookieDomain -} from './cookies/browser-cookie-import-policy' +} from './browser-cookie-import-policy' export type BrowserPartitionCookieCopyCounts = WslMoveBrowserCookieCopyCounts diff --git a/src/main/browser/cookies/chromium/import-context.ts b/src/main/browser/cookies/chromium/import-context.ts index e3f0d6a09ac..e38b6964cf3 100644 --- a/src/main/browser/cookies/chromium/import-context.ts +++ b/src/main/browser/cookies/chromium/import-context.ts @@ -5,7 +5,7 @@ import type { ImportedCookieFields, ImportWritePlanResult } from '../browser-coo import type { SourcePartitionRead } from '../sources/browser-cookie-source-partition' import type { ChromiumCookieSnapshot } from '../../chromium-cookie-snapshot' import type { EncryptionKeyResult } from '../sources/browser-cookie-sqlite' -import type { DetectedBrowser } from '../sources/browser-cookie-detection-types' +import type { DetectedBrowser } from '../sources/browser-cookie-source-profiles' export type ChromiumSourceRow = Record diff --git a/src/main/browser/cookies/chromium/import-cookies.ts b/src/main/browser/cookies/chromium/import-cookies.ts index ac7f2f90ab9..db3822bea13 100644 --- a/src/main/browser/cookies/chromium/import-cookies.ts +++ b/src/main/browser/cookies/chromium/import-cookies.ts @@ -7,7 +7,7 @@ import { getDiagLogPath, summarizeCookieImportError } from '../browser-cookie-import-diagnostics' -import type { DetectedBrowser } from '../sources/browser-cookie-detection-types' +import type { DetectedBrowser } from '../sources/browser-cookie-source-profiles' import type { CookieImportOptions } from '../browser-cookie-import-pipeline' import { withCookieMutationLock } from '../browser-cookie-import-clear' import { prepareChromiumCookieImport } from './prepare-import' diff --git a/src/main/browser/cookies/chromium/prepare-import.ts b/src/main/browser/cookies/chromium/prepare-import.ts index 16549976f35..2a947dd5adf 100644 --- a/src/main/browser/cookies/chromium/prepare-import.ts +++ b/src/main/browser/cookies/chromium/prepare-import.ts @@ -9,7 +9,7 @@ import { createChromiumCookieSnapshot } from '../../chromium-cookie-snapshot' import { planImportWrites } from '../browser-cookie-import-write' import { readChromiumRowPartition } from '../sources/browser-cookie-source-partition' import { diag } from '../browser-cookie-import-diagnostics' -import type { DetectedBrowser } from '../sources/browser-cookie-detection-types' +import type { DetectedBrowser } from '../sources/browser-cookie-source-profiles' import type { CookieImportOptions } from '../browser-cookie-import-pipeline' import type { ChromiumImportContext } from './import-context' import type { Session } from 'electron' diff --git a/src/main/browser/browser-client-route-cookie-import-partition-parity.test.ts b/src/main/browser/cookies/client-route/browser-client-route-cookie-import-partition-parity.test.ts similarity index 83% rename from src/main/browser/browser-client-route-cookie-import-partition-parity.test.ts rename to src/main/browser/cookies/client-route/browser-client-route-cookie-import-partition-parity.test.ts index e823aaeadd0..9aff0e1e116 100644 --- a/src/main/browser/browser-client-route-cookie-import-partition-parity.test.ts +++ b/src/main/browser/cookies/client-route/browser-client-route-cookie-import-partition-parity.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest' -import type { BrowserHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' +import type { BrowserHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' const { bindingStore, @@ -26,37 +26,35 @@ const { updateProfileSourceMock: vi.fn() })) -vi.mock('./cookies/browser-cookie-import', () => ({ +vi.mock('../browser-cookie-import', () => ({ detectInstalledBrowsers: detectInstalledBrowsersMock, importCookiesFromBrowser: importCookiesFromBrowserMock, selectBrowserProfile: vi.fn() })) -vi.mock('./browser-route-partition-binding-runtime', () => ({ +vi.mock('../../routing/partitions/browser-route-partition-binding-runtime', () => ({ currentBrowserRoutePartitionBindingStore: () => bindingStore })) -vi.mock('./browser-session-registry', () => ({ +vi.mock('../../browser-session-registry', () => ({ browserSessionRegistry: { getProfile: getProfileMock, requireRouteBrowserProfile: requireRouteBrowserProfileMock, updateProfileSource: updateProfileSourceMock } })) -vi.mock('./paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ getPairedRuntimeBrowserClientRouteIdentity: getRouteIdentityMock })) import { importCookiesIntoClientRoutePartition } from './browser-client-route-cookie-import' -import { BrowserClientNetworkRouteRegistry } from './browser-client-network-route-registry' +import { BrowserClientNetworkRouteRegistry } from '../../network/client-routes/browser-client-network-route-registry' import { browserAuthorityExecutionHostStorageIdentity, legacyBrowserNativeExecutionHostStorageIdentity -} from './browser-execution-host-storage-identity' -import { createBrowserRoutePartitionBindingStoreFake } from './browser-route-partition-binding-store-fake' -import { browserNetworkExecutionHostKey } from './browser-network-execution-route' -import { - BrowserRouteSessionRegistry, - type BrowserRouteElectronSession -} from './browser-route-session-registry' +} from '../../routing/identity/browser-execution-host-storage-identity' +import { createBrowserRoutePartitionBindingStoreFake } from '../../routing/partitions/browser-route-partition-binding-store-fake' +import { browserNetworkExecutionHostKey } from '../../network/execution-routes/browser-network-execution-route' +import { BrowserRouteSessionRegistry } from '../../routing/sessions/browser-route-session-registry' +import type { BrowserRouteElectronSession } from '../../routing/sessions/browser-route-session-policy' const orcaProfileId = 'orca-profile-a' const browserProfileId = 'default' diff --git a/src/main/browser/browser-client-route-cookie-import.test.ts b/src/main/browser/cookies/client-route/browser-client-route-cookie-import.test.ts similarity index 96% rename from src/main/browser/browser-client-route-cookie-import.test.ts rename to src/main/browser/cookies/client-route/browser-client-route-cookie-import.test.ts index 7ac24c79a8a..9135230756f 100644 --- a/src/main/browser/browser-client-route-cookie-import.test.ts +++ b/src/main/browser/cookies/client-route/browser-client-route-cookie-import.test.ts @@ -28,16 +28,16 @@ const { selectBrowserProfileMock: vi.fn() })) -vi.mock('./cookies/browser-cookie-import', () => ({ +vi.mock('../browser-cookie-import', () => ({ detectInstalledBrowsers: detectInstalledBrowsersMock, importCookiesFromBrowser: importCookiesFromBrowserMock, importCookiesFromFile: importCookiesFromFileMock, selectBrowserProfile: selectBrowserProfileMock })) -vi.mock('./browser-route-partition-binding-runtime', () => ({ +vi.mock('../../routing/partitions/browser-route-partition-binding-runtime', () => ({ currentBrowserRoutePartitionBindingStore: () => bindingStore })) -vi.mock('./browser-session-registry', () => ({ +vi.mock('../../browser-session-registry', () => ({ browserSessionRegistry: { getProfile: getProfileMock, requireRouteBrowserProfile: requireRouteBrowserProfileMock @@ -46,7 +46,7 @@ vi.mock('./browser-session-registry', () => ({ vi.mock('./client-route-cookie-import-source-store', () => ({ recordClientRouteCookieImportSource: recordClientRouteImportSourceMock })) -vi.mock('./paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ getPairedRuntimeBrowserClientRouteIdentity: getRouteIdentityMock })) diff --git a/src/main/browser/browser-client-route-cookie-import.ts b/src/main/browser/cookies/client-route/browser-client-route-cookie-import.ts similarity index 90% rename from src/main/browser/browser-client-route-cookie-import.ts rename to src/main/browser/cookies/client-route/browser-client-route-cookie-import.ts index c8c6e40e31e..0f0be14d916 100644 --- a/src/main/browser/browser-client-route-cookie-import.ts +++ b/src/main/browser/cookies/client-route/browser-client-route-cookie-import.ts @@ -1,24 +1,24 @@ import type { BrowserCookieImportResult, BrowserSessionProfileSource -} from '../../shared/browser-workspace-types' +} from '../../../../shared/browser-workspace-types' import { browserCookieImportFailure, type BrowserCookieImportFailure -} from '../../shared/browser-cookie-import-failure-copy' +} from '../../../../shared/browser-cookie-import-failure-copy' import { detectInstalledBrowsers, importCookiesFromBrowser, importCookiesFromFile, selectBrowserProfile -} from './cookies/browser-cookie-import' -import type { DetectedBrowser } from './cookies/sources/browser-cookie-detection-types' +} from '../browser-cookie-import' +import type { DetectedBrowser } from '../sources/browser-cookie-source-profiles' import { recordClientRouteCookieImportSource } from './client-route-cookie-import-source-store' -import { currentBrowserRoutePartitionBindingStore } from './browser-route-partition-binding-runtime' -import { resolveBrowserRoutePartitionBinding } from './browser-route-partition-migration' -import { browserSessionRegistry } from './browser-session-registry' -import { getPairedRuntimeBrowserClientRouteIdentity } from './paired-runtime-browser-client-host-runtime' +import { currentBrowserRoutePartitionBindingStore } from '../../routing/partitions/browser-route-partition-binding-runtime' +import { resolveBrowserRoutePartitionBinding } from '../../routing/partitions/browser-route-partition-migration' +import { browserSessionRegistry } from '../../browser-session-registry' +import { getPairedRuntimeBrowserClientRouteIdentity } from '../../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' type ClientRouteCookieImportTarget = { environmentId: string diff --git a/src/main/browser/client-route-cookie-import-source-store.test.ts b/src/main/browser/cookies/client-route/client-route-cookie-import-source-store.test.ts similarity index 100% rename from src/main/browser/client-route-cookie-import-source-store.test.ts rename to src/main/browser/cookies/client-route/client-route-cookie-import-source-store.test.ts diff --git a/src/main/browser/client-route-cookie-import-source-store.ts b/src/main/browser/cookies/client-route/client-route-cookie-import-source-store.ts similarity index 96% rename from src/main/browser/client-route-cookie-import-source-store.ts rename to src/main/browser/cookies/client-route/client-route-cookie-import-source-store.ts index 3a2d31fbfea..d6894aacdf4 100644 --- a/src/main/browser/client-route-cookie-import-source-store.ts +++ b/src/main/browser/cookies/client-route/client-route-cookie-import-source-store.ts @@ -1,7 +1,7 @@ import { app } from 'electron' import { mkdirSync, readFileSync, writeFileSync } from 'node:fs' import { dirname, join } from 'node:path' -import type { BrowserSessionProfileSource } from '../../shared/browser-workspace-types' +import type { BrowserSessionProfileSource } from '../../../../shared/browser-workspace-types' /** Keep import badges on this desktop because its route jars are absent from server profile records. */ const FILE_NAME = 'client-route-cookie-import-sources.json' diff --git a/src/main/browser/cookies/sources/browser-cookie-detection.ts b/src/main/browser/cookies/sources/browser-cookie-detection.ts index 3780a7e0900..b4744e947ca 100644 --- a/src/main/browser/cookies/sources/browser-cookie-detection.ts +++ b/src/main/browser/cookies/sources/browser-cookie-detection.ts @@ -9,7 +9,7 @@ import { firefoxProfilesRoot, isSafeBrowserProfileDirectory, type DetectedBrowser -} from './browser-cookie-detection-types' +} from './browser-cookie-source-profiles' export function detectSafari(): DetectedBrowser | null { if (process.platform !== 'darwin') { diff --git a/src/main/browser/cookies/sources/browser-cookie-firefox-import.ts b/src/main/browser/cookies/sources/browser-cookie-firefox-import.ts index 948958d0be3..3a45e07f491 100644 --- a/src/main/browser/cookies/sources/browser-cookie-firefox-import.ts +++ b/src/main/browser/cookies/sources/browser-cookie-firefox-import.ts @@ -11,7 +11,7 @@ import { type CookieImportOptions } from '../browser-cookie-import-pipeline' import { databaseSameSite, deriveUrl, type ValidatedCookie } from './browser-cookie-validation' -import type { DetectedBrowser } from './browser-cookie-detection-types' +import type { DetectedBrowser } from './browser-cookie-source-profiles' import { diag } from '../browser-cookie-import-diagnostics' export async function importCookiesFromFirefox( diff --git a/src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts b/src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts index ed101e1027c..0b450ac0410 100644 --- a/src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts +++ b/src/main/browser/cookies/sources/browser-cookie-import-undecryptable.test.ts @@ -63,7 +63,7 @@ vi.mock('../browser-cookie-clear-store', () => ({ })) import { importCookiesFromBrowser } from '../browser-cookie-import' -import type { DetectedBrowser } from './browser-cookie-detection-types' +import type { DetectedBrowser } from './browser-cookie-source-profiles' import { createChromiumCookieTestDatabase } from '../browser-cookie-import-test-database' import { mkdtempSync, rmSync } from 'node:fs' import { join } from 'node:path' diff --git a/src/main/browser/cookies/sources/browser-cookie-key.ts b/src/main/browser/cookies/sources/browser-cookie-key.ts index 75e53f6c86c..9187413c3b7 100644 --- a/src/main/browser/cookies/sources/browser-cookie-key.ts +++ b/src/main/browser/cookies/sources/browser-cookie-key.ts @@ -8,7 +8,7 @@ import { CHROMIUM_BROWSERS, browserRootPath, type DetectedBrowser -} from './browser-cookie-detection-types' +} from './browser-cookie-source-profiles' import type { EncryptionKeyResult } from './browser-cookie-sqlite' import type { LinuxCookieKeyFailure } from '../../../../shared/browser-workspace-types' diff --git a/src/main/browser/cookies/sources/browser-cookie-safari-import.ts b/src/main/browser/cookies/sources/browser-cookie-safari-import.ts index 6c7378547d7..9cc2352700b 100644 --- a/src/main/browser/cookies/sources/browser-cookie-safari-import.ts +++ b/src/main/browser/cookies/sources/browser-cookie-safari-import.ts @@ -3,7 +3,7 @@ import { browserCookieImportFailure } from '../../../../shared/browser-cookie-im import type { BrowserCookieImportResult } from '../../../../shared/browser-workspace-types' import { decodeSafariBinaryCookies } from './browser-cookie-safari-parser' import { importValidatedCookies, cookieImportTarget } from '../browser-cookie-import-pipeline' -import type { DetectedBrowser } from './browser-cookie-detection-types' +import type { DetectedBrowser } from './browser-cookie-source-profiles' import { diag } from '../browser-cookie-import-diagnostics' export async function importCookiesFromSafari( diff --git a/src/main/browser/cookies/sources/browser-cookie-detection-types.ts b/src/main/browser/cookies/sources/browser-cookie-source-profiles.ts similarity index 100% rename from src/main/browser/cookies/sources/browser-cookie-detection-types.ts rename to src/main/browser/cookies/sources/browser-cookie-source-profiles.ts diff --git a/src/main/browser/desktop-browser-bridge/desktop-browser-bridge-executor.ts b/src/main/browser/desktop-browser-bridge/desktop-browser-bridge-executor.ts index 030e54c02d0..81b8f302310 100644 --- a/src/main/browser/desktop-browser-bridge/desktop-browser-bridge-executor.ts +++ b/src/main/browser/desktop-browser-bridge/desktop-browser-bridge-executor.ts @@ -11,7 +11,7 @@ import { } from '../../../shared/desktop-browser-bridge-protocol' import type { RpcResponse } from '../../runtime/rpc/core' import { runInRemoteCliBrowserScope } from '../../runtime/desktop-browser-bridge/remote-cli-browser-scope' -import { parseCdpKeyEvent } from '../cdp-keyboard-us-layout' +import { parseCdpKeyEvent } from '../cdp/input/cdp-keyboard-us-layout' export type DesktopBrowserBridgeOutcome = | { ok: true; result: unknown } diff --git a/src/main/browser/doc-preview-guest-policy.ts b/src/main/browser/doc-preview-guest-policy.ts index 89ab474af93..3d1beaf415d 100644 --- a/src/main/browser/doc-preview-guest-policy.ts +++ b/src/main/browser/doc-preview-guest-policy.ts @@ -4,7 +4,7 @@ import { type DocPreviewExternalLink } from '../../shared/doc-preview-scheme' import { normalizeExternalBrowserUrl } from '../../shared/browser-url' -import { enforceBrowserRouteWebRtcPolicy } from './browser-route-webrtc-policy' +import { enforceBrowserRouteWebRtcPolicy } from './network/egress/browser-route-webrtc-policy' import { getDocPreviewGrant } from './doc-preview-grant-registry' type PreviewHostRenderer = { diff --git a/src/main/browser/browser-download-destination.test.ts b/src/main/browser/downloads/browser-download-destination.test.ts similarity index 100% rename from src/main/browser/browser-download-destination.test.ts rename to src/main/browser/downloads/browser-download-destination.test.ts diff --git a/src/main/browser/browser-download-destination.ts b/src/main/browser/downloads/browser-download-destination.ts similarity index 98% rename from src/main/browser/browser-download-destination.ts rename to src/main/browser/downloads/browser-download-destination.ts index 62aaceb0bd0..6a83cfd1d58 100644 --- a/src/main/browser/browser-download-destination.ts +++ b/src/main/browser/downloads/browser-download-destination.ts @@ -7,7 +7,7 @@ import { buildBrowserDownloadCollisionCandidate, MAX_BROWSER_DOWNLOAD_COLLISION_ATTEMPTS, normalizeBrowserDownloadFilename -} from '../../shared/browser-download-filename' +} from '../../../shared/browser-download-filename' export type BrowserDownloadDestination = { filename: string diff --git a/src/main/browser/extensions/api/commands.ts b/src/main/browser/extensions/api/commands.ts index 60f43b3a88c..6944395d081 100644 --- a/src/main/browser/extensions/api/commands.ts +++ b/src/main/browser/extensions/api/commands.ts @@ -1,6 +1,6 @@ import { z } from 'zod' import { KEYBINDING_DEFINITIONS, keybindingMatchesAction } from '../../../../shared/keybindings' -import { isAgentInjectingInput } from '../../agent-input-injection' +import { isAgentInjectingInput } from '../../cdp/input/agent-input-injection' import { browserManager } from '../../browser-manager' import { emitBrowserExtensionEvent, diff --git a/src/main/browser/extensions/browser-extension-popup-host.ts b/src/main/browser/extensions/browser-extension-popup-host.ts index 337a7880e65..7f4e44e20dd 100644 --- a/src/main/browser/extensions/browser-extension-popup-host.ts +++ b/src/main/browser/extensions/browser-extension-popup-host.ts @@ -4,7 +4,7 @@ import { getChromeExtensionOrigin, isSameExtensionNavigation } from '../../../shared/browser-extension-url' -import { allowPageUnload } from '../browser-guest-unload-policy' +import { allowPageUnload } from '../guest-lifecycle/browser-guest-unload-policy' import { BrowserExtensionApiError } from './browser-extension-namespace-registry' import { BROWSER_EXTENSION_POPUP_MAX, diff --git a/src/main/browser/extensions/browser-extension-tab-model.test.ts b/src/main/browser/extensions/browser-extension-tab-model.test.ts index ee12fbc8f2f..5c2ac3c7453 100644 --- a/src/main/browser/extensions/browser-extension-tab-model.test.ts +++ b/src/main/browser/extensions/browser-extension-tab-model.test.ts @@ -47,7 +47,8 @@ vi.mock('./browser-extension-window-model', () => ({ })) const { openBrowserExtensionTab } = await import('./browser-extension-tab-model') -const { watchBrowserMainWindowReadiness } = await import('../browser-main-window-readiness') +const { watchBrowserMainWindowReadiness } = + await import('../guest-lifecycle/browser-main-window-readiness') /** Orca's main window; its renderer reports readiness on the per-window IPC channel. */ function mainWindow() { diff --git a/src/main/browser/extensions/browser-extension-tab-model.ts b/src/main/browser/extensions/browser-extension-tab-model.ts index dade5076193..bf5bc940b19 100644 --- a/src/main/browser/extensions/browser-extension-tab-model.ts +++ b/src/main/browser/extensions/browser-extension-tab-model.ts @@ -21,7 +21,7 @@ import { getBrowserExtensionSessionForProfile } from './browser-extension-session-loader' import { isBrowserExtensionSupportEnabled } from './browser-extension-support' -import { whenBrowserMainWindowReady } from '../browser-main-window-readiness' +import { whenBrowserMainWindowReady } from '../guest-lifecycle/browser-main-window-readiness' import { findDiscardedBrowserTabForPage } from './browser-extension-discarded-tabs' import { getBrowserExtensionMainWindow, diff --git a/src/main/browser/extensions/browser-extension-tab-resolution.test.ts b/src/main/browser/extensions/browser-extension-tab-resolution.test.ts index 839aee1154c..0098ee56620 100644 --- a/src/main/browser/extensions/browser-extension-tab-resolution.test.ts +++ b/src/main/browser/extensions/browser-extension-tab-resolution.test.ts @@ -85,7 +85,7 @@ vi.mock('./browser-extension-api-host', () => ({ emitBrowserExtensionEvent: vi.f vi.mock('./browser-extension-popup-host', () => ({ closeBrowserExtensionPopup: vi.fn() })) vi.mock('./browser-extension-support', () => ({ isBrowserExtensionSupportEnabled: () => false })) vi.mock('./browser-extension-session-loader', () => ({})) -vi.mock('../browser-main-window-readiness', () => ({})) +vi.mock('../guest-lifecycle/browser-main-window-readiness', () => ({})) vi.mock('./browser-extension-active-tab', () => ({ hasBrowserExtensionActiveTab: (_extensionId: string, tabId: number) => mocks.activeGrants.has(tabId) diff --git a/src/main/browser/extensions/browser-extension-window-model.test.ts b/src/main/browser/extensions/browser-extension-window-model.test.ts index 110d3cc0fe9..12b6f8a9ef5 100644 --- a/src/main/browser/extensions/browser-extension-window-model.test.ts +++ b/src/main/browser/extensions/browser-extension-window-model.test.ts @@ -35,7 +35,7 @@ vi.mock('./browser-extension-api-host', () => ({ mocks.emitted.push({ session: target.session, event }) })) vi.mock('./browser-extension-support', () => ({ isBrowserExtensionSupportEnabled: () => false })) -vi.mock('../browser-main-window-readiness', () => ({ +vi.mock('../guest-lifecycle/browser-main-window-readiness', () => ({ watchBrowserMainWindowReadiness: () => {} })) diff --git a/src/main/browser/extensions/browser-extension-window-model.ts b/src/main/browser/extensions/browser-extension-window-model.ts index d0d17d8f306..21e464e6575 100644 --- a/src/main/browser/extensions/browser-extension-window-model.ts +++ b/src/main/browser/extensions/browser-extension-window-model.ts @@ -7,7 +7,7 @@ import { showWindowWithoutStealingFocus } from '../../window/foreground-activation-policy' import { emitBrowserExtensionEvent } from './browser-extension-api-host' -import { watchBrowserMainWindowReadiness } from '../browser-main-window-readiness' +import { watchBrowserMainWindowReadiness } from '../guest-lifecycle/browser-main-window-readiness' /** chrome.windows constants. */ export const WINDOW_ID_NONE = -1 diff --git a/src/main/browser/browser-agent-activity.test.ts b/src/main/browser/guest-lifecycle/browser-agent-activity.test.ts similarity index 98% rename from src/main/browser/browser-agent-activity.test.ts rename to src/main/browser/guest-lifecycle/browser-agent-activity.test.ts index 8cab00dfcf9..f1c5e2e615a 100644 --- a/src/main/browser/browser-agent-activity.test.ts +++ b/src/main/browser/guest-lifecycle/browser-agent-activity.test.ts @@ -21,13 +21,13 @@ vi.mock('electron', () => ({ })) import { BrowserAgentActivity } from './browser-agent-activity' -import { runWithActiveRpcCaller } from '../runtime/rpc/rpc-active-caller' +import { runWithActiveRpcCaller } from '../../runtime/rpc/rpc-active-caller' import { BROWSER_AGENT_ACTIVITY_CHANNEL, BROWSER_AGENT_CURSOR_ARRIVED_CHANNEL, BROWSER_AGENT_CURSOR_CHANNEL, type BrowserAgentCursorEvent -} from '../../shared/browser-agent-activity-contract' +} from '../../../shared/browser-agent-activity-contract' const PAGE = 'page-1' diff --git a/src/main/browser/browser-agent-activity.ts b/src/main/browser/guest-lifecycle/browser-agent-activity.ts similarity index 96% rename from src/main/browser/browser-agent-activity.ts rename to src/main/browser/guest-lifecycle/browser-agent-activity.ts index df958d55ed5..ef433dd1c6a 100644 --- a/src/main/browser/browser-agent-activity.ts +++ b/src/main/browser/guest-lifecycle/browser-agent-activity.ts @@ -1,15 +1,15 @@ import { BrowserWindow, ipcMain, type WebContents } from 'electron' -import { isResourceWindowVisible } from '../window/resource-view-admission' -import { sendGuestCdpCommand } from './guest-cdp-command' -import { isAgentRpcCaller } from '../runtime/rpc/rpc-caller-identity' +import { isResourceWindowVisible } from '../../window/resource-view-admission' +import { sendGuestCdpCommand } from '../cdp/debugger/guest-cdp-command' +import { isAgentRpcCaller } from '../../runtime/rpc/rpc-caller-identity' import { BROWSER_AGENT_ACTIVITY_CHANNEL, BROWSER_AGENT_CURSOR_ARRIVED_CHANNEL, BROWSER_AGENT_CURSOR_CHANNEL, type BrowserAgentActivityEvent, type BrowserAgentCursorEvent -} from '../../shared/browser-agent-activity-contract' -import { getActiveRpcCaller } from '../runtime/rpc/rpc-active-caller' +} from '../../../shared/browser-agent-activity-contract' +import { getActiveRpcCaller } from '../../runtime/rpc/rpc-active-caller' // Spans an agent's thinking between steps; a finished, failed or disconnected agent clears within it. const ACTIVITY_IDLE_MS = 20_000 diff --git a/src/main/browser/browser-guest-devtools-close-shortcut.ts b/src/main/browser/guest-lifecycle/browser-guest-devtools-close-shortcut.ts similarity index 92% rename from src/main/browser/browser-guest-devtools-close-shortcut.ts rename to src/main/browser/guest-lifecycle/browser-guest-devtools-close-shortcut.ts index ea96e40198e..462253477d2 100644 --- a/src/main/browser/browser-guest-devtools-close-shortcut.ts +++ b/src/main/browser/guest-lifecycle/browser-guest-devtools-close-shortcut.ts @@ -1,8 +1,5 @@ -import { - keybindingMatchesAction, - type KeybindingInput, - type KeybindingOverrides -} from '../../shared/keybindings' +import { keybindingMatchesAction } from '../../../shared/keybindings/matching' +import type { KeybindingInput, KeybindingOverrides } from '../../../shared/keybindings/types' /** Cmd/Ctrl+W in a page's DevTools, docked or in their own window, closes DevTools, not the tab. */ export function installGuestDevToolsCloseShortcut(args: { diff --git a/src/main/browser/browser-guest-devtools-dock.test.ts b/src/main/browser/guest-lifecycle/browser-guest-devtools-dock.test.ts similarity index 100% rename from src/main/browser/browser-guest-devtools-dock.test.ts rename to src/main/browser/guest-lifecycle/browser-guest-devtools-dock.test.ts diff --git a/src/main/browser/browser-guest-devtools-dock.ts b/src/main/browser/guest-lifecycle/browser-guest-devtools-dock.ts similarity index 99% rename from src/main/browser/browser-guest-devtools-dock.ts rename to src/main/browser/guest-lifecycle/browser-guest-devtools-dock.ts index d1f609c24ad..9318a4fdc6e 100644 --- a/src/main/browser/browser-guest-devtools-dock.ts +++ b/src/main/browser/guest-lifecycle/browser-guest-devtools-dock.ts @@ -1,5 +1,5 @@ import { BrowserWindow, WebContentsView } from 'electron' -import type { BrowserDevToolsDockBounds } from '../../shared/browser-devtools-dock' +import type { BrowserDevToolsDockBounds } from '../../../shared/browser-devtools-dock' type DevToolsOpenOperation = { isCurrent: () => boolean diff --git a/src/main/browser/browser-guest-navigation-state.ts b/src/main/browser/guest-lifecycle/browser-guest-navigation-state.ts similarity index 100% rename from src/main/browser/browser-guest-navigation-state.ts rename to src/main/browser/guest-lifecycle/browser-guest-navigation-state.ts diff --git a/src/main/browser/browser-guest-renderer-target.ts b/src/main/browser/guest-lifecycle/browser-guest-renderer-target.ts similarity index 100% rename from src/main/browser/browser-guest-renderer-target.ts rename to src/main/browser/guest-lifecycle/browser-guest-renderer-target.ts diff --git a/src/main/browser/browser-guest-unload-policy.ts b/src/main/browser/guest-lifecycle/browser-guest-unload-policy.ts similarity index 100% rename from src/main/browser/browser-guest-unload-policy.ts rename to src/main/browser/guest-lifecycle/browser-guest-unload-policy.ts diff --git a/src/main/browser/browser-main-window-readiness.ts b/src/main/browser/guest-lifecycle/browser-main-window-readiness.ts similarity index 95% rename from src/main/browser/browser-main-window-readiness.ts rename to src/main/browser/guest-lifecycle/browser-main-window-readiness.ts index 95d2d99cbb8..4a53089c676 100644 --- a/src/main/browser/browser-main-window-readiness.ts +++ b/src/main/browser/guest-lifecycle/browser-main-window-readiness.ts @@ -1,5 +1,5 @@ import type { BrowserWindow } from 'electron' -import { forgetBrowserPageGuestsGone } from './extensions/browser-extension-discarded-tabs' +import { forgetBrowserPageGuestsGone } from '../extensions/browser-extension-discarded-tabs' /** Sent by the renderer's browser request bridge once its workspaces are restored. */ const TAB_REQUESTS_READY_CHANNEL = 'browser:tabRequestsReady' diff --git a/src/main/browser/browser-page-events.ts b/src/main/browser/guest-lifecycle/browser-page-events.ts similarity index 91% rename from src/main/browser/browser-page-events.ts rename to src/main/browser/guest-lifecycle/browser-page-events.ts index df417b58874..d5e5ba1dade 100644 --- a/src/main/browser/browser-page-events.ts +++ b/src/main/browser/guest-lifecycle/browser-page-events.ts @@ -1,5 +1,5 @@ import { EventEmitter } from 'node:events' -import type { BrowserPopupEvent } from '../../shared/browser-guest-events' +import type { BrowserPopupEvent } from '../../../shared/browser-guest-events' /** Facts the browser manager resolves to their owning page: a tab it asked for, a popup outcome, a download. */ export type BrowserPageEvent = diff --git a/src/main/browser/browser-guest-context-menu.ts b/src/main/browser/guest-lifecycle/input/browser-guest-context-menu.ts similarity index 88% rename from src/main/browser/browser-guest-context-menu.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-context-menu.ts index 06db732a90a..7f0decd5ad5 100644 --- a/src/main/browser/browser-guest-context-menu.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-context-menu.ts @@ -3,12 +3,12 @@ import { normalizeBrowserNavigationUrl, normalizeExternalBrowserUrl, redactKagiSessionToken -} from '../../shared/browser-url' -import type { BrowserContextMenuRequestedEvent } from '../../shared/browser-guest-events' -import { readContextMenuSpelling } from '../window/editable-context-menu' -import { readGuestNavigationState } from './browser-guest-navigation-state' -import type { ResolveRenderer } from './browser-guest-renderer-target' -import { buildBrowserExtensionPageContextMenu } from './extensions/browser-extension-context-menu-host' +} from '../../../../shared/browser-url' +import type { BrowserContextMenuRequestedEvent } from '../../../../shared/browser-guest-events' +import { readContextMenuSpelling } from '../../../window/editable-context-menu' +import { readGuestNavigationState } from '../browser-guest-navigation-state' +import type { ResolveRenderer } from '../browser-guest-renderer-target' +import { buildBrowserExtensionPageContextMenu } from '../../extensions/browser-extension-context-menu-host' export function setupGuestContextMenu(args: { browserTabId: string diff --git a/src/main/browser/browser-guest-grab-shortcuts.ts b/src/main/browser/guest-lifecycle/input/browser-guest-grab-shortcuts.ts similarity index 89% rename from src/main/browser/browser-guest-grab-shortcuts.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-grab-shortcuts.ts index 9cfae7f144d..f78e67a3253 100644 --- a/src/main/browser/browser-guest-grab-shortcuts.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-grab-shortcuts.ts @@ -1,6 +1,7 @@ -import { keybindingMatchesAction, type KeybindingOverrides } from '../../shared/keybindings' -import { isAgentInjectingInput } from './agent-input-injection' -import type { ResolveRenderer } from './browser-guest-renderer-target' +import { keybindingMatchesAction } from '../../../../shared/keybindings/matching' +import type { KeybindingOverrides } from '../../../../shared/keybindings/types' +import { isAgentInjectingInput } from '../../cdp/input/agent-input-injection' +import type { ResolveRenderer } from '../browser-guest-renderer-target' // Guests swallow renderer shortcuts; keep normal copy when editing or text is selected. export function setupGrabShortcutForwarding(args: { diff --git a/src/main/browser/browser-guest-input-gesture.ts b/src/main/browser/guest-lifecycle/input/browser-guest-input-gesture.ts similarity index 100% rename from src/main/browser/browser-guest-input-gesture.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-input-gesture.ts diff --git a/src/main/browser/browser-guest-mouse-press.ts b/src/main/browser/guest-lifecycle/input/browser-guest-mouse-press.ts similarity index 89% rename from src/main/browser/browser-guest-mouse-press.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-mouse-press.ts index 3fabdf5f913..592fef7f63e 100644 --- a/src/main/browser/browser-guest-mouse-press.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-mouse-press.ts @@ -1,5 +1,5 @@ -import type { ResolveRenderer } from './browser-guest-renderer-target' -import { isAgentInjectingInput } from './agent-input-injection' +import type { ResolveRenderer } from '../browser-guest-renderer-target' +import { isAgentInjectingInput } from '../../cdp/input/agent-input-injection' /** * A press in a page is the desktop user's signal for two things the embedder never sees: the diff --git a/src/main/browser/browser-guest-shortcut-dispatch.ts b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-dispatch.ts similarity index 92% rename from src/main/browser/browser-guest-shortcut-dispatch.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-shortcut-dispatch.ts index 65efb04c6c8..f9ef21fe2bd 100644 --- a/src/main/browser/browser-guest-shortcut-dispatch.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-dispatch.ts @@ -1,13 +1,14 @@ import { resolveWindowShortcutAction, type WindowShortcutInput -} from '../../shared/window-shortcut-policy' -import { keybindingMatchesAction, type KeybindingOverrides } from '../../shared/keybindings' -import { FLOATING_TERMINAL_WORKTREE_ID } from '../../shared/constants' -import type { BrowserPageZoomDirection } from '../../shared/browser-page-zoom' -import type { BrowserFindTarget } from '../../shared/browser-find-source' -import type { BrowserPageTabShortcut } from '../../shared/browser-page-command-target' -import type { ResolveRenderer } from './browser-guest-renderer-target' +} from '../../../../shared/window-shortcut-policy' +import { keybindingMatchesAction } from '../../../../shared/keybindings/matching' +import type { KeybindingOverrides } from '../../../../shared/keybindings/types' +import { FLOATING_TERMINAL_WORKTREE_ID } from '../../../../shared/constants' +import type { BrowserPageZoomDirection } from '../../../../shared/browser-page-zoom' +import type { BrowserFindTarget } from '../../../../shared/browser-find-source' +import type { BrowserPageTabShortcut } from '../../../../shared/browser-page-command-target' +import type { ResolveRenderer } from '../browser-guest-renderer-target' import { matchesGuestTabShortcut } from './browser-guest-tab-shortcut' export type ShouldForwardDictationShortcut = () => boolean diff --git a/src/main/browser/browser-guest-shortcut-forwarding.test.ts b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-forwarding.test.ts similarity index 100% rename from src/main/browser/browser-guest-shortcut-forwarding.test.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-shortcut-forwarding.test.ts diff --git a/src/main/browser/browser-guest-shortcut-forwarding.ts b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-forwarding.ts similarity index 92% rename from src/main/browser/browser-guest-shortcut-forwarding.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-shortcut-forwarding.ts index 75d433cf5e9..99dde606a90 100644 --- a/src/main/browser/browser-guest-shortcut-forwarding.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-forwarding.ts @@ -1,17 +1,17 @@ -import { isAgentInjectingInput } from './agent-input-injection' +import { isAgentInjectingInput } from '../../cdp/input/agent-input-injection' import { isRecentTabSwitcherCommitRelease, matchesRecentTabSwitcherChord, nativeZoomCommandMatchesKeybindings, resolveWindowShortcutAction -} from '../../shared/window-shortcut-policy' -import type { KeybindingOverrides } from '../../shared/keybindings' -import type { BrowserPageZoomDirection } from '../../shared/browser-page-zoom' +} from '../../../../shared/window-shortcut-policy' +import type { KeybindingOverrides } from '../../../../shared/keybindings/types' +import type { BrowserPageZoomDirection } from '../../../../shared/browser-page-zoom' import { ModifierDoubleTapDetector, toModifierDoubleTapEvent -} from '../../shared/modifier-double-tap-detector' -import type { ResolveRenderer } from './browser-guest-renderer-target' +} from '../../../../shared/modifier-double-tap-detector' +import type { ResolveRenderer } from '../browser-guest-renderer-target' import { consumeRecentGuestWheelZoom } from './browser-guest-wheel-zoom' import { forwardGuestShortcutInput, diff --git a/src/main/browser/browser-guest-shortcut-plugin-frame.test.ts b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-plugin-frame.test.ts similarity index 100% rename from src/main/browser/browser-guest-shortcut-plugin-frame.test.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-shortcut-plugin-frame.test.ts diff --git a/src/main/browser/browser-guest-shortcut-precedence.test.ts b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-precedence.test.ts similarity index 89% rename from src/main/browser/browser-guest-shortcut-precedence.test.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-shortcut-precedence.test.ts index 9b442763ee0..435c2669805 100644 --- a/src/main/browser/browser-guest-shortcut-precedence.test.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-shortcut-precedence.test.ts @@ -15,12 +15,10 @@ vi.mock('electron', async () => { }) import { BrowserWindow } from 'electron' -import { - findKeybindingConflicts, - isKeybindingInterceptedByMainProcess, - KEYBINDING_DEFINITIONS, - type KeybindingOverrides -} from '../../shared/keybindings' +import { findKeybindingConflicts } from '../../../../shared/keybindings/formatting' +import { isKeybindingInterceptedByMainProcess } from '../../../../shared/keybindings/effective' +import { KEYBINDING_DEFINITIONS } from '../../../../shared/keybindings/definitions' +import type { KeybindingOverrides } from '../../../../shared/keybindings/types' import { setupGuestShortcutForwarding } from './browser-guest-shortcut-forwarding' const CHORD = 'Mod+Alt+Shift+1' diff --git a/src/main/browser/browser-guest-tab-shortcut.ts b/src/main/browser/guest-lifecycle/input/browser-guest-tab-shortcut.ts similarity index 70% rename from src/main/browser/browser-guest-tab-shortcut.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-tab-shortcut.ts index bbfce28506e..6a142b022c3 100644 --- a/src/main/browser/browser-guest-tab-shortcut.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-tab-shortcut.ts @@ -1,10 +1,7 @@ -import { - KEYBINDING_DEFINITIONS, - keybindingMatchesAction, - type KeybindingActionId, - type KeybindingOverrides -} from '../../shared/keybindings' -import type { WindowShortcutInput } from '../../shared/window-shortcut-policy' +import { KEYBINDING_DEFINITIONS } from '../../../../shared/keybindings/definitions' +import { keybindingMatchesAction } from '../../../../shared/keybindings/matching' +import type { KeybindingActionId, KeybindingOverrides } from '../../../../shared/keybindings/types' +import type { WindowShortcutInput } from '../../../../shared/window-shortcut-policy' // Why: neither acts on a page (open-markdown has no app-wide owner, rename only renames terminal and // chat tabs), so claiming them would only take the chord from the page. diff --git a/src/main/browser/browser-guest-target-url.test.ts b/src/main/browser/guest-lifecycle/input/browser-guest-target-url.test.ts similarity index 100% rename from src/main/browser/browser-guest-target-url.test.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-target-url.test.ts diff --git a/src/main/browser/browser-guest-target-url.ts b/src/main/browser/guest-lifecycle/input/browser-guest-target-url.ts similarity index 93% rename from src/main/browser/browser-guest-target-url.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-target-url.ts index 0072d92750f..d40cc2d442a 100644 --- a/src/main/browser/browser-guest-target-url.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-target-url.ts @@ -1,6 +1,6 @@ import { screen } from 'electron' -import type { BrowserTargetUrlChangedEvent } from '../../shared/browser-guest-events' -import type { ResolveRenderer } from './browser-guest-renderer-target' +import type { BrowserTargetUrlChangedEvent } from '../../../../shared/browser-guest-events' +import type { ResolveRenderer } from '../browser-guest-renderer-target' const POINTER_REFRESH_MS = 100 diff --git a/src/main/browser/browser-guest-wheel-zoom-scroll.test.ts b/src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom-scroll.test.ts similarity index 98% rename from src/main/browser/browser-guest-wheel-zoom-scroll.test.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom-scroll.test.ts index a2ee508d659..63a2f2162fb 100644 --- a/src/main/browser/browser-guest-wheel-zoom-scroll.test.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom-scroll.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' const agentInjection = vi.hoisted(() => ({ active: false })) -vi.mock('./agent-input-injection', () => ({ +vi.mock('../../cdp/input/agent-input-injection', () => ({ isAgentInjectingInput: () => agentInjection.active })) diff --git a/src/main/browser/browser-guest-wheel-zoom.ts b/src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom.ts similarity index 96% rename from src/main/browser/browser-guest-wheel-zoom.ts rename to src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom.ts index 0f5898d7b7e..e03b9ede014 100644 --- a/src/main/browser/browser-guest-wheel-zoom.ts +++ b/src/main/browser/guest-lifecycle/input/browser-guest-wheel-zoom.ts @@ -1,5 +1,5 @@ -import type { BrowserPageZoomDirection } from '../../shared/browser-page-zoom' -import type { ResolveRenderer } from './browser-guest-renderer-target' +import type { BrowserPageZoomDirection } from '../../../../shared/browser-page-zoom' +import type { ResolveRenderer } from '../browser-guest-renderer-target' import { forwardGuestMousePress } from './browser-guest-mouse-press' const CONTROL_MODIFIERS = new Set(['control', 'ctrl']) diff --git a/src/main/browser/browser-page-initiated-tab-budget.test.ts b/src/main/browser/guest-lifecycle/popups/browser-page-initiated-tab-budget.test.ts similarity index 100% rename from src/main/browser/browser-page-initiated-tab-budget.test.ts rename to src/main/browser/guest-lifecycle/popups/browser-page-initiated-tab-budget.test.ts diff --git a/src/main/browser/browser-page-initiated-tab-budget.ts b/src/main/browser/guest-lifecycle/popups/browser-page-initiated-tab-budget.ts similarity index 100% rename from src/main/browser/browser-page-initiated-tab-budget.ts rename to src/main/browser/guest-lifecycle/popups/browser-page-initiated-tab-budget.ts diff --git a/src/main/browser/browser-popup-adapter-compatibility.electron.test.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts similarity index 99% rename from src/main/browser/browser-popup-adapter-compatibility.electron.test.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts index c7424823a65..17df9929044 100644 --- a/src/main/browser/browser-popup-adapter-compatibility.electron.test.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-adapter-compatibility.electron.test.ts @@ -12,7 +12,7 @@ import { snapshots, status } from './browser-popup-compatibility-cdp-fixture' -import { waitForHiddenFrameInput } from './hidden-frame-input-readiness-fixture' +import { waitForHiddenFrameInput } from '../../hidden-frame-input-readiness-fixture' enablePopupAdapterProbe() setPopupFixtureEvidenceName('adapter-electron-evidence.json') diff --git a/src/main/browser/browser-popup-adapter-probe-fixture.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-adapter-probe-fixture.ts similarity index 100% rename from src/main/browser/browser-popup-adapter-probe-fixture.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-adapter-probe-fixture.ts diff --git a/src/main/browser/browser-popup-background-cdp-probe.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-background-cdp-probe.ts similarity index 98% rename from src/main/browser/browser-popup-background-cdp-probe.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-background-cdp-probe.ts index 27ad3a58b4f..fbd92eb57fc 100644 --- a/src/main/browser/browser-popup-background-cdp-probe.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-background-cdp-probe.ts @@ -2,7 +2,7 @@ import { mkdirSync } from 'node:fs' import { join } from 'node:path' import type { Page } from 'playwright' import { expect } from 'vitest' -import { waitForHiddenFrameInput } from './hidden-frame-input-readiness-fixture' +import { waitForHiddenFrameInput } from '../../hidden-frame-input-readiness-fixture' import { artifactDir, browser, diff --git a/src/main/browser/browser-popup-background-compatibility.electron.test.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-background-compatibility.electron.test.ts similarity index 100% rename from src/main/browser/browser-popup-background-compatibility.electron.test.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-background-compatibility.electron.test.ts diff --git a/src/main/browser/browser-popup-compatibility-cdp-fixture.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-cdp-fixture.ts similarity index 96% rename from src/main/browser/browser-popup-compatibility-cdp-fixture.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-cdp-fixture.ts index e9c996f5b83..29158930b98 100644 --- a/src/main/browser/browser-popup-compatibility-cdp-fixture.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-cdp-fixture.ts @@ -9,13 +9,13 @@ import { join } from 'node:path' import { chromium, type Browser, type Page } from 'playwright' import { afterAll, afterEach, beforeAll, expect, vi } from 'vitest' import { build as buildVite } from 'vite' -import { waitForBrowserCdpEndpoint } from './browser-session-ua-cdp-collector' +import { waitForBrowserCdpEndpoint } from '../../browser-session-ua-cdp-collector' import { popupFixtureHtml } from './browser-popup-compatibility-page-fixture' -import { resolveElectronProbeLaunch } from './electron-probe-display-launch' +import { resolveElectronProbeLaunch } from '../../electron-probe-display-launch' import { HIDDEN_RENDERER_FIRST_FRAME_TIMEOUT_MS, startHiddenRendererFrameCapture -} from './hidden-renderer-frame-capture-fixture' +} from '../../hidden-renderer-frame-capture-fixture' // Hidden renderer startup and CDP events can exceed the default one-second poll on CI. vi.setConfig({ expect: { poll: { timeout: 10_000 } } }) @@ -132,7 +132,7 @@ beforeAll(async () => { lib: { entry: join( process.cwd(), - 'src/main/browser/browser-popup-compatibility-electron-fixture.ts' + 'src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-electron-fixture.ts' ), formats: ['cjs'], fileName: () => 'main.cjs' diff --git a/src/main/browser/browser-popup-compatibility-electron-fixture.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-electron-fixture.ts similarity index 96% rename from src/main/browser/browser-popup-compatibility-electron-fixture.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-electron-fixture.ts index 5878f9530fe..848560befb8 100644 --- a/src/main/browser/browser-popup-compatibility-electron-fixture.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-electron-fixture.ts @@ -8,10 +8,10 @@ import { type WebContents } from 'electron' import { renameSync, writeFileSync } from 'node:fs' -import { applyBackgroundActivationPolicy } from '../window/foreground-activation-policy' +import { applyBackgroundActivationPolicy } from '../../../window/foreground-activation-policy' import { BrowserPopupCompatibilityManager } from './browser-popup-compatibility-manager-fixture' -import { BrowserRouteWebContentsRegistry } from './browser-route-webcontents-registry' -import { initializeBrowserProcessUserAgent } from './browser-process-user-agent' +import { BrowserRouteWebContentsRegistry } from '../../routing/guest-authority/browser-route-webcontents-registry' +import { initializeBrowserProcessUserAgent } from '../../browser-process-user-agent' import { BrowserPopupNativeFixture, popupFixtureContentSecurity as contentSecurity @@ -19,7 +19,7 @@ import { import type { BrowserRouteGuestLifecycleClaim, BrowserRoutePageGuestIdentity -} from './browser-route-page-authority' +} from '../../routing/guest-authority/browser-route-page-authority' import { BrowserPopupAdapterProbeFixture } from './browser-popup-adapter-probe-fixture' const origin = process.env.ORCA_POPUP_FIXTURE_ORIGIN diff --git a/src/main/browser/browser-popup-compatibility-manager-fixture.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-manager-fixture.ts similarity index 97% rename from src/main/browser/browser-popup-compatibility-manager-fixture.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-manager-fixture.ts index bffd2240819..2e65b3f2cd7 100644 --- a/src/main/browser/browser-popup-compatibility-manager-fixture.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-manager-fixture.ts @@ -1,5 +1,5 @@ import type { WebContents } from 'electron' -import { BrowserManager } from './browser-manager' +import { BrowserManager } from '../../browser-manager' import type { PopupChildWindowOptions } from './popup-origin-bar-window' import { popupFixtureContentSecurity as contentSecurity } from './browser-popup-native-electron-fixture' diff --git a/src/main/browser/browser-popup-compatibility-page-fixture.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-page-fixture.ts similarity index 100% rename from src/main/browser/browser-popup-compatibility-page-fixture.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-page-fixture.ts diff --git a/src/main/browser/browser-popup-compatibility-status.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-status.ts similarity index 100% rename from src/main/browser/browser-popup-compatibility-status.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-compatibility-status.ts diff --git a/src/main/browser/browser-popup-compatibility.electron.test.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts similarity index 100% rename from src/main/browser/browser-popup-compatibility.electron.test.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts diff --git a/src/main/browser/browser-popup-native-compatibility.electron.test.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts similarity index 99% rename from src/main/browser/browser-popup-native-compatibility.electron.test.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts index 4ad3ca27445..0835dc0d695 100644 --- a/src/main/browser/browser-popup-native-compatibility.electron.test.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts @@ -14,7 +14,7 @@ import { status, setPopupFixtureEvidenceName } from './browser-popup-compatibility-cdp-fixture' -import { waitForHiddenFrameInput } from './hidden-frame-input-readiness-fixture' +import { waitForHiddenFrameInput } from '../../hidden-frame-input-readiness-fixture' import { MIN_POPUP_CONTENT_HEIGHT, MIN_POPUP_CONTENT_WIDTH } from './popup-window-minimum-size' setPopupFixtureEvidenceName('native-electron-evidence.json') diff --git a/src/main/browser/browser-popup-native-electron-fixture.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-native-electron-fixture.ts similarity index 97% rename from src/main/browser/browser-popup-native-electron-fixture.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-native-electron-fixture.ts index 4689b1227f3..8e9da714c62 100644 --- a/src/main/browser/browser-popup-native-electron-fixture.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-native-electron-fixture.ts @@ -6,7 +6,7 @@ import { type Session, type WebContents } from 'electron' -import { resolveBrowserRouteGuestPopupOpener } from './browser-route-guest-popup-ownership' +import { resolveBrowserRouteGuestPopupOpener } from '../../routing/guest-authority/browser-route-guest-popup-ownership' export class BrowserPopupNativeFixture { readonly presentationCalls: string[] = [] diff --git a/src/main/browser/browser-popup-native-window.test.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-native-window.test.ts similarity index 100% rename from src/main/browser/browser-popup-native-window.test.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-native-window.test.ts diff --git a/src/main/browser/browser-popup-native-window.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-native-window.ts similarity index 98% rename from src/main/browser/browser-popup-native-window.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-native-window.ts index 8dff4aa1e2a..c4d6e1fd265 100644 --- a/src/main/browser/browser-popup-native-window.ts +++ b/src/main/browser/guest-lifecycle/popups/browser-popup-native-window.ts @@ -1,5 +1,5 @@ import { app, type BrowserWindow, type WebContents } from 'electron' -import { isBackgroundLaunch } from '../window/foreground-activation-policy' +import { isBackgroundLaunch } from '../../../window/foreground-activation-policy' import type { PopupChildWindowOptions, PopupOriginBarWindow } from './popup-origin-bar-window' import { isNativeBrowserPopupWindow, diff --git a/src/main/browser/browser-popup-new-tab-intent.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-new-tab-intent.ts similarity index 100% rename from src/main/browser/browser-popup-new-tab-intent.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-new-tab-intent.ts diff --git a/src/main/browser/browser-popup-page-id.ts b/src/main/browser/guest-lifecycle/popups/browser-popup-page-id.ts similarity index 100% rename from src/main/browser/browser-popup-page-id.ts rename to src/main/browser/guest-lifecycle/popups/browser-popup-page-id.ts diff --git a/src/main/browser/native-browser-popup-windows.ts b/src/main/browser/guest-lifecycle/popups/native-browser-popup-windows.ts similarity index 100% rename from src/main/browser/native-browser-popup-windows.ts rename to src/main/browser/guest-lifecycle/popups/native-browser-popup-windows.ts diff --git a/src/main/browser/popup-committed-origin.ts b/src/main/browser/guest-lifecycle/popups/popup-committed-origin.ts similarity index 100% rename from src/main/browser/popup-committed-origin.ts rename to src/main/browser/guest-lifecycle/popups/popup-committed-origin.ts diff --git a/src/main/browser/popup-identity-electron-probe.test.ts b/src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.test.ts similarity index 96% rename from src/main/browser/popup-identity-electron-probe.test.ts rename to src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.test.ts index 340da15d66f..75a738775cb 100644 --- a/src/main/browser/popup-identity-electron-probe.test.ts +++ b/src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.test.ts @@ -12,7 +12,7 @@ vi.mock('@orca/process-host', () => ({ spawnProcess: mocks.spawn })) vi.mock('playwright', () => ({ chromium: { connectOverCDP: vi.fn(async () => ({ close: mocks.closeBrowser })) } })) -vi.mock('./browser-session-ua-cdp-collector', () => ({ +vi.mock('../../browser-session-ua-cdp-collector', () => ({ waitForBrowserCdpEndpoint: vi.fn(async () => undefined) })) diff --git a/src/main/browser/popup-identity-electron-probe.ts b/src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.ts similarity index 95% rename from src/main/browser/popup-identity-electron-probe.ts rename to src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.ts index badc1c4400f..289fa486bca 100644 --- a/src/main/browser/popup-identity-electron-probe.ts +++ b/src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.ts @@ -6,8 +6,8 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { chromium } from 'playwright' import { build } from 'vite' -import { waitForBrowserCdpEndpoint } from './browser-session-ua-cdp-collector' -import { resolveElectronProbeLaunch } from './electron-probe-display-launch' +import { waitForBrowserCdpEndpoint } from '../../browser-session-ua-cdp-collector' +import { resolveElectronProbeLaunch } from '../../electron-probe-display-launch' export function createPopupIdentityProbeRoot(): string { return mkdtempSync(join(tmpdir(), 'orca-popup-identity-')) diff --git a/src/main/browser/popup-origin-bar-window.test.ts b/src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.test.ts similarity index 99% rename from src/main/browser/popup-origin-bar-window.test.ts rename to src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.test.ts index 38869d50057..025441cec2f 100644 --- a/src/main/browser/popup-origin-bar-window.test.ts +++ b/src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.test.ts @@ -122,11 +122,8 @@ vi.mock('electron', () => ({ WebContentsView: fakeElectron.FakeWebContentsView })) -import { - describePopupOrigin, - openPopupWithOriginBar, - POPUP_ORIGIN_BAR_HEIGHT -} from './popup-origin-bar-window' +import { describePopupOrigin } from './popup-origin-description' +import { openPopupWithOriginBar, POPUP_ORIGIN_BAR_HEIGHT } from './popup-origin-bar-window' const { createFakeWebContents, FakeWebContentsView, FakeBaseWindow } = fakeElectron diff --git a/src/main/browser/popup-origin-bar-window.ts b/src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.ts similarity index 98% rename from src/main/browser/popup-origin-bar-window.ts rename to src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.ts index fe6f116f68b..ec39bb41850 100644 --- a/src/main/browser/popup-origin-bar-window.ts +++ b/src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.ts @@ -1,12 +1,11 @@ import { BaseWindow, WebContentsView } from 'electron' -import { isBackgroundLaunch } from '../window/foreground-activation-policy' +import { isBackgroundLaunch } from '../../../window/foreground-activation-policy' import { discardBrowserPopupContents, prepareNativeBrowserPopup } from './browser-popup-native-window' import { MIN_POPUP_CONTENT_HEIGHT, MIN_POPUP_CONTENT_WIDTH } from './popup-window-minimum-size' import { describeCommittedPopupOrigin } from './popup-committed-origin' -export { describePopupOrigin } from './popup-origin-description' // Electron supplies an untyped webContents option; adopting it preserves OAuth opener/session state. export type PopupChildWindowOptions = Electron.BrowserWindowConstructorOptions & { diff --git a/src/main/browser/popup-origin-chrome-electron-fixture.ts b/src/main/browser/guest-lifecycle/popups/popup-origin-chrome-electron-fixture.ts similarity index 98% rename from src/main/browser/popup-origin-chrome-electron-fixture.ts rename to src/main/browser/guest-lifecycle/popups/popup-origin-chrome-electron-fixture.ts index 8d54d8f5c0f..56413d267cd 100644 --- a/src/main/browser/popup-origin-chrome-electron-fixture.ts +++ b/src/main/browser/guest-lifecycle/popups/popup-origin-chrome-electron-fixture.ts @@ -3,7 +3,7 @@ import { mkdirSync, writeFileSync } from 'node:fs' import { join } from 'node:path' import { openPopupWithOriginBar } from './popup-origin-bar-window' import { prepareNativeBrowserPopup } from './browser-popup-native-window' -import { applyBackgroundActivationPolicy } from '../window/foreground-activation-policy' +import { applyBackgroundActivationPolicy } from '../../../window/foreground-activation-policy' if (process.env.ORCA_BACKGROUND_LAUNCH !== '1') { throw new Error('Popup identity probes require a background launch') diff --git a/src/main/browser/popup-origin-chrome.electron.test.ts b/src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts similarity index 98% rename from src/main/browser/popup-origin-chrome.electron.test.ts rename to src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts index 4f0276da65e..66d42a880cf 100644 --- a/src/main/browser/popup-origin-chrome.electron.test.ts +++ b/src/main/browser/guest-lifecycle/popups/popup-origin-chrome.electron.test.ts @@ -11,7 +11,7 @@ import { import { HIDDEN_RENDERER_FIRST_FRAME_TIMEOUT_MS, startHiddenRendererFrameCapture -} from './hidden-renderer-frame-capture-fixture' +} from '../../hidden-renderer-frame-capture-fixture' type OriginProbeWindow = Window & { originProbeChild?: Window } @@ -118,7 +118,10 @@ beforeAll(async () => { origin = `http://127.0.0.1:${address.port}` await buildPopupIdentityProbe( root, - join(process.cwd(), 'src/main/browser/popup-origin-chrome-electron-fixture.ts'), + join( + process.cwd(), + 'src/main/browser/guest-lifecycle/popups/popup-origin-chrome-electron-fixture.ts' + ), 'main.cjs' ) probe = await launchPopupIdentityProbe(root, ['--js-flags=--expose-gc']) diff --git a/src/main/browser/popup-origin-description.ts b/src/main/browser/guest-lifecycle/popups/popup-origin-description.ts similarity index 100% rename from src/main/browser/popup-origin-description.ts rename to src/main/browser/guest-lifecycle/popups/popup-origin-description.ts diff --git a/src/main/browser/popup-window-minimum-size.ts b/src/main/browser/guest-lifecycle/popups/popup-window-minimum-size.ts similarity index 100% rename from src/main/browser/popup-window-minimum-size.ts rename to src/main/browser/guest-lifecycle/popups/popup-window-minimum-size.ts diff --git a/src/main/browser/browser-external-app-launch.test.ts b/src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.test.ts similarity index 98% rename from src/main/browser/browser-external-app-launch.test.ts rename to src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.test.ts index caacdc7545e..e094bfb0ca5 100644 --- a/src/main/browser/browser-external-app-launch.test.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.test.ts @@ -11,7 +11,7 @@ vi.mock('electron', () => ({ shell: { openExternal: mocks.openExternal } })) -import type { BrowserPagePromptRequest } from '../../shared/browser-page-prompt' +import type { BrowserPagePromptRequest } from '../../../../shared/browser-page-prompt' import { requestBrowserExternalAppLaunch } from './browser-external-app-launch' import { BROWSER_PAGE_PROMPT_TIMEOUT_MS, diff --git a/src/main/browser/browser-external-app-launch.ts b/src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.ts similarity index 94% rename from src/main/browser/browser-external-app-launch.ts rename to src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.ts index ca9a73c6808..a9928ad95f7 100644 --- a/src/main/browser/browser-external-app-launch.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-external-app-launch.ts @@ -1,7 +1,7 @@ import { app, shell } from 'electron' -import { DOC_PREVIEW_SCHEME } from '../../shared/doc-preview-scheme' -import { BROWSER_EXTENSION_API_SCHEME } from '../../shared/browser-extension-worker-api' +import { DOC_PREVIEW_SCHEME } from '../../../../shared/doc-preview-scheme' +import { BROWSER_EXTENSION_API_SCHEME } from '../../../../shared/browser-extension-worker-api' import { browserPagePromptOrigin, openBrowserPagePrompt, diff --git a/src/main/browser/browser-http-auth-prompt.test.ts b/src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.test.ts similarity index 97% rename from src/main/browser/browser-http-auth-prompt.test.ts rename to src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.test.ts index 51f416e3227..42883d0ed65 100644 --- a/src/main/browser/browser-http-auth-prompt.test.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.test.ts @@ -5,13 +5,13 @@ const mocks = vi.hoisted(() => ({ resolvePagePromptTarget: vi.fn() })) -vi.mock('./browser-manager', () => ({ +vi.mock('../../browser-manager', () => ({ browserManager: { resolvePagePromptTarget: mocks.resolvePagePromptTarget } })) -import type { BrowserPagePromptRequest } from '../../shared/browser-page-prompt' +import type { BrowserPagePromptRequest } from '../../../../shared/browser-page-prompt' import { handleBrowserGuestLogin } from './browser-http-auth-prompt' import { BROWSER_PAGE_PROMPT_TIMEOUT_MS, respondToBrowserPagePrompt } from './browser-page-prompts' diff --git a/src/main/browser/browser-http-auth-prompt.ts b/src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.ts similarity index 92% rename from src/main/browser/browser-http-auth-prompt.ts rename to src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.ts index 8cb4c76e7a3..3fb0fc86d34 100644 --- a/src/main/browser/browser-http-auth-prompt.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-http-auth-prompt.ts @@ -1,5 +1,5 @@ -import type { BrowserHttpAuthCredentials } from '../../shared/browser-http-auth' -import { browserManager } from './browser-manager' +import type { BrowserHttpAuthCredentials } from '../../../../shared/browser-http-auth' +import { browserManager } from '../../browser-manager' import { browserPagePromptOrigin, openBrowserPagePrompt } from './browser-page-prompts' function parseCredentials(value: unknown): BrowserHttpAuthCredentials | undefined { diff --git a/src/main/browser/browser-javascript-dialogs.test.ts b/src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.test.ts similarity index 98% rename from src/main/browser/browser-javascript-dialogs.test.ts rename to src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.test.ts index 268f850e48c..5604bf0e5fd 100644 --- a/src/main/browser/browser-javascript-dialogs.test.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.test.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'node:events' import { describe, expect, it, vi } from 'vitest' -import type { BrowserPagePromptRequest } from '../../shared/browser-page-prompt' +import type { BrowserPagePromptRequest } from '../../../../shared/browser-page-prompt' import { answerBrowserJavaScriptDialog, getBrowserJavaScriptDialog, diff --git a/src/main/browser/browser-javascript-dialogs.ts b/src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.ts similarity index 98% rename from src/main/browser/browser-javascript-dialogs.ts rename to src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.ts index 486f139fe95..193694faacf 100644 --- a/src/main/browser/browser-javascript-dialogs.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-javascript-dialogs.ts @@ -1,7 +1,7 @@ import type { BrowserJavaScriptDialog, BrowserJavaScriptDialogAnswer -} from '../../shared/browser-javascript-dialog' +} from '../../../../shared/browser-javascript-dialog' import { browserPagePromptOrigin, closeBrowserPagePrompts, diff --git a/src/main/browser/browser-page-prompt-quiet.ts b/src/main/browser/guest-lifecycle/prompts/browser-page-prompt-quiet.ts similarity index 93% rename from src/main/browser/browser-page-prompt-quiet.ts rename to src/main/browser/guest-lifecycle/prompts/browser-page-prompt-quiet.ts index db30b0bcb6c..311243a39c8 100644 --- a/src/main/browser/browser-page-prompt-quiet.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-page-prompt-quiet.ts @@ -1,4 +1,4 @@ -import { isActivatingBrowserGuestInput } from './browser-guest-input-gesture' +import { isActivatingBrowserGuestInput } from '../input/browser-guest-input-gesture' const quietContents = new Set() diff --git a/src/main/browser/browser-page-prompts.test.ts b/src/main/browser/guest-lifecycle/prompts/browser-page-prompts.test.ts similarity index 99% rename from src/main/browser/browser-page-prompts.test.ts rename to src/main/browser/guest-lifecycle/prompts/browser-page-prompts.test.ts index 05f81cf29d2..37cfc0336c1 100644 --- a/src/main/browser/browser-page-prompts.test.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-page-prompts.test.ts @@ -1,7 +1,7 @@ import { EventEmitter } from 'node:events' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { BrowserPagePromptRequest } from '../../shared/browser-page-prompt' +import type { BrowserPagePromptRequest } from '../../../../shared/browser-page-prompt' import { BROWSER_PAGE_PROMPT_TIMEOUT_MS, cancelBrowserPagePrompts, diff --git a/src/main/browser/browser-page-prompts.ts b/src/main/browser/guest-lifecycle/prompts/browser-page-prompts.ts similarity index 99% rename from src/main/browser/browser-page-prompts.ts rename to src/main/browser/guest-lifecycle/prompts/browser-page-prompts.ts index 334146bbae7..5a67b9f5be4 100644 --- a/src/main/browser/browser-page-prompts.ts +++ b/src/main/browser/guest-lifecycle/prompts/browser-page-prompts.ts @@ -6,7 +6,7 @@ import type { BrowserPagePromptKind, BrowserPagePromptResponse, BrowserPagePromptResult -} from '../../shared/browser-page-prompt' +} from '../../../../shared/browser-page-prompt' import { isBrowserPagePromptQuiet, quietBrowserPagePrompts } from './browser-page-prompt-quiet' export const BROWSER_PAGE_PROMPT_TIMEOUT_MS = 120_000 diff --git a/src/main/browser/browser-client-network-route-address.ts b/src/main/browser/network/client-routes/browser-client-network-route-address.ts similarity index 100% rename from src/main/browser/browser-client-network-route-address.ts rename to src/main/browser/network/client-routes/browser-client-network-route-address.ts diff --git a/src/main/browser/browser-client-network-route-recovery.ts b/src/main/browser/network/client-routes/browser-client-network-route-recovery.ts similarity index 93% rename from src/main/browser/browser-client-network-route-recovery.ts rename to src/main/browser/network/client-routes/browser-client-network-route-recovery.ts index 9931a0ebdff..3e12fd8a5f8 100644 --- a/src/main/browser/browser-client-network-route-recovery.ts +++ b/src/main/browser/network/client-routes/browser-client-network-route-recovery.ts @@ -1,4 +1,4 @@ -import { retryBrowserNetworkRouteReconnect } from './browser-network-route-reconnect-retry' +import { retryBrowserNetworkRouteReconnect } from '../execution-routes/browser-network-route-reconnect-retry' const MAX_CONCURRENT_ROUTE_RECONNECTS = 8 diff --git a/src/main/browser/browser-client-network-route-registry.test.ts b/src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts similarity index 98% rename from src/main/browser/browser-client-network-route-registry.test.ts rename to src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts index a56ebd7f3d7..6dbfa435b74 100644 --- a/src/main/browser/browser-client-network-route-registry.test.ts +++ b/src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts @@ -1,7 +1,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' -import type { BrowserHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import { browserNetworkExecutionHostStorageIdentity } from './browser-execution-host-storage-identity' -import { browserNetworkExecutionHostKey } from './browser-network-execution-route' +import type { BrowserHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import { browserNetworkExecutionHostStorageIdentity } from '../../routing/identity/browser-execution-host-storage-identity' +import { browserNetworkExecutionHostKey } from '../execution-routes/browser-network-execution-route' import { BrowserClientNetworkRouteRegistry } from './browser-client-network-route-registry' const authority: BrowserHostLeaseAuthority = { diff --git a/src/main/browser/browser-client-network-route-registry.ts b/src/main/browser/network/client-routes/browser-client-network-route-registry.ts similarity index 94% rename from src/main/browser/browser-client-network-route-registry.ts rename to src/main/browser/network/client-routes/browser-client-network-route-registry.ts index f5532976922..4f7e9ed5326 100644 --- a/src/main/browser/browser-client-network-route-registry.ts +++ b/src/main/browser/network/client-routes/browser-client-network-route-registry.ts @@ -1,6 +1,6 @@ -import type { BrowserHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' -import type { BrowserClientPageNetworkRoute } from './browser-client-page-cleanup' +import type { BrowserHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' +import type { BrowserClientPageNetworkRoute } from '../../client-pages/lifecycle/browser-client-page-cleanup' import { assertBrowserClientNetworkRouteAddress, sameBrowserClientNetworkRouteAddress @@ -9,10 +9,10 @@ import { reconnectBrowserClientNetworkRoutes } from './browser-client-network-ro import { browserNetworkExecutionHostStorageIdentity, legacyBrowserNetworkExecutionHostStorageIdentity -} from './browser-execution-host-storage-identity' +} from '../../routing/identity/browser-execution-host-storage-identity' import { createRouteRetirement, waitForRoute } from './browser-client-network-route-settlement' -import { resolveBrowserHostReconnectDelay } from './browser-host-lease-reconnect-delay' -import { parseBrowserNetworkExecutionHostKey } from './browser-network-execution-route' +import { resolveBrowserHostReconnectDelay } from '../../client-hosts/leases/browser-host-lease-reconnect-delay' +import { parseBrowserNetworkExecutionHostKey } from '../execution-routes/browser-network-execution-route' type BrowserClientNetworkRoute = { start(): Promise<{ host: string; port: number }> diff --git a/src/main/browser/browser-client-network-route-settlement.ts b/src/main/browser/network/client-routes/browser-client-network-route-settlement.ts similarity index 100% rename from src/main/browser/browser-client-network-route-settlement.ts rename to src/main/browser/network/client-routes/browser-client-network-route-settlement.ts diff --git a/src/main/browser/browser-route-egress-electron-launch.ts b/src/main/browser/network/egress/browser-route-egress-electron-launch.ts similarity index 97% rename from src/main/browser/browser-route-egress-electron-launch.ts rename to src/main/browser/network/egress/browser-route-egress-electron-launch.ts index 0afb86f20f6..d3c2412f6dd 100644 --- a/src/main/browser/browser-route-egress-electron-launch.ts +++ b/src/main/browser/network/egress/browser-route-egress-electron-launch.ts @@ -2,7 +2,7 @@ import { spawn, spawnSync, type ChildProcess } from 'node:child_process' import { existsSync, readFileSync } from 'node:fs' import { createRequire } from 'node:module' import { join } from 'node:path' -import { resolveElectronProbeLaunch } from './electron-probe-display-launch' +import { resolveElectronProbeLaunch } from '../../electron-probe-display-launch' const electronBinary = createRequire(import.meta.url)('electron') as string diff --git a/src/main/browser/browser-route-webrtc-egress.electron.test.ts b/src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts similarity index 98% rename from src/main/browser/browser-route-webrtc-egress.electron.test.ts rename to src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts index 1dc9b5ac9a1..f80b5d9a3a7 100644 --- a/src/main/browser/browser-route-webrtc-egress.electron.test.ts +++ b/src/main/browser/network/egress/browser-route-webrtc-egress.electron.test.ts @@ -4,7 +4,7 @@ import { createRequire } from 'node:module' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterAll, describe, expect, it } from 'vitest' -import { resolveElectronProbeLaunch } from './electron-probe-display-launch' +import { resolveElectronProbeLaunch } from '../../electron-probe-display-launch' const electronBinary = createRequire(import.meta.url)('electron') as string const fixtureRoots: string[] = [] diff --git a/src/main/browser/browser-route-webrtc-policy.ts b/src/main/browser/network/egress/browser-route-webrtc-policy.ts similarity index 76% rename from src/main/browser/browser-route-webrtc-policy.ts rename to src/main/browser/network/egress/browser-route-webrtc-policy.ts index b334be3d810..04967856392 100644 --- a/src/main/browser/browser-route-webrtc-policy.ts +++ b/src/main/browser/network/egress/browser-route-webrtc-policy.ts @@ -1,5 +1,8 @@ import type { WebContents } from 'electron' -import { closeRouteGuest, isRouteGuestDestroyed } from './browser-route-guest-guard' +import { + closeRouteGuest, + isRouteGuestDestroyed +} from '../../routing/guest-authority/browser-route-guest-guard' export function enforceBrowserRouteWebRtcPolicy( guest: WebContents, diff --git a/src/main/browser/browser-network-deferred-socket.test.ts b/src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts similarity index 100% rename from src/main/browser/browser-network-deferred-socket.test.ts rename to src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts diff --git a/src/main/browser/browser-network-deferred-socket.ts b/src/main/browser/network/execution-routes/browser-network-deferred-socket.ts similarity index 96% rename from src/main/browser/browser-network-deferred-socket.ts rename to src/main/browser/network/execution-routes/browser-network-deferred-socket.ts index 121195c2f73..995ad9ec711 100644 --- a/src/main/browser/browser-network-deferred-socket.ts +++ b/src/main/browser/network/execution-routes/browser-network-deferred-socket.ts @@ -1,6 +1,6 @@ import { EventEmitter } from 'node:events' import type { Duplex } from 'node:stream' -import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' +import type { BrowserNetworkTunnelSocket } from '../tunnels/browser-network-tunnel-stream-state' type DeferredSocketSource = Duplex & { setNoDelay?: (noDelay?: boolean) => unknown diff --git a/src/main/browser/browser-network-execution-route-dispatch.ts b/src/main/browser/network/execution-routes/browser-network-execution-route-dispatch.ts similarity index 91% rename from src/main/browser/browser-network-execution-route-dispatch.ts rename to src/main/browser/network/execution-routes/browser-network-execution-route-dispatch.ts index 33b71a3f500..0b384b038ee 100644 --- a/src/main/browser/browser-network-execution-route-dispatch.ts +++ b/src/main/browser/network/execution-routes/browser-network-execution-route-dispatch.ts @@ -15,8 +15,8 @@ export const resolveBrowserNetworkExecutionRoute: BrowserNetworkExecutionRouteRe return wslRoute.resolveWslBrowserNetworkExecutionRoute(context) } const [{ getSshConnectionManager }, authority, sshRoute] = await Promise.all([ - import('../ssh/targets/ssh-target-registry'), - import('../ssh/ssh-provider-authority'), + import('../../../ssh/targets/ssh-target-registry'), + import('../../../ssh/ssh-provider-authority'), import('./ssh-browser-network-execution-route') ]) const connectionManager = getSshConnectionManager() diff --git a/src/main/browser/browser-network-execution-route.test.ts b/src/main/browser/network/execution-routes/browser-network-execution-route.test.ts similarity index 100% rename from src/main/browser/browser-network-execution-route.test.ts rename to src/main/browser/network/execution-routes/browser-network-execution-route.test.ts diff --git a/src/main/browser/browser-network-execution-route.ts b/src/main/browser/network/execution-routes/browser-network-execution-route.ts similarity index 90% rename from src/main/browser/browser-network-execution-route.ts rename to src/main/browser/network/execution-routes/browser-network-execution-route.ts index 9322a18c601..eb2139a7306 100644 --- a/src/main/browser/browser-network-execution-route.ts +++ b/src/main/browser/network/execution-routes/browser-network-execution-route.ts @@ -1,13 +1,13 @@ import { connect, type Socket } from 'node:net' -import { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' -import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' +import { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' +import type { BrowserNetworkTunnelSocket } from '../tunnels/browser-network-tunnel-stream-state' import { readNetworkProxySettings } from './browser-network-proxy-settings-source' -import { selectBrowserNetworkTunnelProxy } from './browser-network-tunnel-proxy-selection' +import { selectBrowserNetworkTunnelProxy } from '../tunnels/browser-network-tunnel-proxy-selection' import { connectThroughBrowserNetworkTunnelProxy, type BrowserNetworkTunnelDialer -} from './browser-network-tunnel-proxy-connect' +} from '../tunnels/browser-network-tunnel-proxy-connect' export type BrowserNetworkExecutionRoute = { key: string diff --git a/src/main/browser/browser-network-proxy-settings-source.ts b/src/main/browser/network/execution-routes/browser-network-proxy-settings-source.ts similarity index 85% rename from src/main/browser/browser-network-proxy-settings-source.ts rename to src/main/browser/network/execution-routes/browser-network-proxy-settings-source.ts index 11ddb783107..7a02f7f10e0 100644 --- a/src/main/browser/browser-network-proxy-settings-source.ts +++ b/src/main/browser/network/execution-routes/browser-network-proxy-settings-source.ts @@ -1,4 +1,4 @@ -import type { NetworkProxySettings } from '../../shared/network-proxy' +import type { NetworkProxySettings } from '../../../../shared/network-proxy' // Tunnel hosts share this source without importing Electron into the plain-Node runtime. let resolveNetworkProxySettings: (() => NetworkProxySettings) | null = null diff --git a/src/main/browser/browser-network-route-reconnect-retry.ts b/src/main/browser/network/execution-routes/browser-network-route-reconnect-retry.ts similarity index 95% rename from src/main/browser/browser-network-route-reconnect-retry.ts rename to src/main/browser/network/execution-routes/browser-network-route-reconnect-retry.ts index b69de71fd8d..418cf84362c 100644 --- a/src/main/browser/browser-network-route-reconnect-retry.ts +++ b/src/main/browser/network/execution-routes/browser-network-route-reconnect-retry.ts @@ -1,7 +1,7 @@ import { BrowserHostReconnectDelay, nextBrowserHostReconnectDelay -} from './browser-host-lease-reconnect-delay' +} from '../../client-hosts/leases/browser-host-lease-reconnect-delay' export type BrowserNetworkRouteAddress = { host: string; port: number } diff --git a/src/main/browser/paired-runtime-browser-network-route.test.ts b/src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts similarity index 97% rename from src/main/browser/paired-runtime-browser-network-route.test.ts rename to src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts index d0a2625edd4..6f43272a4ca 100644 --- a/src/main/browser/paired-runtime-browser-network-route.test.ts +++ b/src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts @@ -1,4 +1,4 @@ -import { pairedRuntimeConnectionFromOffer } from '../../shared/paired-runtime-connection' +import { pairedRuntimeConnectionFromOffer } from '../../../../shared/paired-runtime-connection' import { once } from 'node:events' import { connect, type Socket } from 'node:net' import { afterEach, describe, expect, it, vi, type Mock } from 'vitest' @@ -6,26 +6,26 @@ import { BrowserNetworkTunnelOpcode, decodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' -import type { PairingOffer } from '../../shared/pairing' +} from '../../../../shared/browser-network-tunnel-protocol' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' +import type { PairingOffer } from '../../../../shared/mobile-relay-pairing-offer' import type { RemoteRuntimeSubscription, RemoteRuntimeSubscriptionCallbacks -} from '../../shared/remote-runtime/remote-runtime-client' -import type { RemoteRuntimeSubscriptionOptions } from '../../shared/remote-runtime/requests/remote-runtime-subscription-contract' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import type { RemoteRuntimeSubscriptionOptions } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() })) -vi.mock('../../shared/remote-runtime/remote-runtime-client', () => ({ +vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock })) import { PairedRuntimeBrowserNetworkRoute } from './paired-runtime-browser-network-route' -import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from './browser-network-tunnel-outbound-memory-budget' -import { RemoteBrowserSocksServer } from './remote-browser-socks-server' +import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from '../tunnels/browser-network-tunnel-outbound-memory-budget' +import { RemoteBrowserSocksServer } from '../tunnels/remote-browser-socks-server' const pairing = { v: 2, diff --git a/src/main/browser/paired-runtime-browser-network-route.ts b/src/main/browser/network/execution-routes/paired-runtime-browser-network-route.ts similarity index 93% rename from src/main/browser/paired-runtime-browser-network-route.ts rename to src/main/browser/network/execution-routes/paired-runtime-browser-network-route.ts index af7c5b3dd75..8dabe380cd9 100644 --- a/src/main/browser/paired-runtime-browser-network-route.ts +++ b/src/main/browser/network/execution-routes/paired-runtime-browser-network-route.ts @@ -1,16 +1,16 @@ -import type { BrowserHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' -import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection' -import type { RemoteRuntimeSubscriptionOptions } from '../../shared/remote-runtime/requests/remote-runtime-subscription-contract' -import { resolveBrowserHostReconnectDelay } from './browser-host-lease-reconnect-delay' +import type { BrowserHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' +import type { PairedRuntimeConnection } from '../../../../shared/paired-runtime-connection' +import type { RemoteRuntimeSubscriptionOptions } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' +import { resolveBrowserHostReconnectDelay } from '../../client-hosts/leases/browser-host-lease-reconnect-delay' import { retryBrowserNetworkRouteReconnect } from './browser-network-route-reconnect-retry' import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry, type BrowserNetworkTunnelOutboundMemoryLease -} from './browser-network-tunnel-outbound-memory-budget' +} from '../tunnels/browser-network-tunnel-outbound-memory-budget' import { PairedRuntimeBrowserNetworkTransport } from './paired-runtime-browser-network-transport' -import { RemoteBrowserSocksServer } from './remote-browser-socks-server' +import { RemoteBrowserSocksServer } from '../tunnels/remote-browser-socks-server' const outboundMemoryBudgets = new BrowserNetworkTunnelOutboundMemoryBudgetRegistry() diff --git a/src/main/browser/paired-runtime-browser-network-transport.ts b/src/main/browser/network/execution-routes/paired-runtime-browser-network-transport.ts similarity index 90% rename from src/main/browser/paired-runtime-browser-network-transport.ts rename to src/main/browser/network/execution-routes/paired-runtime-browser-network-transport.ts index 66fe4c2c9ff..abdd0fad1ee 100644 --- a/src/main/browser/paired-runtime-browser-network-transport.ts +++ b/src/main/browser/network/execution-routes/paired-runtime-browser-network-transport.ts @@ -1,22 +1,22 @@ import { BrowserNetworkTunnelEvent, type BrowserHostLeaseAuthority -} from '../../shared/browser-client-host-protocol' -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' -import type { PairedRuntimeConnection } from '../../shared/paired-runtime-connection' +} from '../../../../shared/browser-client-host-protocol' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' +import type { PairedRuntimeConnection } from '../../../../shared/paired-runtime-connection' import { subscribeRemoteRuntimeRequest, type RemoteRuntimeSubscription -} from '../../shared/remote-runtime/remote-runtime-client' -import type { RemoteRuntimeSubscriptionOptions } from '../../shared/remote-runtime/requests/remote-runtime-subscription-contract' -import { RemoteRuntimeClientError } from '../../shared/remote-runtime/remote-runtime-client-error' +} from '../../../../shared/remote-runtime/remote-runtime-client' +import type { RemoteRuntimeSubscriptionOptions } from '../../../../shared/remote-runtime/requests/remote-runtime-subscription-contract' +import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, BROWSER_NETWORK_EXECUTION_HOSTS_RUNTIME_CAPABILITY, BROWSER_NETWORK_TUNNEL_RUNTIME_CAPABILITY -} from '../../shared/protocol-version' -import { BrowserNetworkTunnelClient } from './browser-network-tunnel-client' -import type { BrowserNetworkTunnelOutboundMemoryLease } from './browser-network-tunnel-outbound-memory-budget' +} from '../../../../shared/browser-runtime-capabilities' +import { BrowserNetworkTunnelClient } from '../tunnels/browser-network-tunnel-client' +import type { BrowserNetworkTunnelOutboundMemoryLease } from '../tunnels/browser-network-tunnel-outbound-memory-budget' const BROWSER_TUNNEL_WS_SOFT_CAP_BYTES = 1024 * 1024 const BROWSER_TUNNEL_WS_MAX_QUEUED_BYTES = 7 * 1024 * 1024 diff --git a/src/main/browser/ssh-browser-network-execution-route.test.ts b/src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts similarity index 98% rename from src/main/browser/ssh-browser-network-execution-route.test.ts rename to src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts index 9b5c8473e2a..a2ba110b761 100644 --- a/src/main/browser/ssh-browser-network-execution-route.test.ts +++ b/src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts @@ -3,12 +3,12 @@ import type { ChildProcess } from 'node:child_process' import { connect, createServer, type AddressInfo, type Socket } from 'node:net' import { PassThrough } from 'node:stream' import { afterEach, describe, expect, it, vi } from 'vitest' -import type { SshConnection } from '../ssh/connection/ssh-connection' -import type { SshProviderEpoch } from '../../shared/ssh-types' +import type { SshConnection } from '../../../ssh/connection/ssh-connection' +import type { SshProviderEpoch } from '../../../../shared/ssh-types' import { resolveSshBrowserNetworkExecutionRoute } from './ssh-browser-network-execution-route' import { setNetworkProxySettingsSource } from './browser-network-proxy-settings-source' -import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' -import { RemoteBrowserSocksServer } from './remote-browser-socks-server' +import type { BrowserNetworkTunnelSocket } from '../tunnels/browser-network-tunnel-stream-state' +import { RemoteBrowserSocksServer } from '../tunnels/remote-browser-socks-server' const executionHost = { kind: 'ssh' as const, diff --git a/src/main/browser/ssh-browser-network-execution-route.ts b/src/main/browser/network/execution-routes/ssh-browser-network-execution-route.ts similarity index 92% rename from src/main/browser/ssh-browser-network-execution-route.ts rename to src/main/browser/network/execution-routes/ssh-browser-network-execution-route.ts index a3ad1c1a859..386cc91b4ac 100644 --- a/src/main/browser/ssh-browser-network-execution-route.ts +++ b/src/main/browser/network/execution-routes/ssh-browser-network-execution-route.ts @@ -1,16 +1,16 @@ -import type { DirectSshAuthority, SshProviderEpoch } from '../../shared/ssh-types' -import type { SshConnection } from '../ssh/connection/ssh-connection' -import type { SshConnectionManager } from '../ssh/connection/ssh-connection-manager' +import type { DirectSshAuthority, SshProviderEpoch } from '../../../../shared/ssh-types' +import type { SshConnection } from '../../../ssh/connection/ssh-connection' +import type { SshConnectionManager } from '../../../ssh/connection/ssh-connection-manager' import type { Client as SshClient, ClientChannel } from 'ssh2' -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' import { loadHostProxyEnvironment, readSshHostProxyEnvironment -} from '../ssh/ssh-host-proxy-environment' +} from '../../../ssh/ssh-host-proxy-environment' import { startSystemSshDynamicForwardProcess, type SystemSshDynamicForwardProcess -} from '../ssh/system-transport/system-ssh-dynamic-forward-process' +} from '../../../ssh/system-transport/system-ssh-dynamic-forward-process' import { BrowserNetworkDeferredSocket } from './browser-network-deferred-socket' import { browserNetworkExecutionHostKey, @@ -21,14 +21,14 @@ import { import { connectThroughBrowserNetworkTunnelProxy, type BrowserNetworkTunnelDialer -} from './browser-network-tunnel-proxy-connect' +} from '../tunnels/browser-network-tunnel-proxy-connect' import { selectBrowserNetworkTunnelProxy, type BrowserNetworkTunnelProxy -} from './browser-network-tunnel-proxy-selection' -import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' -import { openExecutionRouteSocketAsDuplex } from './execution-route-socket-duplex' -import { SystemSshSocksClientSocket } from './system-ssh-socks-client-socket' +} from '../tunnels/browser-network-tunnel-proxy-selection' +import type { BrowserNetworkTunnelSocket } from '../tunnels/browser-network-tunnel-stream-state' +import { openExecutionRouteSocketAsDuplex } from '../tunnels/execution-route-socket-duplex' +import { SystemSshSocksClientSocket } from '../tunnels/system-ssh-socks-client-socket' export type SshBrowserNetworkExecutionRouteDependencies = { connectionManager: Pick diff --git a/src/main/browser/wsl-browser-network-execution-route.test.ts b/src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts similarity index 96% rename from src/main/browser/wsl-browser-network-execution-route.test.ts rename to src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts index 77a19f7aff4..a9050389bad 100644 --- a/src/main/browser/wsl-browser-network-execution-route.test.ts +++ b/src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts @@ -2,18 +2,18 @@ import { EventEmitter, once } from 'node:events' import { PassThrough, Writable } from 'node:stream' import type { ChildProcessWithoutNullStreams } from 'node:child_process' import { describe, expect, it, vi } from 'vitest' -import { BrowserNetworkTunnelClient } from './browser-network-tunnel-client' -import type { BrowserNetworkTunnelDuplex } from './browser-network-tunnel-duplex' -import { BrowserNetworkTunnelSession } from './browser-network-tunnel-session' +import { BrowserNetworkTunnelClient } from '../tunnels/browser-network-tunnel-client' +import type { BrowserNetworkTunnelDuplex } from '../tunnels/browser-network-tunnel-duplex' +import { BrowserNetworkTunnelSession } from '../tunnels/browser-network-tunnel-session' import { BROWSER_NETWORK_TUNNEL_INITIAL_WINDOW_BYTES, type BrowserNetworkTunnelSocket -} from './browser-network-tunnel-stream-state' +} from '../tunnels/browser-network-tunnel-stream-state' import type { BrowserNetworkExecutionRoute } from './browser-network-execution-route' import { BrowserNetworkTunnelStreamFrameDecoder, BrowserNetworkTunnelStreamFrameWriter -} from '../../shared/browser-network-tunnel-stream-framing' +} from '../../../../shared/browser-network-tunnel-stream-framing' import { resolveWslBrowserNetworkExecutionRoute } from './wsl-browser-network-execution-route' class FakeDestination extends EventEmitter implements BrowserNetworkTunnelSocket { diff --git a/src/main/browser/wsl-browser-network-execution-route.ts b/src/main/browser/network/execution-routes/wsl-browser-network-execution-route.ts similarity index 96% rename from src/main/browser/wsl-browser-network-execution-route.ts rename to src/main/browser/network/execution-routes/wsl-browser-network-execution-route.ts index cea2e30eaa9..f07db699663 100644 --- a/src/main/browser/wsl-browser-network-execution-route.ts +++ b/src/main/browser/network/execution-routes/wsl-browser-network-execution-route.ts @@ -2,9 +2,9 @@ import type { WslBrowserNetworkRelayChild } from './wsl-browser-network-relay-la import { BrowserNetworkTunnelStreamFrameDecoder, BrowserNetworkTunnelStreamFrameWriter -} from '../../shared/browser-network-tunnel-stream-framing' +} from '../../../../shared/browser-network-tunnel-stream-framing' import { BrowserNetworkDeferredSocket } from './browser-network-deferred-socket' -import { BrowserNetworkTunnelClient } from './browser-network-tunnel-client' +import { BrowserNetworkTunnelClient } from '../tunnels/browser-network-tunnel-client' import { browserNetworkExecutionHostKey, type BrowserNetworkExecutionRoute, diff --git a/src/main/browser/wsl-browser-network-relay-launch.test.ts b/src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.test.ts similarity index 100% rename from src/main/browser/wsl-browser-network-relay-launch.test.ts rename to src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.test.ts diff --git a/src/main/browser/wsl-browser-network-relay-launch.ts b/src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.ts similarity index 95% rename from src/main/browser/wsl-browser-network-relay-launch.ts rename to src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.ts index e57d337bf3b..9313f921f63 100644 --- a/src/main/browser/wsl-browser-network-relay-launch.ts +++ b/src/main/browser/network/execution-routes/wsl-browser-network-relay-launch.ts @@ -1,9 +1,9 @@ import { spawnProcess } from '@orca/process-host' import { existsSync, readFileSync } from 'node:fs' import { join } from 'node:path' -import { relayBundleCandidates } from '../ssh/relay-bundle-paths' -import { withWslGuestLauncherRevision } from '../wsl/execution/wsl-guest-launcher-revision' -import { orcadPosixNodeRuntimeGlobs } from '../managed-server/install/orcad-node-runtime-globs' +import { relayBundleCandidates } from '../../../ssh/relay-bundle-paths' +import { withWslGuestLauncherRevision } from '../../../wsl/execution/wsl-guest-launcher-revision' +import { orcadPosixNodeRuntimeGlobs } from '../../../managed-server/install/orcad-node-runtime-globs' import { WSL_BROWSER_NETWORK_RELAY_BUNDLE_NAME, WSL_BROWSER_NETWORK_RELAY_DIR, @@ -11,7 +11,7 @@ import { WSL_BROWSER_NETWORK_RELAY_SENTINEL, WSL_BROWSER_NETWORK_RELAY_STALE_EXIT_CODE, WSL_BROWSER_NETWORK_RELAY_VERSION_FILE -} from '../../shared/wsl-browser-network-relay-contract' +} from '../../../../shared/wsl-browser-network-relay-contract' const STARTUP_TIMEOUT_MS = 10_000 const INSTALL_TIMEOUT_MS = 30_000 diff --git a/src/main/browser/browser-network-tunnel-client-frame-dispatch.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client-frame-dispatch.ts similarity index 95% rename from src/main/browser/browser-network-tunnel-client-frame-dispatch.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client-frame-dispatch.ts index 09be5f03acc..6142596021c 100644 --- a/src/main/browser/browser-network-tunnel-client-frame-dispatch.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-client-frame-dispatch.ts @@ -1,7 +1,7 @@ import { BrowserNetworkTunnelOpcode, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' type BrowserNetworkTunnelClientFrameActions = { opened: () => void diff --git a/src/main/browser/browser-network-tunnel-client-memory-budget.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts similarity index 98% rename from src/main/browser/browser-network-tunnel-client-memory-budget.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts index ac775f12920..fe4d3eb9774 100644 --- a/src/main/browser/browser-network-tunnel-client-memory-budget.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts @@ -5,7 +5,7 @@ import { decodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelWindowUpdate -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BrowserNetworkTunnelClient } from './browser-network-tunnel-client' import type { BrowserNetworkTunnelDuplex } from './browser-network-tunnel-duplex' import { diff --git a/src/main/browser/browser-network-tunnel-client-retirement.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client-retirement.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-client-retirement.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client-retirement.ts diff --git a/src/main/browser/browser-network-tunnel-client-stream-frames.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client-stream-frames.ts similarity index 98% rename from src/main/browser/browser-network-tunnel-client-stream-frames.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client-stream-frames.ts index ad1a99870cf..77c522af1f7 100644 --- a/src/main/browser/browser-network-tunnel-client-stream-frames.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-client-stream-frames.ts @@ -3,7 +3,7 @@ import { decodeBrowserNetworkTunnelWindowUpdate, encodeBrowserNetworkTunnelWindowUpdate, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { dispatchBrowserNetworkTunnelClientFrame } from './browser-network-tunnel-client-frame-dispatch' import type { BrowserNetworkTunnelClientStream } from './browser-network-tunnel-client-stream' import { diff --git a/src/main/browser/browser-network-tunnel-client-stream.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client-stream.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-client-stream.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client-stream.ts diff --git a/src/main/browser/browser-network-tunnel-client.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts similarity index 99% rename from src/main/browser/browser-network-tunnel-client.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts index 8ce720b94df..d19e71ac5ef 100644 --- a/src/main/browser/browser-network-tunnel-client.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts @@ -9,7 +9,7 @@ import { encodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelWindowUpdate, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BROWSER_NETWORK_TUNNEL_CONNECT_TIMEOUT_MS, BROWSER_NETWORK_TUNNEL_INITIAL_WINDOW_BYTES diff --git a/src/main/browser/browser-network-tunnel-client.ts b/src/main/browser/network/tunnels/browser-network-tunnel-client.ts similarity index 99% rename from src/main/browser/browser-network-tunnel-client.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-client.ts index 236cdd0471c..c0958653d97 100644 --- a/src/main/browser/browser-network-tunnel-client.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-client.ts @@ -5,7 +5,7 @@ import { encodeBrowserNetworkTunnelWindowUpdate, type BrowserNetworkTunnelFrame, type BrowserNetworkTunnelOpen -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BrowserNetworkTunnelFrameSender } from './browser-network-tunnel-frame-sender' import { handleBrowserNetworkTunnelHeartbeat } from './browser-network-tunnel-heartbeat' import type { BrowserNetworkTunnelOutboundMemoryLease } from './browser-network-tunnel-outbound-memory-budget' diff --git a/src/main/browser/browser-network-tunnel-conformance.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-conformance.test.ts similarity index 99% rename from src/main/browser/browser-network-tunnel-conformance.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-conformance.test.ts index efb3b644045..d2a05e1c8b6 100644 --- a/src/main/browser/browser-network-tunnel-conformance.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-conformance.test.ts @@ -5,7 +5,7 @@ import { decodeBrowserNetworkTunnelFrame, decodeBrowserNetworkTunnelWindowUpdate, encodeBrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BrowserNetworkTunnelClient } from './browser-network-tunnel-client' import type { BrowserNetworkTunnelDuplex } from './browser-network-tunnel-duplex' import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from './browser-network-tunnel-outbound-memory-budget' diff --git a/src/main/browser/browser-network-tunnel-destination-flow.ts b/src/main/browser/network/tunnels/browser-network-tunnel-destination-flow.ts similarity index 98% rename from src/main/browser/browser-network-tunnel-destination-flow.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-destination-flow.ts index 7b11b4c972d..f129e4f2355 100644 --- a/src/main/browser/browser-network-tunnel-destination-flow.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-destination-flow.ts @@ -1,7 +1,7 @@ import { BROWSER_NETWORK_TUNNEL_MAX_DATA_BYTES, decodeBrowserNetworkTunnelWindowUpdate -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BROWSER_NETWORK_TUNNEL_INITIAL_WINDOW_BYTES, BROWSER_NETWORK_TUNNEL_MAX_PENDING_SOCKET_BYTES, diff --git a/src/main/browser/browser-network-tunnel-duplex.ts b/src/main/browser/network/tunnels/browser-network-tunnel-duplex.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-duplex.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-duplex.ts diff --git a/src/main/browser/browser-network-tunnel-frame-sender.ts b/src/main/browser/network/tunnels/browser-network-tunnel-frame-sender.ts similarity index 95% rename from src/main/browser/browser-network-tunnel-frame-sender.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-frame-sender.ts index 8a39429efaa..373463e280e 100644 --- a/src/main/browser/browser-network-tunnel-frame-sender.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-frame-sender.ts @@ -2,7 +2,7 @@ import { BrowserNetworkTunnelOpcode, encodeBrowserNetworkTunnelFrame, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import type { BrowserNetworkTunnelSessionOptions } from './browser-network-tunnel-stream-state' export function sendBrowserNetworkTunnelFrame( diff --git a/src/main/browser/browser-network-tunnel-heartbeat.ts b/src/main/browser/network/tunnels/browser-network-tunnel-heartbeat.ts similarity index 90% rename from src/main/browser/browser-network-tunnel-heartbeat.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-heartbeat.ts index 05c945d8431..46a3f1453bd 100644 --- a/src/main/browser/browser-network-tunnel-heartbeat.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-heartbeat.ts @@ -1,7 +1,7 @@ import { BrowserNetworkTunnelOpcode, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import type { BrowserNetworkTunnelFrameSender } from './browser-network-tunnel-frame-sender' export function handleBrowserNetworkTunnelHeartbeat( diff --git a/src/main/browser/browser-network-tunnel-open-admission.ts b/src/main/browser/network/tunnels/browser-network-tunnel-open-admission.ts similarity index 97% rename from src/main/browser/browser-network-tunnel-open-admission.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-open-admission.ts index 06a2c738291..d65cf1bd6d4 100644 --- a/src/main/browser/browser-network-tunnel-open-admission.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-open-admission.ts @@ -1,7 +1,7 @@ import { decodeBrowserNetworkTunnelOpen, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import type { BrowserNetworkTunnelResourceBudget } from './browser-network-tunnel-resource-budget' import { createBrowserNetworkTunnelStream } from './browser-network-tunnel-stream-lifecycle' import { diff --git a/src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-outbound-memory-budget.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts diff --git a/src/main/browser/browser-network-tunnel-outbound-memory-budget.ts b/src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-outbound-memory-budget.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.ts diff --git a/src/main/browser/browser-network-tunnel-proxy-connect.ts b/src/main/browser/network/tunnels/browser-network-tunnel-proxy-connect.ts similarity index 95% rename from src/main/browser/browser-network-tunnel-proxy-connect.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-proxy-connect.ts index 43e7753f3fd..eac9d32c3cf 100644 --- a/src/main/browser/browser-network-tunnel-proxy-connect.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-proxy-connect.ts @@ -1,4 +1,4 @@ -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' import type { BrowserNetworkTunnelProxy } from './browser-network-tunnel-proxy-selection' import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' import { HttpConnectTunnelSocket } from './http-connect-tunnel-socket' diff --git a/src/main/browser/browser-network-tunnel-proxy-dial-error.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-proxy-dial-error.test.ts similarity index 92% rename from src/main/browser/browser-network-tunnel-proxy-dial-error.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-proxy-dial-error.test.ts index 5f1954006a2..3d1424ee6e0 100644 --- a/src/main/browser/browser-network-tunnel-proxy-dial-error.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-proxy-dial-error.test.ts @@ -1,7 +1,7 @@ import { Socket } from 'node:net' import * as net from 'node:net' import { describe, expect, it, vi } from 'vitest' -import { connectNativeBrowserNetworkTarget } from './browser-network-execution-route' +import { connectNativeBrowserNetworkTarget } from '../execution-routes/browser-network-execution-route' vi.mock('node:net', async (importOriginal) => { const actual = await importOriginal() diff --git a/src/main/browser/browser-network-tunnel-proxy-selection.ts b/src/main/browser/network/tunnels/browser-network-tunnel-proxy-selection.ts similarity index 96% rename from src/main/browser/browser-network-tunnel-proxy-selection.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-proxy-selection.ts index 843707319c1..3d70ccbb753 100644 --- a/src/main/browser/browser-network-tunnel-proxy-selection.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-proxy-selection.ts @@ -5,9 +5,9 @@ import { normalizeProxyBypassRules, normalizeProxyUrl, type NetworkProxySettings -} from '../../shared/network-proxy' -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' -import { isEligibleLocalCertificateHost } from '../../shared/browser-url' +} from '../../../../shared/network-proxy' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' +import { isEligibleLocalCertificateHost } from '../../../../shared/browser-url' export type BrowserNetworkTunnelProxy = | { kind: 'direct' } diff --git a/src/main/browser/browser-network-tunnel-proxy.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-proxy.test.ts similarity index 98% rename from src/main/browser/browser-network-tunnel-proxy.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-proxy.test.ts index 860ad0f9420..fbcd84266b7 100644 --- a/src/main/browser/browser-network-tunnel-proxy.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-proxy.test.ts @@ -4,8 +4,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import { connectNativeBrowserNetworkTarget, resolveNativeBrowserNetworkExecutionRoute -} from './browser-network-execution-route' -import { setNetworkProxySettingsSource } from './browser-network-proxy-settings-source' +} from '../execution-routes/browser-network-execution-route' +import { setNetworkProxySettingsSource } from '../execution-routes/browser-network-proxy-settings-source' import { matchesProxyBypassRules, selectBrowserNetworkTunnelProxy diff --git a/src/main/browser/browser-network-tunnel-resource-budget.ts b/src/main/browser/network/tunnels/browser-network-tunnel-resource-budget.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-resource-budget.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-resource-budget.ts diff --git a/src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts similarity index 98% rename from src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts index 52ec9e35bdb..70cccdfeb4d 100644 --- a/src/main/browser/browser-network-tunnel-session-aggregate-memory.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts @@ -4,7 +4,7 @@ import { BrowserNetworkTunnelOpcode, encodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelOpen -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from './browser-network-tunnel-outbound-memory-budget' import { BrowserNetworkTunnelSession } from './browser-network-tunnel-session' import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' diff --git a/src/main/browser/browser-network-tunnel-session-stream-scoped-failure.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-session-stream-scoped-failure.test.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-session-stream-scoped-failure.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-session-stream-scoped-failure.test.ts diff --git a/src/main/browser/browser-network-tunnel-session.test.ts b/src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts similarity index 99% rename from src/main/browser/browser-network-tunnel-session.test.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts index 1478506232b..533582631d2 100644 --- a/src/main/browser/browser-network-tunnel-session.test.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts @@ -8,7 +8,7 @@ import { encodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelOpen, encodeBrowserNetworkTunnelWindowUpdate -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { BROWSER_NETWORK_TUNNEL_INITIAL_WINDOW_BYTES, type BrowserNetworkTunnelSocket diff --git a/src/main/browser/browser-network-tunnel-session.ts b/src/main/browser/network/tunnels/browser-network-tunnel-session.ts similarity index 99% rename from src/main/browser/browser-network-tunnel-session.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-session.ts index b737be993d8..30dfdffc3cd 100644 --- a/src/main/browser/browser-network-tunnel-session.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-session.ts @@ -3,7 +3,7 @@ import { decodeBrowserNetworkTunnelFrame, encodeBrowserNetworkTunnelWindowUpdate, type BrowserNetworkTunnelFrame -} from '../../shared/browser-network-tunnel-protocol' +} from '../../../../shared/browser-network-tunnel-protocol' import { admitBrowserNetworkTunnelOpen } from './browser-network-tunnel-open-admission' import { BROWSER_NETWORK_TUNNEL_ROUTE_BUFFER_OVERFLOW, diff --git a/src/main/browser/browser-network-tunnel-source-flow.ts b/src/main/browser/network/tunnels/browser-network-tunnel-source-flow.ts similarity index 95% rename from src/main/browser/browser-network-tunnel-source-flow.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-source-flow.ts index 4153980c735..9f10e323c1a 100644 --- a/src/main/browser/browser-network-tunnel-source-flow.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-source-flow.ts @@ -1,4 +1,4 @@ -import { BROWSER_NETWORK_TUNNEL_MAX_DATA_BYTES } from '../../shared/browser-network-tunnel-protocol' +import { BROWSER_NETWORK_TUNNEL_MAX_DATA_BYTES } from '../../../../shared/browser-network-tunnel-protocol' import { BROWSER_NETWORK_TUNNEL_MAX_PENDING_SOCKET_BYTES, BROWSER_NETWORK_TUNNEL_MAX_PENDING_SOCKET_CHUNKS diff --git a/src/main/browser/browser-network-tunnel-source-receive-flow.ts b/src/main/browser/network/tunnels/browser-network-tunnel-source-receive-flow.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-source-receive-flow.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-source-receive-flow.ts diff --git a/src/main/browser/browser-network-tunnel-stream-lifecycle.ts b/src/main/browser/network/tunnels/browser-network-tunnel-stream-lifecycle.ts similarity index 100% rename from src/main/browser/browser-network-tunnel-stream-lifecycle.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-stream-lifecycle.ts diff --git a/src/main/browser/browser-network-tunnel-stream-state.ts b/src/main/browser/network/tunnels/browser-network-tunnel-stream-state.ts similarity index 96% rename from src/main/browser/browser-network-tunnel-stream-state.ts rename to src/main/browser/network/tunnels/browser-network-tunnel-stream-state.ts index 147620801a5..73748a11875 100644 --- a/src/main/browser/browser-network-tunnel-stream-state.ts +++ b/src/main/browser/network/tunnels/browser-network-tunnel-stream-state.ts @@ -68,4 +68,4 @@ export type BrowserNetworkTunnelSessionOptions = { now?: () => number claimAggregateRetainedBytes?: (bytes: number) => (() => void) | null } -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' diff --git a/src/main/browser/execution-route-socket-duplex.test.ts b/src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts similarity index 96% rename from src/main/browser/execution-route-socket-duplex.test.ts rename to src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts index 8cd5c89b6f5..1cceb0230ef 100644 --- a/src/main/browser/execution-route-socket-duplex.test.ts +++ b/src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts @@ -1,7 +1,7 @@ import { EventEmitter, once } from 'node:events' import { PassThrough } from 'node:stream' import { describe, expect, it } from 'vitest' -import { BrowserNetworkDeferredSocket } from './browser-network-deferred-socket' +import { BrowserNetworkDeferredSocket } from '../execution-routes/browser-network-deferred-socket' import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' import { openExecutionRouteSocketAsDuplex } from './execution-route-socket-duplex' diff --git a/src/main/browser/execution-route-socket-duplex.ts b/src/main/browser/network/tunnels/execution-route-socket-duplex.ts similarity index 100% rename from src/main/browser/execution-route-socket-duplex.ts rename to src/main/browser/network/tunnels/execution-route-socket-duplex.ts diff --git a/src/main/browser/http-connect-tunnel-socket.ts b/src/main/browser/network/tunnels/http-connect-tunnel-socket.ts similarity index 93% rename from src/main/browser/http-connect-tunnel-socket.ts rename to src/main/browser/network/tunnels/http-connect-tunnel-socket.ts index bdd2d2e4b22..364383118e7 100644 --- a/src/main/browser/http-connect-tunnel-socket.ts +++ b/src/main/browser/network/tunnels/http-connect-tunnel-socket.ts @@ -1,7 +1,7 @@ import { isIP } from 'node:net' import { connect as connectTls, type ConnectionOptions } from 'node:tls' -import { separateElectronProxyCredentials } from '../network/electron-proxy-credentials' -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' +import { separateElectronProxyCredentials } from '../../../network/electron-proxy-credentials' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' import { ProxyHandshakeSocket, type ProxyHandshakeTransport } from './proxy-handshake-socket' const MAX_RESPONSE_HEAD_BYTES = 16 * 1024 diff --git a/src/main/browser/proxy-handshake-socket.ts b/src/main/browser/network/tunnels/proxy-handshake-socket.ts similarity index 100% rename from src/main/browser/proxy-handshake-socket.ts rename to src/main/browser/network/tunnels/proxy-handshake-socket.ts diff --git a/src/main/browser/remote-browser-socks-buffering.test.ts b/src/main/browser/network/tunnels/remote-browser-socks-buffering.test.ts similarity index 100% rename from src/main/browser/remote-browser-socks-buffering.test.ts rename to src/main/browser/network/tunnels/remote-browser-socks-buffering.test.ts diff --git a/src/main/browser/remote-browser-socks-server.test.ts b/src/main/browser/network/tunnels/remote-browser-socks-server.test.ts similarity index 100% rename from src/main/browser/remote-browser-socks-server.test.ts rename to src/main/browser/network/tunnels/remote-browser-socks-server.test.ts diff --git a/src/main/browser/remote-browser-socks-server.ts b/src/main/browser/network/tunnels/remote-browser-socks-server.ts similarity index 100% rename from src/main/browser/remote-browser-socks-server.ts rename to src/main/browser/network/tunnels/remote-browser-socks-server.ts diff --git a/src/main/browser/remote-browser-socks-upstream.ts b/src/main/browser/network/tunnels/remote-browser-socks-upstream.ts similarity index 100% rename from src/main/browser/remote-browser-socks-upstream.ts rename to src/main/browser/network/tunnels/remote-browser-socks-upstream.ts diff --git a/src/main/browser/system-ssh-socks-client-socket.test.ts b/src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts similarity index 100% rename from src/main/browser/system-ssh-socks-client-socket.test.ts rename to src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts diff --git a/src/main/browser/system-ssh-socks-client-socket.ts b/src/main/browser/network/tunnels/system-ssh-socks-client-socket.ts similarity index 97% rename from src/main/browser/system-ssh-socks-client-socket.ts rename to src/main/browser/network/tunnels/system-ssh-socks-client-socket.ts index 9e8dae6c6da..497a227de62 100644 --- a/src/main/browser/system-ssh-socks-client-socket.ts +++ b/src/main/browser/network/tunnels/system-ssh-socks-client-socket.ts @@ -1,4 +1,4 @@ -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' import { ProxyHandshakeSocket, type ProxyHandshakeTransport } from './proxy-handshake-socket' const SOCKS_VERSION = 5 diff --git a/src/main/browser/offscreen-browser-backend.ts b/src/main/browser/offscreen-browser-backend.ts index fc654a26b34..0e3e643d475 100644 --- a/src/main/browser/offscreen-browser-backend.ts +++ b/src/main/browser/offscreen-browser-backend.ts @@ -7,7 +7,7 @@ import type { BrowserBackend, BrowserBackendCreateTab } from './browser-backend' import type { BrowserManager } from './browser-manager' import type { AgentBrowserBridge } from './agent-browser/agent-browser-bridge' import { browserSessionRegistry } from './browser-session-registry' -import { installBrowserJavaScriptDialogs } from './browser-javascript-dialogs' +import { installBrowserJavaScriptDialogs } from './guest-lifecycle/prompts/browser-javascript-dialogs' import type { ServeBrowserPageState } from '../runtime/serve-browser-tab-layout' // orca serve has no renderer for webviews; hidden BrowserWindows host its pages. diff --git a/src/main/browser/browser-route-guest-guard.ts b/src/main/browser/routing/guest-authority/browser-route-guest-guard.ts similarity index 94% rename from src/main/browser/browser-route-guest-guard.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-guard.ts index 5dd69958b0d..07aec26f212 100644 --- a/src/main/browser/browser-route-guest-guard.ts +++ b/src/main/browser/routing/guest-authority/browser-route-guest-guard.ts @@ -1,6 +1,6 @@ import type { Session, WebContents } from 'electron' -import { normalizeBrowserNavigationUrl } from '../../shared/browser-url' -import { ORCA_BROWSER_BLANK_URL } from '../../shared/constants' +import { normalizeBrowserNavigationUrl } from '../../../../shared/browser-url' +import { ORCA_BROWSER_BLANK_URL } from '../../../../shared/constants' import { isValidBrowserRoutePageOwnerIdentity, type BrowserRoutePageAuthorityRetirement, diff --git a/src/main/browser/browser-route-guest-lifecycle-claim.ts b/src/main/browser/routing/guest-authority/browser-route-guest-lifecycle-claim.ts similarity index 100% rename from src/main/browser/browser-route-guest-lifecycle-claim.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-lifecycle-claim.ts diff --git a/src/main/browser/browser-route-guest-lifecycle.ts b/src/main/browser/routing/guest-authority/browser-route-guest-lifecycle.ts similarity index 97% rename from src/main/browser/browser-route-guest-lifecycle.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-lifecycle.ts index 5f3ed2c2a98..d772053a9a3 100644 --- a/src/main/browser/browser-route-guest-lifecycle.ts +++ b/src/main/browser/routing/guest-authority/browser-route-guest-lifecycle.ts @@ -1,5 +1,5 @@ -import { normalizeBrowserNavigationUrl } from '../../shared/browser-url' -import { ORCA_BROWSER_BLANK_URL } from '../../shared/constants' +import { normalizeBrowserNavigationUrl } from '../../../../shared/browser-url' +import { ORCA_BROWSER_BLANK_URL } from '../../../../shared/constants' import type { WebContents } from 'electron' import { browserRoutePageKey, diff --git a/src/main/browser/browser-route-guest-popup-ownership.ts b/src/main/browser/routing/guest-authority/browser-route-guest-popup-ownership.ts similarity index 100% rename from src/main/browser/browser-route-guest-popup-ownership.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-popup-ownership.ts diff --git a/src/main/browser/browser-route-guest-popup-window-options.ts b/src/main/browser/routing/guest-authority/browser-route-guest-popup-window-options.ts similarity index 100% rename from src/main/browser/browser-route-guest-popup-window-options.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-popup-window-options.ts diff --git a/src/main/browser/browser-route-guest-popups.test.ts b/src/main/browser/routing/guest-authority/browser-route-guest-popups.test.ts similarity index 99% rename from src/main/browser/browser-route-guest-popups.test.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-popups.test.ts index 8d6c6379ee7..456ff47f1b0 100644 --- a/src/main/browser/browser-route-guest-popups.test.ts +++ b/src/main/browser/routing/guest-authority/browser-route-guest-popups.test.ts @@ -3,7 +3,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest' const popupMocks = vi.hoisted(() => ({ openPopupWithOriginBar: vi.fn() })) -vi.mock('./popup-origin-bar-window', () => ({ +vi.mock('../../guest-lifecycle/popups/popup-origin-bar-window', () => ({ openPopupWithOriginBar: popupMocks.openPopupWithOriginBar })) diff --git a/src/main/browser/browser-route-guest-popups.ts b/src/main/browser/routing/guest-authority/browser-route-guest-popups.ts similarity index 91% rename from src/main/browser/browser-route-guest-popups.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-popups.ts index f77522a0415..34871c7b514 100644 --- a/src/main/browser/browser-route-guest-popups.ts +++ b/src/main/browser/routing/guest-authority/browser-route-guest-popups.ts @@ -1,11 +1,14 @@ import type { Session, WebContents } from 'electron' -import { ORCA_BROWSER_BLANK_URL } from '../../shared/constants' -import { isBlankBrowserPopupUrl, normalizeBrowserPopupUrl } from './browser-popup-new-tab-intent' -import { enforceBrowserRouteWebRtcPolicy } from './browser-route-webrtc-policy' +import { ORCA_BROWSER_BLANK_URL } from '../../../../shared/constants' +import { + isBlankBrowserPopupUrl, + normalizeBrowserPopupUrl +} from '../../guest-lifecycle/popups/browser-popup-new-tab-intent' +import { enforceBrowserRouteWebRtcPolicy } from '../../network/egress/browser-route-webrtc-policy' import { trackBrowserGuestInputGesture, type BrowserGuestInputGesture -} from './browser-guest-input-gesture' +} from '../../guest-lifecycle/input/browser-guest-input-gesture' import { registerBrowserRouteGuestPopup, releaseBrowserRouteGuestPopup @@ -14,9 +17,15 @@ import { ROUTE_POPUP_WINDOW_OPTIONS, type BrowserRouteGuestPopupWindow } from './browser-route-guest-popup-window-options' -import { openPopupWithOriginBar, type PopupChildWindowOptions } from './popup-origin-bar-window' -import { allowNativeBrowserPopup, isNativeBrowserPopupRequest } from './browser-popup-native-window' -import { allowPageUnload } from './browser-guest-unload-policy' +import { + openPopupWithOriginBar, + type PopupChildWindowOptions +} from '../../guest-lifecycle/popups/popup-origin-bar-window' +import { + allowNativeBrowserPopup, + isNativeBrowserPopupRequest +} from '../../guest-lifecycle/popups/browser-popup-native-window' +import { allowPageUnload } from '../../guest-lifecycle/browser-guest-unload-policy' export const MAX_BROWSER_ROUTE_GUEST_POPUPS = 4 diff --git a/src/main/browser/browser-route-guest-release.ts b/src/main/browser/routing/guest-authority/browser-route-guest-release.ts similarity index 100% rename from src/main/browser/browser-route-guest-release.ts rename to src/main/browser/routing/guest-authority/browser-route-guest-release.ts diff --git a/src/main/browser/browser-route-navigation-authority.ts b/src/main/browser/routing/guest-authority/browser-route-navigation-authority.ts similarity index 100% rename from src/main/browser/browser-route-navigation-authority.ts rename to src/main/browser/routing/guest-authority/browser-route-navigation-authority.ts diff --git a/src/main/browser/browser-route-page-authority.ts b/src/main/browser/routing/guest-authority/browser-route-page-authority.ts similarity index 100% rename from src/main/browser/browser-route-page-authority.ts rename to src/main/browser/routing/guest-authority/browser-route-page-authority.ts diff --git a/src/main/browser/browser-route-page-availability.ts b/src/main/browser/routing/guest-authority/browser-route-page-availability.ts similarity index 100% rename from src/main/browser/browser-route-page-availability.ts rename to src/main/browser/routing/guest-authority/browser-route-page-availability.ts diff --git a/src/main/browser/browser-route-webcontents-registration.ts b/src/main/browser/routing/guest-authority/browser-route-webcontents-registration.ts similarity index 100% rename from src/main/browser/browser-route-webcontents-registration.ts rename to src/main/browser/routing/guest-authority/browser-route-webcontents-registration.ts diff --git a/src/main/browser/browser-route-webcontents-registry-dependencies.ts b/src/main/browser/routing/guest-authority/browser-route-webcontents-registry-dependencies.ts similarity index 90% rename from src/main/browser/browser-route-webcontents-registry-dependencies.ts rename to src/main/browser/routing/guest-authority/browser-route-webcontents-registry-dependencies.ts index 7a5115aab1d..43d0ab555cf 100644 --- a/src/main/browser/browser-route-webcontents-registry-dependencies.ts +++ b/src/main/browser/routing/guest-authority/browser-route-webcontents-registry-dependencies.ts @@ -3,7 +3,7 @@ import type { BrowserRoutePageAuthority, BrowserRoutePageOwnerIdentity } from './browser-route-page-authority' -import type { BrowserRouteSessionRekey } from './browser-route-session-state' +import type { BrowserRouteSessionRekey } from '../sessions/browser-route-session-state' export type BrowserRouteWebContentsRegistryDependencies = { getPartitionForSession(session: Session): string | null diff --git a/src/main/browser/browser-route-webcontents-registry.test.ts b/src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts similarity index 100% rename from src/main/browser/browser-route-webcontents-registry.test.ts rename to src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts diff --git a/src/main/browser/browser-route-webcontents-registry.ts b/src/main/browser/routing/guest-authority/browser-route-webcontents-registry.ts similarity index 99% rename from src/main/browser/browser-route-webcontents-registry.ts rename to src/main/browser/routing/guest-authority/browser-route-webcontents-registry.ts index 7ff216914f9..044ac5e099b 100644 --- a/src/main/browser/browser-route-webcontents-registry.ts +++ b/src/main/browser/routing/guest-authority/browser-route-webcontents-registry.ts @@ -28,7 +28,7 @@ import { navigateBrowserRouteGuest } from './browser-route-guest-lifecycle' import type { BrowserRouteGuestState as GuestState } from './browser-route-webcontents-state' -import { enforceBrowserRouteWebRtcPolicy } from './browser-route-webrtc-policy' +import { enforceBrowserRouteWebRtcPolicy } from '../../network/egress/browser-route-webrtc-policy' import { grantReconciledBrowserRouteGuestNavigation, rekeyBrowserRouteGuest, diff --git a/src/main/browser/browser-route-webcontents-rekey.ts b/src/main/browser/routing/guest-authority/browser-route-webcontents-rekey.ts similarity index 98% rename from src/main/browser/browser-route-webcontents-rekey.ts rename to src/main/browser/routing/guest-authority/browser-route-webcontents-rekey.ts index a1868bb6b04..31d835b1a54 100644 --- a/src/main/browser/browser-route-webcontents-rekey.ts +++ b/src/main/browser/routing/guest-authority/browser-route-webcontents-rekey.ts @@ -9,7 +9,7 @@ import { isValidRoutePageRegistration } from './browser-route-guest-guard' import type { BrowserRouteSessionHandle, BrowserRouteSessionRekey -} from './browser-route-session-state' +} from '../sessions/browser-route-session-state' import type { BrowserRouteGuestState as GuestState } from './browser-route-webcontents-state' type BrowserRouteGuestRekeyDependencies = { diff --git a/src/main/browser/browser-route-webcontents-state.ts b/src/main/browser/routing/guest-authority/browser-route-webcontents-state.ts similarity index 100% rename from src/main/browser/browser-route-webcontents-state.ts rename to src/main/browser/routing/guest-authority/browser-route-webcontents-state.ts diff --git a/src/main/browser/browser-execution-host-storage-identity.ts b/src/main/browser/routing/identity/browser-execution-host-storage-identity.ts similarity index 94% rename from src/main/browser/browser-execution-host-storage-identity.ts rename to src/main/browser/routing/identity/browser-execution-host-storage-identity.ts index a08076f987d..55f0597cc09 100644 --- a/src/main/browser/browser-execution-host-storage-identity.ts +++ b/src/main/browser/routing/identity/browser-execution-host-storage-identity.ts @@ -1,4 +1,4 @@ -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' const STORAGE_IDENTITY_VERSION = 1 const STORAGE_IDENTITY_TAG = 'orca-browser-execution-host-storage' diff --git a/src/main/browser/browser-page-input-credit.test.ts b/src/main/browser/routing/input-ownership/browser-page-input-credit.test.ts similarity index 90% rename from src/main/browser/browser-page-input-credit.test.ts rename to src/main/browser/routing/input-ownership/browser-page-input-credit.test.ts index 9cff0d21a13..6197600b35a 100644 --- a/src/main/browser/browser-page-input-credit.test.ts +++ b/src/main/browser/routing/input-ownership/browser-page-input-credit.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' -import { BROWSER_GUEST_INPUT_GESTURE_WINDOW_MS } from './browser-guest-input-gesture' +import { BROWSER_GUEST_INPUT_GESTURE_WINDOW_MS } from '../../guest-lifecycle/input/browser-guest-input-gesture' import { BrowserPageInputCredit } from './browser-page-input-credit' -import { LOCAL_CLI_RPC_CALLER } from '../runtime/rpc/rpc-caller-identity' +import { LOCAL_CLI_RPC_CALLER } from '../../../runtime/rpc/rpc-caller-identity' const desktop = { kind: 'paired-device', deviceId: 'desk-1' } as const diff --git a/src/main/browser/browser-page-input-credit.ts b/src/main/browser/routing/input-ownership/browser-page-input-credit.ts similarity index 92% rename from src/main/browser/browser-page-input-credit.ts rename to src/main/browser/routing/input-ownership/browser-page-input-credit.ts index cb687328798..6d65953fe02 100644 --- a/src/main/browser/browser-page-input-credit.ts +++ b/src/main/browser/routing/input-ownership/browser-page-input-credit.ts @@ -1,5 +1,5 @@ -import { isRecentBrowserGuestInput } from './browser-guest-input-gesture' -import type { RpcCallerIdentity } from '../runtime/rpc/rpc-caller-identity' +import { isRecentBrowserGuestInput } from '../../guest-lifecycle/input/browser-guest-input-gesture' +import type { RpcCallerIdentity } from '../../../runtime/rpc/rpc-caller-identity' type Runner = { pairedDeviceId: string | null } diff --git a/src/main/browser/remote-cli-page-admission.ts b/src/main/browser/routing/input-ownership/remote-cli-page-admission.ts similarity index 99% rename from src/main/browser/remote-cli-page-admission.ts rename to src/main/browser/routing/input-ownership/remote-cli-page-admission.ts index fe7b0914b13..8212f6deb2a 100644 --- a/src/main/browser/remote-cli-page-admission.ts +++ b/src/main/browser/routing/input-ownership/remote-cli-page-admission.ts @@ -3,7 +3,7 @@ import { AsyncLocalStorage } from 'node:async_hooks' import { assertRemoteCliBrowserAccess, runOutsideRemoteCliBrowserScope -} from '../runtime/desktop-browser-bridge/remote-cli-browser-scope' +} from '../../../runtime/desktop-browser-bridge/remote-cli-browser-scope' export type HeldInputRelease = { method: string; params: Record } diff --git a/src/main/browser/local-ssh-browser-partition-identity.test.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts similarity index 92% rename from src/main/browser/local-ssh-browser-partition-identity.test.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts index d0b84f39d8d..cdd9aabd086 100644 --- a/src/main/browser/local-ssh-browser-partition-identity.test.ts +++ b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partition-identity.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it } from 'vitest' -import { sshExecutionHostStorageIdentity } from './browser-execution-host-storage-identity' +import { sshExecutionHostStorageIdentity } from '../identity/browser-execution-host-storage-identity' import { deriveBrowserRoutePartition, deriveBrowserRoutePartitionStorageScope, deriveLocalSshBrowserRoutePartitionStorageScope -} from './browser-route-identity' +} from '../partitions/browser-route-identity' import { localSshBrowserAuthorityConnectionIdentity } from './local-ssh-browser-partitions' function derive(orcaProfileId: string, browserProfileId: string, targetId: string) { diff --git a/src/main/browser/local-ssh-browser-partitions.probe-cache.test.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.probe-cache.test.ts similarity index 91% rename from src/main/browser/local-ssh-browser-partitions.probe-cache.test.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.probe-cache.test.ts index 5bf9efc4d58..8816f651dc2 100644 --- a/src/main/browser/local-ssh-browser-partitions.probe-cache.test.ts +++ b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.probe-cache.test.ts @@ -49,8 +49,10 @@ vi.mock('electron', async () => { webContents: { getAllWebContents: mocks.census } } }) -vi.mock('./browser-route-guest-guard', () => ({ closeRouteGuest: mocks.closeGuest })) -vi.mock('./browser-route-partition-binding-runtime', () => { +vi.mock('../guest-authority/browser-route-guest-guard', () => ({ + closeRouteGuest: mocks.closeGuest +})) +vi.mock('../partitions/browser-route-partition-binding-runtime', () => { const fingerprints = new Map() return { activeBrowserRoutePartitionOrcaProfileId: () => 'orca-profile-1', @@ -64,18 +66,20 @@ vi.mock('./browser-route-partition-binding-runtime', () => { }) } }) -vi.mock('./browser-route-partition-retention', () => ({ +vi.mock('../partitions/browser-route-partition-retention', () => ({ isBrowserRoutePartitionRetainedByAnyOwner: () => false, registerBrowserRoutePartitionRetentionProbe: vi.fn() })) -vi.mock('./browser-route-partition-storage-dependencies', () => ({ +vi.mock('../partitions/browser-route-partition-storage-dependencies', () => ({ releaseEvictedBrowserRoutePartitionStorage: vi.fn(async () => {}) })) -vi.mock('./browser-route-session-policy', () => ({ +vi.mock('../sessions/browser-route-session-policy', () => ({ prepareBrowserRouteSessionPolicy: mocks.policy })) -vi.mock('./browser-route-webrtc-policy', () => ({ enforceBrowserRouteWebRtcPolicy: vi.fn() })) -vi.mock('./browser-session-registry', () => ({ +vi.mock('../../network/egress/browser-route-webrtc-policy', () => ({ + enforceBrowserRouteWebRtcPolicy: vi.fn() +})) +vi.mock('../../browser-session-registry', () => ({ browserSessionRegistry: { requireRouteBrowserProfile: vi.fn(), setupRoutePartitionPolicies: vi.fn(), @@ -87,34 +91,34 @@ vi.mock('./local-ssh-browser-route', () => ({ probeLocalSshBrowserRouteForwarding: mocks.probe, closeLocalSshBrowserRouteForTarget: vi.fn(async () => {}) })) -vi.mock('../ssh/targets/ssh-target-registry', () => ({ +vi.mock('../../../ssh/targets/ssh-target-registry', () => ({ getSshTargetRegistryStore: () => ({ removeTarget: mocks.removeTarget }) })) -vi.mock('../ssh/ssh-host-server-status', () => ({ clearSshHostServerStatus: vi.fn() })) -vi.mock('../ssh/connection/ssh-connection-attribution', () => ({ +vi.mock('../../../ssh/ssh-host-server-status', () => ({ clearSshHostServerStatus: vi.fn() })) +vi.mock('../../../ssh/connection/ssh-connection-attribution', () => ({ isSshConnectionSolelyOwnedBy: () => true })) -vi.mock('../ipc/ssh/ssh-connect-attempt-registry', () => ({ +vi.mock('../../../ipc/ssh/ssh-connect-attempt-registry', () => ({ connectInFlight: new Map(), invalidateConnectAttempt: vi.fn(), isCurrentConnectAttempt: () => false })) -vi.mock('../ipc/ssh/ssh-ipc-context', () => ({ +vi.mock('../../../ipc/ssh/ssh-ipc-context', () => ({ connectionManager: { disconnect: vi.fn(async () => {}) }, persistedStore: { removeSshRemotePtyLeases: vi.fn() }, portForwardManager: { removeAllForwards: vi.fn(async () => {}) } })) -vi.mock('../ipc/ssh/ssh-managed-port-forward-restore', () => ({ +vi.mock('../../../ipc/ssh/ssh-managed-port-forward-restore', () => ({ forgetPortForwardRestoreState: vi.fn() })) -vi.mock('../ssh/legacy-relay/legacy-relay-bridge-registry', () => ({ +vi.mock('../../../ssh/legacy-relay/legacy-relay-bridge-registry', () => ({ forgetLegacyRelayTarget: vi.fn(), stopLegacyRelayBridge: vi.fn() })) -vi.mock('../managed-server/lifecycle/orcad-managed-tunnel', () => ({ +vi.mock('../../../managed-server/lifecycle/orcad-managed-tunnel', () => ({ closeOrcadManagedTunnelsForTarget: vi.fn(async () => {}) })) -vi.mock('./browser-route-partition-storage-runtime', () => ({ +vi.mock('../partitions/browser-route-partition-storage-runtime', () => ({ clearBrowserRoutePartitionStorageForLocalSshTarget: mocks.clearStorage })) @@ -123,8 +127,11 @@ import { prepareLocalSshBrowserPartition, releaseLocalSshBrowserPartitionsForTarget } from './local-ssh-browser-partitions' -import { removeRegisteredSshTarget } from '../ipc/ssh/ssh-session-teardown' -import { runTargetLifecycle, targetLifecycleInFlight } from '../ipc/ssh/ssh-target-lifecycle-queue' +import { removeRegisteredSshTarget } from '../../../ipc/ssh/ssh-session-teardown' +import { + runTargetLifecycle, + targetLifecycleInFlight +} from '../../../ipc/ssh/ssh-target-lifecycle-queue' beforeEach(() => { mocks.probe.mockReset().mockResolvedValue('ok') diff --git a/src/main/browser/local-ssh-browser-partitions.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.ts similarity index 93% rename from src/main/browser/local-ssh-browser-partitions.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.ts index 78226ca6364..4d18b409a82 100644 --- a/src/main/browser/local-ssh-browser-partitions.ts +++ b/src/main/browser/routing/local-host-partitions/local-ssh-browser-partitions.ts @@ -1,25 +1,25 @@ import { app, session, webContents, type Session, type WebContents } from 'electron' -import { closeRouteGuest } from './browser-route-guest-guard' -import { sshExecutionHostStorageIdentity } from './browser-execution-host-storage-identity' +import { closeRouteGuest } from '../guest-authority/browser-route-guest-guard' +import { sshExecutionHostStorageIdentity } from '../identity/browser-execution-host-storage-identity' import { deriveBrowserRoutePartition, deriveLocalSshBrowserRoutePartitionStorageScope -} from './browser-route-identity' +} from '../partitions/browser-route-identity' import { activeBrowserRoutePartitionOrcaProfileId, currentBrowserRoutePartitionBindingStore -} from './browser-route-partition-binding-runtime' +} from '../partitions/browser-route-partition-binding-runtime' import { isBrowserRoutePartitionRetainedByAnyOwner, registerBrowserRoutePartitionRetentionProbe -} from './browser-route-partition-retention' -import { releaseEvictedBrowserRoutePartitionStorage } from './browser-route-partition-storage-dependencies' +} from '../partitions/browser-route-partition-retention' +import { releaseEvictedBrowserRoutePartitionStorage } from '../partitions/browser-route-partition-storage-dependencies' import { prepareBrowserRouteSessionPolicy, type BrowserRouteProxyEndpoint -} from './browser-route-session-policy' -import { enforceBrowserRouteWebRtcPolicy } from './browser-route-webrtc-policy' -import { browserSessionRegistry } from './browser-session-registry' +} from '../sessions/browser-route-session-policy' +import { enforceBrowserRouteWebRtcPolicy } from '../../network/egress/browser-route-webrtc-policy' +import { browserSessionRegistry } from '../../browser-session-registry' import { closeLocalSshBrowserRouteForTarget, probeLocalSshBrowserRouteForwarding, diff --git a/src/main/browser/local-ssh-browser-profile-retirement.test.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-profile-retirement.test.ts similarity index 89% rename from src/main/browser/local-ssh-browser-profile-retirement.test.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-profile-retirement.test.ts index 7031402e0f5..53099419efa 100644 --- a/src/main/browser/local-ssh-browser-profile-retirement.test.ts +++ b/src/main/browser/routing/local-host-partitions/local-ssh-browser-profile-retirement.test.ts @@ -56,34 +56,36 @@ vi.mock('electron', async () => { webContents: { getAllWebContents: () => state.guests } } }) -vi.mock('./browser-session-cookie-staging', () => ({ +vi.mock('../../browser-session-cookie-staging', () => ({ applyPendingBrowserCookieImports() {}, clearPendingBrowserCookieImport() {} })) -vi.mock('./browser-session-partition-policies', () => ({ +vi.mock('../../browser-session-partition-policies', () => ({ installBrowserSessionPartitionPolicies: state.policy, clearBrowserSessionPartitionPolicies: state.clearPolicy, forgetBrowserSessionPartitionConfiguration() {}, retireBrowserSessionUserAgentPolicy() {} })) -vi.mock('./browser-session-proxy', () => ({ invalidateBrowserSessionProxyApplication() {} })) -vi.mock('../network/proxy-settings', () => ({ async retireProxySessionApplication() {} })) -vi.mock('./browser-webauthn-account-picker', () => ({ +vi.mock('../../browser-session-proxy', () => ({ invalidateBrowserSessionProxyApplication() {} })) +vi.mock('../../../network/proxy-settings', () => ({ async retireProxySessionApplication() {} })) +vi.mock('../../browser-webauthn-account-picker', () => ({ cancelBrowserWebAuthnAccountRequestsForSession() {} })) -vi.mock('./extensions/browser-extension-session-loader', () => ({ +vi.mock('../../extensions/browser-extension-session-loader', () => ({ attachBrowserExtensionsToProfileSession() {}, async detachBrowserExtensionsFromProfileSession() {} })) -vi.mock('../persistence/loading-store/user-data-path', () => ({ +vi.mock('../../../persistence/loading-store/user-data-path', () => ({ getCanonicalUserDataPath: () => state.directory })) -vi.mock('./browser-identity-mode-store', () => ({ +vi.mock('../../browser-identity-mode-store', () => ({ async markBrowserIdentityMigrationNoticePending() {} })) -vi.mock('./browser-site-permission-store', () => ({ forgetBrowserSitePermissions() {} })) -vi.mock('./browser-site-display-store', () => ({ forgetBrowserSiteDisplay() {} })) -vi.mock('./browser-route-webrtc-policy', () => ({ enforceBrowserRouteWebRtcPolicy() {} })) +vi.mock('../../browser-site-permission-store', () => ({ forgetBrowserSitePermissions() {} })) +vi.mock('../../browser-site-display-store', () => ({ forgetBrowserSiteDisplay() {} })) +vi.mock('../../network/egress/browser-route-webrtc-policy', () => ({ + enforceBrowserRouteWebRtcPolicy() {} +})) vi.mock('./local-ssh-browser-route', () => ({ retainLocalSshBrowserRoute: state.retain, probeLocalSshBrowserRouteForwarding: state.probe, @@ -91,12 +93,12 @@ vi.mock('./local-ssh-browser-route', () => ({ })) import { session } from 'electron' -import { browserSessionRegistry as registry } from './browser-session-registry' +import { browserSessionRegistry as registry } from '../../browser-session-registry' import { configureBrowserRoutePartitionBindingsForOrcaProfile, currentBrowserRoutePartitionBindingStore -} from './browser-route-partition-binding-runtime' -import { isBrowserRoutePartitionRetainedByAnyOwner } from './browser-route-partition-retention' +} from '../partitions/browser-route-partition-binding-runtime' +import { isBrowserRoutePartitionRetainedByAnyOwner } from '../partitions/browser-route-partition-retention' import { isLocalSshBrowserPartition, prepareLocalSshBrowserPartition, diff --git a/src/main/browser/local-ssh-browser-route-target.test.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-route-target.test.ts similarity index 100% rename from src/main/browser/local-ssh-browser-route-target.test.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-route-target.test.ts diff --git a/src/main/browser/local-ssh-browser-route.test.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-route.test.ts similarity index 98% rename from src/main/browser/local-ssh-browser-route.test.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-route.test.ts index 3f513b5755a..1e746316f6f 100644 --- a/src/main/browser/local-ssh-browser-route.test.ts +++ b/src/main/browser/routing/local-host-partitions/local-ssh-browser-route.test.ts @@ -4,8 +4,8 @@ import { afterEach, describe, expect, it, vi } from 'vitest' import type { BrowserNetworkExecutionRoute, BrowserNetworkExecutionRouteContext -} from './browser-network-execution-route' -import type { BrowserNetworkTunnelSocket } from './browser-network-tunnel-stream-state' +} from '../../network/execution-routes/browser-network-execution-route' +import type { BrowserNetworkTunnelSocket } from '../../network/tunnels/browser-network-tunnel-stream-state' import { closeAllLocalSshBrowserRoutes, closeLocalSshBrowserRouteForTarget, diff --git a/src/main/browser/local-ssh-browser-route.ts b/src/main/browser/routing/local-host-partitions/local-ssh-browser-route.ts similarity index 91% rename from src/main/browser/local-ssh-browser-route.ts rename to src/main/browser/routing/local-host-partitions/local-ssh-browser-route.ts index 68fbe47a8c1..e73d00f5c51 100644 --- a/src/main/browser/local-ssh-browser-route.ts +++ b/src/main/browser/routing/local-host-partitions/local-ssh-browser-route.ts @@ -1,9 +1,9 @@ import type { Duplex } from 'node:stream' -import type { BrowserNetworkExecutionRouteResolver } from './browser-network-execution-route' -import type { BrowserNetworkTunnelOpen } from '../../shared/browser-network-tunnel-protocol' -import type { SshTargetSummary } from '../../shared/ssh-types' -import { openExecutionRouteSocketAsDuplex } from './execution-route-socket-duplex' -import { RemoteBrowserSocksServer } from './remote-browser-socks-server' +import type { BrowserNetworkExecutionRouteResolver } from '../../network/execution-routes/browser-network-execution-route' +import type { BrowserNetworkTunnelOpen } from '../../../../shared/browser-network-tunnel-protocol' +import type { SshTargetSummary } from '../../../../shared/ssh-types' +import { openExecutionRouteSocketAsDuplex } from '../../network/tunnels/execution-route-socket-duplex' +import { RemoteBrowserSocksServer } from '../../network/tunnels/remote-browser-socks-server' export function requireLocalSshBrowserRouteTarget( targets: readonly Pick[] | undefined, @@ -165,8 +165,8 @@ const routesByTargetId = new Map() async function defaultDependencies(): Promise { const [{ resolveBrowserNetworkExecutionRoute }, authority] = await Promise.all([ - import('./browser-network-execution-route-dispatch'), - import('../ssh/ssh-provider-authority') + import('../../network/execution-routes/browser-network-execution-route-dispatch'), + import('../../../ssh/ssh-provider-authority') ]) return { resolveExecutionRoute: resolveBrowserNetworkExecutionRoute, diff --git a/src/main/browser/wsl-host-browser-jar-identity.test.ts b/src/main/browser/routing/local-host-partitions/wsl-host-browser-jar-identity.test.ts similarity index 89% rename from src/main/browser/wsl-host-browser-jar-identity.test.ts rename to src/main/browser/routing/local-host-partitions/wsl-host-browser-jar-identity.test.ts index a4178e9f60a..b301e7556ac 100644 --- a/src/main/browser/wsl-host-browser-jar-identity.test.ts +++ b/src/main/browser/routing/local-host-partitions/wsl-host-browser-jar-identity.test.ts @@ -7,8 +7,8 @@ import { mkdtempSync, realpathSync, rmSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import type { KnownRuntimeEnvironment } from '../../shared/runtime-environments' -import { defaultWslOrcadEnvironmentId } from '../wsl/orcad/wsl-orcad-deploy' +import type { KnownRuntimeEnvironment } from '../../../../shared/runtime-environments' +import { defaultWslOrcadEnvironmentId } from '../../../wsl/orcad/wsl-orcad-deploy' const bindings = vi.hoisted(() => ({ filePath: '' })) @@ -16,15 +16,15 @@ vi.mock('electron', () => ({ app: { getPath: () => tmpdir() }, ipcMain: { on: vi.fn(), removeListener: vi.fn() } })) -vi.mock('./browser-route-partition-binding-runtime', async () => { +vi.mock('../partitions/browser-route-partition-binding-runtime', async () => { const { BrowserRoutePartitionBindingStore } = - await import('./browser-route-partition-binding-store') + await import('../partitions/browser-route-partition-binding-store') return { currentBrowserRoutePartitionBindingStore: () => new BrowserRoutePartitionBindingStore({ filePath: bindings.filePath }) } }) -vi.mock('./browser-route-partition-storage-dependencies', () => ({ +vi.mock('../partitions/browser-route-partition-storage-dependencies', () => ({ releaseEvictedBrowserRoutePartitionStorage: vi.fn(async () => {}) })) diff --git a/src/main/browser/wsl-host-browser-route-partition.test.ts b/src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.test.ts similarity index 90% rename from src/main/browser/wsl-host-browser-route-partition.test.ts rename to src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.test.ts index c88bd144291..ff65ed5ebcb 100644 --- a/src/main/browser/wsl-host-browser-route-partition.test.ts +++ b/src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.test.ts @@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import type { KnownRuntimeEnvironment, OrcadDeploymentLink -} from '../../shared/runtime-environments' +} from '../../../../shared/runtime-environments' const bindings = vi.hoisted(() => ({ filePath: '' })) @@ -13,7 +13,7 @@ vi.mock('electron', () => ({ app: { getPath: () => tmpdir() }, ipcMain: { on: vi.fn(), removeListener: vi.fn() } })) -vi.mock('./paired-runtime-browser-client-host-composition', () => ({ +vi.mock('../../client-hosts/lifecycle/paired-runtime-browser-client-host-composition', () => ({ PairedRuntimeBrowserClientHostComposition: class { start(): Promise { return Promise.resolve({ authority: 'lease-a' }) @@ -29,27 +29,27 @@ vi.mock('./paired-runtime-browser-client-host-composition', () => ({ } } })) -vi.mock('./browser-route-partition-binding-runtime', async () => { +vi.mock('../partitions/browser-route-partition-binding-runtime', async () => { const { BrowserRoutePartitionBindingStore } = - await import('./browser-route-partition-binding-store') + await import('../partitions/browser-route-partition-binding-store') return { currentBrowserRoutePartitionBindingStore: () => new BrowserRoutePartitionBindingStore({ filePath: bindings.filePath }) } }) -vi.mock('./browser-route-partition-storage-dependencies', () => ({ +vi.mock('../partitions/browser-route-partition-storage-dependencies', () => ({ releaseEvictedBrowserRoutePartitionStorage: vi.fn(async () => {}) })) -import { BrowserRoutePartitionBindingStore } from './browser-route-partition-binding-store' -import { resolveBrowserRoutePartitionBinding } from './browser-route-partition-migration' +import { BrowserRoutePartitionBindingStore } from '../partitions/browser-route-partition-binding-store' +import { resolveBrowserRoutePartitionBinding } from '../partitions/browser-route-partition-migration' import { closePairedRuntimeBrowserClientHostEnvironment, configurePairedRuntimeBrowserClientHostsForOrcaProfile, getPairedRuntimeBrowserClientRouteIdentity, startPairedRuntimeBrowserClientHost, type ClientHostRouteIdentity -} from './paired-runtime-browser-client-host-runtime' +} from '../../client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' import { bindWslHostBrowserRoutePartition, wslHostBrowserRouteStorage diff --git a/src/main/browser/wsl-host-browser-route-partition.ts b/src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.ts similarity index 83% rename from src/main/browser/wsl-host-browser-route-partition.ts rename to src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.ts index e4f06e50dda..d1352230354 100644 --- a/src/main/browser/wsl-host-browser-route-partition.ts +++ b/src/main/browser/routing/local-host-partitions/wsl-host-browser-route-partition.ts @@ -2,21 +2,21 @@ * The route partition a WSL host's in-app browser pages will use, resolved from the environment * record alone so a caller can seed it while no page or orcad connection is live. */ -import { classifyRuntimeEnvironmentHost } from '../../shared/runtime-environment-host-kind' +import { classifyRuntimeEnvironmentHost } from '../../../../shared/runtime-environment-host-kind' import { getPreferredPairedRuntimeConnection, type KnownRuntimeEnvironment -} from '../../shared/runtime-environments' -import { browserAuthorityExecutionHostStorageIdentity } from './browser-execution-host-storage-identity' +} from '../../../../shared/runtime-environments' +import { browserAuthorityExecutionHostStorageIdentity } from '../identity/browser-execution-host-storage-identity' import { deriveBrowserRoutePartitionStorageScope, type BrowserRoutePartitionIdentity -} from './browser-route-identity' -import { currentBrowserRoutePartitionBindingStore } from './browser-route-partition-binding-runtime' -import { resolveBrowserRoutePartitionBinding } from './browser-route-partition-migration' -import { isBrowserRoutePartitionRetainedByAnyOwner } from './browser-route-partition-retention' -import { releaseEvictedBrowserRoutePartitionStorage } from './browser-route-partition-storage-dependencies' -import { derivePairedRuntimeBrowserAuthorityIdentity } from './paired-runtime-browser-authority-identity' +} from '../partitions/browser-route-identity' +import { currentBrowserRoutePartitionBindingStore } from '../partitions/browser-route-partition-binding-runtime' +import { resolveBrowserRoutePartitionBinding } from '../partitions/browser-route-partition-migration' +import { isBrowserRoutePartitionRetainedByAnyOwner } from '../partitions/browser-route-partition-retention' +import { releaseEvictedBrowserRoutePartitionStorage } from '../partitions/browser-route-partition-storage-dependencies' +import { derivePairedRuntimeBrowserAuthorityIdentity } from '../../client-hosts/leases/paired-runtime-browser-authority-identity' // Only the per-process legacy identity reads the runtime id, and it is not used here. const OFFLINE_AUTHORITY_RUNTIME_ID = 'wsl-move-offline' diff --git a/src/main/browser/browser-route-identity.test.ts b/src/main/browser/routing/partitions/browser-route-identity.test.ts similarity index 100% rename from src/main/browser/browser-route-identity.test.ts rename to src/main/browser/routing/partitions/browser-route-identity.test.ts diff --git a/src/main/browser/browser-route-identity.ts b/src/main/browser/routing/partitions/browser-route-identity.ts similarity index 100% rename from src/main/browser/browser-route-identity.ts rename to src/main/browser/routing/partitions/browser-route-identity.ts diff --git a/src/main/browser/browser-route-partition-binding-capacity.test.ts b/src/main/browser/routing/partitions/browser-route-partition-binding-capacity.test.ts similarity index 100% rename from src/main/browser/browser-route-partition-binding-capacity.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-binding-capacity.test.ts diff --git a/src/main/browser/browser-route-partition-binding-file.ts b/src/main/browser/routing/partitions/browser-route-partition-binding-file.ts similarity index 100% rename from src/main/browser/browser-route-partition-binding-file.ts rename to src/main/browser/routing/partitions/browser-route-partition-binding-file.ts diff --git a/src/main/browser/browser-route-partition-binding-runtime.ts b/src/main/browser/routing/partitions/browser-route-partition-binding-runtime.ts similarity index 100% rename from src/main/browser/browser-route-partition-binding-runtime.ts rename to src/main/browser/routing/partitions/browser-route-partition-binding-runtime.ts diff --git a/src/main/browser/browser-route-partition-binding-store-fake.ts b/src/main/browser/routing/partitions/browser-route-partition-binding-store-fake.ts similarity index 93% rename from src/main/browser/browser-route-partition-binding-store-fake.ts rename to src/main/browser/routing/partitions/browser-route-partition-binding-store-fake.ts index fc4639dd36e..6ad9bc9ecd1 100644 --- a/src/main/browser/browser-route-partition-binding-store-fake.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-binding-store-fake.ts @@ -1,4 +1,4 @@ -import type { BrowserRoutePartitionBindingStore } from './browser-route-session-registry-contract' +import type { BrowserRoutePartitionBindingStore } from '../sessions/browser-route-session-registry-contract' export type BrowserRoutePartitionBindingStoreFake = BrowserRoutePartitionBindingStore & { entries: Map diff --git a/src/main/browser/browser-route-partition-binding-store.test.ts b/src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts similarity index 100% rename from src/main/browser/browser-route-partition-binding-store.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-binding-store.test.ts diff --git a/src/main/browser/browser-route-partition-binding-store.ts b/src/main/browser/routing/partitions/browser-route-partition-binding-store.ts similarity index 96% rename from src/main/browser/browser-route-partition-binding-store.ts rename to src/main/browser/routing/partitions/browser-route-partition-binding-store.ts index e7a89be8d14..d0f2535aaa7 100644 --- a/src/main/browser/browser-route-partition-binding-store.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-binding-store.ts @@ -1,8 +1,8 @@ import { existsSync, mkdirSync, statSync } from 'node:fs' import { dirname, join } from 'node:path' -import { grantDirAcl } from '../windows/windows-directory-acl' -import { isPermissionError } from '../filesystem/permission-errors' -import { durableWriteTempPath, writeFileDurableSync } from '../filesystem/durable-file-write' +import { grantDirAcl } from '../../../windows/windows-directory-acl' +import { isPermissionError } from '../../../filesystem/permission-errors' +import { durableWriteTempPath, writeFileDurableSync } from '../../../filesystem/durable-file-write' import { assertBinding, assertStorageScope, @@ -14,8 +14,6 @@ import { type BrowserRoutePartitionBinding } from './browser-route-partition-binding-file' -export type { BrowserRoutePartitionBinding } from './browser-route-partition-binding-file' - const DEFAULT_MAX_BINDINGS = 512 const DEFAULT_MAX_FILE_BYTES = 256 * 1024 const TOUCH_INTERVAL_MS = 24 * 60 * 60 * 1000 diff --git a/src/main/browser/browser-route-partition-migration.test.ts b/src/main/browser/routing/partitions/browser-route-partition-migration.test.ts similarity index 96% rename from src/main/browser/browser-route-partition-migration.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-migration.test.ts index 15f9b979f32..133c9aad5ea 100644 --- a/src/main/browser/browser-route-partition-migration.test.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-migration.test.ts @@ -5,10 +5,8 @@ import { describe, expect, it, vi } from 'vitest' import { deriveBrowserRoutePartition } from './browser-route-identity' import { BrowserRoutePartitionBindingStore } from './browser-route-partition-binding-store' -import { - BrowserRouteSessionRegistry, - type BrowserRouteElectronSession -} from './browser-route-session-registry' +import { BrowserRouteSessionRegistry } from '../sessions/browser-route-session-registry' +import type { BrowserRouteElectronSession } from '../sessions/browser-route-session-policy' const orcaProfileId = 'orca/profile:alpha' const browserProfileId = 'default' diff --git a/src/main/browser/browser-route-partition-migration.ts b/src/main/browser/routing/partitions/browser-route-partition-migration.ts similarity index 100% rename from src/main/browser/browser-route-partition-migration.ts rename to src/main/browser/routing/partitions/browser-route-partition-migration.ts diff --git a/src/main/browser/browser-route-partition-pending-deletes.test.ts b/src/main/browser/routing/partitions/browser-route-partition-pending-deletes.test.ts similarity index 100% rename from src/main/browser/browser-route-partition-pending-deletes.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-pending-deletes.test.ts diff --git a/src/main/browser/browser-route-partition-pending-deletes.ts b/src/main/browser/routing/partitions/browser-route-partition-pending-deletes.ts similarity index 98% rename from src/main/browser/browser-route-partition-pending-deletes.ts rename to src/main/browser/routing/partitions/browser-route-partition-pending-deletes.ts index 89d0826c5cc..196060e1710 100644 --- a/src/main/browser/browser-route-partition-pending-deletes.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-pending-deletes.ts @@ -8,7 +8,7 @@ import { dirname, join, resolve } from 'node:path' import { normalizeRuntimePathForComparison, relativePathInsideRoot -} from '../../shared/cross-platform-path' +} from '../../../../shared/cross-platform-path' const PENDING_DELETES_FILE_NAME = 'browser-route-partition-pending-deletes.json' diff --git a/src/main/browser/browser-route-partition-retention.ts b/src/main/browser/routing/partitions/browser-route-partition-retention.ts similarity index 100% rename from src/main/browser/browser-route-partition-retention.ts rename to src/main/browser/routing/partitions/browser-route-partition-retention.ts diff --git a/src/main/browser/browser-route-partition-stability.test.ts b/src/main/browser/routing/partitions/browser-route-partition-stability.test.ts similarity index 93% rename from src/main/browser/browser-route-partition-stability.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-stability.test.ts index 236b5fc12cf..ec182acf1ce 100644 --- a/src/main/browser/browser-route-partition-stability.test.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-stability.test.ts @@ -2,10 +2,10 @@ import { mkdtempSync, realpathSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { describe, expect, it, vi } from 'vitest' -import type { BrowserHostLeaseAuthority } from '../../shared/browser-client-host-protocol' -import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' -import { BrowserClientNetworkRouteRegistry } from './browser-client-network-route-registry' -import { browserNetworkExecutionHostKey } from './browser-network-execution-route' +import type { BrowserHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' +import type { BrowserNetworkExecutionHost } from '../../../../shared/browser-network-execution-host' +import { BrowserClientNetworkRouteRegistry } from '../../network/client-routes/browser-client-network-route-registry' +import { browserNetworkExecutionHostKey } from '../../network/execution-routes/browser-network-execution-route' import { deriveBrowserRoutePartition } from './browser-route-identity' import { BrowserRoutePartitionBindingStore } from './browser-route-partition-binding-store' diff --git a/src/main/browser/browser-route-partition-storage-dependencies.test.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.test.ts similarity index 96% rename from src/main/browser/browser-route-partition-storage-dependencies.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.test.ts index 26c44eb0734..f8eb4faf6cf 100644 --- a/src/main/browser/browser-route-partition-storage-dependencies.test.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.test.ts @@ -15,19 +15,19 @@ vi.mock('electron', () => ({ app: { getPath: () => mocks.userData }, session: { fromPartition: mocks.fromPartition } })) -vi.mock('./browser-session-partition-policies', () => ({ +vi.mock('../../browser-session-partition-policies', () => ({ installBrowserSessionPartitionPolicies: vi.fn(async () => {}), clearBrowserSessionPartitionPolicies: mocks.clearPolicies })) -vi.mock('./browser-session-profile-retirement', () => ({ +vi.mock('../../browser-session-profile-retirement', () => ({ retireDeletedBrowserSessionProfile: vi.fn(async () => {}), retireFailedBrowserSessionProfile: vi.fn(async () => {}) })) -vi.mock('./browser-session-cookie-staging', () => ({ +vi.mock('../../browser-session-cookie-staging', () => ({ applyPendingBrowserCookieImports: vi.fn(), clearPendingBrowserCookieImport: vi.fn() })) -vi.mock('./extensions/browser-extension-session-loader', () => ({ +vi.mock('../../extensions/browser-extension-session-loader', () => ({ attachBrowserExtensionsToProfileSession: vi.fn() })) diff --git a/src/main/browser/browser-route-partition-storage-dependencies.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.ts similarity index 97% rename from src/main/browser/browser-route-partition-storage-dependencies.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.ts index 4b8da0a2798..b8f03cbecb4 100644 --- a/src/main/browser/browser-route-partition-storage-dependencies.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-storage-dependencies.ts @@ -9,7 +9,7 @@ import { currentBrowserRoutePartitionBindingStore, routePartitionDataRoot } from './browser-route-partition-binding-runtime' -import { browserSessionRegistry } from './browser-session-registry' +import { browserSessionRegistry } from '../../browser-session-registry' import { browserRoutePartitionPendingDeletesPath, queueBrowserRoutePartitionDirectoryDelete diff --git a/src/main/browser/browser-route-partition-storage-lifecycle.test.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-lifecycle.test.ts similarity index 100% rename from src/main/browser/browser-route-partition-storage-lifecycle.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-lifecycle.test.ts diff --git a/src/main/browser/browser-route-partition-storage-lifecycle.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-lifecycle.ts similarity index 99% rename from src/main/browser/browser-route-partition-storage-lifecycle.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-lifecycle.ts index 819f50f003b..a936995ca9c 100644 --- a/src/main/browser/browser-route-partition-storage-lifecycle.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-storage-lifecycle.ts @@ -1,5 +1,5 @@ import { join } from 'node:path' -import type { BrowserRoutePartitionBinding } from './browser-route-partition-binding-store' +import type { BrowserRoutePartitionBinding } from './browser-route-partition-binding-file' const PERSIST_PARTITION_PREFIX = 'persist:' diff --git a/src/main/browser/browser-route-partition-storage-retirement.test.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-retirement.test.ts similarity index 94% rename from src/main/browser/browser-route-partition-storage-retirement.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-retirement.test.ts index cdf6a41a3af..e7d168cdde9 100644 --- a/src/main/browser/browser-route-partition-storage-retirement.test.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-storage-retirement.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it, vi } from 'vitest' -import type { BrowserClientHostLeaseAuthority } from '../../shared/browser-client-host-protocol' +import type { BrowserClientHostLeaseAuthority } from '../../../../shared/browser-client-host-protocol' import { retireBrowserRoutePartitionStorageForEnvironment } from './browser-route-partition-storage-retirement' -import { PairedRuntimeBrowserClientHostComposition } from './paired-runtime-browser-client-host-composition' -import { PairedRuntimeBrowserClientHostRegistry } from './paired-runtime-browser-client-host-registry' +import { PairedRuntimeBrowserClientHostComposition } from '../../client-hosts/lifecycle/paired-runtime-browser-client-host-composition' +import { PairedRuntimeBrowserClientHostRegistry } from '../../client-hosts/lifecycle/paired-runtime-browser-client-host-registry' const partition = `persist:orca-browser-v1-${'a'.repeat(64)}` diff --git a/src/main/browser/browser-route-partition-storage-retirement.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-retirement.ts similarity index 100% rename from src/main/browser/browser-route-partition-storage-retirement.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-retirement.ts diff --git a/src/main/browser/browser-route-partition-storage-runtime.test.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-runtime.test.ts similarity index 99% rename from src/main/browser/browser-route-partition-storage-runtime.test.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-runtime.test.ts index 315b55eaddb..1bdcd8817bb 100644 --- a/src/main/browser/browser-route-partition-storage-runtime.test.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-storage-runtime.test.ts @@ -17,7 +17,7 @@ const mocks = vi.hoisted(() => ({ })) vi.mock('electron', () => ({ app: { getPath: () => '/tmp/orca-test-user-data' } })) -vi.mock('../../shared/runtime-environment-store', () => ({ +vi.mock('../../../../shared/runtime-environment-store', () => ({ listEnvironments: () => mocks.environments })) vi.mock('./browser-route-partition-binding-runtime', () => ({ diff --git a/src/main/browser/browser-route-partition-storage-runtime.ts b/src/main/browser/routing/partitions/browser-route-partition-storage-runtime.ts similarity index 96% rename from src/main/browser/browser-route-partition-storage-runtime.ts rename to src/main/browser/routing/partitions/browser-route-partition-storage-runtime.ts index b709a487781..e7872bea0b8 100644 --- a/src/main/browser/browser-route-partition-storage-runtime.ts +++ b/src/main/browser/routing/partitions/browser-route-partition-storage-runtime.ts @@ -1,4 +1,4 @@ -import { listEnvironments } from '../../shared/runtime-environment-store' +import { listEnvironments } from '../../../../shared/runtime-environment-store' import { deriveBrowserRoutePartitionStorageScope, deriveLocalSshBrowserRoutePartitionStorageScope @@ -21,7 +21,7 @@ import { currentBrowserRoutePartitionBindingFilePath } from './browser-route-partition-binding-runtime' import { browserRoutePartitionStorageDependencies } from './browser-route-partition-storage-dependencies' -import { getRuntimeEnvironmentRegistryRoot } from '../ipc/runtime-environments/runtime-environment-registry-root' +import { getRuntimeEnvironmentRegistryRoot } from '../../../ipc/runtime-environments/runtime-environment-registry-root' export type BrowserRoutePartitionStorageClear = { clearedPartitions: string[] diff --git a/src/main/browser/browser-route-prepared-page-ledger.ts b/src/main/browser/routing/sessions/browser-route-prepared-page-ledger.ts similarity index 98% rename from src/main/browser/browser-route-prepared-page-ledger.ts rename to src/main/browser/routing/sessions/browser-route-prepared-page-ledger.ts index 487463d0c5d..5d984c8e87b 100644 --- a/src/main/browser/browser-route-prepared-page-ledger.ts +++ b/src/main/browser/routing/sessions/browser-route-prepared-page-ledger.ts @@ -3,7 +3,7 @@ import { isValidBrowserRoutePageOwnerIdentity, type BrowserRoutePageAuthority, type BrowserRoutePageOwnerIdentity -} from './browser-route-page-authority' +} from '../guest-authority/browser-route-page-authority' export class BrowserRoutePreparedPageLedger { private readonly active = new Map() diff --git a/src/main/browser/browser-route-prepared-page-rekey.test.ts b/src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts similarity index 100% rename from src/main/browser/browser-route-prepared-page-rekey.test.ts rename to src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts diff --git a/src/main/browser/browser-route-renderer-prepare-fence.ts b/src/main/browser/routing/sessions/browser-route-renderer-prepare-fence.ts similarity index 100% rename from src/main/browser/browser-route-renderer-prepare-fence.ts rename to src/main/browser/routing/sessions/browser-route-renderer-prepare-fence.ts diff --git a/src/main/browser/browser-route-session-partition-binding.ts b/src/main/browser/routing/sessions/browser-route-session-partition-binding.ts similarity index 94% rename from src/main/browser/browser-route-session-partition-binding.ts rename to src/main/browser/routing/sessions/browser-route-session-partition-binding.ts index 3e2ebffde9e..5e1b1b44fe9 100644 --- a/src/main/browser/browser-route-session-partition-binding.ts +++ b/src/main/browser/routing/sessions/browser-route-session-partition-binding.ts @@ -1,11 +1,11 @@ import type { BrowserRoutePartitionIdentity, DerivedBrowserRoutePartition -} from './browser-route-identity' +} from '../partitions/browser-route-identity' import { resolveBrowserRoutePartitionBinding, type ResolvedBrowserRoutePartition -} from './browser-route-partition-migration' +} from '../partitions/browser-route-partition-migration' import type { BrowserRouteSessionRegistryDependencies } from './browser-route-session-registry-contract' import type { BrowserRoutePreparePageInput } from './browser-route-session-state' diff --git a/src/main/browser/browser-route-session-policy.ts b/src/main/browser/routing/sessions/browser-route-session-policy.ts similarity index 96% rename from src/main/browser/browser-route-session-policy.ts rename to src/main/browser/routing/sessions/browser-route-session-policy.ts index 73c91538623..44faf38fb7d 100644 --- a/src/main/browser/browser-route-session-policy.ts +++ b/src/main/browser/routing/sessions/browser-route-session-policy.ts @@ -1,4 +1,4 @@ -import type { BrowserClientProfileMetadata } from '../../shared/browser-client-profile-switch-protocol' +import type { BrowserClientProfileMetadata } from '../../../../shared/browser-client-profile-switch-protocol' const PROXY_PROBE_URL = 'http://browser-route-probe.invalid/' export type BrowserRouteElectronSession = { diff --git a/src/main/browser/browser-route-session-registry-contract.ts b/src/main/browser/routing/sessions/browser-route-session-registry-contract.ts similarity index 84% rename from src/main/browser/browser-route-session-registry-contract.ts rename to src/main/browser/routing/sessions/browser-route-session-registry-contract.ts index 38cdb056c33..f7721121fdf 100644 --- a/src/main/browser/browser-route-session-registry-contract.ts +++ b/src/main/browser/routing/sessions/browser-route-session-registry-contract.ts @@ -1,9 +1,9 @@ -import type { BrowserClientProfileMetadata } from '../../shared/browser-client-profile-switch-protocol' +import type { BrowserClientProfileMetadata } from '../../../../shared/browser-client-profile-switch-protocol' import type { BrowserRoutePartitionIdentity, DerivedBrowserRoutePartition -} from './browser-route-identity' -import type { BrowserRoutePageAuthorityRetirement } from './browser-route-page-authority' +} from '../partitions/browser-route-identity' +import type { BrowserRoutePageAuthorityRetirement } from '../guest-authority/browser-route-page-authority' import type { BrowserRouteElectronSession } from './browser-route-session-policy' export type BrowserRoutePartitionBindingStore = { diff --git a/src/main/browser/browser-route-session-registry.test.ts b/src/main/browser/routing/sessions/browser-route-session-registry.test.ts similarity index 98% rename from src/main/browser/browser-route-session-registry.test.ts rename to src/main/browser/routing/sessions/browser-route-session-registry.test.ts index 4c83afa2dde..35e1b955293 100644 --- a/src/main/browser/browser-route-session-registry.test.ts +++ b/src/main/browser/routing/sessions/browser-route-session-registry.test.ts @@ -1,9 +1,7 @@ import { describe, expect, it, vi } from 'vitest' -import { - BrowserRouteSessionRegistry, - type BrowserRouteElectronSession, - type BrowserRouteSessionRegistryDependencies -} from './browser-route-session-registry' +import { BrowserRouteSessionRegistry } from './browser-route-session-registry' +import type { BrowserRouteElectronSession } from './browser-route-session-policy' +import type { BrowserRouteSessionRegistryDependencies } from './browser-route-session-registry-contract' const identity = { orcaProfileId: 'orca-profile-a', diff --git a/src/main/browser/browser-route-session-registry.ts b/src/main/browser/routing/sessions/browser-route-session-registry.ts similarity index 96% rename from src/main/browser/browser-route-session-registry.ts rename to src/main/browser/routing/sessions/browser-route-session-registry.ts index e9a5ae184d5..50ba5cfafae 100644 --- a/src/main/browser/browser-route-session-registry.ts +++ b/src/main/browser/routing/sessions/browser-route-session-registry.ts @@ -1,8 +1,8 @@ -import { BrowserClientProfileMetadata } from '../../shared/browser-client-profile-switch-protocol' +import { BrowserClientProfileMetadata } from '../../../../shared/browser-client-profile-switch-protocol' import { deriveBrowserRoutePartition, type DerivedBrowserRoutePartition -} from './browser-route-identity' +} from '../partitions/browser-route-identity' import { persistBrowserRouteSessionBinding, resolveBrowserRouteSessionPartition @@ -10,7 +10,7 @@ import { import type { BrowserRoutePageAuthority, BrowserRoutePageOwnerIdentity -} from './browser-route-page-authority' +} from '../guest-authority/browser-route-page-authority' import { assertBrowserRoutePreparedPageOwner, BrowserRoutePreparedPageLedger @@ -41,12 +41,6 @@ import type { PreparedBrowserRoutePartition as PreparedPartition } from './browser-route-session-state' -export type { BrowserRouteElectronSession } from './browser-route-session-policy' -export type { - BrowserRoutePartitionBindingStore, - BrowserRouteSessionRegistryDependencies -} from './browser-route-session-registry-contract' - const DEFAULT_MAX_LIVE_PARTITIONS = 64 const DEFAULT_MAX_PAGES_PER_PARTITION = 64 export class BrowserRouteSessionRegistry { diff --git a/src/main/browser/browser-route-session-rekey.ts b/src/main/browser/routing/sessions/browser-route-session-rekey.ts similarity index 94% rename from src/main/browser/browser-route-session-rekey.ts rename to src/main/browser/routing/sessions/browser-route-session-rekey.ts index 4efdd6c96df..5c673b95165 100644 --- a/src/main/browser/browser-route-session-rekey.ts +++ b/src/main/browser/routing/sessions/browser-route-session-rekey.ts @@ -1,7 +1,7 @@ import type { BrowserRoutePageAuthority, BrowserRoutePageOwnerIdentity -} from './browser-route-page-authority' +} from '../guest-authority/browser-route-page-authority' import type { BrowserRouteSessionRekey, PreparedBrowserRoutePartition diff --git a/src/main/browser/browser-route-session-renderer-retirement.ts b/src/main/browser/routing/sessions/browser-route-session-renderer-retirement.ts similarity index 91% rename from src/main/browser/browser-route-session-renderer-retirement.ts rename to src/main/browser/routing/sessions/browser-route-session-renderer-retirement.ts index 76ad8435884..a4787338903 100644 --- a/src/main/browser/browser-route-session-renderer-retirement.ts +++ b/src/main/browser/routing/sessions/browser-route-session-renderer-retirement.ts @@ -1,4 +1,4 @@ -import type { BrowserRoutePageAuthority } from './browser-route-page-authority' +import type { BrowserRoutePageAuthority } from '../guest-authority/browser-route-page-authority' import type { BrowserRouteRendererPrepareFenceRegistry } from './browser-route-renderer-prepare-fence' import type { PreparedBrowserRoutePartition } from './browser-route-session-state' diff --git a/src/main/browser/browser-route-session-retirement.ts b/src/main/browser/routing/sessions/browser-route-session-retirement.ts similarity index 83% rename from src/main/browser/browser-route-session-retirement.ts rename to src/main/browser/routing/sessions/browser-route-session-retirement.ts index a3b54a5c146..9abaa85f548 100644 --- a/src/main/browser/browser-route-session-retirement.ts +++ b/src/main/browser/routing/sessions/browser-route-session-retirement.ts @@ -1,4 +1,4 @@ -import type { BrowserRoutePageAuthority } from './browser-route-page-authority' +import type { BrowserRoutePageAuthority } from '../guest-authority/browser-route-page-authority' import type { PreparedBrowserRoutePartition } from './browser-route-session-state' export function retireBrowserRouteSessionPage( diff --git a/src/main/browser/browser-route-session-runtime.ts b/src/main/browser/routing/sessions/browser-route-session-runtime.ts similarity index 83% rename from src/main/browser/browser-route-session-runtime.ts rename to src/main/browser/routing/sessions/browser-route-session-runtime.ts index a0d7c07db0f..83f32e156e3 100644 --- a/src/main/browser/browser-route-session-runtime.ts +++ b/src/main/browser/routing/sessions/browser-route-session-runtime.ts @@ -1,22 +1,22 @@ -import { BrowserClientProfileMetadata } from '../../shared/browser-client-profile-switch-protocol' +import { BrowserClientProfileMetadata } from '../../../../shared/browser-client-profile-switch-protocol' import { installBrowserRoutePartitionPolicies } from './browser-session-route-policies' import { session, webContents } from 'electron' -import { setBrowserClientRouteWebContentsProbe } from './browser-client-download-routing' -import type { BrowserRoutePartitionBindingStore } from './browser-route-partition-binding-store' +import { setBrowserClientRouteWebContentsProbe } from '../../client-hosts/file-transfers/browser-client-download-routing' +import type { BrowserRoutePartitionBindingStore } from '../partitions/browser-route-partition-binding-store' import { configureBrowserRoutePartitionBindingsForOrcaProfile, currentBrowserRoutePartitionBindingStore -} from './browser-route-partition-binding-runtime' -import { releaseEvictedBrowserRoutePartitionStorage } from './browser-route-partition-storage-dependencies' -import { isBrowserRouteGuestPopup } from './browser-route-guest-popup-ownership' -import { browserManager } from './browser-manager' +} from '../partitions/browser-route-partition-binding-runtime' +import { releaseEvictedBrowserRoutePartitionStorage } from '../partitions/browser-route-partition-storage-dependencies' +import { isBrowserRouteGuestPopup } from '../guest-authority/browser-route-guest-popup-ownership' +import { browserManager } from '../../browser-manager' import { isBrowserRoutePartitionRetainedByAnyOwner, registerBrowserRoutePartitionRetentionProbe -} from './browser-route-partition-retention' +} from '../partitions/browser-route-partition-retention' import { BrowserRouteSessionRegistry } from './browser-route-session-registry' -import { BrowserRouteWebContentsRegistry } from './browser-route-webcontents-registry' -import { browserSessionRegistry } from './browser-session-registry' +import { BrowserRouteWebContentsRegistry } from '../guest-authority/browser-route-webcontents-registry' +import { browserSessionRegistry } from '../../browser-session-registry' const routeWebContentsRegistryRef: { current: BrowserRouteWebContentsRegistry | null diff --git a/src/main/browser/browser-route-session-state.ts b/src/main/browser/routing/sessions/browser-route-session-state.ts similarity index 82% rename from src/main/browser/browser-route-session-state.ts rename to src/main/browser/routing/sessions/browser-route-session-state.ts index 2800799073c..9ca5a849229 100644 --- a/src/main/browser/browser-route-session-state.ts +++ b/src/main/browser/routing/sessions/browser-route-session-state.ts @@ -1,7 +1,7 @@ -import type { BrowserClientProfileMetadata } from '../../shared/browser-client-profile-switch-protocol' -import type { BrowserRoutePartitionIdentity } from './browser-route-identity' +import type { BrowserClientProfileMetadata } from '../../../../shared/browser-client-profile-switch-protocol' +import type { BrowserRoutePartitionIdentity } from '../partitions/browser-route-identity' import type { BrowserRoutePreparedPageLedger } from './browser-route-prepared-page-ledger' -import type { BrowserRoutePageAuthority } from './browser-route-page-authority' +import type { BrowserRoutePageAuthority } from '../guest-authority/browser-route-page-authority' import type { BrowserRouteElectronSession, BrowserRouteProxyEndpoint diff --git a/src/main/browser/browser-session-route-policies.ts b/src/main/browser/routing/sessions/browser-session-route-policies.ts similarity index 79% rename from src/main/browser/browser-session-route-policies.ts rename to src/main/browser/routing/sessions/browser-session-route-policies.ts index a7f2d0364ed..1f01ad2f07b 100644 --- a/src/main/browser/browser-session-route-policies.ts +++ b/src/main/browser/routing/sessions/browser-session-route-policies.ts @@ -1,10 +1,10 @@ import { session } from 'electron' -import type { BrowserSessionProfile } from '../../shared/browser-workspace-types' -import { isBrowserRoutePartition } from './browser-route-identity' +import type { BrowserSessionProfile } from '../../../../shared/browser-workspace-types' +import { isBrowserRoutePartition } from '../partitions/browser-route-identity' import { clearBrowserSessionPartitionPolicies, installBrowserSessionPartitionPolicies -} from './browser-session-partition-policies' +} from '../../browser-session-partition-policies' export function installBrowserRoutePartitionPolicies( profile: BrowserSessionProfile, diff --git a/src/main/ipc/browser/browser-client-host-cookie-import-ipc.ts b/src/main/ipc/browser/browser-client-host-cookie-import-ipc.ts index 6eedabb2923..3dc2a7afc52 100644 --- a/src/main/ipc/browser/browser-client-host-cookie-import-ipc.ts +++ b/src/main/ipc/browser/browser-client-host-cookie-import-ipc.ts @@ -4,8 +4,8 @@ import type { BrowserCookieImportResult } from '../../../shared/browser-workspac import { importCookieFileIntoClientRoutePartition, importCookiesIntoClientRoutePartition -} from '../../browser/browser-client-route-cookie-import' -import { clientRouteCookieImportSources } from '../../browser/client-route-cookie-import-source-store' +} from '../../browser/cookies/client-route/browser-client-route-cookie-import' +import { clientRouteCookieImportSources } from '../../browser/cookies/client-route/client-route-cookie-import-source-store' import { pickCookieFile } from '../../browser/cookies/browser-cookie-import' import { isTrustedBrowserRenderer } from './browser-renderer-trust' diff --git a/src/main/ipc/browser/browser-client-page-metadata-ipc.test.ts b/src/main/ipc/browser/browser-client-page-metadata-ipc.test.ts index a39d3b5ba31..052d8a86508 100644 --- a/src/main/ipc/browser/browser-client-page-metadata-ipc.test.ts +++ b/src/main/ipc/browser/browser-client-page-metadata-ipc.test.ts @@ -20,7 +20,7 @@ vi.mock('./browser-renderer-trust', () => ({ isTrustedBrowserRenderer: (sender: unknown) => mocks.isTrusted(sender) })) -vi.mock('../../browser/browser-client-page-metadata-transport', () => ({ +vi.mock('../../browser/client-pages/renderer/browser-client-page-metadata-transport', () => ({ publishBrowserClientPageMetadata: (environmentId: string, params: unknown) => mocks.publish(environmentId, params) })) diff --git a/src/main/ipc/browser/browser-google-cookie-clear-ipc.ts b/src/main/ipc/browser/browser-google-cookie-clear-ipc.ts index 60b1dfba9c3..82a31a6bb04 100644 --- a/src/main/ipc/browser/browser-google-cookie-clear-ipc.ts +++ b/src/main/ipc/browser/browser-google-cookie-clear-ipc.ts @@ -2,7 +2,7 @@ import { z } from 'zod' import { googleCookieClearLocalTarget, clearGoogleCookiesForLocalTarget -} from '../../browser/browser-google-cookie-clear-target' +} from '../../browser/cookies/browser-google-cookie-clear-target' import { ipcMain } from 'electron' import { isTrustedBrowserRenderer } from './browser-renderer-trust' diff --git a/src/main/ipc/browser/browser-guest-view-ipc.ts b/src/main/ipc/browser/browser-guest-view-ipc.ts index cb42f4d5eea..ac9d2f758e7 100644 --- a/src/main/ipc/browser/browser-guest-view-ipc.ts +++ b/src/main/ipc/browser/browser-guest-view-ipc.ts @@ -2,7 +2,7 @@ import { ipcMain, webContents, type IpcMainInvokeEvent } from 'electron' import { browserManager } from '../../browser/browser-manager' import { browserSiteDisplayController } from '../../browser/browser-site-display-controller' import { isBrowserPageZoomDirection } from '../../../shared/browser-page-zoom' -import { publishBrowserClientPageMetadata } from '../../browser/browser-client-page-metadata-transport' +import { publishBrowserClientPageMetadata } from '../../browser/client-pages/renderer/browser-client-page-metadata-transport' import { BrowserClientPageMetadataParams, type BrowserClientPageMetadataPublishOutcome diff --git a/src/main/ipc/browser/browser-session-profile-ipc.test.ts b/src/main/ipc/browser/browser-session-profile-ipc.test.ts index 2c40aa8fa64..13549218b2a 100644 --- a/src/main/ipc/browser/browser-session-profile-ipc.test.ts +++ b/src/main/ipc/browser/browser-session-profile-ipc.test.ts @@ -40,7 +40,7 @@ vi.mock('../../browser/browser-session-registry', () => ({ } })) -vi.mock('../../browser/paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ getPairedRuntimeBrowserClientRouteIdentity: routeIdentityMock })) diff --git a/src/main/ipc/browser/browser-session-profile-ipc.ts b/src/main/ipc/browser/browser-session-profile-ipc.ts index a2aa21fe6e1..2ba71f542ee 100644 --- a/src/main/ipc/browser/browser-session-profile-ipc.ts +++ b/src/main/ipc/browser/browser-session-profile-ipc.ts @@ -1,10 +1,10 @@ -import { retainLocalGoogleCookieClearTarget } from '../../browser/browser-google-cookie-clear-target' +import { retainLocalGoogleCookieClearTarget } from '../../browser/cookies/browser-google-cookie-clear-target' import { browserCookieImportFailure } from '../../../shared/browser-cookie-import-failure-copy' import { registerGoogleCookieClearHandlers } from './browser-google-cookie-clear-ipc' import { registerClientHostCookieImportHandlers } from './browser-client-host-cookie-import-ipc' import { BrowserWindow, ipcMain } from 'electron' import { browserSessionRegistry } from '../../browser/browser-session-registry' -import { getPairedRuntimeBrowserClientRouteIdentity } from '../../browser/paired-runtime-browser-client-host-runtime' +import { getPairedRuntimeBrowserClientRouteIdentity } from '../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' import { isTrustedBrowserRenderer } from './browser-renderer-trust' import { pickCookieFile, diff --git a/src/main/ipc/browser/browser.ts b/src/main/ipc/browser/browser.ts index 576153bc92a..317176e98dd 100644 --- a/src/main/ipc/browser/browser.ts +++ b/src/main/ipc/browser/browser.ts @@ -24,7 +24,7 @@ import type { BrowserPagePromptResponse, BrowserPagePromptResult } from '../../../shared/browser-page-prompt' -import { respondToBrowserPagePrompt } from '../../browser/browser-page-prompts' +import { respondToBrowserPagePrompt } from '../../browser/guest-lifecycle/prompts/browser-page-prompts' import { recordActiveBrowserPage } from '../../browser/extensions/browser-extension-tab-model' import { announceRegisteredBrowserExtensionTab } from '../../browser/extensions/api/tabs-lifecycle' import { registerBrowserExtensionHandlers } from './browser-extensions' @@ -126,14 +126,14 @@ export function registerBrowserHandlers(): void { } const { getSshConnectionStore } = await import('../ssh/ssh') const { requireLocalSshBrowserRouteTarget } = - await import('../../browser/local-ssh-browser-route') + await import('../../browser/routing/local-host-partitions/local-ssh-browser-route') requireLocalSshBrowserRouteTarget( getSshConnectionStore()?.listTargets(), args.targetId, args.expectedSshTargetGeneration ) const { prepareLocalSshBrowserPartition } = - await import('../../browser/local-ssh-browser-partitions') + await import('../../browser/routing/local-host-partitions/local-ssh-browser-partitions') return prepareLocalSshBrowserPartition({ targetId: args.targetId, browserProfileId: diff --git a/src/main/ipc/browser/desktop-browser-bridge-wiring.ts b/src/main/ipc/browser/desktop-browser-bridge-wiring.ts index c94b4e55b8b..19a76dcaea4 100644 --- a/src/main/ipc/browser/desktop-browser-bridge-wiring.ts +++ b/src/main/ipc/browser/desktop-browser-bridge-wiring.ts @@ -37,7 +37,7 @@ import { isRuntimeEnvironmentManuallyDisconnected } from '../runtime-environment import { setDesktopBrowserBridgeControl } from './desktop-browser-bridge-reconcile' import { markRemoteCliDrivenWorkspace } from '../../browser/desktop-browser-bridge/remote-cli-driven-workspaces' import { persistedStore } from '../ssh/ssh-ipc-context' -import { localSshBrowserTargetIdForSession } from '../../browser/local-ssh-browser-partitions' +import { localSshBrowserTargetIdForSession } from '../../browser/routing/local-host-partitions/local-ssh-browser-partitions' const ATTACH_TIMEOUT_MS = 15_000 const BRIDGE_CLIENT_ID = randomUUID() diff --git a/src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts b/src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts index 94d2d934a50..57429b4f1b9 100644 --- a/src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts +++ b/src/main/ipc/runtime-environments/runtime-environment-browser-client-host-handler.test.ts @@ -32,7 +32,7 @@ vi.mock('../../../shared/runtime-environment-store', () => ({ vi.mock('./runtime-environment-status-probe', () => ({ getRuntimeEnvironmentStatus: getRuntimeEnvironmentStatusMock })) -vi.mock('../../browser/paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ startPairedRuntimeBrowserClientHost: startHostMock, closePairedRuntimeBrowserClientHostEnvironment: closeHostMock })) diff --git a/src/main/ipc/runtime-environments/runtime-environment-browser-placement.ts b/src/main/ipc/runtime-environments/runtime-environment-browser-placement.ts index 7bc5b6e2c15..61ddcaf4124 100644 --- a/src/main/ipc/runtime-environments/runtime-environment-browser-placement.ts +++ b/src/main/ipc/runtime-environments/runtime-environment-browser-placement.ts @@ -3,8 +3,8 @@ import { resolveEnvironment } from '../../../shared/runtime-environment-store' import { closePairedRuntimeBrowserClientHostEnvironment, startPairedRuntimeBrowserClientHost -} from '../../browser/paired-runtime-browser-client-host-runtime' -import { prepareBrowserClientHostPlacement } from '../../browser/browser-client-host-placement-preparation' +} from '../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' +import { prepareBrowserClientHostPlacement } from '../../browser/client-hosts/lifecycle/browser-client-host-placement-preparation' import { isRuntimeEnvironmentManuallyDisconnected } from './runtime-environment-manual-disconnect' import { getRuntimeEnvironmentStatus } from './runtime-environment-status-probe' diff --git a/src/main/ipc/runtime-environments/runtime-environment-mobile-relay-hosts.ts b/src/main/ipc/runtime-environments/runtime-environment-mobile-relay-hosts.ts index 1a455d0df3c..59faed0bec4 100644 --- a/src/main/ipc/runtime-environments/runtime-environment-mobile-relay-hosts.ts +++ b/src/main/ipc/runtime-environments/runtime-environment-mobile-relay-hosts.ts @@ -1,7 +1,7 @@ import { pairedRuntimeBrowserClientHostId, pairedRuntimeBrowserClientHostsPage -} from '../../browser/paired-runtime-browser-client-host-runtime' +} from '../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' import { listEnvironments } from '../../../shared/runtime-environment-store' import { prepareRuntimeEnvironmentBrowserPlacement } from './runtime-environment-browser-placement' import { diff --git a/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts b/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts index 973ad597823..3d23265805e 100644 --- a/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts +++ b/src/main/ipc/runtime-environments/runtime-environment-removal-cleanup.ts @@ -1,7 +1,7 @@ import { desktopChatCreationHistory } from '../../runtime/desktop-chat-creation-history' import { revokeRemoteFilePreviewGrants } from '../../media/media-preview-protocol' -import { clearBrowserRoutePartitionStorageForEnvironment } from '../../browser/browser-route-partition-storage-runtime' -import { retireBrowserRoutePartitionStorageForEnvironment } from '../../browser/browser-route-partition-storage-retirement' +import { clearBrowserRoutePartitionStorageForEnvironment } from '../../browser/routing/partitions/browser-route-partition-storage-runtime' +import { retireBrowserRoutePartitionStorageForEnvironment } from '../../browser/routing/partitions/browser-route-partition-storage-retirement' import { clearRuntimeEnvironmentCapabilityEvidence } from './runtime-environment-capability-evidence' import { clearRuntimeEnvironmentManualDisconnect } from './runtime-environment-manual-disconnect' import { toRuntimeExecutionHostId, type ExecutionHostId } from '../../../shared/execution-host' diff --git a/src/main/ipc/runtime-environments/runtime-environment-removal-storage.test.ts b/src/main/ipc/runtime-environments/runtime-environment-removal-storage.test.ts index 1ff2c48ef83..c88ca941d04 100644 --- a/src/main/ipc/runtime-environments/runtime-environment-removal-storage.test.ts +++ b/src/main/ipc/runtime-environments/runtime-environment-removal-storage.test.ts @@ -18,7 +18,7 @@ vi.mock('../../../shared/runtime-environment-store', () => ({ resolveEnvironment: resolveEnvironmentMock })) -vi.mock('../../browser/browser-route-partition-storage-runtime', () => ({ +vi.mock('../../browser/routing/partitions/browser-route-partition-storage-runtime', () => ({ clearBrowserRoutePartitionStorageForEnvironment: clearStorageMock })) diff --git a/src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts b/src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts index 85f8ce7523e..1257a9f4b2e 100644 --- a/src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts +++ b/src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts @@ -70,7 +70,7 @@ vi.mock('./runtime-environment-request-connections', async () => { closeRemoteRuntimeRequestConnection: closeRemoteRuntimeRequestConnectionMock }) }) -vi.mock('../../browser/paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ retirePairedRuntimeBrowserClientHostEnvironment: retirePairedRuntimeBrowserClientHostEnvironmentMock })) diff --git a/src/main/ipc/runtime-environments/runtime-environments.ts b/src/main/ipc/runtime-environments/runtime-environments.ts index da4977ec71e..a2911452ea8 100644 --- a/src/main/ipc/runtime-environments/runtime-environments.ts +++ b/src/main/ipc/runtime-environments/runtime-environments.ts @@ -41,7 +41,7 @@ import { clearPublishedManagedServer } from '../ssh/ssh-renderer-broadcast' import { clearManagedServerNotes } from './runtime-environment-managed-tunnel' import { reconcileOrphanedRuntimeSessions } from './runtime-environment-session-reconcile' import { registerRuntimeSshAccessHandlers } from '../runtime-ssh-access-handlers' -import { retirePairedRuntimeBrowserClientHostEnvironment } from '../../browser/paired-runtime-browser-client-host-runtime' +import { retirePairedRuntimeBrowserClientHostEnvironment } from '../../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' import { registerRuntimeEnvironmentBrowserClientHostHandler } from './runtime-environment-browser-client-host-handler' import { advanceRuntimeEnvironmentCapabilityIncarnation } from './runtime-environment-capability-evidence' import { retireMobileDesktopRelayEnvironment } from './runtime-environment-mobile-relay-hosts' diff --git a/src/main/ipc/ssh/ssh-session-teardown.ts b/src/main/ipc/ssh/ssh-session-teardown.ts index e4fb1071101..814c2550e3f 100644 --- a/src/main/ipc/ssh/ssh-session-teardown.ts +++ b/src/main/ipc/ssh/ssh-session-teardown.ts @@ -42,8 +42,8 @@ export async function removeRegisteredSshTarget(targetId: string): Promise // Target removal also retires its scoped browser cookie storage. try { const [partitions, storage] = await Promise.all([ - import('../../browser/local-ssh-browser-partitions'), - import('../../browser/browser-route-partition-storage-runtime') + import('../../browser/routing/local-host-partitions/local-ssh-browser-partitions'), + import('../../browser/routing/partitions/browser-route-partition-storage-runtime') ]) await partitions.releaseLocalSshBrowserPartitionsForTarget(targetId) await storage.clearBrowserRoutePartitionStorageForLocalSshTarget(targetId) diff --git a/src/main/ipc/wsl/wsl-move-driver-wiring.ts b/src/main/ipc/wsl/wsl-move-driver-wiring.ts index 7cf7ecd4285..54f1b2539ae 100644 --- a/src/main/ipc/wsl/wsl-move-driver-wiring.ts +++ b/src/main/ipc/wsl/wsl-move-driver-wiring.ts @@ -24,8 +24,8 @@ import { orcadMigrationDestinationFor } from '../../managed-server/lifecycle/orc import type { Store } from '../../persistence/loading-store/store' import { exportWslMoveManifest } from '../../persistence/moving-wsl-projects/wsl-move-manifest-export' import { ensureWslMoveDestinationBrowserLogins } from '../../persistence/moving-wsl-projects/wsl-move-browser-cookie-copy' -import { activeBrowserRoutePartitionOrcaProfileId } from '../../browser/browser-route-partition-binding-runtime' -import { wslHostBrowserRouteStorage } from '../../browser/wsl-host-browser-route-partition' +import { activeBrowserRoutePartitionOrcaProfileId } from '../../browser/routing/partitions/browser-route-partition-binding-runtime' +import { wslHostBrowserRouteStorage } from '../../browser/routing/local-host-partitions/wsl-host-browser-route-partition' import { runGatedWslMoveDesktopRewritePass } from '../../persistence/moving-wsl-projects/wsl-move-desktop-rewrite' import type { WslMoveDriverDeps, diff --git a/src/main/menu/app-menu-selection-item.ts b/src/main/menu/app-menu-selection-item.ts index 1b0dcbbb4b2..5034d120ce1 100644 --- a/src/main/menu/app-menu-selection-item.ts +++ b/src/main/menu/app-menu-selection-item.ts @@ -1,5 +1,5 @@ import { BrowserWindow, Menu, webContents } from 'electron' -import { isNativeBrowserPopupWindow } from '../browser/native-browser-popup-windows' +import { isNativeBrowserPopupWindow } from '../browser/guest-lifecycle/popups/native-browser-popup-windows' export type AppMenuSelectionAction = 'copy' | 'select-all' diff --git a/src/main/menu/register-app-menu.test.ts b/src/main/menu/register-app-menu.test.ts index 4f2f8f29a0b..836b6df4551 100644 --- a/src/main/menu/register-app-menu.test.ts +++ b/src/main/menu/register-app-menu.test.ts @@ -35,7 +35,7 @@ vi.mock('electron', () => ({ })) import { getNextDefaultOnAppearanceSettingValue, registerAppMenu } from './register-app-menu' -import { markNativeBrowserPopupWindow } from '../browser/native-browser-popup-windows' +import { markNativeBrowserPopupWindow } from '../browser/guest-lifecycle/popups/native-browser-popup-windows' const isMac = process.platform === 'darwin' diff --git a/src/main/orcad/electron-serve-browser-process.ts b/src/main/orcad/electron-serve-browser-process.ts index 8613d7cca2e..44580bff9ad 100644 --- a/src/main/orcad/electron-serve-browser-process.ts +++ b/src/main/orcad/electron-serve-browser-process.ts @@ -6,7 +6,7 @@ import { BROWSER_EXPECT_URL_UNSUPPORTED_CODE, BrowserExpectedUrlMismatch } from '../../shared/browser-expected-url' -import { browserExpectedUrlMismatchError } from '../browser/browser-expected-page-url' +import { browserExpectedUrlMismatchError } from '../browser/cdp/input/browser-expected-page-url' import { setTimeout as delay } from 'node:timers/promises' import { z } from 'zod' import { BrowserError } from '../browser/browser-error' diff --git a/src/main/orcad/external-chromium-browser-process.ts b/src/main/orcad/external-chromium-browser-process.ts index 5fedc2fd54e..1ae5f6febab 100644 --- a/src/main/orcad/external-chromium-browser-process.ts +++ b/src/main/orcad/external-chromium-browser-process.ts @@ -2,7 +2,7 @@ import { z } from 'zod' import type { RuntimeBrowserCommandHost } from '../runtime/browser/browser-command-contracts' import type { RuntimeBrowserCommands } from '../runtime/browser/browser-commands' import { BrowserError } from '../browser/browser-error' -import { assertUploadFilesExist } from '../browser/browser-upload-files' +import { assertUploadFilesExist } from '../browser/cdp/input/browser-upload-files' import { agentBrowserEvalCommand, ExternalChromiumBrowserSession, @@ -22,7 +22,7 @@ import { ExternalChromiumTabRegistry } from './external-chromium-tab-registry' import { runExternalChromiumPageInput, type PageInputSession } from './external-chromium-page-input' import { agentBrowserSnapshotArgs } from '../browser/agent-browser/agent-browser-snapshot-arguments' import { Snapshot } from '../../shared/rpc-contract/browser-observation-params' -import { ExpectedPageUrlGuard } from '../browser/browser-expected-page-url' +import { ExpectedPageUrlGuard } from '../browser/cdp/input/browser-expected-page-url' const AgentBrowserCurrentUrl = z.object({ url: z.string() }) diff --git a/src/main/orcad/external-chromium-page-input.ts b/src/main/orcad/external-chromium-page-input.ts index 7c5eb5f6a8e..2485783a6fc 100644 --- a/src/main/orcad/external-chromium-page-input.ts +++ b/src/main/orcad/external-chromium-page-input.ts @@ -6,8 +6,8 @@ import { FILL_ELEMENT_FUNCTION, SELECT_ALL_ELEMENT_FUNCTION, SELECT_OPTION_TARGET_FUNCTION -} from '../browser/browser-element-functions' -import { typedInputSteps } from '../browser/cdp-keyboard-us-layout' +} from '../browser/cdp/input/browser-element-functions' +import { typedInputSteps } from '../browser/cdp/input/cdp-keyboard-us-layout' import { agentBrowserError, agentBrowserEvalCommand, diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.test.ts b/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.test.ts index 450b4af7784..cb974cb1edd 100644 --- a/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.test.ts +++ b/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.test.ts @@ -15,8 +15,8 @@ import { WSL_HOSTS_INTERNAL_GATE_ENV } from '../../../shared/wsl-host-internal-g import { parseWslMoveCutover } from '../../../shared/wsl-move/wsl-move-cutover' import { wslMoveCutoverFixture as cutover } from '../__fixtures__/wsl-mover/wsl-move-cutover-fixture' import { seedWslMoveCutover } from '../__fixtures__/wsl-mover/wsl-move-journal-seeding' -import { deriveBrowserRoutePartitionStorageScope } from '../../browser/browser-route-identity' -import { wslHostBrowserRouteStorage } from '../../browser/wsl-host-browser-route-partition' +import { deriveBrowserRoutePartitionStorageScope } from '../../browser/routing/partitions/browser-route-identity' +import { wslHostBrowserRouteStorage } from '../../browser/routing/local-host-partitions/wsl-host-browser-route-partition' import { listWslMoveCutovers } from './wsl-move-cutover-journal' import type { WslMoveBrowserCookieCopyDependencies } from './wsl-move-browser-cookie-copy' import { @@ -33,17 +33,17 @@ import { setWslMoveDesktopRewriteRegistryCompleteForTests } from './wsl-move-desktop-rewrite-stores' -vi.mock('../../browser/browser-partition-cookie-copy', () => ({ +vi.mock('../../browser/cookies/browser-partition-cookie-copy', () => ({ copyBrowserPartitionCookies: vi.fn(), flushBrowserPartitionCookies: vi.fn() })) vi.mock('../../browser/browser-session-registry', () => ({ browserSessionRegistry: {} })) vi.mock('../../browser/browser-session-startup', () => ({ browserSessionsInitialized: vi.fn() })) -vi.mock('../../browser/browser-route-partition-binding-runtime', () => ({ +vi.mock('../../browser/routing/partitions/browser-route-partition-binding-runtime', () => ({ activeBrowserRoutePartitionOrcaProfileId: vi.fn(), currentBrowserRoutePartitionBindingStore: vi.fn() })) -vi.mock('../../browser/browser-route-partition-storage-dependencies', () => ({ +vi.mock('../../browser/routing/partitions/browser-route-partition-storage-dependencies', () => ({ releaseEvictedBrowserRoutePartitionStorage: vi.fn() })) diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.ts b/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.ts index 5b9fcba5174..20eecc3ab29 100644 --- a/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.ts +++ b/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-copy.ts @@ -17,7 +17,7 @@ import type { WslMoveCutover } from '../../../shared/wsl-move/wsl-move-cutover' import type { WslHostBrowserRouteStorage, WslHostBrowserRouteStorageResult -} from '../../browser/wsl-host-browser-route-partition' +} from '../../browser/routing/local-host-partitions/wsl-host-browser-route-partition' import { listWslMoveCutovers, writeWslMoveCutover } from './wsl-move-cutover-journal' import type { WslMoveDesktopRewriteContext } from './wsl-move-desktop-rewrite-stores' diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-store.ts b/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-store.ts index 35d68a417f4..ef6018d4eb9 100644 --- a/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-store.ts +++ b/src/main/persistence/moving-wsl-projects/wsl-move-browser-cookie-store.ts @@ -5,14 +5,14 @@ import { WSL_MOVE_BROWSER_COOKIES_STORE_ID } from '../../../shared/wsl-move/wsl- import { copyBrowserPartitionCookies, flushBrowserPartitionCookies -} from '../../browser/browser-partition-cookie-copy' -import { activeBrowserRoutePartitionOrcaProfileId } from '../../browser/browser-route-partition-binding-runtime' +} from '../../browser/cookies/browser-partition-cookie-copy' +import { activeBrowserRoutePartitionOrcaProfileId } from '../../browser/routing/partitions/browser-route-partition-binding-runtime' import { browserSessionRegistry } from '../../browser/browser-session-registry' import { browserSessionsInitialized } from '../../browser/browser-session-startup' import { bindWslHostBrowserRoutePartition, wslHostBrowserRouteStorage -} from '../../browser/wsl-host-browser-route-partition' +} from '../../browser/routing/local-host-partitions/wsl-host-browser-route-partition' import { runWslMoveBrowserCookieCopy, type WslMoveBrowserCookieCopyDependencies diff --git a/src/main/persistence/moving-wsl-projects/wsl-move-registry-complete.test.ts b/src/main/persistence/moving-wsl-projects/wsl-move-registry-complete.test.ts index 4c24b5a70b9..f58eb11157a 100644 --- a/src/main/persistence/moving-wsl-projects/wsl-move-registry-complete.test.ts +++ b/src/main/persistence/moving-wsl-projects/wsl-move-registry-complete.test.ts @@ -45,17 +45,17 @@ vi.mock('electron', () => ({ safeStorage: { isEncryptionAvailable: () => false }, BrowserWindow: { getAllWindows: () => [] } })) -vi.mock('../../browser/browser-partition-cookie-copy', () => ({ +vi.mock('../../browser/cookies/browser-partition-cookie-copy', () => ({ copyBrowserPartitionCookies: vi.fn(), flushBrowserPartitionCookies: vi.fn() })) vi.mock('../../browser/browser-session-registry', () => ({ browserSessionRegistry: {} })) vi.mock('../../browser/browser-session-startup', () => ({ browserSessionsInitialized: vi.fn() })) -vi.mock('../../browser/browser-route-partition-binding-runtime', () => ({ +vi.mock('../../browser/routing/partitions/browser-route-partition-binding-runtime', () => ({ activeBrowserRoutePartitionOrcaProfileId: vi.fn(), currentBrowserRoutePartitionBindingStore: vi.fn() })) -vi.mock('../../browser/browser-route-partition-storage-dependencies', () => ({ +vi.mock('../../browser/routing/partitions/browser-route-partition-storage-dependencies', () => ({ releaseEvictedBrowserRoutePartitionStorage: vi.fn() })) diff --git a/src/main/plugins/panels/plugin-frame-blocked-requests.electron.test.ts b/src/main/plugins/panels/plugin-frame-blocked-requests.electron.test.ts index dc3db0ebe91..22d73858d3f 100644 --- a/src/main/plugins/panels/plugin-frame-blocked-requests.electron.test.ts +++ b/src/main/plugins/panels/plugin-frame-blocked-requests.electron.test.ts @@ -2,7 +2,7 @@ import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { runBrowserRouteEgressElectron } from '../../browser/browser-route-egress-electron-launch' +import { runBrowserRouteEgressElectron } from '../../browser/network/egress/browser-route-egress-electron-launch' import { isPluginFrameCancelledRequestEcho, pluginFrameCspBlock diff --git a/src/main/plugins/panels/plugin-frame-guest-clipboard.electron.test.ts b/src/main/plugins/panels/plugin-frame-guest-clipboard.electron.test.ts index 0da447f2c05..6cd4010582a 100644 --- a/src/main/plugins/panels/plugin-frame-guest-clipboard.electron.test.ts +++ b/src/main/plugins/panels/plugin-frame-guest-clipboard.electron.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { buildSync } from 'esbuild' import { afterEach, describe, expect, it } from 'vitest' -import { runBrowserRouteEgressElectron } from '../../browser/browser-route-egress-electron-launch' +import { runBrowserRouteEgressElectron } from '../../browser/network/egress/browser-route-egress-electron-launch' const roots: string[] = [] afterEach(() => { diff --git a/src/main/plugins/panels/plugin-frame-guest-egress.electron.test.ts b/src/main/plugins/panels/plugin-frame-guest-egress.electron.test.ts index 6d91e8d2382..eb4f5411a98 100644 --- a/src/main/plugins/panels/plugin-frame-guest-egress.electron.test.ts +++ b/src/main/plugins/panels/plugin-frame-guest-egress.electron.test.ts @@ -7,7 +7,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { buildSync } from 'esbuild' import { afterEach, describe, expect, it } from 'vitest' -import { runBrowserRouteEgressElectron } from '../../browser/browser-route-egress-electron-launch' +import { runBrowserRouteEgressElectron } from '../../browser/network/egress/browser-route-egress-electron-launch' const roots: string[] = [] const closers: (() => Promise)[] = [] diff --git a/src/main/plugins/panels/plugin-frame-guest-policies.ts b/src/main/plugins/panels/plugin-frame-guest-policies.ts index affb7437a6d..619bccf6ffc 100644 --- a/src/main/plugins/panels/plugin-frame-guest-policies.ts +++ b/src/main/plugins/panels/plugin-frame-guest-policies.ts @@ -1,7 +1,7 @@ import { BrowserWindow, Menu, webContents as electronWebContents } from 'electron' import type { Session, WebContents } from 'electron' import type { KeybindingOverrides } from '../../../shared/keybindings' -import { setupGuestShortcutForwarding } from '../../browser/browser-guest-shortcut-forwarding' +import { setupGuestShortcutForwarding } from '../../browser/guest-lifecycle/input/browser-guest-shortcut-forwarding' import { buildEditableContextMenuTemplate } from '../../window/editable-context-menu' import { isAllowedPluginFrameNavigation } from './plugin-frame-request-policy' diff --git a/src/main/plugins/panels/plugin-panel-webrtc.electron.test.ts b/src/main/plugins/panels/plugin-panel-webrtc.electron.test.ts index 362d94fe81c..4463d163b36 100644 --- a/src/main/plugins/panels/plugin-panel-webrtc.electron.test.ts +++ b/src/main/plugins/panels/plugin-panel-webrtc.electron.test.ts @@ -3,7 +3,7 @@ import { createServer, type Server, type Socket } from 'node:net' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it } from 'vitest' -import { runBrowserRouteEgressElectron } from '../../browser/browser-route-egress-electron-launch' +import { runBrowserRouteEgressElectron } from '../../browser/network/egress/browser-route-egress-electron-launch' import { buildPluginPanelShellHtml } from '../../../shared/plugins/frames/plugin-panel-shell' import { PLUGIN_PANEL_FRAME_NAME_PREFIX } from '../../../shared/plugins/frames/plugin-frame-bridge' diff --git a/src/main/runtime/browser-execution-host-key-resolution.test.ts b/src/main/runtime/browser-execution-host-key-resolution.test.ts index 6a91722b0bb..ac969c3790c 100644 --- a/src/main/runtime/browser-execution-host-key-resolution.test.ts +++ b/src/main/runtime/browser-execution-host-key-resolution.test.ts @@ -3,7 +3,7 @@ import { tmpdir } from 'node:os' import { join } from 'node:path' import { describe, expect, it } from 'vitest' import type { FolderWorkspace } from '../../shared/folder-workspace-types' -import { parseBrowserNetworkExecutionHostKey } from '../browser/browser-network-execution-route' +import { parseBrowserNetworkExecutionHostKey } from '../browser/network/execution-routes/browser-network-execution-route' import { OrcaRuntimeService } from './orca-runtime' // Use the real resolver: adoption retires missing workspaces but preserves pages awaiting an offline host. diff --git a/src/main/runtime/browser-host/browser-host-client-profile-switch.test.ts b/src/main/runtime/browser-host/browser-host-client-profile-switch.test.ts index 62b455da58e..58dbdc5d99c 100644 --- a/src/main/runtime/browser-host/browser-host-client-profile-switch.test.ts +++ b/src/main/runtime/browser-host/browser-host-client-profile-switch.test.ts @@ -2,13 +2,13 @@ import { DEFAULT_CLIENT_PAGE_CREATION_TIMEOUT_MS } from '../../../shared/browser import type { BrowserClientHostCommandEvent } from '../../../shared/browser-client-host-protocol' import { describe, expect, it, vi } from 'vitest' import { BrowserHostLeaseRegistry } from './browser-host-lease-registry' -import { BrowserClientHostCommandDispatcher } from '../../browser/browser-client-host-command-dispatcher' -import { createHarness } from '../../browser/browser-client-page-command-executor-test-harness' +import { BrowserClientHostCommandDispatcher } from '../../browser/client-hosts/commands/browser-client-host-command-dispatcher' +import { createHarness } from '../../browser/client-pages/execution/browser-client-page-command-executor-test-harness' import { BROWSER_CLIENT_PROFILE_SWITCH_CAPABILITY, BrowserClientProfileMetadata } from '../../../shared/browser-client-profile-switch-protocol' -import { deriveBrowserRoutePartition } from '../../browser/browser-route-identity' +import { deriveBrowserRoutePartition } from '../../browser/routing/partitions/browser-route-identity' import { setBrowserHostClientProfileResolver } from './browser-host-client-profile-metadata' async function fixture(supported = true, onClientPageReleased?: (browserPageId: string) => void) { diff --git a/src/main/runtime/browser-host/browser-host-command-result-cache.ts b/src/main/runtime/browser-host/browser-host-command-result-cache.ts index 3e5fd85e338..5ddc93c2fc4 100644 --- a/src/main/runtime/browser-host/browser-host-command-result-cache.ts +++ b/src/main/runtime/browser-host/browser-host-command-result-cache.ts @@ -1,4 +1,4 @@ -import { browserCommandCacheBytes } from '../../browser/browser-command-cache-bytes' +import { browserCommandCacheBytes } from '../../browser/client-hosts/commands/browser-command-cache-bytes' import type { resolveBrowserHostCommandCacheLimits, BrowserHostCommandPageState, diff --git a/src/main/runtime/browser-host/browser-host-command-state.ts b/src/main/runtime/browser-host/browser-host-command-state.ts index 1776424929c..18cccb4d3a6 100644 --- a/src/main/runtime/browser-host/browser-host-command-state.ts +++ b/src/main/runtime/browser-host/browser-host-command-state.ts @@ -1,7 +1,7 @@ import { BROWSER_COMMAND_CACHE_MAX_BYTES, BROWSER_COMMAND_CACHE_MAX_BYTES_PER_PAGE -} from '../../browser/browser-command-cache-bytes' +} from '../../browser/client-hosts/commands/browser-command-cache-bytes' import type { BrowserClientHostCommandEvent, BrowserClientHostCommandResult, diff --git a/src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts b/src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts index 45943ab9853..5a1bdf5884a 100644 --- a/src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts +++ b/src/main/runtime/browser-network-tunnel-paired-runtime.integration.test.ts @@ -4,8 +4,8 @@ import { createServer, connect, type Server, type Socket } from 'node:net' import { tmpdir } from 'node:os' import { join } from 'node:path' import { afterEach, describe, expect, it, vi } from 'vitest' -import { PairedRuntimeBrowserNetworkRoute } from '../browser/paired-runtime-browser-network-route' -import { PairedRuntimeBrowserHostLease } from '../browser/paired-runtime-browser-host-lease' +import { PairedRuntimeBrowserNetworkRoute } from '../browser/network/execution-routes/paired-runtime-browser-network-route' +import { PairedRuntimeBrowserHostLease } from '../browser/client-hosts/leases/paired-runtime-browser-host-lease' import { parsePairingCode } from '../../shared/pairing' import { getBrowserHostLeaseRegistry } from './browser-host/browser-host-lease-registry-instance' import { OrcaRuntimeService } from './orca-runtime' diff --git a/src/main/runtime/browser-screencast-renderer-throttle-lease.test.ts b/src/main/runtime/browser-screencast-renderer-throttle-lease.test.ts index 426fae17d1c..5e7d58f2ae6 100644 --- a/src/main/runtime/browser-screencast-renderer-throttle-lease.test.ts +++ b/src/main/runtime/browser-screencast-renderer-throttle-lease.test.ts @@ -1,6 +1,6 @@ /** Hidden host compositors must keep drawing while remote streams need guest frames. */ import { beforeEach, describe, expect, it, vi } from 'vitest' -import type { BrowserScreencastOptions } from '../browser/browser-screencast-stream-types' +import type { BrowserScreencastOptions } from '../browser/cdp/screencast/browser-screencast-stream-types' import { createScreencastHarness } from './browser-screencast-subscriber-test-harness' import { RuntimeBrowserCommands } from './browser/browser-commands' import { createSinglePageBrowserCommandsHost } from './single-page-browser-commands-host-test-double' @@ -14,7 +14,7 @@ vi.mock('electron', () => ({ ipcMain: { on: vi.fn(), removeListener: vi.fn(), handle: vi.fn(), removeHandler: vi.fn() }, webContents: { fromId: webContentsFromId } })) -vi.mock('../browser/browser-screencast-stream', () => ({ startBrowserScreencast })) +vi.mock('../browser/cdp/screencast/browser-screencast-stream', () => ({ startBrowserScreencast })) type PageStream = { options: BrowserScreencastOptions; close: () => void } diff --git a/src/main/runtime/browser-tab-create-publication.test.ts b/src/main/runtime/browser-tab-create-publication.test.ts index b75351c081b..fbb56b5f468 100644 --- a/src/main/runtime/browser-tab-create-publication.test.ts +++ b/src/main/runtime/browser-tab-create-publication.test.ts @@ -32,7 +32,7 @@ vi.mock('../ipc/browser/browser-tab-registration-wait', () => ({ waitForWorktreeTabRegistration: vi.fn() })) -vi.mock('../browser/browser-main-window-readiness', () => ({ +vi.mock('../browser/guest-lifecycle/browser-main-window-readiness', () => ({ whenBrowserMainWindowReady: async () => null })) diff --git a/src/main/runtime/browser/browser-client-page-opening.ts b/src/main/runtime/browser/browser-client-page-opening.ts index 0eb9a2fe24d..7bb424d0932 100644 --- a/src/main/runtime/browser/browser-client-page-opening.ts +++ b/src/main/runtime/browser/browser-client-page-opening.ts @@ -1,6 +1,6 @@ import { randomUUID } from 'node:crypto' import { BrowserError } from '../../browser/browser-error' -import { browserNetworkExecutionHostKey } from '../../browser/browser-network-execution-route' +import { browserNetworkExecutionHostKey } from '../../browser/network/execution-routes/browser-network-execution-route' import type { RuntimeNavigationTarget } from '../../../shared/runtime-navigation' import { BROWSER_CLIENT_AUTOMATION_HOST_CAPABILITY } from '../../../shared/browser-client-automation-protocol' import { BROWSER_HOST_WEBVIEW_CAPABILITY } from '../browser-host/browser-host-capability-selection' diff --git a/src/main/runtime/browser/browser-command-targets.ts b/src/main/runtime/browser/browser-command-targets.ts index 59ae51bab4d..c5e3d50aba9 100644 --- a/src/main/runtime/browser/browser-command-targets.ts +++ b/src/main/runtime/browser/browser-command-targets.ts @@ -1,14 +1,14 @@ import type { BrowserSnapshotOptions } from '../../../shared/rpc-contract/browser-observation-params' import type { AgentBrowserBridge } from '../../browser/agent-browser/agent-browser-bridge' import { BrowserError } from '../../browser/browser-error' -import { browserPopupPageWebContentsId } from '../../browser/browser-popup-page-id' +import { browserPopupPageWebContentsId } from '../../browser/guest-lifecycle/popups/browser-popup-page-id' import { webContents } from 'electron' import { waitForTabFirstLoad, waitForTabRegistration, waitForWorktreeTabRegistration } from '../../ipc/browser/browser-tab-registration-wait' -import { whenBrowserMainWindowReady } from '../../browser/browser-main-window-readiness' +import { whenBrowserMainWindowReady } from '../../browser/guest-lifecycle/browser-main-window-readiness' import type { BrowserSnapshotResult } from '../../../shared/runtime-types' import type { BrowserCommandTargetParams, diff --git a/src/main/runtime/browser/browser-screencast-budget.ts b/src/main/runtime/browser/browser-screencast-budget.ts index 3005d30a117..67dc6fda276 100644 --- a/src/main/runtime/browser/browser-screencast-budget.ts +++ b/src/main/runtime/browser/browser-screencast-budget.ts @@ -2,11 +2,11 @@ import type { BrowserScreencastFrameBudget, BrowserScreencastSession, BrowserScreencastViewport -} from '../../browser/browser-screencast-stream-types' +} from '../../browser/cdp/screencast/browser-screencast-stream-types' import { browserScreencastFrameBudgetsEqual, mergeBrowserScreencastFrameBudgets -} from '../../browser/browser-screencast-frame-budget' +} from '../../browser/cdp/screencast/browser-screencast-frame-budget' import type { BrowserScreencastParams, ActiveBrowserScreencastPage diff --git a/src/main/runtime/browser/browser-screencast-contracts.ts b/src/main/runtime/browser/browser-screencast-contracts.ts index 72834db9f73..e5eb2576683 100644 --- a/src/main/runtime/browser/browser-screencast-contracts.ts +++ b/src/main/runtime/browser/browser-screencast-contracts.ts @@ -3,7 +3,7 @@ import type { BrowserScreencastFrameBudget, BrowserScreencastSession, BrowserScreencastViewport -} from '../../browser/browser-screencast-stream-types' +} from '../../browser/cdp/screencast/browser-screencast-stream-types' import type { ScreencastSubscriberDeliveryState } from '../browser-screencast-ghost-subscriber-eviction' import type { RpcBinarySender } from '../rpc/rpc-binary-sender' import type { BrowserCommandTargetParams } from './browser-command-contracts' diff --git a/src/main/runtime/browser/browser-screencasts.test.ts b/src/main/runtime/browser/browser-screencasts.test.ts index 5da8fc75a01..67cccdea723 100644 --- a/src/main/runtime/browser/browser-screencasts.test.ts +++ b/src/main/runtime/browser/browser-screencasts.test.ts @@ -3,7 +3,7 @@ import type { WebContents } from 'electron' import type { BrowserScreencastOptions, BrowserScreencastSession -} from '../../browser/browser-screencast-stream-types' +} from '../../browser/cdp/screencast/browser-screencast-stream-types' import { createSinglePageBrowserCommandsHost, createStreamedGuest @@ -22,7 +22,9 @@ vi.mock('electron', () => ({ ipcMain: { on: vi.fn(), removeListener: vi.fn() }, webContents: { fromId: webContentsFromId } })) -vi.mock('../../browser/browser-screencast-stream', () => ({ startBrowserScreencast })) +vi.mock('../../browser/cdp/screencast/browser-screencast-stream', () => ({ + startBrowserScreencast +})) function createSession() { let close!: () => void diff --git a/src/main/runtime/browser/browser-screencasts.ts b/src/main/runtime/browser/browser-screencasts.ts index cdefc42b053..7a6b11aac6f 100644 --- a/src/main/runtime/browser/browser-screencasts.ts +++ b/src/main/runtime/browser/browser-screencasts.ts @@ -1,7 +1,7 @@ import type { BrowserScreencastResult } from '../../../shared/runtime-types' import { BrowserError } from '../../browser/browser-error' import { randomUUID } from 'node:crypto' -import { startBrowserScreencast } from '../../browser/browser-screencast-stream' +import { startBrowserScreencast } from '../../browser/cdp/screencast/browser-screencast-stream' import { rendererPublicationThrottle } from '../../window/renderer-publication-throttle' import { mintBrowserScreencastSubscriptionId } from '../browser-screencast-subscription-id' import { @@ -12,7 +12,7 @@ import { INITIAL_SCREENCAST_SUBSCRIBER_DELIVERY, screencastSubscriberIsGhost } from '../browser-screencast-ghost-subscriber-eviction' -import type { BrowserScreencastSession } from '../../browser/browser-screencast-stream-types' +import type { BrowserScreencastSession } from '../../browser/cdp/screencast/browser-screencast-stream-types' import type { RpcBinarySender } from '../rpc/rpc-binary-sender' import type { RuntimeBrowserCommandHost } from './browser-command-contracts' import type { RuntimeBrowserCommandTargets } from './browser-command-targets' diff --git a/src/main/runtime/orca-runtime-browser-client-hosted.test.ts b/src/main/runtime/orca-runtime-browser-client-hosted.test.ts index 5fc9cc84a5e..6238ab68402 100644 --- a/src/main/runtime/orca-runtime-browser-client-hosted.test.ts +++ b/src/main/runtime/orca-runtime-browser-client-hosted.test.ts @@ -30,7 +30,7 @@ vi.mock('electron', () => ({ webContents: { fromId: vi.fn() } })) -vi.mock('../browser/browser-screencast-stream', () => ({ +vi.mock('../browser/cdp/screencast/browser-screencast-stream', () => ({ startBrowserScreencast: startBrowserScreencastMock })) @@ -39,7 +39,7 @@ vi.mock('../ipc/browser/browser-tab-registration-wait', () => ({ waitForWorktreeTabRegistration: vi.fn() })) -vi.mock('../browser/browser-main-window-readiness', () => ({ +vi.mock('../browser/guest-lifecycle/browser-main-window-readiness', () => ({ whenBrowserMainWindowReady: async () => null })) diff --git a/src/main/runtime/orca-runtime-browser-headless.test.ts b/src/main/runtime/orca-runtime-browser-headless.test.ts index 476601add18..fd50e383bf7 100644 --- a/src/main/runtime/orca-runtime-browser-headless.test.ts +++ b/src/main/runtime/orca-runtime-browser-headless.test.ts @@ -54,7 +54,7 @@ vi.mock('../ipc/browser/browser-tab-registration-wait', () => ({ waitForWorktreeTabRegistration: waitForWorktreeTabRegistrationMock })) -vi.mock('../browser/browser-main-window-readiness', () => ({ +vi.mock('../browser/guest-lifecycle/browser-main-window-readiness', () => ({ whenBrowserMainWindowReady: async () => null })) diff --git a/src/main/runtime/orca-runtime-browser-screencast-e2ee-backlog.test.ts b/src/main/runtime/orca-runtime-browser-screencast-e2ee-backlog.test.ts index c10075ab96f..fc7e97da799 100644 --- a/src/main/runtime/orca-runtime-browser-screencast-e2ee-backlog.test.ts +++ b/src/main/runtime/orca-runtime-browser-screencast-e2ee-backlog.test.ts @@ -25,7 +25,7 @@ vi.mock('electron', () => ({ ipcMain: { on: vi.fn(), removeListener: vi.fn() }, webContents: { fromId: webContentsFromId } })) -vi.mock('../browser/browser-screencast-stream', () => ({ startBrowserScreencast })) +vi.mock('../browser/cdp/screencast/browser-screencast-stream', () => ({ startBrowserScreencast })) vi.mock('../telemetry/client', () => ({ track: vi.fn() })) function connectLegacyChannel() { diff --git a/src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts b/src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts index bd72915689e..f6d0863a494 100644 --- a/src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts +++ b/src/main/runtime/orca-runtime-browser-screencast-fanout.test.ts @@ -16,7 +16,7 @@ vi.mock('electron', () => ({ ipcMain: { on: vi.fn(), removeListener: vi.fn() }, webContents: { fromId: webContentsFromId } })) -vi.mock('../browser/browser-screencast-stream', () => ({ startBrowserScreencast })) +vi.mock('../browser/cdp/screencast/browser-screencast-stream', () => ({ startBrowserScreencast })) function deferred() { let resolve!: () => void diff --git a/src/main/runtime/orca-runtime-browser-screencast-pending-frame-retry.test.ts b/src/main/runtime/orca-runtime-browser-screencast-pending-frame-retry.test.ts index 9be1d5ebb0b..28df4b9254e 100644 --- a/src/main/runtime/orca-runtime-browser-screencast-pending-frame-retry.test.ts +++ b/src/main/runtime/orca-runtime-browser-screencast-pending-frame-retry.test.ts @@ -16,7 +16,7 @@ vi.mock('electron', () => ({ ipcMain: { on: vi.fn(), removeListener: vi.fn() }, webContents: { fromId: webContentsFromId } })) -vi.mock('../browser/browser-screencast-stream', () => ({ startBrowserScreencast })) +vi.mock('../browser/cdp/screencast/browser-screencast-stream', () => ({ startBrowserScreencast })) async function subscribe(sendBinary: RpcBinarySender) { const { RuntimeBrowserCommands } = await import('./browser/browser-commands') diff --git a/src/main/runtime/orca-runtime-browser.test.ts b/src/main/runtime/orca-runtime-browser.test.ts index 5b714387f71..5684040a2a0 100644 --- a/src/main/runtime/orca-runtime-browser.test.ts +++ b/src/main/runtime/orca-runtime-browser.test.ts @@ -56,7 +56,7 @@ vi.mock('electron', () => ({ webContents: { fromId: webContentsFromIdMock } })) -vi.mock('../browser/browser-screencast-stream', () => ({ +vi.mock('../browser/cdp/screencast/browser-screencast-stream', () => ({ startBrowserScreencast: startBrowserScreencastMock })) @@ -65,7 +65,7 @@ vi.mock('../ipc/browser/browser-tab-registration-wait', () => ({ waitForWorktreeTabRegistration: waitForWorktreeTabRegistrationMock })) -vi.mock('../browser/browser-main-window-readiness', () => ({ +vi.mock('../browser/guest-lifecycle/browser-main-window-readiness', () => ({ whenBrowserMainWindowReady: whenBrowserMainWindowReadyMock })) diff --git a/src/main/runtime/remote-browser-screencast-frame-admission.test.ts b/src/main/runtime/remote-browser-screencast-frame-admission.test.ts index 807b93cebcc..a56366766c5 100644 --- a/src/main/runtime/remote-browser-screencast-frame-admission.test.ts +++ b/src/main/runtime/remote-browser-screencast-frame-admission.test.ts @@ -4,7 +4,7 @@ import { describe, expect, it, vi } from 'vitest' import { deriveSharedKey, encrypt, generateKeyPair } from '../../shared/e2ee-crypto' import { REMOTE_RUNTIME_MAX_OUTBOUND_BINARY_FRAME_BYTES } from '../../shared/remote-runtime/remote-runtime-memory-limits' -import { startBrowserScreencast } from '../browser/browser-screencast-stream' +import { startBrowserScreencast } from '../browser/cdp/screencast/browser-screencast-stream' import { E2EEChannel } from './rpc/e2ee-channel' import { sendRemoteBrowserScreencastFrame } from './remote-browser-screencast-frame-admission' import type { RpcBinarySender } from './rpc/rpc-binary-sender' diff --git a/src/main/runtime/rpc/methods/browser-network-tunnel.test.ts b/src/main/runtime/rpc/methods/browser-network-tunnel.test.ts index 9f326232296..73f73959bcf 100644 --- a/src/main/runtime/rpc/methods/browser-network-tunnel.test.ts +++ b/src/main/runtime/rpc/methods/browser-network-tunnel.test.ts @@ -8,12 +8,12 @@ import { import { getBrowserHostLeaseRegistry } from '../../browser-host/browser-host-lease-registry-instance' import type { BrowserHostLease } from '../../browser-host/browser-host-lease-records' import type { OrcaRuntimeService } from '../../orca-runtime' -import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from '../../../browser/browser-network-tunnel-outbound-memory-budget' +import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from '../../../browser/network/tunnels/browser-network-tunnel-outbound-memory-budget' import { browserNetworkExecutionHostKey, type BrowserNetworkExecutionRoute, type BrowserNetworkExecutionRouteResolver -} from '../../../browser/browser-network-execution-route' +} from '../../../browser/network/execution-routes/browser-network-execution-route' import { RpcDispatcher } from '../dispatcher' import { BROWSER_NETWORK_TUNNEL_METHODS, diff --git a/src/main/runtime/rpc/methods/browser-network-tunnel.ts b/src/main/runtime/rpc/methods/browser-network-tunnel.ts index c2820667206..e0ce0a965ec 100644 --- a/src/main/runtime/rpc/methods/browser-network-tunnel.ts +++ b/src/main/runtime/rpc/methods/browser-network-tunnel.ts @@ -1,10 +1,10 @@ -import { BrowserNetworkTunnelSession } from '../../../browser/browser-network-tunnel-session' -import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from '../../../browser/browser-network-tunnel-outbound-memory-budget' +import { BrowserNetworkTunnelSession } from '../../../browser/network/tunnels/browser-network-tunnel-session' +import { BrowserNetworkTunnelOutboundMemoryBudgetRegistry } from '../../../browser/network/tunnels/browser-network-tunnel-outbound-memory-budget' import { browserNetworkExecutionHostKey, type BrowserNetworkExecutionRouteResolver -} from '../../../browser/browser-network-execution-route' -import { resolveBrowserNetworkExecutionRoute } from '../../../browser/browser-network-execution-route-dispatch' +} from '../../../browser/network/execution-routes/browser-network-execution-route' +import { resolveBrowserNetworkExecutionRoute } from '../../../browser/network/execution-routes/browser-network-execution-route-dispatch' import { BrowserNetworkTunnelAttachParams } from '../../../../shared/browser-client-host-protocol' import { BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, diff --git a/src/main/runtime/runtime-browser-client-automation.ts b/src/main/runtime/runtime-browser-client-automation.ts index 052ecbe9047..493d0d143b8 100644 --- a/src/main/runtime/runtime-browser-client-automation.ts +++ b/src/main/runtime/runtime-browser-client-automation.ts @@ -1,5 +1,5 @@ import { BrowserClientAutomationMethod } from '../../shared/browser-client-automation-protocol' -import { browserExpectedUrlMismatchError } from '../browser/browser-expected-page-url' +import { browserExpectedUrlMismatchError } from '../browser/cdp/input/browser-expected-page-url' import type { BrowserHostLeaseRegistry } from './browser-host/browser-host-lease-registry' import type { RuntimeBrowserPageRegistry } from './runtime-browser-page-registry' diff --git a/src/main/runtime/runtime-browser-client-page-creation.ts b/src/main/runtime/runtime-browser-client-page-creation.ts index 992cbda868c..849db93f199 100644 --- a/src/main/runtime/runtime-browser-client-page-creation.ts +++ b/src/main/runtime/runtime-browser-client-page-creation.ts @@ -1,6 +1,6 @@ import type { BrowserNetworkExecutionHost } from '../../shared/browser-network-execution-host' import { BROWSER_CLIENT_AUTOMATION_HOST_CAPABILITY } from '../../shared/browser-client-automation-protocol' -import { browserNetworkExecutionHostKey } from '../browser/browser-network-execution-route' +import { browserNetworkExecutionHostKey } from '../browser/network/execution-routes/browser-network-execution-route' import type { BrowserHostLeaseRegistry } from './browser-host/browser-host-lease-registry' import type { RuntimeBrowserClientPlacement } from '../../shared/runtime-browser-placement' diff --git a/src/main/runtime/runtime-edge-command-controller.test.ts b/src/main/runtime/runtime-edge-command-controller.test.ts index ac9b83ac10f..4b05b889fb7 100644 --- a/src/main/runtime/runtime-edge-command-controller.test.ts +++ b/src/main/runtime/runtime-edge-command-controller.test.ts @@ -1,5 +1,5 @@ import { afterEach, expect, it } from 'vitest' -import { getRequestedPageUrl } from '../browser/browser-expected-page-url' +import { getRequestedPageUrl } from '../browser/cdp/input/browser-expected-page-url' import type { RuntimeBrowserCommands } from './browser/browser-commands' import { setRuntimeBrowserCommandsFactory } from './runtime-browser-commands-factory' import { RuntimeEdgeCommandController } from './runtime-edge-command-controller' diff --git a/src/main/runtime/runtime-edge-command-controller.ts b/src/main/runtime/runtime-edge-command-controller.ts index 4c3cab1dd86..4848a128434 100644 --- a/src/main/runtime/runtime-edge-command-controller.ts +++ b/src/main/runtime/runtime-edge-command-controller.ts @@ -1,5 +1,5 @@ import type { BrowserScreencastResult } from '../../shared/runtime-types' -import { runWithRequestedPageUrl } from '../browser/browser-expected-page-url' +import { runWithRequestedPageUrl } from '../browser/cdp/input/browser-expected-page-url' import type { RuntimeBrowserCommandHost } from './browser/browser-command-contracts' import type { RuntimeBrowserCommands } from './browser/browser-commands' import { RuntimeEmulatorCommands } from './orca-runtime-emulator' diff --git a/src/main/runtime/session-graph/session-graph-authority.ts b/src/main/runtime/session-graph/session-graph-authority.ts index 733a8aaa4b2..445e5837ac7 100644 --- a/src/main/runtime/session-graph/session-graph-authority.ts +++ b/src/main/runtime/session-graph/session-graph-authority.ts @@ -27,7 +27,7 @@ import type { TerminalWorkspaceLaunchScope } from '../runtime-legacy-worker-term import { folderWorkspaceKey, parseWorkspaceKey } from '../../../shared/workspace-scope' import type { ResolvedWorktree } from '../runtime-worktree-path-identity' import type { BrowserExecutionHostKeyResolution } from '../runtime-browser-client-page-adoption' -import { browserNetworkExecutionHostKey } from '../../browser/browser-network-execution-route' +import { browserNetworkExecutionHostKey } from '../../browser/network/execution-routes/browser-network-execution-route' import type { ClientHostedBrowserRpcRoute } from '../runtime-browser-client-automation' import { routeRuntimeBrowserClientAutomation } from '../runtime-browser-client-automation' import { getRuntimeBrowserPageRegistry } from '../runtime-browser-page-registry' diff --git a/src/main/startup/main-process-quit-pending-writer.test.ts b/src/main/startup/main-process-quit-pending-writer.test.ts index b6d43e37a5e..b441388b474 100644 --- a/src/main/startup/main-process-quit-pending-writer.test.ts +++ b/src/main/startup/main-process-quit-pending-writer.test.ts @@ -33,7 +33,7 @@ const dependencies: Record> = { }, '../runtime/files/watch/file-watcher-leases': { awaitRuntimeFileWatcherUnsubscribes: settled() }, '../runtime/runtime-metadata': { clearRuntimeMetadataIfOwned: idle() }, - '../browser/paired-runtime-browser-client-host-runtime': { + '../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime': { shutdownPairedRuntimeBrowserClientHosts: settled() }, '../ipc/browser/desktop-browser-bridge-wiring': { disposeDesktopBrowserBridge: idle() }, @@ -42,7 +42,9 @@ const dependencies: Record> = { browserManager: { setBrowserGuestStateChangedListener: idle(), setOffscreenTabOpener: idle() } }, '../browser/browser-session-registry': { browserSessionRegistry: {} }, - '../browser/local-ssh-browser-route': { closeAllLocalSshBrowserRoutes: settled() }, + '../browser/routing/local-host-partitions/local-ssh-browser-route': { + closeAllLocalSshBrowserRoutes: settled() + }, '../codex/codex-state-db-backfill-recovery': { stopCodexStateDbBackfillRecoveries: settled() }, '../codex/codex-account-session-bridge': { stopCodexAccountSessionBridges: idle() }, '../git/refs/maintenance/local-repo-ref-maintenance': { awaitPackedRefsLockRelease: settled() }, diff --git a/src/main/startup/main-process-quit-update-veto.test.ts b/src/main/startup/main-process-quit-update-veto.test.ts index 6387f5cb908..b145d44c8ef 100644 --- a/src/main/startup/main-process-quit-update-veto.test.ts +++ b/src/main/startup/main-process-quit-update-veto.test.ts @@ -22,7 +22,7 @@ const dependencyExports: [string, string[]][] = [ ['../runtime/files/watch/file-watcher-leases', ['awaitRuntimeFileWatcherUnsubscribes']], ['../runtime/runtime-metadata', ['clearRuntimeMetadataIfOwned']], [ - '../browser/paired-runtime-browser-client-host-runtime', + '../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', ['shutdownPairedRuntimeBrowserClientHosts'] ], ['../ipc/browser/desktop-browser-bridge-wiring', ['disposeDesktopBrowserBridge']], diff --git a/src/main/startup/main-process-quit.ts b/src/main/startup/main-process-quit.ts index 4ff22b7d43b..9688f502bee 100644 --- a/src/main/startup/main-process-quit.ts +++ b/src/main/startup/main-process-quit.ts @@ -14,7 +14,7 @@ import { stopStructuredAgentSessionRuntime } from '../runtime/agent-session/stru import { setStructuredAgentSessionTeardownTrigger } from '../runtime/agent-session/structured-agent-session-runtime-teardown' import { awaitRuntimeFileWatcherUnsubscribes } from '../runtime/files/watch/file-watcher-leases' import { clearRuntimeMetadataIfOwned } from '../runtime/runtime-metadata' -import { shutdownPairedRuntimeBrowserClientHosts } from '../browser/paired-runtime-browser-client-host-runtime' +import { shutdownPairedRuntimeBrowserClientHosts } from '../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime' import { disposeDesktopBrowserBridge } from '../ipc/browser/desktop-browser-bridge-wiring' import { browserManager } from '../browser/browser-manager' import { stopCodexStateDbBackfillRecoveries } from '../codex/codex-state-db-backfill-recovery' @@ -196,9 +196,10 @@ function installWillQuitHandler(): void { await state.runtime?.getAgentBrowserBridge()?.destroyAllSessions() })() // Local SSH browser routes own loopback listeners and ssh -N -D children that must not outlive the app (P2-4). - const localSshRouteShutdown = import('../browser/local-ssh-browser-route') - .then((routes) => routes.closeAllLocalSshBrowserRoutes()) - .catch(() => {}) + const localSshRouteShutdown = + import('../browser/routing/local-host-partitions/local-ssh-browser-route') + .then((routes) => routes.closeAllLocalSshBrowserRoutes()) + .catch(() => {}) browserManager.setBrowserGuestStateChangedListener(null) browserManager.setOffscreenTabOpener(null) const emulatorShutdown = diff --git a/src/main/startup/main-process-ready-duplicate-pty-repair.test.ts b/src/main/startup/main-process-ready-duplicate-pty-repair.test.ts index be34d05a323..19d703f1a3d 100644 --- a/src/main/startup/main-process-ready-duplicate-pty-repair.test.ts +++ b/src/main/startup/main-process-ready-duplicate-pty-repair.test.ts @@ -89,7 +89,7 @@ vi.mock('../runtime/rpc/dispatcher', () => ({ RpcDispatcher: class {} })) vi.mock('../browser/browser-manager', () => ({ browserManager: { setBrowserGuestStateChangedListener: vi.fn(), setOffscreenTabOpener: vi.fn() } })) -vi.mock('../browser/browser-client-page-automation-runtime', () => ({ +vi.mock('../browser/client-pages/execution/browser-client-page-automation-runtime', () => ({ configureBrowserClientPageAutomationRuntime: vi.fn() })) vi.mock('../crash-reporting/process-gone-diagnostics', () => ({ diff --git a/src/main/startup/main-process-ready-foundation.ts b/src/main/startup/main-process-ready-foundation.ts index 6406cb1215f..5613064c0d3 100644 --- a/src/main/startup/main-process-ready-foundation.ts +++ b/src/main/startup/main-process-ready-foundation.ts @@ -4,7 +4,7 @@ import { applyElectronProxySettings } from '../network/proxy-settings' import { installElectronProxyRequestGuard } from '../network/electron-proxy-request-guard' import { handleElectronProxyLogin } from '../network/electron-proxy-credentials' import { setNodeDistMirrorSettingReader } from '../node-runtime/node-dist-mirror-setting' -import { handleBrowserGuestLogin } from '../browser/browser-http-auth-prompt' +import { handleBrowserGuestLogin } from '../browser/guest-lifecycle/prompts/browser-http-auth-prompt' import { installMainThreadHangWatchdog } from '../hang-watchdog/main-thread-hang-watchdog' import { preservePreviousHangDetection } from '../hang-watchdog/previous-hang-detection' import { browserCertificateTrustController, browserManager } from '../browser/browser-manager' @@ -18,7 +18,7 @@ import { startWslHostsPolicyLiveUpdates } from '../wsl/host-lifecycle/wsl-hosts- import { runPendingWslDriveUncConversions } from '../wsl/filesystem/wsl-drive-unc-conversion-startup' import { createProfileStateStoreForStartup } from '../persistence/profile-state/profile-state-startup-authority' import { getProfileUserDataPath } from '../orca-profiles/profile-storage-paths' -import { initializeBrowserClientHostId } from '../browser/browser-client-host-id' +import { initializeBrowserClientHostId } from '../browser/client-hosts/lifecycle/browser-client-host-id' import { scheduleSecretProtectionGapReport } from '../host/deferred-secret-protection-report' import { withholdUnreachableKeychainForServe } from '../host/serve-keychain-guard' import { initSshHostKeyStoreFile } from '../ssh/ssh-host-key-store' diff --git a/src/main/startup/main-process-ready-identity-write.test.ts b/src/main/startup/main-process-ready-identity-write.test.ts index f8596dca84a..83fd59cc832 100644 --- a/src/main/startup/main-process-ready-identity-write.test.ts +++ b/src/main/startup/main-process-ready-identity-write.test.ts @@ -133,7 +133,9 @@ vi.mock('../orca-profiles/profile-index-store', () => ({ dataFile: join(mocks.profileDirectory, 'data.json') }) })) -vi.mock('../browser/browser-client-host-id', () => ({ initializeBrowserClientHostId: vi.fn() })) +vi.mock('../browser/client-hosts/lifecycle/browser-client-host-id', () => ({ + initializeBrowserClientHostId: vi.fn() +})) vi.mock('../host/deferred-secret-protection-report', () => ({ scheduleSecretProtectionGapReport: vi.fn() })) @@ -175,13 +177,13 @@ vi.mock('../media/media-preview-protocol', () => ({ installMediaPreviewProtocolH vi.mock('../ipc/doc-preview-grant-ipc', () => ({ registerDocPreviewGrantHandlers: vi.fn() })) // Keep registry/startup real through meta load, retired-choice inspection and identity write; stub only surrounding route/policy/cookie machinery. -vi.mock('../browser/browser-route-session-runtime', () => ({ +vi.mock('../browser/routing/sessions/browser-route-session-runtime', () => ({ configureRouteSessionsForOrcaProfile: vi.fn() })) -vi.mock('../browser/paired-runtime-browser-client-host-runtime', () => ({ +vi.mock('../browser/client-hosts/lifecycle/paired-runtime-browser-client-host-runtime', () => ({ configurePairedRuntimeBrowserClientHostsForOrcaProfile: vi.fn() })) -vi.mock('../browser/browser-route-partition-storage-runtime', () => ({ +vi.mock('../browser/routing/partitions/browser-route-partition-storage-runtime', () => ({ collectOrphanedBrowserRoutePartitionStorage: vi.fn(async () => {}) })) vi.mock('../browser/browser-session-partition-policies', () => ({ @@ -194,7 +196,7 @@ vi.mock('../browser/browser-session-cookie-staging', () => ({ clearPendingBrowserCookieImport: vi.fn(), setPendingBrowserCookieImport: vi.fn() })) -vi.mock('../browser/browser-session-route-policies', () => ({ +vi.mock('../browser/routing/sessions/browser-session-route-policies', () => ({ installBrowserRoutePartitionPolicies: vi.fn(), clearBrowserRoutePartitionPolicies: vi.fn() })) diff --git a/src/main/startup/main-process-ready-runtime.ts b/src/main/startup/main-process-ready-runtime.ts index 14fe73871ab..daaac0d0ade 100644 --- a/src/main/startup/main-process-ready-runtime.ts +++ b/src/main/startup/main-process-ready-runtime.ts @@ -6,9 +6,9 @@ import { AgentBrowserBridge } from '../browser/agent-browser/agent-browser-bridg import { EmulatorBridge } from '../emulator/emulator-bridge' import { RpcDispatcher } from '../runtime/rpc/dispatcher' import { browserManager } from '../browser/browser-manager' -import { configureBrowserClientPageAutomationRuntime } from '../browser/browser-client-page-automation-runtime' +import { configureBrowserClientPageAutomationRuntime } from '../browser/client-pages/execution/browser-client-page-automation-runtime' import { BrowserExpectedUrlMismatch } from '../../shared/browser-expected-url' -import { BrowserClientPageCommandError } from '../browser/browser-client-page-command-failure' +import { BrowserClientPageCommandError } from '../browser/client-pages/execution/browser-client-page-command-failure' import { startPreGoneCrashSampling } from '../crash-reporting/process-gone-diagnostics' import { refuseRealtimeSchedulingUnderZeroRtTime } from './linux-realtime-scheduling-guard' import { recordProcessGoneCrash } from './main-window-lifecycle-flags' diff --git a/src/main/startup/main-window-actions-menu-target.test.ts b/src/main/startup/main-window-actions-menu-target.test.ts index 71d08224596..f08e1911ac4 100644 --- a/src/main/startup/main-window-actions-menu-target.test.ts +++ b/src/main/startup/main-window-actions-menu-target.test.ts @@ -26,7 +26,7 @@ vi.mock('../window/renderer-launch-failure-probe', () => ({ probeRendererLaunchC import { sendOpenCrashReport, sendOpenFeatureTour, sendOpenSetupGuide } from './main-window-actions' import { mainProcessState as state } from './main-process-state' -import { markNativeBrowserPopupWindow } from '../browser/native-browser-popup-windows' +import { markNativeBrowserPopupWindow } from '../browser/guest-lifecycle/popups/native-browser-popup-windows' import { getDashboardPopoutWindow } from '../window/dashboard-popout-window' import { getWorkspaceSpaceWindow } from '../window/workspace-space-window' import { safelyRevealWindow } from '../window/focus-existing-window' diff --git a/src/main/startup/main-window-actions.ts b/src/main/startup/main-window-actions.ts index 4cb85df382d..535b025c0ab 100644 --- a/src/main/startup/main-window-actions.ts +++ b/src/main/startup/main-window-actions.ts @@ -8,7 +8,7 @@ import { type Tray, type WebContents } from 'electron' -import { isNativeBrowserPopupWindow } from '../browser/native-browser-popup-windows' +import { isNativeBrowserPopupWindow } from '../browser/guest-lifecycle/popups/native-browser-popup-windows' import type { UpdateCheckOptions } from '../../shared/update-status-types' import type { AppMenuQuitHandlers } from '../menu/app-menu-quit-item' import type { createWebContentsTimedFlag } from './web-contents-timed-flag' diff --git a/src/main/window/createMainWindow-close-confirmation.test.ts b/src/main/window/createMainWindow-close-confirmation.test.ts index 1885fd980b4..b5f751d7c25 100644 --- a/src/main/window/createMainWindow-close-confirmation.test.ts +++ b/src/main/window/createMainWindow-close-confirmation.test.ts @@ -12,7 +12,7 @@ vi.mock('./desktop-integration/app-icon', async () => vi.mock('../browser/browser-manager', async () => (await import('./createMainWindow-test-harness')).browserManagerMock() ) -vi.mock('../browser/browser-route-session-runtime', async () => { +vi.mock('../browser/routing/sessions/browser-route-session-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { browserRouteSessionRegistry: { isAllowedPartition: harness.routePartitionAllowedMock }, @@ -22,7 +22,7 @@ vi.mock('../browser/browser-route-session-runtime', async () => { } } }) -vi.mock('../browser/browser-client-page-renderer-runtime', async () => { +vi.mock('../browser/client-pages/renderer/browser-client-page-renderer-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { attachBrowserClientPageRenderer: harness.attachClientPageRendererMock, diff --git a/src/main/window/createMainWindow-low-commit-oom-recovery.test.ts b/src/main/window/createMainWindow-low-commit-oom-recovery.test.ts index e0121ec9fd4..ac621b9597c 100644 --- a/src/main/window/createMainWindow-low-commit-oom-recovery.test.ts +++ b/src/main/window/createMainWindow-low-commit-oom-recovery.test.ts @@ -12,7 +12,7 @@ vi.mock('./desktop-integration/app-icon', async () => vi.mock('../browser/browser-manager', async () => (await import('./createMainWindow-test-harness')).browserManagerMock() ) -vi.mock('../browser/browser-client-page-renderer-runtime', async () => { +vi.mock('../browser/client-pages/renderer/browser-client-page-renderer-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { attachBrowserClientPageRenderer: harness.attachClientPageRendererMock, diff --git a/src/main/window/createMainWindow-recovery-reload-watchdog.test.ts b/src/main/window/createMainWindow-recovery-reload-watchdog.test.ts index aa20a9da85a..93cc645ae61 100644 --- a/src/main/window/createMainWindow-recovery-reload-watchdog.test.ts +++ b/src/main/window/createMainWindow-recovery-reload-watchdog.test.ts @@ -21,7 +21,7 @@ vi.mock('./desktop-integration/app-icon', async () => vi.mock('../browser/browser-manager', async () => (await import('./createMainWindow-test-harness')).browserManagerMock() ) -vi.mock('../browser/browser-client-page-renderer-runtime', async () => { +vi.mock('../browser/client-pages/renderer/browser-client-page-renderer-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { attachBrowserClientPageRenderer: harness.attachClientPageRendererMock, diff --git a/src/main/window/createMainWindow-renderer-crash-recovery.test.ts b/src/main/window/createMainWindow-renderer-crash-recovery.test.ts index c88917fde9c..24f2faaa573 100644 --- a/src/main/window/createMainWindow-renderer-crash-recovery.test.ts +++ b/src/main/window/createMainWindow-renderer-crash-recovery.test.ts @@ -12,7 +12,7 @@ vi.mock('./desktop-integration/app-icon', async () => vi.mock('../browser/browser-manager', async () => (await import('./createMainWindow-test-harness')).browserManagerMock() ) -vi.mock('../browser/browser-client-page-renderer-runtime', async () => { +vi.mock('../browser/client-pages/renderer/browser-client-page-renderer-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { attachBrowserClientPageRenderer: harness.attachClientPageRendererMock, diff --git a/src/main/window/createMainWindow-renderer-launch-failure.test.ts b/src/main/window/createMainWindow-renderer-launch-failure.test.ts index 9f0b1c83ca8..18359bdbee6 100644 --- a/src/main/window/createMainWindow-renderer-launch-failure.test.ts +++ b/src/main/window/createMainWindow-renderer-launch-failure.test.ts @@ -12,7 +12,7 @@ vi.mock('./desktop-integration/app-icon', async () => vi.mock('../browser/browser-manager', async () => (await import('./createMainWindow-test-harness')).browserManagerMock() ) -vi.mock('../browser/browser-client-page-renderer-runtime', async () => { +vi.mock('../browser/client-pages/renderer/browser-client-page-renderer-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { attachBrowserClientPageRenderer: harness.attachClientPageRendererMock, diff --git a/src/main/window/createMainWindow.test.ts b/src/main/window/createMainWindow.test.ts index cb23d4e4d6e..44ae61834ec 100644 --- a/src/main/window/createMainWindow.test.ts +++ b/src/main/window/createMainWindow.test.ts @@ -12,7 +12,7 @@ vi.mock('./desktop-integration/app-icon', async () => vi.mock('../browser/browser-manager', async () => (await import('./createMainWindow-test-harness')).browserManagerMock() ) -vi.mock('../browser/browser-route-session-runtime', async () => ({ +vi.mock('../browser/routing/sessions/browser-route-session-runtime', async () => ({ browserRouteSessionRegistry: { isAllowedPartition: (await import('./createMainWindow-test-harness')).routePartitionAllowedMock }, @@ -20,10 +20,10 @@ vi.mock('../browser/browser-route-session-runtime', async () => ({ attachGuest: (await import('./createMainWindow-test-harness')).attachRouteGuestMock } })) -vi.mock('../browser/browser-javascript-dialogs', () => ({ +vi.mock('../browser/guest-lifecycle/prompts/browser-javascript-dialogs', () => ({ installBrowserJavaScriptDialogs: vi.fn() })) -vi.mock('../browser/browser-client-page-renderer-runtime', async () => { +vi.mock('../browser/client-pages/renderer/browser-client-page-renderer-runtime', async () => { const harness = await import('./createMainWindow-test-harness') return { attachBrowserClientPageRenderer: harness.attachClientPageRendererMock, @@ -33,7 +33,7 @@ vi.mock('../browser/browser-client-page-renderer-runtime', async () => { import { createMainWindow, loadMainWindow } from './createMainWindow' import { ipcMain } from 'electron' -import { getBrowserClientHostId } from '../browser/browser-client-host-id' +import { getBrowserClientHostId } from '../browser/client-hosts/lifecycle/browser-client-host-id' import { formatBrowserClientHostIdArgument, readBrowserClientHostIdArgument diff --git a/src/main/window/createMainWindow.ts b/src/main/window/createMainWindow.ts index 5e60ee6f91d..01b3fe272da 100644 --- a/src/main/window/createMainWindow.ts +++ b/src/main/window/createMainWindow.ts @@ -3,7 +3,7 @@ import { release } from 'node:os' import { join } from 'node:path' import { getAppIconPath } from './desktop-integration/app-icon' import { browserManager } from '../browser/browser-manager' -import { getBrowserClientHostId } from '../browser/browser-client-host-id' +import { getBrowserClientHostId } from '../browser/client-hosts/lifecycle/browser-client-host-id' import { formatBrowserClientHostIdArgument } from '../../shared/browser-client-host-id-argument' import { formatWindowMaterialArgument, resolveWindowMaterial } from '../../shared/window-material' import { windowMaterialOptions } from './window-material-options' diff --git a/src/main/window/main-window-focus-lifecycle.ts b/src/main/window/main-window-focus-lifecycle.ts index 544dca29c17..e1636afca5d 100644 --- a/src/main/window/main-window-focus-lifecycle.ts +++ b/src/main/window/main-window-focus-lifecycle.ts @@ -18,11 +18,11 @@ import { } from './editable-context-menu' import { createEditableContextMenuPopup } from './editable-context-menu-popup' import type { CreateMainWindowOptions, MainWindowLoadObserver } from './main-window-contracts' -import { browserRouteWebContentsRegistry } from '../browser/browser-route-session-runtime' +import { browserRouteWebContentsRegistry } from '../browser/routing/sessions/browser-route-session-runtime' import { attachBrowserClientPageRenderer, retireBrowserClientPageRenderer -} from '../browser/browser-client-page-renderer-runtime' +} from '../browser/client-pages/renderer/browser-client-page-renderer-runtime' import { registerRendererDocumentNavigation } from './renderer-document-navigation' import { createRendererRecoveryReloadWatchdog } from './renderer-recovery-reload-watchdog' import { createRendererLaunchFailureBackoff } from './renderer-launch-failure-backoff' diff --git a/src/main/window/main-window-webview-security.test.ts b/src/main/window/main-window-webview-security.test.ts index 15cd6629ee8..28171b6319a 100644 --- a/src/main/window/main-window-webview-security.test.ts +++ b/src/main/window/main-window-webview-security.test.ts @@ -24,18 +24,18 @@ vi.mock('./host-frame-navigation-guard', () => ({ vi.mock('./privileged-window-navigation', () => ({ installPrivilegedWindowNavigationPolicy: mocks.installNavigationPolicy })) -vi.mock('../browser/browser-route-session-runtime', () => ({ +vi.mock('../browser/routing/sessions/browser-route-session-runtime', () => ({ browserRouteSessionRegistry: { isAllowedPartition: () => false }, browserRouteWebContentsRegistry: { attachGuest: mocks.attachRouteGuest } })) -vi.mock('../browser/local-ssh-browser-partitions', () => ({ +vi.mock('../browser/routing/local-host-partitions/local-ssh-browser-partitions', () => ({ isLocalSshBrowserPartition: () => false, enforceLocalSshWebRtcPolicyForGuest: vi.fn() })) vi.mock('../browser/extensions/browser-extension-session-loader', () => ({ getBrowserExtensionSessionForProfile: () => null })) -vi.mock('../browser/browser-javascript-dialogs', () => ({ +vi.mock('../browser/guest-lifecycle/prompts/browser-javascript-dialogs', () => ({ installBrowserJavaScriptDialogs: mocks.installJavaScriptDialogs })) vi.mock(import('../plugins/panels/plugin-frame-guest-registry'), async (importOriginal) => ({ diff --git a/src/main/window/main-window-webview-security.ts b/src/main/window/main-window-webview-security.ts index d8b38f55174..f8b29080274 100644 --- a/src/main/window/main-window-webview-security.ts +++ b/src/main/window/main-window-webview-security.ts @@ -7,11 +7,11 @@ import { browserSessionRegistry } from '../browser/browser-session-registry' import { enforceLocalSshWebRtcPolicyForGuest, isLocalSshBrowserPartition -} from '../browser/local-ssh-browser-partitions' +} from '../browser/routing/local-host-partitions/local-ssh-browser-partitions' import { browserRouteSessionRegistry, browserRouteWebContentsRegistry -} from '../browser/browser-route-session-runtime' +} from '../browser/routing/sessions/browser-route-session-runtime' import { ORCA_BROWSER_BLANK_URL } from '../../shared/constants' import { DOC_PREVIEW_PARTITION, parseDocPreviewUrl } from '../../shared/doc-preview-scheme' import { setDocPreviewFailureSink } from '../browser/doc-preview-failure-notice' @@ -24,7 +24,7 @@ import { registerHostFrameNavigationGuard } from './host-frame-navigation-guard' import { installPrivilegedWindowNavigationPolicy } from './privileged-window-navigation' import { parseChromeExtensionUrl } from '../../shared/browser-extension-url' import { getBrowserExtensionSessionForProfile } from '../browser/extensions/browser-extension-session-loader' -import { installBrowserJavaScriptDialogs } from '../browser/browser-javascript-dialogs' +import { installBrowserJavaScriptDialogs } from '../browser/guest-lifecycle/prompts/browser-javascript-dialogs' import { admitPluginFrameAttach, attachPluginFrameGuest, diff --git a/src/main/window/renderer-publication-throttle-electron-fixture.ts b/src/main/window/renderer-publication-throttle-electron-fixture.ts index 662bd908282..9adaac8227b 100644 --- a/src/main/window/renderer-publication-throttle-electron-fixture.ts +++ b/src/main/window/renderer-publication-throttle-electron-fixture.ts @@ -1,5 +1,5 @@ import { app, BrowserWindow } from 'electron' -import { startBrowserScreencast } from '../browser/browser-screencast-stream' +import { startBrowserScreencast } from '../browser/cdp/screencast/browser-screencast-stream' import { RendererPublicationThrottle } from './renderer-publication-throttle' async function run(): Promise { diff --git a/src/wsl-guest/wsl-browser-network-relay.ts b/src/wsl-guest/wsl-browser-network-relay.ts index 3bcef6f703e..8d4f6e6a766 100644 --- a/src/wsl-guest/wsl-browser-network-relay.ts +++ b/src/wsl-guest/wsl-browser-network-relay.ts @@ -1,6 +1,6 @@ #!/usr/bin/env node import { connect } from 'node:net' -import { BrowserNetworkTunnelSession } from '../main/browser/browser-network-tunnel-session' +import { BrowserNetworkTunnelSession } from '../main/browser/network/tunnels/browser-network-tunnel-session' import { BrowserNetworkTunnelStreamFrameDecoder, BrowserNetworkTunnelStreamFrameWriter diff --git a/tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts b/tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts index b7530b0706e..93f552f3385 100644 --- a/tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts +++ b/tests/e2e/ssh-browser-network-execution-route.docker.unit.test.ts @@ -12,7 +12,7 @@ import { startDockerSshHostTarget, type DockerSshHostTarget } from './helpers/docker-ssh-host-target' -import { resolveSshBrowserNetworkExecutionRoute } from '../../src/main/browser/ssh-browser-network-execution-route' +import { resolveSshBrowserNetworkExecutionRoute } from '../../src/main/browser/network/execution-routes/ssh-browser-network-execution-route' import { quotePosixShell } from '../../src/shared/shell-argument-quoting' const runDocker = process.env.ORCA_RUN_DOCKER_SSH_BROWSER_E2E === '1' diff --git a/tests/e2e/ssh-orcad-browser-routing.spec.ts b/tests/e2e/ssh-orcad-browser-routing.spec.ts index 3ca91ba838f..6d24cd84114 100644 --- a/tests/e2e/ssh-orcad-browser-routing.spec.ts +++ b/tests/e2e/ssh-orcad-browser-routing.spec.ts @@ -20,8 +20,8 @@ import { import { createRetentionFixtureDirectory } from './helpers/host-created-terminal-retention-oracle' import { toSshExecutionHostId } from '../../src/shared/execution-host' import { DEFAULT_LOCAL_ORCA_PROFILE_ID } from '../../src/shared/orca-profiles' -import { deriveBrowserRoutePartition } from '../../src/main/browser/browser-route-identity' -import { sshExecutionHostStorageIdentity } from '../../src/main/browser/browser-execution-host-storage-identity' +import { deriveBrowserRoutePartition } from '../../src/main/browser/routing/partitions/browser-route-identity' +import { sshExecutionHostStorageIdentity } from '../../src/main/browser/routing/identity/browser-execution-host-storage-identity' import { reconnect } from './helpers/orcad-convert-flow' import { navigateGuest } from './helpers/browser-split-guest-probes' import { ORCAD_TEMPLATE, skipUnlessManagedDockerHost } from './helpers/orcad-managed-workspace'