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