@desplega.ai/agent-swarm 1.52.0 → 1.53.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 (62) hide show
  1. package/README.md +131 -0
  2. package/openapi.json +1517 -488
  3. package/package.json +7 -2
  4. package/src/be/db.ts +557 -0
  5. package/src/be/events.ts +322 -0
  6. package/src/be/migrations/021_events.sql +24 -0
  7. package/src/be/migrations/022_context_usage.sql +34 -0
  8. package/src/be/migrations/023_mcp_servers.sql +44 -0
  9. package/src/be/migrations/runner.ts +4 -4
  10. package/src/commands/runner.ts +514 -15
  11. package/src/http/agents.ts +29 -0
  12. package/src/http/approval-requests.ts +63 -0
  13. package/src/http/context.ts +118 -0
  14. package/src/http/events.ts +188 -0
  15. package/src/http/index.ts +28 -2
  16. package/src/http/mcp-servers.ts +364 -0
  17. package/src/http/poll.ts +15 -0
  18. package/src/http/tasks.ts +127 -0
  19. package/src/linear/outbound.ts +20 -13
  20. package/src/linear/sync.ts +3 -0
  21. package/src/oauth/ensure-token.ts +50 -0
  22. package/src/prompts/base-prompt.ts +7 -0
  23. package/src/providers/claude-adapter.ts +174 -17
  24. package/src/providers/pi-mono-adapter.ts +68 -0
  25. package/src/providers/pi-mono-extension.ts +56 -2
  26. package/src/providers/pi-mono-mcp-client.ts +10 -1
  27. package/src/providers/types.ts +14 -1
  28. package/src/scheduler/scheduler.ts +24 -1
  29. package/src/server.ts +19 -0
  30. package/src/slack/blocks.ts +1 -1
  31. package/src/tests/approval-requests.test.ts +214 -1
  32. package/src/tests/context-window.test.ts +66 -0
  33. package/src/tests/ensure-token.test.ts +170 -0
  34. package/src/tests/events-db.test.ts +314 -0
  35. package/src/tests/events-http.test.ts +267 -0
  36. package/src/tests/prompt-template-remaining.test.ts +5 -5
  37. package/src/tests/skill-sync.test.ts +1 -1
  38. package/src/tests/slack-blocks.test.ts +3 -2
  39. package/src/tests/structured-output.test.ts +1 -0
  40. package/src/tests/tool-annotations.test.ts +2 -2
  41. package/src/tests/tool-call-progress.test.ts +207 -0
  42. package/src/tests/tool-registrar-no-input.test.ts +114 -0
  43. package/src/tests/update-profile-auth.test.ts +1 -0
  44. package/src/tests/vcs-tracking.test.ts +176 -0
  45. package/src/tests/workflow-executors.test.ts +8 -1
  46. package/src/tools/mcp-servers/index.ts +7 -0
  47. package/src/tools/mcp-servers/mcp-server-create.ts +138 -0
  48. package/src/tools/mcp-servers/mcp-server-delete.ts +72 -0
  49. package/src/tools/mcp-servers/mcp-server-get.ts +80 -0
  50. package/src/tools/mcp-servers/mcp-server-install.ts +110 -0
  51. package/src/tools/mcp-servers/mcp-server-list.ts +67 -0
  52. package/src/tools/mcp-servers/mcp-server-uninstall.ts +71 -0
  53. package/src/tools/mcp-servers/mcp-server-update.ts +120 -0
  54. package/src/tools/request-human-input.ts +14 -3
  55. package/src/tools/store-progress.ts +31 -0
  56. package/src/tools/templates.ts +28 -0
  57. package/src/tools/tool-config.ts +9 -0
  58. package/src/tools/utils.ts +9 -7
  59. package/src/types.ts +153 -0
  60. package/src/utils/context-window.ts +41 -0
  61. package/src/workflows/executors/base.ts +9 -1
  62. package/src/workflows/executors/human-in-the-loop.ts +115 -2
package/README.md CHANGED
@@ -56,6 +56,8 @@ Agent Swarm lets you run a team of AI coding agents that coordinate autonomously
56
56
  - **Linear integration** — Bidirectional ticket tracker sync via OAuth + webhooks with AgentSession lifecycle and generic tracker abstraction
57
57
  - **Portless local dev** — Friendly URLs for local development (`api.swarm.localhost:1355`) via portless proxy
58
58
  - **Onboarding wizard** — Interactive CLI wizard (`agent-swarm onboard`) to set up a new swarm from scratch with presets, credential collection, and docker-compose generation
59
+ - **Skill system** — Reusable procedural knowledge: create, install, publish, and sync skills from GitHub with scope resolution (agent → swarm → global)
60
+ - **Human-in-the-Loop** — Workflow nodes that pause for human approval or input, with a dashboard UI for reviewing and responding to requests
59
61
 
60
62
  ## Quick Start
61
63
 
@@ -262,6 +264,135 @@ GITHUB_APP_PRIVATE_KEY=base64-encoded-key
262
264
  | PR review submitted (on bot's PR) | Creates a notification task with review feedback |
263
265
  | CI failure (on PRs with existing tasks) | Creates a CI notification task |
264
266
 
267
+ <details>
268
+ <summary><strong>Flow Diagrams</strong> (click to expand)</summary>
269
+
270
+ #### Task Creation Flow
271
+
272
+ How GitHub events become tasks in the swarm:
273
+
274
+ ```mermaid
275
+ %%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px', 'nodeSpacing': 30, 'rankSpacing': 40}}}%%
276
+ flowchart TB
277
+ subgraph ENTRY["1. GitHub Webhook Entry Points"]
278
+ direction LR
279
+ E1["Issue<br/>opened/edited"]
280
+ E2["PR<br/>opened/edited"]
281
+ E3["Comment<br/>created"]
282
+ E4["Bot Assigned<br/>to Issue/PR"]
283
+ E5["Review Requested<br/>from Bot"]
284
+ end
285
+
286
+ subgraph GATE["2. Trigger Gate"]
287
+ M{"@agent-swarm<br/>mention?"}
288
+ A{"Bot is<br/>assignee?"}
289
+ D{"Duplicate?<br/>60s TTL"}
290
+ end
291
+
292
+ subgraph CREATE["3. Task Creation"]
293
+ LEAD["Find Lead Agent<br/>(online > offline > none)"]
294
+ TPL["resolveTemplate()"]
295
+ TASK["createTaskExtended()"]
296
+ end
297
+
298
+ subgraph OUT["4. Output"]
299
+ ASSIGN["Task assigned<br/>to Lead"]
300
+ POOL["Task in pool<br/>(no lead)"]
301
+ REACT["eyes reaction<br/>on GitHub"]
302
+ end
303
+
304
+ E1 & E2 & E3 --> M
305
+ E4 & E5 --> A
306
+
307
+ M -->|Yes| D
308
+ A -->|Yes| D
309
+ M & A -->|No| DROP1(("skip"))
310
+
311
+ D -->|New| LEAD
312
+ D -->|Dup| DROP2(("skip"))
313
+
314
+ LEAD --> TPL --> TASK
315
+
316
+ TASK -->|lead found| ASSIGN
317
+ TASK -.->|no lead| POOL
318
+ TASK --> REACT
319
+ ```
320
+
321
+ [PNG fallback](assets/github-task-creation-flow.png)
322
+
323
+ #### Follow-up Flows
324
+
325
+ Events that create secondary tasks when an active task already exists for a PR:
326
+
327
+ ```mermaid
328
+ %%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}}}%%
329
+ flowchart TB
330
+ subgraph EVENTS["GitHub Follow-up Events (require existing active task)"]
331
+ direction LR
332
+ F1["PR Closed<br/>(merged/closed)"]
333
+ F2["PR Synchronize<br/>(new commits)"]
334
+ F3["Review Submitted<br/>(approved/changes_requested)"]
335
+ F4["Check Run Failed"]
336
+ F5["Check Suite Failed"]
337
+ F6["Workflow Run Failed"]
338
+ end
339
+
340
+ FIND{"findTaskByVcs()<br/>Active task for<br/>repo + PR number?"}
341
+
342
+ EVENTS --> FIND
343
+
344
+ FIND -->|No task| SKIP(("skip"))
345
+
346
+ subgraph FOLLOWUP["Follow-up Task Created (assigned to Lead)"]
347
+ direction LR
348
+ T1["github-pr-status<br/>PR merged/closed"]
349
+ T2["github-pr-update<br/>New commits pushed"]
350
+ T3["github-review<br/>Review feedback"]
351
+ T4["github-ci<br/>CI failure alert"]
352
+ end
353
+
354
+ F1 --> FIND -->|task found| T1
355
+ F2 --> FIND -->|task found| T2
356
+ F3 --> FIND -->|task found| T3
357
+ F4 & F5 & F6 --> FIND -->|task found| T4
358
+
359
+ NOTE["All follow-up tasks reference<br/>the original task ID for routing"]
360
+
361
+ FOLLOWUP --> NOTE
362
+ ```
363
+
364
+ [PNG fallback](assets/github-followup-flows.png)
365
+
366
+ #### Cancellation Flows
367
+
368
+ How unassigning the bot cancels active tasks:
369
+
370
+ ```mermaid
371
+ %%{init: {'theme': 'dark', 'themeVariables': {'fontSize': '13px'}}}%%
372
+ flowchart TB
373
+ subgraph EVENTS["Cancellation Events"]
374
+ direction LR
375
+ C1["Bot Unassigned<br/>from Issue"]
376
+ C2["Bot Unassigned<br/>from PR"]
377
+ C3["Review Request<br/>Removed from Bot"]
378
+ end
379
+
380
+ BOT{"isBotAssignee()"}
381
+ FIND{"findTaskByVcs()<br/>Active task?"}
382
+ CANCEL["failTask()<br/>Cancel with reason"]
383
+ NOOP(("no-op"))
384
+
385
+ EVENTS --> BOT
386
+ BOT -->|Not bot| NOOP
387
+ BOT -->|Is bot| FIND
388
+ FIND -->|No task| NOOP
389
+ FIND -->|Task found| CANCEL
390
+ ```
391
+
392
+ [PNG fallback](assets/github-cancellation-flows.png)
393
+
394
+ </details>
395
+
265
396
  ### GitLab
266
397
 
267
398
  Set up a GitLab webhook to receive events when the bot is @mentioned or assigned to issues/MRs.