@desplega.ai/agent-swarm 1.169.0 → 1.171.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/README.md +11 -2
  2. package/dist/{acp-adapter-m47zfx4a.js → acp-adapter-1z9p3fvx.js} +6 -6
  3. package/dist/{actions-ws7k3tvq.js → actions-rc2yjk8a.js} +31 -29
  4. package/dist/{amp-adapter-nvv8k8j5.js → amp-adapter-ypyf5s1x.js} +6 -6
  5. package/dist/{anthropic-messages-13yn502s.js → anthropic-messages-etkbxhhy.js} +11 -11
  6. package/dist/{app-80w6qspx.js → app-04ab2s0z.js} +9 -9
  7. package/dist/{artifact-fey7dvj9.js → artifact-eczsknc3.js} +6 -3
  8. package/dist/{assistant-jtq439kw.js → assistant-vhmjd8wf.js} +34 -32
  9. package/dist/{azure-openai-responses-9st34pfz.js → azure-openai-responses-xap57x4b.js} +7 -7
  10. package/dist/{boot-reembed-feda8wn8.js → boot-reembed-3p0m259x.js} +8 -8
  11. package/dist/{boot-reembed-3nc0aaed.js → boot-reembed-wew3gwk8.js} +8 -8
  12. package/dist/{boot-scrub-sweep-grsa2er0.js → boot-scrub-sweep-5ytwtq24.js} +9 -9
  13. package/dist/{boot-seeds-gcfgq44f.js → boot-seeds-s8p2xry8.js} +12 -12
  14. package/dist/{claude-adapter-pjv2q7t8.js → claude-adapter-akrzg6jh.js} +15 -15
  15. package/dist/{claude-managed-adapter-0wa8se82.js → claude-managed-adapter-kqqqhp2q.js} +2 -2
  16. package/dist/{claude-managed-setup-zxa9p9tx.js → claude-managed-setup-bnmjarjc.js} +11 -8
  17. package/dist/{claude-sdk-session-c9j6k9kx.js → claude-sdk-session-exq1jadx.js} +15 -15
  18. package/dist/{cli-a8vps458.js → cli-01qndrvw.js} +17274 -17242
  19. package/dist/{cli-rg1c8ccw.js → cli-0d2rqhvq.js} +497 -73
  20. package/dist/cli-0p3enk35.js +188 -0
  21. package/dist/cli-1srmzpr3.js +16 -0
  22. package/dist/{cli-zzev32jw.js → cli-231av4y6.js} +6 -6
  23. package/dist/{cli-kp3vfknv.js → cli-280gnz4v.js} +2 -2
  24. package/dist/{cli-mv2520nm.js → cli-2bw3w47j.js} +1 -1
  25. package/dist/{cli-km8559dm.js → cli-2qbs2tvf.js} +18 -10
  26. package/dist/{cli-efnd2kce.js → cli-2rbt7at8.js} +6 -1
  27. package/dist/{cli-xvc3q9br.js → cli-451ks6aw.js} +1 -1
  28. package/dist/{cli-jkfxpg1b.js → cli-4bm25xtw.js} +2 -2
  29. package/dist/{cli-zp38xvtm.js → cli-5rqrj7q0.js} +1 -1
  30. package/dist/{cli-km4x66j0.js → cli-5y67yrt6.js} +13 -13
  31. package/dist/{cli-qg2zhjfc.js → cli-62bwwc2q.js} +8 -8
  32. package/dist/{cli-s0k2j7q9.js → cli-6xxxb8qt.js} +10 -10
  33. package/dist/cli-6zx22mv6.js +0 -0
  34. package/dist/{cli-zp67qg5x.js → cli-7a0sde2x.js} +72 -1
  35. package/dist/{cli-v1w7pbd8.js → cli-7jykv7ef.js} +1 -1
  36. package/dist/{cli-rfphkzh5.js → cli-7pz3b7x5.js} +24 -4
  37. package/dist/{cli-mb75wpxf.js → cli-81r1wjyv.js} +1 -1
  38. package/dist/{cli-rbr91whd.js → cli-8mr695sb.js} +9 -5
  39. package/dist/{cli-f14fvzag.js → cli-a1b9b32n.js} +6 -1
  40. package/dist/cli-cd0hv9nh.js +32 -0
  41. package/dist/{cli-dv76vq5d.js → cli-ctret352.js} +685 -209
  42. package/dist/{cli-wt7ccy4r.js → cli-d161g69q.js} +9 -1
  43. package/dist/cli-db3m6zdt.js +362 -0
  44. package/dist/{cli-hf5s9pgf.js → cli-e3pmyt39.js} +1 -1
  45. package/dist/{cli-ysnkvdx6.js → cli-ec7hrgqp.js} +313 -91
  46. package/dist/{cli-m23r88re.js → cli-erbp6b4g.js} +3 -3
  47. package/dist/{cli-9k7mqz00.js → cli-ge593j7e.js} +30 -3
  48. package/dist/cli-h8w3fg83.js +17 -0
  49. package/dist/{cli-xvdgasgy.js → cli-hsem16hb.js} +114 -9
  50. package/dist/{cli-yvxfaem2.js → cli-hsk5gd15.js} +9 -5
  51. package/dist/{cli-7vz49g7h.js → cli-jxsgrnmq.js} +101 -4
  52. package/dist/{cli-b7y8113e.js → cli-k2v5x13t.js} +1 -1
  53. package/dist/{cli-bqrs5ycj.js → cli-m4csbs67.js} +2 -2
  54. package/dist/{cli-91r17hb1.js → cli-mzj3aqac.js} +3 -3
  55. package/dist/{cli-swrz3mj8.js → cli-n805bb98.js} +1 -1
  56. package/dist/{cli-sajr098b.js → cli-n8ybnv1k.js} +3 -3
  57. package/dist/{cli-e5qk3m2a.js → cli-nkjwe4z7.js} +19 -19
  58. package/dist/{cli-3ry5gx4f.js → cli-p2pjfq1r.js} +2 -2
  59. package/dist/{cli-61tbnjpf.js → cli-p8f7dqgt.js} +767 -541
  60. package/dist/{cli-r7eeddkq.js → cli-ph3145b7.js} +3 -3
  61. package/dist/cli-ppy4nnnh.js +168 -0
  62. package/dist/cli-r455yd58.js +832 -0
  63. package/dist/{cli-jv36y8wz.js → cli-rrbctenq.js} +1 -1
  64. package/dist/{cli-8xjst8q2.js → cli-s88my3br.js} +11 -11
  65. package/dist/{cli-vejds37t.js → cli-srmej5tp.js} +3 -3
  66. package/dist/{cli-eqfbsxsn.js → cli-tg8q0b5y.js} +14 -11
  67. package/dist/cli-w0zx9ya1.js +1351 -0
  68. package/dist/{cli-rh44xx46.js → cli-wfvedq5w.js} +15 -15
  69. package/dist/{cli-n4z21pt8.js → cli-x207g4w1.js} +1 -1
  70. package/dist/{cli-fyeft04q.js → cli-x3fy2tgp.js} +2 -2
  71. package/dist/{cli-7mhy3ths.js → cli-x61srfpp.js} +5 -5
  72. package/dist/{cli-w6xa5nf5.js → cli-y1j1ggbf.js} +8 -8
  73. package/dist/{cli-jvmtxqtc.js → cli-ywh2a87k.js} +7 -2
  74. package/dist/{cli-3qhyh31j.js → cli-ywm1azg9.js} +6 -0
  75. package/dist/{cli-z48ggfyq.js → cli-zxm9p3x4.js} +2 -2
  76. package/dist/cli.js +42 -24
  77. package/dist/{codex-adapter-0kpg09ca.js → codex-adapter-9ag75whm.js} +13 -13
  78. package/dist/{codex-hook-295jpbfa.js → codex-hook-7ba15hjd.js} +5 -3
  79. package/dist/{codex-login-g1cyt5zm.js → codex-login-841kv5fk.js} +7 -5
  80. package/dist/{codex-session-runner-8n672hxh.js → codex-session-runner-9fp7y4cf.js} +13 -13
  81. package/dist/{commands-mhmg5n0x.js → commands-d7eah0y9.js} +10 -10
  82. package/dist/controller-hq5ggpcp.js +193 -0
  83. package/dist/controllers-connect-8t0k65x2.js +265 -0
  84. package/dist/{cursor-adapter-wn8n5zzk.js → cursor-adapter-t4pr1m3c.js} +5 -5
  85. package/dist/db-2rmd23wq.js +71 -0
  86. package/dist/{db-wa6s1mwv.js → db-sp39qv72.js} +8 -8
  87. package/dist/{devin-adapter-bffjj5n4.js → devin-adapter-xgtj680j.js} +2 -2
  88. package/dist/{dispatcher-nhs2pkr8.js → dispatcher-g7fsybsd.js} +30 -28
  89. package/dist/docker-f503k9p0.js +201 -0
  90. package/dist/{dsh-adapter-5423p70m.js → dsh-adapter-2h8m4cab.js} +5 -5
  91. package/dist/e2b-66xra4az.js +202 -0
  92. package/dist/{e2b-nd50eccg.js → e2b-xwhyj8cw.js} +43 -527
  93. package/dist/{event-bus-vnfthafg.js → event-bus-vjtv82gm.js} +2 -2
  94. package/dist/{grok-adapter-28pkdt80.js → grok-adapter-1err1me7.js} +7 -7
  95. package/dist/{handlers-5rtf9nng.js → handlers-c7yggm37.js} +33 -31
  96. package/dist/heartbeat-dkm924fk.js +124 -0
  97. package/dist/{hook-qkm73zk6.js → hook-g8e7sfnf.js} +13 -13
  98. package/dist/{hook-krjfkpzy.js → hook-wgx4exw6.js} +20 -17
  99. package/dist/{http-a397xcn4.js → http-1d23k928.js} +1958 -205
  100. package/dist/{index-kqre45fr.js → index-gm10tmye.js} +30 -28
  101. package/dist/{index-rtxg15ah.js → index-q7cj9bn2.js} +39 -29
  102. package/dist/{index-vvsq7v45.js → index-va4zbvzp.js} +30 -28
  103. package/dist/{index-ac0v8v9d.js → index-vertaxs1.js} +8 -8
  104. package/dist/{index-ytdhtdry.js → index-y5vvczrs.js} +31 -22
  105. package/dist/{keepalive-psfh8ysx.js → keepalive-1jc5e7ct.js} +10 -10
  106. package/dist/{lead-m6rppjn7.js → lead-yxw2f1sg.js} +48 -46
  107. package/dist/{maintenance-41f837ke.js → maintenance-h7w2m10y.js} +8 -8
  108. package/dist/{node-8zkdq42h.js → node-c9we95xf.js} +9 -9
  109. package/dist/{oauth-refresh-sweep-6hr55hm8.js → oauth-refresh-sweep-wh9ypd1b.js} +9 -9
  110. package/dist/{onboard-ktrtd7cz.js → onboard-dfr9j762.js} +25 -15
  111. package/dist/{openai-codex-responses-jzxkta9b.js → openai-codex-responses-pgvtddvv.js} +3 -3
  112. package/dist/{openai-responses-m3g43rrt.js → openai-responses-9dyzwzkr.js} +9 -9
  113. package/dist/{opencode-adapter-yjyqynzf.js → opencode-adapter-f1zby94p.js} +3 -3
  114. package/dist/{otel-impl-dq4f2k3m.js → otel-impl-and31m5s.js} +5 -5
  115. package/dist/{pi-mono-adapter-e5v9w0hv.js → pi-mono-adapter-fx6k5wwh.js} +38 -27
  116. package/dist/{pricing-refresh-kmk7j1ra.js → pricing-refresh-23zr6j3w.js} +10 -10
  117. package/dist/{rbac-roles-9ykx9tc5.js → rbac-roles-nc7k9d0t.js} +10 -10
  118. package/dist/{rbac-roles-9w1dkkxd.js → rbac-roles-wnx35x4x.js} +11 -11
  119. package/dist/{render-v2-ycqm53np.js → render-v2-81cg1y52.js} +9 -9
  120. package/dist/{resume-cq2pkp8q.js → resume-d4b6j2n2.js} +16 -16
  121. package/dist/{setup-0dcmdvbn.js → setup-g68r1w28.js} +7 -5
  122. package/dist/static-t1gr2cr7.js +30 -0
  123. package/dist/{virtual-modules-1x9k4jcs.js → virtual-modules-rdjmcg7q.js} +3 -3
  124. package/dist/{work-objects-x01x2fh8.js → work-objects-0zzdnbt9.js} +35 -33
  125. package/dist/{worker-py1ssb1h.js → worker-p1g8qm6h.js} +48 -46
  126. package/dist/{x-ma4gnfgy.js → x-qfmygqqv.js} +2 -2
  127. package/openapi.json +3382 -167
  128. package/package.json +3 -3
  129. package/src/be/db/agents.ts +6 -0
  130. package/src/be/db/instance-signals.ts +30 -0
  131. package/src/be/db/tasks/read.ts +2 -0
  132. package/src/be/db/tasks/write.ts +39 -5
  133. package/src/be/db/workflow-runs.ts +22 -0
  134. package/src/be/db.ts +96 -40
  135. package/src/be/fleet-benchmark-stats.ts +39 -0
  136. package/src/be/migrations/205_favorites_per_dashboard_user.sql +29 -0
  137. package/src/be/migrations/206_runtime_pools.sql +62 -0
  138. package/src/be/migrations/207_runtime_session_tokens.sql +31 -0
  139. package/src/be/migrations/208_task_runtime_dispatch.sql +4 -0
  140. package/src/be/model-tier-resolution.ts +9 -2
  141. package/src/be/multi-runtime.ts +102 -13
  142. package/src/be/org-profile.ts +35 -0
  143. package/src/be/rbac-audit.ts +4 -0
  144. package/src/be/runtime-pools/controllers.ts +150 -0
  145. package/src/be/runtime-pools/db.ts +526 -0
  146. package/src/be/runtime-pools/demand.ts +65 -0
  147. package/src/be/runtime-pools/e2b-images.ts +109 -0
  148. package/src/be/runtime-pools/errors.ts +8 -0
  149. package/src/be/runtime-pools/lifecycle.ts +44 -0
  150. package/src/be/runtime-pools/reachability.ts +30 -0
  151. package/src/be/runtime-pools/recovery.ts +248 -0
  152. package/src/be/runtime-pools/remote-controller.ts +144 -0
  153. package/src/be/runtime-pools/routing.ts +304 -0
  154. package/src/be/runtime-pools/seed.ts +110 -0
  155. package/src/be/runtime-pools/supervisor.ts +981 -0
  156. package/src/be/runtime-pools/tokens.ts +57 -0
  157. package/src/be/scripts/typecheck.ts +48 -3
  158. package/src/be/secret-registry.ts +17 -1
  159. package/src/be/skill-usage.ts +467 -0
  160. package/src/be/swarm-config-guard.ts +59 -2
  161. package/src/be/telemetry-enable.ts +66 -0
  162. package/src/be/telemetry-ingest-anchor.ts +77 -0
  163. package/src/be/users.ts +173 -23
  164. package/src/be/worker-nudge-listener.ts +28 -0
  165. package/src/be/worker-nudges.ts +22 -0
  166. package/src/cli.tsx +22 -3
  167. package/src/commands/controller.ts +180 -0
  168. package/src/commands/onboard/non-interactive.ts +36 -12
  169. package/src/commands/onboard/types.ts +1 -1
  170. package/src/commands/onboard.tsx +3 -0
  171. package/src/commands/push-delivery.ts +230 -0
  172. package/src/commands/runner.ts +560 -276
  173. package/src/e2b/dispatch.ts +15 -1
  174. package/src/extensions/contract-types.generated.ts +1 -1
  175. package/src/fleet-benchmark.ts +157 -0
  176. package/src/heartbeat/heartbeat.ts +53 -135
  177. package/src/hooks/hook.ts +3 -2
  178. package/src/http/agents.ts +21 -0
  179. package/src/http/all-routes.ts +6 -0
  180. package/src/http/apps.ts +4 -2
  181. package/src/http/auth.ts +4 -7
  182. package/src/http/config.ts +58 -21
  183. package/src/http/controllers-connect.ts +206 -0
  184. package/src/http/core.ts +108 -14
  185. package/src/http/favorite-owner.ts +31 -1
  186. package/src/http/fleet-benchmark.ts +206 -0
  187. package/src/http/index.ts +38 -6
  188. package/src/http/mcp.ts +3 -8
  189. package/src/http/poll.ts +31 -2
  190. package/src/http/realtime.ts +1 -1
  191. package/src/http/request-principal.ts +2 -0
  192. package/src/http/runtime-pools.ts +527 -0
  193. package/src/http/session-data.ts +2 -0
  194. package/src/http/sessions.ts +100 -23
  195. package/src/http/skills.ts +173 -0
  196. package/src/http/status.ts +25 -1
  197. package/src/http/tasks.ts +14 -1
  198. package/src/http/telemetry-ui.ts +102 -0
  199. package/src/http/used-by.ts +140 -0
  200. package/src/http/utils.ts +7 -1
  201. package/src/http/workflows.ts +10 -2
  202. package/src/jira/app.ts +1 -2
  203. package/src/kv-reserved-namespaces.ts +1 -0
  204. package/src/linear/app.ts +1 -2
  205. package/src/providers/acp-target-catalog.ts +75 -1
  206. package/src/providers/acp-targets.ts +114 -0
  207. package/src/providers/amp-adapter.ts +1 -1
  208. package/src/providers/claude-adapter.ts +1 -1
  209. package/src/providers/codex-adapter.ts +5 -1
  210. package/src/providers/opencode-adapter.ts +2 -1
  211. package/src/providers/pi-mono-adapter.ts +41 -26
  212. package/src/providers/pricing-sources.md +2 -0
  213. package/src/providers/skill-invoke.ts +39 -3
  214. package/src/rbac/legacy-policy.ts +8 -0
  215. package/src/rbac/permissions.ts +16 -0
  216. package/src/rbac/types.ts +2 -0
  217. package/src/realtime/auth.ts +13 -0
  218. package/src/realtime/channels.ts +24 -0
  219. package/src/realtime/transport.ts +94 -15
  220. package/src/realtime/worker-client.ts +176 -0
  221. package/src/runtime-providers/controller-protocol.ts +97 -0
  222. package/src/runtime-providers/controller.ts +86 -0
  223. package/src/runtime-providers/docker.ts +235 -0
  224. package/src/runtime-providers/e2b.ts +217 -0
  225. package/src/runtime-providers/index.ts +37 -0
  226. package/src/runtime-providers/static.ts +26 -0
  227. package/src/runtime-providers/types.ts +92 -0
  228. package/src/runtime-providers/worker-api-url.ts +11 -0
  229. package/src/scripts-runtime/sdk-allowlist.ts +6 -0
  230. package/src/scripts-runtime/types/stdlib.d.ts +15 -0
  231. package/src/scripts-runtime/types/swarm-extension.d.ts +1 -0
  232. package/src/scripts-runtime/types/swarm-sdk.d.ts +15 -0
  233. package/src/server.ts +12 -0
  234. package/src/slack/router.ts +7 -5
  235. package/src/tasks/worker-follow-up.ts +80 -52
  236. package/src/telemetry-context.ts +6 -0
  237. package/src/telemetry-contract/EVENTS.md +14 -1
  238. package/src/telemetry-contract/SOURCE.json +4 -4
  239. package/src/telemetry-contract/catalog.json +155 -0
  240. package/src/telemetry-contract/types.gen.ts +248 -4
  241. package/src/telemetry-ui-events.ts +130 -0
  242. package/src/telemetry.ts +43 -3
  243. package/src/tests/acp-adapter.test.ts +129 -0
  244. package/src/tests/claude-adapter.test.ts +6 -2
  245. package/src/tests/codex-adapter.test.ts +6 -2
  246. package/src/tests/config-internal-keys.test.ts +27 -0
  247. package/src/tests/config-session-auth.test.ts +19 -3
  248. package/src/tests/db-retention.test.ts +50 -10
  249. package/src/tests/docs-index-footprint.test.js +3 -3
  250. package/src/tests/e2b-dispatch.test.ts +28 -1
  251. package/src/tests/e2e-runtime-pools.test.ts +51 -0
  252. package/src/tests/entrypoint-acp-target-binary.test.ts +38 -1
  253. package/src/tests/favorites.test.ts +188 -0
  254. package/src/tests/fetch-resolved-env.test.ts +59 -1
  255. package/src/tests/fleet-benchmark.test.ts +453 -0
  256. package/src/tests/harness-model-support.test.ts +70 -2
  257. package/src/tests/heartbeat-orphan-resume.test.ts +24 -0
  258. package/src/tests/heartbeat-reboot-live.test.ts +31 -0
  259. package/src/tests/heartbeat-supersede-resume.test.ts +21 -0
  260. package/src/tests/hook-runtime-close.test.ts +64 -0
  261. package/src/tests/http-task-write-ownership.test.ts +8 -1
  262. package/src/tests/integration-disable-flags.test.ts +45 -0
  263. package/src/tests/migration-206-runtime-pools.test.ts +134 -0
  264. package/src/tests/migration-207-runtime-session-tokens.test.ts +45 -0
  265. package/src/tests/migration-208-task-runtime-dispatch.test.ts +30 -0
  266. package/src/tests/multi-runtime-registration.test.ts +219 -4
  267. package/src/tests/onboard-non-interactive.test.ts +104 -6
  268. package/src/tests/opencode-adapter.test.ts +6 -2
  269. package/src/tests/org-website.test.ts +115 -0
  270. package/src/tests/pi-mono-adapter.test.ts +74 -10
  271. package/src/tests/rbac-admission-e2e.test.ts +4 -4
  272. package/src/tests/rbac-engine.test.ts +8 -1
  273. package/src/tests/realtime-room-auth.test.ts +49 -0
  274. package/src/tests/repo-allow-merge-gate.test.ts +8 -1
  275. package/src/tests/runner-exit-after-tasks.test.ts +163 -0
  276. package/src/tests/runner-finish-retry.test.ts +466 -0
  277. package/src/tests/runner-harness-telemetry-env.test.ts +105 -0
  278. package/src/tests/runner-push-delivery.test.ts +670 -0
  279. package/src/tests/runner-slot-reconcile.test.ts +89 -1
  280. package/src/tests/runtime-child-token-cleanup.test.ts +172 -0
  281. package/src/tests/runtime-controller-token.test.ts +254 -0
  282. package/src/tests/runtime-demand.test.ts +119 -0
  283. package/src/tests/runtime-e2b-pools.test.ts +847 -0
  284. package/src/tests/runtime-pool-reachability.test.ts +328 -0
  285. package/src/tests/runtime-pool-routing.test.ts +817 -0
  286. package/src/tests/runtime-pools-db.test.ts +275 -0
  287. package/src/tests/runtime-pools-http.test.ts +506 -0
  288. package/src/tests/runtime-pools-ownership-guards.test.ts +235 -0
  289. package/src/tests/runtime-pools-seed.test.ts +203 -0
  290. package/src/tests/runtime-pools-test-utils.ts +128 -0
  291. package/src/tests/runtime-provider-registration.test.ts +133 -0
  292. package/src/tests/runtime-providers-docker.test.ts +400 -0
  293. package/src/tests/runtime-providers-e2b-transport.test.ts +50 -0
  294. package/src/tests/runtime-providers-e2b.test.ts +335 -0
  295. package/src/tests/runtime-recovery.test.ts +745 -0
  296. package/src/tests/runtime-remote-controller.test.ts +846 -0
  297. package/src/tests/runtime-supervisor-failures.test.ts +387 -0
  298. package/src/tests/runtime-supervisor.test.ts +1039 -0
  299. package/src/tests/runtime-token-auth.test.ts +897 -0
  300. package/src/tests/script-connections.test.ts +7 -0
  301. package/src/tests/secret-scrubber.test.ts +17 -2
  302. package/src/tests/session-costs-codex-recompute.test.ts +49 -0
  303. package/src/tests/session-tokens.test.ts +13 -3
  304. package/src/tests/skill-invoke.test.ts +142 -0
  305. package/src/tests/skill-usage-cohorts.test.ts +232 -0
  306. package/src/tests/skill-usage.test.ts +348 -0
  307. package/src/tests/slack-attachments-block.test.ts +23 -0
  308. package/src/tests/slack-render-v2.test.ts +6 -0
  309. package/src/tests/status-instance.test.ts +71 -0
  310. package/src/tests/task-supersede-resume.test.ts +87 -4
  311. package/src/tests/telemetry-enable.test.ts +113 -0
  312. package/src/tests/telemetry-ui-route.test.ts +195 -0
  313. package/src/tests/tool-annotations.test.ts +1 -1
  314. package/src/tests/used-by-route.test.ts +237 -0
  315. package/src/tests/worker-nudges.test.ts +653 -0
  316. package/src/tests/worker-realtime-client.test.ts +188 -0
  317. package/src/tests/workflow-sub-workflow.test.ts +22 -0
  318. package/src/tools/app-upsert.ts +1 -1
  319. package/src/tools/runtime-controller-list.ts +28 -0
  320. package/src/tools/runtime-pool-bind-agent.ts +29 -0
  321. package/src/tools/runtime-pool-common.ts +37 -0
  322. package/src/tools/runtime-pool-create-agent.ts +29 -0
  323. package/src/tools/runtime-pool-delete.ts +27 -0
  324. package/src/tools/runtime-pool-list.ts +27 -0
  325. package/src/tools/runtime-pool-upsert.ts +31 -0
  326. package/src/tools/script-common.ts +1 -1
  327. package/src/tools/send-task.ts +3 -2
  328. package/src/tools/tool-config.ts +6 -0
  329. package/src/types.ts +137 -2
  330. package/src/utils/config-secrets.ts +1 -0
  331. package/src/utils/lead-monitor-channels.ts +3 -0
  332. package/src/utils/org-website.ts +104 -0
  333. package/src/utils/request-auth-context.ts +10 -2
  334. package/src/utils/runtime-pools-flag.ts +11 -0
  335. package/src/utils/secret-scrubber.ts +9 -0
  336. package/src/utils/session-token-connections.ts +20 -0
  337. package/templates/skills/apps/content.md +1 -1
  338. package/templates/skills/code-quality/content.md +9 -1
  339. package/templates/skills/db-query-guidance/content.md +9 -0
  340. package/templates/skills/swarm-scripts/SKILL.md +1 -1
  341. package/templates/skills/swarm-scripts/content.md +1 -1
  342. package/templates/skills/work-on-task/SKILL.md +1 -1
  343. package/templates/skills/work-on-task/content.md +1 -1
  344. package/dist/{cli-qd97v6z2.js → cli-1qtgd1h1.js} +3 -3
  345. package/dist/{cli-cmxkbzzs.js → cli-j0w59p15.js} +6 -6
  346. package/dist/{google-generative-ai-b8zxrpax.js → google-generative-ai-pvhm0dq1.js} +1 -1
  347. package/dist/{google-vertex-nrdd697t.js → google-vertex-tek9sqe2.js} +4 -4
  348. package/dist/{mistral-conversations-059y51zt.js → mistral-conversations-rjxa9s1j.js} +3 -3
  349. package/dist/{openai-completions-663yncfq.js → openai-completions-44gb0zsk.js} +12 -12
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ALL_TOOLS,
3
3
  init_tool_config
4
- } from "./cli-3qhyh31j.js";
4
+ } from "./cli-ywm1azg9.js";
5
5
  import {
6
6
  AgentAvatarSchema,
7
7
  CreateTaskOptionsSchema,
@@ -22,7 +22,7 @@ import {
22
22
  normalizeAssetKey,
23
23
  parseAssetKey,
24
24
  parseModelTier
25
- } from "./cli-xvdgasgy.js";
25
+ } from "./cli-hsem16hb.js";
26
26
  import {
27
27
  IdentityFieldBudgetError,
28
28
  checkIdentityFieldBudget,
@@ -36,7 +36,7 @@ import {
36
36
  init_profile_sync,
37
37
  matchesDefaultClaudeMd,
38
38
  matchesDefaultIdentityMd
39
- } from "./cli-jv36y8wz.js";
39
+ } from "./cli-rrbctenq.js";
40
40
  import {
41
41
  init_steering_enabled,
42
42
  isSteeringEnabled
@@ -76,10 +76,6 @@ import {
76
76
  getOpenRouterAttributionHeaders,
77
77
  init_openrouter_base_url
78
78
  } from "./cli-a35hzdve.js";
79
- import {
80
- init_env_flag,
81
- isEnvFlagEnabled
82
- } from "./cli-ej6gbxfb.js";
83
79
  import {
84
80
  harnessModelMismatch,
85
81
  init_runtime_model_catalog,
@@ -103,18 +99,22 @@ import {
103
99
  import {
104
100
  init_package,
105
101
  package_default
106
- } from "./cli-m23r88re.js";
102
+ } from "./cli-erbp6b4g.js";
107
103
  import {
108
104
  init_bus,
109
105
  realtimeBus
110
106
  } from "./cli-zf8jjwex.js";
107
+ import {
108
+ init_env_flag,
109
+ isEnvFlagEnabled
110
+ } from "./cli-ej6gbxfb.js";
111
111
  import {
112
112
  init_secret_scrubber,
113
113
  registerSensitiveKeyName,
114
114
  registerVolatileSecret,
115
115
  scrubObject,
116
116
  scrubSecrets
117
- } from "./cli-wt7ccy4r.js";
117
+ } from "./cli-d161g69q.js";
118
118
  import {
119
119
  __commonJS,
120
120
  __esm,
@@ -8597,6 +8597,15 @@ var init_catalog = __esm(() => {
8597
8597
  "system",
8598
8598
  "other"
8599
8599
  ]
8600
+ },
8601
+ popup: {
8602
+ type: "string",
8603
+ description: "Dashboard pop-up that a popup.* event is about.",
8604
+ enum: [
8605
+ "feedback",
8606
+ "org_name",
8607
+ "used_by"
8608
+ ]
8600
8609
  }
8601
8610
  },
8602
8611
  common_properties: {
@@ -9721,6 +9730,10 @@ var init_catalog = __esm(() => {
9721
9730
  key: {
9722
9731
  type: "string",
9723
9732
  required: true
9733
+ },
9734
+ email_domain: {
9735
+ type: "string",
9736
+ description: "Domain of the email typed into the item, never the address."
9724
9737
  }
9725
9738
  }
9726
9739
  },
@@ -9800,6 +9813,148 @@ var init_catalog = __esm(() => {
9800
9813
  }
9801
9814
  }
9802
9815
  },
9816
+ {
9817
+ product: "agent-swarm",
9818
+ event: "popup.shown",
9819
+ description: "A dashboard pop-up was shown. Telemetry-gated: never sent while telemetry is off.",
9820
+ since: "2026-10-12",
9821
+ source: "ui",
9822
+ properties: {
9823
+ popup: {
9824
+ ref: "popup",
9825
+ required: true
9826
+ },
9827
+ trigger: {
9828
+ type: "string",
9829
+ required: true,
9830
+ enum: [
9831
+ "task_failed",
9832
+ "tasks_completed",
9833
+ "workflow_completed",
9834
+ "quarterly",
9835
+ "missing_org_name"
9836
+ ],
9837
+ description: "Rule that made the pop-up eligible."
9838
+ }
9839
+ }
9840
+ },
9841
+ {
9842
+ product: "agent-swarm",
9843
+ event: "popup.dismissed",
9844
+ description: "A dashboard pop-up was closed without submitting.",
9845
+ since: "2026-10-12",
9846
+ source: "ui",
9847
+ properties: {
9848
+ popup: {
9849
+ ref: "popup",
9850
+ required: true
9851
+ },
9852
+ method: {
9853
+ type: "string",
9854
+ required: true,
9855
+ enum: [
9856
+ "later",
9857
+ "close",
9858
+ "escape"
9859
+ ]
9860
+ }
9861
+ }
9862
+ },
9863
+ {
9864
+ product: "agent-swarm",
9865
+ event: "popup.submitted",
9866
+ description: "A dashboard pop-up was submitted. Content stays out of telemetry: only flags for what was filled.",
9867
+ since: "2026-10-12",
9868
+ source: "ui",
9869
+ properties: {
9870
+ popup: {
9871
+ ref: "popup",
9872
+ required: true
9873
+ },
9874
+ score: {
9875
+ type: "integer",
9876
+ minimum: 0,
9877
+ description: "Feedback pop-up only: the 0-10 score. /v1/feedback enforces the upper bound."
9878
+ },
9879
+ has_message: {
9880
+ type: "boolean",
9881
+ required: true
9882
+ },
9883
+ has_contact: {
9884
+ type: "boolean",
9885
+ required: true,
9886
+ description: "A name or email was left. The values go to /v1/feedback, never here."
9887
+ }
9888
+ }
9889
+ },
9890
+ {
9891
+ product: "agent-swarm",
9892
+ event: "org.profile_updated",
9893
+ description: "An admin changed the org profile. Lists which fields changed, never their values.",
9894
+ since: "2026-10-12",
9895
+ source: "ui",
9896
+ properties: {
9897
+ fields: {
9898
+ type: "array",
9899
+ required: true,
9900
+ description: "Changed field names: name, website."
9901
+ },
9902
+ surface: {
9903
+ type: "string",
9904
+ required: true,
9905
+ enum: [
9906
+ "prompt",
9907
+ "setup",
9908
+ "settings"
9909
+ ],
9910
+ description: "Where the change was made. Not trigger_surface: that key fills the raw_events.trigger_surface column."
9911
+ }
9912
+ }
9913
+ },
9914
+ {
9915
+ product: "agent-swarm",
9916
+ event: "used_by.consent_changed",
9917
+ description: 'An admin granted or revoked the "used by" logo consent. The request itself goes to /v1/used-by.',
9918
+ since: "2026-10-12",
9919
+ source: "ui",
9920
+ properties: {
9921
+ granted: {
9922
+ type: "boolean",
9923
+ required: true
9924
+ }
9925
+ }
9926
+ },
9927
+ {
9928
+ product: "agent-swarm",
9929
+ event: "telemetry.enabled",
9930
+ description: "Telemetry was turned on. Sent once, on the first boot or re-init after opting in.",
9931
+ since: "2026-10-12",
9932
+ source: "api-server",
9933
+ properties: {
9934
+ via: {
9935
+ type: "string",
9936
+ required: true,
9937
+ enum: [
9938
+ "banner",
9939
+ "settings",
9940
+ "env"
9941
+ ]
9942
+ }
9943
+ }
9944
+ },
9945
+ {
9946
+ product: "agent-swarm",
9947
+ event: "fleet_benchmark.viewed",
9948
+ description: "The fleet benchmark card was shown.",
9949
+ since: "2026-10-12",
9950
+ source: "ui",
9951
+ properties: {
9952
+ has_org_name: {
9953
+ type: "boolean",
9954
+ required: true
9955
+ }
9956
+ }
9957
+ },
9803
9958
  {
9804
9959
  product: "agent-fs",
9805
9960
  event: "server.started",
@@ -9955,6 +10110,7 @@ function buildContext(input) {
9955
10110
  const userId = input.actor?.userId?.trim();
9956
10111
  const orgName = input.orgName?.trim();
9957
10112
  const orgDomain = validOrgDomain(input.orgDomain);
10113
+ const orgWebsite = validOrgDomain(input.orgWebsite);
9958
10114
  return {
9959
10115
  org_id: input.orgId,
9960
10116
  org_name: orgName ? orgName : null,
@@ -9966,7 +10122,8 @@ function buildContext(input) {
9966
10122
  swarm_version: input.swarmVersion,
9967
10123
  install_method: input.installMethod ?? null,
9968
10124
  install_preset: input.installPreset ?? null,
9969
- acquisition_source: input.acquisitionSource ?? null
10125
+ acquisition_source: input.acquisitionSource ?? null,
10126
+ ...orgWebsite ? { org_website: orgWebsite } : {}
9970
10127
  };
9971
10128
  }
9972
10129
  function catalogSpecs(event) {
@@ -10007,6 +10164,87 @@ var init_telemetry_context = __esm(() => {
10007
10164
  ORG_DOMAIN_PATTERN = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/;
10008
10165
  });
10009
10166
 
10167
+ // src/utils/org-website.ts
10168
+ function normalizeOrgWebsite(raw) {
10169
+ let value = raw?.trim().toLowerCase();
10170
+ if (!value)
10171
+ return null;
10172
+ if (!/^[a-z][a-z0-9+.-]*:\/\//.test(value))
10173
+ value = `https://${value}`;
10174
+ let host;
10175
+ try {
10176
+ const url = new URL(value);
10177
+ if (url.protocol !== "http:" && url.protocol !== "https:")
10178
+ return null;
10179
+ if (url.username || url.password)
10180
+ return null;
10181
+ host = url.hostname;
10182
+ } catch {
10183
+ return null;
10184
+ }
10185
+ host = host.replace(/\.$/, "");
10186
+ if (host.startsWith("www."))
10187
+ host = host.slice(4);
10188
+ if (!host || host.length > 253)
10189
+ return null;
10190
+ if (host.startsWith("[") || IPV4.test(host))
10191
+ return null;
10192
+ const labels = host.split(".");
10193
+ if (labels.length < 2)
10194
+ return null;
10195
+ if (!labels.every((label) => label.length <= 63 && LABEL.test(label)))
10196
+ return null;
10197
+ if (/^\d+$/.test(labels.at(-1) ?? ""))
10198
+ return null;
10199
+ if (BLOCKED_SUFFIXES.some((suffix) => host.endsWith(suffix)))
10200
+ return null;
10201
+ return host;
10202
+ }
10203
+ function orgLogoUrl(host, origin = TELEMETRY_PROXY_ORIGIN) {
10204
+ return `${origin.replace(/\/+$/, "")}/v1/logo?domain=${encodeURIComponent(host)}`;
10205
+ }
10206
+ function isFilledOrgLogoUrl(url, origin = TELEMETRY_PROXY_ORIGIN) {
10207
+ if (!url)
10208
+ return false;
10209
+ try {
10210
+ const parsed = new URL(url);
10211
+ return parsed.origin === new URL(origin).origin && parsed.pathname === "/v1/logo" && parsed.searchParams.has("domain");
10212
+ } catch {
10213
+ return false;
10214
+ }
10215
+ }
10216
+ var LABEL, IPV4, BLOCKED_SUFFIXES, TELEMETRY_PROXY_ORIGIN = "https://proxy.desplega.sh", FREE_MAIL_DOMAINS;
10217
+ var init_org_website = __esm(() => {
10218
+ LABEL = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
10219
+ IPV4 = /^\d{1,3}(\.\d{1,3}){3}$/;
10220
+ BLOCKED_SUFFIXES = [".local", ".internal", ".localhost", ".lan", ".home", ".test"];
10221
+ FREE_MAIL_DOMAINS = new Set([
10222
+ "gmail.com",
10223
+ "googlemail.com",
10224
+ "outlook.com",
10225
+ "hotmail.com",
10226
+ "live.com",
10227
+ "msn.com",
10228
+ "yahoo.com",
10229
+ "icloud.com",
10230
+ "me.com",
10231
+ "mac.com",
10232
+ "aol.com",
10233
+ "proton.me",
10234
+ "protonmail.com",
10235
+ "gmx.com",
10236
+ "gmx.de",
10237
+ "yandex.com",
10238
+ "yandex.ru",
10239
+ "mail.com",
10240
+ "zoho.com",
10241
+ "qq.com",
10242
+ "163.com",
10243
+ "hey.com",
10244
+ "fastmail.com"
10245
+ ]);
10246
+ });
10247
+
10010
10248
  // src/utils/request-auth-context.ts
10011
10249
  import { AsyncLocalStorage } from "node:async_hooks";
10012
10250
  function beginRequestAuthScope() {
@@ -10041,6 +10279,9 @@ var init_request_auth_context = __esm(() => {
10041
10279
 
10042
10280
  // src/telemetry.ts
10043
10281
  import { randomUUID } from "node:crypto";
10282
+ function setTelemetryIngestObserver(observer) {
10283
+ ingestObserver = observer;
10284
+ }
10044
10285
  function isTelemetryEnabled() {
10045
10286
  return isEnvFlagEnabled("ANONYMIZED_TELEMETRY", true);
10046
10287
  }
@@ -10228,7 +10469,13 @@ function getTelemetryEnvironment() {
10228
10469
  ;
10229
10470
  return "production";
10230
10471
  }
10231
- function emit(event, properties, metadata, actor) {
10472
+ function track(options) {
10473
+ emit(options.event, options.properties, options.metadata, options.actor);
10474
+ }
10475
+ function trackRelayed(event, properties, options) {
10476
+ emit(event, properties, undefined, options.actor, options.emitter);
10477
+ }
10478
+ function emit(event, properties, metadata, actor, emitter = source) {
10232
10479
  if (!isTelemetryEnabled() || !installationId)
10233
10480
  return;
10234
10481
  maybeRefreshOrgIdentity();
@@ -10236,6 +10483,8 @@ function emit(event, properties, metadata, actor) {
10236
10483
  if (!orgId)
10237
10484
  return;
10238
10485
  try {
10486
+ const occurredAt = new Date().toISOString();
10487
+ const sentFor = installationId;
10239
10488
  const isCloud = cachedIsCloud || isCloudDeployment();
10240
10489
  const orgIdentity = getOrgIdentity();
10241
10490
  const userId = actor?.userId?.trim() || undefined;
@@ -10243,14 +10492,15 @@ function emit(event, properties, metadata, actor) {
10243
10492
  schema_version: 2,
10244
10493
  product: PRODUCT,
10245
10494
  event,
10246
- occurred_at: new Date().toISOString(),
10247
- source,
10495
+ occurred_at: occurredAt,
10496
+ source: emitter,
10248
10497
  actor_mode: "anonymous",
10249
10498
  actor_anonymous_id: installationId,
10250
10499
  context: buildContext({
10251
10500
  orgId,
10252
10501
  orgName: orgIdentity.organization_name,
10253
10502
  orgDomain: cachedOrgDomain,
10503
+ orgWebsite: normalizeOrgWebsite(process.env.SWARM_ORG_WEBSITE),
10254
10504
  installationId,
10255
10505
  actor: userId ? { userId, role: actor?.role ?? roleResolver?.(userId) ?? null } : undefined,
10256
10506
  isCloud,
@@ -10286,6 +10536,9 @@ function emit(event, properties, metadata, actor) {
10286
10536
  headers: { "Content-Type": "application/json" },
10287
10537
  body: JSON.stringify(payload),
10288
10538
  signal: AbortSignal.timeout(TIMEOUT_MS)
10539
+ }).then((response) => {
10540
+ if (response.ok)
10541
+ ingestObserver?.({ installationId: sentFor, occurredAt });
10289
10542
  }).catch(() => {});
10290
10543
  } catch {}
10291
10544
  }
@@ -10300,12 +10553,13 @@ function emitIntegrationConnected(type, providerSlug, firstOfType) {
10300
10553
  }, { userId: getCurrentRequestUserId() ?? null });
10301
10554
  return true;
10302
10555
  }
10303
- var TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events", PRODUCT = "agent-swarm", TIMEOUT_MS = 5000, installationId = null, installedAt = null, cachedOrgId, cachedOrgDomain, roleResolver = null, identityReloader = null, lastIdentityLoadAt = 0, source = "unknown", cachedIsCloud = false, cachedIsE2b = false, cachedHasEmbedding = false, cachedHasSlackChannel = false, cachedHasEmailChannel = false, cachedInstallMethod = "manual", cachedInstallPreset, CLOUD_HOST_EXACT, CLOUD_HOST_SUFFIXES, KNOWN_INSTALL_METHODS, KNOWN_INSTALL_PRESETS, KNOWN_INTEGRATION_TYPES, INTEGRATION_PROVIDERS, ORG_IDENTITY_RETRY_MS = 60000, ORG_IDENTITY_REFRESH_MS, telemetry;
10556
+ var TELEMETRY_ENDPOINT = "https://proxy.desplega.sh/v1/events", PRODUCT = "agent-swarm", TIMEOUT_MS = 5000, installationId = null, installedAt = null, ingestObserver = null, cachedOrgId, cachedOrgDomain, roleResolver = null, identityReloader = null, lastIdentityLoadAt = 0, source = "unknown", cachedIsCloud = false, cachedIsE2b = false, cachedHasEmbedding = false, cachedHasSlackChannel = false, cachedHasEmailChannel = false, cachedInstallMethod = "manual", cachedInstallPreset, CLOUD_HOST_EXACT, CLOUD_HOST_SUFFIXES, KNOWN_INSTALL_METHODS, KNOWN_INSTALL_PRESETS, KNOWN_INTEGRATION_TYPES, INTEGRATION_PROVIDERS, ORG_IDENTITY_RETRY_MS = 60000, ORG_IDENTITY_REFRESH_MS, telemetry;
10304
10557
  var init_telemetry = __esm(() => {
10305
10558
  init_package();
10306
10559
  init_config();
10307
10560
  init_telemetry_context();
10308
10561
  init_env_flag();
10562
+ init_org_website();
10309
10563
  init_request_auth_context();
10310
10564
  CLOUD_HOST_EXACT = new Set([
10311
10565
  "agent-swarm-mcp.desplega.sh",
@@ -12118,7 +12372,7 @@ var init_runtime = __esm(() => {
12118
12372
  // src/telemetry-identity.ts
12119
12373
  async function loadUserRole(userId) {
12120
12374
  try {
12121
- const { getUserGrant } = await import("./rbac-roles-9ykx9tc5.js");
12375
+ const { getUserGrant } = await import("./rbac-roles-nc7k9d0t.js");
12122
12376
  const grant = await getUserGrant(userId);
12123
12377
  const role = grant.grantsAll ? "admin" : "member";
12124
12378
  if (roleCache.size >= ROLE_CACHE_LIMIT) {
@@ -12278,6 +12532,10 @@ var init_codex_auth_failure = __esm(() => {
12278
12532
  ];
12279
12533
  });
12280
12534
 
12535
+ // src/utils/config-secrets.ts
12536
+ var MASKED_SECRET_VALUE = "********";
12537
+ var init_config_secrets = () => {};
12538
+
12281
12539
  // src/utils/github-pull-request.ts
12282
12540
  function parseGitHubPullRequestToken(token) {
12283
12541
  const candidate = token.replace(TRAILING_PROSE_PUNCTUATION_RE, "");
@@ -12396,6 +12654,14 @@ var init_heartbeat_expiry = __esm(() => {
12396
12654
  };
12397
12655
  });
12398
12656
 
12657
+ // src/utils/runtime-pools-flag.ts
12658
+ function isRuntimePoolsEnabled(env2 = process.env) {
12659
+ return isEnvFlagEnabled("RUNTIME_POOLS_ENABLED", false, env2);
12660
+ }
12661
+ var init_runtime_pools_flag = __esm(() => {
12662
+ init_env_flag();
12663
+ });
12664
+
12399
12665
  // src/be/date-utils.ts
12400
12666
  function normalizeDate(date) {
12401
12667
  if (date == null)
@@ -12436,6 +12702,9 @@ function rowToAgent(row, slim = false) {
12436
12702
  name: row.name,
12437
12703
  isLead: row.isLead === 1,
12438
12704
  status: row.status,
12705
+ runtimePoolId: row.runtime_pool_id ?? null,
12706
+ runtimeProvisionAttempts: row.runtime_provision_attempts ?? 0,
12707
+ runtimeProvisionRetryAt: row.runtime_provision_retry_at ?? null,
12439
12708
  description: row.description ?? undefined,
12440
12709
  role: row.role ?? undefined,
12441
12710
  capabilities: row.capabilities ? JSON.parse(row.capabilities) : [],
@@ -13106,6 +13375,7 @@ function rowToAgentTask(row) {
13106
13375
  routingReason: row.routing_reason ?? undefined,
13107
13376
  routingSource: row.routing_source ?? undefined,
13108
13377
  routingNote: row.routing_note ?? undefined,
13378
+ poolWakeAt: row.pool_wake_at ?? undefined,
13109
13379
  taskType: row.taskType ?? undefined,
13110
13380
  tags: row.tags ? JSON.parse(row.tags) : [],
13111
13381
  priority: row.priority ?? 50,
@@ -13839,6 +14109,52 @@ var init_task_lifecycle_events = __esm(() => {
13839
14109
  taskStartedHandlers = [];
13840
14110
  });
13841
14111
 
14112
+ // src/realtime/channels.ts
14113
+ function channelTopic(namespace, name) {
14114
+ return `channel:${JSON.stringify([namespace, name])}`;
14115
+ }
14116
+ function addWorkerSubscription(agentId, subscriber) {
14117
+ const subscribers = workerSubscribers.get(agentId) ?? new Set;
14118
+ subscribers.add(subscriber);
14119
+ workerSubscribers.set(agentId, subscribers);
14120
+ }
14121
+ function removeWorkerSubscription(agentId, subscriber) {
14122
+ const subscribers = workerSubscribers.get(agentId);
14123
+ subscribers?.delete(subscriber);
14124
+ if (subscribers?.size === 0)
14125
+ workerSubscribers.delete(agentId);
14126
+ }
14127
+ function listSubscribedWorkerAgents() {
14128
+ return [...workerSubscribers.keys()];
14129
+ }
14130
+ var workerSubscribers;
14131
+ var init_channels = __esm(() => {
14132
+ workerSubscribers = new Map;
14133
+ });
14134
+
14135
+ // src/be/worker-nudges.ts
14136
+ function publishWorkerNudge(agentId, nudge) {
14137
+ if (!isRuntimePoolsEnabled())
14138
+ return;
14139
+ realtimeBus.publish(channelTopic(`worker:${agentId}`, "nudge"), {
14140
+ v: 1,
14141
+ ...nudge,
14142
+ at: new Date().toISOString()
14143
+ });
14144
+ }
14145
+ function publishWorkerConfigNudge(scope, scopeId) {
14146
+ if (!isRuntimePoolsEnabled())
14147
+ return;
14148
+ const agents = scope === "agent" ? scopeId ? [scopeId] : [] : listSubscribedWorkerAgents();
14149
+ for (const agentId of agents)
14150
+ publishWorkerNudge(agentId, { kind: "config" });
14151
+ }
14152
+ var init_worker_nudges = __esm(() => {
14153
+ init_bus();
14154
+ init_channels();
14155
+ init_runtime_pools_flag();
14156
+ });
14157
+
13842
14158
  // src/be/db/tasks/write.ts
13843
14159
  function configureTaskWriteDependencies(value) {
13844
14160
  dependencies3 = value;
@@ -13917,10 +14233,10 @@ async function getPendingTaskForAgent(agentId) {
13917
14233
  }
13918
14234
  return null;
13919
14235
  }
13920
- async function assignUnassignedTaskPending(taskId, agentId) {
14236
+ async function assignUnassignedTaskPending(taskId, agentId, options = {}) {
13921
14237
  {
13922
- const task = await getTaskById(taskId);
13923
- const agent = await getAgentById(agentId);
14238
+ const task = options.routingSnapshot?.task ?? await getTaskById(taskId);
14239
+ const agent = options.routingSnapshot?.agent ?? await getAgentById(agentId);
13924
14240
  if (task && (!agent || !isAgentEligibleForTask(agent, task))) {
13925
14241
  try {
13926
14242
  await dependencies3.createLogEntry({
@@ -13939,8 +14255,22 @@ async function assignUnassignedTaskPending(taskId, agentId) {
13939
14255
  }
13940
14256
  }
13941
14257
  const now = new Date().toISOString();
13942
- const row = await getDbClient().get(`UPDATE agent_tasks SET agentId = ?, status = 'pending', lastUpdatedAt = ?
13943
- WHERE id = ? AND status = 'unassigned' RETURNING *`, [agentId, now, taskId]);
14258
+ const snapshot = options.routingSnapshot;
14259
+ const guards = snapshot ? ` AND lastUpdatedAt = ?
14260
+ AND EXISTS (SELECT 1 FROM agents WHERE id = ? AND lastUpdatedAt = ?
14261
+ AND (SELECT COUNT(*) FROM agent_tasks WHERE agentId = agents.id
14262
+ AND status IN ('pending', 'in_progress')) < COALESCE(maxTasks, 1))` : "";
14263
+ const poolGuard = snapshot?.pool ? ` AND EXISTS (SELECT 1 FROM runtime_pools WHERE id = ? AND updated_at = ?
14264
+ AND enabled = 1 AND (circuit_open_until IS NULL OR circuit_open_until <= ?))` : "";
14265
+ const row = await getDbClient().get(`UPDATE agent_tasks SET agentId = ?, status = 'pending', lastUpdatedAt = ?, pool_wake_at = ?
14266
+ WHERE id = ? AND status = 'unassigned'${guards}${poolGuard} RETURNING *`, [
14267
+ agentId,
14268
+ now,
14269
+ options.poolWakeAt ?? null,
14270
+ taskId,
14271
+ ...snapshot ? [snapshot.task.lastUpdatedAt, agentId, snapshot.agent.lastUpdatedAt] : [],
14272
+ ...snapshot?.pool ? [snapshot.pool.id, snapshot.pool.updatedAt, options.poolWakeAt ?? now] : []
14273
+ ]);
13944
14274
  if (row) {
13945
14275
  try {
13946
14276
  await dependencies3.createLogEntry({
@@ -13952,6 +14282,7 @@ async function assignUnassignedTaskPending(taskId, agentId) {
13952
14282
  metadata: { pendingDispatch: true }
13953
14283
  });
13954
14284
  } catch {}
14285
+ getDbClient().afterCommit(() => publishWorkerNudge(agentId, { kind: "work", taskId }));
13955
14286
  }
13956
14287
  return row ? rowToAgentTask(row) : null;
13957
14288
  }
@@ -14077,7 +14408,7 @@ async function completeTask(id, output, options) {
14077
14408
  });
14078
14409
  } catch {}
14079
14410
  getDbClient().afterCommit(() => {
14080
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
14411
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
14081
14412
  workflowEventBus.emit("task.completed", {
14082
14413
  taskId: id,
14083
14414
  output: scrubbedOutput,
@@ -14132,7 +14463,7 @@ async function failTask(id, reason, opts = {}) {
14132
14463
  });
14133
14464
  } catch {}
14134
14465
  getDbClient().afterCommit(() => {
14135
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
14466
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
14136
14467
  workflowEventBus.emit("task.failed", {
14137
14468
  taskId: id,
14138
14469
  failureReason: scrubbedReason,
@@ -14189,6 +14520,13 @@ async function cancelTask(id, reason) {
14189
14520
  const row = await getDbClient().get(`UPDATE agent_tasks SET status = 'cancelled', failureReason = ?, finishedAt = ?, lastUpdatedAt = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
14190
14521
  WHERE id = ? AND status NOT IN ('completed', 'failed', 'cancelled', 'superseded') RETURNING *`, [cancelReason, finishedAt, id]);
14191
14522
  if (row && oldTask) {
14523
+ const recipients = new Set([row.agentId, row.offeredTo]);
14524
+ getDbClient().afterCommit(() => {
14525
+ for (const agentId of recipients) {
14526
+ if (agentId)
14527
+ publishWorkerNudge(agentId, { kind: "cancel", taskId: id });
14528
+ }
14529
+ });
14192
14530
  dependencies3.emitTaskLifecycleTelemetryAfterCommit("cancelled", {
14193
14531
  taskId: id,
14194
14532
  source: oldTask.source,
@@ -14207,7 +14545,7 @@ async function cancelTask(id, reason) {
14207
14545
  });
14208
14546
  } catch {}
14209
14547
  getDbClient().afterCommit(() => {
14210
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
14548
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
14211
14549
  workflowEventBus.emit("task.cancelled", {
14212
14550
  taskId: id,
14213
14551
  agentId: row.agentId,
@@ -14264,7 +14602,7 @@ async function supersedeTask(id, args) {
14264
14602
  });
14265
14603
  } catch {}
14266
14604
  getDbClient().afterCommit(() => {
14267
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
14605
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
14268
14606
  workflowEventBus.emit("task.superseded", {
14269
14607
  taskId: id,
14270
14608
  reason: args.reason,
@@ -14476,7 +14814,7 @@ async function updateTaskProgress(id, progress) {
14476
14814
  });
14477
14815
  } catch {}
14478
14816
  getDbClient().afterCommit(() => {
14479
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
14817
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
14480
14818
  workflowEventBus.emit("task.progress", {
14481
14819
  taskId: id,
14482
14820
  progress: scrubbedProgress,
@@ -14494,6 +14832,7 @@ var init_write = __esm(() => {
14494
14832
  init_types();
14495
14833
  init_secret_scrubber();
14496
14834
  init_task_lifecycle_events();
14835
+ init_worker_nudges();
14497
14836
  init_agents();
14498
14837
  init_runtime();
14499
14838
  init_human_free();
@@ -14507,6 +14846,13 @@ async function getChildWorkflowRunId(parentStepId) {
14507
14846
  const row = await getDbClient().get("SELECT id FROM workflow_runs WHERE parentStepId = ?", [parentStepId]);
14508
14847
  return row?.id ?? null;
14509
14848
  }
14849
+ async function getWorkflowRunParent(parentStepId) {
14850
+ const row = await getDbClient().get(`SELECT s.runId AS runId, r.workflowId AS workflowId, s.id AS stepId, s.nodeId AS nodeId
14851
+ FROM workflow_run_steps s
14852
+ JOIN workflow_runs r ON r.id = s.runId
14853
+ WHERE s.id = ?`, [parentStepId]);
14854
+ return row ?? null;
14855
+ }
14510
14856
  async function getWorkflowRunLineage(runId, maxDepth) {
14511
14857
  const rows = await getDbClient().query(`WITH RECURSIVE lineage(id, workflowId, parentStepId, depth) AS (
14512
14858
  SELECT id, workflowId, parentStepId, 0 FROM workflow_runs WHERE id = ?
@@ -14539,7 +14885,7 @@ function emitChildRunFinished(childRunId, parentStepId, status) {
14539
14885
  }
14540
14886
  function emitAfterCommit(childRunId, parentStepId) {
14541
14887
  getDbClient().afterCommit(() => {
14542
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
14888
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
14543
14889
  workflowEventBus.emit("workflow.child.finished", { childRunId, parentStepId });
14544
14890
  }).catch((err) => console.error("[db] workflow.child.finished event not emitted:", scrubSecrets(err instanceof Error ? err.message : String(err))));
14545
14891
  });
@@ -14704,7 +15050,8 @@ function isInternalConfigKey(key) {
14704
15050
  return INTERNAL_CONFIG_KEYS.has(key.toLowerCase());
14705
15051
  }
14706
15052
  function internalConfigKeyError(key) {
14707
- return new Error(`Key '${key}' is managed by /api/onboarding`);
15053
+ const owner = key.toLowerCase() === "runtime_owner_id" ? "the runtime supervisor" : "/api/onboarding";
15054
+ return new Error(`Key '${key}' is managed by ${owner}`);
14708
15055
  }
14709
15056
  function isReservedConfigKey(key) {
14710
15057
  return RESERVED_KEYS.has(key.toUpperCase());
@@ -14796,19 +15143,24 @@ function validateFloatRange(key, value, min, max, expectation) {
14796
15143
  }
14797
15144
  return null;
14798
15145
  }
15146
+ function validateRuntimeTokenTtlHours(value) {
15147
+ const hours = Number(value);
15148
+ return typeof value === "string" && Number.isFinite(hours) && hours > 0 && hours <= 168 ? null : "Invalid RUNTIME_TOKEN_TTL_HOURS (must be greater than zero and at most 168)";
15149
+ }
14799
15150
  function validateConfigValue(key, value) {
14800
15151
  if (isTierConfigKey(key))
14801
15152
  return validateTierConfigValue(key.toUpperCase(), value);
14802
15153
  const validator = VALIDATED_KEYS[key.toUpperCase()];
14803
15154
  return validator ? validator(value) : null;
14804
15155
  }
14805
- var RESERVED_KEYS, INTERNAL_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, VALIDATED_KEYS;
15156
+ var RESERVED_KEYS, INTERNAL_CONFIG_KEYS, BOOLEAN_LITERALS, MAX_DB_RETENTION_DAYS = 1e6, DB_RETENTION_TUNING_BOUNDS, validateControllerTokenTtlDays, validateControllerGraceSec, VALIDATED_KEYS;
14806
15157
  var init_swarm_config_guard = __esm(() => {
14807
15158
  init_quickjs_pool_config();
14808
15159
  init_reaction_shortcode();
14809
15160
  init_types();
14810
15161
  init_api_drain();
14811
15162
  init_enabled_tools();
15163
+ init_org_website();
14812
15164
  init_task_tool_manifest();
14813
15165
  init_model_tier_keys();
14814
15166
  RESERVED_KEYS = new Set([
@@ -14817,14 +15169,37 @@ var init_swarm_config_guard = __esm(() => {
14817
15169
  "CORS_ALLOW_ANY_ORIGIN",
14818
15170
  "EXTENSION_ALLOW_LEAD_ACTIVATION"
14819
15171
  ]);
14820
- INTERNAL_CONFIG_KEYS = new Set(["onboarding_state"]);
15172
+ INTERNAL_CONFIG_KEYS = new Set(["onboarding_state", "runtime_owner_id"]);
14821
15173
  BOOLEAN_LITERALS = ["true", "false", "1", "0"];
14822
15174
  DB_RETENTION_TUNING_BOUNDS = {
14823
15175
  DB_RETENTION_TICK_BUDGET_MS: { min: 1000, max: 300000 },
14824
15176
  DB_RETENTION_CATCHUP_INTERVAL_MS: { min: 5000, max: 3600000 },
14825
15177
  DB_RETENTION_MAX_STATEMENT_MS: { min: 25, max: 5000 }
14826
15178
  };
15179
+ validateControllerTokenTtlDays = boundedIntegerValidators(["RUNTIME_CONTROLLER_TOKEN_TTL_DAYS"], 1, 3650).RUNTIME_CONTROLLER_TOKEN_TTL_DAYS;
15180
+ validateControllerGraceSec = boundedIntegerValidators(["RUNTIME_CONTROLLER_GRACE_SEC"], 0, 86400).RUNTIME_CONTROLLER_GRACE_SEC;
14827
15181
  VALIDATED_KEYS = {
15182
+ ...booleanValidators(["RUNTIME_POOLS_ENABLED"]),
15183
+ ...enumValidator("RUNTIME_DEFAULT_DELIVERY", ["poll", "push"]),
15184
+ RUNTIME_TOKEN_TTL_HOURS: validateRuntimeTokenTtlHours,
15185
+ RUNTIME_CONTROLLER_TOKEN_TTL_DAYS: validateControllerTokenTtlDays,
15186
+ RUNTIME_CONTROLLER_GRACE_SEC: validateControllerGraceSec,
15187
+ ...integerValidators([
15188
+ "RUNTIME_SUPERVISOR_INTERVAL_MS",
15189
+ "RUNTIME_PROVISION_TIMEOUT_SEC",
15190
+ "RUNTIME_PROVISION_CONCURRENCY",
15191
+ "RUNTIME_PER_TASK_EXIT_GRACE_SEC",
15192
+ "RUNTIME_PROVISION_MAX_ATTEMPTS",
15193
+ "RUNTIME_CIRCUIT_THRESHOLD",
15194
+ "RUNTIME_CIRCUIT_OPEN_MIN",
15195
+ "RUNTIME_TOKEN_ROTATE_BEFORE_MIN",
15196
+ "RUNTIME_LEASE_RENEW_BEFORE_SEC",
15197
+ "RUNTIME_E2B_BUILD_TIMEOUT_SEC",
15198
+ "RUNTIME_ROTATE_BEFORE_SEC",
15199
+ "E2B_MAX_CONTINUOUS_SEC"
15200
+ ], 1),
15201
+ ...integerValidators(["RUNTIME_SOCKET_GRACE_SEC"], 0),
15202
+ ...integerValidators(["RUNTIME_WAKE_GRACE_SEC", "RUNTIME_WAKE_REROUTE_SEC", "RUNTIME_ROUTING_INTERVAL_MS"], 0),
14828
15203
  TASK_TOOL_MANIFESTS: (value) => {
14829
15204
  try {
14830
15205
  if (typeof value !== "string")
@@ -14900,7 +15275,12 @@ var init_swarm_config_guard = __esm(() => {
14900
15275
  }
14901
15276
  return null;
14902
15277
  },
15278
+ SWARM_ORG_WEBSITE: (value) => {
15279
+ const str2 = String(value).trim();
15280
+ return str2 === "" || normalizeOrgWebsite(str2) === str2 ? null : "Invalid SWARM_ORG_WEBSITE (must be a public hostname such as example.com, without scheme, www, path or port)";
15281
+ },
14903
15282
  ...booleanValidators([
15283
+ "SWARM_USED_BY_CONSENT",
14904
15284
  "SWARM_DEV_MODE",
14905
15285
  "MULTI_RUNTIME_ENABLED",
14906
15286
  "STEERING_ENABLED",
@@ -15014,7 +15394,7 @@ async function listStoredConfigSecrets() {
15014
15394
  }
15015
15395
  return { secrets, failed };
15016
15396
  }
15017
- var init_config_secrets = __esm(() => {
15397
+ var init_config_secrets2 = __esm(() => {
15018
15398
  init_crypto();
15019
15399
  init_swarm_config_guard();
15020
15400
  init_runtime();
@@ -16166,7 +16546,13 @@ function registerStoredSecret(value, name) {
16166
16546
  registerVolatileSecret(form, name);
16167
16547
  }
16168
16548
  async function loadSecretRegistry() {
16169
- const result = { config: 0, oauth: 0, scriptApi: 0, failed: 0 };
16549
+ const result = {
16550
+ config: 0,
16551
+ oauth: 0,
16552
+ scriptApi: 0,
16553
+ runtimeController: 0,
16554
+ failed: 0
16555
+ };
16170
16556
  try {
16171
16557
  const { secrets, failed } = await listStoredConfigSecrets();
16172
16558
  for (const { key, value } of secrets)
@@ -16195,11 +16581,19 @@ async function loadSecretRegistry() {
16195
16581
  } catch {
16196
16582
  result.failed += 1;
16197
16583
  }
16584
+ try {
16585
+ const { loadRuntimeControllerSecrets } = await import("./db-2rmd23wq.js");
16586
+ const loaded = await loadRuntimeControllerSecrets();
16587
+ result.runtimeController = loaded.count;
16588
+ result.failed += loaded.failed;
16589
+ } catch {
16590
+ result.failed += 1;
16591
+ }
16198
16592
  return result;
16199
16593
  }
16200
16594
  var init_secret_registry = __esm(() => {
16201
16595
  init_secret_scrubber();
16202
- init_config_secrets();
16596
+ init_config_secrets2();
16203
16597
  init_oauth();
16204
16598
  init_db();
16205
16599
  });
@@ -17928,6 +18322,11 @@ async function createSteeringMessage(args) {
17928
18322
  ]);
17929
18323
  if (!row)
17930
18324
  throw new Error("Failed to create steering message");
18325
+ getDbClient().afterCommit(async () => {
18326
+ const task = await getTaskById(args.taskId);
18327
+ if (task?.agentId)
18328
+ publishWorkerNudge(task.agentId, { kind: "steer", taskId: args.taskId });
18329
+ });
17931
18330
  try {
17932
18331
  await createLogEntry({
17933
18332
  eventType: "task_steering",
@@ -18466,7 +18865,7 @@ async function createTaskExtended(task, options) {
18466
18865
  priority: row.priority
18467
18866
  }, (task2) => task2 !== null, row.requestedByUserId);
18468
18867
  getDbClient().afterCommit(() => {
18469
- import("./event-bus-vnfthafg.js").then(({ workflowEventBus }) => {
18868
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => {
18470
18869
  workflowEventBus.emit("task.created", {
18471
18870
  taskId: row.id,
18472
18871
  task: row.task,
@@ -18521,15 +18920,21 @@ async function claimTask(taskId, agentId) {
18521
18920
  }
18522
18921
  return result;
18523
18922
  }
18524
- async function releaseTask(taskId) {
18525
- const task = await getTaskById(taskId);
18923
+ async function releaseTask(taskId, wakeSnapshot) {
18924
+ const task = wakeSnapshot ?? await getTaskById(taskId);
18526
18925
  if (!task)
18527
18926
  return null;
18528
18927
  if (task.status !== "pending" && task.status !== "in_progress")
18529
18928
  return null;
18530
18929
  const now = new Date().toISOString();
18531
- const row = await getDbClient().get(`UPDATE agent_tasks SET agentId = NULL, status = 'unassigned', lastUpdatedAt = ?
18532
- WHERE id = ? AND status IN ('pending', 'in_progress') RETURNING *`, [now, taskId]);
18930
+ const row = await getDbClient().get(`UPDATE agent_tasks SET agentId = NULL, status = 'unassigned', lastUpdatedAt = ?, pool_wake_at = NULL
18931
+ WHERE id = ? AND status IN ('pending', 'in_progress')
18932
+ ${wakeSnapshot ? "AND status = 'pending' AND agentId = ? AND pool_wake_at = ? AND COALESCE(routing_reason, '') != 'human_pinned'" : ""}
18933
+ RETURNING *`, [
18934
+ now,
18935
+ taskId,
18936
+ ...wakeSnapshot ? [wakeSnapshot.agentId ?? null, wakeSnapshot.poolWakeAt ?? null] : []
18937
+ ]);
18533
18938
  if (row) {
18534
18939
  try {
18535
18940
  await createLogEntry({
@@ -18540,6 +18945,10 @@ async function releaseTask(taskId) {
18540
18945
  newValue: "unassigned"
18541
18946
  });
18542
18947
  } catch {}
18948
+ if (isRuntimePoolsEnabled() && !wakeSnapshot)
18949
+ getDbClient().afterCommit(() => {
18950
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error2) => console.error("[db] Routing event failed:", scrubSecrets(String(error2))));
18951
+ });
18543
18952
  }
18544
18953
  return row ? rowToAgentTask(row) : null;
18545
18954
  }
@@ -18580,6 +18989,7 @@ async function acceptTask(taskId, agentId) {
18580
18989
  newValue: "pending"
18581
18990
  });
18582
18991
  } catch {}
18992
+ getDbClient().afterCommit(() => publishWorkerNudge(agentId, { kind: "work", taskId }));
18583
18993
  }
18584
18994
  return row ? rowToAgentTask(row) : null;
18585
18995
  }
@@ -18592,7 +19002,7 @@ async function rejectTask(taskId, agentId, reason) {
18592
19002
  const now = new Date().toISOString();
18593
19003
  const row = await getDbClient().get(`UPDATE agent_tasks SET
18594
19004
  status = 'unassigned', offeredTo = NULL, offeredAt = NULL,
18595
- rejectionReason = ?, lastUpdatedAt = ?
19005
+ rejectionReason = ?, lastUpdatedAt = ?, pool_wake_at = NULL
18596
19006
  WHERE id = ? AND status IN ('offered', 'reviewing') RETURNING *`, [reason ?? null, now, taskId]);
18597
19007
  if (row) {
18598
19008
  try {
@@ -18605,6 +19015,10 @@ async function rejectTask(taskId, agentId, reason) {
18605
19015
  metadata: reason ? { reason } : undefined
18606
19016
  });
18607
19017
  } catch {}
19018
+ if (isRuntimePoolsEnabled())
19019
+ getDbClient().afterCommit(() => {
19020
+ import("./event-bus-vjtv82gm.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error2) => console.error("[db] Routing event failed:", scrubSecrets(String(error2))));
19021
+ });
18608
19022
  }
18609
19023
  return row ? rowToAgentTask(row) : null;
18610
19024
  }
@@ -18697,15 +19111,23 @@ async function releaseStaleReviewingTasks(timeoutMinutes = 30) {
18697
19111
  WHERE status = 'reviewing' AND lastUpdatedAt < ?`, [now, cutoffTime]);
18698
19112
  return result.changes;
18699
19113
  }
18700
- async function releaseStaleOfferedTasksForOfflineAgents() {
19114
+ async function releaseStaleOfferedTasksForOfflineAgents(isReachable) {
18701
19115
  const now = new Date().toISOString();
19116
+ const reachable = [];
19117
+ if (isRuntimePoolsEnabled() && isReachable) {
19118
+ for (const agent of await getAllAgents()) {
19119
+ if (agent.status === "offline" && await isReachable(agent))
19120
+ reachable.push(agent.id);
19121
+ }
19122
+ }
18702
19123
  const result = await getDbClient().run(`UPDATE agent_tasks
18703
19124
  SET status = 'unassigned', offeredTo = NULL, offeredAt = NULL, lastUpdatedAt = ?
18704
19125
  WHERE status = 'offered'
18705
19126
  AND offeredTo IS NOT NULL
19127
+ ${reachable.length ? `AND offeredTo NOT IN (${reachable.map(() => "?").join(",")})` : ""}
18706
19128
  AND NOT EXISTS (
18707
19129
  SELECT 1 FROM agents WHERE agents.id = agent_tasks.offeredTo AND agents.status != 'offline'
18708
- )`, [now]);
19130
+ )`, [now, ...reachable]);
18709
19131
  return result.changes;
18710
19132
  }
18711
19133
  async function getOfferedTasksForAgent(agentId) {
@@ -19048,6 +19470,11 @@ async function postMessage(channelId, agentId, content, options) {
19048
19470
  targetMentions = parentMessage.mentions;
19049
19471
  }
19050
19472
  }
19473
+ getDbClient().afterCommit(() => {
19474
+ for (const mentionedAgentId of new Set(targetMentions)) {
19475
+ publishWorkerNudge(mentionedAgentId, { kind: "work" });
19476
+ }
19477
+ });
19051
19478
  if (isTaskMessage && targetMentions.length > 0) {
19052
19479
  const sender = agentId ? await getAgentById(agentId) : null;
19053
19480
  const channel = await getChannelById(channelId);
@@ -19503,7 +19930,7 @@ function rowToSessionCost(row) {
19503
19930
  };
19504
19931
  }
19505
19932
  async function createSessionCost(input) {
19506
- const id = crypto.randomUUID();
19933
+ const id = input.id ?? crypto.randomUUID();
19507
19934
  const costSource = input.costSource ?? "harness";
19508
19935
  const reasoningOutputTokens = input.reasoningOutputTokens ?? 0;
19509
19936
  const thinkingTokens = input.thinkingTokens ?? 0;
@@ -19516,7 +19943,8 @@ async function createSessionCost(input) {
19516
19943
  costSource, harnessCostUsd, cacheWrite5mTokens, cacheWrite1hTokens,
19517
19944
  modelBreakdown, createdAt
19518
19945
  )
19519
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`, [
19946
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
19947
+ ON CONFLICT(id) DO NOTHING`, [
19520
19948
  id,
19521
19949
  input.sessionId,
19522
19950
  input.taskId ?? null,
@@ -19538,29 +19966,12 @@ async function createSessionCost(input) {
19538
19966
  input.cacheWrite1hTokens ?? null,
19539
19967
  input.modelBreakdown ? JSON.stringify(input.modelBreakdown) : null
19540
19968
  ]);
19541
- return {
19542
- id,
19543
- sessionId: input.sessionId,
19544
- taskId: input.taskId,
19545
- agentId: input.agentId,
19546
- totalCostUsd: input.totalCostUsd,
19547
- inputTokens: input.inputTokens ?? 0,
19548
- outputTokens: input.outputTokens ?? 0,
19549
- cacheReadTokens: input.cacheReadTokens ?? 0,
19550
- cacheWriteTokens: input.cacheWriteTokens ?? 0,
19551
- reasoningOutputTokens,
19552
- thinkingTokens,
19553
- durationMs: input.durationMs,
19554
- numTurns: input.numTurns,
19555
- model: input.model,
19556
- isError: input.isError ?? false,
19557
- costSource,
19558
- harnessCostUsd: input.harnessCostUsd ?? null,
19559
- cacheWrite5mTokens: input.cacheWrite5mTokens ?? null,
19560
- cacheWrite1hTokens: input.cacheWrite1hTokens ?? null,
19561
- modelBreakdown: input.modelBreakdown ?? null,
19562
- createdAt: new Date().toISOString()
19563
- };
19969
+ const row = await getDbClient().get("SELECT * FROM session_costs WHERE id = ?", [
19970
+ id
19971
+ ]);
19972
+ if (!row)
19973
+ throw new Error("Session cost record is missing after insertion.");
19974
+ return rowToSessionCost(row);
19564
19975
  }
19565
19976
  async function getSessionCostsByTaskId(taskId, limit2 = 500) {
19566
19977
  const rows = await getDbClient().query("SELECT * FROM session_costs WHERE taskId = ? ORDER BY createdAt DESC LIMIT ?", [taskId, limit2]);
@@ -20257,8 +20668,11 @@ async function updateScheduledTask(id, data) {
20257
20668
  return row ? rowToScheduledTask(row) : null;
20258
20669
  }
20259
20670
  async function deleteScheduledTask(id) {
20260
- const result = await getDbClient().run("DELETE FROM scheduled_tasks WHERE id = ?", [id]);
20261
- return result.changes > 0;
20671
+ return await getDbClient().transaction(async (tx) => {
20672
+ await tx.run("DELETE FROM user_favorites WHERE itemType = 'schedule' AND itemId = ?", [id]);
20673
+ const result = await tx.run("DELETE FROM scheduled_tasks WHERE id = ?", [id]);
20674
+ return result.changes > 0;
20675
+ });
20262
20676
  }
20263
20677
  async function getDueScheduledTasks() {
20264
20678
  const now = new Date().toISOString();
@@ -20346,7 +20760,7 @@ function autoEncryptLegacyPlaintextSecrets(database, dbPath, options = {}) {
20346
20760
  console.log(`[secrets] Auto-migrated ${rows.length} secret(s) to encrypted storage.`);
20347
20761
  }
20348
20762
  function maskSecrets(configs) {
20349
- return configs.map((c) => c.isSecret ? { ...c, value: "********" } : c);
20763
+ return configs.map((c) => c.isSecret ? { ...c, value: MASKED_SECRET_VALUE } : c);
20350
20764
  }
20351
20765
  function writeEnvFile(configs) {
20352
20766
  const { readFileSync: readFileSync3, writeFileSync: writeFileSync2 } = __require("node:fs");
@@ -20474,6 +20888,7 @@ async function upsertSwarmConfig(data) {
20474
20888
  registerStoredSecret(config.value, configSecretName(config.key));
20475
20889
  registerSensitiveKeyName(config.key);
20476
20890
  }
20891
+ getDbClient().afterCommit(() => publishWorkerConfigNudge(config.scope, config.scopeId));
20477
20892
  return config;
20478
20893
  }
20479
20894
  async function emitBuiltInIntegrationConnectedOnce(provider) {
@@ -20487,8 +20902,10 @@ async function emitBuiltInIntegrationConnectedOnce(provider) {
20487
20902
  } catch {}
20488
20903
  }
20489
20904
  async function deleteSwarmConfig(id) {
20490
- const result = await getDbClient().run("DELETE FROM swarm_config WHERE id = ?", [id]);
20491
- return result.changes > 0;
20905
+ const row = await getDbClient().get("DELETE FROM swarm_config WHERE id = ? RETURNING scope, scopeId", [id]);
20906
+ if (row)
20907
+ getDbClient().afterCommit(() => publishWorkerConfigNudge(row.scope, row.scopeId));
20908
+ return row !== null;
20492
20909
  }
20493
20910
  async function deleteSwarmConfigByKey(scope, scopeId, key) {
20494
20911
  const resolvedScopeId = scope === "global" ? null : scopeId;
@@ -20497,7 +20914,7 @@ async function deleteSwarmConfigByKey(scope, scopeId, key) {
20497
20914
  return false;
20498
20915
  return await deleteSwarmConfig(existing.id);
20499
20916
  }
20500
- async function getResolvedConfig(agentId, repoId) {
20917
+ async function getResolvedConfig(agentId, repoId, options = {}) {
20501
20918
  const configMap = new Map;
20502
20919
  const globalConfigs = await getSwarmConfigs({ scope: "global" });
20503
20920
  for (const config of globalConfigs) {
@@ -20512,6 +20929,8 @@ async function getResolvedConfig(agentId, repoId) {
20512
20929
  if (repoId) {
20513
20930
  const repoConfigs = await getSwarmConfigs({ scope: "repo", scopeId: repoId });
20514
20931
  for (const config of repoConfigs) {
20932
+ if (config.isSecret && options.includeRepoSecrets === false)
20933
+ continue;
20515
20934
  configMap.set(config.key, config);
20516
20935
  }
20517
20936
  }
@@ -21003,6 +21422,7 @@ async function deleteWorkflowRows(id, source2) {
21003
21422
  await client.run(`DELETE FROM workflow_run_steps WHERE runId IN (SELECT id FROM workflow_runs WHERE workflowId = ?)`, [id]);
21004
21423
  await client.run("DELETE FROM workflow_runs WHERE workflowId = ?", [id]);
21005
21424
  await reclassifyTaskHumanFree(linkedTaskIds);
21425
+ await client.run("DELETE FROM user_favorites WHERE itemType = 'workflow' AND itemId = ?", [id]);
21006
21426
  const result = await client.run("DELETE FROM workflows WHERE id = ?", [id]);
21007
21427
  const deleted = result.changes > 0;
21008
21428
  if (deleted) {
@@ -21029,7 +21449,8 @@ function rowToWorkflowRun(row, view = "replay") {
21029
21449
  createdBy: row.created_by ?? undefined,
21030
21450
  startedAt: normalizeDateRequired(row.startedAt),
21031
21451
  lastUpdatedAt: normalizeDateRequired(row.lastUpdatedAt),
21032
- finishedAt: normalizeDate(row.finishedAt) ?? undefined
21452
+ finishedAt: normalizeDate(row.finishedAt) ?? undefined,
21453
+ parentStepId: row.parentStepId ?? undefined
21033
21454
  };
21034
21455
  return defineWorkflowPayload(run, "context", row.context, row.context_replay, view, {
21035
21456
  runId: row.id,
@@ -24523,12 +24944,14 @@ var init_db2 = __esm(() => {
24523
24944
  init_telemetry_trigger();
24524
24945
  init_types();
24525
24946
  init_codex_auth_failure();
24947
+ init_config_secrets();
24526
24948
  init_credentials();
24527
24949
  init_github_pull_request();
24528
24950
  init_heartbeat_expiry();
24529
24951
  init_identity_field_budget();
24530
24952
  init_model_rate_limit_windows();
24531
24953
  init_request_auth_context();
24954
+ init_runtime_pools_flag();
24532
24955
  init_secret_scrubber();
24533
24956
  init_subscription_plans();
24534
24957
  init_asset_key_audit();
@@ -24548,6 +24971,7 @@ var init_db2 = __esm(() => {
24548
24971
  init_steering();
24549
24972
  init_swarm_config_guard();
24550
24973
  init_task_lifecycle_events();
24974
+ init_worker_nudges();
24551
24975
  init_workflow_replay();
24552
24976
  init_active_sessions();
24553
24977
  init_agents();
@@ -25729,4 +26153,4 @@ function getMemoryStore() {
25729
26153
  var embeddingProvider2 = null, memoryStore = null;
25730
26154
  var init_memory = () => {};
25731
26155
 
25732
- export { slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, mapTriggerSurface, init_telemetry_context, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, getCurrentRequestUserId, init_request_auth_context, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, isTelemetryReady, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, init_templates3 as init_templates1, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, init_runtime, cachedUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey, isCodexAuthFailureReason, init_codex_auth_failure, HeartbeatExpiryError, init_heartbeat_expiry, normalizeDate, normalizeDateRequired, init_date_utils, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, EXTENSION_AGENT_ROLE, NOT_EXTENSION_AGENT_SQL, isExtensionAgent, extensionAgentAssignmentError, ReservedAgentRoleError, reservedRoleViolation, ExtensionAgentAssignmentError, getAllAgents, getAgentStatusCounts, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, getAgentDailyTaskCounts, listApprovalRequestSummaries, getPendingApprovalVoteState, recordApprovalVotes, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, getTaskById, getChildTasks, hasNonTerminalResumeChild, getSupersededTasksWithoutResume, getSupersededTasksWithUnsettledDependents, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, isLinearTrackerContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, onTaskStarted, init_task_lifecycle_events, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, recordTaskProviderIfUnset, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, settleSupersededTaskDependents, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, getChildWorkflowRunId, getWorkflowRunLineage, getSettledChildRunParentSteps, init_workflow_runs, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain, parseEnabledTools, init_enabled_tools, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateConfigValue, init_swarm_config_guard, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI, init_openai, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, resetEmbeddingProvider, getMemoryStore, init_memory, embeddingProvider, embedScript, searchScripts, reembedAllScripts, init_embeddings2 as init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, WorkflowReplayStateError, init_workflow_replay, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS, refreshActiveSessionOnActivity, recordKeySeatMismatch, getScriptRunExecutionArgs, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, isSettledSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getResolvableDeferralOutcomes, markSlackDeferralResolved, noteSlackOutcomeDeliveryFailure, abandonSlackOutcomeDelivery, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, listSlackThreadsAwaitingHuman, isSlackThreadAwaitingHuman, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdAndEventType, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, getCurrentStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelApprovalRequestById, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, getStaleApprovalRequests, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, setApiKeyPlan, markKeyRateLimited, recordKeyAuthFailure, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getReadyAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, kvPrefixUpperBound, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db2 as init_db1 };
26156
+ export { slackContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, getCurrentRequestUserId, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2 as init_templates, init_templates3 as init_templates1, isSqliteVecAvailable, resolveSqliteVecExtensionPath, __resetSqliteVecExtensionPathCacheForTests, initDb, getDb, closeDb, getDbClient, init_runtime, cachedUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, CODEX_AUTH_WATCH_NAMESPACE, codexAuthBenchMarkerKey, isCodexAuthFailureReason, init_codex_auth_failure, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState, updateAgentCredentialMissing, createAgent, getAgentById, EXTENSION_AGENT_ROLE, NOT_EXTENSION_AGENT_SQL, isExtensionAgent, extensionAgentAssignmentError, ReservedAgentRoleError, reservedRoleViolation, ExtensionAgentAssignmentError, getAllAgents, getAgentStatusCounts, getLeadAgent, updateAgentStatus, updateAgentMaxTasks, updateAgentProvider, setAgentHarnessProvider, updateAgentCredStatus, listAgentsWithCredStatusByProvider, getAgentHarnessProviders, updateAgentActivity, MAX_EMPTY_POLLS, incrementEmptyPollCount, resetEmptyPollCount, shouldBlockPolling, deleteAgent, getActiveTaskCount, hasCapacity, getRemainingCapacity, updateAgentStatusFromCapacity, isPoolAffinityEnforcementEnabled, buildRoutingAffinityFromAgent, isAgentEligibleForTask, getAgentDailyTaskCounts, init_agents, listApprovalRequestSummaries, getPendingApprovalVoteState, recordApprovalVotes, computeContentHash, createContextVersion, getLatestContextVersion, getContextVersion, getContextVersionHistory, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, rowToAgentTask, getTaskById, getChildTasks, hasNonTerminalResumeChild, getSupersededTasksWithoutResume, getSupersededTasksWithUnsettledDependents, hasNonTerminalRerouteDecisionChild, getTasksByAgentId, getAgentCurrentTask, getTasksByStatus, findTaskByVcs, findTaskByGitHub, getAllTasks, getTasksCount, getTaskStats, getCompletedSlackTasks, getPendingSlackRelayTasks, markSlackRelayAttempted, markSlackRelayDelivered, markFinalizedSlackRelaysDelivered, getRecentlyFinishedWorkerTasks, markTasksNotified, resetTasksNotified, getInProgressSlackTasks, getSlackTasksMissingTree, getInProgressTasksByContextKey, isLinearTrackerContextKey, findExistingLinearTrackerContextWork, getLatestTaskByContextKey, getLatestScriptRunStepTaskByContextKey, getAgentWorkingOnThread, getLatestActiveTaskInThread, getLatestLeadTaskInThread, getMostRecentTaskInThread, findCompletedTaskInThread, findRecentCancelledTaskInThread, init_read, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask, getPendingTaskForAgent, assignUnassignedTaskPending, startTask, updateTaskClaudeSessionId, recordTaskProviderIfUnset, updateTaskTitle, completeTask, failTask, overwriteTerminalTaskResultText, cancelTask, supersedeTask, settleSupersededTaskDependents, backfillSupersedeTaskResumeTaskId, pauseTask, resumeTask, getPausedTasksForAgent, getOrphanedInProgressTasksForAgent, resetOrphanedInProgressTasksForAgent, getRecentlyCancelledTasksForAgent, deleteTask, updateTaskProgress, getChildWorkflowRunId, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, init_workflow_runs, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain, parseEnabledTools, init_enabled_tools, parseTaskToolManifest, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, init_swarm_config_guard, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI, init_openai, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, rowToCandidate, init_sqlite_store, getEmbeddingProvider, resetEmbeddingProvider, getMemoryStore, init_memory, embeddingProvider, embedScript, searchScripts, reembedAllScripts, init_embeddings2 as init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, SteeringRequestError, isSteeringEnabled2 as isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, requestSteering, init_steering, WorkflowReplayStateError, init_workflow_replay, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS, refreshActiveSessionOnActivity, recordKeySeatMismatch, getScriptRunExecutionArgs, getSlackRenderV2ActivatedAt, ensureSlackRenderV2Activation, getSlackDelegationActivatedAt, ensureSlackDelegationActivation, isPendingSlackMessage, isSettledSlackMessage, recordSlackMessage, reserveSlackMessage, bindSlackMessageTimestamp, updateSlackMessageRecord, markSlackTreeRendered, deleteSlackMessageRecord, getSlackTreeMessage, getSlackTreeMessageByThread, getSlackOutcomeMessage, getResolvableDeferralOutcomes, markSlackDeferralResolved, noteSlackOutcomeDeliveryFailure, abandonSlackOutcomeDelivery, getSlackTreeMessages, getSlackMessageByChannelTs, getSlackTasksInThread, listSlackThreadsAwaitingHuman, isSlackThreadAwaitingHuman, markTaskSlackReplySent, setSlackMessageTracking, updateTaskVcs, insertTaskAttachment, recordTaskPullRequestAttachments, getAssetKeyMappingByProvider, upsertAssetKeyMapping, getAssetKeyMapping, listAssetSummaries, moveAssetKey, deleteTaskAttachment, replaceTaskAttachment, getTaskAttachments, createSteeringMessage, getSteeringMessagesForTask, getSteeringMessageById, getPendingSteeringForTask, getPendingSteeringForAgent, markSteeringDelivered, markSteeringHandled, markSteeringPromoted, cancelPendingSteeringForTask, hasPendingSteering, getAgentWithTasks, getAllAgentsWithTasks, createLogEntry, getLogsByAgentId, getLogsByTaskId, getLogsByTaskIdAndEventType, getLogsByTaskIdChronological, getLogsByEventType, getAllLogs, findRecentSimilarTasks, createTaskExtended, claimTask, releaseTask, acceptTask, rejectTask, moveTaskToBacklog, moveTaskFromBacklog, promoteDraftTask, refreshDraftTaskLease, promoteAbandonedDraftTasks, releaseStaleReviewingTasks, releaseStaleOfferedTasksForOfflineAgents, getOfferedTasksForAgent, claimOfferedTask, getUnassignedTasksCount, getUnassignedTaskIds, getUnassignedTaskIdsForAgent, checkDependencies, getDependentTasks, cascadeFailDependents, updateAgentProfile, updateAgentName, createChannel, getMessageById, getChannelById, getChannelByName, getAllChannels, deleteChannel, postMessage, getChannelMessages, updateReadState, getLastReadAt, getUnreadMessages, getMentionsForAgent, getInboxSummary, claimMentions, releaseMentionProcessing, releaseStaleMentionProcessing, createService, getServiceById, getServiceByAgentAndName, getServicesByAgentId, getAllServices, updateServiceStatus, deleteService, upsertService, deleteServicesByAgentId, createSessionLogs, getSessionLogsByTaskId, getSessionLogsBySession, createSessionCost, getSessionCostsByTaskId, getSessionCostsByAgentId, getAllSessionCosts, getSessionCostsFiltered, UNATTRIBUTED_USER_ID, getSessionCostSummary, getAttributionByPerson, getDashboardCostSummary, createInboxMessage, getInboxMessageById, getUnreadInboxMessages, claimInboxMessages, markInboxMessageRead, markInboxMessageResponded, markInboxMessageDelegated, releaseStaleProcessingInbox, getConcurrentContext, getScheduledTasks, getScheduledTaskById, getScheduledTaskByName, createScheduledTask, updateScheduledTask, deleteScheduledTask, getDueScheduledTasks, autoEncryptLegacyPlaintextSecrets, maskSecrets, getSwarmConfigs, getInjectableGlobalConfigs, getSwarmConfigById, getSwarmConfigLookupById, upsertSwarmConfig, emitBuiltInIntegrationConnectedOnce, deleteSwarmConfig, deleteSwarmConfigByKey, getResolvedConfig, getSwarmRepos, getSwarmRepoById, getSwarmRepoByName, getSwarmRepoByUrl, createSwarmRepo, updateSwarmRepo, deleteSwarmRepo, getAgentMailInboxMapping, getAgentMailInboxMappingsByAgent, getAllAgentMailInboxMappings, createAgentMailInboxMapping, deleteAgentMailInboxMapping, findTaskByAgentMailThread, insertActiveSession, deleteActiveSession, deleteActiveSessionById, getActiveSessions, heartbeatActiveSession, cleanupStaleSessions, cleanupAgentSessions, updateActiveSessionProviderSessionId, getActiveSessionForTask, reassociateSessionLogs, getStalledInProgressTasks, getStalePinnedResumes, failPendingResumeIfUnclaimed, getIdleWorkersWithCapacity, getUnassignedPoolTasks, getStaleUnassignedAffinityTasks, getRecentFailedTasks, getRecentCompletedCount, getRecentFailedCount, createWorkflow, getWorkflow, listWorkflows, updateWorkflow, deleteWorkflow, getWorkflowsByScheduleId, createWorkflowRun, getWorkflowRun, updateWorkflowRun, listWorkflowRuns, countWorkflowRuns, listWorkflowRunsPage, createWorkflowRunStep, getWorkflowRunStep, updateWorkflowRunStep, getWorkflowRunStepsByRunId, getStuckWorkflowRuns, getLastSuccessfulRun, getLastRunStart, getRetryableSteps, getCompletedStepNodeIds, getTaskByWorkflowRunStepId, detachTaskFromWorkflowRunStep, getStepByIdempotencyKey, getStepCountForNode, getLatestStepForNode, getCurrentStepForNode, createWorkflowVersion, getWorkflowVersions, getWorkflowVersion, createAppVersion, getAppVersions, getAppVersion, createPage, getPage, getPageBySlug, getLatestPageBySlug, listPagesByAgent, listAllPages, countAllPages, countPagesByAgent, updatePage, deletePage, incrementPageViewCount, createPageVersion, getPageVersions, getPageVersion, createMetric, getMetric, getMetricBySlug, listMetricsByAgent, listAllMetrics, countAllMetrics, countMetricsByAgent, updateMetric, deleteMetric, createMetricVersion, getMetricVersions, getMetricVersion, getPromptTemplates, getPromptTemplateById, upsertPromptTemplate, deletePromptTemplate, resetPromptTemplateToDefault, getPromptTemplateHistory, resolvePromptTemplate, checkoutPromptTemplate, getAllChannelActivityCursors, getChannelActivityCursor, upsertChannelActivityCursor, createApprovalRequest, getApprovalRequestById, resolveApprovalRequest, cancelApprovalRequestById, cancelPendingApprovalRequestsForRun, listCancelledApprovalRequestsForRun, listCancelledApprovalRequestsForStep, claimApprovalCancellationNotification, completeApprovalCancellationNotificationClaim, releaseApprovalCancellationNotificationClaim, updateApprovalRequestNotifications, listApprovalRequests, getStuckApprovalRuns, getApprovalRequestByStepId, getExpiredPendingApprovals, getStaleApprovalRequests, createWaitState, getWaitStateById, getWaitStateByStepId, getDueWaitStates, getPendingEventWaitNames, getPendingWaitsByEvent, resolveWaitState, getStuckWaitRuns, SKILL_FILE_LIMITS, normalizeSkillFilePath, createSkill, updateSkill, listSkillFileManifest, getSkillFiles, getSkillFile, upsertSkillFile, upsertSkillFiles, deleteSkillFile, deleteSkill, getSkillById, getSkillByName, listSkills, searchSkills, installSkill, getSystemDefaultSkills, installSystemDefaultSkillsForAgent, uninstallSkill, getAgentSkills, toggleAgentSkill, createMcpServer, emitMcpServerConnectedTelemetry, updateMcpServer, deleteMcpServer, getMcpServerById, getMcpServerByName, listMcpServers, installMcpServer, uninstallMcpServer, getAgentMcpServers, createContextSnapshot, getContextSnapshotsByTaskId, getContextSnapshotsBySessionId, getContextSummaryByTaskId, getAvailableKeyIndices, recordKeyUsage, setApiKeyPlan, markKeyRateLimited, recordKeyAuthFailure, recordKeyRateLimitWindows, setApiKeyName, clearKeyRateLimit, getKeyStatuses, getKeyCostSummary, getUserById, getAllUsers, createUser, updateUser, deleteUser, listInboxState, upsertInboxState, listFavorites, listUserFavorites, getFavoriteItemIdSet, setFavorite, setUserFavorite, withFavoriteFlags, listTaskTemplates, getRootTaskChain, listRecentSessions, countSessions, getBudget, getBudgets, upsertBudget, deleteBudget, getAllPricingRows, getPricingRows, getActivePricingRow, insertPricingRow, deletePricingRow, getDailySpendForAgent, getDailySpendGlobal, getDailySpendForUser, recordBudgetRefusalNotification, getBudgetRefusalNotification, getRecentBudgetRefusalNotifications, hasBudgetRefusalNotificationToday, setBudgetRefusalFollowUpTaskId, getLiveAgentCounts, getReadyAgentCounts, getInstanceActivity, getSwarmMetrics, hasFirstCompletedTask, getKv, sweepExpiredKv, sweepExpiredKvPrefix, upsertKv, claimKv, deleteKv, KvTypeCollisionError, incrKv, kvPrefixUpperBound, listKv, countKv, createScriptRun, recordInlineScriptRun, getScriptRun, getScriptRunByIdempotencyKey, listScriptRuns, countScriptRuns, countActiveScriptRuns, updateScriptRun, updateScriptRunIfNotTerminal, updateScriptRunIfRunning, getRunningScriptRuns, getScriptRunJournalStep, upsertScriptRunJournalStep, listScriptRunJournalSteps, countScriptRunJournalSteps, countScriptRunJournalAgentTaskSteps, exports_db, init_db2 as init_db1 };