fix(browser): limit ai snapshot size

test(browser): cover ai snapshot limit
This commit is contained in:
Gabriel Trigo
2026-01-12 18:05:10 +00:00
committed by Peter Steinberger
parent 542c8020ec
commit 79a6506593
5 changed files with 102 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ import {
browserScreenshotAction,
} from "../../browser/client-actions.js";
import { resolveBrowserConfig } from "../../browser/config.js";
import { DEFAULT_AI_SNAPSHOT_MAX_CHARS } from "../../browser/constants.js";
import { loadConfig } from "../../config/config.js";
import {
type AnyAgentTool,
@@ -44,8 +45,6 @@ const BROWSER_ACT_KINDS = [
type BrowserActKind = (typeof BROWSER_ACT_KINDS)[number];
const DEFAULT_AI_SNAPSHOT_MAX_CHARS = 80_000;
// NOTE: Using a flattened object schema instead of Type.Union([Type.Object(...), ...])
// because Claude API on Vertex AI rejects nested anyOf schemas as invalid JSON Schema.
// The discriminator (kind) determines which properties are relevant; runtime validates.