@mastra/core 1.87.0-alpha.1 → 1.87.0-alpha.4

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 (420) hide show
  1. package/dist/_types/@ai-sdk_openai@4.0.106/dist/index.d.ts +2034 -0
  2. package/dist/_types/@ai-sdk_openai@4.0.106/package.json +1 -0
  3. package/dist/a2a/index.cjs +1 -1
  4. package/dist/a2a/index.js +1 -1
  5. package/dist/agent/durable/index.cjs +1 -1
  6. package/dist/agent/durable/index.js +1 -1
  7. package/dist/agent/durable/run-message-refs.d.ts +3 -2
  8. package/dist/agent/index.cjs +4 -4
  9. package/dist/agent/index.js +4 -4
  10. package/dist/agent/message-list/adapters/AIV5Adapter.d.ts +15 -1
  11. package/dist/agent/message-list/index.cjs +2 -2
  12. package/dist/agent/message-list/index.js +2 -2
  13. package/dist/agent/message-list/state/types.d.ts +5 -1
  14. package/dist/agent/message-list/types.d.ts +1 -1
  15. package/dist/agent/message-list/utils/provider-compat.d.ts +9 -1
  16. package/dist/agent-builder/ee/index.cjs +1 -1
  17. package/dist/agent-builder/ee/index.js +1 -1
  18. package/dist/agent-controller/index.cjs +2 -2
  19. package/dist/agent-controller/index.js +2 -2
  20. package/dist/{agent-controller-BTIxiD1u.cjs → agent-controller-CqcyudV6.cjs} +8 -8
  21. package/dist/{agent-controller-C1bK0CXm.js → agent-controller-VBMIPr6h.js} +8 -8
  22. package/dist/background-tasks/index.cjs +1 -1
  23. package/dist/background-tasks/index.js +1 -1
  24. package/dist/{background-tasks-BbVsBghi.js → background-tasks-1tyymY2H.js} +1 -1
  25. package/dist/{background-tasks-CVl6e0Jo.cjs → background-tasks-FOaQ1LsS.cjs} +1 -1
  26. package/dist/browser/index.cjs +2 -2
  27. package/dist/browser/index.js +2 -2
  28. package/dist/{builder-C8XzrtBQ.js → builder-CUbE9d87.js} +2 -2
  29. package/dist/{builder-BRJPSTig.cjs → builder-MLhVrFJw.cjs} +2 -2
  30. package/dist/capabilities/302ai.json +203 -203
  31. package/dist/capabilities/abliteratedllm.json +33 -33
  32. package/dist/capabilities/abliteration-ai.json +9 -9
  33. package/dist/capabilities/above.json +18 -18
  34. package/dist/capabilities/adaption.json +16 -16
  35. package/dist/capabilities/adzuki.json +20 -20
  36. package/dist/capabilities/agentrouter.json +11 -11
  37. package/dist/capabilities/agnes.json +3 -3
  38. package/dist/capabilities/ai-router.json +5 -5
  39. package/dist/capabilities/aiand.json +17 -17
  40. package/dist/capabilities/aigrow.json +11 -11
  41. package/dist/capabilities/aimlapi.json +153 -156
  42. package/dist/capabilities/aipg.json +2 -2
  43. package/dist/capabilities/aixy.json +14 -14
  44. package/dist/capabilities/aki-io.json +15 -15
  45. package/dist/capabilities/alibaba-cn.json +98 -98
  46. package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
  47. package/dist/capabilities/alibaba-coding-plan.json +5 -5
  48. package/dist/capabilities/alibaba-token-plan-cn.json +55 -55
  49. package/dist/capabilities/alibaba-token-plan.json +54 -54
  50. package/dist/capabilities/alibaba.json +67 -67
  51. package/dist/capabilities/ambient.json +19 -12
  52. package/dist/capabilities/amd.json +6 -6
  53. package/dist/capabilities/anthropic.json +47 -47
  54. package/dist/capabilities/anyapi.json +15 -15
  55. package/dist/capabilities/apiko.json +5 -5
  56. package/dist/capabilities/arcee.json +7 -7
  57. package/dist/capabilities/augure.json +6 -6
  58. package/dist/capabilities/auriko.json +19 -19
  59. package/dist/capabilities/bailing.json +5 -5
  60. package/dist/capabilities/baseten.json +25 -25
  61. package/dist/capabilities/bee.json +4 -4
  62. package/dist/capabilities/bothub.json +11 -11
  63. package/dist/capabilities/boundless.json +39 -39
  64. package/dist/capabilities/bumo.json +40 -40
  65. package/dist/capabilities/byteplus.json +29 -29
  66. package/dist/capabilities/cheapaimodel.json +10 -10
  67. package/dist/capabilities/cheapest-token.json +28 -28
  68. package/dist/capabilities/chutes.json +7 -7
  69. package/dist/capabilities/clarifai.json +2 -2
  70. package/dist/capabilities/cline-pass.json +39 -39
  71. package/dist/capabilities/cloudcode.json +10 -10
  72. package/dist/capabilities/cloudflare-workers-ai.json +13 -13
  73. package/dist/capabilities/commandcode.json +143 -143
  74. package/dist/capabilities/concentrate.json +279 -276
  75. package/dist/capabilities/cortecs.json +105 -105
  76. package/dist/capabilities/crossmodel.json +191 -191
  77. package/dist/capabilities/crusoe.json +10 -10
  78. package/dist/capabilities/daoxe.json +9 -9
  79. package/dist/capabilities/databricks.json +124 -124
  80. package/dist/capabilities/deepinfra.json +93 -84
  81. package/dist/capabilities/deepseek.json +3 -3
  82. package/dist/capabilities/digitalocean.json +114 -114
  83. package/dist/capabilities/dothoosh.json +30 -30
  84. package/dist/capabilities/doubleword.json +22 -22
  85. package/dist/capabilities/edenai.json +279 -288
  86. package/dist/capabilities/empiriolabs.json +166 -166
  87. package/dist/capabilities/engy.json +22 -22
  88. package/dist/capabilities/evroc.json +11 -11
  89. package/dist/capabilities/ezkielyna.json +10 -10
  90. package/dist/capabilities/fastrouter.json +85 -85
  91. package/dist/capabilities/fireworks-ai.json +130 -69
  92. package/dist/capabilities/freemodel.json +18 -18
  93. package/dist/capabilities/frogbot.json +93 -93
  94. package/dist/capabilities/gisoo.json +20 -20
  95. package/dist/capabilities/gmicloud.json +17 -17
  96. package/dist/capabilities/google.json +54 -54
  97. package/dist/capabilities/graphn.json +15 -15
  98. package/dist/capabilities/greenpt.json +36 -36
  99. package/dist/capabilities/groq.json +6 -6
  100. package/dist/capabilities/helicone.json +83 -83
  101. package/dist/capabilities/hostinger-router.json +8 -8
  102. package/dist/capabilities/hpc-ai.json +8 -8
  103. package/dist/capabilities/huawei-maas.json +12 -12
  104. package/dist/capabilities/hubris.json +33 -33
  105. package/dist/capabilities/huggingface.json +118 -78
  106. package/dist/capabilities/hyper.json +25 -33
  107. package/dist/capabilities/impossibl.json +162 -162
  108. package/dist/capabilities/inception.json +2 -2
  109. package/dist/capabilities/inceptron.json +4 -4
  110. package/dist/capabilities/inco.json +4 -4
  111. package/dist/capabilities/infer.json +15 -15
  112. package/dist/capabilities/inferall.json +7 -7
  113. package/dist/capabilities/inference-coop.json +15 -15
  114. package/dist/capabilities/inferenceapis.json +14 -14
  115. package/dist/capabilities/inferris.json +4 -4
  116. package/dist/capabilities/infersia.json +13 -13
  117. package/dist/capabilities/inferx.json +2 -2
  118. package/dist/capabilities/infomaniak.json +4 -4
  119. package/dist/capabilities/io-net.json +2 -2
  120. package/dist/capabilities/iteracompute.json +53 -53
  121. package/dist/capabilities/jad-ai.json +3 -3
  122. package/dist/capabilities/jalapeno.json +12 -12
  123. package/dist/capabilities/jiekou.json +61 -61
  124. package/dist/capabilities/jzstoken.json +45 -45
  125. package/dist/capabilities/keln.json +16 -16
  126. package/dist/capabilities/kenari.json +123 -131
  127. package/dist/capabilities/kilo.json +615 -612
  128. package/dist/capabilities/kimi-code-plan-cn.json +5 -5
  129. package/dist/capabilities/kimi-code-plan-global.json +5 -5
  130. package/dist/capabilities/kitani.json +2 -2
  131. package/dist/capabilities/klavo.json +19 -19
  132. package/dist/capabilities/korouter.json +36 -36
  133. package/dist/capabilities/kunavo.json +6 -6
  134. package/dist/capabilities/liquid.json +11 -11
  135. package/dist/capabilities/lithosai.json +2 -2
  136. package/dist/capabilities/llmgateway-providers.json +957 -909
  137. package/dist/capabilities/llmgateway.json +335 -335
  138. package/dist/capabilities/llmtr.json +25 -25
  139. package/dist/capabilities/lowrouter.json +58 -58
  140. package/dist/capabilities/lyceum.json +4 -4
  141. package/dist/capabilities/melious.json +10 -10
  142. package/dist/capabilities/merge-gateway.json +289 -289
  143. package/dist/capabilities/meta.json +7 -7
  144. package/dist/capabilities/minimax-cn-coding-plan.json +5 -5
  145. package/dist/capabilities/minimax-cn.json +5 -5
  146. package/dist/capabilities/minimax-coding-plan.json +5 -5
  147. package/dist/capabilities/minimax.json +5 -5
  148. package/dist/capabilities/mistral.json +19 -19
  149. package/dist/capabilities/mixlayer.json +5 -5
  150. package/dist/capabilities/modal.json +11 -11
  151. package/dist/capabilities/model-oracle-ai.json +23 -23
  152. package/dist/capabilities/modelis.json +18 -18
  153. package/dist/capabilities/modular.json +7 -7
  154. package/dist/capabilities/moneo.json +12 -12
  155. package/dist/capabilities/morph.json +15 -15
  156. package/dist/capabilities/munito-eu.json +4 -4
  157. package/dist/capabilities/munito.json +4 -4
  158. package/dist/capabilities/nan.json +23 -23
  159. package/dist/capabilities/nano-gpt.json +592 -576
  160. package/dist/capabilities/nearai.json +97 -97
  161. package/dist/capabilities/nebius.json +24 -24
  162. package/dist/capabilities/neon.json +132 -132
  163. package/dist/capabilities/neuralwatt.json +41 -41
  164. package/dist/capabilities/nokeep.json +4 -4
  165. package/dist/capabilities/novita-ai.json +115 -115
  166. package/dist/capabilities/nvidia.json +31 -31
  167. package/dist/capabilities/obscurify.json +31 -31
  168. package/dist/capabilities/oci.json +6 -6
  169. package/dist/capabilities/ofox.json +356 -356
  170. package/dist/capabilities/ollama-cloud.json +57 -57
  171. package/dist/capabilities/openai.json +57 -57
  172. package/dist/capabilities/opencode-go.json +86 -86
  173. package/dist/capabilities/openreason.json +4 -4
  174. package/dist/capabilities/openrouter.json +537 -526
  175. package/dist/capabilities/opper.json +26 -26
  176. package/dist/capabilities/orcarouter.json +223 -223
  177. package/dist/capabilities/outerlabs.json +25 -25
  178. package/dist/capabilities/ovhcloud.json +21 -21
  179. package/dist/capabilities/pareto.json +5 -5
  180. package/dist/capabilities/perplexity-agent.json +65 -65
  181. package/dist/capabilities/phala.json +30 -30
  182. package/dist/capabilities/pioneer.json +32 -32
  183. package/dist/capabilities/poe.json +129 -129
  184. package/dist/capabilities/powerspring.json +14 -14
  185. package/dist/capabilities/primalabs.json +9 -9
  186. package/dist/capabilities/prime.json +125 -124
  187. package/dist/capabilities/privatemode-ai.json +11 -11
  188. package/dist/capabilities/proxystacks.json +6 -6
  189. package/dist/capabilities/qiniu-ai.json +14 -14
  190. package/dist/capabilities/refuseless.json +5 -5
  191. package/dist/capabilities/regolo-ai.json +10 -10
  192. package/dist/capabilities/requesty.json +169 -192
  193. package/dist/capabilities/ruapi.json +19 -19
  194. package/dist/capabilities/runcrate.json +5 -5
  195. package/dist/capabilities/runinfra.json +9 -9
  196. package/dist/capabilities/sakana.json +7 -7
  197. package/dist/capabilities/sambanova.json +9 -9
  198. package/dist/capabilities/sandbase.json +25 -25
  199. package/dist/capabilities/sarvam.json +9 -9
  200. package/dist/capabilities/scaleway.json +19 -19
  201. package/dist/capabilities/scnet-token-plan.json +10 -10
  202. package/dist/capabilities/scx-ai.json +29 -29
  203. package/dist/capabilities/sensenova.json +15 -15
  204. package/dist/capabilities/siliconflow-cn.json +45 -45
  205. package/dist/capabilities/siliconflow.json +45 -45
  206. package/dist/capabilities/snowflake-cortex.json +18 -18
  207. package/dist/capabilities/sokkan.json +7 -7
  208. package/dist/capabilities/sparrowcodes.json +23 -23
  209. package/dist/capabilities/standardcompute.json +94 -94
  210. package/dist/capabilities/steadyrouter.json +42 -42
  211. package/dist/capabilities/stepfun-ai-step-plan.json +4 -4
  212. package/dist/capabilities/stepfun-ai.json +4 -4
  213. package/dist/capabilities/stepfun-step-plan.json +4 -4
  214. package/dist/capabilities/stepfun.json +4 -4
  215. package/dist/capabilities/stepping-stone.json +18 -18
  216. package/dist/capabilities/synthetic.json +11 -11
  217. package/dist/capabilities/synthorai.json +27 -27
  218. package/dist/capabilities/teamorouter.json +19 -19
  219. package/dist/capabilities/teapot-router.json +10 -10
  220. package/dist/capabilities/tencent-token-plan.json +37 -37
  221. package/dist/capabilities/tencent-tokenhub.json +52 -37
  222. package/dist/capabilities/tensorx.json +38 -38
  223. package/dist/capabilities/tenstorrent.json +4 -4
  224. package/dist/capabilities/the-grid-ai.json +29 -29
  225. package/dist/capabilities/thinkingmachines.json +77 -77
  226. package/dist/capabilities/tinfoil.json +10 -10
  227. package/dist/capabilities/toapis.json +3 -3
  228. package/dist/capabilities/togetherai.json +47 -47
  229. package/dist/capabilities/tokengo.json +20 -20
  230. package/dist/capabilities/tokenify.json +3 -3
  231. package/dist/capabilities/trustedrouter.json +7 -7
  232. package/dist/capabilities/trustedtokens.json +15 -15
  233. package/dist/capabilities/umans-ai-coding-plan.json +11 -11
  234. package/dist/capabilities/umans-ai.json +10 -10
  235. package/dist/capabilities/uncensuredai.json +5 -5
  236. package/dist/capabilities/unrestricted.json +6 -6
  237. package/dist/capabilities/uplinkswitch.json +20 -20
  238. package/dist/capabilities/upstage.json +8 -8
  239. package/dist/capabilities/vancine.json +23 -23
  240. package/dist/capabilities/vercel.json +581 -581
  241. package/dist/capabilities/vivgrid.json +80 -80
  242. package/dist/capabilities/volcengine-coding-plan.json +26 -26
  243. package/dist/capabilities/volcengine.json +24 -24
  244. package/dist/capabilities/vultr.json +34 -34
  245. package/dist/capabilities/wafer.ai.json +16 -16
  246. package/dist/capabilities/wally.json +11 -11
  247. package/dist/capabilities/wandb.json +20 -20
  248. package/dist/capabilities/watt.json +19 -19
  249. package/dist/capabilities/xai.json +6 -6
  250. package/dist/capabilities/xiaomi.json +3 -3
  251. package/dist/capabilities/xpersona.json +11 -11
  252. package/dist/capabilities/xxapi.json +26 -26
  253. package/dist/capabilities/zai-coding-plan.json +18 -18
  254. package/dist/capabilities/zai.json +33 -33
  255. package/dist/capabilities/zenifra.json +33 -33
  256. package/dist/capabilities/zenmux.json +186 -186
  257. package/dist/capabilities/zerogpu.json +11 -11
  258. package/dist/capabilities/zhipuai-coding-plan.json +8 -8
  259. package/dist/capabilities/zhipuai.json +32 -32
  260. package/dist/capabilities/zro.json +6 -6
  261. package/dist/channels/agent-channels.d.ts +22 -0
  262. package/dist/channels/index.cjs +2 -2
  263. package/dist/channels/index.js +2 -2
  264. package/dist/channels/output-processor.d.ts +12 -0
  265. package/dist/channels/state-adapter.d.ts +3 -1
  266. package/dist/channels/stream-helpers.d.ts +17 -0
  267. package/dist/{channels-Cl-pRrWB.cjs → channels-CZ0iY2yh.cjs} +1 -1
  268. package/dist/{channels-DegTNzaq.js → channels-hBppCRhl.js} +1 -1
  269. package/dist/coding-agent/index.cjs +2 -2
  270. package/dist/coding-agent/index.js +2 -2
  271. package/dist/datasets/index.cjs +2 -2
  272. package/dist/datasets/index.js +2 -2
  273. package/dist/docs/SKILL.md +2 -1
  274. package/dist/docs/assets/SOURCE_MAP.json +797 -797
  275. package/dist/docs/references/docs-agents-networks.md +1 -1
  276. package/dist/docs/references/docs-agents-tools.md +6 -0
  277. package/dist/docs/references/docs-auth-simple-auth.md +8 -8
  278. package/dist/docs/references/docs-evals-custom-scorers.md +1 -1
  279. package/dist/docs/references/docs-mastra-platform-observability-overview.md +3 -189
  280. package/dist/docs/references/docs-memory-message-history.md +25 -0
  281. package/dist/docs/references/docs-sandbox-lsp.md +5 -6
  282. package/dist/docs/references/docs-sandbox-overview.md +20 -0
  283. package/dist/docs/references/docs-sandbox-skills.md +2 -0
  284. package/dist/docs/references/docs-signals-sending-signals.md +1 -1
  285. package/dist/docs/references/reference-agent-controller-session.md +1 -1
  286. package/dist/docs/references/reference-agents-generate.md +1 -1
  287. package/dist/docs/references/reference-agents-network.md +1 -1
  288. package/dist/docs/references/reference-configuration.md +8 -8
  289. package/dist/docs/references/reference-core-getWorkspaceById.md +37 -0
  290. package/dist/docs/references/reference-evals-create-scorer.md +5 -5
  291. package/dist/docs/references/reference-evals-run-evals.md +1 -1
  292. package/dist/docs/references/reference-manual-install.md +1 -1
  293. package/dist/docs/references/reference-memory-observational-memory.md +8 -0
  294. package/dist/docs/references/reference-observability-tracing-interfaces.md +10 -6
  295. package/dist/docs/references/reference-processors-processor-interface.md +3 -2
  296. package/dist/docs/references/reference-processors-system-prompt-scrubber.md +1 -1
  297. package/dist/docs/references/reference-pubsub-base.md +5 -3
  298. package/dist/docs/references/reference-pubsub-caching-pubsub.md +3 -1
  299. package/dist/docs/references/reference-storage-overview.md +1 -1
  300. package/dist/docs/references/reference-storage-retention.md +20 -20
  301. package/dist/docs/references/reference-tools-vector-query-tool.md +8 -0
  302. package/dist/docs/references/reference-voice-overview.md +11 -26
  303. package/dist/docs/references/reference-voice-speech-to-speech.md +1 -1
  304. package/dist/docs/references/reference-voice-voice.listen.md +1 -0
  305. package/dist/docs/references/reference-voice-voice.speak.md +1 -3
  306. package/dist/docs/references/reference-workspace-factory-sandbox.md +6 -6
  307. package/dist/docs/references/reference-workspace-sandbox.md +14 -0
  308. package/dist/docs/references/reference.md +1 -0
  309. package/dist/evals/index.cjs +1 -1
  310. package/dist/evals/index.js +1 -1
  311. package/dist/evals/scoreTraces/index.cjs +1 -1
  312. package/dist/evals/scoreTraces/index.js +1 -1
  313. package/dist/harness/index.cjs +2 -2
  314. package/dist/harness/index.js +2 -2
  315. package/dist/index.cjs +1 -1
  316. package/dist/index.js +1 -1
  317. package/dist/knowledge/importers/host.d.ts +7 -1
  318. package/dist/knowledge/importers/runner.d.ts +12 -0
  319. package/dist/knowledge/importers/types.d.ts +2 -0
  320. package/dist/knowledge/index.cjs +82 -6
  321. package/dist/knowledge/index.js +82 -6
  322. package/dist/llm/index.cjs +3 -3
  323. package/dist/llm/index.js +3 -3
  324. package/dist/llm/model/base.types.d.ts +3 -1
  325. package/dist/llm/model/mastra-gateway-provider-tools.d.ts +9 -6
  326. package/dist/llm/model/model.d.ts +1 -1
  327. package/dist/llm/model/model.loop.d.ts +1 -1
  328. package/dist/llm/model/model.loop.types.d.ts +3 -1
  329. package/dist/llm/model/provider-options.d.ts +4 -3
  330. package/dist/llm/model/provider-types.generated.d.ts +7581 -7556
  331. package/dist/{llm-CMkzIFAk.js → llm-CsQOELh9.js} +38 -78
  332. package/dist/{llm-BKxlS9Kk.cjs → llm-D6N-WJwo.cjs} +38 -78
  333. package/dist/loop/index.cjs +2 -2
  334. package/dist/loop/index.js +2 -2
  335. package/dist/{manager-CasaT35Q.cjs → manager-CtsjlKP7.cjs} +2 -2
  336. package/dist/{manager-C-eQXmRq.js → manager-DBVDNjO2.js} +2 -2
  337. package/dist/mastra/index.cjs +1 -1
  338. package/dist/mastra/index.js +1 -1
  339. package/dist/{mastra-C7Tj4U8c.cjs → mastra-B60fJsMe.cjs} +16 -16
  340. package/dist/{mastra-5EEmN3Ok.js → mastra-Bkpe1lBu.js} +16 -16
  341. package/dist/memory/index.cjs +3 -3
  342. package/dist/memory/index.js +3 -3
  343. package/dist/{message-list-wI71UGxk.js → message-list-BGm1DCiG.js} +230 -129
  344. package/dist/{message-list-DfN9mWeN.cjs → message-list-vR3uLAHL.cjs} +230 -129
  345. package/dist/{model-9HA-W0tg.cjs → model-CAbL0zRc.cjs} +4 -3
  346. package/dist/{model-DCLUL-8a.js → model-Da_pawSI.js} +4 -3
  347. package/dist/{netlify-DaWURNSU.js → netlify-CW26UJrG.js} +41361 -30464
  348. package/dist/{netlify-Cq3H-A9I.cjs → netlify-hasf5dLA.cjs} +41364 -30461
  349. package/dist/notifications/index.cjs +1 -1
  350. package/dist/notifications/index.js +1 -1
  351. package/dist/observability/types/tracing.d.ts +1 -1
  352. package/dist/processor-provider/index.cjs +1 -1
  353. package/dist/processor-provider/index.js +1 -1
  354. package/dist/processors/index.cjs +2 -2
  355. package/dist/processors/index.js +2 -2
  356. package/dist/{provider-registry-a649fS5r.cjs → provider-registry-CeV5wjlF.cjs} +21019 -20909
  357. package/dist/{provider-registry-DWixjFX7.js → provider-registry-DnVkqIBw.js} +21020 -20910
  358. package/dist/provider-registry.json +21425 -21369
  359. package/dist/{registry-generator-BYJC7p8M.js → registry-generator-DSR56u5H.js} +1 -1
  360. package/dist/{registry-generator-BuKC7UKd.cjs → registry-generator-G4PZCqrS.cjs} +1 -1
  361. package/dist/{rehydrate-DR2_WAz2.cjs → rehydrate-BLJ-q_V6.cjs} +2 -2
  362. package/dist/{rehydrate-DPhmASM6.js → rehydrate-zXo3Wo60.js} +2 -2
  363. package/dist/relevance/index.cjs +2 -2
  364. package/dist/relevance/index.js +2 -2
  365. package/dist/{run-registry-D3X7XvUL.js → run-registry-Cl2QbXgN.js} +189 -62
  366. package/dist/{run-registry-oUNF6szW.cjs → run-registry-oixTpWpa.cjs} +190 -63
  367. package/dist/storage/index.cjs +2 -2
  368. package/dist/storage/index.js +2 -2
  369. package/dist/stream/index.cjs +2 -2
  370. package/dist/stream/index.js +2 -2
  371. package/dist/{stream-DoZ6F41o.js → stream-DUUfwH38.js} +3 -3
  372. package/dist/{stream-DQC1vpvl.cjs → stream-DaZh0apo.cjs} +3 -3
  373. package/dist/test-utils/llm-mock.cjs +1 -1
  374. package/dist/test-utils/llm-mock.js +1 -1
  375. package/dist/{to-prompt-B9eZo2U5.cjs → to-prompt-CG-LyaBY.cjs} +9 -0
  376. package/dist/{to-prompt-BsDtVXrf.js → to-prompt-CMlVGYxC.js} +9 -0
  377. package/dist/tool-loop-agent/index.cjs +1 -1
  378. package/dist/tool-loop-agent/index.js +1 -1
  379. package/dist/{tool-loop-agent-C9YkvDRd.js → tool-loop-agent-C4NvGYnM.js} +4 -4
  380. package/dist/{tool-loop-agent-Cy4NDOMS.cjs → tool-loop-agent-DDowWQyO.cjs} +4 -4
  381. package/dist/tools/index.cjs +1 -1
  382. package/dist/tools/index.js +1 -1
  383. package/dist/{tools-CDfyMpzN.js → tools-DDfA_ES4.js} +113 -31
  384. package/dist/{tools-CGF5Ik6j.cjs → tools-n9lqzDNe.cjs} +113 -31
  385. package/dist/{utils-9JyiKu5r.js → utils-CVN-336o.js} +1 -1
  386. package/dist/{utils-Bs2IYyOb.cjs → utils-CmNJO2xP.cjs} +1 -1
  387. package/dist/utils.cjs +1 -1
  388. package/dist/utils.js +1 -1
  389. package/dist/{validate-8j0phWFV.js → validate-CgNNzqgp.js} +1 -1
  390. package/dist/{validate-BE3mVxVy.cjs → validate-LpK3-p_O.cjs} +1 -1
  391. package/dist/vector/index.cjs +2 -2
  392. package/dist/vector/index.js +2 -2
  393. package/dist/worker/index.cjs +1 -1
  394. package/dist/worker/index.js +1 -1
  395. package/dist/{worker-DwdgU6E9.cjs → worker-6qR81hZZ.cjs} +2 -2
  396. package/dist/{worker-BiK1kfMa.cjs → worker-BN2odJzu.cjs} +2 -2
  397. package/dist/{worker-DIRdEwih.js → worker-BdPUoHXa.js} +2 -2
  398. package/dist/{worker-BfWFqSH2.js → worker-ChoZX7rg.js} +2 -2
  399. package/dist/{workflow-ni-keg2i.js → workflow-D2MsV-JA.js} +3 -3
  400. package/dist/{workflow-CxQMcTbT.cjs → workflow-ww-N09bR.cjs} +3 -3
  401. package/dist/workflows/builder/index.cjs +1 -1
  402. package/dist/workflows/builder/index.js +1 -1
  403. package/dist/workflows/evented/index.cjs +1 -1
  404. package/dist/workflows/evented/index.js +1 -1
  405. package/dist/workflows/index.cjs +4 -4
  406. package/dist/workflows/index.js +4 -4
  407. package/dist/workflows/step.d.ts +2 -0
  408. package/dist/workflows/workflow.d.ts +2 -0
  409. package/dist/workspace/index.cjs +3 -1
  410. package/dist/workspace/index.d.ts +1 -1
  411. package/dist/workspace/index.js +2 -2
  412. package/dist/workspace/lsp/manager.d.ts +19 -4
  413. package/dist/workspace/sandbox/mastra-sandbox.d.ts +17 -0
  414. package/dist/workspace/tools/index.d.ts +1 -0
  415. package/dist/workspace/tools/media.d.ts +20 -1
  416. package/dist/workspace/tools/recreate-sandbox.d.ts +24 -0
  417. package/dist/{workspace-DY2Nxiyi.js → workspace-BK9ltbSa.js} +270 -105
  418. package/dist/{workspace-X2RHJZU9.cjs → workspace-Pv3J8K0c.cjs} +281 -104
  419. package/package.json +7 -7
  420. package/src/llm/model/provider-types.generated.d.ts +7581 -7556
@@ -1,4 +1,4 @@
1
- import { g as getCapabilityFileName, h as shouldEnableGateway, p as getGatewayId } from "./netlify-DaWURNSU.js";
1
+ import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-CW26UJrG.js";
2
2
  import path from "path";
3
3
  import fs from "fs/promises";
4
4
  // src/llm/model/registry-generator.ts
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
2
- const require_netlify = require("./netlify-Cq3H-A9I.cjs");
2
+ const require_netlify = require("./netlify-hasf5dLA.cjs");
3
3
  let path = require("path");
4
4
  path = require_rolldown_runtime.__toESM(path, 1);
5
5
  let fs_promises = require("fs/promises");
@@ -1,6 +1,6 @@
1
- const require_run_registry = require("./run-registry-oUNF6szW.cjs");
1
+ const require_run_registry = require("./run-registry-oixTpWpa.cjs");
2
2
  const require_predicate_index = require("./predicate/index.cjs");
3
- const require_validate = require("./validate-BE3mVxVy.cjs");
3
+ const require_validate = require("./validate-LpK3-p_O.cjs");
4
4
  let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
5
5
  // src/workflows/dynamic/serialize.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { Cc as predicateToCondition, Fs as cloneWorkflow, Gc as createStepFromTool, Is as createEventedWorkflow, Ls as createWorkflow, Sc as mapVariable, Uc as createStepFromAgent, al as getSingleStepEntryId } from "./run-registry-D3X7XvUL.js";
1
+ import { Cc as predicateToCondition, Fs as cloneWorkflow, Gc as createStepFromTool, Is as createEventedWorkflow, Ls as createWorkflow, Sc as mapVariable, Uc as createStepFromAgent, al as getSingleStepEntryId } from "./run-registry-Cl2QbXgN.js";
2
2
  import { derivePredicateLabel } from "./predicate/index.js";
3
- import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-8j0phWFV.js";
3
+ import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-CgNNzqgp.js";
4
4
  import { standardSchemaToJSONSchema, toStandardSchema } from "./schema/index.js";
5
5
  // src/workflows/dynamic/serialize.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_registry = require("../run-registry-oUNF6szW.cjs");
3
- const require_stream = require("../stream-DQC1vpvl.cjs");
2
+ const require_run_registry = require("../run-registry-oixTpWpa.cjs");
3
+ const require_stream = require("../stream-DaZh0apo.cjs");
4
4
  // src/relevance/relevance-score-provider.ts
5
5
  function createSimilarityPrompt(query, text) {
6
6
  return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
@@ -1,5 +1,5 @@
1
- import { P as Agent } from "../run-registry-D3X7XvUL.js";
2
- import { ln as isSupportedLanguageModel } from "../stream-DoZ6F41o.js";
1
+ import { P as Agent } from "../run-registry-Cl2QbXgN.js";
2
+ import { ln as isSupportedLanguageModel } from "../stream-DUUfwH38.js";
3
3
  // src/relevance/relevance-score-provider.ts
4
4
  function createSimilarityPrompt(query, text) {
5
5
  return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
@@ -4,18 +4,18 @@ import { t as MastraBase } from "./base-CKLWBhDo.js";
4
4
  import { A as compactStopReasonContext, D as agentLoopTermination, O as executionFailureTermination, S as resolveObservabilityContext, b as wrapMastra, i as subtractReportedUsage, k as tripwireTermination, n as extractUsageMetrics, r as isUsageIncomplete, t as calculateObservedUsage, x as createObservabilityContext, y as unwrapMastraTracingProxy } from "./observability-D7RNOAPx.js";
5
5
  import { a as MastraNonRetryableError, i as MastraError, n as ErrorDomain, o as getErrorFromUnknown, t as ErrorCategory } from "./error-oh2DLsP2.js";
6
6
  import { a as classifyProviderError, l as describeProviderError, t as recordTerminalErrorMessage, u as readProviderErrorDetails } from "./error-BC9Au-22.js";
7
- import { $ as resolveProcessorSpanAttributes, $t as computeModelOutputProviderMetadata, A as OUTPUT_STREAM_HOOK_DURATION_KEY_PREFIX, An as safeError, B as ProviderHistoryCompat, Bt as summarizeStepResult, C as markChunkOutputProcessed, Cn as isMastraTimeoutError, Ct as resolveTemplate, D as asJsonSchema, Dn as MastraModelInput, Dt as getStepResult, E as isStructuredOutputError, Et as validateTemplate, F as findOwnModelStepSpan, Ft as materializeState, G as REPROCESS_PART_KEY, Gt as patchState, Ht as applyStatePatch, It as materializeWorkflowRun, J as summarizeActiveToolsForSpan, Jt as isObservationalMemoryEnabled$1, K as takeHeldParts, L as isTrailingAssistantGuardContinuation, Lt as pickStateKeys, M as ProcessorState, Mn as createRunScopeKey, Mt as applyStateColumnsWrite, N as endOutputStreamSpanAtStepEnd, Nt as isStateCheckpointDue, O as getResponseFormat, On as safeClose, Ot as getStepResultAsync, P as endOutputStreamSpanOutsideStep, Pt as latestStepResults, Q as summarizeToolChoiceForSpan, Qt as commitToolResult, R as needsTrailingAssistantGuard, Rt as stateBaseOf, S as stampChunkProducedAt, Sn as guardStreamWithAbort, T as escapeUnescapedControlCharsInJsonStrings, Tn as settledOrElapsed, Tt as traverseMappingPath, Vt as unusedStateEntries, W as FLUSH_HELD_PARTS_KEY, Wt as diffStateAsJson, X as summarizeProcessorResultForSpan, Xt as parseMemoryRequestContext, Y as summarizeProcessorModelForSpan, Z as summarizeProcessorToolsForSpan, _ as reconcileBufferedStepTexts, _n as DEADLINE_SAVE_WAIT_MS, _t as collectMappingStepRefs, a as convertFullStreamChunkToMastra, an as withAgentWorkflowToolMarker, at as RunJournal, b as resolveProcessorWriterMessageId, bn as getAbortReason, bt as resolveStepOutputs, c as WorkflowRunOutput, cn as isProcessorWorkflow, ct as hydrateStepResults, d as MastraModelOutput, dn as resolveThreadIdFromArgs, dt as loadStepResults, en as hasToolResultProcessor, et as resolveProcessorSpanName, f as clearStepPartIndexes, fn as supportedLanguageModelSpecifications, ft as loadedStepResults, g as persistProcessorDataChunk, gn as DEADLINE_SAVE_CLAIM_HOLD_MS, gt as stubStepResult, h as findStepPartBoundaries, hn as applyStateSignal, ht as storageV2StepResultAccessors, in as snapshotToolResult, it as PROCESSOR_ABORT_SIGNAL, j as ProcessorRunner, jn as createRunScope, k as isSignalChunkExcluded, kn as safeEnqueue, kt as getSnapshotMemoryInfo, l as TripWire, ln as isSupportedLanguageModel, lt as isStepResultStub, m as findIterationOffsetInParts, mn as tryStreamWithJsonFallback, mt as residentStepResultsLoader, nn as readModelOutput, nt as PROCESSOR_LATE_SIGNAL_SINK, on as normalizeModelOutput, ot as buildStepResultAccessors, p as createDestructurableOutput, pn as tryGenerateWithJsonFallback, pt as residentStepResults, q as withoutHeldContent, rn as resolveModelOutputAfterToolResultProcessors, rt as createProcessorSendSignal, s as MastraAgentNetworkStream, sn as validationErrorModelOutput, st as getHydratedStepResult, tn as latestProcessedModelOutput, tt as toProcessorSpanPhase, u as getModelOutputForTripwire, un as resolveSuspendedToolRunId, ut as lazyStepResults, v as resolveMessageText, vn as MastraTimeoutError, vt as collectPredicateStepRefs, w as createOutputHandler, wn as raceAgainstAbort, wt as templateReadsState, x as getChunkProducedAt, xn as guardStreamUntilMatch, xt as stepRefId, y as resolveOutputMessageSkippingCompletionChecks, yn as createTimeoutAbortSignal, yt as predicateReadsState, z as removeTrailingAssistantGuardContinuations, zt as stateColumnsWrite } from "./stream-DoZ6F41o.js";
7
+ import { $ as resolveProcessorSpanAttributes, $t as computeModelOutputProviderMetadata, A as OUTPUT_STREAM_HOOK_DURATION_KEY_PREFIX, An as safeError, B as ProviderHistoryCompat, Bt as summarizeStepResult, C as markChunkOutputProcessed, Cn as isMastraTimeoutError, Ct as resolveTemplate, D as asJsonSchema, Dn as MastraModelInput, Dt as getStepResult, E as isStructuredOutputError, Et as validateTemplate, F as findOwnModelStepSpan, Ft as materializeState, G as REPROCESS_PART_KEY, Gt as patchState, Ht as applyStatePatch, It as materializeWorkflowRun, J as summarizeActiveToolsForSpan, Jt as isObservationalMemoryEnabled$1, K as takeHeldParts, L as isTrailingAssistantGuardContinuation, Lt as pickStateKeys, M as ProcessorState, Mn as createRunScopeKey, Mt as applyStateColumnsWrite, N as endOutputStreamSpanAtStepEnd, Nt as isStateCheckpointDue, O as getResponseFormat, On as safeClose, Ot as getStepResultAsync, P as endOutputStreamSpanOutsideStep, Pt as latestStepResults, Q as summarizeToolChoiceForSpan, Qt as commitToolResult, R as needsTrailingAssistantGuard, Rt as stateBaseOf, S as stampChunkProducedAt, Sn as guardStreamWithAbort, T as escapeUnescapedControlCharsInJsonStrings, Tn as settledOrElapsed, Tt as traverseMappingPath, Vt as unusedStateEntries, W as FLUSH_HELD_PARTS_KEY, Wt as diffStateAsJson, X as summarizeProcessorResultForSpan, Xt as parseMemoryRequestContext, Y as summarizeProcessorModelForSpan, Z as summarizeProcessorToolsForSpan, _ as reconcileBufferedStepTexts, _n as DEADLINE_SAVE_WAIT_MS, _t as collectMappingStepRefs, a as convertFullStreamChunkToMastra, an as withAgentWorkflowToolMarker, at as RunJournal, b as resolveProcessorWriterMessageId, bn as getAbortReason, bt as resolveStepOutputs, c as WorkflowRunOutput, cn as isProcessorWorkflow, ct as hydrateStepResults, d as MastraModelOutput, dn as resolveThreadIdFromArgs, dt as loadStepResults, en as hasToolResultProcessor, et as resolveProcessorSpanName, f as clearStepPartIndexes, fn as supportedLanguageModelSpecifications, ft as loadedStepResults, g as persistProcessorDataChunk, gn as DEADLINE_SAVE_CLAIM_HOLD_MS, gt as stubStepResult, h as findStepPartBoundaries, hn as applyStateSignal, ht as storageV2StepResultAccessors, in as snapshotToolResult, it as PROCESSOR_ABORT_SIGNAL, j as ProcessorRunner, jn as createRunScope, k as isSignalChunkExcluded, kn as safeEnqueue, kt as getSnapshotMemoryInfo, l as TripWire, ln as isSupportedLanguageModel, lt as isStepResultStub, m as findIterationOffsetInParts, mn as tryStreamWithJsonFallback, mt as residentStepResultsLoader, nn as readModelOutput, nt as PROCESSOR_LATE_SIGNAL_SINK, on as normalizeModelOutput, ot as buildStepResultAccessors, p as createDestructurableOutput, pn as tryGenerateWithJsonFallback, pt as residentStepResults, q as withoutHeldContent, rn as resolveModelOutputAfterToolResultProcessors, rt as createProcessorSendSignal, s as MastraAgentNetworkStream, sn as validationErrorModelOutput, st as getHydratedStepResult, tn as latestProcessedModelOutput, tt as toProcessorSpanPhase, u as getModelOutputForTripwire, un as resolveSuspendedToolRunId, ut as lazyStepResults, v as resolveMessageText, vn as MastraTimeoutError, vt as collectPredicateStepRefs, w as createOutputHandler, wn as raceAgainstAbort, wt as templateReadsState, x as getChunkProducedAt, xn as guardStreamUntilMatch, xt as stepRefId, y as resolveOutputMessageSkippingCompletionChecks, yn as createTimeoutAbortSignal, yt as predicateReadsState, z as removeTrailingAssistantGuardContinuations, zt as stateColumnsWrite } from "./stream-DUUfwH38.js";
8
8
  import { c as MASTRA_THREAD_ID_KEY, d as isReservedRequestContextKey, f as mergeVersionOverrides$1, l as MASTRA_VERSIONS_KEY, n as MASTRA_AUTH_TOKEN_KEY, o as MASTRA_RESOURCE_ID_KEY, p as withoutLiveRequestKeys, r as MASTRA_INHERITED_MEMORY_KEY, s as MASTRA_SCOPES_KEY, t as MASTRA_CONTINUATION_TOOL_CALL_IDS_KEY, u as RequestContext } from "./request-context-COnZHt2-.js";
9
9
  import { S as withAck, _ as serializeError$1, h as stripModelSnapshots, n as PublisherQueueLimitError, p as slimNestedAgentChunks, r as CachingPubSub, t as DefaultStepResult, u as isRunLocalTopic, v as EventEmitterPubSub, x as isLeaseProvider, y as NoopLeaseProvider } from "./output-helpers-CVzhy1Y0.js";
10
- import { A as stableStringify$1, E as removeWorkingMemoryTags, P as embed$3, Z as preserveResponseItemIdsOnMerge, a as isTerminalToolInvocationState, c as withUnavailableAttachmentUrls, d as aiV5UIMessagesToAIV5ModelMessages, f as coreContentToString, i as isClientToolInvocationUpdate, l as isDownloadAssetsError, m as filterMessagesForPersistence, n as MessageList, ot as normalizeToolOutput, p as messagesAreEqual, r as advancesToolInvocationState, s as unavailableAttachmentPlaceholder, t as convertMessages, u as MessageMerger } from "./message-list-wI71UGxk.js";
10
+ import { A as stableStringify$1, E as removeWorkingMemoryTags, P as embed$3, Z as preserveResponseItemIdsOnMerge, a as isTerminalToolInvocationState, c as withUnavailableAttachmentUrls, d as aiV5UIMessagesToAIV5ModelMessages, f as coreContentToString, i as isClientToolInvocationUpdate, l as isDownloadAssetsError, m as filterMessagesForPersistence, n as MessageList, ot as normalizeToolOutput, p as messagesAreEqual, r as advancesToolInvocationState, s as unavailableAttachmentPlaceholder, t as convertMessages, u as MessageMerger } from "./message-list-BGm1DCiG.js";
11
11
  import { Bt as listScoresArgsSchema, Ft as listLogsArgsSchema, Lt as listMetricsArgsSchema, Nt as listFeedbackArgsSchema, t as EntityType } from "./storage-Cc50aQAp.js";
12
12
  import { a as getOrCreateSpan, f as resolveCurrentSpan, l as getTimeToFirstChunkMs, n as executeWithContextSync, o as getResumeTracingContext, p as resolveExportedSpanId, s as getRootExportSpan, t as executeWithContext, u as getWorkflowResumeTracingContext } from "./utils-DU_pU5SK.js";
13
13
  import { i as setSpanErrorOrigin, n as getSpanErrorOrigin } from "./error-count-BH-rJW7q.js";
14
- import { a as ModelRouterLanguageModel, d as attachModelStreamTransport, f as isDataChunk, i as resolveModelConfig, n as ModelRouterEmbeddingModel, o as resolveApiProviderId, p as readModelStreamTransport } from "./llm-CMkzIFAk.js";
14
+ import { a as ModelRouterLanguageModel, d as attachModelStreamTransport, f as isDataChunk, i as resolveModelConfig, n as ModelRouterEmbeddingModel, o as resolveApiProviderId, p as readModelStreamTransport } from "./llm-CsQOELh9.js";
15
15
  import { a as withToolPayloadTransformMetadata, i as transformToolPayloadForTargets, n as hasTransformedToolPayload, o as withToolPayloadTransformProviderMetadata, r as normalizeToolPayloadTransformPolicy, t as getTransformedToolPayload } from "./payload-transform-Dj3HUeD4.js";
16
16
  import { boundedStringify, ensureSerializable, safeStringify } from "./utils/safe-stringify.js";
17
17
  import { d as signalSpanAttributes, h as signalToXmlMarkup, l as mastraDBMessageToSignal, n as createSignal, o as isMastraSignalMessage, s as isTransientSignalMessage, u as resolveDeliveryAttributes } from "./signals-CqR_iWkg.js";
18
- import { h as resolveFilePartMediaTypeAndData, m as parseDataUri, o as categorizeFileData } from "./to-prompt-BsDtVXrf.js";
18
+ import { h as resolveFilePartMediaTypeAndData, m as parseDataUri, o as categorizeFileData } from "./to-prompt-CMlVGYxC.js";
19
19
  import { c as parsePartialJson, h as tool$1, m as generateId$1, p as asSchema$1, r as embed$4, u as APICallError$1 } from "./dist-TPVqg8oV.js";
20
20
  import { n as embed$5 } from "./dist-D3cKCUe-.js";
21
21
  import { t as deepEqual$3 } from "./deep-equal-d1xU02ag.js";
@@ -24,13 +24,13 @@ import { _ as getRequestContextInputValues, a as getModelFacingValidationError,
24
24
  import { a as isApprovalExempt, c as isProviderDefinedTool, d as markAgentWorkflowTool, f as markApprovalExempt, l as isProviderTool, n as getNeedsApprovalFn, o as isBuiltBeforeApproval, r as getProviderToolName, s as isMastraTool, t as getBeforeApprovalFn } from "./toolchecks-DrsZdc3S.js";
25
25
  import { a as waitDelay, i as getRetryAfterMs, n as DEFAULT_MAX_RETRY_AFTER_MS, r as clampDelayMs } from "./fetchWithRetry-DFSvpYDT.js";
26
26
  import { i as hasFreeFormObject } from "./model-DS-b2R-R.js";
27
- import { c as modelSupportsStructuredOutput, l as modelSupportsTemperature } from "./provider-registry-DWixjFX7.js";
27
+ import { c as modelSupportsStructuredOutput, l as modelSupportsTemperature } from "./provider-registry-DnVkqIBw.js";
28
28
  import { t as InMemoryServerCache } from "./inmemory-BK3zLwvM.js";
29
29
  import { n as resolveDynamicArgument, t as getRequestUser } from "./dynamic-argument-BzPK3qPN.js";
30
- import { t as MastraLLMV1 } from "./model-DCLUL-8a.js";
31
- import { A as eagerToolCallDidNotExecute, D as EagerToolExecutionCoordinator, E as EAGER_TOOL_EXECUTION_MARKER, F as hasRunningRunStep, I as isRunStepActive, L as setRunLeaseFence, M as isEagerlyExecutableToolCall, N as TOOL_ABORT_NOTICE, O as EagerToolExecutionNotRun, P as clearRunLeaseFence, R as startRunStep, S as selectFields, T as EAGER_TOOL_BAILOUT, a as ensureToolProperties, b as removeUndefinedValues, d as makeCoreTool, i as delay$1, j as eagerToolCallSuspensionIntent, k as eagerToolCallAlreadyAnnouncedInput, n as createMastraProxy, o as generateEmptyFromSchema, p as makeProcessorCoreTool, r as deepMerge$1, v as readPositiveIntEnv, w as EAGER_TOOL_ABORT_SIGNAL, y as rebindProcessorTools, z as whenRunStepsSettle } from "./utils-9JyiKu5r.js";
30
+ import { t as MastraLLMV1 } from "./model-Da_pawSI.js";
31
+ import { A as eagerToolCallDidNotExecute, D as EagerToolExecutionCoordinator, E as EAGER_TOOL_EXECUTION_MARKER, F as hasRunningRunStep, I as isRunStepActive, L as setRunLeaseFence, M as isEagerlyExecutableToolCall, N as TOOL_ABORT_NOTICE, O as EagerToolExecutionNotRun, P as clearRunLeaseFence, R as startRunStep, S as selectFields, T as EAGER_TOOL_BAILOUT, a as ensureToolProperties, b as removeUndefinedValues, d as makeCoreTool, i as delay$1, j as eagerToolCallSuspensionIntent, k as eagerToolCallAlreadyAnnouncedInput, n as createMastraProxy, o as generateEmptyFromSchema, p as makeProcessorCoreTool, r as deepMerge$1, v as readPositiveIntEnv, w as EAGER_TOOL_ABORT_SIGNAL, y as rebindProcessorTools, z as whenRunStepsSettle } from "./utils-CVN-336o.js";
32
32
  import { h as getWorkflowFGAResourceId, i as MastraFGAPermissions, y as requireFGA } from "./ee-iTj2bRDt-By_B9ngH.js";
33
- import { a as resolveBackgroundConfig, o as createBackgroundTask, t as generateBackgroundTaskSystemPrompt } from "./background-tasks-BbVsBghi.js";
33
+ import { a as resolveBackgroundConfig, o as createBackgroundTask, t as generateBackgroundTaskSystemPrompt } from "./background-tasks-1tyymY2H.js";
34
34
  import { t as ToolStream } from "./stream-D9JOykz7.js";
35
35
  import { MISSING, collectInvalidPredicatePaths, createPredicateEvaluator, derivePredicateLabel, normalizePredicatePath, walk } from "./predicate/index.js";
36
36
  import { Classifier } from "./classifier/index.js";
@@ -42,8 +42,8 @@ import { A as writeObjective, D as readObjective, O as resolveEffectiveGoalSetti
42
42
  import { An as computeTraceStatus, Cr as extractTrajectory, Dr as saveScorePayloadSchema, It as TABLE_SCHEMAS, Lt as TABLE_SCORERS, Nn as extractBranchSpans, Pn as getBranchArgsSchema, Qn as listTracesArgsSchema, Sr as withBufferedReflectionVerified, Tr as extractWorkflowTrajectory, Yn as listBranchesArgsSchema, _r as isAppendOnlySince, ar as spanRecordSchema, br as maxObservationCursor, cr as toTraceSpans, gn as BRANCH_SPAN_TYPE_SET, gr as compareObservationalMemoryHeadOrder, hr as assertActiveObservationsApplied, or as toLightSpanRecord, pn as matchesExpectedWorkflowStatus, qn as isPreviewTruncated, sr as toTraceSpan, vn as TraceStatus, vr as isBufferedChunkCoveredByCursor, wr as extractTrajectoryFromTrace, xr as planReflectionGenerationText, yr as isBufferedReflectionUnchangedSince } from "./constants-BmdTvEYN.js";
43
43
  import { t as GoalSignalProvider } from "./signal-provider-BslnAjWG.js";
44
44
  import { t as slugify } from "./slugify-BUNmb-Ga.js";
45
- import { N as LocalSandbox, at as LocalFilesystem, dt as sliceByTokensSafe, ft as estimateTokenCount, it as normalizeReadTrackerPath, lt as WORKSPACE_TOOLS, m as resolveToolConfig, mt as shellQuote, o as Workspace, p as createWorkspaceTools, pt as sliceByTokens, rt as evaluateReadRecord, s as createSkillTools, st as CompositeFilesystem } from "./workspace-DY2Nxiyi.js";
46
- import { i as normalizeWebSearchProvider, n as createWebSearchProviderTool, r as isWebSearchTool } from "./tools-CDfyMpzN.js";
45
+ import { F as LocalSandbox, at as evaluateReadRecord, c as Workspace, dt as WORKSPACE_TOOLS, g as resolveToolConfig, gt as shellQuote, h as createWorkspaceTools, ht as sliceByTokens, l as createSkillTools, lt as CompositeFilesystem, mt as estimateTokenCount, ot as normalizeReadTrackerPath, pt as sliceByTokensSafe, st as LocalFilesystem } from "./workspace-BK9ltbSa.js";
46
+ import { i as normalizeWebSearchProvider, n as createWebSearchProviderTool, r as isWebSearchTool } from "./tools-DDfA_ES4.js";
47
47
  import { D as BM25Index, O as tokenize } from "./workspace-skills-38OY32_b.js";
48
48
  import { f as calculatePagination, g as InMemoryThreadStateStorage, h as resolveListOrderBy, m as normalizePerPage, p as compareByField, s as StorageDomain, u as MastraCompositeStore } from "./filesystem-versioned-BL1ojJLo.js";
49
49
  import { coreFeatures } from "./features/index.js";
@@ -65,11 +65,11 @@ import { ReadableStream as ReadableStream$1, TransformStream as TransformStream$
65
65
  import { injectJsonInstructionIntoMessages, isAbortError } from "@ai-sdk/provider-utils-v6";
66
66
  import { z as z$1 } from "zod";
67
67
  import { createHash, randomUUID } from "crypto";
68
+ import { config, toJSONSchema } from "zod/v4/core";
69
+ import en from "zod/v4/locales/en.js";
68
70
  import { prepareJsonSchemaForOpenAIStrictMode, wrapSchemaWithNullTransform } from "@mastra/schema-compat";
69
71
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
70
72
  import { dirname, extname, isAbsolute, join, normalize, posix, relative, resolve, sep, win32 } from "path";
71
- import { config, toJSONSchema } from "zod/v4/core";
72
- import en from "zod/v4/locales/en.js";
73
73
  import { jsonSchemaToZod } from "@mastra/schema-compat/json-to-zod";
74
74
  import { AsyncLocalStorage } from "async_hooks";
75
75
  import fastq from "fastq";
@@ -7613,6 +7613,7 @@ function createStepFromProcessor$1(processor) {
7613
7613
  };
7614
7614
  const step = {
7615
7615
  id: `processor:${processor.id}`,
7616
+ processorId: processor.id,
7616
7617
  description: processor.name ?? `Processor ${processor.id}`,
7617
7618
  inputSchema: toStandardSchema(ProcessorStepInputSchema),
7618
7619
  outputSchema: toStandardSchema(ProcessorStepOutputSchema),
@@ -8258,7 +8259,8 @@ function cloneStep$1(step, opts) {
8258
8259
  retries: step.retries,
8259
8260
  scorers: step.scorers,
8260
8261
  component: step.component,
8261
- metadata: step.metadata
8262
+ metadata: step.metadata,
8263
+ processorId: step.processorId
8262
8264
  };
8263
8265
  }
8264
8266
  /**
@@ -11996,6 +11998,7 @@ function snapshotRequestContextEntries(requestContext, onEntryOmitted) {
11996
11998
  if (key === "mastra__versions") continue;
11997
11999
  if (key === "mastra__durableExecutions") continue;
11998
12000
  if (key === "mastra__durableSegments") continue;
12001
+ if (key === "__mastra_chat_channel_render") continue;
11999
12002
  const json = boundedStringify(value);
12000
12003
  if (json === void 0) {
12001
12004
  onEntryOmitted?.();
@@ -21337,7 +21340,8 @@ function cloneStep(step, opts) {
21337
21340
  retries: step.retries,
21338
21341
  scorers: step.scorers,
21339
21342
  metadata: step.metadata,
21340
- component: step.component
21343
+ component: step.component,
21344
+ processorId: step.processorId
21341
21345
  };
21342
21346
  }
21343
21347
  function isToolStep(input) {
@@ -21597,6 +21601,7 @@ function createStepFromProcessor(processor) {
21597
21601
  };
21598
21602
  return {
21599
21603
  id: `processor:${processor.id}`,
21604
+ processorId: processor.id,
21600
21605
  description: processor.name ?? `Processor ${processor.id}`,
21601
21606
  inputSchema: toStandardSchema(ProcessorStepSchema),
21602
21607
  outputSchema: toStandardSchema(ProcessorStepOutputSchema),
@@ -27746,12 +27751,14 @@ async function partitionMessages(messagesDescending, limits, tokenCounter, initi
27746
27751
  if (maxTokens !== void 0 && !tokenCounter) throw new Error("A token counter is required to load token-limited message history");
27747
27752
  let messageCount = 0;
27748
27753
  let tokenCount = initialTokens;
27754
+ let loadedTokens = initialTokens;
27749
27755
  let reachedLimit = false;
27750
27756
  let overflowReason;
27751
27757
  const retainedIds = /* @__PURE__ */ new Set();
27752
27758
  for (const group of groupLinkedToolMessages(messagesDescending)) {
27753
27759
  let groupTokens = 0;
27754
27760
  if (tokenCounter) for (const message of group) groupTokens += await tokenCounter.countMessage(message);
27761
+ loadedTokens += groupTokens;
27755
27762
  const exceedsMessageLimit = limits.maxMessages !== void 0 && messageCount + group.length > limits.maxMessages;
27756
27763
  const exceedsTokenLimit = maxTokens !== void 0 && tokenCount + groupTokens > maxTokens;
27757
27764
  if (reachedLimit || exceedsMessageLimit || exceedsTokenLimit) {
@@ -27766,7 +27773,8 @@ async function partitionMessages(messagesDescending, limits, tokenCounter, initi
27766
27773
  return {
27767
27774
  messages: messagesDescending.filter((message) => retainedIds.has(message.id)).reverse(),
27768
27775
  overflow: messagesDescending.filter((message) => !retainedIds.has(message.id)).reverse(),
27769
- overflowReason
27776
+ overflowReason,
27777
+ loadedTokens
27770
27778
  };
27771
27779
  }
27772
27780
  function laterDate(left, right) {
@@ -27828,15 +27836,15 @@ async function loadMessageHistory(args) {
27828
27836
  const newestOverflow = partitioned.overflow.at(-1);
27829
27837
  if (newestOverflow) cutoffTimestamp = newestOverflow.createdAt.getTime();
27830
27838
  const oldestTimestamp = result.messages.at(-1)?.createdAt.getTime();
27831
- const crossedCutoff = cutoffTimestamp !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < cutoffTimestamp;
27839
+ const crossedCutoff = cutoffTimestamp !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < cutoffTimestamp && (!args.includeOverflow || partitioned.overflowReason !== "tokens" || partitioned.loadedTokens > (args.maxTokens ?? 0));
27832
27840
  const reachedBoundary = args.boundary !== void 0 && oldestTimestamp !== void 0 && oldestTimestamp < new Date(args.boundary.createdAt).getTime();
27833
- if (!result.hasMore || crossedCutoff || reachedBoundary || result.messages.length === 0) return args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned : {
27841
+ if (!result.hasMore || crossedCutoff || reachedBoundary || result.messages.length === 0) return {
27834
27842
  messages: partitioned.messages,
27835
- overflow: []
27843
+ overflow: args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned.overflow : []
27836
27844
  };
27837
- if (oldestTimestamp === void 0) return args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned : {
27845
+ if (oldestTimestamp === void 0) return {
27838
27846
  messages: partitioned.messages,
27839
- overflow: []
27847
+ overflow: args.includeOverflow && partitioned.overflowReason === "tokens" ? partitioned.overflow : []
27840
27848
  };
27841
27849
  if (end?.getTime() === oldestTimestamp && added === 0) page++;
27842
27850
  else {
@@ -47884,6 +47892,32 @@ function chunkToFallbackMessage(chunk) {
47884
47892
  if (chunk.type === "plan_update") return chunk.title && chunk.title.length > 0 ? chunk.title : null;
47885
47893
  return null;
47886
47894
  }
47895
+ /** Whitespace plus the meaningful joiners ZWNJ (U+200C) and ZWJ (U+200D). */
47896
+ const EDGE_PADDING = /[\s\u200C\u200D]/;
47897
+ /**
47898
+ * Sanitize a buffered channel reply before posting.
47899
+ *
47900
+ * Zero-width space (U+200B) and the byte-order mark (U+FEFF) are invisible
47901
+ * padding and are removed everywhere. Whitespace and the joiners ZWNJ
47902
+ * (U+200C) / ZWJ (U+200D) are trimmed only at the edges, so internal joiners
47903
+ * in compound emoji (🏄🏼‍♂️, 👨‍👩‍👧) and scripts such as Persian (می‌خواهم)
47904
+ * survive — the bug behind #31205. Invisible-only input collapses to '' so
47905
+ * callers skip posting it entirely.
47906
+ *
47907
+ * The edge trim is a single-pass scan rather than
47908
+ * `.replace(/^[\s\u200C\u200D]+|[\s\u200C\u200D]+$/g, '')`: that anchored
47909
+ * alternation backtracks quadratically over a long interior run of the class
47910
+ * (a 300k-character run of model-controlled output took ~80s), while this
47911
+ * scan is O(n).
47912
+ */
47913
+ function cleanBufferedText(input) {
47914
+ const stripped = input.replace(/[\u200B\uFEFF]/g, "");
47915
+ let start = 0;
47916
+ let end = stripped.length;
47917
+ while (start < end && EDGE_PADDING.test(stripped.charAt(start))) start++;
47918
+ while (end > start && EDGE_PADDING.test(stripped.charAt(end - 1))) end--;
47919
+ return start === 0 && end === stripped.length ? stripped : stripped.slice(start, end);
47920
+ }
47887
47921
  // src/channels/chat-driver-static.ts
47888
47922
  /**
47889
47923
  * Static (non-streaming) driver: consumes `AgentChunkType<any>` chunks and
@@ -47928,7 +47962,7 @@ async function runStaticDriver({ stream, chatThread, adapter, toolDisplay, toolD
47928
47962
  let textBuffer = "";
47929
47963
  const toolMessageIds = /* @__PURE__ */ new Map();
47930
47964
  const flushText = async () => {
47931
- const cleaned = textBuffer.replace(/[\u200B-\u200D\uFEFF]/g, "").trim();
47965
+ const cleaned = cleanBufferedText(textBuffer);
47932
47966
  if (cleaned) try {
47933
47967
  await chatThread.post(textFormat === "plain" ? cleaned : { markdown: cleaned });
47934
47968
  } catch (e) {
@@ -48263,7 +48297,7 @@ async function runStreamingDriver({ stream, chatThread, adapter, toolDisplay, to
48263
48297
  if (closed) break;
48264
48298
  await waitForNext();
48265
48299
  }
48266
- const cleaned = fallback.replace(/[\u200B-\u200D\uFEFF]/g, "").trim();
48300
+ const cleaned = cleanBufferedText(fallback);
48267
48301
  if (cleaned) try {
48268
48302
  await chatThread.post(textFormat === "plain" ? cleaned : { markdown: cleaned });
48269
48303
  } catch (postErr) {
@@ -48746,6 +48780,20 @@ const TEXT_CHUNK_TYPES = /* @__PURE__ */ new Set([
48746
48780
  /** Key the processor reads off `requestContext` to locate its render deps. */
48747
48781
  const CHAT_CHANNEL_RENDER_CONTEXT_KEY = "__mastra_chat_channel_render";
48748
48782
  /**
48783
+ * Whether a `requestContext` entry is a live render context rather than the
48784
+ * method-less husk a JSON snapshot round-trip leaves behind (issue #31310).
48785
+ * `wrapStream` is the first method the session calls, so its presence is the
48786
+ * signal that the object is usable.
48787
+ *
48788
+ * Every reader that treats a stashed render context as a live object (the
48789
+ * output processor, `resolveChannelRenderContext`, `AgentChannels.resolveRunRender`
48790
+ * and the generative-UI processor) guards with this, so a husk on a replica's
48791
+ * restored `requestContext` always falls through to a rebuild from the thread.
48792
+ */
48793
+ function isUsableRenderContext(value) {
48794
+ return typeof value === "object" && value !== null && typeof value.wrapStream === "function";
48795
+ }
48796
+ /**
48749
48797
  * Single-producer / single-consumer async queue. The processor pushes chunks
48750
48798
  * synchronously from `processOutputStream`; the driver consumes them via the
48751
48799
  * async iterable. `close()` ends the iteration after pending items are drained.
@@ -48879,7 +48927,7 @@ var ChatChannelOutputProcessor = class {
48879
48927
  async #resolveRenderContext(state, requestContext) {
48880
48928
  if (state.render !== void 0) return state.render;
48881
48929
  const fromRequest = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
48882
- if (fromRequest) {
48930
+ if (isUsableRenderContext(fromRequest)) {
48883
48931
  state.render = fromRequest;
48884
48932
  return fromRequest;
48885
48933
  }
@@ -49052,7 +49100,7 @@ var ChatChannelGenerativeUIProcessor = class {
49052
49100
  }
49053
49101
  async #resolve(requestContext, state) {
49054
49102
  const inbound = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
49055
- if (inbound) return inbound;
49103
+ if (isUsableRenderContext(inbound)) return inbound;
49056
49104
  if (state && "render" in state) return state.render ?? void 0;
49057
49105
  const threadId = parseMemoryRequestContext(requestContext)?.thread?.id;
49058
49106
  const render = threadId && this.#channels ? await this.#channels.buildRenderContextForThread(threadId) : null;
@@ -49206,6 +49254,8 @@ async function headContentType(url, logger) {
49206
49254
  }
49207
49255
  }
49208
49256
  // src/channels/processor.ts
49257
+ /** Per-run `state` key caching a thread's display mode recovered without a render context. */
49258
+ const RECOVERED_DISPLAY_KEY = "threadTextHidden";
49209
49259
  /**
49210
49260
  * Input processor that injects channel context (platform, bot identity, DM vs.
49211
49261
  * public-channel guidance) into the agent's system prompt on every step.
@@ -49239,19 +49289,37 @@ var ChatChannelProcessor = class {
49239
49289
  }
49240
49290
  async #resolve(requestContext, state) {
49241
49291
  const channel = requestContext?.get("channel");
49242
- if (channel) return {
49243
- channel,
49244
- textHidden: (requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY))?.textDisplay === "hidden"
49245
- };
49292
+ if (channel) {
49293
+ const render = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
49294
+ return {
49295
+ channel,
49296
+ textHidden: isUsableRenderContext(render) ? render.textDisplay === "hidden" : await this.#recoverTextHidden(requestContext, state)
49297
+ };
49298
+ }
49246
49299
  if (state && "thread" in state) return state.thread ?? void 0;
49300
+ const resolved = await this.#resolveThread(requestContext);
49301
+ if (state) state.thread = resolved;
49302
+ return resolved ?? void 0;
49303
+ }
49304
+ /** The channel-backed context of the run's memory thread, or `null` when it has none. */
49305
+ async #resolveThread(requestContext) {
49247
49306
  const threadId = parseMemoryRequestContext(requestContext)?.thread?.id;
49248
49307
  const found = threadId && this.#channels ? await this.#channels.buildChannelContextForThread(threadId) : null;
49249
- const resolved = found ? {
49308
+ return found ? {
49250
49309
  channel: found.channel,
49251
49310
  textHidden: found.render.textDisplay === "hidden"
49252
49311
  } : null;
49253
- if (state) state.thread = resolved;
49254
- return resolved ?? void 0;
49312
+ }
49313
+ /**
49314
+ * Display mode of a channel-backed thread whose render context is no longer on the
49315
+ * restored request context. Cached per run like the thread lookup above, so later
49316
+ * steps of the same run read the thread once.
49317
+ */
49318
+ async #recoverTextHidden(requestContext, state) {
49319
+ if (state && RECOVERED_DISPLAY_KEY in state) return state[RECOVERED_DISPLAY_KEY] === true;
49320
+ const textHidden = (await this.#resolveThread(requestContext))?.textHidden ?? false;
49321
+ if (state) state[RECOVERED_DISPLAY_KEY] = textHidden;
49322
+ return textHidden;
49255
49323
  }
49256
49324
  };
49257
49325
  function channelLines(ctx, textHidden, tools) {
@@ -49774,15 +49842,17 @@ var ChannelReplyModeProcessor = class {
49774
49842
  var MastraStateAdapter = class {
49775
49843
  memoryStore;
49776
49844
  getOwnerId;
49845
+ logger;
49777
49846
  connected = false;
49778
49847
  connectPromise = null;
49779
49848
  cache = /* @__PURE__ */ new Map();
49780
49849
  locks = /* @__PURE__ */ new Map();
49781
49850
  lists = /* @__PURE__ */ new Map();
49782
49851
  queues = /* @__PURE__ */ new Map();
49783
- constructor(memoryStore, getOwnerId) {
49852
+ constructor(memoryStore, getOwnerId, logger) {
49784
49853
  this.memoryStore = memoryStore;
49785
49854
  this.getOwnerId = getOwnerId;
49855
+ this.logger = logger;
49786
49856
  }
49787
49857
  async connect() {
49788
49858
  if (this.connected) return;
@@ -49801,7 +49871,10 @@ var MastraStateAdapter = class {
49801
49871
  }
49802
49872
  async subscribe(threadId) {
49803
49873
  const thread = await this.findThreadByExternalId(threadId);
49804
- if (!thread) return;
49874
+ if (!thread) {
49875
+ this.logger?.warn(`subscribe(${threadId}) ignored: no Mastra thread is mapped to this chat thread. Use AgentChannels.subscribeThread() for threads the bot started itself.`);
49876
+ return;
49877
+ }
49805
49878
  await this.memoryStore.patchThread({
49806
49879
  id: thread.id,
49807
49880
  metadata: {
@@ -50193,7 +50266,7 @@ function formatLegacyHistoryBlock(history, chatThread, platform) {
50193
50266
  async function resolveChannelRenderContext(requestContext, channels) {
50194
50267
  if (!requestContext) return void 0;
50195
50268
  const stashed = requestContext.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
50196
- if (stashed) return stashed;
50269
+ if (isUsableRenderContext(stashed)) return stashed;
50197
50270
  const threadId = requestContext.get("controller")?.threadId ?? parseMemoryRequestContext(requestContext)?.thread?.id;
50198
50271
  if (!threadId) return void 0;
50199
50272
  return await channels?.()?.buildRenderContextForThread(threadId) ?? void 0;
@@ -50637,7 +50710,7 @@ var AgentChannels = class {
50637
50710
  const storage = mastra.getStorage();
50638
50711
  const memoryStore = storage ? await storage.getStore("memory") : void 0;
50639
50712
  if (!memoryStore) throw new Error("Channels require storage to be configured on the Mastra instance. Configure a storage provider like LibSQLStore.");
50640
- this.stateAdapter = new MastraStateAdapter(memoryStore, () => this.getOwnerId());
50713
+ this.stateAdapter = new MastraStateAdapter(memoryStore, () => this.getOwnerId(), this.logger);
50641
50714
  this.log("info", "Using MastraStateAdapter (subscriptions persist across restarts)");
50642
50715
  }
50643
50716
  const { Chat, Message: ChatMessage, ThreadImpl } = await getChatModule();
@@ -50865,25 +50938,30 @@ var AgentChannels = class {
50865
50938
  runId = stashed.runId;
50866
50939
  toolName = stashed.toolName;
50867
50940
  toolArgs = stashed.args;
50868
- } else {
50941
+ }
50942
+ if (!requesterId) {
50869
50943
  const { result: lookup } = await this.lookupPersistedApproval({
50870
50944
  mastra,
50871
50945
  card,
50872
50946
  platform
50873
50947
  });
50874
- if (lookup.status === "answered") {
50875
- this.log("info", "Tool approval already answered", actionEventContext);
50876
- return;
50948
+ if (!stashed?.runId) {
50949
+ if (lookup.status === "answered") {
50950
+ this.log("info", "Tool approval already answered", actionEventContext);
50951
+ return;
50952
+ }
50953
+ if (lookup.status === "pending") {
50954
+ runId = lookup.runId;
50955
+ toolName = lookup.toolName;
50956
+ toolArgs = lookup.args;
50957
+ }
50877
50958
  }
50878
50959
  if (lookup.status === "pending") {
50879
- runId = lookup.runId;
50880
- toolName = lookup.toolName;
50881
- toolArgs = lookup.args;
50882
- if (adapterConfig?.toolApprovers !== "anyone" && !requesterId && lookup.authors.length > 1) {
50960
+ if (adapterConfig?.toolApprovers !== "anyone" && lookup.authors.length > 1) {
50883
50961
  this.log("info", "Ignoring tool approval action: requester is ambiguous", actionEventContext);
50884
50962
  return;
50885
50963
  }
50886
- requesterId ??= lookup.authors[0];
50964
+ requesterId = lookup.authors[0];
50887
50965
  }
50888
50966
  }
50889
50967
  if (!runId) {
@@ -51188,7 +51266,7 @@ var AgentChannels = class {
51188
51266
  */
51189
51267
  async resolveRunRender(requestContext, state) {
51190
51268
  const inbound = requestContext?.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
51191
- if (inbound) return inbound;
51269
+ if (isUsableRenderContext(inbound)) return inbound;
51192
51270
  if (state && "render" in state) return state.render ?? void 0;
51193
51271
  const render = await resolveChannelRenderContext(requestContext, () => this);
51194
51272
  if (state) state.render = render ?? null;
@@ -51217,8 +51295,8 @@ var AgentChannels = class {
51217
51295
  const has = (id) => configuredProcessors.some((p) => !isProcessorWorkflow(p) && p.id === id);
51218
51296
  const processors = [];
51219
51297
  if (Object.values(this.adapterConfigs).some((cfg) => cfg.threadLink) && !has(THREAD_LINK_PROCESSOR_ID)) processors.push(new ChannelThreadLinkProcessor((requestContext) => {
51220
- const render = requestContext.get(CHAT_CHANNEL_RENDER_CONTEXT_KEY);
51221
- return render && threadLinkOptions(this.adapterConfigs[render.platform]?.threadLink);
51298
+ const platform = requestContext.get("channel")?.platform ?? requestContext.get("__mastra_chat_channel_render")?.platform;
51299
+ return platform ? threadLinkOptions(this.adapterConfigs[platform]?.threadLink) : void 0;
51222
51300
  }));
51223
51301
  if (!has("chat-channel-render")) processors.push(new ChatChannelOutputProcessor(this));
51224
51302
  if (this.replyModeEnabled && !has(REPLY_STREAM_PROCESSOR_ID)) processors.push(new ChannelReplyStreamProcessor((requestContext) => this.resolveRunRender(requestContext)));
@@ -52400,6 +52478,36 @@ var AgentChannels = class {
52400
52478
  };
52401
52479
  }
52402
52480
  /**
52481
+ * Map a chat thread to a Mastra thread (creating the mapping if needed) and
52482
+ * subscribe to it, so follow-up replies reach the agent without a mention.
52483
+ *
52484
+ * Use this for threads the bot started itself, e.g. a scheduled digest posted
52485
+ * to Slack. Inbound messages create the mapping automatically, but a thread
52486
+ * the bot opened has none until someone mentions it. An existing mapping is
52487
+ * reused and keeps its original owner.
52488
+ *
52489
+ * @example
52490
+ * ```ts
52491
+ * const sent = await channel.post('Daily digest');
52492
+ * await agent.getChannels()!.subscribeThread({ thread: sent.thread, resourceId: 'digest-bot' });
52493
+ * ```
52494
+ */
52495
+ async subscribeThread({ thread, resourceId, threadId }) {
52496
+ const mastra = this.getMastra();
52497
+ if (!mastra) throw new Error("subscribeThread requires the agent to be registered with a Mastra instance.");
52498
+ await this.initialize(mastra);
52499
+ const mastraThread = await this.getOrCreateThread({
52500
+ externalThreadId: thread.id,
52501
+ channelId: thread.channelId,
52502
+ platform: thread.adapter.name,
52503
+ resourceId,
52504
+ threadId: threadId ? () => threadId : void 0,
52505
+ mastra
52506
+ });
52507
+ await this.stateAdapter.subscribe(thread.id);
52508
+ return mastraThread;
52509
+ }
52510
+ /**
52403
52511
  * Resolves an existing Mastra thread for the given external IDs, or creates one.
52404
52512
  */
52405
52513
  async getOrCreateThread({ externalThreadId, channelId, platform, resourceId, threadId, onCreate, mastra }) {
@@ -67187,7 +67295,7 @@ var MastraLLMVNext = class extends MastraBase {
67187
67295
  content: messages
67188
67296
  }];
67189
67297
  }
67190
- stream({ resumeContext, runId, stopWhen, maxSteps, tools = {}, modelSettings, toolChoice = "auto", threadId, resourceId, structuredOutput, options, inputProcessors, llmRequestInputProcessors, outputProcessors, errorProcessors, hasConfiguredErrorProcessors, returnScorerData, providerOptions, messageList, requireToolApproval, toolCallConcurrency, eagerToolExecution, streamPublisher, _internal, onTracingTripwire, onTracingTerminalError, tracingScope = createRunScope(), agentId, agentVersionId, resolvedScopes, agentName, toolCallId, requestContext, actor, mcp, methodType, includeRawChunks, experimentalTransform, hideSignals, autoResumeSuspendedTools, maxProcessorRetries, processorStates, activeTools, isTaskComplete, goal, onIterationComplete, workspace, agentRunSpan, agent, ...rest }) {
67298
+ stream({ resumeContext, runId, stopWhen, maxSteps, tools = {}, modelSettings, toolChoice = "auto", threadId, resourceId, structuredOutput, options, inputProcessors, llmRequestInputProcessors, outputProcessors, errorProcessors, hasConfiguredErrorProcessors, returnScorerData, providerOptions, messageList, requireToolApproval, toolCallConcurrency, eagerToolExecution, streamPublisher, _internal, onTracingTripwire, onTracingTerminalError, tracingScope = createRunScope(), agentId, agentVersionId, resolvedScopes, agentName, toolCallId, requestContext, actor, mcp, methodType, includeRawChunks, experimentalTransform, hideSignals, autoResumeSuspendedTools, maxProcessorRetries, processorStates, activeTools, isTaskComplete, goal, onIterationComplete, workspace, agentRunSpan, agent, resultType, ...rest }) {
67191
67299
  const observabilityContext = resolveObservabilityContext(rest);
67192
67300
  let stopWhenToUse;
67193
67301
  if (maxSteps && typeof maxSteps === "number") {
@@ -67213,7 +67321,8 @@ var MastraLLMVNext = class extends MastraBase {
67213
67321
  provider: firstModel.provider,
67214
67322
  streaming: true,
67215
67323
  parameters: modelSettings,
67216
- ...toolDefinitions ? { tools: toolDefinitions } : {}
67324
+ ...toolDefinitions ? { tools: toolDefinitions } : {},
67325
+ ...resultType ? { resultType } : {}
67217
67326
  },
67218
67327
  metadata: {
67219
67328
  runId,
@@ -73565,8 +73674,9 @@ function releaseRunMessageRefs(runId) {
73565
73674
  /**
73566
73675
  * A `SaveQueueManager` `onSaved` callback that records the rows a run saved,
73567
73676
  * so its persisted transcript references them instead of repeating them. Only
73568
- * runs that store refs hold an entry (the transcript store creates it), so saves
73569
- * for other runs, or landing after the run released its entry, are not kept.
73677
+ * runs that store refs hold an entry (created before the run saves its input,
73678
+ * else by the transcript store), so saves for other runs, or landing after the
73679
+ * run released its entry, are not kept.
73570
73680
  */
73571
73681
  function recordRunSavedMessages(runId) {
73572
73682
  return (rows) => {
@@ -76385,6 +76495,15 @@ function buildMessagesFromChunks({ chunks, messageId, responseModelMetadata, too
76385
76495
  });
76386
76496
  break;
76387
76497
  }
76498
+ case "custom": {
76499
+ const p = chunk.payload;
76500
+ parts.push({
76501
+ type: "custom",
76502
+ kind: p.kind,
76503
+ ...p.providerMetadata ? { providerMetadata: p.providerMetadata } : {}
76504
+ });
76505
+ break;
76506
+ }
76388
76507
  case "tool-call": {
76389
76508
  const p = chunk.payload;
76390
76509
  const toolDef = tools?.[p.toolName] || findProviderToolByName(tools, p.toolName);
@@ -83719,15 +83838,21 @@ async function persistDurableRunInput(runId, workflowInput, mastra, beforeSave)
83719
83838
  await beforeSave();
83720
83839
  }
83721
83840
  const inputCopy = entry.messageList.clone();
83722
- await entry.saveQueueManager.flushMessages(inputCopy, state.threadId, state.memoryConfig, {
83723
- throwOnError: true,
83724
- beforePersist: () => assertExecutionOwned({
83725
- runId,
83726
- agentId: workflowInput.agentId,
83727
- mastra,
83728
- requestContext
83729
- })
83730
- });
83841
+ if (state.fixedMemory) getRunMessageRefs(runId);
83842
+ try {
83843
+ await entry.saveQueueManager.flushMessages(inputCopy, state.threadId, state.memoryConfig, {
83844
+ throwOnError: true,
83845
+ beforePersist: () => assertExecutionOwned({
83846
+ runId,
83847
+ agentId: workflowInput.agentId,
83848
+ mastra,
83849
+ requestContext
83850
+ })
83851
+ });
83852
+ } catch (error) {
83853
+ if (state.fixedMemory) releaseRunMessageRefs(runId);
83854
+ throw error;
83855
+ }
83731
83856
  const embedded = entry.messageList.getEmbeddedMessages();
83732
83857
  for (const [messageId, textHash] of inputCopy.getEmbeddedMessages()) embedded.set(messageId, textHash);
83733
83858
  }
@@ -84054,7 +84179,7 @@ async function prepareForDurableExecution(options) {
84054
84179
  });
84055
84180
  let tripwireData;
84056
84181
  if (inputProcessors.length > 0) try {
84057
- const { ProcessorRunner } = await import("./stream-DoZ6F41o.js").then((n) => n.I);
84182
+ const { ProcessorRunner } = await import("./stream-DUUfwH38.js").then((n) => n.I);
84058
84183
  await new ProcessorRunner({
84059
84184
  inputProcessors,
84060
84185
  outputProcessors,
@@ -88519,11 +88644,13 @@ var Agent = class Agent extends MastraBase {
88519
88644
  ...observabilityContext,
88520
88645
  messageList,
88521
88646
  agentId: this.id,
88522
- agentName: this.name
88647
+ agentName: this.name,
88648
+ resultType: "title_generation"
88523
88649
  }).text;
88524
88650
  } else text = (await llm.__text({
88525
88651
  requestContext,
88526
88652
  ...observabilityContext,
88653
+ resultType: "title_generation",
88527
88654
  messages: [{
88528
88655
  role: "system",
88529
88656
  content: systemInstructions