@mastra/dane 0.0.2-alpha.0 → 0.0.2-alpha.100
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/LICENSE +44 -0
- package/README.md +25 -4
- package/data/crawl/conventional-commit.json +25 -0
- package/dist/commands/changelog.d.ts +2 -0
- package/dist/commands/changelog.d.ts.map +1 -0
- package/dist/commands/changelog.js +15 -0
- 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 +32 -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 +1 -0
- package/dist/commands/issue-labeler.d.ts.map +1 -0
- package/dist/commands/issue-labeler.js +19 -2
- package/dist/commands/link-checker.d.ts +4 -0
- package/dist/commands/link-checker.d.ts.map +1 -0
- package/dist/commands/link-checker.js +16 -0
- package/dist/commands/message.d.ts +1 -0
- package/dist/commands/message.d.ts.map +1 -0
- package/dist/commands/message.js +3 -1
- package/dist/commands/new-contributor-message.d.ts +2 -0
- package/dist/commands/new-contributor-message.d.ts.map +1 -0
- package/dist/commands/new-contributor-message.js +43 -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 +11 -0
- package/dist/commands/telephone-game.d.ts +2 -0
- package/dist/commands/telephone-game.d.ts.map +1 -0
- package/dist/commands/telephone-game.js +32 -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 +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -1
- package/dist/mastra/agents/index.d.ts +34 -2
- package/dist/mastra/agents/index.d.ts.map +1 -0
- package/dist/mastra/agents/index.js +62 -25
- package/dist/mastra/agents/model.d.ts +7 -0
- package/dist/mastra/agents/model.d.ts.map +1 -0
- package/dist/mastra/agents/model.js +7 -0
- package/dist/mastra/agents/new-contributor.d.ts +3 -0
- package/dist/mastra/agents/new-contributor.d.ts.map +1 -0
- package/dist/mastra/agents/new-contributor.js +12 -0
- package/dist/mastra/agents/package-publisher.d.ts +65 -0
- package/dist/mastra/agents/package-publisher.d.ts.map +1 -0
- package/dist/mastra/agents/package-publisher.js +168 -0
- package/dist/mastra/index.d.ts +135 -5
- package/dist/mastra/index.d.ts.map +1 -0
- package/dist/mastra/index.js +21 -8
- 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 +19 -2
- 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 +4 -0
- package/dist/mastra/tools/crawl.d.ts.map +1 -0
- package/dist/mastra/tools/crawl.js +7 -4
- 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 +5 -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/mcp.d.ts +3 -0
- package/dist/mastra/tools/mcp.d.ts.map +1 -0
- package/dist/mastra/tools/mcp.js +12 -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/tools/pnpm.d.ts +60 -0
- package/dist/mastra/tools/pnpm.d.ts.map +1 -0
- package/dist/mastra/tools/pnpm.js +127 -0
- package/dist/mastra/workflows/changelog.d.ts +10 -0
- package/dist/mastra/workflows/changelog.d.ts.map +1 -0
- package/dist/mastra/workflows/changelog.js +149 -0
- package/dist/mastra/workflows/chat.d.ts +1 -0
- package/dist/mastra/workflows/chat.d.ts.map +1 -0
- package/dist/mastra/workflows/chat.js +6 -11
- 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 +138 -0
- package/dist/mastra/workflows/first-contributor.d.ts +16 -0
- package/dist/mastra/workflows/first-contributor.d.ts.map +1 -0
- package/dist/mastra/workflows/first-contributor.js +122 -0
- package/dist/mastra/workflows/index.d.ts +2 -0
- package/dist/mastra/workflows/index.d.ts.map +1 -0
- package/dist/mastra/workflows/index.js +1 -0
- package/dist/mastra/workflows/issue-labeler.d.ts +1 -0
- package/dist/mastra/workflows/issue-labeler.d.ts.map +1 -0
- package/dist/mastra/workflows/issue-labeler.js +1 -1
- package/dist/mastra/workflows/link-checker.d.ts +13 -0
- package/dist/mastra/workflows/link-checker.d.ts.map +1 -0
- package/dist/mastra/workflows/link-checker.js +102 -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 +344 -0
- package/dist/mastra/workflows/telephone-game.d.ts +3 -0
- package/dist/mastra/workflows/telephone-game.d.ts.map +1 -0
- package/dist/mastra/workflows/telephone-game.js +95 -0
- package/package.json +19 -10
- 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
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { Step, Workflow } from '@mastra/core';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import inquirer from 'inquirer';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
import { dane } from '../agents/index.js';
|
|
7
|
-
|
|
8
|
-
export const messageWorkflow = new Workflow({
|
|
9
|
-
name: 'entry',
|
|
10
|
-
triggerSchema: z.object({
|
|
11
|
-
resourceid: z.string(),
|
|
12
|
-
threadId: z.string(),
|
|
13
|
-
}),
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const messageStep = new Step({
|
|
17
|
-
id: 'message-input',
|
|
18
|
-
outputSchema: z.object({
|
|
19
|
-
message: z.string(),
|
|
20
|
-
}),
|
|
21
|
-
execute: async () => {
|
|
22
|
-
const { content } = await inquirer.prompt([
|
|
23
|
-
{
|
|
24
|
-
type: 'input',
|
|
25
|
-
name: 'content',
|
|
26
|
-
message: '\n You:',
|
|
27
|
-
validate: input => input.trim().length > 0 || 'Message cannot be empty',
|
|
28
|
-
},
|
|
29
|
-
]);
|
|
30
|
-
|
|
31
|
-
return { message: content };
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const messageOutputStep = new Step({
|
|
36
|
-
id: 'message-output',
|
|
37
|
-
outputSchema: z.object({
|
|
38
|
-
message: z.string(),
|
|
39
|
-
}),
|
|
40
|
-
// SHOULD BE ABLE TO ACCESS ALL MASTRA PRIMS FROM EXECTUE
|
|
41
|
-
execute: async ({ context, mastra }) => {
|
|
42
|
-
// WISH THIS WAS TYPED
|
|
43
|
-
const threadId = context?.machineContext?.triggerData?.threadId;
|
|
44
|
-
const resourceid = context?.machineContext?.triggerData?.resourceid;
|
|
45
|
-
|
|
46
|
-
const messageInputStatus = context?.machineContext?.stepResults?.['message-input']?.status;
|
|
47
|
-
|
|
48
|
-
if (messageInputStatus !== 'success') {
|
|
49
|
-
return { message: 'Failure in workflow' };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// is there someway to know what steps are flowing into this one and type their props
|
|
53
|
-
const message = context?.machineContext?.stepResults?.['message-input']?.payload?.message;
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
let messages = await mastra?.memory?.getContextWindow({
|
|
57
|
-
threadId,
|
|
58
|
-
format: 'core_message',
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
if (!messages || messages.length === 0) {
|
|
62
|
-
messages = [];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const res = await mastra?.agents?.['dane']?.generate(message, {
|
|
66
|
-
stream: true,
|
|
67
|
-
maxSteps: 5,
|
|
68
|
-
resourceid,
|
|
69
|
-
threadId,
|
|
70
|
-
context: [],
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
if (res) {
|
|
74
|
-
console.log(chalk.green(`\nDane: \n`));
|
|
75
|
-
|
|
76
|
-
for await (const chunk of res.textStream) {
|
|
77
|
-
process.stdout.write(chalk.green(chunk));
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
console.log(chalk.green(`\n`));
|
|
81
|
-
|
|
82
|
-
return { message: 'success' };
|
|
83
|
-
}
|
|
84
|
-
} catch (e) {
|
|
85
|
-
console.log(chalk.red(`\n`));
|
|
86
|
-
console.log(chalk.red(`\n`));
|
|
87
|
-
console.log(chalk.red(`Error streaming results. Let's try again.`));
|
|
88
|
-
if (e instanceof Error) {
|
|
89
|
-
console.log(chalk.red(e.message));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const res = await dane.generate(message, {
|
|
94
|
-
maxSteps: 5,
|
|
95
|
-
threadId,
|
|
96
|
-
resourceid,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
console.log(chalk.green(res?.text));
|
|
100
|
-
|
|
101
|
-
return { message: res?.text };
|
|
102
|
-
},
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
messageWorkflow
|
|
106
|
-
.step(messageStep)
|
|
107
|
-
.after(messageStep)
|
|
108
|
-
.step(messageOutputStep)
|
|
109
|
-
.after(messageOutputStep)
|
|
110
|
-
.step(messageStep)
|
|
111
|
-
.commit();
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { Step, Workflow } from '@mastra/core';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
|
|
4
|
-
import { github } from '../integrations/index.js';
|
|
5
|
-
|
|
6
|
-
export const githubIssueLabeler = new Workflow({
|
|
7
|
-
name: 'github-issue-labeler',
|
|
8
|
-
triggerSchema: z.object({
|
|
9
|
-
repo: z.string(),
|
|
10
|
-
owner: z.string(),
|
|
11
|
-
issue_number: z.number(),
|
|
12
|
-
}),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const getIssue = new Step({
|
|
16
|
-
id: 'getIssue',
|
|
17
|
-
outputSchema: z.object({
|
|
18
|
-
title: z.string(),
|
|
19
|
-
body: z.string(),
|
|
20
|
-
labelNames: z.array(z.string()),
|
|
21
|
-
}),
|
|
22
|
-
execute: async ({ context }) => {
|
|
23
|
-
const client = await github.getApiClient();
|
|
24
|
-
|
|
25
|
-
const issue = await client.issuesGet({
|
|
26
|
-
path: {
|
|
27
|
-
// TODO: Type triggerData in machineContext to the triggerSchema
|
|
28
|
-
owner: context?.machineContext?.triggerData?.owner,
|
|
29
|
-
repo: context?.machineContext?.triggerData?.repo,
|
|
30
|
-
issue_number: context?.machineContext?.triggerData?.issue_number,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const labels = await client.issuesListLabelsForRepo({
|
|
35
|
-
path: {
|
|
36
|
-
owner: context?.machineContext?.triggerData?.owner,
|
|
37
|
-
repo: context?.machineContext?.triggerData?.repo,
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const labelNames = labels?.data?.map(label => label.name);
|
|
42
|
-
|
|
43
|
-
return { title: issue?.data?.title!, body: issue?.data?.body!, labelNames: labelNames! };
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const labelIssue = new Step({
|
|
48
|
-
id: 'labelIssue',
|
|
49
|
-
outputSchema: z.object({
|
|
50
|
-
labels: z.array(z.string()),
|
|
51
|
-
}),
|
|
52
|
-
execute: async ({ context, mastra }) => {
|
|
53
|
-
const parentStep = context?.machineContext?.stepResults?.getIssue;
|
|
54
|
-
if (!parentStep || parentStep.status !== 'success') {
|
|
55
|
-
return { labels: [] };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const daneIssueLabeler = mastra?.agents?.daneIssueLabeler;
|
|
59
|
-
|
|
60
|
-
const res = await daneIssueLabeler?.generate(
|
|
61
|
-
`
|
|
62
|
-
Hey Dane, given:
|
|
63
|
-
* this issue title: ${parentStep?.payload?.title}
|
|
64
|
-
* this issue body: ${parentStep?.payload?.body}
|
|
65
|
-
* these labels: ${parentStep?.payload?.labelNames}
|
|
66
|
-
|
|
67
|
-
What label or labels would you assign?
|
|
68
|
-
`,
|
|
69
|
-
{
|
|
70
|
-
schema: z.object({
|
|
71
|
-
labels: z.array(z.string()),
|
|
72
|
-
}),
|
|
73
|
-
},
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
return { labels: res?.object?.labels as string[] };
|
|
77
|
-
},
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const applyLabels = new Step({
|
|
81
|
-
id: 'applyLabels',
|
|
82
|
-
execute: async ({ context }) => {
|
|
83
|
-
const parentStep = context?.machineContext?.stepResults?.labelIssue;
|
|
84
|
-
|
|
85
|
-
if (!parentStep || parentStep.status !== 'success') {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const client = await github.getApiClient();
|
|
90
|
-
|
|
91
|
-
await client.issuesAddLabels({
|
|
92
|
-
path: {
|
|
93
|
-
owner: context?.machineContext?.triggerData?.owner,
|
|
94
|
-
repo: context?.machineContext?.triggerData?.repo,
|
|
95
|
-
issue_number: context?.machineContext?.triggerData?.issue_number,
|
|
96
|
-
},
|
|
97
|
-
body: {
|
|
98
|
-
labels: parentStep.payload.labels,
|
|
99
|
-
},
|
|
100
|
-
});
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
githubIssueLabeler.step(getIssue).then(labelIssue).then(applyLabels).commit();
|
package/tsconfig.json
DELETED