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

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 (494) 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/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +49 -0
  4. package/dist/a2a/index.cjs +1 -1
  5. package/dist/a2a/index.js +1 -1
  6. package/dist/agent/agent.d.ts +3 -1
  7. package/dist/agent/durable/index.cjs +1 -1
  8. package/dist/agent/durable/index.js +1 -1
  9. package/dist/agent/durable/run-message-refs.d.ts +3 -2
  10. package/dist/agent/index.cjs +5 -4
  11. package/dist/agent/index.d.ts +2 -0
  12. package/dist/agent/index.js +5 -5
  13. package/dist/agent/merge-persona.d.ts +15 -0
  14. package/dist/agent/message-list/adapters/AIV5Adapter.d.ts +15 -1
  15. package/dist/agent/message-list/index.cjs +2 -2
  16. package/dist/agent/message-list/index.js +2 -2
  17. package/dist/agent/message-list/state/types.d.ts +5 -1
  18. package/dist/agent/message-list/types.d.ts +1 -1
  19. package/dist/agent/message-list/utils/provider-compat.d.ts +9 -1
  20. package/dist/agent-builder/ee/index.cjs +1 -1
  21. package/dist/agent-builder/ee/index.js +1 -1
  22. package/dist/agent-controller/agent-controller.d.ts +6 -0
  23. package/dist/agent-controller/index.cjs +2 -2
  24. package/dist/agent-controller/index.js +2 -2
  25. package/dist/agent-controller/session.d.ts +11 -1
  26. package/dist/agent-controller/worker-run-binding.d.ts +15 -0
  27. package/dist/{agent-controller-C1bK0CXm.js → agent-controller-BrRzZy4-.js} +66 -15
  28. package/dist/{agent-controller-BTIxiD1u.cjs → agent-controller-DKI-d-np.cjs} +66 -15
  29. package/dist/background-tasks/index.cjs +2 -1
  30. package/dist/background-tasks/index.d.ts +1 -1
  31. package/dist/background-tasks/index.js +1 -1
  32. package/dist/background-tasks/resolve-config.d.ts +30 -1
  33. package/dist/background-tasks/system-prompt.d.ts +8 -2
  34. package/dist/background-tasks/types.d.ts +47 -1
  35. package/dist/{background-tasks-BbVsBghi.js → background-tasks-CDP3Pgeu.js} +156 -33
  36. package/dist/{background-tasks-CVl6e0Jo.cjs → background-tasks-CDgdfRmB.cjs} +167 -32
  37. package/dist/browser/index.cjs +2 -2
  38. package/dist/browser/index.js +2 -2
  39. package/dist/{builder-BRJPSTig.cjs → builder-Bs4CtyqT.cjs} +2 -2
  40. package/dist/{builder-C8XzrtBQ.js → builder-DuT0Iqb5.js} +2 -2
  41. package/dist/capabilities/302ai.json +199 -199
  42. package/dist/capabilities/abliteratedllm.json +43 -34
  43. package/dist/capabilities/abliteration-ai.json +7 -7
  44. package/dist/capabilities/above.json +19 -19
  45. package/dist/capabilities/adaption.json +15 -15
  46. package/dist/capabilities/adzuki.json +27 -27
  47. package/dist/capabilities/agentrouter.json +13 -13
  48. package/dist/capabilities/agnes.json +3 -3
  49. package/dist/capabilities/ai-router.json +6 -6
  50. package/dist/capabilities/aiand.json +21 -21
  51. package/dist/capabilities/aigrow.json +12 -12
  52. package/dist/capabilities/aimlapi.json +143 -146
  53. package/dist/capabilities/aipg.json +2 -2
  54. package/dist/capabilities/aixy.json +22 -22
  55. package/dist/capabilities/aki-io.json +16 -16
  56. package/dist/capabilities/alibaba-cn.json +108 -102
  57. package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
  58. package/dist/capabilities/alibaba-coding-plan.json +5 -5
  59. package/dist/capabilities/alibaba-token-plan-cn.json +52 -52
  60. package/dist/capabilities/alibaba-token-plan.json +53 -53
  61. package/dist/capabilities/alibaba.json +98 -64
  62. package/dist/capabilities/ambient.json +17 -10
  63. package/dist/capabilities/amd.json +9 -9
  64. package/dist/capabilities/anthropic.json +45 -45
  65. package/dist/capabilities/anyapi.json +47 -47
  66. package/dist/capabilities/apiko.json +2 -2
  67. package/dist/capabilities/arcee.json +11 -11
  68. package/dist/capabilities/augure.json +6 -6
  69. package/dist/capabilities/auriko.json +20 -20
  70. package/dist/capabilities/bailing.json +4 -4
  71. package/dist/capabilities/baseten.json +33 -33
  72. package/dist/capabilities/bee.json +5 -5
  73. package/dist/capabilities/berget.json +20 -7
  74. package/dist/capabilities/bothub.json +14 -14
  75. package/dist/capabilities/boundless.json +37 -37
  76. package/dist/capabilities/bumo.json +42 -42
  77. package/dist/capabilities/byteplus.json +28 -28
  78. package/dist/capabilities/cerebras.json +4 -4
  79. package/dist/capabilities/cheapaimodel.json +7 -7
  80. package/dist/capabilities/cheapest-token.json +30 -30
  81. package/dist/capabilities/chutes.json +4 -4
  82. package/dist/capabilities/clarifai.json +2 -2
  83. package/dist/capabilities/claudinio.json +10 -1
  84. package/dist/capabilities/cline-pass.json +42 -42
  85. package/dist/capabilities/cloudcode.json +9 -16
  86. package/dist/capabilities/cloudferro-sherlock.json +4 -4
  87. package/dist/capabilities/cloudflare-workers-ai.json +14 -14
  88. package/dist/capabilities/commandcode.json +140 -140
  89. package/dist/capabilities/concentrate.json +289 -298
  90. package/dist/capabilities/cortecs.json +105 -105
  91. package/dist/capabilities/crossmodel.json +197 -197
  92. package/dist/capabilities/crusoe.json +38 -9
  93. package/dist/capabilities/daoxe.json +8 -8
  94. package/dist/capabilities/databricks.json +125 -125
  95. package/dist/capabilities/deepinfra.json +109 -94
  96. package/dist/capabilities/deepseek.json +4 -4
  97. package/dist/capabilities/digitalocean.json +112 -112
  98. package/dist/capabilities/dothoosh.json +34 -34
  99. package/dist/capabilities/doubleword.json +24 -24
  100. package/dist/capabilities/edenai.json +280 -292
  101. package/dist/capabilities/empiriolabs.json +168 -168
  102. package/dist/capabilities/engy.json +21 -21
  103. package/dist/capabilities/entrim.json +8 -8
  104. package/dist/capabilities/evroc.json +12 -12
  105. package/dist/capabilities/ezkielyna.json +8 -8
  106. package/dist/capabilities/fastrouter.json +87 -87
  107. package/dist/capabilities/fireworks-ai.json +130 -69
  108. package/dist/capabilities/fortytwo.json +9 -3
  109. package/dist/capabilities/freemodel.json +14 -14
  110. package/dist/capabilities/friendli.json +2 -2
  111. package/dist/capabilities/frogbot.json +96 -96
  112. package/dist/capabilities/gisoo.json +17 -17
  113. package/dist/capabilities/gmicloud.json +24 -24
  114. package/dist/capabilities/google.json +54 -54
  115. package/dist/capabilities/graphn.json +16 -16
  116. package/dist/capabilities/greenpt.json +35 -35
  117. package/dist/capabilities/groq.json +2 -2
  118. package/dist/capabilities/helicone.json +94 -94
  119. package/dist/capabilities/hetzner.json +35 -3
  120. package/dist/capabilities/hostinger-router.json +14 -14
  121. package/dist/capabilities/hpc-ai.json +11 -11
  122. package/dist/capabilities/huawei-maas.json +14 -14
  123. package/dist/capabilities/hubris.json +30 -30
  124. package/dist/capabilities/huggingface.json +113 -155
  125. package/dist/capabilities/humain.json +2 -2
  126. package/dist/capabilities/hyper.json +25 -33
  127. package/dist/capabilities/impossibl.json +155 -155
  128. package/dist/capabilities/inception.json +2 -2
  129. package/dist/capabilities/inceptron.json +8 -8
  130. package/dist/capabilities/inco.json +5 -5
  131. package/dist/capabilities/infer.json +20 -20
  132. package/dist/capabilities/inferall.json +14 -14
  133. package/dist/capabilities/inference-coop.json +9 -9
  134. package/dist/capabilities/inferenceapis.json +20 -20
  135. package/dist/capabilities/inferris.json +4 -4
  136. package/dist/capabilities/infersia.json +11 -11
  137. package/dist/capabilities/infomaniak.json +4 -4
  138. package/dist/capabilities/io-net.json +4 -4
  139. package/dist/capabilities/isoquant.json +4 -4
  140. package/dist/capabilities/iteracompute.json +59 -59
  141. package/dist/capabilities/jad-ai.json +3 -3
  142. package/dist/capabilities/jalapeno.json +10 -10
  143. package/dist/capabilities/jiekou.json +60 -60
  144. package/dist/capabilities/joingonka.json +4 -4
  145. package/dist/capabilities/jzstoken.json +58 -59
  146. package/dist/capabilities/keln.json +18 -18
  147. package/dist/capabilities/kenari.json +119 -127
  148. package/dist/capabilities/kilo.json +609 -613
  149. package/dist/capabilities/kimi-code-plan-cn.json +5 -5
  150. package/dist/capabilities/kimi-code-plan-global.json +5 -5
  151. package/dist/capabilities/kitani.json +6 -6
  152. package/dist/capabilities/klavo.json +20 -20
  153. package/dist/capabilities/korouter.json +32 -32
  154. package/dist/capabilities/kunavo.json +8 -8
  155. package/dist/capabilities/liquid.json +12 -12
  156. package/dist/capabilities/lithosai.json +2 -2
  157. package/dist/capabilities/llmgateway-providers.json +947 -878
  158. package/dist/capabilities/llmgateway.json +336 -335
  159. package/dist/capabilities/llmtr.json +26 -26
  160. package/dist/capabilities/logits.json +2 -2
  161. package/dist/capabilities/longcat.json +2 -2
  162. package/dist/capabilities/lowrouter.json +65 -65
  163. package/dist/capabilities/lyceum.json +19 -11
  164. package/dist/capabilities/melious.json +14 -14
  165. package/dist/capabilities/merge-gateway.json +264 -263
  166. package/dist/capabilities/meta.json +13 -13
  167. package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
  168. package/dist/capabilities/minimax-cn.json +5 -5
  169. package/dist/capabilities/minimax-coding-plan.json +2 -2
  170. package/dist/capabilities/minimax.json +5 -5
  171. package/dist/capabilities/mistral.json +21 -21
  172. package/dist/capabilities/mixlayer.json +3 -3
  173. package/dist/capabilities/modal.json +10 -10
  174. package/dist/capabilities/model-oracle-ai.json +26 -26
  175. package/dist/capabilities/modelis.json +17 -17
  176. package/dist/capabilities/modelscope.json +2 -2
  177. package/dist/capabilities/modular.json +30 -8
  178. package/dist/capabilities/moneo.json +12 -12
  179. package/dist/capabilities/moonshotai-cn.json +2 -2
  180. package/dist/capabilities/moonshotai.json +2 -2
  181. package/dist/capabilities/morph.json +17 -17
  182. package/dist/capabilities/munito-eu.json +6 -6
  183. package/dist/capabilities/munito.json +6 -6
  184. package/dist/capabilities/nan.json +29 -29
  185. package/dist/capabilities/nano-gpt.json +606 -593
  186. package/dist/capabilities/nearai.json +112 -112
  187. package/dist/capabilities/nebius.json +30 -30
  188. package/dist/capabilities/neon.json +136 -136
  189. package/dist/capabilities/neuralwatt.json +43 -43
  190. package/dist/capabilities/nokeep.json +4 -4
  191. package/dist/capabilities/novita-ai.json +136 -136
  192. package/dist/capabilities/nvidia.json +52 -35
  193. package/dist/capabilities/oathbreaker.json +24 -1
  194. package/dist/capabilities/obscurify.json +29 -29
  195. package/dist/capabilities/oci.json +7 -7
  196. package/dist/capabilities/ofox.json +315 -315
  197. package/dist/capabilities/ollama-cloud.json +53 -53
  198. package/dist/capabilities/openai.json +53 -53
  199. package/dist/capabilities/opencode-go.json +88 -88
  200. package/dist/capabilities/openreason.json +5 -5
  201. package/dist/capabilities/openrouter.json +528 -519
  202. package/dist/capabilities/opper.json +29 -29
  203. package/dist/capabilities/orcarouter.json +214 -214
  204. package/dist/capabilities/outerlabs.json +33 -33
  205. package/dist/capabilities/ovhcloud.json +20 -20
  206. package/dist/capabilities/pareto.json +6 -6
  207. package/dist/capabilities/pendra.json +4 -4
  208. package/dist/capabilities/perplexity-agent.json +55 -55
  209. package/dist/capabilities/perplexity.json +2 -2
  210. package/dist/capabilities/phala.json +26 -26
  211. package/dist/capabilities/pioneer.json +31 -31
  212. package/dist/capabilities/poe.json +136 -136
  213. package/dist/capabilities/poolside.json +2 -2
  214. package/dist/capabilities/powerspring.json +12 -12
  215. package/dist/capabilities/primalabs.json +9 -9
  216. package/dist/capabilities/prime.json +121 -111
  217. package/dist/capabilities/privatemode-ai.json +5 -5
  218. package/dist/capabilities/proxystacks.json +7 -7
  219. package/dist/capabilities/qiniu-ai.json +16 -16
  220. package/dist/capabilities/refuseless.json +9 -9
  221. package/dist/capabilities/regolo-ai.json +11 -11
  222. package/dist/capabilities/requesty.json +451 -177
  223. package/dist/capabilities/ruapi.json +35 -19
  224. package/dist/capabilities/runcrate.json +13 -13
  225. package/dist/capabilities/runinfra.json +18 -18
  226. package/dist/capabilities/sakana.json +7 -7
  227. package/dist/capabilities/sambanova.json +6 -6
  228. package/dist/capabilities/sandbase.json +25 -25
  229. package/dist/capabilities/sarvam.json +7 -7
  230. package/dist/capabilities/scaleway.json +19 -19
  231. package/dist/capabilities/scnet-token-plan.json +10 -10
  232. package/dist/capabilities/scx-ai.json +30 -30
  233. package/dist/capabilities/sensenova.json +12 -12
  234. package/dist/capabilities/siliconflow-cn.json +60 -60
  235. package/dist/capabilities/siliconflow.json +62 -62
  236. package/dist/capabilities/snowflake-cortex.json +21 -21
  237. package/dist/capabilities/sokkan.json +7 -7
  238. package/dist/capabilities/sparrowcodes.json +19 -19
  239. package/dist/capabilities/standardcompute.json +106 -106
  240. package/dist/capabilities/steadyrouter.json +37 -37
  241. package/dist/capabilities/stepfun-ai-step-plan.json +6 -6
  242. package/dist/capabilities/stepfun-ai.json +6 -6
  243. package/dist/capabilities/stepfun-step-plan.json +6 -6
  244. package/dist/capabilities/stepfun.json +6 -6
  245. package/dist/capabilities/stepping-stone.json +17 -17
  246. package/dist/capabilities/superbot-gg.json +4 -4
  247. package/dist/capabilities/synthetic.json +13 -13
  248. package/dist/capabilities/synthorai.json +24 -24
  249. package/dist/capabilities/teamorouter.json +23 -23
  250. package/dist/capabilities/teapot-router.json +11 -11
  251. package/dist/capabilities/tencent-token-plan-intl.json +126 -0
  252. package/dist/capabilities/tencent-token-plan.json +44 -44
  253. package/dist/capabilities/tencent-tokenhub.json +58 -43
  254. package/dist/capabilities/tensorx.json +40 -40
  255. package/dist/capabilities/tenstorrent.json +8 -8
  256. package/dist/capabilities/the-grid-ai.json +35 -35
  257. package/dist/capabilities/thinkingmachines.json +76 -76
  258. package/dist/capabilities/tinfoil.json +13 -13
  259. package/dist/capabilities/toapis.json +3 -3
  260. package/dist/capabilities/togetherai.json +54 -54
  261. package/dist/capabilities/tokengo.json +25 -25
  262. package/dist/capabilities/tokenify.json +9 -9
  263. package/dist/capabilities/tokenwatt.json +10 -2
  264. package/dist/capabilities/trustedrouter.json +7 -7
  265. package/dist/capabilities/trustedtokens.json +18 -18
  266. package/dist/capabilities/umans-ai-coding-plan.json +13 -13
  267. package/dist/capabilities/umans-ai.json +14 -14
  268. package/dist/capabilities/uncensuredai.json +5 -5
  269. package/dist/capabilities/unrestricted.json +8 -8
  270. package/dist/capabilities/uplinkswitch.json +22 -22
  271. package/dist/capabilities/upstage.json +6 -6
  272. package/dist/capabilities/vancine.json +23 -23
  273. package/dist/capabilities/vercel.json +543 -540
  274. package/dist/capabilities/vivgrid.json +88 -79
  275. package/dist/capabilities/volcengine-coding-plan.json +26 -26
  276. package/dist/capabilities/volcengine.json +26 -25
  277. package/dist/capabilities/vultr.json +32 -32
  278. package/dist/capabilities/wafer.ai.json +16 -16
  279. package/dist/capabilities/wallaby.json +2 -2
  280. package/dist/capabilities/wally.json +11 -11
  281. package/dist/capabilities/wandb.json +17 -17
  282. package/dist/capabilities/watt.json +25 -25
  283. package/dist/capabilities/xai.json +6 -6
  284. package/dist/capabilities/xiaomi.json +2 -2
  285. package/dist/capabilities/xpersona.json +13 -13
  286. package/dist/capabilities/xxapi.json +26 -26
  287. package/dist/capabilities/zai-coding-plan.json +15 -15
  288. package/dist/capabilities/zai.json +32 -32
  289. package/dist/capabilities/zenifra.json +26 -26
  290. package/dist/capabilities/zenmux.json +208 -208
  291. package/dist/capabilities/zerogpu.json +13 -13
  292. package/dist/capabilities/zhipuai-coding-plan.json +4 -4
  293. package/dist/capabilities/zhipuai.json +31 -31
  294. package/dist/capabilities/zro.json +7 -7
  295. package/dist/channels/agent-channels.d.ts +22 -0
  296. package/dist/channels/index.cjs +2 -2
  297. package/dist/channels/index.js +2 -2
  298. package/dist/channels/output-processor.d.ts +12 -0
  299. package/dist/channels/state-adapter.d.ts +3 -1
  300. package/dist/channels/stream-helpers.d.ts +17 -0
  301. package/dist/{channels-Cl-pRrWB.cjs → channels-Bkd_v8M1.cjs} +1 -1
  302. package/dist/{channels-DegTNzaq.js → channels-CkRMEIQ6.js} +1 -1
  303. package/dist/coding-agent/index.cjs +2 -2
  304. package/dist/coding-agent/index.js +2 -2
  305. package/dist/{constants-B9ZDvXZ4.cjs → constants-Bou0hEgY.cjs} +4 -0
  306. package/dist/{constants-BmdTvEYN.js → constants-CFWgIaqA.js} +4 -0
  307. package/dist/datasets/experiment/scorer.d.ts +16 -5
  308. package/dist/datasets/index.cjs +2 -2
  309. package/dist/datasets/index.js +2 -2
  310. package/dist/docs/SKILL.md +2 -1
  311. package/dist/docs/assets/SOURCE_MAP.json +1070 -1055
  312. package/dist/docs/references/docs-agents-code-mode.md +36 -0
  313. package/dist/docs/references/docs-agents-networks.md +1 -1
  314. package/dist/docs/references/docs-agents-tools.md +6 -0
  315. package/dist/docs/references/docs-auth-simple-auth.md +8 -8
  316. package/dist/docs/references/docs-browser.md +3 -1
  317. package/dist/docs/references/docs-evals-custom-scorers.md +1 -1
  318. package/dist/docs/references/docs-harness-background-tasks.md +38 -0
  319. package/dist/docs/references/docs-knowledge-agents-and-tools.md +2 -0
  320. package/dist/docs/references/docs-mastra-platform-observability-overview.md +3 -189
  321. package/dist/docs/references/docs-memory-message-history.md +25 -0
  322. package/dist/docs/references/docs-sandbox-lsp.md +5 -6
  323. package/dist/docs/references/docs-sandbox-overview.md +20 -0
  324. package/dist/docs/references/docs-sandbox-skills.md +2 -0
  325. package/dist/docs/references/docs-signals-sending-signals.md +1 -1
  326. package/dist/docs/references/integrations.md +1 -0
  327. package/dist/docs/references/reference-agent-controller-session.md +30 -2
  328. package/dist/docs/references/reference-agents-generate.md +1 -1
  329. package/dist/docs/references/reference-agents-network.md +1 -1
  330. package/dist/docs/references/reference-configuration.md +8 -8
  331. package/dist/docs/references/reference-core-getWorkspaceById.md +37 -0
  332. package/dist/docs/references/reference-evals-create-scorer.md +5 -5
  333. package/dist/docs/references/reference-evals-run-evals.md +1 -1
  334. package/dist/docs/references/reference-knowledge-knowledge-tools.md +3 -3
  335. package/dist/docs/references/reference-manual-install.md +1 -1
  336. package/dist/docs/references/reference-memory-observational-memory.md +8 -0
  337. package/dist/docs/references/reference-observability-tracing-interfaces.md +10 -6
  338. package/dist/docs/references/reference-processors-processor-interface.md +3 -2
  339. package/dist/docs/references/reference-processors-system-prompt-scrubber.md +1 -1
  340. package/dist/docs/references/reference-processors-tool-search-processor.md +3 -3
  341. package/dist/docs/references/reference-pubsub-base.md +5 -3
  342. package/dist/docs/references/reference-pubsub-caching-pubsub.md +3 -1
  343. package/dist/docs/references/reference-storage-overview.md +1 -1
  344. package/dist/docs/references/reference-storage-retention.md +20 -20
  345. package/dist/docs/references/reference-tools-create-code-mode.md +22 -0
  346. package/dist/docs/references/reference-tools-vector-query-tool.md +8 -0
  347. package/dist/docs/references/reference-voice-overview.md +11 -26
  348. package/dist/docs/references/reference-voice-speech-to-speech.md +1 -1
  349. package/dist/docs/references/reference-voice-voice.listen.md +1 -0
  350. package/dist/docs/references/reference-voice-voice.speak.md +1 -3
  351. package/dist/docs/references/reference-workspace-factory-sandbox.md +6 -6
  352. package/dist/docs/references/reference-workspace-sandbox.md +14 -0
  353. package/dist/docs/references/reference.md +1 -0
  354. package/dist/evals/index.cjs +2 -2
  355. package/dist/evals/index.js +2 -2
  356. package/dist/evals/scoreTraces/index.cjs +2 -2
  357. package/dist/evals/scoreTraces/index.js +2 -2
  358. package/dist/events/index.cjs +1 -1
  359. package/dist/events/index.js +1 -1
  360. package/dist/harness/index.cjs +2 -2
  361. package/dist/harness/index.js +2 -2
  362. package/dist/index.cjs +1 -1
  363. package/dist/index.js +1 -1
  364. package/dist/knowledge/agent-scopes.d.ts +17 -0
  365. package/dist/knowledge/declarations.d.ts +2 -0
  366. package/dist/knowledge/held-scopes-state-processor.d.ts +50 -0
  367. package/dist/knowledge/importers/host.d.ts +7 -1
  368. package/dist/knowledge/importers/overlay.d.ts +138 -0
  369. package/dist/knowledge/importers/runner.d.ts +12 -0
  370. package/dist/knowledge/importers/sink.d.ts +6 -0
  371. package/dist/knowledge/importers/types.d.ts +9 -0
  372. package/dist/knowledge/index.cjs +1611 -167
  373. package/dist/knowledge/index.d.ts +12 -2
  374. package/dist/knowledge/index.js +1610 -168
  375. package/dist/knowledge/links.d.ts +27 -0
  376. package/dist/knowledge/page-tools.d.ts +23 -0
  377. package/dist/knowledge/pinned-state-processor.d.ts +2 -2
  378. package/dist/knowledge/run.d.ts +5 -0
  379. package/dist/knowledge/scope-runtime.d.ts +6 -0
  380. package/dist/llm/index.cjs +3 -3
  381. package/dist/llm/index.js +3 -3
  382. package/dist/llm/model/base.types.d.ts +3 -1
  383. package/dist/llm/model/mastra-gateway-provider-tools.d.ts +9 -6
  384. package/dist/llm/model/model.d.ts +1 -1
  385. package/dist/llm/model/model.loop.d.ts +1 -1
  386. package/dist/llm/model/model.loop.types.d.ts +3 -1
  387. package/dist/llm/model/provider-options.d.ts +4 -3
  388. package/dist/llm/model/provider-types.generated.d.ts +8161 -8082
  389. package/dist/{llm-BKxlS9Kk.cjs → llm-DAw2eouV.cjs} +38 -78
  390. package/dist/{llm-CMkzIFAk.js → llm-DFT5EKp4.js} +38 -78
  391. package/dist/loop/index.cjs +2 -2
  392. package/dist/loop/index.js +2 -2
  393. package/dist/{manager-C-eQXmRq.js → manager-DiDnvKLM.js} +106 -35
  394. package/dist/{manager-CasaT35Q.cjs → manager-hxzEe4U5.cjs} +106 -35
  395. package/dist/mastra/index.cjs +1 -1
  396. package/dist/mastra/index.js +1 -1
  397. package/dist/{mastra-C7Tj4U8c.cjs → mastra-1diaq68N.cjs} +17 -17
  398. package/dist/{mastra-5EEmN3Ok.js → mastra-BPaPxG5t.js} +17 -17
  399. package/dist/memory/index.cjs +3 -3
  400. package/dist/memory/index.js +3 -3
  401. package/dist/{message-list-wI71UGxk.js → message-list-BGm1DCiG.js} +230 -129
  402. package/dist/{message-list-DfN9mWeN.cjs → message-list-vR3uLAHL.cjs} +230 -129
  403. package/dist/{model-DCLUL-8a.js → model-CUBZjm0T.js} +4 -3
  404. package/dist/{model-9HA-W0tg.cjs → model-DSMHJM3c.cjs} +4 -3
  405. package/dist/{netlify-Cq3H-A9I.cjs → netlify-C21T9ozJ.cjs} +41364 -30461
  406. package/dist/{netlify-DaWURNSU.js → netlify-D1BKjns0.js} +41361 -30464
  407. package/dist/notifications/index.cjs +1 -1
  408. package/dist/notifications/index.js +1 -1
  409. package/dist/observability/types/tracing.d.ts +1 -1
  410. package/dist/processor-provider/index.cjs +1 -1
  411. package/dist/processor-provider/index.js +1 -1
  412. package/dist/processors/index.cjs +2 -2
  413. package/dist/processors/index.js +2 -2
  414. package/dist/processors/processors/tool-search.d.ts +2 -2
  415. package/dist/processors/runner.d.ts +12 -0
  416. package/dist/{provider-registry-DWixjFX7.js → provider-registry-BAlFFX5o.js} +21911 -21671
  417. package/dist/{provider-registry-a649fS5r.cjs → provider-registry-ChojUVJa.cjs} +21910 -21670
  418. package/dist/provider-registry.json +21947 -21767
  419. package/dist/{registry-generator-BYJC7p8M.js → registry-generator-BbWSH6W4.js} +1 -1
  420. package/dist/{registry-generator-BuKC7UKd.cjs → registry-generator-CAUL9Hek.cjs} +1 -1
  421. package/dist/{rehydrate-DR2_WAz2.cjs → rehydrate-0xSq47n9.cjs} +2 -2
  422. package/dist/{rehydrate-DPhmASM6.js → rehydrate-CzUnNFU6.js} +2 -2
  423. package/dist/relevance/index.cjs +2 -2
  424. package/dist/relevance/index.js +2 -2
  425. package/dist/{run-registry-oUNF6szW.cjs → run-registry-CrTsH9iL.cjs} +1158 -125
  426. package/dist/{run-registry-D3X7XvUL.js → run-registry-DJT02z_9.js} +1092 -125
  427. package/dist/storage/constants.cjs +1 -1
  428. package/dist/storage/constants.js +1 -1
  429. package/dist/storage/domains/knowledge/base.d.ts +101 -1
  430. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +10 -0
  431. package/dist/storage/domains/knowledge/importers.d.ts +39 -0
  432. package/dist/storage/domains/knowledge/inmemory.d.ts +8 -0
  433. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +35 -1
  434. package/dist/storage/domains/knowledge/pages.d.ts +74 -0
  435. package/dist/storage/index.cjs +3 -3
  436. package/dist/storage/index.js +3 -3
  437. package/dist/storage/types.d.ts +14 -0
  438. package/dist/stream/index.cjs +2 -2
  439. package/dist/stream/index.js +2 -2
  440. package/dist/{stream-DoZ6F41o.js → stream-CG9OooRx.js} +37 -14
  441. package/dist/{stream-DQC1vpvl.cjs → stream-CMKRczs4.cjs} +37 -14
  442. package/dist/test-utils/llm-mock.cjs +1 -1
  443. package/dist/test-utils/llm-mock.js +1 -1
  444. package/dist/{to-prompt-B9eZo2U5.cjs → to-prompt-CG-LyaBY.cjs} +9 -0
  445. package/dist/{to-prompt-BsDtVXrf.js → to-prompt-CMlVGYxC.js} +9 -0
  446. package/dist/tool-loop-agent/index.cjs +1 -1
  447. package/dist/tool-loop-agent/index.js +1 -1
  448. package/dist/{tool-loop-agent-Cy4NDOMS.cjs → tool-loop-agent-14o3Z1qo.cjs} +4 -4
  449. package/dist/{tool-loop-agent-C9YkvDRd.js → tool-loop-agent-Bi6z_q7o.js} +4 -4
  450. package/dist/tools/code-mode/index.d.ts +2 -0
  451. package/dist/tools/code-mode/log-collector.d.ts +49 -0
  452. package/dist/tools/code-mode/types.d.ts +71 -0
  453. package/dist/tools/index.cjs +3 -1
  454. package/dist/tools/index.js +2 -2
  455. package/dist/{tools-CGF5Ik6j.cjs → tools-BEYxowf0.cjs} +429 -61
  456. package/dist/{tools-CDfyMpzN.js → tools-tPy2FwMI.js} +418 -62
  457. package/dist/{utils-Bs2IYyOb.cjs → utils-DkvbP8EA.cjs} +7 -6
  458. package/dist/{utils-9JyiKu5r.js → utils-Fag7YDBU.js} +7 -6
  459. package/dist/utils.cjs +1 -1
  460. package/dist/utils.js +1 -1
  461. package/dist/{validate-BE3mVxVy.cjs → validate-Bhrlve2E.cjs} +1 -1
  462. package/dist/{validate-8j0phWFV.js → validate-DLER0nlQ.js} +1 -1
  463. package/dist/vector/index.cjs +2 -2
  464. package/dist/vector/index.js +2 -2
  465. package/dist/worker/index.cjs +1 -1
  466. package/dist/worker/index.js +1 -1
  467. package/dist/worker/workers/orchestration-worker.d.ts +1 -0
  468. package/dist/{worker-DwdgU6E9.cjs → worker-0gczpztM.cjs} +2 -2
  469. package/dist/{worker-BiK1kfMa.cjs → worker-BwJyrFQN.cjs} +10 -4
  470. package/dist/{worker-BfWFqSH2.js → worker-D-em3hyS.js} +5 -5
  471. package/dist/{worker-DIRdEwih.js → worker-leYV1Y91.js} +2 -2
  472. package/dist/{workflow-CxQMcTbT.cjs → workflow-DWdcEcxw.cjs} +3 -3
  473. package/dist/{workflow-ni-keg2i.js → workflow-FikHVwog.js} +3 -3
  474. package/dist/workflows/builder/index.cjs +1 -1
  475. package/dist/workflows/builder/index.js +1 -1
  476. package/dist/workflows/evented/index.cjs +1 -1
  477. package/dist/workflows/evented/index.js +1 -1
  478. package/dist/workflows/index.cjs +4 -4
  479. package/dist/workflows/index.js +4 -4
  480. package/dist/workflows/step.d.ts +2 -0
  481. package/dist/workflows/workflow.d.ts +2 -0
  482. package/dist/workspace/index.cjs +3 -1
  483. package/dist/workspace/index.d.ts +1 -1
  484. package/dist/workspace/index.js +2 -2
  485. package/dist/workspace/lsp/manager.d.ts +19 -4
  486. package/dist/workspace/sandbox/mastra-sandbox.d.ts +17 -0
  487. package/dist/workspace/sandbox/teardown-context.d.ts +74 -0
  488. package/dist/workspace/tools/index.d.ts +1 -0
  489. package/dist/workspace/tools/media.d.ts +20 -1
  490. package/dist/workspace/tools/recreate-sandbox.d.ts +24 -0
  491. package/dist/{workspace-X2RHJZU9.cjs → workspace-C8Zo5_qK.cjs} +387 -109
  492. package/dist/{workspace-DY2Nxiyi.js → workspace-DOAil8mG.js} +376 -110
  493. package/package.json +6 -6
  494. package/src/llm/model/provider-types.generated.d.ts +8161 -8082
@@ -132,6 +132,26 @@ const agent = new Agent({
132
132
 
133
133
  The generated code for `sales_code` can't call an inventory tool, and the reverse holds too. Use this for least-privilege scoping and to keep each tool's prompt surface small.
134
134
 
135
+ ## Execution limits
136
+
137
+ Code mode runs model-authored code, so you can bound what a single program may consume. Every limit is opt-in and set on `createCodeMode()`:
138
+
139
+ ```typescript
140
+ const { tool, instructions } = createCodeMode({
141
+ tools: { getTopProducts, getProductRatings },
142
+ sandbox: new LocalSandbox(),
143
+ timeout: 30_000, // wall-clock limit for the whole program
144
+ maxCalls: 25, // cap the number of external_* calls
145
+ maxConcurrentCalls: 5, // run at most 5 at a time; the rest queue
146
+ maxResultBytes: 256_000, // cap each nested tool result
147
+ maxLogLines: 200, // bound captured console logs
148
+ })
149
+ ```
150
+
151
+ `maxCalls` and `maxResultBytes` fail the whole run with a `CodeModeLimitError` when exceeded, even if the program catches the rejection. `maxConcurrentCalls` queues extra calls instead of failing, so a `Promise.all` fan-out still completes. `maxLogBytes` and `maxLogLines` truncate the captured logs and the program still succeeds. The [`createCodeMode()` reference](https://mastra.ai/reference/tools/create-code-mode) has the full behavior.
152
+
153
+ For multi-tenant hosts, pair these with the runtime budgets of the in-process transports, such as the QuickJS `maxInterruptTicks` and `shouldInterrupt` options. See [Execution limits](https://mastra.ai/reference/tools/quickjs-transport) in the transport reference.
154
+
135
155
  ## Connected tools
136
156
 
137
157
  To orchestrate the tools of providers connected in Mastra Platform, use [`tools().codeMode()`](https://mastra.ai/reference/connect/tools) from `@mastra/connect`. It builds the code tool and instructions from the current connections on each request, and keeps tools that need approval as direct agent tools.
@@ -180,6 +200,22 @@ const { tool, instructions } = createCodeMode(
180
200
  )
181
201
  ```
182
202
 
203
+ Importing `@mastra/quickjs` doesn't initialize the default TypeScript stripper, so the import is safe on runtimes without Node.js globals such as Cloudflare Workers. The default stripper (`ts-blank-space`) loads on the first run that needs it, and on those runtimes it can't load at all: it pulls in `typescript`, which reads `__filename` while it initializes. Pass a stripper that runs there instead:
204
+
205
+ ```typescript
206
+ import { createCodeMode } from '@mastra/core/tools'
207
+ import { QuickJsCodeModeTransport } from '@mastra/quickjs'
208
+
209
+ // Programs that are already plain JavaScript need no transform, and nothing
210
+ // that depends on Node.js globals is loaded.
211
+ const { tool, instructions } = createCodeMode(
212
+ { tools },
213
+ new QuickJsCodeModeTransport({ stripTypes: code => code }),
214
+ )
215
+ ```
216
+
217
+ Where a build step can strip the types, send the program already stripped. To cap CPU-heavy programs on a host with a frozen clock, set `maxInterruptTicks` or `shouldInterrupt`. See the [QuickJsCodeModeTransport reference](https://mastra.ai/reference/tools/quickjs-transport).
218
+
183
219
  See [Choosing a transport](https://mastra.ai/reference/tools/quickjs-transport) for a side-by-side comparison.
184
220
 
185
221
  ## Related
@@ -110,7 +110,7 @@ const stream = await routingAgent.network('Perform some sensitive action', {
110
110
  for await (const chunk of stream) {
111
111
  if (chunk.type === 'agent-execution-approval' || chunk.type === 'tool-execution-approval') {
112
112
  // Approve
113
- const approvedStream = await routingAgent.approveNetworkToolCall(chunk.payload.toolCallId, {
113
+ const approvedStream = await routingAgent.approveNetworkToolCall({
114
114
  runId: stream.runId,
115
115
  memory: { thread: 'user-123', resource: 'my-app' },
116
116
  })
@@ -636,6 +636,12 @@ The tool takes a single `url` input and returns `content`, `truncated`, `status`
636
636
 
637
637
  Failures don't throw. The tool returns `isError: true` with the reason in `content`, so the agent can retry or explain the problem.
638
638
 
639
+ #### Cloudflare Workers
640
+
641
+ The tool also runs on Cloudflare Workers with `nodejs_compat`, which the Cloudflare deployer enables. Workers can't pass the tool's DNS check to Node's request API. On Workers, the tool sends requests with `fetch` instead. It still checks every URL and redirect target before requesting it, still applies the same `localhost` and IP address checks as on Node to hosts written in the URL, and keeps the same redirect and size limits. The 15-second timeout works differently on Workers. On Node, a request times out after 15 seconds without network activity. On Workers, each request, including reading the response body, must finish within 15 seconds.
642
+
643
+ On Workers the tool can't check which address a hostname resolves to. It doesn't block a public hostname whose DNS record points to a private address, including DNS rebinding. Cloudflare's network refuses most such requests from a deployed Worker, but Cloudflare doesn't document that behavior, and local `wrangler dev` reaches private addresses normally. Don't rely on the tool as the only guard for private services on Workers.
644
+
639
645
  ### Ask the user a question
640
646
 
641
647
  Import [`askUserTool`](https://mastra.ai/reference/tools/ask-user-tool) and add it to the agent's toolset.
@@ -56,14 +56,14 @@ export const mastra = new Mastra({
56
56
 
57
57
  ## Configuration options
58
58
 
59
- | Option | Type | Required | Description |
60
- | --------------- | ------------------------------------------------ | -------- | -------------------------------------- |
61
- | `tokens` | `Record<string, TUser>` | Yes | Map of tokens to user objects |
62
- | `headers` | `string \| string[]` | No | Additional headers to check for tokens |
63
- | `name` | `string` | No | Provider name for logging |
64
- | `authorizeUser` | `(user, request) => boolean \| Promise<boolean>` | No | Custom authorization function |
65
- | `protected` | `(RegExp \| string)[]` | No | Paths that require authentication |
66
- | `public` | `(RegExp \| string)[]` | No | Paths that bypass authentication |
59
+ | Option | Type | Required | Description |
60
+ | --------------- | -------------------------------------------------------- | -------- | -------------------------------------- |
61
+ | `tokens` | `Record<string, TUser>` | Yes | Map of tokens to user objects |
62
+ | `headers` | `string \| string[]` | No | Additional headers to check for tokens |
63
+ | `name` | `string` | No | Provider name for logging |
64
+ | `authorizeUser` | `(user, request) => boolean \| Promise<boolean>` | No | Custom authorization function |
65
+ | `protected` | `(RegExp \| string \| [string, Methods \| Methods[]])[]` | No | Paths that require authentication |
66
+ | `public` | `(RegExp \| string \| [string, Methods \| Methods[]])[]` | No | Paths that bypass authentication |
67
67
 
68
68
  ### Default headers
69
69
 
@@ -9,11 +9,12 @@ Browser support lets agents navigate websites, interact with page elements, fill
9
9
  - **SDK providers** wrap a browser automation library and give the agent browser tools directly.
10
10
  - **CLI providers** launch a browser that the agent controls through command-line tools.
11
11
 
12
- Mastra includes three SDK providers and one CLI provider:
12
+ Mastra includes four SDK providers and one CLI provider:
13
13
 
14
14
  - [**AgentBrowser**](https://mastra.ai/integrations/browsers/agent-browser): An SDK provider built on Playwright that finds page elements through accessibility information. Use it for general web automation and scraping.
15
15
  - [**Stagehand**](https://mastra.ai/integrations/browsers/stagehand): An SDK provider built on the Stagehand library from Browserbase. It uses AI to find page elements. Use it for complex interactions where describing an element in natural language works better than a fixed selector.
16
16
  - [**FirecrawlBrowser**](https://mastra.ai/integrations/browsers/firecrawl): An SDK provider that runs AgentBrowser tools in hosted Firecrawl Browser Sandbox sessions. Use it to avoid running browsers on your own infrastructure.
17
+ - [**PlatformBrowser**](https://mastra.ai/integrations/browsers/mastra-platform): An SDK provider that runs AgentBrowser tools in hosted browsers from Mastra Platform. Use it for agents deployed on Mastra Platform.
17
18
  - [**BrowserViewer**](https://mastra.ai/integrations/browsers/browser-viewer): A CLI provider that launches Chrome and passes its Chrome DevTools Protocol (CDP) URL to CLI tools such as agent-browser, browser-use, and browse. Use it for workspace agents that control browsers through shell commands.
18
19
 
19
20
  ## When to use a browser
@@ -215,6 +216,7 @@ Recordings use Motion-JPEG AVI and don't require `ffmpeg`. The default maximum d
215
216
  - [AgentBrowser](https://mastra.ai/integrations/browsers/agent-browser)
216
217
  - [Stagehand](https://mastra.ai/integrations/browsers/stagehand)
217
218
  - [Firecrawl](https://mastra.ai/integrations/browsers/firecrawl)
219
+ - [Mastra Platform](https://mastra.ai/integrations/browsers/mastra-platform)
218
220
  - [BrowserViewer](https://mastra.ai/integrations/browsers/browser-viewer)
219
221
  - [MastraBrowser reference](https://mastra.ai/reference/browser/mastra-browser)
220
222
  - 📹 [Mastra browser capabilities workshop](https://www.youtube.com/watch?v=E9KFsZEnQO8\&t=5s)
@@ -230,7 +230,7 @@ const glutenCheckerScorer = createScorer({...})
230
230
  })
231
231
  ```
232
232
 
233
- **Prompt Objects:** See the [`createScorer`](https://mastra.ai/reference/evals/create-scorer) API reference for details on using prompt objects with generateScore, including required `calculateScore` function.
233
+ **Prompt Objects:** See the [`createScorer`](https://mastra.ai/reference/evals/create-scorer) API reference for details on using prompt objects with generateScore. A prompt object needs a `description` and a `createPrompt` function, and the judge returns the numerical score.
234
234
 
235
235
  **Data Flow:** The score is available to generateReason as the `score` parameter
236
236
 
@@ -98,6 +98,25 @@ export const researcher = new Agent({
98
98
 
99
99
  Set `tools: 'all'` to opt in every tool the agent has.
100
100
 
101
+ ### Agent-wide defaults
102
+
103
+ Agent-wide `defaultDisposition` and `modelOverrides` sit next to `tools` and apply to every tool the agent has opted in, so you don't have to repeat them per tool:
104
+
105
+ ```typescript
106
+ export const researcher = new Agent({
107
+ // ...
108
+ backgroundTasks: {
109
+ tools: 'all',
110
+ defaultDisposition: 'foreground',
111
+ modelOverrides: false,
112
+ },
113
+ })
114
+ ```
115
+
116
+ Both act as defaults. For each tool the agent has opted in, `defaultDisposition` resolves as the tool entry's own value, then the agent-wide value, then the tool's own `background` config, then `deferred`. `modelOverrides` resolves the same way but defaults to `true`. `enabled` is never inherited, so agent-wide fields can't opt a tool in on their own.
117
+
118
+ Agent-wide values apply to named entries too, so a plain `tools: { research: true }` inherits them. An entry can still opt out per tool with its own `defaultDisposition` or `modelOverrides`. `defaultDisposition` accepts `'foreground'` or `'deferred'`, so `awaited` remains a per-call `_background` choice.
119
+
101
120
  ### LLM per-call override
102
121
 
103
122
  When a tool is registered on an agent that has background tasks enabled, the model can include a `_background` field in the tool arguments to override the resolved configuration for that specific call. The model only includes what it wants to override, all fields in `_background` are optional. The override is stripped from the arguments before the tool runs.
@@ -119,6 +138,25 @@ For compatibility, `_background.enabled: true` selects `deferred`, and `_backgro
119
138
 
120
139
  The `_background` override only _modifies_ tools the developer has already opted in at the tool or agent layer. If a tool hasn't been opted in, a model-selected background disposition is ignored and the tool runs in the foreground. This keeps deterministic, foreground-only tools (calculators, lookups, schema validators) from being silently dispatched as tasks.
121
140
 
141
+ ### Disable the per-call override
142
+
143
+ The `_background` object adds five optional parameters to each eligible tool's input schema: the object itself plus `enabled`, `disposition`, `timeoutMs`, and `maxRetries`. Some providers cap optional parameters per request. Anthropic rejects strict tool schemas with more than 24 optional parameters in total, so five strict background tools exceed the limit before counting their own optional fields.
144
+
145
+ Set `modelOverrides: false` when a tool should always use its configured disposition. Mastra then leaves `_background` out of the tool's schema and the system prompt, and ignores any `_background` value the model sends:
146
+
147
+ ```typescript
148
+ const researchTool = createTool({
149
+ id: 'research',
150
+ description: 'Research a topic in depth',
151
+ strict: true,
152
+ inputSchema: z.object({ topic: z.string() }),
153
+ background: { enabled: true, modelOverrides: false },
154
+ execute: async ({ topic }) => runResearch(topic),
155
+ })
156
+ ```
157
+
158
+ You can also set `modelOverrides: false` on an agent's per-tool entry, for example `backgroundTasks: { tools: { research: { enabled: true, modelOverrides: false } } }`. The agent entry takes precedence over the tool definition. Tools with `modelOverrides: false` and `defaultDisposition: 'foreground'` always run in the foreground.
159
+
122
160
  ### Resolution order
123
161
 
124
162
  When a tool call is dispatched, agent-level and tool-level settings determine eligibility and fallback values. For an eligible tool, the LLM `_background` fields override the corresponding values for that call. Manager defaults fill timeout and retry values that remain unset. An `_background` field can't enable a tool that's not eligible.
@@ -55,6 +55,8 @@ export const supportAgent = new Agent({
55
55
 
56
56
  To change these instructions, see [Tool instructions](https://mastra.ai/reference/knowledge/tool-instructions).
57
57
 
58
+ When the agent has Memory and its `knowledge` option turns on read or write tools, it also learns which scopes it holds before it calls a tool. Knowledge with no tools turned on doesn't send this list, and neither do tools you add yourself with `createTools()`. Each turn's context lists each scope the run holds and has a role on, with that role. A role in one scope can also grant access to others, such as a team's docs through its org. Those aren't listed. Viewers can read, and contributors, editors and owners can also write. Scopes with no pages yet are listed too. This list is a [state signal](https://mastra.ai/docs/signals/state-signals): the first turn gets the full list, and later turns get only what changed, such as a scope added, a role changed, or a scope removed. If the full list has left the context window, the next turn gets it again, even when nothing changed. A run that holds no scopes gets no list on its first turn, and isn't sent an empty list after an earlier one leaves the context window.
59
+
58
60
  ### Add the tools yourself
59
61
 
60
62
  You can also add the tools to the agent's `tools`, next to its other tools. Use [`createTools()`](https://mastra.ai/reference/knowledge/knowledge-class) for the tools and [`getInstructions()`](https://mastra.ai/reference/knowledge/knowledge-class) for their instructions. Pass the same options to both:
@@ -136,6 +136,8 @@ Open your project in [Mastra Platform](https://projects.mastra.ai) to inspect ex
136
136
 
137
137
  Use a consistent `serviceName` to filter data from a specific application or deployment.
138
138
 
139
+ To get notified when a value such as an error rate or cost crosses a threshold, [create alerts](https://mastra.ai/docs/mastra-platform/observability/alerts).
140
+
139
141
  ## Query observability data
140
142
 
141
143
  Browse hosted traces from the terminal with the Mastra CLI:
@@ -218,195 +220,7 @@ You can query exported metrics over HTTP, with `MastraClient`, or with `mastra a
218
220
 
219
221
  ## Import existing traces
220
222
 
221
- Use `mastra traces import` to move existing trace history from a supported observability provider into an existing Mastra Platform project. The command reads and validates complete traces at the source, converts them into Mastra spans, then uses a shared workflow for preparation, upload, resume, and verification.
222
-
223
- The import command currently supports Langfuse. Additional providers can use the same command workflow when their adapters are added.
224
-
225
- | Provider | Command argument | Source requirement |
226
- | -------- | ---------------- | -------------------------------------------------- |
227
- | Langfuse | `langfuse` | Langfuse Cloud or self-hosted Langfuse v4 or later |
228
-
229
- ### Prerequisites
230
-
231
- Before starting an import, you need:
232
-
233
- - A Mastra Platform project.
234
- - Mastra Platform authentication through `mastra auth login`, or a `MASTRA_API_TOKEN` and `MASTRA_ORG_ID` for a headless environment.
235
- - `MASTRA_PLATFORM_ACCESS_TOKEN` for upload and read-back when using an interactive login. A dry run doesn't require this token.
236
- - Credentials for a supported source provider.
237
- - Enough local disk space to temporarily store the prepared traces.
238
-
239
- ### Configure the destination
240
-
241
- For an interactive import, sign in and select the organization that owns the destination project:
242
-
243
- ```bash
244
- npx mastra auth login
245
- npx mastra auth orgs switch
246
- ```
247
-
248
- Interactive login authorizes project discovery. Set the Platform access token used by the destination project before uploading or verifying traces:
249
-
250
- ```bash
251
- MASTRA_PLATFORM_ACCESS_TOKEN=<mastra-platform-access-token>
252
- ```
253
-
254
- If `mastra init` configured observability for the project, use the token it wrote to `.env`. Otherwise, create an access token in [Mastra Platform](https://projects.mastra.ai).
255
-
256
- You can run `--dry-run` without this token because a dry run doesn't contact the collector or query API.
257
-
258
- `--target-project` names the destination: the Mastra Platform project that receives the traces. Specify it with a project name, slug, or ID, or set `MASTRA_PROJECT_ID`:
259
-
260
- ```bash
261
- npx mastra traces import langfuse --target-project my-mastra-project --dry-run
262
- ```
263
-
264
- The `--target-project` flag takes precedence over `MASTRA_PROJECT_ID`. Without either value, the CLI uses the project linked in `.mastra-project.json`.
265
-
266
- The source project isn't a command-line option. The provider credentials in `.env` select it, and the preparation summary names it before anything is uploaded.
267
-
268
- For a headless environment, set the API token and organization ID. The command uses `MASTRA_API_TOKEN` for project discovery, upload, and read-back. Set the project ID or pass `--target-project`:
269
-
270
- ```bash
271
- MASTRA_API_TOKEN=<mastra-api-token>
272
- MASTRA_ORG_ID=<organization-id>
273
- MASTRA_PROJECT_ID=<project-id>
274
- ```
275
-
276
- ### Configure Langfuse
277
-
278
- Langfuse API keys belong to one Langfuse project, so they also select the source project. Create [project API keys in Langfuse](https://langfuse.com/docs/api-and-data-platform/features/public-api), then add them to `.env` or `.env.local` in the directory where you run the command:
279
-
280
- ```bash
281
- LANGFUSE_PUBLIC_KEY=<langfuse-public-key>
282
- LANGFUSE_SECRET_KEY=<langfuse-secret-key>
283
- ```
284
-
285
- Langfuse Cloud defaults to the EU region at `https://cloud.langfuse.com`. Set `LANGFUSE_BASE_URL` to the [regional host](https://langfuse.com/security/data-regions) for US, Japan, or HIPAA Cloud, or to the origin of a self-hosted instance:
286
-
287
- ```bash
288
- LANGFUSE_BASE_URL=https://us.cloud.langfuse.com
289
- ```
290
-
291
- ### Preview the import
292
-
293
- Run a dry run before uploading:
294
-
295
- ```bash
296
- npx mastra traces import langfuse --target-project my-mastra-project --dry-run
297
- ```
298
-
299
- The dry run reads the source, prepares valid Mastra traces locally, and reports:
300
-
301
- - The source Langfuse project by name and ID, and the destination Mastra Platform project.
302
- - The fixed import window.
303
- - Prepared and skipped trace and span counts.
304
- - The size of the prepared local data.
305
- - Provider warnings and skip reasons in `report.json`.
306
-
307
- It doesn't upload traces. The command prints a `--resume` command that uploads the prepared data later without reading the source again.
308
-
309
- ### Choose the import window
310
-
311
- By default, the command selects the last 30 days, ending when the import starts. Use `--since` and `--until` to choose a smaller window:
312
-
313
- ```bash
314
- npx mastra traces import langfuse \
315
- --target-project my-mastra-project \
316
- --since "$SINCE" \
317
- --until "$UNTIL" \
318
- --dry-run
319
- ```
320
-
321
- Set `SINCE` and `UNTIL` to ISO 8601 dates or timestamps. The following rules apply:
322
-
323
- - `--until` must be within the last 30 days and can't be in the future.
324
- - `--since` must be earlier than `--until` and within the last 30 days.
325
- - The selected window can't exceed 30 days.
326
- - If only `--until` is set, the default start is 30 days before the current time.
327
-
328
- This 30-day import window is separate from your plan's data retention period.
329
-
330
- The earlier `--from` and `--to` names still work, but they're deprecated hidden aliases of `--since` and `--until` and don't appear in the command help. Use `--since` and `--until` in new commands.
331
-
332
- Trace eligibility is based on the root observation's start time. The Langfuse adapter discovers roots in the selected window and then reads all currently available observations for each selected trace. It skips the complete trace if the available parent-child tree or timestamps are invalid.
333
-
334
- ### Upload and verify
335
-
336
- Run the command without `--dry-run` to upload the prepared traces:
337
-
338
- ```bash
339
- npx mastra traces import langfuse --target-project my-mastra-project
340
- ```
341
-
342
- The CLI displays the preparation summary and asks for confirmation before upload. Pass `--yes` to skip this prompt in an automated environment:
343
-
344
- ```bash
345
- npx mastra traces import langfuse --target-project my-mastra-project --yes
346
- ```
347
-
348
- The importer keeps every trace in one upload request and checkpoints progress only after Mastra Platform acknowledges the batch. Temporary source and destination failures use bounded retries.
349
-
350
- After every prepared trace is acknowledged, the importer reads back a deterministic sample of up to 10 traces. It verifies span IDs, parent links, names, span types, event flags, timestamps, and whether an error is present. It doesn't read back or compare input, output, attributes, metadata, or tags.
351
-
352
- If read-back isn't available yet or a sampled trace differs, the import pauses and keeps its prepared data. Resume the import to retry verification without uploading acknowledged traces again.
353
-
354
- ### Resume an import
355
-
356
- Use the exact command printed by the CLI when a dry run, cancellation, interruption, upload failure, or paused verification leaves an import unfinished:
357
-
358
- ```bash
359
- npx mastra traces import langfuse \
360
- --resume 00000000-0000-0000-0000-000000000000 \
361
- --target-project my-mastra-project
362
- ```
363
-
364
- A resumed import must use the original provider and destination project. Its saved date window can't be changed, so `--since`, `--until`, and `--dry-run` can't be combined with `--resume`.
365
-
366
- Resume behavior depends on where the command stopped:
367
-
368
- - An interrupted preparation reads and prepares the source again.
369
- - An interrupted upload starts with the first unacknowledged trace.
370
- - Paused verification retries read-back without re-uploading acknowledged traces.
371
- - A completed import reports that it's already complete and retries any remaining local cleanup.
372
-
373
- ### Local files and cleanup
374
-
375
- Import state is stored under:
376
-
377
- ```text
378
- ~/.mastra/imports/traces/<target-project-id>/<import-id>/
379
- ```
380
-
381
- | File | Purpose | Lifecycle |
382
- | --------------- | --------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
383
- | `manifest.json` | Stores the source identity, date window, counts, and acknowledged progress. | Retained after completion. |
384
- | `traces.jsonl` | Stores one complete normalized trace per line. | Retained for dry runs and unfinished imports, then removed after successful verification. |
385
- | `report.json` | Stores counts, warnings, skip samples, and verification results. | Retained after it's written. |
386
-
387
- These files can contain trace content. Mastra creates the import directory and files with permissions restricted to the local user. Protect the machine and account that run the import.
388
-
389
- ### Imported data and limits
390
-
391
- For Langfuse imports:
392
-
393
- - Observations become Mastra spans with their parent-child relationships and timestamps.
394
- - Langfuse `AGENT`, `TOOL`, and `EVALUATOR` observations, and plain spans that carry OpenTelemetry GenAI attributes such as `gen_ai.operation.name: invoke_agent`, keep their primitive type and name. Mastra Platform shows them in the Primitive type and Primitive name columns and includes them in those filters, like native traces.
395
- - Supported fields such as names, input, output, errors, model details, usage, cost, tags, and source context are mapped when present.
396
- - Environments you set in Langfuse, such as `staging`, are kept. Langfuse's built-in `default` environment isn't copied. Those traces have no environment in Mastra, and Mastra Studio shows them for every environment.
397
- - Destination trace and span IDs are deterministic. Original Langfuse IDs remain in span metadata for correlation.
398
- - Unknown Langfuse observation types become generic spans and produce a warning instead of being silently discarded.
399
- - Only trace observations are imported. Scores, feedback, datasets, attachments, and logs aren't imported.
400
-
401
- The shared importer also applies these limits:
402
-
403
- - Prepared local trace data is limited to 5 GiB per import. Use a smaller date window if an import reaches this limit.
404
- - A complete trace must fit within the importer's 4 MiB upload payload limit. A larger trace is skipped and recorded with the `trace_too_large` reason.
405
- - A trace is never split between upload requests.
406
-
407
- Review `report.json` after a dry run or completed import to see exactly what was prepared, skipped, acknowledged, and verified.
408
-
409
- See the [`mastra traces import` CLI reference](https://mastra.ai/reference/cli/mastra) for the complete option and environment-variable reference.
223
+ To move trace history from another provider, such as Langfuse, into a Mastra Platform project, see [Import existing traces](https://mastra.ai/docs/mastra-platform/observability/import-traces).
410
224
 
411
225
  ## Next steps
412
226
 
@@ -157,6 +157,31 @@ System messages, context, the current turn's input, and the agent's responses ar
157
157
 
158
158
  Trimmed messages stay in storage. During agent runs, Mastra persists a per-thread boundary so they're excluded from later turns. Setting `messageHistory` without `lastMessages` disables the default 10-message cap. Set both to combine a count cap with a token budget. Set `maxTokens` to `0` to disable message history.
159
159
 
160
+ ### OpenAI Responses compaction
161
+
162
+ OpenAI Responses models can compact provider context during long-running conversations. Enable compaction for a call with `providerOptions.openai.contextManagement`:
163
+
164
+ ```typescript
165
+ await agent.stream('Continue the conversation', {
166
+ memory: {
167
+ thread: 'thread-123',
168
+ resource: 'user-456',
169
+ },
170
+ providerOptions: {
171
+ openai: {
172
+ store: false,
173
+ contextManagement: [{ type: 'compaction', compactThreshold: 10_000 }],
174
+ },
175
+ },
176
+ })
177
+ ```
178
+
179
+ When OpenAI returns a compaction item, Mastra stores it with the thread and replays it across tool loops and later agent calls. With `store: false`, Mastra retains the encrypted compaction content. With stored Responses, an item with an OpenAI item ID can replay as an `item_reference`.
180
+
181
+ Compaction state is provider-specific. Mastra removes OpenAI compaction items when a thread switches to an incompatible provider. Other stored messages remain unchanged.
182
+
183
+ When the selected history contains a compaction checkpoint, Mastra keeps the full conversation in Memory but sends OpenAI only the latest checkpoint, system instructions, and messages after that checkpoint. Memory's `lastMessages` and `messageHistory` controls still determine which stored messages are selected before compaction is applied.
184
+
160
185
  > **Tip:** When memory is enabled, [Studio](https://mastra.ai/docs/studio/overview) uses message history to display past conversations in the chat sidebar.
161
186
 
162
187
  ## Thread title generation
@@ -26,7 +26,7 @@ LSP starts a long-running language-server process and exchanges JSON-RPC message
26
26
  - A static [sandbox](https://mastra.ai/docs/sandbox/overview) with a process manager whose process handles provide readable output and writable input streams. Sandbox resolvers aren't supported.
27
27
  - The `vscode-jsonrpc` and `vscode-languageserver-protocol` packages installed in the Mastra application.
28
28
  - A language-server binary and its runtime installed where the sandbox process runs.
29
- - An absolute project root and project files available through matching paths to both the Mastra application and the sandbox process.
29
+ - An absolute project root and project files available through matching paths in the workspace filesystem and the sandbox process.
30
30
 
31
31
  Mastra has built-in server definitions for TypeScript and JavaScript, Python, Go, and Rust. The matching language-server binary must still be installed. You can [register another server](#custom-language-servers) for other file types.
32
32
 
@@ -251,16 +251,15 @@ Direct client positions are 0-indexed. A leaked lease can prevent an idle client
251
251
 
252
252
  ### Remote sandboxes
253
253
 
254
- Remote LSP isn't backend-transparent. The language-server command runs through the remote sandbox process manager, but binary discovery, file reads, and some source previews still use the Mastra host.
254
+ The language-server command runs through the remote sandbox process manager. The `lsp_inspect` tool reads the inspected file and definition previews through the workspace filesystem, so files that exist only in the remote sandbox are inspected with their real content. If the workspace filesystem can't read the inspected file, the tool returns a `Could not read file` error. It doesn't read the host file at the same path, because on a remote sandbox that file is unrelated content. Mastra reads from the host filesystem only when the workspace has no filesystem.
255
255
 
256
- Use remote LSP only when all of these conditions are met:
256
+ Binary discovery still runs on the Mastra host. Use remote LSP only when all of these conditions are met:
257
257
 
258
258
  - The remote process manager provides readable output and writable input streams.
259
- - The project uses matching absolute paths on the Mastra host and in the remote sandbox.
259
+ - The workspace filesystem and the remote sandbox use the same absolute paths for project files.
260
260
  - The resolved server command is installed in the remote image. Configure it with `binaryOverrides` for a built-in server or `lsp.servers.command` for a custom server.
261
- - The host can read files needed for inspection and definition previews.
262
261
 
263
- A local filesystem and remote sandbox don't synchronize automatically. A binary installed only on the host can't run in the remote sandbox, and remote-only files can't provide all host-side results. For remote-only projects, use `grep`, indexed [search](https://mastra.ai/docs/sandbox/search), and sandbox commands until LSP file access is backend-transparent.
262
+ A binary installed only on the host can't run in the remote sandbox. When filesystem paths don't match sandbox paths, use `grep`, indexed [search](https://mastra.ai/docs/sandbox/search), and sandbox commands instead.
264
263
 
265
264
  ## Related
266
265
 
@@ -332,6 +332,26 @@ The backend decides what `stop()` and `destroy()` do. For example, stopping may
332
332
 
333
333
  Sandboxes returned by a resolver are owned by your application. `workspace.destroy()` and `mastra.shutdown()` clear cached references but don't destroy resolved sandboxes. Application lifecycle code must keep track of them, call `destroy()` when their user, thread, or session ends, and then call `workspace.clearSandboxCache(cacheKey)`. This prevents unused compute from continuing to run and later requests from reusing a stale sandbox.
334
334
 
335
+ ### Recover a sandbox that stopped responding
336
+
337
+ Sometimes an environment hangs. The backend still reports it running, but commands time out. Give the agent `createRecreateSandboxTool()` so it can replace the environment itself. The tool calls the sandbox's [`_reset()`](https://mastra.ai/reference/workspace/sandbox), which destroys the environment and leaves the workspace usable. The next command starts a fresh one.
338
+
339
+ ```typescript
340
+ import { Agent } from '@mastra/core/agent'
341
+ import { createRecreateSandboxTool } from '@mastra/core/workspace'
342
+
343
+ const agent = new Agent({
344
+ id: 'coder',
345
+ name: 'Coder',
346
+ instructions: 'You write and run code.',
347
+ model: 'openai/gpt-6.1-sol',
348
+ workspace,
349
+ tools: { recreate_sandbox: createRecreateSandboxTool() },
350
+ })
351
+ ```
352
+
353
+ Anything in the old environment that isn't saved elsewhere is lost. To run your own recovery, such as clearing state you keep about the sandbox, pass `reset`. It receives the agent's `reason` and the tool's execution context, and should end in `_reset()` on the sandbox the run holds. Pass `id` to change the tool's name.
354
+
335
355
  ### Persistence
336
356
 
337
357
  Persistence is backend-specific. Files and processes aren't guaranteed to survive when a sandbox stops or the application restarts. An idle timeout may also discard them. Some backends reconnect by sandbox ID or preserve snapshots and volumes. Others create a fresh environment.
@@ -78,6 +78,8 @@ Mastra also gives the agent three tools:
78
78
  | `skill_read` | Reads all or part of any file under the selected skill directory. |
79
79
  | `skill_search` | Searches skill names, descriptions, instructions, and reference files. |
80
80
 
81
+ `skill_read` returns PNG, JPEG, WebP, and PDF files up to 10 MiB as native media parts so the model can view them. The media type is read from the file's contents, so a WebP saved as `.png` is sent as WebP, and a text file saved under a media extension (for example an HTML error page saved as `.pdf`) is returned as text. Larger media files and unsupported binary files return only their path and size. Text files remain text, with optional line ranges.
82
+
81
83
  Loading is stateless. The instructions remain in the conversation as a tool result, and the agent can call `skill` again if they leave the context after compaction.
82
84
 
83
85
  ### Turn off the skills list
@@ -127,7 +127,7 @@ The `accepted` promise resolves with one of these actions:
127
127
  - `deliver`: the input was sent to a run, or another process accepted responsibility for starting one.
128
128
  - `persist`: the input is to be stored without delivery or a new run. Wait for `persisted` to confirm the write.
129
129
  - `discard`: the input was dropped.
130
- - `blocked`: a paused run prevented Mastra from starting a new one on the thread.
130
+ - `blocked`: the signal couldn't start or join a run. `reason` is `thread-blocked` when another run, such as a paused or suspended one, owns the thread, or `scope-mismatch` when the signal's `scopes` differ from those of the run active on the thread. Resume or wait for run `runId` to end, then send the signal again.
131
131
 
132
132
  When the action is `wake`, the result carries the run's `output` stream. A run that fails after starting reports the error there. A routing failure rejects `accepted`. Use [`persisted`](https://mastra.ai/reference/agents/agent) to wait for a storage write.
133
133
 
@@ -135,6 +135,7 @@
135
135
  - [Bright Data](https://mastra.ai/integrations/tools/brightdata)
136
136
  - [Exa](https://mastra.ai/integrations/tools/exa)
137
137
  - [Firecrawl](https://mastra.ai/integrations/tools/firecrawl)
138
+ - [Mastra Platform](https://mastra.ai/integrations/browsers/mastra-platform)
138
139
  - [GitLab](https://mastra.ai/integrations/tools/gitlab)
139
140
  - [Parallel](https://mastra.ai/integrations/tools/parallel)
140
141
  - [Perplexity](https://mastra.ai/integrations/tools/perplexity)
@@ -361,7 +361,7 @@ Rename the active stored thread.
361
361
  await session.thread.rename({ title: 'Fix login failure' })
362
362
  ```
363
363
 
364
- ### `session.thread.clone({ sourceThreadId?, title?, resourceId?, requestContext? })`
364
+ ### `session.thread.clone({ sourceThreadId?, title?, resourceId?, metadata?, options?, requestContext? })`
365
365
 
366
366
  Clone an owned thread and its messages, then bind the session to the clone. Pass `requestContext` when memory is a function that reads the signed-in user.
367
367
 
@@ -372,6 +372,34 @@ const clone = await session.thread.clone({
372
372
  })
373
373
  ```
374
374
 
375
+ Pass `metadata` to set the clone's metadata. Pass `options` to choose which messages to copy: it takes the same `messageFilter`, `messageLimit` and `contextWindowOnly` as `memory.cloneThread()`. The clone keeps the source thread's observational and working memory. Without `options`, the clone copies every message. Pass `options: { contextWindowOnly: true }` to copy only the messages after `lastObservedAt`, the ones still in the context window. A filter that keeps no messages clones the memory without the conversation.
376
+
377
+ ```typescript
378
+ const clone = await session.thread.clone({
379
+ sourceThreadId: 'thread-7',
380
+ metadata: { clonedFrom: 'thread-7' },
381
+ options: { messageFilter: { startDate: new Date() } },
382
+ })
383
+ ```
384
+
385
+ Returns: `Promise<AgentControllerThread>`
386
+
387
+ ### `session.thread.cloneToCurrentResource({ threadId, expectedResourceId, expectedProjectPath, metadata?, options?, requestContext? })`
388
+
389
+ Clone a thread from another resource into the session's resource, then bind the session to the clone. The clone keeps the source thread's title. The call throws `Thread not found` when the source thread is missing, doesn't belong to `expectedResourceId`, has a `projectPath` metadata value other than `expectedProjectPath`, or already belongs to the session's resource.
390
+
391
+ Pass `metadata` to use it for the clone in place of the source thread's metadata. Pass `options` to choose which messages to copy, with the same `messageFilter`, `messageLimit` and `contextWindowOnly` as `session.thread.clone()`.
392
+
393
+ ```typescript
394
+ const clone = await session.thread.cloneToCurrentResource({
395
+ threadId: 'thread-7',
396
+ expectedResourceId: 'old-resource',
397
+ expectedProjectPath: '/projects/app',
398
+ metadata: { projectPath: '/projects/app-copy' },
399
+ options: { contextWindowOnly: true },
400
+ })
401
+ ```
402
+
375
403
  Returns: `Promise<AgentControllerThread>`
376
404
 
377
405
  ### `session.thread.switch({ threadId, emitEvent?, requestContext? })`
@@ -850,7 +878,7 @@ After every event, the session emits `display_state_changed` with the latest sna
850
878
 
851
879
  `session.state` exposes the active conversation's thread-owned preferences together with host-owned state. Updates are serialized and validated against the `stateSchema` passed to the AgentController. Visible state changes emit `state_changed`.
852
880
 
853
- Thread-owned preferences include thinking level, observational memory settings, and subagent model selections. Switching threads leaves host-owned custom fields and permission rules unchanged and doesn't persist them.
881
+ Thread-owned preferences include thinking level, notifications, permission rules, observational memory settings, and subagent model selections. They're persisted with the thread and restored when you switch to it. Switching threads leaves host-owned custom fields unchanged and doesn't persist them.
854
882
 
855
883
  A queued write keeps its source thread through asynchronous updates and validation. Switching from A to B while a write is pending doesn't apply A's preferences to B. Host-field updates still affect the host. A retained run and the active view of the same thread share update ordering. A resumed run sees edits made while it was parked. Events without a source address that affect the conversation display are emitted only while that source is active.
856
884
 
@@ -38,7 +38,7 @@ const result = await agent.generate('message for agent')
38
38
 
39
39
  **options.onIterationComplete.context.finishReason** (`string`): Reason why this iteration finished (e.g., 'stop', 'length', 'tool-calls').
40
40
 
41
- **options.onIterationComplete.context.toolCalls** (`ToolCall[]`): Tool calls made in this iteration.
41
+ **options.onIterationComplete.context.toolCalls** (`Array<{ id: string; name: string; args: Record<string, unknown> }>`): Tool calls made in this iteration.
42
42
 
43
43
  **options.onIterationComplete.context.messages** (`MastraDBMessage[]`): All messages accumulated so far.
44
44
 
@@ -44,7 +44,7 @@ await agent.network(`
44
44
 
45
45
  **messages** (`string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]`): The messages to send to the agent. Can be a single string, array of strings, or structured message objects.
46
46
 
47
- **options** (`MultiPrimitiveExecutionOptions`): Optional configuration for the network process.
47
+ **options** (`NetworkOptions`): Optional configuration for the network process.
48
48
 
49
49
  **options.maxSteps** (`number`): Maximum number of steps to run during execution.
50
50