@browserbasehq/orca 3.0.2-zod352 → 3.0.2-zod353
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.js +12 -45
- 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-
|
|
88
|
+
STAGEHAND_VERSION = "3.0.2-zod353";
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
|
|
@@ -7965,16 +7965,7 @@ 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) =>
|
|
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
|
-
};
|
|
7968
|
+
var isZod4Schema = (schema) => typeof schema._zod !== "undefined";
|
|
7978
7969
|
var isZod3Schema = (schema) => !isZod4Schema(schema);
|
|
7979
7970
|
function ZodToJsonSchema(schema) {
|
|
7980
7971
|
const _def = schema._def;
|
|
@@ -8226,14 +8217,11 @@ function isRunningInBun() {
|
|
|
8226
8217
|
return typeof process !== "undefined" && typeof process.versions !== "undefined" && "bun" in process.versions;
|
|
8227
8218
|
}
|
|
8228
8219
|
function decorateGeminiSchema(geminiSchema, zodSchema2) {
|
|
8229
|
-
var _a, _b;
|
|
8230
8220
|
if (geminiSchema.nullable === void 0) {
|
|
8231
|
-
|
|
8232
|
-
geminiSchema.nullable = zodType === "optional" || zodType === "nullable";
|
|
8221
|
+
geminiSchema.nullable = zodSchema2.isOptional();
|
|
8233
8222
|
}
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
geminiSchema.description = description;
|
|
8223
|
+
if (zodSchema2.description) {
|
|
8224
|
+
geminiSchema.description = zodSchema2.description;
|
|
8237
8225
|
}
|
|
8238
8226
|
return geminiSchema;
|
|
8239
8227
|
}
|
|
@@ -8364,10 +8352,10 @@ function transformSchema(schema, currentPath) {
|
|
|
8364
8352
|
const checks = getStringChecks(schema);
|
|
8365
8353
|
const format = getStringFormat(schema);
|
|
8366
8354
|
const hasUrlCheck = checks.some((check) => {
|
|
8367
|
-
var _a, _b, _c, _d
|
|
8355
|
+
var _a, _b, _c, _d;
|
|
8368
8356
|
const candidate = check;
|
|
8369
|
-
return candidate.kind === "url" || candidate.format === "url" ||
|
|
8370
|
-
}) || format === "url"
|
|
8357
|
+
return candidate.kind === "url" || candidate.format === "url" || ((_b = (_a = candidate._zod) == null ? void 0 : _a.def) == null ? void 0 : _b.check) === "url" || ((_d = (_c = candidate._zod) == null ? void 0 : _c.def) == null ? void 0 : _d.format) === "url";
|
|
8358
|
+
}) || format === "url";
|
|
8371
8359
|
if (hasUrlCheck) {
|
|
8372
8360
|
return [makeIdStringSchema(schema), [{ segments: [] }]];
|
|
8373
8361
|
}
|
|
@@ -11376,7 +11364,7 @@ var ExtractHandler = class {
|
|
|
11376
11364
|
const { instruction, schema, page, selector, timeout, model } = params;
|
|
11377
11365
|
const llmClient = this.resolveLlmClient(model);
|
|
11378
11366
|
const doExtract = () => __async(this, null, function* () {
|
|
11379
|
-
var _a, _b,
|
|
11367
|
+
var _a, _b, _d;
|
|
11380
11368
|
const noArgs = !instruction && !schema;
|
|
11381
11369
|
if (noArgs) {
|
|
11382
11370
|
const focusSelector2 = (_a = selector == null ? void 0 : selector.replace(/^xpath=/i, "")) != null ? _a : "";
|
|
@@ -11413,27 +11401,6 @@ var ExtractHandler = class {
|
|
|
11413
11401
|
[WRAP_KEY]: baseSchema
|
|
11414
11402
|
});
|
|
11415
11403
|
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
|
-
}
|
|
11437
11404
|
const extractionResponse = yield extract({
|
|
11438
11405
|
instruction,
|
|
11439
11406
|
domElements: combinedTree,
|
|
@@ -11443,14 +11410,14 @@ var ExtractHandler = class {
|
|
|
11443
11410
|
logger: v3Logger,
|
|
11444
11411
|
logInferenceToFile: this.logInferenceToFile
|
|
11445
11412
|
});
|
|
11446
|
-
const
|
|
11413
|
+
const _c = extractionResponse, {
|
|
11447
11414
|
metadata: { completed },
|
|
11448
11415
|
prompt_tokens,
|
|
11449
11416
|
completion_tokens,
|
|
11450
11417
|
reasoning_tokens = 0,
|
|
11451
11418
|
cached_input_tokens = 0,
|
|
11452
11419
|
inference_time_ms
|
|
11453
|
-
} =
|
|
11420
|
+
} = _c, rest = __objRest(_c, [
|
|
11454
11421
|
"metadata",
|
|
11455
11422
|
"prompt_tokens",
|
|
11456
11423
|
"completion_tokens",
|
|
@@ -11475,7 +11442,7 @@ var ExtractHandler = class {
|
|
|
11475
11442
|
}
|
|
11476
11443
|
}
|
|
11477
11444
|
});
|
|
11478
|
-
(
|
|
11445
|
+
(_d = this.onMetrics) == null ? void 0 : _d.call(
|
|
11479
11446
|
this,
|
|
11480
11447
|
"EXTRACT" /* EXTRACT */,
|
|
11481
11448
|
prompt_tokens,
|
package/package.json
CHANGED