@desplega.ai/agent-swarm 2.10.0 → 2.12.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 (572) hide show
  1. package/dist/acp-adapter-11m13kx4.js +16 -0
  2. package/dist/{acp-targets-arrwv4f0.js → acp-targets-311gcyvw.js} +9 -9
  3. package/dist/{actions-y0d2n1c2.js → actions-c4chgxp6.js} +27 -24
  4. package/dist/{agent-fs-provision-tpj7sktd.js → agent-fs-provision-0b9awm5n.js} +10 -5
  5. package/dist/{amp-adapter-vmmnmw8d.js → amp-adapter-r0veq6x5.js} +3 -3
  6. package/dist/{anthropic-messages-zdca3gv1.js → anthropic-messages-88b7s3n9.js} +177 -25
  7. package/dist/{app-wb7w45dq.js → app-hn5fftf5.js} +7 -6
  8. package/dist/{approval-notifications-7mqr6vbd.js → approval-notifications-3g6yc8nv.js} +7 -6
  9. package/dist/{assistant-gf60454p.js → assistant-cpjgpjvp.js} +29 -26
  10. package/dist/{azure-openai-responses-b3y7fz36.js → azure-openai-responses-jeaas6x0.js} +10 -10
  11. package/dist/{boot-args-schema-qxmd59sr.js → boot-args-schema-hce1av1h.js} +1 -1
  12. package/dist/{boot-reembed-5tmeskj2.js → boot-reembed-bztbxc4z.js} +1 -1
  13. package/dist/{boot-reembed-wb44vc3s.js → boot-reembed-d7xcym0j.js} +1 -1
  14. package/dist/{boot-scrub-sweep-25bxhnw4.js → boot-scrub-sweep-mkmm16gk.js} +2 -2
  15. package/dist/{boot-seeds-nj9za0vk.js → boot-seeds-arrkbe8t.js} +4 -4
  16. package/dist/{boxd-wn235q80.js → boxd-68n75y1s.js} +2 -2
  17. package/dist/{claude-adapter-d3krpdyb.js → claude-adapter-ykpyr5p8.js} +8 -8
  18. package/dist/{claude-managed-adapter-t8nfgcgz.js → claude-managed-adapter-ssg6z4bt.js} +4 -4
  19. package/dist/{claude-managed-setup-7y4pwd81.js → claude-managed-setup-trd59v7b.js} +4 -4
  20. package/dist/{claude-sdk-session-d138zy0e.js → claude-sdk-session-yjcze0j1.js} +10941 -10412
  21. package/dist/{cli-vq2eg24x.js → cli-01tvvtad.js} +63 -60
  22. package/dist/cli-04zc3f7b.js +68 -0
  23. package/dist/{cli-01k6wpr9.js → cli-0k1a0sde.js} +7 -7
  24. package/dist/{cli-j6te8keb.js → cli-0pp1yjg2.js} +8 -8
  25. package/dist/{cli-0b4zam62.js → cli-0vcqcwfn.js} +18 -0
  26. package/dist/{cli-wwp1bd3n.js → cli-12vek61e.js} +564 -97
  27. package/dist/{cli-rqx70rcz.js → cli-17qzb39j.js} +5 -2
  28. package/dist/{cli-124ntmf0.js → cli-1htmtqc2.js} +143 -63
  29. package/dist/{cli-3f8zbtqa.js → cli-2amwhyv2.js} +15 -11
  30. package/dist/{cli-7sf9sb0w.js → cli-2m6yaq6b.js} +1 -1
  31. package/dist/{cli-6cwr32fe.js → cli-2tw284hj.js} +422 -140
  32. package/dist/{cli-6ehs4mta.js → cli-2z2c4k6q.js} +18 -4
  33. package/dist/{cli-nstkanmx.js → cli-39qm0rtm.js} +8 -8
  34. package/dist/{cli-hnamkvnc.js → cli-3p288654.js} +2 -2
  35. package/dist/{cli-4ymxrwg5.js → cli-4dyzzkfb.js} +2 -2
  36. package/dist/{cli-3kd08rej.js → cli-4jjrhy48.js} +1 -1
  37. package/dist/{cli-kxn3747f.js → cli-4se3x6qm.js} +1 -26
  38. package/dist/cli-52nfye5j.js +673 -0
  39. package/dist/cli-55tc8cj4.js +252 -0
  40. package/dist/cli-5r95eqbh.js +186 -0
  41. package/dist/{cli-6037prsx.js → cli-5tg94mdw.js} +13 -13
  42. package/dist/{cli-2spnz7ye.js → cli-5x03v6en.js} +11137 -8332
  43. package/dist/{cli-y4ccxtz5.js → cli-5z0g0e8v.js} +153 -6
  44. package/dist/{cli-8y43jx2r.js → cli-6p8p2e6r.js} +16 -9
  45. package/dist/{cli-539h29es.js → cli-72yms3ey.js} +224 -189
  46. package/dist/{cli-y8p78ekx.js → cli-73q4g5nx.js} +21 -21
  47. package/dist/{cli-p74md7t8.js → cli-7b7rxz22.js} +13 -15
  48. package/dist/{cli-43ms35q9.js → cli-7wy8gbwb.js} +3 -3
  49. package/dist/{cli-7mv4h3sn.js → cli-7yn42w6m.js} +2 -2
  50. package/dist/{cli-gabsjg8x.js → cli-8hp56wat.js} +3 -2
  51. package/dist/cli-8mfdbdhe.js +43 -0
  52. package/dist/{cli-zcfpsfzf.js → cli-96234j5w.js} +3 -3
  53. package/dist/{cli-1z4qggfe.js → cli-9fvk9mv8.js} +30 -21
  54. package/dist/{cli-2rnd5j3t.js → cli-9qe5y107.js} +2 -2
  55. package/dist/{cli-5mpy301f.js → cli-9t7syepg.js} +1 -1
  56. package/dist/{cli-7cp6aa1q.js → cli-9y4tgrkf.js} +23 -177
  57. package/dist/{cli-7evph51z.js → cli-a49frv85.js} +2 -2
  58. package/dist/{cli-3aaeb78m.js → cli-agjbj5x0.js} +95 -10
  59. package/dist/{cli-th1dkc2v.js → cli-b93d81yg.js} +2 -2
  60. package/dist/{cli-qj39vrc6.js → cli-bhgrhedp.js} +1 -1
  61. package/dist/{cli-2xv18ywz.js → cli-bmqp0ser.js} +2 -2
  62. package/dist/{cli-9fjr27ez.js → cli-bp6k9acz.js} +18 -22
  63. package/dist/{cli-5a6pqy45.js → cli-bpje8n65.js} +31 -4
  64. package/dist/{cli-2v2zdm0a.js → cli-bz97ff9n.js} +2 -2
  65. package/dist/{cli-3caf7pmg.js → cli-c7j31hq9.js} +3 -3
  66. package/dist/{cli-t9ga4qmb.js → cli-cah298e5.js} +40 -33
  67. package/dist/{cli-aw83sr40.js → cli-cjqyse9q.js} +3 -3
  68. package/dist/{cli-b6px1k1q.js → cli-dd2k2mcd.js} +1 -1
  69. package/dist/{cli-nv4xsvmk.js → cli-dkvtfgn4.js} +7 -7
  70. package/dist/{cli-7r162fxe.js → cli-e3ahxq5y.js} +23 -17
  71. package/dist/{cli-3et6fmfe.js → cli-e8n0hdzd.js} +1 -1
  72. package/dist/{cli-tsa40663.js → cli-ebqx630g.js} +3 -3
  73. package/dist/{cli-kbtzfrxj.js → cli-en6dmkxd.js} +3 -3
  74. package/dist/{cli-m9cvf7vs.js → cli-eq4kew31.js} +14 -14
  75. package/dist/{cli-fcfbct2j.js → cli-eqq0hwvx.js} +5 -5
  76. package/dist/{cli-7zm3b3f5.js → cli-ercwc8xn.js} +1 -1
  77. package/dist/{cli-vs9vdpy0.js → cli-ex1y88j3.js} +1 -1
  78. package/dist/{cli-mk7c5ac4.js → cli-fxd1mwtr.js} +2 -2
  79. package/dist/{cli-91pkxres.js → cli-fy4gb74g.js} +2 -2
  80. package/dist/{cli-fq2rr3jb.js → cli-fyaq4zdv.js} +6 -6
  81. package/dist/{cli-cc93xzes.js → cli-gfy6hbd9.js} +28 -17
  82. package/dist/{cli-s1khw52h.js → cli-h70a2mxy.js} +71 -17
  83. package/dist/cli-hbvgzjq4.js +69 -0
  84. package/dist/{cli-qx4f057j.js → cli-hhc47ack.js} +4 -4
  85. package/dist/{cli-q5srsxq2.js → cli-j5gtytvg.js} +154 -41
  86. package/dist/{cli-psffsanb.js → cli-js10kdk7.js} +6 -1
  87. package/dist/{cli-54vrpgm0.js → cli-k3facve0.js} +8 -5
  88. package/dist/{cli-vsw91x06.js → cli-k5jx8jya.js} +10 -6
  89. package/dist/{cli-tr27kwyg.js → cli-krbcr00p.js} +261 -6
  90. package/dist/{cli-5qhfv9rw.js → cli-kwr5qv5g.js} +44 -17
  91. package/dist/{cli-md50mj0r.js → cli-m5qtmrbc.js} +3 -3
  92. package/dist/{cli-vfqvrd82.js → cli-ma9ys8rt.js} +2 -2
  93. package/dist/{cli-w16kwbzw.js → cli-mbwmqb5w.js} +1 -1
  94. package/dist/{cli-w1q68d8x.js → cli-mcymtvwn.js} +322 -72
  95. package/dist/{cli-k3q2va86.js → cli-mq2fbgva.js} +66 -5
  96. package/dist/{cli-xqdz5cqm.js → cli-mz7ycqn8.js} +1 -0
  97. package/dist/{cli-kpgcm7xy.js → cli-n85m2wkq.js} +1 -1
  98. package/dist/{cli-v8z0yga9.js → cli-n8f0fs3c.js} +4 -4
  99. package/dist/{cli-mys27d03.js → cli-nja15knq.js} +3 -3
  100. package/dist/{cli-zk7v5s89.js → cli-pe3yxedk.js} +3 -3
  101. package/dist/{cli-v46zsvqk.js → cli-ph95yejc.js} +2 -2
  102. package/dist/{cli-6237rnyr.js → cli-pqfecppn.js} +1 -1
  103. package/dist/{cli-qrta34nb.js → cli-q2dywc8h.js} +4 -4
  104. package/dist/{cli-k6nejceb.js → cli-q4z9s6zs.js} +2 -2
  105. package/dist/{cli-s1zqk1aj.js → cli-q8tc22bj.js} +15 -9
  106. package/dist/{cli-hg42n3hx.js → cli-qrzq3hvg.js} +8 -8
  107. package/dist/{cli-43evxwj4.js → cli-r0mz92by.js} +9 -4
  108. package/dist/{cli-jrbq4djp.js → cli-r14ac1y0.js} +1 -1
  109. package/dist/{cli-5gpqgs8b.js → cli-rtmqzat7.js} +2 -2
  110. package/dist/{cli-tvgqesec.js → cli-s6zk31gr.js} +4 -4
  111. package/dist/{cli-6ym4jhzp.js → cli-sv2r3bw8.js} +7 -7
  112. package/dist/{cli-wafmk3fn.js → cli-t75xngj1.js} +12 -12
  113. package/dist/{cli-x40a0w9j.js → cli-tdk7jtka.js} +1 -1
  114. package/dist/{cli-zeh2mhkg.js → cli-tm60vtax.js} +1 -1
  115. package/dist/cli-tsfkcd4v.js +30 -0
  116. package/dist/{cli-8st34zhr.js → cli-v9ya390t.js} +57 -19
  117. package/dist/{cli-zfqg6fzn.js → cli-vbppqvte.js} +3 -3
  118. package/dist/{cli-p0n7b5rz.js → cli-wvjqaqcp.js} +2907 -151
  119. package/dist/{cli-sb4426be.js → cli-xf4z5bdn.js} +5 -5
  120. package/dist/{cli-p0c3vtch.js → cli-xm34qj8m.js} +772 -515
  121. package/dist/{cli-z0m452jr.js → cli-ya3kf4gs.js} +1 -1
  122. package/dist/{cli-had1p04a.js → cli-yegz2g06.js} +4 -4
  123. package/dist/{cli-k5yewqgd.js → cli-yfpc6qy9.js} +3 -3
  124. package/dist/{cli-q2d3e1k1.js → cli-z4f346g5.js} +1 -1
  125. package/dist/{cli-yab6sh8p.js → cli-zcghfsdg.js} +23 -4
  126. package/dist/cli.js +34 -30
  127. package/dist/{cloudflare-workers-ai-system-one-4aysy6rh.js → cloudflare-workers-ai-system-one-w3m0fbf8.js} +2 -2
  128. package/dist/{codex-adapter-exfdbj73.js → codex-adapter-wc6e4wct.js} +8 -8
  129. package/dist/{codex-hook-59atdwd8.js → codex-hook-aqtj17yr.js} +1 -1
  130. package/dist/{codex-login-a239g1ah.js → codex-login-1ven7yje.js} +1 -1
  131. package/dist/{codex-session-runner-xhznc4g3.js → codex-session-runner-ppfgjd97.js} +9 -9
  132. package/dist/{commands-d8g349v4.js → commands-tsv2vx5b.js} +3 -3
  133. package/dist/{controller-mwgdmb8y.js → controller-ye4sdwsy.js} +4 -4
  134. package/dist/{controllers-connect-5v7qx04j.js → controllers-connect-zn4dg69h.js} +25 -22
  135. package/dist/core-dxcy02sc.js +41 -0
  136. package/dist/{cursor-adapter-p2q5h35d.js → cursor-adapter-q2g9vwts.js} +2 -2
  137. package/dist/{db-wcw0b2j8.js → db-3r1fyr2n.js} +6 -2
  138. package/dist/{db-qpganbeb.js → db-g111qn9j.js} +3 -3
  139. package/dist/{devin-adapter-zp4tqq53.js → devin-adapter-t8d86q9x.js} +1 -1
  140. package/dist/{dispatcher-8d8s49yz.js → dispatcher-4q8s0mx8.js} +22 -19
  141. package/dist/{docker-09tkkg0n.js → docker-1b41eysj.js} +51 -14
  142. package/dist/{dsh-adapter-me0twn13.js → dsh-adapter-mmcw1z5s.js} +2 -2
  143. package/dist/{e2b-3v1e745x.js → e2b-ew8c5j5v.js} +3 -3
  144. package/dist/{e2b-sm28k0k3.js → e2b-xm60c8ad.js} +6 -6
  145. package/dist/{easter-egg-3d-wv7w5ty6.js → easter-egg-3d-04ke6hcp.js} +1 -1
  146. package/dist/{embedding-space-e48xchqa.js → embedding-space-kcdn52vz.js} +6 -6
  147. package/dist/{embeddings-tgq2afbq.js → embeddings-jnzcd91a.js} +1 -1
  148. package/dist/{event-bus-xr83x566.js → event-bus-v4ywhc2p.js} +1 -1
  149. package/dist/{execute-8rhwrk7f.js → execute-74amghty.js} +8 -4
  150. package/dist/{external-channel-8bt3j2pm.js → external-channel-v9zgxnxz.js} +2 -2
  151. package/dist/fx-adapter-0ar6pqm3.js +19 -0
  152. package/dist/{google-generative-ai-bh0djqjp.js → google-generative-ai-sw77egmr.js} +9 -9
  153. package/dist/{google-vertex-prjbw8dj.js → google-vertex-rrw93g8h.js} +9 -9
  154. package/dist/grok-adapter-t6m74fb1.js +19 -0
  155. package/dist/handlers-9kwcrc4k.js +38 -0
  156. package/dist/{heartbeat-x0056ra5.js → heartbeat-p8pk1msj.js} +25 -22
  157. package/dist/{hook-a7vmn2st.js → hook-k1h73zd7.js} +5 -5
  158. package/dist/{hook-mrd2ayxv.js → hook-p5reemds.js} +8 -8
  159. package/dist/{http-ym9c5svp.js → http-ms1z5xxy.js} +2549 -224
  160. package/dist/index-23cdfzr6.js +39 -0
  161. package/dist/{index-01ns1pkw.js → index-76zzxtzf.js} +1 -1
  162. package/dist/{index-ny60jcat.js → index-fbkqhvvj.js} +40 -18
  163. package/dist/index-g7kkjs5b.js +38 -0
  164. package/dist/{index-x6azjwm8.js → index-gjn6qfgn.js} +1 -1
  165. package/dist/{index-b5wgnm78.js → index-kdmkfjt7.js} +4 -4
  166. package/dist/{index-p46tvwtx.js → index-kn63q1gr.js} +28 -25
  167. package/dist/{index-9myfj74s.js → index-kzdqn3dd.js} +3 -3
  168. package/dist/{index-4a0670yh.js → index-p2f5xg64.js} +6 -6
  169. package/dist/index-stk36pa5.js +43 -0
  170. package/dist/{k8s-m56sw868.js → k8s-fy8hbhkg.js} +73 -14
  171. package/dist/{keepalive-7yxg8z4c.js → keepalive-031js8jz.js} +4 -4
  172. package/dist/lead-mfggjtfk.js +77 -0
  173. package/dist/{llama-cpp-classify-nfgswa1m.js → llama-cpp-classify-yvb8vh7w.js} +2 -2
  174. package/dist/{maintenance-6tefxmk1.js → maintenance-sq9v3qx9.js} +1 -1
  175. package/dist/{mistral-conversations-tm2vd4gc.js → mistral-conversations-w4bncwbt.js} +7 -7
  176. package/dist/{node-7qsx5kvm.js → node-z67yjre7.js} +19 -13
  177. package/dist/{oauth-refresh-sweep-70cavc3a.js → oauth-refresh-sweep-zqmnyvs8.js} +3 -3
  178. package/dist/object-webhooks-r24wwb5y.js +21 -0
  179. package/dist/{onboard-fja65z08.js → onboard-p25yhh7t.js} +5 -5
  180. package/dist/{openai-codex-responses-sxjv60xx.js → openai-codex-responses-70g39cgz.js} +20 -14
  181. package/dist/{openai-completions-0c7qnhsx.js → openai-completions-cv3hp4h5.js} +18 -11
  182. package/dist/{openai-decisions-ytp6w6xh.js → openai-decisions-fyq1p9f9.js} +2 -2
  183. package/dist/{openai-responses-a7h29chp.js → openai-responses-trsvnks6.js} +13 -11
  184. package/dist/{opencode-adapter-hakkm7yh.js → opencode-adapter-wcjc4zdk.js} +7 -7
  185. package/dist/{openrouter-images-xr9gme9x.js → openrouter-images-0jj12a2q.js} +6 -6
  186. package/dist/{otel-impl-7zhnt6gj.js → otel-impl-ff1gf20m.js} +2 -2
  187. package/dist/{pending-h01yzpx4.js → pending-hxj5yatb.js} +23 -20
  188. package/dist/{pi-messages-2j0fpqwq.js → pi-messages-zk3g4esn.js} +1 -1
  189. package/dist/{pi-mono-adapter-f52hz743.js → pi-mono-adapter-vkp4zz7p.js} +19 -18
  190. package/dist/{pricing-refresh-fzxvk2zf.js → pricing-refresh-9w7gx41w.js} +2 -2
  191. package/dist/{rbac-roles-9v6vhgbs.js → rbac-roles-84aw10nz.js} +3 -3
  192. package/dist/{rbac-roles-hfgh8sba.js → rbac-roles-hz74vckp.js} +2 -2
  193. package/dist/{registry-32b1mft6.js → registry-eeyx1201.js} +1 -1
  194. package/dist/{render-v2-1rgspxzf.js → render-v2-nrdkg9gf.js} +7 -6
  195. package/dist/{resume-tqy61x24.js → resume-s6ey36rh.js} +9 -8
  196. package/dist/{runtime-exkxyx5f.js → runtime-x0b4pyam.js} +2 -2
  197. package/dist/{session-access-3act7vt4.js → session-access-xv49tk14.js} +4 -4
  198. package/dist/{session-source-backfill-82qe7fqq.js → session-source-backfill-r5j988ah.js} +3 -3
  199. package/dist/{setup-ry1vfdef.js → setup-mj0krk1p.js} +1 -1
  200. package/dist/thread-buffer-temgaqsy.js +41 -0
  201. package/dist/tree-visibility-cbrsfaar.js +24 -0
  202. package/dist/{typesafe-system-one-vcfj2ak8.js → typesafe-system-one-qkvkgrcz.js} +2 -2
  203. package/dist/{user-merge-jobs-bx6bf7db.js → user-merge-jobs-f9d8nwnw.js} +3 -3
  204. package/dist/{virtual-modules-s0rjzcqq.js → virtual-modules-ns0ryw05.js} +32 -10
  205. package/dist/{work-objects-z2e5tv03.js → work-objects-pydhzast.js} +25 -22
  206. package/dist/worker-efcemc22.js +77 -0
  207. package/dist/{worker-follow-up-y3xeg89w.js → worker-follow-up-9z2xec5e.js} +22 -19
  208. package/dist/{x-wg164ss9.js → x-3dtaf2r9.js} +2 -2
  209. package/openapi.json +2040 -559
  210. package/package.json +15 -11
  211. package/src/azure-devops/auth.ts +2 -3
  212. package/src/be/agent-fs-identity.ts +46 -0
  213. package/src/be/agent-history.ts +215 -0
  214. package/src/be/db/agents.ts +34 -12
  215. package/src/be/db/request-composition.ts +190 -0
  216. package/src/be/db/runtime.ts +15 -0
  217. package/src/be/db/slack-trees.ts +220 -10
  218. package/src/be/db/tasks/human-free.ts +3 -2
  219. package/src/be/db/tasks/write.ts +2 -2
  220. package/src/be/db/workflow-run-retention.ts +101 -0
  221. package/src/be/db-client.ts +23 -1
  222. package/src/be/db-retention-defaults.ts +46 -0
  223. package/src/be/db-retention.ts +55 -6
  224. package/src/be/db.ts +2 -0
  225. package/src/be/mcp-events/catalog.ts +108 -0
  226. package/src/be/mcp-events/dispatcher.ts +202 -0
  227. package/src/be/mcp-events/protocol.ts +296 -0
  228. package/src/be/mcp-events/store.ts +231 -0
  229. package/src/be/mcp-events/webhook.ts +226 -0
  230. package/src/be/memory/providers/sqlite-store.ts +110 -24
  231. package/src/be/memory/review-recall-filter.ts +22 -0
  232. package/src/be/memory/search-candidates.ts +5 -7
  233. package/src/be/memory/types.ts +5 -0
  234. package/src/be/migrations/322_runtime_pool_workspace.sql +8 -0
  235. package/src/be/migrations/323_slack_task_tree_visibility.sql +9 -0
  236. package/src/be/migrations/326_slack_reconcile_pages.sql +13 -0
  237. package/src/be/migrations/327_mcp_event_subscriptions.sql +57 -0
  238. package/src/be/migrations/329_workflow_run_retention.sql +9 -0
  239. package/src/be/migrations/330_request_composition.sql +22 -0
  240. package/src/be/migrations/332_primitive_objects.sql +31 -0
  241. package/src/be/migrations/334_agent_history.sql +23 -0
  242. package/src/be/migrations/335_primitive_object_webhooks.sql +36 -0
  243. package/src/be/model-profile-check.ts +1 -1
  244. package/src/be/multi-runtime.ts +32 -4
  245. package/src/be/primitives/boards/elements.ts +717 -0
  246. package/src/be/primitives/boards/excalifont-metrics.json +516 -0
  247. package/src/be/primitives/boards/service.ts +121 -0
  248. package/src/be/primitives/object-webhooks.ts +348 -0
  249. package/src/be/primitives/objects.ts +686 -0
  250. package/src/be/primitives/sheets/a1.ts +136 -0
  251. package/src/be/primitives/sheets/engine-worker.ts +194 -0
  252. package/src/be/primitives/sheets/engine.ts +199 -0
  253. package/src/be/primitives/sheets/format.ts +106 -0
  254. package/src/be/primitives/sheets/service.ts +415 -0
  255. package/src/be/primitives/write-object.ts +83 -0
  256. package/src/be/runtime-pools/controllers.ts +18 -3
  257. package/src/be/runtime-pools/db.ts +15 -4
  258. package/src/be/runtime-pools/supervisor.ts +42 -2
  259. package/src/be/script-credential-broker.ts +8 -27
  260. package/src/be/scripts/typecheck.ts +216 -0
  261. package/src/be/seed/agent-fs-provision.ts +18 -0
  262. package/src/be/swarm-config-guard.ts +10 -2
  263. package/src/be/users.ts +19 -0
  264. package/src/commands/context-preamble.ts +11 -4
  265. package/src/commands/credential-outcome-report.ts +33 -9
  266. package/src/commands/e2b-stack-wizard.tsx +12 -6
  267. package/src/commands/onboard/agent-fs-version.ts +1 -1
  268. package/src/commands/onboard/steps/harness.tsx +1 -1
  269. package/src/commands/provider-credentials.ts +1 -0
  270. package/src/commands/runner.ts +116 -12
  271. package/src/e2b/env.ts +3 -1
  272. package/src/extensions/catalog.generated.json +1 -1
  273. package/src/fs/agent-fs-provider.ts +33 -2
  274. package/src/github/app.ts +59 -14
  275. package/src/gitlab/auth.ts +3 -4
  276. package/src/heartbeat/heartbeat.ts +11 -11
  277. package/src/http/agent-lifecycle.ts +152 -0
  278. package/src/http/agents.ts +12 -0
  279. package/src/http/all-routes.ts +4 -0
  280. package/src/http/auth.ts +2 -1
  281. package/src/http/config.ts +2 -1
  282. package/src/http/core.ts +2 -0
  283. package/src/http/github-token.ts +66 -0
  284. package/src/http/index.ts +36 -0
  285. package/src/http/mcp-user.ts +11 -8
  286. package/src/http/mcp.ts +58 -42
  287. package/src/http/object-webhooks.ts +101 -0
  288. package/src/http/operator-actor.ts +2 -1
  289. package/src/http/prompt-templates.ts +1 -0
  290. package/src/http/request-composition.ts +310 -0
  291. package/src/http/sessions.ts +7 -0
  292. package/src/http/tasks.ts +6 -1
  293. package/src/http/tool-schema-estimate.ts +95 -0
  294. package/src/http/workflows.ts +61 -11
  295. package/src/integrations/chat-sdk/inbound.ts +2 -2
  296. package/src/integrations/chat-sdk/outbound-files.ts +3 -2
  297. package/src/prompts/base-prompt.ts +133 -7
  298. package/src/prompts/resolver.ts +41 -2
  299. package/src/providers/acp-targets.ts +2 -2
  300. package/src/providers/amp-adapter.ts +1 -1
  301. package/src/providers/opencode-adapter.ts +76 -2
  302. package/src/providers/opencode-swarm-plugin.ts +22 -3
  303. package/src/providers/pi-mono-adapter.ts +1 -0
  304. package/src/providers/pi-mono-extension.ts +71 -0
  305. package/src/providers/pricing-sources.md +4 -0
  306. package/src/providers/request-composition-hook.ts +312 -0
  307. package/src/providers/types.ts +5 -0
  308. package/src/rbac/legacy-policy.ts +2 -0
  309. package/src/rbac/permissions.ts +5 -0
  310. package/src/runtime-providers/controller-protocol.ts +7 -0
  311. package/src/runtime-providers/docker.ts +80 -12
  312. package/src/runtime-providers/k8s.ts +111 -6
  313. package/src/runtime-providers/types.ts +17 -0
  314. package/src/scheduler/scheduler.ts +1 -1
  315. package/src/script-workflows/guest-ctx.ts +32 -0
  316. package/src/script-workflows/workflow-ctx.ts +2 -0
  317. package/src/scripts-runtime/ctx.ts +9 -1
  318. package/src/scripts-runtime/executors/native.ts +106 -21
  319. package/src/scripts-runtime/executors/quickjs-prelude.ts +9 -2
  320. package/src/scripts-runtime/executors/quickjs-runner.ts +12 -1
  321. package/src/scripts-runtime/sdk-allowlist.ts +88 -0
  322. package/src/scripts-runtime/swarm-sdk.ts +51 -3
  323. package/src/scripts-runtime/types/stdlib.d.ts +267 -0
  324. package/src/scripts-runtime/types/swarm-sdk.d.ts +267 -0
  325. package/src/server-user.ts +16 -1
  326. package/src/server.ts +48 -0
  327. package/src/slack/ack.ts +10 -5
  328. package/src/slack/actions.ts +3 -3
  329. package/src/slack/app.ts +2 -0
  330. package/src/slack/assistant.ts +4 -4
  331. package/src/slack/blocks.ts +3 -3
  332. package/src/slack/handlers.ts +3 -3
  333. package/src/slack/reaction-shortcode.ts +23 -2
  334. package/src/slack/render-v2.ts +297 -200
  335. package/src/slack/responses.ts +7 -5
  336. package/src/slack/thread-buffer.ts +3 -3
  337. package/src/slack/tree-visibility.ts +64 -0
  338. package/src/tasks/worker-follow-up.ts +127 -17
  339. package/src/tests/agent-history.test.ts +313 -0
  340. package/src/tests/azure-devops-auth.test.ts +6 -0
  341. package/src/tests/azure-devops-outbound.test.ts +47 -14
  342. package/src/tests/base-prompt.test.ts +149 -1
  343. package/src/tests/chat-sdk-outbound-files.test.ts +3 -1
  344. package/src/tests/check-playwright-version.test.ts +33 -0
  345. package/src/tests/check-unit-test-allowlist.test.ts +193 -0
  346. package/src/tests/context-preamble-budget.test.ts +65 -0
  347. package/src/tests/credential-check.test.ts +12 -0
  348. package/src/tests/credential-outcome-report.test.ts +81 -1
  349. package/src/tests/db-client.test.ts +22 -0
  350. package/src/tests/db-retention-defaults.test.ts +244 -0
  351. package/src/tests/db-retention.test.ts +2 -1
  352. package/src/tests/db-task-read-contract.test.ts +2 -0
  353. package/src/tests/db-task-write-contract.test.ts +2 -0
  354. package/src/tests/deploy-release-dispatch.test.ts +332 -0
  355. package/src/tests/e2b-stack-wizard.test.tsx +156 -0
  356. package/src/tests/e2e-coverage-contract.test.ts +6 -2
  357. package/src/tests/e2e-diff-coverage.test.ts +154 -0
  358. package/src/tests/e2e-rerun-quarantine.test.ts +180 -0
  359. package/src/tests/e2e-shards.test.ts +137 -0
  360. package/src/tests/e2e-tracker-ingest.test.ts +266 -0
  361. package/src/tests/entrypoint-chown-no-follow.test.ts +69 -0
  362. package/src/tests/entrypoint-repo-clone-target.test.ts +112 -0
  363. package/src/tests/env-flag.test.ts +4 -2
  364. package/src/tests/event-loop-lag.test.ts +12 -18
  365. package/src/tests/extensions-example-slack-reply-gate.test.ts +15 -0
  366. package/src/tests/extensions-heartbeat.test.ts +34 -0
  367. package/src/tests/fixtures/base-prompt-baseline-cases.ts +78 -0
  368. package/src/tests/fixtures/base-prompt-baseline.json +18 -0
  369. package/src/tests/github-app-worker-auth-helper.test.ts +325 -0
  370. package/src/tests/github-installation-token-route.test.ts +199 -0
  371. package/src/tests/gitlab-auth.test.ts +10 -0
  372. package/src/tests/heartbeat.test.ts +38 -0
  373. package/src/tests/http-api-integration.test.ts +0 -6
  374. package/src/tests/mcp-user-events.test.ts +708 -0
  375. package/src/tests/memory-key-paths.test.ts +4 -1
  376. package/src/tests/memory-search-stall.test.ts +421 -0
  377. package/src/tests/migration-322-runtime-pool-workspace.test.ts +116 -0
  378. package/src/tests/migration-329-workflow-run-retention.test.ts +32 -0
  379. package/src/tests/model-profile-fallbacks.test.ts +236 -2
  380. package/src/tests/opencode-adapter.test.ts +97 -0
  381. package/src/tests/pi-mono-extension.test.ts +168 -0
  382. package/src/tests/preload-env.test.ts +61 -1
  383. package/src/tests/preload.ts +22 -0
  384. package/src/tests/primitives-boards.test.ts +686 -0
  385. package/src/tests/primitives-object-webhooks.test.ts +642 -0
  386. package/src/tests/primitives-objects.test.ts +248 -0
  387. package/src/tests/prompt-template-resolver.test.ts +85 -0
  388. package/src/tests/reasoning-kind-ui-parity.test.ts +112 -0
  389. package/src/tests/reload-config.test.ts +45 -0
  390. package/src/tests/request-composition.test.ts +447 -0
  391. package/src/tests/runner-max-concurrent.test.ts +86 -0
  392. package/src/tests/runtime-pools-db.test.ts +80 -0
  393. package/src/tests/runtime-provider-registration.test.ts +8 -0
  394. package/src/tests/runtime-providers-docker.test.ts +192 -1
  395. package/src/tests/runtime-providers-k8s.test.ts +127 -0
  396. package/src/tests/runtime-remote-controller.test.ts +64 -1
  397. package/src/tests/runtime-supervisor.test.ts +101 -0
  398. package/src/tests/script-connections.test.ts +8 -0
  399. package/src/tests/script-native-sandbox-identity.test.ts +264 -0
  400. package/src/tests/scripts-namespaces.test.ts +211 -0
  401. package/src/tests/secret-scrub-gate.test.ts +1 -0
  402. package/src/tests/secret-scrubber-convex.test.ts +168 -0
  403. package/src/tests/secret-scrubber.test.ts +1 -1
  404. package/src/tests/session-tokens.test.ts +27 -0
  405. package/src/tests/sheet-engine.test.ts +58 -0
  406. package/src/tests/slack-blocks.test.ts +18 -0
  407. package/src/tests/slack-empty-icon-config.test.ts +113 -0
  408. package/src/tests/slack-file-tools-attachments.test.ts +74 -6
  409. package/src/tests/slack-reaction-config.test.ts +38 -2
  410. package/src/tests/slack-read-boundaries.test.ts +4 -2
  411. package/src/tests/slack-render-v2-query-plans.test.ts +100 -1
  412. package/src/tests/slack-render-v2-reconcile.test.ts +75 -4
  413. package/src/tests/slack-render-v2.test.ts +683 -11
  414. package/src/tests/swarm-config-reserved-keys.test.ts +1 -0
  415. package/src/tests/task-session-prompts.test.ts +37 -0
  416. package/src/tests/task-start-after-commit.test.ts +82 -0
  417. package/src/tests/ui-logs-parser.test.ts +67 -0
  418. package/src/tests/user-delete-perf.test.ts +36 -9
  419. package/src/tests/webhook-filter.test.ts +327 -0
  420. package/src/tests/workflow-async-v2.test.ts +19 -16
  421. package/src/tests/workflow-e2e.test.ts +1 -9
  422. package/src/tests/workflow-finalization-races.test.ts +553 -0
  423. package/src/tests/workflow-foreach.test.ts +2 -0
  424. package/src/tests/workflow-hitl-routing.test.ts +26 -20
  425. package/src/tests/workflow-http-v2.test.ts +105 -2
  426. package/src/tests/workflow-idempotency.test.ts +41 -0
  427. package/src/tests/workflow-mcp-webhook-filter.test.ts +214 -0
  428. package/src/tests/workflow-parallel-park.test.ts +297 -0
  429. package/src/tests/workflow-retry-v2.test.ts +158 -21
  430. package/src/tests/workflow-retry-validation.test.ts +13 -13
  431. package/src/tests/workflow-runs-retention.test.ts +533 -0
  432. package/src/tests/workflow-script-principal.test.ts +7 -2
  433. package/src/tests/workflow-tla-races.test.ts +36 -2
  434. package/src/tests/workflow-triggers-v2.test.ts +201 -0
  435. package/src/tests/workflow-wait-builtin-events.test.ts +3 -1
  436. package/src/tests/workflow-wait-event.test.ts +28 -2
  437. package/src/tests/workflow-wait-poller.test.ts +94 -0
  438. package/src/tests/workflow-wait-time.test.ts +7 -3
  439. package/src/tests/workflow-wait.ts +44 -0
  440. package/src/tools/boards.ts +260 -0
  441. package/src/tools/objects.ts +191 -0
  442. package/src/tools/sheets.ts +312 -0
  443. package/src/tools/slack-read.ts +10 -3
  444. package/src/tools/tool-config.ts +23 -0
  445. package/src/tools/workflows/create-workflow.ts +18 -4
  446. package/src/tools/workflows/patch-workflow-node.ts +4 -0
  447. package/src/tools/workflows/patch-workflow.ts +4 -0
  448. package/src/tools/workflows/update-workflow.ts +24 -3
  449. package/src/types.ts +216 -2
  450. package/src/utils/credentials.ts +7 -0
  451. package/src/utils/sandboxed-process.ts +47 -2
  452. package/src/utils/secret-scrubber.ts +61 -6
  453. package/src/workflows/checkpoint.ts +18 -0
  454. package/src/workflows/engine.ts +73 -31
  455. package/src/workflows/foreach-driver.ts +42 -4
  456. package/src/workflows/input.ts +29 -1
  457. package/src/workflows/patch-definition.ts +15 -1
  458. package/src/workflows/recovery.ts +6 -1
  459. package/src/workflows/resume.ts +11 -3
  460. package/src/workflows/retry-poller.ts +32 -6
  461. package/src/workflows/successor-routing.ts +108 -0
  462. package/src/workflows/task-step-routing.ts +5 -2
  463. package/src/workflows/triggers.ts +21 -36
  464. package/src/workflows/validation.ts +10 -0
  465. package/src/workflows/wait-poller.ts +6 -2
  466. package/src/workflows/webhook-filter.ts +203 -0
  467. package/templates/ai-toolbox.manifest.json +1 -1
  468. package/templates/extensions/slack-reply-gate/hooks.ts +8 -4
  469. package/templates/skills/agent-browser/SKILL.md +1 -0
  470. package/templates/skills/agent-browser/content.md +1 -0
  471. package/templates/skills/pages/content.md +5 -0
  472. package/templates/skills/swarm-docs/content.md +8 -1
  473. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  474. package/templates/skills/swarm-scripts/content.md +1 -0
  475. package/templates/skills/tdd-planning/content.md +5 -2
  476. package/dist/acp-adapter-bht22g3k.js +0 -16
  477. package/dist/core-sxy4epp2.js +0 -38
  478. package/dist/fx-adapter-adtdb3jb.js +0 -19
  479. package/dist/grok-adapter-accnn9km.js +0 -19
  480. package/dist/handlers-1x77561e.js +0 -35
  481. package/dist/index-48qzcqzj.js +0 -35
  482. package/dist/index-rkvaambe.js +0 -36
  483. package/dist/index-xj1mq27m.js +0 -40
  484. package/dist/lead-enzn86bz.js +0 -74
  485. package/dist/thread-buffer-3x93yexa.js +0 -38
  486. package/dist/worker-zfcv2wbf.js +0 -74
  487. package/src/slack/socket-mode-guard.test.ts +0 -25
  488. package/src/tests/agent-activity.test.ts +0 -247
  489. package/src/tests/agent-fs-live-url.test.ts +0 -55
  490. package/src/tests/agentmail-inbox-mapping.test.ts +0 -73
  491. package/src/tests/approval-sweeps-config.test.ts +0 -47
  492. package/src/tests/cards.test.ts +0 -169
  493. package/src/tests/chat-sdk-facts.test.ts +0 -23
  494. package/src/tests/config-env-export-chat-sdk.test.ts +0 -11
  495. package/src/tests/core-auth.test.ts +0 -156
  496. package/src/tests/date-utils.test.ts +0 -48
  497. package/src/tests/db-context-versions.test.ts +0 -37
  498. package/src/tests/db-runtime.test.ts +0 -131
  499. package/src/tests/enabled-capabilities.test.ts +0 -20
  500. package/src/tests/extensions-example-mcp-install.test.ts +0 -67
  501. package/src/tests/extensions-lead-equivalence.test.ts +0 -70
  502. package/src/tests/get-workflow-run-tool.test.ts +0 -98
  503. package/src/tests/github-event-labels.test.ts +0 -24
  504. package/src/tests/haiku-5-5-pricing.test.ts +0 -38
  505. package/src/tests/http-log-scrubbing.test.ts +0 -123
  506. package/src/tests/http-semconv-attributes.test.ts +0 -92
  507. package/src/tests/identity.test.ts +0 -117
  508. package/src/tests/inbox-state.test.ts +0 -167
  509. package/src/tests/internal-ai/models.test.ts +0 -54
  510. package/src/tests/launch-password-rejection.test.ts +0 -140
  511. package/src/tests/list-total-cache.test.ts +0 -88
  512. package/src/tests/match-route.test.ts +0 -187
  513. package/src/tests/memory-feature-flags.test.ts +0 -45
  514. package/src/tests/memory-get-tool.test.ts +0 -269
  515. package/src/tests/memory-health-endpoint.test.ts +0 -78
  516. package/src/tests/memory-http-access.test.ts +0 -221
  517. package/src/tests/memory-retrieval-purge.test.ts +0 -99
  518. package/src/tests/multi-runtime-enabled-stats.test.ts +0 -229
  519. package/src/tests/openai-embedding-provider.test.ts +0 -159
  520. package/src/tests/org-identity.test.ts +0 -44
  521. package/src/tests/pages-actions-endpoint.test.ts +0 -103
  522. package/src/tests/pages-browser-sdk.test.ts +0 -76
  523. package/src/tests/pages-feedback-keys.test.ts +0 -121
  524. package/src/tests/pages-frame-ancestors.test.ts +0 -189
  525. package/src/tests/pages-list-endpoint.test.ts +0 -148
  526. package/src/tests/pages-password-mode.test.ts +0 -266
  527. package/src/tests/pages-public-authed-401.test.ts +0 -103
  528. package/src/tests/pages-public-html.test.ts +0 -297
  529. package/src/tests/pages-public-json-redirect.test.ts +0 -122
  530. package/src/tests/pages-view-count.test.ts +0 -245
  531. package/src/tests/prompt-templates-db.test.ts +0 -616
  532. package/src/tests/rbac-engine.test.ts +0 -742
  533. package/src/tests/repo-allow-merge-gate.test.ts +0 -389
  534. package/src/tests/route-def-find-route.test.ts +0 -192
  535. package/src/tests/runtime-stale-threshold.test.ts +0 -40
  536. package/src/tests/schedule-validation-helper.test.ts +0 -51
  537. package/src/tests/scheduled-tasks-api.test.ts +0 -355
  538. package/src/tests/scheduler-backoff.test.ts +0 -166
  539. package/src/tests/script-run-token.test.ts +0 -75
  540. package/src/tests/scripts-extract-signature.test.ts +0 -47
  541. package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +0 -141
  542. package/src/tests/seed-workflow-dreaming.test.ts +0 -117
  543. package/src/tests/short-id.test.ts +0 -23
  544. package/src/tests/skill-files-http.test.ts +0 -222
  545. package/src/tests/skill-get-file-tool.test.ts +0 -110
  546. package/src/tests/skill-script-refs.test.ts +0 -63
  547. package/src/tests/skill-update-scope.test.ts +0 -252
  548. package/src/tests/skills-bundle.test.ts +0 -99
  549. package/src/tests/slack-app-icon.test.ts +0 -94
  550. package/src/tests/slack-assistant-comention.test.ts +0 -139
  551. package/src/tests/slack-delete.test.ts +0 -157
  552. package/src/tests/slack-inbound-diagnostics-auth.test.ts +0 -93
  553. package/src/tests/slack-manifest.test.ts +0 -23
  554. package/src/tests/slack-task-output.test.ts +0 -90
  555. package/src/tests/store-progress-output-guidance.test.ts +0 -34
  556. package/src/tests/swarm-diff.test.ts +0 -728
  557. package/src/tests/task-lifecycle-events.test.ts +0 -53
  558. package/src/tests/template-asset-config.test.ts +0 -18
  559. package/src/tests/template-fetch.test.ts +0 -490
  560. package/src/tests/themes-page-theme.test.ts +0 -155
  561. package/src/tests/tool-annotations.test.ts +0 -442
  562. package/src/tests/tool-output-agent-id.test.ts +0 -202
  563. package/src/tests/update-profile-agentid.test.ts +0 -248
  564. package/src/tests/whoami-route.test.ts +0 -162
  565. package/src/tests/workflow-definition-telemetry.test.ts +0 -134
  566. package/src/tests/workflow-patch.test.ts +0 -169
  567. package/src/tests/workflow-run-steps-index.test.ts +0 -65
  568. package/src/tests/workflow-schedule-trigger.test.ts +0 -104
  569. package/src/tests/workflow-step-claims.test.ts +0 -152
  570. package/src/tests/workflow-step-order.test.ts +0 -92
  571. package/src/tests/workflow-trigger-schema.test.ts +0 -359
  572. package/src/tests/workflow-versions.test.ts +0 -240
@@ -1,3 +1,10 @@
1
+ import {
2
+ assertProviderQuotaCapacity,
3
+ parseProviderAccount,
4
+ applyProviderQuotaReport,
5
+ scrubProviderQuotaReport,
6
+ init_provider_account_telemetry
7
+ } from "./cli-7wy8gbwb.js";
1
8
  import {
2
9
  resolveGitHubHost,
3
10
  getGitHubLinkConfig,
@@ -9,25 +16,7 @@ import {
9
16
  ampPinCatalogError,
10
17
  ampModelError,
11
18
  init_amp_models
12
- } from "./cli-zeh2mhkg.js";
13
- import {
14
- ALL_TOOLS,
15
- init_tool_config
16
- } from "./cli-0b4zam62.js";
17
- import {
18
- assertProviderQuotaCapacity,
19
- parseProviderAccount,
20
- applyProviderQuotaReport,
21
- scrubProviderQuotaReport,
22
- init_provider_account_telemetry
23
- } from "./cli-43ms35q9.js";
24
- import {
25
- CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
26
- CODEX_AUTH_FAILURE_BENCH_MS,
27
- CODEX_AUTH_WATCH_NAMESPACE,
28
- codexAuthBenchMarkerKey,
29
- init_codex_auth_failure
30
- } from "./cli-fw2w0kva.js";
19
+ } from "./cli-tm60vtax.js";
31
20
  import {
32
21
  normalizeAssetKey,
33
22
  defaultAssetKey,
@@ -65,7 +54,18 @@ import {
65
54
  SUPERSEDED_WORKFLOW_TASK_REASON,
66
55
  PageThemeTokensSchema,
67
56
  init_types5
68
- } from "./cli-y4ccxtz5.js";
57
+ } from "./cli-5z0g0e8v.js";
58
+ import {
59
+ ALL_TOOLS,
60
+ init_tool_config
61
+ } from "./cli-0vcqcwfn.js";
62
+ import {
63
+ CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
64
+ CODEX_AUTH_FAILURE_BENCH_MS,
65
+ CODEX_AUTH_WATCH_NAMESPACE,
66
+ codexAuthBenchMarkerKey,
67
+ init_codex_auth_failure
68
+ } from "./cli-fw2w0kva.js";
69
69
  import {
70
70
  init_templates4,
71
71
  generateDefaultClaudeMd2,
@@ -80,7 +80,7 @@ import {
80
80
  init_identity_field_budget,
81
81
  contentSha256,
82
82
  init_profile_sync
83
- } from "./cli-3aaeb78m.js";
83
+ } from "./cli-agjbj5x0.js";
84
84
  import {
85
85
  isSteeringEnabled2,
86
86
  init_steering_enabled
@@ -108,7 +108,7 @@ import {
108
108
  splitCredentialPool,
109
109
  selectCredential,
110
110
  init_credentials2
111
- } from "./cli-psffsanb.js";
111
+ } from "./cli-js10kdk7.js";
112
112
  import {
113
113
  getOpenRouterAttributionHeaders,
114
114
  init_openrouter_base_url
@@ -120,15 +120,15 @@ import {
120
120
  configureDbResolver,
121
121
  init_resolver,
122
122
  init_session_templates
123
- } from "./cli-6ehs4mta.js";
123
+ } from "./cli-2z2c4k6q.js";
124
124
  import {
125
125
  setRuntimeModelCatalog,
126
126
  runtimeHarnessSections,
127
127
  init_runtime_model_catalog
128
- } from "./cli-qj39vrc6.js";
128
+ } from "./cli-bhgrhedp.js";
129
129
  import {
130
130
  init_zod
131
- } from "./cli-zcfpsfzf.js";
131
+ } from "./cli-96234j5w.js";
132
132
  import {
133
133
  string2,
134
134
  uuid,
@@ -145,7 +145,7 @@ import {
145
145
  _enum2,
146
146
  literal2,
147
147
  exports_iso
148
- } from "./cli-hg42n3hx.js";
148
+ } from "./cli-qrzq3hvg.js";
149
149
  import {
150
150
  isEnvFlagEnabled,
151
151
  init_env_flag
@@ -153,7 +153,7 @@ import {
153
153
  import {
154
154
  init_package,
155
155
  package_default
156
- } from "./cli-3f8zbtqa.js";
156
+ } from "./cli-2amwhyv2.js";
157
157
  import {
158
158
  getNodeEnv,
159
159
  init_node_env
@@ -184,7 +184,7 @@ import {
184
184
  registerVolatileSecret,
185
185
  registerSensitiveKeyName,
186
186
  init_secret_scrubber
187
- } from "./cli-5a6pqy45.js";
187
+ } from "./cli-bpje8n65.js";
188
188
  import {
189
189
  __toCommonJS,
190
190
  __commonJS,
@@ -493,6 +493,7 @@ var init_default_bindings = __esm(() => {
493
493
  });
494
494
 
495
495
  // src/utils/egress-guard.ts
496
+ import { lookup } from "node:dns/promises";
496
497
  function parseIPv4(host) {
497
498
  const parts = host.split(".");
498
499
  if (parts.length !== 4)
@@ -648,6 +649,227 @@ function assertUrlSafe(rawUrl, opts = {}) {
648
649
  }
649
650
  return parsed;
650
651
  }
652
+ function nextHopRequest(status, from, to, request) {
653
+ const headers = new Headers(request.headers);
654
+ if (to.origin !== from.origin) {
655
+ for (const name of CREDENTIAL_HEADERS)
656
+ headers.delete(name);
657
+ }
658
+ const method = request.method.toUpperCase();
659
+ const toGet = status === 303 ? method !== "HEAD" : (status === 301 || status === 302) && method === "POST";
660
+ if (!toGet)
661
+ return { method, headers, body: request.body };
662
+ headers.delete("content-type");
663
+ headers.delete("content-length");
664
+ return { method: "GET", headers, body: undefined };
665
+ }
666
+ async function defaultResolve(hostname) {
667
+ const records = await lookup(hostname, { all: true, verbatim: true });
668
+ return records.map((record) => record.address);
669
+ }
670
+ function effectivePort(url) {
671
+ if (url.port)
672
+ return url.port;
673
+ return url.protocol === "https:" ? "443" : "80";
674
+ }
675
+ function matchesAllowlist(url, allowlist) {
676
+ const host = stripBrackets(url.hostname.toLowerCase()).replace(/\.$/, "");
677
+ const port = effectivePort(url);
678
+ return allowlist.some((rawEntry) => {
679
+ const entry = rawEntry.trim().toLowerCase();
680
+ if (!entry)
681
+ return false;
682
+ let entryHost = entry;
683
+ let entryPort = null;
684
+ const bracketed = /^\[([^\]]+)\](?::(\d+))?$/.exec(entry);
685
+ if (bracketed) {
686
+ entryHost = bracketed[1] ?? "";
687
+ entryPort = bracketed[2] ?? null;
688
+ } else if ((entry.match(/:/g) ?? []).length === 1) {
689
+ const [name, portText] = entry.split(":");
690
+ entryHost = name ?? "";
691
+ entryPort = portText ?? null;
692
+ }
693
+ if (entryPort !== null && entryPort !== port)
694
+ return false;
695
+ if (entryHost.startsWith("*.")) {
696
+ const suffix = entryHost.slice(1);
697
+ return host.endsWith(suffix) && host.length > suffix.length;
698
+ }
699
+ return host === entryHost;
700
+ });
701
+ }
702
+ async function assertEgressAllowed(url, options) {
703
+ if (url.protocol !== "http:" && url.protocol !== "https:") {
704
+ if (url.protocol === "data:" || url.protocol === "blob:")
705
+ return null;
706
+ throw new EgressDeniedError(`Script egress refused: unsupported protocol ${url.protocol}`);
707
+ }
708
+ if (options.isTrusted?.(url))
709
+ return null;
710
+ const { policy } = options;
711
+ if (policy.allowlist && policy.allowlist.length > 0) {
712
+ if (matchesAllowlist(url, policy.allowlist))
713
+ return null;
714
+ throw new EgressDeniedError(`Script egress refused: ${url.host} is not in SCRIPT_EGRESS_ALLOWLIST`);
715
+ }
716
+ if (policy.allowPrivate)
717
+ return null;
718
+ const host = stripBrackets(url.hostname);
719
+ const denied = () => new EgressDeniedError(`Script egress refused: ${url.host} is a private or loopback address. Add it to SCRIPT_EGRESS_ALLOWLIST or set SCRIPT_EGRESS_ALLOW_PRIVATE=true`);
720
+ if (isLoopbackName(host))
721
+ throw denied();
722
+ if (isIPv4Literal(host) || isIPv6Literal(host)) {
723
+ if (isPrivateAddress(host))
724
+ throw denied();
725
+ return null;
726
+ }
727
+ let addresses;
728
+ try {
729
+ addresses = await (options.resolve ?? defaultResolve)(host);
730
+ } catch (error) {
731
+ throw new EgressDeniedError(`Script egress refused: could not resolve ${host} (${error instanceof Error ? error.message : String(error)})`);
732
+ }
733
+ if (addresses.length === 0) {
734
+ throw new EgressDeniedError(`Script egress refused: ${host} resolved to no address`);
735
+ }
736
+ if (addresses.some(isPrivateAddress))
737
+ throw denied();
738
+ return addresses.find(isIPv4Literal) ?? addresses[0];
739
+ }
740
+ function pinToAddress(url, address, init) {
741
+ const target = new URL(url.href);
742
+ target.hostname = isIPv6Literal(address) ? `[${stripBrackets(address)}]` : address;
743
+ const headers = new Headers(init.headers);
744
+ if (!headers.has("host"))
745
+ headers.set("host", url.host);
746
+ const pinned = { ...init, headers };
747
+ if (url.protocol === "https:") {
748
+ const callerTls = init.tls;
749
+ pinned.tls = { ...callerTls, serverName: url.hostname.replace(/\.$/, "") };
750
+ }
751
+ return [target, pinned];
752
+ }
753
+ function chunkBytes(chunk) {
754
+ if (typeof chunk === "string")
755
+ return new TextEncoder().encode(chunk);
756
+ if (chunk instanceof ArrayBuffer)
757
+ return new Uint8Array(chunk);
758
+ if (ArrayBuffer.isView(chunk)) {
759
+ return new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
760
+ }
761
+ throw new TypeError("Request body stream yielded a chunk that is not bytes or a string");
762
+ }
763
+ async function replayableBody(body, signal, maxBytes = MAX_REPLAY_BODY_BYTES) {
764
+ if (!(body instanceof ReadableStream))
765
+ return { body: body ?? undefined, replayable: true };
766
+ const reader = body.getReader();
767
+ const onAbort = () => {
768
+ reader.cancel(signal?.reason).catch(() => {});
769
+ };
770
+ signal?.addEventListener("abort", onAbort, { once: true });
771
+ const chunks = [];
772
+ let size = 0;
773
+ let overCap = false;
774
+ try {
775
+ for (;; ) {
776
+ signal?.throwIfAborted();
777
+ const { done, value } = await reader.read();
778
+ signal?.throwIfAborted();
779
+ if (done)
780
+ break;
781
+ const bytes = chunkBytes(value);
782
+ size += bytes.byteLength;
783
+ chunks.push(bytes);
784
+ if (size > maxBytes) {
785
+ overCap = true;
786
+ break;
787
+ }
788
+ }
789
+ } catch (error) {
790
+ reader.cancel(error).catch(() => {});
791
+ reader.releaseLock();
792
+ throw error;
793
+ } finally {
794
+ signal?.removeEventListener("abort", onAbort);
795
+ }
796
+ if (overCap) {
797
+ const stream = new ReadableStream({
798
+ start(controller) {
799
+ for (const chunk of chunks.splice(0))
800
+ controller.enqueue(chunk);
801
+ },
802
+ async pull(controller) {
803
+ const { done, value } = await reader.read();
804
+ if (done)
805
+ controller.close();
806
+ else
807
+ controller.enqueue(chunkBytes(value));
808
+ },
809
+ cancel(reason) {
810
+ return reader.cancel(reason);
811
+ }
812
+ });
813
+ return { body: stream, replayable: false };
814
+ }
815
+ reader.releaseLock();
816
+ const out = new Uint8Array(size);
817
+ let offset = 0;
818
+ for (const chunk of chunks) {
819
+ out.set(chunk, offset);
820
+ offset += chunk.byteLength;
821
+ }
822
+ return { body: out, replayable: true };
823
+ }
824
+ function createGuardedFetch(baseFetch, options) {
825
+ const guarded = async (input, init) => {
826
+ const request = input instanceof Request ? input : null;
827
+ let url = new URL(input instanceof Request ? input.url : input instanceof URL ? input.href : input);
828
+ const mode = init?.redirect ?? request?.redirect ?? "follow";
829
+ let method = (init?.method ?? request?.method ?? "GET").toUpperCase();
830
+ let headers = new Headers(init?.headers ?? request?.headers);
831
+ const signal = init?.signal ?? request?.signal;
832
+ let body = init?.body ?? (request ? request.body : undefined);
833
+ let replayable = true;
834
+ if (mode === "follow")
835
+ ({ body, replayable } = await replayableBody(body, signal));
836
+ for (let hop = 0;; hop++) {
837
+ const address = await assertEgressAllowed(url, options);
838
+ const hopInit = {
839
+ ...init,
840
+ method,
841
+ headers,
842
+ body,
843
+ signal,
844
+ redirect: "manual"
845
+ };
846
+ const response = address ? await baseFetch(...pinToAddress(url, address, hopInit)) : await baseFetch(url, hopInit);
847
+ if (address)
848
+ Object.defineProperty(response, "url", { value: url.href });
849
+ if (!REDIRECT_STATUSES.has(response.status) || mode === "manual")
850
+ return response;
851
+ const location = response.headers.get("location");
852
+ if (!location)
853
+ return response;
854
+ if (mode === "error")
855
+ throw new TypeError(`fetch redirect refused (redirect: "error"): ${url.href}`);
856
+ if (hop >= MAX_REDIRECTS) {
857
+ throw new EgressDeniedError(`Script egress refused: more than ${MAX_REDIRECTS} redirects`);
858
+ }
859
+ await response.body?.cancel().catch(() => {});
860
+ const next = new URL(location, url);
861
+ ({ method, headers, body } = nextHopRequest(response.status, url, next, {
862
+ method,
863
+ headers,
864
+ body
865
+ }));
866
+ if (!replayable && body !== undefined)
867
+ throw new RequestBodyTooLargeError(MAX_REPLAY_BODY_BYTES);
868
+ url = next;
869
+ }
870
+ };
871
+ return Object.assign(guarded, { preconnect: baseFetch.preconnect });
872
+ }
651
873
  function parseEgressAllowlist(value) {
652
874
  const entries = (value ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
653
875
  return entries.length > 0 ? entries : null;
@@ -661,7 +883,7 @@ function validateEgressAllowlist(value) {
661
883
  }
662
884
  return null;
663
885
  }
664
- var BLOCKED_IPV4, BLOCKED_IPV4_RANGES, REDIRECT_STATUSES, MAX_REPLAY_BODY_BYTES;
886
+ var BLOCKED_IPV4, BLOCKED_IPV4_RANGES, EgressDeniedError, MAX_REDIRECTS = 5, REDIRECT_STATUSES, CREDENTIAL_HEADERS, MAX_REPLAY_BODY_BYTES, RequestBodyTooLargeError;
665
887
  var init_egress_guard = __esm(() => {
666
888
  BLOCKED_IPV4 = [
667
889
  ["0.0.0.0", 8],
@@ -680,8 +902,21 @@ var init_egress_guard = __esm(() => {
680
902
  const size = 2 ** (32 - bits);
681
903
  return { start: parseIPv4(network), size };
682
904
  });
905
+ EgressDeniedError = class EgressDeniedError extends Error {
906
+ constructor(message) {
907
+ super(message);
908
+ this.name = "EgressDeniedError";
909
+ }
910
+ };
683
911
  REDIRECT_STATUSES = new Set([301, 302, 303, 307, 308]);
912
+ CREDENTIAL_HEADERS = ["authorization", "cookie", "proxy-authorization"];
684
913
  MAX_REPLAY_BODY_BYTES = 1024 * 1024;
914
+ RequestBodyTooLargeError = class RequestBodyTooLargeError extends Error {
915
+ constructor(limitBytes) {
916
+ super(`Cannot resend a streamed request body over ${limitBytes / (1024 * 1024)} MiB on a 307/308 redirect: it is sent as it is read, not kept in memory. Send a smaller or non-streamed body, or use redirect: "manual"`);
917
+ this.name = "RequestBodyTooLargeError";
918
+ }
919
+ };
685
920
  });
686
921
 
687
922
  // src/scripts-runtime/credential-broker/fetch-patch.ts
@@ -1164,7 +1399,7 @@ class BunSqliteClient {
1164
1399
  }
1165
1400
  async runTransactionAttempt(fn, readOnly, finalAttempt = false, deadlineAt) {
1166
1401
  const release = await this.lock.acquire();
1167
- const ctx = { closed: false, afterCommit: [] };
1402
+ const ctx = { closed: false, afterCommit: [], afterRollback: [] };
1168
1403
  let began = false;
1169
1404
  try {
1170
1405
  const db = this.getDatabase();
@@ -1197,6 +1432,13 @@ class BunSqliteClient {
1197
1432
  try {
1198
1433
  this.getDatabase().run("ROLLBACK");
1199
1434
  } catch {}
1435
+ for (const hook of ctx.afterRollback) {
1436
+ try {
1437
+ hook();
1438
+ } catch (hookErr) {
1439
+ console.error("[db-client] afterRollback hook threw:", hookErr);
1440
+ }
1441
+ }
1200
1442
  }
1201
1443
  throw err;
1202
1444
  } finally {
@@ -1212,6 +1454,11 @@ class BunSqliteClient {
1212
1454
  }
1213
1455
  this.scheduleHook(fn);
1214
1456
  }
1457
+ afterRollback(fn) {
1458
+ const ctx = txContext.getStore();
1459
+ if (ctx && !ctx.closed)
1460
+ ctx.afterRollback.push(fn);
1461
+ }
1215
1462
  scheduleHook(fn) {
1216
1463
  this.lock.acquire().then((release) => {
1217
1464
  release();
@@ -2092,6 +2339,10 @@ var init_seed_prompt_templates = __esm(() => {
2092
2339
 
2093
2340
  // src/be/db/runtime.ts
2094
2341
  import { Database } from "bun:sqlite";
2342
+ function wasDbCreatedThisBoot() {
2343
+ getDb2();
2344
+ return dbCreatedThisBoot;
2345
+ }
2095
2346
  function isSqliteVecAvailable2() {
2096
2347
  return sqliteVecAvailable;
2097
2348
  }
@@ -2162,6 +2413,7 @@ function initDb2(dbPath = "./agent-swarm-db.sqlite") {
2162
2413
  }
2163
2414
  }
2164
2415
  function bootOpenedDb(database, dbPath, resolvePromptTemplate, autoEncryptLegacyPlaintextSecrets) {
2416
+ dbCreatedThisBoot = database.prepare("SELECT 1 FROM sqlite_master LIMIT 1").get() === null;
2165
2417
  database.run("PRAGMA journal_mode = WAL;");
2166
2418
  database.run("PRAGMA busy_timeout = 5000;");
2167
2419
  database.run("PRAGMA foreign_keys = ON;");
@@ -2275,6 +2527,7 @@ function closeDb2() {
2275
2527
  db = null;
2276
2528
  }
2277
2529
  sqliteVecAvailable = false;
2530
+ dbCreatedThisBoot = false;
2278
2531
  }
2279
2532
  function getDbClient2() {
2280
2533
  if (!dbClientInstance) {
@@ -2320,7 +2573,7 @@ function seedContextVersions() {
2320
2573
  }
2321
2574
  }
2322
2575
  }
2323
- var db = null, sqliteVecAvailable = false, cachedSqliteVecExtensionPath = null, dbClientInstance = null, VERSIONABLE_FIELDS;
2576
+ var db = null, sqliteVecAvailable = false, dbCreatedThisBoot = false, cachedSqliteVecExtensionPath = null, dbClientInstance = null, VERSIONABLE_FIELDS;
2324
2577
  var init_runtime2 = __esm(() => {
2325
2578
  init_resolver();
2326
2579
  init_types5();
@@ -5438,7 +5691,7 @@ var init_telemetry = __esm(() => {
5438
5691
  // src/telemetry-identity.ts
5439
5692
  async function loadUserRole(userId) {
5440
5693
  try {
5441
- const { getUserGrant } = await import("./rbac-roles-9v6vhgbs.js");
5694
+ const { getUserGrant } = await import("./rbac-roles-84aw10nz.js");
5442
5695
  const grant = await getUserGrant(userId);
5443
5696
  const role = grant.grantsAll ? "admin" : "member";
5444
5697
  const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
@@ -5963,18 +6216,26 @@ async function updateAgentCredentialMissing2(agentId, missing) {
5963
6216
  const json = missing && missing.length > 0 ? JSON.stringify(missing) : null;
5964
6217
  await getDbClient2().run("UPDATE agents SET credentialMissing = ?, lastUpdatedAt = strftime('%Y-%m-%dT%H:%M:%fZ', 'now') WHERE id = ?", [json, agentId]);
5965
6218
  }
6219
+ async function isAgentDeleted2(agentId) {
6220
+ const last = await getDbClient2().get("SELECT event FROM agent_history WHERE agent_id = ? ORDER BY created_at DESC, rowid DESC LIMIT 1", [agentId]);
6221
+ return last?.event === "deleted";
6222
+ }
5966
6223
  async function createAgent2(agent) {
5967
6224
  const id = agent.id ?? crypto.randomUUID();
5968
6225
  const maxTasks = agent.maxTasks ?? 1;
5969
- const row = await getDbClient2().get("INSERT INTO agents (id, name, isLead, status, maxTasks, provider, harness_provider, createdAt, lastUpdatedAt) VALUES (?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'), strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) RETURNING *", [
5970
- id,
5971
- agent.name,
5972
- agent.isLead ? 1 : 0,
5973
- agent.status,
5974
- maxTasks,
5975
- agent.provider ?? null,
5976
- agent.harnessProvider ?? null
5977
- ]);
6226
+ const row = await getDbClient2().transaction(async () => {
6227
+ if (await isAgentDeleted2(id))
6228
+ throw new AgentDeletedError2(id);
6229
+ return await getDbClient2().get("INSERT INTO agents (id, name, isLead, status, maxTasks, provider, harness_provider, createdAt, lastUpdatedAt) VALUES (?, ?, ?, ?, ?, ?, ?, strftime('%Y-%m-%dT%H:%M:%fZ', 'now'), strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) RETURNING *", [
6230
+ id,
6231
+ agent.name,
6232
+ agent.isLead ? 1 : 0,
6233
+ agent.status,
6234
+ maxTasks,
6235
+ agent.provider ?? null,
6236
+ agent.harnessProvider ?? null
6237
+ ]);
6238
+ });
5978
6239
  if (!row)
5979
6240
  throw new Error("Failed to create agent");
5980
6241
  try {
@@ -6201,11 +6462,19 @@ async function getAgentDailyTaskCounts2(agentId, days) {
6201
6462
  GROUP BY date
6202
6463
  ORDER BY date`, [agentId, since]);
6203
6464
  }
6204
- var dependencies, EXTENSION_AGENT_ROLE2 = "extension", NOT_EXTENSION_AGENT_SQL2, ReservedAgentRoleError2, ExtensionAgentAssignmentError2, MAX_EMPTY_POLLS2 = 2;
6465
+ var dependencies, AgentDeletedError2, EXTENSION_AGENT_ROLE2 = "extension", NOT_EXTENSION_AGENT_SQL2, ReservedAgentRoleError2, ExtensionAgentAssignmentError2, MAX_EMPTY_POLLS2 = 2;
6205
6466
  var init_agents = __esm(() => {
6206
6467
  init_types5();
6207
6468
  init_env_flag();
6208
6469
  init_runtime2();
6470
+ AgentDeletedError2 = class AgentDeletedError2 extends Error {
6471
+ agentId;
6472
+ constructor(agentId) {
6473
+ super(`Agent "${agentId}" was deleted by an operator. Restore it first.`);
6474
+ this.agentId = agentId;
6475
+ this.name = "AgentDeletedError";
6476
+ }
6477
+ };
6209
6478
  NOT_EXTENSION_AGENT_SQL2 = `COALESCE(role, '') != '${EXTENSION_AGENT_ROLE2}'`;
6210
6479
  ReservedAgentRoleError2 = class ReservedAgentRoleError2 extends Error {
6211
6480
  constructor(message) {
@@ -6310,7 +6579,7 @@ function scheduleApprovalCardUpdates(approvals) {
6310
6579
  const posted = approvals.filter((approval) => approval.notificationChannels?.some((n) => n.channel === "slack" && n.messageTs));
6311
6580
  if (posted.length === 0)
6312
6581
  return;
6313
- getDbClient2().afterCommit(() => import("./approval-notifications-7mqr6vbd.js").then(({ updateResolvedApprovalCards }) => updateResolvedApprovalCards(posted)).catch((err) => console.error("[HITL] Slack card update not run:", scrubSecrets(err instanceof Error ? err.message : String(err)))));
6582
+ getDbClient2().afterCommit(() => import("./approval-notifications-3g6yc8nv.js").then(({ updateResolvedApprovalCards }) => updateResolvedApprovalCards(posted)).catch((err) => console.error("[HITL] Slack card update not run:", scrubSecrets(err instanceof Error ? err.message : String(err)))));
6314
6583
  }
6315
6584
  var init_approvals = __esm(() => {
6316
6585
  init_secret_scrubber();
@@ -6699,6 +6968,7 @@ var init_legacy_policy = __esm(() => {
6699
6968
  "runtime_pool.bind": leadOrOperatorOrUser,
6700
6969
  "runtime_controller.write": operatorOrUser,
6701
6970
  "agent.token.manage": operatorOrUser,
6971
+ "agent.lifecycle.manage": operatorOrUser,
6702
6972
  "user.role.manage": operatorOrUser,
6703
6973
  "extension.write": extensionWrite,
6704
6974
  "extension.activate": extensionActivation,
@@ -6753,6 +7023,10 @@ var init_permissions = __esm(() => {
6753
7023
  description: "Mint, rotate, or revoke an agent-bound worker token.",
6754
7024
  namespace: "agent"
6755
7025
  },
7026
+ "agent.lifecycle.manage": {
7027
+ description: "Preview, soft-delete, or restore an agent, list deleted agents, and read their delete/restore audit.",
7028
+ namespace: "agent"
7029
+ },
6756
7030
  "user.role.manage": {
6757
7031
  description: "Assign or remove a person's RBAC roles.",
6758
7032
  namespace: "user"
@@ -11326,7 +11600,9 @@ async function closeSlackTreeIfSettled(id) {
11326
11600
  WHERE tree.id = ?
11327
11601
  AND tree.kind = 'tree'
11328
11602
  AND tree.closed_at IS NULL
11329
- AND tree.ts NOT LIKE 'pending:%'
11603
+ AND (tree.ts NOT LIKE 'pending:%' OR EXISTS (
11604
+ SELECT 1 FROM slack_render_v2_state state WHERE state.id = 1 AND NOT ${SLACK_TREE_VISIBLE_SQL}
11605
+ ))
11330
11606
  AND EXISTS (
11331
11607
  SELECT 1 FROM slack_render_v2_state state
11332
11608
  WHERE state.id = 1 AND NOT ${SLACK_TREE_NEEDS_RENDER_SQL}
@@ -11353,7 +11629,19 @@ async function getSlackThreadsOfTasks(taskIds) {
11353
11629
  }
11354
11630
  return { threads: [...threads.values()], wakeTouched };
11355
11631
  }
11356
- async function slackThreadHasOutcomeWork(thread) {
11632
+ async function slackThreadHasBotReplySince(channelId, threadTs, since, taskId) {
11633
+ const row = await getDbClient2().get(`SELECT EXISTS (
11634
+ SELECT 1 FROM slack_messages reply
11635
+ WHERE reply.channel_id = ? AND reply.thread_ts = ? AND reply.created_at >= ?
11636
+ AND (reply.kind = 'agent'
11637
+ OR (reply.kind = 'outcome' AND reply.finalized_at IS NOT NULL AND reply.task_id != ?))
11638
+ ) AS found`, [channelId, threadTs, since, taskId]);
11639
+ return !!row?.found;
11640
+ }
11641
+ function slackOutcomeWindowParams(window2) {
11642
+ return [window2.finishedAfter, Number(window2.delegationEnabled), window2.closureActiveAfter];
11643
+ }
11644
+ async function slackThreadHasOutcomeWork(thread, window2) {
11357
11645
  const row = await getDbClient2().get(`SELECT EXISTS (
11358
11646
  SELECT 1 FROM agent_tasks task, slack_render_v2_state state
11359
11647
  WHERE state.id = 1
@@ -11361,6 +11649,7 @@ async function slackThreadHasOutcomeWork(thread) {
11361
11649
  AND task.source = 'slack'
11362
11650
  AND task.createdAt >= state.activated_at
11363
11651
  AND task.status IN ('completed', 'failed', 'cancelled')
11652
+ AND ${SLACK_OUTCOME_WINDOW_SQL}
11364
11653
  AND NOT EXISTS (
11365
11654
  SELECT 1 FROM slack_messages outcome
11366
11655
  WHERE outcome.kind = 'outcome'
@@ -11372,10 +11661,116 @@ async function slackThreadHasOutcomeWork(thread) {
11372
11661
  WHERE outcome.kind = 'outcome'
11373
11662
  AND outcome.channel_id = ? AND outcome.thread_ts = ?
11374
11663
  AND outcome.finalized_at IS NULL AND outcome.delivery_abandoned_at IS NULL
11375
- ) AS pending`, [thread.channelId, thread.threadTs, thread.channelId, thread.threadTs]);
11664
+ ) AS pending`, [
11665
+ thread.channelId,
11666
+ thread.threadTs,
11667
+ ...slackOutcomeWindowParams(window2),
11668
+ thread.channelId,
11669
+ thread.threadTs
11670
+ ]);
11376
11671
  return !!row?.pending;
11377
11672
  }
11378
- var SLACK_TREE_NEEDS_RENDER_SQL = `(
11673
+ async function observeSlackTreeVisibility(enabled) {
11674
+ const current = await getDbClient2().get("SELECT task_tree_enabled, task_tree_enabled_at FROM slack_render_v2_state WHERE id = 1");
11675
+ if (!current || current.task_tree_enabled === Number(enabled)) {
11676
+ return current?.task_tree_enabled_at ?? null;
11677
+ }
11678
+ const row = await getDbClient2().get(`UPDATE slack_render_v2_state SET
11679
+ task_tree_enabled_at = CASE WHEN task_tree_enabled = 0 AND ? = 1
11680
+ THEN ? ELSE task_tree_enabled_at END,
11681
+ task_tree_enabled = ?
11682
+ WHERE id = 1 RETURNING task_tree_enabled_at`, [Number(enabled), new Date().toISOString(), Number(enabled)]);
11683
+ return row?.task_tree_enabled_at ?? null;
11684
+ }
11685
+ async function getSlackProcessingThreads(delegationEnabled, treesEnabled, window2) {
11686
+ return getDbClient2().transaction(async () => {
11687
+ const state = await getDbClient2().get("SELECT reconcile_cursors FROM slack_render_v2_state WHERE id = 1");
11688
+ if (!state)
11689
+ return [];
11690
+ const cursors = JSON.parse(state.reconcile_cursors);
11691
+ const threads = new Map;
11692
+ async function page(source, sql, extra = []) {
11693
+ const rows = await getDbClient2().query(sql, [cursors[source] ?? "", SLACK_RECONCILE_PAGE_SIZE, ...extra]);
11694
+ cursors[source] = rows.length < SLACK_RECONCILE_PAGE_SIZE ? "" : rows.at(-1).id;
11695
+ for (const row of rows) {
11696
+ if (row.eligible)
11697
+ threads.set(`${row.channelId}\x00${row.threadTs}`, {
11698
+ channelId: row.channelId,
11699
+ threadTs: row.threadTs
11700
+ });
11701
+ }
11702
+ }
11703
+ await page("active", `WITH candidates AS MATERIALIZED (
11704
+ SELECT id, slackChannelId, slackThreadTs, createdAt FROM agent_tasks INDEXED BY idx_slack_reconcile_active
11705
+ WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
11706
+ AND status IN ('offered', 'reviewing', 'pending', 'in_progress', 'paused')
11707
+ AND id > ? ORDER BY id LIMIT ?
11708
+ ) SELECT task.id, task.slackChannelId AS channelId, task.slackThreadTs AS threadTs,
11709
+ task.createdAt >= state.activated_at AS eligible
11710
+ FROM candidates task, slack_render_v2_state state WHERE state.id = 1 ORDER BY task.id`);
11711
+ await page("terminal", `WITH candidates AS MATERIALIZED (
11712
+ SELECT * FROM agent_tasks INDEXED BY idx_slack_reconcile_terminal
11713
+ WHERE slackChannelId IS NOT NULL AND slackThreadTs IS NOT NULL
11714
+ AND status IN ('completed', 'failed', 'cancelled')
11715
+ AND id > ? ORDER BY id LIMIT ?
11716
+ ) SELECT task.id, task.slackChannelId AS channelId, task.slackThreadTs AS threadTs,
11717
+ (task.createdAt >= state.activated_at
11718
+ AND (task.source = 'slack'
11719
+ OR (task.source = 'schedule' AND task.taskType = 'deferred')
11720
+ OR (? = 1 AND task.parentTaskId IS NOT NULL AND task.createdAt >= state.delegation_activated_at
11721
+ AND task.status IN ('completed', 'failed') AND task.slackReplySent = 0
11722
+ AND COALESCE(task.taskType, '') NOT IN ('follow-up', 'reroute-decision')))
11723
+ AND ${SLACK_OUTCOME_WINDOW_SQL}
11724
+ AND NOT (task.source = 'schedule' AND task.taskType = 'deferred'
11725
+ AND ${SLACK_WAKE_ALREADY_ANSWERED_SQL})
11726
+ AND NOT EXISTS (
11727
+ SELECT 1 FROM agent_tasks parent JOIN slack_messages parent_card ON parent_card.task_id = parent.id
11728
+ WHERE task.source = 'schedule' AND task.taskType = 'deferred' AND parent.id = task.parentTaskId
11729
+ AND parent.deferredAt IS NOT NULL AND parent_card.kind = 'outcome'
11730
+ AND parent_card.finalized_at IS NOT NULL AND parent_card.deferral_abandoned_at IS NULL
11731
+ )
11732
+ AND NOT EXISTS (SELECT 1 FROM slack_messages card WHERE card.kind = 'outcome'
11733
+ AND card.task_id = task.id
11734
+ AND (card.finalized_at IS NOT NULL OR card.delivery_abandoned_at IS NOT NULL))) AS eligible
11735
+ FROM candidates task, slack_render_v2_state state WHERE state.id = 1 ORDER BY task.id`, [Number(delegationEnabled), ...slackOutcomeWindowParams(window2)]);
11736
+ await page("outcome", `SELECT id, channel_id AS channelId, thread_ts AS threadTs, 1 AS eligible
11737
+ FROM slack_messages INDEXED BY idx_slack_reconcile_outcome
11738
+ WHERE kind = 'outcome' AND finalized_at IS NULL AND delivery_abandoned_at IS NULL
11739
+ AND id > ? ORDER BY id LIMIT ?`);
11740
+ if (treesEnabled)
11741
+ await page("tree", `WITH candidates AS MATERIALIZED (
11742
+ SELECT * FROM slack_messages INDEXED BY idx_slack_reconcile_tree
11743
+ WHERE kind = 'tree' AND closed_at IS NULL AND id > ? ORDER BY id LIMIT ?
11744
+ ) SELECT tree.id, tree.channel_id AS channelId, tree.thread_ts AS threadTs,
11745
+ ${SLACK_TREE_NEEDS_RENDER_SQL} AS eligible
11746
+ FROM candidates tree, slack_render_v2_state state WHERE state.id = 1 ORDER BY tree.id`);
11747
+ const next = JSON.stringify(cursors);
11748
+ if (next !== state.reconcile_cursors)
11749
+ await getDbClient2().run("UPDATE slack_render_v2_state SET reconcile_cursors = ? WHERE id = 1", [next]);
11750
+ return [...threads.values()];
11751
+ });
11752
+ }
11753
+ var SLACK_TREE_VISIBLE_SQL = `(COALESCE(state.task_tree_enabled, 1) = 1 AND (
11754
+ state.task_tree_enabled_at IS NULL OR EXISTS (
11755
+ SELECT 1 FROM agent_tasks visible_task
11756
+ WHERE visible_task.slackChannelId = tree.channel_id
11757
+ AND visible_task.slackThreadTs = tree.thread_ts
11758
+ AND (visible_task.status NOT IN ('completed', 'failed', 'cancelled', 'superseded', 'skipped')
11759
+ OR visible_task.finishedAt > state.task_tree_enabled_at)
11760
+ )
11761
+ ))`, SLACK_TREE_NEEDS_RENDER_SQL, THREAD_LOOKUP_CHUNK = 500, SLACK_OUTCOME_WINDOW_SQL = `(COALESCE(task.finishedAt, task.lastUpdatedAt) >= ?
11762
+ OR (? = 1 AND task.source = 'slack' AND task.createdAt >= state.delegation_activated_at
11763
+ AND EXISTS (SELECT 1 FROM agent_tasks recent
11764
+ WHERE recent.slackChannelId = task.slackChannelId AND recent.slackThreadTs = task.slackThreadTs
11765
+ AND recent.lastUpdatedAt >= ?)))`, SLACK_WAKE_ALREADY_ANSWERED_SQL = `(task.slackReplySent = 1 OR EXISTS (
11766
+ SELECT 1 FROM slack_messages reply
11767
+ WHERE reply.channel_id = task.slackChannelId AND reply.thread_ts = task.slackThreadTs
11768
+ AND reply.created_at >= task.createdAt
11769
+ AND (reply.kind = 'agent'
11770
+ OR (reply.kind = 'outcome' AND reply.finalized_at IS NOT NULL AND reply.task_id != task.id))))`, SLACK_RECONCILE_PAGE_SIZE = 50;
11771
+ var init_slack_trees = __esm(() => {
11772
+ init_db4();
11773
+ SLACK_TREE_NEEDS_RENDER_SQL = `(${SLACK_TREE_VISIBLE_SQL} AND (
11379
11774
  (tree.ts LIKE 'pending:%' AND tree.created_at >= state.activated_at)
11380
11775
  OR EXISTS (
11381
11776
  SELECT 1 FROM agent_tasks task
@@ -11418,9 +11813,7 @@ var SLACK_TREE_NEEDS_RENDER_SQL = `(
11418
11813
  OR outcome.updated_at > tree.updated_at
11419
11814
  )
11420
11815
  )
11421
- )`, THREAD_LOOKUP_CHUNK = 500;
11422
- var init_slack_trees = __esm(() => {
11423
- init_db4();
11816
+ ))`;
11424
11817
  });
11425
11818
 
11426
11819
  // src/be/db/tasks/eligibility-scan.ts
@@ -11860,7 +12253,7 @@ async function startTask2(taskId) {
11860
12253
  }
11861
12254
  const result = row ? rowToAgentTask(row) : null;
11862
12255
  if (result && oldTask.status !== "in_progress") {
11863
- emitTaskStarted(result);
12256
+ getDbClient2().afterCommit(() => emitTaskStarted(result));
11864
12257
  }
11865
12258
  return result;
11866
12259
  }
@@ -11989,7 +12382,7 @@ async function completeTask2(id, output, options) {
11989
12382
  });
11990
12383
  } catch {}
11991
12384
  getDbClient2().afterCommit(() => {
11992
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
12385
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
11993
12386
  workflowEventBus.emit("task.completed", {
11994
12387
  taskId: id,
11995
12388
  output: scrubbedOutput,
@@ -12044,7 +12437,7 @@ async function failTask2(id, reason, opts = {}) {
12044
12437
  });
12045
12438
  } catch {}
12046
12439
  getDbClient2().afterCommit(() => {
12047
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
12440
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12048
12441
  workflowEventBus.emit("task.failed", {
12049
12442
  taskId: id,
12050
12443
  failureReason: scrubbedReason,
@@ -12126,7 +12519,7 @@ async function cancelTask2(id, reason, options = {}) {
12126
12519
  });
12127
12520
  } catch {}
12128
12521
  getDbClient2().afterCommit(() => {
12129
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
12522
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12130
12523
  workflowEventBus.emit("task.cancelled", {
12131
12524
  taskId: id,
12132
12525
  agentId: row.agentId,
@@ -12138,7 +12531,7 @@ async function cancelTask2(id, reason, options = {}) {
12138
12531
  if (row.source === "schedule" && row.taskType === "deferred" && row.parentTaskId) {
12139
12532
  getDbClient2().afterCommit(async () => {
12140
12533
  try {
12141
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-y3xeg89w.js");
12534
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-9z2xec5e.js");
12142
12535
  await createWorkerTaskFollowUp({
12143
12536
  task: rowToAgentTask(row),
12144
12537
  status: "failed",
@@ -12187,7 +12580,7 @@ async function skipTask2(id, reason) {
12187
12580
  });
12188
12581
  } catch {}
12189
12582
  getDbClient2().afterCommit(() => {
12190
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
12583
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12191
12584
  workflowEventBus.emit("task.skipped", {
12192
12585
  taskId: id,
12193
12586
  failureReason: skipReason,
@@ -12239,7 +12632,7 @@ async function supersedeTask2(id, args) {
12239
12632
  });
12240
12633
  } catch {}
12241
12634
  getDbClient2().afterCommit(() => {
12242
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
12635
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12243
12636
  workflowEventBus.emit("task.superseded", {
12244
12637
  taskId: id,
12245
12638
  reason: args.reason,
@@ -12474,7 +12867,7 @@ async function updateTaskProgress2(id, progress) {
12474
12867
  });
12475
12868
  } catch {}
12476
12869
  getDbClient2().afterCommit(() => {
12477
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
12870
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12478
12871
  workflowEventBus.emit("task.progress", {
12479
12872
  taskId: id,
12480
12873
  progress: scrubbedProgress,
@@ -13043,7 +13436,7 @@ function emitRunFinished(runId, workflowId, status) {
13043
13436
  }
13044
13437
  function emitBusEventAfterCommit(event, payload) {
13045
13438
  getDbClient2().afterCommit(() => {
13046
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
13439
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
13047
13440
  workflowEventBus.emit(event, payload);
13048
13441
  }).catch((err) => console.error(`[db] ${event} event not emitted:`, scrubSecrets(err instanceof Error ? err.message : String(err))));
13049
13442
  });
@@ -13404,11 +13797,26 @@ function normalizeSlackReactionShortcode(raw) {
13404
13797
  }
13405
13798
  function reactionName(event) {
13406
13799
  const raw = process.env[SLACK_REACTION_CONFIG_KEYS[event]];
13800
+ if (raw !== undefined && raw.trim() === "")
13801
+ return null;
13407
13802
  const normalized = normalizeSlackReactionShortcode(raw);
13408
13803
  return normalized ?? SLACK_REACTION_DEFAULTS[event];
13409
13804
  }
13805
+ function isSlackIconConfigKey(key) {
13806
+ return key === SLACK_STATUS_ICON_COMPLETED_KEY || Object.values(SLACK_REACTION_CONFIG_KEYS).includes(key);
13807
+ }
13808
+ function reactionStatusIcon(event) {
13809
+ const name = reactionName(event);
13810
+ return name === null ? "" : `:${name}:`;
13811
+ }
13812
+ function iconPrefix(icon) {
13813
+ return icon ? `${icon} ` : "";
13814
+ }
13410
13815
  function completedStatusIcon() {
13411
- const normalized = normalizeSlackReactionShortcode(process.env[SLACK_STATUS_ICON_COMPLETED_KEY]);
13816
+ const raw = process.env[SLACK_STATUS_ICON_COMPLETED_KEY];
13817
+ if (raw !== undefined && raw.trim() === "")
13818
+ return "";
13819
+ const normalized = normalizeSlackReactionShortcode(raw);
13412
13820
  return normalized ? `:${normalized}:` : SLACK_STATUS_ICON_COMPLETED_DEFAULT;
13413
13821
  }
13414
13822
  var SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, SLACK_REACTION_SHORTCODE_PATTERN, SLACK_STATUS_ICON_COMPLETED_KEY = "SLACK_STATUS_ICON_COMPLETED", SLACK_STATUS_ICON_COMPLETED_DEFAULT = "✅";
@@ -13584,10 +13992,10 @@ function enumValidator(key, options) {
13584
13992
  };
13585
13993
  }
13586
13994
  function shortcodeValidators(keys) {
13587
- const message = (key) => `Invalid ${key} (must be a Slack emoji shortcode: lowercase letters, digits, _ + ' -, with optional surrounding colons)`;
13995
+ const message = (key) => `Invalid ${key} (must be empty to disable, or a Slack emoji shortcode: lowercase letters, digits, _ + ' -, with optional surrounding colons)`;
13588
13996
  return Object.fromEntries(keys.map((key) => [
13589
13997
  key,
13590
- (value) => normalizeSlackReactionShortcode(value) !== null ? null : message(key)
13998
+ (value) => typeof value === "string" && (value.trim() === "" || normalizeSlackReactionShortcode(value) !== null) ? null : message(key)
13591
13999
  ]));
13592
14000
  }
13593
14001
  function integerValidators(keys, min) {
@@ -13730,7 +14138,8 @@ var init_swarm_config_guard = __esm(() => {
13730
14138
  "DESPLEGA_TELEMETRY_ENDPOINT",
13731
14139
  "CLOUDFLARE_API_BASE_URL",
13732
14140
  "GITHUB_URL",
13733
- "GITHUB_API_URL"
14141
+ "GITHUB_API_URL",
14142
+ "GITHUB_APP_INSTALLATION_ID"
13734
14143
  ]);
13735
14144
  API_ONLY_CONFIG_KEYS = new Set([
13736
14145
  "API_AGENT_FS_API_KEY",
@@ -13926,6 +14335,7 @@ var init_swarm_config_guard = __esm(() => {
13926
14335
  "SLACK_DISABLE",
13927
14336
  "CHAT_SDK_ENABLED",
13928
14337
  "SLACK_RENDER_V2",
14338
+ "SLACK_RENDER_V2_TASK_TREE_ENABLED",
13929
14339
  "SLACK_RENDER_V2_DELEGATION",
13930
14340
  "SLACK_BLOCK_EXTERNAL_CHANNELS",
13931
14341
  "GITHUB_DISABLE",
@@ -14012,6 +14422,7 @@ var init_swarm_config_guard = __esm(() => {
14012
14422
  "AGENT_LOG_RETENTION_DAYS",
14013
14423
  "EVENTS_RETENTION_DAYS",
14014
14424
  "SCRIPT_RUNS_RETENTION_DAYS",
14425
+ "WORKFLOW_RUNS_RETENTION_DAYS",
14015
14426
  "CONTEXT_VERSIONS_KEEP_LATEST"
14016
14427
  ], 1, MAX_DB_RETENTION_DAYS),
14017
14428
  ...integerValidators(["HEARTBEAT_MAX_AUTO_ASSIGN"], 0),
@@ -22658,7 +23069,7 @@ function noteEmbeddingSuccess() {
22658
23069
  const report = (what) => (err) => {
22659
23070
  console.error(`[memory] ${what} backfill after embeddings recovered failed:`, err.message);
22660
23071
  };
22661
- backfill2 = import("./embedding-space-e48xchqa.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
23072
+ backfill2 = import("./embedding-space-kcdn52vz.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
22662
23073
  backfill2 = null;
22663
23074
  });
22664
23075
  }
@@ -23054,6 +23465,21 @@ function parseTags(raw) {
23054
23465
  return [];
23055
23466
  }
23056
23467
  }
23468
+ function notReviewTaskCompletionSql(memoryAlias = "") {
23469
+ const col = (name) => memoryAlias ? `${memoryAlias}.${name}` : name;
23470
+ return {
23471
+ sql: `NOT (${col("source")} = 'task_completion' AND EXISTS (
23472
+ SELECT 1 FROM agent_tasks rt
23473
+ WHERE rt.id = ${col("sourceTaskId")}
23474
+ AND (rt.taskType = ?
23475
+ OR CASE WHEN json_valid(rt.tags)
23476
+ THEN json_type(rt.tags) = 'array' AND EXISTS (
23477
+ SELECT 1 FROM json_each(rt.tags)
23478
+ WHERE value IN (${REVIEW_TASK_TAGS.map(() => "?").join(",")}))
23479
+ ELSE 0 END)))`,
23480
+ params: [REVIEW_TASK_TYPE, ...REVIEW_TASK_TAGS]
23481
+ };
23482
+ }
23057
23483
  async function isReviewTaskId(taskId) {
23058
23484
  if (!taskId)
23059
23485
  return false;
@@ -23098,11 +23524,8 @@ function countCandidateDocuments(candidates) {
23098
23524
  }
23099
23525
  return standalone + documents.size;
23100
23526
  }
23101
- async function searchMemoryCandidates(store, embedding, agentId, {
23102
- excludeReviewTaskCompletions = false,
23103
- ...options
23104
- }) {
23105
- const keep = (rows) => excludeReviewTaskCompletions ? dropReviewTaskCompletions(rows) : Promise.resolve(rows);
23527
+ async function searchMemoryCandidates(store, embedding, agentId, options) {
23528
+ const keep = (rows) => options.excludeReviewTaskCompletions ? dropReviewTaskCompletions(rows) : Promise.resolve(rows);
23106
23529
  let fetchLimit = options.limit;
23107
23530
  let raw = await store.search(embedding, agentId, { ...options, limit: fetchLimit });
23108
23531
  let rows = await keep(raw);
@@ -23217,6 +23640,7 @@ class SqliteMemoryStore {
23217
23640
  ftsInitialized = false;
23218
23641
  ftsPopulate = null;
23219
23642
  lastPopulate = null;
23643
+ searchHealthCache = null;
23220
23644
  constructor() {
23221
23645
  this.ensureVecTable();
23222
23646
  this.ensureFtsTable();
@@ -23304,16 +23728,19 @@ class SqliteMemoryStore {
23304
23728
  whenFtsPopulated() {
23305
23729
  return this.ftsPopulate ?? Promise.resolve();
23306
23730
  }
23307
- async syncFtsRow(memoryId, name, content) {
23731
+ async syncFtsRow(memoryId, name, content, freshId = false) {
23308
23732
  if (!this.ftsInitialized && !await this.getFtsTableSchema())
23309
23733
  return;
23310
23734
  try {
23311
- await getDbClient2().run("DELETE FROM memory_fts WHERE memory_id = ?", [memoryId]);
23312
- await getDbClient2().run("INSERT INTO memory_fts(memory_id, name, content) VALUES (?, ?, ?)", [
23313
- memoryId,
23314
- name,
23315
- content
23316
- ]);
23735
+ await getDbClient2().transaction(async (tx) => {
23736
+ if (!freshId)
23737
+ await tx.run("DELETE FROM memory_fts WHERE memory_id = ?", [memoryId]);
23738
+ await tx.run("INSERT INTO memory_fts(memory_id, name, content) VALUES (?, ?, ?)", [
23739
+ memoryId,
23740
+ name,
23741
+ content
23742
+ ]);
23743
+ });
23317
23744
  } catch (err) {
23318
23745
  console.error(`[memory-fts] sync failed memory_id=${memoryId}: ${err.message}`);
23319
23746
  }
@@ -23400,6 +23827,7 @@ class SqliteMemoryStore {
23400
23827
  }
23401
23828
  }
23402
23829
  const afterCount = this.getVecCount();
23830
+ this.searchHealthCache = null;
23403
23831
  this.lastPopulate = {
23404
23832
  attempted,
23405
23833
  inserted,
@@ -23475,9 +23903,9 @@ class SqliteMemoryStore {
23475
23903
  input.agentId ?? null,
23476
23904
  input.agentId ?? null
23477
23905
  ]);
23906
+ await this.syncFtsRow(inserted.id, inserted.name, inserted.content, true);
23478
23907
  return inserted;
23479
23908
  });
23480
- await this.syncFtsRow(row.id, row.name, row.content);
23481
23909
  return rowToAgentMemory(row);
23482
23910
  }
23483
23911
  async storeBatch(inputs) {
@@ -23532,7 +23960,8 @@ class SqliteMemoryStore {
23532
23960
  source,
23533
23961
  isLead = false,
23534
23962
  includeExpired = false,
23535
- keyPrefix
23963
+ keyPrefix,
23964
+ excludeReviewTaskCompletions
23536
23965
  } = options;
23537
23966
  if (options.exhaustive) {
23538
23967
  return this.searchExhaustive(embedding, agentId, {
@@ -23542,10 +23971,11 @@ class SqliteMemoryStore {
23542
23971
  isLead,
23543
23972
  includeExpired,
23544
23973
  keyPrefix,
23974
+ excludeReviewTaskCompletions,
23545
23975
  minSimilarity: options.minSimilarity
23546
23976
  });
23547
23977
  }
23548
- const health = this.getHealth();
23978
+ const health = this.searchHealth();
23549
23979
  if (isHybridSearchEnabled() && options.queryText && this.ftsInitialized && await this.getFtsTableSchema() && health.retrievalMode === "vec" && embedding.length === EMBEDDING_DIMENSIONS) {
23550
23980
  console.log(`[memory-search] retrieval_path=hybrid scope=${scope} limit=${limit} vec_rows=${health.counts.memoryVec} searchable=${health.counts.searchable}`);
23551
23981
  return this.searchHybrid(embedding, options.queryText, agentId, {
@@ -23554,7 +23984,8 @@ class SqliteMemoryStore {
23554
23984
  source,
23555
23985
  isLead,
23556
23986
  includeExpired,
23557
- keyPrefix
23987
+ keyPrefix,
23988
+ excludeReviewTaskCompletions
23558
23989
  });
23559
23990
  }
23560
23991
  if (health.retrievalMode === "vec" && embedding.length === EMBEDDING_DIMENSIONS) {
@@ -23566,6 +23997,7 @@ class SqliteMemoryStore {
23566
23997
  isLead,
23567
23998
  includeExpired,
23568
23999
  keyPrefix,
24000
+ excludeReviewTaskCompletions,
23569
24001
  minSimilarity: options.minSimilarity
23570
24002
  });
23571
24003
  }
@@ -23577,7 +24009,8 @@ class SqliteMemoryStore {
23577
24009
  source,
23578
24010
  isLead,
23579
24011
  includeExpired,
23580
- keyPrefix
24012
+ keyPrefix,
24013
+ excludeReviewTaskCompletions
23581
24014
  });
23582
24015
  }
23583
24016
  console.log(`[memory-search] retrieval_path=fallback scope=${scope} limit=${limit} reason=${embedding.length !== EMBEDDING_DIMENSIONS ? "query_dimension_mismatch" : health.reasons.join("|") || "vec_unavailable"}`);
@@ -23588,6 +24021,7 @@ class SqliteMemoryStore {
23588
24021
  isLead,
23589
24022
  includeExpired,
23590
24023
  keyPrefix,
24024
+ excludeReviewTaskCompletions,
23591
24025
  minSimilarity: options.minSimilarity
23592
24026
  });
23593
24027
  }
@@ -23652,6 +24086,7 @@ class SqliteMemoryStore {
23652
24086
  const params = [match];
23653
24087
  this.addScopeConditions(conditions, params, agentId, scope, isLead, "m");
23654
24088
  this.addKeyPrefixCondition(conditions, params, keyPrefix, "m");
24089
+ this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions, "m");
23655
24090
  if (source) {
23656
24091
  conditions.push("m.source = ?");
23657
24092
  params.push(source);
@@ -23692,11 +24127,12 @@ class SqliteMemoryStore {
23692
24127
  const { scope, limit, source, isLead, includeExpired, keyPrefix } = options;
23693
24128
  const floor = options.minSimilarity ?? minSimilarity();
23694
24129
  const embeddingBuffer = serializeEmbedding(queryEmbedding);
23695
- const knnLimit = Math.min(Math.max(limit, this.getVecCount()), 4096);
24130
+ const knnLimit = 4096;
23696
24131
  const conditions = ["v.embedding MATCH ?"];
23697
24132
  const params = [embeddingBuffer];
23698
24133
  this.addScopeConditions(conditions, params, agentId, scope, isLead, "m");
23699
24134
  this.addKeyPrefixCondition(conditions, params, keyPrefix, "m");
24135
+ this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions, "m");
23700
24136
  if (source) {
23701
24137
  conditions.push("m.source = ?");
23702
24138
  params.push(source);
@@ -23728,6 +24164,7 @@ class SqliteMemoryStore {
23728
24164
  const params = [];
23729
24165
  this.addScopeConditions(conditions, params, agentId, scope, isLead);
23730
24166
  this.addKeyPrefixCondition(conditions, params, keyPrefix);
24167
+ this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions);
23731
24168
  if (source) {
23732
24169
  conditions.push("source = ?");
23733
24170
  params.push(source);
@@ -23790,6 +24227,7 @@ class SqliteMemoryStore {
23790
24227
  const params = [];
23791
24228
  this.addScopeConditions(conditions, params, agentId, scope, isLead);
23792
24229
  this.addKeyPrefixCondition(conditions, params, keyPrefix);
24230
+ this.addReviewExclusion(conditions, params, options.excludeReviewTaskCompletions);
23793
24231
  if (source) {
23794
24232
  conditions.push("source = ?");
23795
24233
  params.push(source);
@@ -23841,6 +24279,13 @@ class SqliteMemoryStore {
23841
24279
  conditions.push(`substr(${key}, 1, length(?)) = ?`);
23842
24280
  params.push(keyPrefix, keyPrefix);
23843
24281
  }
24282
+ addReviewExclusion(conditions, params, exclude, tableAlias = "") {
24283
+ if (!exclude)
24284
+ return;
24285
+ const filter = notReviewTaskCompletionSql(tableAlias);
24286
+ conditions.push(filter.sql);
24287
+ params.push(...filter.params);
24288
+ }
23844
24289
  buildListWhereClause(agentId, options) {
23845
24290
  const { scope = "all", isLead = false, ownerAgentId, source, sourcePath, keyPrefix } = options;
23846
24291
  const conditions = [];
@@ -24023,6 +24468,7 @@ class SqliteMemoryStore {
24023
24468
  if (this.vecInitialized && this.getVecTableSchema()) {
24024
24469
  const placeholders = ids.map(() => "?").join(",");
24025
24470
  await getDbClient2().run(`DELETE FROM memory_vec WHERE memory_id IN (${placeholders})`, ids);
24471
+ this.noteVecWrite();
24026
24472
  }
24027
24473
  await this.deleteFtsRows(ids);
24028
24474
  }
@@ -24093,8 +24539,10 @@ class SqliteMemoryStore {
24093
24539
  id,
24094
24540
  vecBuffer
24095
24541
  ]);
24542
+ this.noteVecWrite();
24096
24543
  } catch (err) {
24097
24544
  console.error(`[memory-vec] update failed memory_id=${id}: ${err.message}`);
24545
+ this.searchHealthCache = null;
24098
24546
  }
24099
24547
  }
24100
24548
  });
@@ -24106,6 +24554,7 @@ class SqliteMemoryStore {
24106
24554
  ]);
24107
24555
  if (this.vecInitialized && this.getVecTableSchema()) {
24108
24556
  await tx.run("DELETE FROM memory_vec WHERE memory_id = ?", [id]);
24557
+ this.noteVecWrite();
24109
24558
  }
24110
24559
  });
24111
24560
  }
@@ -24132,6 +24581,7 @@ class SqliteMemoryStore {
24132
24581
  return false;
24133
24582
  if (contentChanged && this.vecInitialized && this.getVecTableSchema()) {
24134
24583
  await tx.run("DELETE FROM memory_vec WHERE memory_id = ?", [id]);
24584
+ this.noteVecWrite();
24135
24585
  }
24136
24586
  if (after.name !== before.name || contentChanged) {
24137
24587
  await this.syncFtsRow(id, after.name, after.content);
@@ -24165,28 +24615,42 @@ class SqliteMemoryStore {
24165
24615
  const tableExists = this.getVecTableSchema() !== null;
24166
24616
  const tableUsable = tableExists && isSqliteVecAvailable2();
24167
24617
  const count = (sql) => db.prepare(sql).get()?.count ?? 0;
24618
+ const validEmbedding = count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`);
24168
24619
  return {
24169
24620
  total: count("SELECT COUNT(*) as count FROM agent_memory"),
24170
24621
  withEmbedding: count("SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL"),
24171
- validEmbedding: count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`),
24622
+ validEmbedding,
24172
24623
  invalidEmbedding: count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}`),
24173
24624
  searchable: count(`SELECT COUNT(*) as count FROM agent_memory
24174
24625
  WHERE embedding IS NOT NULL
24175
24626
  AND length(embedding) = ${VECTOR_BYTES}
24176
24627
  AND (expiresAt IS NULL OR expiresAt > datetime('now'))`),
24177
24628
  memoryVec: tableUsable ? count("SELECT COUNT(*) as count FROM memory_vec") : 0,
24178
- missingFromVec: tableUsable ? count(`SELECT COUNT(*) as count
24179
- FROM agent_memory m
24180
- LEFT JOIN memory_vec v ON v.memory_id = m.id
24629
+ missingFromVec: tableUsable ? validEmbedding - count(`SELECT COUNT(*) as count
24630
+ FROM memory_vec v
24631
+ CROSS JOIN agent_memory m ON m.id = v.memory_id
24181
24632
  WHERE m.embedding IS NOT NULL
24182
- AND length(m.embedding) = ${VECTOR_BYTES}
24183
- AND v.memory_id IS NULL`) : count(`SELECT COUNT(*) as count FROM agent_memory WHERE embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`),
24633
+ AND length(m.embedding) = ${VECTOR_BYTES}`) : validEmbedding,
24184
24634
  extraInVec: tableUsable ? count(`SELECT COUNT(*) as count
24185
24635
  FROM memory_vec v
24186
24636
  LEFT JOIN agent_memory m ON m.id = v.memory_id
24187
24637
  WHERE m.id IS NULL`) : 0
24188
24638
  };
24189
24639
  }
24640
+ searchHealth() {
24641
+ const db = getDb2();
24642
+ const cached = this.searchHealthCache;
24643
+ if (cached && cached.db === db && Date.now() - cached.at < SEARCH_HEALTH_TTL_MS) {
24644
+ return cached.health;
24645
+ }
24646
+ const health = this.getHealth();
24647
+ this.searchHealthCache = { health, db, at: Date.now() };
24648
+ return health;
24649
+ }
24650
+ noteVecWrite() {
24651
+ if (this.searchHealthCache?.health.retrievalMode !== "vec")
24652
+ this.searchHealthCache = null;
24653
+ }
24190
24654
  getHealth() {
24191
24655
  const schema = this.getVecTableSchema();
24192
24656
  const counts = this.getHealthCounts();
@@ -24223,7 +24687,7 @@ var VECTOR_BYTES, FTS_SCAN_BATCH_SQL = `SELECT rowid AS rowid, memory_id AS memo
24223
24687
  memory_id IS NOT NULL
24224
24688
  AND NOT EXISTS (SELECT 1 FROM agent_memory m WHERE m.id = memory_fts.memory_id) AS orphan
24225
24689
  FROM memory_fts WHERE rowid > ? ORDER BY rowid LIMIT ?`, MEMORY_ID_BATCH_SQL = `SELECT rowid AS rowid, id FROM agent_memory
24226
- WHERE rowid > ? ORDER BY rowid LIMIT ?`, FTS_SCAN_BATCH_SIZE = 1000, FTS_POPULATE_BATCH_SIZE = 500;
24690
+ WHERE rowid > ? ORDER BY rowid LIMIT ?`, SEARCH_HEALTH_TTL_MS = 60000, FTS_SCAN_BATCH_SIZE = 1000, FTS_POPULATE_BATCH_SIZE = 500;
24227
24691
  var init_sqlite_store = __esm(() => {
24228
24692
  init_db4();
24229
24693
  init_embedding();
@@ -24233,6 +24697,7 @@ var init_sqlite_store = __esm(() => {
24233
24697
  init_constants2();
24234
24698
  init_key_paths();
24235
24699
  init_reranker();
24700
+ init_review_recall_filter();
24236
24701
  init_search_candidates();
24237
24702
  VECTOR_BYTES = EMBEDDING_DIMENSIONS * Float32Array.BYTES_PER_ELEMENT;
24238
24703
  });
@@ -24918,7 +25383,7 @@ async function loadSecretRegistry() {
24918
25383
  result.failed += 1;
24919
25384
  }
24920
25385
  try {
24921
- const { loadRuntimeControllerSecrets } = await import("./db-qpganbeb.js");
25386
+ const { loadRuntimeControllerSecrets } = await import("./db-g111qn9j.js");
24922
25387
  const loaded = await loadRuntimeControllerSecrets();
24923
25388
  result.runtimeController = loaded.count;
24924
25389
  result.failed += loaded.failed;
@@ -25079,7 +25544,7 @@ async function requestSteering(args) {
25079
25544
  }
25080
25545
  const requestedMode = args.mode ?? "queue";
25081
25546
  const onUnsupported = args.onUnsupported ?? "degrade";
25082
- const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-8d8s49yz.js");
25547
+ const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-4q8s0mx8.js");
25083
25548
  const preSteer = await dispatchPre("pre.task.steer", {
25084
25549
  task,
25085
25550
  message: args.message,
@@ -25296,6 +25761,7 @@ var init_script_runs = __esm(() => {
25296
25761
  // src/be/db.ts
25297
25762
  var exports_db = {};
25298
25763
  __export(exports_db, {
25764
+ AgentDeletedError: () => AgentDeletedError2,
25299
25765
  AssetKeyMovesBlockedError: () => AssetKeyMovesBlockedError2,
25300
25766
  EXTENSION_AGENT_ROLE: () => EXTENSION_AGENT_ROLE2,
25301
25767
  ExtensionAgentAssignmentError: () => ExtensionAgentAssignmentError2,
@@ -25660,6 +26126,7 @@ __export(exports_db, {
25660
26126
  installMcpServer: () => installMcpServer2,
25661
26127
  installSkill: () => installSkill2,
25662
26128
  installSystemDefaultSkillsForAgent: () => installSystemDefaultSkillsForAgent2,
26129
+ isAgentDeleted: () => isAgentDeleted2,
25663
26130
  isAgentEligibleForTask: () => isAgentEligibleForTask2,
25664
26131
  isExtensionAgent: () => isExtensionAgent2,
25665
26132
  isLinearTrackerContextKey: () => isLinearTrackerContextKey2,
@@ -27314,7 +27781,7 @@ async function createTaskExtended2(task, options) {
27314
27781
  priority: row.priority
27315
27782
  }, (task) => task !== null, row.requestedByUserId);
27316
27783
  getDbClient2().afterCommit(() => {
27317
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
27784
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
27318
27785
  workflowEventBus.emit("task.created", {
27319
27786
  taskId: row.id,
27320
27787
  task: row.task,
@@ -27396,7 +27863,7 @@ async function releaseTask2(taskId, wakeSnapshot) {
27396
27863
  } catch {}
27397
27864
  if (isRuntimePoolsEnabled() && !wakeSnapshot)
27398
27865
  getDbClient2().afterCommit(() => {
27399
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
27866
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
27400
27867
  });
27401
27868
  }
27402
27869
  return row ? rowToAgentTask(row) : null;
@@ -27466,7 +27933,7 @@ async function rejectTask2(taskId, agentId, reason) {
27466
27933
  } catch {}
27467
27934
  if (isRuntimePoolsEnabled())
27468
27935
  getDbClient2().afterCommit(() => {
27469
- import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
27936
+ import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
27470
27937
  });
27471
27938
  }
27472
27939
  return row ? rowToAgentTask(row) : null;
@@ -29115,7 +29582,7 @@ async function deleteScheduledTask2(id) {
29115
29582
  const parent = await getTaskById2(deferred.parentTaskId);
29116
29583
  if (!parent?.deferredAt)
29117
29584
  return;
29118
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-y3xeg89w.js");
29585
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-9z2xec5e.js");
29119
29586
  await createWorkerTaskFollowUp({
29120
29587
  task: parent,
29121
29588
  status: "failed",
@@ -33468,7 +33935,7 @@ var init_db4 = __esm(() => {
33468
33935
  configureAgentDependencies({
33469
33936
  createLogEntry: (entry) => createLogEntry2(entry),
33470
33937
  installSystemDefaultSkillsForAgent: (agentId) => installSystemDefaultSkillsForAgent2(agentId),
33471
- resolvePendingImportAssignments: async (agent) => (await import("./pending-h01yzpx4.js")).resolvePendingImportAssignments(agent)
33938
+ resolvePendingImportAssignments: async (agent) => (await import("./pending-hxj5yatb.js")).resolvePendingImportAssignments(agent)
33472
33939
  });
33473
33940
  configureTaskWriteDependencies({
33474
33941
  createLogEntry: (...args) => createLogEntry2(...args),
@@ -33518,4 +33985,4 @@ var init_db4 = __esm(() => {
33518
33985
  };
33519
33986
  });
33520
33987
 
33521
- export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasOutcomeWork, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
33988
+ export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, EgressDeniedError, createGuardedFetch, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, init_secrets_cipher, getEncryptionKey, init_key_bootstrap, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, wasDbCreatedThisBoot, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, init_can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, isSlackIconConfigKey, reactionStatusIcon, iconPrefix, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, AgentDeletedError2, isAgentDeleted2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasBotReplySince, slackThreadHasOutcomeWork, observeSlackTreeVisibility, getSlackProcessingThreads, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, configPools, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, reclassifyTaskHumanFree, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, deleteOrphanedRunDefinitions, init_workflow_run_definitions, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };