Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(ssh): surface import result/errors instead of failing silently

enesc228598e2b6d
diff --git a/src/renderer/components/settings/sections/SshSection.tsx b/src/renderer/components/settings/sections/SshSection.tsx
index 1ed326ac1..a01fa0167 100644
--- a/src/renderer/components/settings/sections/SshSection.tsx
+++ b/src/renderer/components/settings/sections/SshSection.tsx
@@ -27,30 +27,41 @@ export function SshSection({ isActive }: { isActive: boolean }): React.JSX.Eleme
// Import named hosts from ~/.ssh/config. Dedupe against saved servers by user@host:port and
// skip hosts without a User (can't form a usable connection); the user can add those by hand.
const importFromConfig = async () => {
- const key = (s: { user?: string; host: string; port?: number }) =>
- `${s.user ?? ''}@${s.host}:${s.port ?? 22}`
- const candidates = await window.nodeTerminal.ssh.importCandidates()
- const withUser = candidates.filter((c) => c.user)
- const skipped = candidates.length - withUser.length
- const seen = new Set(useSshServers.getState().servers.map(key))
- const fresh = withUser.filter((c) => !seen.has(key(c)))
- for (const c of fresh) {
- await useSshServers.getState().save({
- id: crypto.randomUUID(),
- label: c.label,
- host: c.host,
- user: c.user as string,
- port: c.port,
- identityFile: c.identityFile
- })
+ // Surface a clear message in every case — a silent no-op (e.g. the IPC bridge missing
+ // because the app wasn't restarted after an update) is worse than an error.
+ if (typeof window.nodeTerminal.ssh.importCandidates !== 'function') {
+ setImportMsg('Import unavailable — fully quit and reopen the app to load the update.')
+ return
+ }
+ setImportMsg('Importing…')
+ try {
+ const key = (s: { user?: string; host: string; port?: number }) =>
+ `${s.user ?? ''}@${s.host}:${s.port ?? 22}`
+ const candidates = await window.nodeTerminal.ssh.importCandidates()
+ const withUser = candidates.filter((c) => c.user)
+ const skipped = candidates.length - withUser.length
+ const seen = new Set(useSshServers.getState().servers.map(key))
+ const fresh = withUser.filter((c) => !seen.has(key(c)))
+ for (const c of fresh) {
+ await useSshServers.getState().save({
+ id: crypto.randomUUID(),
+ label: c.label,
+ host: c.host,
+ user: c.user as string,
+ port: c.port,
+ identityFile: c.identityFile
+ })
+ }
+ setImportMsg(
+ candidates.length === 0
+ ? 'No hosts found in ~/.ssh/config'
+ : `${fresh.length ? `Imported ${fresh.length} server${fresh.length === 1 ? '' : 's'}` : 'No new servers to import'}${
+ skipped ? ` · skipped ${skipped} without a user` : ''
+ }`
+ )
+ } catch (err) {
+ setImportMsg(`Import failed: ${err instanceof Error ? err.message : String(err)}`)
}
- setImportMsg(
- candidates.length === 0
- ? 'No hosts found in ~/.ssh/config'
- : `${fresh.length ? `Imported ${fresh.length} server${fresh.length === 1 ? '' : 's'}` : 'No new servers to import'}${
- skipped ? ` · skipped ${skipped} without a user` : ''
- }`
- )
}
const saveDisabled =