@desplega.ai/agent-swarm 2.7.8 → 2.7.10

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 (380) hide show
  1. package/dist/acp-adapter-srfhs1s9.js +16 -0
  2. package/dist/{actions-4m1ct4nh.js → actions-b8aqhrsg.js} +20 -19
  3. package/dist/{amp-adapter-txqh7eqj.js → amp-adapter-4c165vgn.js} +3 -3
  4. package/dist/{anthropic-messages-xey2skwx.js → anthropic-messages-jkva0zps.js} +68 -78
  5. package/dist/app-m9khefrh.js +20 -0
  6. package/dist/{assistant-gd08kr9e.js → assistant-rh4v3ntz.js} +22 -21
  7. package/dist/{azure-openai-responses-26t7j9ra.js → azure-openai-responses-wgtqkbr3.js} +5 -10
  8. package/dist/{boot-args-schema-tjrkpbvm.js → boot-args-schema-hwkc8bzv.js} +1 -1
  9. package/dist/{boot-reembed-21hbck22.js → boot-reembed-5y6yw9sj.js} +1 -1
  10. package/dist/{boot-reembed-mdxd3wgp.js → boot-reembed-fdyk55h4.js} +1 -1
  11. package/dist/{boot-scrub-sweep-qy0zr9t2.js → boot-scrub-sweep-r5r8kqsn.js} +4 -4
  12. package/dist/{boot-seeds-n46eaxdv.js → boot-seeds-8f9zt5cm.js} +5 -4
  13. package/dist/{boxd-nv507va8.js → boxd-qbkxy6ap.js} +1 -1
  14. package/dist/{claude-adapter-j37w2eds.js → claude-adapter-s5df247c.js} +8 -8
  15. package/dist/{claude-managed-adapter-8jvcma9a.js → claude-managed-adapter-h74d06yz.js} +4 -4
  16. package/dist/{claude-managed-setup-rzkjmgc1.js → claude-managed-setup-9gsmwzyx.js} +4 -4
  17. package/dist/{claude-sdk-session-4k7w73t0.js → claude-sdk-session-dq1j4nz9.js} +7901 -7718
  18. package/dist/{cli-s4ss5g59.js → cli-0m7rtm11.js} +5 -5
  19. package/dist/{cli-fzachfnf.js → cli-16phend6.js} +5 -5
  20. package/dist/{cli-yqefz277.js → cli-18qt3few.js} +1 -1
  21. package/dist/{cli-snpj5zbj.js → cli-1z4qggfe.js} +9 -36
  22. package/dist/{cli-s0qnd4wv.js → cli-28fq781p.js} +1 -1
  23. package/dist/{cli-1p89xny0.js → cli-2r0jcc3k.js} +1 -1
  24. package/dist/{cli-66ww7fer.js → cli-2tsfpc70.js} +1 -1
  25. package/dist/{cli-rvtm68yy.js → cli-2xv18ywz.js} +2 -2
  26. package/dist/{cli-kyr67fgx.js → cli-36wdfzgn.js} +18608 -9089
  27. package/dist/{cli-t60ajbbp.js → cli-38yww4e9.js} +20 -20
  28. package/dist/{cli-5xaqj21p.js → cli-3kd08rej.js} +1 -1
  29. package/dist/{cli-ae7mrdf9.js → cli-3vjhs18n.js} +4 -6
  30. package/dist/{cli-ssnjfg5p.js → cli-3xcwp3z8.js} +8 -10
  31. package/dist/{cli-rjknb2ae.js → cli-3xddv0rk.js} +6 -6
  32. package/dist/{cli-az48n0nr.js → cli-4caa1x7d.js} +67 -64
  33. package/dist/cli-4vwxp550.js +9321 -0
  34. package/dist/{cli-pz4rk021.js → cli-54vrpgm0.js} +1 -1
  35. package/dist/{cli-gvx71kqv.js → cli-55bkx8hh.js} +3 -3
  36. package/dist/{cli-r9jqcehk.js → cli-5mpy301f.js} +38 -2
  37. package/dist/{cli-bb0mmdk8.js → cli-5wfz00be.js} +35 -12
  38. package/dist/{cli-btfsp3mv.js → cli-5xcb8gxq.js} +9 -11
  39. package/dist/{cli-4t50yq3j.js → cli-6m6b4bep.js} +29 -12
  40. package/dist/cli-6pzk82fd.js +778 -0
  41. package/dist/{cli-8sdejs1f.js → cli-7wz05bx3.js} +797 -255
  42. package/dist/{cli-mkk9rnzz.js → cli-8bpgbr8k.js} +54 -7
  43. package/dist/{cli-fyhr5h4s.js → cli-8ewkreqd.js} +17 -13
  44. package/dist/{cli-p3vsj0d3.js → cli-an1knn2k.js} +15 -10
  45. package/dist/{cli-0ykgn1h5.js → cli-bxz823sz.js} +2 -2
  46. package/dist/{cli-jdv6ypxs.js → cli-bzvs88tv.js} +2 -2
  47. package/dist/{cli-bshb7jas.js → cli-cr14kftt.js} +3 -3
  48. package/dist/{cli-njwac61j.js → cli-cyn9v8zr.js} +12 -2
  49. package/dist/{cli-a22h291q.js → cli-d6521kb5.js} +1 -1
  50. package/dist/{cli-1b7btd38.js → cli-d84byzn8.js} +869 -5
  51. package/dist/{cli-84rj785g.js → cli-eb2azq8n.js} +9 -9
  52. package/dist/{cli-1cxrbkk6.js → cli-ed6yqpf1.js} +7 -9
  53. package/dist/{cli-wx3rhnm0.js → cli-eddnyg3t.js} +1 -1
  54. package/dist/{cli-ga786dzg.js → cli-eqk5p56g.js} +18 -17
  55. package/dist/{cli-mthwvjre.js → cli-f2zenhja.js} +1 -1
  56. package/dist/{cli-ferkkrg9.js → cli-fjggej24.js} +2 -2
  57. package/dist/{cli-g7s47cc5.js → cli-fsgttth8.js} +123 -102
  58. package/dist/{cli-269q28a1.js → cli-g1px1g2e.js} +27 -6
  59. package/dist/{cli-sq4n7af4.js → cli-h49ejvmc.js} +4 -6
  60. package/dist/{cli-5j0m12ns.js → cli-hfkwwy1h.js} +51 -15
  61. package/dist/{cli-agfm16v9.js → cli-hg42n3hx.js} +12 -12
  62. package/dist/{cli-yndmfxb3.js → cli-hxpyc9sn.js} +3 -3
  63. package/dist/{cli-w4xnbm46.js → cli-j7d73g1y.js} +414 -145
  64. package/dist/{cli-gazw7kpa.js → cli-jg24scat.js} +8 -10
  65. package/dist/{cli-5ja3b75e.js → cli-jrp1dt73.js} +1 -1
  66. package/dist/{cli-98rw5dt5.js → cli-jrzkw01m.js} +2 -2
  67. package/dist/{cli-583frbyr.js → cli-kchjb7qy.js} +1 -1
  68. package/dist/{cli-xr8908my.js → cli-kx4c8j05.js} +32 -17
  69. package/dist/{cli-fmjd0t1y.js → cli-m0cy2vyf.js} +2 -2
  70. package/dist/{cli-c0kqky8y.js → cli-m5akxq8q.js} +1 -1
  71. package/dist/{cli-ycscb2ar.js → cli-m88rpzkh.js} +2 -2
  72. package/dist/{cli-ppjxh6ah.js → cli-mp9aa8g5.js} +10 -12
  73. package/dist/{cli-xq9r2wtt.js → cli-mr97t7cc.js} +679 -247
  74. package/dist/{cli-z75yxkjh.js → cli-n07eecjs.js} +3 -3
  75. package/dist/{cli-7cx2m6t2.js → cli-n515ex5z.js} +16 -16
  76. package/dist/{cli-fy6x31ps.js → cli-n5yexkdg.js} +1 -0
  77. package/dist/{cli-bbw9wj9m.js → cli-n9abj89w.js} +17 -16
  78. package/dist/{cli-ypff1qwp.js → cli-n9ftpys4.js} +7 -7
  79. package/dist/{cli-32m9eda8.js → cli-nj3x45rw.js} +111 -109
  80. package/dist/{cli-6vcp76qk.js → cli-p74md7t8.js} +42 -23
  81. package/dist/{cli-rjcbm574.js → cli-pr0eze3x.js} +2 -2
  82. package/dist/{cli-dq8x79v8.js → cli-pyrxt9gw.js} +198 -3
  83. package/dist/{cli-m0hmeqma.js → cli-q581b386.js} +5 -5
  84. package/dist/{cli-8rpcng8j.js → cli-rjyghzg4.js} +8 -10
  85. package/dist/cli-rkc97c6a.js +39 -0
  86. package/dist/{cli-msg9m2ny.js → cli-rt0ag4x1.js} +9 -11
  87. package/dist/{cli-qd57hhhh.js → cli-rvhdmjvt.js} +6 -10
  88. package/dist/{cli-318r69gq.js → cli-t73cas91.js} +440 -9
  89. package/dist/{cli-q4ebh7h7.js → cli-td33w98c.js} +6 -6
  90. package/dist/{cli-zkky4t5g.js → cli-tmft5dz2.js} +2 -2
  91. package/dist/{cli-q26b9wre.js → cli-tph5wt3y.js} +4 -4
  92. package/dist/{cli-3e4snnzf.js → cli-ttbqe3q4.js} +1 -1
  93. package/dist/{cli-wemma3jd.js → cli-v2fwbnsk.js} +7 -7
  94. package/dist/cli-w3bk0dgv.js +5266 -0
  95. package/dist/{cli-8h0ayw8c.js → cli-x9exydey.js} +6 -6
  96. package/dist/{cli-85gzce7b.js → cli-xbtq4d6s.js} +287 -75
  97. package/dist/{cli-eyg1pa00.js → cli-xd5ebp64.js} +7 -7
  98. package/dist/{cli-g83s9ewh.js → cli-xfjrc279.js} +1 -1
  99. package/dist/{cli-7axf41jq.js → cli-xncjscpm.js} +40 -42
  100. package/dist/{cli-9m8hdawy.js → cli-xvymtmv4.js} +4 -4
  101. package/dist/{cli-81p9jd57.js → cli-yab6sh8p.js} +9 -3
  102. package/dist/{cli-srye3vdt.js → cli-ybjdc978.js} +1 -1
  103. package/dist/{cli-z1srzaf6.js → cli-yz7v0sh4.js} +70 -5
  104. package/dist/{cli-nbsf8yvn.js → cli-z9cs5m0w.js} +9 -9
  105. package/dist/{cli-k5671be5.js → cli-zcfpsfzf.js} +5 -5
  106. package/dist/{cli-vf078p3e.js → cli-zfqg6fzn.js} +1 -1
  107. package/dist/{cli-tpksw2nr.js → cli-zjphdj1a.js} +461 -108
  108. package/dist/cli.js +32 -52
  109. package/dist/{cloudflare-workers-ai-system-one-ef2a980q.js → cloudflare-workers-ai-system-one-9y1zx3pt.js} +2 -2
  110. package/dist/{codex-adapter-88z6psm4.js → codex-adapter-yr60sme6.js} +7 -7
  111. package/dist/{codex-login-74wa4hmq.js → codex-login-bcda78ge.js} +2 -2
  112. package/dist/{codex-session-runner-zwbcwzvx.js → codex-session-runner-pch8x584.js} +8 -8
  113. package/dist/{commands-7amxs716.js → commands-phjfbkv0.js} +3 -3
  114. package/dist/{controller-5rkkc37m.js → controller-jkx994pz.js} +4 -4
  115. package/dist/{controllers-connect-m7d4vxxb.js → controllers-connect-c4448kwa.js} +25 -24
  116. package/dist/{cursor-adapter-x1q18693.js → cursor-adapter-ndebqnm8.js} +2 -2
  117. package/dist/{db-athc68zt.js → db-ef32tbfc.js} +6 -2
  118. package/dist/{db-h2fsfve3.js → db-ez6egt6v.js} +3 -3
  119. package/dist/{devin-adapter-r9phbnc9.js → devin-adapter-z46ep5ph.js} +1 -1
  120. package/dist/{dispatcher-b1yz2bnn.js → dispatcher-g3tt9hs9.js} +19 -18
  121. package/dist/{docker-c1a3gqmf.js → docker-866qpzt9.js} +2 -2
  122. package/dist/{dsh-adapter-e33bkxq9.js → dsh-adapter-tcyn3099.js} +2 -2
  123. package/dist/{e2b-fr12yccx.js → e2b-jkwfhbcv.js} +2 -2
  124. package/dist/{e2b-x6ywzak3.js → e2b-s16txnpx.js} +2 -3
  125. package/dist/{easter-egg-3d-pv5qnzc8.js → easter-egg-3d-e36hk5td.js} +1 -1
  126. package/dist/{embedding-space-b4txbwrk.js → embedding-space-4kyh5qqj.js} +6 -6
  127. package/dist/{embeddings-m6zn6tad.js → embeddings-6a8v4a6t.js} +1 -1
  128. package/dist/{event-bus-g0ka3pbw.js → event-bus-e66gh7cc.js} +1 -1
  129. package/dist/{execute-68nwny8m.js → execute-3cbg0twf.js} +1 -1
  130. package/dist/{external-channel-gkckmhzh.js → external-channel-se646snz.js} +2 -2
  131. package/dist/fx-adapter-yw795hqq.js +19 -0
  132. package/dist/{google-generative-ai-v94hr7h0.js → google-generative-ai-h7s3e9kk.js} +7 -12
  133. package/dist/{google-vertex-g7vr6cf8.js → google-vertex-fhxaafzw.js} +7 -12
  134. package/dist/grok-adapter-ttmcss2j.js +19 -0
  135. package/dist/handlers-17wha3ze.js +33 -0
  136. package/dist/heartbeat-gwewgdms.js +42 -0
  137. package/dist/{hook-q5fv0jy2.js → hook-g3nhexsy.js} +16 -11
  138. package/dist/{hook-w0q2wcrv.js → hook-hq93y5ej.js} +5 -5
  139. package/dist/{http-bxat8dg3.js → http-5a9p4h6y.js} +808 -285
  140. package/dist/{index-pxn30mse.js → index-0eny15vj.js} +8 -8
  141. package/dist/{index-6cxzwfen.js → index-0rvk3vd4.js} +71 -71
  142. package/dist/{index-fvzke5kx.js → index-1qw6f2dc.js} +10 -10
  143. package/dist/{index-cqhqpgrv.js → index-3c5pxbge.js} +1 -1
  144. package/dist/{index-k7fj52d3.js → index-6haqt3v5.js} +12302 -11048
  145. package/dist/index-8arwq8mw.js +34 -0
  146. package/dist/{index-h7f61sy9.js → index-e5pfbsys.js} +3 -3
  147. package/dist/{index-bxrexmfy.js → index-hgn3c961.js} +14 -13
  148. package/dist/{index-h39zbx67.js → index-m5gx1xd6.js} +68 -68
  149. package/dist/{index-5fx3b3kw.js → index-rvccek1w.js} +9 -9
  150. package/dist/{index-fm0czesf.js → index-s72rqgsx.js} +1 -1
  151. package/dist/index-tpw054az.js +38 -0
  152. package/dist/{index-514d9pf6.js → index-w7em4ktq.js} +8 -8
  153. package/dist/index-waq75j2j.js +31 -0
  154. package/dist/{keepalive-qnt21cv0.js → keepalive-1j4n4dmk.js} +4 -4
  155. package/dist/lead-re73kdgc.js +72 -0
  156. package/dist/{llama-cpp-classify-s5c47rwh.js → llama-cpp-classify-nfgswa1m.js} +2 -2
  157. package/dist/{maintenance-btdr68y4.js → maintenance-dmghacy5.js} +1 -1
  158. package/dist/{mistral-conversations-3gjpdb4b.js → mistral-conversations-a45tx39a.js} +29 -51
  159. package/dist/{oauth-refresh-sweep-vczabeh4.js → oauth-refresh-sweep-yy06c03c.js} +3 -3
  160. package/dist/{onboard-k33ezyq8.js → onboard-52f9t5dm.js} +68 -16
  161. package/dist/{openai-codex-responses-8pbxq9h5.js → openai-codex-responses-k9gapdze.js} +7 -11
  162. package/dist/{openai-completions-rm00s912.js → openai-completions-xd579js7.js} +50 -58
  163. package/dist/{openai-decisions-8v957r2r.js → openai-decisions-q3hh60wr.js} +2 -2
  164. package/dist/{openai-responses-agxpf96k.js → openai-responses-4d5dx3c7.js} +5 -10
  165. package/dist/{opencode-adapter-3dst2ka7.js → opencode-adapter-krnh9jkn.js} +6 -6
  166. package/dist/{openrouter-images-3ecegv0d.js → openrouter-images-xr9gme9x.js} +4 -3
  167. package/dist/{otel-impl-13am7a65.js → otel-impl-xjqz6wjj.js} +2 -2
  168. package/dist/{pi-messages-pchtw4he.js → pi-messages-hjbv8v10.js} +28 -12
  169. package/dist/{pi-mono-adapter-c53de1gd.js → pi-mono-adapter-dbxyp0qv.js} +23 -26
  170. package/dist/{pricing-refresh-9fcbnq3f.js → pricing-refresh-ctdr74pd.js} +3 -3
  171. package/dist/{rbac-roles-66j5h4y5.js → rbac-roles-ehv8s10n.js} +12 -3
  172. package/dist/{rbac-roles-gw0p9h3j.js → rbac-roles-q0gr8eyj.js} +16 -2
  173. package/dist/{render-v2-fg8bmdn4.js → render-v2-5b6chvcq.js} +9 -4
  174. package/dist/{resume-1c8kr3nh.js → resume-5a5d2845.js} +7 -7
  175. package/dist/{runtime-tzf9j7tc.js → runtime-khxszyfp.js} +1 -1
  176. package/dist/{session-access-d0atq10j.js → session-access-gj0bjhqg.js} +4 -4
  177. package/dist/{session-source-backfill-0vscqmsa.js → session-source-backfill-2sy0krfk.js} +3 -3
  178. package/dist/{setup-tvfa7rwe.js → setup-7ssfakk1.js} +1 -1
  179. package/dist/{typesafe-system-one-0bmqcxfg.js → typesafe-system-one-f2en2knd.js} +2 -2
  180. package/dist/virtual-modules-pjj0knwf.js +362 -0
  181. package/dist/{work-objects-ks71xqeb.js → work-objects-bf3syvhq.js} +22 -21
  182. package/dist/{worker-follow-up-bfx0h9hg.js → worker-follow-up-38xevga6.js} +19 -18
  183. package/dist/worker-r8mz7a65.js +72 -0
  184. package/dist/{x-vmmye1kb.js → x-2fyrt5pp.js} +2 -2
  185. package/openapi.json +1169 -257
  186. package/package.json +9 -11
  187. package/src/apps/catalog.generated.json +354 -82
  188. package/src/apps/page-validator.ts +134 -2
  189. package/src/assets/key.ts +77 -4
  190. package/src/be/connector-codes.ts +21 -6
  191. package/src/be/db/session-labels.ts +57 -0
  192. package/src/be/db/session-tree.ts +51 -7
  193. package/src/be/db/slack-trees.ts +146 -0
  194. package/src/be/db/tasks/read.ts +124 -7
  195. package/src/be/db-client.ts +8 -2
  196. package/src/be/db.ts +99 -86
  197. package/src/be/event-loop-lag.ts +146 -0
  198. package/src/be/improvements.ts +416 -0
  199. package/src/be/mcp-overflow-sweep.ts +2 -1
  200. package/src/be/memory/providers/sqlite-store.ts +39 -8
  201. package/src/be/migrations/274_improvements.sql +27 -0
  202. package/src/be/migrations/275_task_dispatched_by.sql +8 -0
  203. package/src/be/migrations/278_slack_render_v2_reconcile.sql +108 -0
  204. package/src/be/rbac-roles.ts +123 -1
  205. package/src/be/swarm-config-guard.ts +3 -0
  206. package/src/be/users.ts +58 -1
  207. package/src/cli.tsx +5 -25
  208. package/src/commands/codex-login.ts +1 -1
  209. package/src/commands/context-preamble.ts +258 -0
  210. package/src/commands/e2b.ts +0 -1
  211. package/src/commands/onboard/agent-fs-version.ts +1 -1
  212. package/src/commands/onboard/compose-generator.ts +0 -1
  213. package/src/commands/onboard/dashboard-url.ts +31 -0
  214. package/src/commands/onboard/steps/generate.tsx +17 -1
  215. package/src/commands/onboard/steps/post-dashboard.tsx +9 -3
  216. package/src/commands/onboard.tsx +19 -6
  217. package/src/commands/runner.ts +117 -96
  218. package/src/extensions/catalog.generated.json +3 -3
  219. package/src/extensions/contract-types.generated.ts +1 -1
  220. package/src/heartbeat/heartbeat.ts +5 -4
  221. package/src/hooks/hook.ts +13 -5
  222. package/src/http/all-routes.ts +1 -0
  223. package/src/http/approval-requests.ts +2 -44
  224. package/src/http/auth.ts +5 -4
  225. package/src/http/codex-oauth-accounts.ts +31 -23
  226. package/src/http/codex-oauth-device.ts +1 -1
  227. package/src/http/codex-oauth-keep-warm.ts +1 -1
  228. package/src/http/core.ts +9 -3
  229. package/src/http/improvements.ts +317 -0
  230. package/src/http/index.ts +12 -6
  231. package/src/http/memory.ts +9 -4
  232. package/src/http/operator-actor.ts +2 -1
  233. package/src/http/person-responder.ts +66 -0
  234. package/src/http/sessions.ts +65 -10
  235. package/src/http/tasks.ts +1 -1
  236. package/src/http/user-roles.ts +11 -2
  237. package/src/http/users.ts +194 -104
  238. package/src/http/utils.ts +18 -0
  239. package/src/http/webhooks.ts +48 -0
  240. package/src/integrations/chat-sdk/commands.ts +167 -31
  241. package/src/integrations/chat-sdk/inbound.ts +10 -8
  242. package/src/integrations/chat-sdk/message-text.ts +117 -0
  243. package/src/providers/acp-targets.ts +1 -1
  244. package/src/providers/amp-adapter.ts +1 -1
  245. package/src/providers/codex-adapter.ts +8 -1
  246. package/src/providers/codex-models.ts +4 -3
  247. package/src/providers/codex-oauth/auth-json.ts +14 -18
  248. package/src/providers/codex-oauth/storage.ts +2 -2
  249. package/src/providers/cursor-adapter.ts +1 -1
  250. package/src/providers/dsh-adapter.ts +1 -1
  251. package/src/rbac/legacy-policy.ts +2 -0
  252. package/src/rbac/permissions.ts +10 -0
  253. package/src/scheduler/scheduler.ts +4 -1
  254. package/src/scripts-runtime/executors/quickjs-runner.ts +2 -0
  255. package/src/scripts-runtime/executors/quickjs-structured-clone.ts +180 -0
  256. package/src/scripts-runtime/quickjs-compat.ts +0 -1
  257. package/src/scripts-runtime/types/swarm-extension.d.ts +2 -0
  258. package/src/server.ts +2 -0
  259. package/src/slack/ack.ts +20 -14
  260. package/src/slack/app.ts +332 -10
  261. package/src/slack/handlers.ts +9 -2
  262. package/src/slack/index.ts +7 -1
  263. package/src/slack/lifecycle-lock.ts +29 -0
  264. package/src/slack/render-v2.ts +466 -229
  265. package/src/slack/socket-fence.ts +64 -0
  266. package/src/slack/watcher.ts +42 -8
  267. package/src/tests/api-drain-worker-e2e.test.ts +69 -2
  268. package/src/tests/apps-catalog-drift.test.ts +35 -0
  269. package/src/tests/apps-catalog-table.test.ts +203 -0
  270. package/src/tests/apps-element-assembly.test.ts +28 -0
  271. package/src/tests/apps-schema-form.test.ts +151 -0
  272. package/src/tests/apps-smart-links.test.ts +151 -0
  273. package/src/tests/apps-table-filters-migration.test.ts +96 -0
  274. package/src/tests/apps-table-selection-migration.test.ts +95 -0
  275. package/src/tests/chat-sdk-commands.test.ts +359 -2
  276. package/src/tests/chat-sdk-inbound.test.ts +20 -0
  277. package/src/tests/chat-sdk-slack.test.ts +189 -1
  278. package/src/tests/chatgpt-subscription-session-bench.test.ts +2 -2
  279. package/src/tests/claude-worker-parity.test.ts +2 -2
  280. package/src/tests/codex-adapter.test.ts +30 -0
  281. package/src/tests/codex-login.test.ts +2 -2
  282. package/src/tests/codex-oauth-accounts.test.ts +48 -12
  283. package/src/tests/codex-oauth-credential-info.test.ts +77 -1
  284. package/src/tests/codex-oauth-device.test.ts +1 -1
  285. package/src/tests/codex-oauth-keep-warm.test.ts +2 -2
  286. package/src/tests/codex-oauth.test.ts +25 -4
  287. package/src/tests/codex-pool.test.ts +2 -2
  288. package/src/tests/db-client-busy-retry.test.ts +69 -18
  289. package/src/tests/db-client.test.ts +26 -1
  290. package/src/tests/db-task-read-contract.test.ts +4 -0
  291. package/src/tests/db-task-write-contract.test.ts +2 -0
  292. package/src/tests/deploy-one-box.test.ts +39 -1
  293. package/src/tests/docs-index-footprint.test.js +3 -3
  294. package/src/tests/dsh-adapter.test.ts +1 -1
  295. package/src/tests/event-loop-lag.test.ts +184 -0
  296. package/src/tests/extensions-example-comms-adherence-gate.test.ts +115 -0
  297. package/src/tests/fixtures/onboard/content.compose.yml.txt +0 -4
  298. package/src/tests/fixtures/onboard/dev.compose.yml.txt +0 -3
  299. package/src/tests/fixtures/onboard/full-all.compose.yml.txt +0 -11
  300. package/src/tests/fixtures/onboard/full.compose.yml.txt +0 -11
  301. package/src/tests/fixtures/onboard/research.compose.yml.txt +0 -3
  302. package/src/tests/fixtures/onboard/solo.compose.yml.txt +0 -1
  303. package/src/tests/fixtures/prs-app-definition.json.txt +784 -0
  304. package/src/tests/fixtures/prs-filters-migration.patch.json.txt +318 -0
  305. package/src/tests/fixtures/prs-selection-migration.patch.json.txt +373 -0
  306. package/src/tests/fixtures/runner-identity-refresh.ts +3 -0
  307. package/src/tests/fixtures/runner-legacy-resume-prompt.ts +3 -0
  308. package/src/tests/fixtures/runner-task-start-reads.ts +140 -0
  309. package/src/tests/github-webhook-early-ack.test.ts +144 -0
  310. package/src/tests/hook-ping-me-order.test.ts +85 -0
  311. package/src/tests/http-api-integration.test.ts +2 -0
  312. package/src/tests/http-log-scrubbing.test.ts +68 -2
  313. package/src/tests/improvements-payload.test.ts +200 -0
  314. package/src/tests/improvements-route.test.ts +419 -0
  315. package/src/tests/install-sh-setup-url.test.ts +190 -0
  316. package/src/tests/kv-storage.test.ts +92 -1
  317. package/src/tests/memory-key-paths.test.ts +57 -0
  318. package/src/tests/memory-retrieval-purge.test.ts +19 -0
  319. package/src/tests/onboard-dashboard-output.test.ts +109 -0
  320. package/src/tests/onboard-dashboard-url.test.ts +83 -0
  321. package/src/tests/operator-granted-credentials.test.ts +561 -0
  322. package/src/tests/operator-granted-role-wire.test.ts +222 -0
  323. package/src/tests/quickjs-compat.test.ts +1 -1
  324. package/src/tests/rbac-engine.test.ts +2 -0
  325. package/src/tests/runner-context-preamble.test.ts +552 -0
  326. package/src/tests/runner-context-usage.test.ts +0 -1
  327. package/src/tests/runner-legacy-options.test.ts +55 -0
  328. package/src/tests/runner-slot-reconcile.test.ts +38 -0
  329. package/src/tests/runner-task-start-reads.test.ts +58 -0
  330. package/src/tests/script-connections.test.ts +3 -0
  331. package/src/tests/script-executor-conformance.test.ts +188 -0
  332. package/src/tests/send-task-dispatched-by.test.ts +129 -0
  333. package/src/tests/session-dispatched-tasks.test.ts +115 -0
  334. package/src/tests/session-sharing.test.ts +198 -9
  335. package/src/tests/sessions-tree.test.ts +133 -2
  336. package/src/tests/slack-app-icon.test.ts +4 -0
  337. package/src/tests/slack-dm-implicit-mention.test.ts +236 -0
  338. package/src/tests/slack-file-tools-attachments.test.ts +96 -3
  339. package/src/tests/slack-reaction-config.test.ts +39 -0
  340. package/src/tests/slack-read-boundaries.test.ts +4 -3
  341. package/src/tests/slack-render-v2-query-plans.test.ts +262 -3
  342. package/src/tests/slack-render-v2-reconcile.test.ts +201 -0
  343. package/src/tests/slack-render-v2.test.ts +47 -0
  344. package/src/tests/slack-socket-watchdog.test.ts +748 -0
  345. package/src/tests/submit-improvement-tool.test.ts +82 -0
  346. package/src/tests/tool-annotations.test.ts +1 -1
  347. package/src/tests/vcs-identity-inheritance.test.ts +85 -0
  348. package/src/tools/manage-user.ts +88 -58
  349. package/src/tools/send-task.ts +3 -0
  350. package/src/tools/slack-read.ts +61 -33
  351. package/src/tools/submit-improvement.ts +68 -0
  352. package/src/tools/tool-config.ts +3 -0
  353. package/src/tools/utils.ts +16 -7
  354. package/src/types.ts +5 -0
  355. package/src/utils/request-auth-context.ts +6 -1
  356. package/templates/extensions/comms-adherence-gate/README.md +25 -0
  357. package/templates/extensions/comms-adherence-gate/hooks.ts +100 -11
  358. package/templates/extensions/comms-adherence-gate/manifest.json +1 -1
  359. package/templates/skills/apps/SKILL.md +29 -11
  360. package/templates/skills/apps/content.md +29 -11
  361. package/templates/skills/swarm-scripts/SKILL.md +1 -1
  362. package/templates/skills/swarm-scripts/content.md +1 -1
  363. package/templates/skills/work-on-task/SKILL.md +1 -1
  364. package/templates/skills/work-on-task/content.md +1 -1
  365. package/dist/acp-adapter-vg5hqkvj.js +0 -16
  366. package/dist/app-e00m45gn.js +0 -17
  367. package/dist/cli-5c4hjzne.js +0 -873
  368. package/dist/cli-ae0dnfee.js +0 -20222
  369. package/dist/cli-nn3ysbqk.js +0 -428
  370. package/dist/cli-pc5znp64.js +0 -364
  371. package/dist/fx-adapter-m5jbgd5q.js +0 -19
  372. package/dist/grok-adapter-csvv7sac.js +0 -19
  373. package/dist/handlers-8x5gfbzx.js +0 -32
  374. package/dist/heartbeat-6c2y3267.js +0 -41
  375. package/dist/index-hpfte8jd.js +0 -33
  376. package/dist/index-ncf7yb5s.js +0 -30
  377. package/dist/index-vte6dyeh.js +0 -37
  378. package/dist/lead-4bvftzm6.js +0 -71
  379. package/dist/virtual-modules-efxcp740.js +0 -59
  380. package/dist/worker-e7v2bvm9.js +0 -71
@@ -1,12 +1,15 @@
1
1
  import {
2
2
  ALL_TOOLS,
3
3
  init_tool_config
4
- } from "./cli-fy6x31ps.js";
4
+ } from "./cli-n5yexkdg.js";
5
5
  import {
6
6
  normalizeAssetKey,
7
7
  defaultAssetKey,
8
8
  keyPrefixRange,
9
+ SESSION_RESOURCE_KINDS,
9
10
  SESSION_LEAF_KINDS,
11
+ NO_GROUP_LEAF_KINDS,
12
+ sessionResourceGroupOf,
10
13
  sessionGroupKey,
11
14
  parseAssetKey,
12
15
  isCanonicalAssetKey,
@@ -29,7 +32,7 @@ import {
29
32
  SessionCostModelBreakdownSchema,
30
33
  PageThemeTokensSchema,
31
34
  init_types4
32
- } from "./cli-5j0m12ns.js";
35
+ } from "./cli-hfkwwy1h.js";
33
36
  import {
34
37
  CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
35
38
  CODEX_AUTH_FAILURE_BENCH_MS,
@@ -51,7 +54,7 @@ import {
51
54
  init_identity_field_budget,
52
55
  contentSha256,
53
56
  init_profile_sync
54
- } from "./cli-dq8x79v8.js";
57
+ } from "./cli-pyrxt9gw.js";
55
58
  import {
56
59
  isSlackConfigured,
57
60
  init_config4
@@ -80,7 +83,7 @@ import {
80
83
  deriveProviderFromKeyType,
81
84
  selectCredential,
82
85
  init_credentials2
83
- } from "./cli-g83s9ewh.js";
86
+ } from "./cli-xfjrc279.js";
84
87
  import {
85
88
  registerTemplate,
86
89
  getAllTemplateDefinitions,
@@ -92,10 +95,10 @@ import {
92
95
  import {
93
96
  runtimeHarnessSections,
94
97
  init_runtime_model_catalog
95
- } from "./cli-1p89xny0.js";
98
+ } from "./cli-2r0jcc3k.js";
96
99
  import {
97
100
  init_zod
98
- } from "./cli-k5671be5.js";
101
+ } from "./cli-zcfpsfzf.js";
99
102
  import {
100
103
  string2,
101
104
  uuid,
@@ -106,17 +109,17 @@ import {
106
109
  object2,
107
110
  strictObject2,
108
111
  looseObject,
109
- union2,
112
+ union3,
110
113
  discriminatedUnion,
111
114
  record2,
112
115
  _enum2,
113
116
  literal2,
114
117
  exports_iso
115
- } from "./cli-agfm16v9.js";
118
+ } from "./cli-hg42n3hx.js";
116
119
  import {
117
120
  init_package,
118
121
  package_default
119
- } from "./cli-msg9m2ny.js";
122
+ } from "./cli-rt0ag4x1.js";
120
123
  import {
121
124
  realtimeBus,
122
125
  init_bus
@@ -130,19 +133,17 @@ import {
130
133
  init_node_env
131
134
  } from "./cli-rgeadyvq.js";
132
135
  import {
136
+ chatgptSubscriptionModelId,
137
+ isAlias,
138
+ parseAlias,
139
+ harnessModelMismatch,
140
+ init_src2,
133
141
  scrubSecrets,
134
142
  scrubObject,
135
143
  registerVolatileSecret,
136
144
  registerSensitiveKeyName,
137
145
  init_secret_scrubber
138
- } from "./cli-1b7btd38.js";
139
- import {
140
- chatgptSubscriptionModelId,
141
- isAlias,
142
- parseAlias,
143
- harnessModelMismatch,
144
- init_src2
145
- } from "./cli-5c4hjzne.js";
146
+ } from "./cli-d84byzn8.js";
146
147
  import {
147
148
  __toCommonJS,
148
149
  __commonJS,
@@ -3286,7 +3287,7 @@ var init_types = __esm(() => {
3286
3287
  message: "oauthAuthorizationId is required when authKind is oauth.",
3287
3288
  path: ["oauthAuthorizationId"]
3288
3289
  });
3289
- CredentialBindingsDocumentSchema = union2([
3290
+ CredentialBindingsDocumentSchema = union3([
3290
3291
  array2(CredentialBindingSchema),
3291
3292
  object2({ bindings: array2(CredentialBindingSchema) })
3292
3293
  ]);
@@ -3796,8 +3797,92 @@ var init_crypto = __esm(() => {
3796
3797
  init_secrets_cipher();
3797
3798
  });
3798
3799
 
3799
- // src/be/db-client.ts
3800
+ // src/be/event-loop-lag.ts
3800
3801
  import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
3802
+ function withLoopPath(path, fn) {
3803
+ return pathContext.run(path, fn);
3804
+ }
3805
+ function bindLoopPath(path, fn) {
3806
+ return (...args) => pathContext.run(path, fn, ...args);
3807
+ }
3808
+ function currentLoopPath() {
3809
+ return pathContext.getStore() ?? "unknown";
3810
+ }
3811
+ function recordStatement(sql, ms) {
3812
+ if (ms < STATEMENT_RECORD_MIN_MS)
3813
+ return;
3814
+ if (ring.length === STATEMENT_RING_MAX)
3815
+ ring.shift();
3816
+ ring.push({ path: currentLoopPath(), sql, ms });
3817
+ }
3818
+ function stallWarnMs() {
3819
+ const raw = Number(process.env.EVENT_LOOP_STALL_WARN_MS);
3820
+ return Number.isFinite(raw) && raw > 0 ? raw : DEFAULT_STALL_WARN_MS;
3821
+ }
3822
+ function statementLabel(sql) {
3823
+ return scrubSecrets(sql.replace(/\s+/g, " ").trim()).slice(0, LABEL_MAX_CHARS);
3824
+ }
3825
+ function formatStallLine(lagMs, statements) {
3826
+ let dbMs = 0;
3827
+ const perPath = new Map;
3828
+ for (const s of statements) {
3829
+ dbMs += s.ms;
3830
+ perPath.set(s.path, (perPath.get(s.path) ?? 0) + 1);
3831
+ }
3832
+ const top = [...statements].sort((a, b) => b.ms - a.ms).slice(0, TOP_STATEMENTS);
3833
+ const path = top[0]?.path ?? "unknown";
3834
+ const parts = [
3835
+ `[event-loop] stall ${Math.round(lagMs)}ms`,
3836
+ `path=${path}`,
3837
+ `statements=${statements.length}`,
3838
+ `db_ms=${Math.round(dbMs)}`
3839
+ ];
3840
+ if (top.length > 0) {
3841
+ parts.push(`top=${top.map((s) => `${Math.round(s.ms)}ms:${statementLabel(s.sql)}`).join("|")}`);
3842
+ parts.push(`paths=${[...perPath].sort((a, b) => b[1] - a[1]).map(([p, n]) => `${p}:${n}`).join(",")}`);
3843
+ }
3844
+ return scrubSecrets(parts.join(" "));
3845
+ }
3846
+ function startEventLoopLagProbe(probeMs = PROBE_MS) {
3847
+ if (stopProbe)
3848
+ return stopProbe;
3849
+ let timer;
3850
+ let expected = performance.now() + probeMs;
3851
+ const schedule = () => {
3852
+ timer = setTimeout(tick, probeMs);
3853
+ timer.unref?.();
3854
+ };
3855
+ const tick = () => {
3856
+ const now = performance.now();
3857
+ const lag = now - expected;
3858
+ if (lag >= stallWarnMs())
3859
+ console.warn(formatStallLine(lag, ring));
3860
+ ring.length = 0;
3861
+ expected = now + probeMs;
3862
+ schedule();
3863
+ };
3864
+ pathContext.exit(schedule);
3865
+ const stop = () => {
3866
+ clearTimeout(timer);
3867
+ ring.length = 0;
3868
+ if (stopProbe === stop)
3869
+ stopProbe = null;
3870
+ };
3871
+ stopProbe = stop;
3872
+ return stop;
3873
+ }
3874
+ function stopEventLoopLagProbe() {
3875
+ stopProbe?.();
3876
+ }
3877
+ var pathContext, STATEMENT_RECORD_MIN_MS = 10, STATEMENT_RING_MAX = 256, ring, PROBE_MS = 100, DEFAULT_STALL_WARN_MS = 1000, TOP_STATEMENTS = 3, LABEL_MAX_CHARS = 60, stopProbe = null;
3878
+ var init_event_loop_lag = __esm(() => {
3879
+ init_secret_scrubber();
3880
+ pathContext = new AsyncLocalStorage2;
3881
+ ring = [];
3882
+ });
3883
+
3884
+ // src/be/db-client.ts
3885
+ import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
3801
3886
 
3802
3887
  class FifoLock {
3803
3888
  tail = Promise.resolve();
@@ -3830,11 +3915,12 @@ function isInTransaction() {
3830
3915
  return store !== undefined && !store.closed;
3831
3916
  }
3832
3917
  function warnIfSlowStatement(sql, durationMs) {
3918
+ recordStatement(sql, durationMs);
3833
3919
  if (durationMs < SLOW_STATEMENT_WARN_MS)
3834
3920
  return;
3835
- const flat = sql.replace(/\s+/g, " ").trim();
3921
+ const flat = scrubSecrets(sql.replace(/\s+/g, " ").trim());
3836
3922
  const shown = flat.length > SLOW_STATEMENT_SQL_MAX_CHARS ? `${flat.slice(0, SLOW_STATEMENT_SQL_MAX_CHARS)}…` : flat;
3837
- console.warn(`[db-client] slow sync statement blocked the event loop for ${Math.round(durationMs)}ms: ${scrubSecrets(shown)}`);
3923
+ console.warn(scrubSecrets(`[db-client] slow sync statement blocked the event loop for ${Math.round(durationMs)}ms path=${currentLoopPath()}: ${shown}`));
3838
3924
  }
3839
3925
  function timedStatement(sql, run) {
3840
3926
  const startedAt = performance.now();
@@ -4135,7 +4221,8 @@ function createBunSqliteClient(getDatabase, busyRetry) {
4135
4221
  var LOCK_WATCHDOG_MS = 30000, txContext, DEFAULT_FINAL_ATTEMPT_SPIN_MS = 250, DEFAULT_BUSY_RETRY, SLOW_STATEMENT_WARN_MS = 100, SLOW_STATEMENT_SQL_MAX_CHARS = 200, DEFAULT_MAX_GATE_MS = 1000, GATE_DECAY_MS = 5000;
4136
4222
  var init_db_client = __esm(() => {
4137
4223
  init_secret_scrubber();
4138
- txContext = new AsyncLocalStorage2;
4224
+ init_event_loop_lag();
4225
+ txContext = new AsyncLocalStorage3;
4139
4226
  DEFAULT_BUSY_RETRY = {
4140
4227
  maxWaitMs: 11000,
4141
4228
  backoffMs: [25, 50, 100, 250, ...Array(21).fill(500)],
@@ -5104,7 +5191,7 @@ var init_runtime2 = __esm(() => {
5104
5191
  // src/telemetry-identity.ts
5105
5192
  async function loadUserRole(userId) {
5106
5193
  try {
5107
- const { getUserGrant } = await import("./rbac-roles-66j5h4y5.js");
5194
+ const { getUserGrant } = await import("./rbac-roles-ehv8s10n.js");
5108
5195
  const grant = await getUserGrant(userId);
5109
5196
  const role = grant.grantsAll ? "admin" : "member";
5110
5197
  const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
@@ -6242,6 +6329,7 @@ function rowToAgentTask(row) {
6242
6329
  mentionChannelId: row.mentionChannelId ?? undefined,
6243
6330
  dir: row.dir ?? undefined,
6244
6331
  parentTaskId: row.parentTaskId ?? undefined,
6332
+ dispatchedByTaskId: row.dispatchedByTaskId ?? undefined,
6245
6333
  claudeSessionId: row.claudeSessionId ?? undefined,
6246
6334
  model: row.model ?? undefined,
6247
6335
  modelTier: parseModelTier(row.modelTier) ?? undefined,
@@ -6448,6 +6536,18 @@ async function getTasksByAgentId2(agentId, readableBy) {
6448
6536
  const rows = await getDbClient2().query(`SELECT * FROM agent_tasks WHERE agentId = ?${readable ? ` AND ${readable.sql}` : ""} ORDER BY createdAt DESC`, [agentId, ...readable?.params ?? []]);
6449
6537
  return rows.map(rowToAgentTask);
6450
6538
  }
6539
+ async function getTasksDispatchedFrom2(taskIds) {
6540
+ if (taskIds.length === 0)
6541
+ return [];
6542
+ const ids = JSON.stringify(taskIds);
6543
+ const rows = await getDbClient2().query(`SELECT t.*,
6544
+ (SELECT SUM(totalCostUsd) FROM session_costs WHERE session_costs.taskId = t.id) AS totalCostUsd
6545
+ FROM agent_tasks t
6546
+ WHERE t.dispatchedByTaskId IN (SELECT value FROM json_each(?))
6547
+ AND t.id NOT IN (SELECT value FROM json_each(?))
6548
+ ORDER BY t.createdAt, t.rowid`, [ids, ids]);
6549
+ return rows.map(rowToAgentTask);
6550
+ }
6451
6551
  async function getAgentCurrentTask2(agentId) {
6452
6552
  const row = await getDbClient2().get("SELECT * FROM agent_tasks WHERE agentId = ? AND status = 'in_progress' ORDER BY lastUpdatedAt DESC LIMIT 1", [agentId]);
6453
6553
  return row ? rowToAgentTask(row) : null;
@@ -6922,12 +7022,25 @@ async function getInProgressSlackTasks2() {
6922
7022
  LIMIT 200`);
6923
7023
  return rows.map(rowToAgentTask);
6924
7024
  }
6925
- async function getSlackTasksMissingTree2() {
6926
- const rows = await getDbClient2().query(`SELECT task.* FROM agent_tasks task
6927
- JOIN slack_render_v2_state state ON state.id = 1
6928
- WHERE task.source = 'slack'
7025
+ async function getSlackTasksMissingTree2(options = {}) {
7026
+ const thread = options.thread;
7027
+ const since = new Date((options.now ?? new Date).getTime() - SLACK_MISSING_TREE_WINDOW_MS).toISOString();
7028
+ const scope = thread ? {
7029
+ index: "idx_agent_tasks_slack_thread_cover",
7030
+ sql: "AND task.slackChannelId = ? AND task.slackThreadTs = ?",
7031
+ params: [thread.channelId, thread.threadTs]
7032
+ } : {
7033
+ index: "idx_agent_tasks_slack_last_updated",
7034
+ sql: "AND task.lastUpdatedAt >= ?",
7035
+ params: [since]
7036
+ };
7037
+ const rows = await getDbClient2().query(`SELECT task.* FROM slack_render_v2_state state
7038
+ CROSS JOIN agent_tasks task INDEXED BY ${scope.index}
7039
+ WHERE state.id = 1
7040
+ AND task.source = 'slack'
6929
7041
  AND task.slackChannelId IS NOT NULL
6930
7042
  AND task.slackThreadTs IS NOT NULL
7043
+ ${scope.sql}
6931
7044
  AND task.createdAt >= state.activated_at
6932
7045
  AND task.status NOT IN ('backlog', 'unassigned', 'superseded')
6933
7046
  AND NOT EXISTS (
@@ -6944,7 +7057,7 @@ async function getSlackTasksMissingTree2() {
6944
7057
  AND tree.thread_ts = task.slackThreadTs
6945
7058
  )
6946
7059
  ORDER BY task.lastUpdatedAt DESC
6947
- LIMIT 200`);
7060
+ LIMIT 200`, scope.params);
6948
7061
  return rows.map(rowToAgentTask);
6949
7062
  }
6950
7063
  async function getInProgressTasksByContextKey2(contextKey, statuses = ["pending", "in_progress", "offered", "paused"]) {
@@ -7006,13 +7119,19 @@ async function findExistingLinearTrackerContextWork2(contextKey, delegatingParen
7006
7119
  }
7007
7120
  return null;
7008
7121
  }
7009
- async function getLatestTaskByContextKey2(contextKey) {
7122
+ async function getLatestTaskByContextKey2(contextKey, options = {}) {
7010
7123
  if (!contextKey)
7011
7124
  return null;
7012
7125
  const row = await getDbClient2().get(`SELECT * FROM agent_tasks
7013
7126
  WHERE contextKey = ?
7127
+ ${options.requestedByUserId !== undefined ? "AND requestedByUserId = ?" : ""}
7128
+ ${options.notRequestedByUserId !== undefined ? "AND requestedByUserId IS NOT ?" : ""}
7014
7129
  ORDER BY createdAt DESC
7015
- LIMIT 1`, [contextKey]);
7130
+ LIMIT 1`, [
7131
+ contextKey,
7132
+ ...options.requestedByUserId !== undefined ? [options.requestedByUserId] : [],
7133
+ ...options.notRequestedByUserId !== undefined ? [options.notRequestedByUserId] : []
7134
+ ]);
7016
7135
  return row ? rowToAgentTask(row) : null;
7017
7136
  }
7018
7137
  async function getLatestScriptRunStepTaskByContextKey2(contextKey) {
@@ -7083,13 +7202,41 @@ async function getAgentWorkingOnContextKey2(contextKey, source, endedSince) {
7083
7202
  return getAgentById2(taskRow.agentId);
7084
7203
  return null;
7085
7204
  }
7086
- async function getLatestActiveTaskByContextKey2(contextKey, source) {
7205
+ async function getLatestTaskByContextKeyPrefix2(prefix, options = {}) {
7206
+ if (!prefix)
7207
+ return null;
7208
+ const upper = prefix.slice(0, -1) + String.fromCharCode(prefix.charCodeAt(prefix.length - 1) + 1);
7209
+ const source = options.source ?? null;
7210
+ const row = await getDbClient2().get(`SELECT * FROM agent_tasks
7211
+ WHERE contextKey >= ? AND contextKey < ?
7212
+ AND ${contextKeySourceSql()}
7213
+ ${options.activeOnly ? "AND status IN ('in_progress', 'pending')" : ""}
7214
+ ${options.requestedByUserId !== undefined ? "AND requestedByUserId = ?" : ""}
7215
+ ORDER BY createdAt DESC, rowid DESC
7216
+ LIMIT 1`, [
7217
+ prefix,
7218
+ upper,
7219
+ source,
7220
+ source,
7221
+ source,
7222
+ ...options.requestedByUserId !== undefined ? [options.requestedByUserId] : []
7223
+ ]);
7224
+ return row ? rowToAgentTask(row) : null;
7225
+ }
7226
+ async function getLatestActiveTaskByContextKey2(contextKey, source, requestedByUserId) {
7087
7227
  const row = await getDbClient2().get(`SELECT * FROM agent_tasks
7088
7228
  WHERE contextKey = ?
7089
7229
  AND ${contextKeySourceSql()}
7090
7230
  AND status IN ('in_progress', 'pending')
7231
+ ${requestedByUserId !== undefined ? "AND requestedByUserId = ?" : ""}
7091
7232
  ORDER BY createdAt DESC, rowid DESC
7092
- LIMIT 1`, [contextKey, source ?? null, source ?? null, source ?? null]);
7233
+ LIMIT 1`, [
7234
+ contextKey,
7235
+ source ?? null,
7236
+ source ?? null,
7237
+ source ?? null,
7238
+ ...requestedByUserId !== undefined ? [requestedByUserId] : []
7239
+ ]);
7093
7240
  return row ? rowToAgentTask(row) : null;
7094
7241
  }
7095
7242
  async function getLatestLeadTaskByContextKey2(contextKey, source) {
@@ -7179,7 +7326,7 @@ async function findRecentCancelledTaskInThread2(channelId, threadTs, windowMinut
7179
7326
  var dependencies2, TASK_PREVIEW_LENGTH = 300, TASK_PREVIEW_BYTES, SIBLING_OPEN = "<sibling_tasks_in_progress>", SIBLING_CLOSE = "</sibling_tasks_in_progress>", TASK_BLOB = "CAST(agent_tasks.task AS BLOB)", SIBLING_CLOSE_AT, SIBLING_END, TASK_PREVIEW_START, TASK_PREVIEW_SQL, taskPreviewDecoder, LIST_COLUMNS, TASK_LINEAGE_LIMITS2, LINEAGE_COLUMNS, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, NEVER_STARTED_TASK_STATUSES, findTaskByGitHub2, READABLE_WALK_MAX_DEPTH = 64, CHAT_RELAY_ELIGIBLE_SQL = `(obligation.last_attempt_at IS NULL
7180
7327
  OR (julianday(?) - julianday(obligation.last_attempt_at)) * 86400000.0 >=
7181
7328
  CASE WHEN obligation.attempt_count >= 8 THEN 600000
7182
- ELSE 3000 * (1 << obligation.attempt_count) END)`, LINEAR_TRACKER_CONTEXT_KEY_PREFIX = "task:trackers:linear:";
7329
+ ELSE 3000 * (1 << obligation.attempt_count) END)`, SLACK_MISSING_TREE_WINDOW_MS, LINEAR_TRACKER_CONTEXT_KEY_PREFIX = "task:trackers:linear:";
7183
7330
  var init_read = __esm(() => {
7184
7331
  init_key();
7185
7332
  init_types4();
@@ -7228,6 +7375,7 @@ var init_read = __esm(() => {
7228
7375
  "pending"
7229
7376
  ];
7230
7377
  findTaskByGitHub2 = findTaskByVcs2;
7378
+ SLACK_MISSING_TREE_WINDOW_MS = 24 * 60 * 60 * 1000;
7231
7379
  });
7232
7380
 
7233
7381
  // src/be/db/model-profiles.ts
@@ -7619,12 +7767,13 @@ async function getSessionGroupKey(task) {
7619
7767
  }
7620
7768
  function groupCondition(group, scan = false) {
7621
7769
  const { lo, hi } = keyPrefixRange(group);
7770
+ const kinds = parseAssetKey(group).relativeSegments.length === 0 ? NO_GROUP_LEAF_KINDS : SESSION_LEAF_KINDS;
7622
7771
  const start = [...lo].length + 1;
7623
7772
  const threadRoots = threadRootsSql();
7624
7773
  return {
7625
7774
  sql: `(${scan ? "+" : ""}r."key" >= ? AND ${scan ? "+" : ""}r."key" < ? AND (r."key" = ? OR (
7626
7775
  instr(substr(r."key", ?, length(r."key") - ?), '/') = 0 AND
7627
- (${SESSION_LEAF_KINDS.map(() => 'substr(r."key", ?) GLOB ?').join(" OR ")}) AND
7776
+ (${kinds.map(() => 'substr(r."key", ?) GLOB ?').join(" OR ")}) AND
7628
7777
  ${threadRoots.sql} < ?
7629
7778
  )))`,
7630
7779
  params: [
@@ -7633,7 +7782,7 @@ function groupCondition(group, scan = false) {
7633
7782
  lo,
7634
7783
  start,
7635
7784
  start,
7636
- ...SESSION_LEAF_KINDS.flatMap((kind) => [start, `${kind}:?*/`]),
7785
+ ...kinds.flatMap((kind) => [start, `${kind}:?*/`]),
7637
7786
  ...threadRoots.params,
7638
7787
  NESTED_THREAD_MIN_ROOTS
7639
7788
  ]
@@ -7648,8 +7797,20 @@ function noGroupCondition(userId) {
7648
7797
  params: groups.flatMap((g) => g.params)
7649
7798
  };
7650
7799
  }
7800
+ function resourceBases(userId) {
7801
+ return userId ? ["shared/", `personal/${userId}/`] : ["shared/"];
7802
+ }
7803
+ function inResourceScope(key, userId) {
7804
+ return resourceBases(userId).some((base) => SESSION_RESOURCE_KINDS.some((kind) => key.startsWith(`${base}${kind}:`)));
7805
+ }
7806
+ function resourceKeyRanges(userId) {
7807
+ return resourceBases(userId).flatMap((base) => SESSION_RESOURCE_KINDS.map((kind) => {
7808
+ const lo = normalizeAssetKey(`${base}${kind}:`).slice(0, -1);
7809
+ return { lo, hi: `${lo.slice(0, -1)};` };
7810
+ }));
7811
+ }
7651
7812
  function inboxScopeCondition(userId) {
7652
- const ranges = sourceKeyRanges();
7813
+ const ranges = [...sourceKeyRanges(), ...resourceKeyRanges(userId)];
7653
7814
  const noGroup = noGroupCondition(userId);
7654
7815
  return {
7655
7816
  sql: `(${ranges.map(() => '(+r."key" >= ? AND +r."key" < ?)').join(" OR ")} OR ${noGroup.sql})`,
@@ -7887,6 +8048,7 @@ async function getSessionTree(actor, now, opts = {}) {
7887
8048
  sources: [],
7888
8049
  sourceGroups: [],
7889
8050
  slackChannels: [],
8051
+ resourceGroups: [],
7890
8052
  threadLabels: {}
7891
8053
  };
7892
8054
  const hidden = new Set(opts.hideSource);
@@ -7894,6 +8056,7 @@ async function getSessionTree(actor, now, opts = {}) {
7894
8056
  const sources = new Map;
7895
8057
  const sourceGroups = new Set;
7896
8058
  const slackChannels = new Set;
8059
+ const resourceGroups = new Set;
7897
8060
  const threadRootIds = [];
7898
8061
  const groups = new Map;
7899
8062
  const add = (section, row) => {
@@ -7921,6 +8084,9 @@ async function getSessionTree(actor, now, opts = {}) {
7921
8084
  }
7922
8085
  if (sourceOfKey(key))
7923
8086
  sourceGroups.add(key);
8087
+ const resource = sessionResourceGroupOf(key);
8088
+ if (resource)
8089
+ resourceGroups.add(key).add(resource.resourceKey);
7924
8090
  if (hidden.has(source) || shown && !shown.has(source))
7925
8091
  continue;
7926
8092
  const noGroup = key === "shared/" || actor.kind === "user" && key === `personal/${actor.userId}/`;
@@ -7937,7 +8103,8 @@ async function getSessionTree(actor, now, opts = {}) {
7937
8103
  if (row.readState === "later" || row.readState === "done")
7938
8104
  add(result[row.readState], row);
7939
8105
  else {
7940
- if (noGroup || sourceOfKey(key))
8106
+ const viewer = actor.kind === "user" ? actor.userId : null;
8107
+ if (noGroup || sourceOfKey(key) || inResourceScope(row.key, viewer))
7941
8108
  add(result.inbox, row);
7942
8109
  if (noGroup)
7943
8110
  add(result.noGroup, row);
@@ -7949,6 +8116,7 @@ async function getSessionTree(actor, now, opts = {}) {
7949
8116
  result.sources = [...sources].map(([source, total]) => ({ source, total })).sort((a, b) => b.total - a.total || a.source.localeCompare(b.source));
7950
8117
  result.sourceGroups = [...sourceGroups].sort();
7951
8118
  result.slackChannels = [...slackChannels].sort();
8119
+ result.resourceGroups = [...resourceGroups].sort();
7952
8120
  if (threadRootIds.length) {
7953
8121
  const labels = await getDbClient2().query(`SELECT "key", title, prompt FROM (
7954
8122
  SELECT r."key", NULLIF(trim(r.title), '') AS title, ${THREAD_PROMPT_SQL} AS prompt,
@@ -8069,6 +8237,109 @@ var init_skill_search = __esm(() => {
8069
8237
  STOPWORDS = new Set(("a an and are as at be but by can do does for from get got have how i if in into is it its " + "me my need of on or our should so that the their them then there these this to use using " + "want was we what when where which who why will with would you your").split(" "));
8070
8238
  });
8071
8239
 
8240
+ // src/be/db/slack-trees.ts
8241
+ async function closeSlackTreeIfSettled(id) {
8242
+ const result = await getDbClient2().run(`UPDATE slack_messages AS tree SET closed_at = ?
8243
+ WHERE tree.id = ?
8244
+ AND tree.kind = 'tree'
8245
+ AND tree.closed_at IS NULL
8246
+ AND tree.ts NOT LIKE 'pending:%'
8247
+ AND EXISTS (
8248
+ SELECT 1 FROM slack_render_v2_state state
8249
+ WHERE state.id = 1 AND NOT ${SLACK_TREE_NEEDS_RENDER_SQL}
8250
+ )`, [new Date().toISOString(), id]);
8251
+ return result.changes > 0;
8252
+ }
8253
+ async function getSlackThreadsOfTasks(taskIds) {
8254
+ const threads = new Map;
8255
+ let wakeTouched = false;
8256
+ for (let i = 0;i < taskIds.length; i += THREAD_LOOKUP_CHUNK) {
8257
+ const chunk = taskIds.slice(i, i + THREAD_LOOKUP_CHUNK);
8258
+ const rows = await getDbClient2().query(`SELECT slackChannelId, slackThreadTs, taskType FROM agent_tasks
8259
+ WHERE id IN (${chunk.map(() => "?").join(",")})`, chunk);
8260
+ for (const row of rows) {
8261
+ if (row.taskType === "deferred")
8262
+ wakeTouched = true;
8263
+ if (!row.slackChannelId || !row.slackThreadTs)
8264
+ continue;
8265
+ threads.set(`${row.slackChannelId}\x00${row.slackThreadTs}`, {
8266
+ channelId: row.slackChannelId,
8267
+ threadTs: row.slackThreadTs
8268
+ });
8269
+ }
8270
+ }
8271
+ return { threads: [...threads.values()], wakeTouched };
8272
+ }
8273
+ async function slackThreadHasOutcomeWork(thread) {
8274
+ const row = await getDbClient2().get(`SELECT EXISTS (
8275
+ SELECT 1 FROM agent_tasks task, slack_render_v2_state state
8276
+ WHERE state.id = 1
8277
+ AND task.slackChannelId = ? AND task.slackThreadTs = ?
8278
+ AND task.source = 'slack'
8279
+ AND task.createdAt >= state.activated_at
8280
+ AND task.status IN ('completed', 'failed', 'cancelled')
8281
+ AND NOT EXISTS (
8282
+ SELECT 1 FROM slack_messages outcome
8283
+ WHERE outcome.kind = 'outcome'
8284
+ AND outcome.task_id = task.id
8285
+ AND (outcome.finalized_at IS NOT NULL OR outcome.delivery_abandoned_at IS NOT NULL)
8286
+ )
8287
+ ) OR EXISTS (
8288
+ SELECT 1 FROM slack_messages outcome
8289
+ WHERE outcome.kind = 'outcome'
8290
+ AND outcome.channel_id = ? AND outcome.thread_ts = ?
8291
+ AND outcome.finalized_at IS NULL AND outcome.delivery_abandoned_at IS NULL
8292
+ ) AS pending`, [thread.channelId, thread.threadTs, thread.channelId, thread.threadTs]);
8293
+ return !!row?.pending;
8294
+ }
8295
+ var SLACK_TREE_NEEDS_RENDER_SQL = `(
8296
+ (tree.ts LIKE 'pending:%' AND tree.created_at >= state.activated_at)
8297
+ OR EXISTS (
8298
+ SELECT 1 FROM agent_tasks task
8299
+ WHERE task.slackChannelId = tree.channel_id
8300
+ AND task.slackThreadTs = tree.thread_ts
8301
+ AND task.source = 'slack'
8302
+ AND task.createdAt >= state.activated_at
8303
+ AND task.status IN ('completed', 'failed', 'cancelled')
8304
+ AND NOT EXISTS (
8305
+ SELECT 1 FROM slack_messages outcome
8306
+ WHERE outcome.kind = 'outcome'
8307
+ AND outcome.task_id = task.id
8308
+ AND (outcome.finalized_at IS NOT NULL OR outcome.delivery_abandoned_at IS NOT NULL)
8309
+ )
8310
+ )
8311
+ OR
8312
+ EXISTS (
8313
+ SELECT 1 FROM agent_tasks task
8314
+ WHERE task.slackChannelId = tree.channel_id
8315
+ AND task.slackThreadTs = tree.thread_ts
8316
+ AND task.createdAt >= state.activated_at
8317
+ AND task.status NOT IN ('completed', 'failed', 'cancelled', 'superseded', 'skipped')
8318
+ )
8319
+ OR EXISTS (
8320
+ SELECT 1 FROM agent_tasks task
8321
+ WHERE task.slackChannelId = tree.channel_id
8322
+ AND task.slackThreadTs = tree.thread_ts
8323
+ AND task.createdAt >= state.activated_at
8324
+ AND task.lastUpdatedAt > tree.updated_at
8325
+ )
8326
+ OR EXISTS (
8327
+ SELECT 1 FROM slack_messages outcome
8328
+ JOIN agent_tasks task ON task.id = outcome.task_id
8329
+ WHERE outcome.kind = 'outcome'
8330
+ AND outcome.channel_id = tree.channel_id
8331
+ AND outcome.thread_ts = tree.thread_ts
8332
+ AND task.createdAt >= state.activated_at
8333
+ AND (
8334
+ (outcome.finalized_at IS NULL AND outcome.delivery_abandoned_at IS NULL)
8335
+ OR outcome.updated_at > tree.updated_at
8336
+ )
8337
+ )
8338
+ )`, THREAD_LOOKUP_CHUNK = 500;
8339
+ var init_slack_trees = __esm(() => {
8340
+ init_db4();
8341
+ });
8342
+
8072
8343
  // src/be/db/tasks/human-free.ts
8073
8344
  function humanFreeCase(parentFlag) {
8074
8345
  return `CASE
@@ -8609,7 +8880,7 @@ async function completeTask2(id, output, options) {
8609
8880
  });
8610
8881
  } catch {}
8611
8882
  getDbClient2().afterCommit(() => {
8612
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
8883
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
8613
8884
  workflowEventBus.emit("task.completed", {
8614
8885
  taskId: id,
8615
8886
  output: scrubbedOutput,
@@ -8664,7 +8935,7 @@ async function failTask2(id, reason, opts = {}) {
8664
8935
  });
8665
8936
  } catch {}
8666
8937
  getDbClient2().afterCommit(() => {
8667
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
8938
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
8668
8939
  workflowEventBus.emit("task.failed", {
8669
8940
  taskId: id,
8670
8941
  failureReason: scrubbedReason,
@@ -8746,7 +9017,7 @@ async function cancelTask2(id, reason, options = {}) {
8746
9017
  });
8747
9018
  } catch {}
8748
9019
  getDbClient2().afterCommit(() => {
8749
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
9020
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
8750
9021
  workflowEventBus.emit("task.cancelled", {
8751
9022
  taskId: id,
8752
9023
  agentId: row.agentId,
@@ -8758,7 +9029,7 @@ async function cancelTask2(id, reason, options = {}) {
8758
9029
  if (row.source === "schedule" && row.taskType === "deferred" && row.parentTaskId) {
8759
9030
  getDbClient2().afterCommit(async () => {
8760
9031
  try {
8761
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-bfx0h9hg.js");
9032
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-38xevga6.js");
8762
9033
  await createWorkerTaskFollowUp({
8763
9034
  task: rowToAgentTask(row),
8764
9035
  status: "failed",
@@ -8807,7 +9078,7 @@ async function skipTask2(id, reason) {
8807
9078
  });
8808
9079
  } catch {}
8809
9080
  getDbClient2().afterCommit(() => {
8810
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
9081
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
8811
9082
  workflowEventBus.emit("task.skipped", {
8812
9083
  taskId: id,
8813
9084
  failureReason: skipReason,
@@ -8859,7 +9130,7 @@ async function supersedeTask2(id, args) {
8859
9130
  });
8860
9131
  } catch {}
8861
9132
  getDbClient2().afterCommit(() => {
8862
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
9133
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
8863
9134
  workflowEventBus.emit("task.superseded", {
8864
9135
  taskId: id,
8865
9136
  reason: args.reason,
@@ -9074,7 +9345,7 @@ async function updateTaskProgress2(id, progress) {
9074
9345
  });
9075
9346
  } catch {}
9076
9347
  getDbClient2().afterCommit(() => {
9077
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
9348
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
9078
9349
  workflowEventBus.emit("task.progress", {
9079
9350
  taskId: id,
9080
9351
  progress: scrubbedProgress,
@@ -9535,7 +9806,7 @@ function emitRunFinished(runId, workflowId, status) {
9535
9806
  }
9536
9807
  function emitBusEventAfterCommit(event, payload) {
9537
9808
  getDbClient2().afterCommit(() => {
9538
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
9809
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
9539
9810
  workflowEventBus.emit(event, payload);
9540
9811
  }).catch((err) => console.error(`[db] ${event} event not emitted:`, scrubSecrets(err instanceof Error ? err.message : String(err))));
9541
9812
  });
@@ -9690,7 +9961,7 @@ var init_schema = __esm(() => {
9690
9961
  init_zod();
9691
9962
  CHAT_SDK_ADAPTER_NAMES = ["telegram", "slack", "discord", "teams"];
9692
9963
  ConfigRefSchema = strictObject2({ $config: string2().min(1) });
9693
- Str = union2([string2().trim().min(1), ConfigRefSchema]);
9964
+ Str = union3([string2().trim().min(1), ConfigRefSchema]);
9694
9965
  FORBIDDEN_ADAPTER_KEYS = [
9695
9966
  "apiUrl",
9696
9967
  "apiBaseUrl",
@@ -9705,7 +9976,7 @@ var init_schema = __esm(() => {
9705
9976
  botToken: Str,
9706
9977
  secretToken: Str.optional(),
9707
9978
  mode: _enum2(["webhook", "polling"]).default("webhook"),
9708
- allowedUserIds: array2(union2([string2(), number2()])).optional()
9979
+ allowedUserIds: array2(union3([string2(), number2()])).optional()
9709
9980
  };
9710
9981
  SLACK_SHAPE = {
9711
9982
  botToken: Str,
@@ -10403,6 +10674,7 @@ var init_swarm_config_guard = __esm(() => {
10403
10674
  "OTEL_TRACE_POLL",
10404
10675
  "OTEL_EXPORT_API_LOGS",
10405
10676
  "ANONYMIZED_TELEMETRY",
10677
+ "IMPROVEMENTS_ENABLED",
10406
10678
  "SWARM_HIDE_CLOUD_PROMO",
10407
10679
  "DB_QUERY_BOUNDED_ENABLED",
10408
10680
  "CLAUDE_TRUST_PRESEED",
@@ -10443,13 +10715,15 @@ var init_swarm_config_guard = __esm(() => {
10443
10715
  "SCRIPT_RUN_CONCURRENCY_CAP",
10444
10716
  "WORKER_API_READY_TIMEOUT_SECONDS",
10445
10717
  "DB_QUERY_HTTP_BUDGET_MS",
10718
+ "EVENT_LOOP_STALL_WARN_MS",
10446
10719
  "DB_QUERY_HTTP_MAX_ROWS",
10447
10720
  "DB_QUERY_MCP_BUDGET_MS",
10448
10721
  "DB_QUERY_MCP_MAX_ROWS",
10449
10722
  "AGENT_FS_REQUEST_TIMEOUT_MS",
10450
10723
  "SLACK_CONCLUSION_SETTLE_SEC",
10451
10724
  "SLACK_CONCLUSION_TIMEOUT_MIN",
10452
- "SLACK_TREE_STALL_MIN"
10725
+ "SLACK_TREE_STALL_MIN",
10726
+ "SLACK_TASK_WATCHER_INTERVAL_MS"
10453
10727
  ], 1),
10454
10728
  ...boundedIntegerValidatorsFor(DB_RETENTION_TUNING_BOUNDS),
10455
10729
  ...boundedIntegerValidators(["APPS_JSON_COLUMN_MAX_BYTES"], APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.min, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.max),
@@ -19103,7 +19377,7 @@ function noteEmbeddingSuccess() {
19103
19377
  const report = (what) => (err) => {
19104
19378
  console.error(`[memory] ${what} backfill after embeddings recovered failed:`, err.message);
19105
19379
  };
19106
- backfill2 = import("./embedding-space-b4txbwrk.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
19380
+ backfill2 = import("./embedding-space-4kyh5qqj.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
19107
19381
  backfill2 = null;
19108
19382
  });
19109
19383
  }
@@ -19905,6 +20179,9 @@ class SqliteMemoryStore {
19905
20179
  return rowToAgentMemory(row);
19906
20180
  }
19907
20181
  async search(embedding, agentId, options = {}) {
20182
+ return withLoopPath(`${currentLoopPath()} > memory.search`, () => this.searchInLoopPath(embedding, agentId, options));
20183
+ }
20184
+ async searchInLoopPath(embedding, agentId, options) {
19908
20185
  const {
19909
20186
  scope = "all",
19910
20187
  limit = 10,
@@ -20351,16 +20628,29 @@ class SqliteMemoryStore {
20351
20628
  }
20352
20629
  async purgeExpired() {
20353
20630
  const db = getDbClient2();
20354
- const expiredIds = await db.query("SELECT id FROM agent_memory WHERE expiresAt IS NOT NULL AND expiresAt <= datetime('now')");
20631
+ const expiredIds = await db.query("SELECT id FROM agent_memory WHERE expiresAt IS NOT NULL AND expiresAt <= datetime('now') ORDER BY id");
20355
20632
  if (expiredIds.length === 0)
20356
20633
  return 0;
20357
20634
  const batchSize = 500;
20635
+ let purged = 0;
20358
20636
  for (let i = 0;i < expiredIds.length; i += batchSize) {
20359
- await this.purgeByIds(expiredIds.slice(i, i + batchSize).map((r) => r.id));
20637
+ if (i > 0)
20638
+ await new Promise((resolve) => setImmediate(resolve));
20639
+ const batch = expiredIds.slice(i, i + batchSize).map((r) => r.id);
20640
+ purged += await db.transaction(async (tx) => {
20641
+ const placeholders = batch.map(() => "?").join(",");
20642
+ const still = await tx.query(`SELECT id FROM agent_memory WHERE id IN (${placeholders})
20643
+ AND expiresAt IS NOT NULL AND expiresAt <= datetime('now')`, batch);
20644
+ const ids = still.map((r) => r.id);
20645
+ if (ids.length === 0)
20646
+ return 0;
20647
+ await this.purgeByIds(ids);
20648
+ const result = await tx.run(`DELETE FROM agent_memory WHERE id IN (${ids.map(() => "?").join(",")})`, ids);
20649
+ return result.changes;
20650
+ });
20360
20651
  }
20361
- const result = await db.run("DELETE FROM agent_memory WHERE expiresAt IS NOT NULL AND expiresAt <= datetime('now')");
20362
- console.log(`[memory] Purged ${result.changes} expired memory row(s) (vec cleanup: ${expiredIds.length} id(s))`);
20363
- return result.changes;
20652
+ console.log(`[memory] Purged ${purged} expired memory row(s) (candidates: ${expiredIds.length} id(s))`);
20653
+ return purged;
20364
20654
  }
20365
20655
  async updateEmbedding(id, embedding, model) {
20366
20656
  const buffer = serializeEmbedding(embedding);
@@ -20516,6 +20806,7 @@ var init_sqlite_store = __esm(() => {
20516
20806
  init_embedding();
20517
20807
  init_profile_sync();
20518
20808
  init_secret_scrubber();
20809
+ init_event_loop_lag();
20519
20810
  init_constants2();
20520
20811
  init_key_paths();
20521
20812
  init_reranker();
@@ -21197,7 +21488,7 @@ async function loadSecretRegistry() {
21197
21488
  result.failed += 1;
21198
21489
  }
21199
21490
  try {
21200
- const { loadRuntimeControllerSecrets } = await import("./db-h2fsfve3.js");
21491
+ const { loadRuntimeControllerSecrets } = await import("./db-ez6egt6v.js");
21201
21492
  const loaded = await loadRuntimeControllerSecrets();
21202
21493
  result.runtimeController = loaded.count;
21203
21494
  result.failed += loaded.failed;
@@ -21346,7 +21637,7 @@ async function requestSteering(args) {
21346
21637
  }
21347
21638
  const requestedMode = args.mode ?? "queue";
21348
21639
  const onUnsupported = args.onUnsupported ?? "degrade";
21349
- const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-b1yz2bnn.js");
21640
+ const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-g3tt9hs9.js");
21350
21641
  const preSteer = await dispatchPre("pre.task.steer", {
21351
21642
  task,
21352
21643
  message: args.message,
@@ -21777,6 +22068,7 @@ __export(exports_db, {
21777
22068
  getLatestScriptRunStepTaskByContextKey: () => getLatestScriptRunStepTaskByContextKey2,
21778
22069
  getLatestStepForNode: () => getLatestStepForNode2,
21779
22070
  getLatestTaskByContextKey: () => getLatestTaskByContextKey2,
22071
+ getLatestTaskByContextKeyPrefix: () => getLatestTaskByContextKeyPrefix2,
21780
22072
  getLeadAgent: () => getLeadAgent2,
21781
22073
  getLiveAgentCounts: () => getLiveAgentCounts2,
21782
22074
  getLogsByAgentId: () => getLogsByAgentId2,
@@ -21886,6 +22178,7 @@ __export(exports_db, {
21886
22178
  getTasksByAgentId: () => getTasksByAgentId2,
21887
22179
  getTasksByStatus: () => getTasksByStatus2,
21888
22180
  getTasksCount: () => getTasksCount2,
22181
+ getTasksDispatchedFrom: () => getTasksDispatchedFrom2,
21889
22182
  getUnassignedPoolTasks: () => getUnassignedPoolTasks2,
21890
22183
  getUnassignedTaskIds: () => getUnassignedTaskIds2,
21891
22184
  getUnassignedTaskIdsForAgent: () => getUnassignedTaskIdsForAgent2,
@@ -22168,6 +22461,7 @@ function rowToSlackMessage(row) {
22168
22461
  deliveryAttempts: row.delivery_attempts,
22169
22462
  deliveryAbandonedAt: row.delivery_abandoned_at ?? undefined,
22170
22463
  deliveryLastError: row.delivery_last_error ?? undefined,
22464
+ closedAt: row.closed_at ?? undefined,
22171
22465
  createdAt: row.created_at,
22172
22466
  updatedAt: row.updated_at
22173
22467
  };
@@ -22304,9 +22598,9 @@ async function getSlackOutcomeMessage2(taskId) {
22304
22598
  }
22305
22599
  async function getResolvableDeferralOutcomes2(limit = 50) {
22306
22600
  const rows = await getDbClient2().query(`WITH RECURSIVE chain(card_id, task_id) AS (
22307
- SELECT card.id, deferred.id FROM slack_messages card
22308
- JOIN agent_tasks deferred ON deferred.id = card.task_id
22309
- WHERE card.kind = 'outcome' AND deferred.deferredAt IS NOT NULL
22601
+ SELECT card.id, deferred.id FROM agent_tasks deferred
22602
+ CROSS JOIN slack_messages card ON card.task_id = deferred.id AND card.kind = 'outcome'
22603
+ WHERE deferred.deferredAt IS NOT NULL
22310
22604
  AND card.deferral_resolved_at IS NULL AND card.finalized_at IS NOT NULL
22311
22605
  AND card.ts NOT LIKE 'pending:%'
22312
22606
  UNION
@@ -22324,7 +22618,7 @@ async function getResolvableDeferralOutcomes2(limit = 50) {
22324
22618
  AND card.ts NOT LIKE 'pending:%'
22325
22619
  AND NOT EXISTS (
22326
22620
  SELECT 1 FROM agent_tasks child
22327
- WHERE child.parentTaskId = wake.id AND child.taskType = 'deferred'
22621
+ WHERE child.parentTaskId = wake.id AND +child.taskType = 'deferred'
22328
22622
  )
22329
22623
  AND (wake.deferredAt IS NULL OR wake.finishedAt > card.updated_at)
22330
22624
  AND wake.status IN ('completed', 'failed', 'cancelled', 'skipped')
@@ -22360,56 +22654,16 @@ async function abandonSlackOutcomeDelivery2(taskId, lastError) {
22360
22654
  RETURNING *`, [now, lastError.slice(0, 500), now, taskId]);
22361
22655
  return row ? rowToSlackMessage(row) : null;
22362
22656
  }
22363
- async function getSlackTreeMessages2() {
22657
+ async function getSlackTreeMessages2(options = {}) {
22658
+ const thread = options.thread;
22364
22659
  const rows = await getDbClient2().query(`SELECT tree.*
22365
22660
  FROM slack_messages tree
22366
22661
  JOIN slack_render_v2_state state ON state.id = 1
22367
22662
  WHERE tree.kind = 'tree'
22368
- AND (
22369
- (tree.ts LIKE 'pending:%' AND tree.created_at >= state.activated_at)
22370
- OR EXISTS (
22371
- SELECT 1 FROM agent_tasks task
22372
- WHERE task.slackChannelId = tree.channel_id
22373
- AND task.slackThreadTs = tree.thread_ts
22374
- AND task.source = 'slack'
22375
- AND task.createdAt >= state.activated_at
22376
- AND task.status IN ('completed', 'failed', 'cancelled')
22377
- AND NOT EXISTS (
22378
- SELECT 1 FROM slack_messages outcome
22379
- WHERE outcome.kind = 'outcome'
22380
- AND outcome.task_id = task.id
22381
- AND (outcome.finalized_at IS NOT NULL OR outcome.delivery_abandoned_at IS NOT NULL)
22382
- )
22383
- )
22384
- OR
22385
- EXISTS (
22386
- SELECT 1 FROM agent_tasks task
22387
- WHERE task.slackChannelId = tree.channel_id
22388
- AND task.slackThreadTs = tree.thread_ts
22389
- AND task.createdAt >= state.activated_at
22390
- AND task.status NOT IN ('completed', 'failed', 'cancelled', 'superseded', 'skipped')
22391
- )
22392
- OR EXISTS (
22393
- SELECT 1 FROM agent_tasks task
22394
- WHERE task.slackChannelId = tree.channel_id
22395
- AND task.slackThreadTs = tree.thread_ts
22396
- AND task.createdAt >= state.activated_at
22397
- AND task.lastUpdatedAt > tree.updated_at
22398
- )
22399
- OR EXISTS (
22400
- SELECT 1 FROM slack_messages outcome
22401
- JOIN agent_tasks task ON task.id = outcome.task_id
22402
- WHERE outcome.kind = 'outcome'
22403
- AND outcome.channel_id = tree.channel_id
22404
- AND outcome.thread_ts = tree.thread_ts
22405
- AND task.createdAt >= state.activated_at
22406
- AND (
22407
- (outcome.finalized_at IS NULL AND outcome.delivery_abandoned_at IS NULL)
22408
- OR outcome.updated_at > tree.updated_at
22409
- )
22410
- )
22411
- )
22412
- ORDER BY tree.created_at ASC`);
22663
+ AND tree.closed_at IS NULL
22664
+ ${thread ? "AND tree.channel_id = ? AND tree.thread_ts = ?" : ""}
22665
+ AND ${SLACK_TREE_NEEDS_RENDER_SQL}
22666
+ ORDER BY tree.created_at ASC`, thread ? [thread.channelId, thread.threadTs] : []);
22413
22667
  return rows.map(rowToSlackMessage);
22414
22668
  }
22415
22669
  async function getSlackMessageByChannelTs2(channelId, ts) {
@@ -23309,32 +23563,35 @@ async function createTaskExtended2(task, options) {
23309
23563
  if (parent.mentionChannelId && !options.mentionChannelId) {
23310
23564
  options.mentionChannelId = parent.mentionChannelId;
23311
23565
  }
23312
- if (parent.vcsProvider && !options.vcsProvider) {
23313
- options.vcsProvider = parent.vcsProvider;
23314
- }
23315
- if (parent.vcsRepo && !options.vcsRepo) {
23316
- options.vcsRepo = parent.vcsRepo;
23317
- }
23318
- if (parent.vcsNumber != null && options.vcsNumber == null) {
23319
- options.vcsNumber = parent.vcsNumber;
23320
- }
23321
- if (parent.vcsEventType && !options.vcsEventType) {
23322
- options.vcsEventType = parent.vcsEventType;
23323
- }
23324
- if (parent.vcsCommentId != null && options.vcsCommentId == null) {
23325
- options.vcsCommentId = parent.vcsCommentId;
23326
- }
23327
- if (parent.vcsAuthor && !options.vcsAuthor) {
23328
- options.vcsAuthor = parent.vcsAuthor;
23329
- }
23330
- if (parent.vcsUrl && !options.vcsUrl) {
23331
- options.vcsUrl = parent.vcsUrl;
23332
- }
23333
- if (parent.vcsInstallationId != null && options.vcsInstallationId == null) {
23334
- options.vcsInstallationId = parent.vcsInstallationId;
23335
- }
23336
- if (parent.vcsNodeId && !options.vcsNodeId) {
23337
- options.vcsNodeId = parent.vcsNodeId;
23566
+ const inheritParentVcs = !options.vcsRepo || !!parent.vcsRepo && options.vcsRepo.toLowerCase() === parent.vcsRepo.toLowerCase();
23567
+ if (inheritParentVcs) {
23568
+ if (parent.vcsProvider && !options.vcsProvider) {
23569
+ options.vcsProvider = parent.vcsProvider;
23570
+ }
23571
+ if (parent.vcsRepo && !options.vcsRepo) {
23572
+ options.vcsRepo = parent.vcsRepo;
23573
+ }
23574
+ if (parent.vcsNumber != null && options.vcsNumber == null) {
23575
+ options.vcsNumber = parent.vcsNumber;
23576
+ }
23577
+ if (parent.vcsEventType && !options.vcsEventType) {
23578
+ options.vcsEventType = parent.vcsEventType;
23579
+ }
23580
+ if (parent.vcsCommentId != null && options.vcsCommentId == null) {
23581
+ options.vcsCommentId = parent.vcsCommentId;
23582
+ }
23583
+ if (parent.vcsAuthor && !options.vcsAuthor) {
23584
+ options.vcsAuthor = parent.vcsAuthor;
23585
+ }
23586
+ if (parent.vcsUrl && !options.vcsUrl) {
23587
+ options.vcsUrl = parent.vcsUrl;
23588
+ }
23589
+ if (parent.vcsInstallationId != null && options.vcsInstallationId == null) {
23590
+ options.vcsInstallationId = parent.vcsInstallationId;
23591
+ }
23592
+ if (parent.vcsNodeId && !options.vcsNodeId) {
23593
+ options.vcsNodeId = parent.vcsNodeId;
23594
+ }
23338
23595
  }
23339
23596
  if (parent.dir && !options.dir) {
23340
23597
  options.dir = parent.dir;
@@ -23485,9 +23742,9 @@ async function createTaskExtended2(task, options) {
23485
23742
  vcsProvider, vcsRepo, vcsEventType, vcsNumber, vcsCommentId, vcsAuthor, vcsUrl,
23486
23743
  vcsInstallationId, vcsNodeId,
23487
23744
  agentmailInboxId, agentmailMessageId, agentmailThreadId,
23488
- mentionMessageId, mentionChannelId, dir, parentTaskId, model, modelTier, effort, profile, scheduleId,
23745
+ mentionMessageId, mentionChannelId, dir, parentTaskId, dispatchedByTaskId, model, modelTier, effort, profile, scheduleId,
23489
23746
  workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree
23490
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
23747
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
23491
23748
  id,
23492
23749
  insertKey,
23493
23750
  options?.agentId ?? null,
@@ -23524,6 +23781,7 @@ async function createTaskExtended2(task, options) {
23524
23781
  options?.mentionChannelId ?? null,
23525
23782
  options?.dir ?? null,
23526
23783
  options?.parentTaskId ?? null,
23784
+ options?.dispatchedByTaskId ?? null,
23527
23785
  options?.model ?? null,
23528
23786
  options?.modelTier ?? null,
23529
23787
  options?.effort ?? null,
@@ -23593,7 +23851,7 @@ async function createTaskExtended2(task, options) {
23593
23851
  priority: row.priority
23594
23852
  }, (task) => task !== null, row.requestedByUserId);
23595
23853
  getDbClient2().afterCommit(() => {
23596
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => {
23854
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
23597
23855
  workflowEventBus.emit("task.created", {
23598
23856
  taskId: row.id,
23599
23857
  task: row.task,
@@ -23675,7 +23933,7 @@ async function releaseTask2(taskId, wakeSnapshot) {
23675
23933
  } catch {}
23676
23934
  if (isRuntimePoolsEnabled() && !wakeSnapshot)
23677
23935
  getDbClient2().afterCommit(() => {
23678
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
23936
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
23679
23937
  });
23680
23938
  }
23681
23939
  return row ? rowToAgentTask(row) : null;
@@ -23745,7 +24003,7 @@ async function rejectTask2(taskId, agentId, reason) {
23745
24003
  } catch {}
23746
24004
  if (isRuntimePoolsEnabled())
23747
24005
  getDbClient2().afterCommit(() => {
23748
- import("./event-bus-g0ka3pbw.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
24006
+ import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
23749
24007
  });
23750
24008
  }
23751
24009
  return row ? rowToAgentTask(row) : null;
@@ -25430,7 +25688,7 @@ async function deleteScheduledTask2(id) {
25430
25688
  const parent = await getTaskById2(deferred.parentTaskId);
25431
25689
  if (!parent?.deferredAt)
25432
25690
  return;
25433
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-bfx0h9hg.js");
25691
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-38xevga6.js");
25434
25692
  await createWorkerTaskFollowUp({
25435
25693
  task: parent,
25436
25694
  status: "failed",
@@ -29302,13 +29560,23 @@ async function sweepExpiredKv2(namespace, now = Date.now()) {
29302
29560
  AND expires_at <= ?`, [namespace, now]);
29303
29561
  return result.changes;
29304
29562
  }
29305
- async function sweepExpiredKvPrefix2(prefix, now = Date.now()) {
29563
+ async function sweepExpiredKvPrefix2(prefix, now = Date.now(), batchSize = 50) {
29564
+ batchSize = Math.max(1, Math.min(batchSize, 50));
29306
29565
  const escaped = prefix.replace(/[\\%_]/g, "\\$&");
29307
- const result = await getDbClient2().run(`DELETE FROM kv_entries
29308
- WHERE (namespace = ? OR namespace LIKE ? ESCAPE '\\')
29309
- AND expires_at IS NOT NULL
29310
- AND expires_at <= ?`, [prefix, `${escaped}:%`, now]);
29311
- return result.changes;
29566
+ let removed = 0;
29567
+ for (;; ) {
29568
+ const result = await getDbClient2().run(`DELETE FROM kv_entries
29569
+ WHERE (namespace, key) IN (
29570
+ SELECT namespace, key FROM kv_entries
29571
+ WHERE (namespace = ? OR namespace LIKE ? ESCAPE '\\')
29572
+ AND expires_at IS NOT NULL
29573
+ AND expires_at <= ?
29574
+ LIMIT ?)`, [prefix, `${escaped}:%`, now, batchSize]);
29575
+ removed += result.changes;
29576
+ if (result.changes < batchSize)
29577
+ return removed;
29578
+ await new Promise((resolve) => setImmediate(resolve));
29579
+ }
29312
29580
  }
29313
29581
  async function upsertKv2(input) {
29314
29582
  const encoded = encodeKvValue(input.value, input.valueType);
@@ -29757,6 +30025,7 @@ var init_db4 = __esm(() => {
29757
30025
  init_session_moves();
29758
30026
  init_session_tree();
29759
30027
  init_skill_search();
30028
+ init_slack_trees();
29760
30029
  init_human_free();
29761
30030
  init_read();
29762
30031
  init_write();
@@ -29834,4 +30103,4 @@ var init_db4 = __esm(() => {
29834
30103
  };
29835
30104
  });
29836
30105
 
29837
- export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, 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, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, isPrivateAddress, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, isEnvExportRestrictedKey, init_config_env_export, 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, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, 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, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, getAgentDefaultProfileName, repoModelOverrideKeys, taskProfileError, init_model_profiles, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, 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, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, 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, 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, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI2, init_openai2, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, 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, 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, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, 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 };
30106
+ export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, 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, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, isPrivateAddress, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, 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, 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, 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, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, 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, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, getAgentDefaultProfileName, repoModelOverrideKeys, taskProfileError, init_model_profiles, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasOutcomeWork, init_slack_trees, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI2, init_openai2, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, 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, 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, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, 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 };