@desplega.ai/agent-swarm 1.10.8 → 1.20.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/.claude/settings.local.json +14 -1
- package/.env.docker.example +6 -0
- package/.env.example +14 -0
- package/.github/workflows/docker-and-deploy.yml +22 -22
- package/.wts-config.json +4 -0
- package/.wts-setup.ts +102 -0
- package/CLAUDE.md +81 -88
- package/DEPLOYMENT.md +228 -14
- package/Dockerfile.worker +21 -4
- package/MCP.md +158 -1
- package/README.md +75 -0
- package/docker-compose.example.yml +25 -2
- package/docker-entrypoint.sh +71 -0
- package/ecosystem.config.cjs +66 -0
- package/package.json +11 -2
- package/plugin/commands/close-issue.md +86 -0
- package/plugin/commands/create-pr.md +93 -0
- package/plugin/commands/implement-issue.md +131 -0
- package/plugin/commands/investigate-sentry-issue.md +138 -0
- package/plugin/commands/respond-github.md +94 -0
- package/plugin/commands/review-pr.md +227 -0
- package/plugin/commands/start-leader.md +32 -12
- package/plugin/commands/swarm-chat.md +4 -0
- package/plugin/commands/work-on-task.md +12 -3
- package/scripts/generate-mcp-docs.ts +4 -4
- package/slack-manifest.json +2 -0
- package/src/be/db.ts +2329 -200
- package/src/commands/runner.ts +1034 -106
- package/src/github/app.ts +231 -0
- package/src/github/handlers.ts +918 -0
- package/src/github/index.ts +31 -0
- package/src/github/mentions.test.ts +104 -0
- package/src/github/mentions.ts +30 -0
- package/src/github/reactions.ts +153 -0
- package/src/github/types.ts +156 -0
- package/src/hooks/hook.ts +314 -5
- package/src/http.ts +1091 -109
- package/src/prompts/base-prompt.ts +168 -17
- package/src/scheduler/index.ts +1 -0
- package/src/scheduler/scheduler.test.ts +149 -0
- package/src/scheduler/scheduler.ts +164 -0
- package/src/server.ts +60 -1
- package/src/slack/files.ts +302 -0
- package/src/slack/handlers.test.ts +165 -0
- package/src/slack/handlers.ts +158 -4
- package/src/slack/index.ts +15 -0
- package/src/slack/responses.ts +10 -2
- package/src/tests/concurrency.test.ts +213 -0
- package/src/tests/db-capacity.test.ts +212 -0
- package/src/tests/epics.test.ts +370 -0
- package/src/tests/generate-default-claude-md.test.ts +90 -0
- package/src/tests/get-inbox-message.test.ts +145 -0
- package/src/tests/rest-api.test.ts +91 -13
- package/src/tests/runner-polling-api.test.ts +84 -12
- package/src/tests/scheduled-tasks-api.test.ts +352 -0
- package/src/tests/scheduled-tasks.test.ts +501 -0
- package/src/tests/session-costs.test.ts +725 -0
- package/src/tests/store-progress-cost.test.ts +209 -0
- package/src/tests/task-cancellation.test.ts +511 -0
- package/src/tests/task-pause-resume.test.ts +737 -0
- package/src/tests/trigger-claiming.test.ts +631 -0
- package/src/tests/update-profile-api.test.ts +561 -0
- package/src/tools/cancel-task.ts +111 -0
- package/src/tools/create-channel.ts +1 -0
- package/src/tools/epics/assign-task-to-epic.ts +128 -0
- package/src/tools/epics/create-epic.ts +111 -0
- package/src/tools/epics/delete-epic.ts +119 -0
- package/src/tools/epics/get-epic-details.ts +90 -0
- package/src/tools/epics/index.ts +7 -0
- package/src/tools/epics/list-epics.ts +83 -0
- package/src/tools/epics/unassign-task-from-epic.ts +108 -0
- package/src/tools/epics/update-epic.ts +171 -0
- package/src/tools/get-inbox-message.ts +89 -0
- package/src/tools/get-swarm.ts +1 -0
- package/src/tools/get-task-details.ts +1 -0
- package/src/tools/get-tasks.ts +10 -1
- package/src/tools/inbox-delegate.ts +113 -0
- package/src/tools/join-swarm.ts +24 -11
- package/src/tools/list-channels.ts +1 -0
- package/src/tools/list-services.ts +1 -0
- package/src/tools/my-agent-info.ts +3 -0
- package/src/tools/poll-task.ts +42 -2
- package/src/tools/post-message.ts +1 -0
- package/src/tools/read-messages.ts +4 -0
- package/src/tools/register-service.ts +1 -0
- package/src/tools/schedules/create-schedule.ts +226 -0
- package/src/tools/schedules/delete-schedule.ts +125 -0
- package/src/tools/schedules/index.ts +5 -0
- package/src/tools/schedules/list-schedules.ts +104 -0
- package/src/tools/schedules/run-schedule-now.ts +123 -0
- package/src/tools/schedules/update-schedule.ts +243 -0
- package/src/tools/send-task.ts +39 -8
- package/src/tools/slack-download-file.ts +174 -0
- package/src/tools/slack-list-channels.ts +168 -0
- package/src/tools/slack-post.ts +103 -0
- package/src/tools/slack-read.ts +385 -0
- package/src/tools/slack-reply.ts +142 -0
- package/src/tools/slack-upload-file.ts +376 -0
- package/src/tools/store-progress.ts +44 -6
- package/src/tools/task-action.ts +92 -2
- package/src/tools/unregister-service.ts +1 -0
- package/src/tools/update-profile.ts +45 -8
- package/src/tools/update-service-status.ts +1 -0
- package/src/types.ts +169 -1
- package/thoughts/shared/plans/{2025-12-18-inverse-teleport.md → 2026-01-09-inverse-teleport.md} +562 -188
- package/thoughts/shared/plans/2026-01-12-agent-rename-pm2-control.md +1133 -0
- package/thoughts/shared/plans/2026-01-12-github-app-integration.md +380 -0
- package/thoughts/shared/plans/2026-01-12-lead-inbox-model.md +876 -0
- package/thoughts/shared/plans/2026-01-12-ralph-wiggum-integration.md +463 -0
- package/thoughts/shared/plans/2026-01-13-agent-concurrency.md +691 -0
- package/thoughts/shared/plans/2026-01-13-github-assignment-handling.md +690 -0
- package/thoughts/shared/plans/2026-01-13-prevent-duplicate-trigger-processing.md +1071 -0
- package/thoughts/shared/plans/2026-01-14-fix-slack-thread-context.md +507 -0
- package/thoughts/shared/plans/2026-01-15-scheduled-tasks-implementation.md +565 -0
- package/thoughts/shared/plans/2026-01-15-usage-cost-tracking-ui.md +1479 -0
- package/thoughts/shared/plans/2026-01-16-epics-feature-implementation.md +1230 -0
- package/thoughts/shared/research/2025-01-09-inverse-teleport-plan-review.md +420 -0
- package/thoughts/shared/research/2026-01-13-lead-duplicate-trigger-processing.md +223 -0
- package/thoughts/shared/research/2026-01-14-lead-slack-thread-context.md +277 -0
- package/thoughts/shared/research/2026-01-15-ai-tracker-agent-swarm-integration.md +376 -0
- package/thoughts/shared/research/2026-01-15-auto-starting-processes-in-worker-containers.md +787 -0
- package/thoughts/shared/research/2026-01-15-scheduled-tasks.md +390 -0
- package/thoughts/shared/research/2026-01-16-epics-feature-research.md +437 -0
- package/thoughts/taras/plans/2026-01-22-agent-swarm-schemas.md +98 -0
- package/thoughts/taras/plans/2026-01-28-per-worker-claude-md.md +617 -0
- package/thoughts/taras/plans/2026-01-28-sentry-cli-integration.md +214 -0
- package/thoughts/taras/research/2026-01-22-vercel-cli-integration.md +287 -0
- package/thoughts/taras/research/2026-01-27-excessive-polling-issue.md +311 -0
- package/thoughts/taras/research/2026-01-28-per-worker-claude-md.md +383 -0
- package/thoughts/taras/research/2026-01-28-sentry-cli-integration.md +240 -0
- package/tsconfig.json +1 -1
- package/ui/CLAUDE.md +49 -0
- package/ui/bun.lock +81 -2
- package/ui/package-lock.json +5290 -0
- package/ui/package.json +1 -0
- package/ui/pnpm-lock.yaml +307 -0
- package/ui/src/App.tsx +25 -5
- package/ui/src/components/ActivityFeed.tsx +121 -96
- package/ui/src/components/AgentDetailPanel.tsx +243 -44
- package/ui/src/components/AgentsPanel.tsx +328 -62
- package/ui/src/components/ChatPanel.tsx +236 -136
- package/ui/src/components/ConfigModal.tsx +31 -10
- package/ui/src/components/Dashboard.tsx +324 -26
- package/ui/src/components/EditAgentProfileModal.tsx +433 -0
- package/ui/src/components/EpicDetailPage.tsx +741 -0
- package/ui/src/components/EpicsPanel.tsx +566 -0
- package/ui/src/components/Header.tsx +4 -12
- package/ui/src/components/JsonViewer.tsx +171 -0
- package/ui/src/components/ScheduledTaskDetailPanel.tsx +517 -0
- package/ui/src/components/ScheduledTasksPanel.tsx +639 -0
- package/ui/src/components/ServicesPanel.tsx +20 -10
- package/ui/src/components/SessionLogPanel.tsx +928 -142
- package/ui/src/components/StatsBar.tsx +58 -25
- package/ui/src/components/StatusBadge.tsx +48 -4
- package/ui/src/components/TaskDetailPanel.tsx +150 -74
- package/ui/src/components/TasksPanel.tsx +76 -37
- package/ui/src/components/UsageCharts.tsx +216 -0
- package/ui/src/components/UsageTab.tsx +394 -0
- package/ui/src/hooks/queries.ts +179 -5
- package/ui/src/hooks/useAutoScroll.ts +37 -9
- package/ui/src/index.css +60 -38
- package/ui/src/lib/api.ts +109 -12
- package/ui/src/lib/contentPreview.ts +208 -0
- package/ui/src/lib/theme.ts +24 -24
- package/ui/src/lib/utils.ts +41 -1
- package/ui/src/main.tsx +5 -9
- package/ui/src/types/api.ts +145 -1
- package/ui/tailwind.config.js +3 -1
- package/ui/vite.config.ts +20 -7
- package/plugin/.claude-plugin/plugin.json +0 -13
- package/plugin/commands/create-plan.md +0 -415
- package/plugin/commands/implement-plan.md +0 -89
- package/plugin/commands/research.md +0 -200
package/DEPLOYMENT.md
CHANGED
|
@@ -7,7 +7,11 @@ This guide covers all deployment options for Agent Swarm MCP.
|
|
|
7
7
|
- [Docker Compose (Recommended)](#docker-compose-recommended)
|
|
8
8
|
- [Docker Worker](#docker-worker)
|
|
9
9
|
- [Server Deployment (systemd)](#server-deployment-systemd)
|
|
10
|
+
- [Graceful Shutdown & Task Resume](#graceful-shutdown--task-resume)
|
|
10
11
|
- [Environment Variables](#environment-variables)
|
|
12
|
+
- [Slack Integration](#slack-integration)
|
|
13
|
+
- [GitHub App Integration](#github-app-integration)
|
|
14
|
+
- [Sentry Integration](#sentry-integration)
|
|
11
15
|
- [System Prompts](#system-prompts)
|
|
12
16
|
- [Service Registry (PM2)](#service-registry-pm2)
|
|
13
17
|
- [Publishing (Maintainers)](#publishing-maintainers)
|
|
@@ -71,8 +75,21 @@ GITHUB_NAME=Your Name
|
|
|
71
75
|
|--------|---------|
|
|
72
76
|
| `swarm_api` | SQLite database persistence |
|
|
73
77
|
| `swarm_logs` | Session logs |
|
|
74
|
-
| `swarm_shared` | Shared workspace between agents |
|
|
75
|
-
| `
|
|
78
|
+
| `swarm_shared` | Shared workspace between agents (`/workspace/shared`) |
|
|
79
|
+
| `swarm_lead` | Lead agent's personal workspace (`/workspace/personal`) |
|
|
80
|
+
| `swarm_worker_*` | Personal workspace per worker (`/workspace/personal`) |
|
|
81
|
+
|
|
82
|
+
### Graceful Shutdown
|
|
83
|
+
|
|
84
|
+
The docker-compose example uses `stop_grace_period: 60s` to allow graceful task pause during deployments. When a container receives SIGTERM:
|
|
85
|
+
|
|
86
|
+
1. In-progress tasks are **paused** (not failed)
|
|
87
|
+
2. Task state and progress are preserved
|
|
88
|
+
3. After restart, paused tasks are automatically **resumed** with context
|
|
89
|
+
|
|
90
|
+
This enables zero-downtime deployments. See [Graceful Shutdown & Task Resume](#graceful-shutdown--task-resume) for details.
|
|
91
|
+
|
|
92
|
+
> **Important:** Use stable `AGENT_ID` values for each worker to enable task resume after restarts.
|
|
76
93
|
|
|
77
94
|
---
|
|
78
95
|
|
|
@@ -111,7 +128,7 @@ docker run --rm -it \
|
|
|
111
128
|
docker run --rm -it \
|
|
112
129
|
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
113
130
|
-e API_KEY=your-api-key \
|
|
114
|
-
-e
|
|
131
|
+
-e SYSTEM_PROMPT="You are a Python specialist" \
|
|
115
132
|
-v ./logs:/logs \
|
|
116
133
|
-v ./work:/workspace \
|
|
117
134
|
ghcr.io/desplega-ai/agent-swarm-worker
|
|
@@ -120,7 +137,7 @@ docker run --rm -it \
|
|
|
120
137
|
docker run --rm -it \
|
|
121
138
|
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
122
139
|
-e API_KEY=your-api-key \
|
|
123
|
-
-e
|
|
140
|
+
-e SYSTEM_PROMPT_FILE=/workspace/prompts/specialist.txt \
|
|
124
141
|
-v ./work:/workspace \
|
|
125
142
|
ghcr.io/desplega-ai/agent-swarm-worker
|
|
126
143
|
|
|
@@ -160,12 +177,15 @@ The Docker worker image uses a multi-stage build:
|
|
|
160
177
|
- **Languages**: Python 3, Node.js 22, Bun
|
|
161
178
|
- **Build tools**: gcc, g++, make, cmake
|
|
162
179
|
- **Process manager**: PM2 (for background services)
|
|
180
|
+
- **CLI tools**: GitHub CLI (`gh`), sqlite3
|
|
181
|
+
- **Agent tools**: `wts` (git worktree manager), `cc-ai-tracker` (code change tracking)
|
|
163
182
|
- **Utilities**: git, git-lfs, vim, nano, jq, curl, wget, ssh
|
|
164
183
|
- **Sudo access**: Worker can install packages with `sudo apt-get install`
|
|
165
184
|
|
|
166
185
|
**Volumes:**
|
|
167
186
|
|
|
168
|
-
- `/workspace` -
|
|
187
|
+
- `/workspace/personal` - Agent's personal workspace (isolated per agent)
|
|
188
|
+
- `/workspace/shared` - Shared workspace between all agents
|
|
169
189
|
- `/logs` - Session logs
|
|
170
190
|
|
|
171
191
|
### Startup Scripts
|
|
@@ -265,6 +285,56 @@ sudo systemctl stop agent-swarm
|
|
|
265
285
|
|
|
266
286
|
---
|
|
267
287
|
|
|
288
|
+
## Graceful Shutdown & Task Resume
|
|
289
|
+
|
|
290
|
+
Agent Swarm supports graceful task handling during deployments and container restarts.
|
|
291
|
+
|
|
292
|
+
### How It Works
|
|
293
|
+
|
|
294
|
+
When a worker container receives SIGTERM (e.g., during `docker-compose down` or Kubernetes rollout):
|
|
295
|
+
|
|
296
|
+
1. **Grace period starts** - Worker waits for active tasks to complete (default: 30s, configurable via `SHUTDOWN_TIMEOUT`)
|
|
297
|
+
2. **Tasks are paused** - Any tasks still running after the grace period are marked as `paused` (not `failed`)
|
|
298
|
+
3. **State preserved** - Task progress and context are saved to the database
|
|
299
|
+
4. **On restart** - Worker automatically fetches and resumes its paused tasks with full context
|
|
300
|
+
|
|
301
|
+
### Task States During Shutdown
|
|
302
|
+
|
|
303
|
+
| State | Description |
|
|
304
|
+
|-------|-------------|
|
|
305
|
+
| `in_progress` | Task completes normally if it finishes within grace period |
|
|
306
|
+
| `paused` | Task is paused for resume after restart |
|
|
307
|
+
| `failed` | Only used if pause API fails (fallback) |
|
|
308
|
+
|
|
309
|
+
### Configuration
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Grace period before force-pausing tasks (milliseconds)
|
|
313
|
+
SHUTDOWN_TIMEOUT=30000
|
|
314
|
+
|
|
315
|
+
# Docker compose stop grace period (should be >= SHUTDOWN_TIMEOUT + buffer)
|
|
316
|
+
stop_grace_period: 60s
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Resume Behavior
|
|
320
|
+
|
|
321
|
+
When a worker starts, it:
|
|
322
|
+
|
|
323
|
+
1. Registers with the MCP server
|
|
324
|
+
2. Checks for paused tasks assigned to its `AGENT_ID`
|
|
325
|
+
3. Resumes each paused task with context:
|
|
326
|
+
- Original task description
|
|
327
|
+
- Previous progress (if any was saved)
|
|
328
|
+
- Notification that this is a resumed task
|
|
329
|
+
|
|
330
|
+
### Best Practices
|
|
331
|
+
|
|
332
|
+
- **Use stable Agent IDs** - Set explicit `AGENT_ID` for each worker to enable resume after restarts
|
|
333
|
+
- **Save progress regularly** - Workers should call `store-progress` during long tasks
|
|
334
|
+
- **Test deployments** - Verify tasks resume correctly in staging before production
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
268
338
|
## Environment Variables
|
|
269
339
|
|
|
270
340
|
### Docker Worker Variables
|
|
@@ -273,24 +343,168 @@ sudo systemctl stop agent-swarm
|
|
|
273
343
|
|----------|----------|-------------|
|
|
274
344
|
| `CLAUDE_CODE_OAUTH_TOKEN` | Yes | OAuth token for Claude CLI (run `claude setup-token`) |
|
|
275
345
|
| `API_KEY` | Yes | API key for MCP server |
|
|
276
|
-
| `AGENT_ID` | No | Agent UUID (assigned on join if not set) |
|
|
346
|
+
| `AGENT_ID` | No | Agent UUID (assigned on join if not set). **Keep stable for task resume.** |
|
|
347
|
+
| `AGENT_ROLE` | No | Role: `worker` (default) or `lead` |
|
|
348
|
+
| `AGENT_NAME` | No | Display name for the agent (auto-generated if not set) |
|
|
277
349
|
| `MCP_BASE_URL` | No | MCP server URL (default: `http://host.docker.internal:3013`) |
|
|
278
350
|
| `SESSION_ID` | No | Log folder name (auto-generated if not provided) |
|
|
279
|
-
| `
|
|
280
|
-
| `
|
|
281
|
-
| `
|
|
351
|
+
| `YOLO` | No | Continue on errors (default: `false`) |
|
|
352
|
+
| `SYSTEM_PROMPT` | No | Custom system prompt text |
|
|
353
|
+
| `SYSTEM_PROMPT_FILE` | No | Path to system prompt file |
|
|
282
354
|
| `STARTUP_SCRIPT_STRICT` | No | Exit on startup script failure (default: `true`) |
|
|
355
|
+
| `SHUTDOWN_TIMEOUT` | No | Grace period in ms before pausing tasks (default: `30000`) |
|
|
356
|
+
| `MAX_CONCURRENT_TASKS` | No | Maximum parallel tasks per worker (default: `1`) |
|
|
283
357
|
| `SWARM_URL` | No | Base domain for service URLs (default: `localhost`) |
|
|
284
358
|
| `SERVICE_PORT` | No | Host port for exposed services (default: `3000`) |
|
|
285
359
|
| `PM2_HOME` | No | PM2 state directory (default: `/workspace/.pm2`) |
|
|
360
|
+
| `GITHUB_TOKEN` | No | GitHub token for git operations |
|
|
361
|
+
| `GITHUB_EMAIL` | No | Git commit email (default: `worker-agent@desplega.ai`) |
|
|
362
|
+
| `GITHUB_NAME` | No | Git commit name (default: `Worker Agent`) |
|
|
363
|
+
| `SENTRY_AUTH_TOKEN` | No | Sentry Organization Auth Token for issue investigation |
|
|
364
|
+
| `SENTRY_ORG` | No | Sentry organization slug |
|
|
286
365
|
|
|
287
366
|
### Server Variables
|
|
288
367
|
|
|
289
368
|
| Variable | Description | Default |
|
|
290
369
|
|----------|-------------|---------|
|
|
291
|
-
| `
|
|
292
|
-
| `PORT` | Port for self-hosted MCP server | `3013` |
|
|
370
|
+
| `PORT` | Port for MCP HTTP server | `3013` |
|
|
293
371
|
| `API_KEY` | API key for server authentication | - |
|
|
372
|
+
| `MCP_BASE_URL` | Base URL (for setup command) | `https://agent-swarm-mcp.desplega.sh` |
|
|
373
|
+
| `SWARM_URL` | Base domain for service discovery | `localhost` |
|
|
374
|
+
| `APP_URL` | Dashboard URL for Slack message links | - |
|
|
375
|
+
| `ENV` | Environment mode (`development` adds prefix to Slack agent names) | - |
|
|
376
|
+
| `SCHEDULER_INTERVAL_MS` | Polling interval for scheduled tasks | `10000` |
|
|
377
|
+
| `DATABASE_PATH` | SQLite database file path | `./agent-swarm-db.sqlite` |
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Slack Integration
|
|
382
|
+
|
|
383
|
+
Enable Slack for task creation and agent communication via direct messages.
|
|
384
|
+
|
|
385
|
+
### Setup
|
|
386
|
+
|
|
387
|
+
1. Create a Slack App at https://api.slack.com/apps
|
|
388
|
+
2. Enable Socket Mode (for real-time events without public webhooks)
|
|
389
|
+
3. Add required scopes: `chat:write`, `users:read`, `users:read.email`, `channels:history`, `im:history`
|
|
390
|
+
4. Install to workspace and copy tokens
|
|
391
|
+
|
|
392
|
+
### Configuration
|
|
393
|
+
|
|
394
|
+
```bash
|
|
395
|
+
# Required for Slack
|
|
396
|
+
SLACK_BOT_TOKEN=xoxb-... # Bot User OAuth Token
|
|
397
|
+
SLACK_APP_TOKEN=xapp-... # App-Level Token (Socket Mode)
|
|
398
|
+
SLACK_SIGNING_SECRET=... # Signing Secret (optional for Socket Mode)
|
|
399
|
+
|
|
400
|
+
# Disable Slack (if not using)
|
|
401
|
+
SLACK_DISABLE=true
|
|
402
|
+
|
|
403
|
+
# Optional: Filter allowed users
|
|
404
|
+
SLACK_ALLOWED_EMAIL_DOMAINS=company.com,partner.com # Comma-separated email domains
|
|
405
|
+
SLACK_ALLOWED_USER_IDS=U12345678,U87654321 # Comma-separated user IDs to always allow
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### User Filtering
|
|
409
|
+
|
|
410
|
+
By default, all Slack users can interact with the bot. To restrict access:
|
|
411
|
+
|
|
412
|
+
- **Email domains**: Only users with matching email domains can send messages
|
|
413
|
+
- **User ID whitelist**: Specific user IDs are always allowed (useful for admins or service accounts)
|
|
414
|
+
|
|
415
|
+
If both are set, a user must match **either** an allowed domain **or** be in the user ID whitelist.
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## GitHub App Integration
|
|
420
|
+
|
|
421
|
+
Enable GitHub webhooks for automated task creation from PR reviews and issue assignments.
|
|
422
|
+
|
|
423
|
+
### Setup
|
|
424
|
+
|
|
425
|
+
1. Create a GitHub App at https://github.com/settings/apps/new
|
|
426
|
+
2. Set webhook URL to your server: `https://your-server.com/github/webhook`
|
|
427
|
+
3. Generate a webhook secret
|
|
428
|
+
4. (Optional) Generate a private key for bot reactions
|
|
429
|
+
|
|
430
|
+
### Configuration
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Required for GitHub webhooks
|
|
434
|
+
GITHUB_WEBHOOK_SECRET=your-webhook-secret
|
|
435
|
+
|
|
436
|
+
# Optional: Disable GitHub integration
|
|
437
|
+
GITHUB_DISABLE=true
|
|
438
|
+
|
|
439
|
+
# Optional: Bot name for @mentions (default: agent-swarm-bot)
|
|
440
|
+
GITHUB_BOT_NAME=your-bot-name
|
|
441
|
+
|
|
442
|
+
# Optional: Enable bot reactions (requires GitHub App)
|
|
443
|
+
GITHUB_APP_ID=123456
|
|
444
|
+
GITHUB_APP_PRIVATE_KEY=-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----
|
|
445
|
+
# Or use base64-encoded private key:
|
|
446
|
+
GITHUB_APP_PRIVATE_KEY=base64-encoded-key
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### Supported Events
|
|
450
|
+
|
|
451
|
+
| Event | Action |
|
|
452
|
+
|-------|--------|
|
|
453
|
+
| PR assigned to bot | Creates task for lead agent |
|
|
454
|
+
| Review requested from bot | Creates review task |
|
|
455
|
+
| PR/Issue comment @mentioning bot | Creates task with context |
|
|
456
|
+
| Issue assigned to bot | Creates task for lead agent |
|
|
457
|
+
|
|
458
|
+
### Bot Reactions
|
|
459
|
+
|
|
460
|
+
If GitHub App credentials are provided, the bot can react to comments/issues to acknowledge receipt.
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Sentry Integration
|
|
465
|
+
|
|
466
|
+
Docker workers include `sentry-cli` pre-installed, enabling agents to investigate and triage Sentry issues directly.
|
|
467
|
+
|
|
468
|
+
### Setup
|
|
469
|
+
|
|
470
|
+
1. Create an Organization Auth Token at `https://sentry.io/settings/{org}/auth-tokens/` with scopes:
|
|
471
|
+
- `event:read` - Read issues and events
|
|
472
|
+
- `project:read` - Read project data
|
|
473
|
+
- `org:read` - Read organization info
|
|
474
|
+
|
|
475
|
+
2. Add to `.env.docker` or `.env`:
|
|
476
|
+
```bash
|
|
477
|
+
SENTRY_AUTH_TOKEN=your-auth-token
|
|
478
|
+
SENTRY_ORG=your-org-slug
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
3. Verify authentication in a worker:
|
|
482
|
+
```bash
|
|
483
|
+
sentry-cli info
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
### Agent Commands
|
|
487
|
+
|
|
488
|
+
| Command | Description |
|
|
489
|
+
|---------|-------------|
|
|
490
|
+
| `/investigate-sentry-issue <url-or-id>` | Investigate a Sentry issue, get stacktrace, and triage |
|
|
491
|
+
|
|
492
|
+
### Usage
|
|
493
|
+
|
|
494
|
+
Workers can use the `/investigate-sentry-issue` command to:
|
|
495
|
+
- Get issue details and stacktraces
|
|
496
|
+
- Analyze breadcrumbs and context
|
|
497
|
+
- Resolve, mute, or unresolve issues
|
|
498
|
+
|
|
499
|
+
Example:
|
|
500
|
+
```
|
|
501
|
+
/investigate-sentry-issue https://sentry.io/organizations/myorg/issues/123456/
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
Or just the issue ID:
|
|
505
|
+
```
|
|
506
|
+
/investigate-sentry-issue 123456
|
|
507
|
+
```
|
|
294
508
|
|
|
295
509
|
---
|
|
296
510
|
|
|
@@ -319,14 +533,14 @@ bunx @desplega.ai/agent-swarm lead --system-prompt-file ./prompts/coordinator.tx
|
|
|
319
533
|
docker run --rm -it \
|
|
320
534
|
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
321
535
|
-e API_KEY=your-api-key \
|
|
322
|
-
-e
|
|
536
|
+
-e SYSTEM_PROMPT="You are a Python specialist." \
|
|
323
537
|
ghcr.io/desplega-ai/agent-swarm-worker
|
|
324
538
|
|
|
325
539
|
# Using system prompt file
|
|
326
540
|
docker run --rm -it \
|
|
327
541
|
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
328
542
|
-e API_KEY=your-api-key \
|
|
329
|
-
-e
|
|
543
|
+
-e SYSTEM_PROMPT_FILE=/workspace/prompts/specialist.txt \
|
|
330
544
|
-v ./work:/workspace \
|
|
331
545
|
ghcr.io/desplega-ai/agent-swarm-worker
|
|
332
546
|
```
|
|
@@ -334,7 +548,7 @@ docker run --rm -it \
|
|
|
334
548
|
### Priority
|
|
335
549
|
|
|
336
550
|
- CLI flags > Environment variables
|
|
337
|
-
- Inline text (
|
|
551
|
+
- Inline text (`SYSTEM_PROMPT`) > File (`SYSTEM_PROMPT_FILE`)
|
|
338
552
|
|
|
339
553
|
---
|
|
340
554
|
|
package/Dockerfile.worker
CHANGED
|
@@ -30,7 +30,7 @@ RUN apt-get update && apt-get install -y \
|
|
|
30
30
|
# Python
|
|
31
31
|
python3 python3-pip python3-venv \
|
|
32
32
|
# Common utilities
|
|
33
|
-
jq tree htop unzip zip tar gzip \
|
|
33
|
+
jq tree htop unzip zip tar gzip sqlite3 \
|
|
34
34
|
# Network tools
|
|
35
35
|
openssh-client \
|
|
36
36
|
# sudo for package installation
|
|
@@ -42,9 +42,6 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
|
|
42
42
|
&& apt-get install -y nodejs \
|
|
43
43
|
&& rm -rf /var/lib/apt/lists/*
|
|
44
44
|
|
|
45
|
-
# Install PM2 globally for process management
|
|
46
|
-
RUN npm install -g pm2
|
|
47
|
-
|
|
48
45
|
# Install GitHub CLI
|
|
49
46
|
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
50
47
|
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
@@ -102,6 +99,26 @@ USER root
|
|
|
102
99
|
COPY --from=builder /build/agent-swarm /usr/local/bin/agent-swarm
|
|
103
100
|
RUN chmod +x /usr/local/bin/agent-swarm
|
|
104
101
|
|
|
102
|
+
# Install step (at the end to leverage caching)
|
|
103
|
+
|
|
104
|
+
# Install PM2 globally for process management
|
|
105
|
+
RUN npm install -g pm2
|
|
106
|
+
|
|
107
|
+
# Install ai-tracker for tracking AI vs human code changes
|
|
108
|
+
RUN pip3 install --break-system-packages cc-ai-tracker
|
|
109
|
+
|
|
110
|
+
# Install wts (git worktree manager) globally for agents
|
|
111
|
+
RUN npm install -g @desplega.ai/wts@latest
|
|
112
|
+
|
|
113
|
+
# Install sentry-cli for issue investigation
|
|
114
|
+
RUN npm install -g @sentry/cli
|
|
115
|
+
|
|
116
|
+
# Install qa-use (QA tool) globally
|
|
117
|
+
RUN npm install -g @desplega.ai/qa-use@latest
|
|
118
|
+
|
|
119
|
+
# Install qa-use dependencies
|
|
120
|
+
RUN qa-use install-deps
|
|
121
|
+
|
|
105
122
|
# Copy commands
|
|
106
123
|
COPY --chown=worker:worker plugin/commands/* /home/worker/.claude/commands/
|
|
107
124
|
COPY --chown=worker:worker plugin/agents/* /home/worker/.claude/agents/
|
package/MCP.md
CHANGED
|
@@ -14,6 +14,13 @@
|
|
|
14
14
|
- [get-task-details](#get-task-details)
|
|
15
15
|
- [store-progress](#store-progress)
|
|
16
16
|
- [my-agent-info](#my-agent-info)
|
|
17
|
+
- [cancel-task](#cancel-task)
|
|
18
|
+
- [slack-reply](#slack-reply)
|
|
19
|
+
- [slack-read](#slack-read)
|
|
20
|
+
- [slack-post](#slack-post)
|
|
21
|
+
- [slack-list-channels](#slack-list-channels)
|
|
22
|
+
- [inbox-delegate](#inbox-delegate)
|
|
23
|
+
- [get-inbox-message](#get-inbox-message)
|
|
17
24
|
- [Task Pool Tools](#task-pool-tools)
|
|
18
25
|
- [task-action](#task-action)
|
|
19
26
|
- [Messaging Tools](#messaging-tools)
|
|
@@ -28,6 +35,12 @@
|
|
|
28
35
|
- [unregister-service](#unregister-service)
|
|
29
36
|
- [list-services](#list-services)
|
|
30
37
|
- [update-service-status](#update-service-status)
|
|
38
|
+
- [Scheduling Tools](#scheduling-tools)
|
|
39
|
+
- [list-schedules](#list-schedules)
|
|
40
|
+
- [create-schedule](#create-schedule)
|
|
41
|
+
- [update-schedule](#update-schedule)
|
|
42
|
+
- [delete-schedule](#delete-schedule)
|
|
43
|
+
- [run-schedule-now](#run-schedule-now)
|
|
31
44
|
|
|
32
45
|
---
|
|
33
46
|
|
|
@@ -121,6 +134,78 @@ Returns your agent ID based on the X-Agent-ID header.
|
|
|
121
134
|
|
|
122
135
|
*No parameters*
|
|
123
136
|
|
|
137
|
+
### cancel-task
|
|
138
|
+
|
|
139
|
+
**Cancel Task**
|
|
140
|
+
|
|
141
|
+
Cancel a task that is pending or in progress. Only the lead or task creator can cancel tasks. The worker will be notified via hooks.
|
|
142
|
+
|
|
143
|
+
| Parameter | Type | Required | Default | Description |
|
|
144
|
+
|-----------|------|----------|---------|-------------|
|
|
145
|
+
| `taskId` | `uuid` | Yes | - | The ID of the task to cancel. |
|
|
146
|
+
| `reason` | `string` | No | - | Reason for cancellation. |
|
|
147
|
+
|
|
148
|
+
### slack-reply
|
|
149
|
+
|
|
150
|
+
**Reply to Slack thread**
|
|
151
|
+
|
|
152
|
+
Send a reply to a Slack thread. Use inboxMessageId for inbox messages, or taskId for task-related threads.
|
|
153
|
+
|
|
154
|
+
| Parameter | Type | Required | Default | Description |
|
|
155
|
+
|-----------|------|----------|---------|-------------|
|
|
156
|
+
| `message` | `string` | Yes | - | The message to send to the Slack thread. |
|
|
157
|
+
|
|
158
|
+
### slack-read
|
|
159
|
+
|
|
160
|
+
**Read Slack thread/channel history**
|
|
161
|
+
|
|
162
|
+
Read messages from a Slack thread or channel. Use inboxMessageId or taskId to read from a thread you have context for, or provide channelId directly for channel history (leads only).
|
|
163
|
+
|
|
164
|
+
| Parameter | Type | Required | Default | Description |
|
|
165
|
+
|-----------|------|----------|---------|-------------|
|
|
166
|
+
| `inboxMessageId` | `uuid` | No | - | Read thread history for an inbox message. |
|
|
167
|
+
| `taskId` | `uuid` | No | - | Read thread history for a task. |
|
|
168
|
+
|
|
169
|
+
### slack-post
|
|
170
|
+
|
|
171
|
+
**Post new message to Slack channel**
|
|
172
|
+
|
|
173
|
+
Post a new message to a Slack channel. This creates a new message (not a thread reply). Requires lead privileges.
|
|
174
|
+
|
|
175
|
+
| Parameter | Type | Required | Default | Description |
|
|
176
|
+
|-----------|------|----------|---------|-------------|
|
|
177
|
+
| `channelId` | `string` | Yes | - | The Slack channel ID to post to. |
|
|
178
|
+
| `message` | `string` | Yes | - | The message content to post. |
|
|
179
|
+
|
|
180
|
+
### slack-list-channels
|
|
181
|
+
|
|
182
|
+
**List Slack channels**
|
|
183
|
+
|
|
184
|
+
List Slack channels the bot is a member of. Use this to discover available channels for reading messages.
|
|
185
|
+
|
|
186
|
+
*No parameters*
|
|
187
|
+
|
|
188
|
+
### inbox-delegate
|
|
189
|
+
|
|
190
|
+
**Delegate inbox message to worker**
|
|
191
|
+
|
|
192
|
+
Delegate an inbox message to a worker agent by creating a task. The task inherits Slack context for replies.
|
|
193
|
+
|
|
194
|
+
| Parameter | Type | Required | Default | Description |
|
|
195
|
+
|-----------|------|----------|---------|-------------|
|
|
196
|
+
| `inboxMessageId` | `uuid` | Yes | - | The inbox message ID to delegate. |
|
|
197
|
+
| `agentId` | `uuid` | Yes | - | The worker agent to delegate to. |
|
|
198
|
+
|
|
199
|
+
### get-inbox-message
|
|
200
|
+
|
|
201
|
+
**Get inbox message details**
|
|
202
|
+
|
|
203
|
+
Returns detailed information about a specific inbox message, including full content and Slack context. Only accessible to the lead agent who owns the message.
|
|
204
|
+
|
|
205
|
+
| Parameter | Type | Required | Default | Description |
|
|
206
|
+
|-----------|------|----------|---------|-------------|
|
|
207
|
+
| `inboxMessageId` | `uuid` | Yes | - | The ID of the inbox message to retrieve. |
|
|
208
|
+
|
|
124
209
|
## Task Pool Tools
|
|
125
210
|
|
|
126
211
|
*Messaging*
|
|
@@ -191,10 +276,11 @@ Reads messages from a channel. If no channel is specified, returns unread messag
|
|
|
191
276
|
|
|
192
277
|
**Update Profile**
|
|
193
278
|
|
|
194
|
-
Updates the calling agent's profile information (description, role, capabilities).
|
|
279
|
+
Updates the calling agent's profile information (name, description, role, capabilities).
|
|
195
280
|
|
|
196
281
|
| Parameter | Type | Required | Default | Description |
|
|
197
282
|
|-----------|------|----------|---------|-------------|
|
|
283
|
+
| `name` | `string` | No | - | Agent name. |
|
|
198
284
|
| `description` | `string` | No | - | Agent description. |
|
|
199
285
|
|
|
200
286
|
## Services Tools
|
|
@@ -247,3 +333,74 @@ Update the health status of a registered service. Use this after a service becom
|
|
|
247
333
|
| `serviceId` | `uuid` | No | - | Service ID to update. |
|
|
248
334
|
| `name` | `string` | No | - | Service name to update (alternative to serviceId). |
|
|
249
335
|
|
|
336
|
+
## Scheduling Tools
|
|
337
|
+
|
|
338
|
+
*Scheduling*
|
|
339
|
+
|
|
340
|
+
### list-schedules
|
|
341
|
+
|
|
342
|
+
**List Scheduled Tasks**
|
|
343
|
+
|
|
344
|
+
View all scheduled tasks with optional filters. Use this to discover existing schedules.
|
|
345
|
+
|
|
346
|
+
| Parameter | Type | Required | Default | Description |
|
|
347
|
+
|-----------|------|----------|---------|-------------|
|
|
348
|
+
| `enabled` | `boolean` | No | - | Filter by enabled status |
|
|
349
|
+
| `name` | `string` | No | - | Filter by name (partial match) |
|
|
350
|
+
|
|
351
|
+
### create-schedule
|
|
352
|
+
|
|
353
|
+
**Create Scheduled Task**
|
|
354
|
+
|
|
355
|
+
Create a new scheduled task that will automatically create agent tasks at specified intervals. Either cronExpression or intervalMs must be provided.
|
|
356
|
+
|
|
357
|
+
| Parameter | Type | Required | Default | Description |
|
|
358
|
+
|-----------|------|----------|---------|-------------|
|
|
359
|
+
| `description` | `string` | No | - | Human-readable description of the schedule |
|
|
360
|
+
| `tags` | `array` | No | - | Tags to apply to created tasks |
|
|
361
|
+
| `timezone` | `string` | No | "UTC" | Timezone for cron schedules |
|
|
362
|
+
|
|
363
|
+
### update-schedule
|
|
364
|
+
|
|
365
|
+
**Update Scheduled Task**
|
|
366
|
+
|
|
367
|
+
Update an existing scheduled task. Only the creator or lead agent can update schedules.
|
|
368
|
+
|
|
369
|
+
| Parameter | Type | Required | Default | Description |
|
|
370
|
+
|-----------|------|----------|---------|-------------|
|
|
371
|
+
| `scheduleId` | `string` | No | - | Schedule ID to update |
|
|
372
|
+
| `name` | `string` | No | - | Schedule name to update (alternative to ID) |
|
|
373
|
+
| `newName` | `string` | No | - | New name for the schedule |
|
|
374
|
+
| `taskTemplate` | `string` | No | - | New task template |
|
|
375
|
+
| `cronExpression` | `string` | No | - | New cron expression |
|
|
376
|
+
| `intervalMs` | `number` | No | - | New interval in milliseconds |
|
|
377
|
+
| `description` | `string` | No | - | New description |
|
|
378
|
+
| `taskType` | `string` | No | - | New task type |
|
|
379
|
+
| `tags` | `array` | No | - | New tags |
|
|
380
|
+
| `priority` | `number` | No | - | New priority |
|
|
381
|
+
| `targetAgentId` | `string` | No | - | New target agent ID |
|
|
382
|
+
| `timezone` | `string` | No | - | New timezone |
|
|
383
|
+
| `enabled` | `boolean` | No | - | Enable or disable the schedule |
|
|
384
|
+
|
|
385
|
+
### delete-schedule
|
|
386
|
+
|
|
387
|
+
**Delete Scheduled Task**
|
|
388
|
+
|
|
389
|
+
Delete a scheduled task permanently. Only the creator or lead agent can delete schedules.
|
|
390
|
+
|
|
391
|
+
| Parameter | Type | Required | Default | Description |
|
|
392
|
+
|-----------|------|----------|---------|-------------|
|
|
393
|
+
| `scheduleId` | `string` | No | - | Schedule ID to delete |
|
|
394
|
+
| `name` | `string` | No | - | Schedule name to delete (alternative to ID) |
|
|
395
|
+
|
|
396
|
+
### run-schedule-now
|
|
397
|
+
|
|
398
|
+
**Run Schedule Now**
|
|
399
|
+
|
|
400
|
+
Immediately execute a scheduled task, creating a task right away. Does not affect the regular schedule timing.
|
|
401
|
+
|
|
402
|
+
| Parameter | Type | Required | Default | Description |
|
|
403
|
+
|-----------|------|----------|---------|-------------|
|
|
404
|
+
| `scheduleId` | `string` | No | - | Schedule ID to run |
|
|
405
|
+
| `name` | `string` | No | - | Schedule name to run (alternative to ID) |
|
|
406
|
+
|
package/README.md
CHANGED
|
@@ -52,6 +52,81 @@ The dashboard runs at `http://localhost:5173` by default.
|
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
+
## GitHub Integration
|
|
56
|
+
|
|
57
|
+
Agent Swarm can receive tasks from GitHub via webhooks. When someone mentions `@agent-swarm-bot` (or your configured bot name) in an issue, PR, or comment, a task is automatically created for the lead agent.
|
|
58
|
+
|
|
59
|
+
### Setup
|
|
60
|
+
|
|
61
|
+
1. Create a GitHub App at https://github.com/settings/apps/new
|
|
62
|
+
2. Set the webhook URL to `https://your-server.com/api/github/webhook`
|
|
63
|
+
3. Generate a webhook secret and add to `.env`:
|
|
64
|
+
```bash
|
|
65
|
+
GITHUB_WEBHOOK_SECRET=your-secret
|
|
66
|
+
GITHUB_BOT_NAME=agent-swarm-bot # optional, default: agent-swarm-bot
|
|
67
|
+
```
|
|
68
|
+
4. Enable webhook events: Issues, Issue comment, Pull request, Pull request review comment
|
|
69
|
+
5. Install the app on your repositories
|
|
70
|
+
|
|
71
|
+
### Agent Commands
|
|
72
|
+
|
|
73
|
+
| Command | Description |
|
|
74
|
+
|---------|-------------|
|
|
75
|
+
| `/implement-issue` | Read issue, implement changes, create PR |
|
|
76
|
+
| `/review-pr` | Analyze and review a pull request |
|
|
77
|
+
| `/create-pr` | Create PR from current branch changes |
|
|
78
|
+
| `/close-issue` | Close issue with summary comment |
|
|
79
|
+
| `/respond-github` | Comment on an issue or PR |
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Sentry Integration
|
|
84
|
+
|
|
85
|
+
Docker workers include `sentry-cli` pre-installed, enabling agents to investigate and triage Sentry issues directly. This is useful for debugging errors reported via Slack alerts.
|
|
86
|
+
|
|
87
|
+
### Setup
|
|
88
|
+
|
|
89
|
+
1. Create an Organization Auth Token at `https://sentry.io/settings/{org}/auth-tokens/` with scopes:
|
|
90
|
+
- `event:read` - Read issues and events
|
|
91
|
+
- `project:read` - Read project data
|
|
92
|
+
- `org:read` - Read organization info
|
|
93
|
+
|
|
94
|
+
2. Add to `.env.docker`:
|
|
95
|
+
```bash
|
|
96
|
+
SENTRY_AUTH_TOKEN=your-auth-token
|
|
97
|
+
SENTRY_ORG=your-org-slug
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. Verify authentication in a worker:
|
|
101
|
+
```bash
|
|
102
|
+
sentry-cli info
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Agent Commands
|
|
106
|
+
|
|
107
|
+
| Command | Description |
|
|
108
|
+
|---------|-------------|
|
|
109
|
+
| `/investigate-sentry-issue <url-or-id>` | Investigate a Sentry issue, get stacktrace, and triage |
|
|
110
|
+
|
|
111
|
+
### Usage
|
|
112
|
+
|
|
113
|
+
Workers can use the `/investigate-sentry-issue` command to:
|
|
114
|
+
- Get issue details and stacktraces
|
|
115
|
+
- Analyze breadcrumbs and context
|
|
116
|
+
- Resolve, mute, or unresolve issues
|
|
117
|
+
|
|
118
|
+
Example:
|
|
119
|
+
```
|
|
120
|
+
/investigate-sentry-issue https://sentry.io/organizations/myorg/issues/123456/
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Or just the issue ID:
|
|
124
|
+
```
|
|
125
|
+
/investigate-sentry-issue 123456
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
55
130
|
## Quick Start
|
|
56
131
|
|
|
57
132
|
The recommended setup: run the API locally, run a Docker worker, and connect Claude Code as the lead agent.
|