Opening a project showed a toast on success and a bare code (`E_FORBIDDEN`) on
failure: no reason, no retry, and a workspace card that kept claiming "Instance
stopped" because `instance_state` frames were dropped by the socket layer.
- The dialog validates a non-absolute path inline, sends `alias` (the field the
daemon persists), maps the daemon's status/code/message to a specific sentence
(`~` expansions, missing directory, roots allowlist, permissions), and keeps
itself open on a spawn failure with the daemon's reason plus a retry that
re-sends only `instance.ensure`.
- `lib/ws` handles `instance_state` by invalidating `workspaces`/`health`
(coalesced at 250 ms across sockets) so the grid reflects reality.
- A never-started workspace renders as "not started · opens on demand" instead
of "stopped", and a degraded/stopped instance shows `instance.reason`.
Workspaces page:
- list the newest sessions across workspaces in the activity column; the
daemon exposes GET /api/v1/sessions/recent as a disk projection and the
browser enriches live rows from the per-workspace session relay
- put recent activity first below 1100px and fix the mobile page-header
flex-basis gap
Smoke:
- pin PI2_HOST=127.0.0.1 in both smoke scripts and make the startup-line
assertion follow the configured host; the daemon default stays 0.0.0.0
Install:
- standalone binary build/install scripts, packaging templates, CI/release
hooks, CLI-first install docs and the supporting config/doctor changes
The workspace list only changes when a query refetches — a new workspace, a name
change or a session count from another browser waits for a poll, and the socket
carries the same information unused.
`parseWorkspaceUpdate` narrows a `workspace_update` frame defensively (hostile
or half-filled payloads return null rather than throwing), and
`applyWorkspaceUpdate` merges one row into the `["workspaces"]` and
`["chat-workspaces"]` caches, upserts the zustand store and invalidates
`["health"]` so the status page re-reads instance state.
Not wired yet: `src/instances/connection.ts` still drops `workspace_update` on
the floor, so the daemon never relays it to a browser and the module has no
caller. This lands the validated reducer and its tests so the daemon-side relay
has something to plug into; the queries.ts fallback (poll only while the socket
is down) covers the gap meanwhile.
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.
The metrics tiles now prefer the daemon's own sample (`resources.system`, then
`info.cpu/mem/disk`) over the old RSS-over-physical-memory guess, and each tile
gained the detail that makes the number actionable: cores and 1-minute load,
used/total bytes, the filesystem the disk figure describes.
The models card stops asking for a workspace it does not have. It calls the bare
endpoint (no spawn), polls every 1.5 s while the plugin's cache is still filling
(bounded to 12 rounds), and tells the three empty states apart instead of showing
one generic "no models": still fetching, no live instance, no live session. With
no workspace to key on, `fetchModels` also tolerates a legacy daemon that
requires the parameter, retrying with the first visible workspace.
Smaller fixes that fell out of the same read: `formatBytes` printed "4.00 GiB"
for a whole number of GiB, and the workspaces query now polls every 5 s only
while the socket is down, so a dropped connection still refreshes the page.
Review caught two holes in the previous commit.
interrupted was ranked below error/attention/done, so an interrupted session
with a stale error flag still blinked red, one with pending attention still
wore the amber dot, and one with a done flag still turned green. In the
plugin there is no interrupted at all: any non-running row is exited
(sessions.lua:75-78) and exited sits at the top of dot_hl. interrupted now
shares that slot.
The subagent tables were not actually consolidated: subagent-view.tsx and
telemetry.tsx each kept their own SUB_DOT, still painting interrupted amber
and completed green. All three now go through subagentDot(); in a subagent
view the row is the one you have open, so a failed child is steady red there.
The sidebar rendered whatever order the plugin payload happened to carry
(disk mtime desc, then Lua hash order). It now mirrors pi2.nvim:
- roots ranked by the tab's visual position (`tabRank`, falling back to the
`tab` handle), a lineage occupying the earliest tab it occupies;
- siblings (real sub-session rows and manifest subagents merged into one list)
by `createdAt` desc with the id as tie-break, a session row inheriting its
manifest entry's `createdAt`, matching `manifest.lua`;
- deterministic code-unit comparisons plus a root tie-break chain, so WS
arrivals and payload order can no longer shuffle rows.
`session-order.ts` is the single owner of the rule; the tree model renders it
and the /chat index default is the sidebar's top root.
List metadata the web console needs to order the chat session list like
pi2.nvim's :PiSessions: the tab handle, its 1-based visual tabline position,
and the creation/last-activity timestamps. Never emitted by the reducer; the
web normalizer and the sessions store preserve them across snapshot and live
event updates.
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.
The Chat session list dot did not follow the plugin it mirrors
(:PiSessions in pi2.nvim, lua/pi/ui/sessions.lua). Four things were wrong:
- priority: attention outranked error and exited; the plugin order is
exited > error > attention > done > busy > compacting > idle.
- interrupted wore the attention amber, the same colour as "waiting for you";
it is a dead process, so it takes the solid exited red (dot--dead).
- exited and dormant were collapsed into the hollow grey ring; a dead parent
is the solid red one, the hollow ring is the dormant sub-session.
- sub-sessions reused the parent matrix. They now follow child_dot_hl: a
failed child is steady red while you are looking at it and blinking red
while you are not, busy/compacting blink at the busy rate, and a child
never shows green (the plugin forces done=false there).
The current-tab marker (PiSessionsListCurrent) was missing entirely: the row
the console has open now carries dot--current, steady on idle and blinking
on busy, and never on top of a notification colour - same guard as
refresh_current_markers. It is the browser analogue of the focused nvim tab,
so no wire change is needed.
Also drops the unreachable sessionDotClass() dead code, whose second mapping
was the reason the divergence went unnoticed, and consolidates the three
subagent dot tables into subagentDot().
Unread notifications now expire like the plugin's: done/error are unread
markers, not states (on_agent_end only raises done for a tab that is not
current, clear_flags wipes both on TabEnter). The store gained markSeen(),
called when the routed session carries done/error, so a session you open
stops being green or red. The canonical reducer and fixtures/ are untouched:
this is a client-side view concern.
`resolveServerStatus` only degraded on `healthOk === false`, so a /health
request that errored outright (network error, 5xx) left the console claiming
"online" off a cached /info. Add `healthError` as its own step, ahead of the
subsystem check, and feed `health.isError` from the shell, the status page and
the workspaces page so all three derive a single verdict.
The console side of ADR 0001: a scanned link pairs itself, the status page
draws the daemon's actual symbol, and the second entry point for pairing
(the in-page camera scanner) is gone.
- `POST /api/v1/pair/redeem` replaced the dual-purpose `/api/v1/pair`; the
redeem response is parsed strictly as `{token, device}` (the five-layer
alias fallbacks for `deviceToken`/`payload.device`/… are deleted).
- `features/status/qr.ts` no longer invents "a deterministic fake QR from a
seed" — it renders `pairCode.qr.rows` module by module (devicePixelRatio
aware, square, token colours, redraws on theme/resize), and a mint without a
matrix shows the link instead of a pattern that will not scan.
- `/pair/<CODE>` (daemon 302 or the SPA route) lands on
`/connect?code=…&auto=1`, which redeems against its own origin with the
localized device name and then navigates to `next`/`/workspaces`, dropping
the code from the URL; a rejected code falls back to the prefilled form.
- The camera scanner (`features/connect/scan-dialog.tsx`) and its i18n keys are
removed: phones scan with the system camera, desktops type the code. Paste a
`pi2://pair?…` link or `/pair/CODE` still fills the form.
- Scope tracking disappears from the store, API types, device list and pairing
metadata (`pi2-device-scopes` is no longer written or read).
- Stale default removed: link parsing falls back to the served origin's port,
then 443/80, instead of a hard-coded 4321.
- `scripts/ui-{fixtures,mock-server,shots}.mjs` follow the new contract
(mint carries `qr`/`bases`, redeem route, no scopes), so the visual harness
exercises the real flow.
Verification: web typecheck clean, 299/299 tests, `vite build` green, visual
matrix 24/24 clean, and the i18n catalog has no missing keys.
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.
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.
Discovery returns every pi session directory ever seen, so the console opened on
47 rows on this machine: 20 ghosts (cwd deleted) and 21 scratch dirs under /tmp
next to the real projects. Every row now carries a derived, non-persisted
`visibility`/`visibilityReason`; nothing is filtered server-side, so
`/workspace/<id>` deep links and the chat page's id lookup still resolve.
Precedence: explicit `hidden` wins; a live instance, `pinned` or `trusted`
rescues a row; then temp paths (`PI2_WORKSPACE_HIDE_TEMP`, on), ghosts
(`PI2_WORKSPACE_HIDE_GHOSTS`, on), outside roots (`PI2_WORKSPACE_HIDE_OUTSIDE_ROOTS`,
off) and staleness (`PI2_WORKSPACE_STALE_DAYS`, off). Measured on real data:
47 → 26 default rows, 0 openable rows lost.
The browser collapses the secondary rows behind a persisted toggle and dims them
with a reason badge; `workspace.add` now clears `hidden`.
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
- 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.
- ws auth frame now carries the token top-level (docs §3.3); daemon accepts payload.token too
- entries route accepts workspaceId/sessionFile so disk-only sessions page history
- chat registers session metadata and pages history for non-live sessions
- e2e asserts a real ASSISTANT reply (PONG) and waits up to 180s
- visual.sh: real daemon + pairing + Playwright screenshots of the four pages