Skip to content

An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.

fix(actions): cap the characters extractText will return

Shahriarb3a83bffb40f
diff --git a/lib/actions/page/extract-text.ts b/lib/actions/page/extract-text.ts
index 00537af..9154c65 100644
--- a/lib/actions/page/extract-text.ts
+++ b/lib/actions/page/extract-text.ts
@@ -2,6 +2,8 @@ import { z } from 'zod';
import { defineAction } from '../core';
import { cssPath, resolveTarget, targetSchema } from './dom';
+const MAX_EXTRACT_CHARS = 200_000;
+
export const extractText = defineAction({
name: 'page.extractText',
description: 'Read the rendered text or raw HTML of an element or the whole page.',
@@ -12,6 +14,7 @@ export const extractText = defineAction({
.number()
.int()
.positive()
+ .max(MAX_EXTRACT_CHARS)
.default(20000)
.describe('Truncate the result to this many characters'),
}),
@@ -20,8 +23,8 @@ export const extractText = defineAction({
const full =
format === 'text' ? element.innerText.replace(/\n{3,}/g, '\n\n').trim() : element.outerHTML;
return {
- content: full.slice(0, maxLength),
- truncated: full.length > maxLength,
+ content: full.slice(0, Math.min(maxLength, MAX_EXTRACT_CHARS)),
+ truncated: full.length > Math.min(maxLength, MAX_EXTRACT_CHARS),
length: full.length,
source: cssPath(element),
};