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

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 (369) hide show
  1. package/dist/agent/durable/index.cjs +1 -1
  2. package/dist/agent/durable/index.js +1 -1
  3. package/dist/agent/index.cjs +2 -2
  4. package/dist/agent/index.js +2 -2
  5. package/dist/agent-builder/ee/index.cjs +1 -1
  6. package/dist/agent-builder/ee/index.js +1 -1
  7. package/dist/agent-controller/agent-controller.d.ts +6 -0
  8. package/dist/agent-controller/index.cjs +1 -1
  9. package/dist/agent-controller/index.js +1 -1
  10. package/dist/agent-controller/worker-run-binding.d.ts +15 -0
  11. package/dist/{agent-controller-VBMIPr6h.js → agent-controller-CDwoELRq.js} +47 -5
  12. package/dist/{agent-controller-CqcyudV6.cjs → agent-controller-DEB1G03O.cjs} +47 -5
  13. package/dist/background-tasks/index.cjs +1 -1
  14. package/dist/background-tasks/index.js +1 -1
  15. package/dist/{background-tasks-FOaQ1LsS.cjs → background-tasks-B40g_Guf.cjs} +1 -1
  16. package/dist/{background-tasks-1tyymY2H.js → background-tasks-CBp2178j.js} +1 -1
  17. package/dist/browser/index.cjs +1 -1
  18. package/dist/browser/index.js +1 -1
  19. package/dist/{builder-CUbE9d87.js → builder-DTEXPju5.js} +2 -2
  20. package/dist/{builder-MLhVrFJw.cjs → builder-tuHJooMG.cjs} +2 -2
  21. package/dist/capabilities/302ai.json +203 -203
  22. package/dist/capabilities/abliteratedllm.json +34 -34
  23. package/dist/capabilities/abliteration-ai.json +9 -9
  24. package/dist/capabilities/above.json +19 -19
  25. package/dist/capabilities/adaption.json +9 -9
  26. package/dist/capabilities/adzuki.json +27 -27
  27. package/dist/capabilities/agentrouter.json +11 -11
  28. package/dist/capabilities/agnes.json +3 -3
  29. package/dist/capabilities/ai-router.json +6 -6
  30. package/dist/capabilities/aiand.json +26 -26
  31. package/dist/capabilities/aigrow.json +13 -13
  32. package/dist/capabilities/aimlapi.json +156 -156
  33. package/dist/capabilities/aipg.json +2 -2
  34. package/dist/capabilities/aixy.json +19 -19
  35. package/dist/capabilities/aki-io.json +15 -15
  36. package/dist/capabilities/alibaba-cn.json +94 -94
  37. package/dist/capabilities/alibaba-coding-plan-cn.json +6 -6
  38. package/dist/capabilities/alibaba-coding-plan.json +6 -6
  39. package/dist/capabilities/alibaba-token-plan-cn.json +48 -48
  40. package/dist/capabilities/alibaba-token-plan.json +51 -51
  41. package/dist/capabilities/alibaba.json +93 -59
  42. package/dist/capabilities/ambient.json +16 -16
  43. package/dist/capabilities/amd.json +9 -9
  44. package/dist/capabilities/anthropic.json +36 -36
  45. package/dist/capabilities/anyapi.json +17 -17
  46. package/dist/capabilities/apiko.json +4 -4
  47. package/dist/capabilities/arcee.json +10 -10
  48. package/dist/capabilities/augure.json +8 -8
  49. package/dist/capabilities/auriko.json +18 -18
  50. package/dist/capabilities/bailing.json +2 -2
  51. package/dist/capabilities/baseten.json +22 -22
  52. package/dist/capabilities/bee.json +4 -4
  53. package/dist/capabilities/berget.json +8 -8
  54. package/dist/capabilities/bothub.json +15 -15
  55. package/dist/capabilities/boundless.json +40 -40
  56. package/dist/capabilities/bumo.json +37 -37
  57. package/dist/capabilities/byteplus.json +29 -29
  58. package/dist/capabilities/cerebras.json +4 -4
  59. package/dist/capabilities/cheapaimodel.json +7 -7
  60. package/dist/capabilities/cheapest-token.json +28 -28
  61. package/dist/capabilities/chutes.json +7 -7
  62. package/dist/capabilities/cline-pass.json +37 -37
  63. package/dist/capabilities/cloudcode.json +7 -7
  64. package/dist/capabilities/cloudflare-workers-ai.json +17 -17
  65. package/dist/capabilities/commandcode.json +149 -149
  66. package/dist/capabilities/concentrate.json +271 -291
  67. package/dist/capabilities/cortecs.json +110 -110
  68. package/dist/capabilities/crossmodel.json +192 -192
  69. package/dist/capabilities/crusoe.json +10 -10
  70. package/dist/capabilities/daoxe.json +9 -9
  71. package/dist/capabilities/databricks.json +129 -129
  72. package/dist/capabilities/deepinfra.json +82 -82
  73. package/dist/capabilities/deepseek.json +3 -3
  74. package/dist/capabilities/digitalocean.json +113 -113
  75. package/dist/capabilities/dothoosh.json +28 -28
  76. package/dist/capabilities/doubleword.json +22 -22
  77. package/dist/capabilities/edenai.json +289 -289
  78. package/dist/capabilities/empiriolabs.json +172 -172
  79. package/dist/capabilities/engy.json +21 -21
  80. package/dist/capabilities/entrim.json +2 -2
  81. package/dist/capabilities/evroc.json +12 -12
  82. package/dist/capabilities/ezkielyna.json +6 -6
  83. package/dist/capabilities/fastrouter.json +75 -75
  84. package/dist/capabilities/fireworks-ai.json +98 -98
  85. package/dist/capabilities/freemodel.json +22 -22
  86. package/dist/capabilities/friendli.json +8 -8
  87. package/dist/capabilities/frogbot.json +93 -93
  88. package/dist/capabilities/gisoo.json +15 -15
  89. package/dist/capabilities/gmicloud.json +15 -15
  90. package/dist/capabilities/google.json +48 -48
  91. package/dist/capabilities/graphn.json +11 -11
  92. package/dist/capabilities/greenpt.json +37 -37
  93. package/dist/capabilities/groq.json +9 -9
  94. package/dist/capabilities/helicone.json +75 -75
  95. package/dist/capabilities/hopper.json +2 -2
  96. package/dist/capabilities/hostinger-router.json +13 -13
  97. package/dist/capabilities/hpc-ai.json +12 -12
  98. package/dist/capabilities/huawei-maas.json +12 -12
  99. package/dist/capabilities/hubris.json +30 -30
  100. package/dist/capabilities/huggingface.json +99 -99
  101. package/dist/capabilities/hyper.json +26 -26
  102. package/dist/capabilities/impossibl.json +167 -167
  103. package/dist/capabilities/inception.json +2 -2
  104. package/dist/capabilities/inceptron.json +6 -6
  105. package/dist/capabilities/inco.json +4 -4
  106. package/dist/capabilities/infer.json +13 -13
  107. package/dist/capabilities/inferall.json +12 -12
  108. package/dist/capabilities/inference-coop.json +15 -15
  109. package/dist/capabilities/inferenceapis.json +15 -15
  110. package/dist/capabilities/inferris.json +3 -3
  111. package/dist/capabilities/infersia.json +14 -14
  112. package/dist/capabilities/inferx.json +3 -3
  113. package/dist/capabilities/infomaniak.json +2 -2
  114. package/dist/capabilities/isoquant.json +4 -4
  115. package/dist/capabilities/iteracompute.json +56 -56
  116. package/dist/capabilities/jad-ai.json +3 -3
  117. package/dist/capabilities/jalapeno.json +10 -10
  118. package/dist/capabilities/jiekou.json +64 -64
  119. package/dist/capabilities/jzstoken.json +53 -53
  120. package/dist/capabilities/keln.json +17 -17
  121. package/dist/capabilities/kenari.json +120 -120
  122. package/dist/capabilities/kilo.json +632 -641
  123. package/dist/capabilities/kimi-code-plan-cn.json +7 -7
  124. package/dist/capabilities/kimi-code-plan-global.json +7 -7
  125. package/dist/capabilities/kitani.json +2 -2
  126. package/dist/capabilities/klavo.json +20 -20
  127. package/dist/capabilities/korouter.json +28 -28
  128. package/dist/capabilities/kunavo.json +10 -10
  129. package/dist/capabilities/liquid.json +10 -10
  130. package/dist/capabilities/lithosai.json +3 -3
  131. package/dist/capabilities/llmgateway-providers.json +913 -905
  132. package/dist/capabilities/llmgateway.json +334 -334
  133. package/dist/capabilities/llmtr.json +35 -35
  134. package/dist/capabilities/logits.json +2 -2
  135. package/dist/capabilities/lowrouter.json +50 -50
  136. package/dist/capabilities/lyceum.json +14 -14
  137. package/dist/capabilities/melious.json +13 -13
  138. package/dist/capabilities/merge-gateway.json +298 -298
  139. package/dist/capabilities/meta.json +10 -10
  140. package/dist/capabilities/mistral.json +16 -16
  141. package/dist/capabilities/mixlayer.json +5 -5
  142. package/dist/capabilities/modal.json +7 -7
  143. package/dist/capabilities/model-oracle-ai.json +25 -25
  144. package/dist/capabilities/modelis.json +17 -17
  145. package/dist/capabilities/modelscope.json +2 -2
  146. package/dist/capabilities/modular.json +5 -5
  147. package/dist/capabilities/moneo.json +13 -13
  148. package/dist/capabilities/moonshotai-cn.json +7 -7
  149. package/dist/capabilities/moonshotai.json +7 -7
  150. package/dist/capabilities/morph.json +10 -10
  151. package/dist/capabilities/munito-eu.json +6 -6
  152. package/dist/capabilities/munito.json +6 -6
  153. package/dist/capabilities/nan.json +27 -27
  154. package/dist/capabilities/nano-gpt.json +571 -568
  155. package/dist/capabilities/nearai.json +108 -108
  156. package/dist/capabilities/nebius.json +21 -21
  157. package/dist/capabilities/neon.json +130 -130
  158. package/dist/capabilities/neuralwatt.json +40 -40
  159. package/dist/capabilities/nokeep.json +4 -4
  160. package/dist/capabilities/novita-ai.json +155 -155
  161. package/dist/capabilities/nvidia.json +29 -29
  162. package/dist/capabilities/oathbreaker.json +2 -2
  163. package/dist/capabilities/obscurify.json +32 -32
  164. package/dist/capabilities/oci.json +5 -5
  165. package/dist/capabilities/ofox.json +374 -374
  166. package/dist/capabilities/ollama-cloud.json +54 -54
  167. package/dist/capabilities/openai.json +56 -56
  168. package/dist/capabilities/opencode-go.json +84 -84
  169. package/dist/capabilities/openreason.json +5 -5
  170. package/dist/capabilities/openrouter.json +562 -562
  171. package/dist/capabilities/opper.json +27 -27
  172. package/dist/capabilities/orcarouter.json +255 -255
  173. package/dist/capabilities/outerlabs.json +21 -21
  174. package/dist/capabilities/ovhcloud.json +21 -21
  175. package/dist/capabilities/pareto.json +5 -5
  176. package/dist/capabilities/pendra.json +4 -4
  177. package/dist/capabilities/perplexity-agent.json +67 -67
  178. package/dist/capabilities/perplexity.json +2 -2
  179. package/dist/capabilities/phala.json +30 -30
  180. package/dist/capabilities/pioneer.json +21 -21
  181. package/dist/capabilities/poe.json +139 -139
  182. package/dist/capabilities/powerspring.json +14 -14
  183. package/dist/capabilities/primalabs.json +10 -10
  184. package/dist/capabilities/prime.json +117 -117
  185. package/dist/capabilities/privatemode-ai.json +14 -14
  186. package/dist/capabilities/proxystacks.json +6 -6
  187. package/dist/capabilities/qiniu-ai.json +15 -15
  188. package/dist/capabilities/refuseless.json +10 -10
  189. package/dist/capabilities/regolo-ai.json +6 -6
  190. package/dist/capabilities/requesty.json +168 -168
  191. package/dist/capabilities/ruapi.json +15 -15
  192. package/dist/capabilities/runcrate.json +7 -7
  193. package/dist/capabilities/runinfra.json +8 -8
  194. package/dist/capabilities/sakana.json +6 -6
  195. package/dist/capabilities/sambanova.json +5 -5
  196. package/dist/capabilities/sandbase.json +21 -21
  197. package/dist/capabilities/sarvam.json +8 -8
  198. package/dist/capabilities/scaleway.json +18 -18
  199. package/dist/capabilities/scnet-token-plan.json +14 -14
  200. package/dist/capabilities/scx-ai.json +21 -21
  201. package/dist/capabilities/sensenova.json +9 -9
  202. package/dist/capabilities/siliconflow-cn.json +46 -46
  203. package/dist/capabilities/siliconflow.json +56 -56
  204. package/dist/capabilities/snowflake-cortex.json +19 -19
  205. package/dist/capabilities/sokkan.json +12 -12
  206. package/dist/capabilities/sparrowcodes.json +21 -21
  207. package/dist/capabilities/standardcompute.json +96 -96
  208. package/dist/capabilities/steadyrouter.json +41 -41
  209. package/dist/capabilities/stepfun-ai-step-plan.json +2 -2
  210. package/dist/capabilities/stepfun-ai.json +2 -2
  211. package/dist/capabilities/stepfun-step-plan.json +2 -2
  212. package/dist/capabilities/stepfun.json +2 -2
  213. package/dist/capabilities/stepping-stone.json +11 -11
  214. package/dist/capabilities/synthetic.json +8 -8
  215. package/dist/capabilities/synthorai.json +22 -22
  216. package/dist/capabilities/teamorouter.json +26 -26
  217. package/dist/capabilities/teapot-router.json +6 -6
  218. package/dist/capabilities/tencent-token-plan-intl.json +126 -0
  219. package/dist/capabilities/tencent-token-plan.json +41 -41
  220. package/dist/capabilities/tencent-tokenhub.json +47 -47
  221. package/dist/capabilities/tensorx.json +50 -50
  222. package/dist/capabilities/tenstorrent.json +2 -2
  223. package/dist/capabilities/the-grid-ai.json +32 -32
  224. package/dist/capabilities/thinkingmachines.json +64 -64
  225. package/dist/capabilities/tinfoil.json +12 -12
  226. package/dist/capabilities/toapis.json +2 -2
  227. package/dist/capabilities/togetherai.json +43 -43
  228. package/dist/capabilities/tokengo.json +20 -20
  229. package/dist/capabilities/tokenify.json +3 -3
  230. package/dist/capabilities/trustedrouter.json +6 -6
  231. package/dist/capabilities/trustedtokens.json +11 -11
  232. package/dist/capabilities/umans-ai-coding-plan.json +14 -14
  233. package/dist/capabilities/umans-ai.json +11 -11
  234. package/dist/capabilities/uncensuredai.json +5 -5
  235. package/dist/capabilities/unrestricted.json +4 -4
  236. package/dist/capabilities/uplinkswitch.json +18 -18
  237. package/dist/capabilities/upstage.json +6 -6
  238. package/dist/capabilities/vancine.json +18 -18
  239. package/dist/capabilities/vercel.json +545 -545
  240. package/dist/capabilities/vivgrid.json +81 -81
  241. package/dist/capabilities/volcengine-coding-plan.json +27 -27
  242. package/dist/capabilities/volcengine.json +25 -25
  243. package/dist/capabilities/vultr.json +31 -31
  244. package/dist/capabilities/wafer.ai.json +17 -17
  245. package/dist/capabilities/wallaby.json +2 -2
  246. package/dist/capabilities/wally.json +13 -13
  247. package/dist/capabilities/wandb.json +15 -15
  248. package/dist/capabilities/watt.json +23 -23
  249. package/dist/capabilities/xai.json +6 -6
  250. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
  251. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
  252. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
  253. package/dist/capabilities/xiaomi.json +2 -2
  254. package/dist/capabilities/xpersona.json +9 -9
  255. package/dist/capabilities/xxapi.json +20 -20
  256. package/dist/capabilities/zai-coding-plan.json +19 -19
  257. package/dist/capabilities/zai.json +31 -31
  258. package/dist/capabilities/zenifra.json +31 -31
  259. package/dist/capabilities/zenmux.json +204 -204
  260. package/dist/capabilities/zerogpu.json +9 -9
  261. package/dist/capabilities/zhipuai-coding-plan.json +7 -7
  262. package/dist/capabilities/zhipuai.json +30 -30
  263. package/dist/capabilities/zro.json +4 -4
  264. package/dist/channels/index.cjs +2 -2
  265. package/dist/channels/index.js +2 -2
  266. package/dist/{channels-hBppCRhl.js → channels-CC2Z4adP.js} +1 -1
  267. package/dist/{channels-CZ0iY2yh.cjs → channels-Drxs9g13.cjs} +1 -1
  268. package/dist/coding-agent/index.cjs +1 -1
  269. package/dist/coding-agent/index.js +1 -1
  270. package/dist/{constants-B9ZDvXZ4.cjs → constants-Bou0hEgY.cjs} +4 -0
  271. package/dist/{constants-BmdTvEYN.js → constants-CFWgIaqA.js} +4 -0
  272. package/dist/datasets/experiment/scorer.d.ts +16 -5
  273. package/dist/datasets/index.cjs +2 -2
  274. package/dist/datasets/index.js +2 -2
  275. package/dist/docs/SKILL.md +1 -1
  276. package/dist/docs/assets/SOURCE_MAP.json +950 -950
  277. package/dist/docs/references/reference-knowledge-knowledge-tools.md +3 -3
  278. package/dist/evals/index.cjs +2 -2
  279. package/dist/evals/index.js +2 -2
  280. package/dist/evals/scoreTraces/index.cjs +2 -2
  281. package/dist/evals/scoreTraces/index.js +2 -2
  282. package/dist/harness/index.cjs +1 -1
  283. package/dist/harness/index.js +1 -1
  284. package/dist/index.cjs +1 -1
  285. package/dist/index.js +1 -1
  286. package/dist/knowledge/index.cjs +51 -16
  287. package/dist/knowledge/index.js +51 -16
  288. package/dist/knowledge/page-tools.d.ts +9 -0
  289. package/dist/knowledge/scope-runtime.d.ts +6 -0
  290. package/dist/llm/index.cjs +3 -3
  291. package/dist/llm/index.js +3 -3
  292. package/dist/llm/model/provider-types.generated.d.ts +8445 -8432
  293. package/dist/{llm-D6N-WJwo.cjs → llm-CbpBEabY.cjs} +2 -2
  294. package/dist/{llm-CsQOELh9.js → llm-D3y8qOKL.js} +2 -2
  295. package/dist/loop/index.cjs +2 -2
  296. package/dist/loop/index.js +2 -2
  297. package/dist/{manager-CtsjlKP7.cjs → manager-BOn6RJwA.cjs} +106 -35
  298. package/dist/{manager-DBVDNjO2.js → manager-elIuArZa.js} +106 -35
  299. package/dist/mastra/index.cjs +1 -1
  300. package/dist/mastra/index.js +1 -1
  301. package/dist/{mastra-B60fJsMe.cjs → mastra-CDQJWY6v.cjs} +16 -16
  302. package/dist/{mastra-Bkpe1lBu.js → mastra-DQjco6Bt.js} +16 -16
  303. package/dist/memory/index.cjs +2 -2
  304. package/dist/memory/index.js +2 -2
  305. package/dist/{model-Da_pawSI.js → model-BjyU1L4I.js} +1 -1
  306. package/dist/{model-CAbL0zRc.cjs → model-C4aI7k-i.cjs} +1 -1
  307. package/dist/{netlify-hasf5dLA.cjs → netlify-BjuUEMrL.cjs} +1 -1
  308. package/dist/{netlify-CW26UJrG.js → netlify-BpB7PtZV.js} +1 -1
  309. package/dist/notifications/index.cjs +1 -1
  310. package/dist/notifications/index.js +1 -1
  311. package/dist/processor-provider/index.cjs +1 -1
  312. package/dist/processor-provider/index.js +1 -1
  313. package/dist/processors/index.cjs +2 -2
  314. package/dist/processors/index.js +2 -2
  315. package/dist/{provider-registry-DnVkqIBw.js → provider-registry-BjdxtGZZ.js} +22165 -22131
  316. package/dist/{provider-registry-CeV5wjlF.cjs → provider-registry-bkFdaY45.cjs} +22165 -22131
  317. package/dist/provider-registry.json +22428 -22394
  318. package/dist/{registry-generator-G4PZCqrS.cjs → registry-generator-BORKO0_T.cjs} +1 -1
  319. package/dist/{registry-generator-DSR56u5H.js → registry-generator-CPF318Kc.js} +1 -1
  320. package/dist/{rehydrate-BLJ-q_V6.cjs → rehydrate-Cps4MTph.cjs} +2 -2
  321. package/dist/{rehydrate-zXo3Wo60.js → rehydrate-Cw2Id-Uz.js} +2 -2
  322. package/dist/relevance/index.cjs +2 -2
  323. package/dist/relevance/index.js +2 -2
  324. package/dist/{run-registry-oixTpWpa.cjs → run-registry-BTFPEkXT.cjs} +185 -36
  325. package/dist/{run-registry-Cl2QbXgN.js → run-registry-D5z2YVqJ.js} +174 -37
  326. package/dist/storage/constants.cjs +1 -1
  327. package/dist/storage/constants.js +1 -1
  328. package/dist/storage/domains/knowledge/base.d.ts +16 -1
  329. package/dist/storage/domains/knowledge/importers-inmemory.d.ts +1 -0
  330. package/dist/storage/domains/knowledge/importers.d.ts +8 -0
  331. package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
  332. package/dist/storage/domains/knowledge/pages-inmemory.d.ts +5 -1
  333. package/dist/storage/index.cjs +3 -3
  334. package/dist/storage/index.js +3 -3
  335. package/dist/storage/types.d.ts +8 -0
  336. package/dist/stream/index.cjs +2 -2
  337. package/dist/stream/index.js +2 -2
  338. package/dist/{stream-DaZh0apo.cjs → stream-D1OnBHDi.cjs} +1 -1
  339. package/dist/{stream-DUUfwH38.js → stream-DB5efioT.js} +1 -1
  340. package/dist/test-utils/llm-mock.cjs +1 -1
  341. package/dist/test-utils/llm-mock.js +1 -1
  342. package/dist/tool-loop-agent/index.cjs +1 -1
  343. package/dist/tool-loop-agent/index.js +1 -1
  344. package/dist/{tool-loop-agent-C4NvGYnM.js → tool-loop-agent-DkhFVx0h.js} +3 -3
  345. package/dist/{tool-loop-agent-DDowWQyO.cjs → tool-loop-agent-Ote8gJMn.cjs} +3 -3
  346. package/dist/{utils-CVN-336o.js → utils-BTKpGHA6.js} +1 -1
  347. package/dist/{utils-CmNJO2xP.cjs → utils-Dl_UFejV.cjs} +1 -1
  348. package/dist/utils.cjs +1 -1
  349. package/dist/utils.js +1 -1
  350. package/dist/{validate-CgNNzqgp.js → validate-D6fUqYGz.js} +1 -1
  351. package/dist/{validate-LpK3-p_O.cjs → validate-DdDuQRoZ.cjs} +1 -1
  352. package/dist/vector/index.cjs +1 -1
  353. package/dist/vector/index.js +1 -1
  354. package/dist/worker/index.cjs +1 -1
  355. package/dist/worker/index.js +1 -1
  356. package/dist/{worker-6qR81hZZ.cjs → worker-B27B9RlK.cjs} +2 -2
  357. package/dist/{worker-ChoZX7rg.js → worker-Bo_hTQJC.js} +2 -2
  358. package/dist/{worker-BdPUoHXa.js → worker-DC269pGx.js} +2 -2
  359. package/dist/{worker-BN2odJzu.cjs → worker-mq-oiLa5.cjs} +2 -2
  360. package/dist/{workflow-ww-N09bR.cjs → workflow-D61dV4AC.cjs} +3 -3
  361. package/dist/{workflow-D2MsV-JA.js → workflow-D97r3h2-.js} +3 -3
  362. package/dist/workflows/builder/index.cjs +1 -1
  363. package/dist/workflows/builder/index.js +1 -1
  364. package/dist/workflows/evented/index.cjs +1 -1
  365. package/dist/workflows/evented/index.js +1 -1
  366. package/dist/workflows/index.cjs +4 -4
  367. package/dist/workflows/index.js +4 -4
  368. package/package.json +10 -10
  369. package/src/llm/model/provider-types.generated.d.ts +8445 -8432
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BrhgMLW6.cjs");
2
- const require_netlify = require("./netlify-hasf5dLA.cjs");
2
+ const require_netlify = require("./netlify-BjuUEMrL.cjs");
3
3
  let path = require("path");
4
4
  path = require_rolldown_runtime.__toESM(path, 1);
5
5
  let fs_promises = require("fs/promises");
@@ -1,4 +1,4 @@
1
- import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-CW26UJrG.js";
1
+ import { _ as getCapabilityFileName, g as shouldEnableGateway, m as getGatewayId } from "./netlify-BpB7PtZV.js";
2
2
  import path from "path";
3
3
  import fs from "fs/promises";
4
4
  // src/llm/model/registry-generator.ts
@@ -1,6 +1,6 @@
1
- const require_run_registry = require("./run-registry-oixTpWpa.cjs");
1
+ const require_run_registry = require("./run-registry-BTFPEkXT.cjs");
2
2
  const require_predicate_index = require("./predicate/index.cjs");
3
- const require_validate = require("./validate-LpK3-p_O.cjs");
3
+ const require_validate = require("./validate-DdDuQRoZ.cjs");
4
4
  let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
5
5
  // src/workflows/dynamic/serialize.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { Cc as predicateToCondition, Fs as cloneWorkflow, Gc as createStepFromTool, Is as createEventedWorkflow, Ls as createWorkflow, Sc as mapVariable, Uc as createStepFromAgent, al as getSingleStepEntryId } from "./run-registry-Cl2QbXgN.js";
1
+ import { Fs as cloneWorkflow, Gc as createStepFromAgent, Is as createEventedWorkflow, Ls as createWorkflow, Tc as predicateToCondition, qc as createStepFromTool, sl as getSingleStepEntryId, wc as mapVariable } from "./run-registry-D5z2YVqJ.js";
2
2
  import { derivePredicateLabel } from "./predicate/index.js";
3
- import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-CgNNzqgp.js";
3
+ import { a as jsonSchemaToZod, l as parseMapConfig } from "./validate-D6fUqYGz.js";
4
4
  import { standardSchemaToJSONSchema, toStandardSchema } from "./schema/index.js";
5
5
  // src/workflows/dynamic/serialize.ts
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_run_registry = require("../run-registry-oixTpWpa.cjs");
3
- const require_stream = require("../stream-DaZh0apo.cjs");
2
+ const require_run_registry = require("../run-registry-BTFPEkXT.cjs");
3
+ const require_stream = require("../stream-D1OnBHDi.cjs");
4
4
  // src/relevance/relevance-score-provider.ts
5
5
  function createSimilarityPrompt(query, text) {
6
6
  return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
@@ -1,5 +1,5 @@
1
- import { P as Agent } from "../run-registry-Cl2QbXgN.js";
2
- import { ln as isSupportedLanguageModel } from "../stream-DUUfwH38.js";
1
+ import { P as Agent } from "../run-registry-D5z2YVqJ.js";
2
+ import { ln as isSupportedLanguageModel } from "../stream-DB5efioT.js";
3
3
  // src/relevance/relevance-score-provider.ts
4
4
  function createSimilarityPrompt(query, text) {
5
5
  return `Rate the semantic similarity between the following the query and the text on a scale from 0 to 1 (decimals allowed), where 1 means exactly the same meaning and 0 means completely different:
@@ -4,14 +4,14 @@ const require_base = require("./base-BIzR1D3_.cjs");
4
4
  const require_observability = require("./observability-B0R_D1PZ.cjs");
5
5
  const require_error = require("./error-D90lJ6M7.cjs");
6
6
  const require_error$1 = require("./error-L1V4uUbd.cjs");
7
- const require_stream = require("./stream-DaZh0apo.cjs");
7
+ const require_stream = require("./stream-D1OnBHDi.cjs");
8
8
  const require_request_context = require("./request-context-D9RXYCy8.cjs");
9
9
  const require_output_helpers = require("./output-helpers-DgsH4aTb.cjs");
10
10
  const require_message_list = require("./message-list-vR3uLAHL.cjs");
11
11
  const require_storage = require("./storage-CfG0I2aF.cjs");
12
12
  const require_utils = require("./utils-D-eNsgDM.cjs");
13
13
  const require_error_count = require("./error-count-DeDpeWU2.cjs");
14
- const require_llm = require("./llm-D6N-WJwo.cjs");
14
+ const require_llm = require("./llm-CbpBEabY.cjs");
15
15
  const require_payload_transform = require("./payload-transform-CWgnsO9w.cjs");
16
16
  const require_utils_safe_stringify = require("./utils/safe-stringify.cjs");
17
17
  const require_signals = require("./signals-CWxAMEmE.cjs");
@@ -23,13 +23,13 @@ const require_tool = require("./tool-CYlT2UA-.cjs");
23
23
  const require_toolchecks = require("./toolchecks-MFU48cit.cjs");
24
24
  const require_fetchWithRetry = require("./fetchWithRetry-f5k4p7_1.cjs");
25
25
  const require_model = require("./model-jBymoqGa.cjs");
26
- const require_provider_registry = require("./provider-registry-CeV5wjlF.cjs");
26
+ const require_provider_registry = require("./provider-registry-bkFdaY45.cjs");
27
27
  const require_inmemory = require("./inmemory-Dc86VWGB.cjs");
28
28
  const require_dynamic_argument = require("./dynamic-argument-CUc1BBOS.cjs");
29
- const require_model$1 = require("./model-CAbL0zRc.cjs");
30
- const require_utils$1 = require("./utils-CmNJO2xP.cjs");
29
+ const require_model$1 = require("./model-C4aI7k-i.cjs");
30
+ const require_utils$1 = require("./utils-Dl_UFejV.cjs");
31
31
  const require_ee_iTj2bRDt = require("./ee-iTj2bRDt-D3-QLGDF.cjs");
32
- const require_background_tasks = require("./background-tasks-FOaQ1LsS.cjs");
32
+ const require_background_tasks = require("./background-tasks-B40g_Guf.cjs");
33
33
  const require_stream$1 = require("./stream-BGbj9jAU.cjs");
34
34
  const require_predicate_index = require("./predicate/index.cjs");
35
35
  const require_classifier_index = require("./classifier/index.cjs");
@@ -38,7 +38,7 @@ const require_workflows_constants = require("./workflows/constants.cjs");
38
38
  const require_hooks = require("./hooks-D7VDBETj.cjs");
39
39
  const require_schedules = require("./schedules-BZS8McF7.cjs");
40
40
  const require_state_processor = require("./state-processor-kRNZ38Nf.cjs");
41
- const require_constants = require("./constants-B9ZDvXZ4.cjs");
41
+ const require_constants = require("./constants-Bou0hEgY.cjs");
42
42
  const require_signal_provider = require("./signal-provider-BFAvh_AJ.cjs");
43
43
  const require_slugify = require("./slugify-B_WzG9IY.cjs");
44
44
  const require_workspace = require("./workspace-Pv3J8K0c.cjs");
@@ -11714,6 +11714,21 @@ function warnUnsupportedEventedSetup(mastra, workflowsStore) {
11714
11714
  warnedHosts.add(mastra);
11715
11715
  mastra.getLogger()?.warn(`Evented workflows and agents aren't supported on several processes with this setup: ${missing}. See ${DOCS_URL}`);
11716
11716
  }
11717
+ // src/agent-controller/worker-run-binding.ts
11718
+ const CONTROLLER_RUN_BINDING_KEY = "mastra__controllerRunBinding";
11719
+ const controllerRunBindingSchema = zod_v4.z.object({
11720
+ controllerId: zod_v4.z.string().min(1),
11721
+ agentId: zod_v4.z.string().min(1),
11722
+ sessionId: zod_v4.z.string().min(1),
11723
+ ownerId: zod_v4.z.string(),
11724
+ resourceId: zod_v4.z.string().min(1),
11725
+ threadId: zod_v4.z.string().min(1),
11726
+ modeId: zod_v4.z.string().min(1)
11727
+ });
11728
+ const restoredWorkerControllerContexts = /* @__PURE__ */ new WeakSet();
11729
+ function isRestoredWorkerControllerContext(value) {
11730
+ return typeof value === "object" && value !== null && restoredWorkerControllerContexts.has(value);
11731
+ }
11717
11732
  // src/agent/scopes.ts
11718
11733
  /**
11719
11734
  * Scope types Memory reads as the run's identity. Every other scope type is
@@ -12029,6 +12044,8 @@ function restoreRequestContext(entries, runLevel, liveRunContext) {
12029
12044
  if (liveRunContext) return liveRunContext;
12030
12045
  if (entries) {
12031
12046
  const restored = new require_request_context.RequestContext([...Object.entries(require_request_context.withoutLiveRequestKeys(entries)), ...liveRequestEntries(runLevel)]);
12047
+ const controller = runLevel?.get("controller");
12048
+ if (isRestoredWorkerControllerContext(controller)) restored.set("controller", controller);
12032
12049
  restoreRunAgentScopes(restored);
12033
12050
  return restored;
12034
12051
  }
@@ -15492,7 +15509,8 @@ var StepExecutor = class extends require_base.MastraBase {
15492
15509
  return require_stream.storageV2StepResultAccessors((step) => require_stream.getHydratedStepResult(stepResults, step, hydrate));
15493
15510
  }
15494
15511
  async execute(params) {
15495
- const { entry, stepResults, runId, requestContext, retryCount = 0, perStep } = params;
15512
+ const { entry, stepResults, runId, retryCount = 0, perStep } = params;
15513
+ let { requestContext } = params;
15496
15514
  const stepId = getEntryId(entry);
15497
15515
  const errorAttemptId = `${runId}:${stepId}:${params.foreachIdx ?? ""}:attempt:${retryCount}`;
15498
15516
  const schemas = getEntrySchemas(entry, this.mastra);
@@ -15548,6 +15566,18 @@ var StepExecutor = class extends require_base.MastraBase {
15548
15566
  const stepTracingContext = workflowStepSpan ? { currentSpan: workflowStepSpan } : params.tracingContext ?? {};
15549
15567
  try {
15550
15568
  if (validationError) throw validationError;
15569
+ if (params.workflowId === DurableStepIds.AGENTIC_LOOP || params.workflowId === DurableStepIds.AGENTIC_EXECUTION) {
15570
+ const live = requestContext.get("controller");
15571
+ const initial = stepResults.input;
15572
+ const binding = initial?.requestContextEntries?.[CONTROLLER_RUN_BINDING_KEY];
15573
+ if (initial && binding !== void 0 && typeof live?.getState !== "function") {
15574
+ const parsed = controllerRunBindingSchema.parse(binding);
15575
+ if (initial.agentId !== parsed.agentId || initial.state?.threadId !== parsed.threadId || initial.state.resourceId !== parsed.resourceId) throw new Error("Controller binding does not match this durable run");
15576
+ const controller = this.mastra?.getAgentControllerById(parsed.controllerId);
15577
+ if (!controller) throw new Error("Controller is not registered on this worker");
15578
+ requestContext = await controller.__restoreWorkerRequestContext(requestContext, parsed, abortController.signal, initial.runId);
15579
+ }
15580
+ }
15551
15581
  const callId = globalThis.crypto.randomUUID();
15552
15582
  const outputWriter = this.createOutputWriter(runId);
15553
15583
  const stepOutput = await require_utils.executeWithContext({
@@ -38737,6 +38767,7 @@ var ExperimentsInMemory = class extends ExperimentsStorage {
38737
38767
  targetType: input.targetType ?? null,
38738
38768
  targetId: input.targetId ?? null,
38739
38769
  scorerIds: input.scorerIds ?? null,
38770
+ scorerVersions: input.scorerVersions ?? null,
38740
38771
  name: input.name,
38741
38772
  description: input.description,
38742
38773
  metadata: input.metadata,
@@ -39643,6 +39674,31 @@ var KnowledgeStorage = class extends require_filesystem_versioned.StorageDomain
39643
39674
  getPages(_input) {
39644
39675
  return Promise.reject(new KnowledgeUnsupportedCapabilityError("getPages"));
39645
39676
  }
39677
+ /**
39678
+ * The page `parentId` and its ancestors, nearest first: for each row what {@link getPage} would
39679
+ * return with the same `read`, deleted rows included. Stops after the first scope page, before
39680
+ * the first row `getPage` would return null for, or after {@link MAX_KNOWLEDGE_PAGE_DEPTH} + 1
39681
+ * rows. Lets a caller holding a page walk its parents in one call instead of one per level.
39682
+ *
39683
+ * The base class reads one {@link getPage} per level; adapters that can read the chain in one
39684
+ * query override it.
39685
+ *
39686
+ * @experimental
39687
+ */
39688
+ async getPageParents(input) {
39689
+ const parents = [];
39690
+ let id = input.parentId;
39691
+ while (id && parents.length <= 10) {
39692
+ const page = await this.getPage({
39693
+ id,
39694
+ read: input.read
39695
+ });
39696
+ if (!page) break;
39697
+ parents.push(page);
39698
+ id = page.isScope ? null : page.parentId;
39699
+ }
39700
+ return parents;
39701
+ }
39646
39702
  getPageByPath(_input) {
39647
39703
  return Promise.reject(new KnowledgeUnsupportedCapabilityError("getPageByPath"));
39648
39704
  }
@@ -39960,6 +40016,12 @@ var InMemoryKnowledgeImportersStorage = class extends KnowledgeImportersStorage
39960
40016
  const node = this.#s.nodes.get(key(bindingId, sourceId));
39961
40017
  return node ? structuredClone(node) : null;
39962
40018
  }
40019
+ async getNodes(bindingId, sourceIds) {
40020
+ return [...new Set(sourceIds)].flatMap((sourceId) => {
40021
+ const node = this.#s.nodes.get(key(bindingId, sourceId));
40022
+ return node ? [structuredClone(node)] : [];
40023
+ });
40024
+ }
39963
40025
  async getNodeByPage(pageId) {
39964
40026
  const node = [...this.#s.nodes.values()].find((n) => n.pageId === pageId);
39965
40027
  return node ? structuredClone(node) : null;
@@ -40350,6 +40412,15 @@ var InMemoryKnowledgePageStore = class {
40350
40412
  const page = this.#pages.get(input.id);
40351
40413
  return page && this.#pageReadable(page, input.read) ? clone$1(page) : null;
40352
40414
  }
40415
+ async getPageParents(input) {
40416
+ const parents = [];
40417
+ let page = this.#pages.get(input.parentId);
40418
+ while (page && this.#pageReadable(page, input.read) && parents.length <= 10) {
40419
+ parents.push(clone$1(page));
40420
+ page = page.isScope || !page.parentId ? void 0 : this.#pages.get(page.parentId);
40421
+ }
40422
+ return parents;
40423
+ }
40353
40424
  async getPages(input) {
40354
40425
  return [...new Set(input.ids)].map((id) => this.#pages.get(id)).filter((page) => !!page && !page.deletedAt && this.#pageReadable(page, input.read)).map(clone$1);
40355
40426
  }
@@ -40857,6 +40928,9 @@ var InMemoryKnowledgeStorage = class extends KnowledgeStorage {
40857
40928
  getPage(input) {
40858
40929
  return this.#pageStore.getPage(input);
40859
40930
  }
40931
+ getPageParents(input) {
40932
+ return this.#pageStore.getPageParents(input);
40933
+ }
40860
40934
  listScopeDeclarations() {
40861
40935
  return this.#pageStore.listScopeDeclarations();
40862
40936
  }
@@ -53499,17 +53573,19 @@ async function pageRefKeys(storage, page) {
53499
53573
  if (page.address) keys.push(knowledgeLinkRefKey(page.address));
53500
53574
  return keys;
53501
53575
  }
53576
+ if (!page.key || !page.parentId) return keys;
53502
53577
  const path = [];
53503
- let current = page;
53504
- while (current && !current.isScope) {
53578
+ for (const current of [page, ...await storage.getPageParents({
53579
+ parentId: page.parentId,
53580
+ read: "all"
53581
+ })]) {
53582
+ if (current.isScope) {
53583
+ if (current.address) keys.push(knowledgeLinkRefKey(`${current.address}#${path.join("/")}`));
53584
+ return keys;
53585
+ }
53505
53586
  if (!current.key || !current.parentId) return keys;
53506
53587
  path.unshift(current.key);
53507
- current = await storage.getPage({
53508
- id: current.parentId,
53509
- read: "all"
53510
- });
53511
53588
  }
53512
- if (current?.address) keys.push(knowledgeLinkRefKey(`${current.address}#${path.join("/")}`));
53513
53589
  return keys;
53514
53590
  }
53515
53591
  /** The page and its live ordinary descendants, at most {@link MAX_KNOWLEDGE_MOVE_PAGES} + 1. */
@@ -63537,6 +63613,30 @@ async function noteSummaries(run, notes, cache = /* @__PURE__ */ new Map()) {
63537
63613
  for (const note of notes) summaries.push(noteSummary(note, await noteMentions(run, note, cache)));
63538
63614
  return summaries;
63539
63615
  }
63616
+ /**
63617
+ * Every scope the run holds, in principal order, with its role and what it can do there. A held scope
63618
+ * gets its page on the first write, so before that its role comes from the declarations and the parent
63619
+ * that write would link it under: without it a model sees no scopes on its first turn and concludes it
63620
+ * has nowhere to write. A stored scope it can't read keeps only its address.
63621
+ */
63622
+ async function heldScopes(run) {
63623
+ const stored = await run.storage.getScopesByAddress(run.principals);
63624
+ return Promise.all(run.principals.map(async (address) => {
63625
+ const found = stored.find((scope) => scope.address === address);
63626
+ const page = found && knowledgeScopeReadable(found, run.read) ? found : void 0;
63627
+ const role = found ? await run.roleOn(found) : knowledgeRoleOn(run.runtime.compiled, run.principals, {
63628
+ address,
63629
+ parentAddress: run.runtime.firstWriteParentAddress(address, run.principals)
63630
+ });
63631
+ const can = !role ? "none" : knowledgeRoleAtLeast(role, "contributor") ? "write" : "read";
63632
+ return {
63633
+ address,
63634
+ ...page ? { page } : {},
63635
+ role,
63636
+ can
63637
+ };
63638
+ }));
63639
+ }
63540
63640
  /** Scope pages for addresses the run names; each must be readable. */
63541
63641
  async function readableScopes(run, addresses) {
63542
63642
  const page = addresses.find((address) => address.includes("#"));
@@ -63817,7 +63917,7 @@ function bodyView(body, input) {
63817
63917
  function readTool(host, canEdit) {
63818
63918
  return require_tool.createTool({
63819
63919
  id: "knowledge_read",
63820
- description: `Read a page: its body, its notes, its child pages and the notes on other pages that mention it. Read a scope address (org:acme) to browse that scope. Without \`page\`, lists the scopes this run holds. When a page's notes, or the notes mentioning it, come to more than ${KNOWLEDGE_READ_INLINE_TOKENS.toLocaleString("en-US")} tokens, a whole read leaves them out and counts them in \`more\`; read them on their own with \`notes\` or \`mentionedIn\`. A body returns at most ${maxTokensOf(host).toLocaleString("en-US")} tokens at a time. A body that fits comes whole as \`body\`; a longer one comes as numbered \`lines\` (\`12\u2502text\`) with the \`range\` they cover, and \`more\` says where to read on; a first read of a long page shows every heading with its line number and the first lines under it, so you can pick the part to read. For a long page, ask for its \`outline\` of headings with their line numbers, read one \`section\`, or \`match\` terms to see only the lines that contain them, with \`context\` lines around each. Those part reads return just that part of the body.` + (canEdit ? " To edit part of a long body, pass the `range` a read gave you to knowledge_page." : ""),
63920
+ description: `Read a page: its body, its notes, its child pages and the notes on other pages that mention it. Read a scope address (org:acme) to browse that scope. Without \`page\`, lists every scope this run holds, with its role and whether it can read or write there, including scopes with no page this run can read yet (\`empty\`). When a page's notes, or the notes mentioning it, come to more than ${KNOWLEDGE_READ_INLINE_TOKENS.toLocaleString("en-US")} tokens, a whole read leaves them out and counts them in \`more\`; read them on their own with \`notes\` or \`mentionedIn\`. A body returns at most ${maxTokensOf(host).toLocaleString("en-US")} tokens at a time. A body that fits comes whole as \`body\`; a longer one comes as numbered \`lines\` (\`12\u2502text\`) with the \`range\` they cover, and \`more\` says where to read on; a first read of a long page shows every heading with its line number and the first lines under it, so you can pick the part to read. For a long page, ask for its \`outline\` of headings with their line numbers, read one \`section\`, or \`match\` terms to see only the lines that contain them, with \`context\` lines around each. Those part reads return just that part of the body.` + (canEdit ? " To edit part of a long body, pass the `range` a read gave you to knowledge_page." : ""),
63821
63921
  inputSchema: {
63822
63922
  type: "object",
63823
63923
  properties: {
@@ -63899,10 +63999,13 @@ function readTool(host, canEdit) {
63899
63999
  if (outline && from) throw new Error("knowledge_read: an outline covers the whole body; pass it without from.");
63900
64000
  const run = await start(host, context);
63901
64001
  const limit = limitOf(requested);
63902
- if (!ref) return { scopes: (await run.storage.getScopesByAddress(run.principals)).filter((scope) => knowledgeScopeReadable(scope, run.read)).map((scope) => ({
63903
- address: scope.address,
63904
- name: scope.name,
63905
- ...scope.description ? { description: scope.description } : {}
64002
+ if (!ref) return { scopes: (await heldScopes(run)).map(({ address, page, role, can }) => ({
64003
+ address,
64004
+ name: page?.name ?? address,
64005
+ ...page?.description ? { description: page.description } : {},
64006
+ ...role ? { role } : {},
64007
+ can,
64008
+ ...page ? {} : { empty: true }
63906
64009
  })) };
63907
64010
  const page = await run.pageOrCloseMatches(ref);
63908
64011
  if (outline || section || match || from) {
@@ -64116,12 +64219,13 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
64116
64219
  let scopes = [];
64117
64220
  if (!origin) {
64118
64221
  if (cursor?.startsWith("p")) throw new Error("knowledge_list: a page cursor needs the `from` it came from.");
64119
- const held = await run.storage.getScopesByAddress(run.principals);
64120
- const order = (scope) => run.principals.indexOf(scope.address ?? "");
64121
- scopes = held.filter((scope) => knowledgeScopeReadable(scope, run.read)).sort((a, b) => order(a) - order(b));
64222
+ scopes = (await heldScopes(run)).map((held) => ({
64223
+ ...held.page ? { page: held.page } : {},
64224
+ held
64225
+ }));
64122
64226
  } else {
64123
64227
  originRef = (await pageRefs(run, [origin])).refs.get(origin.id) ?? origin.id;
64124
- if (origin.isScope && !cursor?.startsWith("p")) scopes = await childScopes(origin.id);
64228
+ if (origin.isScope && !cursor?.startsWith("p")) scopes = (await childScopes(origin.id)).map((page) => ({ page }));
64125
64229
  }
64126
64230
  const shownScopes = scopes.slice(scopeOffset, scopeOffset + limit);
64127
64231
  let roots = shownScopes;
@@ -64131,7 +64235,7 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
64131
64235
  const room = limit - shownScopes.length;
64132
64236
  if (room > 0) {
64133
64237
  const pages = await childPages(origin.id, room, pageCursor);
64134
- roots = [...shownScopes, ...pages.pages];
64238
+ roots = [...shownScopes, ...pages.pages.map((page) => ({ page }))];
64135
64239
  if (pages.nextCursor) nextCursor = `p${pages.nextCursor}`;
64136
64240
  } else if ((await run.storage.countChildPages({
64137
64241
  parentIds: [origin.id],
@@ -64145,10 +64249,19 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
64145
64249
  children: 0,
64146
64250
  below: []
64147
64251
  });
64148
- const top = roots.map((page) => nodeOf(page, origin && originRef ? childRef(origin, originRef, page) : page.address ?? page.id, 1));
64252
+ const top = roots.map(({ page, held }) => page ? {
64253
+ ...nodeOf(page, origin && originRef ? childRef(origin, originRef, page) : page.address ?? page.id, 1),
64254
+ ...held ? { held } : {}
64255
+ } : {
64256
+ held,
64257
+ ref: held.address,
64258
+ depth: 1,
64259
+ children: 0,
64260
+ below: []
64261
+ });
64149
64262
  let budget = Math.max(limit - top.length, 0);
64150
64263
  let truncated = false;
64151
- let level = top;
64264
+ let level = top.filter((node) => node.page);
64152
64265
  for (let current = 1; current <= depth && level.length; current++) {
64153
64266
  const parentIds = level.map((node) => node.page.id);
64154
64267
  const scopeParents = level.filter((node) => node.page.isScope).map((node) => node.page.id);
@@ -64172,22 +64285,30 @@ async function listKnowledgeTree(run, { origin, depth, limit, cursor, descriptio
64172
64285
  budget -= scopes.length;
64173
64286
  const pages = budget > 0 ? (await childPages(node.page.id, budget)).pages : [];
64174
64287
  budget -= pages.length;
64175
- node.below = [...scopes, ...pages].map((child) => nodeOf(child, childRef(node.page, node.ref, child), current + 1));
64176
- if (node.below.length < node.children) truncated = true;
64177
- nextLevel.push(...node.below);
64288
+ const below = [...scopes, ...pages].map((child) => ({
64289
+ ...nodeOf(child, childRef(node.page, node.ref, child), current + 1),
64290
+ page: child
64291
+ }));
64292
+ node.below = below;
64293
+ if (below.length < node.children) truncated = true;
64294
+ nextLevel.push(...below);
64178
64295
  }
64179
64296
  level = nextLevel;
64180
64297
  }
64181
64298
  const entries = [];
64182
64299
  const flatten = (nodes) => {
64183
64300
  for (const node of nodes) {
64301
+ const { page, held } = node;
64184
64302
  entries.push({
64185
64303
  ref: node.ref,
64186
- name: node.page.name,
64187
- ...descriptions && node.page.description ? { description: node.page.description } : {},
64304
+ name: page?.name ?? node.ref,
64305
+ ...descriptions && page?.description ? { description: page.description } : {},
64188
64306
  depth: node.depth,
64189
64307
  children: node.children,
64190
- ...node.page.isScope ? { scope: true } : {}
64308
+ ...!page || page.isScope ? { scope: true } : {},
64309
+ ...held?.role ? { role: held.role } : {},
64310
+ ...held ? { can: held.can } : {},
64311
+ ...page ? {} : { empty: true }
64191
64312
  });
64192
64313
  flatten(node.below);
64193
64314
  }
@@ -64204,7 +64325,7 @@ function listTool(host) {
64204
64325
  const maxTokens = maxTokensOf(host);
64205
64326
  return require_tool.createTool({
64206
64327
  id: "knowledge_list",
64207
- description: `List the page tree under a starting point: each child with its ref (pass it to knowledge_read or knowledge_list), name and how many children it has. Pass \`descriptions: true\` to include page descriptions too. Without \`from\`, lists the scopes this run can read. Use it to find your way around a scope before searching or reading. One result holds at most \`limit\` entries and about ${maxTokens.toLocaleString("en-US")} tokens of them; when it stops early, \`more\` says how many entries were left out and gives the \`cursor\` to list the rest (pass the same \`from\`).`,
64328
+ description: `List the page tree under a starting point: each child with its ref (pass it to knowledge_read or knowledge_list), name and how many children it has. Pass \`descriptions: true\` to include page descriptions too. Without \`from\`, lists every scope this run holds, with its role and whether it can read or write there, including scopes with no page this run can read yet (\`empty\`). Use it to find your way around a scope before searching or reading. One result holds at most \`limit\` entries and about ${maxTokens.toLocaleString("en-US")} tokens of them; when it stops early, \`more\` says how many entries were left out and gives the \`cursor\` to list the rest (pass the same \`from\`).`,
64208
64329
  inputSchema: {
64209
64330
  type: "object",
64210
64331
  properties: {
@@ -73704,6 +73825,15 @@ function recordRunSavedMessages(runId) {
73704
73825
  };
73705
73826
  }
73706
73827
  // src/agent/durable/utils/resolve-runtime.ts
73828
+ async function restoreWorkerToolsets(mastra, context, names) {
73829
+ const controller = context.get("controller");
73830
+ if (!isRestoredWorkerControllerContext(controller) || !names?.length) return;
73831
+ const toolsets = await mastra.getAgentControllerById(controller.controllerId)?.__restoreWorkerToolsets(context);
73832
+ if (!toolsets) return;
73833
+ const allowed = new Set(names);
73834
+ for (const [key, tools] of Object.entries(toolsets)) if (tools) toolsets[key] = Object.fromEntries(Object.entries(tools).filter(([name]) => allowed.has(name)));
73835
+ return toolsets;
73836
+ }
73707
73837
  /**
73708
73838
  * Build a SaveQueueManager for a run's memory, or `undefined` when no memory
73709
73839
  * is configured. Shared by `resolveRuntimeDependencies` and
@@ -73866,6 +73996,7 @@ async function resolveRuntimeDependencies(options) {
73866
73996
  backgroundTasks = resolveBackgroundTasks(mastra, agent, input.options);
73867
73997
  tools = await agent.getToolsForExecution({
73868
73998
  runId,
73999
+ toolsets: await restoreWorkerToolsets(mastra, resolveRequestContext, input.options?.toolsetToolNames),
73869
74000
  threadId: input.state.threadId,
73870
74001
  resourceId: input.state.resourceId,
73871
74002
  requestContext: resolveRequestContext,
@@ -73987,6 +74118,7 @@ async function rebuildRunToolsFromMastra(options) {
73987
74118
  const backgroundTasks = resolveBackgroundTasks(mastra, agent, execOptions);
73988
74119
  const tools = await agent.getToolsForExecution({
73989
74120
  runId,
74121
+ toolsets: await restoreWorkerToolsets(mastra, resolveRequestContext, execOptions?.toolsetToolNames),
73990
74122
  threadId: state.threadId,
73991
74123
  resourceId: state.resourceId,
73992
74124
  requestContext: resolveRequestContext,
@@ -74456,7 +74588,11 @@ function mergeRequestContextForFinalization(entries, fallback, liveRunContext) {
74456
74588
  if (liveRunContext) return liveRunContext;
74457
74589
  if (!entries) return fallback ?? new require_request_context.RequestContext();
74458
74590
  const restored = new require_request_context.RequestContext(fallback?.entries());
74459
- for (const [key, value] of Object.entries(require_request_context.withoutLiveRequestKeys(entries))) restored.set(key, value);
74591
+ const controller = fallback?.get("controller");
74592
+ for (const [key, value] of Object.entries(require_request_context.withoutLiveRequestKeys(entries))) {
74593
+ if (key === "controller" && isRestoredWorkerControllerContext(controller)) continue;
74594
+ restored.set(key, value);
74595
+ }
74460
74596
  restoreRunAgentScopes(restored);
74461
74597
  return restored;
74462
74598
  }
@@ -74497,6 +74633,7 @@ async function runDurableFinishSideEffects({ runId, initData, messageListState,
74497
74633
  ...initData,
74498
74634
  messageListState
74499
74635
  },
74636
+ requestContext,
74500
74637
  logger: effectiveLogger
74501
74638
  });
74502
74639
  rebuiltSaveQueueManager = resolved.saveQueueManager;
@@ -84185,7 +84322,7 @@ async function prepareForDurableExecution(options) {
84185
84322
  });
84186
84323
  let tripwireData;
84187
84324
  if (inputProcessors.length > 0) try {
84188
- const { ProcessorRunner } = await Promise.resolve().then(() => require("./stream-DaZh0apo.cjs")).then((n) => n.runner_exports);
84325
+ const { ProcessorRunner } = await Promise.resolve().then(() => require("./stream-D1OnBHDi.cjs")).then((n) => n.runner_exports);
84189
84326
  await new ProcessorRunner({
84190
84327
  inputProcessors,
84191
84328
  outputProcessors,
@@ -110939,6 +111076,12 @@ Object.defineProperty(exports, "CONTINUE_RUN_MESSAGE", {
110939
111076
  return CONTINUE_RUN_MESSAGE;
110940
111077
  }
110941
111078
  });
111079
+ Object.defineProperty(exports, "CONTROLLER_RUN_BINDING_KEY", {
111080
+ enumerable: true,
111081
+ get: function() {
111082
+ return CONTROLLER_RUN_BINDING_KEY;
111083
+ }
111084
+ });
110942
111085
  Object.defineProperty(exports, "ChannelSessionRejectedError", {
110943
111086
  enumerable: true,
110944
111087
  get: function() {
@@ -113687,6 +113830,12 @@ Object.defineProperty(exports, "resolveWaitUntil", {
113687
113830
  return resolveWaitUntil;
113688
113831
  }
113689
113832
  });
113833
+ Object.defineProperty(exports, "restoredWorkerControllerContexts", {
113834
+ enumerable: true,
113835
+ get: function() {
113836
+ return restoredWorkerControllerContexts;
113837
+ }
113838
+ });
113690
113839
  Object.defineProperty(exports, "retentionCutoffMs", {
113691
113840
  enumerable: true,
113692
113841
  get: function() {