@mastra/core 1.3.0 → 1.4.0

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 (274) hide show
  1. package/CHANGELOG.md +462 -0
  2. package/datasets.d.ts +1 -0
  3. package/dist/agent/agent.d.ts +1 -1
  4. package/dist/agent/index.cjs +13 -13
  5. package/dist/agent/index.js +2 -2
  6. package/dist/agent/message-list/adapters/AIV4Adapter.d.ts.map +1 -1
  7. package/dist/agent/message-list/adapters/AIV5Adapter.d.ts.map +1 -1
  8. package/dist/agent/message-list/conversion/output-converter.d.ts +2 -1
  9. package/dist/agent/message-list/conversion/output-converter.d.ts.map +1 -1
  10. package/dist/agent/message-list/index.cjs +18 -18
  11. package/dist/agent/message-list/index.js +1 -1
  12. package/dist/agent/workflows/prepare-stream/index.d.ts +1 -1
  13. package/dist/chunk-3JVFFAJX.cjs +1207 -0
  14. package/dist/chunk-3JVFFAJX.cjs.map +1 -0
  15. package/dist/{chunk-WL3AW3YA.js → chunk-3X3CZUXI.js} +4070 -3983
  16. package/dist/chunk-3X3CZUXI.js.map +1 -0
  17. package/dist/{chunk-2GWTJFVM.js → chunk-4EHGOATH.js} +46 -14
  18. package/dist/chunk-4EHGOATH.js.map +1 -0
  19. package/dist/{chunk-YNXIGRQE.cjs → chunk-4IJ4UDZX.cjs} +319 -83
  20. package/dist/chunk-4IJ4UDZX.cjs.map +1 -0
  21. package/dist/{chunk-CGPH7CMG.cjs → chunk-4KFEMXTV.cjs} +46 -14
  22. package/dist/chunk-4KFEMXTV.cjs.map +1 -0
  23. package/dist/{chunk-PHYJYZ32.js → chunk-4TQ4EBYX.js} +16 -8
  24. package/dist/chunk-4TQ4EBYX.js.map +1 -0
  25. package/dist/{chunk-SIZEIYNH.js → chunk-4XSAZPPS.js} +254 -18
  26. package/dist/chunk-4XSAZPPS.js.map +1 -0
  27. package/dist/{chunk-KUTU2YZF.js → chunk-5Q5Y34SS.js} +5 -5
  28. package/dist/{chunk-KUTU2YZF.js.map → chunk-5Q5Y34SS.js.map} +1 -1
  29. package/dist/{chunk-EH6SAGEO.cjs → chunk-64WGYTQK.cjs} +72 -53
  30. package/dist/{chunk-EH6SAGEO.cjs.map → chunk-64WGYTQK.cjs.map} +1 -1
  31. package/dist/{chunk-OOCEAC6U.cjs → chunk-65PHUUMF.cjs} +3 -3
  32. package/dist/{chunk-OOCEAC6U.cjs.map → chunk-65PHUUMF.cjs.map} +1 -1
  33. package/dist/{chunk-JNE2ABVB.js → chunk-7NKUSQEV.js} +1094 -10
  34. package/dist/chunk-7NKUSQEV.js.map +1 -0
  35. package/dist/{chunk-ZHFM7HCQ.js → chunk-AXHBJ4GX.js} +3 -3
  36. package/dist/{chunk-ZHFM7HCQ.js.map → chunk-AXHBJ4GX.js.map} +1 -1
  37. package/dist/{chunk-ILQXPZCD.js → chunk-AY6DBRS3.js} +37 -21
  38. package/dist/chunk-AY6DBRS3.js.map +1 -0
  39. package/dist/{chunk-TERSHTY5.cjs → chunk-BP7VYTOP.cjs} +1116 -21
  40. package/dist/chunk-BP7VYTOP.cjs.map +1 -0
  41. package/dist/{chunk-UE2G2LRP.cjs → chunk-CZ4NQANZ.cjs} +37 -21
  42. package/dist/chunk-CZ4NQANZ.cjs.map +1 -0
  43. package/dist/{chunk-NCC45KOB.cjs → chunk-DBSVT6AR.cjs} +7 -7
  44. package/dist/{chunk-NCC45KOB.cjs.map → chunk-DBSVT6AR.cjs.map} +1 -1
  45. package/dist/{chunk-BXLLXTT4.js → chunk-FLPEGTEK.js} +4 -4
  46. package/dist/{chunk-BXLLXTT4.js.map → chunk-FLPEGTEK.js.map} +1 -1
  47. package/dist/{chunk-ON2KVIUJ.cjs → chunk-HYRYTTMT.cjs} +7 -7
  48. package/dist/{chunk-ON2KVIUJ.cjs.map → chunk-HYRYTTMT.cjs.map} +1 -1
  49. package/dist/chunk-NJ7TL3LQ.js +1196 -0
  50. package/dist/chunk-NJ7TL3LQ.js.map +1 -0
  51. package/dist/{chunk-EUG4AON3.cjs → chunk-NKYWDNCI.cjs} +8 -7
  52. package/dist/{chunk-EUG4AON3.cjs.map → chunk-NKYWDNCI.cjs.map} +1 -1
  53. package/dist/{chunk-UHVG25VW.cjs → chunk-NZG2JAKS.cjs} +23 -15
  54. package/dist/chunk-NZG2JAKS.cjs.map +1 -0
  55. package/dist/{chunk-44SUGDBR.js → chunk-PS5ONCXY.js} +109 -5
  56. package/dist/chunk-PS5ONCXY.js.map +1 -0
  57. package/dist/{chunk-57QAF2ZQ.js → chunk-QTTWRCB5.js} +4 -4
  58. package/dist/{chunk-57QAF2ZQ.js.map → chunk-QTTWRCB5.js.map} +1 -1
  59. package/dist/{chunk-VM25PDSW.js → chunk-RZ4CIIZR.js} +4 -4
  60. package/dist/{chunk-VM25PDSW.js.map → chunk-RZ4CIIZR.js.map} +1 -1
  61. package/dist/{chunk-C3XU7ZDC.cjs → chunk-SU5APAM6.cjs} +123 -4
  62. package/dist/chunk-SU5APAM6.cjs.map +1 -0
  63. package/dist/{chunk-3MJCJLZS.js → chunk-U2HKJZCI.js} +24 -5
  64. package/dist/{chunk-3MJCJLZS.js.map → chunk-U2HKJZCI.js.map} +1 -1
  65. package/dist/{chunk-GCTAD6B7.cjs → chunk-VD5YA6RH.cjs} +12 -12
  66. package/dist/{chunk-GCTAD6B7.cjs.map → chunk-VD5YA6RH.cjs.map} +1 -1
  67. package/dist/{chunk-KAJNBNWP.cjs → chunk-YNNJLLFN.cjs} +4071 -3984
  68. package/dist/chunk-YNNJLLFN.cjs.map +1 -0
  69. package/dist/datasets/dataset.d.ts +153 -0
  70. package/dist/datasets/dataset.d.ts.map +1 -0
  71. package/dist/datasets/experiment/analytics/aggregate.d.ts +46 -0
  72. package/dist/datasets/experiment/analytics/aggregate.d.ts.map +1 -0
  73. package/dist/datasets/experiment/analytics/compare.d.ts +33 -0
  74. package/dist/datasets/experiment/analytics/compare.d.ts.map +1 -0
  75. package/dist/datasets/experiment/analytics/index.d.ts +9 -0
  76. package/dist/datasets/experiment/analytics/index.d.ts.map +1 -0
  77. package/dist/datasets/experiment/analytics/types.d.ts +103 -0
  78. package/dist/datasets/experiment/analytics/types.d.ts.map +1 -0
  79. package/dist/datasets/experiment/executor.d.ts +40 -0
  80. package/dist/datasets/experiment/executor.d.ts.map +1 -0
  81. package/dist/datasets/experiment/index.d.ts +31 -0
  82. package/dist/datasets/experiment/index.d.ts.map +1 -0
  83. package/dist/datasets/experiment/scorer.d.ts +21 -0
  84. package/dist/datasets/experiment/scorer.d.ts.map +1 -0
  85. package/dist/datasets/experiment/types.d.ts +140 -0
  86. package/dist/datasets/experiment/types.d.ts.map +1 -0
  87. package/dist/datasets/index.cjs +69 -0
  88. package/dist/datasets/index.cjs.map +1 -0
  89. package/dist/datasets/index.d.ts +6 -0
  90. package/dist/datasets/index.d.ts.map +1 -0
  91. package/dist/datasets/index.js +4 -0
  92. package/dist/datasets/index.js.map +1 -0
  93. package/dist/datasets/manager.d.ts +73 -0
  94. package/dist/datasets/manager.d.ts.map +1 -0
  95. package/dist/datasets/validation/errors.d.ts +44 -0
  96. package/dist/datasets/validation/errors.d.ts.map +1 -0
  97. package/dist/datasets/validation/index.d.ts +3 -0
  98. package/dist/datasets/validation/index.d.ts.map +1 -0
  99. package/dist/datasets/validation/validator.d.ts +24 -0
  100. package/dist/datasets/validation/validator.d.ts.map +1 -0
  101. package/dist/docs/SKILL.md +1 -3
  102. package/dist/docs/assets/SOURCE_MAP.json +436 -346
  103. package/dist/docs/references/docs-memory-observational-memory.md +86 -11
  104. package/dist/docs/references/docs-streaming-events.md +23 -0
  105. package/dist/docs/references/docs-workspace-filesystem.md +72 -1
  106. package/dist/docs/references/docs-workspace-overview.md +95 -12
  107. package/dist/docs/references/docs-workspace-sandbox.md +2 -0
  108. package/dist/docs/references/guides-agent-frameworks-ai-sdk.md +6 -2
  109. package/dist/docs/references/reference-ai-sdk-with-mastra.md +1 -1
  110. package/dist/docs/references/reference-memory-observational-memory.md +318 -9
  111. package/dist/docs/references/reference-streaming-workflows-stream.md +1 -0
  112. package/dist/docs/references/reference-workflows-workflow-methods-foreach.md +30 -0
  113. package/dist/docs/references/reference.md +3 -0
  114. package/dist/editor/index.d.ts +1 -1
  115. package/dist/editor/index.d.ts.map +1 -1
  116. package/dist/editor/types.d.ts +21 -3
  117. package/dist/editor/types.d.ts.map +1 -1
  118. package/dist/evals/index.cjs +20 -20
  119. package/dist/evals/index.js +3 -3
  120. package/dist/evals/scoreTraces/index.cjs +5 -5
  121. package/dist/evals/scoreTraces/index.js +2 -2
  122. package/dist/features/index.cjs +1 -1
  123. package/dist/features/index.cjs.map +1 -1
  124. package/dist/features/index.d.ts.map +1 -1
  125. package/dist/features/index.js +1 -1
  126. package/dist/features/index.js.map +1 -1
  127. package/dist/index.cjs +2 -7
  128. package/dist/index.d.ts +0 -9
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +1 -2
  131. package/dist/llm/index.cjs +10 -10
  132. package/dist/llm/index.js +2 -2
  133. package/dist/llm/model/provider-types.generated.d.ts +1694 -1659
  134. package/dist/loop/index.cjs +12 -12
  135. package/dist/loop/index.js +1 -1
  136. package/dist/loop/network/index.d.ts +1 -1
  137. package/dist/loop/workflows/agentic-execution/index.d.ts +1 -1
  138. package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
  139. package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
  140. package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
  141. package/dist/loop/workflows/agentic-loop/index.d.ts +1 -1
  142. package/dist/loop/workflows/errors.d.ts +4 -0
  143. package/dist/loop/workflows/errors.d.ts.map +1 -0
  144. package/dist/mastra/index.cjs +2 -2
  145. package/dist/mastra/index.d.ts +2 -0
  146. package/dist/mastra/index.d.ts.map +1 -1
  147. package/dist/mastra/index.js +1 -1
  148. package/dist/memory/index.cjs +14 -14
  149. package/dist/memory/index.js +1 -1
  150. package/dist/memory/memory.d.ts +5 -0
  151. package/dist/memory/memory.d.ts.map +1 -1
  152. package/dist/memory/types.d.ts +56 -0
  153. package/dist/memory/types.d.ts.map +1 -1
  154. package/dist/processors/index.cjs +41 -41
  155. package/dist/processors/index.js +1 -1
  156. package/dist/processors/processors/skills.d.ts +1 -1
  157. package/dist/processors/processors/skills.d.ts.map +1 -1
  158. package/dist/processors/runner.d.ts.map +1 -1
  159. package/dist/processors/trailing-assistant-guard.d.ts +34 -0
  160. package/dist/processors/trailing-assistant-guard.d.ts.map +1 -0
  161. package/dist/provider-registry-6LZAGQET.cjs +40 -0
  162. package/dist/{provider-registry-C6XCYX44.cjs.map → provider-registry-6LZAGQET.cjs.map} +1 -1
  163. package/dist/provider-registry-QUNT7S55.js +3 -0
  164. package/dist/{provider-registry-NWU4YFQW.js.map → provider-registry-QUNT7S55.js.map} +1 -1
  165. package/dist/provider-registry.json +4068 -3981
  166. package/dist/relevance/index.cjs +3 -3
  167. package/dist/relevance/index.js +1 -1
  168. package/dist/storage/base.d.ts +4 -1
  169. package/dist/storage/base.d.ts.map +1 -1
  170. package/dist/storage/constants.cjs +87 -27
  171. package/dist/storage/constants.d.ts +21 -2
  172. package/dist/storage/constants.d.ts.map +1 -1
  173. package/dist/storage/constants.js +1 -1
  174. package/dist/storage/domains/agents/inmemory.d.ts.map +1 -1
  175. package/dist/storage/domains/datasets/base.d.ts +83 -0
  176. package/dist/storage/domains/datasets/base.d.ts.map +1 -0
  177. package/dist/storage/domains/datasets/index.d.ts +3 -0
  178. package/dist/storage/domains/datasets/index.d.ts.map +1 -0
  179. package/dist/storage/domains/datasets/inmemory.d.ts +40 -0
  180. package/dist/storage/domains/datasets/inmemory.d.ts.map +1 -0
  181. package/dist/storage/domains/experiments/base.d.ts +28 -0
  182. package/dist/storage/domains/experiments/base.d.ts.map +1 -0
  183. package/dist/storage/domains/experiments/index.d.ts +3 -0
  184. package/dist/storage/domains/experiments/index.d.ts.map +1 -0
  185. package/dist/storage/domains/experiments/inmemory.d.ts +28 -0
  186. package/dist/storage/domains/experiments/inmemory.d.ts.map +1 -0
  187. package/dist/storage/domains/index.d.ts +3 -0
  188. package/dist/storage/domains/index.d.ts.map +1 -1
  189. package/dist/storage/domains/inmemory-db.d.ts +9 -1
  190. package/dist/storage/domains/inmemory-db.d.ts.map +1 -1
  191. package/dist/storage/domains/mcp-clients/base.d.ts +47 -0
  192. package/dist/storage/domains/mcp-clients/base.d.ts.map +1 -0
  193. package/dist/storage/domains/mcp-clients/index.d.ts +3 -0
  194. package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -0
  195. package/dist/storage/domains/mcp-clients/inmemory.d.ts +31 -0
  196. package/dist/storage/domains/mcp-clients/inmemory.d.ts.map +1 -0
  197. package/dist/storage/domains/operations/inmemory.d.ts.map +1 -1
  198. package/dist/storage/index.cjs +201 -117
  199. package/dist/storage/index.js +2 -2
  200. package/dist/storage/mock.d.ts.map +1 -1
  201. package/dist/storage/types.d.ts +338 -3
  202. package/dist/storage/types.d.ts.map +1 -1
  203. package/dist/stream/base/output.d.ts.map +1 -1
  204. package/dist/stream/index.cjs +11 -11
  205. package/dist/stream/index.js +2 -2
  206. package/dist/stream/types.d.ts +15 -0
  207. package/dist/stream/types.d.ts.map +1 -1
  208. package/dist/test-utils/llm-mock.cjs +4 -4
  209. package/dist/test-utils/llm-mock.js +1 -1
  210. package/dist/tool-loop-agent/index.cjs +4 -4
  211. package/dist/tool-loop-agent/index.js +1 -1
  212. package/dist/tool-provider/index.cjs +4 -0
  213. package/dist/tool-provider/index.cjs.map +1 -0
  214. package/dist/tool-provider/index.d.ts +2 -0
  215. package/dist/tool-provider/index.d.ts.map +1 -0
  216. package/dist/tool-provider/index.js +3 -0
  217. package/dist/tool-provider/index.js.map +1 -0
  218. package/dist/tool-provider/types.d.ts +113 -0
  219. package/dist/tool-provider/types.d.ts.map +1 -0
  220. package/dist/utils.cjs +23 -23
  221. package/dist/utils.d.ts +1 -1
  222. package/dist/utils.d.ts.map +1 -1
  223. package/dist/utils.js +1 -1
  224. package/dist/vector/index.cjs +7 -7
  225. package/dist/vector/index.js +1 -1
  226. package/dist/workflows/evented/index.cjs +10 -10
  227. package/dist/workflows/evented/index.js +1 -1
  228. package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
  229. package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
  230. package/dist/workflows/index.cjs +25 -25
  231. package/dist/workflows/index.js +1 -1
  232. package/dist/workflows/workflow.d.ts +2 -2
  233. package/dist/workflows/workflow.d.ts.map +1 -1
  234. package/dist/workspace/filesystem/filesystem.d.ts +5 -15
  235. package/dist/workspace/filesystem/filesystem.d.ts.map +1 -1
  236. package/dist/workspace/filesystem/local-filesystem.d.ts +18 -2
  237. package/dist/workspace/filesystem/local-filesystem.d.ts.map +1 -1
  238. package/dist/workspace/filesystem/mastra-filesystem.d.ts +21 -1
  239. package/dist/workspace/filesystem/mastra-filesystem.d.ts.map +1 -1
  240. package/dist/workspace/index.cjs +41 -41
  241. package/dist/workspace/index.d.ts +1 -1
  242. package/dist/workspace/index.d.ts.map +1 -1
  243. package/dist/workspace/index.js +1 -1
  244. package/dist/workspace/lifecycle.d.ts +49 -53
  245. package/dist/workspace/lifecycle.d.ts.map +1 -1
  246. package/dist/workspace/sandbox/local-sandbox.d.ts +1 -1
  247. package/dist/workspace/sandbox/local-sandbox.d.ts.map +1 -1
  248. package/dist/workspace/sandbox/mastra-sandbox.d.ts +3 -2
  249. package/dist/workspace/sandbox/mastra-sandbox.d.ts.map +1 -1
  250. package/dist/workspace/sandbox/sandbox.d.ts +3 -4
  251. package/dist/workspace/sandbox/sandbox.d.ts.map +1 -1
  252. package/dist/workspace/workspace.d.ts +2 -15
  253. package/dist/workspace/workspace.d.ts.map +1 -1
  254. package/package.json +7 -7
  255. package/src/llm/model/provider-types.generated.d.ts +1694 -1659
  256. package/tool-provider.d.ts +1 -0
  257. package/dist/chunk-2GWTJFVM.js.map +0 -1
  258. package/dist/chunk-44SUGDBR.js.map +0 -1
  259. package/dist/chunk-C3XU7ZDC.cjs.map +0 -1
  260. package/dist/chunk-CGPH7CMG.cjs.map +0 -1
  261. package/dist/chunk-ILQXPZCD.js.map +0 -1
  262. package/dist/chunk-JNE2ABVB.js.map +0 -1
  263. package/dist/chunk-KAJNBNWP.cjs.map +0 -1
  264. package/dist/chunk-PHYJYZ32.js.map +0 -1
  265. package/dist/chunk-SIZEIYNH.js.map +0 -1
  266. package/dist/chunk-TERSHTY5.cjs.map +0 -1
  267. package/dist/chunk-UE2G2LRP.cjs.map +0 -1
  268. package/dist/chunk-UHVG25VW.cjs.map +0 -1
  269. package/dist/chunk-WL3AW3YA.js.map +0 -1
  270. package/dist/chunk-YNXIGRQE.cjs.map +0 -1
  271. package/dist/docs/references/reference-cli-mastra.md +0 -336
  272. package/dist/docs/references/reference-deployer-cloudflare.md +0 -56
  273. package/dist/provider-registry-C6XCYX44.cjs +0 -40
  274. package/dist/provider-registry-NWU4YFQW.js +0 -3
@@ -1,336 +0,0 @@
1
- # CLI Commands
2
-
3
- You can use the Command-Line Interface (CLI) provided by Mastra to develop, build, and start your Mastra project.
4
-
5
- ## `mastra dev`
6
-
7
- Starts a server which exposes [Studio](https://mastra.ai/docs/getting-started/studio) and REST endpoints for your agents, tools, and workflows. You can visit <http://localhost:4111/swagger-ui> for an overview of all available endpoints once `mastra dev` is running.
8
-
9
- You can also [configure the server](https://mastra.ai/docs/getting-started/studio).
10
-
11
- ### Flags
12
-
13
- The command accepts [common flags](#common-flags) and the following additional flags:
14
-
15
- #### `--https`
16
-
17
- Enable local HTTPS support. [Learn more](https://mastra.ai/reference/configuration).
18
-
19
- #### `--inspect`
20
-
21
- Start the development server in inspect mode, helpful for debugging. Optionally specify a custom host and port (e.g., `--inspect=0.0.0.0:9229` for Docker). This can't be used together with `--inspect-brk`.
22
-
23
- #### `--inspect-brk`
24
-
25
- Start the development server in inspect mode and break at the beginning of the script. Optionally specify a custom host and port (e.g., `--inspect-brk=0.0.0.0:9229`). This can't be used together with `--inspect`.
26
-
27
- #### `--custom-args`
28
-
29
- Comma-separated list of custom arguments to pass to the Node.js process, e.g. `--require=newrelic` or `--experimental-transform-types`.
30
-
31
- #### `--request-context-presets`
32
-
33
- Path to a JSON file containing named [request context](https://mastra.ai/docs/server/request-context) presets. When provided, a dropdown appears in Studio's request context editor, letting you quickly switch between preset configurations.
34
-
35
- ```bash
36
- mastra dev --request-context-presets ./presets.json
37
- ```
38
-
39
- The file must be a JSON object where each key is a preset name and each value is an object:
40
-
41
- ```json
42
- {
43
- "development": { "userId": "dev-user", "env": "development" },
44
- "production": { "userId": "prod-user", "env": "production" }
45
- }
46
- ```
47
-
48
- ### Configs
49
-
50
- You can set certain environment variables to modify the behavior of `mastra dev`.
51
-
52
- #### Skip peer dependency check
53
-
54
- Set `MASTRA_SKIP_PEERDEP_CHECK=1` to skip the peer dependency version mismatch check at startup:
55
-
56
- ```bash
57
- MASTRA_SKIP_PEERDEP_CHECK=1 mastra dev
58
- ```
59
-
60
- This is useful during monorepo development when peer dependencies may be bumped but packages are not yet published.
61
-
62
- #### Disable build caching
63
-
64
- Set `MASTRA_DEV_NO_CACHE=1` to force a full rebuild rather than using the cached assets under `.mastra/`:
65
-
66
- ```bash
67
- MASTRA_DEV_NO_CACHE=1 mastra dev
68
- ```
69
-
70
- This helps when you are debugging bundler plugins or suspect stale output.
71
-
72
- #### Limit parallelism
73
-
74
- `MASTRA_CONCURRENCY` caps how many expensive operations run in parallel (primarily build and evaluation steps). For example:
75
-
76
- ```bash
77
- MASTRA_CONCURRENCY=4 mastra dev
78
- ```
79
-
80
- Leave it unset to let the CLI pick a sensible default for the machine.
81
-
82
- #### Custom provider endpoints
83
-
84
- When using providers supported by the Vercel AI SDK you can redirect requests through proxies or internal gateways by setting a base URL. For OpenAI:
85
-
86
- ```bash
87
- OPENAI_API_KEY=<your-api-key> \
88
- OPENAI_BASE_URL=https://openrouter.example/v1 \
89
- mastra dev
90
- ```
91
-
92
- For Anthropic:
93
-
94
- ```bash
95
- ANTHROPIC_API_KEY=<your-api-key> \
96
- ANTHROPIC_BASE_URL=https://anthropic.internal \
97
- mastra dev
98
- ```
99
-
100
- These are forwarded to the Mastra model router and will work with any `"openai/..."` or `"anthropic/..."` model selections.
101
-
102
- ## `mastra build`
103
-
104
- The `mastra build` command bundles your Mastra project into a production-ready Hono server. [Hono](https://hono.dev/) is a lightweight, type-safe web framework that makes it easy to deploy Mastra agents as HTTP endpoints with middleware support.
105
-
106
- Under the hood Mastra's Rollup server locates your Mastra entry file and bundles it to a production-ready Hono server. During that bundling it tree-shakes your code and generates source maps for debugging.
107
-
108
- The output in `.mastra` can be deployed to any cloud server using [`mastra start`](#mastra-start).
109
-
110
- If you're deploying to a [serverless platform](https://mastra.ai/docs/deployment/cloud-providers) you need to install the correct deployer in order to receive the correct output in `.mastra`.
111
-
112
- It accepts [common flags](#common-flags).
113
-
114
- ### Flags
115
-
116
- #### `--studio`
117
-
118
- Bundle the Studio UI with the build.
119
-
120
- ### Configs
121
-
122
- You can set certain environment variables to modify the behavior of `mastra build`.
123
-
124
- #### Skip peer dependency check
125
-
126
- Set `MASTRA_SKIP_PEERDEP_CHECK=1` to skip the peer dependency version mismatch check:
127
-
128
- ```bash
129
- MASTRA_SKIP_PEERDEP_CHECK=1 mastra build
130
- ```
131
-
132
- #### Limit parallelism
133
-
134
- For CI or when running in resource constrained environments you can cap how many expensive tasks run at once by setting `MASTRA_CONCURRENCY`.
135
-
136
- ```bash
137
- MASTRA_CONCURRENCY=2 mastra build
138
- ```
139
-
140
- ## `mastra start`
141
-
142
- > **Info:** You need to run `mastra build` before using `mastra start`.
143
-
144
- Starts a local server to serve your built Mastra application in production mode. By default, [OTEL Tracing](https://mastra.ai/docs/observability/tracing/overview) is enabled.
145
-
146
- ### Flags
147
-
148
- The command accepts [common flags](#common-flags) and the following additional flags:
149
-
150
- #### `--dir`
151
-
152
- The path to your built Mastra output directory. Defaults to `.mastra/output`.
153
-
154
- #### `--custom-args`
155
-
156
- Comma-separated list of custom arguments to pass to the Node.js process, e.g. `--require=newrelic` or `--experimental-transform-types`.
157
-
158
- ## `mastra studio`
159
-
160
- Starts [Mastra Studio](https://mastra.ai/docs/getting-started/studio) as a static server. After starting, you can enter your Mastra instance URL (e.g. `http://localhost:4111`) to connect Studio to your Mastra backend.
161
-
162
- ### Flags
163
-
164
- The command accepts [common flags](#common-flags) and the following additional flags:
165
-
166
- #### `--port`
167
-
168
- The port to run Studio on. Defaults to `3000`.
169
-
170
- #### `--server-host`
171
-
172
- The host of the Mastra API server to connect to. Defaults to `localhost`.
173
-
174
- #### `--server-port`
175
-
176
- The port of the Mastra API server to connect to. Defaults to `4111`.
177
-
178
- #### `--server-protocol`
179
-
180
- The protocol of the Mastra API server to connect to. Defaults to `http`.
181
-
182
- #### `--request-context-presets`
183
-
184
- Path to a JSON file containing named [request context](https://mastra.ai/docs/server/request-context) presets. Works the same as the [`mastra dev` flag](#--request-context-presets).
185
-
186
- ```bash
187
- mastra studio --request-context-presets ./presets.json
188
- ```
189
-
190
- ## `mastra lint`
191
-
192
- The `mastra lint` command validates the structure and code of your Mastra project to ensure it follows best practices and is error-free.
193
-
194
- It accepts [common flags](#common-flags).
195
-
196
- ## `mastra scorers`
197
-
198
- The `mastra scorers` command provides management capabilities for evaluation scorers that measure the quality, accuracy, and performance of AI-generated outputs.
199
-
200
- Read the [Scorers overview](https://mastra.ai/docs/evals/overview) to learn more.
201
-
202
- ### `add`
203
-
204
- Add a new scorer to your project. You can use an interactive prompt:
205
-
206
- ```bash
207
- mastra scorers add
208
- ```
209
-
210
- Or provide a scorer name directly:
211
-
212
- ```bash
213
- mastra scorers add answer-relevancy
214
- ```
215
-
216
- Use the [`list`](#list) command to get the correct ID.
217
-
218
- ### `list`
219
-
220
- List all available scorer templates. Use the ID for the `add` command.
221
-
222
- ## `mastra init`
223
-
224
- The `mastra init` command initializes Mastra in an existing project. Use this command to scaffold the necessary folders and configuration without generating a new project from scratch.
225
-
226
- ### Flags
227
-
228
- The command accepts the following additional flags:
229
-
230
- #### `--default`
231
-
232
- Creates files inside `src` using OpenAI. It also populates the `src/mastra` folders with example code.
233
-
234
- #### `--dir`
235
-
236
- The directory where Mastra files should be saved to. Defaults to `src`.
237
-
238
- #### `--components`
239
-
240
- Comma-separated list of components to add. For each component a new folder will be created. Choose from: `"agents" | "tools" | "workflows" | "scorers"`. Defaults to `['agents', 'tools', 'workflows']`.
241
-
242
- #### `--llm`
243
-
244
- Default model provider. Choose from: `"openai" | "anthropic" | "groq" | "google" | "cerebras" | "mistral"`.
245
-
246
- #### `--llm-api-key`
247
-
248
- The API key for your chosen model provider. Will be written to an environment variables file (`.env`).
249
-
250
- #### `--example`
251
-
252
- If enabled, example code is written to the list of components (e.g. example agent code).
253
-
254
- #### `--no-example`
255
-
256
- Do not include example code. Useful when using the `--default` flag.
257
-
258
- #### `--mcp`
259
-
260
- Configure your code editor with Mastra's MCP server. Choose from: `"cursor" | "cursor-global" | "windsurf" | "vscode"`.
261
-
262
- ## `mastra migrate`
263
-
264
- Runs database migrations to update your storage schema. This command is useful when upgrading Mastra versions that include storage schema changes.
265
-
266
- The command bundles your project, connects to your configured storage backend, and executes any pending migrations. Currently supports:
267
-
268
- - **Duplicate spans migration**: Removes duplicate `(traceId, spanId)` entries and adds a unique constraint to ensure data integrity.
269
-
270
- ```bash
271
- mastra migrate
272
- ```
273
-
274
- See the [Storage migration guide](https://mastra.ai/guides/migrations/upgrade-to-v1/storage) for details on when migrations are needed.
275
-
276
- It accepts [common flags](#common-flags).
277
-
278
- ## Common flags
279
-
280
- ### `--dir`
281
-
282
- **Available in:** `dev`, `build`, `lint`, `migrate`
283
-
284
- The path to your Mastra folder. Defaults to `src/mastra`.
285
-
286
- ### `--debug`
287
-
288
- **Available in:** `dev`, `build`, `migrate`
289
-
290
- Enable verbose logging for Mastra's internals. Defaults to `false`.
291
-
292
- ### `--env`
293
-
294
- **Available in:** `dev`, `start`, `studio`, `migrate`
295
-
296
- Custom environment variables file to include. By default, includes `.env.development`, `.env.local`, and `.env`.
297
-
298
- ### `--root`
299
-
300
- **Available in:** `dev`, `build`, `lint`, `migrate`
301
-
302
- Path to your root folder. Defaults to `process.cwd()`.
303
-
304
- ### `--tools`
305
-
306
- **Available in:** `dev`, `build`, `lint`
307
-
308
- Comma-separated list of tool paths to include. Defaults to `src/mastra/tools`.
309
-
310
- ## Global flags
311
-
312
- Use these flags to get information about the `mastra` CLI.
313
-
314
- ### `--version`
315
-
316
- Prints the Mastra CLI version and exits.
317
-
318
- ### `--help`
319
-
320
- Prints help message and exits.
321
-
322
- ## Telemetry
323
-
324
- By default, Mastra collects anonymous information about your project like your OS, Mastra version or Node.js version. You can read the [source code](https://github.com/mastra-ai/mastra/blob/main/packages/cli/src/analytics/index.ts) to check what's collected.
325
-
326
- You can opt out of the CLI analytics by setting an environment variable:
327
-
328
- ```bash
329
- MASTRA_TELEMETRY_DISABLED=1
330
- ```
331
-
332
- You can also set this while using other `mastra` commands:
333
-
334
- ```bash
335
- MASTRA_TELEMETRY_DISABLED=1 mastra dev
336
- ```
@@ -1,56 +0,0 @@
1
- # CloudflareDeployer
2
-
3
- The `CloudflareDeployer` class handles deployment of standalone Mastra applications to Cloudflare Workers. It manages configuration, deployment, and extends the base [Deployer](https://mastra.ai/reference/deployer) class with Cloudflare specific functionality.
4
-
5
- ## Usage example
6
-
7
- ```typescript
8
- import { Mastra } from "@mastra/core";
9
- import { CloudflareDeployer } from "@mastra/deployer-cloudflare";
10
-
11
- export const mastra = new Mastra({
12
- deployer: new CloudflareDeployer({
13
- name: "hello-mastra",
14
- routes: [
15
- {
16
- pattern: "example.com/*",
17
- zone_name: "example.com",
18
- custom_domain: true
19
- }
20
- ],
21
- vars: {
22
- NODE_ENV: "production",
23
- API_KEY: "<api-key>"
24
- },
25
- d1_databases: [
26
- {
27
- binding: "DB",
28
- database_name: "my-database",
29
- database_id: "d1-database-id",
30
- preview_database_id: "your-preview-database-id"
31
- }
32
- ],
33
- kv_namespaces: [
34
- {
35
- binding: "CACHE",
36
- id: "kv-namespace-id"
37
- }
38
- ]
39
- })
40
- });
41
- ```
42
-
43
- ## Constructor options
44
-
45
- The `CloudflareDeployer` constructor accepts the same configuration options as `wrangler.json`. See the [Wrangler configuration documentation](https://developers.cloudflare.com/workers/wrangler/configuration/) for all available options.
46
-
47
- ### Migrating from earlier versions
48
-
49
- The following fields are deprecated and should be replaced with their standard `wrangler.json` equivalents:
50
-
51
- | Deprecated | Use instead |
52
- | ----------------- | --------------------------- |
53
- | `projectName` | `name` |
54
- | `d1Databases` | `d1_databases` |
55
- | `kvNamespaces` | `kv_namespaces` |
56
- | `workerNamespace` | _(removed, no longer used)_ |
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkKAJNBNWP_cjs = require('./chunk-KAJNBNWP.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "GatewayRegistry", {
8
- enumerable: true,
9
- get: function () { return chunkKAJNBNWP_cjs.GatewayRegistry; }
10
- });
11
- Object.defineProperty(exports, "PROVIDER_MODELS", {
12
- enumerable: true,
13
- get: function () { return chunkKAJNBNWP_cjs.PROVIDER_MODELS; }
14
- });
15
- Object.defineProperty(exports, "PROVIDER_REGISTRY", {
16
- enumerable: true,
17
- get: function () { return chunkKAJNBNWP_cjs.PROVIDER_REGISTRY; }
18
- });
19
- Object.defineProperty(exports, "getProviderConfig", {
20
- enumerable: true,
21
- get: function () { return chunkKAJNBNWP_cjs.getProviderConfig; }
22
- });
23
- Object.defineProperty(exports, "getRegisteredProviders", {
24
- enumerable: true,
25
- get: function () { return chunkKAJNBNWP_cjs.getRegisteredProviders; }
26
- });
27
- Object.defineProperty(exports, "isProviderRegistered", {
28
- enumerable: true,
29
- get: function () { return chunkKAJNBNWP_cjs.isProviderRegistered; }
30
- });
31
- Object.defineProperty(exports, "isValidModelId", {
32
- enumerable: true,
33
- get: function () { return chunkKAJNBNWP_cjs.isValidModelId; }
34
- });
35
- Object.defineProperty(exports, "parseModelString", {
36
- enumerable: true,
37
- get: function () { return chunkKAJNBNWP_cjs.parseModelString; }
38
- });
39
- //# sourceMappingURL=provider-registry-C6XCYX44.cjs.map
40
- //# sourceMappingURL=provider-registry-C6XCYX44.cjs.map
@@ -1,3 +0,0 @@
1
- export { GatewayRegistry, PROVIDER_MODELS, PROVIDER_REGISTRY, getProviderConfig, getRegisteredProviders, isProviderRegistered, isValidModelId, parseModelString } from './chunk-WL3AW3YA.js';
2
- //# sourceMappingURL=provider-registry-NWU4YFQW.js.map
3
- //# sourceMappingURL=provider-registry-NWU4YFQW.js.map