@mastra/server 1.33.0-alpha.3 → 1.33.0-alpha.4

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 (166) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/_types/@internal_core/dist/index.d.ts +9 -1
  3. package/dist/{api-schema-manifest-X5B3P6OC.cjs → api-schema-manifest-MWMQI6TE.cjs} +4 -4
  4. package/dist/{api-schema-manifest-X5B3P6OC.cjs.map → api-schema-manifest-MWMQI6TE.cjs.map} +1 -1
  5. package/dist/{api-schema-manifest-JJDOQRPI.js → api-schema-manifest-OBRC34LA.js} +3 -3
  6. package/dist/{api-schema-manifest-JJDOQRPI.js.map → api-schema-manifest-OBRC34LA.js.map} +1 -1
  7. package/dist/{chunk-U5G72POG.js → chunk-247ZCPZW.js} +4 -4
  8. package/dist/{chunk-U5G72POG.js.map → chunk-247ZCPZW.js.map} +1 -1
  9. package/dist/{chunk-HFNLYENA.js → chunk-27MTROCI.js} +3 -3
  10. package/dist/{chunk-HFNLYENA.js.map → chunk-27MTROCI.js.map} +1 -1
  11. package/dist/{chunk-BZBG3MLF.cjs → chunk-2XNLZANZ.cjs} +3 -3
  12. package/dist/{chunk-BZBG3MLF.cjs.map → chunk-2XNLZANZ.cjs.map} +1 -1
  13. package/dist/{chunk-XDPKDD6J.js → chunk-3J5YIIAC.js} +3 -3
  14. package/dist/{chunk-XDPKDD6J.js.map → chunk-3J5YIIAC.js.map} +1 -1
  15. package/dist/{chunk-J6LU7NDU.js → chunk-3S77SMGK.js} +95 -4
  16. package/dist/chunk-3S77SMGK.js.map +1 -0
  17. package/dist/{chunk-EEDVUS6P.js → chunk-4OJDWKDW.js} +3 -3
  18. package/dist/{chunk-EEDVUS6P.js.map → chunk-4OJDWKDW.js.map} +1 -1
  19. package/dist/{chunk-GUWIV3ZN.cjs → chunk-4QZCXU3A.cjs} +9 -2
  20. package/dist/chunk-4QZCXU3A.cjs.map +1 -0
  21. package/dist/{chunk-PXMVZCUO.cjs → chunk-6ZSBLNO2.cjs} +3 -3
  22. package/dist/{chunk-PXMVZCUO.cjs.map → chunk-6ZSBLNO2.cjs.map} +1 -1
  23. package/dist/{chunk-25CXKVSW.cjs → chunk-767P6IDT.cjs} +174 -82
  24. package/dist/chunk-767P6IDT.cjs.map +1 -0
  25. package/dist/{chunk-OSUAMRZD.cjs → chunk-7BXQ2HFG.cjs} +25 -25
  26. package/dist/{chunk-OSUAMRZD.cjs.map → chunk-7BXQ2HFG.cjs.map} +1 -1
  27. package/dist/{chunk-CNTWPG57.cjs → chunk-CXAJPAJ2.cjs} +9 -2
  28. package/dist/chunk-CXAJPAJ2.cjs.map +1 -0
  29. package/dist/{chunk-UKWW47HL.js → chunk-D4XVXXDX.js} +3 -3
  30. package/dist/{chunk-UKWW47HL.js.map → chunk-D4XVXXDX.js.map} +1 -1
  31. package/dist/{chunk-PTLWJUYU.cjs → chunk-D5H4LH6V.cjs} +7 -7
  32. package/dist/{chunk-PTLWJUYU.cjs.map → chunk-D5H4LH6V.cjs.map} +1 -1
  33. package/dist/{chunk-377XDZUV.cjs → chunk-DBY645PQ.cjs} +157 -12
  34. package/dist/chunk-DBY645PQ.cjs.map +1 -0
  35. package/dist/{chunk-OXSLQPWP.cjs → chunk-DWQGAKMB.cjs} +4 -4
  36. package/dist/{chunk-OXSLQPWP.cjs.map → chunk-DWQGAKMB.cjs.map} +1 -1
  37. package/dist/{chunk-NJ2L4CM6.js → chunk-EIJLTW5X.js} +3 -3
  38. package/dist/{chunk-NJ2L4CM6.js.map → chunk-EIJLTW5X.js.map} +1 -1
  39. package/dist/{chunk-FOZ7WC36.cjs → chunk-GWLMGMHI.cjs} +464 -278
  40. package/dist/chunk-GWLMGMHI.cjs.map +1 -0
  41. package/dist/{chunk-MAUNZ6BS.js → chunk-ING7J2GB.js} +3 -3
  42. package/dist/{chunk-MAUNZ6BS.js.map → chunk-ING7J2GB.js.map} +1 -1
  43. package/dist/{chunk-3TT3XABO.js → chunk-IUXM3WA2.js} +8 -4
  44. package/dist/chunk-IUXM3WA2.js.map +1 -0
  45. package/dist/{chunk-SLXPPVD3.cjs → chunk-J4FVO25L.cjs} +8 -4
  46. package/dist/chunk-J4FVO25L.cjs.map +1 -0
  47. package/dist/{chunk-WIUKDNAE.js → chunk-JNIAMBSQ.js} +3 -3
  48. package/dist/{chunk-WIUKDNAE.js.map → chunk-JNIAMBSQ.js.map} +1 -1
  49. package/dist/{chunk-43CWQ4M3.js → chunk-KCVOCZXG.js} +9 -3
  50. package/dist/chunk-KCVOCZXG.js.map +1 -0
  51. package/dist/{chunk-TJNZEYLA.js → chunk-KEE6UMGC.js} +9 -2
  52. package/dist/chunk-KEE6UMGC.js.map +1 -0
  53. package/dist/{chunk-624PVCHI.js → chunk-LYDIFPB2.js} +3 -3
  54. package/dist/{chunk-624PVCHI.js.map → chunk-LYDIFPB2.js.map} +1 -1
  55. package/dist/{chunk-LAUE43XU.cjs → chunk-MOH4DZJP.cjs} +4 -4
  56. package/dist/{chunk-LAUE43XU.cjs.map → chunk-MOH4DZJP.cjs.map} +1 -1
  57. package/dist/{chunk-WIXZRRJE.cjs → chunk-MW23D33F.cjs} +6 -4
  58. package/dist/chunk-MW23D33F.cjs.map +1 -0
  59. package/dist/{chunk-AY3L2K4Y.cjs → chunk-MZFFAVXZ.cjs} +3 -3
  60. package/dist/{chunk-AY3L2K4Y.cjs.map → chunk-MZFFAVXZ.cjs.map} +1 -1
  61. package/dist/{chunk-A6J3CYNX.cjs → chunk-N2JR3ER7.cjs} +17 -17
  62. package/dist/{chunk-A6J3CYNX.cjs.map → chunk-N2JR3ER7.cjs.map} +1 -1
  63. package/dist/{chunk-HRV2M5BX.js → chunk-NHQKZEVJ.js} +131 -6
  64. package/dist/chunk-NHQKZEVJ.js.map +1 -0
  65. package/dist/{chunk-MGSLTJZ3.js → chunk-NPNRCLYK.js} +444 -258
  66. package/dist/chunk-NPNRCLYK.js.map +1 -0
  67. package/dist/{chunk-TEUAEW3K.js → chunk-OCFLDDPE.js} +6 -4
  68. package/dist/chunk-OCFLDDPE.js.map +1 -0
  69. package/dist/{chunk-JOMZXGHK.js → chunk-OMOR5OUN.js} +4 -4
  70. package/dist/{chunk-JOMZXGHK.js.map → chunk-OMOR5OUN.js.map} +1 -1
  71. package/dist/{chunk-LTQAE2EZ.js → chunk-OSXOHBCO.js} +3 -3
  72. package/dist/{chunk-LTQAE2EZ.js.map → chunk-OSXOHBCO.js.map} +1 -1
  73. package/dist/{chunk-2LIWBIH2.cjs → chunk-SZOC7JGR.cjs} +30 -30
  74. package/dist/{chunk-2LIWBIH2.cjs.map → chunk-SZOC7JGR.cjs.map} +1 -1
  75. package/dist/{chunk-LBYV6CLG.cjs → chunk-TRB4NGQ3.cjs} +3 -3
  76. package/dist/{chunk-LBYV6CLG.cjs.map → chunk-TRB4NGQ3.cjs.map} +1 -1
  77. package/dist/{chunk-PQHGVAHX.js → chunk-TZFIX2NI.js} +3 -3
  78. package/dist/{chunk-PQHGVAHX.js.map → chunk-TZFIX2NI.js.map} +1 -1
  79. package/dist/{chunk-2EYHTORX.js → chunk-UVLQSMYF.js} +23 -22
  80. package/dist/{chunk-2EYHTORX.js.map → chunk-UVLQSMYF.js.map} +1 -1
  81. package/dist/{chunk-ZYIGNK6T.cjs → chunk-VQMQBGDO.cjs} +3 -3
  82. package/dist/{chunk-ZYIGNK6T.cjs.map → chunk-VQMQBGDO.cjs.map} +1 -1
  83. package/dist/{chunk-MFICYRVR.cjs → chunk-WC3F3EA5.cjs} +4 -4
  84. package/dist/{chunk-MFICYRVR.cjs.map → chunk-WC3F3EA5.cjs.map} +1 -1
  85. package/dist/{chunk-SUGHLGVF.cjs → chunk-Y5FNAVOR.cjs} +172 -171
  86. package/dist/chunk-Y5FNAVOR.cjs.map +1 -0
  87. package/dist/docs/SKILL.md +1 -1
  88. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  89. package/dist/server/a2a/agent-card-signing.d.ts +7 -0
  90. package/dist/server/a2a/agent-card-signing.d.ts.map +1 -0
  91. package/dist/server/handlers/a2a.cjs +14 -14
  92. package/dist/server/handlers/a2a.d.ts +10 -0
  93. package/dist/server/handlers/a2a.d.ts.map +1 -1
  94. package/dist/server/handlers/a2a.js +1 -1
  95. package/dist/server/handlers/agent-builder.cjs +16 -16
  96. package/dist/server/handlers/agent-builder.js +1 -1
  97. package/dist/server/handlers/agents.cjs +42 -38
  98. package/dist/server/handlers/agents.d.ts +157 -0
  99. package/dist/server/handlers/agents.d.ts.map +1 -1
  100. package/dist/server/handlers/agents.js +1 -1
  101. package/dist/server/handlers/background-tasks.cjs +4 -4
  102. package/dist/server/handlers/background-tasks.d.ts +18 -5
  103. package/dist/server/handlers/background-tasks.d.ts.map +1 -1
  104. package/dist/server/handlers/background-tasks.js +1 -1
  105. package/dist/server/handlers/conversations.cjs +5 -5
  106. package/dist/server/handlers/conversations.js +1 -1
  107. package/dist/server/handlers/observability-new-endpoints.cjs +28 -28
  108. package/dist/server/handlers/observability-new-endpoints.d.ts +18 -6
  109. package/dist/server/handlers/observability-new-endpoints.d.ts.map +1 -1
  110. package/dist/server/handlers/observability-new-endpoints.js +1 -1
  111. package/dist/server/handlers/observability.cjs +38 -38
  112. package/dist/server/handlers/observability.js +2 -2
  113. package/dist/server/handlers/responses.cjs +4 -4
  114. package/dist/server/handlers/responses.js +1 -1
  115. package/dist/server/handlers/scores.cjs +7 -7
  116. package/dist/server/handlers/scores.js +1 -1
  117. package/dist/server/handlers/stored-agents.cjs +7 -7
  118. package/dist/server/handlers/stored-agents.js +1 -1
  119. package/dist/server/handlers/stored-mcp-clients.cjs +6 -6
  120. package/dist/server/handlers/stored-mcp-clients.js +1 -1
  121. package/dist/server/handlers/stored-prompt-blocks.cjs +6 -6
  122. package/dist/server/handlers/stored-prompt-blocks.js +1 -1
  123. package/dist/server/handlers/stored-scorers.cjs +6 -6
  124. package/dist/server/handlers/stored-scorers.js +1 -1
  125. package/dist/server/handlers/system.cjs +3 -3
  126. package/dist/server/handlers/system.js +1 -1
  127. package/dist/server/handlers/tools.cjs +6 -6
  128. package/dist/server/handlers/tools.js +1 -1
  129. package/dist/server/handlers/voice.cjs +8 -8
  130. package/dist/server/handlers/voice.js +1 -1
  131. package/dist/server/handlers/workflows.cjs +24 -24
  132. package/dist/server/handlers/workflows.js +1 -1
  133. package/dist/server/handlers.cjs +27 -27
  134. package/dist/server/handlers.js +11 -11
  135. package/dist/server/schemas/a2a.d.ts +5 -0
  136. package/dist/server/schemas/a2a.d.ts.map +1 -1
  137. package/dist/server/schemas/agents.d.ts +77 -0
  138. package/dist/server/schemas/agents.d.ts.map +1 -1
  139. package/dist/server/schemas/background-tasks.d.ts +11 -0
  140. package/dist/server/schemas/background-tasks.d.ts.map +1 -1
  141. package/dist/server/schemas/index.cjs +289 -285
  142. package/dist/server/schemas/index.js +7 -7
  143. package/dist/server/server-adapter/index.cjs +10 -10
  144. package/dist/server/server-adapter/index.js +2 -2
  145. package/dist/server/server-adapter/routes/a2a.d.ts +10 -0
  146. package/dist/server/server-adapter/routes/a2a.d.ts.map +1 -1
  147. package/dist/server/server-adapter/routes/agents.d.ts +2 -1
  148. package/dist/server/server-adapter/routes/agents.d.ts.map +1 -1
  149. package/dist/server/server-adapter/routes/observability.d.ts +9 -3
  150. package/dist/server/server-adapter/routes/observability.d.ts.map +1 -1
  151. package/package.json +7 -6
  152. package/dist/chunk-25CXKVSW.cjs.map +0 -1
  153. package/dist/chunk-377XDZUV.cjs.map +0 -1
  154. package/dist/chunk-3TT3XABO.js.map +0 -1
  155. package/dist/chunk-43CWQ4M3.js.map +0 -1
  156. package/dist/chunk-CNTWPG57.cjs.map +0 -1
  157. package/dist/chunk-FOZ7WC36.cjs.map +0 -1
  158. package/dist/chunk-GUWIV3ZN.cjs.map +0 -1
  159. package/dist/chunk-HRV2M5BX.js.map +0 -1
  160. package/dist/chunk-J6LU7NDU.js.map +0 -1
  161. package/dist/chunk-MGSLTJZ3.js.map +0 -1
  162. package/dist/chunk-SLXPPVD3.cjs.map +0 -1
  163. package/dist/chunk-SUGHLGVF.cjs.map +0 -1
  164. package/dist/chunk-TEUAEW3K.js.map +0 -1
  165. package/dist/chunk-TJNZEYLA.js.map +0 -1
  166. package/dist/chunk-WIXZRRJE.cjs.map +0 -1
@@ -1,9 +1,9 @@
1
+ import { LIST_WORKFLOWS_ROUTE, GET_WORKFLOW_BY_ID_ROUTE, LIST_WORKFLOW_RUNS_ROUTE, GET_WORKFLOW_RUN_BY_ID_ROUTE, CREATE_WORKFLOW_RUN_ROUTE, STREAM_WORKFLOW_ROUTE, START_ASYNC_WORKFLOW_ROUTE, START_WORKFLOW_RUN_ROUTE, OBSERVE_STREAM_WORKFLOW_ROUTE, RESUME_ASYNC_WORKFLOW_ROUTE, RESUME_WORKFLOW_ROUTE, RESUME_STREAM_WORKFLOW_ROUTE, CANCEL_WORKFLOW_RUN_ROUTE, STREAM_LEGACY_WORKFLOW_ROUTE, OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE } from './chunk-27MTROCI.js';
1
2
  import { actionIdPathParams, actionRunPathParams, streamAgentBuilderBodySchema, startAsyncAgentBuilderBodySchema, resumeAgentBuilderBodySchema, streamLegacyAgentBuilderBodySchema } from './chunk-GEXJ4LPZ.js';
3
+ import { listWorkflowsResponseSchema, workflowInfoSchema, workflowRunsResponseSchema, listWorkflowRunsQuerySchema, workflowRunResultSchema, workflowRunResultQuerySchema, createWorkflowRunResponseSchema, workflowExecutionResultSchema, workflowControlResponseSchema } from './chunk-5OOYXBPG.js';
2
4
  import { e, truncateStringByTokens, estimateTokenCount, resolveToolResultValue, formatToolResultForObserver } from './chunk-S65AMBAF.js';
3
5
  import { openai } from './chunk-PALNMAC6.js';
4
- import { LIST_WORKFLOWS_ROUTE, GET_WORKFLOW_BY_ID_ROUTE, LIST_WORKFLOW_RUNS_ROUTE, GET_WORKFLOW_RUN_BY_ID_ROUTE, CREATE_WORKFLOW_RUN_ROUTE, STREAM_WORKFLOW_ROUTE, START_ASYNC_WORKFLOW_ROUTE, START_WORKFLOW_RUN_ROUTE, OBSERVE_STREAM_WORKFLOW_ROUTE, RESUME_ASYNC_WORKFLOW_ROUTE, RESUME_WORKFLOW_ROUTE, RESUME_STREAM_WORKFLOW_ROUTE, CANCEL_WORKFLOW_RUN_ROUTE, STREAM_LEGACY_WORKFLOW_ROUTE, OBSERVE_STREAM_LEGACY_WORKFLOW_ROUTE } from './chunk-HFNLYENA.js';
5
- import { listWorkflowsResponseSchema, workflowInfoSchema, workflowRunsResponseSchema, listWorkflowRunsQuerySchema, workflowRunResultSchema, workflowRunResultQuerySchema, createWorkflowRunResponseSchema, workflowExecutionResultSchema, workflowControlResponseSchema } from './chunk-5OOYXBPG.js';
6
- import { streamResponseSchema } from './chunk-43CWQ4M3.js';
6
+ import { streamResponseSchema } from './chunk-KCVOCZXG.js';
7
7
  import { WorkflowRegistry } from './chunk-YCL2MS5R.js';
8
8
  import { optionalRunIdSchema, runIdSchema } from './chunk-2YY3EMMS.js';
9
9
  import { standardSchemaToJSONSchema, createRoute, isStandardSchemaWithJSON, toStandardSchema5 } from './chunk-GDACR4PY.js';
@@ -40,7 +40,7 @@ var require_ignore = __commonJS({
40
40
  }
41
41
  var UNDEFINED = void 0;
42
42
  var EMPTY = "";
43
- var SPACE = " ";
43
+ var SPACE4 = " ";
44
44
  var ESCAPE = "\\";
45
45
  var REGEX_TEST_BLANK_LINE = /^\s+$/;
46
46
  var REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/;
@@ -84,7 +84,7 @@ var require_ignore = __commonJS({
84
84
  // (a ) -> (a)
85
85
  // (a \ ) -> (a )
86
86
  /((?:\\\\)*?)(\\?\s+)$/,
87
- (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE : EMPTY)
87
+ (_, m1, m2) => m1 + (m2.indexOf("\\") === 0 ? SPACE4 : EMPTY)
88
88
  ],
89
89
  // Replace (\ ) with ' '
90
90
  // (\ ) -> ' '
@@ -94,7 +94,7 @@ var require_ignore = __commonJS({
94
94
  /(\\+?)\s/g,
95
95
  (_, m1) => {
96
96
  const { length } = m1;
97
- return m1.slice(0, length - length % 2) + SPACE;
97
+ return m1.slice(0, length - length % 2) + SPACE4;
98
98
  }
99
99
  ],
100
100
  // Escape metacharacters
@@ -4983,6 +4983,9 @@ var ParseError = class extends Error {
4983
4983
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
4984
4984
  }
4985
4985
  };
4986
+ var LF = 10;
4987
+ var CR = 13;
4988
+ var SPACE = 32;
4986
4989
  function noop(_arg) {
4987
4990
  }
4988
4991
  function createParser(callbacks) {
@@ -4990,39 +4993,109 @@ function createParser(callbacks) {
4990
4993
  throw new TypeError(
4991
4994
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
4992
4995
  );
4993
- const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
4994
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
4995
- function feed(newChunk) {
4996
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
4997
- for (const line of complete)
4998
- parseLine(line);
4999
- incompleteLine = incomplete, isFirstChunk = false;
5000
- }
5001
- function parseLine(line) {
5002
- if (line === "") {
4996
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks, pendingFragments = [];
4997
+ let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
4998
+ function feed(chunk) {
4999
+ if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
5000
+ const trailing2 = processLines(chunk);
5001
+ trailing2 !== "" && pendingFragments.push(trailing2);
5002
+ return;
5003
+ }
5004
+ if (chunk.indexOf(`
5005
+ `) === -1 && chunk.indexOf("\r") === -1) {
5006
+ pendingFragments.push(chunk);
5007
+ return;
5008
+ }
5009
+ pendingFragments.push(chunk);
5010
+ const input = pendingFragments.join("");
5011
+ pendingFragments.length = 0;
5012
+ const trailing = processLines(input);
5013
+ trailing !== "" && pendingFragments.push(trailing);
5014
+ }
5015
+ function processLines(chunk) {
5016
+ let searchIndex = 0;
5017
+ if (chunk.indexOf("\r") === -1) {
5018
+ let lfIndex = chunk.indexOf(`
5019
+ `, searchIndex);
5020
+ for (; lfIndex !== -1; ) {
5021
+ if (searchIndex === lfIndex) {
5022
+ dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
5023
+ `, searchIndex);
5024
+ continue;
5025
+ }
5026
+ const firstCharCode = chunk.charCodeAt(searchIndex);
5027
+ if (isDataPrefix(chunk, searchIndex, firstCharCode)) {
5028
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
5029
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF) {
5030
+ onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
5031
+ `, searchIndex);
5032
+ continue;
5033
+ }
5034
+ data = dataLines === 0 ? value : `${data}
5035
+ ${value}`, dataLines++;
5036
+ } else isEventPrefix(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
5037
+ chunk.charCodeAt(searchIndex + 6) === SPACE ? searchIndex + 7 : searchIndex + 6,
5038
+ lfIndex
5039
+ ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
5040
+ searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
5041
+ `, searchIndex);
5042
+ }
5043
+ return chunk.slice(searchIndex);
5044
+ }
5045
+ for (; searchIndex < chunk.length; ) {
5046
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
5047
+ `, searchIndex);
5048
+ let lineEnd = -1;
5049
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
5050
+ break;
5051
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR && chunk.charCodeAt(searchIndex) === LF && searchIndex++;
5052
+ }
5053
+ return chunk.slice(searchIndex);
5054
+ }
5055
+ function parseLine(chunk, start, end) {
5056
+ if (start === end) {
5003
5057
  dispatchEvent();
5004
5058
  return;
5005
5059
  }
5006
- if (line.startsWith(":")) {
5007
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
5060
+ const firstCharCode = chunk.charCodeAt(start);
5061
+ if (isDataPrefix(chunk, start, firstCharCode)) {
5062
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
5063
+ data = dataLines === 0 ? value2 : `${data}
5064
+ ${value2}`, dataLines++;
5008
5065
  return;
5009
5066
  }
5010
- const fieldSeparatorIndex = line.indexOf(":");
5011
- if (fieldSeparatorIndex !== -1) {
5012
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
5013
- processField(field, value, line);
5067
+ if (isEventPrefix(chunk, start, firstCharCode)) {
5068
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE ? start + 7 : start + 6, end) || void 0;
5014
5069
  return;
5015
5070
  }
5016
- processField(line, "", line);
5071
+ if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
5072
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE ? start + 4 : start + 3, end);
5073
+ id = value2.includes("\0") ? void 0 : value2;
5074
+ return;
5075
+ }
5076
+ if (firstCharCode === 58) {
5077
+ if (onComment) {
5078
+ const line2 = chunk.slice(start, end);
5079
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE ? 2 : 1));
5080
+ }
5081
+ return;
5082
+ }
5083
+ const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
5084
+ if (fieldSeparatorIndex === -1) {
5085
+ processField(line, "", line);
5086
+ return;
5087
+ }
5088
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
5089
+ processField(field, value, line);
5017
5090
  }
5018
5091
  function processField(field, value, line) {
5019
5092
  switch (field) {
5020
5093
  case "event":
5021
- eventType = value;
5094
+ eventType = value || void 0;
5022
5095
  break;
5023
5096
  case "data":
5024
- data = `${data}${value}
5025
- `;
5097
+ data = dataLines === 0 ? value : `${data}
5098
+ ${value}`, dataLines++;
5026
5099
  break;
5027
5100
  case "id":
5028
5101
  id = value.includes("\0") ? void 0 : value;
@@ -5047,37 +5120,26 @@ function createParser(callbacks) {
5047
5120
  }
5048
5121
  }
5049
5122
  function dispatchEvent() {
5050
- data.length > 0 && onEvent({
5123
+ dataLines > 0 && onEvent({
5051
5124
  id,
5052
- event: eventType || void 0,
5053
- // If the data buffer's last character is a U+000A LINE FEED (LF) character,
5054
- // then remove the last character from the data buffer.
5055
- data: data.endsWith(`
5056
- `) ? data.slice(0, -1) : data
5057
- }), id = void 0, data = "", eventType = "";
5125
+ event: eventType,
5126
+ data
5127
+ }), id = void 0, data = "", dataLines = 0, eventType = void 0;
5058
5128
  }
5059
5129
  function reset(options = {}) {
5060
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
5130
+ if (options.consume && pendingFragments.length > 0) {
5131
+ const incompleteLine = pendingFragments.join("");
5132
+ parseLine(incompleteLine, 0, incompleteLine.length);
5133
+ }
5134
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
5061
5135
  }
5062
5136
  return { feed, reset };
5063
5137
  }
5064
- function splitLines(chunk) {
5065
- const lines = [];
5066
- let incompleteLine = "", searchIndex = 0;
5067
- for (; searchIndex < chunk.length; ) {
5068
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
5069
- `, searchIndex);
5070
- let lineEnd = -1;
5071
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
5072
- incompleteLine = chunk.slice(searchIndex);
5073
- break;
5074
- } else {
5075
- const line = chunk.slice(searchIndex, lineEnd);
5076
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
5077
- ` && searchIndex++;
5078
- }
5079
- }
5080
- return [lines, incompleteLine];
5138
+ function isDataPrefix(chunk, i, firstCharCode) {
5139
+ return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
5140
+ }
5141
+ function isEventPrefix(chunk, i, firstCharCode) {
5142
+ return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
5081
5143
  }
5082
5144
  var EventSourceParserStream = class extends TransformStream {
5083
5145
  constructor({ onError, onRetry, onComment } = {}) {
@@ -5253,7 +5315,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
5253
5315
  );
5254
5316
  return Object.fromEntries(normalizedHeaders.entries());
5255
5317
  }
5256
- var VERSION2 = "3.0.23";
5318
+ var VERSION2 = "3.0.25";
5257
5319
  var getOriginalFetch = () => globalThis.fetch;
5258
5320
  var getFromApi = async ({
5259
5321
  url,
@@ -5722,6 +5784,33 @@ var createJsonResponseHandler = (responseSchema) => async ({ response, url, requ
5722
5784
  rawValue: parsedResult.rawValue
5723
5785
  };
5724
5786
  };
5787
+ var schemaSymbol2 = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
5788
+ function lazySchema(createSchema) {
5789
+ let schema;
5790
+ return () => {
5791
+ if (schema == null) {
5792
+ schema = createSchema();
5793
+ }
5794
+ return schema;
5795
+ };
5796
+ }
5797
+ function jsonSchema2(jsonSchema22, {
5798
+ validate
5799
+ } = {}) {
5800
+ return {
5801
+ [schemaSymbol2]: true,
5802
+ _type: void 0,
5803
+ // should never be used directly
5804
+ [validatorSymbol2]: true,
5805
+ get jsonSchema() {
5806
+ if (typeof jsonSchema22 === "function") {
5807
+ jsonSchema22 = jsonSchema22();
5808
+ }
5809
+ return jsonSchema22;
5810
+ },
5811
+ validate
5812
+ };
5813
+ }
5725
5814
  function addAdditionalPropertiesToJsonSchema(jsonSchema22) {
5726
5815
  if (jsonSchema22.type === "object") {
5727
5816
  jsonSchema22.additionalProperties = false;
@@ -5747,13 +5836,6 @@ function addAdditionalPropertiesToJsonSchema(jsonSchema22) {
5747
5836
  }
5748
5837
  return jsonSchema22;
5749
5838
  }
5750
- var getRelativePath2 = (pathA, pathB) => {
5751
- let i = 0;
5752
- for (; i < pathA.length && i < pathB.length; i++) {
5753
- if (pathA[i] !== pathB[i]) break;
5754
- }
5755
- return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
5756
- };
5757
5839
  var ignoreOverride2 = /* @__PURE__ */ Symbol(
5758
5840
  "Let zodToJsonSchema decide on which parser to use"
5759
5841
  );
@@ -6697,6 +6779,13 @@ var selectParser2 = (def, typeName, refs) => {
6697
6779
  return /* @__PURE__ */ ((_) => void 0)();
6698
6780
  }
6699
6781
  };
6782
+ var getRelativePath2 = (pathA, pathB) => {
6783
+ let i = 0;
6784
+ for (; i < pathA.length && i < pathB.length; i++) {
6785
+ if (pathA[i] !== pathB[i]) break;
6786
+ }
6787
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
6788
+ };
6700
6789
  function parseDef2(def, refs, forceResolution = false) {
6701
6790
  var _a224;
6702
6791
  const seenItem = refs.seen.get(def);
@@ -6876,33 +6965,6 @@ function zodSchema2(zodSchema22, options) {
6876
6965
  return zod3Schema(zodSchema22);
6877
6966
  }
6878
6967
  }
6879
- var schemaSymbol2 = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
6880
- function lazySchema(createSchema) {
6881
- let schema;
6882
- return () => {
6883
- if (schema == null) {
6884
- schema = createSchema();
6885
- }
6886
- return schema;
6887
- };
6888
- }
6889
- function jsonSchema2(jsonSchema22, {
6890
- validate
6891
- } = {}) {
6892
- return {
6893
- [schemaSymbol2]: true,
6894
- _type: void 0,
6895
- // should never be used directly
6896
- [validatorSymbol2]: true,
6897
- get jsonSchema() {
6898
- if (typeof jsonSchema22 === "function") {
6899
- jsonSchema22 = jsonSchema22();
6900
- }
6901
- return jsonSchema22;
6902
- },
6903
- validate
6904
- };
6905
- }
6906
6968
  function isSchema2(value) {
6907
6969
  return typeof value === "object" && value !== null && schemaSymbol2 in value && value[schemaSymbol2] === true && "jsonSchema" in value && "validate" in value;
6908
6970
  }
@@ -7190,6 +7252,19 @@ var gatewayErrorResponseSchema = lazyValidator(
7190
7252
  })
7191
7253
  )
7192
7254
  );
7255
+ function extractApiCallResponse(error) {
7256
+ if (error.data !== void 0) {
7257
+ return error.data;
7258
+ }
7259
+ if (error.responseBody != null) {
7260
+ try {
7261
+ return JSON.parse(error.responseBody);
7262
+ } catch (e2) {
7263
+ return error.responseBody;
7264
+ }
7265
+ }
7266
+ return {};
7267
+ }
7193
7268
  var name74 = "GatewayTimeoutError";
7194
7269
  var marker84 = `vercel.ai.gateway.error.${name74}`;
7195
7270
  var symbol84 = Symbol.for(marker84);
@@ -7276,19 +7351,6 @@ async function asGatewayError(error, authMethod) {
7276
7351
  authMethod
7277
7352
  });
7278
7353
  }
7279
- function extractApiCallResponse(error) {
7280
- if (error.data !== void 0) {
7281
- return error.data;
7282
- }
7283
- if (error.responseBody != null) {
7284
- try {
7285
- return JSON.parse(error.responseBody);
7286
- } catch (e2) {
7287
- return error.responseBody;
7288
- }
7289
- }
7290
- return {};
7291
- }
7292
7354
  var GATEWAY_AUTH_METHOD_HEADER = "ai-gateway-auth-method";
7293
7355
  async function parseAuthMethod(headers) {
7294
7356
  const result = await safeValidateTypes2({
@@ -8075,7 +8137,7 @@ async function getVercelRequestId() {
8075
8137
  var _a932;
8076
8138
  return (_a932 = getContext().headers) == null ? void 0 : _a932["x-vercel-id"];
8077
8139
  }
8078
- var VERSION3 = "2.0.82";
8140
+ var VERSION3 = "2.0.86";
8079
8141
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
8080
8142
  function createGatewayProvider(options = {}) {
8081
8143
  var _a932, _b93;
@@ -9062,7 +9124,7 @@ function getGlobalProvider() {
9062
9124
  var _a163;
9063
9125
  return (_a163 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a163 : gateway;
9064
9126
  }
9065
- var VERSION32 = "5.0.179";
9127
+ var VERSION32 = "5.0.184";
9066
9128
  var dataContentSchema2 = z$1.union([
9067
9129
  z$1.string(),
9068
9130
  z$1.instanceof(Uint8Array),
@@ -10367,6 +10429,9 @@ var ParseError2 = class extends Error {
10367
10429
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
10368
10430
  }
10369
10431
  };
10432
+ var LF2 = 10;
10433
+ var CR2 = 13;
10434
+ var SPACE2 = 32;
10370
10435
  function noop2(_arg) {
10371
10436
  }
10372
10437
  function createParser2(callbacks) {
@@ -10374,39 +10439,109 @@ function createParser2(callbacks) {
10374
10439
  throw new TypeError(
10375
10440
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
10376
10441
  );
10377
- const { onEvent = noop2, onError = noop2, onRetry = noop2, onComment } = callbacks;
10378
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
10379
- function feed(newChunk) {
10380
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines2(`${incompleteLine}${chunk}`);
10381
- for (const line of complete)
10382
- parseLine(line);
10383
- incompleteLine = incomplete, isFirstChunk = false;
10384
- }
10385
- function parseLine(line) {
10386
- if (line === "") {
10442
+ const { onEvent = noop2, onError = noop2, onRetry = noop2, onComment } = callbacks, pendingFragments = [];
10443
+ let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
10444
+ function feed(chunk) {
10445
+ if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
10446
+ const trailing2 = processLines(chunk);
10447
+ trailing2 !== "" && pendingFragments.push(trailing2);
10448
+ return;
10449
+ }
10450
+ if (chunk.indexOf(`
10451
+ `) === -1 && chunk.indexOf("\r") === -1) {
10452
+ pendingFragments.push(chunk);
10453
+ return;
10454
+ }
10455
+ pendingFragments.push(chunk);
10456
+ const input = pendingFragments.join("");
10457
+ pendingFragments.length = 0;
10458
+ const trailing = processLines(input);
10459
+ trailing !== "" && pendingFragments.push(trailing);
10460
+ }
10461
+ function processLines(chunk) {
10462
+ let searchIndex = 0;
10463
+ if (chunk.indexOf("\r") === -1) {
10464
+ let lfIndex = chunk.indexOf(`
10465
+ `, searchIndex);
10466
+ for (; lfIndex !== -1; ) {
10467
+ if (searchIndex === lfIndex) {
10468
+ dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
10469
+ `, searchIndex);
10470
+ continue;
10471
+ }
10472
+ const firstCharCode = chunk.charCodeAt(searchIndex);
10473
+ if (isDataPrefix2(chunk, searchIndex, firstCharCode)) {
10474
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE2 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
10475
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF2) {
10476
+ onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
10477
+ `, searchIndex);
10478
+ continue;
10479
+ }
10480
+ data = dataLines === 0 ? value : `${data}
10481
+ ${value}`, dataLines++;
10482
+ } else isEventPrefix2(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
10483
+ chunk.charCodeAt(searchIndex + 6) === SPACE2 ? searchIndex + 7 : searchIndex + 6,
10484
+ lfIndex
10485
+ ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
10486
+ searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
10487
+ `, searchIndex);
10488
+ }
10489
+ return chunk.slice(searchIndex);
10490
+ }
10491
+ for (; searchIndex < chunk.length; ) {
10492
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
10493
+ `, searchIndex);
10494
+ let lineEnd = -1;
10495
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
10496
+ break;
10497
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR2 && chunk.charCodeAt(searchIndex) === LF2 && searchIndex++;
10498
+ }
10499
+ return chunk.slice(searchIndex);
10500
+ }
10501
+ function parseLine(chunk, start, end) {
10502
+ if (start === end) {
10387
10503
  dispatchEvent();
10388
10504
  return;
10389
10505
  }
10390
- if (line.startsWith(":")) {
10391
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
10506
+ const firstCharCode = chunk.charCodeAt(start);
10507
+ if (isDataPrefix2(chunk, start, firstCharCode)) {
10508
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE2 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
10509
+ data = dataLines === 0 ? value2 : `${data}
10510
+ ${value2}`, dataLines++;
10511
+ return;
10512
+ }
10513
+ if (isEventPrefix2(chunk, start, firstCharCode)) {
10514
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE2 ? start + 7 : start + 6, end) || void 0;
10515
+ return;
10516
+ }
10517
+ if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
10518
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE2 ? start + 4 : start + 3, end);
10519
+ id = value2.includes("\0") ? void 0 : value2;
10520
+ return;
10521
+ }
10522
+ if (firstCharCode === 58) {
10523
+ if (onComment) {
10524
+ const line2 = chunk.slice(start, end);
10525
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE2 ? 2 : 1));
10526
+ }
10392
10527
  return;
10393
10528
  }
10394
- const fieldSeparatorIndex = line.indexOf(":");
10395
- if (fieldSeparatorIndex !== -1) {
10396
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
10397
- processField(field, value, line);
10529
+ const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
10530
+ if (fieldSeparatorIndex === -1) {
10531
+ processField(line, "", line);
10398
10532
  return;
10399
10533
  }
10400
- processField(line, "", line);
10534
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE2 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
10535
+ processField(field, value, line);
10401
10536
  }
10402
10537
  function processField(field, value, line) {
10403
10538
  switch (field) {
10404
10539
  case "event":
10405
- eventType = value;
10540
+ eventType = value || void 0;
10406
10541
  break;
10407
10542
  case "data":
10408
- data = `${data}${value}
10409
- `;
10543
+ data = dataLines === 0 ? value : `${data}
10544
+ ${value}`, dataLines++;
10410
10545
  break;
10411
10546
  case "id":
10412
10547
  id = value.includes("\0") ? void 0 : value;
@@ -10431,37 +10566,26 @@ function createParser2(callbacks) {
10431
10566
  }
10432
10567
  }
10433
10568
  function dispatchEvent() {
10434
- data.length > 0 && onEvent({
10569
+ dataLines > 0 && onEvent({
10435
10570
  id,
10436
- event: eventType || void 0,
10437
- // If the data buffer's last character is a U+000A LINE FEED (LF) character,
10438
- // then remove the last character from the data buffer.
10439
- data: data.endsWith(`
10440
- `) ? data.slice(0, -1) : data
10441
- }), id = void 0, data = "", eventType = "";
10571
+ event: eventType,
10572
+ data
10573
+ }), id = void 0, data = "", dataLines = 0, eventType = void 0;
10442
10574
  }
10443
10575
  function reset(options = {}) {
10444
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
10576
+ if (options.consume && pendingFragments.length > 0) {
10577
+ const incompleteLine = pendingFragments.join("");
10578
+ parseLine(incompleteLine, 0, incompleteLine.length);
10579
+ }
10580
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
10445
10581
  }
10446
10582
  return { feed, reset };
10447
10583
  }
10448
- function splitLines2(chunk) {
10449
- const lines = [];
10450
- let incompleteLine = "", searchIndex = 0;
10451
- for (; searchIndex < chunk.length; ) {
10452
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
10453
- `, searchIndex);
10454
- let lineEnd = -1;
10455
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
10456
- incompleteLine = chunk.slice(searchIndex);
10457
- break;
10458
- } else {
10459
- const line = chunk.slice(searchIndex, lineEnd);
10460
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
10461
- ` && searchIndex++;
10462
- }
10463
- }
10464
- return [lines, incompleteLine];
10584
+ function isDataPrefix2(chunk, i, firstCharCode) {
10585
+ return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
10586
+ }
10587
+ function isEventPrefix2(chunk, i, firstCharCode) {
10588
+ return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
10465
10589
  }
10466
10590
  var EventSourceParserStream2 = class extends TransformStream {
10467
10591
  constructor({ onError, onRetry, onComment } = {}) {
@@ -10673,7 +10797,7 @@ function withUserAgentSuffix2(headers, ...userAgentSuffixParts) {
10673
10797
  );
10674
10798
  return Object.fromEntries(normalizedHeaders.entries());
10675
10799
  }
10676
- var VERSION4 = "4.0.23";
10800
+ var VERSION4 = "4.0.26";
10677
10801
  var getOriginalFetch3 = () => globalThis.fetch;
10678
10802
  var getFromApi2 = async ({
10679
10803
  url,
@@ -12645,6 +12769,19 @@ var gatewayErrorResponseSchema2 = lazySchema2(
12645
12769
  })
12646
12770
  )
12647
12771
  );
12772
+ function extractApiCallResponse2(error) {
12773
+ if (error.data !== void 0) {
12774
+ return error.data;
12775
+ }
12776
+ if (error.responseBody != null) {
12777
+ try {
12778
+ return JSON.parse(error.responseBody);
12779
+ } catch (e2) {
12780
+ return error.responseBody;
12781
+ }
12782
+ }
12783
+ return {};
12784
+ }
12648
12785
  var name76 = "GatewayTimeoutError";
12649
12786
  var marker86 = `vercel.ai.gateway.error.${name76}`;
12650
12787
  var symbol86 = Symbol.for(marker86);
@@ -12734,19 +12871,6 @@ async function asGatewayError2(error, authMethod) {
12734
12871
  authMethod
12735
12872
  });
12736
12873
  }
12737
- function extractApiCallResponse2(error) {
12738
- if (error.data !== void 0) {
12739
- return error.data;
12740
- }
12741
- if (error.responseBody != null) {
12742
- try {
12743
- return JSON.parse(error.responseBody);
12744
- } catch (e2) {
12745
- return error.responseBody;
12746
- }
12747
- }
12748
- return {};
12749
- }
12750
12874
  var GATEWAY_AUTH_METHOD_HEADER2 = "ai-gateway-auth-method";
12751
12875
  async function parseAuthMethod2(headers) {
12752
12876
  const result = await safeValidateTypes3({
@@ -13840,7 +13964,7 @@ async function getVercelRequestId2() {
13840
13964
  var _a932;
13841
13965
  return (_a932 = getContext2().headers) == null ? void 0 : _a932["x-vercel-id"];
13842
13966
  }
13843
- var VERSION5 = "3.0.104";
13967
+ var VERSION5 = "3.0.110";
13844
13968
  var AI_GATEWAY_PROTOCOL_VERSION2 = "0.0.1";
13845
13969
  function createGatewayProvider2(options = {}) {
13846
13970
  var _a932, _b93;
@@ -14950,7 +15074,7 @@ function getTotalTimeoutMs(timeout) {
14950
15074
  }
14951
15075
  return timeout.totalMs;
14952
15076
  }
14953
- var VERSION33 = "6.0.168";
15077
+ var VERSION33 = "6.0.175";
14954
15078
  var dataContentSchema3 = z$1.union([
14955
15079
  z$1.string(),
14956
15080
  z$1.instanceof(Uint8Array),
@@ -24474,6 +24598,9 @@ var ParseError3 = class extends Error {
24474
24598
  super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
24475
24599
  }
24476
24600
  };
24601
+ var LF3 = 10;
24602
+ var CR3 = 13;
24603
+ var SPACE3 = 32;
24477
24604
  function noop3(_arg) {
24478
24605
  }
24479
24606
  function createParser3(callbacks) {
@@ -24481,39 +24608,109 @@ function createParser3(callbacks) {
24481
24608
  throw new TypeError(
24482
24609
  "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
24483
24610
  );
24484
- const { onEvent = noop3, onError = noop3, onRetry = noop3, onComment } = callbacks;
24485
- let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
24486
- function feed(newChunk) {
24487
- const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines3(`${incompleteLine}${chunk}`);
24488
- for (const line of complete)
24489
- parseLine(line);
24490
- incompleteLine = incomplete, isFirstChunk = false;
24491
- }
24492
- function parseLine(line) {
24493
- if (line === "") {
24611
+ const { onEvent = noop3, onError = noop3, onRetry = noop3, onComment } = callbacks, pendingFragments = [];
24612
+ let isFirstChunk = true, id, data = "", dataLines = 0, eventType;
24613
+ function feed(chunk) {
24614
+ if (isFirstChunk && (isFirstChunk = false, chunk.charCodeAt(0) === 239 && chunk.charCodeAt(1) === 187 && chunk.charCodeAt(2) === 191 && (chunk = chunk.slice(3))), pendingFragments.length === 0) {
24615
+ const trailing2 = processLines(chunk);
24616
+ trailing2 !== "" && pendingFragments.push(trailing2);
24617
+ return;
24618
+ }
24619
+ if (chunk.indexOf(`
24620
+ `) === -1 && chunk.indexOf("\r") === -1) {
24621
+ pendingFragments.push(chunk);
24622
+ return;
24623
+ }
24624
+ pendingFragments.push(chunk);
24625
+ const input = pendingFragments.join("");
24626
+ pendingFragments.length = 0;
24627
+ const trailing = processLines(input);
24628
+ trailing !== "" && pendingFragments.push(trailing);
24629
+ }
24630
+ function processLines(chunk) {
24631
+ let searchIndex = 0;
24632
+ if (chunk.indexOf("\r") === -1) {
24633
+ let lfIndex = chunk.indexOf(`
24634
+ `, searchIndex);
24635
+ for (; lfIndex !== -1; ) {
24636
+ if (searchIndex === lfIndex) {
24637
+ dataLines > 0 && onEvent({ id, event: eventType, data }), id = void 0, data = "", dataLines = 0, eventType = void 0, searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
24638
+ `, searchIndex);
24639
+ continue;
24640
+ }
24641
+ const firstCharCode = chunk.charCodeAt(searchIndex);
24642
+ if (isDataPrefix3(chunk, searchIndex, firstCharCode)) {
24643
+ const valueStart = chunk.charCodeAt(searchIndex + 5) === SPACE3 ? searchIndex + 6 : searchIndex + 5, value = chunk.slice(valueStart, lfIndex);
24644
+ if (dataLines === 0 && chunk.charCodeAt(lfIndex + 1) === LF3) {
24645
+ onEvent({ id, event: eventType, data: value }), id = void 0, data = "", eventType = void 0, searchIndex = lfIndex + 2, lfIndex = chunk.indexOf(`
24646
+ `, searchIndex);
24647
+ continue;
24648
+ }
24649
+ data = dataLines === 0 ? value : `${data}
24650
+ ${value}`, dataLines++;
24651
+ } else isEventPrefix3(chunk, searchIndex, firstCharCode) ? eventType = chunk.slice(
24652
+ chunk.charCodeAt(searchIndex + 6) === SPACE3 ? searchIndex + 7 : searchIndex + 6,
24653
+ lfIndex
24654
+ ) || void 0 : parseLine(chunk, searchIndex, lfIndex);
24655
+ searchIndex = lfIndex + 1, lfIndex = chunk.indexOf(`
24656
+ `, searchIndex);
24657
+ }
24658
+ return chunk.slice(searchIndex);
24659
+ }
24660
+ for (; searchIndex < chunk.length; ) {
24661
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
24662
+ `, searchIndex);
24663
+ let lineEnd = -1;
24664
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = crIndex < lfIndex ? crIndex : lfIndex : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1)
24665
+ break;
24666
+ parseLine(chunk, searchIndex, lineEnd), searchIndex = lineEnd + 1, chunk.charCodeAt(searchIndex - 1) === CR3 && chunk.charCodeAt(searchIndex) === LF3 && searchIndex++;
24667
+ }
24668
+ return chunk.slice(searchIndex);
24669
+ }
24670
+ function parseLine(chunk, start, end) {
24671
+ if (start === end) {
24494
24672
  dispatchEvent();
24495
24673
  return;
24496
24674
  }
24497
- if (line.startsWith(":")) {
24498
- onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
24675
+ const firstCharCode = chunk.charCodeAt(start);
24676
+ if (isDataPrefix3(chunk, start, firstCharCode)) {
24677
+ const valueStart = chunk.charCodeAt(start + 5) === SPACE3 ? start + 6 : start + 5, value2 = chunk.slice(valueStart, end);
24678
+ data = dataLines === 0 ? value2 : `${data}
24679
+ ${value2}`, dataLines++;
24499
24680
  return;
24500
24681
  }
24501
- const fieldSeparatorIndex = line.indexOf(":");
24502
- if (fieldSeparatorIndex !== -1) {
24503
- const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
24504
- processField(field, value, line);
24682
+ if (isEventPrefix3(chunk, start, firstCharCode)) {
24683
+ eventType = chunk.slice(chunk.charCodeAt(start + 6) === SPACE3 ? start + 7 : start + 6, end) || void 0;
24505
24684
  return;
24506
24685
  }
24507
- processField(line, "", line);
24686
+ if (firstCharCode === 105 && chunk.charCodeAt(start + 1) === 100 && chunk.charCodeAt(start + 2) === 58) {
24687
+ const value2 = chunk.slice(chunk.charCodeAt(start + 3) === SPACE3 ? start + 4 : start + 3, end);
24688
+ id = value2.includes("\0") ? void 0 : value2;
24689
+ return;
24690
+ }
24691
+ if (firstCharCode === 58) {
24692
+ if (onComment) {
24693
+ const line2 = chunk.slice(start, end);
24694
+ onComment(line2.slice(chunk.charCodeAt(start + 1) === SPACE3 ? 2 : 1));
24695
+ }
24696
+ return;
24697
+ }
24698
+ const line = chunk.slice(start, end), fieldSeparatorIndex = line.indexOf(":");
24699
+ if (fieldSeparatorIndex === -1) {
24700
+ processField(line, "", line);
24701
+ return;
24702
+ }
24703
+ const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE3 ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
24704
+ processField(field, value, line);
24508
24705
  }
24509
24706
  function processField(field, value, line) {
24510
24707
  switch (field) {
24511
24708
  case "event":
24512
- eventType = value;
24709
+ eventType = value || void 0;
24513
24710
  break;
24514
24711
  case "data":
24515
- data = `${data}${value}
24516
- `;
24712
+ data = dataLines === 0 ? value : `${data}
24713
+ ${value}`, dataLines++;
24517
24714
  break;
24518
24715
  case "id":
24519
24716
  id = value.includes("\0") ? void 0 : value;
@@ -24538,37 +24735,26 @@ function createParser3(callbacks) {
24538
24735
  }
24539
24736
  }
24540
24737
  function dispatchEvent() {
24541
- data.length > 0 && onEvent({
24738
+ dataLines > 0 && onEvent({
24542
24739
  id,
24543
- event: eventType || void 0,
24544
- // If the data buffer's last character is a U+000A LINE FEED (LF) character,
24545
- // then remove the last character from the data buffer.
24546
- data: data.endsWith(`
24547
- `) ? data.slice(0, -1) : data
24548
- }), id = void 0, data = "", eventType = "";
24740
+ event: eventType,
24741
+ data
24742
+ }), id = void 0, data = "", dataLines = 0, eventType = void 0;
24549
24743
  }
24550
24744
  function reset(options = {}) {
24551
- incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
24745
+ if (options.consume && pendingFragments.length > 0) {
24746
+ const incompleteLine = pendingFragments.join("");
24747
+ parseLine(incompleteLine, 0, incompleteLine.length);
24748
+ }
24749
+ isFirstChunk = true, id = void 0, data = "", dataLines = 0, eventType = void 0, pendingFragments.length = 0;
24552
24750
  }
24553
24751
  return { feed, reset };
24554
24752
  }
24555
- function splitLines3(chunk) {
24556
- const lines = [];
24557
- let incompleteLine = "", searchIndex = 0;
24558
- for (; searchIndex < chunk.length; ) {
24559
- const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
24560
- `, searchIndex);
24561
- let lineEnd = -1;
24562
- if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
24563
- incompleteLine = chunk.slice(searchIndex);
24564
- break;
24565
- } else {
24566
- const line = chunk.slice(searchIndex, lineEnd);
24567
- lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
24568
- ` && searchIndex++;
24569
- }
24570
- }
24571
- return [lines, incompleteLine];
24753
+ function isDataPrefix3(chunk, i, firstCharCode) {
24754
+ return firstCharCode === 100 && chunk.charCodeAt(i + 1) === 97 && chunk.charCodeAt(i + 2) === 116 && chunk.charCodeAt(i + 3) === 97 && chunk.charCodeAt(i + 4) === 58;
24755
+ }
24756
+ function isEventPrefix3(chunk, i, firstCharCode) {
24757
+ return firstCharCode === 101 && chunk.charCodeAt(i + 1) === 118 && chunk.charCodeAt(i + 2) === 101 && chunk.charCodeAt(i + 3) === 110 && chunk.charCodeAt(i + 4) === 116 && chunk.charCodeAt(i + 5) === 58;
24572
24758
  }
24573
24759
  var EventSourceParserStream3 = class extends TransformStream {
24574
24760
  constructor({ onError, onRetry, onComment } = {}) {
@@ -24704,7 +24890,7 @@ function withUserAgentSuffix3(headers, ...userAgentSuffixParts) {
24704
24890
  );
24705
24891
  return Object.fromEntries(normalizedHeaders.entries());
24706
24892
  }
24707
- var VERSION6 = "3.0.23";
24893
+ var VERSION6 = "3.0.25";
24708
24894
  var getOriginalFetch4 = () => globalThis.fetch;
24709
24895
  var getFromApi3 = async ({
24710
24896
  url,
@@ -25173,6 +25359,33 @@ var createJsonResponseHandler3 = (responseSchema) => async ({ response, url, req
25173
25359
  rawValue: parsedResult.rawValue
25174
25360
  };
25175
25361
  };
25362
+ var schemaSymbol4 = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
25363
+ function lazySchema3(createSchema) {
25364
+ let schema;
25365
+ return () => {
25366
+ if (schema == null) {
25367
+ schema = createSchema();
25368
+ }
25369
+ return schema;
25370
+ };
25371
+ }
25372
+ function jsonSchema4(jsonSchema22, {
25373
+ validate
25374
+ } = {}) {
25375
+ return {
25376
+ [schemaSymbol4]: true,
25377
+ _type: void 0,
25378
+ // should never be used directly
25379
+ [validatorSymbol3]: true,
25380
+ get jsonSchema() {
25381
+ if (typeof jsonSchema22 === "function") {
25382
+ jsonSchema22 = jsonSchema22();
25383
+ }
25384
+ return jsonSchema22;
25385
+ },
25386
+ validate
25387
+ };
25388
+ }
25176
25389
  function addAdditionalPropertiesToJsonSchema3(jsonSchema22) {
25177
25390
  if (jsonSchema22.type === "object") {
25178
25391
  jsonSchema22.additionalProperties = false;
@@ -25198,13 +25411,6 @@ function addAdditionalPropertiesToJsonSchema3(jsonSchema22) {
25198
25411
  }
25199
25412
  return jsonSchema22;
25200
25413
  }
25201
- var getRelativePath4 = (pathA, pathB) => {
25202
- let i = 0;
25203
- for (; i < pathA.length && i < pathB.length; i++) {
25204
- if (pathA[i] !== pathB[i]) break;
25205
- }
25206
- return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
25207
- };
25208
25414
  var ignoreOverride4 = /* @__PURE__ */ Symbol(
25209
25415
  "Let zodToJsonSchema decide on which parser to use"
25210
25416
  );
@@ -26148,6 +26354,13 @@ var selectParser4 = (def, typeName, refs) => {
26148
26354
  return /* @__PURE__ */ ((_) => void 0)();
26149
26355
  }
26150
26356
  };
26357
+ var getRelativePath4 = (pathA, pathB) => {
26358
+ let i = 0;
26359
+ for (; i < pathA.length && i < pathB.length; i++) {
26360
+ if (pathA[i] !== pathB[i]) break;
26361
+ }
26362
+ return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
26363
+ };
26151
26364
  function parseDef4(def, refs, forceResolution = false) {
26152
26365
  var _a2232;
26153
26366
  const seenItem = refs.seen.get(def);
@@ -26327,33 +26540,6 @@ function zodSchema4(zodSchema22, options) {
26327
26540
  return zod3Schema3(zodSchema22);
26328
26541
  }
26329
26542
  }
26330
- var schemaSymbol4 = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
26331
- function lazySchema3(createSchema) {
26332
- let schema;
26333
- return () => {
26334
- if (schema == null) {
26335
- schema = createSchema();
26336
- }
26337
- return schema;
26338
- };
26339
- }
26340
- function jsonSchema4(jsonSchema22, {
26341
- validate
26342
- } = {}) {
26343
- return {
26344
- [schemaSymbol4]: true,
26345
- _type: void 0,
26346
- // should never be used directly
26347
- [validatorSymbol3]: true,
26348
- get jsonSchema() {
26349
- if (typeof jsonSchema22 === "function") {
26350
- jsonSchema22 = jsonSchema22();
26351
- }
26352
- return jsonSchema22;
26353
- },
26354
- validate
26355
- };
26356
- }
26357
26543
  function isSchema4(value) {
26358
26544
  return typeof value === "object" && value !== null && schemaSymbol4 in value && value[schemaSymbol4] === true && "jsonSchema" in value && "validate" in value;
26359
26545
  }
@@ -26641,6 +26827,19 @@ var gatewayErrorResponseSchema3 = lazyValidator2(
26641
26827
  })
26642
26828
  )
26643
26829
  );
26830
+ function extractApiCallResponse3(error) {
26831
+ if (error.data !== void 0) {
26832
+ return error.data;
26833
+ }
26834
+ if (error.responseBody != null) {
26835
+ try {
26836
+ return JSON.parse(error.responseBody);
26837
+ } catch (e2) {
26838
+ return error.responseBody;
26839
+ }
26840
+ }
26841
+ return {};
26842
+ }
26644
26843
  var name72 = "GatewayTimeoutError";
26645
26844
  var marker82 = `vercel.ai.gateway.error.${name72}`;
26646
26845
  var symbol82 = Symbol.for(marker82);
@@ -26727,19 +26926,6 @@ async function asGatewayError3(error, authMethod) {
26727
26926
  authMethod
26728
26927
  });
26729
26928
  }
26730
- function extractApiCallResponse3(error) {
26731
- if (error.data !== void 0) {
26732
- return error.data;
26733
- }
26734
- if (error.responseBody != null) {
26735
- try {
26736
- return JSON.parse(error.responseBody);
26737
- } catch (e2) {
26738
- return error.responseBody;
26739
- }
26740
- }
26741
- return {};
26742
- }
26743
26929
  var GATEWAY_AUTH_METHOD_HEADER3 = "ai-gateway-auth-method";
26744
26930
  async function parseAuthMethod3(headers) {
26745
26931
  const result = await safeValidateTypes4({
@@ -27526,7 +27712,7 @@ async function getVercelRequestId3() {
27526
27712
  var _a93;
27527
27713
  return (_a93 = getContext3().headers) == null ? void 0 : _a93["x-vercel-id"];
27528
27714
  }
27529
- var VERSION24 = "2.0.82";
27715
+ var VERSION24 = "2.0.86";
27530
27716
  var AI_GATEWAY_PROTOCOL_VERSION3 = "0.0.1";
27531
27717
  function createGatewayProvider3(options = {}) {
27532
27718
  var _a93, _b92;
@@ -30849,5 +31035,5 @@ var OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE = createRoute({
30849
31035
  });
30850
31036
 
30851
31037
  export { CANCEL_AGENT_BUILDER_ACTION_RUN_ROUTE, CREATE_AGENT_BUILDER_ACTION_RUN_ROUTE, GET_AGENT_BUILDER_ACTION_BY_ID_ROUTE, GET_AGENT_BUILDER_ACTION_RUN_BY_ID_ROUTE, LIST_AGENT_BUILDER_ACTIONS_ROUTE, LIST_AGENT_BUILDER_ACTION_RUNS_ROUTE, OBSERVE_STREAM_AGENT_BUILDER_ACTION_ROUTE, OBSERVE_STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, RESUME_AGENT_BUILDER_ACTION_ROUTE, RESUME_ASYNC_AGENT_BUILDER_ACTION_ROUTE, RESUME_STREAM_AGENT_BUILDER_ACTION_ROUTE, START_AGENT_BUILDER_ACTION_RUN_ROUTE, START_ASYNC_AGENT_BUILDER_ACTION_ROUTE, STREAM_AGENT_BUILDER_ACTION_ROUTE, STREAM_LEGACY_AGENT_BUILDER_ACTION_ROUTE, agent_builder_exports };
30852
- //# sourceMappingURL=chunk-MGSLTJZ3.js.map
30853
- //# sourceMappingURL=chunk-MGSLTJZ3.js.map
31038
+ //# sourceMappingURL=chunk-NPNRCLYK.js.map
31039
+ //# sourceMappingURL=chunk-NPNRCLYK.js.map