@browserbasehq/orca 3.0.0-preview.0 → 3.0.0-preview.3

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.
Files changed (90) hide show
  1. package/dist/index.d.ts +761 -593
  2. package/dist/index.js +25775 -24553
  3. package/package.json +35 -74
  4. package/README.md +0 -165
  5. package/dist/lib/api.d.ts +0 -23
  6. package/dist/lib/dom/build/scriptContent.d.ts +0 -1
  7. package/dist/lib/inference.d.ts +0 -71
  8. package/dist/lib/inferenceLogUtils.d.ts +0 -12
  9. package/dist/lib/logger.d.ts +0 -54
  10. package/dist/lib/prompt.d.ts +0 -12
  11. package/dist/lib/utils.d.ts +0 -65
  12. package/dist/lib/v3/agent/AgentClient.d.ts +0 -18
  13. package/dist/lib/v3/agent/AgentProvider.d.ts +0 -18
  14. package/dist/lib/v3/agent/AnthropicCUAClient.d.ts +0 -55
  15. package/dist/lib/v3/agent/OpenAICUAClient.d.ts +0 -64
  16. package/dist/lib/v3/agent/StagehandAgent.d.ts +0 -15
  17. package/dist/lib/v3/agent/tools/index.d.ts +0 -229
  18. package/dist/lib/v3/agent/tools/v3-act.d.ts +0 -29
  19. package/dist/lib/v3/agent/tools/v3-ariaTree.d.ts +0 -11
  20. package/dist/lib/v3/agent/tools/v3-close.d.ts +0 -24
  21. package/dist/lib/v3/agent/tools/v3-extract.d.ts +0 -38
  22. package/dist/lib/v3/agent/tools/v3-fillform.d.ts +0 -37
  23. package/dist/lib/v3/agent/tools/v3-goto.d.ts +0 -29
  24. package/dist/lib/v3/agent/tools/v3-navback.d.ts +0 -17
  25. package/dist/lib/v3/agent/tools/v3-screenshot.d.ts +0 -13
  26. package/dist/lib/v3/agent/tools/v3-scroll.d.ts +0 -23
  27. package/dist/lib/v3/agent/tools/v3-wait.d.ts +0 -19
  28. package/dist/lib/v3/agent/utils/cuaKeyMapping.d.ts +0 -10
  29. package/dist/lib/v3/agent/utils/imageCompression.d.ts +0 -18
  30. package/dist/lib/v3/agent/utils/messageProcessing.d.ts +0 -13
  31. package/dist/lib/v3/dom/build/scriptV3Content.d.ts +0 -1
  32. package/dist/lib/v3/dom/genDomScripts.d.ts +0 -1
  33. package/dist/lib/v3/dom/index.d.ts +0 -1
  34. package/dist/lib/v3/dom/piercer.entry.d.ts +0 -1
  35. package/dist/lib/v3/dom/piercer.runtime.d.ts +0 -25
  36. package/dist/lib/v3/handlers/actHandler.d.ts +0 -18
  37. package/dist/lib/v3/handlers/extractHandler.d.ts +0 -29
  38. package/dist/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +0 -18
  39. package/dist/lib/v3/handlers/observeHandler.d.ts +0 -15
  40. package/dist/lib/v3/handlers/v3AgentHandler.d.ts +0 -17
  41. package/dist/lib/v3/handlers/v3CuaAgentHandler.d.ts +0 -26
  42. package/dist/lib/v3/index.d.ts +0 -10
  43. package/dist/lib/v3/launch/browserbase.d.ts +0 -8
  44. package/dist/lib/v3/launch/local.d.ts +0 -13
  45. package/dist/lib/v3/llm/AnthropicClient.d.ts +0 -16
  46. package/dist/lib/v3/llm/CerebrasClient.d.ts +0 -17
  47. package/dist/lib/v3/llm/GoogleClient.d.ts +0 -19
  48. package/dist/lib/v3/llm/GroqClient.d.ts +0 -17
  49. package/dist/lib/v3/llm/LLMClient.d.ts +0 -99
  50. package/dist/lib/v3/llm/LLMProvider.d.ts +0 -10
  51. package/dist/lib/v3/llm/OpenAIClient.d.ts +0 -15
  52. package/dist/lib/v3/llm/aisdk.d.ts +0 -15
  53. package/dist/lib/v3/logger.d.ts +0 -48
  54. package/dist/lib/v3/mcp/connection.d.ts +0 -11
  55. package/dist/lib/v3/mcp/utils.d.ts +0 -3
  56. package/dist/lib/v3/tests/default-page-tracking.spec.d.ts +0 -1
  57. package/dist/lib/v3/tests/perform-understudy-method.spec.d.ts +0 -1
  58. package/dist/lib/v3/tests/shadow-iframe.spec.d.ts +0 -1
  59. package/dist/lib/v3/tests/timeouts.spec.d.ts +0 -1
  60. package/dist/lib/v3/tests/v3.config.d.ts +0 -4
  61. package/dist/lib/v3/tests/v3.playwright.config.d.ts +0 -2
  62. package/dist/lib/v3/tests/xpath-for-location-deep.spec.d.ts +0 -1
  63. package/dist/lib/v3/types/act.d.ts +0 -10
  64. package/dist/lib/v3/types/agent.d.ts +0 -132
  65. package/dist/lib/v3/types/api.d.ts +0 -40
  66. package/dist/lib/v3/types/cache.d.ts +0 -71
  67. package/dist/lib/v3/types/context.d.ts +0 -2
  68. package/dist/lib/v3/types/evals.d.ts +0 -71
  69. package/dist/lib/v3/types/evaluator.d.ts +0 -40
  70. package/dist/lib/v3/types/llm.d.ts +0 -11
  71. package/dist/lib/v3/types/log.d.ts +0 -23
  72. package/dist/lib/v3/types/model.d.ts +0 -20
  73. package/dist/lib/v3/types/playwright.d.ts +0 -6
  74. package/dist/lib/v3/types/stagehand.d.ts +0 -113
  75. package/dist/lib/v3/types/stagehandApiErrors.d.ts +0 -18
  76. package/dist/lib/v3/types/stagehandErrors.d.ts +0 -104
  77. package/dist/lib/v3/types.d.ts +0 -176
  78. package/dist/lib/v3/understudy/a11y/snapshot.d.ts +0 -71
  79. package/dist/lib/v3/understudy/cdp.d.ts +0 -58
  80. package/dist/lib/v3/understudy/context.d.ts +0 -120
  81. package/dist/lib/v3/understudy/deepLocator.d.ts +0 -69
  82. package/dist/lib/v3/understudy/executionContextRegistry.d.ts +0 -15
  83. package/dist/lib/v3/understudy/frame.d.ts +0 -63
  84. package/dist/lib/v3/understudy/frameLocator.d.ts +0 -46
  85. package/dist/lib/v3/understudy/frameRegistry.d.ts +0 -100
  86. package/dist/lib/v3/understudy/locator.d.ts +0 -196
  87. package/dist/lib/v3/understudy/page.d.ts +0 -241
  88. package/dist/lib/v3/understudy/piercer.d.ts +0 -4
  89. package/dist/lib/v3/v3.d.ts +0 -156
  90. package/dist/lib/version.d.ts +0 -5
@@ -1,55 +0,0 @@
1
- import { AgentAction, AgentExecutionOptions, AgentResult, AgentType, AnthropicContentBlock, AnthropicMessage, AnthropicToolResult, ToolUseItem } from "../types/agent";
2
- import { LogLine } from "../types/log";
3
- import { ToolSet } from "ai";
4
- import { AgentClient } from "./AgentClient";
5
- export type ResponseInputItem = AnthropicMessage | AnthropicToolResult;
6
- /**
7
- * Client for Anthropic's Computer Use API
8
- * This implementation uses the official Anthropic Messages API for Computer Use
9
- */
10
- export declare class AnthropicCUAClient extends AgentClient {
11
- private apiKey;
12
- private baseURL?;
13
- private client;
14
- lastMessageId?: string;
15
- private currentViewport;
16
- private currentUrl?;
17
- private screenshotProvider?;
18
- private actionHandler?;
19
- private thinkingBudget;
20
- private tools?;
21
- constructor(type: AgentType, modelName: string, userProvidedInstructions?: string, clientOptions?: Record<string, unknown>, tools?: ToolSet);
22
- setViewport(width: number, height: number): void;
23
- setCurrentUrl(url: string): void;
24
- setScreenshotProvider(provider: () => Promise<string>): void;
25
- setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
26
- /**
27
- * Execute a task with the Anthropic CUA
28
- * This is the main entry point for the agent
29
- * @implements AgentClient.execute
30
- */
31
- execute(executionOptions: AgentExecutionOptions): Promise<AgentResult>;
32
- executeStep(inputItems: ResponseInputItem[], logger: (message: LogLine) => void): Promise<{
33
- actions: AgentAction[];
34
- message: string;
35
- completed: boolean;
36
- nextInputItems: ResponseInputItem[];
37
- usage: {
38
- input_tokens: number;
39
- output_tokens: number;
40
- inference_time_ms: number;
41
- };
42
- }>;
43
- private createInitialInputItems;
44
- getAction(inputItems: ResponseInputItem[]): Promise<{
45
- content: AnthropicContentBlock[];
46
- id: string;
47
- usage: Record<string, number>;
48
- }>;
49
- takeAction(toolUseItems: ToolUseItem[], logger: (message: LogLine) => void): Promise<AnthropicToolResult[]>;
50
- private convertToolUseToAction;
51
- captureScreenshot(options?: {
52
- base64Image?: string;
53
- currentUrl?: string;
54
- }): Promise<string>;
55
- }
@@ -1,64 +0,0 @@
1
- import { LogLine } from "../types/log";
2
- import { AgentAction, AgentResult, AgentType, AgentExecutionOptions, ResponseInputItem, ResponseItem } from "../types/agent";
3
- import { AgentClient } from "./AgentClient";
4
- import { ToolSet } from "ai/dist";
5
- /**
6
- * Client for OpenAI's Computer Use Assistant API
7
- * This implementation uses the official OpenAI Responses API for Computer Use
8
- */
9
- export declare class OpenAICUAClient extends AgentClient {
10
- private apiKey;
11
- private organization?;
12
- private baseURL;
13
- private client;
14
- lastResponseId?: string;
15
- private currentViewport;
16
- private currentUrl?;
17
- private screenshotProvider?;
18
- private actionHandler?;
19
- private reasoningItems;
20
- private environment;
21
- private tools?;
22
- constructor(type: AgentType, modelName: string, userProvidedInstructions?: string, clientOptions?: Record<string, unknown>, tools?: ToolSet);
23
- setViewport(width: number, height: number): void;
24
- setCurrentUrl(url: string): void;
25
- setScreenshotProvider(provider: () => Promise<string>): void;
26
- setActionHandler(handler: (action: AgentAction) => Promise<void>): void;
27
- /**
28
- * Execute a task with the OpenAI CUA
29
- * This is the main entry point for the agent
30
- * @implements AgentClient.execute
31
- */
32
- execute(executionOptions: AgentExecutionOptions): Promise<AgentResult>;
33
- /**
34
- * Execute a single step of the agent
35
- * This coordinates the flow: Request → Get Action → Execute Action
36
- */
37
- executeStep(inputItems: ResponseInputItem[], previousResponseId: string | undefined, logger: (message: LogLine) => void): Promise<{
38
- actions: AgentAction[];
39
- message: string;
40
- completed: boolean;
41
- nextInputItems: ResponseInputItem[];
42
- responseId: string;
43
- usage: {
44
- input_tokens: number;
45
- output_tokens: number;
46
- inference_time_ms: number;
47
- };
48
- }>;
49
- private isComputerCallItem;
50
- private isFunctionCallItem;
51
- private createInitialInputItems;
52
- getAction(inputItems: ResponseInputItem[], previousResponseId?: string): Promise<{
53
- output: ResponseItem[];
54
- responseId: string;
55
- usage: Record<string, number>;
56
- }>;
57
- takeAction(output: ResponseItem[], logger: (message: LogLine) => void): Promise<ResponseInputItem[]>;
58
- private convertComputerCallToAction;
59
- private convertFunctionCallToAction;
60
- captureScreenshot(options?: {
61
- base64Image?: string;
62
- currentUrl?: string;
63
- }): Promise<string>;
64
- }
@@ -1,15 +0,0 @@
1
- import { LogLine } from "../types/log";
2
- import { AgentExecuteOptions, AgentResult } from "../types/agent";
3
- import { AgentClient } from "./AgentClient";
4
- /**
5
- * Main interface for agent operations in Stagehand
6
- * This class provides methods for executing tasks with an agent
7
- */
8
- export declare class StagehandAgent {
9
- private client;
10
- private logger;
11
- constructor(client: AgentClient, logger: (message: LogLine) => void);
12
- execute(optionsOrInstruction: AgentExecuteOptions | string): Promise<AgentResult>;
13
- getModelName(): string;
14
- getAgentType(): string;
15
- }
@@ -1,229 +0,0 @@
1
- import type { V3 } from "@/lib/v3/v3";
2
- import type { LogLine } from "../../types/log";
3
- export interface V3AgentToolOptions {
4
- executionModel?: string;
5
- logger?: (message: LogLine) => void;
6
- }
7
- export declare function createAgentTools(v3: V3, options?: V3AgentToolOptions): {
8
- act: import("ai/dist").Tool<import("zod/v3").ZodObject<{
9
- action: import("zod/v3").ZodString;
10
- }, "strip", import("zod/v3").ZodTypeAny, {
11
- action?: string;
12
- }, {
13
- action?: string;
14
- }>, {
15
- success: boolean;
16
- action: string;
17
- error?: undefined;
18
- } | {
19
- success: boolean;
20
- error: any;
21
- action?: undefined;
22
- }> & {
23
- execute: (args: {
24
- action?: string;
25
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
26
- success: boolean;
27
- action: string;
28
- error?: undefined;
29
- } | {
30
- success: boolean;
31
- error: any;
32
- action?: undefined;
33
- }>;
34
- };
35
- ariaTree: import("ai/dist").Tool<import("zod/v3").ZodObject<{}, "strip", import("zod/v3").ZodTypeAny, {}, {}>, {
36
- content: string;
37
- pageUrl: string;
38
- }> & {
39
- execute: (args: {}, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
40
- content: string;
41
- pageUrl: string;
42
- }>;
43
- };
44
- close: import("ai/dist").Tool<import("zod/v3").ZodObject<{
45
- reasoning: import("zod/v3").ZodString;
46
- taskComplete: import("zod/v3").ZodBoolean;
47
- }, "strip", import("zod/v3").ZodTypeAny, {
48
- reasoning?: string;
49
- taskComplete?: boolean;
50
- }, {
51
- reasoning?: string;
52
- taskComplete?: boolean;
53
- }>, {
54
- success: boolean;
55
- reasoning: string;
56
- taskComplete: boolean;
57
- }> & {
58
- execute: (args: {
59
- reasoning?: string;
60
- taskComplete?: boolean;
61
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
62
- success: boolean;
63
- reasoning: string;
64
- taskComplete: boolean;
65
- }>;
66
- };
67
- extract: import("ai/dist").Tool<import("zod/v3").ZodObject<{
68
- instruction: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
69
- schema: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
70
- selector: import("zod/v3").ZodOptional<import("zod/v3").ZodString>;
71
- }, "strip", import("zod/v3").ZodTypeAny, {
72
- instruction?: string;
73
- selector?: string;
74
- schema?: string;
75
- }, {
76
- instruction?: string;
77
- selector?: string;
78
- schema?: string;
79
- }>, {
80
- success: boolean;
81
- result: any;
82
- error?: undefined;
83
- } | {
84
- success: boolean;
85
- error: any;
86
- result?: undefined;
87
- }> & {
88
- execute: (args: {
89
- instruction?: string;
90
- selector?: string;
91
- schema?: string;
92
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
93
- success: boolean;
94
- result: any;
95
- error?: undefined;
96
- } | {
97
- success: boolean;
98
- error: any;
99
- result?: undefined;
100
- }>;
101
- };
102
- fillForm: import("ai/dist").Tool<import("zod/v3").ZodObject<{
103
- fields: import("zod/v3").ZodArray<import("zod/v3").ZodObject<{
104
- action: import("zod/v3").ZodString;
105
- value: import("zod/v3").ZodString;
106
- }, "strip", import("zod/v3").ZodTypeAny, {
107
- value?: string;
108
- action?: string;
109
- }, {
110
- value?: string;
111
- action?: string;
112
- }>, "many">;
113
- }, "strip", import("zod/v3").ZodTypeAny, {
114
- fields?: {
115
- value?: string;
116
- action?: string;
117
- }[];
118
- }, {
119
- fields?: {
120
- value?: string;
121
- action?: string;
122
- }[];
123
- }>, {
124
- success: boolean;
125
- actions: unknown[];
126
- }> & {
127
- execute: (args: {
128
- fields?: {
129
- value?: string;
130
- action?: string;
131
- }[];
132
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
133
- success: boolean;
134
- actions: unknown[];
135
- }>;
136
- };
137
- goto: import("ai/dist").Tool<import("zod/v3").ZodObject<{
138
- url: import("zod/v3").ZodString;
139
- }, "strip", import("zod/v3").ZodTypeAny, {
140
- url?: string;
141
- }, {
142
- url?: string;
143
- }>, {
144
- success: boolean;
145
- url: string;
146
- error?: undefined;
147
- } | {
148
- success: boolean;
149
- error: any;
150
- url?: undefined;
151
- }> & {
152
- execute: (args: {
153
- url?: string;
154
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
155
- success: boolean;
156
- url: string;
157
- error?: undefined;
158
- } | {
159
- success: boolean;
160
- error: any;
161
- url?: undefined;
162
- }>;
163
- };
164
- navback: import("ai/dist").Tool<import("zod/v3").ZodObject<{
165
- reasoning: import("zod/v3").ZodString;
166
- }, "strip", import("zod/v3").ZodTypeAny, {
167
- reasoning?: string;
168
- }, {
169
- reasoning?: string;
170
- }>, {
171
- success: boolean;
172
- }> & {
173
- execute: (args: {
174
- reasoning?: string;
175
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
176
- success: boolean;
177
- }>;
178
- };
179
- screenshot: import("ai/dist").Tool<import("zod/v3").ZodObject<{}, "strip", import("zod/v3").ZodTypeAny, {}, {}>, {
180
- base64: string;
181
- timestamp: number;
182
- pageUrl: string;
183
- }> & {
184
- execute: (args: {}, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
185
- base64: string;
186
- timestamp: number;
187
- pageUrl: string;
188
- }>;
189
- };
190
- scroll: import("ai/dist").Tool<import("zod/v3").ZodObject<{
191
- pixels: import("zod/v3").ZodNumber;
192
- direction: import("zod/v3").ZodEnum<["up", "down"]>;
193
- }, "strip", import("zod/v3").ZodTypeAny, {
194
- pixels?: number;
195
- direction?: "up" | "down";
196
- }, {
197
- pixels?: number;
198
- direction?: "up" | "down";
199
- }>, {
200
- success: boolean;
201
- pixels: number;
202
- }> & {
203
- execute: (args: {
204
- pixels?: number;
205
- direction?: "up" | "down";
206
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
207
- success: boolean;
208
- pixels: number;
209
- }>;
210
- };
211
- wait: import("ai/dist").Tool<import("zod/v3").ZodObject<{
212
- timeMs: import("zod/v3").ZodNumber;
213
- }, "strip", import("zod/v3").ZodTypeAny, {
214
- timeMs?: number;
215
- }, {
216
- timeMs?: number;
217
- }>, {
218
- success: boolean;
219
- waited: number;
220
- }> & {
221
- execute: (args: {
222
- timeMs?: number;
223
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
224
- success: boolean;
225
- waited: number;
226
- }>;
227
- };
228
- };
229
- export type AgentTools = ReturnType<typeof createAgentTools>;
@@ -1,29 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createActTool: (v3: V3, executionModel?: string) => import("ai/dist").Tool<z.ZodObject<{
4
- action: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- action?: string;
7
- }, {
8
- action?: string;
9
- }>, {
10
- success: boolean;
11
- action: string;
12
- error?: undefined;
13
- } | {
14
- success: boolean;
15
- error: any;
16
- action?: undefined;
17
- }> & {
18
- execute: (args: {
19
- action?: string;
20
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
21
- success: boolean;
22
- action: string;
23
- error?: undefined;
24
- } | {
25
- success: boolean;
26
- error: any;
27
- action?: undefined;
28
- }>;
29
- };
@@ -1,11 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createAriaTreeTool: (v3: V3) => import("ai/dist").Tool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, {
4
- content: string;
5
- pageUrl: string;
6
- }> & {
7
- execute: (args: {}, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
8
- content: string;
9
- pageUrl: string;
10
- }>;
11
- };
@@ -1,24 +0,0 @@
1
- import { z } from "zod/v3";
2
- export declare const createCloseTool: () => import("ai/dist").Tool<z.ZodObject<{
3
- reasoning: z.ZodString;
4
- taskComplete: z.ZodBoolean;
5
- }, "strip", z.ZodTypeAny, {
6
- reasoning?: string;
7
- taskComplete?: boolean;
8
- }, {
9
- reasoning?: string;
10
- taskComplete?: boolean;
11
- }>, {
12
- success: boolean;
13
- reasoning: string;
14
- taskComplete: boolean;
15
- }> & {
16
- execute: (args: {
17
- reasoning?: string;
18
- taskComplete?: boolean;
19
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
20
- success: boolean;
21
- reasoning: string;
22
- taskComplete: boolean;
23
- }>;
24
- };
@@ -1,38 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- import type { LogLine } from "../../types/log";
4
- export declare const createExtractTool: (v3: V3, executionModel?: string, logger?: (message: LogLine) => void) => import("ai/dist").Tool<z.ZodObject<{
5
- instruction: z.ZodOptional<z.ZodString>;
6
- schema: z.ZodOptional<z.ZodString>;
7
- selector: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- instruction?: string;
10
- selector?: string;
11
- schema?: string;
12
- }, {
13
- instruction?: string;
14
- selector?: string;
15
- schema?: string;
16
- }>, {
17
- success: boolean;
18
- result: any;
19
- error?: undefined;
20
- } | {
21
- success: boolean;
22
- error: any;
23
- result?: undefined;
24
- }> & {
25
- execute: (args: {
26
- instruction?: string;
27
- selector?: string;
28
- schema?: string;
29
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
30
- success: boolean;
31
- result: any;
32
- error?: undefined;
33
- } | {
34
- success: boolean;
35
- error: any;
36
- result?: undefined;
37
- }>;
38
- };
@@ -1,37 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createFillFormTool: (v3: V3, executionModel?: string) => import("ai/dist").Tool<z.ZodObject<{
4
- fields: z.ZodArray<z.ZodObject<{
5
- action: z.ZodString;
6
- value: z.ZodString;
7
- }, "strip", z.ZodTypeAny, {
8
- value?: string;
9
- action?: string;
10
- }, {
11
- value?: string;
12
- action?: string;
13
- }>, "many">;
14
- }, "strip", z.ZodTypeAny, {
15
- fields?: {
16
- value?: string;
17
- action?: string;
18
- }[];
19
- }, {
20
- fields?: {
21
- value?: string;
22
- action?: string;
23
- }[];
24
- }>, {
25
- success: boolean;
26
- actions: unknown[];
27
- }> & {
28
- execute: (args: {
29
- fields?: {
30
- value?: string;
31
- action?: string;
32
- }[];
33
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
34
- success: boolean;
35
- actions: unknown[];
36
- }>;
37
- };
@@ -1,29 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createGotoTool: (v3: V3) => import("ai/dist").Tool<z.ZodObject<{
4
- url: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- url?: string;
7
- }, {
8
- url?: string;
9
- }>, {
10
- success: boolean;
11
- url: string;
12
- error?: undefined;
13
- } | {
14
- success: boolean;
15
- error: any;
16
- url?: undefined;
17
- }> & {
18
- execute: (args: {
19
- url?: string;
20
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
21
- success: boolean;
22
- url: string;
23
- error?: undefined;
24
- } | {
25
- success: boolean;
26
- error: any;
27
- url?: undefined;
28
- }>;
29
- };
@@ -1,17 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createNavBackTool: (v3: V3) => import("ai/dist").Tool<z.ZodObject<{
4
- reasoning: z.ZodString;
5
- }, "strip", z.ZodTypeAny, {
6
- reasoning?: string;
7
- }, {
8
- reasoning?: string;
9
- }>, {
10
- success: boolean;
11
- }> & {
12
- execute: (args: {
13
- reasoning?: string;
14
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
15
- success: boolean;
16
- }>;
17
- };
@@ -1,13 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createScreenshotTool: (v3: V3) => import("ai/dist").Tool<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, {
4
- base64: string;
5
- timestamp: number;
6
- pageUrl: string;
7
- }> & {
8
- execute: (args: {}, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
9
- base64: string;
10
- timestamp: number;
11
- pageUrl: string;
12
- }>;
13
- };
@@ -1,23 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createScrollTool: (v3: V3) => import("ai/dist").Tool<z.ZodObject<{
4
- pixels: z.ZodNumber;
5
- direction: z.ZodEnum<["up", "down"]>;
6
- }, "strip", z.ZodTypeAny, {
7
- pixels?: number;
8
- direction?: "up" | "down";
9
- }, {
10
- pixels?: number;
11
- direction?: "up" | "down";
12
- }>, {
13
- success: boolean;
14
- pixels: number;
15
- }> & {
16
- execute: (args: {
17
- pixels?: number;
18
- direction?: "up" | "down";
19
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
20
- success: boolean;
21
- pixels: number;
22
- }>;
23
- };
@@ -1,19 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { V3 } from "@/lib/v3/v3";
3
- export declare const createWaitTool: (v3: V3) => import("ai/dist").Tool<z.ZodObject<{
4
- timeMs: z.ZodNumber;
5
- }, "strip", z.ZodTypeAny, {
6
- timeMs?: number;
7
- }, {
8
- timeMs?: number;
9
- }>, {
10
- success: boolean;
11
- waited: number;
12
- }> & {
13
- execute: (args: {
14
- timeMs?: number;
15
- }, options: import("ai/dist").ToolExecutionOptions) => PromiseLike<{
16
- success: boolean;
17
- waited: number;
18
- }>;
19
- };
@@ -1,10 +0,0 @@
1
- /**
2
- * Universal key mapping utility for converting various key representations
3
- * to Playwright-compatible key names. Used by all CUA clients and handlers.
4
- */
5
- /**
6
- * Maps a key name from various formats to Playwright-compatible format
7
- * @param key The key name in any supported format
8
- * @returns The Playwright-compatible key name
9
- */
10
- export declare function mapKeyToPlaywright(key: string): string;
@@ -1,18 +0,0 @@
1
- import { AnthropicMessage, AnthropicToolResult } from "../../types/agent";
2
- export type ResponseInputItem = AnthropicMessage | AnthropicToolResult;
3
- /**
4
- * Finds all items in the conversation history that contain images
5
- * @param items - Array of conversation items to check
6
- * @returns Array of indices where images were found
7
- */
8
- export declare function findItemsWithImages(items: ResponseInputItem[]): number[];
9
- /**
10
- * Compresses conversation history by removing images from older items
11
- * while keeping the most recent images intact
12
- * @param items - Array of conversation items to process
13
- * @param keepMostRecentCount - Number of most recent image-containing items to preserve (default: 2)
14
- * @returns Object with processed items
15
- */
16
- export declare function compressConversationImages(items: ResponseInputItem[], keepMostRecentCount?: number): {
17
- items: ResponseInputItem[];
18
- };
@@ -1,13 +0,0 @@
1
- import { type LanguageModelV1CallOptions } from "ai";
2
- export interface CompressionStats {
3
- originalSize: number;
4
- compressedSize: number;
5
- savedChars: number;
6
- compressionRatio: number;
7
- screenshotCount: number;
8
- ariaTreeCount: number;
9
- }
10
- export declare function processMessages(params: LanguageModelV1CallOptions): {
11
- processedPrompt: LanguageModelV1CallOptions["prompt"];
12
- stats: CompressionStats;
13
- };
@@ -1 +0,0 @@
1
- export declare const v3ScriptContent = "(()=>{function b(_={}){let S=n=>{let{hostToRoot:l}=n,m=t=>{let o=[];if(t instanceof Document)return t.documentElement&&o.push(t.documentElement),o;if(t instanceof ShadowRoot||t instanceof DocumentFragment)return o.push(...Array.from(t.children)),o;if(t instanceof Element){o.push(...Array.from(t.children));let a=t.shadowRoot;a&&o.push(...Array.from(a.children));let r=l.get(t);return r&&o.push(...Array.from(r.children)),o}return o},v=t=>{let o=[],a=[...m(t)];for(;a.length;){let r=a.shift();o.push(r),a.push(...m(r))}return o},y=t=>{let o=String(t||\"\").trim();if(!o)return null;let a=o.replace(/^xpath=/i,\"\"),r=[];{let e=0;for(;e<a.length;){let d=\"child\";a.startsWith(\"//\",e)?(d=\"desc\",e+=2):a[e]===\"/\"&&(d=\"child\",e+=1);let h=e;for(;e<a.length&&a[e]!==\"/\";)e++;let u=a.slice(h,e).trim();if(!u)continue;let p=u.match(/^(.*?)(\\[(\\d+)\\])?$/u),i=(p?.[1]??u).trim(),c=p?.[3]?Math.max(1,Number(p[3])):null,R=i===\"\"?\"*\":i.toLowerCase();r.push({axis:d,raw:u,tag:R,index:c})}}n.debug&&console.info(\"[v3-piercer][resolve] start\",{url:location.href,steps:r.map(e=>({axis:e.axis,raw:e.raw,tag:e.tag,index:e.index}))});let g=[document];for(let e of r){let d=e.index,h=null;for(let u of g){let p=e.axis===\"child\"?m(u):v(u),i=[];for(let c of p)(e.tag===\"*\"||c.localName===e.tag)&&i.push(c);if(n.debug&&console.info(\"[v3-piercer][resolve] step\",{axis:e.axis,tag:e.tag,index:d,poolCount:p.length,matchesCount:i.length}),!!i.length){if(d!=null){let c=d-1;h=c>=0&&c<i.length?i[c]:null}else h=i[0];if(h)break}}if(!h)return n.debug&&console.info(\"[v3-piercer][resolve] no-match\",{step:e.raw}),null;g=[h]}let E=g.length?g[0]:null;return n.debug&&console.info(\"[v3-piercer][resolve] done\",{found:!!E,tag:E?.localName??\"\"}),E};window.__stagehandV3__={getClosedRoot:t=>l.get(t),stats:()=>({installed:!0,url:location.href,isTop:window.top===window,open:n.openCount,closed:n.closedCount}),resolveSimpleXPath:y}},f=Element.prototype.attachShadow;if(f.__v3Patched&&f.__v3State){f.__v3State.debug=!0,S(f.__v3State);return}let s={hostToRoot:new WeakMap,openCount:0,closedCount:0,debug:!0},x=f,w=function(n){let l=n?.mode??\"open\",m=x.call(this,n);try{s.hostToRoot.set(this,m),l===\"closed\"?s.closedCount++:s.openCount++,s.debug&&console.info(\"[v3-piercer] attachShadow\",{tag:this.tagName?.toLowerCase()??\"\",mode:l,url:location.href})}catch{}return m};if(w.__v3Patched=!0,w.__v3State=s,Object.defineProperty(Element.prototype,\"attachShadow\",{configurable:!0,writable:!0,value:w}),_.tagExisting)try{let n=document.createTreeWalker(document,NodeFilter.SHOW_ELEMENT);for(;n.nextNode();){let l=n.currentNode;l.shadowRoot&&(s.hostToRoot.set(l,l.shadowRoot),s.openCount++)}}catch{}window.__stagehandV3Injected=!0,S(s),s.debug&&console.info(\"[v3-piercer] installed\",{url:location.href,isTop:window.top===window,readyState:document.readyState})}b({debug:!0,tagExisting:!1});})();\n";
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export * from "./piercer.runtime";