@desplega.ai/agent-swarm 1.87.0 → 1.89.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 (102) hide show
  1. package/README.md +5 -1
  2. package/openapi.json +53 -1
  3. package/package.json +6 -5
  4. package/plugin/skills/composio/SKILL.md +98 -0
  5. package/src/be/db.ts +374 -9
  6. package/src/be/migrations/080_skill_system_defaults.sql +8 -0
  7. package/src/be/migrations/081_metrics.sql +39 -0
  8. package/src/be/migrations/082_user_audit_fields.sql +120 -0
  9. package/src/be/modelsdev-cache.json +3825 -2417
  10. package/src/be/seed/registry.ts +3 -2
  11. package/src/be/seed-skills/index.ts +179 -0
  12. package/src/cli.tsx +51 -4
  13. package/src/commands/e2b-stack-wizard.tsx +394 -0
  14. package/src/commands/e2b.ts +1352 -53
  15. package/src/commands/onboard/dashboard-url.ts +29 -0
  16. package/src/commands/onboard/steps/post-dashboard.tsx +3 -1
  17. package/src/commands/onboard.tsx +3 -1
  18. package/src/commands/runner.ts +154 -22
  19. package/src/commands/x.ts +118 -0
  20. package/src/e2b/dispatch.ts +234 -18
  21. package/src/github/handlers.ts +40 -1
  22. package/src/heartbeat/heartbeat.ts +26 -5
  23. package/src/http/active-sessions.ts +32 -1
  24. package/src/http/auth.ts +36 -0
  25. package/src/http/core.ts +20 -16
  26. package/src/http/db-query.ts +20 -0
  27. package/src/http/index.ts +2 -0
  28. package/src/http/memory.ts +13 -1
  29. package/src/http/metrics.ts +447 -0
  30. package/src/http/operator-actor.ts +9 -0
  31. package/src/http/poll.ts +11 -1
  32. package/src/http/skills.ts +53 -0
  33. package/src/http/tasks.ts +4 -1
  34. package/src/http/webhooks.ts +75 -0
  35. package/src/http/workflows.ts +5 -1
  36. package/src/integrations/kapso/client.ts +82 -0
  37. package/src/memory/automatic-task-gate.ts +47 -0
  38. package/src/metrics/version.ts +26 -0
  39. package/src/prompts/base-prompt.ts +24 -1
  40. package/src/prompts/session-templates.ts +74 -0
  41. package/src/providers/claude-adapter.ts +19 -0
  42. package/src/providers/codex-adapter.ts +22 -0
  43. package/src/providers/ctx-mode-env.ts +10 -0
  44. package/src/providers/opencode-adapter.ts +72 -7
  45. package/src/server.ts +10 -1
  46. package/src/slack/blocks.ts +12 -4
  47. package/src/slack/watcher.ts +3 -3
  48. package/src/telemetry.ts +14 -1
  49. package/src/templates.d.ts +4 -0
  50. package/src/tests/base-prompt.test.ts +76 -0
  51. package/src/tests/budget-claim-gate.test.ts +26 -0
  52. package/src/tests/claude-adapter.test.ts +86 -1
  53. package/src/tests/codex-adapter.test.ts +89 -0
  54. package/src/tests/core-auth.test.ts +8 -1
  55. package/src/tests/e2b-dispatch.test.ts +603 -11
  56. package/src/tests/events-http.test.ts +6 -2
  57. package/src/tests/github-handlers-cancel-config.test.ts +262 -0
  58. package/src/tests/heartbeat.test.ts +84 -3
  59. package/src/tests/http-api-integration.test.ts +116 -1
  60. package/src/tests/kapso-client.test.ts +74 -1
  61. package/src/tests/kapso-inbound.test.ts +60 -2
  62. package/src/tests/metrics-http.test.ts +247 -0
  63. package/src/tests/opencode-adapter.test.ts +185 -30
  64. package/src/tests/prompt-template-session.test.ts +4 -2
  65. package/src/tests/runner-repo-autostash.test.ts +117 -0
  66. package/src/tests/runner-requester-profile.test.ts +25 -0
  67. package/src/tests/runner-skills-refresh.test.ts +1 -1
  68. package/src/tests/self-improvement.test.ts +89 -0
  69. package/src/tests/skill-update-scope.test.ts +88 -1
  70. package/src/tests/slack-blocks.test.ts +15 -0
  71. package/src/tests/swarm-x-tool.test.ts +90 -0
  72. package/src/tests/system-default-skills.test.ts +122 -0
  73. package/src/tests/telemetry-init.test.ts +86 -0
  74. package/src/tests/ui-logs-parser.test.ts +271 -0
  75. package/src/tests/user-token-rest-auth.test.ts +129 -0
  76. package/src/tests/workflow-async-v2.test.ts +23 -0
  77. package/src/tests/x-composio.test.ts +122 -0
  78. package/src/tools/create-metric.ts +191 -0
  79. package/src/tools/skills/skill-delete.ts +14 -0
  80. package/src/tools/skills/skill-update.ts +14 -0
  81. package/src/tools/store-progress.ts +19 -5
  82. package/src/tools/swarm-x.ts +116 -0
  83. package/src/tools/tool-config.ts +6 -0
  84. package/src/types.ts +121 -0
  85. package/src/utils/request-auth-context.ts +28 -0
  86. package/src/utils/skills-refresh.ts +2 -2
  87. package/src/workflows/engine.ts +24 -2
  88. package/src/workflows/executors/agent-task.ts +2 -0
  89. package/src/x/composio.ts +295 -0
  90. package/templates/skills/artifacts/config.json +1 -0
  91. package/templates/skills/attio-interaction/SKILL.md +279 -0
  92. package/templates/skills/attio-interaction/config.json +14 -0
  93. package/templates/skills/attio-interaction/content.md +272 -0
  94. package/templates/skills/kv-storage/config.json +1 -0
  95. package/templates/skills/pages/config.json +1 -0
  96. package/templates/skills/scheduled-task-resilience/config.json +1 -0
  97. package/templates/skills/swarm-scripts/SKILL.md +91 -0
  98. package/templates/skills/swarm-scripts/config.json +14 -0
  99. package/templates/skills/swarm-scripts/content.md +86 -0
  100. package/templates/skills/workflow-iterate/config.json +1 -0
  101. package/templates/skills/workflow-structured-output/config.json +1 -0
  102. package/tsconfig.json +2 -1
package/README.md CHANGED
@@ -9,6 +9,9 @@
9
9
  <sub>Built by <a href="https://desplega.sh">desplega.sh</a> — by builders, for builders.</sub>
10
10
  </p>
11
11
 
12
+ > [!TIP]
13
+ > **This repo evolves every single day.** [Watch now →](https://github.com/desplega-ai/agent-swarm/subscription)
14
+
12
15
  <p align="center">
13
16
  <video src="https://github.com/user-attachments/assets/e220712e-c54d-4f46-b059-bac04639d229" controls muted playsinline width="720"></video>
14
17
  </p>
@@ -124,7 +127,7 @@ Check [our templates](https://templates.agent-swarm.dev) for a quick start.
124
127
  - **Workflow engine with Human-in-the-Loop** — DAG-based automation with approval gates, retries, and structured I/O. [Workflows →](https://docs.agent-swarm.dev/docs/concepts/workflows)
125
128
  - **Scheduled & recurring tasks** — cron-based automation for standing work. [Scheduling →](https://docs.agent-swarm.dev/docs/concepts/scheduling)
126
129
  - **Harness & LLM agnostic** — run with Claude Code, OpenAI Codex, pi-mono, Devin, Claude Managed Agents, raw LLMs, or opencode. [Harness config →](https://docs.agent-swarm.dev/docs/guides/harness-configuration) · [Add a new provider →](https://docs.agent-swarm.dev/docs/guides/harness-providers)
127
- - **Follow-up continuity across all harnesses** — child tasks inherit bounded prior-task context even on providers without native session resume, while resumable providers still reuse prior sessions when possible. [Task lifecycle →](https://docs.agent-swarm.dev/docs/concepts/task-lifecycle)
130
+ - **Follow-up continuity across all harnesses** — child tasks inherit a bounded prior-task context preamble built from the task chain, so continuity survives restarts and works the same across every provider. [Task lifecycle →](https://docs.agent-swarm.dev/docs/concepts/task-lifecycle)
128
131
  - **Skills & MCP servers** — reusable procedural knowledge and per-agent MCP servers with scope cascade. [MCP tools →](https://docs.agent-swarm.dev/docs/reference/mcp-tools)
129
132
  - **DB-backed pages** — agents publish HTML or JSON pages (reports, dashboards, action specs) via the `create_page` MCP tool with public / authed / password modes, version history, view counters, diff helpers, and PDF export. [MCP tools → Pages](https://docs.agent-swarm.dev/docs/reference/mcp-tools#pages-tools)
130
133
  - **KV store** — Redis-like namespaced key/value store with auto-scoped context (Slack thread / PR / Linear issue / page). [MCP tools → KV](https://docs.agent-swarm.dev/docs/reference/mcp-tools#kv-tools)
@@ -222,6 +225,7 @@ bunx @desplega.ai/agent-swarm <command>
222
225
  | `api` | Start the API + MCP HTTP server |
223
226
  | `worker` | Run a worker agent |
224
227
  | `lead` | Run a lead agent |
228
+ | `e2b` | Build E2B templates and launch/manage grouped API + lead + worker swarms |
225
229
  | `docs` | Open documentation (`--open` to launch in browser) |
226
230
 
227
231
  ## Deployment
package/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Agent Swarm API",
5
- "version": "1.87.0",
5
+ "version": "1.89.0",
6
6
  "description": "Multi-agent orchestration API for Claude Code, Codex, and Gemini CLI. Enables task distribution, agent communication, and service discovery.\n\nMCP tools are documented separately in [MCP.md](./MCP.md)."
7
7
  },
8
8
  "servers": [
@@ -277,6 +277,46 @@
277
277
  }
278
278
  }
279
279
  },
280
+ "/api/active-sessions/recover-orphaned-tasks": {
281
+ "post": {
282
+ "summary": "Recover orphaned in-progress tasks for an agent",
283
+ "tags": [
284
+ "Active Sessions"
285
+ ],
286
+ "security": [
287
+ {
288
+ "bearerAuth": []
289
+ }
290
+ ],
291
+ "requestBody": {
292
+ "content": {
293
+ "application/json": {
294
+ "schema": {
295
+ "type": "object",
296
+ "properties": {
297
+ "agentId": {
298
+ "type": "string",
299
+ "minLength": 1
300
+ },
301
+ "minAgeSeconds": {
302
+ "type": "integer",
303
+ "exclusiveMinimum": 0
304
+ }
305
+ },
306
+ "required": [
307
+ "agentId"
308
+ ]
309
+ }
310
+ }
311
+ }
312
+ },
313
+ "responses": {
314
+ "200": {
315
+ "description": "Recovery result"
316
+ }
317
+ }
318
+ }
319
+ },
280
320
  "/api/agents": {
281
321
  "post": {
282
322
  "summary": "Register or re-register an agent",
@@ -4014,6 +4054,9 @@
4014
4054
  "items": {
4015
4055
  "type": "string"
4016
4056
  }
4057
+ },
4058
+ "persistMemory": {
4059
+ "type": "boolean"
4017
4060
  }
4018
4061
  },
4019
4062
  "required": [
@@ -7620,6 +7663,9 @@
7620
7663
  },
7621
7664
  "ownerAgentId": {
7622
7665
  "type": "string"
7666
+ },
7667
+ "systemDefault": {
7668
+ "type": "boolean"
7623
7669
  }
7624
7670
  },
7625
7671
  "required": [
@@ -7703,6 +7749,9 @@
7703
7749
  "200": {
7704
7750
  "description": "Skill updated"
7705
7751
  },
7752
+ "403": {
7753
+ "description": "System-managed skills cannot be edited"
7754
+ },
7706
7755
  "404": {
7707
7756
  "description": "Skill not found"
7708
7757
  }
@@ -7732,6 +7781,9 @@
7732
7781
  "200": {
7733
7782
  "description": "Skill deleted"
7734
7783
  },
7784
+ "403": {
7785
+ "description": "System-managed skills cannot be deleted"
7786
+ },
7735
7787
  "404": {
7736
7788
  "description": "Skill not found"
7737
7789
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/agent-swarm",
3
- "version": "1.87.0",
3
+ "version": "1.89.0",
4
4
  "description": "Multi-agent orchestration for Claude Code, Codex, Gemini CLI, and other AI coding assistants",
5
5
  "license": "MIT",
6
6
  "author": "desplega.sh <contact@desplega.sh>",
@@ -45,6 +45,7 @@
45
45
  "tsc:check": "bun tsc --noEmit",
46
46
  "check:db-boundary": "bash scripts/check-db-boundary.sh",
47
47
  "check:api-key-boundary": "bash scripts/check-api-key-boundary.sh",
48
+ "check:audit-columns": "bash scripts/check-audit-columns.sh",
48
49
  "prepare-release": "bun scripts/prepare-release.ts",
49
50
  "sync-chart-version": "bun scripts/sync-chart-version.ts",
50
51
  "check-chart-version": "bun scripts/sync-chart-version.ts --check-if-package-version-changed",
@@ -111,12 +112,12 @@
111
112
  "@desplega.ai/localtunnel": "^2.2.0",
112
113
  "@inkjs/ui": "^2.0.0",
113
114
  "@linear/sdk": "^77.0.0",
114
- "@earendil-works/pi-agent-core": "^0.76.0",
115
- "@earendil-works/pi-ai": "^0.76.0",
116
- "@earendil-works/pi-coding-agent": "^0.76.0",
115
+ "@earendil-works/pi-agent-core": "^0.78.0",
116
+ "@earendil-works/pi-ai": "^0.78.0",
117
+ "@earendil-works/pi-coding-agent": "^0.78.0",
117
118
  "@modelcontextprotocol/sdk": "^1.25.1",
118
119
  "@openai/codex-sdk": "^0.135.0",
119
- "@opencode-ai/sdk": "^1.15.12",
120
+ "@opencode-ai/sdk": "^1.15.13",
120
121
  "@openfort/openfort-node": "^0.9.1",
121
122
  "@opentelemetry/api": "^1.9.1",
122
123
  "@opentelemetry/exporter-trace-otlp-http": "^0.218.0",
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: composio
3
+ description: Use Composio from Agent Swarm via the `agent-swarm x composio` CLI route or the `swarm_x` MCP tool. Trigger when a task needs connected third-party app tools such as Gmail, GitHub, Slack, Notion, or HubSpot through Composio Tool Router sessions, Connect Links, or connected accounts.
4
+ ---
5
+
6
+ # Composio
7
+
8
+ Use this skill when a task needs Composio-managed third-party app access.
9
+ The current supported surface is the Agent Swarm `x` route:
10
+
11
+ - CLI: `agent-swarm x composio <method> <path> [options]`
12
+ - MCP: `swarm_x` with `target: "composio"`
13
+
14
+ ## Core Model
15
+
16
+ - `COMPOSIO_API_KEY` is deployment-scoped and injected by the CLI/API process.
17
+ - `user_id` is the app user whose connected accounts should be used.
18
+ - Connected accounts persist under that `user_id` across sessions.
19
+ - Tool Router sessions are task/conversation runtime contexts. Store and reuse
20
+ the `session_id` for follow-up turns; create a new session if the user,
21
+ toolkit set, auth config, or pinned connected account changes.
22
+ - Sessions do not expire, but Connect Links and incomplete connection attempts
23
+ expire quickly. If a connection is missing or expired, initiate a new link.
24
+
25
+ ## Workflow
26
+
27
+ 1. Create or reuse a Tool Router session for the target user and toolkit set.
28
+ 2. Search before executing. Use `/search` to get the current tool slug, schema,
29
+ plan, pitfalls, and connection status.
30
+ 3. If Composio reports no active connection, execute
31
+ `COMPOSIO_MANAGE_CONNECTIONS` for the exact toolkit names it returned.
32
+ 4. Share the returned Connect Link with the user and pause until they complete
33
+ auth.
34
+ 5. Retry the app tool only after the toolkit shows an active connected account.
35
+ 6. Prefer metadata-first reads (`include_payload:false`, `verbose:false`) unless
36
+ the user explicitly needs bodies, attachments, or full records.
37
+ 7. Paginate when Composio returns `nextPageToken`, cursors, or continuation
38
+ fields.
39
+
40
+ ## CLI Examples
41
+
42
+ Create a Gmail-scoped session:
43
+
44
+ ```bash
45
+ agent-swarm x composio POST /tool_router/session \
46
+ --body '{"user_id":"swarm-user-id","toolkits":{"enable":["gmail"]},"workbench":{"enable":false}}'
47
+ ```
48
+
49
+ Search for the right Gmail tool:
50
+
51
+ ```bash
52
+ agent-swarm x composio POST /tool_router/session/$SESSION_ID/search \
53
+ --body '{"queries":[{"use_case":"Check recent emails in Gmail and return metadata only."}]}'
54
+ ```
55
+
56
+ Connect Gmail if needed:
57
+
58
+ ```bash
59
+ agent-swarm x composio POST /tool_router/session/$SESSION_ID/execute \
60
+ --body '{"tool_slug":"COMPOSIO_MANAGE_CONNECTIONS","arguments":{"toolkits":["gmail"]}}'
61
+ ```
62
+
63
+ Fetch lightweight email metadata after connection:
64
+
65
+ ```bash
66
+ agent-swarm x composio POST /tool_router/session/$SESSION_ID/execute \
67
+ --body '{"tool_slug":"GMAIL_FETCH_EMAILS","arguments":{"user_id":"me","max_results":5,"include_payload":false,"verbose":false}}'
68
+ ```
69
+
70
+ ## MCP Example
71
+
72
+ ```jsonc
73
+ // Tool call: swarm_x
74
+ {
75
+ "target": "composio",
76
+ "method": "POST",
77
+ "path": "/tool_router/session/$SESSION_ID/execute",
78
+ "body": {
79
+ "tool_slug": "GMAIL_FETCH_EMAILS",
80
+ "arguments": {
81
+ "user_id": "me",
82
+ "max_results": 5,
83
+ "include_payload": false,
84
+ "verbose": false
85
+ }
86
+ }
87
+ }
88
+ ```
89
+
90
+ ## Guardrails
91
+
92
+ - Never invent tool slugs or argument shapes. Use `/search` and returned schemas.
93
+ - Never pass absolute URLs as Composio paths. Use relative API paths only.
94
+ - Do not expose `COMPOSIO_API_KEY`; server-side code injects it.
95
+ - Do not fetch email bodies, attachments, or destructive tool actions unless the
96
+ task explicitly requires them.
97
+ - If multiple accounts exist for a toolkit, ask which account to use or pin the
98
+ specific connected account/session account according to the task.