@browserbasehq/orca 3.0.3-zod → 3.0.3-zod-1

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 (2) hide show
  1. package/dist/index.js +5 -87
  2. package/package.json +3 -2
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.3-zod";
88
+ STAGEHAND_VERSION = "3.0.3-zod-1";
89
89
  }
90
90
  });
91
91
 
@@ -7965,94 +7965,12 @@ var import_v3 = __toESM(require("zod/v3"));
7965
7965
 
7966
7966
  // lib/v3/zodCompat.ts
7967
7967
  var import_zod = require("zod");
7968
+ var import_zod_to_json_schema = __toESM(require("zod-to-json-schema"));
7968
7969
  var isZod4Schema = (schema) => typeof schema._zod !== "undefined";
7969
7970
  var isZod3Schema = (schema) => !isZod4Schema(schema);
7970
- function ZodToJsonSchema(schema) {
7971
- const _def = schema._def;
7972
- if (!_def) {
7973
- return { type: "null" };
7974
- }
7975
- const typeName = _def.typeName;
7976
- switch (typeName) {
7977
- case "ZodObject": {
7978
- const shape = typeof _def.shape === "function" ? _def.shape() : _def.shape;
7979
- const properties = {};
7980
- const required = [];
7981
- for (const [key, value] of Object.entries(
7982
- shape
7983
- )) {
7984
- properties[key] = ZodToJsonSchema(value);
7985
- const valueDef = value._def;
7986
- if ((valueDef == null ? void 0 : valueDef.typeName) !== "ZodOptional") {
7987
- required.push(key);
7988
- }
7989
- }
7990
- return {
7991
- type: "object",
7992
- properties,
7993
- required,
7994
- additionalProperties: _def.unknownKeys === "passthrough"
7995
- };
7996
- }
7997
- case "ZodArray": {
7998
- const itemType = _def.type;
7999
- return {
8000
- type: "array",
8001
- items: ZodToJsonSchema(itemType)
8002
- };
8003
- }
8004
- case "ZodString": {
8005
- const result = { type: "string" };
8006
- const checks = _def.checks;
8007
- if (checks) {
8008
- for (const check of checks) {
8009
- if (check.kind === "url") {
8010
- result.format = "url";
8011
- break;
8012
- }
8013
- }
8014
- }
8015
- return result;
8016
- }
8017
- case "ZodNumber":
8018
- return { type: "number" };
8019
- case "ZodBoolean":
8020
- return { type: "boolean" };
8021
- case "ZodOptional":
8022
- return ZodToJsonSchema(_def.innerType);
8023
- case "ZodNullable": {
8024
- const innerSchema = ZodToJsonSchema(_def.innerType);
8025
- return __spreadProps(__spreadValues({}, innerSchema), {
8026
- nullable: true
8027
- });
8028
- }
8029
- case "ZodEnum":
8030
- return {
8031
- type: "string",
8032
- enum: _def.values
8033
- };
8034
- case "ZodLiteral":
8035
- return {
8036
- type: typeof _def.value,
8037
- const: _def.value
8038
- };
8039
- case "ZodUnion":
8040
- return {
8041
- anyOf: _def.options.map(
8042
- (opt) => ZodToJsonSchema(opt)
8043
- )
8044
- };
8045
- default:
8046
- console.warn(`Unknown Zod type: ${typeName}`);
8047
- return { type: "null" };
8048
- }
8049
- }
8050
7971
  function toJsonSchema(schema) {
8051
7972
  if (!isZod4Schema(schema)) {
8052
- const result = __spreadValues({
8053
- $schema: "http://json-schema.org/draft-07/schema#"
8054
- }, ZodToJsonSchema(schema));
8055
- return result;
7973
+ return (0, import_zod_to_json_schema.default)(schema);
8056
7974
  }
8057
7975
  const zodWithJsonSchema = import_zod.z;
8058
7976
  if (zodWithJsonSchema.toJSONSchema) {
@@ -19764,7 +19682,7 @@ var getRefs = (options) => {
19764
19682
  )
19765
19683
  });
19766
19684
  };
19767
- var zodToJsonSchema = (schema, options) => {
19685
+ var zodToJsonSchema2 = (schema, options) => {
19768
19686
  var _a;
19769
19687
  const refs = getRefs(options);
19770
19688
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
@@ -19809,7 +19727,7 @@ var zodToJsonSchema = (schema, options) => {
19809
19727
  combined.$schema = "http://json-schema.org/draft-07/schema#";
19810
19728
  return combined;
19811
19729
  };
19812
- var zod_to_json_schema_default = zodToJsonSchema;
19730
+ var zod_to_json_schema_default = zodToJsonSchema2;
19813
19731
  function zod3Schema(zodSchema2, options) {
19814
19732
  var _a;
19815
19733
  const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/orca",
3
- "version": "3.0.3-zod",
3
+ "version": "3.0.3-zod-1",
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",
@@ -40,7 +40,8 @@
40
40
  "pino": "^9.6.0",
41
41
  "pino-pretty": "^13.0.0",
42
42
  "playwright": "^1.52.0",
43
- "ws": "^8.18.0"
43
+ "ws": "^8.18.0",
44
+ "zod-to-json-schema": "^3.25.0"
44
45
  },
45
46
  "optionalDependencies": {
46
47
  "@ai-sdk/anthropic": "^2.0.34",