feat(servers): harden pairing and run linked-server sessions in the UI

Replace the plaintext pairing exchange with a nonce and HMAC proof plus
AES-256-GCM encrypted credentials, bumping links to v2. Track session
ownership per linked server so activity, session picker, transcript, MCP
and skills views work against remote servers. Share encrypted secret
access, event routing and URL helpers across backend, shared and CLI.
This commit is contained in:
Chris Scott committed 2026-10-18 20:27:34 -04:00
1 parent c591c15743
commit f566556fd6
77 files changed
+3170 -702

No files matched your search

@@ -136,6 +136,8 @@ function activeWorkItem(
key: `${directory}:${id}`,
session: itemSession,
repo: itemRepo,
serverId: null,
serverName: null,
state,
updatedAt: itemSession.time.updated,
path: `/repos/${itemRepo.id}/sessions/${id}`,
@@ -877,4 +879,76 @@ describe('SessionPickerDialog', () => {
pinned: true,
})
})
describe('linked-server mode', () => {
beforeEach(() => {
mocks.repos = [repo(1, 'alpha', '/w/a')]
mocks.sessionsData = [session('ses_remote', 'Remote session', '/home/me/app')]
})
it('lists the project sessions without Manager-only tabs and reports the chosen server session', async () => {
const onSelectRemoteSession = vi.fn()
renderPicker({
remote: {
serverId: 'srv_kitchen',
serverName: 'Kitchen',
projectDirectory: '/home/me/app',
},
onSelectRemoteSession,
})
expect(screen.queryByRole('tab', { name: 'Projects' })).not.toBeInTheDocument()
expect(screen.getByRole('tab', { name: 'Active' })).toBeInTheDocument()
const row = await screen.findByRole('option', { name: /Remote session/ })
expect(row).toHaveTextContent('Kitchen')
fireEvent.click(row)
expect(onSelectRemoteSession).toHaveBeenCalledWith(
expect.objectContaining({ id: 'ses_remote' }),
'srv_kitchen',
)
})
it('navigates a remote active work row through the owning server', async () => {
const onSelectRemoteSession = vi.fn()
mocks.activeWorkGroups = {
needsInput: [
{
key: '/home/me/app/ses_remote',
session: session('ses_remote', 'Remote pending', '/home/me/app'),
repo: null,
serverId: 'srv_kitchen',
serverName: 'Kitchen',
state: 'needs-input',
updatedAt: Date.now(),
path: '/servers/srv_kitchen/sessions/ses_remote',
},
],
running: [],
recent: [],
}
renderPicker({
remote: {
serverId: 'srv_kitchen',
serverName: 'Kitchen',
projectDirectory: '/home/me/app',
},
onSelectRemoteSession,
})
openActiveTab()
const row = await screen.findByRole('option', { name: /Remote pending/ })
expect(row).toHaveTextContent('Kitchen')
expect(screen.queryByRole('button', { name: 'Session actions' })).not.toBeInTheDocument()
fireEvent.click(row)
expect(onSelectRemoteSession).toHaveBeenCalledWith(
expect.objectContaining({ id: 'ses_remote' }),
'srv_kitchen',
)
})
})
})