@mastra/dane 0.0.2-alpha.31 → 0.0.2-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/commit-message.d.ts +2 -0
- package/dist/commands/commit-message.d.ts.map +1 -0
- package/dist/commands/commit-message.js +31 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +40 -0
- package/dist/commands/issue-labeler.d.ts +2 -0
- package/dist/commands/issue-labeler.d.ts.map +1 -0
- package/dist/commands/issue-labeler.js +34 -0
- package/dist/commands/message.d.ts +2 -0
- package/dist/commands/message.d.ts.map +1 -0
- package/dist/commands/message.js +12 -0
- package/dist/commands/publish-packages.d.ts +2 -0
- package/dist/commands/publish-packages.d.ts.map +1 -0
- package/dist/commands/publish-packages.js +9 -0
- package/dist/config/index.d.ts +12 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +75 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/mastra/agents/index.d.ts +282 -0
- package/dist/mastra/agents/index.d.ts.map +1 -0
- package/dist/mastra/agents/index.js +106 -0
- package/dist/mastra/index.d.ts +318 -0
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/mastra/index.js +34 -0
- package/dist/mastra/integrations/index.d.ts +7 -0
- package/dist/mastra/integrations/index.d.ts.map +1 -0
- package/dist/mastra/integrations/index.js +29 -0
- package/dist/mastra/tools/browser.d.ts +40 -0
- package/dist/mastra/tools/browser.d.ts.map +1 -0
- package/dist/mastra/tools/browser.js +116 -0
- package/dist/mastra/tools/calendar.d.ts +21 -0
- package/dist/mastra/tools/calendar.d.ts.map +1 -0
- package/dist/mastra/tools/calendar.js +134 -0
- package/dist/mastra/tools/crawl.d.ts +36 -0
- package/dist/mastra/tools/crawl.d.ts.map +1 -0
- package/dist/mastra/tools/crawl.js +26 -0
- package/dist/mastra/tools/execa.d.ts +27 -0
- package/dist/mastra/tools/execa.d.ts.map +1 -0
- package/dist/mastra/tools/execa.js +43 -0
- package/dist/mastra/tools/fs.d.ts +33 -0
- package/dist/mastra/tools/fs.d.ts.map +1 -0
- package/dist/mastra/tools/fs.js +36 -0
- package/dist/mastra/tools/image.d.ts +27 -0
- package/dist/mastra/tools/image.d.ts.map +1 -0
- package/dist/mastra/tools/image.js +37 -0
- package/dist/mastra/tools/pdf.d.ts +21 -0
- package/dist/mastra/tools/pdf.d.ts.map +1 -0
- package/dist/mastra/tools/pdf.js +42 -0
- package/dist/mastra/tools/pnpm.d.ts +60 -0
- package/dist/mastra/tools/pnpm.d.ts.map +1 -0
- package/dist/mastra/tools/pnpm.js +128 -0
- package/dist/mastra/workflows/chat.d.ts +13 -0
- package/dist/mastra/workflows/chat.d.ts.map +1 -0
- package/dist/mastra/workflows/chat.js +89 -0
- package/dist/mastra/workflows/commit-message.d.ts +10 -0
- package/dist/mastra/workflows/commit-message.d.ts.map +1 -0
- package/dist/mastra/workflows/commit-message.js +137 -0
- package/dist/mastra/workflows/index.d.ts +4 -0
- package/dist/mastra/workflows/index.d.ts.map +1 -0
- package/dist/mastra/workflows/index.js +3 -0
- package/dist/mastra/workflows/issue-labeler.d.ts +16 -0
- package/dist/mastra/workflows/issue-labeler.d.ts.map +1 -0
- package/dist/mastra/workflows/issue-labeler.js +85 -0
- package/dist/mastra/workflows/publish-packages.d.ts +3 -0
- package/dist/mastra/workflows/publish-packages.d.ts.map +1 -0
- package/dist/mastra/workflows/publish-packages.js +202 -0
- package/package.json +4 -4
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
|
+
import { config } from '../../config/index.js';
|
|
3
|
+
import { browserTool, googleSearch } from '../tools/browser.js';
|
|
4
|
+
import { listEvents } from '../tools/calendar.js';
|
|
5
|
+
import { crawl } from '../tools/crawl.js';
|
|
6
|
+
import { execaTool } from '../tools/execa.js';
|
|
7
|
+
import { fsTool } from '../tools/fs.js';
|
|
8
|
+
import { imageTool } from '../tools/image.js';
|
|
9
|
+
import { readPDF } from '../tools/pdf.js';
|
|
10
|
+
import { activeDistTag, pnpmBuild, pnpmChangesetPublish, pnpmChangesetStatus } from '../tools/pnpm.js';
|
|
11
|
+
const getBaseModelConfig = () => ({
|
|
12
|
+
provider: 'ANTHROPIC',
|
|
13
|
+
toolChoice: 'auto',
|
|
14
|
+
name: 'claude-3-5-sonnet-20241022',
|
|
15
|
+
apiKey: config.getAnthropicApiKey(),
|
|
16
|
+
});
|
|
17
|
+
export const daneCommitMessage = new Agent({
|
|
18
|
+
name: 'DaneCommitMessage',
|
|
19
|
+
instructions: `
|
|
20
|
+
You are Dane, the ultimate GitHub operator.
|
|
21
|
+
You help engineers generate commit messages.
|
|
22
|
+
|
|
23
|
+
GENERATE A SCOPE FOR THE COMMIT MESSAGE IF NECESSARY.
|
|
24
|
+
FIGURE OUT THE BEST TOP LEVEL SEMANTIC MATCH TO USE AS THE SCOPE.
|
|
25
|
+
`,
|
|
26
|
+
model: getBaseModelConfig(),
|
|
27
|
+
});
|
|
28
|
+
export const daneIssueLabeler = new Agent({
|
|
29
|
+
name: 'DaneIssueLabeler',
|
|
30
|
+
instructions: `
|
|
31
|
+
You are Dane, the ultimate GitHub operator.
|
|
32
|
+
You help engineers label their issues.
|
|
33
|
+
`,
|
|
34
|
+
model: getBaseModelConfig(),
|
|
35
|
+
});
|
|
36
|
+
export const danePackagePublisher = new Agent({
|
|
37
|
+
name: 'DanePackagePublisher',
|
|
38
|
+
instructions: `
|
|
39
|
+
You are Dane, the ultimate node module publisher.
|
|
40
|
+
You help engineers publish their pnpm changesets.
|
|
41
|
+
`,
|
|
42
|
+
model: getBaseModelConfig(),
|
|
43
|
+
tools: {
|
|
44
|
+
execaTool,
|
|
45
|
+
pnpmBuild,
|
|
46
|
+
pnpmChangesetPublish,
|
|
47
|
+
pnpmChangesetStatus,
|
|
48
|
+
activeDistTag,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
export const dane = new Agent({
|
|
52
|
+
name: 'Dane',
|
|
53
|
+
instructions: `
|
|
54
|
+
You are Dane, my assistant and one of my best friends. We are an ace team!
|
|
55
|
+
You help me with my code, write tests, and even deploy my code to the cloud!
|
|
56
|
+
|
|
57
|
+
DO NOT ATTEMPT TO USE GENERAL KNOWLEDGE! We are only as good as the tools we use.
|
|
58
|
+
|
|
59
|
+
# Our tools:
|
|
60
|
+
|
|
61
|
+
## readPDF
|
|
62
|
+
Makes you a powerful agent capable of reading PDF files.
|
|
63
|
+
|
|
64
|
+
## fsTool
|
|
65
|
+
Makes you a powerful agent capable of reading and writing files to the local filesystem.
|
|
66
|
+
|
|
67
|
+
## execaTool
|
|
68
|
+
Makes you a powerful agent capabale of executing files on the local system.
|
|
69
|
+
|
|
70
|
+
## googleSearch
|
|
71
|
+
Makes you a powerful agent capabale answering all questions by finding the answer on Google search.
|
|
72
|
+
Pass the query as a JS object. If you have links, ALWAYS CITE YOUR SOURCES.
|
|
73
|
+
|
|
74
|
+
## browserTool
|
|
75
|
+
Makes you a powerful agent capable of scraping the web. Pass the url as a JS object.
|
|
76
|
+
|
|
77
|
+
## listEvents
|
|
78
|
+
Makes you a powerful agent capable of listing events on a calendar. When using this tool ONLY RETURN RELEVANT EVENTS.
|
|
79
|
+
DO NOT ATTEMPT TO DO ANYTHING MORE.
|
|
80
|
+
|
|
81
|
+
## crawl
|
|
82
|
+
Use this when the user asks you to crawl. CRAWL is the signal to use this tool.
|
|
83
|
+
Makes you a powerful agent capable of crawling a site and extracting markdown metadata.
|
|
84
|
+
The data will be stored in a database if it is not already there. Confirm that it is sucessful.
|
|
85
|
+
The crawled data will be returned in the response on the 'crawlData' field.
|
|
86
|
+
|
|
87
|
+
## imageTool
|
|
88
|
+
Makes you a powerful agent capable of generating images and saving them to disk. Pass the directory and an image prompt.
|
|
89
|
+
|
|
90
|
+
# Rules
|
|
91
|
+
* DO NOT ATTEMPT TO USE GENERAL KNOWLEDGE. Use the 'googleSearch' tool to find the answer.
|
|
92
|
+
* Don't reference tools when you communicate with the user. Do not mention what tools you are using.
|
|
93
|
+
* Tell the user what you are doing.
|
|
94
|
+
`,
|
|
95
|
+
model: getBaseModelConfig(),
|
|
96
|
+
tools: {
|
|
97
|
+
fsTool,
|
|
98
|
+
execaTool,
|
|
99
|
+
browserTool,
|
|
100
|
+
googleSearch,
|
|
101
|
+
readPDF,
|
|
102
|
+
listEvents,
|
|
103
|
+
crawl,
|
|
104
|
+
imageTool,
|
|
105
|
+
},
|
|
106
|
+
});
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core';
|
|
2
|
+
export declare const mastra: Mastra<{
|
|
3
|
+
[x: string]: import("@mastra/core").SyncAction<any, any, any, any>;
|
|
4
|
+
}, {
|
|
5
|
+
dane: import("@mastra/core").Agent<{
|
|
6
|
+
fsTool: import("@mastra/core").Tool<"fsTool", import("zod").ZodObject<{
|
|
7
|
+
action: import("zod").ZodString;
|
|
8
|
+
file: import("zod").ZodString;
|
|
9
|
+
data: import("zod").ZodString;
|
|
10
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
11
|
+
data: string;
|
|
12
|
+
action: string;
|
|
13
|
+
file: string;
|
|
14
|
+
}, {
|
|
15
|
+
data: string;
|
|
16
|
+
action: string;
|
|
17
|
+
file: string;
|
|
18
|
+
}>, import("zod").ZodObject<{
|
|
19
|
+
message: import("zod").ZodString;
|
|
20
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
21
|
+
message: string;
|
|
22
|
+
}, {
|
|
23
|
+
message: string;
|
|
24
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
25
|
+
action: import("zod").ZodString;
|
|
26
|
+
file: import("zod").ZodString;
|
|
27
|
+
data: import("zod").ZodString;
|
|
28
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
29
|
+
data: string;
|
|
30
|
+
action: string;
|
|
31
|
+
file: string;
|
|
32
|
+
}, {
|
|
33
|
+
data: string;
|
|
34
|
+
action: string;
|
|
35
|
+
file: string;
|
|
36
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
37
|
+
execaTool: import("@mastra/core").Tool<"execaTool", import("zod").ZodObject<{
|
|
38
|
+
command: import("zod").ZodString;
|
|
39
|
+
args: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
40
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
41
|
+
command: string;
|
|
42
|
+
args: string[];
|
|
43
|
+
}, {
|
|
44
|
+
command: string;
|
|
45
|
+
args: string[];
|
|
46
|
+
}>, import("zod").ZodObject<{
|
|
47
|
+
message: import("zod").ZodString;
|
|
48
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
49
|
+
message: string;
|
|
50
|
+
}, {
|
|
51
|
+
message: string;
|
|
52
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
53
|
+
command: import("zod").ZodString;
|
|
54
|
+
args: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
55
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
56
|
+
command: string;
|
|
57
|
+
args: string[];
|
|
58
|
+
}, {
|
|
59
|
+
command: string;
|
|
60
|
+
args: string[];
|
|
61
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
62
|
+
browserTool: import("@mastra/core").Tool<"browserTool", import("zod").ZodObject<{
|
|
63
|
+
url: import("zod").ZodString;
|
|
64
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
65
|
+
url: string;
|
|
66
|
+
}, {
|
|
67
|
+
url: string;
|
|
68
|
+
}>, import("zod").ZodObject<{
|
|
69
|
+
message: import("zod").ZodString;
|
|
70
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
71
|
+
message: string;
|
|
72
|
+
}, {
|
|
73
|
+
message: string;
|
|
74
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
75
|
+
url: import("zod").ZodString;
|
|
76
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
77
|
+
url: string;
|
|
78
|
+
}, {
|
|
79
|
+
url: string;
|
|
80
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
81
|
+
googleSearch: import("@mastra/core").Tool<"googleSearch", import("zod").ZodObject<{
|
|
82
|
+
query: import("zod").ZodString;
|
|
83
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
84
|
+
query: string;
|
|
85
|
+
}, {
|
|
86
|
+
query: string;
|
|
87
|
+
}>, import("zod").ZodObject<{
|
|
88
|
+
message: import("zod").ZodString;
|
|
89
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
90
|
+
message: string;
|
|
91
|
+
}, {
|
|
92
|
+
message: string;
|
|
93
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
94
|
+
query: import("zod").ZodString;
|
|
95
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
96
|
+
query: string;
|
|
97
|
+
}, {
|
|
98
|
+
query: string;
|
|
99
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
100
|
+
readPDF: import("@mastra/core").Tool<"readPDF", import("zod").ZodObject<{
|
|
101
|
+
pdfPath: import("zod").ZodString;
|
|
102
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
103
|
+
pdfPath: string;
|
|
104
|
+
}, {
|
|
105
|
+
pdfPath: string;
|
|
106
|
+
}>, import("zod").ZodObject<{
|
|
107
|
+
content: import("zod").ZodString;
|
|
108
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
109
|
+
content: string;
|
|
110
|
+
}, {
|
|
111
|
+
content: string;
|
|
112
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
113
|
+
pdfPath: import("zod").ZodString;
|
|
114
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
115
|
+
pdfPath: string;
|
|
116
|
+
}, {
|
|
117
|
+
pdfPath: string;
|
|
118
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
119
|
+
listEvents: import("@mastra/core").Tool<"listEvents", import("zod").ZodObject<{
|
|
120
|
+
startDate: import("zod").ZodString;
|
|
121
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
122
|
+
startDate: string;
|
|
123
|
+
}, {
|
|
124
|
+
startDate: string;
|
|
125
|
+
}>, import("zod").ZodObject<{
|
|
126
|
+
content: import("zod").ZodString;
|
|
127
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
128
|
+
content: string;
|
|
129
|
+
}, {
|
|
130
|
+
content: string;
|
|
131
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
132
|
+
startDate: import("zod").ZodString;
|
|
133
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
134
|
+
startDate: string;
|
|
135
|
+
}, {
|
|
136
|
+
startDate: string;
|
|
137
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
138
|
+
crawl: import("@mastra/core").Tool<"crawler", import("zod").ZodObject<{
|
|
139
|
+
url: import("zod").ZodString;
|
|
140
|
+
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
141
|
+
pathRegex: import("zod").ZodNullable<import("zod").ZodString>;
|
|
142
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
143
|
+
url: string;
|
|
144
|
+
limit: number;
|
|
145
|
+
pathRegex: string | null;
|
|
146
|
+
}, {
|
|
147
|
+
url: string;
|
|
148
|
+
pathRegex: string | null;
|
|
149
|
+
limit?: number | undefined;
|
|
150
|
+
}>, import("zod").ZodObject<{
|
|
151
|
+
message: import("zod").ZodString;
|
|
152
|
+
crawlData: import("zod").ZodAny;
|
|
153
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
154
|
+
message: string;
|
|
155
|
+
crawlData?: any;
|
|
156
|
+
}, {
|
|
157
|
+
message: string;
|
|
158
|
+
crawlData?: any;
|
|
159
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
160
|
+
url: import("zod").ZodString;
|
|
161
|
+
limit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
162
|
+
pathRegex: import("zod").ZodNullable<import("zod").ZodString>;
|
|
163
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
164
|
+
url: string;
|
|
165
|
+
limit: number;
|
|
166
|
+
pathRegex: string | null;
|
|
167
|
+
}, {
|
|
168
|
+
url: string;
|
|
169
|
+
pathRegex: string | null;
|
|
170
|
+
limit?: number | undefined;
|
|
171
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
172
|
+
imageTool: import("@mastra/core").Tool<"imageTool", import("zod").ZodObject<{
|
|
173
|
+
directory: import("zod").ZodString;
|
|
174
|
+
prompt: import("zod").ZodString;
|
|
175
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
176
|
+
directory: string;
|
|
177
|
+
prompt: string;
|
|
178
|
+
}, {
|
|
179
|
+
directory: string;
|
|
180
|
+
prompt: string;
|
|
181
|
+
}>, import("zod").ZodObject<{
|
|
182
|
+
message: import("zod").ZodString;
|
|
183
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
184
|
+
message: string;
|
|
185
|
+
}, {
|
|
186
|
+
message: string;
|
|
187
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
188
|
+
directory: import("zod").ZodString;
|
|
189
|
+
prompt: import("zod").ZodString;
|
|
190
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
191
|
+
directory: string;
|
|
192
|
+
prompt: string;
|
|
193
|
+
}, {
|
|
194
|
+
directory: string;
|
|
195
|
+
prompt: string;
|
|
196
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
197
|
+
}>;
|
|
198
|
+
danePackagePublisher: import("@mastra/core").Agent<{
|
|
199
|
+
execaTool: import("@mastra/core").Tool<"execaTool", import("zod").ZodObject<{
|
|
200
|
+
command: import("zod").ZodString;
|
|
201
|
+
args: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
202
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
203
|
+
command: string;
|
|
204
|
+
args: string[];
|
|
205
|
+
}, {
|
|
206
|
+
command: string;
|
|
207
|
+
args: string[];
|
|
208
|
+
}>, import("zod").ZodObject<{
|
|
209
|
+
message: import("zod").ZodString;
|
|
210
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
211
|
+
message: string;
|
|
212
|
+
}, {
|
|
213
|
+
message: string;
|
|
214
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
215
|
+
command: import("zod").ZodString;
|
|
216
|
+
args: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
217
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
218
|
+
command: string;
|
|
219
|
+
args: string[];
|
|
220
|
+
}, {
|
|
221
|
+
command: string;
|
|
222
|
+
args: string[];
|
|
223
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
224
|
+
pnpmBuild: import("@mastra/core").Tool<"pnpmBuild", import("zod").ZodObject<{
|
|
225
|
+
name: import("zod").ZodString;
|
|
226
|
+
packagePath: import("zod").ZodString;
|
|
227
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
228
|
+
name: string;
|
|
229
|
+
packagePath: string;
|
|
230
|
+
}, {
|
|
231
|
+
name: string;
|
|
232
|
+
packagePath: string;
|
|
233
|
+
}>, import("zod").ZodObject<{
|
|
234
|
+
message: import("zod").ZodString;
|
|
235
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
236
|
+
message: string;
|
|
237
|
+
}, {
|
|
238
|
+
message: string;
|
|
239
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
240
|
+
name: import("zod").ZodString;
|
|
241
|
+
packagePath: import("zod").ZodString;
|
|
242
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
243
|
+
name: string;
|
|
244
|
+
packagePath: string;
|
|
245
|
+
}, {
|
|
246
|
+
name: string;
|
|
247
|
+
packagePath: string;
|
|
248
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
249
|
+
pnpmChangesetPublish: import("@mastra/core").Tool<"pnpmChangesetPublish", import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{
|
|
250
|
+
message: import("zod").ZodString;
|
|
251
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
252
|
+
message: string;
|
|
253
|
+
}, {
|
|
254
|
+
message: string;
|
|
255
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
256
|
+
pnpmChangesetStatus: import("@mastra/core").Tool<"pnpmChangesetStatus", import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("zod").ZodObject<{
|
|
257
|
+
message: import("zod").ZodArray<import("zod").ZodString, "many">;
|
|
258
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
259
|
+
message: string[];
|
|
260
|
+
}, {
|
|
261
|
+
message: string[];
|
|
262
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{}, "strip", import("zod").ZodTypeAny, {}, {}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
263
|
+
activeDistTag: import("@mastra/core").Tool<"activeDistTag", import("zod").ZodObject<{
|
|
264
|
+
packagePath: import("zod").ZodString;
|
|
265
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
266
|
+
packagePath: string;
|
|
267
|
+
}, {
|
|
268
|
+
packagePath: string;
|
|
269
|
+
}>, import("zod").ZodObject<{
|
|
270
|
+
message: import("zod").ZodString;
|
|
271
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
272
|
+
message: string;
|
|
273
|
+
}, {
|
|
274
|
+
message: string;
|
|
275
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
276
|
+
packagePath: import("zod").ZodString;
|
|
277
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
278
|
+
packagePath: string;
|
|
279
|
+
}, {
|
|
280
|
+
packagePath: string;
|
|
281
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
282
|
+
}>;
|
|
283
|
+
daneIssueLabeler: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
284
|
+
daneCommitMessage: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
285
|
+
}, {
|
|
286
|
+
message: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
287
|
+
resourceid: import("zod").ZodString;
|
|
288
|
+
threadId: import("zod").ZodString;
|
|
289
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
290
|
+
resourceid: string;
|
|
291
|
+
threadId: string;
|
|
292
|
+
}, {
|
|
293
|
+
resourceid: string;
|
|
294
|
+
threadId: string;
|
|
295
|
+
}>>;
|
|
296
|
+
githubIssueLabeler: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
297
|
+
repo: import("zod").ZodString;
|
|
298
|
+
owner: import("zod").ZodString;
|
|
299
|
+
issue_number: import("zod").ZodNumber;
|
|
300
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
301
|
+
repo: string;
|
|
302
|
+
owner: string;
|
|
303
|
+
issue_number: number;
|
|
304
|
+
}, {
|
|
305
|
+
repo: string;
|
|
306
|
+
owner: string;
|
|
307
|
+
issue_number: number;
|
|
308
|
+
}>>;
|
|
309
|
+
commitMessage: import("@mastra/core").Workflow<any, import("zod").ZodObject<{
|
|
310
|
+
repoPath: import("zod").ZodString;
|
|
311
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
312
|
+
repoPath: string;
|
|
313
|
+
}, {
|
|
314
|
+
repoPath: string;
|
|
315
|
+
}>>;
|
|
316
|
+
packagePublisher: import("@mastra/core").Workflow<any, any>;
|
|
317
|
+
}, import("@mastra/core").BaseLogger<import("@mastra/core").BaseLogMessage>>;
|
|
318
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mastra/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAatC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAuBjB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Mastra } from '@mastra/core';
|
|
2
|
+
import { PostgresEngine } from '@mastra/engine';
|
|
3
|
+
import { UpstashKVMemory } from '@mastra/memory';
|
|
4
|
+
import { dane, daneCommitMessage, daneIssueLabeler, danePackagePublisher } from './agents/index.js';
|
|
5
|
+
import { firecrawl } from './integrations/index.js';
|
|
6
|
+
import { messageWorkflow, githubIssueLabeler, commitMessageGenerator } from './workflows/index.js';
|
|
7
|
+
import { packagePublisher } from './workflows/publish-packages.js';
|
|
8
|
+
const engine = new PostgresEngine({
|
|
9
|
+
url: 'postgres://postgres:postgres@localhost:5433/mastra',
|
|
10
|
+
});
|
|
11
|
+
export const mastra = new Mastra({
|
|
12
|
+
agents: {
|
|
13
|
+
dane,
|
|
14
|
+
danePackagePublisher,
|
|
15
|
+
daneIssueLabeler,
|
|
16
|
+
daneCommitMessage,
|
|
17
|
+
},
|
|
18
|
+
engine,
|
|
19
|
+
memory: new UpstashKVMemory({
|
|
20
|
+
url: 'http://localhost:8079',
|
|
21
|
+
token: `example_token`,
|
|
22
|
+
maxTokens: 39000,
|
|
23
|
+
}),
|
|
24
|
+
workflows: {
|
|
25
|
+
message: messageWorkflow,
|
|
26
|
+
githubIssueLabeler: githubIssueLabeler,
|
|
27
|
+
commitMessage: commitMessageGenerator,
|
|
28
|
+
packagePublisher: packagePublisher,
|
|
29
|
+
},
|
|
30
|
+
logger: false,
|
|
31
|
+
syncs: {
|
|
32
|
+
...firecrawl.getSyncs(),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FirecrawlIntegration } from "@mastra/firecrawl";
|
|
2
|
+
import { GithubIntegration } from "@mastra/github";
|
|
3
|
+
import { StabilityAiIntegration } from "@mastra/stabilityai";
|
|
4
|
+
export declare const firecrawl: FirecrawlIntegration;
|
|
5
|
+
export declare const github: GithubIntegration;
|
|
6
|
+
export declare const stabilityai: StabilityAiIntegration;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mastra/integrations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAc7D,eAAO,MAAM,SAAS,sBAIpB,CAAC;AAEH,eAAO,MAAM,MAAM,mBAIjB,CAAC;AAEH,eAAO,MAAM,WAAW,wBAItB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FirecrawlIntegration } from "@mastra/firecrawl";
|
|
2
|
+
import { GithubIntegration } from "@mastra/github";
|
|
3
|
+
import { StabilityAiIntegration } from "@mastra/stabilityai";
|
|
4
|
+
import { config } from "../../config/index.js";
|
|
5
|
+
// Helper function to get key from config or env
|
|
6
|
+
const getApiKey = (configKey, envKey) => {
|
|
7
|
+
const configValue = config.get(configKey);
|
|
8
|
+
if (configValue)
|
|
9
|
+
return configValue;
|
|
10
|
+
const envValue = process.env[envKey];
|
|
11
|
+
if (envValue)
|
|
12
|
+
return envValue;
|
|
13
|
+
return '';
|
|
14
|
+
};
|
|
15
|
+
export const firecrawl = new FirecrawlIntegration({
|
|
16
|
+
config: {
|
|
17
|
+
API_KEY: getApiKey('FIRECRAWL_API_KEY', 'FIRECRAWL_API_KEY'),
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
export const github = new GithubIntegration({
|
|
21
|
+
config: {
|
|
22
|
+
PERSONAL_ACCESS_TOKEN: getApiKey('GITHUB_PERSONAL_ACCESS_TOKEN', 'GITHUB_PERSONAL_ACCESS_TOKEN'),
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
export const stabilityai = new StabilityAiIntegration({
|
|
26
|
+
config: {
|
|
27
|
+
API_KEY: getApiKey('STABILITYAI_API_KEY', 'STABILITYAI_API_KEY'),
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const browserTool: import("@mastra/core").Tool<"browserTool", z.ZodObject<{
|
|
3
|
+
url: z.ZodString;
|
|
4
|
+
}, "strip", z.ZodTypeAny, {
|
|
5
|
+
url: string;
|
|
6
|
+
}, {
|
|
7
|
+
url: string;
|
|
8
|
+
}>, z.ZodObject<{
|
|
9
|
+
message: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
message: string;
|
|
12
|
+
}, {
|
|
13
|
+
message: string;
|
|
14
|
+
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
15
|
+
url: z.ZodString;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
url: string;
|
|
18
|
+
}, {
|
|
19
|
+
url: string;
|
|
20
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
21
|
+
export declare const googleSearch: import("@mastra/core").Tool<"googleSearch", z.ZodObject<{
|
|
22
|
+
query: z.ZodString;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
query: string;
|
|
25
|
+
}, {
|
|
26
|
+
query: string;
|
|
27
|
+
}>, z.ZodObject<{
|
|
28
|
+
message: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
message: string;
|
|
31
|
+
}, {
|
|
32
|
+
message: string;
|
|
33
|
+
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
34
|
+
query: z.ZodString;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
query: string;
|
|
37
|
+
}, {
|
|
38
|
+
query: string;
|
|
39
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
40
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/browser.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;iDAoDtB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;iDAqEvB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createTool } from '@mastra/core';
|
|
2
|
+
import { MDocument } from '@mastra/rag';
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { chromium } from 'playwright-core';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
export const browserTool = createTool({
|
|
7
|
+
id: 'browserTool',
|
|
8
|
+
name: 'Browser Tool',
|
|
9
|
+
description: 'Browser Tool, opens a browser and navigates to a url capturing the content',
|
|
10
|
+
inputSchema: z.object({
|
|
11
|
+
url: z.string(),
|
|
12
|
+
}),
|
|
13
|
+
outputSchema: z.object({
|
|
14
|
+
message: z.string(),
|
|
15
|
+
}),
|
|
16
|
+
execute: async ({ context: { url } }) => {
|
|
17
|
+
try {
|
|
18
|
+
const browser = await chromium.launch({
|
|
19
|
+
headless: true,
|
|
20
|
+
});
|
|
21
|
+
const page = await browser.newPage();
|
|
22
|
+
await page.goto(url);
|
|
23
|
+
const docs = MDocument.fromHTML(await page.content());
|
|
24
|
+
await docs.chunk({
|
|
25
|
+
strategy: 'html',
|
|
26
|
+
size: 300,
|
|
27
|
+
sections: [
|
|
28
|
+
['h1', 'Header 1'],
|
|
29
|
+
['h2', 'Header 2'],
|
|
30
|
+
['h3', 'Header 3'],
|
|
31
|
+
['h4', 'Header 4'],
|
|
32
|
+
['h5', 'Header 5'],
|
|
33
|
+
['h6', 'Header 6'],
|
|
34
|
+
['p', 'Paragraph'],
|
|
35
|
+
],
|
|
36
|
+
});
|
|
37
|
+
await page.close();
|
|
38
|
+
await browser.close();
|
|
39
|
+
if (!docs.getText().length) {
|
|
40
|
+
return { message: 'No content' };
|
|
41
|
+
}
|
|
42
|
+
return { message: docs.getText().join('\n') };
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
if (e instanceof Error) {
|
|
46
|
+
console.log(`\n${chalk.red(e.message)}`);
|
|
47
|
+
return { message: `Error: ${e.message}` };
|
|
48
|
+
}
|
|
49
|
+
return { message: 'Error' };
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
export const googleSearch = createTool({
|
|
54
|
+
id: 'googleSearch',
|
|
55
|
+
name: 'Google Search',
|
|
56
|
+
description: 'Google Search. Passes the query to Google and returns the search results.',
|
|
57
|
+
inputSchema: z.object({
|
|
58
|
+
query: z.string(),
|
|
59
|
+
}),
|
|
60
|
+
outputSchema: z.object({
|
|
61
|
+
message: z.string(),
|
|
62
|
+
}),
|
|
63
|
+
execute: async ({ context: { query } }) => {
|
|
64
|
+
let browser;
|
|
65
|
+
try {
|
|
66
|
+
browser = await chromium.launch({
|
|
67
|
+
headless: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
if (e instanceof Error) {
|
|
72
|
+
console.log(`\n${chalk.red(e.message)}`);
|
|
73
|
+
return { message: `Error: ${e.message}` };
|
|
74
|
+
}
|
|
75
|
+
return { message: 'Error' };
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const page = await browser.newPage();
|
|
79
|
+
await page.goto(`https://www.google.com/search?q=${encodeURIComponent(query)}`);
|
|
80
|
+
console.log(`\n`);
|
|
81
|
+
console.log(chalk.blue('Waiting for search results...'));
|
|
82
|
+
try {
|
|
83
|
+
await page.click('button:has-text("Accept all")', { timeout: 5000 });
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
// Cookie dialog didn't appear, continue
|
|
87
|
+
}
|
|
88
|
+
// Wait for results and click first organic result
|
|
89
|
+
await page.waitForSelector('#search');
|
|
90
|
+
const text = await page.evaluate(() => {
|
|
91
|
+
const links = [];
|
|
92
|
+
const searchResults = document.querySelectorAll('div.g a');
|
|
93
|
+
searchResults.forEach(link => {
|
|
94
|
+
const href = link.getAttribute('href');
|
|
95
|
+
if (href && href.startsWith('http')) {
|
|
96
|
+
links.push(href);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
return links;
|
|
100
|
+
});
|
|
101
|
+
await page.close();
|
|
102
|
+
await browser.close();
|
|
103
|
+
if (!text.length) {
|
|
104
|
+
return { message: 'No results' };
|
|
105
|
+
}
|
|
106
|
+
return { message: text.join('\n') };
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
if (e instanceof Error) {
|
|
110
|
+
console.log(`\n${chalk.red(e.message)}`);
|
|
111
|
+
return { message: `Error: ${e.message}` };
|
|
112
|
+
}
|
|
113
|
+
return { message: `Error` };
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
});
|