@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
@@ -0,0 +1,132 @@
1
+ /**
2
+ * P1: a session whose task the server already holds as completed or failed
3
+ * (the agent finished before its session ended) still reports the usage
4
+ * windows it observed. The finish call and the key outcome stay skipped.
5
+ */
6
+ import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
7
+ import { checkCompletedProcesses, type RunnerState, type RunningTask } from "../commands/runner";
8
+ import type { ProviderSession } from "../providers/types";
9
+
10
+ /** Worker → API calls, as `METHOD /path` plus the parsed body. */
11
+ const requests: Array<{ call: string; body: unknown }> = [];
12
+ let server: ReturnType<typeof Bun.serve>;
13
+ let apiUrl = "";
14
+
15
+ beforeAll(() => {
16
+ server = Bun.serve({
17
+ port: 0,
18
+ async fetch(req) {
19
+ const text = await req.text();
20
+ requests.push({
21
+ call: `${req.method} ${new URL(req.url).pathname}`,
22
+ body: text ? JSON.parse(text) : undefined,
23
+ });
24
+ return Response.json({ success: true });
25
+ },
26
+ });
27
+ apiUrl = `http://127.0.0.1:${server.port}`;
28
+ });
29
+
30
+ afterAll(() => {
31
+ server.stop(true);
32
+ });
33
+
34
+ beforeEach(() => {
35
+ requests.length = 0;
36
+ });
37
+
38
+ const WINDOWS_PATH = "POST /api/keys/report-rate-limit-windows";
39
+
40
+ function settledSession(): ProviderSession {
41
+ return {
42
+ sessionId: "s-1",
43
+ onEvent: () => {},
44
+ waitForCompletion: () => new Promise(() => {}),
45
+ abort: async () => {},
46
+ } as unknown as ProviderSession;
47
+ }
48
+
49
+ function setup(serverTerminalStatus: string, withWindows = true) {
50
+ const taskId = crypto.randomUUID();
51
+ const task = {
52
+ taskId,
53
+ triggerType: "task_assigned",
54
+ session: settledSession(),
55
+ logFile: "/tmp/runner-terminal-window-report.log",
56
+ startTime: new Date(),
57
+ promise: new Promise(() => {}),
58
+ result: {
59
+ exitCode: 0,
60
+ sessionId: "s-1",
61
+ ...(withWindows
62
+ ? {
63
+ rateLimitWindows: {
64
+ five_hour: {
65
+ status: "allowed",
66
+ utilization: 0.53,
67
+ resetsAt: Math.floor(Date.now() / 1000) + 3600,
68
+ lastSeenAt: new Date().toISOString(),
69
+ },
70
+ },
71
+ }
72
+ : {}),
73
+ },
74
+ harnessProvider: "claude",
75
+ hasLocalEnvironment: false,
76
+ credentialInfo: { keyType: "CLAUDE_CODE_OAUTH_TOKEN", keySuffix: "DNAAA", keyIndex: 3 },
77
+ serverTerminalStatus,
78
+ } as unknown as RunningTask;
79
+ const state = {
80
+ activeTasks: new Map<string, RunningTask>([[taskId, task]]),
81
+ maxConcurrent: 1,
82
+ startedAt: Date.now(),
83
+ tasksProcessed: 0,
84
+ harnessProvider: "claude",
85
+ codexCreditsExhaustedCooldownMs: 7_200_000,
86
+ modelWindowBlocks: new Map(),
87
+ } as RunnerState;
88
+ return { taskId, state };
89
+ }
90
+
91
+ /** The window report is fire-and-forget: wait until it lands or the budget runs out. */
92
+ async function waitForCall(call: string, budgetMs = 2_000): Promise<void> {
93
+ const deadline = Date.now() + budgetMs;
94
+ while (Date.now() < deadline && !requests.some((r) => r.call === call)) await Bun.sleep(10);
95
+ }
96
+
97
+ const apiConfig = () => ({ apiUrl, apiKey: "test-key", agentId: crypto.randomUUID() });
98
+
99
+ describe("checkCompletedProcesses — window telemetry for a task terminal server-side", () => {
100
+ test.each(["completed", "failed"])("%s: one window report, no finish", async (status) => {
101
+ const { taskId, state } = setup(status);
102
+ await checkCompletedProcesses(state, "worker", apiConfig());
103
+ await waitForCall(WINDOWS_PATH);
104
+
105
+ const windowReports = requests.filter((r) => r.call === WINDOWS_PATH);
106
+ expect(windowReports).toHaveLength(1);
107
+ expect(windowReports[0]?.body).toMatchObject({
108
+ keyType: "CLAUDE_CODE_OAUTH_TOKEN",
109
+ keySuffix: "DNAAA",
110
+ keyIndex: 3,
111
+ windows: { five_hour: { utilization: 0.53 } },
112
+ });
113
+ // The server result stands: no finish, no key outcome.
114
+ expect(requests.some((r) => r.call.includes("/finish"))).toBe(false);
115
+ expect(requests.some((r) => r.call === "POST /api/keys/clear-rate-limit")).toBe(false);
116
+ expect(state.activeTasks.has(taskId)).toBe(false);
117
+ });
118
+
119
+ test("cancelled: no window report", async () => {
120
+ const { state } = setup("cancelled");
121
+ await checkCompletedProcesses(state, "worker", apiConfig());
122
+ await Bun.sleep(100);
123
+ expect(requests.some((r) => r.call === WINDOWS_PATH)).toBe(false);
124
+ });
125
+
126
+ test("a session without windows sends no report", async () => {
127
+ const { state } = setup("completed", false);
128
+ await checkCompletedProcesses(state, "worker", apiConfig());
129
+ await Bun.sleep(100);
130
+ expect(requests.some((r) => r.call === WINDOWS_PATH)).toBe(false);
131
+ });
132
+ });
@@ -78,6 +78,7 @@ test("eight failed concurrent provisions count one attempt and preserve retry de
78
78
  await reconcileOnce({ now: later(now, 120) });
79
79
  expect(state.fake.requests).toHaveLength(10);
80
80
  expect((await getTaskById(task.id))?.status).toBe("failed");
81
+ expect((await getTaskById(task.id))?.statusKind).toBe("error");
81
82
  expect((await getTaskById(task.id))?.failureReason).toStartWith(
82
83
  "provisioning failed after 3 attempts:",
83
84
  );
@@ -17,7 +17,7 @@ import { CHILD_PROCESS_TEST_BUDGET_MS, expectChildOk, runChild } from "./test-pr
17
17
 
18
18
  const TEST_ENV = { PATH: process.env.PATH ?? "/usr/bin:/bin", HOME: "/tmp" };
19
19
  function sandboxPrelude(command: readonly string[]): string {
20
- return buildSandboxedCommand(command, TEST_ENV)[2] ?? "";
20
+ return buildSandboxedCommand(command, TEST_ENV).at(-1) ?? "";
21
21
  }
22
22
 
23
23
  /**
@@ -69,28 +69,33 @@ describe("sandboxSpawnEnv", () => {
69
69
  });
70
70
  });
71
71
 
72
- describe("buildSandboxedCommand spawn mode", () => {
72
+ describe("buildSandboxedCommand environment modes", () => {
73
73
  test.skipIf(SKIP_SANDBOX_SPAWN_TESTS)(
74
- "does not execute BASH_ENV before installing the sandbox limits",
74
+ "does not execute startup files before installing the sandbox limits",
75
75
  async () => {
76
- const startupFile = `${process.env.TMPDIR ?? "/tmp"}/sandbox-startup-${crypto.randomUUID()}.sh`;
76
+ const startupDir = `${process.env.TMPDIR ?? "/tmp"}/sandbox-startup-${crypto.randomUUID()}`;
77
+ const startupFile = `${startupDir}/startup.sh`;
77
78
  await Bun.write(startupFile, "exit 37\n");
79
+ await Bun.write(`${startupDir}/.bashrc`, "echo unexpected-startup >&2\n");
78
80
  try {
79
- const env = { ...TEST_ENV, BASH_ENV: startupFile };
80
- const command = buildSandboxedCommand(
81
- ["printf", "ready"],
82
- env,
83
- DEFAULT_SANDBOX_LIMITS,
84
- "spawn",
85
- );
86
- const result = await runChild(command, { env });
87
- expectChildOk(result, "spawn-mode sandbox with BASH_ENV");
88
- expect(result.stdout).toBe("ready");
81
+ const env = { ...TEST_ENV, HOME: startupDir, BASH_ENV: startupFile };
82
+ for (const mode of ["inline", "spawn"] as const) {
83
+ const command = buildSandboxedCommand(
84
+ ["printf", "ready"],
85
+ env,
86
+ DEFAULT_SANDBOX_LIMITS,
87
+ mode,
88
+ );
89
+ const result = await runChild(command, { env, keepStdinOpen: true });
90
+ expectChildOk(result, `${mode}-mode sandbox startup`);
91
+ expect(result.stdout).toBe("ready");
92
+ expect(result.stderr).toBe("");
93
+ }
89
94
  } finally {
90
- await Bun.file(startupFile).delete();
95
+ await Bun.$`rm -rf ${startupDir}`;
91
96
  }
92
97
  },
93
- CHILD_PROCESS_TEST_BUDGET_MS,
98
+ CHILD_PROCESS_TEST_BUDGET_MS * 2,
94
99
  );
95
100
 
96
101
  test("keeps environment values out of every command argument", () => {
@@ -146,8 +151,8 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
146
151
  test.each(["bun", "node", "npx"])("raises AS and nproc for direct %s commands", (runtime) => {
147
152
  const command = buildSandboxedCommand([runtime, "--version"], TEST_ENV);
148
153
  expect(command[0]).toBe("bash");
149
- expect(command[2]).toContain(`ulimit -v ${BUN_SANDBOX_VIRTUAL_MEMORY_MB * 1024}`);
150
- expect(command[2]).toContain(`ulimit -u ${JAVASCRIPT_RUNTIME_SANDBOX_MAX_PROCS}`);
154
+ expect(command.at(-1)).toContain(`ulimit -v ${BUN_SANDBOX_VIRTUAL_MEMORY_MB * 1024}`);
155
+ expect(command.at(-1)).toContain(`ulimit -u ${JAVASCRIPT_RUNTIME_SANDBOX_MAX_PROCS}`);
151
156
  });
152
157
 
153
158
  test.each(["bash", "sh", "dash"])("propagates the runtime profile through %s -c", (shell) => {
@@ -171,7 +176,7 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
171
176
  test("keeps strict resource defaults for direct non-interpreter commands, still rendered through bash", () => {
172
177
  const command = buildSandboxedCommand(["git", "status", "--short"], TEST_ENV);
173
178
  expect(command[0]).toBe("bash");
174
- const prelude = command[2] ?? "";
179
+ const prelude = command.at(-1) ?? "";
175
180
  expect(prelude).toContain(`ulimit -v ${DEFAULT_SANDBOX_LIMITS.virtualMemoryMb * 1024}`);
176
181
  expect(prelude).toContain(`ulimit -u ${DEFAULT_SANDBOX_LIMITS.maxProcs}`);
177
182
  });
@@ -184,7 +189,7 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
184
189
  test("renders a real ulimit -u for a non-JS, non-shell command (python3) via bash", () => {
185
190
  const command = buildSandboxedCommand(["python3", "-c", "print('hi')"], TEST_ENV);
186
191
  expect(command[0]).toBe("bash");
187
- const prelude = command[2] ?? "";
192
+ const prelude = command.at(-1) ?? "";
188
193
  expect(prelude).toContain(`ulimit -u ${DEFAULT_SANDBOX_LIMITS.maxProcs}`);
189
194
  });
190
195
 
@@ -261,7 +266,7 @@ describe("buildSandboxedCommand runtime-aware limits", () => {
261
266
  // on behavior that could pass for the wrong reason (e.g. ambient
262
267
  // fleet-wide UID pressure happening to be low that run).
263
268
  expect(command[0]).toBe("bash");
264
- expect(command[2]).toContain(`ulimit -u ${tinyLimits.maxProcs}`);
269
+ expect(command.at(-1)).toContain(`ulimit -u ${tinyLimits.maxProcs}`);
265
270
 
266
271
  const result = await runChild(command, { env: sandboxSpawnEnv(TEST_ENV) });
267
272
 
@@ -108,15 +108,18 @@ describe("Schedule HTTP triage tooling", () => {
108
108
  lastErrorMessage: "boom",
109
109
  });
110
110
 
111
- const res = await fetch(
112
- `${baseUrl}/api/schedules?lastRunStatus=failed&consecutiveErrorsMin=2`,
113
- { headers },
114
- );
115
-
116
- expect(res.status).toBe(200);
117
- const body = (await res.json()) as { schedules: ScheduledTaskSummary[]; count: number };
118
- expect(body.schedules.some((s) => s.id === failing.id)).toBe(true);
119
- expect(body.schedules.some((s) => s.id === ok.id)).toBe(false);
111
+ for (const [query, includesFailing] of [
112
+ ["lastRunStatus=failed", true],
113
+ ["lastRunStatus=failed&consecutiveErrorsMin=2", true],
114
+ ["lastRunStatus=failed&consecutiveErrorsMin=3", false],
115
+ ] as const) {
116
+ const res = await fetch(`${baseUrl}/api/schedules?${query}`, { headers });
117
+ expect(res.status).toBe(200);
118
+ const body = (await res.json()) as { schedules: ScheduledTaskSummary[] };
119
+ const ids = body.schedules.map((schedule) => schedule.id);
120
+ expect(ids.includes(failing.id)).toBe(includesFailing);
121
+ expect(ids).not.toContain(ok.id);
122
+ }
120
123
  });
121
124
  test("PUT and PATCH /api/schedules/:id let only the owner, a lead or the operator change a deferral", async () => {
122
125
  const owner = await createAgent({ name: "DeferralOwner", isLead: false, status: "idle" });
@@ -176,14 +176,14 @@ describe("Scheduled Tasks Integration", () => {
176
176
 
177
177
  test("should list scheduled tasks with filters", async () => {
178
178
  // Create enabled and disabled schedules
179
- await createScheduledTask({
179
+ const enabled = await createScheduledTask({
180
180
  name: "test-filter-enabled",
181
181
  intervalMs: 60000,
182
182
  taskTemplate: "Enabled task",
183
183
  enabled: true,
184
184
  });
185
185
 
186
- await createScheduledTask({
186
+ const disabled = await createScheduledTask({
187
187
  name: "test-filter-disabled",
188
188
  intervalMs: 60000,
189
189
  taskTemplate: "Disabled task",
@@ -193,6 +193,8 @@ describe("Scheduled Tasks Integration", () => {
193
193
  const enabledOnly = await getScheduledTasks({ enabled: true });
194
194
  const disabledOnly = await getScheduledTasks({ enabled: false });
195
195
 
196
+ expect(enabledOnly.some((s) => s.id === enabled.id)).toBe(true);
197
+ expect(disabledOnly.some((s) => s.id === disabled.id)).toBe(true);
196
198
  expect(enabledOnly.every((s) => s.enabled)).toBe(true);
197
199
  expect(disabledOnly.every((s) => !s.enabled)).toBe(true);
198
200
  });
@@ -214,15 +216,18 @@ describe("Scheduled Tasks Integration", () => {
214
216
  });
215
217
  await updateScheduledTask(failing.id, {
216
218
  lastRunAt: new Date(Date.now() - 60000).toISOString(),
217
- consecutiveErrors: 3,
219
+ consecutiveErrors: 2,
218
220
  lastErrorAt: new Date().toISOString(),
219
221
  lastErrorMessage: "boom",
220
222
  });
221
223
 
222
- const failingOnly = await getScheduledTasks({
223
- lastRunStatus: "failed",
224
- consecutiveErrorsMin: 2,
225
- });
224
+ const belowMinimum = await getScheduledTasks({ consecutiveErrorsMin: 3 });
225
+ expect(belowMinimum.some((s) => s.id === failing.id)).toBe(false);
226
+ const atMinimum = await getScheduledTasks({ consecutiveErrorsMin: 2 });
227
+ expect(atMinimum.some((s) => s.id === failing.id)).toBe(true);
228
+ expect(atMinimum.some((s) => s.id === ok.id)).toBe(false);
229
+
230
+ const failingOnly = await getScheduledTasks({ lastRunStatus: "failed" });
226
231
  const succeededOnly = await getScheduledTasks({ lastRunStatus: "succeeded" });
227
232
 
228
233
  expect(failingOnly.some((s) => s.id === failing.id)).toBe(true);
@@ -437,35 +442,6 @@ describe("Scheduled Tasks Integration", () => {
437
442
  expect(createdTask.routingSource).toBeNull();
438
443
  expect(createdTask.status).toBe("unassigned");
439
444
  });
440
-
441
- test("should be transactional - task and schedule update are atomic", async () => {
442
- const schedule = await createScheduledTask({
443
- name: "test-transactional",
444
- intervalMs: 60000,
445
- taskTemplate: "Transactional test task",
446
- enabled: true,
447
- });
448
-
449
- const taskCountBefore = (
450
- (await getDbClient().get("SELECT COUNT(*) as count FROM agent_tasks")) as {
451
- count: number;
452
- }
453
- ).count;
454
-
455
- await runScheduleNow(schedule.id);
456
-
457
- const taskCountAfter = (
458
- (await getDbClient().get("SELECT COUNT(*) as count FROM agent_tasks")) as {
459
- count: number;
460
- }
461
- ).count;
462
-
463
- const updatedSchedule = await getScheduledTaskById(schedule.id);
464
-
465
- // Both operations should have completed
466
- expect(taskCountAfter).toBe(taskCountBefore + 1);
467
- expect(updatedSchedule?.lastRunAt).toBeDefined();
468
- });
469
445
  });
470
446
 
471
447
  describe("calculateNextRun", () => {
@@ -603,7 +579,7 @@ describe("Scheduled Tasks Integration", () => {
603
579
  });
604
580
 
605
581
  describe("One-Time Schedules", () => {
606
- test("create one-time schedule with delayMs computes nextRunAt", async () => {
582
+ test("create one-time schedule stores nextRunAt without cadence", async () => {
607
583
  const before = Date.now();
608
584
  const schedule = await createScheduledTask({
609
585
  name: "one-time-delay-test",
@@ -620,7 +596,7 @@ describe("Scheduled Tasks Integration", () => {
620
596
  expect(schedule.intervalMs).toBeUndefined();
621
597
  });
622
598
 
623
- test("create one-time schedule with runAt stores nextRunAt", async () => {
599
+ test("create one-time schedule preserves exact nextRunAt", async () => {
624
600
  const runAt = new Date(Date.now() + 120000).toISOString();
625
601
  const schedule = await createScheduledTask({
626
602
  name: "one-time-runat-test",
@@ -634,19 +610,6 @@ describe("Scheduled Tasks Integration", () => {
634
610
  expect(schedule.nextRunAt).toBe(runAt);
635
611
  });
636
612
 
637
- test("one-time schedule does not require cronExpression or intervalMs", async () => {
638
- const schedule = await createScheduledTask({
639
- name: "one-time-no-cron-test",
640
- taskTemplate: "No cron needed",
641
- scheduleType: "one_time",
642
- nextRunAt: new Date(Date.now() + 60000).toISOString(),
643
- });
644
-
645
- expect(schedule.scheduleType).toBe("one_time");
646
- expect(schedule.cronExpression).toBeUndefined();
647
- expect(schedule.intervalMs).toBeUndefined();
648
- });
649
-
650
613
  test("executing one-time schedule auto-disables it", async () => {
651
614
  const schedule = await createScheduledTask({
652
615
  name: "one-time-exec-test",
@@ -4,11 +4,7 @@ import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { classifyExit, NativeScriptExecutor } from "../scripts-runtime/executors/native";
6
6
  import { QuickJSScriptExecutor } from "../scripts-runtime/executors/quickjs";
7
- import type {
8
- ExecutorInput,
9
- ExecutorOutput,
10
- ScriptExecutor,
11
- } from "../scripts-runtime/executors/types";
7
+ import type { ExecutorInput, ScriptExecutor } from "../scripts-runtime/executors/types";
12
8
  import { DEFAULT_SCRIPT_RESOURCES } from "../scripts-runtime/executors/types";
13
9
  import { SKIP_SANDBOX_SPAWN_TESTS } from "./sandbox-spawn-test-helpers";
14
10
  import { CHILD_PROCESS_TEST_BUDGET_MS } from "./test-proc";
@@ -39,49 +35,7 @@ function input(overrides: Partial<ExecutorInput> = {}): ExecutorInput {
39
35
  };
40
36
  }
41
37
 
42
- class FakeScriptExecutor implements ScriptExecutor {
43
- readonly name = "fake";
44
-
45
- async run(runInput: ExecutorInput): Promise<ExecutorOutput> {
46
- if (runInput.fsMode === "workspace-rw") {
47
- return {
48
- result: undefined,
49
- stdout: "",
50
- stderr: "workspace-rw not supported",
51
- truncated: { stdout: false, stderr: false },
52
- durationMs: 0,
53
- exitCode: 1,
54
- error: "executor_error",
55
- };
56
- }
57
-
58
- if (runInput.signal?.aborted) {
59
- return {
60
- result: undefined,
61
- stdout: "",
62
- stderr: "",
63
- truncated: { stdout: false, stderr: false },
64
- durationMs: 0,
65
- exitCode: 1,
66
- error: "killed",
67
- };
68
- }
69
-
70
- const stdout = "x".repeat(runInput.resources.maxStdoutBytes + 10);
71
- return {
72
- result: runInput.configPayload.system.agentId.value,
73
- stdout: stdout.slice(0, runInput.resources.maxStdoutBytes),
74
- stderr: "",
75
- truncated: { stdout: true, stderr: false },
76
- durationMs: 1,
77
- exitCode: 0,
78
- };
79
- }
80
- }
81
-
82
38
  // `spawns` marks whether this executor variant shells out via Bun.spawn.
83
- // FakeScriptExecutor is plain JS and never touches the sandbox, so it must
84
- // keep running even when the spawn probe has disabled the native suite.
85
39
  function conformance(name: string, makeExecutor: () => ScriptExecutor, spawns: boolean) {
86
40
  const spawnTest = test.skipIf(spawns && SKIP_SANDBOX_SPAWN_TESTS);
87
41
 
@@ -132,7 +86,6 @@ function conformance(name: string, makeExecutor: () => ScriptExecutor, spawns: b
132
86
  }
133
87
 
134
88
  conformance("native", () => new NativeScriptExecutor(), true);
135
- conformance("fake", () => new FakeScriptExecutor(), false);
136
89
  // Worker threads and WASM, no Bun.spawn: runs even when the spawn probe fails.
137
90
  conformance("quickjs", () => new QuickJSScriptExecutor(), false);
138
91
 
@@ -1193,7 +1146,9 @@ describe("native-only executor behavior", () => {
1193
1146
  describe("classifyExit", () => {
1194
1147
  test("timeout and killed take precedence over other exit codes", () => {
1195
1148
  expect(classifyExit(1, true, false, false)).toBe("timeout");
1149
+ expect(classifyExit(1, true, false, true)).toBe("timeout");
1196
1150
  expect(classifyExit(1, false, true, false)).toBe("killed");
1151
+ expect(classifyExit(1, false, true, true)).toBe("killed");
1197
1152
  });
1198
1153
 
1199
1154
  test("exit 134 is authoritative even if the watchdog also fired (our kill can't produce SIGABRT)", () => {
@@ -1209,6 +1164,7 @@ describe("classifyExit", () => {
1209
1164
 
1210
1165
  test("OOM-kill exit codes map to killed", () => {
1211
1166
  expect(classifyExit(137, false, false, false)).toBe("killed");
1167
+ expect(classifyExit(137, false, false, true)).toBe("killed");
1212
1168
  expect(classifyExit(9, false, false, false)).toBe("killed");
1213
1169
  });
1214
1170
 
@@ -8,12 +8,16 @@ import { QuickJSScriptExecutor, quickJSWorkerCount } from "./src/scripts-runtime
8
8
  import { DEFAULT_SCRIPT_RESOURCES } from "./src/scripts-runtime/executors/types";
9
9
  let release;
10
10
  const gate = new Promise(resolve => { release = resolve; });
11
+ let allStarted;
12
+ const ready = new Promise(resolve => { allStarted = resolve; });
13
+ let workers;
11
14
  let started = 0;
12
15
  let inFlight = 0;
13
16
  let peak = 0;
14
17
  const server = Bun.serve({ port: 0, async fetch() {
15
18
  started++;
16
19
  peak = Math.max(peak, ++inFlight);
20
+ if (started === workers) allStarted();
17
21
  await gate;
18
22
  inFlight--;
19
23
  return new Response("ok");
@@ -32,15 +36,13 @@ try {
32
36
  fsMode: "none", network: "open",
33
37
  };
34
38
  const jobs = Array.from({ length: 10 }, () => executor.run(input));
35
- const workers = quickJSWorkerCount();
36
- const deadline = Date.now() + 10_000;
37
- while (started < workers && Date.now() < deadline) await Bun.sleep(10);
38
- const heldPeak = peak;
39
+ workers = quickJSWorkerCount();
40
+ if (workers > 0) await Promise.race([ready, Promise.all(jobs)]);
39
41
  release();
40
42
  const outputs = await Promise.all(jobs);
41
43
  process.env.SCRIPT_QUICKJS_POOL_SIZE = "16";
42
44
  const later = await executor.run(input);
43
- console.log(JSON.stringify({ workers, heldPeak, results: outputs.map(o => o.result),
45
+ console.log(JSON.stringify({ workers, peak, results: outputs.map(o => o.result),
44
46
  errors: outputs.map(o => o.error), stderr: outputs[0].stderr,
45
47
  retainedWorkers: quickJSWorkerCount(), laterResult: later.result }));
46
48
  } finally {
@@ -59,7 +61,7 @@ async function inspectPool(size?: string) {
59
61
  );
60
62
  return JSON.parse(result.stdout.trim()) as {
61
63
  workers: number;
62
- heldPeak: number;
64
+ peak: number;
63
65
  results: string[];
64
66
  errors: Array<string | null>;
65
67
  stderr: string;
@@ -80,7 +82,7 @@ describe("QuickJS pool configuration", () => {
80
82
  async () => {
81
83
  const result = await inspectPool(size);
82
84
  expect(result.workers).toBe(expected);
83
- expect(result.heldPeak).toBe(expected);
85
+ expect(result.peak).toBe(expected);
84
86
  expect(result.results).toEqual(Array(10).fill("ok"));
85
87
  expect(result.errors).toEqual(Array(10).fill(null));
86
88
  expect(result.retainedWorkers).toBe(expected);
@@ -4,7 +4,6 @@ import { tmpdir } from "node:os";
4
4
  import { join } from "node:path";
5
5
  import { pathToFileURL } from "node:url";
6
6
  import {
7
- classifyExit,
8
7
  NativeScriptExecutor,
9
8
  writeBareImportShim,
10
9
  writeBareImportShims,
@@ -65,15 +64,6 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
65
64
  }
66
65
  });
67
66
 
68
- test("classifyExit preserves retry-safety boundary around userCodeStarted and resource signals", () => {
69
- expect(classifyExit(134, false, false, false)).toBe("capacity_exceeded");
70
- expect(classifyExit(134, false, false, true)).toBe("eval_error");
71
- expect(classifyExit(1, true, false, true)).toBe("timeout");
72
- expect(classifyExit(1, false, true, true)).toBe("killed");
73
- expect(classifyExit(137, false, false, true)).toBe("killed");
74
- expect(classifyExit(0, false, false, true)).toBeUndefined();
75
- });
76
-
77
67
  spawnTest(
78
68
  "NativeScriptExecutor resolves bare imports across repeated runs and cleans up tmpdir",
79
69
  async () => {
@@ -112,6 +102,7 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
112
102
  expect(second.exitCode).toBe(0);
113
103
  expect(typeof second.result).toBe("string");
114
104
  },
105
+ defaultResources.wallClockMs * 2 + 5_000,
115
106
  );
116
107
 
117
108
  spawnTest(
@@ -160,6 +151,7 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
160
151
  expect(secondResult.hasMarker).toBe(false);
161
152
  expect(secondResult.tmp).not.toBe(firstTmp);
162
153
  },
154
+ defaultResources.wallClockMs * 2 + 5_000,
163
155
  );
164
156
 
165
157
  spawnTest("NativeScriptExecutor enforces wallClockMs timeout", async () => {
@@ -226,26 +218,30 @@ describe("NativeScriptExecutor startup overhead & shim reuse (#2008)", () => {
226
218
  expect(out.result).toBeUndefined();
227
219
  });
228
220
 
229
- spawnTest("NativeScriptExecutor enforces maxStdoutBytes truncation resource limit", async () => {
230
- const executor = new NativeScriptExecutor();
221
+ spawnTest(
222
+ "NativeScriptExecutor enforces maxStdoutBytes truncation resource limit",
223
+ async () => {
224
+ const executor = new NativeScriptExecutor();
231
225
 
232
- const out = await executor.run({
233
- source: `
226
+ const out = await executor.run({
227
+ source: `
234
228
  export default async () => {
235
229
  console.log("x".repeat(4096));
236
230
  return { ok: true };
237
231
  };
238
232
  `,
239
- args: null,
240
- configPayload: defaultConfigPayload,
241
- resources: { ...defaultResources, maxStdoutBytes: 512 },
242
- fsMode: "none",
243
- network: "full",
244
- });
233
+ args: null,
234
+ configPayload: defaultConfigPayload,
235
+ resources: { ...defaultResources, maxStdoutBytes: 512 },
236
+ fsMode: "none",
237
+ network: "full",
238
+ });
245
239
 
246
- expect(out.error, out.stderr).toBeUndefined();
247
- expect(out.truncated.stdout).toBe(true);
248
- expect(out.stdout.length).toBeLessThanOrEqual(512);
249
- expect(out.result).toEqual({ ok: true });
250
- });
240
+ expect(out.error, out.stderr).toBeUndefined();
241
+ expect(out.truncated.stdout).toBe(true);
242
+ expect(out.stdout.length).toBeLessThanOrEqual(512);
243
+ expect(out.result).toEqual({ ok: true });
244
+ },
245
+ defaultResources.wallClockMs + 5_000,
246
+ );
251
247
  });
@@ -349,8 +349,10 @@ describe("secret corpus", () => {
349
349
 
350
350
  describe("pass 5 throughput", () => {
351
351
  // Informational budget. Timing-sensitive on a shared CI runner: retry
352
- // absorbs a spike; a real regression fails every attempt.
353
- test(
352
+ // absorbs a spike; a real regression fails every attempt. Skipped in the
353
+ // nightly coverage run: instrumentation slows pass 5's JS more than the
354
+ // native regex passes, so the ratio sits near 2x there with no regression.
355
+ test.skipIf(process.env.ROOT_COVERAGE_RUN === "1")(
354
356
  "10k lines with pass 5 cost under 2x the run without it",
355
357
  () => {
356
358
  const lines: string[] = [];