@mastra/dane 0.0.2-alpha.116 → 0.0.2-alpha.118
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.
- package/package.json +10 -9
- package/dist/commands/changelog.d.ts +0 -2
- package/dist/commands/changelog.d.ts.map +0 -1
- package/dist/commands/changelog.js +0 -15
- package/dist/commands/commit-message.d.ts +0 -2
- package/dist/commands/commit-message.d.ts.map +0 -1
- package/dist/commands/commit-message.js +0 -32
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -40
- package/dist/commands/issue-labeler.d.ts +0 -2
- package/dist/commands/issue-labeler.d.ts.map +0 -1
- package/dist/commands/issue-labeler.js +0 -35
- package/dist/commands/link-checker.d.ts +0 -4
- package/dist/commands/link-checker.d.ts.map +0 -1
- package/dist/commands/link-checker.js +0 -16
- package/dist/commands/message.d.ts +0 -2
- package/dist/commands/message.d.ts.map +0 -1
- package/dist/commands/message.js +0 -14
- package/dist/commands/new-contributor-message.d.ts +0 -2
- package/dist/commands/new-contributor-message.d.ts.map +0 -1
- package/dist/commands/new-contributor-message.js +0 -43
- package/dist/commands/publish-packages.d.ts +0 -2
- package/dist/commands/publish-packages.d.ts.map +0 -1
- package/dist/commands/publish-packages.js +0 -11
- package/dist/commands/telephone-game.d.ts +0 -2
- package/dist/commands/telephone-game.d.ts.map +0 -1
- package/dist/commands/telephone-game.js +0 -32
- package/dist/config/index.d.ts +0 -12
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -75
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -37
- package/dist/mastra/agents/index.d.ts +0 -165
- package/dist/mastra/agents/index.d.ts.map +0 -1
- package/dist/mastra/agents/index.js +0 -105
- package/dist/mastra/agents/model.d.ts +0 -7
- package/dist/mastra/agents/model.d.ts.map +0 -1
- package/dist/mastra/agents/model.js +0 -7
- package/dist/mastra/agents/new-contributor.d.ts +0 -3
- package/dist/mastra/agents/new-contributor.d.ts.map +0 -1
- package/dist/mastra/agents/new-contributor.js +0 -12
- package/dist/mastra/agents/package-publisher.d.ts +0 -65
- package/dist/mastra/agents/package-publisher.d.ts.map +0 -1
- package/dist/mastra/agents/package-publisher.js +0 -188
- package/dist/mastra/index.d.ts +0 -291
- package/dist/mastra/index.d.ts.map +0 -1
- package/dist/mastra/index.js +0 -46
- package/dist/mastra/integrations/index.d.ts +0 -5
- package/dist/mastra/integrations/index.d.ts.map +0 -1
- package/dist/mastra/integrations/index.js +0 -23
- package/dist/mastra/tools/browser.d.ts +0 -40
- package/dist/mastra/tools/browser.d.ts.map +0 -1
- package/dist/mastra/tools/browser.js +0 -116
- package/dist/mastra/tools/calendar.d.ts +0 -21
- package/dist/mastra/tools/calendar.d.ts.map +0 -1
- package/dist/mastra/tools/calendar.js +0 -134
- package/dist/mastra/tools/crawl.d.ts +0 -36
- package/dist/mastra/tools/crawl.d.ts.map +0 -1
- package/dist/mastra/tools/crawl.js +0 -27
- package/dist/mastra/tools/execa.d.ts +0 -27
- package/dist/mastra/tools/execa.d.ts.map +0 -1
- package/dist/mastra/tools/execa.js +0 -43
- package/dist/mastra/tools/fs.d.ts +0 -33
- package/dist/mastra/tools/fs.d.ts.map +0 -1
- package/dist/mastra/tools/fs.js +0 -36
- package/dist/mastra/tools/image.d.ts +0 -27
- package/dist/mastra/tools/image.d.ts.map +0 -1
- package/dist/mastra/tools/image.js +0 -37
- package/dist/mastra/tools/mcp.d.ts +0 -3
- package/dist/mastra/tools/mcp.d.ts.map +0 -1
- package/dist/mastra/tools/mcp.js +0 -12
- package/dist/mastra/tools/pdf.d.ts +0 -21
- package/dist/mastra/tools/pdf.d.ts.map +0 -1
- package/dist/mastra/tools/pdf.js +0 -42
- package/dist/mastra/tools/pnpm.d.ts +0 -60
- package/dist/mastra/tools/pnpm.d.ts.map +0 -1
- package/dist/mastra/tools/pnpm.js +0 -127
- package/dist/mastra/workflows/changelog.d.ts +0 -10
- package/dist/mastra/workflows/changelog.d.ts.map +0 -1
- package/dist/mastra/workflows/changelog.js +0 -149
- package/dist/mastra/workflows/chat.d.ts +0 -13
- package/dist/mastra/workflows/chat.d.ts.map +0 -1
- package/dist/mastra/workflows/chat.js +0 -90
- package/dist/mastra/workflows/commit-message.d.ts +0 -10
- package/dist/mastra/workflows/commit-message.d.ts.map +0 -1
- package/dist/mastra/workflows/commit-message.js +0 -138
- package/dist/mastra/workflows/first-contributor.d.ts +0 -16
- package/dist/mastra/workflows/first-contributor.d.ts.map +0 -1
- package/dist/mastra/workflows/first-contributor.js +0 -122
- package/dist/mastra/workflows/index.d.ts +0 -4
- package/dist/mastra/workflows/index.d.ts.map +0 -1
- package/dist/mastra/workflows/index.js +0 -3
- package/dist/mastra/workflows/issue-labeler.d.ts +0 -16
- package/dist/mastra/workflows/issue-labeler.d.ts.map +0 -1
- package/dist/mastra/workflows/issue-labeler.js +0 -85
- package/dist/mastra/workflows/link-checker.d.ts +0 -13
- package/dist/mastra/workflows/link-checker.d.ts.map +0 -1
- package/dist/mastra/workflows/link-checker.js +0 -102
- package/dist/mastra/workflows/publish-packages.d.ts +0 -3
- package/dist/mastra/workflows/publish-packages.d.ts.map +0 -1
- package/dist/mastra/workflows/publish-packages.js +0 -425
- package/dist/mastra/workflows/telephone-game.d.ts +0 -3
- package/dist/mastra/workflows/telephone-game.d.ts.map +0 -1
- package/dist/mastra/workflows/telephone-game.js +0 -95
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
import { Step, Workflow } from '@mastra/core/workflows';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { existsSync } from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { PACKAGES_LIST_PROMPT, PUBLISH_PACKAGES_PROMPT } from '../agents/package-publisher.js';
|
|
7
|
-
import { pnpmBuild } from '../tools/pnpm.js';
|
|
8
|
-
export const packagePublisher = new Workflow({
|
|
9
|
-
name: 'pnpm-changset-publisher',
|
|
10
|
-
});
|
|
11
|
-
const outputSchema = z.object({
|
|
12
|
-
packages: z.array(z.string()),
|
|
13
|
-
integrations: z.array(z.string()),
|
|
14
|
-
deployers: z.array(z.string()),
|
|
15
|
-
speech: z.array(z.string()),
|
|
16
|
-
// deprecated
|
|
17
|
-
vector_stores: z.array(z.string()),
|
|
18
|
-
stores: z.array(z.string()),
|
|
19
|
-
// combined deprecated stores
|
|
20
|
-
combined_stores: z.array(z.string()),
|
|
21
|
-
});
|
|
22
|
-
const defaultSet = {
|
|
23
|
-
packages: [],
|
|
24
|
-
deployers: [],
|
|
25
|
-
integrations: [],
|
|
26
|
-
speech: [],
|
|
27
|
-
// deprecated
|
|
28
|
-
vector_stores: [],
|
|
29
|
-
stores: [],
|
|
30
|
-
// combined vector + storage
|
|
31
|
-
combined_stores: [],
|
|
32
|
-
};
|
|
33
|
-
const getPacakgesToPublish = new Step({
|
|
34
|
-
id: 'getPacakgesToPublish',
|
|
35
|
-
outputSchema,
|
|
36
|
-
execute: async ({ mastra }) => {
|
|
37
|
-
const agent = mastra?.agents?.['danePackagePublisher'];
|
|
38
|
-
if (!agent) {
|
|
39
|
-
throw new Error('Agent not found');
|
|
40
|
-
}
|
|
41
|
-
const result = await agent.generate(PACKAGES_LIST_PROMPT);
|
|
42
|
-
console.log(chalk.green(`\n${result.text}`));
|
|
43
|
-
const resultObj = await agent.generate(`
|
|
44
|
-
Please convert this into a structured object:
|
|
45
|
-
|
|
46
|
-
Input Text: ${result.text}
|
|
47
|
-
|
|
48
|
-
1. Order Requirements:
|
|
49
|
-
- @mastra/core MUST be first within packages
|
|
50
|
-
- @mastra/deployer MUST be second within packages
|
|
51
|
-
- Group parallel builds by directory type
|
|
52
|
-
|
|
53
|
-
2. Output Format:
|
|
54
|
-
- Group into: packages[], integrations[], deployers[], vector_stores[], stores[], combined_stores[]
|
|
55
|
-
- Place create-mastra in packages[] array
|
|
56
|
-
- Maintain correct order within each group
|
|
57
|
-
|
|
58
|
-
3. Critical Rules:
|
|
59
|
-
- Never publish without building first
|
|
60
|
-
- Only include packages that need updates
|
|
61
|
-
- Follow dependency order strictly
|
|
62
|
-
`, {
|
|
63
|
-
output: z.object({
|
|
64
|
-
packages: z.array(z.string()),
|
|
65
|
-
integrations: z.array(z.string()),
|
|
66
|
-
deployers: z.array(z.string()),
|
|
67
|
-
vector_stores: z.array(z.string()),
|
|
68
|
-
stores: z.array(z.string()),
|
|
69
|
-
combined_stores: z.array(z.string()),
|
|
70
|
-
speech: z.array(z.string()),
|
|
71
|
-
}),
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
packages: resultObj?.object?.packages,
|
|
75
|
-
integrations: resultObj?.object?.integrations,
|
|
76
|
-
deployers: resultObj?.object?.deployers,
|
|
77
|
-
vector_stores: resultObj?.object?.vector_stores,
|
|
78
|
-
stores: resultObj?.object?.stores,
|
|
79
|
-
combined_stores: resultObj?.object?.stores,
|
|
80
|
-
speech: resultObj?.object?.speech,
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
const assemblePackages = new Step({
|
|
85
|
-
id: 'assemblePackages',
|
|
86
|
-
outputSchema,
|
|
87
|
-
execute: async ({ context }) => {
|
|
88
|
-
if (context.machineContext?.stepResults.getPacakgesToPublish?.status !== 'success') {
|
|
89
|
-
return {
|
|
90
|
-
packages: [],
|
|
91
|
-
integrations: [],
|
|
92
|
-
deployers: [],
|
|
93
|
-
vector_stores: [],
|
|
94
|
-
stores: [],
|
|
95
|
-
combined_stores: [],
|
|
96
|
-
speech: [],
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const payload = context.machineContext.stepResults.getPacakgesToPublish.payload;
|
|
100
|
-
const packagesToBuild = new Set();
|
|
101
|
-
const deployersToBuild = new Set();
|
|
102
|
-
const integrationsToBuild = new Set();
|
|
103
|
-
const vector_storesToBuild = new Set();
|
|
104
|
-
const storesToBuild = new Set();
|
|
105
|
-
const combined_storesToBuild = new Set();
|
|
106
|
-
const speechToBuild = new Set();
|
|
107
|
-
if (payload?.packages) {
|
|
108
|
-
payload.packages.forEach((pkg) => {
|
|
109
|
-
let pkgName = pkg.replace('@mastra/', '');
|
|
110
|
-
if (pkgName === 'mastra') {
|
|
111
|
-
pkgName = 'cli';
|
|
112
|
-
}
|
|
113
|
-
const pkgPath = path.join(process.cwd(), 'packages', pkgName);
|
|
114
|
-
packagesToBuild.add(pkgPath);
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
if (payload?.deployers) {
|
|
118
|
-
payload.deployers.forEach((pkg) => {
|
|
119
|
-
let pkgName = pkg.replace('@mastra/deployer-', '');
|
|
120
|
-
if (pkgName === 'mastra') {
|
|
121
|
-
pkgName = 'cli';
|
|
122
|
-
}
|
|
123
|
-
const pkgPath = path.join(process.cwd(), 'deployers', pkgName);
|
|
124
|
-
deployersToBuild.add(pkgPath);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (payload?.vector_stores) {
|
|
128
|
-
payload.vector_stores.forEach((pkg) => {
|
|
129
|
-
let pkgName = pkg.replace('@mastra/vector-', '');
|
|
130
|
-
const pkgPath = path.join(process.cwd(), 'vector-stores', pkgName);
|
|
131
|
-
vector_storesToBuild.add(pkgPath);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (payload?.stores) {
|
|
135
|
-
payload.stores.forEach((pkg) => {
|
|
136
|
-
let pkgName = pkg.replace('@mastra/store-', '');
|
|
137
|
-
const pkgPath = path.join(process.cwd(), 'storage', pkgName);
|
|
138
|
-
storesToBuild.add(pkgPath);
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
if (payload?.combined_stores) {
|
|
142
|
-
payload.combined_stores.forEach((pkg) => {
|
|
143
|
-
let pkgName = pkg.replace('@mastra/', '');
|
|
144
|
-
const pkgPath = path.join(process.cwd(), 'stores', pkgName);
|
|
145
|
-
combined_storesToBuild.add(pkgPath);
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
if (payload?.integrations) {
|
|
149
|
-
const integrations = payload.integrations;
|
|
150
|
-
integrations.forEach((integration) => {
|
|
151
|
-
let pkgName = integration.replace('@mastra/', '');
|
|
152
|
-
const integrationPath = path.join(process.cwd(), 'integrations', pkgName);
|
|
153
|
-
integrationsToBuild.add(integrationPath);
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
if (payload?.speech) {
|
|
157
|
-
const speecs = payload.speech;
|
|
158
|
-
speecs.forEach((speech) => {
|
|
159
|
-
let pkgName = speech.replace('@mastra/speech-', '');
|
|
160
|
-
const speechPath = path.join(process.cwd(), 'speech', pkgName);
|
|
161
|
-
speechToBuild.add(speechPath);
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
const pkgSet = Array.from(packagesToBuild.keys());
|
|
165
|
-
const deploySet = Array.from(deployersToBuild.keys());
|
|
166
|
-
const integrationSet = Array.from(integrationsToBuild.keys());
|
|
167
|
-
const vectorStoreSet = Array.from(vector_storesToBuild.keys());
|
|
168
|
-
const storeSet = Array.from(storesToBuild.keys());
|
|
169
|
-
const combinedStoreSet = Array.from(combined_storesToBuild.keys());
|
|
170
|
-
const speechSet = Array.from(speechToBuild.keys());
|
|
171
|
-
if (!packagesToBuild.size &&
|
|
172
|
-
!deployersToBuild.size &&
|
|
173
|
-
!integrationsToBuild.size &&
|
|
174
|
-
!vector_storesToBuild.size &&
|
|
175
|
-
!storesToBuild.size &&
|
|
176
|
-
!combined_storesToBuild.size) {
|
|
177
|
-
console.error(chalk.red('No packages to build.'));
|
|
178
|
-
return defaultSet;
|
|
179
|
-
}
|
|
180
|
-
console.log(chalk.green(`\nBuilding packages:\n`));
|
|
181
|
-
pkgSet.forEach((pkg) => {
|
|
182
|
-
console.log(chalk.green(pkg));
|
|
183
|
-
});
|
|
184
|
-
if (deploySet.length > 0) {
|
|
185
|
-
console.log(chalk.green(`\nBuilding deployers:\n`));
|
|
186
|
-
deploySet.forEach((pkg) => {
|
|
187
|
-
console.log(chalk.green(pkg));
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
if (integrationSet.length > 0) {
|
|
191
|
-
console.log(chalk.green(`\nBuilding integrations:\n`));
|
|
192
|
-
integrationSet.forEach((pkg) => {
|
|
193
|
-
console.log(chalk.green(pkg));
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
if (vectorStoreSet.length > 0) {
|
|
197
|
-
console.log(chalk.green(`\nBuilding vector stores:\n`));
|
|
198
|
-
vectorStoreSet.forEach((pkg) => {
|
|
199
|
-
console.log(chalk.green(pkg));
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
if (storeSet.length > 0) {
|
|
203
|
-
console.log(chalk.green(`\nBuilding storage packages:\n`));
|
|
204
|
-
storeSet.forEach((pkg) => {
|
|
205
|
-
console.log(chalk.green(pkg));
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
if (combinedStoreSet.length > 0) {
|
|
209
|
-
console.log(chalk.green(`\nBuilding store packages:\n`));
|
|
210
|
-
combinedStoreSet.forEach((pkg) => {
|
|
211
|
-
console.log(chalk.green(pkg));
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
if (speechSet.length > 0) {
|
|
215
|
-
console.log(chalk.green(`\nBuilding speech:\n`));
|
|
216
|
-
speechSet.forEach((pkg) => {
|
|
217
|
-
console.log(chalk.green(pkg));
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
return {
|
|
221
|
-
packages: pkgSet,
|
|
222
|
-
deployers: deploySet,
|
|
223
|
-
integrations: integrationSet,
|
|
224
|
-
vector_stores: vectorStoreSet,
|
|
225
|
-
stores: storeSet,
|
|
226
|
-
combined_stores: combinedStoreSet,
|
|
227
|
-
speech: speechSet,
|
|
228
|
-
};
|
|
229
|
-
},
|
|
230
|
-
});
|
|
231
|
-
const buildPackages = new Step({
|
|
232
|
-
id: 'buildPackages',
|
|
233
|
-
outputSchema,
|
|
234
|
-
execute: async ({ context, mastra }) => {
|
|
235
|
-
if (context.machineContext?.stepResults.assemblePackages?.status !== 'success') {
|
|
236
|
-
return defaultSet;
|
|
237
|
-
}
|
|
238
|
-
const pkgSet = context.machineContext.stepResults.assemblePackages.payload.packages;
|
|
239
|
-
const deploySet = context.machineContext.stepResults.assemblePackages.payload.deployers;
|
|
240
|
-
const integrationSet = context.machineContext.stepResults.assemblePackages.payload.integrations;
|
|
241
|
-
const vectorStoreSet = context.machineContext.stepResults.assemblePackages.payload.vector_stores;
|
|
242
|
-
const storeSet = context.machineContext.stepResults.assemblePackages.payload.stores;
|
|
243
|
-
const combinedStoreSet = context.machineContext.stepResults.assemblePackages.payload.combined_stores;
|
|
244
|
-
const speechSet = context.machineContext.stepResults.assemblePackages.payload.speech;
|
|
245
|
-
console.log({
|
|
246
|
-
pkgSet,
|
|
247
|
-
deploySet,
|
|
248
|
-
integrationSet,
|
|
249
|
-
vectorStoreSet,
|
|
250
|
-
storeSet,
|
|
251
|
-
combinedStoreSet,
|
|
252
|
-
speechSet,
|
|
253
|
-
});
|
|
254
|
-
const agent = mastra?.agents?.['danePackagePublisher'];
|
|
255
|
-
if (!agent) {
|
|
256
|
-
throw new Error('Agent not found');
|
|
257
|
-
}
|
|
258
|
-
async function buildSet(list) {
|
|
259
|
-
for (const pkg of list) {
|
|
260
|
-
await pnpmBuild.execute({
|
|
261
|
-
context: {
|
|
262
|
-
name: pkg,
|
|
263
|
-
packagePath: pkg,
|
|
264
|
-
},
|
|
265
|
-
suspend: async () => { },
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
let built = false;
|
|
270
|
-
if (pkgSet.length > 0) {
|
|
271
|
-
built = true;
|
|
272
|
-
await buildSet(pkgSet);
|
|
273
|
-
}
|
|
274
|
-
if (deploySet.length > 0) {
|
|
275
|
-
await buildSet(deploySet);
|
|
276
|
-
built = true;
|
|
277
|
-
}
|
|
278
|
-
if (integrationSet.length > 0) {
|
|
279
|
-
await buildSet(integrationSet);
|
|
280
|
-
built = true;
|
|
281
|
-
}
|
|
282
|
-
if (vectorStoreSet.length > 0) {
|
|
283
|
-
await buildSet(vectorStoreSet);
|
|
284
|
-
built = true;
|
|
285
|
-
}
|
|
286
|
-
if (speechSet.length > 0) {
|
|
287
|
-
await buildSet(speechSet);
|
|
288
|
-
built = true;
|
|
289
|
-
}
|
|
290
|
-
if (!built) {
|
|
291
|
-
console.error(chalk.red('Failed to build one or more packages'));
|
|
292
|
-
throw new Error('Failed to build one or more packages');
|
|
293
|
-
}
|
|
294
|
-
return {
|
|
295
|
-
packages: pkgSet,
|
|
296
|
-
deployers: deploySet,
|
|
297
|
-
integrations: integrationSet,
|
|
298
|
-
vector_stores: vectorStoreSet,
|
|
299
|
-
stores: storeSet,
|
|
300
|
-
combined_stores: combinedStoreSet,
|
|
301
|
-
speech: speechSet,
|
|
302
|
-
};
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
const verifyBuild = new Step({
|
|
306
|
-
id: 'verifyBuild',
|
|
307
|
-
outputSchema: z.object({
|
|
308
|
-
packages: z.array(z.string()),
|
|
309
|
-
}),
|
|
310
|
-
execute: async ({ context }) => {
|
|
311
|
-
if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
|
|
312
|
-
return {
|
|
313
|
-
packages: [],
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
|
|
317
|
-
const deploySet = context.machineContext.stepResults.buildPackages.payload.deployers;
|
|
318
|
-
const integrationSet = context.machineContext.stepResults.buildPackages.payload.integrations;
|
|
319
|
-
const vectorStoreSet = context.machineContext.stepResults.buildPackages.payload.vector_stores;
|
|
320
|
-
const storeSet = context.machineContext.stepResults.buildPackages.payload.stores;
|
|
321
|
-
const combinedStoreSet = context.machineContext.stepResults.buildPackages.payload.combined_stores;
|
|
322
|
-
const speechSet = context.machineContext.stepResults.buildPackages.payload.speech;
|
|
323
|
-
const allPackages = [
|
|
324
|
-
...pkgSet,
|
|
325
|
-
...deploySet,
|
|
326
|
-
...integrationSet,
|
|
327
|
-
...vectorStoreSet,
|
|
328
|
-
...storeSet,
|
|
329
|
-
...combinedStoreSet,
|
|
330
|
-
...speechSet,
|
|
331
|
-
];
|
|
332
|
-
function checkMissingPackages(pkgSet) {
|
|
333
|
-
const missingPackages = [];
|
|
334
|
-
for (const pkg of pkgSet) {
|
|
335
|
-
if (!existsSync(`${pkg}/dist`)) {
|
|
336
|
-
console.error(chalk.red(`We did not find the dist folder for ${pkg}.`));
|
|
337
|
-
missingPackages.push(pkg);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return missingPackages;
|
|
341
|
-
}
|
|
342
|
-
console.log('Verifying the output for:', context.machineContext.stepResults.buildPackages.payload.allPackages);
|
|
343
|
-
const missingPackages = checkMissingPackages(allPackages);
|
|
344
|
-
if (missingPackages.length > 0) {
|
|
345
|
-
console.error(chalk.red(`Missing packages: ${missingPackages.join(', ')}`));
|
|
346
|
-
throw new Error('Failed to build one or more packages');
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
packages: allPackages,
|
|
350
|
-
};
|
|
351
|
-
},
|
|
352
|
-
});
|
|
353
|
-
const publishChangeset = new Step({
|
|
354
|
-
id: 'publishChangeset',
|
|
355
|
-
outputSchema: z.object({
|
|
356
|
-
packages: z.array(z.string()),
|
|
357
|
-
}),
|
|
358
|
-
execute: async ({ context, mastra }) => {
|
|
359
|
-
if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
|
|
360
|
-
return {
|
|
361
|
-
packages: [],
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
|
|
365
|
-
const agent = mastra?.agents?.['danePackagePublisher'];
|
|
366
|
-
if (!agent) {
|
|
367
|
-
throw new Error('Agent not found');
|
|
368
|
-
}
|
|
369
|
-
const res = await agent.generate(PUBLISH_PACKAGES_PROMPT);
|
|
370
|
-
console.log(chalk.green(res.text));
|
|
371
|
-
return { packages: pkgSet };
|
|
372
|
-
},
|
|
373
|
-
});
|
|
374
|
-
const setLatestDistTag = new Step({
|
|
375
|
-
id: 'setLatestDistTag',
|
|
376
|
-
outputSchema: z.object({
|
|
377
|
-
packages: z.array(z.string()),
|
|
378
|
-
}),
|
|
379
|
-
execute: async ({ context, mastra }) => {
|
|
380
|
-
if (context.machineContext?.stepResults.publishChangeset?.status !== 'success') {
|
|
381
|
-
return {
|
|
382
|
-
packages: [],
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
const pkgSet = context.machineContext.stepResults.publishChangeset.payload.packages;
|
|
386
|
-
const agent = mastra?.agents?.['danePackagePublisher'];
|
|
387
|
-
if (!agent) {
|
|
388
|
-
throw new Error('Agent not found');
|
|
389
|
-
}
|
|
390
|
-
let res = await agent.generate(`
|
|
391
|
-
Set the active tag for these packages ${pkgSet.join(',')}.
|
|
392
|
-
`);
|
|
393
|
-
console.log(chalk.green(res.text));
|
|
394
|
-
return { packages: pkgSet };
|
|
395
|
-
},
|
|
396
|
-
});
|
|
397
|
-
packagePublisher
|
|
398
|
-
.step(getPacakgesToPublish)
|
|
399
|
-
.then(assemblePackages)
|
|
400
|
-
.then(buildPackages, {
|
|
401
|
-
when: async ({ context }) => {
|
|
402
|
-
return (context.stepResults.assemblePackages?.status === 'success' &&
|
|
403
|
-
context.stepResults.assemblePackages?.payload?.packages.length > 0);
|
|
404
|
-
},
|
|
405
|
-
})
|
|
406
|
-
.then(verifyBuild, {
|
|
407
|
-
when: async ({ context }) => {
|
|
408
|
-
return (context.stepResults.buildPackages?.status === 'success' &&
|
|
409
|
-
context.stepResults.buildPackages?.payload?.packages.length > 0);
|
|
410
|
-
},
|
|
411
|
-
})
|
|
412
|
-
.after(verifyBuild)
|
|
413
|
-
.step(publishChangeset, {
|
|
414
|
-
when: async ({ context }) => {
|
|
415
|
-
return (context.stepResults.buildPackages?.status === 'success' &&
|
|
416
|
-
context.stepResults.buildPackages?.payload?.packages.length > 0);
|
|
417
|
-
},
|
|
418
|
-
})
|
|
419
|
-
.then(setLatestDistTag, {
|
|
420
|
-
when: async ({ context }) => {
|
|
421
|
-
return (context.stepResults.publishChangeset?.status === 'success' &&
|
|
422
|
-
context.stepResults.publishChangeset?.payload?.packages.length > 0);
|
|
423
|
-
},
|
|
424
|
-
})
|
|
425
|
-
.commit();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"telephone-game.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/telephone-game.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,QAAQ,EAAiB,MAAM,wBAAwB,CAAC;AAGvE,eAAO,MAAM,qBAAqB,oBAEhC,CAAC"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { input } from '@inquirer/prompts';
|
|
2
|
-
import { Step, Workflow, getStepResult } from '@mastra/core/workflows';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
export const telephoneGameWorkflow = new Workflow({
|
|
5
|
-
name: 'telephoneGame',
|
|
6
|
-
});
|
|
7
|
-
const stepA1 = new Step({
|
|
8
|
-
id: 'stepA1',
|
|
9
|
-
description: 'Starts the message',
|
|
10
|
-
outputSchema: z.object({
|
|
11
|
-
message: z.string(),
|
|
12
|
-
}),
|
|
13
|
-
execute: async () => {
|
|
14
|
-
return {
|
|
15
|
-
message: 'Test',
|
|
16
|
-
};
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
const stepA2 = new Step({
|
|
20
|
-
id: 'stepA2',
|
|
21
|
-
description: 'Pass the message through',
|
|
22
|
-
outputSchema: z.object({
|
|
23
|
-
message: z.string(),
|
|
24
|
-
}),
|
|
25
|
-
execute: async () => {
|
|
26
|
-
const content = await input({
|
|
27
|
-
message: 'Give me a message',
|
|
28
|
-
validate: input => input.trim().length > 0 || 'Message cannot be empty',
|
|
29
|
-
});
|
|
30
|
-
return {
|
|
31
|
-
message: content,
|
|
32
|
-
};
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
const stepB2 = new Step({
|
|
36
|
-
id: 'stepB2',
|
|
37
|
-
description: 'Checks if the file exists',
|
|
38
|
-
outputSchema: z.object({
|
|
39
|
-
message: z.string(),
|
|
40
|
-
}),
|
|
41
|
-
execute: async ({ context }) => {
|
|
42
|
-
if (context.machineContext?.stepResults.stepA2?.status !== 'success') {
|
|
43
|
-
throw new Error('Message not found');
|
|
44
|
-
}
|
|
45
|
-
const msg = context.machineContext.stepResults.stepA2.payload.message;
|
|
46
|
-
return {
|
|
47
|
-
message: msg,
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
const stepC2 = new Step({
|
|
52
|
-
id: 'stepC2',
|
|
53
|
-
description: 'Ask if you should modify the message',
|
|
54
|
-
outputSchema: z.object({
|
|
55
|
-
message: z.string(),
|
|
56
|
-
}),
|
|
57
|
-
execute: async ({ suspend, context, mastra }) => {
|
|
58
|
-
const oMsg = getStepResult(context?.machineContext?.stepResults.stepA2);
|
|
59
|
-
if (context?.machineContext?.stepResults.stepC2?.status === 'success') {
|
|
60
|
-
const msg = getStepResult(context?.machineContext?.stepResults.stepC2);
|
|
61
|
-
if (msg.confirm) {
|
|
62
|
-
if (mastra?.llm) {
|
|
63
|
-
const llm = mastra?.llm({
|
|
64
|
-
provider: 'ANTHROPIC',
|
|
65
|
-
name: 'claude-3-5-haiku-20241022',
|
|
66
|
-
});
|
|
67
|
-
const result = await llm.generate(`
|
|
68
|
-
You are playing a game of telephone.
|
|
69
|
-
Here is the message the previous person sent ${oMsg.message}.
|
|
70
|
-
But you want to change the message.
|
|
71
|
-
Only return the message
|
|
72
|
-
`);
|
|
73
|
-
return {
|
|
74
|
-
message: result.text,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return oMsg;
|
|
79
|
-
}
|
|
80
|
-
await suspend();
|
|
81
|
-
return { message: 'Suspended' };
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
const stepD2 = new Step({
|
|
85
|
-
id: 'stepD2',
|
|
86
|
-
description: 'Pass the message',
|
|
87
|
-
outputSchema: z.object({
|
|
88
|
-
message: z.string(),
|
|
89
|
-
}),
|
|
90
|
-
execute: async ({ context }) => {
|
|
91
|
-
const msg = getStepResult(context?.machineContext?.stepResults.stepC2);
|
|
92
|
-
return msg;
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
telephoneGameWorkflow.step(stepA1).step(stepA2).then(stepB2).then(stepC2).then(stepD2).commit();
|