Skip to content

Add web UI lineage section and operator token meter - #1188

Merged
edwin-zvs merged 11 commits into
mainfrom
webui-lineage-token-meter
Aug 3, 2026
Merged

Add web UI lineage section and operator token meter#1188
edwin-zvs merged 11 commits into
mainfrom
webui-lineage-token-meter

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

Summary

  • Lineage section in the web sidebar (spec 0081 parity): shows the selected session's fork/subagent tree when it has messages or lineage; click nodes to jump; subagents collapsed by default behind a per-parent toggle; collapse/height persist in localStorage.
  • Operator ambient panel at the bottom of the sidebar (specs 0019 / 0167): fleet token meter by default (seeded from usage.token_history, fed by every session's live Cost events, rates from model-backed busy_ms), with a rain mode toggle; collapse/height/mode persist.
  • Design record: specs/0186-webui-lineage-and-token-meter.md.

This PR only touches crates/daemon/assets/index.html (embedded web UI) and the new spec — relevant binary is construct (daemon serves the assets).

Test plan

  • Build worktree debug binary and point a daemon at it (or use hot-reload: CONSTRUCT_ASSETS_DIR=…/crates/daemon/assets).
  • Open the web UI with at least one session that has forks/subagents — lineage section appears under the list; clicking a node selects it; expanding "N subagents" reveals them.
  • Empty brand-new session without lineage — lineage section hidden.
  • Operator panel shows "no token usage reported yet" when idle; after model turns, stacked bars + legend rates update.
  • Toggle tokens ⇄ rain; collapse both sections; reload — prefs restore.
  • Resize lineage and operator panels via the drag handles.

Bring the sidebar in line with the TUI: a collapsible lineage tree for
the selected session (fork/subagent graph, subagents collapsed by
default) and an ambient operator panel with the fleet token meter
(seeded from usage.token_history, fed by live Cost events) plus a rain
mode toggle.
Token meter columns use monospaced cell width (one 1-minute bar per
cell, right-aligned) instead of 1px hairs, and the empty state no longer
shows under a visible canvas.

Lineage renders the TUI boxed-lane diagram by default (boxes, vertical
lanes, fork/merge arrows, turn-info segments) with a compact rails mode
toggle, matching the TUI full/compact switch.
Replace the ASCII boxed-lane canvas with a real HTML/CSS graph: session
cards, status chips, fork/subagent badges, and CSS rails/connectors.
Compact mode densifies the same structure instead of drawing character
rails.

Drive rain at 60fps with faster fall speed, a bright head, near-head
highlight, and a darkening alpha tail — instead of a 1Hz repaint with
uniform glyphs.
Move the drag strips above the section headers so they sit on the top
border of each title bar, matching the TUI, instead of under the header
between title and body.
A broken quote in the symbol set string made the browser parse an
assignment (`":·" = *+<>...`), which threw Invalid left-hand side in
assignment and blocked the whole web UI script from loading.
Session cards keep title and harness only. Volume and elapsed
(`12.4k tok · 8m12s`) render as a separate lane segment under each
card — a distinct graph node with •/✓/✗, matching the TUI turn-info
placement outside the boxed session.
Draw a vertical lane under each session card so the turn-info segment
sits on a continuous │-style line instead of floating disconnected
below the box.
Match render_lineage_row / segment conventions:
- Status glyph alone carries state color; name is recessed unless
  selected/hovered
- Selection fills the box; hover brightens the border only and demotes
  another session's selection
- Turn-info sits on the lane as plain text with • / live spinner / ✓ / ✗
  (outcome uses ok/warn, not a chip)
- Branch edges use ⑂ / ▸ / ↺ glyphs on the stub instead of colored pills
- Box label is `title (harness)`; discarded names strike through
- Subagent toggle is a muted disclosure; +N more is muted italic
- Shared spinner keeps lineage status + live bullets in phase with the list
Audit pass against TUI lineage semantics:
- Isolate hover to the leaf-most node so parents don't light up when a
  child is hovered; demote selection the same way
- Mid-timeline segment mark stays • when idle (only spins while working)
- Preserve scroll position and skip full rebuild when structure is unchanged
- Clicking the lane segment (or node) selects the session, not only the card
- Flush lane under the card; align child rails; edge glyphs only hot on the
  active branch; discarded strikes the name only
- Brighten only the branch into a selected/hovered child, not the whole path
- Stop the child-stack rail at the last connector instead of hanging past it
- Live-refresh segment duration/outcome without rebuilding the DOM
- Scroll the selected box into view; preserve scroll across rebuilds
- aria-level / aria-expanded; drop unused focusId and dead tally helpers
- Respect prefers-reduced-motion on lineage transitions
Lineage is event time top-to-bottom. Subagent/fork nodes are spawn
events and must appear under the session box before the parent's
turn-info (tok · duration), which closes a later window on that lane.
Use a continuous parent spine through children then the segment.
@edwin-zvs
edwin-zvs merged commit 81aa69d into main Aug 3, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the webui-lineage-token-meter branch August 3, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant