feat(web): workspaces, connect and status pages plus the full chat experience

- workspaces list + new-workspace flow (add -> ensure -> navigate), server context bar
- connect: manual/pair-code redeem, QR scan with paste fallback, paired summary, disconnect
- status: info/health/resources/models/devices/connection cards with 3s visible-only polling
- chat: 3/2/1-column layout, session tree, virtualized stream, tool/thinking/todo/batch blocks,
  composer with queue chips and abort, subagents/todo/tasks panel, attention + diff review modals,
  history pagination merged with live entries
- canonical reducer reused via @protocol alias (no duplicated types)
- 63 vitest tests, typecheck + build green, zh/en parity at 411 keys
This commit is contained in:
yuez committed 2026-10-21 13:32:34 +08:00
1 parent 2e5d6d5006
commit 721661177c
61 files changed
+10931 -355

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
/**
* Type surface for the canonical reducer (`../src/protocol/reducer.ts`).
*
* The implementation is imported at runtime through the `@protocol` Vite alias
* so the browser reuses the daemon's reducer instead of a copy. TypeScript
* consumes this declaration rather than the upstream file because the daemon
* source is compiled with different lint flags (it has an unused type import
* that `noUnusedLocals` would reject here). Keep this in sync with the exports
* of `src/protocol/reducer.ts`.
*/
import type { ModelRef, SessionEvent, SessionState, ThinkingLevel } from "@protocol/types";
export interface ReducerContext {
nextEntry: number;
assistantEntryId: string | null;
userEntryId: string | null;
/** toolCallId -> location of the tool block */
toolBlocks: Map<string, { entryId: string; index: number }>;
/** streamed tool call argument buffers, keyed by toolCallId */
toolArgs: Map<string, string>;
}
export interface Reducer {
state: SessionState;
ctx: ReducerContext;
}
export interface StateInit {
sessionId: string;
workspaceId?: string;
cwd?: string;
name?: string | null;
status?: SessionState["status"];
model?: ModelRef | null;
thinking?: ThinkingLevel | null;
}
export function createReducer(init: StateInit): Reducer;
export function applyEvent(reducer: Reducer, event: SessionEvent): void;
export function reduceAll(init: StateInit, events: SessionEvent[]): SessionState;