From ffff3a97e939da02796fabba91e05251227b2d62 Mon Sep 17 00:00:00 2001 From: Taskman Date: Tue, 17 Nov 2026 14:58:17 +0800 Subject: [PATCH] =?UTF-8?q?Browser=20CLI=20=E6=94=AF=E6=8C=81=E5=9C=A8?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E4=BC=9A=E8=AF=9D=E6=97=B6=E5=BC=80=E5=90=AF?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E9=AA=8C=E8=AF=81=E7=A0=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taskman-Run: 2decc756-ef59-40a7-a749-6d548f76e703 Taskman-Artifact: e190400b810d7c5a6e58bf5e449fb88b594c93b8c0aab2fc424260c284ecb027 --- README.md | 16 ++++++++++++++++ skills/lexmount-browser/references/commands.md | 18 +++++++++++++++++- src/client.rs | 5 +++++ src/main.rs | 4 ++++ src/models.rs | 3 +++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed99b9b..f9a8fe4 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,22 @@ failed still exits with status 1 even if stderr is closed and cannot report the error. These source changes require a new binary; updating Skill instructions does not change an already installed CLI. +## Automatic CAPTCHA handling + +```bash +browser-cli session create --browser-mode normal --enable-captcha +``` + +`--enable-captcha` enables server-side automatic CAPTCHA handling for the created +session only. It is off by default and supports only `normal` browser mode; +requesting it with any other mode returns a configuration error before any +session request. Availability and usage are subject to your plan's CAPTCHA quota. +Rust SDK callers can set `CreateSession.enable_captcha` to `Some(true)`; the +default `None` omits the field from the request. + +This option requires a binary built from source containing this feature; +updating Skill documentation alone does not update an installed binary. + ## Local network proxy tunnels Introduced in 1.3.0. This requires a newly built or published binary; updating the diff --git a/skills/lexmount-browser/references/commands.md b/skills/lexmount-browser/references/commands.md index 9fb706a..24c9a86 100644 --- a/skills/lexmount-browser/references/commands.md +++ b/skills/lexmount-browser/references/commands.md @@ -9,7 +9,7 @@ browser-cli doctor browser-cli auth status browser-cli auth login [--client-name "NAME"] -browser-cli session create [--browser-mode normal|light] +browser-cli session create [--browser-mode normal|light] [--enable-captcha] [--context-id ID --context-mode read_write|read_only] [--downloads] [--recording] [--window-size 1920,1080] [--official-proxy | --local-proxy-tunnel-id TUNNEL_ID] @@ -47,6 +47,22 @@ browser-cli action eval --session-id ID --expression JS browser-cli action raw --session-id ID --method CDP_METHOD --params-json JSON ``` +## Automatic CAPTCHA handling + +```bash +browser-cli session create --browser-mode normal --enable-captcha +``` + +`--enable-captcha` enables server-side automatic CAPTCHA handling for the created +session only. It is off by default and supports only `normal` browser mode; +requesting it with any other mode returns a configuration error before any +session request. Availability and usage are subject to your plan's CAPTCHA quota. +Rust SDK callers can set `CreateSession.enable_captcha` to `Some(true)`; the +default `None` omits the field from the request. + +This option requires a binary built from source containing this feature; +updating Skill documentation alone does not update an installed binary. + ## Page selection Introduced in 1.2.0; requires a binary whose `browser-cli action --help` lists diff --git a/src/client.rs b/src/client.rs index e460187..39daf78 100644 --- a/src/client.rs +++ b/src/client.rs @@ -230,6 +230,11 @@ impl Client { request: CreateSession, poll_timeout: Duration, ) -> Result { + if request.enable_captcha == Some(true) && request.browser_mode != "normal" { + return Err(Error::Config( + "automatic CAPTCHA handling requires normal browser mode".into(), + )); + } let local_id = request .proxy .as_ref() diff --git a/src/main.rs b/src/main.rs index c501857..77da18c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -162,6 +162,9 @@ enum DownloadsCommand { struct CreateSessionArgs { #[arg(long, default_value = "normal")] browser_mode: String, + /// Enable server-side CAPTCHA handling for this session (normal mode only). + #[arg(long)] + enable_captcha: bool, #[arg(long)] context_id: Option, #[arg(long, default_value = "read_write")] @@ -472,6 +475,7 @@ fn run_session(client: Client, command: SessionCommand) -> Result { .map(|id| json!({"id":id,"mode":args.context_mode})); let request = CreateSession { browser_mode: args.browser_mode, + enable_captcha: args.enable_captcha.then_some(true), context, context_description: args.context_description, weak_lock: args.weak_lock.then_some(true), diff --git a/src/models.rs b/src/models.rs index 4909dce..1d96b42 100644 --- a/src/models.rs +++ b/src/models.rs @@ -146,6 +146,8 @@ pub struct ContextList { pub struct CreateSession { pub browser_mode: String, #[serde(skip_serializing_if = "Option::is_none")] + pub enable_captcha: Option, + #[serde(skip_serializing_if = "Option::is_none")] pub context: Option, #[serde(skip_serializing_if = "Option::is_none")] pub extension_ids: Option>, @@ -171,6 +173,7 @@ impl Default for CreateSession { fn default() -> Self { Self { browser_mode: "normal".into(), + enable_captcha: None, context: None, extension_ids: None, proxy: None,