@desplega.ai/agent-swarm 2.12.0 → 2.13.1

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 (417) hide show
  1. package/dist/acp-adapter-xtj40wd8.js +17 -0
  2. package/dist/{acp-targets-311gcyvw.js → acp-targets-n7vm5atw.js} +10 -9
  3. package/dist/{actions-c4chgxp6.js → actions-hq6wp9xv.js} +28 -27
  4. package/dist/{agent-fs-provision-0b9awm5n.js → agent-fs-provision-y0qc1rdd.js} +4 -4
  5. package/dist/{amp-adapter-r0veq6x5.js → amp-adapter-1qqs6h91.js} +3 -3
  6. package/dist/{app-hn5fftf5.js → app-7m4z44rv.js} +10 -8
  7. package/dist/{approval-notifications-3g6yc8nv.js → approval-notifications-8sr41gjx.js} +11 -10
  8. package/dist/{assistant-cpjgpjvp.js → assistant-hkczwfv6.js} +29 -28
  9. package/dist/{boot-args-schema-hce1av1h.js → boot-args-schema-8025snev.js} +1 -1
  10. package/dist/{boot-reembed-bztbxc4z.js → boot-reembed-15m87nr1.js} +5 -2
  11. package/dist/{boot-reembed-d7xcym0j.js → boot-reembed-4bbpxjh1.js} +1 -1
  12. package/dist/{boot-scrub-sweep-mkmm16gk.js → boot-scrub-sweep-eajr97e9.js} +2 -2
  13. package/dist/{boot-seeds-arrkbe8t.js → boot-seeds-9cwy39jx.js} +4 -4
  14. package/dist/{boxd-68n75y1s.js → boxd-hr8rsxzq.js} +1 -1
  15. package/dist/{claude-adapter-ykpyr5p8.js → claude-adapter-g61wa4rt.js} +9 -8
  16. package/dist/{claude-managed-adapter-ssg6z4bt.js → claude-managed-adapter-znkk0prm.js} +4 -4
  17. package/dist/{claude-managed-setup-trd59v7b.js → claude-managed-setup-f1wndkr2.js} +7 -7
  18. package/dist/{claude-sdk-session-yjcze0j1.js → claude-sdk-session-687xzf21.js} +20763 -19380
  19. package/dist/{cli-ya3kf4gs.js → cli-04103ryh.js} +1 -1
  20. package/dist/{cli-55tc8cj4.js → cli-0a336ze7.js} +5 -5
  21. package/dist/{cli-q8tc22bj.js → cli-0fx95c06.js} +5 -5
  22. package/dist/{cli-mq2fbgva.js → cli-0m77n7ej.js} +3 -3
  23. package/dist/{cli-7yn42w6m.js → cli-0xwb7zpt.js} +2 -2
  24. package/dist/{cli-mcymtvwn.js → cli-13t0smbk.js} +1000 -28
  25. package/dist/{cli-c7j31hq9.js → cli-1b5axkt1.js} +4 -4
  26. package/dist/{cli-yegz2g06.js → cli-1carhg8g.js} +4 -4
  27. package/dist/{cli-j5gtytvg.js → cli-1dr5at77.js} +15 -12
  28. package/dist/cli-2v4xxnx2.js +148 -0
  29. package/dist/{cli-sv2r3bw8.js → cli-32xndx6b.js} +7 -7
  30. package/dist/{cli-h70a2mxy.js → cli-3m8vqehw.js} +53 -13
  31. package/dist/{cli-ercwc8xn.js → cli-3mf04tkh.js} +1 -1
  32. package/dist/{cli-52nfye5j.js → cli-3zyme1wt.js} +24 -16
  33. package/dist/{cli-s6zk31gr.js → cli-43dsqhcp.js} +4 -4
  34. package/dist/{cli-b93d81yg.js → cli-4h90xaet.js} +2 -2
  35. package/dist/{cli-5tg94mdw.js → cli-4mj5g29m.js} +9 -12
  36. package/dist/{cli-47hz21se.js → cli-4tbvndmm.js} +4 -5
  37. package/dist/{cli-r0mz92by.js → cli-50whymxq.js} +2 -2
  38. package/dist/{cli-js10kdk7.js → cli-5basv0e7.js} +19 -5
  39. package/dist/{cli-krbcr00p.js → cli-5v6b2am8.js} +59 -5
  40. package/dist/{cli-en6dmkxd.js → cli-6r1dwegd.js} +3 -3
  41. package/dist/{cli-9qe5y107.js → cli-7ewre3dm.js} +15 -6
  42. package/dist/{cli-n3qe7tyr.js → cli-84xtgbn6.js} +35 -2
  43. package/dist/{cli-xm34qj8m.js → cli-8cmjkbvj.js} +2 -2
  44. package/dist/{cli-2m6yaq6b.js → cli-8fj8yfmk.js} +1 -1
  45. package/dist/{cli-nja15knq.js → cli-8rbkw18r.js} +3 -3
  46. package/dist/{cli-x05p2d05.js → cli-9tevdxyf.js} +1 -1
  47. package/dist/{cli-hhc47ack.js → cli-9xx36trj.js} +4 -4
  48. package/dist/{cli-39qm0rtm.js → cli-a8ts6x1n.js} +29 -150
  49. package/dist/{cli-bp6k9acz.js → cli-aebswqmz.js} +18 -18
  50. package/dist/{cli-ex1y88j3.js → cli-at67kvnp.js} +1 -1
  51. package/dist/{cli-q2dywc8h.js → cli-bjmq14k9.js} +4 -4
  52. package/dist/{cli-v9ya390t.js → cli-byxsctca.js} +12 -12
  53. package/dist/{cli-bz97ff9n.js → cli-c0tyzt73.js} +152 -12
  54. package/dist/{cli-fyaq4zdv.js → cli-c8kqmzzf.js} +9 -9
  55. package/dist/{cli-t75xngj1.js → cli-cd9acnvd.js} +12 -12
  56. package/dist/{cli-eqq0hwvx.js → cli-cmgdptmx.js} +3 -3
  57. package/dist/{cli-r14ac1y0.js → cli-cn6fpa1p.js} +1 -1
  58. package/dist/{cli-0k1a0sde.js → cli-cp0m07wb.js} +10 -10
  59. package/dist/{cli-3p288654.js → cli-cpkxh68d.js} +2 -2
  60. package/dist/{cli-fxd1mwtr.js → cli-cqxwjb93.js} +2 -2
  61. package/dist/{cli-8hp56wat.js → cli-d2epqm0y.js} +1 -1
  62. package/dist/{cli-73q4g5nx.js → cli-dd57p1gd.js} +21 -21
  63. package/dist/{cli-5z0g0e8v.js → cli-f8rcvf2x.js} +49 -13
  64. package/dist/{cli-wvjqaqcp.js → cli-fn8aj7gb.js} +1330 -249
  65. package/dist/{cli-bpje8n65.js → cli-fp65jdp2.js} +31 -6
  66. package/dist/{cli-0pp1yjg2.js → cli-gedf48yw.js} +11 -11
  67. package/dist/{cli-m5qtmrbc.js → cli-gq6qhmrr.js} +2 -2
  68. package/dist/{cli-5x03v6en.js → cli-grcc2h2g.js} +8 -8
  69. package/dist/{cli-01tvvtad.js → cli-h03j6je3.js} +4 -4
  70. package/dist/{cli-mbwmqb5w.js → cli-h0ewec3d.js} +1 -1
  71. package/dist/{cli-12vek61e.js → cli-h9bejmkf.js} +535 -146
  72. package/dist/{cli-gfy6hbd9.js → cli-hs3mqswp.js} +18 -11
  73. package/dist/{cli-tdk7jtka.js → cli-hv3820ez.js} +1 -1
  74. package/dist/{cli-pqfecppn.js → cli-je587f74.js} +1 -1
  75. package/dist/{cli-cjqyse9q.js → cli-jhtvt7gn.js} +3 -3
  76. package/dist/{cli-dkvtfgn4.js → cli-mmw2sjaf.js} +76 -17
  77. package/dist/{cli-2z2c4k6q.js → cli-mwxez0pz.js} +22 -0
  78. package/dist/{cli-yfpc6qy9.js → cli-nk8swfpx.js} +47 -16
  79. package/dist/{cli-eq4kew31.js → cli-p7g7wd9n.js} +26 -13
  80. package/dist/{cli-bhgrhedp.js → cli-q8aq48v1.js} +1 -1
  81. package/dist/{cli-dd2k2mcd.js → cli-qn79645p.js} +1 -1
  82. package/dist/{cli-ma9ys8rt.js → cli-qx1dwrr5.js} +7 -4
  83. package/dist/{cli-tm60vtax.js → cli-rfejbpe1.js} +1 -1
  84. package/dist/{cli-agjbj5x0.js → cli-s6fhqbz1.js} +38 -20
  85. package/dist/{cli-kwr5qv5g.js → cli-sfajkbd7.js} +2 -2
  86. package/dist/{cli-9y4tgrkf.js → cli-skd2c4ej.js} +2 -1
  87. package/dist/{cli-e8n0hdzd.js → cli-snypfjgj.js} +1 -1
  88. package/dist/{cli-n8f0fs3c.js → cli-t25rq8mg.js} +11 -11
  89. package/dist/{cli-72yms3ey.js → cli-t90k0phh.js} +201 -21
  90. package/dist/{cli-xf4z5bdn.js → cli-tzzas8rb.js} +4 -4
  91. package/dist/{cli-rtmqzat7.js → cli-vdfngx2g.js} +2 -2
  92. package/dist/{cli-9w8712tq.js → cli-vr4eyq6p.js} +43 -14
  93. package/dist/{cli-z4f346g5.js → cli-vx9acp12.js} +1 -1
  94. package/dist/{cli-2amwhyv2.js → cli-w24f3j49.js} +13 -11
  95. package/dist/cli-w41bvvms.js +148 -0
  96. package/dist/{cli-04zc3f7b.js → cli-w6c6dj91.js} +1 -1
  97. package/dist/{cli-fy4gb74g.js → cli-x5yb8zc8.js} +2 -2
  98. package/dist/{cli-2tw284hj.js → cli-xhkek467.js} +3 -3
  99. package/dist/{cli-5r95eqbh.js → cli-y260hgep.js} +1 -1
  100. package/dist/{cli-hbvgzjq4.js → cli-y6qqbpwc.js} +3 -3
  101. package/dist/{cli-7wy8gbwb.js → cli-ya1cj689.js} +1 -1
  102. package/dist/{cli-1htmtqc2.js → cli-yeh3g1q6.js} +620 -95
  103. package/dist/{cli-0vcqcwfn.js → cli-yfvhvw8m.js} +2 -0
  104. package/dist/{cli-k5jx8jya.js → cli-z6m6xzxt.js} +2 -2
  105. package/dist/{cli-pe3yxedk.js → cli-zaate0rd.js} +3 -3
  106. package/dist/{cli-n85m2wkq.js → cli-zkbz8m2q.js} +3 -2
  107. package/dist/{cli-e3ahxq5y.js → cli-zvpkrgsc.js} +6 -6
  108. package/dist/cli.js +30 -28
  109. package/dist/{codex-adapter-wc6e4wct.js → codex-adapter-ysfg6ty3.js} +8 -8
  110. package/dist/{codex-hook-aqtj17yr.js → codex-hook-c0nvm30r.js} +73 -2
  111. package/dist/{codex-login-1ven7yje.js → codex-login-ven5cz5j.js} +1 -1
  112. package/dist/{codex-session-runner-ppfgjd97.js → codex-session-runner-823scr6g.js} +9 -9
  113. package/dist/{commands-tsv2vx5b.js → commands-5rbm07fz.js} +3 -3
  114. package/dist/{controller-ye4sdwsy.js → controller-wn3vd217.js} +4 -4
  115. package/dist/{controllers-connect-zn4dg69h.js → controllers-connect-34jzhfft.js} +29 -28
  116. package/dist/core-kdehq26g.js +42 -0
  117. package/dist/{cursor-adapter-q2g9vwts.js → cursor-adapter-w1681kp1.js} +2 -2
  118. package/dist/{db-g111qn9j.js → db-6bkgbfwk.js} +3 -3
  119. package/dist/{db-3r1fyr2n.js → db-hcj16x7z.js} +4 -2
  120. package/dist/{devin-adapter-t8d86q9x.js → devin-adapter-fs90ab4v.js} +1 -1
  121. package/dist/{dispatcher-4q8s0mx8.js → dispatcher-jgjqrfzv.js} +28 -25
  122. package/dist/{docker-1b41eysj.js → docker-1h33jvh9.js} +2 -2
  123. package/dist/{dsh-adapter-mmcw1z5s.js → dsh-adapter-g9yqv09y.js} +2 -2
  124. package/dist/{e2b-xm60c8ad.js → e2b-jnk0yeva.js} +2 -2
  125. package/dist/{e2b-ew8c5j5v.js → e2b-y7e5kmzf.js} +2 -2
  126. package/dist/{easter-egg-3d-04ke6hcp.js → easter-egg-3d-w17nsny6.js} +1 -1
  127. package/dist/{embedding-space-kcdn52vz.js → embedding-space-v06fwy7b.js} +6 -6
  128. package/dist/{embeddings-jnzcd91a.js → embeddings-g50dxea4.js} +1 -1
  129. package/dist/{event-bus-v4ywhc2p.js → event-bus-08t2b4y2.js} +1 -1
  130. package/dist/{execute-74amghty.js → execute-1n36haw1.js} +1 -1
  131. package/dist/{external-channel-v9zgxnxz.js → external-channel-43tv8pg6.js} +2 -2
  132. package/dist/fx-adapter-bvh05t4a.js +20 -0
  133. package/dist/grok-adapter-my5j8mdf.js +20 -0
  134. package/dist/handlers-wyymeeqh.js +41 -0
  135. package/dist/heartbeat-sf3nk937.js +50 -0
  136. package/dist/{hook-p5reemds.js → hook-dqph1e05.js} +77 -18
  137. package/dist/{hook-k1h73zd7.js → hook-m1m9dm6w.js} +6 -5
  138. package/dist/{http-ms1z5xxy.js → http-w0th1cz9.js} +888 -226
  139. package/dist/index-22khdtby.js +44 -0
  140. package/dist/{index-76zzxtzf.js → index-c0e8en64.js} +1 -1
  141. package/dist/{index-620y7jzq.js → index-e8pz8qdg.js} +3 -3
  142. package/dist/{index-8p0j4h4j.js → index-ez823q84.js} +94 -89
  143. package/dist/{index-fbkqhvvj.js → index-ffba0z8q.js} +217 -165
  144. package/dist/{index-gjn6qfgn.js → index-gkpfgpg7.js} +1 -1
  145. package/dist/{index-4k7m5dgj.js → index-k8ajc0g0.js} +143 -103
  146. package/dist/index-np0582ac.js +40 -0
  147. package/dist/{index-kn63q1gr.js → index-pb03vans.js} +33 -32
  148. package/dist/index-vgkrj1jt.js +39 -0
  149. package/dist/{index-pe3d8jfy.js → index-whysn1wf.js} +1 -1
  150. package/dist/{index-0h6qd4p1.js → index-y4vd4mhn.js} +3 -4
  151. package/dist/{k8s-fy8hbhkg.js → k8s-8326q0rq.js} +2 -2
  152. package/dist/{keepalive-031js8jz.js → keepalive-2v06q2e8.js} +5 -4
  153. package/dist/lead-55z813ng.js +79 -0
  154. package/dist/{maintenance-sq9v3qx9.js → maintenance-vx7vjhhy.js} +1 -1
  155. package/dist/{oauth-refresh-sweep-zqmnyvs8.js → oauth-refresh-sweep-g06k4bza.js} +4 -3
  156. package/dist/{object-webhooks-r24wwb5y.js → object-webhooks-3dzdq4fm.js} +7 -7
  157. package/dist/{onboard-p25yhh7t.js → onboard-232pazny.js} +4 -4
  158. package/dist/{opencode-adapter-wcjc4zdk.js → opencode-adapter-t0paqbh8.js} +8 -7
  159. package/dist/{otel-impl-ff1gf20m.js → otel-impl-kmpkyp4y.js} +2 -2
  160. package/dist/{pending-hxj5yatb.js → pending-x0z3vx1x.js} +27 -26
  161. package/dist/{pi-mono-adapter-vkp4zz7p.js → pi-mono-adapter-7pmypn6d.js} +93 -22
  162. package/dist/{pricing-refresh-9w7gx41w.js → pricing-refresh-ytjmtyd7.js} +2 -2
  163. package/dist/{rbac-roles-84aw10nz.js → rbac-roles-fgm5mxr2.js} +3 -3
  164. package/dist/{rbac-roles-hz74vckp.js → rbac-roles-xyaxekh3.js} +7 -4
  165. package/dist/{registry-eeyx1201.js → registry-zv0zvxsx.js} +1 -1
  166. package/dist/{render-v2-nrdkg9gf.js → render-v2-ws972g4r.js} +12 -8
  167. package/dist/{resume-s6ey36rh.js → resume-m6mjzhkp.js} +13 -12
  168. package/dist/{runtime-x0b4pyam.js → runtime-zzpc0c8a.js} +1 -1
  169. package/dist/{session-access-xv49tk14.js → session-access-vp35xs91.js} +5 -4
  170. package/dist/{session-source-backfill-r5j988ah.js → session-source-backfill-p73e8zbe.js} +3 -3
  171. package/dist/{setup-mj0krk1p.js → setup-r4kd7rxg.js} +1 -1
  172. package/dist/thread-buffer-cm2nzq6t.js +42 -0
  173. package/dist/{tree-visibility-cbrsfaar.js → tree-visibility-07h2tbs2.js} +2 -2
  174. package/dist/{user-merge-jobs-f9d8nwnw.js → user-merge-jobs-96vg9rpe.js} +3 -3
  175. package/dist/{virtual-modules-ns0ryw05.js → virtual-modules-vgn3f2x4.js} +3 -3
  176. package/dist/{work-objects-pydhzast.js → work-objects-74hbcx3e.js} +31 -29
  177. package/dist/worker-5pn2vzx6.js +79 -0
  178. package/dist/{worker-follow-up-9z2xec5e.js → worker-follow-up-ezavwn5d.js} +26 -25
  179. package/dist/{x-3dtaf2r9.js → x-asbrnafg.js} +2 -2
  180. package/dist/xlsx-9acfmxr1.js +31534 -0
  181. package/openapi.json +2816 -1464
  182. package/package.json +13 -11
  183. package/src/agentmail/handlers.ts +26 -19
  184. package/src/apps/catalog.generated.json +757 -0
  185. package/src/apps/definition.ts +24 -7
  186. package/src/apps/page-validator.ts +225 -3
  187. package/src/apps/row-store.ts +37 -14
  188. package/src/azure-devops/handlers.ts +2 -0
  189. package/src/be/audit-user.ts +46 -6
  190. package/src/be/db/kv-windows.ts +22 -0
  191. package/src/be/db/session-moves.ts +3 -3
  192. package/src/be/db/session-tree.ts +52 -5
  193. package/src/be/db/skill-audit.ts +17 -0
  194. package/src/be/db/tasks/write.ts +18 -3
  195. package/src/be/db.ts +152 -33
  196. package/src/be/extensions/assets.ts +11 -7
  197. package/src/be/mcp-proxy.ts +5 -4
  198. package/src/be/memory/demotion-evidence.ts +2 -2
  199. package/src/be/memory/providers/sqlite-store.ts +151 -18
  200. package/src/be/memory/search-read-worker.ts +60 -0
  201. package/src/be/memory/search-reader.ts +223 -0
  202. package/src/be/migrations/337_favorites_session_hidden_key.sql +39 -0
  203. package/src/be/migrations/338_audit_agent_columns.sql +30 -0
  204. package/src/be/migrations/339_deferred_event_waits.sql +26 -0
  205. package/src/be/migrations/340_api_key_spend_cap.sql +5 -0
  206. package/src/be/model-tier-resolution.ts +18 -1
  207. package/src/be/multi-runtime.ts +17 -0
  208. package/src/be/primitives/object-embed.ts +250 -0
  209. package/src/be/primitives/objects.ts +29 -9
  210. package/src/be/primitives/sheets/service.ts +138 -6
  211. package/src/be/primitives/sheets/xlsx.ts +367 -0
  212. package/src/be/rbac-roles.ts +3 -0
  213. package/src/be/repo-checked-update.ts +4 -4
  214. package/src/be/repo-merge-policy.ts +26 -9
  215. package/src/be/schedules/validate.ts +26 -0
  216. package/src/be/scripts/boot-reembed.ts +6 -0
  217. package/src/be/scripts/db.ts +17 -5
  218. package/src/be/scripts/embeddings.ts +6 -0
  219. package/src/be/scripts/typecheck.ts +43 -2
  220. package/src/be/seed/schedules-seeder.ts +9 -1
  221. package/src/be/seed/workflows-seeder.ts +9 -1
  222. package/src/be/seed-scripts/index.ts +2 -0
  223. package/src/be/seed-skills/index.ts +12 -0
  224. package/src/be/swarm-config-guard.ts +5 -0
  225. package/src/be/unmapped-identities.ts +95 -1
  226. package/src/bitbucket/handlers.ts +2 -0
  227. package/src/commands/credential-outcome-report.ts +5 -2
  228. package/src/commands/onboard/agent-fs-version.ts +1 -1
  229. package/src/commands/provider-credentials.ts +19 -0
  230. package/src/commands/provider-error-class.ts +4 -1
  231. package/src/commands/rate-limit-outcome.ts +48 -3
  232. package/src/commands/runner.ts +113 -55
  233. package/src/commands/worktree-reaper.ts +600 -0
  234. package/src/event-waits/github.ts +43 -0
  235. package/src/event-waits/index.ts +29 -0
  236. package/src/event-waits/types.ts +51 -0
  237. package/src/extensions/contract-types.generated.ts +1 -1
  238. package/src/extensions/dispatcher.ts +9 -0
  239. package/src/fs/agent-fs-provider.ts +4 -1
  240. package/src/github/handlers.ts +3 -1
  241. package/src/github/pull-request-state.ts +34 -0
  242. package/src/gitlab/handlers.ts +12 -7
  243. package/src/hooks/codex-hook.ts +99 -1
  244. package/src/hooks/hook.ts +85 -11
  245. package/src/hooks/native-tool-hooks.ts +245 -0
  246. package/src/http/agents.ts +4 -0
  247. package/src/http/all-routes.ts +1 -0
  248. package/src/http/api-keys.ts +27 -3
  249. package/src/http/assets.ts +4 -3
  250. package/src/http/comb.ts +2 -2
  251. package/src/http/favorite-owner.ts +2 -2
  252. package/src/http/favorites.ts +3 -2
  253. package/src/http/fs.ts +13 -4
  254. package/src/http/index.ts +2 -0
  255. package/src/http/mcp-bridge.ts +4 -0
  256. package/src/http/objects.ts +265 -0
  257. package/src/http/pages-public.ts +40 -4
  258. package/src/http/pages.ts +3 -3
  259. package/src/http/poll.ts +43 -12
  260. package/src/http/pool-keys.ts +21 -2
  261. package/src/http/repos.ts +7 -6
  262. package/src/http/schedules.ts +38 -9
  263. package/src/http/script-connections.ts +14 -6
  264. package/src/http/script-runs.ts +12 -3
  265. package/src/http/scripts.ts +9 -0
  266. package/src/http/sessions.ts +30 -12
  267. package/src/http/skills.ts +17 -0
  268. package/src/http/task-requester.ts +2 -2
  269. package/src/http/tasks.ts +18 -12
  270. package/src/http/tool-hooks.ts +24 -2
  271. package/src/http/trackers/authorize-gate.ts +2 -2
  272. package/src/http/users.ts +136 -1
  273. package/src/http/workflow-events.ts +13 -0
  274. package/src/http/workflows.ts +21 -11
  275. package/src/linear/sync.ts +3 -1
  276. package/src/mcp-client/http-client.ts +3 -1
  277. package/src/oauth/identity-capture.ts +6 -1
  278. package/src/oauth/mcp-wrapper.ts +10 -3
  279. package/src/oauth/wrapper.ts +15 -3
  280. package/src/prompts/base-prompt.ts +35 -13
  281. package/src/prompts/session-templates.ts +26 -0
  282. package/src/providers/acp-targets.ts +2 -2
  283. package/src/providers/amp-adapter.ts +1 -1
  284. package/src/providers/dsh-adapter.ts +1 -1
  285. package/src/providers/opencode-adapter.ts +1 -0
  286. package/src/providers/opencode-swarm-plugin.ts +50 -1
  287. package/src/providers/pi-mono-adapter.ts +143 -11
  288. package/src/providers/pi-mono-extension.ts +69 -0
  289. package/src/providers/runtime-dependencies.ts +1 -1
  290. package/src/rbac/legacy-policy.ts +5 -0
  291. package/src/rbac/permissions.ts +16 -1
  292. package/src/scheduler/deferred-task-waits.ts +170 -13
  293. package/src/scripts-runtime/executors/types.ts +5 -0
  294. package/src/scripts-runtime/loader.ts +8 -0
  295. package/src/scripts-runtime/mcp-client.ts +4 -0
  296. package/src/scripts-runtime/sdk-allowlist.ts +14 -1
  297. package/src/scripts-runtime/swarm-config.ts +8 -0
  298. package/src/scripts-runtime/swarm-sdk.ts +4 -0
  299. package/src/scripts-runtime/types/stdlib.d.ts +47 -4
  300. package/src/scripts-runtime/types/swarm-extension.d.ts +8 -7
  301. package/src/scripts-runtime/types/swarm-sdk.d.ts +47 -4
  302. package/src/server.ts +4 -0
  303. package/src/slack/enrich.ts +94 -31
  304. package/src/slack/handlers.test.ts +55 -2
  305. package/src/slack/handlers.ts +38 -3
  306. package/src/slack/render-v2.ts +19 -0
  307. package/src/slack/session-mirror.ts +208 -0
  308. package/src/slack/thread-participants.ts +0 -5
  309. package/src/slack/watcher.ts +3 -0
  310. package/src/slack/work-objects.test.ts +2 -1
  311. package/src/slack/work-objects.ts +7 -2
  312. package/src/tests/agentmail-filters.test.ts +4 -3
  313. package/src/tests/agents-list-model-display.test.ts +23 -0
  314. package/src/tests/apps-spike2.test.ts +35 -0
  315. package/src/tests/audit-agent-person.test.ts +825 -0
  316. package/src/tests/audit-updated-by.test.ts +19 -12
  317. package/src/tests/base-prompt.test.ts +1 -0
  318. package/src/tests/claude-hook-output.test.ts +107 -2
  319. package/src/tests/claude-managed-setup.test.ts +1 -1
  320. package/src/tests/codex-adapter.test.ts +6 -6
  321. package/src/tests/codex-gpt6-release.test.ts +4 -4
  322. package/src/tests/db-task-read-contract.test.ts +1 -0
  323. package/src/tests/db-task-write-contract.test.ts +1 -0
  324. package/src/tests/deploy-guard.test.ts +24 -0
  325. package/src/tests/dsh-adapter.test.ts +1 -1
  326. package/src/tests/ensure-token.test.ts +2 -2
  327. package/src/tests/entrypoint-repo-autoclone-args.test.ts +202 -0
  328. package/src/tests/extensions-catalog.test.ts +33 -25
  329. package/src/tests/fake-dns.ts +47 -0
  330. package/src/tests/fixtures/base-prompt-baseline.json +12 -12
  331. package/src/tests/fixtures/sheets/eocd-count-mismatch.xlsx +0 -0
  332. package/src/tests/fixtures/sheets/rich-budget.xlsx +0 -0
  333. package/src/tests/fixtures/sheets/tracker-export.xlsx +0 -0
  334. package/src/tests/kv-storage.test.ts +3 -0
  335. package/src/tests/latest-model-report.test.ts +138 -0
  336. package/src/tests/mcp-oauth-dcr-reuse.test.ts +5 -2
  337. package/src/tests/mcp-oauth-ensure-token.test.ts +3 -2
  338. package/src/tests/mcp-oauth-manual-client.test.ts +6 -1
  339. package/src/tests/mcp-oauth-wrapper.test.ts +20 -4
  340. package/src/tests/mcp-outbound-fetch-guard.test.ts +169 -0
  341. package/src/tests/mcp-server-ssrf.test.ts +2 -0
  342. package/src/tests/memory-search-reader.test.ts +258 -0
  343. package/src/tests/memory-search-stall.test.ts +202 -20
  344. package/src/tests/model-control.test.ts +4 -4
  345. package/src/tests/model-tier-resolution.test.ts +2 -2
  346. package/src/tests/multi-runtime-registration.test.ts +8 -2
  347. package/src/tests/native-tool-hooks.test.ts +188 -0
  348. package/src/tests/oauth-connection-fetch-guard.test.ts +162 -0
  349. package/src/tests/oauth-token-endpoint-fetch-guard.test.ts +121 -0
  350. package/src/tests/oauth-wrapper.test.ts +1 -2
  351. package/src/tests/opencode-swarm-plugin.test.ts +6 -1
  352. package/src/tests/pages-head-v2.test.ts +2 -1
  353. package/src/tests/pi-provider-runtime-keys.test.ts +163 -0
  354. package/src/tests/poll-probe-readonly.test.ts +108 -0
  355. package/src/tests/primitives-sheets-xlsx.test.ts +549 -0
  356. package/src/tests/prompt-template-session.test.ts +3 -2
  357. package/src/tests/rbac-roles.test.ts +3 -0
  358. package/src/tests/script-connections-http.test.ts +8 -3
  359. package/src/tests/script-connections.test.ts +6 -0
  360. package/src/tests/seed-model-profiles.test.ts +1 -1
  361. package/src/tests/sessions-tree.test.ts +10 -2
  362. package/src/tests/slack-thread-participants.test.ts +77 -4
  363. package/src/tests/spend-cap-credentials.test.ts +34 -0
  364. package/src/tests/spend-cap-outcome.test.ts +67 -0
  365. package/src/tests/subscription-first.test.ts +119 -0
  366. package/src/tests/tool-registrar-no-input.test.ts +1 -0
  367. package/src/tests/worktree-reaper.test.ts +424 -0
  368. package/src/tools/defer-task.ts +154 -12
  369. package/src/tools/get-task-details.ts +247 -5
  370. package/src/tools/objects.ts +10 -5
  371. package/src/tools/repos/update-repo.ts +6 -6
  372. package/src/tools/schedules/create-schedule.ts +1 -0
  373. package/src/tools/schedules/list-schedules.ts +3 -0
  374. package/src/tools/schedules/patch-schedule.ts +38 -4
  375. package/src/tools/schedules/update-schedule.ts +40 -5
  376. package/src/tools/sheets.ts +66 -0
  377. package/src/tools/skills/skill-create.ts +6 -0
  378. package/src/tools/skills/skill-install-remote.ts +6 -0
  379. package/src/tools/skills/skill-sync-remote.ts +9 -0
  380. package/src/tools/skills/skill-update.ts +9 -1
  381. package/src/tools/tool-config.ts +3 -1
  382. package/src/tools/utils.ts +15 -0
  383. package/src/tools/workflows/create-workflow.ts +9 -4
  384. package/src/tools/workflows/patch-workflow-node.ts +1 -1
  385. package/src/tools/workflows/patch-workflow.ts +5 -2
  386. package/src/tools/workflows/update-workflow.ts +13 -7
  387. package/src/types.ts +96 -12
  388. package/src/utils/credentials.ts +36 -1
  389. package/src/utils/egress-guard.ts +40 -10
  390. package/src/utils/error-tracker.ts +17 -0
  391. package/src/workflows/input.ts +12 -5
  392. package/src/workflows/patch-definition.ts +13 -5
  393. package/src/workflows/triggers.ts +11 -6
  394. package/src/workflows/version.ts +7 -1
  395. package/templates/skills/apps/SKILL.md +191 -2
  396. package/templates/skills/apps/content.md +191 -2
  397. package/templates/skills/boards-and-sheets/config.json +14 -0
  398. package/templates/skills/boards-and-sheets/content.md +174 -0
  399. package/templates/skills/pages/content.md +11 -0
  400. package/templates/skills/swarm-docs/content.md +11 -0
  401. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  402. package/templates/skills/swarm-scripts/content.md +1 -0
  403. package/templates/workflows/ralph-loop/content.md +6 -6
  404. package/dist/acp-adapter-11m13kx4.js +0 -16
  405. package/dist/cli-pr0eze3x.js +0 -149
  406. package/dist/core-dxcy02sc.js +0 -41
  407. package/dist/fx-adapter-0ar6pqm3.js +0 -19
  408. package/dist/grok-adapter-t6m74fb1.js +0 -19
  409. package/dist/handlers-9kwcrc4k.js +0 -38
  410. package/dist/heartbeat-p8pk1msj.js +0 -49
  411. package/dist/index-23cdfzr6.js +0 -39
  412. package/dist/index-g7kkjs5b.js +0 -38
  413. package/dist/index-stk36pa5.js +0 -43
  414. package/dist/lead-mfggjtfk.js +0 -77
  415. package/dist/thread-buffer-temgaqsy.js +0 -41
  416. package/dist/worker-efcemc22.js +0 -77
  417. /package/dist/{cli-cah298e5.js → cli-m4ejz4nj.js} +0 -0
@@ -1,10 +1,21 @@
1
+ import {
2
+ ALL_TOOLS,
3
+ init_tool_config
4
+ } from "./cli-yfvhvw8m.js";
1
5
  import {
2
6
  assertProviderQuotaCapacity,
3
7
  parseProviderAccount,
4
8
  applyProviderQuotaReport,
5
9
  scrubProviderQuotaReport,
6
10
  init_provider_account_telemetry
7
- } from "./cli-7wy8gbwb.js";
11
+ } from "./cli-ya1cj689.js";
12
+ import {
13
+ CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
14
+ CODEX_AUTH_FAILURE_BENCH_MS,
15
+ CODEX_AUTH_WATCH_NAMESPACE,
16
+ codexAuthBenchMarkerKey,
17
+ init_codex_auth_failure
18
+ } from "./cli-fw2w0kva.js";
8
19
  import {
9
20
  resolveGitHubHost,
10
21
  getGitHubLinkConfig,
@@ -16,56 +27,7 @@ import {
16
27
  ampPinCatalogError,
17
28
  ampModelError,
18
29
  init_amp_models
19
- } from "./cli-tm60vtax.js";
20
- import {
21
- normalizeAssetKey,
22
- defaultAssetKey,
23
- keyPrefixRange,
24
- SESSION_RESOURCE_KINDS,
25
- SESSION_LEAF_KINDS,
26
- NO_GROUP_LEAF_KINDS,
27
- isGroupKey,
28
- isResourceGroupPrefix,
29
- sessionResourceGroupOf,
30
- sessionGroupKey,
31
- parseAssetKey,
32
- isCanonicalAssetKey,
33
- init_key,
34
- MODEL_TIERS,
35
- ReasoningEffortSchema,
36
- DEFAULT_MODEL_TIER_MAP,
37
- parseModelTier,
38
- TERMINAL_TASK_STATUSES,
39
- isTerminalTaskStatus,
40
- OPEN_TASK_STATUSES,
41
- ProviderNameSchema,
42
- ModelProfileCredentialsSchema,
43
- FallbackHopSchema,
44
- PROVIDER_STEER_CAPABILITIES,
45
- FollowUpConfigSchema,
46
- RoutingAffinitySchema,
47
- TaskSlackParticipantsSchema,
48
- CreateTaskOptionsSchema,
49
- SERVER_GENERATED_ATTACHMENT_CAPABILITY,
50
- AgentAvatarSchema,
51
- AgentSlackIconSchema,
52
- VersionableFieldSchema,
53
- SessionCostModelBreakdownSchema,
54
- SUPERSEDED_WORKFLOW_TASK_REASON,
55
- PageThemeTokensSchema,
56
- init_types5
57
- } from "./cli-5z0g0e8v.js";
58
- import {
59
- ALL_TOOLS,
60
- init_tool_config
61
- } from "./cli-0vcqcwfn.js";
62
- import {
63
- CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
64
- CODEX_AUTH_FAILURE_BENCH_MS,
65
- CODEX_AUTH_WATCH_NAMESPACE,
66
- codexAuthBenchMarkerKey,
67
- init_codex_auth_failure
68
- } from "./cli-fw2w0kva.js";
30
+ } from "./cli-rfejbpe1.js";
69
31
  import {
70
32
  init_templates4,
71
33
  generateDefaultClaudeMd2,
@@ -80,15 +42,15 @@ import {
80
42
  init_identity_field_budget,
81
43
  contentSha256,
82
44
  init_profile_sync
83
- } from "./cli-agjbj5x0.js";
84
- import {
85
- isSteeringEnabled2,
86
- init_steering_enabled
87
- } from "./cli-4sydckyj.js";
45
+ } from "./cli-s6fhqbz1.js";
88
46
  import {
89
47
  isSlackConfigured,
90
48
  init_config4
91
49
  } from "./cli-eetzmsy5.js";
50
+ import {
51
+ isSteeringEnabled2,
52
+ init_steering_enabled
53
+ } from "./cli-4sydckyj.js";
92
54
  import {
93
55
  kindForModelString,
94
56
  init_models2
@@ -108,7 +70,7 @@ import {
108
70
  splitCredentialPool,
109
71
  selectCredential,
110
72
  init_credentials2
111
- } from "./cli-js10kdk7.js";
73
+ } from "./cli-5basv0e7.js";
112
74
  import {
113
75
  getOpenRouterAttributionHeaders,
114
76
  init_openrouter_base_url
@@ -120,12 +82,50 @@ import {
120
82
  configureDbResolver,
121
83
  init_resolver,
122
84
  init_session_templates
123
- } from "./cli-2z2c4k6q.js";
85
+ } from "./cli-mwxez0pz.js";
86
+ import {
87
+ normalizeAssetKey,
88
+ defaultAssetKey,
89
+ keyPrefixRange,
90
+ SESSION_RESOURCE_KINDS,
91
+ SESSION_LEAF_KINDS,
92
+ NO_GROUP_LEAF_KINDS,
93
+ isGroupKey,
94
+ isResourceGroupPrefix,
95
+ sessionResourceGroupOf,
96
+ sessionGroupKey,
97
+ parseAssetKey,
98
+ isCanonicalAssetKey,
99
+ init_key,
100
+ MODEL_TIERS,
101
+ ReasoningEffortSchema,
102
+ DEFAULT_MODEL_TIER_MAP,
103
+ parseModelTier,
104
+ TERMINAL_TASK_STATUSES,
105
+ isTerminalTaskStatus,
106
+ OPEN_TASK_STATUSES,
107
+ ProviderNameSchema,
108
+ ModelProfileCredentialsSchema,
109
+ FallbackHopSchema,
110
+ PROVIDER_STEER_CAPABILITIES,
111
+ FollowUpConfigSchema,
112
+ RoutingAffinitySchema,
113
+ TaskSlackParticipantsSchema,
114
+ CreateTaskOptionsSchema,
115
+ SERVER_GENERATED_ATTACHMENT_CAPABILITY,
116
+ AgentAvatarSchema,
117
+ AgentSlackIconSchema,
118
+ VersionableFieldSchema,
119
+ SessionCostModelBreakdownSchema,
120
+ SUPERSEDED_WORKFLOW_TASK_REASON,
121
+ PageThemeTokensSchema,
122
+ init_types5
123
+ } from "./cli-f8rcvf2x.js";
124
124
  import {
125
125
  setRuntimeModelCatalog,
126
126
  runtimeHarnessSections,
127
127
  init_runtime_model_catalog
128
- } from "./cli-bhgrhedp.js";
128
+ } from "./cli-q8aq48v1.js";
129
129
  import {
130
130
  init_zod
131
131
  } from "./cli-96234j5w.js";
@@ -153,7 +153,7 @@ import {
153
153
  import {
154
154
  init_package,
155
155
  package_default
156
- } from "./cli-2amwhyv2.js";
156
+ } from "./cli-w24f3j49.js";
157
157
  import {
158
158
  getNodeEnv,
159
159
  init_node_env
@@ -184,7 +184,7 @@ import {
184
184
  registerVolatileSecret,
185
185
  registerSensitiveKeyName,
186
186
  init_secret_scrubber
187
- } from "./cli-bpje8n65.js";
187
+ } from "./cli-fp65jdp2.js";
188
188
  import {
189
189
  __toCommonJS,
190
190
  __commonJS,
@@ -700,6 +700,7 @@ function matchesAllowlist(url, allowlist) {
700
700
  });
701
701
  }
702
702
  async function assertEgressAllowed(url, options) {
703
+ options.checkUrl?.(url);
703
704
  if (url.protocol !== "http:" && url.protocol !== "https:") {
704
705
  if (url.protocol === "data:" || url.protocol === "blob:")
705
706
  return null;
@@ -707,6 +708,7 @@ async function assertEgressAllowed(url, options) {
707
708
  }
708
709
  if (options.isTrusted?.(url))
709
710
  return null;
711
+ const label = options.label ?? "Script egress refused";
710
712
  const { policy } = options;
711
713
  if (policy.allowlist && policy.allowlist.length > 0) {
712
714
  if (matchesAllowlist(url, policy.allowlist))
@@ -716,7 +718,7 @@ async function assertEgressAllowed(url, options) {
716
718
  if (policy.allowPrivate)
717
719
  return null;
718
720
  const host = stripBrackets(url.hostname);
719
- const denied = () => new EgressDeniedError(`Script egress refused: ${url.host} is a private or loopback address. Add it to SCRIPT_EGRESS_ALLOWLIST or set SCRIPT_EGRESS_ALLOW_PRIVATE=true`);
721
+ const denied = () => new EgressDeniedError(`${label}: ${url.host} is a private or loopback address.${options.label ? "" : " Add it to SCRIPT_EGRESS_ALLOWLIST or set SCRIPT_EGRESS_ALLOW_PRIVATE=true"}`);
720
722
  if (isLoopbackName(host))
721
723
  throw denied();
722
724
  if (isIPv4Literal(host) || isIPv6Literal(host)) {
@@ -728,10 +730,10 @@ async function assertEgressAllowed(url, options) {
728
730
  try {
729
731
  addresses = await (options.resolve ?? defaultResolve)(host);
730
732
  } catch (error) {
731
- throw new EgressDeniedError(`Script egress refused: could not resolve ${host} (${error instanceof Error ? error.message : String(error)})`);
733
+ throw new EgressDeniedError(`${label}: could not resolve ${host} (${error instanceof Error ? error.message : String(error)})`);
732
734
  }
733
735
  if (addresses.length === 0) {
734
- throw new EgressDeniedError(`Script egress refused: ${host} resolved to no address`);
736
+ throw new EgressDeniedError(`${label}: ${host} resolved to no address`);
735
737
  }
736
738
  if (addresses.some(isPrivateAddress))
737
739
  throw denied();
@@ -854,7 +856,7 @@ function createGuardedFetch(baseFetch, options) {
854
856
  if (mode === "error")
855
857
  throw new TypeError(`fetch redirect refused (redirect: "error"): ${url.href}`);
856
858
  if (hop >= MAX_REDIRECTS) {
857
- throw new EgressDeniedError(`Script egress refused: more than ${MAX_REDIRECTS} redirects`);
859
+ throw new EgressDeniedError(`${options.label ?? "Script egress refused"}: more than ${MAX_REDIRECTS} redirects`);
858
860
  }
859
861
  await response.body?.cancel().catch(() => {});
860
862
  const next = new URL(location, url);
@@ -870,6 +872,15 @@ function createGuardedFetch(baseFetch, options) {
870
872
  };
871
873
  return Object.assign(guarded, { preconnect: baseFetch.preconnect });
872
874
  }
875
+ function createSsrfGuardedFetch(opts, baseFetch = (input, init) => fetch(input, init)) {
876
+ return createGuardedFetch(baseFetch, {
877
+ policy: { allowPrivate: opts.allowPrivateHosts === true, allowlist: null },
878
+ checkUrl: (url) => {
879
+ assertUrlSafe(url.href, opts);
880
+ },
881
+ label: "Outbound request refused"
882
+ });
883
+ }
873
884
  function parseEgressAllowlist(value) {
874
885
  const entries = (value ?? "").split(",").map((entry) => entry.trim()).filter(Boolean);
875
886
  return entries.length > 0 ? entries : null;
@@ -5691,7 +5702,7 @@ var init_telemetry = __esm(() => {
5691
5702
  // src/telemetry-identity.ts
5692
5703
  async function loadUserRole(userId) {
5693
5704
  try {
5694
- const { getUserGrant } = await import("./rbac-roles-84aw10nz.js");
5705
+ const { getUserGrant } = await import("./rbac-roles-fgm5mxr2.js");
5695
5706
  const grant = await getUserGrant(userId);
5696
5707
  const role = grant.grantsAll ? "admin" : "member";
5697
5708
  const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
@@ -6579,7 +6590,7 @@ function scheduleApprovalCardUpdates(approvals) {
6579
6590
  const posted = approvals.filter((approval) => approval.notificationChannels?.some((n) => n.channel === "slack" && n.messageTs));
6580
6591
  if (posted.length === 0)
6581
6592
  return;
6582
- getDbClient2().afterCommit(() => import("./approval-notifications-3g6yc8nv.js").then(({ updateResolvedApprovalCards }) => updateResolvedApprovalCards(posted)).catch((err) => console.error("[HITL] Slack card update not run:", scrubSecrets(err instanceof Error ? err.message : String(err)))));
6593
+ getDbClient2().afterCommit(() => import("./approval-notifications-8sr41gjx.js").then(({ updateResolvedApprovalCards }) => updateResolvedApprovalCards(posted)).catch((err) => console.error("[HITL] Slack card update not run:", scrubSecrets(err instanceof Error ? err.message : String(err)))));
6583
6594
  }
6584
6595
  var init_approvals = __esm(() => {
6585
6596
  init_secret_scrubber();
@@ -6953,6 +6964,8 @@ var init_legacy_policy = __esm(() => {
6953
6964
  "comb.presence": operatorOrUser,
6954
6965
  "fs.join.own": anyAuthenticated,
6955
6966
  "page.delete.any": leadOrResourceOwner,
6967
+ "objects.read": operatorOrUser,
6968
+ "objects.write": operatorOrUser,
6956
6969
  "app.manage": anyAuthenticated,
6957
6970
  "app.use": anyAuthenticated,
6958
6971
  "script.global.write": leadOnly,
@@ -6964,6 +6977,7 @@ var init_legacy_policy = __esm(() => {
6964
6977
  "script.api.rotate": leadOnly,
6965
6978
  "script.api.delete": leadOnly,
6966
6979
  "schedule.deferral.update.any": leadOrResourceOwner,
6980
+ "schedule.target.update.any": leadOrResourceOwner,
6967
6981
  "runtime_pool.write": operatorOrUser,
6968
6982
  "runtime_pool.bind": leadOrOperatorOrUser,
6969
6983
  "runtime_controller.write": operatorOrUser,
@@ -7140,7 +7154,7 @@ var init_permissions = __esm(() => {
7140
7154
  namespace: "channel"
7141
7155
  },
7142
7156
  "repo.merge-policy.write": {
7143
- description: "Change a repo's allowMerge guideline, which tells agents whether they may merge a PR themselves.",
7157
+ description: "Change a repo's merge policy (the allowMerge guideline or the mergePolicy record), which tells agents whether they may merge a PR themselves and which PRs the swarm may auto-merge.",
7144
7158
  namespace: "repo"
7145
7159
  },
7146
7160
  "integration.kapso.manage": {
@@ -7323,6 +7337,14 @@ var init_permissions = __esm(() => {
7323
7337
  description: "Delete a page the caller does not own.",
7324
7338
  namespace: "page"
7325
7339
  },
7340
+ "objects.read": {
7341
+ description: "Read a board or sheet on the swarm's shared agent-fs drive through the object routes.",
7342
+ namespace: "objects"
7343
+ },
7344
+ "objects.write": {
7345
+ description: "Save a board or edit sheet cells on the swarm's shared agent-fs drive through the object routes.",
7346
+ namespace: "objects"
7347
+ },
7326
7348
  "app.manage": {
7327
7349
  description: "Create, update, delete, or roll back apps, and inspect app version history.",
7328
7350
  namespace: "app"
@@ -7367,6 +7389,10 @@ var init_permissions = __esm(() => {
7367
7389
  description: "Change a defer-task schedule the caller did not create.",
7368
7390
  namespace: "schedule"
7369
7391
  },
7392
+ "schedule.target.update.any": {
7393
+ description: "Change what a schedule the caller did not create runs (its target, task template, workflow, script, script args or params).",
7394
+ namespace: "schedule"
7395
+ },
7370
7396
  "runtime_pool.write": {
7371
7397
  description: "Create, update, or delete runtime pools (image, provider kind, placement).",
7372
7398
  namespace: "runtime_pool"
@@ -8464,8 +8490,16 @@ async function getAgentModelTierOverrides(agentId) {
8464
8490
  return {};
8465
8491
  }
8466
8492
  }
8493
+ function storedModelTierOverrides(overrides) {
8494
+ return Object.keys(overrides).length > 0 ? JSON.stringify(overrides) : null;
8495
+ }
8496
+ async function modelTierOverridesDiffer(agentId, overrides) {
8497
+ const next = storedModelTierOverrides(overrides);
8498
+ const row = await getDbClient2().get("SELECT id FROM agents WHERE id = ? AND modelTierOverrides IS NOT ?", [agentId, next]);
8499
+ return row !== null;
8500
+ }
8467
8501
  async function setAgentModelTierOverrides(agentId, overrides) {
8468
- const next = Object.keys(overrides).length > 0 ? JSON.stringify(overrides) : null;
8502
+ const next = storedModelTierOverrides(overrides);
8469
8503
  await getDbClient2().run("UPDATE agents SET modelTierOverrides = ? WHERE id = ? AND modelTierOverrides IS NOT ?", [next, agentId, next]);
8470
8504
  }
8471
8505
  function mergeFacts2(base, overlay) {
@@ -10997,7 +11031,7 @@ async function moveSessionChains(input) {
10997
11031
  async function moveKeyFavorites(input) {
10998
11032
  const { lo, hi } = keyPrefixRange(input.from);
10999
11033
  const scoped = input.scope !== undefined;
11000
- const range = `itemType = 'key' AND itemId >= ? AND itemId < ?${scoped ? " AND favoriteScope = ?" : ""}`;
11034
+ const range = `itemType IN ('key','hidden-key') AND itemId >= ? AND itemId < ?${scoped ? " AND favoriteScope = ?" : ""}`;
11001
11035
  const rangeParams = [lo, hi, ...scoped ? [input.scope] : []];
11002
11036
  await getDbClient2().transaction(async () => {
11003
11037
  await getDbClient2().run(`UPDATE OR IGNORE user_favorites SET itemId = ? || substr(itemId, ?) WHERE ${range}`, [input.to, lo.length + 1, ...rangeParams]);
@@ -11170,6 +11204,15 @@ function sessionRootFilter(opts = {}) {
11170
11204
  });
11171
11205
  if (opts.rootId)
11172
11206
  add({ sql: "r.id = ?", params: [opts.rootId] });
11207
+ if (opts.rootIds) {
11208
+ add(opts.rootIds.length ? { sql: `r.id IN (${opts.rootIds.map(() => "?").join(",")})`, params: opts.rootIds } : { sql: "0", params: [] });
11209
+ }
11210
+ if (opts.exceptRootIds?.length) {
11211
+ add({
11212
+ sql: `r.id NOT IN (${opts.exceptRootIds.map(() => "?").join(",")})`,
11213
+ params: opts.exceptRootIds
11214
+ });
11215
+ }
11173
11216
  const sources = opts.source?.filter(Boolean) ?? [];
11174
11217
  if (sources.length)
11175
11218
  add({ sql: `r.source IN (${sources.map(() => "?").join(",")})`, params: sources });
@@ -11226,8 +11269,9 @@ function sessionRootFilter(opts = {}) {
11226
11269
  add(groupCondition(normalizeAssetKey(opts.groupKey)));
11227
11270
  if (opts.noGroup)
11228
11271
  add(noGroupCondition(opts.viewer?.userId));
11229
- if (opts.triage === "inbox")
11272
+ if (opts.triage === "inbox" || opts.triage === "working") {
11230
11273
  add(inboxScopeCondition(opts.viewer?.userId));
11274
+ }
11231
11275
  if (opts.triage === "later" || opts.triage === "done") {
11232
11276
  const marked = {
11233
11277
  sql: `r.id IN (SELECT itemId FROM inbox_item_state
@@ -11240,6 +11284,8 @@ function sessionRootFilter(opts = {}) {
11240
11284
  return { sql: conditions.length ? conditions.join(" AND ") : "1", params };
11241
11285
  }
11242
11286
  function excludesTriaged(opts) {
11287
+ if (sourceOfKey(opts.groupKey ?? opts.keyPrefix ?? ""))
11288
+ return false;
11243
11289
  return !!(opts.viewer?.userId && (opts.groupKey || opts.keyPrefix || opts.keyPrefixes?.length || opts.noGroup));
11244
11290
  }
11245
11291
  function hasSessionChainFilter(opts) {
@@ -11253,9 +11299,13 @@ function summaryRowFilters(opts) {
11253
11299
  else if (opts.triage === "later" || opts.triage === "done") {
11254
11300
  filters.push("readState = ?");
11255
11301
  params.push(opts.triage);
11256
- } else if (opts.triage === "inbox" || excludesTriaged(opts)) {
11302
+ } else if (opts.triage === "inbox" || opts.triage === "working" || excludesTriaged(opts)) {
11257
11303
  filters.push("(readState IS NULL OR readState IN ('read','unread'))");
11258
11304
  }
11305
+ if (opts.triage === "inbox")
11306
+ filters.push(`NOT (${workingSql})`);
11307
+ if (opts.triage === "working")
11308
+ filters.push(workingSql);
11259
11309
  if (opts.status === "running")
11260
11310
  filters.push(runningSql);
11261
11311
  if (opts.status === "failed")
@@ -11393,6 +11443,7 @@ async function getSessionTree(actor, now, opts = {}) {
11393
11443
  const result = {
11394
11444
  groups: [],
11395
11445
  inbox: counts(),
11446
+ working: counts(),
11396
11447
  later: counts(),
11397
11448
  done: counts(),
11398
11449
  noGroup: counts(),
@@ -11458,11 +11509,14 @@ async function getSessionTree(actor, now, opts = {}) {
11458
11509
  if (row.readState === "later" || row.readState === "done") {
11459
11510
  if (sectionVisible)
11460
11511
  add(result[row.readState], row);
11512
+ if (group && sourceOfKey(key))
11513
+ add(group, row);
11461
11514
  } else {
11462
11515
  const viewer = actor.kind === "user" ? actor.userId : null;
11463
11516
  const inInbox = noGroup || sourceOfKey(key) || inResourceScope(row.key, viewer);
11517
+ const working = !isTerminalTaskStatus(row.latestStatus) && !row.needsYou;
11464
11518
  if (sectionVisible && inInbox)
11465
- add(result.inbox, row);
11519
+ add(working ? result.working : result.inbox, row);
11466
11520
  if (noGroup)
11467
11521
  add(result.noGroup, row);
11468
11522
  else if (group)
@@ -11517,7 +11571,7 @@ async function triageSessionList(userId, filters, action, readAll) {
11517
11571
  ]);
11518
11572
  return result.changes;
11519
11573
  }
11520
- var AUTO_DONE_QUIET_MS, LEGACY_READ_STATE_COLUMNS, SESSION_ROOTS = "(SELECT rootId AS id, * FROM session_summaries)", terminalSql, runningSql, openTaskSql, AGENT_TASK_SOURCES, reopensDoneSql, THREAD_OPEN = "<thread_context>", THREAD_CLOSE = "</thread_context>", THREAD_OPEN_AT, THREAD_CLOSE_AT, THREAD_LABEL_LENGTH = 300, THREAD_LABEL_TRIM_MARGIN = 100, THREAD_PROMPT_SQL, UNREAD_CURSOR = "1970-01-01T00:00:00.000Z";
11574
+ var AUTO_DONE_QUIET_MS, LEGACY_READ_STATE_COLUMNS, SESSION_ROOTS = "(SELECT rootId AS id, * FROM session_summaries)", terminalSql, runningSql, workingSql, openTaskSql, AGENT_TASK_SOURCES, reopensDoneSql, THREAD_OPEN = "<thread_context>", THREAD_CLOSE = "</thread_context>", THREAD_OPEN_AT, THREAD_CLOSE_AT, THREAD_LABEL_LENGTH = 300, THREAD_LABEL_TRIM_MARGIN = 100, THREAD_PROMPT_SQL, UNREAD_CURSOR = "1970-01-01T00:00:00.000Z";
11521
11575
  var init_session_tree = __esm(() => {
11522
11576
  init_key();
11523
11577
  init_source_key();
@@ -11533,6 +11587,7 @@ var init_session_tree = __esm(() => {
11533
11587
  };
11534
11588
  terminalSql = TERMINAL_TASK_STATUSES.map((s) => `'${s}'`).join(",");
11535
11589
  runningSql = `latestStatus NOT IN (${terminalSql})`;
11590
+ workingSql = `(${runningSql} AND needsYou = 0)`;
11536
11591
  openTaskSql = `chain.status NOT IN (${terminalSql})`;
11537
11592
  AGENT_TASK_SOURCES = ["mcp", "system", "schedule", "workflow"];
11538
11593
  reopensDoneSql = `(d.id IS NOT NULL AND (
@@ -12135,12 +12190,16 @@ async function createTask2(agentId, task, options) {
12135
12190
  } catch {}
12136
12191
  return rowToAgentTask(row);
12137
12192
  }
12138
- async function logAffinityDispatchSkip(agent, task) {
12193
+ async function logAffinityDispatchSkip(agent, task, probe) {
12139
12194
  const now = Date.now();
12140
12195
  const lastLoggedAt = lastAffinityDispatchSkipLoggedAt.get(task.id);
12141
12196
  if (lastLoggedAt !== undefined && now - lastLoggedAt < AFFINITY_DISPATCH_SKIP_LOG_COOLDOWN_MS) {
12142
12197
  return;
12143
12198
  }
12199
+ if (probe) {
12200
+ probe.skipLogDue = true;
12201
+ return;
12202
+ }
12144
12203
  lastAffinityDispatchSkipLoggedAt.set(task.id, now);
12145
12204
  try {
12146
12205
  await dependencies3.createLogEntry({
@@ -12157,7 +12216,7 @@ async function logAffinityDispatchSkip(agent, task) {
12157
12216
  });
12158
12217
  } catch {}
12159
12218
  }
12160
- async function getPendingTaskForAgent2(agentId) {
12219
+ async function getPendingTaskForAgent2(agentId, probe) {
12161
12220
  const rows = await getDbClient2().query("SELECT * FROM agent_tasks WHERE agentId = ? AND status = 'pending' ORDER BY priority DESC, createdAt ASC", [agentId]);
12162
12221
  const agent = await getAgentById2(agentId);
12163
12222
  if (!agent)
@@ -12165,11 +12224,11 @@ async function getPendingTaskForAgent2(agentId) {
12165
12224
  for (const row of rows) {
12166
12225
  const task = rowToAgentTask(row);
12167
12226
  if (task.routingAffinityInvalid) {
12168
- await logAffinityDispatchSkip(agent, task);
12227
+ await logAffinityDispatchSkip(agent, task, probe);
12169
12228
  continue;
12170
12229
  }
12171
12230
  if (task.routingAffinity?.leadOnly && !isAgentEligibleForTask2(agent, task)) {
12172
- await logAffinityDispatchSkip(agent, task);
12231
+ await logAffinityDispatchSkip(agent, task, probe);
12173
12232
  continue;
12174
12233
  }
12175
12234
  const { ready } = await dependencies3.checkDependencies(task.id);
@@ -12382,9 +12441,10 @@ async function completeTask2(id, output, options) {
12382
12441
  });
12383
12442
  } catch {}
12384
12443
  getDbClient2().afterCommit(() => {
12385
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12444
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
12386
12445
  workflowEventBus.emit("task.completed", {
12387
12446
  taskId: id,
12447
+ previousStatus: oldTask.status,
12388
12448
  output: scrubbedOutput,
12389
12449
  agentId: row.agentId,
12390
12450
  workflowRunId: row.workflowRunId,
@@ -12437,9 +12497,10 @@ async function failTask2(id, reason, opts = {}) {
12437
12497
  });
12438
12498
  } catch {}
12439
12499
  getDbClient2().afterCommit(() => {
12440
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12500
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
12441
12501
  workflowEventBus.emit("task.failed", {
12442
12502
  taskId: id,
12503
+ previousStatus: oldTask.status,
12443
12504
  failureReason: scrubbedReason,
12444
12505
  agentId: row.agentId,
12445
12506
  workflowRunId: row.workflowRunId,
@@ -12519,9 +12580,10 @@ async function cancelTask2(id, reason, options = {}) {
12519
12580
  });
12520
12581
  } catch {}
12521
12582
  getDbClient2().afterCommit(() => {
12522
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12583
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
12523
12584
  workflowEventBus.emit("task.cancelled", {
12524
12585
  taskId: id,
12586
+ previousStatus: oldTask.status,
12525
12587
  agentId: row.agentId,
12526
12588
  workflowRunId: row.workflowRunId,
12527
12589
  workflowRunStepId: row.workflowRunStepId
@@ -12531,7 +12593,7 @@ async function cancelTask2(id, reason, options = {}) {
12531
12593
  if (row.source === "schedule" && row.taskType === "deferred" && row.parentTaskId) {
12532
12594
  getDbClient2().afterCommit(async () => {
12533
12595
  try {
12534
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-9z2xec5e.js");
12596
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-ezavwn5d.js");
12535
12597
  await createWorkerTaskFollowUp({
12536
12598
  task: rowToAgentTask(row),
12537
12599
  status: "failed",
@@ -12580,7 +12642,7 @@ async function skipTask2(id, reason) {
12580
12642
  });
12581
12643
  } catch {}
12582
12644
  getDbClient2().afterCommit(() => {
12583
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12645
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
12584
12646
  workflowEventBus.emit("task.skipped", {
12585
12647
  taskId: id,
12586
12648
  failureReason: skipReason,
@@ -12632,7 +12694,7 @@ async function supersedeTask2(id, args) {
12632
12694
  });
12633
12695
  } catch {}
12634
12696
  getDbClient2().afterCommit(() => {
12635
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12697
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
12636
12698
  workflowEventBus.emit("task.superseded", {
12637
12699
  taskId: id,
12638
12700
  reason: args.reason,
@@ -12867,7 +12929,7 @@ async function updateTaskProgress2(id, progress) {
12867
12929
  });
12868
12930
  } catch {}
12869
12931
  getDbClient2().afterCommit(() => {
12870
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
12932
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
12871
12933
  workflowEventBus.emit("task.progress", {
12872
12934
  taskId: id,
12873
12935
  progress: scrubbedProgress,
@@ -13436,7 +13498,7 @@ function emitRunFinished(runId, workflowId, status) {
13436
13498
  }
13437
13499
  function emitBusEventAfterCommit(event, payload) {
13438
13500
  getDbClient2().afterCommit(() => {
13439
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
13501
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
13440
13502
  workflowEventBus.emit(event, payload);
13441
13503
  }).catch((err) => console.error(`[db] ${event} event not emitted:`, scrubSecrets(err instanceof Error ? err.message : String(err))));
13442
13504
  });
@@ -14377,6 +14439,7 @@ var init_swarm_config_guard = __esm(() => {
14377
14439
  ...enumValidator("SLACK_MODE", ["socket", "http"]),
14378
14440
  ...enumValidator("SLACK_THREAD_STEERING", ["off", "lead", "all"]),
14379
14441
  ...enumValidator("SLACK_THREAD_STEERING_MODE", ["steer", "queue"]),
14442
+ ...enumValidator("SLACK_SESSION_MIRROR", ["off", "reply", "both"]),
14380
14443
  ...shortcodeValidators([
14381
14444
  "SLACK_REACTION_ACCEPTED",
14382
14445
  "SLACK_REACTION_BUFFERED",
@@ -14416,6 +14479,9 @@ var init_swarm_config_guard = __esm(() => {
14416
14479
  ], 1),
14417
14480
  ...boundedIntegerValidatorsFor(DB_RETENTION_TUNING_BOUNDS),
14418
14481
  ...boundedIntegerValidators(["APPS_JSON_COLUMN_MAX_BYTES"], APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.min, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS.max),
14482
+ ...enumValidator("WORKTREE_REAPER_MODE", ["off", "dry-run", "on"]),
14483
+ ...boundedIntegerValidators(["WORKTREE_TTL_HOURS"], 1, 2160),
14484
+ ...boundedIntegerValidators(["WORKTREE_SWEEP_INTERVAL_MINUTES"], 5, 1440),
14419
14485
  ...boundedIntegerValidators(["CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS"], CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS.min, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS.max),
14420
14486
  ...boundedIntegerValidators([
14421
14487
  "SESSION_LOG_RETENTION_DAYS",
@@ -23069,7 +23135,7 @@ function noteEmbeddingSuccess() {
23069
23135
  const report = (what) => (err) => {
23070
23136
  console.error(`[memory] ${what} backfill after embeddings recovered failed:`, err.message);
23071
23137
  };
23072
- backfill2 = import("./embedding-space-kcdn52vz.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
23138
+ backfill2 = import("./embedding-space-v06fwy7b.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
23073
23139
  backfill2 = null;
23074
23140
  });
23075
23141
  }
@@ -23550,6 +23616,163 @@ var init_search_candidates = __esm(() => {
23550
23616
  init_review_recall_filter();
23551
23617
  });
23552
23618
 
23619
+ // src/be/memory/search-reader.ts
23620
+ function workerSpecifier() {
23621
+ if (import.meta.url.includes("/$bunfs/"))
23622
+ return "./be/memory/search-read-worker.ts";
23623
+ return new URL("./search-read-worker.ts", import.meta.url).href;
23624
+ }
23625
+ function spawnWorker(file, vecExtensionPath) {
23626
+ return new Promise((resolve, reject) => {
23627
+ const worker = new Worker(workerSpecifier());
23628
+ worker.unref?.();
23629
+ const fail = (message) => {
23630
+ clearTimeout(timer);
23631
+ worker.terminate();
23632
+ reject(new Error(message));
23633
+ };
23634
+ const timer = setTimeout(() => fail("timed out starting"), START_TIMEOUT_MS);
23635
+ worker.addEventListener("message", function onReady(event) {
23636
+ worker.removeEventListener("message", onReady);
23637
+ if (event.data.type === "ready") {
23638
+ clearTimeout(timer);
23639
+ resolve(worker);
23640
+ } else
23641
+ fail(event.data.type === "fatal" ? event.data.message : "unexpected first message");
23642
+ });
23643
+ worker.addEventListener("error", (event) => fail(event.message), { once: true });
23644
+ worker.postMessage({ type: "init", file, vecExtensionPath });
23645
+ });
23646
+ }
23647
+
23648
+ class SearchReadPool {
23649
+ idle;
23650
+ queue = [];
23651
+ slots;
23652
+ nextId = 1;
23653
+ broken = false;
23654
+ constructor(workers) {
23655
+ this.slots = workers.map((worker) => ({ worker, job: null }));
23656
+ this.idle = [...this.slots];
23657
+ for (const slot of this.slots) {
23658
+ slot.worker.addEventListener("message", (event) => this.settle(slot, event.data));
23659
+ slot.worker.addEventListener("error", (event) => this.stop(`worker error: ${event.message}`));
23660
+ slot.worker.addEventListener("close", () => this.stop("worker exited"));
23661
+ }
23662
+ }
23663
+ get stats() {
23664
+ return {
23665
+ workers: this.slots.length,
23666
+ busy: this.slots.filter((slot) => slot.job).length,
23667
+ queued: this.queue.length
23668
+ };
23669
+ }
23670
+ read(mode, sql, params) {
23671
+ if (this.broken)
23672
+ return Promise.reject(new WorkerGoneError("pool stopped"));
23673
+ return new Promise((resolve, reject) => {
23674
+ this.queue.push({ id: this.nextId++, mode, sql, params, resolve, reject });
23675
+ this.pump();
23676
+ });
23677
+ }
23678
+ pump() {
23679
+ while (this.idle.length > 0 && this.queue.length > 0) {
23680
+ const slot = this.idle.pop();
23681
+ const job = this.queue.shift();
23682
+ slot.job = job;
23683
+ slot.worker.ref?.();
23684
+ const request = {
23685
+ type: "read",
23686
+ id: job.id,
23687
+ mode: job.mode,
23688
+ sql: job.sql,
23689
+ params: job.params
23690
+ };
23691
+ slot.worker.postMessage(request);
23692
+ }
23693
+ }
23694
+ settle(slot, message) {
23695
+ const job = slot.job;
23696
+ if (!job || message.type !== "result" && message.type !== "error" || message.id !== job.id) {
23697
+ return;
23698
+ }
23699
+ slot.job = null;
23700
+ slot.worker.unref?.();
23701
+ this.idle.push(slot);
23702
+ if (message.type === "result")
23703
+ job.resolve(message.rows);
23704
+ else
23705
+ job.reject(new Error(message.message));
23706
+ this.pump();
23707
+ }
23708
+ stop(reason, log = true) {
23709
+ if (this.broken)
23710
+ return;
23711
+ this.broken = true;
23712
+ if (log)
23713
+ console.warn(`[memory-search] read workers stopped (${reason}); reads run in-process`);
23714
+ const pending = [...this.slots.flatMap((slot) => slot.job ? [slot.job] : []), ...this.queue];
23715
+ this.queue.length = 0;
23716
+ for (const slot of this.slots) {
23717
+ slot.job = null;
23718
+ slot.worker.terminate();
23719
+ }
23720
+ for (const job of pending)
23721
+ job.reject(new WorkerGoneError(reason));
23722
+ }
23723
+ }
23724
+ function poolForCurrentDb() {
23725
+ const db = getDb2();
23726
+ if (current?.db === db)
23727
+ return current.pool;
23728
+ current?.pool.then((pool) => pool?.stop("database handle changed", false));
23729
+ const file = db.filename;
23730
+ const pool = !file || file === ":memory:" ? Promise.resolve(null) : startPool(file, isSqliteVecAvailable2() ? resolveSqliteVecExtensionPath2() : undefined);
23731
+ current = { db, pool };
23732
+ return pool;
23733
+ }
23734
+ async function startPool(file, vecExtensionPath) {
23735
+ const started = await Promise.allSettled(Array.from({ length: SEARCH_READ_WORKERS }, () => spawnWorker(file, vecExtensionPath)));
23736
+ const failed = started.find((result) => result.status === "rejected");
23737
+ if (failed) {
23738
+ for (const result of started)
23739
+ if (result.status === "fulfilled")
23740
+ result.value.terminate();
23741
+ console.warn(`[memory-search] read workers failed to start (${failed.reason.message}); reads run in-process`);
23742
+ return null;
23743
+ }
23744
+ console.log(`[memory-search] read workers started workers=${SEARCH_READ_WORKERS}`);
23745
+ return new SearchReadPool(started.map((result) => result.value));
23746
+ }
23747
+ function readInProcess(mode, sql, params) {
23748
+ return mode === "all" ? getDbClient2().query(sql, params) : getDbClient2().get(sql, params);
23749
+ }
23750
+ async function read(mode, sql, params) {
23751
+ if (inProcessOnly || isInTransaction())
23752
+ return readInProcess(mode, sql, params);
23753
+ const pool = await poolForCurrentDb();
23754
+ if (!pool || pool.broken)
23755
+ return readInProcess(mode, sql, params);
23756
+ try {
23757
+ return await pool.read(mode, sql, params);
23758
+ } catch (err) {
23759
+ if (err instanceof WorkerGoneError)
23760
+ return readInProcess(mode, sql, params);
23761
+ throw err;
23762
+ }
23763
+ }
23764
+ var SEARCH_READ_WORKERS = 2, START_TIMEOUT_MS = 1e4, WorkerGoneError, current = null, inProcessOnly = false, memorySearchReader;
23765
+ var init_search_reader = __esm(() => {
23766
+ init_db4();
23767
+ init_db_client();
23768
+ WorkerGoneError = class WorkerGoneError extends Error {
23769
+ };
23770
+ memorySearchReader = {
23771
+ query: (sql, params = []) => read("all", sql, params),
23772
+ get: (sql, params = []) => read("get", sql, params)
23773
+ };
23774
+ });
23775
+
23553
23776
  // src/be/memory/providers/sqlite-store.ts
23554
23777
  var exports_sqlite_store = {};
23555
23778
  __export(exports_sqlite_store, {
@@ -23641,6 +23864,8 @@ class SqliteMemoryStore {
23641
23864
  ftsPopulate = null;
23642
23865
  lastPopulate = null;
23643
23866
  searchHealthCache = null;
23867
+ searchHealthRefresh = null;
23868
+ searchHealthGeneration = 0;
23644
23869
  constructor() {
23645
23870
  this.ensureVecTable();
23646
23871
  this.ensureFtsTable();
@@ -23827,7 +24052,7 @@ class SqliteMemoryStore {
23827
24052
  }
23828
24053
  }
23829
24054
  const afterCount = this.getVecCount();
23830
- this.searchHealthCache = null;
24055
+ this.dropSearchHealth();
23831
24056
  this.lastPopulate = {
23832
24057
  attempted,
23833
24058
  inserted,
@@ -23975,7 +24200,7 @@ class SqliteMemoryStore {
23975
24200
  minSimilarity: options.minSimilarity
23976
24201
  });
23977
24202
  }
23978
- const health = this.searchHealth();
24203
+ const health = await this.searchHealth();
23979
24204
  if (isHybridSearchEnabled() && options.queryText && this.ftsInitialized && await this.getFtsTableSchema() && health.retrievalMode === "vec" && embedding.length === EMBEDDING_DIMENSIONS) {
23980
24205
  console.log(`[memory-search] retrieval_path=hybrid scope=${scope} limit=${limit} vec_rows=${health.counts.memoryVec} searchable=${health.counts.searchable}`);
23981
24206
  return this.searchHybrid(embedding, options.queryText, agentId, {
@@ -24067,7 +24292,7 @@ class SqliteMemoryStore {
24067
24292
  const missing = ids.filter((id) => !cosines.has(id));
24068
24293
  if (missing.length === 0)
24069
24294
  return;
24070
- const rows = await getDbClient2().query(`SELECT id, embedding FROM agent_memory WHERE id IN (${missing.map(() => "?").join(",")})`, missing);
24295
+ const rows = await memorySearchReader.query(`SELECT id, embedding FROM agent_memory WHERE id IN (${missing.map(() => "?").join(",")})`, missing);
24071
24296
  for (const row of rows) {
24072
24297
  if (!row.embedding)
24073
24298
  continue;
@@ -24096,7 +24321,7 @@ class SqliteMemoryStore {
24096
24321
  }
24097
24322
  try {
24098
24323
  const sqlLimit = armFetchLimit(limit);
24099
- const rows = await getDbClient2().query(`SELECT m.*, bm25(memory_fts) AS rank
24324
+ const rows = await memorySearchReader.query(`SELECT m.*, bm25(memory_fts) AS rank
24100
24325
  FROM memory_fts
24101
24326
  JOIN agent_memory m ON m.id = memory_fts.memory_id
24102
24327
  WHERE ${conditions.join(" AND ")}
@@ -24142,7 +24367,7 @@ class SqliteMemoryStore {
24142
24367
  }
24143
24368
  conditions.push("v.k = ?");
24144
24369
  params.push(knnLimit);
24145
- const rows = await getDbClient2().query(`SELECT m.*, v.distance
24370
+ const rows = await memorySearchReader.query(`SELECT m.*, v.distance
24146
24371
  FROM memory_vec v
24147
24372
  JOIN agent_memory m ON m.id = v.memory_id
24148
24373
  WHERE ${conditions.join(" AND ")}
@@ -24181,7 +24406,7 @@ class SqliteMemoryStore {
24181
24406
  console.log(`[memory-search] retrieval_path=exhaustive scope=${scope} limit=${limit} scanned=${scanned} hits=${top.length}${scanned >= EXHAUSTIVE_SEARCH_MAX_ROWS ? " capped=true" : ""}`);
24182
24407
  if (top.length === 0)
24183
24408
  return [];
24184
- const rows = await getDbClient2().query(`SELECT * FROM agent_memory WHERE id IN (${top.map(() => "?").join(", ")})`, top.map((hit) => hit.id));
24409
+ const rows = await memorySearchReader.query(`SELECT * FROM agent_memory WHERE id IN (${top.map(() => "?").join(", ")})`, top.map((hit) => hit.id));
24185
24410
  const byId = new Map(rows.map((row) => [row.id, row]));
24186
24411
  const candidates = [];
24187
24412
  for (const hit of top) {
@@ -24192,7 +24417,7 @@ class SqliteMemoryStore {
24192
24417
  return candidates;
24193
24418
  }
24194
24419
  async scoreCappedInSql(queryEmbedding, capped, cappedParams, floor, limit) {
24195
- const db = getDbClient2();
24420
+ const db = memorySearchReader;
24196
24421
  const counted = await db.get(`SELECT COUNT(*) AS n FROM (SELECT 1 ${capped})`, cappedParams);
24197
24422
  const queryBuffer = serializeEmbedding(queryEmbedding);
24198
24423
  const top = await db.query(`SELECT id, similarity FROM (
@@ -24207,7 +24432,7 @@ class SqliteMemoryStore {
24207
24432
  return { scanned: counted?.n ?? 0, top };
24208
24433
  }
24209
24434
  async scoreCappedInJs(queryEmbedding, capped, cappedParams, floor, limit) {
24210
- const rows = await getDbClient2().query(`SELECT id, embedding ${capped}`, cappedParams);
24435
+ const rows = await memorySearchReader.query(`SELECT id, embedding ${capped}`, cappedParams);
24211
24436
  const scored = [];
24212
24437
  for (const row of rows) {
24213
24438
  const emb = deserializeEmbedding(row.embedding);
@@ -24236,7 +24461,7 @@ class SqliteMemoryStore {
24236
24461
  conditions.push("(expiresAt IS NULL OR expiresAt > datetime('now'))");
24237
24462
  }
24238
24463
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
24239
- const rows = await getDbClient2().query(`SELECT * FROM agent_memory ${whereClause}`, params);
24464
+ const rows = await memorySearchReader.query(`SELECT * FROM agent_memory ${whereClause}`, params);
24240
24465
  const candidates = [];
24241
24466
  for (const row of rows) {
24242
24467
  if (!row.embedding)
@@ -24542,7 +24767,7 @@ class SqliteMemoryStore {
24542
24767
  this.noteVecWrite();
24543
24768
  } catch (err) {
24544
24769
  console.error(`[memory-vec] update failed memory_id=${id}: ${err.message}`);
24545
- this.searchHealthCache = null;
24770
+ this.invalidateSearchHealth();
24546
24771
  }
24547
24772
  }
24548
24773
  });
@@ -24610,6 +24835,36 @@ class SqliteMemoryStore {
24610
24835
  expired: expired?.count ?? 0
24611
24836
  };
24612
24837
  }
24838
+ async getHealthCountsOffLoop() {
24839
+ const tableUsable = this.getVecTableSchema() !== null && isSqliteVecAvailable2();
24840
+ const valid = `embedding IS NOT NULL AND length(embedding) = ${VECTOR_BYTES}`;
24841
+ const row = await memorySearchReader.get(`SELECT
24842
+ (SELECT COUNT(*) FROM agent_memory) AS total,
24843
+ (SELECT COUNT(*) FROM agent_memory WHERE embedding IS NOT NULL) AS withEmbedding,
24844
+ (SELECT COUNT(*) FROM agent_memory WHERE ${valid}) AS validEmbedding,
24845
+ (SELECT COUNT(*) FROM agent_memory
24846
+ WHERE embedding IS NOT NULL AND length(embedding) != ${VECTOR_BYTES}) AS invalidEmbedding,
24847
+ (SELECT COUNT(*) FROM agent_memory
24848
+ WHERE ${valid} AND (expiresAt IS NULL OR expiresAt > datetime('now'))) AS searchable,
24849
+ ${tableUsable ? "(SELECT COUNT(*) FROM memory_vec)" : "0"} AS memoryVec,
24850
+ ${tableUsable ? `(SELECT COUNT(*) FROM agent_memory WHERE ${valid})
24851
+ - (SELECT COUNT(*) FROM memory_vec v CROSS JOIN agent_memory m ON m.id = v.memory_id
24852
+ WHERE m.embedding IS NOT NULL AND length(m.embedding) = ${VECTOR_BYTES})` : `(SELECT COUNT(*) FROM agent_memory WHERE ${valid})`} AS missingFromVec,
24853
+ ${tableUsable ? `(SELECT COUNT(*) FROM memory_vec v LEFT JOIN agent_memory m ON m.id = v.memory_id
24854
+ WHERE m.id IS NULL)` : "0"} AS extraInVec`);
24855
+ if (!row)
24856
+ throw new Error("health counts returned no row");
24857
+ return {
24858
+ total: row.total,
24859
+ withEmbedding: row.withEmbedding,
24860
+ validEmbedding: row.validEmbedding,
24861
+ invalidEmbedding: row.invalidEmbedding,
24862
+ searchable: row.searchable,
24863
+ memoryVec: row.memoryVec,
24864
+ missingFromVec: row.missingFromVec,
24865
+ extraInVec: row.extraInVec
24866
+ };
24867
+ }
24613
24868
  getHealthCounts() {
24614
24869
  const db = getDb2();
24615
24870
  const tableExists = this.getVecTableSchema() !== null;
@@ -24637,23 +24892,76 @@ class SqliteMemoryStore {
24637
24892
  WHERE m.id IS NULL`) : 0
24638
24893
  };
24639
24894
  }
24640
- searchHealth() {
24895
+ async searchHealth() {
24641
24896
  const db = getDb2();
24642
24897
  const cached = this.searchHealthCache;
24643
- if (cached && cached.db === db && Date.now() - cached.at < SEARCH_HEALTH_TTL_MS) {
24644
- return cached.health;
24898
+ const inTransaction = isInTransaction();
24899
+ if (cached && cached.db === db) {
24900
+ if (Date.now() - cached.at < SEARCH_HEALTH_TTL_MS)
24901
+ return cached.health;
24902
+ if (cached.health.retrievalMode === "vec" && !inTransaction) {
24903
+ if (!this.searchHealthRefresh)
24904
+ this.startSearchHealthRefresh(db).promise.catch(() => {});
24905
+ return cached.health;
24906
+ }
24907
+ }
24908
+ if (inTransaction)
24909
+ return this.getHealth();
24910
+ return this.currentSearchHealth();
24911
+ }
24912
+ async currentSearchHealth() {
24913
+ for (let attempt = 0;attempt < SEARCH_HEALTH_MAX_REFRESHES; attempt++) {
24914
+ const db = getDb2();
24915
+ const generation = this.searchHealthGeneration;
24916
+ const inFlight = this.searchHealthRefresh;
24917
+ const refresh = inFlight && inFlight.db === db && inFlight.generation === generation ? inFlight : this.startSearchHealthRefresh(db);
24918
+ const health = await refresh.promise;
24919
+ if (getDb2() === db && this.searchHealthGeneration === generation)
24920
+ return health;
24645
24921
  }
24646
24922
  const health = this.getHealth();
24647
- this.searchHealthCache = { health, db, at: Date.now() };
24923
+ this.searchHealthCache = { health, db: getDb2(), at: Date.now() };
24648
24924
  return health;
24649
24925
  }
24926
+ startSearchHealthRefresh(db) {
24927
+ const generation = this.searchHealthGeneration;
24928
+ const promise = (async () => {
24929
+ let health;
24930
+ try {
24931
+ health = this.healthFromCounts(await this.getHealthCountsOffLoop());
24932
+ } catch (err) {
24933
+ console.warn("[memory-search] health counts failed:", err.message);
24934
+ health = this.getHealth();
24935
+ }
24936
+ if (getDb2() === db && generation === this.searchHealthGeneration)
24937
+ this.searchHealthCache = { health, db, at: Date.now() };
24938
+ return health;
24939
+ })().finally(() => {
24940
+ if (this.searchHealthRefresh === entry)
24941
+ this.searchHealthRefresh = null;
24942
+ });
24943
+ const entry = { db, generation, promise };
24944
+ this.searchHealthRefresh = entry;
24945
+ return entry;
24946
+ }
24650
24947
  noteVecWrite() {
24651
24948
  if (this.searchHealthCache?.health.retrievalMode !== "vec")
24652
- this.searchHealthCache = null;
24949
+ this.invalidateSearchHealth();
24950
+ }
24951
+ invalidateSearchHealth() {
24952
+ this.dropSearchHealth();
24953
+ if (isInTransaction())
24954
+ getDbClient2().afterCommit(() => this.dropSearchHealth());
24955
+ }
24956
+ dropSearchHealth() {
24957
+ this.searchHealthCache = null;
24958
+ this.searchHealthGeneration++;
24653
24959
  }
24654
24960
  getHealth() {
24961
+ return this.healthFromCounts(this.getHealthCounts());
24962
+ }
24963
+ healthFromCounts(counts) {
24655
24964
  const schema = this.getVecTableSchema();
24656
- const counts = this.getHealthCounts();
24657
24965
  const reasons = [];
24658
24966
  if (!isSqliteVecAvailable2())
24659
24967
  reasons.push("sqlite_vec_extension_unavailable");
@@ -24687,18 +24995,20 @@ var VECTOR_BYTES, FTS_SCAN_BATCH_SQL = `SELECT rowid AS rowid, memory_id AS memo
24687
24995
  memory_id IS NOT NULL
24688
24996
  AND NOT EXISTS (SELECT 1 FROM agent_memory m WHERE m.id = memory_fts.memory_id) AS orphan
24689
24997
  FROM memory_fts WHERE rowid > ? ORDER BY rowid LIMIT ?`, MEMORY_ID_BATCH_SQL = `SELECT rowid AS rowid, id FROM agent_memory
24690
- WHERE rowid > ? ORDER BY rowid LIMIT ?`, SEARCH_HEALTH_TTL_MS = 60000, FTS_SCAN_BATCH_SIZE = 1000, FTS_POPULATE_BATCH_SIZE = 500;
24998
+ WHERE rowid > ? ORDER BY rowid LIMIT ?`, SEARCH_HEALTH_TTL_MS = 60000, SEARCH_HEALTH_MAX_REFRESHES = 3, FTS_SCAN_BATCH_SIZE = 1000, FTS_POPULATE_BATCH_SIZE = 500;
24691
24999
  var init_sqlite_store = __esm(() => {
24692
25000
  init_db4();
24693
25001
  init_embedding();
24694
25002
  init_profile_sync();
24695
25003
  init_secret_scrubber();
25004
+ init_db_client();
24696
25005
  init_event_loop_lag();
24697
25006
  init_constants2();
24698
25007
  init_key_paths();
24699
25008
  init_reranker();
24700
25009
  init_review_recall_filter();
24701
25010
  init_search_candidates();
25011
+ init_search_reader();
24702
25012
  VECTOR_BYTES = EMBEDDING_DIMENSIONS * Float32Array.BYTES_PER_ELEMENT;
24703
25013
  });
24704
25014
 
@@ -24749,6 +25059,9 @@ function rowToScript(row) {
24749
25059
  fsMode: row.fsMode,
24750
25060
  executor: row.executor ?? null,
24751
25061
  createdByAgentId: row.createdByAgentId ?? null,
25062
+ updatedByAgentId: row.updatedByAgentId ?? null,
25063
+ createdBy: row.created_by ?? null,
25064
+ updatedBy: row.updated_by ?? null,
24752
25065
  createdAt: row.createdAt,
24753
25066
  updatedAt: row.updatedAt
24754
25067
  };
@@ -24904,7 +25217,10 @@ function rowToScript2(row) {
24904
25217
  isScratch: row.isScratch === 1,
24905
25218
  typeChecked: row.typeChecked === 1,
24906
25219
  executor: row.executor ?? null,
24907
- createdByAgentId: row.createdByAgentId ?? null
25220
+ createdByAgentId: row.createdByAgentId ?? null,
25221
+ updatedByAgentId: row.updatedByAgentId ?? null,
25222
+ createdBy: row.created_by ?? null,
25223
+ updatedBy: row.updated_by ?? null
24908
25224
  };
24909
25225
  }
24910
25226
  function rowToScriptVersion(row) {
@@ -24946,9 +25262,9 @@ async function insertScript(args) {
24946
25262
  const row = await tx.get(`INSERT INTO scripts (
24947
25263
  id, "key", name, scope, scopeId, source, description, intent, signatureJson,
24948
25264
  argsJsonSchema, contentHash, isScratch, typeChecked, fsMode, executor, createdByAgentId, createdAt, updatedAt,
24949
- created_by, updated_by
25265
+ created_by, updated_by, updatedByAgentId
24950
25266
  )
24951
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
25267
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
24952
25268
  RETURNING *`, [
24953
25269
  id,
24954
25270
  defaultAssetKey("script", id),
@@ -24969,7 +25285,8 @@ async function insertScript(args) {
24969
25285
  now,
24970
25286
  now,
24971
25287
  args.createdBy ?? null,
24972
- args.createdBy ?? null
25288
+ args.createdBy ?? null,
25289
+ args.agentId ?? null
24973
25290
  ]);
24974
25291
  if (!row)
24975
25292
  throw new Error("Failed to insert script");
@@ -25014,7 +25331,8 @@ async function upsertScriptByName(args) {
25014
25331
  if (fsMode !== existing.fsMode || executor !== existing.executor || isScratch !== existing.isScratch || typeChecked !== existing.typeChecked || trackedMetadataChanged || refreshScratchLastUsed) {
25015
25332
  const row = await getDbClient2().get(`UPDATE scripts
25016
25333
  SET description = ?, intent = ?, signatureJson = ?, argsJsonSchema = ?,
25017
- isScratch = ?, typeChecked = ?, fsMode = ?, executor = ?, updatedAt = ?, updated_by = ?
25334
+ isScratch = ?, typeChecked = ?, fsMode = ?, executor = ?, updatedAt = ?, updated_by = ?,
25335
+ updatedByAgentId = ?
25018
25336
  WHERE id = ?
25019
25337
  RETURNING *`, [
25020
25338
  args.description,
@@ -25027,6 +25345,7 @@ async function upsertScriptByName(args) {
25027
25345
  executor ?? null,
25028
25346
  new Date().toISOString(),
25029
25347
  args.createdBy ?? null,
25348
+ args.agentId ?? null,
25030
25349
  existing.id
25031
25350
  ]);
25032
25351
  if (!row)
@@ -25057,7 +25376,8 @@ async function upsertScriptByName(args) {
25057
25376
  const script = await getDbClient2().transaction(async (tx) => {
25058
25377
  const row = await tx.get(`UPDATE scripts
25059
25378
  SET source = ?, description = ?, intent = ?, signatureJson = ?, argsJsonSchema = ?,
25060
- contentHash = ?, version = ?, isScratch = ?, typeChecked = ?, fsMode = ?, executor = ?, updatedAt = ?, updated_by = ?
25379
+ contentHash = ?, version = ?, isScratch = ?, typeChecked = ?, fsMode = ?, executor = ?, updatedAt = ?, updated_by = ?,
25380
+ updatedByAgentId = ?
25061
25381
  WHERE id = ?
25062
25382
  RETURNING *`, [
25063
25383
  args.source,
@@ -25073,6 +25393,7 @@ async function upsertScriptByName(args) {
25073
25393
  executor ?? null,
25074
25394
  now,
25075
25395
  args.createdBy ?? null,
25396
+ args.agentId ?? null,
25076
25397
  existing.id
25077
25398
  ]);
25078
25399
  if (!row)
@@ -25383,7 +25704,7 @@ async function loadSecretRegistry() {
25383
25704
  result.failed += 1;
25384
25705
  }
25385
25706
  try {
25386
- const { loadRuntimeControllerSecrets } = await import("./db-g111qn9j.js");
25707
+ const { loadRuntimeControllerSecrets } = await import("./db-6bkgbfwk.js");
25387
25708
  const loaded = await loadRuntimeControllerSecrets();
25388
25709
  result.runtimeController = loaded.count;
25389
25710
  result.failed += loaded.failed;
@@ -25544,7 +25865,7 @@ async function requestSteering(args) {
25544
25865
  }
25545
25866
  const requestedMode = args.mode ?? "queue";
25546
25867
  const onUnsupported = args.onUnsupported ?? "degrade";
25547
- const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-4q8s0mx8.js");
25868
+ const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-jgjqrfzv.js");
25548
25869
  const preSteer = await dispatchPre("pre.task.steer", {
25549
25870
  task,
25550
25871
  message: args.message,
@@ -25758,6 +26079,18 @@ var init_script_runs = __esm(() => {
25758
26079
  init_runtime2();
25759
26080
  });
25760
26081
 
26082
+ // src/be/db/skill-audit.ts
26083
+ async function setSkillUpdatedBy2(skillId, actor) {
26084
+ await getDbClient2().run("UPDATE skills SET updated_by = ?, updatedByAgentId = ? WHERE id = ?", [
26085
+ actor.userId,
26086
+ actor.agentId,
26087
+ skillId
26088
+ ]);
26089
+ }
26090
+ var init_skill_audit = __esm(() => {
26091
+ init_runtime2();
26092
+ });
26093
+
25761
26094
  // src/be/db.ts
25762
26095
  var exports_db = {};
25763
26096
  __export(exports_db, {
@@ -26235,6 +26568,7 @@ __export(exports_db, {
26235
26568
  setBudgetRefusalFollowUpTaskId: () => setBudgetRefusalFollowUpTaskId2,
26236
26569
  setFavorite: () => setFavorite2,
26237
26570
  setScriptRunFollowUpGuard: () => setScriptRunFollowUpGuard2,
26571
+ setSkillUpdatedBy: () => setSkillUpdatedBy2,
26238
26572
  setSlackMessageTracking: () => setSlackMessageTracking2,
26239
26573
  setTaskTitleIfUnset: () => setTaskTitleIfUnset2,
26240
26574
  setUserFavorite: () => setUserFavorite2,
@@ -27062,10 +27396,10 @@ async function moveAssetKey2(input) {
27062
27396
  return { movedTaskIds };
27063
27397
  }
27064
27398
  case "workflow":
27065
- await tx.run('UPDATE workflows SET "key" = ?, lastUpdatedAt = ?, updated_by = ? WHERE id = ?', [key, now, input.changedBy ?? null, input.id]);
27399
+ await tx.run('UPDATE workflows SET "key" = ?, lastUpdatedAt = ?, updated_by = ?, updatedByAgentId = ? WHERE id = ?', [key, now, input.changedBy ?? null, input.changedByAgentId ?? null, input.id]);
27066
27400
  break;
27067
27401
  case "schedule":
27068
- await tx.run('UPDATE scheduled_tasks SET "key" = ?, lastUpdatedAt = ?, updated_by = ? WHERE id = ?', [key, now, input.changedBy ?? null, input.id]);
27402
+ await tx.run('UPDATE scheduled_tasks SET "key" = ?, lastUpdatedAt = ?, updated_by = ?, updatedByAgentId = ? WHERE id = ?', [key, now, input.changedBy ?? null, input.changedByAgentId ?? null, input.id]);
27069
27403
  break;
27070
27404
  case "page":
27071
27405
  await tx.run('UPDATE pages SET "key" = ?, updatedAt = ?, updated_by = ? WHERE id = ?', [
@@ -27083,12 +27417,7 @@ async function moveAssetKey2(input) {
27083
27417
  ]);
27084
27418
  break;
27085
27419
  case "script":
27086
- await tx.run('UPDATE scripts SET "key" = ?, updatedAt = ?, updated_by = ? WHERE id = ?', [
27087
- key,
27088
- now,
27089
- input.changedBy ?? null,
27090
- input.id
27091
- ]);
27420
+ await tx.run('UPDATE scripts SET "key" = ?, updatedAt = ?, updated_by = ?, updatedByAgentId = ? WHERE id = ?', [key, now, input.changedBy ?? null, input.changedByAgentId ?? null, input.id]);
27092
27421
  break;
27093
27422
  case "file":
27094
27423
  await tx.run('UPDATE asset_key_mappings SET "key" = ?, updated_at = ?, updated_by = ? WHERE id = ?', [key, now, input.changedBy ?? null, input.id]);
@@ -27781,7 +28110,7 @@ async function createTaskExtended2(task, options) {
27781
28110
  priority: row.priority
27782
28111
  }, (task) => task !== null, row.requestedByUserId);
27783
28112
  getDbClient2().afterCommit(() => {
27784
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => {
28113
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => {
27785
28114
  workflowEventBus.emit("task.created", {
27786
28115
  taskId: row.id,
27787
28116
  task: row.task,
@@ -27863,7 +28192,7 @@ async function releaseTask2(taskId, wakeSnapshot) {
27863
28192
  } catch {}
27864
28193
  if (isRuntimePoolsEnabled() && !wakeSnapshot)
27865
28194
  getDbClient2().afterCommit(() => {
27866
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
28195
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
27867
28196
  });
27868
28197
  }
27869
28198
  return row ? rowToAgentTask(row) : null;
@@ -27933,7 +28262,7 @@ async function rejectTask2(taskId, agentId, reason) {
27933
28262
  } catch {}
27934
28263
  if (isRuntimePoolsEnabled())
27935
28264
  getDbClient2().afterCommit(() => {
27936
- import("./event-bus-v4ywhc2p.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
28265
+ import("./event-bus-08t2b4y2.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
27937
28266
  });
27938
28267
  }
27939
28268
  return row ? rowToAgentTask(row) : null;
@@ -28550,7 +28879,7 @@ async function getInboxSummary2(agentId) {
28550
28879
  recentMentions
28551
28880
  };
28552
28881
  }
28553
- async function claimMentions2(agentId) {
28882
+ async function claimMentions2(agentId, opts) {
28554
28883
  const now = new Date().toISOString();
28555
28884
  const client = getDbClient2();
28556
28885
  const channels = await getAllChannels2();
@@ -28565,6 +28894,14 @@ async function claimMentions2(agentId) {
28565
28894
  const mentionCountRow = await client.get(`SELECT COUNT(*) as count FROM channel_messages m
28566
28895
  WHERE m.channelId = ? AND m.mentions LIKE ? ${baseCondition}`, [channel.id, `%"${agentId}"%`]);
28567
28896
  if (mentionCountRow && mentionCountRow.count > 0) {
28897
+ if (opts?.dryRun) {
28898
+ claimedChannels.push({
28899
+ channelId: channel.id,
28900
+ lastReadAt,
28901
+ mentionsCount: mentionCountRow.count
28902
+ });
28903
+ continue;
28904
+ }
28568
28905
  const result = await client.run(`INSERT INTO channel_read_state (agentId, channelId, lastReadAt, processing_since)
28569
28906
  VALUES (?, ?, ?, ?)
28570
28907
  ON CONFLICT(agentId, channelId) DO UPDATE SET
@@ -29298,6 +29635,7 @@ function rowToScheduledTask(row) {
29298
29635
  lastRunAt: normalizeDate(row.lastRunAt) ?? undefined,
29299
29636
  nextRunAt: normalizeDate(row.nextRunAt) ?? undefined,
29300
29637
  createdByAgentId: row.createdByAgentId ?? undefined,
29638
+ updatedByAgentId: row.updatedByAgentId ?? undefined,
29301
29639
  parentTaskId: row.parentTaskId ?? undefined,
29302
29640
  requestedDelayMs: row.requestedDelayMs ?? undefined,
29303
29641
  requestedRunAt: normalizeDate(row.requestedRunAt) ?? undefined,
@@ -29401,8 +29739,8 @@ async function createScheduledTask2(data) {
29401
29739
  timezone, model, modelTier, profile, scheduleType,
29402
29740
  targetType, workflowId, scriptName, scriptArgs, params, requiredParams, requires,
29403
29741
  createdAt, lastUpdatedAt,
29404
- created_by, updated_by
29405
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
29742
+ created_by, updated_by, updatedByAgentId
29743
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
29406
29744
  id,
29407
29745
  normalizeAssetKey(data.key ?? defaultAssetKey("schedule", id)),
29408
29746
  data.name,
@@ -29435,7 +29773,8 @@ async function createScheduledTask2(data) {
29435
29773
  now,
29436
29774
  now,
29437
29775
  data.createdBy ?? null,
29438
- data.createdBy ?? null
29776
+ data.createdBy ?? null,
29777
+ data.createdByAgentId ?? null
29439
29778
  ]);
29440
29779
  if (!row)
29441
29780
  throw new Error("Failed to create scheduled task");
@@ -29560,6 +29899,10 @@ async function updateScheduledTask2(id, data) {
29560
29899
  updates.push("updated_by = ?");
29561
29900
  params.push(data.updatedBy);
29562
29901
  }
29902
+ if (data.updatedByAgentId !== undefined) {
29903
+ updates.push("updatedByAgentId = ?");
29904
+ params.push(data.updatedByAgentId);
29905
+ }
29563
29906
  if (updates.length === 0) {
29564
29907
  return getScheduledTaskById2(id);
29565
29908
  }
@@ -29582,7 +29925,7 @@ async function deleteScheduledTask2(id) {
29582
29925
  const parent = await getTaskById2(deferred.parentTaskId);
29583
29926
  if (!parent?.deferredAt)
29584
29927
  return;
29585
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-9z2xec5e.js");
29928
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-ezavwn5d.js");
29586
29929
  await createWorkerTaskFollowUp({
29587
29930
  task: parent,
29588
29931
  status: "failed",
@@ -30189,6 +30532,7 @@ function rowToWorkflow(row) {
30189
30532
  dir: row.dir ?? undefined,
30190
30533
  vcsRepo: row.vcs_repo ?? undefined,
30191
30534
  createdByAgentId: row.createdByAgentId ?? undefined,
30535
+ updatedByAgentId: row.updatedByAgentId ?? undefined,
30192
30536
  createdAt: normalizeDateRequired(row.createdAt),
30193
30537
  lastUpdatedAt: normalizeDateRequired(row.lastUpdatedAt),
30194
30538
  createdBy: row.created_by ?? undefined,
@@ -30197,8 +30541,8 @@ function rowToWorkflow(row) {
30197
30541
  }
30198
30542
  async function createWorkflow2(data, source) {
30199
30543
  const id = crypto.randomUUID();
30200
- const row = await getDbClient2().get(`INSERT INTO workflows (id, "key", name, description, definition, triggers, cooldown, input, triggerSchema, params, requiredParams, requires, dir, vcs_repo, createdByAgentId, created_by, updated_by, enabled)
30201
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
30544
+ const row = await getDbClient2().get(`INSERT INTO workflows (id, "key", name, description, definition, triggers, cooldown, input, triggerSchema, params, requiredParams, requires, dir, vcs_repo, createdByAgentId, updatedByAgentId, created_by, updated_by, enabled)
30545
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
30202
30546
  id,
30203
30547
  normalizeAssetKey(data.key ?? defaultAssetKey("workflow", id)),
30204
30548
  data.name,
@@ -30214,6 +30558,7 @@ async function createWorkflow2(data, source) {
30214
30558
  data.dir ?? null,
30215
30559
  data.vcsRepo ?? null,
30216
30560
  data.createdByAgentId ?? null,
30561
+ data.createdByAgentId ?? null,
30217
30562
  data.createdBy ?? null,
30218
30563
  data.createdBy ?? null,
30219
30564
  data.enabled === false ? 0 : 1
@@ -30250,8 +30595,11 @@ function rowToWorkflowSummary(row) {
30250
30595
  dir: row.dir ?? undefined,
30251
30596
  vcsRepo: row.vcs_repo ?? undefined,
30252
30597
  createdByAgentId: row.createdByAgentId ?? undefined,
30598
+ updatedByAgentId: row.updatedByAgentId ?? undefined,
30253
30599
  createdAt: normalizeDateRequired(row.createdAt),
30254
30600
  lastUpdatedAt: normalizeDateRequired(row.lastUpdatedAt),
30601
+ createdBy: row.created_by ?? undefined,
30602
+ updatedBy: row.updated_by ?? undefined,
30255
30603
  nodeCount
30256
30604
  };
30257
30605
  }
@@ -30365,6 +30713,10 @@ async function updateWorkflow2(id, data) {
30365
30713
  updates.push("updated_by = ?");
30366
30714
  params.push(data.updatedBy);
30367
30715
  }
30716
+ if (data.updatedByAgentId !== undefined) {
30717
+ updates.push("updatedByAgentId = ?");
30718
+ params.push(data.updatedByAgentId);
30719
+ }
30368
30720
  if (updates.length === 0)
30369
30721
  return await getWorkflow2(id);
30370
30722
  updates.push("lastUpdatedAt = ?");
@@ -31705,6 +32057,10 @@ function rowToSkill(row) {
31705
32057
  systemDefault: row.systemDefault === 1,
31706
32058
  invocationCount: row.invocationCount,
31707
32059
  lastInvokedAt: row.lastInvokedAt,
32060
+ createdByAgentId: row.createdByAgentId ?? null,
32061
+ updatedByAgentId: row.updatedByAgentId ?? null,
32062
+ createdBy: row.created_by ?? null,
32063
+ updatedBy: row.updated_by ?? null,
31708
32064
  createdAt: row.createdAt,
31709
32065
  lastUpdatedAt: row.lastUpdatedAt,
31710
32066
  lastFetchedAt: row.lastFetchedAt
@@ -31801,8 +32157,9 @@ async function createSkill2(data) {
31801
32157
  id, name, description, content, type, scope, ownerAgentId,
31802
32158
  sourceUrl, sourceRepo, sourcePath, sourceBranch, sourceHash, isComplex,
31803
32159
  allowedTools, model, effort, context, agent, disableModelInvocation, userInvocable,
31804
- version, isEnabled, systemDefault, createdAt, lastUpdatedAt
31805
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?) RETURNING *`, [
32160
+ version, isEnabled, systemDefault, createdAt, lastUpdatedAt,
32161
+ createdByAgentId, updatedByAgentId, created_by, updated_by
32162
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
31806
32163
  id,
31807
32164
  data.name,
31808
32165
  data.description,
@@ -31826,7 +32183,11 @@ async function createSkill2(data) {
31826
32183
  data.isEnabled === false ? 0 : 1,
31827
32184
  data.systemDefault ? 1 : 0,
31828
32185
  now,
31829
- now
32186
+ now,
32187
+ data.createdByAgentId ?? null,
32188
+ data.createdByAgentId ?? null,
32189
+ data.createdBy ?? null,
32190
+ data.createdBy ?? null
31830
32191
  ]);
31831
32192
  if (!row)
31832
32193
  throw new Error("Failed to create skill");
@@ -31919,6 +32280,14 @@ async function updateSkill2(id, updates) {
31919
32280
  sets.push("lastFetchedAt = ?");
31920
32281
  params.push(updates.lastFetchedAt);
31921
32282
  }
32283
+ if (updates.updatedBy !== undefined) {
32284
+ sets.push("updated_by = ?");
32285
+ params.push(updates.updatedBy);
32286
+ }
32287
+ if (updates.updatedByAgentId !== undefined) {
32288
+ sets.push("updatedByAgentId = ?");
32289
+ params.push(updates.updatedByAgentId);
32290
+ }
31922
32291
  if (updates.content !== undefined) {
31923
32292
  sets.push("version = version + 1");
31924
32293
  }
@@ -32468,7 +32837,8 @@ function rowToApiKeyStatus(row) {
32468
32837
  return {
32469
32838
  ...row,
32470
32839
  rateLimitWindows: parseRateLimitWindowsJson(row.rateLimitWindows),
32471
- providerAccount: parseProviderAccount(row.providerAccount)
32840
+ providerAccount: parseProviderAccount(row.providerAccount),
32841
+ spendCap: row.spendCap ? JSON.parse(row.spendCap) : null
32472
32842
  };
32473
32843
  }
32474
32844
  async function getAvailableKeyIndices2(keyType, totalKeys, scope = "global", scopeId = null, modelFamily, keySuffixes) {
@@ -32480,10 +32850,10 @@ async function getAvailableKeyIndices2(keyType, totalKeys, scope = "global", sco
32480
32850
  const rowFilter = suffixes ? `keyType = ? AND keySuffix IN (${suffixes.map(() => "?").join(", ")})` : "keyType = ? AND scope = ? AND scopeId = ?";
32481
32851
  const rowParams = suffixes ? [keyType, ...suffixes] : [keyType, scope, effectiveScopeId];
32482
32852
  await client.run(`UPDATE api_key_status
32483
- SET status = 'available', rateLimitedUntil = NULL, updatedAt = ?
32853
+ SET status = 'available', rateLimitedUntil = NULL, spendCap = NULL, updatedAt = ?
32484
32854
  WHERE ${rowFilter}
32485
32855
  AND status = 'rate_limited' AND rateLimitedUntil <= ? AND consecutiveAuthFailures < ?`, [now, ...rowParams, now, CODEX_AUTH_FAILURE_BENCH_THRESHOLD]);
32486
- const rows = await client.query(`SELECT keyIndex, keySuffix, scope, scopeId, status, rateLimitWindows, plan, authFailureSeq, lastValidationFailedAt FROM api_key_status
32856
+ const rows = await client.query(`SELECT keyIndex, keySuffix, scope, scopeId, status, rateLimitWindows, plan, authFailureSeq, lastValidationFailedAt, spendCap FROM api_key_status
32487
32857
  WHERE ${rowFilter}`, rowParams);
32488
32858
  const positionsOf = (row) => {
32489
32859
  if (!suffixes)
@@ -32495,6 +32865,9 @@ async function getAvailableKeyIndices2(keyType, totalKeys, scope = "global", sco
32495
32865
  return sameScope && positions.includes(row.keyIndex) ? [row.keyIndex] : [];
32496
32866
  };
32497
32867
  const blockedIndices = new Set(rows.filter((r) => r.status === "rate_limited").flatMap(positionsOf));
32868
+ const spendCappedIndices = [
32869
+ ...new Set(rows.filter((r) => r.status === "rate_limited" && r.spendCap).flatMap(positionsOf))
32870
+ ];
32498
32871
  const rejectedIndices = [
32499
32872
  ...new Set(rows.filter((row) => row.lastValidationFailedAt !== null).flatMap(positionsOf))
32500
32873
  ];
@@ -32540,6 +32913,7 @@ async function getAvailableKeyIndices2(keyType, totalKeys, scope = "global", sco
32540
32913
  rejectedIndices,
32541
32914
  modelBlockedIndices,
32542
32915
  seatBlockedIndices,
32916
+ spendCappedIndices,
32543
32917
  earliestModelResetAt: earliestModelResetsAtSec !== undefined ? new Date(earliestModelResetsAtSec * 1000).toISOString() : null,
32544
32918
  authFailureFence: Math.max(0, ...rows.map((r) => r.authFailureSeq))
32545
32919
  };
@@ -32590,20 +32964,32 @@ async function setApiKeyPlan2(keyType, keySuffix, plan) {
32590
32964
  WHERE keyType = ? AND keySuffix = ?`, [now, keyType, keySuffix]);
32591
32965
  return result.changes > 0;
32592
32966
  }
32593
- async function markKeyRateLimited2(keyType, keySuffix, keyIndex, rateLimitedUntil, scope = "global", scopeId = null) {
32967
+ async function markKeyRateLimited2(keyType, keySuffix, keyIndex, rateLimitedUntil, scope = "global", scopeId = null, spendCap = null) {
32594
32968
  const now = new Date().toISOString();
32595
32969
  const effectiveScopeId = scopeId ?? "";
32596
32970
  const provider = deriveProviderFromKeyType(keyType);
32597
- await getDbClient2().run(`INSERT INTO api_key_status (keyType, keySuffix, keyIndex, scope, scopeId, status, rateLimitedUntil, lastRateLimitAt, rateLimitCount, provider, updatedAt)
32598
- VALUES (?, ?, ?, ?, ?, 'rate_limited', ?, ?, 1, ?, ?)
32971
+ await getDbClient2().run(`INSERT INTO api_key_status (keyType, keySuffix, keyIndex, scope, scopeId, status, rateLimitedUntil, lastRateLimitAt, rateLimitCount, provider, updatedAt, spendCap)
32972
+ VALUES (?, ?, ?, ?, ?, 'rate_limited', ?, ?, 1, ?, ?, ?)
32599
32973
  ON CONFLICT(keyType, keySuffix, scope, scopeId)
32600
32974
  DO UPDATE SET
32601
32975
  status = 'rate_limited',
32602
32976
  rateLimitedUntil = CASE WHEN status = 'rate_limited' AND consecutiveAuthFailures >= ${CODEX_AUTH_FAILURE_BENCH_THRESHOLD} THEN MAX(COALESCE(rateLimitedUntil, ''), excluded.rateLimitedUntil) ELSE excluded.rateLimitedUntil END,
32977
+ spendCap = excluded.spendCap,
32603
32978
  lastRateLimitAt = excluded.lastRateLimitAt,
32604
32979
  rateLimitCount = rateLimitCount + 1,
32605
32980
  keyIndex = excluded.keyIndex,
32606
- updatedAt = excluded.updatedAt`, [keyType, keySuffix, keyIndex, scope, effectiveScopeId, rateLimitedUntil, now, provider, now]);
32981
+ updatedAt = excluded.updatedAt`, [
32982
+ keyType,
32983
+ keySuffix,
32984
+ keyIndex,
32985
+ scope,
32986
+ effectiveScopeId,
32987
+ rateLimitedUntil,
32988
+ now,
32989
+ provider,
32990
+ now,
32991
+ spendCap ? JSON.stringify(spendCap) : null
32992
+ ]);
32607
32993
  }
32608
32994
  async function recordKeyAuthFailure2(keyType, keySuffix, keyIndex, scope = "global", scopeId = null) {
32609
32995
  const effectiveScopeId = scopeId ?? "";
@@ -32691,7 +33077,7 @@ async function clearKeyRateLimit2(keyType, keySuffix, scope = "global", scopeId
32691
33077
  const clearAuthBench = opts.clearAuthBench === true && authFence !== null;
32692
33078
  return await getDbClient2().transaction(async (tx) => {
32693
33079
  const result = await tx.run(`UPDATE api_key_status
32694
- SET status = 'available', rateLimitedUntil = NULL, updatedAt = ?
33080
+ SET status = 'available', rateLimitedUntil = NULL, spendCap = NULL, updatedAt = ?
32695
33081
  WHERE keyType = ? AND keySuffix = ?
32696
33082
  AND status = 'rate_limited' AND ((? AND authFailureSeq <= ?) OR consecutiveAuthFailures < ?)`, [
32697
33083
  now,
@@ -32705,7 +33091,8 @@ async function clearKeyRateLimit2(keyType, keySuffix, scope = "global", scopeId
32705
33091
  if (!clearAuthBench)
32706
33092
  return cleared;
32707
33093
  const lifted = await tx.query(`UPDATE api_key_status SET consecutiveAuthFailures = 0, updatedAt = ?1,
32708
- status = CASE WHEN keySuffix = ?2 THEN status ELSE 'available' END, rateLimitedUntil = CASE WHEN keySuffix = ?2 THEN rateLimitedUntil END
33094
+ status = CASE WHEN keySuffix = ?2 THEN status ELSE 'available' END, rateLimitedUntil = CASE WHEN keySuffix = ?2 THEN rateLimitedUntil END,
33095
+ spendCap = CASE WHEN keySuffix = ?2 THEN spendCap END
32709
33096
  WHERE keyType = ?3 AND (consecutiveAuthFailures > 0 OR status = 'rate_limited')
32710
33097
  AND ((keySuffix = ?2 AND authFailureSeq <= ?7)
32711
33098
  OR (keySuffix != ?2 AND keyIndex = ?6 AND scope = ?4 AND scopeId = ?5)) RETURNING keySuffix`, [now, keySuffix, keyType, scope, effectiveScopeId, keyIndex, authFence]);
@@ -33558,7 +33945,8 @@ function kvJsonFieldConditions(filters) {
33558
33945
  }
33559
33946
  async function listKv2(namespace, opts) {
33560
33947
  const now = Date.now();
33561
- const prefix = kvPrefixCondition(opts.prefix);
33948
+ const upper = opts.prefix === undefined ? null : kvPrefixUpperBound2(opts.prefix);
33949
+ const prefix = opts.keyAfter === undefined ? kvPrefixCondition(opts.prefix) : opts.keyThrough !== undefined ? { sql: "AND key > ? AND key <= ?", params: [opts.keyAfter, opts.keyThrough] } : upper === null ? { sql: "AND key > ?", params: [opts.keyAfter] } : { sql: "AND key > ? AND key < ?", params: [opts.keyAfter, upper] };
33562
33950
  const json = kvJsonFieldConditions(opts.jsonFieldEquals);
33563
33951
  const rows = await getDbClient2().query(`SELECT namespace, key, value, value_type, expires_at, created_at, updated_at
33564
33952
  FROM kv_entries
@@ -33859,7 +34247,7 @@ var VERSIONABLE_FIELDS2, BUDGETED_IDENTITY_FIELDS, PENDING_SLACK_MESSAGE_TS_PREF
33859
34247
  LEFT JOIN agents a ON m.created_by_kind = 'agent' AND a.id = m.created_by_agent_id`, ROUTING_HOLDER_SQL = `CASE
33860
34248
  WHEN status IN ('draft', 'offered', 'reviewing') AND offeredTo IS NOT NULL THEN offeredTo
33861
34249
  ELSE COALESCE(agentId, offeredTo)
33862
- END`, ELIGIBILITY_SCAN_BATCH_SIZE, UNATTRIBUTED_USER_ID2 = "unattributed", HUMAN_FREE_SQL = "(COALESCE(t.isHumanFree, 0) = 1)", SCHEDULE_TEMPLATE_PREVIEW_LENGTH = 280, RESERVED_CONFIG_PLACEHOLDER = "[reserved key stored in swarm_config; delete this row]", SKILL_FILE_LIMITS2, BINARY_SKILL_FILE_PLACEHOLDER = "[binary file - not synced]", SKILL_SLIM_COLUMNS = "id, name, description, type, scope, ownerAgentId, sourceUrl, sourceRepo, sourcePath, sourceBranch, sourceHash, isComplex, allowedTools, model, effort, context, agent, disableModelInvocation, userInvocable, version, isEnabled, systemDefault, invocationCount, lastInvokedAt, createdAt, lastUpdatedAt, lastFetchedAt, '' as content", KvTypeCollisionError2;
34250
+ END`, ELIGIBILITY_SCAN_BATCH_SIZE, UNATTRIBUTED_USER_ID2 = "unattributed", HUMAN_FREE_SQL = "(COALESCE(t.isHumanFree, 0) = 1)", SCHEDULE_TEMPLATE_PREVIEW_LENGTH = 280, RESERVED_CONFIG_PLACEHOLDER = "[reserved key stored in swarm_config; delete this row]", SKILL_FILE_LIMITS2, BINARY_SKILL_FILE_PLACEHOLDER = "[binary file - not synced]", SKILL_SLIM_COLUMNS = "id, name, description, type, scope, ownerAgentId, sourceUrl, sourceRepo, sourcePath, sourceBranch, sourceHash, isComplex, allowedTools, model, effort, context, agent, disableModelInvocation, userInvocable, version, isEnabled, systemDefault, invocationCount, lastInvokedAt, createdByAgentId, updatedByAgentId, created_by, updated_by, createdAt, lastUpdatedAt, lastFetchedAt, '' as content", KvTypeCollisionError2;
33863
34251
  var init_db4 = __esm(() => {
33864
34252
  init_session_costs();
33865
34253
  init_session_costs();
@@ -33927,6 +34315,7 @@ var init_db4 = __esm(() => {
33927
34315
  init_context_versions();
33928
34316
  init_script_runs();
33929
34317
  init_session_moves();
34318
+ init_skill_audit();
33930
34319
  init_workflow_run_definitions();
33931
34320
  init_runtime2();
33932
34321
  init_read();
@@ -33935,7 +34324,7 @@ var init_db4 = __esm(() => {
33935
34324
  configureAgentDependencies({
33936
34325
  createLogEntry: (entry) => createLogEntry2(entry),
33937
34326
  installSystemDefaultSkillsForAgent: (agentId) => installSystemDefaultSkillsForAgent2(agentId),
33938
- resolvePendingImportAssignments: async (agent) => (await import("./pending-hxj5yatb.js")).resolvePendingImportAssignments(agent)
34327
+ resolvePendingImportAssignments: async (agent) => (await import("./pending-x0z3vx1x.js")).resolvePendingImportAssignments(agent)
33939
34328
  });
33940
34329
  configureTaskWriteDependencies({
33941
34330
  createLogEntry: (...args) => createLogEntry2(...args),
@@ -33985,4 +34374,4 @@ var init_db4 = __esm(() => {
33985
34374
  };
33986
34375
  });
33987
34376
 
33988
- export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, EgressDeniedError, createGuardedFetch, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, init_secrets_cipher, getEncryptionKey, init_key_bootstrap, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, wasDbCreatedThisBoot, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, init_can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, isSlackIconConfigKey, reactionStatusIcon, iconPrefix, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, AgentDeletedError2, isAgentDeleted2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasBotReplySince, slackThreadHasOutcomeWork, observeSlackTreeVisibility, getSlackProcessingThreads, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, configPools, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, reclassifyTaskHumanFree, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, deleteOrphanedRunDefinitions, init_workflow_run_definitions, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
34377
+ export { auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, defaultCredentialBindings, isPrivateAddress, assertUrlSafe, EgressDeniedError, createGuardedFetch, createSsrfGuardedFetch, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, init_secrets_cipher, getEncryptionKey, init_key_bootstrap, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, openSealedJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, wasDbCreatedThisBoot, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, SessionCostConflictError2, insertSessionCost2, slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, APP_SESSION_KEY_PATTERN, appSessionContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, TaskCreationBlockedError, TaskRoutingAuthorizationError, init_errors2, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, getCurrentRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, init_can, PermissionVerbSchema, init_rbac, randomChars, init_short_id, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, isSlackIconConfigKey, reactionStatusIcon, iconPrefix, completedStatusIcon, init_reaction_shortcode, UI_SPEC_SCRIPT_ACTIONS_KEY, parseScriptActionAllowlist, init_script_allowlist, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isHumanOnlyConfigKey, humanOnlyConfigKeyError, humanOnlyConfigKeyPageError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, AgentDeletedError2, isAgentDeleted2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasBotReplySince, slackThreadHasOutcomeWork, observeSlackTreeVisibility, getSlackProcessingThreads, init_slack_trees, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, OpenAI2, init_openai2, LEARNING_TTL_DAYS, LEARNING_DUPLICATE_MIN_SIMILARITY, CANDIDATE_SET_MULTIPLIER, isGraphExpansionEnabled, EMBEDDING_DIMENSIONS, init_constants2, LONGTERM_ROOT, LEARNINGS_ROOT, MEMORY_KEY_PATTERN, MEMORY_KEY_PATTERN_MESSAGE, MEMORY_KEY_MAX_LENGTH, isLongtermKey, longtermKeyError, isConsolidatedKey, consolidatedKeyMessage, resolveStoreKey, init_key_paths, computeScore, rerank, init_reranker, isReviewTaskId, dropReviewTaskCompletions, init_review_recall_filter, searchMemoryCandidates, init_search_candidates, memorySearchReader, init_search_reader, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getGlobalScriptContentHashes, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, hasOAuthTokens, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, modelTierOverridesDiffer, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, configPools, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, TASK_HOLDS_PROFILE_SQL, repairWindowStart, modelProfileReferences, modelProfileRefError, isModelNameTakenError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, onTaskStarted, init_task_lifecycle_events, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, moveKeyFavorites, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, sessionSummaryQuery, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, setHumanFreeQueueListener, reclassifyTaskHumanFree, drainHumanFreeReclassifyQueue, init_human_free, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, updateTaskTags2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, markWorkflowStepTaskSuperseded2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, quoteSqlIdentifier, USER_REFERENCE_COLUMNS_SQL, userReferenceRewriteSql, WORKFLOW_CONTEXT_REQUESTER_SQL, init_user_references, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, deleteOrphanedRunDefinitions, init_workflow_run_definitions, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, setSkillUpdatedBy2, 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 };