@browserbasehq/orca 3.0.2-zod34 → 3.0.2-zod345

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { ZodTypeAny, z, ZodError } from 'zod';
1
+ import { ZodTypeAny, z, ZodObject, ZodRawShape, ZodError } from 'zod';
2
2
  import * as z3 from 'zod/v3';
3
+ import { zodToJsonSchema } from 'zod-to-json-schema';
3
4
  import { ClientOptions as ClientOptions$2 } from '@anthropic-ai/sdk';
4
5
  import { LanguageModelV2 } from '@ai-sdk/provider';
5
6
  import { ClientOptions as ClientOptions$1 } from 'openai';
@@ -19,7 +20,14 @@ import { ToolSet as ToolSet$1 } from 'ai/dist';
19
20
  import { Schema } from '@google/genai';
20
21
 
21
22
  type StagehandZodSchema = ZodTypeAny | z3.ZodTypeAny;
23
+ type StagehandZodObject = ZodObject<ZodRawShape> | z3.ZodObject<z3.ZodRawShape>;
22
24
  type InferStagehandSchema<T extends StagehandZodSchema> = T extends z3.ZodTypeAny ? z3.infer<T> : T extends ZodTypeAny ? z.infer<T> : never;
25
+ declare const isZod4Schema: (schema: StagehandZodSchema) => schema is ZodTypeAny & {
26
+ _zod: unknown;
27
+ };
28
+ declare const isZod3Schema: (schema: StagehandZodSchema) => schema is z3.ZodTypeAny;
29
+ type JsonSchemaDocument = Record<string, unknown>;
30
+ declare function toJsonSchema(schema: StagehandZodSchema, options?: Parameters<typeof zodToJsonSchema>[1]): JsonSchemaDocument;
23
31
 
24
32
  type AnthropicJsonSchemaObject = {
25
33
  definitions?: {
@@ -2136,4 +2144,4 @@ declare class V3Evaluator {
2136
2144
  private _evaluateWithMultipleScreenshots;
2137
2145
  }
2138
2146
 
2139
- 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, ConnectionTimeoutError, type ConsoleListener, ConsoleMessage, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, CuaModelRequiredError, ElementNotVisibleError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaProperty, LLMClient, type LLMParsedResponse, type LLMResponse, LLMResponseError, type LLMTool, type LLMUsage, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type ObserveOptions, Page, PageNotFoundError, Response$1 as Response, ResponseBodyError, type ResponseInputItem, type ResponseItem, ResponseParseError, 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, TimeoutError, 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 };
2147
+ 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, ConnectionTimeoutError, type ConsoleListener, ConsoleMessage, ContentFrameNotFoundError, type CreateChatCompletionOptions, CreateChatCompletionResponseError, CuaModelRequiredError, ElementNotVisibleError, ExperimentalApiConflictError, ExperimentalNotConfiguredError, type ExtractOptions, type ExtractResult, type FunctionCallItem, HandlerNotInitializedError, type HistoryEntry, type InferStagehandSchema, InvalidAISDKModelFormatError, type JsonSchema, type JsonSchemaDocument, type JsonSchemaProperty, LLMClient, type LLMParsedResponse, type LLMResponse, LLMResponseError, type LLMTool, type LLMUsage, LOG_LEVEL_NAMES, type LoadState, type LocalBrowserLaunchOptions, type LogLevel, type LogLine, type Logger, MCPConnectionError, MissingEnvironmentVariableError, MissingLLMConfigurationError, type ModelConfiguration, type ModelProvider, type ObserveOptions, Page, PageNotFoundError, Response$1 as Response, ResponseBodyError, type ResponseInputItem, type ResponseItem, ResponseParseError, 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 StagehandZodObject, type StagehandZodSchema, TimeoutError, type ToolUseItem, UnsupportedAISDKModelProviderError, UnsupportedModelError, UnsupportedModelProviderError, V3, type V3Env, V3Evaluator, V3FunctionName, type V3Options, XPathResolutionError, ZodSchemaValidationError, connectToMCPServer, defaultExtractSchema, getZodType, injectUrls, isRunningInBun, isZod3Schema, isZod4Schema, jsonSchemaToZod, loadApiKeyFromEnv, modelToAgentProviderMap, pageTextSchema, providerEnvVarMap, toGeminiSchema, toJsonSchema, transformSchema, trimTrailingTextNode, validateZodSchema };
package/dist/index.js CHANGED
@@ -85,7 +85,7 @@ var __async = (__this, __arguments, generator) => {
85
85
  var STAGEHAND_VERSION;
86
86
  var init_version = __esm({
87
87
  "lib/version.ts"() {
88
- STAGEHAND_VERSION = "3.0.2-zod34";
88
+ STAGEHAND_VERSION = "3.0.2-zod345";
89
89
  }
90
90
  });
91
91
 
@@ -7935,12 +7935,15 @@ __export(v3_exports, {
7935
7935
  getZodType: () => getZodType,
7936
7936
  injectUrls: () => injectUrls,
7937
7937
  isRunningInBun: () => isRunningInBun,
7938
+ isZod3Schema: () => isZod3Schema,
7939
+ isZod4Schema: () => isZod4Schema,
7938
7940
  jsonSchemaToZod: () => jsonSchemaToZod,
7939
7941
  loadApiKeyFromEnv: () => loadApiKeyFromEnv,
7940
7942
  modelToAgentProviderMap: () => modelToAgentProviderMap,
7941
7943
  pageTextSchema: () => pageTextSchema,
7942
7944
  providerEnvVarMap: () => providerEnvVarMap,
7943
7945
  toGeminiSchema: () => toGeminiSchema,
7946
+ toJsonSchema: () => toJsonSchema,
7944
7947
  transformSchema: () => transformSchema,
7945
7948
  trimTrailingTextNode: () => trimTrailingTextNode,
7946
7949
  validateZodSchema: () => validateZodSchema
@@ -7964,6 +7967,7 @@ var import_v3 = __toESM(require("zod/v3"));
7964
7967
  var import_zod = require("zod");
7965
7968
  var import_zod_to_json_schema = require("zod-to-json-schema");
7966
7969
  var isZod4Schema = (schema) => typeof schema._zod !== "undefined";
7970
+ var isZod3Schema = (schema) => !isZod4Schema(schema);
7967
7971
  function toJsonSchema(schema, options) {
7968
7972
  if (isZod4Schema(schema) && typeof import_zod.z.toJSONSchema === "function" && !options) {
7969
7973
  return import_zod.z.toJSONSchema(schema);
@@ -11320,6 +11324,11 @@ var ExtractHandler = class {
11320
11324
  logger: v3Logger,
11321
11325
  logInferenceToFile: this.logInferenceToFile
11322
11326
  });
11327
+ console.log("transformedSchema", transformedSchema);
11328
+ console.log(
11329
+ "transformedSchema",
11330
+ JSON.stringify(transformedSchema, null, 2)
11331
+ );
11323
11332
  const _c = extractionResponse, {
11324
11333
  metadata: { completed },
11325
11334
  prompt_tokens,
@@ -40252,6 +40261,7 @@ var StagehandAPIClient = class {
40252
40261
  frameId
40253
40262
  }) {
40254
40263
  const jsonSchema2 = zodSchema2 ? toJsonSchema(zodSchema2) : void 0;
40264
+ console.log("jsonSchema", JSON.stringify(jsonSchema2, null, 2));
40255
40265
  const args = {
40256
40266
  schema: jsonSchema2,
40257
40267
  instruction,
@@ -42089,12 +42099,15 @@ I'm providing ${screenshots.length} screenshots showing the progression of the t
42089
42099
  getZodType,
42090
42100
  injectUrls,
42091
42101
  isRunningInBun,
42102
+ isZod3Schema,
42103
+ isZod4Schema,
42092
42104
  jsonSchemaToZod,
42093
42105
  loadApiKeyFromEnv,
42094
42106
  modelToAgentProviderMap,
42095
42107
  pageTextSchema,
42096
42108
  providerEnvVarMap,
42097
42109
  toGeminiSchema,
42110
+ toJsonSchema,
42098
42111
  transformSchema,
42099
42112
  trimTrailingTextNode,
42100
42113
  validateZodSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/orca",
3
- "version": "3.0.2-zod34",
3
+ "version": "3.0.2-zod345",
4
4
  "description": "An AI web browsing framework focused on simplicity and extensibility.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",