@aiagentflow/cli 0.1.0
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 +21 -0
- package/README.md +232 -0
- package/dist/agents/base.d.ts +69 -0
- package/dist/agents/base.d.ts.map +1 -0
- package/dist/agents/base.js +78 -0
- package/dist/agents/base.js.map +1 -0
- package/dist/agents/factory.d.ts +21 -0
- package/dist/agents/factory.d.ts.map +1 -0
- package/dist/agents/factory.js +50 -0
- package/dist/agents/factory.js.map +1 -0
- package/dist/agents/roles/architect.d.ts +23 -0
- package/dist/agents/roles/architect.d.ts.map +1 -0
- package/dist/agents/roles/architect.js +39 -0
- package/dist/agents/roles/architect.js.map +1 -0
- package/dist/agents/roles/coder.d.ts +19 -0
- package/dist/agents/roles/coder.d.ts.map +1 -0
- package/dist/agents/roles/coder.js +38 -0
- package/dist/agents/roles/coder.js.map +1 -0
- package/dist/agents/roles/fixer.d.ts +19 -0
- package/dist/agents/roles/fixer.d.ts.map +1 -0
- package/dist/agents/roles/fixer.js +29 -0
- package/dist/agents/roles/fixer.js.map +1 -0
- package/dist/agents/roles/judge.d.ts +24 -0
- package/dist/agents/roles/judge.d.ts.map +1 -0
- package/dist/agents/roles/judge.js +38 -0
- package/dist/agents/roles/judge.js.map +1 -0
- package/dist/agents/roles/reviewer.d.ts +28 -0
- package/dist/agents/roles/reviewer.d.ts.map +1 -0
- package/dist/agents/roles/reviewer.js +49 -0
- package/dist/agents/roles/reviewer.js.map +1 -0
- package/dist/agents/roles/tester.d.ts +19 -0
- package/dist/agents/roles/tester.d.ts.map +1 -0
- package/dist/agents/roles/tester.js +29 -0
- package/dist/agents/roles/tester.js.map +1 -0
- package/dist/agents/types.d.ts +13 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +25 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/cli/commands/config.d.ts +9 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +30 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +12 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +63 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +231 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/run.d.ts +11 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +66 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +24 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config/defaults.d.ts +22 -0
- package/dist/core/config/defaults.d.ts.map +1 -0
- package/dist/core/config/defaults.js +60 -0
- package/dist/core/config/defaults.js.map +1 -0
- package/dist/core/config/manager.d.ts +45 -0
- package/dist/core/config/manager.d.ts.map +1 -0
- package/dist/core/config/manager.js +106 -0
- package/dist/core/config/manager.js.map +1 -0
- package/dist/core/config/schema.d.ts +780 -0
- package/dist/core/config/schema.d.ts.map +1 -0
- package/dist/core/config/schema.js +102 -0
- package/dist/core/config/schema.js.map +1 -0
- package/dist/core/config/types.d.ts +24 -0
- package/dist/core/config/types.d.ts.map +1 -0
- package/dist/core/config/types.js +11 -0
- package/dist/core/config/types.js.map +1 -0
- package/dist/core/errors.d.ts +36 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +60 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/workflow/approval.d.ts +22 -0
- package/dist/core/workflow/approval.d.ts.map +1 -0
- package/dist/core/workflow/approval.js +54 -0
- package/dist/core/workflow/approval.js.map +1 -0
- package/dist/core/workflow/engine.d.ts +128 -0
- package/dist/core/workflow/engine.d.ts.map +1 -0
- package/dist/core/workflow/engine.js +159 -0
- package/dist/core/workflow/engine.js.map +1 -0
- package/dist/core/workflow/file-parser.d.ts +41 -0
- package/dist/core/workflow/file-parser.d.ts.map +1 -0
- package/dist/core/workflow/file-parser.js +138 -0
- package/dist/core/workflow/file-parser.js.map +1 -0
- package/dist/core/workflow/qa-policy.d.ts +55 -0
- package/dist/core/workflow/qa-policy.d.ts.map +1 -0
- package/dist/core/workflow/qa-policy.js +119 -0
- package/dist/core/workflow/qa-policy.js.map +1 -0
- package/dist/core/workflow/runner.d.ts +30 -0
- package/dist/core/workflow/runner.d.ts.map +1 -0
- package/dist/core/workflow/runner.js +273 -0
- package/dist/core/workflow/runner.js.map +1 -0
- package/dist/core/workflow/session.d.ts +37 -0
- package/dist/core/workflow/session.d.ts.map +1 -0
- package/dist/core/workflow/session.js +93 -0
- package/dist/core/workflow/session.js.map +1 -0
- package/dist/core/workflow/task-queue.d.ts +46 -0
- package/dist/core/workflow/task-queue.d.ts.map +1 -0
- package/dist/core/workflow/task-queue.js +106 -0
- package/dist/core/workflow/task-queue.js.map +1 -0
- package/dist/core/workflow/test-runner.d.ts +25 -0
- package/dist/core/workflow/test-runner.d.ts.map +1 -0
- package/dist/core/workflow/test-runner.js +50 -0
- package/dist/core/workflow/test-runner.js.map +1 -0
- package/dist/core/workflow/token-tracker.d.ts +54 -0
- package/dist/core/workflow/token-tracker.d.ts.map +1 -0
- package/dist/core/workflow/token-tracker.js +98 -0
- package/dist/core/workflow/token-tracker.js.map +1 -0
- package/dist/git/client.d.ts +47 -0
- package/dist/git/client.d.ts.map +1 -0
- package/dist/git/client.js +109 -0
- package/dist/git/client.js.map +1 -0
- package/dist/prompts/library.d.ts +35 -0
- package/dist/prompts/library.d.ts.map +1 -0
- package/dist/prompts/library.js +238 -0
- package/dist/prompts/library.js.map +1 -0
- package/dist/providers/anthropic.d.ts +55 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +237 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/ollama.d.ts +44 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +211 -0
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/registry.d.ts +36 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +91 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/types.d.ts +100 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +12 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +9 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/fs.d.ts +30 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +80 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/logger.d.ts +46 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +87 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validation.d.ts +28 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +38 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aiagentflow contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# aiagentflow
|
|
2
|
+
|
|
3
|
+
A local-first CLI that orchestrates multi-agent AI workflows for software development. Give it a task — it coordinates specialized agents to architect, code, review, test, and ship automatically.
|
|
4
|
+
|
|
5
|
+
**No cloud dependency. Bring your own API keys. Your code stays on your machine.**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/aiagentflow)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://nodejs.org)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## How It Works
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
Task → Architect → Coder → Reviewer → Tester → Fixer → Ship
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Each stage uses a specialized AI agent with tuned prompts and parameters. The loop repeats until quality thresholds pass — like a small AI engineering team running on your machine.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g aiagentflow
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or with pnpm:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pnpm add -g aiagentflow
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 1. Initialize in your project
|
|
41
|
+
cd /path/to/your/project
|
|
42
|
+
aiagentflow init
|
|
43
|
+
|
|
44
|
+
# 2. Run a task
|
|
45
|
+
aiagentflow run "Add a login form with email/password validation"
|
|
46
|
+
|
|
47
|
+
# 3. Or run autonomously (no approval prompts)
|
|
48
|
+
aiagentflow run "Refactor the auth module" --auto
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The `init` wizard walks you through:
|
|
52
|
+
1. Select your LLM providers (Anthropic, Ollama)
|
|
53
|
+
2. Enter API keys
|
|
54
|
+
3. Assign models per agent role
|
|
55
|
+
4. Set workflow preferences
|
|
56
|
+
|
|
57
|
+
Configuration is saved locally in `.aiagentflow/config.json`.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Features
|
|
62
|
+
|
|
63
|
+
- **Multi-agent pipeline** — 6 specialized agents, each with a distinct role
|
|
64
|
+
- **Local-first** — runs entirely on your machine, no code leaves your system
|
|
65
|
+
- **Provider-agnostic** — Anthropic (Claude), Ollama (local models), more coming
|
|
66
|
+
- **Configurable** — tune models, temperature, and iteration limits per agent
|
|
67
|
+
- **Git-native** — auto-creates branches for each task
|
|
68
|
+
- **Human-in-the-loop** — approve or override at any stage, or go full auto
|
|
69
|
+
- **QA policies** — configurable quality gates (max critical issues, test requirements)
|
|
70
|
+
- **Batch mode** — process multiple tasks from a file
|
|
71
|
+
- **Session persistence** — crash recovery with automatic session saving
|
|
72
|
+
- **Token tracking** — monitor LLM usage per agent and per run
|
|
73
|
+
- **Customizable prompts** — edit agent prompts in `.aiagentflow/prompts/`
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## CLI Commands
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---------|-------------|
|
|
81
|
+
| `aiagentflow init` | Interactive setup wizard |
|
|
82
|
+
| `aiagentflow config` | View current configuration |
|
|
83
|
+
| `aiagentflow doctor` | Health check — verify providers and setup |
|
|
84
|
+
| `aiagentflow run <task>` | Run a workflow for a task |
|
|
85
|
+
| `aiagentflow run <task> --auto` | Autonomous mode (no approval prompts) |
|
|
86
|
+
| `aiagentflow run --batch tasks.txt` | Process multiple tasks from a file |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Agent Roles
|
|
91
|
+
|
|
92
|
+
| Agent | Role | What it does |
|
|
93
|
+
|-------|------|-------------|
|
|
94
|
+
| 🧠 Architect | Plan | Analyzes the task and creates an implementation plan |
|
|
95
|
+
| 💻 Coder | Implement | Writes production-ready code based on the plan |
|
|
96
|
+
| 🔍 Reviewer | Review | Reviews code for bugs, security, and quality |
|
|
97
|
+
| 🧪 Tester | Test | Generates tests and runs them |
|
|
98
|
+
| 🐛 Fixer | Fix | Addresses review comments and test failures |
|
|
99
|
+
| ✅ Judge | QA | Final quality gate — pass or fail |
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Supported Providers
|
|
104
|
+
|
|
105
|
+
| Provider | Type | Setup |
|
|
106
|
+
|----------|------|-------|
|
|
107
|
+
| **Anthropic** | Cloud API | Requires `ANTHROPIC_API_KEY` |
|
|
108
|
+
| **Ollama** | Local | Requires [Ollama](https://ollama.com) running locally |
|
|
109
|
+
|
|
110
|
+
More providers (OpenAI, Groq, etc.) can be added by implementing a single adapter file.
|
|
111
|
+
|
|
112
|
+
### Using with Ollama (free, local)
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Install and start Ollama
|
|
116
|
+
ollama serve
|
|
117
|
+
|
|
118
|
+
# Pull a model
|
|
119
|
+
ollama pull llama3.2
|
|
120
|
+
|
|
121
|
+
# Initialize aiagentflow with Ollama
|
|
122
|
+
aiagentflow init
|
|
123
|
+
# → Select "ollama" as provider
|
|
124
|
+
# → Enter model name: llama3.2
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
After `aiagentflow init`, your project has:
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
.aiagentflow/
|
|
135
|
+
├── config.json # Main configuration
|
|
136
|
+
├── prompts/ # Customizable agent prompts
|
|
137
|
+
│ ├── architect.md
|
|
138
|
+
│ ├── coder.md
|
|
139
|
+
│ ├── reviewer.md
|
|
140
|
+
│ ├── tester.md
|
|
141
|
+
│ ├── fixer.md
|
|
142
|
+
│ └── judge.md
|
|
143
|
+
├── policies/ # Quality standards
|
|
144
|
+
│ └── coding-standards.md
|
|
145
|
+
└── sessions/ # Saved workflow sessions
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Edit the prompt files to customize how each agent behaves. Edit `coding-standards.md` to set project-specific rules that all agents follow.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Project Structure
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
src/
|
|
156
|
+
├── cli/ # CLI entry point and commands
|
|
157
|
+
├── core/ # Config system, workflow engine, QA policies
|
|
158
|
+
├── providers/ # LLM provider adapters (Anthropic, Ollama)
|
|
159
|
+
├── agents/ # Agent implementations and prompt library
|
|
160
|
+
├── git/ # Git operations wrapper
|
|
161
|
+
├── prompts/ # Default prompt templates
|
|
162
|
+
└── utils/ # Shared utilities (logger, fs, validation)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Development
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# Clone and install
|
|
171
|
+
git clone https://github.com/aiagentflow/aiagentflow.git
|
|
172
|
+
cd aiagentflow
|
|
173
|
+
pnpm install
|
|
174
|
+
|
|
175
|
+
# Run in dev mode
|
|
176
|
+
pnpm dev run "your task here"
|
|
177
|
+
|
|
178
|
+
# Type check
|
|
179
|
+
pnpm typecheck
|
|
180
|
+
|
|
181
|
+
# Run tests
|
|
182
|
+
pnpm test
|
|
183
|
+
|
|
184
|
+
# Lint & format
|
|
185
|
+
pnpm lint
|
|
186
|
+
pnpm format
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
Contributions are welcome! Here's how to get started:
|
|
194
|
+
|
|
195
|
+
1. **Fork** the repo and clone your fork
|
|
196
|
+
2. **Create a branch** for your feature: `git checkout -b feature/your-feature`
|
|
197
|
+
3. **Follow the coding standards:**
|
|
198
|
+
- Functions: `camelCase`, Classes: `PascalCase`, Files: `kebab-case`
|
|
199
|
+
- All public functions need JSDoc, types, and error handling
|
|
200
|
+
- Use custom `AppError` subclasses — never raw `throw new Error()`
|
|
201
|
+
4. **Check your work:** `pnpm typecheck && pnpm lint && pnpm test`
|
|
202
|
+
5. **Open a PR** against `main` with a description of what and why
|
|
203
|
+
|
|
204
|
+
### Architecture rules
|
|
205
|
+
|
|
206
|
+
- Dependency direction flows downward: `cli → core → utils → types`
|
|
207
|
+
- Config types are inferred from Zod schemas, never manually defined
|
|
208
|
+
- New providers only require one adapter file + registry entry
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Roadmap
|
|
213
|
+
|
|
214
|
+
- [x] Project scaffolding, config system, LLM provider layer
|
|
215
|
+
- [x] Workflow engine, agent implementations, Git integration
|
|
216
|
+
- [x] QA policies, token tracking, session persistence
|
|
217
|
+
- [ ] Context management for large repositories
|
|
218
|
+
- [ ] More providers (OpenAI, Groq, Mistral)
|
|
219
|
+
- [ ] VSCode extension
|
|
220
|
+
- [ ] Desktop GUI
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## License
|
|
225
|
+
|
|
226
|
+
[MIT](LICENSE)
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
<p align="center">
|
|
231
|
+
<a href="https://aiagentflow.dev">aiagentflow.dev</a>
|
|
232
|
+
</p>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent base class — defines the contract and shared behavior for all agents.
|
|
3
|
+
*
|
|
4
|
+
* Each specialized agent (Architect, Coder, Reviewer, etc.) extends this base
|
|
5
|
+
* and implements the `execute()` method with role-specific logic.
|
|
6
|
+
*
|
|
7
|
+
* Dependency direction: agents/base.ts → providers/types, core/errors, utils
|
|
8
|
+
* Used by: all agent implementations
|
|
9
|
+
*/
|
|
10
|
+
import type { LLMProvider, ChatResponse } from '../providers/types.js';
|
|
11
|
+
import type { AgentRole } from './types.js';
|
|
12
|
+
/** Input that an agent receives to do its work. */
|
|
13
|
+
export interface AgentInput {
|
|
14
|
+
/** The task or instruction for the agent. */
|
|
15
|
+
task: string;
|
|
16
|
+
/** Additional context (e.g., code files, review feedback, test results). */
|
|
17
|
+
context?: string;
|
|
18
|
+
/** Previous agent outputs to build upon. */
|
|
19
|
+
previousOutput?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Output that an agent produces after execution. */
|
|
22
|
+
export interface AgentOutput {
|
|
23
|
+
/** The agent's generated content (code, review, spec, etc.). */
|
|
24
|
+
content: string;
|
|
25
|
+
/** Which agent produced this output. */
|
|
26
|
+
role: AgentRole;
|
|
27
|
+
/** Token usage for this agent call. */
|
|
28
|
+
tokensUsed: number;
|
|
29
|
+
/** Whether the agent considers its task done successfully. */
|
|
30
|
+
success: boolean;
|
|
31
|
+
/** Optional metadata from the agent. */
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Base class for all agents.
|
|
36
|
+
*
|
|
37
|
+
* To create a new agent:
|
|
38
|
+
* 1. Extend this class
|
|
39
|
+
* 2. Implement `buildSystemPrompt()` — the agent's role instructions
|
|
40
|
+
* 3. Implement `buildUserPrompt(input)` — formats the task for the LLM
|
|
41
|
+
* 4. Optionally override `parseResponse()` to extract structured data
|
|
42
|
+
*/
|
|
43
|
+
export declare abstract class BaseAgent {
|
|
44
|
+
readonly role: AgentRole;
|
|
45
|
+
protected readonly provider: LLMProvider;
|
|
46
|
+
protected readonly model: string;
|
|
47
|
+
protected readonly temperature: number;
|
|
48
|
+
protected readonly maxTokens: number;
|
|
49
|
+
constructor(role: AgentRole, provider: LLMProvider, options: {
|
|
50
|
+
model: string;
|
|
51
|
+
temperature?: number;
|
|
52
|
+
maxTokens?: number;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Execute this agent's task.
|
|
56
|
+
*
|
|
57
|
+
* @param input - The task description and context
|
|
58
|
+
* @returns The agent's output
|
|
59
|
+
* @throws {ProviderError} if the LLM call fails
|
|
60
|
+
*/
|
|
61
|
+
execute(input: AgentInput): Promise<AgentOutput>;
|
|
62
|
+
/** Build the system prompt that defines this agent's role and behavior. */
|
|
63
|
+
protected abstract buildSystemPrompt(): string;
|
|
64
|
+
/** Build the user prompt from the input task and context. */
|
|
65
|
+
protected abstract buildUserPrompt(input: AgentInput): string;
|
|
66
|
+
/** Parse the LLM response. Override to extract structured data. */
|
|
67
|
+
protected parseResponse(response: ChatResponse): string;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/agents/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,WAAW,EAA4B,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACvB,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,qDAAqD;AACrD,MAAM,WAAW,WAAW;IACxB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,IAAI,EAAE,SAAS,CAAC;IAChB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,OAAO,EAAE,OAAO,CAAC;IACjB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,8BAAsB,SAAS;IAC3B,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;IACzC,SAAS,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACjC,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IACvC,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAGjC,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE;IASxE;;;;;;OAMG;IACG,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,CAAC;IAuCtD,2EAA2E;IAC3E,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,MAAM;IAE9C,6DAA6D;IAC7D,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM;IAE7D,mEAAmE;IACnE,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM;CAG1D"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent base class — defines the contract and shared behavior for all agents.
|
|
3
|
+
*
|
|
4
|
+
* Each specialized agent (Architect, Coder, Reviewer, etc.) extends this base
|
|
5
|
+
* and implements the `execute()` method with role-specific logic.
|
|
6
|
+
*
|
|
7
|
+
* Dependency direction: agents/base.ts → providers/types, core/errors, utils
|
|
8
|
+
* Used by: all agent implementations
|
|
9
|
+
*/
|
|
10
|
+
import { ProviderError } from '../core/errors.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
|
+
import { AGENT_ROLE_LABELS } from './types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Base class for all agents.
|
|
15
|
+
*
|
|
16
|
+
* To create a new agent:
|
|
17
|
+
* 1. Extend this class
|
|
18
|
+
* 2. Implement `buildSystemPrompt()` — the agent's role instructions
|
|
19
|
+
* 3. Implement `buildUserPrompt(input)` — formats the task for the LLM
|
|
20
|
+
* 4. Optionally override `parseResponse()` to extract structured data
|
|
21
|
+
*/
|
|
22
|
+
export class BaseAgent {
|
|
23
|
+
role;
|
|
24
|
+
provider;
|
|
25
|
+
model;
|
|
26
|
+
temperature;
|
|
27
|
+
maxTokens;
|
|
28
|
+
constructor(role, provider, options) {
|
|
29
|
+
this.role = role;
|
|
30
|
+
this.provider = provider;
|
|
31
|
+
this.model = options.model;
|
|
32
|
+
this.temperature = options.temperature ?? 0.7;
|
|
33
|
+
this.maxTokens = options.maxTokens ?? 4096;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Execute this agent's task.
|
|
37
|
+
*
|
|
38
|
+
* @param input - The task description and context
|
|
39
|
+
* @returns The agent's output
|
|
40
|
+
* @throws {ProviderError} if the LLM call fails
|
|
41
|
+
*/
|
|
42
|
+
async execute(input) {
|
|
43
|
+
const label = AGENT_ROLE_LABELS[this.role];
|
|
44
|
+
logger.info(`${label} starting...`);
|
|
45
|
+
const systemPrompt = this.buildSystemPrompt();
|
|
46
|
+
const userPrompt = this.buildUserPrompt(input);
|
|
47
|
+
const messages = [
|
|
48
|
+
{ role: 'user', content: userPrompt },
|
|
49
|
+
];
|
|
50
|
+
const options = {
|
|
51
|
+
model: this.model,
|
|
52
|
+
temperature: this.temperature,
|
|
53
|
+
maxTokens: this.maxTokens,
|
|
54
|
+
systemPrompt,
|
|
55
|
+
};
|
|
56
|
+
try {
|
|
57
|
+
const response = await this.provider.chat(messages, options);
|
|
58
|
+
const content = this.parseResponse(response);
|
|
59
|
+
logger.success(`${label} complete (${response.usage.totalTokens} tokens)`);
|
|
60
|
+
return {
|
|
61
|
+
content,
|
|
62
|
+
role: this.role,
|
|
63
|
+
tokensUsed: response.usage.totalTokens,
|
|
64
|
+
success: true,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
if (err instanceof ProviderError)
|
|
69
|
+
throw err;
|
|
70
|
+
throw new ProviderError(`${label} failed: ${err instanceof Error ? err.message : String(err)}`, { role: this.role, model: this.model });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/** Parse the LLM response. Override to extract structured data. */
|
|
74
|
+
parseResponse(response) {
|
|
75
|
+
return response.content;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/agents/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AA0B/C;;;;;;;;GAQG;AACH,MAAM,OAAgB,SAAS;IACX,IAAI,CAAY;IACb,QAAQ,CAAc;IACtB,KAAK,CAAS;IACd,WAAW,CAAS;IACpB,SAAS,CAAS;IAErC,YACI,IAAe,EACf,QAAqB,EACrB,OAAoE;QAEpE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,GAAG,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,OAAO,CAAC,KAAiB;QAC3B,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,cAAc,CAAC,CAAC;QAEpC,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAkB;YAC5B,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE;SACxC,CAAC;QAEF,MAAM,OAAO,GAAgB;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,YAAY;SACf,CAAC;QAEF,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC7D,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAE7C,MAAM,CAAC,OAAO,CAAC,GAAG,KAAK,cAAc,QAAQ,CAAC,KAAK,CAAC,WAAW,UAAU,CAAC,CAAC;YAE3E,OAAO;gBACH,OAAO;gBACP,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,WAAW;gBACtC,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,YAAY,aAAa;gBAAE,MAAM,GAAG,CAAC;YAC5C,MAAM,IAAI,aAAa,CACnB,GAAG,KAAK,YAAY,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EACtE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CACzC,CAAC;QACN,CAAC;IACL,CAAC;IAQD,mEAAmE;IACzD,aAAa,CAAC,QAAsB;QAC1C,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC5B,CAAC;CACJ"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent factory — creates agent instances from config.
|
|
3
|
+
*
|
|
4
|
+
* Wires together the provider registry + agent config + prompt library
|
|
5
|
+
* to produce ready-to-use agent instances.
|
|
6
|
+
*
|
|
7
|
+
* Dependency direction: factory.ts → agents/roles/*, providers/registry
|
|
8
|
+
* Used by: workflow runner
|
|
9
|
+
*/
|
|
10
|
+
import type { AgentRole } from './types.js';
|
|
11
|
+
import type { BaseAgent } from './base.js';
|
|
12
|
+
import type { AppConfig } from '../core/config/types.js';
|
|
13
|
+
/**
|
|
14
|
+
* Create an agent instance for the specified role using the app config.
|
|
15
|
+
*
|
|
16
|
+
* @param role - Which agent to create
|
|
17
|
+
* @param config - Full application config
|
|
18
|
+
* @param projectRoot - Project root directory for prompt loading
|
|
19
|
+
*/
|
|
20
|
+
export declare function createAgent(role: AgentRole, config: AppConfig, projectRoot: string): BaseAgent;
|
|
21
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/agents/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAUzD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACvB,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,SAAS,EACjB,WAAW,EAAE,MAAM,GACpB,SAAS,CA0BX"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent factory — creates agent instances from config.
|
|
3
|
+
*
|
|
4
|
+
* Wires together the provider registry + agent config + prompt library
|
|
5
|
+
* to produce ready-to-use agent instances.
|
|
6
|
+
*
|
|
7
|
+
* Dependency direction: factory.ts → agents/roles/*, providers/registry
|
|
8
|
+
* Used by: workflow runner
|
|
9
|
+
*/
|
|
10
|
+
import { createProvider } from '../providers/registry.js';
|
|
11
|
+
import { ArchitectAgent } from './roles/architect.js';
|
|
12
|
+
import { CoderAgent } from './roles/coder.js';
|
|
13
|
+
import { ReviewerAgent } from './roles/reviewer.js';
|
|
14
|
+
import { TesterAgent } from './roles/tester.js';
|
|
15
|
+
import { FixerAgent } from './roles/fixer.js';
|
|
16
|
+
import { JudgeAgent } from './roles/judge.js';
|
|
17
|
+
import { WorkflowError } from '../core/errors.js';
|
|
18
|
+
/**
|
|
19
|
+
* Create an agent instance for the specified role using the app config.
|
|
20
|
+
*
|
|
21
|
+
* @param role - Which agent to create
|
|
22
|
+
* @param config - Full application config
|
|
23
|
+
* @param projectRoot - Project root directory for prompt loading
|
|
24
|
+
*/
|
|
25
|
+
export function createAgent(role, config, projectRoot) {
|
|
26
|
+
const agentConfig = config.agents[role];
|
|
27
|
+
const provider = createProvider(agentConfig.provider, config.providers);
|
|
28
|
+
const options = {
|
|
29
|
+
model: agentConfig.model,
|
|
30
|
+
temperature: agentConfig.temperature,
|
|
31
|
+
maxTokens: agentConfig.maxTokens,
|
|
32
|
+
};
|
|
33
|
+
switch (role) {
|
|
34
|
+
case 'architect':
|
|
35
|
+
return new ArchitectAgent(provider, options, projectRoot);
|
|
36
|
+
case 'coder':
|
|
37
|
+
return new CoderAgent(provider, options, projectRoot);
|
|
38
|
+
case 'reviewer':
|
|
39
|
+
return new ReviewerAgent(provider, options, projectRoot);
|
|
40
|
+
case 'tester':
|
|
41
|
+
return new TesterAgent(provider, options, projectRoot);
|
|
42
|
+
case 'fixer':
|
|
43
|
+
return new FixerAgent(provider, options, projectRoot);
|
|
44
|
+
case 'judge':
|
|
45
|
+
return new JudgeAgent(provider, options, projectRoot);
|
|
46
|
+
default:
|
|
47
|
+
throw new WorkflowError(`Unknown agent role: ${role}`, { role });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../src/agents/factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACvB,IAAe,EACf,MAAiB,EACjB,WAAmB;IAEnB,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,QAAQ,GAAG,cAAc,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAExE,MAAM,OAAO,GAAG;QACZ,KAAK,EAAE,WAAW,CAAC,KAAK;QACxB,WAAW,EAAE,WAAW,CAAC,WAAW;QACpC,SAAS,EAAE,WAAW,CAAC,SAAS;KACnC,CAAC;IAEF,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,WAAW;YACZ,OAAO,IAAI,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC9D,KAAK,OAAO;YACR,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,KAAK,UAAU;YACX,OAAO,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC7D,KAAK,QAAQ;YACT,OAAO,IAAI,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC3D,KAAK,OAAO;YACR,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D,KAAK,OAAO;YACR,OAAO,IAAI,UAAU,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1D;YACI,MAAM,IAAI,aAAa,CAAC,uBAAuB,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architect agent — analyzes a task and creates an implementation plan.
|
|
3
|
+
*
|
|
4
|
+
* This is the first agent in the pipeline. It reads the task description,
|
|
5
|
+
* understands the project context, and outputs a structured plan that the
|
|
6
|
+
* Coder agent will follow.
|
|
7
|
+
*
|
|
8
|
+
* Dependency direction: architect.ts → agents/base, prompts/library
|
|
9
|
+
* Used by: workflow runner
|
|
10
|
+
*/
|
|
11
|
+
import { BaseAgent, type AgentInput } from '../base.js';
|
|
12
|
+
import type { LLMProvider } from '../../providers/types.js';
|
|
13
|
+
export declare class ArchitectAgent extends BaseAgent {
|
|
14
|
+
private readonly projectRoot;
|
|
15
|
+
constructor(provider: LLMProvider, options: {
|
|
16
|
+
model: string;
|
|
17
|
+
temperature?: number;
|
|
18
|
+
maxTokens?: number;
|
|
19
|
+
}, projectRoot: string);
|
|
20
|
+
protected buildSystemPrompt(): string;
|
|
21
|
+
protected buildUserPrompt(input: AgentInput): string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=architect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect.d.ts","sourceRoot":"","sources":["../../../src/agents/roles/architect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qBAAa,cAAe,SAAQ,SAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAGjC,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EACpE,WAAW,EAAE,MAAM;IAMvB,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAWrC,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM;CAavD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architect agent — analyzes a task and creates an implementation plan.
|
|
3
|
+
*
|
|
4
|
+
* This is the first agent in the pipeline. It reads the task description,
|
|
5
|
+
* understands the project context, and outputs a structured plan that the
|
|
6
|
+
* Coder agent will follow.
|
|
7
|
+
*
|
|
8
|
+
* Dependency direction: architect.ts → agents/base, prompts/library
|
|
9
|
+
* Used by: workflow runner
|
|
10
|
+
*/
|
|
11
|
+
import { BaseAgent } from '../base.js';
|
|
12
|
+
import { loadAgentPrompt, loadCodingStandards } from '../../prompts/library.js';
|
|
13
|
+
export class ArchitectAgent extends BaseAgent {
|
|
14
|
+
projectRoot;
|
|
15
|
+
constructor(provider, options, projectRoot) {
|
|
16
|
+
super('architect', provider, { ...options, temperature: options.temperature ?? 0.8 });
|
|
17
|
+
this.projectRoot = projectRoot;
|
|
18
|
+
}
|
|
19
|
+
buildSystemPrompt() {
|
|
20
|
+
const rolePrompt = loadAgentPrompt(this.projectRoot, 'architect');
|
|
21
|
+
const standards = loadCodingStandards(this.projectRoot);
|
|
22
|
+
let prompt = rolePrompt;
|
|
23
|
+
if (standards) {
|
|
24
|
+
prompt += `\n\n## Project Coding Standards\n\n${standards}`;
|
|
25
|
+
}
|
|
26
|
+
return prompt;
|
|
27
|
+
}
|
|
28
|
+
buildUserPrompt(input) {
|
|
29
|
+
let prompt = `## Task\n\n${input.task}\n`;
|
|
30
|
+
if (input.context) {
|
|
31
|
+
prompt += `\n## Project Context\n\n${input.context}\n`;
|
|
32
|
+
}
|
|
33
|
+
if (input.previousOutput) {
|
|
34
|
+
prompt += `\n## Previous Feedback\n\n${input.previousOutput}\n`;
|
|
35
|
+
}
|
|
36
|
+
return prompt;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=architect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architect.js","sourceRoot":"","sources":["../../../src/agents/roles/architect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGhF,MAAM,OAAO,cAAe,SAAQ,SAAS;IACxB,WAAW,CAAS;IAErC,YACI,QAAqB,EACrB,OAAoE,EACpE,WAAmB;QAEnB,KAAK,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG,EAAE,CAAC,CAAC;QACtF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAES,iBAAiB;QACvB,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;QAClE,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExD,IAAI,MAAM,GAAG,UAAU,CAAC;QACxB,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,IAAI,sCAAsC,SAAS,EAAE,CAAC;QAChE,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAES,eAAe,CAAC,KAAiB;QACvC,IAAI,MAAM,GAAG,cAAc,KAAK,CAAC,IAAI,IAAI,CAAC;QAE1C,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,MAAM,IAAI,2BAA2B,KAAK,CAAC,OAAO,IAAI,CAAC;QAC3D,CAAC;QAED,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,IAAI,6BAA6B,KAAK,CAAC,cAAc,IAAI,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coder agent — implements code based on the architect's plan.
|
|
3
|
+
*
|
|
4
|
+
* Dependency direction: coder.ts → agents/base, prompts/library
|
|
5
|
+
* Used by: workflow runner
|
|
6
|
+
*/
|
|
7
|
+
import { BaseAgent, type AgentInput } from '../base.js';
|
|
8
|
+
import type { LLMProvider } from '../../providers/types.js';
|
|
9
|
+
export declare class CoderAgent extends BaseAgent {
|
|
10
|
+
private readonly projectRoot;
|
|
11
|
+
constructor(provider: LLMProvider, options: {
|
|
12
|
+
model: string;
|
|
13
|
+
temperature?: number;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
}, projectRoot: string);
|
|
16
|
+
protected buildSystemPrompt(): string;
|
|
17
|
+
protected buildUserPrompt(input: AgentInput): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=coder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coder.d.ts","sourceRoot":"","sources":["../../../src/agents/roles/coder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qBAAa,UAAW,SAAQ,SAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAGjC,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EACpE,WAAW,EAAE,MAAM;IAOvB,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAWrC,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM;CAgBvD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coder agent — implements code based on the architect's plan.
|
|
3
|
+
*
|
|
4
|
+
* Dependency direction: coder.ts → agents/base, prompts/library
|
|
5
|
+
* Used by: workflow runner
|
|
6
|
+
*/
|
|
7
|
+
import { BaseAgent } from '../base.js';
|
|
8
|
+
import { loadAgentPrompt, loadCodingStandards } from '../../prompts/library.js';
|
|
9
|
+
export class CoderAgent extends BaseAgent {
|
|
10
|
+
projectRoot;
|
|
11
|
+
constructor(provider, options, projectRoot) {
|
|
12
|
+
// Lower temperature for deterministic code generation
|
|
13
|
+
super('coder', provider, { ...options, temperature: options.temperature ?? 0.3 });
|
|
14
|
+
this.projectRoot = projectRoot;
|
|
15
|
+
}
|
|
16
|
+
buildSystemPrompt() {
|
|
17
|
+
const rolePrompt = loadAgentPrompt(this.projectRoot, 'coder');
|
|
18
|
+
const standards = loadCodingStandards(this.projectRoot);
|
|
19
|
+
let prompt = rolePrompt;
|
|
20
|
+
if (standards) {
|
|
21
|
+
prompt += `\n\n## Project Coding Standards\n\n${standards}`;
|
|
22
|
+
}
|
|
23
|
+
return prompt;
|
|
24
|
+
}
|
|
25
|
+
buildUserPrompt(input) {
|
|
26
|
+
let prompt = '';
|
|
27
|
+
// The architect's plan is the primary input
|
|
28
|
+
if (input.previousOutput) {
|
|
29
|
+
prompt += `## Implementation Plan\n\n${input.previousOutput}\n\n`;
|
|
30
|
+
}
|
|
31
|
+
prompt += `## Task\n\n${input.task}\n`;
|
|
32
|
+
if (input.context) {
|
|
33
|
+
prompt += `\n## Existing Code Context\n\n${input.context}\n`;
|
|
34
|
+
}
|
|
35
|
+
return prompt;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=coder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coder.js","sourceRoot":"","sources":["../../../src/agents/roles/coder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGhF,MAAM,OAAO,UAAW,SAAQ,SAAS;IACpB,WAAW,CAAS;IAErC,YACI,QAAqB,EACrB,OAAoE,EACpE,WAAmB;QAEnB,sDAAsD;QACtD,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,GAAG,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,GAAG,EAAE,CAAC,CAAC;QAClF,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAES,iBAAiB;QACvB,MAAM,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QAC9D,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExD,IAAI,MAAM,GAAG,UAAU,CAAC;QACxB,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,IAAI,sCAAsC,SAAS,EAAE,CAAC;QAChE,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAES,eAAe,CAAC,KAAiB;QACvC,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,4CAA4C;QAC5C,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,MAAM,IAAI,6BAA6B,KAAK,CAAC,cAAc,MAAM,CAAC;QACtE,CAAC;QAED,MAAM,IAAI,cAAc,KAAK,CAAC,IAAI,IAAI,CAAC;QAEvC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;YAChB,MAAM,IAAI,iCAAiC,KAAK,CAAC,OAAO,IAAI,CAAC;QACjE,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixer agent — fixes bugs found by reviewers and test failures.
|
|
3
|
+
*
|
|
4
|
+
* Dependency direction: fixer.ts → agents/base, prompts/library
|
|
5
|
+
* Used by: workflow runner
|
|
6
|
+
*/
|
|
7
|
+
import { BaseAgent, type AgentInput } from '../base.js';
|
|
8
|
+
import type { LLMProvider } from '../../providers/types.js';
|
|
9
|
+
export declare class FixerAgent extends BaseAgent {
|
|
10
|
+
private readonly projectRoot;
|
|
11
|
+
constructor(provider: LLMProvider, options: {
|
|
12
|
+
model: string;
|
|
13
|
+
temperature?: number;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
}, projectRoot: string);
|
|
16
|
+
protected buildSystemPrompt(): string;
|
|
17
|
+
protected buildUserPrompt(input: AgentInput): string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=fixer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixer.d.ts","sourceRoot":"","sources":["../../../src/agents/roles/fixer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,qBAAa,UAAW,SAAQ,SAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;gBAGjC,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EACpE,WAAW,EAAE,MAAM;IAMvB,SAAS,CAAC,iBAAiB,IAAI,MAAM;IAIrC,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM;CAavD"}
|