Skip to content

The agent that grows with you

fix(desktop): expose custom Hermes path for SSH connections

Yags3093e98506bf
diff --git a/apps/desktop/src/app/settings/connections-registry.test.tsx b/apps/desktop/src/app/settings/connections-registry.test.tsx
index 6a5b4007f70..4002016cdcd 100644
--- a/apps/desktop/src/app/settings/connections-registry.test.tsx
+++ b/apps/desktop/src/app/settings/connections-registry.test.tsx
@@ -120,6 +120,60 @@ describe('ConnectionsRegistrySection', () => {
})
})
+ it('saves a custom remote Hermes path for SSH connections', async () => {
+ render(<ConnectionsRegistrySection />)
+
+ await waitFor(() => expect(screen.getByText('Homelab')).toBeTruthy())
+ fireEvent.click(screen.getByText('Add connection'))
+ fireEvent.click(screen.getByRole('button', { name: 'SSH' }))
+ fireEvent.change(screen.getByPlaceholderText('Homelab'), { target: { value: 'Build host' } })
+ fireEvent.change(screen.getByPlaceholderText('user@host:22'), { target: { value: '[email protected]:2222' } })
+ fireEvent.change(screen.getByPlaceholderText('auto-detect'), {
+ target: { value: '/opt/hermes/bin/hermes' }
+ })
+ fireEvent.click(screen.getByText('Save connection').closest('button')!)
+
+ await waitFor(() => expect(save).toHaveBeenCalledTimes(1))
+ expect(save.mock.calls[0][0]).toMatchObject({
+ host: '[email protected]:2222',
+ kind: 'ssh',
+ label: 'Build host',
+ remoteHermesPath: '/opt/hermes/bin/hermes'
+ })
+ })
+
+ it('clears a saved remote Hermes path back to auto-detect', async () => {
+ const sshRegistry: DesktopConnectionsRegistry = {
+ ...registry,
+ connections: [
+ registry.connections[0],
+ {
+ host: 'build.test',
+ id: 'build-host',
+ kind: 'ssh',
+ label: 'Build host',
+ remoteHermesPath: '/opt/hermes/bin/hermes',
+ tokenPreview: null,
+ tokenSet: false,
+ user: 'dev'
+ }
+ ]
+ }
+
+ list.mockResolvedValueOnce(sshRegistry)
+ render(<ConnectionsRegistrySection />)
+
+ await screen.findByText('Build host')
+ fireEvent.click(screen.getByRole('button', { name: 'Edit' }))
+ const pathInput = screen.getByPlaceholderText('auto-detect') as HTMLInputElement
+ expect(pathInput.value).toBe('/opt/hermes/bin/hermes')
+ fireEvent.change(pathInput, { target: { value: ' ' } })
+ fireEvent.click(screen.getByText('Save connection').closest('button')!)
+
+ await waitFor(() => expect(save).toHaveBeenCalledTimes(1))
+ expect(save.mock.calls[0][0]).toMatchObject({ id: 'build-host', remoteHermesPath: '' })
+ })
+
it('offers every kind on create and disables Local while the managed entry exists', async () => {
render(<ConnectionsRegistrySection />)
diff --git a/apps/desktop/src/app/settings/connections-registry.tsx b/apps/desktop/src/app/settings/connections-registry.tsx
index 8ae3056dd26..b6a32ff8fd2 100644
--- a/apps/desktop/src/app/settings/connections-registry.tsx
+++ b/apps/desktop/src/app/settings/connections-registry.tsx
@@ -57,6 +57,7 @@ interface EditorState {
token: string
host: string
keyPath: string
+ remoteHermesPath: string
// ssh remote profile, hydrated on edit so the duplicate key matches the
// main-process one (user@host:port + profile); the editor doesn't expose it.
remoteProfile: string
@@ -83,6 +84,7 @@ function editorFromConnection(conn: DesktopRegistryConnection): EditorState {
// would silently resurrect the old values.
host: conn.host ? `${conn.user ? `${conn.user}@` : ''}${conn.host}${conn.port ? `:${conn.port}` : ''}` : '',
keyPath: conn.keyPath || '',
+ remoteHermesPath: conn.remoteHermesPath || '',
remoteProfile: conn.remoteProfile || '',
headers: (conn.headerNames || []).map(name => ({ name, stored: true, value: '' }))
}
@@ -98,6 +100,7 @@ function emptyEditor(kind: DesktopConnectionKind): EditorState {
token: '',
host: '',
keyPath: '',
+ remoteHermesPath: '',
remoteProfile: '',
headers: []
}
@@ -451,6 +454,7 @@ export function ConnectionsRegistrySection() {
// of truth — never send separate user/port (see editorFromConnection).
payload.host = editor.host
payload.keyPath = editor.keyPath || undefined
+ payload.remoteHermesPath = editor.remoteHermesPath.trim()
}
const result = await bridge.save(payload)
@@ -931,19 +935,32 @@ export function ConnectionsRegistrySection() {
)}
{editor.kind === 'ssh' && (
- <ListRow
- action={
- <Input
- onChange={e => {
- setDupeError(null)
- setEditor({ ...editor, host: e.target.value })
- }}
- placeholder="user@host:22"
- value={editor.host}
- />
- }
- title={s.sshHostTitle}
- />
+ <>
+ <ListRow
+ action={
+ <Input
+ onChange={e => {
+ setDupeError(null)
+ setEditor({ ...editor, host: e.target.value })
+ }}
+ placeholder="user@host:22"
+ value={editor.host}
+ />
+ }
+ title={s.sshHostTitle}
+ />
+ <ListRow
+ action={
+ <Input
+ onChange={e => setEditor({ ...editor, remoteHermesPath: e.target.value })}
+ placeholder={t.settings.gateway.sshHermesPathPlaceholder}
+ value={editor.remoteHermesPath}
+ />
+ }
+ description={t.settings.gateway.sshHermesPathDesc}
+ title={t.settings.gateway.sshHermesPathTitle}
+ />
+ </>
)}
{dupeError ? <p className="text-xs text-destructive">{dupeError}</p> : null}