@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.js CHANGED
@@ -7443,7 +7443,7 @@ var import_path5 = __toESM(require("path"));
7443
7443
  var import_process2 = __toESM(require("process"));
7444
7444
 
7445
7445
  // lib/version.ts
7446
- var STAGEHAND_VERSION = "3.0.1-zod4";
7446
+ var STAGEHAND_VERSION = "3.0.2-test-cua-base-url";
7447
7447
 
7448
7448
  // lib/v3/types/public/sdkErrors.ts
7449
7449
  var StagehandError = class extends Error {
@@ -7668,7 +7668,7 @@ var StagehandShadowSegmentNotFoundError = class extends StagehandError {
7668
7668
 
7669
7669
  // lib/utils.ts
7670
7670
  var import_genai = require("@google/genai");
7671
- var import_zod = require("zod");
7671
+ var import_v3 = require("zod/v3");
7672
7672
  var ID_PATTERN = /^\d+-\d+$/;
7673
7673
  function validateZodSchema(schema, data) {
7674
7674
  const result = schema.safeParse(data);
@@ -7692,28 +7692,28 @@ function decorateGeminiSchema(geminiSchema, zodSchema2) {
7692
7692
  function toGeminiSchema(zodSchema2) {
7693
7693
  const zodType = getZodType(zodSchema2);
7694
7694
  switch (zodType) {
7695
- case "array": {
7696
- const arraySchema = zodSchema2;
7697
- const element = arraySchema._zod.def.element;
7695
+ case "ZodArray": {
7698
7696
  return decorateGeminiSchema(
7699
7697
  {
7700
7698
  type: import_genai.Type.ARRAY,
7701
- items: toGeminiSchema(element != null ? element : import_zod.z.any())
7699
+ items: toGeminiSchema(
7700
+ zodSchema2.element
7701
+ )
7702
7702
  },
7703
7703
  zodSchema2
7704
7704
  );
7705
7705
  }
7706
- case "object": {
7706
+ case "ZodObject": {
7707
7707
  const properties = {};
7708
7708
  const required = [];
7709
- const objectSchema = zodSchema2;
7710
- const shape = objectSchema._zod.def.shape;
7711
- Object.entries(shape).forEach(([key, value]) => {
7712
- properties[key] = toGeminiSchema(value);
7713
- if (getZodType(value) !== "optional") {
7714
- required.push(key);
7709
+ Object.entries(zodSchema2.shape).forEach(
7710
+ ([key, value]) => {
7711
+ properties[key] = toGeminiSchema(value);
7712
+ if (getZodType(value) !== "ZodOptional") {
7713
+ required.push(key);
7714
+ }
7715
7715
  }
7716
- });
7716
+ );
7717
7717
  return decorateGeminiSchema(
7718
7718
  {
7719
7719
  type: import_genai.Type.OBJECT,
@@ -7723,45 +7723,39 @@ function toGeminiSchema(zodSchema2) {
7723
7723
  zodSchema2
7724
7724
  );
7725
7725
  }
7726
- case "string":
7727
- case "url":
7726
+ case "ZodString":
7728
7727
  return decorateGeminiSchema(
7729
7728
  {
7730
7729
  type: import_genai.Type.STRING
7731
7730
  },
7732
7731
  zodSchema2
7733
7732
  );
7734
- case "number":
7733
+ case "ZodNumber":
7735
7734
  return decorateGeminiSchema(
7736
7735
  {
7737
7736
  type: import_genai.Type.NUMBER
7738
7737
  },
7739
7738
  zodSchema2
7740
7739
  );
7741
- case "boolean":
7740
+ case "ZodBoolean":
7742
7741
  return decorateGeminiSchema(
7743
7742
  {
7744
7743
  type: import_genai.Type.BOOLEAN
7745
7744
  },
7746
7745
  zodSchema2
7747
7746
  );
7748
- case "enum": {
7749
- const enumSchema = zodSchema2;
7750
- const values = Object.values(enumSchema._zod.def.entries);
7747
+ case "ZodEnum":
7751
7748
  return decorateGeminiSchema(
7752
7749
  {
7753
7750
  type: import_genai.Type.STRING,
7754
- enum: values
7751
+ enum: zodSchema2._def.values
7755
7752
  },
7756
7753
  zodSchema2
7757
7754
  );
7758
- }
7759
- case "default":
7760
- case "nullable":
7761
- case "optional": {
7762
- const wrapperSchema = zodSchema2;
7763
- const innerType = wrapperSchema._zod.def.innerType;
7764
- const innerSchema = toGeminiSchema(innerType);
7755
+ case "ZodDefault":
7756
+ case "ZodNullable":
7757
+ case "ZodOptional": {
7758
+ const innerSchema = toGeminiSchema(zodSchema2._def.innerType);
7765
7759
  return decorateGeminiSchema(
7766
7760
  __spreadProps(__spreadValues({}, innerSchema), {
7767
7761
  nullable: true
@@ -7769,23 +7763,14 @@ function toGeminiSchema(zodSchema2) {
7769
7763
  zodSchema2
7770
7764
  );
7771
7765
  }
7772
- case "literal": {
7773
- const literalSchema = zodSchema2;
7774
- const values = literalSchema._zod.def.values;
7766
+ case "ZodLiteral":
7775
7767
  return decorateGeminiSchema(
7776
7768
  {
7777
7769
  type: import_genai.Type.STRING,
7778
- enum: values
7770
+ enum: [zodSchema2._def.value]
7779
7771
  },
7780
7772
  zodSchema2
7781
7773
  );
7782
- }
7783
- case "pipe": {
7784
- const pipeSchema = zodSchema2;
7785
- const inSchema = pipeSchema._zod.def.in;
7786
- return toGeminiSchema(inSchema);
7787
- }
7788
- // Standalone transforms and any unknown types fall through to default
7789
7774
  default:
7790
7775
  return decorateGeminiSchema(
7791
7776
  {
@@ -7797,40 +7782,21 @@ function toGeminiSchema(zodSchema2) {
7797
7782
  }
7798
7783
  }
7799
7784
  function getZodType(schema) {
7800
- var _a, _b;
7801
- const schemaWithDef = schema;
7802
- if ((_b = (_a = schemaWithDef._zod) == null ? void 0 : _a.def) == null ? void 0 : _b.type) {
7803
- return schemaWithDef._zod.def.type;
7804
- }
7805
- throw new Error(
7806
- `Unable to determine Zod schema type. Schema: ${JSON.stringify(schema)}`
7807
- );
7785
+ return schema._def.typeName;
7808
7786
  }
7809
7787
  function transformSchema(schema, currentPath) {
7810
7788
  var _a, _b;
7811
- if (isKind(schema, "url")) {
7812
- const transformed = makeIdStringSchema(schema);
7813
- return [transformed, [{ segments: [] }]];
7814
- }
7815
- if (isKind(schema, "string")) {
7816
- const stringSchema = schema;
7817
- const checks = stringSchema._zod.def.checks;
7818
- const format = (_a = stringSchema._zod.bag) == null ? void 0 : _a.format;
7819
- const hasUrlCheck = ((_b = checks == null ? void 0 : checks.some((check) => {
7820
- var _a2, _b2;
7821
- return ((_b2 = (_a2 = check._zod) == null ? void 0 : _a2.def) == null ? void 0 : _b2.check) === "url";
7822
- })) != null ? _b : false) || format === "url";
7789
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodString)) {
7790
+ const hasUrlCheck = (_b = (_a = schema._def.checks) == null ? void 0 : _a.some(
7791
+ (check) => check.kind === "url"
7792
+ )) != null ? _b : false;
7823
7793
  if (hasUrlCheck) {
7824
7794
  return [makeIdStringSchema(schema), [{ segments: [] }]];
7825
7795
  }
7826
7796
  return [schema, []];
7827
7797
  }
7828
- if (isKind(schema, "object")) {
7829
- const objectSchema = schema;
7830
- const shape = objectSchema._zod.def.shape;
7831
- if (!shape) {
7832
- return [schema, []];
7833
- }
7798
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodObject)) {
7799
+ const shape = schema._def.shape();
7834
7800
  const newShape = {};
7835
7801
  const urlPaths = [];
7836
7802
  let changed = false;
@@ -7852,17 +7818,12 @@ function transformSchema(schema, currentPath) {
7852
7818
  }
7853
7819
  }
7854
7820
  if (changed) {
7855
- const newSchema = import_zod.z.object(newShape);
7856
- return [newSchema, urlPaths];
7821
+ return [import_v3.z.object(newShape), urlPaths];
7857
7822
  }
7858
7823
  return [schema, urlPaths];
7859
7824
  }
7860
- if (isKind(schema, "array")) {
7861
- const arraySchema = schema;
7862
- const itemType = arraySchema._zod.def.element;
7863
- if (!itemType) {
7864
- return [schema, []];
7865
- }
7825
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodArray)) {
7826
+ const itemType = schema._def.type;
7866
7827
  const [transformedItem, childPaths] = transformSchema(itemType, [
7867
7828
  ...currentPath,
7868
7829
  "*"
@@ -7872,17 +7833,12 @@ function transformSchema(schema, currentPath) {
7872
7833
  segments: ["*", ...cp.segments]
7873
7834
  }));
7874
7835
  if (changed) {
7875
- const newSchema = import_zod.z.array(transformedItem);
7876
- return [newSchema, arrayPaths];
7836
+ return [import_v3.z.array(transformedItem), arrayPaths];
7877
7837
  }
7878
7838
  return [schema, arrayPaths];
7879
7839
  }
7880
- if (isKind(schema, "union")) {
7881
- const unionSchema = schema;
7882
- const unionOptions = unionSchema._zod.def.options;
7883
- if (!unionOptions || unionOptions.length === 0) {
7884
- return [schema, []];
7885
- }
7840
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodUnion)) {
7841
+ const unionOptions = schema._def.options;
7886
7842
  const newOptions = [];
7887
7843
  let changed = false;
7888
7844
  let allPaths = [];
@@ -7899,19 +7855,15 @@ function transformSchema(schema, currentPath) {
7899
7855
  });
7900
7856
  if (changed) {
7901
7857
  return [
7902
- import_zod.z.union(newOptions),
7858
+ import_v3.z.union(newOptions),
7903
7859
  allPaths
7904
7860
  ];
7905
7861
  }
7906
7862
  return [schema, allPaths];
7907
7863
  }
7908
- if (isKind(schema, "intersection")) {
7909
- const intersectionSchema = schema;
7910
- const leftType = intersectionSchema._zod.def.left;
7911
- const rightType = intersectionSchema._zod.def.right;
7912
- if (!leftType || !rightType) {
7913
- return [schema, []];
7914
- }
7864
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodIntersection)) {
7865
+ const leftType = schema._def.left;
7866
+ const rightType = schema._def.right;
7915
7867
  const [left, leftPaths] = transformSchema(leftType, [
7916
7868
  ...currentPath,
7917
7869
  "intersection_left"
@@ -7923,50 +7875,33 @@ function transformSchema(schema, currentPath) {
7923
7875
  const changed = left !== leftType || right !== rightType;
7924
7876
  const allPaths = [...leftPaths, ...rightPaths];
7925
7877
  if (changed) {
7926
- return [import_zod.z.intersection(left, right), allPaths];
7878
+ return [import_v3.z.intersection(left, right), allPaths];
7927
7879
  }
7928
7880
  return [schema, allPaths];
7929
7881
  }
7930
- if (isKind(schema, "optional")) {
7931
- const optionalSchema = schema;
7932
- const innerType = optionalSchema._zod.def.innerType;
7933
- if (!innerType) {
7934
- return [schema, []];
7935
- }
7882
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodOptional)) {
7883
+ const innerType = schema._def.innerType;
7936
7884
  const [inner, innerPaths] = transformSchema(innerType, currentPath);
7937
7885
  if (inner !== innerType) {
7938
- return [import_zod.z.optional(inner), innerPaths];
7886
+ return [import_v3.z.optional(inner), innerPaths];
7939
7887
  }
7940
7888
  return [schema, innerPaths];
7941
7889
  }
7942
- if (isKind(schema, "nullable")) {
7943
- const nullableSchema = schema;
7944
- const innerType = nullableSchema._zod.def.innerType;
7945
- if (!innerType) {
7946
- return [schema, []];
7947
- }
7890
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodNullable)) {
7891
+ const innerType = schema._def.innerType;
7948
7892
  const [inner, innerPaths] = transformSchema(innerType, currentPath);
7949
7893
  if (inner !== innerType) {
7950
- return [import_zod.z.nullable(inner), innerPaths];
7894
+ return [import_v3.z.nullable(inner), innerPaths];
7951
7895
  }
7952
7896
  return [schema, innerPaths];
7953
7897
  }
7954
- if (isKind(schema, "pipe")) {
7955
- const pipeSchema = schema;
7956
- const inSchema = pipeSchema._zod.def.in;
7957
- const outSchema = pipeSchema._zod.def.out;
7958
- if (!inSchema || !outSchema) {
7959
- return [schema, []];
7960
- }
7961
- const [newIn, inPaths] = transformSchema(inSchema, currentPath);
7962
- const [newOut, outPaths] = transformSchema(outSchema, currentPath);
7963
- const allPaths = [...inPaths, ...outPaths];
7964
- const changed = newIn !== inSchema || newOut !== outSchema;
7965
- if (changed) {
7966
- const result = import_zod.z.pipe(newIn, newOut);
7967
- return [result, allPaths];
7898
+ if (isKind(schema, import_v3.ZodFirstPartyTypeKind.ZodEffects)) {
7899
+ const baseSchema = schema._def.schema;
7900
+ const [newBaseSchema, basePaths] = transformSchema(baseSchema, currentPath);
7901
+ if (newBaseSchema !== baseSchema) {
7902
+ return [import_v3.z.effect(newBaseSchema, schema._def.effect), basePaths];
7968
7903
  }
7969
- return [schema, allPaths];
7904
+ return [schema, basePaths];
7970
7905
  }
7971
7906
  return [schema, []];
7972
7907
  }
@@ -8012,18 +7947,17 @@ function injectUrls(obj, path6, idToUrlMapping) {
8012
7947
  }
8013
7948
  }
8014
7949
  function isKind(s, kind) {
8015
- try {
8016
- return getZodType(s) === kind;
8017
- } catch (e) {
8018
- return false;
8019
- }
7950
+ return s._def.typeName === kind;
8020
7951
  }
8021
7952
  function makeIdStringSchema(orig) {
8022
- var _a;
8023
- const userDesc = (_a = orig.description) != null ? _a : "";
7953
+ var _a, _b, _c;
7954
+ const userDesc = (
7955
+ // Zod ≥3.23 exposes .description directly; fall back to _def for older minor versions
7956
+ (_c = (_b = orig.description) != null ? _b : (_a = orig._def) == null ? void 0 : _a.description) != null ? _c : ""
7957
+ );
8024
7958
  const base = `This field must be the element-ID in the form 'frameId-backendId' (e.g. "0-432").`;
8025
7959
  const composed = userDesc.trim().length > 0 ? `${base} that follows this user-defined description: ${userDesc}` : base;
8026
- return import_zod.z.string().regex(ID_PATTERN).describe(composed);
7960
+ return import_v3.z.string().regex(ID_PATTERN).describe(composed);
8027
7961
  }
8028
7962
  var providerEnvVarMap = {
8029
7963
  openai: "OPENAI_API_KEY",
@@ -8069,7 +8003,7 @@ function jsonSchemaToZod(schema) {
8069
8003
  for (const key in schema.properties) {
8070
8004
  shape[key] = jsonSchemaToZod(schema.properties[key]);
8071
8005
  }
8072
- let zodObject = import_zod.z.object(shape);
8006
+ let zodObject = import_v3.z.object(shape);
8073
8007
  if (schema.required && Array.isArray(schema.required)) {
8074
8008
  const requiredFields = schema.required.reduce(
8075
8009
  (acc, field) => __spreadProps(__spreadValues({}, acc), { [field]: true }),
@@ -8082,30 +8016,30 @@ function jsonSchemaToZod(schema) {
8082
8016
  }
8083
8017
  return zodObject;
8084
8018
  } else {
8085
- return import_zod.z.object({});
8019
+ return import_v3.z.object({});
8086
8020
  }
8087
8021
  case "array":
8088
8022
  if (schema.items) {
8089
- let zodArray = import_zod.z.array(jsonSchemaToZod(schema.items));
8023
+ let zodArray = import_v3.z.array(jsonSchemaToZod(schema.items));
8090
8024
  if (schema.description) {
8091
8025
  zodArray = zodArray.describe(schema.description);
8092
8026
  }
8093
8027
  return zodArray;
8094
8028
  } else {
8095
- return import_zod.z.array(import_zod.z.any());
8029
+ return import_v3.z.array(import_v3.z.any());
8096
8030
  }
8097
8031
  case "string": {
8098
8032
  if (schema.enum) {
8099
- return import_zod.z.string().refine((val) => schema.enum.includes(val));
8033
+ return import_v3.z.string().refine((val) => schema.enum.includes(val));
8100
8034
  }
8101
- let zodString = import_zod.z.string();
8035
+ let zodString = import_v3.z.string();
8102
8036
  if (schema.description) {
8103
8037
  zodString = zodString.describe(schema.description);
8104
8038
  }
8105
8039
  return zodString;
8106
8040
  }
8107
8041
  case "number": {
8108
- let zodNumber = import_zod.z.number();
8042
+ let zodNumber = import_v3.z.number();
8109
8043
  if (schema.minimum !== void 0) {
8110
8044
  zodNumber = zodNumber.min(schema.minimum);
8111
8045
  }
@@ -8118,14 +8052,14 @@ function jsonSchemaToZod(schema) {
8118
8052
  return zodNumber;
8119
8053
  }
8120
8054
  case "boolean": {
8121
- let zodBoolean = import_zod.z.boolean();
8055
+ let zodBoolean = import_v3.z.boolean();
8122
8056
  if (schema.description) {
8123
8057
  zodBoolean = zodBoolean.describe(schema.description);
8124
8058
  }
8125
8059
  return zodBoolean;
8126
8060
  }
8127
8061
  default:
8128
- return import_zod.z.any();
8062
+ return import_v3.z.any();
8129
8063
  }
8130
8064
  }
8131
8065
 
@@ -9124,7 +9058,7 @@ var CacheStorage = class _CacheStorage {
9124
9058
  };
9125
9059
 
9126
9060
  // lib/inference.ts
9127
- var import_zod2 = require("zod");
9061
+ var import_v32 = require("zod/v3");
9128
9062
 
9129
9063
  // lib/prompt.ts
9130
9064
  function buildUserInstructionsString(userProvidedInstructions) {
@@ -9383,11 +9317,11 @@ function extract(_0) {
9383
9317
  logInferenceToFile = false
9384
9318
  }) {
9385
9319
  var _a, _b, _c, _d, _e, _f, _g, _h;
9386
- const metadataSchema = import_zod2.z.object({
9387
- progress: import_zod2.z.string().describe(
9320
+ const metadataSchema = import_v32.z.object({
9321
+ progress: import_v32.z.string().describe(
9388
9322
  "progress of what has been extracted so far, as concise as possible"
9389
9323
  ),
9390
- completed: import_zod2.z.boolean().describe(
9324
+ completed: import_v32.z.boolean().describe(
9391
9325
  "true if the goal is now accomplished. Use this conservatively, only when sure that the goal has been completed."
9392
9326
  )
9393
9327
  });
@@ -9537,20 +9471,20 @@ function observe(_0) {
9537
9471
  }) {
9538
9472
  var _a, _b, _c, _d;
9539
9473
  const isGPT5 = llmClient.modelName.includes("gpt-5");
9540
- const observeSchema = import_zod2.z.object({
9541
- elements: import_zod2.z.array(
9542
- import_zod2.z.object({
9543
- elementId: import_zod2.z.string().describe(
9474
+ const observeSchema = import_v32.z.object({
9475
+ elements: import_v32.z.array(
9476
+ import_v32.z.object({
9477
+ elementId: import_v32.z.string().describe(
9544
9478
  "the ID string associated with the element. Never include surrounding square brackets. This field must follow the format of 'number-number'."
9545
9479
  ),
9546
- description: import_zod2.z.string().describe(
9480
+ description: import_v32.z.string().describe(
9547
9481
  "a description of the accessible element and its purpose"
9548
9482
  ),
9549
- method: import_zod2.z.string().describe(
9483
+ method: import_v32.z.string().describe(
9550
9484
  "the candidate method/action to interact with the element. Select one of the available Playwright interaction methods."
9551
9485
  ),
9552
- arguments: import_zod2.z.array(
9553
- import_zod2.z.string().describe(
9486
+ arguments: import_v32.z.array(
9487
+ import_v32.z.string().describe(
9554
9488
  "the arguments to pass to the method. For example, for a click, the arguments are empty, but for a fill, the arguments are the value to fill in."
9555
9489
  )
9556
9490
  )
@@ -9644,20 +9578,20 @@ function act(_0) {
9644
9578
  }) {
9645
9579
  var _a, _b;
9646
9580
  const isGPT5 = llmClient.modelName.includes("gpt-5");
9647
- const actSchema = import_zod2.z.object({
9648
- elementId: import_zod2.z.string().describe(
9581
+ const actSchema = import_v32.z.object({
9582
+ elementId: import_v32.z.string().describe(
9649
9583
  "the ID string associated with the element. Never include surrounding square brackets. This field must follow the format of 'number-number'."
9650
9584
  ),
9651
- description: import_zod2.z.string().describe("a description of the accessible element and its purpose"),
9652
- method: import_zod2.z.string().describe(
9585
+ description: import_v32.z.string().describe("a description of the accessible element and its purpose"),
9586
+ method: import_v32.z.string().describe(
9653
9587
  "the candidate method/action to interact with the element. Select one of the available Playwright interaction methods."
9654
9588
  ),
9655
- arguments: import_zod2.z.array(
9656
- import_zod2.z.string().describe(
9589
+ arguments: import_v32.z.array(
9590
+ import_v32.z.string().describe(
9657
9591
  "the arguments to pass to the method. For example, for a click, the arguments are empty, but for a fill, the arguments are the value to fill in."
9658
9592
  )
9659
9593
  ),
9660
- twoStep: import_zod2.z.boolean()
9594
+ twoStep: import_v32.z.boolean()
9661
9595
  });
9662
9596
  const messages = [
9663
9597
  buildActSystemPrompt(userProvidedInstructions),
@@ -9738,12 +9672,12 @@ function act(_0) {
9738
9672
  init_logger();
9739
9673
 
9740
9674
  // lib/v3/types/public/methods.ts
9741
- var import_zod3 = require("zod");
9742
- var defaultExtractSchema = import_zod3.z.object({
9743
- extraction: import_zod3.z.string()
9675
+ var import_v33 = require("zod/v3");
9676
+ var defaultExtractSchema = import_v33.z.object({
9677
+ extraction: import_v33.z.string()
9744
9678
  });
9745
- var pageTextSchema = import_zod3.z.object({
9746
- pageText: import_zod3.z.string()
9679
+ var pageTextSchema = import_v33.z.object({
9680
+ pageText: import_v33.z.string()
9747
9681
  });
9748
9682
  var V3FunctionName = /* @__PURE__ */ ((V3FunctionName2) => {
9749
9683
  V3FunctionName2["ACT"] = "ACT";
@@ -9766,6 +9700,7 @@ var SupportedPlaywrightAction = /* @__PURE__ */ ((SupportedPlaywrightAction2) =>
9766
9700
  SupportedPlaywrightAction2["NEXT_CHUNK"] = "nextChunk";
9767
9701
  SupportedPlaywrightAction2["PREV_CHUNK"] = "prevChunk";
9768
9702
  SupportedPlaywrightAction2["SELECT_OPTION_FROM_DROPDOWN"] = "selectOptionFromDropdown";
9703
+ SupportedPlaywrightAction2["HOVER"] = "hover";
9769
9704
  return SupportedPlaywrightAction2;
9770
9705
  })(SupportedPlaywrightAction || {});
9771
9706
 
@@ -9876,7 +9811,8 @@ var METHOD_HANDLER_MAP = {
9876
9811
  nextChunk: scrollToNextChunk,
9877
9812
  prevChunk: scrollToPreviousChunk,
9878
9813
  selectOptionFromDropdown: selectOption,
9879
- selectOption
9814
+ selectOption,
9815
+ hover
9880
9816
  };
9881
9817
  function selectOption(ctx) {
9882
9818
  return __async(this, null, function* () {
@@ -10219,6 +10155,26 @@ function scrollByElementHeight(ctx, direction) {
10219
10155
  }
10220
10156
  });
10221
10157
  }
10158
+ function hover(ctx) {
10159
+ return __async(this, null, function* () {
10160
+ const { locator, xpath } = ctx;
10161
+ try {
10162
+ yield locator.hover();
10163
+ } catch (e) {
10164
+ v3Logger({
10165
+ category: "action",
10166
+ message: "error attempting to hover",
10167
+ level: 0,
10168
+ auxiliary: {
10169
+ error: { value: e.message, type: "string" },
10170
+ trace: { value: e.stack, type: "string" },
10171
+ xpath: { value: xpath, type: "string" }
10172
+ }
10173
+ });
10174
+ throw new UnderstudyCommandException(e.message);
10175
+ }
10176
+ });
10177
+ }
10222
10178
  function getFrameUrl(frame) {
10223
10179
  return __async(this, null, function* () {
10224
10180
  const url = yield frame.evaluate("location.href");
@@ -10726,7 +10682,7 @@ var ActHandler = class {
10726
10682
  // lib/v3/handlers/extractHandler.ts
10727
10683
  init_logger();
10728
10684
  init_snapshot();
10729
- var import_zod4 = require("zod");
10685
+ var import_v34 = require("zod/v3");
10730
10686
  function transformUrlStringsToNumericIds(schema) {
10731
10687
  const [finalSchema, urlPaths] = transformSchema(schema, []);
10732
10688
  return [finalSchema, urlPaths];
@@ -10780,7 +10736,7 @@ var ExtractHandler = class {
10780
10736
  const baseSchema = schema != null ? schema : defaultExtractSchema;
10781
10737
  const isObjectSchema = !!((_c = baseSchema._def) == null ? void 0 : _c.shape);
10782
10738
  const WRAP_KEY = "value";
10783
- const objectSchema = isObjectSchema ? baseSchema : import_zod4.z.object({ [WRAP_KEY]: baseSchema });
10739
+ const objectSchema = isObjectSchema ? baseSchema : import_v34.z.object({ [WRAP_KEY]: baseSchema });
10784
10740
  const [transformedSchema, urlFieldPaths] = transformUrlStringsToNumericIds(objectSchema);
10785
10741
  const extractionResponse = yield extract({
10786
10742
  instruction,
@@ -10967,11 +10923,11 @@ var ObserveHandler = class {
10967
10923
 
10968
10924
  // lib/v3/agent/tools/v3-goto.ts
10969
10925
  var import_ai = require("ai");
10970
- var import_zod5 = require("zod");
10926
+ var import_v35 = require("zod/v3");
10971
10927
  var createGotoTool = (v3) => (0, import_ai.tool)({
10972
10928
  description: "Navigate to a specific URL",
10973
- inputSchema: import_zod5.z.object({
10974
- url: import_zod5.z.string().describe("The URL to navigate to")
10929
+ inputSchema: import_v35.z.object({
10930
+ url: import_v35.z.string().describe("The URL to navigate to")
10975
10931
  }),
10976
10932
  execute: (_0) => __async(null, [_0], function* ({ url }) {
10977
10933
  var _a;
@@ -10999,11 +10955,11 @@ var createGotoTool = (v3) => (0, import_ai.tool)({
10999
10955
 
11000
10956
  // lib/v3/agent/tools/v3-act.ts
11001
10957
  var import_ai2 = require("ai");
11002
- var import_zod6 = require("zod");
10958
+ var import_v36 = require("zod/v3");
11003
10959
  var createActTool = (v3, executionModel) => (0, import_ai2.tool)({
11004
10960
  description: "Perform an action on the page (click, type). Provide a short, specific phrase that mentions the element type.",
11005
- inputSchema: import_zod6.z.object({
11006
- action: import_zod6.z.string().describe(
10961
+ inputSchema: import_v36.z.object({
10962
+ action: import_v36.z.string().describe(
11007
10963
  'Describe what to click or type, e.g. "click the Login button" or "type "John" into the first name input"'
11008
10964
  )
11009
10965
  }),
@@ -11044,10 +11000,10 @@ var createActTool = (v3, executionModel) => (0, import_ai2.tool)({
11044
11000
 
11045
11001
  // lib/v3/agent/tools/v3-screenshot.ts
11046
11002
  var import_ai3 = require("ai");
11047
- var import_zod7 = require("zod");
11003
+ var import_v37 = require("zod/v3");
11048
11004
  var createScreenshotTool = (v3) => (0, import_ai3.tool)({
11049
11005
  description: "Takes a screenshot (PNG) of the current page. Use this to quickly verify page state.",
11050
- inputSchema: import_zod7.z.object({}),
11006
+ inputSchema: import_v37.z.object({}),
11051
11007
  execute: () => __async(null, null, function* () {
11052
11008
  v3.logger({
11053
11009
  category: "agent",
@@ -11071,11 +11027,11 @@ var createScreenshotTool = (v3) => (0, import_ai3.tool)({
11071
11027
 
11072
11028
  // lib/v3/agent/tools/v3-wait.ts
11073
11029
  var import_ai4 = require("ai");
11074
- var import_zod8 = require("zod");
11030
+ var import_v38 = require("zod/v3");
11075
11031
  var createWaitTool = (v3) => (0, import_ai4.tool)({
11076
11032
  description: "Wait for a specified time",
11077
- inputSchema: import_zod8.z.object({
11078
- timeMs: import_zod8.z.number().describe("Time in milliseconds")
11033
+ inputSchema: import_v38.z.object({
11034
+ timeMs: import_v38.z.number().describe("Time in milliseconds")
11079
11035
  }),
11080
11036
  execute: (_0) => __async(null, [_0], function* ({ timeMs }) {
11081
11037
  v3.logger({
@@ -11099,11 +11055,11 @@ var createWaitTool = (v3) => (0, import_ai4.tool)({
11099
11055
 
11100
11056
  // lib/v3/agent/tools/v3-navback.ts
11101
11057
  var import_ai5 = require("ai");
11102
- var import_zod9 = require("zod");
11058
+ var import_v39 = require("zod/v3");
11103
11059
  var createNavBackTool = (v3) => (0, import_ai5.tool)({
11104
11060
  description: "Navigate back to the previous page",
11105
- inputSchema: import_zod9.z.object({
11106
- reasoningText: import_zod9.z.string().describe("Why you're going back")
11061
+ inputSchema: import_v39.z.object({
11062
+ reasoningText: import_v39.z.string().describe("Why you're going back")
11107
11063
  }),
11108
11064
  execute: () => __async(null, null, function* () {
11109
11065
  v3.logger({
@@ -11123,12 +11079,12 @@ var createNavBackTool = (v3) => (0, import_ai5.tool)({
11123
11079
 
11124
11080
  // lib/v3/agent/tools/v3-close.ts
11125
11081
  var import_ai6 = require("ai");
11126
- var import_zod10 = require("zod");
11082
+ var import_v310 = require("zod/v3");
11127
11083
  var createCloseTool = () => (0, import_ai6.tool)({
11128
11084
  description: "Complete the task and close",
11129
- inputSchema: import_zod10.z.object({
11130
- reasoning: import_zod10.z.string().describe("Summary of what was accomplished"),
11131
- taskComplete: import_zod10.z.boolean().describe("Whether the task was completed successfully")
11085
+ inputSchema: import_v310.z.object({
11086
+ reasoning: import_v310.z.string().describe("Summary of what was accomplished"),
11087
+ taskComplete: import_v310.z.boolean().describe("Whether the task was completed successfully")
11132
11088
  }),
11133
11089
  execute: (_0) => __async(null, [_0], function* ({ reasoning, taskComplete }) {
11134
11090
  return { success: true, reasoning, taskComplete };
@@ -11137,10 +11093,10 @@ var createCloseTool = () => (0, import_ai6.tool)({
11137
11093
 
11138
11094
  // lib/v3/agent/tools/v3-ariaTree.ts
11139
11095
  var import_ai7 = require("ai");
11140
- var import_zod11 = require("zod");
11096
+ var import_v311 = require("zod/v3");
11141
11097
  var createAriaTreeTool = (v3) => (0, import_ai7.tool)({
11142
11098
  description: "gets the accessibility (ARIA) hybrid tree text for the current page. use this to understand structure and content.",
11143
- inputSchema: import_zod11.z.object({}),
11099
+ inputSchema: import_v311.z.object({}),
11144
11100
  execute: () => __async(null, null, function* () {
11145
11101
  v3.logger({
11146
11102
  category: "agent",
@@ -11168,17 +11124,17 @@ ${result.content}` }]
11168
11124
 
11169
11125
  // lib/v3/agent/tools/v3-fillform.ts
11170
11126
  var import_ai8 = require("ai");
11171
- var import_zod12 = require("zod");
11127
+ var import_v312 = require("zod/v3");
11172
11128
  var createFillFormTool = (v3, executionModel) => (0, import_ai8.tool)({
11173
11129
  description: `\u{1F4DD} FORM FILL - MULTI-FIELD INPUT TOOL
11174
11130
  For any form with 2+ inputs/textareas. Faster than individual typing.`,
11175
- inputSchema: import_zod12.z.object({
11176
- fields: import_zod12.z.array(
11177
- import_zod12.z.object({
11178
- action: import_zod12.z.string().describe(
11131
+ inputSchema: import_v312.z.object({
11132
+ fields: import_v312.z.array(
11133
+ import_v312.z.object({
11134
+ action: import_v312.z.string().describe(
11179
11135
  'Description of typing action, e.g. "type foo into the email field"'
11180
11136
  ),
11181
- value: import_zod12.z.string().describe("Text to type into the target")
11137
+ value: import_v312.z.string().describe("Text to type into the target")
11182
11138
  })
11183
11139
  ).min(1, "Provide at least one field to fill")
11184
11140
  }),
@@ -11222,12 +11178,12 @@ For any form with 2+ inputs/textareas. Faster than individual typing.`,
11222
11178
 
11223
11179
  // lib/v3/agent/tools/v3-scroll.ts
11224
11180
  var import_ai9 = require("ai");
11225
- var import_zod13 = require("zod");
11181
+ var import_v313 = require("zod/v3");
11226
11182
  var createScrollTool = (v3) => (0, import_ai9.tool)({
11227
11183
  description: "Scroll the page",
11228
- inputSchema: import_zod13.z.object({
11229
- pixels: import_zod13.z.number().describe("Number of pixels to scroll up or down"),
11230
- direction: import_zod13.z.enum(["up", "down"]).describe("Direction to scroll")
11184
+ inputSchema: import_v313.z.object({
11185
+ pixels: import_v313.z.number().describe("Number of pixels to scroll up or down"),
11186
+ direction: import_v313.z.enum(["up", "down"]).describe("Direction to scroll")
11231
11187
  }),
11232
11188
  execute: (_0) => __async(null, [_0], function* ({ pixels, direction }) {
11233
11189
  v3.logger({
@@ -11259,19 +11215,19 @@ var createScrollTool = (v3) => (0, import_ai9.tool)({
11259
11215
 
11260
11216
  // lib/v3/agent/tools/v3-extract.ts
11261
11217
  var import_ai10 = require("ai");
11262
- var import_zod14 = require("zod");
11218
+ var import_v314 = require("zod/v3");
11263
11219
  function evaluateZodSchema(schemaStr, logger) {
11264
11220
  var _a;
11265
11221
  try {
11266
11222
  const fn = new Function("z", `return ${schemaStr}`);
11267
- return fn(import_zod14.z);
11223
+ return fn(import_v314.z);
11268
11224
  } catch (e) {
11269
11225
  logger == null ? void 0 : logger({
11270
11226
  category: "agent",
11271
11227
  message: `Failed to evaluate schema: ${(_a = e == null ? void 0 : e.message) != null ? _a : String(e)}`,
11272
11228
  level: 0
11273
11229
  });
11274
- return import_zod14.z.any();
11230
+ return import_v314.z.any();
11275
11231
  }
11276
11232
  }
11277
11233
  var createExtractTool = (v3, executionModel, logger) => (0, import_ai10.tool)({
@@ -11293,9 +11249,9 @@ var createExtractTool = (v3, executionModel, logger) => (0, import_ai10.tool)({
11293
11249
  3. Extract arrays:
11294
11250
  instruction: "extract all product names and prices"
11295
11251
  schema: "z.object({ products: z.array(z.object({ name: z.string(), price: z.number() })) })"`,
11296
- inputSchema: import_zod14.z.object({
11297
- instruction: import_zod14.z.string(),
11298
- schema: import_zod14.z.string().optional().describe("Zod schema as code, e.g. z.object({ title: z.string() })")
11252
+ inputSchema: import_v314.z.object({
11253
+ instruction: import_v314.z.string(),
11254
+ schema: import_v314.z.string().optional().describe("Zod schema as code, e.g. z.object({ title: z.string() })")
11299
11255
  }),
11300
11256
  execute: (_0) => __async(null, [_0], function* ({ instruction, schema }) {
11301
11257
  var _a;
@@ -11700,7 +11656,7 @@ init_snapshot();
11700
11656
 
11701
11657
  // lib/v3/agent/AnthropicCUAClient.ts
11702
11658
  var import_sdk = __toESM(require("@anthropic-ai/sdk"));
11703
- var import_zod15 = require("zod");
11659
+ var import_zod_to_json_schema = require("zod-to-json-schema");
11704
11660
 
11705
11661
  // lib/v3/agent/AgentClient.ts
11706
11662
  var AgentClient = class {
@@ -12203,7 +12159,7 @@ var AnthropicCUAClient = class extends AgentClient {
12203
12159
  };
12204
12160
  if (this.tools && Object.keys(this.tools).length > 0) {
12205
12161
  const customTools = Object.entries(this.tools).map(([name, tool12]) => {
12206
- const jsonSchema2 = import_zod15.z.toJSONSchema(tool12.inputSchema);
12162
+ const jsonSchema2 = (0, import_zod_to_json_schema.zodToJsonSchema)(tool12.inputSchema);
12207
12163
  const inputSchema = {
12208
12164
  type: "object",
12209
12165
  properties: jsonSchema2.properties || {},
@@ -13067,7 +13023,7 @@ var import_genai3 = require("@google/genai");
13067
13023
 
13068
13024
  // lib/v3/agent/utils/googleCustomToolHandler.ts
13069
13025
  var import_genai2 = require("@google/genai");
13070
- var import_zod16 = require("zod");
13026
+ var import_zod_to_json_schema2 = require("zod-to-json-schema");
13071
13027
  function executeGoogleCustomTool(toolName, toolArgs, tools, functionCall, logger) {
13072
13028
  return __async(this, null, function* () {
13073
13029
  try {
@@ -13135,7 +13091,7 @@ function convertToolSetToFunctionDeclarations(tools) {
13135
13091
  }
13136
13092
  function convertToolToFunctionDeclaration(name, tool12) {
13137
13093
  try {
13138
- const jsonSchema2 = import_zod16.z.toJSONSchema(tool12.inputSchema);
13094
+ const jsonSchema2 = (0, import_zod_to_json_schema2.zodToJsonSchema)(tool12.inputSchema);
13139
13095
  const parameters = convertJsonSchemaToGoogleParameters(jsonSchema2);
13140
13096
  return {
13141
13097
  name,
@@ -13192,9 +13148,11 @@ var GoogleCUAClient = class extends AgentClient {
13192
13148
  this.environment = "ENVIRONMENT_BROWSER";
13193
13149
  this.tools = tools;
13194
13150
  this.apiKey = (clientOptions == null ? void 0 : clientOptions.apiKey) || process.env.GEMINI_API_KEY || process.env.GOOGLE_GENERATIVE_AI_API_KEY || "";
13195
- this.client = new import_genai3.GoogleGenAI({
13151
+ this.baseURL = clientOptions == null ? void 0 : clientOptions.baseURL;
13152
+ const genAIOptions = __spreadValues({
13196
13153
  apiKey: this.apiKey
13197
- });
13154
+ }, this.baseURL ? { httpOptions: { baseUrl: this.baseURL } } : {});
13155
+ this.client = new import_genai3.GoogleGenAI(genAIOptions);
13198
13156
  if ((clientOptions == null ? void 0 : clientOptions.environment) && typeof clientOptions.environment === "string") {
13199
13157
  this.environment = clientOptions.environment;
13200
13158
  }
@@ -13214,9 +13172,9 @@ var GoogleCUAClient = class extends AgentClient {
13214
13172
  }
13215
13173
  ]
13216
13174
  };
13217
- this.clientOptions = {
13175
+ this.clientOptions = __spreadValues({
13218
13176
  apiKey: this.apiKey
13219
- };
13177
+ }, this.baseURL ? { baseURL: this.baseURL } : {});
13220
13178
  if (this.tools && Object.keys(this.tools).length > 0) {
13221
13179
  this.updateGenerateContentConfig();
13222
13180
  }
@@ -15792,7 +15750,7 @@ var AISdkClient = class extends LLMClient {
15792
15750
 
15793
15751
  // lib/v3/llm/AnthropicClient.ts
15794
15752
  var import_sdk3 = __toESM(require("@anthropic-ai/sdk"));
15795
- var import_zod17 = require("zod");
15753
+ var import_zod_to_json_schema3 = require("zod-to-json-schema");
15796
15754
  var AnthropicClient = class extends LLMClient {
15797
15755
  constructor({
15798
15756
  modelName,
@@ -15902,7 +15860,7 @@ var AnthropicClient = class extends LLMClient {
15902
15860
  });
15903
15861
  let toolDefinition;
15904
15862
  if (options.response_model) {
15905
- const jsonSchema2 = import_zod17.z.toJSONSchema(options.response_model.schema);
15863
+ const jsonSchema2 = (0, import_zod_to_json_schema3.zodToJsonSchema)(options.response_model.schema);
15906
15864
  const { properties: schemaProperties, required: schemaRequired } = extractSchemaProperties(jsonSchema2);
15907
15865
  toolDefinition = {
15908
15866
  name: "print_extracted_data",
@@ -16034,7 +15992,7 @@ var extractSchemaProperties = (jsonSchema2) => {
16034
15992
 
16035
15993
  // lib/v3/llm/CerebrasClient.ts
16036
15994
  var import_openai2 = __toESM(require("openai"));
16037
- var import_zod18 = require("zod");
15995
+ var import_zod_to_json_schema4 = require("zod-to-json-schema");
16038
15996
  var CerebrasClient = class extends LLMClient {
16039
15997
  constructor({
16040
15998
  modelName,
@@ -16096,7 +16054,7 @@ var CerebrasClient = class extends LLMClient {
16096
16054
  }
16097
16055
  }));
16098
16056
  if (options.response_model) {
16099
- const jsonSchema2 = import_zod18.z.toJSONSchema(options.response_model.schema);
16057
+ const jsonSchema2 = (0, import_zod_to_json_schema4.zodToJsonSchema)(options.response_model.schema);
16100
16058
  const schemaProperties = jsonSchema2.properties || {};
16101
16059
  const schemaRequired = jsonSchema2.required || [];
16102
16060
  const responseTool = {
@@ -16621,7 +16579,7 @@ ${firstPartText.text}`;
16621
16579
 
16622
16580
  // lib/v3/llm/GroqClient.ts
16623
16581
  var import_openai3 = __toESM(require("openai"));
16624
- var import_zod19 = require("zod");
16582
+ var import_zod_to_json_schema5 = require("zod-to-json-schema");
16625
16583
  var GroqClient = class extends LLMClient {
16626
16584
  constructor({
16627
16585
  modelName,
@@ -16683,7 +16641,7 @@ var GroqClient = class extends LLMClient {
16683
16641
  }
16684
16642
  }));
16685
16643
  if (options.response_model) {
16686
- const jsonSchema2 = import_zod19.z.toJSONSchema(options.response_model.schema);
16644
+ const jsonSchema2 = (0, import_zod_to_json_schema5.zodToJsonSchema)(options.response_model.schema);
16687
16645
  const schemaProperties = jsonSchema2.properties || {};
16688
16646
  const schemaRequired = jsonSchema2.required || [];
16689
16647
  const responseTool = {
@@ -16841,8 +16799,8 @@ var GroqClient = class extends LLMClient {
16841
16799
 
16842
16800
  // lib/v3/llm/OpenAIClient.ts
16843
16801
  var import_openai4 = __toESM(require("openai"));
16844
- var import_zod20 = require("openai/helpers/zod");
16845
- var import_zod21 = require("zod");
16802
+ var import_zod = require("openai/helpers/zod");
16803
+ var import_zod_to_json_schema6 = __toESM(require("zod-to-json-schema"));
16846
16804
  var OpenAIClient = class extends LLMClient {
16847
16805
  constructor({
16848
16806
  modelName,
@@ -16953,7 +16911,7 @@ ${JSON.stringify(
16953
16911
  if (this.modelName.startsWith("o1") || this.modelName.startsWith("o3")) {
16954
16912
  try {
16955
16913
  const parsedSchema = JSON.stringify(
16956
- import_zod21.z.toJSONSchema(options.response_model.schema)
16914
+ (0, import_zod_to_json_schema6.default)(options.response_model.schema)
16957
16915
  );
16958
16916
  options.messages.push({
16959
16917
  role: "user",
@@ -16979,7 +16937,7 @@ ${parsedSchema}
16979
16937
  throw error;
16980
16938
  }
16981
16939
  } else {
16982
- responseFormat = (0, import_zod20.zodResponseFormat)(
16940
+ responseFormat = (0, import_zod.zodResponseFormat)(
16983
16941
  options.response_model.schema,
16984
16942
  options.response_model.name
16985
16943
  );
@@ -17163,7 +17121,7 @@ ${parsedSchema}
17163
17121
  }
17164
17122
  };
17165
17123
 
17166
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.12_zod@4.1.12/node_modules/@ai-sdk/provider-utils/dist/index.mjs
17124
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.12_zod@3.25.67/node_modules/@ai-sdk/provider-utils/dist/index.mjs
17167
17125
  var import_provider = require("@ai-sdk/provider");
17168
17126
  var import_provider2 = require("@ai-sdk/provider");
17169
17127
  var import_provider3 = require("@ai-sdk/provider");
@@ -17300,14 +17258,14 @@ var EventSourceParserStream = class extends TransformStream {
17300
17258
  }
17301
17259
  };
17302
17260
 
17303
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.12_zod@4.1.12/node_modules/@ai-sdk/provider-utils/dist/index.mjs
17261
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.12_zod@3.25.67/node_modules/@ai-sdk/provider-utils/dist/index.mjs
17304
17262
  var import_provider9 = require("@ai-sdk/provider");
17305
17263
  var import_provider10 = require("@ai-sdk/provider");
17306
17264
  var import_provider11 = require("@ai-sdk/provider");
17307
17265
  var z42 = __toESM(require("zod/v4"), 1);
17308
- var import_v3 = require("zod/v3");
17309
- var import_v32 = require("zod/v3");
17310
- var import_v33 = require("zod/v3");
17266
+ var import_v315 = require("zod/v3");
17267
+ var import_v316 = require("zod/v3");
17268
+ var import_v317 = require("zod/v3");
17311
17269
  function combineHeaders(...headers) {
17312
17270
  return headers.reduce(
17313
17271
  (combinedHeaders, currentHeaders) => __spreadValues(__spreadValues({}, combinedHeaders), currentHeaders != null ? currentHeaders : {}),
@@ -18124,7 +18082,7 @@ function parseArrayDef(def, refs) {
18124
18082
  const res = {
18125
18083
  type: "array"
18126
18084
  };
18127
- if (((_a = def.type) == null ? void 0 : _a._def) && ((_c = (_b = def.type) == null ? void 0 : _b._def) == null ? void 0 : _c.typeName) !== import_v32.ZodFirstPartyTypeKind.ZodAny) {
18085
+ if (((_a = def.type) == null ? void 0 : _a._def) && ((_c = (_b = def.type) == null ? void 0 : _b._def) == null ? void 0 : _c.typeName) !== import_v316.ZodFirstPartyTypeKind.ZodAny) {
18128
18086
  res.items = parseDef(def.type._def, __spreadProps(__spreadValues({}, refs), {
18129
18087
  currentPath: [...refs.currentPath, "items"]
18130
18088
  }));
@@ -18613,18 +18571,18 @@ function parseRecordDef(def, refs) {
18613
18571
  currentPath: [...refs.currentPath, "additionalProperties"]
18614
18572
  }))) != null ? _a : refs.allowedAdditionalProperties
18615
18573
  };
18616
- if (((_b = def.keyType) == null ? void 0 : _b._def.typeName) === import_v33.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
18574
+ if (((_b = def.keyType) == null ? void 0 : _b._def.typeName) === import_v317.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
18617
18575
  const _a2 = parseStringDef(def.keyType._def, refs), { type } = _a2, keyType = __objRest(_a2, ["type"]);
18618
18576
  return __spreadProps(__spreadValues({}, schema), {
18619
18577
  propertyNames: keyType
18620
18578
  });
18621
- } else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === import_v33.ZodFirstPartyTypeKind.ZodEnum) {
18579
+ } else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === import_v317.ZodFirstPartyTypeKind.ZodEnum) {
18622
18580
  return __spreadProps(__spreadValues({}, schema), {
18623
18581
  propertyNames: {
18624
18582
  enum: def.keyType._def.values
18625
18583
  }
18626
18584
  });
18627
- } else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === import_v33.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === import_v33.ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
18585
+ } else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === import_v317.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === import_v317.ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
18628
18586
  const _b2 = parseBrandedDef(
18629
18587
  def.keyType._def,
18630
18588
  refs
@@ -18950,73 +18908,73 @@ var parseReadonlyDef = (def, refs) => {
18950
18908
  };
18951
18909
  var selectParser = (def, typeName, refs) => {
18952
18910
  switch (typeName) {
18953
- case import_v3.ZodFirstPartyTypeKind.ZodString:
18911
+ case import_v315.ZodFirstPartyTypeKind.ZodString:
18954
18912
  return parseStringDef(def, refs);
18955
- case import_v3.ZodFirstPartyTypeKind.ZodNumber:
18913
+ case import_v315.ZodFirstPartyTypeKind.ZodNumber:
18956
18914
  return parseNumberDef(def);
18957
- case import_v3.ZodFirstPartyTypeKind.ZodObject:
18915
+ case import_v315.ZodFirstPartyTypeKind.ZodObject:
18958
18916
  return parseObjectDef(def, refs);
18959
- case import_v3.ZodFirstPartyTypeKind.ZodBigInt:
18917
+ case import_v315.ZodFirstPartyTypeKind.ZodBigInt:
18960
18918
  return parseBigintDef(def);
18961
- case import_v3.ZodFirstPartyTypeKind.ZodBoolean:
18919
+ case import_v315.ZodFirstPartyTypeKind.ZodBoolean:
18962
18920
  return parseBooleanDef();
18963
- case import_v3.ZodFirstPartyTypeKind.ZodDate:
18921
+ case import_v315.ZodFirstPartyTypeKind.ZodDate:
18964
18922
  return parseDateDef(def, refs);
18965
- case import_v3.ZodFirstPartyTypeKind.ZodUndefined:
18923
+ case import_v315.ZodFirstPartyTypeKind.ZodUndefined:
18966
18924
  return parseUndefinedDef();
18967
- case import_v3.ZodFirstPartyTypeKind.ZodNull:
18925
+ case import_v315.ZodFirstPartyTypeKind.ZodNull:
18968
18926
  return parseNullDef();
18969
- case import_v3.ZodFirstPartyTypeKind.ZodArray:
18927
+ case import_v315.ZodFirstPartyTypeKind.ZodArray:
18970
18928
  return parseArrayDef(def, refs);
18971
- case import_v3.ZodFirstPartyTypeKind.ZodUnion:
18972
- case import_v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
18929
+ case import_v315.ZodFirstPartyTypeKind.ZodUnion:
18930
+ case import_v315.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
18973
18931
  return parseUnionDef(def, refs);
18974
- case import_v3.ZodFirstPartyTypeKind.ZodIntersection:
18932
+ case import_v315.ZodFirstPartyTypeKind.ZodIntersection:
18975
18933
  return parseIntersectionDef(def, refs);
18976
- case import_v3.ZodFirstPartyTypeKind.ZodTuple:
18934
+ case import_v315.ZodFirstPartyTypeKind.ZodTuple:
18977
18935
  return parseTupleDef(def, refs);
18978
- case import_v3.ZodFirstPartyTypeKind.ZodRecord:
18936
+ case import_v315.ZodFirstPartyTypeKind.ZodRecord:
18979
18937
  return parseRecordDef(def, refs);
18980
- case import_v3.ZodFirstPartyTypeKind.ZodLiteral:
18938
+ case import_v315.ZodFirstPartyTypeKind.ZodLiteral:
18981
18939
  return parseLiteralDef(def);
18982
- case import_v3.ZodFirstPartyTypeKind.ZodEnum:
18940
+ case import_v315.ZodFirstPartyTypeKind.ZodEnum:
18983
18941
  return parseEnumDef(def);
18984
- case import_v3.ZodFirstPartyTypeKind.ZodNativeEnum:
18942
+ case import_v315.ZodFirstPartyTypeKind.ZodNativeEnum:
18985
18943
  return parseNativeEnumDef(def);
18986
- case import_v3.ZodFirstPartyTypeKind.ZodNullable:
18944
+ case import_v315.ZodFirstPartyTypeKind.ZodNullable:
18987
18945
  return parseNullableDef(def, refs);
18988
- case import_v3.ZodFirstPartyTypeKind.ZodOptional:
18946
+ case import_v315.ZodFirstPartyTypeKind.ZodOptional:
18989
18947
  return parseOptionalDef(def, refs);
18990
- case import_v3.ZodFirstPartyTypeKind.ZodMap:
18948
+ case import_v315.ZodFirstPartyTypeKind.ZodMap:
18991
18949
  return parseMapDef(def, refs);
18992
- case import_v3.ZodFirstPartyTypeKind.ZodSet:
18950
+ case import_v315.ZodFirstPartyTypeKind.ZodSet:
18993
18951
  return parseSetDef(def, refs);
18994
- case import_v3.ZodFirstPartyTypeKind.ZodLazy:
18952
+ case import_v315.ZodFirstPartyTypeKind.ZodLazy:
18995
18953
  return () => def.getter()._def;
18996
- case import_v3.ZodFirstPartyTypeKind.ZodPromise:
18954
+ case import_v315.ZodFirstPartyTypeKind.ZodPromise:
18997
18955
  return parsePromiseDef(def, refs);
18998
- case import_v3.ZodFirstPartyTypeKind.ZodNaN:
18999
- case import_v3.ZodFirstPartyTypeKind.ZodNever:
18956
+ case import_v315.ZodFirstPartyTypeKind.ZodNaN:
18957
+ case import_v315.ZodFirstPartyTypeKind.ZodNever:
19000
18958
  return parseNeverDef();
19001
- case import_v3.ZodFirstPartyTypeKind.ZodEffects:
18959
+ case import_v315.ZodFirstPartyTypeKind.ZodEffects:
19002
18960
  return parseEffectsDef(def, refs);
19003
- case import_v3.ZodFirstPartyTypeKind.ZodAny:
18961
+ case import_v315.ZodFirstPartyTypeKind.ZodAny:
19004
18962
  return parseAnyDef();
19005
- case import_v3.ZodFirstPartyTypeKind.ZodUnknown:
18963
+ case import_v315.ZodFirstPartyTypeKind.ZodUnknown:
19006
18964
  return parseUnknownDef();
19007
- case import_v3.ZodFirstPartyTypeKind.ZodDefault:
18965
+ case import_v315.ZodFirstPartyTypeKind.ZodDefault:
19008
18966
  return parseDefaultDef(def, refs);
19009
- case import_v3.ZodFirstPartyTypeKind.ZodBranded:
18967
+ case import_v315.ZodFirstPartyTypeKind.ZodBranded:
19010
18968
  return parseBrandedDef(def, refs);
19011
- case import_v3.ZodFirstPartyTypeKind.ZodReadonly:
18969
+ case import_v315.ZodFirstPartyTypeKind.ZodReadonly:
19012
18970
  return parseReadonlyDef(def, refs);
19013
- case import_v3.ZodFirstPartyTypeKind.ZodCatch:
18971
+ case import_v315.ZodFirstPartyTypeKind.ZodCatch:
19014
18972
  return parseCatchDef(def, refs);
19015
- case import_v3.ZodFirstPartyTypeKind.ZodPipeline:
18973
+ case import_v315.ZodFirstPartyTypeKind.ZodPipeline:
19016
18974
  return parsePipelineDef(def, refs);
19017
- case import_v3.ZodFirstPartyTypeKind.ZodFunction:
19018
- case import_v3.ZodFirstPartyTypeKind.ZodVoid:
19019
- case import_v3.ZodFirstPartyTypeKind.ZodSymbol:
18975
+ case import_v315.ZodFirstPartyTypeKind.ZodFunction:
18976
+ case import_v315.ZodFirstPartyTypeKind.ZodVoid:
18977
+ case import_v315.ZodFirstPartyTypeKind.ZodSymbol:
19020
18978
  return void 0;
19021
18979
  default:
19022
18980
  return /* @__PURE__ */ ((_) => void 0)(typeName);
@@ -19103,7 +19061,7 @@ var getRefs = (options) => {
19103
19061
  )
19104
19062
  });
19105
19063
  };
19106
- var zodToJsonSchema = (schema, options) => {
19064
+ var zodToJsonSchema7 = (schema, options) => {
19107
19065
  var _a;
19108
19066
  const refs = getRefs(options);
19109
19067
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
@@ -19148,7 +19106,7 @@ var zodToJsonSchema = (schema, options) => {
19148
19106
  combined.$schema = "http://json-schema.org/draft-07/schema#";
19149
19107
  return combined;
19150
19108
  };
19151
- var zod_to_json_schema_default = zodToJsonSchema;
19109
+ var zod_to_json_schema_default = zodToJsonSchema7;
19152
19110
  function zod3Schema(zodSchema2, options) {
19153
19111
  var _a;
19154
19112
  const useReferences = (_a = options == null ? void 0 : options.useReferences) != null ? _a : false;
@@ -19240,7 +19198,7 @@ function withoutTrailingSlash(url) {
19240
19198
  return url == null ? void 0 : url.replace(/\/$/, "");
19241
19199
  }
19242
19200
 
19243
- // ../../node_modules/.pnpm/@ai-sdk+openai@2.0.53_zod@4.1.12/node_modules/@ai-sdk/openai/dist/index.mjs
19201
+ // ../../node_modules/.pnpm/@ai-sdk+openai@2.0.53_zod@3.25.67/node_modules/@ai-sdk/openai/dist/index.mjs
19244
19202
  var import_provider12 = require("@ai-sdk/provider");
19245
19203
  var import_v4 = require("zod/v4");
19246
19204
  var import_provider13 = require("@ai-sdk/provider");
@@ -23630,7 +23588,7 @@ function createOpenAI(options = {}) {
23630
23588
  }
23631
23589
  var openai = createOpenAI();
23632
23590
 
23633
- // ../../node_modules/.pnpm/@ai-sdk+anthropic@2.0.34_zod@4.1.12/node_modules/@ai-sdk/anthropic/dist/index.mjs
23591
+ // ../../node_modules/.pnpm/@ai-sdk+anthropic@2.0.34_zod@3.25.67/node_modules/@ai-sdk/anthropic/dist/index.mjs
23634
23592
  var import_provider20 = require("@ai-sdk/provider");
23635
23593
  var import_provider21 = require("@ai-sdk/provider");
23636
23594
  var import_v421 = require("zod/v4");
@@ -26669,7 +26627,7 @@ function createAnthropic(options = {}) {
26669
26627
  }
26670
26628
  var anthropic = createAnthropic();
26671
26629
 
26672
- // ../../node_modules/.pnpm/@ai-sdk+google@2.0.23_zod@4.1.12/node_modules/@ai-sdk/google/dist/index.mjs
26630
+ // ../../node_modules/.pnpm/@ai-sdk+google@2.0.23_zod@3.25.67/node_modules/@ai-sdk/google/dist/index.mjs
26673
26631
  var import_provider24 = require("@ai-sdk/provider");
26674
26632
  var import_v437 = require("zod/v4");
26675
26633
  var import_v438 = require("zod/v4");
@@ -28221,7 +28179,7 @@ function createGoogleGenerativeAI(options = {}) {
28221
28179
  }
28222
28180
  var google = createGoogleGenerativeAI();
28223
28181
 
28224
- // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@1.0.22_zod@4.1.12/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
28182
+ // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@1.0.22_zod@3.25.67/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
28225
28183
  var import_provider27 = require("@ai-sdk/provider");
28226
28184
  var import_v446 = require("zod/v4");
28227
28185
  var import_provider28 = require("@ai-sdk/provider");
@@ -29541,7 +29499,7 @@ var openaiCompatibleImageResponseSchema = import_v453.z.object({
29541
29499
  data: import_v453.z.array(import_v453.z.object({ b64_json: import_v453.z.string() }))
29542
29500
  });
29543
29501
 
29544
- // ../../node_modules/.pnpm/@ai-sdk+xai@2.0.26_zod@4.1.12/node_modules/@ai-sdk/xai/dist/index.mjs
29502
+ // ../../node_modules/.pnpm/@ai-sdk+xai@2.0.26_zod@3.25.67/node_modules/@ai-sdk/xai/dist/index.mjs
29545
29503
  var import_provider32 = require("@ai-sdk/provider");
29546
29504
  var import_v454 = require("zod/v4");
29547
29505
  var import_provider33 = require("@ai-sdk/provider");
@@ -30293,7 +30251,7 @@ function createXai(options = {}) {
30293
30251
  }
30294
30252
  var xai = createXai();
30295
30253
 
30296
- // ../../node_modules/.pnpm/@ai-sdk+openai@2.0.53_zod@4.1.12/node_modules/@ai-sdk/openai/dist/internal/index.mjs
30254
+ // ../../node_modules/.pnpm/@ai-sdk+openai@2.0.53_zod@3.25.67/node_modules/@ai-sdk/openai/dist/internal/index.mjs
30297
30255
  var import_provider35 = require("@ai-sdk/provider");
30298
30256
  var import_v457 = require("zod/v4");
30299
30257
  var import_provider36 = require("@ai-sdk/provider");
@@ -34516,7 +34474,7 @@ function mapWebSearchOutput2(action) {
34516
34474
  }
34517
34475
  }
34518
34476
 
34519
- // ../../node_modules/.pnpm/@ai-sdk+azure@2.0.54_zod@4.1.12/node_modules/@ai-sdk/azure/dist/index.mjs
34477
+ // ../../node_modules/.pnpm/@ai-sdk+azure@2.0.54_zod@3.25.67/node_modules/@ai-sdk/azure/dist/index.mjs
34520
34478
  var azureOpenaiTools = {
34521
34479
  codeInterpreter: codeInterpreter2,
34522
34480
  fileSearch: fileSearch2,
@@ -34621,7 +34579,7 @@ function createAzure(options = {}) {
34621
34579
  }
34622
34580
  var azure = createAzure();
34623
34581
 
34624
- // ../../node_modules/.pnpm/@ai-sdk+groq@2.0.24_zod@4.1.12/node_modules/@ai-sdk/groq/dist/index.mjs
34582
+ // ../../node_modules/.pnpm/@ai-sdk+groq@2.0.24_zod@3.25.67/node_modules/@ai-sdk/groq/dist/index.mjs
34625
34583
  var import_provider43 = require("@ai-sdk/provider");
34626
34584
  var import_provider44 = require("@ai-sdk/provider");
34627
34585
  var import_v477 = require("zod/v4");
@@ -35503,7 +35461,7 @@ function createGroq(options = {}) {
35503
35461
  }
35504
35462
  var groq = createGroq();
35505
35463
 
35506
- // ../../node_modules/.pnpm/@ai-sdk+cerebras@1.0.25_zod@4.1.12/node_modules/@ai-sdk/cerebras/dist/index.mjs
35464
+ // ../../node_modules/.pnpm/@ai-sdk+cerebras@1.0.25_zod@3.25.67/node_modules/@ai-sdk/cerebras/dist/index.mjs
35507
35465
  var import_provider47 = require("@ai-sdk/provider");
35508
35466
  var import_v482 = require("zod/v4");
35509
35467
  var VERSION8 = true ? "1.0.25" : "0.0.0-test";
@@ -35555,7 +35513,7 @@ function createCerebras(options = {}) {
35555
35513
  }
35556
35514
  var cerebras = createCerebras();
35557
35515
 
35558
- // ../../node_modules/.pnpm/@ai-sdk+togetherai@1.0.23_zod@4.1.12/node_modules/@ai-sdk/togetherai/dist/index.mjs
35516
+ // ../../node_modules/.pnpm/@ai-sdk+togetherai@1.0.23_zod@3.25.67/node_modules/@ai-sdk/togetherai/dist/index.mjs
35559
35517
  var import_v483 = require("zod/v4");
35560
35518
  var TogetherAIImageModel = class {
35561
35519
  constructor(modelId, config) {
@@ -35686,7 +35644,7 @@ function createTogetherAI(options = {}) {
35686
35644
  }
35687
35645
  var togetherai = createTogetherAI();
35688
35646
 
35689
- // ../../node_modules/.pnpm/@ai-sdk+mistral@2.0.19_zod@4.1.12/node_modules/@ai-sdk/mistral/dist/index.mjs
35647
+ // ../../node_modules/.pnpm/@ai-sdk+mistral@2.0.19_zod@3.25.67/node_modules/@ai-sdk/mistral/dist/index.mjs
35690
35648
  var import_provider48 = require("@ai-sdk/provider");
35691
35649
  var import_v484 = require("zod/v4");
35692
35650
  var import_provider49 = require("@ai-sdk/provider");
@@ -36469,7 +36427,7 @@ function createMistral(options = {}) {
36469
36427
  }
36470
36428
  var mistral = createMistral();
36471
36429
 
36472
- // ../../node_modules/.pnpm/@ai-sdk+deepseek@1.0.23_zod@4.1.12/node_modules/@ai-sdk/deepseek/dist/index.mjs
36430
+ // ../../node_modules/.pnpm/@ai-sdk+deepseek@1.0.23_zod@3.25.67/node_modules/@ai-sdk/deepseek/dist/index.mjs
36473
36431
  var import_provider52 = require("@ai-sdk/provider");
36474
36432
  var import_v488 = require("zod/v4");
36475
36433
  var buildDeepseekMetadata = (usage) => {
@@ -36559,7 +36517,7 @@ function createDeepSeek(options = {}) {
36559
36517
  }
36560
36518
  var deepseek = createDeepSeek();
36561
36519
 
36562
- // ../../node_modules/.pnpm/@ai-sdk+perplexity@2.0.13_zod@4.1.12/node_modules/@ai-sdk/perplexity/dist/index.mjs
36520
+ // ../../node_modules/.pnpm/@ai-sdk+perplexity@2.0.13_zod@3.25.67/node_modules/@ai-sdk/perplexity/dist/index.mjs
36563
36521
  var import_provider53 = require("@ai-sdk/provider");
36564
36522
  var import_v489 = require("zod/v4");
36565
36523
  var import_provider54 = require("@ai-sdk/provider");
@@ -36989,7 +36947,7 @@ function createPerplexity(options = {}) {
36989
36947
  }
36990
36948
  var perplexity = createPerplexity();
36991
36949
 
36992
- // ../../node_modules/.pnpm/ollama-ai-provider-v2@1.5.0_zod@4.1.12/node_modules/ollama-ai-provider-v2/dist/index.mjs
36950
+ // ../../node_modules/.pnpm/ollama-ai-provider-v2@1.5.0_zod@3.25.67/node_modules/ollama-ai-provider-v2/dist/index.mjs
36993
36951
  var import_provider55 = require("@ai-sdk/provider");
36994
36952
  var import_v490 = require("zod/v4");
36995
36953
  var import_v491 = require("zod/v4");
@@ -39529,7 +39487,7 @@ function resolveModel(model) {
39529
39487
 
39530
39488
  // lib/v3/api.ts
39531
39489
  var import_fetch_cookie = __toESM(require("fetch-cookie"));
39532
- var import_zod22 = require("zod");
39490
+ var import_zod_to_json_schema7 = __toESM(require("zod-to-json-schema"));
39533
39491
  var StagehandAPIClient = class {
39534
39492
  constructor({ apiKey, projectId, logger }) {
39535
39493
  this.apiKey = apiKey;
@@ -39623,7 +39581,7 @@ var StagehandAPIClient = class {
39623
39581
  options,
39624
39582
  frameId
39625
39583
  }) {
39626
- const jsonSchema2 = zodSchema2 ? import_zod22.z.toJSONSchema(zodSchema2) : void 0;
39584
+ const jsonSchema2 = zodSchema2 ? (0, import_zod_to_json_schema7.default)(zodSchema2) : void 0;
39627
39585
  const args = {
39628
39586
  schema: jsonSchema2,
39629
39587
  instruction,
@@ -41108,13 +41066,13 @@ function isObserveResult(v) {
41108
41066
 
41109
41067
  // lib/v3Evaluator.ts
41110
41068
  var import_dotenv2 = __toESM(require("dotenv"));
41111
- var import_zod23 = require("zod");
41069
+ var import_v318 = require("zod/v3");
41112
41070
  import_dotenv2.default.config();
41113
- var EvaluationSchema = import_zod23.z.object({
41114
- evaluation: import_zod23.z.enum(["YES", "NO"]),
41115
- reasoning: import_zod23.z.string()
41071
+ var EvaluationSchema = import_v318.z.object({
41072
+ evaluation: import_v318.z.enum(["YES", "NO"]),
41073
+ reasoning: import_v318.z.string()
41116
41074
  });
41117
- var BatchEvaluationSchema = import_zod23.z.array(EvaluationSchema);
41075
+ var BatchEvaluationSchema = import_v318.z.array(EvaluationSchema);
41118
41076
  var V3Evaluator = class {
41119
41077
  constructor(v3, modelName, modelClientOptions) {
41120
41078
  this.silentLogger = () => {