@aiready/agents 0.3.0 → 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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @aiready/agents@0.2.0 test /Users/pengcao/projects/aiready/packages/agents
3
+ > @aiready/agents@0.3.1 test /Users/pengcao/projects/aiready/packages/agents
4
4
  > vitest run
5
5
 
6
6
 
@@ -10,7 +10,7 @@
10
10
 
11
11
   Test Files  1 passed (1)
12
12
   Tests  1 passed (1)
13
-  Start at  16:14:30
14
-  Duration  467ms (transform 156ms, setup 0ms, collect 148ms, tests 1ms, environment 0ms, prepare 83ms)
13
+  Start at  02:00:27
14
+  Duration  246ms (transform 46ms, setup 0ms, collect 43ms, tests 1ms, environment 0ms, prepare 54ms)
15
15
 
16
16
  [?25h
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@aiready/agents",
3
- "version": "0.3.0",
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.18.0",
8
+ "@mastra/core": "^0.24.0",
9
9
  "zod": "^3.0.0",
10
- "@aiready/core": "0.23.0",
11
- "@aiready/cli": "0.14.0"
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
  }
@@ -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({
@@ -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({
@@ -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({
@@ -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({
@@ -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 ({ input }) => {
18
+ execute: async (context) => {
19
19
  console.log(
20
- `[GitHubTool] Creating branch ${input.branchName} from ${input.baseBranch}`
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/${input.branchName}`,
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 ({ input }) => {
46
- console.log(`[GitHubTool] Creating PR: ${input.title}`);
45
+ execute: async (context) => {
46
+ console.log(`[GitHubTool] Creating PR: ${context.context.title}`);
47
47
  // Mock implementation
48
48
  return {
49
49
  success: true,
@@ -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
- name: 'Remediation Swarm',
10
- steps: [
11
- {
12
- id: 'prioritize',
13
- agent: PrioritizationAgent,
14
- description: 'Calculating ROI and Risk hierarchy',
15
- },
16
- {
17
- id: 'impact',
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);