@mastra/dane 0.0.2-alpha.99 → 0.0.3
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/package.json +12 -10
- package/dist/commands/changelog.d.ts +0 -2
- package/dist/commands/changelog.d.ts.map +0 -1
- package/dist/commands/changelog.js +0 -15
- package/dist/commands/commit-message.d.ts +0 -2
- package/dist/commands/commit-message.d.ts.map +0 -1
- package/dist/commands/commit-message.js +0 -32
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -40
- package/dist/commands/issue-labeler.d.ts +0 -2
- package/dist/commands/issue-labeler.d.ts.map +0 -1
- package/dist/commands/issue-labeler.js +0 -35
- package/dist/commands/link-checker.d.ts +0 -4
- package/dist/commands/link-checker.d.ts.map +0 -1
- package/dist/commands/link-checker.js +0 -16
- package/dist/commands/message.d.ts +0 -2
- package/dist/commands/message.d.ts.map +0 -1
- package/dist/commands/message.js +0 -14
- package/dist/commands/new-contributor-message.d.ts +0 -2
- package/dist/commands/new-contributor-message.d.ts.map +0 -1
- package/dist/commands/new-contributor-message.js +0 -43
- package/dist/commands/publish-packages.d.ts +0 -2
- package/dist/commands/publish-packages.d.ts.map +0 -1
- package/dist/commands/publish-packages.js +0 -11
- package/dist/commands/telephone-game.d.ts +0 -2
- package/dist/commands/telephone-game.d.ts.map +0 -1
- package/dist/commands/telephone-game.js +0 -32
- package/dist/config/index.d.ts +0 -12
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -75
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -37
- package/dist/mastra/agents/index.d.ts +0 -199
- package/dist/mastra/agents/index.d.ts.map +0 -1
- package/dist/mastra/agents/index.js +0 -113
- package/dist/mastra/agents/model.d.ts +0 -7
- package/dist/mastra/agents/model.d.ts.map +0 -1
- package/dist/mastra/agents/model.js +0 -7
- package/dist/mastra/agents/new-contributor.d.ts +0 -3
- package/dist/mastra/agents/new-contributor.d.ts.map +0 -1
- package/dist/mastra/agents/new-contributor.js +0 -12
- package/dist/mastra/agents/package-publisher.d.ts +0 -65
- package/dist/mastra/agents/package-publisher.d.ts.map +0 -1
- package/dist/mastra/agents/package-publisher.js +0 -168
- package/dist/mastra/index.d.ts +0 -325
- package/dist/mastra/index.d.ts.map +0 -1
- package/dist/mastra/index.js +0 -42
- package/dist/mastra/integrations/index.d.ts +0 -7
- package/dist/mastra/integrations/index.d.ts.map +0 -1
- package/dist/mastra/integrations/index.js +0 -29
- package/dist/mastra/tools/browser.d.ts +0 -40
- package/dist/mastra/tools/browser.d.ts.map +0 -1
- package/dist/mastra/tools/browser.js +0 -116
- package/dist/mastra/tools/calendar.d.ts +0 -21
- package/dist/mastra/tools/calendar.d.ts.map +0 -1
- package/dist/mastra/tools/calendar.js +0 -134
- package/dist/mastra/tools/crawl.d.ts +0 -36
- package/dist/mastra/tools/crawl.d.ts.map +0 -1
- package/dist/mastra/tools/crawl.js +0 -27
- package/dist/mastra/tools/execa.d.ts +0 -27
- package/dist/mastra/tools/execa.d.ts.map +0 -1
- package/dist/mastra/tools/execa.js +0 -43
- package/dist/mastra/tools/fs.d.ts +0 -33
- package/dist/mastra/tools/fs.d.ts.map +0 -1
- package/dist/mastra/tools/fs.js +0 -36
- package/dist/mastra/tools/image.d.ts +0 -27
- package/dist/mastra/tools/image.d.ts.map +0 -1
- package/dist/mastra/tools/image.js +0 -37
- package/dist/mastra/tools/mcp.d.ts +0 -3
- package/dist/mastra/tools/mcp.d.ts.map +0 -1
- package/dist/mastra/tools/mcp.js +0 -12
- package/dist/mastra/tools/pdf.d.ts +0 -21
- package/dist/mastra/tools/pdf.d.ts.map +0 -1
- package/dist/mastra/tools/pdf.js +0 -42
- package/dist/mastra/tools/pnpm.d.ts +0 -60
- package/dist/mastra/tools/pnpm.d.ts.map +0 -1
- package/dist/mastra/tools/pnpm.js +0 -127
- package/dist/mastra/workflows/changelog.d.ts +0 -10
- package/dist/mastra/workflows/changelog.d.ts.map +0 -1
- package/dist/mastra/workflows/changelog.js +0 -149
- package/dist/mastra/workflows/chat.d.ts +0 -13
- package/dist/mastra/workflows/chat.d.ts.map +0 -1
- package/dist/mastra/workflows/chat.js +0 -88
- package/dist/mastra/workflows/commit-message.d.ts +0 -10
- package/dist/mastra/workflows/commit-message.d.ts.map +0 -1
- package/dist/mastra/workflows/commit-message.js +0 -138
- package/dist/mastra/workflows/first-contributor.d.ts +0 -16
- package/dist/mastra/workflows/first-contributor.d.ts.map +0 -1
- package/dist/mastra/workflows/first-contributor.js +0 -122
- package/dist/mastra/workflows/index.d.ts +0 -4
- package/dist/mastra/workflows/index.d.ts.map +0 -1
- package/dist/mastra/workflows/index.js +0 -3
- package/dist/mastra/workflows/issue-labeler.d.ts +0 -16
- package/dist/mastra/workflows/issue-labeler.d.ts.map +0 -1
- package/dist/mastra/workflows/issue-labeler.js +0 -85
- package/dist/mastra/workflows/link-checker.d.ts +0 -13
- package/dist/mastra/workflows/link-checker.d.ts.map +0 -1
- package/dist/mastra/workflows/link-checker.js +0 -102
- package/dist/mastra/workflows/publish-packages.d.ts +0 -3
- package/dist/mastra/workflows/publish-packages.d.ts.map +0 -1
- package/dist/mastra/workflows/publish-packages.js +0 -257
- package/dist/mastra/workflows/telephone-game.d.ts +0 -3
- package/dist/mastra/workflows/telephone-game.d.ts.map +0 -1
- package/dist/mastra/workflows/telephone-game.js +0 -95
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execSync } from 'child_process';
|
|
4
|
-
import Table from 'cli-table3';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
class LocalCalendarReader {
|
|
7
|
-
async getEvents() {
|
|
8
|
-
const script = `
|
|
9
|
-
tell application "Calendar"
|
|
10
|
-
set eventList to {}
|
|
11
|
-
set startDate to (current date) - 7 * days
|
|
12
|
-
set endDate to (current date) + 365 * days
|
|
13
|
-
|
|
14
|
-
repeat with calendarAccount in calendars
|
|
15
|
-
set eventList to eventList & (every event of calendarAccount whose start date is greater than or equal to startDate and start date is less than or equal to endDate)
|
|
16
|
-
end repeat
|
|
17
|
-
|
|
18
|
-
set output to ""
|
|
19
|
-
repeat with anEvent in eventList
|
|
20
|
-
set theTitle to summary of anEvent
|
|
21
|
-
set theStart to start date of anEvent as string
|
|
22
|
-
set theEnd to end date of anEvent as string
|
|
23
|
-
set theLoc to location of anEvent
|
|
24
|
-
set theDesc to description of anEvent
|
|
25
|
-
|
|
26
|
-
if theLoc is missing value then
|
|
27
|
-
set theLoc to ""
|
|
28
|
-
end if
|
|
29
|
-
if theDesc is missing value then
|
|
30
|
-
set theDesc to ""
|
|
31
|
-
end if
|
|
32
|
-
|
|
33
|
-
set output to output & theTitle & "|" & theStart & "|" & theEnd & "|" & theLoc & "|" & theDesc & "
|
|
34
|
-
"
|
|
35
|
-
end repeat
|
|
36
|
-
|
|
37
|
-
return output
|
|
38
|
-
end tell
|
|
39
|
-
`;
|
|
40
|
-
try {
|
|
41
|
-
const result = execSync(`osascript -e '${script}'`).toString();
|
|
42
|
-
return this.parseAppleScriptOutput(result);
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
if (error instanceof Error) {
|
|
46
|
-
console.error('Raw AppleScript error:', error.message);
|
|
47
|
-
throw new Error(`Failed to read Mac calendar: ${error.message}`);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
console.error('An unknown error occurred:', error);
|
|
51
|
-
throw new Error('Failed to read Mac calendar');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
parseAppleScriptOutput(output) {
|
|
56
|
-
const events = [];
|
|
57
|
-
const lines = output.split('\n').filter(line => line.trim());
|
|
58
|
-
for (const line of lines) {
|
|
59
|
-
try {
|
|
60
|
-
const [title, startDateStr, endDateStr, location, description] = line.split('|');
|
|
61
|
-
const startStandardized = startDateStr
|
|
62
|
-
?.split(',')?.[1] // Remove day name
|
|
63
|
-
?.replace(' at ', ' ') // Remove 'at'
|
|
64
|
-
?.trim(); // 'January 3, 2025 9:00:00 AM'
|
|
65
|
-
const startDate = new Date(startStandardized || '');
|
|
66
|
-
const endStandardized = endDateStr
|
|
67
|
-
?.split(',')?.[1] // Remove day name
|
|
68
|
-
?.replace(' at ', ' ') // Remove 'at'
|
|
69
|
-
?.trim(); // 'January 3, 2025 9:00:00 AM'
|
|
70
|
-
const endDate = new Date(endStandardized || '');
|
|
71
|
-
const event = {
|
|
72
|
-
title: title?.trim(),
|
|
73
|
-
startDate,
|
|
74
|
-
endDate,
|
|
75
|
-
location: location?.trim() || '',
|
|
76
|
-
description: description?.trim() || '',
|
|
77
|
-
};
|
|
78
|
-
events.push(event);
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
console.error('Failed to parse event line:', line, error);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
return events.sort((a, b) => a.startDate.getTime() - b.startDate.getTime());
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
const reader = new LocalCalendarReader();
|
|
88
|
-
export const listEvents = createTool({
|
|
89
|
-
id: 'listEvents',
|
|
90
|
-
name: 'List Events',
|
|
91
|
-
description: 'List calendar events',
|
|
92
|
-
inputSchema: z.object({
|
|
93
|
-
startDate: z.string(),
|
|
94
|
-
}),
|
|
95
|
-
outputSchema: z.object({
|
|
96
|
-
content: z.string(),
|
|
97
|
-
}),
|
|
98
|
-
execute: async () => {
|
|
99
|
-
try {
|
|
100
|
-
const events = await reader.getEvents();
|
|
101
|
-
const table = new Table({
|
|
102
|
-
head: [
|
|
103
|
-
chalk.blue('Start'),
|
|
104
|
-
chalk.blue('End'),
|
|
105
|
-
chalk.blue('Title'),
|
|
106
|
-
chalk.blue('Location'),
|
|
107
|
-
chalk.blue('Description'),
|
|
108
|
-
],
|
|
109
|
-
colWidths: [12, 15, 30, 20, 40],
|
|
110
|
-
});
|
|
111
|
-
events.forEach(event => {
|
|
112
|
-
if (event.title) {
|
|
113
|
-
table.push([
|
|
114
|
-
event.startDate.toISOString(),
|
|
115
|
-
event.endDate.toISOString(),
|
|
116
|
-
event.title || '',
|
|
117
|
-
event.location || '',
|
|
118
|
-
(event.description || '').substring(0, 37) + '...',
|
|
119
|
-
]);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
// console.log(chalk.blue(table.toString()));
|
|
123
|
-
return {
|
|
124
|
-
content: JSON.stringify(events, null, 2),
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
if (e instanceof Error) {
|
|
129
|
-
console.log(`\n${chalk.red(e.message)}`);
|
|
130
|
-
}
|
|
131
|
-
return { content: 'Error' };
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const crawl: import("@mastra/core").Tool<"crawler", z.ZodObject<{
|
|
3
|
-
url: z.ZodString;
|
|
4
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
5
|
-
pathRegex: z.ZodNullable<z.ZodString>;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
url: string;
|
|
8
|
-
limit: number;
|
|
9
|
-
pathRegex: string | null;
|
|
10
|
-
}, {
|
|
11
|
-
url: string;
|
|
12
|
-
pathRegex: string | null;
|
|
13
|
-
limit?: number | undefined;
|
|
14
|
-
}>, z.ZodObject<{
|
|
15
|
-
message: z.ZodString;
|
|
16
|
-
crawlData: z.ZodAny;
|
|
17
|
-
}, "strip", z.ZodTypeAny, {
|
|
18
|
-
message: string;
|
|
19
|
-
crawlData?: any;
|
|
20
|
-
}, {
|
|
21
|
-
message: string;
|
|
22
|
-
crawlData?: any;
|
|
23
|
-
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
24
|
-
url: z.ZodString;
|
|
25
|
-
limit: z.ZodDefault<z.ZodNumber>;
|
|
26
|
-
pathRegex: z.ZodNullable<z.ZodString>;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
url: string;
|
|
29
|
-
limit: number;
|
|
30
|
-
pathRegex: string | null;
|
|
31
|
-
}, {
|
|
32
|
-
url: string;
|
|
33
|
-
pathRegex: string | null;
|
|
34
|
-
limit?: number | undefined;
|
|
35
|
-
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
36
|
-
//# sourceMappingURL=crawl.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/crawl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDAyBhB,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { firecrawl } from '../integrations/index.js';
|
|
4
|
-
export const crawl = createTool({
|
|
5
|
-
id: 'crawler',
|
|
6
|
-
name: 'Crawler Tool',
|
|
7
|
-
description: 'Crawler Tool to crawl a website and return the content',
|
|
8
|
-
inputSchema: z.object({
|
|
9
|
-
url: z.string(),
|
|
10
|
-
limit: z.number().default(3),
|
|
11
|
-
pathRegex: z.string().nullable(),
|
|
12
|
-
}),
|
|
13
|
-
outputSchema: z.object({
|
|
14
|
-
message: z.string(),
|
|
15
|
-
crawlData: z.any(),
|
|
16
|
-
}),
|
|
17
|
-
execute: async ({ context }) => {
|
|
18
|
-
const crawlData = firecrawl.getWorkflows({})?.['FIRECRAWL:CRAWL_AND_SYNC']?.createRun();
|
|
19
|
-
await crawlData?.start({
|
|
20
|
-
triggerData: context,
|
|
21
|
-
});
|
|
22
|
-
return {
|
|
23
|
-
message: 'The website has been successfully crawled and chunks have been synced to the database. Finish.',
|
|
24
|
-
crawlData,
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const execaTool: import("@mastra/core").Tool<"execaTool", z.ZodObject<{
|
|
3
|
-
command: z.ZodString;
|
|
4
|
-
args: z.ZodArray<z.ZodString, "many">;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
command: string;
|
|
7
|
-
args: string[];
|
|
8
|
-
}, {
|
|
9
|
-
command: string;
|
|
10
|
-
args: 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
|
-
command: z.ZodString;
|
|
19
|
-
args: z.ZodArray<z.ZodString, "many">;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
command: string;
|
|
22
|
-
args: string[];
|
|
23
|
-
}, {
|
|
24
|
-
command: string;
|
|
25
|
-
args: string[];
|
|
26
|
-
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
27
|
-
//# sourceMappingURL=execa.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;iDA4BpB,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execa, ExecaError } from 'execa';
|
|
4
|
-
import { Transform } from 'stream';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
// Create transform stream that applies chalk
|
|
7
|
-
const colorTransform = new Transform({
|
|
8
|
-
transform(chunk, _encoding, callback) {
|
|
9
|
-
// Convert chunk to string and apply chalk
|
|
10
|
-
const colored = chalk.blue(chunk.toString());
|
|
11
|
-
this.push(colored);
|
|
12
|
-
callback();
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
export const execaTool = createTool({
|
|
16
|
-
id: 'execaTool',
|
|
17
|
-
name: 'Execa System Tool',
|
|
18
|
-
description: 'Execa System Tool',
|
|
19
|
-
inputSchema: z.object({
|
|
20
|
-
command: z.string(),
|
|
21
|
-
args: z.array(z.string()),
|
|
22
|
-
}),
|
|
23
|
-
outputSchema: z.object({
|
|
24
|
-
message: z.string(),
|
|
25
|
-
}),
|
|
26
|
-
execute: async ({ context: { command, args } }) => {
|
|
27
|
-
try {
|
|
28
|
-
console.log(chalk.green(`Running command: ${command} ${args.join(' ')}`));
|
|
29
|
-
const p = execa(command, args);
|
|
30
|
-
console.log(`\n`);
|
|
31
|
-
p.stdout.pipe(colorTransform).pipe(process.stdout);
|
|
32
|
-
p.stderr.pipe(colorTransform).pipe(process.stderr);
|
|
33
|
-
const r = await p;
|
|
34
|
-
return { message: r.stdout };
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
if (e instanceof ExecaError) {
|
|
38
|
-
return { message: e.message };
|
|
39
|
-
}
|
|
40
|
-
return { message: 'Error' };
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const fsTool: import("@mastra/core").Tool<"fsTool", z.ZodObject<{
|
|
3
|
-
action: z.ZodString;
|
|
4
|
-
file: z.ZodString;
|
|
5
|
-
data: z.ZodString;
|
|
6
|
-
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
data: string;
|
|
8
|
-
action: string;
|
|
9
|
-
file: string;
|
|
10
|
-
}, {
|
|
11
|
-
data: string;
|
|
12
|
-
action: string;
|
|
13
|
-
file: string;
|
|
14
|
-
}>, z.ZodObject<{
|
|
15
|
-
message: z.ZodString;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
message: string;
|
|
18
|
-
}, {
|
|
19
|
-
message: string;
|
|
20
|
-
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
21
|
-
action: z.ZodString;
|
|
22
|
-
file: z.ZodString;
|
|
23
|
-
data: z.ZodString;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
data: string;
|
|
26
|
-
action: string;
|
|
27
|
-
file: string;
|
|
28
|
-
}, {
|
|
29
|
-
data: string;
|
|
30
|
-
action: string;
|
|
31
|
-
file: string;
|
|
32
|
-
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
33
|
-
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/mastra/tools/fs.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core';
|
|
2
|
-
import { readFileSync, writeFileSync } from 'fs';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
export const fsTool = createTool({
|
|
5
|
-
id: 'fsTool',
|
|
6
|
-
name: 'File System Tool',
|
|
7
|
-
description: 'File System Tool',
|
|
8
|
-
inputSchema: z.object({
|
|
9
|
-
action: z.string(),
|
|
10
|
-
file: z.string(),
|
|
11
|
-
data: z.string(),
|
|
12
|
-
}),
|
|
13
|
-
outputSchema: z.object({
|
|
14
|
-
message: z.string(),
|
|
15
|
-
}),
|
|
16
|
-
execute: async ({ context: { action, file, data } }) => {
|
|
17
|
-
try {
|
|
18
|
-
switch (action) {
|
|
19
|
-
case 'write':
|
|
20
|
-
writeFileSync(file, data);
|
|
21
|
-
break;
|
|
22
|
-
case 'read':
|
|
23
|
-
return { message: readFileSync(file, 'utf8') };
|
|
24
|
-
case 'append':
|
|
25
|
-
writeFileSync(file, data, { flag: 'a' });
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
return { message: 'Invalid action' };
|
|
29
|
-
}
|
|
30
|
-
return { message: 'Success' };
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
return { message: 'Error' };
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/image.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;iDAgCpB,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { writeFileSync } from 'fs';
|
|
4
|
-
import { resolve } from 'path';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { stabilityai } from '../integrations/index.js';
|
|
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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,eAAO,MAAM,KAAK,iBAUhB,CAAC"}
|
package/dist/mastra/tools/mcp.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { MastraMCPClient } from '@mastra/mcp';
|
|
2
|
-
export const slack = new MastraMCPClient({
|
|
3
|
-
name: 'Slack',
|
|
4
|
-
server: {
|
|
5
|
-
command: '/usr/local/bin/docker',
|
|
6
|
-
args: ['run', '-i', '--rm', '-e', 'SLACK_BOT_TOKEN', '-e', 'SLACK_TEAM_ID', 'mcp/slack'],
|
|
7
|
-
env: {
|
|
8
|
-
SLACK_BOT_TOKEN: process.env.SLACK_BOT_TOKEN,
|
|
9
|
-
SLACK_TEAM_ID: process.env.SLACK_TEAM_ID,
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const readPDF: import("@mastra/core").Tool<"readPDF", z.ZodObject<{
|
|
3
|
-
pdfPath: z.ZodString;
|
|
4
|
-
}, "strip", z.ZodTypeAny, {
|
|
5
|
-
pdfPath: string;
|
|
6
|
-
}, {
|
|
7
|
-
pdfPath: string;
|
|
8
|
-
}>, z.ZodObject<{
|
|
9
|
-
content: z.ZodString;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
content: string;
|
|
12
|
-
}, {
|
|
13
|
-
content: string;
|
|
14
|
-
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
15
|
-
pdfPath: z.ZodString;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
pdfPath: string;
|
|
18
|
-
}, {
|
|
19
|
-
pdfPath: string;
|
|
20
|
-
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
21
|
-
//# sourceMappingURL=pdf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/pdf.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;iDAsClB,CAAC"}
|
package/dist/mastra/tools/pdf.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { createTool } from '@mastra/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { existsSync, readFileSync } from 'fs';
|
|
4
|
-
import path from 'path';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
import pdfParse from 'pdf-parse/lib/pdf-parse.js';
|
|
8
|
-
export const readPDF = createTool({
|
|
9
|
-
id: 'readPDF',
|
|
10
|
-
name: 'Read PDF',
|
|
11
|
-
description: 'Read PDF file and extract information',
|
|
12
|
-
inputSchema: z.object({
|
|
13
|
-
pdfPath: z.string(),
|
|
14
|
-
}),
|
|
15
|
-
outputSchema: z.object({
|
|
16
|
-
content: z.string(),
|
|
17
|
-
}),
|
|
18
|
-
execute: async ({ context: { pdfPath } }) => {
|
|
19
|
-
try {
|
|
20
|
-
// Check if file exists
|
|
21
|
-
if (!existsSync(pdfPath)) {
|
|
22
|
-
throw new Error('PDF file not found');
|
|
23
|
-
}
|
|
24
|
-
// Check if file is a PDF
|
|
25
|
-
if (path.extname(pdfPath).toLowerCase() !== '.pdf') {
|
|
26
|
-
throw new Error('File is not a PDF');
|
|
27
|
-
}
|
|
28
|
-
// Read the PDF file
|
|
29
|
-
const dataBuffer = readFileSync(pdfPath);
|
|
30
|
-
// Parse PDF content
|
|
31
|
-
const data = await pdfParse(dataBuffer);
|
|
32
|
-
console.log(chalk.blue('\n'));
|
|
33
|
-
console.log(chalk.blue('PDF Information:'));
|
|
34
|
-
console.log(chalk.blue('-----------------'));
|
|
35
|
-
console.log(chalk.blue(`Number of pages: ${data.numpages}`));
|
|
36
|
-
return { content: data.text };
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
return { content: 'Error scanning PDF' };
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const pnpmBuild: import("@mastra/core").Tool<"pnpmBuild", z.ZodObject<{
|
|
3
|
-
name: z.ZodString;
|
|
4
|
-
packagePath: z.ZodString;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
name: string;
|
|
7
|
-
packagePath: string;
|
|
8
|
-
}, {
|
|
9
|
-
name: string;
|
|
10
|
-
packagePath: 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
|
-
name: z.ZodString;
|
|
19
|
-
packagePath: z.ZodString;
|
|
20
|
-
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
name: string;
|
|
22
|
-
packagePath: string;
|
|
23
|
-
}, {
|
|
24
|
-
name: string;
|
|
25
|
-
packagePath: string;
|
|
26
|
-
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
27
|
-
export declare const pnpmChangesetStatus: import("@mastra/core").Tool<"pnpmChangesetStatus", z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, z.ZodObject<{
|
|
28
|
-
message: z.ZodArray<z.ZodString, "many">;
|
|
29
|
-
}, "strip", z.ZodTypeAny, {
|
|
30
|
-
message: string[];
|
|
31
|
-
}, {
|
|
32
|
-
message: string[];
|
|
33
|
-
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
34
|
-
export declare const pnpmChangesetPublish: import("@mastra/core").Tool<"pnpmChangesetPublish", z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, z.ZodObject<{
|
|
35
|
-
message: z.ZodString;
|
|
36
|
-
}, "strip", z.ZodTypeAny, {
|
|
37
|
-
message: string;
|
|
38
|
-
}, {
|
|
39
|
-
message: string;
|
|
40
|
-
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
41
|
-
export declare const activeDistTag: import("@mastra/core").Tool<"activeDistTag", z.ZodObject<{
|
|
42
|
-
packagePath: z.ZodString;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
packagePath: string;
|
|
45
|
-
}, {
|
|
46
|
-
packagePath: string;
|
|
47
|
-
}>, z.ZodObject<{
|
|
48
|
-
message: z.ZodString;
|
|
49
|
-
}, "strip", z.ZodTypeAny, {
|
|
50
|
-
message: string;
|
|
51
|
-
}, {
|
|
52
|
-
message: string;
|
|
53
|
-
}>, import("@mastra/core").ToolExecutionContext<z.ZodObject<{
|
|
54
|
-
packagePath: z.ZodString;
|
|
55
|
-
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
packagePath: string;
|
|
57
|
-
}, {
|
|
58
|
-
packagePath: string;
|
|
59
|
-
}>, import("@mastra/core").WorkflowContext<any>>>;
|
|
60
|
-
//# sourceMappingURL=pnpm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pnpm.d.ts","sourceRoot":"","sources":["../../../src/mastra/tools/pnpm.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;iDA8BpB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;6IA6B9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;6IA0B/B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;iDA8BxB,CAAC"}
|