Commit Graph
8 Commits
Author SHA1 Message Date
yuez e7ce064817 fix(web): let the view decide the blink, not the CSS colour class
A dot's animation was keyed on its colour class plus a component wrapper:
`html[data-pi-blink-fast="dim"] .tree-row .dot--ok` made green blink only inside
the session tree, `.dot--busy`/`.dot--err` blazed everywhere they appeared, and
`dot--steady` existed only to subtract what that selector had just added. Two
consequences the matrix in docs/session-dot.md already forbids: a failed task's
red blinked forever with no gesture to acknowledge it, and the same session
could blink in the list and sit solid in the stream head.

`DotView` now carries the rate (`blink: "fast" | "slow"`, omitted = solid) next
to the colour, and `<StatusDot>` renders it as `dot--blink-fast` /
`dot--blink-slow`. `dot--steady` is gone — to make a dot solid you omit `blink`.
app.css keeps exactly two dim rules, with no colour or component scoping and no
knowledge of *whether* anything blinks, only of when the shared clock dims it.

Filling in the matrix this exposed: parent `err`/`ok`/`busy` blink fast and
`compacting` slow; a viewed child or subagent failure is solid while an unviewed
one blinks; `interrupted` is the same solid dead red as `exited` (the plugin has
no interrupted, and in the plugin `exited` outranks its own unread flags —
`sessionDot(active)` is now rendered `viewed: true` for the stream head, so one
session can never show two different rates); task dots follow `:PiTasks`
(`taskDotView`, shared by the tray and the output modal) where only `running`
blinks, `completed` is solid green and `stopped` is amber attention. The
`/status` task card renders the same colours, solid, since nothing there
acknowledges anything.
2026-10-28 08:14:25 +08:00
yuez c4d0057b0b test(web): pin the dot matrix, the shared blink clock and markSeen
sessionDot had no test at all, which is how its priority order drifted away
from the plugin. session-dot.test.ts locks the whole matrix: the parent
order (exited > error > attention > done > busy > compacting > idle), every
collision that used to be wrong, the viewed -> current overlay, the separate
child matrix (steady red while viewed, never green, never attention) and the
subagent table.

blink.test.ts covers the one shared clock: phase lockstep, ref counting
(two subscribers, one interval), idempotent unsubscribe, and
prefers-reduced-motion pinning the dots solid.

chat.tree.test.tsx grows up from "a .dot exists" to the actual classes;
sessions-store.test.ts covers markSeen; components.test.tsx covers the dead
status and the steady/current modifiers.

Also makes the current-tab overlay a positive check (idle | busy |
compacting), matching the plugin markable list: a session that has not
reported a status yet ("starting") no longer claims the blue marker.
2026-10-27 19:00:26 +08:00
yuez e910e75849 feat: session-scoped entries query, session title tree and message stream updates 2026-10-27 17:30:28 +08:00
yuez 3789394c85 refactor(web): remove the dead right-panel and subagent-preview code
v0.1.1 replaced both surfaces: the session tray took the right panel's
todo/tasks, and the in-place `?sub=` child view took the subagent preview.

- delete `features/chat/side-panel.tsx` (nothing imported it since the tray
  landed)
- delete `SubagentModal` and its private helpers (`SUB_BADGE`, `SUB_DOT`,
  `SubagentEntry`, `parseSubagentLines`, `SUB_ROLES`); the child view builds its
  timeline from the parent's entries instead of `subagent.read`
- drop `chatCommands.readSubagent` (its only caller is gone)
- drop the deprecated store slice `PreviewTarget` / `preview` / `setPreview`,
  including the session-migration re-key and the `PanelTab` alias
- drop their exclusive CSS (`.sub-item*`, `.sub-preview*`, `.sub-steer`) and the
  6 orphan catalog keys (chat.subagentTitle, chat.preview, chat.previewNote,
  chat.task, chat.currentSubagents, chat.steerRequired)
- tests: remove the two SubagentModal cases and the preview/readSubagent
  expectations (295 tests, down from 297 — exactly the deleted cases)

Verification: typecheck clean, vitest 295/295, vite build green, visual matrix
24/24 clean.
2026-10-27 09:26:36 +08:00
yuez 88e73c7737 feat(web): port the pi2-web-ui-design v0.1.1 UI
Sync the React console with the v0.1.1 prototype (20 CHGs): Quiet Workbench
shell, Chat IA v3, tool-family rendering, and the mobile page pill.

Shell / tokens (CHG-01/04/15/20):
- tokens.css rewritten from the prototype (three-layer light/dark/system),
  `--tabbar-h` removed, new faint/border-subtle/surface-1-2/fs-*/dur-*/reading-max
- 56px icon-only nav rail/sidebar (44x44 hit targets, CSS tooltips, active is a
  solid primary fill, no left bar), 52px topbar, merged preferences menu,
  ⌘K/Cmd-K palette
- `<600` gets a topbar page pill + page sheet; the bottom tabbar is gone

Pages (CHG-01): workspaces becomes a card grid with whole-card links and a
320px recent-activity column; status gets four metric tiles + a zero-primary
layout; connect gets a two-column hero, one primary per state and a collapsed
manual form.

Chat IA v3 (CHG-02/10-14/16-19): two columns, single-workspace tree with a
workspace switch, single-line rows with attention, body-level row popover,
session tray (todo/tasks) replacing the right panel, context ring moved into a
composer telemetry line, right-aligned user messages, queued messages as one
stream entity plus a composer status bar, and an in-place subagent child view.

Tool rendering (CHG-05/06/09): new `features/chat/tools` module — one row per
call, DTO adapter for the daemon's block shape, 11 kind families, state
semantics ("one state, one meaning"), 44px touch targets and the diff row
contrast fix.

i18n: 729 keys per language (zh/en parity checked), 0 unresolved keys.

Verification: web typecheck + 297 vitest + vite build green, root typecheck
green, `scripts/smoke.sh` green, and a new visual harness
(`scripts/ui-mock-server.mjs` + `scripts/ui-shots.mjs`, docs/ui-parity.md)
shoots 4 pages x 3 viewports x 2 themes = 24 screenshots clean with
overflow/console/primary/tabbar assertions. `scripts/e2e/ui-e2e.mjs` selectors
are updated to the new DOM; that suite still needs a real pi + nvim to run.
2026-10-26 20:28:47 +08:00
yuez 06e70204e7 fix(web): render the chat session tree from parent/sub-session lineage
The sidebar treated every workspace session as a root and only nested the
manifest sub-agents, so sub-session files showed up as siblings (the same child
twice); sub-sessions the plugin marked hidden were listed anyway.

- build the tree from `parentId` in a pure `buildSessionTree` model: orphans are
  promoted to roots, cycles and duplicate ids are guarded, real child-session
  rows win over the manifest projection, and the routed row force-opens its
  ancestors
- honour the plugin's `:PiSessions` visibility (`visible: false`) with a "show
  hidden sub-sessions" toggle, the routed-row exception and a dedicated
  all-hidden empty state
- keep tree metadata across WS snapshots, reducer events, id migration and
  parent removal; prefer a root row for the `/chat` index and add a "back to
  parent" action
- document the session-row and `pi2:subagents` list metadata in the protocol
2026-10-22 16:45:09 +08:00
yuez 0ef019f58d 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.
2026-10-21 20:42:19 +08:00
yuez 721661177c 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
2026-10-21 13:32:34 +08:00