@opentiny/next-sdk 0.2.4 → 0.2.5

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.
@@ -171,7 +171,7 @@ function requireScope() {
171
171
  (function(exports) {
172
172
  Object.defineProperty(exports, "__esModule", { value: true });
173
173
  exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
174
- const code_1 = requireCode$1();
174
+ const code_1 = /* @__PURE__ */ requireCode$1();
175
175
  class ValueError extends Error {
176
176
  constructor(name16) {
177
177
  super(`CodeGen: "code" for ${name16} not defined`);
@@ -317,9 +317,9 @@ function requireCodegen() {
317
317
  (function(exports) {
318
318
  Object.defineProperty(exports, "__esModule", { value: true });
319
319
  exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0;
320
- const code_1 = requireCode$1();
321
- const scope_1 = requireScope();
322
- var code_2 = requireCode$1();
320
+ const code_1 = /* @__PURE__ */ requireCode$1();
321
+ const scope_1 = /* @__PURE__ */ requireScope();
322
+ var code_2 = /* @__PURE__ */ requireCode$1();
323
323
  Object.defineProperty(exports, "_", { enumerable: true, get: function() {
324
324
  return code_2._;
325
325
  } });
@@ -344,7 +344,7 @@ function requireCodegen() {
344
344
  Object.defineProperty(exports, "Name", { enumerable: true, get: function() {
345
345
  return code_2.Name;
346
346
  } });
347
- var scope_2 = requireScope();
347
+ var scope_2 = /* @__PURE__ */ requireScope();
348
348
  Object.defineProperty(exports, "Scope", { enumerable: true, get: function() {
349
349
  return scope_2.Scope;
350
350
  } });
@@ -1038,8 +1038,8 @@ function requireUtil() {
1038
1038
  hasRequiredUtil = 1;
1039
1039
  Object.defineProperty(util$1, "__esModule", { value: true });
1040
1040
  util$1.checkStrictMode = util$1.getErrorPath = util$1.Type = util$1.useFunc = util$1.setEvaluated = util$1.evaluatedPropsToName = util$1.mergeEvaluated = util$1.eachItem = util$1.unescapeJsonPointer = util$1.escapeJsonPointer = util$1.escapeFragment = util$1.unescapeFragment = util$1.schemaRefOrVal = util$1.schemaHasRulesButRef = util$1.schemaHasRules = util$1.checkUnknownRules = util$1.alwaysValidSchema = util$1.toHash = void 0;
1041
- const codegen_1 = requireCodegen();
1042
- const code_1 = requireCode$1();
1041
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1042
+ const code_1 = /* @__PURE__ */ requireCode$1();
1043
1043
  function toHash(arr) {
1044
1044
  const hash = {};
1045
1045
  for (const item of arr)
@@ -1204,7 +1204,7 @@ function requireNames() {
1204
1204
  if (hasRequiredNames) return names;
1205
1205
  hasRequiredNames = 1;
1206
1206
  Object.defineProperty(names, "__esModule", { value: true });
1207
- const codegen_1 = requireCodegen();
1207
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1208
1208
  const names$1 = {
1209
1209
  // validation function arguments
1210
1210
  data: new codegen_1.Name("data"),
@@ -1244,9 +1244,9 @@ function requireErrors() {
1244
1244
  (function(exports) {
1245
1245
  Object.defineProperty(exports, "__esModule", { value: true });
1246
1246
  exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0;
1247
- const codegen_1 = requireCodegen();
1248
- const util_1 = requireUtil();
1249
- const names_1 = requireNames();
1247
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1248
+ const util_1 = /* @__PURE__ */ requireUtil();
1249
+ const names_1 = /* @__PURE__ */ requireNames();
1250
1250
  exports.keywordError = {
1251
1251
  message: ({ keyword: keyword2 }) => (0, codegen_1.str)`must pass "${keyword2}" keyword validation`
1252
1252
  };
@@ -1366,9 +1366,9 @@ function requireBoolSchema() {
1366
1366
  hasRequiredBoolSchema = 1;
1367
1367
  Object.defineProperty(boolSchema, "__esModule", { value: true });
1368
1368
  boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
1369
- const errors_1 = requireErrors();
1370
- const codegen_1 = requireCodegen();
1371
- const names_1 = requireNames();
1369
+ const errors_1 = /* @__PURE__ */ requireErrors();
1370
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1371
+ const names_1 = /* @__PURE__ */ requireNames();
1372
1372
  const boolError = {
1373
1373
  message: "boolean schema is false"
1374
1374
  };
@@ -1471,11 +1471,11 @@ function requireDataType() {
1471
1471
  hasRequiredDataType = 1;
1472
1472
  Object.defineProperty(dataType, "__esModule", { value: true });
1473
1473
  dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
1474
- const rules_1 = requireRules();
1475
- const applicability_1 = requireApplicability();
1476
- const errors_1 = requireErrors();
1477
- const codegen_1 = requireCodegen();
1478
- const util_1 = requireUtil();
1474
+ const rules_1 = /* @__PURE__ */ requireRules();
1475
+ const applicability_1 = /* @__PURE__ */ requireApplicability();
1476
+ const errors_1 = /* @__PURE__ */ requireErrors();
1477
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1478
+ const util_1 = /* @__PURE__ */ requireUtil();
1479
1479
  var DataType;
1480
1480
  (function(DataType2) {
1481
1481
  DataType2[DataType2["Correct"] = 0] = "Correct";
@@ -1655,8 +1655,8 @@ function requireDefaults() {
1655
1655
  hasRequiredDefaults = 1;
1656
1656
  Object.defineProperty(defaults, "__esModule", { value: true });
1657
1657
  defaults.assignDefaults = void 0;
1658
- const codegen_1 = requireCodegen();
1659
- const util_1 = requireUtil();
1658
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1659
+ const util_1 = /* @__PURE__ */ requireUtil();
1660
1660
  function assignDefaults(it, ty) {
1661
1661
  const { properties: properties2, items: items2 } = it.schema;
1662
1662
  if (ty === "object" && properties2) {
@@ -1693,10 +1693,10 @@ function requireCode() {
1693
1693
  hasRequiredCode = 1;
1694
1694
  Object.defineProperty(code, "__esModule", { value: true });
1695
1695
  code.validateUnion = code.validateArray = code.usePattern = code.callValidateCode = code.schemaProperties = code.allSchemaProperties = code.noPropertyInData = code.propertyInData = code.isOwnProperty = code.hasPropFunc = code.reportMissingProp = code.checkMissingProp = code.checkReportMissingProp = void 0;
1696
- const codegen_1 = requireCodegen();
1697
- const util_1 = requireUtil();
1698
- const names_1 = requireNames();
1699
- const util_2 = requireUtil();
1696
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1697
+ const util_1 = /* @__PURE__ */ requireUtil();
1698
+ const names_1 = /* @__PURE__ */ requireNames();
1699
+ const util_2 = /* @__PURE__ */ requireUtil();
1700
1700
  function checkReportMissingProp(cxt, prop) {
1701
1701
  const { gen, data, it } = cxt;
1702
1702
  gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
@@ -1825,10 +1825,10 @@ function requireKeyword() {
1825
1825
  hasRequiredKeyword = 1;
1826
1826
  Object.defineProperty(keyword, "__esModule", { value: true });
1827
1827
  keyword.validateKeywordUsage = keyword.validSchemaType = keyword.funcKeywordCode = keyword.macroKeywordCode = void 0;
1828
- const codegen_1 = requireCodegen();
1829
- const names_1 = requireNames();
1830
- const code_1 = requireCode();
1831
- const errors_1 = requireErrors();
1828
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1829
+ const names_1 = /* @__PURE__ */ requireNames();
1830
+ const code_1 = /* @__PURE__ */ requireCode();
1831
+ const errors_1 = /* @__PURE__ */ requireErrors();
1832
1832
  function macroKeywordCode(cxt, def) {
1833
1833
  const { gen, keyword: keyword2, schema, parentSchema, it } = cxt;
1834
1834
  const macroSchema = def.macro.call(it.self, schema, parentSchema, it);
@@ -1943,8 +1943,8 @@ function requireSubschema() {
1943
1943
  hasRequiredSubschema = 1;
1944
1944
  Object.defineProperty(subschema, "__esModule", { value: true });
1945
1945
  subschema.extendSubschemaMode = subschema.extendSubschemaData = subschema.getSubschema = void 0;
1946
- const codegen_1 = requireCodegen();
1947
- const util_1 = requireUtil();
1946
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
1947
+ const util_1 = /* @__PURE__ */ requireUtil();
1948
1948
  function getSubschema(it, { keyword: keyword2, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
1949
1949
  if (keyword2 !== void 0 && schema !== void 0) {
1950
1950
  throw new Error('both "keyword" and "schema" passed, only one allowed');
@@ -2149,7 +2149,7 @@ function requireResolve() {
2149
2149
  hasRequiredResolve = 1;
2150
2150
  Object.defineProperty(resolve$1, "__esModule", { value: true });
2151
2151
  resolve$1.getSchemaRefs = resolve$1.resolveUrl = resolve$1.normalizeId = resolve$1._getFullPath = resolve$1.getFullPath = resolve$1.inlineRef = void 0;
2152
- const util_1 = requireUtil();
2152
+ const util_1 = /* @__PURE__ */ requireUtil();
2153
2153
  const equal2 = requireFastDeepEqual();
2154
2154
  const traverse = requireJsonSchemaTraverse();
2155
2155
  const SIMPLE_INLINED = /* @__PURE__ */ new Set([
@@ -2304,18 +2304,18 @@ function requireValidate() {
2304
2304
  hasRequiredValidate = 1;
2305
2305
  Object.defineProperty(validate, "__esModule", { value: true });
2306
2306
  validate.getData = validate.KeywordCxt = validate.validateFunctionCode = void 0;
2307
- const boolSchema_1 = requireBoolSchema();
2308
- const dataType_1 = requireDataType();
2309
- const applicability_1 = requireApplicability();
2310
- const dataType_2 = requireDataType();
2311
- const defaults_1 = requireDefaults();
2312
- const keyword_1 = requireKeyword();
2313
- const subschema_1 = requireSubschema();
2314
- const codegen_1 = requireCodegen();
2315
- const names_1 = requireNames();
2316
- const resolve_1 = requireResolve();
2317
- const util_1 = requireUtil();
2318
- const errors_1 = requireErrors();
2307
+ const boolSchema_1 = /* @__PURE__ */ requireBoolSchema();
2308
+ const dataType_1 = /* @__PURE__ */ requireDataType();
2309
+ const applicability_1 = /* @__PURE__ */ requireApplicability();
2310
+ const dataType_2 = /* @__PURE__ */ requireDataType();
2311
+ const defaults_1 = /* @__PURE__ */ requireDefaults();
2312
+ const keyword_1 = /* @__PURE__ */ requireKeyword();
2313
+ const subschema_1 = /* @__PURE__ */ requireSubschema();
2314
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
2315
+ const names_1 = /* @__PURE__ */ requireNames();
2316
+ const resolve_1 = /* @__PURE__ */ requireResolve();
2317
+ const util_1 = /* @__PURE__ */ requireUtil();
2318
+ const errors_1 = /* @__PURE__ */ requireErrors();
2319
2319
  function validateFunctionCode(it) {
2320
2320
  if (isSchemaObj(it)) {
2321
2321
  checkKeywords(it);
@@ -2826,7 +2826,7 @@ function requireRef_error() {
2826
2826
  if (hasRequiredRef_error) return ref_error;
2827
2827
  hasRequiredRef_error = 1;
2828
2828
  Object.defineProperty(ref_error, "__esModule", { value: true });
2829
- const resolve_1 = requireResolve();
2829
+ const resolve_1 = /* @__PURE__ */ requireResolve();
2830
2830
  class MissingRefError extends Error {
2831
2831
  constructor(resolver, baseId, ref2, msg) {
2832
2832
  super(msg || `can't resolve reference ${ref2} from id ${baseId}`);
@@ -2844,12 +2844,12 @@ function requireCompile() {
2844
2844
  hasRequiredCompile = 1;
2845
2845
  Object.defineProperty(compile, "__esModule", { value: true });
2846
2846
  compile.resolveSchema = compile.getCompilingSchema = compile.resolveRef = compile.compileSchema = compile.SchemaEnv = void 0;
2847
- const codegen_1 = requireCodegen();
2848
- const validation_error_1 = requireValidation_error();
2849
- const names_1 = requireNames();
2850
- const resolve_1 = requireResolve();
2851
- const util_1 = requireUtil();
2852
- const validate_1 = requireValidate();
2847
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
2848
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
2849
+ const names_1 = /* @__PURE__ */ requireNames();
2850
+ const resolve_1 = /* @__PURE__ */ requireResolve();
2851
+ const util_1 = /* @__PURE__ */ requireUtil();
2852
+ const validate_1 = /* @__PURE__ */ requireValidate();
2853
2853
  class SchemaEnv {
2854
2854
  constructor(env) {
2855
2855
  var _a10;
@@ -3815,11 +3815,11 @@ function requireCore$1() {
3815
3815
  (function(exports) {
3816
3816
  Object.defineProperty(exports, "__esModule", { value: true });
3817
3817
  exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
3818
- var validate_1 = requireValidate();
3818
+ var validate_1 = /* @__PURE__ */ requireValidate();
3819
3819
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
3820
3820
  return validate_1.KeywordCxt;
3821
3821
  } });
3822
- var codegen_1 = requireCodegen();
3822
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
3823
3823
  Object.defineProperty(exports, "_", { enumerable: true, get: function() {
3824
3824
  return codegen_1._;
3825
3825
  } });
@@ -3838,16 +3838,16 @@ function requireCore$1() {
3838
3838
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
3839
3839
  return codegen_1.CodeGen;
3840
3840
  } });
3841
- const validation_error_1 = requireValidation_error();
3842
- const ref_error_1 = requireRef_error();
3843
- const rules_1 = requireRules();
3844
- const compile_1 = requireCompile();
3845
- const codegen_2 = requireCodegen();
3846
- const resolve_1 = requireResolve();
3847
- const dataType_1 = requireDataType();
3848
- const util_1 = requireUtil();
3841
+ const validation_error_1 = /* @__PURE__ */ requireValidation_error();
3842
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
3843
+ const rules_1 = /* @__PURE__ */ requireRules();
3844
+ const compile_1 = /* @__PURE__ */ requireCompile();
3845
+ const codegen_2 = /* @__PURE__ */ requireCodegen();
3846
+ const resolve_1 = /* @__PURE__ */ requireResolve();
3847
+ const dataType_1 = /* @__PURE__ */ requireDataType();
3848
+ const util_1 = /* @__PURE__ */ requireUtil();
3849
3849
  const $dataRefSchema = require$$9;
3850
- const uri_1 = requireUri();
3850
+ const uri_1 = /* @__PURE__ */ requireUri();
3851
3851
  const defaultRegExp = (str, flags) => new RegExp(str, flags);
3852
3852
  defaultRegExp.code = "new RegExp";
3853
3853
  const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
@@ -4444,12 +4444,12 @@ function requireRef() {
4444
4444
  hasRequiredRef = 1;
4445
4445
  Object.defineProperty(ref, "__esModule", { value: true });
4446
4446
  ref.callRef = ref.getValidate = void 0;
4447
- const ref_error_1 = requireRef_error();
4448
- const code_1 = requireCode();
4449
- const codegen_1 = requireCodegen();
4450
- const names_1 = requireNames();
4451
- const compile_1 = requireCompile();
4452
- const util_1 = requireUtil();
4447
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
4448
+ const code_1 = /* @__PURE__ */ requireCode();
4449
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4450
+ const names_1 = /* @__PURE__ */ requireNames();
4451
+ const compile_1 = /* @__PURE__ */ requireCompile();
4452
+ const util_1 = /* @__PURE__ */ requireUtil();
4453
4453
  const def = {
4454
4454
  keyword: "$ref",
4455
4455
  schemaType: "string",
@@ -4564,8 +4564,8 @@ function requireCore() {
4564
4564
  if (hasRequiredCore) return core;
4565
4565
  hasRequiredCore = 1;
4566
4566
  Object.defineProperty(core, "__esModule", { value: true });
4567
- const id_1 = requireId();
4568
- const ref_1 = requireRef();
4567
+ const id_1 = /* @__PURE__ */ requireId();
4568
+ const ref_1 = /* @__PURE__ */ requireRef();
4569
4569
  const core$12 = [
4570
4570
  "$schema",
4571
4571
  "$id",
@@ -4586,7 +4586,7 @@ function requireLimitNumber() {
4586
4586
  if (hasRequiredLimitNumber) return limitNumber;
4587
4587
  hasRequiredLimitNumber = 1;
4588
4588
  Object.defineProperty(limitNumber, "__esModule", { value: true });
4589
- const codegen_1 = requireCodegen();
4589
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4590
4590
  const ops = codegen_1.operators;
4591
4591
  const KWDs = {
4592
4592
  maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
@@ -4618,7 +4618,7 @@ function requireMultipleOf() {
4618
4618
  if (hasRequiredMultipleOf) return multipleOf;
4619
4619
  hasRequiredMultipleOf = 1;
4620
4620
  Object.defineProperty(multipleOf, "__esModule", { value: true });
4621
- const codegen_1 = requireCodegen();
4621
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4622
4622
  const error = {
4623
4623
  message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
4624
4624
  params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
@@ -4672,9 +4672,9 @@ function requireLimitLength() {
4672
4672
  if (hasRequiredLimitLength) return limitLength;
4673
4673
  hasRequiredLimitLength = 1;
4674
4674
  Object.defineProperty(limitLength, "__esModule", { value: true });
4675
- const codegen_1 = requireCodegen();
4676
- const util_1 = requireUtil();
4677
- const ucs2length_1 = requireUcs2length();
4675
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4676
+ const util_1 = /* @__PURE__ */ requireUtil();
4677
+ const ucs2length_1 = /* @__PURE__ */ requireUcs2length();
4678
4678
  const error = {
4679
4679
  message({ keyword: keyword2, schemaCode }) {
4680
4680
  const comp = keyword2 === "maxLength" ? "more" : "fewer";
@@ -4704,8 +4704,9 @@ function requirePattern() {
4704
4704
  if (hasRequiredPattern) return pattern;
4705
4705
  hasRequiredPattern = 1;
4706
4706
  Object.defineProperty(pattern, "__esModule", { value: true });
4707
- const code_1 = requireCode();
4708
- const codegen_1 = requireCodegen();
4707
+ const code_1 = /* @__PURE__ */ requireCode();
4708
+ const util_1 = /* @__PURE__ */ requireUtil();
4709
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4709
4710
  const error = {
4710
4711
  message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
4711
4712
  params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
@@ -4717,10 +4718,18 @@ function requirePattern() {
4717
4718
  $data: true,
4718
4719
  error,
4719
4720
  code(cxt) {
4720
- const { data, $data, schema, schemaCode, it } = cxt;
4721
+ const { gen, data, $data, schema, schemaCode, it } = cxt;
4721
4722
  const u = it.opts.unicodeRegExp ? "u" : "";
4722
- const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema);
4723
- cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4723
+ if ($data) {
4724
+ const { regExp } = it.opts.code;
4725
+ const regExpCode = regExp.code === "new RegExp" ? (0, codegen_1._)`new RegExp` : (0, util_1.useFunc)(gen, regExp);
4726
+ const valid = gen.let("valid");
4727
+ gen.try(() => gen.assign(valid, (0, codegen_1._)`${regExpCode}(${schemaCode}, ${u}).test(${data})`), () => gen.assign(valid, false));
4728
+ cxt.fail$data((0, codegen_1._)`!${valid}`);
4729
+ } else {
4730
+ const regExp = (0, code_1.usePattern)(cxt, schema);
4731
+ cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
4732
+ }
4724
4733
  }
4725
4734
  };
4726
4735
  pattern.default = def;
@@ -4732,7 +4741,7 @@ function requireLimitProperties() {
4732
4741
  if (hasRequiredLimitProperties) return limitProperties;
4733
4742
  hasRequiredLimitProperties = 1;
4734
4743
  Object.defineProperty(limitProperties, "__esModule", { value: true });
4735
- const codegen_1 = requireCodegen();
4744
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4736
4745
  const error = {
4737
4746
  message({ keyword: keyword2, schemaCode }) {
4738
4747
  const comp = keyword2 === "maxProperties" ? "more" : "fewer";
@@ -4761,9 +4770,9 @@ function requireRequired() {
4761
4770
  if (hasRequiredRequired) return required$1;
4762
4771
  hasRequiredRequired = 1;
4763
4772
  Object.defineProperty(required$1, "__esModule", { value: true });
4764
- const code_1 = requireCode();
4765
- const codegen_1 = requireCodegen();
4766
- const util_1 = requireUtil();
4773
+ const code_1 = /* @__PURE__ */ requireCode();
4774
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4775
+ const util_1 = /* @__PURE__ */ requireUtil();
4767
4776
  const error = {
4768
4777
  message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
4769
4778
  params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
@@ -4843,7 +4852,7 @@ function requireLimitItems() {
4843
4852
  if (hasRequiredLimitItems) return limitItems;
4844
4853
  hasRequiredLimitItems = 1;
4845
4854
  Object.defineProperty(limitItems, "__esModule", { value: true });
4846
- const codegen_1 = requireCodegen();
4855
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4847
4856
  const error = {
4848
4857
  message({ keyword: keyword2, schemaCode }) {
4849
4858
  const comp = keyword2 === "maxItems" ? "more" : "fewer";
@@ -4883,10 +4892,10 @@ function requireUniqueItems() {
4883
4892
  if (hasRequiredUniqueItems) return uniqueItems;
4884
4893
  hasRequiredUniqueItems = 1;
4885
4894
  Object.defineProperty(uniqueItems, "__esModule", { value: true });
4886
- const dataType_1 = requireDataType();
4887
- const codegen_1 = requireCodegen();
4888
- const util_1 = requireUtil();
4889
- const equal_1 = requireEqual();
4895
+ const dataType_1 = /* @__PURE__ */ requireDataType();
4896
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4897
+ const util_1 = /* @__PURE__ */ requireUtil();
4898
+ const equal_1 = /* @__PURE__ */ requireEqual();
4890
4899
  const error = {
4891
4900
  message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
4892
4901
  params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
@@ -4950,9 +4959,9 @@ function require_const() {
4950
4959
  if (hasRequired_const) return _const;
4951
4960
  hasRequired_const = 1;
4952
4961
  Object.defineProperty(_const, "__esModule", { value: true });
4953
- const codegen_1 = requireCodegen();
4954
- const util_1 = requireUtil();
4955
- const equal_1 = requireEqual();
4962
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4963
+ const util_1 = /* @__PURE__ */ requireUtil();
4964
+ const equal_1 = /* @__PURE__ */ requireEqual();
4956
4965
  const error = {
4957
4966
  message: "must be equal to constant",
4958
4967
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
@@ -4979,9 +4988,9 @@ function require_enum() {
4979
4988
  if (hasRequired_enum) return _enum$1;
4980
4989
  hasRequired_enum = 1;
4981
4990
  Object.defineProperty(_enum$1, "__esModule", { value: true });
4982
- const codegen_1 = requireCodegen();
4983
- const util_1 = requireUtil();
4984
- const equal_1 = requireEqual();
4991
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
4992
+ const util_1 = /* @__PURE__ */ requireUtil();
4993
+ const equal_1 = /* @__PURE__ */ requireEqual();
4985
4994
  const error = {
4986
4995
  message: "must be equal to one of the allowed values",
4987
4996
  params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
@@ -5027,16 +5036,16 @@ function requireValidation() {
5027
5036
  if (hasRequiredValidation) return validation;
5028
5037
  hasRequiredValidation = 1;
5029
5038
  Object.defineProperty(validation, "__esModule", { value: true });
5030
- const limitNumber_1 = requireLimitNumber();
5031
- const multipleOf_1 = requireMultipleOf();
5032
- const limitLength_1 = requireLimitLength();
5033
- const pattern_1 = requirePattern();
5034
- const limitProperties_1 = requireLimitProperties();
5035
- const required_1 = requireRequired();
5036
- const limitItems_1 = requireLimitItems();
5037
- const uniqueItems_1 = requireUniqueItems();
5038
- const const_1 = require_const();
5039
- const enum_1 = require_enum();
5039
+ const limitNumber_1 = /* @__PURE__ */ requireLimitNumber();
5040
+ const multipleOf_1 = /* @__PURE__ */ requireMultipleOf();
5041
+ const limitLength_1 = /* @__PURE__ */ requireLimitLength();
5042
+ const pattern_1 = /* @__PURE__ */ requirePattern();
5043
+ const limitProperties_1 = /* @__PURE__ */ requireLimitProperties();
5044
+ const required_1 = /* @__PURE__ */ requireRequired();
5045
+ const limitItems_1 = /* @__PURE__ */ requireLimitItems();
5046
+ const uniqueItems_1 = /* @__PURE__ */ requireUniqueItems();
5047
+ const const_1 = /* @__PURE__ */ require_const();
5048
+ const enum_1 = /* @__PURE__ */ require_enum();
5040
5049
  const validation$1 = [
5041
5050
  // number
5042
5051
  limitNumber_1.default,
@@ -5067,8 +5076,8 @@ function requireAdditionalItems() {
5067
5076
  hasRequiredAdditionalItems = 1;
5068
5077
  Object.defineProperty(additionalItems, "__esModule", { value: true });
5069
5078
  additionalItems.validateAdditionalItems = void 0;
5070
- const codegen_1 = requireCodegen();
5071
- const util_1 = requireUtil();
5079
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5080
+ const util_1 = /* @__PURE__ */ requireUtil();
5072
5081
  const error = {
5073
5082
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5074
5083
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
@@ -5121,9 +5130,9 @@ function requireItems() {
5121
5130
  hasRequiredItems = 1;
5122
5131
  Object.defineProperty(items, "__esModule", { value: true });
5123
5132
  items.validateTuple = void 0;
5124
- const codegen_1 = requireCodegen();
5125
- const util_1 = requireUtil();
5126
- const code_1 = requireCode();
5133
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5134
+ const util_1 = /* @__PURE__ */ requireUtil();
5135
+ const code_1 = /* @__PURE__ */ requireCode();
5127
5136
  const def = {
5128
5137
  keyword: "items",
5129
5138
  type: "array",
@@ -5176,7 +5185,7 @@ function requirePrefixItems() {
5176
5185
  if (hasRequiredPrefixItems) return prefixItems;
5177
5186
  hasRequiredPrefixItems = 1;
5178
5187
  Object.defineProperty(prefixItems, "__esModule", { value: true });
5179
- const items_1 = requireItems();
5188
+ const items_1 = /* @__PURE__ */ requireItems();
5180
5189
  const def = {
5181
5190
  keyword: "prefixItems",
5182
5191
  type: "array",
@@ -5193,10 +5202,10 @@ function requireItems2020() {
5193
5202
  if (hasRequiredItems2020) return items2020;
5194
5203
  hasRequiredItems2020 = 1;
5195
5204
  Object.defineProperty(items2020, "__esModule", { value: true });
5196
- const codegen_1 = requireCodegen();
5197
- const util_1 = requireUtil();
5198
- const code_1 = requireCode();
5199
- const additionalItems_1 = requireAdditionalItems();
5205
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5206
+ const util_1 = /* @__PURE__ */ requireUtil();
5207
+ const code_1 = /* @__PURE__ */ requireCode();
5208
+ const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
5200
5209
  const error = {
5201
5210
  message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
5202
5211
  params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
@@ -5228,8 +5237,8 @@ function requireContains() {
5228
5237
  if (hasRequiredContains) return contains;
5229
5238
  hasRequiredContains = 1;
5230
5239
  Object.defineProperty(contains, "__esModule", { value: true });
5231
- const codegen_1 = requireCodegen();
5232
- const util_1 = requireUtil();
5240
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5241
+ const util_1 = /* @__PURE__ */ requireUtil();
5233
5242
  const error = {
5234
5243
  message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
5235
5244
  params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
@@ -5324,9 +5333,9 @@ function requireDependencies() {
5324
5333
  (function(exports) {
5325
5334
  Object.defineProperty(exports, "__esModule", { value: true });
5326
5335
  exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0;
5327
- const codegen_1 = requireCodegen();
5328
- const util_1 = requireUtil();
5329
- const code_1 = requireCode();
5336
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5337
+ const util_1 = /* @__PURE__ */ requireUtil();
5338
+ const code_1 = /* @__PURE__ */ requireCode();
5330
5339
  exports.error = {
5331
5340
  message: ({ params: { property, depsCount, deps } }) => {
5332
5341
  const property_ies = depsCount === 1 ? "property" : "properties";
@@ -5418,8 +5427,8 @@ function requirePropertyNames() {
5418
5427
  if (hasRequiredPropertyNames) return propertyNames;
5419
5428
  hasRequiredPropertyNames = 1;
5420
5429
  Object.defineProperty(propertyNames, "__esModule", { value: true });
5421
- const codegen_1 = requireCodegen();
5422
- const util_1 = requireUtil();
5430
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5431
+ const util_1 = /* @__PURE__ */ requireUtil();
5423
5432
  const error = {
5424
5433
  message: "property name must be valid",
5425
5434
  params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
@@ -5461,10 +5470,10 @@ function requireAdditionalProperties() {
5461
5470
  if (hasRequiredAdditionalProperties) return additionalProperties;
5462
5471
  hasRequiredAdditionalProperties = 1;
5463
5472
  Object.defineProperty(additionalProperties, "__esModule", { value: true });
5464
- const code_1 = requireCode();
5465
- const codegen_1 = requireCodegen();
5466
- const names_1 = requireNames();
5467
- const util_1 = requireUtil();
5473
+ const code_1 = /* @__PURE__ */ requireCode();
5474
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5475
+ const names_1 = /* @__PURE__ */ requireNames();
5476
+ const util_1 = /* @__PURE__ */ requireUtil();
5468
5477
  const error = {
5469
5478
  message: "must NOT have additional properties",
5470
5479
  params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
@@ -5567,10 +5576,10 @@ function requireProperties() {
5567
5576
  if (hasRequiredProperties) return properties$1;
5568
5577
  hasRequiredProperties = 1;
5569
5578
  Object.defineProperty(properties$1, "__esModule", { value: true });
5570
- const validate_1 = requireValidate();
5571
- const code_1 = requireCode();
5572
- const util_1 = requireUtil();
5573
- const additionalProperties_1 = requireAdditionalProperties();
5579
+ const validate_1 = /* @__PURE__ */ requireValidate();
5580
+ const code_1 = /* @__PURE__ */ requireCode();
5581
+ const util_1 = /* @__PURE__ */ requireUtil();
5582
+ const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
5574
5583
  const def = {
5575
5584
  keyword: "properties",
5576
5585
  type: "object",
@@ -5625,10 +5634,10 @@ function requirePatternProperties() {
5625
5634
  if (hasRequiredPatternProperties) return patternProperties;
5626
5635
  hasRequiredPatternProperties = 1;
5627
5636
  Object.defineProperty(patternProperties, "__esModule", { value: true });
5628
- const code_1 = requireCode();
5629
- const codegen_1 = requireCodegen();
5630
- const util_1 = requireUtil();
5631
- const util_2 = requireUtil();
5637
+ const code_1 = /* @__PURE__ */ requireCode();
5638
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5639
+ const util_1 = /* @__PURE__ */ requireUtil();
5640
+ const util_2 = /* @__PURE__ */ requireUtil();
5632
5641
  const def = {
5633
5642
  keyword: "patternProperties",
5634
5643
  type: "object",
@@ -5699,7 +5708,7 @@ function requireNot() {
5699
5708
  if (hasRequiredNot) return not;
5700
5709
  hasRequiredNot = 1;
5701
5710
  Object.defineProperty(not, "__esModule", { value: true });
5702
- const util_1 = requireUtil();
5711
+ const util_1 = /* @__PURE__ */ requireUtil();
5703
5712
  const def = {
5704
5713
  keyword: "not",
5705
5714
  schemaType: ["object", "boolean"],
@@ -5730,7 +5739,7 @@ function requireAnyOf() {
5730
5739
  if (hasRequiredAnyOf) return anyOf;
5731
5740
  hasRequiredAnyOf = 1;
5732
5741
  Object.defineProperty(anyOf, "__esModule", { value: true });
5733
- const code_1 = requireCode();
5742
+ const code_1 = /* @__PURE__ */ requireCode();
5734
5743
  const def = {
5735
5744
  keyword: "anyOf",
5736
5745
  schemaType: "array",
@@ -5747,8 +5756,8 @@ function requireOneOf() {
5747
5756
  if (hasRequiredOneOf) return oneOf;
5748
5757
  hasRequiredOneOf = 1;
5749
5758
  Object.defineProperty(oneOf, "__esModule", { value: true });
5750
- const codegen_1 = requireCodegen();
5751
- const util_1 = requireUtil();
5759
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5760
+ const util_1 = /* @__PURE__ */ requireUtil();
5752
5761
  const error = {
5753
5762
  message: "must match exactly one schema in oneOf",
5754
5763
  params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
@@ -5805,7 +5814,7 @@ function requireAllOf() {
5805
5814
  if (hasRequiredAllOf) return allOf;
5806
5815
  hasRequiredAllOf = 1;
5807
5816
  Object.defineProperty(allOf, "__esModule", { value: true });
5808
- const util_1 = requireUtil();
5817
+ const util_1 = /* @__PURE__ */ requireUtil();
5809
5818
  const def = {
5810
5819
  keyword: "allOf",
5811
5820
  schemaType: "array",
@@ -5832,8 +5841,8 @@ function require_if() {
5832
5841
  if (hasRequired_if) return _if;
5833
5842
  hasRequired_if = 1;
5834
5843
  Object.defineProperty(_if, "__esModule", { value: true });
5835
- const codegen_1 = requireCodegen();
5836
- const util_1 = requireUtil();
5844
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5845
+ const util_1 = /* @__PURE__ */ requireUtil();
5837
5846
  const error = {
5838
5847
  message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
5839
5848
  params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
@@ -5901,7 +5910,7 @@ function requireThenElse() {
5901
5910
  if (hasRequiredThenElse) return thenElse;
5902
5911
  hasRequiredThenElse = 1;
5903
5912
  Object.defineProperty(thenElse, "__esModule", { value: true });
5904
- const util_1 = requireUtil();
5913
+ const util_1 = /* @__PURE__ */ requireUtil();
5905
5914
  const def = {
5906
5915
  keyword: ["then", "else"],
5907
5916
  schemaType: ["object", "boolean"],
@@ -5918,22 +5927,22 @@ function requireApplicator() {
5918
5927
  if (hasRequiredApplicator) return applicator;
5919
5928
  hasRequiredApplicator = 1;
5920
5929
  Object.defineProperty(applicator, "__esModule", { value: true });
5921
- const additionalItems_1 = requireAdditionalItems();
5922
- const prefixItems_1 = requirePrefixItems();
5923
- const items_1 = requireItems();
5924
- const items2020_1 = requireItems2020();
5925
- const contains_1 = requireContains();
5926
- const dependencies_1 = requireDependencies();
5927
- const propertyNames_1 = requirePropertyNames();
5928
- const additionalProperties_1 = requireAdditionalProperties();
5929
- const properties_1 = requireProperties();
5930
- const patternProperties_1 = requirePatternProperties();
5931
- const not_1 = requireNot();
5932
- const anyOf_1 = requireAnyOf();
5933
- const oneOf_1 = requireOneOf();
5934
- const allOf_1 = requireAllOf();
5935
- const if_1 = require_if();
5936
- const thenElse_1 = requireThenElse();
5930
+ const additionalItems_1 = /* @__PURE__ */ requireAdditionalItems();
5931
+ const prefixItems_1 = /* @__PURE__ */ requirePrefixItems();
5932
+ const items_1 = /* @__PURE__ */ requireItems();
5933
+ const items2020_1 = /* @__PURE__ */ requireItems2020();
5934
+ const contains_1 = /* @__PURE__ */ requireContains();
5935
+ const dependencies_1 = /* @__PURE__ */ requireDependencies();
5936
+ const propertyNames_1 = /* @__PURE__ */ requirePropertyNames();
5937
+ const additionalProperties_1 = /* @__PURE__ */ requireAdditionalProperties();
5938
+ const properties_1 = /* @__PURE__ */ requireProperties();
5939
+ const patternProperties_1 = /* @__PURE__ */ requirePatternProperties();
5940
+ const not_1 = /* @__PURE__ */ requireNot();
5941
+ const anyOf_1 = /* @__PURE__ */ requireAnyOf();
5942
+ const oneOf_1 = /* @__PURE__ */ requireOneOf();
5943
+ const allOf_1 = /* @__PURE__ */ requireAllOf();
5944
+ const if_1 = /* @__PURE__ */ require_if();
5945
+ const thenElse_1 = /* @__PURE__ */ requireThenElse();
5937
5946
  function getApplicator(draft2020 = false) {
5938
5947
  const applicator2 = [
5939
5948
  // any
@@ -5967,7 +5976,7 @@ function requireFormat$1() {
5967
5976
  if (hasRequiredFormat$1) return format;
5968
5977
  hasRequiredFormat$1 = 1;
5969
5978
  Object.defineProperty(format, "__esModule", { value: true });
5970
- const codegen_1 = requireCodegen();
5979
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
5971
5980
  const error = {
5972
5981
  message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
5973
5982
  params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
@@ -6056,7 +6065,7 @@ function requireFormat() {
6056
6065
  if (hasRequiredFormat) return format$1;
6057
6066
  hasRequiredFormat = 1;
6058
6067
  Object.defineProperty(format$1, "__esModule", { value: true });
6059
- const format_1 = requireFormat$1();
6068
+ const format_1 = /* @__PURE__ */ requireFormat$1();
6060
6069
  const format2 = [format_1.default];
6061
6070
  format$1.default = format2;
6062
6071
  return format$1;
@@ -6089,11 +6098,11 @@ function requireDraft7() {
6089
6098
  if (hasRequiredDraft7) return draft7;
6090
6099
  hasRequiredDraft7 = 1;
6091
6100
  Object.defineProperty(draft7, "__esModule", { value: true });
6092
- const core_1 = requireCore();
6093
- const validation_1 = requireValidation();
6094
- const applicator_1 = requireApplicator();
6095
- const format_1 = requireFormat();
6096
- const metadata_1 = requireMetadata();
6101
+ const core_1 = /* @__PURE__ */ requireCore();
6102
+ const validation_1 = /* @__PURE__ */ requireValidation();
6103
+ const applicator_1 = /* @__PURE__ */ requireApplicator();
6104
+ const format_1 = /* @__PURE__ */ requireFormat();
6105
+ const metadata_1 = /* @__PURE__ */ requireMetadata();
6097
6106
  const draft7Vocabularies = [
6098
6107
  core_1.default,
6099
6108
  validation_1.default,
@@ -6125,11 +6134,11 @@ function requireDiscriminator() {
6125
6134
  if (hasRequiredDiscriminator) return discriminator;
6126
6135
  hasRequiredDiscriminator = 1;
6127
6136
  Object.defineProperty(discriminator, "__esModule", { value: true });
6128
- const codegen_1 = requireCodegen();
6129
- const types_1 = requireTypes();
6130
- const compile_1 = requireCompile();
6131
- const ref_error_1 = requireRef_error();
6132
- const util_1 = requireUtil();
6137
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
6138
+ const types_1 = /* @__PURE__ */ requireTypes();
6139
+ const compile_1 = /* @__PURE__ */ requireCompile();
6140
+ const ref_error_1 = /* @__PURE__ */ requireRef_error();
6141
+ const util_1 = /* @__PURE__ */ requireUtil();
6133
6142
  const error = {
6134
6143
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
6135
6144
  params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
@@ -6246,9 +6255,9 @@ function requireAjv() {
6246
6255
  (function(module, exports) {
6247
6256
  Object.defineProperty(exports, "__esModule", { value: true });
6248
6257
  exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
6249
- const core_1 = requireCore$1();
6250
- const draft7_1 = requireDraft7();
6251
- const discriminator_1 = requireDiscriminator();
6258
+ const core_1 = /* @__PURE__ */ requireCore$1();
6259
+ const draft7_1 = /* @__PURE__ */ requireDraft7();
6260
+ const discriminator_1 = /* @__PURE__ */ requireDiscriminator();
6252
6261
  const draft7MetaSchema = require$$3;
6253
6262
  const META_SUPPORT_DATA = ["/properties"];
6254
6263
  const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
@@ -6276,11 +6285,11 @@ function requireAjv() {
6276
6285
  module.exports.Ajv = Ajv2;
6277
6286
  Object.defineProperty(exports, "__esModule", { value: true });
6278
6287
  exports.default = Ajv2;
6279
- var validate_1 = requireValidate();
6288
+ var validate_1 = /* @__PURE__ */ requireValidate();
6280
6289
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
6281
6290
  return validate_1.KeywordCxt;
6282
6291
  } });
6283
- var codegen_1 = requireCodegen();
6292
+ var codegen_1 = /* @__PURE__ */ requireCodegen();
6284
6293
  Object.defineProperty(exports, "_", { enumerable: true, get: function() {
6285
6294
  return codegen_1._;
6286
6295
  } });
@@ -6299,18 +6308,18 @@ function requireAjv() {
6299
6308
  Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function() {
6300
6309
  return codegen_1.CodeGen;
6301
6310
  } });
6302
- var validation_error_1 = requireValidation_error();
6311
+ var validation_error_1 = /* @__PURE__ */ requireValidation_error();
6303
6312
  Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
6304
6313
  return validation_error_1.default;
6305
6314
  } });
6306
- var ref_error_1 = requireRef_error();
6315
+ var ref_error_1 = /* @__PURE__ */ requireRef_error();
6307
6316
  Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function() {
6308
6317
  return ref_error_1.default;
6309
6318
  } });
6310
6319
  })(ajv, ajv.exports);
6311
6320
  return ajv.exports;
6312
6321
  }
6313
- var ajvExports = requireAjv();
6322
+ var ajvExports = /* @__PURE__ */ requireAjv();
6314
6323
  const Ajv = /* @__PURE__ */ getDefaultExportFromCjs(ajvExports);
6315
6324
  var util;
6316
6325
  (function(util2) {
@@ -18621,8 +18630,8 @@ function requireLimit() {
18621
18630
  (function(exports) {
18622
18631
  Object.defineProperty(exports, "__esModule", { value: true });
18623
18632
  exports.formatLimitDefinition = void 0;
18624
- const ajv_1 = requireAjv();
18625
- const codegen_1 = requireCodegen();
18633
+ const ajv_1 = /* @__PURE__ */ requireAjv();
18634
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
18626
18635
  const ops = codegen_1.operators;
18627
18636
  const KWDs = {
18628
18637
  formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
@@ -18695,7 +18704,7 @@ function requireDist() {
18695
18704
  Object.defineProperty(exports, "__esModule", { value: true });
18696
18705
  const formats_1 = requireFormats();
18697
18706
  const limit_1 = requireLimit();
18698
- const codegen_1 = requireCodegen();
18707
+ const codegen_1 = /* @__PURE__ */ requireCodegen();
18699
18708
  const fullName = new codegen_1.Name("fullFormats");
18700
18709
  const fastName = new codegen_1.Name("fastFormats");
18701
18710
  const formatsPlugin = (ajv2, opts = { keywords: true }) => {
@@ -31193,17 +31202,14 @@ var GatewayVideoModel = class {
31193
31202
  var _a92;
31194
31203
  const resolvedHeaders = await resolve(this.config.headers());
31195
31204
  try {
31196
- const {
31197
- responseHeaders,
31198
- value: responseBody,
31199
- rawValue
31200
- } = await postJsonToApi$1({
31205
+ const { responseHeaders, value: responseBody } = await postJsonToApi$1({
31201
31206
  url: this.getUrl(),
31202
31207
  headers: combineHeaders$1(
31203
31208
  resolvedHeaders,
31204
31209
  headers != null ? headers : {},
31205
31210
  this.getModelConfigHeaders(),
31206
- await resolve(this.config.o11yHeaders)
31211
+ await resolve(this.config.o11yHeaders),
31212
+ { accept: "text/event-stream" }
31207
31213
  ),
31208
31214
  body: {
31209
31215
  prompt,
@@ -31216,9 +31222,70 @@ var GatewayVideoModel = class {
31216
31222
  ...providerOptions && { providerOptions },
31217
31223
  ...image && { image: maybeEncodeVideoFile(image) }
31218
31224
  },
31219
- successfulResponseHandler: createJsonResponseHandler$1(
31220
- gatewayVideoResponseSchema
31221
- ),
31225
+ successfulResponseHandler: async ({
31226
+ response,
31227
+ url: url2,
31228
+ requestBodyValues
31229
+ }) => {
31230
+ if (response.body == null) {
31231
+ throw new APICallError$1({
31232
+ message: "SSE response body is empty",
31233
+ url: url2,
31234
+ requestBodyValues,
31235
+ statusCode: response.status
31236
+ });
31237
+ }
31238
+ const eventStream = parseJsonEventStream$1({
31239
+ stream: response.body,
31240
+ schema: gatewayVideoEventSchema
31241
+ });
31242
+ const reader = eventStream.getReader();
31243
+ const { done, value: parseResult } = await reader.read();
31244
+ reader.releaseLock();
31245
+ if (done || !parseResult) {
31246
+ throw new APICallError$1({
31247
+ message: "SSE stream ended without a data event",
31248
+ url: url2,
31249
+ requestBodyValues,
31250
+ statusCode: response.status
31251
+ });
31252
+ }
31253
+ if (!parseResult.success) {
31254
+ throw new APICallError$1({
31255
+ message: "Failed to parse video SSE event",
31256
+ cause: parseResult.error,
31257
+ url: url2,
31258
+ requestBodyValues,
31259
+ statusCode: response.status
31260
+ });
31261
+ }
31262
+ const event = parseResult.value;
31263
+ if (event.type === "error") {
31264
+ throw new APICallError$1({
31265
+ message: event.message,
31266
+ statusCode: event.statusCode,
31267
+ url: url2,
31268
+ requestBodyValues,
31269
+ responseHeaders: Object.fromEntries([...response.headers]),
31270
+ responseBody: JSON.stringify(event),
31271
+ data: {
31272
+ error: {
31273
+ message: event.message,
31274
+ type: event.errorType,
31275
+ param: event.param
31276
+ }
31277
+ }
31278
+ });
31279
+ }
31280
+ return {
31281
+ value: {
31282
+ videos: event.videos,
31283
+ warnings: event.warnings,
31284
+ providerMetadata: event.providerMetadata
31285
+ },
31286
+ responseHeaders: Object.fromEntries([...response.headers])
31287
+ };
31288
+ },
31222
31289
  failedResponseHandler: createJsonErrorResponseHandler$1({
31223
31290
  errorSchema: any(),
31224
31291
  errorToMessage: (data) => data
@@ -31290,11 +31357,21 @@ var gatewayVideoWarningSchema = discriminatedUnion("type", [
31290
31357
  message: string()
31291
31358
  })
31292
31359
  ]);
31293
- var gatewayVideoResponseSchema = object$2({
31294
- videos: array$1(gatewayVideoDataSchema),
31295
- warnings: array$1(gatewayVideoWarningSchema).optional(),
31296
- providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
31297
- });
31360
+ var gatewayVideoEventSchema = discriminatedUnion("type", [
31361
+ object$2({
31362
+ type: literal("result"),
31363
+ videos: array$1(gatewayVideoDataSchema),
31364
+ warnings: array$1(gatewayVideoWarningSchema).optional(),
31365
+ providerMetadata: record(string(), providerMetadataEntrySchema2).optional()
31366
+ }),
31367
+ object$2({
31368
+ type: literal("error"),
31369
+ message: string(),
31370
+ errorType: string(),
31371
+ statusCode: number$1(),
31372
+ param: unknown().nullable()
31373
+ })
31374
+ ]);
31298
31375
  var parallelSearchInputSchema = lazySchema(
31299
31376
  () => zodSchema(
31300
31377
  objectType({
@@ -31471,7 +31548,7 @@ async function getVercelRequestId() {
31471
31548
  var _a92;
31472
31549
  return (_a92 = indexBrowserExports.getContext().headers) == null ? void 0 : _a92["x-vercel-id"];
31473
31550
  }
31474
- var VERSION$6 = "3.0.45";
31551
+ var VERSION$6 = "3.0.55";
31475
31552
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
31476
31553
  function createGatewayProvider(options = {}) {
31477
31554
  var _a92, _b9;
@@ -31514,13 +31591,18 @@ function createGatewayProvider(options = {}) {
31514
31591
  settingValue: void 0,
31515
31592
  environmentVariableName: "VERCEL_REGION"
31516
31593
  });
31594
+ const projectId = loadOptionalSetting({
31595
+ settingValue: void 0,
31596
+ environmentVariableName: "VERCEL_PROJECT_ID"
31597
+ });
31517
31598
  return async () => {
31518
31599
  const requestId = await getVercelRequestId();
31519
31600
  return {
31520
31601
  ...deploymentId && { "ai-o11y-deployment-id": deploymentId },
31521
31602
  ...environment && { "ai-o11y-environment": environment },
31522
31603
  ...region && { "ai-o11y-region": region },
31523
- ...requestId && { "ai-o11y-request-id": requestId }
31604
+ ...requestId && { "ai-o11y-request-id": requestId },
31605
+ ...projectId && { "ai-o11y-project-id": projectId }
31524
31606
  };
31525
31607
  };
31526
31608
  };
@@ -32899,7 +32981,7 @@ function detectMediaType({
32899
32981
  }
32900
32982
  return void 0;
32901
32983
  }
32902
- var VERSION$4 = "6.0.85";
32984
+ var VERSION$4 = "6.0.99";
32903
32985
  var download = async ({
32904
32986
  url: url2,
32905
32987
  maxBytes,
@@ -34324,6 +34406,10 @@ function collectToolApprovals({
34324
34406
  }
34325
34407
  return { approvedToolApprovals, deniedToolApprovals };
34326
34408
  }
34409
+ function now() {
34410
+ var _a21, _b9;
34411
+ return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
34412
+ }
34327
34413
  async function executeToolCall({
34328
34414
  toolCall,
34329
34415
  tools,
@@ -34332,13 +34418,27 @@ async function executeToolCall({
34332
34418
  messages,
34333
34419
  abortSignal,
34334
34420
  experimental_context,
34335
- onPreliminaryToolResult
34421
+ stepNumber,
34422
+ model,
34423
+ onPreliminaryToolResult,
34424
+ onToolCallStart,
34425
+ onToolCallFinish
34336
34426
  }) {
34337
34427
  const { toolName, toolCallId, input } = toolCall;
34338
34428
  const tool2 = tools == null ? void 0 : tools[toolName];
34339
34429
  if ((tool2 == null ? void 0 : tool2.execute) == null) {
34340
34430
  return void 0;
34341
34431
  }
34432
+ const baseCallbackEvent = {
34433
+ stepNumber,
34434
+ model,
34435
+ toolCall,
34436
+ messages,
34437
+ abortSignal,
34438
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
34439
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
34440
+ experimental_context
34441
+ };
34342
34442
  return recordSpan({
34343
34443
  name: "ai.toolCall",
34344
34444
  attributes: selectTelemetryAttributes({
@@ -34358,6 +34458,11 @@ async function executeToolCall({
34358
34458
  tracer,
34359
34459
  fn: async (span) => {
34360
34460
  let output;
34461
+ try {
34462
+ await (onToolCallStart == null ? void 0 : onToolCallStart(baseCallbackEvent));
34463
+ } catch (_ignored) {
34464
+ }
34465
+ const startTime = now();
34361
34466
  try {
34362
34467
  const stream = executeTool({
34363
34468
  execute: tool2.execute.bind(tool2),
@@ -34382,6 +34487,16 @@ async function executeToolCall({
34382
34487
  }
34383
34488
  }
34384
34489
  } catch (error) {
34490
+ const durationMs2 = now() - startTime;
34491
+ try {
34492
+ await (onToolCallFinish == null ? void 0 : onToolCallFinish({
34493
+ ...baseCallbackEvent,
34494
+ success: false,
34495
+ error,
34496
+ durationMs: durationMs2
34497
+ }));
34498
+ } catch (_ignored) {
34499
+ }
34385
34500
  recordErrorOnSpan(span, error);
34386
34501
  return {
34387
34502
  type: "tool-error",
@@ -34393,6 +34508,16 @@ async function executeToolCall({
34393
34508
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
34394
34509
  };
34395
34510
  }
34511
+ const durationMs = now() - startTime;
34512
+ try {
34513
+ await (onToolCallFinish == null ? void 0 : onToolCallFinish({
34514
+ ...baseCallbackEvent,
34515
+ success: true,
34516
+ output,
34517
+ durationMs
34518
+ }));
34519
+ } catch (_ignored) {
34520
+ }
34396
34521
  try {
34397
34522
  span.setAttributes(
34398
34523
  await selectTelemetryAttributes({
@@ -35256,6 +35381,11 @@ async function doParseToolCall({
35256
35381
  }
35257
35382
  var DefaultStepResult = class {
35258
35383
  constructor({
35384
+ stepNumber,
35385
+ model,
35386
+ functionId,
35387
+ metadata: metadata2,
35388
+ experimental_context,
35259
35389
  content,
35260
35390
  finishReason,
35261
35391
  rawFinishReason,
@@ -35265,6 +35395,11 @@ var DefaultStepResult = class {
35265
35395
  response,
35266
35396
  providerMetadata
35267
35397
  }) {
35398
+ this.stepNumber = stepNumber;
35399
+ this.model = model;
35400
+ this.functionId = functionId;
35401
+ this.metadata = metadata2;
35402
+ this.experimental_context = experimental_context;
35268
35403
  this.content = content;
35269
35404
  this.finishReason = finishReason;
35270
35405
  this.rawFinishReason = rawFinishReason;
@@ -35506,6 +35641,10 @@ async function generateText({
35506
35641
  experimental_context,
35507
35642
  experimental_include: include,
35508
35643
  _internal: { generateId: generateId2 = originalGenerateId } = {},
35644
+ experimental_onStart: onStart,
35645
+ experimental_onStepStart: onStepStart,
35646
+ experimental_onToolCallStart: onToolCallStart,
35647
+ experimental_onToolCallFinish: onToolCallFinish,
35509
35648
  onStepFinish,
35510
35649
  onFinish,
35511
35650
  ...settings
@@ -35535,11 +35674,43 @@ async function generateText({
35535
35674
  headers: headersWithUserAgent,
35536
35675
  settings: { ...callSettings, maxRetries }
35537
35676
  });
35677
+ const modelInfo = { provider: model.provider, modelId: model.modelId };
35538
35678
  const initialPrompt = await standardizePrompt({
35539
35679
  system,
35540
35680
  prompt,
35541
35681
  messages
35542
35682
  });
35683
+ try {
35684
+ await (onStart == null ? void 0 : onStart({
35685
+ model: modelInfo,
35686
+ system,
35687
+ prompt,
35688
+ messages,
35689
+ tools,
35690
+ toolChoice,
35691
+ activeTools,
35692
+ maxOutputTokens: callSettings.maxOutputTokens,
35693
+ temperature: callSettings.temperature,
35694
+ topP: callSettings.topP,
35695
+ topK: callSettings.topK,
35696
+ presencePenalty: callSettings.presencePenalty,
35697
+ frequencyPenalty: callSettings.frequencyPenalty,
35698
+ stopSequences: callSettings.stopSequences,
35699
+ seed: callSettings.seed,
35700
+ maxRetries,
35701
+ timeout,
35702
+ headers,
35703
+ providerOptions,
35704
+ stopWhen,
35705
+ output,
35706
+ abortSignal,
35707
+ include,
35708
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
35709
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
35710
+ experimental_context
35711
+ }));
35712
+ } catch (_ignored) {
35713
+ }
35543
35714
  const tracer = getTracer(telemetry);
35544
35715
  try {
35545
35716
  return await recordSpan({
@@ -35563,7 +35734,7 @@ async function generateText({
35563
35734
  }),
35564
35735
  tracer,
35565
35736
  fn: async (span) => {
35566
- var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k;
35737
+ var _a21, _b9, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
35567
35738
  const initialMessages = initialPrompt.messages;
35568
35739
  const responseMessages = [];
35569
35740
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -35580,7 +35751,11 @@ async function generateText({
35580
35751
  telemetry,
35581
35752
  messages: initialMessages,
35582
35753
  abortSignal: mergedAbortSignal,
35583
- experimental_context
35754
+ experimental_context,
35755
+ stepNumber: 0,
35756
+ model: modelInfo,
35757
+ onToolCallStart,
35758
+ onToolCallFinish
35584
35759
  });
35585
35760
  const toolContent = [];
35586
35761
  for (const output2 of toolOutputs) {
@@ -35660,6 +35835,10 @@ async function generateText({
35660
35835
  const stepModel = resolveLanguageModel(
35661
35836
  (_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
35662
35837
  );
35838
+ const stepModelInfo = {
35839
+ provider: stepModel.provider,
35840
+ modelId: stepModel.modelId
35841
+ };
35663
35842
  const promptMessages = await convertToLanguageModelPrompt({
35664
35843
  prompt: {
35665
35844
  system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
@@ -35669,11 +35848,41 @@ async function generateText({
35669
35848
  download: download2
35670
35849
  });
35671
35850
  experimental_context = (_d = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _d : experimental_context;
35851
+ const stepActiveTools = (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools;
35672
35852
  const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
35673
35853
  tools,
35674
- toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
35675
- activeTools: (_f = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _f : activeTools
35854
+ toolChoice: (_f = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _f : toolChoice,
35855
+ activeTools: stepActiveTools
35676
35856
  });
35857
+ const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
35858
+ const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
35859
+ const stepProviderOptions = mergeObjects(
35860
+ providerOptions,
35861
+ prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
35862
+ );
35863
+ try {
35864
+ await (onStepStart == null ? void 0 : onStepStart({
35865
+ stepNumber: steps.length,
35866
+ model: stepModelInfo,
35867
+ system: stepSystem,
35868
+ messages: stepMessages,
35869
+ tools,
35870
+ toolChoice: stepToolChoice,
35871
+ activeTools: stepActiveTools,
35872
+ steps: [...steps],
35873
+ providerOptions: stepProviderOptions,
35874
+ timeout,
35875
+ headers,
35876
+ stopWhen,
35877
+ output,
35878
+ abortSignal,
35879
+ include,
35880
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
35881
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
35882
+ experimental_context
35883
+ }));
35884
+ } catch (_ignored) {
35885
+ }
35677
35886
  currentModelResponse = await retry(
35678
35887
  () => {
35679
35888
  var _a22;
@@ -35716,10 +35925,6 @@ async function generateText({
35716
35925
  tracer,
35717
35926
  fn: async (span2) => {
35718
35927
  var _a23, _b22, _c2, _d2, _e2, _f2, _g2, _h2;
35719
- const stepProviderOptions = mergeObjects(
35720
- providerOptions,
35721
- prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
35722
- );
35723
35928
  const result = await stepModel.doGenerate({
35724
35929
  ...callSettings2,
35725
35930
  tools: stepTools,
@@ -35851,7 +36056,11 @@ async function generateText({
35851
36056
  telemetry,
35852
36057
  messages: stepInputMessages,
35853
36058
  abortSignal: mergedAbortSignal,
35854
- experimental_context
36059
+ experimental_context,
36060
+ stepNumber: steps.length,
36061
+ model: stepModelInfo,
36062
+ onToolCallStart,
36063
+ onToolCallFinish
35855
36064
  })
35856
36065
  );
35857
36066
  }
@@ -35888,15 +36097,21 @@ async function generateText({
35888
36097
  tools
35889
36098
  })
35890
36099
  );
35891
- const stepRequest = ((_g = include == null ? void 0 : include.requestBody) != null ? _g : true) ? (_h = currentModelResponse.request) != null ? _h : {} : { ...currentModelResponse.request, body: void 0 };
36100
+ const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? (_j = currentModelResponse.request) != null ? _j : {} : { ...currentModelResponse.request, body: void 0 };
35892
36101
  const stepResponse = {
35893
36102
  ...currentModelResponse.response,
35894
36103
  // deep clone msgs to avoid mutating past messages in multi-step:
35895
36104
  messages: structuredClone(responseMessages),
35896
36105
  // Conditionally include response body:
35897
- body: ((_i = include == null ? void 0 : include.responseBody) != null ? _i : true) ? (_j = currentModelResponse.response) == null ? void 0 : _j.body : void 0
36106
+ body: ((_k = include == null ? void 0 : include.responseBody) != null ? _k : true) ? (_l = currentModelResponse.response) == null ? void 0 : _l.body : void 0
35898
36107
  };
36108
+ const stepNumber = steps.length;
35899
36109
  const currentStepResult = new DefaultStepResult({
36110
+ stepNumber,
36111
+ model: stepModelInfo,
36112
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
36113
+ metadata: telemetry == null ? void 0 : telemetry.metadata,
36114
+ experimental_context,
35900
36115
  content: stepContent,
35901
36116
  finishReason: currentModelResponse.finishReason.unified,
35902
36117
  rawFinishReason: currentModelResponse.finishReason.raw,
@@ -35907,9 +36122,9 @@ async function generateText({
35907
36122
  response: stepResponse
35908
36123
  });
35909
36124
  logWarnings({
35910
- warnings: (_k = currentModelResponse.warnings) != null ? _k : [],
35911
- provider: stepModel.provider,
35912
- model: stepModel.modelId
36125
+ warnings: (_m = currentModelResponse.warnings) != null ? _m : [],
36126
+ provider: stepModelInfo.provider,
36127
+ model: stepModelInfo.modelId
35913
36128
  });
35914
36129
  steps.push(currentStepResult);
35915
36130
  await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
@@ -35965,6 +36180,11 @@ async function generateText({
35965
36180
  }
35966
36181
  );
35967
36182
  await (onFinish == null ? void 0 : onFinish({
36183
+ stepNumber: lastStep.stepNumber,
36184
+ model: lastStep.model,
36185
+ functionId: lastStep.functionId,
36186
+ metadata: lastStep.metadata,
36187
+ experimental_context: lastStep.experimental_context,
35968
36188
  finishReason: lastStep.finishReason,
35969
36189
  rawFinishReason: lastStep.rawFinishReason,
35970
36190
  usage: lastStep.usage,
@@ -35985,8 +36205,7 @@ async function generateText({
35985
36205
  warnings: lastStep.warnings,
35986
36206
  providerMetadata: lastStep.providerMetadata,
35987
36207
  steps,
35988
- totalUsage,
35989
- experimental_context
36208
+ totalUsage
35990
36209
  }));
35991
36210
  let resolvedOutput;
35992
36211
  if (lastStep.finishReason === "stop") {
@@ -36018,7 +36237,11 @@ async function executeTools({
36018
36237
  telemetry,
36019
36238
  messages,
36020
36239
  abortSignal,
36021
- experimental_context
36240
+ experimental_context,
36241
+ stepNumber,
36242
+ model,
36243
+ onToolCallStart,
36244
+ onToolCallFinish
36022
36245
  }) {
36023
36246
  const toolOutputs = await Promise.all(
36024
36247
  toolCalls.map(
@@ -36029,7 +36252,11 @@ async function executeTools({
36029
36252
  telemetry,
36030
36253
  messages,
36031
36254
  abortSignal,
36032
- experimental_context
36255
+ experimental_context,
36256
+ stepNumber,
36257
+ model,
36258
+ onToolCallStart,
36259
+ onToolCallFinish
36033
36260
  })
36034
36261
  )
36035
36262
  );
@@ -37190,10 +37417,6 @@ function createStitchableStream() {
37190
37417
  terminate
37191
37418
  };
37192
37419
  }
37193
- function now() {
37194
- var _a21, _b9;
37195
- return (_b9 = (_a21 = globalThis == null ? void 0 : globalThis.performance) == null ? void 0 : _a21.now()) != null ? _b9 : Date.now();
37196
- }
37197
37420
  function runToolsTransformation({
37198
37421
  tools,
37199
37422
  generatorStream,
@@ -37204,7 +37427,11 @@ function runToolsTransformation({
37204
37427
  abortSignal,
37205
37428
  repairToolCall,
37206
37429
  experimental_context,
37207
- generateId: generateId2
37430
+ generateId: generateId2,
37431
+ stepNumber,
37432
+ model,
37433
+ onToolCallStart,
37434
+ onToolCallFinish
37208
37435
  }) {
37209
37436
  let toolResultsStreamController = null;
37210
37437
  const toolResultsStream = new ReadableStream({
@@ -37346,6 +37573,10 @@ function runToolsTransformation({
37346
37573
  messages,
37347
37574
  abortSignal,
37348
37575
  experimental_context,
37576
+ stepNumber,
37577
+ model,
37578
+ onToolCallStart,
37579
+ onToolCallFinish,
37349
37580
  onPreliminaryToolResult: (result) => {
37350
37581
  toolResultsStreamController.enqueue(result);
37351
37582
  }
@@ -37462,6 +37693,10 @@ function streamText({
37462
37693
  onFinish,
37463
37694
  onAbort,
37464
37695
  onStepFinish,
37696
+ experimental_onStart: onStart,
37697
+ experimental_onStepStart: onStepStart,
37698
+ experimental_onToolCallStart: onToolCallStart,
37699
+ experimental_onToolCallFinish: onToolCallFinish,
37465
37700
  experimental_context,
37466
37701
  experimental_include: include,
37467
37702
  _internal: { now: now2 = now, generateId: generateId2 = originalGenerateId2 } = {},
@@ -37501,11 +37736,18 @@ function streamText({
37501
37736
  providerOptions,
37502
37737
  prepareStep,
37503
37738
  includeRawChunks,
37739
+ timeout,
37740
+ stopWhen,
37741
+ originalAbortSignal: abortSignal,
37504
37742
  onChunk,
37505
37743
  onError,
37506
37744
  onFinish,
37507
37745
  onAbort,
37508
37746
  onStepFinish,
37747
+ onStart,
37748
+ onStepStart,
37749
+ onToolCallStart,
37750
+ onToolCallFinish,
37509
37751
  now: now2,
37510
37752
  generateId: generateId2,
37511
37753
  experimental_context,
@@ -37602,11 +37844,18 @@ var DefaultStreamTextResult = class {
37602
37844
  includeRawChunks,
37603
37845
  now: now2,
37604
37846
  generateId: generateId2,
37847
+ timeout,
37848
+ stopWhen,
37849
+ originalAbortSignal,
37605
37850
  onChunk,
37606
37851
  onError,
37607
37852
  onFinish,
37608
37853
  onAbort,
37609
37854
  onStepFinish,
37855
+ onStart,
37856
+ onStepStart,
37857
+ onToolCallStart,
37858
+ onToolCallFinish,
37610
37859
  experimental_context,
37611
37860
  download: download2,
37612
37861
  include
@@ -37749,6 +37998,10 @@ var DefaultStreamTextResult = class {
37749
37998
  tools
37750
37999
  });
37751
38000
  const currentStepResult = new DefaultStepResult({
38001
+ stepNumber: recordedSteps.length,
38002
+ model: modelInfo,
38003
+ ...callbackTelemetryProps,
38004
+ experimental_context,
37752
38005
  content: recordedContent,
37753
38006
  finishReason: part.finishReason,
37754
38007
  rawFinishReason: part.rawFinishReason,
@@ -37764,8 +38017,8 @@ var DefaultStreamTextResult = class {
37764
38017
  await (onStepFinish == null ? void 0 : onStepFinish(currentStepResult));
37765
38018
  logWarnings({
37766
38019
  warnings: recordedWarnings,
37767
- provider: model.provider,
37768
- model: model.modelId
38020
+ provider: modelInfo.provider,
38021
+ model: modelInfo.modelId
37769
38022
  });
37770
38023
  recordedSteps.push(currentStepResult);
37771
38024
  recordedResponseMessages.push(...stepMessages);
@@ -37797,6 +38050,11 @@ var DefaultStreamTextResult = class {
37797
38050
  self2._steps.resolve(recordedSteps);
37798
38051
  const finalStep = recordedSteps[recordedSteps.length - 1];
37799
38052
  await (onFinish == null ? void 0 : onFinish({
38053
+ stepNumber: finalStep.stepNumber,
38054
+ model: finalStep.model,
38055
+ functionId: finalStep.functionId,
38056
+ metadata: finalStep.metadata,
38057
+ experimental_context: finalStep.experimental_context,
37800
38058
  finishReason: finalStep.finishReason,
37801
38059
  rawFinishReason: finalStep.rawFinishReason,
37802
38060
  totalUsage,
@@ -37817,8 +38075,7 @@ var DefaultStreamTextResult = class {
37817
38075
  response: finalStep.response,
37818
38076
  warnings: finalStep.warnings,
37819
38077
  providerMetadata: finalStep.providerMetadata,
37820
- steps: recordedSteps,
37821
- experimental_context
38078
+ steps: recordedSteps
37822
38079
  }));
37823
38080
  rootSpan.setAttributes(
37824
38081
  await selectTelemetryAttributes({
@@ -37920,6 +38177,11 @@ var DefaultStreamTextResult = class {
37920
38177
  settings: { ...callSettings, maxRetries }
37921
38178
  });
37922
38179
  const self2 = this;
38180
+ const modelInfo = { provider: model.provider, modelId: model.modelId };
38181
+ const callbackTelemetryProps = {
38182
+ functionId: telemetry == null ? void 0 : telemetry.functionId,
38183
+ metadata: telemetry == null ? void 0 : telemetry.metadata
38184
+ };
37923
38185
  recordSpan({
37924
38186
  name: "ai.streamText",
37925
38187
  attributes: selectTelemetryAttributes({
@@ -37942,6 +38204,36 @@ var DefaultStreamTextResult = class {
37942
38204
  prompt,
37943
38205
  messages
37944
38206
  });
38207
+ try {
38208
+ await (onStart == null ? void 0 : onStart({
38209
+ model: modelInfo,
38210
+ system,
38211
+ prompt,
38212
+ messages,
38213
+ tools,
38214
+ toolChoice,
38215
+ activeTools,
38216
+ maxOutputTokens: callSettings.maxOutputTokens,
38217
+ temperature: callSettings.temperature,
38218
+ topP: callSettings.topP,
38219
+ topK: callSettings.topK,
38220
+ presencePenalty: callSettings.presencePenalty,
38221
+ frequencyPenalty: callSettings.frequencyPenalty,
38222
+ stopSequences: callSettings.stopSequences,
38223
+ seed: callSettings.seed,
38224
+ maxRetries,
38225
+ timeout,
38226
+ headers,
38227
+ providerOptions,
38228
+ stopWhen,
38229
+ output,
38230
+ abortSignal: originalAbortSignal,
38231
+ include,
38232
+ ...callbackTelemetryProps,
38233
+ experimental_context
38234
+ }));
38235
+ } catch (_ignored) {
38236
+ }
37945
38237
  const initialMessages = initialPrompt.messages;
37946
38238
  const initialResponseMessages = [];
37947
38239
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -37988,6 +38280,10 @@ var DefaultStreamTextResult = class {
37988
38280
  messages: initialMessages,
37989
38281
  abortSignal,
37990
38282
  experimental_context,
38283
+ stepNumber: recordedSteps.length,
38284
+ model: modelInfo,
38285
+ onToolCallStart,
38286
+ onToolCallFinish,
37991
38287
  onPreliminaryToolResult: (result2) => {
37992
38288
  toolExecutionStepStreamController == null ? void 0 : toolExecutionStepStreamController.enqueue(result2);
37993
38289
  }
@@ -38054,7 +38350,7 @@ var DefaultStreamTextResult = class {
38054
38350
  responseMessages,
38055
38351
  usage
38056
38352
  }) {
38057
- var _a21, _b9, _c, _d, _e, _f, _g;
38353
+ var _a21, _b9, _c, _d, _e, _f, _g, _h, _i;
38058
38354
  const includeRawChunks2 = self2.includeRawChunks;
38059
38355
  const stepTimeoutId = stepTimeoutMs != null ? setTimeout(() => stepAbortController.abort(), stepTimeoutMs) : void 0;
38060
38356
  let chunkTimeoutId = void 0;
@@ -38093,6 +38389,10 @@ var DefaultStreamTextResult = class {
38093
38389
  const stepModel = resolveLanguageModel(
38094
38390
  (_a21 = prepareStepResult == null ? void 0 : prepareStepResult.model) != null ? _a21 : model
38095
38391
  );
38392
+ const stepModelInfo = {
38393
+ provider: stepModel.provider,
38394
+ modelId: stepModel.modelId
38395
+ };
38096
38396
  const promptMessages = await convertToLanguageModelPrompt({
38097
38397
  prompt: {
38098
38398
  system: (_b9 = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _b9 : initialPrompt.system,
@@ -38101,16 +38401,41 @@ var DefaultStreamTextResult = class {
38101
38401
  supportedUrls: await stepModel.supportedUrls,
38102
38402
  download: download2
38103
38403
  });
38404
+ const stepActiveTools = (_d = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _d : activeTools;
38104
38405
  const { toolChoice: stepToolChoice, tools: stepTools } = await prepareToolsAndToolChoice({
38105
38406
  tools,
38106
- toolChoice: (_d = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _d : toolChoice,
38107
- activeTools: (_e = prepareStepResult == null ? void 0 : prepareStepResult.activeTools) != null ? _e : activeTools
38407
+ toolChoice: (_e = prepareStepResult == null ? void 0 : prepareStepResult.toolChoice) != null ? _e : toolChoice,
38408
+ activeTools: stepActiveTools
38108
38409
  });
38109
38410
  experimental_context = (_f = prepareStepResult == null ? void 0 : prepareStepResult.experimental_context) != null ? _f : experimental_context;
38411
+ const stepMessages = (_g = prepareStepResult == null ? void 0 : prepareStepResult.messages) != null ? _g : stepInputMessages;
38412
+ const stepSystem = (_h = prepareStepResult == null ? void 0 : prepareStepResult.system) != null ? _h : initialPrompt.system;
38110
38413
  const stepProviderOptions = mergeObjects(
38111
38414
  providerOptions,
38112
38415
  prepareStepResult == null ? void 0 : prepareStepResult.providerOptions
38113
38416
  );
38417
+ try {
38418
+ await (onStepStart == null ? void 0 : onStepStart({
38419
+ stepNumber: recordedSteps.length,
38420
+ model: stepModelInfo,
38421
+ system: stepSystem,
38422
+ messages: stepMessages,
38423
+ tools,
38424
+ toolChoice: stepToolChoice,
38425
+ activeTools: stepActiveTools,
38426
+ steps: [...recordedSteps],
38427
+ providerOptions: stepProviderOptions,
38428
+ timeout,
38429
+ headers,
38430
+ stopWhen,
38431
+ output,
38432
+ abortSignal: originalAbortSignal,
38433
+ include,
38434
+ ...callbackTelemetryProps,
38435
+ experimental_context
38436
+ }));
38437
+ } catch (_ignored) {
38438
+ }
38114
38439
  const {
38115
38440
  result: { stream: stream2, response, request },
38116
38441
  doStreamSpan,
@@ -38182,9 +38507,13 @@ var DefaultStreamTextResult = class {
38182
38507
  repairToolCall,
38183
38508
  abortSignal,
38184
38509
  experimental_context,
38185
- generateId: generateId2
38510
+ generateId: generateId2,
38511
+ stepNumber: recordedSteps.length,
38512
+ model: stepModelInfo,
38513
+ onToolCallStart,
38514
+ onToolCallFinish
38186
38515
  });
38187
- const stepRequest = ((_g = include == null ? void 0 : include.requestBody) != null ? _g : true) ? request != null ? request : {} : { ...request, body: void 0 };
38516
+ const stepRequest = ((_i = include == null ? void 0 : include.requestBody) != null ? _i : true) ? request != null ? request : {} : { ...request, body: void 0 };
38188
38517
  const stepToolCalls = [];
38189
38518
  const stepToolOutputs = [];
38190
38519
  let warnings;
@@ -38197,7 +38526,7 @@ var DefaultStreamTextResult = class {
38197
38526
  let stepResponse = {
38198
38527
  id: generateId2(),
38199
38528
  timestamp: /* @__PURE__ */ new Date(),
38200
- modelId: model.modelId
38529
+ modelId: modelInfo.modelId
38201
38530
  };
38202
38531
  let activeText = "";
38203
38532
  self2.addStream(
@@ -42711,7 +43040,8 @@ var modelMaxImagesPerCall = {
42711
43040
  "dall-e-2": 10,
42712
43041
  "gpt-image-1": 10,
42713
43042
  "gpt-image-1-mini": 10,
42714
- "gpt-image-1.5": 10
43043
+ "gpt-image-1.5": 10,
43044
+ "chatgpt-image-latest": 10
42715
43045
  };
42716
43046
  var defaultResponseFormatPrefixes = [
42717
43047
  "gpt-image-1-mini",
@@ -42812,15 +43142,20 @@ var OpenAIImageModel = class {
42812
43142
  },
42813
43143
  providerMetadata: {
42814
43144
  openai: {
42815
- images: response2.data.map((item) => {
42816
- var _a22, _b22, _c2, _d2, _e2;
43145
+ images: response2.data.map((item, index) => {
43146
+ var _a22, _b22, _c2, _d2, _e2, _f2;
42817
43147
  return {
42818
43148
  ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
42819
43149
  created: (_a22 = response2.created) != null ? _a22 : void 0,
42820
43150
  size: (_b22 = response2.size) != null ? _b22 : void 0,
42821
43151
  quality: (_c2 = response2.quality) != null ? _c2 : void 0,
42822
43152
  background: (_d2 = response2.background) != null ? _d2 : void 0,
42823
- outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0
43153
+ outputFormat: (_e2 = response2.output_format) != null ? _e2 : void 0,
43154
+ ...distributeTokenDetails(
43155
+ (_f2 = response2.usage) == null ? void 0 : _f2.input_tokens_details,
43156
+ index,
43157
+ response2.data.length
43158
+ )
42824
43159
  };
42825
43160
  })
42826
43161
  }
@@ -42863,15 +43198,20 @@ var OpenAIImageModel = class {
42863
43198
  },
42864
43199
  providerMetadata: {
42865
43200
  openai: {
42866
- images: response.data.map((item) => {
42867
- var _a22, _b22, _c2, _d2, _e2;
43201
+ images: response.data.map((item, index) => {
43202
+ var _a22, _b22, _c2, _d2, _e2, _f2;
42868
43203
  return {
42869
43204
  ...item.revised_prompt ? { revisedPrompt: item.revised_prompt } : {},
42870
43205
  created: (_a22 = response.created) != null ? _a22 : void 0,
42871
43206
  size: (_b22 = response.size) != null ? _b22 : void 0,
42872
43207
  quality: (_c2 = response.quality) != null ? _c2 : void 0,
42873
43208
  background: (_d2 = response.background) != null ? _d2 : void 0,
42874
- outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0
43209
+ outputFormat: (_e2 = response.output_format) != null ? _e2 : void 0,
43210
+ ...distributeTokenDetails(
43211
+ (_f2 = response.usage) == null ? void 0 : _f2.input_tokens_details,
43212
+ index,
43213
+ response.data.length
43214
+ )
42875
43215
  };
42876
43216
  })
42877
43217
  }
@@ -42879,6 +43219,23 @@ var OpenAIImageModel = class {
42879
43219
  };
42880
43220
  }
42881
43221
  };
43222
+ function distributeTokenDetails(details, index, total) {
43223
+ if (details == null) {
43224
+ return {};
43225
+ }
43226
+ const result = {};
43227
+ if (details.image_tokens != null) {
43228
+ const base = Math.floor(details.image_tokens / total);
43229
+ const remainder = details.image_tokens - base * (total - 1);
43230
+ result.imageTokens = index === total - 1 ? remainder : base;
43231
+ }
43232
+ if (details.text_tokens != null) {
43233
+ const base = Math.floor(details.text_tokens / total);
43234
+ const remainder = details.text_tokens - base * (total - 1);
43235
+ result.textTokens = index === total - 1 ? remainder : base;
43236
+ }
43237
+ return result;
43238
+ }
42882
43239
  async function fileToBlob(file) {
42883
43240
  if (!file) return void 0;
42884
43241
  if (file.type === "url") {
@@ -43089,6 +43446,67 @@ var shellOutputSchema = lazySchema(
43089
43446
  })
43090
43447
  )
43091
43448
  );
43449
+ var shellSkillsSchema = array$1(
43450
+ discriminatedUnion("type", [
43451
+ object$2({
43452
+ type: literal("skillReference"),
43453
+ skillId: string(),
43454
+ version: string().optional()
43455
+ }),
43456
+ object$2({
43457
+ type: literal("inline"),
43458
+ name: string(),
43459
+ description: string(),
43460
+ source: object$2({
43461
+ type: literal("base64"),
43462
+ mediaType: literal("application/zip"),
43463
+ data: string()
43464
+ })
43465
+ })
43466
+ ])
43467
+ ).optional();
43468
+ var shellArgsSchema = lazySchema(
43469
+ () => zodSchema(
43470
+ object$2({
43471
+ environment: union([
43472
+ object$2({
43473
+ type: literal("containerAuto"),
43474
+ fileIds: array$1(string()).optional(),
43475
+ memoryLimit: _enum(["1g", "4g", "16g", "64g"]).optional(),
43476
+ networkPolicy: discriminatedUnion("type", [
43477
+ object$2({ type: literal("disabled") }),
43478
+ object$2({
43479
+ type: literal("allowlist"),
43480
+ allowedDomains: array$1(string()),
43481
+ domainSecrets: array$1(
43482
+ object$2({
43483
+ domain: string(),
43484
+ name: string(),
43485
+ value: string()
43486
+ })
43487
+ ).optional()
43488
+ })
43489
+ ]).optional(),
43490
+ skills: shellSkillsSchema
43491
+ }),
43492
+ object$2({
43493
+ type: literal("containerReference"),
43494
+ containerId: string()
43495
+ }),
43496
+ object$2({
43497
+ type: literal("local").optional(),
43498
+ skills: array$1(
43499
+ object$2({
43500
+ name: string(),
43501
+ description: string(),
43502
+ path: string()
43503
+ })
43504
+ ).optional()
43505
+ })
43506
+ ]).optional()
43507
+ })
43508
+ )
43509
+ );
43092
43510
  var shell = createProviderToolFactoryWithOutputSchema({
43093
43511
  id: "openai.shell",
43094
43512
  inputSchema: shellInputSchema,
@@ -43128,7 +43546,7 @@ var webSearchOutputSchema = lazySchema(
43128
43546
  url: string().nullish(),
43129
43547
  pattern: string().nullish()
43130
43548
  })
43131
- ]),
43549
+ ]).optional(),
43132
43550
  sources: array$1(
43133
43551
  discriminatedUnion("type", [
43134
43552
  object$2({ type: literal("url"), url: string() }),
@@ -43178,7 +43596,7 @@ var webSearchPreviewOutputSchema = lazySchema(
43178
43596
  url: string().nullish(),
43179
43597
  pattern: string().nullish()
43180
43598
  })
43181
- ])
43599
+ ]).optional()
43182
43600
  })
43183
43601
  )
43184
43602
  );
@@ -43578,8 +43996,32 @@ async function convertToOpenAIResponsesInput({
43578
43996
  if (hasConversation) {
43579
43997
  break;
43580
43998
  }
43999
+ const resolvedResultToolName = toolNameMapping.toProviderToolName(
44000
+ part.toolName
44001
+ );
44002
+ if (hasShellTool && resolvedResultToolName === "shell") {
44003
+ if (part.output.type === "json") {
44004
+ const parsedOutput = await validateTypes$1({
44005
+ value: part.output.value,
44006
+ schema: shellOutputSchema
44007
+ });
44008
+ input.push({
44009
+ type: "shell_call_output",
44010
+ call_id: part.toolCallId,
44011
+ output: parsedOutput.output.map((item) => ({
44012
+ stdout: item.stdout,
44013
+ stderr: item.stderr,
44014
+ outcome: item.outcome.type === "timeout" ? { type: "timeout" } : {
44015
+ type: "exit",
44016
+ exit_code: item.outcome.exitCode
44017
+ }
44018
+ }))
44019
+ });
44020
+ }
44021
+ break;
44022
+ }
43581
44023
  if (store) {
43582
- const itemId = (_j = (_i = (_h = part.providerMetadata) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
44024
+ const itemId = (_j = (_i = (_h = part.providerOptions) == null ? void 0 : _h[providerOptionsName]) == null ? void 0 : _i.itemId) != null ? _j : part.toolCallId;
43583
44025
  input.push({ type: "item_reference", id: itemId });
43584
44026
  } else {
43585
44027
  warnings.push({
@@ -43948,6 +44390,25 @@ var openaiResponsesChunkSchema = lazySchema(
43948
44390
  action: object$2({
43949
44391
  commands: array$1(string())
43950
44392
  })
44393
+ }),
44394
+ object$2({
44395
+ type: literal("shell_call_output"),
44396
+ id: string(),
44397
+ call_id: string(),
44398
+ status: _enum(["in_progress", "completed", "incomplete"]),
44399
+ output: array$1(
44400
+ object$2({
44401
+ stdout: string(),
44402
+ stderr: string(),
44403
+ outcome: discriminatedUnion("type", [
44404
+ object$2({ type: literal("timeout") }),
44405
+ object$2({
44406
+ type: literal("exit"),
44407
+ exit_code: number$1()
44408
+ })
44409
+ ])
44410
+ })
44411
+ )
43951
44412
  })
43952
44413
  ])
43953
44414
  }),
@@ -44013,7 +44474,7 @@ var openaiResponsesChunkSchema = lazySchema(
44013
44474
  url: string().nullish(),
44014
44475
  pattern: string().nullish()
44015
44476
  })
44016
- ])
44477
+ ]).nullish()
44017
44478
  }),
44018
44479
  object$2({
44019
44480
  type: literal("file_search_call"),
@@ -44127,6 +44588,25 @@ var openaiResponsesChunkSchema = lazySchema(
44127
44588
  action: object$2({
44128
44589
  commands: array$1(string())
44129
44590
  })
44591
+ }),
44592
+ object$2({
44593
+ type: literal("shell_call_output"),
44594
+ id: string(),
44595
+ call_id: string(),
44596
+ status: _enum(["in_progress", "completed", "incomplete"]),
44597
+ output: array$1(
44598
+ object$2({
44599
+ stdout: string(),
44600
+ stderr: string(),
44601
+ outcome: discriminatedUnion("type", [
44602
+ object$2({ type: literal("timeout") }),
44603
+ object$2({
44604
+ type: literal("exit"),
44605
+ exit_code: number$1()
44606
+ })
44607
+ ])
44608
+ })
44609
+ )
44130
44610
  })
44131
44611
  ])
44132
44612
  }),
@@ -44310,7 +44790,10 @@ var openaiResponsesResponseSchema = lazySchema(
44310
44790
  sources: array$1(
44311
44791
  discriminatedUnion("type", [
44312
44792
  object$2({ type: literal("url"), url: string() }),
44313
- object$2({ type: literal("api"), name: string() })
44793
+ object$2({
44794
+ type: literal("api"),
44795
+ name: string()
44796
+ })
44314
44797
  ])
44315
44798
  ).nullish()
44316
44799
  }),
@@ -44323,7 +44806,7 @@ var openaiResponsesResponseSchema = lazySchema(
44323
44806
  url: string().nullish(),
44324
44807
  pattern: string().nullish()
44325
44808
  })
44326
- ])
44809
+ ]).nullish()
44327
44810
  }),
44328
44811
  object$2({
44329
44812
  type: literal("file_search_call"),
@@ -44472,6 +44955,25 @@ var openaiResponsesResponseSchema = lazySchema(
44472
44955
  action: object$2({
44473
44956
  commands: array$1(string())
44474
44957
  })
44958
+ }),
44959
+ object$2({
44960
+ type: literal("shell_call_output"),
44961
+ id: string(),
44962
+ call_id: string(),
44963
+ status: _enum(["in_progress", "completed", "incomplete"]),
44964
+ output: array$1(
44965
+ object$2({
44966
+ stdout: string(),
44967
+ stderr: string(),
44968
+ outcome: discriminatedUnion("type", [
44969
+ object$2({ type: literal("timeout") }),
44970
+ object$2({
44971
+ type: literal("exit"),
44972
+ exit_code: number$1()
44973
+ })
44974
+ ])
44975
+ })
44976
+ )
44475
44977
  })
44476
44978
  ])
44477
44979
  ).optional(),
@@ -44688,8 +45190,15 @@ async function prepareResponsesTools({
44688
45190
  break;
44689
45191
  }
44690
45192
  case "openai.shell": {
45193
+ const args = await validateTypes$1({
45194
+ value: tool2.args,
45195
+ schema: shellArgsSchema
45196
+ });
44691
45197
  openaiTools2.push({
44692
- type: "shell"
45198
+ type: "shell",
45199
+ ...args.environment && {
45200
+ environment: mapShellEnvironment(args.environment)
45201
+ }
44693
45202
  });
44694
45203
  break;
44695
45204
  }
@@ -44819,6 +45328,52 @@ async function prepareResponsesTools({
44819
45328
  }
44820
45329
  }
44821
45330
  }
45331
+ function mapShellEnvironment(environment) {
45332
+ if (environment.type === "containerReference") {
45333
+ const env2 = environment;
45334
+ return {
45335
+ type: "container_reference",
45336
+ container_id: env2.containerId
45337
+ };
45338
+ }
45339
+ if (environment.type === "containerAuto") {
45340
+ const env2 = environment;
45341
+ return {
45342
+ type: "container_auto",
45343
+ file_ids: env2.fileIds,
45344
+ memory_limit: env2.memoryLimit,
45345
+ network_policy: env2.networkPolicy == null ? void 0 : env2.networkPolicy.type === "disabled" ? { type: "disabled" } : {
45346
+ type: "allowlist",
45347
+ allowed_domains: env2.networkPolicy.allowedDomains,
45348
+ domain_secrets: env2.networkPolicy.domainSecrets
45349
+ },
45350
+ skills: mapShellSkills(env2.skills)
45351
+ };
45352
+ }
45353
+ const env = environment;
45354
+ return {
45355
+ type: "local",
45356
+ skills: env.skills
45357
+ };
45358
+ }
45359
+ function mapShellSkills(skills) {
45360
+ return skills == null ? void 0 : skills.map(
45361
+ (skill) => skill.type === "skillReference" ? {
45362
+ type: "skill_reference",
45363
+ skill_id: skill.skillId,
45364
+ version: skill.version
45365
+ } : {
45366
+ type: "inline",
45367
+ name: skill.name,
45368
+ description: skill.description,
45369
+ source: {
45370
+ type: "base64",
45371
+ media_type: skill.source.mediaType,
45372
+ data: skill.source.data
45373
+ }
45374
+ }
45375
+ );
45376
+ }
44822
45377
  function extractApprovalRequestIdToToolCallIdMapping(prompt) {
44823
45378
  var _a10, _b9;
44824
45379
  const mapping = {};
@@ -44862,7 +45417,7 @@ var OpenAIResponsesLanguageModel = class {
44862
45417
  toolChoice,
44863
45418
  responseFormat
44864
45419
  }) {
44865
- var _a10, _b9, _c, _d, _e, _f;
45420
+ var _a10, _b9, _c, _d, _e, _f, _g, _h, _i;
44866
45421
  const warnings = [];
44867
45422
  const modelCapabilities = getOpenAILanguageModelCapabilities(this.modelId);
44868
45423
  if (topK != null) {
@@ -45066,6 +45621,10 @@ var OpenAIResponsesLanguageModel = class {
45066
45621
  tools,
45067
45622
  toolChoice
45068
45623
  });
45624
+ const shellToolEnvType = (_i = (_h = (_g = tools == null ? void 0 : tools.find(
45625
+ (tool2) => tool2.type === "provider" && tool2.id === "openai.shell"
45626
+ )) == null ? void 0 : _g.args) == null ? void 0 : _h.environment) == null ? void 0 : _i.type;
45627
+ const isShellProviderExecuted = shellToolEnvType === "containerAuto" || shellToolEnvType === "containerReference";
45069
45628
  return {
45070
45629
  webSearchToolName,
45071
45630
  args: {
@@ -45076,7 +45635,8 @@ var OpenAIResponsesLanguageModel = class {
45076
45635
  warnings: [...warnings, ...toolWarnings],
45077
45636
  store,
45078
45637
  toolNameMapping,
45079
- providerOptionsName
45638
+ providerOptionsName,
45639
+ isShellProviderExecuted
45080
45640
  };
45081
45641
  }
45082
45642
  async doGenerate(options) {
@@ -45086,7 +45646,8 @@ var OpenAIResponsesLanguageModel = class {
45086
45646
  warnings,
45087
45647
  webSearchToolName,
45088
45648
  toolNameMapping,
45089
- providerOptionsName
45649
+ providerOptionsName,
45650
+ isShellProviderExecuted
45090
45651
  } = await this.getArgs(options);
45091
45652
  const url2 = this.config.url({
45092
45653
  path: "/responses",
@@ -45186,6 +45747,7 @@ var OpenAIResponsesLanguageModel = class {
45186
45747
  commands: part.action.commands
45187
45748
  }
45188
45749
  }),
45750
+ ...isShellProviderExecuted && { providerExecuted: true },
45189
45751
  providerMetadata: {
45190
45752
  [providerOptionsName]: {
45191
45753
  itemId: part.id
@@ -45194,6 +45756,24 @@ var OpenAIResponsesLanguageModel = class {
45194
45756
  });
45195
45757
  break;
45196
45758
  }
45759
+ case "shell_call_output": {
45760
+ content.push({
45761
+ type: "tool-result",
45762
+ toolCallId: part.call_id,
45763
+ toolName: toolNameMapping.toCustomToolName("shell"),
45764
+ result: {
45765
+ output: part.output.map((item) => ({
45766
+ stdout: item.stdout,
45767
+ stderr: item.stderr,
45768
+ outcome: item.outcome.type === "exit" ? {
45769
+ type: "exit",
45770
+ exitCode: item.outcome.exit_code
45771
+ } : { type: "timeout" }
45772
+ }))
45773
+ }
45774
+ });
45775
+ break;
45776
+ }
45197
45777
  case "message": {
45198
45778
  for (const contentPart of part.content) {
45199
45779
  if (((_c = (_b9 = options.providerOptions) == null ? void 0 : _b9[providerOptionsName]) == null ? void 0 : _c.logprobs) && contentPart.logprobs) {
@@ -45483,7 +46063,8 @@ var OpenAIResponsesLanguageModel = class {
45483
46063
  webSearchToolName,
45484
46064
  toolNameMapping,
45485
46065
  store,
45486
- providerOptionsName
46066
+ providerOptionsName,
46067
+ isShellProviderExecuted
45487
46068
  } = await this.getArgs(options);
45488
46069
  const { responseHeaders, value: response } = await postJsonToApi$1({
45489
46070
  url: this.config.url({
@@ -45662,7 +46243,8 @@ var OpenAIResponsesLanguageModel = class {
45662
46243
  toolName: toolNameMapping.toCustomToolName("shell"),
45663
46244
  toolCallId: value.item.call_id
45664
46245
  };
45665
- } else if (value.item.type === "message") {
46246
+ } else if (value.item.type === "shell_call_output") ;
46247
+ else if (value.item.type === "message") {
45666
46248
  ongoingAnnotations.splice(0, ongoingAnnotations.length);
45667
46249
  controller.enqueue({
45668
46250
  type: "text-start",
@@ -45915,10 +46497,31 @@ var OpenAIResponsesLanguageModel = class {
45915
46497
  commands: value.item.action.commands
45916
46498
  }
45917
46499
  }),
46500
+ ...isShellProviderExecuted && {
46501
+ providerExecuted: true
46502
+ },
45918
46503
  providerMetadata: {
45919
46504
  [providerOptionsName]: { itemId: value.item.id }
45920
46505
  }
45921
46506
  });
46507
+ } else if (value.item.type === "shell_call_output") {
46508
+ controller.enqueue({
46509
+ type: "tool-result",
46510
+ toolCallId: value.item.call_id,
46511
+ toolName: toolNameMapping.toCustomToolName("shell"),
46512
+ result: {
46513
+ output: value.item.output.map(
46514
+ (item) => ({
46515
+ stdout: item.stdout,
46516
+ stderr: item.stderr,
46517
+ outcome: item.outcome.type === "exit" ? {
46518
+ type: "exit",
46519
+ exitCode: item.outcome.exit_code
46520
+ } : { type: "timeout" }
46521
+ })
46522
+ )
46523
+ }
46524
+ });
45922
46525
  } else if (value.item.type === "reasoning") {
45923
46526
  const activeReasoningPart = activeReasoning[value.item.id];
45924
46527
  const summaryPartIndices = Object.entries(
@@ -46235,6 +46838,9 @@ function isErrorChunk(chunk) {
46235
46838
  }
46236
46839
  function mapWebSearchOutput(action) {
46237
46840
  var _a10;
46841
+ if (action == null) {
46842
+ return {};
46843
+ }
46238
46844
  switch (action.type) {
46239
46845
  case "search":
46240
46846
  return {
@@ -46587,7 +47193,7 @@ var OpenAITranscriptionModel = class {
46587
47193
  };
46588
47194
  }
46589
47195
  };
46590
- var VERSION$2 = "3.0.28";
47196
+ var VERSION$2 = "3.0.33";
46591
47197
  function createOpenAI(options = {}) {
46592
47198
  var _a10, _b9;
46593
47199
  const baseURL = (_a10 = withoutTrailingSlash$1(