@browserbasehq/orca 3.0.1-zod4 → 3.0.2-test-cua-base-url

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 (3) hide show
  1. package/dist/index.d.ts +29 -35
  2. package/dist/index.js +244 -286
  3. package/package.json +4 -3
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ZodType, z, ZodError, ZodTypeAny } from 'zod';
1
+ import z, { ZodType, z as z$1, ZodError, ZodTypeAny } from 'zod/v3';
2
2
  import { ClientOptions as ClientOptions$2 } from '@anthropic-ai/sdk';
3
3
  import { LanguageModelV2 } from '@ai-sdk/provider';
4
4
  import { ClientOptions as ClientOptions$1 } from 'openai';
@@ -141,14 +141,6 @@ interface CreateChatCompletionOptions {
141
141
  logger: (message: LogLine) => void;
142
142
  retries?: number;
143
143
  }
144
- interface LLMParsedResponse<T> {
145
- data: T;
146
- usage?: {
147
- prompt_tokens: number;
148
- completion_tokens: number;
149
- total_tokens: number;
150
- };
151
- }
152
144
  declare abstract class LLMClient {
153
145
  type: "openai" | "anthropic" | "cerebras" | "groq" | (string & {});
154
146
  modelName: AvailableModel | (string & {});
@@ -156,15 +148,9 @@ declare abstract class LLMClient {
156
148
  clientOptions: ClientOptions;
157
149
  userProvidedInstructions?: string;
158
150
  constructor(modelName: AvailableModel, userProvidedInstructions?: string);
159
- abstract createChatCompletion<T>(options: CreateChatCompletionOptions & {
160
- options: {
161
- response_model: {
162
- name: string;
163
- schema: ZodType;
164
- };
165
- };
166
- }): Promise<LLMParsedResponse<T>>;
167
- abstract createChatCompletion<T = LLMResponse>(options: CreateChatCompletionOptions): Promise<T>;
151
+ abstract createChatCompletion<T = LLMResponse & {
152
+ usage?: LLMResponse["usage"];
153
+ }>(options: CreateChatCompletionOptions): Promise<T>;
168
154
  generateObject: typeof generateObject;
169
155
  generateText: typeof generateText;
170
156
  streamText: typeof streamText;
@@ -755,7 +741,7 @@ declare class StagehandAPIClient {
755
741
  constructor({ apiKey, projectId, logger }: StagehandAPIConstructorParams);
756
742
  init({ modelName, modelApiKey, domSettleTimeoutMs, verbose, systemPrompt, selfHeal, browserbaseSessionCreateParams, browserbaseSessionID, }: StartSessionParams): Promise<StartSessionResult>;
757
743
  act({ input, options, frameId }: APIActParameters): Promise<ActResult>;
758
- extract<T extends z.ZodObject>({ instruction, schema: zodSchema, options, frameId, }: APIExtractParameters): Promise<ExtractResult<T>>;
744
+ extract<T extends z.AnyZodObject>({ instruction, schema: zodSchema, options, frameId, }: APIExtractParameters): Promise<ExtractResult<T>>;
759
745
  observe({ instruction, options, frameId, }: APIObserveParameters): Promise<Action[]>;
760
746
  goto(url: string, options?: {
761
747
  waitUntil?: "load" | "domcontentloaded" | "networkidle";
@@ -1307,7 +1293,7 @@ interface ActResult {
1307
1293
  actionDescription: string;
1308
1294
  actions: Action[];
1309
1295
  }
1310
- type ExtractResult<T extends z.ZodObject> = z.infer<T>;
1296
+ type ExtractResult<T extends z$1.AnyZodObject> = z$1.infer<T>;
1311
1297
  interface Action {
1312
1298
  selector: string;
1313
1299
  description: string;
@@ -1326,12 +1312,20 @@ interface ExtractOptions {
1326
1312
  selector?: string;
1327
1313
  page?: Page$1 | Page$2 | Page$3 | Page;
1328
1314
  }
1329
- declare const defaultExtractSchema: z.ZodObject<{
1330
- extraction: z.ZodString;
1331
- }, z.core.$strip>;
1332
- declare const pageTextSchema: z.ZodObject<{
1333
- pageText: z.ZodString;
1334
- }, z.core.$strip>;
1315
+ declare const defaultExtractSchema: z$1.ZodObject<{
1316
+ extraction: z$1.ZodString;
1317
+ }, "strip", z$1.ZodTypeAny, {
1318
+ extraction?: string;
1319
+ }, {
1320
+ extraction?: string;
1321
+ }>;
1322
+ declare const pageTextSchema: z$1.ZodObject<{
1323
+ pageText: z$1.ZodString;
1324
+ }, "strip", z$1.ZodTypeAny, {
1325
+ pageText?: string;
1326
+ }, {
1327
+ pageText?: string;
1328
+ }>;
1335
1329
  interface ObserveOptions {
1336
1330
  model?: ModelConfiguration;
1337
1331
  timeout?: number;
@@ -1899,10 +1893,10 @@ declare class V3 {
1899
1893
  * - extract(instruction, schema) → schema-inferred
1900
1894
  * - extract(instruction, schema, options)
1901
1895
  */
1902
- extract(): Promise<z.infer<typeof pageTextSchema>>;
1903
- extract(options: ExtractOptions): Promise<z.infer<typeof pageTextSchema>>;
1904
- extract(instruction: string, options?: ExtractOptions): Promise<z.infer<typeof defaultExtractSchema>>;
1905
- extract<T extends ZodTypeAny>(instruction: string, schema: T, options?: ExtractOptions): Promise<z.infer<T>>;
1896
+ extract(): Promise<z$1.infer<typeof pageTextSchema>>;
1897
+ extract(options: ExtractOptions): Promise<z$1.infer<typeof pageTextSchema>>;
1898
+ extract(instruction: string, options?: ExtractOptions): Promise<z$1.infer<typeof defaultExtractSchema>>;
1899
+ extract<T extends ZodTypeAny>(instruction: string, schema: T, options?: ExtractOptions): Promise<z$1.infer<T>>;
1906
1900
  /**
1907
1901
  * Run an "observe" instruction through the ObserveHandler.
1908
1902
  */
@@ -1974,14 +1968,14 @@ declare class AgentProvider {
1974
1968
  static getAgentProvider(modelName: string): AgentProviderType;
1975
1969
  }
1976
1970
 
1977
- declare function validateZodSchema(schema: z.ZodTypeAny, data: unknown): boolean;
1971
+ declare function validateZodSchema(schema: z$1.ZodTypeAny, data: unknown): boolean;
1978
1972
  /**
1979
1973
  * Detects if the code is running in the Bun runtime environment.
1980
1974
  * @returns {boolean} True if running in Bun, false otherwise.
1981
1975
  */
1982
1976
  declare function isRunningInBun(): boolean;
1983
- declare function toGeminiSchema(zodSchema: z.ZodTypeAny): Schema;
1984
- declare function getZodType(schema: z.ZodTypeAny): string;
1977
+ declare function toGeminiSchema(zodSchema: z$1.ZodTypeAny): Schema;
1978
+ declare function getZodType(schema: z$1.ZodTypeAny): string;
1985
1979
  /**
1986
1980
  * Recursively traverses a given Zod schema, scanning for any fields of type `z.string().url()`.
1987
1981
  * For each such field, it replaces the `z.string().url()` with `z.number()`.
@@ -1995,7 +1989,7 @@ declare function getZodType(schema: z.ZodTypeAny): string;
1995
1989
  * 1. The updated Zod schema, with any `.url()` fields replaced by `z.number()`.
1996
1990
  * 2. An array of {@link ZodPathSegments} objects representing each replaced field, including the path segments.
1997
1991
  */
1998
- declare function transformSchema(schema: z.ZodTypeAny, currentPath: Array<string | number>): [z.ZodTypeAny, ZodPathSegments[]];
1992
+ declare function transformSchema(schema: z$1.ZodTypeAny, currentPath: Array<string | number>): [z$1.ZodTypeAny, ZodPathSegments[]];
1999
1993
  /**
2000
1994
  * Once we get the final extracted object that has numeric IDs in place of URLs,
2001
1995
  * use `injectUrls` to walk the object and replace numeric IDs
@@ -2064,4 +2058,4 @@ declare class V3Evaluator {
2064
2058
  private _evaluateWithMultipleScreenshots;
2065
2059
  }
2066
2060
 
2067
- export { type AISDKCustomProvider, type AISDKProvider, AISdkClient, AVAILABLE_CUA_MODELS, type ActOptions, type ActResult, type Action, type ActionExecutionResult, type AgentAction, type AgentConfig, type AgentExecuteOptions, type AgentExecutionOptions, type AgentHandlerOptions, type AgentInstance, type AgentModelConfig, AgentProvider, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentType, AnnotatedScreenshotText, type AnthropicContentBlock, type AnthropicJsonSchemaObject, type AnthropicMessage, type AnthropicTextBlock, type AnthropicToolResult, type AnyPage, type AvailableCuaModel, type AvailableModel, BrowserbaseSessionNotFoundError, CaptchaTimeoutError, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ComputerCallItem, type ConsoleListener, ConsoleMessage, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaProperty, LLMClient, type LLMParsedResponse, type LLMResponse, LLMResponseError, type LLMTool, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type ObserveOptions, Page, Response$1 as Response, type ResponseInputItem, type ResponseItem, V3 as Stagehand, StagehandAPIError, StagehandAPIUnauthorizedError, StagehandClickError, StagehandDefaultError, StagehandDomProcessError, StagehandElementNotFoundError, StagehandEnvironmentError, StagehandError, StagehandEvalError, StagehandHttpError, StagehandIframeError, StagehandInitError, StagehandInvalidArgumentError, type StagehandMetrics, StagehandMissingArgumentError, StagehandNotInitializedError, StagehandResponseBodyError, StagehandResponseParseError, StagehandServerError, StagehandShadowRootMissingError, StagehandShadowSegmentEmptyError, StagehandShadowSegmentNotFoundError, type ToolUseItem, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, jsonSchemaToZod, loadApiKeyFromEnv, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, transformSchema, trimTrailingTextNode, validateZodSchema };
2061
+ export { type AISDKCustomProvider, type AISDKProvider, AISdkClient, AVAILABLE_CUA_MODELS, type ActOptions, type ActResult, type Action, type ActionExecutionResult, type AgentAction, type AgentConfig, type AgentExecuteOptions, type AgentExecutionOptions, type AgentHandlerOptions, type AgentInstance, type AgentModelConfig, AgentProvider, type AgentProviderType, type AgentResult, AgentScreenshotProviderError, type AgentType, AnnotatedScreenshotText, type AnthropicContentBlock, type AnthropicJsonSchemaObject, type AnthropicMessage, type AnthropicTextBlock, type AnthropicToolResult, type AnyPage, type AvailableCuaModel, type AvailableModel, BrowserbaseSessionNotFoundError, CaptchaTimeoutError, type ChatCompletionOptions, type ChatMessage, type ChatMessageContent, type ChatMessageImageContent, type ChatMessageTextContent, type ClientOptions, type ComputerCallItem, type ConsoleListener, ConsoleMessage, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaProperty, LLMClient, type LLMResponse, LLMResponseError, type LLMTool, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type ObserveOptions, Page, Response$1 as Response, type ResponseInputItem, type ResponseItem, V3 as Stagehand, StagehandAPIError, StagehandAPIUnauthorizedError, StagehandClickError, StagehandDefaultError, StagehandDomProcessError, StagehandElementNotFoundError, StagehandEnvironmentError, StagehandError, StagehandEvalError, StagehandHttpError, StagehandIframeError, StagehandInitError, StagehandInvalidArgumentError, type StagehandMetrics, StagehandMissingArgumentError, StagehandNotInitializedError, StagehandResponseBodyError, StagehandResponseParseError, StagehandServerError, StagehandShadowRootMissingError, StagehandShadowSegmentEmptyError, StagehandShadowSegmentNotFoundError, type ToolUseItem, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, jsonSchemaToZod, loadApiKeyFromEnv, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, transformSchema, trimTrailingTextNode, validateZodSchema };