@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,3 +1,3 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_mastra = require("../mastra-Cn5NC6Es.cjs");
2
+ const require_mastra = require("../mastra-D4hvfuxX.cjs");
3
3
  exports.Mastra = require_mastra.Mastra;
@@ -222,6 +222,11 @@ export interface Config<TAgents extends Record<string, Agent<any>> = Record<stri
222
222
  bundler?: BundlerConfig;
223
223
  /**
224
224
  * Pub/sub system for event-driven communication between components.
225
+ *
226
+ * The default delivers inside this process. Evented workflows and evented
227
+ * agents that run on several processes need a pubsub that redelivers
228
+ * unacknowledged events and a workflows store with step guards.
229
+ * @see https://mastra.ai/docs/server/pubsub#evented-workflows-and-agents
225
230
  * @default EventEmitterPubSub
226
231
  */
227
232
  pubsub?: PubSub;
@@ -1431,6 +1436,14 @@ export declare class Mastra<TAgents extends Record<string, Agent<any>> = Record<
1431
1436
  * @internal
1432
1437
  */
1433
1438
  __hasLocalWorkflowExecution(): boolean;
1439
+ /**
1440
+ * Register the durable experiment workflow (`__mastra-experiment`) once.
1441
+ * Registered `distributed` because every process registers it identically,
1442
+ * so whichever process receives a run's events can execute them.
1443
+ *
1444
+ * @internal
1445
+ */
1446
+ __ensureExperimentWorkflow(): Promise<void>;
1434
1447
  __hasInternalWorkflow(id: string, runId?: string): boolean;
1435
1448
  __getInternalWorkflow(id: string, runId?: string): AnyWorkflow;
1436
1449
  /**
@@ -1 +1 @@
1
- export { t as Mastra } from "../mastra-B8i1UDZs.js";
1
+ export { t as Mastra } from "../mastra-CigBrT7X.js";
@@ -36,5 +36,7 @@ export type ResolveAgentByIdResult = {
36
36
  * confirmed-miss vs. transient-error distinction) can't drift between call
37
37
  * sites.
38
38
  */
39
- export declare function resolveAgentById(mastra: Mastra, agentId: string): Promise<ResolveAgentByIdResult>;
39
+ export declare function resolveAgentById(mastra: Mastra, agentId: string, editorOptions?: {
40
+ versionId: string;
41
+ }): Promise<ResolveAgentByIdResult>;
40
42
  //# sourceMappingURL=resolve-agent.d.ts.map
@@ -1,36 +1,30 @@
1
- import { Cc as createConcurrencyLimiter, Ds as createStep, En as AgentChannels, Lr as dispatchDueNotifications, Oo as augmentWithInit, Os as createWorkflow, Tc as runWithConcurrency, Vl as runOutsideRunFenceScope, Xi as BackgroundTasksInMemory, _c as repeatAfterSettled, br as WorkflowsInMemory, cl as waitMs, dc as createNestedRunParentStatusLookup, dl as isDurableAgentLike, fc as nestedRunParentOf, gc as renewWorkflowLease, hc as WORKFLOW_RUN_LEASE_TTL_MS, js as computeScheduleDefinitionHash, jt as __registerMastraCtor, ko as getStorageSource, ks as WorkflowEventProcessor, l as isDurableAgentExecutionDetached, mc as nestedRunStatusOf, o as getActiveDurableAgentWorkflowExecutions, p as agentThreadStreamRuntime, pc as nestedRunRecoveryAction, r as abandonDurableAgentExecutions, sl as assertDrainTimeout, uc as cancelNestedRun, vr as InMemoryStore, wc as normalizeConcurrency, y as createOnScorerHook } from "./run-registry-DC03XLeZ.js";
2
- import { s as BackgroundTaskManager } from "./background-tasks-BgpX1P_s.js";
1
+ import { Br as dispatchDueNotifications, Cc as WORKFLOW_RUN_LEASE_TTL_MS, Cr as WorkflowsInMemory, Fs as createStep, Io as augmentWithInit, Is as createWorkflow, Lo as getStorageSource, Ls as WorkflowEventProcessor, Mc as normalizeConcurrency, Nc as runWithConcurrency, Sc as nestedRunStatusOf, Tc as repeatAfterSettled, Xl as runOutsideRunFenceScope, bc as nestedRunParentOf, bl as isDurableAgentLike, gl as waitMs, hl as assertDrainTimeout, ia as BackgroundTasksInMemory, jc as createConcurrencyLimiter, jt as __registerMastraCtor, kn as AgentChannels, l as isDurableAgentExecutionDetached, o as getActiveDurableAgentWorkflowExecutions, p as agentThreadStreamRuntime, r as abandonDurableAgentExecutions, vc as cancelNestedRun, vl as hasDurableExecution, wc as renewWorkflowLease, xc as nestedRunRecoveryAction, xr as InMemoryStore, y as createOnScorerHook, yc as createNestedRunParentStatusLookup, zs as computeScheduleDefinitionHash } from "./run-registry-BwEcwYlU.js";
2
+ import { s as BackgroundTaskManager } from "./background-tasks-BnJfNLFo.js";
3
3
  import { t as InMemoryServerCache } from "./inmemory-BDD0w8gx.js";
4
- import { t as DatasetsManager } from "./manager-BsghM-UL.js";
4
+ import { t as DatasetsManager } from "./manager-DfWQCJUK.js";
5
5
  import { i as MastraError, n as ErrorDomain, t as ErrorCategory } from "./error-oh2DLsP2.js";
6
- import { g as EventEmitterPubSub, u as isRunLocalTopic } from "./output-helpers-D4II19No.js";
6
+ import { h as EventEmitterPubSub, u as isRunLocalTopic } from "./output-helpers-CedRCE17.js";
7
7
  import { a as registerHook, r as deregisterHook } from "./hooks-Bth8Cjpj.js";
8
8
  import { LicenseClient } from "./license/index.js";
9
- import { p as getGatewayId } from "./netlify-C-OpNSGp.js";
10
- import { l as defaultGateways } from "./llm-DnXK3Pmw.js";
9
+ import { p as getGatewayId } from "./netlify-CuI1ZrwR.js";
10
+ import { l as defaultGateways } from "./llm-B5A5cwJr.js";
11
11
  import { l as isAdaptableLogger, n as LogLevel, t as ConsoleLogger, u as noopLogger } from "./logger-BwbmRqfc.js";
12
12
  import { DualLogger, createExportSuppressedLogger, isObservabilityExportSuppressed, resolveTraceFields } from "./logger/index.js";
13
13
  import { c as fsAgentScheduleRowId, g as toEpochMs, h as computeNextFireAt, l as parseFsAgentScheduleRowId, m as computeNextFire, t as Schedules } from "./schedules-DZfSx-7P.js";
14
14
  import { C as NoOpObservability, T as noOpMetricsContext, w as noOpLoggerContext } from "./observability-D7RNOAPx.js";
15
15
  import { initContextStorage } from "./observability/context-storage.js";
16
16
  import { f as resolveCurrentSpan } from "./utils-DU_pU5SK.js";
17
- import { r as InMemoryDB } from "./source-Did_2XQc.js";
17
+ import { r as InMemoryDB } from "./source-fNa6u1kH.js";
18
18
  import { r as trackFeatureUsage } from "./feature-telemetry-DdR8J_5o.js";
19
- import { r as isToolLoopAgentLike, t as toolLoopAgentToMastraAgent } from "./tool-loop-agent-FEEwHfmg.js";
19
+ import { r as isToolLoopAgentLike, t as toolLoopAgentToMastraAgent } from "./tool-loop-agent-BdjWGVIb.js";
20
20
  import { r as normalizeToolPayloadTransformPolicy } from "./payload-transform-Dj3HUeD4.js";
21
- import { v as readPositiveIntEnv } from "./utils-Bd_y1_a-.js";
22
- import { i as OrchestrationWorker, n as BackgroundTaskWorker, r as SchedulerWorker } from "./worker-B80xkcKG.js";
23
- import { n as normalizeWorkflowBuilderDefinition } from "./builder-x295GDL6.js";
24
- import { d as toJsonSchemaOrUndefined, p as collectNestedWorkflowIds, t as assertValidDynamicWorkflow } from "./validate-CX0yQo_q.js";
25
- import { t as rehydrateWorkflow } from "./rehydrate-D3fPgJwp.js";
26
- import { Tn as createRunScope } from "./stream-CJUm6EAH.js";
21
+ import { v as readPositiveIntEnv } from "./utils-GHY3hmLx.js";
22
+ import { i as OrchestrationWorker, n as BackgroundTaskWorker, r as SchedulerWorker } from "./worker-C3u_xzY2.js";
23
+ import { n as normalizeWorkflowBuilderDefinition } from "./builder-Cl-0BWkh.js";
24
+ import { d as toJsonSchemaOrUndefined, p as collectNestedWorkflowIds, t as assertValidDynamicWorkflow } from "./validate-CB-q-R2F.js";
25
+ import { t as rehydrateWorkflow } from "./rehydrate-PnaVawGX.js";
26
+ import { jn as createRunScope } from "./stream-D1y9GzoD.js";
27
27
  import { z } from "zod/v4";
28
- // src/agent/streams/execution-capability.ts
29
- /** Native engine selection or the released structural adapter contract (including Inngest). */
30
- function hasDurableExecution(obj) {
31
- if (isDurableAgentLike(obj)) return true;
32
- return typeof obj === "object" && obj !== null && "__hasDurableExecution" in obj && typeof obj.__hasDurableExecution === "function" && obj.__hasDurableExecution() === true;
33
- }
34
28
  // src/notifications/workflow.ts
35
29
  const NOTIFICATION_DISPATCH_WORKFLOW_ID = "__mastra_notification_dispatcher";
36
30
  /**
@@ -2863,6 +2857,19 @@ var Mastra = class Mastra {
2863
2857
  if (this.#pushSubscription) return true;
2864
2858
  return !!this.#workers.find((w) => w.name === "orchestration")?.isRunning;
2865
2859
  }
2860
+ /**
2861
+ * Register the durable experiment workflow (`__mastra-experiment`) once.
2862
+ * Registered `distributed` because every process registers it identically,
2863
+ * so whichever process receives a run's events can execute them.
2864
+ *
2865
+ * @internal
2866
+ */
2867
+ async __ensureExperimentWorkflow() {
2868
+ if (this.__hasInternalWorkflow("__mastra-experiment")) return;
2869
+ const { buildExperimentWorkflow } = await import("./manager-DfWQCJUK.js").then((n) => n.y);
2870
+ if (this.__hasInternalWorkflow("__mastra-experiment")) return;
2871
+ this.__registerInternalWorkflow(buildExperimentWorkflow(), void 0, { distributed: true });
2872
+ }
2866
2873
  __hasInternalWorkflow(id, runId) {
2867
2874
  if (runId) {
2868
2875
  if (this.#internalMastraWorkflows[`${id}:${runId}`]) {
@@ -5053,7 +5060,7 @@ var Mastra = class Mastra {
5053
5060
  if (!this.#workerFilter || this.#workerFilter.has("agent-schedule")) {
5054
5061
  let agentScheduleWorker = this.#findAgentScheduleWorker();
5055
5062
  if (!agentScheduleWorker) {
5056
- const { AgentScheduleWorker } = await import("./worker-DSEfMPmq.js");
5063
+ const { AgentScheduleWorker } = await import("./worker-Kwm8EKcj.js");
5057
5064
  agentScheduleWorker = new AgentScheduleWorker();
5058
5065
  agentScheduleWorker.__registerMastra(this);
5059
5066
  this.#workers.push(agentScheduleWorker);
@@ -5650,6 +5657,7 @@ var Mastra = class Mastra {
5650
5657
  retry: true
5651
5658
  };
5652
5659
  }
5660
+ if (event.data?.workflowId === "__mastra-experiment") await this.__ensureExperimentWorkflow();
5653
5661
  if (!this.#workflowEventProcessor) this.#workflowEventProcessor = new WorkflowEventProcessor({ mastra: this });
5654
5662
  return this.#workflowEventProcessor.handle(event);
5655
5663
  }
@@ -5672,6 +5680,7 @@ var Mastra = class Mastra {
5672
5680
  async startWorkers(name) {
5673
5681
  if (this.#storage) await this.#storage.init();
5674
5682
  this.#initializeDurableAgents();
5683
+ await this.__ensureExperimentWorkflow();
5675
5684
  const schedulerSelected = !this.#schedulerDisabled() && (!this.#workerFilter || this.#workerFilter.has("scheduler"));
5676
5685
  const schedulerForcedByFilter = schedulerSelected && (this.#workerFilter?.has("scheduler") ?? false);
5677
5686
  if (!name && schedulerSelected && this.#storage && !this.#findSchedulerWorker()?.isRunning) try {
@@ -5690,7 +5699,7 @@ var Mastra = class Mastra {
5690
5699
  this.#workers.push(sw);
5691
5700
  }
5692
5701
  if (!this.#findAgentScheduleWorker()) {
5693
- const { AgentScheduleWorker } = await import("./worker-DSEfMPmq.js");
5702
+ const { AgentScheduleWorker } = await import("./worker-Kwm8EKcj.js");
5694
5703
  const asw = new AgentScheduleWorker();
5695
5704
  asw.__registerMastra(this);
5696
5705
  this.#workers.push(asw);
@@ -6135,7 +6144,7 @@ var Mastra = class Mastra {
6135
6144
  #syncGatewayRegistry() {
6136
6145
  try {
6137
6146
  if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") return;
6138
- import("./provider-registry-RZ8EgSe8.js").then((n) => n.d).then(async ({ GatewayRegistry }) => {
6147
+ import("./provider-registry-CmQLzLF_.js").then((n) => n.d).then(async ({ GatewayRegistry }) => {
6139
6148
  const registry = GatewayRegistry.getInstance();
6140
6149
  const customGateways = Object.values(this.#gateways || {});
6141
6150
  registry.registerCustomGateways(customGateways);
@@ -1,36 +1,30 @@
1
- const require_run_registry = require("./run-registry-5_LQBGn_.cjs");
2
- const require_background_tasks = require("./background-tasks-DqnQMfuf.cjs");
1
+ const require_run_registry = require("./run-registry-BmckDVBk.cjs");
2
+ const require_background_tasks = require("./background-tasks-BDrYBis-.cjs");
3
3
  const require_inmemory = require("./inmemory-fgR8sq-U.cjs");
4
- const require_manager = require("./manager-DwFnIrI6.cjs");
4
+ const require_manager = require("./manager-sv35JY-z.cjs");
5
5
  const require_error = require("./error-D90lJ6M7.cjs");
6
- const require_output_helpers = require("./output-helpers-JL-HeCbT.cjs");
6
+ const require_output_helpers = require("./output-helpers-1Zu4Vt9C.cjs");
7
7
  const require_hooks = require("./hooks-D7VDBETj.cjs");
8
8
  const require_license_index = require("./license/index.cjs");
9
- const require_netlify = require("./netlify-C-83Fxus.cjs");
10
- const require_llm = require("./llm-CsQuqKPc.cjs");
9
+ const require_netlify = require("./netlify-BAnn3ouY.cjs");
10
+ const require_llm = require("./llm-8Av3mSjD.cjs");
11
11
  const require_logger = require("./logger-CvzZYuJd.cjs");
12
12
  const require_logger_index = require("./logger/index.cjs");
13
13
  const require_schedules = require("./schedules-BZS8McF7.cjs");
14
14
  const require_observability = require("./observability-B0R_D1PZ.cjs");
15
15
  const require_observability_context_storage = require("./observability/context-storage.cjs");
16
16
  const require_utils = require("./utils-D-eNsgDM.cjs");
17
- const require_source = require("./source-DDwx-87N.cjs");
17
+ const require_source = require("./source-BVOi8Xhp.cjs");
18
18
  const require_feature_telemetry = require("./feature-telemetry-Cw0L1tHo.cjs");
19
- const require_tool_loop_agent = require("./tool-loop-agent-Dn0QCB9n.cjs");
19
+ const require_tool_loop_agent = require("./tool-loop-agent-kWaZAT6Q.cjs");
20
20
  const require_payload_transform = require("./payload-transform-CWgnsO9w.cjs");
21
- const require_utils$1 = require("./utils-DY01hxVd.cjs");
22
- const require_worker = require("./worker-GsGIxPMa.cjs");
23
- const require_builder = require("./builder-D8Osghdo.cjs");
24
- const require_validate = require("./validate-CuB_1Zd3.cjs");
25
- const require_rehydrate = require("./rehydrate-B-wrAN7C.cjs");
26
- const require_stream = require("./stream-4aNIw_TQ.cjs");
21
+ const require_utils$1 = require("./utils-BKUCaZ12.cjs");
22
+ const require_worker = require("./worker-CAKvQj9_.cjs");
23
+ const require_builder = require("./builder-Cw8u3pPl.cjs");
24
+ const require_validate = require("./validate-De92squ7.cjs");
25
+ const require_rehydrate = require("./rehydrate-CDQ4dOYj.cjs");
26
+ const require_stream = require("./stream-0kdqBOOn.cjs");
27
27
  let zod_v4 = require("zod/v4");
28
- // src/agent/streams/execution-capability.ts
29
- /** Native engine selection or the released structural adapter contract (including Inngest). */
30
- function hasDurableExecution(obj) {
31
- if (require_run_registry.isDurableAgentLike(obj)) return true;
32
- return typeof obj === "object" && obj !== null && "__hasDurableExecution" in obj && typeof obj.__hasDurableExecution === "function" && obj.__hasDurableExecution() === true;
33
- }
34
28
  // src/notifications/workflow.ts
35
29
  const NOTIFICATION_DISPATCH_WORKFLOW_ID = "__mastra_notification_dispatcher";
36
30
  /**
@@ -2863,6 +2857,19 @@ var Mastra = class Mastra {
2863
2857
  if (this.#pushSubscription) return true;
2864
2858
  return !!this.#workers.find((w) => w.name === "orchestration")?.isRunning;
2865
2859
  }
2860
+ /**
2861
+ * Register the durable experiment workflow (`__mastra-experiment`) once.
2862
+ * Registered `distributed` because every process registers it identically,
2863
+ * so whichever process receives a run's events can execute them.
2864
+ *
2865
+ * @internal
2866
+ */
2867
+ async __ensureExperimentWorkflow() {
2868
+ if (this.__hasInternalWorkflow("__mastra-experiment")) return;
2869
+ const { buildExperimentWorkflow } = await Promise.resolve().then(() => require("./manager-sv35JY-z.cjs")).then((n) => n.workflow_exports);
2870
+ if (this.__hasInternalWorkflow("__mastra-experiment")) return;
2871
+ this.__registerInternalWorkflow(buildExperimentWorkflow(), void 0, { distributed: true });
2872
+ }
2866
2873
  __hasInternalWorkflow(id, runId) {
2867
2874
  if (runId) {
2868
2875
  if (this.#internalMastraWorkflows[`${id}:${runId}`]) {
@@ -3505,7 +3512,7 @@ var Mastra = class Mastra {
3505
3512
  };
3506
3513
  }
3507
3514
  const durableAgents = [];
3508
- for (const agent of Object.values(this.#agents ?? {})) if (agent && hasDurableExecution(agent)) durableAgents.push(agent);
3515
+ for (const agent of Object.values(this.#agents ?? {})) if (agent && require_run_registry.hasDurableExecution(agent)) durableAgents.push(agent);
3509
3516
  if (durableAgents.length === 0) return {
3510
3517
  agents: 0,
3511
3518
  recovered: 0,
@@ -5053,7 +5060,7 @@ var Mastra = class Mastra {
5053
5060
  if (!this.#workerFilter || this.#workerFilter.has("agent-schedule")) {
5054
5061
  let agentScheduleWorker = this.#findAgentScheduleWorker();
5055
5062
  if (!agentScheduleWorker) {
5056
- const { AgentScheduleWorker } = await Promise.resolve().then(() => require("./worker-CbaSmip-.cjs"));
5063
+ const { AgentScheduleWorker } = await Promise.resolve().then(() => require("./worker-BbWPQuPR.cjs"));
5057
5064
  agentScheduleWorker = new AgentScheduleWorker();
5058
5065
  agentScheduleWorker.__registerMastra(this);
5059
5066
  this.#workers.push(agentScheduleWorker);
@@ -5628,7 +5635,7 @@ var Mastra = class Mastra {
5628
5635
  }
5629
5636
  /** Build native durable agents' engines and register their workflows, so event ownership checks can find them. */
5630
5637
  #initializeDurableAgents() {
5631
- for (const agent of Object.values(this.#agents ?? {})) if (hasDurableExecution(agent) && !require_run_registry.isDurableAgentLike(agent)) agent.__initializeDurableExecution();
5638
+ for (const agent of Object.values(this.#agents ?? {})) if (require_run_registry.hasDurableExecution(agent) && !require_run_registry.isDurableAgentLike(agent)) agent.__initializeDurableExecution();
5632
5639
  }
5633
5640
  /**
5634
5641
  * Process a single workflow event. Shared entry point used by:
@@ -5650,6 +5657,7 @@ var Mastra = class Mastra {
5650
5657
  retry: true
5651
5658
  };
5652
5659
  }
5660
+ if (event.data?.workflowId === "__mastra-experiment") await this.__ensureExperimentWorkflow();
5653
5661
  if (!this.#workflowEventProcessor) this.#workflowEventProcessor = new require_run_registry.WorkflowEventProcessor({ mastra: this });
5654
5662
  return this.#workflowEventProcessor.handle(event);
5655
5663
  }
@@ -5672,6 +5680,7 @@ var Mastra = class Mastra {
5672
5680
  async startWorkers(name) {
5673
5681
  if (this.#storage) await this.#storage.init();
5674
5682
  this.#initializeDurableAgents();
5683
+ await this.__ensureExperimentWorkflow();
5675
5684
  const schedulerSelected = !this.#schedulerDisabled() && (!this.#workerFilter || this.#workerFilter.has("scheduler"));
5676
5685
  const schedulerForcedByFilter = schedulerSelected && (this.#workerFilter?.has("scheduler") ?? false);
5677
5686
  if (!name && schedulerSelected && this.#storage && !this.#findSchedulerWorker()?.isRunning) try {
@@ -5690,7 +5699,7 @@ var Mastra = class Mastra {
5690
5699
  this.#workers.push(sw);
5691
5700
  }
5692
5701
  if (!this.#findAgentScheduleWorker()) {
5693
- const { AgentScheduleWorker } = await Promise.resolve().then(() => require("./worker-CbaSmip-.cjs"));
5702
+ const { AgentScheduleWorker } = await Promise.resolve().then(() => require("./worker-BbWPQuPR.cjs"));
5694
5703
  const asw = new AgentScheduleWorker();
5695
5704
  asw.__registerMastra(this);
5696
5705
  this.#workers.push(asw);
@@ -6135,7 +6144,7 @@ var Mastra = class Mastra {
6135
6144
  #syncGatewayRegistry() {
6136
6145
  try {
6137
6146
  if (process.env.MASTRA_DEV !== "true" && process.env.MASTRA_DEV !== "1") return;
6138
- Promise.resolve().then(() => require("./provider-registry-9O-H9osy.cjs")).then((n) => n.provider_registry_exports).then(async ({ GatewayRegistry }) => {
6147
+ Promise.resolve().then(() => require("./provider-registry-BwuI_IpT.cjs")).then((n) => n.provider_registry_exports).then(async ({ GatewayRegistry }) => {
6139
6148
  const registry = GatewayRegistry.getInstance();
6140
6149
  const customGateways = Object.values(this.#gateways || {});
6141
6150
  registry.registerCustomGateways(customGateways);
@@ -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
  exports.AUTHORED_USER_TURN = require_message_list.AUTHORED_USER_TURN;
6
6
  exports.DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS = require_run_registry.DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS;
7
7
  exports.MESSAGE_EMBEDDING_CHARS_PER_TOKEN = require_run_registry.MESSAGE_EMBEDDING_CHARS_PER_TOKEN;
@@ -1,4 +1,4 @@
1
- import { Bt as TITLE_PINNED_THREAD_METADATA_KEY, Gt as setThreadOMMetadata, Ht as isObservationalMemoryEnabled, Ut as isThreadTitlePinned, Vt as getThreadOMMetadata, Wt as parseMemoryRequestContext } from "../stream-CJUm6EAH.js";
2
- import { $o as normalizeMessageHistoryConfig, Co as MastraMemory, Do as isSystemReminderMessage, Eo as filterSystemReminderMessages, Jn as getMemoryRunState, Jo as groupLinkedToolMessages, Qo as isAfterMemoryTokenBoundary, So as upsertMessageVectors, To as memoryDefaultOptions, Xo as advanceMemoryTokenBoundary, Yn as MockMemory, Yo as loadMessageHistory, Zo as getMemoryTokenBoundary, _o as buildMessageEmbeddingRows, bo as messageVectorId, go as MESSAGE_EMBEDDING_CHARS_PER_TOKEN, ho as DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS, qn as MemoryRunState, vo as chunkMessageText, wo as MemoryProcessor, xo as resolveMaxChunkChars, yo as extractMessageEmbeddingText } from "../run-registry-DC03XLeZ.js";
3
- import { $ as AUTHORED_USER_TURN, C as extractWorkingMemoryTags, D as removeWorkingMemoryToolInvocationParts, E as removeWorkingMemoryTags, O as removeWorkingMemoryToolInvocations, S as extractWorkingMemoryContent, T as removeSystemReminderTags, _ as SYSTEM_REMINDER_START_TAG, at as stripClientAuthoredTurnMarks, b as WORKING_MEMORY_START_TAG, et as asUserTurn, g as SYSTEM_REMINDER_END_TAG, h as SET_WORKING_MEMORY_TOOL_NAME, it as sealUserTurnMessage, nt as messageDeclaresAuthoredTurn, rt as sealTurnMarkup, tt as escapeTurnMarkup, v as UPDATE_WORKING_MEMORY_TOOL_NAME, w as isWorkingMemoryToolName, x as WORKING_MEMORY_TOOL_NAMES, y as WORKING_MEMORY_END_TAG } from "../message-list-DEuRl82K.js";
1
+ import { Ao as upsertMessageVectors, Co as DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS, Do as extractMessageEmbeddingText, Eo as chunkMessageText, Fo as isSystemReminderMessage, Mo as MemoryProcessor, No as memoryDefaultOptions, Oo as messageVectorId, Po as filterSystemReminderMessages, Qn as MockMemory, To as buildMessageEmbeddingRows, Xn as MemoryRunState, Zn as getMemoryRunState, as as getMemoryTokenBoundary, is as advanceMemoryTokenBoundary, jo as MastraMemory, ko as resolveMaxChunkChars, ns as groupLinkedToolMessages, os as isAfterMemoryTokenBoundary, rs as loadMessageHistory, ss as normalizeMessageHistoryConfig, wo as MESSAGE_EMBEDDING_CHARS_PER_TOKEN } from "../run-registry-BwEcwYlU.js";
2
+ import { Jt as isObservationalMemoryEnabled, Kt as TITLE_PINNED_THREAD_METADATA_KEY, Xt as parseMemoryRequestContext, Yt as isThreadTitlePinned, Zt as setThreadOMMetadata, qt as getThreadOMMetadata } from "../stream-D1y9GzoD.js";
3
+ import { $ as AUTHORED_USER_TURN, C as extractWorkingMemoryTags, D as removeWorkingMemoryToolInvocationParts, E as removeWorkingMemoryTags, O as removeWorkingMemoryToolInvocations, S as extractWorkingMemoryContent, T as removeSystemReminderTags, _ as SYSTEM_REMINDER_START_TAG, at as stripClientAuthoredTurnMarks, b as WORKING_MEMORY_START_TAG, et as asUserTurn, g as SYSTEM_REMINDER_END_TAG, h as SET_WORKING_MEMORY_TOOL_NAME, it as sealUserTurnMessage, nt as messageDeclaresAuthoredTurn, rt as sealTurnMarkup, tt as escapeTurnMarkup, v as UPDATE_WORKING_MEMORY_TOOL_NAME, w as isWorkingMemoryToolName, x as WORKING_MEMORY_TOOL_NAMES, y as WORKING_MEMORY_END_TAG } from "../message-list-KRbg-TnI.js";
4
4
  export { AUTHORED_USER_TURN, DEFAULT_MESSAGE_EMBEDDING_MAX_CHUNK_CHARS, MESSAGE_EMBEDDING_CHARS_PER_TOKEN, MastraMemory, MemoryProcessor, MemoryRunState, MockMemory, SET_WORKING_MEMORY_TOOL_NAME, SYSTEM_REMINDER_END_TAG, SYSTEM_REMINDER_START_TAG, TITLE_PINNED_THREAD_METADATA_KEY, UPDATE_WORKING_MEMORY_TOOL_NAME, WORKING_MEMORY_END_TAG, WORKING_MEMORY_START_TAG, WORKING_MEMORY_TOOL_NAMES, advanceMemoryTokenBoundary, asUserTurn, buildMessageEmbeddingRows, chunkMessageText, escapeTurnMarkup, extractMessageEmbeddingText, extractWorkingMemoryContent, extractWorkingMemoryTags, filterSystemReminderMessages, getMemoryRunState, getMemoryTokenBoundary, getThreadOMMetadata, groupLinkedToolMessages, isAfterMemoryTokenBoundary, isObservationalMemoryEnabled, isSystemReminderMessage, isThreadTitlePinned, isWorkingMemoryToolName, loadMessageHistory, memoryDefaultOptions, messageDeclaresAuthoredTurn, messageVectorId, normalizeMessageHistoryConfig, parseMemoryRequestContext, removeSystemReminderTags, removeWorkingMemoryTags, removeWorkingMemoryToolInvocationParts, removeWorkingMemoryToolInvocations, resolveMaxChunkChars, sealTurnMarkup, sealUserTurnMessage, setThreadOMMetadata, stripClientAuthoredTurnMarks, upsertMessageVectors };
@@ -533,7 +533,8 @@ function dropCrossProviderExecutedParts(messages, dbMessages, targetProvider, lo
533
533
  * @see https://github.com/mastra-ai/mastra/issues/11376 - Anthropic models fail with empty object tool input
534
534
  */
535
535
  function ensureAnthropicCompatibleMessages(messages, dbMessages) {
536
- return messages.map((msg) => enrichToolResultsWithInput(msg, dbMessages));
536
+ const getToolCallArgs = createToolCallArgsLookup(dbMessages);
537
+ return messages.map((msg) => enrichToolResultsWithInput(msg, getToolCallArgs));
537
538
  }
538
539
  /**
539
540
  * Tool call ids in the assistant message at `index` that already have a matching tool_result,
@@ -650,14 +651,14 @@ function pairOrphanedToolCalls(messages) {
650
651
  /**
651
652
  * Enriches a single message's tool-result parts with input field
652
653
  */
653
- function enrichToolResultsWithInput(message, dbMessages) {
654
+ function enrichToolResultsWithInput(message, getToolCallArgs) {
654
655
  if (message.role !== "tool" || !Array.isArray(message.content)) return message;
655
656
  return {
656
657
  ...message,
657
658
  content: message.content.map((part) => {
658
659
  if (part.type === "tool-result") return {
659
660
  ...part,
660
- input: findToolCallArgs(dbMessages, part.toolCallId)
661
+ input: getToolCallArgs(part.toolCallId)
661
662
  };
662
663
  return part;
663
664
  })
@@ -705,6 +706,35 @@ function getResponseProviderItemIdFromPart(part) {
705
706
  const partAny = part;
706
707
  return getResponseProviderItemId(partAny.providerMetadata) || getResponseProviderItemId(partAny.providerOptions);
707
708
  }
709
+ function createToolCallArgsLookup(messages) {
710
+ let byId;
711
+ return (toolCallId) => {
712
+ if (!byId) {
713
+ byId = /* @__PURE__ */ new Map();
714
+ for (let i = messages.length - 1; i >= 0; i--) {
715
+ const message = messages[i];
716
+ if (!message || message.role !== "assistant") continue;
717
+ const seen = /* @__PURE__ */ new Set();
718
+ for (const part of message.content.parts ?? []) {
719
+ if (part.type !== "tool-invocation") continue;
720
+ const invocation = part.toolInvocation;
721
+ if (seen.has(invocation.toolCallId)) continue;
722
+ seen.add(invocation.toolCallId);
723
+ const args = invocation.args;
724
+ if (!byId.has(invocation.toolCallId) && args && typeof args === "object" && Object.keys(args).length > 0) byId.set(invocation.toolCallId, args);
725
+ }
726
+ seen.clear();
727
+ for (const invocation of message.content.toolInvocations ?? []) {
728
+ if (seen.has(invocation.toolCallId)) continue;
729
+ seen.add(invocation.toolCallId);
730
+ const args = invocation.args;
731
+ if (!byId.has(invocation.toolCallId) && args && typeof args === "object" && Object.keys(args).length > 0) byId.set(invocation.toolCallId, args);
732
+ }
733
+ }
734
+ }
735
+ return byId.get(toolCallId) ?? {};
736
+ };
737
+ }
708
738
  /**
709
739
  * Finds the tool call args for a given toolCallId by searching through messages.
710
740
  * This is used to reconstruct the input field when converting tool-result parts to StaticToolResult.
@@ -10976,10 +11006,13 @@ function messagesAreEqual(one, two) {
10976
11006
  }
10977
11007
  /**
10978
11008
  * The parts as memory persists them: `updateWorkingMemory` tool steps removed, and
10979
- * `<working_memory>` tags and surrounding whitespace stripped from text.
11009
+ * `<working_memory>` tags and surrounding whitespace stripped from text. Observational
11010
+ * memory's `data-om-*` marker parts are also left out: it writes them onto the stored copy
11011
+ * only (when it has no live message list to add them to), so a stored copy that gained one
11012
+ * is still the same message.
10980
11013
  */
10981
11014
  function projectPartsForPersistence(parts) {
10982
- return removeWorkingMemoryToolInvocationParts(parts).map((part) => part.type === "text" ? {
11015
+ return removeWorkingMemoryToolInvocationParts(parts).filter((part) => !part.type.startsWith("data-om-")).map((part) => part.type === "text" ? {
10983
11016
  ...part,
10984
11017
  text: removeWorkingMemoryTags(typeof part.text === "string" ? part.text : "").trim()
10985
11018
  } : part);
@@ -11760,10 +11793,11 @@ var StepContentExtractor = class StepContentExtractor {
11760
11793
  type: "text",
11761
11794
  text: latest.content
11762
11795
  }];
11796
+ const getToolCallArgs = createToolCallArgsLookup(dbMessages);
11763
11797
  return latest.content.map((c) => {
11764
11798
  if (c.type === "tool-result") return {
11765
11799
  type: "tool-result",
11766
- input: findToolCallArgs(dbMessages, c.toolCallId),
11800
+ input: getToolCallArgs(c.toolCallId),
11767
11801
  output: c.output,
11768
11802
  toolCallId: c.toolCallId,
11769
11803
  toolName: c.toolName
@@ -13148,6 +13182,7 @@ var MessageList = class MessageList {
13148
13182
  stateManager = new MessageStateManager();
13149
13183
  #prunedResponseMessages = /* @__PURE__ */ new Map();
13150
13184
  #embeddedMessages = /* @__PURE__ */ new Map();
13185
+ #messagesToResave = /* @__PURE__ */ new Set();
13151
13186
  get memoryMessages() {
13152
13187
  return this.stateManager.getMemoryMessages();
13153
13188
  }
@@ -13405,11 +13440,13 @@ var MessageList = class MessageList {
13405
13440
  }
13406
13441
  /** @internal */
13407
13442
  clone() {
13408
- return new MessageList({
13443
+ const clone = new MessageList({
13409
13444
  generateMessageId: this.generateMessageId,
13410
13445
  logger: this.logger,
13411
13446
  filterIncompleteToolCalls: this.filterIncompleteToolCalls
13412
13447
  }).deserialize(this.serialize());
13448
+ for (const id of this.#messagesToResave) clone.#messagesToResave.add(id);
13449
+ return clone;
13413
13450
  }
13414
13451
  /**
13415
13452
  * Return the transcript view that persistence-oriented output processors should store.
@@ -14063,6 +14100,21 @@ var MessageList = class MessageList {
14063
14100
  this.unavailableAttachmentUpdates.clear();
14064
14101
  return updates;
14065
14102
  }
14103
+ /**
14104
+ * Mark a message already in this list as changed after it was loaded, so the next save writes it
14105
+ * again through the normal whole-message save. It is not reported as new input, output or source.
14106
+ * Messages that are not in the list are ignored.
14107
+ */
14108
+ markForResave(message) {
14109
+ if (this.messages.some((m) => m.id === message.id)) this.#messagesToResave.add(message.id);
14110
+ }
14111
+ /**
14112
+ * The messages marked with {@link markForResave} and not yet drained. For save paths that read the
14113
+ * list instead of draining it; they pick these up next to the new input and response.
14114
+ */
14115
+ getMessagesToResave() {
14116
+ return this.messages.filter((m) => this.#messagesToResave.has(m.id));
14117
+ }
14066
14118
  drainUnsavedMessages() {
14067
14119
  return this.drainUnsavedMessagesForSave().messages;
14068
14120
  }
@@ -14073,14 +14125,17 @@ var MessageList = class MessageList {
14073
14125
  drainUnsavedMessagesForSave() {
14074
14126
  const userMessages = [...this.newUserMessages];
14075
14127
  const responseMessages = [...this.newResponseMessages];
14076
- const messages = this.messages.filter((m) => this.newUserMessages.has(m) || this.newResponseMessages.has(m));
14128
+ const resaveIds = [...this.#messagesToResave];
14129
+ const messages = this.messages.filter((m) => this.newUserMessages.has(m) || this.newResponseMessages.has(m) || this.#messagesToResave.has(m.id));
14077
14130
  this.newUserMessages.clear();
14078
14131
  this.newResponseMessages.clear();
14132
+ this.#messagesToResave.clear();
14079
14133
  return {
14080
14134
  messages: messages.map((message) => this.transformMessageForTranscript(message)),
14081
14135
  restore: () => {
14082
14136
  for (const message of userMessages) if (this.messages.includes(message)) this.newUserMessages.add(message);
14083
14137
  for (const message of responseMessages) if (this.messages.includes(message)) this.newResponseMessages.add(message);
14138
+ for (const id of resaveIds) if (this.messages.some((m) => m.id === id)) this.#messagesToResave.add(id);
14084
14139
  }
14085
14140
  };
14086
14141
  }
@@ -533,7 +533,8 @@ function dropCrossProviderExecutedParts(messages, dbMessages, targetProvider, lo
533
533
  * @see https://github.com/mastra-ai/mastra/issues/11376 - Anthropic models fail with empty object tool input
534
534
  */
535
535
  function ensureAnthropicCompatibleMessages(messages, dbMessages) {
536
- return messages.map((msg) => enrichToolResultsWithInput(msg, dbMessages));
536
+ const getToolCallArgs = createToolCallArgsLookup(dbMessages);
537
+ return messages.map((msg) => enrichToolResultsWithInput(msg, getToolCallArgs));
537
538
  }
538
539
  /**
539
540
  * Tool call ids in the assistant message at `index` that already have a matching tool_result,
@@ -650,14 +651,14 @@ function pairOrphanedToolCalls(messages) {
650
651
  /**
651
652
  * Enriches a single message's tool-result parts with input field
652
653
  */
653
- function enrichToolResultsWithInput(message, dbMessages) {
654
+ function enrichToolResultsWithInput(message, getToolCallArgs) {
654
655
  if (message.role !== "tool" || !Array.isArray(message.content)) return message;
655
656
  return {
656
657
  ...message,
657
658
  content: message.content.map((part) => {
658
659
  if (part.type === "tool-result") return {
659
660
  ...part,
660
- input: findToolCallArgs(dbMessages, part.toolCallId)
661
+ input: getToolCallArgs(part.toolCallId)
661
662
  };
662
663
  return part;
663
664
  })
@@ -705,6 +706,35 @@ function getResponseProviderItemIdFromPart(part) {
705
706
  const partAny = part;
706
707
  return getResponseProviderItemId(partAny.providerMetadata) || getResponseProviderItemId(partAny.providerOptions);
707
708
  }
709
+ function createToolCallArgsLookup(messages) {
710
+ let byId;
711
+ return (toolCallId) => {
712
+ if (!byId) {
713
+ byId = /* @__PURE__ */ new Map();
714
+ for (let i = messages.length - 1; i >= 0; i--) {
715
+ const message = messages[i];
716
+ if (!message || message.role !== "assistant") continue;
717
+ const seen = /* @__PURE__ */ new Set();
718
+ for (const part of message.content.parts ?? []) {
719
+ if (part.type !== "tool-invocation") continue;
720
+ const invocation = part.toolInvocation;
721
+ if (seen.has(invocation.toolCallId)) continue;
722
+ seen.add(invocation.toolCallId);
723
+ const args = invocation.args;
724
+ if (!byId.has(invocation.toolCallId) && args && typeof args === "object" && Object.keys(args).length > 0) byId.set(invocation.toolCallId, args);
725
+ }
726
+ seen.clear();
727
+ for (const invocation of message.content.toolInvocations ?? []) {
728
+ if (seen.has(invocation.toolCallId)) continue;
729
+ seen.add(invocation.toolCallId);
730
+ const args = invocation.args;
731
+ if (!byId.has(invocation.toolCallId) && args && typeof args === "object" && Object.keys(args).length > 0) byId.set(invocation.toolCallId, args);
732
+ }
733
+ }
734
+ }
735
+ return byId.get(toolCallId) ?? {};
736
+ };
737
+ }
708
738
  /**
709
739
  * Finds the tool call args for a given toolCallId by searching through messages.
710
740
  * This is used to reconstruct the input field when converting tool-result parts to StaticToolResult.
@@ -10976,10 +11006,13 @@ function messagesAreEqual(one, two) {
10976
11006
  }
10977
11007
  /**
10978
11008
  * The parts as memory persists them: `updateWorkingMemory` tool steps removed, and
10979
- * `<working_memory>` tags and surrounding whitespace stripped from text.
11009
+ * `<working_memory>` tags and surrounding whitespace stripped from text. Observational
11010
+ * memory's `data-om-*` marker parts are also left out: it writes them onto the stored copy
11011
+ * only (when it has no live message list to add them to), so a stored copy that gained one
11012
+ * is still the same message.
10980
11013
  */
10981
11014
  function projectPartsForPersistence(parts) {
10982
- return removeWorkingMemoryToolInvocationParts(parts).map((part) => part.type === "text" ? {
11015
+ return removeWorkingMemoryToolInvocationParts(parts).filter((part) => !part.type.startsWith("data-om-")).map((part) => part.type === "text" ? {
10983
11016
  ...part,
10984
11017
  text: removeWorkingMemoryTags(typeof part.text === "string" ? part.text : "").trim()
10985
11018
  } : part);
@@ -11759,10 +11792,11 @@ var StepContentExtractor = class StepContentExtractor {
11759
11792
  type: "text",
11760
11793
  text: latest.content
11761
11794
  }];
11795
+ const getToolCallArgs = createToolCallArgsLookup(dbMessages);
11762
11796
  return latest.content.map((c) => {
11763
11797
  if (c.type === "tool-result") return {
11764
11798
  type: "tool-result",
11765
- input: findToolCallArgs(dbMessages, c.toolCallId),
11799
+ input: getToolCallArgs(c.toolCallId),
11766
11800
  output: c.output,
11767
11801
  toolCallId: c.toolCallId,
11768
11802
  toolName: c.toolName
@@ -13147,6 +13181,7 @@ var MessageList = class MessageList {
13147
13181
  stateManager = new MessageStateManager();
13148
13182
  #prunedResponseMessages = /* @__PURE__ */ new Map();
13149
13183
  #embeddedMessages = /* @__PURE__ */ new Map();
13184
+ #messagesToResave = /* @__PURE__ */ new Set();
13150
13185
  get memoryMessages() {
13151
13186
  return this.stateManager.getMemoryMessages();
13152
13187
  }
@@ -13404,11 +13439,13 @@ var MessageList = class MessageList {
13404
13439
  }
13405
13440
  /** @internal */
13406
13441
  clone() {
13407
- return new MessageList({
13442
+ const clone = new MessageList({
13408
13443
  generateMessageId: this.generateMessageId,
13409
13444
  logger: this.logger,
13410
13445
  filterIncompleteToolCalls: this.filterIncompleteToolCalls
13411
13446
  }).deserialize(this.serialize());
13447
+ for (const id of this.#messagesToResave) clone.#messagesToResave.add(id);
13448
+ return clone;
13412
13449
  }
13413
13450
  /**
13414
13451
  * Return the transcript view that persistence-oriented output processors should store.
@@ -14062,6 +14099,21 @@ var MessageList = class MessageList {
14062
14099
  this.unavailableAttachmentUpdates.clear();
14063
14100
  return updates;
14064
14101
  }
14102
+ /**
14103
+ * Mark a message already in this list as changed after it was loaded, so the next save writes it
14104
+ * again through the normal whole-message save. It is not reported as new input, output or source.
14105
+ * Messages that are not in the list are ignored.
14106
+ */
14107
+ markForResave(message) {
14108
+ if (this.messages.some((m) => m.id === message.id)) this.#messagesToResave.add(message.id);
14109
+ }
14110
+ /**
14111
+ * The messages marked with {@link markForResave} and not yet drained. For save paths that read the
14112
+ * list instead of draining it; they pick these up next to the new input and response.
14113
+ */
14114
+ getMessagesToResave() {
14115
+ return this.messages.filter((m) => this.#messagesToResave.has(m.id));
14116
+ }
14065
14117
  drainUnsavedMessages() {
14066
14118
  return this.drainUnsavedMessagesForSave().messages;
14067
14119
  }
@@ -14072,14 +14124,17 @@ var MessageList = class MessageList {
14072
14124
  drainUnsavedMessagesForSave() {
14073
14125
  const userMessages = [...this.newUserMessages];
14074
14126
  const responseMessages = [...this.newResponseMessages];
14075
- const messages = this.messages.filter((m) => this.newUserMessages.has(m) || this.newResponseMessages.has(m));
14127
+ const resaveIds = [...this.#messagesToResave];
14128
+ const messages = this.messages.filter((m) => this.newUserMessages.has(m) || this.newResponseMessages.has(m) || this.#messagesToResave.has(m.id));
14076
14129
  this.newUserMessages.clear();
14077
14130
  this.newResponseMessages.clear();
14131
+ this.#messagesToResave.clear();
14078
14132
  return {
14079
14133
  messages: messages.map((message) => this.transformMessageForTranscript(message)),
14080
14134
  restore: () => {
14081
14135
  for (const message of userMessages) if (this.messages.includes(message)) this.newUserMessages.add(message);
14082
14136
  for (const message of responseMessages) if (this.messages.includes(message)) this.newResponseMessages.add(message);
14137
+ for (const id of resaveIds) if (this.messages.some((m) => m.id === id)) this.#messagesToResave.add(id);
14083
14138
  }
14084
14139
  };
14085
14140
  }
@@ -3,7 +3,7 @@ const require_base = require("./base-BIzR1D3_.cjs");
3
3
  const require_error = require("./error-D90lJ6M7.cjs");
4
4
  const require_utils = require("./utils-D-eNsgDM.cjs");
5
5
  const require_observability = require("./observability-B0R_D1PZ.cjs");
6
- const require_utils$1 = require("./utils-DY01hxVd.cjs");
6
+ const require_utils$1 = require("./utils-BKUCaZ12.cjs");
7
7
  const require_zod_utils = require("./zod-utils-Cl5jw5N_.cjs");
8
8
  let _mastra_schema_compat = require("@mastra/schema-compat");
9
9
  let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");