@mastra/dane 0.0.2-alpha.102 → 0.0.2-alpha.105

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