Files
llama-watch/docs/superpowers/specs/2026-08-14-inflight-activity-design.md
T

62 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# In-Flight Monitor — Count + Activity Spark
**Date:** 2026-08-14
**Status:** Approved (design)
## Summary
Enhance the In-Flight Monitor action so its key shows the **number of
in-flight requests** for the configured model plus a **count-trend spark**:
a tiny line/area chart of that count over the last ~60s, so activity is
visible even during a single long-running request.
## Layout (72×72 SVG, rendered via `renderInflight`)
- **Top:** model short name (small, white) — existing.
- **Center:** the status. When `ready`:
- count > 0 → the **count number**, large/bold (e.g. `3`), on the red
`ACTIVE` background, with the existing pulse.
- count === 0 → `IDLE` on green — existing.
- `loading``LOADING`, `stopped``OFF`, offline → `OFFLINE`,
unconfigured → `NO MODEL`, unknown → `…` — all unchanged.
- **Bottom strip (~14px):** the count-trend spark — a small polyline + faint
area fill of the model's in-flight count over the last 60 samples, in the
state color. Flat at the baseline when idle; spikes when requests come and go.
## Data Flow
- The feed side is unchanged — `InflightTracker` already exposes exact
per-model counts.
- Each key's per-key state (in `inflight-monitor.ts`, keyed by
`ev.action.id`) gains:
- `history: number[]` — a 60-sample ring buffer of the live count.
- `sampler?: ReturnType<typeof setInterval>` — a 1s interval that pushes
`runtime.tracker.count(modelId)` into `history` and re-renders.
Started in `onWillAppear`, cleared in `onWillDisappear`.
- Live feed events (`add`/`remove`/`snapshot`) still re-render the big
number immediately via the existing subscription; the spark refreshes at
1Hz.
- `renderInflight` gains an optional `history?: number[]` field. Spark
scale: yMax = `max(max(history), 1)` so a zero line sits at the baseline.
## Files
- `src/lib/render.ts``renderInflight` accepts `history` and draws the
spark; center label shows the count when active.
- `src/actions/inflight-monitor.ts` — per-key `history` ring buffer +
1s sampler.
- `tests/render.test.ts` — new/updated assertions for count rendering and
the spark.
## Error Handling / Edge Cases
- Spark with <2 samples renders no line (like the GPU chart).
- Sampler cleared on `onWillDisappear` (no leaks); multi-key safety
preserved (buffer + sampler live in the per-key map entry).
- History capped at 60 samples.
## Out of Scope
- No change to the GPU Graph action, the feed, or the tracker.
- No throughput-bar variant (count trend was chosen).