@desplega.ai/agent-swarm 2.5.4 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/README.md +4 -2
  2. package/dist/{acp-adapter-ek38cwsv.js → acp-adapter-ma1js5n7.js} +9 -9
  3. package/dist/{actions-92mepq03.js → actions-1vhmtvg9.js} +21 -21
  4. package/dist/{amp-adapter-9gaxg015.js → amp-adapter-sxqqvmdk.js} +4 -4
  5. package/dist/{app-ctn8gsgx.js → app-mwx1d5a9.js} +3 -3
  6. package/dist/{assistant-zyr5kz47.js → assistant-yx1p6g82.js} +30 -26
  7. package/dist/{boot-reembed-w75maga2.js → boot-reembed-5h37a2c2.js} +1 -1
  8. package/dist/{boot-reembed-dwzfttdr.js → boot-reembed-7h78vmvv.js} +2 -1
  9. package/dist/{boot-scrub-sweep-e9kq43kf.js → boot-scrub-sweep-8mawd4gw.js} +4 -4
  10. package/dist/{boot-seeds-x28v3fhb.js → boot-seeds-ca84dhnn.js} +4 -4
  11. package/dist/{claude-adapter-f0afqnne.js → claude-adapter-wqt4hfkq.js} +9 -9
  12. package/dist/{claude-managed-adapter-x81a7r65.js → claude-managed-adapter-6fjqtr2z.js} +2 -2
  13. package/dist/{claude-managed-setup-bqzwjd9x.js → claude-managed-setup-rqv98sea.js} +10 -3
  14. package/dist/{claude-sdk-session-7b7whkaq.js → claude-sdk-session-f29f3b2x.js} +11 -11
  15. package/dist/{cli-sxgtf5fw.js → cli-07q03xm2.js} +1 -1
  16. package/dist/{cli-kxpfx2xr.js → cli-0z1xjzwa.js} +2 -2
  17. package/dist/{cli-g9vd9ece.js → cli-1hhbzkbb.js} +14 -16
  18. package/dist/{cli-qqzmjxkf.js → cli-1m9x8dr5.js} +11 -6
  19. package/dist/{cli-jbnn4vxb.js → cli-2pvzmas1.js} +3 -3
  20. package/dist/{cli-x77gen2p.js → cli-2y7v133v.js} +7 -7
  21. package/dist/{cli-dew6x255.js → cli-39aet655.js} +2 -2
  22. package/dist/{cli-g1cw7xtt.js → cli-39rrw8yp.js} +1 -1
  23. package/dist/{cli-jb30dzvk.js → cli-48gxjmcz.js} +530 -190
  24. package/dist/{cli-pzatvw94.js → cli-54sj64fc.js} +2 -2
  25. package/dist/{cli-bvpgr9ny.js → cli-60sty27p.js} +5 -5
  26. package/dist/{cli-asq5ydm4.js → cli-6a9qfa8b.js} +411 -69
  27. package/dist/{cli-277c31dw.js → cli-6mgdba42.js} +225 -3
  28. package/dist/{cli-19202kew.js → cli-6srv653c.js} +5 -5
  29. package/dist/{cli-n4c8e3s5.js → cli-708wdy32.js} +1 -1
  30. package/dist/{cli-pasyvjmm.js → cli-737pyqxr.js} +1 -1
  31. package/dist/{cli-6x9ma5w5.js → cli-803188pb.js} +1 -1
  32. package/dist/{cli-hh5we352.js → cli-86ehn4s5.js} +7 -7
  33. package/dist/{cli-9s05422w.js → cli-8mbc9za9.js} +1 -1
  34. package/dist/{cli-ff1tm9n9.js → cli-8wmj18cz.js} +1 -1
  35. package/dist/{cli-1r5ad7j5.js → cli-9gsm2rzp.js} +12 -12
  36. package/dist/{cli-mz9afxxf.js → cli-9pshx6rd.js} +17 -3
  37. package/dist/{cli-s682zgqz.js → cli-a6ds2epe.js} +1 -1
  38. package/dist/{cli-6a1xg1p7.js → cli-a89zdqz9.js} +2 -2
  39. package/dist/{cli-03vpq45j.js → cli-ay40dnj3.js} +2 -2
  40. package/dist/{cli-tsma7p8v.js → cli-aypd09nf.js} +2 -2
  41. package/dist/{cli-ethgy7ha.js → cli-b3yzyc57.js} +2 -2
  42. package/dist/{cli-bn0rewsy.js → cli-c081bj3b.js} +2 -2
  43. package/dist/{cli-mmhj8vd7.js → cli-c668vvcf.js} +11 -2
  44. package/dist/{cli-sbwsxvtd.js → cli-d20qvpr2.js} +2 -2
  45. package/dist/{cli-c952c7ac.js → cli-e1595bgx.js} +3 -3
  46. package/dist/{cli-621ce7kw.js → cli-f12mr20z.js} +3 -3
  47. package/dist/{cli-dqygeeh5.js → cli-f1e0ptjj.js} +10 -1
  48. package/dist/{cli-xzfq4at3.js → cli-f4dbh7a5.js} +16 -12
  49. package/dist/{cli-ha9rmwgq.js → cli-fb8m699c.js} +2 -2
  50. package/dist/{cli-5bnsc0e1.js → cli-gsfk58nw.js} +5 -5
  51. package/dist/cli-gt4h8cxw.js +895 -0
  52. package/dist/{cli-nwyw3zhg.js → cli-gxee0bqa.js} +1 -1
  53. package/dist/{cli-25n3mv5d.js → cli-h5jeg46p.js} +6 -6
  54. package/dist/{cli-gn5af0x5.js → cli-he9gbdx0.js} +62 -12
  55. package/dist/{cli-gbfxp48k.js → cli-j0ppywdr.js} +42 -35
  56. package/dist/{cli-k4tjsdx9.js → cli-j3y0x2n4.js} +277 -199
  57. package/dist/{cli-7p4jxgtt.js → cli-j9bpmykh.js} +75 -27
  58. package/dist/{cli-dabehxhp.js → cli-kt907da6.js} +1 -1
  59. package/dist/{cli-wx2nj19m.js → cli-kv7sbc2c.js} +6 -6
  60. package/dist/{cli-abs8ndtr.js → cli-m30k9777.js} +26 -26
  61. package/dist/{cli-cz5nmdxt.js → cli-m5e802r7.js} +2 -2
  62. package/dist/{cli-0shx9j93.js → cli-pfk92eqz.js} +2 -2
  63. package/dist/{cli-xtrz6bzs.js → cli-ptfq202x.js} +5 -3
  64. package/dist/{cli-6n8axjv1.js → cli-qj442fws.js} +2 -2
  65. package/dist/{cli-c61mbdds.js → cli-rd5m70gj.js} +4 -4
  66. package/dist/{cli-eftzyh9y.js → cli-s09j9vp5.js} +2 -2
  67. package/dist/{cli-m4ecdxvz.js → cli-s0mgx214.js} +7 -7
  68. package/dist/{cli-wghjkr0e.js → cli-sgqm2582.js} +10 -7
  69. package/dist/{cli-2655k16q.js → cli-sjctjr48.js} +2 -2
  70. package/dist/{cli-nzfnt2gs.js → cli-tf1n0r0b.js} +1 -1
  71. package/dist/{cli-x0f2v69c.js → cli-twctnkng.js} +12 -7
  72. package/dist/{cli-j6rktc91.js → cli-v6shg7na.js} +1 -1
  73. package/dist/{cli-gx4rm0qx.js → cli-vz78s5wm.js} +1 -1
  74. package/dist/{cli-gwhjmh8g.js → cli-wqr7cea4.js} +5 -5
  75. package/dist/{cli-e42vss7b.js → cli-x37r7qwf.js} +16 -8
  76. package/dist/{cli-4b2z6n0m.js → cli-yd2nreqw.js} +17 -8
  77. package/dist/{cli-64mh9mf3.js → cli-ymjpkxgn.js} +69 -17
  78. package/dist/{cli-5kqnemen.js → cli-yvy48785.js} +1 -1
  79. package/dist/{cli-9j129brq.js → cli-yxbsmx56.js} +6 -6
  80. package/dist/cli.js +22 -20
  81. package/dist/{codex-adapter-wch12q99.js → codex-adapter-zk59x2zh.js} +7 -7
  82. package/dist/{codex-hook-brpnycn5.js → codex-hook-xyjhvxwd.js} +1 -1
  83. package/dist/{codex-login-rn7c5gxt.js → codex-login-8cg0vhf2.js} +1 -1
  84. package/dist/{codex-session-runner-41pfcr95.js → codex-session-runner-kh6s4j3n.js} +8 -8
  85. package/dist/{commands-9849dkj6.js → commands-68et1qv2.js} +2 -2
  86. package/dist/{controller-ja0sd95p.js → controller-fyrbnzg4.js} +4 -4
  87. package/dist/{controllers-connect-xp05dj6x.js → controllers-connect-nep9h2xv.js} +23 -23
  88. package/dist/{cursor-adapter-623qxqew.js → cursor-adapter-yss3pg7t.js} +2 -2
  89. package/dist/{db-w759qmx0.js → db-28gjyvxj.js} +4 -2
  90. package/dist/{db-47vj40dy.js → db-8ftwvzba.js} +3 -3
  91. package/dist/{devin-adapter-4ycy4vrf.js → devin-adapter-byen2cxt.js} +1 -1
  92. package/dist/{dispatcher-7b8e4z2j.js → dispatcher-hayexmkr.js} +20 -20
  93. package/dist/{docker-s84hjs91.js → docker-fdzyewpz.js} +2 -2
  94. package/dist/{dsh-adapter-2ezw3xea.js → dsh-adapter-46wawff9.js} +2 -2
  95. package/dist/{e2b-9gkdhm3c.js → e2b-222hsajc.js} +2 -2
  96. package/dist/{e2b-cjtf8k1z.js → e2b-fn3zacvt.js} +2 -2
  97. package/dist/{easter-egg-3d-e4qv8dxj.js → easter-egg-3d-8d1e0h4m.js} +1 -1
  98. package/dist/{event-bus-3z78ep5n.js → event-bus-pghg8hqy.js} +1 -1
  99. package/dist/{execute-0xpz8950.js → execute-cjrfxfnm.js} +1 -1
  100. package/dist/{external-channel-e2s028da.js → external-channel-xbmxcg09.js} +2 -2
  101. package/dist/{grok-adapter-ys7gaqee.js → grok-adapter-ag4wks2a.js} +10 -10
  102. package/dist/handlers-tzmevqb5.js +41 -0
  103. package/dist/{heartbeat-w3mntghj.js → heartbeat-psfvcgwp.js} +23 -23
  104. package/dist/{hook-g7kvv6x9.js → hook-8pz04697.js} +6 -6
  105. package/dist/{hook-3jjywnpb.js → hook-cyq4mryn.js} +8 -8
  106. package/dist/{http-tkp7d4kb.js → http-haj1nd6k.js} +921 -169
  107. package/dist/{index-q7m26kvs.js → index-jwt2bj6f.js} +265 -97
  108. package/dist/{index-3n8m9ea2.js → index-q52f47pe.js} +1 -1
  109. package/dist/{index-31ceyf42.js → index-syvhnvtw.js} +1 -1
  110. package/dist/index-y1ajx04a.js +43 -0
  111. package/dist/{index-1ef1myq2.js → index-z5h22pes.js} +20 -20
  112. package/dist/{index-xdaahthb.js → index-zyq8ct52.js} +20 -20
  113. package/dist/{keepalive-v4ta8wgg.js → keepalive-xdvsamvj.js} +4 -4
  114. package/dist/lead-hqg57kdp.js +79 -0
  115. package/dist/{maintenance-84n1ex21.js → maintenance-4y2xzh3a.js} +1 -1
  116. package/dist/{oauth-refresh-sweep-vjnnandw.js → oauth-refresh-sweep-jd4r7zbs.js} +9 -4
  117. package/dist/{onboard-sfmpe4np.js → onboard-18447q9q.js} +6 -6
  118. package/dist/{opencode-adapter-jmpst4q4.js → opencode-adapter-26b2frdf.js} +7 -7
  119. package/dist/{otel-impl-v6cc0zve.js → otel-impl-f9tgr8yw.js} +2 -2
  120. package/dist/{pi-mono-adapter-fk8fkcf6.js → pi-mono-adapter-qn6qbga1.js} +38 -17
  121. package/dist/{pricing-refresh-fsk1e1zc.js → pricing-refresh-dw2tgb53.js} +3 -3
  122. package/dist/{rbac-roles-prmkdnkw.js → rbac-roles-aygm2760.js} +2 -2
  123. package/dist/{rbac-roles-zxmxqa39.js → rbac-roles-s4nwj2m3.js} +1 -1
  124. package/dist/render-v2-yfvdfr0x.js +16 -0
  125. package/dist/{resume-frdtgfa0.js → resume-1bmvjbf3.js} +9 -9
  126. package/dist/{runtime-bt5pkpm1.js → runtime-f7tpzedy.js} +1 -1
  127. package/dist/{session-access-fpez4y5q.js → session-access-r5garej6.js} +4 -4
  128. package/dist/session-source-backfill-424wzv0r.js +110 -0
  129. package/dist/{setup-mq6m3m8q.js → setup-8tygvxkq.js} +1 -1
  130. package/dist/{virtual-modules-mnfbh5mr.js → virtual-modules-xsw323b3.js} +2 -2
  131. package/dist/{work-objects-kfahhjsq.js → work-objects-ggnghpgf.js} +23 -23
  132. package/dist/worker-sqjd1nqf.js +79 -0
  133. package/dist/{x-pbpezr0s.js → x-wxrzvzx8.js} +2 -2
  134. package/openapi.json +1324 -14
  135. package/package.json +5 -3
  136. package/src/assets/source-key.ts +95 -0
  137. package/src/be/automation-preflight.ts +2 -0
  138. package/src/be/db/api-keys.ts +89 -0
  139. package/src/be/db/session-labels.ts +28 -0
  140. package/src/be/db/session-moves.ts +5 -6
  141. package/src/be/db/session-tree.ts +153 -14
  142. package/src/be/db/tasks/read.ts +11 -0
  143. package/src/be/db/tasks/write.ts +6 -1
  144. package/src/be/db/workflow-runs.ts +219 -6
  145. package/src/be/db-retention.ts +61 -6
  146. package/src/be/db.ts +135 -132
  147. package/src/be/memory/providers/openai-embedding.ts +5 -1
  148. package/src/be/memory/task-learning.ts +155 -0
  149. package/src/be/migrations/244_api_key_validation.sql +4 -0
  150. package/src/be/migrations/245_script_executor.sql +3 -0
  151. package/src/be/oauth-refresh-sweep.ts +2 -1
  152. package/src/be/onboarding.ts +4 -0
  153. package/src/be/scripts/boot-reembed.ts +2 -0
  154. package/src/be/scripts/db.ts +14 -4
  155. package/src/be/scripts/embeddings.ts +2 -0
  156. package/src/be/scripts/run-saved.ts +1 -0
  157. package/src/be/scripts/typecheck.ts +10 -4
  158. package/src/be/seed-skills/index.ts +7 -0
  159. package/src/be/session-source-backfill.ts +163 -0
  160. package/src/be/swarm-config-guard.ts +1 -0
  161. package/src/comb/review-batch.ts +28 -1
  162. package/src/comb/templates.ts +7 -2
  163. package/src/commands/claude-managed-setup.ts +7 -1
  164. package/src/commands/credential-refresh.ts +76 -1
  165. package/src/commands/credential-wait.ts +2 -2
  166. package/src/commands/onboard/compose-generator.ts +5 -3
  167. package/src/commands/provider-credentials.ts +212 -171
  168. package/src/commands/runner.ts +25 -4
  169. package/src/extensions/apply-task-create.ts +8 -1
  170. package/src/extensions/contract-types.generated.ts +1 -1
  171. package/src/extensions/contract.ts +5 -0
  172. package/src/heartbeat/heartbeat.ts +14 -1
  173. package/src/heartbeat/script-runner-probe.ts +47 -0
  174. package/src/http/all-routes.ts +2 -0
  175. package/src/http/api-keys.ts +77 -9
  176. package/src/http/assets.ts +15 -0
  177. package/src/http/codex-oauth-accounts.ts +191 -0
  178. package/src/http/comb.ts +15 -2
  179. package/src/http/config.ts +1 -1
  180. package/src/http/core.ts +6 -0
  181. package/src/http/fleet-benchmark.ts +5 -2
  182. package/src/http/idempotency-key.ts +1 -1
  183. package/src/http/index.ts +14 -3
  184. package/src/http/integrations.ts +5 -1
  185. package/src/http/kv.ts +8 -3
  186. package/src/http/onboarding.ts +6 -1
  187. package/src/http/pages-public.ts +38 -5
  188. package/src/http/pool-keys.ts +354 -0
  189. package/src/http/scripts.ts +27 -0
  190. package/src/http/sessions.ts +37 -12
  191. package/src/http/stats.ts +1 -0
  192. package/src/http/status.ts +26 -12
  193. package/src/http/tasks.ts +3 -0
  194. package/src/http/used-by.ts +7 -2
  195. package/src/http/workflows.ts +88 -9
  196. package/src/http/x.ts +5 -0
  197. package/src/integrations/chat-sdk/inbound.ts +27 -0
  198. package/src/kv-reserved-namespaces.ts +19 -0
  199. package/src/prompts/base-prompt.ts +21 -1
  200. package/src/prompts/session-templates.ts +17 -3
  201. package/src/providers/acp-targets.ts +1 -1
  202. package/src/providers/amp-adapter.ts +1 -1
  203. package/src/providers/claude-adapter.ts +5 -1
  204. package/src/providers/claude-managed-adapter.ts +16 -9
  205. package/src/providers/codex-adapter.ts +71 -11
  206. package/src/providers/dsh-adapter.ts +1 -1
  207. package/src/providers/pi-mono-adapter.ts +41 -11
  208. package/src/scheduler/scheduler.ts +5 -3
  209. package/src/scripts-runtime/eval-harness.ts +8 -1
  210. package/src/scripts-runtime/executors/native.ts +22 -16
  211. package/src/scripts-runtime/executors/quickjs-prelude.ts +103 -1
  212. package/src/scripts-runtime/executors/quickjs-runner.ts +2 -1
  213. package/src/scripts-runtime/executors/quickjs.ts +7 -0
  214. package/src/scripts-runtime/executors/registry.ts +32 -0
  215. package/src/scripts-runtime/executors/types.ts +7 -0
  216. package/src/scripts-runtime/host-validated-args.ts +133 -0
  217. package/src/scripts-runtime/loader.ts +30 -3
  218. package/src/scripts-runtime/swarm-sdk.ts +16 -3
  219. package/src/scripts-runtime/types/stdlib.d.ts +10 -2
  220. package/src/scripts-runtime/types/swarm-extension.d.ts +17 -8
  221. package/src/scripts-runtime/types/swarm-sdk.d.ts +10 -2
  222. package/src/slack/assistant.ts +7 -0
  223. package/src/slack/channel-labels.ts +74 -0
  224. package/src/slack/handlers.ts +8 -0
  225. package/src/slack/inbound-files.ts +5 -2
  226. package/src/slack/thread-buffer.ts +4 -0
  227. package/src/tasks/sibling-awareness.ts +12 -3
  228. package/src/telemetry-context.ts +5 -6
  229. package/src/telemetry-identity.ts +3 -3
  230. package/src/tests/api-key-status-by-suffix.test.ts +242 -0
  231. package/src/tests/api-keys-validation.test.ts +170 -0
  232. package/src/tests/base-prompt.test.ts +70 -2
  233. package/src/tests/claude-managed-adapter.test.ts +46 -0
  234. package/src/tests/claude-routes-e2e.test.ts +7 -2
  235. package/src/tests/codex-credential-pools.test.ts +120 -0
  236. package/src/tests/codex-gateway-route.test.ts +165 -0
  237. package/src/tests/codex-oauth-accounts.test.ts +357 -0
  238. package/src/tests/comb-review-batch.test.ts +63 -2
  239. package/src/tests/community-linear-delivery-loop.test.ts +2099 -0
  240. package/src/tests/config-pool-keys.test.ts +533 -0
  241. package/src/tests/credential-check.test.ts +294 -4
  242. package/src/tests/credential-refresh.test.ts +172 -1
  243. package/src/tests/db-retention.test.ts +9 -3
  244. package/src/tests/db-task-read-contract.test.ts +1 -0
  245. package/src/tests/db-task-write-contract.test.ts +1 -3
  246. package/src/tests/docs-index-footprint.test.js +3 -3
  247. package/src/tests/docs-index.test.ts +135 -0
  248. package/src/tests/dsh-adapter.test.ts +1 -1
  249. package/src/tests/extensions-pre-task.test.ts +53 -1
  250. package/src/tests/fetch-resolved-env.test.ts +16 -2
  251. package/src/tests/fixtures/extensions/record-task-create/hooks.ts +9 -0
  252. package/src/tests/fixtures/extensions/record-task-create/manifest.json +7 -0
  253. package/src/tests/fleet-benchmark.test.ts +8 -0
  254. package/src/tests/get-workflow-run-tool.test.ts +98 -0
  255. package/src/tests/heartbeat-checklist.test.ts +89 -0
  256. package/src/tests/heartbeat-script-runner-probe.test.ts +83 -0
  257. package/src/tests/integrations-http.test.ts +32 -2
  258. package/src/tests/internal-ai/complete-structured.test.ts +37 -1
  259. package/src/tests/internal-ai/credentials.test.ts +23 -0
  260. package/src/tests/kv-http.test.ts +32 -0
  261. package/src/tests/kv-tool.test.ts +25 -0
  262. package/src/tests/multi-runtime-registration.test.ts +12 -12
  263. package/src/tests/oauth-refresh-sweep.test.ts +34 -1
  264. package/src/tests/onboard-compose.test.ts +20 -0
  265. package/src/tests/onboarding.test.ts +108 -1
  266. package/src/tests/openai-embedding-credentials.test.ts +35 -0
  267. package/src/tests/opencode-adapter.test.ts +2 -1
  268. package/src/tests/openrouter-attribution-call-sites.test.ts +2 -2
  269. package/src/tests/org-website.test.ts +36 -0
  270. package/src/tests/pages-frame-ancestors.test.ts +162 -0
  271. package/src/tests/pi-codemode.test.ts +2 -1
  272. package/src/tests/pi-mono-adapter.test.ts +54 -0
  273. package/src/tests/pi-native-mcp.test.ts +13 -1
  274. package/src/tests/pi-tool-exposure.test.ts +8 -8
  275. package/src/tests/probe-tool-schema-tokens.test.ts +144 -0
  276. package/src/tests/prompt-template-session.test.ts +4 -3
  277. package/src/tests/provider-key-probes.test.ts +181 -0
  278. package/src/tests/rbac-e2e-helpers.test.ts +88 -1
  279. package/src/tests/rbac-e2e-helpers.ts +36 -11
  280. package/src/tests/request-composition-derive.test.ts +329 -0
  281. package/src/tests/script-connections.test.ts +4 -0
  282. package/src/tests/script-executor-conformance.test.ts +36 -1
  283. package/src/tests/script-executor-quickjs-pool.test.ts +50 -0
  284. package/src/tests/script-executor-quickjs.test.ts +140 -0
  285. package/src/tests/script-host-validated-args-native.test.ts +196 -0
  286. package/src/tests/script-per-script-executor.test.ts +415 -0
  287. package/src/tests/script-runs-retention.test.ts +212 -0
  288. package/src/tests/scripts-external-api.test.ts +45 -0
  289. package/src/tests/sdk-allowlist.test.ts +42 -2
  290. package/src/tests/self-improvement.test.ts +4 -4
  291. package/src/tests/session-source-backfill.test.ts +429 -0
  292. package/src/tests/session-source-keys.test.ts +236 -0
  293. package/src/tests/session-source-labels.test.ts +419 -0
  294. package/src/tests/sessions-detail-batch.test.ts +2 -0
  295. package/src/tests/sessions-move.test.ts +131 -0
  296. package/src/tests/sessions-tree.test.ts +299 -2
  297. package/src/tests/slack-inbound-files.test.ts +103 -23
  298. package/src/tests/status.test.ts +101 -18
  299. package/src/tests/store-progress-learning.test.ts +288 -0
  300. package/src/tests/tasks-workflow-run-filter.test.ts +146 -0
  301. package/src/tests/test-net.ts +31 -0
  302. package/src/tests/transcription.test.ts +8 -0
  303. package/src/tests/ui-logs-parser.test.ts +180 -0
  304. package/src/tests/used-by-route.test.ts +11 -0
  305. package/src/tests/workflow-cascade-cancel.test.ts +172 -0
  306. package/src/tests/workflow-engine-v2.test.ts +116 -1
  307. package/src/tests/workflow-http-v2.test.ts +131 -0
  308. package/src/tests/workflow-mcp-trigger-schema.test.ts +209 -0
  309. package/src/tests/workflow-run-finished-event.test.ts +263 -0
  310. package/src/tests/workflow-step-order.test.ts +92 -0
  311. package/src/tests/workflow-sub-workflow.test.ts +30 -0
  312. package/src/tests/workflow-swarm-script.test.ts +34 -0
  313. package/src/tools/get-tasks.ts +8 -0
  314. package/src/tools/kv/kv-read-auth.ts +4 -2
  315. package/src/tools/script-common.ts +1 -0
  316. package/src/tools/script-run.ts +7 -0
  317. package/src/tools/script-upsert.ts +7 -0
  318. package/src/tools/store-progress.ts +67 -1
  319. package/src/tools/task-action.ts +1 -1
  320. package/src/tools/workflows/get-workflow-run.ts +14 -4
  321. package/src/tools/workflows/trigger-workflow.ts +104 -10
  322. package/src/types.ts +36 -1
  323. package/src/utils/company-profile.ts +51 -1
  324. package/src/utils/credentials.ts +10 -4
  325. package/src/utils/internal-ai/complete-structured.ts +5 -0
  326. package/src/utils/internal-ai/credentials.ts +4 -3
  327. package/src/utils/provider-key-probes.ts +328 -0
  328. package/src/utils/transcription.ts +4 -1
  329. package/src/workflows/engine.ts +18 -16
  330. package/src/workflows/executors/sub-workflow.ts +8 -1
  331. package/src/workflows/executors/swarm-script.ts +5 -0
  332. package/src/workflows/foreach-driver.ts +5 -11
  333. package/src/workflows/node-timeout.ts +30 -0
  334. package/templates/ai-toolbox.manifest.json +2 -2
  335. package/templates/community/linear-delivery-loop/PLAYBOOK.md +323 -0
  336. package/templates/community/linear-delivery-loop/README.md +38 -0
  337. package/templates/community/linear-delivery-loop/config.example.json +31 -0
  338. package/templates/community/linear-delivery-loop/lead-prompt.md +34 -0
  339. package/templates/community/linear-delivery-loop/schedule.json +10 -0
  340. package/templates/community/linear-delivery-loop/scripts/linear-delivery-setup.ts +148 -0
  341. package/templates/community/linear-delivery-loop/scripts/linear-delivery-tick.ts +1781 -0
  342. package/templates/skills/researching/content.md +2 -0
  343. package/templates/skills/swarm-docs/config.json +14 -0
  344. package/templates/skills/swarm-docs/content.md +144 -0
  345. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  346. package/templates/skills/swarm-scripts/content.md +1 -0
  347. package/dist/cli-7421jzsw.js +0 -84
  348. package/dist/cli-e45e4m6b.js +0 -413
  349. package/dist/cli-zw88zjba.js +0 -307
  350. package/dist/handlers-wy1dr6ja.js +0 -41
  351. package/dist/index-nmm79qgr.js +0 -43
  352. package/dist/lead-sawnyqxk.js +0 -79
  353. package/dist/render-v2-pjwxvnkw.js +0 -12
  354. package/dist/worker-v5e5rxj3.js +0 -79
@@ -17,6 +17,8 @@ import {
17
17
  agentContextKey,
18
18
  pageContextKey,
19
19
  init_context_key,
20
+ sessionSourceKey,
21
+ init_source_key,
20
22
  checkSlackRoutingCoherence,
21
23
  init_slack_routing,
22
24
  beginRequestAuthScope,
@@ -111,6 +113,13 @@ import {
111
113
  cancelTask2,
112
114
  getRecentlyCancelledTasksForAgent2,
113
115
  updateTaskProgress2,
116
+ IdempotencyKeyTakenError,
117
+ workflowRequestFingerprint,
118
+ findAcceptedWorkflowOperation,
119
+ recordAcceptedWorkflowOperation,
120
+ init_workflow_idempotency,
121
+ getWorkflowRunSummary,
122
+ getWorkflowRunStepsSlimByRunId,
114
123
  getRunLineageBlock,
115
124
  getWorkflowRunStatus,
116
125
  disarmWorkflowTreeRetries,
@@ -339,19 +348,19 @@ import {
339
348
  recordInlineScriptRun2,
340
349
  exports_db,
341
350
  init_db3
342
- } from "./cli-jb30dzvk.js";
351
+ } from "./cli-48gxjmcz.js";
343
352
  import {
344
353
  getUserGrant2,
345
354
  init_rbac_roles
346
- } from "./cli-ff1tm9n9.js";
355
+ } from "./cli-8wmj18cz.js";
347
356
  import {
348
357
  ensurePricingSeeded2,
349
358
  ensureRbacSeeded2,
350
359
  ensureModelProfilesSeeded2
351
- } from "./cli-c61mbdds.js";
360
+ } from "./cli-rd5m70gj.js";
352
361
  import {
353
362
  loadModelsDevCache
354
- } from "./cli-sbwsxvtd.js";
363
+ } from "./cli-d20qvpr2.js";
355
364
  import {
356
365
  buildCatalogEntries,
357
366
  listModelCatalog,
@@ -361,16 +370,16 @@ import {
361
370
  loadModelsCatalog,
362
371
  requestModelCatalogRefresh2,
363
372
  startPricingRefreshLoop2
364
- } from "./cli-bvpgr9ny.js";
373
+ } from "./cli-60sty27p.js";
365
374
  import {
366
375
  ampPinProviderError,
367
376
  ampPinCatalogError,
368
377
  ampModelError
369
- } from "./cli-9s05422w.js";
378
+ } from "./cli-8mbc9za9.js";
370
379
  import {
371
380
  workflowEventBus2,
372
381
  init_event_bus
373
- } from "./cli-dabehxhp.js";
382
+ } from "./cli-kt907da6.js";
374
383
  import {
375
384
  notifyAutomationPreflightFailure,
376
385
  isNeedsSetupFailure,
@@ -435,7 +444,7 @@ import {
435
444
  definitionNodeIds,
436
445
  validateDefinition,
437
446
  applyDefinitionPatch
438
- } from "./cli-gbfxp48k.js";
447
+ } from "./cli-j0ppywdr.js";
439
448
  import {
440
449
  require_dist2,
441
450
  publicEndpointSsrfOptions,
@@ -495,14 +504,14 @@ import {
495
504
  deleteApp,
496
505
  typecheckScript,
497
506
  parseSkillContent
498
- } from "./cli-7p4jxgtt.js";
507
+ } from "./cli-j9bpmykh.js";
499
508
  import {
500
509
  buildAuthorizationUrl,
501
510
  onAuthorizationRefreshed,
502
511
  ensureAuthorizationTokenOrThrow,
503
512
  ensureToken,
504
513
  ensureTokenOrThrow
505
- } from "./cli-tsma7p8v.js";
514
+ } from "./cli-aypd09nf.js";
506
515
  import {
507
516
  detachedProcessGroup,
508
517
  registerProcessGroup,
@@ -536,14 +545,14 @@ import {
536
545
  getSlackApp2,
537
546
  startSlackApp2,
538
547
  stopSlackApp2
539
- } from "./cli-abs8ndtr.js";
548
+ } from "./cli-m30k9777.js";
540
549
  import {
541
550
  slackCode,
542
551
  slackMissingScopeMessage,
543
552
  withAutoJoin,
544
553
  externalChannelToolError2,
545
554
  getChannelBlockReason2
546
- } from "./cli-eftzyh9y.js";
555
+ } from "./cli-s09j9vp5.js";
547
556
  import {
548
557
  shapeApprovalResolution,
549
558
  SubWorkflowExecutor,
@@ -562,7 +571,7 @@ import {
562
571
  recoverResolvedWaitState2,
563
572
  resumeFromChildRun2,
564
573
  initWaitBusSubscriptions2
565
- } from "./cli-x0f2v69c.js";
574
+ } from "./cli-twctnkng.js";
566
575
  import {
567
576
  duplicateGuardedQueryKey,
568
577
  parseQueryParams,
@@ -589,7 +598,7 @@ import {
589
598
  isPublicRoute,
590
599
  findRoute,
591
600
  route
592
- } from "./cli-gwhjmh8g.js";
601
+ } from "./cli-wqr7cea4.js";
593
602
  import {
594
603
  FilesError,
595
604
  providerPath,
@@ -600,7 +609,7 @@ import {
600
609
  import {
601
610
  getRuntimePool2,
602
611
  init_db
603
- } from "./cli-19202kew.js";
612
+ } from "./cli-6srv653c.js";
604
613
  import {
605
614
  getMemoryRaterNames,
606
615
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -611,7 +620,7 @@ import {
611
620
  COMPOSIO_HTTP_METHODS,
612
621
  executeComposioRequest,
613
622
  composioArgsFromParts
614
- } from "./cli-pasyvjmm.js";
623
+ } from "./cli-737pyqxr.js";
615
624
  import {
616
625
  require_fast_deep_equal
617
626
  } from "./cli-bhp11egn.js";
@@ -625,7 +634,7 @@ import {
625
634
  import {
626
635
  canProvisionKind,
627
636
  init_runtime_providers
628
- } from "./cli-dew6x255.js";
637
+ } from "./cli-39aet655.js";
629
638
  import {
630
639
  findUserById,
631
640
  findUserByExternalId,
@@ -640,7 +649,7 @@ import {
640
649
  resolveSessionToken,
641
650
  fingerprintApiKey,
642
651
  init_users
643
- } from "./cli-6a1xg1p7.js";
652
+ } from "./cli-a89zdqz9.js";
644
653
  import {
645
654
  isRbacEnabled,
646
655
  decideAdmission,
@@ -652,6 +661,7 @@ import {
652
661
  } from "./cli-4rvr7zfx.js";
653
662
  import {
654
663
  normalizeAssetKey,
664
+ sessionGroupKey,
655
665
  parseAssetKey,
656
666
  canWriteAssetKey,
657
667
  init_key,
@@ -709,7 +719,7 @@ import {
709
719
  KvNamespaceSchema,
710
720
  KvKeySchema,
711
721
  init_types
712
- } from "./cli-mz9afxxf.js";
722
+ } from "./cli-9pshx6rd.js";
713
723
  import {
714
724
  generateDefaultClaudeMd2,
715
725
  generateDefaultSoulMd2,
@@ -717,16 +727,22 @@ import {
717
727
  init_defaults,
718
728
  taskAttachmentFetchCommand,
719
729
  taskAttachmentDisplayUrl,
720
- init_task_attachment_links
721
- } from "./cli-e42vss7b.js";
730
+ init_task_attachment_links,
731
+ contentSha256,
732
+ init_profile_sync
733
+ } from "./cli-x37r7qwf.js";
734
+ import {
735
+ isSteeringEnabled2,
736
+ init_steering_enabled
737
+ } from "./cli-4sydckyj.js";
722
738
  import {
723
739
  getSlackConfiguration,
724
740
  init_config
725
741
  } from "./cli-qeaq3j6t.js";
726
742
  import {
727
- isSteeringEnabled2,
728
- init_steering_enabled
729
- } from "./cli-4sydckyj.js";
743
+ selectCredential,
744
+ init_credentials
745
+ } from "./cli-gt4h8cxw.js";
730
746
  import {
731
747
  findInterpolationTokens,
732
748
  interpolate,
@@ -736,7 +752,7 @@ import {
736
752
  init_registry,
737
753
  resolveTemplate,
738
754
  init_resolver
739
- } from "./cli-dqygeeh5.js";
755
+ } from "./cli-f1e0ptjj.js";
740
756
  import {
741
757
  init_zod
742
758
  } from "./cli-4chz1hye.js";
@@ -778,7 +794,7 @@ import {
778
794
  import {
779
795
  init_package,
780
796
  package_default
781
- } from "./cli-xtrz6bzs.js";
797
+ } from "./cli-ptfq202x.js";
782
798
  import {
783
799
  realtimeBus,
784
800
  init_bus
@@ -812,7 +828,7 @@ import {
812
828
  registerVolatileSecret,
813
829
  registerSensitiveKeyName,
814
830
  init_secret_scrubber
815
- } from "./cli-n4c8e3s5.js";
831
+ } from "./cli-708wdy32.js";
816
832
  import {
817
833
  isAlias,
818
834
  parseAlias,
@@ -826,7 +842,7 @@ import {
826
842
  openAICompatibleProviderIds,
827
843
  claudeCatalogModelId,
828
844
  init_src2
829
- } from "./cli-nwyw3zhg.js";
845
+ } from "./cli-gxee0bqa.js";
830
846
  import {
831
847
  __toESM,
832
848
  __commonJS,
@@ -20528,7 +20544,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
20528
20544
  if (!waiting)
20529
20545
  continue;
20530
20546
  if (result.waitFor === "workflow.child.finished") {
20531
- const { resumeFromChildRun } = await import("./resume-frdtgfa0.js");
20547
+ const { resumeFromChildRun } = await import("./resume-1bmvjbf3.js");
20532
20548
  await resumeFromChildRun(step.id, registry);
20533
20549
  }
20534
20550
  } else {
@@ -21211,7 +21227,7 @@ class NotifyExecutor extends BaseExecutor {
21211
21227
  }
21212
21228
  }
21213
21229
  case "slack": {
21214
- const { getSlackApp } = await import("./app-ctn8gsgx.js");
21230
+ const { getSlackApp } = await import("./app-mwx1d5a9.js");
21215
21231
  const app = getSlackApp();
21216
21232
  if (!app) {
21217
21233
  return {
@@ -21634,6 +21650,7 @@ class SwarmScriptExecutor extends BaseExecutor {
21634
21650
  source: resolved.source,
21635
21651
  args: config.args,
21636
21652
  fsMode: "none",
21653
+ executor: resolved.script.executor,
21637
21654
  agentId: agentId ?? "workflow",
21638
21655
  mcpBaseUrl: getMcpBaseUrl(),
21639
21656
  egressSecrets: credentials.egressSecrets,
@@ -21642,7 +21659,8 @@ class SwarmScriptExecutor extends BaseExecutor {
21642
21659
  agentFs: credentials.agentFs,
21643
21660
  apiConnections: getScriptApiConnectionDescriptors({ agentId: agentId ?? undefined }),
21644
21661
  mcpConnections: getScriptMcpConnectionDescriptors({ agentId: agentId ?? undefined }),
21645
- timeoutMs: config.timeoutMs
21662
+ timeoutMs: config.timeoutMs,
21663
+ signal: meta.signal
21646
21664
  });
21647
21665
  if (output.exitCode === 0 && !output.error && !output.runtimeError) {
21648
21666
  await touchScratchScriptLastUsed(resolved.script.id);
@@ -22324,6 +22342,7 @@ async function executeScheduleScript(schedule) {
22324
22342
  source: script.source,
22325
22343
  args,
22326
22344
  fsMode: "none",
22345
+ executor: script.executor,
22327
22346
  agentId,
22328
22347
  egressSecrets: credentials.egressSecrets,
22329
22348
  userConfig: credentials.userConfig,
@@ -24595,7 +24614,7 @@ function setPreloadedTools(server, names) {
24595
24614
  async function applyPreToolCall(name, args, requestInfo, inputSchema) {
24596
24615
  if (requestInfo.callOrigin !== "mcp")
24597
24616
  return { args };
24598
- const dispatcher = await import("./dispatcher-7b8e4z2j.js");
24617
+ const dispatcher = await import("./dispatcher-hayexmkr.js");
24599
24618
  const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
24600
24619
  validateModify: async (data) => {
24601
24620
  const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
@@ -25207,7 +25226,13 @@ function bridgeRequestFor(name, args) {
25207
25226
  const id = typeof body.id === "string" ? body.id : undefined;
25208
25227
  if (!id)
25209
25228
  throw new Error("workflow_getRun requires string `id`");
25210
- return { method: "GET", path: `/api/workflow-runs/${encodeURIComponent(id)}` };
25229
+ if (body.fields !== undefined && body.fields !== "full" && body.fields !== "slim") {
25230
+ throw new Error('workflow_getRun `fields` must be "full" or "slim"');
25231
+ }
25232
+ return {
25233
+ method: "GET",
25234
+ path: appendQuery(`/api/workflow-runs/${encodeURIComponent(id)}`, { fields: body.fields })
25235
+ };
25211
25236
  }
25212
25237
  case "workflow_delete": {
25213
25238
  const id = typeof body.id === "string" ? body.id : undefined;
@@ -25248,10 +25273,12 @@ function bridgeRequestFor(name, args) {
25248
25273
  const id = typeof body.id === "string" ? body.id : undefined;
25249
25274
  if (!id)
25250
25275
  throw new Error("workflow_trigger requires string `id`");
25276
+ const path = `/api/workflows/${encodeURIComponent(id)}/trigger`;
25251
25277
  return {
25252
25278
  method: "POST",
25253
- path: `/api/workflows/${encodeURIComponent(id)}/trigger`,
25254
- body: body.triggerData ?? {}
25279
+ path: body.wait === false ? `${path}?wait=false` : path,
25280
+ body: body.triggerData ?? {},
25281
+ ...typeof body.idempotencyKey === "string" ? { headers: { "Idempotency-Key": body.idempotencyKey } } : {}
25255
25282
  };
25256
25283
  }
25257
25284
  case "workflow_retryRun": {
@@ -25364,7 +25391,7 @@ async function callBridgeApi(name, args, config, options = {}) {
25364
25391
  }
25365
25392
  const res = await fetch(`${baseUrl}${request.path}`, {
25366
25393
  method: request.method,
25367
- headers: headers(config),
25394
+ headers: { ...headers(config), ...request.headers },
25368
25395
  body: request.body === undefined ? undefined : JSON.stringify(request.body)
25369
25396
  });
25370
25397
  const data = await readScriptSdkJsonResponse(res, `ctx.swarm.${name}`);
@@ -26750,7 +26777,8 @@ async function applyPreTaskCreate(args) {
26750
26777
  description: args.description,
26751
26778
  options: args.options,
26752
26779
  origin,
26753
- requestInfo: args.requestInfo
26780
+ requestInfo: args.requestInfo,
26781
+ ...args.slack ? { slack: args.slack } : {}
26754
26782
  }, {
26755
26783
  skipExtensionId: creatingExtensionId,
26756
26784
  transformModify: ({ data, currentPayload, extension }) => {
@@ -26956,7 +26984,8 @@ async function prepareTaskWithSiblingAwareness(description, options, args = {})
26956
26984
  description,
26957
26985
  options,
26958
26986
  origin: args.origin ?? "rest",
26959
- allowCustomModel: args.allowCustomModel
26987
+ allowCustomModel: args.allowCustomModel,
26988
+ slack: args.slack
26960
26989
  });
26961
26990
  if (preCreate.kind === "blocked") {
26962
26991
  throw new TaskCreationBlockedError(preCreate.reason, preCreate.extension);
@@ -32322,8 +32351,31 @@ function resetDiscordGatewayHealth() {
32322
32351
 
32323
32352
  // src/integrations/chat-sdk/inbound.ts
32324
32353
  init_zod();
32354
+ init_key();
32355
+ init_source_key();
32325
32356
  init_db3();
32326
32357
 
32358
+ // src/be/db/session-labels.ts
32359
+ init_db3();
32360
+ var NAMESPACE = "session-labels";
32361
+ async function getSessionLabels(keys) {
32362
+ if (keys.length === 0)
32363
+ return {};
32364
+ const rows = await getDbClient2().query(`SELECT key, value FROM kv_entries
32365
+ WHERE namespace = ? AND key IN (${keys.map(() => "?").join(", ")})
32366
+ AND (expires_at IS NULL OR expires_at > ?)`, [NAMESPACE, ...keys, Date.now()]);
32367
+ return Object.fromEntries(rows.map((row) => [row.key, row.value]));
32368
+ }
32369
+ async function rememberSessionLabel(key, label, ttlMs) {
32370
+ await upsertKv2({
32371
+ namespace: NAMESPACE,
32372
+ key,
32373
+ value: label,
32374
+ valueType: "string",
32375
+ expiresAt: ttlMs === undefined ? null : Date.now() + ttlMs
32376
+ });
32377
+ }
32378
+
32327
32379
  // src/be/unmapped-identities.ts
32328
32380
  init_db3();
32329
32381
  var TTL_MS = 30 * 24 * 60 * 60 * 1000;
@@ -32427,6 +32479,7 @@ function backingProviderId(attachment) {
32427
32479
  }
32428
32480
 
32429
32481
  // src/utils/transcription.ts
32482
+ init_credentials();
32430
32483
  init_secret_scrubber();
32431
32484
  var TRANSCRIPTION_TIMEOUT_MS = 60000;
32432
32485
  var TRANSCRIPTION_API_KEY_ENV = "TRANSCRIPTION_API_KEY";
@@ -32489,7 +32542,8 @@ function resolveTranscriptionConfig() {
32489
32542
  const candidates = pinned ? AUTO_DETECT_ORDER.filter((name) => name === pinned) : AUTO_DETECT_ORDER;
32490
32543
  for (const name of candidates) {
32491
32544
  const { keyEnv } = PROVIDERS[name];
32492
- const apiKey = envValue(keyEnv);
32545
+ const value = envValue(keyEnv);
32546
+ const apiKey = value ? selectCredential(value, undefined, keyEnv).selected : undefined;
32493
32547
  if (apiKey)
32494
32548
  return { provider: name, apiKey, keyEnv, source: "auto" };
32495
32549
  }
@@ -33571,6 +33625,16 @@ async function targetFromExtension(target) {
33571
33625
  }
33572
33626
  }
33573
33627
  }
33628
+ function chatSourceLabel(adapter, item) {
33629
+ if (adapter !== "telegram" && adapter !== "discord")
33630
+ return;
33631
+ const { facts } = item;
33632
+ if (facts.chatType === "dm" || item.isDirectMessage)
33633
+ return facts.from ? `DM · ${facts.from}` : undefined;
33634
+ if (adapter === "telegram" && (facts.chatType === "group" || facts.chatType === "supergroup"))
33635
+ return facts.title || undefined;
33636
+ return;
33637
+ }
33574
33638
  async function flushChatThread(threadId, items, immediate) {
33575
33639
  let __stack = [];
33576
33640
  try {
@@ -33688,6 +33752,7 @@ ${combined}` : combined;
33688
33752
  const latestActive = await getLatestActiveTaskByContextKey2(contextKey, "chat");
33689
33753
  const dependsOn = !immediate && latestActive ? [latestActive.id] : undefined;
33690
33754
  let created = 0;
33755
+ let sourceKey = null;
33691
33756
  for (const match of target.matches) {
33692
33757
  const options = {
33693
33758
  agentId: match.agent?.id ?? null,
@@ -33708,6 +33773,7 @@ ${combined}` : combined;
33708
33773
  };
33709
33774
  try {
33710
33775
  const { task, unattached } = await createChatTaskWithFiles(description, options, inbound);
33776
+ sourceKey ??= sessionSourceKey(task);
33711
33777
  created++;
33712
33778
  console.log(`[chat-sdk] ${threadId}: task ${task.id} for ${match.agent ? `agent ${match.agent.id}` : "no agent (queued)"} (${match.matchedText}, dependsOn: ${dependsOn?.join(", ") ?? "none"}${unattached.length ? `, ${unattached.length} file(s) not attached` : ""})`);
33713
33779
  } catch (error) {
@@ -33718,6 +33784,12 @@ ${combined}` : combined;
33718
33784
  }
33719
33785
  }
33720
33786
  }
33787
+ const label = chatSourceLabel(adapter, requester);
33788
+ if (sourceKey && label) {
33789
+ await rememberSessionLabel(sessionGroupKey(sourceKey), label).catch(() => {
33790
+ console.warn("[chat-sdk] Could not save a session source label");
33791
+ });
33792
+ }
33721
33793
  if (created > 0) {
33722
33794
  await rememberChatThreadRequester(threadId, requester.userId);
33723
33795
  await subscribe(thread);
@@ -35026,7 +35098,7 @@ async function notifySlack(text) {
35026
35098
  return;
35027
35099
  }
35028
35100
  try {
35029
- const { getSlackApp } = await import("./app-ctn8gsgx.js");
35101
+ const { getSlackApp } = await import("./app-mwx1d5a9.js");
35030
35102
  const app = getSlackApp();
35031
35103
  if (!app) {
35032
35104
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -35097,7 +35169,7 @@ async function deleteJiraWebhook(webhookId) {
35097
35169
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
35098
35170
  }
35099
35171
  async function overwriteWebhookIds(next) {
35100
- const { getDbClient } = await import("./db-w759qmx0.js");
35172
+ const { getDbClient } = await import("./db-28gjyvxj.js");
35101
35173
  await getDbClient().transaction(async (tx) => {
35102
35174
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
35103
35175
  if (!row) {
@@ -108450,6 +108522,10 @@ var SCALAR_HTML = `<!DOCTYPE html>
108450
108522
 
108451
108523
  // src/http/core.ts
108452
108524
  var injectedEnvOriginals = new Map;
108525
+ function getDeploymentEnvValue(key) {
108526
+ const tracked = injectedEnvOriginals.get(key);
108527
+ return tracked && process.env[key] === tracked.injected ? tracked.original : process.env[key];
108528
+ }
108453
108529
  async function loadGlobalConfigsIntoEnv(override = false) {
108454
108530
  const globalConfigs = await getInjectableGlobalConfigs2();
108455
108531
  const updated = [];
@@ -108492,7 +108568,7 @@ async function reloadGlobalConfigsAndIntegrations() {
108492
108568
  return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
108493
108569
  }
108494
108570
  async function reloadGlobalConfigsAndIntegrationsInner() {
108495
- const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-3n8m9ea2.js");
108571
+ const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-q52f47pe.js");
108496
108572
  const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
108497
108573
  const updated = await loadGlobalConfigsIntoEnv(true);
108498
108574
  await syncTelemetryEnabled("settings").catch((err) => {
@@ -108508,10 +108584,10 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
108508
108584
  integrations.push("embeddings");
108509
108585
  }
108510
108586
  if (!wasEmbeddingsConfigured && isEmbeddingsConfigured) {
108511
- import("./boot-reembed-w75maga2.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
108587
+ import("./boot-reembed-5h37a2c2.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
108512
108588
  console.error("[config-reload] memory backfill failed (non-fatal):", err);
108513
108589
  });
108514
- import("./boot-reembed-dwzfttdr.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
108590
+ import("./boot-reembed-7h78vmvv.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
108515
108591
  console.error("[config-reload] script backfill failed (non-fatal):", err);
108516
108592
  });
108517
108593
  }
@@ -117619,6 +117695,7 @@ var SCRIPT_TRANSPORT_ERROR = "script_* tools require HTTP MCP transport — agen
117619
117695
  var scriptNameSchema = string2().min(1).max(200);
117620
117696
  var scriptScopeSchema = _enum2(["agent", "global"]);
117621
117697
  var scriptFsModeSchema = _enum2(["none", "workspace-rw"]);
117698
+ var scriptExecutorSchema = _enum2(["native", "quickjs"]);
117622
117699
  var scriptToolOutputSchema = swarmToolOutputSchema({
117623
117700
  status: number2().optional(),
117624
117701
  data: unknown().optional()
@@ -118184,6 +118261,7 @@ var getTasksInputSchema = object2({
118184
118261
  tags: array2(string2()).optional().describe("Filter by any matching tag."),
118185
118262
  search: string2().optional().describe("Search in task description."),
118186
118263
  scheduleId: string2().uuid().optional().describe("Filter by schedule ID to find tasks created by a specific schedule."),
118264
+ workflowRunId: string2().uuid().optional().describe("Filter by workflow run ID to find the tasks of a single run."),
118187
118265
  key: AssetKeySchema.optional().describe("Filter by exact logical namespace."),
118188
118266
  keyPrefix: AssetKeySchema.optional().describe("Filter by namespace subtree."),
118189
118267
  includeHeartbeat: boolean().optional().describe("Include heartbeat/system tasks in results (excluded by default)."),
@@ -118228,6 +118306,7 @@ async function getTasksHandler(ctx, {
118228
118306
  tags,
118229
118307
  search,
118230
118308
  scheduleId,
118309
+ workflowRunId,
118231
118310
  key,
118232
118311
  keyPrefix,
118233
118312
  includeHeartbeat,
@@ -118245,6 +118324,7 @@ async function getTasksHandler(ctx, {
118245
118324
  tags,
118246
118325
  search,
118247
118326
  scheduleId,
118327
+ workflowRunId,
118248
118328
  key,
118249
118329
  keyPrefix,
118250
118330
  includeHeartbeat,
@@ -118287,6 +118367,8 @@ async function getTasksHandler(ctx, {
118287
118367
  filters.push(`search='${search}'`);
118288
118368
  if (scheduleId)
118289
118369
  filters.push(`scheduleId='${scheduleId}'`);
118370
+ if (workflowRunId)
118371
+ filters.push(`workflowRunId='${workflowRunId}'`);
118290
118372
  if (key)
118291
118373
  filters.push(`key='${key}'`);
118292
118374
  if (keyPrefix)
@@ -118503,11 +118585,19 @@ var RESERVED_FAMILIES = new Map([
118503
118585
  ["comb", "namespace is reserved for Comb; use POST /api/comb/review-batches"],
118504
118586
  ["heartbeat-checklist", "namespace is reserved for heartbeat checklist receipts"],
118505
118587
  ["worker", "namespace is reserved for worker nudges"],
118506
- ["slack-external-alert", "namespace is reserved for Slack external channel alerts"]
118588
+ ["slack-external-alert", "namespace is reserved for Slack external channel alerts"],
118589
+ [
118590
+ "session-labels",
118591
+ "namespace is reserved for session source labels; GET /api/session-tree returns them"
118592
+ ]
118507
118593
  ]);
118594
+ var PRIVATE_FAMILIES = new Set(["session-labels"]);
118508
118595
  function reservedNamespaceError(namespace) {
118509
118596
  return RESERVED_FAMILIES.get(namespace.split(":", 1)[0] ?? "") ?? null;
118510
118597
  }
118598
+ function privateNamespaceError(namespace) {
118599
+ return PRIVATE_FAMILIES.has(namespace.split(":", 1)[0] ?? "") ? reservedNamespaceError(namespace) : null;
118600
+ }
118511
118601
  function reservedRoomKeyError(key) {
118512
118602
  return key.startsWith("_room/") ? "room snapshot keys are reserved; use the room endpoints" : null;
118513
118603
  }
@@ -118612,7 +118702,7 @@ init_types();
118612
118702
 
118613
118703
  // src/tools/kv/kv-read-auth.ts
118614
118704
  function kvReadAuthError(namespace, info) {
118615
- return mcpOverflowAuthError(namespace, info.agentId);
118705
+ return privateNamespaceError(namespace) ?? mcpOverflowAuthError(namespace, info.agentId);
118616
118706
  }
118617
118707
 
118618
118708
  // src/tools/kv/kv-get.ts
@@ -131020,6 +131110,7 @@ var registerScriptRunTool = (server) => {
131020
131110
  intent: string2().default("").describe("Why this script is being run."),
131021
131111
  scope: scriptScopeSchema.optional().describe("Optional scope for named script resolution."),
131022
131112
  fsMode: scriptFsModeSchema.default("none").describe("Filesystem mode. v1 supports none only."),
131113
+ executor: scriptExecutorSchema.nullable().optional().describe('Optional executor override ("native" or "quickjs"). When omitted, named scripts use their saved executor or SCRIPT_EXECUTOR.'),
131023
131114
  idempotencyKey: string2().max(200).optional().describe("When set, output is auto-persisted to kv under script:executions/{key}. Re-running with the same key overwrites. Queryable via kv-get.")
131024
131115
  }),
131025
131116
  outputSchema: scriptToolOutputSchema
@@ -131225,7 +131316,8 @@ var registerScriptUpsertTool = (server) => {
131225
131316
  description: string2().default("").describe("Human-readable script description."),
131226
131317
  intent: string2().default("").describe("Why this script exists."),
131227
131318
  scope: scriptScopeSchema.default("agent").describe("Persist under agent or global scope."),
131228
- fsMode: scriptFsModeSchema.default("none").describe("Filesystem mode. v1 supports none only.")
131319
+ fsMode: scriptFsModeSchema.default("none").describe("Filesystem mode. v1 supports none only."),
131320
+ executor: scriptExecutorSchema.nullable().optional().describe('Optional per-script executor override ("native" or "quickjs"). Null or omitted inherits SCRIPT_EXECUTOR.')
131229
131321
  }),
131230
131322
  outputSchema: scriptToolOutputSchema
131231
131323
  }, async (args, requestInfo) => proxyScriptsApi({
@@ -133149,13 +133241,14 @@ async function downloadSlackFile(file, token, path) {
133149
133241
  return `download failed (${errorText2(error)})`;
133150
133242
  }
133151
133243
  }
133152
- async function createSlackTaskWithFiles(description, options, inbound) {
133244
+ async function createSlackTaskWithFiles(description, options, inbound, slack) {
133153
133245
  noteSlackInboundSideEffect("task_created");
133246
+ const context = { origin: "slack", slack };
133154
133247
  if (inbound.fetched.length === 0) {
133155
- const task = await createTaskWithSiblingAwareness(description, options, { origin: "slack" });
133248
+ const task = await createTaskWithSiblingAwareness(description, options, context);
133156
133249
  return { task, unattached: inbound.failed };
133157
133250
  }
133158
- const task = await createTaskWithSiblingAwareness(description, { ...options, status: "draft" }, { origin: "slack" });
133251
+ const task = await createTaskWithSiblingAwareness(description, { ...options, status: "draft" }, context);
133159
133252
  const unattached = [...inbound.failed];
133160
133253
  const lease = setInterval(() => {
133161
133254
  refreshDraftTaskLease2(task.id).catch((error) => console.warn(`[Slack] could not renew the draft lease of task ${task.id}: ${errorText2(error)}`));
@@ -134476,6 +134569,94 @@ var registerSteerTaskTool = (server) => {
134476
134569
  // src/tools/store-progress.ts
134477
134570
  init_zod();
134478
134571
  init_db3();
134572
+
134573
+ // src/be/memory/task-learning.ts
134574
+ init_db3();
134575
+ init_profile_sync();
134576
+ init_secret_scrubber();
134577
+ var LEARNING_MAX_CHARS = 2000;
134578
+ var LEARNING_MAX_TAGS = 5;
134579
+ var LEARNINGS_ROOT = "/learnings";
134580
+ var SEGMENT_MAX_CHARS = 60;
134581
+ var KEY_ATTEMPTS = 4;
134582
+ function toKebab(value, maxChars = SEGMENT_MAX_CHARS) {
134583
+ return value.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+/, "").slice(0, maxChars).replace(/-+$/, "");
134584
+ }
134585
+ function resolveLearningWorkstream(explicit, vcsRepo) {
134586
+ const fromExplicit = explicit ? toKebab(explicit) : "";
134587
+ if (fromExplicit)
134588
+ return fromExplicit;
134589
+ const repoName = vcsRepo?.trim().replace(/\/+$/, "").split("/").pop()?.replace(/\.git$/, "");
134590
+ const fromRepo = repoName ? toKebab(repoName) : "";
134591
+ return fromRepo || "general";
134592
+ }
134593
+ async function storeTaskLearning(params) {
134594
+ const { agentId, isLead, task } = params;
134595
+ const input = typeof params.learning === "string" ? { text: params.learning } : params.learning;
134596
+ const text = scrubSecrets(input.text).trim();
134597
+ if (!text)
134598
+ return { status: "failed", error: "learning text is empty" };
134599
+ if (text.length > LEARNING_MAX_CHARS) {
134600
+ return {
134601
+ status: "failed",
134602
+ error: `learning text is over ~500 tokens (${LEARNING_MAX_CHARS} characters); shorten it`
134603
+ };
134604
+ }
134605
+ const tags = [
134606
+ ...new Set((input.tags ?? []).map((tag) => toKebab(scrubSecrets(tag))).filter(Boolean))
134607
+ ].filter((tag) => tag !== "learning");
134608
+ if (tags.length > LEARNING_MAX_TAGS) {
134609
+ return { status: "failed", error: `learning takes at most ${LEARNING_MAX_TAGS} tags` };
134610
+ }
134611
+ const workstream = resolveLearningWorkstream(input.workstream === undefined ? undefined : scrubSecrets(input.workstream), task.vcsRepo === undefined ? undefined : scrubSecrets(task.vcsRepo));
134612
+ try {
134613
+ return await getDbClient2().transaction(() => insertLearning({ agentId, isLead, taskId: task.id, text, tags, workstream }));
134614
+ } catch (err) {
134615
+ return {
134616
+ status: "failed",
134617
+ error: scrubSecrets(err instanceof Error ? err.message : String(err))
134618
+ };
134619
+ }
134620
+ }
134621
+ async function insertLearning(params) {
134622
+ const { agentId, isLead, taskId, text, tags, workstream } = params;
134623
+ const contentHash = contentSha256(text);
134624
+ const replay = await getDbClient2().get(`SELECT id, key FROM agent_memory
134625
+ WHERE sourceTaskId = ? AND contentHash = ? AND key LIKE '${LEARNINGS_ROOT}/%'
134626
+ LIMIT 1`, [taskId, contentHash]);
134627
+ if (replay)
134628
+ return { status: "replayed", memoryId: replay.id, key: replay.key };
134629
+ const title = text.split(/\r?\n/, 1)[0].trim().slice(0, 200);
134630
+ const baseKey = `${LEARNINGS_ROOT}/${workstream}/${toKebab(title) || "learning"}`;
134631
+ for (let attempt = 0;attempt < KEY_ATTEMPTS; attempt++) {
134632
+ const key = attempt === 0 ? baseKey : `${baseKey}-${crypto.randomUUID().slice(0, 6)}`;
134633
+ const taken = await getDbClient2().get("SELECT id FROM agent_memory WHERE scope = 'swarm' AND key = ? LIMIT 1", [key]);
134634
+ if (taken)
134635
+ continue;
134636
+ try {
134637
+ const result = await indexMemoryContent({
134638
+ agentId,
134639
+ content: text,
134640
+ name: title,
134641
+ scope: "swarm",
134642
+ source: "manual",
134643
+ sourceTaskId: taskId,
134644
+ tags: ["learning", ...tags],
134645
+ intent: "store-progress learning",
134646
+ key,
134647
+ writer: { principal: { kind: "agent", agentId, isLead }, source: "mcp" }
134648
+ });
134649
+ return { status: "stored", memoryId: result.memoryIds[0], key, workstream };
134650
+ } catch (err) {
134651
+ if (/UNIQUE constraint failed/i.test(err.message))
134652
+ continue;
134653
+ throw err;
134654
+ }
134655
+ }
134656
+ return { status: "failed", error: `no free key under ${baseKey}` };
134657
+ }
134658
+
134659
+ // src/tools/store-progress.ts
134479
134660
  init_rbac();
134480
134661
  init_types();
134481
134662
  init_secret_scrubber();
@@ -134504,8 +134685,22 @@ var storeProgressOutputSchema = swarmToolOutputSchema({
134504
134685
  yourAgentId: string2().optional(),
134505
134686
  wasNoOp: boolean().optional().describe("True when the call was a no-op because the task was already in a terminal state (completed/failed/cancelled). First-call-wins."),
134506
134687
  wasForcedOverwrite: boolean().optional().describe("True when force: true replaced output and/or failureReason on an already-terminal task without replaying completion side effects."),
134507
- blockedWaitingElapsedMs: number2().optional().describe("Present only when this progress text reads as blocked-waiting: milliseconds since the task's prior update. Drives the store-progress nudge toward defer-task.")
134508
- });
134688
+ blockedWaitingElapsedMs: number2().optional().describe("Present only when this progress text reads as blocked-waiting: milliseconds since the task's prior update. Drives the store-progress nudge toward defer-task."),
134689
+ learning: looseObject({
134690
+ status: string2().optional(),
134691
+ key: string2().optional(),
134692
+ memoryId: string2().optional(),
134693
+ workstream: string2().optional(),
134694
+ error: string2().optional()
134695
+ }).optional().describe("Present when the call carried a learning: stored, replayed (same text already stored for this task), or failed with error.")
134696
+ });
134697
+ function learningSentence(result) {
134698
+ if (result.status === "stored")
134699
+ return `Learning stored at ${result.key}.`;
134700
+ if (result.status === "replayed")
134701
+ return `Learning already stored at ${result.key}; skipped.`;
134702
+ return `Learning not stored: ${result.error}.`;
134703
+ }
134509
134704
  var registerStoreProgressTool = (server) => {
134510
134705
  createToolRegistrar(server)("store-progress", {
134511
134706
  title: "Store task progress",
@@ -134519,6 +134714,14 @@ var registerStoreProgressTool = (server) => {
134519
134714
  failureReason: string2().optional().describe("The reason for failure (used when failing)."),
134520
134715
  attachments: array2(AttachmentInputSchema).max(20).optional().describe("Pointer-based artifacts produced by this step — agent-fs path, URL, shared-fs path, or swarm Page. No inline file data; upload to agent-fs first and attach by path. Agent-fs pointers are verified before task state changes, using the explicit org/drive pair or the registering agent's configured defaults. May be sent on any call (progress or completion) and accumulates across calls; duplicates are de-duped by sha256 (when present) or by (kind, pointer, name)."),
134521
134716
  citations: array2(CitationInputSchema).max(MAX_TASK_CITATIONS).catch([]).optional().describe('Claim sources, upserted by index across calls. Use only for factual claims the reader cannot already see in the thread or task tree, 1-2 sources; none on delegation, routing, acks, or status replies. Reference each one in output with [citation:N], or set general: true for a source that backs the whole answer (it renders under "General sources"). ref per kind: task = task UUID; memory = memory UUID (optional quote must appear verbatim in it); github = owner/repo#N, owner/repo@<sha>, or a github.com pull, issues, or commit URL; slack = permalink or channel/ts; agent-fs = file path; page = page id; script-run = script run id; url = http(s) URL. The first completing call is refused, and the task stays in progress, if a marker has no entry, a citation fails validation, or a non-general citation is unreferenced; the response lists each problem. After one refusal, completion proceeds and those markers and sources are dropped from rendered output. At most 50 citations per call/task, refs up to 2048 characters, labels up to 200. Invalid or oversized batches are ignored; existing indices can still be updated at capacity.'),
134717
+ learning: union2([
134718
+ string2(),
134719
+ object2({
134720
+ text: string2(),
134721
+ workstream: string2().optional(),
134722
+ tags: array2(string2()).optional()
134723
+ })
134724
+ ]).optional().describe(`A lesson to keep. Add one only when it would change how the next agent works: a gotcha, a dead end, a pattern that worked. Not a progress line. Stored as a swarm memory at /learnings/<workstream>/<slug>, tagged "learning" and tied to this task. The first line of text is the title. At most ~500 tokens and ${LEARNING_MAX_TAGS} kebab tags. workstream defaults to the task's repo name, else "general". Send it on or before the completing call: a call on a finished task stores nothing. A failed learning write is reported in the result and never blocks the progress update.`),
134522
134725
  persistMemory: boolean().optional().describe("Opt in to task_completion memory persistence for automatic/recurring tasks. Manual tasks are persisted by default; scheduled, system, heartbeat/boot-triage, monitor, and digest tasks are skipped unless this is true."),
134523
134726
  force: boolean().optional().describe("On an already-terminal task, overwrite explicitly provided output and/or failureReason text while preserving status and finishedAt and without replaying events, memory writes, follow-up creation, business-use ensure, or capacity updates. Differing terminal text is otherwise discarded and reported as a failure.")
134524
134727
  }),
@@ -134531,6 +134734,7 @@ var registerStoreProgressTool = (server) => {
134531
134734
  failureReason,
134532
134735
  attachments,
134533
134736
  citations,
134737
+ learning,
134534
134738
  persistMemory,
134535
134739
  force
134536
134740
  }, requestInfo, _meta) => {
@@ -134624,6 +134828,7 @@ var registerStoreProgressTool = (server) => {
134624
134828
  return toolErr(`${verificationError} No attachment was registered and task state was unchanged.`);
134625
134829
  }
134626
134830
  }
134831
+ let learningWrite;
134627
134832
  const result = await getDbClient2().transaction(async () => {
134628
134833
  const agent = await getAgentById2(requestInfo.agentId ?? "");
134629
134834
  if (!agent) {
@@ -134690,6 +134895,21 @@ var registerStoreProgressTool = (server) => {
134690
134895
  if (citations?.length && existingTask.agentId === agent.id) {
134691
134896
  await upsertTaskCitations(taskId, citations);
134692
134897
  }
134898
+ if (learning && isTerminal) {
134899
+ learningWrite = Promise.resolve({
134900
+ status: "failed",
134901
+ error: "the task is already finished; use memory-store"
134902
+ });
134903
+ } else if (learning) {
134904
+ learningWrite = new Promise((resolve) => {
134905
+ getDbClient2().afterCommit(() => storeTaskLearning({
134906
+ agentId: agent.id,
134907
+ isLead: agent.isLead === true,
134908
+ task: existingTask,
134909
+ learning
134910
+ }).then(resolve, (err) => resolve({ status: "failed", error: scrubSecrets(String(err)) })));
134911
+ });
134912
+ }
134693
134913
  const terminalResultGuard = await guardTerminalTaskResultWrite(existingTask, {
134694
134914
  status,
134695
134915
  output,
@@ -134812,7 +135032,9 @@ This check refuses once per task; the next completion is accepted and unfixed ci
134812
135032
  persistMemory
134813
135033
  });
134814
135034
  }
134815
- const { success, message } = result;
135035
+ const learningResult = await learningWrite;
135036
+ const { success } = result;
135037
+ const message = learningResult ? `${result.message} ${learningSentence(learningResult)}` : result.message;
134816
135038
  const task = result.task ? {
134817
135039
  id: result.task.id,
134818
135040
  status: result.task.status,
@@ -134823,7 +135045,8 @@ This check refuses once per task; the next completion is accepted and unfixed ci
134823
135045
  ...task ? { task } : {},
134824
135046
  ..."wasNoOp" in result && result.wasNoOp ? { wasNoOp: true } : {},
134825
135047
  ..."wasForcedOverwrite" in result && result.wasForcedOverwrite ? { wasForcedOverwrite: true } : {},
134826
- ..."blockedWaitingElapsedMs" in result && typeof result.blockedWaitingElapsedMs === "number" ? { blockedWaitingElapsedMs: result.blockedWaitingElapsedMs } : {}
135048
+ ..."blockedWaitingElapsedMs" in result && typeof result.blockedWaitingElapsedMs === "number" ? { blockedWaitingElapsedMs: result.blockedWaitingElapsedMs } : {},
135049
+ ...learningResult ? { learning: learningResult } : {}
134827
135050
  };
134828
135051
  const warnings = success && status === "completed" ? taskCitationWarnings(result.task?.output ?? output ?? "", await getTaskCitations(taskId)) : [];
134829
135052
  return success ? toolOk(message, { data, details: warnings.length ? warnings.join(`
@@ -135447,7 +135670,7 @@ async function emitBudgetRefusalSideEffects(ctx, inserted) {
135447
135670
  console.warn(`[budget-refusal-notify] Failed to create follow-up task for budget refusal (task=${ctx.task.id.slice(0, 8)}): ${err}`);
135448
135671
  }
135449
135672
  }
135450
- import("./event-bus-3z78ep5n.js").then(({ workflowEventBus }) => {
135673
+ import("./event-bus-pghg8hqy.js").then(({ workflowEventBus }) => {
135451
135674
  workflowEventBus.emit("task.budget_refused", {
135452
135675
  taskId: ctx.task.id,
135453
135676
  agentId: ctx.agentId,
@@ -135479,7 +135702,7 @@ var TaskActionSchema = _enum2([
135479
135702
  var taskActionInputSchema = object2({
135480
135703
  action: TaskActionSchema.describe("The action to perform: 'create' creates an unassigned task, 'claim' takes a task from pool, 'release' returns task to pool, 'accept' accepts offered task, 'reject' declines offered task, 'to_backlog' moves task to backlog, 'from_backlog' moves task from backlog to pool."),
135481
135704
  task: string2().min(1).optional().describe("Task description (required for 'create')."),
135482
- key: AssetKeySchema.optional().describe("Logical namespace for a created task. Defaults to a shared/task:<id>/ resource key."),
135705
+ key: AssetKeySchema.optional().describe("Logical namespace for a created task. Default: the Slack or chat source key of the task (for example shared/slack/<channel>/thread:<ts>/), else shared/task:<id>/."),
135483
135706
  taskType: string2().max(50).optional().describe("Task type (e.g., 'bug', 'feature')."),
135484
135707
  tags: array2(string2()).optional().describe("Tags for filtering (e.g., ['urgent', 'frontend'])."),
135485
135708
  priority: number2().int().min(0).max(100).optional().describe("Priority 0-100, default 50."),
@@ -136633,6 +136856,7 @@ var registerGetWorkflowTool = (server) => {
136633
136856
  // src/tools/workflows/get-workflow-run.ts
136634
136857
  init_zod();
136635
136858
  init_db3();
136859
+ init_workflow_runs();
136636
136860
  var STEP_VALUE_CAP = 400;
136637
136861
  function stepValuePreview(value) {
136638
136862
  if (value === undefined || value === null)
@@ -136664,19 +136888,21 @@ var registerGetWorkflowRunTool = (server) => {
136664
136888
  annotations: { destructiveHint: false },
136665
136889
  description: "Get details of a workflow run by ID, including all steps and their statuses.",
136666
136890
  inputSchema: object2({
136667
- id: string2().uuid().describe("Workflow run ID")
136891
+ id: string2().uuid().describe("Workflow run ID"),
136892
+ fields: _enum2(["full", "slim"]).optional().describe("`slim` omits run.context and each step's input (a context snapshot per step, large in runs with loops). Outputs, errors and retry fields stay. Default: full.")
136668
136893
  }),
136669
136894
  outputSchema: swarmToolOutputSchema({
136670
136895
  run: unknown().optional(),
136671
136896
  steps: array2(unknown()).optional()
136672
136897
  })
136673
- }, async ({ id }) => {
136898
+ }, async ({ id, fields }) => {
136674
136899
  try {
136675
- const run = await getWorkflowRun2(id, "display");
136900
+ const slim = fields === "slim";
136901
+ const run = slim ? await getWorkflowRunSummary(id) : await getWorkflowRun2(id, "display");
136676
136902
  if (!run) {
136677
136903
  return toolErr(`Workflow run not found: ${id}`, { data: { steps: [] } });
136678
136904
  }
136679
- const steps = await getWorkflowRunStepsByRunId2(id, "display");
136905
+ const steps = slim ? await getWorkflowRunStepsSlimByRunId(id) : await getWorkflowRunStepsByRunId2(id, "display");
136680
136906
  return toolOk(`Run ${id} status: ${run.status}.`, {
136681
136907
  details: renderSteps(steps),
136682
136908
  data: { run, steps }
@@ -137014,6 +137240,82 @@ var registerRetryWorkflowRunTool = (server) => {
137014
137240
  // src/tools/workflows/trigger-workflow.ts
137015
137241
  init_zod();
137016
137242
  init_db3();
137243
+ init_workflow_idempotency();
137244
+
137245
+ // src/http/idempotency-key.ts
137246
+ init_zod();
137247
+ init_workflow_idempotency();
137248
+ init_request_auth_context();
137249
+ var IDEMPOTENCY_KEY_PATTERN = /^[\x21-\x7E]{1,255}$/;
137250
+ var IDEMPOTENT_REPLAYED_HEADER = "Idempotent-Replayed";
137251
+ var idempotencyKeyHeader = (accepted) => object2({
137252
+ "Idempotency-Key": string2().regex(IDEMPOTENCY_KEY_PATTERN).optional().describe("Optional client-generated key, 1-255 visible ASCII characters (a UUID works). " + `The first request the server accepts under a key ${accepted}; a retry with the same key ` + "and an equivalent body gets that request's status and body back (with " + `\`${IDEMPOTENT_REPLAYED_HEADER}: true\`) and changes nothing. The key is scoped to the ` + "caller's identity and this operation; it is not a credential. The same key with a " + "different body is a 409. A request rejected before it is accepted (validation, auth, " + "not found, disabled) does not use up the key. Accepted keys do not expire.")
137253
+ });
137254
+ function idempotencyPrincipal(req, myAgentId) {
137255
+ const auth = getRequestAuth(req);
137256
+ switch (auth?.kind) {
137257
+ case "user":
137258
+ return `user:${auth.userId}`;
137259
+ case "agent":
137260
+ return `agent:${auth.agentId}`;
137261
+ case "controller":
137262
+ return `controller:${auth.controllerId}`;
137263
+ case "guest":
137264
+ return null;
137265
+ default:
137266
+ return myAgentId ? `agent:${myAgentId}` : "operator";
137267
+ }
137268
+ }
137269
+ function readIdempotencyKey(req, res, myAgentId) {
137270
+ const raw = req.headers["idempotency-key"];
137271
+ if (raw === undefined)
137272
+ return;
137273
+ const key = Array.isArray(raw) ? raw.join(", ") : raw;
137274
+ if (!IDEMPOTENCY_KEY_PATTERN.test(key)) {
137275
+ jsonError(res, "Idempotency-Key must be 1-255 visible ASCII characters", 400);
137276
+ return null;
137277
+ }
137278
+ const principal = idempotencyPrincipal(req, myAgentId);
137279
+ if (!principal) {
137280
+ jsonError(res, "Idempotency-Key needs an identified caller", 400);
137281
+ return null;
137282
+ }
137283
+ return { principal, key };
137284
+ }
137285
+ async function replayAcceptedOperation(res, claim, send) {
137286
+ const accepted = await findAcceptedWorkflowOperation(claim);
137287
+ if (!accepted)
137288
+ return false;
137289
+ if (accepted.fingerprint !== claim.fingerprint) {
137290
+ jsonError(res, "Idempotency-Key was already used for a different request", 409);
137291
+ } else if (accepted.resourceDeletedAt !== null) {
137292
+ jsonError(res, "The workflow this Idempotency-Key created or triggered was deleted; send a new key to start over", 410);
137293
+ } else {
137294
+ res.setHeader(IDEMPOTENT_REPLAYED_HEADER, "true");
137295
+ send(accepted.body);
137296
+ }
137297
+ return true;
137298
+ }
137299
+
137300
+ // src/tools/workflows/trigger-workflow.ts
137301
+ async function replayAcceptedTrigger(claim) {
137302
+ const accepted = await findAcceptedWorkflowOperation(claim);
137303
+ if (!accepted)
137304
+ return null;
137305
+ if (accepted.fingerprint !== claim.fingerprint) {
137306
+ return toolErr("idempotencyKey was already used to trigger this workflow with other data.", {
137307
+ data: { idempotencyConflict: true }
137308
+ });
137309
+ }
137310
+ if (accepted.resourceDeletedAt !== null) {
137311
+ return toolErr("The workflow this idempotencyKey triggered was deleted; send a new key to start over.");
137312
+ }
137313
+ const { runId, skipped } = accepted.body;
137314
+ return toolOk("Run already accepted under this idempotencyKey; nothing new was started.", {
137315
+ details: `Replayed the run accepted under this idempotencyKey — run ID: ${runId}.`,
137316
+ data: { runId, skipped, replayed: true }
137317
+ });
137318
+ }
137017
137319
  var registerTriggerWorkflowTool = (server) => {
137018
137320
  createToolRegistrar(server)("trigger-workflow", {
137019
137321
  title: "Trigger Workflow",
@@ -137021,16 +137323,35 @@ var registerTriggerWorkflowTool = (server) => {
137021
137323
  description: "Manually trigger a workflow execution, optionally passing trigger data as context. Respects cooldown configuration. " + "If the workflow has a triggerSchema, the payload is validated first; on failure, the response includes structured validationErrors plus the workflow's triggerSchema for self-correction.",
137022
137324
  inputSchema: object2({
137023
137325
  id: string2().uuid().describe("Workflow ID to trigger"),
137024
- triggerData: record2(string2(), unknown()).optional().describe("Optional data to pass as trigger context to the workflow")
137326
+ triggerData: record2(string2(), unknown()).optional().describe("Optional data to pass as trigger context to the workflow"),
137327
+ wait: boolean().optional().describe("Default true: return after the run's instant steps ran, when it finishes or parks at its first async step. " + "false: return as soon as the run is created and walk it in the background. Use false from a script or step that only needs the runId."),
137328
+ idempotencyKey: string2().regex(IDEMPOTENCY_KEY_PATTERN).optional().describe("Optional, 1-255 visible ASCII characters, scoped to the calling agent and this workflow. " + "The first trigger accepted under a key starts one run; the key is recorded in the run's own transaction and never expires. " + "A retry with the same key and triggerData starts nothing and returns that run (replayed: true), even if the earlier call was killed before it saw the answer. " + "The same key with other triggerData is an error with idempotencyConflict: true.")
137025
137329
  }),
137026
137330
  outputSchema: swarmToolOutputSchema({
137027
137331
  runId: string2().optional(),
137028
137332
  skipped: boolean().optional(),
137333
+ replayed: boolean().optional(),
137334
+ idempotencyConflict: boolean().optional(),
137029
137335
  validationErrors: array2(string2()).optional(),
137030
137336
  triggerSchema: record2(string2(), unknown()).optional()
137031
137337
  })
137032
- }, async ({ id, triggerData }, requestInfo) => {
137338
+ }, async ({ id, triggerData, wait, idempotencyKey }, requestInfo) => {
137033
137339
  try {
137340
+ if (idempotencyKey !== undefined && !requestInfo.agentId) {
137341
+ return toolErr("idempotencyKey needs an identified caller (X-Agent-ID).");
137342
+ }
137343
+ const claim = idempotencyKey === undefined ? undefined : {
137344
+ principal: `agent:${requestInfo.agentId}`,
137345
+ key: idempotencyKey,
137346
+ operation: "workflow.trigger",
137347
+ targetId: id,
137348
+ fingerprint: workflowRequestFingerprint("workflow.trigger", triggerData ?? {})
137349
+ };
137350
+ if (claim) {
137351
+ const replayed = await replayAcceptedTrigger(claim);
137352
+ if (replayed)
137353
+ return replayed;
137354
+ }
137034
137355
  const workflow = await getWorkflow2(id);
137035
137356
  if (!workflow) {
137036
137357
  return toolErr(`Workflow not found: ${id}`);
@@ -137038,12 +137359,33 @@ var registerTriggerWorkflowTool = (server) => {
137038
137359
  if (!workflow.enabled) {
137039
137360
  return toolErr(`Workflow "${workflow.name}" is disabled.`);
137040
137361
  }
137041
- const runId = await startWorkflowExecution2(workflow, triggerData ?? {}, getExecutorRegistry2(), {
137042
- triggerType: "manual",
137043
- requestedByUserId: await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined
137044
- });
137045
- const run = await getWorkflowRun2(runId);
137046
- const skipped = run?.status === "skipped";
137362
+ let accepted;
137363
+ let runId;
137364
+ try {
137365
+ runId = await startWorkflowExecution2(workflow, triggerData ?? {}, getExecutorRegistry2(), {
137366
+ triggerType: "manual",
137367
+ requestedByUserId: await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined,
137368
+ detach: wait === false,
137369
+ accept: claim ? async (run) => {
137370
+ const response = { runId: run.runId, skipped: run.skipped };
137371
+ await recordAcceptedWorkflowOperation(claim, {
137372
+ workflowId: workflow.id,
137373
+ runId: run.runId,
137374
+ status: 201,
137375
+ body: response
137376
+ });
137377
+ accepted = response;
137378
+ } : undefined
137379
+ });
137380
+ } catch (err) {
137381
+ if (claim && err instanceof IdempotencyKeyTakenError) {
137382
+ const replayed = await replayAcceptedTrigger(claim);
137383
+ if (replayed)
137384
+ return replayed;
137385
+ }
137386
+ throw err;
137387
+ }
137388
+ const skipped = accepted ? accepted.skipped : (await getWorkflowRun2(runId))?.status === "skipped";
137047
137389
  if (skipped) {
137048
137390
  return toolOk(`Workflow "${workflow.name}" skipped (cooldown).`, {
137049
137391
  details: `Workflow "${workflow.name}" skipped (cooldown active) — run ID: ${runId}.`,
@@ -137545,4 +137887,4 @@ async function createServer(opts = {}) {
137545
137887
  return server;
137546
137888
  }
137547
137889
 
137548
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, resolveIdentity, renderIdentity, createAdditiveBuffer, taskModelPin, resumedTaskModelSelection, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, transcribeAudioNotes, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, isRuntimePoolWakeable, isAgentReachable, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, recoverIncompleteRuns, handleWebhookTrigger, verifyHmacSignature, WebhookError, snapshotAndUpdateWorkflow, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry2, initWorkflows2, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, hasKvViewArgs, resolveKvView, toolErr, createToolRegistrar, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, stripSiblingBlock, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, getTelemetryIngestAnchor, initApiTelemetry, syncTelemetryEnabled, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, isChatSdkEnabled, getChatSdkConfig, errorMessage, resolveAdapterApiUrl, trackBackground, TelegramBotApiError, callTelegramBotApi, isTrustedTeamsServiceUrl, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, pageSessionSetCookies, resolveHttpRequestAuth, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, userCtx, requestPrincipal, agentFirstPrincipal, rejectGuest, handleApps, cancelApprovalRequest, cancelApprovalRequestAndRun, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, getPageEditCounter, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, MemoryKeyError, refreshLinks, indexMemoryContent, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, inheritedModelSelection, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, reservedRoomKeyError, updateMcpServerChecked, updateTouchesStdioExecution, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, isApiDraining, drainApi, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, changesAllowMerge, updateSwarmRepoChecked, getCombConfig, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, workflowModelErrors, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };
137890
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, resolveIdentity, renderIdentity, createAdditiveBuffer, taskModelPin, resumedTaskModelSelection, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, transcribeAudioNotes, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, isRuntimePoolWakeable, isAgentReachable, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, recoverIncompleteRuns, handleWebhookTrigger, verifyHmacSignature, WebhookError, snapshotAndUpdateWorkflow, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry2, initWorkflows2, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, hasKvViewArgs, resolveKvView, toolErr, createToolRegistrar, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, stripSiblingBlock, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, getTelemetryIngestAnchor, initApiTelemetry, syncTelemetryEnabled, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, isChatSdkEnabled, getChatSdkConfig, errorMessage, resolveAdapterApiUrl, trackBackground, TelegramBotApiError, callTelegramBotApi, isTrustedTeamsServiceUrl, getSessionLabels, rememberSessionLabel, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, pageSessionSetCookies, resolveHttpRequestAuth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, userCtx, requestPrincipal, agentFirstPrincipal, rejectGuest, handleApps, cancelApprovalRequest, cancelApprovalRequestAndRun, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, getPageEditCounter, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, MemoryKeyError, refreshLinks, indexMemoryContent, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, inheritedModelSelection, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, updateMcpServerChecked, updateTouchesStdioExecution, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, isApiDraining, drainApi, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, changesAllowMerge, updateSwarmRepoChecked, getCombConfig, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, workflowModelErrors, patchWorkflowDefinition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };