@mastra/core 1.86.0-alpha.6 → 1.86.0-alpha.8

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 (509) hide show
  1. package/dist/_types/@internal_core@0.1.4/dist/memory/index.d.ts +25 -0
  2. package/dist/agent/agent.d.ts +87 -12
  3. package/dist/agent/agent.types.d.ts +34 -2
  4. package/dist/agent/durable/create-durable-agent.d.ts +1 -1
  5. package/dist/agent/durable/create-evented-agent.d.ts +6 -0
  6. package/dist/agent/durable/durable-agent.d.ts +30 -514
  7. package/dist/agent/durable/durable-stream-until-idle.d.ts +2 -1
  8. package/dist/agent/durable/evented-agent.d.ts +2 -5
  9. package/dist/agent/durable/execution-engine.d.ts +20 -3
  10. package/dist/agent/durable/index.cjs +61 -6351
  11. package/dist/agent/durable/index.d.ts +3 -2
  12. package/dist/agent/durable/index.js +50 -6340
  13. package/dist/agent/durable/stream-adapter.d.ts +5 -5
  14. package/dist/agent/durable/types.d.ts +454 -3
  15. package/dist/agent/durable/workflows/durable-loop-builder.d.ts +7 -9
  16. package/dist/agent/helpers.d.ts +1 -1
  17. package/dist/agent/index.cjs +4 -4
  18. package/dist/agent/index.d.ts +1 -1
  19. package/dist/agent/index.js +4 -4
  20. package/dist/agent/streams/execution-capability.d.ts +3 -2
  21. package/dist/agent/streams/execution-policy.d.ts +1 -1
  22. package/dist/agent/streams/types.d.ts +3 -3
  23. package/dist/agent/types.d.ts +30 -5
  24. package/dist/agent-builder/ee/index.cjs +1 -1
  25. package/dist/agent-builder/ee/index.js +1 -1
  26. package/dist/agent-controller/index.cjs +2 -2
  27. package/dist/agent-controller/index.js +2 -2
  28. package/dist/{agent-controller-c4KbZ8DY.js → agent-controller-B7POPub5.js} +9 -9
  29. package/dist/{agent-controller-6ORqG6hK.cjs → agent-controller-DEPayioq.cjs} +9 -9
  30. package/dist/{agent-skills-resolver-BIeWsb01.cjs → agent-skills-resolver-BMoCDoaK.cjs} +1 -1
  31. package/dist/{agent-skills-resolver-k04IRam7.js → agent-skills-resolver-CUEIMDbx.js} +1 -1
  32. package/dist/background-tasks/index.cjs +1 -1
  33. package/dist/background-tasks/index.js +1 -1
  34. package/dist/{background-tasks-Da0c3R-J.cjs → background-tasks-7iftnRK_.cjs} +1 -1
  35. package/dist/{background-tasks-CEglmAt7.js → background-tasks-Cv1ecD6S.js} +1 -1
  36. package/dist/browser/index.cjs +2 -2
  37. package/dist/browser/index.js +2 -2
  38. package/dist/{builder-DS826dWf.cjs → builder-DuJBbQDH.cjs} +3 -3
  39. package/dist/{builder-0V9N8S15.js → builder-Gg-xnX_E.js} +3 -3
  40. package/dist/capabilities/302ai.json +198 -198
  41. package/dist/capabilities/abliteratedllm.json +38 -38
  42. package/dist/capabilities/abliteration-ai.json +6 -6
  43. package/dist/capabilities/above.json +23 -23
  44. package/dist/capabilities/adaption.json +14 -14
  45. package/dist/capabilities/adzuki.json +22 -22
  46. package/dist/capabilities/agentrouter.json +7 -7
  47. package/dist/capabilities/agnes.json +2 -2
  48. package/dist/capabilities/ai-router.json +5 -5
  49. package/dist/capabilities/aiand.json +23 -23
  50. package/dist/capabilities/aigrow.json +15 -15
  51. package/dist/capabilities/aimlapi.json +143 -143
  52. package/dist/capabilities/aipg.json +2 -2
  53. package/dist/capabilities/aixy.json +16 -16
  54. package/dist/capabilities/aki-io.json +12 -12
  55. package/dist/capabilities/alibaba-cn.json +84 -84
  56. package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
  57. package/dist/capabilities/alibaba-coding-plan.json +5 -5
  58. package/dist/capabilities/alibaba-token-plan-cn.json +51 -51
  59. package/dist/capabilities/alibaba-token-plan.json +52 -52
  60. package/dist/capabilities/alibaba.json +69 -69
  61. package/dist/capabilities/ambient.json +12 -12
  62. package/dist/capabilities/amd.json +10 -10
  63. package/dist/capabilities/anthropic.json +64 -40
  64. package/dist/capabilities/anyapi.json +12 -12
  65. package/dist/capabilities/apiko.json +5 -5
  66. package/dist/capabilities/arcee.json +7 -7
  67. package/dist/capabilities/augure.json +8 -8
  68. package/dist/capabilities/auriko.json +21 -21
  69. package/dist/capabilities/bailing.json +2 -2
  70. package/dist/capabilities/baseten.json +26 -26
  71. package/dist/capabilities/bee.json +4 -4
  72. package/dist/capabilities/berget.json +4 -4
  73. package/dist/capabilities/bothub.json +17 -17
  74. package/dist/capabilities/boundless.json +41 -41
  75. package/dist/capabilities/bumo.json +43 -43
  76. package/dist/capabilities/byteplus.json +31 -31
  77. package/dist/capabilities/cerebras.json +4 -4
  78. package/dist/capabilities/cheapaimodel.json +6 -6
  79. package/dist/capabilities/cheapest-token.json +32 -32
  80. package/dist/capabilities/chutes.json +10 -10
  81. package/dist/capabilities/cline-pass.json +43 -43
  82. package/dist/capabilities/cloudcode.json +8 -8
  83. package/dist/capabilities/cloudferro-sherlock.json +4 -4
  84. package/dist/capabilities/cloudflare-workers-ai.json +31 -31
  85. package/dist/capabilities/commandcode.json +151 -151
  86. package/dist/capabilities/concentrate.json +287 -263
  87. package/dist/capabilities/cortecs.json +106 -106
  88. package/dist/capabilities/crossmodel.json +189 -189
  89. package/dist/capabilities/crusoe.json +3 -3
  90. package/dist/capabilities/daoxe.json +9 -9
  91. package/dist/capabilities/databricks.json +62 -62
  92. package/dist/capabilities/deepinfra.json +97 -88
  93. package/dist/capabilities/deepseek.json +3 -3
  94. package/dist/capabilities/digitalocean.json +114 -114
  95. package/dist/capabilities/dothoosh.json +36 -36
  96. package/dist/capabilities/doubleword.json +29 -29
  97. package/dist/capabilities/edenai.json +443 -442
  98. package/dist/capabilities/empiriolabs.json +172 -172
  99. package/dist/capabilities/engy.json +20 -20
  100. package/dist/capabilities/entrim.json +8 -8
  101. package/dist/capabilities/evroc.json +15 -15
  102. package/dist/capabilities/ezkielyna.json +7 -7
  103. package/dist/capabilities/fastrouter.json +82 -82
  104. package/dist/capabilities/fireworks-ai.json +50 -50
  105. package/dist/capabilities/freemodel.json +24 -24
  106. package/dist/capabilities/friendli.json +6 -6
  107. package/dist/capabilities/frogbot.json +98 -98
  108. package/dist/capabilities/gisoo.json +20 -20
  109. package/dist/capabilities/gmicloud.json +14 -14
  110. package/dist/capabilities/google.json +60 -60
  111. package/dist/capabilities/graphn.json +12 -12
  112. package/dist/capabilities/greenpt.json +33 -33
  113. package/dist/capabilities/groq.json +9 -9
  114. package/dist/capabilities/helicone.json +81 -81
  115. package/dist/capabilities/hopper.json +2 -2
  116. package/dist/capabilities/hostinger-router.json +12 -12
  117. package/dist/capabilities/hpc-ai.json +10 -10
  118. package/dist/capabilities/huawei-maas.json +15 -15
  119. package/dist/capabilities/hubris.json +27 -27
  120. package/dist/capabilities/huggingface.json +59 -50
  121. package/dist/capabilities/humain.json +2 -2
  122. package/dist/capabilities/hyper.json +25 -25
  123. package/dist/capabilities/impossibl.json +140 -140
  124. package/dist/capabilities/inception.json +2 -2
  125. package/dist/capabilities/inceptron.json +8 -8
  126. package/dist/capabilities/inco.json +4 -4
  127. package/dist/capabilities/infer.json +14 -14
  128. package/dist/capabilities/inferall.json +7 -7
  129. package/dist/capabilities/inference-coop.json +15 -15
  130. package/dist/capabilities/inferenceapis.json +18 -18
  131. package/dist/capabilities/inferris.json +4 -4
  132. package/dist/capabilities/infersia.json +13 -13
  133. package/dist/capabilities/infomaniak.json +2 -2
  134. package/dist/capabilities/io-net.json +5 -5
  135. package/dist/capabilities/isoquant.json +4 -4
  136. package/dist/capabilities/iteracompute.json +54 -54
  137. package/dist/capabilities/jalapeno.json +12 -12
  138. package/dist/capabilities/jiekou.json +63 -63
  139. package/dist/capabilities/joingonka.json +4 -4
  140. package/dist/capabilities/jzstoken.json +56 -56
  141. package/dist/capabilities/keln.json +27 -27
  142. package/dist/capabilities/kenari.json +117 -111
  143. package/dist/capabilities/kilo.json +625 -649
  144. package/dist/capabilities/kimi-code-plan-cn.json +6 -6
  145. package/dist/capabilities/kimi-code-plan-global.json +6 -6
  146. package/dist/capabilities/kitani.json +6 -6
  147. package/dist/capabilities/klavo.json +21 -21
  148. package/dist/capabilities/korouter.json +33 -33
  149. package/dist/capabilities/kunavo.json +9 -9
  150. package/dist/capabilities/liquid.json +8 -8
  151. package/dist/capabilities/lithosai.json +3 -3
  152. package/dist/capabilities/llmgateway-providers.json +932 -905
  153. package/dist/capabilities/llmgateway.json +343 -343
  154. package/dist/capabilities/llmtr.json +25 -25
  155. package/dist/capabilities/longcat.json +2 -2
  156. package/dist/capabilities/lowrouter.json +48 -48
  157. package/dist/capabilities/lyceum.json +13 -13
  158. package/dist/capabilities/melious.json +13 -13
  159. package/dist/capabilities/merge-gateway.json +294 -294
  160. package/dist/capabilities/meta.json +10 -10
  161. package/dist/capabilities/minimax-cn-coding-plan.json +6 -6
  162. package/dist/capabilities/minimax-coding-plan.json +6 -6
  163. package/dist/capabilities/mistral.json +20 -20
  164. package/dist/capabilities/mixlayer.json +3 -3
  165. package/dist/capabilities/modal.json +14 -14
  166. package/dist/capabilities/model-oracle-ai.json +19 -19
  167. package/dist/capabilities/modelis.json +19 -19
  168. package/dist/capabilities/modular.json +5 -5
  169. package/dist/capabilities/moneo.json +17 -17
  170. package/dist/capabilities/moonshotai-cn.json +5 -5
  171. package/dist/capabilities/moonshotai.json +5 -5
  172. package/dist/capabilities/morph.json +14 -14
  173. package/dist/capabilities/munito-eu.json +8 -8
  174. package/dist/capabilities/munito.json +10 -10
  175. package/dist/capabilities/nan.json +28 -28
  176. package/dist/capabilities/nano-gpt.json +597 -567
  177. package/dist/capabilities/nearai.json +89 -89
  178. package/dist/capabilities/nebius.json +40 -31
  179. package/dist/capabilities/neon.json +135 -135
  180. package/dist/capabilities/neuralwatt.json +39 -39
  181. package/dist/capabilities/nokeep.json +2 -2
  182. package/dist/capabilities/novita-ai.json +158 -158
  183. package/dist/capabilities/nvidia.json +35 -35
  184. package/dist/capabilities/oathbreaker.json +2 -2
  185. package/dist/capabilities/obscurify.json +26 -26
  186. package/dist/capabilities/oci.json +6 -6
  187. package/dist/capabilities/ofox.json +352 -352
  188. package/dist/capabilities/ollama-cloud.json +52 -52
  189. package/dist/capabilities/openai.json +49 -56
  190. package/dist/capabilities/opencode-go.json +82 -81
  191. package/dist/capabilities/openreason.json +5 -5
  192. package/dist/capabilities/openrouter.json +557 -567
  193. package/dist/capabilities/opper.json +28 -22
  194. package/dist/capabilities/orcarouter.json +230 -230
  195. package/dist/capabilities/outerlabs.json +33 -33
  196. package/dist/capabilities/ovhcloud.json +6 -6
  197. package/dist/capabilities/pareto.json +6 -6
  198. package/dist/capabilities/perplexity-agent.json +58 -58
  199. package/dist/capabilities/perplexity.json +2 -2
  200. package/dist/capabilities/phala.json +22 -22
  201. package/dist/capabilities/pioneer.json +30 -30
  202. package/dist/capabilities/poe.json +122 -122
  203. package/dist/capabilities/poolside.json +3 -3
  204. package/dist/capabilities/powerspring.json +10 -10
  205. package/dist/capabilities/primalabs.json +8 -8
  206. package/dist/capabilities/prime.json +114 -97
  207. package/dist/capabilities/privatemode-ai.json +11 -11
  208. package/dist/capabilities/proxystacks.json +7 -7
  209. package/dist/capabilities/qiniu-ai.json +13 -13
  210. package/dist/capabilities/refuseless.json +7 -7
  211. package/dist/capabilities/regolo-ai.json +6 -6
  212. package/dist/capabilities/requesty.json +172 -189
  213. package/dist/capabilities/ruapi.json +18 -18
  214. package/dist/capabilities/runcrate.json +17 -17
  215. package/dist/capabilities/runinfra.json +16 -16
  216. package/dist/capabilities/sakana.json +6 -6
  217. package/dist/capabilities/sambanova.json +4 -4
  218. package/dist/capabilities/sandbase.json +24 -24
  219. package/dist/capabilities/sarvam.json +12 -12
  220. package/dist/capabilities/scaleway.json +19 -19
  221. package/dist/capabilities/scnet-token-plan.json +10 -10
  222. package/dist/capabilities/scx-ai.json +23 -23
  223. package/dist/capabilities/sensenova.json +14 -14
  224. package/dist/capabilities/siliconflow-cn.json +64 -64
  225. package/dist/capabilities/siliconflow.json +63 -63
  226. package/dist/capabilities/snowflake-cortex.json +23 -23
  227. package/dist/capabilities/sokkan.json +12 -12
  228. package/dist/capabilities/sparrowcodes.json +23 -23
  229. package/dist/capabilities/standardcompute.json +83 -83
  230. package/dist/capabilities/steadyrouter.json +39 -39
  231. package/dist/capabilities/stepfun-ai-step-plan.json +5 -5
  232. package/dist/capabilities/stepfun-ai.json +5 -5
  233. package/dist/capabilities/stepfun-step-plan.json +5 -5
  234. package/dist/capabilities/stepfun.json +5 -5
  235. package/dist/capabilities/stepping-stone.json +16 -16
  236. package/dist/capabilities/superbot-gg.json +4 -4
  237. package/dist/capabilities/synthetic.json +14 -14
  238. package/dist/capabilities/synthorai.json +29 -29
  239. package/dist/capabilities/teamorouter.json +26 -26
  240. package/dist/capabilities/teapot-router.json +13 -13
  241. package/dist/capabilities/tencent-coding-plan.json +2 -2
  242. package/dist/capabilities/tencent-token-plan.json +30 -30
  243. package/dist/capabilities/tencent-tokenhub.json +8 -8
  244. package/dist/capabilities/tensorx.json +45 -45
  245. package/dist/capabilities/tenstorrent.json +8 -8
  246. package/dist/capabilities/the-grid-ai.json +35 -35
  247. package/dist/capabilities/thinkingmachines.json +59 -59
  248. package/dist/capabilities/tinfoil.json +5 -5
  249. package/dist/capabilities/toapis.json +2 -2
  250. package/dist/capabilities/togetherai.json +59 -59
  251. package/dist/capabilities/tokengo.json +24 -24
  252. package/dist/capabilities/tokenify.json +9 -9
  253. package/dist/capabilities/trustedrouter.json +5 -5
  254. package/dist/capabilities/trustedtokens.json +18 -18
  255. package/dist/capabilities/umans-ai-coding-plan.json +18 -18
  256. package/dist/capabilities/umans-ai.json +15 -15
  257. package/dist/capabilities/uncensuredai.json +4 -4
  258. package/dist/capabilities/unrestricted.json +4 -4
  259. package/dist/capabilities/uplinkswitch.json +21 -21
  260. package/dist/capabilities/upstage.json +7 -7
  261. package/dist/capabilities/vancine.json +20 -20
  262. package/dist/capabilities/vercel.json +568 -576
  263. package/dist/capabilities/vivgrid.json +78 -78
  264. package/dist/capabilities/volcengine-coding-plan.json +30 -30
  265. package/dist/capabilities/volcengine.json +35 -35
  266. package/dist/capabilities/vultr.json +27 -27
  267. package/dist/capabilities/wafer.ai.json +16 -16
  268. package/dist/capabilities/wallaby.json +5 -5
  269. package/dist/capabilities/wally.json +11 -11
  270. package/dist/capabilities/wandb.json +21 -21
  271. package/dist/capabilities/watt.json +26 -26
  272. package/dist/capabilities/xai.json +7 -7
  273. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
  274. package/dist/capabilities/xiaomi-token-plan-cn.json +3 -3
  275. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
  276. package/dist/capabilities/xiaomi.json +6 -6
  277. package/dist/capabilities/xpersona.json +12 -12
  278. package/dist/capabilities/xxapi.json +31 -31
  279. package/dist/capabilities/zai-coding-plan.json +13 -13
  280. package/dist/capabilities/zai.json +27 -27
  281. package/dist/capabilities/zenifra.json +27 -27
  282. package/dist/capabilities/zenmux.json +195 -195
  283. package/dist/capabilities/zerogpu.json +12 -12
  284. package/dist/capabilities/zhipuai-coding-plan.json +8 -8
  285. package/dist/capabilities/zhipuai.json +27 -27
  286. package/dist/capabilities/zro.json +6 -6
  287. package/dist/channels/agent-channels.d.ts +11 -0
  288. package/dist/channels/chat-tools.d.ts +156 -0
  289. package/dist/channels/index.cjs +7 -2
  290. package/dist/channels/index.d.ts +2 -0
  291. package/dist/channels/index.js +3 -3
  292. package/dist/{channels-C5DxhFRc.js → channels-BRVCOutx.js} +1 -1
  293. package/dist/{channels-B57qQolh.cjs → channels-MjTA9bFp.cjs} +1 -1
  294. package/dist/coding-agent/index.cjs +4 -4
  295. package/dist/coding-agent/index.js +4 -4
  296. package/dist/{constants-DaBkXs5H.cjs → constants-B9ZDvXZ4.cjs} +41 -0
  297. package/dist/{constants-BDHIyN28.js → constants-BmdTvEYN.js} +30 -1
  298. package/dist/datasets/dataset.d.ts +13 -6
  299. package/dist/datasets/experiment/durable.d.ts +16 -0
  300. package/dist/datasets/experiment/index.d.ts +2 -1
  301. package/dist/datasets/experiment/item.d.ts +26 -4
  302. package/dist/datasets/experiment/retries.d.ts +18 -0
  303. package/dist/datasets/experiment/types.d.ts +18 -0
  304. package/dist/datasets/experiment/workflow-id.d.ts +7 -0
  305. package/dist/datasets/experiment/workflow.d.ts +74 -0
  306. package/dist/datasets/index.cjs +3 -2
  307. package/dist/datasets/index.d.ts +2 -1
  308. package/dist/datasets/index.js +3 -3
  309. package/dist/docs/SKILL.md +2 -2
  310. package/dist/docs/assets/SOURCE_MAP.json +1309 -1304
  311. package/dist/docs/references/docs-deployment-workers.md +1 -1
  312. package/dist/docs/references/docs-evals-experiments.md +29 -1
  313. package/dist/docs/references/docs-harness-durable-agents.md +9 -5
  314. package/dist/docs/references/docs-knowledge-agents-and-tools.md +1 -0
  315. package/dist/docs/references/docs-knowledge-load-your-content.md +1 -1
  316. package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
  317. package/dist/docs/references/docs-server-pubsub.md +51 -8
  318. package/dist/docs/references/docs-signals-running-across-processes.md +2 -0
  319. package/dist/docs/references/docs-workflows-overview.md +1 -1
  320. package/dist/docs/references/docs-workflows-scheduled-workflows.md +1 -1
  321. package/dist/docs/references/integrations-channels-slack.md +4 -2
  322. package/dist/docs/references/integrations.md +6 -0
  323. package/dist/docs/references/reference-agents-agent.md +3 -1
  324. package/dist/docs/references/reference-agents-channels.md +146 -24
  325. package/dist/docs/references/reference-agents-durable-agent.md +28 -2
  326. package/dist/docs/references/reference-datasets-runExperimentItem.md +13 -1
  327. package/dist/docs/references/reference-datasets-startExperimentAsync.md +3 -1
  328. package/dist/docs/references/reference-editor-mastra-editor.md +3 -1
  329. package/dist/docs/references/reference-knowledge-knowledge-class.md +2 -2
  330. package/dist/docs/references/reference-knowledge-knowledge-tools.md +43 -20
  331. package/dist/docs/references/reference-processors-moderation-processor.md +2 -2
  332. package/dist/docs/references/reference-pubsub-base.md +5 -1
  333. package/dist/docs/references/reference-pubsub-event-emitter.md +2 -0
  334. package/dist/docs/references/reference-pubsub-redis-streams.md +1 -1
  335. package/dist/docs/references/reference-pubsub-unix-socket-pubsub.md +2 -0
  336. package/dist/docs/references/reference-streaming-ChunkType.md +1 -1
  337. package/dist/docs/references/reference-workers-overview.md +1 -1
  338. package/dist/docs/references/reference-workflows-run-methods-start.md +23 -0
  339. package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +4 -0
  340. package/dist/docs/references/reference-workflows-run.md +1 -1
  341. package/dist/evals/index.cjs +2 -2
  342. package/dist/evals/index.js +2 -2
  343. package/dist/evals/scoreTraces/index.cjs +2 -2
  344. package/dist/evals/scoreTraces/index.js +2 -2
  345. package/dist/events/caching-pubsub.d.ts +1 -0
  346. package/dist/events/event-emitter/index.d.ts +12 -5
  347. package/dist/events/index.cjs +15 -1
  348. package/dist/events/index.js +15 -1
  349. package/dist/events/pubsub.d.ts +29 -0
  350. package/dist/events/reach.d.ts +11 -0
  351. package/dist/events/unix-socket-pubsub.d.ts +14 -0
  352. package/dist/{filesystem-CUj0vclS.cjs → filesystem-B0AZrbj8.cjs} +1 -1
  353. package/dist/{filesystem-BBqrAmKK.js → filesystem-B3s0WRud.js} +1 -1
  354. package/dist/{filesystem-B_HACoLS.js → filesystem-B5X-5G0x.js} +1 -1
  355. package/dist/{filesystem-pZNvxjuW.cjs → filesystem-BDSpwBke.cjs} +1 -1
  356. package/dist/{filesystem-5Z777gYZ.js → filesystem-BsdkC311.js} +1 -1
  357. package/dist/{filesystem-BNHPgtjJ.cjs → filesystem-C-cyJfi1.cjs} +1 -1
  358. package/dist/{filesystem-U5o28b5w.cjs → filesystem-CEbD_77-.cjs} +1 -1
  359. package/dist/{filesystem-yHKEz2Pr.cjs → filesystem-CUAgLugE.cjs} +1 -1
  360. package/dist/{filesystem-Cb8iTPM-.js → filesystem-Cv79mHRk.js} +1 -1
  361. package/dist/{filesystem-DhiaddZe.cjs → filesystem-DsCQiBl2.cjs} +1 -1
  362. package/dist/{filesystem-DSYDB3ek.js → filesystem-DzM9pcQ8.js} +1 -1
  363. package/dist/{filesystem-gpIfFMed.js → filesystem-DzfqVTO_.js} +1 -1
  364. package/dist/{filesystem-versioned-CxbiSJF-.js → filesystem-versioned-Bijb_p9l.js} +44 -44
  365. package/dist/harness/index.cjs +2 -2
  366. package/dist/harness/index.js +2 -2
  367. package/dist/index.cjs +1 -1
  368. package/dist/index.js +1 -1
  369. package/dist/knowledge/index.cjs +1 -1
  370. package/dist/knowledge/index.js +1 -1
  371. package/dist/llm/index.cjs +3 -3
  372. package/dist/llm/index.js +3 -3
  373. package/dist/llm/model/provider-types.generated.d.ts +7720 -7720
  374. package/dist/llm/model/shared.types.d.ts +31 -0
  375. package/dist/{llm-B0VtQDgT.js → llm-Djd8Qzi0.js} +2 -2
  376. package/dist/{llm-ByskI6z3.cjs → llm-DmUucguC.cjs} +2 -2
  377. package/dist/loop/base-loop-builder.d.ts +60 -0
  378. package/dist/loop/index.cjs +2 -2
  379. package/dist/loop/index.js +2 -2
  380. package/dist/loop/loop-builder.d.ts +10 -32
  381. package/dist/loop/workflows/agentic-execution/index.d.ts +1 -1
  382. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +2 -2
  383. package/dist/loop/workflows/agentic-loop/index.d.ts +1 -1
  384. package/dist/{manager-C2RGNH68.js → manager-CO_Xz2zR.js} +461 -95
  385. package/dist/{manager-BJKx4lQf.cjs → manager-D27PkIPo.cjs} +477 -93
  386. package/dist/mastra/index.cjs +1 -1
  387. package/dist/mastra/index.d.ts +13 -0
  388. package/dist/mastra/index.js +1 -1
  389. package/dist/{mastra-zUTq9ilk.js → mastra-Ch00nEAJ.js} +66 -25
  390. package/dist/{mastra-FXCeC5rF.cjs → mastra-qsVWpOTi.cjs} +66 -25
  391. package/dist/memory/index.cjs +2 -2
  392. package/dist/memory/index.js +2 -2
  393. package/dist/{model-BTNRPDgQ.js → model-CW-mfGYA.js} +1 -1
  394. package/dist/{model-BmTFNo62.cjs → model-Do6DTJoj.cjs} +1 -1
  395. package/dist/{netlify-B_XdjYPY.cjs → netlify-DU32SDT6.cjs} +1 -1
  396. package/dist/{netlify-BCSVhO5q.js → netlify-DZSAbdve.js} +1 -1
  397. package/dist/notifications/index.cjs +1 -1
  398. package/dist/notifications/index.js +1 -1
  399. package/dist/{output-helpers-CncZ3y-g.cjs → output-helpers-1Zu4Vt9C.cjs} +112 -69
  400. package/dist/{output-helpers-RlvE2WPA.js → output-helpers-CedRCE17.js} +113 -70
  401. package/dist/processor-provider/index.cjs +1 -1
  402. package/dist/processor-provider/index.js +1 -1
  403. package/dist/processors/index.cjs +2 -2
  404. package/dist/processors/index.js +2 -2
  405. package/dist/processors/processors/pii-detector.d.ts +1 -0
  406. package/dist/{provider-registry-Ble43Wb4.js → provider-registry-deA0x-Gd.js} +21349 -21338
  407. package/dist/{provider-registry-D8O1G18A.cjs → provider-registry-zGezZVsL.cjs} +21349 -21338
  408. package/dist/provider-registry.json +21695 -21680
  409. package/dist/{registry-generator-BQ1noftK.cjs → registry-generator-BkQ1AxZn.cjs} +1 -1
  410. package/dist/{registry-generator-D1Zslex6.js → registry-generator-VvBfOKAD.js} +1 -1
  411. package/dist/{rehydrate-CgxEur9m.js → rehydrate-BjLV643n.js} +2 -2
  412. package/dist/{rehydrate-BiA_HUJH.cjs → rehydrate-DDYFpQsV.cjs} +2 -2
  413. package/dist/relevance/index.cjs +2 -2
  414. package/dist/relevance/index.js +2 -2
  415. package/dist/{run-registry-aomba2_Z.cjs → run-registry-5Suldxz3.cjs} +83965 -77543
  416. package/dist/{run-registry-BUFmc_78.js → run-registry-CGRPldLH.js} +84057 -77017
  417. package/dist/{scheduler-BuivoTeD.js → scheduler-B-VZUvv_.js} +1 -1
  418. package/dist/{scheduler-COSuIH7R.cjs → scheduler-D00X03jQ.cjs} +1 -1
  419. package/dist/schedules/index.cjs +1 -1
  420. package/dist/schedules/index.js +1 -1
  421. package/dist/{schedules-Dmu9qOgc.js → schedules-DZfSx-7P.js} +94 -94
  422. package/dist/{signal-provider-CicwpNwY.cjs → signal-provider-BFAvh_AJ.cjs} +1 -1
  423. package/dist/{signal-provider-BOtSN-_0.js → signal-provider-BslnAjWG.js} +1 -1
  424. package/dist/signals/index.cjs +3 -3
  425. package/dist/signals/index.js +3 -3
  426. package/dist/{signals-6EBDPHQX.cjs → signals-B1JSj-Ew.cjs} +2 -2
  427. package/dist/{signals-BH__LS8Y.js → signals-De9VnwL2.js} +2 -2
  428. package/dist/skills/index.cjs +2 -2
  429. package/dist/skills/index.js +2 -2
  430. package/dist/{source-8qxr6KJv.cjs → source-DDwx-87N.cjs} +1 -1
  431. package/dist/{source-DRqDgbCv.js → source-Did_2XQc.js} +1 -1
  432. package/dist/{state-processor-BRk8t1OR.js → state-processor-B9kxpM53.js} +140 -140
  433. package/dist/{state-processor-Bfs9LkY8.cjs → state-processor-kRNZ38Nf.cjs} +139 -139
  434. package/dist/storage/constants.cjs +1 -1
  435. package/dist/storage/constants.js +1 -1
  436. package/dist/storage/domains/agents/index.cjs +1 -1
  437. package/dist/storage/domains/agents/index.js +1 -1
  438. package/dist/storage/domains/knowledge/base.d.ts +5 -0
  439. package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
  440. package/dist/storage/domains/knowledge/pages.d.ts +24 -7
  441. package/dist/storage/domains/mcp-clients/index.cjs +1 -1
  442. package/dist/storage/domains/mcp-clients/index.js +1 -1
  443. package/dist/storage/domains/mcp-servers/index.cjs +1 -1
  444. package/dist/storage/domains/mcp-servers/index.js +1 -1
  445. package/dist/storage/domains/memory/base.d.ts +3 -1
  446. package/dist/storage/domains/memory/observational-memory-lifecycle.d.ts +1 -1
  447. package/dist/storage/domains/prompt-blocks/index.cjs +1 -1
  448. package/dist/storage/domains/prompt-blocks/index.js +1 -1
  449. package/dist/storage/domains/scorer-definitions/index.cjs +1 -1
  450. package/dist/storage/domains/scorer-definitions/index.js +1 -1
  451. package/dist/storage/domains/skills/index.cjs +1 -1
  452. package/dist/storage/domains/skills/index.js +1 -1
  453. package/dist/storage/domains/workspaces/index.cjs +1 -1
  454. package/dist/storage/domains/workspaces/index.js +1 -1
  455. package/dist/storage/index.cjs +12 -11
  456. package/dist/storage/index.js +12 -12
  457. package/dist/storage/types.d.ts +13 -0
  458. package/dist/stream/base/output.d.ts +42 -15
  459. package/dist/stream/index.cjs +2 -2
  460. package/dist/stream/index.js +2 -2
  461. package/dist/stream/types.d.ts +19 -0
  462. package/dist/{stream-S_NC5v9e.js → stream-Dpwx0whf.js} +1 -1
  463. package/dist/{stream-DUrp3Fcy.cjs → stream-Dvy_0o14.cjs} +1 -1
  464. package/dist/test-utils/llm-mock.cjs +1 -1
  465. package/dist/test-utils/llm-mock.js +1 -1
  466. package/dist/tool-loop-agent/index.cjs +1 -1
  467. package/dist/tool-loop-agent/index.js +1 -1
  468. package/dist/{tool-loop-agent-BhCzpGfr.js → tool-loop-agent-PbWrEj1k.js} +3 -3
  469. package/dist/{tool-loop-agent-DU0BiemT.cjs → tool-loop-agent-UxOv3FoK.cjs} +3 -3
  470. package/dist/tools/index.cjs +1 -1
  471. package/dist/tools/index.js +1 -1
  472. package/dist/tools/types.d.ts +27 -1
  473. package/dist/{utils-CeEt4K7t.cjs → utils-BbMTlyBO.cjs} +1 -1
  474. package/dist/{utils-DYIai19q.js → utils-BnNi1BYM.js} +1 -1
  475. package/dist/utils.cjs +1 -1
  476. package/dist/utils.js +1 -1
  477. package/dist/{validate-BRikrNhF.js → validate-HSBcm96b.js} +1 -1
  478. package/dist/{validate-BckgxuJ0.cjs → validate-Skps-cM3.cjs} +1 -1
  479. package/dist/vector/index.cjs +1 -1
  480. package/dist/vector/index.js +1 -1
  481. package/dist/worker/index.cjs +1 -1
  482. package/dist/worker/index.js +1 -1
  483. package/dist/{worker-BfhUD77l.cjs → worker-BE-0DyKL.cjs} +3 -3
  484. package/dist/{worker-DcBfwJqD.js → worker-BKrKHZzU.js} +3 -3
  485. package/dist/{worker-D9WwmcJa.cjs → worker-BNS5A3qP.cjs} +3 -3
  486. package/dist/{worker-Du5ybt5o.js → worker-DehaD4qD.js} +3 -3
  487. package/dist/{workflow-BWV5m9Mx.cjs → workflow-BjUTwaK9.cjs} +4 -4
  488. package/dist/{workflow-jNWVBYDJ.js → workflow-Bvw6yDjc.js} +4 -4
  489. package/dist/workflows/builder/index.cjs +1 -1
  490. package/dist/workflows/builder/index.js +1 -1
  491. package/dist/workflows/evented/index.cjs +1 -1
  492. package/dist/workflows/evented/index.js +1 -1
  493. package/dist/workflows/evented/setup-warning.d.ts +18 -0
  494. package/dist/workflows/evented/workflow-event-processor/run-status.d.ts +37 -0
  495. package/dist/workflows/evented/workflow.d.ts +11 -1
  496. package/dist/workflows/index.cjs +6 -6
  497. package/dist/workflows/index.js +6 -6
  498. package/dist/workflows/workflow.d.ts +6 -1
  499. package/dist/workspace/index.cjs +2 -2
  500. package/dist/workspace/index.js +2 -2
  501. package/dist/{workspace-D7JRhn1Z.js → workspace-C05xDH60.js} +564 -411
  502. package/dist/{workspace-BQ2wZj5D.cjs → workspace-D1OzzlLw.cjs} +564 -411
  503. package/dist/{workspace-skills-CGiXfKzA.js → workspace-skills-38OY32_b.js} +531 -531
  504. package/package.json +6 -6
  505. package/src/llm/model/provider-types.generated.d.ts +7720 -7720
  506. package/dist/agent/durable/evented-execution-engine.d.ts +0 -20
  507. package/dist/{filesystem-versioned-D-OCaYSl.cjs → filesystem-versioned-DZGyPbNC.cjs} +43 -43
  508. package/dist/{schedules-qIHUKsj4.cjs → schedules-BZS8McF7.cjs} +93 -93
  509. package/dist/{workspace-skills-CUSjYHdi.cjs → workspace-skills-BcquhPDn.cjs} +530 -530
@@ -1,471 +1,18 @@
1
1
  import type { MastraServerCache } from '../../cache/base.js';
2
2
  import type { PubSub } from '../../events/pubsub.js';
3
- import type { MastraModelConfig } from '../../llm/model/shared.types.js';
4
3
  import type { IMastraLogger } from '../../logger/index.js';
5
4
  import type { Mastra } from '../../mastra/index.js';
6
5
  import type { DeclaredAgentSchedule } from '../../schedules/define.js';
7
6
  import type { FullOutput, MastraModelOutput } from '../../stream/base/output.js';
8
7
  import type { ChunkType, MastraOnFinishCallback, MastraStreamTransformOptions } from '../../stream/types.js';
9
- import type { DynamicArgument } from '../../types/index.js';
10
- import type { ShouldPersistSnapshotFn, WorkflowRunStatus } from '../../workflows/types.js';
8
+ import type { ShouldPersistSnapshotFn } from '../../workflows/types.js';
11
9
  import { Agent } from '../agent.js';
12
- import type { AgentExecutionOptions } from '../agent.types.js';
13
10
  import type { MessageListInput } from '../message-list/index.js';
14
11
  import type { AgentStreamBus } from '../streams/bus.js';
15
- import type { AgentRunRecord } from '../streams/run-records.js';
16
- import type { AgentStreamsConfig } from '../streams/types.js';
17
12
  import type { AgentDurableOption, ToolsInput } from '../types.js';
18
- import { DurableExecutionEngine } from './execution-engine.js';
19
13
  import type { ExtendedRunRegistry } from './run-registry.js';
20
- import type { AgentAbortEventData, AgentStreamEvent, DurableAgentStepFinishResult, AgentSuspendedEventData } from './types.js';
14
+ import type { AgentAbortEventData, DurableAgentConfig, DurableAgentStreamOptions, DurableAgentStreamResult, DurableAgentStepFinishResult, AgentSuspendedEventData } from './types.js';
21
15
  import type { createDurableAgenticWorkflow } from './workflows/index.js';
22
- /**
23
- * Options for DurableAgent.stream()
24
- */
25
- export interface DurableAgentStreamOptions<OUTPUT = undefined> {
26
- /** Signal chunks to hide from this caller's stream. Does not affect generated results. */
27
- hideSignals?: AgentExecutionOptions<OUTPUT>['hideSignals'];
28
- /** Custom instructions that override the agent's default instructions for this execution */
29
- instructions?: AgentExecutionOptions<OUTPUT>['instructions'];
30
- /** Additional context messages to provide to the agent */
31
- context?: AgentExecutionOptions<OUTPUT>['context'];
32
- /** Memory configuration for conversation persistence and retrieval */
33
- memory?: AgentExecutionOptions<OUTPUT>['memory'];
34
- /** Scopes this run acts with. See `AgentExecutionOptions.scopes`. */
35
- scopes?: string[];
36
- /** Unique identifier for this execution run */
37
- runId?: string;
38
- /** Request Context containing dynamic configuration and state */
39
- requestContext?: AgentExecutionOptions<OUTPUT>['requestContext'];
40
- /** Maximum number of steps to run */
41
- maxSteps?: number;
42
- /**
43
- * Model to run for this call instead of the agent's model.
44
- *
45
- * A model instance can't be persisted, so `recover()` in another process falls back to the
46
- * agent's own model and logs a warning.
47
- */
48
- model?: DynamicArgument<MastraModelConfig>;
49
- /**
50
- * Conditions for stopping execution (e.g., step count, token limit).
51
- *
52
- * The predicate is non-serializable, so it's parked on the in-process run
53
- * registry and evaluated by the durable loop on every iteration. Cross-process
54
- * durable engines (e.g. Inngest after a worker restart) cannot recover the
55
- * closure and degrade to `maxSteps` only.
56
- */
57
- stopWhen?: AgentExecutionOptions<OUTPUT>['stopWhen'];
58
- /** Additional tool sets that can be used for this execution */
59
- toolsets?: AgentExecutionOptions<OUTPUT>['toolsets'];
60
- /** Client-side tools available during execution */
61
- clientTools?: AgentExecutionOptions<OUTPUT>['clientTools'];
62
- /** Tool selection strategy */
63
- toolChoice?: AgentExecutionOptions<OUTPUT>['toolChoice'];
64
- /** Tool names enabled for this execution */
65
- activeTools?: AgentExecutionOptions<OUTPUT>['activeTools'];
66
- /** Model-specific settings like temperature */
67
- modelSettings?: AgentExecutionOptions<OUTPUT>['modelSettings'];
68
- /** Provider-specific options forwarded to the model (serialized into the durable workflow input) */
69
- providerOptions?: AgentExecutionOptions<OUTPUT>['providerOptions'];
70
- /** Require approval for tool calls. Boolean (gate all / none) or a per-call function policy. */
71
- requireToolApproval?: AgentExecutionOptions<OUTPUT>['requireToolApproval'];
72
- /** Automatically resume suspended tools */
73
- autoResumeSuspendedTools?: boolean;
74
- /** Maximum number of tool calls to execute concurrently, or an object with `limit`/`strategy` */
75
- toolCallConcurrency?: AgentExecutionOptions<OUTPUT>['toolCallConcurrency'];
76
- /** Whether to include raw chunks in the stream output */
77
- includeRawChunks?: boolean;
78
- /** Experimental transforms applied whenever `fullStream` is consumed. */
79
- experimentalTransform?: MastraStreamTransformOptions<OUTPUT>;
80
- /** Maximum processor retries */
81
- maxProcessorRetries?: number;
82
- /** Structured output configuration */
83
- structuredOutput?: AgentExecutionOptions<OUTPUT>['structuredOutput'];
84
- /** Whether to return detailed scoring data in the response */
85
- returnScorerData?: boolean;
86
- /** Version overrides for sub-agent delegation */
87
- versions?: AgentExecutionOptions<OUTPUT>['versions'];
88
- /** Callback when chunk is received */
89
- onChunk?: (chunk: ChunkType<OUTPUT>) => void | Promise<void>;
90
- /** Callback when step finishes */
91
- onStepFinish?: (result: DurableAgentStepFinishResult) => void | Promise<void>;
92
- /** Callback when execution finishes — receives rich step data (text, steps, toolResults) */
93
- onFinish?: MastraOnFinishCallback<OUTPUT>;
94
- /** Callback on error */
95
- onError?: ({ error }: {
96
- error: Error | string;
97
- }) => void | Promise<void>;
98
- /** Callback when workflow suspends (e.g., for tool approval) */
99
- onSuspended?: (data: AgentSuspendedEventData) => void | Promise<void>;
100
- /** Callback when execution is aborted via abortSignal */
101
- onAbort?: AgentExecutionOptions<OUTPUT>['onAbort'];
102
- /** Callback fired after each agentic-loop iteration */
103
- onIterationComplete?: AgentExecutionOptions<OUTPUT>['onIterationComplete'];
104
- /** Additional system message appended after context but before user messages. */
105
- system?: AgentExecutionOptions<OUTPUT>['system'];
106
- /** When true, background tasks are disabled for this run. */
107
- disableBackgroundTasks?: AgentExecutionOptions<OUTPUT>['disableBackgroundTasks'];
108
- /** Execution-scoped background dispatch policy for delegated agents. */
109
- backgroundTaskPolicy?: AgentExecutionOptions<OUTPUT>['backgroundTaskPolicy'];
110
- /** Tracing options forwarded to the agent/model spans. */
111
- tracingOptions?: AgentExecutionOptions<OUTPUT>['tracingOptions'];
112
- /** Per-call actor signal forwarded to FGA checks and tool execution. */
113
- actor?: AgentExecutionOptions<OUTPUT>['actor'];
114
- /** MCP protocol context forwarded to tools for in-process durable runs. */
115
- mcp?: AgentExecutionOptions<OUTPUT>['mcp'];
116
- /**
117
- * Per-call tool lifecycle hooks. Applied when tools are prepared for this execution.
118
- * Function hooks are not serialized; a cross-process recovery cannot restore them.
119
- */
120
- hooks?: AgentExecutionOptions<OUTPUT>['hooks'];
121
- /**
122
- * Per-invocation tool payload transform policy. The closure rides on the
123
- * in-process run registry; only the JSON-safe `targets` shadow is serialized
124
- * for cross-process engines.
125
- */
126
- transform?: AgentExecutionOptions<OUTPUT>['transform'];
127
- /**
128
- * Per-step preparation hook. Closure-only: stored on the in-process run
129
- * registry and invoked as a `PrepareStepProcessor` at the start of every
130
- * iteration. Cross-process resumes lose the hook.
131
- */
132
- prepareStep?: AgentExecutionOptions<OUTPUT>['prepareStep'];
133
- /**
134
- * Per-call `isTaskComplete` policy. Scorer instances and `onComplete` are
135
- * closure-only and live on the in-process run registry; the JSON-safe
136
- * primitives (`strategy`, `timeout`, `parallel`, `suppressFeedback`,
137
- * `scorerNames`) are serialized for cross-process observability.
138
- */
139
- isTaskComplete?: AgentExecutionOptions<OUTPUT>['isTaskComplete'];
140
- /**
141
- * Sub-agent delegation hooks (`onDelegationStart`, `onDelegationComplete`,
142
- * `messageFilter`, etc.). The callbacks are forwarded into `convertTools`
143
- * at prepare time and burned into the sub-agent `CoreTool` wrappers on the
144
- * in-process run registry. Cross-process resumes lose the callbacks (only
145
- * `includeSubAgentToolResultsInModelContext` would be JSON-safe), so a
146
- * fresh worker degrades to default delegation behaviour.
147
- */
148
- delegation?: AgentExecutionOptions<OUTPUT>['delegation'];
149
- /**
150
- * When set, `stream()` delegates to the idle-loop wrapper that keeps the
151
- * outer stream open across background-task continuations — the same
152
- * behaviour as the now-deprecated `streamUntilIdle()`.
153
- *
154
- * Pass `true` for default idle timeout (5 min), or `{ maxIdleMs }` to
155
- * customise.
156
- *
157
- * @example
158
- * ```typescript
159
- * const { output, cleanup } = await durableAgent.stream('Research topic', {
160
- * untilIdle: true,
161
- * memory: { thread: 't1', resource: 'u1' },
162
- * });
163
- * ```
164
- */
165
- untilIdle?: boolean | {
166
- maxIdleMs?: number;
167
- };
168
- /** When true, the in-loop background task check step skips waiting (streamUntilIdle sets this) */
169
- _skipBgTaskWait?: boolean;
170
- /**
171
- * @internal
172
- * Detach HTTP observers on reader cancellation instead of aborting execution.
173
- */
174
- _detachObserverOnCancel?: boolean;
175
- /**
176
- * External abort signal. The durable agent always installs its own internal
177
- * `AbortController` for the run; when this signal is provided, its `abort`
178
- * event is forwarded to the internal controller so either source can cancel
179
- * the run.
180
- *
181
- * Cross-process resumes (e.g. Inngest after a worker restart) cannot
182
- * recover the signal — call `resume(runId, ..., { abortSignal })` with a
183
- * fresh signal on each segment if you need abortability post-resume.
184
- */
185
- abortSignal?: AbortSignal;
186
- /**
187
- * Whether this caller's stream closes when the run suspends (e.g. for tool
188
- * approval). Defaults to `false`: the stream stays open across suspension so
189
- * a later resume can continue streaming on this same reader.
190
- *
191
- * Set to `true` so `fullStream`, `text`, and `getFullOutput()` resolve at the
192
- * suspension boundary (matching non-durable `Agent.stream()`), letting callers
193
- * such as AG-UI or A2A react instead of hanging. Resume the run with
194
- * `resumeStream()`/`resume()` — those always return a fresh stream.
195
- */
196
- closeOnSuspend?: boolean;
197
- }
198
- /**
199
- * Result from DurableAgent.stream()
200
- */
201
- export interface DurableAgentStreamResult<OUTPUT = undefined> {
202
- /** The streaming output */
203
- output: MastraModelOutput<OUTPUT>;
204
- /** The full stream - delegates to output.fullStream for server compatibility */
205
- readonly fullStream: ReadableStream<any>;
206
- /** The unique run ID for this execution */
207
- runId: string;
208
- /** Thread ID if using memory */
209
- threadId?: string;
210
- /** Resource ID if using memory */
211
- resourceId?: string;
212
- /** Trace ID of the run, when the run is traced */
213
- traceId?: string;
214
- /** ID of the agent run span, when the run is traced */
215
- spanId?: string;
216
- /** Cleanup function to call when done (unsubscribes from pubsub) */
217
- cleanup: () => void;
218
- /**
219
- * Abort the run. Flips the internal `AbortController` for this run, which
220
- * surfaces as an `AbortError` inside the durable LLM-execution step and
221
- * is bridged to the user's `onAbort` callback via the run's pubsub topic.
222
- *
223
- * Safe to call after the run has already finished — it's a no-op in that
224
- * case.
225
- *
226
- * Also publishes an abort request over pubsub so the abort reaches the
227
- * process executing the run, which in a load-balanced deployment is usually
228
- * not this one. That process flips its own controller and unwinds normally;
229
- * the workflow run is never hard-cancelled, so the terminal `finish` event
230
- * still reaches stream consumers. Await the returned promise to know the
231
- * request has been dispatched; ignoring it keeps the previous
232
- * fire-and-forget behaviour.
233
- */
234
- abort: (reason?: unknown) => Promise<void>;
235
- }
236
- /**
237
- * Configuration for DurableAgent - wraps an existing Agent with durable execution
238
- */
239
- export interface DurableAgentConfig<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TOutput = undefined> extends AgentStreamsConfig {
240
- /**
241
- * The Agent to wrap with durable execution capabilities.
242
- * All agent methods (getModel, listTools, etc.) delegate to this agent.
243
- */
244
- agent: Agent<TAgentId, TTools, TOutput>;
245
- /**
246
- * Optional ID override. Defaults to agent.id.
247
- */
248
- id?: TAgentId;
249
- /**
250
- * Optional name override. Defaults to agent.name.
251
- */
252
- name?: string;
253
- /**
254
- * Maximum steps for the agentic loop.
255
- * Defaults to the workflow default if not specified.
256
- */
257
- maxSteps?: number;
258
- /**
259
- * Overrides the snapshot-persistence policy for this agent's durable
260
- * workflows. Returning false for a status skips that snapshot write.
261
- *
262
- * The default policy always persists `pending | paused | suspended`
263
- * (required for human-in-the-loop `resume()`), and persists `running`
264
- * when the Mastra instance is configured with
265
- * `recovery: { durableAgents: 'auto' }`, or at each step boundary after
266
- * `mastra.shutdown()` starts (even with recovery off). `running`
267
- * checkpoints exist solely so `listActiveRuns()` / `recover()` /
268
- * `recoverActiveRuns()` can see in-flight runs after a crash or shutdown.
269
- *
270
- * Footguns when providing a custom predicate:
271
- * - Excluding `paused` / `suspended` breaks human-in-the-loop resume.
272
- * - Excluding `running` makes the agent invisible to crash recovery.
273
- * A guardrail warning is logged for both cases (detected by probing the
274
- * predicate with an empty `stepResults`, so predicates that read
275
- * `stepResults` may probe inaccurately — the warning is best-effort).
276
- *
277
- * EventedAgent and InngestAgent own their persistence policy and ignore
278
- * this option with a warning.
279
- */
280
- shouldPersistSnapshot?: ShouldPersistSnapshotFn;
281
- /**
282
- * How this agent's new runs are stored. `1` rewrites one snapshot per run
283
- * on every write. `2` stores a run header plus per-step entries, and each
284
- * write sends only what changed.
285
- *
286
- * Where the storage adapter doesn't support version 2, new runs are stored
287
- * as version 1 and a warning is logged. Runs keep the version they were
288
- * created with: a run resumed after this option changes continues in its
289
- * stored version.
290
- *
291
- * @default 1
292
- * @experimental
293
- */
294
- storageVersion?: 1 | 2;
295
- }
296
- /**
297
- * DurableAgent wraps an existing Agent with durable execution capabilities.
298
- *
299
- * Key features:
300
- * 1. Resumable streams - clients can disconnect and reconnect without missing events
301
- * 2. Serializable workflow inputs - works with durable execution engines
302
- * 3. PubSub-based streaming - events flow through pubsub for distribution
303
- *
304
- * DurableAgent extends Agent, delegating most methods to the wrapped agent.
305
- * It overrides stream() to use durable execution with the agentic workflow.
306
- *
307
- * Subclasses (EventedAgent, InngestAgent) override executeWorkflow() to
308
- * customize how the workflow is executed.
309
- *
310
- * @example
311
- * ```typescript
312
- * import { Agent } from '@mastra/core/agent';
313
- * import { DurableAgent } from '@mastra/core/agent/durable';
314
- *
315
- * const agent = new Agent({
316
- * id: 'my-agent',
317
- * instructions: 'You are a helpful assistant',
318
- * model: openai('gpt-4'),
319
- * });
320
- *
321
- * const durableAgent = new DurableAgent({ agent });
322
- *
323
- * const { output, runId, cleanup } = await durableAgent.stream('Hello!');
324
- * const text = await output.text;
325
- * cleanup();
326
- * ```
327
- */
328
- /**
329
- * Statuses of durable agent runs discoverable via {@link DurableAgent.listActiveRuns}.
330
- *
331
- * `running` is the status reported by the workflow engine while the durable
332
- * agent's agentic loop is actively executing (i.e. between suspend
333
- * boundaries). Persisted `running` snapshots are the recovery source for runs
334
- * orphaned by a process restart.
335
- */
336
- export type DurableAgentActiveRunStatus = Extract<WorkflowRunStatus, 'running'>;
337
- /**
338
- * Filters for {@link DurableAgent.listActiveRuns}. Mirrors the
339
- * `listWorkflowRuns` filter contract, plus the agent-level `threadId` /
340
- * `resourceId` filters used by the base {@link Agent.listSuspendedRuns}.
341
- */
342
- export interface DurableAgentListActiveRunsOptions {
343
- /** Only return runs that belong to this memory thread. */
344
- threadId?: string;
345
- /** Only return runs that belong to this memory resource. */
346
- resourceId?: string;
347
- /** Only return runs created at or after this date. */
348
- fromDate?: Date;
349
- /** Only return runs created at or before this date. */
350
- toDate?: Date;
351
- /**
352
- * Number of items per page. Pagination is applied when both `perPage` and
353
- * `page` are provided; otherwise all matching runs are returned.
354
- */
355
- perPage?: number;
356
- /** Zero-indexed page number. */
357
- page?: number;
358
- }
359
- /**
360
- * A durable agent run currently reported as `running` in workflow snapshot
361
- * storage. These are the runs that a boot-time or operator-initiated
362
- * recovery would re-drive after a process restart.
363
- */
364
- export interface DurableAgentActiveRun {
365
- /** Run ID accepted by {@link DurableAgent.recoverActiveRuns} and workflow `restart`. */
366
- runId: string;
367
- status: DurableAgentActiveRunStatus;
368
- threadId?: string;
369
- resourceId?: string;
370
- /** When the run's snapshot was last persisted while running. */
371
- updatedAt: Date;
372
- }
373
- export interface DurableAgentListActiveRunsResult {
374
- runs: DurableAgentActiveRun[];
375
- /** Total number of matching runs, before pagination. */
376
- total: number;
377
- }
378
- /**
379
- * Outcome of a single run restart attempted by
380
- * {@link DurableAgent.recoverActiveRuns}. `success` means `run.restart()`
381
- * returned; `failed` means it threw and the error was captured so recovery
382
- * of remaining runs could proceed; `skipped` means the run was not orphaned,
383
- * recovery hit a transient error, its recovery wait timed out, or recovery was interrupted by shutdown.
384
- */
385
- export interface DurableAgentRecoveredRun {
386
- runId: string;
387
- status: 'success' | 'failed' | 'skipped';
388
- /** Set when `status` is `failed`. */
389
- error?: Error;
390
- /**
391
- * Set when `status` is `skipped`:
392
- * - `run-active`: another execution, possibly in another process, is live.
393
- * Check again at `retryAt`.
394
- * - `run-active-locally`: this process is executing the run.
395
- * - `already-in-progress`: this process is already recovering the run.
396
- * - `transient-error`: recovery hit a transient infrastructure error. Check again at `retryAt`.
397
- * - `recovery-timeout`: the attempt is still pending or its 30-second wait expired. Check again at `retryAt`.
398
- */
399
- reason?: 'run-active' | 'run-active-locally' | 'already-in-progress' | 'transient-error' | 'recovery-timeout';
400
- /** Epoch ms to check again: claim expiry for `run-active`, or a retry delay for `transient-error` / `recovery-timeout`. */
401
- retryAt?: number;
402
- }
403
- /**
404
- * Filters for {@link DurableAgent.recoverActiveRuns}. Reuses the
405
- * {@link DurableAgentListActiveRunsOptions} discovery filters and adds an
406
- * escape hatch for targeting a specific run ID.
407
- */
408
- export interface DurableAgentRecoverActiveRunsOptions extends DurableAgentListActiveRunsOptions {
409
- /**
410
- * Recover a specific run by ID. When set, the discovery filters and
411
- * pagination fields are ignored. Useful when the caller already knows the
412
- * run ID from another source (e.g. their own bookkeeping).
413
- */
414
- runId?: string;
415
- }
416
- export interface DurableAgentRecoverActiveRunsResult {
417
- recovered: DurableAgentRecoveredRun[];
418
- /** Number of runs that restarted successfully. */
419
- succeeded: number;
420
- /** Number of runs whose restart threw. */
421
- failed: number;
422
- }
423
- /**
424
- * Options for {@link DurableAgent.recover}, a single-run streamable recovery
425
- * counterpart to {@link DurableAgent.resume}.
426
- *
427
- * `recover()` rebuilds the run's non-serializable state from the persisted
428
- * workflow snapshot (message list, model, tools, memory, saveQueueManager,
429
- * request context, agent span) and returns a fresh {@link DurableAgentStreamResult}
430
- * whose `fullStream` observes the recovered run through pubsub. Callbacks
431
- * mirror `stream()` / `resume()`.
432
- */
433
- export interface DurableAgentRecoverOptions<OUTPUT = undefined> {
434
- /** Callback when chunk is received */
435
- onChunk?: (chunk: ChunkType<OUTPUT>) => void | Promise<void>;
436
- /** Experimental transforms applied whenever `fullStream` is consumed. */
437
- experimentalTransform?: MastraStreamTransformOptions<OUTPUT>;
438
- /** Callback when a step finishes */
439
- onStepFinish?: (result: DurableAgentStepFinishResult) => void | Promise<void>;
440
- /** Callback when the recovered run finishes */
441
- onFinish?: MastraOnFinishCallback<OUTPUT>;
442
- /** Callback when the recovered run errors */
443
- onError?: ({ error }: {
444
- error: Error | string;
445
- }) => void | Promise<void>;
446
- /** Callback when the recovered run is aborted */
447
- onAbort?: (data: AgentAbortEventData) => void | Promise<void>;
448
- /** Callback when the recovered run suspends again */
449
- onSuspended?: (data: AgentSuspendedEventData) => void | Promise<void>;
450
- /**
451
- * Close the recovered stream once the run suspends (e.g. awaiting tool
452
- * approval) so callers can hand off to `resume()`. Defaults to `false`.
453
- */
454
- closeOnSuspend?: boolean;
455
- /**
456
- * Optional abort signal for the recovered segment. Forwarded onto a fresh
457
- * internal `AbortController` installed on the run's registry entry, so
458
- * `result.abort()` and the external signal can both cancel the recovered run.
459
- */
460
- abortSignal?: AbortSignal;
461
- /**
462
- * Take the run over even while another execution is live. The other
463
- * execution loses the run and stops; its writes are rejected when the
464
- * workflows store supports run fencing. Without `force`, `recover()` throws
465
- * `DURABLE_AGENT_RUN_ACTIVE` for a live run.
466
- */
467
- force?: boolean;
468
- }
469
16
  export interface DurableAgent<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TOutput = undefined> {
470
17
  stream(messages: MessageListInput, options?: DurableAgentStreamOptions<TOutput>): Promise<DurableAgentStreamResult<TOutput>>;
471
18
  resumeStream(resumeData: any, streamOptions?: any): Promise<MastraModelOutput<TOutput>>;
@@ -489,10 +36,10 @@ export interface DurableAgent<TAgentId extends string = string, TTools extends T
489
36
  * `suspendPayload` will be populated. Use {@link DurableAgent.resumeGenerate}
490
37
  * to continue.
491
38
  *
492
- * Note on suspend persistence: both `DurableAgent` and `EventedAgent` track
493
- * the workflow engine's `run.start()` through snapshot persistence, so
494
- * awaiting `workflowExecution` on suspend is sufficient for a subsequent
495
- * `resumeGenerate()` to find the snapshot.
39
+ * Note on suspend persistence: `DurableAgent` reports a suspension only
40
+ * after the suspended snapshot is saved. `EventedAgent` can report it before
41
+ * the snapshot is readable from another process, so a `resumeGenerate()`
42
+ * issued elsewhere immediately afterwards may not find it yet.
496
43
  */
497
44
  generate(messages: MessageListInput, options?: DurableAgentStreamOptions<TOutput>): Promise<FullOutput<TOutput>>;
498
45
  /**
@@ -604,10 +151,9 @@ export interface DurableAgent<TAgentId extends string = string, TTools extends T
604
151
  }
605
152
  export declare class DurableAgent<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TOutput = undefined> extends Agent<TAgentId, TTools, TOutput> {
606
153
  #private;
607
- /** @internal Subclasses supply their default engine without changing workflow fallback policy. */
608
- protected createExecutionEngine(mastra?: Mastra): DurableExecutionEngine;
609
- /** @internal Forced strategy, without resolving host/storage fallback. */
610
- __getExecutionEngineStrategy(): 'durable' | 'evented';
154
+ /** Engine this wrapper class runs on, selected through the Agent's `durable` policy. @internal */
155
+ protected static readonly executionEngine: 'default' | 'evented';
156
+ protected get returnsDurableStreamResult(): boolean;
611
157
  /**
612
158
  * User-supplied snapshot-persistence policy
613
159
  * (see DurableAgentConfig.shouldPersistSnapshot). Protected so subclasses
@@ -628,36 +174,10 @@ export declare class DurableAgent<TAgentId extends string = string, TTools exten
628
174
  * Returns CachingPubSub if caching is enabled, otherwise the inner pubsub.
629
175
  */
630
176
  get pubsub(): PubSub;
631
- /** Durable runs always publish on their stream topic. */
632
- hasResumableStreams(): boolean;
633
- __usesSharedRunLog(): boolean;
634
- /** Durable execution uses its lifecycle publisher, not the plain Agent entry point. @internal */
635
- protected __ownsPlainStreamPublisher(): boolean;
636
177
  /** Kept `false`, the value this getter has always reported for durable agents. */
637
178
  get durable(): AgentDurableOption | undefined;
638
179
  /** @internal */
639
180
  __getStreamBus(): AgentStreamBus;
640
- /**
641
- * Owner of a run this process still tracks (until its auto-cleanup clears
642
- * the replay history), or undefined.
643
- * @internal
644
- */
645
- __getRunOwner(runId: string): {
646
- resourceId?: string;
647
- threadId?: string;
648
- } | undefined;
649
- __getRunRecord(runId: string): Promise<AgentRunRecord | undefined>;
650
- /**
651
- * Owner of a run whose replay history is still retained: the local owner,
652
- * else the shared record, including legacy records without stream status.
653
- * Undefined once the run's topic is cleared. Only used for replay access.
654
- * Rejects when the shared cache cannot be read.
655
- * @internal
656
- */
657
- __getReplayOwner(runId: string): Promise<{
658
- resourceId?: string;
659
- threadId?: string;
660
- } | undefined>;
661
181
  protected get agentForExecution(): Agent<TAgentId, TTools, TOutput>;
662
182
  /**
663
183
  * Get the wrapped agent instance.
@@ -693,6 +213,16 @@ export declare class DurableAgent<TAgentId extends string = string, TTools exten
693
213
  getModel(options?: any): import("../../_types/@internal_ai-sdk-v4@0.0.98/dist/index.js").LanguageModelV1 | Promise<import("../../_types/@internal_ai-sdk-v4@0.0.98/dist/index.js").LanguageModelV1 | import("..").MastraLanguageModel> | import("..").MastraLanguageModel;
694
214
  getLLM(options?: any): Promise<import("..").MastraLLM> | import("..").MastraLLM;
695
215
  getModelList(requestContext?: any): Promise<import("..").AgentModelManagerConfig[] | null>;
216
+ __getModelAndModelList(options?: Parameters<Agent<TAgentId, TTools, TOutput>['__getModelAndModelList']>[0]): Promise<{
217
+ model: import("..").MastraLanguageModel | import("..").MastraLegacyLanguageModel;
218
+ modelList: Array<import("..").AgentModelManagerConfig> | null;
219
+ fallbackTimeouts: Array<import("..").ModelFallbackSettings['timeout'] | undefined>;
220
+ }>;
221
+ reorderModels(modelIds: string[]): boolean;
222
+ updateModelInModelList(update: Parameters<Agent<TAgentId, TTools, TOutput>['updateModelInModelList']>[0]): boolean;
223
+ __resetToOriginalModel(): void;
224
+ __getMaxRetriesConfigured(): boolean;
225
+ __getMaxProcessorRetries(): number | undefined;
696
226
  getInstructions(options?: any): Promise<import("../../llm").SystemMessage> | import("../../llm").SystemMessage;
697
227
  getDescription(): string;
698
228
  getMetadata(options?: any): Promise<Record<string, unknown> | undefined> | Record<string, unknown> | undefined;
@@ -706,6 +236,8 @@ export declare class DurableAgent<TAgentId extends string = string, TTools exten
706
236
  getMemory(options?: any): Promise<import("../../memory").MastraMemory | undefined>;
707
237
  getScopes(options?: any): Promise<string[]>;
708
238
  hasOwnMemory(): boolean;
239
+ __hasFixedMemory(): boolean;
240
+ getKnowledge(): import("../../knowledge").Knowledge | undefined;
709
241
  getWorkspace(options?: any): Promise<import("../../workspace").AnyWorkspace | undefined>;
710
242
  hasOwnWorkspace(): boolean;
711
243
  getVoice(options?: any): Promise<import("../../_types/@internal_voice@0.0.47/dist/index.js").IMastraVoice<unknown, unknown, import("../../_types/@internal_voice@0.0.47/dist/index.js").ToolsInput, import("../../_types/@internal_voice@0.0.47/dist/index.js").VoiceEventMap, unknown>>;
@@ -751,21 +283,22 @@ export declare class DurableAgent<TAgentId extends string = string, TTools exten
751
283
  __setMemory(memory: any): void;
752
284
  __setPubSub(pubsub: any): void;
753
285
  __setWorkspace(workspace: any): void;
286
+ __setKnowledge(knowledge: Parameters<Agent<TAgentId, TTools, TOutput>['__setKnowledge']>[0]): void;
754
287
  __getEditorConfig(): import("..").AgentEditorConfig | undefined;
755
288
  __getOverridableFields(): {
756
- instructions: DynamicArgument<import("../../llm").SystemMessage, any>;
289
+ instructions: import("../../types").DynamicArgument<import("../../llm").SystemMessage, any>;
757
290
  model: {
758
291
  id: string;
759
- model: DynamicArgument<import("../../llm").WidenedMastraModelConfig>;
292
+ model: import("../../types").DynamicArgument<import("../../llm").WidenedMastraModelConfig>;
760
293
  maxRetries: number;
761
294
  maxRetriesConfigured: boolean;
762
295
  enabled: boolean;
763
- modelSettings?: DynamicArgument<import("..").ModelFallbackSettings>;
764
- providerOptions?: DynamicArgument<import("../../llm/model/provider-options").ProviderOptions>;
765
- headers?: DynamicArgument<Record<string, string>>;
766
- }[] | DynamicArgument<import("..").ModelWithRetries[] | MastraModelConfig, any>;
767
- tools: DynamicArgument<TTools, any>;
768
- workspace: DynamicArgument<import("../../workspace").AnyWorkspace | undefined, any>;
296
+ modelSettings?: import("../../types").DynamicArgument<import("..").ModelFallbackSettings>;
297
+ providerOptions?: import("../../types").DynamicArgument<import("../../llm/model/provider-options").ProviderOptions>;
298
+ headers?: import("../../types").DynamicArgument<Record<string, string>>;
299
+ }[] | import("../../types").DynamicArgument<import("..").ModelWithRetries[] | import("../../llm").MastraModelConfig, any>;
300
+ tools: import("../../types").DynamicArgument<TTools, any>;
301
+ workspace: import("../../types").DynamicArgument<import("../../workspace").AnyWorkspace | undefined, any>;
769
302
  };
770
303
  __updateInstructions(instructions: Parameters<Agent<TAgentId, TTools, TOutput>['__updateInstructions']>[0]): void;
771
304
  __updateModel(config: Parameters<Agent<TAgentId, TTools, TOutput>['__updateModel']>[0]): void;
@@ -796,23 +329,6 @@ export declare class DurableAgent<TAgentId extends string = string, TTools exten
796
329
  __fork(): Agent<TAgentId, TTools, TOutput>;
797
330
  /** Whether new runs opt into journal storage. @internal */
798
331
  protected get storesRunsInJournal(): boolean;
799
- /**
800
- * Stream a response from the agent using durable execution.
801
- */
802
- /**
803
- * Subscribe to a run's raw AgentStreamEvents, filtering out events from
804
- * executions that lost ownership and takeover markers. Callers must map
805
- * these events to the public frame contract produced by stream-adapter.ts's
806
- * createDurableAgentStream before sending them to clients; raw event
807
- * envelopes are not public stream frames. Resolves once subscribed, with
808
- * a function that unsubscribes.
809
- *
810
- * @internal
811
- */
812
- __subscribeToRunStream(runId: string, options: {
813
- offset?: number;
814
- onComplete?: () => void;
815
- }, onEvent: (event: AgentStreamEvent) => void): Promise<() => Promise<void>>;
816
332
  /**
817
333
  * Get the workflow instance for direct execution.
818
334
  * Lazily creates the workflow and registers Mastra on it (needed for
@@ -13,7 +13,8 @@
13
13
  */
14
14
  import type { BackgroundTaskManager } from '../../background-tasks/manager.js';
15
15
  import type { MessageListInput } from '../message-list/index.js';
16
- import type { DurableAgent, DurableAgentStreamOptions, DurableAgentStreamResult } from './durable-agent.js';
16
+ import type { DurableAgent } from './durable-agent.js';
17
+ import type { DurableAgentStreamOptions, DurableAgentStreamResult } from './types.js';
17
18
  export interface DurableStreamUntilIdleDeps {
18
19
  activeStreams: Map<string, () => void>;
19
20
  bgManager: BackgroundTaskManager | undefined;
@@ -6,11 +6,9 @@
6
6
  * while the run's completion promise is tracked for safe suspension/resume.
7
7
  * Events are streamed via pubsub as the workflow executes.
8
8
  */
9
- import type { Mastra } from '../../mastra/index.js';
10
9
  import type { ToolsInput } from '../types.js';
11
10
  import { DurableAgent } from './durable-agent.js';
12
- import type { DurableAgentConfig } from './durable-agent.js';
13
- import { EventedExecutionEngine } from './evented-execution-engine.js';
11
+ import type { DurableAgentConfig } from './types.js';
14
12
  /**
15
13
  * Configuration for EventedAgent - wraps an existing Agent with fire-and-forget execution
16
14
  */
@@ -83,8 +81,7 @@ export declare class EventedAgent<TAgentId extends string = string, TTools exten
83
81
  * in-process engine.
84
82
  * @internal
85
83
  */
86
- protected get workflowEngine(): 'default' | 'evented';
87
- protected createExecutionEngine(mastra?: Mastra): EventedExecutionEngine;
84
+ protected static readonly executionEngine: 'evented';
88
85
  }
89
86
  /**
90
87
  * Check if an object is an EventedAgent class instance