@mastra/deployer 1.54.0-alpha.0 → 1.54.0-alpha.2

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 (211) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/analyze-C2q7jxbN.js +1308 -0
  3. package/dist/analyze-C2q7jxbN.js.map +1 -0
  4. package/dist/analyze-DhDZW9TS.cjs +1318 -0
  5. package/dist/analyze-DhDZW9TS.cjs.map +1 -0
  6. package/dist/arktype-aI7TBD0R-BsgjPZ4a.cjs +8 -0
  7. package/dist/arktype-aI7TBD0R-BsgjPZ4a.cjs.map +1 -0
  8. package/dist/arktype-aI7TBD0R-_UZl-wsH.js +8 -0
  9. package/dist/arktype-aI7TBD0R-_UZl-wsH.js.map +1 -0
  10. package/dist/build/analyze/constants.d.ts.map +1 -1
  11. package/dist/build/analyze.cjs +3 -12
  12. package/dist/build/analyze.js +2 -3
  13. package/dist/build/bundler.cjs +6 -24
  14. package/dist/build/bundler.js +2 -3
  15. package/dist/build/index.cjs +29 -101
  16. package/dist/build/index.js +7 -8
  17. package/dist/build-De4AZhfJ.cjs +908 -0
  18. package/dist/build-De4AZhfJ.cjs.map +1 -0
  19. package/dist/build-KCOeHd4N.js +834 -0
  20. package/dist/build-KCOeHd4N.js.map +1 -0
  21. package/dist/bundler/index.cjs +318 -13
  22. package/dist/bundler/index.cjs.map +1 -1
  23. package/dist/bundler/index.js +314 -2
  24. package/dist/bundler/index.js.map +1 -1
  25. package/dist/bundler-BqrDXofn.cjs +792 -0
  26. package/dist/bundler-BqrDXofn.cjs.map +1 -0
  27. package/dist/bundler-D86rFu2J.js +705 -0
  28. package/dist/bundler-D86rFu2J.js.map +1 -0
  29. package/dist/bundlerOptions-aFsEi86t.js +180 -0
  30. package/dist/bundlerOptions-aFsEi86t.js.map +1 -0
  31. package/dist/bundlerOptions-rBmtSyGe.cjs +194 -0
  32. package/dist/bundlerOptions-rBmtSyGe.cjs.map +1 -0
  33. package/dist/core-D0wEgdn3.cjs +790 -0
  34. package/dist/core-D0wEgdn3.cjs.map +1 -0
  35. package/dist/core-DF65PJXc.js +790 -0
  36. package/dist/core-DF65PJXc.js.map +1 -0
  37. package/dist/dist-BauTimif.js +532 -0
  38. package/dist/dist-BauTimif.js.map +1 -0
  39. package/dist/dist-Cv-mAEtr.cjs +532 -0
  40. package/dist/dist-Cv-mAEtr.cjs.map +1 -0
  41. package/dist/docs/SKILL.md +1 -1
  42. package/dist/docs/assets/SOURCE_MAP.json +2 -23
  43. package/dist/docs/references/docs-deployment-cloud-providers.md +1 -0
  44. package/dist/docs/references/docs-deployment-overview.md +1 -0
  45. package/dist/effect-QlVUlMFu-CwFnyS-g.cjs +14 -0
  46. package/dist/effect-QlVUlMFu-CwFnyS-g.cjs.map +1 -0
  47. package/dist/effect-QlVUlMFu-gyLQRCtQ.js +14 -0
  48. package/dist/effect-QlVUlMFu-gyLQRCtQ.js.map +1 -0
  49. package/dist/esm-BX-weMyC.js +4634 -0
  50. package/dist/esm-BX-weMyC.js.map +1 -0
  51. package/dist/esm-D81PZ_wJ.cjs +4634 -0
  52. package/dist/esm-D81PZ_wJ.cjs.map +1 -0
  53. package/dist/index-CLddUTqr-B5mOP6DC.cjs +145 -0
  54. package/dist/index-CLddUTqr-B5mOP6DC.cjs.map +1 -0
  55. package/dist/index-CLddUTqr-CkS6Y_hA.js +140 -0
  56. package/dist/index-CLddUTqr-CkS6Y_hA.js.map +1 -0
  57. package/dist/index.cjs +35 -48
  58. package/dist/index.cjs.map +1 -1
  59. package/dist/index.js +29 -30
  60. package/dist/index.js.map +1 -1
  61. package/dist/rolldown-runtime-emK7D4bc.cjs +35 -0
  62. package/dist/server/index.cjs +3141 -3874
  63. package/dist/server/index.cjs.map +1 -1
  64. package/dist/server/index.d.ts.map +1 -1
  65. package/dist/server/index.js +3131 -3842
  66. package/dist/server/index.js.map +1 -1
  67. package/dist/server/types.d.ts +1 -0
  68. package/dist/server/types.d.ts.map +1 -1
  69. package/dist/services/index.cjs +5 -20
  70. package/dist/services/index.js +2 -3
  71. package/dist/services-BxYMLS9-.cjs +430 -0
  72. package/dist/services-BxYMLS9-.cjs.map +1 -0
  73. package/dist/services-CLi56qqe.js +391 -0
  74. package/dist/services-CLi56qqe.js.map +1 -0
  75. package/dist/sury-CWZTCd75-B85M6878.js +14 -0
  76. package/dist/sury-CWZTCd75-B85M6878.js.map +1 -0
  77. package/dist/sury-CWZTCd75-DTj5HlK_.cjs +14 -0
  78. package/dist/sury-CWZTCd75-DTj5HlK_.cjs.map +1 -0
  79. package/dist/typebox-Dei93FPO-BeuT13_G.cjs +8 -0
  80. package/dist/typebox-Dei93FPO-BeuT13_G.cjs.map +1 -0
  81. package/dist/typebox-Dei93FPO-DovwMlVl.js +8 -0
  82. package/dist/typebox-Dei93FPO-DovwMlVl.js.map +1 -0
  83. package/dist/utils-FVOUvj-I.js +190 -0
  84. package/dist/utils-FVOUvj-I.js.map +1 -0
  85. package/dist/utils-O98BGdnP.cjs +267 -0
  86. package/dist/utils-O98BGdnP.cjs.map +1 -0
  87. package/dist/valibot--1zFm7rT-BqJHja5B.cjs +14 -0
  88. package/dist/valibot--1zFm7rT-BqJHja5B.cjs.map +1 -0
  89. package/dist/valibot--1zFm7rT-Y4Fhea0w.js +14 -0
  90. package/dist/valibot--1zFm7rT-Y4Fhea0w.js.map +1 -0
  91. package/dist/validator/custom-resolver.cjs +71 -73
  92. package/dist/validator/custom-resolver.cjs.map +1 -1
  93. package/dist/validator/custom-resolver.js +70 -71
  94. package/dist/validator/custom-resolver.js.map +1 -1
  95. package/dist/validator/loader.cjs +6 -7
  96. package/dist/validator/loader.cjs.map +1 -1
  97. package/dist/validator/loader.js +8 -4
  98. package/dist/validator/loader.js.map +1 -1
  99. package/dist/zod-Bwrt9trS-2JL6_UI_.cjs +23 -0
  100. package/dist/zod-Bwrt9trS-2JL6_UI_.cjs.map +1 -0
  101. package/dist/zod-Bwrt9trS-rVHICsmp.js +23 -0
  102. package/dist/zod-Bwrt9trS-rVHICsmp.js.map +1 -0
  103. package/package.json +7 -7
  104. package/dist/arktype-aI7TBD0R-K3QZAVE2.js +0 -8
  105. package/dist/arktype-aI7TBD0R-K3QZAVE2.js.map +0 -1
  106. package/dist/arktype-aI7TBD0R-WK5AZZMC.cjs +0 -10
  107. package/dist/arktype-aI7TBD0R-WK5AZZMC.cjs.map +0 -1
  108. package/dist/build/analyze.cjs.map +0 -1
  109. package/dist/build/analyze.js.map +0 -1
  110. package/dist/build/bundler.cjs.map +0 -1
  111. package/dist/build/bundler.js.map +0 -1
  112. package/dist/build/index.cjs.map +0 -1
  113. package/dist/build/index.js.map +0 -1
  114. package/dist/chunk-36AWZH7Z.cjs +0 -252
  115. package/dist/chunk-36AWZH7Z.cjs.map +0 -1
  116. package/dist/chunk-3XIMK24X.cjs +0 -765
  117. package/dist/chunk-3XIMK24X.cjs.map +0 -1
  118. package/dist/chunk-46M65MQG.cjs +0 -95
  119. package/dist/chunk-46M65MQG.cjs.map +0 -1
  120. package/dist/chunk-4ZNTNJ6T.js +0 -6
  121. package/dist/chunk-4ZNTNJ6T.js.map +0 -1
  122. package/dist/chunk-5PORNUPF.js +0 -739
  123. package/dist/chunk-5PORNUPF.js.map +0 -1
  124. package/dist/chunk-743HRNWT.cjs +0 -1546
  125. package/dist/chunk-743HRNWT.cjs.map +0 -1
  126. package/dist/chunk-AEQ7JHDB.cjs +0 -412
  127. package/dist/chunk-AEQ7JHDB.cjs.map +0 -1
  128. package/dist/chunk-E5SBYHQK.js +0 -244
  129. package/dist/chunk-E5SBYHQK.js.map +0 -1
  130. package/dist/chunk-FKKJQUGR.cjs +0 -497
  131. package/dist/chunk-FKKJQUGR.cjs.map +0 -1
  132. package/dist/chunk-FQHUOYYL.js +0 -1514
  133. package/dist/chunk-FQHUOYYL.js.map +0 -1
  134. package/dist/chunk-G7MIMGMX.js +0 -14
  135. package/dist/chunk-G7MIMGMX.js.map +0 -1
  136. package/dist/chunk-HZC3PTK2.cjs +0 -16
  137. package/dist/chunk-HZC3PTK2.cjs.map +0 -1
  138. package/dist/chunk-JZRFRUGM.cjs +0 -158
  139. package/dist/chunk-JZRFRUGM.cjs.map +0 -1
  140. package/dist/chunk-L45X3DJX.js +0 -385
  141. package/dist/chunk-L45X3DJX.js.map +0 -1
  142. package/dist/chunk-PC25XSK7.cjs +0 -8
  143. package/dist/chunk-PC25XSK7.cjs.map +0 -1
  144. package/dist/chunk-PZ5AY32C.js +0 -9
  145. package/dist/chunk-PZ5AY32C.js.map +0 -1
  146. package/dist/chunk-Q7SFCCGT.cjs +0 -11
  147. package/dist/chunk-Q7SFCCGT.cjs.map +0 -1
  148. package/dist/chunk-T4UT2QX7.js +0 -3
  149. package/dist/chunk-T4UT2QX7.js.map +0 -1
  150. package/dist/chunk-UBIDJOJA.js +0 -93
  151. package/dist/chunk-UBIDJOJA.js.map +0 -1
  152. package/dist/chunk-V3EKV6QB.cjs +0 -162
  153. package/dist/chunk-V3EKV6QB.cjs.map +0 -1
  154. package/dist/chunk-WHD2QQ3N.js +0 -783
  155. package/dist/chunk-WHD2QQ3N.js.map +0 -1
  156. package/dist/chunk-WP65JQAT.js +0 -144
  157. package/dist/chunk-WP65JQAT.js.map +0 -1
  158. package/dist/chunk-YO5OFXPN.cjs +0 -819
  159. package/dist/chunk-YO5OFXPN.cjs.map +0 -1
  160. package/dist/chunk-YUBKHO52.js +0 -465
  161. package/dist/chunk-YUBKHO52.js.map +0 -1
  162. package/dist/chunk-YWMYXUHX.cjs +0 -4
  163. package/dist/chunk-YWMYXUHX.cjs.map +0 -1
  164. package/dist/chunk-ZKZOVNT4.js +0 -159
  165. package/dist/chunk-ZKZOVNT4.js.map +0 -1
  166. package/dist/core-XIDAXLRB.js +0 -11866
  167. package/dist/core-XIDAXLRB.js.map +0 -1
  168. package/dist/core-XJNQ4AY6.cjs +0 -12141
  169. package/dist/core-XJNQ4AY6.cjs.map +0 -1
  170. package/dist/default-u_dwuiYb-HGUAHA6N.cjs +0 -9
  171. package/dist/default-u_dwuiYb-HGUAHA6N.cjs.map +0 -1
  172. package/dist/default-u_dwuiYb-MVPTVDCE.js +0 -3
  173. package/dist/default-u_dwuiYb-MVPTVDCE.js.map +0 -1
  174. package/dist/dist-UEE5OLII.cjs +0 -521
  175. package/dist/dist-UEE5OLII.cjs.map +0 -1
  176. package/dist/dist-X75F2Q36.js +0 -515
  177. package/dist/dist-X75F2Q36.js.map +0 -1
  178. package/dist/effect-QlVUlMFu-QNLZLGWO.js +0 -15
  179. package/dist/effect-QlVUlMFu-QNLZLGWO.js.map +0 -1
  180. package/dist/effect-QlVUlMFu-XUD6EH23.cjs +0 -17
  181. package/dist/effect-QlVUlMFu-XUD6EH23.cjs.map +0 -1
  182. package/dist/esm-DFCHSIJZ.cjs +0 -1589
  183. package/dist/esm-DFCHSIJZ.cjs.map +0 -1
  184. package/dist/esm-PXGQ5WB4.js +0 -1542
  185. package/dist/esm-PXGQ5WB4.js.map +0 -1
  186. package/dist/services/index.cjs.map +0 -1
  187. package/dist/services/index.js.map +0 -1
  188. package/dist/sury-CWZTCd75-3KQQJ22C.cjs +0 -17
  189. package/dist/sury-CWZTCd75-3KQQJ22C.cjs.map +0 -1
  190. package/dist/sury-CWZTCd75-DZQHKAZF.js +0 -15
  191. package/dist/sury-CWZTCd75-DZQHKAZF.js.map +0 -1
  192. package/dist/typebox-Dei93FPO-GOYJ5OUT.js +0 -8
  193. package/dist/typebox-Dei93FPO-GOYJ5OUT.js.map +0 -1
  194. package/dist/typebox-Dei93FPO-M7J7E57W.cjs +0 -10
  195. package/dist/typebox-Dei93FPO-M7J7E57W.cjs.map +0 -1
  196. package/dist/valibot--1zFm7rT-NVM3G3TI.cjs +0 -17
  197. package/dist/valibot--1zFm7rT-NVM3G3TI.cjs.map +0 -1
  198. package/dist/valibot--1zFm7rT-ZVGQI7WV.js +0 -15
  199. package/dist/valibot--1zFm7rT-ZVGQI7WV.js.map +0 -1
  200. package/dist/valibot-D_HTw1Gn-UCPEGDL7.cjs +0 -45
  201. package/dist/valibot-D_HTw1Gn-UCPEGDL7.cjs.map +0 -1
  202. package/dist/valibot-D_HTw1Gn-XPR4F6VS.js +0 -43
  203. package/dist/valibot-D_HTw1Gn-XPR4F6VS.js.map +0 -1
  204. package/dist/zod-Bwrt9trS-GN7ZXBMN.js +0 -29
  205. package/dist/zod-Bwrt9trS-GN7ZXBMN.js.map +0 -1
  206. package/dist/zod-Bwrt9trS-OVKARV6W.cjs +0 -31
  207. package/dist/zod-Bwrt9trS-OVKARV6W.cjs.map +0 -1
  208. package/dist/zod-DSgpEGAE-E7YZZ7VC.js +0 -37
  209. package/dist/zod-DSgpEGAE-E7YZZ7VC.js.map +0 -1
  210. package/dist/zod-DSgpEGAE-UNQNGL2W.cjs +0 -39
  211. package/dist/zod-DSgpEGAE-UNQNGL2W.cjs.map +0 -1
@@ -1,819 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk36AWZH7Z_cjs = require('./chunk-36AWZH7Z.cjs');
4
- var chunk743HRNWT_cjs = require('./chunk-743HRNWT.cjs');
5
- var chunk3XIMK24X_cjs = require('./chunk-3XIMK24X.cjs');
6
- var chunkJZRFRUGM_cjs = require('./chunk-JZRFRUGM.cjs');
7
- var path = require('path');
8
- var logger = require('@mastra/core/logger');
9
- var pkg = require('empathic/package');
10
- var rollup = require('rollup');
11
- var promises = require('fs/promises');
12
- var core = require('@babel/core');
13
- var agent = require('@mastra/core/agent');
14
- var matter = require('gray-matter');
15
-
16
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
17
-
18
- function _interopNamespace(e) {
19
- if (e && e.__esModule) return e;
20
- var n = Object.create(null);
21
- if (e) {
22
- Object.keys(e).forEach(function (k) {
23
- if (k !== 'default') {
24
- var d = Object.getOwnPropertyDescriptor(e, k);
25
- Object.defineProperty(n, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () { return e[k]; }
28
- });
29
- }
30
- });
31
- }
32
- n.default = e;
33
- return Object.freeze(n);
34
- }
35
-
36
- var pkg__namespace = /*#__PURE__*/_interopNamespace(pkg);
37
- var matter__default = /*#__PURE__*/_interopDefault(matter);
38
-
39
- async function getInputOptions2(entryFile, platform, env, {
40
- sourcemap = false,
41
- bundlerOptions = {
42
- enableSourcemap: false,
43
- enableEsmShim: true,
44
- externals: true
45
- },
46
- analysisEntries = [entryFile]
47
- } = {}) {
48
- const closestPkgJson = pkg__namespace.up({ cwd: path.dirname(entryFile) });
49
- const projectRoot = closestPkgJson ? path.dirname(chunkJZRFRUGM_cjs.slash(closestPkgJson)) : chunkJZRFRUGM_cjs.slash(process.cwd());
50
- const { workspaceMap, workspaceRoot } = await chunk743HRNWT_cjs.getWorkspaceInformation({ mastraEntryFile: entryFile });
51
- const analyzeEntryResult = await chunk743HRNWT_cjs.analyzeBundle(
52
- analysisEntries,
53
- entryFile,
54
- {
55
- outputDir: path.posix.join(process.cwd(), ".mastra", ".build"),
56
- projectRoot: workspaceRoot || process.cwd(),
57
- platform,
58
- isDev: true,
59
- bundlerOptions
60
- },
61
- logger.noopLogger
62
- );
63
- const deps = /* @__PURE__ */ new Map();
64
- for (const [dep, metadata] of analyzeEntryResult.dependencies.entries()) {
65
- const pkgName = chunkJZRFRUGM_cjs.getPackageName(dep);
66
- if (pkgName && workspaceMap.has(pkgName)) {
67
- deps.set(dep, metadata);
68
- }
69
- }
70
- const inputOptions = await chunk3XIMK24X_cjs.getInputOptions(
71
- entryFile,
72
- {
73
- dependencies: deps,
74
- externalDependencies: /* @__PURE__ */ new Map(),
75
- workspaceMap
76
- },
77
- platform,
78
- env,
79
- { sourcemap, isDev: true, workspaceRoot, projectRoot, externalsPreset: bundlerOptions?.externals === true }
80
- );
81
- if (Array.isArray(inputOptions.plugins)) {
82
- const plugins = [];
83
- inputOptions.plugins.forEach((plugin) => {
84
- if (plugin?.name === "node-resolve") {
85
- return;
86
- }
87
- if (plugin?.name === "tsconfig-paths") {
88
- plugins.push(
89
- chunk3XIMK24X_cjs.tsConfigPaths({
90
- localResolve: true
91
- })
92
- );
93
- return;
94
- }
95
- plugins.push(plugin);
96
- });
97
- inputOptions.plugins = plugins;
98
- inputOptions.plugins.push(chunk743HRNWT_cjs.aliasHono());
99
- inputOptions.plugins.push(chunk3XIMK24X_cjs.nodeModulesExtensionResolver());
100
- }
101
- return inputOptions;
102
- }
103
- async function createWatcher(inputOptions, outputOptions) {
104
- const watcher = await rollup.watch({
105
- ...inputOptions,
106
- output: {
107
- ...outputOptions,
108
- format: "esm",
109
- entryFileNames: "[name].mjs",
110
- chunkFileNames: "[name].mjs"
111
- }
112
- });
113
- return watcher;
114
- }
115
- async function analyzeEntryProjectType(mastraEntry) {
116
- const code = await promises.readFile(mastraEntry, "utf-8");
117
- const result = { hasValidConfig: false };
118
- await core.transformAsync(code, {
119
- filename: mastraEntry,
120
- presets: [undefined("@babel/preset-typescript")],
121
- plugins: [() => chunk743HRNWT_cjs.checkConfigExport(result)]
122
- });
123
- return result.projectType;
124
- }
125
-
126
- // src/build/serverOptions.ts
127
- async function getServerOptions(entryFile, outputDir, logger) {
128
- const result = await chunk36AWZH7Z_cjs.extractMastraOption("server", entryFile, outputDir, logger);
129
- if (!result) {
130
- return null;
131
- }
132
- return result.getConfig();
133
- }
134
- var CONFIG_BASENAMES = ["config.ts", "config.js"];
135
- var WORKSPACE_BASENAMES = ["workspace.ts", "workspace.js"];
136
- var MEMORY_BASENAMES = ["memory.ts", "memory.js"];
137
- var INSTRUCTIONS_BASENAME = "instructions.md";
138
- var TOOL_EXTENSIONS = [".ts", ".js"];
139
- var SKILL_MODULE_EXTENSIONS = [".ts", ".js"];
140
- var SKILL_MD_BASENAME = "SKILL.md";
141
- async function exists(path) {
142
- try {
143
- return !(await promises.lstat(path)).isSymbolicLink();
144
- } catch {
145
- return false;
146
- }
147
- }
148
- async function realDirectory(path) {
149
- try {
150
- const info = await promises.lstat(path);
151
- if (info.isDirectory() && !info.isSymbolicLink()) {
152
- return chunkJZRFRUGM_cjs.slash(path);
153
- }
154
- } catch {
155
- }
156
- return void 0;
157
- }
158
- async function directoryExists(path) {
159
- return realDirectory(path);
160
- }
161
- async function firstExisting(dir, basenames) {
162
- for (const basename of basenames) {
163
- const candidate = path.join(dir, basename);
164
- if (await exists(candidate)) {
165
- return chunkJZRFRUGM_cjs.slash(candidate);
166
- }
167
- }
168
- return void 0;
169
- }
170
- function isTestFile(basename) {
171
- return /\.(test|spec)\.(ts|js)$/.test(basename);
172
- }
173
- function toolKey(basename) {
174
- return basename.replace(/\.(ts|js)$/, "");
175
- }
176
- async function discoverModuleDir(dir) {
177
- if (!await exists(dir)) {
178
- return [];
179
- }
180
- let entries;
181
- try {
182
- entries = await promises.readdir(dir);
183
- } catch {
184
- return [];
185
- }
186
- const modules = [];
187
- for (const basename of entries.sort()) {
188
- if (isTestFile(basename)) {
189
- continue;
190
- }
191
- if (!TOOL_EXTENSIONS.some((ext) => basename.endsWith(ext))) {
192
- continue;
193
- }
194
- const path$1 = path.join(dir, basename);
195
- const stats = await promises.lstat(path$1);
196
- if (stats.isSymbolicLink() || stats.isDirectory()) {
197
- continue;
198
- }
199
- modules.push({ key: toolKey(basename), path: chunkJZRFRUGM_cjs.slash(path$1) });
200
- }
201
- return modules;
202
- }
203
- async function discoverTools(toolsDir) {
204
- return discoverModuleDir(toolsDir);
205
- }
206
- async function discoverProcessors(processorsDir) {
207
- const result = { input: [], output: [] };
208
- for (const type of ["input", "output"]) {
209
- const typeDir = path.join(processorsDir, type);
210
- if (!await exists(typeDir)) {
211
- continue;
212
- }
213
- let entries;
214
- try {
215
- entries = await promises.readdir(typeDir);
216
- } catch {
217
- continue;
218
- }
219
- for (const basename of entries.sort()) {
220
- if (isTestFile(basename)) {
221
- continue;
222
- }
223
- if (!TOOL_EXTENSIONS.some((ext) => basename.endsWith(ext))) {
224
- continue;
225
- }
226
- const path$1 = path.join(typeDir, basename);
227
- const stats = await promises.lstat(path$1);
228
- if (stats.isSymbolicLink() || stats.isDirectory()) {
229
- continue;
230
- }
231
- result[type].push({ key: toolKey(basename), path: chunkJZRFRUGM_cjs.slash(path$1) });
232
- }
233
- }
234
- return result;
235
- }
236
- async function readReferences(referencesDir) {
237
- if (!await exists(referencesDir)) {
238
- return {};
239
- }
240
- const references = {};
241
- let entries;
242
- try {
243
- entries = await promises.readdir(referencesDir);
244
- } catch {
245
- return {};
246
- }
247
- for (const basename of entries.sort()) {
248
- const path$1 = path.join(referencesDir, basename);
249
- const stats = await promises.lstat(path$1);
250
- if (stats.isSymbolicLink() || stats.isDirectory()) {
251
- continue;
252
- }
253
- references[basename] = await promises.readFile(path$1, "utf-8");
254
- }
255
- return references;
256
- }
257
- async function parsePackagedSkill(skillMdPath, fallbackName, references = {}) {
258
- const raw = await promises.readFile(skillMdPath, "utf-8");
259
- const parsed = matter__default.default(raw);
260
- const frontmatter = parsed.data;
261
- const name = frontmatter.name ?? fallbackName;
262
- const description = frontmatter.description;
263
- if (!description) {
264
- throw new Error(
265
- `Skill "${name}" in ${skillMdPath} is missing a required "description". Add a YAML frontmatter block with a "description:" field. See https://agentskills.io/specification for the SKILL.md format.`
266
- );
267
- }
268
- const instructions = parsed.content.trim();
269
- return { kind: "packaged", name, description, instructions, references };
270
- }
271
- function skillModuleName(basename) {
272
- return basename.replace(/\.(ts|js)$/, "");
273
- }
274
- async function discoverSkills(skillsDir) {
275
- if (!await exists(skillsDir)) {
276
- return [];
277
- }
278
- let entries;
279
- try {
280
- entries = await promises.readdir(skillsDir);
281
- } catch {
282
- return [];
283
- }
284
- const skills = [];
285
- for (const basename of entries.sort()) {
286
- if (isTestFile(basename)) {
287
- continue;
288
- }
289
- const path$1 = path.join(skillsDir, basename);
290
- const stats = await promises.lstat(path$1);
291
- if (stats.isSymbolicLink()) {
292
- continue;
293
- }
294
- const isDir = stats.isDirectory();
295
- if (isDir) {
296
- const skillMd = path.join(path$1, SKILL_MD_BASENAME);
297
- if (await exists(skillMd)) {
298
- const references = await readReferences(path.join(path$1, "references"));
299
- skills.push(await parsePackagedSkill(skillMd, skillModuleName(basename), references));
300
- }
301
- continue;
302
- }
303
- if (SKILL_MODULE_EXTENSIONS.some((ext) => basename.endsWith(ext))) {
304
- skills.push({ kind: "module", path: chunkJZRFRUGM_cjs.slash(path$1) });
305
- continue;
306
- }
307
- if (basename.endsWith(".md")) {
308
- const skill = await parsePackagedSkill(path$1, basename.replace(/\.md$/, ""));
309
- skills.push(skill);
310
- }
311
- }
312
- return skills;
313
- }
314
- async function discoverAgentDir(dir, name, depth, onWarn) {
315
- const configPath = await firstExisting(dir, CONFIG_BASENAMES);
316
- const instructionsPath = await exists(path.join(dir, INSTRUCTIONS_BASENAME)) ? chunkJZRFRUGM_cjs.slash(path.join(dir, INSTRUCTIONS_BASENAME)) : void 0;
317
- if (!configPath && !instructionsPath) {
318
- return void 0;
319
- }
320
- const workspacePath = await firstExisting(dir, WORKSPACE_BASENAMES);
321
- const memoryPath = await firstExisting(dir, MEMORY_BASENAMES);
322
- const workspaceSeedDir = await directoryExists(path.join(dir, "workspace"));
323
- const tools = await discoverTools(path.join(dir, "tools"));
324
- const processors = await discoverProcessors(path.join(dir, "processors"));
325
- const scorers = await discoverModuleDir(path.join(dir, "scorers"));
326
- const skills = await discoverSkills(path.join(dir, "skills"));
327
- const subagents = await discoverSubagents(dir, depth, onWarn);
328
- return {
329
- name,
330
- dir: chunkJZRFRUGM_cjs.slash(dir),
331
- configPath,
332
- instructionsPath,
333
- workspacePath,
334
- memoryPath,
335
- workspaceSeedDir,
336
- tools,
337
- inputProcessors: processors.input,
338
- outputProcessors: processors.output,
339
- scorers,
340
- skills,
341
- subagents
342
- };
343
- }
344
- async function discoverSubagents(parentDir, parentDepth, onWarn) {
345
- const subagentsDir = path.join(parentDir, "subagents");
346
- if (!await exists(subagentsDir)) {
347
- return [];
348
- }
349
- if (parentDepth >= agent.MAX_FS_SUBAGENT_DEPTH) {
350
- onWarn?.(
351
- `Ignoring subagents in "${chunkJZRFRUGM_cjs.slash(subagentsDir)}": subagents may only nest ${agent.MAX_FS_SUBAGENT_DEPTH} levels below a top-level agent.`
352
- );
353
- return [];
354
- }
355
- let entries;
356
- try {
357
- entries = await promises.readdir(subagentsDir);
358
- } catch {
359
- return [];
360
- }
361
- const subagents = [];
362
- for (const name of entries.sort()) {
363
- const dir = path.join(subagentsDir, name);
364
- if (!await realDirectory(dir)) {
365
- continue;
366
- }
367
- const child = await discoverAgentDir(dir, name, parentDepth + 1, onWarn);
368
- if (child) {
369
- subagents.push(child);
370
- }
371
- }
372
- return subagents;
373
- }
374
- async function discoverFsAgents(mastraDir, onWarn) {
375
- const agentsDir = path.join(mastraDir, "agents");
376
- if (!await exists(agentsDir)) {
377
- return [];
378
- }
379
- let entries;
380
- try {
381
- entries = await promises.readdir(agentsDir);
382
- } catch {
383
- return [];
384
- }
385
- const discovered = [];
386
- for (const name of entries.sort()) {
387
- const dir = path.join(agentsDir, name);
388
- if (!await realDirectory(dir)) {
389
- continue;
390
- }
391
- const agent = await discoverAgentDir(dir, name, 0, onWarn);
392
- if (agent) {
393
- discovered.push(agent);
394
- }
395
- }
396
- return discovered;
397
- }
398
- async function discoverFsWorkflows(mastraDir) {
399
- const workflowsDir = path.join(mastraDir, "workflows");
400
- if (!await exists(workflowsDir)) {
401
- return [];
402
- }
403
- let entries;
404
- try {
405
- entries = await promises.readdir(workflowsDir);
406
- } catch {
407
- return [];
408
- }
409
- const discovered = [];
410
- for (const basename of entries.sort()) {
411
- if (isTestFile(basename)) {
412
- continue;
413
- }
414
- if (!TOOL_EXTENSIONS.some((ext) => basename.endsWith(ext))) {
415
- continue;
416
- }
417
- const path$1 = path.join(workflowsDir, basename);
418
- const stats = await promises.lstat(path$1);
419
- if (stats.isSymbolicLink() || stats.isDirectory()) {
420
- continue;
421
- }
422
- const source = await promises.readFile(path$1, "utf-8");
423
- if (!/\bexport\s+default\b/.test(source)) {
424
- continue;
425
- }
426
- discovered.push({ key: toolKey(basename), path: chunkJZRFRUGM_cjs.slash(path$1) });
427
- }
428
- return discovered;
429
- }
430
- var SINGLETON_EXTENSIONS = [".ts", ".js", ".mts", ".mjs"];
431
- var SINGLETON_NAME_PATTERN = /^[a-zA-Z0-9_-]+$/;
432
- async function discoverFsSingleton(mastraDir, name) {
433
- if (!SINGLETON_NAME_PATTERN.test(name)) {
434
- throw new Error(`Invalid fs-singleton name ${JSON.stringify(name)}: expected a bare identifier.`);
435
- }
436
- for (const ext of SINGLETON_EXTENSIONS) {
437
- const candidate = path.join(mastraDir, `${name}${ext}`);
438
- try {
439
- const stats = await promises.lstat(candidate);
440
- if (!stats.isFile() || stats.isSymbolicLink()) {
441
- continue;
442
- }
443
- const source = await promises.readFile(candidate, "utf-8");
444
- if (!/\bexport\s+default\b/.test(source)) {
445
- continue;
446
- }
447
- return { path: chunkJZRFRUGM_cjs.slash(candidate) };
448
- } catch {
449
- }
450
- }
451
- return void 0;
452
- }
453
- function sanitizeIdentifier(name, prefix, index) {
454
- const cleaned = name.replace(/[^a-zA-Z0-9_$]/g, "_");
455
- return `${prefix}_${index}_${cleaned}`;
456
- }
457
- async function emitAgentEntry(agent, idPath, workspaceName, lines) {
458
- const configIdent = sanitizeIdentifier(agent.name, "config", idPath);
459
- const toolIdents = [];
460
- if (agent.configPath) {
461
- lines.push(`import ${configIdent} from ${JSON.stringify(agent.configPath)};`);
462
- }
463
- let workspaceIdent;
464
- if (agent.workspacePath) {
465
- workspaceIdent = sanitizeIdentifier(`${agent.name}_workspace`, "workspace", idPath);
466
- lines.push(`import ${workspaceIdent} from ${JSON.stringify(agent.workspacePath)};`);
467
- }
468
- let memoryIdent;
469
- if (agent.memoryPath) {
470
- memoryIdent = sanitizeIdentifier(`${agent.name}_memory`, "memory", idPath);
471
- lines.push(`import ${memoryIdent} from ${JSON.stringify(agent.memoryPath)};`);
472
- }
473
- for (let t = 0; t < agent.tools.length; t++) {
474
- const tool = agent.tools[t];
475
- const ident = sanitizeIdentifier(`${agent.name}_${tool.key}`, "tool", `${idPath}_${t}`);
476
- lines.push(`import ${ident} from ${JSON.stringify(tool.path)};`);
477
- toolIdents.push({ key: tool.key, ident });
478
- }
479
- const inputProcessorIdents = [];
480
- for (let p = 0; p < agent.inputProcessors.length; p++) {
481
- const proc = agent.inputProcessors[p];
482
- const ident = sanitizeIdentifier(`${agent.name}_inputProc_${proc.key}`, "proc", `${idPath}_ip${p}`);
483
- lines.push(`import ${ident} from ${JSON.stringify(proc.path)};`);
484
- inputProcessorIdents.push(ident);
485
- }
486
- const outputProcessorIdents = [];
487
- for (let p = 0; p < agent.outputProcessors.length; p++) {
488
- const proc = agent.outputProcessors[p];
489
- const ident = sanitizeIdentifier(`${agent.name}_outputProc_${proc.key}`, "proc", `${idPath}_op${p}`);
490
- lines.push(`import ${ident} from ${JSON.stringify(proc.path)};`);
491
- outputProcessorIdents.push(ident);
492
- }
493
- const scorerIdents = [];
494
- for (let s = 0; s < agent.scorers.length; s++) {
495
- const scorer = agent.scorers[s];
496
- const ident = sanitizeIdentifier(`${agent.name}_scorer_${scorer.key}`, "scorer", `${idPath}_${s}`);
497
- lines.push(`import ${ident} from ${JSON.stringify(scorer.path)};`);
498
- scorerIdents.push({ key: scorer.key, ident });
499
- }
500
- const skillExprs = [];
501
- const agentSkills = agent.skills ?? [];
502
- for (let s = 0; s < agentSkills.length; s++) {
503
- const skill = agentSkills[s];
504
- if (skill.kind === "module") {
505
- const ident = sanitizeIdentifier(`${agent.name}_skill`, "skill", `${idPath}_${s}`);
506
- lines.push(`import ${ident} from ${JSON.stringify(skill.path)};`);
507
- skillExprs.push(ident);
508
- } else {
509
- const referenceFields = Object.entries(skill.references).map(
510
- ([key, value]) => `${JSON.stringify(key)}: ${JSON.stringify(value)}`
511
- );
512
- const skillFields = [
513
- `name: ${JSON.stringify(skill.name)}`,
514
- `description: ${JSON.stringify(skill.description)}`,
515
- `instructions: ${JSON.stringify(skill.instructions)}`
516
- ];
517
- if (referenceFields.length > 0) {
518
- skillFields.push(`references: { ${referenceFields.join(", ")} }`);
519
- }
520
- skillExprs.push(`__createSkill({ ${skillFields.join(", ")} })`);
521
- }
522
- }
523
- let instructionsMd;
524
- if (agent.instructionsPath) {
525
- instructionsMd = await promises.readFile(agent.instructionsPath, "utf-8");
526
- }
527
- const subagentExprs = [];
528
- for (let c = 0; c < agent.subagents.length; c++) {
529
- const child = agent.subagents[c];
530
- const childExpr = await emitAgentEntry(child, `${idPath}_${c}`, `${workspaceName}/${child.name}`, lines);
531
- subagentExprs.push(childExpr);
532
- }
533
- const entryFields = [`name: ${JSON.stringify(agent.name)}`];
534
- if (agent.configPath) {
535
- entryFields.push(`config: ${configIdent}`);
536
- }
537
- if (instructionsMd !== void 0) {
538
- entryFields.push(`instructionsMd: ${JSON.stringify(instructionsMd)}`);
539
- }
540
- if (toolIdents.length > 0) {
541
- const toolEntries = toolIdents.map(({ key, ident }) => `{ key: ${JSON.stringify(key)}, tool: ${ident} }`);
542
- entryFields.push(`tools: [${toolEntries.join(", ")}]`);
543
- }
544
- if (skillExprs.length > 0) {
545
- entryFields.push(`skills: [${skillExprs.join(", ")}]`);
546
- }
547
- if (inputProcessorIdents.length > 0) {
548
- entryFields.push(`inputProcessors: [${inputProcessorIdents.join(", ")}]`);
549
- }
550
- if (outputProcessorIdents.length > 0) {
551
- entryFields.push(`outputProcessors: [${outputProcessorIdents.join(", ")}]`);
552
- }
553
- if (scorerIdents.length > 0) {
554
- const scorerEntries = scorerIdents.map(({ key, ident }) => `{ key: ${JSON.stringify(key)}, scorer: ${ident} }`);
555
- entryFields.push(`scorers: [${scorerEntries.join(", ")}]`);
556
- }
557
- if (subagentExprs.length > 0) {
558
- entryFields.push(`subagents: [${subagentExprs.join(", ")}]`);
559
- }
560
- if (workspaceIdent) {
561
- entryFields.push(`workspace: ${workspaceIdent}`);
562
- }
563
- if (memoryIdent) {
564
- entryFields.push(`memory: ${memoryIdent}`);
565
- }
566
- entryFields.push(`defaultWorkspaceBasePath: __workspaceBasePath(${JSON.stringify(workspaceName)})`);
567
- return `{ ${entryFields.join(", ")} }`;
568
- }
569
- async function generateFsAgentsModule(userEntry, agents, options) {
570
- const workflows = options?.workflows ?? [];
571
- const storage = options?.storage;
572
- const observability = options?.observability;
573
- const logger = options?.logger;
574
- const server = options?.server;
575
- const studio = options?.studio;
576
- const standalone = userEntry === void 0;
577
- const lines = [];
578
- const hasInlineSkills = (function check(list) {
579
- return list.some((a) => (a.skills ?? []).some((s) => s.kind === "packaged") || check(a.subagents ?? []));
580
- })(agents);
581
- lines.push(`import { assembleAgentFromFsEntry } from '@mastra/core/agent';`);
582
- if (hasInlineSkills) {
583
- lines.push(`import { createSkill as __createSkill } from '@mastra/core/skills';`);
584
- }
585
- if (standalone) {
586
- lines.push(`import { Mastra } from '@mastra/core';`);
587
- }
588
- lines.push(`import { fileURLToPath as __fileURLToPath } from 'node:url';`);
589
- lines.push(`import { dirname as __dirname, join as __join } from 'node:path';`);
590
- if (userEntry) {
591
- lines.push(`import * as __userEntry from ${JSON.stringify(userEntry)};`);
592
- lines.push(`export * from ${JSON.stringify(userEntry)};`);
593
- }
594
- lines.push(``);
595
- lines.push(`const __bundleDir = __dirname(__fileURLToPath(import.meta.url));`);
596
- lines.push(`const __workspaceBasePath = name => __join(__bundleDir, 'workspace', ...name.split('/'));`);
597
- lines.push(``);
598
- const singletonImports = [];
599
- if (storage) {
600
- singletonImports.push(`import __fsStorage from ${JSON.stringify(storage.path)};`);
601
- }
602
- if (observability) {
603
- singletonImports.push(`import __fsObservability from ${JSON.stringify(observability.path)};`);
604
- }
605
- if (logger) {
606
- singletonImports.push(`import __fsLogger from ${JSON.stringify(logger.path)};`);
607
- }
608
- if (server) {
609
- singletonImports.push(`import __fsServer from ${JSON.stringify(server.path)};`);
610
- }
611
- if (studio) {
612
- singletonImports.push(`import __fsStudio from ${JSON.stringify(studio.path)};`);
613
- }
614
- if (singletonImports.length > 0) {
615
- lines.push(...singletonImports);
616
- lines.push(``);
617
- }
618
- const wfCodegen = workflows.length > 0 ? generateFsWorkflowsCodegen(workflows) : void 0;
619
- if (wfCodegen) {
620
- for (const line of wfCodegen.importLines) {
621
- lines.push(line);
622
- }
623
- lines.push(``);
624
- }
625
- const entryExprs = [];
626
- for (let i = 0; i < agents.length; i++) {
627
- const agent = agents[i];
628
- const expr = await emitAgentEntry(agent, `${i}`, agent.name, lines);
629
- entryExprs.push(expr);
630
- }
631
- if (standalone) {
632
- lines.push(``);
633
- lines.push(`const __mastra = new Mastra({});`);
634
- } else {
635
- lines.push(``);
636
- lines.push(`const __mastra = __userEntry.mastra;`);
637
- }
638
- lines.push(``);
639
- lines.push(`const __fsAgentEntries = [`);
640
- for (const expr of entryExprs) {
641
- lines.push(` ${expr},`);
642
- }
643
- lines.push(`];`);
644
- lines.push(``);
645
- lines.push(`const __fsAgents = Object.create(null);`);
646
- lines.push(`for (const __entry of __fsAgentEntries) {`);
647
- lines.push(` __fsAgents[__entry.name] = assembleAgentFromFsEntry(__entry, {`);
648
- lines.push(` onWarn: msg => __mastra?.getLogger?.()?.warn?.(msg) ?? console.warn(msg),`);
649
- lines.push(` });`);
650
- lines.push(`}`);
651
- lines.push(``);
652
- if (logger) {
653
- lines.push(`if (__mastra && typeof __mastra.__registerFsLogger === 'function') {`);
654
- lines.push(` __mastra.__registerFsLogger(__fsLogger);`);
655
- lines.push(`}`);
656
- lines.push(``);
657
- }
658
- if (storage) {
659
- lines.push(`if (__mastra && typeof __mastra.__registerFsStorage === 'function') {`);
660
- lines.push(` __mastra.__registerFsStorage(__fsStorage);`);
661
- lines.push(`}`);
662
- lines.push(``);
663
- }
664
- if (observability) {
665
- lines.push(`if (__mastra && typeof __mastra.__registerFsObservability === 'function') {`);
666
- lines.push(` __mastra.__registerFsObservability(__fsObservability);`);
667
- lines.push(`}`);
668
- lines.push(``);
669
- }
670
- if (server) {
671
- lines.push(`if (__mastra && typeof __mastra.__registerFsServer === 'function') {`);
672
- lines.push(` __mastra.__registerFsServer(__fsServer);`);
673
- lines.push(`}`);
674
- lines.push(``);
675
- }
676
- if (studio) {
677
- lines.push(`if (__mastra && typeof __mastra.__registerFsStudio === 'function') {`);
678
- lines.push(` __mastra.__registerFsStudio(__fsStudio);`);
679
- lines.push(`}`);
680
- lines.push(``);
681
- }
682
- lines.push(`if (__mastra && typeof __mastra.__registerFsAgents === 'function') {`);
683
- lines.push(` __mastra.__registerFsAgents(__fsAgents);`);
684
- lines.push(`}`);
685
- if (wfCodegen) {
686
- lines.push(``);
687
- for (const line of wfCodegen.registrationLines) {
688
- lines.push(line);
689
- }
690
- }
691
- lines.push(``);
692
- lines.push(`export const mastra = __mastra;`);
693
- return lines.join("\n");
694
- }
695
- function generateFsWorkflowsCodegen(workflows) {
696
- const importLines = [];
697
- const registrationLines = [];
698
- for (let i = 0; i < workflows.length; i++) {
699
- const wf = workflows[i];
700
- const ident = sanitizeIdentifier(wf.key, "workflow", `${i}`);
701
- importLines.push(`import ${ident} from ${JSON.stringify(wf.path)};`);
702
- }
703
- registrationLines.push(`const __fsWorkflows = Object.create(null);`);
704
- for (let i = 0; i < workflows.length; i++) {
705
- const wf = workflows[i];
706
- const ident = sanitizeIdentifier(wf.key, "workflow", `${i}`);
707
- registrationLines.push(`__fsWorkflows[${JSON.stringify(wf.key)}] = ${ident};`);
708
- }
709
- registrationLines.push(``);
710
- registrationLines.push(`if (__mastra && typeof __mastra.__registerFsWorkflows === 'function') {`);
711
- registrationLines.push(` __mastra.__registerFsWorkflows(__fsWorkflows);`);
712
- registrationLines.push(`}`);
713
- return { importLines, registrationLines };
714
- }
715
- async function prepareFsAgentsEntry(mastraDir, entryFile, outputDirectory) {
716
- const [agents, workflows, storage, observability, logger, server, studio] = await Promise.all([
717
- discoverFsAgents(mastraDir),
718
- discoverFsWorkflows(mastraDir),
719
- discoverFsSingleton(mastraDir, "storage"),
720
- discoverFsSingleton(mastraDir, "observability"),
721
- discoverFsSingleton(mastraDir, "logger"),
722
- discoverFsSingleton(mastraDir, "server"),
723
- discoverFsSingleton(mastraDir, "studio")
724
- ]);
725
- const standalone = entryFile === void 0;
726
- const hasFsPrimitives = agents.length > 0 || workflows.length > 0 || !!storage || !!observability || !!logger || !!server || !!studio;
727
- if (!hasFsPrimitives && entryFile !== void 0) {
728
- return {
729
- entryFile,
730
- standalone: false,
731
- toolPaths: [],
732
- agentCount: 0,
733
- workflowCount: 0,
734
- hasStorage: false,
735
- hasObservability: false,
736
- hasLogger: false,
737
- hasServer: false,
738
- hasStudio: false
739
- };
740
- }
741
- if (!hasFsPrimitives && standalone) {
742
- throw new Error(
743
- "No index.ts and no file-based primitives found. Create src/mastra/index.ts with a Mastra instance, or add file-based agents/workflows/storage."
744
- );
745
- }
746
- const moduleSource = await generateFsAgentsModule(entryFile ? chunkJZRFRUGM_cjs.slash(entryFile) : void 0, agents, {
747
- workflows,
748
- storage,
749
- observability,
750
- logger,
751
- server,
752
- studio
753
- });
754
- const generatedEntry = path.join(outputDirectory, ".mastra-fs-agents-entry.mjs");
755
- const normalizedMastraDir = chunkJZRFRUGM_cjs.slash(mastraDir);
756
- const toolPaths = agents.length > 0 ? [
757
- path.posix.join(normalizedMastraDir, "agents/*/tools/**/*.{js,ts}"),
758
- `!${path.posix.join(normalizedMastraDir, "agents/*/tools/**/*.{test,spec}.{js,ts}")}`,
759
- `!${path.posix.join(normalizedMastraDir, "agents/*/tools/**/__tests__/**")}`
760
- ] : [];
761
- return {
762
- entryFile: generatedEntry,
763
- standalone,
764
- toolPaths,
765
- agentCount: agents.length,
766
- workflowCount: workflows.length,
767
- hasStorage: !!storage,
768
- hasObservability: !!observability,
769
- hasLogger: !!logger,
770
- hasServer: !!server,
771
- hasStudio: !!studio,
772
- moduleSource
773
- };
774
- }
775
- async function writeFsAgentsEntry(result) {
776
- if (!result.moduleSource) {
777
- return;
778
- }
779
- await promises.mkdir(path.dirname(result.entryFile), { recursive: true });
780
- await promises.writeFile(result.entryFile, result.moduleSource, "utf-8");
781
- }
782
- async function rejectSymlinks(source) {
783
- const stats = await promises.lstat(source);
784
- return !stats.isSymbolicLink();
785
- }
786
- async function mirrorAgentSeeds(agent, workspaceName, bundleDir, mirrored) {
787
- if (agent.workspaceSeedDir) {
788
- const destination = path.join(bundleDir, "workspace", ...workspaceName.split("/"));
789
- await promises.mkdir(destination, { recursive: true });
790
- await promises.cp(agent.workspaceSeedDir, destination, { recursive: true, filter: rejectSymlinks });
791
- mirrored.push(workspaceName);
792
- }
793
- for (const child of agent.subagents ?? []) {
794
- await mirrorAgentSeeds(child, `${workspaceName}/${child.name}`, bundleDir, mirrored);
795
- }
796
- }
797
- async function mirrorFsAgentWorkspaces(mastraDir, bundleDir) {
798
- const agents = await discoverFsAgents(mastraDir);
799
- const mirrored = [];
800
- for (const agent of agents) {
801
- await mirrorAgentSeeds(agent, agent.name, bundleDir, mirrored);
802
- }
803
- return mirrored;
804
- }
805
-
806
- exports.analyzeEntryProjectType = analyzeEntryProjectType;
807
- exports.createWatcher = createWatcher;
808
- exports.discoverFsAgents = discoverFsAgents;
809
- exports.discoverFsSingleton = discoverFsSingleton;
810
- exports.discoverFsWorkflows = discoverFsWorkflows;
811
- exports.generateFsAgentsModule = generateFsAgentsModule;
812
- exports.generateFsWorkflowsCodegen = generateFsWorkflowsCodegen;
813
- exports.getInputOptions = getInputOptions2;
814
- exports.getServerOptions = getServerOptions;
815
- exports.mirrorFsAgentWorkspaces = mirrorFsAgentWorkspaces;
816
- exports.prepareFsAgentsEntry = prepareFsAgentsEntry;
817
- exports.writeFsAgentsEntry = writeFsAgentsEntry;
818
- //# sourceMappingURL=chunk-YO5OFXPN.cjs.map
819
- //# sourceMappingURL=chunk-YO5OFXPN.cjs.map