summaryrefslogtreecommitdiffhomepage
path: root/backend-handoff.md
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-06-12 01:01:32 +0900
committerAdam Malczewski <[email protected]>2026-06-12 01:01:32 +0900
commit4bc02b0102e45dc8cce97b7fc8499e0ab23d862f (patch)
tree8d8c40ca4f2951a68ec812fb3d0f31c044a76599 /backend-handoff.md
parent4866ebe724d247ab9c1a7615104712cf0ff2e508 (diff)
downloaddispatch-web-4bc02b0102e45dc8cce97b7fc8499e0ab23d862f.tar.gz
dispatch-web-4bc02b0102e45dc8cce97b7fc8499e0ab23d862f.zip
feat(metrics): consume contextSize — current context-usage readout
Backend context-size handoff: re-pin [email protected] / [email protected] (+ re-mirror .dispatch reference snapshots). Thread the optional contextSize through core/metrics (done fold + durable + selectCurrentContextSize: latest turn's defined value, undefined=>unknown never 0, durable-wins-over-live). Chat store exposes currentContextSize; ContextSizeBadge renders "N tokens in context" / "context size unknown" above the composer. GLOSSARY: add context size / context window. 533 tests green.
Diffstat (limited to 'backend-handoff.md')
-rw-r--r--backend-handoff.md29
1 files changed, 22 insertions, 7 deletions
diff --git a/backend-handoff.md b/backend-handoff.md
index 99c2964..e9b128a 100644
--- a/backend-handoff.md
+++ b/backend-handoff.md
@@ -5,24 +5,33 @@
> **From:** dispatch-web orchestrator · **To:** arch-rewrite orchestrator · **Courier:** the user.
> `lsp` does NOT span the repos (ORCHESTRATOR §5) — every cross-repo ask flows through here.
-_Last updated: 2026-06-11. **FE is current on `[email protected]`.** All handoffs to date are
-consumed: surfaces + WS, conversation transcript/metrics, tabs + model selector, cache-warming (incl.
-authoritative timer + retention + cache-rate fix), and **per-conversation cwd + LSP status** (new
-`workspace` feature — cwd field in the Model view + a "Language Servers" view; works for drafts too).
+_Last updated: 2026-06-12. **FE is current on `[email protected]` / `[email protected]`.** All handoffs
+to date are consumed: surfaces + WS, conversation transcript/metrics, tabs + model selector,
+cache-warming (incl. authoritative timer + retention + cache-rate fix), **per-conversation cwd + LSP
+status**, and **context size** (the `contextSize` field — `done` live + `TurnMetrics` persisted —
+rendered as a current-usage readout above the composer).
**Open asks:** CR-1 (Loaded Extensions as a real table) + CR-2 (optional catalog `scope` flag) below.
The cwd/LSP draft-path verification (`backend-handoff-cwd-lsp.md`) came back **all ✅ confirmed** by the
backend (answers in their `frontend-lsp-cwd-handoff.md`) — see §2._
+**Context-size handoff (`frontend-context-size-handoff.md`) → CONSUMED ✅.** Re-pinned `[email protected]→0.5.0`
++ `[email protected]→0.6.0`; re-mirrored both `.dispatch/*.reference.md`; added "context size" +
+"context window" to FE `GLOSSARY.md`. `core/metrics` now threads `contextSize` through the `done` fold +
+durable metrics and exposes `selectCurrentContextSize` (LATEST turn's defined value, `undefined`⇒unknown,
+never `0`, durable-wins-over-live); the chat store exposes `currentContextSize`; `ContextSizeBadge`
+renders "N tokens in context" / "context size unknown" above the composer. 533 tests green. NO new
+backend ask — but the max-limit denominator is now a live FE need; see §3.
+
---
## 1. Pinned backend contracts (consumed by the FE)
-Pinned as `file:` deps: **`[email protected]`; `[email protected]`; `[email protected]`**.
+Pinned as `file:` deps: **`[email protected]`; `[email protected]`; `[email protected]`**.
| Package | Used for |
|---|---|
| `@dispatch/ui-contract` | surfaces + surface WS protocol |
-| `@dispatch/wire` | `Chunk`/`StoredChunk`(+`seq`)/`ChatMessage`/`AgentEvent`/`TurnSealedEvent`/`Usage`/`StepId` + metrics: `StepMetrics`/`TurnMetrics`, `usage.stepId`, `step-complete`, `done.durationMs`/`done.usage`, `tool-result.durationMs` |
+| `@dispatch/wire` | `Chunk`/`StoredChunk`(+`seq`)/`ChatMessage`/`AgentEvent`/`TurnSealedEvent`/`Usage`/`StepId` + metrics: `StepMetrics`/`TurnMetrics`, `usage.stepId`, `step-complete`, `done.durationMs`/`done.usage`, `tool-result.durationMs`, **`done.contextSize`/`TurnMetrics.contextSize`** |
| `@dispatch/transport-contract` | `ChatRequest`/`ModelsResponse`/`ConversationHistoryResponse`/`ConversationMetricsResponse` + `WarmRequest`/`WarmResponse` + `CwdResponse`/`SetCwdRequest` + LSP (`LspStatusResponse`/`LspServerInfo`/`LspServerState`) + WS chat ops + `WsClientMessage`/`WsServerMessage` |
Endpoints in use (HTTP **24203**, WS **24205**, CORS `*` incl. `PUT`):
@@ -31,7 +40,7 @@ Endpoints in use (HTTP **24203**, WS **24205**, CORS `*` incl. `PUT`):
`GET /conversations/:id/lsp` · `POST /chat/warm` · WS `chat.send`→`chat.delta`.
Mirrored in-repo for headless agents: `.dispatch/{ui-contract,wire,transport-contract}.reference.md`
-(regenerate on any contract bump; all current as of `[email protected]`).
+(regenerate on any contract bump; all current as of `[email protected]` / `[email protected]`).
## 2. Open asks FOR THE BACKEND
@@ -101,6 +110,12 @@ harden `/chat` to treat blank as "not provided" if we ever want it — not neede
## 3. Likely NEXT backend asks (heads-up, not yet requested)
+- **Model max context-window LIMIT** (the denominator for context size) — the context-size handoff
+ flagged this as the separate, later field. The FE now shows current size alone (e.g. "34,102 tokens
+ in context"); once a per-model/per-turn `contextWindow` (max token capacity) ships, the FE can render
+ `contextSize / limit` (e.g. "34,102 / 200,000") + a usage bar. GLOSSARY term reserved: "context window"
+ = the limit (distinct from "context size" = current usage). **Likely the next ask** — raise when the
+ backend can source the model's advertised window.
- `GET /conversations` — conversation list / sidebar (history explorer / switcher); could also expose a
per-conversation "last model" so a reopened tab seeds its model from the server instead of localStorage.
- `POST /conversations/:id/cancel` — "stop generating".