@mastra/core 1.87.0-alpha.10 → 1.87.0-alpha.12

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 (405) hide show
  1. package/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +49 -0
  2. package/dist/a2a/index.cjs +1 -1
  3. package/dist/a2a/index.js +1 -1
  4. package/dist/agent/durable/index.cjs +1 -1
  5. package/dist/agent/durable/index.js +1 -1
  6. package/dist/agent/durable/run-registry.d.ts +2 -0
  7. package/dist/agent/durable/types.d.ts +6 -0
  8. package/dist/agent/durable/utils/resolve-runtime.d.ts +5 -0
  9. package/dist/agent/index.cjs +3 -3
  10. package/dist/agent/index.js +3 -3
  11. package/dist/agent/message-list/index.cjs +1 -1
  12. package/dist/agent/message-list/index.js +1 -1
  13. package/dist/agent/message-list/state/MessageStateManager.d.ts +5 -0
  14. package/dist/agent-builder/ee/index.cjs +1 -1
  15. package/dist/agent-builder/ee/index.js +1 -1
  16. package/dist/agent-controller/index.cjs +1 -1
  17. package/dist/agent-controller/index.js +1 -1
  18. package/dist/agent-controller/session.d.ts +11 -1
  19. package/dist/{agent-controller-BolLBwDm.cjs → agent-controller-BcN7r3yI.cjs} +40 -204
  20. package/dist/{agent-controller--gKWI81G.js → agent-controller-DfeTRuBc.js} +40 -204
  21. package/dist/background-tasks/index.cjs +1 -1
  22. package/dist/background-tasks/index.js +1 -1
  23. package/dist/{background-tasks-CgzXjBfE.js → background-tasks-BcU--rXL.js} +1 -1
  24. package/dist/{background-tasks-DYtlijQ1.cjs → background-tasks-DRUHnQOk.cjs} +1 -1
  25. package/dist/browser/index.cjs +15 -6
  26. package/dist/browser/index.js +15 -6
  27. package/dist/browser/processor.d.ts +1 -0
  28. package/dist/{builder-Dz-g-9CZ.cjs → builder-Bufqrcz3.cjs} +2 -2
  29. package/dist/{builder-emNPaIaC.js → builder-TuIc5l7X.js} +2 -2
  30. package/dist/capabilities/302ai.json +201 -201
  31. package/dist/capabilities/abliteratedllm.json +34 -34
  32. package/dist/capabilities/abliteration-ai.json +11 -11
  33. package/dist/capabilities/above.json +22 -22
  34. package/dist/capabilities/adaption.json +13 -13
  35. package/dist/capabilities/adzuki.json +33 -33
  36. package/dist/capabilities/agentrouter.json +7 -7
  37. package/dist/capabilities/agnes.json +4 -4
  38. package/dist/capabilities/ai-router.json +8 -8
  39. package/dist/capabilities/aiand.json +22 -22
  40. package/dist/capabilities/aigrow.json +12 -12
  41. package/dist/capabilities/aimlapi.json +149 -149
  42. package/dist/capabilities/aixy.json +26 -26
  43. package/dist/capabilities/aki-io.json +12 -12
  44. package/dist/capabilities/alibaba-cn.json +93 -93
  45. package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
  46. package/dist/capabilities/alibaba-coding-plan.json +5 -5
  47. package/dist/capabilities/alibaba-token-plan-cn.json +37 -37
  48. package/dist/capabilities/alibaba-token-plan.json +40 -40
  49. package/dist/capabilities/alibaba.json +66 -66
  50. package/dist/capabilities/ambient.json +13 -13
  51. package/dist/capabilities/amd.json +11 -11
  52. package/dist/capabilities/anthropic.json +42 -42
  53. package/dist/capabilities/anyapi.json +47 -47
  54. package/dist/capabilities/apiko.json +5 -5
  55. package/dist/capabilities/arcee.json +11 -11
  56. package/dist/capabilities/augure.json +7 -7
  57. package/dist/capabilities/auriko.json +21 -21
  58. package/dist/capabilities/bailing.json +5 -5
  59. package/dist/capabilities/baseten.json +33 -33
  60. package/dist/capabilities/bee.json +4 -4
  61. package/dist/capabilities/berget.json +8 -8
  62. package/dist/capabilities/bothub.json +17 -17
  63. package/dist/capabilities/boundless.json +38 -38
  64. package/dist/capabilities/bumo.json +34 -34
  65. package/dist/capabilities/byteplus.json +24 -24
  66. package/dist/capabilities/cerebras.json +4 -4
  67. package/dist/capabilities/cheapaimodel.json +10 -10
  68. package/dist/capabilities/cheapest-token.json +28 -28
  69. package/dist/capabilities/chutes.json +7 -7
  70. package/dist/capabilities/cline-pass.json +35 -35
  71. package/dist/capabilities/cloudcode.json +7 -7
  72. package/dist/capabilities/cloudferro-sherlock.json +4 -4
  73. package/dist/capabilities/cloudflare-workers-ai.json +19 -19
  74. package/dist/capabilities/commandcode.json +149 -149
  75. package/dist/capabilities/concentrate.json +276 -268
  76. package/dist/capabilities/cortecs.json +104 -104
  77. package/dist/capabilities/crossmodel.json +179 -179
  78. package/dist/capabilities/crusoe.json +19 -19
  79. package/dist/capabilities/daoxe.json +6 -6
  80. package/dist/capabilities/databricks.json +124 -124
  81. package/dist/capabilities/deepinfra.json +89 -83
  82. package/dist/capabilities/deepseek.json +4 -4
  83. package/dist/capabilities/digitalocean.json +113 -113
  84. package/dist/capabilities/dothoosh.json +32 -32
  85. package/dist/capabilities/doubleword.json +25 -25
  86. package/dist/capabilities/edenai.json +286 -286
  87. package/dist/capabilities/empiriolabs.json +169 -169
  88. package/dist/capabilities/engy.json +16 -16
  89. package/dist/capabilities/entrim.json +8 -8
  90. package/dist/capabilities/evroc.json +12 -12
  91. package/dist/capabilities/ezkielyna.json +4 -4
  92. package/dist/capabilities/fastrouter.json +83 -83
  93. package/dist/capabilities/fireworks-ai.json +99 -99
  94. package/dist/capabilities/fortytwo.json +4 -4
  95. package/dist/capabilities/freemodel.json +22 -22
  96. package/dist/capabilities/friendli.json +8 -8
  97. package/dist/capabilities/frogbot.json +87 -87
  98. package/dist/capabilities/gisoo.json +17 -17
  99. package/dist/capabilities/gmicloud.json +21 -21
  100. package/dist/capabilities/google.json +58 -58
  101. package/dist/capabilities/graphn.json +8 -8
  102. package/dist/capabilities/greenpt.json +34 -34
  103. package/dist/capabilities/groq.json +9 -9
  104. package/dist/capabilities/helicone.json +87 -87
  105. package/dist/capabilities/hetzner.json +5 -5
  106. package/dist/capabilities/hostinger-router.json +10 -10
  107. package/dist/capabilities/hpc-ai.json +12 -12
  108. package/dist/capabilities/huawei-maas.json +15 -15
  109. package/dist/capabilities/hubris.json +32 -32
  110. package/dist/capabilities/huggingface.json +93 -85
  111. package/dist/capabilities/humain.json +2 -2
  112. package/dist/capabilities/hyper.json +23 -23
  113. package/dist/capabilities/impossibl.json +173 -173
  114. package/dist/capabilities/inceptron.json +8 -8
  115. package/dist/capabilities/inco.json +4 -4
  116. package/dist/capabilities/infer.json +14 -14
  117. package/dist/capabilities/inferall.json +9 -9
  118. package/dist/capabilities/inference-coop.json +9 -9
  119. package/dist/capabilities/inferenceapis.json +13 -13
  120. package/dist/capabilities/inferris.json +4 -4
  121. package/dist/capabilities/infersia.json +8 -8
  122. package/dist/capabilities/inferx.json +3 -3
  123. package/dist/capabilities/infomaniak.json +2 -2
  124. package/dist/capabilities/io-net.json +5 -5
  125. package/dist/capabilities/isoquant.json +4 -4
  126. package/dist/capabilities/iteracompute.json +53 -53
  127. package/dist/capabilities/jad-ai.json +2 -2
  128. package/dist/capabilities/jalapeno.json +12 -12
  129. package/dist/capabilities/jiekou.json +67 -67
  130. package/dist/capabilities/joingonka.json +4 -4
  131. package/dist/capabilities/jzstoken.json +53 -53
  132. package/dist/capabilities/keln.json +21 -21
  133. package/dist/capabilities/kenari.json +132 -124
  134. package/dist/capabilities/kilo.json +604 -604
  135. package/dist/capabilities/kimi-code-plan-cn.json +7 -7
  136. package/dist/capabilities/kimi-code-plan-global.json +7 -7
  137. package/dist/capabilities/kitani.json +6 -6
  138. package/dist/capabilities/klavo.json +21 -21
  139. package/dist/capabilities/korouter.json +30 -30
  140. package/dist/capabilities/kunavo.json +7 -7
  141. package/dist/capabilities/liquid.json +9 -9
  142. package/dist/capabilities/lithosai.json +2 -2
  143. package/dist/capabilities/llmgateway-providers.json +944 -944
  144. package/dist/capabilities/llmgateway.json +340 -340
  145. package/dist/capabilities/llmtr.json +30 -30
  146. package/dist/capabilities/logits.json +2 -2
  147. package/dist/capabilities/longcat.json +2 -2
  148. package/dist/capabilities/lowrouter.json +60 -60
  149. package/dist/capabilities/lyceum.json +12 -12
  150. package/dist/capabilities/melious.json +8 -8
  151. package/dist/capabilities/merge-gateway.json +280 -280
  152. package/dist/capabilities/meta.json +7 -7
  153. package/dist/capabilities/mistral.json +18 -18
  154. package/dist/capabilities/mixlayer.json +5 -5
  155. package/dist/capabilities/modal.json +12 -12
  156. package/dist/capabilities/model-oracle-ai.json +25 -25
  157. package/dist/capabilities/modelis.json +21 -21
  158. package/dist/capabilities/modular.json +13 -13
  159. package/dist/capabilities/moneo.json +18 -18
  160. package/dist/capabilities/moonshotai-cn.json +7 -7
  161. package/dist/capabilities/moonshotai.json +7 -7
  162. package/dist/capabilities/morph.json +16 -16
  163. package/dist/capabilities/munito-eu.json +6 -6
  164. package/dist/capabilities/munito.json +10 -10
  165. package/dist/capabilities/nan.json +28 -28
  166. package/dist/capabilities/nano-gpt.json +566 -565
  167. package/dist/capabilities/nearai.json +96 -96
  168. package/dist/capabilities/nebius.json +32 -32
  169. package/dist/capabilities/neon.json +124 -124
  170. package/dist/capabilities/neuralwatt.json +36 -36
  171. package/dist/capabilities/nokeep.json +5 -5
  172. package/dist/capabilities/novita-ai.json +153 -153
  173. package/dist/capabilities/nvidia.json +35 -35
  174. package/dist/capabilities/oathbreaker.json +3 -3
  175. package/dist/capabilities/obscurify.json +27 -27
  176. package/dist/capabilities/oci.json +10 -10
  177. package/dist/capabilities/ofox.json +381 -381
  178. package/dist/capabilities/ollama-cloud.json +48 -48
  179. package/dist/capabilities/openai.json +59 -59
  180. package/dist/capabilities/opencode-go.json +91 -91
  181. package/dist/capabilities/openreason.json +5 -5
  182. package/dist/capabilities/openrouter.json +526 -527
  183. package/dist/capabilities/opper.json +29 -29
  184. package/dist/capabilities/orcarouter.json +228 -228
  185. package/dist/capabilities/outerlabs.json +30 -30
  186. package/dist/capabilities/ovhcloud.json +19 -19
  187. package/dist/capabilities/pareto.json +5 -5
  188. package/dist/capabilities/pendra.json +4 -4
  189. package/dist/capabilities/perplexity-agent.json +47 -47
  190. package/dist/capabilities/phala.json +30 -30
  191. package/dist/capabilities/pioneer.json +27 -27
  192. package/dist/capabilities/poe.json +133 -133
  193. package/dist/capabilities/poolside.json +2 -2
  194. package/dist/capabilities/powerspring.json +9 -9
  195. package/dist/capabilities/primalabs.json +9 -9
  196. package/dist/capabilities/prime.json +106 -106
  197. package/dist/capabilities/privatemode-ai.json +12 -12
  198. package/dist/capabilities/proxystacks.json +7 -7
  199. package/dist/capabilities/qiniu-ai.json +14 -14
  200. package/dist/capabilities/refuseless.json +8 -8
  201. package/dist/capabilities/regolo-ai.json +2 -2
  202. package/dist/capabilities/requesty.json +258 -199
  203. package/dist/capabilities/ruapi.json +21 -21
  204. package/dist/capabilities/runcrate.json +14 -14
  205. package/dist/capabilities/runinfra.json +18 -18
  206. package/dist/capabilities/sakana.json +6 -6
  207. package/dist/capabilities/sambanova.json +6 -6
  208. package/dist/capabilities/sandbase.json +22 -22
  209. package/dist/capabilities/sarvam.json +14 -14
  210. package/dist/capabilities/scaleway.json +16 -16
  211. package/dist/capabilities/scnet-token-plan.json +10 -10
  212. package/dist/capabilities/scx-ai.json +29 -29
  213. package/dist/capabilities/sensenova.json +12 -12
  214. package/dist/capabilities/siliconflow-cn.json +56 -56
  215. package/dist/capabilities/siliconflow.json +60 -60
  216. package/dist/capabilities/snowflake-cortex.json +20 -20
  217. package/dist/capabilities/sokkan.json +10 -10
  218. package/dist/capabilities/sparrowcodes.json +16 -16
  219. package/dist/capabilities/standardcompute.json +88 -88
  220. package/dist/capabilities/steadyrouter.json +35 -35
  221. package/dist/capabilities/stepfun-ai-step-plan.json +4 -4
  222. package/dist/capabilities/stepfun-ai.json +4 -4
  223. package/dist/capabilities/stepfun-step-plan.json +4 -4
  224. package/dist/capabilities/stepfun.json +4 -4
  225. package/dist/capabilities/stepping-stone.json +21 -21
  226. package/dist/capabilities/subconscious.json +2 -2
  227. package/dist/capabilities/superbot-gg.json +4 -4
  228. package/dist/capabilities/synthetic.json +10 -10
  229. package/dist/capabilities/synthorai.json +19 -19
  230. package/dist/capabilities/teamorouter.json +25 -25
  231. package/dist/capabilities/teapot-router.json +7 -7
  232. package/dist/capabilities/tencent-token-plan-intl.json +24 -24
  233. package/dist/capabilities/tencent-token-plan.json +40 -40
  234. package/dist/capabilities/tencent-tokenhub.json +47 -47
  235. package/dist/capabilities/tensorx.json +48 -48
  236. package/dist/capabilities/tenstorrent.json +8 -8
  237. package/dist/capabilities/the-grid-ai.json +28 -28
  238. package/dist/capabilities/thinkingmachines.json +39 -39
  239. package/dist/capabilities/tinfoil.json +14 -14
  240. package/dist/capabilities/toapis.json +2 -2
  241. package/dist/capabilities/togetherai.json +50 -50
  242. package/dist/capabilities/tokengo.json +19 -19
  243. package/dist/capabilities/tokenify.json +9 -9
  244. package/dist/capabilities/trustedrouter.json +7 -7
  245. package/dist/capabilities/trustedtokens.json +20 -20
  246. package/dist/capabilities/umans-ai-coding-plan.json +18 -18
  247. package/dist/capabilities/umans-ai.json +12 -12
  248. package/dist/capabilities/uncensuredai.json +4 -4
  249. package/dist/capabilities/unrestricted.json +8 -8
  250. package/dist/capabilities/uplinkswitch.json +22 -22
  251. package/dist/capabilities/upstage.json +6 -6
  252. package/dist/capabilities/vancine.json +15 -15
  253. package/dist/capabilities/vercel.json +546 -546
  254. package/dist/capabilities/vivgrid.json +84 -84
  255. package/dist/capabilities/volcengine-coding-plan.json +28 -28
  256. package/dist/capabilities/volcengine.json +29 -29
  257. package/dist/capabilities/vultr.json +31 -31
  258. package/dist/capabilities/wafer.ai.json +15 -15
  259. package/dist/capabilities/wallaby.json +2 -2
  260. package/dist/capabilities/wally.json +9 -9
  261. package/dist/capabilities/wandb.json +16 -16
  262. package/dist/capabilities/watt.json +22 -22
  263. package/dist/capabilities/xai.json +7 -7
  264. package/dist/capabilities/xiaomi.json +3 -3
  265. package/dist/capabilities/xpersona.json +11 -11
  266. package/dist/capabilities/xxapi.json +28 -28
  267. package/dist/capabilities/zai-coding-plan.json +12 -12
  268. package/dist/capabilities/zai.json +31 -31
  269. package/dist/capabilities/zenifra.json +26 -26
  270. package/dist/capabilities/zenmux.json +159 -159
  271. package/dist/capabilities/zerogpu.json +11 -11
  272. package/dist/capabilities/zhipuai-coding-plan.json +8 -8
  273. package/dist/capabilities/zhipuai.json +29 -29
  274. package/dist/capabilities/zro.json +7 -7
  275. package/dist/channels/index.cjs +2 -2
  276. package/dist/channels/index.js +2 -2
  277. package/dist/{channels-CndspFXP.js → channels-Cdsqdajh.js} +1 -1
  278. package/dist/{channels-BVnDIsZS.cjs → channels-MsOnUvU6.cjs} +1 -1
  279. package/dist/coding-agent/index.cjs +2 -2
  280. package/dist/coding-agent/index.js +2 -2
  281. package/dist/datasets/index.cjs +2 -2
  282. package/dist/datasets/index.js +2 -2
  283. package/dist/docs/SKILL.md +1 -1
  284. package/dist/docs/assets/SOURCE_MAP.json +609 -609
  285. package/dist/docs/references/reference-agent-controller-session.md +29 -1
  286. package/dist/docs/references/reference-memory-observational-memory.md +4 -0
  287. package/dist/docs/references/reference.md +1 -0
  288. package/dist/evals/index.cjs +1 -1
  289. package/dist/evals/index.js +1 -1
  290. package/dist/evals/scoreTraces/index.cjs +1 -1
  291. package/dist/evals/scoreTraces/index.js +1 -1
  292. package/dist/harness/index.cjs +1 -1
  293. package/dist/harness/index.js +1 -1
  294. package/dist/index.cjs +1 -1
  295. package/dist/index.js +1 -1
  296. package/dist/knowledge/importers/overlay.d.ts +138 -0
  297. package/dist/knowledge/importers/sink.d.ts +6 -0
  298. package/dist/knowledge/importers/types.d.ts +5 -0
  299. package/dist/knowledge/index.cjs +1412 -139
  300. package/dist/knowledge/index.js +1412 -139
  301. package/dist/knowledge/links.d.ts +27 -0
  302. package/dist/llm/index.cjs +3 -3
  303. package/dist/llm/index.js +3 -3
  304. package/dist/llm/model/provider-types.generated.d.ts +7781 -7766
  305. package/dist/llm/reasoning/anthropic-thinking.d.ts +5 -0
  306. package/dist/llm/reasoning/gemini-thinking.d.ts +24 -0
  307. package/dist/llm/reasoning/index.cjs +389 -0
  308. package/dist/llm/reasoning/index.d.ts +8 -0
  309. package/dist/llm/reasoning/index.js +362 -0
  310. package/dist/llm/reasoning/model-fallback.d.ts +75 -0
  311. package/dist/llm/reasoning/model-ids.d.ts +5 -0
  312. package/dist/llm/reasoning/thinking-provider-options.d.ts +10 -0
  313. package/dist/llm/reasoning/thinking-request.d.ts +14 -0
  314. package/dist/llm/reasoning/thinking.d.ts +37 -0
  315. package/dist/{llm-B1semiTO.cjs → llm-CS6YY_IV.cjs} +2 -2
  316. package/dist/{llm-CytL7cpw.js → llm-zjtMQn7M.js} +2 -2
  317. package/dist/loop/index.cjs +2 -2
  318. package/dist/loop/index.js +2 -2
  319. package/dist/{manager-BwyfS4ha.cjs → manager-BU_lY6kl.cjs} +2 -2
  320. package/dist/{manager-DnTzA9GL.js → manager-Do0MENhH.js} +2 -2
  321. package/dist/mastra/index.cjs +1 -1
  322. package/dist/mastra/index.d.ts +2 -0
  323. package/dist/mastra/index.js +1 -1
  324. package/dist/{mastra-DTkZPpch.js → mastra-C-1zIyS5.js} +22 -16
  325. package/dist/{mastra-Dj35Lj_J.cjs → mastra-DYVjsXTO.cjs} +22 -16
  326. package/dist/memory/index.cjs +3 -3
  327. package/dist/memory/index.js +3 -3
  328. package/dist/memory/om-events/index.cjs +189 -0
  329. package/dist/memory/om-events/index.d.ts +17 -0
  330. package/dist/memory/om-events/index.js +188 -0
  331. package/dist/{message-list-vR3uLAHL.cjs → message-list-C0F2sDNC.cjs} +3 -2
  332. package/dist/{message-list-BGm1DCiG.js → message-list-RgFlLrxG.js} +3 -2
  333. package/dist/{model-eDfetuno.cjs → model-DGFc1hw3.cjs} +1 -1
  334. package/dist/{model-DyQ07rPH.js → model-DIzIjDej.js} +1 -1
  335. package/dist/{netlify-BUvdxfHe.js → netlify-B9mLgxJs.js} +1 -1
  336. package/dist/{netlify-BC4v7Ufv.cjs → netlify-CyL6FNsw.cjs} +1 -1
  337. package/dist/notifications/index.cjs +1 -1
  338. package/dist/notifications/index.js +1 -1
  339. package/dist/processor-provider/index.cjs +1 -1
  340. package/dist/processor-provider/index.js +1 -1
  341. package/dist/processors/index.cjs +2 -2
  342. package/dist/processors/index.js +2 -2
  343. package/dist/{provider-registry-CP_5SNiw.js → provider-registry-DdQoO_jd.js} +22523 -22492
  344. package/dist/{provider-registry-Bn01gq9y.cjs → provider-registry-g9m_fyV8.cjs} +22523 -22492
  345. package/dist/provider-registry.json +22977 -22946
  346. package/dist/{registry-generator-CNFKGRFQ.cjs → registry-generator-At8J4ZOR.cjs} +1 -1
  347. package/dist/{registry-generator-CDPyxbzt.js → registry-generator-CX6Ev697.js} +1 -1
  348. package/dist/{rehydrate-DExpzlNS.cjs → rehydrate-BzD6UX8f.cjs} +2 -2
  349. package/dist/{rehydrate-CnGNY2zq.js → rehydrate-DEDxsr6E.js} +2 -2
  350. package/dist/relevance/index.cjs +2 -2
  351. package/dist/relevance/index.js +2 -2
  352. package/dist/{run-registry-BL_kKvFE.js → run-registry-D22IF5SK.js} +434 -26
  353. package/dist/{run-registry-CibQoN6K.cjs → run-registry-PiQTSx2Y.cjs} +457 -25
  354. package/dist/storage/domains/knowledge/base.d.ts +86 -1
  355. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +9 -0
  356. package/dist/storage/domains/knowledge/importers.d.ts +31 -0
  357. package/dist/storage/domains/knowledge/inmemory.d.ts +7 -0
  358. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +31 -1
  359. package/dist/storage/domains/knowledge/pages.d.ts +74 -0
  360. package/dist/storage/index.cjs +2 -2
  361. package/dist/storage/index.js +2 -2
  362. package/dist/storage/types.d.ts +6 -0
  363. package/dist/stream/base/output.d.ts +7 -0
  364. package/dist/stream/index.cjs +2 -2
  365. package/dist/stream/index.js +2 -2
  366. package/dist/{stream-D_7tMaJe.cjs → stream-BbPZavop.cjs} +36 -4
  367. package/dist/{stream-1DGoEkG2.js → stream-CoQTdzLm.js} +31 -5
  368. package/dist/test-utils/llm-mock.cjs +1 -1
  369. package/dist/test-utils/llm-mock.js +1 -1
  370. package/dist/tool-loop-agent/index.cjs +1 -1
  371. package/dist/tool-loop-agent/index.js +1 -1
  372. package/dist/{tool-loop-agent-CLB1r3X3.cjs → tool-loop-agent-8lyD6O4o.cjs} +4 -4
  373. package/dist/{tool-loop-agent-BXya_RYj.js → tool-loop-agent-DhQkNDaR.js} +4 -4
  374. package/dist/{utils-C55ZdVaj.js → utils-B-3lET9S.js} +1 -1
  375. package/dist/{utils-B-KOMA_Q.cjs → utils-DtmyBuBT.cjs} +1 -1
  376. package/dist/utils.cjs +1 -1
  377. package/dist/utils.js +1 -1
  378. package/dist/{validate-BDfYr72F.js → validate-CO4rWYyH.js} +1 -1
  379. package/dist/{validate-CmZhnsmX.cjs → validate-vucjWXcz.cjs} +1 -1
  380. package/dist/vector/index.cjs +2 -2
  381. package/dist/vector/index.js +2 -2
  382. package/dist/worker/index.cjs +1 -1
  383. package/dist/worker/index.js +1 -1
  384. package/dist/{worker-CuK2RaC0.js → worker-B6CpapAF.js} +2 -2
  385. package/dist/{worker-BoybIUTI.cjs → worker-BgifMkOw.cjs} +2 -2
  386. package/dist/{worker-BG1rw_dg.js → worker-CCpSrXBY.js} +2 -2
  387. package/dist/{worker-D2B-x7Le.cjs → worker-eUT7GgQ9.cjs} +2 -2
  388. package/dist/{workflow-Bt09PcH1.js → workflow-B4Tn58DD.js} +3 -3
  389. package/dist/{workflow-CTKqeRXU.cjs → workflow-BJSrGEEL.cjs} +3 -3
  390. package/dist/workflows/builder/index.cjs +1 -1
  391. package/dist/workflows/builder/index.js +1 -1
  392. package/dist/workflows/evented/index.cjs +1 -1
  393. package/dist/workflows/evented/index.js +1 -1
  394. package/dist/workflows/index.cjs +4 -4
  395. package/dist/workflows/index.js +4 -4
  396. package/dist/workspace/index.cjs +1 -1
  397. package/dist/workspace/index.js +1 -1
  398. package/dist/workspace/sandbox/local-sandbox.d.ts +11 -0
  399. package/dist/workspace/sandbox/sandbox.d.ts +2 -0
  400. package/dist/{workspace-C8Zo5_qK.cjs → workspace-C5lXteRU.cjs} +174 -12
  401. package/dist/{workspace-DOAil8mG.js → workspace-CnmmMou8.js} +174 -12
  402. package/llm/reasoning.d.ts +1 -0
  403. package/memory/om-events.d.ts +1 -0
  404. package/package.json +27 -7
  405. package/src/llm/model/provider-types.generated.d.ts +7781 -7766
@@ -3724,7 +3724,11 @@ var LocalProcessManager = class extends SandboxProcessManager {
3724
3724
  ...env
3725
3725
  };
3726
3726
  const directShell = isWindows && this.sandbox.isolation === "none" && invocation !== void 0 && /^(sh|sh\.exe)$/i.test(path.win32.basename(invocation.command)) && invocation.args[0] === "-c" && invocation.args.length >= 2;
3727
- const wrapped = directShell ? {
3727
+ const commandShell = this.sandbox.commandShell;
3728
+ const wrapped = commandShell ? {
3729
+ command: commandShell,
3730
+ args: ["-c", withRaisedOomScore(command)]
3731
+ } : directShell ? {
3728
3732
  command: usesBash && /^sh(\.exe)?$/i.test(invocation.command) ? posixShell : invocation.command,
3729
3733
  args: invocation.args
3730
3734
  } : usesBash && invocation ? {
@@ -3754,7 +3758,7 @@ var LocalProcessManager = class extends SandboxProcessManager {
3754
3758
  else execaOptions = {
3755
3759
  ...baseOptions,
3756
3760
  detached: true,
3757
- shell: this.sandbox.isolation === "none"
3761
+ shell: !commandShell && this.sandbox.isolation === "none"
3758
3762
  };
3759
3763
  const subprocess = (await getExeca())(wrapped.command, wrapped.args, execaOptions);
3760
3764
  if (!subprocess.pid) {
@@ -4238,8 +4242,11 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
4238
4242
  get workingDirectory() {
4239
4243
  return this._workingDirectory;
4240
4244
  }
4245
+ commandShell;
4246
+ nativePipefail;
4241
4247
  constructor(options = {}) {
4242
4248
  const requestedIsolation = options.isolation ?? "none";
4249
+ if (options.shell && (process.platform === "win32" || requestedIsolation !== "none" || !path.isAbsolute(options.shell.path))) throw new Error("LocalSandbox shell requires an absolute path and non-isolated Unix execution.");
4243
4250
  if (requestedIsolation === "seatbelt" && process.platform === "win32") throw new IsolationUnavailableError("seatbelt", "Seatbelt isolation is only supported on macOS, not Windows.");
4244
4251
  if (requestedIsolation !== "none" && !isIsolationAvailable(requestedIsolation)) throw new IsolationUnavailableError(requestedIsolation, detectIsolation().message);
4245
4252
  super({
@@ -4266,6 +4273,8 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
4266
4273
  this._initialReadWritePaths = new Set(this._nativeSandboxConfig.readWritePaths ?? []);
4267
4274
  this._initialDenyWritePaths = new Set(this._nativeSandboxConfig.denyWritePaths ?? []);
4268
4275
  this.isolation = requestedIsolation;
4276
+ this.commandShell = options.shell?.path;
4277
+ this.nativePipefail = options.shell?.nativePipefail;
4269
4278
  this._instructionsOverride = options.instructions;
4270
4279
  this._checkpointName = options.checkpointName;
4271
4280
  this._seedCheckpointName = options.seedCheckpointName;
@@ -4288,6 +4297,10 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
4288
4297
  env: options.env ?? this.env,
4289
4298
  timeout: this.timeout,
4290
4299
  isolation: this.isolation,
4300
+ shell: this.commandShell ? {
4301
+ path: this.commandShell,
4302
+ nativePipefail: this.nativePipefail
4303
+ } : void 0,
4291
4304
  outputEncoding: this._outputEncoding,
4292
4305
  nativeSandbox: {
4293
4306
  ...this._nativeSandboxConfig,
@@ -7270,19 +7283,167 @@ const executeCommandWithDescriptionAndBackgroundSchema = zod_v4.z.object({
7270
7283
  ...descriptionShape,
7271
7284
  ...executeCommandWithBackgroundSchema.shape
7272
7285
  });
7286
+ const MAX_PIPEFAIL_DISPATCH_BYTES = 122880;
7273
7287
  /** A command whose final pipeline stage is `tail`, e.g. `make test 2>&1 | tail -20`. */
7274
7288
  const TRAILING_TAIL_PIPE = /(?:^|[^|])\|\s*tail(?:\s[^|;&]*)?$/;
7289
+ const OPAQUE_COMMANDS = /* @__PURE__ */ new Set([
7290
+ "if",
7291
+ "then",
7292
+ "elif",
7293
+ "else",
7294
+ "fi",
7295
+ "for",
7296
+ "while",
7297
+ "until",
7298
+ "do",
7299
+ "done",
7300
+ "case",
7301
+ "esac",
7302
+ "select",
7303
+ "function",
7304
+ "time",
7305
+ "coproc",
7306
+ "eval",
7307
+ ".",
7308
+ "source",
7309
+ "alias",
7310
+ "unalias",
7311
+ "trap",
7312
+ "command",
7313
+ "builtin",
7314
+ "enable",
7315
+ "shopt",
7316
+ "local",
7317
+ "declare",
7318
+ "typeset",
7319
+ "readonly"
7320
+ ]);
7321
+ /** Recognize only simple commands, list separators, and statically known redirections. */
7322
+ function findTailPipelineStages(src) {
7323
+ const redirection = /(\d*)(>>|>\||>&|<&|<>|[<>])/y;
7324
+ if (src.includes("__mastra_pf_")) return void 0;
7325
+ let stageStarts = [0];
7326
+ let commandName;
7327
+ let hasStage = false;
7328
+ let i = 0;
7329
+ while (i < src.length) {
7330
+ const c = src[i];
7331
+ if (c === " " || c === " ") {
7332
+ i++;
7333
+ continue;
7334
+ }
7335
+ if (c === "\n" && !hasStage) {
7336
+ i++;
7337
+ continue;
7338
+ }
7339
+ if (c === "|" || c === "&" || c === ";" || c === "\n") {
7340
+ if (!hasStage) return void 0;
7341
+ const next = src[i + 1];
7342
+ if (c === "&" && next !== "&" || c === "|" && next === "&" || c === ";" && next === ";") return;
7343
+ i += (c === "|" || c === "&") && next === c ? 2 : 1;
7344
+ if (c === "|" && next !== "|") stageStarts.push(i);
7345
+ else stageStarts = [i];
7346
+ commandName = void 0;
7347
+ hasStage = false;
7348
+ continue;
7349
+ }
7350
+ if ("#()".includes(c)) return void 0;
7351
+ redirection.lastIndex = i;
7352
+ const redirect = redirection.exec(src);
7353
+ if (redirect) {
7354
+ const [, fd, operator] = redirect;
7355
+ if (!/^[0-7]?$/.test(fd) || src.startsWith("<<", i + fd.length)) return void 0;
7356
+ i = redirection.lastIndex;
7357
+ while (src[i] === " " || src[i] === " ") i++;
7358
+ const end = scanSimpleWord(src, i);
7359
+ if (end === void 0 || end === i) return void 0;
7360
+ const target = src.slice(i, end);
7361
+ if (operator === ">&" || operator === "<&") {
7362
+ if (!/^[0-7-]$/.test(target)) return void 0;
7363
+ } else if (!/^[\w./-]+$/.test(target) || target.includes("/fd/")) return;
7364
+ i = end;
7365
+ hasStage = true;
7366
+ continue;
7367
+ }
7368
+ const end = scanSimpleWord(src, i);
7369
+ if (end === void 0 || end === i) return void 0;
7370
+ const word = src.slice(i, end);
7371
+ if (/^\{\w+\}$/.test(word) && (src[end] === ">" || src[end] === "<")) return void 0;
7372
+ if (!commandName && !/^[A-Za-z_]\w*=/.test(word)) {
7373
+ if (!/^(?::|[\w./-]+)$/.test(word) || OPAQUE_COMMANDS.has(word)) return void 0;
7374
+ commandName = word;
7375
+ } else if (commandName === "exec" || commandName === "set" && word !== "-e" && word !== "+e") return;
7376
+ hasStage = true;
7377
+ i = end;
7378
+ }
7379
+ if (stageStarts.length < 2 || commandName !== "tail") return void 0;
7380
+ return stageStarts.map((start, index) => ({
7381
+ start,
7382
+ end: index + 1 < stageStarts.length ? stageStarts[index + 1] - 1 : src.length
7383
+ }));
7384
+ }
7385
+ /**
7386
+ * Skip ordinary quotes, escapes and simple parameters, but not embedded shell programs. `$_` is not
7387
+ * simple: the stage wrapper runs a command first, so bash would expand it to the wrapper's argument.
7388
+ */
7389
+ function scanSimpleWord(src, from) {
7390
+ const parameter = /\$(?:\{(?:[A-Za-z]\w*|_\w+|\d+|[?#!*@$-])\}|[A-Za-z]\w*|_\w+|[0-9?#!*@$-])/y;
7391
+ let doubleQuoted = false;
7392
+ for (let i = from; i < src.length; i++) {
7393
+ const c = src[i];
7394
+ if (!doubleQuoted && " \n;&|()<>".includes(c)) return i;
7395
+ if (c === "\"") doubleQuoted = !doubleQuoted;
7396
+ else if (c === "'" && !doubleQuoted) {
7397
+ i = src.indexOf("'", i + 1);
7398
+ if (i === -1) return void 0;
7399
+ } else if (c === "\\") {
7400
+ if (i + 1 === src.length || src[i + 1] === "\n") return void 0;
7401
+ i++;
7402
+ } else if (c === "`") return;
7403
+ else if (c === "$") {
7404
+ parameter.lastIndex = i;
7405
+ if (!parameter.test(src)) return void 0;
7406
+ i = parameter.lastIndex - 1;
7407
+ }
7408
+ }
7409
+ return doubleQuoted ? void 0 : src.length;
7410
+ }
7275
7411
  /**
7276
7412
  * POSIX shells report a pipeline's status from its last command, so `cmd | tail -N` exits 0 even
7277
- * when `cmd` fails. Enable `pipefail` (where the shell supports it) for pipelines ending in `tail`
7278
- * so the upstream failure is reported. `tail` reads all of its input, so upstream commands are
7279
- * not cut off by SIGPIPE. LocalSandbox on Windows runs commands through cmd.exe, which has no
7280
- * `set -o`.
7281
- */
7282
- function reportUpstreamPipelineFailure(command, sandboxProvider) {
7283
- if (sandboxProvider === "local" && process.platform === "win32") return command;
7284
- if (!TRAILING_TAIL_PIPE.test(command.trim())) return command;
7285
- return `(set -o pipefail) 2>/dev/null && set -o pipefail; ${command}`;
7413
+ * when `cmd` fails. For pipelines ending in `tail`, report the status of the last failing stage
7414
+ * instead, as `pipefail` does. `tail` reads all of its input, so upstream commands are not cut off
7415
+ * by SIGPIPE.
7416
+ *
7417
+ * On shells with native `pipefail`, run the original pipeline. On older dash, emulate it for
7418
+ * supported final pipelines by collecting upstream statuses on fd 9 and forwarding stdout on fd 8.
7419
+ * Only simple commands and static redirections are eligible. Compound syntax, runtime shell
7420
+ * interpretation, substitutions, and ambiguous or reserved file descriptors run unchanged after the
7421
+ * guard. Unknown launchers use an inline in-shell dispatch only when both branches fit.
7422
+ * Launchers known to lack pipefail need only one copy. If the generated script exceeds the
7423
+ * byte budget, leave the command unchanged after the native guard. Windows cmd.exe is unaffected.
7424
+ */
7425
+ function reportUpstreamPipelineFailure(command, sandbox) {
7426
+ if (sandbox.provider === "local" && process.platform === "win32") return command;
7427
+ const trimmed = command.trimEnd();
7428
+ if (!TRAILING_TAIL_PIPE.test(trimmed.trim())) return command;
7429
+ const guard = "(set -o pipefail) 2>/dev/null && set -o pipefail; ";
7430
+ if (sandbox.nativePipefail === true) return "command set -o pipefail; " + command;
7431
+ const stages = findTailPipelineStages(trimmed);
7432
+ if (!stages) return guard + command;
7433
+ const before = trimmed.slice(0, stages[0].start);
7434
+ const after = command.slice(trimmed.length);
7435
+ const emulated = emulatePipefail(stages.map(({ start, end }) => trimmed.slice(start, end)));
7436
+ const separator = /^$|\s$/.test(before) ? "" : " ";
7437
+ const script = sandbox.nativePipefail === false ? guard + before + separator + emulated + after : "if (set -o pipefail) 2>/dev/null; then __mastra_pf_probe=0; set -o pipefail; else __mastra_pf_probe=$?; (exit \"$__mastra_pf_probe\") && :; fi; " + before + separator + "case \"$__mastra_pf_probe\" in 0) " + trimmed.slice(before.length) + " ;; *) " + emulated + " ;; esac" + after;
7438
+ return Buffer.byteLength(script) <= MAX_PIPEFAIL_DISPATCH_BYTES ? script : guard + command;
7439
+ }
7440
+ function emulatePipefail(stages) {
7441
+ const wrappedStages = stages.map((stage, index) => {
7442
+ const wrapped = `( command eval "$__mastra_pf_init" && :; ${stage} ) 8>&- 9>&-`;
7443
+ return index === stages.length - 1 ? wrapped : `{ ${wrapped}; command printf '${index + 1}:%s ' "$?" >&9; }`;
7444
+ });
7445
+ const rightToLeft = stages.slice(1).map((_, index) => stages.length - index - 1).join(" ");
7446
+ return `{ __mastra_pf_init="(exit \$?)"; case \$- in *e*) __mastra_pf_init="set -e; \$__mastra_pf_init";; esac; if { command exec 8>&1; } 2>/dev/null; then __mastra_pf_stdout=8; else __mastra_pf_stdout=-; fi; __mastra_pf_status=$(set +e; { ${wrappedStages.join(" | ")}; } 9>&1 >&"$__mastra_pf_stdout"); ( __mastra_pf_exit=$?; __mastra_pf_status=" $__mastra_pf_status"; for __mastra_pf_n in ${rightToLeft}; do __mastra_pf_key=" $__mastra_pf_n:"; __mastra_pf_value=\${__mastra_pf_status#*"$__mastra_pf_key"}; case $__mastra_pf_value in "$__mastra_pf_status") exit 125;; esac; __mastra_pf_code=\${__mastra_pf_value%% *}; case $__mastra_pf_code in [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;; *) exit 125;; esac; __mastra_pf_status=\${__mastra_pf_status%%"$__mastra_pf_key"*}\${__mastra_pf_value#"$__mastra_pf_code"}; [ "$__mastra_pf_exit" -ne 0 ] || __mastra_pf_exit=$__mastra_pf_code; done; [ "$__mastra_pf_status" = ' ' ] || exit 125; exit "$__mastra_pf_exit" ); } 8>&-`;
7286
7447
  }
7287
7448
  const ABORTED_COMMAND_NOTE = "Command aborted: the run was cancelled (by the user or system) while this command was running, so it was killed before it finished.";
7288
7449
  const CANCELLED_RUN_NOTE = "The run was cancelled (by the user or system) while this command was running.";
@@ -7445,7 +7606,8 @@ async function executeCommand(input, context) {
7445
7606
  const stderr = new RetainedOutputBuffer(DEFAULT_MAX_RETAINED_PROCESS_OUTPUT_BYTES);
7446
7607
  let abortedWhenSettled = false;
7447
7608
  try {
7448
- const result = await sandbox.executeCommand(reportUpstreamPipelineFailure(command, sandbox.provider), [], {
7609
+ const script = reportUpstreamPipelineFailure(command, sandbox);
7610
+ const result = await sandbox.executeCommand(script, [], {
7449
7611
  timeout: timeout ?? void 0,
7450
7612
  cwd: effectiveCwd,
7451
7613
  abortSignal: context?.abortSignal,
@@ -3719,7 +3719,11 @@ var LocalProcessManager = class extends SandboxProcessManager {
3719
3719
  ...env
3720
3720
  };
3721
3721
  const directShell = isWindows && this.sandbox.isolation === "none" && invocation !== void 0 && /^(sh|sh\.exe)$/i.test(nodePath.win32.basename(invocation.command)) && invocation.args[0] === "-c" && invocation.args.length >= 2;
3722
- const wrapped = directShell ? {
3722
+ const commandShell = this.sandbox.commandShell;
3723
+ const wrapped = commandShell ? {
3724
+ command: commandShell,
3725
+ args: ["-c", withRaisedOomScore(command)]
3726
+ } : directShell ? {
3723
3727
  command: usesBash && /^sh(\.exe)?$/i.test(invocation.command) ? posixShell : invocation.command,
3724
3728
  args: invocation.args
3725
3729
  } : usesBash && invocation ? {
@@ -3749,7 +3753,7 @@ var LocalProcessManager = class extends SandboxProcessManager {
3749
3753
  else execaOptions = {
3750
3754
  ...baseOptions,
3751
3755
  detached: true,
3752
- shell: this.sandbox.isolation === "none"
3756
+ shell: !commandShell && this.sandbox.isolation === "none"
3753
3757
  };
3754
3758
  const subprocess = (await getExeca())(wrapped.command, wrapped.args, execaOptions);
3755
3759
  if (!subprocess.pid) {
@@ -4233,8 +4237,11 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
4233
4237
  get workingDirectory() {
4234
4238
  return this._workingDirectory;
4235
4239
  }
4240
+ commandShell;
4241
+ nativePipefail;
4236
4242
  constructor(options = {}) {
4237
4243
  const requestedIsolation = options.isolation ?? "none";
4244
+ if (options.shell && (process.platform === "win32" || requestedIsolation !== "none" || !nodePath.isAbsolute(options.shell.path))) throw new Error("LocalSandbox shell requires an absolute path and non-isolated Unix execution.");
4238
4245
  if (requestedIsolation === "seatbelt" && process.platform === "win32") throw new IsolationUnavailableError("seatbelt", "Seatbelt isolation is only supported on macOS, not Windows.");
4239
4246
  if (requestedIsolation !== "none" && !isIsolationAvailable(requestedIsolation)) throw new IsolationUnavailableError(requestedIsolation, detectIsolation().message);
4240
4247
  super({
@@ -4261,6 +4268,8 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
4261
4268
  this._initialReadWritePaths = new Set(this._nativeSandboxConfig.readWritePaths ?? []);
4262
4269
  this._initialDenyWritePaths = new Set(this._nativeSandboxConfig.denyWritePaths ?? []);
4263
4270
  this.isolation = requestedIsolation;
4271
+ this.commandShell = options.shell?.path;
4272
+ this.nativePipefail = options.shell?.nativePipefail;
4264
4273
  this._instructionsOverride = options.instructions;
4265
4274
  this._checkpointName = options.checkpointName;
4266
4275
  this._seedCheckpointName = options.seedCheckpointName;
@@ -4283,6 +4292,10 @@ var LocalSandbox = class LocalSandbox extends MastraSandbox {
4283
4292
  env: options.env ?? this.env,
4284
4293
  timeout: this.timeout,
4285
4294
  isolation: this.isolation,
4295
+ shell: this.commandShell ? {
4296
+ path: this.commandShell,
4297
+ nativePipefail: this.nativePipefail
4298
+ } : void 0,
4286
4299
  outputEncoding: this._outputEncoding,
4287
4300
  nativeSandbox: {
4288
4301
  ...this._nativeSandboxConfig,
@@ -7265,19 +7278,167 @@ const executeCommandWithDescriptionAndBackgroundSchema = z.object({
7265
7278
  ...descriptionShape,
7266
7279
  ...executeCommandWithBackgroundSchema.shape
7267
7280
  });
7281
+ const MAX_PIPEFAIL_DISPATCH_BYTES = 122880;
7268
7282
  /** A command whose final pipeline stage is `tail`, e.g. `make test 2>&1 | tail -20`. */
7269
7283
  const TRAILING_TAIL_PIPE = /(?:^|[^|])\|\s*tail(?:\s[^|;&]*)?$/;
7284
+ const OPAQUE_COMMANDS = /* @__PURE__ */ new Set([
7285
+ "if",
7286
+ "then",
7287
+ "elif",
7288
+ "else",
7289
+ "fi",
7290
+ "for",
7291
+ "while",
7292
+ "until",
7293
+ "do",
7294
+ "done",
7295
+ "case",
7296
+ "esac",
7297
+ "select",
7298
+ "function",
7299
+ "time",
7300
+ "coproc",
7301
+ "eval",
7302
+ ".",
7303
+ "source",
7304
+ "alias",
7305
+ "unalias",
7306
+ "trap",
7307
+ "command",
7308
+ "builtin",
7309
+ "enable",
7310
+ "shopt",
7311
+ "local",
7312
+ "declare",
7313
+ "typeset",
7314
+ "readonly"
7315
+ ]);
7316
+ /** Recognize only simple commands, list separators, and statically known redirections. */
7317
+ function findTailPipelineStages(src) {
7318
+ const redirection = /(\d*)(>>|>\||>&|<&|<>|[<>])/y;
7319
+ if (src.includes("__mastra_pf_")) return void 0;
7320
+ let stageStarts = [0];
7321
+ let commandName;
7322
+ let hasStage = false;
7323
+ let i = 0;
7324
+ while (i < src.length) {
7325
+ const c = src[i];
7326
+ if (c === " " || c === " ") {
7327
+ i++;
7328
+ continue;
7329
+ }
7330
+ if (c === "\n" && !hasStage) {
7331
+ i++;
7332
+ continue;
7333
+ }
7334
+ if (c === "|" || c === "&" || c === ";" || c === "\n") {
7335
+ if (!hasStage) return void 0;
7336
+ const next = src[i + 1];
7337
+ if (c === "&" && next !== "&" || c === "|" && next === "&" || c === ";" && next === ";") return;
7338
+ i += (c === "|" || c === "&") && next === c ? 2 : 1;
7339
+ if (c === "|" && next !== "|") stageStarts.push(i);
7340
+ else stageStarts = [i];
7341
+ commandName = void 0;
7342
+ hasStage = false;
7343
+ continue;
7344
+ }
7345
+ if ("#()".includes(c)) return void 0;
7346
+ redirection.lastIndex = i;
7347
+ const redirect = redirection.exec(src);
7348
+ if (redirect) {
7349
+ const [, fd, operator] = redirect;
7350
+ if (!/^[0-7]?$/.test(fd) || src.startsWith("<<", i + fd.length)) return void 0;
7351
+ i = redirection.lastIndex;
7352
+ while (src[i] === " " || src[i] === " ") i++;
7353
+ const end = scanSimpleWord(src, i);
7354
+ if (end === void 0 || end === i) return void 0;
7355
+ const target = src.slice(i, end);
7356
+ if (operator === ">&" || operator === "<&") {
7357
+ if (!/^[0-7-]$/.test(target)) return void 0;
7358
+ } else if (!/^[\w./-]+$/.test(target) || target.includes("/fd/")) return;
7359
+ i = end;
7360
+ hasStage = true;
7361
+ continue;
7362
+ }
7363
+ const end = scanSimpleWord(src, i);
7364
+ if (end === void 0 || end === i) return void 0;
7365
+ const word = src.slice(i, end);
7366
+ if (/^\{\w+\}$/.test(word) && (src[end] === ">" || src[end] === "<")) return void 0;
7367
+ if (!commandName && !/^[A-Za-z_]\w*=/.test(word)) {
7368
+ if (!/^(?::|[\w./-]+)$/.test(word) || OPAQUE_COMMANDS.has(word)) return void 0;
7369
+ commandName = word;
7370
+ } else if (commandName === "exec" || commandName === "set" && word !== "-e" && word !== "+e") return;
7371
+ hasStage = true;
7372
+ i = end;
7373
+ }
7374
+ if (stageStarts.length < 2 || commandName !== "tail") return void 0;
7375
+ return stageStarts.map((start, index) => ({
7376
+ start,
7377
+ end: index + 1 < stageStarts.length ? stageStarts[index + 1] - 1 : src.length
7378
+ }));
7379
+ }
7380
+ /**
7381
+ * Skip ordinary quotes, escapes and simple parameters, but not embedded shell programs. `$_` is not
7382
+ * simple: the stage wrapper runs a command first, so bash would expand it to the wrapper's argument.
7383
+ */
7384
+ function scanSimpleWord(src, from) {
7385
+ const parameter = /\$(?:\{(?:[A-Za-z]\w*|_\w+|\d+|[?#!*@$-])\}|[A-Za-z]\w*|_\w+|[0-9?#!*@$-])/y;
7386
+ let doubleQuoted = false;
7387
+ for (let i = from; i < src.length; i++) {
7388
+ const c = src[i];
7389
+ if (!doubleQuoted && " \n;&|()<>".includes(c)) return i;
7390
+ if (c === "\"") doubleQuoted = !doubleQuoted;
7391
+ else if (c === "'" && !doubleQuoted) {
7392
+ i = src.indexOf("'", i + 1);
7393
+ if (i === -1) return void 0;
7394
+ } else if (c === "\\") {
7395
+ if (i + 1 === src.length || src[i + 1] === "\n") return void 0;
7396
+ i++;
7397
+ } else if (c === "`") return;
7398
+ else if (c === "$") {
7399
+ parameter.lastIndex = i;
7400
+ if (!parameter.test(src)) return void 0;
7401
+ i = parameter.lastIndex - 1;
7402
+ }
7403
+ }
7404
+ return doubleQuoted ? void 0 : src.length;
7405
+ }
7270
7406
  /**
7271
7407
  * POSIX shells report a pipeline's status from its last command, so `cmd | tail -N` exits 0 even
7272
- * when `cmd` fails. Enable `pipefail` (where the shell supports it) for pipelines ending in `tail`
7273
- * so the upstream failure is reported. `tail` reads all of its input, so upstream commands are
7274
- * not cut off by SIGPIPE. LocalSandbox on Windows runs commands through cmd.exe, which has no
7275
- * `set -o`.
7276
- */
7277
- function reportUpstreamPipelineFailure(command, sandboxProvider) {
7278
- if (sandboxProvider === "local" && process.platform === "win32") return command;
7279
- if (!TRAILING_TAIL_PIPE.test(command.trim())) return command;
7280
- return `(set -o pipefail) 2>/dev/null && set -o pipefail; ${command}`;
7408
+ * when `cmd` fails. For pipelines ending in `tail`, report the status of the last failing stage
7409
+ * instead, as `pipefail` does. `tail` reads all of its input, so upstream commands are not cut off
7410
+ * by SIGPIPE.
7411
+ *
7412
+ * On shells with native `pipefail`, run the original pipeline. On older dash, emulate it for
7413
+ * supported final pipelines by collecting upstream statuses on fd 9 and forwarding stdout on fd 8.
7414
+ * Only simple commands and static redirections are eligible. Compound syntax, runtime shell
7415
+ * interpretation, substitutions, and ambiguous or reserved file descriptors run unchanged after the
7416
+ * guard. Unknown launchers use an inline in-shell dispatch only when both branches fit.
7417
+ * Launchers known to lack pipefail need only one copy. If the generated script exceeds the
7418
+ * byte budget, leave the command unchanged after the native guard. Windows cmd.exe is unaffected.
7419
+ */
7420
+ function reportUpstreamPipelineFailure(command, sandbox) {
7421
+ if (sandbox.provider === "local" && process.platform === "win32") return command;
7422
+ const trimmed = command.trimEnd();
7423
+ if (!TRAILING_TAIL_PIPE.test(trimmed.trim())) return command;
7424
+ const guard = "(set -o pipefail) 2>/dev/null && set -o pipefail; ";
7425
+ if (sandbox.nativePipefail === true) return "command set -o pipefail; " + command;
7426
+ const stages = findTailPipelineStages(trimmed);
7427
+ if (!stages) return guard + command;
7428
+ const before = trimmed.slice(0, stages[0].start);
7429
+ const after = command.slice(trimmed.length);
7430
+ const emulated = emulatePipefail(stages.map(({ start, end }) => trimmed.slice(start, end)));
7431
+ const separator = /^$|\s$/.test(before) ? "" : " ";
7432
+ const script = sandbox.nativePipefail === false ? guard + before + separator + emulated + after : "if (set -o pipefail) 2>/dev/null; then __mastra_pf_probe=0; set -o pipefail; else __mastra_pf_probe=$?; (exit \"$__mastra_pf_probe\") && :; fi; " + before + separator + "case \"$__mastra_pf_probe\" in 0) " + trimmed.slice(before.length) + " ;; *) " + emulated + " ;; esac" + after;
7433
+ return Buffer.byteLength(script) <= MAX_PIPEFAIL_DISPATCH_BYTES ? script : guard + command;
7434
+ }
7435
+ function emulatePipefail(stages) {
7436
+ const wrappedStages = stages.map((stage, index) => {
7437
+ const wrapped = `( command eval "$__mastra_pf_init" && :; ${stage} ) 8>&- 9>&-`;
7438
+ return index === stages.length - 1 ? wrapped : `{ ${wrapped}; command printf '${index + 1}:%s ' "$?" >&9; }`;
7439
+ });
7440
+ const rightToLeft = stages.slice(1).map((_, index) => stages.length - index - 1).join(" ");
7441
+ return `{ __mastra_pf_init="(exit \$?)"; case \$- in *e*) __mastra_pf_init="set -e; \$__mastra_pf_init";; esac; if { command exec 8>&1; } 2>/dev/null; then __mastra_pf_stdout=8; else __mastra_pf_stdout=-; fi; __mastra_pf_status=$(set +e; { ${wrappedStages.join(" | ")}; } 9>&1 >&"$__mastra_pf_stdout"); ( __mastra_pf_exit=$?; __mastra_pf_status=" $__mastra_pf_status"; for __mastra_pf_n in ${rightToLeft}; do __mastra_pf_key=" $__mastra_pf_n:"; __mastra_pf_value=\${__mastra_pf_status#*"$__mastra_pf_key"}; case $__mastra_pf_value in "$__mastra_pf_status") exit 125;; esac; __mastra_pf_code=\${__mastra_pf_value%% *}; case $__mastra_pf_code in [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]) ;; *) exit 125;; esac; __mastra_pf_status=\${__mastra_pf_status%%"$__mastra_pf_key"*}\${__mastra_pf_value#"$__mastra_pf_code"}; [ "$__mastra_pf_exit" -ne 0 ] || __mastra_pf_exit=$__mastra_pf_code; done; [ "$__mastra_pf_status" = ' ' ] || exit 125; exit "$__mastra_pf_exit" ); } 8>&-`;
7281
7442
  }
7282
7443
  const ABORTED_COMMAND_NOTE = "Command aborted: the run was cancelled (by the user or system) while this command was running, so it was killed before it finished.";
7283
7444
  const CANCELLED_RUN_NOTE = "The run was cancelled (by the user or system) while this command was running.";
@@ -7440,7 +7601,8 @@ async function executeCommand(input, context) {
7440
7601
  const stderr = new RetainedOutputBuffer(DEFAULT_MAX_RETAINED_PROCESS_OUTPUT_BYTES);
7441
7602
  let abortedWhenSettled = false;
7442
7603
  try {
7443
- const result = await sandbox.executeCommand(reportUpstreamPipelineFailure(command, sandbox.provider), [], {
7604
+ const script = reportUpstreamPipelineFailure(command, sandbox);
7605
+ const result = await sandbox.executeCommand(script, [], {
7444
7606
  timeout: timeout ?? void 0,
7445
7607
  cwd: effectiveCwd,
7446
7608
  abortSignal: context?.abortSignal,
@@ -0,0 +1 @@
1
+ export * from './../dist/llm/reasoning';
@@ -0,0 +1 @@
1
+ export * from './../dist/memory/om-events';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/core",
3
- "version": "1.87.0-alpha.10",
3
+ "version": "1.87.0-alpha.12",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -331,6 +331,26 @@
331
331
  "default": "./dist/llm/index.cjs"
332
332
  }
333
333
  },
334
+ "./llm/reasoning": {
335
+ "import": {
336
+ "types": "./dist/llm/reasoning/index.d.ts",
337
+ "default": "./dist/llm/reasoning/index.js"
338
+ },
339
+ "require": {
340
+ "types": "./dist/llm/reasoning/index.d.ts",
341
+ "default": "./dist/llm/reasoning/index.cjs"
342
+ }
343
+ },
344
+ "./memory/om-events": {
345
+ "import": {
346
+ "types": "./dist/memory/om-events/index.d.ts",
347
+ "default": "./dist/memory/om-events/index.js"
348
+ },
349
+ "require": {
350
+ "types": "./dist/memory/om-events/index.d.ts",
351
+ "default": "./dist/memory/om-events/index.cjs"
352
+ }
353
+ },
334
354
  "./knowledge": {
335
355
  "import": {
336
356
  "types": "./dist/knowledge/index.d.ts",
@@ -966,19 +986,19 @@
966
986
  "vscode-languageserver-protocol": "^3.18.5",
967
987
  "zod": "^4.6.7",
968
988
  "zod-v3": "npm:zod@3.25.76",
989
+ "@internal/ai-sdk-v5": "0.0.99",
969
990
  "@internal/ai-sdk-v4": "0.0.99",
970
- "@internal/auth": "0.0.40",
971
991
  "@internal/ai-v6": "0.0.99",
972
- "@internal/core": "0.1.4",
973
- "@internal/ai-sdk-v5": "0.0.99",
974
- "@internal/llm-recorder": "0.0.88",
992
+ "@internal/ai-v7": "0.0.99",
993
+ "@internal/auth": "0.0.40",
975
994
  "@internal/external-types": "0.0.102",
976
995
  "@internal/lint": "0.0.152",
996
+ "@internal/llm-recorder": "0.0.88",
977
997
  "@internal/deployer": "0.0.5",
998
+ "@internal/types-builder": "0.0.127",
978
999
  "@internal/test-utils": "0.0.88",
979
1000
  "@internal/voice": "0.0.48",
980
- "@internal/ai-v7": "0.0.99",
981
- "@internal/types-builder": "0.0.127"
1001
+ "@internal/core": "0.1.4"
982
1002
  },
983
1003
  "engines": {
984
1004
  "node": ">=22.13.0"