@desplega.ai/agent-swarm 1.2.0 → 1.9.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 +20 -1
- package/.dockerignore +3 -0
- package/.env.docker.example +22 -1
- package/.env.example +17 -0
- package/.github/workflows/docker-publish.yml +92 -0
- package/CONTRIBUTING.md +270 -0
- package/DEPLOYMENT.md +391 -0
- package/Dockerfile.worker +29 -1
- package/FAQ.md +19 -0
- package/LICENSE +21 -0
- package/MCP.md +249 -0
- package/README.md +105 -185
- package/assets/agent-swarm-logo-orange.png +0 -0
- package/assets/agent-swarm-logo.png +0 -0
- package/assets/agent-swarm.png +0 -0
- package/deploy/docker-push.ts +30 -0
- package/docker-compose.example.yml +137 -0
- package/docker-entrypoint.sh +223 -7
- package/package.json +13 -4
- package/{cc-plugin → plugin}/.claude-plugin/plugin.json +1 -1
- package/plugin/README.md +1 -0
- package/plugin/agents/.gitkeep +0 -0
- package/plugin/agents/codebase-analyzer.md +143 -0
- package/plugin/agents/codebase-locator.md +122 -0
- package/plugin/agents/codebase-pattern-finder.md +227 -0
- package/plugin/agents/web-search-researcher.md +109 -0
- package/plugin/commands/create-plan.md +415 -0
- package/plugin/commands/implement-plan.md +89 -0
- package/plugin/commands/research.md +200 -0
- package/plugin/commands/start-leader.md +101 -0
- package/plugin/commands/start-worker.md +56 -0
- package/plugin/commands/swarm-chat.md +78 -0
- package/plugin/commands/todos.md +66 -0
- package/plugin/commands/work-on-task.md +44 -0
- package/plugin/skills/.gitkeep +0 -0
- package/scripts/generate-mcp-docs.ts +415 -0
- package/slack-manifest.json +69 -0
- package/src/be/db.ts +1431 -25
- package/src/cli.tsx +135 -11
- package/src/commands/lead.ts +13 -0
- package/src/commands/runner.ts +255 -0
- package/src/commands/setup.tsx +5 -5
- package/src/commands/worker.ts +8 -220
- package/src/hooks/hook.ts +108 -14
- package/src/http.ts +361 -5
- package/src/prompts/base-prompt.ts +131 -0
- package/src/server.ts +56 -0
- package/src/slack/app.ts +73 -0
- package/src/slack/commands.ts +88 -0
- package/src/slack/handlers.ts +281 -0
- package/src/slack/index.ts +3 -0
- package/src/slack/responses.ts +175 -0
- package/src/slack/router.ts +170 -0
- package/src/slack/types.ts +20 -0
- package/src/slack/watcher.ts +119 -0
- package/src/tools/create-channel.ts +80 -0
- package/src/tools/get-tasks.ts +54 -21
- package/src/tools/join-swarm.ts +28 -4
- package/src/tools/list-channels.ts +37 -0
- package/src/tools/list-services.ts +110 -0
- package/src/tools/poll-task.ts +47 -3
- package/src/tools/post-message.ts +87 -0
- package/src/tools/read-messages.ts +192 -0
- package/src/tools/register-service.ts +118 -0
- package/src/tools/send-task.ts +80 -7
- package/src/tools/store-progress.ts +9 -3
- package/src/tools/task-action.ts +211 -0
- package/src/tools/unregister-service.ts +110 -0
- package/src/tools/update-profile.ts +105 -0
- package/src/tools/update-service-status.ts +118 -0
- package/src/types.ts +110 -3
- package/src/utils/pretty-print.ts +224 -0
- package/thoughts/shared/plans/.gitkeep +0 -0
- package/thoughts/shared/plans/2025-12-18-inverse-teleport.md +1142 -0
- package/thoughts/shared/plans/2025-12-18-slack-integration.md +1195 -0
- package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +732 -0
- package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +361 -0
- package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +501 -0
- package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +560 -0
- package/thoughts/shared/research/.gitkeep +0 -0
- package/thoughts/shared/research/2025-12-18-slack-integration.md +442 -0
- package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +339 -0
- package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +390 -0
- package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +376 -0
- package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +264 -0
- package/tsconfig.json +3 -1
- package/ui/bun.lock +692 -0
- package/ui/index.html +22 -0
- package/ui/package.json +32 -0
- package/ui/pnpm-lock.yaml +3034 -0
- package/ui/postcss.config.js +6 -0
- package/ui/public/logo.png +0 -0
- package/ui/src/App.tsx +43 -0
- package/ui/src/components/ActivityFeed.tsx +415 -0
- package/ui/src/components/AgentDetailPanel.tsx +534 -0
- package/ui/src/components/AgentsPanel.tsx +549 -0
- package/ui/src/components/ChatPanel.tsx +1820 -0
- package/ui/src/components/ConfigModal.tsx +232 -0
- package/ui/src/components/Dashboard.tsx +534 -0
- package/ui/src/components/Header.tsx +168 -0
- package/ui/src/components/ServicesPanel.tsx +612 -0
- package/ui/src/components/StatsBar.tsx +288 -0
- package/ui/src/components/StatusBadge.tsx +124 -0
- package/ui/src/components/TaskDetailPanel.tsx +807 -0
- package/ui/src/components/TasksPanel.tsx +575 -0
- package/ui/src/hooks/queries.ts +170 -0
- package/ui/src/index.css +235 -0
- package/ui/src/lib/api.ts +161 -0
- package/ui/src/lib/config.ts +35 -0
- package/ui/src/lib/theme.ts +214 -0
- package/ui/src/lib/utils.ts +48 -0
- package/ui/src/main.tsx +32 -0
- package/ui/src/types/api.ts +164 -0
- package/ui/src/vite-env.d.ts +1 -0
- package/ui/tailwind.config.js +35 -0
- package/ui/tsconfig.json +31 -0
- package/ui/vite.config.ts +22 -0
- package/cc-plugin/README.md +0 -49
- package/cc-plugin/commands/setup-leader.md +0 -73
- package/cc-plugin/commands/start-worker.md +0 -64
- package/docker-compose.worker.yml +0 -35
- package/example-req-meta.json +0 -24
- /package/{cc-plugin → plugin}/hooks/hooks.json +0 -0
package/DEPLOYMENT.md
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
# Deployment Guide
|
|
2
|
+
|
|
3
|
+
This guide covers all deployment options for Agent Swarm MCP.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Docker Compose (Recommended)](#docker-compose-recommended)
|
|
8
|
+
- [Docker Worker](#docker-worker)
|
|
9
|
+
- [Server Deployment (systemd)](#server-deployment-systemd)
|
|
10
|
+
- [Environment Variables](#environment-variables)
|
|
11
|
+
- [System Prompts](#system-prompts)
|
|
12
|
+
- [Service Registry (PM2)](#service-registry-pm2)
|
|
13
|
+
- [Publishing (Maintainers)](#publishing-maintainers)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Docker Compose (Recommended)
|
|
18
|
+
|
|
19
|
+
The easiest way to deploy a full swarm with API, workers, and lead agent.
|
|
20
|
+
|
|
21
|
+
### Quick Start
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Copy example files
|
|
25
|
+
cp docker-compose.example.yml docker-compose.yml
|
|
26
|
+
|
|
27
|
+
# Create a combined .env for docker-compose (combines API + worker settings)
|
|
28
|
+
# You can merge .env.example (API) and .env.docker.example (worker) settings
|
|
29
|
+
cp .env.docker.example .env
|
|
30
|
+
|
|
31
|
+
# Edit .env with your values
|
|
32
|
+
vim .env
|
|
33
|
+
|
|
34
|
+
# Start the swarm
|
|
35
|
+
docker-compose up -d
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
> **Note:** `.env.example` contains API server settings, `.env.docker.example` contains Docker worker settings. For docker-compose, you need both sets of variables in a single `.env` file.
|
|
39
|
+
|
|
40
|
+
### What's Included
|
|
41
|
+
|
|
42
|
+
The example `docker-compose.yml` sets up:
|
|
43
|
+
|
|
44
|
+
- **API service** (port 3013) - MCP HTTP server
|
|
45
|
+
- **2 Worker agents** - Containerized Claude workers
|
|
46
|
+
- **1 Lead agent** - Coordinator agent
|
|
47
|
+
|
|
48
|
+
### Configuration
|
|
49
|
+
|
|
50
|
+
Edit your `.env` file:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Required
|
|
54
|
+
API_KEY=your-secret-api-key
|
|
55
|
+
CLAUDE_CODE_OAUTH_TOKEN=your-oauth-token # Run `claude setup-token` to get this
|
|
56
|
+
|
|
57
|
+
# Agent IDs (optional, auto-generated if not set)
|
|
58
|
+
AGENT_ID=worker-1-uuid
|
|
59
|
+
AGENT_ID_2=worker-2-uuid
|
|
60
|
+
AGENT_ID_LEAD=lead-agent-uuid
|
|
61
|
+
|
|
62
|
+
# GitHub integration (optional)
|
|
63
|
+
GITHUB_TOKEN=your-github-token
|
|
64
|
+
GITHUB_EMAIL=your@email.com
|
|
65
|
+
GITHUB_NAME=Your Name
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Volumes
|
|
69
|
+
|
|
70
|
+
| Volume | Purpose |
|
|
71
|
+
|--------|---------|
|
|
72
|
+
| `swarm_api` | SQLite database persistence |
|
|
73
|
+
| `swarm_logs` | Session logs |
|
|
74
|
+
| `swarm_shared` | Shared workspace between agents |
|
|
75
|
+
| `swarm_worker_*` | Personal workspace per worker |
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Docker Worker
|
|
80
|
+
|
|
81
|
+
Run individual Claude workers in containers.
|
|
82
|
+
|
|
83
|
+
### Pull from Registry
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
docker pull ghcr.io/desplega-ai/agent-swarm-worker:latest
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Build Locally
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Build the worker image
|
|
93
|
+
docker build -f Dockerfile.worker -t agent-swarm-worker .
|
|
94
|
+
|
|
95
|
+
# Or using npm script
|
|
96
|
+
bun run docker:build:worker
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Run
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# Using pre-built image
|
|
103
|
+
docker run --rm -it \
|
|
104
|
+
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
105
|
+
-e API_KEY=your-api-key \
|
|
106
|
+
-v ./logs:/logs \
|
|
107
|
+
-v ./work:/workspace \
|
|
108
|
+
ghcr.io/desplega-ai/agent-swarm-worker
|
|
109
|
+
|
|
110
|
+
# With custom system prompt
|
|
111
|
+
docker run --rm -it \
|
|
112
|
+
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
113
|
+
-e API_KEY=your-api-key \
|
|
114
|
+
-e WORKER_SYSTEM_PROMPT="You are a Python specialist" \
|
|
115
|
+
-v ./logs:/logs \
|
|
116
|
+
-v ./work:/workspace \
|
|
117
|
+
ghcr.io/desplega-ai/agent-swarm-worker
|
|
118
|
+
|
|
119
|
+
# With system prompt from file
|
|
120
|
+
docker run --rm -it \
|
|
121
|
+
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
122
|
+
-e API_KEY=your-api-key \
|
|
123
|
+
-e WORKER_SYSTEM_PROMPT_FILE=/workspace/prompts/specialist.txt \
|
|
124
|
+
-v ./work:/workspace \
|
|
125
|
+
ghcr.io/desplega-ai/agent-swarm-worker
|
|
126
|
+
|
|
127
|
+
# Using npm script (requires .env.docker file)
|
|
128
|
+
bun run docker:run:worker
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Troubleshooting
|
|
132
|
+
|
|
133
|
+
**Permission denied when writing to /workspace**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Option 1: Fix permissions on host directory
|
|
137
|
+
chmod 777 ./work
|
|
138
|
+
|
|
139
|
+
# Option 2: Run container as your current user
|
|
140
|
+
docker run --rm -it --user $(id -u):$(id -g) \
|
|
141
|
+
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
142
|
+
-e API_KEY=your-api-key \
|
|
143
|
+
-v ./work:/workspace \
|
|
144
|
+
ghcr.io/desplega-ai/agent-swarm-worker
|
|
145
|
+
|
|
146
|
+
# Option 3: Create the file on the host first
|
|
147
|
+
touch ./work/.mcp.json
|
|
148
|
+
chmod 666 ./work/.mcp.json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Architecture
|
|
152
|
+
|
|
153
|
+
The Docker worker image uses a multi-stage build:
|
|
154
|
+
|
|
155
|
+
1. **Builder stage**: Compiles `src/cli.tsx` into a standalone binary
|
|
156
|
+
2. **Runtime stage**: Ubuntu 24.04 with full development environment
|
|
157
|
+
|
|
158
|
+
**Pre-installed tools:**
|
|
159
|
+
|
|
160
|
+
- **Languages**: Python 3, Node.js 22, Bun
|
|
161
|
+
- **Build tools**: gcc, g++, make, cmake
|
|
162
|
+
- **Process manager**: PM2 (for background services)
|
|
163
|
+
- **Utilities**: git, git-lfs, vim, nano, jq, curl, wget, ssh
|
|
164
|
+
- **Sudo access**: Worker can install packages with `sudo apt-get install`
|
|
165
|
+
|
|
166
|
+
**Volumes:**
|
|
167
|
+
|
|
168
|
+
- `/workspace` - Working directory for cloning repos
|
|
169
|
+
- `/logs` - Session logs
|
|
170
|
+
|
|
171
|
+
### Startup Scripts
|
|
172
|
+
|
|
173
|
+
Run custom initialization before the worker starts. Place a script at `/workspace/start-up.*`:
|
|
174
|
+
|
|
175
|
+
**Supported formats** (priority order):
|
|
176
|
+
- `start-up.sh` / `start-up.bash` - Bash scripts
|
|
177
|
+
- `start-up.js` - Node.js scripts
|
|
178
|
+
- `start-up.ts` / `start-up.bun` - Bun/TypeScript scripts
|
|
179
|
+
|
|
180
|
+
**Interpreter detection:**
|
|
181
|
+
1. Shebang line (e.g., `#!/usr/bin/env bun`)
|
|
182
|
+
2. File extension (`.ts` -> bun, `.js` -> node, `.sh` -> bash)
|
|
183
|
+
|
|
184
|
+
**Error handling:**
|
|
185
|
+
- `STARTUP_SCRIPT_STRICT=true` (default) - Container exits if script fails
|
|
186
|
+
- `STARTUP_SCRIPT_STRICT=false` - Logs warning and continues
|
|
187
|
+
|
|
188
|
+
**Example: Install dependencies**
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
#!/bin/bash
|
|
192
|
+
# /workspace/start-up.sh
|
|
193
|
+
|
|
194
|
+
echo "Installing dependencies..."
|
|
195
|
+
if [ -f "package.json" ]; then
|
|
196
|
+
bun install
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
sudo apt-get update -qq
|
|
200
|
+
sudo apt-get install -y -qq ripgrep
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Example: TypeScript setup**
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
#!/usr/bin/env bun
|
|
207
|
+
// /workspace/start-up.ts
|
|
208
|
+
|
|
209
|
+
console.log("Running startup...");
|
|
210
|
+
await Bun.$`bun install`;
|
|
211
|
+
|
|
212
|
+
if (!process.env.API_KEY) {
|
|
213
|
+
console.error("ERROR: API_KEY not set");
|
|
214
|
+
process.exit(1);
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Server Deployment (systemd)
|
|
221
|
+
|
|
222
|
+
Deploy the MCP server to a Linux host with systemd.
|
|
223
|
+
|
|
224
|
+
### Prerequisites
|
|
225
|
+
|
|
226
|
+
- Linux with systemd
|
|
227
|
+
- Bun installed (`curl -fsSL https://bun.sh/install | bash`)
|
|
228
|
+
|
|
229
|
+
### Install
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
git clone https://github.com/desplega-ai/agent-swarm.git
|
|
233
|
+
cd agent-swarm
|
|
234
|
+
sudo bun deploy/install.ts
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
This will:
|
|
238
|
+
- Copy files to `/opt/agent-swarm`
|
|
239
|
+
- Create `.env` file (edit to set `API_KEY`)
|
|
240
|
+
- Install systemd service with health checks every 30s
|
|
241
|
+
- Start the service on port 3013
|
|
242
|
+
|
|
243
|
+
### Update
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
git pull
|
|
247
|
+
sudo bun deploy/update.ts
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Management
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Check status
|
|
254
|
+
sudo systemctl status agent-swarm
|
|
255
|
+
|
|
256
|
+
# View logs
|
|
257
|
+
sudo journalctl -u agent-swarm -f
|
|
258
|
+
|
|
259
|
+
# Restart
|
|
260
|
+
sudo systemctl restart agent-swarm
|
|
261
|
+
|
|
262
|
+
# Stop
|
|
263
|
+
sudo systemctl stop agent-swarm
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Environment Variables
|
|
269
|
+
|
|
270
|
+
### Docker Worker Variables
|
|
271
|
+
|
|
272
|
+
| Variable | Required | Description |
|
|
273
|
+
|----------|----------|-------------|
|
|
274
|
+
| `CLAUDE_CODE_OAUTH_TOKEN` | Yes | OAuth token for Claude CLI (run `claude setup-token`) |
|
|
275
|
+
| `API_KEY` | Yes | API key for MCP server |
|
|
276
|
+
| `AGENT_ID` | No | Agent UUID (assigned on join if not set) |
|
|
277
|
+
| `MCP_BASE_URL` | No | MCP server URL (default: `http://host.docker.internal:3013`) |
|
|
278
|
+
| `SESSION_ID` | No | Log folder name (auto-generated if not provided) |
|
|
279
|
+
| `WORKER_YOLO` | No | Continue on errors (default: `false`) |
|
|
280
|
+
| `WORKER_SYSTEM_PROMPT` | No | Custom system prompt text |
|
|
281
|
+
| `WORKER_SYSTEM_PROMPT_FILE` | No | Path to system prompt file |
|
|
282
|
+
| `STARTUP_SCRIPT_STRICT` | No | Exit on startup script failure (default: `true`) |
|
|
283
|
+
| `SWARM_URL` | No | Base domain for service URLs (default: `localhost`) |
|
|
284
|
+
| `SERVICE_PORT` | No | Host port for exposed services (default: `3000`) |
|
|
285
|
+
| `PM2_HOME` | No | PM2 state directory (default: `/workspace/.pm2`) |
|
|
286
|
+
|
|
287
|
+
### Server Variables
|
|
288
|
+
|
|
289
|
+
| Variable | Description | Default |
|
|
290
|
+
|----------|-------------|---------|
|
|
291
|
+
| `MCP_BASE_URL` | Base URL for the MCP server | `https://agent-swarm-mcp.desplega.sh` |
|
|
292
|
+
| `PORT` | Port for self-hosted MCP server | `3013` |
|
|
293
|
+
| `API_KEY` | API key for server authentication | - |
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## System Prompts
|
|
298
|
+
|
|
299
|
+
Customize Claude's behavior with system prompts for worker and lead agents.
|
|
300
|
+
|
|
301
|
+
### CLI Usage
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# Inline system prompt
|
|
305
|
+
bunx @desplega.ai/agent-swarm worker --system-prompt "You are a Python specialist."
|
|
306
|
+
|
|
307
|
+
# System prompt from file
|
|
308
|
+
bunx @desplega.ai/agent-swarm worker --system-prompt-file ./prompts/python-specialist.txt
|
|
309
|
+
|
|
310
|
+
# Same options work for lead agent
|
|
311
|
+
bunx @desplega.ai/agent-swarm lead --system-prompt "You are a project coordinator."
|
|
312
|
+
bunx @desplega.ai/agent-swarm lead --system-prompt-file ./prompts/coordinator.txt
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Docker Usage
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
# Using inline system prompt
|
|
319
|
+
docker run --rm -it \
|
|
320
|
+
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
321
|
+
-e API_KEY=your-api-key \
|
|
322
|
+
-e WORKER_SYSTEM_PROMPT="You are a Python specialist." \
|
|
323
|
+
ghcr.io/desplega-ai/agent-swarm-worker
|
|
324
|
+
|
|
325
|
+
# Using system prompt file
|
|
326
|
+
docker run --rm -it \
|
|
327
|
+
-e CLAUDE_CODE_OAUTH_TOKEN=your-token \
|
|
328
|
+
-e API_KEY=your-api-key \
|
|
329
|
+
-e WORKER_SYSTEM_PROMPT_FILE=/workspace/prompts/specialist.txt \
|
|
330
|
+
-v ./work:/workspace \
|
|
331
|
+
ghcr.io/desplega-ai/agent-swarm-worker
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Priority
|
|
335
|
+
|
|
336
|
+
- CLI flags > Environment variables
|
|
337
|
+
- Inline text (`*_SYSTEM_PROMPT`) > File (`*_SYSTEM_PROMPT_FILE`)
|
|
338
|
+
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
## Service Registry (PM2)
|
|
342
|
+
|
|
343
|
+
Workers can run background services on port 3000 using PM2. Services are registered for discovery and auto-restart.
|
|
344
|
+
|
|
345
|
+
### PM2 Commands
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
pm2 start /workspace/app/server.js --name my-api # Start a service
|
|
349
|
+
pm2 stop|restart|delete my-api # Manage services
|
|
350
|
+
pm2 logs [name] # View logs
|
|
351
|
+
pm2 list # Show running processes
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### MCP Tools
|
|
355
|
+
|
|
356
|
+
- `register-service` - Register service for discovery and auto-restart
|
|
357
|
+
- `unregister-service` - Remove from registry
|
|
358
|
+
- `list-services` - Find services exposed by other agents
|
|
359
|
+
- `update-service-status` - Update health status
|
|
360
|
+
|
|
361
|
+
### Starting a New Service
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
# 1. Start your service with PM2
|
|
365
|
+
pm2 start /workspace/myapp/server.js --name my-api
|
|
366
|
+
|
|
367
|
+
# 2. Register it (via MCP tool)
|
|
368
|
+
# register-service name="my-api" script="/workspace/myapp/server.js"
|
|
369
|
+
|
|
370
|
+
# 3. Mark healthy when ready
|
|
371
|
+
# update-service-status name="my-api" status="healthy"
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### Service URL Pattern
|
|
375
|
+
|
|
376
|
+
`https://{service-name}.{SWARM_URL}`
|
|
377
|
+
|
|
378
|
+
### Health Checks
|
|
379
|
+
|
|
380
|
+
Implement a `/health` endpoint returning 200 OK for monitoring.
|
|
381
|
+
|
|
382
|
+
---
|
|
383
|
+
|
|
384
|
+
## Publishing (Maintainers)
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# Requires gh CLI authenticated
|
|
388
|
+
bun deploy/docker-push.ts
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
This builds, tags with version from package.json + `latest`, and pushes to GHCR.
|
package/Dockerfile.worker
CHANGED
|
@@ -42,6 +42,17 @@ 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
|
+
# Install GitHub CLI
|
|
49
|
+
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
50
|
+
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
|
|
51
|
+
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
|
|
52
|
+
&& apt-get update \
|
|
53
|
+
&& apt-get install -y gh \
|
|
54
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
55
|
+
|
|
45
56
|
# Install Bun (for running JS/TS projects)
|
|
46
57
|
RUN curl -fsSL https://bun.sh/install | bash
|
|
47
58
|
ENV BUN_INSTALL="/root/.bun"
|
|
@@ -68,6 +79,7 @@ ENV PATH="/home/worker/.local/bin:$PATH"
|
|
|
68
79
|
|
|
69
80
|
# Setup .claude directory
|
|
70
81
|
RUN mkdir -p /home/worker/.claude/commands
|
|
82
|
+
RUN mkdir -p /home/worker/.claude/agents
|
|
71
83
|
RUN echo '{"hasCompletedOnboarding":true,"bypassPermissionsModeAccepted":true}' > /home/worker/.claude.json
|
|
72
84
|
|
|
73
85
|
# Settings with hooks pointing to compiled binary
|
|
@@ -91,7 +103,9 @@ COPY --from=builder /build/agent-swarm /usr/local/bin/agent-swarm
|
|
|
91
103
|
RUN chmod +x /usr/local/bin/agent-swarm
|
|
92
104
|
|
|
93
105
|
# Copy commands
|
|
94
|
-
COPY --chown=worker:worker
|
|
106
|
+
COPY --chown=worker:worker plugin/commands/* /home/worker/.claude/commands/
|
|
107
|
+
COPY --chown=worker:worker plugin/agents/* /home/worker/.claude/agents/
|
|
108
|
+
COPY --chown=worker:worker plugin/skills/* /home/worker/.claude/skills/
|
|
95
109
|
|
|
96
110
|
# Create directories
|
|
97
111
|
RUN mkdir -p /workspace /logs && chown worker:worker /workspace /logs
|
|
@@ -103,10 +117,24 @@ USER worker
|
|
|
103
117
|
WORKDIR /workspace
|
|
104
118
|
VOLUME ["/logs"]
|
|
105
119
|
|
|
120
|
+
RUN mkdir -p ./personal ./shared
|
|
121
|
+
VOLUME ["/workspace/personal" "/workspace/shared"]
|
|
122
|
+
|
|
123
|
+
# Expose service port for PM2 processes
|
|
124
|
+
EXPOSE 3000
|
|
125
|
+
|
|
106
126
|
# Environment
|
|
127
|
+
ENV AGENT_ROLE=worker
|
|
107
128
|
ENV WORKER_YOLO=false
|
|
108
129
|
ENV MCP_BASE_URL=http://host.docker.internal:3013
|
|
109
130
|
ENV WORKER_LOG_DIR=/logs
|
|
131
|
+
ENV LEAD_LOG_DIR=/logs
|
|
132
|
+
ENV WORKER_SYSTEM_PROMPT=""
|
|
133
|
+
ENV WORKER_SYSTEM_PROMPT_FILE=""
|
|
134
|
+
ENV LEAD_SYSTEM_PROMPT=""
|
|
135
|
+
ENV LEAD_SYSTEM_PROMPT_FILE=""
|
|
136
|
+
ENV STARTUP_SCRIPT_STRICT=true
|
|
137
|
+
ENV PM2_HOME=/workspace/.pm2
|
|
110
138
|
ENV PATH="/home/worker/.local/bin:/home/worker/.bun/bin:$PATH"
|
|
111
139
|
|
|
112
140
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|
package/FAQ.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Frequently Asked Questions
|
|
2
|
+
|
|
3
|
+
> This document will be populated with common questions and answers.
|
|
4
|
+
|
|
5
|
+
## General
|
|
6
|
+
|
|
7
|
+
*Coming soon*
|
|
8
|
+
|
|
9
|
+
## Setup & Configuration
|
|
10
|
+
|
|
11
|
+
*Coming soon*
|
|
12
|
+
|
|
13
|
+
## Docker Workers
|
|
14
|
+
|
|
15
|
+
*Coming soon*
|
|
16
|
+
|
|
17
|
+
## Troubleshooting
|
|
18
|
+
|
|
19
|
+
*Coming soon*
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 desplega.ai
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|