@mastra/core 1.87.0-alpha.17 → 1.87.0-alpha.19

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 (486) hide show
  1. package/dist/_types/@internal_ai-v6@0.0.99/dist/index.d.ts +2075 -123
  2. package/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +30 -3
  3. package/dist/agent/agent.d.ts +2 -4
  4. package/dist/agent/agent.types.d.ts +1 -0
  5. package/dist/agent/durable/index.cjs +86 -86
  6. package/dist/agent/durable/index.js +2 -2
  7. package/dist/agent/durable/run-registry.d.ts +54 -25
  8. package/dist/agent/index.cjs +16 -16
  9. package/dist/agent/index.d.ts +1 -0
  10. package/dist/agent/index.js +3 -3
  11. package/dist/agent/scopes.d.ts +8 -0
  12. package/dist/agent/types.d.ts +1 -0
  13. package/dist/agent-builder/ee/index.cjs +1 -1
  14. package/dist/agent-builder/ee/index.js +1 -1
  15. package/dist/agent-controller/agent-controller.d.ts +8 -1
  16. package/dist/agent-controller/index.cjs +3 -3
  17. package/dist/agent-controller/index.js +3 -3
  18. package/dist/agent-controller/session.d.ts +16 -0
  19. package/dist/{agent-controller-cqcUP-xy.cjs → agent-controller-DzOEhUjR.cjs} +55 -35
  20. package/dist/{agent-controller-ChZ3qcXE.js → agent-controller-lBdNfcFi.js} +31 -11
  21. package/dist/{agent-skills-resolver-BMoCDoaK.cjs → agent-skills-resolver-2d8k7ioj.cjs} +134 -109
  22. package/dist/{agent-skills-resolver-CUEIMDbx.js → agent-skills-resolver-D2HktP6Y.js} +134 -109
  23. package/dist/background-tasks/index.cjs +1 -1
  24. package/dist/background-tasks/index.js +1 -1
  25. package/dist/{background-tasks-CH_gzJwc.js → background-tasks-DAu4WaCb.js} +1 -1
  26. package/dist/{background-tasks-BIk1TRPw.cjs → background-tasks-DOmQdBVn.cjs} +1 -1
  27. package/dist/browser/index.cjs +4 -4
  28. package/dist/browser/index.js +4 -4
  29. package/dist/{builder-ZAUhFqtD.cjs → builder-BFcVEbX0.cjs} +3 -3
  30. package/dist/{builder-v01k8_0x.js → builder-DHFtMW8D.js} +2 -2
  31. package/dist/capabilities/302ai.json +198 -198
  32. package/dist/capabilities/abacus.json +2 -96
  33. package/dist/capabilities/abliteratedllm.json +36 -36
  34. package/dist/capabilities/abliteration-ai.json +11 -11
  35. package/dist/capabilities/above.json +19 -19
  36. package/dist/capabilities/adaption.json +11 -11
  37. package/dist/capabilities/adzuki.json +32 -32
  38. package/dist/capabilities/agentrouter.json +12 -12
  39. package/dist/capabilities/agnes.json +4 -4
  40. package/dist/capabilities/ai-router.json +5 -5
  41. package/dist/capabilities/aiand.json +25 -25
  42. package/dist/capabilities/aigrow.json +13 -13
  43. package/dist/capabilities/aimlapi.json +144 -144
  44. package/dist/capabilities/aipg.json +2 -2
  45. package/dist/capabilities/aixy.json +24 -24
  46. package/dist/capabilities/aki-io.json +12 -12
  47. package/dist/capabilities/alibaba-cn.json +81 -126
  48. package/dist/capabilities/alibaba-coding-plan-cn.json +4 -4
  49. package/dist/capabilities/alibaba-coding-plan.json +4 -4
  50. package/dist/capabilities/alibaba-token-plan-cn.json +57 -53
  51. package/dist/capabilities/alibaba-token-plan.json +57 -53
  52. package/dist/capabilities/alibaba.json +76 -71
  53. package/dist/capabilities/ambient.json +14 -32
  54. package/dist/capabilities/amd-tokenlab.json +41 -0
  55. package/dist/capabilities/amd.json +8 -8
  56. package/dist/capabilities/anthropic.json +32 -56
  57. package/dist/capabilities/anyapi.json +47 -47
  58. package/dist/capabilities/apiko.json +5 -5
  59. package/dist/capabilities/arcee.json +5 -5
  60. package/dist/capabilities/augure.json +4 -4
  61. package/dist/capabilities/auriko.json +15 -15
  62. package/dist/capabilities/bailing.json +3 -3
  63. package/dist/capabilities/baseten.json +35 -35
  64. package/dist/capabilities/bee.json +5 -5
  65. package/dist/capabilities/berget.json +2 -35
  66. package/dist/capabilities/bothub.json +14 -14
  67. package/dist/capabilities/boundless.json +39 -39
  68. package/dist/capabilities/bumo.json +40 -40
  69. package/dist/capabilities/byteplus.json +28 -28
  70. package/dist/capabilities/cheapest-token.json +31 -31
  71. package/dist/capabilities/chutes.json +48 -17
  72. package/dist/capabilities/cline-pass.json +32 -45
  73. package/dist/capabilities/cloudcode.json +8 -8
  74. package/dist/capabilities/cloudferro-sherlock.json +4 -4
  75. package/dist/capabilities/cloudflare-workers-ai.json +17 -17
  76. package/dist/capabilities/commandcode.json +141 -156
  77. package/dist/capabilities/concentrate.json +289 -289
  78. package/dist/capabilities/cortecs.json +103 -103
  79. package/dist/capabilities/crossmodel.json +194 -194
  80. package/dist/capabilities/crusoe.json +18 -18
  81. package/dist/capabilities/daoxe.json +9 -9
  82. package/dist/capabilities/databricks.json +128 -128
  83. package/dist/capabilities/deepinfra.json +98 -94
  84. package/dist/capabilities/deepseek.json +4 -4
  85. package/dist/capabilities/digitalocean.json +114 -114
  86. package/dist/capabilities/dinference.json +1 -2
  87. package/dist/capabilities/dothoosh.json +26 -26
  88. package/dist/capabilities/doubleword.json +23 -23
  89. package/dist/capabilities/edenai.json +285 -285
  90. package/dist/capabilities/empiriolabs.json +176 -167
  91. package/dist/capabilities/engy.json +16 -16
  92. package/dist/capabilities/entrim.json +8 -8
  93. package/dist/capabilities/evroc.json +15 -15
  94. package/dist/capabilities/ezkielyna.json +10 -10
  95. package/dist/capabilities/fastrouter.json +93 -97
  96. package/dist/capabilities/fireworks-ai.json +85 -85
  97. package/dist/capabilities/fortytwo.json +4 -4
  98. package/dist/capabilities/freemodel.json +7 -51
  99. package/dist/capabilities/friendli.json +8 -8
  100. package/dist/capabilities/frogbot.json +95 -103
  101. package/dist/capabilities/gisoo.json +15 -15
  102. package/dist/capabilities/gmicloud.json +21 -21
  103. package/dist/capabilities/google.json +55 -55
  104. package/dist/capabilities/graphn.json +10 -10
  105. package/dist/capabilities/greenpt.json +35 -35
  106. package/dist/capabilities/groq.json +7 -20
  107. package/dist/capabilities/helicone.json +84 -86
  108. package/dist/capabilities/hetzner.json +4 -4
  109. package/dist/capabilities/hopper.json +2 -2
  110. package/dist/capabilities/hostinger-router.json +5 -5
  111. package/dist/capabilities/hpc-ai.json +8 -24
  112. package/dist/capabilities/huawei-maas.json +13 -13
  113. package/dist/capabilities/hubris.json +30 -30
  114. package/dist/capabilities/huggingface.json +86 -101
  115. package/dist/capabilities/hyper.json +24 -24
  116. package/dist/capabilities/impossibl.json +152 -199
  117. package/dist/capabilities/inceptron.json +8 -8
  118. package/dist/capabilities/inco.json +4 -21
  119. package/dist/capabilities/infer.json +16 -16
  120. package/dist/capabilities/inferall.json +2 -18
  121. package/dist/capabilities/inference-coop.json +6 -6
  122. package/dist/capabilities/inference.json +2 -11
  123. package/dist/capabilities/inferenceapis.json +24 -24
  124. package/dist/capabilities/infersia.json +13 -13
  125. package/dist/capabilities/inferx.json +3 -3
  126. package/dist/capabilities/infomaniak.json +3 -3
  127. package/dist/capabilities/io-net.json +6 -16
  128. package/dist/capabilities/isoquant.json +4 -4
  129. package/dist/capabilities/iteracompute.json +42 -80
  130. package/dist/capabilities/jalapeno.json +11 -11
  131. package/dist/capabilities/jiekou.json +19 -167
  132. package/dist/capabilities/joingonka.json +4 -4
  133. package/dist/capabilities/jzstoken.json +54 -54
  134. package/dist/capabilities/keln.json +23 -23
  135. package/dist/capabilities/kenari.json +122 -130
  136. package/dist/capabilities/kilo.json +649 -647
  137. package/dist/capabilities/kimi-code-plan-cn.json +7 -7
  138. package/dist/capabilities/kimi-code-plan-global.json +7 -7
  139. package/dist/capabilities/kitani.json +4 -4
  140. package/dist/capabilities/klavo.json +24 -24
  141. package/dist/capabilities/korouter.json +32 -32
  142. package/dist/capabilities/kunavo.json +7 -7
  143. package/dist/capabilities/liquid.json +8 -8
  144. package/dist/capabilities/lithosai.json +3 -3
  145. package/dist/capabilities/llmgateway-providers.json +885 -893
  146. package/dist/capabilities/llmgateway.json +340 -340
  147. package/dist/capabilities/llmtr.json +16 -54
  148. package/dist/capabilities/lowrouter.json +61 -61
  149. package/dist/capabilities/lyceum.json +14 -14
  150. package/dist/capabilities/meganova.json +0 -1
  151. package/dist/capabilities/melious.json +14 -14
  152. package/dist/capabilities/merge-gateway.json +292 -292
  153. package/dist/capabilities/meta.json +11 -11
  154. package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
  155. package/dist/capabilities/minimax-cn.json +5 -5
  156. package/dist/capabilities/minimax-coding-plan.json +2 -2
  157. package/dist/capabilities/minimax.json +5 -5
  158. package/dist/capabilities/mistral.json +15 -31
  159. package/dist/capabilities/mixlayer.json +5 -5
  160. package/dist/capabilities/moark.json +0 -2
  161. package/dist/capabilities/modal.json +8 -8
  162. package/dist/capabilities/model-oracle-ai.json +19 -27
  163. package/dist/capabilities/modelis.json +14 -14
  164. package/dist/capabilities/modelscope.json +2 -2
  165. package/dist/capabilities/modular.json +11 -11
  166. package/dist/capabilities/moneo.json +7 -38
  167. package/dist/capabilities/moonshotai-cn.json +7 -7
  168. package/dist/capabilities/moonshotai.json +7 -7
  169. package/dist/capabilities/morph.json +13 -13
  170. package/dist/capabilities/munito-eu.json +8 -8
  171. package/dist/capabilities/munito.json +10 -10
  172. package/dist/capabilities/nan.json +31 -31
  173. package/dist/capabilities/nano-gpt.json +581 -603
  174. package/dist/capabilities/nearai.json +119 -119
  175. package/dist/capabilities/nebius.json +30 -31
  176. package/dist/capabilities/neon.json +132 -132
  177. package/dist/capabilities/neuralwatt.json +41 -41
  178. package/dist/capabilities/nokeep.json +5 -5
  179. package/dist/capabilities/novita-ai.json +113 -227
  180. package/dist/capabilities/nvidia.json +14 -82
  181. package/dist/capabilities/oathbreaker.json +2 -2
  182. package/dist/capabilities/obscurify.json +28 -28
  183. package/dist/capabilities/oci.json +4 -4
  184. package/dist/capabilities/ofox.json +270 -270
  185. package/dist/capabilities/ollama-cloud.json +53 -53
  186. package/dist/capabilities/openai.json +57 -57
  187. package/dist/capabilities/opencode-go.json +88 -90
  188. package/dist/capabilities/openreason.json +5 -5
  189. package/dist/capabilities/openrouter.json +574 -563
  190. package/dist/capabilities/opper.json +29 -34
  191. package/dist/capabilities/orcarouter.json +307 -367
  192. package/dist/capabilities/outerlabs.json +30 -30
  193. package/dist/capabilities/ovhcloud.json +19 -19
  194. package/dist/capabilities/pareto.json +2 -7
  195. package/dist/capabilities/perplexity-agent.json +47 -102
  196. package/dist/capabilities/perplexity.json +2 -2
  197. package/dist/capabilities/phala.json +35 -35
  198. package/dist/capabilities/pioneer.json +5 -122
  199. package/dist/capabilities/poe.json +130 -130
  200. package/dist/capabilities/poolside.json +2 -2
  201. package/dist/capabilities/powerspring.json +14 -14
  202. package/dist/capabilities/primalabs.json +12 -12
  203. package/dist/capabilities/prime.json +123 -115
  204. package/dist/capabilities/privatemode-ai.json +8 -36
  205. package/dist/capabilities/proxystacks.json +5 -5
  206. package/dist/capabilities/qihang-ai.json +3 -15
  207. package/dist/capabilities/qiniu-ai.json +13 -87
  208. package/dist/capabilities/refuseless.json +7 -14
  209. package/dist/capabilities/regolo-ai.json +9 -13
  210. package/dist/capabilities/requesty.json +202 -202
  211. package/dist/capabilities/routing-run.json +3 -40
  212. package/dist/capabilities/ruapi.json +21 -21
  213. package/dist/capabilities/runcrate.json +10 -10
  214. package/dist/capabilities/runinfra.json +16 -16
  215. package/dist/capabilities/sakana.json +3 -3
  216. package/dist/capabilities/sambanova.json +9 -9
  217. package/dist/capabilities/sandbase.json +20 -20
  218. package/dist/capabilities/sarvam.json +22 -13
  219. package/dist/capabilities/scaleway.json +18 -18
  220. package/dist/capabilities/scnet-token-plan.json +7 -7
  221. package/dist/capabilities/scx-ai.json +16 -32
  222. package/dist/capabilities/sensenova.json +12 -12
  223. package/dist/capabilities/siliconflow-cn.json +45 -97
  224. package/dist/capabilities/siliconflow.json +53 -53
  225. package/dist/capabilities/snowflake-cortex.json +26 -26
  226. package/dist/capabilities/sokkan.json +8 -20
  227. package/dist/capabilities/sparrowcodes.json +21 -21
  228. package/dist/capabilities/stackit.json +1 -2
  229. package/dist/capabilities/standardcompute.json +84 -120
  230. package/dist/capabilities/steadyrouter.json +41 -41
  231. package/dist/capabilities/stepfun-ai-step-plan.json +8 -8
  232. package/dist/capabilities/stepfun-ai.json +8 -8
  233. package/dist/capabilities/stepfun-step-plan.json +8 -8
  234. package/dist/capabilities/stepfun.json +8 -8
  235. package/dist/capabilities/stepping-stone.json +15 -15
  236. package/dist/capabilities/subconscious.json +2 -2
  237. package/dist/capabilities/superbot-gg.json +4 -4
  238. package/dist/capabilities/synthetic.json +8 -17
  239. package/dist/capabilities/synthorai.json +21 -21
  240. package/dist/capabilities/teamorouter.json +23 -23
  241. package/dist/capabilities/teapot-router.json +10 -10
  242. package/dist/capabilities/tencent-token-plan-intl.json +25 -25
  243. package/dist/capabilities/tencent-token-plan.json +38 -38
  244. package/dist/capabilities/tencent-tokenhub.json +46 -46
  245. package/dist/capabilities/tensorx.json +48 -48
  246. package/dist/capabilities/tenstorrent.json +4 -4
  247. package/dist/capabilities/the-grid-ai.json +29 -29
  248. package/dist/capabilities/thinkingmachines.json +71 -71
  249. package/dist/capabilities/tinfoil.json +8 -8
  250. package/dist/capabilities/toapis.json +3 -3
  251. package/dist/capabilities/togetherai.json +42 -42
  252. package/dist/capabilities/tokengo.json +21 -21
  253. package/dist/capabilities/tokenify.json +2 -2
  254. package/dist/capabilities/trustedrouter.json +5 -5
  255. package/dist/capabilities/trustedtokens.json +15 -15
  256. package/dist/capabilities/umans-ai-coding-plan.json +16 -16
  257. package/dist/capabilities/umans-ai.json +13 -13
  258. package/dist/capabilities/uncensuredai.json +4 -4
  259. package/dist/capabilities/unorouter.json +1 -22
  260. package/dist/capabilities/unrestricted.json +4 -20
  261. package/dist/capabilities/uplinkswitch.json +21 -21
  262. package/dist/capabilities/upstage.json +3 -15
  263. package/dist/capabilities/vancine.json +20 -20
  264. package/dist/capabilities/vercel.json +551 -551
  265. package/dist/capabilities/vivgrid.json +51 -131
  266. package/dist/capabilities/volcengine-coding-plan.json +29 -29
  267. package/dist/capabilities/volcengine.json +27 -27
  268. package/dist/capabilities/vultr.json +14 -67
  269. package/dist/capabilities/wafer.ai.json +17 -17
  270. package/dist/capabilities/wallaby.json +2 -2
  271. package/dist/capabilities/wally.json +12 -12
  272. package/dist/capabilities/wandb.json +21 -21
  273. package/dist/capabilities/watt.json +22 -22
  274. package/dist/capabilities/xai.json +5 -5
  275. package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
  276. package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
  277. package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
  278. package/dist/capabilities/xiaomi.json +2 -2
  279. package/dist/capabilities/xpersona.json +13 -13
  280. package/dist/capabilities/xxapi.json +30 -30
  281. package/dist/capabilities/zai-coding-plan.json +17 -17
  282. package/dist/capabilities/zai.json +31 -31
  283. package/dist/capabilities/zenifra.json +26 -26
  284. package/dist/capabilities/zenmux.json +190 -233
  285. package/dist/capabilities/zerogpu.json +8 -8
  286. package/dist/capabilities/zhipuai-coding-plan.json +3 -14
  287. package/dist/capabilities/zhipuai.json +30 -30
  288. package/dist/capabilities/zro.json +6 -6
  289. package/dist/channels/index.cjs +24 -24
  290. package/dist/channels/index.js +2 -2
  291. package/dist/{channels-B7lf5BnT.js → channels-BBwgs50q.js} +2 -2
  292. package/dist/{channels-CAA8MkDQ.cjs → channels-CbhgGgQD.cjs} +6 -6
  293. package/dist/coding-agent/index.cjs +7 -7
  294. package/dist/coding-agent/index.js +4 -4
  295. package/dist/{constants-CFO8w780.cjs → constants-B2FVV_2e.cjs} +1 -1
  296. package/dist/{constants-CUv0mU2y.js → constants-Dro9fuhk.js} +1 -1
  297. package/dist/datasets/index.cjs +9 -9
  298. package/dist/datasets/index.js +2 -2
  299. package/dist/docs/SKILL.md +1 -1
  300. package/dist/docs/assets/SOURCE_MAP.json +1147 -1142
  301. package/dist/docs/references/docs-agents-overview.md +9 -0
  302. package/dist/docs/references/docs-deployment-workers.md +1 -1
  303. package/dist/docs/references/docs-harness-background-tasks.md +8 -5
  304. package/dist/docs/references/docs-harness-durable-agents.md +1 -0
  305. package/dist/docs/references/docs-knowledge-search.md +1 -1
  306. package/dist/docs/references/docs-server-pubsub.md +1 -1
  307. package/dist/docs/references/docs-skills.md +4 -1
  308. package/dist/docs/references/docs-workflows-overview.md +2 -0
  309. package/dist/docs/references/reference-agent-controller-session.md +19 -0
  310. package/dist/docs/references/reference-agents-createSkill.md +20 -1
  311. package/dist/docs/references/reference-knowledge-knowledge-tools.md +1 -2
  312. package/dist/docs/references/reference-observability-metrics-metrics-context.md +63 -3
  313. package/dist/docs/references/reference-pubsub-base.md +1 -1
  314. package/dist/docs/references/reference-pubsub-redis-streams.md +3 -5
  315. package/dist/docs/references/reference-pubsub-valkey-streams.md +2 -2
  316. package/dist/docs/references/reference-templates-overview.md +31 -1
  317. package/dist/docs/references/reference-workflows-run-methods-restart.md +2 -0
  318. package/dist/evals/index.cjs +13 -13
  319. package/dist/evals/index.js +2 -2
  320. package/dist/evals/scoreTraces/index.cjs +4 -4
  321. package/dist/evals/scoreTraces/index.js +2 -2
  322. package/dist/events/index.cjs +1 -1
  323. package/dist/events/index.js +1 -1
  324. package/dist/events/pubsub.d.ts +1 -3
  325. package/dist/{run-registry-bm6b6mwQ.js → execution-fence-B8yV_n51.js} +62508 -62052
  326. package/dist/{run-registry-BaVTwGKh.cjs → execution-fence-fqV6FGdV.cjs} +63621 -63153
  327. package/dist/harness/index.cjs +3 -3
  328. package/dist/harness/index.js +3 -3
  329. package/dist/index.cjs +1 -1
  330. package/dist/index.d.ts +1 -0
  331. package/dist/index.js +1 -1
  332. package/dist/integration/index.cjs +1 -1
  333. package/dist/integration/index.js +1 -1
  334. package/dist/knowledge/index.cjs +163 -153
  335. package/dist/knowledge/index.js +18 -8
  336. package/dist/llm/index.cjs +3 -3
  337. package/dist/llm/index.js +3 -3
  338. package/dist/llm/model/gateways/opencode-session-header.d.ts +28 -0
  339. package/dist/llm/model/provider-types.generated.d.ts +7412 -7795
  340. package/dist/llm/model/resolve-model.d.ts +1 -0
  341. package/dist/llm/model/shared.types.d.ts +1 -0
  342. package/dist/{llm-CGl_FZsb.cjs → llm-B7ul27Ay.cjs} +32 -14
  343. package/dist/{llm-B5OxUmL4.js → llm-Cy3WZXgA.js} +32 -14
  344. package/dist/loop/index.cjs +15 -15
  345. package/dist/loop/index.js +2 -2
  346. package/dist/loop/server.cjs +1 -1
  347. package/dist/loop/server.js +1 -1
  348. package/dist/{manager-BuPZ97U6.cjs → manager-CY-RzZJL.cjs} +21 -19
  349. package/dist/{manager-R_QVoiy9.js → manager-Dsub5fyz.js} +9 -7
  350. package/dist/mastra/index.cjs +1 -1
  351. package/dist/mastra/index.d.ts +33 -4
  352. package/dist/mastra/index.js +1 -1
  353. package/dist/{mastra-CHYi4Woq.cjs → mastra-DXQUuwFl.cjs} +116 -67
  354. package/dist/{mastra-Cl5EC-jR.js → mastra-yjoYfTS5.js} +76 -27
  355. package/dist/memory/index.cjs +24 -24
  356. package/dist/memory/index.js +2 -2
  357. package/dist/memory/mock.d.ts +2 -3
  358. package/dist/{model-WmKuSHa8.cjs → model-BARBpXDN.cjs} +2 -2
  359. package/dist/{model-BNIR9RSw.js → model-DauH8JTo.js} +2 -2
  360. package/dist/{netlify-D4orVt-5.js → netlify-BNBtKR4Q.js} +86 -4
  361. package/dist/{netlify-C_6KLad8.cjs → netlify-DGsETiFB.cjs} +97 -3
  362. package/dist/notifications/index.cjs +18 -18
  363. package/dist/notifications/index.js +2 -2
  364. package/dist/observability/index.cjs +1 -1
  365. package/dist/observability/index.js +1 -1
  366. package/dist/{observability-D7RNOAPx.js → observability-DPDWibyH.js} +648 -648
  367. package/dist/{output-helpers-DgsH4aTb.cjs → output-helpers-By5FbLpp.cjs} +71 -73
  368. package/dist/{output-helpers-CVzhy1Y0.js → output-helpers-k2-48ssH.js} +72 -74
  369. package/dist/processor-provider/index.cjs +10 -10
  370. package/dist/processor-provider/index.js +1 -1
  371. package/dist/processors/index.cjs +65 -65
  372. package/dist/processors/index.js +2 -2
  373. package/dist/{provider-registry-CkHZ7heH.js → provider-registry-CfHy4Zhw.js} +21401 -22401
  374. package/dist/{provider-registry-DH7XbpHT.cjs → provider-registry-Y6tbfFhH.cjs} +21401 -22401
  375. package/dist/provider-registry.json +21940 -22961
  376. package/dist/{registry-generator-Dn8HU1Jz.cjs → registry-generator-BEJ0APNc.cjs} +1 -1
  377. package/dist/{registry-generator-CAXpGkmM.js → registry-generator-DJiQAI8V.js} +1 -1
  378. package/dist/{rehydrate-DZyZNbaq.cjs → rehydrate-4Sl7D3kO.cjs} +14 -14
  379. package/dist/{rehydrate-Cy7-QPU-.js → rehydrate-Da4_E_N8.js} +2 -2
  380. package/dist/relevance/index.cjs +3 -3
  381. package/dist/relevance/index.js +2 -2
  382. package/dist/{signal-provider-BslnAjWG.js → signal-provider-B_mfW-J4.js} +1 -1
  383. package/dist/{signal-provider-BFAvh_AJ.cjs → signal-provider-D9gbevHN.cjs} +1 -1
  384. package/dist/signals/index.cjs +3 -3
  385. package/dist/signals/index.js +3 -3
  386. package/dist/{signals-CbmgVwL-.cjs → signals-BwDXGqxc.cjs} +2 -2
  387. package/dist/{signals-Clupx3jz.js → signals-TznxWfM3.js} +2 -2
  388. package/dist/skills/create-skill.d.ts +3 -0
  389. package/dist/skills/index.cjs +1 -1
  390. package/dist/skills/index.js +1 -1
  391. package/dist/skills/inline-skill-source.d.ts +5 -1
  392. package/dist/skills/types.d.ts +16 -1
  393. package/dist/{source-DYZMfjv3.js → source-B3He4_mz.js} +1 -1
  394. package/dist/{source-BC8Et5qZ.cjs → source-C_nWbqI0.cjs} +1 -1
  395. package/dist/{state-processor-B9kxpM53.js → state-processor-B_KsS82m.js} +1 -1
  396. package/dist/{state-processor-kRNZ38Nf.cjs → state-processor-DaSmhVUX.cjs} +1 -1
  397. package/dist/storage/constants.cjs +1 -1
  398. package/dist/storage/constants.js +1 -1
  399. package/dist/storage/domains/agents/index.cjs +1 -1
  400. package/dist/storage/domains/agents/index.js +1 -1
  401. package/dist/storage/domains/inmemory-db.d.ts +1 -1
  402. package/dist/storage/domains/knowledge/pages.d.ts +8 -1
  403. package/dist/storage/domains/memory/base.d.ts +19 -9
  404. package/dist/storage/domains/memory/inmemory.d.ts +4 -1
  405. package/dist/storage/domains/memory/queue-thread.d.ts +7 -1
  406. package/dist/storage/domains/workflows/base.d.ts +18 -5
  407. package/dist/storage/domains/workflows/inmemory.d.ts +3 -5
  408. package/dist/storage/domains/workflows/journal.d.ts +16 -1
  409. package/dist/storage/index.cjs +187 -186
  410. package/dist/storage/index.js +6 -6
  411. package/dist/storage/workflow-snapshot.d.ts +4 -0
  412. package/dist/storage/workflow-step-guard.d.ts +5 -0
  413. package/dist/stream/base/output.d.ts +1 -0
  414. package/dist/stream/index.cjs +2 -2
  415. package/dist/stream/index.js +2 -2
  416. package/dist/{stream-B9dswdIM.js → stream-BFhCDJvz.js} +18 -8
  417. package/dist/{stream-CbG7k93m.cjs → stream-CZy8XA_q.cjs} +23 -7
  418. package/dist/telemetry/index.cjs +1 -1
  419. package/dist/telemetry/index.js +1 -1
  420. package/dist/test-utils/llm-mock.cjs +1 -1
  421. package/dist/test-utils/llm-mock.js +1 -1
  422. package/dist/{tool-Z3bykc1m.js → tool-DIFduuTw.js} +2 -5
  423. package/dist/{tool-CYlT2UA-.cjs → tool-Dn9WSDVn.cjs} +2 -5
  424. package/dist/tool-loop-agent/index.cjs +1 -1
  425. package/dist/tool-loop-agent/index.js +1 -1
  426. package/dist/{tool-loop-agent-BnlPROel.cjs → tool-loop-agent-DifR6VLI.cjs} +4 -4
  427. package/dist/{tool-loop-agent-BmlzhMxc.js → tool-loop-agent-SOpIJRws.js} +3 -3
  428. package/dist/{toolchecks-DrsZdc3S.js → toolchecks-CRAfUe9H.js} +1 -1
  429. package/dist/{toolchecks-MFU48cit.cjs → toolchecks-DbBsQGHW.cjs} +1 -1
  430. package/dist/tools/index.cjs +5 -5
  431. package/dist/tools/index.d.ts +1 -0
  432. package/dist/tools/index.js +5 -5
  433. package/dist/tools/is-vercel-tool.cjs +1 -1
  434. package/dist/tools/is-vercel-tool.js +1 -1
  435. package/dist/tools/tool.d.ts +2 -4
  436. package/dist/tools/types.d.ts +1 -0
  437. package/dist/{tools-BEYxowf0.cjs → tools-C2q0ougI.cjs} +1 -1
  438. package/dist/{tools-tPy2FwMI.js → tools-ybbz1YKg.js} +1 -1
  439. package/dist/{utils-N_OPw-9g.cjs → utils-BjFntMW_.cjs} +6 -5
  440. package/dist/{utils-BU8lpEZ4.js → utils-DN_kWhH6.js} +6 -5
  441. package/dist/utils.cjs +3 -3
  442. package/dist/utils.js +3 -3
  443. package/dist/{validate-BvxwUPNa.cjs → validate-CBQ0dMBb.cjs} +1 -1
  444. package/dist/{validate-BANPY3pi.js → validate-KIBMWuyc.js} +1 -1
  445. package/dist/vector/index.cjs +8 -8
  446. package/dist/vector/index.js +1 -1
  447. package/dist/worker/index.cjs +1 -1
  448. package/dist/worker/index.js +1 -1
  449. package/dist/{worker-BpVWGM6Q.js → worker-Bqg7bsxX.js} +8 -3
  450. package/dist/{worker-E2MdhICW.cjs → worker-CJ_JYSy0.cjs} +3 -3
  451. package/dist/{worker-B3s2DjXP.cjs → worker-Ct6E5_2p.cjs} +16 -11
  452. package/dist/{worker-CZ_07SOb.js → worker-DVM_pvH7.js} +2 -2
  453. package/dist/{workflow-BrcVks0j.js → workflow-BmShpn3p.js} +4 -4
  454. package/dist/{workflow-BuPW86ke.cjs → workflow-DEAvg0pI.cjs} +8 -8
  455. package/dist/workflows/builder/index.cjs +1 -1
  456. package/dist/workflows/builder/index.js +1 -1
  457. package/dist/workflows/evented/index.cjs +10 -10
  458. package/dist/workflows/evented/index.js +1 -1
  459. package/dist/workflows/evented/workflow-event-processor/index.d.ts +0 -2
  460. package/dist/workflows/evented/workflow.d.ts +2 -1
  461. package/dist/workflows/index.cjs +54 -54
  462. package/dist/workflows/index.js +4 -4
  463. package/dist/workflows/run-storage.d.ts +16 -1
  464. package/dist/workflows/types.d.ts +10 -0
  465. package/dist/workflows/workflow.d.ts +3 -1
  466. package/dist/workspace/index.cjs +1 -1
  467. package/dist/workspace/index.js +1 -1
  468. package/dist/{workspace-CzzrnE6Q.cjs → workspace-BQD4tcQi.cjs} +3 -3
  469. package/dist/{workspace-Ct2kAiDv.js → workspace-sqcfdZRR.js} +2 -2
  470. package/package.json +7 -6
  471. package/skills/mastra/SKILL.md +171 -0
  472. package/skills/mastra/references/common-errors.md +557 -0
  473. package/skills/mastra/references/core-concepts.md +21 -0
  474. package/skills/mastra/references/create-mastra.md +233 -0
  475. package/skills/mastra/references/embedded-docs.md +103 -0
  476. package/skills/mastra/references/feedback.md +69 -0
  477. package/skills/mastra/references/gateway.md +66 -0
  478. package/skills/mastra/references/mastra-api.md +222 -0
  479. package/skills/mastra/references/migration-guide.md +185 -0
  480. package/skills/mastra/references/model-selection.md +29 -0
  481. package/skills/mastra/references/platform.md +164 -0
  482. package/skills/mastra/references/remote-docs.md +193 -0
  483. package/skills/mastra/references/trace-query.md +150 -0
  484. package/skills/mastra/scripts/provider-registry.mjs +271 -0
  485. package/src/llm/model/provider-types.generated.d.ts +7412 -7795
  486. package/dist/{observability-B0R_D1PZ.cjs → observability-VaoaeadK.cjs} +647 -647
@@ -22,6 +22,9 @@ const require_workspace_skills = require("./workspace-skills-BcquhPDn.cjs");
22
22
  * references: {
23
23
  * 'checklist.md': '# Review Checklist\n...',
24
24
  * },
25
+ * scripts: {
26
+ * 'lint.sh': '#!/bin/sh\npnpm lint',
27
+ * },
25
28
  * });
26
29
  * ```
27
30
  */
@@ -34,23 +37,32 @@ const require_workspace_skills = require("./workspace-skills-BcquhPDn.cjs");
34
37
  * @throws Error if the skill metadata fails validation
35
38
  */
36
39
  function createSkill(input) {
37
- const { name, description, instructions, license, compatibility, metadata, references } = input;
38
- const validation = require_workspace_skills.validateSkillMetadata({
39
- metadata: {
40
- name,
41
- description,
42
- license,
43
- compatibility,
44
- "user-invocable": input["user-invocable"],
45
- metadata
46
- },
47
- instructions
48
- });
49
- if (!validation.valid) throw new Error(`Invalid skill "${name}": ${validation.errors.join("; ")}`);
50
- const referenceKeys = references ? Object.keys(references) : [];
40
+ const { name, description, instructions, license, compatibility, metadata } = input;
41
+ const references = input.references ?? {};
42
+ const scripts = input.scripts ?? {};
43
+ const assets = input.assets ?? {};
44
+ const errors = [
45
+ ...require_workspace_skills.validateSkillMetadata({
46
+ metadata: {
47
+ name,
48
+ description,
49
+ license,
50
+ compatibility,
51
+ "user-invocable": input["user-invocable"],
52
+ metadata
53
+ },
54
+ instructions
55
+ }).errors,
56
+ ...invalidFilePaths("references", references),
57
+ ...invalidFilePaths("scripts", scripts),
58
+ ...invalidFilePaths("assets", assets)
59
+ ];
60
+ if (errors.length > 0) throw new Error(`Invalid skill "${name}": ${errors.join("; ")}`);
51
61
  return {
52
62
  __inline: true,
53
- __referenceContents: references ?? {},
63
+ __referenceContents: references,
64
+ __scriptContents: scripts,
65
+ __assetContents: assets,
54
66
  name,
55
67
  description,
56
68
  instructions,
@@ -63,12 +75,29 @@ function createSkill(input) {
63
75
  type: "local",
64
76
  projectPath: `inline/${name}`
65
77
  },
66
- references: referenceKeys,
67
- scripts: [],
68
- assets: []
78
+ references: Object.keys(references),
79
+ scripts: Object.keys(scripts),
80
+ assets: Object.keys(assets)
69
81
  };
70
82
  }
71
83
  /**
84
+ * File keys are paths inside the skill's `references/`, `scripts/`, or `assets/`
85
+ * directory, so they must be relative, use `/` separators, stay inside it, and
86
+ * never name both a file and a directory.
87
+ */
88
+ function invalidFilePaths(dir, files) {
89
+ const keys = Object.keys(files);
90
+ const errors = [];
91
+ for (const key of keys) if (key.includes("\\")) errors.push(`${dir}: "${key}" must use / to separate directories`);
92
+ else if (key.startsWith("/") || /^[a-zA-Z]:/.test(key) || key.split("/").some((segment) => [
93
+ "",
94
+ ".",
95
+ ".."
96
+ ].includes(segment))) errors.push(`${dir}: "${key}" must be a relative file path inside ${dir}/`);
97
+ else if (keys.some((other) => other.startsWith(`${key}/`))) errors.push(`${dir}: "${key}" is both a file and a directory`);
98
+ return errors;
99
+ }
100
+ /**
72
101
  * Type guard: is this skill an inline skill (from createSkill)?
73
102
  */
74
103
  function isInlineSkill(skill) {
@@ -84,16 +113,17 @@ function isInlineSkill(skill) {
84
113
  * Directory layout emulation:
85
114
  * Each inline skill appears as a directory at `inline/<name>/` with:
86
115
  * - SKILL.md (generated from the skill's metadata + instructions)
87
- * - references/<file> (from the skill's `references` map)
116
+ * - references/<path> (from the skill's `references` map)
117
+ * - scripts/<path> (from the skill's `scripts` map)
118
+ * - assets/<path> (from the skill's `assets` map)
119
+ *
120
+ * Keys containing `/` become nested directories.
88
121
  */
89
122
  var InlineSkillSource = class {
90
- #skills;
91
- /** Pre-built SKILL.md content per skill name */
92
- #skillMdCache;
123
+ #trees;
124
+ #createdAt = /* @__PURE__ */ new Date();
93
125
  constructor(skills) {
94
- this.#skills = new Map(skills.map((s) => [s.name, s]));
95
- this.#skillMdCache = /* @__PURE__ */ new Map();
96
- for (const skill of skills) this.#skillMdCache.set(skill.name, this.#buildSkillMd(skill));
126
+ this.#trees = new Map(skills.map((skill) => [skill.name, this.#buildTree(skill)]));
97
127
  }
98
128
  /**
99
129
  * Build a synthetic SKILL.md from an inline skill's metadata and instructions.
@@ -109,112 +139,107 @@ var InlineSkillSource = class {
109
139
  if (skill.metadata) frontmatter.metadata = skill.metadata;
110
140
  return require_workspace_skills.stringifyFrontmatter(skill.instructions, frontmatter);
111
141
  }
142
+ #buildTree(skill) {
143
+ const files = /* @__PURE__ */ new Map([["SKILL.md", this.#buildSkillMd(skill)]]);
144
+ const directories = /* @__PURE__ */ new Set([""]);
145
+ const subdirs = [
146
+ ["references", skill.__referenceContents],
147
+ ["scripts", skill.__scriptContents],
148
+ ["assets", skill.__assetContents]
149
+ ];
150
+ for (const [subdir, contents] of subdirs) for (const [relativePath, content] of Object.entries(contents ?? {})) {
151
+ const filePath = `${subdir}/${relativePath}`;
152
+ files.set(filePath, content);
153
+ const segments = filePath.split("/");
154
+ for (let i = 1; i < segments.length; i++) directories.add(segments.slice(0, i).join("/"));
155
+ }
156
+ return {
157
+ files,
158
+ directories
159
+ };
160
+ }
112
161
  /**
113
- * Parse a path into skill name and relative sub-path.
114
- * Paths look like `inline/<name>`, `inline/<name>/SKILL.md`, `inline/<name>/references/file.md`
162
+ * Resolve a path like `inline/<name>/references/file.md` to the skill's tree
163
+ * and the skill-relative sub-path.
115
164
  */
116
- #parsePath(inputPath) {
165
+ #resolve(inputPath) {
117
166
  if (!inputPath.startsWith("inline/")) return null;
118
- const rest = inputPath.slice(7);
167
+ const rest = inputPath.slice(7).replace(/\/+$/, "");
119
168
  const slashIdx = rest.indexOf("/");
120
- if (slashIdx === -1) return {
121
- skillName: rest,
122
- subPath: ""
123
- };
169
+ const name = slashIdx === -1 ? rest : rest.slice(0, slashIdx);
170
+ const tree = this.#trees.get(name);
171
+ if (!tree) return null;
124
172
  return {
125
- skillName: rest.slice(0, slashIdx),
126
- subPath: rest.slice(slashIdx + 1)
173
+ name,
174
+ tree,
175
+ subPath: slashIdx === -1 ? "" : rest.slice(slashIdx + 1)
127
176
  };
128
177
  }
129
- #getSkill(inputPath) {
130
- const parsed = this.#parsePath(inputPath);
131
- if (!parsed) return null;
132
- const skill = this.#skills.get(parsed.skillName);
133
- if (!skill) return null;
134
- return {
135
- skill,
136
- subPath: parsed.subPath
137
- };
178
+ #enoent(path) {
179
+ const error = /* @__PURE__ */ new Error(`ENOENT: no such file or directory: ${path}`);
180
+ error.code = "ENOENT";
181
+ return error;
138
182
  }
139
183
  async exists(path) {
140
- const result = this.#getSkill(path);
141
- if (!result) return false;
142
- const { skill, subPath } = result;
143
- if (subPath === "") return true;
144
- if (subPath === "SKILL.md") return true;
145
- if (subPath === "references") return (skill.references?.length ?? 0) > 0;
146
- if (subPath.startsWith("references/")) {
147
- const refPath = subPath.slice(11);
148
- return skill.references.includes(refPath);
149
- }
150
- return false;
184
+ const resolved = this.#resolve(path);
185
+ if (!resolved) return false;
186
+ return resolved.tree.files.has(resolved.subPath) || resolved.tree.directories.has(resolved.subPath);
151
187
  }
152
188
  async stat(path) {
153
- const result = this.#getSkill(path);
154
- if (!result) throw new Error(`ENOENT: no such file or directory: ${path}`);
155
- const { skill, subPath } = result;
156
- const now = /* @__PURE__ */ new Date();
157
- if (subPath === "") return {
158
- name: skill.name,
189
+ const resolved = this.#resolve(path);
190
+ if (!resolved) throw this.#enoent(path);
191
+ const { name, tree, subPath } = resolved;
192
+ const createdAt = this.#createdAt;
193
+ const baseName = subPath === "" ? name : subPath.slice(subPath.lastIndexOf("/") + 1);
194
+ if (tree.directories.has(subPath)) return {
195
+ name: baseName,
159
196
  type: "directory",
160
197
  size: 0,
161
- createdAt: now,
162
- modifiedAt: now
198
+ createdAt,
199
+ modifiedAt: createdAt
163
200
  };
164
- if (subPath === "SKILL.md") {
165
- const content = this.#skillMdCache.get(skill.name) ?? "";
166
- return {
167
- name: "SKILL.md",
168
- type: "file",
169
- size: Buffer.byteLength(content, "utf-8"),
170
- createdAt: now,
171
- modifiedAt: now,
172
- mimeType: "text/markdown"
173
- };
174
- }
175
- if (subPath === "references") return {
176
- name: "references",
177
- type: "directory",
178
- size: 0,
179
- createdAt: now,
180
- modifiedAt: now
201
+ const content = tree.files.get(subPath);
202
+ if (content === void 0) throw this.#enoent(path);
203
+ return {
204
+ name: baseName,
205
+ type: "file",
206
+ size: typeof content === "string" ? Buffer.byteLength(content, "utf-8") : content.byteLength,
207
+ createdAt,
208
+ modifiedAt: createdAt,
209
+ ...subPath === "SKILL.md" ? { mimeType: "text/markdown" } : {}
181
210
  };
182
- throw new Error(`ENOENT: no such file or directory: ${path}`);
183
211
  }
184
212
  async readFile(path) {
185
- const result = this.#getSkill(path);
186
- if (!result) throw new Error(`ENOENT: no such file or directory: ${path}`);
187
- const { skill, subPath } = result;
188
- if (subPath === "SKILL.md") return this.#skillMdCache.get(skill.name) ?? "";
189
- if (subPath.startsWith("references/")) {
190
- const refPath = subPath.slice(11);
191
- const content = skill.__referenceContents[refPath];
192
- if (content !== void 0) return content;
193
- }
194
- throw new Error(`ENOENT: no such file or directory: ${path}`);
213
+ const resolved = this.#resolve(path);
214
+ const content = resolved?.tree.files.get(resolved.subPath);
215
+ if (content === void 0) throw this.#enoent(path);
216
+ return typeof content === "string" ? content : Buffer.from(content.buffer, content.byteOffset, content.byteLength);
195
217
  }
196
218
  async readdir(path) {
197
- const parsed = this.#parsePath(path);
198
- if (!parsed) return [];
199
- const { skillName, subPath } = parsed;
200
- const skill = this.#skills.get(skillName);
201
- if (!skill) return [];
202
- if (subPath === "") {
203
- const entries = [{
204
- name: "SKILL.md",
205
- type: "file"
206
- }];
207
- if (skill.references.length > 0) entries.push({
208
- name: "references",
219
+ const resolved = this.#resolve(path);
220
+ if (!resolved || !resolved.tree.directories.has(resolved.subPath)) return [];
221
+ const { tree, subPath } = resolved;
222
+ const prefix = subPath === "" ? "" : `${subPath}/`;
223
+ const entries = /* @__PURE__ */ new Map();
224
+ for (const dir of tree.directories) {
225
+ if (dir === "" || !dir.startsWith(prefix)) continue;
226
+ const rest = dir.slice(prefix.length);
227
+ if (rest.includes("/")) continue;
228
+ entries.set(rest, {
229
+ name: rest,
209
230
  type: "directory"
210
231
  });
211
- return entries;
212
232
  }
213
- if (subPath === "references") return skill.references.map((ref) => ({
214
- name: ref,
215
- type: "file"
216
- }));
217
- return [];
233
+ for (const filePath of tree.files.keys()) {
234
+ if (!filePath.startsWith(prefix)) continue;
235
+ const rest = filePath.slice(prefix.length);
236
+ if (rest.includes("/")) continue;
237
+ entries.set(rest, {
238
+ name: rest,
239
+ type: "file"
240
+ });
241
+ }
242
+ return [...entries.values()];
218
243
  }
219
244
  };
220
245
  // src/skills/agent-skills-resolver.ts
@@ -22,6 +22,9 @@ import { c as stringifyFrontmatter, l as LocalSkillSource, r as WorkspaceSkillsI
22
22
  * references: {
23
23
  * 'checklist.md': '# Review Checklist\n...',
24
24
  * },
25
+ * scripts: {
26
+ * 'lint.sh': '#!/bin/sh\npnpm lint',
27
+ * },
25
28
  * });
26
29
  * ```
27
30
  */
@@ -34,23 +37,32 @@ import { c as stringifyFrontmatter, l as LocalSkillSource, r as WorkspaceSkillsI
34
37
  * @throws Error if the skill metadata fails validation
35
38
  */
36
39
  function createSkill(input) {
37
- const { name, description, instructions, license, compatibility, metadata, references } = input;
38
- const validation = validateSkillMetadata({
39
- metadata: {
40
- name,
41
- description,
42
- license,
43
- compatibility,
44
- "user-invocable": input["user-invocable"],
45
- metadata
46
- },
47
- instructions
48
- });
49
- if (!validation.valid) throw new Error(`Invalid skill "${name}": ${validation.errors.join("; ")}`);
50
- const referenceKeys = references ? Object.keys(references) : [];
40
+ const { name, description, instructions, license, compatibility, metadata } = input;
41
+ const references = input.references ?? {};
42
+ const scripts = input.scripts ?? {};
43
+ const assets = input.assets ?? {};
44
+ const errors = [
45
+ ...validateSkillMetadata({
46
+ metadata: {
47
+ name,
48
+ description,
49
+ license,
50
+ compatibility,
51
+ "user-invocable": input["user-invocable"],
52
+ metadata
53
+ },
54
+ instructions
55
+ }).errors,
56
+ ...invalidFilePaths("references", references),
57
+ ...invalidFilePaths("scripts", scripts),
58
+ ...invalidFilePaths("assets", assets)
59
+ ];
60
+ if (errors.length > 0) throw new Error(`Invalid skill "${name}": ${errors.join("; ")}`);
51
61
  return {
52
62
  __inline: true,
53
- __referenceContents: references ?? {},
63
+ __referenceContents: references,
64
+ __scriptContents: scripts,
65
+ __assetContents: assets,
54
66
  name,
55
67
  description,
56
68
  instructions,
@@ -63,12 +75,29 @@ function createSkill(input) {
63
75
  type: "local",
64
76
  projectPath: `inline/${name}`
65
77
  },
66
- references: referenceKeys,
67
- scripts: [],
68
- assets: []
78
+ references: Object.keys(references),
79
+ scripts: Object.keys(scripts),
80
+ assets: Object.keys(assets)
69
81
  };
70
82
  }
71
83
  /**
84
+ * File keys are paths inside the skill's `references/`, `scripts/`, or `assets/`
85
+ * directory, so they must be relative, use `/` separators, stay inside it, and
86
+ * never name both a file and a directory.
87
+ */
88
+ function invalidFilePaths(dir, files) {
89
+ const keys = Object.keys(files);
90
+ const errors = [];
91
+ for (const key of keys) if (key.includes("\\")) errors.push(`${dir}: "${key}" must use / to separate directories`);
92
+ else if (key.startsWith("/") || /^[a-zA-Z]:/.test(key) || key.split("/").some((segment) => [
93
+ "",
94
+ ".",
95
+ ".."
96
+ ].includes(segment))) errors.push(`${dir}: "${key}" must be a relative file path inside ${dir}/`);
97
+ else if (keys.some((other) => other.startsWith(`${key}/`))) errors.push(`${dir}: "${key}" is both a file and a directory`);
98
+ return errors;
99
+ }
100
+ /**
72
101
  * Type guard: is this skill an inline skill (from createSkill)?
73
102
  */
74
103
  function isInlineSkill(skill) {
@@ -84,16 +113,17 @@ function isInlineSkill(skill) {
84
113
  * Directory layout emulation:
85
114
  * Each inline skill appears as a directory at `inline/<name>/` with:
86
115
  * - SKILL.md (generated from the skill's metadata + instructions)
87
- * - references/<file> (from the skill's `references` map)
116
+ * - references/<path> (from the skill's `references` map)
117
+ * - scripts/<path> (from the skill's `scripts` map)
118
+ * - assets/<path> (from the skill's `assets` map)
119
+ *
120
+ * Keys containing `/` become nested directories.
88
121
  */
89
122
  var InlineSkillSource = class {
90
- #skills;
91
- /** Pre-built SKILL.md content per skill name */
92
- #skillMdCache;
123
+ #trees;
124
+ #createdAt = /* @__PURE__ */ new Date();
93
125
  constructor(skills) {
94
- this.#skills = new Map(skills.map((s) => [s.name, s]));
95
- this.#skillMdCache = /* @__PURE__ */ new Map();
96
- for (const skill of skills) this.#skillMdCache.set(skill.name, this.#buildSkillMd(skill));
126
+ this.#trees = new Map(skills.map((skill) => [skill.name, this.#buildTree(skill)]));
97
127
  }
98
128
  /**
99
129
  * Build a synthetic SKILL.md from an inline skill's metadata and instructions.
@@ -109,112 +139,107 @@ var InlineSkillSource = class {
109
139
  if (skill.metadata) frontmatter.metadata = skill.metadata;
110
140
  return stringifyFrontmatter(skill.instructions, frontmatter);
111
141
  }
142
+ #buildTree(skill) {
143
+ const files = /* @__PURE__ */ new Map([["SKILL.md", this.#buildSkillMd(skill)]]);
144
+ const directories = /* @__PURE__ */ new Set([""]);
145
+ const subdirs = [
146
+ ["references", skill.__referenceContents],
147
+ ["scripts", skill.__scriptContents],
148
+ ["assets", skill.__assetContents]
149
+ ];
150
+ for (const [subdir, contents] of subdirs) for (const [relativePath, content] of Object.entries(contents ?? {})) {
151
+ const filePath = `${subdir}/${relativePath}`;
152
+ files.set(filePath, content);
153
+ const segments = filePath.split("/");
154
+ for (let i = 1; i < segments.length; i++) directories.add(segments.slice(0, i).join("/"));
155
+ }
156
+ return {
157
+ files,
158
+ directories
159
+ };
160
+ }
112
161
  /**
113
- * Parse a path into skill name and relative sub-path.
114
- * Paths look like `inline/<name>`, `inline/<name>/SKILL.md`, `inline/<name>/references/file.md`
162
+ * Resolve a path like `inline/<name>/references/file.md` to the skill's tree
163
+ * and the skill-relative sub-path.
115
164
  */
116
- #parsePath(inputPath) {
165
+ #resolve(inputPath) {
117
166
  if (!inputPath.startsWith("inline/")) return null;
118
- const rest = inputPath.slice(7);
167
+ const rest = inputPath.slice(7).replace(/\/+$/, "");
119
168
  const slashIdx = rest.indexOf("/");
120
- if (slashIdx === -1) return {
121
- skillName: rest,
122
- subPath: ""
123
- };
169
+ const name = slashIdx === -1 ? rest : rest.slice(0, slashIdx);
170
+ const tree = this.#trees.get(name);
171
+ if (!tree) return null;
124
172
  return {
125
- skillName: rest.slice(0, slashIdx),
126
- subPath: rest.slice(slashIdx + 1)
173
+ name,
174
+ tree,
175
+ subPath: slashIdx === -1 ? "" : rest.slice(slashIdx + 1)
127
176
  };
128
177
  }
129
- #getSkill(inputPath) {
130
- const parsed = this.#parsePath(inputPath);
131
- if (!parsed) return null;
132
- const skill = this.#skills.get(parsed.skillName);
133
- if (!skill) return null;
134
- return {
135
- skill,
136
- subPath: parsed.subPath
137
- };
178
+ #enoent(path) {
179
+ const error = /* @__PURE__ */ new Error(`ENOENT: no such file or directory: ${path}`);
180
+ error.code = "ENOENT";
181
+ return error;
138
182
  }
139
183
  async exists(path) {
140
- const result = this.#getSkill(path);
141
- if (!result) return false;
142
- const { skill, subPath } = result;
143
- if (subPath === "") return true;
144
- if (subPath === "SKILL.md") return true;
145
- if (subPath === "references") return (skill.references?.length ?? 0) > 0;
146
- if (subPath.startsWith("references/")) {
147
- const refPath = subPath.slice(11);
148
- return skill.references.includes(refPath);
149
- }
150
- return false;
184
+ const resolved = this.#resolve(path);
185
+ if (!resolved) return false;
186
+ return resolved.tree.files.has(resolved.subPath) || resolved.tree.directories.has(resolved.subPath);
151
187
  }
152
188
  async stat(path) {
153
- const result = this.#getSkill(path);
154
- if (!result) throw new Error(`ENOENT: no such file or directory: ${path}`);
155
- const { skill, subPath } = result;
156
- const now = /* @__PURE__ */ new Date();
157
- if (subPath === "") return {
158
- name: skill.name,
189
+ const resolved = this.#resolve(path);
190
+ if (!resolved) throw this.#enoent(path);
191
+ const { name, tree, subPath } = resolved;
192
+ const createdAt = this.#createdAt;
193
+ const baseName = subPath === "" ? name : subPath.slice(subPath.lastIndexOf("/") + 1);
194
+ if (tree.directories.has(subPath)) return {
195
+ name: baseName,
159
196
  type: "directory",
160
197
  size: 0,
161
- createdAt: now,
162
- modifiedAt: now
198
+ createdAt,
199
+ modifiedAt: createdAt
163
200
  };
164
- if (subPath === "SKILL.md") {
165
- const content = this.#skillMdCache.get(skill.name) ?? "";
166
- return {
167
- name: "SKILL.md",
168
- type: "file",
169
- size: Buffer.byteLength(content, "utf-8"),
170
- createdAt: now,
171
- modifiedAt: now,
172
- mimeType: "text/markdown"
173
- };
174
- }
175
- if (subPath === "references") return {
176
- name: "references",
177
- type: "directory",
178
- size: 0,
179
- createdAt: now,
180
- modifiedAt: now
201
+ const content = tree.files.get(subPath);
202
+ if (content === void 0) throw this.#enoent(path);
203
+ return {
204
+ name: baseName,
205
+ type: "file",
206
+ size: typeof content === "string" ? Buffer.byteLength(content, "utf-8") : content.byteLength,
207
+ createdAt,
208
+ modifiedAt: createdAt,
209
+ ...subPath === "SKILL.md" ? { mimeType: "text/markdown" } : {}
181
210
  };
182
- throw new Error(`ENOENT: no such file or directory: ${path}`);
183
211
  }
184
212
  async readFile(path) {
185
- const result = this.#getSkill(path);
186
- if (!result) throw new Error(`ENOENT: no such file or directory: ${path}`);
187
- const { skill, subPath } = result;
188
- if (subPath === "SKILL.md") return this.#skillMdCache.get(skill.name) ?? "";
189
- if (subPath.startsWith("references/")) {
190
- const refPath = subPath.slice(11);
191
- const content = skill.__referenceContents[refPath];
192
- if (content !== void 0) return content;
193
- }
194
- throw new Error(`ENOENT: no such file or directory: ${path}`);
213
+ const resolved = this.#resolve(path);
214
+ const content = resolved?.tree.files.get(resolved.subPath);
215
+ if (content === void 0) throw this.#enoent(path);
216
+ return typeof content === "string" ? content : Buffer.from(content.buffer, content.byteOffset, content.byteLength);
195
217
  }
196
218
  async readdir(path) {
197
- const parsed = this.#parsePath(path);
198
- if (!parsed) return [];
199
- const { skillName, subPath } = parsed;
200
- const skill = this.#skills.get(skillName);
201
- if (!skill) return [];
202
- if (subPath === "") {
203
- const entries = [{
204
- name: "SKILL.md",
205
- type: "file"
206
- }];
207
- if (skill.references.length > 0) entries.push({
208
- name: "references",
219
+ const resolved = this.#resolve(path);
220
+ if (!resolved || !resolved.tree.directories.has(resolved.subPath)) return [];
221
+ const { tree, subPath } = resolved;
222
+ const prefix = subPath === "" ? "" : `${subPath}/`;
223
+ const entries = /* @__PURE__ */ new Map();
224
+ for (const dir of tree.directories) {
225
+ if (dir === "" || !dir.startsWith(prefix)) continue;
226
+ const rest = dir.slice(prefix.length);
227
+ if (rest.includes("/")) continue;
228
+ entries.set(rest, {
229
+ name: rest,
209
230
  type: "directory"
210
231
  });
211
- return entries;
212
232
  }
213
- if (subPath === "references") return skill.references.map((ref) => ({
214
- name: ref,
215
- type: "file"
216
- }));
217
- return [];
233
+ for (const filePath of tree.files.keys()) {
234
+ if (!filePath.startsWith(prefix)) continue;
235
+ const rest = filePath.slice(prefix.length);
236
+ if (rest.includes("/")) continue;
237
+ entries.set(rest, {
238
+ name: rest,
239
+ type: "file"
240
+ });
241
+ }
242
+ return [...entries.values()];
218
243
  }
219
244
  };
220
245
  // src/skills/agent-skills-resolver.ts
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_background_tasks = require("../background-tasks-BIk1TRPw.cjs");
2
+ const require_background_tasks = require("../background-tasks-DOmQdBVn.cjs");
3
3
  exports.BACKGROUND_TASK_WORKFLOW_ID = require_background_tasks.BACKGROUND_TASK_WORKFLOW_ID;
4
4
  exports.BackgroundTaskManager = require_background_tasks.BackgroundTaskManager;
5
5
  exports.backgroundOverrideJsonSchema = require_background_tasks.backgroundOverrideJsonSchema;
@@ -1 +1 @@
1
- export { u as BACKGROUND_TASK_WORKFLOW_ID, l as BackgroundTaskManager, n as backgroundOverrideJsonSchema, r as backgroundOverrideZodSchema, c as createBackgroundTask, t as generateBackgroundTaskSystemPrompt, i as isModelBackgroundOverrideAllowed, a as isToolBackgroundEligible, o as resolveBackgroundConfig } from "../background-tasks-CH_gzJwc.js";
1
+ export { u as BACKGROUND_TASK_WORKFLOW_ID, l as BackgroundTaskManager, n as backgroundOverrideJsonSchema, r as backgroundOverrideZodSchema, c as createBackgroundTask, t as generateBackgroundTaskSystemPrompt, i as isModelBackgroundOverrideAllowed, a as isToolBackgroundEligible, o as resolveBackgroundConfig } from "../background-tasks-DAu4WaCb.js";
@@ -249,7 +249,7 @@ var BackgroundTaskManager = class {
249
249
  if (handled) await ack?.();
250
250
  };
251
251
  if (this.#mastra) {
252
- const { buildBackgroundTaskWorkflow } = await import("./workflow-BrcVks0j.js");
252
+ const { buildBackgroundTaskWorkflow } = await import("./workflow-BmShpn3p.js");
253
253
  const workflow = buildBackgroundTaskWorkflow(this);
254
254
  if (!this.#mastra.__hasInternalWorkflow("__background-task")) this.#mastra.__registerInternalWorkflow(workflow);
255
255
  }
@@ -249,7 +249,7 @@ var BackgroundTaskManager = class {
249
249
  if (handled) await ack?.();
250
250
  };
251
251
  if (this.#mastra) {
252
- const { buildBackgroundTaskWorkflow } = await Promise.resolve().then(() => require("./workflow-BuPW86ke.cjs"));
252
+ const { buildBackgroundTaskWorkflow } = await Promise.resolve().then(() => require("./workflow-DEAvg0pI.cjs"));
253
253
  const workflow = buildBackgroundTaskWorkflow(this);
254
254
  if (!this.#mastra.__hasInternalWorkflow("__background-task")) this.#mastra.__registerInternalWorkflow(workflow);
255
255
  }