From db484f2ac9b4f5762f6f28f469cd9b8bf66ff863 Mon Sep 17 00:00:00 2001 From: leeguooooo Date: Fri, 12 Jun 2026 16:43:39 +0900 Subject: [PATCH] fix(cli): absolute screenshot path (#16) + show relay in session list (#15) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #16: handle_screenshot now returns a canonicalized ABSOLUTE path, so the `✓ Screenshot saved to …` line is the same regardless of process cwd and the agent can read the file without guessing the cwd. #15: `session list` now reflects the extension-relay connection — when the relay is up it shows the active session as `(relay/extension → live Chrome)` instead of "No active sessions", and the --json output gains a `relay` bool. Stops agents misjudging a live relay connection as down. --- cli/src/main.rs | 20 +++++++++++++++++--- cli/src/native/actions.rs | 13 +++++++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/cli/src/main.rs b/cli/src/main.rs index 605a5bf..463eb64 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -269,13 +269,19 @@ fn run_session(args: &[String], session: &str, json_mode: bool) { .into_iter() .map(|s| s.name) .collect(); + // The extension relay drives the user's live Chrome but isn't always + // registered as a launched daemon session — without surfacing it, + // `session list` says "No active sessions" while open/tab work fine, + // and agents misjudge the connection as down (issue #15). + let relay_up = connect::relay_url().is_some(); if json_mode { println!( - r#"{{"success":true,"data":{{"sessions":{}}}}}"#, - serde_json::to_string(&sessions).unwrap_or_default() + r#"{{"success":true,"data":{{"sessions":{},"relay":{}}}}}"#, + serde_json::to_string(&sessions).unwrap_or_default(), + relay_up ); - } else if sessions.is_empty() { + } else if sessions.is_empty() && !relay_up { println!("No active sessions"); } else { println!("Active sessions:"); @@ -287,6 +293,14 @@ fn run_session(args: &[String], session: &str, json_mode: bool) { }; println!("{} {}", marker, s); } + if relay_up && !sessions.iter().any(|s| s == session) { + println!( + "{} {} {}", + color::cyan("→"), + session, + color::dim("(relay/extension → live Chrome)") + ); + } } } None | Some(_) => { diff --git a/cli/src/native/actions.rs b/cli/src/native/actions.rs index 1e0dd90..411341c 100644 --- a/cli/src/native/actions.rs +++ b/cli/src/native/actions.rs @@ -2877,6 +2877,15 @@ async fn handle_snapshot(cmd: &Value, state: &mut DaemonState) -> Result String { + std::fs::canonicalize(p) + .map(|c| c.to_string_lossy().into_owned()) + .unwrap_or_else(|_| p.to_string()) +} + async fn handle_screenshot(cmd: &Value, state: &mut DaemonState) -> Result { let annotate = cmd .get("annotate") @@ -2902,7 +2911,7 @@ async fn handle_screenshot(cmd: &Value, state: &mut DaemonState) -> Result Result