Commit Graph

10 Commits

Author SHA1 Message Date
jay df735aa279 fix(sidecar): POST /sessions response now matches GET shape (id+name+state+lastOutputAt)
Previously POST returned only { id, name }, while GET returns
{ id, name, state, lastOutputAt }. iOS clients that share a Decodable
for both endpoints (e.g. SessionItem in pi-remote-ios) failed to decode
the POST response with 'data couldn't be read because it is missing'.

The new session always starts in 'idle' state with empty lastOutputAt.
Documented the new shape in the route header comment.
2026-05-16 22:07:54 +02:00
jay a7c7b8f3d7 fix(sidecar): WS stream handler — process keys/key/paste messages 2026-05-16 12:07:16 +02:00
jay 4b428df0a4 fix: capturePane with escapes=true for color-accurate snapshots 2026-05-16 03:46:24 +02:00
jay fcfe729d23 fix: terminal size sync — resize message handler + xterm-256color default-terminal 2026-05-16 03:30:27 +02:00
Johannes Merz b64aaab40a fix: WS upgrade auth — multi-token bearer not validated
Problem: isAuthenticated() for WS upgrade only checked legacy single token.
iOS bearer token (from POST /pair → createToken()) was rejected → 403 on WS.

Fix:
- warmTokenCache(): pre-load all multi-tokens into a sync Set on startup
- validateBearerSync(): O(1) sync lookup against the cache
- createToken(): adds to cache immediately on creation
- isAuthenticated(): checks validateBearerSync() as third fallback
2026-05-16 03:12:43 +02:00
Johannes Merz 920f6d8fc3 fix: import readBody+sendJson in server.ts — POST /pair was crashing 2026-05-16 03:04:07 +02:00
Johannes Merz 571cf8c9ec feat: GET /pair-qr endpoint — QR code in terminal, fix double-port bug 2026-05-16 02:56:06 +02:00
Johannes Merz 1f36636e06 feat: POST /pair endpoint + async bearer token auth
- POST /pair: consumes one-time pairingToken, creates named bearer token,
  returns { bearerToken, sidecarId } per IC-3
- isAuthenticatedAsync(): checks legacy token + new multi-token store
- isAuthenticated(): extended with Bearer header support for WS upgrade
- Smoke still 12/12 green
2026-05-16 02:46:15 +02:00
Johannes Merz b94b668df6 feat(T-1.5/1.6/1.7): stream+input+snapshot routes, sessions CRUD, commands, side-channel, health endpoint 2026-05-15 11:35:55 +02:00
jay 568931901d refactor(T-1.0): carve server.ts into server/ sub-modules
Create the modular server/ layout from PHASE-1-sidecar.md §Architecture Sketch:

  server/types.ts    — shared WsClient/WsServer/RemoteServer interfaces
  server/upgrade.ts  — WS upgrade routing per path (LEGACY /ws)
  server/server.ts   — HTTP bootstrap, middleware, LEGACY HTML routes
  server/routes/     — empty dir, placeholder for T-1.5/T-1.6/T-1.7

The original extensions/remote-control/server.ts is replaced with a
thin re-export shim so that index.ts continues to resolve
'./server.js' without changes.

All LEGACY code paths (manifest.json, icon.svg, /, /ws) are tagged
with // LEGACY: … comments. No behaviour changes. No new endpoints.

Pre-existing biome errors in auth.ts, config.ts, index.ts are
unchanged — NOT introduced by this commit.
2026-05-15 10:57:52 +02:00