6.3 KiB
Created
Created by tickets.sh create.
Plan
Preflight classification: implementation-ready with updated current-code scope.
The original ticket was written before insomnia-crate-cli-owner, when crates/tui/src/main.rs owned both product CLI and single-Pod runtime loop. That product CLI entrypoint has since moved to the insomnia crate and tui is now library-only. The remaining cleanup target is therefore the same runtime/event-loop code now living in crates/tui/src/lib.rs, not an obsolete main.rs file.
Updated intent:
- Move the single-Pod TUI runtime/event-loop implementation out of
crates/tui/src/lib.rsinto a focused TUI module, likelysingle_pod.rs. - Keep
lib.rsas the library façade: module declarations, launch API/types, and high-level dispatch.
Requirements:
- Extract single-Pod runtime functions from
lib.rsinto a focused module while preserving behavior. - Include related helpers only where mechanical and clear: event loop, key/mouse handling, stream/event drain helpers, and per-run connection orchestration.
- Keep terminal setup/restore behavior, input queueing, interruption, task reminders, manual rewind/compact handling, and Pod socket behavior unchanged.
- Do not move render helpers, split
multi_pod.rs, redesign keybindings, or perform unrelated TUI module cleanup. - Keep public
tui::launch,LaunchOptions, andLaunchModebehavior stable for theinsomniacrate.
Current code map:
crates/tui/src/lib.rs: library façade plus large single-Pod runtime loop and helpers after CLI ownership migration.crates/tui/src/multi_pod.rs: dashboard runtime; out of scope except imports needed bylib.rs.crates/tui/src/app.rs,input.rs,ui.rs,tool.rs,view_mode.rs: single-Pod runtime dependencies; should be imported by the extracted module as needed.
Critical risks:
- Over-extracting unrelated launch/multi-Pod code and increasing churn.
- Accidentally changing key/mouse/event handling semantics while moving functions.
- Creating circular module visibility or broad
pubexposure. Preferpub(crate)only wherelib.rsmust call intosingle_pod.
Intent packet for coder:
Intent:
- Extract the single-Pod runtime loop from current
tui/src/lib.rsinto a focused module and leavelib.rsas a thin façade/high-level dispatcher.
Invariants:
- Behavior-preserving move.
tuiremains library-only;insomniaremains CLI owner.- No Pod protocol/profile/manifest changes.
- No broad TUI layout refactor beyond this extraction.
Validation:
cargo fmt --check- focused
cargo test -p tuitests for queueing/interrupt/compact/rewind/stream handling if available - full
cargo test -p tui cargo check -p tui -p insomnia./tickets.sh doctorgit diff --check
Review: approve
External reviewer: tui-runtime-reviewer-20260531
Reviewed implementation commit: 4d89718 (tui: extract single pod runtime)
Verdict: approve
Summary:
- This is a behavior-preserving mechanical extraction.
crates/tui/src/lib.rsis now a façade/high-level dispatcher.- Single-Pod runtime/event-loop code now lives in
crates/tui/src/single_pod.rs. - Public
tui::launch,LaunchOptions, andLaunchModesignatures remain stable.
Requirements mapping:
lib.rskeeps module declarations, public launch API/types, and high-level mode dispatch.single_pod.rsowns Pod-name/spawn/resume attach paths, fullscreen terminal helpers, main loop/drain logic, key/mouse handling, and the focused tests that cover those behaviors.- Terminal setup/restore behavior is preserved: raw mode/bracketed paste global setup remains in
lib.rs, while fullscreen/alternate-screen helpers moved with single-Pod runtime code. - Input queueing, interruption, task reminders, compact/rewind handling, and Pod socket behavior are moved with tests and unchanged by inspection.
- No render helper move,
multi_pod.rssplit, App rewrite, keybinding redesign, Pod protocol/profile/manifest change, crate rename, or CLI ownership regression was introduced.
Blockers: none.
Non-blocking follow-up:
single_pod.rsnow contains a thinrun_multidashboard bridge. This is acceptable here because it bridges dashboard open requests into private single-Pod attach helpers, but if dashboard orchestration grows a future cleanup could move that bridge into a small launch/runtime coordination module.
Validation adequacy:
- Coder validation covered fmt, full TUI tests, TUI/insomnia check, doctor, and diff check.
- Reviewer reran
cargo fmt --check,cargo test -p tui,cargo check -p tui -p insomnia,./tickets.sh doctor, andgit diff --check HEAD^ HEAD; all passed with existing dead-code warnings.
Closed
Extracted the current single-Pod TUI runtime/event-loop implementation out of crates/tui/src/lib.rs.
Implementation:
- Added
crates/tui/src/single_pod.rs. - Moved single-Pod attach/spawn/resume orchestration, fullscreen terminal helpers, event loop/drain logic, key/mouse handling, compact/rewind/queue/interrupt handling, and related tests into
single_pod.rs. - Left
lib.rsas the TUI library façade/high-level dispatcher with module declarations,LaunchOptions,LaunchMode, andlaunch(...). - Preserved public
tui::launch,LaunchOptions, andLaunchModebehavior for theinsomniacrate. - Did not split
multi_pod.rs, move render helpers, redesign keybindings, rewrite App state, or change Pod protocol/profile/manifest semantics.
Review:
- External reviewer
tui-runtime-reviewer-20260531approved implementation commit4d89718. - Reviewer noted one non-blocking follow-up: the thin
run_multibridge now lives insingle_pod.rs; acceptable for this extraction, but could move to a small launch/runtime coordination module if dashboard orchestration grows.
Validation after merge:
cargo fmt --checkcargo test -p tuicargo check -p tui -p insomnia(passed with existing dead-code warnings)./tickets.sh doctorgit diff --checkwc -l crates/tui/src/lib.rs crates/tui/src/single_pod.rsshowedlib.rsat 117 lines andsingle_pod.rsat 1765 lines.