diff options
| author | Adam Malczewski <[email protected]> | 2026-06-12 00:43:55 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-12 00:43:55 +0900 |
| commit | e2646ad2b0c28bd64ad4efd6b154f97f8a35e0ad (patch) | |
| tree | 0f739576bbabf19ebb0e254776188b0950c4f489 /tasks.md | |
| parent | e7eada4802ceebd86c83bcd6e3eca70152e7f331 (diff) | |
| download | dispatch-e2646ad2b0c28bd64ad4efd6b154f97f8a35e0ad.tar.gz dispatch-e2646ad2b0c28bd64ad4efd6b154f97f8a35e0ad.zip | |
feat(metrics): expose current context size to the frontend
contextSize = the turn's FINAL step inputTokens+outputTokens (true context
occupancy; NOT the aggregate usage, which sums per-step prompts and overcounts
multi-step turns). Stamped on both the live done event (kernel) and persisted
TurnMetrics (session-orchestrator); a client reads the latest turn's value.
- @dispatch/wire 0.4.0->0.5.0: optional contextSize on TurnDoneEvent + TurnMetrics
- @dispatch/transport-contract 0.5.0->0.6.0 (re-export only)
- glossary: context size (reserve 'context window' for the model limit, later)
- FE courier: frontend-context-size-handoff.md
881 vitest pass; tsc -b EXIT 0; biome clean.
Diffstat (limited to 'tasks.md')
| -rw-r--r-- | tasks.md | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -5,7 +5,7 @@ > Keep this lean and current; do not let it re-accrete a step-by-step changelog. ## Status (current) -`tsc -b` EXIT 0 · biome clean · **865 vitest + 135 bun = 1000 tests**. +`tsc -b` EXIT 0 · biome clean · **881 vitest + 135 bun = 1016 tests**. Built and verified live (full-fidelity: every feature is a manifest-loaded extension through the host): @@ -231,6 +231,26 @@ workspace root, working directory. finished it directly; also fixed a real design bug the agent missed: the manager read config statically instead of per-cwd (would have broken Roblox). +## Context size — current context-window usage (DONE) +User-gated decisions: term = **context size** (current usage; reserve "context window" for the +model's max LIMIT, a later feature); definition = the turn's **FINAL step `inputTokens + +outputTokens`** (NOT the aggregate `usage`, which sums per-step prompts and overcounts a +multi-step turn); delivery = a backend-computed field on BOTH the live `done` event and the +persisted `TurnMetrics`. +- [x] **Contract (orchestrator):** optional `contextSize?: number` added to `TurnDoneEvent` + + `TurnMetrics` in `@dispatch/wire` (`0.4.0→0.5.0`); `@dispatch/transport-contract` + `0.5.0→0.6.0` (re-exports both — no other change). Glossary: added **context size**. +- [x] **Wave (parallel, disjoint pkgs):** + - [x] **kernel** — `run-turn.ts` tracks the last step's `Usage`; `doneEvent()` stamps + `done.contextSize = lastStep.input + lastStep.output` (omitted when no usage). +3 tests. + - [x] **session-orchestrator** — `metrics.ts build()` stamps `TurnMetrics.contextSize` from + the final per-step metrics (same definition; equals the live value). +5 tests. +- [x] Verified: `tsc -b` EXIT 0, biome clean, 881 vitest pass; both owners stayed in-lane. + `conversation-store` (JSON passthrough) + `transport-http` (forwards/serves) unchanged. +- [x] **FE courier handoff:** `frontend-context-size-handoff.md` (user couriers to + `../dispatch-web`). Not yet exercised end-to-end against a live LLM (unit tests cover both + producers); optional live-verify deferred. + ## Open items - **`prefix.fingerprint` / `warm|real` cache-bust attributes (deferred):** decoupled from dedup by the content-addressed decision; also gated on cache-warming being |
