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

@@ -1,7 +1,7 @@
import { beforeAll, describe, expect, it, vi } from 'vitest'
import { render, screen, waitFor } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { buildOpenCodeServerLink, type OpenCodeServer, type OpenCodeServerTestResult } from '@opencode-manager/shared/schemas'
import { buildOpenCodeServerLink, OPENCODE_SERVER_LINK_VERSION, type OpenCodeServer, type OpenCodeServerTestResult } from '@opencode-manager/shared/schemas'
import { OpenCodeServerDialog, type OpenCodeServerFormValues } from './OpenCodeServerDialog'
const testResult: OpenCodeServerTestResult = {
@@ -90,6 +90,20 @@ describe('OpenCodeServerDialog', () => {
expect(screen.queryByText(/Pairing with/)).not.toBeInTheDocument()
})
it('explains that a pairing link from an unsupported version cannot be used', async () => {
const user = userEvent.setup()
renderDialog()
const outdated = pairingLink.replace(`v=${OPENCODE_SERVER_LINK_VERSION}`, 'v=1')
await user.type(screen.getByLabelText('Pairing link'), outdated)
await user.click(screen.getByRole('button', { name: 'Use link' }))
expect(screen.getByRole('alert')).toHaveTextContent(
`This pairing link uses link version 1, but this Manager expects version ${OPENCODE_SERVER_LINK_VERSION}. Update the Manager or the ocm CLI and generate a new QR code.`,
)
expect(screen.queryByText(/Pairing with/)).not.toBeInTheDocument()
})
it('sends clearPassword when the stored password is explicitly cleared', async () => {
const user = userEvent.setup()
const { onSubmit } = renderDialog({ server: savedServer })