@mastra/core 1.86.0 → 1.87.0-alpha.1

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 (481) hide show
  1. package/dist/_types/@ai-sdk_anthropic@3.0.137/dist/index.d.ts +2 -2
  2. package/dist/_types/@ai-sdk_google@3.0.140/dist/index.d.ts +2 -2
  3. package/dist/_types/@ai-sdk_openai@3.0.135/dist/index.d.ts +2 -2
  4. package/dist/a2a/index.cjs +1 -1
  5. package/dist/a2a/index.js +1 -1
  6. package/dist/agent/durable/constants.d.ts +2 -0
  7. package/dist/agent/durable/evented-execution.d.ts +7 -0
  8. package/dist/agent/durable/execution-engine.d.ts +1 -0
  9. package/dist/agent/durable/execution-fence.d.ts +2 -0
  10. package/dist/agent/durable/index.cjs +4 -1
  11. package/dist/agent/durable/index.d.ts +2 -1
  12. package/dist/agent/durable/index.js +2 -2
  13. package/dist/agent/durable/run-registry.d.ts +13 -0
  14. package/dist/agent/durable/segment-spans.d.ts +54 -1
  15. package/dist/agent/durable/types.d.ts +12 -0
  16. package/dist/agent/durable/workflows/durable-loop-builder.d.ts +57 -2
  17. package/dist/agent/durable/workflows/finalize-run.d.ts +4 -1
  18. package/dist/agent/durable/workflows/shared/index.d.ts +1 -1
  19. package/dist/agent/durable/workflows/shared/reported-cost.d.ts +7 -0
  20. package/dist/agent/durable/workflows/shared/schemas.d.ts +16 -1
  21. package/dist/agent/durable/workflows/shared/tool-call-concurrency.d.ts +6 -0
  22. package/dist/agent/durable/workflows/steps/llm-execution.d.ts +5 -0
  23. package/dist/agent/durable/workflows/steps/llm-mapping.d.ts +6 -0
  24. package/dist/agent/durable/workflows/steps/tool-call.d.ts +20 -0
  25. package/dist/agent/index.cjs +3 -3
  26. package/dist/agent/index.js +3 -3
  27. package/dist/agent/message-list/index.cjs +1 -1
  28. package/dist/agent/message-list/index.js +1 -1
  29. package/dist/agent/request-context-snapshot.d.ts +3 -2
  30. package/dist/agent/streams/run-records.d.ts +9 -1
  31. package/dist/agent/thread-stream-runtime.d.ts +3 -1
  32. package/dist/agent-builder/ee/index.cjs +1 -1
  33. package/dist/agent-builder/ee/index.js +1 -1
  34. package/dist/agent-controller/index.cjs +1 -1
  35. package/dist/agent-controller/index.js +1 -1
  36. package/dist/agent-controller/session-run-engine.d.ts +5 -2
  37. package/dist/agent-controller/session.d.ts +2 -0
  38. package/dist/agent-controller/types.d.ts +23 -0
  39. package/dist/{agent-controller-D_5Dc8d3.cjs → agent-controller-BTIxiD1u.cjs} +44 -14
  40. package/dist/{agent-controller-D5EKeS1H.js → agent-controller-C1bK0CXm.js} +44 -14
  41. package/dist/background-tasks/index.cjs +1 -1
  42. package/dist/background-tasks/index.js +1 -1
  43. package/dist/background-tasks/manager.d.ts +4 -1
  44. package/dist/{background-tasks-idnlMbqD.js → background-tasks-BbVsBghi.js} +139 -51
  45. package/dist/{background-tasks-BVxb0VGV.cjs → background-tasks-CVl6e0Jo.cjs} +139 -51
  46. package/dist/browser/index.cjs +1 -1
  47. package/dist/browser/index.js +1 -1
  48. package/dist/{builder-CBWoYNck.cjs → builder-BRJPSTig.cjs} +2 -2
  49. package/dist/{builder-Cuq-j2w3.js → builder-C8XzrtBQ.js} +2 -2
  50. package/dist/cache/base.d.ts +40 -10
  51. package/dist/cache/index.cjs +1 -1
  52. package/dist/cache/index.js +1 -1
  53. package/dist/capabilities/302ai.json +213 -213
  54. package/dist/capabilities/abliteratedllm.json +30 -30
  55. package/dist/capabilities/abliteration-ai.json +6 -6
  56. package/dist/capabilities/above.json +19 -19
  57. package/dist/capabilities/adaption.json +16 -16
  58. package/dist/capabilities/adzuki.json +19 -19
  59. package/dist/capabilities/agentrouter.json +11 -11
  60. package/dist/capabilities/agnes.json +2 -2
  61. package/dist/capabilities/ai-router.json +6 -6
  62. package/dist/capabilities/aiand.json +20 -20
  63. package/dist/capabilities/aigrow.json +14 -14
  64. package/dist/capabilities/aimlapi.json +146 -150
  65. package/dist/capabilities/aixy.json +21 -21
  66. package/dist/capabilities/aki-io.json +14 -14
  67. package/dist/capabilities/alibaba-cn.json +96 -96
  68. package/dist/capabilities/alibaba-coding-plan-cn.json +4 -4
  69. package/dist/capabilities/alibaba-coding-plan.json +4 -4
  70. package/dist/capabilities/alibaba-token-plan-cn.json +50 -50
  71. package/dist/capabilities/alibaba-token-plan.json +49 -49
  72. package/dist/capabilities/alibaba.json +69 -69
  73. package/dist/capabilities/ambient.json +12 -12
  74. package/dist/capabilities/amd.json +8 -8
  75. package/dist/capabilities/anthropic.json +43 -43
  76. package/dist/capabilities/anyapi.json +17 -17
  77. package/dist/capabilities/apiko.json +2 -2
  78. package/dist/capabilities/arcee.json +11 -11
  79. package/dist/capabilities/augure.json +6 -6
  80. package/dist/capabilities/auriko.json +24 -24
  81. package/dist/capabilities/bailing.json +5 -5
  82. package/dist/capabilities/baseten.json +35 -35
  83. package/dist/capabilities/bee.json +5 -5
  84. package/dist/capabilities/berget.json +8 -8
  85. package/dist/capabilities/bothub.json +15 -15
  86. package/dist/capabilities/boundless.json +36 -36
  87. package/dist/capabilities/bumo.json +47 -47
  88. package/dist/capabilities/byteplus.json +30 -30
  89. package/dist/capabilities/cerebras.json +4 -4
  90. package/dist/capabilities/cheapaimodel.json +10 -10
  91. package/dist/capabilities/cheapest-token.json +32 -32
  92. package/dist/capabilities/chutes.json +11 -14
  93. package/dist/capabilities/cline-pass.json +33 -33
  94. package/dist/capabilities/cloudcode.json +9 -9
  95. package/dist/capabilities/cloudferro-sherlock.json +4 -4
  96. package/dist/capabilities/cloudflare-workers-ai.json +17 -78
  97. package/dist/capabilities/commandcode.json +155 -155
  98. package/dist/capabilities/concentrate.json +286 -277
  99. package/dist/capabilities/cortecs.json +114 -114
  100. package/dist/capabilities/crossmodel.json +189 -189
  101. package/dist/capabilities/crusoe.json +8 -8
  102. package/dist/capabilities/daoxe.json +6 -6
  103. package/dist/capabilities/databricks.json +129 -129
  104. package/dist/capabilities/deepinfra.json +132 -69
  105. package/dist/capabilities/deepseek.json +4 -4
  106. package/dist/capabilities/digitalocean.json +112 -112
  107. package/dist/capabilities/dothoosh.json +31 -31
  108. package/dist/capabilities/doubleword.json +26 -26
  109. package/dist/capabilities/edenai.json +902 -1760
  110. package/dist/capabilities/empiriolabs.json +156 -158
  111. package/dist/capabilities/engy.json +18 -18
  112. package/dist/capabilities/entrim.json +6 -6
  113. package/dist/capabilities/evroc.json +16 -16
  114. package/dist/capabilities/ezkielyna.json +7 -7
  115. package/dist/capabilities/fastrouter.json +73 -73
  116. package/dist/capabilities/fireworks-ai.json +86 -65
  117. package/dist/capabilities/freemodel.json +24 -24
  118. package/dist/capabilities/friendli.json +2 -2
  119. package/dist/capabilities/frogbot.json +96 -96
  120. package/dist/capabilities/gisoo.json +17 -17
  121. package/dist/capabilities/gmicloud.json +10 -10
  122. package/dist/capabilities/google.json +50 -50
  123. package/dist/capabilities/graphn.json +12 -12
  124. package/dist/capabilities/greenpt.json +35 -35
  125. package/dist/capabilities/groq.json +8 -8
  126. package/dist/capabilities/helicone.json +77 -77
  127. package/dist/capabilities/hostinger-router.json +11 -11
  128. package/dist/capabilities/hpc-ai.json +14 -14
  129. package/dist/capabilities/huawei-maas.json +16 -16
  130. package/dist/capabilities/hubris.json +30 -30
  131. package/dist/capabilities/huggingface.json +101 -91
  132. package/dist/capabilities/hyper.json +24 -24
  133. package/dist/capabilities/impossibl.json +135 -135
  134. package/dist/capabilities/inception.json +2 -2
  135. package/dist/capabilities/inceptron.json +8 -8
  136. package/dist/capabilities/inco.json +4 -4
  137. package/dist/capabilities/infer.json +13 -13
  138. package/dist/capabilities/inferall.json +4 -4
  139. package/dist/capabilities/inference-coop.json +9 -9
  140. package/dist/capabilities/inferenceapis.json +26 -26
  141. package/dist/capabilities/inferris.json +3 -3
  142. package/dist/capabilities/infersia.json +14 -14
  143. package/dist/capabilities/inferx.json +3 -3
  144. package/dist/capabilities/infomaniak.json +2 -2
  145. package/dist/capabilities/io-net.json +5 -5
  146. package/dist/capabilities/iteracompute.json +55 -55
  147. package/dist/capabilities/jad-ai.json +2 -2
  148. package/dist/capabilities/jalapeno.json +11 -11
  149. package/dist/capabilities/jiekou.json +64 -64
  150. package/dist/capabilities/joingonka.json +4 -4
  151. package/dist/capabilities/jzstoken.json +40 -40
  152. package/dist/capabilities/keln.json +25 -25
  153. package/dist/capabilities/kenari.json +123 -123
  154. package/dist/capabilities/kilo.json +639 -623
  155. package/dist/capabilities/kimi-code-plan-cn.json +4 -4
  156. package/dist/capabilities/kimi-code-plan-global.json +4 -4
  157. package/dist/capabilities/kitani.json +6 -6
  158. package/dist/capabilities/klavo.json +23 -23
  159. package/dist/capabilities/korouter.json +31 -31
  160. package/dist/capabilities/kunavo.json +10 -10
  161. package/dist/capabilities/liquid.json +10 -10
  162. package/dist/capabilities/lithosai.json +2 -2
  163. package/dist/capabilities/llmgateway-providers.json +895 -886
  164. package/dist/capabilities/llmgateway.json +344 -336
  165. package/dist/capabilities/llmtr.json +26 -26
  166. package/dist/capabilities/logits.json +2 -2
  167. package/dist/capabilities/longcat.json +2 -2
  168. package/dist/capabilities/lowrouter.json +49 -49
  169. package/dist/capabilities/lyceum.json +11 -11
  170. package/dist/capabilities/melious.json +12 -12
  171. package/dist/capabilities/merge-gateway.json +259 -258
  172. package/dist/capabilities/meta.json +8 -8
  173. package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
  174. package/dist/capabilities/minimax-cn.json +5 -5
  175. package/dist/capabilities/minimax-coding-plan.json +2 -2
  176. package/dist/capabilities/minimax.json +5 -5
  177. package/dist/capabilities/mistral.json +18 -18
  178. package/dist/capabilities/mixlayer.json +5 -5
  179. package/dist/capabilities/modal.json +10 -10
  180. package/dist/capabilities/model-oracle-ai.json +26 -26
  181. package/dist/capabilities/modelis.json +13 -13
  182. package/dist/capabilities/modelscope.json +2 -2
  183. package/dist/capabilities/modular.json +8 -8
  184. package/dist/capabilities/moneo.json +13 -13
  185. package/dist/capabilities/moonshotai-cn.json +3 -3
  186. package/dist/capabilities/moonshotai.json +3 -3
  187. package/dist/capabilities/morph.json +11 -11
  188. package/dist/capabilities/munito-eu.json +6 -6
  189. package/dist/capabilities/munito.json +10 -10
  190. package/dist/capabilities/nan.json +24 -24
  191. package/dist/capabilities/nano-gpt.json +583 -548
  192. package/dist/capabilities/nearai.json +82 -82
  193. package/dist/capabilities/nebius.json +33 -33
  194. package/dist/capabilities/neon.json +135 -135
  195. package/dist/capabilities/neuralwatt.json +37 -37
  196. package/dist/capabilities/nokeep.json +5 -5
  197. package/dist/capabilities/novita-ai.json +153 -153
  198. package/dist/capabilities/nvidia.json +25 -57
  199. package/dist/capabilities/oathbreaker.json +2 -2
  200. package/dist/capabilities/obscurify.json +27 -27
  201. package/dist/capabilities/oci.json +16 -7
  202. package/dist/capabilities/ofox.json +358 -358
  203. package/dist/capabilities/ollama-cloud.json +50 -50
  204. package/dist/capabilities/openai.json +79 -47
  205. package/dist/capabilities/opencode-go.json +88 -88
  206. package/dist/capabilities/openreason.json +5 -5
  207. package/dist/capabilities/openrouter.json +543 -533
  208. package/dist/capabilities/opper.json +28 -28
  209. package/dist/capabilities/orcarouter.json +238 -238
  210. package/dist/capabilities/outerlabs.json +30 -30
  211. package/dist/capabilities/ovhcloud.json +61 -7
  212. package/dist/capabilities/pareto.json +4 -4
  213. package/dist/capabilities/pendra.json +4 -4
  214. package/dist/capabilities/perplexity-agent.json +59 -59
  215. package/dist/capabilities/perplexity.json +2 -2
  216. package/dist/capabilities/phala.json +34 -34
  217. package/dist/capabilities/pioneer.json +26 -26
  218. package/dist/capabilities/poe.json +99 -99
  219. package/dist/capabilities/poolside.json +2 -2
  220. package/dist/capabilities/powerspring.json +12 -12
  221. package/dist/capabilities/primalabs.json +10 -10
  222. package/dist/capabilities/prime.json +117 -101
  223. package/dist/capabilities/privatemode-ai.json +11 -11
  224. package/dist/capabilities/proxystacks.json +6 -6
  225. package/dist/capabilities/qiniu-ai.json +13 -13
  226. package/dist/capabilities/refuseless.json +8 -8
  227. package/dist/capabilities/regolo-ai.json +11 -11
  228. package/dist/capabilities/requesty.json +171 -171
  229. package/dist/capabilities/ruapi.json +19 -19
  230. package/dist/capabilities/runcrate.json +17 -17
  231. package/dist/capabilities/runinfra.json +16 -16
  232. package/dist/capabilities/sakana.json +5 -5
  233. package/dist/capabilities/sambanova.json +6 -6
  234. package/dist/capabilities/sandbase.json +22 -22
  235. package/dist/capabilities/sarvam.json +12 -12
  236. package/dist/capabilities/scaleway.json +17 -17
  237. package/dist/capabilities/scnet-token-plan.json +14 -14
  238. package/dist/capabilities/scx-ai.json +29 -29
  239. package/dist/capabilities/sensenova.json +10 -10
  240. package/dist/capabilities/siliconflow-cn.json +58 -58
  241. package/dist/capabilities/siliconflow.json +61 -61
  242. package/dist/capabilities/snowflake-cortex.json +24 -24
  243. package/dist/capabilities/sokkan.json +9 -9
  244. package/dist/capabilities/sparrowcodes.json +18 -18
  245. package/dist/capabilities/standardcompute.json +94 -94
  246. package/dist/capabilities/steadyrouter.json +42 -42
  247. package/dist/capabilities/stepfun-ai-step-plan.json +6 -6
  248. package/dist/capabilities/stepfun-ai.json +5 -5
  249. package/dist/capabilities/stepfun-step-plan.json +5 -5
  250. package/dist/capabilities/stepfun.json +5 -5
  251. package/dist/capabilities/stepping-stone.json +20 -20
  252. package/dist/capabilities/superbot-gg.json +4 -4
  253. package/dist/capabilities/synthetic.json +12 -12
  254. package/dist/capabilities/synthorai.json +21 -21
  255. package/dist/capabilities/teamorouter.json +24 -24
  256. package/dist/capabilities/teapot-router.json +13 -13
  257. package/dist/capabilities/tencent-token-plan.json +56 -32
  258. package/dist/capabilities/tencent-tokenhub.json +43 -43
  259. package/dist/capabilities/tensorx.json +48 -48
  260. package/dist/capabilities/tenstorrent.json +2 -2
  261. package/dist/capabilities/the-grid-ai.json +33 -33
  262. package/dist/capabilities/thinkingmachines.json +78 -78
  263. package/dist/capabilities/tinfoil.json +10 -10
  264. package/dist/capabilities/toapis.json +2 -2
  265. package/dist/capabilities/togetherai.json +52 -50
  266. package/dist/capabilities/tokengo.json +19 -19
  267. package/dist/capabilities/tokenify.json +10 -10
  268. package/dist/capabilities/trustedrouter.json +5 -5
  269. package/dist/capabilities/trustedtokens.json +16 -16
  270. package/dist/capabilities/umans-ai-coding-plan.json +16 -16
  271. package/dist/capabilities/umans-ai.json +10 -10
  272. package/dist/capabilities/unrestricted.json +8 -8
  273. package/dist/capabilities/uplinkswitch.json +19 -19
  274. package/dist/capabilities/upstage.json +8 -8
  275. package/dist/capabilities/vancine.json +20 -20
  276. package/dist/capabilities/vercel.json +539 -539
  277. package/dist/capabilities/vivgrid.json +85 -85
  278. package/dist/capabilities/volcengine-coding-plan.json +36 -27
  279. package/dist/capabilities/volcengine.json +26 -26
  280. package/dist/capabilities/vultr.json +30 -30
  281. package/dist/capabilities/wafer.ai.json +19 -19
  282. package/dist/capabilities/wallaby.json +5 -5
  283. package/dist/capabilities/wally.json +8 -8
  284. package/dist/capabilities/wandb.json +19 -19
  285. package/dist/capabilities/watt.json +23 -23
  286. package/dist/capabilities/xai.json +7 -7
  287. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
  288. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
  289. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
  290. package/dist/capabilities/xiaomi.json +2 -2
  291. package/dist/capabilities/xpersona.json +12 -12
  292. package/dist/capabilities/xxapi.json +30 -30
  293. package/dist/capabilities/zai-coding-plan.json +17 -17
  294. package/dist/capabilities/zai.json +28 -26
  295. package/dist/capabilities/zenifra.json +27 -27
  296. package/dist/capabilities/zenmux.json +164 -164
  297. package/dist/capabilities/zerogpu.json +11 -11
  298. package/dist/capabilities/zhipuai-coding-plan.json +4 -4
  299. package/dist/capabilities/zhipuai.json +22 -22
  300. package/dist/capabilities/zro.json +3 -3
  301. package/dist/channels/agent-channels.d.ts +9 -1
  302. package/dist/channels/attach-file-tool.d.ts +22 -0
  303. package/dist/channels/formatting.d.ts +8 -0
  304. package/dist/channels/index.cjs +13 -2
  305. package/dist/channels/index.d.ts +11 -1
  306. package/dist/channels/index.js +3 -3
  307. package/dist/channels/reply-guidance-processor.d.ts +26 -0
  308. package/dist/channels/reply-mode.d.ts +66 -0
  309. package/dist/channels/reply-reminder-processor.d.ts +23 -0
  310. package/dist/channels/reply-tool.d.ts +43 -0
  311. package/dist/channels/thread-link-processor.d.ts +48 -0
  312. package/dist/channels/thread-lookup.d.ts +16 -0
  313. package/dist/channels/tool-announcement-processor.d.ts +29 -0
  314. package/dist/channels/types.d.ts +30 -3
  315. package/dist/{channels-D7bBM9xD.cjs → channels-Cl-pRrWB.cjs} +122 -1
  316. package/dist/{channels-DSOCNoab.js → channels-DegTNzaq.js} +99 -2
  317. package/dist/coding-agent/index.cjs +1 -1
  318. package/dist/coding-agent/index.js +1 -1
  319. package/dist/datasets/experiment/index.d.ts +1 -1
  320. package/dist/datasets/experiment/item.d.ts +4 -3
  321. package/dist/datasets/experiment/scorer.d.ts +34 -11
  322. package/dist/datasets/index.cjs +3 -2
  323. package/dist/datasets/index.js +3 -3
  324. package/dist/{dist-ByO0vuJJ-BjMue5_p.cjs → dist-CufwpBZM-CwERFaas.cjs} +4 -4
  325. package/dist/{dist-ByO0vuJJ-CCXLBnvJ.js → dist-CufwpBZM-DK14Qe0Z.js} +4 -4
  326. package/dist/docs/SKILL.md +2 -1
  327. package/dist/docs/assets/SOURCE_MAP.json +817 -817
  328. package/dist/docs/references/docs-agents-resumable-streams.md +15 -6
  329. package/dist/docs/references/docs-channels.md +43 -0
  330. package/dist/docs/references/docs-deployment-workers.md +3 -1
  331. package/dist/docs/references/docs-evals-experiments.md +13 -3
  332. package/dist/docs/references/docs-harness-background-tasks.md +4 -4
  333. package/dist/docs/references/docs-harness-durable-agents.md +39 -48
  334. package/dist/docs/references/docs-knowledge-importers.md +1 -1
  335. package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
  336. package/dist/docs/references/docs-sandbox-overview.md +1 -0
  337. package/dist/docs/references/docs-server-pubsub.md +1 -1
  338. package/dist/docs/references/docs-workflows-overview.md +67 -3
  339. package/dist/docs/references/integrations-agentic-ui-assistant-ui.md +2 -0
  340. package/dist/docs/references/integrations-frameworks-angular.md +39 -0
  341. package/dist/docs/references/integrations-frameworks-astro.md +5 -2
  342. package/dist/docs/references/integrations-frameworks-electron.md +40 -0
  343. package/dist/docs/references/integrations-frameworks-next-js.md +5 -2
  344. package/dist/docs/references/integrations-frameworks-nuxt.md +5 -2
  345. package/dist/docs/references/integrations-frameworks-sveltekit.md +5 -2
  346. package/dist/docs/references/integrations-frameworks-vite-react.md +40 -0
  347. package/dist/docs/references/integrations.md +3 -0
  348. package/dist/docs/references/reference-agent-controller-agent-controller-class.md +6 -0
  349. package/dist/docs/references/reference-agents-channels.md +1 -1
  350. package/dist/docs/references/reference-agents-durable-agent.md +5 -3
  351. package/dist/docs/references/reference-agents-generate.md +2 -0
  352. package/dist/docs/references/reference-channels-thread-link.md +67 -0
  353. package/dist/docs/references/reference-configuration.md +1 -1
  354. package/dist/docs/references/reference-core-mastra-class.md +2 -0
  355. package/dist/docs/references/reference-knowledge-knowledge-class.md +1 -1
  356. package/dist/docs/references/reference-knowledge-knowledge-tools.md +11 -5
  357. package/dist/docs/references/reference-pubsub-caching-pubsub.md +2 -2
  358. package/dist/docs/references/reference-pubsub-redis-streams.md +2 -2
  359. package/dist/docs/references/reference-pubsub-valkey-streams.md +2 -2
  360. package/dist/docs/references/reference-workers-overview.md +2 -0
  361. package/dist/docs/references/reference-workflows-workflow-methods-create-run.md +2 -0
  362. package/dist/docs/references/reference-workflows-workflow.md +2 -0
  363. package/dist/docs/references/reference-workspace-factory-sandbox.md +2 -1
  364. package/dist/docs/references/reference.md +2 -0
  365. package/dist/error/index.cjs +2 -1
  366. package/dist/error/index.d.ts +1 -1
  367. package/dist/error/index.js +2 -2
  368. package/dist/error/provider-error.d.ts +2 -1
  369. package/dist/{error-BLwEXqOK.js → error-BC9Au-22.js} +13 -1
  370. package/dist/{error-BdEvO8za.cjs → error-L1V4uUbd.cjs} +18 -0
  371. package/dist/evals/index.cjs +1 -1
  372. package/dist/evals/index.js +1 -1
  373. package/dist/evals/scoreTraces/index.cjs +1 -1
  374. package/dist/evals/scoreTraces/index.js +1 -1
  375. package/dist/events/caching-pubsub.d.ts +28 -0
  376. package/dist/events/index.cjs +4 -1
  377. package/dist/events/index.js +2 -2
  378. package/dist/events/topics.d.ts +55 -9
  379. package/dist/harness/index.cjs +1 -1
  380. package/dist/harness/index.js +1 -1
  381. package/dist/index.cjs +1 -1
  382. package/dist/index.js +1 -1
  383. package/dist/{inmemory-BDD0w8gx.js → inmemory-BK3zLwvM.js} +42 -12
  384. package/dist/{inmemory-fgR8sq-U.cjs → inmemory-Dc86VWGB.cjs} +42 -12
  385. package/dist/knowledge/changes.d.ts +17 -5
  386. package/dist/knowledge/importers/runner.d.ts +6 -0
  387. package/dist/knowledge/index.cjs +78 -16
  388. package/dist/knowledge/index.d.ts +2 -2
  389. package/dist/knowledge/index.js +78 -16
  390. package/dist/knowledge/search-snippet.d.ts +30 -0
  391. package/dist/llm/index.cjs +3 -3
  392. package/dist/llm/index.js +3 -3
  393. package/dist/llm/model/provider-types.generated.d.ts +8175 -8296
  394. package/dist/{llm-BOQR5g0t.cjs → llm-BKxlS9Kk.cjs} +3 -3
  395. package/dist/{llm-DMNEZIV9.js → llm-CMkzIFAk.js} +3 -3
  396. package/dist/loop/index.cjs +2 -2
  397. package/dist/loop/index.js +2 -2
  398. package/dist/{manager-BzNynLwT.js → manager-C-eQXmRq.js} +120 -70
  399. package/dist/{manager-CyCR9IpR.cjs → manager-CasaT35Q.cjs} +125 -69
  400. package/dist/mastra/index.cjs +1 -1
  401. package/dist/mastra/index.js +1 -1
  402. package/dist/{mastra-CqBmnzjM.js → mastra-5EEmN3Ok.js} +28 -18
  403. package/dist/{mastra-D2B01_gg.cjs → mastra-C7Tj4U8c.cjs} +28 -18
  404. package/dist/memory/index.cjs +3 -3
  405. package/dist/memory/index.js +3 -3
  406. package/dist/{message-list-Cj0Sq_JP.cjs → message-list-DfN9mWeN.cjs} +121 -121
  407. package/dist/{message-list-KRbg-TnI.js → message-list-wI71UGxk.js} +1 -1
  408. package/dist/{model-CrXDhcbw.cjs → model-9HA-W0tg.cjs} +1 -1
  409. package/dist/{model-3AeJKHLU.js → model-DCLUL-8a.js} +1 -1
  410. package/dist/{netlify-DTXLQiG1.cjs → netlify-Cq3H-A9I.cjs} +12 -12
  411. package/dist/{netlify-DUPSTzi6.js → netlify-DaWURNSU.js} +11 -11
  412. package/dist/notifications/index.cjs +1 -1
  413. package/dist/notifications/index.js +1 -1
  414. package/dist/observability/index.cjs +1 -0
  415. package/dist/observability/index.d.ts +1 -1
  416. package/dist/observability/index.js +2 -2
  417. package/dist/{output-helpers-CedRCE17.js → output-helpers-CVzhy1Y0.js} +126 -56
  418. package/dist/{output-helpers-1Zu4Vt9C.cjs → output-helpers-DgsH4aTb.cjs} +143 -55
  419. package/dist/processor-provider/index.cjs +1 -1
  420. package/dist/processor-provider/index.js +1 -1
  421. package/dist/processors/index.cjs +2 -2
  422. package/dist/processors/index.js +2 -2
  423. package/dist/processors/runner.d.ts +2 -0
  424. package/dist/{provider-registry-BeB8RQO8.js → provider-registry-DWixjFX7.js} +21915 -22166
  425. package/dist/{provider-registry-B_rC-5aL.cjs → provider-registry-a649fS5r.cjs} +21915 -22166
  426. package/dist/provider-registry.json +22772 -23030
  427. package/dist/{registry-generator-Cv6GnxLG.js → registry-generator-BYJC7p8M.js} +1 -1
  428. package/dist/{registry-generator-DbBoIOby.cjs → registry-generator-BuKC7UKd.cjs} +1 -1
  429. package/dist/{rehydrate-3f-i1Ga2.js → rehydrate-DPhmASM6.js} +2 -2
  430. package/dist/{rehydrate-BWaa2eGN.cjs → rehydrate-DR2_WAz2.cjs} +2 -2
  431. package/dist/relevance/index.cjs +2 -2
  432. package/dist/relevance/index.js +2 -2
  433. package/dist/{run-registry-Bx06ZIN_.js → run-registry-D3X7XvUL.js} +2464 -731
  434. package/dist/{run-registry-Bk6QxNE4.cjs → run-registry-oUNF6szW.cjs} +2584 -785
  435. package/dist/storage/domains/inmemory-db.d.ts +1 -0
  436. package/dist/storage/domains/knowledge/base.d.ts +5 -0
  437. package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
  438. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +10 -2
  439. package/dist/storage/domains/knowledge/pages.d.ts +30 -0
  440. package/dist/storage/index.cjs +2 -2
  441. package/dist/storage/index.js +2 -2
  442. package/dist/storage/run-fencing.d.ts +5 -0
  443. package/dist/stream/index.cjs +2 -2
  444. package/dist/stream/index.js +2 -2
  445. package/dist/{stream-BIXX67WE.cjs → stream-DQC1vpvl.cjs} +4 -4
  446. package/dist/{stream-DVy0Z-m0.js → stream-DoZ6F41o.js} +4 -4
  447. package/dist/test-utils/llm-mock.cjs +1 -1
  448. package/dist/test-utils/llm-mock.js +1 -1
  449. package/dist/tool-loop-agent/index.cjs +1 -1
  450. package/dist/tool-loop-agent/index.js +1 -1
  451. package/dist/{tool-loop-agent-PSKeNhuT.js → tool-loop-agent-C9YkvDRd.js} +4 -4
  452. package/dist/{tool-loop-agent-DDeKGwtr.cjs → tool-loop-agent-Cy4NDOMS.cjs} +4 -4
  453. package/dist/{utils-BJiQF8Pi.js → utils-9JyiKu5r.js} +1 -1
  454. package/dist/{utils-CAnUlnUm.cjs → utils-Bs2IYyOb.cjs} +1 -1
  455. package/dist/utils.cjs +1 -1
  456. package/dist/utils.js +1 -1
  457. package/dist/{validate-BAVwAgtT.js → validate-8j0phWFV.js} +1 -1
  458. package/dist/{validate-BMNxfs4Z.cjs → validate-BE3mVxVy.cjs} +1 -1
  459. package/dist/vector/index.cjs +2 -2
  460. package/dist/vector/index.js +2 -2
  461. package/dist/worker/index.cjs +1 -1
  462. package/dist/worker/index.js +1 -1
  463. package/dist/{worker-BlvJM_Hu.js → worker-BfWFqSH2.js} +2 -2
  464. package/dist/{worker-CFUKBBCF.cjs → worker-BiK1kfMa.cjs} +2 -2
  465. package/dist/{worker-CVoD3tts.js → worker-DIRdEwih.js} +2 -2
  466. package/dist/{worker-Brwa-HqM.cjs → worker-DwdgU6E9.cjs} +2 -2
  467. package/dist/{workflow-zvQGBMCM.cjs → workflow-CxQMcTbT.cjs} +4 -4
  468. package/dist/{workflow-BSLS7_vB.js → workflow-ni-keg2i.js} +4 -4
  469. package/dist/workflows/builder/index.cjs +1 -1
  470. package/dist/workflows/builder/index.js +1 -1
  471. package/dist/workflows/evented/index.cjs +1 -1
  472. package/dist/workflows/evented/index.js +1 -1
  473. package/dist/workflows/index.cjs +4 -4
  474. package/dist/workflows/index.js +4 -4
  475. package/dist/workflows/run-ownership.d.ts +74 -8
  476. package/dist/workflows/types.d.ts +16 -0
  477. package/dist/workflows/workflow.d.ts +4 -0
  478. package/package.json +5 -5
  479. package/src/llm/model/provider-types.generated.d.ts +8175 -8296
  480. /package/dist/_types/{@ai-sdk_provider-utils@4.0.66 → @ai-sdk_provider-utils@4.0.67}/dist/index.d.ts +0 -0
  481. /package/dist/_types/{@ai-sdk_provider-utils@4.0.66 → @ai-sdk_provider-utils@4.0.67}/package.json +0 -0
@@ -1,7 +1,7 @@
1
1
  import { JSONObject, ProviderV3, LanguageModelV3 } from '../../@ai-sdk_provider@3.0.19/dist/index.js';
2
2
  import { z } from 'zod/v4';
3
- import * as _ai_sdk_provider_utils from '../../@ai-sdk_provider-utils@4.0.66/dist/index.js';
4
- import { InferSchema, FetchFunction } from '../../@ai-sdk_provider-utils@4.0.66/dist/index.js';
3
+ import * as _ai_sdk_provider_utils from '../../@ai-sdk_provider-utils@4.0.67/dist/index.js';
4
+ import { InferSchema, FetchFunction } from '../../@ai-sdk_provider-utils@4.0.67/dist/index.js';
5
5
 
6
6
  declare const anthropicSafeguardResultSchema: () => z.ZodObject<{
7
7
  type: z.ZodString;
@@ -1,5 +1,5 @@
1
- import * as _ai_sdk_provider_utils from '../../@ai-sdk_provider-utils@4.0.66/dist/index.js';
2
- import { InferSchema, Resolvable, FetchFunction } from '../../@ai-sdk_provider-utils@4.0.66/dist/index.js';
1
+ import * as _ai_sdk_provider_utils from '../../@ai-sdk_provider-utils@4.0.67/dist/index.js';
2
+ import { InferSchema, Resolvable, FetchFunction } from '../../@ai-sdk_provider-utils@4.0.67/dist/index.js';
3
3
  import { z } from 'zod/v4';
4
4
  import { TranscriptionModelV3, ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3, Experimental_VideoModelV3 } from '../../@ai-sdk_provider@3.0.19/dist/index.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import * as _ai_sdk_provider from '../../@ai-sdk_provider@3.0.19/dist/index.js';
2
2
  import { JSONValue, ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '../../@ai-sdk_provider@3.0.19/dist/index.js';
3
- import * as _ai_sdk_provider_utils from '../../@ai-sdk_provider-utils@4.0.66/dist/index.js';
4
- import { InferSchema, FetchFunction } from '../../@ai-sdk_provider-utils@4.0.66/dist/index.js';
3
+ import * as _ai_sdk_provider_utils from '../../@ai-sdk_provider-utils@4.0.67/dist/index.js';
4
+ import { InferSchema, FetchFunction } from '../../@ai-sdk_provider-utils@4.0.67/dist/index.js';
5
5
 
6
6
  type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o3-mini' | 'o3-mini-2025-01-31' | 'o3' | 'o3-2025-04-16' | 'o4-mini' | 'o4-mini-2025-04-16' | 'gpt-4.1' | 'gpt-4.1-2025-04-14' | 'gpt-4.1-mini' | 'gpt-4.1-mini-2025-04-14' | 'gpt-4.1-nano' | 'gpt-4.1-nano-2025-04-14' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-audio-preview-2025-06-03' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4o-mini-audio-preview' | 'gpt-4o-mini-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini-search-preview' | 'gpt-4o-mini-search-preview-2025-03-11' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-3.5-turbo-16k' | 'gpt-5' | 'gpt-5-2025-08-07' | 'gpt-5-mini' | 'gpt-5-mini-2025-08-07' | 'gpt-5-nano' | 'gpt-5-nano-2025-08-07' | 'gpt-5-chat-latest' | 'gpt-5.1' | 'gpt-5.1-2025-11-13' | 'gpt-5.1-chat-latest' | 'gpt-5.2' | 'gpt-5.2-2025-12-11' | 'gpt-5.2-chat-latest' | 'gpt-5.2-pro' | 'gpt-5.2-pro-2025-12-11' | 'gpt-5.3-chat-latest' | 'gpt-5.4' | 'gpt-5.4-2026-03-05' | 'gpt-5.4-mini' | 'gpt-5.4-mini-2026-03-17' | 'gpt-5.4-nano' | 'gpt-5.4-nano-2026-03-17' | 'gpt-5.4-pro' | 'gpt-5.4-pro-2026-03-05' | 'gpt-5.5' | 'gpt-5.5-2026-04-23' | 'gpt-5.6' | 'gpt-5.6-luna' | 'gpt-5.6-sol' | 'gpt-5.6-terra' | 'gpt-6-astra' | 'gpt-6.1-sol' | 'gpt-6.1-terra' | 'gpt-6-luna' | 'gpt-6-sol' | (string & {});
7
7
  declare const openaiLanguageModelChatOptions: _ai_sdk_provider_utils.LazySchema<{
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("../rolldown-runtime-BrhgMLW6.cjs");
3
3
  const require_client = require("../client-bbXoVR4g.cjs");
4
- const require_message_list = require("../message-list-Cj0Sq_JP.cjs");
4
+ const require_message_list = require("../message-list-DfN9mWeN.cjs");
5
5
  const require_request_context = require("../request-context-D9RXYCy8.cjs");
6
6
  const require_dynamic_argument = require("../dynamic-argument-CUc1BBOS.cjs");
7
7
  let _a2a_js_sdk_v1 = require("@a2a-js/sdk-v1");
package/dist/a2a/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "../rolldown-runtime-tIEjjQTE.js";
2
2
  import { t as MastraA2AError } from "../client-BIxS0ecg.js";
3
- import { n as MessageList, t as convertMessages } from "../message-list-KRbg-TnI.js";
3
+ import { n as MessageList, t as convertMessages } from "../message-list-wI71UGxk.js";
4
4
  import { u as RequestContext } from "../request-context-COnZHt2-.js";
5
5
  import { n as resolveDynamicArgument } from "../dynamic-argument-BzPK3qPN.js";
6
6
  import { AgentCard, GetTaskRequest, Role, SendMessageRequest, SendMessageResponse, StreamResponse, SubscribeToTaskRequest, Task, TaskState } from "@a2a-js/sdk-v1";
@@ -43,6 +43,8 @@ export declare const DurableStepIds: {
43
43
  /** isTaskComplete evaluation step */
44
44
  readonly IS_TASK_COMPLETE: 'durable-is-task-complete';
45
45
  };
46
+ /** The loop's last step, which ends the run's spans when it succeeds. */
47
+ export declare const MAP_FINAL_OUTPUT_STEP_ID = "map-final-output";
46
48
  export declare const RECOVER_ALREADY_IN_PROGRESS_ERROR_ID = "DURABLE_AGENT_RECOVER_ALREADY_IN_PROGRESS";
47
49
  export declare const RECOVER_SNAPSHOT_NOT_FOUND_ERROR_ID = "DURABLE_AGENT_RECOVER_SNAPSHOT_NOT_FOUND";
48
50
  export declare const RECOVER_CHECKPOINT_NOT_AVAILABLE_ERROR_ID = "DURABLE_AGENT_RECOVER_CHECKPOINT_NOT_AVAILABLE";
@@ -11,6 +11,13 @@ export declare function participateInDurableExecution<T>(mastra: Mastra, event:
11
11
  export declare function stopAbandonedDurableExecution(mastra: Mastra, event: Event, published: boolean): Promise<void>;
12
12
  /** Retry only conditional cleanup after a terminal delivery released its claim before broker acknowledgement. */
13
13
  export declare function retrySettledDurableExecution(mastra: Mastra, event: Event): Promise<boolean>;
14
+ /**
15
+ * When a suspension beside the failed tool call ends the segment's spans, tell this failure and the run's own, through
16
+ * the request context they inherit. Called before the delivery passes that context on.
17
+ */
18
+ export declare function carryEndedSegment(mastra: Mastra, event: Event): Promise<void>;
19
+ /** End the MODEL_STEP of a failed iteration. Only the iteration's own event still carries it. */
20
+ export declare function endFailedIteration(mastra: Mastra, event: Event): void;
14
21
  /** Called only after the root terminal handler has persisted and published its outcome. */
15
22
  export declare function settleEventedDurableExecution(mastra: Mastra, event: Event): Promise<void>;
16
23
  //# sourceMappingURL=evented-execution.d.ts.map
@@ -262,6 +262,7 @@ export declare class DefaultAgentExecutionEngine {
262
262
  workflowInput: DurableAgenticWorkflowInput;
263
263
  finishPublishedBeforeCrash: boolean;
264
264
  originalSpansEnded: boolean;
265
+ openStepsOf: string[] | undefined;
265
266
  }>;
266
267
  loadSuspendedRequestContextValue(workflowsStore: WorkflowsStorage, runId: string, agent: {
267
268
  id: string;
@@ -190,6 +190,8 @@ export declare class ExecutionFence implements RunFenceScope {
190
190
  get claim(): DurableExecutionClaim;
191
191
  isLost(): boolean;
192
192
  get settlement(): ExecutionSettlement | undefined;
193
+ /** This process stopped coordinating the run and left its settlement to the workers. */
194
+ get detached(): boolean;
193
195
  /** An owned deadline settlement revokes writes without handing its topics to another execution. */
194
196
  ownsRunTopics(): boolean;
195
197
  /** Throw the loss error once this execution lost the run. Checks local state only. */
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_registry = require("../../run-registry-Bk6QxNE4.cjs");
2
+ const require_run_registry = require("../../run-registry-oUNF6szW.cjs");
3
3
  const require_observability = require("../../observability-B0R_D1PZ.cjs");
4
4
  // src/agent/durable/durable-agent.ts
5
5
  var DurableAgent = class extends require_run_registry.Agent {
@@ -720,6 +720,7 @@ exports.AGENT_STREAM_TOPIC = require_run_registry.AGENT_STREAM_TOPIC;
720
720
  exports.AgentControlEventTypes = require_run_registry.AgentControlEventTypes;
721
721
  exports.AgentStreamBus = require_run_registry.AgentStreamBus;
722
722
  exports.AgentStreamEventTypes = require_run_registry.AgentStreamEventTypes;
723
+ exports.DURABLE_CONTEXT_SEGMENT_KEY = require_run_registry.DURABLE_CONTEXT_SEGMENT_KEY;
723
724
  exports.DURABLE_STOP_WHEN_ERROR_ID = require_run_registry.DURABLE_STOP_WHEN_ERROR_ID;
724
725
  exports.DurableAgent = DurableAgent;
725
726
  exports.DurableAgentDefaults = require_run_registry.DurableAgentDefaults;
@@ -762,6 +763,7 @@ exports.emitFinishEvent = require_run_registry.emitFinishEvent;
762
763
  exports.emitStepFinishEvent = require_run_registry.emitStepFinishEvent;
763
764
  exports.emitStepStartEvent = require_run_registry.emitStepStartEvent;
764
765
  exports.emitSuspendedEvent = require_run_registry.emitSuspendedEvent;
766
+ exports.endFailedSegmentSpans = require_run_registry.endFailedSegmentSpans;
765
767
  exports.endRunSpansWithError = require_run_registry.endRunSpansWithError;
766
768
  exports.ensureRemoteAbortListener = require_run_registry.ensureRemoteAbortListener;
767
769
  exports.executeDurableAgentScorers = require_run_registry.executeDurableAgentScorers;
@@ -795,6 +797,7 @@ exports.resolveTool = require_run_registry.resolveTool;
795
797
  exports.runDurableFinishSideEffects = require_run_registry.runDurableFinishSideEffects;
796
798
  exports.runDurableStreamUntilIdle = require_run_registry.runDurableStreamUntilIdle;
797
799
  exports.runResumeDurableStreamUntilIdle = require_run_registry.runResumeDurableStreamUntilIdle;
800
+ exports.segmentEndedBySuspension = require_run_registry.segmentEndedBySuspension;
798
801
  exports.segmentSpanData = require_run_registry.segmentSpanData;
799
802
  exports.serializeDurableOptions = require_run_registry.serializeDurableOptions;
800
803
  exports.serializeDurableState = require_run_registry.serializeDurableState;
@@ -80,6 +80,7 @@ export { persistDurableRunInput } from './persist-run-input.js';
80
80
  export { validateModelTimeoutSettings } from '../../llm/model/model-settings.js';
81
81
  export { RunRegistry, ExtendedRunRegistry, globalRunRegistry, getRunRegistryEntry, setRunRegistryEntry, deleteRunRegistryEntry, takeRunScorerInstances, type ExtendedRunRegistryEntry, } from './run-registry.js';
82
82
  export { normalizeResumeGenerateArgs } from './utils/resume-generate-args.js';
83
+ export { DURABLE_CONTEXT_SEGMENT_KEY } from './run-registry.js';
83
84
  export { __resetExecutionFencesForTests } from './execution-fence.js';
84
85
  export { agentThreadStreamRuntime } from '../thread-stream-runtime.js';
85
86
  export { createRunAbortController, type RunAbortController } from './run-abort.js';
@@ -102,7 +103,7 @@ export type { ToolExecutionContext, ToolExecutionError } from './workflows/depre
102
103
  export { pruneAgentLoopSnapshot } from '../../loop/workflows/prune-snapshot.js';
103
104
  export { endRunSpansWithError } from './run-registry.js';
104
105
  /** @internal The span pair a resumed or recovered execution reports under, shared with external durable engines. */
105
- export { carrySegmentSpans, liveSegmentSpan, segmentSpanData, type SegmentSpanData } from './segment-spans.js';
106
+ export { carrySegmentSpans, endFailedSegmentSpans, liveSegmentSpan, segmentEndedBySuspension, segmentSpanData, type SegmentSpanData, } from './segment-spans.js';
106
107
  /** @internal Runtime instrumentation helpers. */
107
108
  export { agentLoopTermination, executionFailureTermination } from '../../loop/shared/execution-outcome.js';
108
109
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { $ as resolveDurableToolCallConcurrency, $s as publishAbortRequest, At as readRunDeadline, B as createDurableGoalStep, Ct as runDurableStreamUntilIdle, Dt as DurableStepIds, Et as DurableAgentDefaults, F as prepareForDurableExecution, Ft as pruneAgentLoopSnapshot, G as serializeDurableOptions, Gs as emitAbortEvent, H as createDurableLLMMappingStep, I as applyReservedMemoryContextKeys, J as serializeToolsMetadata, Js as emitFinishEvent, K as serializeDurableState, Ks as emitChunkEvent, L as persistDurableRunInput, Mt as getRunStreamSlot, N as Agent, Nt as getScopeStreamSlot, Ot as RUN_DEADLINE_KEY, P as normalizeResumeGenerateArgs, Pt as untilIdleHandlesBackgroundTask, Q as createDurableBackgroundTaskCheckStep, Qs as AgentStreamBus, R as detachFullStreamOnEnd, St as createDurableAgentStream, Tt as DURABLE_STOP_WHEN_ERROR_ID, U as createDurableToolCallStep, Us as __resetExecutionFencesForTests, V as createDurableIsTaskCompleteStep, W as createWorkflowInput, Ws as diffResponseMessages, Xs as emitStepStartEvent, Y as createDurableLLMExecutionStep, Ys as emitStepFinishEvent, Zs as emitSuspendedEvent, Zt as validateModelTimeoutSettings, _t as toolRequiresApproval, a as endRunSpansWithError, ac as AgentControlEventTypes, at as baseIterationStateSchema, bt as liveSegmentSpan, c as globalRunRegistry, ct as modelListEntrySchema, d as takeRunScorerInstances, dt as loadRunStoredMessages, ec as requestAcknowledgedAbort, et as buildStepRecord, ft as rebuildRunToolsFromMastra, gt as resolveTool, ht as resolveRuntimeDependencies, i as deleteRunRegistryEntry, ic as AGENT_STREAM_TOPIC, it as baseDurableAgenticInputSchema, kt as ensureRemoteAbortListener, lt as executeDurableAgentScorers, mt as resolveModel, n as RunRegistry, nc as createRunAbortController, nt as createBaseIterationStateUpdate, oc as AgentStreamEventTypes, ot as durableAgenticOutputSchema, p as agentThreadStreamRuntime, pt as resolveInternalState, q as serializeModelConfig, qs as emitErrorEvent, rc as AGENT_CONTROL_TOPIC, rt as accumulatedUsageSchema, s as getRunRegistryEntry, st as modelConfigSchema, t as ExtendedRunRegistry, tc as subscribeToAbortRequests, tt as calculateAccumulatedUsage, u as setRunRegistryEntry, ut as runDurableFinishSideEffects, wt as runResumeDurableStreamUntilIdle, xt as segmentSpanData, yt as carrySegmentSpans, z as createDurableAgenticWorkflow } from "../../run-registry-Bx06ZIN_.js";
1
+ import { $ as createDurableBackgroundTaskCheckStep, $s as emitStepFinishEvent, At as readRunDeadline, B as createDurableAgenticWorkflow, Ct as liveSegmentSpan, Dt as runResumeDurableStreamUntilIdle, Et as runDurableStreamUntilIdle, F as normalizeResumeGenerateArgs, Ft as pruneAgentLoopSnapshot, G as createWorkflowInput, H as createDurableIsTaskCompleteStep, I as prepareForDurableExecution, J as serializeModelConfig, Js as diffResponseMessages, K as serializeDurableOptions, L as applyReservedMemoryContextKeys, Mt as getRunStreamSlot, Nt as getScopeStreamSlot, Ot as RUN_DEADLINE_KEY, P as Agent, Pt as untilIdleHandlesBackgroundTask, Qs as emitFinishEvent, R as persistDurableRunInput, St as endFailedSegmentSpans, Tt as segmentSpanData, U as createDurableLLMMappingStep, V as createDurableGoalStep, W as createDurableToolCallStep, X as createDurableLLMExecutionStep, Xs as emitChunkEvent, Y as serializeToolsMetadata, Ys as emitAbortEvent, Zs as emitErrorEvent, Zt as validateModelTimeoutSettings, _t as resolveTool, a as deleteRunRegistryEntry, ac as subscribeToAbortRequests, at as baseDurableAgenticInputSchema, bt as createDurableAgentStream, c as getRunRegistryEntry, cc as DurableAgentDefaults, ct as modelConfigSchema, d as setRunRegistryEntry, dc as AGENT_STREAM_TOPIC, dt as runDurableFinishSideEffects, ec as emitStepStartEvent, et as resolveDurableToolCallConcurrency, f as takeRunScorerInstances, fc as AgentControlEventTypes, ft as loadRunStoredMessages, gt as resolveRuntimeDependencies, ht as resolveModel, ic as requestAcknowledgedAbort, it as accumulatedUsageSchema, kt as ensureRemoteAbortListener, l as globalRunRegistry, lc as DurableStepIds, lt as modelListEntrySchema, m as agentThreadStreamRuntime, mt as resolveInternalState, n as ExtendedRunRegistry, nc as AgentStreamBus, nt as calculateAccumulatedUsage, o as endRunSpansWithError, oc as createRunAbortController, ot as baseIterationStateSchema, pc as AgentStreamEventTypes, pt as rebuildRunToolsFromMastra, q as serializeDurableState, qs as __resetExecutionFencesForTests, r as RunRegistry, rc as publishAbortRequest, rt as createBaseIterationStateUpdate, sc as DURABLE_STOP_WHEN_ERROR_ID, st as durableAgenticOutputSchema, t as DURABLE_CONTEXT_SEGMENT_KEY, tc as emitSuspendedEvent, tt as buildStepRecord, uc as AGENT_CONTROL_TOPIC, ut as executeDurableAgentScorers, vt as toolRequiresApproval, wt as segmentEndedBySuspension, xt as carrySegmentSpans, z as detachFullStreamOnEnd } from "../../run-registry-D3X7XvUL.js";
2
2
  import { D as agentLoopTermination, O as executionFailureTermination } from "../../observability-D7RNOAPx.js";
3
3
  // src/agent/durable/durable-agent.ts
4
4
  var DurableAgent = class extends Agent {
@@ -714,4 +714,4 @@ async function executeDurableToolCalls(ctx) {
714
714
  }
715
715
  return toolResults;
716
716
  }
717
- export { AGENT_CONTROL_TOPIC, AGENT_STREAM_TOPIC, AgentControlEventTypes, AgentStreamBus, AgentStreamEventTypes, DURABLE_STOP_WHEN_ERROR_ID, DurableAgent, DurableAgentDefaults, DurableStepIds, EventedAgent, ExtendedRunRegistry, RUN_DEADLINE_KEY, RunRegistry, __resetExecutionFencesForTests, accumulatedUsageSchema, agentLoopTermination, agentThreadStreamRuntime, applyReservedMemoryContextKeys, baseDurableAgenticInputSchema, baseIterationStateSchema, buildStepRecord, calculateAccumulatedUsage, carrySegmentSpans, createBaseIterationStateUpdate, createDurableAgent, createDurableAgentStream, createDurableAgenticWorkflow, createDurableBackgroundTaskCheckStep, createDurableGoalStep, createDurableIsTaskCompleteStep, createDurableLLMExecutionStep, createDurableLLMMappingStep, createDurableToolCallStep, createEventedAgent, createRunAbortController, createWorkflowInput, deleteRunRegistryEntry, detachFullStreamOnEnd, diffResponseMessages, durableAgenticOutputSchema, emitAbortEvent, emitChunkEvent, emitErrorEvent, emitFinishEvent, emitStepFinishEvent, emitStepStartEvent, emitSuspendedEvent, endRunSpansWithError, ensureRemoteAbortListener, executeDurableAgentScorers, executeDurableToolCalls, executionFailureTermination, getRunRegistryEntry, getRunStreamSlot, getScopeStreamSlot, globalRunRegistry, isDurableAgent, isEventedAgent, isEventedAgentClass, isLocalDurableAgent, liveSegmentSpan, loadRunStoredMessages, modelConfigSchema, modelListEntrySchema, normalizeResumeGenerateArgs, persistDurableRunInput, prepareForDurableExecution, pruneAgentLoopSnapshot, publishAbortRequest, readRunDeadline, rebuildRunToolsFromMastra, requestAcknowledgedAbort, resolveDurableToolCallConcurrency, resolveInternalState, resolveModel, resolveRuntimeDependencies, resolveTool, runDurableFinishSideEffects, runDurableStreamUntilIdle, runResumeDurableStreamUntilIdle, segmentSpanData, serializeDurableOptions, serializeDurableState, serializeModelConfig, serializeToolsMetadata, setRunRegistryEntry, subscribeToAbortRequests, takeRunScorerInstances, toolRequiresApproval, untilIdleHandlesBackgroundTask, validateModelTimeoutSettings };
717
+ export { AGENT_CONTROL_TOPIC, AGENT_STREAM_TOPIC, AgentControlEventTypes, AgentStreamBus, AgentStreamEventTypes, DURABLE_CONTEXT_SEGMENT_KEY, DURABLE_STOP_WHEN_ERROR_ID, DurableAgent, DurableAgentDefaults, DurableStepIds, EventedAgent, ExtendedRunRegistry, RUN_DEADLINE_KEY, RunRegistry, __resetExecutionFencesForTests, accumulatedUsageSchema, agentLoopTermination, agentThreadStreamRuntime, applyReservedMemoryContextKeys, baseDurableAgenticInputSchema, baseIterationStateSchema, buildStepRecord, calculateAccumulatedUsage, carrySegmentSpans, createBaseIterationStateUpdate, createDurableAgent, createDurableAgentStream, createDurableAgenticWorkflow, createDurableBackgroundTaskCheckStep, createDurableGoalStep, createDurableIsTaskCompleteStep, createDurableLLMExecutionStep, createDurableLLMMappingStep, createDurableToolCallStep, createEventedAgent, createRunAbortController, createWorkflowInput, deleteRunRegistryEntry, detachFullStreamOnEnd, diffResponseMessages, durableAgenticOutputSchema, emitAbortEvent, emitChunkEvent, emitErrorEvent, emitFinishEvent, emitStepFinishEvent, emitStepStartEvent, emitSuspendedEvent, endFailedSegmentSpans, endRunSpansWithError, ensureRemoteAbortListener, executeDurableAgentScorers, executeDurableToolCalls, executionFailureTermination, getRunRegistryEntry, getRunStreamSlot, getScopeStreamSlot, globalRunRegistry, isDurableAgent, isEventedAgent, isEventedAgentClass, isLocalDurableAgent, liveSegmentSpan, loadRunStoredMessages, modelConfigSchema, modelListEntrySchema, normalizeResumeGenerateArgs, persistDurableRunInput, prepareForDurableExecution, pruneAgentLoopSnapshot, publishAbortRequest, readRunDeadline, rebuildRunToolsFromMastra, requestAcknowledgedAbort, resolveDurableToolCallConcurrency, resolveInternalState, resolveModel, resolveRuntimeDependencies, resolveTool, runDurableFinishSideEffects, runDurableStreamUntilIdle, runResumeDurableStreamUntilIdle, segmentEndedBySuspension, segmentSpanData, serializeDurableOptions, serializeDurableState, serializeModelConfig, serializeToolsMetadata, setRunRegistryEntry, subscribeToAbortRequests, takeRunScorerInstances, toolRequiresApproval, untilIdleHandlesBackgroundTask, validateModelTimeoutSettings };
@@ -2,6 +2,7 @@ import { TTLCache } from '@isaacs/ttlcache';
2
2
  import type { MastraScorer } from '../../evals/base.js';
3
3
  import type { MastraLanguageModel } from '../../llm/model/shared.types.js';
4
4
  import type { Mastra } from '../../mastra/index.js';
5
+ import type { RequestContext } from '../../request-context/index.js';
5
6
  import type { CoreTool } from '../../tools/types.js';
6
7
  import type { MessageList } from '../message-list/index.js';
7
8
  import type { SaveQueueManager } from '../save-queue/index.js';
@@ -42,6 +43,17 @@ export declare const globalRunRegistry: TTLCache<string, RunRegistryEntry>;
42
43
  * scoped reader, so a later instance reusing the runId cannot adopt it.
43
44
  */
44
45
  export declare function getRunRegistryEntry(runId: string, mastra: Mastra | undefined): RunRegistryEntry | undefined;
46
+ /**
47
+ * Request-context key that identifies a run segment on engines whose steps carry no Core execution
48
+ * claim (Inngest). The engine stores the same value on the registry entry it seeds for the segment.
49
+ */
50
+ export declare const DURABLE_CONTEXT_SEGMENT_KEY = "__mastra_durableContextSegment";
51
+ /**
52
+ * The registry's live request context, when it belongs to the execution running this step. Once
53
+ * another process claims the run (for example an approval from another host), the context cached
54
+ * here still belongs to the previous caller and must not be reused for the new execution.
55
+ */
56
+ export declare function getLiveRunRequestContext(entry: RunRegistryEntry | undefined, runId: string | undefined, stepContext: RequestContext | undefined, executionId?: string): RequestContext<unknown> | undefined;
45
57
  /**
46
58
  * Publish an entry for `runId`, owned by `mastra`, unless the slot holds
47
59
  * another Mastra instance's live run. Returns whether the entry was stored.
@@ -104,6 +116,7 @@ export declare function abandonDurableAgentExecutions(mastra: Mastra): Promise<v
104
116
  */
105
117
  export declare function endRunSpansWithError(runId: string, error: Error, options?: {
106
118
  endSpan?: boolean;
119
+ endStep?: boolean;
107
120
  }): void;
108
121
  /**
109
122
  * Registry for per-run non-serializable state.
@@ -1,3 +1,4 @@
1
+ import type { Mastra } from '../../mastra/index.js';
1
2
  import type { AIModelGenerationSpan, ExportedSpan, Span, SpanType } from '../../observability/index.js';
2
3
  import type { RequestContext } from '../../request-context/index.js';
3
4
  import type { RunRegistryEntry } from './types.js';
@@ -8,7 +9,9 @@ export interface SegmentSpanData {
8
9
  stepParentId?: string;
9
10
  /** Recovery: it finishes the MODEL_STEP the crashed execution left open. */
10
11
  adoptsOpenSteps?: boolean;
11
- /** Recovery: the MODEL_GENERATION a suspension ended before the crash, whose steps stay ended. */
12
+ /** Recovery: the only generations whose MODEL_STEP the crash left open, when the snapshot names them. */
13
+ openStepsOf?: string[];
14
+ /** Recovery without `openStepsOf`: the MODEL_GENERATION a suspension ended before the crash, whose steps stay ended. */
12
15
  endedStepsOf?: string;
13
16
  }
14
17
  /** The wire form of the pair a resume or recovery opened. */
@@ -33,6 +36,12 @@ export declare function segmentSpanData(requestContext: Pick<RequestContext, 'ge
33
36
  }, live?: Pick<RunRegistryEntry, 'resumeAgentSpan' | 'resumeModelSpan'>): SegmentSpanData & {
34
37
  carried: boolean;
35
38
  };
39
+ /**
40
+ * The generations whose MODEL_STEP the execution that persisted `requestContext` left open: its own
41
+ * pair's, plus those it was itself finishing after an earlier crash. Every other step was ended by
42
+ * the suspension before a resume. Undefined when that execution carried no pair.
43
+ */
44
+ export declare function openStepsOfCrashedSegment(requestContext: Record<string, unknown> | undefined, runId: string): string[] | undefined;
36
45
  /** The live span behind `data` when this process holds it, so it is ended in place; otherwise undefined. */
37
46
  export declare function liveSegmentSpan<S extends {
38
47
  id: string;
@@ -48,5 +57,49 @@ export declare function liveSegmentSpan<S extends {
48
57
  export declare function segmentOwnsStep(segment: SegmentSpanData & {
49
58
  carried?: boolean;
50
59
  }, stepSpanData: unknown): boolean;
60
+ /**
61
+ * Whether `outcome` ends the spans of the run's first segment. Behind a broker, a tool call that suspends and one
62
+ * beside it that fails the run are in different processes, and both end the same spans, so the first one to claim
63
+ * them does. Undefined when no claim can be made, and in one process only the suspension asks.
64
+ */
65
+ export declare function claimSegmentEnd({ mastra, requestContext, runId, iterationCount, outcome, }: {
66
+ mastra: Mastra | undefined;
67
+ requestContext: RequestContext<any>;
68
+ runId: string;
69
+ iterationCount: number | undefined;
70
+ outcome: 'suspend' | 'fail';
71
+ }): Promise<boolean | undefined>;
72
+ /** A MODEL_STEP the run's deadline stopped is interrupted, as on the regular agent; the run itself hit a limit. */
73
+ export declare function stepFailure<T extends {
74
+ error: Error;
75
+ }>(failure: T): T;
76
+ /**
77
+ * Whether a tool call that suspended beside the failed one already ended the spans of the segment. Only the failed
78
+ * iteration's steps show it, so the settling engine takes it to the run's own failure as a carried `null` segment.
79
+ */
80
+ export declare function segmentEndedBySuspension(segment: SegmentSpanData & {
81
+ carried?: boolean;
82
+ }, steps: Record<string, any>): boolean;
83
+ /**
84
+ * End what a failed execution left open, from the facts the run carries, where the process that settles the
85
+ * failure may hold none of the run's live spans. An iteration's failure ends its MODEL_STEP; the run's failure
86
+ * ends the MODEL_GENERATION and AGENT_RUN its segment reports under. Never throws.
87
+ */
88
+ export declare function endFailedSegmentSpans({ mastra, requestContext, runId, state, steps, error, live, firstPairOnly, }: {
89
+ mastra: Mastra | undefined;
90
+ requestContext: RequestContext<any>;
91
+ runId: string;
92
+ /** An iteration's state counts the iterations; the run's input does not. */
93
+ state: {
94
+ agentSpanData?: unknown;
95
+ modelSpanData?: unknown;
96
+ iterationCount?: number;
97
+ };
98
+ steps: Record<string, any>;
99
+ error: Error;
100
+ live?: RunRegistryEntry;
101
+ /** Leave a resumed or recovered pair to the process that opened it. */
102
+ firstPairOnly?: boolean;
103
+ }): void;
51
104
  export {};
52
105
  //# sourceMappingURL=segment-spans.d.ts.map
@@ -459,6 +459,10 @@ export interface DurableToolCallInput {
459
459
  stepSpanData?: unknown;
460
460
  /** Model usage of the step that produced this call, reported on its suspension chunk */
461
461
  stepUsage?: LanguageModelUsage;
462
+ /** Response of that step: the model that answered and the cost its provider reported */
463
+ response?: ResponseRecord;
464
+ /** Other tool calls of the step run at the same time, so a suspension of this one reports no model usage */
465
+ sideBySide?: boolean;
462
466
  }
463
467
  /**
464
468
  * Output from a single tool call step
@@ -611,6 +615,8 @@ export interface DurableAgenticExecutionOutput {
611
615
  tracingTermination?: SpanTermination;
612
616
  /** Failure behind this iteration's delegation bail, see DurableToolCallOutput */
613
617
  tracingDelegationFailure?: SpanTermination;
618
+ /** An earlier segment's suspension ended this iteration's MODEL_STEP and reported the run's usage so far */
619
+ suspensionReportedUsage?: boolean;
614
620
  }
615
621
  /**
616
622
  * Final output from the durable agentic loop workflow
@@ -751,6 +757,8 @@ export interface RegistryModelListEntry {
751
757
  * Registry entry for a single run's non-serializable state
752
758
  */
753
759
  export interface RunRegistryEntry {
760
+ /** MODEL_STEP a tool-calling iteration leaves open until its mapping step, so a failed run can end it. */
761
+ openStepSpan?: Span<SpanType.MODEL_STEP>;
754
762
  /** In-process copy of a tracing fact the iteration state carries across workers; not in the finish payload. */
755
763
  tracingTermination?: SpanTermination;
756
764
  tracingDelegationFailure?: SpanTermination;
@@ -810,6 +818,10 @@ export interface RunRegistryEntry {
810
818
  workspace?: Workspace;
811
819
  /** Request context for forwarding auth data, feature flags, etc. to tools */
812
820
  requestContext?: RequestContext;
821
+ /** The stored context was rebuilt from a workflow snapshot, not supplied by the active caller. */
822
+ requestContextRebuilt?: boolean;
823
+ /** Segment identity for engines that do not carry a Core execution claim. */
824
+ requestContextSegment?: string;
813
825
  /** MCP protocol context for in-process tool execution (non-serializable). */
814
826
  mcp?: MCPToolExecutionContext;
815
827
  /** Cleanup function to call when run completes */
@@ -6,7 +6,8 @@ import { pruneAgentLoopSnapshot } from '../../../loop/workflows/prune-snapshot.j
6
6
  import type { StepResultReads } from '../../../loop/workflows/prune-snapshot.js';
7
7
  import { createWorkflow } from '../../../workflows/create.js';
8
8
  import type { ShouldPersistSnapshotFn } from '../../../workflows/types.js';
9
- export declare const MAP_FINAL_OUTPUT_STEP_ID = "map-final-output";
9
+ import { MAP_FINAL_OUTPUT_STEP_ID } from '../constants.js';
10
+ export { MAP_FINAL_OUTPUT_STEP_ID };
10
11
  /**
11
12
  * Options for creating a durable agentic workflow
12
13
  */
@@ -207,6 +208,11 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
207
208
  response?: {
208
209
  id?: string | undefined;
209
210
  modelId?: string | undefined;
211
+ servedBy?: {
212
+ provider: string;
213
+ modelId: string;
214
+ } | undefined;
215
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
210
216
  } | undefined;
211
217
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
212
218
  }, unknown, unknown, import("../../../workflows").DefaultEngineType, unknown>;
@@ -225,6 +231,16 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
225
231
  completionStartTime?: Date | undefined;
226
232
  timeToFirstTokenMs?: number | undefined;
227
233
  stepUsage?: any;
234
+ sideBySide?: boolean | undefined;
235
+ response?: {
236
+ id?: string | undefined;
237
+ modelId?: string | undefined;
238
+ servedBy?: {
239
+ provider: string;
240
+ modelId: string;
241
+ } | undefined;
242
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
243
+ } | undefined;
228
244
  }, {
229
245
  toolCallId: string;
230
246
  toolName: string;
@@ -239,6 +255,16 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
239
255
  completionStartTime?: Date | undefined;
240
256
  timeToFirstTokenMs?: number | undefined;
241
257
  stepUsage?: any;
258
+ sideBySide?: boolean | undefined;
259
+ response?: {
260
+ id?: string | undefined;
261
+ modelId?: string | undefined;
262
+ servedBy?: {
263
+ provider: string;
264
+ modelId: string;
265
+ } | undefined;
266
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
267
+ } | undefined;
242
268
  result?: any;
243
269
  modelOutputComputed?: boolean | undefined;
244
270
  mappingError?: {
@@ -329,7 +355,13 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
329
355
  response?: {
330
356
  id?: string | undefined;
331
357
  modelId?: string | undefined;
358
+ servedBy?: {
359
+ provider: string;
360
+ modelId: string;
361
+ } | undefined;
362
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
332
363
  } | undefined;
364
+ suspensionReportedUsage?: boolean | undefined;
333
365
  }, unknown, unknown, import("../../../workflows").DefaultEngineType, unknown>;
334
366
  protected backgroundTaskCheckStep(): import("../../../workflows").Step<string, unknown, any, any, unknown, unknown, import("../../../workflows").DefaultEngineType, unknown>;
335
367
  /**
@@ -388,6 +420,8 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
388
420
  accumulatedSteps?: any[] | undefined;
389
421
  accumulatedUsage: import("./shared").AccumulatedUsage;
390
422
  usageAggregationVersion?: 1 | undefined;
423
+ generationReportedUsage?: import("./shared").AccumulatedUsage | undefined;
424
+ generationReportedSteps?: number | undefined;
391
425
  lastStepResult?: any;
392
426
  deferredStepFinishChunk?: any;
393
427
  backgroundTaskPending?: boolean | undefined;
@@ -412,7 +446,13 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
412
446
  lastResponse?: {
413
447
  id?: string | undefined;
414
448
  modelId?: string | undefined;
449
+ servedBy?: {
450
+ provider: string;
451
+ modelId: string;
452
+ } | undefined;
453
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
415
454
  } | undefined;
455
+ reportedCosts?: (import("../../../stream").ProviderMetadata | null)[] | undefined;
416
456
  tracingStopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
417
457
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
418
458
  tracingDelegationFailure?: import("../../../observability").SpanTermination | undefined;
@@ -440,6 +480,8 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
440
480
  accumulatedSteps?: any[] | undefined;
441
481
  accumulatedUsage: import("./shared").AccumulatedUsage;
442
482
  usageAggregationVersion?: 1 | undefined;
483
+ generationReportedUsage?: import("./shared").AccumulatedUsage | undefined;
484
+ generationReportedSteps?: number | undefined;
443
485
  lastStepResult?: any;
444
486
  deferredStepFinishChunk?: any;
445
487
  backgroundTaskPending?: boolean | undefined;
@@ -464,7 +506,13 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
464
506
  lastResponse?: {
465
507
  id?: string | undefined;
466
508
  modelId?: string | undefined;
509
+ servedBy?: {
510
+ provider: string;
511
+ modelId: string;
512
+ } | undefined;
513
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
467
514
  } | undefined;
515
+ reportedCosts?: (import("../../../stream").ProviderMetadata | null)[] | undefined;
468
516
  tracingStopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
469
517
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
470
518
  tracingDelegationFailure?: import("../../../observability").SpanTermination | undefined;
@@ -492,6 +540,8 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
492
540
  accumulatedSteps?: any[] | undefined;
493
541
  accumulatedUsage: import("./shared").AccumulatedUsage;
494
542
  usageAggregationVersion?: 1 | undefined;
543
+ generationReportedUsage?: import("./shared").AccumulatedUsage | undefined;
544
+ generationReportedSteps?: number | undefined;
495
545
  lastStepResult?: any;
496
546
  deferredStepFinishChunk?: any;
497
547
  backgroundTaskPending?: boolean | undefined;
@@ -516,7 +566,13 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
516
566
  lastResponse?: {
517
567
  id?: string | undefined;
518
568
  modelId?: string | undefined;
569
+ servedBy?: {
570
+ provider: string;
571
+ modelId: string;
572
+ } | undefined;
573
+ reportedCost?: import("../../../stream").ProviderMetadata | undefined;
519
574
  } | undefined;
575
+ reportedCosts?: (import("../../../stream").ProviderMetadata | null)[] | undefined;
520
576
  tracingStopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
521
577
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
522
578
  tracingDelegationFailure?: import("../../../observability").SpanTermination | undefined;
@@ -603,5 +659,4 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
603
659
  stopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
604
660
  }, unknown, 1>;
605
661
  }
606
- export {};
607
662
  //# sourceMappingURL=durable-loop-builder.d.ts.map
@@ -45,6 +45,8 @@ export interface DurableFinishSideEffectsResult {
45
45
  titleForStream?: Promise<string | undefined>;
46
46
  /** Chunks from the `structuredOutput.model` structuring pass, to publish before FINISH. */
47
47
  structuredOutputChunks?: ChunkType[];
48
+ /** The validated `structuredOutput` object, when the run asked for one. */
49
+ object?: unknown;
48
50
  /**
49
51
  * Chunks output processors wrote with `writer.custom()` in processOutputResult. Publish them
50
52
  * marked output-processed, after `structuredOutputChunks` and before the tripwire or FINISH,
@@ -85,12 +87,13 @@ export declare function deadlineMessageListState(entry: RunRegistryEntry, fallba
85
87
  * durable run. The run never reaches its finish step, so this runs over what the deadline saves
86
88
  * (see `deadlineMessageListState`), as the default loop's deadline pass does.
87
89
  */
88
- export declare function runDurableDeadlineOutputPass({ runId, initData, messageListState, cutOffText, entry, mastra, tracingContext, logger, }: {
90
+ export declare function runDurableDeadlineOutputPass({ runId, initData, messageListState, cutOffText, entry, executionId, mastra, tracingContext, logger, }: {
89
91
  runId: string;
90
92
  initData: Pick<DurableAgenticWorkflowInput, 'runId' | 'agentId' | 'agentName' | 'messageId' | 'state' | 'options' | 'requestContextEntries'>;
91
93
  messageListState: SerializedMessageListState;
92
94
  cutOffText?: string;
93
95
  entry: RunRegistryEntry;
96
+ executionId: string;
94
97
  mastra?: Mastra;
95
98
  /** The run's agent span, so the deadline pass shows in the run's trace as the finish pass does. */
96
99
  tracingContext?: TracingContext;
@@ -15,5 +15,5 @@ export type { IterationStateUpdateInput, StepRecord } from './iteration-state.js
15
15
  export { loadAccumulatedSteps, readAccumulatedSteps, storeAccumulatedSteps } from './accumulated-steps.js';
16
16
  export { buildDeferredStepFinishChunk, buildDurableStepContent, durableStopConditionSteps, expandDurableSteps, } from '../../../../_types/@internal_core@0.1.4/dist/durable/index.js';
17
17
  export { dehydrateMessageListState, dehydrateSnapshotTranscripts, hydrateMessageListState, loadRunStoredMessages, openMessageListState, readMessageListState, releaseMessageListState, storeMessageListState, } from './message-list-state.js';
18
- export { resolveDurableToolCallConcurrency } from './tool-call-concurrency.js';
18
+ export { resolveDurableToolCallConcurrency, toolCallsRunSideBySide } from './tool-call-concurrency.js';
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,7 @@
1
+ import type { ProviderMetadata } from '../../../../stream/types.js';
2
+ /**
3
+ * The part of a step's provider metadata that says what the call cost. The rest, such as search
4
+ * grounding, can be large, and the loop state that carries this is saved with the run.
5
+ */
6
+ export declare function reportedCost(metadata: ProviderMetadata | undefined): ProviderMetadata | undefined;
7
+ //# sourceMappingURL=reported-cost.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import type { SpanTermination } from '../../../../observability/types/outcome.js';
3
+ import type { ProviderMetadata } from '../../../../stream/types.js';
3
4
  export declare function isJsonSafe(value: unknown): boolean;
4
5
  /**
5
6
  * Schema for the serialized durable options carried in workflow input. These
@@ -51,11 +52,17 @@ export type AccumulatedUsage = {
51
52
  */
52
53
  export declare const accumulatedUsageSchema: z.ZodType<AccumulatedUsage>;
53
54
  /**
54
- * Provider id and serving model of one response.
55
+ * One response: the provider's id and model for it, the configured model that
56
+ * answered, and the cost the provider reported for it.
55
57
  */
56
58
  export declare const responseRecordSchema: z.ZodObject<{
57
59
  id: z.ZodOptional<z.ZodString>;
58
60
  modelId: z.ZodOptional<z.ZodString>;
61
+ servedBy: z.ZodOptional<z.ZodObject<{
62
+ provider: z.ZodString;
63
+ modelId: z.ZodString;
64
+ }, z.core.$strip>>;
65
+ reportedCost: z.ZodOptional<z.ZodCustom<ProviderMetadata, ProviderMetadata>>;
59
66
  }, z.core.$strip>;
60
67
  export type ResponseRecord = z.infer<typeof responseRecordSchema>;
61
68
  /**
@@ -134,6 +141,8 @@ export declare const baseIterationStateSchema: z.ZodObject<{
134
141
  accumulatedSteps: z.ZodOptional<z.ZodArray<z.ZodAny>>;
135
142
  accumulatedUsage: z.ZodType<AccumulatedUsage, unknown, z.core.$ZodTypeInternals<AccumulatedUsage, unknown>>;
136
143
  usageAggregationVersion: z.ZodOptional<z.ZodLiteral<1>>;
144
+ generationReportedUsage: z.ZodOptional<z.ZodType<AccumulatedUsage, unknown, z.core.$ZodTypeInternals<AccumulatedUsage, unknown>>>;
145
+ generationReportedSteps: z.ZodOptional<z.ZodNumber>;
137
146
  lastStepResult: z.ZodOptional<z.ZodAny>;
138
147
  deferredStepFinishChunk: z.ZodOptional<z.ZodAny>;
139
148
  backgroundTaskPending: z.ZodOptional<z.ZodBoolean>;
@@ -158,7 +167,13 @@ export declare const baseIterationStateSchema: z.ZodObject<{
158
167
  lastResponse: z.ZodOptional<z.ZodObject<{
159
168
  id: z.ZodOptional<z.ZodString>;
160
169
  modelId: z.ZodOptional<z.ZodString>;
170
+ servedBy: z.ZodOptional<z.ZodObject<{
171
+ provider: z.ZodString;
172
+ modelId: z.ZodString;
173
+ }, z.core.$strip>>;
174
+ reportedCost: z.ZodOptional<z.ZodCustom<ProviderMetadata, ProviderMetadata>>;
161
175
  }, z.core.$strip>>;
176
+ reportedCosts: z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodCustom<ProviderMetadata, ProviderMetadata>>>>;
162
177
  tracingStopCause: z.ZodOptional<z.ZodEnum<{
163
178
  delegation: "delegation";
164
179
  feedback_complete: "feedback_complete";
@@ -33,4 +33,10 @@ export declare function resolveDurableToolCallConcurrency({ options, toolsMetada
33
33
  toolsMetadata?: SerializableToolMetadata[];
34
34
  toolCalls?: Pick<DurableToolCallInput, 'activeTools' | 'toolName' | 'requireApproval' | 'hasSuspendSchema'>[];
35
35
  }): number;
36
+ /**
37
+ * Whether the step's tool calls run at the same time. Then more than one can suspend in the same
38
+ * execution, on workers that share no memory, so none of them can report the step's model usage
39
+ * exactly once. The run's last execution reports it instead.
40
+ */
41
+ export declare function toolCallsRunSideBySide(args: Parameters<typeof resolveDurableToolCallConcurrency>[0]): boolean;
36
42
  //# sourceMappingURL=tool-call-concurrency.d.ts.map
@@ -104,6 +104,11 @@ export declare function createDurableLLMExecutionStep(_options?: DurableLLMExecu
104
104
  response?: {
105
105
  id?: string | undefined;
106
106
  modelId?: string | undefined;
107
+ servedBy?: {
108
+ provider: string;
109
+ modelId: string;
110
+ } | undefined;
111
+ reportedCost?: import("../../../../stream").ProviderMetadata | undefined;
107
112
  } | undefined;
108
113
  tracingTermination?: SpanTermination | undefined;
109
114
  }, unknown, unknown, DefaultEngineType, unknown>;
@@ -47,6 +47,12 @@ export declare function createDurableLLMMappingStep(): import("../../../../workf
47
47
  response?: {
48
48
  id?: string | undefined;
49
49
  modelId?: string | undefined;
50
+ servedBy?: {
51
+ provider: string;
52
+ modelId: string;
53
+ } | undefined;
54
+ reportedCost?: import("../../../../stream").ProviderMetadata | undefined;
50
55
  } | undefined;
56
+ suspensionReportedUsage?: boolean | undefined;
51
57
  }, unknown, unknown, import("../../../../workflows").DefaultEngineType, unknown>;
52
58
  //# sourceMappingURL=llm-mapping.d.ts.map