Skip to content

Commit 6599fea

Browse files
NianJiuZstclauderaylanlin
authored
feat: add interactive multi-turn chat REPL (mmx text repl) (#141)
* feat: add raw-mode line editor with bordered chrome for text repl Introduce a custom LineEditor class for interactive terminal input that renders a bordered input area using ANSI escape sequences. The editor supports: - Arrow key navigation (left/right/home/end) - History browsing (up/down) - Emacs-style line editing (Ctrl+A, Ctrl+E, Ctrl+U, Ctrl+W) - Backspace and delete - Raw-mode keypress handling with per-character processing The text repl command skeleton wires the editor to stdin and provides a minimal /exit command. Chat integration will follow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add slash command system with real-time suggestion rendering Wire up the slash command infrastructure in the text repl: - Define 7 slash commands: /exit, /clear, /system, /model, /save, /help, /history - Show filtered command suggestions below the input area in real time as the user types — no Tab key required - Auto-hide suggestions when the command is fully typed or / is deleted - Tab key auto-completes the only matching slash command - handleSlash() dispatches typed commands to their handlers The suggestion rendering reuses the LineEditor's existing ANSI layout, appending matches below the bottom border outside the input area. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: add conversation state and streaming chat API integration to repl Wire the REPL to the MiniMax Messages API for real chat: - Introduce ReplState to track messages, model, system prompt, and sampling parameters across turns - Implement sendMessages() with SSE streaming, thinking/response display separation, and automatic conversation history accumulation - Wire /clear, /system, /model, /save, and /history slash commands to operate on the live conversation state - Add SIGINT handler with double-Ctrl+C to quit and single-interrupt during response streaming - Initialize state from CLI flags (--model, --system, --temperature, etc.) and config defaults The echo placeholder is replaced with a full chat loop — each user message is added to the conversation, streamed to the API, and the assistant response is appended back to history. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: register text repl command in command registry Wire the text repl command into the CLI's command trie so it is discoverable via `mmx text repl` and shown in help output under `mmx text --help`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * test: add unit tests for text repl command Verify command import, metadata, option flags, and non-interactive mode rejection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: null-guard LineEditor.resolve before calling callback When raw mode is enabled, stdin may flush buffered data before readLine() is called, causing this.resolve to be null. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Raylan LIN <linrion101@gmail.com>
1 parent 879da45 commit 6599fea

3 files changed

Lines changed: 663 additions & 0 deletions

File tree

0 commit comments

Comments
 (0)