Skip to content

feat(tui): MVP — streaming transcript, editor, footer, inline approvals, Esc cancel - #507

Merged
ajianaz merged 3 commits into
developfrom
feat/tui-mvp
Nov 4, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/tui-mvp

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

TUI MVP (#460, epic #464 Phase 1 core): the tole-tui placeholder becomes a working chat surface.

  • Transcript with streaming answer text, reasoning shown dimmed, tool calls/results as compact lines (TurnObserver events reach the UI over a channel; each turn runs on a worker thread).
  • Editor: multi-line (Shift+Enter / Alt+Enter / Ctrl+J), history (Up/Down), Enter submits; kitty keyboard flags pushed blindly (unsupported terminals ignore them — on non-kitty terminals Shift+Enter submits like Enter; documented in docs/tui.md).
  • Footer: folder, session id/name, model, reasoning effort, context used/window(%), session tokens — via the EXTENDED TuiHost contract (footer() + blocking run_turn(prompt, cancel, observer) + approval_channel()). Design decision (recorded): option (b) — the HOST supplies footer content and runs turns; SessionStatus/WindowSource/ModelsCatalog are CLI-side network-adjacent types and moving them would drag provider concerns into tole-core. tole-tui and tole-core stay UI-free.
  • Inline approvals: approval_channel() yields a Prompter wrapped by the CLI as PromptFn inside the normal InteractiveApprover — allowlist/--yes/Destructive-always-asks rules unchanged; the prompt renders inline and is answered through the event loop; Esc at a prompt denies and cancels; a dropped/unanswered prompt denies (fail-closed).
  • Esc cancels the running turn ((turn cancelled) settles visibly).
  • Bare tole now re-parses as a hidden tole tui subcommand so it goes through the normal config gate/settings (skeleton's direct dispatch bypassed the gate — fixed, beyond-brief, disclosed).
  • Sessions are ordinary tole sessions (resumable via tole resume, listed by sessions --all — asserted in the e2e).
  • Deferred explicitly (docs/tui.md + CHANGELOG): in-buffer cursor movement, slash commands beyond /quit, memory loop, MCP prompt commands, sibling notices, soft interrupts (feat(harness): soft interrupt — inject owner message into a running session without cancelling it #377/feat(child-agents): typed handoff + mandatory verify gate for child agents #383), wide-char wrapping (lines wrap by char count, not cell width).

Why (the problem you're solving)

Closes #460 — the TUI skeleton had no core loop; this is the everyday-driver surface of the epic (#464): talk to the agent, see what it does, approve/cancel it.

Testing (how you verified this works)

  • Acceptance pty e2e tui_streams_approves_cancels_and_leaves_an_ordinary_session (crates/tole-cli/tests/tui_e2e.rs): real binary under a pty against a scripted mock provider — send prompt -> streamed answer renders, approve a write (artifact out.txt created), Esc cancels a running turn ((turn cancelled)), multi-line input, then tole resume sees an ordinary session. Orchestrator re-ran it: 1 passed / 0 failed.
  • RED honesty: no compile-level RED (state-machine unit tests for editor/transcript/footer/approval/loop written alongside the implementation; the pty e2e DID fail first on real issues — missing cursor-query reply, split [y] allow assertion — then passed).
  • Gates run by the implementer AND independently re-run by the orchestrator (own target dir): fmt clean; clippy --workspace --all-targets -- -D warnings clean; cargo test --workspace --no-fail-fast 1050 passed / 0 failed; cargo test -p tole-core -p tole-cli --no-default-features 893 / 0; cargo build -p tole-cli --no-default-features OK; cargo build -p tole-cli (default, links TUI) OK.
  • Honest caveats: local cora review --staged static pass said "No issues found" but its LLM tier hit a 504 — no real local LLM verdict; the CI Cora job is the check for this PR. Uteke rooms: tole-dev / codecoradev-conventions / uteke-conventions read; codecora-workflow-standard listing overflowed (AGENTS.md fallback). Real-TTY feel (exact rendering, keybinding edge cases on odd terminals) remains human-verify territory per docs/tui.md.

Comment thread crates/tole-cli/src/main.rs Fixed
@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

/// `▸ write_file out.txt`: the tool plus its first short string argument.
pub fn tool_line(tool: &str, input: &Value) -> String {
let arg = input
.as_object()
@ajianaz
ajianaz merged commit 3bf9007 into develop Nov 4, 2026
16 checks passed
@ajianaz
ajianaz deleted the feat/tui-mvp branch November 4, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(tui): MVP — streaming transcript, editor, footer, inline approvals, Esc cancel

2 participants