@mastra/core 1.13.3-alpha.1 → 1.14.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/_types/@internal_core/dist/index.d.ts +1333 -0
  3. package/dist/agent/index.cjs +13 -13
  4. package/dist/agent/index.js +2 -2
  5. package/dist/agent/message-list/conversion/output-converter.d.ts.map +1 -1
  6. package/dist/agent/message-list/index.cjs +18 -18
  7. package/dist/agent/message-list/index.js +1 -1
  8. package/dist/agent/message-list/message-list.d.ts +12 -1
  9. package/dist/agent/message-list/message-list.d.ts.map +1 -1
  10. package/dist/agent/message-list/types.d.ts +3 -3
  11. package/dist/agent/types.d.ts +1 -1
  12. package/dist/{chunk-3B6BQEKK.cjs → chunk-2FDGDAJQ.cjs} +3 -3
  13. package/dist/{chunk-3B6BQEKK.cjs.map → chunk-2FDGDAJQ.cjs.map} +1 -1
  14. package/dist/{chunk-GYSKVDYD.js → chunk-3TECGW34.js} +5 -5
  15. package/dist/{chunk-GYSKVDYD.js.map → chunk-3TECGW34.js.map} +1 -1
  16. package/dist/{chunk-Q4W5XQK2.cjs → chunk-445B4SO3.cjs} +292 -403
  17. package/dist/chunk-445B4SO3.cjs.map +1 -0
  18. package/dist/{chunk-WO2CP4Z2.cjs → chunk-4X35LO4W.cjs} +32 -156
  19. package/dist/chunk-4X35LO4W.cjs.map +1 -0
  20. package/dist/{chunk-GC7AHOXK.js → chunk-5LHPEIQQ.js} +12 -12
  21. package/dist/chunk-5LHPEIQQ.js.map +1 -0
  22. package/dist/{chunk-CMTNYR6E.js → chunk-5UAF67E3.js} +9 -9
  23. package/dist/{chunk-CMTNYR6E.js.map → chunk-5UAF67E3.js.map} +1 -1
  24. package/dist/{chunk-SBHYPYXD.js → chunk-5WKCTOYN.js} +13 -13
  25. package/dist/chunk-5WKCTOYN.js.map +1 -0
  26. package/dist/{chunk-WKZEZJKQ.js → chunk-7V4HN5NK.js} +5 -5
  27. package/dist/{chunk-WKZEZJKQ.js.map → chunk-7V4HN5NK.js.map} +1 -1
  28. package/dist/{chunk-F3SHGIQA.cjs → chunk-B3KIJAOJ.cjs} +185 -185
  29. package/dist/{chunk-F3SHGIQA.cjs.map → chunk-B3KIJAOJ.cjs.map} +1 -1
  30. package/dist/{chunk-TAXQJ5ZP.js → chunk-BOUXMXZQ.js} +4 -94
  31. package/dist/chunk-BOUXMXZQ.js.map +1 -0
  32. package/dist/{chunk-MIILNUS4.cjs → chunk-DDIY3CRP.cjs} +10 -10
  33. package/dist/chunk-DDIY3CRP.cjs.map +1 -0
  34. package/dist/{chunk-4RWTWZET.cjs → chunk-EAKNCJKL.cjs} +31 -433
  35. package/dist/chunk-EAKNCJKL.cjs.map +1 -0
  36. package/dist/{chunk-RE3YFYVQ.cjs → chunk-EH5D56XV.cjs} +7 -7
  37. package/dist/{chunk-RE3YFYVQ.cjs.map → chunk-EH5D56XV.cjs.map} +1 -1
  38. package/dist/{chunk-A2B3L753.js → chunk-FZNKE4DK.js} +4 -4
  39. package/dist/{chunk-A2B3L753.js.map → chunk-FZNKE4DK.js.map} +1 -1
  40. package/dist/chunk-GVQJCS5O.js +812 -0
  41. package/dist/chunk-GVQJCS5O.js.map +1 -0
  42. package/dist/{chunk-NUZYNU4M.cjs → chunk-J7Q3CZI5.cjs} +14 -14
  43. package/dist/{chunk-NUZYNU4M.cjs.map → chunk-J7Q3CZI5.cjs.map} +1 -1
  44. package/dist/{chunk-CJYTDH5Q.js → chunk-KJUHI5QK.js} +5 -5
  45. package/dist/chunk-KJUHI5QK.js.map +1 -0
  46. package/dist/{chunk-B44JEQHW.js → chunk-KKNT7W4Q.js} +4 -4
  47. package/dist/{chunk-B44JEQHW.js.map → chunk-KKNT7W4Q.js.map} +1 -1
  48. package/dist/{chunk-FDC6E3MJ.cjs → chunk-LAFTYVLN.cjs} +72 -72
  49. package/dist/chunk-LAFTYVLN.cjs.map +1 -0
  50. package/dist/chunk-LIRWMGGI.cjs +931 -0
  51. package/dist/chunk-LIRWMGGI.cjs.map +1 -0
  52. package/dist/{chunk-6JM4RID6.js → chunk-MCAE3D3S.js} +41 -7
  53. package/dist/chunk-MCAE3D3S.js.map +1 -0
  54. package/dist/{chunk-T5M2TGCD.js → chunk-OGR427FH.js} +14 -350
  55. package/dist/chunk-OGR427FH.js.map +1 -0
  56. package/dist/{chunk-AZZGCVBY.js → chunk-PV2DBPYF.js} +3 -3
  57. package/dist/{chunk-AZZGCVBY.js.map → chunk-PV2DBPYF.js.map} +1 -1
  58. package/dist/{chunk-Z7JQTINS.js → chunk-QROAUTDP.js} +3 -3
  59. package/dist/{chunk-Z7JQTINS.js.map → chunk-QROAUTDP.js.map} +1 -1
  60. package/dist/{chunk-DRZWU4MQ.cjs → chunk-RQFAL5VW.cjs} +13 -13
  61. package/dist/chunk-RQFAL5VW.cjs.map +1 -0
  62. package/dist/{chunk-YTSTLTQ5.cjs → chunk-SRNRUDZ2.cjs} +21 -21
  63. package/dist/{chunk-YTSTLTQ5.cjs.map → chunk-SRNRUDZ2.cjs.map} +1 -1
  64. package/dist/{chunk-L2YA2HHZ.js → chunk-SRVR5Z2F.js} +5 -5
  65. package/dist/{chunk-L2YA2HHZ.js.map → chunk-SRVR5Z2F.js.map} +1 -1
  66. package/dist/{chunk-KMG525KB.js → chunk-TFV75T4H.js} +10 -10
  67. package/dist/{chunk-KMG525KB.js.map → chunk-TFV75T4H.js.map} +1 -1
  68. package/dist/{chunk-26JVEE76.cjs → chunk-UHO57W6H.cjs} +7 -7
  69. package/dist/{chunk-26JVEE76.cjs.map → chunk-UHO57W6H.cjs.map} +1 -1
  70. package/dist/{chunk-QXNHZJRV.js → chunk-UWTB4U2X.js} +127 -238
  71. package/dist/chunk-UWTB4U2X.js.map +1 -0
  72. package/dist/{chunk-E2Y2HLCU.cjs → chunk-W2LUCUUP.cjs} +41 -7
  73. package/dist/chunk-W2LUCUUP.cjs.map +1 -0
  74. package/dist/{chunk-X7IX2H7I.cjs → chunk-XVH7SCZN.cjs} +13 -13
  75. package/dist/{chunk-X7IX2H7I.cjs.map → chunk-XVH7SCZN.cjs.map} +1 -1
  76. package/dist/{chunk-CXYQJVHK.cjs → chunk-YSQC2LEG.cjs} +10 -10
  77. package/dist/{chunk-CXYQJVHK.cjs.map → chunk-YSQC2LEG.cjs.map} +1 -1
  78. package/dist/{chunk-XNHOUTCP.cjs → chunk-ZSFSSMFT.cjs} +84 -84
  79. package/dist/{chunk-XNHOUTCP.cjs.map → chunk-ZSFSSMFT.cjs.map} +1 -1
  80. package/dist/datasets/index.cjs +17 -17
  81. package/dist/datasets/index.js +2 -2
  82. package/dist/docs/SKILL.md +1 -1
  83. package/dist/docs/assets/SOURCE_MAP.json +721 -708
  84. package/dist/docs/references/docs-agents-adding-voice.md +6 -6
  85. package/dist/docs/references/docs-agents-agent-approval.md +4 -4
  86. package/dist/docs/references/docs-agents-guardrails.md +1 -1
  87. package/dist/docs/references/docs-agents-network-approval.md +1 -1
  88. package/dist/docs/references/docs-agents-networks.md +1 -1
  89. package/dist/docs/references/docs-agents-overview.md +2 -2
  90. package/dist/docs/references/docs-agents-processors.md +11 -11
  91. package/dist/docs/references/docs-agents-structured-output.md +4 -4
  92. package/dist/docs/references/docs-agents-supervisor-agents.md +3 -3
  93. package/dist/docs/references/docs-agents-using-tools.md +4 -4
  94. package/dist/docs/references/docs-evals-custom-scorers.md +4 -4
  95. package/dist/docs/references/docs-evals-overview.md +2 -2
  96. package/dist/docs/references/docs-memory-memory-processors.md +6 -6
  97. package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
  98. package/dist/docs/references/docs-memory-storage.md +1 -1
  99. package/dist/docs/references/docs-memory-working-memory.md +1 -1
  100. package/dist/docs/references/docs-observability-datasets-running-experiments.md +1 -1
  101. package/dist/docs/references/docs-observability-tracing-exporters-langfuse.md +1 -1
  102. package/dist/docs/references/docs-observability-tracing-exporters-langsmith.md +2 -2
  103. package/dist/docs/references/docs-rag-graph-rag.md +2 -2
  104. package/dist/docs/references/docs-rag-retrieval.md +12 -12
  105. package/dist/docs/references/docs-server-mastra-client.md +1 -1
  106. package/dist/docs/references/docs-server-request-context.md +3 -3
  107. package/dist/docs/references/docs-streaming-tool-streaming.md +1 -1
  108. package/dist/docs/references/docs-voice-overview.md +21 -21
  109. package/dist/docs/references/docs-voice-speech-to-speech.md +2 -2
  110. package/dist/docs/references/docs-voice-speech-to-text.md +1 -1
  111. package/dist/docs/references/docs-voice-text-to-speech.md +1 -1
  112. package/dist/docs/references/docs-workspace-filesystem.md +1 -1
  113. package/dist/docs/references/docs-workspace-overview.md +1 -1
  114. package/dist/docs/references/docs-workspace-sandbox.md +1 -1
  115. package/dist/docs/references/reference-agents-agent.md +5 -5
  116. package/dist/docs/references/reference-agents-generateLegacy.md +2 -2
  117. package/dist/docs/references/reference-agents-getLLM.md +1 -1
  118. package/dist/docs/references/reference-agents-network.md +1 -1
  119. package/dist/docs/references/reference-configuration.md +3 -3
  120. package/dist/docs/references/reference-evals-answer-relevancy.md +1 -1
  121. package/dist/docs/references/reference-evals-answer-similarity.md +1 -1
  122. package/dist/docs/references/reference-evals-bias.md +1 -1
  123. package/dist/docs/references/reference-evals-context-precision.md +3 -3
  124. package/dist/docs/references/reference-evals-faithfulness.md +1 -1
  125. package/dist/docs/references/reference-evals-hallucination.md +5 -5
  126. package/dist/docs/references/reference-evals-toxicity.md +1 -1
  127. package/dist/docs/references/reference-harness-harness-class.md +4 -4
  128. package/dist/docs/references/reference-memory-memory-class.md +3 -3
  129. package/dist/docs/references/reference-memory-observational-memory.md +5 -5
  130. package/dist/docs/references/reference-processors-batch-parts-processor.md +1 -1
  131. package/dist/docs/references/reference-processors-language-detector.md +1 -1
  132. package/dist/docs/references/reference-processors-moderation-processor.md +2 -2
  133. package/dist/docs/references/reference-processors-pii-detector.md +2 -2
  134. package/dist/docs/references/reference-processors-processor-interface.md +3 -3
  135. package/dist/docs/references/reference-processors-prompt-injection-detector.md +1 -1
  136. package/dist/docs/references/reference-processors-system-prompt-scrubber.md +1 -1
  137. package/dist/docs/references/reference-processors-token-limiter-processor.md +3 -3
  138. package/dist/docs/references/reference-processors-tool-search-processor.md +2 -2
  139. package/dist/docs/references/reference-processors-unicode-normalizer.md +1 -1
  140. package/dist/docs/references/reference-storage-mongodb.md +1 -1
  141. package/dist/docs/references/reference-storage-postgresql.md +1 -1
  142. package/dist/docs/references/reference-storage-upstash.md +1 -1
  143. package/dist/docs/references/reference-templates-overview.md +1 -1
  144. package/dist/docs/references/reference-tools-mcp-client.md +2 -2
  145. package/dist/docs/references/reference-tools-mcp-server.md +1 -1
  146. package/dist/docs/references/reference-tools-vector-query-tool.md +1 -1
  147. package/dist/docs/references/reference-vectors-libsql.md +1 -1
  148. package/dist/docs/references/reference-vectors-mongodb.md +1 -1
  149. package/dist/docs/references/reference-vectors-pg.md +1 -1
  150. package/dist/docs/references/reference-vectors-upstash.md +1 -1
  151. package/dist/docs/references/reference-voice-voice.addInstructions.md +1 -1
  152. package/dist/docs/references/reference-workspace-local-filesystem.md +1 -1
  153. package/dist/docs/references/reference-workspace-local-sandbox.md +1 -1
  154. package/dist/evals/index.cjs +20 -20
  155. package/dist/evals/index.js +3 -3
  156. package/dist/evals/scoreTraces/index.cjs +7 -7
  157. package/dist/evals/scoreTraces/index.js +3 -3
  158. package/dist/features/index.cjs +2 -1
  159. package/dist/features/index.cjs.map +1 -1
  160. package/dist/features/index.d.ts.map +1 -1
  161. package/dist/features/index.js +2 -1
  162. package/dist/features/index.js.map +1 -1
  163. package/dist/harness/index.cjs +7 -7
  164. package/dist/harness/index.js +5 -5
  165. package/dist/index.cjs +2 -2
  166. package/dist/index.js +1 -1
  167. package/dist/llm/index.cjs +16 -16
  168. package/dist/llm/index.js +5 -5
  169. package/dist/llm/model/base.types.d.ts +1 -1
  170. package/dist/llm/model/provider-types.generated.d.ts +4 -4
  171. package/dist/loop/index.cjs +14 -14
  172. package/dist/loop/index.js +1 -1
  173. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  174. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  175. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  176. package/dist/mastra/index.cjs +2 -2
  177. package/dist/mastra/index.js +1 -1
  178. package/dist/memory/index.cjs +14 -14
  179. package/dist/memory/index.js +1 -1
  180. package/dist/memory/types.d.ts +1 -1
  181. package/dist/models-dev-E24MAXL2.cjs +12 -0
  182. package/dist/{models-dev-SOEEI4UR.cjs.map → models-dev-E24MAXL2.cjs.map} +1 -1
  183. package/dist/models-dev-F65PLXGJ.js +3 -0
  184. package/dist/{models-dev-EKZCLX7Y.js.map → models-dev-F65PLXGJ.js.map} +1 -1
  185. package/dist/netlify-FT3VYX27.cjs +12 -0
  186. package/dist/{netlify-SSPGBXOO.cjs.map → netlify-FT3VYX27.cjs.map} +1 -1
  187. package/dist/netlify-NYUZ5ZTO.js +3 -0
  188. package/dist/{netlify-ALYV7577.js.map → netlify-NYUZ5ZTO.js.map} +1 -1
  189. package/dist/observability/index.cjs +17 -17
  190. package/dist/observability/index.js +1 -1
  191. package/dist/observability/types/tracing.d.ts +2 -22
  192. package/dist/observability/types/tracing.d.ts.map +1 -1
  193. package/dist/processor-provider/index.cjs +10 -10
  194. package/dist/processor-provider/index.js +1 -1
  195. package/dist/processors/index.cjs +42 -42
  196. package/dist/processors/index.js +1 -1
  197. package/dist/provider-registry-5R2TUINW.js +3 -0
  198. package/dist/{provider-registry-AZ4SPASK.js.map → provider-registry-5R2TUINW.js.map} +1 -1
  199. package/dist/provider-registry-TVYED7F2.cjs +40 -0
  200. package/dist/{provider-registry-35V252GM.cjs.map → provider-registry-TVYED7F2.cjs.map} +1 -1
  201. package/dist/provider-registry.json +8 -8
  202. package/dist/relevance/index.cjs +3 -3
  203. package/dist/relevance/index.js +1 -1
  204. package/dist/storage/constants.cjs +56 -56
  205. package/dist/storage/constants.d.ts +1 -1
  206. package/dist/storage/constants.js +1 -1
  207. package/dist/storage/domains/memory/inmemory.d.ts.map +1 -1
  208. package/dist/storage/domains/observability/discovery.d.ts +1 -63
  209. package/dist/storage/domains/observability/discovery.d.ts.map +1 -1
  210. package/dist/storage/domains/observability/feedback.d.ts +1 -185
  211. package/dist/storage/domains/observability/feedback.d.ts.map +1 -1
  212. package/dist/storage/domains/observability/logs.d.ts +1 -321
  213. package/dist/storage/domains/observability/logs.d.ts.map +1 -1
  214. package/dist/storage/domains/observability/metrics.d.ts +1 -394
  215. package/dist/storage/domains/observability/metrics.d.ts.map +1 -1
  216. package/dist/storage/domains/observability/scores.d.ts +1 -192
  217. package/dist/storage/domains/observability/scores.d.ts.map +1 -1
  218. package/dist/storage/domains/observability/tracing.d.ts +50 -52
  219. package/dist/storage/domains/observability/tracing.d.ts.map +1 -1
  220. package/dist/storage/domains/shared.d.ts +1 -118
  221. package/dist/storage/domains/shared.d.ts.map +1 -1
  222. package/dist/storage/index.cjs +479 -466
  223. package/dist/storage/index.js +3 -2
  224. package/dist/stream/index.cjs +11 -11
  225. package/dist/stream/index.js +2 -2
  226. package/dist/test-utils/llm-mock.cjs +4 -4
  227. package/dist/test-utils/llm-mock.js +1 -1
  228. package/dist/tool-loop-agent/index.cjs +4 -4
  229. package/dist/tool-loop-agent/index.js +1 -1
  230. package/dist/utils.cjs +23 -23
  231. package/dist/utils.js +1 -1
  232. package/dist/vector/embed.d.ts +2 -2
  233. package/dist/vector/index.cjs +7 -7
  234. package/dist/vector/index.js +1 -1
  235. package/dist/workflows/evented/index.cjs +10 -10
  236. package/dist/workflows/evented/index.js +1 -1
  237. package/dist/workflows/index.cjs +24 -24
  238. package/dist/workflows/index.js +1 -1
  239. package/package.json +6 -5
  240. package/src/llm/model/provider-types.generated.d.ts +4 -4
  241. package/dist/chunk-4RWTWZET.cjs.map +0 -1
  242. package/dist/chunk-6JM4RID6.js.map +0 -1
  243. package/dist/chunk-CJYTDH5Q.js.map +0 -1
  244. package/dist/chunk-DJCCDPZQ.js +0 -376
  245. package/dist/chunk-DJCCDPZQ.js.map +0 -1
  246. package/dist/chunk-DRZWU4MQ.cjs.map +0 -1
  247. package/dist/chunk-E2Y2HLCU.cjs.map +0 -1
  248. package/dist/chunk-FDC6E3MJ.cjs.map +0 -1
  249. package/dist/chunk-GC7AHOXK.js.map +0 -1
  250. package/dist/chunk-MIILNUS4.cjs.map +0 -1
  251. package/dist/chunk-PBDJR7QN.cjs +0 -393
  252. package/dist/chunk-PBDJR7QN.cjs.map +0 -1
  253. package/dist/chunk-Q4W5XQK2.cjs.map +0 -1
  254. package/dist/chunk-QXNHZJRV.js.map +0 -1
  255. package/dist/chunk-SBHYPYXD.js.map +0 -1
  256. package/dist/chunk-T5M2TGCD.js.map +0 -1
  257. package/dist/chunk-TAXQJ5ZP.js.map +0 -1
  258. package/dist/chunk-WO2CP4Z2.cjs.map +0 -1
  259. package/dist/models-dev-EKZCLX7Y.js +0 -3
  260. package/dist/models-dev-SOEEI4UR.cjs +0 -12
  261. package/dist/netlify-ALYV7577.js +0 -3
  262. package/dist/netlify-SSPGBXOO.cjs +0 -12
  263. package/dist/provider-registry-35V252GM.cjs +0 -40
  264. package/dist/provider-registry-AZ4SPASK.js +0 -3
@@ -3,22 +3,22 @@
3
3
  var chunkLDLSSJ7X_cjs = require('./chunk-LDLSSJ7X.cjs');
4
4
  var chunkZCBG4ZQT_cjs = require('./chunk-ZCBG4ZQT.cjs');
5
5
  var chunkBMKSUZBT_cjs = require('./chunk-BMKSUZBT.cjs');
6
- var chunk4RWTWZET_cjs = require('./chunk-4RWTWZET.cjs');
7
- var chunkE2Y2HLCU_cjs = require('./chunk-E2Y2HLCU.cjs');
6
+ var chunkEAKNCJKL_cjs = require('./chunk-EAKNCJKL.cjs');
7
+ var chunkW2LUCUUP_cjs = require('./chunk-W2LUCUUP.cjs');
8
8
  var chunkVBVOKSJK_cjs = require('./chunk-VBVOKSJK.cjs');
9
9
  var chunkCFMZZDO2_cjs = require('./chunk-CFMZZDO2.cjs');
10
10
  var chunkMR7ZWBL6_cjs = require('./chunk-MR7ZWBL6.cjs');
11
- var chunkXNHOUTCP_cjs = require('./chunk-XNHOUTCP.cjs');
12
- var chunkNUZYNU4M_cjs = require('./chunk-NUZYNU4M.cjs');
11
+ var chunkZSFSSMFT_cjs = require('./chunk-ZSFSSMFT.cjs');
12
+ var chunkJ7Q3CZI5_cjs = require('./chunk-J7Q3CZI5.cjs');
13
13
  var chunk6BJ7XHRH_cjs = require('./chunk-6BJ7XHRH.cjs');
14
14
  var chunkOQDRPRKM_cjs = require('./chunk-OQDRPRKM.cjs');
15
- var chunkMIILNUS4_cjs = require('./chunk-MIILNUS4.cjs');
16
- var chunkPBDJR7QN_cjs = require('./chunk-PBDJR7QN.cjs');
17
- var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
15
+ var chunkDDIY3CRP_cjs = require('./chunk-DDIY3CRP.cjs');
16
+ var chunkLIRWMGGI_cjs = require('./chunk-LIRWMGGI.cjs');
18
17
  var chunkKJBMTK5B_cjs = require('./chunk-KJBMTK5B.cjs');
19
18
  var chunkNQXA2BUF_cjs = require('./chunk-NQXA2BUF.cjs');
20
19
  var chunkVWJ7H3MJ_cjs = require('./chunk-VWJ7H3MJ.cjs');
21
20
  var chunk5WBEMKE2_cjs = require('./chunk-5WBEMKE2.cjs');
21
+ var chunk4U7ZLI36_cjs = require('./chunk-4U7ZLI36.cjs');
22
22
  var chunkRO47SMI7_cjs = require('./chunk-RO47SMI7.cjs');
23
23
  var chunk7XAECHYL_cjs = require('./chunk-7XAECHYL.cjs');
24
24
  var chunkBVWXTWXP_cjs = require('./chunk-BVWXTWXP.cjs');
@@ -793,7 +793,7 @@ var StructuredOutputProcessor = class {
793
793
  }
794
794
  async processOutputStream(args) {
795
795
  const { part, state, streamParts, abort, ...rest } = args;
796
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
796
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
797
797
  const controller = state.controller;
798
798
  switch (part.type) {
799
799
  case "finish":
@@ -1090,7 +1090,7 @@ var ProcessorState = class {
1090
1090
  this.span = parentSpan?.createChildSpan({
1091
1091
  type: "processor_run" /* PROCESSOR_RUN */,
1092
1092
  name: `output stream processor: ${options.processorName}`,
1093
- entityType: "output_processor" /* OUTPUT_PROCESSOR */,
1093
+ entityType: chunkLIRWMGGI_cjs.EntityType.OUTPUT_PROCESSOR,
1094
1094
  entityName: options.processorName,
1095
1095
  attributes: {
1096
1096
  processorExecutor: "legacy",
@@ -1267,7 +1267,7 @@ var ProcessorRunner = class _ProcessorRunner {
1267
1267
  const processorSpan = parentSpan?.createChildSpan({
1268
1268
  type: "processor_run" /* PROCESSOR_RUN */,
1269
1269
  name: `output processor: ${processor.id}`,
1270
- entityType: "output_processor" /* OUTPUT_PROCESSOR */,
1270
+ entityType: chunkLIRWMGGI_cjs.EntityType.OUTPUT_PROCESSOR,
1271
1271
  entityId: processor.id,
1272
1272
  entityName: processor.name,
1273
1273
  attributes: {
@@ -1291,13 +1291,13 @@ var ProcessorRunner = class _ProcessorRunner {
1291
1291
  state: processorState.customState,
1292
1292
  result: result ?? defaultResult,
1293
1293
  abort,
1294
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1294
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1295
1295
  requestContext,
1296
1296
  retryCount,
1297
1297
  writer
1298
1298
  });
1299
1299
  const mutations = messageList.stopRecording();
1300
- if (processResult instanceof chunkE2Y2HLCU_cjs.MessageList) {
1300
+ if (processResult instanceof chunkW2LUCUUP_cjs.MessageList) {
1301
1301
  if (processResult !== messageList) {
1302
1302
  throw new chunk4U7ZLI36_cjs.MastraError({
1303
1303
  category: "USER",
@@ -1425,7 +1425,7 @@ var ProcessorRunner = class _ProcessorRunner {
1425
1425
  abort: (reason, options) => {
1426
1426
  throw new TripWire(reason || `Stream part blocked by ${processor.id}`, options, processor.id);
1427
1427
  },
1428
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: state.span }),
1428
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: state.span }),
1429
1429
  requestContext,
1430
1430
  messageList,
1431
1431
  retryCount,
@@ -1567,7 +1567,7 @@ var ProcessorRunner = class _ProcessorRunner {
1567
1567
  const processorSpan = parentSpan?.createChildSpan({
1568
1568
  type: "processor_run" /* PROCESSOR_RUN */,
1569
1569
  name: `input processor: ${processor.id}`,
1570
- entityType: "input_processor" /* INPUT_PROCESSOR */,
1570
+ entityType: chunkLIRWMGGI_cjs.EntityType.INPUT_PROCESSOR,
1571
1571
  entityId: processor.id,
1572
1572
  entityName: processor.name,
1573
1573
  attributes: {
@@ -1585,13 +1585,13 @@ var ProcessorRunner = class _ProcessorRunner {
1585
1585
  systemMessages: currentSystemMessages,
1586
1586
  state: processorState.customState,
1587
1587
  abort,
1588
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1588
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1589
1589
  messageList,
1590
1590
  requestContext,
1591
1591
  retryCount
1592
1592
  });
1593
1593
  let mutations;
1594
- if (result instanceof chunkE2Y2HLCU_cjs.MessageList) {
1594
+ if (result instanceof chunkW2LUCUUP_cjs.MessageList) {
1595
1595
  if (result !== messageList) {
1596
1596
  throw new chunk4U7ZLI36_cjs.MastraError({
1597
1597
  category: "USER",
@@ -1696,7 +1696,7 @@ var ProcessorRunner = class _ProcessorRunner {
1696
1696
  */
1697
1697
  async runProcessInputStep(args) {
1698
1698
  const { messageList, stepNumber, steps, requestContext, writer } = args;
1699
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(args);
1699
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(args);
1700
1700
  const stepInput = {
1701
1701
  messageId: args.messageId,
1702
1702
  tools: args.tools,
@@ -1766,7 +1766,7 @@ var ProcessorRunner = class _ProcessorRunner {
1766
1766
  const processorSpan = currentSpan?.createChildSpan({
1767
1767
  type: "processor_run" /* PROCESSOR_RUN */,
1768
1768
  name: `input step processor: ${processor.id}`,
1769
- entityType: "input_step_processor" /* INPUT_STEP_PROCESSOR */,
1769
+ entityType: chunkLIRWMGGI_cjs.EntityType.INPUT_STEP_PROCESSOR,
1770
1770
  entityId: processor.id,
1771
1771
  entityName: processor.name,
1772
1772
  attributes: {
@@ -1797,7 +1797,7 @@ var ProcessorRunner = class _ProcessorRunner {
1797
1797
  return nextMessageId;
1798
1798
  }
1799
1799
  } : {},
1800
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1800
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1801
1801
  retryCount: args.retryCount ?? 0,
1802
1802
  writer,
1803
1803
  abortSignal: args.abortSignal
@@ -1892,7 +1892,7 @@ var ProcessorRunner = class _ProcessorRunner {
1892
1892
  retryCount = 0,
1893
1893
  writer
1894
1894
  } = args;
1895
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(args);
1895
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(args);
1896
1896
  for (const [index, processorOrWorkflow] of this.outputProcessors.entries()) {
1897
1897
  const processableMessages = messageList.get.all.db();
1898
1898
  const idsBeforeProcessing = processableMessages.map((m) => m.id);
@@ -1932,7 +1932,7 @@ var ProcessorRunner = class _ProcessorRunner {
1932
1932
  const processorSpan = parentSpan?.createChildSpan({
1933
1933
  type: "processor_run" /* PROCESSOR_RUN */,
1934
1934
  name: `output step processor: ${processor.id}`,
1935
- entityType: "output_step_processor" /* OUTPUT_STEP_PROCESSOR */,
1935
+ entityType: chunkLIRWMGGI_cjs.EntityType.OUTPUT_STEP_PROCESSOR,
1936
1936
  entityId: processor.id,
1937
1937
  entityName: processor.name,
1938
1938
  attributes: {
@@ -1956,13 +1956,13 @@ var ProcessorRunner = class _ProcessorRunner {
1956
1956
  steps,
1957
1957
  state: processorState.customState,
1958
1958
  abort,
1959
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1959
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: processorSpan }),
1960
1960
  requestContext,
1961
1961
  retryCount,
1962
1962
  writer
1963
1963
  });
1964
1964
  const mutations = messageList.stopRecording();
1965
- if (result instanceof chunkE2Y2HLCU_cjs.MessageList) {
1965
+ if (result instanceof chunkW2LUCUUP_cjs.MessageList) {
1966
1966
  if (result !== messageList) {
1967
1967
  throw new chunk4U7ZLI36_cjs.MastraError({
1968
1968
  category: "USER",
@@ -2035,7 +2035,7 @@ var ProcessorRunner = class _ProcessorRunner {
2035
2035
  processor,
2036
2036
  stepNumber
2037
2037
  }) {
2038
- if (result instanceof chunkE2Y2HLCU_cjs.MessageList) {
2038
+ if (result instanceof chunkW2LUCUUP_cjs.MessageList) {
2039
2039
  if (result !== messageList) {
2040
2040
  throw new chunk4U7ZLI36_cjs.MastraError({
2041
2041
  category: "USER",
@@ -2070,7 +2070,7 @@ var ProcessorRunner = class _ProcessorRunner {
2070
2070
  }
2071
2071
  const { model: _model, ...rest } = result;
2072
2072
  if (result.model) {
2073
- const resolvedModel = await chunkXNHOUTCP_cjs.resolveModelConfig(result.model);
2073
+ const resolvedModel = await chunkZSFSSMFT_cjs.resolveModelConfig(result.model);
2074
2074
  const isSupported = isSupportedLanguageModel(resolvedModel);
2075
2075
  if (!isSupported) {
2076
2076
  throw new chunk4U7ZLI36_cjs.MastraError({
@@ -2876,7 +2876,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
2876
2876
  } = await processorRunner.processPart(
2877
2877
  chunk,
2878
2878
  processorStates,
2879
- chunkPBDJR7QN_cjs.resolveObservabilityContext(options),
2879
+ chunkLIRWMGGI_cjs.resolveObservabilityContext(options),
2880
2880
  options.requestContext,
2881
2881
  self.messageList,
2882
2882
  0,
@@ -3268,7 +3268,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
3268
3268
  };
3269
3269
  self.messageList = await self.processorRunner.runOutputProcessors(
3270
3270
  self.messageList,
3271
- chunkPBDJR7QN_cjs.resolveObservabilityContext(options),
3271
+ chunkLIRWMGGI_cjs.resolveObservabilityContext(options),
3272
3272
  self.#options.requestContext,
3273
3273
  0,
3274
3274
  outputResultWriter,
@@ -3276,7 +3276,7 @@ var MastraModelOutput = class extends chunkRO47SMI7_cjs.MastraBase {
3276
3276
  );
3277
3277
  const responseMessages = self.messageList.get.response.aiV4.core();
3278
3278
  const lastResponseMessage = responseMessages[responseMessages.length - 1];
3279
- const outputText = lastResponseMessage ? chunkE2Y2HLCU_cjs.coreContentToString(lastResponseMessage.content) : "";
3279
+ const outputText = lastResponseMessage ? chunkW2LUCUUP_cjs.coreContentToString(lastResponseMessage.content) : "";
3280
3280
  if (lastStep && outputText && outputText !== originalText) {
3281
3281
  lastStep.text = outputText;
3282
3282
  }
@@ -4648,7 +4648,7 @@ function convertMastraChunkToAISDKv5({
4648
4648
  if (mode === "generate") {
4649
4649
  return {
4650
4650
  type: "file",
4651
- file: new chunkE2Y2HLCU_cjs.DefaultGeneratedFile({
4651
+ file: new chunkW2LUCUUP_cjs.DefaultGeneratedFile({
4652
4652
  data: chunk.payload.data,
4653
4653
  mediaType: chunk.payload.mimeType
4654
4654
  })
@@ -4656,7 +4656,7 @@ function convertMastraChunkToAISDKv5({
4656
4656
  }
4657
4657
  return {
4658
4658
  type: "file",
4659
- file: new chunkE2Y2HLCU_cjs.DefaultGeneratedFileWithType({
4659
+ file: new chunkW2LUCUUP_cjs.DefaultGeneratedFileWithType({
4660
4660
  data: chunk.payload.data,
4661
4661
  mediaType: chunk.payload.mimeType
4662
4662
  })
@@ -4843,7 +4843,7 @@ var getModelOutputForTripwire = async ({
4843
4843
  messageList,
4844
4844
  ...rest
4845
4845
  }) => {
4846
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
4846
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
4847
4847
  const tripwireStream = new web.ReadableStream({
4848
4848
  start(controller) {
4849
4849
  controller.enqueue({
@@ -5495,7 +5495,7 @@ var createTimeTravelExecutionParams = (params) => {
5495
5495
  result = void 0;
5496
5496
  }
5497
5497
  if (result) {
5498
- const formattedResult = chunkMIILNUS4_cjs.removeUndefinedValues(result);
5498
+ const formattedResult = chunkDDIY3CRP_cjs.removeUndefinedValues(result);
5499
5499
  stepResults[stepId] = formattedResult;
5500
5500
  }
5501
5501
  });
@@ -5587,7 +5587,7 @@ async function executeParallel(engine, params) {
5587
5587
  perStep,
5588
5588
  ...rest
5589
5589
  } = params;
5590
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
5590
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
5591
5591
  const parallelSpan = await engine.createChildSpan({
5592
5592
  parentSpan: observabilityContext.tracingContext.currentSpan,
5593
5593
  operationId: `workflow.${workflowId}.run.${runId}.parallel.${executionContext.executionPath.join("-")}.span.start`,
@@ -5665,7 +5665,7 @@ async function executeParallel(engine, params) {
5665
5665
  state: executionContext.state,
5666
5666
  tracingIds: executionContext.tracingIds
5667
5667
  },
5668
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: parallelSpan }),
5668
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: parallelSpan }),
5669
5669
  pubsub,
5670
5670
  abortController,
5671
5671
  requestContext,
@@ -5741,7 +5741,7 @@ async function executeConditional(engine, params) {
5741
5741
  perStep,
5742
5742
  ...rest
5743
5743
  } = params;
5744
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
5744
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
5745
5745
  const conditionalSpan = await engine.createChildSpan({
5746
5746
  parentSpan: observabilityContext.tracingContext.currentSpan,
5747
5747
  operationId: `workflow.${workflowId}.run.${runId}.conditional.${executionContext.executionPath.join("-")}.span.start`,
@@ -5783,7 +5783,7 @@ async function executeConditional(engine, params) {
5783
5783
  inputData: prevOutput,
5784
5784
  state: executionContext.state,
5785
5785
  retryCount: -1,
5786
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: evalSpan }),
5786
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: evalSpan }),
5787
5787
  getInitData: () => stepResults?.input,
5788
5788
  getStepResult: getStepResult.bind(null, stepResults),
5789
5789
  bail: (() => {
@@ -5904,7 +5904,7 @@ async function executeConditional(engine, params) {
5904
5904
  state: executionContext.state,
5905
5905
  tracingIds: executionContext.tracingIds
5906
5906
  },
5907
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: conditionalSpan }),
5907
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: conditionalSpan }),
5908
5908
  pubsub,
5909
5909
  abortController,
5910
5910
  requestContext,
@@ -5981,7 +5981,7 @@ async function executeLoop(engine, params) {
5981
5981
  perStep,
5982
5982
  ...rest
5983
5983
  } = params;
5984
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
5984
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
5985
5985
  const { step, condition } = entry;
5986
5986
  const loopSpan = await engine.createChildSpan({
5987
5987
  parentSpan: observabilityContext.tracingContext.currentSpan,
@@ -6017,7 +6017,7 @@ async function executeLoop(engine, params) {
6017
6017
  resume: currentResume,
6018
6018
  timeTravel: currentTimeTravel,
6019
6019
  prevOutput: result.output,
6020
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: loopSpan }),
6020
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: loopSpan }),
6021
6021
  pubsub,
6022
6022
  abortController,
6023
6023
  requestContext,
@@ -6053,7 +6053,7 @@ async function executeLoop(engine, params) {
6053
6053
  options: {
6054
6054
  type: "workflow_conditional_eval" /* WORKFLOW_CONDITIONAL_EVAL */,
6055
6055
  name: `condition: '${entry.loopType}'`,
6056
- input: chunkMIILNUS4_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
6056
+ input: chunkDDIY3CRP_cjs.selectFields(result.output, ["stepResult", "output.text", "output.object", "messages"]),
6057
6057
  attributes: {
6058
6058
  conditionIndex: iteration
6059
6059
  },
@@ -6071,7 +6071,7 @@ async function executeLoop(engine, params) {
6071
6071
  inputData: result.output,
6072
6072
  state: executionContext.state,
6073
6073
  retryCount: -1,
6074
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: evalSpan }),
6074
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: evalSpan }),
6075
6075
  iterationCount: iteration + 1,
6076
6076
  getInitData: () => stepResults?.input,
6077
6077
  getStepResult: getStepResult.bind(null, stepResults),
@@ -6143,7 +6143,7 @@ async function executeForeach(engine, params) {
6143
6143
  perStep,
6144
6144
  ...rest
6145
6145
  } = params;
6146
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
6146
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
6147
6147
  const { step, opts } = entry;
6148
6148
  const results = [];
6149
6149
  const concurrency = opts.concurrency;
@@ -6219,7 +6219,7 @@ async function executeForeach(engine, params) {
6219
6219
  executionContext: { ...executionContext, foreachIndex: k },
6220
6220
  resume: resumeToUse,
6221
6221
  prevOutput: item,
6222
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: loopSpan }),
6222
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: loopSpan }),
6223
6223
  pubsub,
6224
6224
  abortController,
6225
6225
  requestContext,
@@ -6506,7 +6506,7 @@ async function executeEntry(engine, params) {
6506
6506
  perStep,
6507
6507
  ...rest
6508
6508
  } = params;
6509
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
6509
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
6510
6510
  const prevOutput = engine.getStepOutput(stepResults, prevStep);
6511
6511
  let execResults;
6512
6512
  let entryRequestContext;
@@ -6975,7 +6975,7 @@ async function executeSleep(engine, params) {
6975
6975
  outputWriter,
6976
6976
  ...rest
6977
6977
  } = params;
6978
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
6978
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
6979
6979
  let { duration, fn } = entry;
6980
6980
  const sleepSpan = await engine.createChildSpan({
6981
6981
  parentSpan: observabilityContext.tracingContext.currentSpan,
@@ -7004,7 +7004,7 @@ async function executeSleep(engine, params) {
7004
7004
  executionContext.state = state;
7005
7005
  },
7006
7006
  retryCount: -1,
7007
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: sleepSpan }),
7007
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: sleepSpan }),
7008
7008
  getInitData: () => stepResults?.input,
7009
7009
  getStepResult: getStepResult.bind(null, stepResults),
7010
7010
  // TODO: this function shouldn't have suspend probably?
@@ -7065,7 +7065,7 @@ async function executeSleepUntil(engine, params) {
7065
7065
  outputWriter,
7066
7066
  ...rest
7067
7067
  } = params;
7068
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
7068
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
7069
7069
  let { date, fn } = entry;
7070
7070
  const sleepUntilSpan = await engine.createChildSpan({
7071
7071
  parentSpan: observabilityContext.tracingContext.currentSpan,
@@ -7095,7 +7095,7 @@ async function executeSleepUntil(engine, params) {
7095
7095
  executionContext.state = state;
7096
7096
  },
7097
7097
  retryCount: -1,
7098
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: sleepUntilSpan }),
7098
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: sleepUntilSpan }),
7099
7099
  getInitData: () => stepResults?.input,
7100
7100
  getStepResult: getStepResult.bind(null, stepResults),
7101
7101
  // TODO: this function shouldn't have suspend probably?
@@ -7174,7 +7174,7 @@ async function executeStep(engine, params) {
7174
7174
  perStep,
7175
7175
  ...rest
7176
7176
  } = params;
7177
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
7177
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
7178
7178
  const stepCallId = crypto2.randomUUID();
7179
7179
  const { inputData, validationError: inputValidationError } = await validateStepInput({
7180
7180
  prevOutput,
@@ -7225,7 +7225,7 @@ async function executeStep(engine, params) {
7225
7225
  options: {
7226
7226
  name: `workflow step: '${step.id}'`,
7227
7227
  type: "workflow_step" /* WORKFLOW_STEP */,
7228
- entityType: "workflow_step" /* WORKFLOW_STEP */,
7228
+ entityType: chunkLIRWMGGI_cjs.EntityType.WORKFLOW_STEP,
7229
7229
  entityId: step.id,
7230
7230
  input: inputData,
7231
7231
  tracingPolicy: engine.options?.tracingPolicy,
@@ -7338,7 +7338,7 @@ async function executeStep(engine, params) {
7338
7338
  requestContextUpdate: null
7339
7339
  };
7340
7340
  const isNestedWorkflow = step.component === "WORKFLOW";
7341
- const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra : chunkPBDJR7QN_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0;
7341
+ const mastraForStep = engine.mastra ? isNestedWorkflow ? engine.mastra : chunkLIRWMGGI_cjs.wrapMastra(engine.mastra, { currentSpan: stepSpan }) : void 0;
7342
7342
  const output = await runStep({
7343
7343
  runId,
7344
7344
  resourceId,
@@ -7361,7 +7361,7 @@ async function executeStep(engine, params) {
7361
7361
  retryCount,
7362
7362
  resumeData: resumeDataToUse,
7363
7363
  suspendData: suspendDataToUse,
7364
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: stepSpan }),
7364
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: stepSpan }),
7365
7365
  getInitData: () => stepResults?.input,
7366
7366
  getStepResult: getStepResult.bind(null, stepResults),
7367
7367
  suspend: async (suspendPayload, suspendOptions) => {
@@ -7463,7 +7463,7 @@ async function executeStep(engine, params) {
7463
7463
  stepId: step.id,
7464
7464
  requestContext,
7465
7465
  disableScorers,
7466
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: stepSpan })
7466
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: stepSpan })
7467
7467
  });
7468
7468
  }
7469
7469
  if (durableResult.suspended) {
@@ -7519,7 +7519,7 @@ async function executeStep(engine, params) {
7519
7519
  }
7520
7520
  async function runScorersForStep(params) {
7521
7521
  const { engine, scorers, runId, input, output, workflowId, stepId, requestContext, disableScorers, ...rest } = params;
7522
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
7522
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
7523
7523
  let scorersToUse = scorers;
7524
7524
  if (typeof scorersToUse === "function") {
7525
7525
  try {
@@ -8088,7 +8088,7 @@ var DefaultExecutionEngine = class extends ExecutionEngine {
8088
8088
  resume,
8089
8089
  timeTravel,
8090
8090
  restart,
8091
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: workflowSpan }),
8091
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: workflowSpan }),
8092
8092
  abortController: params.abortController,
8093
8093
  pubsub: params.pubsub,
8094
8094
  requestContext: currentRequestContext,
@@ -8384,7 +8384,7 @@ function createStepFromAgent(params, agentOrToolOptions) {
8384
8384
  writer,
8385
8385
  ...rest
8386
8386
  }) => {
8387
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
8387
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
8388
8388
  let streamPromise = {};
8389
8389
  streamPromise.promise = new Promise((resolve, reject) => {
8390
8390
  streamPromise.resolve = resolve;
@@ -8512,7 +8512,7 @@ function createStepFromTool(params, toolOpts) {
8512
8512
  setState,
8513
8513
  ...rest
8514
8514
  }) => {
8515
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
8515
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
8516
8516
  const toolContext = {
8517
8517
  mastra,
8518
8518
  requestContext,
@@ -8536,16 +8536,16 @@ function createStepFromProcessor(processor) {
8536
8536
  const getProcessorEntityType = (phase) => {
8537
8537
  switch (phase) {
8538
8538
  case "input":
8539
- return "input_processor" /* INPUT_PROCESSOR */;
8539
+ return chunkLIRWMGGI_cjs.EntityType.INPUT_PROCESSOR;
8540
8540
  case "inputStep":
8541
- return "input_step_processor" /* INPUT_STEP_PROCESSOR */;
8541
+ return chunkLIRWMGGI_cjs.EntityType.INPUT_STEP_PROCESSOR;
8542
8542
  case "outputStream":
8543
8543
  case "outputResult":
8544
- return "output_processor" /* OUTPUT_PROCESSOR */;
8544
+ return chunkLIRWMGGI_cjs.EntityType.OUTPUT_PROCESSOR;
8545
8545
  case "outputStep":
8546
- return "output_step_processor" /* OUTPUT_STEP_PROCESSOR */;
8546
+ return chunkLIRWMGGI_cjs.EntityType.OUTPUT_STEP_PROCESSOR;
8547
8547
  default:
8548
- return "output_processor" /* OUTPUT_PROCESSOR */;
8548
+ return chunkLIRWMGGI_cjs.EntityType.OUTPUT_PROCESSOR;
8549
8549
  }
8550
8550
  };
8551
8551
  const getSpanNamePrefix = (phase) => {
@@ -8643,7 +8643,7 @@ function createStepFromProcessor(processor) {
8643
8643
  processorIndex: processor.processorIndex
8644
8644
  }
8645
8645
  }) : void 0;
8646
- const processorObservabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext(
8646
+ const processorObservabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext(
8647
8647
  processorSpan ? { currentSpan: processorSpan } : tracingContext
8648
8648
  );
8649
8649
  const processorWriter = outputWriter ? {
@@ -8677,7 +8677,7 @@ function createStepFromProcessor(processor) {
8677
8677
  phase,
8678
8678
  // Auto-create MessageList from messages if not provided
8679
8679
  // This enables running processor workflows from the UI where messageList can't be serialized
8680
- messageList: messageList ?? (Array.isArray(messages) ? new chunkE2Y2HLCU_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
8680
+ messageList: messageList ?? (Array.isArray(messages) ? new chunkW2LUCUUP_cjs.MessageList().add(messages, "input").addSystem(systemMessages ?? []) : void 0),
8681
8681
  stepNumber,
8682
8682
  systemMessages,
8683
8683
  streamParts,
@@ -8734,7 +8734,7 @@ function createStepFromProcessor(processor) {
8734
8734
  messageList: checkedMessageList,
8735
8735
  systemMessages: systemMessages ?? []
8736
8736
  });
8737
- if (result instanceof chunkE2Y2HLCU_cjs.MessageList) {
8737
+ if (result instanceof chunkW2LUCUUP_cjs.MessageList) {
8738
8738
  if (result !== checkedMessageList) {
8739
8739
  throw new chunk4U7ZLI36_cjs.MastraError({
8740
8740
  category: "USER" /* USER */,
@@ -8845,7 +8845,7 @@ function createStepFromProcessor(processor) {
8845
8845
  processorSpan2 = parentSpan.createChildSpan({
8846
8846
  type: "processor_run" /* PROCESSOR_RUN */,
8847
8847
  name: `output stream processor: ${processor.id}`,
8848
- entityType: "output_processor" /* OUTPUT_PROCESSOR */,
8848
+ entityType: chunkLIRWMGGI_cjs.EntityType.OUTPUT_PROCESSOR,
8849
8849
  entityId: processor.id,
8850
8850
  entityName: processor.name ?? processor.id,
8851
8851
  input: { phase, totalChunks: 0 },
@@ -8862,7 +8862,7 @@ function createStepFromProcessor(processor) {
8862
8862
  totalChunks: (streamParts ?? []).length
8863
8863
  };
8864
8864
  }
8865
- const processorObservabilityContext2 = chunkPBDJR7QN_cjs.createObservabilityContext(
8865
+ const processorObservabilityContext2 = chunkLIRWMGGI_cjs.createObservabilityContext(
8866
8866
  processorSpan2 ? { currentSpan: processorSpan2 } : baseContext.tracingContext
8867
8867
  );
8868
8868
  let result;
@@ -8917,7 +8917,7 @@ function createStepFromProcessor(processor) {
8917
8917
  messageList: passThrough.messageList,
8918
8918
  result: passThrough.result ?? defaultResult
8919
8919
  });
8920
- if (result instanceof chunkE2Y2HLCU_cjs.MessageList) {
8920
+ if (result instanceof chunkW2LUCUUP_cjs.MessageList) {
8921
8921
  if (result !== passThrough.messageList) {
8922
8922
  throw new chunk4U7ZLI36_cjs.MastraError({
8923
8923
  category: "USER" /* USER */,
@@ -8984,7 +8984,7 @@ function createStepFromProcessor(processor) {
8984
8984
  systemMessages: systemMessages ?? [],
8985
8985
  steps: steps ?? []
8986
8986
  });
8987
- if (result instanceof chunkE2Y2HLCU_cjs.MessageList) {
8987
+ if (result instanceof chunkW2LUCUUP_cjs.MessageList) {
8988
8988
  if (result !== checkedMessageList) {
8989
8989
  throw new chunk4U7ZLI36_cjs.MastraError({
8990
8990
  category: "USER" /* USER */,
@@ -9608,7 +9608,7 @@ var Workflow = class extends chunkRO47SMI7_cjs.MastraBase {
9608
9608
  bail: _bail,
9609
9609
  ...rest
9610
9610
  }) {
9611
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
9611
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
9612
9612
  this.__registerMastra(mastra);
9613
9613
  const effectiveValidateInputs = validateInputs ?? this.#options.validateInputs ?? true;
9614
9614
  this.#options = {
@@ -10106,11 +10106,11 @@ var Run = class {
10106
10106
  perStep,
10107
10107
  ...rest
10108
10108
  }) {
10109
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10110
- const workflowSpan = chunkPBDJR7QN_cjs.getOrCreateSpan({
10109
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10110
+ const workflowSpan = chunkLIRWMGGI_cjs.getOrCreateSpan({
10111
10111
  type: "workflow_run" /* WORKFLOW_RUN */,
10112
10112
  name: `workflow run: '${this.workflowId}'`,
10113
- entityType: "workflow_run" /* WORKFLOW_RUN */,
10113
+ entityType: chunkLIRWMGGI_cjs.EntityType.WORKFLOW_RUN,
10114
10114
  entityId: this.workflowId,
10115
10115
  input: inputData,
10116
10116
  metadata: {
@@ -10187,7 +10187,7 @@ var Run = class {
10187
10187
  tracingOptions,
10188
10188
  ...rest
10189
10189
  } = {}) {
10190
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10190
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10191
10191
  if (this.closeStreamAction) {
10192
10192
  return {
10193
10193
  stream: this.observeStreamLegacy().stream,
@@ -10312,7 +10312,7 @@ var Run = class {
10312
10312
  perStep,
10313
10313
  ...rest
10314
10314
  }) {
10315
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10315
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10316
10316
  if (this.closeStreamAction && this.streamOutput) {
10317
10317
  return this.streamOutput;
10318
10318
  }
@@ -10413,7 +10413,7 @@ var Run = class {
10413
10413
  perStep,
10414
10414
  ...rest
10415
10415
  } = {}) {
10416
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10416
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10417
10417
  this.closeStreamAction = async () => {
10418
10418
  };
10419
10419
  const self = this;
@@ -10542,7 +10542,7 @@ var Run = class {
10542
10542
  return this._restart(args);
10543
10543
  }
10544
10544
  async _resume(params) {
10545
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(params);
10545
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(params);
10546
10546
  const workflowsStore = await this.#mastra?.getStorage()?.getStore("workflows");
10547
10547
  const snapshot = await workflowsStore?.loadWorkflowSnapshot({
10548
10548
  workflowName: this.workflowId,
@@ -10626,10 +10626,10 @@ var Run = class {
10626
10626
  traceId: effectiveTraceId,
10627
10627
  parentSpanId: shouldUsePersistedParentSpan ? persistedTracingContext?.spanId : params.tracingOptions?.parentSpanId
10628
10628
  };
10629
- const workflowSpan = chunkPBDJR7QN_cjs.getOrCreateSpan({
10629
+ const workflowSpan = chunkLIRWMGGI_cjs.getOrCreateSpan({
10630
10630
  type: "workflow_run" /* WORKFLOW_RUN */,
10631
10631
  name: `workflow run: '${this.workflowId}' (resumed)`,
10632
- entityType: "workflow_run" /* WORKFLOW_RUN */,
10632
+ entityType: chunkLIRWMGGI_cjs.EntityType.WORKFLOW_RUN,
10633
10633
  entityId: this.workflowId,
10634
10634
  input: resumeDataToUse,
10635
10635
  metadata: {
@@ -10693,7 +10693,7 @@ var Run = class {
10693
10693
  tracingOptions,
10694
10694
  ...rest
10695
10695
  }) {
10696
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10696
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10697
10697
  if (this.workflowEngineType !== "default") {
10698
10698
  throw new Error(`restart() is not supported on ${this.workflowEngineType} workflows`);
10699
10699
  }
@@ -10745,10 +10745,10 @@ var Run = class {
10745
10745
  requestContextToUse.set(key, value);
10746
10746
  }
10747
10747
  }
10748
- const workflowSpan = chunkPBDJR7QN_cjs.getOrCreateSpan({
10748
+ const workflowSpan = chunkLIRWMGGI_cjs.getOrCreateSpan({
10749
10749
  type: "workflow_run" /* WORKFLOW_RUN */,
10750
10750
  name: `workflow run: '${this.workflowId}'`,
10751
- entityType: "workflow_run" /* WORKFLOW_RUN */,
10751
+ entityType: chunkLIRWMGGI_cjs.EntityType.WORKFLOW_RUN,
10752
10752
  entityId: this.workflowId,
10753
10753
  metadata: {
10754
10754
  resourceId: this.resourceId,
@@ -10798,7 +10798,7 @@ var Run = class {
10798
10798
  perStep,
10799
10799
  ...rest
10800
10800
  }) {
10801
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10801
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10802
10802
  if (!stepParam || Array.isArray(stepParam) && stepParam.length === 0) {
10803
10803
  throw new Error("Step is required and must be a valid step or array of steps");
10804
10804
  }
@@ -10842,11 +10842,11 @@ var Run = class {
10842
10842
  requestContextToUse.set(key, value);
10843
10843
  }
10844
10844
  }
10845
- const workflowSpan = chunkPBDJR7QN_cjs.getOrCreateSpan({
10845
+ const workflowSpan = chunkLIRWMGGI_cjs.getOrCreateSpan({
10846
10846
  type: "workflow_run" /* WORKFLOW_RUN */,
10847
10847
  name: `workflow run: '${this.workflowId}'`,
10848
10848
  input: inputData,
10849
- entityType: "workflow_run" /* WORKFLOW_RUN */,
10849
+ entityType: chunkLIRWMGGI_cjs.EntityType.WORKFLOW_RUN,
10850
10850
  entityId: this.workflowId,
10851
10851
  metadata: {
10852
10852
  resourceId: this.resourceId,
@@ -10900,7 +10900,7 @@ var Run = class {
10900
10900
  perStep,
10901
10901
  ...rest
10902
10902
  }) {
10903
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
10903
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
10904
10904
  this.closeStreamAction = async () => {
10905
10905
  };
10906
10906
  const self = this;
@@ -11206,7 +11206,7 @@ var MastraScorer = class _MastraScorer {
11206
11206
  }
11207
11207
  });
11208
11208
  }
11209
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(input);
11209
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(input);
11210
11210
  let runId = input.runId;
11211
11211
  if (!runId) {
11212
11212
  runId = crypto2.randomUUID();
@@ -11259,7 +11259,7 @@ var MastraScorer = class _MastraScorer {
11259
11259
  inputSchema: z9.z.any(),
11260
11260
  outputSchema: z9.z.any(),
11261
11261
  execute: async ({ inputData, getInitData, ...rest }) => {
11262
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
11262
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
11263
11263
  const { accumulatedResults = {}, generatedPrompts = {} } = inputData;
11264
11264
  const { run } = getInitData();
11265
11265
  const context = this.createScorerContext(scorerStep.name, run, accumulatedResults);
@@ -11350,7 +11350,7 @@ var MastraScorer = class _MastraScorer {
11350
11350
  }
11351
11351
  });
11352
11352
  }
11353
- const resolvedModel = await chunkXNHOUTCP_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
11353
+ const resolvedModel = await chunkZSFSSMFT_cjs.resolveModelConfig(modelConfig, void 0, this.#mastra);
11354
11354
  const judge = new Agent({
11355
11355
  id: "judge",
11356
11356
  name: "judge",
@@ -12268,8 +12268,7 @@ async function processOutputStream({
12268
12268
  includeRawChunks,
12269
12269
  logger,
12270
12270
  transportRef,
12271
- transportResolver,
12272
- persistedToolCallIds
12271
+ transportResolver
12273
12272
  }) {
12274
12273
  let transportSet = false;
12275
12274
  for await (const chunk of outputStream._getBaseStream()) {
@@ -12421,34 +12420,6 @@ async function processOutputStream({
12421
12420
  safeEnqueue(controller, chunk);
12422
12421
  break;
12423
12422
  }
12424
- case "tool-call": {
12425
- const message = {
12426
- id: messageId,
12427
- role: "assistant",
12428
- content: {
12429
- format: 2,
12430
- parts: [
12431
- {
12432
- type: "tool-invocation",
12433
- toolInvocation: {
12434
- state: "call",
12435
- toolCallId: chunk.payload.toolCallId,
12436
- toolName: chunk.payload.toolName,
12437
- args: chunk.payload.args ?? {}
12438
- },
12439
- providerMetadata: chunk.payload.providerMetadata,
12440
- ...{ providerExecuted: chunk.payload.providerExecuted }
12441
- }
12442
- ],
12443
- ...buildResponseModelMetadata(runState)
12444
- },
12445
- createdAt: /* @__PURE__ */ new Date()
12446
- };
12447
- messageList.add(message, "response");
12448
- persistedToolCallIds?.add(chunk.payload.toolCallId);
12449
- safeEnqueue(controller, chunk);
12450
- break;
12451
- }
12452
12423
  case "tool-call-input-streaming-end": {
12453
12424
  safeEnqueue(controller, chunk);
12454
12425
  break;
@@ -12611,6 +12582,57 @@ async function processOutputStream({
12611
12582
  safeEnqueue(controller, { ...chunk, payload: { ...chunk.payload, error } });
12612
12583
  await options?.onError?.({ error });
12613
12584
  break;
12585
+ // Provider-executed tool results (e.g. web_search). Client tool results
12586
+ // are handled by llm-mapping-step after execution.
12587
+ case "tool-result": {
12588
+ if (chunk.payload.result != null) {
12589
+ const resultToolDef = tools?.[chunk.payload.toolName] || findProviderToolByName(tools, chunk.payload.toolName);
12590
+ messageList.updateToolInvocation({
12591
+ type: "tool-invocation",
12592
+ toolInvocation: {
12593
+ state: "result",
12594
+ toolCallId: chunk.payload.toolCallId,
12595
+ toolName: chunk.payload.toolName,
12596
+ args: chunk.payload.args,
12597
+ result: chunk.payload.result
12598
+ },
12599
+ providerMetadata: chunk.payload.providerMetadata,
12600
+ // @ts-expect-error - providerExecuted is not in the type but is read by output-converter.ts (to keep deferred provider calls) and tool-call-step.ts (to skip client execution)
12601
+ providerExecuted: inferProviderExecuted(chunk.payload.providerExecuted, resultToolDef)
12602
+ });
12603
+ }
12604
+ safeEnqueue(controller, chunk);
12605
+ break;
12606
+ }
12607
+ case "tool-call": {
12608
+ const toolDef = tools?.[chunk.payload.toolName] || findProviderToolByName(tools, chunk.payload.toolName);
12609
+ const inferredProviderExecuted = inferProviderExecuted(chunk.payload.providerExecuted, toolDef);
12610
+ const toolCallPart = {
12611
+ type: "tool-invocation",
12612
+ toolInvocation: {
12613
+ state: "call",
12614
+ toolCallId: chunk.payload.toolCallId,
12615
+ toolName: chunk.payload.toolName,
12616
+ args: chunk.payload.args
12617
+ },
12618
+ providerMetadata: chunk.payload.providerMetadata,
12619
+ // @ts-expect-error - providerExecuted is not in the type but is read by output-converter.ts (to keep deferred provider calls) and tool-call-step.ts (to skip client execution)
12620
+ providerExecuted: inferredProviderExecuted
12621
+ };
12622
+ const message = {
12623
+ id: messageId,
12624
+ role: "assistant",
12625
+ content: {
12626
+ format: 2,
12627
+ parts: [toolCallPart],
12628
+ ...buildResponseModelMetadata(runState)
12629
+ },
12630
+ createdAt: /* @__PURE__ */ new Date()
12631
+ };
12632
+ messageList.add(message, "response");
12633
+ safeEnqueue(controller, chunk);
12634
+ break;
12635
+ }
12614
12636
  default:
12615
12637
  safeEnqueue(controller, chunk);
12616
12638
  }
@@ -12712,7 +12734,6 @@ function createLLMExecutionStep({
12712
12734
  let warnings;
12713
12735
  let request;
12714
12736
  let rawResponse;
12715
- const persistedToolCallIds = /* @__PURE__ */ new Set();
12716
12737
  const { outputStream, callBail, runState, stepTools, stepWorkspace } = await executeStreamWithFallbackModels(
12717
12738
  models,
12718
12739
  logger
@@ -12754,7 +12775,7 @@ function createLLMExecutionStep({
12754
12775
  const processInputStepResult = await processorRunner.runProcessInputStep({
12755
12776
  messageList,
12756
12777
  stepNumber: inputData.output?.steps?.length || 0,
12757
- ...chunkPBDJR7QN_cjs.createObservabilityContext(stepTracingContext),
12778
+ ...chunkLIRWMGGI_cjs.createObservabilityContext(stepTracingContext),
12758
12779
  requestContext,
12759
12780
  model,
12760
12781
  steps: inputData.output?.steps || [],
@@ -12779,7 +12800,7 @@ function createLLMExecutionStep({
12779
12800
  const convertedTools = {};
12780
12801
  for (const [name, tool2] of Object.entries(currentStep.tools)) {
12781
12802
  if (chunkNQXA2BUF_cjs.isMastraTool(tool2)) {
12782
- convertedTools[name] = chunkMIILNUS4_cjs.makeCoreTool(
12803
+ convertedTools[name] = chunkDDIY3CRP_cjs.makeCoreTool(
12783
12804
  tool2,
12784
12805
  {
12785
12806
  name,
@@ -12916,7 +12937,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
12916
12937
  }
12917
12938
  }
12918
12939
  if (isSupportedLanguageModel(currentStep.model)) {
12919
- modelResult = chunkPBDJR7QN_cjs.executeWithContextSync({
12940
+ modelResult = chunkLIRWMGGI_cjs.executeWithContextSync({
12920
12941
  span: modelSpanTracker?.getTracingContext()?.currentSpan,
12921
12942
  fn: () => execute({
12922
12943
  runId,
@@ -12986,7 +13007,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
12986
13007
  }
12987
13008
  });
12988
13009
  let transportResolver;
12989
- if (currentStep.model instanceof chunkXNHOUTCP_cjs.ModelRouterLanguageModel) {
13010
+ if (currentStep.model instanceof chunkZSFSSMFT_cjs.ModelRouterLanguageModel) {
12990
13011
  const routerModel = currentStep.model;
12991
13012
  transportResolver = () => routerModel._getStreamTransport();
12992
13013
  }
@@ -13007,8 +13028,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
13007
13028
  },
13008
13029
  logger,
13009
13030
  transportRef: _internal?.transportRef,
13010
- transportResolver,
13011
- persistedToolCallIds
13031
+ transportResolver
13012
13032
  });
13013
13033
  } catch (error) {
13014
13034
  const provider = model?.provider;
@@ -13114,50 +13134,13 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
13114
13134
  }
13115
13135
  });
13116
13136
  }
13117
- const toolResults = outputStream._getImmediateToolResults()?.map((chunk) => chunk.payload) ?? [];
13118
- const toolResultById = new Map(toolResults.map((result) => [result.toolCallId, result]));
13119
- const toolCalls = outputStream._getImmediateToolCalls()?.map((chunk) => {
13120
- const toolResult = toolResultById.get(chunk.payload.toolCallId);
13121
- const output = chunk.payload.output ?? toolResult?.result;
13122
- const tool2 = findProviderToolByName(stepTools, chunk.payload.toolName);
13123
- const providerExecuted = inferProviderExecuted(
13124
- chunk.payload.providerExecuted ?? toolResult?.providerExecuted,
13125
- tool2
13126
- );
13137
+ const toolCalls = (outputStream._getImmediateToolCalls() ?? []).map((chunk) => {
13138
+ const tool2 = stepTools?.[chunk.payload.toolName] || findProviderToolByName(stepTools, chunk.payload.toolName);
13127
13139
  return {
13128
13140
  ...chunk.payload,
13129
- args: chunk.payload.args ?? toolResult?.args ?? {},
13130
- ...output !== void 0 ? { output } : {},
13131
- providerExecuted,
13132
- providerMetadata: chunk.payload.providerMetadata ?? toolResult?.providerMetadata
13133
- };
13134
- }) ?? [];
13135
- const toolCallsToPersist = toolCalls.filter((toolCall) => !persistedToolCallIds.has(toolCall.toolCallId));
13136
- if (toolCallsToPersist.length > 0) {
13137
- const message = {
13138
- id: outputStream.messageId,
13139
- role: "assistant",
13140
- content: {
13141
- format: 2,
13142
- parts: toolCallsToPersist.map((toolCall) => {
13143
- return {
13144
- type: "tool-invocation",
13145
- toolInvocation: {
13146
- state: "call",
13147
- toolCallId: toolCall.toolCallId,
13148
- toolName: toolCall.toolName,
13149
- args: toolCall.args
13150
- },
13151
- providerMetadata: toolCall.providerMetadata,
13152
- providerExecuted: toolCall.providerExecuted
13153
- };
13154
- }),
13155
- ...buildResponseModelMetadata(runState)
13156
- },
13157
- createdAt: /* @__PURE__ */ new Date()
13141
+ providerExecuted: inferProviderExecuted(chunk.payload.providerExecuted, tool2)
13158
13142
  };
13159
- messageList.add(message, "response");
13160
- }
13143
+ });
13161
13144
  let processOutputStepTripwire = null;
13162
13145
  if (outputProcessors && outputProcessors.length > 0) {
13163
13146
  const processorRunner = new ProcessorRunner({
@@ -13187,7 +13170,7 @@ Analyse the suspended tools: ${JSON.stringify(suspendedTools)}, using the messag
13187
13170
  finishReason: immediateFinishReason,
13188
13171
  toolCalls: toolCallInfos.length > 0 ? toolCallInfos : void 0,
13189
13172
  text: immediateText,
13190
- ...chunkPBDJR7QN_cjs.createObservabilityContext(outputStepTracingContext),
13173
+ ...chunkLIRWMGGI_cjs.createObservabilityContext(outputStepTracingContext),
13191
13174
  requestContext,
13192
13175
  retryCount: currentRetryCount,
13193
13176
  writer: processorWriter
@@ -13302,7 +13285,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
13302
13285
  agentName: "LLMMappingStep",
13303
13286
  processorStates: rest.processorStates
13304
13287
  }) : void 0;
13305
- const observabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
13288
+ const observabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
13306
13289
  const streamWriter = rest.outputWriter ? { custom: async (data) => rest.outputWriter(data) } : void 0;
13307
13290
  async function processAndEnqueueChunk(chunk) {
13308
13291
  if (processorRunner && rest.processorStates) {
@@ -13363,9 +13346,8 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
13363
13346
  const hasMetadata = Object.keys(providerMetadata).length > 0;
13364
13347
  return hasMetadata ? providerMetadata : void 0;
13365
13348
  }
13366
- if (inputData?.some((toolCall) => toolCall?.result === void 0)) {
13367
- const errorResults = inputData.filter((toolCall) => toolCall?.error);
13368
- const toolResultMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
13349
+ if (inputData?.some((toolCall) => toolCall?.result === void 0 && !toolCall.providerExecuted)) {
13350
+ const errorResults = inputData.filter((toolCall) => toolCall?.error && !toolCall.providerExecuted);
13369
13351
  if (errorResults?.length) {
13370
13352
  for (const toolCall of errorResults) {
13371
13353
  const chunk = {
@@ -13382,29 +13364,18 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
13382
13364
  };
13383
13365
  const processed = await processAndEnqueueChunk(chunk);
13384
13366
  if (processed) await rest.options?.onChunk?.(processed);
13367
+ rest.messageList.updateToolInvocation({
13368
+ type: "tool-invocation",
13369
+ toolInvocation: {
13370
+ state: "result",
13371
+ toolCallId: toolCall.toolCallId,
13372
+ toolName: chunkW2LUCUUP_cjs.sanitizeToolName(toolCall.toolName),
13373
+ args: toolCall.args,
13374
+ result: toolCall.error?.message ?? toolCall.error
13375
+ },
13376
+ ...toolCall.providerMetadata ? { providerMetadata: toolCall.providerMetadata } : {}
13377
+ });
13385
13378
  }
13386
- const msg = {
13387
- id: toolResultMessageId || "",
13388
- role: "assistant",
13389
- content: {
13390
- format: 2,
13391
- parts: errorResults.map((toolCallErrorResult) => {
13392
- return {
13393
- type: "tool-invocation",
13394
- toolInvocation: {
13395
- state: "result",
13396
- toolCallId: toolCallErrorResult.toolCallId,
13397
- toolName: chunkE2Y2HLCU_cjs.sanitizeToolName(toolCallErrorResult.toolName),
13398
- args: toolCallErrorResult.args,
13399
- result: toolCallErrorResult.error?.message ?? toolCallErrorResult.error
13400
- },
13401
- ...toolCallErrorResult.providerMetadata ? { providerMetadata: toolCallErrorResult.providerMetadata } : {}
13402
- };
13403
- })
13404
- },
13405
- createdAt: /* @__PURE__ */ new Date()
13406
- };
13407
- rest.messageList.add(msg, "response");
13408
13379
  }
13409
13380
  const hasPendingHITL = inputData.some((tc) => tc.result === void 0 && !tc.error && !tc.providerExecuted);
13410
13381
  if (errorResults?.length > 0 && !hasPendingHITL) {
@@ -13426,60 +13397,20 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
13426
13397
  };
13427
13398
  const processed = await processAndEnqueueChunk(chunk);
13428
13399
  if (processed) await rest.options?.onChunk?.(processed);
13429
- }
13430
- const clientResults = successfulResults.filter((tc) => !tc.providerExecuted);
13431
- if (clientResults.length > 0) {
13432
- const successMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
13433
- const successMessage = {
13434
- id: successMessageId || "",
13435
- role: "assistant",
13436
- content: {
13437
- format: 2,
13438
- parts: await Promise.all(
13439
- clientResults.map(async (toolCall) => {
13440
- const providerMetadata = await getProviderMetadataWithModelOutput(toolCall);
13441
- return {
13442
- type: "tool-invocation",
13443
- toolInvocation: {
13444
- state: "result",
13445
- toolCallId: toolCall.toolCallId,
13446
- toolName: chunkE2Y2HLCU_cjs.sanitizeToolName(toolCall.toolName),
13447
- args: toolCall.args,
13448
- result: toolCall.result
13449
- },
13450
- ...providerMetadata ? { providerMetadata } : {}
13451
- };
13452
- })
13453
- )
13454
- },
13455
- createdAt: /* @__PURE__ */ new Date()
13456
- };
13457
- rest.messageList.add(successMessage, "response");
13458
- }
13459
- if (successfulResults.some((tc) => tc.providerExecuted)) {
13460
- const providerResults = successfulResults.filter((tc) => tc.providerExecuted);
13461
- const providerMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
13462
- const providerMessage = {
13463
- id: providerMessageId || "",
13464
- role: "assistant",
13465
- content: {
13466
- format: 2,
13467
- parts: providerResults.map((toolCall) => ({
13468
- type: "tool-invocation",
13469
- toolInvocation: {
13470
- state: "result",
13471
- toolCallId: toolCall.toolCallId,
13472
- toolName: chunkE2Y2HLCU_cjs.sanitizeToolName(toolCall.toolName),
13473
- args: toolCall.args,
13474
- result: toolCall.result
13475
- },
13476
- ...toolCall.providerMetadata ? { providerMetadata: toolCall.providerMetadata } : {},
13477
- providerExecuted: true
13478
- }))
13479
- },
13480
- createdAt: /* @__PURE__ */ new Date()
13481
- };
13482
- rest.messageList.add(providerMessage, "response");
13400
+ if (!toolCall.providerExecuted) {
13401
+ const providerMetadata = await getProviderMetadataWithModelOutput(toolCall);
13402
+ rest.messageList.updateToolInvocation({
13403
+ type: "tool-invocation",
13404
+ toolInvocation: {
13405
+ state: "result",
13406
+ toolCallId: toolCall.toolCallId,
13407
+ toolName: chunkW2LUCUUP_cjs.sanitizeToolName(toolCall.toolName),
13408
+ args: toolCall.args,
13409
+ result: toolCall.result
13410
+ },
13411
+ ...providerMetadata ? { providerMetadata } : {}
13412
+ });
13413
+ }
13483
13414
  }
13484
13415
  }
13485
13416
  initialResult.stepResult.isContinued = true;
@@ -13507,6 +13438,7 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
13507
13438
  }
13508
13439
  if (inputData?.length) {
13509
13440
  for (const toolCall of inputData) {
13441
+ if (toolCall.result === void 0) continue;
13510
13442
  const chunk = {
13511
13443
  type: "tool-result",
13512
13444
  runId: rest.runId,
@@ -13522,60 +13454,20 @@ function createLLMMappingStep({ models, _internal, ...rest }, llmExecutionStep)
13522
13454
  };
13523
13455
  const processed = await processAndEnqueueChunk(chunk);
13524
13456
  if (processed) await rest.options?.onChunk?.(processed);
13525
- }
13526
- const clientExecutedToolCalls = inputData.filter((toolCall) => !toolCall.providerExecuted);
13527
- if (clientExecutedToolCalls.length > 0) {
13528
- const toolResultMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
13529
- const toolResultMessage = {
13530
- id: toolResultMessageId || "",
13531
- role: "assistant",
13532
- content: {
13533
- format: 2,
13534
- parts: await Promise.all(
13535
- clientExecutedToolCalls.map(async (toolCall) => {
13536
- const providerMetadata = await getProviderMetadataWithModelOutput(toolCall);
13537
- return {
13538
- type: "tool-invocation",
13539
- toolInvocation: {
13540
- state: "result",
13541
- toolCallId: toolCall.toolCallId,
13542
- toolName: chunkE2Y2HLCU_cjs.sanitizeToolName(toolCall.toolName),
13543
- args: toolCall.args,
13544
- result: toolCall.result
13545
- },
13546
- ...providerMetadata ? { providerMetadata } : {}
13547
- };
13548
- })
13549
- )
13550
- },
13551
- createdAt: /* @__PURE__ */ new Date()
13552
- };
13553
- rest.messageList.add(toolResultMessage, "response");
13554
- }
13555
- const providerExecutedToolCalls = inputData.filter((toolCall) => toolCall.providerExecuted);
13556
- if (providerExecutedToolCalls.length > 0) {
13557
- const providerResultMessageId = rest.experimental_generateMessageId?.() || _internal?.generateId?.();
13558
- const providerResultMessage = {
13559
- id: providerResultMessageId || "",
13560
- role: "assistant",
13561
- content: {
13562
- format: 2,
13563
- parts: providerExecutedToolCalls.map((toolCall) => ({
13564
- type: "tool-invocation",
13565
- toolInvocation: {
13566
- state: "result",
13567
- toolCallId: toolCall.toolCallId,
13568
- toolName: chunkE2Y2HLCU_cjs.sanitizeToolName(toolCall.toolName),
13569
- args: toolCall.args,
13570
- result: toolCall.result
13571
- },
13572
- ...toolCall.providerMetadata ? { providerMetadata: toolCall.providerMetadata } : {},
13573
- providerExecuted: true
13574
- }))
13575
- },
13576
- createdAt: /* @__PURE__ */ new Date()
13577
- };
13578
- rest.messageList.add(providerResultMessage, "response");
13457
+ if (!toolCall.providerExecuted) {
13458
+ const providerMetadata = await getProviderMetadataWithModelOutput(toolCall);
13459
+ rest.messageList.updateToolInvocation({
13460
+ type: "tool-invocation",
13461
+ toolInvocation: {
13462
+ state: "result",
13463
+ toolCallId: toolCall.toolCallId,
13464
+ toolName: chunkW2LUCUUP_cjs.sanitizeToolName(toolCall.toolName),
13465
+ args: toolCall.args,
13466
+ result: toolCall.result
13467
+ },
13468
+ ...providerMetadata ? { providerMetadata } : {}
13469
+ });
13470
+ }
13579
13471
  }
13580
13472
  if (rest.requestContext?.get("__mastra_delegationBailed") && _internal) {
13581
13473
  _internal._delegationBailed = true;
@@ -13752,10 +13644,7 @@ function createToolCallStep({
13752
13644
  }
13753
13645
  };
13754
13646
  if (inputData.providerExecuted) {
13755
- return {
13756
- ...inputData,
13757
- result: inputData.output ?? { providerExecuted: true, toolName: inputData.toolName }
13758
- };
13647
+ return inputData;
13759
13648
  }
13760
13649
  const toolKey = stepTools?.[inputData.toolName] ? inputData.toolName : Object.entries(stepTools || {}).find(([_, t]) => t === tool2)?.[0];
13761
13650
  const isHiddenByActiveTools = stepActiveTools && toolKey && !stepActiveTools.includes(toolKey);
@@ -14471,12 +14360,12 @@ function workflowLoopStream({
14471
14360
  }
14472
14361
  const executionResult = resumeContext ? await run.resume({
14473
14362
  resumeData: resumeContext.resumeData,
14474
- ...chunkPBDJR7QN_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
14363
+ ...chunkLIRWMGGI_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
14475
14364
  requestContext,
14476
14365
  label: toolCallId
14477
14366
  }) : await run.start({
14478
14367
  inputData: initialData,
14479
- ...chunkPBDJR7QN_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
14368
+ ...chunkLIRWMGGI_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext()),
14480
14369
  requestContext
14481
14370
  });
14482
14371
  if (executionResult.status !== "success") {
@@ -14620,7 +14509,7 @@ function loop({
14620
14509
  }
14621
14510
  const baseStream = workflowLoopStream(workflowLoopProps);
14622
14511
  const stream = rest.modelSpanTracker?.wrapStream(baseStream) ?? baseStream;
14623
- const observabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
14512
+ const observabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext(rest.modelSpanTracker?.getTracingContext());
14624
14513
  modelOutput = new MastraModelOutput({
14625
14514
  model: {
14626
14515
  modelId: firstModel.model.modelId,
@@ -14753,7 +14642,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
14753
14642
  workspace,
14754
14643
  ...rest
14755
14644
  }) {
14756
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
14645
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
14757
14646
  let stopWhenToUse;
14758
14647
  if (maxSteps && typeof maxSteps === "number") {
14759
14648
  stopWhenToUse = chunkVBVOKSJK_cjs.stepCountIs(maxSteps);
@@ -14865,7 +14754,7 @@ var MastraLLMVNext = class extends chunkRO47SMI7_cjs.MastraBase {
14865
14754
  const remainingTokens = parseInt(props?.response?.headers?.["x-ratelimit-remaining-tokens"] ?? "", 10);
14866
14755
  if (!isNaN(remainingTokens) && remainingTokens > 0 && remainingTokens < 2e3) {
14867
14756
  this.logger.warn("Rate limit approaching, waiting 10 seconds", { runId });
14868
- await chunkMIILNUS4_cjs.delay(10 * 1e3);
14757
+ await chunkDDIY3CRP_cjs.delay(10 * 1e3);
14869
14758
  }
14870
14759
  },
14871
14760
  onFinish: async (props) => {
@@ -15103,7 +14992,7 @@ async function prepareMemoryStep({
15103
14992
  memoryConfig,
15104
14993
  ...rest
15105
14994
  }) {
15106
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
14995
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
15107
14996
  const memory = await routingAgent.getMemory({ requestContext });
15108
14997
  let thread = await memory?.getThreadById({ threadId });
15109
14998
  if (!thread) {
@@ -15141,7 +15030,7 @@ async function prepareMemoryStep({
15141
15030
  );
15142
15031
  }
15143
15032
  } else {
15144
- const messageList = new chunkE2Y2HLCU_cjs.MessageList({
15033
+ const messageList = new chunkW2LUCUUP_cjs.MessageList({
15145
15034
  threadId: thread?.id,
15146
15035
  resourceId: thread?.resourceId
15147
15036
  });
@@ -15198,14 +15087,14 @@ async function saveMessagesWithProcessors(memory, messages, processorRunner, con
15198
15087
  await memory.saveMessages({ messages });
15199
15088
  return;
15200
15089
  }
15201
- const messageList = new chunkE2Y2HLCU_cjs.MessageList();
15090
+ const messageList = new chunkW2LUCUUP_cjs.MessageList();
15202
15091
  for (const msg of messages) {
15203
15092
  messageList.add(msg, "response");
15204
15093
  }
15205
15094
  const { requestContext, ...observabilityContext } = context ?? {};
15206
15095
  await processorRunner.runOutputProcessors(
15207
15096
  messageList,
15208
- chunkPBDJR7QN_cjs.resolveObservabilityContext(observabilityContext),
15097
+ chunkLIRWMGGI_cjs.resolveObservabilityContext(observabilityContext),
15209
15098
  requestContext
15210
15099
  );
15211
15100
  const processedMessages = messageList.get.response.db();
@@ -16355,7 +16244,7 @@ async function createNetworkLoop({
16355
16244
  memory,
16356
16245
  context: inputDataToUse,
16357
16246
  // TODO: Pass proper tracing context when network supports tracing
16358
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: void 0 }),
16247
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: void 0 }),
16359
16248
  writer
16360
16249
  },
16361
16250
  { toolCallId, messages: [] }
@@ -16635,7 +16524,7 @@ async function networkLoop({
16635
16524
  "resumeData": "string"
16636
16525
  }
16637
16526
  `;
16638
- const messageList = new chunkE2Y2HLCU_cjs.MessageList();
16527
+ const messageList = new chunkW2LUCUUP_cjs.MessageList();
16639
16528
  messageList.addSystem(systemInstructions);
16640
16529
  messageList.add(task, "user");
16641
16530
  const result = llm.stream({
@@ -16643,7 +16532,7 @@ async function networkLoop({
16643
16532
  requestContext,
16644
16533
  messageList,
16645
16534
  agentId: routingAgent.id,
16646
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
16535
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
16647
16536
  structuredOutput: {
16648
16537
  schema: z9__default.default.object({
16649
16538
  resumeData: z9__default.default.string()
@@ -17021,7 +16910,7 @@ async function networkLoop({
17021
16910
  messages,
17022
16911
  routingAgent,
17023
16912
  generateId: generateId2,
17024
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
16913
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(routingAgentOptions ?? {}),
17025
16914
  memoryConfig: routingAgentMemoryOptions?.options
17026
16915
  });
17027
16916
  return new MastraAgentNetworkStream({
@@ -17230,16 +17119,16 @@ var AgentLegacyHandler = class {
17230
17119
  tracingOptions,
17231
17120
  ...rest
17232
17121
  }) {
17233
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
17122
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
17234
17123
  return {
17235
17124
  before: async () => {
17236
17125
  if (process.env.NODE_ENV !== "test") {
17237
17126
  this.capabilities.logger.debug(`[Agents:${this.capabilities.name}] - Starting generation`, { runId });
17238
17127
  }
17239
- const agentSpan = chunkPBDJR7QN_cjs.getOrCreateSpan({
17128
+ const agentSpan = chunkLIRWMGGI_cjs.getOrCreateSpan({
17240
17129
  type: "agent_run" /* AGENT_RUN */,
17241
17130
  name: `agent run: '${this.capabilities.id}'`,
17242
- entityType: "agent" /* AGENT */,
17131
+ entityType: chunkLIRWMGGI_cjs.EntityType.AGENT,
17243
17132
  entityId: this.capabilities.id,
17244
17133
  entityName: this.capabilities.name,
17245
17134
  input: {
@@ -17263,7 +17152,7 @@ var AgentLegacyHandler = class {
17263
17152
  requestContext,
17264
17153
  mastra: this.capabilities.mastra
17265
17154
  });
17266
- const innerObservabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan });
17155
+ const innerObservabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan });
17267
17156
  const memory = await this.capabilities.getMemory({ requestContext });
17268
17157
  const toolEnhancements = [
17269
17158
  // toolsets
@@ -17291,7 +17180,7 @@ var AgentLegacyHandler = class {
17291
17180
  methodType: methodType === "generate" ? "generateLegacy" : "streamLegacy",
17292
17181
  memoryConfig
17293
17182
  });
17294
- let messageList = new chunkE2Y2HLCU_cjs.MessageList({
17183
+ let messageList = new chunkW2LUCUUP_cjs.MessageList({
17295
17184
  threadId,
17296
17185
  resourceId,
17297
17186
  generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
@@ -17460,7 +17349,7 @@ var AgentLegacyHandler = class {
17460
17349
  result: resToLog,
17461
17350
  threadId
17462
17351
  });
17463
- const messageListResponses = new chunkE2Y2HLCU_cjs.MessageList({
17352
+ const messageListResponses = new chunkW2LUCUUP_cjs.MessageList({
17464
17353
  threadId,
17465
17354
  resourceId,
17466
17355
  generateMessageId: this.capabilities.mastra?.generateId?.bind(this.capabilities.mastra),
@@ -17510,7 +17399,7 @@ var AgentLegacyHandler = class {
17510
17399
  instructions: titleInstructions
17511
17400
  } = this.capabilities.resolveTitleGenerationConfig(config?.generateTitle);
17512
17401
  if (shouldGenerate && !thread2.title && userMessage) {
17513
- const observabilityContext2 = chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan });
17402
+ const observabilityContext2 = chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan });
17514
17403
  promises.push(
17515
17404
  this.capabilities.genTitle(userMessage, requestContext, observabilityContext2, titleModel, titleInstructions).then((title) => {
17516
17405
  if (title) {
@@ -17580,7 +17469,7 @@ var AgentLegacyHandler = class {
17580
17469
  overrideScorers,
17581
17470
  threadId,
17582
17471
  resourceId,
17583
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan })
17472
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan })
17584
17473
  });
17585
17474
  const scoringData = {
17586
17475
  input: {
@@ -17664,7 +17553,7 @@ var AgentLegacyHandler = class {
17664
17553
  writableStream,
17665
17554
  methodType,
17666
17555
  tracingOptions,
17667
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(args)
17556
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(args)
17668
17557
  });
17669
17558
  let messageList;
17670
17559
  let thread;
@@ -17829,7 +17718,7 @@ var AgentLegacyHandler = class {
17829
17718
  return tripwireResult;
17830
17719
  }
17831
17720
  const { experimental_output, output, agentSpan, ...llmOptions } = beforeResult;
17832
- const observabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan });
17721
+ const observabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan });
17833
17722
  let finalOutputProcessors = mergedGenerateOptions.outputProcessors;
17834
17723
  if (!output || experimental_output) {
17835
17724
  const result2 = await llmToUse.__text({
@@ -18117,7 +18006,7 @@ var AgentLegacyHandler = class {
18117
18006
  }
18118
18007
  const { onFinish, runId, output, experimental_output, agentSpan, messageList, requestContext, ...llmOptions } = beforeResult;
18119
18008
  const overrideScorers = mergedStreamOptions.scorers;
18120
- const observabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan });
18009
+ const observabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan });
18121
18010
  if (!output || experimental_output) {
18122
18011
  this.capabilities.logger.debug(`Starting agent ${this.capabilities.name} llm stream call`, {
18123
18012
  runId
@@ -18443,7 +18332,7 @@ function createMapResultsStep({
18443
18332
  const modelOutput = await getModelOutputForTripwire({
18444
18333
  tripwire: memoryData.tripwire,
18445
18334
  runId,
18446
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan }),
18335
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan }),
18447
18336
  options,
18448
18337
  model: agentModel,
18449
18338
  messageList: memoryData.messageList
@@ -18497,7 +18386,7 @@ function createMapResultsStep({
18497
18386
  methodType: modelMethodType,
18498
18387
  agentId,
18499
18388
  requestContext: result.requestContext,
18500
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan }),
18389
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan }),
18501
18390
  runId,
18502
18391
  toolChoice: result.toolChoice,
18503
18392
  tools: result.tools,
@@ -18610,7 +18499,7 @@ var prepareToolsStepOutputSchema = z9.z.object({
18610
18499
  var prepareMemoryStepOutputSchema = z9.z.object({
18611
18500
  threadExists: z9.z.boolean(),
18612
18501
  thread: storageThreadSchema.optional(),
18613
- messageList: z9.z.instanceof(chunkE2Y2HLCU_cjs.MessageList),
18502
+ messageList: z9.z.instanceof(chunkW2LUCUUP_cjs.MessageList),
18614
18503
  /** Shared processor states map that persists across loop iterations for both input and output processors */
18615
18504
  processorStates: z9.z.instanceof(Map),
18616
18505
  /** Tripwire data when input processor triggered abort */
@@ -18649,9 +18538,9 @@ function createPrepareMemoryStep({
18649
18538
  inputSchema: z9.z.object({}),
18650
18539
  outputSchema: prepareMemoryStepOutputSchema,
18651
18540
  execute: async ({ ...rest }) => {
18652
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
18541
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
18653
18542
  const thread = threadFromArgs;
18654
- const messageList = new chunkE2Y2HLCU_cjs.MessageList({
18543
+ const messageList = new chunkW2LUCUUP_cjs.MessageList({
18655
18544
  threadId: thread?.id,
18656
18545
  resourceId,
18657
18546
  generateMessageId: capabilities.generateMessageId,
@@ -18785,7 +18674,7 @@ function createPrepareToolsStep({
18785
18674
  resourceId,
18786
18675
  runId,
18787
18676
  requestContext,
18788
- ...chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan }),
18677
+ ...chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan }),
18789
18678
  outputWriter: options.outputWriter,
18790
18679
  methodType,
18791
18680
  memoryConfig: options.memory?.options,
@@ -18834,7 +18723,7 @@ function createStreamStep({
18834
18723
  ...validatedInputData,
18835
18724
  outputProcessors: processors,
18836
18725
  returnScorerData,
18837
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(observabilityContext),
18726
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(observabilityContext),
18838
18727
  requireToolApproval,
18839
18728
  toolCallConcurrency,
18840
18729
  resumeContext,
@@ -19143,7 +19032,7 @@ var Agent = class extends chunkRO47SMI7_cjs.MastraBase {
19143
19032
  * Throws an error if validation fails.
19144
19033
  */
19145
19034
  async #validateRequestContext(requestContext) {
19146
- if (this.#requestContextSchema && chunkMIILNUS4_cjs.isZodType(this.#requestContextSchema)) {
19035
+ if (this.#requestContextSchema && chunkDDIY3CRP_cjs.isZodType(this.#requestContextSchema)) {
19147
19036
  const contextValues = requestContext?.all ?? {};
19148
19037
  const validatedRequestContext = await this.#requestContextSchema.safeParseAsync(contextValues);
19149
19038
  if (!validatedRequestContext.success) {
@@ -19875,7 +19764,7 @@ ${errorMessages}`,
19875
19764
  */
19876
19765
  listTools({ requestContext = new chunk5WBEMKE2_cjs.RequestContext() } = {}) {
19877
19766
  if (typeof this.#tools !== "function") {
19878
- return chunkMIILNUS4_cjs.ensureToolProperties(this.#tools);
19767
+ return chunkDDIY3CRP_cjs.ensureToolProperties(this.#tools);
19879
19768
  }
19880
19769
  const result = this.#tools({
19881
19770
  requestContext,
@@ -19896,7 +19785,7 @@ ${errorMessages}`,
19896
19785
  this.logger.error(mastraError.toString());
19897
19786
  throw mastraError;
19898
19787
  }
19899
- return chunkMIILNUS4_cjs.ensureToolProperties(tools);
19788
+ return chunkDDIY3CRP_cjs.ensureToolProperties(tools);
19900
19789
  });
19901
19790
  }
19902
19791
  /**
@@ -19942,7 +19831,7 @@ ${errorMessages}`,
19942
19831
  });
19943
19832
  });
19944
19833
  } else {
19945
- llm = new chunkNUZYNU4M_cjs.MastraLLMV1({
19834
+ llm = new chunkJ7Q3CZI5_cjs.MastraLLMV1({
19946
19835
  model: modelInfo,
19947
19836
  mastra: this.#mastra,
19948
19837
  options: { tracingPolicy: this.#options?.tracingPolicy }
@@ -19968,7 +19857,7 @@ ${errorMessages}`,
19968
19857
  */
19969
19858
  async resolveModelConfig(modelConfig, requestContext) {
19970
19859
  try {
19971
- return await chunkXNHOUTCP_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
19860
+ return await chunkZSFSSMFT_cjs.resolveModelConfig(modelConfig, requestContext, this.#mastra);
19972
19861
  } catch (error) {
19973
19862
  const mastraError = new chunk4U7ZLI36_cjs.MastraError({
19974
19863
  id: "AGENT_GET_MODEL_MISSING_MODEL_INSTANCE",
@@ -20294,9 +20183,9 @@ ${errorMessages}`,
20294
20183
  instructions,
20295
20184
  ...rest
20296
20185
  }) {
20297
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20186
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20298
20187
  const llm = await this.getLLM({ requestContext, model });
20299
- const normMessage = new chunkE2Y2HLCU_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
20188
+ const normMessage = new chunkW2LUCUUP_cjs.MessageList().add(message, "user").get.all.aiV5.ui().at(-1);
20300
20189
  if (!normMessage) {
20301
20190
  throw new Error(`Could not generate title from input ${JSON.stringify(message)}`);
20302
20191
  }
@@ -20319,7 +20208,7 @@ ${errorMessages}`,
20319
20208
  const systemInstructions = await this.resolveTitleInstructions(requestContext, instructions);
20320
20209
  let text = "";
20321
20210
  if (isSupportedLanguageModel(llm.getModel())) {
20322
- const messageList = new chunkE2Y2HLCU_cjs.MessageList().add(
20211
+ const messageList = new chunkW2LUCUUP_cjs.MessageList().add(
20323
20212
  [
20324
20213
  {
20325
20214
  role: "system",
@@ -20372,7 +20261,7 @@ ${errorMessages}`,
20372
20261
  async genTitle(userMessage, requestContext, observabilityContext, model, instructions) {
20373
20262
  try {
20374
20263
  if (userMessage) {
20375
- const normMessage = new chunkE2Y2HLCU_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
20264
+ const normMessage = new chunkW2LUCUUP_cjs.MessageList().add(userMessage, "user").get.all.ui().at(-1);
20376
20265
  if (normMessage) {
20377
20266
  return await this.generateTitleFromUserMessage({
20378
20267
  message: normMessage,
@@ -20417,7 +20306,7 @@ ${errorMessages}`,
20417
20306
  autoResumeSuspendedTools,
20418
20307
  ...rest
20419
20308
  }) {
20420
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20309
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20421
20310
  let convertedMemoryTools = {};
20422
20311
  if (this._agentNetworkAppend) {
20423
20312
  this.logger.debug(`[Agent:${this.name}] - Skipping memory tools (agent network context)`, { runId });
@@ -20453,7 +20342,7 @@ ${errorMessages}`,
20453
20342
  tracingPolicy: this.#options?.tracingPolicy,
20454
20343
  requireApproval: toolObj.requireApproval
20455
20344
  };
20456
- const convertedToCoreTool = chunkMIILNUS4_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
20345
+ const convertedToCoreTool = chunkDDIY3CRP_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
20457
20346
  convertedMemoryTools[toolName] = convertedToCoreTool;
20458
20347
  }
20459
20348
  }
@@ -20472,7 +20361,7 @@ ${errorMessages}`,
20472
20361
  autoResumeSuspendedTools,
20473
20362
  ...rest
20474
20363
  }) {
20475
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20364
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20476
20365
  let convertedWorkspaceTools = {};
20477
20366
  if (this._agentNetworkAppend) {
20478
20367
  this.logger.debug(`[Agent:${this.name}] - Skipping workspace tools (agent network context)`, { runId });
@@ -20504,7 +20393,7 @@ ${errorMessages}`,
20504
20393
  requireApproval: toolObj.requireApproval,
20505
20394
  workspace
20506
20395
  };
20507
- const convertedToCoreTool = chunkMIILNUS4_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
20396
+ const convertedToCoreTool = chunkDDIY3CRP_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
20508
20397
  convertedWorkspaceTools[toolName] = convertedToCoreTool;
20509
20398
  }
20510
20399
  }
@@ -20526,7 +20415,7 @@ ${errorMessages}`,
20526
20415
  autoResumeSuspendedTools,
20527
20416
  ...rest
20528
20417
  }) {
20529
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20418
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20530
20419
  let convertedSkillTools = {};
20531
20420
  if (this._agentNetworkAppend) {
20532
20421
  return convertedSkillTools;
@@ -20558,7 +20447,7 @@ ${errorMessages}`,
20558
20447
  // Skill tools never require approval
20559
20448
  workspace
20560
20449
  };
20561
- const convertedToCoreTool = chunkMIILNUS4_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
20450
+ const convertedToCoreTool = chunkDDIY3CRP_cjs.makeCoreTool(toolObj, options, void 0, autoResumeSuspendedTools);
20562
20451
  convertedSkillTools[toolName] = convertedToCoreTool;
20563
20452
  }
20564
20453
  }
@@ -20618,7 +20507,7 @@ ${errorMessages}`,
20618
20507
  */
20619
20508
  async __runProcessInputStep(args) {
20620
20509
  const { requestContext, messageList, stepNumber = 0, processorStates, ...rest } = args;
20621
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20510
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20622
20511
  let tripwire;
20623
20512
  if (this.#inputProcessors || this.#memory) {
20624
20513
  const runner = await this.getProcessorRunner({
@@ -20747,7 +20636,7 @@ ${errorMessages}`,
20747
20636
  autoResumeSuspendedTools,
20748
20637
  ...rest
20749
20638
  }) {
20750
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20639
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20751
20640
  let toolsForRequest = {};
20752
20641
  this.logger.debug(`[Agents:${this.name}] - Assembling assigned tools`, { runId, threadId, resourceId });
20753
20642
  const memory = await this.getMemory({ requestContext });
@@ -20774,7 +20663,7 @@ ${errorMessages}`,
20774
20663
  tracingPolicy: this.#options?.tracingPolicy,
20775
20664
  requireApproval: tool2.requireApproval
20776
20665
  };
20777
- return [k, chunkMIILNUS4_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
20666
+ return [k, chunkDDIY3CRP_cjs.makeCoreTool(tool2, options, void 0, autoResumeSuspendedTools)];
20778
20667
  })
20779
20668
  );
20780
20669
  const assignedToolEntriesConverted = Object.fromEntries(
@@ -20799,7 +20688,7 @@ ${errorMessages}`,
20799
20688
  autoResumeSuspendedTools,
20800
20689
  ...rest
20801
20690
  }) {
20802
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20691
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20803
20692
  let toolsForRequest = {};
20804
20693
  const memory = await this.getMemory({ requestContext });
20805
20694
  const toolsFromToolsets = Object.values(toolsets || {});
@@ -20825,7 +20714,7 @@ ${errorMessages}`,
20825
20714
  tracingPolicy: this.#options?.tracingPolicy,
20826
20715
  requireApproval: toolObj.requireApproval
20827
20716
  };
20828
- const convertedToCoreTool = chunkMIILNUS4_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
20717
+ const convertedToCoreTool = chunkDDIY3CRP_cjs.makeCoreTool(toolObj, options, "toolset", autoResumeSuspendedTools);
20829
20718
  toolsForRequest[toolName] = convertedToCoreTool;
20830
20719
  }
20831
20720
  }
@@ -20846,7 +20735,7 @@ ${errorMessages}`,
20846
20735
  autoResumeSuspendedTools,
20847
20736
  ...rest
20848
20737
  }) {
20849
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20738
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20850
20739
  let toolsForRequest = {};
20851
20740
  const memory = await this.getMemory({ requestContext });
20852
20741
  const clientToolsForInput = Object.entries(clientTools || {});
@@ -20871,7 +20760,7 @@ ${errorMessages}`,
20871
20760
  tracingPolicy: this.#options?.tracingPolicy,
20872
20761
  requireApproval: tool2.requireApproval
20873
20762
  };
20874
- const convertedToCoreTool = chunkMIILNUS4_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
20763
+ const convertedToCoreTool = chunkDDIY3CRP_cjs.makeCoreTool(toolRest, options, "client-tool", autoResumeSuspendedTools);
20875
20764
  toolsForRequest[toolName] = convertedToCoreTool;
20876
20765
  }
20877
20766
  }
@@ -20923,7 +20812,7 @@ ${errorMessages}`,
20923
20812
  delegation,
20924
20813
  ...rest
20925
20814
  }) {
20926
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
20815
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
20927
20816
  const convertedAgentTools = {};
20928
20817
  const agents = await this.listAgents({ requestContext });
20929
20818
  if (Object.keys(agents).length > 0) {
@@ -21153,7 +21042,7 @@ ${effectiveInstructions}`;
21153
21042
  const generateResult = resumeData ? await agent.resumeGenerate(resumeData, {
21154
21043
  runId: suspendedToolRunId,
21155
21044
  requestContext,
21156
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {}),
21045
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {}),
21157
21046
  ...effectiveInstructions && { instructions: effectiveInstructions },
21158
21047
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
21159
21048
  ...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
@@ -21165,7 +21054,7 @@ ${effectiveInstructions}`;
21165
21054
  } : {}
21166
21055
  }) : await agent.generate(messagesForSubAgent, {
21167
21056
  requestContext,
21168
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {}),
21057
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {}),
21169
21058
  ...effectiveInstructions && { instructions: effectiveInstructions },
21170
21059
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
21171
21060
  ...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
@@ -21229,14 +21118,14 @@ ${effectiveInstructions}`;
21229
21118
  } else if (methodType === "generate" && modelVersion === "v1") {
21230
21119
  const generateResult = await agent.generateLegacy(messagesForSubAgent, {
21231
21120
  requestContext,
21232
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {})
21121
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {})
21233
21122
  });
21234
21123
  result = { text: generateResult.text };
21235
21124
  } else if ((methodType === "stream" || methodType === "streamLegacy") && supportedLanguageModelSpecifications.includes(modelVersion)) {
21236
21125
  const streamResult = resumeData ? await agent.resumeStream(resumeData, {
21237
21126
  runId: suspendedToolRunId,
21238
21127
  requestContext,
21239
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {}),
21128
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {}),
21240
21129
  ...effectiveInstructions && { instructions: effectiveInstructions },
21241
21130
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
21242
21131
  ...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
@@ -21250,7 +21139,7 @@ ${effectiveInstructions}`;
21250
21139
  } : {}
21251
21140
  }) : await agent.stream(messagesForSubAgent, {
21252
21141
  requestContext,
21253
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {}),
21142
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {}),
21254
21143
  ...effectiveInstructions && { instructions: effectiveInstructions },
21255
21144
  ...effectiveMaxSteps && { maxSteps: effectiveMaxSteps },
21256
21145
  ...resourceId && threadId && !subAgentHasOwnMemoryConfig ? {
@@ -21349,7 +21238,7 @@ ${effectiveInstructions}`;
21349
21238
  } else {
21350
21239
  const streamResult = await agent.streamLegacy(effectivePrompt, {
21351
21240
  requestContext,
21352
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {})
21241
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {})
21353
21242
  });
21354
21243
  let fullText = "";
21355
21244
  for await (const chunk of streamResult.fullStream) {
@@ -21531,7 +21420,7 @@ ${effectiveInstructions}`;
21531
21420
  ...observabilityContext,
21532
21421
  tracingPolicy: this.#options?.tracingPolicy
21533
21422
  };
21534
- convertedAgentTools[`agent-${agentName}`] = chunkMIILNUS4_cjs.makeCoreTool(
21423
+ convertedAgentTools[`agent-${agentName}`] = chunkDDIY3CRP_cjs.makeCoreTool(
21535
21424
  toolObj,
21536
21425
  options,
21537
21426
  void 0,
@@ -21554,7 +21443,7 @@ ${effectiveInstructions}`;
21554
21443
  autoResumeSuspendedTools,
21555
21444
  ...rest
21556
21445
  }) {
21557
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
21446
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
21558
21447
  const convertedWorkflowTools = {};
21559
21448
  const workflows = await this.listWorkflows({ requestContext });
21560
21449
  if (Object.keys(workflows).length > 0) {
@@ -21625,13 +21514,13 @@ ${effectiveInstructions}`;
21625
21514
  result = await run.resume({
21626
21515
  resumeData,
21627
21516
  requestContext,
21628
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {})
21517
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {})
21629
21518
  });
21630
21519
  } else {
21631
21520
  result = await run.start({
21632
21521
  inputData: workflowInputData,
21633
21522
  requestContext,
21634
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {}),
21523
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {}),
21635
21524
  ...initialState && { initialState }
21636
21525
  });
21637
21526
  }
@@ -21639,7 +21528,7 @@ ${effectiveInstructions}`;
21639
21528
  const streamResult = run.streamLegacy({
21640
21529
  inputData: workflowInputData,
21641
21530
  requestContext,
21642
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {})
21531
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {})
21643
21532
  });
21644
21533
  if (context?.writer) {
21645
21534
  await streamResult.stream.pipeTo(context.writer);
@@ -21652,11 +21541,11 @@ ${effectiveInstructions}`;
21652
21541
  const streamResult = resumeData ? run.resumeStream({
21653
21542
  resumeData,
21654
21543
  requestContext,
21655
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {})
21544
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {})
21656
21545
  }) : run.stream({
21657
21546
  inputData: workflowInputData,
21658
21547
  requestContext,
21659
- ...chunkPBDJR7QN_cjs.resolveObservabilityContext(context ?? {}),
21548
+ ...chunkLIRWMGGI_cjs.resolveObservabilityContext(context ?? {}),
21660
21549
  ...initialState && { initialState }
21661
21550
  });
21662
21551
  if (context?.writer) {
@@ -21747,7 +21636,7 @@ ${effectiveInstructions}`;
21747
21636
  ...observabilityContext,
21748
21637
  tracingPolicy: this.#options?.tracingPolicy
21749
21638
  };
21750
- convertedWorkflowTools[`workflow-${workflowName}`] = chunkMIILNUS4_cjs.makeCoreTool(
21639
+ convertedWorkflowTools[`workflow-${workflowName}`] = chunkDDIY3CRP_cjs.makeCoreTool(
21751
21640
  toolObj,
21752
21641
  options,
21753
21642
  void 0,
@@ -21775,11 +21664,11 @@ ${effectiveInstructions}`;
21775
21664
  delegation,
21776
21665
  ...rest
21777
21666
  }) {
21778
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
21667
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
21779
21668
  let mastraProxy = void 0;
21780
21669
  const logger = this.logger;
21781
21670
  if (this.#mastra) {
21782
- mastraProxy = chunkMIILNUS4_cjs.createMastraProxy({ mastra: this.#mastra, logger });
21671
+ mastraProxy = chunkDDIY3CRP_cjs.createMastraProxy({ mastra: this.#mastra, logger });
21783
21672
  }
21784
21673
  const assignedTools = await this.listAssignedTools({
21785
21674
  runId,
@@ -22031,7 +21920,7 @@ ${effectiveInstructions}`;
22031
21920
  const resolvedModel = await this.resolveModelConfig(selection, requestContext);
22032
21921
  this.assertSupportsPreparedModels(resolvedModel);
22033
21922
  let headers;
22034
- if (resolvedModel instanceof chunkXNHOUTCP_cjs.ModelRouterLanguageModel) {
21923
+ if (resolvedModel instanceof chunkZSFSSMFT_cjs.ModelRouterLanguageModel) {
22035
21924
  headers = resolvedModel.config?.headers;
22036
21925
  }
22037
21926
  return [
@@ -22064,7 +21953,7 @@ ${effectiveInstructions}`;
22064
21953
  throw mastraError;
22065
21954
  }
22066
21955
  let headers;
22067
- if (model instanceof chunkXNHOUTCP_cjs.ModelRouterLanguageModel) {
21956
+ if (model instanceof chunkZSFSSMFT_cjs.ModelRouterLanguageModel) {
22068
21957
  headers = model.config?.headers;
22069
21958
  }
22070
21959
  return {
@@ -22134,10 +22023,10 @@ ${effectiveInstructions}`;
22134
22023
  resourceId
22135
22024
  }) || crypto2.randomUUID();
22136
22025
  const instructions = options.instructions || await this.getInstructions({ requestContext });
22137
- const agentSpan = chunkPBDJR7QN_cjs.getOrCreateSpan({
22026
+ const agentSpan = chunkLIRWMGGI_cjs.getOrCreateSpan({
22138
22027
  type: "agent_run" /* AGENT_RUN */,
22139
22028
  name: `agent run: '${this.id}'`,
22140
- entityType: "agent" /* AGENT */,
22029
+ entityType: chunkLIRWMGGI_cjs.EntityType.AGENT,
22141
22030
  entityId: this.id,
22142
22031
  entityName: this.name,
22143
22032
  input: options.messages,
@@ -22210,7 +22099,7 @@ ${effectiveInstructions}`;
22210
22099
  workspace
22211
22100
  });
22212
22101
  const run = await executionWorkflow.createRun();
22213
- const observabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan });
22102
+ const observabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan });
22214
22103
  const result = await run.start({ ...observabilityContext });
22215
22104
  return result;
22216
22105
  }
@@ -22234,7 +22123,7 @@ ${effectiveInstructions}`;
22234
22123
  structuredOutput = false,
22235
22124
  overrideScorers
22236
22125
  }) {
22237
- const observabilityContext = chunkPBDJR7QN_cjs.createObservabilityContext({ currentSpan: agentSpan });
22126
+ const observabilityContext = chunkLIRWMGGI_cjs.createObservabilityContext({ currentSpan: agentSpan });
22238
22127
  const resToLog = {
22239
22128
  text: result.text,
22240
22129
  object: result.object,
@@ -22515,7 +22404,7 @@ ${effectiveInstructions}`;
22515
22404
  const defaultOptions = await this.getDefaultOptions({
22516
22405
  requestContext: options?.requestContext
22517
22406
  });
22518
- const mergedOptions = chunkMIILNUS4_cjs.deepMerge(
22407
+ const mergedOptions = chunkDDIY3CRP_cjs.deepMerge(
22519
22408
  defaultOptions,
22520
22409
  options ?? {}
22521
22410
  );
@@ -22585,7 +22474,7 @@ ${effectiveInstructions}`;
22585
22474
  const defaultOptions = await this.getDefaultOptions({
22586
22475
  requestContext: streamOptions?.requestContext
22587
22476
  });
22588
- const mergedOptions = chunkMIILNUS4_cjs.deepMerge(
22477
+ const mergedOptions = chunkDDIY3CRP_cjs.deepMerge(
22589
22478
  defaultOptions,
22590
22479
  streamOptions ?? {}
22591
22480
  );
@@ -22649,7 +22538,7 @@ ${effectiveInstructions}`;
22649
22538
  const defaultOptions = await this.getDefaultOptions({
22650
22539
  requestContext: streamOptions?.requestContext
22651
22540
  });
22652
- let mergedStreamOptions = chunkMIILNUS4_cjs.deepMerge(
22541
+ let mergedStreamOptions = chunkDDIY3CRP_cjs.deepMerge(
22653
22542
  defaultOptions,
22654
22543
  streamOptions ?? {}
22655
22544
  );
@@ -22714,7 +22603,7 @@ ${effectiveInstructions}`;
22714
22603
  const defaultOptions = await this.getDefaultOptions({
22715
22604
  requestContext: options?.requestContext
22716
22605
  });
22717
- const mergedOptions = chunkMIILNUS4_cjs.deepMerge(
22606
+ const mergedOptions = chunkDDIY3CRP_cjs.deepMerge(
22718
22607
  defaultOptions,
22719
22608
  options ?? {}
22720
22609
  );
@@ -22951,7 +22840,7 @@ var ModerationProcessor = class _ModerationProcessor {
22951
22840
  async processInput(args) {
22952
22841
  try {
22953
22842
  const { messages, abort, ...rest } = args;
22954
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
22843
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
22955
22844
  if (messages.length === 0) {
22956
22845
  return messages;
22957
22846
  }
@@ -22985,7 +22874,7 @@ var ModerationProcessor = class _ModerationProcessor {
22985
22874
  async processOutputStream(args) {
22986
22875
  try {
22987
22876
  const { part, streamParts, abort, ...rest } = args;
22988
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
22877
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
22989
22878
  if (part.type !== "text-delta") {
22990
22879
  return part;
22991
22880
  }
@@ -23193,7 +23082,7 @@ var PromptInjectionDetector = class _PromptInjectionDetector {
23193
23082
  async processInput(args) {
23194
23083
  try {
23195
23084
  const { messages, abort, ...rest } = args;
23196
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
23085
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
23197
23086
  if (messages.length === 0) {
23198
23087
  return messages;
23199
23088
  }
@@ -23441,7 +23330,7 @@ var PIIDetector = class _PIIDetector {
23441
23330
  async processInput(args) {
23442
23331
  try {
23443
23332
  const { messages, abort, ...rest } = args;
23444
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
23333
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
23445
23334
  if (messages.length === 0) {
23446
23335
  return messages;
23447
23336
  }
@@ -23724,7 +23613,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
23724
23613
  */
23725
23614
  async processOutputStream(args) {
23726
23615
  const { part, abort, ...rest } = args;
23727
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
23616
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
23728
23617
  try {
23729
23618
  if (part.type !== "text-delta") {
23730
23619
  return part;
@@ -23787,7 +23676,7 @@ IMPORTANT: Only include PII types that are actually detected. If no PII is found
23787
23676
  abort,
23788
23677
  ...rest
23789
23678
  }) {
23790
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
23679
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
23791
23680
  try {
23792
23681
  if (messages.length === 0) {
23793
23682
  return messages;
@@ -23916,7 +23805,7 @@ var LanguageDetector = class _LanguageDetector {
23916
23805
  async processInput(args) {
23917
23806
  try {
23918
23807
  const { messages, abort, ...rest } = args;
23919
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
23808
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
23920
23809
  if (messages.length === 0) {
23921
23810
  return messages;
23922
23811
  }
@@ -24581,7 +24470,7 @@ var SystemPromptScrubber = class {
24581
24470
  */
24582
24471
  async processOutputStream(args) {
24583
24472
  const { part, abort, ...rest } = args;
24584
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
24473
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
24585
24474
  if (part.type !== "text-delta") {
24586
24475
  return part;
24587
24476
  }
@@ -24636,7 +24525,7 @@ var SystemPromptScrubber = class {
24636
24525
  abort,
24637
24526
  ...rest
24638
24527
  }) {
24639
- const observabilityContext = chunkPBDJR7QN_cjs.resolveObservabilityContext(rest);
24528
+ const observabilityContext = chunkLIRWMGGI_cjs.resolveObservabilityContext(rest);
24640
24529
  const processedMessages = [];
24641
24530
  for (const message of messages) {
24642
24531
  if (message.role !== "assistant" || !message.content?.parts) {
@@ -25502,7 +25391,7 @@ var WorkingMemory = class {
25502
25391
  return messageList;
25503
25392
  }
25504
25393
  generateEmptyFromSchemaInternal(schema) {
25505
- const result = chunkMIILNUS4_cjs.generateEmptyFromSchema(schema);
25394
+ const result = chunkDDIY3CRP_cjs.generateEmptyFromSchema(schema);
25506
25395
  return Object.keys(result).length > 0 ? result : null;
25507
25396
  }
25508
25397
  getWorkingMemoryToolInstruction({
@@ -25705,7 +25594,7 @@ var SemanticRecall = class {
25705
25594
  */
25706
25595
  formatCrossThreadMessages(messages, currentThreadId) {
25707
25596
  let result = ``;
25708
- const v1Messages = new chunkE2Y2HLCU_cjs.MessageList().add(messages, "memory").get.all.v1();
25597
+ const v1Messages = new chunkW2LUCUUP_cjs.MessageList().add(messages, "memory").get.all.v1();
25709
25598
  let lastYmd = null;
25710
25599
  for (const msg of v1Messages) {
25711
25600
  const date = msg.createdAt;
@@ -26147,7 +26036,7 @@ https://mastra.ai/en/docs/memory/semantic-recall`
26147
26036
  );
26148
26037
  }
26149
26038
  if (typeof config.embedder === "string") {
26150
- this.embedder = new chunkXNHOUTCP_cjs.ModelRouterEmbeddingModel(config.embedder);
26039
+ this.embedder = new chunkZSFSSMFT_cjs.ModelRouterEmbeddingModel(config.embedder);
26151
26040
  } else {
26152
26041
  this.embedder = config.embedder;
26153
26042
  }
@@ -26186,7 +26075,7 @@ https://mastra.ai/en/docs/memory/overview`
26186
26075
  }
26187
26076
  setEmbedder(embedder, embedderOptions) {
26188
26077
  if (typeof embedder === "string") {
26189
- this.embedder = new chunkXNHOUTCP_cjs.ModelRouterEmbeddingModel(embedder);
26078
+ this.embedder = new chunkZSFSSMFT_cjs.ModelRouterEmbeddingModel(embedder);
26190
26079
  } else {
26191
26080
  this.embedder = embedder;
26192
26081
  }
@@ -26283,7 +26172,7 @@ https://mastra.ai/en/docs/memory/overview`
26283
26172
  "The threads.generateTitle option has been moved. Use the top-level generateTitle option instead."
26284
26173
  );
26285
26174
  }
26286
- const mergedConfig = chunkMIILNUS4_cjs.deepMerge(this.threadConfig, config || {});
26175
+ const mergedConfig = chunkDDIY3CRP_cjs.deepMerge(this.threadConfig, config || {});
26287
26176
  if (typeof config?.workingMemory === "object" && config.workingMemory?.schema && typeof mergedConfig.workingMemory === "object") {
26288
26177
  mergedConfig.workingMemory.schema = config.workingMemory.schema;
26289
26178
  }
@@ -26633,7 +26522,7 @@ var MockMemory = class extends MastraMemory {
26633
26522
  } = {}) {
26634
26523
  super({
26635
26524
  name: "mock",
26636
- storage: storage || new chunk4RWTWZET_cjs.InMemoryStore(),
26525
+ storage: storage || new chunkEAKNCJKL_cjs.InMemoryStore(),
26637
26526
  options: {
26638
26527
  workingMemory: enableWorkingMemory ? { enabled: true, template: workingMemoryTemplate } : void 0,
26639
26528
  lastMessages: enableMessageHistory ? 10 : void 0
@@ -26941,5 +26830,5 @@ exports.validateStepRequestContext = validateStepRequestContext;
26941
26830
  exports.validateStepResumeData = validateStepResumeData;
26942
26831
  exports.validateStepStateData = validateStepStateData;
26943
26832
  exports.validateStepSuspendData = validateStepSuspendData;
26944
- //# sourceMappingURL=chunk-Q4W5XQK2.cjs.map
26945
- //# sourceMappingURL=chunk-Q4W5XQK2.cjs.map
26833
+ //# sourceMappingURL=chunk-445B4SO3.cjs.map
26834
+ //# sourceMappingURL=chunk-445B4SO3.cjs.map