@desplega.ai/agent-swarm 1.148.0 → 1.149.1

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 (191) hide show
  1. package/README.md +2 -1
  2. package/dist/{acp-adapter-grez7xhd.js → acp-adapter-vhkzfpjg.js} +12 -5
  3. package/dist/{actions-kweznh5a.js → actions-9d2694yk.js} +10 -9
  4. package/dist/{app-5fvvjv9m.js → app-fq2ggynt.js} +6 -6
  5. package/dist/{assistant-40m4w50s.js → assistant-edb6n9nn.js} +13 -11
  6. package/dist/{boot-reembed-9rxmb26n.js → boot-reembed-msweabbp.js} +8 -8
  7. package/dist/{boot-reembed-cn357y5n.js → boot-reembed-q5wd3tha.js} +7 -7
  8. package/dist/{boot-scrub-logs-5tpp0x3y.js → boot-scrub-logs-3g1az933.js} +5 -5
  9. package/dist/{claude-adapter-9pz5q2pb.js → claude-adapter-v3rnzsdc.js} +9 -9
  10. package/dist/{claude-managed-adapter-sactwn31.js → claude-managed-adapter-qvsmh6mv.js} +2 -2
  11. package/dist/{claude-sdk-session-v8w0s7qm.js → claude-sdk-session-qxrpsna1.js} +9 -9
  12. package/dist/{cli-cdjezzc7.js → cli-01g3x1ca.js} +8 -5
  13. package/dist/{cli-y6b6fb76.js → cli-08b07b4r.js} +1 -1
  14. package/dist/{cli-8fc8de14.js → cli-0z2v4nhw.js} +1 -1
  15. package/dist/{cli-qy6h009w.js → cli-1c94wvcw.js} +7 -6
  16. package/dist/{cli-kpv03zhj.js → cli-3apbzgyk.js} +27 -15
  17. package/dist/{cli-dk3me3qs.js → cli-3sysyjve.js} +8 -8
  18. package/dist/{cli-kzvhgvk3.js → cli-3z634pqe.js} +3 -3
  19. package/dist/{cli-n9grk3yd.js → cli-4260r1tg.js} +37 -26
  20. package/dist/{cli-d8brzxjb.js → cli-4wtq5jjv.js} +2 -2
  21. package/dist/{cli-0amc6myn.js → cli-5m0qmvdp.js} +1 -1
  22. package/dist/{cli-ct0et58h.js → cli-5my3bjsd.js} +1 -1
  23. package/dist/{cli-cn6mmc7f.js → cli-6664w7y4.js} +1 -1
  24. package/dist/{cli-hzhhrt7b.js → cli-6skz3rk8.js} +1 -1
  25. package/dist/{cli-v3e51x7w.js → cli-73gq0zxn.js} +3 -3
  26. package/dist/{cli-9216xm24.js → cli-7evafqvy.js} +20 -20
  27. package/dist/{cli-56y3hch2.js → cli-7fehefdf.js} +133 -22
  28. package/dist/{cli-hp2est46.js → cli-7xx10h0a.js} +3 -3
  29. package/dist/{cli-n2cwscdd.js → cli-9br8ypfv.js} +2 -2
  30. package/dist/{cli-7gn7c2af.js → cli-ayvy5kde.js} +1 -1
  31. package/dist/{cli-dcem3pr1.js → cli-cd60fv6j.js} +2 -2
  32. package/dist/{cli-p73drk6p.js → cli-cv7s5zdq.js} +167 -40
  33. package/dist/{cli-f8j56xv2.js → cli-ddfw1mc4.js} +53 -13
  34. package/dist/{cli-anedxf1w.js → cli-e06a8a7y.js} +1 -1
  35. package/dist/{cli-tebsjpk7.js → cli-hzqmgcm2.js} +2 -2
  36. package/dist/{cli-xqcpg1st.js → cli-j4d4f6hv.js} +1 -1
  37. package/dist/{cli-rvqz34y5.js → cli-jecc01cb.js} +1 -1
  38. package/dist/{cli-5khqvvnq.js → cli-jezx9b9c.js} +2 -2
  39. package/dist/{cli-m1p5cysp.js → cli-k351hv5k.js} +3 -3
  40. package/dist/{cli-6s2y152y.js → cli-qgd4sqz5.js} +286 -11
  41. package/dist/{cli-xqcq9y5e.js → cli-r2ap2czm.js} +1 -0
  42. package/dist/{cli-hz8xhefy.js → cli-sdzq01t9.js} +4 -4
  43. package/dist/{cli-0er5m69z.js → cli-svbrpf5q.js} +4 -4
  44. package/dist/{cli-brxyat7h.js → cli-tg8qj8ee.js} +5 -5
  45. package/dist/{cli-ztn0ga15.js → cli-wby1xnnb.js} +1 -1
  46. package/dist/{cli-0b6y7kxm.js → cli-xm87hzbw.js} +1 -1
  47. package/dist/{cli-3n7cbfjn.js → cli-y3pq4v9g.js} +6 -2
  48. package/dist/{cli-m9sxbkhm.js → cli-zvz62chv.js} +3 -3
  49. package/dist/cli.js +14 -14
  50. package/dist/{codex-adapter-ehhj2qwc.js → codex-adapter-jyw7a91z.js} +4 -4
  51. package/dist/{codex-hook-bw8p5nh4.js → codex-hook-hfrt9shr.js} +2 -2
  52. package/dist/{codex-session-runner-5hne566k.js → codex-session-runner-bmngj0s5.js} +4 -4
  53. package/dist/{commands-xnvh951h.js → commands-n755g391.js} +5 -5
  54. package/dist/{db-ycr5zfr4.js → db-s1cgh5gv.js} +5 -5
  55. package/dist/{e2b-6hb103d8.js → e2b-p04vmtx0.js} +1 -1
  56. package/dist/{handlers-1vt77kgq.js → handlers-nsg0bcye.js} +14 -11
  57. package/dist/{hook-91ntpmff.js → hook-h9cqrm8q.js} +7 -7
  58. package/dist/{hook-qfwjydvn.js → hook-jf0xe8zh.js} +8 -8
  59. package/dist/{http-h6g7bv5b.js → http-nc6pydw5.js} +96 -45
  60. package/dist/{index-d2mytx95.js → index-0wdy6gwc.js} +13 -13
  61. package/dist/{index-antf9t4p.js → index-769nc012.js} +14 -14
  62. package/dist/{index-47ghesbn.js → index-ezxkds2n.js} +575 -152
  63. package/dist/{index-0ez2aack.js → index-x1zcj09z.js} +15 -15
  64. package/dist/{keepalive-c4sp7yvd.js → keepalive-nesm3xb6.js} +7 -7
  65. package/dist/{lead-4r7z9e8v.js → lead-bwy6t2za.js} +32 -32
  66. package/dist/{maintenance-yqjfdjas.js → maintenance-8w393zf0.js} +8 -8
  67. package/dist/{oauth-refresh-sweep-wtqgnh3c.js → oauth-refresh-sweep-sh8xjy08.js} +6 -6
  68. package/dist/{onboard-a4krmh46.js → onboard-25ps29h1.js} +4 -3
  69. package/dist/{opencode-adapter-fef1mrn2.js → opencode-adapter-dce4wskd.js} +2 -2
  70. package/dist/{otel-impl-725kq0vp.js → otel-impl-b93gxnz5.js} +2 -2
  71. package/dist/{pi-mono-adapter-2has4gnp.js → pi-mono-adapter-zvshk5cj.js} +2 -2
  72. package/dist/{pricing-refresh-kqxd7w9h.js → pricing-refresh-5v56x7gb.js} +7 -7
  73. package/dist/{rbac-roles-t3wygpth.js → rbac-roles-0p0s6pbj.js} +6 -6
  74. package/dist/{rbac-roles-gws5xej6.js → rbac-roles-x55cnezn.js} +5 -5
  75. package/dist/{render-v2-x1wxvn51.js → render-v2-hyd45w8b.js} +6 -6
  76. package/dist/{seed-pricing-t6y8d0vf.js → seed-pricing-49gbgn96.js} +6 -6
  77. package/dist/{setup-x50py6xg.js → setup-qvq64vzq.js} +2 -2
  78. package/dist/{worker-zsz0qfxk.js → worker-scj60cxg.js} +32 -32
  79. package/dist/{x-n2phr5vm.js → x-n3e0v3xa.js} +2 -2
  80. package/openapi.json +46 -4
  81. package/package.json +1 -1
  82. package/src/agentmail/handlers.ts +5 -0
  83. package/src/automation-preflight-alert.ts +41 -0
  84. package/src/be/automation-preflight.ts +3 -3
  85. package/src/be/budget-refusal-notify.ts +1 -0
  86. package/src/be/db/tasks/read.ts +5 -0
  87. package/src/be/db.ts +132 -2
  88. package/src/be/migrations/150_deferred_task_waits.sql +18 -0
  89. package/src/be/migrations/151_repair_scheduled_task_required_params.sql +39 -0
  90. package/src/be/migrations/152_routing_decisions.sql +44 -0
  91. package/src/be/scripts/typecheck.ts +33 -22
  92. package/src/be/seed/automation-toggle.ts +69 -0
  93. package/src/be/seed/schedules-seeder.ts +28 -6
  94. package/src/be/seed/workflows-seeder.ts +18 -6
  95. package/src/be/seed-scripts/catalog/delegate.ts +5 -1
  96. package/src/be/seed-skills/bundled-files.generated.json +10 -0
  97. package/src/be/seed-skills/index.ts +3 -0
  98. package/src/be/steering.ts +1 -0
  99. package/src/be/swarm-config-guard.ts +12 -0
  100. package/src/commands/onboard/steps/post-task.tsx +1 -0
  101. package/src/github/handlers.ts +9 -0
  102. package/src/gitlab/handlers.ts +4 -0
  103. package/src/heartbeat/heartbeat.ts +8 -0
  104. package/src/http/approval-requests.ts +1 -0
  105. package/src/http/apps.ts +1 -0
  106. package/src/http/config.ts +15 -6
  107. package/src/http/mcp.ts +31 -4
  108. package/src/http/script-runs.ts +6 -0
  109. package/src/http/tasks.ts +52 -30
  110. package/src/integrations/kapso/inbound.ts +1 -0
  111. package/src/jira/sync.ts +2 -0
  112. package/src/linear/sync.ts +2 -0
  113. package/src/prompts/session-templates.ts +29 -15
  114. package/src/scheduler/deferred-task-waits.ts +123 -0
  115. package/src/scheduler/schedule-task.ts +42 -0
  116. package/src/scheduler/scheduler.ts +22 -31
  117. package/src/script-workflows/workflow-ctx.ts +2 -0
  118. package/src/scripts-runtime/types/stdlib.d.ts +38 -24
  119. package/src/scripts-runtime/types/swarm-sdk.d.ts +38 -24
  120. package/src/server.ts +10 -1
  121. package/src/slack/actions.ts +1 -0
  122. package/src/slack/assistant.ts +2 -0
  123. package/src/slack/handlers.ts +3 -0
  124. package/src/slack/thread-buffer.ts +2 -0
  125. package/src/tasks/worker-follow-up.ts +9 -0
  126. package/src/tests/acp-adapter.test.ts +35 -6
  127. package/src/tests/acp-session-token.test.ts +67 -0
  128. package/src/tests/asset-key-api.test.ts +15 -2
  129. package/src/tests/asset-key-mcp.test.ts +2 -0
  130. package/src/tests/automation-preflight-alert.test.ts +91 -0
  131. package/src/tests/claude-worker-parity.test.ts +3 -0
  132. package/src/tests/config-session-auth.test.ts +143 -0
  133. package/src/tests/defer-task.test.ts +117 -6
  134. package/src/tests/deferred-task-wake.test.ts +456 -0
  135. package/src/tests/heartbeat-reroute-decision.test.ts +1 -0
  136. package/src/tests/http-api-integration.test.ts +33 -4
  137. package/src/tests/model-control.test.ts +18 -5
  138. package/src/tests/opencode-adapter.test.ts +2 -2
  139. package/src/tests/promote-draft-task-route.test.ts +4 -0
  140. package/src/tests/prompt-template-session.test.ts +13 -4
  141. package/src/tests/rbac-wire-e2e.test.ts +2 -2
  142. package/src/tests/routing-decision-persistence.test.ts +520 -0
  143. package/src/tests/routing-reason-contract.test.ts +89 -0
  144. package/src/tests/routing-reason-inventory.test.ts +55 -0
  145. package/src/tests/schedule-target-type.test.ts +48 -1
  146. package/src/tests/scheduled-task-required-params-migration.test.ts +182 -0
  147. package/src/tests/scheduled-tasks.test.ts +9 -5
  148. package/src/tests/script-connections.test.ts +4 -0
  149. package/src/tests/script-runs-http.test.ts +31 -0
  150. package/src/tests/scripts-typecheck.test.ts +11 -0
  151. package/src/tests/secret-scrubber.test.ts +12 -0
  152. package/src/tests/seed-registry.test.ts +2 -2
  153. package/src/tests/seed-schedules.test.ts +99 -3
  154. package/src/tests/seed-workflows.test.ts +74 -0
  155. package/src/tests/send-task-output-schema.test.ts +66 -1
  156. package/src/tests/send-task-requested-by.test.ts +1 -0
  157. package/src/tests/send-task-slack-routing-guard.test.ts +2 -0
  158. package/src/tests/store-progress-blocked-waiting-gate.test.ts +151 -0
  159. package/src/tests/swarm-tool-result-gate.test.ts +24 -0
  160. package/src/tests/task-tool-manifest.test.ts +47 -0
  161. package/src/tests/task-tool-preload-mcp.test.ts +125 -0
  162. package/src/tests/task-tools-ctx.test.ts +2 -0
  163. package/src/tests/tool-output-agent-id.test.ts +1 -0
  164. package/src/tests/ui-followup-lead-delegation.test.ts +6 -1
  165. package/src/tests/workflow-agent-task.test.ts +24 -1
  166. package/src/tests/workflow-engine-v2.test.ts +58 -2
  167. package/src/tools/defer-task.ts +73 -21
  168. package/src/tools/send-task.ts +31 -0
  169. package/src/tools/skills/skill-publish.ts +1 -0
  170. package/src/tools/store-progress.ts +43 -0
  171. package/src/tools/templates.ts +2 -1
  172. package/src/tools/utils.ts +33 -2
  173. package/src/types.ts +14 -1
  174. package/src/utils/acp-session-token.ts +14 -4
  175. package/src/utils/secret-scrubber.ts +2 -0
  176. package/src/utils/task-tool-manifest.ts +33 -0
  177. package/src/workflows/engine.ts +4 -1
  178. package/src/workflows/executors/agent-task.ts +7 -1
  179. package/templates/ai-toolbox.manifest.json +6 -1
  180. package/templates/schedules/daily-blocker-digest/config.json +6 -1
  181. package/templates/schedules/daily-compounding-reflection/config.json +1 -0
  182. package/templates/schedules/daily-status-report/config.json +6 -1
  183. package/templates/schedules/daily-swarm-update-check/config.json +19 -0
  184. package/templates/schedules/daily-swarm-update-check/content.md +49 -0
  185. package/templates/schedules/daily-workflow-health-audit/config.json +6 -1
  186. package/templates/skills/comms/config.json +18 -0
  187. package/templates/skills/comms/content.md +74 -0
  188. package/templates/skills/comms/files/references/ste-rules.md +73 -0
  189. package/templates/skills/comms/files/references/visual-shapes.md +112 -0
  190. package/templates/skills/swarm-scripts/SKILL.md +3 -2
  191. package/templates/skills/swarm-scripts/content.md +3 -2
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > **This repo evolves every single day.** [Watch now →](https://github.com/desplega-ai/agent-swarm/subscription)
6
6
  <p align="center"><video src="https://github.com/user-attachments/assets/e220712e-c54d-4f46-b059-bac04639d229" controls muted playsinline width="720"></video></p>
7
7
  <p align="center"><sub>▸ <a href="./assets/agent-swarm.mp4">daily evolution</a> · <a href="./assets/agent-swarm-slack-to-pr.mp4">slack → pr</a> · <a href="./assets/video-source">Making of</a></sub></p>
8
- <p align="center"><a href="https://agent-swarm.dev"><img src="https://img.shields.io/badge/Website-agent--swarm.dev-000?style=for-the-badge" alt="Website"></a> <a href="https://docs.agent-swarm.dev"><img src="https://img.shields.io/badge/Docs-docs.agent--swarm.dev-amber?style=for-the-badge" alt="Docs"></a> <a href="https://app.agent-swarm.dev"><img src="https://img.shields.io/badge/Dashboard-app.agent--swarm.dev-blue?style=for-the-badge" alt="Dashboard"></a> <a href="https://discord.gg/KZgfyyDVZa"><img src="https://img.shields.io/badge/Discord-Join%20Community-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join Discord"></a> <a href="https://x.com/desplegalabs"><img src="https://img.shields.io/badge/𝕏-@desplegalabs-000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X"></a> <a href="https://www.linkedin.com/company/desplega-labs/"><img src="https://img.shields.io/badge/LinkedIn-Desplega%20Labs-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="Desplega Labs on LinkedIn"></a></p>
8
+ <p align="center"><a href="https://agent-swarm.dev"><img src="https://img.shields.io/badge/Website-agent--swarm.dev-000?style=for-the-badge" alt="Website"></a> <a href="https://docs.agent-swarm.dev"><img src="https://img.shields.io/badge/Docs-docs.agent--swarm.dev-amber?style=for-the-badge" alt="Docs"></a> <a href="https://app.agent-swarm.dev"><img src="https://img.shields.io/badge/Dashboard-app.agent--swarm.dev-blue?style=for-the-badge" alt="Dashboard"></a> <a href="https://discord.gg/KZgfyyDVZa"><img src="https://img.shields.io/badge/Discord-Join%20Community-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join Discord"></a> <a href="https://x.com/desplegalabs"><img src="https://img.shields.io/badge/𝕏-@desplegalabs-000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X"></a> <a href="https://www.linkedin.com/company/desplega-labs/"><img src="https://img.shields.io/badge/LinkedIn-Desplega%20Labs-0A66C2?style=for-the-badge&logo=linkedin&logoColor=white" alt="Desplega Labs on LinkedIn"></a> <a href="https://www.youtube.com/@desplega-labs/videos"><img src="https://img.shields.io/badge/YouTube-Desplega%20Labs-FF0000?style=for-the-badge&logo=youtube&logoColor=white" alt="Desplega Labs on YouTube"></a></p>
9
9
 
10
10
  agent-swarm.dev is an open-source operating system for AI work. A lead agent delegates goals to workers such as Claude Code or Codex. Isolated containers, shared memory, tools, schedules, and review gates preserve work across sessions.
11
11
 
@@ -13,6 +13,7 @@ agent-swarm.dev is an open-source operating system for AI work. A lead agent del
13
13
 
14
14
  - A lead agent that receives work from Slack, repositories, issue trackers, email, or the API
15
15
  - [Schema-validated task results](./MCP.md#send-task) for callers that need structured JSON output
16
+ - [Deferred tasks](./MCP.md#defer-task) that wake when another task finishes or a deadline arrives
16
17
  - [Dashboard file attachments](https://docs.agent-swarm.dev/docs/ui#file-attachments) by drag-and-drop or file picker
17
18
  - Workers in isolated Docker containers with development environments
18
19
  - Memory and identity that persist across sessions
@@ -29,11 +29,11 @@ import {
29
29
  import {
30
30
  init_package,
31
31
  package_default
32
- } from "./cli-anedxf1w.js";
32
+ } from "./cli-e06a8a7y.js";
33
33
  import {
34
34
  init_secret_scrubber,
35
35
  scrubSecrets
36
- } from "./cli-xqcq9y5e.js";
36
+ } from "./cli-r2ap2czm.js";
37
37
  import"./cli-bc05qbss.js";
38
38
 
39
39
  // node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -4349,6 +4349,8 @@ class ClientSideConnection {
4349
4349
  init_package();
4350
4350
 
4351
4351
  // src/utils/acp-session-token.ts
4352
+ init_secret_scrubber();
4353
+ var REVOKE_TIMEOUT_MS = 5000;
4352
4354
  var ACP_SESSION_TOKEN_TTL_MS = 24 * 60 * 60 * 1000;
4353
4355
  async function mintAcpSessionToken(apiUrl, apiKey, agentId, taskId) {
4354
4356
  const res = await fetch(`${apiUrl.replace(/\/+$/, "")}/api/sessions/tokens`, {
@@ -4367,11 +4369,16 @@ async function mintAcpSessionToken(apiUrl, apiKey, agentId, taskId) {
4367
4369
  }
4368
4370
  async function revokeAcpSessionToken(apiUrl, apiKey, tokenId) {
4369
4371
  try {
4370
- await fetch(`${apiUrl.replace(/\/+$/, "")}/api/sessions/tokens/${tokenId}`, {
4372
+ const res = await fetch(`${apiUrl.replace(/\/+$/, "")}/api/sessions/tokens/${tokenId}`, {
4371
4373
  method: "DELETE",
4372
- headers: { Authorization: `Bearer ${apiKey}` }
4374
+ headers: { Authorization: `Bearer ${apiKey}` },
4375
+ signal: AbortSignal.timeout(REVOKE_TIMEOUT_MS)
4373
4376
  });
4374
- } catch {}
4377
+ if (!res.ok)
4378
+ throw new Error(`HTTP ${res.status}`);
4379
+ } catch (error) {
4380
+ console.warn(scrubSecrets(`[acp] Session token revoke failed: ${error instanceof Error ? error.message : String(error)}`));
4381
+ }
4375
4382
  }
4376
4383
 
4377
4384
  // src/providers/acp-adapter.ts
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  resolveSlackUserId
3
- } from "./cli-n2cwscdd.js";
4
- import"./cli-xqcpg1st.js";
3
+ } from "./cli-9br8ypfv.js";
4
+ import"./cli-j4d4f6hv.js";
5
5
  import {
6
6
  createTaskWithSiblingAwareness
7
- } from "./cli-7gn7c2af.js";
7
+ } from "./cli-ayvy5kde.js";
8
8
  import {
9
9
  buildCancelledBlocks,
10
10
  ensureSlackThreadTree,
@@ -12,7 +12,7 @@ import {
12
12
  getAgentEmoji,
13
13
  getTaskLink,
14
14
  isSlackRenderV2Enabled
15
- } from "./cli-dk3me3qs.js";
15
+ } from "./cli-3sysyjve.js";
16
16
  import"./cli-q51yprfq.js";
17
17
  import"./cli-9d8ntetj.js";
18
18
  import"./cli-yatxqynm.js";
@@ -24,16 +24,16 @@ import {
24
24
  init_context_key,
25
25
  init_db,
26
26
  slackContextKey
27
- } from "./cli-6s2y152y.js";
28
- import"./cli-y6b6fb76.js";
29
- import"./cli-kpv03zhj.js";
27
+ } from "./cli-qgd4sqz5.js";
28
+ import"./cli-08b07b4r.js";
29
+ import"./cli-3apbzgyk.js";
30
30
  import"./cli-e29gmdmw.js";
31
31
  import"./cli-c2mk1kgf.js";
32
32
  import"./cli-ej6gbxfb.js";
33
33
  import"./cli-sd0mxa3c.js";
34
34
  import"./cli-w5e1d1vv.js";
35
- import"./cli-anedxf1w.js";
36
- import"./cli-xqcq9y5e.js";
35
+ import"./cli-e06a8a7y.js";
36
+ import"./cli-r2ap2czm.js";
37
37
  import"./cli-pzxba7gw.js";
38
38
  import"./cli-zf8jjwex.js";
39
39
  import"./cli-bd957dgb.js";
@@ -104,6 +104,7 @@ function registerActionHandlers(app) {
104
104
  });
105
105
  const followUpTask = await createTaskWithSiblingAwareness(followUpText, {
106
106
  agentId: lead?.id,
107
+ routingReason: lead ? "skill" : undefined,
107
108
  source: "slack",
108
109
  parentTaskId: taskId,
109
110
  slackChannelId: originalTask.slackChannelId,
@@ -3,20 +3,20 @@ import {
3
3
  initSlackApp,
4
4
  startSlackApp,
5
5
  stopSlackApp
6
- } from "./cli-dk3me3qs.js";
6
+ } from "./cli-3sysyjve.js";
7
7
  import"./cli-q51yprfq.js";
8
8
  import"./cli-9d8ntetj.js";
9
9
  import"./cli-yatxqynm.js";
10
- import"./cli-6s2y152y.js";
11
- import"./cli-y6b6fb76.js";
12
- import"./cli-kpv03zhj.js";
10
+ import"./cli-qgd4sqz5.js";
11
+ import"./cli-08b07b4r.js";
12
+ import"./cli-3apbzgyk.js";
13
13
  import"./cli-e29gmdmw.js";
14
14
  import"./cli-c2mk1kgf.js";
15
15
  import"./cli-ej6gbxfb.js";
16
16
  import"./cli-sd0mxa3c.js";
17
17
  import"./cli-w5e1d1vv.js";
18
- import"./cli-anedxf1w.js";
19
- import"./cli-xqcq9y5e.js";
18
+ import"./cli-e06a8a7y.js";
19
+ import"./cli-r2ap2czm.js";
20
20
  import"./cli-pzxba7gw.js";
21
21
  import"./cli-zf8jjwex.js";
22
22
  import"./cli-bd957dgb.js";
@@ -2,7 +2,7 @@ import {
2
2
  bufferThreadMessage,
3
3
  getBufferMessageCount,
4
4
  wasEventSeen
5
- } from "./cli-qy6h009w.js";
5
+ } from "./cli-1c94wvcw.js";
6
6
  import {
7
7
  bufferedFileFailures,
8
8
  buildEffectiveText,
@@ -10,20 +10,20 @@ import {
10
10
  fetchSlackFiles,
11
11
  hasOtherUserMention,
12
12
  notifySlackFileFailures
13
- } from "./cli-hz8xhefy.js";
13
+ } from "./cli-sdzq01t9.js";
14
14
  import"./cli-jsp14b6c.js";
15
15
  import {
16
16
  resolveSlackUserId,
17
17
  rewriteSlackMentions
18
- } from "./cli-n2cwscdd.js";
19
- import"./cli-xqcpg1st.js";
20
- import"./cli-7gn7c2af.js";
18
+ } from "./cli-9br8ypfv.js";
19
+ import"./cli-j4d4f6hv.js";
20
+ import"./cli-ayvy5kde.js";
21
21
  import {
22
22
  ackSlackMessage,
23
23
  ensureSlackThreadTree,
24
24
  isSlackRenderV2Enabled,
25
25
  require_dist
26
- } from "./cli-dk3me3qs.js";
26
+ } from "./cli-3sysyjve.js";
27
27
  import"./cli-q51yprfq.js";
28
28
  import"./cli-9d8ntetj.js";
29
29
  import"./cli-yatxqynm.js";
@@ -35,12 +35,12 @@ import {
35
35
  init_db,
36
36
  reactionName,
37
37
  slackContextKey
38
- } from "./cli-6s2y152y.js";
39
- import"./cli-y6b6fb76.js";
38
+ } from "./cli-qgd4sqz5.js";
39
+ import"./cli-08b07b4r.js";
40
40
  import {
41
41
  init_resolver,
42
42
  resolveTemplate
43
- } from "./cli-kpv03zhj.js";
43
+ } from "./cli-3apbzgyk.js";
44
44
  import"./cli-e29gmdmw.js";
45
45
  import"./cli-c2mk1kgf.js";
46
46
  import {
@@ -49,8 +49,8 @@ import {
49
49
  } from "./cli-ej6gbxfb.js";
50
50
  import"./cli-sd0mxa3c.js";
51
51
  import"./cli-w5e1d1vv.js";
52
- import"./cli-anedxf1w.js";
53
- import"./cli-xqcq9y5e.js";
52
+ import"./cli-e06a8a7y.js";
53
+ import"./cli-r2ap2czm.js";
54
54
  import"./cli-pzxba7gw.js";
55
55
  import"./cli-zf8jjwex.js";
56
56
  import"./cli-bd957dgb.js";
@@ -159,6 +159,7 @@ function createAssistant() {
159
159
  const latestTask = await getMostRecentTaskInThread(channelId, threadTs);
160
160
  const { task: task2, unattached: unattached2 } = await createSlackTaskWithFiles(renderedMessageText, {
161
161
  agentId: workingAgent.id,
162
+ routingReason: "continuity",
162
163
  source: "slack",
163
164
  slackChannelId: channelId,
164
165
  slackThreadTs: threadTs,
@@ -207,6 +208,7 @@ function createAssistant() {
207
208
  }
208
209
  const { task, unattached } = await createSlackTaskWithFiles(renderedMessageText + channelContext, {
209
210
  agentId: lead.id,
211
+ routingReason: "skill",
210
212
  source: "slack",
211
213
  slackChannelId: channelId,
212
214
  slackThreadTs: threadTs,
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  embedScript,
3
3
  embeddingProvider
4
- } from "./cli-kzvhgvk3.js";
5
- import"./cli-5khqvvnq.js";
6
- import"./cli-m9sxbkhm.js";
4
+ } from "./cli-3z634pqe.js";
5
+ import"./cli-jezx9b9c.js";
6
+ import"./cli-zvz62chv.js";
7
7
  import"./cli-aehm1rbq.js";
8
8
  import"./cli-9d8ntetj.js";
9
9
  import {
10
10
  getDbClient,
11
11
  init_db
12
- } from "./cli-6s2y152y.js";
13
- import"./cli-y6b6fb76.js";
14
- import"./cli-kpv03zhj.js";
12
+ } from "./cli-qgd4sqz5.js";
13
+ import"./cli-08b07b4r.js";
14
+ import"./cli-3apbzgyk.js";
15
15
  import"./cli-e29gmdmw.js";
16
16
  import"./cli-c2mk1kgf.js";
17
17
  import"./cli-ej6gbxfb.js";
18
18
  import"./cli-sd0mxa3c.js";
19
19
  import"./cli-w5e1d1vv.js";
20
- import"./cli-anedxf1w.js";
21
- import"./cli-xqcq9y5e.js";
20
+ import"./cli-e06a8a7y.js";
21
+ import"./cli-r2ap2czm.js";
22
22
  import"./cli-zf8jjwex.js";
23
23
  import"./cli-bc05qbss.js";
24
24
 
@@ -3,23 +3,23 @@ import {
3
3
  getEmbeddingProvider,
4
4
  getMemoryStore,
5
5
  init_constants
6
- } from "./cli-5khqvvnq.js";
7
- import"./cli-m9sxbkhm.js";
6
+ } from "./cli-jezx9b9c.js";
7
+ import"./cli-zvz62chv.js";
8
8
  import"./cli-aehm1rbq.js";
9
9
  import"./cli-9d8ntetj.js";
10
10
  import {
11
11
  getDbClient,
12
12
  init_db
13
- } from "./cli-6s2y152y.js";
14
- import"./cli-y6b6fb76.js";
15
- import"./cli-kpv03zhj.js";
13
+ } from "./cli-qgd4sqz5.js";
14
+ import"./cli-08b07b4r.js";
15
+ import"./cli-3apbzgyk.js";
16
16
  import"./cli-e29gmdmw.js";
17
17
  import"./cli-c2mk1kgf.js";
18
18
  import"./cli-ej6gbxfb.js";
19
19
  import"./cli-sd0mxa3c.js";
20
20
  import"./cli-w5e1d1vv.js";
21
- import"./cli-anedxf1w.js";
22
- import"./cli-xqcq9y5e.js";
21
+ import"./cli-e06a8a7y.js";
22
+ import"./cli-r2ap2czm.js";
23
23
  import"./cli-zf8jjwex.js";
24
24
  import"./cli-bc05qbss.js";
25
25
 
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  getDbClient,
3
3
  init_db
4
- } from "./cli-6s2y152y.js";
5
- import"./cli-y6b6fb76.js";
6
- import"./cli-kpv03zhj.js";
4
+ } from "./cli-qgd4sqz5.js";
5
+ import"./cli-08b07b4r.js";
6
+ import"./cli-3apbzgyk.js";
7
7
  import"./cli-e29gmdmw.js";
8
8
  import"./cli-c2mk1kgf.js";
9
9
  import"./cli-ej6gbxfb.js";
10
10
  import"./cli-sd0mxa3c.js";
11
11
  import"./cli-w5e1d1vv.js";
12
- import"./cli-anedxf1w.js";
12
+ import"./cli-e06a8a7y.js";
13
13
  import {
14
14
  init_secret_scrubber,
15
15
  scrubSecrets
16
- } from "./cli-xqcq9y5e.js";
16
+ } from "./cli-r2ap2czm.js";
17
17
  import"./cli-zf8jjwex.js";
18
18
  import"./cli-bc05qbss.js";
19
19
 
@@ -17,11 +17,11 @@ import {
17
17
  resolveClaudeBridgeEnabled,
18
18
  resolveClaudeQueueSteeringOverride,
19
19
  runClaudeSessionSummary
20
- } from "./cli-m1p5cysp.js";
21
- import"./cli-brxyat7h.js";
22
- import"./cli-d8brzxjb.js";
20
+ } from "./cli-k351hv5k.js";
21
+ import"./cli-tg8qj8ee.js";
22
+ import"./cli-4wtq5jjv.js";
23
23
  import"./cli-b5b30yzk.js";
24
- import"./cli-rvqz34y5.js";
24
+ import"./cli-jecc01cb.js";
25
25
  import"./cli-hp1n6zq3.js";
26
26
  import"./cli-tng3131n.js";
27
27
  import"./cli-zm7njwzd.js";
@@ -35,18 +35,18 @@ import"./cli-e7d20cty.js";
35
35
  import"./cli-3dpj7atn.js";
36
36
  import"./cli-y89t4nca.js";
37
37
  import"./cli-f14fvzag.js";
38
- import"./cli-m9sxbkhm.js";
38
+ import"./cli-zvz62chv.js";
39
39
  import"./cli-bsakbbkm.js";
40
40
  import"./cli-9d8ntetj.js";
41
- import"./cli-y6b6fb76.js";
42
- import"./cli-kpv03zhj.js";
41
+ import"./cli-08b07b4r.js";
42
+ import"./cli-3apbzgyk.js";
43
43
  import"./cli-e29gmdmw.js";
44
44
  import"./cli-c2mk1kgf.js";
45
45
  import"./cli-ej6gbxfb.js";
46
46
  import"./cli-sd0mxa3c.js";
47
47
  import"./cli-w5e1d1vv.js";
48
- import"./cli-anedxf1w.js";
49
- import"./cli-xqcq9y5e.js";
48
+ import"./cli-e06a8a7y.js";
49
+ import"./cli-r2ap2czm.js";
50
50
  import"./cli-knd276ed.js";
51
51
  import"./cli-c4eeb5q2.js";
52
52
  import"./cli-btbzvq95.js";
@@ -3,13 +3,13 @@ import {
3
3
  checkClaudeManagedCredentials,
4
4
  composeManagedUserMessage,
5
5
  normalizeRepoUrl
6
- } from "./cli-cn6mmc7f.js";
6
+ } from "./cli-6664w7y4.js";
7
7
  import"./cli-hsxj0yar.js";
8
8
  import"./cli-2djtr51b.js";
9
9
  import"./cli-j490egb5.js";
10
10
  import"./cli-hp1n6zq3.js";
11
11
  import"./cli-s25avqg9.js";
12
- import"./cli-xqcq9y5e.js";
12
+ import"./cli-r2ap2czm.js";
13
13
  import"./cli-bc05qbss.js";
14
14
  export {
15
15
  ClaudeManagedAdapter,
@@ -3,15 +3,15 @@ import {
3
3
  cleanupTaskFile,
4
4
  normalizeClaudeMessage,
5
5
  runClaudeSessionSummary
6
- } from "./cli-m1p5cysp.js";
7
- import"./cli-brxyat7h.js";
8
- import"./cli-d8brzxjb.js";
6
+ } from "./cli-k351hv5k.js";
7
+ import"./cli-tg8qj8ee.js";
8
+ import"./cli-4wtq5jjv.js";
9
9
  import {
10
10
  SessionErrorTracker,
11
11
  parseStderrForErrors,
12
12
  trackErrorFromJson
13
13
  } from "./cli-b5b30yzk.js";
14
- import"./cli-rvqz34y5.js";
14
+ import"./cli-jecc01cb.js";
15
15
  import"./cli-hp1n6zq3.js";
16
16
  import"./cli-tng3131n.js";
17
17
  import"./cli-zm7njwzd.js";
@@ -32,21 +32,21 @@ import {
32
32
  terminateProcessGroup
33
33
  } from "./cli-y89t4nca.js";
34
34
  import"./cli-f14fvzag.js";
35
- import"./cli-m9sxbkhm.js";
35
+ import"./cli-zvz62chv.js";
36
36
  import"./cli-bsakbbkm.js";
37
37
  import"./cli-9d8ntetj.js";
38
- import"./cli-y6b6fb76.js";
39
- import"./cli-kpv03zhj.js";
38
+ import"./cli-08b07b4r.js";
39
+ import"./cli-3apbzgyk.js";
40
40
  import"./cli-e29gmdmw.js";
41
41
  import"./cli-c2mk1kgf.js";
42
42
  import"./cli-ej6gbxfb.js";
43
43
  import"./cli-sd0mxa3c.js";
44
44
  import"./cli-w5e1d1vv.js";
45
- import"./cli-anedxf1w.js";
45
+ import"./cli-e06a8a7y.js";
46
46
  import {
47
47
  init_secret_scrubber,
48
48
  scrubSecrets
49
- } from "./cli-xqcq9y5e.js";
49
+ } from "./cli-r2ap2czm.js";
50
50
  import"./cli-knd276ed.js";
51
51
  import"./cli-c4eeb5q2.js";
52
52
  import"./cli-btbzvq95.js";
@@ -11,14 +11,14 @@ import {
11
11
  getResumeGeneration,
12
12
  repointTrackerSyncBySwarmId,
13
13
  resolveLeadOnlyRecoveryAssignment
14
- } from "./cli-3n7cbfjn.js";
14
+ } from "./cli-y3pq4v9g.js";
15
15
  import {
16
16
  isMultiRuntimeEnabled
17
17
  } from "./cli-07jd68a1.js";
18
18
  import {
19
19
  getExecutorRegistry,
20
20
  recoverIncompleteRuns
21
- } from "./cli-f8j56xv2.js";
21
+ } from "./cli-ddfw1mc4.js";
22
22
  import {
23
23
  MAX_EMPTY_POLLS,
24
24
  assignUnassignedTaskPending,
@@ -61,17 +61,17 @@ import {
61
61
  releaseStaleReviewingTasks,
62
62
  supersedeTask,
63
63
  updateAgentStatus
64
- } from "./cli-6s2y152y.js";
64
+ } from "./cli-qgd4sqz5.js";
65
65
  import {
66
66
  init_registry,
67
67
  init_resolver,
68
68
  registerTemplate,
69
69
  resolveTemplate
70
- } from "./cli-kpv03zhj.js";
70
+ } from "./cli-3apbzgyk.js";
71
71
  import {
72
72
  init_secret_scrubber,
73
73
  scrubSecrets
74
- } from "./cli-xqcq9y5e.js";
74
+ } from "./cli-r2ap2czm.js";
75
75
 
76
76
  // src/heartbeat/heartbeat.ts
77
77
  init_db();
@@ -519,6 +519,7 @@ async function runRebootSweep() {
519
519
  const retryTask = await createTaskExtended(task.task, {
520
520
  parentTaskId: task.id,
521
521
  agentId: preferredAgentId,
522
+ routingReason: preferredAgentId === undefined ? undefined : preferredAgentId === task.agentId ? "continuity" : "reroute_fault",
522
523
  tags,
523
524
  priority: task.priority,
524
525
  source: task.source,
@@ -891,6 +892,7 @@ async function checkHeartbeatChecklist() {
891
892
  return;
892
893
  await createTaskExtended(result.text, {
893
894
  agentId: lead.id,
895
+ routingReason: "skill",
894
896
  taskType: "heartbeat-checklist",
895
897
  tags: ["checklist", "auto-generated"],
896
898
  priority: 60
@@ -1025,6 +1027,7 @@ async function createBootTriageTask() {
1025
1027
  return;
1026
1028
  await createTaskExtended(result.text, {
1027
1029
  agentId: lead.id,
1030
+ routingReason: "skill",
1028
1031
  taskType: "boot-triage",
1029
1032
  tags: ["boot", "triage", "auto-generated"],
1030
1033
  priority: 70
@@ -6,7 +6,7 @@ import {
6
6
  isSteeringEnabled,
7
7
  registerTemplate,
8
8
  resolveTemplateAsync
9
- } from "./cli-kpv03zhj.js";
9
+ } from "./cli-3apbzgyk.js";
10
10
  import {
11
11
  __esm
12
12
  } from "./cli-bc05qbss.js";
@@ -3,7 +3,7 @@ import {
3
3
  registerVolatileSecret,
4
4
  scrubObject,
5
5
  scrubSecrets
6
- } from "./cli-xqcq9y5e.js";
6
+ } from "./cli-r2ap2czm.js";
7
7
 
8
8
  // src/x/composio.ts
9
9
  init_secret_scrubber();
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createAdditiveBuffer,
3
3
  extractSlackMessageText
4
- } from "./cli-hz8xhefy.js";
4
+ } from "./cli-sdzq01t9.js";
5
5
  import {
6
6
  rewriteSlackMentions
7
- } from "./cli-n2cwscdd.js";
7
+ } from "./cli-9br8ypfv.js";
8
8
  import {
9
9
  createTaskWithSiblingAwareness
10
- } from "./cli-7gn7c2af.js";
10
+ } from "./cli-ayvy5kde.js";
11
11
  import {
12
12
  buildBufferFlushBlocks,
13
13
  ensureSlackThreadTree,
@@ -16,7 +16,7 @@ import {
16
16
  getSlackApp,
17
17
  isSlackRenderV2Enabled,
18
18
  registerTreeMessage
19
- } from "./cli-dk3me3qs.js";
19
+ } from "./cli-3sysyjve.js";
20
20
  import {
21
21
  createLogEntry,
22
22
  getAgentById,
@@ -29,11 +29,11 @@ import {
29
29
  init_steering,
30
30
  requestSteering,
31
31
  slackContextKey
32
- } from "./cli-6s2y152y.js";
32
+ } from "./cli-qgd4sqz5.js";
33
33
  import {
34
34
  init_steering_enabled,
35
35
  isSteeringEnabled
36
- } from "./cli-kpv03zhj.js";
36
+ } from "./cli-3apbzgyk.js";
37
37
 
38
38
  // src/slack/event-dedup.ts
39
39
  var DEFAULT_TTL_MS = 300000;
@@ -253,6 +253,7 @@ ${description}` : description;
253
253
  const mostRecentTask = await getMostRecentTaskInThread(channelId, threadTs);
254
254
  const task = await createTaskWithSiblingAwareness(fullDescription, {
255
255
  agentId: lead?.id,
256
+ routingReason: lead && mostRecentTask?.agentId === lead.id ? "continuity" : lead ? "skill" : undefined,
256
257
  source: "slack",
257
258
  slackChannelId: channelId,
258
259
  slackThreadTs: threadTs,
@@ -285,14 +285,15 @@ The task has four endings. When you are done: \`completed\`. When the answer nee
285
285
  Your output is delegation and review. Workers implement, research, analyze, and write. Data gathering, even a quick query, goes to a worker. You answer simple factual questions yourself.
286
286
 
287
287
  \`get-swarm\` is the roster. Route by capability and load.
288
- Delegate with \`send-task\`. Read a child's result with \`get-task-details\`.
288
+ \`send-task\`: include \`routingReason\` with \`agentId\`. Read results via \`get-task-details\`.
289
289
  A task states the goal, the repo URL when there is one, and the constraints. Workers know git, the skills, and \`store-progress\`.
290
290
  Delegate by the shape of the work: a workflow for multi-step or fan-out work, a schedule for recurring work, a script for bulk data, an inline \`script-run\` for a one-off bulk job you can run yourself. The \`workflow-iterate\`, \`scheduling\`, and \`swarm-scripts\` skills build them.
291
291
  Research or exploration: tell the worker to use the \`researching\` skill. A large feature: a task for the \`planning\` skill first, then a task for the \`implementing\` skill with \`parentTaskId\`. A small fix: direct implementation.
292
292
  A follow-up that continues earlier work carries \`parentTaskId\`. The worker receives the prior context.
293
- A task whose result depends on the workers' output: wait for the children with the \`wait-for-task\` script, then merge and complete the task yourself. A turn that ends with children still running leaves the task unfinished.
294
293
 
295
- A worker's completion or failure arrives as a follow-up task. Review the output and complete the follow-up. The worker's result is the answer. A person decides only when the worker failed and the failure needs a person.
294
+ Worker completion/failure triggers a follow-up by default. For longer work, \`defer-task\` with a wake-up or complete this task. Review the worker's answer and complete the follow-up. Escalate only failures needing a person.
295
+
296
+ Wait inline via \`wait-for-task\` only for an essential result expected within ~1 minute. Set \`send-task.followUpConfig.disabled=true\`; cap all waits at ~1 minute total. If still running, \`defer-task\` with a wake-up.
296
297
 
297
298
  A task from an unknown user: register them with \`manage-user\`, then continue.
298
299
  Your heartbeat runbook is the \`heartbeatMd\` profile field. Edit it with \`update-profile\`. You MUST use the \`heartbeat-runbook\` skill when you handle a heartbeat checklist task.
@@ -398,16 +399,20 @@ Link env: \`APP_URL\` for pages, \`MCP_BASE_URL\` for the API. Report missing va
398
399
  defaultBody: `
399
400
  ## How you write
400
401
 
401
- These rules cover everything a person reads from you: Slack, PR and issue comments, tickets, email, pages, task output.
402
+ For human-facing replies and artifacts: lead with the result. Use plain words, active voice, one idea per sentence, and sentence case headings.
403
+ State blockers and reasons. Preserve meaningful uncertainty.
404
+ Omit em dashes, filler, sign-offs, praise, repetition, step narration, and generic offers to elaborate.
405
+
406
+ Simple replies: one to three sentences. Routine replies: under 120 words, using short paragraphs or up to three bullets.
407
+ Use more detail for requested depth or essential evidence, caveats, or instructions.
408
+ Include context only when it changes understanding or action. Link extensive supporting material when useful, but make the reply self-contained.
409
+ Do not shorten investigation, required artifacts, or schema-defined output to meet reply limits.
402
410
 
403
- Lead with the result. Context comes after.
404
- One idea per sentence. Active voice with a named actor.
405
- Sentence case headings. Plain words: use, help, many, if.
406
- Keep a hedge only when you are unsure. "May have failed" stays "may have failed".
407
- When something is broken, blocked, or a bad idea, say so and say why.
408
- Reply in the requester's language, at the depth they asked for. A one-line question gets the answer first.
409
- A Requester Profile section, when present, wins on tone, depth, and format. Correctness wins over style.
410
- Em dashes, filler, sign-offs, and praise of the question are out.
411
+ Follow the current request and Requester Profile for language, tone, depth, and format. Correctness wins over style.
412
+ Use the \`comms\` skill when available for requested simplification or clarity rewrites. Ordinary replies need no skill invocation.
413
+ Use Visual mode only for explicit visual requests with delivery tools available in the active channel.
414
+ Requests to show data are not visual requests. New facts, diagnosis, and actions still require work.
415
+ Output schemas and channel delivery rules, including Slack's engine-owned delivery, override skill defaults.
411
416
  `,
412
417
  variables: [],
413
418
  category: "system"
@@ -461,6 +466,13 @@ You may receive steering messages while this task is running. Each one arrives w
461
466
  ],
462
467
  category: "system"
463
468
  });
469
+ registerTemplate({
470
+ eventType: "system.agent.tool_preload",
471
+ header: "",
472
+ defaultBody: "This session preloads selected swarm tools. If a tool definition is already available in context, call it directly. Use your harness tool search only for tools whose definitions are not yet available.",
473
+ variables: [],
474
+ category: "system"
475
+ });
464
476
  registerTemplate({
465
477
  eventType: "system.agent.tools_skills",
466
478
  header: "",
@@ -521,8 +533,8 @@ This swarm runs in **scripts-only mode**. The ONLY swarm MCP tools available are
521
533
  The script authoring contract in the \`swarm-scripts\` skill (entry signature, \`ctx\` shape, secret handling) applies here unchanged. The full SDK is \`ctx.swarm.*\`: task lifecycle (\`task_get\`, \`task_send\`, \`task_storeProgress\`, \`task_action\`, \`task_list\`), Slack (\`slack_reply\`, \`slack_post\`, \`slack_read\`), memory, kv, swarm info (\`swarm_get\`, \`agent_info\`), and more. Responses are usually wrapped; prefer \`res?.data ?? res\`.
522
534
 
523
535
  **Built-in coordination scripts, USE THESE FIRST (\`script-run\` with \`name\` + \`args\`):**
524
- - \`delegate\` {agentName, task, parentTaskId?} → subtask for an agent by name; returns {taskId}
525
- - \`wait-for-task\` {taskId} → waits up to ~25s for a terminal state; returns {done, status, output}; while done=false call it again
536
+ - \`delegate\` {agentName, task, routingReason, parentTaskId?} → subtask for an agent by name; returns {taskId}
537
+ - \`wait-for-task\` {taskId} → waits up to ~25s for a terminal state; returns {done, status, output}; only for a child expected to finish within about a minute whose result the answer requires. Bound all calls to about a minute total; if still done=false, use \`defer-task\` with a wake-up to collect the result.
526
538
  - \`get-child-outputs\` {parentTaskId} → all children with status+output
527
539
  - \`complete-task\` {taskId, output} → THE way to finish your assigned task
528
540
  - \`report-progress\` {taskId, note} → progress update
@@ -532,7 +544,7 @@ Rules of the road:
532
544
  - Prefer a built-in script over inline source; write inline TypeScript only for logic no built-in covers. Check \`script-search\` first, and \`script-query-types\` for the live \`swarm-sdk.d.ts\` before authoring anything non-trivial.
533
545
  - \`taskId\` is NOT ambient inside scripts; pass it explicitly via \`args\`.
534
546
  - Report progress and completion via \`complete-task\` / \`report-progress\` (or \`ctx.swarm.task_storeProgress\` inline). This is how you update, complete, or fail your task; there is no other way.
535
- - Scripts are killed after ~30s and stdout is capped at 1 MB. Never sleep/loop longer than ~25s inside one script; chain \`wait-for-task\` calls instead.
547
+ - Scripts are killed after ~30s and stdout is capped at 1 MB. Never sleep/loop longer than ~25s inside one script. Default to the child's automatic follow-up; chained \`wait-for-task\` calls are only for the inline exception above and must stay within about a minute total.
536
548
  - Aggregate inside the script and return only the derived result; never dump raw data.
537
549
  - Batch related SDK calls into a single script when it reduces round trips.
538
550
  `,