mcp-agent-foundry 1.3.0 → 2.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 +350 -52
- package/dist/background/index.d.ts +33 -0
- package/dist/background/index.d.ts.map +1 -0
- package/dist/background/index.js +33 -0
- package/dist/background/index.js.map +1 -0
- package/dist/background/task-runner.d.ts +177 -0
- package/dist/background/task-runner.d.ts.map +1 -0
- package/dist/background/task-runner.js +551 -0
- package/dist/background/task-runner.js.map +1 -0
- package/dist/background/types.d.ts +135 -0
- package/dist/background/types.d.ts.map +1 -0
- package/dist/background/types.js +8 -0
- package/dist/background/types.js.map +1 -0
- package/dist/failover/health-tracker.d.ts +81 -1
- package/dist/failover/health-tracker.d.ts.map +1 -1
- package/dist/failover/health-tracker.js +229 -1
- package/dist/failover/health-tracker.js.map +1 -1
- package/dist/hooks/hook-executor.d.ts +77 -0
- package/dist/hooks/hook-executor.d.ts.map +1 -0
- package/dist/hooks/hook-executor.js +308 -0
- package/dist/hooks/hook-executor.js.map +1 -0
- package/dist/hooks/hook-manager.d.ts +140 -0
- package/dist/hooks/hook-manager.d.ts.map +1 -0
- package/dist/hooks/hook-manager.js +520 -0
- package/dist/hooks/hook-manager.js.map +1 -0
- package/dist/hooks/index.d.ts +10 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/types.d.ts +221 -0
- package/dist/hooks/types.d.ts.map +1 -0
- package/dist/hooks/types.js +31 -0
- package/dist/hooks/types.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp/auto-mode.d.ts +221 -0
- package/dist/mcp/auto-mode.d.ts.map +1 -0
- package/dist/mcp/auto-mode.js +436 -0
- package/dist/mcp/auto-mode.js.map +1 -0
- package/dist/mcp/index.d.ts +14 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +22 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/tools/tasks/delete-task.d.ts +25 -0
- package/dist/mcp/tools/tasks/delete-task.d.ts.map +1 -0
- package/dist/mcp/tools/tasks/delete-task.js +148 -0
- package/dist/mcp/tools/tasks/delete-task.js.map +1 -0
- package/dist/mcp/tools/tasks/index.d.ts +2 -0
- package/dist/mcp/tools/tasks/index.d.ts.map +1 -1
- package/dist/mcp/tools/tasks/index.js +6 -0
- package/dist/mcp/tools/tasks/index.js.map +1 -1
- package/dist/observability/debug-logger.d.ts +209 -0
- package/dist/observability/debug-logger.d.ts.map +1 -0
- package/dist/observability/debug-logger.js +430 -0
- package/dist/observability/debug-logger.js.map +1 -0
- package/dist/observability/index.d.ts +12 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +12 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/logger.d.ts +180 -0
- package/dist/observability/logger.d.ts.map +1 -1
- package/dist/observability/logger.js +158 -0
- package/dist/observability/logger.js.map +1 -1
- package/dist/router/context-manager.d.ts +214 -1
- package/dist/router/context-manager.d.ts.map +1 -1
- package/dist/router/context-manager.js +759 -2
- package/dist/router/context-manager.js.map +1 -1
- package/dist/router/context-types.d.ts +182 -0
- package/dist/router/context-types.d.ts.map +1 -0
- package/dist/router/context-types.js +8 -0
- package/dist/router/context-types.js.map +1 -0
- package/dist/server.d.ts +41 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +165 -0
- package/dist/server.js.map +1 -1
- package/dist/skills/hot-reloader.d.ts +104 -0
- package/dist/skills/hot-reloader.d.ts.map +1 -0
- package/dist/skills/hot-reloader.js +314 -0
- package/dist/skills/hot-reloader.js.map +1 -0
- package/dist/skills/index.d.ts +14 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +16 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/skill-executor.d.ts +96 -0
- package/dist/skills/skill-executor.d.ts.map +1 -0
- package/dist/skills/skill-executor.js +289 -0
- package/dist/skills/skill-executor.js.map +1 -0
- package/dist/skills/skill-loader.d.ts +147 -0
- package/dist/skills/skill-loader.d.ts.map +1 -0
- package/dist/skills/skill-loader.js +579 -0
- package/dist/skills/skill-loader.js.map +1 -0
- package/dist/skills/types.d.ts +198 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +21 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tasks/coordinator.d.ts +22 -1
- package/dist/tasks/coordinator.d.ts.map +1 -1
- package/dist/tasks/coordinator.js +83 -0
- package/dist/tasks/coordinator.js.map +1 -1
- package/dist/tasks/state-coordinator.d.ts +19 -0
- package/dist/tasks/state-coordinator.d.ts.map +1 -1
- package/dist/tasks/state-coordinator.js +40 -0
- package/dist/tasks/state-coordinator.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
[](https://nodejs.org)
|
|
7
7
|
[](https://www.npmjs.com/package/mcp-agent-foundry)
|
|
8
|
-
[](tests/)
|
|
9
9
|
|
|
10
10
|
Agent Foundry extends Claude Code with multi-provider AI orchestration and git worktree isolation. Each coding agent receives its own isolated worktree - a separate checkout on a dedicated branch - enabling true parallel development without file conflicts. Get second opinions from external AI models without leaving Claude Code.
|
|
11
11
|
|
|
@@ -13,6 +13,8 @@ Agent Foundry extends Claude Code with multi-provider AI orchestration and git w
|
|
|
13
13
|
|
|
14
14
|
## Features
|
|
15
15
|
|
|
16
|
+
- **Zero-Config Setup** - Auto-registers with Claude Code on npm install
|
|
17
|
+
- **13+ AI Providers** - From budget (DeepSeek, Groq) to premium (OpenAI, Anthropic)
|
|
16
18
|
- **Multi-Provider AI Orchestration** - Route tasks to Anthropic, OpenAI, Google Gemini, DeepSeek, Z.AI (GLM-4), Kimi, or local Ollama models
|
|
17
19
|
- **Git Worktree Isolation** - Each coding agent works in an isolated directory on its own branch
|
|
18
20
|
- **Pipeline Execution** - Multi-step DAG workflows with dependency ordering and parallel execution
|
|
@@ -22,6 +24,11 @@ Agent Foundry extends Claude Code with multi-provider AI orchestration and git w
|
|
|
22
24
|
- **State Persistence** - Survives server restarts with automatic state recovery
|
|
23
25
|
- **Crash Recovery** - Orphan detection, stuck worktree handling, and cleanup commands
|
|
24
26
|
- **Intelligent Failover** - Automatic provider switching with health tracking, circuit breakers, and cost-aware routing
|
|
27
|
+
- **Context Manager** - Token tracking per provider/model with 40+ model limits, auto-compact at 90%, blocking at 98%
|
|
28
|
+
- **Hooks System** - 9 event types for customizing agent behavior with variable substitution and hot-reload
|
|
29
|
+
- **Background Task Runner** - Queue-based async task execution with AbortController cancellation and progress tracking
|
|
30
|
+
- **MCP Auto Mode** - Intelligent tool selection under context pressure with priority-based deferral
|
|
31
|
+
- **Skills Hot-Reload** - Custom skill definitions with auto-discovery from user and project directories
|
|
25
32
|
|
|
26
33
|
---
|
|
27
34
|
|
|
@@ -33,7 +40,12 @@ Agent Foundry extends Claude Code with multi-provider AI orchestration and git w
|
|
|
33
40
|
npm install -g mcp-agent-foundry
|
|
34
41
|
```
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
That's it! Agent Foundry automatically registers with Claude Code during installation.
|
|
44
|
+
Restart Claude Code to activate.
|
|
45
|
+
|
|
46
|
+
To verify: Run `/mcp` in Claude Code - you should see `agent-foundry · ✓ connected`
|
|
47
|
+
|
|
48
|
+
### Initial Setup
|
|
37
49
|
|
|
38
50
|
```bash
|
|
39
51
|
agent-foundry setup
|
|
@@ -45,34 +57,6 @@ This interactive wizard will:
|
|
|
45
57
|
3. Set up agent roles
|
|
46
58
|
4. Create your configuration file
|
|
47
59
|
|
|
48
|
-
### Connect to Claude Code
|
|
49
|
-
|
|
50
|
-
Add to your Claude Code configuration (`~/.claude/claude_desktop_config.json`):
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"mcpServers": {
|
|
55
|
-
"agent-foundry": {
|
|
56
|
-
"command": "agent-foundry",
|
|
57
|
-
"args": ["start"]
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Or specify the full path:
|
|
64
|
-
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"mcpServers": {
|
|
68
|
-
"agent-foundry": {
|
|
69
|
-
"command": "node",
|
|
70
|
-
"args": ["/path/to/agent-foundry/dist/index.js"]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
60
|
---
|
|
77
61
|
|
|
78
62
|
## How It Works
|
|
@@ -125,6 +109,218 @@ Or specify the full path:
|
|
|
125
109
|
|
|
126
110
|
---
|
|
127
111
|
|
|
112
|
+
## Intelligent Failover System
|
|
113
|
+
|
|
114
|
+
Agent Foundry includes automatic provider failover with health tracking:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
118
|
+
│ Request to Role │
|
|
119
|
+
└─────────────────────────────────────────────────────────────┘
|
|
120
|
+
│
|
|
121
|
+
▼
|
|
122
|
+
┌─────────────────┐
|
|
123
|
+
│ Primary Provider │
|
|
124
|
+
│ (e.g. DeepSeek)│
|
|
125
|
+
└────────┬────────┘
|
|
126
|
+
│
|
|
127
|
+
┌──────────────┴──────────────┐
|
|
128
|
+
│ │
|
|
129
|
+
✓ Success ✗ Error (429, 500, etc.)
|
|
130
|
+
│ │
|
|
131
|
+
▼ ▼
|
|
132
|
+
Return Result ┌─────────────────┐
|
|
133
|
+
│ Health Tracker │
|
|
134
|
+
│ marks unhealthy │
|
|
135
|
+
└────────┬────────┘
|
|
136
|
+
│
|
|
137
|
+
▼
|
|
138
|
+
┌─────────────────┐
|
|
139
|
+
│ Circuit Breaker │
|
|
140
|
+
│ checks state │
|
|
141
|
+
└────────┬────────┘
|
|
142
|
+
│
|
|
143
|
+
▼
|
|
144
|
+
┌─────────────────┐
|
|
145
|
+
│ Fallback Chain │
|
|
146
|
+
│ (OpenAI → Anthropic)│
|
|
147
|
+
└────────┬────────┘
|
|
148
|
+
│
|
|
149
|
+
▼
|
|
150
|
+
Next Provider
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Key Features
|
|
154
|
+
|
|
155
|
+
- **Automatic Retry** - Exponential backoff on transient errors
|
|
156
|
+
- **Health Tracking** - Monitors provider success/failure rates
|
|
157
|
+
- **Cooldown Periods** - Unhealthy providers are temporarily skipped
|
|
158
|
+
- **Circuit Breakers** - Prevents cascading failures
|
|
159
|
+
- **Cost-Aware Routing** - Optionally prefer cheaper providers
|
|
160
|
+
- **Configurable Error Codes** - Define which errors trigger failover
|
|
161
|
+
- **Rate Limit Warnings** - Proactive warnings at 70% capacity with header parsing for OpenAI/Anthropic/generic formats
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Hooks System
|
|
166
|
+
|
|
167
|
+
Agent Foundry provides a flexible hooks system that lets you customize agent behavior by running commands at key lifecycle events.
|
|
168
|
+
|
|
169
|
+
### Supported Events
|
|
170
|
+
|
|
171
|
+
| Event | Description |
|
|
172
|
+
|-------|-------------|
|
|
173
|
+
| `PreToolUse` | Before a tool is invoked |
|
|
174
|
+
| `PostToolUse` | After a tool completes |
|
|
175
|
+
| `Setup` | During agent initialization |
|
|
176
|
+
| `ToolError` | When a tool encounters an error |
|
|
177
|
+
| `TaskStart` | When a task begins execution |
|
|
178
|
+
| `TaskComplete` | When a task finishes successfully |
|
|
179
|
+
| `TaskFail` | When a task fails |
|
|
180
|
+
| `ProviderError` | When an AI provider returns an error |
|
|
181
|
+
| `Failover` | When switching to a fallback provider |
|
|
182
|
+
|
|
183
|
+
### Configuration
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
# In ~/.config/agent-foundry/config.yaml
|
|
187
|
+
hooks:
|
|
188
|
+
enabled: true
|
|
189
|
+
configPath: ~/.agent-foundry/hooks.yaml
|
|
190
|
+
events:
|
|
191
|
+
PreToolUse:
|
|
192
|
+
- command: "echo 'Tool: ${TOOL_NAME}'"
|
|
193
|
+
timeout_ms: 5000
|
|
194
|
+
filter:
|
|
195
|
+
tools: ["execute_task", "invoke_agent"]
|
|
196
|
+
TaskComplete:
|
|
197
|
+
- command: "./notify.sh ${TASK_ID}"
|
|
198
|
+
timeout_ms: 10000
|
|
199
|
+
ProviderError:
|
|
200
|
+
- command: "logger -t agent-foundry 'Provider ${PROVIDER} failed: ${ERROR}'"
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Variable Substitution
|
|
204
|
+
|
|
205
|
+
Hooks support variable substitution with context-specific values:
|
|
206
|
+
- `${TOOL_NAME}` - Name of the tool being invoked
|
|
207
|
+
- `${TASK_ID}` - Current task identifier
|
|
208
|
+
- `${PROVIDER}` - AI provider name
|
|
209
|
+
- `${ERROR}` - Error message (for error events)
|
|
210
|
+
- `${RESULT}` - Result data (for post-completion events)
|
|
211
|
+
|
|
212
|
+
### Features
|
|
213
|
+
|
|
214
|
+
- **Filtering** - Run hooks only for specific tools, providers, or roles
|
|
215
|
+
- **Timeouts** - Configurable per-hook timeouts prevent blocking
|
|
216
|
+
- **Hot-Reload** - Changes to hooks.yaml are picked up automatically
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Skills Hot-Reload
|
|
221
|
+
|
|
222
|
+
Define custom skills that extend agent capabilities with automatic discovery and hot-reload.
|
|
223
|
+
|
|
224
|
+
### Skill Locations
|
|
225
|
+
|
|
226
|
+
Skills are loaded from:
|
|
227
|
+
1. `~/.agent-foundry/skills/` - User-level skills (shared across projects)
|
|
228
|
+
2. `.agent-foundry/skills/` - Project-level skills (project-specific)
|
|
229
|
+
|
|
230
|
+
### Skill Definition
|
|
231
|
+
|
|
232
|
+
```yaml
|
|
233
|
+
# ~/.agent-foundry/skills/code-review.yaml
|
|
234
|
+
name: code-review
|
|
235
|
+
description: Comprehensive code review skill
|
|
236
|
+
context_mode: inherit # inherit | fork | isolated
|
|
237
|
+
|
|
238
|
+
prompts:
|
|
239
|
+
system: |
|
|
240
|
+
You are an expert code reviewer focusing on:
|
|
241
|
+
- Security vulnerabilities
|
|
242
|
+
- Performance issues
|
|
243
|
+
- Best practices
|
|
244
|
+
- Code clarity
|
|
245
|
+
|
|
246
|
+
triggers:
|
|
247
|
+
- pattern: "review this code"
|
|
248
|
+
- pattern: "code review"
|
|
249
|
+
|
|
250
|
+
actions:
|
|
251
|
+
- type: invoke_agent
|
|
252
|
+
role: reviewer
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Context Modes
|
|
256
|
+
|
|
257
|
+
| Mode | Description |
|
|
258
|
+
|------|-------------|
|
|
259
|
+
| `inherit` | Skill runs in the parent agent's context |
|
|
260
|
+
| `fork` | Skill gets a copy of the parent context |
|
|
261
|
+
| `isolated` | Skill runs with a fresh, empty context |
|
|
262
|
+
|
|
263
|
+
### Features
|
|
264
|
+
|
|
265
|
+
- **Auto-Discovery** - Skills are automatically loaded on startup
|
|
266
|
+
- **Hot-Reload** - Changes to skill files are picked up without restart
|
|
267
|
+
- **Priority Ordering** - Project skills override user skills with the same name
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Context Manager
|
|
272
|
+
|
|
273
|
+
Agent Foundry includes intelligent context management to prevent token limit issues and optimize AI provider usage.
|
|
274
|
+
|
|
275
|
+
### Features
|
|
276
|
+
|
|
277
|
+
- **Token Tracking** - Tracks token usage per provider/model with 40+ pre-configured model limits
|
|
278
|
+
- **Auto-Compact** - Automatically compacts context when reaching 90% capacity
|
|
279
|
+
- **Blocking Threshold** - Blocks new requests at 98% to prevent errors
|
|
280
|
+
- **Visualization** - Context usage visible in debug logs and status commands
|
|
281
|
+
|
|
282
|
+
### Configuration
|
|
283
|
+
|
|
284
|
+
```yaml
|
|
285
|
+
# In ~/.config/agent-foundry/config.yaml
|
|
286
|
+
context:
|
|
287
|
+
autoCompact: true
|
|
288
|
+
compactThreshold: 0.9 # Trigger compaction at 90%
|
|
289
|
+
blockThreshold: 0.98 # Block new requests at 98%
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Supported Model Limits
|
|
293
|
+
|
|
294
|
+
Pre-configured limits for 40+ models including:
|
|
295
|
+
- OpenAI: GPT-4o (128K), GPT-4 Turbo (128K), o1 (200K)
|
|
296
|
+
- Anthropic: Claude 3.5/4 (200K)
|
|
297
|
+
- Google: Gemini 2.5 Pro (1M), Gemini 2.5 Flash (1M)
|
|
298
|
+
- DeepSeek: DeepSeek R1 (64K), DeepSeek Chat (128K)
|
|
299
|
+
- And many more...
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## MCP Auto Mode
|
|
304
|
+
|
|
305
|
+
When context pressure builds, MCP Auto Mode intelligently manages tool availability.
|
|
306
|
+
|
|
307
|
+
### How It Works
|
|
308
|
+
|
|
309
|
+
1. **Context Budget** - Tool descriptions are deferred when exceeding 10% of context budget
|
|
310
|
+
2. **Priority-Based Selection** - High-priority tools remain available; lower-priority tools are deferred
|
|
311
|
+
3. **Automatic Restoration** - Deferred tools become available again when context decreases
|
|
312
|
+
|
|
313
|
+
### Tool Priorities
|
|
314
|
+
|
|
315
|
+
| Priority | Tools |
|
|
316
|
+
|----------|-------|
|
|
317
|
+
| Critical | `invoke_agent`, `execute_task` |
|
|
318
|
+
| High | `list_agents`, `get_task_status` |
|
|
319
|
+
| Medium | `execute_pipeline`, `compare_agents` |
|
|
320
|
+
| Low | `cleanup_worktrees`, `list_worktrees` |
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
128
324
|
## MCP Tools
|
|
129
325
|
|
|
130
326
|
| Tool | Description |
|
|
@@ -143,6 +339,7 @@ Or specify the full path:
|
|
|
143
339
|
| `cleanup_worktrees` | Clean up stale or orphaned worktrees |
|
|
144
340
|
| `resolve_conflicts` | Resolve merge conflicts using various strategies |
|
|
145
341
|
| `get_worktree_status` | Get detailed status of a specific worktree |
|
|
342
|
+
| `delete_task` | Delete a task from the queue |
|
|
146
343
|
|
|
147
344
|
---
|
|
148
345
|
|
|
@@ -162,19 +359,24 @@ providers:
|
|
|
162
359
|
openai:
|
|
163
360
|
api_key: ${OPENAI_API_KEY}
|
|
164
361
|
default_model: gpt-4o
|
|
165
|
-
deepseek:
|
|
166
|
-
api_key: ${DEEPSEEK_API_KEY}
|
|
167
|
-
base_url: https://api.deepseek.com
|
|
168
|
-
default_model: deepseek-reasoner
|
|
169
362
|
anthropic:
|
|
170
363
|
api_key: ${ANTHROPIC_API_KEY}
|
|
171
364
|
default_model: claude-sonnet-4-20250514
|
|
365
|
+
deepseek:
|
|
366
|
+
api_key: ${DEEPSEEK_API_KEY}
|
|
367
|
+
default_model: deepseek-reasoner
|
|
172
368
|
google:
|
|
173
369
|
api_key: ${GOOGLE_API_KEY}
|
|
174
370
|
default_model: gemini-2.5-pro
|
|
371
|
+
groq:
|
|
372
|
+
api_key: ${GROQ_API_KEY}
|
|
373
|
+
default_model: llama-3.3-70b-versatile
|
|
374
|
+
openrouter:
|
|
375
|
+
api_key: ${OPENROUTER_API_KEY}
|
|
376
|
+
default_model: anthropic/claude-3.5-sonnet
|
|
175
377
|
ollama:
|
|
176
378
|
base_url: http://localhost:11434
|
|
177
|
-
default_model: llama3.
|
|
379
|
+
default_model: llama3.3:70b
|
|
178
380
|
|
|
179
381
|
roles:
|
|
180
382
|
coder:
|
|
@@ -243,19 +445,62 @@ worktrees:
|
|
|
243
445
|
enabled: true
|
|
244
446
|
minAvailable: 2
|
|
245
447
|
maxSize: 5
|
|
448
|
+
|
|
449
|
+
# Hooks configuration
|
|
450
|
+
hooks:
|
|
451
|
+
enabled: true
|
|
452
|
+
configPath: ~/.agent-foundry/hooks.yaml
|
|
453
|
+
events:
|
|
454
|
+
PreToolUse:
|
|
455
|
+
- command: "echo 'Tool: ${TOOL_NAME}'"
|
|
456
|
+
timeout_ms: 5000
|
|
457
|
+
TaskComplete:
|
|
458
|
+
- command: "./notify.sh ${TASK_ID}"
|
|
459
|
+
|
|
460
|
+
# Skills configuration
|
|
461
|
+
skills:
|
|
462
|
+
enabled: true
|
|
463
|
+
directories:
|
|
464
|
+
- ~/.agent-foundry/skills
|
|
465
|
+
- .agent-foundry/skills
|
|
466
|
+
hotReload: true
|
|
467
|
+
|
|
468
|
+
# Context management
|
|
469
|
+
context:
|
|
470
|
+
autoCompact: true
|
|
471
|
+
compactThreshold: 0.9 # Auto-compact at 90% capacity
|
|
472
|
+
blockThreshold: 0.98 # Block new requests at 98% capacity
|
|
246
473
|
```
|
|
247
474
|
|
|
248
475
|
### Environment Variables
|
|
249
476
|
|
|
250
|
-
Set your API keys as environment variables:
|
|
251
|
-
|
|
252
477
|
```bash
|
|
253
|
-
|
|
478
|
+
# Premium Providers
|
|
254
479
|
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
255
|
-
export
|
|
480
|
+
export OPENAI_API_KEY="sk-..."
|
|
256
481
|
export GOOGLE_API_KEY="..."
|
|
257
|
-
|
|
258
|
-
|
|
482
|
+
|
|
483
|
+
# Budget-Friendly Providers
|
|
484
|
+
export DEEPSEEK_API_KEY="sk-..."
|
|
485
|
+
export ZAI_API_KEY="..."
|
|
486
|
+
export KIMI_API_KEY="..."
|
|
487
|
+
export KIMI_CODE_API_KEY="..." # Kimi Code subscription
|
|
488
|
+
|
|
489
|
+
# Router/Aggregator
|
|
490
|
+
export OPENROUTER_API_KEY="sk-or-..."
|
|
491
|
+
|
|
492
|
+
# Fast Inference
|
|
493
|
+
export GROQ_API_KEY="gsk_..."
|
|
494
|
+
export TOGETHER_API_KEY="..."
|
|
495
|
+
export FIREWORKS_API_KEY="..."
|
|
496
|
+
|
|
497
|
+
# Web Search
|
|
498
|
+
export PERPLEXITY_API_KEY="pplx-..."
|
|
499
|
+
|
|
500
|
+
# Debug/Observability
|
|
501
|
+
export AGENT_FOUNDRY_DEBUG=true # Enable debug logging
|
|
502
|
+
export AGENT_FOUNDRY_DEBUG_FILE=/path/to/debug.log # Write debug logs to file
|
|
503
|
+
export AGENT_FOUNDRY_DEBUG_VERBOSE=true # Include verbose details
|
|
259
504
|
```
|
|
260
505
|
|
|
261
506
|
---
|
|
@@ -310,15 +555,23 @@ agent-foundry help # Show help
|
|
|
310
555
|
|
|
311
556
|
## Supported Providers
|
|
312
557
|
|
|
313
|
-
| Provider | Models |
|
|
314
|
-
|
|
315
|
-
| **Anthropic** | Claude
|
|
316
|
-
| **OpenAI** | GPT-4o, GPT-4 Turbo, o1, o1-mini |
|
|
317
|
-
| **Google Gemini** | Gemini 2.5 Pro, Gemini 2.5 Flash |
|
|
318
|
-
| **DeepSeek** | DeepSeek R1, DeepSeek Chat |
|
|
319
|
-
| **
|
|
320
|
-
| **
|
|
321
|
-
| **
|
|
558
|
+
| Provider | Models | API Key Env Var | Cost |
|
|
559
|
+
|----------|--------|-----------------|------|
|
|
560
|
+
| **Anthropic** | Claude Opus 4, Claude Sonnet 4 | `ANTHROPIC_API_KEY` | $$$ |
|
|
561
|
+
| **OpenAI** | GPT-4o, GPT-4 Turbo, o1, o1-mini, o3-mini | `OPENAI_API_KEY` | $$$ |
|
|
562
|
+
| **Google Gemini** | Gemini 2.5 Pro, Gemini 2.5 Flash | `GOOGLE_API_KEY` | $$ |
|
|
563
|
+
| **DeepSeek** | DeepSeek R1, DeepSeek Chat, DeepSeek Coder | `DEEPSEEK_API_KEY` | $ |
|
|
564
|
+
| **OpenRouter** | Access 100+ models via single API | `OPENROUTER_API_KEY` | Varies |
|
|
565
|
+
| **Perplexity** | pplx-70b-online, pplx-7b-online (web search) | `PERPLEXITY_API_KEY` | $$ |
|
|
566
|
+
| **Groq** | Llama 3.3 70B, Mixtral (ultra-fast inference) | `GROQ_API_KEY` | $ |
|
|
567
|
+
| **Together AI** | Llama, Mistral, CodeLlama, Qwen | `TOGETHER_API_KEY` | $ |
|
|
568
|
+
| **Fireworks AI** | Llama, Mixtral (optimized inference) | `FIREWORKS_API_KEY` | $ |
|
|
569
|
+
| **Z.AI** | GLM-4, GLM-4.7 | `ZAI_API_KEY` | $ |
|
|
570
|
+
| **Kimi (Moonshot)** | moonshot-v1-128k | `KIMI_API_KEY` | $ |
|
|
571
|
+
| **Kimi Code** | Kimi coding assistant (subscription) | `KIMI_CODE_API_KEY` | Subscription |
|
|
572
|
+
| **Ollama** | Llama 3.3, Mistral, CodeLlama, Qwen, etc. | N/A (local) | Free |
|
|
573
|
+
|
|
574
|
+
**Cost Legend**: $ = Budget, $$ = Moderate, $$$ = Premium
|
|
322
575
|
|
|
323
576
|
---
|
|
324
577
|
|
|
@@ -398,7 +651,8 @@ agent-foundry/
|
|
|
398
651
|
│ ├── cli/ # CLI command implementations
|
|
399
652
|
│ ├── mcp/
|
|
400
653
|
│ │ ├── tools/ # MCP tool implementations
|
|
401
|
-
│ │
|
|
654
|
+
│ │ ├── transport/ # stdio transport
|
|
655
|
+
│ │ └── auto-mode.ts # MCP Auto Mode - intelligent tool selection
|
|
402
656
|
│ ├── worktrees/
|
|
403
657
|
│ │ ├── manager.ts # Worktree lifecycle
|
|
404
658
|
│ │ ├── branch.ts # Branch operations
|
|
@@ -412,9 +666,31 @@ agent-foundry/
|
|
|
412
666
|
│ │ ├── anthropic.ts # Anthropic Claude
|
|
413
667
|
│ │ ├── openai.ts # OpenAI GPT-4o
|
|
414
668
|
│ │ ├── gemini.ts # Google Gemini
|
|
669
|
+
│ │ ├── deepseek.ts # DeepSeek R1
|
|
415
670
|
│ │ ├── ollama.ts # Local Ollama
|
|
416
671
|
│ │ ├── zai.ts # Z.AI GLM
|
|
417
|
-
│ │
|
|
672
|
+
│ │ ├── kimi.ts # Moonshot Kimi
|
|
673
|
+
│ │ ├── openrouter.ts # OpenRouter (100+ models)
|
|
674
|
+
│ │ ├── perplexity.ts # Perplexity (web search)
|
|
675
|
+
│ │ ├── groq.ts # Groq (fast inference)
|
|
676
|
+
│ │ ├── together.ts # Together AI
|
|
677
|
+
│ │ └── fireworks.ts # Fireworks AI
|
|
678
|
+
│ ├── failover/
|
|
679
|
+
│ │ ├── orchestrator.ts # Retry and failover logic
|
|
680
|
+
│ │ ├── health-tracker.ts # Provider health monitoring
|
|
681
|
+
│ │ └── pricing.ts # Cost-aware routing
|
|
682
|
+
│ ├── background/ # Background task execution
|
|
683
|
+
│ │ └── task-runner.ts # Queue-based async task runner
|
|
684
|
+
│ ├── hooks/ # Hook system
|
|
685
|
+
│ │ ├── hook-executor.ts # Hook command execution
|
|
686
|
+
│ │ └── hook-manager.ts # Hook registration and dispatch
|
|
687
|
+
│ ├── skills/ # Skills hot-reload
|
|
688
|
+
│ │ ├── skill-loader.ts # Skill file discovery and parsing
|
|
689
|
+
│ │ ├── skill-executor.ts # Skill action execution
|
|
690
|
+
│ │ └── hot-reloader.ts # File watcher for hot-reload
|
|
691
|
+
│ ├── observability/ # Logging and debugging
|
|
692
|
+
│ │ ├── logger.ts # Structured logging
|
|
693
|
+
│ │ └── debug-logger.ts # Debug output with environment control
|
|
418
694
|
│ ├── persistence/ # State persistence
|
|
419
695
|
│ ├── config/ # Configuration management
|
|
420
696
|
│ └── router/ # Routing engine
|
|
@@ -449,6 +725,28 @@ pnpm lint:fix
|
|
|
449
725
|
pnpm typecheck
|
|
450
726
|
```
|
|
451
727
|
|
|
728
|
+
### Debug Logging
|
|
729
|
+
|
|
730
|
+
Agent Foundry provides enhanced debug logging controlled via environment variables:
|
|
731
|
+
|
|
732
|
+
```bash
|
|
733
|
+
# Enable debug logging
|
|
734
|
+
export AGENT_FOUNDRY_DEBUG=true
|
|
735
|
+
|
|
736
|
+
# Write debug logs to a file
|
|
737
|
+
export AGENT_FOUNDRY_DEBUG_FILE=/path/to/debug.log
|
|
738
|
+
|
|
739
|
+
# Include verbose details (API payloads, full stack traces)
|
|
740
|
+
export AGENT_FOUNDRY_DEBUG_VERBOSE=true
|
|
741
|
+
```
|
|
742
|
+
|
|
743
|
+
Debug logging includes:
|
|
744
|
+
- Provider API calls and responses
|
|
745
|
+
- Failover decisions and health tracking
|
|
746
|
+
- Hook execution and timing
|
|
747
|
+
- Skill loading and hot-reload events
|
|
748
|
+
- Context manager token tracking
|
|
749
|
+
|
|
452
750
|
---
|
|
453
751
|
|
|
454
752
|
## Security
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background Module
|
|
3
|
+
*
|
|
4
|
+
* Provides background task execution for non-blocking agent invocations
|
|
5
|
+
* and pipeline steps. Supports concurrency control, cancellation,
|
|
6
|
+
* progress tracking, and event-based notifications.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { BackgroundTaskRunner } from './background/index.js';
|
|
11
|
+
*
|
|
12
|
+
* const runner = new BackgroundTaskRunner({ maxConcurrent: 3 }, logger);
|
|
13
|
+
*
|
|
14
|
+
* // Submit a background agent invocation
|
|
15
|
+
* const taskId = await runner.run(
|
|
16
|
+
* 'agent_invocation',
|
|
17
|
+
* 'Review authentication code',
|
|
18
|
+
* async () => {
|
|
19
|
+
* return await orchestrator.executeWithFailover('reviewer', messages, options);
|
|
20
|
+
* },
|
|
21
|
+
* { role: 'reviewer', provider: 'openai' }
|
|
22
|
+
* );
|
|
23
|
+
*
|
|
24
|
+
* // Check status later
|
|
25
|
+
* const task = runner.getTask(taskId);
|
|
26
|
+
*
|
|
27
|
+
* // Or wait for completion
|
|
28
|
+
* const completed = await runner.waitFor(taskId, 60000);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export * from './types.js';
|
|
32
|
+
export { BackgroundTaskRunner } from './task-runner.js';
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/background/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Background Module
|
|
3
|
+
*
|
|
4
|
+
* Provides background task execution for non-blocking agent invocations
|
|
5
|
+
* and pipeline steps. Supports concurrency control, cancellation,
|
|
6
|
+
* progress tracking, and event-based notifications.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { BackgroundTaskRunner } from './background/index.js';
|
|
11
|
+
*
|
|
12
|
+
* const runner = new BackgroundTaskRunner({ maxConcurrent: 3 }, logger);
|
|
13
|
+
*
|
|
14
|
+
* // Submit a background agent invocation
|
|
15
|
+
* const taskId = await runner.run(
|
|
16
|
+
* 'agent_invocation',
|
|
17
|
+
* 'Review authentication code',
|
|
18
|
+
* async () => {
|
|
19
|
+
* return await orchestrator.executeWithFailover('reviewer', messages, options);
|
|
20
|
+
* },
|
|
21
|
+
* { role: 'reviewer', provider: 'openai' }
|
|
22
|
+
* );
|
|
23
|
+
*
|
|
24
|
+
* // Check status later
|
|
25
|
+
* const task = runner.getTask(taskId);
|
|
26
|
+
*
|
|
27
|
+
* // Or wait for completion
|
|
28
|
+
* const completed = await runner.waitFor(taskId, 60000);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export * from './types.js';
|
|
32
|
+
export { BackgroundTaskRunner } from './task-runner.js';
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/background/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|