diff --git a/src/bin/poc-daemon/tmux.rs b/src/bin/poc-daemon/tmux.rs index f8dacb8..dc5dc49 100644 --- a/src/bin/poc-daemon/tmux.rs +++ b/src/bin/poc-daemon/tmux.rs @@ -30,28 +30,12 @@ pub fn find_claude_pane() -> Option { /// Send a prompt to a tmux pane. Returns true on success. /// -/// Sequence: Escape q C-c C-u (clear input), wait, type message, Enter. +/// Types the message literally then presses Enter. pub fn send_prompt(pane: &str, msg: &str) -> bool { let preview: String = msg.chars().take(100).collect(); info!("SEND [{pane}]: {preview}..."); - let send = |keys: &[&str]| { - Command::new("tmux") - .arg("send-keys") - .arg("-t") - .arg(pane) - .args(keys) - .output() - .is_ok() - }; - - // Clear any partial input - if !send(&["Escape", "q", "C-c", "C-u"]) { - return false; - } - thread::sleep(Duration::from_secs(1)); - - // Type the message (literal mode so spaces aren't key separators) + // Type the message literally let ok = Command::new("tmux") .args(["send-keys", "-t", pane, "-l", msg]) .output() @@ -59,8 +43,11 @@ pub fn send_prompt(pane: &str, msg: &str) -> bool { if !ok { return false; } - thread::sleep(Duration::from_millis(500)); + thread::sleep(Duration::from_millis(200)); // Submit - send(&["Enter"]) + Command::new("tmux") + .args(["send-keys", "-t", pane, "Enter"]) + .output() + .is_ok() }