@mastra/server 0.21.0-alpha.0 → 0.21.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/{chunk-SBWOUCO3.cjs → chunk-7HDOBOGG.cjs} +717 -2716
  3. package/dist/chunk-7HDOBOGG.cjs.map +1 -0
  4. package/dist/{chunk-DTBJ3D22.js → chunk-FWO7VQDC.js} +268 -2267
  5. package/dist/chunk-FWO7VQDC.js.map +1 -0
  6. package/dist/{chunk-H2CO44WB.js → chunk-FZNS32WJ.js} +4 -4
  7. package/dist/{chunk-H2CO44WB.js.map → chunk-FZNS32WJ.js.map} +1 -1
  8. package/dist/{chunk-6BMOC6SA.cjs → chunk-OYL5TBJW.cjs} +4 -4
  9. package/dist/{chunk-6BMOC6SA.cjs.map → chunk-OYL5TBJW.cjs.map} +1 -1
  10. package/dist/{chunk-KQZPT7AO.js → chunk-SIW6CYO3.js} +7 -7
  11. package/dist/{chunk-KQZPT7AO.js.map → chunk-SIW6CYO3.js.map} +1 -1
  12. package/dist/{chunk-3LGGSMCC.cjs → chunk-XVPBGW6Y.cjs} +9 -9
  13. package/dist/{chunk-3LGGSMCC.cjs.map → chunk-XVPBGW6Y.cjs.map} +1 -1
  14. package/dist/server/handlers/agent-builder.cjs +16 -16
  15. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  16. package/dist/server/handlers/agent-builder.js +1 -1
  17. package/dist/server/handlers/memory.d.ts +2 -2
  18. package/dist/server/handlers.cjs +2 -2
  19. package/dist/server/handlers.js +1 -1
  20. package/dist/{token-JT637FZG.cjs → token-53CFGXUO.cjs} +10 -10
  21. package/dist/{token-JT637FZG.cjs.map → token-53CFGXUO.cjs.map} +1 -1
  22. package/dist/{token-352SFL4N.js → token-WAEKDUVY.js} +8 -8
  23. package/dist/{token-352SFL4N.js.map → token-WAEKDUVY.js.map} +1 -1
  24. package/dist/token-util-LY37VCIN.js +7 -0
  25. package/dist/{token-util-75OQWZ4W.js.map → token-util-LY37VCIN.js.map} +1 -1
  26. package/dist/token-util-S4A355II.cjs +9 -0
  27. package/dist/{token-util-WGALAXWM.cjs.map → token-util-S4A355II.cjs.map} +1 -1
  28. package/package.json +5 -5
  29. package/dist/chunk-DTBJ3D22.js.map +0 -1
  30. package/dist/chunk-SBWOUCO3.cjs.map +0 -1
  31. package/dist/token-util-75OQWZ4W.js +0 -7
  32. package/dist/token-util-WGALAXWM.cjs +0 -9
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var chunkMQDBNHBT_cjs = require('./chunk-MQDBNHBT.cjs');
4
- var chunk6BMOC6SA_cjs = require('./chunk-6BMOC6SA.cjs');
4
+ var chunkOYL5TBJW_cjs = require('./chunk-OYL5TBJW.cjs');
5
5
  var chunk2PLXW4ZX_cjs = require('./chunk-2PLXW4ZX.cjs');
6
6
  var chunkLPM6BBAX_cjs = require('./chunk-LPM6BBAX.cjs');
7
7
  var chunkVY4ENABS_cjs = require('./chunk-VY4ENABS.cjs');
@@ -12,7 +12,7 @@ var agent = require('@mastra/core/agent');
12
12
  var memory = require('@mastra/core/memory');
13
13
  var utils = require('@mastra/core/utils');
14
14
  var zod = require('zod');
15
- var z104 = require('zod/v4');
15
+ var z42 = require('zod/v4');
16
16
  var v3 = require('zod/v3');
17
17
  var tools = require('@mastra/core/tools');
18
18
  var child_process = require('child_process');
@@ -43,30 +43,30 @@ function _interopNamespace(e) {
43
43
  return Object.freeze(n);
44
44
  }
45
45
 
46
- var z104__namespace = /*#__PURE__*/_interopNamespace(z104);
46
+ var z42__namespace = /*#__PURE__*/_interopNamespace(z42);
47
47
 
48
- // ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/get-context.js
48
+ // ../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-context.js
49
49
  var require_get_context = chunkO7I5CWRX_cjs.__commonJS({
50
- "../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/get-context.js"(exports, module) {
51
- var __defProp5 = Object.defineProperty;
50
+ "../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-context.js"(exports, module) {
51
+ var __defProp4 = Object.defineProperty;
52
52
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
53
53
  var __getOwnPropNames = Object.getOwnPropertyNames;
54
54
  var __hasOwnProp = Object.prototype.hasOwnProperty;
55
- var __export5 = (target, all) => {
56
- for (var name21 in all)
57
- __defProp5(target, name21, { get: all[name21], enumerable: true });
55
+ var __export4 = (target, all) => {
56
+ for (var name20 in all)
57
+ __defProp4(target, name20, { get: all[name20], enumerable: true });
58
58
  };
59
59
  var __copyProps = (to, from, except, desc) => {
60
60
  if (from && typeof from === "object" || typeof from === "function") {
61
61
  for (let key of __getOwnPropNames(from))
62
62
  if (!__hasOwnProp.call(to, key) && key !== except)
63
- __defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
63
+ __defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
64
64
  }
65
65
  return to;
66
66
  };
67
- var __toCommonJS = (mod) => __copyProps(__defProp5({}, "__esModule", { value: true }), mod);
67
+ var __toCommonJS = (mod) => __copyProps(__defProp4({}, "__esModule", { value: true }), mod);
68
68
  var get_context_exports = {};
69
- __export5(get_context_exports, {
69
+ __export4(get_context_exports, {
70
70
  SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
71
71
  getContext: () => getContext3
72
72
  });
@@ -79,34 +79,34 @@ var require_get_context = chunkO7I5CWRX_cjs.__commonJS({
79
79
  }
80
80
  });
81
81
 
82
- // ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js
82
+ // ../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js
83
83
  var require_get_vercel_oidc_token = chunkO7I5CWRX_cjs.__commonJS({
84
- "../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(exports, module) {
85
- var __defProp5 = Object.defineProperty;
84
+ "../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(exports, module) {
85
+ var __defProp4 = Object.defineProperty;
86
86
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
87
87
  var __getOwnPropNames = Object.getOwnPropertyNames;
88
88
  var __hasOwnProp = Object.prototype.hasOwnProperty;
89
- var __export5 = (target, all) => {
90
- for (var name21 in all)
91
- __defProp5(target, name21, { get: all[name21], enumerable: true });
89
+ var __export4 = (target, all) => {
90
+ for (var name20 in all)
91
+ __defProp4(target, name20, { get: all[name20], enumerable: true });
92
92
  };
93
93
  var __copyProps = (to, from, except, desc) => {
94
94
  if (from && typeof from === "object" || typeof from === "function") {
95
95
  for (let key of __getOwnPropNames(from))
96
96
  if (!__hasOwnProp.call(to, key) && key !== except)
97
- __defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
97
+ __defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
98
98
  }
99
99
  return to;
100
100
  };
101
- var __toCommonJS = (mod) => __copyProps(__defProp5({}, "__esModule", { value: true }), mod);
101
+ var __toCommonJS = (mod) => __copyProps(__defProp4({}, "__esModule", { value: true }), mod);
102
102
  var get_vercel_oidc_token_exports = {};
103
- __export5(get_vercel_oidc_token_exports, {
103
+ __export4(get_vercel_oidc_token_exports, {
104
104
  getVercelOidcToken: () => getVercelOidcToken3,
105
105
  getVercelOidcTokenSync: () => getVercelOidcTokenSync2
106
106
  });
107
107
  module.exports = __toCommonJS(get_vercel_oidc_token_exports);
108
108
  var import_get_context = require_get_context();
109
- var import_token_error = chunk6BMOC6SA_cjs.require_token_error();
109
+ var import_token_error = chunkOYL5TBJW_cjs.require_token_error();
110
110
  async function getVercelOidcToken3() {
111
111
  let token = "";
112
112
  let err;
@@ -117,8 +117,8 @@ var require_get_vercel_oidc_token = chunkO7I5CWRX_cjs.__commonJS({
117
117
  }
118
118
  try {
119
119
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
120
- await import('./token-util-WGALAXWM.cjs'),
121
- await import('./token-JT637FZG.cjs')
120
+ await import('./token-util-S4A355II.cjs'),
121
+ await import('./token-53CFGXUO.cjs')
122
122
  ]);
123
123
  if (!token || isExpired(getTokenPayload(token))) {
124
124
  await refreshToken();
@@ -145,28 +145,28 @@ ${error.message}`;
145
145
  }
146
146
  });
147
147
 
148
- // ../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/index.js
148
+ // ../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/index.js
149
149
  var require_dist = chunkO7I5CWRX_cjs.__commonJS({
150
- "../../node_modules/.pnpm/@vercel+oidc@3.0.2/node_modules/@vercel/oidc/dist/index.js"(exports, module) {
151
- var __defProp5 = Object.defineProperty;
150
+ "../../node_modules/.pnpm/@vercel+oidc@3.0.1/node_modules/@vercel/oidc/dist/index.js"(exports, module) {
151
+ var __defProp4 = Object.defineProperty;
152
152
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
153
153
  var __getOwnPropNames = Object.getOwnPropertyNames;
154
154
  var __hasOwnProp = Object.prototype.hasOwnProperty;
155
- var __export5 = (target, all) => {
156
- for (var name21 in all)
157
- __defProp5(target, name21, { get: all[name21], enumerable: true });
155
+ var __export4 = (target, all) => {
156
+ for (var name20 in all)
157
+ __defProp4(target, name20, { get: all[name20], enumerable: true });
158
158
  };
159
159
  var __copyProps = (to, from, except, desc) => {
160
160
  if (from && typeof from === "object" || typeof from === "function") {
161
161
  for (let key of __getOwnPropNames(from))
162
162
  if (!__hasOwnProp.call(to, key) && key !== except)
163
- __defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
163
+ __defProp4(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
164
164
  }
165
165
  return to;
166
166
  };
167
- var __toCommonJS = (mod) => __copyProps(__defProp5({}, "__esModule", { value: true }), mod);
167
+ var __toCommonJS = (mod) => __copyProps(__defProp4({}, "__esModule", { value: true }), mod);
168
168
  var src_exports = {};
169
- __export5(src_exports, {
169
+ __export4(src_exports, {
170
170
  getContext: () => import_get_context.getContext,
171
171
  getVercelOidcToken: () => import_get_vercel_oidc_token.getVercelOidcToken,
172
172
  getVercelOidcTokenSync: () => import_get_vercel_oidc_token.getVercelOidcTokenSync
@@ -300,8 +300,8 @@ var require_ignore = chunkO7I5CWRX_cjs.__commonJS({
300
300
  TMP_KEY_IGNORE = Symbol.for("node-ignore");
301
301
  }
302
302
  var KEY_IGNORE = TMP_KEY_IGNORE;
303
- var define = (object8, key, value) => {
304
- Object.defineProperty(object8, key, { value });
303
+ var define = (object3, key, value) => {
304
+ Object.defineProperty(object3, key, { value });
305
305
  return value;
306
306
  };
307
307
  var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
@@ -797,11 +797,11 @@ var getRefs = (options) => {
797
797
  flags: { hasReferencedOpenAiAnyType: false },
798
798
  currentPath,
799
799
  propertyPath: void 0,
800
- seen: new Map(Object.entries(_options.definitions).map(([name21, def]) => [
800
+ seen: new Map(Object.entries(_options.definitions).map(([name20, def]) => [
801
801
  def._def,
802
802
  {
803
803
  def: def._def,
804
- path: [..._options.basePath, _options.definitionPath, name21],
804
+ path: [..._options.basePath, _options.definitionPath, name20],
805
805
  // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
806
806
  jsonSchema: void 0
807
807
  }
@@ -1250,8 +1250,8 @@ function parseStringDef(def, refs) {
1250
1250
  }
1251
1251
  return res;
1252
1252
  }
1253
- function escapeLiteralCheckValue(literal7, refs) {
1254
- return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal7) : literal7;
1253
+ function escapeLiteralCheckValue(literal, refs) {
1254
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric(literal) : literal;
1255
1255
  }
1256
1256
  var ALPHA_NUMERIC = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
1257
1257
  function escapeNonAlphaNumeric(source) {
@@ -1469,11 +1469,11 @@ function parseMapDef(def, refs) {
1469
1469
 
1470
1470
  // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
1471
1471
  function parseNativeEnumDef(def) {
1472
- const object8 = def.values;
1472
+ const object3 = def.values;
1473
1473
  const actualKeys = Object.keys(def.values).filter((key) => {
1474
- return typeof object8[object8[key]] !== "number";
1474
+ return typeof object3[object3[key]] !== "number";
1475
1475
  });
1476
- const actualValues = actualKeys.map((key) => object8[key]);
1476
+ const actualValues = actualKeys.map((key) => object3[key]);
1477
1477
  const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
1478
1478
  return {
1479
1479
  type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
@@ -1923,17 +1923,17 @@ function parseDef(def, refs, forceResolution = false) {
1923
1923
  const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
1924
1924
  refs.seen.set(def, newItem);
1925
1925
  const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
1926
- const jsonSchema4 = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
1927
- if (jsonSchema4) {
1928
- addMeta(def, refs, jsonSchema4);
1926
+ const jsonSchema3 = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
1927
+ if (jsonSchema3) {
1928
+ addMeta(def, refs, jsonSchema3);
1929
1929
  }
1930
1930
  if (refs.postProcess) {
1931
- const postProcessResult = refs.postProcess(jsonSchema4, def, refs);
1932
- newItem.jsonSchema = jsonSchema4;
1931
+ const postProcessResult = refs.postProcess(jsonSchema3, def, refs);
1932
+ newItem.jsonSchema = jsonSchema3;
1933
1933
  return postProcessResult;
1934
1934
  }
1935
- newItem.jsonSchema = jsonSchema4;
1936
- return jsonSchema4;
1935
+ newItem.jsonSchema = jsonSchema3;
1936
+ return jsonSchema3;
1937
1937
  }
1938
1938
  var get$ref = (item, refs) => {
1939
1939
  switch (refs.$refStrategy) {
@@ -1951,30 +1951,30 @@ var get$ref = (item, refs) => {
1951
1951
  }
1952
1952
  }
1953
1953
  };
1954
- var addMeta = (def, refs, jsonSchema4) => {
1954
+ var addMeta = (def, refs, jsonSchema3) => {
1955
1955
  if (def.description) {
1956
- jsonSchema4.description = def.description;
1956
+ jsonSchema3.description = def.description;
1957
1957
  if (refs.markdownDescription) {
1958
- jsonSchema4.markdownDescription = def.description;
1958
+ jsonSchema3.markdownDescription = def.description;
1959
1959
  }
1960
1960
  }
1961
- return jsonSchema4;
1961
+ return jsonSchema3;
1962
1962
  };
1963
1963
 
1964
1964
  // ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
1965
1965
  var zodToJsonSchema = (schema, options) => {
1966
1966
  const refs = getRefs(options);
1967
- let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name26, schema2]) => ({
1967
+ let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name21, schema2]) => ({
1968
1968
  ...acc,
1969
- [name26]: parseDef(schema2._def, {
1969
+ [name21]: parseDef(schema2._def, {
1970
1970
  ...refs,
1971
- currentPath: [...refs.basePath, refs.definitionPath, name26]
1971
+ currentPath: [...refs.basePath, refs.definitionPath, name21]
1972
1972
  }, true) ?? parseAnyDef(refs)
1973
1973
  }), {}) : void 0;
1974
- const name21 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
1975
- const main = parseDef(schema._def, name21 === void 0 ? refs : {
1974
+ const name20 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
1975
+ const main = parseDef(schema._def, name20 === void 0 ? refs : {
1976
1976
  ...refs,
1977
- currentPath: [...refs.basePath, refs.definitionPath, name21]
1977
+ currentPath: [...refs.basePath, refs.definitionPath, name20]
1978
1978
  }, false) ?? parseAnyDef(refs);
1979
1979
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
1980
1980
  if (title !== void 0) {
@@ -1998,18 +1998,18 @@ var zodToJsonSchema = (schema, options) => {
1998
1998
  };
1999
1999
  }
2000
2000
  }
2001
- const combined = name21 === void 0 ? definitions ? {
2001
+ const combined = name20 === void 0 ? definitions ? {
2002
2002
  ...main,
2003
2003
  [refs.definitionPath]: definitions
2004
2004
  } : main : {
2005
2005
  $ref: [
2006
2006
  ...refs.$refStrategy === "relative" ? [] : refs.basePath,
2007
2007
  refs.definitionPath,
2008
- name21
2008
+ name20
2009
2009
  ].join("/"),
2010
2010
  [refs.definitionPath]: {
2011
2011
  ...definitions,
2012
- [name21]: main
2012
+ [name20]: main
2013
2013
  }
2014
2014
  };
2015
2015
  if (refs.target === "jsonSchema7") {
@@ -2027,10 +2027,10 @@ var zodToJsonSchema = (schema, options) => {
2027
2027
  var esm_default = zodToJsonSchema;
2028
2028
 
2029
2029
  // ../schema-compat/dist/chunk-GWTUXMDD.js
2030
- function zodToJsonSchema2(zodSchema4, target = "jsonSchema7", strategy = "relative") {
2030
+ function zodToJsonSchema2(zodSchema3, target = "jsonSchema7", strategy = "relative") {
2031
2031
  const fn = "toJSONSchema";
2032
2032
  if (fn in zod.z) {
2033
- return zod.z[fn](zodSchema4, {
2033
+ return zod.z[fn](zodSchema3, {
2034
2034
  unrepresentable: "any",
2035
2035
  override: (ctx) => {
2036
2036
  const def = ctx.zodSchema?._zod?.def;
@@ -2041,7 +2041,7 @@ function zodToJsonSchema2(zodSchema4, target = "jsonSchema7", strategy = "relati
2041
2041
  }
2042
2042
  });
2043
2043
  } else {
2044
- return esm_default(zodSchema4, {
2044
+ return esm_default(zodSchema3, {
2045
2045
  $refStrategy: strategy,
2046
2046
  target
2047
2047
  });
@@ -2641,8 +2641,8 @@ function formatDataStreamPart(type, value) {
2641
2641
  `;
2642
2642
  }
2643
2643
  function zodSchema(zodSchema22, options) {
2644
- var _a21;
2645
- const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
2644
+ var _a20;
2645
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
2646
2646
  return jsonSchema(
2647
2647
  esm_default(zodSchema22, {
2648
2648
  $refStrategy: useReferences ? "root" : "none",
@@ -2755,11 +2755,11 @@ var major = VERSION.split(".")[0];
2755
2755
  var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
2756
2756
  var _global = _globalThis;
2757
2757
  function registerGlobal(type, instance, diag, allowOverride) {
2758
- var _a21;
2758
+ var _a20;
2759
2759
  if (allowOverride === void 0) {
2760
2760
  allowOverride = false;
2761
2761
  }
2762
- var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a21 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a21 !== void 0 ? _a21 : {
2762
+ var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a20 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a20 !== void 0 ? _a20 : {
2763
2763
  version: VERSION
2764
2764
  };
2765
2765
  if (!allowOverride && api[type]) {
@@ -2777,8 +2777,8 @@ function registerGlobal(type, instance, diag, allowOverride) {
2777
2777
  return true;
2778
2778
  }
2779
2779
  function getGlobal(type) {
2780
- var _a21, _b8;
2781
- var globalVersion = (_a21 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a21 === void 0 ? void 0 : _a21.version;
2780
+ var _a20, _b8;
2781
+ var globalVersion = (_a20 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a20 === void 0 ? void 0 : _a20.version;
2782
2782
  if (!globalVersion || !isCompatible(globalVersion)) {
2783
2783
  return;
2784
2784
  }
@@ -2955,13 +2955,13 @@ var DiagAPI = (
2955
2955
  }
2956
2956
  var self = this;
2957
2957
  var setLogger = function(logger, optionsOrLogLevel) {
2958
- var _a21, _b8, _c;
2958
+ var _a20, _b8, _c;
2959
2959
  if (optionsOrLogLevel === void 0) {
2960
2960
  optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
2961
2961
  }
2962
2962
  if (logger === self) {
2963
2963
  var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
2964
- self.error((_a21 = err.stack) !== null && _a21 !== void 0 ? _a21 : err.message);
2964
+ self.error((_a20 = err.stack) !== null && _a20 !== void 0 ? _a20 : err.message);
2965
2965
  return false;
2966
2966
  }
2967
2967
  if (typeof optionsOrLogLevel === "number") {
@@ -3132,12 +3132,12 @@ var ContextAPI = (
3132
3132
  return this._getContextManager().active();
3133
3133
  };
3134
3134
  ContextAPI2.prototype.with = function(context, fn, thisArg) {
3135
- var _a21;
3135
+ var _a20;
3136
3136
  var args = [];
3137
3137
  for (var _i = 3; _i < arguments.length; _i++) {
3138
3138
  args[_i - 3] = arguments[_i];
3139
3139
  }
3140
- return (_a21 = this._getContextManager()).with.apply(_a21, __spreadArray4([context, fn, thisArg], __read4(args), false));
3140
+ return (_a20 = this._getContextManager()).with.apply(_a20, __spreadArray4([context, fn, thisArg], __read4(args), false));
3141
3141
  };
3142
3142
  ContextAPI2.prototype.bind = function(context, target) {
3143
3143
  return this._getContextManager().bind(context, target);
@@ -3232,8 +3232,8 @@ function setSpanContext(context, spanContext) {
3232
3232
  return setSpan(context, new NonRecordingSpan(spanContext));
3233
3233
  }
3234
3234
  function getSpanContext(context) {
3235
- var _a21;
3236
- return (_a21 = getSpan(context)) === null || _a21 === void 0 ? void 0 : _a21.spanContext();
3235
+ var _a20;
3236
+ return (_a20 = getSpan(context)) === null || _a20 === void 0 ? void 0 : _a20.spanContext();
3237
3237
  }
3238
3238
 
3239
3239
  // ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
@@ -3259,7 +3259,7 @@ var NoopTracer = (
3259
3259
  (function() {
3260
3260
  function NoopTracer2() {
3261
3261
  }
3262
- NoopTracer2.prototype.startSpan = function(name21, options, context) {
3262
+ NoopTracer2.prototype.startSpan = function(name20, options, context) {
3263
3263
  if (context === void 0) {
3264
3264
  context = contextApi.active();
3265
3265
  }
@@ -3274,7 +3274,7 @@ var NoopTracer = (
3274
3274
  return new NonRecordingSpan();
3275
3275
  }
3276
3276
  };
3277
- NoopTracer2.prototype.startActiveSpan = function(name21, arg2, arg3, arg4) {
3277
+ NoopTracer2.prototype.startActiveSpan = function(name20, arg2, arg3, arg4) {
3278
3278
  var opts;
3279
3279
  var ctx;
3280
3280
  var fn;
@@ -3291,7 +3291,7 @@ var NoopTracer = (
3291
3291
  fn = arg4;
3292
3292
  }
3293
3293
  var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
3294
- var span = this.startSpan(name21, opts, parentContext);
3294
+ var span = this.startSpan(name20, opts, parentContext);
3295
3295
  var contextWithSpanSet = setSpan(parentContext, span);
3296
3296
  return contextApi.with(contextWithSpanSet, fn, void 0, span);
3297
3297
  };
@@ -3307,14 +3307,14 @@ var NOOP_TRACER = new NoopTracer();
3307
3307
  var ProxyTracer = (
3308
3308
  /** @class */
3309
3309
  (function() {
3310
- function ProxyTracer2(_provider, name21, version, options) {
3310
+ function ProxyTracer2(_provider, name20, version, options) {
3311
3311
  this._provider = _provider;
3312
- this.name = name21;
3312
+ this.name = name20;
3313
3313
  this.version = version;
3314
3314
  this.options = options;
3315
3315
  }
3316
- ProxyTracer2.prototype.startSpan = function(name21, options, context) {
3317
- return this._getTracer().startSpan(name21, options, context);
3316
+ ProxyTracer2.prototype.startSpan = function(name20, options, context) {
3317
+ return this._getTracer().startSpan(name20, options, context);
3318
3318
  };
3319
3319
  ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
3320
3320
  var tracer = this._getTracer();
@@ -3355,20 +3355,20 @@ var ProxyTracerProvider = (
3355
3355
  (function() {
3356
3356
  function ProxyTracerProvider2() {
3357
3357
  }
3358
- ProxyTracerProvider2.prototype.getTracer = function(name21, version, options) {
3359
- var _a21;
3360
- return (_a21 = this.getDelegateTracer(name21, version, options)) !== null && _a21 !== void 0 ? _a21 : new ProxyTracer(this, name21, version, options);
3358
+ ProxyTracerProvider2.prototype.getTracer = function(name20, version, options) {
3359
+ var _a20;
3360
+ return (_a20 = this.getDelegateTracer(name20, version, options)) !== null && _a20 !== void 0 ? _a20 : new ProxyTracer(this, name20, version, options);
3361
3361
  };
3362
3362
  ProxyTracerProvider2.prototype.getDelegate = function() {
3363
- var _a21;
3364
- return (_a21 = this._delegate) !== null && _a21 !== void 0 ? _a21 : NOOP_TRACER_PROVIDER;
3363
+ var _a20;
3364
+ return (_a20 = this._delegate) !== null && _a20 !== void 0 ? _a20 : NOOP_TRACER_PROVIDER;
3365
3365
  };
3366
3366
  ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
3367
3367
  this._delegate = delegate;
3368
3368
  };
3369
- ProxyTracerProvider2.prototype.getDelegateTracer = function(name21, version, options) {
3370
- var _a21;
3371
- return (_a21 = this._delegate) === null || _a21 === void 0 ? void 0 : _a21.getTracer(name21, version, options);
3369
+ ProxyTracerProvider2.prototype.getDelegateTracer = function(name20, version, options) {
3370
+ var _a20;
3371
+ return (_a20 = this._delegate) === null || _a20 === void 0 ? void 0 : _a20.getTracer(name20, version, options);
3372
3372
  };
3373
3373
  return ProxyTracerProvider2;
3374
3374
  })()
@@ -3414,8 +3414,8 @@ var TraceAPI = (
3414
3414
  TraceAPI2.prototype.getTracerProvider = function() {
3415
3415
  return getGlobal(API_NAME3) || this._proxyTracerProvider;
3416
3416
  };
3417
- TraceAPI2.prototype.getTracer = function(name21, version) {
3418
- return this.getTracerProvider().getTracer(name21, version);
3417
+ TraceAPI2.prototype.getTracer = function(name20, version) {
3418
+ return this.getTracerProvider().getTracer(name20, version);
3419
3419
  };
3420
3420
  TraceAPI2.prototype.disable = function() {
3421
3421
  unregisterGlobal(API_NAME3, DiagAPI.instance());
@@ -3753,13 +3753,13 @@ function selectTelemetryAttributes({
3753
3753
  return { ...attributes2, [key]: value };
3754
3754
  }, {});
3755
3755
  }
3756
- function splitArray(array7, chunkSize) {
3756
+ function splitArray(array, chunkSize) {
3757
3757
  if (chunkSize <= 0) {
3758
3758
  throw new Error("chunkSize must be greater than 0");
3759
3759
  }
3760
3760
  const result = [];
3761
- for (let i = 0; i < array7.length; i += chunkSize) {
3762
- result.push(array7.slice(i, i + chunkSize));
3761
+ for (let i = 0; i < array.length; i += chunkSize) {
3762
+ result.push(array.slice(i, i + chunkSize));
3763
3763
  }
3764
3764
  return result;
3765
3765
  }
@@ -4586,13 +4586,13 @@ var _AISDKError = class _AISDKError2 extends Error {
4586
4586
  * @param {unknown} [params.cause] - The underlying cause of the error.
4587
4587
  */
4588
4588
  constructor({
4589
- name: name144,
4589
+ name: name143,
4590
4590
  message,
4591
4591
  cause
4592
4592
  }) {
4593
4593
  super(message);
4594
4594
  this[_a17] = true;
4595
- this.name = name144;
4595
+ this.name = name143;
4596
4596
  this.cause = cause;
4597
4597
  }
4598
4598
  /**
@@ -4603,8 +4603,8 @@ var _AISDKError = class _AISDKError2 extends Error {
4603
4603
  static isInstance(error) {
4604
4604
  return _AISDKError2.hasMarker(error, marker17);
4605
4605
  }
4606
- static hasMarker(error, marker154) {
4607
- const markerSymbol = Symbol.for(marker154);
4606
+ static hasMarker(error, marker153) {
4607
+ const markerSymbol = Symbol.for(marker153);
4608
4608
  return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
4609
4609
  }
4610
4610
  };
@@ -4696,15 +4696,15 @@ var marker72 = `vercel.ai.error.${name62}`;
4696
4696
  var symbol72 = Symbol.for(marker72);
4697
4697
  var _a72;
4698
4698
  var JSONParseError = class extends AISDKError2 {
4699
- constructor({ text: text4, cause }) {
4699
+ constructor({ text: text3, cause }) {
4700
4700
  super({
4701
4701
  name: name62,
4702
- message: `JSON parsing failed: Text: ${text4}.
4702
+ message: `JSON parsing failed: Text: ${text3}.
4703
4703
  Error message: ${getErrorMessage2(cause)}`,
4704
4704
  cause
4705
4705
  });
4706
4706
  this[_a72] = true;
4707
- this.text = text4;
4707
+ this.text = text3;
4708
4708
  }
4709
4709
  static isInstance(error) {
4710
4710
  return AISDKError2.hasMarker(error, marker72);
@@ -4937,11 +4937,11 @@ function extractResponseHeaders(response) {
4937
4937
  return Object.fromEntries([...response.headers]);
4938
4938
  }
4939
4939
  function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
4940
- var _a21, _b8, _c;
4940
+ var _a20, _b8, _c;
4941
4941
  if (globalThisAny.window) {
4942
4942
  return `runtime/browser`;
4943
4943
  }
4944
- if ((_a21 = globalThisAny.navigator) == null ? void 0 : _a21.userAgent) {
4944
+ if ((_a20 = globalThisAny.navigator) == null ? void 0 : _a20.userAgent) {
4945
4945
  return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
4946
4946
  }
4947
4947
  if ((_c = (_b8 = globalThisAny.process) == null ? void 0 : _b8.versions) == null ? void 0 : _c.node) {
@@ -4952,9 +4952,9 @@ function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
4952
4952
  }
4953
4953
  return "runtime/unknown";
4954
4954
  }
4955
- function removeUndefinedEntries(record3) {
4955
+ function removeUndefinedEntries(record) {
4956
4956
  return Object.fromEntries(
4957
- Object.entries(record3).filter(([_key, value]) => value != null)
4957
+ Object.entries(record).filter(([_key, value]) => value != null)
4958
4958
  );
4959
4959
  }
4960
4960
  function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
@@ -5122,12 +5122,12 @@ function loadOptionalSetting({
5122
5122
  }
5123
5123
  var suspectProtoRx = /"__proto__"\s*:/;
5124
5124
  var suspectConstructorRx = /"constructor"\s*:/;
5125
- function _parse(text4) {
5126
- const obj = JSON.parse(text4);
5125
+ function _parse(text3) {
5126
+ const obj = JSON.parse(text3);
5127
5127
  if (obj === null || typeof obj !== "object") {
5128
5128
  return obj;
5129
5129
  }
5130
- if (suspectProtoRx.test(text4) === false && suspectConstructorRx.test(text4) === false) {
5130
+ if (suspectProtoRx.test(text3) === false && suspectConstructorRx.test(text3) === false) {
5131
5131
  return obj;
5132
5132
  }
5133
5133
  return filter(obj);
@@ -5154,11 +5154,11 @@ function filter(obj) {
5154
5154
  }
5155
5155
  return obj;
5156
5156
  }
5157
- function secureJsonParse(text4) {
5157
+ function secureJsonParse(text3) {
5158
5158
  const { stackTraceLimit } = Error;
5159
5159
  Error.stackTraceLimit = 0;
5160
5160
  try {
5161
- return _parse(text4);
5161
+ return _parse(text3);
5162
5162
  } finally {
5163
5163
  Error.stackTraceLimit = stackTraceLimit;
5164
5164
  }
@@ -5199,12 +5199,12 @@ async function safeValidateTypes2({
5199
5199
  value,
5200
5200
  schema
5201
5201
  }) {
5202
- const validator22 = asValidator(schema);
5202
+ const validator2 = asValidator(schema);
5203
5203
  try {
5204
- if (validator22.validate == null) {
5204
+ if (validator2.validate == null) {
5205
5205
  return { success: true, value, rawValue: value };
5206
5206
  }
5207
- const result = await validator22.validate(value);
5207
+ const result = await validator2.validate(value);
5208
5208
  if (result.success) {
5209
5209
  return { success: true, value: result.value, rawValue: value };
5210
5210
  }
@@ -5222,11 +5222,11 @@ async function safeValidateTypes2({
5222
5222
  }
5223
5223
  }
5224
5224
  async function parseJSON({
5225
- text: text4,
5225
+ text: text3,
5226
5226
  schema
5227
5227
  }) {
5228
5228
  try {
5229
- const value = secureJsonParse(text4);
5229
+ const value = secureJsonParse(text3);
5230
5230
  if (schema == null) {
5231
5231
  return value;
5232
5232
  }
@@ -5235,15 +5235,15 @@ async function parseJSON({
5235
5235
  if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
5236
5236
  throw error;
5237
5237
  }
5238
- throw new JSONParseError({ text: text4, cause: error });
5238
+ throw new JSONParseError({ text: text3, cause: error });
5239
5239
  }
5240
5240
  }
5241
5241
  async function safeParseJSON2({
5242
- text: text4,
5242
+ text: text3,
5243
5243
  schema
5244
5244
  }) {
5245
5245
  try {
5246
- const value = secureJsonParse(text4);
5246
+ const value = secureJsonParse(text3);
5247
5247
  if (schema == null) {
5248
5248
  return { success: true, value, rawValue: value };
5249
5249
  }
@@ -5251,7 +5251,7 @@ async function safeParseJSON2({
5251
5251
  } catch (error) {
5252
5252
  return {
5253
5253
  success: false,
5254
- error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
5254
+ error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text3, cause: error }),
5255
5255
  rawValue: void 0
5256
5256
  };
5257
5257
  }
@@ -5504,11 +5504,11 @@ function parseAnyDef2() {
5504
5504
  return {};
5505
5505
  }
5506
5506
  function parseArrayDef2(def, refs) {
5507
- var _a21, _b8, _c;
5507
+ var _a20, _b8, _c;
5508
5508
  const res = {
5509
5509
  type: "array"
5510
5510
  };
5511
- if (((_a21 = def.type) == null ? void 0 : _a21._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
5511
+ if (((_a20 = def.type) == null ? void 0 : _a20._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
5512
5512
  res.items = parseDef2(def.type._def, {
5513
5513
  ...refs,
5514
5514
  currentPath: [...refs.currentPath, "items"]
@@ -5852,8 +5852,8 @@ function parseStringDef2(def, refs) {
5852
5852
  }
5853
5853
  return res;
5854
5854
  }
5855
- function escapeLiteralCheckValue2(literal7, refs) {
5856
- return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal7) : literal7;
5855
+ function escapeLiteralCheckValue2(literal, refs) {
5856
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal) : literal;
5857
5857
  }
5858
5858
  var ALPHA_NUMERIC2 = new Set(
5859
5859
  "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
@@ -5869,8 +5869,8 @@ function escapeNonAlphaNumeric2(source) {
5869
5869
  return result;
5870
5870
  }
5871
5871
  function addFormat2(schema, value, message, refs) {
5872
- var _a21;
5873
- if (schema.format || ((_a21 = schema.anyOf) == null ? void 0 : _a21.some((x) => x.format))) {
5872
+ var _a20;
5873
+ if (schema.format || ((_a20 = schema.anyOf) == null ? void 0 : _a20.some((x) => x.format))) {
5874
5874
  if (!schema.anyOf) {
5875
5875
  schema.anyOf = [];
5876
5876
  }
@@ -5889,8 +5889,8 @@ function addFormat2(schema, value, message, refs) {
5889
5889
  }
5890
5890
  }
5891
5891
  function addPattern2(schema, regex, message, refs) {
5892
- var _a21;
5893
- if (schema.pattern || ((_a21 = schema.allOf) == null ? void 0 : _a21.some((x) => x.pattern))) {
5892
+ var _a20;
5893
+ if (schema.pattern || ((_a20 = schema.allOf) == null ? void 0 : _a20.some((x) => x.pattern))) {
5894
5894
  if (!schema.allOf) {
5895
5895
  schema.allOf = [];
5896
5896
  }
@@ -5909,7 +5909,7 @@ function addPattern2(schema, regex, message, refs) {
5909
5909
  }
5910
5910
  }
5911
5911
  function stringifyRegExpWithFlags2(regex, refs) {
5912
- var _a21;
5912
+ var _a20;
5913
5913
  if (!refs.applyRegexFlags || !regex.flags) {
5914
5914
  return regex.source;
5915
5915
  }
@@ -5939,7 +5939,7 @@ function stringifyRegExpWithFlags2(regex, refs) {
5939
5939
  pattern += source[i];
5940
5940
  pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
5941
5941
  inCharRange = false;
5942
- } else if (source[i + 1] === "-" && ((_a21 = source[i + 2]) == null ? void 0 : _a21.match(/[a-z]/))) {
5942
+ } else if (source[i + 1] === "-" && ((_a20 = source[i + 2]) == null ? void 0 : _a20.match(/[a-z]/))) {
5943
5943
  pattern += source[i];
5944
5944
  inCharRange = true;
5945
5945
  } else {
@@ -5981,13 +5981,13 @@ function stringifyRegExpWithFlags2(regex, refs) {
5981
5981
  return pattern;
5982
5982
  }
5983
5983
  function parseRecordDef2(def, refs) {
5984
- var _a21, _b8, _c, _d, _e, _f;
5984
+ var _a20, _b8, _c, _d, _e, _f;
5985
5985
  const schema = {
5986
5986
  type: "object",
5987
- additionalProperties: (_a21 = parseDef2(def.valueType._def, {
5987
+ additionalProperties: (_a20 = parseDef2(def.valueType._def, {
5988
5988
  ...refs,
5989
5989
  currentPath: [...refs.currentPath, "additionalProperties"]
5990
- })) != null ? _a21 : refs.allowedAdditionalProperties
5990
+ })) != null ? _a20 : refs.allowedAdditionalProperties
5991
5991
  };
5992
5992
  if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
5993
5993
  const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
@@ -6038,11 +6038,11 @@ function parseMapDef2(def, refs) {
6038
6038
  };
6039
6039
  }
6040
6040
  function parseNativeEnumDef2(def) {
6041
- const object8 = def.values;
6041
+ const object3 = def.values;
6042
6042
  const actualKeys = Object.keys(def.values).filter((key) => {
6043
- return typeof object8[object8[key]] !== "number";
6043
+ return typeof object3[object3[key]] !== "number";
6044
6044
  });
6045
- const actualValues = actualKeys.map((key) => object8[key]);
6045
+ const actualValues = actualKeys.map((key) => object3[key]);
6046
6046
  const parsedTypes = Array.from(
6047
6047
  new Set(actualValues.map((values) => typeof values))
6048
6048
  );
@@ -6246,8 +6246,8 @@ function safeIsOptional2(schema) {
6246
6246
  }
6247
6247
  }
6248
6248
  var parseOptionalDef2 = (def, refs) => {
6249
- var _a21;
6250
- if (refs.currentPath.toString() === ((_a21 = refs.propertyPath) == null ? void 0 : _a21.toString())) {
6249
+ var _a20;
6250
+ if (refs.currentPath.toString() === ((_a20 = refs.propertyPath) == null ? void 0 : _a20.toString())) {
6251
6251
  return parseDef2(def.innerType._def, refs);
6252
6252
  }
6253
6253
  const innerSchema = parseDef2(def.innerType._def, {
@@ -6417,10 +6417,10 @@ var selectParser2 = (def, typeName, refs) => {
6417
6417
  }
6418
6418
  };
6419
6419
  function parseDef2(def, refs, forceResolution = false) {
6420
- var _a21;
6420
+ var _a20;
6421
6421
  const seenItem = refs.seen.get(def);
6422
6422
  if (refs.override) {
6423
- const overrideResult = (_a21 = refs.override) == null ? void 0 : _a21.call(
6423
+ const overrideResult = (_a20 = refs.override) == null ? void 0 : _a20.call(
6424
6424
  refs,
6425
6425
  def,
6426
6426
  refs,
@@ -6486,11 +6486,11 @@ var getRefs2 = (options) => {
6486
6486
  currentPath,
6487
6487
  propertyPath: void 0,
6488
6488
  seen: new Map(
6489
- Object.entries(_options.definitions).map(([name21, def]) => [
6489
+ Object.entries(_options.definitions).map(([name20, def]) => [
6490
6490
  def._def,
6491
6491
  {
6492
6492
  def: def._def,
6493
- path: [..._options.basePath, _options.definitionPath, name21],
6493
+ path: [..._options.basePath, _options.definitionPath, name20],
6494
6494
  // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
6495
6495
  jsonSchema: void 0
6496
6496
  }
@@ -6499,50 +6499,50 @@ var getRefs2 = (options) => {
6499
6499
  };
6500
6500
  };
6501
6501
  var zodToJsonSchema3 = (schema, options) => {
6502
- var _a21;
6502
+ var _a20;
6503
6503
  const refs = getRefs2(options);
6504
6504
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
6505
- (acc, [name26, schema2]) => {
6506
- var _a26;
6505
+ (acc, [name25, schema2]) => {
6506
+ var _a25;
6507
6507
  return {
6508
6508
  ...acc,
6509
- [name26]: (_a26 = parseDef2(
6509
+ [name25]: (_a25 = parseDef2(
6510
6510
  schema2._def,
6511
6511
  {
6512
6512
  ...refs,
6513
- currentPath: [...refs.basePath, refs.definitionPath, name26]
6513
+ currentPath: [...refs.basePath, refs.definitionPath, name25]
6514
6514
  },
6515
6515
  true
6516
- )) != null ? _a26 : parseAnyDef2()
6516
+ )) != null ? _a25 : parseAnyDef2()
6517
6517
  };
6518
6518
  },
6519
6519
  {}
6520
6520
  ) : void 0;
6521
- const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
6522
- const main = (_a21 = parseDef2(
6521
+ const name20 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
6522
+ const main = (_a20 = parseDef2(
6523
6523
  schema._def,
6524
- name21 === void 0 ? refs : {
6524
+ name20 === void 0 ? refs : {
6525
6525
  ...refs,
6526
- currentPath: [...refs.basePath, refs.definitionPath, name21]
6526
+ currentPath: [...refs.basePath, refs.definitionPath, name20]
6527
6527
  },
6528
6528
  false
6529
- )) != null ? _a21 : parseAnyDef2();
6529
+ )) != null ? _a20 : parseAnyDef2();
6530
6530
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
6531
6531
  if (title !== void 0) {
6532
6532
  main.title = title;
6533
6533
  }
6534
- const combined = name21 === void 0 ? definitions ? {
6534
+ const combined = name20 === void 0 ? definitions ? {
6535
6535
  ...main,
6536
6536
  [refs.definitionPath]: definitions
6537
6537
  } : main : {
6538
6538
  $ref: [
6539
6539
  ...refs.$refStrategy === "relative" ? [] : refs.basePath,
6540
6540
  refs.definitionPath,
6541
- name21
6541
+ name20
6542
6542
  ].join("/"),
6543
6543
  [refs.definitionPath]: {
6544
6544
  ...definitions,
6545
- [name21]: main
6545
+ [name20]: main
6546
6546
  }
6547
6547
  };
6548
6548
  combined.$schema = "http://json-schema.org/draft-07/schema#";
@@ -6550,8 +6550,8 @@ var zodToJsonSchema3 = (schema, options) => {
6550
6550
  };
6551
6551
  var zod_to_json_schema_default = zodToJsonSchema3;
6552
6552
  function zod3Schema(zodSchema22, options) {
6553
- var _a21;
6554
- const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
6553
+ var _a20;
6554
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
6555
6555
  return jsonSchema2(
6556
6556
  zod_to_json_schema_default(zodSchema22, {
6557
6557
  $refStrategy: useReferences ? "root" : "none"
@@ -6565,16 +6565,16 @@ function zod3Schema(zodSchema22, options) {
6565
6565
  );
6566
6566
  }
6567
6567
  function zod4Schema(zodSchema22, options) {
6568
- var _a21;
6569
- const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
6570
- const z4JSONSchema = z104__namespace.toJSONSchema(zodSchema22, {
6568
+ var _a20;
6569
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
6570
+ const z4JSONSchema = z42__namespace.toJSONSchema(zodSchema22, {
6571
6571
  target: "draft-7",
6572
6572
  io: "output",
6573
6573
  reused: useReferences ? "ref" : "inline"
6574
6574
  });
6575
6575
  return jsonSchema2(z4JSONSchema, {
6576
6576
  validate: async (value) => {
6577
- const result = await z104__namespace.safeParseAsync(zodSchema22, value);
6577
+ const result = await z42__namespace.safeParseAsync(zodSchema22, value);
6578
6578
  return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
6579
6579
  }
6580
6580
  });
@@ -6754,8 +6754,8 @@ var GatewayRateLimitError = class extends (_b4 = GatewayError, _a43 = symbol43,
6754
6754
  var name43 = "GatewayModelNotFoundError";
6755
6755
  var marker53 = `vercel.ai.gateway.error.${name43}`;
6756
6756
  var symbol53 = Symbol.for(marker53);
6757
- var modelNotFoundParamSchema = z104.z.object({
6758
- modelId: z104.z.string()
6757
+ var modelNotFoundParamSchema = z42.z.object({
6758
+ modelId: z42.z.string()
6759
6759
  });
6760
6760
  var _a53;
6761
6761
  var _b5;
@@ -6869,23 +6869,23 @@ function createGatewayErrorFromResponse({
6869
6869
  return new GatewayInternalServerError({ message, statusCode, cause });
6870
6870
  }
6871
6871
  }
6872
- var gatewayErrorResponseSchema = z104.z.object({
6873
- error: z104.z.object({
6874
- message: z104.z.string(),
6875
- type: z104.z.string().nullish(),
6876
- param: z104.z.unknown().nullish(),
6877
- code: z104.z.union([z104.z.string(), z104.z.number()]).nullish()
6872
+ var gatewayErrorResponseSchema = z42.z.object({
6873
+ error: z42.z.object({
6874
+ message: z42.z.string(),
6875
+ type: z42.z.string().nullish(),
6876
+ param: z42.z.unknown().nullish(),
6877
+ code: z42.z.union([z42.z.string(), z42.z.number()]).nullish()
6878
6878
  })
6879
6879
  });
6880
6880
  function asGatewayError(error, authMethod) {
6881
- var _a85;
6881
+ var _a84;
6882
6882
  if (GatewayError.isInstance(error)) {
6883
6883
  return error;
6884
6884
  }
6885
6885
  if (APICallError2.isInstance(error)) {
6886
6886
  return createGatewayErrorFromResponse({
6887
6887
  response: extractApiCallResponse(error),
6888
- statusCode: (_a85 = error.statusCode) != null ? _a85 : 500,
6888
+ statusCode: (_a84 = error.statusCode) != null ? _a84 : 500,
6889
6889
  defaultMessage: "Gateway request failed",
6890
6890
  cause: error,
6891
6891
  authMethod
@@ -6919,9 +6919,9 @@ function parseAuthMethod(headers) {
6919
6919
  );
6920
6920
  return result.success ? result.data : void 0;
6921
6921
  }
6922
- var gatewayAuthMethodSchema = z104.z.union([
6923
- z104.z.literal("api-key"),
6924
- z104.z.literal("oidc")
6922
+ var gatewayAuthMethodSchema = z42.z.union([
6923
+ z42.z.literal("api-key"),
6924
+ z42.z.literal("oidc")
6925
6925
  ]);
6926
6926
  var GatewayFetchMetadata = class {
6927
6927
  constructor(config) {
@@ -6936,7 +6936,7 @@ var GatewayFetchMetadata = class {
6936
6936
  gatewayFetchMetadataSchema
6937
6937
  ),
6938
6938
  failedResponseHandler: createJsonErrorResponseHandler({
6939
- errorSchema: z104.z.any(),
6939
+ errorSchema: z42.z.any(),
6940
6940
  errorToMessage: (data) => data
6941
6941
  }),
6942
6942
  fetch: this.config.fetch
@@ -6954,7 +6954,7 @@ var GatewayFetchMetadata = class {
6954
6954
  headers: await resolve(this.config.headers()),
6955
6955
  successfulResponseHandler: createJsonResponseHandler(gatewayCreditsSchema),
6956
6956
  failedResponseHandler: createJsonErrorResponseHandler({
6957
- errorSchema: z104.z.any(),
6957
+ errorSchema: z42.z.any(),
6958
6958
  errorToMessage: (data) => data
6959
6959
  }),
6960
6960
  fetch: this.config.fetch
@@ -6965,36 +6965,36 @@ var GatewayFetchMetadata = class {
6965
6965
  }
6966
6966
  }
6967
6967
  };
6968
- var gatewayLanguageModelSpecificationSchema = z104.z.object({
6969
- specificationVersion: z104.z.literal("v2"),
6970
- provider: z104.z.string(),
6971
- modelId: z104.z.string()
6968
+ var gatewayLanguageModelSpecificationSchema = z42.z.object({
6969
+ specificationVersion: z42.z.literal("v2"),
6970
+ provider: z42.z.string(),
6971
+ modelId: z42.z.string()
6972
6972
  });
6973
- var gatewayLanguageModelPricingSchema = z104.z.object({
6974
- input: z104.z.string(),
6975
- output: z104.z.string(),
6976
- input_cache_read: z104.z.string().nullish(),
6977
- input_cache_write: z104.z.string().nullish()
6973
+ var gatewayLanguageModelPricingSchema = z42.z.object({
6974
+ input: z42.z.string(),
6975
+ output: z42.z.string(),
6976
+ input_cache_read: z42.z.string().nullish(),
6977
+ input_cache_write: z42.z.string().nullish()
6978
6978
  }).transform(({ input, output, input_cache_read, input_cache_write }) => ({
6979
6979
  input,
6980
6980
  output,
6981
6981
  ...input_cache_read ? { cachedInputTokens: input_cache_read } : {},
6982
6982
  ...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
6983
6983
  }));
6984
- var gatewayLanguageModelEntrySchema = z104.z.object({
6985
- id: z104.z.string(),
6986
- name: z104.z.string(),
6987
- description: z104.z.string().nullish(),
6984
+ var gatewayLanguageModelEntrySchema = z42.z.object({
6985
+ id: z42.z.string(),
6986
+ name: z42.z.string(),
6987
+ description: z42.z.string().nullish(),
6988
6988
  pricing: gatewayLanguageModelPricingSchema.nullish(),
6989
6989
  specification: gatewayLanguageModelSpecificationSchema,
6990
- modelType: z104.z.enum(["language", "embedding", "image"]).nullish()
6990
+ modelType: z42.z.enum(["language", "embedding", "image"]).nullish()
6991
6991
  });
6992
- var gatewayFetchMetadataSchema = z104.z.object({
6993
- models: z104.z.array(gatewayLanguageModelEntrySchema)
6992
+ var gatewayFetchMetadataSchema = z42.z.object({
6993
+ models: z42.z.array(gatewayLanguageModelEntrySchema)
6994
6994
  });
6995
- var gatewayCreditsSchema = z104.z.object({
6996
- balance: z104.z.string(),
6997
- total_used: z104.z.string()
6995
+ var gatewayCreditsSchema = z42.z.object({
6996
+ balance: z42.z.string(),
6997
+ total_used: z42.z.string()
6998
6998
  }).transform(({ balance, total_used }) => ({
6999
6999
  balance,
7000
7000
  totalUsed: total_used
@@ -7034,9 +7034,9 @@ var GatewayLanguageModel = class {
7034
7034
  await resolve(this.config.o11yHeaders)
7035
7035
  ),
7036
7036
  body: args,
7037
- successfulResponseHandler: createJsonResponseHandler(z104.z.any()),
7037
+ successfulResponseHandler: createJsonResponseHandler(z42.z.any()),
7038
7038
  failedResponseHandler: createJsonErrorResponseHandler({
7039
- errorSchema: z104.z.any(),
7039
+ errorSchema: z42.z.any(),
7040
7040
  errorToMessage: (data) => data
7041
7041
  }),
7042
7042
  ...abortSignal && { abortSignal },
@@ -7066,9 +7066,9 @@ var GatewayLanguageModel = class {
7066
7066
  await resolve(this.config.o11yHeaders)
7067
7067
  ),
7068
7068
  body: args,
7069
- successfulResponseHandler: createEventSourceResponseHandler(z104.z.any()),
7069
+ successfulResponseHandler: createEventSourceResponseHandler(z42.z.any()),
7070
7070
  failedResponseHandler: createJsonErrorResponseHandler({
7071
- errorSchema: z104.z.any(),
7071
+ errorSchema: z42.z.any(),
7072
7072
  errorToMessage: (data) => data
7073
7073
  }),
7074
7074
  ...abortSignal && { abortSignal },
@@ -7161,7 +7161,7 @@ var GatewayEmbeddingModel = class {
7161
7161
  abortSignal,
7162
7162
  providerOptions
7163
7163
  }) {
7164
- var _a85;
7164
+ var _a84;
7165
7165
  const resolvedHeaders = await resolve(this.config.headers());
7166
7166
  try {
7167
7167
  const {
@@ -7184,7 +7184,7 @@ var GatewayEmbeddingModel = class {
7184
7184
  gatewayEmbeddingResponseSchema
7185
7185
  ),
7186
7186
  failedResponseHandler: createJsonErrorResponseHandler({
7187
- errorSchema: z104.z.any(),
7187
+ errorSchema: z42.z.any(),
7188
7188
  errorToMessage: (data) => data
7189
7189
  }),
7190
7190
  ...abortSignal && { abortSignal },
@@ -7192,7 +7192,7 @@ var GatewayEmbeddingModel = class {
7192
7192
  });
7193
7193
  return {
7194
7194
  embeddings: responseBody.embeddings,
7195
- usage: (_a85 = responseBody.usage) != null ? _a85 : void 0,
7195
+ usage: (_a84 = responseBody.usage) != null ? _a84 : void 0,
7196
7196
  providerMetadata: responseBody.providerMetadata,
7197
7197
  response: { headers: responseHeaders, body: rawValue }
7198
7198
  };
@@ -7210,22 +7210,22 @@ var GatewayEmbeddingModel = class {
7210
7210
  };
7211
7211
  }
7212
7212
  };
7213
- var gatewayEmbeddingResponseSchema = z104.z.object({
7214
- embeddings: z104.z.array(z104.z.array(z104.z.number())),
7215
- usage: z104.z.object({ tokens: z104.z.number() }).nullish(),
7216
- providerMetadata: z104.z.record(z104.z.string(), z104.z.record(z104.z.string(), z104.z.unknown())).optional()
7213
+ var gatewayEmbeddingResponseSchema = z42.z.object({
7214
+ embeddings: z42.z.array(z42.z.array(z42.z.number())),
7215
+ usage: z42.z.object({ tokens: z42.z.number() }).nullish(),
7216
+ providerMetadata: z42.z.record(z42.z.string(), z42.z.record(z42.z.string(), z42.z.unknown())).optional()
7217
7217
  });
7218
7218
  async function getVercelRequestId() {
7219
- var _a85;
7220
- return (_a85 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a85["x-vercel-id"];
7219
+ var _a84;
7220
+ return (_a84 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a84["x-vercel-id"];
7221
7221
  }
7222
7222
  var VERSION3 = "1.0.33" ;
7223
7223
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
7224
7224
  function createGatewayProvider(options = {}) {
7225
- var _a85, _b8;
7225
+ var _a84, _b8;
7226
7226
  let pendingMetadata = null;
7227
7227
  let metadataCache = null;
7228
- const cacheRefreshMillis = (_a85 = options.metadataCacheRefreshMillis) != null ? _a85 : 1e3 * 60 * 5;
7228
+ const cacheRefreshMillis = (_a84 = options.metadataCacheRefreshMillis) != null ? _a84 : 1e3 * 60 * 5;
7229
7229
  let lastFetchTime = 0;
7230
7230
  const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/v1/ai";
7231
7231
  const getHeaders = async () => {
@@ -7280,8 +7280,8 @@ function createGatewayProvider(options = {}) {
7280
7280
  });
7281
7281
  };
7282
7282
  const getAvailableModels = async () => {
7283
- var _a95, _b9, _c;
7284
- const now = (_c = (_b9 = (_a95 = options._internal) == null ? void 0 : _a95.currentDate) == null ? void 0 : _b9.call(_a95).getTime()) != null ? _c : Date.now();
7283
+ var _a94, _b9, _c;
7284
+ const now = (_c = (_b9 = (_a94 = options._internal) == null ? void 0 : _a94.currentDate) == null ? void 0 : _b9.call(_a94).getTime()) != null ? _c : Date.now();
7285
7285
  if (!pendingMetadata || now - lastFetchTime > cacheRefreshMillis) {
7286
7286
  lastFetchTime = now;
7287
7287
  pendingMetadata = new GatewayFetchMetadata({
@@ -7458,11 +7458,11 @@ function getGlobalProvider() {
7458
7458
  return (_a172 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a172 : gateway;
7459
7459
  }
7460
7460
  var VERSION4 = "5.0.60" ;
7461
- var dataContentSchema2 = z104.z.union([
7462
- z104.z.string(),
7463
- z104.z.instanceof(Uint8Array),
7464
- z104.z.instanceof(ArrayBuffer),
7465
- z104.z.custom(
7461
+ var dataContentSchema2 = z42.z.union([
7462
+ z42.z.string(),
7463
+ z42.z.instanceof(Uint8Array),
7464
+ z42.z.instanceof(ArrayBuffer),
7465
+ z42.z.custom(
7466
7466
  // Buffer might not be available in some environments such as CloudFlare:
7467
7467
  (value) => {
7468
7468
  var _a172, _b8;
@@ -7471,113 +7471,113 @@ var dataContentSchema2 = z104.z.union([
7471
7471
  { message: "Must be a Buffer" }
7472
7472
  )
7473
7473
  ]);
7474
- var jsonValueSchema2 = z104.z.lazy(
7475
- () => z104.z.union([
7476
- z104.z.null(),
7477
- z104.z.string(),
7478
- z104.z.number(),
7479
- z104.z.boolean(),
7480
- z104.z.record(z104.z.string(), jsonValueSchema2),
7481
- z104.z.array(jsonValueSchema2)
7474
+ var jsonValueSchema2 = z42.z.lazy(
7475
+ () => z42.z.union([
7476
+ z42.z.null(),
7477
+ z42.z.string(),
7478
+ z42.z.number(),
7479
+ z42.z.boolean(),
7480
+ z42.z.record(z42.z.string(), jsonValueSchema2),
7481
+ z42.z.array(jsonValueSchema2)
7482
7482
  ])
7483
7483
  );
7484
- var providerMetadataSchema2 = z104.z.record(
7485
- z104.z.string(),
7486
- z104.z.record(z104.z.string(), jsonValueSchema2)
7484
+ var providerMetadataSchema2 = z42.z.record(
7485
+ z42.z.string(),
7486
+ z42.z.record(z42.z.string(), jsonValueSchema2)
7487
7487
  );
7488
- var textPartSchema2 = z104.z.object({
7489
- type: z104.z.literal("text"),
7490
- text: z104.z.string(),
7488
+ var textPartSchema2 = z42.z.object({
7489
+ type: z42.z.literal("text"),
7490
+ text: z42.z.string(),
7491
7491
  providerOptions: providerMetadataSchema2.optional()
7492
7492
  });
7493
- var imagePartSchema2 = z104.z.object({
7494
- type: z104.z.literal("image"),
7495
- image: z104.z.union([dataContentSchema2, z104.z.instanceof(URL)]),
7496
- mediaType: z104.z.string().optional(),
7493
+ var imagePartSchema2 = z42.z.object({
7494
+ type: z42.z.literal("image"),
7495
+ image: z42.z.union([dataContentSchema2, z42.z.instanceof(URL)]),
7496
+ mediaType: z42.z.string().optional(),
7497
7497
  providerOptions: providerMetadataSchema2.optional()
7498
7498
  });
7499
- var filePartSchema2 = z104.z.object({
7500
- type: z104.z.literal("file"),
7501
- data: z104.z.union([dataContentSchema2, z104.z.instanceof(URL)]),
7502
- filename: z104.z.string().optional(),
7503
- mediaType: z104.z.string(),
7499
+ var filePartSchema2 = z42.z.object({
7500
+ type: z42.z.literal("file"),
7501
+ data: z42.z.union([dataContentSchema2, z42.z.instanceof(URL)]),
7502
+ filename: z42.z.string().optional(),
7503
+ mediaType: z42.z.string(),
7504
7504
  providerOptions: providerMetadataSchema2.optional()
7505
7505
  });
7506
- var reasoningPartSchema2 = z104.z.object({
7507
- type: z104.z.literal("reasoning"),
7508
- text: z104.z.string(),
7506
+ var reasoningPartSchema2 = z42.z.object({
7507
+ type: z42.z.literal("reasoning"),
7508
+ text: z42.z.string(),
7509
7509
  providerOptions: providerMetadataSchema2.optional()
7510
7510
  });
7511
- var toolCallPartSchema2 = z104.z.object({
7512
- type: z104.z.literal("tool-call"),
7513
- toolCallId: z104.z.string(),
7514
- toolName: z104.z.string(),
7515
- input: z104.z.unknown(),
7511
+ var toolCallPartSchema2 = z42.z.object({
7512
+ type: z42.z.literal("tool-call"),
7513
+ toolCallId: z42.z.string(),
7514
+ toolName: z42.z.string(),
7515
+ input: z42.z.unknown(),
7516
7516
  providerOptions: providerMetadataSchema2.optional(),
7517
- providerExecuted: z104.z.boolean().optional()
7517
+ providerExecuted: z42.z.boolean().optional()
7518
7518
  });
7519
- var outputSchema = z104.z.discriminatedUnion("type", [
7520
- z104.z.object({
7521
- type: z104.z.literal("text"),
7522
- value: z104.z.string()
7519
+ var outputSchema = z42.z.discriminatedUnion("type", [
7520
+ z42.z.object({
7521
+ type: z42.z.literal("text"),
7522
+ value: z42.z.string()
7523
7523
  }),
7524
- z104.z.object({
7525
- type: z104.z.literal("json"),
7524
+ z42.z.object({
7525
+ type: z42.z.literal("json"),
7526
7526
  value: jsonValueSchema2
7527
7527
  }),
7528
- z104.z.object({
7529
- type: z104.z.literal("error-text"),
7530
- value: z104.z.string()
7528
+ z42.z.object({
7529
+ type: z42.z.literal("error-text"),
7530
+ value: z42.z.string()
7531
7531
  }),
7532
- z104.z.object({
7533
- type: z104.z.literal("error-json"),
7532
+ z42.z.object({
7533
+ type: z42.z.literal("error-json"),
7534
7534
  value: jsonValueSchema2
7535
7535
  }),
7536
- z104.z.object({
7537
- type: z104.z.literal("content"),
7538
- value: z104.z.array(
7539
- z104.z.union([
7540
- z104.z.object({
7541
- type: z104.z.literal("text"),
7542
- text: z104.z.string()
7536
+ z42.z.object({
7537
+ type: z42.z.literal("content"),
7538
+ value: z42.z.array(
7539
+ z42.z.union([
7540
+ z42.z.object({
7541
+ type: z42.z.literal("text"),
7542
+ text: z42.z.string()
7543
7543
  }),
7544
- z104.z.object({
7545
- type: z104.z.literal("media"),
7546
- data: z104.z.string(),
7547
- mediaType: z104.z.string()
7544
+ z42.z.object({
7545
+ type: z42.z.literal("media"),
7546
+ data: z42.z.string(),
7547
+ mediaType: z42.z.string()
7548
7548
  })
7549
7549
  ])
7550
7550
  )
7551
7551
  })
7552
7552
  ]);
7553
- var toolResultPartSchema2 = z104.z.object({
7554
- type: z104.z.literal("tool-result"),
7555
- toolCallId: z104.z.string(),
7556
- toolName: z104.z.string(),
7553
+ var toolResultPartSchema2 = z42.z.object({
7554
+ type: z42.z.literal("tool-result"),
7555
+ toolCallId: z42.z.string(),
7556
+ toolName: z42.z.string(),
7557
7557
  output: outputSchema,
7558
7558
  providerOptions: providerMetadataSchema2.optional()
7559
7559
  });
7560
- var systemModelMessageSchema = z104.z.object(
7560
+ var systemModelMessageSchema = z42.z.object(
7561
7561
  {
7562
- role: z104.z.literal("system"),
7563
- content: z104.z.string(),
7562
+ role: z42.z.literal("system"),
7563
+ content: z42.z.string(),
7564
7564
  providerOptions: providerMetadataSchema2.optional()
7565
7565
  }
7566
7566
  );
7567
- var userModelMessageSchema = z104.z.object({
7568
- role: z104.z.literal("user"),
7569
- content: z104.z.union([
7570
- z104.z.string(),
7571
- z104.z.array(z104.z.union([textPartSchema2, imagePartSchema2, filePartSchema2]))
7567
+ var userModelMessageSchema = z42.z.object({
7568
+ role: z42.z.literal("user"),
7569
+ content: z42.z.union([
7570
+ z42.z.string(),
7571
+ z42.z.array(z42.z.union([textPartSchema2, imagePartSchema2, filePartSchema2]))
7572
7572
  ]),
7573
7573
  providerOptions: providerMetadataSchema2.optional()
7574
7574
  });
7575
- var assistantModelMessageSchema = z104.z.object({
7576
- role: z104.z.literal("assistant"),
7577
- content: z104.z.union([
7578
- z104.z.string(),
7579
- z104.z.array(
7580
- z104.z.union([
7575
+ var assistantModelMessageSchema = z42.z.object({
7576
+ role: z42.z.literal("assistant"),
7577
+ content: z42.z.union([
7578
+ z42.z.string(),
7579
+ z42.z.array(
7580
+ z42.z.union([
7581
7581
  textPartSchema2,
7582
7582
  filePartSchema2,
7583
7583
  reasoningPartSchema2,
@@ -7588,12 +7588,12 @@ var assistantModelMessageSchema = z104.z.object({
7588
7588
  ]),
7589
7589
  providerOptions: providerMetadataSchema2.optional()
7590
7590
  });
7591
- var toolModelMessageSchema = z104.z.object({
7592
- role: z104.z.literal("tool"),
7593
- content: z104.z.array(toolResultPartSchema2),
7591
+ var toolModelMessageSchema = z42.z.object({
7592
+ role: z42.z.literal("tool"),
7593
+ content: z42.z.array(toolResultPartSchema2),
7594
7594
  providerOptions: providerMetadataSchema2.optional()
7595
7595
  });
7596
- z104.z.union([
7596
+ z42.z.union([
7597
7597
  systemModelMessageSchema,
7598
7598
  userModelMessageSchema,
7599
7599
  assistantModelMessageSchema,
@@ -7902,144 +7902,147 @@ function prepareRetries2({
7902
7902
  })
7903
7903
  };
7904
7904
  }
7905
+ function stepCountIs(stepCount) {
7906
+ return ({ steps }) => steps.length === stepCount;
7907
+ }
7905
7908
  createIdGenerator2({
7906
7909
  prefix: "aitxt",
7907
7910
  size: 24
7908
7911
  });
7909
- z104.z.union([
7910
- z104.z.strictObject({
7911
- type: z104.z.literal("text-start"),
7912
- id: z104.z.string(),
7912
+ z42.z.union([
7913
+ z42.z.strictObject({
7914
+ type: z42.z.literal("text-start"),
7915
+ id: z42.z.string(),
7913
7916
  providerMetadata: providerMetadataSchema2.optional()
7914
7917
  }),
7915
- z104.z.strictObject({
7916
- type: z104.z.literal("text-delta"),
7917
- id: z104.z.string(),
7918
- delta: z104.z.string(),
7918
+ z42.z.strictObject({
7919
+ type: z42.z.literal("text-delta"),
7920
+ id: z42.z.string(),
7921
+ delta: z42.z.string(),
7919
7922
  providerMetadata: providerMetadataSchema2.optional()
7920
7923
  }),
7921
- z104.z.strictObject({
7922
- type: z104.z.literal("text-end"),
7923
- id: z104.z.string(),
7924
+ z42.z.strictObject({
7925
+ type: z42.z.literal("text-end"),
7926
+ id: z42.z.string(),
7924
7927
  providerMetadata: providerMetadataSchema2.optional()
7925
7928
  }),
7926
- z104.z.strictObject({
7927
- type: z104.z.literal("error"),
7928
- errorText: z104.z.string()
7929
+ z42.z.strictObject({
7930
+ type: z42.z.literal("error"),
7931
+ errorText: z42.z.string()
7929
7932
  }),
7930
- z104.z.strictObject({
7931
- type: z104.z.literal("tool-input-start"),
7932
- toolCallId: z104.z.string(),
7933
- toolName: z104.z.string(),
7934
- providerExecuted: z104.z.boolean().optional(),
7935
- dynamic: z104.z.boolean().optional()
7933
+ z42.z.strictObject({
7934
+ type: z42.z.literal("tool-input-start"),
7935
+ toolCallId: z42.z.string(),
7936
+ toolName: z42.z.string(),
7937
+ providerExecuted: z42.z.boolean().optional(),
7938
+ dynamic: z42.z.boolean().optional()
7936
7939
  }),
7937
- z104.z.strictObject({
7938
- type: z104.z.literal("tool-input-delta"),
7939
- toolCallId: z104.z.string(),
7940
- inputTextDelta: z104.z.string()
7940
+ z42.z.strictObject({
7941
+ type: z42.z.literal("tool-input-delta"),
7942
+ toolCallId: z42.z.string(),
7943
+ inputTextDelta: z42.z.string()
7941
7944
  }),
7942
- z104.z.strictObject({
7943
- type: z104.z.literal("tool-input-available"),
7944
- toolCallId: z104.z.string(),
7945
- toolName: z104.z.string(),
7946
- input: z104.z.unknown(),
7947
- providerExecuted: z104.z.boolean().optional(),
7945
+ z42.z.strictObject({
7946
+ type: z42.z.literal("tool-input-available"),
7947
+ toolCallId: z42.z.string(),
7948
+ toolName: z42.z.string(),
7949
+ input: z42.z.unknown(),
7950
+ providerExecuted: z42.z.boolean().optional(),
7948
7951
  providerMetadata: providerMetadataSchema2.optional(),
7949
- dynamic: z104.z.boolean().optional()
7952
+ dynamic: z42.z.boolean().optional()
7950
7953
  }),
7951
- z104.z.strictObject({
7952
- type: z104.z.literal("tool-input-error"),
7953
- toolCallId: z104.z.string(),
7954
- toolName: z104.z.string(),
7955
- input: z104.z.unknown(),
7956
- providerExecuted: z104.z.boolean().optional(),
7954
+ z42.z.strictObject({
7955
+ type: z42.z.literal("tool-input-error"),
7956
+ toolCallId: z42.z.string(),
7957
+ toolName: z42.z.string(),
7958
+ input: z42.z.unknown(),
7959
+ providerExecuted: z42.z.boolean().optional(),
7957
7960
  providerMetadata: providerMetadataSchema2.optional(),
7958
- dynamic: z104.z.boolean().optional(),
7959
- errorText: z104.z.string()
7961
+ dynamic: z42.z.boolean().optional(),
7962
+ errorText: z42.z.string()
7960
7963
  }),
7961
- z104.z.strictObject({
7962
- type: z104.z.literal("tool-output-available"),
7963
- toolCallId: z104.z.string(),
7964
- output: z104.z.unknown(),
7965
- providerExecuted: z104.z.boolean().optional(),
7966
- dynamic: z104.z.boolean().optional(),
7967
- preliminary: z104.z.boolean().optional()
7964
+ z42.z.strictObject({
7965
+ type: z42.z.literal("tool-output-available"),
7966
+ toolCallId: z42.z.string(),
7967
+ output: z42.z.unknown(),
7968
+ providerExecuted: z42.z.boolean().optional(),
7969
+ dynamic: z42.z.boolean().optional(),
7970
+ preliminary: z42.z.boolean().optional()
7968
7971
  }),
7969
- z104.z.strictObject({
7970
- type: z104.z.literal("tool-output-error"),
7971
- toolCallId: z104.z.string(),
7972
- errorText: z104.z.string(),
7973
- providerExecuted: z104.z.boolean().optional(),
7974
- dynamic: z104.z.boolean().optional()
7972
+ z42.z.strictObject({
7973
+ type: z42.z.literal("tool-output-error"),
7974
+ toolCallId: z42.z.string(),
7975
+ errorText: z42.z.string(),
7976
+ providerExecuted: z42.z.boolean().optional(),
7977
+ dynamic: z42.z.boolean().optional()
7975
7978
  }),
7976
- z104.z.strictObject({
7977
- type: z104.z.literal("reasoning-start"),
7978
- id: z104.z.string(),
7979
+ z42.z.strictObject({
7980
+ type: z42.z.literal("reasoning-start"),
7981
+ id: z42.z.string(),
7979
7982
  providerMetadata: providerMetadataSchema2.optional()
7980
7983
  }),
7981
- z104.z.strictObject({
7982
- type: z104.z.literal("reasoning-delta"),
7983
- id: z104.z.string(),
7984
- delta: z104.z.string(),
7984
+ z42.z.strictObject({
7985
+ type: z42.z.literal("reasoning-delta"),
7986
+ id: z42.z.string(),
7987
+ delta: z42.z.string(),
7985
7988
  providerMetadata: providerMetadataSchema2.optional()
7986
7989
  }),
7987
- z104.z.strictObject({
7988
- type: z104.z.literal("reasoning-end"),
7989
- id: z104.z.string(),
7990
+ z42.z.strictObject({
7991
+ type: z42.z.literal("reasoning-end"),
7992
+ id: z42.z.string(),
7990
7993
  providerMetadata: providerMetadataSchema2.optional()
7991
7994
  }),
7992
- z104.z.strictObject({
7993
- type: z104.z.literal("source-url"),
7994
- sourceId: z104.z.string(),
7995
- url: z104.z.string(),
7996
- title: z104.z.string().optional(),
7995
+ z42.z.strictObject({
7996
+ type: z42.z.literal("source-url"),
7997
+ sourceId: z42.z.string(),
7998
+ url: z42.z.string(),
7999
+ title: z42.z.string().optional(),
7997
8000
  providerMetadata: providerMetadataSchema2.optional()
7998
8001
  }),
7999
- z104.z.strictObject({
8000
- type: z104.z.literal("source-document"),
8001
- sourceId: z104.z.string(),
8002
- mediaType: z104.z.string(),
8003
- title: z104.z.string(),
8004
- filename: z104.z.string().optional(),
8002
+ z42.z.strictObject({
8003
+ type: z42.z.literal("source-document"),
8004
+ sourceId: z42.z.string(),
8005
+ mediaType: z42.z.string(),
8006
+ title: z42.z.string(),
8007
+ filename: z42.z.string().optional(),
8005
8008
  providerMetadata: providerMetadataSchema2.optional()
8006
8009
  }),
8007
- z104.z.strictObject({
8008
- type: z104.z.literal("file"),
8009
- url: z104.z.string(),
8010
- mediaType: z104.z.string(),
8010
+ z42.z.strictObject({
8011
+ type: z42.z.literal("file"),
8012
+ url: z42.z.string(),
8013
+ mediaType: z42.z.string(),
8011
8014
  providerMetadata: providerMetadataSchema2.optional()
8012
8015
  }),
8013
- z104.z.strictObject({
8014
- type: z104.z.custom(
8016
+ z42.z.strictObject({
8017
+ type: z42.z.custom(
8015
8018
  (value) => typeof value === "string" && value.startsWith("data-"),
8016
8019
  { message: 'Type must start with "data-"' }
8017
8020
  ),
8018
- id: z104.z.string().optional(),
8019
- data: z104.z.unknown(),
8020
- transient: z104.z.boolean().optional()
8021
+ id: z42.z.string().optional(),
8022
+ data: z42.z.unknown(),
8023
+ transient: z42.z.boolean().optional()
8021
8024
  }),
8022
- z104.z.strictObject({
8023
- type: z104.z.literal("start-step")
8025
+ z42.z.strictObject({
8026
+ type: z42.z.literal("start-step")
8024
8027
  }),
8025
- z104.z.strictObject({
8026
- type: z104.z.literal("finish-step")
8028
+ z42.z.strictObject({
8029
+ type: z42.z.literal("finish-step")
8027
8030
  }),
8028
- z104.z.strictObject({
8029
- type: z104.z.literal("start"),
8030
- messageId: z104.z.string().optional(),
8031
- messageMetadata: z104.z.unknown().optional()
8031
+ z42.z.strictObject({
8032
+ type: z42.z.literal("start"),
8033
+ messageId: z42.z.string().optional(),
8034
+ messageMetadata: z42.z.unknown().optional()
8032
8035
  }),
8033
- z104.z.strictObject({
8034
- type: z104.z.literal("finish"),
8035
- messageMetadata: z104.z.unknown().optional()
8036
+ z42.z.strictObject({
8037
+ type: z42.z.literal("finish"),
8038
+ messageMetadata: z42.z.unknown().optional()
8036
8039
  }),
8037
- z104.z.strictObject({
8038
- type: z104.z.literal("abort")
8040
+ z42.z.strictObject({
8041
+ type: z42.z.literal("abort")
8039
8042
  }),
8040
- z104.z.strictObject({
8041
- type: z104.z.literal("message-metadata"),
8042
- messageMetadata: z104.z.unknown()
8043
+ z42.z.strictObject({
8044
+ type: z42.z.literal("message-metadata"),
8045
+ messageMetadata: z42.z.unknown()
8043
8046
  })
8044
8047
  ]);
8045
8048
  function fixJson2(input) {
@@ -8376,13 +8379,13 @@ createIdGenerator2({
8376
8379
  prefix: "aitxt",
8377
8380
  size: 24
8378
8381
  });
8379
- function splitArray2(array7, chunkSize) {
8382
+ function splitArray2(array, chunkSize) {
8380
8383
  if (chunkSize <= 0) {
8381
8384
  throw new Error("chunkSize must be greater than 0");
8382
8385
  }
8383
8386
  const result = [];
8384
- for (let i = 0; i < array7.length; i += chunkSize) {
8385
- result.push(array7.slice(i, i + chunkSize));
8387
+ for (let i = 0; i < array.length; i += chunkSize) {
8388
+ result.push(array.slice(i, i + chunkSize));
8386
8389
  }
8387
8390
  return result;
8388
8391
  }
@@ -8693,262 +8696,262 @@ var object2 = ({
8693
8696
  }
8694
8697
  };
8695
8698
  };
8696
- var ClientOrServerImplementationSchema2 = z104.z.looseObject({
8697
- name: z104.z.string(),
8698
- version: z104.z.string()
8699
+ var ClientOrServerImplementationSchema2 = z42.z.looseObject({
8700
+ name: z42.z.string(),
8701
+ version: z42.z.string()
8699
8702
  });
8700
- var BaseParamsSchema2 = z104.z.looseObject({
8701
- _meta: z104.z.optional(z104.z.object({}).loose())
8703
+ var BaseParamsSchema2 = z42.z.looseObject({
8704
+ _meta: z42.z.optional(z42.z.object({}).loose())
8702
8705
  });
8703
8706
  var ResultSchema2 = BaseParamsSchema2;
8704
- var RequestSchema2 = z104.z.object({
8705
- method: z104.z.string(),
8706
- params: z104.z.optional(BaseParamsSchema2)
8707
+ var RequestSchema2 = z42.z.object({
8708
+ method: z42.z.string(),
8709
+ params: z42.z.optional(BaseParamsSchema2)
8707
8710
  });
8708
- var ServerCapabilitiesSchema2 = z104.z.looseObject({
8709
- experimental: z104.z.optional(z104.z.object({}).loose()),
8710
- logging: z104.z.optional(z104.z.object({}).loose()),
8711
- prompts: z104.z.optional(
8712
- z104.z.looseObject({
8713
- listChanged: z104.z.optional(z104.z.boolean())
8711
+ var ServerCapabilitiesSchema2 = z42.z.looseObject({
8712
+ experimental: z42.z.optional(z42.z.object({}).loose()),
8713
+ logging: z42.z.optional(z42.z.object({}).loose()),
8714
+ prompts: z42.z.optional(
8715
+ z42.z.looseObject({
8716
+ listChanged: z42.z.optional(z42.z.boolean())
8714
8717
  })
8715
8718
  ),
8716
- resources: z104.z.optional(
8717
- z104.z.looseObject({
8718
- subscribe: z104.z.optional(z104.z.boolean()),
8719
- listChanged: z104.z.optional(z104.z.boolean())
8719
+ resources: z42.z.optional(
8720
+ z42.z.looseObject({
8721
+ subscribe: z42.z.optional(z42.z.boolean()),
8722
+ listChanged: z42.z.optional(z42.z.boolean())
8720
8723
  })
8721
8724
  ),
8722
- tools: z104.z.optional(
8723
- z104.z.looseObject({
8724
- listChanged: z104.z.optional(z104.z.boolean())
8725
+ tools: z42.z.optional(
8726
+ z42.z.looseObject({
8727
+ listChanged: z42.z.optional(z42.z.boolean())
8725
8728
  })
8726
8729
  )
8727
8730
  });
8728
8731
  ResultSchema2.extend({
8729
- protocolVersion: z104.z.string(),
8732
+ protocolVersion: z42.z.string(),
8730
8733
  capabilities: ServerCapabilitiesSchema2,
8731
8734
  serverInfo: ClientOrServerImplementationSchema2,
8732
- instructions: z104.z.optional(z104.z.string())
8735
+ instructions: z42.z.optional(z42.z.string())
8733
8736
  });
8734
8737
  var PaginatedResultSchema2 = ResultSchema2.extend({
8735
- nextCursor: z104.z.optional(z104.z.string())
8738
+ nextCursor: z42.z.optional(z42.z.string())
8736
8739
  });
8737
- var ToolSchema2 = z104.z.object({
8738
- name: z104.z.string(),
8739
- description: z104.z.optional(z104.z.string()),
8740
- inputSchema: z104.z.object({
8741
- type: z104.z.literal("object"),
8742
- properties: z104.z.optional(z104.z.object({}).loose())
8740
+ var ToolSchema2 = z42.z.object({
8741
+ name: z42.z.string(),
8742
+ description: z42.z.optional(z42.z.string()),
8743
+ inputSchema: z42.z.object({
8744
+ type: z42.z.literal("object"),
8745
+ properties: z42.z.optional(z42.z.object({}).loose())
8743
8746
  }).loose()
8744
8747
  }).loose();
8745
8748
  PaginatedResultSchema2.extend({
8746
- tools: z104.z.array(ToolSchema2)
8749
+ tools: z42.z.array(ToolSchema2)
8747
8750
  });
8748
- var TextContentSchema2 = z104.z.object({
8749
- type: z104.z.literal("text"),
8750
- text: z104.z.string()
8751
+ var TextContentSchema2 = z42.z.object({
8752
+ type: z42.z.literal("text"),
8753
+ text: z42.z.string()
8751
8754
  }).loose();
8752
- var ImageContentSchema2 = z104.z.object({
8753
- type: z104.z.literal("image"),
8754
- data: z104.z.base64(),
8755
- mimeType: z104.z.string()
8755
+ var ImageContentSchema2 = z42.z.object({
8756
+ type: z42.z.literal("image"),
8757
+ data: z42.z.base64(),
8758
+ mimeType: z42.z.string()
8756
8759
  }).loose();
8757
- var ResourceContentsSchema2 = z104.z.object({
8760
+ var ResourceContentsSchema2 = z42.z.object({
8758
8761
  /**
8759
8762
  * The URI of this resource.
8760
8763
  */
8761
- uri: z104.z.string(),
8764
+ uri: z42.z.string(),
8762
8765
  /**
8763
8766
  * The MIME type of this resource, if known.
8764
8767
  */
8765
- mimeType: z104.z.optional(z104.z.string())
8768
+ mimeType: z42.z.optional(z42.z.string())
8766
8769
  }).loose();
8767
8770
  var TextResourceContentsSchema2 = ResourceContentsSchema2.extend({
8768
- text: z104.z.string()
8771
+ text: z42.z.string()
8769
8772
  });
8770
8773
  var BlobResourceContentsSchema2 = ResourceContentsSchema2.extend({
8771
- blob: z104.z.base64()
8774
+ blob: z42.z.base64()
8772
8775
  });
8773
- var EmbeddedResourceSchema2 = z104.z.object({
8774
- type: z104.z.literal("resource"),
8775
- resource: z104.z.union([TextResourceContentsSchema2, BlobResourceContentsSchema2])
8776
+ var EmbeddedResourceSchema2 = z42.z.object({
8777
+ type: z42.z.literal("resource"),
8778
+ resource: z42.z.union([TextResourceContentsSchema2, BlobResourceContentsSchema2])
8776
8779
  }).loose();
8777
8780
  ResultSchema2.extend({
8778
- content: z104.z.array(
8779
- z104.z.union([TextContentSchema2, ImageContentSchema2, EmbeddedResourceSchema2])
8781
+ content: z42.z.array(
8782
+ z42.z.union([TextContentSchema2, ImageContentSchema2, EmbeddedResourceSchema2])
8780
8783
  ),
8781
- isError: z104.z.boolean().default(false).optional()
8784
+ isError: z42.z.boolean().default(false).optional()
8782
8785
  }).or(
8783
8786
  ResultSchema2.extend({
8784
- toolResult: z104.z.unknown()
8787
+ toolResult: z42.z.unknown()
8785
8788
  })
8786
8789
  );
8787
8790
  var JSONRPC_VERSION2 = "2.0";
8788
- var JSONRPCRequestSchema2 = z104.z.object({
8789
- jsonrpc: z104.z.literal(JSONRPC_VERSION2),
8790
- id: z104.z.union([z104.z.string(), z104.z.number().int()])
8791
+ var JSONRPCRequestSchema2 = z42.z.object({
8792
+ jsonrpc: z42.z.literal(JSONRPC_VERSION2),
8793
+ id: z42.z.union([z42.z.string(), z42.z.number().int()])
8791
8794
  }).merge(RequestSchema2).strict();
8792
- var JSONRPCResponseSchema2 = z104.z.object({
8793
- jsonrpc: z104.z.literal(JSONRPC_VERSION2),
8794
- id: z104.z.union([z104.z.string(), z104.z.number().int()]),
8795
+ var JSONRPCResponseSchema2 = z42.z.object({
8796
+ jsonrpc: z42.z.literal(JSONRPC_VERSION2),
8797
+ id: z42.z.union([z42.z.string(), z42.z.number().int()]),
8795
8798
  result: ResultSchema2
8796
8799
  }).strict();
8797
- var JSONRPCErrorSchema2 = z104.z.object({
8798
- jsonrpc: z104.z.literal(JSONRPC_VERSION2),
8799
- id: z104.z.union([z104.z.string(), z104.z.number().int()]),
8800
- error: z104.z.object({
8801
- code: z104.z.number().int(),
8802
- message: z104.z.string(),
8803
- data: z104.z.optional(z104.z.unknown())
8800
+ var JSONRPCErrorSchema2 = z42.z.object({
8801
+ jsonrpc: z42.z.literal(JSONRPC_VERSION2),
8802
+ id: z42.z.union([z42.z.string(), z42.z.number().int()]),
8803
+ error: z42.z.object({
8804
+ code: z42.z.number().int(),
8805
+ message: z42.z.string(),
8806
+ data: z42.z.optional(z42.z.unknown())
8804
8807
  })
8805
8808
  }).strict();
8806
- var JSONRPCNotificationSchema2 = z104.z.object({
8807
- jsonrpc: z104.z.literal(JSONRPC_VERSION2)
8809
+ var JSONRPCNotificationSchema2 = z42.z.object({
8810
+ jsonrpc: z42.z.literal(JSONRPC_VERSION2)
8808
8811
  }).merge(
8809
- z104.z.object({
8810
- method: z104.z.string(),
8811
- params: z104.z.optional(BaseParamsSchema2)
8812
+ z42.z.object({
8813
+ method: z42.z.string(),
8814
+ params: z42.z.optional(BaseParamsSchema2)
8812
8815
  })
8813
8816
  ).strict();
8814
- z104.z.union([
8817
+ z42.z.union([
8815
8818
  JSONRPCRequestSchema2,
8816
8819
  JSONRPCNotificationSchema2,
8817
8820
  JSONRPCResponseSchema2,
8818
8821
  JSONRPCErrorSchema2
8819
8822
  ]);
8820
- var textUIPartSchema = z104.z.object({
8821
- type: z104.z.literal("text"),
8822
- text: z104.z.string(),
8823
- state: z104.z.enum(["streaming", "done"]).optional(),
8823
+ var textUIPartSchema = z42.z.object({
8824
+ type: z42.z.literal("text"),
8825
+ text: z42.z.string(),
8826
+ state: z42.z.enum(["streaming", "done"]).optional(),
8824
8827
  providerMetadata: providerMetadataSchema2.optional()
8825
8828
  });
8826
- var reasoningUIPartSchema = z104.z.object({
8827
- type: z104.z.literal("reasoning"),
8828
- text: z104.z.string(),
8829
- state: z104.z.enum(["streaming", "done"]).optional(),
8829
+ var reasoningUIPartSchema = z42.z.object({
8830
+ type: z42.z.literal("reasoning"),
8831
+ text: z42.z.string(),
8832
+ state: z42.z.enum(["streaming", "done"]).optional(),
8830
8833
  providerMetadata: providerMetadataSchema2.optional()
8831
8834
  });
8832
- var sourceUrlUIPartSchema = z104.z.object({
8833
- type: z104.z.literal("source-url"),
8834
- sourceId: z104.z.string(),
8835
- url: z104.z.string(),
8836
- title: z104.z.string().optional(),
8835
+ var sourceUrlUIPartSchema = z42.z.object({
8836
+ type: z42.z.literal("source-url"),
8837
+ sourceId: z42.z.string(),
8838
+ url: z42.z.string(),
8839
+ title: z42.z.string().optional(),
8837
8840
  providerMetadata: providerMetadataSchema2.optional()
8838
8841
  });
8839
- var sourceDocumentUIPartSchema = z104.z.object({
8840
- type: z104.z.literal("source-document"),
8841
- sourceId: z104.z.string(),
8842
- mediaType: z104.z.string(),
8843
- title: z104.z.string(),
8844
- filename: z104.z.string().optional(),
8842
+ var sourceDocumentUIPartSchema = z42.z.object({
8843
+ type: z42.z.literal("source-document"),
8844
+ sourceId: z42.z.string(),
8845
+ mediaType: z42.z.string(),
8846
+ title: z42.z.string(),
8847
+ filename: z42.z.string().optional(),
8845
8848
  providerMetadata: providerMetadataSchema2.optional()
8846
8849
  });
8847
- var fileUIPartSchema = z104.z.object({
8848
- type: z104.z.literal("file"),
8849
- mediaType: z104.z.string(),
8850
- filename: z104.z.string().optional(),
8851
- url: z104.z.string(),
8850
+ var fileUIPartSchema = z42.z.object({
8851
+ type: z42.z.literal("file"),
8852
+ mediaType: z42.z.string(),
8853
+ filename: z42.z.string().optional(),
8854
+ url: z42.z.string(),
8852
8855
  providerMetadata: providerMetadataSchema2.optional()
8853
8856
  });
8854
- var stepStartUIPartSchema = z104.z.object({
8855
- type: z104.z.literal("step-start")
8857
+ var stepStartUIPartSchema = z42.z.object({
8858
+ type: z42.z.literal("step-start")
8856
8859
  });
8857
- var dataUIPartSchema = z104.z.object({
8858
- type: z104.z.string().startsWith("data-"),
8859
- id: z104.z.string().optional(),
8860
- data: z104.z.unknown()
8860
+ var dataUIPartSchema = z42.z.object({
8861
+ type: z42.z.string().startsWith("data-"),
8862
+ id: z42.z.string().optional(),
8863
+ data: z42.z.unknown()
8861
8864
  });
8862
8865
  var dynamicToolUIPartSchemas = [
8863
- z104.z.object({
8864
- type: z104.z.literal("dynamic-tool"),
8865
- toolName: z104.z.string(),
8866
- toolCallId: z104.z.string(),
8867
- state: z104.z.literal("input-streaming"),
8868
- input: z104.z.unknown().optional(),
8869
- output: z104.z.never().optional(),
8870
- errorText: z104.z.never().optional()
8866
+ z42.z.object({
8867
+ type: z42.z.literal("dynamic-tool"),
8868
+ toolName: z42.z.string(),
8869
+ toolCallId: z42.z.string(),
8870
+ state: z42.z.literal("input-streaming"),
8871
+ input: z42.z.unknown().optional(),
8872
+ output: z42.z.never().optional(),
8873
+ errorText: z42.z.never().optional()
8871
8874
  }),
8872
- z104.z.object({
8873
- type: z104.z.literal("dynamic-tool"),
8874
- toolName: z104.z.string(),
8875
- toolCallId: z104.z.string(),
8876
- state: z104.z.literal("input-available"),
8877
- input: z104.z.unknown(),
8878
- output: z104.z.never().optional(),
8879
- errorText: z104.z.never().optional(),
8875
+ z42.z.object({
8876
+ type: z42.z.literal("dynamic-tool"),
8877
+ toolName: z42.z.string(),
8878
+ toolCallId: z42.z.string(),
8879
+ state: z42.z.literal("input-available"),
8880
+ input: z42.z.unknown(),
8881
+ output: z42.z.never().optional(),
8882
+ errorText: z42.z.never().optional(),
8880
8883
  callProviderMetadata: providerMetadataSchema2.optional()
8881
8884
  }),
8882
- z104.z.object({
8883
- type: z104.z.literal("dynamic-tool"),
8884
- toolName: z104.z.string(),
8885
- toolCallId: z104.z.string(),
8886
- state: z104.z.literal("output-available"),
8887
- input: z104.z.unknown(),
8888
- output: z104.z.unknown(),
8889
- errorText: z104.z.never().optional(),
8885
+ z42.z.object({
8886
+ type: z42.z.literal("dynamic-tool"),
8887
+ toolName: z42.z.string(),
8888
+ toolCallId: z42.z.string(),
8889
+ state: z42.z.literal("output-available"),
8890
+ input: z42.z.unknown(),
8891
+ output: z42.z.unknown(),
8892
+ errorText: z42.z.never().optional(),
8890
8893
  callProviderMetadata: providerMetadataSchema2.optional(),
8891
- preliminary: z104.z.boolean().optional()
8894
+ preliminary: z42.z.boolean().optional()
8892
8895
  }),
8893
- z104.z.object({
8894
- type: z104.z.literal("dynamic-tool"),
8895
- toolName: z104.z.string(),
8896
- toolCallId: z104.z.string(),
8897
- state: z104.z.literal("output-error"),
8898
- input: z104.z.unknown(),
8899
- output: z104.z.never().optional(),
8900
- errorText: z104.z.string(),
8896
+ z42.z.object({
8897
+ type: z42.z.literal("dynamic-tool"),
8898
+ toolName: z42.z.string(),
8899
+ toolCallId: z42.z.string(),
8900
+ state: z42.z.literal("output-error"),
8901
+ input: z42.z.unknown(),
8902
+ output: z42.z.never().optional(),
8903
+ errorText: z42.z.string(),
8901
8904
  callProviderMetadata: providerMetadataSchema2.optional()
8902
8905
  })
8903
8906
  ];
8904
8907
  var toolUIPartSchemas = [
8905
- z104.z.object({
8906
- type: z104.z.string().startsWith("tool-"),
8907
- toolCallId: z104.z.string(),
8908
- state: z104.z.literal("input-streaming"),
8909
- providerExecuted: z104.z.boolean().optional(),
8910
- input: z104.z.unknown().optional(),
8911
- output: z104.z.never().optional(),
8912
- errorText: z104.z.never().optional()
8908
+ z42.z.object({
8909
+ type: z42.z.string().startsWith("tool-"),
8910
+ toolCallId: z42.z.string(),
8911
+ state: z42.z.literal("input-streaming"),
8912
+ providerExecuted: z42.z.boolean().optional(),
8913
+ input: z42.z.unknown().optional(),
8914
+ output: z42.z.never().optional(),
8915
+ errorText: z42.z.never().optional()
8913
8916
  }),
8914
- z104.z.object({
8915
- type: z104.z.string().startsWith("tool-"),
8916
- toolCallId: z104.z.string(),
8917
- state: z104.z.literal("input-available"),
8918
- providerExecuted: z104.z.boolean().optional(),
8919
- input: z104.z.unknown(),
8920
- output: z104.z.never().optional(),
8921
- errorText: z104.z.never().optional(),
8917
+ z42.z.object({
8918
+ type: z42.z.string().startsWith("tool-"),
8919
+ toolCallId: z42.z.string(),
8920
+ state: z42.z.literal("input-available"),
8921
+ providerExecuted: z42.z.boolean().optional(),
8922
+ input: z42.z.unknown(),
8923
+ output: z42.z.never().optional(),
8924
+ errorText: z42.z.never().optional(),
8922
8925
  callProviderMetadata: providerMetadataSchema2.optional()
8923
8926
  }),
8924
- z104.z.object({
8925
- type: z104.z.string().startsWith("tool-"),
8926
- toolCallId: z104.z.string(),
8927
- state: z104.z.literal("output-available"),
8928
- providerExecuted: z104.z.boolean().optional(),
8929
- input: z104.z.unknown(),
8930
- output: z104.z.unknown(),
8931
- errorText: z104.z.never().optional(),
8927
+ z42.z.object({
8928
+ type: z42.z.string().startsWith("tool-"),
8929
+ toolCallId: z42.z.string(),
8930
+ state: z42.z.literal("output-available"),
8931
+ providerExecuted: z42.z.boolean().optional(),
8932
+ input: z42.z.unknown(),
8933
+ output: z42.z.unknown(),
8934
+ errorText: z42.z.never().optional(),
8932
8935
  callProviderMetadata: providerMetadataSchema2.optional(),
8933
- preliminary: z104.z.boolean().optional()
8936
+ preliminary: z42.z.boolean().optional()
8934
8937
  }),
8935
- z104.z.object({
8936
- type: z104.z.string().startsWith("tool-"),
8937
- toolCallId: z104.z.string(),
8938
- state: z104.z.literal("output-error"),
8939
- providerExecuted: z104.z.boolean().optional(),
8940
- input: z104.z.unknown(),
8941
- output: z104.z.never().optional(),
8942
- errorText: z104.z.string(),
8938
+ z42.z.object({
8939
+ type: z42.z.string().startsWith("tool-"),
8940
+ toolCallId: z42.z.string(),
8941
+ state: z42.z.literal("output-error"),
8942
+ providerExecuted: z42.z.boolean().optional(),
8943
+ input: z42.z.unknown(),
8944
+ output: z42.z.never().optional(),
8945
+ errorText: z42.z.string(),
8943
8946
  callProviderMetadata: providerMetadataSchema2.optional()
8944
8947
  })
8945
8948
  ];
8946
- z104.z.object({
8947
- id: z104.z.string(),
8948
- role: z104.z.enum(["system", "user", "assistant"]),
8949
- metadata: z104.z.unknown().optional(),
8950
- parts: z104.z.array(
8951
- z104.z.union([
8949
+ z42.z.object({
8950
+ id: z42.z.string(),
8951
+ role: z42.z.enum(["system", "user", "assistant"]),
8952
+ metadata: z42.z.unknown().optional(),
8953
+ parts: z42.z.array(
8954
+ z42.z.union([
8952
8955
  textUIPartSchema,
8953
8956
  reasoningUIPartSchema,
8954
8957
  sourceUrlUIPartSchema,
@@ -9225,8 +9228,8 @@ var TypeHandler = class {
9225
9228
  types.object = false;
9226
9229
  }
9227
9230
  if (typeSet.has("integer") && types.number !== false) {
9228
- const currentNumber = types.number || z104.z.number();
9229
- if (currentNumber instanceof z104.z.ZodNumber) {
9231
+ const currentNumber = types.number || z42.z.number();
9232
+ if (currentNumber instanceof z42.z.ZodNumber) {
9230
9233
  types.number = currentNumber.int();
9231
9234
  }
9232
9235
  }
@@ -9243,13 +9246,13 @@ var ConstHandler = class {
9243
9246
  types.array = false;
9244
9247
  types.object = false;
9245
9248
  if (typeof constValue === "string") {
9246
- types.string = z104.z.literal(constValue);
9249
+ types.string = z42.z.literal(constValue);
9247
9250
  } else if (typeof constValue === "number") {
9248
- types.number = z104.z.literal(constValue);
9251
+ types.number = z42.z.literal(constValue);
9249
9252
  } else if (typeof constValue === "boolean") {
9250
- types.boolean = z104.z.literal(constValue);
9253
+ types.boolean = z42.z.literal(constValue);
9251
9254
  } else if (constValue === null) {
9252
- types.null = z104.z.null();
9255
+ types.null = z42.z.null();
9253
9256
  } else if (Array.isArray(constValue)) {
9254
9257
  types.array = void 0;
9255
9258
  } else if (typeof constValue === "object") {
@@ -9282,24 +9285,24 @@ var EnumHandler = class {
9282
9285
  types.string = this.createTypeSchema(valuesByType.string, "string");
9283
9286
  types.number = this.createTypeSchema(valuesByType.number, "number");
9284
9287
  types.boolean = this.createTypeSchema(valuesByType.boolean, "boolean");
9285
- types.null = valuesByType.null.length > 0 ? z104.z.null() : false;
9288
+ types.null = valuesByType.null.length > 0 ? z42.z.null() : false;
9286
9289
  types.array = valuesByType.array.length > 0 ? void 0 : false;
9287
9290
  types.object = valuesByType.object.length > 0 ? void 0 : false;
9288
9291
  }
9289
9292
  createTypeSchema(values, type) {
9290
9293
  if (values.length === 0) return false;
9291
9294
  if (values.length === 1) {
9292
- return z104.z.literal(values[0]);
9295
+ return z42.z.literal(values[0]);
9293
9296
  }
9294
9297
  if (type === "string") {
9295
- return z104.z.enum(values);
9298
+ return z42.z.enum(values);
9296
9299
  }
9297
9300
  if (type === "number") {
9298
9301
  const [first, second, ...rest] = values;
9299
- return z104.z.union([z104.z.literal(first), z104.z.literal(second), ...rest.map((v) => z104.z.literal(v))]);
9302
+ return z42.z.union([z42.z.literal(first), z42.z.literal(second), ...rest.map((v) => z42.z.literal(v))]);
9300
9303
  }
9301
9304
  if (type === "boolean") {
9302
- return z104.z.union([z104.z.literal(true), z104.z.literal(false)]);
9305
+ return z42.z.union([z42.z.literal(true), z42.z.literal(false)]);
9303
9306
  }
9304
9307
  return false;
9305
9308
  }
@@ -9309,7 +9312,7 @@ var ImplicitStringHandler = class {
9309
9312
  const stringSchema = schema;
9310
9313
  if (schema.type === void 0 && (stringSchema.minLength !== void 0 || stringSchema.maxLength !== void 0 || stringSchema.pattern !== void 0)) {
9311
9314
  if (types.string === void 0) {
9312
- types.string = z104.z.string();
9315
+ types.string = z42.z.string();
9313
9316
  }
9314
9317
  }
9315
9318
  }
@@ -9319,8 +9322,8 @@ var MinLengthHandler = class {
9319
9322
  const stringSchema = schema;
9320
9323
  if (stringSchema.minLength === void 0) return;
9321
9324
  if (types.string !== false) {
9322
- const currentString = types.string || z104.z.string();
9323
- if (currentString instanceof z104.z.ZodString) {
9325
+ const currentString = types.string || z42.z.string();
9326
+ if (currentString instanceof z42.z.ZodString) {
9324
9327
  types.string = currentString.refine(
9325
9328
  (value) => {
9326
9329
  const graphemeLength = Array.from(value).length;
@@ -9337,8 +9340,8 @@ var MaxLengthHandler = class {
9337
9340
  const stringSchema = schema;
9338
9341
  if (stringSchema.maxLength === void 0) return;
9339
9342
  if (types.string !== false) {
9340
- const currentString = types.string || z104.z.string();
9341
- if (currentString instanceof z104.z.ZodString) {
9343
+ const currentString = types.string || z42.z.string();
9344
+ if (currentString instanceof z42.z.ZodString) {
9342
9345
  types.string = currentString.refine(
9343
9346
  (value) => {
9344
9347
  const graphemeLength = Array.from(value).length;
@@ -9355,8 +9358,8 @@ var PatternHandler = class {
9355
9358
  const stringSchema = schema;
9356
9359
  if (!stringSchema.pattern) return;
9357
9360
  if (types.string !== false) {
9358
- const currentString = types.string || z104.z.string();
9359
- if (currentString instanceof z104.z.ZodString) {
9361
+ const currentString = types.string || z42.z.string();
9362
+ if (currentString instanceof z42.z.ZodString) {
9360
9363
  const regex = new RegExp(stringSchema.pattern);
9361
9364
  types.string = currentString.regex(regex);
9362
9365
  }
@@ -9368,8 +9371,8 @@ var MinimumHandler = class {
9368
9371
  const numberSchema = schema;
9369
9372
  if (numberSchema.minimum === void 0) return;
9370
9373
  if (types.number !== false) {
9371
- const currentNumber = types.number || z104.z.number();
9372
- if (currentNumber instanceof z104.z.ZodNumber) {
9374
+ const currentNumber = types.number || z42.z.number();
9375
+ if (currentNumber instanceof z42.z.ZodNumber) {
9373
9376
  types.number = currentNumber.min(numberSchema.minimum);
9374
9377
  }
9375
9378
  }
@@ -9380,8 +9383,8 @@ var MaximumHandler = class {
9380
9383
  const numberSchema = schema;
9381
9384
  if (numberSchema.maximum === void 0) return;
9382
9385
  if (types.number !== false) {
9383
- const currentNumber = types.number || z104.z.number();
9384
- if (currentNumber instanceof z104.z.ZodNumber) {
9386
+ const currentNumber = types.number || z42.z.number();
9387
+ if (currentNumber instanceof z42.z.ZodNumber) {
9385
9388
  types.number = currentNumber.max(numberSchema.maximum);
9386
9389
  }
9387
9390
  }
@@ -9392,8 +9395,8 @@ var ExclusiveMinimumHandler = class {
9392
9395
  const numberSchema = schema;
9393
9396
  if (numberSchema.exclusiveMinimum === void 0) return;
9394
9397
  if (types.number !== false) {
9395
- const currentNumber = types.number || z104.z.number();
9396
- if (currentNumber instanceof z104.z.ZodNumber) {
9398
+ const currentNumber = types.number || z42.z.number();
9399
+ if (currentNumber instanceof z42.z.ZodNumber) {
9397
9400
  if (typeof numberSchema.exclusiveMinimum === "number") {
9398
9401
  types.number = currentNumber.gt(numberSchema.exclusiveMinimum);
9399
9402
  } else {
@@ -9408,8 +9411,8 @@ var ExclusiveMaximumHandler = class {
9408
9411
  const numberSchema = schema;
9409
9412
  if (numberSchema.exclusiveMaximum === void 0) return;
9410
9413
  if (types.number !== false) {
9411
- const currentNumber = types.number || z104.z.number();
9412
- if (currentNumber instanceof z104.z.ZodNumber) {
9414
+ const currentNumber = types.number || z42.z.number();
9415
+ if (currentNumber instanceof z42.z.ZodNumber) {
9413
9416
  if (typeof numberSchema.exclusiveMaximum === "number") {
9414
9417
  types.number = currentNumber.lt(numberSchema.exclusiveMaximum);
9415
9418
  } else {
@@ -9424,8 +9427,8 @@ var MultipleOfHandler = class {
9424
9427
  const numberSchema = schema;
9425
9428
  if (numberSchema.multipleOf === void 0) return;
9426
9429
  if (types.number !== false) {
9427
- const currentNumber = types.number || z104.z.number();
9428
- if (currentNumber instanceof z104.z.ZodNumber) {
9430
+ const currentNumber = types.number || z42.z.number();
9431
+ if (currentNumber instanceof z42.z.ZodNumber) {
9429
9432
  types.number = currentNumber.refine(
9430
9433
  (value) => {
9431
9434
  if (numberSchema.multipleOf === 0) return false;
@@ -9448,7 +9451,7 @@ var ImplicitArrayHandler = class {
9448
9451
  const arraySchema = schema;
9449
9452
  if (schema.type === void 0 && (arraySchema.minItems !== void 0 || arraySchema.maxItems !== void 0 || arraySchema.items !== void 0 || arraySchema.prefixItems !== void 0)) {
9450
9453
  if (types.array === void 0) {
9451
- types.array = z104.z.array(z104.z.any());
9454
+ types.array = z42.z.array(z42.z.any());
9452
9455
  }
9453
9456
  }
9454
9457
  }
@@ -9458,7 +9461,7 @@ var MinItemsHandler = class {
9458
9461
  const arraySchema = schema;
9459
9462
  if (arraySchema.minItems === void 0) return;
9460
9463
  if (types.array !== false) {
9461
- types.array = (types.array || z104.z.array(z104.z.any())).min(arraySchema.minItems);
9464
+ types.array = (types.array || z42.z.array(z42.z.any())).min(arraySchema.minItems);
9462
9465
  }
9463
9466
  }
9464
9467
  };
@@ -9467,7 +9470,7 @@ var MaxItemsHandler = class {
9467
9470
  const arraySchema = schema;
9468
9471
  if (arraySchema.maxItems === void 0) return;
9469
9472
  if (types.array !== false) {
9470
- types.array = (types.array || z104.z.array(z104.z.any())).max(arraySchema.maxItems);
9473
+ types.array = (types.array || z42.z.array(z42.z.any())).max(arraySchema.maxItems);
9471
9474
  }
9472
9475
  }
9473
9476
  };
@@ -9476,11 +9479,11 @@ var ItemsHandler = class {
9476
9479
  const arraySchema = schema;
9477
9480
  if (types.array === false) return;
9478
9481
  if (Array.isArray(arraySchema.items)) {
9479
- types.array = types.array || z104.z.array(z104.z.any());
9482
+ types.array = types.array || z42.z.array(z42.z.any());
9480
9483
  } else if (arraySchema.items && typeof arraySchema.items !== "boolean" && !arraySchema.prefixItems) {
9481
9484
  const itemSchema = convertJsonSchemaToZod(arraySchema.items);
9482
- let newArray = z104.z.array(itemSchema);
9483
- if (types.array && types.array instanceof z104.z.ZodArray) {
9485
+ let newArray = z42.z.array(itemSchema);
9486
+ if (types.array && types.array instanceof z42.z.ZodArray) {
9484
9487
  const existingDef = types.array._def;
9485
9488
  if (existingDef.checks) {
9486
9489
  existingDef.checks.forEach((check) => {
@@ -9498,14 +9501,14 @@ var ItemsHandler = class {
9498
9501
  types.array = newArray;
9499
9502
  } else if (typeof arraySchema.items === "boolean" && arraySchema.items === false) {
9500
9503
  if (!arraySchema.prefixItems) {
9501
- types.array = z104.z.array(z104.z.any()).max(0);
9504
+ types.array = z42.z.array(z42.z.any()).max(0);
9502
9505
  } else {
9503
- types.array = types.array || z104.z.array(z104.z.any());
9506
+ types.array = types.array || z42.z.array(z42.z.any());
9504
9507
  }
9505
9508
  } else if (typeof arraySchema.items === "boolean" && arraySchema.items === true) {
9506
- types.array = types.array || z104.z.array(z104.z.any());
9509
+ types.array = types.array || z42.z.array(z42.z.any());
9507
9510
  } else if (arraySchema.prefixItems) {
9508
- types.array = types.array || z104.z.array(z104.z.any());
9511
+ types.array = types.array || z42.z.array(z42.z.any());
9509
9512
  }
9510
9513
  }
9511
9514
  };
@@ -9518,9 +9521,9 @@ var TupleHandler = class {
9518
9521
  const itemSchemas = arraySchema.items.map((itemSchema) => convertJsonSchemaToZod(itemSchema));
9519
9522
  let tuple;
9520
9523
  if (itemSchemas.length === 0) {
9521
- tuple = z104.z.tuple([]);
9524
+ tuple = z42.z.tuple([]);
9522
9525
  } else {
9523
- tuple = z104.z.tuple(itemSchemas);
9526
+ tuple = z42.z.tuple(itemSchemas);
9524
9527
  }
9525
9528
  if (arraySchema.minItems !== void 0 && arraySchema.minItems > itemSchemas.length) {
9526
9529
  tuple = false;
@@ -9537,7 +9540,7 @@ var PropertiesHandler = class {
9537
9540
  const objectSchema = schema;
9538
9541
  if (types.object === false) return;
9539
9542
  if (objectSchema.properties || objectSchema.required || objectSchema.additionalProperties !== void 0) {
9540
- types.object = types.object || z104.z.object({}).passthrough();
9543
+ types.object = types.object || z42.z.object({}).passthrough();
9541
9544
  }
9542
9545
  }
9543
9546
  };
@@ -9546,7 +9549,7 @@ var ImplicitObjectHandler = class {
9546
9549
  const objectSchema = schema;
9547
9550
  if (schema.type === void 0 && (objectSchema.maxProperties !== void 0 || objectSchema.minProperties !== void 0)) {
9548
9551
  if (types.object === void 0) {
9549
- types.object = z104.z.object({}).passthrough();
9552
+ types.object = z42.z.object({}).passthrough();
9550
9553
  }
9551
9554
  }
9552
9555
  }
@@ -9556,7 +9559,7 @@ var MaxPropertiesHandler = class {
9556
9559
  const objectSchema = schema;
9557
9560
  if (objectSchema.maxProperties === void 0) return;
9558
9561
  if (types.object !== false) {
9559
- const baseObject = types.object || z104.z.object({}).passthrough();
9562
+ const baseObject = types.object || z42.z.object({}).passthrough();
9560
9563
  types.object = baseObject.refine(
9561
9564
  (obj) => Object.keys(obj).length <= objectSchema.maxProperties,
9562
9565
  { message: `Object must have at most ${objectSchema.maxProperties} properties` }
@@ -9569,7 +9572,7 @@ var MinPropertiesHandler = class {
9569
9572
  const objectSchema = schema;
9570
9573
  if (objectSchema.minProperties === void 0) return;
9571
9574
  if (types.object !== false) {
9572
- const baseObject = types.object || z104.z.object({}).passthrough();
9575
+ const baseObject = types.object || z42.z.object({}).passthrough();
9573
9576
  types.object = baseObject.refine(
9574
9577
  (obj) => Object.keys(obj).length >= objectSchema.minProperties,
9575
9578
  { message: `Object must have at least ${objectSchema.minProperties} properties` }
@@ -9613,50 +9616,50 @@ function isValidWithSchema(schema, value) {
9613
9616
  return schema.safeParse(value).success;
9614
9617
  }
9615
9618
  var NotHandler = class {
9616
- apply(zodSchema4, schema) {
9617
- if (!schema.not) return zodSchema4;
9619
+ apply(zodSchema3, schema) {
9620
+ if (!schema.not) return zodSchema3;
9618
9621
  const notSchema = convertJsonSchemaToZod(schema.not);
9619
- return zodSchema4.refine(
9622
+ return zodSchema3.refine(
9620
9623
  (value) => !isValidWithSchema(notSchema, value),
9621
9624
  { message: "Value must not match the 'not' schema" }
9622
9625
  );
9623
9626
  }
9624
9627
  };
9625
9628
  var UniqueItemsHandler = class {
9626
- apply(zodSchema4, schema) {
9629
+ apply(zodSchema3, schema) {
9627
9630
  const arraySchema = schema;
9628
- if (arraySchema.uniqueItems !== true) return zodSchema4;
9629
- return zodSchema4.refine(createUniqueItemsValidator(), {
9631
+ if (arraySchema.uniqueItems !== true) return zodSchema3;
9632
+ return zodSchema3.refine(createUniqueItemsValidator(), {
9630
9633
  message: "Array items must be unique"
9631
9634
  });
9632
9635
  }
9633
9636
  };
9634
9637
  var AllOfHandler = class {
9635
- apply(zodSchema4, schema) {
9636
- if (!schema.allOf || schema.allOf.length === 0) return zodSchema4;
9638
+ apply(zodSchema3, schema) {
9639
+ if (!schema.allOf || schema.allOf.length === 0) return zodSchema3;
9637
9640
  const allOfSchemas = schema.allOf.map((s) => convertJsonSchemaToZod(s));
9638
9641
  return allOfSchemas.reduce(
9639
- (acc, s) => z104.z.intersection(acc, s),
9640
- zodSchema4
9642
+ (acc, s) => z42.z.intersection(acc, s),
9643
+ zodSchema3
9641
9644
  );
9642
9645
  }
9643
9646
  };
9644
9647
  var AnyOfHandler = class {
9645
- apply(zodSchema4, schema) {
9646
- if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema4;
9647
- const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z104.z.union([
9648
+ apply(zodSchema3, schema) {
9649
+ if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema3;
9650
+ const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z42.z.union([
9648
9651
  convertJsonSchemaToZod(schema.anyOf[0]),
9649
9652
  convertJsonSchemaToZod(schema.anyOf[1]),
9650
9653
  ...schema.anyOf.slice(2).map((s) => convertJsonSchemaToZod(s))
9651
9654
  ]);
9652
- return z104.z.intersection(zodSchema4, anyOfSchema);
9655
+ return z42.z.intersection(zodSchema3, anyOfSchema);
9653
9656
  }
9654
9657
  };
9655
9658
  var OneOfHandler = class {
9656
- apply(zodSchema4, schema) {
9657
- if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema4;
9659
+ apply(zodSchema3, schema) {
9660
+ if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema3;
9658
9661
  const oneOfSchemas = schema.oneOf.map((s) => convertJsonSchemaToZod(s));
9659
- return zodSchema4.refine(
9662
+ return zodSchema3.refine(
9660
9663
  (value) => {
9661
9664
  let validCount = 0;
9662
9665
  for (const oneOfSchema of oneOfSchemas) {
@@ -9673,12 +9676,12 @@ var OneOfHandler = class {
9673
9676
  }
9674
9677
  };
9675
9678
  var PrefixItemsHandler = class {
9676
- apply(zodSchema4, schema) {
9679
+ apply(zodSchema3, schema) {
9677
9680
  const arraySchema = schema;
9678
9681
  if (arraySchema.prefixItems && Array.isArray(arraySchema.prefixItems)) {
9679
9682
  const prefixItems = arraySchema.prefixItems;
9680
9683
  const prefixSchemas = prefixItems.map((itemSchema) => convertJsonSchemaToZod(itemSchema));
9681
- return zodSchema4.refine(
9684
+ return zodSchema3.refine(
9682
9685
  (value) => {
9683
9686
  if (!Array.isArray(value)) return true;
9684
9687
  for (let i = 0; i < Math.min(value.length, prefixSchemas.length); i++) {
@@ -9703,16 +9706,16 @@ var PrefixItemsHandler = class {
9703
9706
  { message: "Array does not match prefixItems schema" }
9704
9707
  );
9705
9708
  }
9706
- return zodSchema4;
9709
+ return zodSchema3;
9707
9710
  }
9708
9711
  };
9709
9712
  var ObjectPropertiesHandler = class {
9710
- apply(zodSchema4, schema) {
9713
+ apply(zodSchema3, schema) {
9711
9714
  const objectSchema = schema;
9712
9715
  if (!objectSchema.properties && !objectSchema.required && objectSchema.additionalProperties !== false) {
9713
- return zodSchema4;
9716
+ return zodSchema3;
9714
9717
  }
9715
- if (zodSchema4 instanceof z104.z.ZodObject || zodSchema4 instanceof z104.z.ZodRecord) {
9718
+ if (zodSchema3 instanceof z42.z.ZodObject || zodSchema3 instanceof z42.z.ZodRecord) {
9716
9719
  const shape = {};
9717
9720
  if (objectSchema.properties) {
9718
9721
  for (const [key, propSchema] of Object.entries(objectSchema.properties)) {
@@ -9734,12 +9737,12 @@ var ObjectPropertiesHandler = class {
9734
9737
  }
9735
9738
  }
9736
9739
  if (objectSchema.additionalProperties === false) {
9737
- return z104.z.object(shape);
9740
+ return z42.z.object(shape);
9738
9741
  } else {
9739
- return z104.z.object(shape).passthrough();
9742
+ return z42.z.object(shape).passthrough();
9740
9743
  }
9741
9744
  }
9742
- return zodSchema4.refine(
9745
+ return zodSchema3.refine(
9743
9746
  (value) => {
9744
9747
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
9745
9748
  return true;
@@ -9781,13 +9784,13 @@ var ObjectPropertiesHandler = class {
9781
9784
  }
9782
9785
  };
9783
9786
  var EnumComplexHandler = class {
9784
- apply(zodSchema4, schema) {
9785
- if (!schema.enum || schema.enum.length === 0) return zodSchema4;
9787
+ apply(zodSchema3, schema) {
9788
+ if (!schema.enum || schema.enum.length === 0) return zodSchema3;
9786
9789
  const complexValues = schema.enum.filter(
9787
9790
  (v) => Array.isArray(v) || typeof v === "object" && v !== null
9788
9791
  );
9789
- if (complexValues.length === 0) return zodSchema4;
9790
- return zodSchema4.refine(
9792
+ if (complexValues.length === 0) return zodSchema3;
9793
+ return zodSchema3.refine(
9791
9794
  (value) => {
9792
9795
  if (typeof value !== "object" || value === null) return true;
9793
9796
  return complexValues.some(
@@ -9799,34 +9802,34 @@ var EnumComplexHandler = class {
9799
9802
  }
9800
9803
  };
9801
9804
  var ConstComplexHandler = class {
9802
- apply(zodSchema4, schema) {
9803
- if (schema.const === void 0) return zodSchema4;
9805
+ apply(zodSchema3, schema) {
9806
+ if (schema.const === void 0) return zodSchema3;
9804
9807
  const constValue = schema.const;
9805
9808
  if (typeof constValue !== "object" || constValue === null) {
9806
- return zodSchema4;
9809
+ return zodSchema3;
9807
9810
  }
9808
- return zodSchema4.refine(
9811
+ return zodSchema3.refine(
9809
9812
  (value) => deepEqual(value, constValue),
9810
9813
  { message: "Value must equal the const value" }
9811
9814
  );
9812
9815
  }
9813
9816
  };
9814
9817
  var MetadataHandler = class {
9815
- apply(zodSchema4, schema) {
9818
+ apply(zodSchema3, schema) {
9816
9819
  if (schema.description) {
9817
- zodSchema4 = zodSchema4.describe(schema.description);
9820
+ zodSchema3 = zodSchema3.describe(schema.description);
9818
9821
  }
9819
- return zodSchema4;
9822
+ return zodSchema3;
9820
9823
  }
9821
9824
  };
9822
9825
  var ProtoRequiredHandler = class {
9823
- apply(zodSchema4, schema) {
9824
- var _a21;
9826
+ apply(zodSchema3, schema) {
9827
+ var _a20;
9825
9828
  const objectSchema = schema;
9826
- if (!((_a21 = objectSchema.required) == null ? void 0 : _a21.includes("__proto__")) || schema.type !== void 0) {
9827
- return zodSchema4;
9829
+ if (!((_a20 = objectSchema.required) == null ? void 0 : _a20.includes("__proto__")) || schema.type !== void 0) {
9830
+ return zodSchema3;
9828
9831
  }
9829
- return z104.z.any().refine(
9832
+ return z42.z.any().refine(
9830
9833
  (value) => this.validateRequired(value, objectSchema.required),
9831
9834
  { message: "Missing required properties" }
9832
9835
  );
@@ -9841,14 +9844,14 @@ var ProtoRequiredHandler = class {
9841
9844
  }
9842
9845
  };
9843
9846
  var ContainsHandler = class {
9844
- apply(zodSchema4, schema) {
9845
- var _a21;
9847
+ apply(zodSchema3, schema) {
9848
+ var _a20;
9846
9849
  const arraySchema = schema;
9847
- if (arraySchema.contains === void 0) return zodSchema4;
9850
+ if (arraySchema.contains === void 0) return zodSchema3;
9848
9851
  const containsSchema = convertJsonSchemaToZod(arraySchema.contains);
9849
- const minContains = (_a21 = arraySchema.minContains) != null ? _a21 : 1;
9852
+ const minContains = (_a20 = arraySchema.minContains) != null ? _a20 : 1;
9850
9853
  const maxContains = arraySchema.maxContains;
9851
- return zodSchema4.refine(
9854
+ return zodSchema3.refine(
9852
9855
  (value) => {
9853
9856
  if (!Array.isArray(value)) {
9854
9857
  return true;
@@ -9922,7 +9925,7 @@ var refinementHandlers = [
9922
9925
  ];
9923
9926
  function convertJsonSchemaToZod(schema) {
9924
9927
  if (typeof schema === "boolean") {
9925
- return schema ? z104.z.any() : z104.z.never();
9928
+ return schema ? z42.z.any() : z42.z.never();
9926
9929
  }
9927
9930
  const types = {};
9928
9931
  for (const handler of primitiveHandlers) {
@@ -9930,19 +9933,19 @@ function convertJsonSchemaToZod(schema) {
9930
9933
  }
9931
9934
  const allowedSchemas = [];
9932
9935
  if (types.string !== false) {
9933
- allowedSchemas.push(types.string || z104.z.string());
9936
+ allowedSchemas.push(types.string || z42.z.string());
9934
9937
  }
9935
9938
  if (types.number !== false) {
9936
- allowedSchemas.push(types.number || z104.z.number());
9939
+ allowedSchemas.push(types.number || z42.z.number());
9937
9940
  }
9938
9941
  if (types.boolean !== false) {
9939
- allowedSchemas.push(types.boolean || z104.z.boolean());
9942
+ allowedSchemas.push(types.boolean || z42.z.boolean());
9940
9943
  }
9941
9944
  if (types.null !== false) {
9942
- allowedSchemas.push(types.null || z104.z.null());
9945
+ allowedSchemas.push(types.null || z42.z.null());
9943
9946
  }
9944
9947
  if (types.array !== false) {
9945
- allowedSchemas.push(types.array || z104.z.array(z104.z.any()));
9948
+ allowedSchemas.push(types.array || z42.z.array(z42.z.any()));
9946
9949
  }
9947
9950
  if (types.tuple !== false && types.tuple !== void 0) {
9948
9951
  allowedSchemas.push(types.tuple);
@@ -9951,38 +9954,38 @@ function convertJsonSchemaToZod(schema) {
9951
9954
  if (types.object) {
9952
9955
  allowedSchemas.push(types.object);
9953
9956
  } else {
9954
- const objectSchema = z104.z.custom((val) => {
9957
+ const objectSchema = z42.z.custom((val) => {
9955
9958
  return typeof val === "object" && val !== null && !Array.isArray(val);
9956
9959
  }, "Must be an object, not an array");
9957
9960
  allowedSchemas.push(objectSchema);
9958
9961
  }
9959
9962
  }
9960
- let zodSchema4;
9963
+ let zodSchema3;
9961
9964
  if (allowedSchemas.length === 0) {
9962
- zodSchema4 = z104.z.never();
9965
+ zodSchema3 = z42.z.never();
9963
9966
  } else if (allowedSchemas.length === 1) {
9964
- zodSchema4 = allowedSchemas[0];
9967
+ zodSchema3 = allowedSchemas[0];
9965
9968
  } else {
9966
9969
  const hasConstraints = Object.keys(schema).some(
9967
9970
  (key) => key !== "$schema" && key !== "title" && key !== "description"
9968
9971
  );
9969
9972
  if (!hasConstraints) {
9970
- zodSchema4 = z104.z.any();
9973
+ zodSchema3 = z42.z.any();
9971
9974
  } else {
9972
- zodSchema4 = z104.z.union(allowedSchemas);
9975
+ zodSchema3 = z42.z.union(allowedSchemas);
9973
9976
  }
9974
9977
  }
9975
9978
  for (const handler of refinementHandlers) {
9976
- zodSchema4 = handler.apply(zodSchema4, schema);
9979
+ zodSchema3 = handler.apply(zodSchema3, schema);
9977
9980
  }
9978
- return zodSchema4;
9981
+ return zodSchema3;
9979
9982
  }
9980
9983
  function convertJsonSchemaToZod2(schema) {
9981
- function addMetadata(zodSchema4, jsonSchema4) {
9982
- if (jsonSchema4.description) {
9983
- zodSchema4 = zodSchema4.describe(jsonSchema4.description);
9984
+ function addMetadata(zodSchema3, jsonSchema3) {
9985
+ if (jsonSchema3.description) {
9986
+ zodSchema3 = zodSchema3.describe(jsonSchema3.description);
9984
9987
  }
9985
- return zodSchema4;
9988
+ return zodSchema3;
9986
9989
  }
9987
9990
  if (schema.const !== void 0) {
9988
9991
  if (typeof schema.const === "string") {
@@ -10088,13 +10091,13 @@ function convertJsonSchemaToZod2(schema) {
10088
10091
  shape[key] = shape[key].optional();
10089
10092
  }
10090
10093
  }
10091
- let zodSchema4;
10094
+ let zodSchema3;
10092
10095
  if (schema.additionalProperties !== false) {
10093
- zodSchema4 = zod.z.object(shape).passthrough();
10096
+ zodSchema3 = zod.z.object(shape).passthrough();
10094
10097
  } else {
10095
- zodSchema4 = zod.z.object(shape);
10098
+ zodSchema3 = zod.z.object(shape);
10096
10099
  }
10097
- return addMetadata(zodSchema4, schema);
10100
+ return addMetadata(zodSchema3, schema);
10098
10101
  }
10099
10102
  return addMetadata(zod.z.object({}), schema);
10100
10103
  case "array": {
@@ -10671,11 +10674,11 @@ ${workingMemory}`;
10671
10674
  release();
10672
10675
  }
10673
10676
  }
10674
- chunkText(text4, tokenSize = 4096) {
10677
+ chunkText(text3, tokenSize = 4096) {
10675
10678
  const charSize = tokenSize * CHARS_PER_TOKEN;
10676
10679
  const chunks = [];
10677
10680
  let currentChunk = "";
10678
- const words = text4.split(/\s+/);
10681
+ const words = text3.split(/\s+/);
10679
10682
  for (const word of words) {
10680
10683
  const wordWithSpace = currentChunk ? " " + word : word;
10681
10684
  if (currentChunk.length + wordWithSpace.length > charSize) {
@@ -10837,10 +10840,10 @@ ${workingMemory}`;
10837
10840
  }
10838
10841
  return newMessage;
10839
10842
  }
10840
- parseWorkingMemory(text4) {
10843
+ parseWorkingMemory(text3) {
10841
10844
  if (!this.threadConfig.workingMemory?.enabled) return null;
10842
10845
  const workingMemoryRegex = /<working_memory>([^]*?)<\/working_memory>/g;
10843
- const matches = text4.match(workingMemoryRegex);
10846
+ const matches = text3.match(workingMemoryRegex);
10844
10847
  const match = matches?.[0];
10845
10848
  if (match) {
10846
10849
  return match.replace(/<\/?working_memory>/g, "").trim();
@@ -11140,12 +11143,12 @@ var _Tiktoken = class {
11140
11143
  this.textMap.set(rank, bytes);
11141
11144
  }
11142
11145
  this.specialTokens = { ...ranks.special_tokens, ...extendedSpecialTokens };
11143
- this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [text4, rank]) => {
11144
- memo[rank] = this.textEncoder.encode(text4);
11146
+ this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [text3, rank]) => {
11147
+ memo[rank] = this.textEncoder.encode(text3);
11145
11148
  return memo;
11146
11149
  }, {});
11147
11150
  }
11148
- encode(text4, allowedSpecial = [], disallowedSpecial = "all") {
11151
+ encode(text3, allowedSpecial = [], disallowedSpecial = "all") {
11149
11152
  const regexes = new RegExp(this.patStr, "ug");
11150
11153
  const specialRegex = _Tiktoken.specialTokenRegex(
11151
11154
  Object.keys(this.specialTokens)
@@ -11163,7 +11166,7 @@ var _Tiktoken = class {
11163
11166
  const disallowedSpecialRegex = _Tiktoken.specialTokenRegex([
11164
11167
  ...disallowedSpecialSet
11165
11168
  ]);
11166
- const specialMatch = text4.match(disallowedSpecialRegex);
11169
+ const specialMatch = text3.match(disallowedSpecialRegex);
11167
11170
  if (specialMatch != null) {
11168
11171
  throw new Error(
11169
11172
  `The text contains a special token that is not allowed: ${specialMatch[0]}`
@@ -11176,13 +11179,13 @@ var _Tiktoken = class {
11176
11179
  let startFind = start;
11177
11180
  while (true) {
11178
11181
  specialRegex.lastIndex = startFind;
11179
- nextSpecial = specialRegex.exec(text4);
11182
+ nextSpecial = specialRegex.exec(text3);
11180
11183
  if (nextSpecial == null || allowedSpecialSet.has(nextSpecial[0]))
11181
11184
  break;
11182
11185
  startFind = nextSpecial.index + 1;
11183
11186
  }
11184
- const end = nextSpecial?.index ?? text4.length;
11185
- for (const match of text4.substring(start, end).matchAll(regexes)) {
11187
+ const end = nextSpecial?.index ?? text3.length;
11188
+ for (const match of text3.substring(start, end).matchAll(regexes)) {
11186
11189
  const piece = this.textEncoder.encode(match[0]);
11187
11190
  const token2 = this.rankMap.get(piece.join(","));
11188
11191
  if (token2 != null) {
@@ -11330,2008 +11333,6 @@ var TokenLimiter = class extends memory.MemoryProcessor {
11330
11333
 
11331
11334
  // ../agent-builder/dist/index.js
11332
11335
  var import_ignore = chunkO7I5CWRX_cjs.__toESM(require_ignore(), 1);
11333
- var createIdGenerator3 = ({
11334
- prefix,
11335
- size = 16,
11336
- alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
11337
- separator = "-"
11338
- } = {}) => {
11339
- const generator = () => {
11340
- const alphabetLength = alphabet.length;
11341
- const chars = new Array(size);
11342
- for (let i = 0; i < size; i++) {
11343
- chars[i] = alphabet[Math.random() * alphabetLength | 0];
11344
- }
11345
- return chars.join("");
11346
- };
11347
- if (prefix == null) {
11348
- return generator;
11349
- }
11350
- if (alphabet.includes(separator)) {
11351
- throw new InvalidArgumentError2({
11352
- argument: "separator",
11353
- message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
11354
- });
11355
- }
11356
- return () => `${prefix}${separator}${generator()}`;
11357
- };
11358
- createIdGenerator3();
11359
- var suspectProtoRx2 = /"__proto__"\s*:/;
11360
- var suspectConstructorRx2 = /"constructor"\s*:/;
11361
- function _parse2(text4) {
11362
- const obj = JSON.parse(text4);
11363
- if (obj === null || typeof obj !== "object") {
11364
- return obj;
11365
- }
11366
- if (suspectProtoRx2.test(text4) === false && suspectConstructorRx2.test(text4) === false) {
11367
- return obj;
11368
- }
11369
- return filter2(obj);
11370
- }
11371
- function filter2(obj) {
11372
- let next = [obj];
11373
- while (next.length) {
11374
- const nodes = next;
11375
- next = [];
11376
- for (const node of nodes) {
11377
- if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
11378
- throw new SyntaxError("Object contains forbidden prototype property");
11379
- }
11380
- if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
11381
- throw new SyntaxError("Object contains forbidden prototype property");
11382
- }
11383
- for (const key in node) {
11384
- const value = node[key];
11385
- if (value && typeof value === "object") {
11386
- next.push(value);
11387
- }
11388
- }
11389
- }
11390
- }
11391
- return obj;
11392
- }
11393
- function secureJsonParse2(text4) {
11394
- const { stackTraceLimit } = Error;
11395
- Error.stackTraceLimit = 0;
11396
- try {
11397
- return _parse2(text4);
11398
- } finally {
11399
- Error.stackTraceLimit = stackTraceLimit;
11400
- }
11401
- }
11402
- var validatorSymbol3 = Symbol.for("vercel.ai.validator");
11403
- function validator2(validate) {
11404
- return { [validatorSymbol3]: true, validate };
11405
- }
11406
- function isValidator2(value) {
11407
- return typeof value === "object" && value !== null && validatorSymbol3 in value && value[validatorSymbol3] === true && "validate" in value;
11408
- }
11409
- function asValidator2(value) {
11410
- return isValidator2(value) ? value : typeof value === "function" ? value() : standardSchemaValidator2(value);
11411
- }
11412
- function standardSchemaValidator2(standardSchema) {
11413
- return validator2(async (value) => {
11414
- const result = await standardSchema["~standard"].validate(value);
11415
- return result.issues == null ? { success: true, value: result.value } : {
11416
- success: false,
11417
- error: new TypeValidationError({
11418
- value,
11419
- cause: result.issues
11420
- })
11421
- };
11422
- });
11423
- }
11424
- async function safeValidateTypes3({
11425
- value,
11426
- schema
11427
- }) {
11428
- const validator22 = asValidator2(schema);
11429
- try {
11430
- if (validator22.validate == null) {
11431
- return { success: true, value, rawValue: value };
11432
- }
11433
- const result = await validator22.validate(value);
11434
- if (result.success) {
11435
- return { success: true, value: result.value, rawValue: value };
11436
- }
11437
- return {
11438
- success: false,
11439
- error: TypeValidationError.wrap({ value, cause: result.error }),
11440
- rawValue: value
11441
- };
11442
- } catch (error) {
11443
- return {
11444
- success: false,
11445
- error: TypeValidationError.wrap({ value, cause: error }),
11446
- rawValue: value
11447
- };
11448
- }
11449
- }
11450
- async function safeParseJSON3({
11451
- text: text4,
11452
- schema
11453
- }) {
11454
- try {
11455
- const value = secureJsonParse2(text4);
11456
- if (schema == null) {
11457
- return { success: true, value, rawValue: value };
11458
- }
11459
- return await safeValidateTypes3({ value, schema });
11460
- } catch (error) {
11461
- return {
11462
- success: false,
11463
- error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
11464
- rawValue: void 0
11465
- };
11466
- }
11467
- }
11468
- var getRelativePath3 = (pathA, pathB) => {
11469
- let i = 0;
11470
- for (; i < pathA.length && i < pathB.length; i++) {
11471
- if (pathA[i] !== pathB[i]) break;
11472
- }
11473
- return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
11474
- };
11475
- var ignoreOverride3 = Symbol(
11476
- "Let zodToJsonSchema decide on which parser to use"
11477
- );
11478
- var defaultOptions3 = {
11479
- name: void 0,
11480
- $refStrategy: "root",
11481
- basePath: ["#"],
11482
- effectStrategy: "input",
11483
- pipeStrategy: "all",
11484
- dateStrategy: "format:date-time",
11485
- mapStrategy: "entries",
11486
- removeAdditionalStrategy: "passthrough",
11487
- allowedAdditionalProperties: true,
11488
- rejectedAdditionalProperties: false,
11489
- definitionPath: "definitions",
11490
- strictUnions: false,
11491
- definitions: {},
11492
- errorMessages: false,
11493
- patternStrategy: "escape",
11494
- applyRegexFlags: false,
11495
- emailStrategy: "format:email",
11496
- base64Strategy: "contentEncoding:base64",
11497
- nameStrategy: "ref"
11498
- };
11499
- var getDefaultOptions3 = (options) => typeof options === "string" ? {
11500
- ...defaultOptions3,
11501
- name: options
11502
- } : {
11503
- ...defaultOptions3,
11504
- ...options
11505
- };
11506
- function parseAnyDef3() {
11507
- return {};
11508
- }
11509
- function parseArrayDef3(def, refs) {
11510
- var _a21, _b8, _c;
11511
- const res = {
11512
- type: "array"
11513
- };
11514
- if (((_a21 = def.type) == null ? void 0 : _a21._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
11515
- res.items = parseDef3(def.type._def, {
11516
- ...refs,
11517
- currentPath: [...refs.currentPath, "items"]
11518
- });
11519
- }
11520
- if (def.minLength) {
11521
- res.minItems = def.minLength.value;
11522
- }
11523
- if (def.maxLength) {
11524
- res.maxItems = def.maxLength.value;
11525
- }
11526
- if (def.exactLength) {
11527
- res.minItems = def.exactLength.value;
11528
- res.maxItems = def.exactLength.value;
11529
- }
11530
- return res;
11531
- }
11532
- function parseBigintDef3(def) {
11533
- const res = {
11534
- type: "integer",
11535
- format: "int64"
11536
- };
11537
- if (!def.checks) return res;
11538
- for (const check of def.checks) {
11539
- switch (check.kind) {
11540
- case "min":
11541
- if (check.inclusive) {
11542
- res.minimum = check.value;
11543
- } else {
11544
- res.exclusiveMinimum = check.value;
11545
- }
11546
- break;
11547
- case "max":
11548
- if (check.inclusive) {
11549
- res.maximum = check.value;
11550
- } else {
11551
- res.exclusiveMaximum = check.value;
11552
- }
11553
- break;
11554
- case "multipleOf":
11555
- res.multipleOf = check.value;
11556
- break;
11557
- }
11558
- }
11559
- return res;
11560
- }
11561
- function parseBooleanDef3() {
11562
- return { type: "boolean" };
11563
- }
11564
- function parseBrandedDef3(_def, refs) {
11565
- return parseDef3(_def.type._def, refs);
11566
- }
11567
- var parseCatchDef3 = (def, refs) => {
11568
- return parseDef3(def.innerType._def, refs);
11569
- };
11570
- function parseDateDef3(def, refs, overrideDateStrategy) {
11571
- const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
11572
- if (Array.isArray(strategy)) {
11573
- return {
11574
- anyOf: strategy.map((item, i) => parseDateDef3(def, refs, item))
11575
- };
11576
- }
11577
- switch (strategy) {
11578
- case "string":
11579
- case "format:date-time":
11580
- return {
11581
- type: "string",
11582
- format: "date-time"
11583
- };
11584
- case "format:date":
11585
- return {
11586
- type: "string",
11587
- format: "date"
11588
- };
11589
- case "integer":
11590
- return integerDateParser3(def);
11591
- }
11592
- }
11593
- var integerDateParser3 = (def) => {
11594
- const res = {
11595
- type: "integer",
11596
- format: "unix-time"
11597
- };
11598
- for (const check of def.checks) {
11599
- switch (check.kind) {
11600
- case "min":
11601
- res.minimum = check.value;
11602
- break;
11603
- case "max":
11604
- res.maximum = check.value;
11605
- break;
11606
- }
11607
- }
11608
- return res;
11609
- };
11610
- function parseDefaultDef3(_def, refs) {
11611
- return {
11612
- ...parseDef3(_def.innerType._def, refs),
11613
- default: _def.defaultValue()
11614
- };
11615
- }
11616
- function parseEffectsDef3(_def, refs) {
11617
- return refs.effectStrategy === "input" ? parseDef3(_def.schema._def, refs) : parseAnyDef3();
11618
- }
11619
- function parseEnumDef3(def) {
11620
- return {
11621
- type: "string",
11622
- enum: Array.from(def.values)
11623
- };
11624
- }
11625
- var isJsonSchema7AllOfType3 = (type) => {
11626
- if ("type" in type && type.type === "string") return false;
11627
- return "allOf" in type;
11628
- };
11629
- function parseIntersectionDef3(def, refs) {
11630
- const allOf = [
11631
- parseDef3(def.left._def, {
11632
- ...refs,
11633
- currentPath: [...refs.currentPath, "allOf", "0"]
11634
- }),
11635
- parseDef3(def.right._def, {
11636
- ...refs,
11637
- currentPath: [...refs.currentPath, "allOf", "1"]
11638
- })
11639
- ].filter((x) => !!x);
11640
- const mergedAllOf = [];
11641
- allOf.forEach((schema) => {
11642
- if (isJsonSchema7AllOfType3(schema)) {
11643
- mergedAllOf.push(...schema.allOf);
11644
- } else {
11645
- let nestedSchema = schema;
11646
- if ("additionalProperties" in schema && schema.additionalProperties === false) {
11647
- const { additionalProperties, ...rest } = schema;
11648
- nestedSchema = rest;
11649
- }
11650
- mergedAllOf.push(nestedSchema);
11651
- }
11652
- });
11653
- return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
11654
- }
11655
- function parseLiteralDef3(def) {
11656
- const parsedType = typeof def.value;
11657
- if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
11658
- return {
11659
- type: Array.isArray(def.value) ? "array" : "object"
11660
- };
11661
- }
11662
- return {
11663
- type: parsedType === "bigint" ? "integer" : parsedType,
11664
- const: def.value
11665
- };
11666
- }
11667
- var emojiRegex3 = void 0;
11668
- var zodPatterns3 = {
11669
- /**
11670
- * `c` was changed to `[cC]` to replicate /i flag
11671
- */
11672
- cuid: /^[cC][^\s-]{8,}$/,
11673
- cuid2: /^[0-9a-z]+$/,
11674
- ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
11675
- /**
11676
- * `a-z` was added to replicate /i flag
11677
- */
11678
- email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
11679
- /**
11680
- * Constructed a valid Unicode RegExp
11681
- *
11682
- * Lazily instantiate since this type of regex isn't supported
11683
- * in all envs (e.g. React Native).
11684
- *
11685
- * See:
11686
- * https://github.com/colinhacks/zod/issues/2433
11687
- * Fix in Zod:
11688
- * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
11689
- */
11690
- emoji: () => {
11691
- if (emojiRegex3 === void 0) {
11692
- emojiRegex3 = RegExp(
11693
- "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
11694
- "u"
11695
- );
11696
- }
11697
- return emojiRegex3;
11698
- },
11699
- /**
11700
- * Unused
11701
- */
11702
- uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
11703
- /**
11704
- * Unused
11705
- */
11706
- ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
11707
- ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
11708
- /**
11709
- * Unused
11710
- */
11711
- ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
11712
- ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
11713
- base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
11714
- base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
11715
- nanoid: /^[a-zA-Z0-9_-]{21}$/,
11716
- jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
11717
- };
11718
- function parseStringDef3(def, refs) {
11719
- const res = {
11720
- type: "string"
11721
- };
11722
- if (def.checks) {
11723
- for (const check of def.checks) {
11724
- switch (check.kind) {
11725
- case "min":
11726
- res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
11727
- break;
11728
- case "max":
11729
- res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
11730
- break;
11731
- case "email":
11732
- switch (refs.emailStrategy) {
11733
- case "format:email":
11734
- addFormat3(res, "email", check.message, refs);
11735
- break;
11736
- case "format:idn-email":
11737
- addFormat3(res, "idn-email", check.message, refs);
11738
- break;
11739
- case "pattern:zod":
11740
- addPattern3(res, zodPatterns3.email, check.message, refs);
11741
- break;
11742
- }
11743
- break;
11744
- case "url":
11745
- addFormat3(res, "uri", check.message, refs);
11746
- break;
11747
- case "uuid":
11748
- addFormat3(res, "uuid", check.message, refs);
11749
- break;
11750
- case "regex":
11751
- addPattern3(res, check.regex, check.message, refs);
11752
- break;
11753
- case "cuid":
11754
- addPattern3(res, zodPatterns3.cuid, check.message, refs);
11755
- break;
11756
- case "cuid2":
11757
- addPattern3(res, zodPatterns3.cuid2, check.message, refs);
11758
- break;
11759
- case "startsWith":
11760
- addPattern3(
11761
- res,
11762
- RegExp(`^${escapeLiteralCheckValue3(check.value, refs)}`),
11763
- check.message,
11764
- refs
11765
- );
11766
- break;
11767
- case "endsWith":
11768
- addPattern3(
11769
- res,
11770
- RegExp(`${escapeLiteralCheckValue3(check.value, refs)}$`),
11771
- check.message,
11772
- refs
11773
- );
11774
- break;
11775
- case "datetime":
11776
- addFormat3(res, "date-time", check.message, refs);
11777
- break;
11778
- case "date":
11779
- addFormat3(res, "date", check.message, refs);
11780
- break;
11781
- case "time":
11782
- addFormat3(res, "time", check.message, refs);
11783
- break;
11784
- case "duration":
11785
- addFormat3(res, "duration", check.message, refs);
11786
- break;
11787
- case "length":
11788
- res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
11789
- res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
11790
- break;
11791
- case "includes": {
11792
- addPattern3(
11793
- res,
11794
- RegExp(escapeLiteralCheckValue3(check.value, refs)),
11795
- check.message,
11796
- refs
11797
- );
11798
- break;
11799
- }
11800
- case "ip": {
11801
- if (check.version !== "v6") {
11802
- addFormat3(res, "ipv4", check.message, refs);
11803
- }
11804
- if (check.version !== "v4") {
11805
- addFormat3(res, "ipv6", check.message, refs);
11806
- }
11807
- break;
11808
- }
11809
- case "base64url":
11810
- addPattern3(res, zodPatterns3.base64url, check.message, refs);
11811
- break;
11812
- case "jwt":
11813
- addPattern3(res, zodPatterns3.jwt, check.message, refs);
11814
- break;
11815
- case "cidr": {
11816
- if (check.version !== "v6") {
11817
- addPattern3(res, zodPatterns3.ipv4Cidr, check.message, refs);
11818
- }
11819
- if (check.version !== "v4") {
11820
- addPattern3(res, zodPatterns3.ipv6Cidr, check.message, refs);
11821
- }
11822
- break;
11823
- }
11824
- case "emoji":
11825
- addPattern3(res, zodPatterns3.emoji(), check.message, refs);
11826
- break;
11827
- case "ulid": {
11828
- addPattern3(res, zodPatterns3.ulid, check.message, refs);
11829
- break;
11830
- }
11831
- case "base64": {
11832
- switch (refs.base64Strategy) {
11833
- case "format:binary": {
11834
- addFormat3(res, "binary", check.message, refs);
11835
- break;
11836
- }
11837
- case "contentEncoding:base64": {
11838
- res.contentEncoding = "base64";
11839
- break;
11840
- }
11841
- case "pattern:zod": {
11842
- addPattern3(res, zodPatterns3.base64, check.message, refs);
11843
- break;
11844
- }
11845
- }
11846
- break;
11847
- }
11848
- case "nanoid": {
11849
- addPattern3(res, zodPatterns3.nanoid, check.message, refs);
11850
- }
11851
- }
11852
- }
11853
- }
11854
- return res;
11855
- }
11856
- function escapeLiteralCheckValue3(literal7, refs) {
11857
- return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric3(literal7) : literal7;
11858
- }
11859
- var ALPHA_NUMERIC3 = new Set(
11860
- "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
11861
- );
11862
- function escapeNonAlphaNumeric3(source) {
11863
- let result = "";
11864
- for (let i = 0; i < source.length; i++) {
11865
- if (!ALPHA_NUMERIC3.has(source[i])) {
11866
- result += "\\";
11867
- }
11868
- result += source[i];
11869
- }
11870
- return result;
11871
- }
11872
- function addFormat3(schema, value, message, refs) {
11873
- var _a21;
11874
- if (schema.format || ((_a21 = schema.anyOf) == null ? void 0 : _a21.some((x) => x.format))) {
11875
- if (!schema.anyOf) {
11876
- schema.anyOf = [];
11877
- }
11878
- if (schema.format) {
11879
- schema.anyOf.push({
11880
- format: schema.format
11881
- });
11882
- delete schema.format;
11883
- }
11884
- schema.anyOf.push({
11885
- format: value,
11886
- ...message && refs.errorMessages && { errorMessage: { format: message } }
11887
- });
11888
- } else {
11889
- schema.format = value;
11890
- }
11891
- }
11892
- function addPattern3(schema, regex, message, refs) {
11893
- var _a21;
11894
- if (schema.pattern || ((_a21 = schema.allOf) == null ? void 0 : _a21.some((x) => x.pattern))) {
11895
- if (!schema.allOf) {
11896
- schema.allOf = [];
11897
- }
11898
- if (schema.pattern) {
11899
- schema.allOf.push({
11900
- pattern: schema.pattern
11901
- });
11902
- delete schema.pattern;
11903
- }
11904
- schema.allOf.push({
11905
- pattern: stringifyRegExpWithFlags3(regex, refs),
11906
- ...message && refs.errorMessages && { errorMessage: { pattern: message } }
11907
- });
11908
- } else {
11909
- schema.pattern = stringifyRegExpWithFlags3(regex, refs);
11910
- }
11911
- }
11912
- function stringifyRegExpWithFlags3(regex, refs) {
11913
- var _a21;
11914
- if (!refs.applyRegexFlags || !regex.flags) {
11915
- return regex.source;
11916
- }
11917
- const flags = {
11918
- i: regex.flags.includes("i"),
11919
- // Case-insensitive
11920
- m: regex.flags.includes("m"),
11921
- // `^` and `$` matches adjacent to newline characters
11922
- s: regex.flags.includes("s")
11923
- // `.` matches newlines
11924
- };
11925
- const source = flags.i ? regex.source.toLowerCase() : regex.source;
11926
- let pattern = "";
11927
- let isEscaped = false;
11928
- let inCharGroup = false;
11929
- let inCharRange = false;
11930
- for (let i = 0; i < source.length; i++) {
11931
- if (isEscaped) {
11932
- pattern += source[i];
11933
- isEscaped = false;
11934
- continue;
11935
- }
11936
- if (flags.i) {
11937
- if (inCharGroup) {
11938
- if (source[i].match(/[a-z]/)) {
11939
- if (inCharRange) {
11940
- pattern += source[i];
11941
- pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
11942
- inCharRange = false;
11943
- } else if (source[i + 1] === "-" && ((_a21 = source[i + 2]) == null ? void 0 : _a21.match(/[a-z]/))) {
11944
- pattern += source[i];
11945
- inCharRange = true;
11946
- } else {
11947
- pattern += `${source[i]}${source[i].toUpperCase()}`;
11948
- }
11949
- continue;
11950
- }
11951
- } else if (source[i].match(/[a-z]/)) {
11952
- pattern += `[${source[i]}${source[i].toUpperCase()}]`;
11953
- continue;
11954
- }
11955
- }
11956
- if (flags.m) {
11957
- if (source[i] === "^") {
11958
- pattern += `(^|(?<=[\r
11959
- ]))`;
11960
- continue;
11961
- } else if (source[i] === "$") {
11962
- pattern += `($|(?=[\r
11963
- ]))`;
11964
- continue;
11965
- }
11966
- }
11967
- if (flags.s && source[i] === ".") {
11968
- pattern += inCharGroup ? `${source[i]}\r
11969
- ` : `[${source[i]}\r
11970
- ]`;
11971
- continue;
11972
- }
11973
- pattern += source[i];
11974
- if (source[i] === "\\") {
11975
- isEscaped = true;
11976
- } else if (inCharGroup && source[i] === "]") {
11977
- inCharGroup = false;
11978
- } else if (!inCharGroup && source[i] === "[") {
11979
- inCharGroup = true;
11980
- }
11981
- }
11982
- return pattern;
11983
- }
11984
- function parseRecordDef3(def, refs) {
11985
- var _a21, _b8, _c, _d, _e, _f;
11986
- const schema = {
11987
- type: "object",
11988
- additionalProperties: (_a21 = parseDef3(def.valueType._def, {
11989
- ...refs,
11990
- currentPath: [...refs.currentPath, "additionalProperties"]
11991
- })) != null ? _a21 : refs.allowedAdditionalProperties
11992
- };
11993
- if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
11994
- const { type, ...keyType } = parseStringDef3(def.keyType._def, refs);
11995
- return {
11996
- ...schema,
11997
- propertyNames: keyType
11998
- };
11999
- } else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === v3.ZodFirstPartyTypeKind.ZodEnum) {
12000
- return {
12001
- ...schema,
12002
- propertyNames: {
12003
- enum: def.keyType._def.values
12004
- }
12005
- };
12006
- } else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === v3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === v3.ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
12007
- const { type, ...keyType } = parseBrandedDef3(
12008
- def.keyType._def,
12009
- refs
12010
- );
12011
- return {
12012
- ...schema,
12013
- propertyNames: keyType
12014
- };
12015
- }
12016
- return schema;
12017
- }
12018
- function parseMapDef3(def, refs) {
12019
- if (refs.mapStrategy === "record") {
12020
- return parseRecordDef3(def, refs);
12021
- }
12022
- const keys = parseDef3(def.keyType._def, {
12023
- ...refs,
12024
- currentPath: [...refs.currentPath, "items", "items", "0"]
12025
- }) || parseAnyDef3();
12026
- const values = parseDef3(def.valueType._def, {
12027
- ...refs,
12028
- currentPath: [...refs.currentPath, "items", "items", "1"]
12029
- }) || parseAnyDef3();
12030
- return {
12031
- type: "array",
12032
- maxItems: 125,
12033
- items: {
12034
- type: "array",
12035
- items: [keys, values],
12036
- minItems: 2,
12037
- maxItems: 2
12038
- }
12039
- };
12040
- }
12041
- function parseNativeEnumDef3(def) {
12042
- const object8 = def.values;
12043
- const actualKeys = Object.keys(def.values).filter((key) => {
12044
- return typeof object8[object8[key]] !== "number";
12045
- });
12046
- const actualValues = actualKeys.map((key) => object8[key]);
12047
- const parsedTypes = Array.from(
12048
- new Set(actualValues.map((values) => typeof values))
12049
- );
12050
- return {
12051
- type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
12052
- enum: actualValues
12053
- };
12054
- }
12055
- function parseNeverDef3() {
12056
- return { not: parseAnyDef3() };
12057
- }
12058
- function parseNullDef3() {
12059
- return {
12060
- type: "null"
12061
- };
12062
- }
12063
- var primitiveMappings3 = {
12064
- ZodString: "string",
12065
- ZodNumber: "number",
12066
- ZodBigInt: "integer",
12067
- ZodBoolean: "boolean",
12068
- ZodNull: "null"
12069
- };
12070
- function parseUnionDef3(def, refs) {
12071
- const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
12072
- if (options.every(
12073
- (x) => x._def.typeName in primitiveMappings3 && (!x._def.checks || !x._def.checks.length)
12074
- )) {
12075
- const types = options.reduce((types2, x) => {
12076
- const type = primitiveMappings3[x._def.typeName];
12077
- return type && !types2.includes(type) ? [...types2, type] : types2;
12078
- }, []);
12079
- return {
12080
- type: types.length > 1 ? types : types[0]
12081
- };
12082
- } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
12083
- const types = options.reduce(
12084
- (acc, x) => {
12085
- const type = typeof x._def.value;
12086
- switch (type) {
12087
- case "string":
12088
- case "number":
12089
- case "boolean":
12090
- return [...acc, type];
12091
- case "bigint":
12092
- return [...acc, "integer"];
12093
- case "object":
12094
- if (x._def.value === null) return [...acc, "null"];
12095
- case "symbol":
12096
- case "undefined":
12097
- case "function":
12098
- default:
12099
- return acc;
12100
- }
12101
- },
12102
- []
12103
- );
12104
- if (types.length === options.length) {
12105
- const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
12106
- return {
12107
- type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
12108
- enum: options.reduce(
12109
- (acc, x) => {
12110
- return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
12111
- },
12112
- []
12113
- )
12114
- };
12115
- }
12116
- } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
12117
- return {
12118
- type: "string",
12119
- enum: options.reduce(
12120
- (acc, x) => [
12121
- ...acc,
12122
- ...x._def.values.filter((x2) => !acc.includes(x2))
12123
- ],
12124
- []
12125
- )
12126
- };
12127
- }
12128
- return asAnyOf3(def, refs);
12129
- }
12130
- var asAnyOf3 = (def, refs) => {
12131
- const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
12132
- (x, i) => parseDef3(x._def, {
12133
- ...refs,
12134
- currentPath: [...refs.currentPath, "anyOf", `${i}`]
12135
- })
12136
- ).filter(
12137
- (x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
12138
- );
12139
- return anyOf.length ? { anyOf } : void 0;
12140
- };
12141
- function parseNullableDef3(def, refs) {
12142
- if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
12143
- def.innerType._def.typeName
12144
- ) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
12145
- return {
12146
- type: [
12147
- primitiveMappings3[def.innerType._def.typeName],
12148
- "null"
12149
- ]
12150
- };
12151
- }
12152
- const base = parseDef3(def.innerType._def, {
12153
- ...refs,
12154
- currentPath: [...refs.currentPath, "anyOf", "0"]
12155
- });
12156
- return base && { anyOf: [base, { type: "null" }] };
12157
- }
12158
- function parseNumberDef3(def) {
12159
- const res = {
12160
- type: "number"
12161
- };
12162
- if (!def.checks) return res;
12163
- for (const check of def.checks) {
12164
- switch (check.kind) {
12165
- case "int":
12166
- res.type = "integer";
12167
- break;
12168
- case "min":
12169
- if (check.inclusive) {
12170
- res.minimum = check.value;
12171
- } else {
12172
- res.exclusiveMinimum = check.value;
12173
- }
12174
- break;
12175
- case "max":
12176
- if (check.inclusive) {
12177
- res.maximum = check.value;
12178
- } else {
12179
- res.exclusiveMaximum = check.value;
12180
- }
12181
- break;
12182
- case "multipleOf":
12183
- res.multipleOf = check.value;
12184
- break;
12185
- }
12186
- }
12187
- return res;
12188
- }
12189
- function parseObjectDef3(def, refs) {
12190
- const result = {
12191
- type: "object",
12192
- properties: {}
12193
- };
12194
- const required = [];
12195
- const shape = def.shape();
12196
- for (const propName in shape) {
12197
- let propDef = shape[propName];
12198
- if (propDef === void 0 || propDef._def === void 0) {
12199
- continue;
12200
- }
12201
- const propOptional = safeIsOptional3(propDef);
12202
- const parsedDef = parseDef3(propDef._def, {
12203
- ...refs,
12204
- currentPath: [...refs.currentPath, "properties", propName],
12205
- propertyPath: [...refs.currentPath, "properties", propName]
12206
- });
12207
- if (parsedDef === void 0) {
12208
- continue;
12209
- }
12210
- result.properties[propName] = parsedDef;
12211
- if (!propOptional) {
12212
- required.push(propName);
12213
- }
12214
- }
12215
- if (required.length) {
12216
- result.required = required;
12217
- }
12218
- const additionalProperties = decideAdditionalProperties3(def, refs);
12219
- if (additionalProperties !== void 0) {
12220
- result.additionalProperties = additionalProperties;
12221
- }
12222
- return result;
12223
- }
12224
- function decideAdditionalProperties3(def, refs) {
12225
- if (def.catchall._def.typeName !== "ZodNever") {
12226
- return parseDef3(def.catchall._def, {
12227
- ...refs,
12228
- currentPath: [...refs.currentPath, "additionalProperties"]
12229
- });
12230
- }
12231
- switch (def.unknownKeys) {
12232
- case "passthrough":
12233
- return refs.allowedAdditionalProperties;
12234
- case "strict":
12235
- return refs.rejectedAdditionalProperties;
12236
- case "strip":
12237
- return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
12238
- }
12239
- }
12240
- function safeIsOptional3(schema) {
12241
- try {
12242
- return schema.isOptional();
12243
- } catch (e2) {
12244
- return true;
12245
- }
12246
- }
12247
- var parseOptionalDef3 = (def, refs) => {
12248
- var _a21;
12249
- if (refs.currentPath.toString() === ((_a21 = refs.propertyPath) == null ? void 0 : _a21.toString())) {
12250
- return parseDef3(def.innerType._def, refs);
12251
- }
12252
- const innerSchema = parseDef3(def.innerType._def, {
12253
- ...refs,
12254
- currentPath: [...refs.currentPath, "anyOf", "1"]
12255
- });
12256
- return innerSchema ? { anyOf: [{ not: parseAnyDef3() }, innerSchema] } : parseAnyDef3();
12257
- };
12258
- var parsePipelineDef3 = (def, refs) => {
12259
- if (refs.pipeStrategy === "input") {
12260
- return parseDef3(def.in._def, refs);
12261
- } else if (refs.pipeStrategy === "output") {
12262
- return parseDef3(def.out._def, refs);
12263
- }
12264
- const a = parseDef3(def.in._def, {
12265
- ...refs,
12266
- currentPath: [...refs.currentPath, "allOf", "0"]
12267
- });
12268
- const b = parseDef3(def.out._def, {
12269
- ...refs,
12270
- currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
12271
- });
12272
- return {
12273
- allOf: [a, b].filter((x) => x !== void 0)
12274
- };
12275
- };
12276
- function parsePromiseDef3(def, refs) {
12277
- return parseDef3(def.type._def, refs);
12278
- }
12279
- function parseSetDef3(def, refs) {
12280
- const items = parseDef3(def.valueType._def, {
12281
- ...refs,
12282
- currentPath: [...refs.currentPath, "items"]
12283
- });
12284
- const schema = {
12285
- type: "array",
12286
- uniqueItems: true,
12287
- items
12288
- };
12289
- if (def.minSize) {
12290
- schema.minItems = def.minSize.value;
12291
- }
12292
- if (def.maxSize) {
12293
- schema.maxItems = def.maxSize.value;
12294
- }
12295
- return schema;
12296
- }
12297
- function parseTupleDef3(def, refs) {
12298
- if (def.rest) {
12299
- return {
12300
- type: "array",
12301
- minItems: def.items.length,
12302
- items: def.items.map(
12303
- (x, i) => parseDef3(x._def, {
12304
- ...refs,
12305
- currentPath: [...refs.currentPath, "items", `${i}`]
12306
- })
12307
- ).reduce(
12308
- (acc, x) => x === void 0 ? acc : [...acc, x],
12309
- []
12310
- ),
12311
- additionalItems: parseDef3(def.rest._def, {
12312
- ...refs,
12313
- currentPath: [...refs.currentPath, "additionalItems"]
12314
- })
12315
- };
12316
- } else {
12317
- return {
12318
- type: "array",
12319
- minItems: def.items.length,
12320
- maxItems: def.items.length,
12321
- items: def.items.map(
12322
- (x, i) => parseDef3(x._def, {
12323
- ...refs,
12324
- currentPath: [...refs.currentPath, "items", `${i}`]
12325
- })
12326
- ).reduce(
12327
- (acc, x) => x === void 0 ? acc : [...acc, x],
12328
- []
12329
- )
12330
- };
12331
- }
12332
- }
12333
- function parseUndefinedDef3() {
12334
- return {
12335
- not: parseAnyDef3()
12336
- };
12337
- }
12338
- function parseUnknownDef3() {
12339
- return parseAnyDef3();
12340
- }
12341
- var parseReadonlyDef3 = (def, refs) => {
12342
- return parseDef3(def.innerType._def, refs);
12343
- };
12344
- var selectParser3 = (def, typeName, refs) => {
12345
- switch (typeName) {
12346
- case v3.ZodFirstPartyTypeKind.ZodString:
12347
- return parseStringDef3(def, refs);
12348
- case v3.ZodFirstPartyTypeKind.ZodNumber:
12349
- return parseNumberDef3(def);
12350
- case v3.ZodFirstPartyTypeKind.ZodObject:
12351
- return parseObjectDef3(def, refs);
12352
- case v3.ZodFirstPartyTypeKind.ZodBigInt:
12353
- return parseBigintDef3(def);
12354
- case v3.ZodFirstPartyTypeKind.ZodBoolean:
12355
- return parseBooleanDef3();
12356
- case v3.ZodFirstPartyTypeKind.ZodDate:
12357
- return parseDateDef3(def, refs);
12358
- case v3.ZodFirstPartyTypeKind.ZodUndefined:
12359
- return parseUndefinedDef3();
12360
- case v3.ZodFirstPartyTypeKind.ZodNull:
12361
- return parseNullDef3();
12362
- case v3.ZodFirstPartyTypeKind.ZodArray:
12363
- return parseArrayDef3(def, refs);
12364
- case v3.ZodFirstPartyTypeKind.ZodUnion:
12365
- case v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
12366
- return parseUnionDef3(def, refs);
12367
- case v3.ZodFirstPartyTypeKind.ZodIntersection:
12368
- return parseIntersectionDef3(def, refs);
12369
- case v3.ZodFirstPartyTypeKind.ZodTuple:
12370
- return parseTupleDef3(def, refs);
12371
- case v3.ZodFirstPartyTypeKind.ZodRecord:
12372
- return parseRecordDef3(def, refs);
12373
- case v3.ZodFirstPartyTypeKind.ZodLiteral:
12374
- return parseLiteralDef3(def);
12375
- case v3.ZodFirstPartyTypeKind.ZodEnum:
12376
- return parseEnumDef3(def);
12377
- case v3.ZodFirstPartyTypeKind.ZodNativeEnum:
12378
- return parseNativeEnumDef3(def);
12379
- case v3.ZodFirstPartyTypeKind.ZodNullable:
12380
- return parseNullableDef3(def, refs);
12381
- case v3.ZodFirstPartyTypeKind.ZodOptional:
12382
- return parseOptionalDef3(def, refs);
12383
- case v3.ZodFirstPartyTypeKind.ZodMap:
12384
- return parseMapDef3(def, refs);
12385
- case v3.ZodFirstPartyTypeKind.ZodSet:
12386
- return parseSetDef3(def, refs);
12387
- case v3.ZodFirstPartyTypeKind.ZodLazy:
12388
- return () => def.getter()._def;
12389
- case v3.ZodFirstPartyTypeKind.ZodPromise:
12390
- return parsePromiseDef3(def, refs);
12391
- case v3.ZodFirstPartyTypeKind.ZodNaN:
12392
- case v3.ZodFirstPartyTypeKind.ZodNever:
12393
- return parseNeverDef3();
12394
- case v3.ZodFirstPartyTypeKind.ZodEffects:
12395
- return parseEffectsDef3(def, refs);
12396
- case v3.ZodFirstPartyTypeKind.ZodAny:
12397
- return parseAnyDef3();
12398
- case v3.ZodFirstPartyTypeKind.ZodUnknown:
12399
- return parseUnknownDef3();
12400
- case v3.ZodFirstPartyTypeKind.ZodDefault:
12401
- return parseDefaultDef3(def, refs);
12402
- case v3.ZodFirstPartyTypeKind.ZodBranded:
12403
- return parseBrandedDef3(def, refs);
12404
- case v3.ZodFirstPartyTypeKind.ZodReadonly:
12405
- return parseReadonlyDef3(def, refs);
12406
- case v3.ZodFirstPartyTypeKind.ZodCatch:
12407
- return parseCatchDef3(def, refs);
12408
- case v3.ZodFirstPartyTypeKind.ZodPipeline:
12409
- return parsePipelineDef3(def, refs);
12410
- case v3.ZodFirstPartyTypeKind.ZodFunction:
12411
- case v3.ZodFirstPartyTypeKind.ZodVoid:
12412
- case v3.ZodFirstPartyTypeKind.ZodSymbol:
12413
- return void 0;
12414
- default:
12415
- return /* @__PURE__ */ ((_) => void 0)();
12416
- }
12417
- };
12418
- function parseDef3(def, refs, forceResolution = false) {
12419
- var _a21;
12420
- const seenItem = refs.seen.get(def);
12421
- if (refs.override) {
12422
- const overrideResult = (_a21 = refs.override) == null ? void 0 : _a21.call(
12423
- refs,
12424
- def,
12425
- refs,
12426
- seenItem,
12427
- forceResolution
12428
- );
12429
- if (overrideResult !== ignoreOverride3) {
12430
- return overrideResult;
12431
- }
12432
- }
12433
- if (seenItem && !forceResolution) {
12434
- const seenSchema = get$ref3(seenItem, refs);
12435
- if (seenSchema !== void 0) {
12436
- return seenSchema;
12437
- }
12438
- }
12439
- const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
12440
- refs.seen.set(def, newItem);
12441
- const jsonSchemaOrGetter = selectParser3(def, def.typeName, refs);
12442
- const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef3(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
12443
- if (jsonSchema22) {
12444
- addMeta3(def, refs, jsonSchema22);
12445
- }
12446
- if (refs.postProcess) {
12447
- const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
12448
- newItem.jsonSchema = jsonSchema22;
12449
- return postProcessResult;
12450
- }
12451
- newItem.jsonSchema = jsonSchema22;
12452
- return jsonSchema22;
12453
- }
12454
- var get$ref3 = (item, refs) => {
12455
- switch (refs.$refStrategy) {
12456
- case "root":
12457
- return { $ref: item.path.join("/") };
12458
- case "relative":
12459
- return { $ref: getRelativePath3(refs.currentPath, item.path) };
12460
- case "none":
12461
- case "seen": {
12462
- if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
12463
- console.warn(
12464
- `Recursive reference detected at ${refs.currentPath.join(
12465
- "/"
12466
- )}! Defaulting to any`
12467
- );
12468
- return parseAnyDef3();
12469
- }
12470
- return refs.$refStrategy === "seen" ? parseAnyDef3() : void 0;
12471
- }
12472
- }
12473
- };
12474
- var addMeta3 = (def, refs, jsonSchema22) => {
12475
- if (def.description) {
12476
- jsonSchema22.description = def.description;
12477
- }
12478
- return jsonSchema22;
12479
- };
12480
- var getRefs3 = (options) => {
12481
- const _options = getDefaultOptions3(options);
12482
- const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
12483
- return {
12484
- ..._options,
12485
- currentPath,
12486
- propertyPath: void 0,
12487
- seen: new Map(
12488
- Object.entries(_options.definitions).map(([name21, def]) => [
12489
- def._def,
12490
- {
12491
- def: def._def,
12492
- path: [..._options.basePath, _options.definitionPath, name21],
12493
- // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
12494
- jsonSchema: void 0
12495
- }
12496
- ])
12497
- )
12498
- };
12499
- };
12500
- var zodToJsonSchema4 = (schema, options) => {
12501
- var _a21;
12502
- const refs = getRefs3(options);
12503
- let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
12504
- (acc, [name26, schema2]) => {
12505
- var _a26;
12506
- return {
12507
- ...acc,
12508
- [name26]: (_a26 = parseDef3(
12509
- schema2._def,
12510
- {
12511
- ...refs,
12512
- currentPath: [...refs.basePath, refs.definitionPath, name26]
12513
- },
12514
- true
12515
- )) != null ? _a26 : parseAnyDef3()
12516
- };
12517
- },
12518
- {}
12519
- ) : void 0;
12520
- const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
12521
- const main = (_a21 = parseDef3(
12522
- schema._def,
12523
- name21 === void 0 ? refs : {
12524
- ...refs,
12525
- currentPath: [...refs.basePath, refs.definitionPath, name21]
12526
- },
12527
- false
12528
- )) != null ? _a21 : parseAnyDef3();
12529
- const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
12530
- if (title !== void 0) {
12531
- main.title = title;
12532
- }
12533
- const combined = name21 === void 0 ? definitions ? {
12534
- ...main,
12535
- [refs.definitionPath]: definitions
12536
- } : main : {
12537
- $ref: [
12538
- ...refs.$refStrategy === "relative" ? [] : refs.basePath,
12539
- refs.definitionPath,
12540
- name21
12541
- ].join("/"),
12542
- [refs.definitionPath]: {
12543
- ...definitions,
12544
- [name21]: main
12545
- }
12546
- };
12547
- combined.$schema = "http://json-schema.org/draft-07/schema#";
12548
- return combined;
12549
- };
12550
- var zod_to_json_schema_default2 = zodToJsonSchema4;
12551
- function zod3Schema2(zodSchema22, options) {
12552
- var _a21;
12553
- const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
12554
- return jsonSchema3(
12555
- // defer json schema creation to avoid unnecessary computation when only validation is needed
12556
- () => zod_to_json_schema_default2(zodSchema22, {
12557
- $refStrategy: useReferences ? "root" : "none"
12558
- }),
12559
- {
12560
- validate: async (value) => {
12561
- const result = await zodSchema22.safeParseAsync(value);
12562
- return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
12563
- }
12564
- }
12565
- );
12566
- }
12567
- function zod4Schema2(zodSchema22, options) {
12568
- var _a21;
12569
- const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
12570
- return jsonSchema3(
12571
- // defer json schema creation to avoid unnecessary computation when only validation is needed
12572
- () => z104__namespace.toJSONSchema(zodSchema22, {
12573
- target: "draft-7",
12574
- io: "output",
12575
- reused: useReferences ? "ref" : "inline"
12576
- }),
12577
- {
12578
- validate: async (value) => {
12579
- const result = await z104__namespace.safeParseAsync(zodSchema22, value);
12580
- return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
12581
- }
12582
- }
12583
- );
12584
- }
12585
- function isZod4Schema2(zodSchema22) {
12586
- return "_zod" in zodSchema22;
12587
- }
12588
- function zodSchema3(zodSchema22, options) {
12589
- if (isZod4Schema2(zodSchema22)) {
12590
- return zod4Schema2(zodSchema22);
12591
- } else {
12592
- return zod3Schema2(zodSchema22);
12593
- }
12594
- }
12595
- var schemaSymbol3 = Symbol.for("vercel.ai.schema");
12596
- function jsonSchema3(jsonSchema22, {
12597
- validate
12598
- } = {}) {
12599
- return {
12600
- [schemaSymbol3]: true,
12601
- _type: void 0,
12602
- // should never be used directly
12603
- [validatorSymbol3]: true,
12604
- get jsonSchema() {
12605
- if (typeof jsonSchema22 === "function") {
12606
- jsonSchema22 = jsonSchema22();
12607
- }
12608
- return jsonSchema22;
12609
- },
12610
- validate
12611
- };
12612
- }
12613
- function isSchema3(value) {
12614
- return typeof value === "object" && value !== null && schemaSymbol3 in value && value[schemaSymbol3] === true && "jsonSchema" in value && "validate" in value;
12615
- }
12616
- function asSchema3(schema) {
12617
- return schema == null ? jsonSchema3({
12618
- properties: {},
12619
- additionalProperties: false
12620
- }) : isSchema3(schema) ? schema : typeof schema === "function" ? schema() : zodSchema3(schema);
12621
- }
12622
- var __defProp4 = Object.defineProperty;
12623
- var __export4 = (target, all) => {
12624
- for (var name172 in all)
12625
- __defProp4(target, name172, { get: all[name172], enumerable: true });
12626
- };
12627
- var name74 = "AI_NoObjectGeneratedError";
12628
- var marker75 = `vercel.ai.error.${name74}`;
12629
- var symbol75 = Symbol.for(marker75);
12630
- var _a75;
12631
- var NoObjectGeneratedError3 = class extends AISDKError2 {
12632
- constructor({
12633
- message = "No object generated.",
12634
- cause,
12635
- text: text22,
12636
- response,
12637
- usage,
12638
- finishReason
12639
- }) {
12640
- super({ name: name74, message, cause });
12641
- this[_a75] = true;
12642
- this.text = text22;
12643
- this.response = response;
12644
- this.usage = usage;
12645
- this.finishReason = finishReason;
12646
- }
12647
- static isInstance(error) {
12648
- return AISDKError2.hasMarker(error, marker75);
12649
- }
12650
- };
12651
- _a75 = symbol75;
12652
- var dataContentSchema3 = z104__namespace.union([
12653
- z104__namespace.string(),
12654
- z104__namespace.instanceof(Uint8Array),
12655
- z104__namespace.instanceof(ArrayBuffer),
12656
- z104__namespace.custom(
12657
- // Buffer might not be available in some environments such as CloudFlare:
12658
- (value) => {
12659
- var _a172, _b8;
12660
- return (_b8 = (_a172 = globalThis.Buffer) == null ? void 0 : _a172.isBuffer(value)) != null ? _b8 : false;
12661
- },
12662
- { message: "Must be a Buffer" }
12663
- )
12664
- ]);
12665
- var jsonValueSchema3 = z104__namespace.lazy(
12666
- () => z104__namespace.union([
12667
- z104__namespace.null(),
12668
- z104__namespace.string(),
12669
- z104__namespace.number(),
12670
- z104__namespace.boolean(),
12671
- z104__namespace.record(z104__namespace.string(), jsonValueSchema3),
12672
- z104__namespace.array(jsonValueSchema3)
12673
- ])
12674
- );
12675
- var providerMetadataSchema3 = z104__namespace.record(
12676
- z104__namespace.string(),
12677
- z104__namespace.record(z104__namespace.string(), jsonValueSchema3)
12678
- );
12679
- var textPartSchema3 = z104__namespace.object({
12680
- type: z104__namespace.literal("text"),
12681
- text: z104__namespace.string(),
12682
- providerOptions: providerMetadataSchema3.optional()
12683
- });
12684
- var imagePartSchema3 = z104__namespace.object({
12685
- type: z104__namespace.literal("image"),
12686
- image: z104__namespace.union([dataContentSchema3, z104__namespace.instanceof(URL)]),
12687
- mediaType: z104__namespace.string().optional(),
12688
- providerOptions: providerMetadataSchema3.optional()
12689
- });
12690
- var filePartSchema3 = z104__namespace.object({
12691
- type: z104__namespace.literal("file"),
12692
- data: z104__namespace.union([dataContentSchema3, z104__namespace.instanceof(URL)]),
12693
- filename: z104__namespace.string().optional(),
12694
- mediaType: z104__namespace.string(),
12695
- providerOptions: providerMetadataSchema3.optional()
12696
- });
12697
- var reasoningPartSchema3 = z104__namespace.object({
12698
- type: z104__namespace.literal("reasoning"),
12699
- text: z104__namespace.string(),
12700
- providerOptions: providerMetadataSchema3.optional()
12701
- });
12702
- var toolCallPartSchema3 = z104__namespace.object({
12703
- type: z104__namespace.literal("tool-call"),
12704
- toolCallId: z104__namespace.string(),
12705
- toolName: z104__namespace.string(),
12706
- input: z104__namespace.unknown(),
12707
- providerOptions: providerMetadataSchema3.optional(),
12708
- providerExecuted: z104__namespace.boolean().optional()
12709
- });
12710
- var outputSchema2 = z104__namespace.discriminatedUnion("type", [
12711
- z104__namespace.object({
12712
- type: z104__namespace.literal("text"),
12713
- value: z104__namespace.string()
12714
- }),
12715
- z104__namespace.object({
12716
- type: z104__namespace.literal("json"),
12717
- value: jsonValueSchema3
12718
- }),
12719
- z104__namespace.object({
12720
- type: z104__namespace.literal("error-text"),
12721
- value: z104__namespace.string()
12722
- }),
12723
- z104__namespace.object({
12724
- type: z104__namespace.literal("error-json"),
12725
- value: jsonValueSchema3
12726
- }),
12727
- z104__namespace.object({
12728
- type: z104__namespace.literal("content"),
12729
- value: z104__namespace.array(
12730
- z104__namespace.union([
12731
- z104__namespace.object({
12732
- type: z104__namespace.literal("text"),
12733
- text: z104__namespace.string()
12734
- }),
12735
- z104__namespace.object({
12736
- type: z104__namespace.literal("media"),
12737
- data: z104__namespace.string(),
12738
- mediaType: z104__namespace.string()
12739
- })
12740
- ])
12741
- )
12742
- })
12743
- ]);
12744
- var toolResultPartSchema3 = z104__namespace.object({
12745
- type: z104__namespace.literal("tool-result"),
12746
- toolCallId: z104__namespace.string(),
12747
- toolName: z104__namespace.string(),
12748
- output: outputSchema2,
12749
- providerOptions: providerMetadataSchema3.optional()
12750
- });
12751
- var systemModelMessageSchema2 = z104__namespace.object(
12752
- {
12753
- role: z104__namespace.literal("system"),
12754
- content: z104__namespace.string(),
12755
- providerOptions: providerMetadataSchema3.optional()
12756
- }
12757
- );
12758
- var userModelMessageSchema2 = z104__namespace.object({
12759
- role: z104__namespace.literal("user"),
12760
- content: z104__namespace.union([
12761
- z104__namespace.string(),
12762
- z104__namespace.array(z104__namespace.union([textPartSchema3, imagePartSchema3, filePartSchema3]))
12763
- ]),
12764
- providerOptions: providerMetadataSchema3.optional()
12765
- });
12766
- var assistantModelMessageSchema2 = z104__namespace.object({
12767
- role: z104__namespace.literal("assistant"),
12768
- content: z104__namespace.union([
12769
- z104__namespace.string(),
12770
- z104__namespace.array(
12771
- z104__namespace.union([
12772
- textPartSchema3,
12773
- filePartSchema3,
12774
- reasoningPartSchema3,
12775
- toolCallPartSchema3,
12776
- toolResultPartSchema3
12777
- ])
12778
- )
12779
- ]),
12780
- providerOptions: providerMetadataSchema3.optional()
12781
- });
12782
- var toolModelMessageSchema2 = z104__namespace.object({
12783
- role: z104__namespace.literal("tool"),
12784
- content: z104__namespace.array(toolResultPartSchema3),
12785
- providerOptions: providerMetadataSchema3.optional()
12786
- });
12787
- z104__namespace.union([
12788
- systemModelMessageSchema2,
12789
- userModelMessageSchema2,
12790
- assistantModelMessageSchema2,
12791
- toolModelMessageSchema2
12792
- ]);
12793
- function stepCountIs(stepCount) {
12794
- return ({ steps }) => steps.length === stepCount;
12795
- }
12796
- createIdGenerator3({
12797
- prefix: "aitxt",
12798
- size: 24
12799
- });
12800
- function fixJson3(input) {
12801
- const stack = ["ROOT"];
12802
- let lastValidIndex = -1;
12803
- let literalStart = null;
12804
- function processValueStart(char, i, swapState) {
12805
- {
12806
- switch (char) {
12807
- case '"': {
12808
- lastValidIndex = i;
12809
- stack.pop();
12810
- stack.push(swapState);
12811
- stack.push("INSIDE_STRING");
12812
- break;
12813
- }
12814
- case "f":
12815
- case "t":
12816
- case "n": {
12817
- lastValidIndex = i;
12818
- literalStart = i;
12819
- stack.pop();
12820
- stack.push(swapState);
12821
- stack.push("INSIDE_LITERAL");
12822
- break;
12823
- }
12824
- case "-": {
12825
- stack.pop();
12826
- stack.push(swapState);
12827
- stack.push("INSIDE_NUMBER");
12828
- break;
12829
- }
12830
- case "0":
12831
- case "1":
12832
- case "2":
12833
- case "3":
12834
- case "4":
12835
- case "5":
12836
- case "6":
12837
- case "7":
12838
- case "8":
12839
- case "9": {
12840
- lastValidIndex = i;
12841
- stack.pop();
12842
- stack.push(swapState);
12843
- stack.push("INSIDE_NUMBER");
12844
- break;
12845
- }
12846
- case "{": {
12847
- lastValidIndex = i;
12848
- stack.pop();
12849
- stack.push(swapState);
12850
- stack.push("INSIDE_OBJECT_START");
12851
- break;
12852
- }
12853
- case "[": {
12854
- lastValidIndex = i;
12855
- stack.pop();
12856
- stack.push(swapState);
12857
- stack.push("INSIDE_ARRAY_START");
12858
- break;
12859
- }
12860
- }
12861
- }
12862
- }
12863
- function processAfterObjectValue(char, i) {
12864
- switch (char) {
12865
- case ",": {
12866
- stack.pop();
12867
- stack.push("INSIDE_OBJECT_AFTER_COMMA");
12868
- break;
12869
- }
12870
- case "}": {
12871
- lastValidIndex = i;
12872
- stack.pop();
12873
- break;
12874
- }
12875
- }
12876
- }
12877
- function processAfterArrayValue(char, i) {
12878
- switch (char) {
12879
- case ",": {
12880
- stack.pop();
12881
- stack.push("INSIDE_ARRAY_AFTER_COMMA");
12882
- break;
12883
- }
12884
- case "]": {
12885
- lastValidIndex = i;
12886
- stack.pop();
12887
- break;
12888
- }
12889
- }
12890
- }
12891
- for (let i = 0; i < input.length; i++) {
12892
- const char = input[i];
12893
- const currentState = stack[stack.length - 1];
12894
- switch (currentState) {
12895
- case "ROOT":
12896
- processValueStart(char, i, "FINISH");
12897
- break;
12898
- case "INSIDE_OBJECT_START": {
12899
- switch (char) {
12900
- case '"': {
12901
- stack.pop();
12902
- stack.push("INSIDE_OBJECT_KEY");
12903
- break;
12904
- }
12905
- case "}": {
12906
- lastValidIndex = i;
12907
- stack.pop();
12908
- break;
12909
- }
12910
- }
12911
- break;
12912
- }
12913
- case "INSIDE_OBJECT_AFTER_COMMA": {
12914
- switch (char) {
12915
- case '"': {
12916
- stack.pop();
12917
- stack.push("INSIDE_OBJECT_KEY");
12918
- break;
12919
- }
12920
- }
12921
- break;
12922
- }
12923
- case "INSIDE_OBJECT_KEY": {
12924
- switch (char) {
12925
- case '"': {
12926
- stack.pop();
12927
- stack.push("INSIDE_OBJECT_AFTER_KEY");
12928
- break;
12929
- }
12930
- }
12931
- break;
12932
- }
12933
- case "INSIDE_OBJECT_AFTER_KEY": {
12934
- switch (char) {
12935
- case ":": {
12936
- stack.pop();
12937
- stack.push("INSIDE_OBJECT_BEFORE_VALUE");
12938
- break;
12939
- }
12940
- }
12941
- break;
12942
- }
12943
- case "INSIDE_OBJECT_BEFORE_VALUE": {
12944
- processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
12945
- break;
12946
- }
12947
- case "INSIDE_OBJECT_AFTER_VALUE": {
12948
- processAfterObjectValue(char, i);
12949
- break;
12950
- }
12951
- case "INSIDE_STRING": {
12952
- switch (char) {
12953
- case '"': {
12954
- stack.pop();
12955
- lastValidIndex = i;
12956
- break;
12957
- }
12958
- case "\\": {
12959
- stack.push("INSIDE_STRING_ESCAPE");
12960
- break;
12961
- }
12962
- default: {
12963
- lastValidIndex = i;
12964
- }
12965
- }
12966
- break;
12967
- }
12968
- case "INSIDE_ARRAY_START": {
12969
- switch (char) {
12970
- case "]": {
12971
- lastValidIndex = i;
12972
- stack.pop();
12973
- break;
12974
- }
12975
- default: {
12976
- lastValidIndex = i;
12977
- processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
12978
- break;
12979
- }
12980
- }
12981
- break;
12982
- }
12983
- case "INSIDE_ARRAY_AFTER_VALUE": {
12984
- switch (char) {
12985
- case ",": {
12986
- stack.pop();
12987
- stack.push("INSIDE_ARRAY_AFTER_COMMA");
12988
- break;
12989
- }
12990
- case "]": {
12991
- lastValidIndex = i;
12992
- stack.pop();
12993
- break;
12994
- }
12995
- default: {
12996
- lastValidIndex = i;
12997
- break;
12998
- }
12999
- }
13000
- break;
13001
- }
13002
- case "INSIDE_ARRAY_AFTER_COMMA": {
13003
- processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
13004
- break;
13005
- }
13006
- case "INSIDE_STRING_ESCAPE": {
13007
- stack.pop();
13008
- lastValidIndex = i;
13009
- break;
13010
- }
13011
- case "INSIDE_NUMBER": {
13012
- switch (char) {
13013
- case "0":
13014
- case "1":
13015
- case "2":
13016
- case "3":
13017
- case "4":
13018
- case "5":
13019
- case "6":
13020
- case "7":
13021
- case "8":
13022
- case "9": {
13023
- lastValidIndex = i;
13024
- break;
13025
- }
13026
- case "e":
13027
- case "E":
13028
- case "-":
13029
- case ".": {
13030
- break;
13031
- }
13032
- case ",": {
13033
- stack.pop();
13034
- if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
13035
- processAfterArrayValue(char, i);
13036
- }
13037
- if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
13038
- processAfterObjectValue(char, i);
13039
- }
13040
- break;
13041
- }
13042
- case "}": {
13043
- stack.pop();
13044
- if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
13045
- processAfterObjectValue(char, i);
13046
- }
13047
- break;
13048
- }
13049
- case "]": {
13050
- stack.pop();
13051
- if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
13052
- processAfterArrayValue(char, i);
13053
- }
13054
- break;
13055
- }
13056
- default: {
13057
- stack.pop();
13058
- break;
13059
- }
13060
- }
13061
- break;
13062
- }
13063
- case "INSIDE_LITERAL": {
13064
- const partialLiteral = input.substring(literalStart, i + 1);
13065
- if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
13066
- stack.pop();
13067
- if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
13068
- processAfterObjectValue(char, i);
13069
- } else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
13070
- processAfterArrayValue(char, i);
13071
- }
13072
- } else {
13073
- lastValidIndex = i;
13074
- }
13075
- break;
13076
- }
13077
- }
13078
- }
13079
- let result = input.slice(0, lastValidIndex + 1);
13080
- for (let i = stack.length - 1; i >= 0; i--) {
13081
- const state = stack[i];
13082
- switch (state) {
13083
- case "INSIDE_STRING": {
13084
- result += '"';
13085
- break;
13086
- }
13087
- case "INSIDE_OBJECT_KEY":
13088
- case "INSIDE_OBJECT_AFTER_KEY":
13089
- case "INSIDE_OBJECT_AFTER_COMMA":
13090
- case "INSIDE_OBJECT_START":
13091
- case "INSIDE_OBJECT_BEFORE_VALUE":
13092
- case "INSIDE_OBJECT_AFTER_VALUE": {
13093
- result += "}";
13094
- break;
13095
- }
13096
- case "INSIDE_ARRAY_START":
13097
- case "INSIDE_ARRAY_AFTER_COMMA":
13098
- case "INSIDE_ARRAY_AFTER_VALUE": {
13099
- result += "]";
13100
- break;
13101
- }
13102
- case "INSIDE_LITERAL": {
13103
- const partialLiteral = input.substring(literalStart, input.length);
13104
- if ("true".startsWith(partialLiteral)) {
13105
- result += "true".slice(partialLiteral.length);
13106
- } else if ("false".startsWith(partialLiteral)) {
13107
- result += "false".slice(partialLiteral.length);
13108
- } else if ("null".startsWith(partialLiteral)) {
13109
- result += "null".slice(partialLiteral.length);
13110
- }
13111
- }
13112
- }
13113
- }
13114
- return result;
13115
- }
13116
- async function parsePartialJson3(jsonText) {
13117
- if (jsonText === void 0) {
13118
- return { value: void 0, state: "undefined-input" };
13119
- }
13120
- let result = await safeParseJSON3({ text: jsonText });
13121
- if (result.success) {
13122
- return { value: result.value, state: "successful-parse" };
13123
- }
13124
- result = await safeParseJSON3({ text: fixJson3(jsonText) });
13125
- if (result.success) {
13126
- return { value: result.value, state: "repaired-parse" };
13127
- }
13128
- return { value: void 0, state: "failed-parse" };
13129
- }
13130
- createIdGenerator3({
13131
- prefix: "aitxt",
13132
- size: 24
13133
- });
13134
- createIdGenerator3({ prefix: "aiobj", size: 24 });
13135
- createIdGenerator3({ prefix: "aiobj", size: 24 });
13136
- var output_exports3 = {};
13137
- __export4(output_exports3, {
13138
- object: () => object32,
13139
- text: () => text3
13140
- });
13141
- var text3 = () => ({
13142
- type: "text",
13143
- responseFormat: { type: "text" },
13144
- async parsePartial({ text: text22 }) {
13145
- return { partial: text22 };
13146
- },
13147
- async parseOutput({ text: text22 }) {
13148
- return text22;
13149
- }
13150
- });
13151
- var object32 = ({
13152
- schema: inputSchema
13153
- }) => {
13154
- const schema = asSchema3(inputSchema);
13155
- return {
13156
- type: "object",
13157
- responseFormat: {
13158
- type: "json",
13159
- schema: schema.jsonSchema
13160
- },
13161
- async parsePartial({ text: text22 }) {
13162
- const result = await parsePartialJson3(text22);
13163
- switch (result.state) {
13164
- case "failed-parse":
13165
- case "undefined-input":
13166
- return void 0;
13167
- case "repaired-parse":
13168
- case "successful-parse":
13169
- return {
13170
- // Note: currently no validation of partial results:
13171
- partial: result.value
13172
- };
13173
- default: {
13174
- const _exhaustiveCheck = result.state;
13175
- throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);
13176
- }
13177
- }
13178
- },
13179
- async parseOutput({ text: text22 }, context) {
13180
- const parseResult = await safeParseJSON3({ text: text22 });
13181
- if (!parseResult.success) {
13182
- throw new NoObjectGeneratedError3({
13183
- message: "No object generated: could not parse the response.",
13184
- cause: parseResult.error,
13185
- text: text22,
13186
- response: context.response,
13187
- usage: context.usage,
13188
- finishReason: context.finishReason
13189
- });
13190
- }
13191
- const validationResult = await safeValidateTypes3({
13192
- value: parseResult.value,
13193
- schema
13194
- });
13195
- if (!validationResult.success) {
13196
- throw new NoObjectGeneratedError3({
13197
- message: "No object generated: response did not match schema.",
13198
- cause: validationResult.error,
13199
- text: text22,
13200
- response: context.response,
13201
- usage: context.usage,
13202
- finishReason: context.finishReason
13203
- });
13204
- }
13205
- return validationResult.value;
13206
- }
13207
- };
13208
- };
13209
- var ClientOrServerImplementationSchema3 = z104__namespace.looseObject({
13210
- name: z104__namespace.string(),
13211
- version: z104__namespace.string()
13212
- });
13213
- var BaseParamsSchema3 = z104__namespace.looseObject({
13214
- _meta: z104__namespace.optional(z104__namespace.object({}).loose())
13215
- });
13216
- var ResultSchema3 = BaseParamsSchema3;
13217
- var RequestSchema3 = z104__namespace.object({
13218
- method: z104__namespace.string(),
13219
- params: z104__namespace.optional(BaseParamsSchema3)
13220
- });
13221
- var ServerCapabilitiesSchema3 = z104__namespace.looseObject({
13222
- experimental: z104__namespace.optional(z104__namespace.object({}).loose()),
13223
- logging: z104__namespace.optional(z104__namespace.object({}).loose()),
13224
- prompts: z104__namespace.optional(
13225
- z104__namespace.looseObject({
13226
- listChanged: z104__namespace.optional(z104__namespace.boolean())
13227
- })
13228
- ),
13229
- resources: z104__namespace.optional(
13230
- z104__namespace.looseObject({
13231
- subscribe: z104__namespace.optional(z104__namespace.boolean()),
13232
- listChanged: z104__namespace.optional(z104__namespace.boolean())
13233
- })
13234
- ),
13235
- tools: z104__namespace.optional(
13236
- z104__namespace.looseObject({
13237
- listChanged: z104__namespace.optional(z104__namespace.boolean())
13238
- })
13239
- )
13240
- });
13241
- ResultSchema3.extend({
13242
- protocolVersion: z104__namespace.string(),
13243
- capabilities: ServerCapabilitiesSchema3,
13244
- serverInfo: ClientOrServerImplementationSchema3,
13245
- instructions: z104__namespace.optional(z104__namespace.string())
13246
- });
13247
- var PaginatedResultSchema3 = ResultSchema3.extend({
13248
- nextCursor: z104__namespace.optional(z104__namespace.string())
13249
- });
13250
- var ToolSchema3 = z104__namespace.object({
13251
- name: z104__namespace.string(),
13252
- description: z104__namespace.optional(z104__namespace.string()),
13253
- inputSchema: z104__namespace.object({
13254
- type: z104__namespace.literal("object"),
13255
- properties: z104__namespace.optional(z104__namespace.object({}).loose())
13256
- }).loose()
13257
- }).loose();
13258
- PaginatedResultSchema3.extend({
13259
- tools: z104__namespace.array(ToolSchema3)
13260
- });
13261
- var TextContentSchema3 = z104__namespace.object({
13262
- type: z104__namespace.literal("text"),
13263
- text: z104__namespace.string()
13264
- }).loose();
13265
- var ImageContentSchema3 = z104__namespace.object({
13266
- type: z104__namespace.literal("image"),
13267
- data: z104__namespace.base64(),
13268
- mimeType: z104__namespace.string()
13269
- }).loose();
13270
- var ResourceContentsSchema3 = z104__namespace.object({
13271
- /**
13272
- * The URI of this resource.
13273
- */
13274
- uri: z104__namespace.string(),
13275
- /**
13276
- * The MIME type of this resource, if known.
13277
- */
13278
- mimeType: z104__namespace.optional(z104__namespace.string())
13279
- }).loose();
13280
- var TextResourceContentsSchema3 = ResourceContentsSchema3.extend({
13281
- text: z104__namespace.string()
13282
- });
13283
- var BlobResourceContentsSchema3 = ResourceContentsSchema3.extend({
13284
- blob: z104__namespace.base64()
13285
- });
13286
- var EmbeddedResourceSchema3 = z104__namespace.object({
13287
- type: z104__namespace.literal("resource"),
13288
- resource: z104__namespace.union([TextResourceContentsSchema3, BlobResourceContentsSchema3])
13289
- }).loose();
13290
- ResultSchema3.extend({
13291
- content: z104__namespace.array(
13292
- z104__namespace.union([TextContentSchema3, ImageContentSchema3, EmbeddedResourceSchema3])
13293
- ),
13294
- isError: z104__namespace.boolean().default(false).optional()
13295
- }).or(
13296
- ResultSchema3.extend({
13297
- toolResult: z104__namespace.unknown()
13298
- })
13299
- );
13300
- var JSONRPC_VERSION3 = "2.0";
13301
- var JSONRPCRequestSchema3 = z104__namespace.object({
13302
- jsonrpc: z104__namespace.literal(JSONRPC_VERSION3),
13303
- id: z104__namespace.union([z104__namespace.string(), z104__namespace.number().int()])
13304
- }).merge(RequestSchema3).strict();
13305
- var JSONRPCResponseSchema3 = z104__namespace.object({
13306
- jsonrpc: z104__namespace.literal(JSONRPC_VERSION3),
13307
- id: z104__namespace.union([z104__namespace.string(), z104__namespace.number().int()]),
13308
- result: ResultSchema3
13309
- }).strict();
13310
- var JSONRPCErrorSchema3 = z104__namespace.object({
13311
- jsonrpc: z104__namespace.literal(JSONRPC_VERSION3),
13312
- id: z104__namespace.union([z104__namespace.string(), z104__namespace.number().int()]),
13313
- error: z104__namespace.object({
13314
- code: z104__namespace.number().int(),
13315
- message: z104__namespace.string(),
13316
- data: z104__namespace.optional(z104__namespace.unknown())
13317
- })
13318
- }).strict();
13319
- var JSONRPCNotificationSchema3 = z104__namespace.object({
13320
- jsonrpc: z104__namespace.literal(JSONRPC_VERSION3)
13321
- }).merge(
13322
- z104__namespace.object({
13323
- method: z104__namespace.string(),
13324
- params: z104__namespace.optional(BaseParamsSchema3)
13325
- })
13326
- ).strict();
13327
- z104__namespace.union([
13328
- JSONRPCRequestSchema3,
13329
- JSONRPCNotificationSchema3,
13330
- JSONRPCResponseSchema3,
13331
- JSONRPCErrorSchema3
13332
- ]);
13333
-
13334
- // ../agent-builder/dist/index.js
13335
11336
  var UNIT_KINDS = ["mcp-server", "tool", "workflow", "agent", "integration", "network", "other"];
13336
11337
  var TemplateUnitSchema = zod.z.object({
13337
11338
  kind: zod.z.enum(UNIT_KINDS),
@@ -15504,14 +13505,14 @@ export const mastra = new Mastra({
15504
13505
  noEmit: true
15505
13506
  };
15506
13507
  const host = {
15507
- getSourceFile: (name21) => name21 === fileName ? sourceFile : void 0,
13508
+ getSourceFile: (name20) => name20 === fileName ? sourceFile : void 0,
15508
13509
  writeFile: () => {
15509
13510
  },
15510
13511
  getCurrentDirectory: () => "",
15511
13512
  getDirectories: () => [],
15512
- fileExists: (name21) => name21 === fileName,
15513
- readFile: (name21) => name21 === fileName ? fileContent : void 0,
15514
- getCanonicalFileName: (name21) => name21,
13513
+ fileExists: (name20) => name20 === fileName,
13514
+ readFile: (name20) => name20 === fileName ? fileContent : void 0,
13515
+ getCanonicalFileName: (name20) => name20,
15515
13516
  useCaseSensitiveFileNames: () => true,
15516
13517
  getNewLine: () => "\n",
15517
13518
  getDefaultLibFileName: () => "lib.d.ts"
@@ -16893,25 +14894,25 @@ var packageMergeStep = workflows.createStep({
16893
14894
  const tplDevDeps = ensureObj(packageInfo.devDependencies);
16894
14895
  const tplPeerDeps = ensureObj(packageInfo.peerDependencies);
16895
14896
  const tplScripts = ensureObj(packageInfo.scripts);
16896
- const existsAnywhere = (name21) => name21 in targetPkg.dependencies || name21 in targetPkg.devDependencies || name21 in targetPkg.peerDependencies;
16897
- for (const [name21, ver] of Object.entries(tplDeps)) {
16898
- if (!existsAnywhere(name21)) {
16899
- targetPkg.dependencies[name21] = String(ver);
14897
+ const existsAnywhere = (name20) => name20 in targetPkg.dependencies || name20 in targetPkg.devDependencies || name20 in targetPkg.peerDependencies;
14898
+ for (const [name20, ver] of Object.entries(tplDeps)) {
14899
+ if (!existsAnywhere(name20)) {
14900
+ targetPkg.dependencies[name20] = String(ver);
16900
14901
  }
16901
14902
  }
16902
- for (const [name21, ver] of Object.entries(tplDevDeps)) {
16903
- if (!existsAnywhere(name21)) {
16904
- targetPkg.devDependencies[name21] = String(ver);
14903
+ for (const [name20, ver] of Object.entries(tplDevDeps)) {
14904
+ if (!existsAnywhere(name20)) {
14905
+ targetPkg.devDependencies[name20] = String(ver);
16905
14906
  }
16906
14907
  }
16907
- for (const [name21, ver] of Object.entries(tplPeerDeps)) {
16908
- if (!(name21 in targetPkg.peerDependencies)) {
16909
- targetPkg.peerDependencies[name21] = String(ver);
14908
+ for (const [name20, ver] of Object.entries(tplPeerDeps)) {
14909
+ if (!(name20 in targetPkg.peerDependencies)) {
14910
+ targetPkg.peerDependencies[name20] = String(ver);
16910
14911
  }
16911
14912
  }
16912
14913
  const prefix = `template:${slug}:`;
16913
- for (const [name21, cmd] of Object.entries(tplScripts)) {
16914
- const newKey = `${prefix}${name21}`;
14914
+ for (const [name20, cmd] of Object.entries(tplScripts)) {
14915
+ const newKey = `${prefix}${name20}`;
16915
14916
  if (!(newKey in targetPkg.scripts)) {
16916
14917
  targetPkg.scripts[newKey] = String(cmd);
16917
14918
  }
@@ -16996,9 +14997,9 @@ var programmaticFileCopyStep = workflows.createStep({
16996
14997
  return "unknown";
16997
14998
  }
16998
14999
  };
16999
- const convertNaming = (name21, convention) => {
17000
- const baseName = path.basename(name21, path.extname(name21));
17001
- const ext = path.extname(name21);
15000
+ const convertNaming = (name20, convention) => {
15001
+ const baseName = path.basename(name20, path.extname(name20));
15002
+ const ext = path.extname(name20);
17002
15003
  switch (convention) {
17003
15004
  case "camelCase":
17004
15005
  return baseName.replace(/[-_]/g, "").replace(/([A-Z])/g, (match, p1, offset) => offset === 0 ? p1.toLowerCase() : p1) + ext;
@@ -17009,7 +15010,7 @@ var programmaticFileCopyStep = workflows.createStep({
17009
15010
  case "PascalCase":
17010
15011
  return baseName.replace(/[-_]/g, "").replace(/^[a-z]/, (match) => match.toUpperCase()) + ext;
17011
15012
  default:
17012
- return name21;
15013
+ return name20;
17013
15014
  }
17014
15015
  };
17015
15016
  for (const unit of orderedUnits) {
@@ -19512,5 +17513,5 @@ exports.startAsyncAgentBuilderActionHandler = startAsyncAgentBuilderActionHandle
19512
17513
  exports.streamAgentBuilderActionHandler = streamAgentBuilderActionHandler;
19513
17514
  exports.streamVNextAgentBuilderActionHandler = streamVNextAgentBuilderActionHandler;
19514
17515
  exports.watchAgentBuilderActionHandler = watchAgentBuilderActionHandler;
19515
- //# sourceMappingURL=chunk-SBWOUCO3.cjs.map
19516
- //# sourceMappingURL=chunk-SBWOUCO3.cjs.map
17516
+ //# sourceMappingURL=chunk-7HDOBOGG.cjs.map
17517
+ //# sourceMappingURL=chunk-7HDOBOGG.cjs.map