From a0cd295c0fe7fac0e982c6ba39a47215b811e1d9 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 21 Jan 2026 03:02:15 +0000 Subject: [PATCH] fix: add browser snapshot default mode (#1336) Co-authored-by: Seb Slight --- CHANGELOG.md | 1 + docs/gateway/configuration.md | 3 ++ docs/tools/browser.md | 1 + src/agents/tools/browser-tool.test.ts | 44 ++++++++++++--- src/agents/tools/browser-tool.ts | 8 ++- src/cli/browser-cli-inspect.test.ts | 78 +++++++++++++++++++++++++++ src/cli/browser-cli-inspect.ts | 7 ++- src/config/schema.ts | 2 + src/config/types.browser.ts | 6 +++ src/config/zod-schema.ts | 8 +++ 10 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 src/cli/browser-cli-inspect.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index b9fcd520e..1fd00edb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Docs: https://docs.clawd.bot - Repo: remove the Peekaboo git submodule now that the SPM release is used. - Update: sync plugin sources on channel switches and update npm-installed plugins during `clawdbot update`. - Plugins: share npm plugin update logic between `clawdbot update` and `clawdbot plugins update`. +- Browser: allow config defaults for efficient snapshots in the tool/CLI. (#1336) — thanks @sebslight. - Channels: add the Nostr plugin channel with profile management + onboarding install defaults. (#1323) — thanks @joelklabo. - Plugins: require manifest-embedded config schemas, validate configs without loading plugin code, and surface plugin config warnings. (#1272) — thanks @thewilloftheshadow. - Plugins: move channel catalog metadata into plugin manifests; align Nextcloud Talk policy helpers with core patterns. (#1290) — thanks @NicholaiVogel. diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index e26637029..8ebcef47a 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -2615,10 +2615,13 @@ Defaults: // noSandbox: false, // executablePath: "/Applications/Brave Browser.app/Contents/MacOS/Brave Browser", // attachOnly: false, // set true when tunneling a remote CDP to localhost + // snapshotDefaults: { mode: "efficient" }, // tool/CLI default snapshot preset } } ``` +Note: `browser.snapshotDefaults` only affects Clawdbot's browser tool + CLI. Direct HTTP clients must pass `mode` explicitly. + ### `ui` (Appearance) Optional accent color used by the native apps for UI chrome (e.g. Talk Mode bubble tint). diff --git a/docs/tools/browser.md b/docs/tools/browser.md index 793b75a75..a897b7412 100644 --- a/docs/tools/browser.md +++ b/docs/tools/browser.md @@ -500,6 +500,7 @@ Notes: - `--format ai` (default when Playwright is installed): returns an AI snapshot with numeric refs (`aria-ref=""`). - `--format aria`: returns the accessibility tree (no refs; inspection only). - `--efficient` (or `--mode efficient`): compact role snapshot preset (interactive + compact + depth + lower maxChars). + - Config default (tool/CLI only): set `browser.snapshotDefaults.mode: "efficient"` to use efficient snapshots when the caller does not pass a mode (see [Gateway configuration](/gateway/configuration#browser-clawd-managed-browser)). - Role snapshot options (`--interactive`, `--compact`, `--depth`, `--selector`) force a role-based snapshot with refs like `ref=e12`. - `--frame "