Skip to content

The agent that grows with you

fix(desktop): resolve active v2 registry SSH scope

Mabollad2c8727db5c4
diff --git a/apps/desktop/electron/active-ssh-route.ts b/apps/desktop/electron/active-ssh-route.ts
new file mode 100644
index 00000000000..2351a959f14
--- /dev/null
+++ b/apps/desktop/electron/active-ssh-route.ts
@@ -0,0 +1,19 @@
+import { backendScopeKey, type ConnectionRegistry } from './connection-registry'
+
+/**
+ * Return the live SSH pool scope for the registry connection currently used by
+ * the Sessions workspace. Non-SSH sources deliberately return null so callers
+ * can preserve the legacy v1 routing fallback.
+ */
+export function activeRegistrySshScope(
+ registry: ConnectionRegistry,
+ profile: null | string | undefined
+): null | string {
+ const connection = registry.connections.find(candidate => candidate.id === registry.lastUsed)
+
+ if (!connection || connection.kind !== 'ssh') {
+ return null
+ }
+
+ return backendScopeKey(connection.id, profile)
+}