all-agents-mcp 1.0.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/README.md +262 -0
- package/dist/agents/base-agent.d.ts +18 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +82 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/claude-agent.d.ts +11 -0
- package/dist/agents/claude-agent.d.ts.map +1 -0
- package/dist/agents/claude-agent.js +34 -0
- package/dist/agents/claude-agent.js.map +1 -0
- package/dist/agents/codex-agent.d.ts +13 -0
- package/dist/agents/codex-agent.d.ts.map +1 -0
- package/dist/agents/codex-agent.js +89 -0
- package/dist/agents/codex-agent.js.map +1 -0
- package/dist/agents/copilot-agent.d.ts +12 -0
- package/dist/agents/copilot-agent.d.ts.map +1 -0
- package/dist/agents/copilot-agent.js +31 -0
- package/dist/agents/copilot-agent.js.map +1 -0
- package/dist/agents/gemini-agent.d.ts +11 -0
- package/dist/agents/gemini-agent.d.ts.map +1 -0
- package/dist/agents/gemini-agent.js +40 -0
- package/dist/agents/gemini-agent.js.map +1 -0
- package/dist/agents/registry.d.ts +7 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +55 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/types.d.ts +42 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/config/loader.d.ts +16 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +97 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +33 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +12 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator/aggregator.d.ts +7 -0
- package/dist/orchestrator/aggregator.d.ts.map +1 -0
- package/dist/orchestrator/aggregator.js +59 -0
- package/dist/orchestrator/aggregator.js.map +1 -0
- package/dist/orchestrator/complexity.d.ts +8 -0
- package/dist/orchestrator/complexity.d.ts.map +1 -0
- package/dist/orchestrator/complexity.js +87 -0
- package/dist/orchestrator/complexity.js.map +1 -0
- package/dist/orchestrator/executor.d.ts +17 -0
- package/dist/orchestrator/executor.d.ts.map +1 -0
- package/dist/orchestrator/executor.js +53 -0
- package/dist/orchestrator/executor.js.map +1 -0
- package/dist/orchestrator/parallel.d.ts +11 -0
- package/dist/orchestrator/parallel.d.ts.map +1 -0
- package/dist/orchestrator/parallel.js +30 -0
- package/dist/orchestrator/parallel.js.map +1 -0
- package/dist/orchestrator/verifier.d.ts +16 -0
- package/dist/orchestrator/verifier.d.ts.map +1 -0
- package/dist/orchestrator/verifier.js +42 -0
- package/dist/orchestrator/verifier.js.map +1 -0
- package/dist/resources/agent-status.d.ts +3 -0
- package/dist/resources/agent-status.d.ts.map +1 -0
- package/dist/resources/agent-status.js +23 -0
- package/dist/resources/agent-status.js.map +1 -0
- package/dist/resources/session-history.d.ts +3 -0
- package/dist/resources/session-history.d.ts.map +1 -0
- package/dist/resources/session-history.js +29 -0
- package/dist/resources/session-history.js.map +1 -0
- package/dist/resources/sessions-list.d.ts +3 -0
- package/dist/resources/sessions-list.d.ts.map +1 -0
- package/dist/resources/sessions-list.js +13 -0
- package/dist/resources/sessions-list.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +45 -0
- package/dist/server.js.map +1 -0
- package/dist/session/store.d.ts +11 -0
- package/dist/session/store.d.ts.map +1 -0
- package/dist/session/store.js +72 -0
- package/dist/session/store.js.map +1 -0
- package/dist/session/types.d.ts +19 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +2 -0
- package/dist/session/types.js.map +1 -0
- package/dist/tools/agent-health.d.ts +3 -0
- package/dist/tools/agent-health.d.ts.map +1 -0
- package/dist/tools/agent-health.js +40 -0
- package/dist/tools/agent-health.js.map +1 -0
- package/dist/tools/ask-agent.d.ts +3 -0
- package/dist/tools/ask-agent.d.ts.map +1 -0
- package/dist/tools/ask-agent.js +63 -0
- package/dist/tools/ask-agent.js.map +1 -0
- package/dist/tools/ask-all.d.ts +3 -0
- package/dist/tools/ask-all.d.ts.map +1 -0
- package/dist/tools/ask-all.js +54 -0
- package/dist/tools/ask-all.js.map +1 -0
- package/dist/tools/collaborate.d.ts +3 -0
- package/dist/tools/collaborate.d.ts.map +1 -0
- package/dist/tools/collaborate.js +56 -0
- package/dist/tools/collaborate.js.map +1 -0
- package/dist/tools/debug-with.d.ts +3 -0
- package/dist/tools/debug-with.d.ts.map +1 -0
- package/dist/tools/debug-with.js +51 -0
- package/dist/tools/debug-with.js.map +1 -0
- package/dist/tools/delegate.d.ts +3 -0
- package/dist/tools/delegate.d.ts.map +1 -0
- package/dist/tools/delegate.js +87 -0
- package/dist/tools/delegate.js.map +1 -0
- package/dist/tools/explain-with.d.ts +3 -0
- package/dist/tools/explain-with.d.ts.map +1 -0
- package/dist/tools/explain-with.js +53 -0
- package/dist/tools/explain-with.js.map +1 -0
- package/dist/tools/generate-test.d.ts +3 -0
- package/dist/tools/generate-test.d.ts.map +1 -0
- package/dist/tools/generate-test.js +64 -0
- package/dist/tools/generate-test.js.map +1 -0
- package/dist/tools/list-agents.d.ts +3 -0
- package/dist/tools/list-agents.d.ts.map +1 -0
- package/dist/tools/list-agents.js +28 -0
- package/dist/tools/list-agents.js.map +1 -0
- package/dist/tools/list-models.d.ts +3 -0
- package/dist/tools/list-models.d.ts.map +1 -0
- package/dist/tools/list-models.js +43 -0
- package/dist/tools/list-models.js.map +1 -0
- package/dist/tools/refactor-with.d.ts +3 -0
- package/dist/tools/refactor-with.d.ts.map +1 -0
- package/dist/tools/refactor-with.js +62 -0
- package/dist/tools/refactor-with.js.map +1 -0
- package/dist/tools/review-code.d.ts +3 -0
- package/dist/tools/review-code.d.ts.map +1 -0
- package/dist/tools/review-code.js +67 -0
- package/dist/tools/review-code.js.map +1 -0
- package/dist/tools/verify.d.ts +3 -0
- package/dist/tools/verify.d.ts.map +1 -0
- package/dist/tools/verify.js +63 -0
- package/dist/tools/verify.js.map +1 -0
- package/dist/utils/detect.d.ts +4 -0
- package/dist/utils/detect.d.ts.map +1 -0
- package/dist/utils/detect.js +44 -0
- package/dist/utils/detect.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +24 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="etc/all-agents-mcp.png" alt="All Agents MCP" width="600" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
# All-Agents-MCP
|
|
6
|
+
|
|
7
|
+
An MCP server that orchestrates multiple AI CLI agents — Claude Code, Codex, Gemini CLI, and Copilot CLI — through a unified interface. Delegate tasks, run cross-agent comparisons, and leverage each agent's strengths from any MCP-compatible host.
|
|
8
|
+
|
|
9
|
+
## Why MCP?
|
|
10
|
+
|
|
11
|
+
Multi-agent orchestration can also be achieved by configuring CLI integrations directly in `~/.claude/CLAUDE.md`. For example, you can add Codex integration like this:
|
|
12
|
+
|
|
13
|
+
```markdown
|
|
14
|
+
## Codex CLI Integration
|
|
15
|
+
When the user asks to "consult with Codex" or similar:
|
|
16
|
+
1. Store the requirement in the $PROMPT environment variable
|
|
17
|
+
2. Run `codex --model gpt-5.3-codex-spark xhigh exec "$PROMPT"`
|
|
18
|
+
3. Show the Codex response and add your own commentary
|
|
19
|
+
4. Compare results and select the optimal solution
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Similar patterns can be applied for Gemini CLI, Copilot CLI, and others. This works well for individual use.
|
|
23
|
+
|
|
24
|
+
However, this project was intentionally built as a standalone **MCP server** for the following reason:
|
|
25
|
+
|
|
26
|
+
In **enterprise environments**, teams often share a common `CLAUDE.md` managed at the organization or repository level. Embedding agent orchestration logic into `CLAUDE.md` would conflict with or pollute these shared configurations. By encapsulating the orchestration as an **MCP server**, the multi-agent capability becomes a modular, pluggable extension — completely independent of any existing `CLAUDE.md` setup. This allows teams to adopt cross-agent workflows without modifying their shared development guidelines.
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- **Single-agent queries** — Ask a specific agent with `ask_agent`
|
|
31
|
+
- **Multi-agent comparison** — Run the same prompt across all agents in parallel with `ask_all`
|
|
32
|
+
- **Task delegation** — Auto-analyze complexity and route to one or multiple agents
|
|
33
|
+
- **Cross-model verification** — Verify answers by running one agent with different models
|
|
34
|
+
- **Specialized tools** — Code review, debugging, explanation, test generation, refactoring
|
|
35
|
+
- **Recursive call prevention** — Automatically excludes the calling agent to avoid infinite loops
|
|
36
|
+
- **Session history** — All interactions are recorded and queryable via MCP resources
|
|
37
|
+
- **Environment-based model config** — Override models at runtime via `AA_MCP_*` environment variables
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
|
|
41
|
+
- **Node.js 22+**
|
|
42
|
+
- At least one of the following CLI agents installed and authenticated:
|
|
43
|
+
|
|
44
|
+
| Agent | Install | Auth |
|
|
45
|
+
|-------|---------|------|
|
|
46
|
+
| [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | `npm i -g @anthropic-ai/claude-code` | `claude` (follow prompts) |
|
|
47
|
+
| [Codex](https://github.com/openai/codex) | `npm i -g @openai/codex` | `codex login` |
|
|
48
|
+
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `npm i -g @anthropic-ai/gemini-cli` | `gemini` (follow prompts) |
|
|
49
|
+
| [Copilot CLI](https://githubnext.com/projects/copilot-cli) | `npm i -g @githubnext/github-copilot-cli` | `copilot` (follow prompts) |
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
### Via npm (recommended)
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
claude mcp add all-agents-mcp -- npx -y all-agents-mcp
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### From source
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/mingyuShim94/all-agents-mcp.git
|
|
63
|
+
cd all-agents-mcp
|
|
64
|
+
npm install
|
|
65
|
+
npm run build
|
|
66
|
+
claude mcp add all-agents-mcp -- node /path/to/all-agents-mcp/dist/index.js
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Manual MCP configuration
|
|
70
|
+
|
|
71
|
+
Add to your Claude Code MCP settings (`~/.claude.json`):
|
|
72
|
+
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"all-agents-mcp": {
|
|
77
|
+
"command": "npx",
|
|
78
|
+
"args": ["-y", "all-agents-mcp"]
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Tools (13)
|
|
85
|
+
|
|
86
|
+
### Core Tools
|
|
87
|
+
|
|
88
|
+
| Tool | Description |
|
|
89
|
+
|------|-------------|
|
|
90
|
+
| `ask_agent` | Ask a specific agent a question. Specify which agent and optionally which model. |
|
|
91
|
+
| `ask_all` | Ask all available agents the same question in parallel. Returns a comparison. |
|
|
92
|
+
| `delegate_task` | Delegate a task with automatic complexity analysis. Simple tasks go to one agent; large tasks are split across multiple agents. |
|
|
93
|
+
| `collaborate` | Collaborate with an agent — get its response alongside guidance for synthesizing both perspectives. |
|
|
94
|
+
|
|
95
|
+
### Verification
|
|
96
|
+
|
|
97
|
+
| Tool | Description |
|
|
98
|
+
|------|-------------|
|
|
99
|
+
| `verify` | Cross-verify by running the same prompt across multiple models of one agent (e.g., Copilot with GPT, Claude, and Gemini models). |
|
|
100
|
+
|
|
101
|
+
### Specialized Tools
|
|
102
|
+
|
|
103
|
+
| Tool | Description |
|
|
104
|
+
|------|-------------|
|
|
105
|
+
| `review_code` | Code review with focus options: `bugs`, `security`, `performance`, `clarity`. |
|
|
106
|
+
| `debug_with` | Debug an error — provide the error message and optional code context. |
|
|
107
|
+
| `explain_with` | Get code explanation at `brief` or `detailed` level. |
|
|
108
|
+
| `generate_test` | Generate tests with optional framework selection (`jest`, `vitest`, `pytest`, `kotest`). |
|
|
109
|
+
| `refactor_with` | Refactor code with a goal: `performance`, `readability`, or `modularity`. |
|
|
110
|
+
|
|
111
|
+
### Info Tools
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `list_agents` | List all detected agents and their availability status. |
|
|
116
|
+
| `list_models` | List available models per agent. |
|
|
117
|
+
| `agent_health` | Health check — availability, authentication status, latency. |
|
|
118
|
+
|
|
119
|
+
## Resources (3)
|
|
120
|
+
|
|
121
|
+
| URI | Description |
|
|
122
|
+
|-----|-------------|
|
|
123
|
+
| `aa://sessions` | List of all recorded sessions |
|
|
124
|
+
| `aa://session/{id}/history` | Full interaction history for a session |
|
|
125
|
+
| `aa://agents/status` | Current status of all agents |
|
|
126
|
+
|
|
127
|
+
## Usage Examples
|
|
128
|
+
|
|
129
|
+
Once registered, use natural language in Claude Code:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
# Ask a specific agent
|
|
133
|
+
"Ask Codex to implement a binary search function"
|
|
134
|
+
|
|
135
|
+
# Compare across agents
|
|
136
|
+
"Ask all agents how to optimize this SQL query"
|
|
137
|
+
|
|
138
|
+
# Delegate a task
|
|
139
|
+
"Delegate writing unit tests for src/utils/ to Gemini"
|
|
140
|
+
|
|
141
|
+
# Collaborate
|
|
142
|
+
"Collaborate with Copilot to review this architecture"
|
|
143
|
+
|
|
144
|
+
# Cross-model verification
|
|
145
|
+
"Verify with Copilot using gpt-5.2-codex, claude-sonnet-4.5, and gemini-3-pro-preview"
|
|
146
|
+
|
|
147
|
+
# Code review
|
|
148
|
+
"Ask Codex to review this code for security vulnerabilities"
|
|
149
|
+
|
|
150
|
+
# Debug
|
|
151
|
+
"Debug this TypeError with Gemini"
|
|
152
|
+
|
|
153
|
+
# Generate tests
|
|
154
|
+
"Generate vitest tests for this function using Codex"
|
|
155
|
+
|
|
156
|
+
# Check status
|
|
157
|
+
"Show me all available agents and their health"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Model Configuration
|
|
161
|
+
|
|
162
|
+
Models are configured via environment variables with the `AA_MCP_` prefix. Set them in your MCP client config to override defaults at runtime:
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"all-agents-mcp": {
|
|
168
|
+
"command": "npx",
|
|
169
|
+
"args": ["-y", "all-agents-mcp"],
|
|
170
|
+
"env": {
|
|
171
|
+
"AA_MCP_CLAUDE_DEFAULT": "claude-sonnet-4.5",
|
|
172
|
+
"AA_MCP_CODEX_ANALYSIS_LEVEL": "medium",
|
|
173
|
+
"AA_MCP_GEMINI_MODELS": "gemini-2.5-pro,gemini-2.5-flash"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Available Environment Variables
|
|
181
|
+
|
|
182
|
+
| Variable | Default | Description |
|
|
183
|
+
|----------|---------|-------------|
|
|
184
|
+
| `AA_MCP_CLAUDE_DEFAULT` | `claude-opus-4.6` | Claude default model |
|
|
185
|
+
| `AA_MCP_CLAUDE_MODELS` | `claude-opus-4.6,claude-sonnet-4.5,claude-haiku-4.5` | Available Claude models (comma-separated) |
|
|
186
|
+
| `AA_MCP_CODEX_DEFAULT` | `gpt-5.3-codex-spark` | Codex default model |
|
|
187
|
+
| `AA_MCP_CODEX_MODELS` | `gpt-5.3-codex-spark,gpt-5.3-codex,gpt-5.2-codex-max,gpt-5.2-codex` | Available Codex models |
|
|
188
|
+
| `AA_MCP_CODEX_ANALYSIS_LEVEL` | `xhigh` | Codex reasoning depth (`low`/`medium`/`high`/`xhigh`) |
|
|
189
|
+
| `AA_MCP_GEMINI_DEFAULT` | `gemini-3-pro-preview` | Gemini default model |
|
|
190
|
+
| `AA_MCP_GEMINI_MODELS` | `gemini-3-pro-preview,gemini-3-flash-preview,gemini-2.5-pro,gemini-2.5-flash` | Available Gemini models |
|
|
191
|
+
| `AA_MCP_COPILOT_DEFAULT` | `claude-sonnet-4.5` | Copilot default model |
|
|
192
|
+
| `AA_MCP_COPILOT_MODELS` | `claude-opus-4.5,claude-sonnet-4.5,claude-haiku-4.5,gpt-5.2-codex,gemini-3-pro-preview,gemini-3-flash-preview` | Available Copilot models |
|
|
193
|
+
|
|
194
|
+
## Recursive Call Prevention
|
|
195
|
+
|
|
196
|
+
When all-agents-mcp runs inside an agent (e.g., Claude Code calls all-agents-mcp), it automatically detects the caller and excludes it from the available agent list. This prevents infinite recursive loops.
|
|
197
|
+
|
|
198
|
+
Detection methods (in priority order):
|
|
199
|
+
1. CLI argument: `--caller=claude`
|
|
200
|
+
2. Environment variables: `CLAUDECODE`, `CODEX_SANDBOX_TYPE`, `GEMINI_CLI`, `COPILOT_CLI`
|
|
201
|
+
3. `process.env._` fallback
|
|
202
|
+
|
|
203
|
+
## Development Methodology
|
|
204
|
+
|
|
205
|
+
This project is built following [AIDE (Agent-Informed Development Engineering) v1.0](./AIDE-REFERENCE.md) — a software development methodology designed for the agentic era. Key principles applied include context budget constraints, locality of behavior, functional core architecture, test-as-specification, and deterministic guardrails.
|
|
206
|
+
|
|
207
|
+
## Test Status
|
|
208
|
+
|
|
209
|
+
All agents have been tested and verified **except Copilot CLI**, which is pending integration testing.
|
|
210
|
+
|
|
211
|
+
| Agent | Status |
|
|
212
|
+
|-------|--------|
|
|
213
|
+
| Claude Code | Tested |
|
|
214
|
+
| Codex | Tested |
|
|
215
|
+
| Gemini CLI | Tested |
|
|
216
|
+
| Copilot CLI | Not yet tested |
|
|
217
|
+
|
|
218
|
+
## Architecture
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
all-agents-mcp/
|
|
222
|
+
├── src/
|
|
223
|
+
│ ├── agents/ # Agent abstraction layer
|
|
224
|
+
│ │ ├── types.ts # IAgent interface, AgentResponse, HealthStatus
|
|
225
|
+
│ │ ├── base-agent.ts# Abstract base with spawn logic
|
|
226
|
+
│ │ ├── claude-agent.ts
|
|
227
|
+
│ │ ├── codex-agent.ts
|
|
228
|
+
│ │ ├── gemini-agent.ts
|
|
229
|
+
│ │ ├── copilot-agent.ts
|
|
230
|
+
│ │ └── registry.ts # Detection, registration, recursion guard
|
|
231
|
+
│ │
|
|
232
|
+
│ ├── tools/ # 13 MCP tool definitions
|
|
233
|
+
│ ├── orchestrator/ # Parallel execution, complexity analysis, verification
|
|
234
|
+
│ ├── session/ # File-based session storage
|
|
235
|
+
│ ├── resources/ # 3 MCP resource definitions
|
|
236
|
+
│ ├── config/ # Env var config loader (AA_MCP_* overrides) + Zod schema
|
|
237
|
+
│ ├── utils/ # Logger (stderr), CLI detection
|
|
238
|
+
│ ├── server.ts # McpServer factory
|
|
239
|
+
│ └── index.ts # Entry point (stdio transport)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Development
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npm install # Install dependencies
|
|
246
|
+
npm run build # Compile TypeScript
|
|
247
|
+
npm run dev # Watch mode
|
|
248
|
+
npm run lint # Biome lint + format
|
|
249
|
+
npm test # Run tests
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### Debug logging
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
AA_MCP_LOG_LEVEL=debug node dist/index.js
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Log levels: `debug`, `info` (default), `warn`, `error`. All logs go to stderr to avoid interfering with MCP stdio transport.
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
MIT
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SpawnOptions } from "../orchestrator/executor.js";
|
|
2
|
+
import type { AgentConfig, AgentId, AgentResponse, ExecutionOptions, HealthStatus, IAgent } from "./types.js";
|
|
3
|
+
export declare abstract class BaseAgent implements IAgent {
|
|
4
|
+
abstract readonly id: AgentId;
|
|
5
|
+
abstract readonly displayName: string;
|
|
6
|
+
abstract readonly cliCommand: string;
|
|
7
|
+
readonly supportsParallelExecution: boolean;
|
|
8
|
+
protected config: AgentConfig;
|
|
9
|
+
constructor(config: AgentConfig);
|
|
10
|
+
isAvailable(): Promise<boolean>;
|
|
11
|
+
getModels(): string[];
|
|
12
|
+
getDefaultModel(): string;
|
|
13
|
+
execute(options: ExecutionOptions): Promise<AgentResponse>;
|
|
14
|
+
healthCheck(): Promise<HealthStatus>;
|
|
15
|
+
protected abstract buildSpawnOptions(options: ExecutionOptions, model: string): SpawnOptions;
|
|
16
|
+
protected parseOutput(stdout: string, _stderr: string): string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=base-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent.d.ts","sourceRoot":"","sources":["../../src/agents/base-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,6BAA6B,CAAC;AAG5E,OAAO,KAAK,EACX,WAAW,EACX,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,MAAM,YAAY,CAAC;AAEpB,8BAAsB,SAAU,YAAW,MAAM;IAChD,QAAQ,CAAC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,yBAAyB,EAAE,OAAO,CAAQ;IAEnD,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC;gBAElB,MAAM,EAAE,WAAW;IAIzB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC,SAAS,IAAI,MAAM,EAAE;IAIrB,eAAe,IAAI,MAAM;IAInB,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IA+B1D,WAAW,IAAI,OAAO,CAAC,YAAY,CAAC;IAqC1C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;IAE5F,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CAG9D"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { spawnAgent } from "../orchestrator/executor.js";
|
|
2
|
+
import { isCliAvailable } from "../utils/detect.js";
|
|
3
|
+
import { logger } from "../utils/logger.js";
|
|
4
|
+
export class BaseAgent {
|
|
5
|
+
supportsParallelExecution = true;
|
|
6
|
+
config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
async isAvailable() {
|
|
11
|
+
return isCliAvailable(this.cliCommand);
|
|
12
|
+
}
|
|
13
|
+
getModels() {
|
|
14
|
+
return this.config.models;
|
|
15
|
+
}
|
|
16
|
+
getDefaultModel() {
|
|
17
|
+
return this.config.default;
|
|
18
|
+
}
|
|
19
|
+
async execute(options) {
|
|
20
|
+
const model = options.model ?? this.getDefaultModel();
|
|
21
|
+
const spawnOptions = this.buildSpawnOptions(options, model);
|
|
22
|
+
logger.info(`Executing ${this.displayName} with model ${model}`);
|
|
23
|
+
const result = await spawnAgent(spawnOptions);
|
|
24
|
+
if (result.timedOut) {
|
|
25
|
+
return {
|
|
26
|
+
agent: this.id,
|
|
27
|
+
model,
|
|
28
|
+
content: "",
|
|
29
|
+
durationMs: result.durationMs,
|
|
30
|
+
exitCode: 124,
|
|
31
|
+
error: `Timed out after ${options.timeout ?? 120000}ms`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
const content = this.parseOutput(result.stdout, result.stderr);
|
|
35
|
+
return {
|
|
36
|
+
agent: this.id,
|
|
37
|
+
model,
|
|
38
|
+
content,
|
|
39
|
+
durationMs: result.durationMs,
|
|
40
|
+
exitCode: result.exitCode,
|
|
41
|
+
error: result.exitCode !== 0 ? result.stderr || `Exit code: ${result.exitCode}` : undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
async healthCheck() {
|
|
45
|
+
const startTime = Date.now();
|
|
46
|
+
const available = await this.isAvailable();
|
|
47
|
+
if (!available) {
|
|
48
|
+
return {
|
|
49
|
+
agent: this.id,
|
|
50
|
+
available: false,
|
|
51
|
+
authenticated: false,
|
|
52
|
+
error: `CLI '${this.cliCommand}' not found`,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const response = await this.execute({
|
|
57
|
+
prompt: "Reply with exactly: OK",
|
|
58
|
+
timeout: 30_000,
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
agent: this.id,
|
|
62
|
+
available: true,
|
|
63
|
+
authenticated: response.exitCode === 0,
|
|
64
|
+
latencyMs: Date.now() - startTime,
|
|
65
|
+
error: response.error,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
return {
|
|
70
|
+
agent: this.id,
|
|
71
|
+
available: true,
|
|
72
|
+
authenticated: false,
|
|
73
|
+
latencyMs: Date.now() - startTime,
|
|
74
|
+
error: err instanceof Error ? err.message : String(err),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
parseOutput(stdout, _stderr) {
|
|
79
|
+
return stdout.trim();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=base-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-agent.js","sourceRoot":"","sources":["../../src/agents/base-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB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AS;gBACjC,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACvD,CAAC;QACH,CAAC;IACF,CAAC;IAIS,WAAW,CAAC,MAAc,EAAE,OAAe;QACpD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SpawnOptions } from "../orchestrator/executor.js";
|
|
2
|
+
import { BaseAgent } from "./base-agent.js";
|
|
3
|
+
import type { AgentId, ExecutionOptions } from "./types.js";
|
|
4
|
+
export declare class ClaudeAgent extends BaseAgent {
|
|
5
|
+
readonly id: AgentId;
|
|
6
|
+
readonly displayName = "Claude Code";
|
|
7
|
+
readonly cliCommand = "claude";
|
|
8
|
+
protected buildSpawnOptions(options: ExecutionOptions, model: string): SpawnOptions;
|
|
9
|
+
protected parseOutput(stdout: string, stderr: string): string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=claude-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-agent.d.ts","sourceRoot":"","sources":["../../src/agents/claude-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAe,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,WAAY,SAAQ,SAAS;IACzC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAY;IAChC,QAAQ,CAAC,WAAW,iBAAiB;IACrC,QAAQ,CAAC,UAAU,YAAY;IAE/B,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;cAgBhE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAUtE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { BaseAgent } from "./base-agent.js";
|
|
2
|
+
export class ClaudeAgent extends BaseAgent {
|
|
3
|
+
id = "claude";
|
|
4
|
+
displayName = "Claude Code";
|
|
5
|
+
cliCommand = "claude";
|
|
6
|
+
buildSpawnOptions(options, model) {
|
|
7
|
+
const args = ["-p", options.prompt, "--output-format", "json", "--model", model];
|
|
8
|
+
return {
|
|
9
|
+
command: this.cliCommand,
|
|
10
|
+
args,
|
|
11
|
+
timeout: options.timeout,
|
|
12
|
+
cwd: options.cwd,
|
|
13
|
+
env: {
|
|
14
|
+
// Prevent recursive MCP calls
|
|
15
|
+
CLAUDECODE: "",
|
|
16
|
+
},
|
|
17
|
+
stdin: options.context,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
parseOutput(stdout, stderr) {
|
|
21
|
+
try {
|
|
22
|
+
const parsed = JSON.parse(stdout);
|
|
23
|
+
if (parsed.result)
|
|
24
|
+
return parsed.result;
|
|
25
|
+
if (typeof parsed === "string")
|
|
26
|
+
return parsed;
|
|
27
|
+
return JSON.stringify(parsed, null, 2);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return stdout.trim() || stderr.trim();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=claude-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-agent.js","sourceRoot":"","sources":["../../src/agents/claude-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,WAAY,SAAQ,SAAS;IAChC,EAAE,GAAY,QAAQ,CAAC;IACvB,WAAW,GAAG,aAAa,CAAC;IAC5B,UAAU,GAAG,QAAQ,CAAC;IAErB,iBAAiB,CAAC,OAAyB,EAAE,KAAa;QACnE,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAEjF,OAAO;YACN,OAAO,EAAE,IAAI,CAAC,UAAU;YACxB,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,GAAG,EAAE;gBACJ,8BAA8B;gBAC9B,UAAU,EAAE,EAAE;aACd;YACD,KAAK,EAAE,OAAO,CAAC,OAAO;SACtB,CAAC;IACH,CAAC;IAEkB,WAAW,CAAC,MAAc,EAAE,MAAc;QAC5D,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAClC,IAAI,MAAM,CAAC,MAAM;gBAAE,OAAO,MAAM,CAAC,MAAM,CAAC;YACxC,IAAI,OAAO,MAAM,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC;YAC9C,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QACvC,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type SpawnOptions } from "../orchestrator/executor.js";
|
|
2
|
+
import { BaseAgent } from "./base-agent.js";
|
|
3
|
+
import type { AgentId, AgentResponse, ExecutionOptions } from "./types.js";
|
|
4
|
+
export declare class CodexAgent extends BaseAgent {
|
|
5
|
+
readonly id: AgentId;
|
|
6
|
+
readonly displayName = "Codex";
|
|
7
|
+
readonly cliCommand = "codex";
|
|
8
|
+
private readOutputContent;
|
|
9
|
+
execute(options: ExecutionOptions): Promise<AgentResponse>;
|
|
10
|
+
protected buildSpawnOptions(options: ExecutionOptions, model: string): SpawnOptions;
|
|
11
|
+
private cleanupFile;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=codex-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-agent.d.ts","sourceRoot":"","sources":["../../src/agents/codex-agent.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAc,MAAM,6BAA6B,CAAC;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAe,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAExF,qBAAa,UAAW,SAAQ,SAAS;IACxC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAW;IAC/B,QAAQ,CAAC,WAAW,WAAW;IAC/B,QAAQ,CAAC,UAAU,WAAW;IAE9B,OAAO,CAAC,iBAAiB;IAYV,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAmDzE,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;IAWnF,OAAO,CAAC,WAAW;CAOnB"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { existsSync, readFileSync, unlinkSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { spawnAgent } from "../orchestrator/executor.js";
|
|
6
|
+
import { logger } from "../utils/logger.js";
|
|
7
|
+
import { BaseAgent } from "./base-agent.js";
|
|
8
|
+
export class CodexAgent extends BaseAgent {
|
|
9
|
+
id = "codex";
|
|
10
|
+
displayName = "Codex";
|
|
11
|
+
cliCommand = "codex";
|
|
12
|
+
readOutputContent(outputFile, fallback) {
|
|
13
|
+
if (!existsSync(outputFile))
|
|
14
|
+
return fallback;
|
|
15
|
+
try {
|
|
16
|
+
const content = readFileSync(outputFile, "utf-8").trim();
|
|
17
|
+
this.cleanupFile(outputFile);
|
|
18
|
+
return content;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
this.cleanupFile(outputFile);
|
|
22
|
+
return fallback;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async execute(options) {
|
|
26
|
+
const model = options.model ?? this.getDefaultModel();
|
|
27
|
+
const outputFile = join(tmpdir(), `codex-output-${randomUUID()}.txt`);
|
|
28
|
+
const analysisLevel = options.analysisLevel ?? this.config.defaultAnalysisLevel ?? "medium";
|
|
29
|
+
const args = [
|
|
30
|
+
"exec",
|
|
31
|
+
"--model",
|
|
32
|
+
model,
|
|
33
|
+
"-c",
|
|
34
|
+
`model_reasoning_effort=${analysisLevel}`,
|
|
35
|
+
"--sandbox",
|
|
36
|
+
"read-only",
|
|
37
|
+
`--output-last-message=${outputFile}`,
|
|
38
|
+
"-",
|
|
39
|
+
];
|
|
40
|
+
logger.info(`Executing Codex with model ${model}, analysis level ${analysisLevel}`);
|
|
41
|
+
const result = await spawnAgent({
|
|
42
|
+
command: this.cliCommand,
|
|
43
|
+
args,
|
|
44
|
+
timeout: options.timeout,
|
|
45
|
+
cwd: options.cwd,
|
|
46
|
+
stdin: options.context ? `${options.context}\n\n${options.prompt}` : options.prompt,
|
|
47
|
+
});
|
|
48
|
+
if (result.timedOut) {
|
|
49
|
+
this.cleanupFile(outputFile);
|
|
50
|
+
return {
|
|
51
|
+
agent: this.id,
|
|
52
|
+
model,
|
|
53
|
+
content: "",
|
|
54
|
+
durationMs: result.durationMs,
|
|
55
|
+
exitCode: 124,
|
|
56
|
+
error: `Timed out after ${options.timeout ?? 120000}ms`,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const content = this.readOutputContent(outputFile, result.stdout.trim());
|
|
60
|
+
return {
|
|
61
|
+
agent: this.id,
|
|
62
|
+
model,
|
|
63
|
+
content,
|
|
64
|
+
durationMs: result.durationMs,
|
|
65
|
+
exitCode: result.exitCode,
|
|
66
|
+
error: result.exitCode !== 0 ? result.stderr || `Exit code: ${result.exitCode}` : undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
buildSpawnOptions(options, model) {
|
|
70
|
+
// Not used directly - execute() is overridden
|
|
71
|
+
return {
|
|
72
|
+
command: this.cliCommand,
|
|
73
|
+
args: ["exec", "-", "--model", model, "--sandbox", "read-only"],
|
|
74
|
+
timeout: options.timeout,
|
|
75
|
+
cwd: options.cwd,
|
|
76
|
+
stdin: options.prompt,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
cleanupFile(path) {
|
|
80
|
+
try {
|
|
81
|
+
if (existsSync(path))
|
|
82
|
+
unlinkSync(path);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// Ignore cleanup errors
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=codex-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-agent.js","sourceRoot":"","sources":["../../src/agents/codex-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAqB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,UAAW,SAAQ,SAAS;IAC/B,EAAE,GAAY,OAAO,CAAC;IACtB,WAAW,GAAG,OAAO,CAAC;IACtB,UAAU,GAAG,OAAO,CAAC;IAEtB,iBAAiB,CAAC,UAAkB,EAAE,QAAgB;QA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C,MAAM,CAAC;YACR,wBAAwB;QACzB,CAAC;IACF,CAAC;CACD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SpawnOptions } from "../orchestrator/executor.js";
|
|
2
|
+
import { BaseAgent } from "./base-agent.js";
|
|
3
|
+
import type { AgentId, ExecutionOptions } from "./types.js";
|
|
4
|
+
export declare class CopilotAgent extends BaseAgent {
|
|
5
|
+
readonly id: AgentId;
|
|
6
|
+
readonly displayName = "Copilot CLI";
|
|
7
|
+
readonly cliCommand = "copilot";
|
|
8
|
+
readonly supportsParallelExecution = false;
|
|
9
|
+
protected buildSpawnOptions(options: ExecutionOptions, model: string): SpawnOptions;
|
|
10
|
+
protected parseOutput(stdout: string, stderr: string): string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=copilot-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-agent.d.ts","sourceRoot":"","sources":["../../src/agents/copilot-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAe,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,YAAa,SAAQ,SAAS;IAC1C,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAa;IACjC,QAAQ,CAAC,WAAW,iBAAiB;IACrC,QAAQ,CAAC,UAAU,aAAa;IAChC,SAAkB,yBAAyB,SAAS;IAEpD,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;cAsBhE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;CAGtE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseAgent } from "./base-agent.js";
|
|
2
|
+
export class CopilotAgent extends BaseAgent {
|
|
3
|
+
id = "copilot";
|
|
4
|
+
displayName = "Copilot CLI";
|
|
5
|
+
cliCommand = "copilot";
|
|
6
|
+
supportsParallelExecution = false;
|
|
7
|
+
buildSpawnOptions(options, model) {
|
|
8
|
+
const args = [
|
|
9
|
+
"--model",
|
|
10
|
+
model,
|
|
11
|
+
"-p",
|
|
12
|
+
options.prompt,
|
|
13
|
+
"--allow-all-tools",
|
|
14
|
+
"--silent",
|
|
15
|
+
"--no-ask-user",
|
|
16
|
+
"--no-custom-instructions",
|
|
17
|
+
"--disable-builtin-mcps",
|
|
18
|
+
];
|
|
19
|
+
return {
|
|
20
|
+
command: this.cliCommand,
|
|
21
|
+
args,
|
|
22
|
+
timeout: options.timeout,
|
|
23
|
+
cwd: options.cwd,
|
|
24
|
+
stdin: options.context,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
parseOutput(stdout, stderr) {
|
|
28
|
+
return stdout.trim() || stderr.trim();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=copilot-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copilot-agent.js","sourceRoot":"","sources":["../../src/agents/copilot-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,YAAa,SAAQ,SAAS;IACjC,EAAE,GAAY,SAAS,CAAC;IACxB,WAAW,GAAG,aAAa,CAAC;IAC5B,UAAU,GAAG,SAAS,CAAC;IACd,yBAAyB,GAAG,KAAK,CAAC;IAE1C,iBAAiB,CAAC,OAAyB,EAAE,KAAa;QACnE,MAAM,IAAI,GAAG;YACZ,SAAS;YACT,KAAK;YACL,IAAI;YACJ,OAAO,CAAC,MAAM;YACd,mBAAmB;YACnB,UAAU;YACV,eAAe;YACf,0BAA0B;YAC1B,wBAAwB;SACxB,CAAC;QAEF,OAAO;YACN,OAAO,EAAE,IAAI,CAAC,UAAU;YACxB,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK,EAAE,OAAO,CAAC,OAAO;SACtB,CAAC;IACH,CAAC;IAEkB,WAAW,CAAC,MAAc,EAAE,MAAc;QAC5D,OAAO,MAAM,CAAC,IAAI,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;IACvC,CAAC;CACD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SpawnOptions } from "../orchestrator/executor.js";
|
|
2
|
+
import { BaseAgent } from "./base-agent.js";
|
|
3
|
+
import type { AgentId, ExecutionOptions } from "./types.js";
|
|
4
|
+
export declare class GeminiAgent extends BaseAgent {
|
|
5
|
+
readonly id: AgentId;
|
|
6
|
+
readonly displayName = "Gemini CLI";
|
|
7
|
+
readonly cliCommand = "gemini";
|
|
8
|
+
protected buildSpawnOptions(options: ExecutionOptions, model: string): SpawnOptions;
|
|
9
|
+
protected parseOutput(stdout: string, _stderr: string): string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=gemini-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini-agent.d.ts","sourceRoot":"","sources":["../../src/agents/gemini-agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAe,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEzE,qBAAa,WAAY,SAAQ,SAAS;IACzC,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAY;IAChC,QAAQ,CAAC,WAAW,gBAAgB;IACpC,QAAQ,CAAC,UAAU,YAAY;IAE/B,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY;cAYhE,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;CAoBvE"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { BaseAgent } from "./base-agent.js";
|
|
2
|
+
export class GeminiAgent extends BaseAgent {
|
|
3
|
+
id = "gemini";
|
|
4
|
+
displayName = "Gemini CLI";
|
|
5
|
+
cliCommand = "gemini";
|
|
6
|
+
buildSpawnOptions(options, model) {
|
|
7
|
+
const args = ["-m", model, "-p", options.prompt, "--output-format", "stream-json", "--sandbox"];
|
|
8
|
+
return {
|
|
9
|
+
command: this.cliCommand,
|
|
10
|
+
args,
|
|
11
|
+
timeout: options.timeout,
|
|
12
|
+
cwd: options.cwd,
|
|
13
|
+
stdin: options.context,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
parseOutput(stdout, _stderr) {
|
|
17
|
+
// stream-json outputs newline-delimited JSON objects
|
|
18
|
+
// Extract text content from the stream
|
|
19
|
+
const lines = stdout.trim().split("\n");
|
|
20
|
+
const textParts = [];
|
|
21
|
+
for (const line of lines) {
|
|
22
|
+
try {
|
|
23
|
+
const obj = JSON.parse(line);
|
|
24
|
+
if (obj.text)
|
|
25
|
+
textParts.push(obj.text);
|
|
26
|
+
else if (obj.response)
|
|
27
|
+
textParts.push(obj.response);
|
|
28
|
+
else if (obj.content)
|
|
29
|
+
textParts.push(obj.content);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Not JSON, collect as raw text
|
|
33
|
+
if (line.trim())
|
|
34
|
+
textParts.push(line);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return textParts.join("") || stdout.trim();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=gemini-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini-agent.js","sourceRoot":"","sources":["../../src/agents/gemini-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,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