@desplega.ai/agent-swarm 1.2.1 → 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.
Files changed (119) hide show
  1. package/.claude/settings.local.json +20 -1
  2. package/.env.docker.example +22 -1
  3. package/.env.example +17 -0
  4. package/.github/workflows/docker-publish.yml +92 -0
  5. package/CONTRIBUTING.md +270 -0
  6. package/DEPLOYMENT.md +391 -0
  7. package/Dockerfile.worker +29 -1
  8. package/FAQ.md +19 -0
  9. package/LICENSE +21 -0
  10. package/MCP.md +249 -0
  11. package/README.md +103 -207
  12. package/assets/agent-swarm-logo-orange.png +0 -0
  13. package/assets/agent-swarm-logo.png +0 -0
  14. package/docker-compose.example.yml +137 -0
  15. package/docker-entrypoint.sh +223 -7
  16. package/package.json +8 -3
  17. package/{cc-plugin → plugin}/.claude-plugin/plugin.json +1 -1
  18. package/plugin/README.md +1 -0
  19. package/plugin/agents/.gitkeep +0 -0
  20. package/plugin/agents/codebase-analyzer.md +143 -0
  21. package/plugin/agents/codebase-locator.md +122 -0
  22. package/plugin/agents/codebase-pattern-finder.md +227 -0
  23. package/plugin/agents/web-search-researcher.md +109 -0
  24. package/plugin/commands/create-plan.md +415 -0
  25. package/plugin/commands/implement-plan.md +89 -0
  26. package/plugin/commands/research.md +200 -0
  27. package/plugin/commands/start-leader.md +101 -0
  28. package/plugin/commands/start-worker.md +56 -0
  29. package/plugin/commands/swarm-chat.md +78 -0
  30. package/plugin/commands/todos.md +66 -0
  31. package/plugin/commands/work-on-task.md +44 -0
  32. package/plugin/skills/.gitkeep +0 -0
  33. package/scripts/generate-mcp-docs.ts +415 -0
  34. package/slack-manifest.json +69 -0
  35. package/src/be/db.ts +1431 -25
  36. package/src/cli.tsx +135 -11
  37. package/src/commands/lead.ts +13 -0
  38. package/src/commands/runner.ts +255 -0
  39. package/src/commands/worker.ts +8 -220
  40. package/src/hooks/hook.ts +102 -14
  41. package/src/http.ts +361 -5
  42. package/src/prompts/base-prompt.ts +131 -0
  43. package/src/server.ts +56 -0
  44. package/src/slack/app.ts +73 -0
  45. package/src/slack/commands.ts +88 -0
  46. package/src/slack/handlers.ts +281 -0
  47. package/src/slack/index.ts +3 -0
  48. package/src/slack/responses.ts +175 -0
  49. package/src/slack/router.ts +170 -0
  50. package/src/slack/types.ts +20 -0
  51. package/src/slack/watcher.ts +119 -0
  52. package/src/tools/create-channel.ts +80 -0
  53. package/src/tools/get-tasks.ts +54 -21
  54. package/src/tools/join-swarm.ts +28 -4
  55. package/src/tools/list-channels.ts +37 -0
  56. package/src/tools/list-services.ts +110 -0
  57. package/src/tools/poll-task.ts +46 -3
  58. package/src/tools/post-message.ts +87 -0
  59. package/src/tools/read-messages.ts +192 -0
  60. package/src/tools/register-service.ts +118 -0
  61. package/src/tools/send-task.ts +80 -7
  62. package/src/tools/store-progress.ts +9 -3
  63. package/src/tools/task-action.ts +211 -0
  64. package/src/tools/unregister-service.ts +110 -0
  65. package/src/tools/update-profile.ts +105 -0
  66. package/src/tools/update-service-status.ts +118 -0
  67. package/src/types.ts +110 -3
  68. package/src/utils/pretty-print.ts +224 -0
  69. package/thoughts/shared/plans/.gitkeep +0 -0
  70. package/thoughts/shared/plans/2025-12-18-inverse-teleport.md +1142 -0
  71. package/thoughts/shared/plans/2025-12-18-slack-integration.md +1195 -0
  72. package/thoughts/shared/plans/2025-12-19-agent-log-streaming.md +732 -0
  73. package/thoughts/shared/plans/2025-12-19-role-based-swarm-plugin.md +361 -0
  74. package/thoughts/shared/plans/2025-12-20-mobile-responsive-ui.md +501 -0
  75. package/thoughts/shared/plans/2025-12-20-startup-team-swarm.md +560 -0
  76. package/thoughts/shared/research/.gitkeep +0 -0
  77. package/thoughts/shared/research/2025-12-18-slack-integration.md +442 -0
  78. package/thoughts/shared/research/2025-12-19-agent-log-streaming.md +339 -0
  79. package/thoughts/shared/research/2025-12-19-agent-secrets-cli-research.md +390 -0
  80. package/thoughts/shared/research/2025-12-21-gemini-cli-integration.md +376 -0
  81. package/thoughts/shared/research/2025-12-22-setup-experience-improvements.md +264 -0
  82. package/tsconfig.json +3 -1
  83. package/ui/bun.lock +692 -0
  84. package/ui/index.html +22 -0
  85. package/ui/package.json +32 -0
  86. package/ui/pnpm-lock.yaml +3034 -0
  87. package/ui/postcss.config.js +6 -0
  88. package/ui/public/logo.png +0 -0
  89. package/ui/src/App.tsx +43 -0
  90. package/ui/src/components/ActivityFeed.tsx +415 -0
  91. package/ui/src/components/AgentDetailPanel.tsx +534 -0
  92. package/ui/src/components/AgentsPanel.tsx +549 -0
  93. package/ui/src/components/ChatPanel.tsx +1820 -0
  94. package/ui/src/components/ConfigModal.tsx +232 -0
  95. package/ui/src/components/Dashboard.tsx +534 -0
  96. package/ui/src/components/Header.tsx +168 -0
  97. package/ui/src/components/ServicesPanel.tsx +612 -0
  98. package/ui/src/components/StatsBar.tsx +288 -0
  99. package/ui/src/components/StatusBadge.tsx +124 -0
  100. package/ui/src/components/TaskDetailPanel.tsx +807 -0
  101. package/ui/src/components/TasksPanel.tsx +575 -0
  102. package/ui/src/hooks/queries.ts +170 -0
  103. package/ui/src/index.css +235 -0
  104. package/ui/src/lib/api.ts +161 -0
  105. package/ui/src/lib/config.ts +35 -0
  106. package/ui/src/lib/theme.ts +214 -0
  107. package/ui/src/lib/utils.ts +48 -0
  108. package/ui/src/main.tsx +32 -0
  109. package/ui/src/types/api.ts +164 -0
  110. package/ui/src/vite-env.d.ts +1 -0
  111. package/ui/tailwind.config.js +35 -0
  112. package/ui/tsconfig.json +31 -0
  113. package/ui/vite.config.ts +22 -0
  114. package/cc-plugin/README.md +0 -49
  115. package/cc-plugin/commands/setup-leader.md +0 -73
  116. package/cc-plugin/commands/start-worker.md +0 -64
  117. package/docker-compose.worker.yml +0 -35
  118. package/example-req-meta.json +0 -24
  119. /package/{cc-plugin → plugin}/hooks/hooks.json +0 -0
@@ -3,7 +3,26 @@
3
3
  "allow": [
4
4
  "mcp__agent-swarm__*",
5
5
  "Bash(bun run tsc:*)",
6
- "Bash(docker build:*)"
6
+ "Bash(docker build:*)",
7
+ "Skill(frontend-design:frontend-design)",
8
+ "Bash(gh repo view:*)",
9
+ "WebSearch",
10
+ "WebFetch(domain:www.claude.com)",
11
+ "WebFetch(domain:simonwillison.net)",
12
+ "WebFetch(domain:deepwiki.com)",
13
+ "WebFetch(domain:docs.claude.com)",
14
+ "Bash(bun run tsc:check:*)",
15
+ "Bash(bun tsc:*)",
16
+ "Bash(bun run lint:*)",
17
+ "Bash(bun run format:*)",
18
+ "Bash(sqlite3:*)",
19
+ "Bash(cat:*)",
20
+ "mcp__context7__resolve-library-id",
21
+ "mcp__context7__get-library-docs",
22
+ "Bash(bun run build:*)",
23
+ "Bash(pnpm run build:*)",
24
+ "WebFetch(domain:geminicli.com)",
25
+ "Bash(bun run docs:mcp:*)"
7
26
  ]
8
27
  },
9
28
  "enableAllProjectMcpServers": true,
@@ -2,11 +2,32 @@
2
2
  # Copy this file to .env.docker and fill in your values
3
3
 
4
4
  # Required
5
+ # Run `claude setup-token` to get your OAuth token
5
6
  CLAUDE_CODE_OAUTH_TOKEN=your-oauth-token-here
6
7
  API_KEY=your-api-key-here
7
8
 
8
9
  # Optional (auto-generated if not provided)
9
10
  AGENT_ID=
10
11
  MCP_BASE_URL=http://host.docker.internal:3013
12
+
13
+ # Service Registry (PM2 background services)
14
+ # Port mapping for exposed services (default: 3000)
15
+ SERVICE_PORT=3000
16
+
17
+ # To re-use an existing session, set SESSION_ID to the desired value
18
+ # Will be used for log directory paths
11
19
  SESSION_ID=
12
- WORKER_YOLO=false
20
+
21
+ # If true, enables YOLO mode for the agent (default: false)
22
+ # which will keep spawning claudes even if an iteration fails
23
+ YOLO=false
24
+
25
+ # If true, the worker will exit if the startup script fails (default: true)
26
+ STARTUP_SCRIPT_STRICT=true
27
+
28
+ # System Prompt (optional - customize agent behavior)
29
+ SYSTEM_PROMPT=
30
+ SYSTEM_PROMPT_FILE=
31
+
32
+ # For the agent exposed services (optional)
33
+ SWARM_URL=swarm.example.com
package/.env.example CHANGED
@@ -4,6 +4,23 @@ API_KEY=
4
4
  # Server port (default: 3013)
5
5
  PORT=3013
6
6
 
7
+ # Swarm URL for service discovery (e.g., swarm.example.com)
8
+ # Services are accessible at https://{AGENT_ID}.{SWARM_URL}
9
+ SWARM_URL=localhost
10
+
7
11
  # MCP Base URL for remote server (used by setup command)
8
12
  # Default: https://agent-swarm-mcp.desplega.sh
9
13
  MCP_BASE_URL=
14
+
15
+ # Slack Bot Configuration (Socket Mode)
16
+ # Get these from https://api.slack.com/apps
17
+ SLACK_BOT_TOKEN=xoxb-... # Bot User OAuth Token
18
+ SLACK_APP_TOKEN=xapp-... # App-Level Token (for Socket Mode)
19
+ SLACK_SIGNING_SECRET=... # Signing Secret (optional for Socket Mode)
20
+ SLACK_DISABLE=true # Set to "true" to disable Slack integration
21
+
22
+ # App URL for Slack message links (e.g., https://your-dashboard.com)
23
+ APP_URL=
24
+
25
+ # Environment mode - set to "development" to add (dev) prefix to agent names in Slack
26
+ ENV=
@@ -0,0 +1,92 @@
1
+ name: Docker Build and Publish
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ env:
10
+ REGISTRY: ghcr.io
11
+ IMAGE_NAME: ${{ github.repository }}
12
+
13
+ jobs:
14
+ build-and-push-server:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: read
18
+ packages: write
19
+
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@v4
23
+
24
+ - name: Get version from package.json
25
+ id: version
26
+ run: echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
27
+
28
+ - name: Log in to Container Registry
29
+ uses: docker/login-action@v3
30
+ with:
31
+ registry: ${{ env.REGISTRY }}
32
+ username: ${{ github.actor }}
33
+ password: ${{ secrets.GITHUB_TOKEN }}
34
+
35
+ - name: Extract metadata (tags, labels)
36
+ id: meta
37
+ uses: docker/metadata-action@v5
38
+ with:
39
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40
+ tags: |
41
+ type=raw,value=latest
42
+ type=raw,value=${{ steps.version.outputs.version }}
43
+ type=sha
44
+
45
+ - name: Build and push Docker image
46
+ uses: docker/build-push-action@v5
47
+ with:
48
+ context: .
49
+ file: ./Dockerfile
50
+ push: true
51
+ tags: ${{ steps.meta.outputs.tags }}
52
+ labels: ${{ steps.meta.outputs.labels }}
53
+
54
+ build-and-push-worker:
55
+ runs-on: ubuntu-latest
56
+ permissions:
57
+ contents: read
58
+ packages: write
59
+
60
+ steps:
61
+ - name: Checkout repository
62
+ uses: actions/checkout@v4
63
+
64
+ - name: Get version from package.json
65
+ id: version
66
+ run: echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
67
+
68
+ - name: Log in to Container Registry
69
+ uses: docker/login-action@v3
70
+ with:
71
+ registry: ${{ env.REGISTRY }}
72
+ username: ${{ github.actor }}
73
+ password: ${{ secrets.GITHUB_TOKEN }}
74
+
75
+ - name: Extract metadata (tags, labels)
76
+ id: meta
77
+ uses: docker/metadata-action@v5
78
+ with:
79
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-worker
80
+ tags: |
81
+ type=raw,value=latest
82
+ type=raw,value=${{ steps.version.outputs.version }}
83
+ type=sha
84
+
85
+ - name: Build and push Docker image
86
+ uses: docker/build-push-action@v5
87
+ with:
88
+ context: .
89
+ file: ./Dockerfile.worker
90
+ push: true
91
+ tags: ${{ steps.meta.outputs.tags }}
92
+ labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,270 @@
1
+ # Contributing to Agent Swarm
2
+
3
+ Thanks for your interest in contributing to Agent Swarm MCP!
4
+
5
+ ## Table of Contents
6
+
7
+ - [Development Setup](#development-setup)
8
+ - [Running the Project](#running-the-project)
9
+ - [Code Quality](#code-quality)
10
+ - [Building](#building)
11
+ - [Project Structure](#project-structure)
12
+ - [Adding New Tools](#adding-new-tools)
13
+
14
+ ---
15
+
16
+ ## Development Setup
17
+
18
+ ### Prerequisites
19
+
20
+ - [Bun](https://bun.sh) (recommended) or Node.js 22+
21
+ - Git
22
+
23
+ ### Install Dependencies
24
+
25
+ ```bash
26
+ git clone https://github.com/desplega-ai/agent-swarm.git
27
+ cd agent-swarm
28
+ bun install
29
+ ```
30
+
31
+ ### Environment Setup
32
+
33
+ ```bash
34
+ cp .env.docker.example .env
35
+ # Edit .env with your API_KEY
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Running the Project
41
+
42
+ ### MCP Server
43
+
44
+ ```bash
45
+ # STDIO transport (for local testing)
46
+ bun run start
47
+
48
+ # HTTP transport (for production)
49
+ bun run start:http
50
+
51
+ # With hot reload
52
+ bun run dev # STDIO
53
+ bun run dev:http # HTTP
54
+ ```
55
+
56
+ ### MCP Inspector
57
+
58
+ Debug and test MCP tools interactively:
59
+
60
+ ```bash
61
+ bun run inspector:http # HTTP transport
62
+ ```
63
+
64
+ ### CLI Commands
65
+
66
+ ```bash
67
+ # Run CLI locally
68
+ bun run cli setup
69
+ bun run cli setup --dry-run
70
+
71
+ # Run worker/lead
72
+ bun run worker
73
+ bun run lead
74
+
75
+ # Hook handler
76
+ bun run hook
77
+ ```
78
+
79
+ ### Docker Worker
80
+
81
+ ```bash
82
+ # Build worker image
83
+ bun run docker:build:worker
84
+
85
+ # Run worker container
86
+ bun run docker:run:worker
87
+
88
+ # Run lead container
89
+ bun run docker:run:lead
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Code Quality
95
+
96
+ ### Linting
97
+
98
+ ```bash
99
+ # Check for issues
100
+ bun run lint
101
+
102
+ # Fix issues automatically
103
+ bun run lint:fix
104
+ ```
105
+
106
+ ### Formatting
107
+
108
+ ```bash
109
+ bun run format
110
+ ```
111
+
112
+ ### Type Checking
113
+
114
+ ```bash
115
+ bun run tsc:check
116
+ ```
117
+
118
+ ### Pre-commit
119
+
120
+ Run all checks before committing:
121
+
122
+ ```bash
123
+ bun run lint && bun run tsc:check
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Building
129
+
130
+ ### Binary Builds
131
+
132
+ Create standalone binaries for Linux:
133
+
134
+ ```bash
135
+ # x64
136
+ bun run build:binary
137
+
138
+ # ARM64
139
+ bun run build:binary:arm64
140
+ ```
141
+
142
+ Output: `./dist/agent-swarm`
143
+
144
+ ### Docker Images
145
+
146
+ ```bash
147
+ # Build worker image
148
+ bun run docker:build:worker
149
+
150
+ # Push to registry (maintainers only)
151
+ bun run deploy:docker
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Project Structure
157
+
158
+ ```
159
+ agent-swarm/
160
+ ├── src/
161
+ │ ├── cli.tsx # CLI entry point (Ink/React)
162
+ │ ├── http.ts # HTTP server entry
163
+ │ ├── server.ts # MCP server setup & tool registration
164
+ │ ├── tools/ # MCP tool implementations
165
+ │ │ ├── join-swarm.ts
166
+ │ │ ├── poll-task.ts
167
+ │ │ ├── send-task.ts
168
+ │ │ └── ...
169
+ │ ├── be/ # Backend (database, business logic)
170
+ │ │ └── db.ts # SQLite database
171
+ │ ├── commands/ # CLI command implementations
172
+ │ │ ├── worker.ts
173
+ │ │ ├── lead.ts
174
+ │ │ └── ...
175
+ │ └── hooks/ # Claude Code hooks
176
+ ├── deploy/ # Deployment scripts
177
+ ├── scripts/ # Utility scripts
178
+ ├── docker-compose.example.yml
179
+ ├── Dockerfile # API server image
180
+ ├── Dockerfile.worker # Worker image
181
+ └── package.json
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Adding New Tools
187
+
188
+ ### 1. Create Tool File
189
+
190
+ Create `src/tools/my-tool.ts`:
191
+
192
+ ```typescript
193
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
194
+ import * as z from "zod";
195
+ import { createToolRegistrar } from "@/tools/utils";
196
+
197
+ export const registerMyTool = (server: McpServer) => {
198
+ createToolRegistrar(server)(
199
+ "my-tool",
200
+ {
201
+ title: "My Tool",
202
+ description: "What this tool does.",
203
+ inputSchema: z.object({
204
+ param1: z.string().describe("Parameter description"),
205
+ param2: z.number().optional().describe("Optional parameter"),
206
+ }),
207
+ outputSchema: z.object({
208
+ success: z.boolean(),
209
+ message: z.string(),
210
+ }),
211
+ },
212
+ async ({ param1, param2 }, requestInfo, _meta) => {
213
+ // requestInfo.agentId - caller's agent ID
214
+ // requestInfo.sessionId - session ID
215
+
216
+ // Your implementation here
217
+
218
+ return {
219
+ content: [{ type: "text", text: "Result message" }],
220
+ structuredContent: {
221
+ success: true,
222
+ message: "Result message",
223
+ },
224
+ };
225
+ },
226
+ );
227
+ };
228
+ ```
229
+
230
+ ### 2. Register in Server
231
+
232
+ Edit `src/server.ts`:
233
+
234
+ ```typescript
235
+ import { registerMyTool } from "./tools/my-tool";
236
+
237
+ export function createServer() {
238
+ // ...existing code...
239
+
240
+ // Register under appropriate capability
241
+ if (hasCapability("my-capability")) {
242
+ registerMyTool(server);
243
+ }
244
+
245
+ return server;
246
+ }
247
+ ```
248
+
249
+ ### 3. Update Documentation
250
+
251
+ ```bash
252
+ bun run docs:mcp
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Coding Guidelines
258
+
259
+ See [CLAUDE.md](./CLAUDE.md) for:
260
+
261
+ - Bun-specific APIs and patterns
262
+ - Testing conventions
263
+ - Frontend development with HTML imports
264
+
265
+ ### Key Points
266
+
267
+ - Use Bun instead of Node.js (`bun run`, `Bun.serve()`, `bun:sqlite`)
268
+ - Use Zod for schema validation
269
+ - Return both `content` (text) and `structuredContent` (JSON) from tools
270
+ - Group tools by capability (core, task-pool, messaging, profiles, services)