@desplega.ai/agent-swarm 2.8.1 → 2.8.3

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 (318) hide show
  1. package/dist/acp-adapter-xq6s2z6t.js +14 -0
  2. package/dist/{actions-pwjpn0j6.js → actions-ewz7bp4g.js} +20 -19
  3. package/dist/{amp-adapter-cq9jgj6x.js → amp-adapter-f25tqhnf.js} +3 -3
  4. package/dist/{app-cnfffgwg.js → app-mkptw0k7.js} +4 -4
  5. package/dist/{assistant-kpn317y1.js → assistant-c47rfe77.js} +23 -22
  6. package/dist/{boot-args-schema-pbbnhmc3.js → boot-args-schema-4vb0xsat.js} +1 -1
  7. package/dist/{boot-reembed-9m0ysxma.js → boot-reembed-1ghy2sab.js} +1 -1
  8. package/dist/{boot-reembed-majbn53m.js → boot-reembed-htr73hbs.js} +1 -1
  9. package/dist/{boot-scrub-sweep-app8g8ym.js → boot-scrub-sweep-yrytg42z.js} +4 -4
  10. package/dist/{boot-seeds-pbtmvcjm.js → boot-seeds-n2b3dx4e.js} +4 -4
  11. package/dist/{boxd-qbkxy6ap.js → boxd-jmfqgkqa.js} +2 -2
  12. package/dist/{claude-adapter-wn1g3qp5.js → claude-adapter-r33pqnzx.js} +8 -9
  13. package/dist/{claude-managed-adapter-jh6c523j.js → claude-managed-adapter-hddmxjyj.js} +4 -4
  14. package/dist/{claude-managed-setup-pd47nzch.js → claude-managed-setup-hfvry1bd.js} +5 -5
  15. package/dist/{claude-sdk-session-3a2a6589.js → claude-sdk-session-0hamqzc7.js} +10 -11
  16. package/dist/{cli-v1dv1r37.js → cli-0bcgyj5b.js} +74 -3
  17. package/dist/{cli-a3b239vq.js → cli-0vksaxvr.js} +2 -2
  18. package/dist/{cli-mrt48bx7.js → cli-15204js0.js} +1 -1
  19. package/dist/{cli-8aes17e4.js → cli-1m96dc36.js} +3 -3
  20. package/dist/{cli-2r0jcc3k.js → cli-2d0cghfn.js} +1 -1
  21. package/dist/{cli-wk18cm92.js → cli-4ax9mvvg.js} +4 -4
  22. package/dist/{cli-9wngrawf.js → cli-4dpkjc2e.js} +6 -6
  23. package/dist/{cli-x1wa213s.js → cli-4e1hfbpq.js} +5 -5
  24. package/dist/{cli-7349va39.js → cli-500c09j9.js} +921 -431
  25. package/dist/{cli-m4dqmnbp.js → cli-54qr8mcd.js} +2 -2
  26. package/dist/{cli-m88rpzkh.js → cli-5a7szzfh.js} +2 -2
  27. package/dist/{cli-bst1vp7e.js → cli-5y2fvw4z.js} +13 -5
  28. package/dist/{cli-vj75tyaw.js → cli-6yygkr0w.js} +7 -7
  29. package/dist/{cli-7b8sbmag.js → cli-7c5tgqhf.js} +5 -5
  30. package/dist/{cli-2gxeg5gr.js → cli-8476gtwf.js} +1 -1
  31. package/dist/{cli-yncmerje.js → cli-922z7gwm.js} +4 -4
  32. package/dist/{cli-jrzkw01m.js → cli-93t5s4zq.js} +2 -2
  33. package/dist/{cli-sn7rtnj4.js → cli-9zmb7ptc.js} +9 -9
  34. package/dist/{cli-tk7cjj8h.js → cli-am1ptset.js} +3 -3
  35. package/dist/{cli-cyhbbd1z.js → cli-awwptga4.js} +1 -1
  36. package/dist/{cli-89cqnasv.js → cli-bhsfbmk8.js} +19 -7
  37. package/dist/{cli-9vhebtjz.js → cli-bj6qhgte.js} +15 -32
  38. package/dist/{cli-g70vxtjh.js → cli-c0xjnr8z.js} +2 -2
  39. package/dist/{cli-vqptjbr7.js → cli-c3ng0mb4.js} +14 -14
  40. package/dist/{cli-re4raaj0.js → cli-c71n3bxq.js} +11 -6
  41. package/dist/{cli-7p1kvkck.js → cli-crpf163n.js} +25 -18
  42. package/dist/{cli-k0wwfqbg.js → cli-dns0y538.js} +4 -0
  43. package/dist/{cli-d3p5vwbk.js → cli-dpsfwh7n.js} +13 -21
  44. package/dist/{cli-xzm9vcfg.js → cli-dtdht77h.js} +2 -2
  45. package/dist/{cli-bb431xey.js → cli-e2w34h6z.js} +231 -68
  46. package/dist/{cli-eddnyg3t.js → cli-emekyyhr.js} +1 -1
  47. package/dist/{cli-d84byzn8.js → cli-f1kwb5fc.js} +109 -33
  48. package/dist/{cli-0jzra9ad.js → cli-gn9y6fn7.js} +2 -2
  49. package/dist/{cli-tqegb8eq.js → cli-gpz1d0t2.js} +4 -4
  50. package/dist/{cli-7w69ne2f.js → cli-h9yy18gy.js} +239 -67
  51. package/dist/{cli-m5akxq8q.js → cli-j8cjdzan.js} +1 -1
  52. package/dist/{cli-m9s2qff2.js → cli-jg5txpm6.js} +187 -93
  53. package/dist/{cli-k26bkr9t.js → cli-k2rw11py.js} +3 -3
  54. package/dist/{cli-93k32c37.js → cli-k96cecs7.js} +377 -61
  55. package/dist/{cli-3vjhs18n.js → cli-kd56bmk4.js} +1 -1
  56. package/dist/{cli-k0615eh8.js → cli-kmemts3w.js} +13 -13
  57. package/dist/{cli-pcad4cb1.js → cli-knva3nmx.js} +2 -2
  58. package/dist/{cli-b085njxz.js → cli-kw44j53p.js} +15 -14
  59. package/dist/{cli-bsywb58a.js → cli-mdpbjnzq.js} +10 -10
  60. package/dist/{cli-syybb0p1.js → cli-me0r8gzr.js} +35 -76
  61. package/dist/{cli-4r05hnqa.js → cli-mwwmka77.js} +15 -15
  62. package/dist/{cli-1xh9a7hn.js → cli-n5t077me.js} +2 -2
  63. package/dist/{cli-rvhdmjvt.js → cli-nx2n3z6p.js} +1 -1
  64. package/dist/{cli-28fq781p.js → cli-pe4d96rb.js} +1 -1
  65. package/dist/{cli-3rkdne1h.js → cli-pxwtcgcp.js} +2 -2
  66. package/dist/{cli-zcsw143p.js → cli-qmqt520k.js} +2 -2
  67. package/dist/{cli-2zp0et3v.js → cli-qps8je6j.js} +70 -19
  68. package/dist/{cli-xae4g51r.js → cli-rh15cakt.js} +1 -1
  69. package/dist/{cli-k93bq1wq.js → cli-rjvsf9qa.js} +5 -5
  70. package/dist/{cli-6mma83xa.js → cli-rqfvkx5t.js} +7 -7
  71. package/dist/{cli-dy32zecz.js → cli-s7zz734a.js} +1 -1
  72. package/dist/{cli-yn2bbre9.js → cli-s8p8hhty.js} +2 -2
  73. package/dist/{cli-vbh10fqa.js → cli-sdvcrq5x.js} +5 -5
  74. package/dist/{cli-b5rs97a6.js → cli-sg27rk2t.js} +5 -5
  75. package/dist/{cli-d6521kb5.js → cli-skmhsnqh.js} +1 -1
  76. package/dist/{cli-5mrq3ake.js → cli-t4dv07kr.js} +1 -1
  77. package/dist/{cli-hxpyc9sn.js → cli-t5ys4ebm.js} +3 -3
  78. package/dist/{cli-qmqk2yc2.js → cli-tas6ckky.js} +2 -2
  79. package/dist/{cli-p1w18yhx.js → cli-tf79ryyy.js} +1 -1
  80. package/dist/{cli-kc7v1nfv.js → cli-tnzebztn.js} +1 -1
  81. package/dist/{cli-gax7fk3t.js → cli-vx421edw.js} +3 -3
  82. package/dist/{cli-kchjb7qy.js → cli-x3ex5bqf.js} +1 -1
  83. package/dist/cli-yss07azk.js +142 -0
  84. package/dist/{cli-0ntbxyaa.js → cli-z8cvws4c.js} +363 -47
  85. package/dist/{cli-tacge1w0.js → cli-zdaypkq9.js} +146 -52
  86. package/dist/{cli-b8e9nb04.js → cli-zeaehgyd.js} +2 -2
  87. package/dist/{cli-jcpr5smb.js → cli-ztq5z4e1.js} +4 -4
  88. package/dist/cli.js +21 -21
  89. package/dist/{codex-adapter-nha71q3n.js → codex-adapter-2brxx5ta.js} +7 -8
  90. package/dist/{codex-hook-h3vk6xzr.js → codex-hook-c930c3ea.js} +2 -2
  91. package/dist/{codex-login-bcda78ge.js → codex-login-cbrs1h5w.js} +1 -1
  92. package/dist/{codex-session-runner-ak9x1k1h.js → codex-session-runner-y9anfj0r.js} +8 -9
  93. package/dist/{commands-f587qpq8.js → commands-wn9q06qr.js} +3 -3
  94. package/dist/{controller-hxx8wwy1.js → controller-fw608czd.js} +4 -4
  95. package/dist/{controllers-connect-k5sg9m9h.js → controllers-connect-63j5rdcm.js} +20 -20
  96. package/dist/{cursor-adapter-n5nc3mfe.js → cursor-adapter-6mb9jme8.js} +2 -2
  97. package/dist/{db-nzf8zb5z.js → db-0m6v5tq4.js} +3 -3
  98. package/dist/{db-amm8w15a.js → db-y4wfrzbm.js} +4 -2
  99. package/dist/{devin-adapter-xedz98zv.js → devin-adapter-r0yx3gv8.js} +1 -1
  100. package/dist/{dispatcher-89zrts8f.js → dispatcher-9tq2zzdj.js} +17 -17
  101. package/dist/{docker-866qpzt9.js → docker-j75atvpt.js} +2 -2
  102. package/dist/{dsh-adapter-nrhbrjz8.js → dsh-adapter-t09sv4tq.js} +2 -2
  103. package/dist/{e2b-s16txnpx.js → e2b-7s9dscap.js} +3 -3
  104. package/dist/{e2b-jkwfhbcv.js → e2b-a7vzs2vj.js} +3 -3
  105. package/dist/{easter-egg-3d-533knw22.js → easter-egg-3d-fbwvmwhe.js} +1 -1
  106. package/dist/{embedding-space-ezwenjmj.js → embedding-space-wh8de1t9.js} +6 -6
  107. package/dist/{embeddings-np74ht6g.js → embeddings-3hpbdtjr.js} +1 -1
  108. package/dist/{event-bus-e66gh7cc.js → event-bus-tr6h3gv8.js} +1 -1
  109. package/dist/{execute-b3mrb1mv.js → execute-4bdf8sdy.js} +1 -1
  110. package/dist/{external-channel-z46yx9d7.js → external-channel-ts2fwqh0.js} +2 -2
  111. package/dist/fx-adapter-1rnxnf56.js +17 -0
  112. package/dist/grok-adapter-efhmf1r8.js +17 -0
  113. package/dist/handlers-anrr3py9.js +32 -0
  114. package/dist/{heartbeat-dt9qw9c8.js → heartbeat-2ze5fzpc.js} +20 -20
  115. package/dist/{hook-8k6fbz9b.js → hook-ca54yd4s.js} +5 -5
  116. package/dist/{hook-jgcgygex.js → hook-gaehe2w5.js} +8 -8
  117. package/dist/{http-haw4r8ne.js → http-jfg8t2yk.js} +3839 -122
  118. package/dist/{index-tvfafeyy.js → index-3gv6sc4z.js} +1 -1
  119. package/dist/{index-tez78qj3.js → index-3yvzbhxd.js} +100 -23
  120. package/dist/index-8w2aznds.js +33 -0
  121. package/dist/{index-5gk12my8.js → index-csgrxedz.js} +1 -1
  122. package/dist/index-qnjvr362.js +37 -0
  123. package/dist/index-yzxd3sn9.js +32 -0
  124. package/dist/{keepalive-xn6s7rmg.js → keepalive-k2a3qe73.js} +4 -4
  125. package/dist/lead-zhxqbfdv.js +69 -0
  126. package/dist/{maintenance-vdts800b.js → maintenance-gb5sd5nc.js} +1 -1
  127. package/dist/{node-4c5jqxr3.js → node-7qsx5kvm.js} +1 -1
  128. package/dist/{oauth-refresh-sweep-094c8wfk.js → oauth-refresh-sweep-y7rm6bkb.js} +3 -3
  129. package/dist/{onboard-v99eh56m.js → onboard-jmc5qerv.js} +4 -4
  130. package/dist/{opencode-adapter-dsagkhtw.js → opencode-adapter-7eade9ev.js} +6 -7
  131. package/dist/{otel-impl-q7yr9yp0.js → otel-impl-8j1xhxqd.js} +2 -2
  132. package/dist/{pi-mono-adapter-546cd1cc.js → pi-mono-adapter-yqmaf32x.js} +14 -13
  133. package/dist/{pricing-refresh-7dh2yase.js → pricing-refresh-1nj722h6.js} +2 -2
  134. package/dist/{rbac-roles-mdmc96p4.js → rbac-roles-b1mtr6dr.js} +3 -3
  135. package/dist/{rbac-roles-npbmdh77.js → rbac-roles-n1f3frk1.js} +2 -2
  136. package/dist/{render-v2-twhhwmms.js → render-v2-1gfpd8rj.js} +4 -4
  137. package/dist/{resume-5gsrjd5e.js → resume-w1s1eh5v.js} +7 -7
  138. package/dist/{runtime-1hv06jsn.js → runtime-84g5egsc.js} +1 -1
  139. package/dist/{session-access-m191x30x.js → session-access-y6z1txk4.js} +4 -4
  140. package/dist/{session-source-backfill-nt923ask.js → session-source-backfill-gxxwfh12.js} +3 -3
  141. package/dist/{setup-wv467afy.js → setup-r91gstyk.js} +1 -1
  142. package/dist/{virtual-modules-gazyapte.js → virtual-modules-cgnj6kme.js} +3 -3
  143. package/dist/{work-objects-8zkrpy13.js → work-objects-qcxzg61c.js} +20 -20
  144. package/dist/worker-7j2907g6.js +69 -0
  145. package/dist/{worker-follow-up-cecqszem.js → worker-follow-up-y2d2h7km.js} +19 -17
  146. package/dist/{x-2fyrt5pp.js → x-qhxq2ama.js} +2 -2
  147. package/openapi.json +2908 -351
  148. package/package.json +4 -4
  149. package/src/apps/catalog.generated.json +120 -1
  150. package/src/apps/definition.ts +38 -11
  151. package/src/apps/page-validator.ts +88 -0
  152. package/src/be/db/model-profiles.ts +110 -11
  153. package/src/be/db/tasks/read.ts +53 -0
  154. package/src/be/db/workflow-run-definitions.ts +19 -8
  155. package/src/be/db-client.ts +43 -5
  156. package/src/be/db.ts +40 -9
  157. package/src/be/migrations/284_model_profile_fallbacks.sql +9 -0
  158. package/src/be/migrations/289_automation_savings_daily.sql +47 -0
  159. package/src/be/migrations/291_task_slack_participants.sql +4 -0
  160. package/src/be/migrations/293_savings_component_links.sql +58 -0
  161. package/src/be/migrations/296_automation_savings_daily_read_index.sql +6 -0
  162. package/src/be/model-profile-check.ts +53 -20
  163. package/src/be/runtime-pools/routing.ts +1 -0
  164. package/src/be/savings/calibrate.ts +468 -0
  165. package/src/be/savings/compute.ts +677 -0
  166. package/src/be/savings/model.ts +674 -0
  167. package/src/be/savings/read.ts +1500 -0
  168. package/src/be/savings/rollup.ts +571 -0
  169. package/src/be/scripts/run-credential.ts +15 -3
  170. package/src/be/scripts/typecheck.ts +91 -4
  171. package/src/be/seed/agent-fs-provision.ts +48 -11
  172. package/src/be/seed/workflows-seeder.ts +67 -23
  173. package/src/be/seed-scripts/catalog/dreaming-learnings.ts +10 -2
  174. package/src/be/seed-scripts/catalog/dreaming-memtax-create.ts +70 -4
  175. package/src/be/skill-parser.ts +19 -7
  176. package/src/be/swarm-config-guard.ts +8 -0
  177. package/src/be/users.ts +29 -2
  178. package/src/commands/onboard/agent-fs-version.ts +1 -1
  179. package/src/commands/provider-error-class.ts +97 -0
  180. package/src/commands/runner.ts +258 -58
  181. package/src/extensions/contract-types.generated.ts +1 -1
  182. package/src/http/all-routes.ts +2 -0
  183. package/src/http/fs.ts +8 -2
  184. package/src/http/index.ts +11 -0
  185. package/src/http/model-profiles.ts +43 -10
  186. package/src/http/poll.ts +15 -1
  187. package/src/http/requested-by.ts +97 -1
  188. package/src/http/savings-calibration.ts +277 -0
  189. package/src/http/savings.ts +849 -0
  190. package/src/http/scripts.ts +26 -15
  191. package/src/http/tasks.ts +89 -9
  192. package/src/http/trackers/authorize-gate.ts +41 -0
  193. package/src/http/trackers/jira.ts +26 -4
  194. package/src/http/trackers/linear.ts +26 -4
  195. package/src/integrations/chat-sdk/limits.ts +6 -1
  196. package/src/jira/oauth.ts +7 -1
  197. package/src/linear/README.md +2 -1
  198. package/src/linear/oauth.ts +7 -1
  199. package/src/prompts/session-templates.ts +80 -3
  200. package/src/providers/acp-targets.ts +1 -1
  201. package/src/providers/amp-adapter.ts +1 -1
  202. package/src/providers/claude-adapter.ts +0 -20
  203. package/src/providers/claude-flag-settings.ts +12 -10
  204. package/src/providers/codex-adapter.ts +12 -34
  205. package/src/providers/opencode-adapter.ts +34 -12
  206. package/src/providers/pi-mono-adapter.ts +6 -5
  207. package/src/providers/types.ts +7 -0
  208. package/src/scheduler/scheduler.ts +20 -14
  209. package/src/scripts-runtime/ctx.ts +1 -1
  210. package/src/scripts-runtime/executors/quickjs-bundle.ts +1 -0
  211. package/src/scripts-runtime/executors/quickjs-prelude.ts +162 -2
  212. package/src/scripts-runtime/executors/quickjs-runner.ts +4 -1
  213. package/src/scripts-runtime/sdk-allowlist.ts +11 -1
  214. package/src/scripts-runtime/stdlib/fetch.ts +113 -15
  215. package/src/scripts-runtime/stdlib/index.ts +3 -1
  216. package/src/scripts-runtime/stdlib/retry.ts +174 -0
  217. package/src/scripts-runtime/swarm-sdk.ts +192 -17
  218. package/src/scripts-runtime/types/stdlib.d.ts +95 -4
  219. package/src/scripts-runtime/types/swarm-extension.d.ts +60 -0
  220. package/src/scripts-runtime/types/swarm-sdk.d.ts +69 -2
  221. package/src/slack/actions.ts +1 -0
  222. package/src/slack/assistant.ts +2 -0
  223. package/src/slack/enrich.ts +144 -50
  224. package/src/slack/handlers.ts +37 -95
  225. package/src/slack/templates.ts +9 -0
  226. package/src/slack/thread-buffer.ts +45 -71
  227. package/src/slack/thread-participants.ts +187 -0
  228. package/src/tasks/worker-follow-up.ts +142 -3
  229. package/src/tests/agent-fs-provision-seeder.test.ts +81 -0
  230. package/src/tests/apps-chart-shell.test.ts +170 -0
  231. package/src/tests/apps-icon.test.ts +156 -2
  232. package/src/tests/base-prompt.test.ts +5 -4
  233. package/src/tests/chat-sdk-relay.test.ts +12 -0
  234. package/src/tests/claude-adapter-binary.test.ts +7 -1
  235. package/src/tests/claude-adapter.test.ts +10 -64
  236. package/src/tests/claude-flag-settings.test.ts +15 -11
  237. package/src/tests/claude-hook-credentials.test.ts +0 -1
  238. package/src/tests/claude-sdk-lifecycle.test.ts +5 -1
  239. package/src/tests/codex-adapter.test.ts +28 -78
  240. package/src/tests/comb-default.test.ts +6 -0
  241. package/src/tests/core-auth.test.ts +7 -6
  242. package/src/tests/create-task-vcs-repo.test.ts +136 -0
  243. package/src/tests/db-client-busy-retry.test.ts +58 -6
  244. package/src/tests/db-task-read-contract.test.ts +2 -0
  245. package/src/tests/db-task-write-contract.test.ts +1 -0
  246. package/src/tests/deploy-guard.test.ts +154 -0
  247. package/src/tests/docs-index-footprint.test.js +3 -3
  248. package/src/tests/dreaming-learnings.test.ts +104 -0
  249. package/src/tests/extensions-pre-task.test.ts +4 -2
  250. package/src/tests/fetch-resolved-env.test.ts +47 -1
  251. package/src/tests/fixtures/app-shell-charts-definition.json.txt +180 -0
  252. package/src/tests/model-profile-fallbacks.test.ts +482 -0
  253. package/src/tests/model-profiles-api.test.ts +1 -0
  254. package/src/tests/opencode-adapter.test.ts +53 -6
  255. package/src/tests/pi-mono-session-cost-on-abort.test.ts +115 -0
  256. package/src/tests/prompt-template-session.test.ts +17 -1
  257. package/src/tests/provider-error-class.test.ts +174 -0
  258. package/src/tests/runner-provider-fallback.test.ts +197 -0
  259. package/src/tests/runner-requester-profile.test.ts +139 -1
  260. package/src/tests/savings-calibration-api.test.ts +264 -0
  261. package/src/tests/savings-calibration.test.ts +201 -0
  262. package/src/tests/savings-compound.test.ts +774 -0
  263. package/src/tests/savings-compute.test.ts +215 -0
  264. package/src/tests/savings-fleet-latency.test.ts +143 -0
  265. package/src/tests/savings-fleet-read.test.ts +195 -0
  266. package/src/tests/savings-fleet-scale.test.ts +222 -0
  267. package/src/tests/savings-model.test.ts +499 -0
  268. package/src/tests/savings-read.test.ts +367 -0
  269. package/src/tests/savings-rollup.test.ts +766 -0
  270. package/src/tests/savings-scripts.test.ts +611 -0
  271. package/src/tests/script-connections.test.ts +4 -0
  272. package/src/tests/script-executor-conformance.test.ts +444 -0
  273. package/src/tests/scripts-http.test.ts +55 -0
  274. package/src/tests/scripts-runtime-fetch.test.ts +2 -2
  275. package/src/tests/sdk-allowlist.test.ts +40 -0
  276. package/src/tests/secret-rules.test.ts +124 -1
  277. package/src/tests/secret-scrubber.test.ts +1 -1
  278. package/src/tests/seed-workflows.test.ts +167 -11
  279. package/src/tests/skill-parser.test.ts +45 -0
  280. package/src/tests/slack-dm-implicit-mention.test.ts +20 -1
  281. package/src/tests/slack-identity-resolution.test.ts +23 -0
  282. package/src/tests/slack-inbound-files.test.ts +2 -1
  283. package/src/tests/slack-thread-participants.test.ts +429 -0
  284. package/src/tests/tool-annotations.test.ts +30 -0
  285. package/src/tests/tracker-oauth-authorize-auth.test.ts +262 -0
  286. package/src/tests/workflow-definition-pinning.test.ts +128 -3
  287. package/src/tests/workflow-script-principal.test.ts +94 -4
  288. package/src/tools/app-upsert.ts +1 -1
  289. package/src/tools/model-profiles/list-model-profiles.ts +4 -2
  290. package/src/tools/update-profile.ts +1 -1
  291. package/src/types.ts +146 -33
  292. package/src/utils/constants.ts +2 -0
  293. package/src/utils/mcp-server-fetcher.test.ts +89 -0
  294. package/src/utils/mcp-server-fetcher.ts +13 -5
  295. package/src/utils/request-auth-context.ts +24 -0
  296. package/src/utils/secret-rules.generated.ts +1 -1
  297. package/src/utils/secret-scrubber.ts +154 -29
  298. package/src/workflows/executors/swarm-script.ts +23 -19
  299. package/templates/skills/apps/SKILL.md +62 -3
  300. package/templates/skills/apps/content.md +62 -3
  301. package/templates/skills/swarm-docs/content.md +2 -0
  302. package/templates/skills/swarm-scripts/SKILL.md +5 -4
  303. package/templates/skills/swarm-scripts/content.md +5 -4
  304. package/templates/skills/work-on-task/SKILL.md +1 -1
  305. package/templates/skills/work-on-task/content.md +1 -1
  306. package/templates/workflows/dreaming/content.md +1 -1
  307. package/dist/acp-adapter-pdy3qsvg.js +0 -15
  308. package/dist/cli-4bd1rck6.js +0 -4
  309. package/dist/cli-jywyhqws.js +0 -104
  310. package/dist/fx-adapter-3q12snn6.js +0 -18
  311. package/dist/grok-adapter-ahb1w033.js +0 -18
  312. package/dist/handlers-vbww69re.js +0 -32
  313. package/dist/index-4xwaf5th.js +0 -32
  314. package/dist/index-f0hcrs8e.js +0 -33
  315. package/dist/index-s4ewdma4.js +0 -37
  316. package/dist/lead-6ygbfhbh.js +0 -70
  317. package/dist/worker-mz5z7kj0.js +0 -70
  318. package/src/providers/ctx-mode-env.ts +0 -10
@@ -3,7 +3,7 @@ import {
3
3
  ampPinCatalogError,
4
4
  ampModelError,
5
5
  init_amp_models
6
- } from "./cli-p1w18yhx.js";
6
+ } from "./cli-tf79ryyy.js";
7
7
  import {
8
8
  ALL_TOOLS,
9
9
  init_tool_config
@@ -29,9 +29,11 @@ import {
29
29
  OPEN_TASK_STATUSES,
30
30
  ProviderNameSchema,
31
31
  ModelProfileCredentialsSchema,
32
+ FallbackHopSchema,
32
33
  PROVIDER_STEER_CAPABILITIES,
33
34
  FollowUpConfigSchema,
34
35
  RoutingAffinitySchema,
36
+ TaskSlackParticipantsSchema,
35
37
  CreateTaskOptionsSchema,
36
38
  SERVER_GENERATED_ATTACHMENT_CAPABILITY,
37
39
  AgentAvatarSchema,
@@ -40,7 +42,7 @@ import {
40
42
  SessionCostModelBreakdownSchema,
41
43
  PageThemeTokensSchema,
42
44
  init_types4
43
- } from "./cli-2zp0et3v.js";
45
+ } from "./cli-qps8je6j.js";
44
46
  import {
45
47
  CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
46
48
  CODEX_AUTH_FAILURE_BENCH_MS,
@@ -62,7 +64,7 @@ import {
62
64
  init_identity_field_budget,
63
65
  contentSha256,
64
66
  init_profile_sync
65
- } from "./cli-tk7cjj8h.js";
67
+ } from "./cli-am1ptset.js";
66
68
  import {
67
69
  isSlackConfigured,
68
70
  init_config4
@@ -94,7 +96,7 @@ import {
94
96
  splitCredentialPool,
95
97
  selectCredential,
96
98
  init_credentials2
97
- } from "./cli-5mrq3ake.js";
99
+ } from "./cli-t4dv07kr.js";
98
100
  import {
99
101
  registerTemplate,
100
102
  getAllTemplateDefinitions,
@@ -102,12 +104,12 @@ import {
102
104
  configureDbResolver,
103
105
  init_resolver,
104
106
  init_session_templates
105
- } from "./cli-v1dv1r37.js";
107
+ } from "./cli-0bcgyj5b.js";
106
108
  import {
107
109
  setRuntimeModelCatalog,
108
110
  runtimeHarnessSections,
109
111
  init_runtime_model_catalog
110
- } from "./cli-2r0jcc3k.js";
112
+ } from "./cli-2d0cghfn.js";
111
113
  import {
112
114
  init_zod
113
115
  } from "./cli-zcfpsfzf.js";
@@ -131,7 +133,7 @@ import {
131
133
  import {
132
134
  init_package,
133
135
  package_default
134
- } from "./cli-yncmerje.js";
136
+ } from "./cli-922z7gwm.js";
135
137
  import {
136
138
  realtimeBus,
137
139
  init_bus
@@ -166,7 +168,7 @@ import {
166
168
  registerVolatileSecret,
167
169
  registerSensitiveKeyName,
168
170
  init_secret_scrubber
169
- } from "./cli-d84byzn8.js";
171
+ } from "./cli-f1kwb5fc.js";
170
172
  import {
171
173
  __toCommonJS,
172
174
  __commonJS,
@@ -2700,6 +2702,14 @@ function isOperatorAuth(auth) {
2700
2702
  function getCurrentRequestUserId() {
2701
2703
  return authUserId(getCurrentRequestAuth());
2702
2704
  }
2705
+ function getCurrentRunProvenance() {
2706
+ const auth = getCurrentRequestAuth();
2707
+ if (auth?.kind !== "agent")
2708
+ return null;
2709
+ const sourceStepId = auth.sourceStepId ?? null;
2710
+ const sourceScriptRunId = auth.sourceScriptRunId ?? null;
2711
+ return sourceStepId || sourceScriptRunId ? { sourceStepId, sourceScriptRunId } : null;
2712
+ }
2703
2713
  var requestAuth, authStorage;
2704
2714
  var init_request_auth_context = __esm(() => {
2705
2715
  requestAuth = new WeakMap;
@@ -3906,6 +3916,13 @@ var init_event_loop_lag = __esm(() => {
3906
3916
 
3907
3917
  // src/be/db-client.ts
3908
3918
  import { AsyncLocalStorage as AsyncLocalStorage3 } from "node:async_hooks";
3919
+ function assertBeforeDeadline(deadlineAt) {
3920
+ if (deadlineAt !== undefined && Date.now() >= deadlineAt)
3921
+ throw new DbTransactionDeadlineError;
3922
+ }
3923
+ function sleepMs(ms, deadlineAt) {
3924
+ return deadlineAt === undefined ? ms : Math.max(0, Math.min(ms, deadlineAt - Date.now()));
3925
+ }
3909
3926
 
3910
3927
  class FifoLock {
3911
3928
  tail = Promise.resolve();
@@ -4048,20 +4065,22 @@ class BunSqliteClient {
4048
4065
  return this.savepoint(existing, fn);
4049
4066
  }
4050
4067
  const readOnly = opts?.readOnly === true;
4068
+ const deadlineAt = opts?.deadlineAt;
4051
4069
  let sleptMs = 0;
4052
4070
  for (let attemptIndex = 0;; attemptIndex++) {
4071
+ assertBeforeDeadline(deadlineAt);
4053
4072
  const backoff = this.busyRetry.backoffMs[attemptIndex];
4054
4073
  const canRetryAfter = backoff !== undefined && sleptMs + backoff <= this.busyRetry.maxWaitMs;
4055
- const attempt = await this.runTransactionAttempt(fn, readOnly, !canRetryAfter);
4074
+ const attempt = await this.runTransactionAttempt(fn, readOnly, !canRetryAfter, deadlineAt);
4056
4075
  if (attempt.ok)
4057
4076
  return attempt.value;
4058
4077
  if (!canRetryAfter || backoff === undefined)
4059
4078
  throw attempt.busyBegin;
4060
4079
  sleptMs += backoff;
4061
- await sleep(jittered(backoff));
4080
+ await sleep(sleepMs(jittered(backoff), deadlineAt));
4062
4081
  }
4063
4082
  }
4064
- async runTransactionAttempt(fn, readOnly, finalAttempt = false) {
4083
+ async runTransactionAttempt(fn, readOnly, finalAttempt = false, deadlineAt) {
4065
4084
  const release = await this.lock.acquire();
4066
4085
  const ctx = { closed: false, afterCommit: [] };
4067
4086
  let began = false;
@@ -4082,10 +4101,11 @@ class BunSqliteClient {
4082
4101
  }
4083
4102
  began = true;
4084
4103
  const result = await txContext.run(ctx, () => fn(tx));
4104
+ assertBeforeDeadline(deadlineAt);
4085
4105
  if (readOnly) {
4086
4106
  db.run("COMMIT");
4087
4107
  } else {
4088
- await this.retryHoldingLock(() => this.shortSpin(db, () => db.run("COMMIT"), false, false));
4108
+ await this.retryHoldingLock(() => this.shortSpin(db, () => db.run("COMMIT"), false, false), deadlineAt);
4089
4109
  }
4090
4110
  for (const hook of ctx.afterCommit)
4091
4111
  this.scheduleHook(hook);
@@ -4205,7 +4225,7 @@ class BunSqliteClient {
4205
4225
  db.exec(`PRAGMA busy_timeout = ${this.restoreBusyTimeoutMs}`);
4206
4226
  }
4207
4227
  }
4208
- async retryHoldingLock(attempt) {
4228
+ async retryHoldingLock(attempt, deadlineAt) {
4209
4229
  let sleptMs = 0;
4210
4230
  for (let attemptIndex = 0;; attemptIndex++) {
4211
4231
  try {
@@ -4213,11 +4233,13 @@ class BunSqliteClient {
4213
4233
  } catch (err) {
4214
4234
  if (!isSqliteBusy(err))
4215
4235
  throw err;
4236
+ assertBeforeDeadline(deadlineAt);
4216
4237
  const backoff = this.busyRetry.backoffMs[attemptIndex];
4217
4238
  if (backoff === undefined || sleptMs + backoff > this.busyRetry.maxWaitMs)
4218
4239
  throw err;
4219
4240
  sleptMs += backoff;
4220
- await sleep(backoff);
4241
+ await sleep(sleepMs(backoff, deadlineAt));
4242
+ assertBeforeDeadline(deadlineAt);
4221
4243
  }
4222
4244
  }
4223
4245
  }
@@ -4241,10 +4263,16 @@ class BunSqliteClient {
4241
4263
  function createBunSqliteClient(getDatabase, busyRetry) {
4242
4264
  return new BunSqliteClient(getDatabase, busyRetry);
4243
4265
  }
4244
- var LOCK_WATCHDOG_MS = 30000, txContext, DEFAULT_FINAL_ATTEMPT_SPIN_MS = 250, DEFAULT_BUSY_RETRY, SLOW_STATEMENT_WARN_MS = 100, SLOW_STATEMENT_SQL_MAX_CHARS = 200, DEFAULT_MAX_GATE_MS = 1000, GATE_DECAY_MS = 5000;
4266
+ var DbTransactionDeadlineError, LOCK_WATCHDOG_MS = 30000, txContext, DEFAULT_FINAL_ATTEMPT_SPIN_MS = 250, DEFAULT_BUSY_RETRY, SLOW_STATEMENT_WARN_MS = 100, SLOW_STATEMENT_SQL_MAX_CHARS = 200, DEFAULT_MAX_GATE_MS = 1000, GATE_DECAY_MS = 5000;
4245
4267
  var init_db_client = __esm(() => {
4246
4268
  init_secret_scrubber();
4247
4269
  init_event_loop_lag();
4270
+ DbTransactionDeadlineError = class DbTransactionDeadlineError extends Error {
4271
+ constructor() {
4272
+ super("db-client: transaction passed its deadline and was rolled back");
4273
+ this.name = "DbTransactionDeadlineError";
4274
+ }
4275
+ };
4248
4276
  txContext = new AsyncLocalStorage3;
4249
4277
  DEFAULT_BUSY_RETRY = {
4250
4278
  maxWaitMs: 11000,
@@ -5226,7 +5254,7 @@ var init_runtime2 = __esm(() => {
5226
5254
  // src/telemetry-identity.ts
5227
5255
  async function loadUserRole(userId) {
5228
5256
  try {
5229
- const { getUserGrant } = await import("./rbac-roles-mdmc96p4.js");
5257
+ const { getUserGrant } = await import("./rbac-roles-b1mtr6dr.js");
5230
5258
  const grant = await getUserGrant(userId);
5231
5259
  const role = grant.grantsAll ? "admin" : "member";
5232
5260
  const user = await getDbClient2().get("SELECT json_extract(metadata, '$.jobFunction') AS jobFunction FROM users WHERE id = ? AND json_valid(metadata)", [userId]);
@@ -8379,8 +8407,13 @@ function runtimeReadsRepoSecrets(agent) {
8379
8407
  async function vcsRepoId(vcsRepo) {
8380
8408
  if (!vcsRepo?.trim())
8381
8409
  return null;
8382
- const repos = await getDbClient2().query("SELECT id, url FROM swarm_repos WHERE name = ? ORDER BY name ASC", [vcsRepoName(vcsRepo)]);
8383
- return repos.find((r) => vcsRepoUrlMatches(r.url, vcsRepo))?.id ?? null;
8410
+ const client = getDbClient2();
8411
+ const named = await client.query("SELECT id, url FROM swarm_repos WHERE name = ? ORDER BY name ASC", [vcsRepoName(vcsRepo)]);
8412
+ const match = named.find((r) => vcsRepoUrlMatches(r.url, vcsRepo));
8413
+ if (match)
8414
+ return match.id;
8415
+ const all = await client.query("SELECT id, url FROM swarm_repos ORDER BY name ASC");
8416
+ return all.find((r) => vcsRepoUrlMatches(r.url, vcsRepo))?.id ?? null;
8384
8417
  }
8385
8418
  async function configPools(agentId, { vcsRepo, includeRepoSecrets = true }) {
8386
8419
  const pools = new Map;
@@ -8503,16 +8536,7 @@ async function credentialAllowlistRow(agentId, allowlist, pools) {
8503
8536
  ...details.length > 0 ? { detail: details.join("; ") } : {}
8504
8537
  };
8505
8538
  }
8506
- async function checkProfileForAgent(agentId, profileName, options = {}) {
8507
- const [agent, profile] = await Promise.all([
8508
- getAgentById2(agentId),
8509
- getModelProfileByName(profileName)
8510
- ]);
8511
- if (!agent || !profile)
8512
- return null;
8513
- const agentHarness = agent.harnessProvider ?? agent.provider ?? null;
8514
- const harness = options.harness === undefined ? agentHarness : options.harness;
8515
- const pools = await configPools(agentId, options);
8539
+ async function profileRows(agent, profile, harness, agentHarness, pools) {
8516
8540
  const checks = [
8517
8541
  harnessRow(profile, harness),
8518
8542
  modelRow(profile, harness),
@@ -8525,10 +8549,31 @@ async function checkProfileForAgent(agentId, profileName, options = {}) {
8525
8549
  detail: "the stored credential allowlist is unreadable; set the profile's credentials again"
8526
8550
  });
8527
8551
  } else if (profile.credentials) {
8528
- checks.push(await credentialAllowlistRow(agentId, profile.credentials, pools));
8552
+ checks.push(await credentialAllowlistRow(agent.id, profile.credentials, pools));
8529
8553
  }
8554
+ return checks;
8555
+ }
8556
+ async function checkProfileForAgent(agentId, profileName, options = {}) {
8557
+ const [agent, profile] = await Promise.all([
8558
+ getAgentById2(agentId),
8559
+ getModelProfileByName(profileName)
8560
+ ]);
8561
+ if (!agent || !profile)
8562
+ return null;
8563
+ const agentHarness = agent.harnessProvider ?? agent.provider ?? null;
8564
+ const harness = options.harness === undefined ? agentHarness : options.harness;
8565
+ const pools = await configPools(agentId, options);
8566
+ const checks = await profileRows(agent, profile, harness, agentHarness, pools);
8530
8567
  const ok = !checks.some((row) => row.state === "fail");
8531
- return { agentId, ok, profiles: [{ name: profile.name, ok, checks }] };
8568
+ const profiles = [{ name: profile.name, ok, checks }];
8569
+ for (const name of options.fallbacks === false ? [] : profile.fallbacks) {
8570
+ const fallback = await getModelProfileByName(name);
8571
+ if (!fallback)
8572
+ continue;
8573
+ const rows = await profileRows(agent, fallback, harness, agentHarness, pools);
8574
+ profiles.push({ name, ok: !rows.some((row) => row.state === "fail"), checks: rows });
8575
+ }
8576
+ return { agentId, ok, profiles };
8532
8577
  }
8533
8578
  function formatProfileCheckFailures(result) {
8534
8579
  const primary = result.profiles[0];
@@ -8751,6 +8796,32 @@ function taskPreview(task) {
8751
8796
  const text = task instanceof Uint8Array ? taskPreviewDecoder.decode(task) : skipSiblingBlock(task ?? "");
8752
8797
  return dependencies2.previewText(text, TASK_PREVIEW_LENGTH);
8753
8798
  }
8799
+ function parseFallbackHops(value) {
8800
+ if (!value)
8801
+ return;
8802
+ try {
8803
+ const parsed = JSON.parse(value);
8804
+ if (!Array.isArray(parsed))
8805
+ return;
8806
+ const hops = parsed.flatMap((entry) => {
8807
+ const hop = FallbackHopSchema.safeParse(entry);
8808
+ return hop.success ? [hop.data] : [];
8809
+ });
8810
+ return hops.length > 0 ? hops : undefined;
8811
+ } catch {
8812
+ return;
8813
+ }
8814
+ }
8815
+ function parseSlackParticipants(value) {
8816
+ if (!value)
8817
+ return;
8818
+ try {
8819
+ const parsed = TaskSlackParticipantsSchema.safeParse(JSON.parse(value));
8820
+ return parsed.success ? parsed.data : undefined;
8821
+ } catch {
8822
+ return;
8823
+ }
8824
+ }
8754
8825
  function rowToAgentTask(row) {
8755
8826
  let followUpConfig;
8756
8827
  if (row.followUpConfig) {
@@ -8807,6 +8878,7 @@ function rowToAgentTask(row) {
8807
8878
  slackThreadTs: row.slackThreadTs ?? undefined,
8808
8879
  slackTriggerMessageTs: row.slackTriggerMessageTs ?? undefined,
8809
8880
  slackUserId: row.slackUserId ?? undefined,
8881
+ slackParticipants: parseSlackParticipants(row.slackParticipants),
8810
8882
  slackReplySent: !!row.slackReplySent,
8811
8883
  slackProgressMessageTs: row.slackProgressMessageTs ?? undefined,
8812
8884
  slackTreeRootMessageTs: row.slackTreeRootMessageTs ?? undefined,
@@ -8837,6 +8909,7 @@ function rowToAgentTask(row) {
8837
8909
  resolvedEffort: ReasoningEffortSchema.safeParse(row.resolvedEffort).success ? row.resolvedEffort : undefined,
8838
8910
  profile: row.profile ?? undefined,
8839
8911
  resolvedProfile: row.resolvedProfile ?? undefined,
8912
+ fallbackHops: parseFallbackHops(row.fallbackHops),
8840
8913
  scheduleId: row.scheduleId ?? undefined,
8841
8914
  workflowRunId: row.workflowRunId ?? undefined,
8842
8915
  workflowRunStepId: row.workflowRunStepId ?? undefined,
@@ -9749,6 +9822,14 @@ async function getLatestLeadTaskByContextKey2(contextKey, source) {
9749
9822
  LIMIT 1`, [contextKey, source ?? null, source ?? null, source ?? null]);
9750
9823
  return row ? rowToAgentTask(row) : null;
9751
9824
  }
9825
+ async function getFirstTaskInThread2(channelId, threadTs) {
9826
+ const row = await getDbClient2().get(`SELECT * FROM agent_tasks
9827
+ WHERE slackChannelId = ?
9828
+ AND slackThreadTs = ?
9829
+ ORDER BY createdAt ASC
9830
+ LIMIT 1`, [channelId, threadTs]);
9831
+ return row ? rowToAgentTask(row) : null;
9832
+ }
9752
9833
  async function getMostRecentTaskInThread2(channelId, threadTs) {
9753
9834
  const row = await getDbClient2().get(`SELECT * FROM agent_tasks
9754
9835
  WHERE slackChannelId = ?
@@ -9894,6 +9975,17 @@ function parseCredentialAllowlist(value) {
9894
9975
  function serializeCredentialAllowlist(value) {
9895
9976
  return value && Object.keys(value).length > 0 ? JSON.stringify(value) : null;
9896
9977
  }
9978
+ function parseFallbacks(value) {
9979
+ if (!value)
9980
+ return [];
9981
+ try {
9982
+ const parsed = JSON.parse(value);
9983
+ if (Array.isArray(parsed)) {
9984
+ return parsed.filter((name) => typeof name === "string" && name.length > 0);
9985
+ }
9986
+ } catch {}
9987
+ return [];
9988
+ }
9897
9989
  function rowToModelProfile(row) {
9898
9990
  const allowlist = parseCredentialAllowlist(row.credentialAllowlist);
9899
9991
  const profile = {
@@ -9906,6 +9998,7 @@ function rowToModelProfile(row) {
9906
9998
  description: row.description,
9907
9999
  seededFrom: row.seededFrom,
9908
10000
  credentials: allowlist.credentials,
10001
+ fallbacks: parseFallbacks(row.fallbacks),
9909
10002
  createdAt: row.createdAt,
9910
10003
  lastUpdatedAt: row.lastUpdatedAt
9911
10004
  };
@@ -9924,8 +10017,8 @@ async function getModelProfileByName(name) {
9924
10017
  async function createModelProfile(input, audit = {}) {
9925
10018
  const now = new Date().toISOString();
9926
10019
  const row = await getDbClient2().get(`INSERT INTO model_profiles
9927
- (id, name, harness, model, effort, allowCustomModel, description, seededFrom, credentialAllowlist, createdAt, lastUpdatedAt, created_by, updated_by)
9928
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
10020
+ (id, name, harness, model, effort, allowCustomModel, description, seededFrom, credentialAllowlist, fallbacks, createdAt, lastUpdatedAt, created_by, updated_by)
10021
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
9929
10022
  ON CONFLICT(name) DO NOTHING
9930
10023
  RETURNING *`, [
9931
10024
  crypto.randomUUID(),
@@ -9937,6 +10030,7 @@ async function createModelProfile(input, audit = {}) {
9937
10030
  input.description ?? null,
9938
10031
  input.seededFrom ?? null,
9939
10032
  serializeCredentialAllowlist(input.credentials),
10033
+ JSON.stringify(input.fallbacks ?? []),
9940
10034
  now,
9941
10035
  now,
9942
10036
  audit.userId ?? null,
@@ -9967,6 +10061,10 @@ async function updateModelProfile(name, patch, audit = {}) {
9967
10061
  sets.push("credentialAllowlist = ?");
9968
10062
  params.push(serializeCredentialAllowlist(patch.credentials));
9969
10063
  }
10064
+ if (patch.fallbacks !== undefined) {
10065
+ sets.push("fallbacks = ?");
10066
+ params.push(JSON.stringify(patch.fallbacks));
10067
+ }
9970
10068
  sets.push("lastUpdatedAt = ?", "updated_by = ?");
9971
10069
  params.push(new Date().toISOString(), audit.userId ?? null);
9972
10070
  const row = await getDbClient2().get(`UPDATE model_profiles SET ${sets.join(", ")} WHERE name = ? RETURNING *`, [...params, name]);
@@ -9980,10 +10078,14 @@ async function modelProfileReferences(name) {
9980
10078
  const tasks = await getDbClient2().get(`SELECT COUNT(*) AS n FROM agent_tasks t
9981
10079
  WHERE (t.profile = ? OR t.resolvedProfile = ?) AND ${TASK_HOLDS_PROFILE_SQL}`, [name, name, repairWindowStart()]);
9982
10080
  const schedules = await getDbClient2().query("SELECT id FROM scheduled_tasks WHERE profile = ? ORDER BY id", [name]);
10081
+ const fallbackOf = await getDbClient2().query(`SELECT o.name FROM model_profiles o,
10082
+ json_each(CASE WHEN json_valid(o.fallbacks) THEN o.fallbacks ELSE '[]' END) j
10083
+ WHERE j.value = ? AND o.name <> ? ORDER BY o.name`, [name, name]);
9983
10084
  return {
9984
10085
  agentIds: agents.map((a) => a.scopeId),
9985
10086
  openTaskCount: tasks?.n ?? 0,
9986
- scheduleIds: schedules.map((s) => s.id)
10087
+ scheduleIds: schedules.map((s) => s.id),
10088
+ fallbackOf: [...new Set(fallbackOf.map((p) => p.name))]
9987
10089
  };
9988
10090
  }
9989
10091
  function modelProfileRefError(error) {
@@ -10002,11 +10104,53 @@ async function deleteModelProfile(name) {
10002
10104
  WHERE scope = 'agent' AND key = ? AND trim(value) = model_profiles.name)
10003
10105
  AND NOT EXISTS (
10004
10106
  SELECT 1 FROM scheduled_tasks s WHERE s.profile = model_profiles.name)
10107
+ AND NOT ${LISTED_AS_FALLBACK_SQL}
10005
10108
  RETURNING id`, [name, repairWindowStart(), MODEL_PROFILE_CONFIG_KEY]);
10006
10109
  if (row)
10007
10110
  return "deleted";
10008
10111
  return await getModelProfileByName(name) ? "in-use" : "missing";
10009
10112
  }
10113
+ async function modelProfileFallbacksError(name, harness, fallbacks) {
10114
+ if (fallbacks.length > MAX_MODEL_PROFILE_FALLBACKS) {
10115
+ return `A profile lists at most ${MAX_MODEL_PROFILE_FALLBACKS} fallbacks.`;
10116
+ }
10117
+ const seen = new Set;
10118
+ for (const fallback of fallbacks) {
10119
+ if (fallback === name)
10120
+ return `"${name}" cannot list itself as a fallback.`;
10121
+ if (seen.has(fallback))
10122
+ return `Fallback "${fallback}" is listed twice.`;
10123
+ seen.add(fallback);
10124
+ }
10125
+ if (fallbacks.length === 0)
10126
+ return null;
10127
+ const rows = await getDbClient2().query("SELECT name, harness, fallbacks FROM model_profiles");
10128
+ const graph = new Map(rows.map((row) => [row.name, parseFallbacks(row.fallbacks)]));
10129
+ const harnessOf = new Map(rows.map((row) => [row.name, row.harness]));
10130
+ for (const fallback of fallbacks) {
10131
+ const other = harnessOf.get(fallback);
10132
+ if (other === undefined)
10133
+ return `Unknown fallback profile "${fallback}".`;
10134
+ if (other !== harness) {
10135
+ return `Fallback "${fallback}" runs on ${other}, not ${harness}; a fallback resumes on the same agent.`;
10136
+ }
10137
+ }
10138
+ graph.set(name, fallbacks);
10139
+ const stack = fallbacks.map((fallback) => [name, fallback]);
10140
+ const visited = new Set;
10141
+ while (stack.length > 0) {
10142
+ const path = stack.pop();
10143
+ const node = path[path.length - 1];
10144
+ if (node === name)
10145
+ return `Fallbacks would form a cycle: ${path.join(" → ")}.`;
10146
+ if (visited.has(node))
10147
+ continue;
10148
+ visited.add(node);
10149
+ for (const next of graph.get(node) ?? [])
10150
+ stack.push([...path, next]);
10151
+ }
10152
+ return null;
10153
+ }
10010
10154
  async function getAgentDefaultProfileName(agentId) {
10011
10155
  const row = await getDbClient2().get("SELECT value FROM swarm_config WHERE scope = 'agent' AND scopeId = ? AND key = ?", [agentId, MODEL_PROFILE_CONFIG_KEY]);
10012
10156
  return row?.value.trim() || null;
@@ -10033,7 +10177,10 @@ async function taskProfileError(check) {
10033
10177
  }
10034
10178
  if (!check.agentId)
10035
10179
  return null;
10036
- const result = await checkProfileForAgent(check.agentId, name, { vcsRepo: check.vcsRepo });
10180
+ const result = await checkProfileForAgent(check.agentId, name, {
10181
+ vcsRepo: check.vcsRepo,
10182
+ fallbacks: false
10183
+ });
10037
10184
  if (!result || result.ok)
10038
10185
  return null;
10039
10186
  return formatProfileCheckFailures(result);
@@ -10081,7 +10228,9 @@ var MODEL_PROFILE_CONFIG_KEY = "MODEL_PROFILE", unreadableAllowlists, TASK_HOLDS
10081
10228
  AND t.workflowRunStepId IS NULL
10082
10229
  AND (t.finishedAt IS NULL OR t.finishedAt > ?)
10083
10230
  AND NOT EXISTS (
10084
- SELECT 1 FROM agent_tasks c WHERE c.parentTaskId = t.id AND c.taskType = 'resume')))`;
10231
+ SELECT 1 FROM agent_tasks c WHERE c.parentTaskId = t.id AND c.taskType = 'resume')))`, LISTED_AS_FALLBACK_SQL = `EXISTS (
10232
+ SELECT 1 FROM model_profiles o, json_each(CASE WHEN json_valid(o.fallbacks) THEN o.fallbacks ELSE '[]' END) j
10233
+ WHERE j.value = model_profiles.name AND o.name <> model_profiles.name)`, MAX_MODEL_PROFILE_FALLBACKS = 10;
10085
10234
  var init_model_profiles = __esm(() => {
10086
10235
  init_types4();
10087
10236
  init_model_profile_check();
@@ -11436,7 +11585,7 @@ async function completeTask2(id, output, options) {
11436
11585
  });
11437
11586
  } catch {}
11438
11587
  getDbClient2().afterCommit(() => {
11439
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
11588
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
11440
11589
  workflowEventBus.emit("task.completed", {
11441
11590
  taskId: id,
11442
11591
  output: scrubbedOutput,
@@ -11491,7 +11640,7 @@ async function failTask2(id, reason, opts = {}) {
11491
11640
  });
11492
11641
  } catch {}
11493
11642
  getDbClient2().afterCommit(() => {
11494
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
11643
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
11495
11644
  workflowEventBus.emit("task.failed", {
11496
11645
  taskId: id,
11497
11646
  failureReason: scrubbedReason,
@@ -11573,7 +11722,7 @@ async function cancelTask2(id, reason, options = {}) {
11573
11722
  });
11574
11723
  } catch {}
11575
11724
  getDbClient2().afterCommit(() => {
11576
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
11725
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
11577
11726
  workflowEventBus.emit("task.cancelled", {
11578
11727
  taskId: id,
11579
11728
  agentId: row.agentId,
@@ -11585,7 +11734,7 @@ async function cancelTask2(id, reason, options = {}) {
11585
11734
  if (row.source === "schedule" && row.taskType === "deferred" && row.parentTaskId) {
11586
11735
  getDbClient2().afterCommit(async () => {
11587
11736
  try {
11588
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-cecqszem.js");
11737
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-y2d2h7km.js");
11589
11738
  await createWorkerTaskFollowUp({
11590
11739
  task: rowToAgentTask(row),
11591
11740
  status: "failed",
@@ -11634,7 +11783,7 @@ async function skipTask2(id, reason) {
11634
11783
  });
11635
11784
  } catch {}
11636
11785
  getDbClient2().afterCommit(() => {
11637
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
11786
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
11638
11787
  workflowEventBus.emit("task.skipped", {
11639
11788
  taskId: id,
11640
11789
  failureReason: skipReason,
@@ -11686,7 +11835,7 @@ async function supersedeTask2(id, args) {
11686
11835
  });
11687
11836
  } catch {}
11688
11837
  getDbClient2().afterCommit(() => {
11689
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
11838
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
11690
11839
  workflowEventBus.emit("task.superseded", {
11691
11840
  taskId: id,
11692
11841
  reason: args.reason,
@@ -11901,7 +12050,7 @@ async function updateTaskProgress2(id, progress) {
11901
12050
  });
11902
12051
  } catch {}
11903
12052
  getDbClient2().afterCommit(() => {
11904
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
12053
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
11905
12054
  workflowEventBus.emit("task.progress", {
11906
12055
  taskId: id,
11907
12056
  progress: scrubbedProgress,
@@ -12046,11 +12195,16 @@ async function getRunWorkflow2(run) {
12046
12195
  const pinned = await getPinnedRunDefinition(run.id);
12047
12196
  return pinned ? mergePinnedDefinition(live, pinned) : live;
12048
12197
  }
12049
- async function deleteOrphanedRunDefinitions() {
12050
- await getDbClient2().run(`DELETE FROM workflow_run_definitions
12051
- WHERE NOT EXISTS (
12052
- SELECT 1 FROM workflow_runs r WHERE r.definitionHash = workflow_run_definitions.hash
12053
- )`);
12198
+ async function deleteOrphanedRunDefinitions(hashes) {
12199
+ const batchSize = 100;
12200
+ for (let offset = 0;offset < hashes.length; offset += batchSize) {
12201
+ const batch = hashes.slice(offset, offset + batchSize);
12202
+ await getDbClient2().run(`DELETE FROM workflow_run_definitions
12203
+ WHERE hash IN (${batch.map(() => "?").join(", ")})
12204
+ AND NOT EXISTS (
12205
+ SELECT 1 FROM workflow_runs r WHERE r.definitionHash = workflow_run_definitions.hash
12206
+ )`, batch);
12207
+ }
12054
12208
  }
12055
12209
  var PINNED_WORKFLOW_KEYS2;
12056
12210
  var init_workflow_run_definitions = __esm(() => {
@@ -12424,7 +12578,7 @@ function emitRunFinished(runId, workflowId, status) {
12424
12578
  }
12425
12579
  function emitBusEventAfterCommit(event, payload) {
12426
12580
  getDbClient2().afterCommit(() => {
12427
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
12581
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
12428
12582
  workflowEventBus.emit(event, payload);
12429
12583
  }).catch((err) => console.error(`[db] ${event} event not emitted:`, scrubSecrets(err instanceof Error ? err.message : String(err))));
12430
12584
  });
@@ -13139,6 +13293,7 @@ var init_swarm_config_guard = __esm(() => {
13139
13293
  return "Invalid SWARM_ENABLED_TOOLS (expected comma-separated tool names or a JSON array of strings)";
13140
13294
  }
13141
13295
  },
13296
+ COMPANY_EMAIL_DOMAINS: (value) => typeof value === "string" && value.split(",").map((domain) => domain.trim()).every((domain) => domain === "" || /^[a-z0-9-]+(\.[a-z0-9-]+)+$/i.test(domain)) ? null : "Invalid COMPANY_EMAIL_DOMAINS (expected comma-separated domains, e.g. example.com,example.dev)",
13142
13297
  FEEDBACK_ENDPOINT: (value) => {
13143
13298
  if (typeof value !== "string") {
13144
13299
  return "Invalid FEEDBACK_ENDPOINT (must use HTTPS, or HTTP on a loopback host)";
@@ -21959,7 +22114,7 @@ function noteEmbeddingSuccess() {
21959
22114
  const report = (what) => (err) => {
21960
22115
  console.error(`[memory] ${what} backfill after embeddings recovered failed:`, err.message);
21961
22116
  };
21962
- backfill2 = import("./embedding-space-ezwenjmj.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
22117
+ backfill2 = import("./embedding-space-wh8de1t9.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: true })).catch(report("Embedding")).finally(() => {
21963
22118
  backfill2 = null;
21964
22119
  });
21965
22120
  }
@@ -24152,7 +24307,7 @@ async function loadSecretRegistry() {
24152
24307
  result.failed += 1;
24153
24308
  }
24154
24309
  try {
24155
- const { loadRuntimeControllerSecrets } = await import("./db-nzf8zb5z.js");
24310
+ const { loadRuntimeControllerSecrets } = await import("./db-0m6v5tq4.js");
24156
24311
  const loaded = await loadRuntimeControllerSecrets();
24157
24312
  result.runtimeController = loaded.count;
24158
24313
  result.failed += loaded.failed;
@@ -24304,7 +24459,7 @@ async function requestSteering(args) {
24304
24459
  }
24305
24460
  const requestedMode = args.mode ?? "queue";
24306
24461
  const onUnsupported = args.onUnsupported ?? "degrade";
24307
- const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-89zrts8f.js");
24462
+ const { dispatchPre, extensionIdForAgent } = await import("./dispatcher-9tq2zzdj.js");
24308
24463
  const preSteer = await dispatchPre("pre.task.steer", {
24309
24464
  task,
24310
24465
  message: args.message,
@@ -24714,6 +24869,7 @@ __export(exports_db, {
24714
24869
  getDueWaitStates: () => getDueWaitStates2,
24715
24870
  getExpiredPendingApprovals: () => getExpiredPendingApprovals2,
24716
24871
  getFavoriteItemIdSet: () => getFavoriteItemIdSet2,
24872
+ getFirstTaskInThread: () => getFirstTaskInThread2,
24717
24873
  getIdleWorkersWithCapacity: () => getIdleWorkersWithCapacity2,
24718
24874
  getInProgressSlackTasks: () => getInProgressSlackTasks2,
24719
24875
  getInProgressTasksByContextKey: () => getInProgressTasksByContextKey2,
@@ -26219,6 +26375,9 @@ async function createTaskExtended2(task, options) {
26219
26375
  if (parent.slackUserId && !options.slackUserId && !explicitForeignChannel) {
26220
26376
  options.slackUserId = parent.slackUserId;
26221
26377
  }
26378
+ if (parent.slackParticipants && !options.slackParticipants && !explicitForeignChannel) {
26379
+ options.slackParticipants = parent.slackParticipants;
26380
+ }
26222
26381
  if (parent.agentmailInboxId && !options.agentmailInboxId) {
26223
26382
  options.agentmailInboxId = parent.agentmailInboxId;
26224
26383
  }
@@ -26406,16 +26565,18 @@ async function createTaskExtended2(task, options) {
26406
26565
  parentTaskId: options?.parentTaskId,
26407
26566
  workflowRunId: options?.workflowRunId
26408
26567
  });
26568
+ const provenance = getCurrentRunProvenance();
26409
26569
  const inserted = await getDbClient2().get(`INSERT INTO agent_tasks (
26410
26570
  id, "key", agentId, creatorAgentId, task, status, source, routing_reason, routing_source, routing_note,
26411
26571
  taskType, tags, priority, dependsOn, offeredTo, offeredAt,
26412
- slackChannelId, slackThreadTs, slackTriggerMessageTs, slackUserId,
26572
+ slackChannelId, slackThreadTs, slackTriggerMessageTs, slackUserId, slackParticipants,
26413
26573
  vcsProvider, vcsRepo, vcsEventType, vcsNumber, vcsCommentId, vcsAuthor, vcsUrl,
26414
26574
  vcsInstallationId, vcsNodeId,
26415
26575
  agentmailInboxId, agentmailMessageId, agentmailThreadId,
26416
- mentionMessageId, mentionChannelId, dir, parentTaskId, dispatchedByTaskId, model, modelTier, effort, profile, scheduleId,
26417
- workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree
26418
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
26576
+ mentionMessageId, mentionChannelId, dir, parentTaskId, dispatchedByTaskId, model, modelTier, effort, profile, fallbackHops, scheduleId,
26577
+ workflowRunId, workflowRunStepId, outputSchema, followUpConfig, requestedByUserId, requestedByUserIdInherited, contextKey, routingAffinity, swarmVersion, createdAt, lastUpdatedAt, created_by, updated_by, isHumanFree,
26578
+ sourceStepId, sourceScriptRunId
26579
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
26419
26580
  id,
26420
26581
  insertKey,
26421
26582
  options?.agentId ?? null,
@@ -26436,6 +26597,7 @@ async function createTaskExtended2(task, options) {
26436
26597
  options?.slackThreadTs ?? null,
26437
26598
  options?.slackTriggerMessageTs ?? null,
26438
26599
  options?.slackUserId ?? null,
26600
+ options?.slackParticipants ? JSON.stringify(options.slackParticipants) : null,
26439
26601
  options?.vcsProvider ?? null,
26440
26602
  options?.vcsRepo ?? null,
26441
26603
  options?.vcsEventType ?? null,
@@ -26457,6 +26619,7 @@ async function createTaskExtended2(task, options) {
26457
26619
  options?.modelTier ?? null,
26458
26620
  options?.effort ?? null,
26459
26621
  options?.profile?.trim() || null,
26622
+ options?.fallbackHops?.length ? JSON.stringify(options.fallbackHops) : null,
26460
26623
  options?.scheduleId ?? null,
26461
26624
  options?.workflowRunId ?? null,
26462
26625
  options?.workflowRunStepId ?? null,
@@ -26471,7 +26634,9 @@ async function createTaskExtended2(task, options) {
26471
26634
  now,
26472
26635
  auditUserId,
26473
26636
  auditUserId,
26474
- isHumanFree ? 1 : 0
26637
+ isHumanFree ? 1 : 0,
26638
+ options?.workflowRunId ? null : provenance?.sourceStepId ?? null,
26639
+ options?.workflowRunId ? null : provenance?.sourceScriptRunId ?? null
26475
26640
  ]);
26476
26641
  if (!inserted)
26477
26642
  throw new Error("Failed to create task");
@@ -26522,7 +26687,7 @@ async function createTaskExtended2(task, options) {
26522
26687
  priority: row.priority
26523
26688
  }, (task) => task !== null, row.requestedByUserId);
26524
26689
  getDbClient2().afterCommit(() => {
26525
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => {
26690
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
26526
26691
  workflowEventBus.emit("task.created", {
26527
26692
  taskId: row.id,
26528
26693
  task: row.task,
@@ -26604,7 +26769,7 @@ async function releaseTask2(taskId, wakeSnapshot) {
26604
26769
  } catch {}
26605
26770
  if (isRuntimePoolsEnabled() && !wakeSnapshot)
26606
26771
  getDbClient2().afterCommit(() => {
26607
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
26772
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
26608
26773
  });
26609
26774
  }
26610
26775
  return row ? rowToAgentTask(row) : null;
@@ -26674,7 +26839,7 @@ async function rejectTask2(taskId, agentId, reason) {
26674
26839
  } catch {}
26675
26840
  if (isRuntimePoolsEnabled())
26676
26841
  getDbClient2().afterCommit(() => {
26677
- import("./event-bus-e66gh7cc.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
26842
+ import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => workflowEventBus.emit("task.unassigned", { taskId })).catch((error) => console.error("[db] Routing event failed:", scrubSecrets(String(error))));
26678
26843
  });
26679
26844
  }
26680
26845
  return row ? rowToAgentTask(row) : null;
@@ -28365,7 +28530,7 @@ async function deleteScheduledTask2(id) {
28365
28530
  const parent = await getTaskById2(deferred.parentTaskId);
28366
28531
  if (!parent?.deferredAt)
28367
28532
  return;
28368
- const { createWorkerTaskFollowUp } = await import("./worker-follow-up-cecqszem.js");
28533
+ const { createWorkerTaskFollowUp } = await import("./worker-follow-up-y2d2h7km.js");
28369
28534
  await createWorkerTaskFollowUp({
28370
28535
  task: parent,
28371
28536
  status: "failed",
@@ -29165,8 +29330,10 @@ async function deleteWorkflowRows(id, source) {
29165
29330
  await client.run(`UPDATE agent_tasks SET workflowRunId = NULL, workflowRunStepId = NULL WHERE workflowRunId IN (SELECT id FROM workflow_runs WHERE workflowId = ?)`, [id]);
29166
29331
  await wakeParentsOfDeletedRuns(id);
29167
29332
  await client.run(`DELETE FROM workflow_run_steps WHERE runId IN (SELECT id FROM workflow_runs WHERE workflowId = ?)`, [id]);
29333
+ const definitionHashes = await client.query(`SELECT DISTINCT definitionHash FROM workflow_runs
29334
+ WHERE workflowId = ? AND definitionHash IS NOT NULL`, [id]);
29168
29335
  await client.run("DELETE FROM workflow_runs WHERE workflowId = ?", [id]);
29169
- await deleteOrphanedRunDefinitions();
29336
+ await deleteOrphanedRunDefinitions(definitionHashes.map((row) => row.definitionHash));
29170
29337
  await reclassifyTaskHumanFree(linkedTaskIds);
29171
29338
  await client.run("DELETE FROM user_favorites WHERE itemType = 'workflow' AND itemId = ?", [id]);
29172
29339
  await tombstoneWorkflowIdempotencyKeys(id);
@@ -29187,7 +29354,7 @@ async function getWorkflowsByScheduleId2(scheduleId) {
29187
29354
  }
29188
29355
  async function createWorkflowRun2(data) {
29189
29356
  const now = new Date().toISOString();
29190
- const row = await getDbClient2().get(`INSERT INTO workflow_runs (id, workflowId, triggerType, startedAt, triggerData, created_by, parentStepId, parentStepAttempt, triggeredByAgentId, definitionHash) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
29357
+ const row = await getDbClient2().get(`INSERT INTO workflow_runs (id, workflowId, triggerType, startedAt, triggerData, created_by, parentStepId, parentStepAttempt, triggeredByAgentId, definitionHash, sourceStepId) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
29191
29358
  data.id,
29192
29359
  data.workflowId,
29193
29360
  data.triggerType ?? "manual",
@@ -29197,7 +29364,8 @@ async function createWorkflowRun2(data) {
29197
29364
  data.parentStepId ?? null,
29198
29365
  data.parentStepAttempt ?? 0,
29199
29366
  data.triggeredByAgentId ?? null,
29200
- data.definitionHash ?? null
29367
+ data.definitionHash ?? null,
29368
+ data.parentStepId || data.triggerType !== "api" && (data.triggerType ?? "manual") !== "manual" ? null : getCurrentRunProvenance()?.sourceStepId ?? null
29201
29369
  ]);
29202
29370
  if (!row)
29203
29371
  throw new Error("Failed to create workflow run");
@@ -32461,10 +32629,12 @@ async function createScriptRun2(data) {
32461
32629
  async function recordInlineScriptRun2(data) {
32462
32630
  const args = scrubJsonValue(data.args ?? null);
32463
32631
  const output = data.output === undefined ? null : scrubJsonValue(data.output);
32632
+ const provenance = getCurrentRunProvenance();
32464
32633
  const row = await getDbClient2().get(`INSERT INTO script_runs
32465
32634
  (id, agentId, scriptName, source, args, kind, status, output, error,
32466
- startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId)
32467
- VALUES (?, ?, ?, ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?)
32635
+ startedAt, finishedAt, requestedByUserId, created_by, updated_by, apiEndpointId,
32636
+ sourceStepId, parentScriptRunId)
32637
+ VALUES (?, ?, ?, ?, ?, 'inline', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
32468
32638
  RETURNING *`, [
32469
32639
  data.id,
32470
32640
  data.agentId,
@@ -32479,7 +32649,9 @@ async function recordInlineScriptRun2(data) {
32479
32649
  data.requestedByUserId ?? null,
32480
32650
  data.createdBy ?? null,
32481
32651
  data.createdBy ?? null,
32482
- data.apiEndpointId ?? null
32652
+ data.apiEndpointId ?? null,
32653
+ provenance?.sourceStepId ?? null,
32654
+ provenance?.sourceScriptRunId ?? null
32483
32655
  ]);
32484
32656
  if (!row)
32485
32657
  throw new Error("Failed to record inline script run");
@@ -32784,4 +32956,4 @@ var init_db4 = __esm(() => {
32784
32956
  };
32785
32957
  });
32786
32958
 
32787
- export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, isPrivateAddress, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, PermissionVerbSchema, init_rbac, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, taskProfileError, scheduleProfileUpdate, init_model_profiles, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasOutcomeWork, init_slack_trees, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI2, init_openai2, LEARNING_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, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };
32959
+ export { slackContextKey, chatSdkContextKey, chatThreadOfContextKey, agentmailContextKey, githubContextKey, gitlabContextKey, azureDevOpsContextKey, azureDevOpsWorkItemContextKey, bitbucketContextKey, linearContextKey, buildJiraContextKey, scheduleContextKey, workflowContextKey, agentContextKey, pageContextKey, init_context_key, sessionSourceKey, sourceOfKey, SOURCE_GROUPS_READ_ONLY, sourceMoveError, init_source_key, checkSlackRoutingCoherence, init_slack_routing, init_catalog, catalog_default, COMPANY_TEAM_SIZES, COMPANY_USE_CASES, USER_FUNCTIONS, reportedUseCase, reportedUserFunction, init_company_profile, mapTriggerSurface, init_telemetry_context, TELEMETRY_PROXY_ORIGIN, normalizeOrgWebsite, orgLogoUrl, isFilledOrgLogoUrl, init_org_website, beginRequestAuthScope, setRequestAuth, getRequestAuth, runWithoutRequestAuth, authUserId, authUser, isOperatorAuth, getCurrentRequestUserId, getCurrentRunProvenance, init_request_auth_context, setTelemetryIngestObserver, isTelemetryEnabled, _resolveIntegrationType, _resolveIntegrationProvider, initTelemetry, setTelemetryRoleResolver, setTelemetryFunctionResolver, isTelemetryReady, track, trackRelayed, telemetry, emitIntegrationConnected, init_telemetry, auditAssetKeys, init_asset_key_audit, CredentialBindingSchema, placeholderForConfigKey, CredentialBroker, DEFAULT_CREDENTIAL_BINDINGS, isPrivateAddress, assertUrlSafe, parseEgressAllowlist, init_egress_guard, init_credential_broker, encryptSecret, decryptSecret, getEncryptionKey, init_crypto, withLoopPath, bindLoopPath, startEventLoopLagProbe, stopEventLoopLagProbe, init_event_loop_lag, DbTransactionDeadlineError, isInTransaction, init_db_client, breaksJsonValidity, scrubJsonValue, foldHexCopies, init_scrub_json, sealJson, init_sealed_json, getPromptTemplateDefaultDrift, init_default_drift, init_templates2, init_templates3, isSqliteVecAvailable2, resolveSqliteVecExtensionPath2, __resetSqliteVecExtensionPathCacheForTests2, initDb2, getDb2, closeDb2, getDbClient2, init_runtime2, isRbacEnabled, decideAdmission, decideToolAdmission, grantLeadEquivalence, revokeLeadEquivalence, init_elevated_agents, LEGACY_RULES, setAuditSink, clearAuditSink, can, PermissionVerbSchema, init_rbac, CHAT_SDK_ADAPTER_NAMES, CHAT_SDK_ADAPTER_SCHEMAS, ChatSdkAdaptersDraftSchema, firstIssueText, isAdapterEntryEnabled, init_schema, TELEMETRY_RANKING_KEY, PUBLIC_RANKING_ENABLED_KEY, RANKING_CATEGORIES, readTelemetryRanking, rankingFormSchema, buildListing, init_telemetry_ranking, resolveQuickJSPoolSize, init_quickjs_pool_config, SLACK_REACTION_DEFAULTS, SLACK_REACTION_CONFIG_KEYS, reactionName, completedStatusIcon, init_reaction_shortcode, API_DRAINING_HEADER, API_DRAIN_MAX_MS_LIMIT, isApiDrainingResponse, init_api_drain2, isEnvExportRestrictedKey, init_config_env_export, parseEnabledTools, init_enabled_tools, parseFollowUpGateScheduleIds, isFollowUpGateScheduleId, init_follow_up_gate_schedule_ids, parseTaskToolManifest, CHAT_TASK_ONLY_TOOLS, isChatSdkTask, selectTaskTools, init_task_tool_manifest, tierConfigKey, init_model_tier_keys, isApiOnlyConfigKey, isInternalConfigKey, internalConfigKeyError, isReservedConfigKey, reservedKeyError, MAX_DB_RETENTION_DAYS, DB_RETENTION_TUNING_BOUNDS, APPS_JSON_COLUMN_MAX_BYTES_BOUNDS, CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS, validateRuntimeTokenTtlHours, validateControllerTokenTtlDays, validateControllerGraceSec, validateConfigValue, validateConfigEntry, validateExportToEnv, init_swarm_config_guard, cachedUserRole, cachedUserFunction, invalidateTelemetryUserRole, configureOrgDomainPersistence, recomputeOrgDomain, scheduleOrgDomainRecompute, init_telemetry_identity, resolveTriggerSurface, emitTaskTelemetry, init_telemetry_trigger, MASKED_SECRET_VALUE, init_config_secrets, HeartbeatExpiryError, init_heartbeat_expiry, isEffectiveOutputSchema, init_output_schema, isRuntimePoolsEnabled, init_runtime_pools_flag, normalizeDate, normalizeDateRequired, init_date_utils, rowToAgent, updateAgentCredentialState2, updateAgentCredentialMissing2, createAgent2, getAgentById2, EXTENSION_AGENT_ROLE2, NOT_EXTENSION_AGENT_SQL2, isExtensionAgent2, extensionAgentAssignmentError2, ReservedAgentRoleError2, reservedRoleViolation2, ExtensionAgentAssignmentError2, getAllAgents2, getAgentStatusCounts2, getLeadAgent2, updateAgentStatus2, updateAgentMaxTasks2, updateAgentProvider2, setAgentHarnessProvider2, updateAgentCredStatus2, listAgentsWithCredStatusByProvider2, getAgentHarnessProviders2, updateAgentActivity2, MAX_EMPTY_POLLS2, incrementEmptyPollCount2, resetEmptyPollCount2, shouldBlockPolling2, deleteAgent2, getActiveTaskCount2, hasCapacity2, getRemainingCapacity2, updateAgentStatusFromCapacity2, isPoolAffinityEnforcementEnabled2, buildRoutingAffinityFromAgent2, isAgentEligibleForTask2, getAgentDailyTaskCounts2, init_agents, listApprovalRequestSummaries2, getPendingApprovalVoteState2, recordApprovalVotes2, getPendingApprovalsForTasks2, approvalCancellationNotificationKey, listUndeliveredCancelledApprovalRequestIds, init_approvals, computeContentHash2, createContextVersion2, getLatestContextVersion2, getContextVersion2, getContextVersionHistory2, normalizeVcsRepo, vcsRepoName, vcsRepoUrlMatches, init_vcs_repo_match, taskModelPin, resumedTaskModelSelection, init_model_pin, normalizeModelKey, init_pricing_normalize, buildModelsDevSeedRows, seedPricingFromModelsDev, init_seed_pricing, buildCatalogEntries, replaceModelCatalog, touchModelCatalogCheckedAt, countModelCatalog, getModelCatalogMeta, updateModelCatalogMeta, upsertModelCatalogOverlay, deleteModelCatalogOverlay, expireMatchedOverlays, applyOverlayPricingRows, reloadModelsCatalog, loadModelsCatalog, init_model_catalog_store, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, init_harness_model_support, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, init_model_tier_resolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, init_model_validation2, runtimeReadsRepoSecrets, checkProfileForAgent, formatProfileCheckFailures, init_model_profile_check, startTaskSearchBackfill, stopTaskSearchBackfill, init_search_index, rowToAgentTask, getTaskById2, getChildTasks2, TASK_LINEAGE_LIMITS2, getTaskLineage2, hasNonTerminalResumeChild2, SUPERSEDED_RESUME_REPAIR_WINDOW_MS2, getSupersededTasksWithoutResume2, getSupersededTasksWithUnsettledDependents2, hasNonTerminalRerouteDecisionChild2, getTasksByAgentId2, getTasksDispatchedFrom2, getAgentCurrentTask2, getTasksByStatus2, findTaskByVcs2, findActiveTasksByVcs2, findTaskByGitHub2, readableSessionCondition, getAllTasks2, getTasksCount2, getTaskStats2, getCompletedSlackTasks2, getPendingSlackRelayTasks2, markSlackRelayAttempted2, markSlackRelayDelivered2, markFinalizedSlackRelaysDelivered2, getPendingChatRelayTasks2, giveUpStaleChatRelays2, markChatRelayAttempted2, recordChatRelayError2, markChatRelayDelivered2, markChatRelayGivenUp2, getRecentlyFinishedWorkerTasks2, markTasksNotified2, resetTasksNotified2, getInProgressSlackTasks2, getSlackTasksMissingTree2, getInProgressTasksByContextKey2, isLinearTrackerContextKey2, findExistingLinearTrackerContextWork2, getLatestTaskByContextKey2, getLatestScriptRunStepTaskByContextKey2, getAgentWorkingOnThread2, getLatestActiveTaskInThread2, getLatestLeadTaskInThread2, getAgentWorkingOnContextKey2, getLatestTaskByContextKeyPrefix2, getLatestActiveTaskByContextKey2, getLatestLeadTaskByContextKey2, getFirstTaskInThread2, getMostRecentTaskInThread2, findCompletedTasksInThread2, findRecentFailedTaskInThread2, countAgentDispatchesInThread2, findRecentCancelledTaskInThread2, init_read, MODEL_PROFILE_CONFIG_KEY, hasUnreadableCredentialAllowlist, listModelProfiles, getModelProfileByName, createModelProfile, updateModelProfile, modelProfileReferences, modelProfileRefError, deleteModelProfile, MAX_MODEL_PROFILE_FALLBACKS, modelProfileFallbacksError, taskProfileError, scheduleProfileUpdate, init_model_profiles, AssetKeyMovesBlockedError2, assertAssetKeyMovesAllowed2, moveTaskChainKeyInTx2, moveSessionChains, listPrefixRoots, listSharedPrefixRoots, init_session_moves, getSessionGroupKey, getSessionReadState, getSessionTree, triageSessionList, init_session_tree, closeSlackTreeIfSettled, getSlackThreadsOfTasks, slackThreadHasOutcomeWork, init_slack_trees, setHumanFreeQueueListener, drainHumanFreeReclassifyQueue, init_human_free, onTaskStarted, init_task_lifecycle_events, channelTopic, addWorkerSubscription, removeWorkerSubscription, listSubscribedWorkerAgents, init_channels, publishWorkerNudge, init_worker_nudges, getDefaultAuthorizationIdForProvider, getOAuthApp, getOAuthAppById, getOAuthAppIdByProvider, createOAuthApp, updateOAuthAppById, upsertOAuthApp, listAuthorizationsForApp, getAuthorizationById, upsertAuthorization, updateAuthorizationTokens, updateAuthorizationIdentity, deleteAuthorizationById, deleteAuthorizationsForApp, createOAuthPending, consumeOAuthPending, gcOAuthPending, markAuthorizationRefreshFailed, getOAuthTokens, listAuthorizationSweepRows, listKeepAliveAuthorizations, deleteOAuthTokens, acquireOAuthRefreshLock, releaseOAuthRefreshLock, init_oauth, OpenAI2, init_openai2, LEARNING_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, searchMemoryCandidates, init_search_candidates, rowToCandidate, init_sqlite_store, getEmbeddingProvider2, resetEmbeddingProvider2, getMemoryStore2, init_memory, embeddingProvider2, computeScriptEmbedding2, writeScriptEmbedding2, embedScript2, searchScripts2, reembedAllScripts2, init_embeddings, upsertScriptByName, getScript, getScriptById, getScriptVersion, listScripts, listScriptVersions, deleteScript, touchScratchScriptLastUsed, restoreScratchScriptLastUsedIfUnchanged, createScriptApi, listScriptApisForScript, getScriptApiById, getScriptApiSecret, updateScriptApi, rotateScriptApiSecret, deleteScriptApi, recordScriptApiUsage, init_db3, oauthSecretName, registerStoredSecret, loadSecretRegistry, init_secret_registry, WorkflowReplayStateError, init_workflow_replay, getWorkflowRunTriggeredByAgentId, getWorkflowRunSummary, getWorkflowRunStepsSlimByRunId, WORKFLOW_RUN_TREE_MAX_DEPTH, WorkflowRunTreeError, getRunLineageBlock, getWorkflowRunTreeIds, getWorkflowRunStatus, getOpenWorkflowTreeTaskIds, getTaskIdsWithDependents, workflowRunTreeHasOpenWork, getWorkflowRunTree, cancelOpenWorkflowTreeSteps, disarmWorkflowTreeRetries, cancelLiveWorkflowTreeRuns, getChildWorkflowRunId, isParentStepAttemptCurrent, getRunningSubWorkflowSteps, getWorkflowRunParent, getWorkflowRunLineage, getSettledChildRunParentSteps, emitRunFinished, createForeachChildSteps, createForeachAttemptSteps, init_workflow_runs, SESSION_ACTIVITY_REFRESH_MIN_INTERVAL_MS2, refreshActiveSessionOnActivity2, getActiveSessionById, init_active_sessions, STEERING_MOVED_ERROR, SteeringRequestError, SteeringBlockedError, isSteeringEnabled, getTaskSteeringFields, getTaskSteeringFieldsForTasks, promotePendingSteeringForTask, markSteeringUndeliverable, carryUnhandledSteering, requestSteering, init_steering2, createTask2, getPendingTaskForAgent2, assignUnassignedTaskPending2, startTask2, updateTaskClaudeSessionId2, recordTaskProviderIfUnset2, updateTaskTitle2, setTaskTitleIfUnset2, completeTask2, failTask2, overwriteTerminalTaskResultText2, cancelTask2, skipTask2, supersedeTask2, settleSupersededTaskDependents2, backfillSupersedeTaskResumeTaskId2, pauseTask2, resumeTask2, getPausedTasksForAgent2, getOrphanedInProgressTasksForAgent2, resetOrphanedInProgressTasksForAgent2, getRecentlyCancelledTasksForAgent2, deleteTask2, updateTaskProgress2, init_write, IdempotencyKeyTakenError, workflowRequestFingerprint, findAcceptedWorkflowOperation, assertWorkflowIdempotencyKeyUnused, recordAcceptedWorkflowOperation, init_workflow_idempotency, PINNED_WORKFLOW_KEYS2, toPinnedDefinition2, pinWorkflowDefinition2, getRunWorkflow2, recordKeySeatMismatch2, recordKeyValidation2, retirePoolKeyStatus, init_api_keys, getScriptRunExecutionArgs2, getScriptRunFollowUpGuard2, setScriptRunFollowUpGuard2, literalPrefixPattern2, getSlackRenderV2ActivatedAt2, ensureSlackRenderV2Activation2, getSlackDelegationActivatedAt2, ensureSlackDelegationActivation2, isPendingSlackMessage2, isSettledSlackMessage2, recordSlackMessage2, reserveSlackMessage2, bindSlackMessageTimestamp2, updateSlackMessageRecord2, markSlackTreeRendered2, deleteSlackMessageRecord2, getSlackTreeMessage2, getSlackTreeMessageByThread2, getSlackOutcomeMessage2, getResolvableDeferralOutcomes2, markSlackDeferralResolved2, noteSlackOutcomeDeliveryFailure2, abandonSlackOutcomeDelivery2, getSlackTreeMessages2, getSlackMessageByChannelTs2, getSlackTasksInThread2, listSlackThreadsAwaitingHuman2, isSlackThreadAwaitingHuman2, markTaskSlackReplySent2, setSlackMessageTracking2, updateTaskVcs2, insertTaskAttachment2, recordTaskPullRequestAttachments2, getAssetKeyMappingByProvider2, upsertAssetKeyMapping2, getAssetKeyMapping2, listAssetSummaries2, moveAssetKey2, deleteTaskAttachment2, replaceTaskAttachment2, getTaskAttachments2, createSteeringMessage2, getSteeringMessagesForTask2, getSteeringMessageById2, getPendingSteeringForTask2, getPendingSteeringForAgent2, markSteeringDelivered2, markSteeringHandled2, markSteeringPromoted2, cancelPendingSteeringForTask2, hasPendingSteering2, getAgentWithTasks2, getAllAgentsWithTasks2, createLogEntry2, getLogsByAgentId2, getLogsByTaskId2, getLogsByTaskIdAndEventType2, getLogsByTaskIdChronological2, getLogsByEventType2, getAllLogs2, findRecentSimilarTasks2, createTaskExtended2, claimTask2, releaseTask2, acceptTask2, rejectTask2, moveTaskToBacklog2, moveTaskFromBacklog2, promoteDraftTask2, refreshDraftTaskLease2, promoteAbandonedDraftTasks2, releaseStaleReviewingTasks2, releaseStaleOfferedTasksForOfflineAgents2, getOfferedTasksForAgent2, claimOfferedTask2, getUnassignedTasksCount2, getUnassignedTaskIds2, getUnassignedTaskIdsForAgent2, checkDependencies2, getDependentTasks2, cascadeFailDependents2, updateAgentProfile2, updateAgentName2, createChannel2, getMessageById2, getChannelById2, getChannelByName2, getAllChannels2, deleteChannel2, postMessage2, getChannelMessages2, updateReadState2, getLastReadAt2, getUnreadMessages2, getMentionsForAgent2, getInboxSummary2, claimMentions2, releaseMentionProcessing2, releaseStaleMentionProcessing2, createService2, getServiceById2, getServiceByAgentAndName2, getServicesByAgentId2, getAllServices2, updateServiceStatus2, deleteService2, upsertService2, deleteServicesByAgentId2, createSessionLogs2, getSessionLogsByTaskId2, getSessionLogsBySession2, createSessionCost2, getSessionCostsByTaskId2, getSessionCostsByAgentId2, getAllSessionCosts2, getSessionCostsFiltered2, UNATTRIBUTED_USER_ID2, getSessionCostSummary2, getAttributionByPerson2, getDashboardCostSummary2, createInboxMessage2, getInboxMessageById2, getUnreadInboxMessages2, claimInboxMessages2, markInboxMessageRead2, markInboxMessageResponded2, markInboxMessageDelegated2, releaseStaleProcessingInbox2, getConcurrentContext2, getScheduledTasks2, getScheduledTaskById2, getScheduledTaskByName2, createScheduledTask2, updateScheduledTask2, deleteScheduledTask2, getDueScheduledTasks2, autoEncryptLegacyPlaintextSecrets2, maskSecrets2, getSwarmConfigs2, getInjectableGlobalConfigs2, getSwarmConfigById2, getSwarmConfigLookupById2, upsertSwarmConfig2, emitBuiltInIntegrationConnectedOnce2, deleteSwarmConfig2, deleteSwarmConfigByKey2, getResolvedConfig2, getSwarmRepos2, getSwarmRepoById2, getSwarmRepoByName2, getSwarmRepoByUrl2, createSwarmRepo2, updateSwarmRepo2, deleteSwarmRepo2, getAgentMailInboxMapping2, getAgentMailInboxMappingsByAgent2, getAllAgentMailInboxMappings2, createAgentMailInboxMapping2, deleteAgentMailInboxMapping2, findTaskByAgentMailThread2, insertActiveSession2, deleteActiveSession2, deleteActiveSessionById2, getActiveSessions2, heartbeatActiveSession2, cleanupStaleSessions2, cleanupAgentSessions2, updateActiveSessionProviderSessionId2, getActiveSessionForTask2, reassociateSessionLogs2, getStalledInProgressTasks2, getStalePinnedResumes2, failPendingResumeIfUnclaimed2, getIdleWorkersWithCapacity2, getUnassignedPoolTasks2, getStaleUnassignedAffinityTasks2, getRecentFailedTasks2, getRecentCompletedCount2, getRecentFailedCount2, createWorkflow2, getWorkflow2, listWorkflows2, updateWorkflow2, deleteWorkflow2, getWorkflowsByScheduleId2, createWorkflowRun2, getWorkflowRun2, updateWorkflowRun2, listWorkflowRuns2, countWorkflowRuns2, listWorkflowRunsPage2, createWorkflowRunStep2, getWorkflowRunStep2, updateWorkflowRunStep2, getWorkflowRunStepsByRunId2, getStuckWorkflowRuns2, getLastSuccessfulRun2, getLastRunStart2, getRetryableSteps2, getCompletedStepNodeIds2, getTaskByWorkflowRunStepId2, detachTaskFromWorkflowRunStep2, getStepByIdempotencyKey2, getStepCountForNode2, getLatestStepForNode2, getCurrentStepForNode2, createWorkflowVersion2, getWorkflowVersions2, getWorkflowVersion2, createAppVersion2, getAppVersions2, getAppVersion2, createPage2, getPage2, getPageBySlug2, getLatestPageBySlug2, listPagesByAgent2, listAllPages2, countAllPages2, countPagesByAgent2, updatePage2, deletePage2, incrementPageViewCount2, createPageVersion2, getPageVersions2, getPageVersion2, createMetric2, getMetric2, getMetricBySlug2, listMetricsByAgent2, listAllMetrics2, countAllMetrics2, countMetricsByAgent2, updateMetric2, deleteMetric2, createMetricVersion2, getMetricVersions2, getMetricVersion2, getPromptTemplates2, getPromptTemplateById2, upsertPromptTemplate2, deletePromptTemplate2, resetPromptTemplateToDefault2, getPromptTemplateHistory2, resolvePromptTemplate2, checkoutPromptTemplate2, getAllChannelActivityCursors2, getChannelActivityCursor2, upsertChannelActivityCursor2, createApprovalRequest2, getApprovalRequestById2, resolveApprovalRequest2, cancelApprovalRequestById2, cancelPendingApprovalRequestsForRun2, listCancelledApprovalRequestsForRun2, listCancelledApprovalRequestsForStep2, claimApprovalCancellationNotification2, completeApprovalCancellationNotificationClaim2, releaseApprovalCancellationNotificationClaim2, updateApprovalRequestNotifications2, listApprovalRequests2, getStuckApprovalRuns2, getApprovalRequestByStepId2, getExpiredPendingApprovals2, getStaleApprovalRequests2, createWaitState2, getWaitStateById2, getWaitStateByStepId2, getDueWaitStates2, getPendingEventWaitNames2, getPendingWaitsByEvent2, resolveWaitState2, getStuckWaitRuns2, SKILL_FILE_LIMITS2, normalizeSkillFilePath2, createSkill2, updateSkill2, listSkillFileManifest2, getSkillFiles2, getSkillFile2, upsertSkillFile2, upsertSkillFiles2, deleteSkillFile2, deleteSkill2, getSkillById2, getSkillByName2, listSkills2, searchSkills2, installSkill2, getSystemDefaultSkills2, installSystemDefaultSkillsForAgent2, uninstallSkill2, getAgentSkills2, toggleAgentSkill2, createMcpServer2, emitMcpServerConnectedTelemetry2, updateMcpServer2, deleteMcpServer2, getMcpServerById2, getMcpServerByName2, listMcpServers2, installMcpServer2, uninstallMcpServer2, getAgentMcpServers2, createContextSnapshot2, getContextSnapshotsByTaskId2, getContextSnapshotsBySessionId2, getContextSummaryByTaskId2, getAvailableKeyIndices2, recordKeyUsage2, setApiKeyPlan2, markKeyRateLimited2, recordKeyAuthFailure2, recordKeyRateLimitWindows2, setApiKeyName2, clearKeyRateLimit2, getKeyStatuses2, getKeyCostSummary2, getUserById2, getAllUsers2, createUser2, updateUser2, deleteUser2, listInboxState2, upsertInboxState2, listFavorites2, listUserFavorites2, getFavoriteItemIdSet2, setFavorite2, setUserFavorite2, withFavoriteFlags2, listTaskTemplates2, getRootTaskChain2, listRecentSessions2, countSessions2, getBudget2, getBudgets2, upsertBudget2, deleteBudget2, getAllPricingRows2, getPricingRows2, getActivePricingRow2, insertPricingRow2, deletePricingRow2, getDailySpendForAgent2, getDailySpendGlobal2, getDailySpendForUser2, recordBudgetRefusalNotification2, getBudgetRefusalNotification2, getRecentBudgetRefusalNotifications2, hasBudgetRefusalNotificationToday2, setBudgetRefusalFollowUpTaskId2, getLiveAgentCounts2, getReadyAgentCounts2, getInstanceActivity2, getSwarmMetrics2, hasFirstCompletedTask2, getKv2, sweepExpiredKv2, sweepExpiredKvPrefix2, upsertKv2, claimKv2, deleteKv2, KvTypeCollisionError2, incrKv2, kvPrefixUpperBound2, listKv2, countKv2, createScriptRun2, recordInlineScriptRun2, getScriptRun2, getScriptRunByIdempotencyKey2, listScriptRuns2, countScriptRuns2, countActiveScriptRuns2, updateScriptRun2, updateScriptRunIfNotTerminal2, updateScriptRunIfRunning2, getRunningScriptRuns2, getScriptRunJournalStep2, upsertScriptRunJournalStep2, listScriptRunJournalSteps2, countScriptRunJournalSteps2, countScriptRunJournalAgentTaskSteps2, exports_db, init_db4 };