@desplega.ai/agent-swarm 2.13.4 → 2.13.5

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 (307) hide show
  1. package/dist/acp-adapter-tbt61zkm.js +17 -0
  2. package/dist/{acp-targets-zrk9k0n7.js → acp-targets-w8dbs4nr.js} +7 -7
  3. package/dist/{actions-acqqj9jn.js → actions-8zrcbjrx.js} +26 -26
  4. package/dist/{agent-fs-provision-zmaykqnd.js → agent-fs-provision-cbt2ttds.js} +4 -4
  5. package/dist/{amp-adapter-a7ts8tmw.js → amp-adapter-8x6zp8w4.js} +2 -2
  6. package/dist/{anthropic-messages-88b7s3n9.js → anthropic-messages-vdd1zmha.js} +10 -10
  7. package/dist/{app-tmwa442h.js → app-zfa9dwjw.js} +6 -6
  8. package/dist/{approval-notifications-6psaaaye.js → approval-notifications-rv92zmza.js} +7 -7
  9. package/dist/{assistant-564v6emv.js → assistant-q7s7rm1q.js} +24 -24
  10. package/dist/{boot-args-schema-n099e0f2.js → boot-args-schema-g27kpzr1.js} +1 -1
  11. package/dist/{boot-reembed-epvg4fp9.js → boot-reembed-1mjs52nt.js} +1 -1
  12. package/dist/{boot-reembed-chx66qfk.js → boot-reembed-m62dpdkg.js} +1 -1
  13. package/dist/{boot-scrub-sweep-dhkfp0a7.js → boot-scrub-sweep-ss1vcamw.js} +2 -2
  14. package/dist/{boot-seeds-m74fc07r.js → boot-seeds-hwnvgbb3.js} +4 -4
  15. package/dist/{boxd-451q55ys.js → boxd-y0szhp0g.js} +1 -1
  16. package/dist/{claude-adapter-hw63yj3j.js → claude-adapter-0rjmbhjk.js} +7 -7
  17. package/dist/{claude-managed-adapter-z5s7fx6p.js → claude-managed-adapter-6k032agg.js} +3 -3
  18. package/dist/{claude-managed-setup-wee1762m.js → claude-managed-setup-6czvve8q.js} +4 -4
  19. package/dist/{claude-sdk-session-cktyqkpk.js → claude-sdk-session-pr0znb81.js} +12667 -11881
  20. package/dist/{cli-0fgvnb0x.js → cli-0qt3epg4.js} +3 -3
  21. package/dist/{cli-ka48vpev.js → cli-19d6v8er.js} +3 -3
  22. package/dist/{cli-zexwhj3f.js → cli-1jq2em7b.js} +3 -3
  23. package/dist/{cli-5rgm8p39.js → cli-2wzkvfgm.js} +2 -2
  24. package/dist/{cli-x2cem5vy.js → cli-34fygf87.js} +2 -2
  25. package/dist/{cli-tsc3pdfd.js → cli-3860pmrq.js} +3 -3
  26. package/dist/{cli-hhtbandk.js → cli-3vw6dd4g.js} +2 -2
  27. package/dist/{cli-qzz6tz8s.js → cli-4gaf3tx5.js} +1 -1
  28. package/dist/{cli-9ah37a8a.js → cli-55h8m1x3.js} +8 -5
  29. package/dist/{cli-7gbff32z.js → cli-5n9w2xzx.js} +1 -1
  30. package/dist/{cli-p436yrzp.js → cli-5tq15aa7.js} +1 -1
  31. package/dist/{cli-jyhbvdga.js → cli-5web09sb.js} +2 -2
  32. package/dist/{cli-3zrwrnz7.js → cli-69zzpjgh.js} +1 -1
  33. package/dist/{cli-7g3fg4gf.js → cli-6msnpj1z.js} +6 -6
  34. package/dist/{cli-azj9t1f9.js → cli-7r9tvk8v.js} +41 -3
  35. package/dist/{cli-4fpa0zns.js → cli-7ypg8hka.js} +3 -3
  36. package/dist/{cli-8cas2xvp.js → cli-887vhew6.js} +2 -2
  37. package/dist/{cli-t0jmkcah.js → cli-8pd1t17c.js} +7 -7
  38. package/dist/{cli-h9d3sdnc.js → cli-94mxerrp.js} +1 -1
  39. package/dist/{cli-bv4vvnmg.js → cli-9n6g14vs.js} +2 -2
  40. package/dist/{cli-5ashycw3.js → cli-abby987g.js} +2 -2
  41. package/dist/{cli-kj84fqxz.js → cli-avax5mp9.js} +1 -1
  42. package/dist/{cli-ea7nz50q.js → cli-b42yfn17.js} +11 -11
  43. package/dist/{cli-ysv0k1we.js → cli-b9ygp1kz.js} +1 -1
  44. package/dist/{cli-3bxrrh53.js → cli-bvamr9g0.js} +2 -2
  45. package/dist/{cli-gse7bp3z.js → cli-ced4azn1.js} +10 -9
  46. package/dist/{cli-7by7vp6m.js → cli-cmbb2t8a.js} +2 -2
  47. package/dist/{cli-0p76my9q.js → cli-cp163xga.js} +10 -10
  48. package/dist/{cli-jzerrzgc.js → cli-ebpq3c5z.js} +8 -8
  49. package/dist/{cli-p3knvk62.js → cli-ehg90jd1.js} +113 -39
  50. package/dist/{cli-jg5txpm6.js → cli-emdfd8fh.js} +75 -1
  51. package/dist/{cli-d5pc8ep0.js → cli-evy3egte.js} +7 -7
  52. package/dist/{cli-60dwk8tx.js → cli-ewk3sg68.js} +2 -2
  53. package/dist/{cli-nc4pbwmp.js → cli-f7b9nyvk.js} +4 -4
  54. package/dist/{cli-29h5239w.js → cli-f9xw9pr4.js} +4 -4
  55. package/dist/{cli-3tzmh38q.js → cli-ffn0a515.js} +7 -7
  56. package/dist/{cli-dqgnbnxs.js → cli-grbngev5.js} +6 -1
  57. package/dist/{cli-cq4am6vg.js → cli-hd5bm1e1.js} +4 -4
  58. package/dist/{cli-akm6y2a8.js → cli-htb5bpz2.js} +1 -1
  59. package/dist/{cli-tr19nyn9.js → cli-j69pzrrz.js} +6 -6
  60. package/dist/{cli-hdhpdrka.js → cli-jdq3jmny.js} +3 -3
  61. package/dist/{cli-ja450998.js → cli-ks06cd0n.js} +1 -1
  62. package/dist/{cli-pz1dp12c.js → cli-kwj3131p.js} +1 -1
  63. package/dist/{cli-1vmhnncj.js → cli-m8f4379k.js} +3 -3
  64. package/dist/{cli-jbrc98qb.js → cli-n79j1vxc.js} +2 -2
  65. package/dist/{cli-b768ek79.js → cli-nrt048ys.js} +1 -0
  66. package/dist/{cli-93n305hm.js → cli-pedm2kht.js} +1 -1
  67. package/dist/{cli-eds5xnsz.js → cli-phmy14hb.js} +2 -2
  68. package/dist/{cli-n1kjs58m.js → cli-prz1p3ft.js} +3 -3
  69. package/dist/{cli-pz1nq5xm.js → cli-q1h041y8.js} +3 -3
  70. package/dist/{cli-cah298e5.js → cli-q41qar56.js} +104 -119
  71. package/dist/{cli-4pbwg7sn.js → cli-qmx8bnt4.js} +1 -1
  72. package/dist/{cli-944w9wb4.js → cli-qrvk9nka.js} +18 -13
  73. package/dist/{cli-gtj12v95.js → cli-r3dxpmyt.js} +1 -1
  74. package/dist/{cli-phdzn699.js → cli-ryem5cfq.js} +7 -7
  75. package/dist/{cli-49aq3cyn.js → cli-s8dhq7rj.js} +4 -4
  76. package/dist/{cli-fkpnx3vf.js → cli-sejvnjvw.js} +3 -2
  77. package/dist/{cli-m1sns1da.js → cli-srre41gb.js} +2 -2
  78. package/dist/{cli-5rxsb3wq.js → cli-t0n9svkb.js} +3 -3
  79. package/dist/{cli-tzw1jr2t.js → cli-t879ww0y.js} +2 -2
  80. package/dist/{cli-xwsm6xkr.js → cli-tgc1kgg3.js} +1 -1
  81. package/dist/{cli-404am6f3.js → cli-tt7dkwjj.js} +6 -6
  82. package/dist/{cli-zjdhrzm0.js → cli-tvyt8w6n.js} +2 -2
  83. package/dist/{cli-hyqksecw.js → cli-v09eza21.js} +9 -9
  84. package/dist/{cli-rv3y60bt.js → cli-vbge4rsp.js} +4 -4
  85. package/dist/{cli-bzcwwebm.js → cli-vcpyttcw.js} +1 -1
  86. package/dist/{cli-904wk98s.js → cli-wzecestt.js} +338 -98
  87. package/dist/{cli-gkv0r2hq.js → cli-x2adbg4j.js} +70 -8
  88. package/dist/{cli-4q2c8rxw.js → cli-z3x7h79n.js} +12 -6
  89. package/dist/{cli-s33bzmk0.js → cli-z40t85ms.js} +1 -1
  90. package/dist/{cli-rmgvwcmy.js → cli-zbbtp02a.js} +98 -21
  91. package/dist/{cli-3xqad83h.js → cli-zntvmqmm.js} +1 -1
  92. package/dist/{cli-zhwjdhjr.js → cli-zxa1vmx7.js} +1 -1
  93. package/dist/{cli-50wa8k4h.js → cli-zy9bb22b.js} +1 -2
  94. package/dist/{cli-ts5yv7dn.js → cli-zzq96q57.js} +123 -33
  95. package/dist/cli.js +18 -18
  96. package/dist/{codex-adapter-2fs2c0n6.js → codex-adapter-bn7eaxk5.js} +6 -6
  97. package/dist/{codex-hook-jxjv6dy5.js → codex-hook-nnmezjg9.js} +2 -2
  98. package/dist/{codex-session-runner-r55tmx4c.js → codex-session-runner-j1e9hffc.js} +6 -6
  99. package/dist/{commands-0mxdy9x8.js → commands-amhpafrr.js} +3 -3
  100. package/dist/{controller-g3vkfhr4.js → controller-tw7g10j2.js} +3 -3
  101. package/dist/{controllers-connect-4wdmncqt.js → controllers-connect-2ssqz7f4.js} +23 -23
  102. package/dist/{core-gsvj5f3z.js → core-bwp98v4w.js} +21 -21
  103. package/dist/{cursor-adapter-t9qb96q2.js → cursor-adapter-d6knjmwa.js} +1 -1
  104. package/dist/{db-487vvyv9.js → db-fd6xxm77.js} +3 -3
  105. package/dist/{db-76p7w3gr.js → db-sc59379z.js} +2 -2
  106. package/dist/{dispatcher-64rp6w67.js → dispatcher-a2gdqz8c.js} +21 -21
  107. package/dist/{dsh-adapter-8abzqk5c.js → dsh-adapter-43ygwqn7.js} +1 -1
  108. package/dist/{e2b-dc8f6ctq.js → e2b-cn7cvjqy.js} +1 -1
  109. package/dist/{e2b-3ykbe805.js → e2b-qnxyfea6.js} +1 -1
  110. package/dist/{easter-egg-3d-jrrwyf55.js → easter-egg-3d-a0pphy71.js} +1 -1
  111. package/dist/{embedding-space-001hhhpk.js → embedding-space-qepzrach.js} +6 -6
  112. package/dist/{embeddings-esj19cnw.js → embeddings-d7vr881x.js} +1 -1
  113. package/dist/{execute-301hkxqg.js → execute-6afts2bn.js} +1 -1
  114. package/dist/{external-channel-w10e2j05.js → external-channel-881zq1x4.js} +2 -2
  115. package/dist/fx-adapter-cr2hq17y.js +20 -0
  116. package/dist/{grok-adapter-3a0ezfee.js → grok-adapter-ayddnbsc.js} +9 -9
  117. package/dist/handlers-7ghs84x2.js +41 -0
  118. package/dist/{heartbeat-tbrj7vhq.js → heartbeat-4c022m6a.js} +24 -24
  119. package/dist/{hook-3am1sq68.js → hook-4k84x499.js} +5 -5
  120. package/dist/{hook-tx917rqw.js → hook-a7eh6zty.js} +7 -7
  121. package/dist/{http-3rmemtqy.js → http-6aw5wanc.js} +180 -94
  122. package/dist/index-dtt0d634.js +44 -0
  123. package/dist/index-hmszyqkk.js +42 -0
  124. package/dist/index-j6rm1rtn.js +39 -0
  125. package/dist/{index-aetfyx6p.js → index-rwwhsmjg.js} +1 -1
  126. package/dist/{index-s7xtvc0f.js → index-xhad0n8m.js} +1 -1
  127. package/dist/{index-2jw11t8s.js → index-yq9hhhhy.js} +25 -25
  128. package/dist/{index-gfnq66t1.js → index-z2g9469g.js} +202 -17
  129. package/dist/{keepalive-9px3t7qj.js → keepalive-zhbmztqw.js} +4 -4
  130. package/dist/lead-g2j4q39z.js +83 -0
  131. package/dist/{maintenance-vwqjwst6.js → maintenance-rsp0591h.js} +1 -1
  132. package/dist/{node-2wfcey7d.js → node-0as4n1ef.js} +3 -3
  133. package/dist/{node-zd6shky9.js → node-dhxbt01p.js} +3 -3
  134. package/dist/{node-z67yjre7.js → node-rxte5hc6.js} +290 -70
  135. package/dist/{node-hjn5n1yp.js → node-t0ct2zpw.js} +3 -5
  136. package/dist/{oauth-refresh-sweep-yqry3wn4.js → oauth-refresh-sweep-w3cqmxq7.js} +3 -3
  137. package/dist/{object-webhooks-8s1wtths.js → object-webhooks-331hay92.js} +7 -7
  138. package/dist/{onboard-hb8czx0p.js → onboard-n2w80m2n.js} +3 -3
  139. package/dist/{opencode-adapter-djd6m6dk.js → opencode-adapter-z98127cz.js} +6 -6
  140. package/dist/{otel-impl-2ymwyczz.js → otel-impl-xsk35tvf.js} +1 -1
  141. package/dist/{pending-nxavtvx7.js → pending-2e6trkxd.js} +22 -22
  142. package/dist/{pi-mono-adapter-d2cpmcy4.js → pi-mono-adapter-wh6yndtm.js} +8 -8
  143. package/dist/{pricing-refresh-1yz8jkqv.js → pricing-refresh-9355dj1t.js} +2 -2
  144. package/dist/{rbac-roles-dbpx0x9v.js → rbac-roles-58y3m912.js} +3 -3
  145. package/dist/{rbac-roles-7s6m31xw.js → rbac-roles-8eajw4s6.js} +2 -2
  146. package/dist/{render-v2-7y20rjrn.js → render-v2-7gskkmd4.js} +6 -6
  147. package/dist/{resume-wz546x47.js → resume-0drnmpja.js} +9 -9
  148. package/dist/{runtime-cb5bd9tz.js → runtime-d2tcmqte.js} +1 -1
  149. package/dist/{session-access-4vcft8kq.js → session-access-0ztys6bd.js} +5 -5
  150. package/dist/{session-source-backfill-57b50tpw.js → session-source-backfill-cdm5s046.js} +2 -2
  151. package/dist/{setup-e1tevjyj.js → setup-pqwb9tcc.js} +1 -1
  152. package/dist/thread-buffer-epx3san4.js +42 -0
  153. package/dist/{tree-visibility-07wf1nct.js → tree-visibility-rwz67mje.js} +2 -2
  154. package/dist/{user-merge-jobs-n20qpv6s.js → user-merge-jobs-mxrhamwt.js} +3 -3
  155. package/dist/{virtual-modules-6fxmn1yv.js → virtual-modules-71y1gsmg.js} +3 -3
  156. package/dist/{work-objects-eg7y48pe.js → work-objects-3k4ykt9j.js} +24 -24
  157. package/dist/worker-09gqn9xy.js +83 -0
  158. package/dist/{worker-follow-up-jnvnnf2b.js → worker-follow-up-y0h64xpr.js} +21 -21
  159. package/openapi.json +387 -6
  160. package/package.json +4 -4
  161. package/src/apps/sync.ts +20 -5
  162. package/src/azure-devops/boards-sync.ts +1 -1
  163. package/src/be/db/slack-trees.ts +12 -1
  164. package/src/be/db/tasks/read.ts +25 -1
  165. package/src/be/db/tasks/write.ts +47 -12
  166. package/src/be/db/users/avatar.ts +12 -0
  167. package/src/be/db.ts +78 -5
  168. package/src/be/migrations/344_user_avatar.sql +4 -0
  169. package/src/be/migrations/345_task_status_kind.sql +6 -0
  170. package/src/be/primitives/object-embed.ts +2 -2
  171. package/src/be/primitives/objects.ts +2 -2
  172. package/src/be/runtime-pools/supervisor.ts +1 -0
  173. package/src/be/scripts/typecheck.ts +1 -1
  174. package/src/be/swarm-config-guard.ts +4 -0
  175. package/src/bitbucket/handlers.ts +1 -1
  176. package/src/commands/credential-outcome-report.ts +96 -0
  177. package/src/commands/onboard/agent-fs-version.ts +1 -1
  178. package/src/commands/runner.ts +49 -3
  179. package/src/event-waits/github.ts +39 -6
  180. package/src/event-waits/index.ts +4 -2
  181. package/src/event-waits/types.ts +10 -3
  182. package/src/extensions/contract-types.generated.ts +1 -1
  183. package/src/github/app.ts +177 -13
  184. package/src/github/handlers.ts +7 -2
  185. package/src/github/pull-request-state.ts +100 -11
  186. package/src/gitlab/handlers.ts +2 -2
  187. package/src/heartbeat/heartbeat.ts +6 -1
  188. package/src/http/api-keys.ts +26 -0
  189. package/src/http/asset-key-write.ts +45 -0
  190. package/src/http/assets.ts +4 -3
  191. package/src/http/github-token.ts +27 -6
  192. package/src/http/pages.ts +4 -10
  193. package/src/http/schedules.ts +6 -6
  194. package/src/http/sessions.ts +7 -2
  195. package/src/http/tasks.ts +23 -5
  196. package/src/http/users.ts +5 -0
  197. package/src/http/webhooks.ts +19 -1
  198. package/src/http/workflows.ts +5 -10
  199. package/src/integrations/chat-sdk/commands.ts +3 -1
  200. package/src/jira/sync.ts +1 -1
  201. package/src/linear/sync.ts +5 -3
  202. package/src/prompts/session-templates.ts +1 -0
  203. package/src/providers/acp-targets.ts +2 -2
  204. package/src/providers/amp-adapter.ts +1 -1
  205. package/src/providers/claude-adapter.ts +5 -0
  206. package/src/providers/claude-sdk-session.ts +5 -0
  207. package/src/providers/runtime-dependencies.ts +1 -1
  208. package/src/scheduler/deferred-task-waits.ts +74 -13
  209. package/src/scripts-runtime/swarm-sdk.ts +8 -1
  210. package/src/scripts-runtime/types/stdlib.d.ts +8 -1
  211. package/src/scripts-runtime/types/swarm-extension.d.ts +19 -2
  212. package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -1
  213. package/src/slack/actions.ts +1 -1
  214. package/src/slack/render-v2.ts +148 -7
  215. package/src/tests/api-drain-worker-e2e.test.ts +0 -2
  216. package/src/tests/approval-auto-cancellation-migration.test.ts +8 -19
  217. package/src/tests/approval-card-resolution.test.ts +2 -17
  218. package/src/tests/approval-requests-notifications.test.ts +41 -27
  219. package/src/tests/approval-requests.test.ts +137 -369
  220. package/src/tests/apps-sync-engine.test.ts +5 -3
  221. package/src/tests/apps-table-filters-migration.test.ts +44 -25
  222. package/src/tests/bitbucket-handlers.test.ts +2 -0
  223. package/src/tests/chat-sdk-commands.test.ts +1 -0
  224. package/src/tests/claude-adapter.test.ts +35 -0
  225. package/src/tests/codex-adapter.test.ts +3 -92
  226. package/src/tests/codex-gpt6-release.test.ts +0 -9
  227. package/src/tests/codex-oauth-credential-info.test.ts +35 -18
  228. package/src/tests/codex-oauth.test.ts +0 -6
  229. package/src/tests/codex-pool.test.ts +5 -214
  230. package/src/tests/codex-rate-limit-parse.test.ts +0 -7
  231. package/src/tests/codex-swarm-events.test.ts +11 -54
  232. package/src/tests/db-client-busy-retry.test.ts +49 -16
  233. package/src/tests/defer-task.test.ts +1 -0
  234. package/src/tests/e2e-shards.test.ts +9 -9
  235. package/src/tests/enabled-tools.test.ts +0 -2
  236. package/src/tests/fixtures/base-prompt-baseline.json +6 -6
  237. package/src/tests/github-app-worker-auth-helper.test.ts +147 -1
  238. package/src/tests/gitlab-handlers.test.ts +2 -0
  239. package/src/tests/heartbeat-jev-gate.test.ts +9 -241
  240. package/src/tests/heartbeat-reroute-decision.test.ts +2 -0
  241. package/src/tests/heartbeat-supersede-resume.test.ts +2 -0
  242. package/src/tests/heartbeat.test.ts +1 -0
  243. package/src/tests/key-usage-selection.test.ts +302 -0
  244. package/src/tests/memory-e2e.test.ts +34 -103
  245. package/src/tests/memory-key-paths.test.ts +5 -0
  246. package/src/tests/memory-rater-llm.test.ts +33 -149
  247. package/src/tests/memory-store.test.ts +24 -125
  248. package/src/tests/memory.test.ts +31 -100
  249. package/src/tests/merge-gate-detect-changes.test.ts +108 -2
  250. package/src/tests/otel-service-name.test.ts +0 -9
  251. package/src/tests/otel-session-cost-metrics.test.ts +1 -38
  252. package/src/tests/pool-session-logs.test.ts +8 -42
  253. package/src/tests/pre-push-affected-tests.test.ts +106 -0
  254. package/src/tests/prompt-template-session.test.ts +3 -0
  255. package/src/tests/runner-api-drain.test.ts +2 -17
  256. package/src/tests/runner-terminal-window-report.test.ts +132 -0
  257. package/src/tests/runtime-supervisor-failures.test.ts +1 -0
  258. package/src/tests/sandboxed-process.test.ts +26 -21
  259. package/src/tests/schedule-http-triage-tools.test.ts +12 -9
  260. package/src/tests/scheduled-tasks.test.ts +14 -51
  261. package/src/tests/script-executor-conformance.test.ts +4 -48
  262. package/src/tests/script-executor-quickjs-pool.test.ts +9 -7
  263. package/src/tests/script-native-startup.test.ts +21 -25
  264. package/src/tests/secret-rules.test.ts +4 -2
  265. package/src/tests/session-logs.test.ts +1 -260
  266. package/src/tests/slack-render-v2.test.ts +5 -148
  267. package/src/tests/task-cascade-fail.test.ts +1 -0
  268. package/src/tests/task-supersede-resume.test.ts +1 -0
  269. package/src/tests/test-proc.ts +5 -2
  270. package/src/tests/window-stream-reporter.test.ts +122 -0
  271. package/src/tests/workflow-agent-task-retry.test.ts +1 -3
  272. package/src/tests/workflow-cascade-cancel.test.ts +1 -0
  273. package/src/tests/workflow-retry-v2.test.ts +34 -43
  274. package/src/tests/workflow-retry-validation.test.ts +8 -48
  275. package/src/tests/worktree-reaper.test.ts +2 -2
  276. package/src/tools/cancel-task.ts +2 -2
  277. package/src/tools/defer-task.ts +7 -2
  278. package/src/tools/get-task-details.ts +8 -4
  279. package/src/tools/get-tasks.ts +13 -2
  280. package/src/tools/manage-user.ts +9 -0
  281. package/src/tools/store-progress.ts +5 -3
  282. package/src/types.ts +93 -0
  283. package/src/utils/constants.ts +12 -0
  284. package/src/utils/credentials.ts +42 -5
  285. package/src/utils/error-tracker.ts +6 -0
  286. package/src/utils/key-usage.ts +114 -0
  287. package/src/utils/sandboxed-process.ts +1 -0
  288. package/src/workflows/resume.ts +5 -2
  289. package/templates/skills/apps/SKILL.md +2 -0
  290. package/templates/skills/apps/content.md +2 -0
  291. package/templates/skills/boards-and-sheets/content.md +4 -2
  292. package/templates/skills/pages/content.md +7 -0
  293. package/templates/skills/swarm-docs/content.md +1 -0
  294. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  295. package/templates/skills/swarm-scripts/content.md +1 -0
  296. package/dist/acp-adapter-mr4temec.js +0 -17
  297. package/dist/fx-adapter-4sjrbdne.js +0 -20
  298. package/dist/handlers-ef3k11hb.js +0 -41
  299. package/dist/index-e6bq0exk.js +0 -42
  300. package/dist/index-hf2k1vge.js +0 -39
  301. package/dist/index-taxmejj3.js +0 -44
  302. package/dist/lead-5vt6f174.js +0 -83
  303. package/dist/thread-buffer-686pa1p1.js +0 -42
  304. package/dist/worker-4vp616ms.js +0 -83
  305. package/src/tests/apps-table-selection-migration.test.ts +0 -95
  306. package/src/tests/extensions-example-heartbeat-remediate.test.ts +0 -69
  307. package/src/tests/extensions-example-rewrite-and-suppress.test.ts +0 -70
@@ -7,6 +7,7 @@ import {
7
7
  providerKeyVars,
8
8
  } from "@desplega/model-catalog";
9
9
  import { deriveDefaultRoute, routeCredentialStatus } from "@desplega/model-routing";
10
+ import { type CredentialSelectionStrategy, pickLowestUsage } from "./key-usage";
10
11
  import { type ModelFamily, modelFamilyOf, windowForModelFamily } from "./model-rate-limit-windows";
11
12
 
12
13
  /** Env vars that may contain comma-separated credential pools */
@@ -307,12 +308,21 @@ export function splitCredentialPool(value: string): string[] {
307
308
  * `allowedIndices` (a profile's credential allowlist, as pool positions)
308
309
  * bounds every pick, including the "all rate-limited, pick anyway" fallbacks.
309
310
  * Indices stay positions in the full pool.
311
+ *
312
+ * `usageByIndex` (per pool position, from `GET /api/keys/available`: the
313
+ * `keyPace` or `keyUsage` score of the selection strategy) orders the pick
314
+ * among the available indices: the lowest score wins, ties break at random.
315
+ * It never excludes a key, whatever its score. `sessionsByIndex` (running
316
+ * sessions per pool position, same source) breaks ties within the score
317
+ * band: the fewest wins.
310
318
  */
311
319
  export function selectCredential(
312
320
  value: string,
313
321
  availableIndices?: number[],
314
322
  keyType = "ANTHROPIC_API_KEY",
315
323
  allowedIndices?: number[],
324
+ usageByIndex?: number[],
325
+ sessionsByIndex?: number[],
316
326
  ): CredentialSelection {
317
327
  // A CODEX_OAUTH value is one JSON blob ({access, refresh, expires, accountId}),
318
328
  // never a comma-separated pool: its commas are field separators. Splitting it
@@ -351,7 +361,7 @@ export function selectCredential(
351
361
  (i) => i >= 0 && i < credentials.length && (!drawFrom || drawFrom.includes(i)),
352
362
  );
353
363
  if (validIndices.length > 0) {
354
- index = validIndices[Math.floor(Math.random() * validIndices.length)]!;
364
+ index = pickLowestUsage(validIndices, usageByIndex, sessionsByIndex)!;
355
365
  } else {
356
366
  // All available indices out of range — fall back to random from all
357
367
  index = pickAny();
@@ -458,6 +468,14 @@ export interface AvailabilityInfo {
458
468
  seatBlockedIndices?: number[];
459
469
  /** Rate-limited indices whose limit is a provider spend cap. */
460
470
  spendCappedIndices?: number[];
471
+ /** Usage per pool position (see `keyUsageFromWindows`). Orders a `usage` pick; never excludes. */
472
+ keyUsage?: number[];
473
+ /** Pace delta per pool position (see `keyPaceFromWindows`). Orders a `pace` pick; never excludes. */
474
+ keyPace?: number[];
475
+ /** The server's `CREDENTIAL_SELECTION_STRATEGY`. Absent from an older server. */
476
+ selectionStrategy?: CredentialSelectionStrategy;
477
+ /** Running sessions per pool position. Breaks ties within the usage band; never excludes. */
478
+ activeSessions?: number[];
461
479
  }
462
480
 
463
481
  /**
@@ -496,6 +514,10 @@ async function fetchAvailableIndices(
496
514
  earliestModelResetAt?: string | null;
497
515
  seatBlockedIndices?: number[];
498
516
  spendCappedIndices?: number[];
517
+ keyUsage?: number[];
518
+ keyPace?: number[];
519
+ selectionStrategy?: CredentialSelectionStrategy;
520
+ activeSessions?: number[];
499
521
  };
500
522
  availableIndicesMap[envVar] = {
501
523
  availableIndices: data.availableIndices,
@@ -504,6 +526,10 @@ async function fetchAvailableIndices(
504
526
  earliestModelResetAt: data.earliestModelResetAt,
505
527
  seatBlockedIndices: data.seatBlockedIndices,
506
528
  spendCappedIndices: data.spendCappedIndices,
529
+ keyUsage: data.keyUsage,
530
+ keyPace: data.keyPace,
531
+ selectionStrategy: data.selectionStrategy,
532
+ activeSessions: data.activeSessions,
507
533
  };
508
534
  if (data.availableIndices.length < totalKeys) {
509
535
  console.log(
@@ -519,6 +545,9 @@ async function fetchAvailableIndices(
519
545
  return availableIndicesMap;
520
546
  }
521
547
 
548
+ const pct = (value: number | undefined) => Math.round((value ?? 0) * 100);
549
+ const signedPct = (value: number | undefined) => `${pct(value) > 0 ? "+" : ""}${pct(value)}`;
550
+
522
551
  /**
523
552
  * For credential env vars that contain comma-separated values,
524
553
  * select one based on availability (rate-limit aware when API info is available).
@@ -681,18 +710,26 @@ export async function resolveCredentialPools(
681
710
  }
682
711
  }
683
712
 
713
+ // Pace only when the server opts in and sends `keyPace`; otherwise rank by usage, as before.
714
+ const strategy: CredentialSelectionStrategy =
715
+ info?.keyPace && info.selectionStrategy === "pace" ? "pace" : "usage";
716
+ const usage = strategy === "pace" ? info?.keyPace : info?.keyUsage;
717
+ const sessions = info?.activeSessions;
684
718
  const result = seatFallbackIndices
685
719
  ? {
686
- ...selectCredential(val, seatFallbackIndices, envVar, allowedIdx),
720
+ ...selectCredential(val, seatFallbackIndices, envVar, allowedIdx, usage, sessions),
687
721
  isRateLimitFallback: true,
688
722
  }
689
723
  : uncapped?.length
690
- ? { ...selectCredential(val, uncapped, envVar, allowedIdx), isRateLimitFallback: true }
691
- : selectCredential(val, available, envVar, allowedIdx);
724
+ ? {
725
+ ...selectCredential(val, uncapped, envVar, allowedIdx, usage, sessions),
726
+ isRateLimitFallback: true,
727
+ }
728
+ : selectCredential(val, available, envVar, allowedIdx, usage, sessions);
692
729
  env[envVar] = result.selected;
693
730
  const availInfo = available ? ` (${available.length} available of ${result.total})` : "";
694
731
  console.log(
695
- `[credentials] Selected ${envVar} credential ${result.index + 1}/${result.total}${availInfo} [...${result.keySuffix}]${info?.rejectedIndices?.length ? ` (${info.rejectedIndices.length} rejected)` : ""}`,
732
+ `[credentials] Selected ${envVar} credential ${result.index + 1}/${result.total}${availInfo} [...${result.keySuffix}]${info?.keyUsage ? ` usage ${pct(info.keyUsage[result.index])}%` : ""}${info?.keyPace ? ` pace ${signedPct(info.keyPace[result.index])}%` : ""}${info ? ` strategy ${strategy}` : ""}${info?.rejectedIndices?.length ? ` (${info.rejectedIndices.length} rejected)` : ""}`,
696
733
  );
697
734
  selections.push({
698
735
  ...result,
@@ -38,6 +38,12 @@ export interface RateLimitWindowInfo {
38
38
 
39
39
  export type RateLimitWindowTelemetry = Record<string, RateLimitWindowInfo>;
40
40
 
41
+ /**
42
+ * Name of the `custom` provider event that carries a session's merged window
43
+ * snapshot after each `rate_limit_event`. The runner streams it to the API.
44
+ */
45
+ export const RATE_LIMIT_WINDOWS_EVENT = "rate_limit_windows";
46
+
41
47
  /**
42
48
  * A key that hit its provider spend limit (OpenRouter key limit or credits).
43
49
  * `resetsAt` is null when the provider names no reset: the key stays benched
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Lowest-score-first key ranking, with a 10-point band. Pure: shared by `GET /api/keys/available`
3
+ * (which computes the scores from stored windows) and the worker picker
4
+ * (`selectCredential`). It only orders admissible keys; it never excludes one.
5
+ */
6
+
7
+ import { type ModelFamily, windowForModelFamily } from "./model-rate-limit-windows";
8
+
9
+ /** Key-wide windows that count as a key's usage. Model-scoped weekly windows do not. */
10
+ export const KEY_USAGE_WINDOWS = ["five_hour", "seven_day"] as const;
11
+
12
+ type UsageWindow = { utilization?: number; resetsAt?: number; durationMins?: number };
13
+
14
+ /**
15
+ * How the worker ranks admissible pool keys (`CREDENTIAL_SELECTION_STRATEGY`).
16
+ * `pace`: most under even use first (`keyPaceFromWindows`). `usage`: lowest
17
+ * utilization first (`keyUsageFromWindows`).
18
+ */
19
+ export const CREDENTIAL_SELECTION_STRATEGIES = ["pace", "usage"] as const;
20
+ export type CredentialSelectionStrategy = (typeof CREDENTIAL_SELECTION_STRATEGIES)[number];
21
+
22
+ /** Parses the setting. Anything but `pace` is `usage`, the default until `pace` has soaked. */
23
+ export function credentialSelectionStrategy(
24
+ value: string | undefined,
25
+ ): CredentialSelectionStrategy {
26
+ return value?.trim().toLowerCase() === "pace" ? "pace" : "usage";
27
+ }
28
+
29
+ /**
30
+ * A key's current usage, as a utilization fraction (0..1, can exceed 1): the
31
+ * max over its non-expired `five_hour` and `seven_day` windows. A window past
32
+ * `resetsAt` (epoch seconds) counts as 0. No observation counts as 0, so a
33
+ * fresh key ranks first.
34
+ */
35
+ export function keyUsageFromWindows(
36
+ windows: Record<string, UsageWindow> | null | undefined,
37
+ nowMs: number,
38
+ ): number {
39
+ let usage = 0;
40
+ for (const name of KEY_USAGE_WINDOWS) {
41
+ const window = windows?.[name];
42
+ if (!window || typeof window.utilization !== "number" || !Number.isFinite(window.utilization))
43
+ continue;
44
+ if (typeof window.resetsAt === "number" && window.resetsAt * 1000 <= nowMs) continue;
45
+ usage = Math.max(usage, window.utilization);
46
+ }
47
+ return usage;
48
+ }
49
+
50
+ /**
51
+ * A key's pace delta, as a fraction: used minus the share of the window that
52
+ * has passed (the even-use point), taken as the max over the key's live
53
+ * `five_hour` and `seven_day` windows plus the weekly window of `modelFamily`
54
+ * (Fable, Opus, Sonnet) when given. Negative means quota that will go unused
55
+ * by the reset; the lowest delta ranks first, so a key over pace on any of
56
+ * those windows ranks behind one under pace on all of them. A window with no
57
+ * utilization, no reset or a passed reset is skipped. Undefined when none
58
+ * is left: the caller counts it as 0 (on pace), never as a reading.
59
+ */
60
+ export function keyPaceFromWindows(
61
+ windows: Record<string, UsageWindow> | null | undefined,
62
+ nowMs: number,
63
+ modelFamily?: ModelFamily,
64
+ ): number | undefined {
65
+ const modelWindow = modelFamily ? windowForModelFamily(modelFamily) : undefined;
66
+ let pace: number | undefined;
67
+ for (const name of [...KEY_USAGE_WINDOWS, ...(modelWindow ? [modelWindow] : [])]) {
68
+ const window = windows?.[name];
69
+ if (!window || typeof window.utilization !== "number" || !Number.isFinite(window.utilization))
70
+ continue;
71
+ if (typeof window.resetsAt !== "number" || window.resetsAt * 1000 <= nowMs) continue;
72
+ const durationMs = (window.durationMins ?? (name === "five_hour" ? 300 : 10080)) * 60_000;
73
+ const elapsed = Math.min(1, Math.max(0, 1 - (window.resetsAt * 1000 - nowMs) / durationMs));
74
+ pace = Math.max(pace ?? Number.NEGATIVE_INFINITY, window.utilization - elapsed);
75
+ }
76
+ return pace;
77
+ }
78
+
79
+ /**
80
+ * Width of the low-score band, as a utilization fraction. Every admissible key
81
+ * within this distance of the lowest score (usage or pace delta) is an equal candidate.
82
+ */
83
+ export const KEY_USAGE_BAND = 0.1;
84
+
85
+ /**
86
+ * Picks the key for a draw among `indices`:
87
+ * 1. the keys whose score (usage or pace delta) is within `band` of the lowest;
88
+ * 2. among them, the keys with the fewest running sessions (`sessionsByIndex`);
89
+ * 3. ties at random.
90
+ *
91
+ * A plain minimum would send every concurrent draw to one key until the next
92
+ * usage report lands. The session count moves at session start, so a burst
93
+ * spreads within seconds; the band still covers draws that land before the
94
+ * session-start report. An index with no usage or session entry counts as 0.
95
+ */
96
+ export function pickLowestUsage(
97
+ indices: readonly number[],
98
+ usageByIndex: readonly (number | null | undefined)[] | undefined,
99
+ sessionsByIndex?: readonly (number | null | undefined)[],
100
+ random: () => number = Math.random,
101
+ band: number = KEY_USAGE_BAND,
102
+ ): number | undefined {
103
+ if (indices.length === 0) return undefined;
104
+ const entryAt = (values: typeof usageByIndex, i: number) => {
105
+ const value = values?.[i];
106
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
107
+ };
108
+ const lowest = Math.min(...indices.map((i) => entryAt(usageByIndex, i)));
109
+ // The epsilon keeps a key exactly `band` above the lowest inside the band.
110
+ const inBand = indices.filter((i) => entryAt(usageByIndex, i) <= lowest + band + 1e-9);
111
+ const fewest = Math.min(...inBand.map((i) => entryAt(sessionsByIndex, i)));
112
+ const best = inBand.filter((i) => entryAt(sessionsByIndex, i) === fewest);
113
+ return best[Math.floor(random() * best.length)];
114
+ }
@@ -224,6 +224,7 @@ function buildSandboxedCommandCore(
224
224
 
225
225
  return [
226
226
  useBashShell ? "bash" : "sh",
227
+ ...(useBashShell ? ["--noprofile", "--norc", "-p"] : []),
227
228
  "-c",
228
229
  `${ulimits}; exec ${dropPrivileges}env -i ${envAssignments} ${quotedInner}`,
229
230
  ];
@@ -764,7 +764,10 @@ export async function cancelWorkflowRunRows(
764
764
  const withDependents =
765
765
  openTaskIds.length > 0 ? await getTaskIdsWithDependents() : new Set<string>();
766
766
  for (const taskId of openTaskIds) {
767
- await cancelTask(taskId, cancelReason, { cascadeDependents: withDependents.has(taskId) });
767
+ await cancelTask(taskId, cancelReason, {
768
+ cascadeDependents: withDependents.has(taskId),
769
+ statusKind: "workflow",
770
+ });
768
771
  }
769
772
  await cancelOpenWorkflowTreeSteps(runIds, cancelReason, now);
770
773
  await disarmWorkflowTreeRetries(runIds, now);
@@ -871,7 +874,7 @@ export async function cancelWorkflowRunStep(
871
874
  }
872
875
 
873
876
  const task = await getTaskByWorkflowRunStepId(stepId);
874
- if (task) await cancelTask(task.id, reason);
877
+ if (task) await cancelTask(task.id, reason, { statusKind: "workflow" });
875
878
  await updateWorkflowRunStep(stepId, {
876
879
  status: "cancelled",
877
880
  error: reason,
@@ -7,6 +7,8 @@ description: Build and iterate on schema-backed Swarm Apps with live models, nam
7
7
 
8
8
  Swarm Apps are persistent, agent-authored internal applications: a schema-backed row store, named queries, custom script/task actions, and a validated json-render interface served at `/apps/<id>`. Use an app when people need to view and change live records; use `create_page` for a static snapshot.
9
9
 
10
+ **When to use a sheet or board instead:** a tracker or grid people keep editing, with no queries or actions, is a sheet. A plan, diagram or map to think through is a board. Both are editable agent-fs files; see the `boards-and-sheets` skill. To show one inside an app, use the `ObjectEmbed` component (section "Embed a sheet or board").
11
+
10
12
  > **Capability gate**: app tools are available when the server's `CAPABILITIES` includes `pages` (for example `CAPABILITIES=core,task-pool,pages`). There is no separate `apps` capability. If these tools are absent from your MCP list, this is why.
11
13
 
12
14
  ## Tools and iteration loop
@@ -2,6 +2,8 @@
2
2
 
3
3
  Swarm Apps are persistent, agent-authored internal applications: a schema-backed row store, named queries, custom script/task actions, and a validated json-render interface served at `/apps/<id>`. Use an app when people need to view and change live records; use `create_page` for a static snapshot.
4
4
 
5
+ **When to use a sheet or board instead:** a tracker or grid people keep editing, with no queries or actions, is a sheet. A plan, diagram or map to think through is a board. Both are editable agent-fs files; see the `boards-and-sheets` skill. To show one inside an app, use the `ObjectEmbed` component (section "Embed a sheet or board").
6
+
5
7
  > **Capability gate**: app tools are available when the server's `CAPABILITIES` includes `pages` (for example `CAPABILITIES=core,task-pool,pages`). There is no separate `apps` capability. If these tools are absent from your MCP list, this is why.
6
8
 
7
9
  ## Tools and iteration loop
@@ -10,6 +10,8 @@ Sheets are spreadsheets with live formulas. Boards are Excalidraw diagrams. Both
10
10
  | A diagram or plan someone will move around (flow, architecture, rollout, mind map) | a board (`ctx.boards`) |
11
11
  | A static table the reader only reads once | a Markdown table in your reply or report |
12
12
  | A person asked for an Excel file, or sent one | a sheet, plus `importXlsx` / `exportXlsx` |
13
+ | A designed report or snapshot to share by URL | a page (the `pages` skill); embed the sheet or board in it |
14
+ | Records with queries, filters or action buttons | an app (the `apps` skill); embed the sheet or board in it |
13
15
 
14
16
  ## How to call
15
17
 
@@ -20,7 +22,7 @@ The `sheet-*` and `board-*` MCP tools are off in the agent tool list. Call them
20
22
  - Identify a file by `id` (from `create` or `list`) or by `path`.
21
23
  - Writes check the file version and re-apply on a concurrent edit (other cells or elements merge; the same cell or element is last writer wins). After 4 conflicting attempts the call throws "retry".
22
24
  - `create` and `importXlsx` are create-only: they refuse when the path exists. Read or update the existing file instead.
23
- - Every returned `object` carries `link`, the live app link to the file. Hand that link to the person.
25
+ - Every returned `object` carries `link`, the dashboard link to the file, where it opens as the editable board or sheet (the agent-fs live app when no dashboard is configured). Hand that link to the person.
24
26
 
25
27
  ## Where to put files
26
28
 
@@ -160,7 +162,7 @@ export default async function (args, ctx) {
160
162
 
161
163
  ## Embed in an app or a page
162
164
 
163
- An app shows a live, editable sheet or board with `{ "type": "ObjectEmbed", "props": { "objectId": "<object id>" } }`. A page shows it with this snippet, where `${APP_URL}` is the dashboard origin:
165
+ An app (the `apps` skill) shows a live, editable sheet or board with `{ "type": "ObjectEmbed", "props": { "objectId": "<object id>" } }`. A page (the `pages` skill) shows it with this snippet, where `${APP_URL}` is the dashboard origin:
164
166
 
165
167
  ```html
166
168
  <script type="module" src="${APP_URL}/embed/v1/swarm-object.js"></script>
@@ -27,6 +27,13 @@ every page should use.
27
27
  Rule of thumb: if the content is a snapshot (you can write the full HTML/JSON
28
28
  in a single call), use pages. If it needs stored data and actions, use apps.
29
29
 
30
+ ### When to use a sheet or board instead
31
+
32
+ A tracker or grid people keep editing (budget, comparison, status list) is a
33
+ sheet. A plan, diagram or map to think through is a board. Both are editable
34
+ agent-fs files; see the `boards-and-sheets` skill. To show one inside a page,
35
+ embed it with `<swarm-object>` (section below).
36
+
30
37
  Do **not** use pages for:
31
38
 
32
39
  - In-flight progress notes: use `store-progress.progress`
@@ -49,6 +49,7 @@ Fetch the page as markdown: `curl -fsSL https://docs.agent-swarm.dev/llms.mdx/do
49
49
  - [Open Oncall](https://docs.agent-swarm.dev/docs/playbooks/open-oncall). When: Someone wants alerts from PagerDuty, Datadog, Sentry or a webhook investigated and fixed, with a person approving each fix. Not when: A one-off question about a single incident.
50
50
  - [PR Review](https://docs.agent-swarm.dev/docs/playbooks/pr-review). When: Someone wants every pull request reviewed automatically before a person looks at it.
51
51
  - [Software Factory](https://docs.agent-swarm.dev/docs/playbooks/software-factory). When: Someone wants labeled issues to become reviewed draft pull requests without a person driving each step.
52
+ - [Goals](https://docs.agent-swarm.dev/docs/playbooks/goals). When: Someone wants the swarm to keep working toward a measurable target until a check passes, or to hold a metric and reopen work when it regresses.
52
53
  - [Linear Delivery Loop](https://docs.agent-swarm.dev/docs/playbooks/linear-delivery-loop). When: Someone wants agents to take Linear issues through implementation, CI and review to merged pull requests, with a person approving each one. Template: `community/linear-delivery-loop`.
53
54
  - [Slack Reply Gate](https://docs.agent-swarm.dev/docs/playbooks/slack-reply-gate). When: Someone wants Lead to stop answering or waking on Slack thread banter, reactions, or messages meant for other people. Not when: Someone wants to route Slack messages to a specific agent or channel, which is a pre.slack.route extension.
54
55
  - [Small-Company Workflows](https://docs.agent-swarm.dev/docs/playbooks/small-company-workflows). When: Someone at a small company asks which recurring cross-team workflows they could run with agents, with people approving the decisions. Not when: Someone wants a documented production playbook for one job, which is the linked playbook itself.
@@ -70,6 +70,7 @@ export default async function (args: z.infer<typeof argsSchema>, ctx: ScriptCont
70
70
  - Both `zod` and `zod/mini` imports work. Use `import * as z from "zod/mini"` for smaller QuickJS bundles. Mini uses functional forms: `z.optional(z.string())`, `z._default(z.number(), 10)`, and `z.string().check(z.minLength(1))`; its schemas still have `.parse()` and `.safeParse()`.
71
71
  - Inline source through `script-run` runs without a typecheck. `script-upsert` typechecks before it saves. Import `ScriptContext` from `"swarm-sdk"` in inline code too, so promotion to a named script works. A worker's `script-upsert` saves at agent scope; a global-scope upsert is rejected unless you are the lead. To share a script, send the lead its name and `contentHash` to promote.
72
72
  - SDK methods return `Promise<unknown>`. Responses are usually wrapped: read `res?.data ?? res`. Exception: `app_query` with a literal `appId` and `query` returns rows typed from the app's columns.
73
+ - To fail a run, throw an `Error` whose message starts with a stable reason code (for example `JOB_FAILED: ...`) and carries a JSON payload. A returned `{ ok: false }` still ends the run as `completed`, so a schedule never surfaces the failure; never return `ok: false` when the run must fail.
73
74
  - When a script returns an array, return a scalar count beside it (for example `{ count, rows }`). A bounded or elided reply can show an empty array as a clean zero; the count is the only reliable signal that rows existed.
74
75
  - `agentId` is propagated through the `X-Agent-ID` header, so SDK calls run as you. `taskId` is not ambient: pass it in `args` when the script calls `task_storeProgress`.
75
76
  - A script invoked from a workflow node may run under a workflow identity. The node may also supply arguments the script needs: when you run that script directly, pass the same arguments the node maps. A script without a strict `argsSchema` then fails deeper in, often as a not-found or resource error instead of a validation error.
@@ -65,6 +65,7 @@ export default async function (args: z.infer<typeof argsSchema>, ctx: ScriptCont
65
65
  - Both `zod` and `zod/mini` imports work. Use `import * as z from "zod/mini"` for smaller QuickJS bundles. Mini uses functional forms: `z.optional(z.string())`, `z._default(z.number(), 10)`, and `z.string().check(z.minLength(1))`; its schemas still have `.parse()` and `.safeParse()`.
66
66
  - Inline source through `script-run` runs without a typecheck. `script-upsert` typechecks before it saves. Import `ScriptContext` from `"swarm-sdk"` in inline code too, so promotion to a named script works. A worker's `script-upsert` saves at agent scope; a global-scope upsert is rejected unless you are the lead. To share a script, send the lead its name and `contentHash` to promote.
67
67
  - SDK methods return `Promise<unknown>`. Responses are usually wrapped: read `res?.data ?? res`. Exception: `app_query` with a literal `appId` and `query` returns rows typed from the app's columns.
68
+ - To fail a run, throw an `Error` whose message starts with a stable reason code (for example `JOB_FAILED: ...`) and carries a JSON payload. A returned `{ ok: false }` still ends the run as `completed`, so a schedule never surfaces the failure; never return `ok: false` when the run must fail.
68
69
  - When a script returns an array, return a scalar count beside it (for example `{ count, rows }`). A bounded or elided reply can show an empty array as a clean zero; the count is the only reliable signal that rows existed.
69
70
  - `agentId` is propagated through the `X-Agent-ID` header, so SDK calls run as you. `taskId` is not ambient: pass it in `args` when the script calls `task_storeProgress`.
70
71
  - A script invoked from a workflow node may run under a workflow identity. The node may also supply arguments the script needs: when you run that script directly, pass the same arguments the node maps. A script without a strict `argsSchema` then fails deeper in, often as a not-found or resource error instead of a validation error.
@@ -1,17 +0,0 @@
1
- import {
2
- ACPAdapter2
3
- } from "./cli-8cas2xvp.js";
4
- import"./cli-0fgvnb0x.js";
5
- import"./cli-nc4pbwmp.js";
6
- import"./cli-n1kjs58m.js";
7
- import"./cli-zexwhj3f.js";
8
- import"./cli-k0nebh10.js";
9
- import"./cli-0h8skzss.js";
10
- import"./cli-m1sns1da.js";
11
- import"./cli-0726awxw.js";
12
- import"./cli-3xqad83h.js";
13
- import"./cli-bv4vvnmg.js";
14
- import"./cli-ywy8yz6t.js";
15
- export {
16
- ACPAdapter2 as ACPAdapter
17
- };
@@ -1,20 +0,0 @@
1
- import {
2
- checkFxCredentials2,
3
- FxAdapter2
4
- } from "./cli-3bxrrh53.js";
5
- import"./cli-8cas2xvp.js";
6
- import"./cli-0fgvnb0x.js";
7
- import"./cli-nc4pbwmp.js";
8
- import"./cli-n1kjs58m.js";
9
- import"./cli-zexwhj3f.js";
10
- import"./cli-k0nebh10.js";
11
- import"./cli-0h8skzss.js";
12
- import"./cli-m1sns1da.js";
13
- import"./cli-0726awxw.js";
14
- import"./cli-3xqad83h.js";
15
- import"./cli-bv4vvnmg.js";
16
- import"./cli-ywy8yz6t.js";
17
- export {
18
- FxAdapter2 as FxAdapter,
19
- checkFxCredentials2 as checkFxCredentials
20
- };
@@ -1,41 +0,0 @@
1
- import {
2
- LOOKUP_USER_TEAM2,
3
- isUserAllowed2,
4
- registerMessageHandler2,
5
- init_handlers
6
- } from "./cli-3tzmh38q.js";
7
- import"./cli-phdzn699.js";
8
- import"./cli-1vmhnncj.js";
9
- import"./cli-904wk98s.js";
10
- import"./cli-4fpa0zns.js";
11
- import"./cli-93n305hm.js";
12
- import"./cli-gse7bp3z.js";
13
- import"./cli-jyhbvdga.js";
14
- import"./cli-tr19nyn9.js";
15
- import"./cli-zhwjdhjr.js";
16
- import"./cli-y260hgep.js";
17
- import"./cli-gtj12v95.js";
18
- import"./cli-9ah37a8a.js";
19
- import"./cli-0p76my9q.js";
20
- import"./cli-d5pc8ep0.js";
21
- import"./cli-404am6f3.js";
22
- import"./cli-29h5239w.js";
23
- import"./cli-rmgvwcmy.js";
24
- import"./cli-qzz6tz8s.js";
25
- import"./cli-7gbff32z.js";
26
- import"./cli-r8ddn0hf.js";
27
- import"./cli-b0m3bg0f.js";
28
- import"./cli-vr4eyq6p.js";
29
- import"./cli-pz1dp12c.js";
30
- import"./cli-ybte1fqc.js";
31
- import"./cli-ysv0k1we.js";
32
- import"./cli-x2cem5vy.js";
33
- import"./cli-kj84fqxz.js";
34
- import"./cli-ts5yv7dn.js";
35
- init_handlers();
36
-
37
- export {
38
- LOOKUP_USER_TEAM2 as LOOKUP_USER_TEAM,
39
- isUserAllowed2 as isUserAllowed,
40
- registerMessageHandler2 as registerMessageHandler
41
- };
@@ -1,42 +0,0 @@
1
- import {
2
- calculateNextRun2,
3
- parseSchedulerIntervalMs2,
4
- startScheduler2,
5
- stopScheduler2,
6
- runScheduleNow2,
7
- init_scheduler2
8
- } from "./cli-904wk98s.js";
9
- import"./cli-4fpa0zns.js";
10
- import"./cli-93n305hm.js";
11
- import"./cli-gse7bp3z.js";
12
- import"./cli-jyhbvdga.js";
13
- import"./cli-tr19nyn9.js";
14
- import"./cli-zhwjdhjr.js";
15
- import"./cli-y260hgep.js";
16
- import"./cli-gtj12v95.js";
17
- import"./cli-9ah37a8a.js";
18
- import"./cli-0p76my9q.js";
19
- import"./cli-d5pc8ep0.js";
20
- import"./cli-404am6f3.js";
21
- import"./cli-29h5239w.js";
22
- import"./cli-rmgvwcmy.js";
23
- import"./cli-qzz6tz8s.js";
24
- import"./cli-7gbff32z.js";
25
- import"./cli-r8ddn0hf.js";
26
- import"./cli-b0m3bg0f.js";
27
- import"./cli-vr4eyq6p.js";
28
- import"./cli-pz1dp12c.js";
29
- import"./cli-ybte1fqc.js";
30
- import"./cli-ysv0k1we.js";
31
- import"./cli-x2cem5vy.js";
32
- import"./cli-kj84fqxz.js";
33
- import"./cli-ts5yv7dn.js";
34
- init_scheduler2();
35
-
36
- export {
37
- calculateNextRun2 as calculateNextRun,
38
- parseSchedulerIntervalMs2 as parseSchedulerIntervalMs,
39
- runScheduleNow2 as runScheduleNow,
40
- startScheduler2 as startScheduler,
41
- stopScheduler2 as stopScheduler
42
- };
@@ -1,39 +0,0 @@
1
- import"./cli-ns59dc6r.js";
2
- import {
3
- parseHeartbeatIntervalMs2,
4
- startHeartbeat2,
5
- stopHeartbeat2
6
- } from "./cli-944w9wb4.js";
7
- import"./cli-ea7nz50q.js";
8
- import"./cli-p436yrzp.js";
9
- import"./cli-904wk98s.js";
10
- import"./cli-4fpa0zns.js";
11
- import"./cli-93n305hm.js";
12
- import"./cli-gse7bp3z.js";
13
- import"./cli-jyhbvdga.js";
14
- import"./cli-tr19nyn9.js";
15
- import"./cli-zhwjdhjr.js";
16
- import"./cli-y260hgep.js";
17
- import"./cli-gtj12v95.js";
18
- import"./cli-9ah37a8a.js";
19
- import"./cli-0p76my9q.js";
20
- import"./cli-d5pc8ep0.js";
21
- import"./cli-404am6f3.js";
22
- import"./cli-29h5239w.js";
23
- import"./cli-rmgvwcmy.js";
24
- import"./cli-qzz6tz8s.js";
25
- import"./cli-7gbff32z.js";
26
- import"./cli-r8ddn0hf.js";
27
- import"./cli-b0m3bg0f.js";
28
- import"./cli-vr4eyq6p.js";
29
- import"./cli-pz1dp12c.js";
30
- import"./cli-ybte1fqc.js";
31
- import"./cli-ysv0k1we.js";
32
- import"./cli-x2cem5vy.js";
33
- import"./cli-kj84fqxz.js";
34
- import"./cli-ts5yv7dn.js";
35
- export {
36
- parseHeartbeatIntervalMs2 as parseHeartbeatIntervalMs,
37
- startHeartbeat2 as startHeartbeat,
38
- stopHeartbeat2 as stopHeartbeat
39
- };
@@ -1,44 +0,0 @@
1
- import {
2
- getExecutorRegistry2,
3
- initWorkflows2,
4
- init_workflows
5
- } from "./cli-904wk98s.js";
6
- import"./cli-4fpa0zns.js";
7
- import"./cli-93n305hm.js";
8
- import"./cli-gse7bp3z.js";
9
- import"./cli-jyhbvdga.js";
10
- import"./cli-tr19nyn9.js";
11
- import"./cli-zhwjdhjr.js";
12
- import"./cli-y260hgep.js";
13
- import"./cli-gtj12v95.js";
14
- import {
15
- retryFailedRun2,
16
- cancelWorkflowRun2
17
- } from "./cli-9ah37a8a.js";
18
- import {
19
- startWorkflowExecution2
20
- } from "./cli-0p76my9q.js";
21
- import"./cli-d5pc8ep0.js";
22
- import"./cli-404am6f3.js";
23
- import"./cli-29h5239w.js";
24
- import"./cli-rmgvwcmy.js";
25
- import"./cli-qzz6tz8s.js";
26
- import"./cli-7gbff32z.js";
27
- import"./cli-r8ddn0hf.js";
28
- import"./cli-b0m3bg0f.js";
29
- import"./cli-vr4eyq6p.js";
30
- import"./cli-pz1dp12c.js";
31
- import"./cli-ybte1fqc.js";
32
- import"./cli-ysv0k1we.js";
33
- import"./cli-x2cem5vy.js";
34
- import"./cli-kj84fqxz.js";
35
- import"./cli-ts5yv7dn.js";
36
- init_workflows();
37
-
38
- export {
39
- cancelWorkflowRun2 as cancelWorkflowRun,
40
- getExecutorRegistry2 as getExecutorRegistry,
41
- initWorkflows2 as initWorkflows,
42
- retryFailedRun2 as retryFailedRun,
43
- startWorkflowExecution2 as startWorkflowExecution
44
- };