@mastra/server 0.0.0-fix-cloud-peer-deps-20250923194656 → 0.0.0-gl-test-20250917080133

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 (92) hide show
  1. package/CHANGELOG.md +3 -119
  2. package/dist/{chunk-AVEPEUN4.cjs → chunk-3THIIWWW.cjs} +3 -4
  3. package/dist/chunk-3THIIWWW.cjs.map +1 -0
  4. package/dist/{chunk-PUYSH3IL.js → chunk-5QUKZCEF.js} +3 -4
  5. package/dist/chunk-5QUKZCEF.js.map +1 -0
  6. package/dist/{chunk-2WMATOMO.cjs → chunk-5VTTUNVK.cjs} +8 -93
  7. package/dist/chunk-5VTTUNVK.cjs.map +1 -0
  8. package/dist/{chunk-57HWW2TY.cjs → chunk-6LUKYSWE.cjs} +119 -96
  9. package/dist/chunk-6LUKYSWE.cjs.map +1 -0
  10. package/dist/{chunk-IYJW2OVQ.js → chunk-7QEJ5QG5.js} +22 -60
  11. package/dist/chunk-7QEJ5QG5.js.map +1 -0
  12. package/dist/{chunk-X7564COI.js → chunk-7XNKAVVA.js} +2596 -315
  13. package/dist/chunk-7XNKAVVA.js.map +1 -0
  14. package/dist/{chunk-G662L2YZ.js → chunk-B2V3PUB7.js} +116 -93
  15. package/dist/chunk-B2V3PUB7.js.map +1 -0
  16. package/dist/{chunk-2GDLSAVJ.cjs → chunk-GUI3CROV.cjs} +22 -60
  17. package/dist/chunk-GUI3CROV.cjs.map +1 -0
  18. package/dist/chunk-IY34NOLA.cjs +150 -0
  19. package/dist/chunk-IY34NOLA.cjs.map +1 -0
  20. package/dist/{chunk-LJFAAEU7.cjs → chunk-J7BPKKOG.cjs} +4 -8
  21. package/dist/chunk-J7BPKKOG.cjs.map +1 -0
  22. package/dist/{chunk-PLNQ4XER.cjs → chunk-JJBXJYMY.cjs} +2615 -334
  23. package/dist/chunk-JJBXJYMY.cjs.map +1 -0
  24. package/dist/{chunk-5N724Q2T.cjs → chunk-L265APUD.cjs} +3 -43
  25. package/dist/chunk-L265APUD.cjs.map +1 -0
  26. package/dist/{chunk-5KRXONRF.js → chunk-R7NOGUZG.js} +4 -43
  27. package/dist/chunk-R7NOGUZG.js.map +1 -0
  28. package/dist/{chunk-KM7EJKXV.js → chunk-SYRRSBGL.js} +4 -8
  29. package/dist/chunk-SYRRSBGL.js.map +1 -0
  30. package/dist/chunk-U46VIX2V.js +144 -0
  31. package/dist/chunk-U46VIX2V.js.map +1 -0
  32. package/dist/{chunk-BZT5VYDT.js → chunk-ZSAOHEZK.js} +9 -92
  33. package/dist/chunk-ZSAOHEZK.js.map +1 -0
  34. package/dist/server/handlers/a2a.cjs +7 -7
  35. package/dist/server/handlers/a2a.d.ts.map +1 -1
  36. package/dist/server/handlers/a2a.js +1 -1
  37. package/dist/server/handlers/agent-builder.cjs +16 -16
  38. package/dist/server/handlers/agent-builder.d.ts +4 -5
  39. package/dist/server/handlers/agent-builder.d.ts.map +1 -1
  40. package/dist/server/handlers/agent-builder.js +1 -1
  41. package/dist/server/handlers/agents.cjs +15 -23
  42. package/dist/server/handlers/agents.d.ts +4 -46
  43. package/dist/server/handlers/agents.d.ts.map +1 -1
  44. package/dist/server/handlers/agents.js +1 -1
  45. package/dist/server/handlers/network.cjs +24 -0
  46. package/dist/server/handlers/network.cjs.map +1 -0
  47. package/dist/server/handlers/network.d.ts +50 -0
  48. package/dist/server/handlers/network.d.ts.map +1 -0
  49. package/dist/server/handlers/network.js +3 -0
  50. package/dist/server/handlers/network.js.map +1 -0
  51. package/dist/server/handlers/observability.cjs +3 -7
  52. package/dist/server/handlers/observability.d.ts +0 -18
  53. package/dist/server/handlers/observability.d.ts.map +1 -1
  54. package/dist/server/handlers/observability.js +1 -1
  55. package/dist/server/handlers/scores.cjs +7 -7
  56. package/dist/server/handlers/scores.d.ts +6 -208
  57. package/dist/server/handlers/scores.d.ts.map +1 -1
  58. package/dist/server/handlers/scores.js +1 -1
  59. package/dist/server/handlers/tools.cjs +6 -6
  60. package/dist/server/handlers/tools.d.ts.map +1 -1
  61. package/dist/server/handlers/tools.js +1 -1
  62. package/dist/server/handlers/vNextNetwork.d.ts +6 -73
  63. package/dist/server/handlers/vNextNetwork.d.ts.map +1 -1
  64. package/dist/server/handlers/workflows.cjs +16 -24
  65. package/dist/server/handlers/workflows.d.ts +7 -16
  66. package/dist/server/handlers/workflows.d.ts.map +1 -1
  67. package/dist/server/handlers/workflows.js +1 -1
  68. package/dist/server/handlers.cjs +19 -14
  69. package/dist/server/handlers.d.ts +1 -0
  70. package/dist/server/handlers.d.ts.map +1 -1
  71. package/dist/server/handlers.js +8 -7
  72. package/dist/server/utils.d.ts +0 -2
  73. package/dist/server/utils.d.ts.map +1 -1
  74. package/package.json +8 -8
  75. package/dist/chunk-2GDLSAVJ.cjs.map +0 -1
  76. package/dist/chunk-2WMATOMO.cjs.map +0 -1
  77. package/dist/chunk-57HWW2TY.cjs.map +0 -1
  78. package/dist/chunk-5KRXONRF.js.map +0 -1
  79. package/dist/chunk-5N724Q2T.cjs.map +0 -1
  80. package/dist/chunk-AVEPEUN4.cjs.map +0 -1
  81. package/dist/chunk-BZT5VYDT.js.map +0 -1
  82. package/dist/chunk-CNU4A2XU.js +0 -129
  83. package/dist/chunk-CNU4A2XU.js.map +0 -1
  84. package/dist/chunk-G662L2YZ.js.map +0 -1
  85. package/dist/chunk-GDWMF6SB.cjs +0 -133
  86. package/dist/chunk-GDWMF6SB.cjs.map +0 -1
  87. package/dist/chunk-IYJW2OVQ.js.map +0 -1
  88. package/dist/chunk-KM7EJKXV.js.map +0 -1
  89. package/dist/chunk-LJFAAEU7.cjs.map +0 -1
  90. package/dist/chunk-PLNQ4XER.cjs.map +0 -1
  91. package/dist/chunk-PUYSH3IL.js.map +0 -1
  92. package/dist/chunk-X7564COI.js.map +0 -1
@@ -1,5 +1,4 @@
1
- import { getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, createWorkflowRunHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, streamWorkflowHandler, streamVNextWorkflowHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, getWorkflowRunsHandler, cancelWorkflowRunHandler, sendWorkflowRunEventHandler } from './chunk-G662L2YZ.js';
2
- import { WorkflowRegistry, getWorkflowInfo } from './chunk-CNU4A2XU.js';
1
+ import { WorkflowRegistry, getWorkflowInfo, getWorkflowByIdHandler, getWorkflowRunByIdHandler, getWorkflowRunExecutionResultHandler, createWorkflowRunHandler, startAsyncWorkflowHandler, startWorkflowRunHandler, watchWorkflowHandler, streamWorkflowHandler, streamVNextWorkflowHandler, resumeAsyncWorkflowHandler, resumeWorkflowHandler, getWorkflowRunsHandler, cancelWorkflowRunHandler, sendWorkflowRunEventHandler } from './chunk-B2V3PUB7.js';
3
2
  import { openai as openai$1 } from './chunk-4RRMWXQ2.js';
4
3
  import { InvalidArgumentError, esm_default, APICallError, EmptyResponseBodyError, AISDKError as AISDKError$1, JSONParseError, TypeValidationError, EventSourceParserStream, NoSuchModelError } from './chunk-N7F33WAD.js';
5
4
  import { openai } from './chunk-6GMFZ5LK.js';
@@ -147,8 +146,8 @@ var require_ignore = __commonJS({
147
146
  TMP_KEY_IGNORE = Symbol.for("node-ignore");
148
147
  }
149
148
  var KEY_IGNORE = TMP_KEY_IGNORE;
150
- var define = (object3, key, value) => {
151
- Object.defineProperty(object3, key, { value });
149
+ var define = (object4, key, value) => {
150
+ Object.defineProperty(object4, key, { value });
152
151
  return value;
153
152
  };
154
153
  var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
@@ -600,10 +599,10 @@ __export(agent_builder_exports, {
600
599
  streamVNextAgentBuilderActionHandler: () => streamVNextAgentBuilderActionHandler,
601
600
  watchAgentBuilderActionHandler: () => watchAgentBuilderActionHandler
602
601
  });
603
- function zodToJsonSchema(zodSchema3, target = "jsonSchema7", strategy = "relative") {
602
+ function zodToJsonSchema(zodSchema4, target = "jsonSchema7", strategy = "relative") {
604
603
  const fn = "toJSONSchema";
605
604
  if (fn in z) {
606
- return z[fn](zodSchema3, {
605
+ return z[fn](zodSchema4, {
607
606
  unrepresentable: "any",
608
607
  override: (ctx) => {
609
608
  const def = ctx.zodSchema?._zod?.def;
@@ -614,7 +613,7 @@ function zodToJsonSchema(zodSchema3, target = "jsonSchema7", strategy = "relativ
614
613
  }
615
614
  });
616
615
  } else {
617
- return esm_default(zodSchema3, {
616
+ return esm_default(zodSchema4, {
618
617
  $refStrategy: strategy,
619
618
  target
620
619
  });
@@ -1214,8 +1213,8 @@ function formatDataStreamPart(type, value) {
1214
1213
  `;
1215
1214
  }
1216
1215
  function zodSchema(zodSchema22, options) {
1217
- var _a19;
1218
- const useReferences = (_a19 = void 0 ) != null ? _a19 : false;
1216
+ var _a20;
1217
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
1219
1218
  return jsonSchema(
1220
1219
  esm_default(zodSchema22, {
1221
1220
  $refStrategy: useReferences ? "root" : "none",
@@ -1328,11 +1327,11 @@ var major = VERSION.split(".")[0];
1328
1327
  var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
1329
1328
  var _global = _globalThis;
1330
1329
  function registerGlobal(type, instance, diag, allowOverride) {
1331
- var _a19;
1330
+ var _a20;
1332
1331
  if (allowOverride === void 0) {
1333
1332
  allowOverride = false;
1334
1333
  }
1335
- var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a19 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a19 !== void 0 ? _a19 : {
1334
+ var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a20 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a20 !== void 0 ? _a20 : {
1336
1335
  version: VERSION
1337
1336
  };
1338
1337
  if (!allowOverride && api[type]) {
@@ -1350,8 +1349,8 @@ function registerGlobal(type, instance, diag, allowOverride) {
1350
1349
  return true;
1351
1350
  }
1352
1351
  function getGlobal(type) {
1353
- var _a19, _b8;
1354
- var globalVersion = (_a19 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a19 === void 0 ? void 0 : _a19.version;
1352
+ var _a20, _b8;
1353
+ var globalVersion = (_a20 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a20 === void 0 ? void 0 : _a20.version;
1355
1354
  if (!globalVersion || !isCompatible(globalVersion)) {
1356
1355
  return;
1357
1356
  }
@@ -1528,13 +1527,13 @@ var DiagAPI = (
1528
1527
  }
1529
1528
  var self = this;
1530
1529
  var setLogger = function(logger, optionsOrLogLevel) {
1531
- var _a19, _b8, _c;
1530
+ var _a20, _b8, _c;
1532
1531
  if (optionsOrLogLevel === void 0) {
1533
1532
  optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
1534
1533
  }
1535
1534
  if (logger === self) {
1536
1535
  var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
1537
- self.error((_a19 = err.stack) !== null && _a19 !== void 0 ? _a19 : err.message);
1536
+ self.error((_a20 = err.stack) !== null && _a20 !== void 0 ? _a20 : err.message);
1538
1537
  return false;
1539
1538
  }
1540
1539
  if (typeof optionsOrLogLevel === "number") {
@@ -1705,12 +1704,12 @@ var ContextAPI = (
1705
1704
  return this._getContextManager().active();
1706
1705
  };
1707
1706
  ContextAPI2.prototype.with = function(context, fn, thisArg) {
1708
- var _a19;
1707
+ var _a20;
1709
1708
  var args = [];
1710
1709
  for (var _i = 3; _i < arguments.length; _i++) {
1711
1710
  args[_i - 3] = arguments[_i];
1712
1711
  }
1713
- return (_a19 = this._getContextManager()).with.apply(_a19, __spreadArray4([context, fn, thisArg], __read4(args), false));
1712
+ return (_a20 = this._getContextManager()).with.apply(_a20, __spreadArray4([context, fn, thisArg], __read4(args), false));
1714
1713
  };
1715
1714
  ContextAPI2.prototype.bind = function(context, target) {
1716
1715
  return this._getContextManager().bind(context, target);
@@ -1805,8 +1804,8 @@ function setSpanContext(context, spanContext) {
1805
1804
  return setSpan(context, new NonRecordingSpan(spanContext));
1806
1805
  }
1807
1806
  function getSpanContext(context) {
1808
- var _a19;
1809
- return (_a19 = getSpan(context)) === null || _a19 === void 0 ? void 0 : _a19.spanContext();
1807
+ var _a20;
1808
+ return (_a20 = getSpan(context)) === null || _a20 === void 0 ? void 0 : _a20.spanContext();
1810
1809
  }
1811
1810
 
1812
1811
  // ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
@@ -1832,7 +1831,7 @@ var NoopTracer = (
1832
1831
  (function() {
1833
1832
  function NoopTracer2() {
1834
1833
  }
1835
- NoopTracer2.prototype.startSpan = function(name19, options, context) {
1834
+ NoopTracer2.prototype.startSpan = function(name20, options, context) {
1836
1835
  if (context === void 0) {
1837
1836
  context = contextApi.active();
1838
1837
  }
@@ -1847,7 +1846,7 @@ var NoopTracer = (
1847
1846
  return new NonRecordingSpan();
1848
1847
  }
1849
1848
  };
1850
- NoopTracer2.prototype.startActiveSpan = function(name19, arg2, arg3, arg4) {
1849
+ NoopTracer2.prototype.startActiveSpan = function(name20, arg2, arg3, arg4) {
1851
1850
  var opts;
1852
1851
  var ctx;
1853
1852
  var fn;
@@ -1864,7 +1863,7 @@ var NoopTracer = (
1864
1863
  fn = arg4;
1865
1864
  }
1866
1865
  var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
1867
- var span = this.startSpan(name19, opts, parentContext);
1866
+ var span = this.startSpan(name20, opts, parentContext);
1868
1867
  var contextWithSpanSet = setSpan(parentContext, span);
1869
1868
  return contextApi.with(contextWithSpanSet, fn, void 0, span);
1870
1869
  };
@@ -1880,14 +1879,14 @@ var NOOP_TRACER = new NoopTracer();
1880
1879
  var ProxyTracer = (
1881
1880
  /** @class */
1882
1881
  (function() {
1883
- function ProxyTracer2(_provider, name19, version, options) {
1882
+ function ProxyTracer2(_provider, name20, version, options) {
1884
1883
  this._provider = _provider;
1885
- this.name = name19;
1884
+ this.name = name20;
1886
1885
  this.version = version;
1887
1886
  this.options = options;
1888
1887
  }
1889
- ProxyTracer2.prototype.startSpan = function(name19, options, context) {
1890
- return this._getTracer().startSpan(name19, options, context);
1888
+ ProxyTracer2.prototype.startSpan = function(name20, options, context) {
1889
+ return this._getTracer().startSpan(name20, options, context);
1891
1890
  };
1892
1891
  ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
1893
1892
  var tracer = this._getTracer();
@@ -1928,20 +1927,20 @@ var ProxyTracerProvider = (
1928
1927
  (function() {
1929
1928
  function ProxyTracerProvider2() {
1930
1929
  }
1931
- ProxyTracerProvider2.prototype.getTracer = function(name19, version, options) {
1932
- var _a19;
1933
- return (_a19 = this.getDelegateTracer(name19, version, options)) !== null && _a19 !== void 0 ? _a19 : new ProxyTracer(this, name19, version, options);
1930
+ ProxyTracerProvider2.prototype.getTracer = function(name20, version, options) {
1931
+ var _a20;
1932
+ return (_a20 = this.getDelegateTracer(name20, version, options)) !== null && _a20 !== void 0 ? _a20 : new ProxyTracer(this, name20, version, options);
1934
1933
  };
1935
1934
  ProxyTracerProvider2.prototype.getDelegate = function() {
1936
- var _a19;
1937
- return (_a19 = this._delegate) !== null && _a19 !== void 0 ? _a19 : NOOP_TRACER_PROVIDER;
1935
+ var _a20;
1936
+ return (_a20 = this._delegate) !== null && _a20 !== void 0 ? _a20 : NOOP_TRACER_PROVIDER;
1938
1937
  };
1939
1938
  ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
1940
1939
  this._delegate = delegate;
1941
1940
  };
1942
- ProxyTracerProvider2.prototype.getDelegateTracer = function(name19, version, options) {
1943
- var _a19;
1944
- return (_a19 = this._delegate) === null || _a19 === void 0 ? void 0 : _a19.getTracer(name19, version, options);
1941
+ ProxyTracerProvider2.prototype.getDelegateTracer = function(name20, version, options) {
1942
+ var _a20;
1943
+ return (_a20 = this._delegate) === null || _a20 === void 0 ? void 0 : _a20.getTracer(name20, version, options);
1945
1944
  };
1946
1945
  return ProxyTracerProvider2;
1947
1946
  })()
@@ -1987,8 +1986,8 @@ var TraceAPI = (
1987
1986
  TraceAPI2.prototype.getTracerProvider = function() {
1988
1987
  return getGlobal(API_NAME3) || this._proxyTracerProvider;
1989
1988
  };
1990
- TraceAPI2.prototype.getTracer = function(name19, version) {
1991
- return this.getTracerProvider().getTracer(name19, version);
1989
+ TraceAPI2.prototype.getTracer = function(name20, version) {
1990
+ return this.getTracerProvider().getTracer(name20, version);
1992
1991
  };
1993
1992
  TraceAPI2.prototype.disable = function() {
1994
1993
  unregisterGlobal(API_NAME3, DiagAPI.instance());
@@ -3185,11 +3184,11 @@ function extractResponseHeaders(response) {
3185
3184
  return Object.fromEntries([...response.headers]);
3186
3185
  }
3187
3186
  function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
3188
- var _a19, _b8, _c;
3187
+ var _a20, _b8, _c;
3189
3188
  if (globalThisAny.window) {
3190
3189
  return `runtime/browser`;
3191
3190
  }
3192
- if ((_a19 = globalThisAny.navigator) == null ? void 0 : _a19.userAgent) {
3191
+ if ((_a20 = globalThisAny.navigator) == null ? void 0 : _a20.userAgent) {
3193
3192
  return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
3194
3193
  }
3195
3194
  if ((_c = (_b8 = globalThisAny.process) == null ? void 0 : _b8.versions) == null ? void 0 : _c.node) {
@@ -3370,12 +3369,12 @@ function loadOptionalSetting({
3370
3369
  }
3371
3370
  var suspectProtoRx = /"__proto__"\s*:/;
3372
3371
  var suspectConstructorRx = /"constructor"\s*:/;
3373
- function _parse(text3) {
3374
- const obj = JSON.parse(text3);
3372
+ function _parse(text4) {
3373
+ const obj = JSON.parse(text4);
3375
3374
  if (obj === null || typeof obj !== "object") {
3376
3375
  return obj;
3377
3376
  }
3378
- if (suspectProtoRx.test(text3) === false && suspectConstructorRx.test(text3) === false) {
3377
+ if (suspectProtoRx.test(text4) === false && suspectConstructorRx.test(text4) === false) {
3379
3378
  return obj;
3380
3379
  }
3381
3380
  return filter(obj);
@@ -3402,11 +3401,11 @@ function filter(obj) {
3402
3401
  }
3403
3402
  return obj;
3404
3403
  }
3405
- function secureJsonParse(text3) {
3404
+ function secureJsonParse(text4) {
3406
3405
  const { stackTraceLimit } = Error;
3407
3406
  Error.stackTraceLimit = 0;
3408
3407
  try {
3409
- return _parse(text3);
3408
+ return _parse(text4);
3410
3409
  } finally {
3411
3410
  Error.stackTraceLimit = stackTraceLimit;
3412
3411
  }
@@ -3447,12 +3446,12 @@ async function safeValidateTypes2({
3447
3446
  value,
3448
3447
  schema
3449
3448
  }) {
3450
- const validator2 = asValidator(schema);
3449
+ const validator22 = asValidator(schema);
3451
3450
  try {
3452
- if (validator2.validate == null) {
3451
+ if (validator22.validate == null) {
3453
3452
  return { success: true, value, rawValue: value };
3454
3453
  }
3455
- const result = await validator2.validate(value);
3454
+ const result = await validator22.validate(value);
3456
3455
  if (result.success) {
3457
3456
  return { success: true, value: result.value, rawValue: value };
3458
3457
  }
@@ -3470,11 +3469,11 @@ async function safeValidateTypes2({
3470
3469
  }
3471
3470
  }
3472
3471
  async function parseJSON({
3473
- text: text3,
3472
+ text: text4,
3474
3473
  schema
3475
3474
  }) {
3476
3475
  try {
3477
- const value = secureJsonParse(text3);
3476
+ const value = secureJsonParse(text4);
3478
3477
  if (schema == null) {
3479
3478
  return value;
3480
3479
  }
@@ -3483,15 +3482,15 @@ async function parseJSON({
3483
3482
  if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
3484
3483
  throw error;
3485
3484
  }
3486
- throw new JSONParseError({ text: text3, cause: error });
3485
+ throw new JSONParseError({ text: text4, cause: error });
3487
3486
  }
3488
3487
  }
3489
3488
  async function safeParseJSON2({
3490
- text: text3,
3489
+ text: text4,
3491
3490
  schema
3492
3491
  }) {
3493
3492
  try {
3494
- const value = secureJsonParse(text3);
3493
+ const value = secureJsonParse(text4);
3495
3494
  if (schema == null) {
3496
3495
  return { success: true, value, rawValue: value };
3497
3496
  }
@@ -3499,7 +3498,7 @@ async function safeParseJSON2({
3499
3498
  } catch (error) {
3500
3499
  return {
3501
3500
  success: false,
3502
- error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text3, cause: error }),
3501
+ error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
3503
3502
  rawValue: void 0
3504
3503
  };
3505
3504
  }
@@ -3752,11 +3751,11 @@ function parseAnyDef() {
3752
3751
  return {};
3753
3752
  }
3754
3753
  function parseArrayDef(def, refs) {
3755
- var _a19, _b8, _c;
3754
+ var _a20, _b8, _c;
3756
3755
  const res = {
3757
3756
  type: "array"
3758
3757
  };
3759
- if (((_a19 = def.type) == null ? void 0 : _a19._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
3758
+ if (((_a20 = def.type) == null ? void 0 : _a20._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
3760
3759
  res.items = parseDef(def.type._def, {
3761
3760
  ...refs,
3762
3761
  currentPath: [...refs.currentPath, "items"]
@@ -4117,8 +4116,8 @@ function escapeNonAlphaNumeric(source) {
4117
4116
  return result;
4118
4117
  }
4119
4118
  function addFormat(schema, value, message, refs) {
4120
- var _a19;
4121
- if (schema.format || ((_a19 = schema.anyOf) == null ? void 0 : _a19.some((x) => x.format))) {
4119
+ var _a20;
4120
+ if (schema.format || ((_a20 = schema.anyOf) == null ? void 0 : _a20.some((x) => x.format))) {
4122
4121
  if (!schema.anyOf) {
4123
4122
  schema.anyOf = [];
4124
4123
  }
@@ -4137,8 +4136,8 @@ function addFormat(schema, value, message, refs) {
4137
4136
  }
4138
4137
  }
4139
4138
  function addPattern(schema, regex, message, refs) {
4140
- var _a19;
4141
- if (schema.pattern || ((_a19 = schema.allOf) == null ? void 0 : _a19.some((x) => x.pattern))) {
4139
+ var _a20;
4140
+ if (schema.pattern || ((_a20 = schema.allOf) == null ? void 0 : _a20.some((x) => x.pattern))) {
4142
4141
  if (!schema.allOf) {
4143
4142
  schema.allOf = [];
4144
4143
  }
@@ -4157,7 +4156,7 @@ function addPattern(schema, regex, message, refs) {
4157
4156
  }
4158
4157
  }
4159
4158
  function stringifyRegExpWithFlags(regex, refs) {
4160
- var _a19;
4159
+ var _a20;
4161
4160
  if (!refs.applyRegexFlags || !regex.flags) {
4162
4161
  return regex.source;
4163
4162
  }
@@ -4187,7 +4186,7 @@ function stringifyRegExpWithFlags(regex, refs) {
4187
4186
  pattern += source[i];
4188
4187
  pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
4189
4188
  inCharRange = false;
4190
- } else if (source[i + 1] === "-" && ((_a19 = source[i + 2]) == null ? void 0 : _a19.match(/[a-z]/))) {
4189
+ } else if (source[i + 1] === "-" && ((_a20 = source[i + 2]) == null ? void 0 : _a20.match(/[a-z]/))) {
4191
4190
  pattern += source[i];
4192
4191
  inCharRange = true;
4193
4192
  } else {
@@ -4229,13 +4228,13 @@ function stringifyRegExpWithFlags(regex, refs) {
4229
4228
  return pattern;
4230
4229
  }
4231
4230
  function parseRecordDef(def, refs) {
4232
- var _a19, _b8, _c, _d, _e, _f;
4231
+ var _a20, _b8, _c, _d, _e, _f;
4233
4232
  const schema = {
4234
4233
  type: "object",
4235
- additionalProperties: (_a19 = parseDef(def.valueType._def, {
4234
+ additionalProperties: (_a20 = parseDef(def.valueType._def, {
4236
4235
  ...refs,
4237
4236
  currentPath: [...refs.currentPath, "additionalProperties"]
4238
- })) != null ? _a19 : refs.allowedAdditionalProperties
4237
+ })) != null ? _a20 : refs.allowedAdditionalProperties
4239
4238
  };
4240
4239
  if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
4241
4240
  const { type, ...keyType } = parseStringDef(def.keyType._def, refs);
@@ -4286,11 +4285,11 @@ function parseMapDef(def, refs) {
4286
4285
  };
4287
4286
  }
4288
4287
  function parseNativeEnumDef(def) {
4289
- const object3 = def.values;
4288
+ const object4 = def.values;
4290
4289
  const actualKeys = Object.keys(def.values).filter((key) => {
4291
- return typeof object3[object3[key]] !== "number";
4290
+ return typeof object4[object4[key]] !== "number";
4292
4291
  });
4293
- const actualValues = actualKeys.map((key) => object3[key]);
4292
+ const actualValues = actualKeys.map((key) => object4[key]);
4294
4293
  const parsedTypes = Array.from(
4295
4294
  new Set(actualValues.map((values) => typeof values))
4296
4295
  );
@@ -4494,8 +4493,8 @@ function safeIsOptional(schema) {
4494
4493
  }
4495
4494
  }
4496
4495
  var parseOptionalDef = (def, refs) => {
4497
- var _a19;
4498
- if (refs.currentPath.toString() === ((_a19 = refs.propertyPath) == null ? void 0 : _a19.toString())) {
4496
+ var _a20;
4497
+ if (refs.currentPath.toString() === ((_a20 = refs.propertyPath) == null ? void 0 : _a20.toString())) {
4499
4498
  return parseDef(def.innerType._def, refs);
4500
4499
  }
4501
4500
  const innerSchema = parseDef(def.innerType._def, {
@@ -4665,10 +4664,10 @@ var selectParser = (def, typeName, refs) => {
4665
4664
  }
4666
4665
  };
4667
4666
  function parseDef(def, refs, forceResolution = false) {
4668
- var _a19;
4667
+ var _a20;
4669
4668
  const seenItem = refs.seen.get(def);
4670
4669
  if (refs.override) {
4671
- const overrideResult = (_a19 = refs.override) == null ? void 0 : _a19.call(
4670
+ const overrideResult = (_a20 = refs.override) == null ? void 0 : _a20.call(
4672
4671
  refs,
4673
4672
  def,
4674
4673
  refs,
@@ -4734,11 +4733,11 @@ var getRefs = (options) => {
4734
4733
  currentPath,
4735
4734
  propertyPath: void 0,
4736
4735
  seen: new Map(
4737
- Object.entries(_options.definitions).map(([name19, def]) => [
4736
+ Object.entries(_options.definitions).map(([name20, def]) => [
4738
4737
  def._def,
4739
4738
  {
4740
4739
  def: def._def,
4741
- path: [..._options.basePath, _options.definitionPath, name19],
4740
+ path: [..._options.basePath, _options.definitionPath, name20],
4742
4741
  // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
4743
4742
  jsonSchema: void 0
4744
4743
  }
@@ -4747,50 +4746,50 @@ var getRefs = (options) => {
4747
4746
  };
4748
4747
  };
4749
4748
  var zodToJsonSchema2 = (schema, options) => {
4750
- var _a19;
4749
+ var _a20;
4751
4750
  const refs = getRefs(options);
4752
4751
  let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
4753
- (acc, [name24, schema2]) => {
4754
- var _a24;
4752
+ (acc, [name25, schema2]) => {
4753
+ var _a25;
4755
4754
  return {
4756
4755
  ...acc,
4757
- [name24]: (_a24 = parseDef(
4756
+ [name25]: (_a25 = parseDef(
4758
4757
  schema2._def,
4759
4758
  {
4760
4759
  ...refs,
4761
- currentPath: [...refs.basePath, refs.definitionPath, name24]
4760
+ currentPath: [...refs.basePath, refs.definitionPath, name25]
4762
4761
  },
4763
4762
  true
4764
- )) != null ? _a24 : parseAnyDef()
4763
+ )) != null ? _a25 : parseAnyDef()
4765
4764
  };
4766
4765
  },
4767
4766
  {}
4768
4767
  ) : void 0;
4769
- const name19 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
4770
- const main = (_a19 = parseDef(
4768
+ const name20 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
4769
+ const main = (_a20 = parseDef(
4771
4770
  schema._def,
4772
- name19 === void 0 ? refs : {
4771
+ name20 === void 0 ? refs : {
4773
4772
  ...refs,
4774
- currentPath: [...refs.basePath, refs.definitionPath, name19]
4773
+ currentPath: [...refs.basePath, refs.definitionPath, name20]
4775
4774
  },
4776
4775
  false
4777
- )) != null ? _a19 : parseAnyDef();
4776
+ )) != null ? _a20 : parseAnyDef();
4778
4777
  const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
4779
4778
  if (title !== void 0) {
4780
4779
  main.title = title;
4781
4780
  }
4782
- const combined = name19 === void 0 ? definitions ? {
4781
+ const combined = name20 === void 0 ? definitions ? {
4783
4782
  ...main,
4784
4783
  [refs.definitionPath]: definitions
4785
4784
  } : main : {
4786
4785
  $ref: [
4787
4786
  ...refs.$refStrategy === "relative" ? [] : refs.basePath,
4788
4787
  refs.definitionPath,
4789
- name19
4788
+ name20
4790
4789
  ].join("/"),
4791
4790
  [refs.definitionPath]: {
4792
4791
  ...definitions,
4793
- [name19]: main
4792
+ [name20]: main
4794
4793
  }
4795
4794
  };
4796
4795
  combined.$schema = "http://json-schema.org/draft-07/schema#";
@@ -4798,8 +4797,8 @@ var zodToJsonSchema2 = (schema, options) => {
4798
4797
  };
4799
4798
  var zod_to_json_schema_default = zodToJsonSchema2;
4800
4799
  function zod3Schema(zodSchema22, options) {
4801
- var _a19;
4802
- const useReferences = (_a19 = void 0 ) != null ? _a19 : false;
4800
+ var _a20;
4801
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
4803
4802
  return jsonSchema2(
4804
4803
  zod_to_json_schema_default(zodSchema22, {
4805
4804
  $refStrategy: useReferences ? "root" : "none"
@@ -4813,8 +4812,8 @@ function zod3Schema(zodSchema22, options) {
4813
4812
  );
4814
4813
  }
4815
4814
  function zod4Schema(zodSchema22, options) {
4816
- var _a19;
4817
- const useReferences = (_a19 = void 0 ) != null ? _a19 : false;
4815
+ var _a20;
4816
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
4818
4817
  const z4JSONSchema = z42.toJSONSchema(zodSchema22, {
4819
4818
  target: "draft-7",
4820
4819
  io: "output",
@@ -5124,14 +5123,14 @@ var gatewayErrorResponseSchema = z$1.object({
5124
5123
  })
5125
5124
  });
5126
5125
  function asGatewayError(error, authMethod) {
5127
- var _a83;
5126
+ var _a84;
5128
5127
  if (GatewayError.isInstance(error)) {
5129
5128
  return error;
5130
5129
  }
5131
5130
  if (APICallError.isInstance(error)) {
5132
5131
  return createGatewayErrorFromResponse({
5133
5132
  response: extractApiCallResponse(error),
5134
- statusCode: (_a83 = error.statusCode) != null ? _a83 : 500,
5133
+ statusCode: (_a84 = error.statusCode) != null ? _a84 : 500,
5135
5134
  defaultMessage: "Gateway request failed",
5136
5135
  cause: error,
5137
5136
  authMethod
@@ -5382,7 +5381,7 @@ var GatewayEmbeddingModel = class {
5382
5381
  abortSignal,
5383
5382
  providerOptions
5384
5383
  }) {
5385
- var _a83;
5384
+ var _a84;
5386
5385
  const resolvedHeaders = await resolve(this.config.headers());
5387
5386
  try {
5388
5387
  const {
@@ -5413,7 +5412,7 @@ var GatewayEmbeddingModel = class {
5413
5412
  });
5414
5413
  return {
5415
5414
  embeddings: responseBody.embeddings,
5416
- usage: (_a83 = responseBody.usage) != null ? _a83 : void 0,
5415
+ usage: (_a84 = responseBody.usage) != null ? _a84 : void 0,
5417
5416
  providerMetadata: responseBody.providerMetadata,
5418
5417
  response: { headers: responseHeaders, body: rawValue }
5419
5418
  };
@@ -5437,8 +5436,8 @@ var gatewayEmbeddingResponseSchema = z$1.object({
5437
5436
  providerMetadata: z$1.record(z$1.string(), z$1.record(z$1.string(), z$1.unknown())).optional()
5438
5437
  });
5439
5438
  async function getVercelOidcToken() {
5440
- var _a83, _b8;
5441
- const token = (_b8 = (_a83 = getContext().headers) == null ? void 0 : _a83["x-vercel-oidc-token"]) != null ? _b8 : process.env.VERCEL_OIDC_TOKEN;
5439
+ var _a84, _b8;
5440
+ const token = (_b8 = (_a84 = getContext().headers) == null ? void 0 : _a84["x-vercel-oidc-token"]) != null ? _b8 : process.env.VERCEL_OIDC_TOKEN;
5442
5441
  if (!token) {
5443
5442
  throw new GatewayAuthenticationError({
5444
5443
  message: "OIDC token not available",
@@ -5448,21 +5447,21 @@ async function getVercelOidcToken() {
5448
5447
  return token;
5449
5448
  }
5450
5449
  async function getVercelRequestId() {
5451
- var _a83;
5452
- return (_a83 = getContext().headers) == null ? void 0 : _a83["x-vercel-id"];
5450
+ var _a84;
5451
+ return (_a84 = getContext().headers) == null ? void 0 : _a84["x-vercel-id"];
5453
5452
  }
5454
5453
  var SYMBOL_FOR_REQ_CONTEXT = Symbol.for("@vercel/request-context");
5455
5454
  function getContext() {
5456
- var _a83, _b8, _c;
5455
+ var _a84, _b8, _c;
5457
5456
  const fromSymbol = globalThis;
5458
- return (_c = (_b8 = (_a83 = fromSymbol[SYMBOL_FOR_REQ_CONTEXT]) == null ? void 0 : _a83.get) == null ? void 0 : _b8.call(_a83)) != null ? _c : {};
5457
+ return (_c = (_b8 = (_a84 = fromSymbol[SYMBOL_FOR_REQ_CONTEXT]) == null ? void 0 : _a84.get) == null ? void 0 : _b8.call(_a84)) != null ? _c : {};
5459
5458
  }
5460
5459
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
5461
5460
  function createGatewayProvider(options = {}) {
5462
- var _a83, _b8;
5461
+ var _a84, _b8;
5463
5462
  let pendingMetadata = null;
5464
5463
  let metadataCache = null;
5465
- const cacheRefreshMillis = (_a83 = options.metadataCacheRefreshMillis) != null ? _a83 : 1e3 * 60 * 5;
5464
+ const cacheRefreshMillis = (_a84 = options.metadataCacheRefreshMillis) != null ? _a84 : 1e3 * 60 * 5;
5466
5465
  let lastFetchTime = 0;
5467
5466
  const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/v1/ai";
5468
5467
  const getHeaders = async () => {
@@ -5514,8 +5513,8 @@ function createGatewayProvider(options = {}) {
5514
5513
  });
5515
5514
  };
5516
5515
  const getAvailableModels = async () => {
5517
- var _a93, _b9, _c;
5518
- const now = (_c = (_b9 = (_a93 = options._internal) == null ? void 0 : _a93.currentDate) == null ? void 0 : _b9.call(_a93).getTime()) != null ? _c : Date.now();
5516
+ var _a94, _b9, _c;
5517
+ const now = (_c = (_b9 = (_a94 = options._internal) == null ? void 0 : _a94.currentDate) == null ? void 0 : _b9.call(_a94).getTime()) != null ? _c : Date.now();
5519
5518
  if (!pendingMetadata || now - lastFetchTime > cacheRefreshMillis) {
5520
5519
  lastFetchTime = now;
5521
5520
  pendingMetadata = new GatewayFetchMetadata({
@@ -6125,9 +6124,6 @@ function prepareRetries2({
6125
6124
  })
6126
6125
  };
6127
6126
  }
6128
- function stepCountIs(stepCount) {
6129
- return ({ steps }) => steps.length === stepCount;
6130
- }
6131
6127
  var VERSION3 = "5.0.44" ;
6132
6128
  createIdGenerator2({
6133
6129
  prefix: "aitxt",
@@ -7845,50 +7841,50 @@ function isValidWithSchema(schema, value) {
7845
7841
  return schema.safeParse(value).success;
7846
7842
  }
7847
7843
  var NotHandler = class {
7848
- apply(zodSchema3, schema) {
7849
- if (!schema.not) return zodSchema3;
7844
+ apply(zodSchema4, schema) {
7845
+ if (!schema.not) return zodSchema4;
7850
7846
  const notSchema = convertJsonSchemaToZod(schema.not);
7851
- return zodSchema3.refine(
7847
+ return zodSchema4.refine(
7852
7848
  (value) => !isValidWithSchema(notSchema, value),
7853
7849
  { message: "Value must not match the 'not' schema" }
7854
7850
  );
7855
7851
  }
7856
7852
  };
7857
7853
  var UniqueItemsHandler = class {
7858
- apply(zodSchema3, schema) {
7854
+ apply(zodSchema4, schema) {
7859
7855
  const arraySchema = schema;
7860
- if (arraySchema.uniqueItems !== true) return zodSchema3;
7861
- return zodSchema3.refine(createUniqueItemsValidator(), {
7856
+ if (arraySchema.uniqueItems !== true) return zodSchema4;
7857
+ return zodSchema4.refine(createUniqueItemsValidator(), {
7862
7858
  message: "Array items must be unique"
7863
7859
  });
7864
7860
  }
7865
7861
  };
7866
7862
  var AllOfHandler = class {
7867
- apply(zodSchema3, schema) {
7868
- if (!schema.allOf || schema.allOf.length === 0) return zodSchema3;
7863
+ apply(zodSchema4, schema) {
7864
+ if (!schema.allOf || schema.allOf.length === 0) return zodSchema4;
7869
7865
  const allOfSchemas = schema.allOf.map((s) => convertJsonSchemaToZod(s));
7870
7866
  return allOfSchemas.reduce(
7871
7867
  (acc, s) => z$1.intersection(acc, s),
7872
- zodSchema3
7868
+ zodSchema4
7873
7869
  );
7874
7870
  }
7875
7871
  };
7876
7872
  var AnyOfHandler = class {
7877
- apply(zodSchema3, schema) {
7878
- if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema3;
7873
+ apply(zodSchema4, schema) {
7874
+ if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema4;
7879
7875
  const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z$1.union([
7880
7876
  convertJsonSchemaToZod(schema.anyOf[0]),
7881
7877
  convertJsonSchemaToZod(schema.anyOf[1]),
7882
7878
  ...schema.anyOf.slice(2).map((s) => convertJsonSchemaToZod(s))
7883
7879
  ]);
7884
- return z$1.intersection(zodSchema3, anyOfSchema);
7880
+ return z$1.intersection(zodSchema4, anyOfSchema);
7885
7881
  }
7886
7882
  };
7887
7883
  var OneOfHandler = class {
7888
- apply(zodSchema3, schema) {
7889
- if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema3;
7884
+ apply(zodSchema4, schema) {
7885
+ if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema4;
7890
7886
  const oneOfSchemas = schema.oneOf.map((s) => convertJsonSchemaToZod(s));
7891
- return zodSchema3.refine(
7887
+ return zodSchema4.refine(
7892
7888
  (value) => {
7893
7889
  let validCount = 0;
7894
7890
  for (const oneOfSchema of oneOfSchemas) {
@@ -7905,12 +7901,12 @@ var OneOfHandler = class {
7905
7901
  }
7906
7902
  };
7907
7903
  var PrefixItemsHandler = class {
7908
- apply(zodSchema3, schema) {
7904
+ apply(zodSchema4, schema) {
7909
7905
  const arraySchema = schema;
7910
7906
  if (arraySchema.prefixItems && Array.isArray(arraySchema.prefixItems)) {
7911
7907
  const prefixItems = arraySchema.prefixItems;
7912
7908
  const prefixSchemas = prefixItems.map((itemSchema) => convertJsonSchemaToZod(itemSchema));
7913
- return zodSchema3.refine(
7909
+ return zodSchema4.refine(
7914
7910
  (value) => {
7915
7911
  if (!Array.isArray(value)) return true;
7916
7912
  for (let i = 0; i < Math.min(value.length, prefixSchemas.length); i++) {
@@ -7935,16 +7931,16 @@ var PrefixItemsHandler = class {
7935
7931
  { message: "Array does not match prefixItems schema" }
7936
7932
  );
7937
7933
  }
7938
- return zodSchema3;
7934
+ return zodSchema4;
7939
7935
  }
7940
7936
  };
7941
7937
  var ObjectPropertiesHandler = class {
7942
- apply(zodSchema3, schema) {
7938
+ apply(zodSchema4, schema) {
7943
7939
  const objectSchema = schema;
7944
7940
  if (!objectSchema.properties && !objectSchema.required && objectSchema.additionalProperties !== false) {
7945
- return zodSchema3;
7941
+ return zodSchema4;
7946
7942
  }
7947
- if (zodSchema3 instanceof z$1.ZodObject || zodSchema3 instanceof z$1.ZodRecord) {
7943
+ if (zodSchema4 instanceof z$1.ZodObject || zodSchema4 instanceof z$1.ZodRecord) {
7948
7944
  const shape = {};
7949
7945
  if (objectSchema.properties) {
7950
7946
  for (const [key, propSchema] of Object.entries(objectSchema.properties)) {
@@ -7971,7 +7967,7 @@ var ObjectPropertiesHandler = class {
7971
7967
  return z$1.object(shape).passthrough();
7972
7968
  }
7973
7969
  }
7974
- return zodSchema3.refine(
7970
+ return zodSchema4.refine(
7975
7971
  (value) => {
7976
7972
  if (typeof value !== "object" || value === null || Array.isArray(value)) {
7977
7973
  return true;
@@ -8013,13 +8009,13 @@ var ObjectPropertiesHandler = class {
8013
8009
  }
8014
8010
  };
8015
8011
  var EnumComplexHandler = class {
8016
- apply(zodSchema3, schema) {
8017
- if (!schema.enum || schema.enum.length === 0) return zodSchema3;
8012
+ apply(zodSchema4, schema) {
8013
+ if (!schema.enum || schema.enum.length === 0) return zodSchema4;
8018
8014
  const complexValues = schema.enum.filter(
8019
8015
  (v) => Array.isArray(v) || typeof v === "object" && v !== null
8020
8016
  );
8021
- if (complexValues.length === 0) return zodSchema3;
8022
- return zodSchema3.refine(
8017
+ if (complexValues.length === 0) return zodSchema4;
8018
+ return zodSchema4.refine(
8023
8019
  (value) => {
8024
8020
  if (typeof value !== "object" || value === null) return true;
8025
8021
  return complexValues.some(
@@ -8031,32 +8027,32 @@ var EnumComplexHandler = class {
8031
8027
  }
8032
8028
  };
8033
8029
  var ConstComplexHandler = class {
8034
- apply(zodSchema3, schema) {
8035
- if (schema.const === void 0) return zodSchema3;
8030
+ apply(zodSchema4, schema) {
8031
+ if (schema.const === void 0) return zodSchema4;
8036
8032
  const constValue = schema.const;
8037
8033
  if (typeof constValue !== "object" || constValue === null) {
8038
- return zodSchema3;
8034
+ return zodSchema4;
8039
8035
  }
8040
- return zodSchema3.refine(
8036
+ return zodSchema4.refine(
8041
8037
  (value) => deepEqual(value, constValue),
8042
8038
  { message: "Value must equal the const value" }
8043
8039
  );
8044
8040
  }
8045
8041
  };
8046
8042
  var MetadataHandler = class {
8047
- apply(zodSchema3, schema) {
8043
+ apply(zodSchema4, schema) {
8048
8044
  if (schema.description) {
8049
- zodSchema3 = zodSchema3.describe(schema.description);
8045
+ zodSchema4 = zodSchema4.describe(schema.description);
8050
8046
  }
8051
- return zodSchema3;
8047
+ return zodSchema4;
8052
8048
  }
8053
8049
  };
8054
8050
  var ProtoRequiredHandler = class {
8055
- apply(zodSchema3, schema) {
8056
- var _a19;
8051
+ apply(zodSchema4, schema) {
8052
+ var _a20;
8057
8053
  const objectSchema = schema;
8058
- if (!((_a19 = objectSchema.required) == null ? void 0 : _a19.includes("__proto__")) || schema.type !== void 0) {
8059
- return zodSchema3;
8054
+ if (!((_a20 = objectSchema.required) == null ? void 0 : _a20.includes("__proto__")) || schema.type !== void 0) {
8055
+ return zodSchema4;
8060
8056
  }
8061
8057
  return z$1.any().refine(
8062
8058
  (value) => this.validateRequired(value, objectSchema.required),
@@ -8073,14 +8069,14 @@ var ProtoRequiredHandler = class {
8073
8069
  }
8074
8070
  };
8075
8071
  var ContainsHandler = class {
8076
- apply(zodSchema3, schema) {
8077
- var _a19;
8072
+ apply(zodSchema4, schema) {
8073
+ var _a20;
8078
8074
  const arraySchema = schema;
8079
- if (arraySchema.contains === void 0) return zodSchema3;
8075
+ if (arraySchema.contains === void 0) return zodSchema4;
8080
8076
  const containsSchema = convertJsonSchemaToZod(arraySchema.contains);
8081
- const minContains = (_a19 = arraySchema.minContains) != null ? _a19 : 1;
8077
+ const minContains = (_a20 = arraySchema.minContains) != null ? _a20 : 1;
8082
8078
  const maxContains = arraySchema.maxContains;
8083
- return zodSchema3.refine(
8079
+ return zodSchema4.refine(
8084
8080
  (value) => {
8085
8081
  if (!Array.isArray(value)) {
8086
8082
  return true;
@@ -8189,32 +8185,32 @@ function convertJsonSchemaToZod(schema) {
8189
8185
  allowedSchemas.push(objectSchema);
8190
8186
  }
8191
8187
  }
8192
- let zodSchema3;
8188
+ let zodSchema4;
8193
8189
  if (allowedSchemas.length === 0) {
8194
- zodSchema3 = z$1.never();
8190
+ zodSchema4 = z$1.never();
8195
8191
  } else if (allowedSchemas.length === 1) {
8196
- zodSchema3 = allowedSchemas[0];
8192
+ zodSchema4 = allowedSchemas[0];
8197
8193
  } else {
8198
8194
  const hasConstraints = Object.keys(schema).some(
8199
8195
  (key) => key !== "$schema" && key !== "title" && key !== "description"
8200
8196
  );
8201
8197
  if (!hasConstraints) {
8202
- zodSchema3 = z$1.any();
8198
+ zodSchema4 = z$1.any();
8203
8199
  } else {
8204
- zodSchema3 = z$1.union(allowedSchemas);
8200
+ zodSchema4 = z$1.union(allowedSchemas);
8205
8201
  }
8206
8202
  }
8207
8203
  for (const handler of refinementHandlers) {
8208
- zodSchema3 = handler.apply(zodSchema3, schema);
8204
+ zodSchema4 = handler.apply(zodSchema4, schema);
8209
8205
  }
8210
- return zodSchema3;
8206
+ return zodSchema4;
8211
8207
  }
8212
8208
  function convertJsonSchemaToZod2(schema) {
8213
- function addMetadata(zodSchema3, jsonSchema3) {
8214
- if (jsonSchema3.description) {
8215
- zodSchema3 = zodSchema3.describe(jsonSchema3.description);
8209
+ function addMetadata(zodSchema4, jsonSchema4) {
8210
+ if (jsonSchema4.description) {
8211
+ zodSchema4 = zodSchema4.describe(jsonSchema4.description);
8216
8212
  }
8217
- return zodSchema3;
8213
+ return zodSchema4;
8218
8214
  }
8219
8215
  if (schema.const !== void 0) {
8220
8216
  if (typeof schema.const === "string") {
@@ -8320,13 +8316,13 @@ function convertJsonSchemaToZod2(schema) {
8320
8316
  shape[key] = shape[key].optional();
8321
8317
  }
8322
8318
  }
8323
- let zodSchema3;
8319
+ let zodSchema4;
8324
8320
  if (schema.additionalProperties !== false) {
8325
- zodSchema3 = z.object(shape).passthrough();
8321
+ zodSchema4 = z.object(shape).passthrough();
8326
8322
  } else {
8327
- zodSchema3 = z.object(shape);
8323
+ zodSchema4 = z.object(shape);
8328
8324
  }
8329
- return addMetadata(zodSchema3, schema);
8325
+ return addMetadata(zodSchema4, schema);
8330
8326
  }
8331
8327
  return addMetadata(z.object({}), schema);
8332
8328
  case "array": {
@@ -8603,7 +8599,7 @@ var Memory = class extends MastraMemory {
8603
8599
  const resourceScope = typeof config?.semanticRecall === "object" && config?.semanticRecall?.scope === `resource`;
8604
8600
  if (config?.semanticRecall && selectBy?.vectorSearchString && this.vector) {
8605
8601
  const { embeddings, dimension } = await this.embedMessageContent(selectBy.vectorSearchString);
8606
- const { indexName } = await this.createEmbeddingIndex(dimension, config);
8602
+ const { indexName } = await this.createEmbeddingIndex(dimension);
8607
8603
  await Promise.all(
8608
8604
  embeddings.map(async (embedding) => {
8609
8605
  if (typeof this.vector === `undefined`) {
@@ -8866,11 +8862,11 @@ ${workingMemory}`;
8866
8862
  release();
8867
8863
  }
8868
8864
  }
8869
- chunkText(text3, tokenSize = 4096) {
8865
+ chunkText(text4, tokenSize = 4096) {
8870
8866
  const charSize = tokenSize * CHARS_PER_TOKEN;
8871
8867
  const chunks = [];
8872
8868
  let currentChunk = "";
8873
- const words = text3.split(/\s+/);
8869
+ const words = text4.split(/\s+/);
8874
8870
  for (const word of words) {
8875
8871
  const wordWithSpace = currentChunk ? " " + word : word;
8876
8872
  if (currentChunk.length + wordWithSpace.length > charSize) {
@@ -8957,7 +8953,7 @@ ${workingMemory}`;
8957
8953
  if (!textForEmbedding) return;
8958
8954
  const { embeddings, chunks, dimension } = await this.embedMessageContent(textForEmbedding);
8959
8955
  if (typeof indexName === `undefined`) {
8960
- indexName = this.createEmbeddingIndex(dimension, config).then((result2) => result2.indexName);
8956
+ indexName = this.createEmbeddingIndex(dimension).then((result2) => result2.indexName);
8961
8957
  }
8962
8958
  if (typeof this.vector === `undefined`) {
8963
8959
  throw new Error(
@@ -9032,10 +9028,10 @@ ${workingMemory}`;
9032
9028
  }
9033
9029
  return newMessage;
9034
9030
  }
9035
- parseWorkingMemory(text3) {
9031
+ parseWorkingMemory(text4) {
9036
9032
  if (!this.threadConfig.workingMemory?.enabled) return null;
9037
9033
  const workingMemoryRegex = /<working_memory>([^]*?)<\/working_memory>/g;
9038
- const matches = text3.match(workingMemoryRegex);
9034
+ const matches = text4.match(workingMemoryRegex);
9039
9035
  const match = matches?.[0];
9040
9036
  if (match) {
9041
9037
  return match.replace(/<\/?working_memory>/g, "").trim();
@@ -9335,12 +9331,12 @@ var _Tiktoken = class {
9335
9331
  this.textMap.set(rank, bytes);
9336
9332
  }
9337
9333
  this.specialTokens = { ...ranks.special_tokens, ...extendedSpecialTokens };
9338
- this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [text3, rank]) => {
9339
- memo[rank] = this.textEncoder.encode(text3);
9334
+ this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [text4, rank]) => {
9335
+ memo[rank] = this.textEncoder.encode(text4);
9340
9336
  return memo;
9341
9337
  }, {});
9342
9338
  }
9343
- encode(text3, allowedSpecial = [], disallowedSpecial = "all") {
9339
+ encode(text4, allowedSpecial = [], disallowedSpecial = "all") {
9344
9340
  const regexes = new RegExp(this.patStr, "ug");
9345
9341
  const specialRegex = _Tiktoken.specialTokenRegex(
9346
9342
  Object.keys(this.specialTokens)
@@ -9358,7 +9354,7 @@ var _Tiktoken = class {
9358
9354
  const disallowedSpecialRegex = _Tiktoken.specialTokenRegex([
9359
9355
  ...disallowedSpecialSet
9360
9356
  ]);
9361
- const specialMatch = text3.match(disallowedSpecialRegex);
9357
+ const specialMatch = text4.match(disallowedSpecialRegex);
9362
9358
  if (specialMatch != null) {
9363
9359
  throw new Error(
9364
9360
  `The text contains a special token that is not allowed: ${specialMatch[0]}`
@@ -9371,13 +9367,13 @@ var _Tiktoken = class {
9371
9367
  let startFind = start;
9372
9368
  while (true) {
9373
9369
  specialRegex.lastIndex = startFind;
9374
- nextSpecial = specialRegex.exec(text3);
9370
+ nextSpecial = specialRegex.exec(text4);
9375
9371
  if (nextSpecial == null || allowedSpecialSet.has(nextSpecial[0]))
9376
9372
  break;
9377
9373
  startFind = nextSpecial.index + 1;
9378
9374
  }
9379
- const end = nextSpecial?.index ?? text3.length;
9380
- for (const match of text3.substring(start, end).matchAll(regexes)) {
9375
+ const end = nextSpecial?.index ?? text4.length;
9376
+ for (const match of text4.substring(start, end).matchAll(regexes)) {
9381
9377
  const piece = this.textEncoder.encode(match[0]);
9382
9378
  const token2 = this.rankMap.get(piece.join(","));
9383
9379
  if (token2 != null) {
@@ -9515,16 +9511,2295 @@ var TokenLimiter = class extends MemoryProcessor {
9515
9511
  }
9516
9512
  }
9517
9513
  }
9518
- if (typeof message.content === `string` || // if the message included non-tool parts, add our message overhead
9519
- message.content.some((p) => p.type !== `tool-call` && p.type !== `tool-result`)) {
9520
- overhead += this.TOKENS_PER_MESSAGE;
9521
- }
9522
- return this.encoder.encode(tokenString).length + overhead;
9523
- }
9514
+ if (typeof message.content === `string` || // if the message included non-tool parts, add our message overhead
9515
+ message.content.some((p) => p.type !== `tool-call` && p.type !== `tool-result`)) {
9516
+ overhead += this.TOKENS_PER_MESSAGE;
9517
+ }
9518
+ return this.encoder.encode(tokenString).length + overhead;
9519
+ }
9520
+ };
9521
+
9522
+ // ../agent-builder/dist/index.js
9523
+ var import_ignore = __toESM(require_ignore(), 1);
9524
+ var createIdGenerator3 = ({
9525
+ prefix,
9526
+ size = 16,
9527
+ alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
9528
+ separator = "-"
9529
+ } = {}) => {
9530
+ const generator = () => {
9531
+ const alphabetLength = alphabet.length;
9532
+ const chars = new Array(size);
9533
+ for (let i = 0; i < size; i++) {
9534
+ chars[i] = alphabet[Math.random() * alphabetLength | 0];
9535
+ }
9536
+ return chars.join("");
9537
+ };
9538
+ if (prefix == null) {
9539
+ return generator;
9540
+ }
9541
+ if (alphabet.includes(separator)) {
9542
+ throw new InvalidArgumentError({
9543
+ argument: "separator",
9544
+ message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
9545
+ });
9546
+ }
9547
+ return () => `${prefix}${separator}${generator()}`;
9548
+ };
9549
+ createIdGenerator3();
9550
+ var suspectProtoRx2 = /"__proto__"\s*:/;
9551
+ var suspectConstructorRx2 = /"constructor"\s*:/;
9552
+ function _parse2(text4) {
9553
+ const obj = JSON.parse(text4);
9554
+ if (obj === null || typeof obj !== "object") {
9555
+ return obj;
9556
+ }
9557
+ if (suspectProtoRx2.test(text4) === false && suspectConstructorRx2.test(text4) === false) {
9558
+ return obj;
9559
+ }
9560
+ return filter2(obj);
9561
+ }
9562
+ function filter2(obj) {
9563
+ let next = [obj];
9564
+ while (next.length) {
9565
+ const nodes = next;
9566
+ next = [];
9567
+ for (const node of nodes) {
9568
+ if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
9569
+ throw new SyntaxError("Object contains forbidden prototype property");
9570
+ }
9571
+ if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
9572
+ throw new SyntaxError("Object contains forbidden prototype property");
9573
+ }
9574
+ for (const key in node) {
9575
+ const value = node[key];
9576
+ if (value && typeof value === "object") {
9577
+ next.push(value);
9578
+ }
9579
+ }
9580
+ }
9581
+ }
9582
+ return obj;
9583
+ }
9584
+ function secureJsonParse2(text4) {
9585
+ const { stackTraceLimit } = Error;
9586
+ Error.stackTraceLimit = 0;
9587
+ try {
9588
+ return _parse2(text4);
9589
+ } finally {
9590
+ Error.stackTraceLimit = stackTraceLimit;
9591
+ }
9592
+ }
9593
+ var validatorSymbol3 = Symbol.for("vercel.ai.validator");
9594
+ function validator2(validate) {
9595
+ return { [validatorSymbol3]: true, validate };
9596
+ }
9597
+ function isValidator2(value) {
9598
+ return typeof value === "object" && value !== null && validatorSymbol3 in value && value[validatorSymbol3] === true && "validate" in value;
9599
+ }
9600
+ function asValidator2(value) {
9601
+ return isValidator2(value) ? value : standardSchemaValidator2(value);
9602
+ }
9603
+ function standardSchemaValidator2(standardSchema) {
9604
+ return validator2(async (value) => {
9605
+ const result = await standardSchema["~standard"].validate(value);
9606
+ return result.issues == null ? { success: true, value: result.value } : {
9607
+ success: false,
9608
+ error: new TypeValidationError({
9609
+ value,
9610
+ cause: result.issues
9611
+ })
9612
+ };
9613
+ });
9614
+ }
9615
+ async function safeValidateTypes3({
9616
+ value,
9617
+ schema
9618
+ }) {
9619
+ const validator22 = asValidator2(schema);
9620
+ try {
9621
+ if (validator22.validate == null) {
9622
+ return { success: true, value, rawValue: value };
9623
+ }
9624
+ const result = await validator22.validate(value);
9625
+ if (result.success) {
9626
+ return { success: true, value: result.value, rawValue: value };
9627
+ }
9628
+ return {
9629
+ success: false,
9630
+ error: TypeValidationError.wrap({ value, cause: result.error }),
9631
+ rawValue: value
9632
+ };
9633
+ } catch (error) {
9634
+ return {
9635
+ success: false,
9636
+ error: TypeValidationError.wrap({ value, cause: error }),
9637
+ rawValue: value
9638
+ };
9639
+ }
9640
+ }
9641
+ async function safeParseJSON3({
9642
+ text: text4,
9643
+ schema
9644
+ }) {
9645
+ try {
9646
+ const value = secureJsonParse2(text4);
9647
+ if (schema == null) {
9648
+ return { success: true, value, rawValue: value };
9649
+ }
9650
+ return await safeValidateTypes3({ value, schema });
9651
+ } catch (error) {
9652
+ return {
9653
+ success: false,
9654
+ error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
9655
+ rawValue: void 0
9656
+ };
9657
+ }
9658
+ }
9659
+ var getRelativePath2 = (pathA, pathB) => {
9660
+ let i = 0;
9661
+ for (; i < pathA.length && i < pathB.length; i++) {
9662
+ if (pathA[i] !== pathB[i])
9663
+ break;
9664
+ }
9665
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
9666
+ };
9667
+ var ignoreOverride2 = Symbol(
9668
+ "Let zodToJsonSchema decide on which parser to use"
9669
+ );
9670
+ var defaultOptions2 = {
9671
+ name: void 0,
9672
+ $refStrategy: "root",
9673
+ basePath: ["#"],
9674
+ effectStrategy: "input",
9675
+ pipeStrategy: "all",
9676
+ dateStrategy: "format:date-time",
9677
+ mapStrategy: "entries",
9678
+ removeAdditionalStrategy: "passthrough",
9679
+ allowedAdditionalProperties: true,
9680
+ rejectedAdditionalProperties: false,
9681
+ definitionPath: "definitions",
9682
+ strictUnions: false,
9683
+ definitions: {},
9684
+ errorMessages: false,
9685
+ patternStrategy: "escape",
9686
+ applyRegexFlags: false,
9687
+ emailStrategy: "format:email",
9688
+ base64Strategy: "contentEncoding:base64",
9689
+ nameStrategy: "ref"
9690
+ };
9691
+ var getDefaultOptions2 = (options) => typeof options === "string" ? {
9692
+ ...defaultOptions2,
9693
+ name: options
9694
+ } : {
9695
+ ...defaultOptions2,
9696
+ ...options
9697
+ };
9698
+ function parseAnyDef2() {
9699
+ return {};
9700
+ }
9701
+ function parseArrayDef2(def, refs) {
9702
+ var _a20, _b8, _c;
9703
+ const res = {
9704
+ type: "array"
9705
+ };
9706
+ if (((_a20 = def.type) == null ? void 0 : _a20._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== ZodFirstPartyTypeKind.ZodAny) {
9707
+ res.items = parseDef2(def.type._def, {
9708
+ ...refs,
9709
+ currentPath: [...refs.currentPath, "items"]
9710
+ });
9711
+ }
9712
+ if (def.minLength) {
9713
+ res.minItems = def.minLength.value;
9714
+ }
9715
+ if (def.maxLength) {
9716
+ res.maxItems = def.maxLength.value;
9717
+ }
9718
+ if (def.exactLength) {
9719
+ res.minItems = def.exactLength.value;
9720
+ res.maxItems = def.exactLength.value;
9721
+ }
9722
+ return res;
9723
+ }
9724
+ function parseBigintDef2(def) {
9725
+ const res = {
9726
+ type: "integer",
9727
+ format: "int64"
9728
+ };
9729
+ if (!def.checks)
9730
+ return res;
9731
+ for (const check of def.checks) {
9732
+ switch (check.kind) {
9733
+ case "min":
9734
+ if (check.inclusive) {
9735
+ res.minimum = check.value;
9736
+ } else {
9737
+ res.exclusiveMinimum = check.value;
9738
+ }
9739
+ break;
9740
+ case "max":
9741
+ if (check.inclusive) {
9742
+ res.maximum = check.value;
9743
+ } else {
9744
+ res.exclusiveMaximum = check.value;
9745
+ }
9746
+ break;
9747
+ case "multipleOf":
9748
+ res.multipleOf = check.value;
9749
+ break;
9750
+ }
9751
+ }
9752
+ return res;
9753
+ }
9754
+ function parseBooleanDef2() {
9755
+ return { type: "boolean" };
9756
+ }
9757
+ function parseBrandedDef2(_def, refs) {
9758
+ return parseDef2(_def.type._def, refs);
9759
+ }
9760
+ var parseCatchDef2 = (def, refs) => {
9761
+ return parseDef2(def.innerType._def, refs);
9762
+ };
9763
+ function parseDateDef2(def, refs, overrideDateStrategy) {
9764
+ const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
9765
+ if (Array.isArray(strategy)) {
9766
+ return {
9767
+ anyOf: strategy.map((item, i) => parseDateDef2(def, refs, item))
9768
+ };
9769
+ }
9770
+ switch (strategy) {
9771
+ case "string":
9772
+ case "format:date-time":
9773
+ return {
9774
+ type: "string",
9775
+ format: "date-time"
9776
+ };
9777
+ case "format:date":
9778
+ return {
9779
+ type: "string",
9780
+ format: "date"
9781
+ };
9782
+ case "integer":
9783
+ return integerDateParser2(def);
9784
+ }
9785
+ }
9786
+ var integerDateParser2 = (def) => {
9787
+ const res = {
9788
+ type: "integer",
9789
+ format: "unix-time"
9790
+ };
9791
+ for (const check of def.checks) {
9792
+ switch (check.kind) {
9793
+ case "min":
9794
+ res.minimum = check.value;
9795
+ break;
9796
+ case "max":
9797
+ res.maximum = check.value;
9798
+ break;
9799
+ }
9800
+ }
9801
+ return res;
9802
+ };
9803
+ function parseDefaultDef2(_def, refs) {
9804
+ return {
9805
+ ...parseDef2(_def.innerType._def, refs),
9806
+ default: _def.defaultValue()
9807
+ };
9808
+ }
9809
+ function parseEffectsDef2(_def, refs) {
9810
+ return refs.effectStrategy === "input" ? parseDef2(_def.schema._def, refs) : parseAnyDef2();
9811
+ }
9812
+ function parseEnumDef2(def) {
9813
+ return {
9814
+ type: "string",
9815
+ enum: Array.from(def.values)
9816
+ };
9817
+ }
9818
+ var isJsonSchema7AllOfType2 = (type) => {
9819
+ if ("type" in type && type.type === "string")
9820
+ return false;
9821
+ return "allOf" in type;
9822
+ };
9823
+ function parseIntersectionDef2(def, refs) {
9824
+ const allOf = [
9825
+ parseDef2(def.left._def, {
9826
+ ...refs,
9827
+ currentPath: [...refs.currentPath, "allOf", "0"]
9828
+ }),
9829
+ parseDef2(def.right._def, {
9830
+ ...refs,
9831
+ currentPath: [...refs.currentPath, "allOf", "1"]
9832
+ })
9833
+ ].filter((x) => !!x);
9834
+ const mergedAllOf = [];
9835
+ allOf.forEach((schema) => {
9836
+ if (isJsonSchema7AllOfType2(schema)) {
9837
+ mergedAllOf.push(...schema.allOf);
9838
+ } else {
9839
+ let nestedSchema = schema;
9840
+ if ("additionalProperties" in schema && schema.additionalProperties === false) {
9841
+ const { additionalProperties, ...rest } = schema;
9842
+ nestedSchema = rest;
9843
+ }
9844
+ mergedAllOf.push(nestedSchema);
9845
+ }
9846
+ });
9847
+ return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
9848
+ }
9849
+ function parseLiteralDef2(def) {
9850
+ const parsedType = typeof def.value;
9851
+ if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
9852
+ return {
9853
+ type: Array.isArray(def.value) ? "array" : "object"
9854
+ };
9855
+ }
9856
+ return {
9857
+ type: parsedType === "bigint" ? "integer" : parsedType,
9858
+ const: def.value
9859
+ };
9860
+ }
9861
+ var emojiRegex2 = void 0;
9862
+ var zodPatterns2 = {
9863
+ /**
9864
+ * `c` was changed to `[cC]` to replicate /i flag
9865
+ */
9866
+ cuid: /^[cC][^\s-]{8,}$/,
9867
+ cuid2: /^[0-9a-z]+$/,
9868
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
9869
+ /**
9870
+ * `a-z` was added to replicate /i flag
9871
+ */
9872
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
9873
+ /**
9874
+ * Constructed a valid Unicode RegExp
9875
+ *
9876
+ * Lazily instantiate since this type of regex isn't supported
9877
+ * in all envs (e.g. React Native).
9878
+ *
9879
+ * See:
9880
+ * https://github.com/colinhacks/zod/issues/2433
9881
+ * Fix in Zod:
9882
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
9883
+ */
9884
+ emoji: () => {
9885
+ if (emojiRegex2 === void 0) {
9886
+ emojiRegex2 = RegExp(
9887
+ "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
9888
+ "u"
9889
+ );
9890
+ }
9891
+ return emojiRegex2;
9892
+ },
9893
+ /**
9894
+ * Unused
9895
+ */
9896
+ 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}$/,
9897
+ /**
9898
+ * Unused
9899
+ */
9900
+ 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])$/,
9901
+ 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])$/,
9902
+ /**
9903
+ * Unused
9904
+ */
9905
+ 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})))$/,
9906
+ 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])$/,
9907
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
9908
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
9909
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
9910
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
9911
+ };
9912
+ function parseStringDef2(def, refs) {
9913
+ const res = {
9914
+ type: "string"
9915
+ };
9916
+ if (def.checks) {
9917
+ for (const check of def.checks) {
9918
+ switch (check.kind) {
9919
+ case "min":
9920
+ res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
9921
+ break;
9922
+ case "max":
9923
+ res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
9924
+ break;
9925
+ case "email":
9926
+ switch (refs.emailStrategy) {
9927
+ case "format:email":
9928
+ addFormat2(res, "email", check.message, refs);
9929
+ break;
9930
+ case "format:idn-email":
9931
+ addFormat2(res, "idn-email", check.message, refs);
9932
+ break;
9933
+ case "pattern:zod":
9934
+ addPattern2(res, zodPatterns2.email, check.message, refs);
9935
+ break;
9936
+ }
9937
+ break;
9938
+ case "url":
9939
+ addFormat2(res, "uri", check.message, refs);
9940
+ break;
9941
+ case "uuid":
9942
+ addFormat2(res, "uuid", check.message, refs);
9943
+ break;
9944
+ case "regex":
9945
+ addPattern2(res, check.regex, check.message, refs);
9946
+ break;
9947
+ case "cuid":
9948
+ addPattern2(res, zodPatterns2.cuid, check.message, refs);
9949
+ break;
9950
+ case "cuid2":
9951
+ addPattern2(res, zodPatterns2.cuid2, check.message, refs);
9952
+ break;
9953
+ case "startsWith":
9954
+ addPattern2(
9955
+ res,
9956
+ RegExp(`^${escapeLiteralCheckValue2(check.value, refs)}`),
9957
+ check.message,
9958
+ refs
9959
+ );
9960
+ break;
9961
+ case "endsWith":
9962
+ addPattern2(
9963
+ res,
9964
+ RegExp(`${escapeLiteralCheckValue2(check.value, refs)}$`),
9965
+ check.message,
9966
+ refs
9967
+ );
9968
+ break;
9969
+ case "datetime":
9970
+ addFormat2(res, "date-time", check.message, refs);
9971
+ break;
9972
+ case "date":
9973
+ addFormat2(res, "date", check.message, refs);
9974
+ break;
9975
+ case "time":
9976
+ addFormat2(res, "time", check.message, refs);
9977
+ break;
9978
+ case "duration":
9979
+ addFormat2(res, "duration", check.message, refs);
9980
+ break;
9981
+ case "length":
9982
+ res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
9983
+ res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
9984
+ break;
9985
+ case "includes": {
9986
+ addPattern2(
9987
+ res,
9988
+ RegExp(escapeLiteralCheckValue2(check.value, refs)),
9989
+ check.message,
9990
+ refs
9991
+ );
9992
+ break;
9993
+ }
9994
+ case "ip": {
9995
+ if (check.version !== "v6") {
9996
+ addFormat2(res, "ipv4", check.message, refs);
9997
+ }
9998
+ if (check.version !== "v4") {
9999
+ addFormat2(res, "ipv6", check.message, refs);
10000
+ }
10001
+ break;
10002
+ }
10003
+ case "base64url":
10004
+ addPattern2(res, zodPatterns2.base64url, check.message, refs);
10005
+ break;
10006
+ case "jwt":
10007
+ addPattern2(res, zodPatterns2.jwt, check.message, refs);
10008
+ break;
10009
+ case "cidr": {
10010
+ if (check.version !== "v6") {
10011
+ addPattern2(res, zodPatterns2.ipv4Cidr, check.message, refs);
10012
+ }
10013
+ if (check.version !== "v4") {
10014
+ addPattern2(res, zodPatterns2.ipv6Cidr, check.message, refs);
10015
+ }
10016
+ break;
10017
+ }
10018
+ case "emoji":
10019
+ addPattern2(res, zodPatterns2.emoji(), check.message, refs);
10020
+ break;
10021
+ case "ulid": {
10022
+ addPattern2(res, zodPatterns2.ulid, check.message, refs);
10023
+ break;
10024
+ }
10025
+ case "base64": {
10026
+ switch (refs.base64Strategy) {
10027
+ case "format:binary": {
10028
+ addFormat2(res, "binary", check.message, refs);
10029
+ break;
10030
+ }
10031
+ case "contentEncoding:base64": {
10032
+ res.contentEncoding = "base64";
10033
+ break;
10034
+ }
10035
+ case "pattern:zod": {
10036
+ addPattern2(res, zodPatterns2.base64, check.message, refs);
10037
+ break;
10038
+ }
10039
+ }
10040
+ break;
10041
+ }
10042
+ case "nanoid": {
10043
+ addPattern2(res, zodPatterns2.nanoid, check.message, refs);
10044
+ }
10045
+ }
10046
+ }
10047
+ }
10048
+ return res;
10049
+ }
10050
+ function escapeLiteralCheckValue2(literal, refs) {
10051
+ return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric2(literal) : literal;
10052
+ }
10053
+ var ALPHA_NUMERIC2 = new Set(
10054
+ "ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
10055
+ );
10056
+ function escapeNonAlphaNumeric2(source) {
10057
+ let result = "";
10058
+ for (let i = 0; i < source.length; i++) {
10059
+ if (!ALPHA_NUMERIC2.has(source[i])) {
10060
+ result += "\\";
10061
+ }
10062
+ result += source[i];
10063
+ }
10064
+ return result;
10065
+ }
10066
+ function addFormat2(schema, value, message, refs) {
10067
+ var _a20;
10068
+ if (schema.format || ((_a20 = schema.anyOf) == null ? void 0 : _a20.some((x) => x.format))) {
10069
+ if (!schema.anyOf) {
10070
+ schema.anyOf = [];
10071
+ }
10072
+ if (schema.format) {
10073
+ schema.anyOf.push({
10074
+ format: schema.format
10075
+ });
10076
+ delete schema.format;
10077
+ }
10078
+ schema.anyOf.push({
10079
+ format: value,
10080
+ ...message && refs.errorMessages && { errorMessage: { format: message } }
10081
+ });
10082
+ } else {
10083
+ schema.format = value;
10084
+ }
10085
+ }
10086
+ function addPattern2(schema, regex, message, refs) {
10087
+ var _a20;
10088
+ if (schema.pattern || ((_a20 = schema.allOf) == null ? void 0 : _a20.some((x) => x.pattern))) {
10089
+ if (!schema.allOf) {
10090
+ schema.allOf = [];
10091
+ }
10092
+ if (schema.pattern) {
10093
+ schema.allOf.push({
10094
+ pattern: schema.pattern
10095
+ });
10096
+ delete schema.pattern;
10097
+ }
10098
+ schema.allOf.push({
10099
+ pattern: stringifyRegExpWithFlags2(regex, refs),
10100
+ ...message && refs.errorMessages && { errorMessage: { pattern: message } }
10101
+ });
10102
+ } else {
10103
+ schema.pattern = stringifyRegExpWithFlags2(regex, refs);
10104
+ }
10105
+ }
10106
+ function stringifyRegExpWithFlags2(regex, refs) {
10107
+ var _a20;
10108
+ if (!refs.applyRegexFlags || !regex.flags) {
10109
+ return regex.source;
10110
+ }
10111
+ const flags = {
10112
+ i: regex.flags.includes("i"),
10113
+ // Case-insensitive
10114
+ m: regex.flags.includes("m"),
10115
+ // `^` and `$` matches adjacent to newline characters
10116
+ s: regex.flags.includes("s")
10117
+ // `.` matches newlines
10118
+ };
10119
+ const source = flags.i ? regex.source.toLowerCase() : regex.source;
10120
+ let pattern = "";
10121
+ let isEscaped = false;
10122
+ let inCharGroup = false;
10123
+ let inCharRange = false;
10124
+ for (let i = 0; i < source.length; i++) {
10125
+ if (isEscaped) {
10126
+ pattern += source[i];
10127
+ isEscaped = false;
10128
+ continue;
10129
+ }
10130
+ if (flags.i) {
10131
+ if (inCharGroup) {
10132
+ if (source[i].match(/[a-z]/)) {
10133
+ if (inCharRange) {
10134
+ pattern += source[i];
10135
+ pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
10136
+ inCharRange = false;
10137
+ } else if (source[i + 1] === "-" && ((_a20 = source[i + 2]) == null ? void 0 : _a20.match(/[a-z]/))) {
10138
+ pattern += source[i];
10139
+ inCharRange = true;
10140
+ } else {
10141
+ pattern += `${source[i]}${source[i].toUpperCase()}`;
10142
+ }
10143
+ continue;
10144
+ }
10145
+ } else if (source[i].match(/[a-z]/)) {
10146
+ pattern += `[${source[i]}${source[i].toUpperCase()}]`;
10147
+ continue;
10148
+ }
10149
+ }
10150
+ if (flags.m) {
10151
+ if (source[i] === "^") {
10152
+ pattern += `(^|(?<=[\r
10153
+ ]))`;
10154
+ continue;
10155
+ } else if (source[i] === "$") {
10156
+ pattern += `($|(?=[\r
10157
+ ]))`;
10158
+ continue;
10159
+ }
10160
+ }
10161
+ if (flags.s && source[i] === ".") {
10162
+ pattern += inCharGroup ? `${source[i]}\r
10163
+ ` : `[${source[i]}\r
10164
+ ]`;
10165
+ continue;
10166
+ }
10167
+ pattern += source[i];
10168
+ if (source[i] === "\\") {
10169
+ isEscaped = true;
10170
+ } else if (inCharGroup && source[i] === "]") {
10171
+ inCharGroup = false;
10172
+ } else if (!inCharGroup && source[i] === "[") {
10173
+ inCharGroup = true;
10174
+ }
10175
+ }
10176
+ return pattern;
10177
+ }
10178
+ function parseRecordDef2(def, refs) {
10179
+ var _a20, _b8, _c, _d, _e, _f;
10180
+ const schema = {
10181
+ type: "object",
10182
+ additionalProperties: (_a20 = parseDef2(def.valueType._def, {
10183
+ ...refs,
10184
+ currentPath: [...refs.currentPath, "additionalProperties"]
10185
+ })) != null ? _a20 : refs.allowedAdditionalProperties
10186
+ };
10187
+ if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
10188
+ const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
10189
+ return {
10190
+ ...schema,
10191
+ propertyNames: keyType
10192
+ };
10193
+ } else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === ZodFirstPartyTypeKind.ZodEnum) {
10194
+ return {
10195
+ ...schema,
10196
+ propertyNames: {
10197
+ enum: def.keyType._def.values
10198
+ }
10199
+ };
10200
+ } else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
10201
+ const { type, ...keyType } = parseBrandedDef2(
10202
+ def.keyType._def,
10203
+ refs
10204
+ );
10205
+ return {
10206
+ ...schema,
10207
+ propertyNames: keyType
10208
+ };
10209
+ }
10210
+ return schema;
10211
+ }
10212
+ function parseMapDef2(def, refs) {
10213
+ if (refs.mapStrategy === "record") {
10214
+ return parseRecordDef2(def, refs);
10215
+ }
10216
+ const keys = parseDef2(def.keyType._def, {
10217
+ ...refs,
10218
+ currentPath: [...refs.currentPath, "items", "items", "0"]
10219
+ }) || parseAnyDef2();
10220
+ const values = parseDef2(def.valueType._def, {
10221
+ ...refs,
10222
+ currentPath: [...refs.currentPath, "items", "items", "1"]
10223
+ }) || parseAnyDef2();
10224
+ return {
10225
+ type: "array",
10226
+ maxItems: 125,
10227
+ items: {
10228
+ type: "array",
10229
+ items: [keys, values],
10230
+ minItems: 2,
10231
+ maxItems: 2
10232
+ }
10233
+ };
10234
+ }
10235
+ function parseNativeEnumDef2(def) {
10236
+ const object4 = def.values;
10237
+ const actualKeys = Object.keys(def.values).filter((key) => {
10238
+ return typeof object4[object4[key]] !== "number";
10239
+ });
10240
+ const actualValues = actualKeys.map((key) => object4[key]);
10241
+ const parsedTypes = Array.from(
10242
+ new Set(actualValues.map((values) => typeof values))
10243
+ );
10244
+ return {
10245
+ type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
10246
+ enum: actualValues
10247
+ };
10248
+ }
10249
+ function parseNeverDef2() {
10250
+ return { not: parseAnyDef2() };
10251
+ }
10252
+ function parseNullDef2() {
10253
+ return {
10254
+ type: "null"
10255
+ };
10256
+ }
10257
+ var primitiveMappings2 = {
10258
+ ZodString: "string",
10259
+ ZodNumber: "number",
10260
+ ZodBigInt: "integer",
10261
+ ZodBoolean: "boolean",
10262
+ ZodNull: "null"
10263
+ };
10264
+ function parseUnionDef2(def, refs) {
10265
+ const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
10266
+ if (options.every(
10267
+ (x) => x._def.typeName in primitiveMappings2 && (!x._def.checks || !x._def.checks.length)
10268
+ )) {
10269
+ const types = options.reduce((types2, x) => {
10270
+ const type = primitiveMappings2[x._def.typeName];
10271
+ return type && !types2.includes(type) ? [...types2, type] : types2;
10272
+ }, []);
10273
+ return {
10274
+ type: types.length > 1 ? types : types[0]
10275
+ };
10276
+ } else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
10277
+ const types = options.reduce(
10278
+ (acc, x) => {
10279
+ const type = typeof x._def.value;
10280
+ switch (type) {
10281
+ case "string":
10282
+ case "number":
10283
+ case "boolean":
10284
+ return [...acc, type];
10285
+ case "bigint":
10286
+ return [...acc, "integer"];
10287
+ case "object":
10288
+ if (x._def.value === null)
10289
+ return [...acc, "null"];
10290
+ case "symbol":
10291
+ case "undefined":
10292
+ case "function":
10293
+ default:
10294
+ return acc;
10295
+ }
10296
+ },
10297
+ []
10298
+ );
10299
+ if (types.length === options.length) {
10300
+ const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
10301
+ return {
10302
+ type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
10303
+ enum: options.reduce(
10304
+ (acc, x) => {
10305
+ return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
10306
+ },
10307
+ []
10308
+ )
10309
+ };
10310
+ }
10311
+ } else if (options.every((x) => x._def.typeName === "ZodEnum")) {
10312
+ return {
10313
+ type: "string",
10314
+ enum: options.reduce(
10315
+ (acc, x) => [
10316
+ ...acc,
10317
+ ...x._def.values.filter((x2) => !acc.includes(x2))
10318
+ ],
10319
+ []
10320
+ )
10321
+ };
10322
+ }
10323
+ return asAnyOf2(def, refs);
10324
+ }
10325
+ var asAnyOf2 = (def, refs) => {
10326
+ const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
10327
+ (x, i) => parseDef2(x._def, {
10328
+ ...refs,
10329
+ currentPath: [...refs.currentPath, "anyOf", `${i}`]
10330
+ })
10331
+ ).filter(
10332
+ (x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
10333
+ );
10334
+ return anyOf.length ? { anyOf } : void 0;
10335
+ };
10336
+ function parseNullableDef2(def, refs) {
10337
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
10338
+ def.innerType._def.typeName
10339
+ ) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
10340
+ return {
10341
+ type: [
10342
+ primitiveMappings2[def.innerType._def.typeName],
10343
+ "null"
10344
+ ]
10345
+ };
10346
+ }
10347
+ const base = parseDef2(def.innerType._def, {
10348
+ ...refs,
10349
+ currentPath: [...refs.currentPath, "anyOf", "0"]
10350
+ });
10351
+ return base && { anyOf: [base, { type: "null" }] };
10352
+ }
10353
+ function parseNumberDef2(def) {
10354
+ const res = {
10355
+ type: "number"
10356
+ };
10357
+ if (!def.checks)
10358
+ return res;
10359
+ for (const check of def.checks) {
10360
+ switch (check.kind) {
10361
+ case "int":
10362
+ res.type = "integer";
10363
+ break;
10364
+ case "min":
10365
+ if (check.inclusive) {
10366
+ res.minimum = check.value;
10367
+ } else {
10368
+ res.exclusiveMinimum = check.value;
10369
+ }
10370
+ break;
10371
+ case "max":
10372
+ if (check.inclusive) {
10373
+ res.maximum = check.value;
10374
+ } else {
10375
+ res.exclusiveMaximum = check.value;
10376
+ }
10377
+ break;
10378
+ case "multipleOf":
10379
+ res.multipleOf = check.value;
10380
+ break;
10381
+ }
10382
+ }
10383
+ return res;
10384
+ }
10385
+ function parseObjectDef2(def, refs) {
10386
+ const result = {
10387
+ type: "object",
10388
+ properties: {}
10389
+ };
10390
+ const required = [];
10391
+ const shape = def.shape();
10392
+ for (const propName in shape) {
10393
+ let propDef = shape[propName];
10394
+ if (propDef === void 0 || propDef._def === void 0) {
10395
+ continue;
10396
+ }
10397
+ const propOptional = safeIsOptional2(propDef);
10398
+ const parsedDef = parseDef2(propDef._def, {
10399
+ ...refs,
10400
+ currentPath: [...refs.currentPath, "properties", propName],
10401
+ propertyPath: [...refs.currentPath, "properties", propName]
10402
+ });
10403
+ if (parsedDef === void 0) {
10404
+ continue;
10405
+ }
10406
+ result.properties[propName] = parsedDef;
10407
+ if (!propOptional) {
10408
+ required.push(propName);
10409
+ }
10410
+ }
10411
+ if (required.length) {
10412
+ result.required = required;
10413
+ }
10414
+ const additionalProperties = decideAdditionalProperties2(def, refs);
10415
+ if (additionalProperties !== void 0) {
10416
+ result.additionalProperties = additionalProperties;
10417
+ }
10418
+ return result;
10419
+ }
10420
+ function decideAdditionalProperties2(def, refs) {
10421
+ if (def.catchall._def.typeName !== "ZodNever") {
10422
+ return parseDef2(def.catchall._def, {
10423
+ ...refs,
10424
+ currentPath: [...refs.currentPath, "additionalProperties"]
10425
+ });
10426
+ }
10427
+ switch (def.unknownKeys) {
10428
+ case "passthrough":
10429
+ return refs.allowedAdditionalProperties;
10430
+ case "strict":
10431
+ return refs.rejectedAdditionalProperties;
10432
+ case "strip":
10433
+ return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
10434
+ }
10435
+ }
10436
+ function safeIsOptional2(schema) {
10437
+ try {
10438
+ return schema.isOptional();
10439
+ } catch (e2) {
10440
+ return true;
10441
+ }
10442
+ }
10443
+ var parseOptionalDef2 = (def, refs) => {
10444
+ var _a20;
10445
+ if (refs.currentPath.toString() === ((_a20 = refs.propertyPath) == null ? void 0 : _a20.toString())) {
10446
+ return parseDef2(def.innerType._def, refs);
10447
+ }
10448
+ const innerSchema = parseDef2(def.innerType._def, {
10449
+ ...refs,
10450
+ currentPath: [...refs.currentPath, "anyOf", "1"]
10451
+ });
10452
+ return innerSchema ? { anyOf: [{ not: parseAnyDef2() }, innerSchema] } : parseAnyDef2();
10453
+ };
10454
+ var parsePipelineDef2 = (def, refs) => {
10455
+ if (refs.pipeStrategy === "input") {
10456
+ return parseDef2(def.in._def, refs);
10457
+ } else if (refs.pipeStrategy === "output") {
10458
+ return parseDef2(def.out._def, refs);
10459
+ }
10460
+ const a = parseDef2(def.in._def, {
10461
+ ...refs,
10462
+ currentPath: [...refs.currentPath, "allOf", "0"]
10463
+ });
10464
+ const b = parseDef2(def.out._def, {
10465
+ ...refs,
10466
+ currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
10467
+ });
10468
+ return {
10469
+ allOf: [a, b].filter((x) => x !== void 0)
10470
+ };
10471
+ };
10472
+ function parsePromiseDef2(def, refs) {
10473
+ return parseDef2(def.type._def, refs);
10474
+ }
10475
+ function parseSetDef2(def, refs) {
10476
+ const items = parseDef2(def.valueType._def, {
10477
+ ...refs,
10478
+ currentPath: [...refs.currentPath, "items"]
10479
+ });
10480
+ const schema = {
10481
+ type: "array",
10482
+ uniqueItems: true,
10483
+ items
10484
+ };
10485
+ if (def.minSize) {
10486
+ schema.minItems = def.minSize.value;
10487
+ }
10488
+ if (def.maxSize) {
10489
+ schema.maxItems = def.maxSize.value;
10490
+ }
10491
+ return schema;
10492
+ }
10493
+ function parseTupleDef2(def, refs) {
10494
+ if (def.rest) {
10495
+ return {
10496
+ type: "array",
10497
+ minItems: def.items.length,
10498
+ items: def.items.map(
10499
+ (x, i) => parseDef2(x._def, {
10500
+ ...refs,
10501
+ currentPath: [...refs.currentPath, "items", `${i}`]
10502
+ })
10503
+ ).reduce(
10504
+ (acc, x) => x === void 0 ? acc : [...acc, x],
10505
+ []
10506
+ ),
10507
+ additionalItems: parseDef2(def.rest._def, {
10508
+ ...refs,
10509
+ currentPath: [...refs.currentPath, "additionalItems"]
10510
+ })
10511
+ };
10512
+ } else {
10513
+ return {
10514
+ type: "array",
10515
+ minItems: def.items.length,
10516
+ maxItems: def.items.length,
10517
+ items: def.items.map(
10518
+ (x, i) => parseDef2(x._def, {
10519
+ ...refs,
10520
+ currentPath: [...refs.currentPath, "items", `${i}`]
10521
+ })
10522
+ ).reduce(
10523
+ (acc, x) => x === void 0 ? acc : [...acc, x],
10524
+ []
10525
+ )
10526
+ };
10527
+ }
10528
+ }
10529
+ function parseUndefinedDef2() {
10530
+ return {
10531
+ not: parseAnyDef2()
10532
+ };
10533
+ }
10534
+ function parseUnknownDef2() {
10535
+ return parseAnyDef2();
10536
+ }
10537
+ var parseReadonlyDef2 = (def, refs) => {
10538
+ return parseDef2(def.innerType._def, refs);
10539
+ };
10540
+ var selectParser2 = (def, typeName, refs) => {
10541
+ switch (typeName) {
10542
+ case ZodFirstPartyTypeKind.ZodString:
10543
+ return parseStringDef2(def, refs);
10544
+ case ZodFirstPartyTypeKind.ZodNumber:
10545
+ return parseNumberDef2(def);
10546
+ case ZodFirstPartyTypeKind.ZodObject:
10547
+ return parseObjectDef2(def, refs);
10548
+ case ZodFirstPartyTypeKind.ZodBigInt:
10549
+ return parseBigintDef2(def);
10550
+ case ZodFirstPartyTypeKind.ZodBoolean:
10551
+ return parseBooleanDef2();
10552
+ case ZodFirstPartyTypeKind.ZodDate:
10553
+ return parseDateDef2(def, refs);
10554
+ case ZodFirstPartyTypeKind.ZodUndefined:
10555
+ return parseUndefinedDef2();
10556
+ case ZodFirstPartyTypeKind.ZodNull:
10557
+ return parseNullDef2();
10558
+ case ZodFirstPartyTypeKind.ZodArray:
10559
+ return parseArrayDef2(def, refs);
10560
+ case ZodFirstPartyTypeKind.ZodUnion:
10561
+ case ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
10562
+ return parseUnionDef2(def, refs);
10563
+ case ZodFirstPartyTypeKind.ZodIntersection:
10564
+ return parseIntersectionDef2(def, refs);
10565
+ case ZodFirstPartyTypeKind.ZodTuple:
10566
+ return parseTupleDef2(def, refs);
10567
+ case ZodFirstPartyTypeKind.ZodRecord:
10568
+ return parseRecordDef2(def, refs);
10569
+ case ZodFirstPartyTypeKind.ZodLiteral:
10570
+ return parseLiteralDef2(def);
10571
+ case ZodFirstPartyTypeKind.ZodEnum:
10572
+ return parseEnumDef2(def);
10573
+ case ZodFirstPartyTypeKind.ZodNativeEnum:
10574
+ return parseNativeEnumDef2(def);
10575
+ case ZodFirstPartyTypeKind.ZodNullable:
10576
+ return parseNullableDef2(def, refs);
10577
+ case ZodFirstPartyTypeKind.ZodOptional:
10578
+ return parseOptionalDef2(def, refs);
10579
+ case ZodFirstPartyTypeKind.ZodMap:
10580
+ return parseMapDef2(def, refs);
10581
+ case ZodFirstPartyTypeKind.ZodSet:
10582
+ return parseSetDef2(def, refs);
10583
+ case ZodFirstPartyTypeKind.ZodLazy:
10584
+ return () => def.getter()._def;
10585
+ case ZodFirstPartyTypeKind.ZodPromise:
10586
+ return parsePromiseDef2(def, refs);
10587
+ case ZodFirstPartyTypeKind.ZodNaN:
10588
+ case ZodFirstPartyTypeKind.ZodNever:
10589
+ return parseNeverDef2();
10590
+ case ZodFirstPartyTypeKind.ZodEffects:
10591
+ return parseEffectsDef2(def, refs);
10592
+ case ZodFirstPartyTypeKind.ZodAny:
10593
+ return parseAnyDef2();
10594
+ case ZodFirstPartyTypeKind.ZodUnknown:
10595
+ return parseUnknownDef2();
10596
+ case ZodFirstPartyTypeKind.ZodDefault:
10597
+ return parseDefaultDef2(def, refs);
10598
+ case ZodFirstPartyTypeKind.ZodBranded:
10599
+ return parseBrandedDef2(def, refs);
10600
+ case ZodFirstPartyTypeKind.ZodReadonly:
10601
+ return parseReadonlyDef2(def, refs);
10602
+ case ZodFirstPartyTypeKind.ZodCatch:
10603
+ return parseCatchDef2(def, refs);
10604
+ case ZodFirstPartyTypeKind.ZodPipeline:
10605
+ return parsePipelineDef2(def, refs);
10606
+ case ZodFirstPartyTypeKind.ZodFunction:
10607
+ case ZodFirstPartyTypeKind.ZodVoid:
10608
+ case ZodFirstPartyTypeKind.ZodSymbol:
10609
+ return void 0;
10610
+ default:
10611
+ return /* @__PURE__ */ ((_) => void 0)();
10612
+ }
10613
+ };
10614
+ function parseDef2(def, refs, forceResolution = false) {
10615
+ var _a20;
10616
+ const seenItem = refs.seen.get(def);
10617
+ if (refs.override) {
10618
+ const overrideResult = (_a20 = refs.override) == null ? void 0 : _a20.call(
10619
+ refs,
10620
+ def,
10621
+ refs,
10622
+ seenItem,
10623
+ forceResolution
10624
+ );
10625
+ if (overrideResult !== ignoreOverride2) {
10626
+ return overrideResult;
10627
+ }
10628
+ }
10629
+ if (seenItem && !forceResolution) {
10630
+ const seenSchema = get$ref2(seenItem, refs);
10631
+ if (seenSchema !== void 0) {
10632
+ return seenSchema;
10633
+ }
10634
+ }
10635
+ const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
10636
+ refs.seen.set(def, newItem);
10637
+ const jsonSchemaOrGetter = selectParser2(def, def.typeName, refs);
10638
+ const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef2(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
10639
+ if (jsonSchema22) {
10640
+ addMeta2(def, refs, jsonSchema22);
10641
+ }
10642
+ if (refs.postProcess) {
10643
+ const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
10644
+ newItem.jsonSchema = jsonSchema22;
10645
+ return postProcessResult;
10646
+ }
10647
+ newItem.jsonSchema = jsonSchema22;
10648
+ return jsonSchema22;
10649
+ }
10650
+ var get$ref2 = (item, refs) => {
10651
+ switch (refs.$refStrategy) {
10652
+ case "root":
10653
+ return { $ref: item.path.join("/") };
10654
+ case "relative":
10655
+ return { $ref: getRelativePath2(refs.currentPath, item.path) };
10656
+ case "none":
10657
+ case "seen": {
10658
+ if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
10659
+ console.warn(
10660
+ `Recursive reference detected at ${refs.currentPath.join(
10661
+ "/"
10662
+ )}! Defaulting to any`
10663
+ );
10664
+ return parseAnyDef2();
10665
+ }
10666
+ return refs.$refStrategy === "seen" ? parseAnyDef2() : void 0;
10667
+ }
10668
+ }
10669
+ };
10670
+ var addMeta2 = (def, refs, jsonSchema22) => {
10671
+ if (def.description) {
10672
+ jsonSchema22.description = def.description;
10673
+ }
10674
+ return jsonSchema22;
10675
+ };
10676
+ var getRefs2 = (options) => {
10677
+ const _options = getDefaultOptions2(options);
10678
+ const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
10679
+ return {
10680
+ ..._options,
10681
+ currentPath,
10682
+ propertyPath: void 0,
10683
+ seen: new Map(
10684
+ Object.entries(_options.definitions).map(([name20, def]) => [
10685
+ def._def,
10686
+ {
10687
+ def: def._def,
10688
+ path: [..._options.basePath, _options.definitionPath, name20],
10689
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
10690
+ jsonSchema: void 0
10691
+ }
10692
+ ])
10693
+ )
10694
+ };
10695
+ };
10696
+ var zodToJsonSchema3 = (schema, options) => {
10697
+ var _a20;
10698
+ const refs = getRefs2(options);
10699
+ let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
10700
+ (acc, [name25, schema2]) => {
10701
+ var _a25;
10702
+ return {
10703
+ ...acc,
10704
+ [name25]: (_a25 = parseDef2(
10705
+ schema2._def,
10706
+ {
10707
+ ...refs,
10708
+ currentPath: [...refs.basePath, refs.definitionPath, name25]
10709
+ },
10710
+ true
10711
+ )) != null ? _a25 : parseAnyDef2()
10712
+ };
10713
+ },
10714
+ {}
10715
+ ) : void 0;
10716
+ const name20 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
10717
+ const main = (_a20 = parseDef2(
10718
+ schema._def,
10719
+ name20 === void 0 ? refs : {
10720
+ ...refs,
10721
+ currentPath: [...refs.basePath, refs.definitionPath, name20]
10722
+ },
10723
+ false
10724
+ )) != null ? _a20 : parseAnyDef2();
10725
+ const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
10726
+ if (title !== void 0) {
10727
+ main.title = title;
10728
+ }
10729
+ const combined = name20 === void 0 ? definitions ? {
10730
+ ...main,
10731
+ [refs.definitionPath]: definitions
10732
+ } : main : {
10733
+ $ref: [
10734
+ ...refs.$refStrategy === "relative" ? [] : refs.basePath,
10735
+ refs.definitionPath,
10736
+ name20
10737
+ ].join("/"),
10738
+ [refs.definitionPath]: {
10739
+ ...definitions,
10740
+ [name20]: main
10741
+ }
10742
+ };
10743
+ combined.$schema = "http://json-schema.org/draft-07/schema#";
10744
+ return combined;
10745
+ };
10746
+ var zod_to_json_schema_default2 = zodToJsonSchema3;
10747
+ function zod3Schema2(zodSchema22, options) {
10748
+ var _a20;
10749
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
10750
+ return jsonSchema3(
10751
+ zod_to_json_schema_default2(zodSchema22, {
10752
+ $refStrategy: useReferences ? "root" : "none"
10753
+ }),
10754
+ {
10755
+ validate: async (value) => {
10756
+ const result = await zodSchema22.safeParseAsync(value);
10757
+ return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
10758
+ }
10759
+ }
10760
+ );
10761
+ }
10762
+ function zod4Schema2(zodSchema22, options) {
10763
+ var _a20;
10764
+ const useReferences = (_a20 = void 0 ) != null ? _a20 : false;
10765
+ const z4JSONSchema = z42.toJSONSchema(zodSchema22, {
10766
+ target: "draft-7",
10767
+ io: "output",
10768
+ reused: useReferences ? "ref" : "inline"
10769
+ });
10770
+ return jsonSchema3(z4JSONSchema, {
10771
+ validate: async (value) => {
10772
+ const result = await z42.safeParseAsync(zodSchema22, value);
10773
+ return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
10774
+ }
10775
+ });
10776
+ }
10777
+ function isZod4Schema2(zodSchema22) {
10778
+ return "_zod" in zodSchema22;
10779
+ }
10780
+ function zodSchema3(zodSchema22, options) {
10781
+ if (isZod4Schema2(zodSchema22)) {
10782
+ return zod4Schema2(zodSchema22);
10783
+ } else {
10784
+ return zod3Schema2(zodSchema22);
10785
+ }
10786
+ }
10787
+ var schemaSymbol3 = Symbol.for("vercel.ai.schema");
10788
+ function jsonSchema3(jsonSchema22, {
10789
+ validate
10790
+ } = {}) {
10791
+ return {
10792
+ [schemaSymbol3]: true,
10793
+ _type: void 0,
10794
+ // should never be used directly
10795
+ [validatorSymbol3]: true,
10796
+ jsonSchema: jsonSchema22,
10797
+ validate
10798
+ };
10799
+ }
10800
+ function isSchema3(value) {
10801
+ return typeof value === "object" && value !== null && schemaSymbol3 in value && value[schemaSymbol3] === true && "jsonSchema" in value && "validate" in value;
10802
+ }
10803
+ function asSchema3(schema) {
10804
+ return schema == null ? jsonSchema3({
10805
+ properties: {},
10806
+ additionalProperties: false
10807
+ }) : isSchema3(schema) ? schema : zodSchema3(schema);
10808
+ }
10809
+ var __defProp4 = Object.defineProperty;
10810
+ var __export4 = (target, all) => {
10811
+ for (var name172 in all)
10812
+ __defProp4(target, name172, { get: all[name172], enumerable: true });
10813
+ };
10814
+ var name73 = "AI_NoObjectGeneratedError";
10815
+ var marker74 = `vercel.ai.error.${name73}`;
10816
+ var symbol74 = Symbol.for(marker74);
10817
+ var _a74;
10818
+ var NoObjectGeneratedError3 = class extends AISDKError$1 {
10819
+ constructor({
10820
+ message = "No object generated.",
10821
+ cause,
10822
+ text: text22,
10823
+ response,
10824
+ usage,
10825
+ finishReason
10826
+ }) {
10827
+ super({ name: name73, message, cause });
10828
+ this[_a74] = true;
10829
+ this.text = text22;
10830
+ this.response = response;
10831
+ this.usage = usage;
10832
+ this.finishReason = finishReason;
10833
+ }
10834
+ static isInstance(error) {
10835
+ return AISDKError$1.hasMarker(error, marker74);
10836
+ }
10837
+ };
10838
+ _a74 = symbol74;
10839
+ var dataContentSchema3 = z$1.union([
10840
+ z$1.string(),
10841
+ z$1.instanceof(Uint8Array),
10842
+ z$1.instanceof(ArrayBuffer),
10843
+ z$1.custom(
10844
+ // Buffer might not be available in some environments such as CloudFlare:
10845
+ (value) => {
10846
+ var _a172, _b8;
10847
+ return (_b8 = (_a172 = globalThis.Buffer) == null ? void 0 : _a172.isBuffer(value)) != null ? _b8 : false;
10848
+ },
10849
+ { message: "Must be a Buffer" }
10850
+ )
10851
+ ]);
10852
+ var jsonValueSchema3 = z$1.lazy(
10853
+ () => z$1.union([
10854
+ z$1.null(),
10855
+ z$1.string(),
10856
+ z$1.number(),
10857
+ z$1.boolean(),
10858
+ z$1.record(z$1.string(), jsonValueSchema3),
10859
+ z$1.array(jsonValueSchema3)
10860
+ ])
10861
+ );
10862
+ var providerMetadataSchema3 = z$1.record(
10863
+ z$1.string(),
10864
+ z$1.record(z$1.string(), jsonValueSchema3)
10865
+ );
10866
+ var textPartSchema3 = z$1.object({
10867
+ type: z$1.literal("text"),
10868
+ text: z$1.string(),
10869
+ providerOptions: providerMetadataSchema3.optional()
10870
+ });
10871
+ var imagePartSchema3 = z$1.object({
10872
+ type: z$1.literal("image"),
10873
+ image: z$1.union([dataContentSchema3, z$1.instanceof(URL)]),
10874
+ mediaType: z$1.string().optional(),
10875
+ providerOptions: providerMetadataSchema3.optional()
10876
+ });
10877
+ var filePartSchema3 = z$1.object({
10878
+ type: z$1.literal("file"),
10879
+ data: z$1.union([dataContentSchema3, z$1.instanceof(URL)]),
10880
+ filename: z$1.string().optional(),
10881
+ mediaType: z$1.string(),
10882
+ providerOptions: providerMetadataSchema3.optional()
10883
+ });
10884
+ var reasoningPartSchema3 = z$1.object({
10885
+ type: z$1.literal("reasoning"),
10886
+ text: z$1.string(),
10887
+ providerOptions: providerMetadataSchema3.optional()
10888
+ });
10889
+ var toolCallPartSchema3 = z$1.object({
10890
+ type: z$1.literal("tool-call"),
10891
+ toolCallId: z$1.string(),
10892
+ toolName: z$1.string(),
10893
+ input: z$1.unknown(),
10894
+ providerOptions: providerMetadataSchema3.optional(),
10895
+ providerExecuted: z$1.boolean().optional()
10896
+ });
10897
+ var outputSchema2 = z$1.discriminatedUnion("type", [
10898
+ z$1.object({
10899
+ type: z$1.literal("text"),
10900
+ value: z$1.string()
10901
+ }),
10902
+ z$1.object({
10903
+ type: z$1.literal("json"),
10904
+ value: jsonValueSchema3
10905
+ }),
10906
+ z$1.object({
10907
+ type: z$1.literal("error-text"),
10908
+ value: z$1.string()
10909
+ }),
10910
+ z$1.object({
10911
+ type: z$1.literal("error-json"),
10912
+ value: jsonValueSchema3
10913
+ }),
10914
+ z$1.object({
10915
+ type: z$1.literal("content"),
10916
+ value: z$1.array(
10917
+ z$1.union([
10918
+ z$1.object({
10919
+ type: z$1.literal("text"),
10920
+ text: z$1.string()
10921
+ }),
10922
+ z$1.object({
10923
+ type: z$1.literal("media"),
10924
+ data: z$1.string(),
10925
+ mediaType: z$1.string()
10926
+ })
10927
+ ])
10928
+ )
10929
+ })
10930
+ ]);
10931
+ var toolResultPartSchema3 = z$1.object({
10932
+ type: z$1.literal("tool-result"),
10933
+ toolCallId: z$1.string(),
10934
+ toolName: z$1.string(),
10935
+ output: outputSchema2,
10936
+ providerOptions: providerMetadataSchema3.optional()
10937
+ });
10938
+ var systemModelMessageSchema2 = z$1.object(
10939
+ {
10940
+ role: z$1.literal("system"),
10941
+ content: z$1.string(),
10942
+ providerOptions: providerMetadataSchema3.optional()
10943
+ }
10944
+ );
10945
+ var userModelMessageSchema2 = z$1.object({
10946
+ role: z$1.literal("user"),
10947
+ content: z$1.union([
10948
+ z$1.string(),
10949
+ z$1.array(z$1.union([textPartSchema3, imagePartSchema3, filePartSchema3]))
10950
+ ]),
10951
+ providerOptions: providerMetadataSchema3.optional()
10952
+ });
10953
+ var assistantModelMessageSchema2 = z$1.object({
10954
+ role: z$1.literal("assistant"),
10955
+ content: z$1.union([
10956
+ z$1.string(),
10957
+ z$1.array(
10958
+ z$1.union([
10959
+ textPartSchema3,
10960
+ filePartSchema3,
10961
+ reasoningPartSchema3,
10962
+ toolCallPartSchema3,
10963
+ toolResultPartSchema3
10964
+ ])
10965
+ )
10966
+ ]),
10967
+ providerOptions: providerMetadataSchema3.optional()
10968
+ });
10969
+ var toolModelMessageSchema2 = z$1.object({
10970
+ role: z$1.literal("tool"),
10971
+ content: z$1.array(toolResultPartSchema3),
10972
+ providerOptions: providerMetadataSchema3.optional()
10973
+ });
10974
+ z$1.union([
10975
+ systemModelMessageSchema2,
10976
+ userModelMessageSchema2,
10977
+ assistantModelMessageSchema2,
10978
+ toolModelMessageSchema2
10979
+ ]);
10980
+ function stepCountIs(stepCount) {
10981
+ return ({ steps }) => steps.length === stepCount;
10982
+ }
10983
+ createIdGenerator3({
10984
+ prefix: "aitxt",
10985
+ size: 24
10986
+ });
10987
+ z$1.union([
10988
+ z$1.strictObject({
10989
+ type: z$1.literal("text-start"),
10990
+ id: z$1.string(),
10991
+ providerMetadata: providerMetadataSchema3.optional()
10992
+ }),
10993
+ z$1.strictObject({
10994
+ type: z$1.literal("text-delta"),
10995
+ id: z$1.string(),
10996
+ delta: z$1.string(),
10997
+ providerMetadata: providerMetadataSchema3.optional()
10998
+ }),
10999
+ z$1.strictObject({
11000
+ type: z$1.literal("text-end"),
11001
+ id: z$1.string(),
11002
+ providerMetadata: providerMetadataSchema3.optional()
11003
+ }),
11004
+ z$1.strictObject({
11005
+ type: z$1.literal("error"),
11006
+ errorText: z$1.string()
11007
+ }),
11008
+ z$1.strictObject({
11009
+ type: z$1.literal("tool-input-start"),
11010
+ toolCallId: z$1.string(),
11011
+ toolName: z$1.string(),
11012
+ providerExecuted: z$1.boolean().optional(),
11013
+ dynamic: z$1.boolean().optional()
11014
+ }),
11015
+ z$1.strictObject({
11016
+ type: z$1.literal("tool-input-delta"),
11017
+ toolCallId: z$1.string(),
11018
+ inputTextDelta: z$1.string()
11019
+ }),
11020
+ z$1.strictObject({
11021
+ type: z$1.literal("tool-input-available"),
11022
+ toolCallId: z$1.string(),
11023
+ toolName: z$1.string(),
11024
+ input: z$1.unknown(),
11025
+ providerExecuted: z$1.boolean().optional(),
11026
+ providerMetadata: providerMetadataSchema3.optional(),
11027
+ dynamic: z$1.boolean().optional()
11028
+ }),
11029
+ z$1.strictObject({
11030
+ type: z$1.literal("tool-input-error"),
11031
+ toolCallId: z$1.string(),
11032
+ toolName: z$1.string(),
11033
+ input: z$1.unknown(),
11034
+ providerExecuted: z$1.boolean().optional(),
11035
+ providerMetadata: providerMetadataSchema3.optional(),
11036
+ dynamic: z$1.boolean().optional(),
11037
+ errorText: z$1.string()
11038
+ }),
11039
+ z$1.strictObject({
11040
+ type: z$1.literal("tool-output-available"),
11041
+ toolCallId: z$1.string(),
11042
+ output: z$1.unknown(),
11043
+ providerExecuted: z$1.boolean().optional(),
11044
+ dynamic: z$1.boolean().optional(),
11045
+ preliminary: z$1.boolean().optional()
11046
+ }),
11047
+ z$1.strictObject({
11048
+ type: z$1.literal("tool-output-error"),
11049
+ toolCallId: z$1.string(),
11050
+ errorText: z$1.string(),
11051
+ providerExecuted: z$1.boolean().optional(),
11052
+ dynamic: z$1.boolean().optional()
11053
+ }),
11054
+ z$1.strictObject({
11055
+ type: z$1.literal("reasoning"),
11056
+ text: z$1.string(),
11057
+ providerMetadata: providerMetadataSchema3.optional()
11058
+ }),
11059
+ z$1.strictObject({
11060
+ type: z$1.literal("reasoning-start"),
11061
+ id: z$1.string(),
11062
+ providerMetadata: providerMetadataSchema3.optional()
11063
+ }),
11064
+ z$1.strictObject({
11065
+ type: z$1.literal("reasoning-delta"),
11066
+ id: z$1.string(),
11067
+ delta: z$1.string(),
11068
+ providerMetadata: providerMetadataSchema3.optional()
11069
+ }),
11070
+ z$1.strictObject({
11071
+ type: z$1.literal("reasoning-end"),
11072
+ id: z$1.string(),
11073
+ providerMetadata: providerMetadataSchema3.optional()
11074
+ }),
11075
+ z$1.strictObject({
11076
+ type: z$1.literal("reasoning-part-finish")
11077
+ }),
11078
+ z$1.strictObject({
11079
+ type: z$1.literal("source-url"),
11080
+ sourceId: z$1.string(),
11081
+ url: z$1.string(),
11082
+ title: z$1.string().optional(),
11083
+ providerMetadata: providerMetadataSchema3.optional()
11084
+ }),
11085
+ z$1.strictObject({
11086
+ type: z$1.literal("source-document"),
11087
+ sourceId: z$1.string(),
11088
+ mediaType: z$1.string(),
11089
+ title: z$1.string(),
11090
+ filename: z$1.string().optional(),
11091
+ providerMetadata: providerMetadataSchema3.optional()
11092
+ }),
11093
+ z$1.strictObject({
11094
+ type: z$1.literal("file"),
11095
+ url: z$1.string(),
11096
+ mediaType: z$1.string(),
11097
+ providerMetadata: providerMetadataSchema3.optional()
11098
+ }),
11099
+ z$1.strictObject({
11100
+ type: z$1.string().startsWith("data-"),
11101
+ id: z$1.string().optional(),
11102
+ data: z$1.unknown(),
11103
+ transient: z$1.boolean().optional()
11104
+ }),
11105
+ z$1.strictObject({
11106
+ type: z$1.literal("start-step")
11107
+ }),
11108
+ z$1.strictObject({
11109
+ type: z$1.literal("finish-step")
11110
+ }),
11111
+ z$1.strictObject({
11112
+ type: z$1.literal("start"),
11113
+ messageId: z$1.string().optional(),
11114
+ messageMetadata: z$1.unknown().optional()
11115
+ }),
11116
+ z$1.strictObject({
11117
+ type: z$1.literal("finish"),
11118
+ messageMetadata: z$1.unknown().optional()
11119
+ }),
11120
+ z$1.strictObject({
11121
+ type: z$1.literal("abort")
11122
+ }),
11123
+ z$1.strictObject({
11124
+ type: z$1.literal("message-metadata"),
11125
+ messageMetadata: z$1.unknown()
11126
+ })
11127
+ ]);
11128
+ function fixJson3(input) {
11129
+ const stack = ["ROOT"];
11130
+ let lastValidIndex = -1;
11131
+ let literalStart = null;
11132
+ function processValueStart(char, i, swapState) {
11133
+ {
11134
+ switch (char) {
11135
+ case '"': {
11136
+ lastValidIndex = i;
11137
+ stack.pop();
11138
+ stack.push(swapState);
11139
+ stack.push("INSIDE_STRING");
11140
+ break;
11141
+ }
11142
+ case "f":
11143
+ case "t":
11144
+ case "n": {
11145
+ lastValidIndex = i;
11146
+ literalStart = i;
11147
+ stack.pop();
11148
+ stack.push(swapState);
11149
+ stack.push("INSIDE_LITERAL");
11150
+ break;
11151
+ }
11152
+ case "-": {
11153
+ stack.pop();
11154
+ stack.push(swapState);
11155
+ stack.push("INSIDE_NUMBER");
11156
+ break;
11157
+ }
11158
+ case "0":
11159
+ case "1":
11160
+ case "2":
11161
+ case "3":
11162
+ case "4":
11163
+ case "5":
11164
+ case "6":
11165
+ case "7":
11166
+ case "8":
11167
+ case "9": {
11168
+ lastValidIndex = i;
11169
+ stack.pop();
11170
+ stack.push(swapState);
11171
+ stack.push("INSIDE_NUMBER");
11172
+ break;
11173
+ }
11174
+ case "{": {
11175
+ lastValidIndex = i;
11176
+ stack.pop();
11177
+ stack.push(swapState);
11178
+ stack.push("INSIDE_OBJECT_START");
11179
+ break;
11180
+ }
11181
+ case "[": {
11182
+ lastValidIndex = i;
11183
+ stack.pop();
11184
+ stack.push(swapState);
11185
+ stack.push("INSIDE_ARRAY_START");
11186
+ break;
11187
+ }
11188
+ }
11189
+ }
11190
+ }
11191
+ function processAfterObjectValue(char, i) {
11192
+ switch (char) {
11193
+ case ",": {
11194
+ stack.pop();
11195
+ stack.push("INSIDE_OBJECT_AFTER_COMMA");
11196
+ break;
11197
+ }
11198
+ case "}": {
11199
+ lastValidIndex = i;
11200
+ stack.pop();
11201
+ break;
11202
+ }
11203
+ }
11204
+ }
11205
+ function processAfterArrayValue(char, i) {
11206
+ switch (char) {
11207
+ case ",": {
11208
+ stack.pop();
11209
+ stack.push("INSIDE_ARRAY_AFTER_COMMA");
11210
+ break;
11211
+ }
11212
+ case "]": {
11213
+ lastValidIndex = i;
11214
+ stack.pop();
11215
+ break;
11216
+ }
11217
+ }
11218
+ }
11219
+ for (let i = 0; i < input.length; i++) {
11220
+ const char = input[i];
11221
+ const currentState = stack[stack.length - 1];
11222
+ switch (currentState) {
11223
+ case "ROOT":
11224
+ processValueStart(char, i, "FINISH");
11225
+ break;
11226
+ case "INSIDE_OBJECT_START": {
11227
+ switch (char) {
11228
+ case '"': {
11229
+ stack.pop();
11230
+ stack.push("INSIDE_OBJECT_KEY");
11231
+ break;
11232
+ }
11233
+ case "}": {
11234
+ lastValidIndex = i;
11235
+ stack.pop();
11236
+ break;
11237
+ }
11238
+ }
11239
+ break;
11240
+ }
11241
+ case "INSIDE_OBJECT_AFTER_COMMA": {
11242
+ switch (char) {
11243
+ case '"': {
11244
+ stack.pop();
11245
+ stack.push("INSIDE_OBJECT_KEY");
11246
+ break;
11247
+ }
11248
+ }
11249
+ break;
11250
+ }
11251
+ case "INSIDE_OBJECT_KEY": {
11252
+ switch (char) {
11253
+ case '"': {
11254
+ stack.pop();
11255
+ stack.push("INSIDE_OBJECT_AFTER_KEY");
11256
+ break;
11257
+ }
11258
+ }
11259
+ break;
11260
+ }
11261
+ case "INSIDE_OBJECT_AFTER_KEY": {
11262
+ switch (char) {
11263
+ case ":": {
11264
+ stack.pop();
11265
+ stack.push("INSIDE_OBJECT_BEFORE_VALUE");
11266
+ break;
11267
+ }
11268
+ }
11269
+ break;
11270
+ }
11271
+ case "INSIDE_OBJECT_BEFORE_VALUE": {
11272
+ processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
11273
+ break;
11274
+ }
11275
+ case "INSIDE_OBJECT_AFTER_VALUE": {
11276
+ processAfterObjectValue(char, i);
11277
+ break;
11278
+ }
11279
+ case "INSIDE_STRING": {
11280
+ switch (char) {
11281
+ case '"': {
11282
+ stack.pop();
11283
+ lastValidIndex = i;
11284
+ break;
11285
+ }
11286
+ case "\\": {
11287
+ stack.push("INSIDE_STRING_ESCAPE");
11288
+ break;
11289
+ }
11290
+ default: {
11291
+ lastValidIndex = i;
11292
+ }
11293
+ }
11294
+ break;
11295
+ }
11296
+ case "INSIDE_ARRAY_START": {
11297
+ switch (char) {
11298
+ case "]": {
11299
+ lastValidIndex = i;
11300
+ stack.pop();
11301
+ break;
11302
+ }
11303
+ default: {
11304
+ lastValidIndex = i;
11305
+ processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
11306
+ break;
11307
+ }
11308
+ }
11309
+ break;
11310
+ }
11311
+ case "INSIDE_ARRAY_AFTER_VALUE": {
11312
+ switch (char) {
11313
+ case ",": {
11314
+ stack.pop();
11315
+ stack.push("INSIDE_ARRAY_AFTER_COMMA");
11316
+ break;
11317
+ }
11318
+ case "]": {
11319
+ lastValidIndex = i;
11320
+ stack.pop();
11321
+ break;
11322
+ }
11323
+ default: {
11324
+ lastValidIndex = i;
11325
+ break;
11326
+ }
11327
+ }
11328
+ break;
11329
+ }
11330
+ case "INSIDE_ARRAY_AFTER_COMMA": {
11331
+ processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
11332
+ break;
11333
+ }
11334
+ case "INSIDE_STRING_ESCAPE": {
11335
+ stack.pop();
11336
+ lastValidIndex = i;
11337
+ break;
11338
+ }
11339
+ case "INSIDE_NUMBER": {
11340
+ switch (char) {
11341
+ case "0":
11342
+ case "1":
11343
+ case "2":
11344
+ case "3":
11345
+ case "4":
11346
+ case "5":
11347
+ case "6":
11348
+ case "7":
11349
+ case "8":
11350
+ case "9": {
11351
+ lastValidIndex = i;
11352
+ break;
11353
+ }
11354
+ case "e":
11355
+ case "E":
11356
+ case "-":
11357
+ case ".": {
11358
+ break;
11359
+ }
11360
+ case ",": {
11361
+ stack.pop();
11362
+ if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
11363
+ processAfterArrayValue(char, i);
11364
+ }
11365
+ if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
11366
+ processAfterObjectValue(char, i);
11367
+ }
11368
+ break;
11369
+ }
11370
+ case "}": {
11371
+ stack.pop();
11372
+ if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
11373
+ processAfterObjectValue(char, i);
11374
+ }
11375
+ break;
11376
+ }
11377
+ case "]": {
11378
+ stack.pop();
11379
+ if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
11380
+ processAfterArrayValue(char, i);
11381
+ }
11382
+ break;
11383
+ }
11384
+ default: {
11385
+ stack.pop();
11386
+ break;
11387
+ }
11388
+ }
11389
+ break;
11390
+ }
11391
+ case "INSIDE_LITERAL": {
11392
+ const partialLiteral = input.substring(literalStart, i + 1);
11393
+ if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
11394
+ stack.pop();
11395
+ if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
11396
+ processAfterObjectValue(char, i);
11397
+ } else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
11398
+ processAfterArrayValue(char, i);
11399
+ }
11400
+ } else {
11401
+ lastValidIndex = i;
11402
+ }
11403
+ break;
11404
+ }
11405
+ }
11406
+ }
11407
+ let result = input.slice(0, lastValidIndex + 1);
11408
+ for (let i = stack.length - 1; i >= 0; i--) {
11409
+ const state = stack[i];
11410
+ switch (state) {
11411
+ case "INSIDE_STRING": {
11412
+ result += '"';
11413
+ break;
11414
+ }
11415
+ case "INSIDE_OBJECT_KEY":
11416
+ case "INSIDE_OBJECT_AFTER_KEY":
11417
+ case "INSIDE_OBJECT_AFTER_COMMA":
11418
+ case "INSIDE_OBJECT_START":
11419
+ case "INSIDE_OBJECT_BEFORE_VALUE":
11420
+ case "INSIDE_OBJECT_AFTER_VALUE": {
11421
+ result += "}";
11422
+ break;
11423
+ }
11424
+ case "INSIDE_ARRAY_START":
11425
+ case "INSIDE_ARRAY_AFTER_COMMA":
11426
+ case "INSIDE_ARRAY_AFTER_VALUE": {
11427
+ result += "]";
11428
+ break;
11429
+ }
11430
+ case "INSIDE_LITERAL": {
11431
+ const partialLiteral = input.substring(literalStart, input.length);
11432
+ if ("true".startsWith(partialLiteral)) {
11433
+ result += "true".slice(partialLiteral.length);
11434
+ } else if ("false".startsWith(partialLiteral)) {
11435
+ result += "false".slice(partialLiteral.length);
11436
+ } else if ("null".startsWith(partialLiteral)) {
11437
+ result += "null".slice(partialLiteral.length);
11438
+ }
11439
+ }
11440
+ }
11441
+ }
11442
+ return result;
11443
+ }
11444
+ async function parsePartialJson3(jsonText) {
11445
+ if (jsonText === void 0) {
11446
+ return { value: void 0, state: "undefined-input" };
11447
+ }
11448
+ let result = await safeParseJSON3({ text: jsonText });
11449
+ if (result.success) {
11450
+ return { value: result.value, state: "successful-parse" };
11451
+ }
11452
+ result = await safeParseJSON3({ text: fixJson3(jsonText) });
11453
+ if (result.success) {
11454
+ return { value: result.value, state: "repaired-parse" };
11455
+ }
11456
+ return { value: void 0, state: "failed-parse" };
11457
+ }
11458
+ createIdGenerator3({
11459
+ prefix: "aitxt",
11460
+ size: 24
11461
+ });
11462
+ createIdGenerator3({ prefix: "aiobj", size: 24 });
11463
+ createIdGenerator3({ prefix: "aiobj", size: 24 });
11464
+ var output_exports3 = {};
11465
+ __export4(output_exports3, {
11466
+ object: () => object3,
11467
+ text: () => text3
11468
+ });
11469
+ var text3 = () => ({
11470
+ type: "text",
11471
+ responseFormat: { type: "text" },
11472
+ async parsePartial({ text: text22 }) {
11473
+ return { partial: text22 };
11474
+ },
11475
+ async parseOutput({ text: text22 }) {
11476
+ return text22;
11477
+ }
11478
+ });
11479
+ var object3 = ({
11480
+ schema: inputSchema
11481
+ }) => {
11482
+ const schema = asSchema3(inputSchema);
11483
+ return {
11484
+ type: "object",
11485
+ responseFormat: {
11486
+ type: "json",
11487
+ schema: schema.jsonSchema
11488
+ },
11489
+ async parsePartial({ text: text22 }) {
11490
+ const result = await parsePartialJson3(text22);
11491
+ switch (result.state) {
11492
+ case "failed-parse":
11493
+ case "undefined-input":
11494
+ return void 0;
11495
+ case "repaired-parse":
11496
+ case "successful-parse":
11497
+ return {
11498
+ // Note: currently no validation of partial results:
11499
+ partial: result.value
11500
+ };
11501
+ default: {
11502
+ const _exhaustiveCheck = result.state;
11503
+ throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);
11504
+ }
11505
+ }
11506
+ },
11507
+ async parseOutput({ text: text22 }, context) {
11508
+ const parseResult = await safeParseJSON3({ text: text22 });
11509
+ if (!parseResult.success) {
11510
+ throw new NoObjectGeneratedError3({
11511
+ message: "No object generated: could not parse the response.",
11512
+ cause: parseResult.error,
11513
+ text: text22,
11514
+ response: context.response,
11515
+ usage: context.usage,
11516
+ finishReason: context.finishReason
11517
+ });
11518
+ }
11519
+ const validationResult = await safeValidateTypes3({
11520
+ value: parseResult.value,
11521
+ schema
11522
+ });
11523
+ if (!validationResult.success) {
11524
+ throw new NoObjectGeneratedError3({
11525
+ message: "No object generated: response did not match schema.",
11526
+ cause: validationResult.error,
11527
+ text: text22,
11528
+ response: context.response,
11529
+ usage: context.usage,
11530
+ finishReason: context.finishReason
11531
+ });
11532
+ }
11533
+ return validationResult.value;
11534
+ }
11535
+ };
9524
11536
  };
11537
+ var ClientOrServerImplementationSchema3 = z$1.looseObject({
11538
+ name: z$1.string(),
11539
+ version: z$1.string()
11540
+ });
11541
+ var BaseParamsSchema3 = z$1.looseObject({
11542
+ _meta: z$1.optional(z$1.object({}).loose())
11543
+ });
11544
+ var ResultSchema3 = BaseParamsSchema3;
11545
+ var RequestSchema3 = z$1.object({
11546
+ method: z$1.string(),
11547
+ params: z$1.optional(BaseParamsSchema3)
11548
+ });
11549
+ var ServerCapabilitiesSchema3 = z$1.looseObject({
11550
+ experimental: z$1.optional(z$1.object({}).loose()),
11551
+ logging: z$1.optional(z$1.object({}).loose()),
11552
+ prompts: z$1.optional(
11553
+ z$1.looseObject({
11554
+ listChanged: z$1.optional(z$1.boolean())
11555
+ })
11556
+ ),
11557
+ resources: z$1.optional(
11558
+ z$1.looseObject({
11559
+ subscribe: z$1.optional(z$1.boolean()),
11560
+ listChanged: z$1.optional(z$1.boolean())
11561
+ })
11562
+ ),
11563
+ tools: z$1.optional(
11564
+ z$1.looseObject({
11565
+ listChanged: z$1.optional(z$1.boolean())
11566
+ })
11567
+ )
11568
+ });
11569
+ ResultSchema3.extend({
11570
+ protocolVersion: z$1.string(),
11571
+ capabilities: ServerCapabilitiesSchema3,
11572
+ serverInfo: ClientOrServerImplementationSchema3,
11573
+ instructions: z$1.optional(z$1.string())
11574
+ });
11575
+ var PaginatedResultSchema3 = ResultSchema3.extend({
11576
+ nextCursor: z$1.optional(z$1.string())
11577
+ });
11578
+ var ToolSchema3 = z$1.object({
11579
+ name: z$1.string(),
11580
+ description: z$1.optional(z$1.string()),
11581
+ inputSchema: z$1.object({
11582
+ type: z$1.literal("object"),
11583
+ properties: z$1.optional(z$1.object({}).loose())
11584
+ }).loose()
11585
+ }).loose();
11586
+ PaginatedResultSchema3.extend({
11587
+ tools: z$1.array(ToolSchema3)
11588
+ });
11589
+ var TextContentSchema3 = z$1.object({
11590
+ type: z$1.literal("text"),
11591
+ text: z$1.string()
11592
+ }).loose();
11593
+ var ImageContentSchema3 = z$1.object({
11594
+ type: z$1.literal("image"),
11595
+ data: z$1.base64(),
11596
+ mimeType: z$1.string()
11597
+ }).loose();
11598
+ var ResourceContentsSchema3 = z$1.object({
11599
+ /**
11600
+ * The URI of this resource.
11601
+ */
11602
+ uri: z$1.string(),
11603
+ /**
11604
+ * The MIME type of this resource, if known.
11605
+ */
11606
+ mimeType: z$1.optional(z$1.string())
11607
+ }).loose();
11608
+ var TextResourceContentsSchema3 = ResourceContentsSchema3.extend({
11609
+ text: z$1.string()
11610
+ });
11611
+ var BlobResourceContentsSchema3 = ResourceContentsSchema3.extend({
11612
+ blob: z$1.base64()
11613
+ });
11614
+ var EmbeddedResourceSchema3 = z$1.object({
11615
+ type: z$1.literal("resource"),
11616
+ resource: z$1.union([TextResourceContentsSchema3, BlobResourceContentsSchema3])
11617
+ }).loose();
11618
+ ResultSchema3.extend({
11619
+ content: z$1.array(
11620
+ z$1.union([TextContentSchema3, ImageContentSchema3, EmbeddedResourceSchema3])
11621
+ ),
11622
+ isError: z$1.boolean().default(false).optional()
11623
+ }).or(
11624
+ ResultSchema3.extend({
11625
+ toolResult: z$1.unknown()
11626
+ })
11627
+ );
11628
+ var JSONRPC_VERSION3 = "2.0";
11629
+ var JSONRPCRequestSchema3 = z$1.object({
11630
+ jsonrpc: z$1.literal(JSONRPC_VERSION3),
11631
+ id: z$1.union([z$1.string(), z$1.number().int()])
11632
+ }).merge(RequestSchema3).strict();
11633
+ var JSONRPCResponseSchema3 = z$1.object({
11634
+ jsonrpc: z$1.literal(JSONRPC_VERSION3),
11635
+ id: z$1.union([z$1.string(), z$1.number().int()]),
11636
+ result: ResultSchema3
11637
+ }).strict();
11638
+ var JSONRPCErrorSchema3 = z$1.object({
11639
+ jsonrpc: z$1.literal(JSONRPC_VERSION3),
11640
+ id: z$1.union([z$1.string(), z$1.number().int()]),
11641
+ error: z$1.object({
11642
+ code: z$1.number().int(),
11643
+ message: z$1.string(),
11644
+ data: z$1.optional(z$1.unknown())
11645
+ })
11646
+ }).strict();
11647
+ var JSONRPCNotificationSchema3 = z$1.object({
11648
+ jsonrpc: z$1.literal(JSONRPC_VERSION3)
11649
+ }).merge(
11650
+ z$1.object({
11651
+ method: z$1.string(),
11652
+ params: z$1.optional(BaseParamsSchema3)
11653
+ })
11654
+ ).strict();
11655
+ z$1.union([
11656
+ JSONRPCRequestSchema3,
11657
+ JSONRPCNotificationSchema3,
11658
+ JSONRPCResponseSchema3,
11659
+ JSONRPCErrorSchema3
11660
+ ]);
11661
+ var textUIPartSchema2 = z$1.object({
11662
+ type: z$1.literal("text"),
11663
+ text: z$1.string(),
11664
+ state: z$1.enum(["streaming", "done"]).optional(),
11665
+ providerMetadata: providerMetadataSchema3.optional()
11666
+ });
11667
+ var reasoningUIPartSchema2 = z$1.object({
11668
+ type: z$1.literal("reasoning"),
11669
+ text: z$1.string(),
11670
+ state: z$1.enum(["streaming", "done"]).optional(),
11671
+ providerMetadata: providerMetadataSchema3.optional()
11672
+ });
11673
+ var sourceUrlUIPartSchema2 = z$1.object({
11674
+ type: z$1.literal("source-url"),
11675
+ sourceId: z$1.string(),
11676
+ url: z$1.string(),
11677
+ title: z$1.string().optional(),
11678
+ providerMetadata: providerMetadataSchema3.optional()
11679
+ });
11680
+ var sourceDocumentUIPartSchema2 = z$1.object({
11681
+ type: z$1.literal("source-document"),
11682
+ sourceId: z$1.string(),
11683
+ mediaType: z$1.string(),
11684
+ title: z$1.string(),
11685
+ filename: z$1.string().optional(),
11686
+ providerMetadata: providerMetadataSchema3.optional()
11687
+ });
11688
+ var fileUIPartSchema2 = z$1.object({
11689
+ type: z$1.literal("file"),
11690
+ mediaType: z$1.string(),
11691
+ filename: z$1.string().optional(),
11692
+ url: z$1.string(),
11693
+ providerMetadata: providerMetadataSchema3.optional()
11694
+ });
11695
+ var stepStartUIPartSchema2 = z$1.object({
11696
+ type: z$1.literal("step-start")
11697
+ });
11698
+ var dataUIPartSchema2 = z$1.object({
11699
+ type: z$1.string().startsWith("data-"),
11700
+ id: z$1.string().optional(),
11701
+ data: z$1.unknown()
11702
+ });
11703
+ var dynamicToolUIPartSchemas2 = [
11704
+ z$1.object({
11705
+ type: z$1.literal("dynamic-tool"),
11706
+ toolName: z$1.string(),
11707
+ toolCallId: z$1.string(),
11708
+ state: z$1.literal("input-streaming"),
11709
+ input: z$1.unknown().optional(),
11710
+ output: z$1.never().optional(),
11711
+ errorText: z$1.never().optional()
11712
+ }),
11713
+ z$1.object({
11714
+ type: z$1.literal("dynamic-tool"),
11715
+ toolName: z$1.string(),
11716
+ toolCallId: z$1.string(),
11717
+ state: z$1.literal("input-available"),
11718
+ input: z$1.unknown(),
11719
+ output: z$1.never().optional(),
11720
+ errorText: z$1.never().optional(),
11721
+ callProviderMetadata: providerMetadataSchema3.optional()
11722
+ }),
11723
+ z$1.object({
11724
+ type: z$1.literal("dynamic-tool"),
11725
+ toolName: z$1.string(),
11726
+ toolCallId: z$1.string(),
11727
+ state: z$1.literal("output-available"),
11728
+ input: z$1.unknown(),
11729
+ output: z$1.unknown(),
11730
+ errorText: z$1.never().optional(),
11731
+ callProviderMetadata: providerMetadataSchema3.optional(),
11732
+ preliminary: z$1.boolean().optional()
11733
+ }),
11734
+ z$1.object({
11735
+ type: z$1.literal("dynamic-tool"),
11736
+ toolName: z$1.string(),
11737
+ toolCallId: z$1.string(),
11738
+ state: z$1.literal("output-error"),
11739
+ input: z$1.unknown(),
11740
+ output: z$1.never().optional(),
11741
+ errorText: z$1.string(),
11742
+ callProviderMetadata: providerMetadataSchema3.optional()
11743
+ })
11744
+ ];
11745
+ var toolUIPartSchemas2 = [
11746
+ z$1.object({
11747
+ type: z$1.string().startsWith("tool-"),
11748
+ toolCallId: z$1.string(),
11749
+ state: z$1.literal("input-streaming"),
11750
+ input: z$1.unknown().optional(),
11751
+ output: z$1.never().optional(),
11752
+ errorText: z$1.never().optional()
11753
+ }),
11754
+ z$1.object({
11755
+ type: z$1.string().startsWith("tool-"),
11756
+ toolCallId: z$1.string(),
11757
+ state: z$1.literal("input-available"),
11758
+ input: z$1.unknown(),
11759
+ output: z$1.never().optional(),
11760
+ errorText: z$1.never().optional(),
11761
+ callProviderMetadata: providerMetadataSchema3.optional()
11762
+ }),
11763
+ z$1.object({
11764
+ type: z$1.string().startsWith("tool-"),
11765
+ toolCallId: z$1.string(),
11766
+ state: z$1.literal("output-available"),
11767
+ input: z$1.unknown(),
11768
+ output: z$1.unknown(),
11769
+ errorText: z$1.never().optional(),
11770
+ callProviderMetadata: providerMetadataSchema3.optional(),
11771
+ preliminary: z$1.boolean().optional()
11772
+ }),
11773
+ z$1.object({
11774
+ type: z$1.string().startsWith("tool-"),
11775
+ toolCallId: z$1.string(),
11776
+ state: z$1.literal("output-error"),
11777
+ input: z$1.unknown(),
11778
+ output: z$1.never().optional(),
11779
+ errorText: z$1.string(),
11780
+ callProviderMetadata: providerMetadataSchema3.optional()
11781
+ })
11782
+ ];
11783
+ z$1.object({
11784
+ id: z$1.string(),
11785
+ role: z$1.enum(["system", "user", "assistant"]),
11786
+ metadata: z$1.unknown().optional(),
11787
+ parts: z$1.array(
11788
+ z$1.union([
11789
+ textUIPartSchema2,
11790
+ reasoningUIPartSchema2,
11791
+ sourceUrlUIPartSchema2,
11792
+ sourceDocumentUIPartSchema2,
11793
+ fileUIPartSchema2,
11794
+ stepStartUIPartSchema2,
11795
+ dataUIPartSchema2,
11796
+ ...dynamicToolUIPartSchemas2,
11797
+ ...toolUIPartSchemas2
11798
+ ])
11799
+ )
11800
+ });
9525
11801
 
9526
11802
  // ../agent-builder/dist/index.js
9527
- var import_ignore = __toESM(require_ignore(), 1);
9528
11803
  var UNIT_KINDS = ["mcp-server", "tool", "workflow", "agent", "integration", "network", "other"];
9529
11804
  var TemplateUnitSchema = z.object({
9530
11805
  kind: z.enum(UNIT_KINDS),
@@ -9729,7 +12004,7 @@ function isInWorkspaceSubfolder(cwd) {
9729
12004
  if (currentDir === cwd) {
9730
12005
  continue;
9731
12006
  }
9732
- console.info(`Checking for workspace indicators in: ${currentDir}`);
12007
+ console.log(`Checking for workspace indicators in: ${currentDir}`);
9733
12008
  if (existsSync(resolve$1(currentDir, "pnpm-workspace.yaml"))) {
9734
12009
  return true;
9735
12010
  }
@@ -9749,7 +12024,7 @@ function isInWorkspaceSubfolder(cwd) {
9749
12024
  }
9750
12025
  return false;
9751
12026
  } catch (error) {
9752
- console.warn(`Error in workspace detection: ${error}`);
12027
+ console.log(`Error in workspace detection: ${error}`);
9753
12028
  return false;
9754
12029
  }
9755
12030
  }
@@ -9820,12 +12095,12 @@ function spawnWithOutput(command, args, options) {
9820
12095
  }
9821
12096
  async function spawnSWPM(cwd, command, packageNames) {
9822
12097
  try {
9823
- console.info("Running install command with swpm");
12098
+ console.log("Running install command with swpm");
9824
12099
  const swpmPath = createRequire(import.meta.filename).resolve("swpm");
9825
12100
  await spawn(swpmPath, [command, ...packageNames], { cwd });
9826
12101
  return;
9827
12102
  } catch (e2) {
9828
- console.warn("Failed to run install command with swpm", e2);
12103
+ console.log("Failed to run install command with swpm", e2);
9829
12104
  }
9830
12105
  try {
9831
12106
  let packageManager;
@@ -9853,11 +12128,11 @@ async function spawnSWPM(cwd, command, packageNames) {
9853
12128
  }
9854
12129
  }
9855
12130
  args.push(...packageNames);
9856
- console.info(`Falling back to ${packageManager} ${args.join(" ")}`);
12131
+ console.log(`Falling back to ${packageManager} ${args.join(" ")}`);
9857
12132
  await spawn(packageManager, args, { cwd });
9858
12133
  return;
9859
12134
  } catch (e2) {
9860
- console.warn(`Failed to run install command with native package manager: ${e2}`);
12135
+ console.log(`Failed to run install command with native package manager: ${e2}`);
9861
12136
  }
9862
12137
  throw new Error(`Failed to run install command with swpm and native package managers`);
9863
12138
  }
@@ -9871,10 +12146,10 @@ async function logGitState(targetPath, label) {
9871
12146
  const gitStatusResult = await git(targetPath, "status", "--porcelain");
9872
12147
  const gitLogResult = await git(targetPath, "log", "--oneline", "-3");
9873
12148
  const gitCountResult = await git(targetPath, "rev-list", "--count", "HEAD");
9874
- console.info(`\u{1F4CA} Git state ${label}:`);
9875
- console.info("Status:", gitStatusResult.stdout.trim() || "Clean working directory");
9876
- console.info("Recent commits:", gitLogResult.stdout.trim());
9877
- console.info("Total commits:", gitCountResult.stdout.trim());
12149
+ console.log(`\u{1F4CA} Git state ${label}:`);
12150
+ console.log("Status:", gitStatusResult.stdout.trim() || "Clean working directory");
12151
+ console.log("Recent commits:", gitLogResult.stdout.trim());
12152
+ console.log("Total commits:", gitCountResult.stdout.trim());
9878
12153
  } catch (gitError) {
9879
12154
  console.warn(`Could not get git state ${label}:`, gitError);
9880
12155
  }
@@ -9946,18 +12221,18 @@ async function gitCheckoutBranch(branchName, targetPath) {
9946
12221
  try {
9947
12222
  if (!await isInsideGitRepo(targetPath)) return;
9948
12223
  await git(targetPath, "checkout", "-b", branchName);
9949
- console.info(`Created new branch: ${branchName}`);
12224
+ console.log(`Created new branch: ${branchName}`);
9950
12225
  } catch (error) {
9951
12226
  const errorStr = error instanceof Error ? error.message : String(error);
9952
12227
  if (errorStr.includes("already exists")) {
9953
12228
  try {
9954
12229
  await git(targetPath, "checkout", branchName);
9955
- console.info(`Switched to existing branch: ${branchName}`);
12230
+ console.log(`Switched to existing branch: ${branchName}`);
9956
12231
  } catch {
9957
12232
  const timestamp = Date.now().toString().slice(-6);
9958
12233
  const uniqueBranchName = `${branchName}-${timestamp}`;
9959
12234
  await git(targetPath, "checkout", "-b", uniqueBranchName);
9960
- console.info(`Created unique branch: ${uniqueBranchName}`);
12235
+ console.log(`Created unique branch: ${uniqueBranchName}`);
9961
12236
  }
9962
12237
  } else {
9963
12238
  throw error;
@@ -9967,9 +12242,9 @@ async function gitCheckoutBranch(branchName, targetPath) {
9967
12242
  async function backupAndReplaceFile(sourceFile, targetFile) {
9968
12243
  const backupFile = `${targetFile}.backup-${Date.now()}`;
9969
12244
  await copyFile(targetFile, backupFile);
9970
- console.info(`\u{1F4E6} Created backup: ${basename(backupFile)}`);
12245
+ console.log(`\u{1F4E6} Created backup: ${basename(backupFile)}`);
9971
12246
  await copyFile(sourceFile, targetFile);
9972
- console.info(`\u{1F504} Replaced file with template version (backup created)`);
12247
+ console.log(`\u{1F504} Replaced file with template version (backup created)`);
9973
12248
  }
9974
12249
  async function renameAndCopyFile(sourceFile, targetFile) {
9975
12250
  let counter = 1;
@@ -9983,7 +12258,7 @@ async function renameAndCopyFile(sourceFile, targetFile) {
9983
12258
  counter++;
9984
12259
  }
9985
12260
  await copyFile(sourceFile, uniqueTargetFile);
9986
- console.info(`\u{1F4DD} Copied with unique name: ${basename(uniqueTargetFile)}`);
12261
+ console.log(`\u{1F4DD} Copied with unique name: ${basename(uniqueTargetFile)}`);
9987
12262
  return uniqueTargetFile;
9988
12263
  }
9989
12264
  var isValidMastraLanguageModel = (model) => {
@@ -10032,7 +12307,7 @@ var mergeGitignoreFiles = (targetContent, templateContent, templateSlug) => {
10032
12307
  if (!hasConflict) {
10033
12308
  newEntries.push(trimmed);
10034
12309
  } else {
10035
- console.info(`\u26A0 Skipping conflicting .gitignore rule: ${trimmed} (conflicts with existing rule)`);
12310
+ console.log(`\u26A0 Skipping conflicting .gitignore rule: ${trimmed} (conflicts with existing rule)`);
10036
12311
  }
10037
12312
  }
10038
12313
  }
@@ -10067,7 +12342,7 @@ var mergeEnvFiles = (targetContent, templateVariables, templateSlug) => {
10067
12342
  if (!existingVars.has(key)) {
10068
12343
  newVars.push({ key, value });
10069
12344
  } else {
10070
- console.info(`\u26A0 Skipping existing environment variable: ${key} (already exists in .env)`);
12345
+ console.log(`\u26A0 Skipping existing environment variable: ${key} (already exists in .env)`);
10071
12346
  }
10072
12347
  }
10073
12348
  if (newVars.length === 0) {
@@ -10088,7 +12363,7 @@ var detectAISDKVersion = async (projectPath) => {
10088
12363
  try {
10089
12364
  const packageJsonPath = join(projectPath, "package.json");
10090
12365
  if (!existsSync(packageJsonPath)) {
10091
- console.info("No package.json found, defaulting to v2");
12366
+ console.log("No package.json found, defaulting to v2");
10092
12367
  return "v2";
10093
12368
  }
10094
12369
  const packageContent = await readFile(packageJsonPath, "utf-8");
@@ -10106,16 +12381,16 @@ var detectAISDKVersion = async (projectPath) => {
10106
12381
  if (versionMatch) {
10107
12382
  const majorVersion = parseInt(versionMatch[1]);
10108
12383
  if (majorVersion >= 2) {
10109
- console.info(`Detected ${pkg} v${majorVersion} -> using v2 specification`);
12384
+ console.log(`Detected ${pkg} v${majorVersion} -> using v2 specification`);
10110
12385
  return "v2";
10111
12386
  } else {
10112
- console.info(`Detected ${pkg} v${majorVersion} -> using v1 specification`);
12387
+ console.log(`Detected ${pkg} v${majorVersion} -> using v1 specification`);
10113
12388
  return "v1";
10114
12389
  }
10115
12390
  }
10116
12391
  }
10117
12392
  }
10118
- console.info("No AI SDK version detected, defaulting to v2");
12393
+ console.log("No AI SDK version detected, defaulting to v2");
10119
12394
  return "v2";
10120
12395
  } catch (error) {
10121
12396
  console.warn(`Failed to detect AI SDK version: ${error instanceof Error ? error.message : String(error)}`);
@@ -10176,7 +12451,7 @@ var createModelInstance = async (provider, modelId, version = "v2") => {
10176
12451
  return null;
10177
12452
  }
10178
12453
  const modelInstance = await providerFn();
10179
- console.info(`Created ${provider} model instance (${version}): ${modelId}`);
12454
+ console.log(`Created ${provider} model instance (${version}): ${modelId}`);
10180
12455
  return modelInstance;
10181
12456
  } catch (error) {
10182
12457
  console.error(`Failed to create model instance: ${error instanceof Error ? error.message : String(error)}`);
@@ -10190,7 +12465,7 @@ var resolveModel = async ({
10190
12465
  }) => {
10191
12466
  const modelFromContext = runtimeContext.get("model");
10192
12467
  if (modelFromContext) {
10193
- console.info("Using model from runtime context");
12468
+ console.log("Using model from runtime context");
10194
12469
  if (isValidMastraLanguageModel(modelFromContext)) {
10195
12470
  return modelFromContext;
10196
12471
  }
@@ -10200,7 +12475,7 @@ var resolveModel = async ({
10200
12475
  }
10201
12476
  const selectedModel = runtimeContext.get("selectedModel");
10202
12477
  if (selectedModel?.provider && selectedModel?.modelId && projectPath) {
10203
- console.info(`Resolving selected model: ${selectedModel.provider}/${selectedModel.modelId}`);
12478
+ console.log(`Resolving selected model: ${selectedModel.provider}/${selectedModel.modelId}`);
10204
12479
  const version = await detectAISDKVersion(projectPath);
10205
12480
  const modelInstance = await createModelInstance(selectedModel.provider, selectedModel.modelId, version);
10206
12481
  if (modelInstance) {
@@ -10208,7 +12483,7 @@ var resolveModel = async ({
10208
12483
  return modelInstance;
10209
12484
  }
10210
12485
  }
10211
- console.info("Using default model");
12486
+ console.log("Using default model");
10212
12487
  return defaultModel;
10213
12488
  };
10214
12489
  var AgentBuilderDefaults = class _AgentBuilderDefaults {
@@ -11242,7 +13517,7 @@ export const mastra = new Mastra({
11242
13517
  error: stderr
11243
13518
  };
11244
13519
  } catch (error) {
11245
- console.error(error);
13520
+ console.log(error);
11246
13521
  return {
11247
13522
  success: false,
11248
13523
  message: `Failed to create project: ${error instanceof Error ? error.message : String(error)}`
@@ -11257,7 +13532,7 @@ export const mastra = new Mastra({
11257
13532
  projectPath
11258
13533
  }) {
11259
13534
  try {
11260
- console.info("Installing packages:", JSON.stringify(packages, null, 2));
13535
+ console.log("Installing packages:", JSON.stringify(packages, null, 2));
11261
13536
  const packageStrings = packages.map((p) => `${p.name}`);
11262
13537
  await spawnSWPM(projectPath || "", "add", packageStrings);
11263
13538
  return {
@@ -11281,7 +13556,7 @@ export const mastra = new Mastra({
11281
13556
  projectPath
11282
13557
  }) {
11283
13558
  try {
11284
- console.info("Upgrading specific packages:", JSON.stringify(packages, null, 2));
13559
+ console.log("Upgrading specific packages:", JSON.stringify(packages, null, 2));
11285
13560
  let packageNames = [];
11286
13561
  if (packages && packages.length > 0) {
11287
13562
  packageNames = packages.map((p) => `${p.name}`);
@@ -11719,14 +13994,14 @@ export const mastra = new Mastra({
11719
13994
  noEmit: true
11720
13995
  };
11721
13996
  const host = {
11722
- getSourceFile: (name19) => name19 === fileName ? sourceFile : void 0,
13997
+ getSourceFile: (name20) => name20 === fileName ? sourceFile : void 0,
11723
13998
  writeFile: () => {
11724
13999
  },
11725
14000
  getCurrentDirectory: () => "",
11726
14001
  getDirectories: () => [],
11727
- fileExists: (name19) => name19 === fileName,
11728
- readFile: (name19) => name19 === fileName ? fileContent : void 0,
11729
- getCanonicalFileName: (name19) => name19,
14002
+ fileExists: (name20) => name20 === fileName,
14003
+ readFile: (name20) => name20 === fileName ? fileContent : void 0,
14004
+ getCanonicalFileName: (name20) => name20,
11730
14005
  useCaseSensitiveFileNames: () => true,
11731
14006
  getNewLine: () => "\n",
11732
14007
  getDefaultLibFileName: () => "lib.d.ts"
@@ -12872,13 +15147,13 @@ var analyzePackageStep = createStep({
12872
15147
  inputSchema: CloneTemplateResultSchema,
12873
15148
  outputSchema: PackageAnalysisSchema,
12874
15149
  execute: async ({ inputData }) => {
12875
- console.info("Analyzing template package.json...");
15150
+ console.log("Analyzing template package.json...");
12876
15151
  const { templateDir } = inputData;
12877
15152
  const packageJsonPath = join(templateDir, "package.json");
12878
15153
  try {
12879
15154
  const packageJsonContent = await readFile(packageJsonPath, "utf-8");
12880
15155
  const packageJson = JSON.parse(packageJsonContent);
12881
- console.info("Template package.json:", JSON.stringify(packageJson, null, 2));
15156
+ console.log("Template package.json:", JSON.stringify(packageJson, null, 2));
12882
15157
  return {
12883
15158
  dependencies: packageJson.dependencies || {},
12884
15159
  devDependencies: packageJson.devDependencies || {},
@@ -12914,7 +15189,7 @@ var discoverUnitsStep = createStep({
12914
15189
  const { templateDir } = inputData;
12915
15190
  const targetPath = resolveTargetPath(inputData, runtimeContext);
12916
15191
  const tools = await AgentBuilderDefaults.DEFAULT_TOOLS(templateDir);
12917
- console.info("targetPath", targetPath);
15192
+ console.log("targetPath", targetPath);
12918
15193
  const model = await resolveModel({ runtimeContext, projectPath: targetPath, defaultModel: openai("gpt-4.1") });
12919
15194
  try {
12920
15195
  const agent = new Agent({
@@ -13002,7 +15277,7 @@ Return the actual exported names of the units, as well as the file names.`,
13002
15277
  template.other?.forEach((otherId) => {
13003
15278
  units.push({ kind: "other", id: otherId.name, file: otherId.file });
13004
15279
  });
13005
- console.info("Discovered units:", JSON.stringify(units, null, 2));
15280
+ console.log("Discovered units:", JSON.stringify(units, null, 2));
13006
15281
  if (units.length === 0) {
13007
15282
  throw new Error(`No Mastra units (agents, workflows, tools) found in template.
13008
15283
  Possible causes:
@@ -13078,7 +15353,7 @@ var packageMergeStep = createStep({
13078
15353
  inputSchema: PackageMergeInputSchema,
13079
15354
  outputSchema: PackageMergeResultSchema,
13080
15355
  execute: async ({ inputData, runtimeContext }) => {
13081
- console.info("Package merge step starting...");
15356
+ console.log("Package merge step starting...");
13082
15357
  const { slug, packageInfo } = inputData;
13083
15358
  const targetPath = resolveTargetPath(inputData, runtimeContext);
13084
15359
  try {
@@ -13106,25 +15381,25 @@ var packageMergeStep = createStep({
13106
15381
  const tplDevDeps = ensureObj(packageInfo.devDependencies);
13107
15382
  const tplPeerDeps = ensureObj(packageInfo.peerDependencies);
13108
15383
  const tplScripts = ensureObj(packageInfo.scripts);
13109
- const existsAnywhere = (name19) => name19 in targetPkg.dependencies || name19 in targetPkg.devDependencies || name19 in targetPkg.peerDependencies;
13110
- for (const [name19, ver] of Object.entries(tplDeps)) {
13111
- if (!existsAnywhere(name19)) {
13112
- targetPkg.dependencies[name19] = String(ver);
15384
+ const existsAnywhere = (name20) => name20 in targetPkg.dependencies || name20 in targetPkg.devDependencies || name20 in targetPkg.peerDependencies;
15385
+ for (const [name20, ver] of Object.entries(tplDeps)) {
15386
+ if (!existsAnywhere(name20)) {
15387
+ targetPkg.dependencies[name20] = String(ver);
13113
15388
  }
13114
15389
  }
13115
- for (const [name19, ver] of Object.entries(tplDevDeps)) {
13116
- if (!existsAnywhere(name19)) {
13117
- targetPkg.devDependencies[name19] = String(ver);
15390
+ for (const [name20, ver] of Object.entries(tplDevDeps)) {
15391
+ if (!existsAnywhere(name20)) {
15392
+ targetPkg.devDependencies[name20] = String(ver);
13118
15393
  }
13119
15394
  }
13120
- for (const [name19, ver] of Object.entries(tplPeerDeps)) {
13121
- if (!(name19 in targetPkg.peerDependencies)) {
13122
- targetPkg.peerDependencies[name19] = String(ver);
15395
+ for (const [name20, ver] of Object.entries(tplPeerDeps)) {
15396
+ if (!(name20 in targetPkg.peerDependencies)) {
15397
+ targetPkg.peerDependencies[name20] = String(ver);
13123
15398
  }
13124
15399
  }
13125
15400
  const prefix = `template:${slug}:`;
13126
- for (const [name19, cmd] of Object.entries(tplScripts)) {
13127
- const newKey = `${prefix}${name19}`;
15401
+ for (const [name20, cmd] of Object.entries(tplScripts)) {
15402
+ const newKey = `${prefix}${name20}`;
13128
15403
  if (!(newKey in targetPkg.scripts)) {
13129
15404
  targetPkg.scripts[newKey] = String(cmd);
13130
15405
  }
@@ -13155,7 +15430,7 @@ var installStep = createStep({
13155
15430
  inputSchema: InstallInputSchema,
13156
15431
  outputSchema: InstallResultSchema,
13157
15432
  execute: async ({ inputData, runtimeContext }) => {
13158
- console.info("Running install step...");
15433
+ console.log("Running install step...");
13159
15434
  const targetPath = resolveTargetPath(inputData, runtimeContext);
13160
15435
  try {
13161
15436
  await spawnSWPM(targetPath, "install", []);
@@ -13183,7 +15458,7 @@ var programmaticFileCopyStep = createStep({
13183
15458
  inputSchema: FileCopyInputSchema,
13184
15459
  outputSchema: FileCopyResultSchema,
13185
15460
  execute: async ({ inputData, runtimeContext }) => {
13186
- console.info("Programmatic file copy step starting...");
15461
+ console.log("Programmatic file copy step starting...");
13187
15462
  const { orderedUnits, templateDir, commitSha, slug } = inputData;
13188
15463
  const targetPath = resolveTargetPath(inputData, runtimeContext);
13189
15464
  try {
@@ -13209,9 +15484,9 @@ var programmaticFileCopyStep = createStep({
13209
15484
  return "unknown";
13210
15485
  }
13211
15486
  };
13212
- const convertNaming = (name19, convention) => {
13213
- const baseName = basename(name19, extname(name19));
13214
- const ext = extname(name19);
15487
+ const convertNaming = (name20, convention) => {
15488
+ const baseName = basename(name20, extname(name20));
15489
+ const ext = extname(name20);
13215
15490
  switch (convention) {
13216
15491
  case "camelCase":
13217
15492
  return baseName.replace(/[-_]/g, "").replace(/([A-Z])/g, (match, p1, offset) => offset === 0 ? p1.toLowerCase() : p1) + ext;
@@ -13222,11 +15497,11 @@ var programmaticFileCopyStep = createStep({
13222
15497
  case "PascalCase":
13223
15498
  return baseName.replace(/[-_]/g, "").replace(/^[a-z]/, (match) => match.toUpperCase()) + ext;
13224
15499
  default:
13225
- return name19;
15500
+ return name20;
13226
15501
  }
13227
15502
  };
13228
15503
  for (const unit of orderedUnits) {
13229
- console.info(`Processing ${unit.kind} unit "${unit.id}" from file "${unit.file}"`);
15504
+ console.log(`Processing ${unit.kind} unit "${unit.id}" from file "${unit.file}"`);
13230
15505
  let sourceFile;
13231
15506
  let resolvedUnitFile;
13232
15507
  if (unit.file.includes("/")) {
@@ -13257,7 +15532,7 @@ var programmaticFileCopyStep = createStep({
13257
15532
  }
13258
15533
  const targetDir = dirname(resolvedUnitFile);
13259
15534
  const namingConvention = await analyzeNamingConvention(targetDir);
13260
- console.info(`Detected naming convention in ${targetDir}: ${namingConvention}`);
15535
+ console.log(`Detected naming convention in ${targetDir}: ${namingConvention}`);
13261
15536
  const hasExtension = extname(unit.id) !== "";
13262
15537
  const baseId = hasExtension ? basename(unit.id, extname(unit.id)) : unit.id;
13263
15538
  const fileExtension = extname(unit.file);
@@ -13265,7 +15540,7 @@ var programmaticFileCopyStep = createStep({
13265
15540
  const targetFile = resolve$1(targetPath, targetDir, convertedFileName);
13266
15541
  if (existsSync(targetFile)) {
13267
15542
  const strategy = determineConflictStrategy();
13268
- console.info(`File exists: ${convertedFileName}, using strategy: ${strategy}`);
15543
+ console.log(`File exists: ${convertedFileName}, using strategy: ${strategy}`);
13269
15544
  switch (strategy) {
13270
15545
  case "skip":
13271
15546
  conflicts.push({
@@ -13274,7 +15549,7 @@ var programmaticFileCopyStep = createStep({
13274
15549
  sourceFile: unit.file,
13275
15550
  targetFile: `${targetDir}/${convertedFileName}`
13276
15551
  });
13277
- console.info(`\u23ED\uFE0F Skipped ${unit.kind} "${unit.id}": file already exists`);
15552
+ console.log(`\u23ED\uFE0F Skipped ${unit.kind} "${unit.id}": file already exists`);
13278
15553
  continue;
13279
15554
  case "backup-and-replace":
13280
15555
  try {
@@ -13284,7 +15559,7 @@ var programmaticFileCopyStep = createStep({
13284
15559
  destination: targetFile,
13285
15560
  unit: { kind: unit.kind, id: unit.id }
13286
15561
  });
13287
- console.info(
15562
+ console.log(
13288
15563
  `\u{1F504} Replaced ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${convertedFileName} (backup created)`
13289
15564
  );
13290
15565
  continue;
@@ -13305,7 +15580,7 @@ var programmaticFileCopyStep = createStep({
13305
15580
  destination: uniqueTargetFile,
13306
15581
  unit: { kind: unit.kind, id: unit.id }
13307
15582
  });
13308
- console.info(`\u{1F4DD} Renamed ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${basename(uniqueTargetFile)}`);
15583
+ console.log(`\u{1F4DD} Renamed ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${basename(uniqueTargetFile)}`);
13309
15584
  continue;
13310
15585
  } catch (renameError) {
13311
15586
  conflicts.push({
@@ -13334,7 +15609,7 @@ var programmaticFileCopyStep = createStep({
13334
15609
  destination: targetFile,
13335
15610
  unit: { kind: unit.kind, id: unit.id }
13336
15611
  });
13337
- console.info(`\u2713 Copied ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${convertedFileName}`);
15612
+ console.log(`\u2713 Copied ${unit.kind} "${unit.id}": ${unit.file} \u2192 ${convertedFileName}`);
13338
15613
  } catch (copyError) {
13339
15614
  conflicts.push({
13340
15615
  unit: { kind: unit.kind, id: unit.id },
@@ -13355,7 +15630,7 @@ var programmaticFileCopyStep = createStep({
13355
15630
  destination: targetTsconfig,
13356
15631
  unit: { kind: "other", id: "tsconfig.json" }
13357
15632
  });
13358
- console.info("\u2713 Copied tsconfig.json from template to target");
15633
+ console.log("\u2713 Copied tsconfig.json from template to target");
13359
15634
  } else {
13360
15635
  const minimalTsconfig = {
13361
15636
  compilerOptions: {
@@ -13377,7 +15652,7 @@ var programmaticFileCopyStep = createStep({
13377
15652
  destination: targetTsconfig,
13378
15653
  unit: { kind: "other", id: "tsconfig.json" }
13379
15654
  });
13380
- console.info("\u2713 Generated minimal tsconfig.json in target");
15655
+ console.log("\u2713 Generated minimal tsconfig.json in target");
13381
15656
  }
13382
15657
  }
13383
15658
  } catch (e2) {
@@ -13402,7 +15677,7 @@ var programmaticFileCopyStep = createStep({
13402
15677
  destination: targetMastraIndex,
13403
15678
  unit: { kind: "other", id: "mastra-index" }
13404
15679
  });
13405
- console.info("\u2713 Copied Mastra index file from template");
15680
+ console.log("\u2713 Copied Mastra index file from template");
13406
15681
  }
13407
15682
  }
13408
15683
  } catch (e2) {
@@ -13426,7 +15701,7 @@ var programmaticFileCopyStep = createStep({
13426
15701
  destination: targetGitignore,
13427
15702
  unit: { kind: "other", id: "gitignore" }
13428
15703
  });
13429
- console.info("\u2713 Copied .gitignore from template to target");
15704
+ console.log("\u2713 Copied .gitignore from template to target");
13430
15705
  } else {
13431
15706
  const targetContent = await readFile(targetGitignore, "utf-8");
13432
15707
  const templateContent = await readFile(templateGitignore, "utf-8");
@@ -13439,9 +15714,9 @@ var programmaticFileCopyStep = createStep({
13439
15714
  destination: targetGitignore,
13440
15715
  unit: { kind: "other", id: "gitignore-merge" }
13441
15716
  });
13442
- console.info(`\u2713 Merged template .gitignore entries into existing .gitignore (${addedLines} new entries)`);
15717
+ console.log(`\u2713 Merged template .gitignore entries into existing .gitignore (${addedLines} new entries)`);
13443
15718
  } else {
13444
- console.info("\u2139 No new .gitignore entries to add from template");
15719
+ console.log("\u2139 No new .gitignore entries to add from template");
13445
15720
  }
13446
15721
  }
13447
15722
  }
@@ -13469,7 +15744,7 @@ var programmaticFileCopyStep = createStep({
13469
15744
  destination: targetEnv,
13470
15745
  unit: { kind: "other", id: "env" }
13471
15746
  });
13472
- console.info(`\u2713 Created .env file with ${Object.keys(variables).length} template variables`);
15747
+ console.log(`\u2713 Created .env file with ${Object.keys(variables).length} template variables`);
13473
15748
  } else {
13474
15749
  const targetContent = await readFile(targetEnv, "utf-8");
13475
15750
  const mergedContent = mergeEnvFiles(targetContent, variables, slug);
@@ -13481,9 +15756,9 @@ var programmaticFileCopyStep = createStep({
13481
15756
  destination: targetEnv,
13482
15757
  unit: { kind: "other", id: "env-merge" }
13483
15758
  });
13484
- console.info(`\u2713 Merged new environment variables into existing .env file (${addedLines} new entries)`);
15759
+ console.log(`\u2713 Merged new environment variables into existing .env file (${addedLines} new entries)`);
13485
15760
  } else {
13486
- console.info("\u2139 No new environment variables to add (all already exist in .env)");
15761
+ console.log("\u2139 No new environment variables to add (all already exist in .env)");
13487
15762
  }
13488
15763
  }
13489
15764
  }
@@ -13504,13 +15779,13 @@ var programmaticFileCopyStep = createStep({
13504
15779
  fileList,
13505
15780
  { skipIfNoStaged: true }
13506
15781
  );
13507
- console.info(`\u2713 Committed ${copiedFiles.length} copied files`);
15782
+ console.log(`\u2713 Committed ${copiedFiles.length} copied files`);
13508
15783
  } catch (commitError) {
13509
15784
  console.warn("Failed to commit copied files:", commitError);
13510
15785
  }
13511
15786
  }
13512
15787
  const message = `Programmatic file copy completed. Copied ${copiedFiles.length} files, ${conflicts.length} conflicts detected.`;
13513
- console.info(message);
15788
+ console.log(message);
13514
15789
  return {
13515
15790
  success: true,
13516
15791
  copiedFiles,
@@ -13535,7 +15810,7 @@ var intelligentMergeStep = createStep({
13535
15810
  inputSchema: IntelligentMergeInputSchema,
13536
15811
  outputSchema: IntelligentMergeResultSchema,
13537
15812
  execute: async ({ inputData, runtimeContext }) => {
13538
- console.info("Intelligent merge step starting...");
15813
+ console.log("Intelligent merge step starting...");
13539
15814
  const { conflicts, copiedFiles, commitSha, slug, templateDir, branchName } = inputData;
13540
15815
  const targetPath = resolveTargetPath(inputData, runtimeContext);
13541
15816
  try {
@@ -13662,8 +15937,8 @@ Template information:
13662
15937
  const registrableFiles = copiedFiles.filter((f) => registrableKinds.has(f.unit.kind));
13663
15938
  const targetMastraIndex = resolve$1(targetPath, "src/mastra/index.ts");
13664
15939
  const mastraIndexExists = existsSync(targetMastraIndex);
13665
- console.info(`Mastra index exists: ${mastraIndexExists} at ${targetMastraIndex}`);
13666
- console.info(
15940
+ console.log(`Mastra index exists: ${mastraIndexExists} at ${targetMastraIndex}`);
15941
+ console.log(
13667
15942
  "Registrable components:",
13668
15943
  registrableFiles.map((f) => `${f.unit.kind}:${f.unit.id}`)
13669
15944
  );
@@ -13677,7 +15952,7 @@ Template information:
13677
15952
  notes: `Components to register: ${registrableFiles.map((f) => `${f.unit.kind}:${f.unit.id}`).join(", ")}`
13678
15953
  });
13679
15954
  }
13680
- console.info(`Creating task list with ${tasks.length} tasks...`);
15955
+ console.log(`Creating task list with ${tasks.length} tasks...`);
13681
15956
  await AgentBuilderDefaults.manageTaskList({ action: "create", tasks });
13682
15957
  await logGitState(targetPath, "before intelligent merge");
13683
15958
  const prompt = `
@@ -13729,12 +16004,12 @@ Start by listing your tasks and work through them systematically!
13729
16004
  for await (const chunk of result.fullStream) {
13730
16005
  if (chunk.type === "step-finish" || chunk.type === "step-start") {
13731
16006
  const chunkData = "payload" in chunk ? chunk.payload : chunk;
13732
- console.info({
16007
+ console.log({
13733
16008
  type: chunk.type,
13734
16009
  msgId: chunkData.messageId
13735
16010
  });
13736
16011
  } else {
13737
- console.info(JSON.stringify(chunk, null, 2));
16012
+ console.log(JSON.stringify(chunk, null, 2));
13738
16013
  if (chunk.type === "tool-result") {
13739
16014
  const chunkData = "payload" in chunk ? chunk.payload : chunk;
13740
16015
  if (chunkData.toolName === "manageTaskList") {
@@ -13748,7 +16023,7 @@ Start by listing your tasks and work through them systematically!
13748
16023
  content: toolResult.content || "",
13749
16024
  notes: toolResult.notes
13750
16025
  });
13751
- console.info(`\u{1F4CB} Task completed: ${toolResult.taskId} - ${toolResult.content}`);
16026
+ console.log(`\u{1F4CB} Task completed: ${toolResult.taskId} - ${toolResult.content}`);
13752
16027
  }
13753
16028
  } catch (parseError) {
13754
16029
  console.warn("Failed to parse task management result:", parseError);
@@ -13803,12 +16078,12 @@ var validationAndFixStep = createStep({
13803
16078
  inputSchema: ValidationFixInputSchema,
13804
16079
  outputSchema: ValidationFixResultSchema,
13805
16080
  execute: async ({ inputData, runtimeContext }) => {
13806
- console.info("Validation and fix step starting...");
16081
+ console.log("Validation and fix step starting...");
13807
16082
  const { commitSha, slug, orderedUnits, templateDir, copiedFiles, conflictsResolved, maxIterations = 5 } = inputData;
13808
16083
  const targetPath = resolveTargetPath(inputData, runtimeContext);
13809
16084
  const hasChanges = copiedFiles.length > 0 || conflictsResolved && conflictsResolved.length > 0;
13810
16085
  if (!hasChanges) {
13811
- console.info("\u23ED\uFE0F Skipping validation - no files copied or conflicts resolved");
16086
+ console.log("\u23ED\uFE0F Skipping validation - no files copied or conflicts resolved");
13812
16087
  return {
13813
16088
  success: true,
13814
16089
  applied: false,
@@ -13820,7 +16095,7 @@ var validationAndFixStep = createStep({
13820
16095
  }
13821
16096
  };
13822
16097
  }
13823
- console.info(
16098
+ console.log(
13824
16099
  `\u{1F4CB} Changes detected: ${copiedFiles.length} files copied, ${conflictsResolved?.length || 0} conflicts resolved`
13825
16100
  );
13826
16101
  let currentIteration = 1;
@@ -13946,7 +16221,7 @@ Be thorough and methodical. Always use listDirectory to verify actual file exist
13946
16221
  executeCommand: allTools.executeCommand
13947
16222
  }
13948
16223
  });
13949
- console.info("Starting validation and fix agent with internal loop...");
16224
+ console.log("Starting validation and fix agent with internal loop...");
13950
16225
  let validationResults = {
13951
16226
  valid: false,
13952
16227
  errorsFixed: 0,
@@ -13957,7 +16232,7 @@ Be thorough and methodical. Always use listDirectory to verify actual file exist
13957
16232
  // Store the actual error details
13958
16233
  };
13959
16234
  while (validationResults.remainingErrors > 0 && currentIteration <= maxIterations) {
13960
- console.info(`
16235
+ console.log(`
13961
16236
  === Validation Iteration ${currentIteration} ===`);
13962
16237
  const iterationPrompt = currentIteration === 1 ? `Please validate the template integration and fix any errors found in the project at ${targetPath}. The template "${slug}" (${commitSha.substring(0, 7)}) was just integrated and may have validation issues that need fixing.
13963
16238
 
@@ -13977,13 +16252,13 @@ Previous iterations may have fixed some issues, so start by re-running validateC
13977
16252
  for await (const chunk of result.fullStream) {
13978
16253
  if (chunk.type === "step-finish" || chunk.type === "step-start") {
13979
16254
  const chunkData = "payload" in chunk ? chunk.payload : chunk;
13980
- console.info({
16255
+ console.log({
13981
16256
  type: chunk.type,
13982
16257
  msgId: chunkData.messageId,
13983
16258
  iteration: currentIteration
13984
16259
  });
13985
16260
  } else {
13986
- console.info(JSON.stringify(chunk, null, 2));
16261
+ console.log(JSON.stringify(chunk, null, 2));
13987
16262
  }
13988
16263
  if (chunk.type === "tool-result") {
13989
16264
  const chunkData = "payload" in chunk ? chunk.payload : chunk;
@@ -13992,7 +16267,7 @@ Previous iterations may have fixed some issues, so start by re-running validateC
13992
16267
  lastValidationResult = toolResult;
13993
16268
  if (toolResult?.summary) {
13994
16269
  iterationErrors = toolResult.summary.totalErrors || 0;
13995
- console.info(`Iteration ${currentIteration}: Found ${iterationErrors} errors`);
16270
+ console.log(`Iteration ${currentIteration}: Found ${iterationErrors} errors`);
13996
16271
  }
13997
16272
  }
13998
16273
  }
@@ -14004,12 +16279,12 @@ Previous iterations may have fixed some issues, so start by re-running validateC
14004
16279
  if (iterationErrors > 0 && lastValidationResult?.errors) {
14005
16280
  validationResults.lastValidationErrors = lastValidationResult.errors;
14006
16281
  }
14007
- console.info(`Iteration ${currentIteration} complete: ${iterationErrors} errors remaining`);
16282
+ console.log(`Iteration ${currentIteration} complete: ${iterationErrors} errors remaining`);
14008
16283
  if (iterationErrors === 0) {
14009
- console.info(`\u2705 All validation issues resolved in ${currentIteration} iterations!`);
16284
+ console.log(`\u2705 All validation issues resolved in ${currentIteration} iterations!`);
14010
16285
  break;
14011
16286
  } else if (currentIteration >= maxIterations) {
14012
- console.info(`\u26A0\uFE0F Max iterations (${maxIterations}) reached. ${iterationErrors} errors still remaining.`);
16287
+ console.log(`\u26A0\uFE0F Max iterations (${maxIterations}) reached. ${iterationErrors} errors still remaining.`);
14013
16288
  break;
14014
16289
  }
14015
16290
  currentIteration++;
@@ -14054,7 +16329,7 @@ Previous iterations may have fixed some issues, so start by re-running validateC
14054
16329
  } finally {
14055
16330
  try {
14056
16331
  await rm(templateDir, { recursive: true, force: true });
14057
- console.info(`\u2713 Cleaned up template directory: ${templateDir}`);
16332
+ console.log(`\u2713 Cleaned up template directory: ${templateDir}`);
14058
16333
  } catch (cleanupError) {
14059
16334
  console.warn("Failed to cleanup template directory:", cleanupError);
14060
16335
  }
@@ -14530,10 +16805,12 @@ var planningIterationStep = createStep({
14530
16805
  research,
14531
16806
  userAnswers
14532
16807
  } = inputData;
14533
- console.info("Starting planning iteration...");
16808
+ console.log("Starting planning iteration...");
14534
16809
  const qaKey = "workflow-builder-qa";
14535
16810
  let storedQAPairs = runtimeContext.get(qaKey) || [];
14536
16811
  const newAnswers = { ...userAnswers || {}, ...resumeData?.answers || {} };
16812
+ console.log("before", storedQAPairs);
16813
+ console.log("newAnswers", newAnswers);
14537
16814
  if (Object.keys(newAnswers).length > 0) {
14538
16815
  storedQAPairs = storedQAPairs.map((pair) => {
14539
16816
  if (newAnswers[pair.question.id]) {
@@ -14547,6 +16824,10 @@ var planningIterationStep = createStep({
14547
16824
  });
14548
16825
  runtimeContext.set(qaKey, storedQAPairs);
14549
16826
  }
16827
+ console.log("after", storedQAPairs);
16828
+ console.log(
16829
+ `Current Q&A state: ${storedQAPairs.length} question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
16830
+ );
14550
16831
  try {
14551
16832
  const model = await resolveModel({ runtimeContext });
14552
16833
  const planningAgent = new Agent({
@@ -14594,8 +16875,8 @@ var planningIterationStep = createStep({
14594
16875
  };
14595
16876
  }
14596
16877
  if (planResult.questions && planResult.questions.length > 0 && !planResult.planComplete) {
14597
- console.info(`Planning needs user clarification: ${planResult.questions.length} questions`);
14598
- console.info(planResult.questions);
16878
+ console.log(`Planning needs user clarification: ${planResult.questions.length} questions`);
16879
+ console.log(planResult.questions);
14599
16880
  const newQAPairs = planResult.questions.map((question) => ({
14600
16881
  question,
14601
16882
  answer: null,
@@ -14604,7 +16885,7 @@ var planningIterationStep = createStep({
14604
16885
  }));
14605
16886
  storedQAPairs = [...storedQAPairs, ...newQAPairs];
14606
16887
  runtimeContext.set(qaKey, storedQAPairs);
14607
- console.info(
16888
+ console.log(
14608
16889
  `Updated Q&A state: ${storedQAPairs.length} total question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
14609
16890
  );
14610
16891
  return suspend({
@@ -14616,9 +16897,9 @@ var planningIterationStep = createStep({
14616
16897
  }
14617
16898
  });
14618
16899
  }
14619
- console.info(`Planning complete with ${planResult.tasks.length} tasks`);
16900
+ console.log(`Planning complete with ${planResult.tasks.length} tasks`);
14620
16901
  runtimeContext.set(qaKey, storedQAPairs);
14621
- console.info(
16902
+ console.log(
14622
16903
  `Final Q&A state: ${storedQAPairs.length} total question-answer pairs, ${storedQAPairs.filter((p) => p.answer).length} answered`
14623
16904
  );
14624
16905
  return {
@@ -14661,7 +16942,7 @@ var taskApprovalStep = createStep({
14661
16942
  execute: async ({ inputData, resumeData, suspend }) => {
14662
16943
  const { tasks } = inputData;
14663
16944
  if (!resumeData?.approved && resumeData?.approved !== false) {
14664
- console.info(`Requesting user approval for ${tasks.length} tasks`);
16945
+ console.log(`Requesting user approval for ${tasks.length} tasks`);
14665
16946
  const summary = `Task List for Approval:
14666
16947
 
14667
16948
  ${tasks.length} tasks planned:
@@ -14674,14 +16955,14 @@ ${tasks.map((task, i) => `${i + 1}. [${task.priority.toUpperCase()}] ${task.cont
14674
16955
  });
14675
16956
  }
14676
16957
  if (resumeData.approved) {
14677
- console.info("Task list approved by user");
16958
+ console.log("Task list approved by user");
14678
16959
  return {
14679
16960
  approved: true,
14680
16961
  tasks,
14681
16962
  message: "Task list approved, ready for execution"
14682
16963
  };
14683
16964
  } else {
14684
- console.info("Task list rejected by user");
16965
+ console.log("Task list rejected by user");
14685
16966
  return {
14686
16967
  approved: false,
14687
16968
  tasks,
@@ -14698,7 +16979,7 @@ var planningAndApprovalWorkflow = createWorkflow({
14698
16979
  outputSchema: TaskApprovalOutputSchema,
14699
16980
  steps: [planningIterationStep, taskApprovalStep]
14700
16981
  }).dountil(planningIterationStep, async ({ inputData }) => {
14701
- console.info(`Sub-workflow planning check: planComplete=${inputData.planComplete}`);
16982
+ console.log(`Sub-workflow planning check: planComplete=${inputData.planComplete}`);
14702
16983
  return inputData.planComplete === true;
14703
16984
  }).map(async ({ inputData }) => {
14704
16985
  return {
@@ -15149,12 +17430,12 @@ var workflowDiscoveryStep = createStep({
15149
17430
  inputSchema: WorkflowBuilderInputSchema,
15150
17431
  outputSchema: WorkflowDiscoveryResultSchema,
15151
17432
  execute: async ({ inputData, runtimeContext: _runtimeContext }) => {
15152
- console.info("Starting workflow discovery...");
17433
+ console.log("Starting workflow discovery...");
15153
17434
  const { projectPath = process.cwd() } = inputData;
15154
17435
  try {
15155
17436
  const workflowsPath = join(projectPath, "src/mastra/workflows");
15156
17437
  if (!existsSync(workflowsPath)) {
15157
- console.info("No workflows directory found");
17438
+ console.log("No workflows directory found");
15158
17439
  return {
15159
17440
  success: true,
15160
17441
  workflows: [],
@@ -15183,7 +17464,7 @@ var workflowDiscoveryStep = createStep({
15183
17464
  }
15184
17465
  }
15185
17466
  }
15186
- console.info(`Discovered ${workflows.length} existing workflows`);
17467
+ console.log(`Discovered ${workflows.length} existing workflows`);
15187
17468
  return {
15188
17469
  success: true,
15189
17470
  workflows,
@@ -15208,7 +17489,7 @@ var projectDiscoveryStep = createStep({
15208
17489
  inputSchema: WorkflowDiscoveryResultSchema,
15209
17490
  outputSchema: ProjectDiscoveryResultSchema,
15210
17491
  execute: async ({ inputData: _inputData, runtimeContext: _runtimeContext }) => {
15211
- console.info("Starting project discovery...");
17492
+ console.log("Starting project discovery...");
15212
17493
  try {
15213
17494
  const projectPath = process.cwd();
15214
17495
  const projectStructure = {
@@ -15229,7 +17510,7 @@ var projectDiscoveryStep = createStep({
15229
17510
  console.warn("Failed to read package.json:", error);
15230
17511
  }
15231
17512
  }
15232
- console.info("Project discovery completed");
17513
+ console.log("Project discovery completed");
15233
17514
  return {
15234
17515
  success: true,
15235
17516
  structure: {
@@ -15270,7 +17551,7 @@ var workflowResearchStep = createStep({
15270
17551
  inputSchema: ProjectDiscoveryResultSchema,
15271
17552
  outputSchema: WorkflowResearchResultSchema,
15272
17553
  execute: async ({ inputData, runtimeContext }) => {
15273
- console.info("Starting workflow research...");
17554
+ console.log("Starting workflow research...");
15274
17555
  try {
15275
17556
  const model = await resolveModel({ runtimeContext });
15276
17557
  const researchAgent = new Agent({
@@ -15302,7 +17583,7 @@ var workflowResearchStep = createStep({
15302
17583
  error: "Research agent failed to generate valid response"
15303
17584
  };
15304
17585
  }
15305
- console.info("Research completed successfully");
17586
+ console.log("Research completed successfully");
15306
17587
  return {
15307
17588
  success: true,
15308
17589
  documentation: {
@@ -15346,12 +17627,12 @@ var taskExecutionStep = createStep({
15346
17627
  research,
15347
17628
  projectPath
15348
17629
  } = inputData;
15349
- console.info(`Starting task execution for ${action}ing workflow: ${workflowName}`);
15350
- console.info(`Executing ${tasks.length} tasks using AgentBuilder stream...`);
17630
+ console.log(`Starting task execution for ${action}ing workflow: ${workflowName}`);
17631
+ console.log(`Executing ${tasks.length} tasks using AgentBuilder stream...`);
15351
17632
  try {
15352
17633
  const model = await resolveModel({ runtimeContext });
15353
17634
  const currentProjectPath = projectPath || process.cwd();
15354
- console.info("Pre-populating taskManager with planned tasks...");
17635
+ console.log("Pre-populating taskManager with planned tasks...");
15355
17636
  const taskManagerContext = {
15356
17637
  action: "create",
15357
17638
  tasks: tasks.map((task) => ({
@@ -15364,7 +17645,7 @@ var taskExecutionStep = createStep({
15364
17645
  }))
15365
17646
  };
15366
17647
  const taskManagerResult = await AgentBuilderDefaults.manageTaskList(taskManagerContext);
15367
- console.info(`Task manager initialized with ${taskManagerResult.tasks.length} tasks`);
17648
+ console.log(`Task manager initialized with ${taskManagerResult.tasks.length} tasks`);
15368
17649
  if (!taskManagerResult.success) {
15369
17650
  throw new Error(`Failed to initialize task manager: ${taskManagerResult.message}`);
15370
17651
  }
@@ -15417,13 +17698,13 @@ ${additionalInstructions}`;
15417
17698
  const currentTaskStatus = await AgentBuilderDefaults.manageTaskList({ action: "list" });
15418
17699
  const completedTasks = currentTaskStatus.tasks.filter((task) => task.status === "completed");
15419
17700
  const pendingTasks = currentTaskStatus.tasks.filter((task) => task.status !== "completed");
15420
- console.info(`
17701
+ console.log(`
15421
17702
  === EXECUTION ITERATION ${iterationCount} ===`);
15422
- console.info(`Completed tasks: ${completedTasks.length}/${expectedTaskIds.length}`);
15423
- console.info(`Remaining tasks: ${pendingTasks.map((t2) => t2.id).join(", ")}`);
17703
+ console.log(`Completed tasks: ${completedTasks.length}/${expectedTaskIds.length}`);
17704
+ console.log(`Remaining tasks: ${pendingTasks.map((t2) => t2.id).join(", ")}`);
15424
17705
  allTasksCompleted = pendingTasks.length === 0;
15425
17706
  if (allTasksCompleted) {
15426
- console.info("All tasks completed! Breaking execution loop.");
17707
+ console.log("All tasks completed! Breaking execution loop.");
15427
17708
  break;
15428
17709
  }
15429
17710
  const iterationPrompt = iterationCount === 1 ? executionPrompt : `${workflowBuilderPrompts.executionAgent.iterationPrompt({
@@ -15447,19 +17728,19 @@ ${workflowBuilderPrompts.validation.instructions}`;
15447
17728
  finalMessage += chunk.payload.text;
15448
17729
  }
15449
17730
  if (chunk.type === "step-finish") {
15450
- console.info(finalMessage);
17731
+ console.log(finalMessage);
15451
17732
  finalMessage = "";
15452
17733
  }
15453
17734
  if (chunk.type === "tool-result") {
15454
- console.info(JSON.stringify(chunk, null, 2));
17735
+ console.log(JSON.stringify(chunk, null, 2));
15455
17736
  }
15456
17737
  if (chunk.type === "finish") {
15457
- console.info(chunk);
17738
+ console.log(chunk);
15458
17739
  }
15459
17740
  }
15460
17741
  await stream.consumeStream();
15461
17742
  finalResult = await stream.object;
15462
- console.info(`Iteration ${iterationCount} result:`, { finalResult });
17743
+ console.log(`Iteration ${iterationCount} result:`, { finalResult });
15463
17744
  if (!finalResult) {
15464
17745
  throw new Error(`No result received from agent execution on iteration ${iterationCount}`);
15465
17746
  }
@@ -15467,17 +17748,17 @@ ${workflowBuilderPrompts.validation.instructions}`;
15467
17748
  const postCompletedTasks = postIterationTaskStatus.tasks.filter((task) => task.status === "completed");
15468
17749
  const postPendingTasks = postIterationTaskStatus.tasks.filter((task) => task.status !== "completed");
15469
17750
  allTasksCompleted = postPendingTasks.length === 0;
15470
- console.info(
17751
+ console.log(
15471
17752
  `After iteration ${iterationCount}: ${postCompletedTasks.length}/${expectedTaskIds.length} tasks completed in taskManager`
15472
17753
  );
15473
17754
  if (finalResult.status === "needs_clarification" && finalResult.questions && finalResult.questions.length > 0) {
15474
- console.info(
17755
+ console.log(
15475
17756
  `Agent needs clarification on iteration ${iterationCount}: ${finalResult.questions.length} questions`
15476
17757
  );
15477
17758
  break;
15478
17759
  }
15479
17760
  if (finalResult.status === "completed" && !allTasksCompleted) {
15480
- console.info(
17761
+ console.log(
15481
17762
  `Agent claimed completion but taskManager shows pending tasks: ${postPendingTasks.map((t2) => t2.id).join(", ")}`
15482
17763
  );
15483
17764
  }
@@ -15490,8 +17771,8 @@ ${workflowBuilderPrompts.validation.instructions}`;
15490
17771
  throw new Error("No result received from agent execution");
15491
17772
  }
15492
17773
  if (finalResult.status === "needs_clarification" && finalResult.questions && finalResult.questions.length > 0) {
15493
- console.info(`Agent needs clarification: ${finalResult.questions.length} questions`);
15494
- console.info("finalResult", JSON.stringify(finalResult, null, 2));
17774
+ console.log(`Agent needs clarification: ${finalResult.questions.length} questions`);
17775
+ console.log("finalResult", JSON.stringify(finalResult, null, 2));
15495
17776
  return suspend({
15496
17777
  questions: finalResult.questions,
15497
17778
  currentProgress: finalResult.progress,
@@ -15507,7 +17788,7 @@ ${workflowBuilderPrompts.validation.instructions}`;
15507
17788
  const finalAllTasksCompleted = finalPendingTasks.length === 0;
15508
17789
  const success = finalAllTasksCompleted && !finalResult.error;
15509
17790
  const message = success ? `Successfully completed workflow ${action} - all ${tasksExpected} tasks completed after ${iterationCount} iteration(s): ${finalResult.message}` : `Workflow execution finished with issues after ${iterationCount} iteration(s): ${finalResult.message}. Completed: ${tasksCompleted}/${tasksExpected} tasks`;
15510
- console.info(message);
17791
+ console.log(message);
15511
17792
  const missingTasks = finalPendingTasks.map((task) => task.id);
15512
17793
  const validationErrors = [];
15513
17794
  if (finalResult.error) {
@@ -15575,7 +17856,7 @@ var workflowBuilderWorkflow = createWorkflow({
15575
17856
  userAnswers: void 0
15576
17857
  };
15577
17858
  }).dountil(planningAndApprovalWorkflow, async ({ inputData }) => {
15578
- console.info(`Sub-workflow check: approved=${inputData.approved}`);
17859
+ console.log(`Sub-workflow check: approved=${inputData.approved}`);
15579
17860
  return inputData.approved === true;
15580
17861
  }).map(async ({ getStepResult, getInitData }) => {
15581
17862
  const initData = getInitData();
@@ -15708,5 +17989,5 @@ var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
15708
17989
  );
15709
17990
 
15710
17991
  export { agent_builder_exports, cancelAgentBuilderActionRunHandler, createAgentBuilderActionRunHandler, getAgentBuilderActionByIdHandler, getAgentBuilderActionRunByIdHandler, getAgentBuilderActionRunExecutionResultHandler, getAgentBuilderActionRunsHandler, getAgentBuilderActionsHandler, resumeAgentBuilderActionHandler, resumeAsyncAgentBuilderActionHandler, sendAgentBuilderActionRunEventHandler, startAgentBuilderActionRunHandler, startAsyncAgentBuilderActionHandler, streamAgentBuilderActionHandler, streamVNextAgentBuilderActionHandler, watchAgentBuilderActionHandler };
15711
- //# sourceMappingURL=chunk-X7564COI.js.map
15712
- //# sourceMappingURL=chunk-X7564COI.js.map
17992
+ //# sourceMappingURL=chunk-7XNKAVVA.js.map
17993
+ //# sourceMappingURL=chunk-7XNKAVVA.js.map