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

+31
View File
@@ -47,6 +47,37 @@ describe("chat message stream", () => {
expect(screen.getByText("agent aborted").closest(".msg__error")).not.toBeNull();
});
it("exposes data-entry-id / data-role on every message", () => {
renderStream();
const user = screen.getByText("Fix the auth bug").closest("article");
expect(user).toHaveAttribute("data-entry-id", "u1");
expect(user).toHaveAttribute("data-role", "user");
const assistant = screen.getByText("Looking at the auth path now.").closest("article");
expect(assistant).toHaveAttribute("data-entry-id", "a1");
expect(assistant).toHaveAttribute("data-role", "assistant");
});
it("exposes the load-older selector only while older pages exist", () => {
const session = fullStreamSession();
const props = {
session,
entries: session.entries,
loadingOlder: false,
error: null,
onLoadOlder: vi.fn(),
onRetry: vi.fn(),
onOpenSubagent: vi.fn(),
};
const { rerender } = render(<MessageStream {...props} hasMore />);
const button = screen.getByTestId("load-older");
fireEvent.click(button);
expect(props.onLoadOlder).toHaveBeenCalledTimes(1);
rerender(<MessageStream {...props} hasMore={false} />);
expect(screen.queryByTestId("load-older")).not.toBeInTheDocument();
});
it("expands a tool card to show output and an edit diff", () => {
renderStream();