fix(web): make the web console work end-to-end

- Pair through the public POST /api/v1/pair and persist the device scopes;
  keep the allow-listed next deep link. Rename the manual field to pairing code.
- Authenticate the WebSocket with the raw device token (strip Bearer) and
  recover from a 401 by clearing the connection once.
- Fix chat payloads: setModel/setThinking, attention/diff responses, subagent
  dispatch items, queue ids/mode, task output and WS resume since.
- Render exactly one assistant message per turn: one-to-one snapshot/history
  merge plus a stale-delta guard after message_end (fixes PONGONG).
- Fix dialogs (content above the overlay), unknown-session deep links
  (error + retry, no silent fallback), device list/revoke, status identity and
  live pairing code, reconnect banner and Playwright selectors.
This commit is contained in:
yuez committed 2026-10-21 20:42:19 +08:00
1 parent 5572ac0d84
commit 0ef019f58d
57 files changed
+3549 -684

No files matched your search

+26 -1
View File
@@ -1,4 +1,4 @@
import type { Batch, Entry, SessionState, Subagent, TodoItem } from "@protocol/types";
import type { Batch, Entry, SessionState, Subagent, TaskItem, TodoItem } from "@protocol/types";
import { emptySessionState } from "@/features/chat/session-state";
@@ -27,6 +27,31 @@ export function subagentFixture(overrides: Partial<Subagent> = {}): Subagent {
};
}
export function taskFixture(overrides: Partial<TaskItem> = {}): TaskItem {
return {
id: "t1",
command: "pnpm test",
status: "completed",
startTime: Date.now() - 5_000,
durationMs: 4_200,
exitCode: 0,
outputFile: "/tmp/pi2-task-t1.log",
...overrides,
};
}
/** `task.output` ack for `taskFixture()`. */
export function taskOutputFixture(overrides: Record<string, unknown> = {}): Record<string, unknown> {
return {
output: "$ pnpm test\n42 passed",
outputFile: "/tmp/pi2-task-t1.log",
status: "completed",
exitCode: 0,
durationMs: 4_200,
...overrides,
};
}
export function todoFixture(): TodoItem[] {
return [
{ content: "Inspect callers", status: "completed" },