@mastra/dane 0.0.2-alpha.112 → 0.0.2-alpha.114

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