@mastra/dane 0.0.2-alpha.9 → 0.0.2-alpha.91

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 (92) 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.map +1 -1
  14. package/dist/commands/issue-labeler.js +19 -2
  15. package/dist/commands/link-checker.d.ts +4 -0
  16. package/dist/commands/link-checker.d.ts.map +1 -0
  17. package/dist/commands/link-checker.js +16 -0
  18. package/dist/commands/message.d.ts.map +1 -1
  19. package/dist/commands/message.js +3 -1
  20. package/dist/commands/new-contributor-message.d.ts +2 -0
  21. package/dist/commands/new-contributor-message.d.ts.map +1 -0
  22. package/dist/commands/new-contributor-message.js +43 -0
  23. package/dist/commands/publish-packages.d.ts +2 -0
  24. package/dist/commands/publish-packages.d.ts.map +1 -0
  25. package/dist/commands/publish-packages.js +11 -0
  26. package/dist/commands/telephone-game.d.ts +2 -0
  27. package/dist/commands/telephone-game.d.ts.map +1 -0
  28. package/dist/commands/telephone-game.js +32 -0
  29. package/dist/config/index.d.ts +12 -0
  30. package/dist/config/index.d.ts.map +1 -0
  31. package/dist/config/index.js +75 -0
  32. package/dist/index.js +30 -4
  33. package/dist/mastra/agents/index.d.ts +33 -2
  34. package/dist/mastra/agents/index.d.ts.map +1 -1
  35. package/dist/mastra/agents/index.js +62 -25
  36. package/dist/mastra/agents/model.d.ts +7 -0
  37. package/dist/mastra/agents/model.d.ts.map +1 -0
  38. package/dist/mastra/agents/model.js +7 -0
  39. package/dist/mastra/agents/new-contributor.d.ts +3 -0
  40. package/dist/mastra/agents/new-contributor.d.ts.map +1 -0
  41. package/dist/mastra/agents/new-contributor.js +12 -0
  42. package/dist/mastra/agents/package-publisher.d.ts +65 -0
  43. package/dist/mastra/agents/package-publisher.d.ts.map +1 -0
  44. package/dist/mastra/agents/package-publisher.js +172 -0
  45. package/dist/mastra/index.d.ts +134 -3
  46. package/dist/mastra/index.d.ts.map +1 -1
  47. package/dist/mastra/index.js +20 -3
  48. package/dist/mastra/integrations/index.d.ts +2 -0
  49. package/dist/mastra/integrations/index.d.ts.map +1 -1
  50. package/dist/mastra/integrations/index.js +19 -2
  51. package/dist/mastra/tools/crawl.d.ts +3 -0
  52. package/dist/mastra/tools/crawl.d.ts.map +1 -1
  53. package/dist/mastra/tools/crawl.js +4 -2
  54. package/dist/mastra/tools/execa.d.ts.map +1 -1
  55. package/dist/mastra/tools/execa.js +5 -1
  56. package/dist/mastra/tools/image.d.ts +27 -0
  57. package/dist/mastra/tools/image.d.ts.map +1 -0
  58. package/dist/mastra/tools/image.js +37 -0
  59. package/dist/mastra/tools/mcp.d.ts +3 -0
  60. package/dist/mastra/tools/mcp.d.ts.map +1 -0
  61. package/dist/mastra/tools/mcp.js +12 -0
  62. package/dist/mastra/tools/pdf.d.ts.map +1 -1
  63. package/dist/mastra/tools/pdf.js +2 -2
  64. package/dist/mastra/tools/pnpm.d.ts +60 -0
  65. package/dist/mastra/tools/pnpm.d.ts.map +1 -0
  66. package/dist/mastra/tools/pnpm.js +127 -0
  67. package/dist/mastra/workflows/changelog.d.ts +10 -0
  68. package/dist/mastra/workflows/changelog.d.ts.map +1 -0
  69. package/dist/mastra/workflows/changelog.js +149 -0
  70. package/dist/mastra/workflows/chat.d.ts.map +1 -1
  71. package/dist/mastra/workflows/chat.js +6 -11
  72. package/dist/mastra/workflows/commit-message.d.ts +10 -0
  73. package/dist/mastra/workflows/commit-message.d.ts.map +1 -0
  74. package/dist/mastra/workflows/commit-message.js +138 -0
  75. package/dist/mastra/workflows/first-contributor.d.ts +16 -0
  76. package/dist/mastra/workflows/first-contributor.d.ts.map +1 -0
  77. package/dist/mastra/workflows/first-contributor.js +122 -0
  78. package/dist/mastra/workflows/index.d.ts +1 -0
  79. package/dist/mastra/workflows/index.d.ts.map +1 -1
  80. package/dist/mastra/workflows/index.js +1 -0
  81. package/dist/mastra/workflows/issue-labeler.js +1 -1
  82. package/dist/mastra/workflows/link-checker.d.ts +13 -0
  83. package/dist/mastra/workflows/link-checker.d.ts.map +1 -0
  84. package/dist/mastra/workflows/link-checker.js +102 -0
  85. package/dist/mastra/workflows/publish-packages.d.ts +3 -0
  86. package/dist/mastra/workflows/publish-packages.d.ts.map +1 -0
  87. package/dist/mastra/workflows/publish-packages.js +260 -0
  88. package/dist/mastra/workflows/telephone-game.d.ts +3 -0
  89. package/dist/mastra/workflows/telephone-game.d.ts.map +1 -0
  90. package/dist/mastra/workflows/telephone-game.js +95 -0
  91. package/package.json +12 -9
  92. package/test-files/716a95a5c57a56d32a32b1c9592d6df0.png +0 -0
@@ -0,0 +1,75 @@
1
+ import * as fs from 'fs';
2
+ import * as os from 'os';
3
+ import * as path from 'path';
4
+ export class ConfigManager {
5
+ constructor() {
6
+ const homeDir = os.homedir();
7
+ const configDir = path.join(homeDir, '.dane');
8
+ this.configPath = path.join(configDir, 'config.json');
9
+ this.ensureConfigExists();
10
+ }
11
+ ensureConfigExists() {
12
+ const configDir = path.dirname(this.configPath);
13
+ if (!fs.existsSync(configDir)) {
14
+ fs.mkdirSync(configDir, { recursive: true });
15
+ }
16
+ if (!fs.existsSync(this.configPath)) {
17
+ fs.writeFileSync(this.configPath, JSON.stringify({}, null, 2));
18
+ }
19
+ }
20
+ get(key) {
21
+ try {
22
+ const config = JSON.parse(fs.readFileSync(this.configPath, 'utf-8'));
23
+ return config[key];
24
+ }
25
+ catch (error) {
26
+ return undefined;
27
+ }
28
+ }
29
+ set(key, value) {
30
+ try {
31
+ const config = fs.existsSync(this.configPath) ? JSON.parse(fs.readFileSync(this.configPath, 'utf-8')) : {};
32
+ config[key] = value;
33
+ fs.writeFileSync(this.configPath, JSON.stringify(config, null, 2));
34
+ }
35
+ catch (error) {
36
+ throw new Error(`Failed to set config value: ${error}`);
37
+ }
38
+ }
39
+ delete(key) {
40
+ try {
41
+ const config = fs.existsSync(this.configPath) ? JSON.parse(fs.readFileSync(this.configPath, 'utf-8')) : {};
42
+ if (key in config) {
43
+ delete config[key];
44
+ fs.writeFileSync(this.configPath, JSON.stringify(config, null, 2));
45
+ }
46
+ }
47
+ catch (error) {
48
+ throw new Error(`Failed to delete config value: ${error}`);
49
+ }
50
+ }
51
+ list() {
52
+ try {
53
+ return JSON.parse(fs.readFileSync(this.configPath, 'utf-8'));
54
+ }
55
+ catch (error) {
56
+ return {};
57
+ }
58
+ }
59
+ getAnthropicApiKey() {
60
+ const key = this.get('ANTHROPIC_API_KEY') || process.env.ANTHROPIC_API_KEY;
61
+ if (!key) {
62
+ // Check if we're in a command that requires the API key
63
+ const command = process.argv[2] || '';
64
+ const configCommands = ['config', '--help', '-h'];
65
+ // Only throw if we're not in a config-related command
66
+ if (!configCommands.includes(command)) {
67
+ throw new Error('ANTHROPIC_API_KEY not found in config. Please set it using: dane config --set ANTHROPIC_API_KEY=your_key_here');
68
+ }
69
+ return '';
70
+ }
71
+ return key;
72
+ }
73
+ }
74
+ // Create a singleton instance for easy access
75
+ export const config = new ConfigManager();
package/dist/index.js CHANGED
@@ -1,11 +1,37 @@
1
1
  #! /usr/bin/env node
2
- import dotenv from 'dotenv';
3
- dotenv.config();
4
- process.env.NODE_NO_WARNINGS = '1';
5
2
  import { Command } from 'commander';
3
+ import dotenv from 'dotenv';
4
+ import { changelog } from './commands/changelog.js';
5
+ import { commitMessageCommand } from './commands/commit-message.js';
6
+ import { configCommand } from './commands/config.js';
6
7
  import { issueLabelerCommand } from './commands/issue-labeler.js';
8
+ import { linkChecker } from './commands/link-checker.js';
7
9
  import { message } from './commands/message.js';
10
+ import { newContributorMessage } from './commands/new-contributor-message.js';
11
+ import { publishPackages } from './commands/publish-packages.js';
12
+ import { telephone } from './commands/telephone-game.js';
13
+ dotenv.config();
14
+ process.env.NODE_NO_WARNINGS = '1';
8
15
  const program = new Command();
9
16
  program.command('chat').action(message);
10
- program.command('issue-labeler').action(issueLabelerCommand);
17
+ program
18
+ .command('issue-labeler')
19
+ .description('Automatically label GitHub issues based on their content and context')
20
+ .action(issueLabelerCommand);
21
+ program
22
+ .command('commit')
23
+ .description('Create a sensible commit message based on the changes made')
24
+ .action(commitMessageCommand);
25
+ program.addCommand(configCommand);
26
+ program.command('publish').description('Publish packages to the registry').action(publishPackages);
27
+ program.command('telephone-game').description('Play a classic game of telephone').action(telephone);
28
+ program.command('changelog').description('Mastra Changelog').action(changelog);
29
+ program.command('new-contributor').description('Create a new contributor message').action(newContributorMessage);
30
+ program
31
+ .command('link-checker')
32
+ .description('Check for broken links')
33
+ .option('-u, --url <url>', 'URL to check')
34
+ .action(args => {
35
+ linkChecker({ url: args.url });
36
+ });
11
37
  program.parse(process.argv);
@@ -1,5 +1,8 @@
1
1
  import { Agent } from '@mastra/core';
2
- export declare const daneIssueLabeler: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
2
+ export declare const daneCommitMessage: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>, Record<string, import("@mastra/core").Metric>>;
3
+ export declare const daneIssueLabeler: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>, Record<string, import("@mastra/core").Metric>>;
4
+ export declare const daneLinkChecker: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>, Record<string, import("@mastra/core").Metric>>;
5
+ export declare const daneChangeLog: Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>, Record<string, import("@mastra/core").Metric>>;
3
6
  export declare const dane: Agent<{
4
7
  fsTool: import("@mastra/core").Tool<"fsTool", import("zod").ZodObject<{
5
8
  action: import("zod").ZodString;
@@ -147,10 +150,13 @@ export declare const dane: Agent<{
147
150
  limit?: number | undefined;
148
151
  }>, import("zod").ZodObject<{
149
152
  message: import("zod").ZodString;
153
+ crawlData: import("zod").ZodAny;
150
154
  }, "strip", import("zod").ZodTypeAny, {
151
155
  message: string;
156
+ crawlData?: any;
152
157
  }, {
153
158
  message: string;
159
+ crawlData?: any;
154
160
  }>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
155
161
  url: import("zod").ZodString;
156
162
  limit: import("zod").ZodDefault<import("zod").ZodNumber>;
@@ -164,5 +170,30 @@ export declare const dane: Agent<{
164
170
  pathRegex: string | null;
165
171
  limit?: number | undefined;
166
172
  }>, import("@mastra/core").WorkflowContext<any>>>;
167
- }>;
173
+ imageTool: import("@mastra/core").Tool<"imageTool", import("zod").ZodObject<{
174
+ directory: import("zod").ZodString;
175
+ prompt: import("zod").ZodString;
176
+ }, "strip", import("zod").ZodTypeAny, {
177
+ directory: string;
178
+ prompt: string;
179
+ }, {
180
+ directory: string;
181
+ prompt: string;
182
+ }>, import("zod").ZodObject<{
183
+ message: import("zod").ZodString;
184
+ }, "strip", import("zod").ZodTypeAny, {
185
+ message: string;
186
+ }, {
187
+ message: string;
188
+ }>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
189
+ directory: import("zod").ZodString;
190
+ prompt: import("zod").ZodString;
191
+ }, "strip", import("zod").ZodTypeAny, {
192
+ directory: string;
193
+ prompt: string;
194
+ }, {
195
+ directory: string;
196
+ prompt: string;
197
+ }>, import("@mastra/core").WorkflowContext<any>>>;
198
+ }, Record<string, import("@mastra/core").Metric>>;
168
199
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AASrC,eAAO,MAAM,gBAAgB,8EAW3B,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAYrC,eAAO,MAAM,iBAAiB,6HAU5B,CAAC;AAEH,eAAO,MAAM,gBAAgB,6HAO3B,CAAC;AAEH,eAAO,MAAM,eAAe,6HAa1B,CAAC;AAEH,eAAO,MAAM,aAAa,6HAcxB,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAuDf,CAAC"}
@@ -4,18 +4,56 @@ import { listEvents } from '../tools/calendar.js';
4
4
  import { crawl } from '../tools/crawl.js';
5
5
  import { execaTool } from '../tools/execa.js';
6
6
  import { fsTool } from '../tools/fs.js';
7
+ import { imageTool } from '../tools/image.js';
7
8
  import { readPDF } from '../tools/pdf.js';
9
+ import { getBaseModelConfig } from './model.js';
10
+ export const daneCommitMessage = new Agent({
11
+ name: 'DaneCommitMessage',
12
+ instructions: `
13
+ You are Dane, the ultimate GitHub operator.
14
+ You help engineers generate commit messages.
15
+
16
+ GENERATE A SCOPE FOR THE COMMIT MESSAGE IF NECESSARY.
17
+ FIGURE OUT THE BEST TOP LEVEL SEMANTIC MATCH TO USE AS THE SCOPE.
18
+ `,
19
+ model: getBaseModelConfig(),
20
+ });
8
21
  export const daneIssueLabeler = new Agent({
9
22
  name: 'DaneIssueLabeler',
10
23
  instructions: `
11
- You are Dane, the ultimate GitHub operator.
24
+ You are Dane, the ultimate GitHub operator.
12
25
  You help engineers label their issues.
13
26
  `,
14
- model: {
15
- provider: 'ANTHROPIC',
16
- toolChoice: 'auto',
17
- name: 'claude-3-5-sonnet-20241022',
18
- },
27
+ model: getBaseModelConfig(),
28
+ });
29
+ export const daneLinkChecker = new Agent({
30
+ name: 'DaneLinkChecker',
31
+ instructions: `
32
+ You are Dane, the link checker for Mastra AI. You report on broken links whenever you see them.
33
+ Make sure to include the url in the message.
34
+
35
+ ## Style Guide
36
+ - Use active voice
37
+ - Keep descriptions concise but informative
38
+ - Avoid marketing language
39
+ - Link to relevant documentation
40
+ `,
41
+ model: getBaseModelConfig(),
42
+ });
43
+ export const daneChangeLog = new Agent({
44
+ name: 'DanePackagePublisher',
45
+ instructions: `
46
+ You are Dane, the changelog writer for Mastra AI. Every week we need to write a changelog for the Mastra AI project.
47
+ ## Style Guide
48
+ - Use active voice
49
+ - Lead with the change, not the PR number
50
+ - Include PR numbers in parentheses at end of line
51
+ - Keep descriptions concise but informative
52
+ - Avoid marketing language
53
+ - Link to relevant documentation
54
+ - Use consistent formatting for code references
55
+ `,
56
+ model: getBaseModelConfig(),
19
57
  });
20
58
  export const dane = new Agent({
21
59
  name: 'Dane',
@@ -26,42 +64,42 @@ export const dane = new Agent({
26
64
  DO NOT ATTEMPT TO USE GENERAL KNOWLEDGE! We are only as good as the tools we use.
27
65
 
28
66
  # Our tools:
29
-
67
+
30
68
  ## readPDF
31
69
  Makes you a powerful agent capable of reading PDF files.
32
70
 
33
71
  ## fsTool
34
72
  Makes you a powerful agent capable of reading and writing files to the local filesystem.
35
-
73
+
36
74
  ## execaTool
37
- Makes you a powerful agent capabale of executing files on the local system.
38
-
39
- ## googleSearch
75
+ Makes you a powerful agent capabale of executing files on the local system.
76
+
77
+ ## googleSearch
40
78
  Makes you a powerful agent capabale answering all questions by finding the answer on Google search.
41
79
  Pass the query as a JS object. If you have links, ALWAYS CITE YOUR SOURCES.
42
-
80
+
43
81
  ## browserTool
44
- Makes you a powerful agent capable of scraping the web. Pass the url as a JS object.
82
+ Makes you a powerful agent capable of scraping the web. Pass the url as a JS object.
45
83
 
46
84
  ## listEvents
47
- Makes you a powerful agent capable of listing events on a calendar. When using this tool ONLY RETURN RELEVANT EVENTS.
85
+ Makes you a powerful agent capable of listing events on a calendar. When using this tool ONLY RETURN RELEVANT EVENTS.
48
86
  DO NOT ATTEMPT TO DO ANYTHING MORE.
49
87
 
50
88
  ## crawl
51
89
  Use this when the user asks you to crawl. CRAWL is the signal to use this tool.
52
- Makes you a powerful agent capable of crawling a site and extracting markdown metadata.
53
- The data will be stored in a database. Confirm that it is sucessful.
54
-
90
+ Makes you a powerful agent capable of crawling a site and extracting markdown metadata.
91
+ The data will be stored in a database if it is not already there. Confirm that it is sucessful.
92
+ The crawled data will be returned in the response on the 'crawlData' field.
93
+
94
+ ## imageTool
95
+ Makes you a powerful agent capable of generating images and saving them to disk. Pass the directory and an image prompt.
96
+
55
97
  # Rules
56
98
  * DO NOT ATTEMPT TO USE GENERAL KNOWLEDGE. Use the 'googleSearch' tool to find the answer.
57
- * Don't reference tools when you communicate with the user. Do not mention what tools you are using.
99
+ * Don't reference tools when you communicate with the user. Do not mention what tools you are using.
58
100
  * Tell the user what you are doing.
59
101
  `,
60
- model: {
61
- provider: 'ANTHROPIC',
62
- toolChoice: 'auto',
63
- name: 'claude-3-5-sonnet-20241022',
64
- },
102
+ model: getBaseModelConfig(),
65
103
  tools: {
66
104
  fsTool,
67
105
  execaTool,
@@ -70,7 +108,6 @@ export const dane = new Agent({
70
108
  readPDF,
71
109
  listEvents,
72
110
  crawl,
73
- // TODO I SHOULD BE ABLE TO PASS A WORKFLOW EXECUTE HERE
74
- // browserAgentRelay,
111
+ imageTool,
75
112
  },
76
113
  });
@@ -0,0 +1,7 @@
1
+ export declare const getBaseModelConfig: () => {
2
+ provider: "ANTHROPIC";
3
+ toolChoice: "auto";
4
+ name: string;
5
+ apiKey: string;
6
+ };
7
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/model.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB;;;;;CAK7B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { config } from '../../config/index.js';
2
+ export const getBaseModelConfig = () => ({
3
+ provider: 'ANTHROPIC',
4
+ toolChoice: 'auto',
5
+ name: 'claude-3-5-sonnet-20241022',
6
+ apiKey: config.getAnthropicApiKey(),
7
+ });
@@ -0,0 +1,3 @@
1
+ import { Agent } from '@mastra/core';
2
+ export declare const daneNewContributor: Agent<{}, Record<string, import("@mastra/core").Metric>>;
3
+ //# sourceMappingURL=new-contributor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"new-contributor.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/new-contributor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAIrC,eAAO,MAAM,kBAAkB,0DAS7B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Agent } from '@mastra/core';
2
+ import { getBaseModelConfig } from './model.js';
3
+ export const daneNewContributor = new Agent({
4
+ name: 'DaneNewContributor',
5
+ instructions: `
6
+ You're Dane, the best GitHub open-source maintainer in the world.
7
+ Your tone is friendly and joyful.
8
+ When a new contributor creates a pull request, they see your message first.
9
+ `,
10
+ model: getBaseModelConfig(),
11
+ tools: {},
12
+ });
@@ -0,0 +1,65 @@
1
+ import { Agent } from '@mastra/core';
2
+ export declare const PACKAGES_LIST_PROMPT = "\n Please analyze the following monorepo directories and identify packages that need pnpm publishing:\n CRITICAL: This step is about planning. We do not want to build anything. All packages MUST be placed in the correct order.\n \n Publish Requirements:\n - @mastra/core first, MUST be before any other package\n - all packages in correct dependency order before building\n - Identify packages that have changes requiring a new pnpm publish\n - Include create-mastra in the packages list if changes exist\n - EXCLUDE @mastra/dane from consideration\n\n Please list all packages that need building grouped by their directory. \n DO NOT NOT USE the 'pnpmBuild' tool during this step.\n ";
3
+ export declare const BUILD_PACKAGES_PROMPT: (packages: string[]) => string;
4
+ export declare const PUBLISH_PACKAGES_PROMPT = "\n <publish_changeset>\n <context>\n All packages have been successfully built and verified. Now we need to publish the changeset.\n </context>\n\n <execution_steps>\n <step order=\"1\">\n <action>Use pnpmChangesetPublish to publish all verified packages</action>\n <verification>Ensure the publish command completes successfully</verification>\n </step>\n </execution_steps>\n\n <critical_rules>\n <rule>Do not proceed if any publish errors occur</rule>\n <rule>Report any failed publishes immediately</rule>\n <rule>Ensure all packages are published atomically</rule>\n </critical_rules>\n\n <output_format>\n Report the publish status and any errors encountered.\n </output_format>\n </publish_changeset>\n \n";
5
+ export declare const danePackagePublisher: Agent<{
6
+ pnpmChangesetStatus: import("@mastra/core").Tool<"pnpmChangesetStatus", import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{
7
+ message: import("zod").ZodArray<import("zod").ZodString, "many">;
8
+ }, "strip", import("zod").ZodTypeAny, {
9
+ message: string[];
10
+ }, {
11
+ message: string[];
12
+ }>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("@mastra/core").WorkflowContext<any>>>;
13
+ pnpmBuild: import("@mastra/core").Tool<"pnpmBuild", import("zod").ZodObject<{
14
+ name: import("zod").ZodString;
15
+ packagePath: import("zod").ZodString;
16
+ }, "strip", import("zod").ZodTypeAny, {
17
+ name: string;
18
+ packagePath: string;
19
+ }, {
20
+ name: string;
21
+ packagePath: string;
22
+ }>, import("zod").ZodObject<{
23
+ message: import("zod").ZodString;
24
+ }, "strip", import("zod").ZodTypeAny, {
25
+ message: string;
26
+ }, {
27
+ message: string;
28
+ }>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
29
+ name: import("zod").ZodString;
30
+ packagePath: import("zod").ZodString;
31
+ }, "strip", import("zod").ZodTypeAny, {
32
+ name: string;
33
+ packagePath: string;
34
+ }, {
35
+ name: string;
36
+ packagePath: string;
37
+ }>, import("@mastra/core").WorkflowContext<any>>>;
38
+ pnpmChangesetPublish: import("@mastra/core").Tool<"pnpmChangesetPublish", import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{
39
+ message: import("zod").ZodString;
40
+ }, "strip", import("zod").ZodTypeAny, {
41
+ message: string;
42
+ }, {
43
+ message: string;
44
+ }>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("@mastra/core").WorkflowContext<any>>>;
45
+ activeDistTag: import("@mastra/core").Tool<"activeDistTag", import("zod").ZodObject<{
46
+ packagePath: import("zod").ZodString;
47
+ }, "strip", import("zod").ZodTypeAny, {
48
+ packagePath: string;
49
+ }, {
50
+ packagePath: string;
51
+ }>, import("zod").ZodObject<{
52
+ message: import("zod").ZodString;
53
+ }, "strip", import("zod").ZodTypeAny, {
54
+ message: string;
55
+ }, {
56
+ message: string;
57
+ }>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
58
+ packagePath: import("zod").ZodString;
59
+ }, "strip", import("zod").ZodTypeAny, {
60
+ packagePath: string;
61
+ }, {
62
+ packagePath: string;
63
+ }>, import("@mastra/core").WorkflowContext<any>>>;
64
+ }, Record<string, import("@mastra/core").Metric>>;
65
+ //# sourceMappingURL=package-publisher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-publisher.d.ts","sourceRoot":"","sources":["../../../src/mastra/agents/package-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAoDrC,eAAO,MAAM,oBAAoB,iwBAa5B,CAAC;AAEN,eAAO,MAAM,qBAAqB,aAAc,MAAM,EAAE,WAoDvD,CAAC;AAEF,eAAO,MAAM,uBAAuB,u2BAwBnC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA+B/B,CAAC"}
@@ -0,0 +1,172 @@
1
+ import { Agent } from '@mastra/core';
2
+ import { pnpmChangesetStatus, pnpmBuild, pnpmChangesetPublish, activeDistTag } from '../tools/pnpm.js';
3
+ import { getBaseModelConfig } from './model.js';
4
+ const packages_llm_text = `
5
+ # PACKAGE LOCATION RULES - FOLLOW THESE EXACTLY:
6
+
7
+ ## 1. Core packages - all must be directly under packages/:
8
+ @mastra/core -> packages/core
9
+ @mastra/deployer -> packages/deployer
10
+ mastra -> packages/cli
11
+ @mastra/engine -> packages/engine
12
+ @mastra/evals -> packages/evals
13
+ @mastra/rag -> packages/rag
14
+ @mastra/tts -> packages/tts
15
+ @mastra/memory -> packages/memory
16
+ @mastra/mcp -> packages/mcp
17
+ @mastra/loggers -> packages/loggers
18
+
19
+ ## 2. Deployer packages - STRICT RULES:
20
+ @mastra/deployer-cloudflare -> deployers/cloudflare
21
+ @mastra/deployer-vercel -> deployers/vercel
22
+ @mastra/deployer-netlify -> deployers/netlify
23
+ - NEVER in any other directory (not in integrations/, examples/, packages/, etc)
24
+
25
+ ## 3. Vector store packages - STRICT RULES:
26
+ - ALL vector packages must be directly under vector-stores/
27
+ - Format: @mastra/vector-{name} -> vector-stores/{name}
28
+ - Special case: @mastra/vector-astra -> vector-stores/astra-db
29
+
30
+ ## 4. Integrations - STRICT RULES:
31
+ - ALL integration packages are under integrations/
32
+ @mastra/apollos -> integrations/apollo
33
+ @mastra/ashby -> integrations/ashby
34
+ @mastra/github -> integrations/github
35
+ @mastra/twilio -> integrations/twilio
36
+ @mastra/stripe -> integrations/stripe
37
+ @mastra/stabilityai -> integrations/stabilityai
38
+ @mastra/sendgrid -> integrations/sendgrid
39
+ @mastra/ragie -> integrations/ragie
40
+ @mastra/resend -> integrations/resend
41
+ @mastra/coda -> integrations/coda
42
+ @mastra/firecrawl -> integrations/firecrawl
43
+
44
+ ##VALIDATION:
45
+ 1. Never mix examples/ or integrations/ with package paths
46
+ 2. Package paths must exactly match these patterns
47
+ 3. No additional subdirectories allowed
48
+ `;
49
+ export const PACKAGES_LIST_PROMPT = `
50
+ Please analyze the following monorepo directories and identify packages that need pnpm publishing:
51
+ CRITICAL: This step is about planning. We do not want to build anything. All packages MUST be placed in the correct order.
52
+
53
+ Publish Requirements:
54
+ - @mastra/core first, MUST be before any other package
55
+ - all packages in correct dependency order before building
56
+ - Identify packages that have changes requiring a new pnpm publish
57
+ - Include create-mastra in the packages list if changes exist
58
+ - EXCLUDE @mastra/dane from consideration
59
+
60
+ Please list all packages that need building grouped by their directory.
61
+ DO NOT NOT USE the 'pnpmBuild' tool during this step.
62
+ `;
63
+ export const BUILD_PACKAGES_PROMPT = (packages) => `
64
+ <build_execution>
65
+ <context>
66
+ The following packages need to be built in sequence: ${packages.join(', ')}
67
+ </context>
68
+
69
+ <execution_plan>
70
+ <phase order="1">
71
+ <!-- Core packages must be built one at a time in this exact order -->
72
+ <step>Use pnpmBuild to build @mastra/core</step>
73
+ <step>Wait for completion, then use pnpmBuild to build @mastra/deployer</step>
74
+ <step>Wait for completion, then use pnpmBuild to build mastra</step>
75
+ </phase>
76
+
77
+ <phase order="2">
78
+ <!-- After core packages, build remaining packages by directory -->
79
+ <parallel_phase name="packages">
80
+ <description>Build remaining packages/ directory packages</description>
81
+ <action>Use pnpmBuild for each remaining package:
82
+ - All @mastra/* packages
83
+ - create-mastra package (in packages/create-mastra)
84
+ </action>
85
+ </parallel_phase>
86
+
87
+ <parallel_phase name="integrations">
88
+ <description>Build integrations/ directory packages</description>
89
+ <action>Use pnpmBuild for each @mastra/integration-* package</action>
90
+ </parallel_phase>
91
+
92
+ <parallel_phase name="deployers">
93
+ <description>Build deployers/ directory packages</description>
94
+ <action>Use pnpmBuild for each @mastra/deployer-* package</action>
95
+ </parallel_phase>
96
+
97
+ <parallel_phase name="vector-stores">
98
+ <description>Build vector-stores/ directory packages</description>
99
+ <action>Use pnpmBuild for each @mastra/vector-* package</action>
100
+ </parallel_phase>
101
+ </phase>
102
+ </execution_plan>
103
+
104
+ <critical_rules>
105
+ <rule>Use pnpmBuild tool for each package</rule>
106
+ <rule>Wait for each core package to complete before starting the next</rule>
107
+ <rule>Only start parallel builds after ALL core packages are built</rule>
108
+ <rule>Verify each build succeeds before proceeding</rule>
109
+ </critical_rules>
110
+
111
+ <output_format>
112
+ Execute the builds in order and report any failures immediately.
113
+ </output_format>
114
+ </build_execution>
115
+ `;
116
+ export const PUBLISH_PACKAGES_PROMPT = `
117
+ <publish_changeset>
118
+ <context>
119
+ All packages have been successfully built and verified. Now we need to publish the changeset.
120
+ </context>
121
+
122
+ <execution_steps>
123
+ <step order="1">
124
+ <action>Use pnpmChangesetPublish to publish all verified packages</action>
125
+ <verification>Ensure the publish command completes successfully</verification>
126
+ </step>
127
+ </execution_steps>
128
+
129
+ <critical_rules>
130
+ <rule>Do not proceed if any publish errors occur</rule>
131
+ <rule>Report any failed publishes immediately</rule>
132
+ <rule>Ensure all packages are published atomically</rule>
133
+ </critical_rules>
134
+
135
+ <output_format>
136
+ Report the publish status and any errors encountered.
137
+ </output_format>
138
+ </publish_changeset>
139
+
140
+ `;
141
+ export const danePackagePublisher = new Agent({
142
+ name: 'DanePackagePublisher',
143
+ instructions: `
144
+ I am Dane, a specialized agent for managing pnpm package publications in monorepos. My core responsibilities are:
145
+
146
+ 1. Package Analysis:
147
+ - Identify packages requiring publication across the monorepo
148
+ - Detect changes that warrant new version releases
149
+ - Validate package dependencies and versioning
150
+
151
+ 2. Publication Management:
152
+ - Orchestrate the correct build order for interdependent packages
153
+ - Ensure proper versioning using changesets
154
+ - Maintain package publishing standards
155
+
156
+ 3. Directory Structure Knowledge:
157
+ ${packages_llm_text}
158
+
159
+ Important Guidelines:
160
+ - Always respect package dependencies when determining build order
161
+ - Ensure all necessary builds complete before publishing
162
+ - Follow semantic versioning principles
163
+ - Validate package.json configurations before publishing
164
+ `,
165
+ model: getBaseModelConfig(),
166
+ tools: {
167
+ pnpmChangesetStatus,
168
+ pnpmBuild,
169
+ pnpmChangesetPublish,
170
+ activeDistTag,
171
+ },
172
+ });