Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

fix(desktop): show SSH progress during startup (#26)

Sean Fergusonc9d0fb53d505
diff --git a/apps/desktop/src/renderer/views/ChatWindow.tsx b/apps/desktop/src/renderer/views/ChatWindow.tsx
index 785bc15c..55e92b0f 100644
--- a/apps/desktop/src/renderer/views/ChatWindow.tsx
+++ b/apps/desktop/src/renderer/views/ChatWindow.tsx
@@ -1,9 +1,9 @@
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from 'react'
import type { WindowCommand } from '@shared/ipc'
+import { isSSHConnecting, showsChat as shouldShowChat } from '@shared/ssh-startup'
import { draftOf, isGroup, type Bot, type BotDraft } from '@shared/models'
import { CharacterAvatar } from '../components/Avatar'
import { Button, ChoicePicker, IconButton } from '../components/Controls'
-import { Icon } from '../components/Icon'
import { AnchoredMenu, Dialog, Sheet, type MenuItem } from '../components/Overlay'
import { font } from '../lib/fonts'
import { useModels } from '../lib/observable'
@@ -23,12 +23,15 @@ import { ApprovalSheet } from './settings/ApprovalSheet'
import { UpdateNeededCard } from './UpdateNeededCard'
import { SearchPalette } from './SearchPalette'
import { AccountWelcomeView } from './AccountWelcomeView'
+import { HostStateView } from './HostStateView'
+import { StartupRecovery } from './StartupRecovery'
+export { EmptyState } from './HostStateView'
import { AnalyticsPrompt } from './AnalyticsPrompt'
import { StarPrompt } from './StarPrompt'
import { OpenVoiceSettings } from './call/CallView'
import { AccountPanelLayer, DesktopActionMenu, ProfileAvatar } from './PanelMenus'
import { useTraySummary } from './tray-summary'
-import { useSSHAttachments } from './settings/ssh-model'
+import { useSSH, useSSHAttachments } from './settings/ssh-model'
import './chat-window.css'
import './sidebar-header.css'
@@ -41,7 +44,8 @@ export function ChatWindow() {
const [confirmReset, setConfirmReset] = useState(false)
useTraySummary(app)
useSSHAttachments(app)
- const showsChat = app.host.state.kind === 'running' || app.computers.length > 0
+ const ssh = useSSH()
+ const showsChat = shouldShowChat(app.host.state.kind, app.computers.length, ssh.state)
useEffect(
() =>
@@ -104,38 +108,6 @@ export function ChatWindow() {
)
}
-/** What stands between this computer and the chat, with the one action that fixes it. */
-function HostStateView() {
- const app = useApp()
- const state = app.host.state
- switch (state.kind) {
- case 'notInstalled':
- return <EmptyState icon="desktopcomputer" title={`Set up this ${isMac ? 'Mac' : 'computer'}`} message={`Codync runs your coding agents through the host, a small background service on this ${isMac ? 'Mac' : 'computer'}.`} action={['Install host', () => window.codync.host.install()]} />
- case 'missingBinary':
- return <EmptyState icon="desktopcomputer.trianglebadge.exclamationmark" title="The host is missing" message="This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub." />
- case 'failed':
- return <EmptyState icon="desktopcomputer.trianglebadge.exclamationmark" title="The host isn't running" message={state.message} action={['Try again', () => window.codync.host.restart()]} />
- default:
- return <EmptyState icon="desktopcomputer" title="Starting the host…" message="This takes a few seconds." />
- }
-}
-
-/** A quiet placeholder for an empty screen: icon, title, a line of help and an optional action. */
-export function EmptyState({ icon, title, message, action }: { icon: string; title: string; message: string; action?: [string, () => void] }) {
- return (
- <div className="empty-state">
- <Icon name={icon} size={36} weight="light" color="var(--tertiary)" />
- <div style={{ ...font('title3', 'semibold'), color: 'var(--text)' }}>{title}</div>
- <div style={{ ...font('callout'), color: 'var(--secondary)', textAlign: 'center', maxWidth: 360 }}>{message}</div>
- {action ? (
- <Button onClick={action[1]} style={{ marginTop: 4 }}>
- {action[0]}
- </Button>
- ) : null}
- </div>
- )
-}
-
interface BotTarget {
bot: Bot
store: BotStore
@@ -149,6 +121,8 @@ interface EditTarget {
function ChatSplitView() {
const app = useApp()
+ const ssh = useSSH()
+ const connecting = ssh.state.profiles.some((p) => isSSHConnecting(ssh.status(p.id))) || [...app.stores.values()].some((s) => s.shownConnection.kind === 'connecting')
const [compact, setCompact] = usePref(prefs.sidebarCompact)
const [sidebarWidth, setSidebarWidth] = usePref(prefs.sidebarWidth)
const [hidden, setHidden] = usePref(prefs.hiddenComputers)
@@ -310,6 +284,8 @@ function ChatSplitView() {
<ThreadView key={refKey(selected)} botId={selected.botId} />
</StoreContext.Provider>
)
+ } else if (!onlineStores.length && ssh.state.profiles.length) {
+ detail = <StartupRecovery manage={() => setSettings('computers')} />
} else {
detail = (
<div className="empty-detail">
@@ -318,8 +294,8 @@ function ChatSplitView() {
<CharacterAvatar shape="squircle" color="orange" size={60} style={{ marginLeft: -10 }} />
<CharacterAvatar shape="teardrop" color="violet" size={60} mood="working" style={{ marginLeft: -10 }} />
</div>
- <div style={font('title2', 'semibold')}>Your coding agents, as teammates.</div>
- <div style={{ color: 'var(--secondary)', textAlign: 'center', maxWidth: 420 }}>Pick a bot, or create one for each kind of work and point it at a project.</div>
+ <div style={font('title2', 'semibold')}>{connecting ? 'Connecting to your computers…' : 'Your coding agents, as teammates.'}</div>
+ <div style={{ color: 'var(--secondary)', textAlign: 'center', maxWidth: 420 }}>{connecting ? 'Your bots will appear once connected. Manage computers to see connection progress.' : 'Pick a bot, or create one for each kind of work and point it at a project.'}</div>
<Button onClick={() => compose()} disabled={!onlineStores.length}>
New Bot
</Button>
@@ -385,8 +361,8 @@ function ChatSplitView() {
})}
{visibleRoster.length === 0 && !compact && mismatchStores.length === 0 ? (
<div className="roster-empty">
- <div style={font(13, 'medium')}>No bots yet</div>
- <div style={{ ...font(12), color: 'var(--secondary)' }}>Use + to start a new chat.</div>
+ <div style={font(13, 'medium')}>{onlineStores.length ? 'No bots yet' : 'Waiting for a computer'}</div>
+ {onlineStores.length ? <div style={{ ...font(12), color: 'var(--secondary)' }}>Use + to start a new chat.</div> : null}
</div>
) : null}
</div>
diff --git a/apps/desktop/src/renderer/views/ComputerFilterHeader.tsx b/apps/desktop/src/renderer/views/ComputerFilterHeader.tsx
index d04cd32f..301f2182 100644
--- a/apps/desktop/src/renderer/views/ComputerFilterHeader.tsx
+++ b/apps/desktop/src/renderer/views/ComputerFilterHeader.tsx
@@ -1,9 +1,11 @@
import type { Computer } from '@shared/models'
+import { sshSummary, sshStatusDetail } from '@shared/ssh-startup'
import { DropdownMenu } from '../components/Controls'
import { Icon } from '../components/Icon'
import type { MenuItem } from '../components/Overlay'
import { font } from '../lib/fonts'
import { useApp } from '../store/context'
+import { useSSH } from './settings/ssh-model'
import type { Connection } from '../store/bot-store'
/** An empty exclusion list means all computers, including newly paired ones. */
@@ -42,9 +44,13 @@ function summary(connections: Connection[]) {
/** The roster's only connection surface: a quiet summary, with details and filters on demand. */
export function ComputerFilterHeader({ hidden, setHidden, manage, compact = false }: { hidden: string; setHidden: (v: string) => void; manage: () => void; compact?: boolean }) {
const app = useApp()
+ const ssh = useSSH()
+ const pending = ssh.state.profiles.filter((p) => !ssh.state.attachments.some((a) => a.profileId === p.id))
+ const pendingSummary = sshSummary(pending.map((p) => ssh.status(p.id)))
const selection = computerSelection(app.computers.map((c) => c.id), hidden)
const stores = selection.shown.map((id) => app.store(id)).filter((s) => !!s)
- const text = summary(stores.map((s) => s.shownConnection))
+ const online = stores.filter((s) => s.shownConnection.kind === 'online').length
+ const text = pendingSummary ? `${online ? `${online} connected · ` : ''}${pendingSummary}` : summary(stores.map((s) => s.shownConnection))
const title = (c: Computer) => {
const store = app.store(c.id)
return store ? `${store.hostName} · ${store.connectionLabel}` : c.name
@@ -52,14 +58,21 @@ export function ComputerFilterHeader({ hidden, setHidden, manage, compact = fals
const items = (): MenuItem[] => {
const list: MenuItem[] = [{ title: 'All computers', selected: selection.shown.length === app.computers.length, action: () => setHidden('') }]
for (const c of app.computers) list.push({ title: title(c), selected: selection.shown.includes(c.id), action: () => setHidden(selection.toggling(c.id)) })
+ for (const p of pending) {
+ const status = ssh.status(p.id)
+ const detail = sshStatusDetail(status, false)
+ list.push({ title: `${p.name || p.host} · ${detail}`, action: manage })
+ }
if (app.computers.length > 1) app.computers.forEach((c, i) => list.push({ title: `Only ${c.name}`, divider: i === 0, action: () => setHidden(selection.only(c.id)) }))
if (stores.length) list.push({ title: 'Reconnect', icon: 'arrow.clockwise', divider: true, action: () => stores.forEach((s) => s.restartStream()) })
+ if (app.host.state.kind === 'notInstalled') list.push({ title: `Install host on this ${window.codync.platform === 'darwin' ? 'Mac' : 'computer'}`, icon: 'desktopcomputer', action: () => window.codync.host.install() })
+ if (app.host.state.kind === 'failed') list.push({ title: 'Try again on this computer', icon: 'arrow.clockwise', action: () => window.codync.host.restart() })
list.push({ title: 'Manage computers', icon: 'desktopcomputer', action: manage })
return list
}
return (
- <DropdownMenu items={items} title={text} className={compact ? 'computer-filter-action' : undefined} style={{ display: 'flex', alignItems: 'center', gap: 4, padding: compact ? '0 9px' : '6px 0', ...font(12, 'medium'), color: 'var(--secondary)' }}>
- {compact ? <Icon name="desktopcomputer" size={12} weight="medium" /> : <span style={{ whiteSpace: 'nowrap' }} aria-label={`Computers, ${text}. Filter conversations`}>{text}</span>}
+ <DropdownMenu items={items} title={text} className={compact ? 'computer-filter-action' : undefined} style={{ display: 'flex', alignItems: 'center', gap: 4, minWidth: 0, padding: compact ? '0 9px' : '6px 0', ...font(12, 'medium'), color: 'var(--secondary)' }}>
+ {compact ? <Icon name="desktopcomputer" size={12} weight="medium" /> : <span style={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }} aria-label={`Computers, ${text}. Filter conversations`}>{text}</span>}
<Icon name="chevron.down" size={8} weight="semibold" />
</DropdownMenu>
)
diff --git a/apps/desktop/src/renderer/views/HostStateView.tsx b/apps/desktop/src/renderer/views/HostStateView.tsx
new file mode 100644
index 00000000..8e15bc68
--- /dev/null
+++ b/apps/desktop/src/renderer/views/HostStateView.tsx
@@ -0,0 +1,39 @@
+import { Button } from '../components/Controls'
+import { Icon } from '../components/Icon'
+import { font } from '../lib/fonts'
+import { useApp } from '../store/context'
+
+const isMac = window.codync.platform === 'darwin'
+
+/** What stands between this computer and the chat, with the one action that fixes it. */
+export function HostStateView({ compact = false }: { compact?: boolean }) {
+ const app = useApp()
+ const state = app.host.state
+ switch (state.kind) {
+ case 'notInstalled':
+ return <EmptyState compact={compact} icon="desktopcomputer" title={`Set up this ${isMac ? 'Mac' : 'computer'}`} message={`Codync runs your coding agents through the host, a small background service on this ${isMac ? 'Mac' : 'computer'}.`} action={['Install host', () => window.codync.host.install()]} />
+ case 'missingBinary':
+ return <EmptyState compact={compact} icon="desktopcomputer.trianglebadge.exclamationmark" title="The host is missing" message="This copy of Codync doesn't include codync-host. Download Codync again from codync.dev or GitHub." />
+ case 'failed':
+ return <EmptyState compact={compact} icon="desktopcomputer.trianglebadge.exclamationmark" title="The host isn't running" message={state.message} action={['Try again', () => window.codync.host.restart()]} />
+ default:
+ return <EmptyState compact={compact} icon="desktopcomputer" title="Starting the host…" message="This takes a few seconds." />
+ }
+}
+
+/** A quiet placeholder for an empty screen: icon, title, a line of help and an optional action. */
+export function EmptyState({ icon, title, message, action, compact = false }: { icon: string; title: string; message: string; action?: [string, () => void]; compact?: boolean }) {
+ return (
+ <div className={`empty-state ${compact ? 'local-recovery' : ''}`}>
+ <Icon name={icon} size={compact ? 22 : 36} weight="light" color="var(--tertiary)" />
+ <div style={{ ...font(compact ? 'callout' : 'title3', 'semibold'), color: 'var(--text)' }}>{title}</div>
+ <div style={{ ...font('callout'), color: 'var(--secondary)', textAlign: compact ? 'left' : 'center', maxWidth: 360 }}>{message}</div>
+ {action ? (
+ <Button kind={compact ? 'secondary' : 'primary'} onClick={action[1]} style={{ marginTop: 4 }}>
+ {action[0]}
+ </Button>
+ ) : null}
+ </div>
+ )
+}
+
diff --git a/apps/desktop/src/renderer/views/StartupRecovery.tsx b/apps/desktop/src/renderer/views/StartupRecovery.tsx
new file mode 100644
index 00000000..f3bcad7d
--- /dev/null
+++ b/apps/desktop/src/renderer/views/StartupRecovery.tsx
@@ -0,0 +1,34 @@
+import { isSSHConnecting } from '@shared/ssh-startup'
+import { Button, Spinner } from '../components/Controls'
+import { Icon } from '../components/Icon'
+import { font } from '../lib/fonts'
+import { useApp } from '../store/context'
+import { HostStateView } from './HostStateView'
+import { SSHRow } from './settings/SSHRow'
+import { useSSH } from './settings/ssh-model'
+import './startup-recovery.css'
+
+/** Saved remote computers remain visible while no computer is ready for a chat. */
+export function StartupRecovery({ manage }: { manage: () => void }) {
+ const app = useApp()
+ const ssh = useSSH()
+ const connecting = ssh.state.profiles.some((p) => isSSHConnecting(ssh.status(p.id)))
+ return (
+ <div className="startup-recovery">
+ <div className="startup-recovery-content">
+ <div className="startup-recovery-title" role="status">
+ {connecting ? <Spinner size={22} /> : <Icon name="desktopcomputer" size={22} color="var(--secondary)" />}
+ <span style={font('title2', 'semibold')}>{connecting ? 'Connecting to your computers…' : 'Your remote computers'}</span>
+ </div>
+ <div style={{ color: 'var(--secondary)' }}>Your bots will appear once a computer is connected.</div>
+ <div className="startup-recovery-profiles">
+ {ssh.state.profiles.map((p) => (
+ <SSHRow key={p.id} profile={p} status={ssh.status(p.id)} attached={ssh.state.attachments.some((a) => a.profileId === p.id)} edit={manage} />
+ ))}
+ </div>
+ <Button kind="secondary" onClick={manage}>Manage computers</Button>
+ {app.host.state.kind !== 'running' ? <HostStateView compact /> : null}
+ </div>
+ </div>
+ )
+}
diff --git a/apps/desktop/src/renderer/views/settings/ComputersView.tsx b/apps/desktop/src/renderer/views/settings/ComputersView.tsx
index 54769c23..d5640ddd 100644
--- a/apps/desktop/src/renderer/views/settings/ComputersView.tsx
+++ b/apps/desktop/src/renderer/views/settings/ComputersView.tsx
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useState } from 'react'
import QRCode from 'qrcode'
import type { AccountApproval, AuthorizedDevice, PairingInfo } from '@shared/models'
-import { newSSHProfile, SSH_INSTALL_COMMAND, type SSHProfile, type SSHStatus } from '@shared/ssh'
+import { newSSHProfile, type SSHProfile } from '@shared/ssh'
import { Button, CardSection, IconButton, Spinner, Switch } from '../../components/Controls'
import { Icon } from '../../components/Icon'
import { Dialog, ModalHeader, Sheet, useDismiss } from '../../components/Overlay'
@@ -13,6 +13,7 @@ import { StoreContext, useApp } from '../../store/context'
import { ComputerBadge } from '../ComputerBadge'
import { deviceIcon, errorText, liveClient, relativeDay, Reveal, SectionHeader, statusText, thisMac } from './parts'
import { sshBridge, useSSH } from './ssh-model'
+import { SSHRow } from './SSHRow'
import { VoiceChatSettingsView } from './VoiceChatSettingsView'
/**
@@ -379,77 +380,8 @@ function PairingPanel({ store }: { store: BotStore }) {
</div>
)
}
-
// MARK: SSH
-function SSHRow({ profile, status, edit }: { profile: SSHProfile; status: SSHStatus; edit: () => void }) {
- const bridge = sshBridge()
- const target = `${profile.user ? `${profile.user}@` : ''}${profile.host}${profile.port !== null ? `:${profile.port}` : ''}`
- const line = (() => {
- switch (status.kind) {
- case 'idle':
- return `${target} · Not connected`
- case 'connecting':
- return status.step
- case 'confirmHostKey':
- return `${target} · Confirm the host key`
- case 'connected':
- return `${target} · Connected`
- case 'retrying':
- return `${status.message} Retrying…`
- case 'failed':
- return status.message
- case 'notInstalled':
- return `codync-host isn't installed on ${profile.host}. Install it there:`
- }
- })()
- const problem = status.kind === 'retrying' || status.kind === 'failed' || status.kind === 'notInstalled'
- const active = status.kind === 'connected' || status.kind === 'connecting' || status.kind === 'retrying'
- return (
- <div className="settings-card settings-appear">
- <div className="settings-row">
- <span style={{ width: 22, display: 'flex', justifyContent: 'center', color: 'var(--secondary)' }}>
- <Icon name="terminal" size={13} />
- </span>
- <div className="settings-stack" style={{ flex: 1 }}>
- <span style={font('callout', 'medium')}>{profile.name || profile.host}</span>
- <span style={{ ...font('caption'), color: problem ? 'var(--warning)' : 'var(--secondary)' }}>{line}</span>
- </div>
- {active ? (
- <IconButton title="Disconnect" icon="stop.circle" onClick={() => bridge?.disconnect(profile.id)} />
- ) : (
- <IconButton title="Connect" icon="arrow.clockwise" onClick={() => bridge?.connect(profile.id)} />
- )}
- <IconButton title="Edit" icon="pencil" onClick={edit} />
- <IconButton title="Remove" icon="trash" onClick={() => bridge?.remove(profile.id)} />
- </div>
- <Reveal show={status.kind === 'confirmHostKey'}>
- {status.kind === 'confirmHostKey' ? (
- <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
- <span style={{ ...font('caption'), color: 'var(--secondary)' }}>
- First connection to {status.name}. Check that its host key fingerprint matches what the computer's owner sees (
- <code style={{ fontFamily: 'var(--mono)' }}>ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub</code>).
- </span>
- {status.fingerprints.map((f) => (
- <span key={f} className="selectable" style={font('caption', undefined, 'monospaced')}>{f}</span>
- ))}
- <div style={{ display: 'flex', gap: 8 }}>
- <Button onClick={() => bridge?.trustHostKey(profile.id)}>Trust and connect</Button>
- <Button kind="secondary" onClick={() => bridge?.disconnect(profile.id)}>Cancel</Button>
- </div>
- </div>
- ) : null}
- </Reveal>
- <Reveal show={status.kind === 'notInstalled'}>
- <div className="settings-row" style={{ gap: 6 }}>
- <span className="settings-code selectable">{SSH_INSTALL_COMMAND}</span>
- <IconButton title="Copy install command" icon="doc.on.doc" onClick={() => window.codync.app.copy(SSH_INSTALL_COMMAND)} />
- </div>
- </Reveal>
- </div>
- )
-}
-
/** Add or change an SSH computer. Only fields ssh takes as separate arguments; nothing goes through a shell. */
function SSHProfileEditor({ profile: initial, isNew }: { profile: SSHProfile; isNew: boolean }) {
const dismiss = useDismiss()
diff --git a/apps/desktop/src/renderer/views/settings/SSHRow.tsx b/apps/desktop/src/renderer/views/settings/SSHRow.tsx
new file mode 100644
index 00000000..83258f6d
--- /dev/null
+++ b/apps/desktop/src/renderer/views/settings/SSHRow.tsx
@@ -0,0 +1,75 @@
+import { SSH_INSTALL_COMMAND, type SSHProfile, type SSHStatus } from '@shared/ssh'
+import { Button, IconButton } from '../../components/Controls'
+import { Icon } from '../../components/Icon'
+import { font } from '../../lib/fonts'
+import { Reveal } from './parts'
+import { sshStatusDetail } from '@shared/ssh-startup'
+import { sshBridge } from './ssh-model'
+
+export function SSHRow({ profile, status, edit, attached = true }: { profile: SSHProfile; status: SSHStatus; attached?: boolean; edit: () => void }) {
+ const bridge = sshBridge()
+ const target = `${profile.user ? `${profile.user}@` : ''}${profile.host}${profile.port !== null ? `:${profile.port}` : ''}`
+ const line = (() => {
+ switch (status.kind) {
+ case 'idle':
+ return `${target} · Not connected`
+ case 'connecting':
+ return status.step
+ case 'confirmHostKey':
+ return `${target} · Confirm the host key`
+ case 'connected':
+ return `${target} · ${sshStatusDetail(status, attached)}`
+ case 'retrying':
+ return `${status.message} Retrying…`
+ case 'failed':
+ return status.message
+ case 'notInstalled':
+ return `codync-host isn't installed on ${profile.host}. Install it there:`
+ }
+ })()
+ const problem = status.kind === 'retrying' || status.kind === 'failed' || status.kind === 'notInstalled'
+ const active = status.kind === 'connected' || status.kind === 'connecting' || status.kind === 'retrying'
+ return (
+ <div className="settings-card settings-appear">
+ <div className="settings-row">
+ <span style={{ width: 22, display: 'flex', justifyContent: 'center', color: 'var(--secondary)' }}>
+ <Icon name="terminal" size={13} />
+ </span>
+ <div className="settings-stack" style={{ flex: 1 }}>
+ <span style={font('callout', 'medium')}>{profile.name || profile.host}</span>
+ <span style={{ ...font('caption'), color: problem ? 'var(--warning)' : 'var(--secondary)' }}>{line}</span>
+ </div>
+ {active ? (
+ <IconButton title="Disconnect" icon="stop.circle" onClick={() => bridge?.disconnect(profile.id)} />
+ ) : (
+ <IconButton title="Connect" icon="arrow.clockwise" onClick={() => bridge?.connect(profile.id)} />
+ )}
+ <IconButton title="Edit" icon="pencil" onClick={edit} />
+ <IconButton title="Remove" icon="trash" onClick={() => bridge?.remove(profile.id)} />
+ </div>
+ <Reveal show={status.kind === 'confirmHostKey'}>
+ {status.kind === 'confirmHostKey' ? (
+ <div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
+ <span style={{ ...font('caption'), color: 'var(--secondary)' }}>
+ First connection to {status.name}. Check that its host key fingerprint matches what the computer's owner sees (
+ <code style={{ fontFamily: 'var(--mono)' }}>ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub</code>).
+ </span>
+ {status.fingerprints.map((f) => (
+ <span key={f} className="selectable" style={font('caption', undefined, 'monospaced')}>{f}</span>
+ ))}
+ <div style={{ display: 'flex', gap: 8 }}>
+ <Button onClick={() => bridge?.trustHostKey(profile.id)}>Trust and connect</Button>
+ <Button kind="secondary" onClick={() => bridge?.disconnect(profile.id)}>Cancel</Button>
+ </div>
+ </div>
+ ) : null}
+ </Reveal>
+ <Reveal show={status.kind === 'notInstalled'}>
+ <div className="settings-row" style={{ gap: 6 }}>
+ <span className="settings-code selectable">{SSH_INSTALL_COMMAND}</span>
+ <IconButton title="Copy install command" icon="doc.on.doc" onClick={() => window.codync.app.copy(SSH_INSTALL_COMMAND)} />
+ </div>
+ </Reveal>
+ </div>
+ )
+}
diff --git a/apps/desktop/src/renderer/views/startup-recovery.css b/apps/desktop/src/renderer/views/startup-recovery.css
new file mode 100644
index 00000000..52849485
--- /dev/null
+++ b/apps/desktop/src/renderer/views/startup-recovery.css
@@ -0,0 +1,34 @@
+.startup-recovery {
+ height: 100%;
+ overflow-y: auto;
+ display: flex;
+ padding: 44px 32px 32px;
+}
+.startup-recovery-content {
+ width: min(560px, 100%);
+ margin: auto;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 16px;
+}
+.startup-recovery-title {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+.startup-recovery-profiles {
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+}
+.startup-recovery .local-recovery {
+ height: auto;
+ width: 100%;
+ align-items: flex-start;
+ padding: 18px;
+ margin-top: 12px;
+ border-radius: 14px;
+ background: var(--surface);
+}
diff --git a/apps/desktop/src/shared/ssh-startup.test.ts b/apps/desktop/src/shared/ssh-startup.test.ts
new file mode 100644
index 00000000..92585638
--- /dev/null
+++ b/apps/desktop/src/shared/ssh-startup.test.ts
@@ -0,0 +1,52 @@
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+import type { HostState } from './ipc.ts'
+import { isSSHConnecting, showsChat, sshSummary, sshStatusDetail } from './ssh-startup.ts'
+import type { SSHProfile, SSHState, SSHStatus } from './ssh.ts'
+
+const profile: SSHProfile = { id: 'remote', host: 'remote', name: 'Remote', port: null, user: null, identityFile: null, remotePort: 19222, computerId: null }
+const state = (status?: SSHStatus): SSHState => ({ profiles: [profile], status: status ? { remote: status } : {}, attachments: [] })
+
+test('saved profiles keep connection status and management visible in every state', () => {
+ const statuses: SSHStatus[] = [
+ { kind: 'idle' }, { kind: 'failed', message: 'Permission denied' }, { kind: 'notInstalled' },
+ { kind: 'confirmHostKey', name: 'remote', fingerprints: [] }, { kind: 'connected', localPort: 19333 },
+ ]
+ for (const host of ['notInstalled', 'failed', 'missingBinary'] satisfies HostState['kind'][]) {
+ for (const status of statuses) assert.equal(showsChat(host, 0, state(status)), true, `${host}/${status.kind}`)
+ assert.equal(showsChat(host, 0, state()), true, `${host}/missing SSH status`)
+ assert.equal(showsChat(host, 0, { profiles: [], status: {}, attachments: [] }), false)
+ }
+})
+
+test('connecting or retrying SSH profiles open the workspace without a local host', () => {
+ for (const status of [{ kind: 'connecting', step: 'Signing in…' }, { kind: 'retrying', message: 'Host unreachable' }] satisfies SSHStatus[]) {
+ assert.equal(isSSHConnecting(status), true)
+ assert.equal(showsChat('notInstalled', 0, state(status)), true)
+ assert.equal(showsChat('failed', 0, state(status)), true)
+ }
+})
+
+test('an available computer or running local host keeps the workspace open', () => {
+ const failed = state({ kind: 'failed', message: 'Permission denied' })
+ assert.equal(showsChat('running', 0, failed), true)
+ assert.equal(showsChat('notInstalled', 1, failed), true)
+})
+
+test('pending SSH rows distinguish idle, connected, retrying and terminal failures', () => {
+ assert.equal(sshStatusDetail({ kind: 'idle' }), 'Not connected')
+ assert.equal(sshStatusDetail({ kind: 'connected', localPort: 19333 }), 'Connected')
+ assert.equal(sshStatusDetail({ kind: 'connected', localPort: 19333 }, false), 'Connected · opening…')
+ assert.equal(sshStatusDetail({ kind: 'connecting', step: 'Opening the tunnel…' }), 'Opening the tunnel…')
+ assert.equal(sshStatusDetail({ kind: 'retrying', message: 'Host unreachable' }), 'Host unreachable Retrying…')
+ assert.equal(sshStatusDetail({ kind: 'notInstalled' }), 'Host not installed')
+ assert.equal(sshStatusDetail({ kind: 'failed', message: 'Permission denied' }), 'Permission denied')
+ assert.equal(sshStatusDetail({ kind: 'confirmHostKey', name: 'remote', fingerprints: [] }), 'Confirm host key…')
+})
+
+test('summary separates active connection attempts from profiles needing attention', () => {
+ assert.equal(sshSummary([{ kind: 'failed', message: 'Permission denied' }, { kind: 'confirmHostKey', name: 'remote', fingerprints: [] }, { kind: 'idle' }]), '2 need attention · 1 not connected')
+ assert.equal(sshSummary([{ kind: 'connecting', step: 'Signing in…' }, { kind: 'retrying', message: 'Host unreachable' }, { kind: 'connected', localPort: 19333 }]), '2 connecting… · 1 opening…')
+ assert.equal(sshSummary([{ kind: 'notInstalled' }]), '1 needs attention')
+ assert.equal(sshSummary([]), '')
+})
diff --git a/apps/desktop/src/shared/ssh-startup.ts b/apps/desktop/src/shared/ssh-startup.ts
new file mode 100644
index 00000000..30d5f1c5
--- /dev/null
+++ b/apps/desktop/src/shared/ssh-startup.ts
@@ -0,0 +1,32 @@
+import type { HostState } from './ipc.ts'
+import type { SSHState, SSHStatus } from './ssh.ts'
+
+export function isSSHConnecting(status: SSHStatus): boolean {
+ return status.kind === 'connecting' || status.kind === 'retrying'
+}
+
+/** Saved remote computers keep their status and recovery controls reachable. */
+export function showsChat(host: HostState['kind'], computers: number, ssh: SSHState): boolean {
+ return host === 'running' || computers > 0 || ssh.profiles.length > 0
+}
+
+/** Statuses here belong to profiles that have not attached a computer yet. */
+export function sshSummary(statuses: SSHStatus[]): string {
+ const connecting = statuses.filter(isSSHConnecting).length
+ const attention = statuses.filter((s) => s.kind === 'failed' || s.kind === 'notInstalled' || s.kind === 'confirmHostKey').length
+ const opening = statuses.filter((s) => s.kind === 'connected').length
+ const idle = statuses.filter((s) => s.kind === 'idle').length
+ return [connecting && `${connecting} connecting…`, attention && `${attention} ${attention === 1 ? 'needs' : 'need'} attention`, opening && `${opening} opening…`, idle && `${idle} not connected`].filter(Boolean).join(' · ')
+}
+
+export function sshStatusDetail(status: SSHStatus, attached = true): string {
+ switch (status.kind) {
+ case 'idle': return 'Not connected'
+ case 'connecting': return status.step
+ case 'retrying': return `${status.message} Retrying…`
+ case 'confirmHostKey': return 'Confirm host key…'
+ case 'connected': return attached ? 'Connected' : 'Connected · opening…'
+ case 'failed': return status.message
+ case 'notInstalled': return 'Host not installed'
+ }
+}
diff --git a/docs/architecture/desktop-app.md b/docs/architecture/desktop-app.md
index fb7fe072..17325d55 100644
--- a/docs/architecture/desktop-app.md
+++ b/docs/architecture/desktop-app.md
@@ -38,6 +38,16 @@ same way; the shared desktop behavior covers macOS and Linux.
## Platform notes
+- **SSH startup** in the shared desktop UI keeps the workspace open whenever saved profiles
+ exist. With no online computer, the detail pane shows each profile's connection
+ progress, failures, reconnect and host-key confirmation controls, plus local host
+ install/retry actions. Manage computers stays reachable throughout. The computer
+ filter distinguishes connecting, attention, disconnected and opening states and
+ keeps local recovery actions reachable when a remote computer is already online.
+ iOS uses direct/encrypted host connections, and the TUI connects to one host;
+ neither manages desktop SSH profiles. Windows exposes the same profile UI, but
+ the tunnel backend still uses `/usr/bin/ssh*` and Unix socket ownership checks;
+ Windows tunnel support has not been implemented.
- **Icons**: SF Symbols may only ship in apps for Apple platforms, so the masks are generated
on macOS at build time and never committed; Linux draws the closest Lucide icons.
- **On-device speech** is macOS only; Linux calls use OpenAI or Gemini on the user's key.