Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4053dcb
feat(remote): open a remote CodeNomad project in a tab of the local w…
pascalandr Nov 5, 2026
25394d9
fix(tauri): let the app-wide navigation guard admit remote project views
pascalandr Nov 5, 2026
51d27db
fix(auth): keep a password sign-in for seven days across browser rest…
pascalandr Nov 5, 2026
ce7f77a
fix(remote): reselect the embedded project's active session after a r…
pascalandr Nov 5, 2026
9007c28
fix(sessions): wait for the agent and model catalogue before creating…
pascalandr Nov 5, 2026
d430082
fix(remote): name a remote tab by its server's name, not its raw address
pascalandr Nov 5, 2026
474f3ca
feat(remote): make Remotes the home page's only CodeNomad server entry
pascalandr Nov 5, 2026
6941613
docs(remote): describe saved servers through Remotes in help and dev-…
pascalandr Nov 5, 2026
ba73983
feat(remote): browse this computer or a saved server, and manage serv…
pascalandr Nov 5, 2026
bee679e
docs(remote): describe Browse and Settings -> Servers in help and dev…
pascalandr Nov 5, 2026
756af7d
feat(home): recent tabs and Browse on the right, creation buttons on …
pascalandr Nov 5, 2026
1443615
docs(home): describe recent tabs, Browse and the creation buttons
pascalandr Nov 5, 2026
efda88c
fix(home): Add server back in Browse, a lighter launcher and a collap…
pascalandr Nov 5, 2026
2ce727b
docs(home): Recent, Add server in Browse and the launcher's two buttons
pascalandr Nov 5, 2026
47a879b
feat(remote): add servers through an inline field in Browse, without …
pascalandr Nov 5, 2026
3cf7f91
docs(remote): add servers through Browse's inline field
pascalandr Nov 5, 2026
cbc499b
feat(tabs): open disposable blank tabs from the tab-bar plus button
pascalandr Nov 5, 2026
34668ca
docs(tabs): explain empty tabs and logo-based home navigation
pascalandr Nov 5, 2026
6364e29
fix(tabs): reuse Home for blank tabs and save servers without opening
pascalandr Nov 5, 2026
b3fb499
feat(remote): browse server folders in place with backend-held sessions
pascalandr Nov 6, 2026
fef67f9
docs(remote): describe inline browsing and private backend connections
pascalandr Nov 6, 2026
68fb38e
fix(remote): permit every saved server destination address
pascalandr Nov 6, 2026
aba4eca
feat(remote): redeem pairing links through a dedicated server protocol
pascalandr Nov 6, 2026
54116d1
docs(remote): specify server pairing security and recovery
pascalandr Nov 6, 2026
0720f8d
fix(remote): redeem valid pairing codes before throttling failures
pascalandr Nov 6, 2026
03c4059
feat(projects): consolidate project opening around one selector
pascalandr Nov 7, 2026
d25ff96
fix(servers): bind credentials to their destination and share revocat…
pascalandr Nov 7, 2026
d3ea1b2
fix(projects): restore home styling and refine tab opening surfaces
pascalandr Nov 7, 2026
8a2687a
feat(remote): browse servers by path and open remote tabs without a s…
pascalandr Nov 8, 2026
faa0cde
fix: address review round 1
pascalandr Nov 8, 2026
a94c2aa
docs(help): describe remote tab sign-in for users
pascalandr Nov 8, 2026
68c1709
fix: address review round 2
pascalandr Nov 8, 2026
4d3a448
docs(help): place a saved server's folders and recents where they appear
pascalandr Nov 8, 2026
d836818
fix(projects): show the browsed server in the Recent tabs header
pascalandr Nov 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ jobs:
packages/ui/src/lib/retained-size.test.ts
packages/ui/src/lib/provider-auth.test.ts
packages/ui/src/lib/remote-pairing-link.test.ts
packages/ui/src/lib/codenomad-link.test.ts
packages/ui/src/lib/embed-mode.test.ts
packages/ui/src/lib/remote-project-recents.test.ts
packages/ui/src/lib/native/browser.test.ts
packages/ui/src/lib/runtime-env.test.ts
packages/ui/src/lib/session-transcript-lru.test.ts
Expand Down Expand Up @@ -485,6 +488,7 @@ jobs:
packages/ui/src/stores/instance-startup-priority.test.ts
packages/ui/src/stores/session-list-startup.test.ts
packages/ui/src/stores/app-tabs.test.ts
packages/ui/src/stores/remote-project-tabs.test.ts
packages/ui/src/stores/forms.test.ts
packages/ui/src/stores/preferences-favorites-mode.test.ts
packages/ui/src/stores/instances-restore-ownership.test.ts
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Paths are under `packages/ui/src/` or `packages/server/src/` unless stated.
- **Session state and recovery** (`stores/session-state.ts`, `stores/session-generation-recovery.ts`): `dev-docs/SESSION_RECOVERY.md`.
- **Dialogs, utility windows, icon toggles, surfaces and scrollbars** (`alert-dialog.tsx`, `dismissible-window.tsx`, auth recovery, `styles/utilities.css`, `index.css`): `dev-docs/UI_CONVENTIONS.md`.
- **Settings and Preferences** (settings rows/actions, Preferences window and project context, Providers/Web search, Stats, notifications, bug report): `dev-docs/SETTINGS.md`; provider accounts and usage `dev-docs/PROVIDER_ACCOUNTS.md`; hotkeys `dev-docs/HOTKEYS.md`; palettes `dev-docs/PALETTE_SOURCES.md`; plugin controls `dev-docs/PLUGIN_CONTROLS.md`; right-panel customization and panel extensions `dev-docs/PANEL_EXTENSIONS.md`.
- **Projects and tabs** (closing tabs, temporary workspaces, new-instance launcher, Git-unavailable mode): `dev-docs/PROJECTS.md`.
- **Projects and tabs** (closing tabs, temporary workspaces, new-instance launcher, Git-unavailable mode, remote project tabs and embedded single-project mode): `dev-docs/PROJECTS.md`.
- **Files panel and Git** (Workspace/Changes/Commits, file watches, Git init, whitespace filter): `dev-docs/FILES_PANEL.md`.
- **Worktrees and event ownership** (`workspaces/native-worktrees.ts`, `workspaces/worktree-inventory.ts`): `dev-docs/WORKTREE_SESSION_PLACEMENT.md`.
- **OpenCode runtime, setup, upgrades and OpenCode settings**: `dev-docs/OPENCODE_RUNTIME_SETUP.md`; bundled plugin builds, provisioning, presence readiness, the event relay and the Design agent and skills (`opencode/design/`): `dev-docs/OPENCODE_COMPATIBILITY.md`; connection budget: `dev-docs/CACHE_REFRESH_CONVENTIONS.md`; session environment: `dev-docs/SESSION_ENVIRONMENT.md`; pruning: `dev-docs/SESSION_PRUNING_RPC.md`.
Expand Down
17 changes: 16 additions & 1 deletion dev-docs/PROJECTS.md

Large diffs are not rendered by default.

121 changes: 111 additions & 10 deletions dev-docs/REMOTE_CONTROL.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ browser ─TLS─▶ OpenTunnel relay (forwards ciphertext) ─▶ OpenTunnel SD
- `request-origin.ts` is the only authority for local privileges:
`isLocalRequest()` requires a loopback peer **and** a non-ingress socket.
- `gate.ts` runs before CORS, authentication and routing. It requires the exact
tunnel `Host` and the public `Origin` on mutations, and strips forwarding
tunnel `Host` and the public `Origin` on browser mutations, and strips forwarding
headers. It accepts origin-form targets only (no absolute-form, leading `//`
or fragment, which the router would reinterpret) and judges the path the
router routes (`server/routed-path.ts`). It denies host-only paths: login and token
Expand All @@ -73,7 +73,8 @@ browser ─TLS─▶ OpenTunnel relay (forwards ciphertext) ─▶ OpenTunnel SD
`pairingRequired`. The recovery dialog then explains how to pair again
instead of offering password login, keeping the page and its drafts.
Pairing from another tab restores it on the next check.
- `devices.ts` issues one five-minute, single-use pairing code. The link carries
- `devices.ts` issues one 192-bit, five-minute, single-use pairing code shared by
browser and server pairing. Consuming it through either route exhausts it for both. The link carries
it in the fragment, never in the query or a log. It stores SHA-256 hashes of
device credentials and expires devices after 30 days without use.
`__Host-codenomad_device` is `Secure; HttpOnly; SameSite=Lax`. Revocation,
Expand All @@ -82,20 +83,120 @@ browser ─TLS─▶ OpenTunnel relay (forwards ciphertext) ─▶ OpenTunnel SD
only once Remote Control is used.
- Remote devices authenticate even with `--dangerously-skip-auth`, and the
local session cookie is never accepted on the ingress.
- A desktop CodeNomad pairs as a device: pasting a pairing link into Add server
saves only the tunnel origin and opens the remote window once on the link
(`lib/remote-pairing-link.ts`). The profile keeps TLS verification on, since
a Tauri TLS-proxy window uses an incognito store without the device cookie.
The code is never stored with the server;
re-pairing a saved server reuses its window storage, which keeps the device
cookie across launches. Covered by `tests/browser/remote-server-pairing.test.ts`.
- Browser pairing consumes the link in the intended browser/profile through
`/api/remote-control/pair`. Its exact public `Origin` checks remain mandatory.
Direct listeners refuse both pairing routes. Pasting a pairing link into the
desktop server-add field saves the tunnel-origin profile and asks the local
backend to redeem the code through the server protocol below. Embedded views
receive that device's existing cookie through the view-session flow below
([PROJECTS.md](PROJECTS.md#agent-conventions)). Never persist a pairing
code or retain it for native opening.
- `--connect-server` opens a saved server or URL at launch through that same
connect flow ([architecture.md](architecture.md#native-profiles-windows-and-client-state)).
It refuses URLs with user info or a fragment, so a pairing code or password
never travels on a command line; pair from Add server instead.
never travels on a command line; use the server-add field or the intended browser for pairing links.

## Backend-to-backend pairing

`POST /api/remote-control/server-pair` is a dedicated HTTPS tunnel-ingress
protocol. `server-pairing.ts` guards its exact routed path before CORS, authentication
and routing; the remote gate exempts only that path from browser mutation `Origin`
requirements. The direct listener returns 404. Never forge an `Origin` to pair.

- Require `X-CodeNomad-Server-Pairing: 1`, exact `Content-Type: application/json`,
and a body of at most 4096 bytes: `{code, hostName}`, with a 32-character base64url
code and a hostname of at most 255 characters.
- Refuse every non-POST and any presence of `Origin` (including `null`), `Cookie`,
`Cookie2`, `Authorization`, `Proxy-Authorization`, `Referer`, `sec-fetch-*` or
`access-control-request-*` headers before CORS. Responses carry `Cache-Control:
no-store`, omit CORS and `Set-Cookie`, and return `{device, credential}` only to
the calling backend on success. Code possession is the authorization; excluding
ambient authentication and browser/preflight metadata confines this exchange
to the explicit protocol while browser pairing keeps its own admission checks.
- Valid codes are checked and atomically consumed through the manager exchange
before the global failure bucket: successful pairings always proceed, even
after an anonymous failure flood, and never count toward the quota. The bucket
allows ten failure responses per minute per remote backend, then returns 429
with `Retry-After`. Replayed codes remain invalid and receive 401 or 429 according
to the failure budget. The cryptographically random 192-bit code expires after
300 seconds; even at one million guesses per second, the chance of guessing it
is below 4.8 × 10^-50. Code entropy supplies the guessing resistance; the quota
throttles failure responses while keeping valid links redeemable. Browser
pairing has no failure quota and keeps its exact public `Origin` checks.
- The device uses the shared registry's 30-day idle expiry, revocation and
least-recently-seen eviction. Its display name is `CodeNomad · <backend hostname>`:
a self-reported label, with identity assurance supplied by code possession and
the TLS endpoint rather than hostname attestation.

The local backend validates an HTTPS pairing link against the exact saved origin
before DNS resolution. A fresh, cookie-free, bounded exchange strips Undici Fetch
metadata, follows the saved TLS policy and endpoint-identity checks, and refuses
redirects and foreign origins. It verifies `/api/auth/status` reports device
authentication before persisting the device cookie in private
`remote-server-credentials.json` (mode `0600`). Protect the configuration directory
and its platform permissions as credential storage. Pairing returns success to
the local UI, and the add field is scrubbed after the attempt. Never retain codes
for retries or expose pairing credentials in UI state or logs.

HTTP, HTTPS and the private bridge share the backend's browse authority and private
credential cache. Admission captures the profile id, exact origin, TLS policy and
revocable generation before queueing; dispatch and credential publication recheck
that authority. Address/TLS changes invalidate active and queued operations and
stored identities. Persisted entries without a TLS-policy field bind to verified TLS.
Forgetting through any listener revokes every listener's active and queued browsing.
Backend shutdown closes the shared owner; standalone listeners release their shared
lease, and the last lease closes the connections.

The credential survives local launches. Forgetting the saved server deletes it;
revocation clears the rejected credential. To repair tunnel browsing, use Back to
Browse and paste a fresh pairing link into the add field. Pairing errors name the
saved server. Home and blank tabs own this named-server browsing flow.

Compatibility is capability-based: an endpoint returning 403 (including an older
browser-Origin rejection), 404 or 405 maps to `pairing_unavailable` and offers
inline password recovery. Password login on tunnel ingress remains host-only:
update the remote server for backend pairing, or save its direct-listener URL for
password access. Invalid, expired or replayed codes map to `pairing_expired`
(`pairingExpired` in UI translations); 429 maps to `pairing_rate_limited`
(`pairingRateLimited`). Obtain a fresh link for expired codes and wait before
retrying a rate-limited attempt.

## Native view sessions

The local backend checks access before the host opens an embedded project URL.
Profiles without stored credentials use a fresh, unauthenticated status request
through the browse transport and its origin/TLS policy. An authenticated status
without a pairing requirement returns an empty view-session result: the host opens
without installing a cookie or showing a sign-in form. Other profiles requiring
credentials keep the inline sign-in flow. Password profiles use a fresh, cookie-free login
with the backend-held password to obtain a dedicated remote session. Never forward
the stored password to the renderer or native host. Paired profiles reuse the
existing device cookie, sharing that device's revocation and 30-day idle lifetime.
Isolating device authentication requires a separate credential mechanism.

The view-session endpoint uses the same admission as backend browsing: a loopback,
non-ingress request with the trusted local self-Origin guard. Admission captures
the profile id, exact origin, TLS policy and revocable generation; dispatch and
return recheck that authority. The outbound login follows the captured TLS policy
and endpoint-identity checks. Never follow redirects or write credentials during
a view-session request. The renderer transports the returned cookie ephemerally
to the native cookie jar, bound to its exact origin, before navigation. Never log
the cookie or persist it in UI state. Keep the pairing code scrubbed after redemption.

When a remote recent requires credentials, Home, the left Recent tabs panel of a
blank tab and the `+` menu show the form in place before creating a project tab.
Restored remote tabs show it inside the tab. The username starts as `codenomad`;
focus starts on the password and failures remain inline for retry. Revoked tunnel
devices use the existing fresh-link pairing repair. Project selection explicitly
labels the separate-window fallback for profiles skipping TLS verification and
hosts without embedded views.

## Validation

- `codenomad-servers/review-regressions.test.ts` covers queued passwords across
address/TLS changes, persisted TLS binding, cross-listener Forget and shared-owner
shutdown with real HTTP remotes.

- `remote-surface.test.ts` drives the real `createHttpServer` through the
ingress. It covers unpaired access, pairing, `Origin`/`Host` checks,
host-only paths including encoded ones, loopback privileges, spoofed headers,
Expand Down
Loading
Loading