@aiready/agents 0.3.1 → 0.3.2
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/.turbo/turbo-test.log +4 -6
- package/package.json +6 -5
- package/src/impact-agent.ts +2 -5
- package/src/prioritization-agent.ts +2 -5
- package/src/refactor-agent.ts +2 -5
- package/src/rename-agent.ts +2 -5
- package/src/restructure-agent.ts +2 -5
- package/src/risk-agent.ts +2 -5
- package/src/tools/github.ts +6 -6
- package/src/validation-agent.ts +2 -5
- package/src/workflows/remediation-swarm.ts +11 -32
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/agents@0.3.
|
|
3
|
+
> @aiready/agents@0.3.1 test /Users/pengcao/projects/aiready/packages/agents
|
|
4
4
|
> vitest run
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
[7m[1m[36m RUN [39m[22m[27m [36mv1.6.1[39m [90m/Users/pengcao/projects/aiready/packages/agents[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m
|
|
10
|
-
[32m✓[39m Agents Smoke Test[2m (1)[22m
|
|
11
|
-
[32m✓[39m should pass
|
|
9
|
+
[32m✓[39m src/__tests__/smoke.test.ts [2m ([22m[2m1 test[22m[2m)[22m[90m 1[2mms[22m[39m
|
|
12
10
|
|
|
13
11
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
14
12
|
[2m Tests [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
15
|
-
[2m Start at [22m
|
|
16
|
-
[2m Duration [22m
|
|
13
|
+
[2m Start at [22m 02:00:27
|
|
14
|
+
[2m Duration [22m 246ms[2m (transform 46ms, setup 0ms, collect 43ms, tests 1ms, environment 0ms, prepare 54ms)[22m
|
|
17
15
|
|
|
18
16
|
[?25h
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/agents",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Agentic remediation and analysis system for AIReady",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"mastra": "^0.
|
|
8
|
+
"@mastra/core": "^0.24.0",
|
|
9
9
|
"zod": "^3.0.0",
|
|
10
|
-
"@aiready/
|
|
11
|
-
"@aiready/
|
|
10
|
+
"@aiready/cli": "0.14.3",
|
|
11
|
+
"@aiready/core": "0.23.2"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"typescript": "^5.0.0",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"test": "vitest run",
|
|
20
|
-
"type-check": "tsc --noEmit"
|
|
20
|
+
"type-check": "tsc --noEmit",
|
|
21
|
+
"lint": "eslint ."
|
|
21
22
|
}
|
|
22
23
|
}
|
package/src/impact-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const ImpactAgent = new Agent({
|
|
@@ -19,10 +19,7 @@ export const ImpactAgent = new Agent({
|
|
|
19
19
|
- confidenceScore: number (0.0 to 1.0)
|
|
20
20
|
- breakdown: string (explanation of the math)
|
|
21
21
|
`,
|
|
22
|
-
model:
|
|
23
|
-
provider: 'openai',
|
|
24
|
-
name: 'gpt-4o',
|
|
25
|
-
},
|
|
22
|
+
model: 'openai/gpt-4o',
|
|
26
23
|
});
|
|
27
24
|
|
|
28
25
|
export const ImpactSchema = z.object({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const PrioritizationAgent = new Agent({
|
|
@@ -16,10 +16,7 @@ export const PrioritizationAgent = new Agent({
|
|
|
16
16
|
- rank: 'P0' | 'P1' | 'P2' | 'P3'
|
|
17
17
|
- reasoning: string explanation of the ranking decision.
|
|
18
18
|
`,
|
|
19
|
-
model:
|
|
20
|
-
provider: 'openai',
|
|
21
|
-
name: 'gpt-4o',
|
|
22
|
-
},
|
|
19
|
+
model: 'openai/gpt-4o',
|
|
23
20
|
});
|
|
24
21
|
|
|
25
22
|
export const PrioritySchema = z.object({
|
package/src/refactor-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const RefactorAgent = new Agent({
|
|
@@ -19,10 +19,7 @@ export const RefactorAgent = new Agent({
|
|
|
19
19
|
- Update the original call sites to use the consolidated logic.
|
|
20
20
|
- Verify with type checking if possible.
|
|
21
21
|
`,
|
|
22
|
-
model:
|
|
23
|
-
provider: 'openai',
|
|
24
|
-
name: 'gpt-4o',
|
|
25
|
-
},
|
|
22
|
+
model: 'openai/gpt-4o',
|
|
26
23
|
});
|
|
27
24
|
|
|
28
25
|
export const RefactorResultSchema = z.object({
|
package/src/rename-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const RenameAgent = new Agent({
|
|
@@ -18,10 +18,7 @@ export const RenameAgent = new Agent({
|
|
|
18
18
|
- Propose a mapping of old -> new names.
|
|
19
19
|
- Execute the rename across all affected files.
|
|
20
20
|
`,
|
|
21
|
-
model:
|
|
22
|
-
provider: 'openai',
|
|
23
|
-
name: 'gpt-4o',
|
|
24
|
-
},
|
|
21
|
+
model: 'openai/gpt-4o',
|
|
25
22
|
});
|
|
26
23
|
|
|
27
24
|
export const RenameResultSchema = z.object({
|
package/src/restructure-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const RestructureAgent = new Agent({
|
|
@@ -17,10 +17,7 @@ export const RestructureAgent = new Agent({
|
|
|
17
17
|
- strategy: string (explanation of the architectural vision)
|
|
18
18
|
- impact: { cognitiveLoadReduction: number (0-100), fragmentationReduction: number (0-100) }
|
|
19
19
|
`,
|
|
20
|
-
model:
|
|
21
|
-
provider: 'openai',
|
|
22
|
-
name: 'gpt-4o',
|
|
23
|
-
},
|
|
20
|
+
model: 'openai/gpt-4o',
|
|
24
21
|
});
|
|
25
22
|
|
|
26
23
|
export const RestructureSchema = z.object({
|
package/src/risk-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const RiskAssessmentAgent = new Agent({
|
|
@@ -19,10 +19,7 @@ export const RiskAssessmentAgent = new Agent({
|
|
|
19
19
|
- autoApprove: boolean (true only for 'low' risk)
|
|
20
20
|
- reasoning: string
|
|
21
21
|
`,
|
|
22
|
-
model:
|
|
23
|
-
provider: 'openai',
|
|
24
|
-
name: 'gpt-4o',
|
|
25
|
-
},
|
|
22
|
+
model: 'openai/gpt-4o',
|
|
26
23
|
});
|
|
27
24
|
|
|
28
25
|
export const RiskSchema = z.object({
|
package/src/tools/github.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createTool } from 'mastra';
|
|
1
|
+
import { createTool } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
// Note: In a real implementation, this would use Octokit with appropriate auth
|
|
@@ -15,14 +15,14 @@ export const githubTools = {
|
|
|
15
15
|
success: z.boolean(),
|
|
16
16
|
branchUrl: z.string().optional(),
|
|
17
17
|
}),
|
|
18
|
-
execute: async (
|
|
18
|
+
execute: async (context) => {
|
|
19
19
|
console.log(
|
|
20
|
-
`[GitHubTool] Creating branch ${
|
|
20
|
+
`[GitHubTool] Creating branch ${context.context.branchName} from ${context.context.baseBranch}`
|
|
21
21
|
);
|
|
22
22
|
// Mock implementation
|
|
23
23
|
return {
|
|
24
24
|
success: true,
|
|
25
|
-
branchUrl: `https://github.com/placeholder/${
|
|
25
|
+
branchUrl: `https://github.com/placeholder/${context.context.branchName}`,
|
|
26
26
|
};
|
|
27
27
|
},
|
|
28
28
|
}),
|
|
@@ -42,8 +42,8 @@ export const githubTools = {
|
|
|
42
42
|
prNumber: z.number().optional(),
|
|
43
43
|
prUrl: z.string().optional(),
|
|
44
44
|
}),
|
|
45
|
-
execute: async (
|
|
46
|
-
console.log(`[GitHubTool] Creating PR: ${
|
|
45
|
+
execute: async (context) => {
|
|
46
|
+
console.log(`[GitHubTool] Creating PR: ${context.context.title}`);
|
|
47
47
|
// Mock implementation
|
|
48
48
|
return {
|
|
49
49
|
success: true,
|
package/src/validation-agent.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Agent } from 'mastra';
|
|
1
|
+
import { Agent } from '@mastra/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
export const ValidationAgent = new Agent({
|
|
@@ -17,10 +17,7 @@ export const ValidationAgent = new Agent({
|
|
|
17
17
|
- errors: array of { file: string, message: string, line?: number }
|
|
18
18
|
- feedbackForRefactor: string (detailed instructions for the RefactorAgent on how to fix these errors)
|
|
19
19
|
`,
|
|
20
|
-
model:
|
|
21
|
-
provider: 'openai',
|
|
22
|
-
name: 'gpt-4o',
|
|
23
|
-
},
|
|
20
|
+
model: 'openai/gpt-4o',
|
|
24
21
|
});
|
|
25
22
|
|
|
26
23
|
export const ValidationSchema = z.object({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Workflow } from 'mastra';
|
|
1
|
+
import { Workflow } from '@mastra/core';
|
|
2
|
+
import { z } from 'zod';
|
|
2
3
|
import { PrioritizationAgent } from '../prioritization-agent';
|
|
3
4
|
import { ImpactAgent } from '../impact-agent';
|
|
4
5
|
import { RestructureAgent } from '../restructure-agent';
|
|
@@ -6,34 +7,12 @@ import { RefactorAgent } from '../refactor-agent';
|
|
|
6
7
|
import { ValidationAgent } from '../validation-agent';
|
|
7
8
|
|
|
8
9
|
export const RemediationSwarm = new Workflow({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
agent: ImpactAgent,
|
|
19
|
-
description: 'Predicting monetary token savings',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: 'restructure',
|
|
23
|
-
agent: RestructureAgent,
|
|
24
|
-
description: 'Optimizing architecture and folder structure',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
id: 'refactor',
|
|
28
|
-
agent: RefactorAgent,
|
|
29
|
-
description: 'Executing the code consolidation',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
id: 'validate',
|
|
33
|
-
agent: ValidationAgent,
|
|
34
|
-
description: 'Verifying types and automated tests',
|
|
35
|
-
},
|
|
36
|
-
],
|
|
37
|
-
// Note: Complex looping and conditional logic is typically handled
|
|
38
|
-
// in the workflow's trigger or a custom execution handler in Mastra.
|
|
39
|
-
});
|
|
10
|
+
id: 'remediation-swarm',
|
|
11
|
+
inputSchema: z.any(),
|
|
12
|
+
outputSchema: z.any(),
|
|
13
|
+
})
|
|
14
|
+
.then(PrioritizationAgent as any)
|
|
15
|
+
.then(ImpactAgent as any)
|
|
16
|
+
.then(RestructureAgent as any)
|
|
17
|
+
.then(RefactorAgent as any)
|
|
18
|
+
.then(ValidationAgent as any);
|