@browserbasehq/orca 3.0.2-zod350 → 3.0.2-zod352

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 +36 -6
  2. package/package.json +1 -1
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-zod350";
88
+ STAGEHAND_VERSION = "3.0.2-zod352";
89
89
  }
90
90
  });
91
91
 
@@ -7965,7 +7965,16 @@ var import_v3 = __toESM(require("zod/v3"));
7965
7965
 
7966
7966
  // lib/v3/zodCompat.ts
7967
7967
  var import_zod = require("zod");
7968
- var isZod4Schema = (schema) => typeof schema._zod !== "undefined";
7968
+ var isZod4Schema = (schema) => {
7969
+ if (typeof schema._zod !== "undefined") {
7970
+ return true;
7971
+ }
7972
+ const maybeAny = schema;
7973
+ if (typeof maybeAny.isOptional === "function") {
7974
+ return false;
7975
+ }
7976
+ return true;
7977
+ };
7969
7978
  var isZod3Schema = (schema) => !isZod4Schema(schema);
7970
7979
  function ZodToJsonSchema(schema) {
7971
7980
  const _def = schema._def;
@@ -11367,7 +11376,7 @@ var ExtractHandler = class {
11367
11376
  const { instruction, schema, page, selector, timeout, model } = params;
11368
11377
  const llmClient = this.resolveLlmClient(model);
11369
11378
  const doExtract = () => __async(this, null, function* () {
11370
- var _a, _b, _d;
11379
+ var _a, _b, _c, _d, _f;
11371
11380
  const noArgs = !instruction && !schema;
11372
11381
  if (noArgs) {
11373
11382
  const focusSelector2 = (_a = selector == null ? void 0 : selector.replace(/^xpath=/i, "")) != null ? _a : "";
@@ -11404,6 +11413,27 @@ var ExtractHandler = class {
11404
11413
  [WRAP_KEY]: baseSchema
11405
11414
  });
11406
11415
  const [transformedSchema, urlFieldPaths] = transformUrlStringsToNumericIds(objectSchema);
11416
+ try {
11417
+ const getShape = (s) => {
11418
+ var _a2, _b2, _c2;
11419
+ const v4Shape = (_b2 = (_a2 = s._zod) == null ? void 0 : _a2.def) == null ? void 0 : _b2.shape;
11420
+ if (v4Shape) return v4Shape;
11421
+ const v3ShapeGetter = (_c2 = s._def) == null ? void 0 : _c2.shape;
11422
+ return typeof v3ShapeGetter === "function" ? v3ShapeGetter() : void 0;
11423
+ };
11424
+ const beforeKeys = Object.keys((_c = getShape(objectSchema)) != null ? _c : {});
11425
+ const afterKeys = Object.keys((_d = getShape(transformedSchema)) != null ? _d : {});
11426
+ v3Logger({
11427
+ category: "extraction",
11428
+ message: "Schema fields before/after URL transform",
11429
+ level: 2,
11430
+ auxiliary: {
11431
+ before: { value: JSON.stringify(beforeKeys), type: "object" },
11432
+ after: { value: JSON.stringify(afterKeys), type: "object" }
11433
+ }
11434
+ });
11435
+ } catch (e) {
11436
+ }
11407
11437
  const extractionResponse = yield extract({
11408
11438
  instruction,
11409
11439
  domElements: combinedTree,
@@ -11413,14 +11443,14 @@ var ExtractHandler = class {
11413
11443
  logger: v3Logger,
11414
11444
  logInferenceToFile: this.logInferenceToFile
11415
11445
  });
11416
- const _c = extractionResponse, {
11446
+ const _e = extractionResponse, {
11417
11447
  metadata: { completed },
11418
11448
  prompt_tokens,
11419
11449
  completion_tokens,
11420
11450
  reasoning_tokens = 0,
11421
11451
  cached_input_tokens = 0,
11422
11452
  inference_time_ms
11423
- } = _c, rest = __objRest(_c, [
11453
+ } = _e, rest = __objRest(_e, [
11424
11454
  "metadata",
11425
11455
  "prompt_tokens",
11426
11456
  "completion_tokens",
@@ -11445,7 +11475,7 @@ var ExtractHandler = class {
11445
11475
  }
11446
11476
  }
11447
11477
  });
11448
- (_d = this.onMetrics) == null ? void 0 : _d.call(
11478
+ (_f = this.onMetrics) == null ? void 0 : _f.call(
11449
11479
  this,
11450
11480
  "EXTRACT" /* EXTRACT */,
11451
11481
  prompt_tokens,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/orca",
3
- "version": "3.0.2-zod350",
3
+ "version": "3.0.2-zod352",
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",