@mastra/core 1.86.0-alpha.7 → 1.86.0-alpha.9

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/knowledge-compat/index.d.ts +363 -0
  2. package/dist/a2a/index.cjs +1 -1
  3. package/dist/a2a/index.js +1 -1
  4. package/dist/agent/agent.d.ts +72 -1
  5. package/dist/agent/agent.types.d.ts +30 -2
  6. package/dist/agent/durable/create-evented-agent.d.ts +6 -0
  7. package/dist/agent/durable/durable-agent.d.ts +1 -15
  8. package/dist/agent/durable/index.cjs +7 -26
  9. package/dist/agent/durable/index.js +7 -26
  10. package/dist/agent/durable/preparation.d.ts +2 -0
  11. package/dist/agent/durable/utils/resolve-runtime.d.ts +9 -0
  12. package/dist/agent/durable/workflows/durable-loop-builder.d.ts +4 -0
  13. package/dist/agent/durable/workflows/finalize-run.d.ts +3 -1
  14. package/dist/agent/durable/workflows/steps/llm-execution.d.ts +1 -0
  15. package/dist/agent/index.cjs +3 -3
  16. package/dist/agent/index.js +3 -3
  17. package/dist/agent/message-list/index.cjs +1 -1
  18. package/dist/agent/message-list/index.js +1 -1
  19. package/dist/agent/message-list/message-list.d.ts +11 -0
  20. package/dist/agent/message-list/utils/provider-compat.d.ts +1 -0
  21. package/dist/agent/request-context-snapshot.d.ts +1 -1
  22. package/dist/agent/streams/types.d.ts +10 -0
  23. package/dist/agent/thread-stream-runtime.d.ts +5 -0
  24. package/dist/agent/types.d.ts +25 -0
  25. package/dist/agent-builder/ee/index.cjs +1 -1
  26. package/dist/agent-builder/ee/index.js +1 -1
  27. package/dist/agent-controller/index.cjs +1 -1
  28. package/dist/agent-controller/index.js +1 -1
  29. package/dist/{agent-controller-K5vHtqfO.cjs → agent-controller-CrQ9OF80.cjs} +8 -8
  30. package/dist/{agent-controller-Cf3_IuY8.js → agent-controller-SSlKzE6A.js} +8 -8
  31. package/dist/background-tasks/index.cjs +1 -1
  32. package/dist/background-tasks/index.js +1 -1
  33. package/dist/{background-tasks-DqnQMfuf.cjs → background-tasks-BDrYBis-.cjs} +5 -3
  34. package/dist/{background-tasks-BgpX1P_s.js → background-tasks-BnJfNLFo.js} +5 -3
  35. package/dist/browser/index.cjs +2 -2
  36. package/dist/browser/index.js +2 -2
  37. package/dist/{builder-x295GDL6.js → builder-Cl-0BWkh.js} +2 -2
  38. package/dist/{builder-D8Osghdo.cjs → builder-Cw8u3pPl.cjs} +2 -2
  39. package/dist/capabilities/302ai.json +192 -192
  40. package/dist/capabilities/abliteratedllm.json +34 -34
  41. package/dist/capabilities/abliteration-ai.json +11 -11
  42. package/dist/capabilities/above.json +17 -17
  43. package/dist/capabilities/adaption.json +12 -12
  44. package/dist/capabilities/adzuki.json +30 -30
  45. package/dist/capabilities/agentrouter.json +10 -10
  46. package/dist/capabilities/agnes.json +4 -4
  47. package/dist/capabilities/ai-router.json +9 -9
  48. package/dist/capabilities/aiand.json +19 -11
  49. package/dist/capabilities/aigrow.json +11 -11
  50. package/dist/capabilities/aimlapi.json +146 -149
  51. package/dist/capabilities/aipg.json +2 -2
  52. package/dist/capabilities/aixy.json +14 -14
  53. package/dist/capabilities/aki-io.json +11 -11
  54. package/dist/capabilities/alibaba-cn.json +128 -109
  55. package/dist/capabilities/alibaba-coding-plan-cn.json +7 -19
  56. package/dist/capabilities/alibaba-coding-plan.json +7 -19
  57. package/dist/capabilities/alibaba-token-plan-cn.json +49 -67
  58. package/dist/capabilities/alibaba-token-plan.json +51 -69
  59. package/dist/capabilities/alibaba.json +71 -118
  60. package/dist/capabilities/ambient.json +14 -14
  61. package/dist/capabilities/amd.json +11 -11
  62. package/dist/capabilities/anthropic.json +48 -48
  63. package/dist/capabilities/anyapi.json +18 -18
  64. package/dist/capabilities/apiko.json +2 -2
  65. package/dist/capabilities/arcee.json +10 -10
  66. package/dist/capabilities/augure.json +6 -6
  67. package/dist/capabilities/auriko.json +20 -20
  68. package/dist/capabilities/bailing.json +5 -5
  69. package/dist/capabilities/baseten.json +46 -16
  70. package/dist/capabilities/bee.json +5 -5
  71. package/dist/capabilities/berget.json +4 -4
  72. package/dist/capabilities/bothub.json +16 -16
  73. package/dist/capabilities/boundless.json +36 -36
  74. package/dist/capabilities/bumo.json +40 -40
  75. package/dist/capabilities/byteplus.json +32 -32
  76. package/dist/capabilities/cerebras.json +4 -4
  77. package/dist/capabilities/cheapaimodel.json +5 -5
  78. package/dist/capabilities/cheapest-token.json +24 -24
  79. package/dist/capabilities/chutes.json +9 -9
  80. package/dist/capabilities/cline-pass.json +37 -37
  81. package/dist/capabilities/cloudcode.json +4 -4
  82. package/dist/capabilities/cloudflare-workers-ai.json +24 -24
  83. package/dist/capabilities/commandcode.json +152 -152
  84. package/dist/capabilities/concentrate.json +290 -266
  85. package/dist/capabilities/cortecs.json +105 -105
  86. package/dist/capabilities/crossmodel.json +160 -160
  87. package/dist/capabilities/crusoe.json +10 -10
  88. package/dist/capabilities/daoxe.json +7 -7
  89. package/dist/capabilities/databricks.json +318 -62
  90. package/dist/capabilities/deepinfra.json +73 -129
  91. package/dist/capabilities/deepseek.json +2 -2
  92. package/dist/capabilities/digitalocean.json +114 -114
  93. package/dist/capabilities/dothoosh.json +28 -28
  94. package/dist/capabilities/doubleword.json +24 -24
  95. package/dist/capabilities/edenai.json +458 -458
  96. package/dist/capabilities/empiriolabs.json +166 -166
  97. package/dist/capabilities/engy.json +20 -20
  98. package/dist/capabilities/evroc.json +8 -8
  99. package/dist/capabilities/ezkielyna.json +8 -8
  100. package/dist/capabilities/fastrouter.json +85 -85
  101. package/dist/capabilities/fireworks-ai.json +107 -44
  102. package/dist/capabilities/freemodel.json +23 -23
  103. package/dist/capabilities/friendli.json +9 -9
  104. package/dist/capabilities/frogbot.json +94 -94
  105. package/dist/capabilities/gisoo.json +16 -16
  106. package/dist/capabilities/gmicloud.json +17 -17
  107. package/dist/capabilities/google.json +57 -57
  108. package/dist/capabilities/graphn.json +10 -10
  109. package/dist/capabilities/greenpt.json +36 -36
  110. package/dist/capabilities/groq.json +2 -2
  111. package/dist/capabilities/helicone.json +68 -68
  112. package/dist/capabilities/hopper.json +2 -2
  113. package/dist/capabilities/hostinger-router.json +12 -12
  114. package/dist/capabilities/hpc-ai.json +13 -13
  115. package/dist/capabilities/huawei-maas.json +17 -17
  116. package/dist/capabilities/hubris.json +30 -30
  117. package/dist/capabilities/huggingface.json +193 -37
  118. package/dist/capabilities/hyper.json +23 -23
  119. package/dist/capabilities/impossibl.json +140 -140
  120. package/dist/capabilities/inception.json +2 -2
  121. package/dist/capabilities/inceptron.json +4 -4
  122. package/dist/capabilities/inco.json +3 -3
  123. package/dist/capabilities/infer.json +15 -15
  124. package/dist/capabilities/inferall.json +10 -10
  125. package/dist/capabilities/inference-coop.json +9 -9
  126. package/dist/capabilities/inferenceapis.json +9 -9
  127. package/dist/capabilities/inferris.json +3 -3
  128. package/dist/capabilities/infersia.json +2 -2
  129. package/dist/capabilities/inferx.json +3 -3
  130. package/dist/capabilities/infomaniak.json +4 -4
  131. package/dist/capabilities/io-net.json +2 -2
  132. package/dist/capabilities/isoquant.json +4 -4
  133. package/dist/capabilities/iteracompute.json +60 -60
  134. package/dist/capabilities/jad-ai.json +3 -3
  135. package/dist/capabilities/jalapeno.json +12 -12
  136. package/dist/capabilities/jiekou.json +63 -63
  137. package/dist/capabilities/jzstoken.json +50 -50
  138. package/dist/capabilities/keln.json +14 -21
  139. package/dist/capabilities/kenari.json +123 -120
  140. package/dist/capabilities/kilo.json +622 -647
  141. package/dist/capabilities/kimi-code-plan-cn.json +5 -5
  142. package/dist/capabilities/kimi-code-plan-global.json +5 -5
  143. package/dist/capabilities/kitani.json +6 -6
  144. package/dist/capabilities/klavo.json +18 -18
  145. package/dist/capabilities/korouter.json +29 -29
  146. package/dist/capabilities/kunavo.json +10 -10
  147. package/dist/capabilities/liquid.json +11 -11
  148. package/dist/capabilities/lithosai.json +2 -2
  149. package/dist/capabilities/llmgateway-providers.json +932 -905
  150. package/dist/capabilities/llmgateway.json +336 -336
  151. package/dist/capabilities/llmtr.json +22 -22
  152. package/dist/capabilities/logits.json +2 -2
  153. package/dist/capabilities/longcat.json +2 -7
  154. package/dist/capabilities/lowrouter.json +54 -54
  155. package/dist/capabilities/lyceum.json +12 -12
  156. package/dist/capabilities/melious.json +13 -13
  157. package/dist/capabilities/merge-gateway.json +260 -260
  158. package/dist/capabilities/meta.json +7 -7
  159. package/dist/capabilities/mistral.json +20 -20
  160. package/dist/capabilities/mixlayer.json +4 -4
  161. package/dist/capabilities/modal.json +10 -10
  162. package/dist/capabilities/model-oracle-ai.json +25 -25
  163. package/dist/capabilities/modelis.json +20 -20
  164. package/dist/capabilities/modular.json +6 -6
  165. package/dist/capabilities/moneo.json +16 -16
  166. package/dist/capabilities/moonshotai-cn.json +7 -7
  167. package/dist/capabilities/moonshotai.json +7 -7
  168. package/dist/capabilities/morph.json +11 -11
  169. package/dist/capabilities/munito-eu.json +6 -6
  170. package/dist/capabilities/munito.json +6 -6
  171. package/dist/capabilities/nan.json +27 -27
  172. package/dist/capabilities/nano-gpt.json +578 -578
  173. package/dist/capabilities/nearai.json +84 -84
  174. package/dist/capabilities/nebius.json +37 -28
  175. package/dist/capabilities/neon.json +126 -126
  176. package/dist/capabilities/neuralwatt.json +41 -41
  177. package/dist/capabilities/nokeep.json +4 -4
  178. package/dist/capabilities/novita-ai.json +154 -154
  179. package/dist/capabilities/nvidia.json +35 -35
  180. package/dist/capabilities/oathbreaker.json +2 -2
  181. package/dist/capabilities/obscurify.json +32 -32
  182. package/dist/capabilities/oci.json +7 -7
  183. package/dist/capabilities/ofox.json +357 -357
  184. package/dist/capabilities/ollama-cloud.json +56 -56
  185. package/dist/capabilities/openai.json +51 -51
  186. package/dist/capabilities/opencode-go.json +85 -84
  187. package/dist/capabilities/openrouter.json +542 -567
  188. package/dist/capabilities/opper.json +30 -24
  189. package/dist/capabilities/orcarouter.json +236 -236
  190. package/dist/capabilities/outerlabs.json +32 -32
  191. package/dist/capabilities/ovhcloud.json +7 -7
  192. package/dist/capabilities/pareto.json +6 -6
  193. package/dist/capabilities/pendra.json +4 -4
  194. package/dist/capabilities/perplexity-agent.json +61 -61
  195. package/dist/capabilities/phala.json +34 -34
  196. package/dist/capabilities/pioneer.json +30 -30
  197. package/dist/capabilities/poe.json +136 -136
  198. package/dist/capabilities/powerspring.json +13 -13
  199. package/dist/capabilities/primalabs.json +10 -10
  200. package/dist/capabilities/prime.json +124 -107
  201. package/dist/capabilities/privatemode-ai.json +14 -14
  202. package/dist/capabilities/proxystacks.json +6 -6
  203. package/dist/capabilities/qiniu-ai.json +16 -16
  204. package/dist/capabilities/refuseless.json +6 -6
  205. package/dist/capabilities/regolo-ai.json +6 -6
  206. package/dist/capabilities/requesty.json +172 -172
  207. package/dist/capabilities/ruapi.json +17 -17
  208. package/dist/capabilities/runcrate.json +5 -5
  209. package/dist/capabilities/runinfra.json +13 -13
  210. package/dist/capabilities/sakana.json +6 -6
  211. package/dist/capabilities/sambanova.json +9 -9
  212. package/dist/capabilities/sandbase.json +27 -27
  213. package/dist/capabilities/sarvam.json +12 -12
  214. package/dist/capabilities/scaleway.json +14 -14
  215. package/dist/capabilities/scnet-token-plan.json +9 -9
  216. package/dist/capabilities/scx-ai.json +26 -26
  217. package/dist/capabilities/sensenova.json +12 -12
  218. package/dist/capabilities/siliconflow-cn.json +49 -49
  219. package/dist/capabilities/siliconflow.json +46 -46
  220. package/dist/capabilities/snowflake-cortex.json +20 -20
  221. package/dist/capabilities/sokkan.json +7 -7
  222. package/dist/capabilities/sparrowcodes.json +25 -25
  223. package/dist/capabilities/standardcompute.json +102 -102
  224. package/dist/capabilities/steadyrouter.json +40 -40
  225. package/dist/capabilities/stepfun-ai-step-plan.json +6 -6
  226. package/dist/capabilities/stepfun-ai.json +15 -8
  227. package/dist/capabilities/stepfun-step-plan.json +15 -8
  228. package/dist/capabilities/stepfun.json +15 -8
  229. package/dist/capabilities/stepping-stone.json +16 -16
  230. package/dist/capabilities/synthetic.json +13 -13
  231. package/dist/capabilities/synthorai.json +19 -19
  232. package/dist/capabilities/teamorouter.json +24 -24
  233. package/dist/capabilities/teapot-router.json +13 -13
  234. package/dist/capabilities/tencent-coding-plan.json +1 -23
  235. package/dist/capabilities/tencent-token-plan.json +60 -23
  236. package/dist/capabilities/tencent-tokenhub.json +182 -7
  237. package/dist/capabilities/tensorx.json +50 -50
  238. package/dist/capabilities/tenstorrent.json +6 -6
  239. package/dist/capabilities/the-grid-ai.json +28 -28
  240. package/dist/capabilities/thinkingmachines.json +72 -55
  241. package/dist/capabilities/tinfoil.json +13 -13
  242. package/dist/capabilities/toapis.json +2 -2
  243. package/dist/capabilities/togetherai.json +54 -83
  244. package/dist/capabilities/tokengo.json +25 -25
  245. package/dist/capabilities/tokenify.json +9 -9
  246. package/dist/capabilities/trustedrouter.json +4 -4
  247. package/dist/capabilities/trustedtokens.json +17 -17
  248. package/dist/capabilities/umans-ai-coding-plan.json +13 -13
  249. package/dist/capabilities/umans-ai.json +10 -10
  250. package/dist/capabilities/unrestricted.json +6 -6
  251. package/dist/capabilities/uplinkswitch.json +21 -21
  252. package/dist/capabilities/upstage.json +4 -4
  253. package/dist/capabilities/vancine.json +23 -23
  254. package/dist/capabilities/vercel.json +540 -527
  255. package/dist/capabilities/vivgrid.json +80 -80
  256. package/dist/capabilities/volcengine-coding-plan.json +24 -54
  257. package/dist/capabilities/volcengine.json +55 -60
  258. package/dist/capabilities/vultr.json +24 -24
  259. package/dist/capabilities/wafer.ai.json +19 -19
  260. package/dist/capabilities/wallaby.json +5 -5
  261. package/dist/capabilities/wally.json +11 -11
  262. package/dist/capabilities/wandb.json +21 -21
  263. package/dist/capabilities/watt.json +24 -24
  264. package/dist/capabilities/xai.json +7 -7
  265. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -12
  266. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -12
  267. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -12
  268. package/dist/capabilities/xiaomi.json +3 -25
  269. package/dist/capabilities/xpersona.json +13 -13
  270. package/dist/capabilities/xxapi.json +31 -31
  271. package/dist/capabilities/zai-coding-plan.json +18 -18
  272. package/dist/capabilities/zai.json +49 -26
  273. package/dist/capabilities/zenifra.json +26 -26
  274. package/dist/capabilities/zenmux.json +205 -205
  275. package/dist/capabilities/zerogpu.json +11 -11
  276. package/dist/capabilities/zhipuai-coding-plan.json +6 -6
  277. package/dist/capabilities/zhipuai.json +39 -24
  278. package/dist/capabilities/zro.json +6 -6
  279. package/dist/channels/index.cjs +2 -2
  280. package/dist/channels/index.js +2 -2
  281. package/dist/{channels-Dx4jiXeK.js → channels-Cz1y3W6u.js} +1 -1
  282. package/dist/{channels-q6qnuRNV.cjs → channels-DQg4v_gm.cjs} +1 -1
  283. package/dist/coding-agent/index.cjs +2 -2
  284. package/dist/coding-agent/index.js +2 -2
  285. package/dist/datasets/dataset.d.ts +13 -6
  286. package/dist/datasets/experiment/durable.d.ts +16 -0
  287. package/dist/datasets/experiment/index.d.ts +2 -1
  288. package/dist/datasets/experiment/item.d.ts +26 -4
  289. package/dist/datasets/experiment/retries.d.ts +18 -0
  290. package/dist/datasets/experiment/types.d.ts +18 -0
  291. package/dist/datasets/experiment/workflow-id.d.ts +7 -0
  292. package/dist/datasets/experiment/workflow.d.ts +74 -0
  293. package/dist/datasets/index.cjs +3 -2
  294. package/dist/datasets/index.d.ts +2 -1
  295. package/dist/datasets/index.js +3 -3
  296. package/dist/docs/SKILL.md +4 -3
  297. package/dist/docs/assets/SOURCE_MAP.json +928 -903
  298. package/dist/docs/references/docs-deployment-workers.md +1 -1
  299. package/dist/docs/references/docs-evals-experiments.md +29 -1
  300. package/dist/docs/references/docs-harness-background-tasks.md +4 -1
  301. package/dist/docs/references/docs-harness-durable-agents.md +9 -5
  302. package/dist/docs/references/docs-knowledge-agents-and-tools.md +1 -0
  303. package/dist/docs/references/docs-knowledge-importers.md +195 -0
  304. package/dist/docs/references/docs-knowledge-load-your-content.md +2 -2
  305. package/dist/docs/references/docs-knowledge-overview.md +1 -1
  306. package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
  307. package/dist/docs/references/docs-sandbox-filesystem.md +1 -1
  308. package/dist/docs/references/docs-server-pubsub.md +51 -8
  309. package/dist/docs/references/docs-signals-running-across-processes.md +2 -0
  310. package/dist/docs/references/docs-signals-thread-streams.md +1 -1
  311. package/dist/docs/references/docs-studio-auth.md +54 -7
  312. package/dist/docs/references/docs-workflows-overview.md +1 -1
  313. package/dist/docs/references/docs-workflows-scheduled-workflows.md +1 -1
  314. package/dist/docs/references/integrations-auth-clerk.md +48 -4
  315. package/dist/docs/references/integrations-channels-slack.md +4 -2
  316. package/dist/docs/references/integrations.md +6 -0
  317. package/dist/docs/references/reference-agents-agent.md +3 -1
  318. package/dist/docs/references/reference-agents-channels.md +116 -27
  319. package/dist/docs/references/reference-agents-durable-agent.md +12 -4
  320. package/dist/docs/references/reference-auth-clerk.md +21 -1
  321. package/dist/docs/references/reference-datasets-runExperimentItem.md +13 -1
  322. package/dist/docs/references/reference-datasets-startExperimentAsync.md +3 -1
  323. package/dist/docs/references/reference-editor-mastra-editor.md +3 -1
  324. package/dist/docs/references/reference-knowledge-knowledge-class.md +13 -6
  325. package/dist/docs/references/reference-knowledge-knowledge-tools.md +43 -20
  326. package/dist/docs/references/reference-memory-observational-memory.md +2 -2
  327. package/dist/docs/references/reference-processors-moderation-processor.md +2 -2
  328. package/dist/docs/references/reference-pubsub-base.md +5 -1
  329. package/dist/docs/references/reference-pubsub-event-emitter.md +2 -0
  330. package/dist/docs/references/reference-pubsub-redis-streams.md +1 -1
  331. package/dist/docs/references/reference-pubsub-unix-socket-pubsub.md +2 -0
  332. package/dist/docs/references/reference-streaming-ChunkType.md +3 -3
  333. package/dist/docs/references/reference-workers-overview.md +1 -1
  334. package/dist/docs/references/reference-workflows-run-methods-start.md +23 -0
  335. package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +4 -0
  336. package/dist/docs/references/reference-workflows-run.md +1 -1
  337. package/dist/docs/references/reference-workspace-local-sandbox.md +2 -0
  338. package/dist/error/index.cjs +1 -1
  339. package/dist/error/index.js +1 -1
  340. package/dist/{error-C9d_24w-.js → error-BLwEXqOK.js} +2 -2
  341. package/dist/{error-BRQf2ku0.cjs → error-BdEvO8za.cjs} +2 -2
  342. package/dist/evals/index.cjs +1 -1
  343. package/dist/evals/index.js +1 -1
  344. package/dist/evals/scoreTraces/index.cjs +1 -1
  345. package/dist/evals/scoreTraces/index.js +1 -1
  346. package/dist/events/caching-pubsub.d.ts +1 -0
  347. package/dist/events/event-emitter/index.d.ts +12 -5
  348. package/dist/events/index.cjs +15 -1
  349. package/dist/events/index.js +15 -1
  350. package/dist/events/pubsub.d.ts +29 -0
  351. package/dist/events/reach.d.ts +11 -0
  352. package/dist/events/unix-socket-pubsub.d.ts +14 -0
  353. package/dist/features/index.cjs +1 -0
  354. package/dist/features/index.js +1 -0
  355. package/dist/{filesystem-B5X-5G0x.js → filesystem-B8ad6kAW.js} +1 -1
  356. package/dist/{filesystem-BDSpwBke.cjs → filesystem-BB5YWXH-.cjs} +1 -1
  357. package/dist/{filesystem-DzM9pcQ8.js → filesystem-BDHUxbHn.js} +1 -1
  358. package/dist/{filesystem-B0AZrbj8.cjs → filesystem-BP5yz5LG.cjs} +1 -1
  359. package/dist/{filesystem-BsdkC311.js → filesystem-B_afSgYk.js} +1 -1
  360. package/dist/{filesystem-C-cyJfi1.cjs → filesystem-BaOJOc-V.cjs} +1 -1
  361. package/dist/{filesystem-B3s0WRud.js → filesystem-BhYgU8qg.js} +1 -1
  362. package/dist/{filesystem-DzfqVTO_.js → filesystem-CLBVmR5j.js} +1 -1
  363. package/dist/{filesystem-CEbD_77-.cjs → filesystem-Cgxc2a_-.cjs} +1 -1
  364. package/dist/{filesystem-Cv79mHRk.js → filesystem-ClBOBoDc.js} +1 -1
  365. package/dist/{filesystem-DsCQiBl2.cjs → filesystem-DVVecqZt.cjs} +1 -1
  366. package/dist/{filesystem-CUAgLugE.cjs → filesystem-Fpsu7e24.cjs} +1 -1
  367. package/dist/{filesystem-versioned-Bijb_p9l.js → filesystem-versioned-BL1ojJLo.js} +1 -1
  368. package/dist/{filesystem-versioned-DZGyPbNC.cjs → filesystem-versioned-BavRtYWJ.cjs} +1 -1
  369. package/dist/harness/index.cjs +1 -1
  370. package/dist/harness/index.js +1 -1
  371. package/dist/index.cjs +1 -1
  372. package/dist/index.js +1 -1
  373. package/dist/knowledge/config.d.ts +10 -0
  374. package/dist/knowledge/host-writes.d.ts +10 -0
  375. package/dist/knowledge/importers/conformance.d.ts +25 -0
  376. package/dist/knowledge/importers/define.d.ts +204 -0
  377. package/dist/knowledge/importers/host.d.ts +143 -0
  378. package/dist/knowledge/importers/index.d.ts +12 -0
  379. package/dist/knowledge/importers/local-host.d.ts +106 -0
  380. package/dist/knowledge/importers/manifest.d.ts +25 -0
  381. package/dist/knowledge/importers/runner.d.ts +61 -0
  382. package/dist/knowledge/importers/sink.d.ts +105 -0
  383. package/dist/knowledge/importers/types.d.ts +144 -0
  384. package/dist/knowledge/index.cjs +2715 -8
  385. package/dist/knowledge/index.d.ts +54 -4
  386. package/dist/knowledge/index.js +2692 -9
  387. package/dist/knowledge/instructions.d.ts +1 -1
  388. package/dist/knowledge/links.d.ts +8 -0
  389. package/dist/knowledge/pinned-state-processor.d.ts +5 -0
  390. package/dist/knowledge/pinned.d.ts +4 -1
  391. package/dist/knowledge/scope-runtime.d.ts +10 -0
  392. package/dist/llm/index.cjs +3 -3
  393. package/dist/llm/index.js +3 -3
  394. package/dist/llm/model/provider-types.generated.d.ts +7812 -7831
  395. package/dist/llm/model/shared.types.d.ts +31 -0
  396. package/dist/{llm-CsQuqKPc.cjs → llm-8Av3mSjD.cjs} +2 -2
  397. package/dist/{llm-DnXK3Pmw.js → llm-B5A5cwJr.js} +2 -2
  398. package/dist/loop/index.cjs +2 -2
  399. package/dist/loop/index.js +2 -2
  400. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +2 -2
  401. package/dist/{manager-BsghM-UL.js → manager-DfWQCJUK.js} +460 -94
  402. package/dist/{manager-DwFnIrI6.cjs → manager-sv35JY-z.cjs} +476 -92
  403. package/dist/mastra/index.cjs +1 -1
  404. package/dist/mastra/index.d.ts +13 -0
  405. package/dist/mastra/index.js +1 -1
  406. package/dist/mastra/resolve-agent.d.ts +3 -1
  407. package/dist/{mastra-B8i1UDZs.js → mastra-CigBrT7X.js} +32 -23
  408. package/dist/{mastra-Cn5NC6Es.cjs → mastra-D4hvfuxX.cjs} +34 -25
  409. package/dist/memory/index.cjs +3 -3
  410. package/dist/memory/index.js +3 -3
  411. package/dist/{message-list-DPXPXvin.cjs → message-list-Cj0Sq_JP.cjs} +63 -8
  412. package/dist/{message-list-DEuRl82K.js → message-list-KRbg-TnI.js} +63 -8
  413. package/dist/{model-CNPfry_X.cjs → model-BK93CMtl.cjs} +1 -1
  414. package/dist/{model-CsOcWMUt.js → model-CYtXw861.js} +1 -1
  415. package/dist/{netlify-C-83Fxus.cjs → netlify-BAnn3ouY.cjs} +1 -1
  416. package/dist/{netlify-C-OpNSGp.js → netlify-CuI1ZrwR.js} +1 -1
  417. package/dist/notifications/index.cjs +1 -1
  418. package/dist/notifications/index.js +1 -1
  419. package/dist/{output-helpers-JL-HeCbT.cjs → output-helpers-1Zu4Vt9C.cjs} +68 -25
  420. package/dist/{output-helpers-D4II19No.js → output-helpers-CedRCE17.js} +69 -26
  421. package/dist/processor-provider/index.cjs +1 -1
  422. package/dist/processor-provider/index.js +1 -1
  423. package/dist/processors/abort-signal-scope.d.ts +6 -0
  424. package/dist/processors/index.cjs +2 -2
  425. package/dist/processors/index.js +2 -2
  426. package/dist/{provider-registry-9O-H9osy.cjs → provider-registry-BwuI_IpT.cjs} +21690 -21811
  427. package/dist/{provider-registry-RZ8EgSe8.js → provider-registry-CmQLzLF_.js} +21690 -21811
  428. package/dist/provider-registry.json +22113 -22215
  429. package/dist/{registry-generator-e8sltJls.js → registry-generator-C17V4WfG.js} +1 -1
  430. package/dist/{registry-generator-DxCX-FiO.cjs → registry-generator-C_0ae7Ce.cjs} +1 -1
  431. package/dist/{rehydrate-B-wrAN7C.cjs → rehydrate-CDQ4dOYj.cjs} +2 -2
  432. package/dist/{rehydrate-D3fPgJwp.js → rehydrate-PnaVawGX.js} +2 -2
  433. package/dist/relevance/index.cjs +2 -2
  434. package/dist/relevance/index.js +2 -2
  435. package/dist/{run-registry-5_LQBGn_.cjs → run-registry-BmckDVBk.cjs} +1698 -497
  436. package/dist/{run-registry-DC03XLeZ.js → run-registry-BwEcwYlU.js} +1614 -467
  437. package/dist/{source-DDwx-87N.cjs → source-BVOi8Xhp.cjs} +1 -1
  438. package/dist/{source-Did_2XQc.js → source-fNa6u1kH.js} +1 -1
  439. package/dist/storage/domains/agents/index.cjs +1 -1
  440. package/dist/storage/domains/agents/index.js +1 -1
  441. package/dist/storage/domains/knowledge/base.d.ts +72 -0
  442. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +146 -0
  443. package/dist/storage/domains/knowledge/importers.d.ts +287 -0
  444. package/dist/storage/domains/knowledge/index.d.ts +1 -0
  445. package/dist/storage/domains/knowledge/inmemory.d.ts +12 -0
  446. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +12 -1
  447. package/dist/storage/domains/knowledge/pages.d.ts +25 -7
  448. package/dist/storage/domains/mcp-clients/index.cjs +1 -1
  449. package/dist/storage/domains/mcp-clients/index.js +1 -1
  450. package/dist/storage/domains/mcp-servers/index.cjs +1 -1
  451. package/dist/storage/domains/mcp-servers/index.js +1 -1
  452. package/dist/storage/domains/prompt-blocks/index.cjs +1 -1
  453. package/dist/storage/domains/prompt-blocks/index.js +1 -1
  454. package/dist/storage/domains/scorer-definitions/index.cjs +1 -1
  455. package/dist/storage/domains/scorer-definitions/index.js +1 -1
  456. package/dist/storage/domains/skills/index.cjs +1 -1
  457. package/dist/storage/domains/skills/index.js +1 -1
  458. package/dist/storage/domains/workspaces/index.cjs +1 -1
  459. package/dist/storage/domains/workspaces/index.js +1 -1
  460. package/dist/storage/index.cjs +15 -10
  461. package/dist/storage/index.js +11 -11
  462. package/dist/stream/base/output.d.ts +59 -15
  463. package/dist/stream/index.cjs +2 -2
  464. package/dist/stream/index.js +2 -2
  465. package/dist/stream/types.d.ts +24 -2
  466. package/dist/{stream-4aNIw_TQ.cjs → stream-0kdqBOOn.cjs} +64 -9
  467. package/dist/{stream-CJUm6EAH.js → stream-D1y9GzoD.js} +29 -10
  468. package/dist/test-utils/llm-mock.cjs +1 -1
  469. package/dist/test-utils/llm-mock.js +1 -1
  470. package/dist/tool-loop-agent/index.cjs +1 -1
  471. package/dist/tool-loop-agent/index.js +1 -1
  472. package/dist/{tool-loop-agent-FEEwHfmg.js → tool-loop-agent-BdjWGVIb.js} +4 -4
  473. package/dist/{tool-loop-agent-Dn0QCB9n.cjs → tool-loop-agent-kWaZAT6Q.cjs} +4 -4
  474. package/dist/tools/types.d.ts +27 -1
  475. package/dist/{utils-DY01hxVd.cjs → utils-BKUCaZ12.cjs} +1 -1
  476. package/dist/{utils-Bd_y1_a-.js → utils-GHY3hmLx.js} +1 -1
  477. package/dist/utils.cjs +1 -1
  478. package/dist/utils.js +1 -1
  479. package/dist/{validate-CX0yQo_q.js → validate-CB-q-R2F.js} +1 -1
  480. package/dist/{validate-CuB_1Zd3.cjs → validate-De92squ7.cjs} +1 -1
  481. package/dist/vector/index.cjs +2 -2
  482. package/dist/vector/index.js +2 -2
  483. package/dist/worker/index.cjs +1 -1
  484. package/dist/worker/index.js +1 -1
  485. package/dist/{worker-CbaSmip-.cjs → worker-BbWPQuPR.cjs} +2 -2
  486. package/dist/{worker-B80xkcKG.js → worker-C3u_xzY2.js} +2 -2
  487. package/dist/{worker-GsGIxPMa.cjs → worker-CAKvQj9_.cjs} +2 -2
  488. package/dist/{worker-DSEfMPmq.js → worker-Kwm8EKcj.js} +2 -2
  489. package/dist/{workflow-CnBPXTpv.cjs → workflow-CSjXeNcR.cjs} +4 -4
  490. package/dist/{workflow-CZHY_C85.js → workflow-CVmI1Sw-.js} +4 -4
  491. package/dist/workflows/builder/index.cjs +1 -1
  492. package/dist/workflows/builder/index.js +1 -1
  493. package/dist/workflows/evented/index.cjs +1 -1
  494. package/dist/workflows/evented/index.js +1 -1
  495. package/dist/workflows/evented/setup-warning.d.ts +18 -0
  496. package/dist/workflows/evented/workflow-event-processor/run-status.d.ts +37 -0
  497. package/dist/workflows/evented/workflow.d.ts +10 -0
  498. package/dist/workflows/index.cjs +4 -4
  499. package/dist/workflows/index.js +4 -4
  500. package/dist/workflows/workflow.d.ts +6 -1
  501. package/dist/workspace/filesystem/filesystem.d.ts +5 -0
  502. package/dist/workspace/index.cjs +1 -1
  503. package/dist/workspace/index.js +1 -1
  504. package/dist/workspace/sandbox/local-sandbox.d.ts +16 -7
  505. package/dist/workspace/sandbox/native-sandbox/types.d.ts +11 -1
  506. package/dist/{workspace-D7TIleIt.js → workspace-DY2Nxiyi.js} +235 -34
  507. package/dist/{workspace-D2drutNg.cjs → workspace-X2RHJZU9.cjs} +235 -34
  508. package/package.json +7 -7
  509. package/src/llm/model/provider-types.generated.d.ts +7812 -7831
@@ -1,4 +1,4 @@
1
- import { $ as createDurableBackgroundTaskCheckStep, At as readRunDeadline, B as createDurableAgenticWorkflow, Bs as emitFinishEvent, Ct as runDurableStreamUntilIdle, Dt as DurableStepIds, Et as DurableAgentDefaults, F as normalizeResumeGenerateArgs, Fs as __resetExecutionFencesForTests, Ft as pruneAgentLoopSnapshot, G as createWorkflowInput, Gs as publishAbortRequest, H as createDurableIsTaskCompleteStep, Hs as emitStepStartEvent, I as prepareForDurableExecution, Is as diffResponseMessages, J as serializeModelConfig, Js as createRunAbortController, K as serializeDurableOptions, Ks as requestAcknowledgedAbort, L as applyReservedMemoryContextKeys, Ls as emitAbortEvent, Mt as getRunStreamSlot, Nt as getScopeStreamSlot, Ot as RUN_DEADLINE_KEY, P as Agent, Pt as untilIdleHandlesBackgroundTask, Qs as AgentStreamEventTypes, R as persistDurableRunInput, Rs as emitChunkEvent, St as createDurableAgentStream, Tt as DURABLE_STOP_WHEN_ERROR_ID, U as createDurableLLMMappingStep, Us as emitSuspendedEvent, V as createDurableGoalStep, Vs as emitStepFinishEvent, W as createDurableToolCallStep, Ws as AgentStreamBus, X as createDurableLLMExecutionStep, Xs as AGENT_STREAM_TOPIC, Y as serializeToolsMetadata, Ys as AGENT_CONTROL_TOPIC, Zs as AgentControlEventTypes, Zt as validateModelTimeoutSettings, _t as resolveTool, a as endRunSpansWithError, at as baseDurableAgenticInputSchema, bt as liveSegmentSpan, c as globalRunRegistry, ct as modelConfigSchema, d as takeRunScorerInstances, dt as runDurableFinishSideEffects, et as resolveDurableToolCallConcurrency, ft as loadRunStoredMessages, gt as resolveRuntimeDependencies, ht as resolveModel, i as deleteRunRegistryEntry, it as accumulatedUsageSchema, kt as ensureRemoteAbortListener, lt as modelListEntrySchema, mt as resolveInternalState, n as RunRegistry, nt as calculateAccumulatedUsage, ot as baseIterationStateSchema, p as agentThreadStreamRuntime, pt as rebuildRunToolsFromMastra, q as serializeDurableState, qs as subscribeToAbortRequests, rt as createBaseIterationStateUpdate, s as getRunRegistryEntry, st as durableAgenticOutputSchema, t as ExtendedRunRegistry, tt as buildStepRecord, u as setRunRegistryEntry, ut as executeDurableAgentScorers, vt as toolRequiresApproval, wt as runResumeDurableStreamUntilIdle, xt as segmentSpanData, yt as carrySegmentSpans, z as detachFullStreamOnEnd, zs as emitErrorEvent } from "../../run-registry-DC03XLeZ.js";
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-BwEcwYlU.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 {
@@ -397,36 +397,11 @@ var DurableAgent = class extends Agent {
397
397
  return this.#storageVersion === 2;
398
398
  }
399
399
  /**
400
- * Warns once when `storageVersion: 2` is set but the registered store can't
401
- * store version 2 runs. The loop workflow's `autoStorageVersion` then stores
402
- * new runs as version 1. An agent with no registered store isn't warned.
403
- */
404
- #warnIfStorageVersionUnsupported() {
405
- if (this.#storageVersion !== 2) return;
406
- const storage = this.#mastra?.getStorage();
407
- const workflowsStore = storage?.stores?.workflows;
408
- if (workflowsStore && !workflowsStore.supportsRunJournal()) this.guardrailLogger?.warn(`DurableAgent '${this.id}' sets storageVersion: 2, which ${storage?.name ?? "the configured"} storage doesn't support yet; storing new runs as version 1.`);
409
- }
410
- /**
411
- * Subscribe to a run's raw AgentStreamEvents, filtering out events from
412
- * executions that lost ownership and takeover markers. Callers must map
413
- * these events to the public frame contract produced by stream-adapter.ts's
414
- * createDurableAgentStream before sending them to clients; raw event
415
- * envelopes are not public stream frames. Resolves once subscribed, with
416
- * a function that unsubscribes.
417
- *
418
- * @internal
419
- */
420
- __subscribeToRunStream(runId, options, onEvent) {
421
- return this.subscribeToDurableRunStream(runId, options, onEvent);
422
- }
423
- /**
424
400
  * Get the workflow instance for direct execution.
425
401
  * Lazily creates the workflow and registers Mastra on it (needed for
426
402
  * getAgentById in execution steps).
427
403
  */
428
404
  getWorkflow() {
429
- if (!this.executionEngine.workflow) this.#warnIfStorageVersionUnsupported();
430
405
  return this.executionEngine.workflow ?? this.executionEngine.getWorkflow({
431
406
  maxSteps: this.#maxSteps,
432
407
  workflowEngine: this.workflowEngine,
@@ -628,6 +603,12 @@ function isEventedAgentClass(obj) {
628
603
  * death: over the same storage, a fresh process can resume in-flight runs via
629
604
  * `recover(runId)` / `recoverActiveRuns()`.
630
605
  *
606
+ * In one process it runs on any pubsub, including the default one. Running its
607
+ * steps on several processes needs a pubsub that redelivers unacknowledged
608
+ * events and a workflows store with step guards.
609
+ *
610
+ * @see https://mastra.ai/docs/server/pubsub#evented-workflows-and-agents
611
+ *
631
612
  * @param options - Configuration options
632
613
  * @returns An EventedAgent instance (register it on a `Mastra` host before use)
633
614
  *
@@ -71,6 +71,8 @@ export interface PreparationOptions<OUTPUT = undefined> {
71
71
  runId?: string;
72
72
  /** Request context */
73
73
  requestContext?: RequestContext;
74
+ /** @internal Called when a non-reserved context entry cannot be snapshotted. */
75
+ onRequestContextEntryOmitted?: () => void;
74
76
  /** Logger */
75
77
  logger?: IMastraLogger;
76
78
  /** Mastra instance (for version overrides, background tasks, etc.) */
@@ -81,6 +81,14 @@ export declare function restoreCustomContext(entries?: Record<string, unknown>,
81
81
  export declare class DurableProcessorRebuildError extends Error {
82
82
  constructor(agentId: string, cause: unknown);
83
83
  }
84
+ /**
85
+ * The process running a step could not find the run's agent in its registry
86
+ * or editor. Running on would execute the step with no tools, memory or
87
+ * processors, so the step fails instead.
88
+ */
89
+ export declare class DurableAgentNotFoundError extends Error {
90
+ constructor(agentId: string, runId: string, cause?: unknown);
91
+ }
84
92
  /**
85
93
  * Resolve all runtime dependencies needed for durable step execution.
86
94
  *
@@ -141,6 +149,7 @@ export declare function rebuildRunToolsFromMastra(options: {
141
149
  mastra?: Mastra;
142
150
  runId: string;
143
151
  agentId: string;
152
+ agentVersionId?: string;
144
153
  state: SerializableDurableState;
145
154
  options?: SerializableDurableOptions;
146
155
  /** JSON-safe request-context snapshot from the workflow input (see preparation.ts). */
@@ -125,6 +125,7 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
125
125
  protected llmExecutionStep(): import("../../../workflows").Step<"durable-llm-execution", unknown, {
126
126
  runId: string;
127
127
  agentId: string;
128
+ agentVersionId?: string | undefined;
128
129
  agentName?: string | undefined;
129
130
  messageListState: any;
130
131
  initialUntaggedSystemMessages?: any[] | undefined;
@@ -415,6 +416,7 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
415
416
  tracingStopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
416
417
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
417
418
  tracingDelegationFailure?: import("../../../observability").SpanTermination | undefined;
419
+ agentVersionId?: string | undefined;
418
420
  modelList?: any[] | undefined;
419
421
  }, {
420
422
  runId: string;
@@ -466,6 +468,7 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
466
468
  tracingStopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
467
469
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
468
470
  tracingDelegationFailure?: import("../../../observability").SpanTermination | undefined;
471
+ agentVersionId?: string | undefined;
469
472
  modelList?: any[] | undefined;
470
473
  }, {
471
474
  runId: string;
@@ -517,6 +520,7 @@ export declare class DurableAgenticLoopBuilder extends BaseAgenticLoopBuilder {
517
520
  tracingStopCause?: "delegation" | "feedback_complete" | "iteration_hook" | "max_steps" | "model_finished" | "stop_condition" | undefined;
518
521
  tracingTermination?: import("../../../observability").SpanTermination | undefined;
519
522
  tracingDelegationFailure?: import("../../../observability").SpanTermination | undefined;
523
+ agentVersionId?: string | undefined;
520
524
  modelList?: any[] | undefined;
521
525
  }, unknown, 1>;
522
526
  /**
@@ -7,7 +7,7 @@ import { RequestContext } from '../../../request-context/index.js';
7
7
  import type { ChunkType } from '../../../stream/types.js';
8
8
  import type { Agent } from '../../agent.js';
9
9
  import type { SerializedMessageListState } from '../../message-list/state/index.js';
10
- import type { DurableAgenticWorkflowInput, RunRegistryEntry } from '../types.js';
10
+ import type { AgentFinishEventData, DurableAgenticWorkflowInput, RunRegistryEntry } from '../types.js';
11
11
  type GenerateThreadTitleArgs = Parameters<NonNullable<RunRegistryEntry['generateThreadTitle']>>[0];
12
12
  type AnyAgent = Agent<any, any, any, any>;
13
13
  export interface DurableFinishSideEffectsOptions {
@@ -27,6 +27,8 @@ export interface DurableFinishSideEffectsOptions {
27
27
  }
28
28
  export interface DurableFinishSideEffectsResult {
29
29
  messageListState: SerializedMessageListState;
30
+ finishMessages?: AgentFinishEventData['messages'];
31
+ rewrittenStepTexts?: string[];
30
32
  outputText: string;
31
33
  /**
32
34
  * True when processOutputResult changed `outputText`, including emptying it. Only then should
@@ -22,6 +22,7 @@ export interface DurableLLMExecutionStepOptions {
22
22
  export declare function createDurableLLMExecutionStep(_options?: DurableLLMExecutionStepOptions): import("../../../../workflows").Step<"durable-llm-execution", unknown, {
23
23
  runId: string;
24
24
  agentId: string;
25
+ agentVersionId?: string | undefined;
25
26
  agentName?: string | undefined;
26
27
  messageListState: any;
27
28
  initialUntaggedSystemMessages?: any[] | undefined;
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_stream = require("../stream-4aNIw_TQ.cjs");
3
- const require_run_registry = require("../run-registry-5_LQBGn_.cjs");
4
- const require_message_list = require("../message-list-DPXPXvin.cjs");
2
+ const require_run_registry = require("../run-registry-BmckDVBk.cjs");
3
+ const require_stream = require("../stream-0kdqBOOn.cjs");
4
+ const require_message_list = require("../message-list-Cj0Sq_JP.cjs");
5
5
  const require_signals = require("../signals-CWxAMEmE.cjs");
6
6
  const require_to_prompt = require("../to-prompt-B9eZo2U5.cjs");
7
7
  const require_schedules = require("../schedules-BZS8McF7.cjs");
@@ -1,6 +1,6 @@
1
- import { an as resolveThreadIdFromArgs, cn as tryStreamWithJsonFallback, in as resolveSuspendedToolRunId, l as TripWire, on as supportedLanguageModelSpecifications, rn as isSupportedLanguageModel, sn as tryGenerateWithJsonFallback } from "../stream-CJUm6EAH.js";
2
- import { A as agentInstructions, It as DEFAULT_TOOL_DECLINE_REASON, Lt as resolveDeclineReason, M as MAX_FS_SUBAGENT_DEPTH, N as AGENT_RESUME_CLAIM_STALE_MS, P as Agent, dl as isDurableAgentLike, j as assembleAgentFromFsEntry, jl as isAgentCompatible, k as agentConfig, ul as hasResumableStreams, ys as getGoalActivityDurationMs } from "../run-registry-DC03XLeZ.js";
3
- import { Q as TypeDetector, n as MessageList, t as convertMessages } from "../message-list-DEuRl82K.js";
1
+ import { A as assembleAgentFromFsEntry, Bl as isAgentCompatible, Ds as getGoalActivityDurationMs, It as DEFAULT_TOOL_DECLINE_REASON, Lt as resolveDeclineReason, M as AGENT_RESUME_CLAIM_STALE_MS, N as Agent, O as agentConfig, bl as isDurableAgentLike, j as MAX_FS_SUBAGENT_DEPTH, k as agentInstructions, yl as hasResumableStreams } from "../run-registry-BwEcwYlU.js";
2
+ import { dn as resolveThreadIdFromArgs, fn as supportedLanguageModelSpecifications, l as TripWire, ln as isSupportedLanguageModel, mn as tryStreamWithJsonFallback, pn as tryGenerateWithJsonFallback, un as resolveSuspendedToolRunId } from "../stream-D1y9GzoD.js";
3
+ import { Q as TypeDetector, n as MessageList, t as convertMessages } from "../message-list-KRbg-TnI.js";
4
4
  import { a as isCreatedAgentSignal, c as isUserAuthoredMessage, d as signalSpanAttributes, f as signalToDataPartFormat, h as signalToXmlMarkup, i as getMessageAuthor, l as mastraDBMessageToSignal, m as signalToMessage, n as createSignal, o as isMastraSignalMessage, p as signalToMastraDBMessage, r as dataPartToSignal, s as isTransientSignalMessage, t as createMessageSignal, u as resolveDeliveryAttributes } from "../signals-CqR_iWkg.js";
5
5
  import { n as aiV5ModelMessageToV2PromptMessage } from "../to-prompt-BsDtVXrf.js";
6
6
  import { d as ScheduleInputSchema, f as ScheduleOutputSchema, i as toWorkflowSchedule, n as toAgentSchedule, p as WORKFLOW_SCHEDULE_PREFIX, r as toScheduleView, s as defineSchedule, t as Schedules, u as AGENT_SCHEDULE_PREFIX } from "../schedules-DZfSx-7P.js";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_message_list = require("../../message-list-DPXPXvin.cjs");
2
+ const require_message_list = require("../../message-list-Cj0Sq_JP.cjs");
3
3
  const require_to_prompt = require("../../to-prompt-B9eZo2U5.cjs");
4
4
  exports.AIV4Adapter = require_message_list.AIV4Adapter;
5
5
  exports.AIV5Adapter = require_message_list.AIV5Adapter;
@@ -1,3 +1,3 @@
1
- import { B as getResponseProviderItemIdFromPart, F as AIV4Adapter, H as hasResponseProviderItemId, I as dropCrossProviderExecutedParts, J as getResponseProviderItemIds, L as ensureAnthropicCompatibleMessages, M as AIV5Adapter, Q as TypeDetector, R as findToolCallArgs, U as pairOrphanedToolCalls, V as hasOpenAIReasoningItemId, W as sanitizeOrphanedToolPairs, X as getResponseProviderItemKeys, Y as getResponseProviderItemKey, f as coreContentToString, j as AIV6Adapter, k as CacheKeyGenerator, n as MessageList, o as MessageStateManager, p as messagesAreEqual, q as getResponseProviderItemId, t as convertMessages, u as MessageMerger, z as getOpenAIReasoningItemId } from "../../message-list-DEuRl82K.js";
1
+ import { B as getResponseProviderItemIdFromPart, F as AIV4Adapter, H as hasResponseProviderItemId, I as dropCrossProviderExecutedParts, J as getResponseProviderItemIds, L as ensureAnthropicCompatibleMessages, M as AIV5Adapter, Q as TypeDetector, R as findToolCallArgs, U as pairOrphanedToolCalls, V as hasOpenAIReasoningItemId, W as sanitizeOrphanedToolPairs, X as getResponseProviderItemKeys, Y as getResponseProviderItemKey, f as coreContentToString, j as AIV6Adapter, k as CacheKeyGenerator, n as MessageList, o as MessageStateManager, p as messagesAreEqual, q as getResponseProviderItemId, t as convertMessages, u as MessageMerger, z as getOpenAIReasoningItemId } from "../../message-list-KRbg-TnI.js";
2
2
  import { n as aiV5ModelMessageToV2PromptMessage, t as aiV4CoreMessageToV1PromptMessage } from "../../to-prompt-BsDtVXrf.js";
3
3
  export { AIV4Adapter, AIV5Adapter, AIV6Adapter, CacheKeyGenerator, MessageList, MessageMerger, MessageStateManager, TypeDetector, aiV4CoreMessageToV1PromptMessage, aiV5ModelMessageToV2PromptMessage, convertMessages, coreContentToString, dropCrossProviderExecutedParts, ensureAnthropicCompatibleMessages, findToolCallArgs, getOpenAIReasoningItemId, getResponseProviderItemId, getResponseProviderItemIdFromPart, getResponseProviderItemIds, getResponseProviderItemKey, getResponseProviderItemKeys, hasOpenAIReasoningItemId, hasResponseProviderItemId, messagesAreEqual, pairOrphanedToolCalls, sanitizeOrphanedToolPairs };
@@ -429,6 +429,17 @@ export declare class MessageList {
429
429
  messageId: string;
430
430
  urls: string[];
431
431
  }[];
432
+ /**
433
+ * Mark a message already in this list as changed after it was loaded, so the next save writes it
434
+ * again through the normal whole-message save. It is not reported as new input, output or source.
435
+ * Messages that are not in the list are ignored.
436
+ */
437
+ markForResave(message: MastraDBMessage): void;
438
+ /**
439
+ * The messages marked with {@link markForResave} and not yet drained. For save paths that read the
440
+ * list instead of draining it; they pick these up next to the new input and response.
441
+ */
442
+ getMessagesToResave(): MastraDBMessage[];
432
443
  drainUnsavedMessages(): MastraDBMessage[];
433
444
  /**
434
445
  * Same as {@link drainUnsavedMessages}, plus `restore`, which marks the drained
@@ -111,6 +111,7 @@ export declare function getResponseProviderItemIdFromPart(part: unknown): {
111
111
  provider: ResponseItemIdProvider;
112
112
  itemId: string;
113
113
  } | undefined;
114
+ export declare function createToolCallArgsLookup(messages: MastraDBMessage[]): (toolCallId: string) => Record<string, unknown>;
114
115
  /**
115
116
  * Finds the tool call args for a given toolCallId by searching through messages.
116
117
  * This is used to reconstruct the input field when converting tool-result parts to StaticToolResult.
@@ -17,7 +17,7 @@ export declare const MASTRA_DURABLE_SEGMENTS_KEY = "mastra__durableSegments";
17
17
  * round-trip are skipped so a single non-serializable value can't break the
18
18
  * snapshot.
19
19
  */
20
- export declare function snapshotRequestContextEntries(requestContext: RequestContext | undefined): Record<string, unknown> | undefined;
20
+ export declare function snapshotRequestContextEntries(requestContext: RequestContext | undefined, onEntryOmitted?: () => void): Record<string, unknown> | undefined;
21
21
  /**
22
22
  * Restore a RequestContext from a `snapshotRequestContextEntries` snapshot.
23
23
  *
@@ -40,6 +40,16 @@ export interface AgentStreamEvent<T = unknown> {
40
40
  export interface AgentStreamsConfig {
41
41
  /** Select the default (in-process) or evented durable engine, or false for the plain Agent loop. */
42
42
  executionEngine?: 'default' | 'evented' | false;
43
+ /** Maximum steps for the durable loop when neither defaultOptions nor the call sets a limit. */
44
+ maxSteps?: number;
45
+ /**
46
+ * Storage version for new durable runs. Version 2 uses the run journal when supported,
47
+ * otherwise the agent logs a warning and stores new runs as version 1.
48
+ * Existing runs keep their stored version.
49
+ * @default 1
50
+ * @experimental
51
+ */
52
+ storageVersion?: 1 | 2;
43
53
  /** Snapshot persistence policy for durable execution. */
44
54
  shouldPersistSnapshot?: ShouldPersistSnapshotFn;
45
55
  /**
@@ -243,6 +243,11 @@ export declare class AgentThreadStreamRuntime {
243
243
  /** Same predicate as {@link getActiveThreadRunId}, over every tracked thread. */
244
244
  listActiveThreadRuns(pubsub?: PubSub): ActiveThreadRun[];
245
245
  hasThreadRun(runId: string, pubsub?: PubSub): boolean;
246
+ /** The resource and thread a `runId`-only signal or message target resolves to in this process. */
247
+ getThreadRunTarget(runId: string, pubsub?: PubSub): {
248
+ resourceId?: string;
249
+ threadId: string;
250
+ } | undefined;
246
251
  /** Whether the run's original stream is still live and carries its resumed segments. */
247
252
  hasRunContinuation(runId: string, pubsub?: PubSub): boolean;
248
253
  /** Capture whether the currently registered continuation publishes its terminal stream part. */
@@ -953,6 +953,31 @@ type AgentEditableFieldConfig<TTools extends ToolsInput, TRequestContext extends
953
953
  } : {
954
954
  tools?: DynamicArgument<TTools, TRequestContext>;
955
955
  });
956
+ /**
957
+ * Options for `new Agent(config)`.
958
+ *
959
+ * - Required: `id`, `name`, `model`, and `instructions` (unless Studio owns instructions via
960
+ * `editor`).
961
+ * - Common optional fields: `tools`, `memory`, `agents` (sub-agents), `workflows`,
962
+ * `defaultOptions` (default per-call options such as `maxSteps`), `inputProcessors`,
963
+ * `outputProcessors`, `maxRetries`.
964
+ * - `model`, `instructions`, `tools`, and most other fields also accept a function of
965
+ * `{ requestContext }` resolved per call. `model` also accepts an array of fallbacks.
966
+ *
967
+ * @example
968
+ * ```ts
969
+ * const agent = new Agent({
970
+ * id: 'weather-agent',
971
+ * name: 'Weather Agent',
972
+ * instructions: 'You answer weather questions.',
973
+ * model: 'openai/gpt-5.6-sol',
974
+ * tools: { weatherTool },
975
+ * defaultOptions: { maxSteps: 5 },
976
+ * });
977
+ * ```
978
+ *
979
+ * @see [Agent constructor reference](https://mastra.ai/reference/agents/agent)
980
+ */
956
981
  export type AgentConfig<TAgentId extends string = string, TTools extends ToolsInput = ToolsInput, TOutput = undefined, TRequestContext extends Record<string, any> | unknown = unknown, TEditor extends AgentEditorConfig | undefined = AgentEditorConfig | undefined> = Omit<AgentConfigBase<TAgentId, TTools, TOutput, TRequestContext>, 'instructions' | 'tools' | 'editor'> & {
957
982
  editor?: TEditor;
958
983
  } & AgentEditableFieldConfig<TTools, TRequestContext, TEditor>;
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_provider_registry = require("../../provider-registry-9O-H9osy.cjs");
2
+ const require_provider_registry = require("../../provider-registry-BwuI_IpT.cjs");
3
3
  // src/agent-builder/ee/types.ts
4
4
  /**
5
5
  * Default-on values for {@link AgentFeatures}. `browser` is defaulted
@@ -1,4 +1,4 @@
1
- import { a as getRegisteredProviders, o as isProviderRegistered, u as parseModelString } from "../../provider-registry-RZ8EgSe8.js";
1
+ import { a as getRegisteredProviders, o as isProviderRegistered, u as parseModelString } from "../../provider-registry-CmQLzLF_.js";
2
2
  // src/agent-builder/ee/types.ts
3
3
  /**
4
4
  * Default-on values for {@link AgentFeatures}. `browser` is defaulted
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_state_processor = require("../state-processor-kRNZ38Nf.cjs");
3
3
  const require_tools = require("../tools-CGF5Ik6j.cjs");
4
- const require_agent_controller = require("../agent-controller-K5vHtqfO.cjs");
4
+ const require_agent_controller = require("../agent-controller-CrQ9OF80.cjs");
5
5
  exports.AgentController = require_agent_controller.AgentController;
6
6
  exports.MODEL_PERSISTENCE_VERSION = require_agent_controller.MODEL_PERSISTENCE_VERSION;
7
7
  exports.MODEL_PERSISTENCE_VERSION_KEY = require_agent_controller.MODEL_PERSISTENCE_VERSION_KEY;
@@ -1,4 +1,4 @@
1
1
  import { f as taskCheckTool, h as taskWriteTool, m as taskUpdateTool, o as assignTaskIds, p as taskCompleteTool } from "../state-processor-B9kxpM53.js";
2
2
  import { s as askUserTool, t as submitPlanTool } from "../tools-CDfyMpzN.js";
3
- import { a as Session, c as defaultDisplayState, d as SessionStartupCancelledError, f as isSessionNotStartedError, i as MODEL_PERSISTENCE_VERSION_KEY, l as defaultOMProgressState, n as parseSubagentMeta, o as getSuspensionAddressKey, p as isSessionStartupCancelledError, r as MODEL_PERSISTENCE_VERSION, s as migratePersistedModelSelection, t as AgentController, u as SessionNotStartedError } from "../agent-controller-Cf3_IuY8.js";
3
+ import { a as Session, c as defaultDisplayState, d as SessionStartupCancelledError, f as isSessionNotStartedError, i as MODEL_PERSISTENCE_VERSION_KEY, l as defaultOMProgressState, n as parseSubagentMeta, o as getSuspensionAddressKey, p as isSessionStartupCancelledError, r as MODEL_PERSISTENCE_VERSION, s as migratePersistedModelSelection, t as AgentController, u as SessionNotStartedError } from "../agent-controller-SSlKzE6A.js";
4
4
  export { AgentController, MODEL_PERSISTENCE_VERSION, MODEL_PERSISTENCE_VERSION_KEY, Session, SessionNotStartedError, SessionStartupCancelledError, askUserTool, assignTaskIds, defaultDisplayState, defaultOMProgressState, getSuspensionAddressKey, isSessionNotStartedError, isSessionStartupCancelledError, migratePersistedModelSelection, parseSubagentMeta, submitPlanTool, taskCheckTool, taskCompleteTool, taskUpdateTool, taskWriteTool };
@@ -1,17 +1,17 @@
1
- const require_run_registry = require("./run-registry-5_LQBGn_.cjs");
2
- const require_message_list = require("./message-list-DPXPXvin.cjs");
1
+ const require_run_registry = require("./run-registry-BmckDVBk.cjs");
2
+ const require_message_list = require("./message-list-Cj0Sq_JP.cjs");
3
3
  const require_signals = require("./signals-CWxAMEmE.cjs");
4
4
  const require_ee_iTj2bRDt = require("./ee-iTj2bRDt-D3-QLGDF.cjs");
5
- const require_channels = require("./channels-q6qnuRNV.cjs");
6
- const require_llm = require("./llm-CsQuqKPc.cjs");
7
- const require_mastra = require("./mastra-Cn5NC6Es.cjs");
8
- const require_stream = require("./stream-4aNIw_TQ.cjs");
5
+ const require_channels = require("./channels-DQg4v_gm.cjs");
6
+ const require_llm = require("./llm-8Av3mSjD.cjs");
7
+ const require_mastra = require("./mastra-D4hvfuxX.cjs");
8
+ const require_stream = require("./stream-0kdqBOOn.cjs");
9
9
  const require_request_context = require("./request-context-D9RXYCy8.cjs");
10
10
  const require_dynamic_argument = require("./dynamic-argument-CUc1BBOS.cjs");
11
11
  const require_error = require("./error-D90lJ6M7.cjs");
12
12
  const require_utils_safe_stringify = require("./utils/safe-stringify.cjs");
13
- const require_workspace = require("./workspace-D2drutNg.cjs");
14
- const require_output_helpers = require("./output-helpers-JL-HeCbT.cjs");
13
+ const require_workspace = require("./workspace-X2RHJZU9.cjs");
14
+ const require_output_helpers = require("./output-helpers-1Zu4Vt9C.cjs");
15
15
  const require_payload_transform = require("./payload-transform-CWgnsO9w.cjs");
16
16
  const require_tools = require("./tools-CGF5Ik6j.cjs");
17
17
  const require_tool = require("./tool-CYlT2UA-.cjs");
@@ -1,18 +1,18 @@
1
- import { Dt as DurableStepIds, P as Agent, Q as isSpanChunk, Rt as getServerSideFallbackInfo, Xr as InMemoryMemory, Z as MessagePartSpans, _a as validateStorageMetadataFilter, f as AgentThreadLeaseLostError, g as describeNonSuccessFinishReason, h as AGENTIC_LOOP_WORKFLOW_ID, jn as CHAT_CHANNEL_RENDER_CONTEXT_KEY, m as AGENTIC_EXECUTION_WORKFLOW_ID, p as agentThreadStreamRuntime } from "./run-registry-DC03XLeZ.js";
2
- import { n as MessageList } from "./message-list-DEuRl82K.js";
1
+ import { $r as InMemoryMemory, Dt as DurableStepIds, N as Agent, Pn as CHAT_CHANNEL_RENDER_CONTEXT_KEY, Rt as getServerSideFallbackInfo, Ta as validateStorageMetadataFilter, X as MessagePartSpans, Z as isSpanChunk, f as AgentThreadLeaseLostError, g as describeNonSuccessFinishReason, h as AGENTIC_LOOP_WORKFLOW_ID, m as AGENTIC_EXECUTION_WORKFLOW_ID, p as agentThreadStreamRuntime } from "./run-registry-BwEcwYlU.js";
2
+ import { n as MessageList } from "./message-list-KRbg-TnI.js";
3
3
  import { c as isUserAuthoredMessage, n as createSignal, u as resolveDeliveryAttributes } from "./signals-CqR_iWkg.js";
4
4
  import { i as MastraFGAPermissions } from "./ee-iTj2bRDt-By_B9ngH.js";
5
- import { t as AgentControllerChannels } from "./channels-Dx4jiXeK.js";
6
- import { a as ModelRouterLanguageModel, l as defaultGateways, s as GatewayManager } from "./llm-DnXK3Pmw.js";
7
- import { t as Mastra } from "./mastra-B8i1UDZs.js";
8
- import { Bt as TITLE_PINNED_THREAD_METADATA_KEY, En as createRunScopeKey } from "./stream-CJUm6EAH.js";
5
+ import { t as AgentControllerChannels } from "./channels-Cz1y3W6u.js";
6
+ import { a as ModelRouterLanguageModel, l as defaultGateways, s as GatewayManager } from "./llm-B5A5cwJr.js";
7
+ import { t as Mastra } from "./mastra-CigBrT7X.js";
8
+ import { Kt as TITLE_PINNED_THREAD_METADATA_KEY, Mn as createRunScopeKey } from "./stream-D1y9GzoD.js";
9
9
  import { c as MASTRA_THREAD_ID_KEY, i as MASTRA_MESSAGE_AUTHOR_KEY, o as MASTRA_RESOURCE_ID_KEY, u as RequestContext } from "./request-context-COnZHt2-.js";
10
10
  import { n as resolveDynamicArgument } from "./dynamic-argument-BzPK3qPN.js";
11
11
  import { i as MastraError, o as getErrorFromUnknown } from "./error-oh2DLsP2.js";
12
12
  import { toStandardSchema } from "./schema/index.js";
13
13
  import { safeStringify } from "./utils/safe-stringify.js";
14
- import { o as Workspace, p as createWorkspaceTools } from "./workspace-D7TIleIt.js";
15
- import { y as isLeaseProvider } from "./output-helpers-D4II19No.js";
14
+ import { o as Workspace, p as createWorkspaceTools } from "./workspace-DY2Nxiyi.js";
15
+ import { v as isLeaseProvider } from "./output-helpers-CedRCE17.js";
16
16
  import { n as hasTransformedToolPayload, t as getTransformedToolPayload } from "./payload-transform-Dj3HUeD4.js";
17
17
  import { s as askUserTool, t as submitPlanTool } from "./tools-CDfyMpzN.js";
18
18
  import { r as createTool, s as isValidationError } from "./tool-Z3bykc1m.js";
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_background_tasks = require("../background-tasks-DqnQMfuf.cjs");
2
+ const require_background_tasks = require("../background-tasks-BDrYBis-.cjs");
3
3
  exports.BACKGROUND_TASK_WORKFLOW_ID = require_background_tasks.BACKGROUND_TASK_WORKFLOW_ID;
4
4
  exports.BackgroundTaskManager = require_background_tasks.BackgroundTaskManager;
5
5
  exports.backgroundOverrideJsonSchema = require_background_tasks.backgroundOverrideJsonSchema;
@@ -1 +1 @@
1
- export { c as BACKGROUND_TASK_WORKFLOW_ID, s as BackgroundTaskManager, n as backgroundOverrideJsonSchema, r as backgroundOverrideZodSchema, o as createBackgroundTask, t as generateBackgroundTaskSystemPrompt, i as isToolBackgroundEligible, a as resolveBackgroundConfig } from "../background-tasks-BgpX1P_s.js";
1
+ export { c as BACKGROUND_TASK_WORKFLOW_ID, s as BackgroundTaskManager, n as backgroundOverrideJsonSchema, r as backgroundOverrideZodSchema, o as createBackgroundTask, t as generateBackgroundTaskSystemPrompt, i as isToolBackgroundEligible, a as resolveBackgroundConfig } from "../background-tasks-BnJfNLFo.js";
@@ -178,7 +178,7 @@ var BackgroundTaskManager = class {
178
178
  if (handled) await ack?.();
179
179
  };
180
180
  if (this.#mastra) {
181
- const { buildBackgroundTaskWorkflow } = await Promise.resolve().then(() => require("./workflow-CnBPXTpv.cjs"));
181
+ const { buildBackgroundTaskWorkflow } = await Promise.resolve().then(() => require("./workflow-CSjXeNcR.cjs"));
182
182
  const workflow = buildBackgroundTaskWorkflow(this);
183
183
  if (!this.#mastra.__hasInternalWorkflow("__background-task")) this.#mastra.__registerInternalWorkflow(workflow);
184
184
  }
@@ -969,7 +969,7 @@ var BackgroundTaskManager = class {
969
969
  if (isRunningRedelivery && task.leaseExpiresAt && task.leaseExpiresAt.getTime() > Date.now()) return task.ownerId === this.workerId;
970
970
  if (task.status === "pending" && task.ownerId && task.ownerId !== this.workerId) return true;
971
971
  const pinnedHere = task.status === "pending" && task.ownerId === this.workerId;
972
- const retryCount = task.status === "running" ? deliveryAttempt - 1 : task.retryCount;
972
+ const retryCount = task.status === "running" ? Math.max(task.retryCount, deliveryAttempt - 1) : task.retryCount;
973
973
  const now = /* @__PURE__ */ new Date();
974
974
  if (!await storage.updateTask(taskId, {
975
975
  status: "running",
@@ -1602,8 +1602,10 @@ var BackgroundTaskManager = class {
1602
1602
  expectedOwnerId: task.ownerId ?? null,
1603
1603
  expectedLeaseExpiresAt: task.leaseExpiresAt ?? null
1604
1604
  };
1605
- if (task.maxRetries > 0) await storage.updateTask(task.id, {
1605
+ const handedBack = !task.ownerId && task.maxRetries > 0;
1606
+ if (handedBack || task.retryCount < task.maxRetries) await storage.updateTask(task.id, {
1606
1607
  status: "pending",
1608
+ retryCount: handedBack ? task.retryCount : task.retryCount + 1,
1607
1609
  startedAt: void 0,
1608
1610
  ownerId: void 0,
1609
1611
  leaseExpiresAt: void 0
@@ -178,7 +178,7 @@ var BackgroundTaskManager = class {
178
178
  if (handled) await ack?.();
179
179
  };
180
180
  if (this.#mastra) {
181
- const { buildBackgroundTaskWorkflow } = await import("./workflow-CZHY_C85.js");
181
+ const { buildBackgroundTaskWorkflow } = await import("./workflow-CVmI1Sw-.js");
182
182
  const workflow = buildBackgroundTaskWorkflow(this);
183
183
  if (!this.#mastra.__hasInternalWorkflow("__background-task")) this.#mastra.__registerInternalWorkflow(workflow);
184
184
  }
@@ -969,7 +969,7 @@ var BackgroundTaskManager = class {
969
969
  if (isRunningRedelivery && task.leaseExpiresAt && task.leaseExpiresAt.getTime() > Date.now()) return task.ownerId === this.workerId;
970
970
  if (task.status === "pending" && task.ownerId && task.ownerId !== this.workerId) return true;
971
971
  const pinnedHere = task.status === "pending" && task.ownerId === this.workerId;
972
- const retryCount = task.status === "running" ? deliveryAttempt - 1 : task.retryCount;
972
+ const retryCount = task.status === "running" ? Math.max(task.retryCount, deliveryAttempt - 1) : task.retryCount;
973
973
  const now = /* @__PURE__ */ new Date();
974
974
  if (!await storage.updateTask(taskId, {
975
975
  status: "running",
@@ -1602,8 +1602,10 @@ var BackgroundTaskManager = class {
1602
1602
  expectedOwnerId: task.ownerId ?? null,
1603
1603
  expectedLeaseExpiresAt: task.leaseExpiresAt ?? null
1604
1604
  };
1605
- if (task.maxRetries > 0) await storage.updateTask(task.id, {
1605
+ const handedBack = !task.ownerId && task.maxRetries > 0;
1606
+ if (handedBack || task.retryCount < task.maxRetries) await storage.updateTask(task.id, {
1606
1607
  status: "pending",
1608
+ retryCount: handedBack ? task.retryCount : task.retryCount + 1,
1607
1609
  startedAt: void 0,
1608
1610
  ownerId: void 0,
1609
1611
  leaseExpiresAt: void 0
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_base = require("../base-BIzR1D3_.cjs");
3
3
  const require_logger = require("../logger-CvzZYuJd.cjs");
4
- const require_stream = require("../stream-4aNIw_TQ.cjs");
4
+ const require_stream = require("../stream-0kdqBOOn.cjs");
5
5
  const require_tool = require("../tool-CYlT2UA-.cjs");
6
- const require_workspace = require("../workspace-D2drutNg.cjs");
6
+ const require_workspace = require("../workspace-X2RHJZU9.cjs");
7
7
  let events = require("events");
8
8
  let zod = require("zod");
9
9
  let fs = require("fs");
@@ -1,8 +1,8 @@
1
1
  import { t as MastraBase } from "../base-CKLWBhDo.js";
2
2
  import { a as RegisteredLogger } from "../logger-BwbmRqfc.js";
3
- import { nn as isProcessorWorkflow } from "../stream-CJUm6EAH.js";
3
+ import { cn as isProcessorWorkflow } from "../stream-D1y9GzoD.js";
4
4
  import { r as createTool } from "../tool-Z3bykc1m.js";
5
- import { E as browserCliHandler, T as BrowserCliHandler } from "../workspace-D7TIleIt.js";
5
+ import { E as browserCliHandler, T as BrowserCliHandler } from "../workspace-DY2Nxiyi.js";
6
6
  import { EventEmitter } from "events";
7
7
  import { z } from "zod";
8
8
  import { closeSync, existsSync, fstatSync, lstatSync, mkdirSync, openSync, readdirSync, readlinkSync, unlinkSync, writeSync } from "fs";
@@ -1,6 +1,6 @@
1
- import { n as validateDynamicWorkflow, s as inferGraphSchemas, u as schemaCompatibility } from "./validate-CX0yQo_q.js";
1
+ import { n as validateDynamicWorkflow, s as inferGraphSchemas, u as schemaCompatibility } from "./validate-CB-q-R2F.js";
2
2
  import { _ as validateCron } from "./schedules-DZfSx-7P.js";
3
- import { P as Agent } from "./run-registry-DC03XLeZ.js";
3
+ import { N as Agent } from "./run-registry-BwEcwYlU.js";
4
4
  import { z } from "zod";
5
5
  // src/workflows/builder/authoring-playbook.ts
6
6
  const WORKFLOW_BUILDER_AUTHORING_CONSTRAINTS = `# Persisted workflow authoring contract
@@ -1,6 +1,6 @@
1
- const require_validate = require("./validate-CuB_1Zd3.cjs");
1
+ const require_validate = require("./validate-De92squ7.cjs");
2
2
  const require_schedules = require("./schedules-BZS8McF7.cjs");
3
- const require_run_registry = require("./run-registry-5_LQBGn_.cjs");
3
+ const require_run_registry = require("./run-registry-BmckDVBk.cjs");
4
4
  let zod = require("zod");
5
5
  // src/workflows/builder/authoring-playbook.ts
6
6
  const WORKFLOW_BUILDER_AUTHORING_CONSTRAINTS = `# Persisted workflow authoring contract