@mastra/dane 0.0.2-alpha.0 → 0.0.2-alpha.11
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/issue-labeler.d.ts +1 -0
- package/dist/commands/issue-labeler.d.ts.map +1 -0
- package/dist/commands/issue-labeler.js +17 -1
- package/dist/commands/message.d.ts +1 -0
- package/dist/commands/message.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/mastra/agents/index.d.ts +26 -0
- package/dist/mastra/agents/index.d.ts.map +1 -0
- package/dist/mastra/agents/index.js +5 -0
- package/dist/mastra/index.d.ts +27 -1
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/mastra/index.js +5 -2
- package/dist/mastra/integrations/index.d.ts +3 -0
- package/dist/mastra/integrations/index.d.ts.map +1 -0
- package/dist/mastra/integrations/index.js +6 -0
- package/dist/mastra/tools/browser.d.ts +1 -0
- package/dist/mastra/tools/browser.d.ts.map +1 -0
- package/dist/mastra/tools/browser.js +10 -12
- package/dist/mastra/tools/calendar.d.ts +1 -0
- package/dist/mastra/tools/calendar.d.ts.map +1 -0
- package/dist/mastra/tools/crawl.d.ts +1 -0
- package/dist/mastra/tools/crawl.d.ts.map +1 -0
- package/dist/mastra/tools/execa.d.ts +1 -0
- package/dist/mastra/tools/execa.d.ts.map +1 -0
- package/dist/mastra/tools/execa.js +4 -1
- package/dist/mastra/tools/fs.d.ts +1 -0
- package/dist/mastra/tools/fs.d.ts.map +1 -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 +1 -0
- package/dist/mastra/tools/pdf.d.ts.map +1 -0
- package/dist/mastra/tools/pdf.js +3 -2
- package/dist/mastra/workflows/chat.d.ts +1 -0
- package/dist/mastra/workflows/chat.d.ts.map +1 -0
- package/dist/mastra/workflows/index.d.ts +1 -0
- package/dist/mastra/workflows/index.d.ts.map +1 -0
- package/dist/mastra/workflows/issue-labeler.d.ts +1 -0
- package/dist/mastra/workflows/issue-labeler.d.ts.map +1 -0
- package/package.json +14 -7
- package/test-files/716a95a5c57a56d32a32b1c9592d6df0.png +0 -0
- package/CHANGELOG.md +0 -19
- package/docker-compose.yaml +0 -22
- package/src/commands/issue-labeler.ts +0 -26
- package/src/commands/message.ts +0 -16
- package/src/index.ts +0 -12
- package/src/mastra/agents/index.ts +0 -79
- package/src/mastra/index.ts +0 -32
- package/src/mastra/integrations/index.ts +0 -14
- package/src/mastra/tools/browser.ts +0 -132
- package/src/mastra/tools/calendar.ts +0 -154
- package/src/mastra/tools/crawl.ts +0 -26
- package/src/mastra/tools/execa.ts +0 -41
- package/src/mastra/tools/fs.ts +0 -36
- package/src/mastra/tools/pdf.ts +0 -46
- package/src/mastra/workflows/chat.ts +0 -111
- package/src/mastra/workflows/index.ts +0 -2
- package/src/mastra/workflows/issue-labeler.ts +0 -104
- package/tsconfig.json +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-labeler.d.ts","sourceRoot":"","sources":["../../src/commands/issue-labeler.ts"],"names":[],"mappings":"AAIA,wBAAsB,mBAAmB,kBA2BxC"}
|
|
@@ -7,12 +7,28 @@ export async function issueLabelerCommand() {
|
|
|
7
7
|
triggerData: {
|
|
8
8
|
issue_number: parseInt(process.env.ISSUE_NUMBER, 10),
|
|
9
9
|
owner: process.env.OWNER,
|
|
10
|
-
repo: process.env.REPO,
|
|
10
|
+
repo: normalizeRepo(process.env.REPO),
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
|
+
if (result.results?.labelIssue?.status === 'failed') {
|
|
14
|
+
console.error(chalk.red(`Error applying labels for issue: ${result.triggerData?.issue_number}`));
|
|
15
|
+
console.error({ error: result.results?.labelIssue?.error });
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
13
18
|
if (result.results?.labelIssue?.status !== 'success') {
|
|
14
19
|
console.error(chalk.red(`Failed to apply labels for issue: ${result.triggerData?.issue_number}`));
|
|
15
20
|
return;
|
|
16
21
|
}
|
|
17
22
|
console.log(chalk.green(`Issue: ${result.triggerData?.issue_number} has been labeled with: ${result.results?.labelIssue?.payload?.labels.join(', ')}`));
|
|
18
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Extracts the repo name from owner/repo format provided by github
|
|
26
|
+
* @param repo - The repo name to normalize
|
|
27
|
+
* @returns The normalized repo name
|
|
28
|
+
*/
|
|
29
|
+
function normalizeRepo(repo) {
|
|
30
|
+
if (repo.includes('/')) {
|
|
31
|
+
return repo.split('/')[1] || repo;
|
|
32
|
+
}
|
|
33
|
+
return repo;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/commands/message.ts"],"names":[],"mappings":"AAIA,wBAAsB,OAAO,kBAW5B"}
|
package/dist/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -164,4 +164,30 @@ export declare const dane: Agent<{
|
|
|
164
164
|
pathRegex: string | null;
|
|
165
165
|
limit?: number | undefined;
|
|
166
166
|
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
167
|
+
imageTool: import("@mastra/core").Tool<"imageTool", import("zod").ZodObject<{
|
|
168
|
+
directory: import("zod").ZodString;
|
|
169
|
+
prompt: import("zod").ZodString;
|
|
170
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
171
|
+
directory: string;
|
|
172
|
+
prompt: string;
|
|
173
|
+
}, {
|
|
174
|
+
directory: string;
|
|
175
|
+
prompt: string;
|
|
176
|
+
}>, import("zod").ZodObject<{
|
|
177
|
+
message: import("zod").ZodString;
|
|
178
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
179
|
+
message: string;
|
|
180
|
+
}, {
|
|
181
|
+
message: string;
|
|
182
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
183
|
+
directory: import("zod").ZodString;
|
|
184
|
+
prompt: import("zod").ZodString;
|
|
185
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
186
|
+
directory: string;
|
|
187
|
+
prompt: string;
|
|
188
|
+
}, {
|
|
189
|
+
directory: string;
|
|
190
|
+
prompt: string;
|
|
191
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
167
192
|
}>;
|
|
193
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAUrC,eAAO,MAAM,gBAAgB,8EAW3B,CAAC;AAEH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4Df,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { crawl } from '../tools/crawl.js';
|
|
|
5
5
|
import { execaTool } from '../tools/execa.js';
|
|
6
6
|
import { fsTool } from '../tools/fs.js';
|
|
7
7
|
import { readPDF } from '../tools/pdf.js';
|
|
8
|
+
import { imageTool } from '../tools/image.js';
|
|
8
9
|
export const daneIssueLabeler = new Agent({
|
|
9
10
|
name: 'DaneIssueLabeler',
|
|
10
11
|
instructions: `
|
|
@@ -51,6 +52,9 @@ export const dane = new Agent({
|
|
|
51
52
|
Use this when the user asks you to crawl. CRAWL is the signal to use this tool.
|
|
52
53
|
Makes you a powerful agent capable of crawling a site and extracting markdown metadata.
|
|
53
54
|
The data will be stored in a database. Confirm that it is sucessful.
|
|
55
|
+
|
|
56
|
+
## imageTool
|
|
57
|
+
Makes you a powerful agent capable of generating images and saving them to disk. Pass the directory and an image prompt.
|
|
54
58
|
|
|
55
59
|
# Rules
|
|
56
60
|
* DO NOT ATTEMPT TO USE GENERAL KNOWLEDGE. Use the 'googleSearch' tool to find the answer.
|
|
@@ -70,6 +74,7 @@ export const dane = new Agent({
|
|
|
70
74
|
readPDF,
|
|
71
75
|
listEvents,
|
|
72
76
|
crawl,
|
|
77
|
+
imageTool
|
|
73
78
|
// TODO I SHOULD BE ABLE TO PASS A WORKFLOW EXECUTE HERE
|
|
74
79
|
// browserAgentRelay,
|
|
75
80
|
},
|
package/dist/mastra/index.d.ts
CHANGED
|
@@ -166,6 +166,31 @@ export declare const mastra: Mastra<{
|
|
|
166
166
|
pathRegex: string | null;
|
|
167
167
|
limit?: number | undefined;
|
|
168
168
|
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
169
|
+
imageTool: import("@mastra/core").Tool<"imageTool", import("zod").ZodObject<{
|
|
170
|
+
directory: import("zod").ZodString;
|
|
171
|
+
prompt: import("zod").ZodString;
|
|
172
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
173
|
+
directory: string;
|
|
174
|
+
prompt: string;
|
|
175
|
+
}, {
|
|
176
|
+
directory: string;
|
|
177
|
+
prompt: string;
|
|
178
|
+
}>, import("zod").ZodObject<{
|
|
179
|
+
message: import("zod").ZodString;
|
|
180
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
181
|
+
message: string;
|
|
182
|
+
}, {
|
|
183
|
+
message: string;
|
|
184
|
+
}>, import("@mastra/core").ToolExecutionContext<import("zod").ZodObject<{
|
|
185
|
+
directory: import("zod").ZodString;
|
|
186
|
+
prompt: import("zod").ZodString;
|
|
187
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
188
|
+
directory: string;
|
|
189
|
+
prompt: string;
|
|
190
|
+
}, {
|
|
191
|
+
directory: string;
|
|
192
|
+
prompt: string;
|
|
193
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
169
194
|
}>;
|
|
170
195
|
daneIssueLabeler: import("@mastra/core").Agent<Record<string, import("@mastra/core").ToolAction<any, any, any, any>>>;
|
|
171
196
|
}, {
|
|
@@ -192,4 +217,5 @@ export declare const mastra: Mastra<{
|
|
|
192
217
|
owner: string;
|
|
193
218
|
issue_number: number;
|
|
194
219
|
}>>;
|
|
195
|
-
}, import("@mastra/core").
|
|
220
|
+
}, import("@mastra/core").ConsoleLogger<import("@mastra/core").BaseLogMessage>>;
|
|
221
|
+
//# 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,EAAgB,MAAM,EAAE,MAAM,cAAc,CAAC;AAYpD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+EAsBjB,CAAC"}
|
package/dist/mastra/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mastra } from '@mastra/core';
|
|
1
|
+
import { createLogger, Mastra } from '@mastra/core';
|
|
2
2
|
import { PostgresEngine } from '@mastra/engine';
|
|
3
3
|
import { UpstashKVMemory } from '@mastra/memory';
|
|
4
4
|
import { dane, daneIssueLabeler } from './agents/index.js';
|
|
@@ -22,7 +22,10 @@ export const mastra = new Mastra({
|
|
|
22
22
|
message: messageWorkflow,
|
|
23
23
|
githubIssueLabeler: githubIssueLabeler,
|
|
24
24
|
},
|
|
25
|
-
logger:
|
|
25
|
+
logger: createLogger({
|
|
26
|
+
level: 'DEBUG',
|
|
27
|
+
type: 'CONSOLE'
|
|
28
|
+
}),
|
|
26
29
|
syncs: {
|
|
27
30
|
...firecrawl.getSyncs(),
|
|
28
31
|
},
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { FirecrawlIntegration } from "@mastra/firecrawl";
|
|
2
2
|
import { GithubIntegration } from "@mastra/github";
|
|
3
|
+
import { StabilityAiIntegration } from "@mastra/stabilityai";
|
|
3
4
|
export declare const firecrawl: FirecrawlIntegration;
|
|
4
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,CAAA;AAE5D,eAAO,MAAM,SAAS,sBAIpB,CAAC;AAEH,eAAO,MAAM,MAAM,mBAIjB,CAAA;AAEF,eAAO,MAAM,WAAW,wBAItB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FirecrawlIntegration } from "@mastra/firecrawl";
|
|
2
2
|
import { GithubIntegration } from "@mastra/github";
|
|
3
|
+
import { StabilityAiIntegration } from "@mastra/stabilityai";
|
|
3
4
|
export const firecrawl = new FirecrawlIntegration({
|
|
4
5
|
config: {
|
|
5
6
|
API_KEY: process.env.FIRECRAWL_API_KEY,
|
|
@@ -10,3 +11,8 @@ export const github = new GithubIntegration({
|
|
|
10
11
|
PERSONAL_ACCESS_TOKEN: process.env.GITHUB_PERSONAL_ACCESS_TOKEN,
|
|
11
12
|
}
|
|
12
13
|
});
|
|
14
|
+
export const stabilityai = new StabilityAiIntegration({
|
|
15
|
+
config: {
|
|
16
|
+
API_KEY: process.env.STABILITYAI_API_KEY,
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -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"}
|
|
@@ -23,18 +23,16 @@ export const browserTool = createTool({
|
|
|
23
23
|
const docs = MDocument.fromHTML(await page.content());
|
|
24
24
|
await docs.chunk({
|
|
25
25
|
strategy: 'html',
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
],
|
|
37
|
-
},
|
|
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
|
+
],
|
|
38
36
|
});
|
|
39
37
|
await page.close();
|
|
40
38
|
await browser.close();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/calendar.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqGxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;iDAgDrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/crawl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAsBhB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execa.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/execa.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;iDA2BpB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createTool } from '@mastra/core';
|
|
2
2
|
import chalk from 'chalk';
|
|
3
|
-
import { execa } from 'execa';
|
|
3
|
+
import { execa, ExecaError } from 'execa';
|
|
4
4
|
import { Transform } from 'stream';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
// Create transform stream that applies chalk
|
|
@@ -33,6 +33,9 @@ export const execaTool = createTool({
|
|
|
33
33
|
return { message: r.stdout };
|
|
34
34
|
}
|
|
35
35
|
catch (e) {
|
|
36
|
+
if (e instanceof ExecaError) {
|
|
37
|
+
return { message: e.message };
|
|
38
|
+
}
|
|
36
39
|
return { message: 'Error' };
|
|
37
40
|
}
|
|
38
41
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/fs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDA+BjB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const imageTool: import("@mastra/core").Tool<"imageTool", z.ZodObject<{
|
|
3
|
+
directory: z.ZodString;
|
|
4
|
+
prompt: z.ZodString;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
directory: string;
|
|
7
|
+
prompt: string;
|
|
8
|
+
}, {
|
|
9
|
+
directory: string;
|
|
10
|
+
prompt: string;
|
|
11
|
+
}>, z.ZodObject<{
|
|
12
|
+
message: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
message: string;
|
|
15
|
+
}, {
|
|
16
|
+
message: string;
|
|
17
|
+
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
18
|
+
directory: z.ZodString;
|
|
19
|
+
prompt: z.ZodString;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
directory: string;
|
|
22
|
+
prompt: string;
|
|
23
|
+
}, {
|
|
24
|
+
directory: string;
|
|
25
|
+
prompt: string;
|
|
26
|
+
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
27
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/image.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;iDAgCpB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createTool } from '@mastra/core';
|
|
3
|
+
import { stabilityai } from "../integrations";
|
|
4
|
+
import { writeFileSync } from "fs";
|
|
5
|
+
import { resolve } from "path";
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
export const imageTool = createTool({
|
|
8
|
+
id: 'imageTool',
|
|
9
|
+
name: 'imageTool',
|
|
10
|
+
description: 'Generate an image based on a text prompt',
|
|
11
|
+
inputSchema: z.object({
|
|
12
|
+
directory: z.string(),
|
|
13
|
+
prompt: z.string(),
|
|
14
|
+
}),
|
|
15
|
+
outputSchema: z.object({
|
|
16
|
+
message: z.string(),
|
|
17
|
+
}),
|
|
18
|
+
execute: async ({ context: { directory, prompt } }) => {
|
|
19
|
+
try {
|
|
20
|
+
console.log('\n' + chalk.blue(`Generating image...`));
|
|
21
|
+
const generateImageResult = await stabilityai.generateImage(prompt);
|
|
22
|
+
const file = resolve(directory, generateImageResult.filename);
|
|
23
|
+
writeFileSync(file, generateImageResult.buffer);
|
|
24
|
+
console.log(chalk.blue(`Successfully generated: ${file}`));
|
|
25
|
+
return {
|
|
26
|
+
message: `Successfully created ${file}`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
if (e instanceof Error) {
|
|
31
|
+
console.log(`\n${chalk.red(e.message)}`);
|
|
32
|
+
return { message: e.message };
|
|
33
|
+
}
|
|
34
|
+
return { message: 'Error' };
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/pdf.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;iDAsClB,CAAC"}
|
package/dist/mastra/tools/pdf.js
CHANGED
|
@@ -2,7 +2,8 @@ import { createTool } from '@mastra/core';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { existsSync, readFileSync } from 'fs';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
|
|
5
|
+
// @ts-ignore
|
|
6
|
+
import pdfParse from "pdf-parse/lib/pdf-parse.js";
|
|
6
7
|
import { z } from 'zod';
|
|
7
8
|
export const readPDF = createTool({
|
|
8
9
|
id: 'readPDF',
|
|
@@ -27,7 +28,7 @@ export const readPDF = createTool({
|
|
|
27
28
|
// Read the PDF file
|
|
28
29
|
const dataBuffer = readFileSync(pdfPath);
|
|
29
30
|
// Parse PDF content
|
|
30
|
-
const data = await
|
|
31
|
+
const data = await pdfParse(dataBuffer);
|
|
31
32
|
console.log(chalk.blue('\n'));
|
|
32
33
|
console.log(chalk.blue('PDF Information:'));
|
|
33
34
|
console.log(chalk.blue('-----------------'));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;;;GAM1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue-labeler.d.ts","sourceRoot":"","sources":["../../../src/mastra/workflows/issue-labeler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;GAO7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/dane",
|
|
3
|
-
"version": "0.0.2-alpha.
|
|
3
|
+
"version": "0.0.2-alpha.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"test",
|
|
9
|
+
"test-files"
|
|
10
|
+
],
|
|
6
11
|
"bin": {
|
|
7
12
|
"dane": "./dist/index.js"
|
|
8
13
|
},
|
|
@@ -20,6 +25,7 @@
|
|
|
20
25
|
"chalk": "^5.3.0",
|
|
21
26
|
"cli-table3": "^0.6.5",
|
|
22
27
|
"commander": "^12.1.0",
|
|
28
|
+
"dotenv": "^16.4.7",
|
|
23
29
|
"execa": "^9.3.1",
|
|
24
30
|
"inquirer": "^12.2.0",
|
|
25
31
|
"luxon": "^3.5.0",
|
|
@@ -31,12 +37,13 @@
|
|
|
31
37
|
"sqlite3": "^5.1.7",
|
|
32
38
|
"typescript": "^5.5.4",
|
|
33
39
|
"zod": "^3.24.0",
|
|
34
|
-
"@mastra/
|
|
35
|
-
"@mastra/
|
|
36
|
-
"@mastra/
|
|
37
|
-
"@mastra/
|
|
38
|
-
"@mastra/
|
|
39
|
-
"@mastra/
|
|
40
|
+
"@mastra/core": "0.1.27-alpha.43",
|
|
41
|
+
"@mastra/engine": "0.0.5-alpha.37",
|
|
42
|
+
"@mastra/firecrawl": "1.0.4-alpha.28",
|
|
43
|
+
"@mastra/github": "1.0.3-alpha.27",
|
|
44
|
+
"@mastra/stabilityai": "1.0.1-alpha.18",
|
|
45
|
+
"@mastra/memory": "0.0.2-alpha.22",
|
|
46
|
+
"@mastra/rag": "0.0.2-alpha.27"
|
|
40
47
|
},
|
|
41
48
|
"scripts": {
|
|
42
49
|
"build": "npx tsc",
|
|
Binary file
|
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
|
package/docker-compose.yaml
DELETED
|
@@ -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.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
import { mastra } from '../mastra/index.js';
|
|
4
|
-
|
|
5
|
-
export async function issueLabelerCommand() {
|
|
6
|
-
console.log(chalk.green("Hi! I'm Dane!"));
|
|
7
|
-
console.log(chalk.green('Let me label this for you..\n'));
|
|
8
|
-
const result = await mastra.getWorkflow('githubIssueLabeler').execute({
|
|
9
|
-
triggerData: {
|
|
10
|
-
issue_number: parseInt(process.env.ISSUE_NUMBER!, 10),
|
|
11
|
-
owner: process.env.OWNER!,
|
|
12
|
-
repo: process.env.REPO!,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
if (result.results?.labelIssue?.status !== 'success') {
|
|
17
|
-
console.error(chalk.red(`Failed to apply labels for issue: ${result.triggerData?.issue_number}`));
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
console.log(
|
|
22
|
-
chalk.green(
|
|
23
|
-
`Issue: ${result.triggerData?.issue_number} has been labeled with: ${result.results?.labelIssue?.payload?.labels.join(', ')}`,
|
|
24
|
-
),
|
|
25
|
-
);
|
|
26
|
-
}
|
package/src/commands/message.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
import { mastra } from '../mastra/index.js';
|
|
4
|
-
|
|
5
|
-
export async function message() {
|
|
6
|
-
console.log(chalk.green("Hi! I'm Dane!"));
|
|
7
|
-
console.log(chalk.green('What would you like to do today?\n'));
|
|
8
|
-
console.log(
|
|
9
|
-
await mastra.getWorkflow('message').execute({
|
|
10
|
-
triggerData: {
|
|
11
|
-
resourceid: 'f8b5c3a1-d6e7-4f9c-b2a3-1d8e4c7f9b5a',
|
|
12
|
-
threadId: '2d9e8c7f-6b5a-4d3c-8f1e-9b7d5c3a2e8h',
|
|
13
|
-
},
|
|
14
|
-
}),
|
|
15
|
-
);
|
|
16
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
|
|
3
|
-
import { issueLabelerCommand } from './commands/issue-labeler.js';
|
|
4
|
-
import { message } from './commands/message.js';
|
|
5
|
-
|
|
6
|
-
const program = new Command();
|
|
7
|
-
|
|
8
|
-
program.command('chat').action(message);
|
|
9
|
-
|
|
10
|
-
program.command('issue-labeler').action(issueLabelerCommand);
|
|
11
|
-
|
|
12
|
-
program.parse(process.argv);
|