Skip to content

The agent that grows with you

refactor(desktop): move the Windows SSH Test capability check out of main.ts

yoniebansbac34e9e9946
diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts
index 39bc7cc1d0f..0eff77e4cb9 100644
--- a/apps/desktop/electron/main.ts
+++ b/apps/desktop/electron/main.ts
@@ -682,10 +682,9 @@ import { buildPathExtCandidates, chooseUpdaterArgs, resolveVenvHermesCommand } f
import {
connectWindowsRemote,
detectRemotePlatform,
- helper,
+ inspectWindowsSupport,
probeWindowsRemote,
- terminateOwnedWindowsDashboardForUpdate,
- windowsHelperOwnsRuntime
+ terminateOwnedWindowsDashboardForUpdate
} from './windows-remote-lifecycle'
import {
alreadyHasNoSandbox,
@@ -10302,9 +10301,9 @@ async function testDesktopConnectionConfig(input: any = {}) {
if (platform.os === 'Windows') {
const runtime = platform
hermesPath = runtime.hermesPath
- const inspection = await helper(ssh, runtime, 'inspect', [runtime.hermesPath])
+ const inspection = await inspectWindowsSupport(ssh, runtime)
hermesVersion = inspection.version
- supported = inspection.supported && windowsHelperOwnsRuntime(runtime, inspection)
+ supported = inspection.supported
} else {
hermesPath = await remoteLifecycle.locateHermes(ssh, sshConfig.remoteHermesPath || '')
hermesVersion = await remoteLifecycle.probeHermesVersion(ssh, hermesPath)
@@ -10340,7 +10339,7 @@ async function testDesktopConnectionConfig(input: any = {}) {
}
}
} catch (error: any) {
- return { reachable: false, sshError: error.kind || 'unknown', error: redactSecrets(String(error?.message || error)) }
+ return { reachable: false, sshError: error.kind || 'unknown', error: redactSecrets(String(error.message)) }
} finally {
try {
await ssh.close()
diff --git a/apps/desktop/electron/windows-remote-lifecycle.ts b/apps/desktop/electron/windows-remote-lifecycle.ts
index a45409888c6..35b729e036b 100644
--- a/apps/desktop/electron/windows-remote-lifecycle.ts
+++ b/apps/desktop/electron/windows-remote-lifecycle.ts
@@ -741,6 +741,13 @@ function windowsHelperOwnsRuntime(runtime, inspection) {
return !runtime.runtimeCommand || inspection?.runtimeBootstrapOwnership === 1
}
+// Test answers with Connect's own capability bar.
+async function inspectWindowsSupport(ssh, runtime) {
+ const inspection = await helper(ssh, runtime, 'inspect', [runtime.hermesPath])
+
+ return { version: inspection.version, supported: inspection.supported && windowsHelperOwnsRuntime(runtime, inspection) }
+}
+
async function connectWindowsRemote(deps) {
const {
ssh,
@@ -979,6 +986,7 @@ export {
encodedPowerShell,
helper,
helperCommand,
+ inspectWindowsSupport,
powerShellCommand,
probeWindowsFiles,
probeWindowsRemote,