diff --git a/cli/src/commands.rs b/cli/src/commands.rs index 2ec3c95..0d5ac36 100644 --- a/cli/src/commands.rs +++ b/cli/src/commands.rs @@ -1066,6 +1066,18 @@ fn parse_command_inner(args: &[String], flags: &Flags) -> Result parse_get(&rest, &id), + // Top-level shortcuts for `get ` status reads — users naturally type + // `agent-browser url` / `cdp-url` / `title` without the `get` prefix + // (and expect `cdp-url`/`cdp_url` to work interchangeably). + "url" | "cdp-url" | "cdp_url" | "title" | "html" | "text" | "value" + | "count" | "box" | "styles" | "attr" => { + let sub = if cmd == "cdp_url" { "cdp-url" } else { cmd }; + let mut get_args: Vec<&str> = Vec::with_capacity(rest.len() + 1); + get_args.push(sub); + get_args.extend_from_slice(&rest); + parse_get(&get_args, &id) + } + // === Is (state checks) === "is" => parse_is(&rest, &id), diff --git a/cli/src/native/actions.rs b/cli/src/native/actions.rs index 4cd4acf..f1fbc2a 100644 --- a/cli/src/native/actions.rs +++ b/cli/src/native/actions.rs @@ -1607,11 +1607,14 @@ async fn auto_launch(state: &mut DaemonState) -> Result<(), String> { // Return a helpful error guiding the user to enable it. return Err(format!( "Could not connect to your Chrome browser.\n\n\ - To let agent-browser work with your existing Chrome (recommended):\n\ + If Chrome showed an \"Allow remote debugging?\" dialog, click \ + Allow and re-run — that consent is what lets agent-browser attach.\n\n\ + Otherwise, to let agent-browser work with your existing Chrome (recommended):\n\ {}\n\n\ Or start a standalone browser with: agent-browser --launch open \n\n\ - Note: chrome://inspect/#remote-debugging only enables remote *target discovery* — \ - it does NOT expose the standard CDP HTTP API on /json/version. \ + Note: remote debugging is a startup flag, not a Chrome setting — \ + chrome://inspect/#remote-debugging only enables target discovery and \ + does NOT expose the CDP HTTP API on /json/version. \ A full restart with --remote-debugging-port= is required.", chrome_relaunch_hint(), )); @@ -2167,11 +2170,14 @@ async fn handle_launch(cmd: &Value, state: &mut DaemonState) -> Result { return Err(format!( "Could not connect to your Chrome browser.\n\n\ - To let agent-browser work with your existing Chrome (recommended):\n\ + If Chrome showed an \"Allow remote debugging?\" dialog, click \ + Allow and re-run — that consent is what lets agent-browser attach.\n\n\ + Otherwise, to let agent-browser work with your existing Chrome (recommended):\n\ {}\n\n\ Or start a standalone browser with: agent-browser --launch open \n\n\ - Note: chrome://inspect/#remote-debugging only enables remote *target discovery* — \ - it does NOT expose the standard CDP HTTP API on /json/version. \ + Note: remote debugging is a startup flag, not a Chrome setting — \ + chrome://inspect/#remote-debugging only enables target discovery and \ + does NOT expose the CDP HTTP API on /json/version. \ A full restart with --remote-debugging-port= is required.", chrome_relaunch_hint(), )); diff --git a/cli/src/native/cdp/chrome.rs b/cli/src/native/cdp/chrome.rs index 5de4fd6..a8192be 100644 --- a/cli/src/native/cdp/chrome.rs +++ b/cli/src/native/cdp/chrome.rs @@ -741,7 +741,11 @@ pub async fn auto_connect_cdp() -> Result { } } - Err("No running Chrome instance found. Launch Chrome with --remote-debugging-port or use --cdp.".to_string()) + Err("No running Chrome with remote debugging found. Remote debugging is a \ + startup flag, not a setting: fully quit Chrome and relaunch it with \ + --remote-debugging-port=9222 (then agent-browser auto-connects), or pass \ + --cdp /--launch." + .to_string()) } /// Resolve a CDP WebSocket URL from a DevToolsActivePort entry. diff --git a/cli/src/native/cdp/discovery.rs b/cli/src/native/cdp/discovery.rs index 23d4259..54ee1ff 100644 --- a/cli/src/native/cdp/discovery.rs +++ b/cli/src/native/cdp/discovery.rs @@ -58,8 +58,12 @@ pub async fn discover_cdp_url_with_timeout( match discover_cdp_ws(host, port, timeout).await { Ok(ws_url) => Ok(append_query(&ws_url, query)), Err(ws_err) => Err(format!( - "All CDP discovery methods failed for {}:{}: /json/version: {}; /json/list: {}; WebSocket: {}", - host, port, version_err, list_err, ws_err + "All CDP discovery methods failed for {host}:{port}. \ + Note: Chrome 136+ no longer serves the HTTP discovery endpoints \ + (/json/version, /json/list), so `--cdp ` cannot find the target — \ + use the default auto-connect (just `agent-browser open `), which reads \ + DevToolsActivePort and attaches over WebSocket. \ + (details: /json/version: {version_err}; /json/list: {list_err}; WebSocket: {ws_err})" )), } } diff --git a/cli/src/output.rs b/cli/src/output.rs index 0c8320b..dfc18c7 100644 --- a/cli/src/output.rs +++ b/cli/src/output.rs @@ -1042,6 +1042,11 @@ pub fn print_response_with_opts(resp: &Response, action: Option<&str>, opts: &Ou // Default success println!("{} Done", color::success_indicator()); + } else { + // Success response with no data payload — still confirm the command ran + // instead of printing nothing (a silent exit 0 looks like a no-op and + // hides whether anything happened). + println!("{} Done", color::success_indicator()); } print_warning(resp);