feat(terminal): pairing, sign-in per mode, device app router and live states (platform-v2 3.1c)

- Pairing screen: requests a code, shows it big, polls with the secret, new code on
  expiry, keeps the device token; "removed from the venue" notice after a revoke.
- Sign-in per device mode: PIN (name + PinPad), tap your name, password (name +
  password), none (straight into the app). Names = holders of <app>.access, refreshed
  every 30 s and on reconnect. Slim bar with screen, user and Sign out; idle sign-out
  after the device's auto_sign_out_minutes; hourly token refresh (same session).
- DeviceProvider: GET /api/devices/me (retried while unreachable), session, the live
  connection with credentials in the first frame (device.updated -> reload, app moved ->
  sign out, device.revoked -> forget, session.ended -> sign out), offline banner;
  useLiveEvent for apps. Screen choice is pure (device/flow.js, unit-tested).
- Blocked screen: app turned off / not licensed / device refused, recovers by itself.
- @xenia/access AccessProvider: autoRetryMs (retry bootstrap while unreachable).
- Tests: terminal unit tests (screen choice, live actions, idle, pairing polls), new
  tests/e2e/terminal.mjs (18 checks), manager.mjs owner flow now pairs and signs in on
  the real terminal screen; run-all runs terminal.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 17:29:18 +02:00
co-authored by Claude Opus 5.5
parent 7ff3c3b48e
commit c24cb72640
22 changed files with 928 additions and 83 deletions
+12
View File
@@ -168,3 +168,15 @@ ${terminal ? ` - "${terminal}:8082"
},
}
}
/** The terminal app's Vite dev server (plan phase 3) on `port`, proxied to `backendUrl`. */
export async function startTerminalVite({ port = 5187, backendUrl }) {
const log = openSync(path.join(OUT, `vite-${port}.log`), 'w')
const child = spawn('npx', ['vite', '--port', String(port), '--strictPort'], {
cwd: path.join(CS, 'terminal'), shell: process.platform === 'win32', detached: process.platform !== 'win32',
stdio: ['ignore', log, log], env: { ...process.env, XENIA_BACKEND: backendUrl },
})
await waitHttp(`http://localhost:${port}/`)
await fetch(`http://localhost:${port}/src/main.jsx`).catch(() => {}) // warm the first compile
return { url: `http://localhost:${port}`, stop: () => killTree(child) }
}