Re-integrates the WSL parallel-backends renderer onto upstream's rewritten connection/RPC architecture (#2978), which deleted the saved-env / environmentApi / serverState / wsConnectionState subsystem this branch was built on. Core (packages/client-runtime/connection): - Add dynamic platform-managed bearer environments: a PlatformConnectionRegistration union (Primary|Bearer) and registry.reconcilePlatform(set), which adds/removes platform-managed environments as the host topology changes and stashes the bearer credential. This models the dual-mode WSL secondary (separate loopback origin, bearer auth, dynamic port so it is rederived rather than persisted). The primary and the WSL-only primary keep the same-origin cookie path. Web platform source (apps/web/src/connection/platform.ts): - Emit the platform set from the plural getLocalEnvironmentBootstraps() IPC: the primary (cookie) plus each WSL backend (bearer via bootstrap-token exchange), polling and reconciling on toggle. Replaces the deleted 541-line reconciler. Renderer re-home: - Drop the old subsystem (environmentApi, rpc/serverState, rpc/wsConnectionState, environments/runtime/*, environments/local/*) and their tests. - Re-home the Sidebar cold-boot indicator, the ConnectionsSettings WSL picker, and the multi-environment provider-update feature onto the new hooks (useEnvironments, serverEnvironment.updateProvider, the primaryServer* atoms). Desktop-local environments are identified by a BearerConnectionTarget with a "local:" connection id. - Drop the inert swap-suppression surface superseded by parallel backends. Verified: typecheck (web, desktop, client-runtime), connection / provider / localApi / authBootstrap tests, and lint all pass.
103 lines
3.1 KiB
TypeScript
103 lines
3.1 KiB
TypeScript
import * as Effect from "effect/Effect";
|
|
|
|
import * as DesktopIpc from "./DesktopIpc.ts";
|
|
import {
|
|
clearCloudAuthToken,
|
|
createCloudAuthRequest,
|
|
fetchCloudAuth,
|
|
getCloudAuthToken,
|
|
setCloudAuthToken,
|
|
} from "./methods/cloudAuth.ts";
|
|
import { getClientSettings, setClientSettings } from "./methods/clientSettings.ts";
|
|
import {
|
|
clearConnectionCatalog,
|
|
getConnectionCatalog,
|
|
setConnectionCatalog,
|
|
} from "./methods/connectionCatalog.ts";
|
|
import {
|
|
getAdvertisedEndpoints,
|
|
getServerExposureState,
|
|
setServerExposureMode,
|
|
setTailscaleServeEnabled,
|
|
} from "./methods/serverExposure.ts";
|
|
import {
|
|
bootstrapSshBearerSession,
|
|
disconnectSshEnvironment,
|
|
discoverSshHosts,
|
|
ensureSshEnvironment,
|
|
fetchSshEnvironmentDescriptor,
|
|
fetchSshSessionState,
|
|
issueSshWebSocketTicket,
|
|
resolveSshPasswordPrompt,
|
|
} from "./methods/sshEnvironment.ts";
|
|
import {
|
|
checkForUpdate,
|
|
downloadUpdate,
|
|
getUpdateState,
|
|
installUpdate,
|
|
setUpdateChannel,
|
|
} from "./methods/updates.ts";
|
|
import {
|
|
confirm,
|
|
getAppBranding,
|
|
getLocalEnvironmentBootstraps,
|
|
openExternal,
|
|
pickFolder,
|
|
setTheme,
|
|
showContextMenu,
|
|
} from "./methods/window.ts";
|
|
import * as PreviewIpc from "./methods/preview.ts";
|
|
import { getWslState, setWslBackendEnabled, setWslDistro, setWslOnly } from "./methods/wsl.ts";
|
|
|
|
export const installDesktopIpcHandlers = Effect.fn("desktop.ipc.installHandlers")(function* () {
|
|
const ipc = yield* DesktopIpc.DesktopIpc;
|
|
yield* PreviewIpc.installPreviewEventForwarding();
|
|
|
|
yield* ipc.handleSync(getAppBranding);
|
|
yield* ipc.handleSync(getLocalEnvironmentBootstraps);
|
|
|
|
yield* ipc.handle(getClientSettings);
|
|
yield* ipc.handle(setClientSettings);
|
|
yield* ipc.handle(getConnectionCatalog);
|
|
yield* ipc.handle(setConnectionCatalog);
|
|
yield* ipc.handle(clearConnectionCatalog);
|
|
|
|
yield* ipc.handle(discoverSshHosts);
|
|
yield* ipc.handle(ensureSshEnvironment);
|
|
yield* ipc.handle(disconnectSshEnvironment);
|
|
yield* ipc.handle(fetchSshEnvironmentDescriptor);
|
|
yield* ipc.handle(bootstrapSshBearerSession);
|
|
yield* ipc.handle(fetchSshSessionState);
|
|
yield* ipc.handle(issueSshWebSocketTicket);
|
|
yield* ipc.handle(resolveSshPasswordPrompt);
|
|
|
|
yield* ipc.handle(getServerExposureState);
|
|
yield* ipc.handle(setServerExposureMode);
|
|
yield* ipc.handle(setTailscaleServeEnabled);
|
|
yield* ipc.handle(getAdvertisedEndpoints);
|
|
|
|
yield* ipc.handle(getWslState);
|
|
yield* ipc.handle(setWslBackendEnabled);
|
|
yield* ipc.handle(setWslDistro);
|
|
yield* ipc.handle(setWslOnly);
|
|
|
|
yield* ipc.handle(pickFolder);
|
|
yield* ipc.handle(confirm);
|
|
yield* ipc.handle(setTheme);
|
|
yield* ipc.handle(showContextMenu);
|
|
yield* ipc.handle(openExternal);
|
|
yield* ipc.handle(createCloudAuthRequest);
|
|
yield* ipc.handle(getCloudAuthToken);
|
|
yield* ipc.handle(setCloudAuthToken);
|
|
yield* ipc.handle(clearCloudAuthToken);
|
|
yield* ipc.handle(fetchCloudAuth);
|
|
yield* ipc.handle(getUpdateState);
|
|
yield* ipc.handle(setUpdateChannel);
|
|
yield* ipc.handle(downloadUpdate);
|
|
yield* ipc.handle(installUpdate);
|
|
yield* ipc.handle(checkForUpdate);
|
|
for (const previewMethod of PreviewIpc.methods) {
|
|
yield* ipc.handle(previewMethod);
|
|
}
|
|
});
|