feat(tui): add input history (↑/↓) for submitted messages #1348
+130
−12
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
Adds shell-style input history to the TUI editor: submitted prompts are recorded so you can use ↑ / ↓ to recall previous messages. Provides parity with existing CLI AI tools.
Details
@mariozechner/pi-tuiEditor history navigationTesting
pnpm test src/tui/tui-input-history.test.tspnpm lintpnpm build🤖 AI-assisted
Codex Review
Codex did not find any issues; expand for code review details
``` >> Code review started: current changes <<• Ran git diff
• Ran git log -1
• Ran git show HEAD
• Explored
└ Search addToHistory in tui
Search class .*Editor in tui
Read custom-editor.ts
Search class Editor in editor
Search addToHistory in node_modules
Search history in pi-tui
List pi-tui
Search history in pi-tui
Read editor.js
Search ./tui.js in src
Search addToHistory in pi-tui
List components
Read editor.d.ts, tui.test.ts, tui.ts
Search function handleCommand in tui
Search createCommandHandlers in *.ts
Read tui-command-handlers.ts
Search handleCommand in tui-command-handlers.ts
Read tui-command-handlers.ts
Search addToHistory
The helper that records editor submissions mirrors the previous onSubmit logic while adding prompt history support, and the accompanying tests assert the expected routing behavior. No regressions or obvious issues are introduced by the refactor.
<< Code review finished >>