feat(connect): make auto-connect to user's Chrome the default behavior
- Auto-connect is now ON by default (was opt-in via --auto-connect) - Added --launch/--new flags to explicitly start a fresh browser - CI environments (CI env var) automatically use --launch mode - Friendly error message with platform-specific Chrome relaunch guide - Mentions Chrome 144+ runtime CDP toggle (chrome://inspect) - --cdp and --provider flags implicitly disable auto-connect - AGENT_BROWSER_NO_AUTO_CONNECT=1 to disable, AGENT_BROWSER_FORCE_LAUNCH=1 to force Track 3 of native-stealth migration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
77616a209c
commit
7ee3d5fb94
+6
-20
@@ -511,7 +511,7 @@ fn main() {
|
||||
}
|
||||
|
||||
let args: Vec<String> = env::args().skip(1).collect();
|
||||
let flags = parse_flags(&args);
|
||||
let mut flags = parse_flags(&args);
|
||||
let clean = clean_args(&args);
|
||||
|
||||
let has_help = args.iter().any(|a| a == "--help" || a == "-h");
|
||||
@@ -752,6 +752,7 @@ fn main() {
|
||||
confirm_actions: flags.confirm_actions.as_deref(),
|
||||
engine: flags.engine.as_deref(),
|
||||
auto_connect: flags.auto_connect,
|
||||
force_launch: flags.force_launch,
|
||||
idle_timeout: flags.idle_timeout.as_deref(),
|
||||
default_timeout: flags.default_timeout,
|
||||
cdp: flags.cdp.as_deref(),
|
||||
@@ -840,24 +841,9 @@ fn main() {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if flags.auto_connect && flags.cdp.is_some() {
|
||||
let msg = "Cannot use --auto-connect and --cdp together";
|
||||
if flags.json {
|
||||
print_json_error(msg);
|
||||
} else {
|
||||
eprintln!("{} {}", color::error_indicator(), msg);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if flags.auto_connect && flags.provider.is_some() {
|
||||
let msg = "Cannot use --auto-connect and -p/--provider together";
|
||||
if flags.json {
|
||||
print_json_error(msg);
|
||||
} else {
|
||||
eprintln!("{} {}", color::error_indicator(), msg);
|
||||
}
|
||||
exit(1);
|
||||
// Explicit --cdp or --provider disables auto-connect (they specify the connection)
|
||||
if flags.cdp.is_some() || flags.provider.is_some() {
|
||||
flags.auto_connect = false;
|
||||
}
|
||||
|
||||
if flags.provider.is_some() && !flags.extensions.is_empty() {
|
||||
@@ -1069,7 +1055,7 @@ fn main() {
|
||||
|| !flags.extensions.is_empty())
|
||||
&& flags.cdp.is_none()
|
||||
&& flags.provider.is_none()
|
||||
&& !flags.auto_connect
|
||||
&& (flags.force_launch || !flags.auto_connect)
|
||||
{
|
||||
let mut launch_cmd = json!({
|
||||
"id": gen_id(),
|
||||
|
||||
Reference in New Issue
Block a user