[PR #165] [MERGED] feat(tui): add guidance injection for human-in-the-loop steering #173

Closed
opened 2026-02-27 10:22:31 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/mikeyobrien/ralph-orchestrator/pull/165
Author: @mikeyobrien
Created: 2/7/2026
Status: Merged
Merged: 2/7/2026
Merged by: @mikeyobrien

Base: mainHead: feat/148-tui-guidance-injection


📝 Commits (1)

  • 574b7ce feat(tui): add guidance injection for human-in-the-loop steering

📊 Changes

10 files changed (+623 additions, -5 deletions)

View changed files

📝 Cargo.lock (+2 -0)
📝 crates/ralph-cli/src/loop_runner.rs (+79 -4)
📝 crates/ralph-tui/Cargo.toml (+3 -0)
crates/ralph-tui/examples/guidance_test.rs (+97 -0)
📝 crates/ralph-tui/src/app.rs (+38 -0)
📝 crates/ralph-tui/src/input.rs (+23 -1)
📝 crates/ralph-tui/src/lib.rs (+15 -0)
📝 crates/ralph-tui/src/state.rs (+313 -0)
📝 crates/ralph-tui/src/widgets/footer.rs (+40 -0)
📝 crates/ralph-tui/src/widgets/help.rs (+13 -0)

📄 Description

Closes #148

Summary

Adds two keybindings to the TUI that let you inject guidance into a running loop without restarting it:

  • : — Queue guidance for the next iteration (written as human.guidance events before build_prompt())
  • ! — Send guidance now (appended directly to events.jsonl for the current iteration)

How it works

  1. Press : or ! to enter guidance input mode (footer becomes a text input)
  2. Type your message, press Enter to send or Esc to cancel
  3. Next mode: message is pushed to a shared queue, drained by loop_runner at the top of the next iteration and written as human.guidance events
  4. Now mode: message is written directly to the active events.jsonl via the resolved events path

The events path is resolved from .ralph/current-events (the authoritative marker for the timestamped events file), falling back to ctx.events_path().

Changes

  • crates/ralph-tui/src/state.rsGuidanceMode, GuidanceResult enums, guidance state fields, start_guidance(), send_guidance(), cancel_guidance(), flash message support, 10 new unit tests
  • crates/ralph-tui/src/input.rs: and ! key mappings + tests
  • crates/ralph-tui/src/app.rs — Guidance input interception (keys + paste), flash expiry
  • crates/ralph-tui/src/widgets/footer.rs — Guidance input rendering + flash messages
  • crates/ralph-tui/src/widgets/help.rs — Guidance section in help overlay
  • crates/ralph-tui/src/lib.rswith_events_path() builder, guidance_next_queue() accessor
  • crates/ralph-cli/src/loop_runner.rs — Queue drain + event writing at iteration boundary, resolve_current_events_path() helper
  • crates/ralph-tui/examples/guidance_test.rs — Interactive test harness

Testing

  • 189 tests pass (160 state, 25 lib, 4 integration)
  • Clippy clean
  • Interactive test harness: cargo run -p ralph-tui --example guidance_test

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/mikeyobrien/ralph-orchestrator/pull/165 **Author:** [@mikeyobrien](https://github.com/mikeyobrien) **Created:** 2/7/2026 **Status:** ✅ Merged **Merged:** 2/7/2026 **Merged by:** [@mikeyobrien](https://github.com/mikeyobrien) **Base:** `main` ← **Head:** `feat/148-tui-guidance-injection` --- ### 📝 Commits (1) - [`574b7ce`](https://github.com/mikeyobrien/ralph-orchestrator/commit/574b7cec926532953099b2cabe1724cd99f310b0) feat(tui): add guidance injection for human-in-the-loop steering ### 📊 Changes **10 files changed** (+623 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+2 -0) 📝 `crates/ralph-cli/src/loop_runner.rs` (+79 -4) 📝 `crates/ralph-tui/Cargo.toml` (+3 -0) ➕ `crates/ralph-tui/examples/guidance_test.rs` (+97 -0) 📝 `crates/ralph-tui/src/app.rs` (+38 -0) 📝 `crates/ralph-tui/src/input.rs` (+23 -1) 📝 `crates/ralph-tui/src/lib.rs` (+15 -0) 📝 `crates/ralph-tui/src/state.rs` (+313 -0) 📝 `crates/ralph-tui/src/widgets/footer.rs` (+40 -0) 📝 `crates/ralph-tui/src/widgets/help.rs` (+13 -0) </details> ### 📄 Description Closes #148 ## Summary Adds two keybindings to the TUI that let you inject guidance into a running loop without restarting it: - **`:`** — Queue guidance for the **next** iteration (written as `human.guidance` events before `build_prompt()`) - **`!`** — Send guidance **now** (appended directly to `events.jsonl` for the current iteration) ## How it works 1. Press `:` or `!` to enter guidance input mode (footer becomes a text input) 2. Type your message, press Enter to send or Esc to cancel 3. **Next mode**: message is pushed to a shared queue, drained by `loop_runner` at the top of the next iteration and written as `human.guidance` events 4. **Now mode**: message is written directly to the active `events.jsonl` via the resolved events path The events path is resolved from `.ralph/current-events` (the authoritative marker for the timestamped events file), falling back to `ctx.events_path()`. ## Changes - `crates/ralph-tui/src/state.rs` — `GuidanceMode`, `GuidanceResult` enums, guidance state fields, `start_guidance()`, `send_guidance()`, `cancel_guidance()`, flash message support, 10 new unit tests - `crates/ralph-tui/src/input.rs` — `:` and `!` key mappings + tests - `crates/ralph-tui/src/app.rs` — Guidance input interception (keys + paste), flash expiry - `crates/ralph-tui/src/widgets/footer.rs` — Guidance input rendering + flash messages - `crates/ralph-tui/src/widgets/help.rs` — Guidance section in help overlay - `crates/ralph-tui/src/lib.rs` — `with_events_path()` builder, `guidance_next_queue()` accessor - `crates/ralph-cli/src/loop_runner.rs` — Queue drain + event writing at iteration boundary, `resolve_current_events_path()` helper - `crates/ralph-tui/examples/guidance_test.rs` — Interactive test harness ## Testing - 189 tests pass (160 state, 25 lib, 4 integration) - Clippy clean - Interactive test harness: `cargo run -p ralph-tui --example guidance_test` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 10:22:31 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ralph-orchestrator#173
No description provided.