feat: REPL prompt history, paste newline folding, and /new session swap - #84
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Daily-driver batch for the bare
zcode-acpREPL — three features plus hardening from a strong-model review pass:~/.zcode/acp/repl-history/<sha1(cwd)>.jsonl(newest 500 kept, consecutive duplicates collapsed, malformed lines tolerated).↑/↓with the completion menu closed recalls entries across restarts; the first↑stashes the live draft and↓past the newest restores it. The in-memory list is bounded to the same cap as the file.usePastechannel (which also arms/disarms?2004with the hook lifecycle — no manual terminal-mode management); terminals without bracketed-paste fall back to a heuristic that folds only chunks carrying a real\n, so coalesced keystroke bursts ("x\r"from fast typing) keep their submit semantics. The size cap counts code points and never splits a surrogate pair./newsession swap — REPL-local command that swaps the live session for a fresh backend-created one, strictly client-side so the update pump never loses the session id. Reseeds the model/mode/thought selects from the new session's response, clears the prompt draft, and appends a divider note (the old conversation stays in/sessionsand in native scrollback — entries are append-only under ink<Static>). Refuses while a turn runs or startup is in flight. Registered as a one-shot command: enter-on-pick in the completion menu executes immediately.Review hardening (all audit findings fixed)
/newre-checksturnActiveafter thesession/newroundtrip: a turn racing into the old session mid-swap used to orphan it (pump disposed, completion filtered by session id) and wedge the REPL withturnActivestuck forever.\n(fixes silent submit loss on fast-typed"x\r"chunks).onSubmitno longer double-records queued prompts into history.Test plan
pnpm lint/pnpm typecheck/pnpm test— 811 tests green (new: history file IO + dedupe + cap, paste folding boundaries incl. surrogate pair at the cap,/newcommand registration and one-shot set)/newdivider, restart recall — all passnewrow (backend does not advertise one; thecommandMenuname-merge covers the case if a future backend does)Docs: README REPL section, CHANGELOG, AGENTS.md source tree. Design records: ADR-0008 (prompt history), ADR-0009 (paste folding), ADR-0010 (/new and session swap) in the project's local
.zcode/docs/adr/.