Expand description
piw: terminal viewer and live replay server for pi-workflows SQLite workflow state.
The library form exists for integration tests; main.rs is the CLI.
Modules§
- canvas
- Port of
src/render/canvas.ts: a sparse character grid where box-drawing characters merge by connectivity (│ crossing ─ becomes ┼). - client
- Reconnecting WebSocket client for remote mode (
piw --connect ws://…). The background task treats subscriptions and artifact requests as desired state, so reconnects cannot replay stale commands. - format
- Port of
src/render/format.tsandsrc/workflows/text.ts, including JavaScript-compatible rounding so durations format identically. - layout
- Faithful port of
src/render/graph.ts: expand switch edges, classify back edges via DFS, longest-path layering with terminal tail pull-down, virtual pass-through cells, and barycenter ordering. Behavior is pinned against the golden fixtures infixtures/layout/— any divergence is a bug in this port, not a stylistic choice. - protocol
- Wire types for the live replay protocol (
pi-workflows.replay.v1), plus the JSON Patch subset (with theappendextension op) used for view synchronization. Seedocs/live-replay-protocol.md. - render
- Port of
src/render/graph-render.ts: renders the workflow DAG onto aCharCanvas. Statuses derive from the steps visible up to the selected step, taken transitions highlight, switch branches carry case labels, and loop edges route through a right-hand gutter. Output is pinned to the TypeScript renderer through the golden fixtures. - server
piw serve: loopback-only, revisioned live replay over bounded projections.- session
- Deterministic reducer for
session/events.ndjson. - source
- Revisioned, bounded database views for the local TUI and replay server.
- state
- theme
- ui
- The interactive TUI (see docs/tui-viewer.md): a runs sidebar, the graph
pane, an inspector with steps/trace/conversation/info tabs, and a replay
transport. Works against a local runs directory, a single run, or a
piw serveWebSocket server; all three feed the same view model.