browser-use 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -18
- package/dist/actor/element.js +24 -3
- package/dist/actor/mouse.js +21 -3
- package/dist/actor/page.js +33 -11
- package/dist/agent/gif.js +28 -3
- package/dist/agent/message-manager/service.js +2 -22
- package/dist/agent/message-manager/utils.js +15 -2
- package/dist/agent/message-manager/views.d.ts +7 -7
- package/dist/agent/message-manager/views.js +1 -0
- package/dist/agent/prompts.d.ts +3 -0
- package/dist/agent/prompts.js +22 -12
- package/dist/agent/service.d.ts +9 -1
- package/dist/agent/service.js +215 -81
- package/dist/agent/system_prompt.md +12 -11
- package/dist/agent/system_prompt_anthropic_flash.md +6 -5
- package/dist/agent/system_prompt_no_thinking.md +12 -11
- package/dist/agent/views.d.ts +2 -0
- package/dist/agent/views.js +48 -36
- package/dist/browser/extensions.js +20 -10
- package/dist/browser/profile.d.ts +4 -0
- package/dist/browser/profile.js +107 -4
- package/dist/browser/session.d.ts +28 -1
- package/dist/browser/session.js +1436 -528
- package/dist/browser/watchdogs/default-action-watchdog.js +32 -3
- package/dist/browser/watchdogs/downloads-watchdog.d.ts +4 -0
- package/dist/browser/watchdogs/downloads-watchdog.js +105 -9
- package/dist/browser/watchdogs/har-recording-watchdog.d.ts +1 -0
- package/dist/browser/watchdogs/har-recording-watchdog.js +54 -2
- package/dist/browser/watchdogs/permissions-watchdog.d.ts +5 -0
- package/dist/browser/watchdogs/permissions-watchdog.js +106 -3
- package/dist/browser/watchdogs/recording-watchdog.d.ts +2 -0
- package/dist/browser/watchdogs/recording-watchdog.js +54 -2
- package/dist/browser/watchdogs/security-watchdog.d.ts +1 -0
- package/dist/browser/watchdogs/security-watchdog.js +47 -7
- package/dist/browser/watchdogs/storage-state-watchdog.d.ts +6 -0
- package/dist/browser/watchdogs/storage-state-watchdog.js +206 -14
- package/dist/cli.d.ts +13 -2
- package/dist/cli.js +188 -8
- package/dist/code-use/namespace.js +52 -7
- package/dist/code-use/notebook-export.js +18 -2
- package/dist/code-use/service.js +1 -0
- package/dist/config.js +27 -5
- package/dist/controller/action-timeout.d.ts +9 -0
- package/dist/controller/action-timeout.js +95 -0
- package/dist/controller/registry/service.d.ts +1 -0
- package/dist/controller/registry/service.js +28 -1
- package/dist/controller/registry/views.d.ts +2 -0
- package/dist/controller/registry/views.js +44 -17
- package/dist/controller/service.d.ts +2 -1
- package/dist/controller/service.js +494 -329
- package/dist/filesystem/file-system.js +38 -8
- package/dist/integrations/gmail/service.js +30 -6
- package/dist/llm/browser-use/chat.js +2 -2
- package/dist/llm/codex/auth.d.ts +118 -0
- package/dist/llm/codex/auth.js +599 -0
- package/dist/llm/codex/chat.d.ts +70 -0
- package/dist/llm/codex/chat.js +392 -0
- package/dist/llm/codex/index.d.ts +2 -0
- package/dist/llm/codex/index.js +2 -0
- package/dist/llm/google/chat.js +18 -1
- package/dist/logging-config.js +22 -11
- package/dist/mcp/client.d.ts +1 -0
- package/dist/mcp/client.js +12 -10
- package/dist/mcp/redaction.d.ts +3 -0
- package/dist/mcp/redaction.js +132 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +64 -22
- package/dist/observability.js +1 -1
- package/dist/screenshots/service.js +25 -2
- package/dist/skill-cli/direct.d.ts +4 -1
- package/dist/skill-cli/direct.js +260 -64
- package/dist/skill-cli/server.d.ts +1 -0
- package/dist/skill-cli/server.js +115 -25
- package/dist/skill-cli/tunnel.d.ts +1 -0
- package/dist/skill-cli/tunnel.js +16 -4
- package/dist/sync/auth.js +22 -9
- package/dist/telemetry/service.js +21 -2
- package/dist/telemetry/views.js +31 -8
- package/dist/tokens/custom-pricing.js +2 -2
- package/dist/tokens/openrouter-pricing.d.ts +11 -0
- package/dist/tokens/openrouter-pricing.js +102 -0
- package/dist/tokens/service.js +20 -16
- package/dist/utils.d.ts +3 -1
- package/dist/utils.js +4 -2
- package/package.json +75 -33
|
@@ -15,6 +15,38 @@ const getPageUrl = (page) => {
|
|
|
15
15
|
}
|
|
16
16
|
return candidate ?? '';
|
|
17
17
|
};
|
|
18
|
+
// Render an action's param schema as compact JSON Schema for the LLM prompt.
|
|
19
|
+
// Replaces a prior raw dump of zod's private `_def` AST, which leaked
|
|
20
|
+
// internal keys like `innerType`/`defaultValue` and confused the LLM into
|
|
21
|
+
// copying default booleans into numeric fields (see scroll.num_pages bug).
|
|
22
|
+
export function renderParamsJsonSchema(schema, skipKeys) {
|
|
23
|
+
// `io: 'input'` makes zod render the *input* shape (what the LLM is
|
|
24
|
+
// expected to provide). Without it, fields with `.default(...)` get marked
|
|
25
|
+
// as required in the JSON Schema (because the parsed *output* always has
|
|
26
|
+
// them), which misleads the model — e.g. scroll.num_pages, done.success.
|
|
27
|
+
const raw = z.toJSONSchema(schema, {
|
|
28
|
+
io: 'input',
|
|
29
|
+
unrepresentable: 'any',
|
|
30
|
+
});
|
|
31
|
+
// Strip dialect noise the LLM doesn't need.
|
|
32
|
+
delete raw.$schema;
|
|
33
|
+
const properties = raw.properties ?? {};
|
|
34
|
+
const filteredProps = {};
|
|
35
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
36
|
+
if (skipKeys.has(key)) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
filteredProps[key] = value;
|
|
40
|
+
}
|
|
41
|
+
raw.properties = filteredProps;
|
|
42
|
+
if (Array.isArray(raw.required)) {
|
|
43
|
+
raw.required = raw.required.filter((key) => typeof key === 'string' && !skipKeys.has(key));
|
|
44
|
+
if (raw.required.length === 0) {
|
|
45
|
+
delete raw.required;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return raw;
|
|
49
|
+
}
|
|
18
50
|
export class RegisteredAction {
|
|
19
51
|
name;
|
|
20
52
|
description;
|
|
@@ -32,10 +64,12 @@ export class RegisteredAction {
|
|
|
32
64
|
this.pageFilter = pageFilter;
|
|
33
65
|
this.terminates_sequence = terminates_sequence;
|
|
34
66
|
}
|
|
35
|
-
|
|
67
|
+
// Returns the JSON Schema rendered for the LLM prompt, with the same
|
|
68
|
+
// skipKeys logic applied as in `promptDescription`. Exposed so tooling
|
|
69
|
+
// (e.g. scripts/dump-schema.ts) can exercise the exact code path the
|
|
70
|
+
// model sees.
|
|
71
|
+
getPromptJsonSchema() {
|
|
36
72
|
const skipKeys = new Set(['title']);
|
|
37
|
-
let description = `${this.description}: \n`;
|
|
38
|
-
description += `{${this.name}: `;
|
|
39
73
|
const schemaShape = (this.paramSchema instanceof z.ZodObject && this.paramSchema.shape) ||
|
|
40
74
|
('shape' in this.paramSchema ? this.paramSchema.shape : null);
|
|
41
75
|
const hideStructuredDoneSuccess = Boolean(this.name === 'done' &&
|
|
@@ -46,26 +80,19 @@ export class RegisteredAction {
|
|
|
46
80
|
if (hideStructuredDoneSuccess) {
|
|
47
81
|
skipKeys.add('success');
|
|
48
82
|
}
|
|
49
|
-
const hideExtractOutputSchema = Boolean(this.name === 'extract_structured_data' &&
|
|
83
|
+
const hideExtractOutputSchema = Boolean((this.name === 'extract_structured_data' || this.name === 'extract') &&
|
|
50
84
|
schemaShape &&
|
|
51
85
|
typeof schemaShape === 'object' &&
|
|
52
86
|
Object.prototype.hasOwnProperty.call(schemaShape, 'output_schema'));
|
|
53
87
|
if (hideExtractOutputSchema) {
|
|
54
88
|
skipKeys.add('output_schema');
|
|
55
89
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return [key, cleanEntries];
|
|
63
|
-
}));
|
|
64
|
-
description += JSON.stringify(props);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
description += '{}';
|
|
68
|
-
}
|
|
90
|
+
return renderParamsJsonSchema(this.paramSchema, skipKeys);
|
|
91
|
+
}
|
|
92
|
+
promptDescription() {
|
|
93
|
+
let description = `${this.description}: \n`;
|
|
94
|
+
description += `{${this.name}: `;
|
|
95
|
+
description += JSON.stringify(this.getPromptJsonSchema());
|
|
69
96
|
description += '}';
|
|
70
97
|
return description;
|
|
71
98
|
}
|
|
@@ -24,6 +24,7 @@ export interface ActParams<Context = unknown> {
|
|
|
24
24
|
file_system?: FileSystem | null;
|
|
25
25
|
context?: Context | null;
|
|
26
26
|
signal?: AbortSignal | null;
|
|
27
|
+
action_timeout?: number | null;
|
|
27
28
|
}
|
|
28
29
|
export declare class Controller<Context = unknown> {
|
|
29
30
|
registry: Registry<Context>;
|
|
@@ -53,6 +54,6 @@ export declare class Controller<Context = unknown> {
|
|
|
53
54
|
exclude_action(actionName: string): void;
|
|
54
55
|
set_coordinate_clicking(enabled: boolean): void;
|
|
55
56
|
action(description: string, options?: {}): <Params = any>(handler: import("./index.js").RegistryActionHandler<Params, Context>) => any;
|
|
56
|
-
act(action: Record<string, unknown>, { browser_session, page_extraction_llm, sensitive_data, available_file_paths, file_system, context, signal, }: ActParams<Context>): Promise<ActionResult>;
|
|
57
|
+
act(action: Record<string, unknown>, { browser_session, page_extraction_llm, sensitive_data, available_file_paths, file_system, context, signal, action_timeout, }: ActParams<Context>): Promise<ActionResult>;
|
|
57
58
|
}
|
|
58
59
|
export {};
|