@mastra/dane 0.0.2-alpha.0 → 0.0.2-alpha.100

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 (126) hide show
  1. package/LICENSE +44 -0
  2. package/README.md +25 -4
  3. package/data/crawl/conventional-commit.json +25 -0
  4. package/dist/commands/changelog.d.ts +2 -0
  5. package/dist/commands/changelog.d.ts.map +1 -0
  6. package/dist/commands/changelog.js +15 -0
  7. package/dist/commands/commit-message.d.ts +2 -0
  8. package/dist/commands/commit-message.d.ts.map +1 -0
  9. package/dist/commands/commit-message.js +32 -0
  10. package/dist/commands/config.d.ts +3 -0
  11. package/dist/commands/config.d.ts.map +1 -0
  12. package/dist/commands/config.js +40 -0
  13. package/dist/commands/issue-labeler.d.ts +1 -0
  14. package/dist/commands/issue-labeler.d.ts.map +1 -0
  15. package/dist/commands/issue-labeler.js +19 -2
  16. package/dist/commands/link-checker.d.ts +4 -0
  17. package/dist/commands/link-checker.d.ts.map +1 -0
  18. package/dist/commands/link-checker.js +16 -0
  19. package/dist/commands/message.d.ts +1 -0
  20. package/dist/commands/message.d.ts.map +1 -0
  21. package/dist/commands/message.js +3 -1
  22. package/dist/commands/new-contributor-message.d.ts +2 -0
  23. package/dist/commands/new-contributor-message.d.ts.map +1 -0
  24. package/dist/commands/new-contributor-message.js +43 -0
  25. package/dist/commands/publish-packages.d.ts +2 -0
  26. package/dist/commands/publish-packages.d.ts.map +1 -0
  27. package/dist/commands/publish-packages.js +11 -0
  28. package/dist/commands/telephone-game.d.ts +2 -0
  29. package/dist/commands/telephone-game.d.ts.map +1 -0
  30. package/dist/commands/telephone-game.js +32 -0
  31. package/dist/config/index.d.ts +12 -0
  32. package/dist/config/index.d.ts.map +1 -0
  33. package/dist/config/index.js +75 -0
  34. package/dist/index.d.ts +2 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +31 -1
  37. package/dist/mastra/agents/index.d.ts +34 -2
  38. package/dist/mastra/agents/index.d.ts.map +1 -0
  39. package/dist/mastra/agents/index.js +62 -25
  40. package/dist/mastra/agents/model.d.ts +7 -0
  41. package/dist/mastra/agents/model.d.ts.map +1 -0
  42. package/dist/mastra/agents/model.js +7 -0
  43. package/dist/mastra/agents/new-contributor.d.ts +3 -0
  44. package/dist/mastra/agents/new-contributor.d.ts.map +1 -0
  45. package/dist/mastra/agents/new-contributor.js +12 -0
  46. package/dist/mastra/agents/package-publisher.d.ts +65 -0
  47. package/dist/mastra/agents/package-publisher.d.ts.map +1 -0
  48. package/dist/mastra/agents/package-publisher.js +168 -0
  49. package/dist/mastra/index.d.ts +135 -5
  50. package/dist/mastra/index.d.ts.map +1 -0
  51. package/dist/mastra/index.js +21 -8
  52. package/dist/mastra/integrations/index.d.ts +3 -0
  53. package/dist/mastra/integrations/index.d.ts.map +1 -0
  54. package/dist/mastra/integrations/index.js +19 -2
  55. package/dist/mastra/tools/browser.d.ts +1 -0
  56. package/dist/mastra/tools/browser.d.ts.map +1 -0
  57. package/dist/mastra/tools/browser.js +10 -12
  58. package/dist/mastra/tools/calendar.d.ts +1 -0
  59. package/dist/mastra/tools/calendar.d.ts.map +1 -0
  60. package/dist/mastra/tools/crawl.d.ts +4 -0
  61. package/dist/mastra/tools/crawl.d.ts.map +1 -0
  62. package/dist/mastra/tools/crawl.js +7 -4
  63. package/dist/mastra/tools/execa.d.ts +1 -0
  64. package/dist/mastra/tools/execa.d.ts.map +1 -0
  65. package/dist/mastra/tools/execa.js +5 -1
  66. package/dist/mastra/tools/fs.d.ts +1 -0
  67. package/dist/mastra/tools/fs.d.ts.map +1 -0
  68. package/dist/mastra/tools/image.d.ts +27 -0
  69. package/dist/mastra/tools/image.d.ts.map +1 -0
  70. package/dist/mastra/tools/image.js +37 -0
  71. package/dist/mastra/tools/mcp.d.ts +3 -0
  72. package/dist/mastra/tools/mcp.d.ts.map +1 -0
  73. package/dist/mastra/tools/mcp.js +12 -0
  74. package/dist/mastra/tools/pdf.d.ts +1 -0
  75. package/dist/mastra/tools/pdf.d.ts.map +1 -0
  76. package/dist/mastra/tools/pdf.js +3 -2
  77. package/dist/mastra/tools/pnpm.d.ts +60 -0
  78. package/dist/mastra/tools/pnpm.d.ts.map +1 -0
  79. package/dist/mastra/tools/pnpm.js +127 -0
  80. package/dist/mastra/workflows/changelog.d.ts +10 -0
  81. package/dist/mastra/workflows/changelog.d.ts.map +1 -0
  82. package/dist/mastra/workflows/changelog.js +149 -0
  83. package/dist/mastra/workflows/chat.d.ts +1 -0
  84. package/dist/mastra/workflows/chat.d.ts.map +1 -0
  85. package/dist/mastra/workflows/chat.js +6 -11
  86. package/dist/mastra/workflows/commit-message.d.ts +10 -0
  87. package/dist/mastra/workflows/commit-message.d.ts.map +1 -0
  88. package/dist/mastra/workflows/commit-message.js +138 -0
  89. package/dist/mastra/workflows/first-contributor.d.ts +16 -0
  90. package/dist/mastra/workflows/first-contributor.d.ts.map +1 -0
  91. package/dist/mastra/workflows/first-contributor.js +122 -0
  92. package/dist/mastra/workflows/index.d.ts +2 -0
  93. package/dist/mastra/workflows/index.d.ts.map +1 -0
  94. package/dist/mastra/workflows/index.js +1 -0
  95. package/dist/mastra/workflows/issue-labeler.d.ts +1 -0
  96. package/dist/mastra/workflows/issue-labeler.d.ts.map +1 -0
  97. package/dist/mastra/workflows/issue-labeler.js +1 -1
  98. package/dist/mastra/workflows/link-checker.d.ts +13 -0
  99. package/dist/mastra/workflows/link-checker.d.ts.map +1 -0
  100. package/dist/mastra/workflows/link-checker.js +102 -0
  101. package/dist/mastra/workflows/publish-packages.d.ts +3 -0
  102. package/dist/mastra/workflows/publish-packages.d.ts.map +1 -0
  103. package/dist/mastra/workflows/publish-packages.js +344 -0
  104. package/dist/mastra/workflows/telephone-game.d.ts +3 -0
  105. package/dist/mastra/workflows/telephone-game.d.ts.map +1 -0
  106. package/dist/mastra/workflows/telephone-game.js +95 -0
  107. package/package.json +19 -10
  108. package/test-files/716a95a5c57a56d32a32b1c9592d6df0.png +0 -0
  109. package/CHANGELOG.md +0 -19
  110. package/docker-compose.yaml +0 -22
  111. package/src/commands/issue-labeler.ts +0 -26
  112. package/src/commands/message.ts +0 -16
  113. package/src/index.ts +0 -12
  114. package/src/mastra/agents/index.ts +0 -79
  115. package/src/mastra/index.ts +0 -32
  116. package/src/mastra/integrations/index.ts +0 -14
  117. package/src/mastra/tools/browser.ts +0 -132
  118. package/src/mastra/tools/calendar.ts +0 -154
  119. package/src/mastra/tools/crawl.ts +0 -26
  120. package/src/mastra/tools/execa.ts +0 -41
  121. package/src/mastra/tools/fs.ts +0 -36
  122. package/src/mastra/tools/pdf.ts +0 -46
  123. package/src/mastra/workflows/chat.ts +0 -111
  124. package/src/mastra/workflows/index.ts +0 -2
  125. package/src/mastra/workflows/issue-labeler.ts +0 -104
  126. package/tsconfig.json +0 -11
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-checker.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/link-checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAI9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,mBAAmB;;;;;;;;;GAM9B,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { Step, Workflow } from '@mastra/core';
2
+ import chalk from 'chalk';
3
+ import child_process from 'node:child_process';
4
+ import util from 'node:util';
5
+ import { z } from 'zod';
6
+ import { slack } from '../tools/mcp.js';
7
+ const exec = util.promisify(child_process.exec);
8
+ export const linkCheckerWorkflow = new Workflow({
9
+ name: 'link-checker',
10
+ triggerSchema: z.object({
11
+ channelId: z.string(),
12
+ targetUrl: z.string(),
13
+ }),
14
+ });
15
+ const linkSchema = z.object({
16
+ url: z.string(),
17
+ status: z.number(),
18
+ state: z.enum(['OK', 'BROKEN']),
19
+ parent: z.string().optional(),
20
+ });
21
+ const getBrokenLinks = new Step({
22
+ id: 'get-broken-links',
23
+ description: 'Get broken links',
24
+ inputSchema: z.object({
25
+ targetUrl: z.string(),
26
+ }),
27
+ outputSchema: z.object({
28
+ brokenLinks: z.array(linkSchema),
29
+ }),
30
+ execute: async ({ context }) => {
31
+ const targetUrl = context.targetUrl;
32
+ const res = await exec(`npx linkinator ${targetUrl} --format json`, {
33
+ encoding: 'utf-8',
34
+ });
35
+ if (res.stderr) {
36
+ throw new Error(res.stderr);
37
+ }
38
+ const data = JSON.parse(res.stdout);
39
+ const parsedData = linkSchema.array().parse(data.links);
40
+ return {
41
+ brokenLinks: parsedData.filter(link => link.state === 'BROKEN'),
42
+ };
43
+ },
44
+ });
45
+ const reportBrokenLinks = new Step({
46
+ id: 'report-broken-links',
47
+ description: 'Report broken links',
48
+ outputSchema: z.object({
49
+ message: z.string(),
50
+ }),
51
+ execute: async ({ context, mastra }) => {
52
+ const brokenLinks = context.machineContext?.getStepPayload('get-broken-links');
53
+ if (!brokenLinks) {
54
+ return {
55
+ message: 'No broken links found',
56
+ };
57
+ }
58
+ if (brokenLinks.brokenLinks.length === 0) {
59
+ return {
60
+ message: 'No broken links found',
61
+ };
62
+ }
63
+ try {
64
+ await slack.connect();
65
+ }
66
+ catch (e) {
67
+ console.error(e);
68
+ }
69
+ const triggerPayload = context.machineContext?.getStepPayload('trigger');
70
+ if (!triggerPayload) {
71
+ return {
72
+ message: 'Trigger payload not found',
73
+ };
74
+ }
75
+ const agent = mastra?.agents?.daneLinkChecker;
76
+ if (!agent) {
77
+ return {
78
+ message: 'Agent not found',
79
+ };
80
+ }
81
+ const tools = await slack.tools();
82
+ console.log(`🤖Generating...`);
83
+ const res = await agent.generate(`
84
+ Send this ${JSON.stringify(brokenLinks, null, 2)} to this slack channel: "${triggerPayload.channelId}" with the tool slack_post_message.
85
+ Format it in markdown so it displays nicely in slack.
86
+ `, {
87
+ toolsets: { slack: tools },
88
+ });
89
+ console.log(chalk.green(res.text));
90
+ return {
91
+ message: res.text,
92
+ };
93
+ },
94
+ });
95
+ linkCheckerWorkflow
96
+ .step(getBrokenLinks, {
97
+ variables: {
98
+ targetUrl: { step: 'trigger', path: 'targetUrl' },
99
+ },
100
+ })
101
+ .then(reportBrokenLinks)
102
+ .commit();
@@ -0,0 +1,3 @@
1
+ import { Workflow } from '@mastra/core';
2
+ export declare const packagePublisher: Workflow<any, any>;
3
+ //# sourceMappingURL=publish-packages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-packages.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/publish-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,cAAc,CAAC;AAQrD,eAAO,MAAM,gBAAgB,oBAE3B,CAAC"}
@@ -0,0 +1,344 @@
1
+ import { Step, Workflow } from '@mastra/core';
2
+ import chalk from 'chalk';
3
+ import { existsSync } from 'fs';
4
+ import path from 'path';
5
+ import { z } from 'zod';
6
+ import { BUILD_PACKAGES_PROMPT, PACKAGES_LIST_PROMPT, PUBLISH_PACKAGES_PROMPT } from '../agents/package-publisher.js';
7
+ export const packagePublisher = new Workflow({
8
+ name: 'pnpm-changset-publisher',
9
+ });
10
+ const outputSchema = z.object({
11
+ packages: z.array(z.string()),
12
+ integrations: z.array(z.string()),
13
+ deployers: z.array(z.string()),
14
+ vector_stores: z.array(z.string()),
15
+ speech: z.array(z.string()),
16
+ });
17
+ const defaultSet = {
18
+ packages: [],
19
+ deployers: [],
20
+ integrations: [],
21
+ vector_stores: [],
22
+ speech: [],
23
+ };
24
+ const getPacakgesToPublish = new Step({
25
+ id: 'getPacakgesToPublish',
26
+ outputSchema,
27
+ execute: async ({ mastra }) => {
28
+ const agent = mastra?.agents?.['danePackagePublisher'];
29
+ if (!agent) {
30
+ throw new Error('Agent not found');
31
+ }
32
+ const result = await agent.generate(PACKAGES_LIST_PROMPT);
33
+ console.log(chalk.green(`\n${result.text}`));
34
+ const resultObj = await agent.generate(`
35
+ Please convert this into a structured object:
36
+
37
+ Input Text: ${result.text}
38
+
39
+ 1. Order Requirements:
40
+ - @mastra/core MUST be first within packages
41
+ - @mastra/deployer MUST be second within packages
42
+ - Group parallel builds by directory type
43
+
44
+ 2. Output Format:
45
+ - Group into: packages[], integrations[], deployers[], vector_stores[]
46
+ - Place create-mastra in packages[] array
47
+ - Maintain correct order within each group
48
+
49
+ 3. Critical Rules:
50
+ - Never publish without building first
51
+ - Only include packages that need updates
52
+ - Follow dependency order strictly
53
+ `, {
54
+ output: z.object({
55
+ packages: z.array(z.string()),
56
+ integrations: z.array(z.string()),
57
+ deployers: z.array(z.string()),
58
+ vector_stores: z.array(z.string()),
59
+ speech: z.array(z.string()),
60
+ }),
61
+ });
62
+ return {
63
+ packages: resultObj?.object?.packages,
64
+ integrations: resultObj?.object?.integrations,
65
+ deployers: resultObj?.object?.deployers,
66
+ vector_stores: resultObj?.object?.vector_stores,
67
+ speech: resultObj?.object?.speech,
68
+ };
69
+ },
70
+ });
71
+ const assemblePackages = new Step({
72
+ id: 'assemblePackages',
73
+ outputSchema,
74
+ execute: async ({ context }) => {
75
+ if (context.machineContext?.stepResults.getPacakgesToPublish?.status !== 'success') {
76
+ return {
77
+ packages: [],
78
+ integrations: [],
79
+ deployers: [],
80
+ vector_stores: [],
81
+ speech: [],
82
+ };
83
+ }
84
+ const payload = context.machineContext.stepResults.getPacakgesToPublish.payload;
85
+ const packagesToBuild = new Set();
86
+ const deployersToBuild = new Set();
87
+ const integrationsToBuild = new Set();
88
+ const vector_storesToBuild = new Set();
89
+ const speechToBuild = new Set();
90
+ if (payload?.packages) {
91
+ payload.packages.forEach((pkg) => {
92
+ let pkgName = pkg.replace('@mastra/', '');
93
+ if (pkgName === 'mastra') {
94
+ pkgName = 'cli';
95
+ }
96
+ const pkgPath = path.join(process.cwd(), 'packages', pkgName);
97
+ packagesToBuild.add(pkgPath);
98
+ });
99
+ }
100
+ if (payload?.deployers) {
101
+ payload.deployers.forEach((pkg) => {
102
+ let pkgName = pkg.replace('@mastra/deployer-', '');
103
+ if (pkgName === 'mastra') {
104
+ pkgName = 'cli';
105
+ }
106
+ const pkgPath = path.join(process.cwd(), 'deployers', pkgName);
107
+ deployersToBuild.add(pkgPath);
108
+ });
109
+ }
110
+ if (payload?.vector_stores) {
111
+ payload.vector_stores.forEach((pkg) => {
112
+ let pkgName = pkg.replace('@mastra/vector-', '');
113
+ const pkgPath = path.join(process.cwd(), 'vector-stores', pkgName);
114
+ vector_storesToBuild.add(pkgPath);
115
+ });
116
+ }
117
+ if (payload?.integrations) {
118
+ const integrations = payload.integrations;
119
+ integrations.forEach((integration) => {
120
+ let pkgName = integration.replace('@mastra/', '');
121
+ const integrationPath = path.join(process.cwd(), 'integrations', pkgName);
122
+ integrationsToBuild.add(integrationPath);
123
+ });
124
+ }
125
+ if (payload?.speech) {
126
+ const speecs = payload.speech;
127
+ speecs.forEach((speech) => {
128
+ let pkgName = speech.replace('@mastra/speech-', '');
129
+ const speechPath = path.join(process.cwd(), 'speech', pkgName);
130
+ speechToBuild.add(speechPath);
131
+ });
132
+ }
133
+ const pkgSet = Array.from(packagesToBuild.keys());
134
+ const deploySet = Array.from(deployersToBuild.keys());
135
+ const integrationSet = Array.from(integrationsToBuild.keys());
136
+ const vectorStoreSet = Array.from(vector_storesToBuild.keys());
137
+ const speechSet = Array.from(speechToBuild.keys());
138
+ if (!packagesToBuild.size && !deployersToBuild.size && !integrationsToBuild.size && !vector_storesToBuild.size) {
139
+ console.error(chalk.red('No packages to build.'));
140
+ return defaultSet;
141
+ }
142
+ console.log(chalk.green(`\nBuilding packages:\n`));
143
+ pkgSet.forEach((pkg) => {
144
+ console.log(chalk.green(pkg));
145
+ });
146
+ if (deploySet.length > 0) {
147
+ console.log(chalk.green(`\nBuilding deployers:\n`));
148
+ deploySet.forEach((pkg) => {
149
+ console.log(chalk.green(pkg));
150
+ });
151
+ }
152
+ if (integrationSet.length > 0) {
153
+ console.log(chalk.green(`\nBuilding integrations:\n`));
154
+ integrationSet.forEach((pkg) => {
155
+ console.log(chalk.green(pkg));
156
+ });
157
+ }
158
+ if (vectorStoreSet.length > 0) {
159
+ console.log(chalk.green(`\nBuilding vector stores:\n`));
160
+ vectorStoreSet.forEach((pkg) => {
161
+ console.log(chalk.green(pkg));
162
+ });
163
+ }
164
+ if (speechSet.length > 0) {
165
+ console.log(chalk.green(`\nBuilding speech:\n`));
166
+ speechSet.forEach((pkg) => {
167
+ console.log(chalk.green(pkg));
168
+ });
169
+ }
170
+ return {
171
+ packages: pkgSet,
172
+ deployers: deploySet,
173
+ integrations: integrationSet,
174
+ vector_stores: vectorStoreSet,
175
+ speech: speechSet,
176
+ };
177
+ },
178
+ });
179
+ async function buildSet(agent, list) {
180
+ let res = await agent.generate(BUILD_PACKAGES_PROMPT(list));
181
+ console.log(chalk.green(res.text));
182
+ return res.text;
183
+ }
184
+ const buildPackages = new Step({
185
+ id: 'buildPackages',
186
+ outputSchema,
187
+ execute: async ({ context, mastra }) => {
188
+ if (context.machineContext?.stepResults.assemblePackages?.status !== 'success') {
189
+ return defaultSet;
190
+ }
191
+ const pkgSet = context.machineContext.stepResults.assemblePackages.payload.packages;
192
+ const deploySet = context.machineContext.stepResults.assemblePackages.payload.deployers;
193
+ const integrationSet = context.machineContext.stepResults.assemblePackages.payload.integrations;
194
+ const vectorStoreSet = context.machineContext.stepResults.assemblePackages.payload.vector_stores;
195
+ const speechSet = context.machineContext.stepResults.assemblePackages.payload.speech;
196
+ const agent = mastra?.agents?.['danePackagePublisher'];
197
+ if (!agent) {
198
+ throw new Error('Agent not found');
199
+ }
200
+ let built = false;
201
+ if (pkgSet.length > 0) {
202
+ built = true;
203
+ await buildSet(agent, pkgSet);
204
+ }
205
+ if (deploySet.length > 0) {
206
+ await buildSet(agent, deploySet);
207
+ built = true;
208
+ }
209
+ if (integrationSet.length > 0) {
210
+ await buildSet(agent, integrationSet);
211
+ built = true;
212
+ }
213
+ if (vectorStoreSet.length > 0) {
214
+ await buildSet(agent, vectorStoreSet);
215
+ built = true;
216
+ }
217
+ if (speechSet.length > 0) {
218
+ await buildSet(agent, speechSet);
219
+ built = true;
220
+ }
221
+ if (!built) {
222
+ console.error(chalk.red('Failed to build one or more packages'));
223
+ throw new Error('Failed to build one or more packages');
224
+ }
225
+ return {
226
+ packages: pkgSet,
227
+ deployers: deploySet,
228
+ integrations: integrationSet,
229
+ vector_stores: vectorStoreSet,
230
+ speech: speechSet,
231
+ };
232
+ },
233
+ });
234
+ const verifyBuild = new Step({
235
+ id: 'verifyBuild',
236
+ outputSchema: z.object({
237
+ packages: z.array(z.string()),
238
+ }),
239
+ execute: async ({ context }) => {
240
+ if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
241
+ return {
242
+ packages: [],
243
+ };
244
+ }
245
+ const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
246
+ const deploySet = context.machineContext.stepResults.buildPackages.payload.deployers;
247
+ const integrationSet = context.machineContext.stepResults.buildPackages.payload.integrations;
248
+ const vectorStoreSet = context.machineContext.stepResults.buildPackages.payload.vector_stores;
249
+ const speechSet = context.machineContext.stepResults.buildPackages.payload.speech;
250
+ const allPackages = [...pkgSet, ...deploySet, ...integrationSet, ...vectorStoreSet, ...speechSet];
251
+ function checkMissingPackages(pkgSet) {
252
+ const missingPackages = [];
253
+ for (const pkg of pkgSet) {
254
+ if (!existsSync(`${pkg}/dist`)) {
255
+ console.error(chalk.red(`We did not find the dist folder for ${pkg}.`));
256
+ missingPackages.push(pkg);
257
+ }
258
+ }
259
+ return missingPackages;
260
+ }
261
+ console.log('Verifying the output for:', context.machineContext.stepResults.buildPackages.payload.allPackages);
262
+ const missingPackages = checkMissingPackages(allPackages);
263
+ if (missingPackages.length > 0) {
264
+ console.error(chalk.red(`Missing packages: ${missingPackages.join(', ')}`));
265
+ throw new Error('Failed to build one or more packages');
266
+ }
267
+ return {
268
+ packages: allPackages,
269
+ };
270
+ },
271
+ });
272
+ const publishChangeset = new Step({
273
+ id: 'publishChangeset',
274
+ outputSchema: z.object({
275
+ packages: z.array(z.string()),
276
+ }),
277
+ execute: async ({ context, mastra }) => {
278
+ if (context.machineContext?.stepResults.buildPackages?.status !== 'success') {
279
+ return {
280
+ packages: [],
281
+ };
282
+ }
283
+ const pkgSet = context.machineContext.stepResults.buildPackages.payload.packages;
284
+ const agent = mastra?.agents?.['danePackagePublisher'];
285
+ if (!agent) {
286
+ throw new Error('Agent not found');
287
+ }
288
+ const res = await agent.generate(PUBLISH_PACKAGES_PROMPT);
289
+ console.log(chalk.green(res.text));
290
+ return { packages: pkgSet };
291
+ },
292
+ });
293
+ const setLatestDistTag = new Step({
294
+ id: 'setLatestDistTag',
295
+ outputSchema: z.object({
296
+ packages: z.array(z.string()),
297
+ }),
298
+ execute: async ({ context, mastra }) => {
299
+ if (context.machineContext?.stepResults.publishChangeset?.status !== 'success') {
300
+ return {
301
+ packages: [],
302
+ };
303
+ }
304
+ const pkgSet = context.machineContext.stepResults.publishChangeset.payload.packages;
305
+ const agent = mastra?.agents?.['danePackagePublisher'];
306
+ if (!agent) {
307
+ throw new Error('Agent not found');
308
+ }
309
+ let res = await agent.generate(`
310
+ Set the active tag for these packages ${pkgSet.join(',')}.
311
+ `);
312
+ console.log(chalk.green(res.text));
313
+ return { packages: pkgSet };
314
+ },
315
+ });
316
+ packagePublisher
317
+ .step(getPacakgesToPublish)
318
+ .then(assemblePackages)
319
+ .then(buildPackages, {
320
+ when: async ({ context }) => {
321
+ return (context.stepResults.assemblePackages?.status === 'success' &&
322
+ context.stepResults.assemblePackages?.payload?.packages.length > 0);
323
+ },
324
+ })
325
+ .then(verifyBuild, {
326
+ when: async ({ context }) => {
327
+ return (context.stepResults.buildPackages?.status === 'success' &&
328
+ context.stepResults.buildPackages?.payload?.packages.length > 0);
329
+ },
330
+ })
331
+ .after(verifyBuild)
332
+ .step(publishChangeset, {
333
+ when: async ({ context }) => {
334
+ return (context.stepResults.buildPackages?.status === 'success' &&
335
+ context.stepResults.buildPackages?.payload?.packages.length > 0);
336
+ },
337
+ })
338
+ .then(setLatestDistTag, {
339
+ when: async ({ context }) => {
340
+ return (context.stepResults.publishChangeset?.status === 'success' &&
341
+ context.stepResults.publishChangeset?.payload?.packages.length > 0);
342
+ },
343
+ })
344
+ .commit();
@@ -0,0 +1,3 @@
1
+ import { Workflow } from '@mastra/core';
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,cAAc,CAAC;AAG7D,eAAO,MAAM,qBAAqB,oBAEhC,CAAC"}
@@ -0,0 +1,95 @@
1
+ import { input } from '@inquirer/prompts';
2
+ import { Step, Workflow, getStepResult } from '@mastra/core';
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,8 +1,14 @@
1
1
  {
2
2
  "name": "@mastra/dane",
3
- "version": "0.0.2-alpha.0",
3
+ "version": "0.0.2-alpha.100",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
+ "files": [
7
+ "dist",
8
+ "data",
9
+ "test",
10
+ "test-files"
11
+ ],
6
12
  "bin": {
7
13
  "dane": "./dist/index.js"
8
14
  },
@@ -16,12 +22,14 @@
16
22
  "tsx": "^4.19.2"
17
23
  },
18
24
  "dependencies": {
25
+ "@inquirer/prompts": "^7.2.1",
19
26
  "boxen": "^8.0.1",
20
27
  "chalk": "^5.3.0",
21
28
  "cli-table3": "^0.6.5",
22
29
  "commander": "^12.1.0",
30
+ "dotenv": "^16.4.7",
31
+ "drizzle-kit": "^0.30.1",
23
32
  "execa": "^9.3.1",
24
- "inquirer": "^12.2.0",
25
33
  "luxon": "^3.5.0",
26
34
  "node-ical": "^0.20.1",
27
35
  "node-screenshots": "^0.2.1",
@@ -29,18 +37,19 @@
29
37
  "playwright": "^1.49.1",
30
38
  "playwright-core": "^1.49.1",
31
39
  "sqlite3": "^5.1.7",
32
- "typescript": "^5.5.4",
40
+ "typescript": "^5.7.3",
33
41
  "zod": "^3.24.0",
34
- "@mastra/firecrawl": "1.0.4-alpha.21",
35
- "@mastra/core": "0.1.27-alpha.37",
36
- "@mastra/engine": "0.0.5-alpha.31",
37
- "@mastra/memory": "0.0.2-alpha.16",
38
- "@mastra/github": "1.0.3-alpha.20",
39
- "@mastra/rag": "0.0.2-alpha.21"
42
+ "@mastra/engine": "0.0.5-alpha.75",
43
+ "@mastra/github": "1.0.3-alpha.64",
44
+ "@mastra/memory": "0.0.2-alpha.62",
45
+ "@mastra/rag": "0.0.2-alpha.71",
46
+ "@mastra/mcp": "0.0.1-alpha.22",
47
+ "@mastra/firecrawl": "1.0.4-alpha.73",
48
+ "@mastra/stabilityai": "1.0.1-alpha.55",
49
+ "@mastra/core": "0.1.27-alpha.80"
40
50
  },
41
51
  "scripts": {
42
52
  "build": "npx tsc",
43
- "issue-labeler": "npx bun src/issue-labeler.ts",
44
53
  "start": "npx bun src/index.ts",
45
54
  "test": "echo \"Error: no test specified\" && exit 1"
46
55
  }
package/CHANGELOG.md DELETED
@@ -1,19 +0,0 @@
1
- # @mastra/dane
2
-
3
- ## 0.0.2-alpha.0
4
-
5
- ### Patch Changes
6
-
7
- - b5393f1: New example: Dane and many fixes to make it work
8
- - 697fbbe: Setup Dane, a cli assistant using the mastra framework.
9
- - Updated dependencies [45fd5b8]
10
- - Updated dependencies [c872875]
11
- - Updated dependencies [f6da688]
12
- - Updated dependencies [1cc6cc0]
13
- - Updated dependencies [b5393f1]
14
- - @mastra/rag@0.0.2-alpha.21
15
- - @mastra/core@0.1.27-alpha.37
16
- - @mastra/engine@0.0.5-alpha.31
17
- - @mastra/firecrawl@1.0.4-alpha.21
18
- - @mastra/memory@0.0.2-alpha.16
19
- - @mastra/github@1.0.3-alpha.20
@@ -1,22 +0,0 @@
1
- services:
2
- db:
3
- image: pgvector/pgvector:pg16
4
- container_name: 'dane-db'
5
- ports:
6
- - '5433:5432'
7
- environment:
8
- POSTGRES_USER: ${POSTGRES_USER:-postgres}
9
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
10
- POSTGRES_DB: ${POSTGRES_DB:-mastra}
11
- redis:
12
- image: redis
13
- ports:
14
- - 6379:6379
15
- serverless-redis-http:
16
- ports:
17
- - "8079:80"
18
- image: hiett/serverless-redis-http:latest
19
- environment:
20
- SRH_MODE: env
21
- SRH_TOKEN: example_token
22
- SRH_CONNECTION_STRING: "redis://redis:6379" # Using `redis` hostname since they're in the same Docker network.