@browserbasehq/orca 3.0.0-preview.1 → 3.0.0-preview.4

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 (160) hide show
  1. package/dist/index.d.ts +806 -682
  2. package/dist/index.js +34207 -23774
  3. package/package.json +46 -83
  4. package/LICENSE +0 -21
  5. package/README.md +0 -165
  6. package/dist/lib/StagehandContext.d.ts +0 -25
  7. package/dist/lib/StagehandPage.d.ts +0 -103
  8. package/dist/lib/a11y/utils.d.ts +0 -144
  9. package/dist/lib/agent/AgentClient.d.ts +0 -20
  10. package/dist/lib/agent/AgentProvider.d.ts +0 -19
  11. package/dist/lib/agent/AnthropicCUAClient.d.ts +0 -56
  12. package/dist/lib/agent/GoogleCUAClient.d.ts +0 -63
  13. package/dist/lib/agent/OpenAICUAClient.d.ts +0 -65
  14. package/dist/lib/agent/StagehandAgent.d.ts +0 -15
  15. package/dist/lib/agent/tools/act.d.ts +0 -59
  16. package/dist/lib/agent/tools/ariaTree.d.ts +0 -11
  17. package/dist/lib/agent/tools/close.d.ts +0 -22
  18. package/dist/lib/agent/tools/extract.d.ts +0 -38
  19. package/dist/lib/agent/tools/fillform.d.ts +0 -37
  20. package/dist/lib/agent/tools/goto.d.ts +0 -29
  21. package/dist/lib/agent/tools/index.d.ts +0 -257
  22. package/dist/lib/agent/tools/navback.d.ts +0 -17
  23. package/dist/lib/agent/tools/screenshot.d.ts +0 -13
  24. package/dist/lib/agent/tools/scroll.d.ts +0 -23
  25. package/dist/lib/agent/tools/wait.d.ts +0 -18
  26. package/dist/lib/agent/utils/cuaKeyMapping.d.ts +0 -10
  27. package/dist/lib/agent/utils/imageCompression.d.ts +0 -53
  28. package/dist/lib/agent/utils/messageProcessing.d.ts +0 -13
  29. package/dist/lib/api.d.ts +0 -23
  30. package/dist/lib/browserbaseDefaults.d.ts +0 -9
  31. package/dist/lib/cache/ActionCache.d.ts +0 -62
  32. package/dist/lib/cache/BaseCache.d.ts +0 -66
  33. package/dist/lib/cache/LLMCache.d.ts +0 -22
  34. package/dist/lib/cache.d.ts +0 -29
  35. package/dist/lib/dom/build/scriptContent.d.ts +0 -1
  36. package/dist/lib/dom/elementCheckUtils.d.ts +0 -2
  37. package/dist/lib/dom/genDomScripts.d.ts +0 -1
  38. package/dist/lib/dom/index.d.ts +0 -2
  39. package/dist/lib/dom/process.d.ts +0 -17
  40. package/dist/lib/dom/utils.d.ts +0 -7
  41. package/dist/lib/dom/xpathUtils.d.ts +0 -14
  42. package/dist/lib/handlers/actHandler.d.ts +0 -33
  43. package/dist/lib/handlers/cuaAgentHandler.d.ts +0 -58
  44. package/dist/lib/handlers/extractHandler.d.ts +0 -54
  45. package/dist/lib/handlers/handlerUtils/actHandlerUtils.d.ts +0 -21
  46. package/dist/lib/handlers/observeHandler.d.ts +0 -40
  47. package/dist/lib/handlers/stagehandAgentHandler.d.ts +0 -27
  48. package/dist/lib/index.d.ts +0 -94
  49. package/dist/lib/inference.d.ts +0 -71
  50. package/dist/lib/inferenceLogUtils.d.ts +0 -12
  51. package/dist/lib/llm/AnthropicClient.d.ts +0 -21
  52. package/dist/lib/llm/CerebrasClient.d.ts +0 -22
  53. package/dist/lib/llm/GoogleClient.d.ts +0 -24
  54. package/dist/lib/llm/GroqClient.d.ts +0 -22
  55. package/dist/lib/llm/LLMClient.d.ts +0 -99
  56. package/dist/lib/llm/LLMProvider.d.ts +0 -13
  57. package/dist/lib/llm/OpenAIClient.d.ts +0 -20
  58. package/dist/lib/llm/aisdk.d.ts +0 -20
  59. package/dist/lib/logger.d.ts +0 -54
  60. package/dist/lib/mcp/connection.d.ts +0 -11
  61. package/dist/lib/mcp/utils.d.ts +0 -3
  62. package/dist/lib/prompt.d.ts +0 -12
  63. package/dist/lib/utils.d.ts +0 -65
  64. package/dist/lib/v3/agent/AgentClient.d.ts +0 -18
  65. package/dist/lib/v3/agent/AgentProvider.d.ts +0 -18
  66. package/dist/lib/v3/agent/AnthropicCUAClient.d.ts +0 -55
  67. package/dist/lib/v3/agent/OpenAICUAClient.d.ts +0 -64
  68. package/dist/lib/v3/agent/StagehandAgent.d.ts +0 -15
  69. package/dist/lib/v3/agent/tools/index.d.ts +0 -229
  70. package/dist/lib/v3/agent/tools/v3-act.d.ts +0 -29
  71. package/dist/lib/v3/agent/tools/v3-ariaTree.d.ts +0 -11
  72. package/dist/lib/v3/agent/tools/v3-close.d.ts +0 -24
  73. package/dist/lib/v3/agent/tools/v3-extract.d.ts +0 -38
  74. package/dist/lib/v3/agent/tools/v3-fillform.d.ts +0 -37
  75. package/dist/lib/v3/agent/tools/v3-goto.d.ts +0 -29
  76. package/dist/lib/v3/agent/tools/v3-navback.d.ts +0 -17
  77. package/dist/lib/v3/agent/tools/v3-screenshot.d.ts +0 -13
  78. package/dist/lib/v3/agent/tools/v3-scroll.d.ts +0 -23
  79. package/dist/lib/v3/agent/tools/v3-wait.d.ts +0 -19
  80. package/dist/lib/v3/agent/utils/cuaKeyMapping.d.ts +0 -10
  81. package/dist/lib/v3/agent/utils/imageCompression.d.ts +0 -18
  82. package/dist/lib/v3/agent/utils/messageProcessing.d.ts +0 -13
  83. package/dist/lib/v3/dom/build/scriptV3Content.d.ts +0 -1
  84. package/dist/lib/v3/dom/genDomScripts.d.ts +0 -1
  85. package/dist/lib/v3/dom/index.d.ts +0 -1
  86. package/dist/lib/v3/dom/piercer.entry.d.ts +0 -1
  87. package/dist/lib/v3/dom/piercer.runtime.d.ts +0 -25
  88. package/dist/lib/v3/handlers/actHandler.d.ts +0 -18
  89. package/dist/lib/v3/handlers/extractHandler.d.ts +0 -29
  90. package/dist/lib/v3/handlers/handlerUtils/actHandlerUtils.d.ts +0 -18
  91. package/dist/lib/v3/handlers/observeHandler.d.ts +0 -15
  92. package/dist/lib/v3/handlers/v3AgentHandler.d.ts +0 -17
  93. package/dist/lib/v3/handlers/v3CuaAgentHandler.d.ts +0 -26
  94. package/dist/lib/v3/index.d.ts +0 -10
  95. package/dist/lib/v3/launch/browserbase.d.ts +0 -8
  96. package/dist/lib/v3/launch/local.d.ts +0 -13
  97. package/dist/lib/v3/llm/AnthropicClient.d.ts +0 -16
  98. package/dist/lib/v3/llm/CerebrasClient.d.ts +0 -17
  99. package/dist/lib/v3/llm/GoogleClient.d.ts +0 -19
  100. package/dist/lib/v3/llm/GroqClient.d.ts +0 -17
  101. package/dist/lib/v3/llm/LLMClient.d.ts +0 -99
  102. package/dist/lib/v3/llm/LLMProvider.d.ts +0 -10
  103. package/dist/lib/v3/llm/OpenAIClient.d.ts +0 -15
  104. package/dist/lib/v3/llm/aisdk.d.ts +0 -15
  105. package/dist/lib/v3/logger.d.ts +0 -48
  106. package/dist/lib/v3/mcp/connection.d.ts +0 -11
  107. package/dist/lib/v3/mcp/utils.d.ts +0 -3
  108. package/dist/lib/v3/tests/default-page-tracking.spec.d.ts +0 -1
  109. package/dist/lib/v3/tests/downloads.spec.d.ts +0 -1
  110. package/dist/lib/v3/tests/perform-understudy-method.spec.d.ts +0 -1
  111. package/dist/lib/v3/tests/shadow-iframe.spec.d.ts +0 -1
  112. package/dist/lib/v3/tests/timeouts.spec.d.ts +0 -1
  113. package/dist/lib/v3/tests/v3.bb.config.d.ts +0 -4
  114. package/dist/lib/v3/tests/v3.config.d.ts +0 -4
  115. package/dist/lib/v3/tests/v3.playwright.config.d.ts +0 -2
  116. package/dist/lib/v3/tests/xpath-for-location-deep.spec.d.ts +0 -1
  117. package/dist/lib/v3/types/act.d.ts +0 -10
  118. package/dist/lib/v3/types/agent.d.ts +0 -132
  119. package/dist/lib/v3/types/api.d.ts +0 -40
  120. package/dist/lib/v3/types/cache.d.ts +0 -71
  121. package/dist/lib/v3/types/context.d.ts +0 -2
  122. package/dist/lib/v3/types/evals.d.ts +0 -71
  123. package/dist/lib/v3/types/evaluator.d.ts +0 -40
  124. package/dist/lib/v3/types/llm.d.ts +0 -11
  125. package/dist/lib/v3/types/log.d.ts +0 -23
  126. package/dist/lib/v3/types/model.d.ts +0 -20
  127. package/dist/lib/v3/types/playwright.d.ts +0 -6
  128. package/dist/lib/v3/types/stagehand.d.ts +0 -113
  129. package/dist/lib/v3/types/stagehandApiErrors.d.ts +0 -18
  130. package/dist/lib/v3/types/stagehandErrors.d.ts +0 -104
  131. package/dist/lib/v3/types.d.ts +0 -176
  132. package/dist/lib/v3/understudy/a11y/snapshot.d.ts +0 -71
  133. package/dist/lib/v3/understudy/cdp.d.ts +0 -58
  134. package/dist/lib/v3/understudy/context.d.ts +0 -120
  135. package/dist/lib/v3/understudy/deepLocator.d.ts +0 -69
  136. package/dist/lib/v3/understudy/executionContextRegistry.d.ts +0 -15
  137. package/dist/lib/v3/understudy/frame.d.ts +0 -63
  138. package/dist/lib/v3/understudy/frameLocator.d.ts +0 -46
  139. package/dist/lib/v3/understudy/frameRegistry.d.ts +0 -100
  140. package/dist/lib/v3/understudy/locator.d.ts +0 -196
  141. package/dist/lib/v3/understudy/page.d.ts +0 -241
  142. package/dist/lib/v3/understudy/piercer.d.ts +0 -4
  143. package/dist/lib/v3/v3.d.ts +0 -158
  144. package/dist/lib/version.d.ts +0 -5
  145. package/dist/stagehand.config.d.ts +0 -3
  146. package/dist/types/act.d.ts +0 -50
  147. package/dist/types/agent.d.ts +0 -143
  148. package/dist/types/api.d.ts +0 -40
  149. package/dist/types/browser.d.ts +0 -10
  150. package/dist/types/context.d.ts +0 -117
  151. package/dist/types/evals.d.ts +0 -94
  152. package/dist/types/evaluator.d.ts +0 -40
  153. package/dist/types/llm.d.ts +0 -11
  154. package/dist/types/log.d.ts +0 -23
  155. package/dist/types/model.d.ts +0 -17
  156. package/dist/types/page.d.ts +0 -38
  157. package/dist/types/playwright.d.ts +0 -12
  158. package/dist/types/stagehand.d.ts +0 -330
  159. package/dist/types/stagehandApiErrors.d.ts +0 -18
  160. package/dist/types/stagehandErrors.d.ts +0 -104
@@ -1,132 +0,0 @@
1
- import { LogLine } from "./log";
2
- export interface AgentAction {
3
- type: string;
4
- reasoning?: string;
5
- taskCompleted?: boolean;
6
- action?: string;
7
- timeMs?: number;
8
- pageText?: string;
9
- pageUrl?: string;
10
- instruction?: string;
11
- [key: string]: unknown;
12
- }
13
- export interface AgentResult {
14
- success: boolean;
15
- message: string;
16
- actions: AgentAction[];
17
- completed: boolean;
18
- metadata?: Record<string, unknown>;
19
- usage?: {
20
- input_tokens: number;
21
- output_tokens: number;
22
- inference_time_ms: number;
23
- };
24
- }
25
- export interface AgentOptions {
26
- maxSteps?: number;
27
- autoScreenshot?: boolean;
28
- waitBetweenActions?: number;
29
- context?: string;
30
- }
31
- export interface AgentExecuteOptions extends AgentOptions {
32
- instruction: string;
33
- }
34
- export type AgentProviderType = "openai" | "anthropic";
35
- export interface AgentClientOptions {
36
- apiKey: string;
37
- organization?: string;
38
- baseURL?: string;
39
- defaultMaxSteps?: number;
40
- [key: string]: unknown;
41
- }
42
- export type AgentType = "openai" | "anthropic";
43
- export interface AgentExecutionOptions {
44
- options: AgentExecuteOptions;
45
- logger: (message: LogLine) => void;
46
- retries?: number;
47
- }
48
- export interface AgentHandlerOptions {
49
- modelName: string;
50
- clientOptions?: Record<string, unknown>;
51
- userProvidedInstructions?: string;
52
- agentType: AgentType;
53
- experimental?: boolean;
54
- }
55
- export interface ActionExecutionResult {
56
- success: boolean;
57
- error?: string;
58
- data?: unknown;
59
- }
60
- export interface ToolUseItem extends ResponseItem {
61
- type: "tool_use";
62
- id: string;
63
- name: string;
64
- input: Record<string, unknown>;
65
- }
66
- export interface AnthropicMessage {
67
- role: string;
68
- content: string | Array<AnthropicContentBlock>;
69
- }
70
- export interface AnthropicContentBlock {
71
- type: string;
72
- [key: string]: unknown;
73
- }
74
- export interface AnthropicTextBlock extends AnthropicContentBlock {
75
- type: "text";
76
- text: string;
77
- }
78
- export interface AnthropicToolResult {
79
- type: "tool_result";
80
- tool_use_id: string;
81
- content: string | Array<AnthropicContentBlock>;
82
- }
83
- export interface ResponseItem {
84
- type: string;
85
- id: string;
86
- [key: string]: unknown;
87
- }
88
- export interface ComputerCallItem extends ResponseItem {
89
- type: "computer_call";
90
- call_id: string;
91
- action: {
92
- type: string;
93
- [key: string]: unknown;
94
- };
95
- pending_safety_checks?: Array<{
96
- id: string;
97
- code: string;
98
- message: string;
99
- }>;
100
- }
101
- export interface FunctionCallItem extends ResponseItem {
102
- type: "function_call";
103
- call_id: string;
104
- name: string;
105
- arguments: string;
106
- }
107
- export type ResponseInputItem = {
108
- role: string;
109
- content: string;
110
- } | {
111
- type: "computer_call_output";
112
- call_id: string;
113
- output: {
114
- type: "input_image";
115
- image_url: string;
116
- current_url?: string;
117
- error?: string;
118
- [key: string]: unknown;
119
- } | string;
120
- acknowledged_safety_checks?: Array<{
121
- id: string;
122
- code: string;
123
- message: string;
124
- }>;
125
- } | {
126
- type: "function_call_output";
127
- call_id: string;
128
- output: string;
129
- };
130
- export interface AgentInstance {
131
- execute: (instructionOrOptions: string | AgentExecuteOptions) => Promise<AgentResult>;
132
- }
@@ -1,40 +0,0 @@
1
- import Browserbase from "@browserbasehq/sdk";
2
- import { LogLine } from "./log";
3
- export interface StagehandAPIConstructorParams {
4
- apiKey: string;
5
- projectId: string;
6
- logger: (message: LogLine) => void;
7
- }
8
- export interface ExecuteActionParams {
9
- method: "act" | "extract" | "observe" | "navigate" | "end" | "agentExecute";
10
- args?: unknown;
11
- params?: unknown;
12
- }
13
- export interface StartSessionParams {
14
- modelName: string;
15
- modelApiKey: string;
16
- domSettleTimeoutMs: number;
17
- verbose: number;
18
- debugDom: boolean;
19
- systemPrompt?: string;
20
- browserbaseSessionCreateParams?: Omit<Browserbase.Sessions.SessionCreateParams, "projectId"> & {
21
- projectId?: string;
22
- };
23
- selfHeal?: boolean;
24
- waitForCaptchaSolves?: boolean;
25
- actionTimeoutMs?: number;
26
- browserbaseSessionID?: string;
27
- }
28
- export interface StartSessionResult {
29
- sessionId: string;
30
- available?: boolean;
31
- }
32
- export interface SuccessResponse<T> {
33
- success: true;
34
- data: T;
35
- }
36
- export interface ErrorResponse {
37
- success: false;
38
- message: string;
39
- }
40
- export type ApiResponse<T> = SuccessResponse<T> | ErrorResponse;
@@ -1,71 +0,0 @@
1
- import type { AgentResult } from "@/lib/v3/types/agent";
2
- import type { Action } from "@/lib/v3/types/stagehand";
3
- import type { LoadState } from "@/lib/v3/types";
4
- export interface CachedActEntry {
5
- version: 1;
6
- instruction: string;
7
- url: string;
8
- variables: Record<string, string>;
9
- actions: Action[];
10
- actionDescription?: string;
11
- message?: string;
12
- }
13
- export type AgentReplayStep = AgentReplayActStep | AgentReplayFillFormStep | AgentReplayGotoStep | AgentReplayScrollStep | AgentReplayWaitStep | AgentReplayNavBackStep | {
14
- type: string;
15
- [key: string]: unknown;
16
- };
17
- export interface AgentReplayActStep {
18
- type: "act";
19
- instruction: string;
20
- actions?: Action[];
21
- actionDescription?: string;
22
- message?: string;
23
- timeout?: number;
24
- }
25
- export interface AgentReplayFillFormStep {
26
- type: "fillForm";
27
- fields?: Array<{
28
- action: string;
29
- value: string;
30
- }>;
31
- observeResults?: Action[];
32
- actions?: Action[];
33
- }
34
- export interface AgentReplayGotoStep {
35
- type: "goto";
36
- url: string;
37
- waitUntil?: LoadState;
38
- }
39
- export interface AgentReplayScrollStep {
40
- type: "scroll";
41
- deltaX?: number;
42
- deltaY?: number;
43
- anchor?: {
44
- x: number;
45
- y: number;
46
- };
47
- }
48
- export interface AgentReplayWaitStep {
49
- type: "wait";
50
- timeMs: number;
51
- }
52
- export interface AgentReplayNavBackStep {
53
- type: "navback";
54
- waitUntil?: LoadState;
55
- }
56
- export interface SanitizedAgentExecuteOptions {
57
- maxSteps?: number;
58
- autoScreenshot?: boolean;
59
- waitBetweenActions?: number;
60
- context?: string;
61
- }
62
- export interface CachedAgentEntry {
63
- version: 1;
64
- instruction: string;
65
- startUrl: string;
66
- options: SanitizedAgentExecuteOptions;
67
- configSignature: string;
68
- steps: AgentReplayStep[];
69
- result: AgentResult;
70
- timestamp: string;
71
- }
@@ -1,2 +0,0 @@
1
- export type EncodedId = `${number}-${number}`;
2
- export declare const ID_PATTERN: RegExp;
@@ -1,71 +0,0 @@
1
- import { z } from "zod/v3";
2
- import type { AvailableModel } from "../types/model";
3
- import type { LogLine } from "../types/log";
4
- import type { AgentInstance } from "../types/agent";
5
- import type { EvalCase } from "braintrust";
6
- import type { V3 } from "@/lib/v3/v3";
7
- import { EvalLogger } from "@/evals/logger";
8
- export type StagehandInitResult = {
9
- v3?: V3;
10
- v3Agent?: AgentInstance;
11
- logger: EvalLogger;
12
- debugUrl: string;
13
- sessionUrl: string;
14
- modelName: AvailableModel;
15
- agent: AgentInstance;
16
- };
17
- export type EvalFunction = (taskInput: StagehandInitResult & {
18
- input: EvalInput;
19
- }) => Promise<{
20
- _success: boolean;
21
- logs: LogLine[];
22
- debugUrl: string;
23
- sessionUrl: string;
24
- error?: unknown;
25
- }>;
26
- export declare const EvalCategorySchema: z.ZodEnum<["observe", "act", "combination", "extract", "experimental", "targeted_extract", "regression", "regression_llm_providers", "llm_clients", "agent", "external_agent_benchmarks"]>;
27
- export type EvalCategory = z.infer<typeof EvalCategorySchema>;
28
- export interface EvalInput {
29
- name: string;
30
- modelName: AvailableModel;
31
- params?: Record<string, unknown>;
32
- }
33
- export interface Testcase extends EvalCase<EvalInput, unknown, {
34
- model: AvailableModel;
35
- test: string;
36
- categories?: string[];
37
- }> {
38
- input: EvalInput;
39
- name: string;
40
- tags: string[];
41
- metadata: {
42
- model: AvailableModel;
43
- test: string;
44
- categories?: string[];
45
- };
46
- expected: unknown;
47
- }
48
- export interface SummaryResult {
49
- input: EvalInput;
50
- output: {
51
- _success: boolean;
52
- };
53
- name: string;
54
- score: number;
55
- }
56
- export interface EvalArgs<TInput, TOutput, TExpected> {
57
- input: TInput;
58
- output: TOutput;
59
- expected: TExpected;
60
- metadata?: {
61
- model: AvailableModel;
62
- test: string;
63
- };
64
- }
65
- export interface EvalResult {
66
- name: string;
67
- score: number;
68
- }
69
- export type LogLineEval = LogLine & {
70
- parsedAuxiliary?: string | object;
71
- };
@@ -1,40 +0,0 @@
1
- export type EvaluateOptions = {
2
- /** The question to ask about the task state */
3
- question: string;
4
- /** The answer to the question */
5
- answer?: string;
6
- /** Whether to take a screenshot of the task state, or array of screenshots to evaluate */
7
- screenshot?: boolean | Buffer[];
8
- /** Custom system prompt for the evaluator */
9
- systemPrompt?: string;
10
- /** Delay in milliseconds before taking the screenshot @default 250 */
11
- screenshotDelayMs?: number;
12
- /** The agent's reasoning/thought process for completing the task */
13
- agentReasoning?: string;
14
- };
15
- export type BatchAskOptions = {
16
- /** Array of questions with optional answers */
17
- questions: Array<{
18
- question: string;
19
- answer?: string;
20
- }>;
21
- /** Whether to take a screenshot of the task state */
22
- screenshot?: boolean;
23
- /** Custom system prompt for the evaluator */
24
- systemPrompt?: string;
25
- /** Delay in milliseconds before taking the screenshot @default 1000 */
26
- screenshotDelayMs?: number;
27
- };
28
- /**
29
- * Result of an evaluation
30
- */
31
- export interface EvaluationResult {
32
- /**
33
- * The evaluation result ('YES', 'NO', or 'INVALID' if parsing failed or value was unexpected)
34
- */
35
- evaluation: "YES" | "NO" | "INVALID";
36
- /**
37
- * The reasoning behind the evaluation
38
- */
39
- reasoning: string;
40
- }
@@ -1,11 +0,0 @@
1
- import { LanguageModel } from "ai";
2
- export interface LLMTool {
3
- type: "function";
4
- name: string;
5
- description: string;
6
- parameters: Record<string, unknown>;
7
- }
8
- export type AISDKProvider = (modelName: string) => LanguageModel;
9
- export type AISDKCustomProvider = (options: {
10
- apiKey: string;
11
- }) => AISDKProvider;
@@ -1,23 +0,0 @@
1
- export type LogLevel = 0 | 1 | 2;
2
- /**
3
- * Mapping between numeric log levels and their names
4
- *
5
- * 0 - error/warn - Critical issues or important warnings
6
- * 1 - info - Standard information messages
7
- * 2 - debug - Detailed information for debugging
8
- */
9
- export declare const LOG_LEVEL_NAMES: Record<LogLevel, string>;
10
- export type LogLine = {
11
- id?: string;
12
- category?: string;
13
- message: string;
14
- level?: LogLevel;
15
- timestamp?: string;
16
- auxiliary?: {
17
- [key: string]: {
18
- value: string;
19
- type: "object" | "string" | "html" | "integer" | "float" | "boolean";
20
- };
21
- };
22
- };
23
- export type Logger = (logLine: LogLine) => void;
@@ -1,20 +0,0 @@
1
- import type { ClientOptions as AnthropicClientOptions } from "@anthropic-ai/sdk";
2
- import type { ClientOptions as OpenAIClientOptions } from "openai";
3
- import { z } from "zod/v3";
4
- export declare const AvailableModelSchema: z.ZodEnum<["gpt-4.1", "gpt-4.1-mini", "gpt-4.1-nano", "o4-mini", "o3", "o3-mini", "o1", "o1-mini", "gpt-4o", "gpt-4o-mini", "gpt-4o-2024-08-06", "gpt-4.5-preview", "o1-preview", "claude-3-5-sonnet-latest", "claude-3-5-sonnet-20241022", "claude-3-5-sonnet-20240620", "claude-3-7-sonnet-latest", "claude-3-7-sonnet-20250219", "cerebras-llama-3.3-70b", "cerebras-llama-3.1-8b", "groq-llama-3.3-70b-versatile", "groq-llama-3.3-70b-specdec", "gemini-1.5-flash", "gemini-1.5-pro", "gemini-1.5-flash-8b", "gemini-2.0-flash-lite", "gemini-2.0-flash", "gemini-2.5-flash-preview-04-17", "gemini-2.5-pro-preview-03-25"]>;
5
- export type AvailableModel = z.infer<typeof AvailableModelSchema> | string;
6
- export type ModelProvider = "openai" | "anthropic" | "cerebras" | "groq" | "google" | "aisdk";
7
- export type ClientOptions = OpenAIClientOptions | AnthropicClientOptions;
8
- export type ModelConfiguration = AvailableModel | (ClientOptions & {
9
- modelName: AvailableModel;
10
- });
11
- export interface AnthropicJsonSchemaObject {
12
- definitions?: {
13
- MySchema?: {
14
- properties?: Record<string, unknown>;
15
- required?: string[];
16
- };
17
- };
18
- properties?: Record<string, unknown>;
19
- required?: string[];
20
- }
@@ -1,6 +0,0 @@
1
- export interface GotoOptions {
2
- timeout?: number;
3
- waitUntil?: "load" | "domcontentloaded" | "networkidle" | "commit";
4
- referer?: string;
5
- frameId?: string;
6
- }
@@ -1,113 +0,0 @@
1
- import { Client } from "@modelcontextprotocol/sdk/dist/esm/client";
2
- import { ToolSet } from "ai";
3
- import { z } from "zod/v3";
4
- import { AgentProviderType } from "./agent";
5
- import { ModelConfiguration } from "./model";
6
- export interface ActOptions {
7
- action: string;
8
- model?: ModelConfiguration;
9
- variables?: Record<string, string>;
10
- domSettleTimeoutMs?: number;
11
- timeoutMs?: number;
12
- iframes?: boolean;
13
- frameId?: string;
14
- }
15
- export interface ActResult {
16
- success: boolean;
17
- message: string;
18
- actionDescription: string;
19
- actions: Action[];
20
- }
21
- export interface ExtractOptions<T extends z.AnyZodObject> {
22
- instruction?: string;
23
- schema?: T;
24
- model?: ModelConfiguration;
25
- domSettleTimeoutMs?: number;
26
- /**
27
- * @deprecated The `useTextExtract` parameter has no effect in this version of Stagehand and will be removed in later versions.
28
- */
29
- useTextExtract?: boolean;
30
- selector?: string;
31
- iframes?: boolean;
32
- frameId?: string;
33
- }
34
- export type ExtractResult<T extends z.AnyZodObject> = z.infer<T>;
35
- export interface ObserveOptions {
36
- instruction?: string;
37
- model?: ModelConfiguration;
38
- domSettleTimeoutMs?: number;
39
- returnAction?: boolean;
40
- selector?: string;
41
- /**
42
- * @deprecated The `onlyVisible` parameter has no effect in this version of Stagehand and will be removed in later versions.
43
- */
44
- onlyVisible?: boolean;
45
- drawOverlay?: boolean;
46
- iframes?: boolean;
47
- frameId?: string;
48
- }
49
- export interface Action {
50
- selector: string;
51
- description: string;
52
- backendNodeId?: number;
53
- method?: string;
54
- arguments?: string[];
55
- }
56
- /**
57
- * Configuration for agent functionality
58
- */
59
- export interface AgentConfig {
60
- /**
61
- * The provider to use for agent functionality
62
- */
63
- provider?: AgentProviderType;
64
- /**
65
- * The model to use for agent functionality
66
- */
67
- model?: string;
68
- /**
69
- * The model to use for tool execution (observe/act calls within agent tools).
70
- * If not specified, inherits from the main model configuration.
71
- * Format: "provider/model" (e.g., "openai/gpt-4o-mini", "google/gemini-2.0-flash-exp")
72
- */
73
- executionModel?: string;
74
- /**
75
- * Custom instructions to provide to the agent
76
- */
77
- instructions?: string;
78
- /**
79
- * Additional options to pass to the agent client
80
- */
81
- options?: Record<string, unknown>;
82
- /**
83
- * MCP integrations - Array of Client objects
84
- */
85
- integrations?: (Client | string)[];
86
- /**
87
- * Tools passed to the agent client
88
- */
89
- tools?: ToolSet;
90
- }
91
- export interface HistoryEntry {
92
- method: "act" | "extract" | "observe" | "navigate";
93
- parameters: unknown;
94
- result: unknown;
95
- timestamp: string;
96
- }
97
- /**
98
- * Represents a path through a Zod schema from the root object down to a
99
- * particular field. The `segments` array describes the chain of keys/indices.
100
- *
101
- * - **String** segments indicate object property names.
102
- * - **Number** segments indicate array indices.
103
- *
104
- * For example, `["users", 0, "homepage"]` might describe reaching
105
- * the `homepage` field in `schema.users[0].homepage`.
106
- */
107
- export interface ZodPathSegments {
108
- /**
109
- * The ordered list of keys/indices leading from the schema root
110
- * to the targeted field.
111
- */
112
- segments: Array<string | number>;
113
- }
@@ -1,18 +0,0 @@
1
- export declare class StagehandAPIError extends Error {
2
- constructor(message: string);
3
- }
4
- export declare class StagehandAPIUnauthorizedError extends StagehandAPIError {
5
- constructor(message?: string);
6
- }
7
- export declare class StagehandHttpError extends StagehandAPIError {
8
- constructor(message: string);
9
- }
10
- export declare class StagehandServerError extends StagehandAPIError {
11
- constructor(message: string);
12
- }
13
- export declare class StagehandResponseBodyError extends StagehandAPIError {
14
- constructor();
15
- }
16
- export declare class StagehandResponseParseError extends StagehandAPIError {
17
- constructor(message: string);
18
- }
@@ -1,104 +0,0 @@
1
- import { ZodError } from "zod/v3";
2
- export declare class StagehandError extends Error {
3
- constructor(message: string);
4
- }
5
- export declare class StagehandDefaultError extends StagehandError {
6
- constructor(error?: unknown);
7
- }
8
- export declare class StagehandEnvironmentError extends StagehandError {
9
- constructor(currentEnvironment: string, requiredEnvironment: string, feature: string);
10
- }
11
- export declare class MissingEnvironmentVariableError extends StagehandError {
12
- constructor(missingEnvironmentVariable: string, feature: string);
13
- }
14
- export declare class UnsupportedModelError extends StagehandError {
15
- constructor(supportedModels: string[], feature?: string);
16
- }
17
- export declare class UnsupportedModelProviderError extends StagehandError {
18
- constructor(supportedProviders: string[], feature?: string);
19
- }
20
- export declare class UnsupportedAISDKModelProviderError extends StagehandError {
21
- constructor(provider: string, supportedProviders: string[]);
22
- }
23
- export declare class InvalidAISDKModelFormatError extends StagehandError {
24
- constructor(modelName: string);
25
- }
26
- export declare class StagehandNotInitializedError extends StagehandError {
27
- constructor(prop: string);
28
- }
29
- export declare class BrowserbaseSessionNotFoundError extends StagehandError {
30
- constructor();
31
- }
32
- export declare class CaptchaTimeoutError extends StagehandError {
33
- constructor();
34
- }
35
- export declare class MissingLLMConfigurationError extends StagehandError {
36
- constructor();
37
- }
38
- export declare class HandlerNotInitializedError extends StagehandError {
39
- constructor(handlerType: string);
40
- }
41
- export declare class StagehandInvalidArgumentError extends StagehandError {
42
- constructor(message: string);
43
- }
44
- export declare class StagehandElementNotFoundError extends StagehandError {
45
- constructor(xpaths: string[]);
46
- }
47
- export declare class AgentScreenshotProviderError extends StagehandError {
48
- constructor(message: string);
49
- }
50
- export declare class StagehandMissingArgumentError extends StagehandError {
51
- constructor(message: string);
52
- }
53
- export declare class CreateChatCompletionResponseError extends StagehandError {
54
- constructor(message: string);
55
- }
56
- export declare class StagehandEvalError extends StagehandError {
57
- constructor(message: string);
58
- }
59
- export declare class StagehandDomProcessError extends StagehandError {
60
- constructor(message: string);
61
- }
62
- export declare class StagehandClickError extends StagehandError {
63
- constructor(message: string, selector: string);
64
- }
65
- export declare class LLMResponseError extends StagehandError {
66
- constructor(primitive: string, message: string);
67
- }
68
- export declare class StagehandIframeError extends StagehandError {
69
- constructor(frameUrl: string, message: string);
70
- }
71
- export declare class ContentFrameNotFoundError extends StagehandError {
72
- constructor(selector: string);
73
- }
74
- export declare class XPathResolutionError extends StagehandError {
75
- constructor(xpath: string);
76
- }
77
- export declare class ExperimentalApiConflictError extends StagehandError {
78
- constructor();
79
- }
80
- export declare class ExperimentalNotConfiguredError extends StagehandError {
81
- constructor(featureName: string);
82
- }
83
- export declare class ZodSchemaValidationError extends Error {
84
- readonly received: unknown;
85
- readonly issues: ReturnType<ZodError["format"]>;
86
- constructor(received: unknown, issues: ReturnType<ZodError["format"]>);
87
- }
88
- export declare class StagehandInitError extends StagehandError {
89
- constructor(message: string);
90
- }
91
- export declare class MCPConnectionError extends StagehandError {
92
- readonly serverUrl: string;
93
- readonly originalError: unknown;
94
- constructor(serverUrl: string, originalError: unknown);
95
- }
96
- export declare class StagehandShadowRootMissingError extends StagehandError {
97
- constructor(detail?: string);
98
- }
99
- export declare class StagehandShadowSegmentEmptyError extends StagehandError {
100
- constructor();
101
- }
102
- export declare class StagehandShadowSegmentNotFoundError extends StagehandError {
103
- constructor(segment: string, hint?: string);
104
- }