The composer's ↑/↓ history is the web port of pi2.nvim's prompt buffer, so it
has to walk the archive nvim walks — not a copy of it. Three tiers: the plugin
owns the text, the daemon relays one live-only read, the browser keeps a mirror.
- `features/chat/prompt-history.ts`: the readline rules (`appendEntry`: blank
ignored, consecutive dedupe, newest 500), the `localStorage` mirror
(`pi2-prompt-history`, per workspace, 40 workspaces LRU), the
`PromptHistorySource` seam, and `PromptHistoryNav` — the per-composer cursor
with a stashed draft, independent positions, and a reset on edit/send
- `features/chat/prompt-history-feed.ts`: `usePromptHistory(workspaceId)` reads
`GET /workspaces/:id/prompt-history`, appends a send optimistically, refreshes
the mirror from every successful read, and falls back to the mirror whenever
the relay cannot answer (no plugin, no capability, a 404 from an older daemon,
an offline browser). One workspace-scoped read per page, never per keystroke.
- composer: ↑ recalls from the first line, ↓ from the last line or while
browsing, `<C-p>`/`<C-n>` always recall; an IME composition and a text
selection keep their keys; the caret lands at the end of a recalled prompt and
a manual edit ends recall
- fixes a mirror bug found while testing it: a full list that accepts one more
entry and drops the oldest has the same length, so the old "unchanged" check
silently stopped recording after 500 prompts
- `docs/prompt-history.md` records the tiers, the key map, the storage contract
and what is deliberately not shared yet (cross-host, history without nvim);
the UI mock server answers the new endpoint so the visual harness stays honest
Version skew is boring by design: an old daemon (404) or an old plugin (no
capability) keeps recall working from the mirror.