Files
orca/src/main/browser/browser-network-execution-route-dispatch.ts
T
NeilandClaude 139bac88b6 refactor(ssh): move the ssh-connection and ssh-target cluster into ssh/connection/ and ssh/targets/ (#30479)
* refactor(ssh): move the ssh-connection and ssh-target cluster into ssh/connection/ and ssh/targets/

Pure git mv plus import and path-literal rewrites. ssh-connection-utils stays put; the next PR splits it.

Co-Authored-By: Claude <noreply@anthropic.com>

* test(e2e): keep the release-checkout import at the v1.4.218 path

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-18 19:23:21 -07:00

39 lines
1.7 KiB
TypeScript

import {
resolveNativeBrowserNetworkExecutionRoute,
type BrowserNetworkExecutionRouteResolver
} from './browser-network-execution-route'
/**
* Dispatches an execution-host descriptor to its transport-specific route
* resolver. Shared by the runtime tunnel RPC (paired remote clients) and the
* local direct-SSH browser route, which dials the same resolvers in-process.
* Imports stay dynamic so the SSH stack loads only when an SSH host is used, and the
* connection manager comes from the registry rather than `ipc/ssh` — the runtime bundles
* this module, and `ipc/ssh` would drag Electron into a graph that must boot on plain Node.
*/
export const resolveBrowserNetworkExecutionRoute: BrowserNetworkExecutionRouteResolver = async (
context
) => {
if (context.executionHost.kind === 'native') {
return resolveNativeBrowserNetworkExecutionRoute(context)
}
if (context.executionHost.kind === 'wsl') {
const wslRoute = await import('./wsl-browser-network-execution-route')
return wslRoute.resolveWslBrowserNetworkExecutionRoute(context)
}
const [{ getSshConnectionManager }, authority, sshRoute] = await Promise.all([
import('../ssh/targets/ssh-target-registry'),
import('../ssh/ssh-provider-authority'),
import('./ssh-browser-network-execution-route')
])
const connectionManager = getSshConnectionManager()
if (!connectionManager) {
throw new Error('browser_tunnel_execution_host_unavailable')
}
return sshRoute.resolveSshBrowserNetworkExecutionRoute(context, {
connectionManager,
isCurrentAuthority: authority.isCurrentSshProviderAuthority,
registerAuthorityAbort: authority.registerSshProviderRequestAbort
})
}