@desplega.ai/agent-swarm 2.8.3 → 2.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (597) hide show
  1. package/dist/acp-adapter-g909b5hw.js +16 -0
  2. package/dist/acp-targets-ny75x1qy.js +23 -0
  3. package/dist/{actions-ewz7bp4g.js → actions-b9qgrmeq.js} +82 -21
  4. package/dist/agent-fs-provision-b5dhdsbd.js +27 -0
  5. package/dist/{amp-adapter-f25tqhnf.js → amp-adapter-vtax2c9s.js} +3 -3
  6. package/dist/{anthropic-messages-jkva0zps.js → anthropic-messages-r5xf5hqw.js} +37 -37
  7. package/dist/{app-mkptw0k7.js → app-g2z15hax.js} +9 -4
  8. package/dist/approval-notifications-yt13wp8r.js +23 -0
  9. package/dist/{assistant-c47rfe77.js → assistant-2cgfxsgk.js} +56 -33
  10. package/dist/{azure-openai-responses-wgtqkbr3.js → azure-openai-responses-590s1eea.js} +10 -10
  11. package/dist/{boot-args-schema-4vb0xsat.js → boot-args-schema-3gwy0f60.js} +1 -1
  12. package/dist/{boot-reembed-htr73hbs.js → boot-reembed-92g7s5zp.js} +1 -1
  13. package/dist/{boot-reembed-1ghy2sab.js → boot-reembed-mywmyp4s.js} +1 -1
  14. package/dist/{boot-scrub-sweep-yrytg42z.js → boot-scrub-sweep-7dkdzqxx.js} +84 -13
  15. package/dist/{boot-seeds-n2b3dx4e.js → boot-seeds-ce7rvgq1.js} +4 -4
  16. package/dist/{boxd-jmfqgkqa.js → boxd-wn235q80.js} +7 -7
  17. package/dist/claude-adapter-3m4q7735.js +28 -0
  18. package/dist/{claude-managed-adapter-hddmxjyj.js → claude-managed-adapter-t8nfgcgz.js} +4 -4
  19. package/dist/{claude-managed-setup-hfvry1bd.js → claude-managed-setup-c217draw.js} +10 -10
  20. package/dist/{claude-sdk-session-0hamqzc7.js → claude-sdk-session-7fbqm51z.js} +9386 -9196
  21. package/dist/{cli-yjdgea32.js → cli-1jx0srjt.js} +17 -17
  22. package/dist/{cli-sdvcrq5x.js → cli-1jykg0py.js} +18 -14
  23. package/dist/{cli-k96cecs7.js → cli-2czxfnvj.js} +1221 -357
  24. package/dist/{cli-qmqt520k.js → cli-2dq9yv8p.js} +2 -2
  25. package/dist/{cli-e2w34h6z.js → cli-2xs8tsf7.js} +132 -85
  26. package/dist/{cli-z8cvws4c.js → cli-2yjj3e31.js} +907 -56
  27. package/dist/{cli-mdpbjnzq.js → cli-32djehja.js} +42 -42
  28. package/dist/{cli-gpz1d0t2.js → cli-3j873zxq.js} +4 -4
  29. package/dist/cli-43ms35q9.js +270 -0
  30. package/dist/cli-47hz21se.js +25584 -0
  31. package/dist/{cli-n515ex5z.js → cli-4ymxrwg5.js} +16 -16
  32. package/dist/{cli-f1kwb5fc.js → cli-5a6pqy45.js} +333 -21
  33. package/dist/{cli-93t5s4zq.js → cli-5gpqgs8b.js} +2 -2
  34. package/dist/{cli-15204js0.js → cli-6237rnyr.js} +1 -1
  35. package/dist/{cli-4ax9mvvg.js → cli-67mwzr35.js} +9 -9
  36. package/dist/{cli-t5ys4ebm.js → cli-6945ywhr.js} +3 -3
  37. package/dist/{cli-0bcgyj5b.js → cli-6ehs4mta.js} +87 -8
  38. package/dist/{cli-6yygkr0w.js → cli-6ym4jhzp.js} +15 -7
  39. package/dist/{cli-8bpgbr8k.js → cli-7evph51z.js} +5 -5
  40. package/dist/{cli-dtdht77h.js → cli-7mv4h3sn.js} +2 -2
  41. package/dist/{cli-nx2n3z6p.js → cli-7sf9sb0w.js} +3 -2
  42. package/dist/{cli-pe4d96rb.js → cli-7zm3b3f5.js} +1 -1
  43. package/dist/cli-8zh9nrew.js +78 -0
  44. package/dist/cli-9ttx00s3.js +137 -0
  45. package/dist/{cli-x6t50dmw.js → cli-9w8712tq.js} +620 -281
  46. package/dist/{cli-8476gtwf.js → cli-b6px1k1q.js} +1 -1
  47. package/dist/{cli-k2rw11py.js → cli-b91nz213.js} +5 -5
  48. package/dist/{cli-7c5tgqhf.js → cli-bg63qmsx.js} +10 -10
  49. package/dist/{cli-qps8je6j.js → cli-bkjdknnp.js} +54 -10
  50. package/dist/{cli-gn9y6fn7.js → cli-bnqncekd.js} +2 -2
  51. package/dist/{cli-s7zz734a.js → cli-br0924pw.js} +1 -1
  52. package/dist/{cli-h9yy18gy.js → cli-ctx0b85j.js} +5484 -5078
  53. package/dist/{cli-0vksaxvr.js → cli-dgs10ttj.js} +2 -2
  54. package/dist/cli-dqgnbnxs.js +132 -0
  55. package/dist/{cli-q6mfk1ej.js → cli-dzzh58sy.js} +2 -2
  56. package/dist/{cli-2znm3dzj.js → cli-eds5xnsz.js} +2 -2
  57. package/dist/{cli-c0xjnr8z.js → cli-f3jyzq4g.js} +2 -2
  58. package/dist/cli-f8x9drqr.js +84 -0
  59. package/dist/{cli-ztq5z4e1.js → cli-f9gz2vyj.js} +6 -6
  60. package/dist/{cli-bhsfbmk8.js → cli-fh97xn30.js} +93 -44
  61. package/dist/cli-fkef327x.js +103 -0
  62. package/dist/{cli-fsgttth8.js → cli-g0vv9dg4.js} +13 -13
  63. package/dist/{cli-kd56bmk4.js → cli-gabsjg8x.js} +3 -1
  64. package/dist/{cli-1m96dc36.js → cli-gfy38pvt.js} +3 -3
  65. package/dist/{cli-922z7gwm.js → cli-h9yqfzx9.js} +15 -11
  66. package/dist/{cli-5a7szzfh.js → cli-hnamkvnc.js} +2 -2
  67. package/dist/{cli-c3ng0mb4.js → cli-j7svy295.js} +71 -818
  68. package/dist/{cli-yss07azk.js → cli-jaw5v1sy.js} +3 -3
  69. package/dist/cli-jkw6ptfw.js +921 -0
  70. package/dist/{cli-s8p8hhty.js → cli-jm0hvmz2.js} +2 -2
  71. package/dist/{cli-knva3nmx.js → cli-jwampxxq.js} +8 -6
  72. package/dist/cli-kj0hyr43.js +51 -0
  73. package/dist/{cli-tnzebztn.js → cli-kpgcm7xy.js} +13 -1
  74. package/dist/{cli-9zmb7ptc.js → cli-kxx4k2jw.js} +8 -753
  75. package/dist/{cli-am1ptset.js → cli-m7c2380k.js} +208 -194
  76. package/dist/{cli-kw44j53p.js → cli-m7zvgt57.js} +45 -38
  77. package/dist/{cli-504akrp9.js → cli-meydjstb.js} +3 -3
  78. package/dist/{cli-54qr8mcd.js → cli-mhapr559.js} +4 -4
  79. package/dist/{cli-tf79ryyy.js → cli-mjw0yf82.js} +3 -3
  80. package/dist/{cli-rjvsf9qa.js → cli-mkwkwq81.js} +14 -11
  81. package/dist/{cli-n30e0hcp.js → cli-mna6pmfx.js} +2 -2
  82. package/dist/{cli-awwptga4.js → cli-mw620q3n.js} +1 -1
  83. package/dist/{cli-6wj7p986.js → cli-n3qe7tyr.js} +172 -168
  84. package/dist/{cli-4dpkjc2e.js → cli-nafvvsp8.js} +9 -9
  85. package/dist/{cli-sg27rk2t.js → cli-nbt14he0.js} +25 -19
  86. package/dist/{cli-7akn6ze9.js → cli-nh7x3133.js} +7 -28
  87. package/dist/{cli-zdaypkq9.js → cli-p4kckx1z.js} +285 -97
  88. package/dist/{cli-n5t077me.js → cli-pb2ay3sh.js} +10 -3
  89. package/dist/{cli-t4dv07kr.js → cli-psffsanb.js} +4 -3
  90. package/dist/{cli-mwwmka77.js → cli-pyjn0qhk.js} +2712 -268
  91. package/dist/{cli-emekyyhr.js → cli-q2d3e1k1.js} +1 -1
  92. package/dist/{cli-vqva1teb.js → cli-qe909n63.js} +2 -2
  93. package/dist/{cli-2d0cghfn.js → cli-qj39vrc6.js} +1 -1
  94. package/dist/{cli-tas6ckky.js → cli-rq5rpv6k.js} +2 -2
  95. package/dist/{cli-0agcv1v5.js → cli-rqx70rcz.js} +2 -2
  96. package/dist/{cli-kmemts3w.js → cli-sn650d7x.js} +39 -69
  97. package/dist/{cli-98rwmcyc.js → cli-snxhtehz.js} +3 -3
  98. package/dist/{cli-d829z3xc.js → cli-spfz393q.js} +6 -6
  99. package/dist/{cli-500c09j9.js → cli-t9ga4qmb.js} +14 -14
  100. package/dist/{cli-me0r8gzr.js → cli-td9tb872.js} +27 -25
  101. package/dist/cli-tvc4jag9.js +754 -0
  102. package/dist/{cli-6ek0hff4.js → cli-ty3gha1p.js} +4 -4
  103. package/dist/{cli-c71n3bxq.js → cli-v57d7fmm.js} +2 -2
  104. package/dist/{cli-j8cjdzan.js → cli-vs9vdpy0.js} +1 -1
  105. package/dist/cli-vt89089n.js +296 -0
  106. package/dist/{cli-pxwtcgcp.js → cli-vyff45ve.js} +2 -2
  107. package/dist/{cli-x3ex5bqf.js → cli-w16kwbzw.js} +1 -1
  108. package/dist/{cli-bj6qhgte.js → cli-w4n323t3.js} +197 -45
  109. package/dist/{cli-rqfvkx5t.js → cli-wn13hhdt.js} +13 -13
  110. package/dist/{cli-skmhsnqh.js → cli-x40a0w9j.js} +1 -1
  111. package/dist/{cli-zeaehgyd.js → cli-xag7btpe.js} +2 -2
  112. package/dist/{cli-k28wkapa.js → cli-xf1wn5ns.js} +2 -2
  113. package/dist/{cli-rh15cakt.js → cli-xwsm6xkr.js} +1 -1
  114. package/dist/{cli-dpsfwh7n.js → cli-y2ewxhth.js} +56 -31
  115. package/dist/{cli-vx421edw.js → cli-ysvspf5e.js} +9 -7
  116. package/dist/{cli-crpf163n.js → cli-zh0e5x7p.js} +16 -26
  117. package/dist/{cli-4e1hfbpq.js → cli-zr6qy15y.js} +24 -24
  118. package/dist/cli.js +33 -29
  119. package/dist/{codex-adapter-2brxx5ta.js → codex-adapter-n656pvb8.js} +9 -8
  120. package/dist/{codex-hook-c930c3ea.js → codex-hook-59atdwd8.js} +6 -6
  121. package/dist/{codex-login-cbrs1h5w.js → codex-login-a239g1ah.js} +1 -1
  122. package/dist/{codex-session-runner-y9anfj0r.js → codex-session-runner-p0fbv5y9.js} +10 -9
  123. package/dist/{commands-wn9q06qr.js → commands-gwea8z5p.js} +3 -3
  124. package/dist/{controller-fw608czd.js → controller-t67c3grh.js} +9 -6
  125. package/dist/{controllers-connect-63j5rdcm.js → controllers-connect-ks155r0h.js} +28 -25
  126. package/dist/{cursor-adapter-6mb9jme8.js → cursor-adapter-ygwrtmkv.js} +2 -2
  127. package/dist/{db-y4wfrzbm.js → db-kpmx06s9.js} +21 -13
  128. package/dist/{db-0m6v5tq4.js → db-rb2xqdb1.js} +3 -3
  129. package/dist/{devin-adapter-r0yx3gv8.js → devin-adapter-zp4tqq53.js} +1 -1
  130. package/dist/{dispatcher-9tq2zzdj.js → dispatcher-31sm0ej2.js} +21 -18
  131. package/dist/{docker-j75atvpt.js → docker-09tkkg0n.js} +47 -8
  132. package/dist/{dsh-adapter-t09sv4tq.js → dsh-adapter-qyxh0w31.js} +2 -2
  133. package/dist/{e2b-a7vzs2vj.js → e2b-3v1e745x.js} +6 -6
  134. package/dist/{e2b-7s9dscap.js → e2b-sm28k0k3.js} +6 -6
  135. package/dist/{easter-egg-3d-fbwvmwhe.js → easter-egg-3d-00wjscn6.js} +1 -1
  136. package/dist/{embedding-space-wh8de1t9.js → embedding-space-qhw4g68n.js} +6 -6
  137. package/dist/{embeddings-3hpbdtjr.js → embeddings-zdv9ke6x.js} +1 -1
  138. package/dist/{event-bus-tr6h3gv8.js → event-bus-xr83x566.js} +1 -1
  139. package/dist/{execute-4bdf8sdy.js → execute-zna8wwr7.js} +1 -1
  140. package/dist/{external-channel-ts2fwqh0.js → external-channel-1ac6t56s.js} +2 -2
  141. package/dist/fx-adapter-sk7n0fzc.js +19 -0
  142. package/dist/{getMachineId-bsd-nfgrzarv.js → getMachineId-bsd-637a7rbk.js} +3 -3
  143. package/dist/{getMachineId-darwin-wz886dsk.js → getMachineId-darwin-9vytrcnn.js} +3 -3
  144. package/dist/{getMachineId-linux-1nng3p1p.js → getMachineId-linux-mkzsvyyz.js} +3 -3
  145. package/dist/{getMachineId-unsupported-a0428vw9.js → getMachineId-unsupported-4cfs2n11.js} +3 -3
  146. package/dist/{getMachineId-win-h45922nq.js → getMachineId-win-154s3qma.js} +3 -3
  147. package/dist/{google-generative-ai-h7s3e9kk.js → google-generative-ai-maq6c9bf.js} +1 -1
  148. package/dist/{google-vertex-fhxaafzw.js → google-vertex-2jgsw2nb.js} +5 -5
  149. package/dist/grok-adapter-sjbcm5ew.js +19 -0
  150. package/dist/handlers-yzy0c87x.js +35 -0
  151. package/dist/{heartbeat-2ze5fzpc.js → heartbeat-2f6z4kdx.js} +24 -21
  152. package/dist/{hook-gaehe2w5.js → hook-8y0gvtp1.js} +14 -14
  153. package/dist/{hook-ca54yd4s.js → hook-w1skzaqc.js} +5 -5
  154. package/dist/{http-jfg8t2yk.js → http-wghxvpef.js} +2333 -589
  155. package/dist/{index-d6wkh8ar.js → index-0h6qd4p1.js} +34 -24
  156. package/dist/index-25pvya7q.js +40 -0
  157. package/dist/index-2t4859r5.js +35 -0
  158. package/dist/{index-enn321kd.js → index-42jq9yy3.js} +3 -3
  159. package/dist/{index-khe3gp0k.js → index-4k7m5dgj.js} +645 -370
  160. package/dist/index-620y7jzq.js +15 -0
  161. package/dist/{index-gjwaqaq8.js → index-8p0j4h4j.js} +506 -43
  162. package/dist/{index-3gv6sc4z.js → index-8zn8nxn5.js} +1 -1
  163. package/dist/{index-m5gx1xd6.js → index-9myfj74s.js} +40 -40
  164. package/dist/{index-3yvzbhxd.js → index-9zkchs9t.js} +336 -193
  165. package/dist/{index-0rvk3vd4.js → index-b5wgnm78.js} +47 -47
  166. package/dist/index-cxca2t8y.js +36 -0
  167. package/dist/{index-qwj6ntem.js → index-e3krvkh2.js} +4 -4
  168. package/dist/{index-hjhfk3ra.js → index-pe3d8jfy.js} +3 -3
  169. package/dist/index-rv89fvzf.js +572 -0
  170. package/dist/{index-csgrxedz.js → index-s71ez27v.js} +1 -1
  171. package/dist/{keepalive-k2a3qe73.js → keepalive-sh02349h.js} +4 -4
  172. package/dist/lead-gk4h5eg7.js +74 -0
  173. package/dist/{maintenance-gb5sd5nc.js → maintenance-yj0dcjja.js} +1 -1
  174. package/dist/{node-252anz2h.js → node-dqm4xgxw.js} +4 -4
  175. package/dist/{node-ray25snp.js → node-zd6shky9.js} +3 -3
  176. package/dist/{oauth-refresh-sweep-y7rm6bkb.js → oauth-refresh-sweep-d9xedk66.js} +3 -3
  177. package/dist/{onboard-jmc5qerv.js → onboard-dpgjn03r.js} +8 -8
  178. package/dist/{openai-codex-responses-k9gapdze.js → openai-codex-responses-bkcd8pjj.js} +9 -9
  179. package/dist/{openai-responses-4d5dx3c7.js → openai-responses-gbh0wfqe.js} +13 -13
  180. package/dist/{opencode-adapter-7eade9ev.js → opencode-adapter-2d31cpjc.js} +7 -6
  181. package/dist/{otel-impl-8j1xhxqd.js → otel-impl-1skarpfq.js} +110 -110
  182. package/dist/pending-bfmxtx0g.js +82 -0
  183. package/dist/{pi-mono-adapter-yqmaf32x.js → pi-mono-adapter-gvppnasy.js} +43 -16
  184. package/dist/{pricing-refresh-1nj722h6.js → pricing-refresh-c6b325mk.js} +2 -2
  185. package/dist/{rbac-roles-b1mtr6dr.js → rbac-roles-h80qbdbs.js} +3 -3
  186. package/dist/{rbac-roles-n1f3frk1.js → rbac-roles-zfcx68tx.js} +10 -3
  187. package/dist/{render-v2-1gfpd8rj.js → render-v2-nx20t3rb.js} +7 -4
  188. package/dist/{resume-w1s1eh5v.js → resume-5ep8agan.js} +11 -7
  189. package/dist/{runtime-84g5egsc.js → runtime-r3pj4mce.js} +1 -1
  190. package/dist/{session-access-y6z1txk4.js → session-access-n7p3m15b.js} +4 -4
  191. package/dist/{session-source-backfill-gxxwfh12.js → session-source-backfill-v8mt0zwn.js} +4 -4
  192. package/dist/{setup-r91gstyk.js → setup-z1psaqhe.js} +1 -1
  193. package/dist/thread-buffer-a1re2r9r.js +38 -0
  194. package/dist/{virtual-modules-cgnj6kme.js → virtual-modules-rrbjdpxn.js} +5 -5
  195. package/dist/{work-objects-qcxzg61c.js → work-objects-4aghh73z.js} +31 -23
  196. package/dist/worker-3dyyb8ev.js +74 -0
  197. package/dist/{worker-follow-up-y2d2h7km.js → worker-follow-up-166zmex1.js} +21 -18
  198. package/dist/{x-qhxq2ama.js → x-wg164ss9.js} +2 -2
  199. package/openapi.json +2561 -131
  200. package/package.json +15 -11
  201. package/plugin/commands/create-pr.md +1 -1
  202. package/plugin/pi-skills/create-pr/SKILL.md +1 -1
  203. package/src/apps/action-runner.ts +21 -1
  204. package/src/apps/catalog.generated.json +667 -18
  205. package/src/apps/page-validator.ts +341 -8
  206. package/src/assets/key.ts +6 -0
  207. package/src/be/agent-fs-user-keys.ts +186 -0
  208. package/src/be/audit-user.ts +27 -13
  209. package/src/be/automation-preflight.test.ts +14 -14
  210. package/src/be/automation-preflight.ts +24 -16
  211. package/src/be/boot-scrub-sweep.ts +143 -14
  212. package/src/be/caller-session-group.ts +86 -0
  213. package/src/be/checklist.ts +375 -0
  214. package/src/be/db/agents.ts +12 -1
  215. package/src/be/db/approvals.ts +26 -0
  216. package/src/be/db/model-profiles.ts +4 -1
  217. package/src/be/db/session-costs.ts +219 -0
  218. package/src/be/db/session-log-reasoning.ts +36 -0
  219. package/src/be/db/session-moves.ts +23 -0
  220. package/src/be/db/session-tree.ts +78 -19
  221. package/src/be/db/tasks/eligibility-scan.ts +14 -0
  222. package/src/be/db/tasks/read.ts +7 -3
  223. package/src/be/db/tasks/slack-fold.ts +116 -0
  224. package/src/be/db/tasks/write.ts +67 -1
  225. package/src/be/db-queries/mcp-servers.ts +13 -0
  226. package/src/be/db-queries/oauth.ts +6 -0
  227. package/src/be/db-queries/task-artifacts.ts +10 -8
  228. package/src/be/db.ts +242 -319
  229. package/src/be/extensions/assets.ts +17 -13
  230. package/src/be/import/config.ts +54 -0
  231. package/src/be/import/dir-source.ts +372 -0
  232. package/src/be/import/index.ts +149 -0
  233. package/src/be/import/pending.ts +71 -0
  234. package/src/be/import/schema.ts +137 -0
  235. package/src/be/import/seeders.ts +462 -0
  236. package/src/be/key-window-usage.ts +385 -0
  237. package/src/be/migrations/297_import_ownership.sql +34 -0
  238. package/src/be/migrations/301_favorites_key_type.sql +36 -0
  239. package/src/be/migrations/302_checklist_items.sql +23 -0
  240. package/src/be/migrations/303_task_ui_specs.sql +28 -0
  241. package/src/be/migrations/306_provider_account_telemetry.sql +1 -0
  242. package/src/be/migrations/307_session_cost_credential_attribution.sql +23 -0
  243. package/src/be/migrations/310_session_logs_reasoning.sql +12 -0
  244. package/src/be/multi-runtime.ts +8 -1
  245. package/src/be/rbac-roles.ts +8 -1
  246. package/src/be/runtime-pools/db.ts +3 -0
  247. package/src/be/runtime-pools/demand.ts +20 -2
  248. package/src/be/runtime-pools/reachability.ts +31 -0
  249. package/src/be/runtime-pools/routing.ts +8 -1
  250. package/src/be/runtime-pools/supervisor.ts +6 -7
  251. package/src/be/savings/read.ts +8 -6
  252. package/src/be/script-credential-broker.ts +2 -2
  253. package/src/be/scripts/typecheck.ts +4 -4
  254. package/src/be/seed/agent-fs-provision.ts +104 -19
  255. package/src/be/seed/index.ts +1 -1
  256. package/src/be/seed/registry.ts +27 -8
  257. package/src/be/seed/runner.ts +1 -1
  258. package/src/be/seed/schedules-seeder.ts +24 -6
  259. package/src/be/seed/seed-toggle.ts +32 -0
  260. package/src/be/seed/types.ts +6 -0
  261. package/src/be/seed-scripts/catalog/boot-triage.inline.ts +1 -0
  262. package/src/be/seed-scripts/catalog/boot-triage.ts +1 -0
  263. package/src/be/seed-scripts/catalog/dreaming-gather.ts +2 -2
  264. package/src/be/seed-scripts/catalog/wait-for-task.ts +5 -1
  265. package/src/be/seed-skills/index.ts +3 -0
  266. package/src/be/steering.ts +27 -4
  267. package/src/be/swarm-config-guard.ts +54 -1
  268. package/src/be/task-citations.ts +8 -5
  269. package/src/be/task-ui-spec.ts +158 -0
  270. package/src/commands/controller.ts +3 -0
  271. package/src/commands/credential-outcome-report.ts +13 -3
  272. package/src/commands/onboard/agent-fs-version.ts +1 -1
  273. package/src/commands/rate-limit-outcome.ts +6 -0
  274. package/src/commands/runner.ts +95 -55
  275. package/src/e2b/env.ts +2 -0
  276. package/src/extensions/catalog.generated.json +17 -0
  277. package/src/extensions/contract-types.generated.ts +1 -1
  278. package/src/github/app.ts +10 -1
  279. package/src/github/handlers.ts +6 -3
  280. package/src/github/reactions.ts +12 -14
  281. package/src/heartbeat/heartbeat.ts +14 -4
  282. package/src/http/agents.ts +19 -10
  283. package/src/http/all-routes.ts +2 -0
  284. package/src/http/api-keys.ts +258 -30
  285. package/src/http/approval-requests.ts +24 -4
  286. package/src/http/apps.ts +69 -5
  287. package/src/http/checklist.ts +176 -0
  288. package/src/http/db-query-bounded.ts +256 -11
  289. package/src/http/db-query-shared.ts +9 -0
  290. package/src/http/favorites.ts +14 -2
  291. package/src/http/fs.ts +346 -1
  292. package/src/http/index.ts +29 -1
  293. package/src/http/kv.ts +13 -0
  294. package/src/http/mcp-oauth.ts +1 -1
  295. package/src/http/mcp-servers.ts +15 -2
  296. package/src/http/onboarding.ts +2 -9
  297. package/src/http/poll.ts +45 -0
  298. package/src/http/script-connections.ts +1 -0
  299. package/src/http/session-data.ts +74 -23
  300. package/src/http/sessions.ts +23 -2
  301. package/src/http/slack-events.ts +101 -0
  302. package/src/http/status.ts +25 -7
  303. package/src/http/task-requester.ts +46 -0
  304. package/src/http/tasks.ts +169 -42
  305. package/src/http/users.ts +14 -0
  306. package/src/http/webhooks.ts +15 -0
  307. package/src/integrations/cards/index.ts +151 -0
  308. package/src/integrations/chat-sdk/outbound.ts +39 -13
  309. package/src/integrations/chat-sdk/relay.ts +87 -0
  310. package/src/integrations/chat-sdk/runtime.ts +7 -1
  311. package/src/integrations/chat-sdk/status.ts +17 -0
  312. package/src/integrations/chat-sdk/telegram-api.ts +6 -1
  313. package/src/jira/outbound.ts +5 -3
  314. package/src/kv-reserved-namespaces.ts +17 -2
  315. package/src/linear/outbound.ts +5 -1
  316. package/src/oauth/presets.ts +29 -2
  317. package/src/prompts/base-prompt.ts +25 -4
  318. package/src/prompts/session-templates.ts +102 -8
  319. package/src/providers/acp-targets.ts +1 -1
  320. package/src/providers/amp-adapter.ts +1 -1
  321. package/src/providers/claude-adapter.ts +27 -4
  322. package/src/providers/claude-flag-settings.ts +39 -1
  323. package/src/providers/claude-managed-adapter.ts +5 -1
  324. package/src/providers/codex-adapter.ts +86 -4
  325. package/src/providers/codex-app-server.ts +11 -16
  326. package/src/providers/codex-oauth/auth-json.ts +1 -0
  327. package/src/providers/opencode-adapter.ts +7 -19
  328. package/src/providers/pi-mono-adapter.ts +35 -2
  329. package/src/providers/pricing-sources.md +32 -0
  330. package/src/providers/runtime-dependencies.ts +158 -0
  331. package/src/providers/types.ts +11 -0
  332. package/src/rbac/legacy-policy.ts +2 -0
  333. package/src/rbac/permissions.ts +10 -1
  334. package/src/runtime-providers/docker.ts +65 -1
  335. package/src/scheduler/deferred-task-waits.ts +18 -5
  336. package/src/scripts-runtime/credential-broker/default-bindings.ts +19 -11
  337. package/src/scripts-runtime/credential-broker/index.ts +1 -1
  338. package/src/scripts-runtime/egress-secrets.ts +2 -2
  339. package/src/scripts-runtime/swarm-sdk.ts +3 -2
  340. package/src/scripts-runtime/types/stdlib.d.ts +11 -4
  341. package/src/scripts-runtime/types/swarm-extension.d.ts +9 -9
  342. package/src/scripts-runtime/types/swarm-sdk.d.ts +11 -4
  343. package/src/server.ts +4 -4
  344. package/src/slack/actions.ts +56 -0
  345. package/src/slack/app.ts +107 -59
  346. package/src/slack/assistant.ts +33 -7
  347. package/src/slack/handlers.ts +6 -4
  348. package/src/slack/http-receiver.ts +284 -0
  349. package/src/slack/inbound-dispatch.ts +43 -7
  350. package/src/slack/inbound-files.ts +35 -14
  351. package/src/slack/message-text.ts +47 -4
  352. package/src/slack/render-v2.ts +109 -24
  353. package/src/slack/responses.ts +3 -2
  354. package/src/slack/socket-ack.ts +17 -10
  355. package/src/slack/steering.ts +5 -0
  356. package/src/slack/thread-buffer-store.ts +58 -0
  357. package/src/slack/thread-buffer.ts +341 -57
  358. package/src/slack/work-objects.ts +4 -1
  359. package/src/tasks/context-key.ts +24 -0
  360. package/src/tasks/errors.ts +5 -0
  361. package/src/tasks/sibling-awareness.ts +13 -1
  362. package/src/tests/acp-adapter.test.ts +4 -6
  363. package/src/tests/agent-fs-live-url.test.ts +15 -0
  364. package/src/tests/agent-fs-provision-seeder.test.ts +140 -0
  365. package/src/tests/agent-fs-user-keys.test.ts +483 -0
  366. package/src/tests/agentfs-proxy.test.ts +8 -8
  367. package/src/tests/api-key-tracking.test.ts +0 -72
  368. package/src/tests/api-keys-status-model-limits.test.ts +93 -1
  369. package/src/tests/api-keys-validation.test.ts +42 -0
  370. package/src/tests/approval-card-resolution.test.ts +402 -0
  371. package/src/tests/approval-requests-notifications.test.ts +12 -2
  372. package/src/tests/approval-respond-auth.test.ts +28 -0
  373. package/src/tests/apps-action-parent-task.test.ts +140 -0
  374. package/src/tests/apps-catalog-additions.test.ts +315 -0
  375. package/src/tests/apps-catalog-files.test.ts +114 -0
  376. package/src/tests/apps-catalog-hitl.test.ts +117 -0
  377. package/src/tests/apps-catalog-inputs.test.ts +86 -0
  378. package/src/tests/apps-catalog-page-frame.test.ts +49 -0
  379. package/src/tests/apps-catalog-table.test.ts +47 -0
  380. package/src/tests/apps-chart-shell.test.ts +1 -1
  381. package/src/tests/apps-element-assembly.test.ts +52 -3
  382. package/src/tests/apps-session-thread.test.ts +261 -0
  383. package/src/tests/asset-key-invariants.test.ts +14 -0
  384. package/src/tests/base-prompt.test.ts +213 -23
  385. package/src/tests/boot-scrub-sweep.test.ts +172 -0
  386. package/src/tests/caller-session-group.test.ts +199 -0
  387. package/src/tests/cards.test.ts +169 -0
  388. package/src/tests/chat-sdk-relay.test.ts +149 -1
  389. package/src/tests/chat-sdk-status-route.test.ts +16 -3
  390. package/src/tests/chat-sdk-telegram-token.test.ts +76 -0
  391. package/src/tests/chat-sdk-tools.test.ts +147 -0
  392. package/src/tests/checklist-nudge.test.ts +208 -0
  393. package/src/tests/checklist.test.ts +686 -0
  394. package/src/tests/claude-adapter-binary.test.ts +67 -6
  395. package/src/tests/claude-flag-settings.test.ts +29 -0
  396. package/src/tests/claude-sdk-lifecycle.test.ts +5 -0
  397. package/src/tests/codex-adapter.test.ts +340 -2
  398. package/src/tests/codex-app-server.test.ts +32 -0
  399. package/src/tests/codex-oauth.test.ts +3 -1
  400. package/src/tests/codex-rate-limits.test.ts +384 -0
  401. package/src/tests/comb-config-guard.test.ts +21 -0
  402. package/src/tests/comb-default.test.ts +59 -97
  403. package/src/tests/comb-links.test.ts +86 -16
  404. package/src/tests/comb-status.test.ts +24 -27
  405. package/src/tests/create-page-tool.test.ts +101 -1
  406. package/src/tests/create-schedule-key.test.ts +105 -0
  407. package/src/tests/credential-broker.test.ts +2 -2
  408. package/src/tests/credential-outcome-report.test.ts +20 -0
  409. package/src/tests/db-query.test.ts +87 -1
  410. package/src/tests/db-task-read-contract.test.ts +4 -0
  411. package/src/tests/db-task-write-contract.test.ts +6 -1
  412. package/src/tests/deferred-task-wake.test.ts +63 -1
  413. package/src/tests/docker-isolation-config-guard.test.ts +29 -0
  414. package/src/tests/docs-index-footprint.test.js +11 -3
  415. package/src/tests/e2e-visuals-comment.test.ts +82 -0
  416. package/src/tests/e2e-visuals-verify-pr.test.ts +138 -0
  417. package/src/tests/entrypoint-github-enterprise.test.ts +158 -0
  418. package/src/tests/extensions-assets.test.ts +7 -3
  419. package/src/tests/extensions-catalog.test.ts +1 -0
  420. package/src/tests/extensions-example-sql-admin-only.test.ts +201 -0
  421. package/src/tests/extensions-pre-task.test.ts +3 -3
  422. package/src/tests/extensions-steering.test.ts +14 -2
  423. package/src/tests/favorites-agent-fs-path.test.ts +124 -0
  424. package/src/tests/fetch-resolved-env.test.ts +68 -0
  425. package/src/tests/fixtures/import-package.ts +32 -0
  426. package/src/tests/fixtures/runner-missing-dependency.ts +129 -0
  427. package/src/tests/fixtures/ui-spec-slack/deploys.json +121 -0
  428. package/src/tests/fixtures/ui-spec-slack/incident.json +183 -0
  429. package/src/tests/fixtures/ui-spec-slack/three-charts-stale.json +196 -0
  430. package/src/tests/fixtures/ui-spec-slack/video-rejected-by-slack.json +183 -0
  431. package/src/tests/fixtures/ui-spec-slack/video.json +446 -0
  432. package/src/tests/fs-routes.test.ts +505 -2
  433. package/src/tests/github-ghes-mock.test.ts +196 -0
  434. package/src/tests/github-host.test.ts +285 -0
  435. package/src/tests/gitleaks-download-retry.test.ts +85 -0
  436. package/src/tests/heartbeat-supersede-resume.test.ts +73 -0
  437. package/src/tests/heartbeat.test.ts +56 -0
  438. package/src/tests/human-thread-routing.test.ts +187 -0
  439. package/src/tests/import-config.test.ts +209 -0
  440. package/src/tests/import.test.ts +464 -0
  441. package/src/tests/invites-http.test.ts +144 -1
  442. package/src/tests/jira-outbound-sync.test.ts +33 -1
  443. package/src/tests/key-window-usage.test.ts +831 -0
  444. package/src/tests/kv-http.test.ts +11 -0
  445. package/src/tests/linear-outbound-sync.test.ts +30 -1
  446. package/src/tests/literal-matcher.test.ts +58 -0
  447. package/src/tests/mcp-oauth-manual-client.test.ts +1 -1
  448. package/src/tests/oauth-presets.test.ts +12 -0
  449. package/src/tests/pi-mono-adapter.test.ts +79 -0
  450. package/src/tests/pool-affinity.test.ts +50 -0
  451. package/src/tests/preload-env.test.ts +2 -0
  452. package/src/tests/preload.ts +3 -1
  453. package/src/tests/prompt-template-session.test.ts +53 -5
  454. package/src/tests/provider-quota-persistence.test.ts +362 -0
  455. package/src/tests/provider-registration.test.ts +2 -55
  456. package/src/tests/provider-runtime-dependencies.test.ts +212 -0
  457. package/src/tests/rate-limit-event.test.ts +22 -0
  458. package/src/tests/rbac-admission.test.ts +19 -0
  459. package/src/tests/rbac-charact-misc-tools.test.ts +31 -0
  460. package/src/tests/rbac-engine.test.ts +2 -0
  461. package/src/tests/rbac-roles.test.ts +2 -0
  462. package/src/tests/reasoning-events.test.ts +164 -0
  463. package/src/tests/routing-affinity-inventory.test.ts +22 -0
  464. package/src/tests/runner-missing-dependency.test.ts +61 -0
  465. package/src/tests/runtime-pool-reachability.test.ts +135 -1
  466. package/src/tests/runtime-pool-routing.test.ts +52 -0
  467. package/src/tests/runtime-providers-docker.test.ts +91 -0
  468. package/src/tests/runtime-stale-threshold.test.ts +40 -0
  469. package/src/tests/savings-fleet-slices.test.ts +122 -0
  470. package/src/tests/savings-read.test.ts +41 -0
  471. package/src/tests/savings-scripts.test.ts +9 -3
  472. package/src/tests/script-connections.test.ts +7 -0
  473. package/src/tests/script-executor-conformance.test.ts +41 -4
  474. package/src/tests/secret-canary-sweep.test.ts +41 -5
  475. package/src/tests/secret-scrub-gate.test.ts +257 -0
  476. package/src/tests/seed-registry.test.ts +142 -9
  477. package/src/tests/seed-scripts.test.ts +23 -0
  478. package/src/tests/session-cost-attribution.test.ts +748 -0
  479. package/src/tests/session-costs.test.ts +14 -15
  480. package/src/tests/session-logs.test.ts +83 -0
  481. package/src/tests/session-source-keys.test.ts +42 -1
  482. package/src/tests/sessions-detail-batch.test.ts +7 -0
  483. package/src/tests/sessions-move.test.ts +70 -0
  484. package/src/tests/sessions-tree.test.ts +98 -0
  485. package/src/tests/sessions.test.ts +69 -0
  486. package/src/tests/slack-config.test.ts +4 -18
  487. package/src/tests/slack-http-receiver.test.ts +472 -0
  488. package/src/tests/slack-inbound-logging.test.ts +64 -0
  489. package/src/tests/slack-leave-thread.test.ts +1 -1
  490. package/src/tests/slack-message-text.test.ts +104 -0
  491. package/src/tests/slack-mode-lifecycle.test.ts +6 -4
  492. package/src/tests/slack-render-v2.test.ts +405 -0
  493. package/src/tests/slack-skip-reaction.test.ts +2 -2
  494. package/src/tests/slack-start-reload-race.test.ts +67 -0
  495. package/src/tests/slack-steering.test.ts +22 -10
  496. package/src/tests/slack-thread-buffer-context.test.ts +1 -1
  497. package/src/tests/slack-thread-buffer-fold.test.ts +417 -0
  498. package/src/tests/slack-thread-buffer-restore.test.ts +198 -0
  499. package/src/tests/slack-thread-buffer-startup-restore.test.ts +86 -0
  500. package/src/tests/slack-thread-buffer.test.ts +34 -34
  501. package/src/tests/slack-thread-participants.test.ts +23 -5
  502. package/src/tests/slack-tool-blocks.test.ts +167 -0
  503. package/src/tests/status.test.ts +32 -6
  504. package/src/tests/steering-core.test.ts +13 -0
  505. package/src/tests/steering-enabled.test.ts +7 -1
  506. package/src/tests/steering-promotion.test.ts +24 -0
  507. package/src/tests/subscription-plans.test.ts +20 -1
  508. package/src/tests/swarm-config-reserved-keys.test.ts +17 -0
  509. package/src/tests/system-one-hosts-ui-mirror.test.ts +67 -0
  510. package/src/tests/task-artifacts.test.ts +50 -0
  511. package/src/tests/task-session-prompts.test.ts +95 -1
  512. package/src/tests/task-ui-action-route.test.ts +191 -0
  513. package/src/tests/task-ui-actions.test.ts +195 -0
  514. package/src/tests/task-ui-spec-fallback.test.ts +65 -0
  515. package/src/tests/task-ui-spec.test.ts +368 -0
  516. package/src/tests/workflow-agent-task-retry.test.ts +34 -1
  517. package/src/tests/workflow-system-one-extraction.test.ts +149 -1
  518. package/src/tools/chat-post.ts +19 -4
  519. package/src/tools/chat-reply.ts +20 -4
  520. package/src/tools/create-page.ts +21 -4
  521. package/src/tools/defer-task.ts +1 -1
  522. package/src/tools/get-swarm.ts +18 -2
  523. package/src/tools/join-swarm.ts +2 -1
  524. package/src/tools/kv/kv-write-auth.ts +17 -1
  525. package/src/tools/schedules/create-schedule.ts +22 -4
  526. package/src/tools/slack-post.ts +40 -7
  527. package/src/tools/slack-reply.ts +50 -14
  528. package/src/tools/store-progress.ts +69 -3
  529. package/src/types.ts +50 -4
  530. package/src/ui-spec/actions.ts +86 -0
  531. package/src/ui-spec/fallback.ts +19 -0
  532. package/src/ui-spec/slack.ts +17 -0
  533. package/src/ui-spec/validate.ts +169 -0
  534. package/src/utils/codex-rate-limits.ts +159 -0
  535. package/src/utils/constants.ts +60 -138
  536. package/src/utils/credentials.ts +2 -0
  537. package/src/utils/error-tracker.ts +19 -0
  538. package/src/utils/github-host.ts +217 -0
  539. package/src/utils/github-pull-request.ts +8 -5
  540. package/src/utils/literal-matcher.ts +118 -0
  541. package/src/utils/provider-account-telemetry.ts +331 -0
  542. package/src/utils/reasoning-events.ts +107 -0
  543. package/src/utils/secret-scrubber.ts +331 -25
  544. package/src/utils/subscription-plans.ts +11 -59
  545. package/src/utils/task-attachment-links.ts +9 -12
  546. package/src/utils/task-ui-spec.ts +67 -0
  547. package/src/vcs/index.ts +3 -0
  548. package/src/workflows/approval-notifications.ts +188 -12
  549. package/src/workflows/executors/system-one-extraction.ts +14 -7
  550. package/src/workflows/executors/system-one-providers.ts +22 -1
  551. package/src/workflows/task-step-routing.ts +8 -3
  552. package/templates/community/open-prompt-showreel/PLAYBOOK.md +1 -1
  553. package/templates/community/open-prompt-showreel/skills/open-prompt-showreel/SKILL.md +1 -1
  554. package/templates/extensions/README.md +1 -0
  555. package/templates/extensions/sql-admin-only/README.md +20 -0
  556. package/templates/extensions/sql-admin-only/hooks.ts +100 -0
  557. package/templates/extensions/sql-admin-only/manifest.json +8 -0
  558. package/templates/import/manifest.schema.json +136 -0
  559. package/templates/import/sources.schema.json +44 -0
  560. package/templates/skills/agent-browser/SKILL.md +1 -1
  561. package/templates/skills/agent-browser/content.md +1 -1
  562. package/templates/skills/apps/SKILL.md +151 -14
  563. package/templates/skills/apps/content.md +151 -14
  564. package/templates/skills/asset-namespaces/content.md +2 -1
  565. package/templates/skills/chat-sdk/content.md +17 -0
  566. package/templates/skills/db-query-guidance/content.md +2 -1
  567. package/templates/skills/scheduling/content.md +27 -0
  568. package/templates/skills/slack-interaction/content.md +12 -2
  569. package/templates/skills/swarm-docs/content.md +1 -0
  570. package/templates/skills/swarm-extensions/config.json +1 -1
  571. package/templates/skills/swarm-extensions/content.md +33 -23
  572. package/templates/skills/swarm-scripts/SKILL.md +13 -0
  573. package/templates/skills/swarm-scripts/content.md +13 -0
  574. package/templates/skills/ui-spec/config.json +14 -0
  575. package/templates/skills/ui-spec/content.md +127 -0
  576. package/templates/skills/work-on-task/SKILL.md +1 -1
  577. package/templates/skills/work-on-task/content.md +1 -1
  578. package/templates/skills/workflow-iterate/content.md +4 -7
  579. package/templates/workflows/dreaming/content.md +2 -2
  580. package/dist/acp-adapter-xq6s2z6t.js +0 -14
  581. package/dist/claude-adapter-r33pqnzx.js +0 -24
  582. package/dist/cli-dns0y538.js +0 -194
  583. package/dist/cli-m2z8jagn.js +0 -12078
  584. package/dist/fx-adapter-1rnxnf56.js +0 -17
  585. package/dist/grok-adapter-efhmf1r8.js +0 -17
  586. package/dist/handlers-anrr3py9.js +0 -32
  587. package/dist/index-2skqtd76.js +0 -12795
  588. package/dist/index-8w2aznds.js +0 -33
  589. package/dist/index-qnjvr362.js +0 -37
  590. package/dist/index-yzxd3sn9.js +0 -32
  591. package/dist/lead-zhxqbfdv.js +0 -69
  592. package/dist/worker-7j2907g6.js +0 -69
  593. package/src/tests/entrypoint-acp-target-binary.test.ts +0 -439
  594. package/dist/{cli-4caa1x7d.js → cli-tsa40663.js} +4 -4
  595. package/dist/{mistral-conversations-a45tx39a.js → mistral-conversations-0c30em7t.js} +4 -4
  596. package/dist/{openai-completions-xd579js7.js → openai-completions-f3n69rep.js} +18 -18
  597. package/dist/{pi-messages-hjbv8v10.js → pi-messages-zebyt7gb.js} +5 -5
@@ -1,4 +1,21 @@
1
1
  import {
2
+ CredentialBindingSchema,
3
+ placeholderForConfigKey,
4
+ assertUrlSafe,
5
+ init_credential_broker,
6
+ withLoopPath,
7
+ bindLoopPath,
8
+ init_event_loop_lag,
9
+ isInTransaction,
10
+ init_db_client,
11
+ breaksJsonValidity,
12
+ init_scrub_json,
13
+ init_templates3,
14
+ resolveSqliteVecExtensionPath2,
15
+ initDb2,
16
+ getDb2,
17
+ getDbClient2,
18
+ init_runtime2,
2
19
  chatSdkContextKey,
3
20
  chatThreadOfContextKey,
4
21
  agentmailContextKey,
@@ -13,9 +30,14 @@ import {
13
30
  workflowContextKey,
14
31
  agentContextKey,
15
32
  pageContextKey,
33
+ APP_SESSION_KEY_PATTERN,
34
+ appSessionContextKey,
16
35
  init_context_key,
17
36
  sessionSourceKey,
37
+ sourceOfKey,
18
38
  init_source_key,
39
+ TaskCreationBlockedError,
40
+ init_errors2,
19
41
  checkSlackRoutingCoherence,
20
42
  init_slack_routing,
21
43
  beginRequestAuthScope,
@@ -31,23 +53,6 @@ import {
31
53
  track,
32
54
  telemetry,
33
55
  init_telemetry,
34
- CredentialBindingSchema,
35
- placeholderForConfigKey,
36
- assertUrlSafe,
37
- init_credential_broker,
38
- withLoopPath,
39
- bindLoopPath,
40
- init_event_loop_lag,
41
- isInTransaction,
42
- init_db_client,
43
- breaksJsonValidity,
44
- init_scrub_json,
45
- init_templates3,
46
- resolveSqliteVecExtensionPath2,
47
- initDb2,
48
- getDb2,
49
- getDbClient2,
50
- init_runtime2,
51
56
  isRbacEnabled,
52
57
  decideAdmission,
53
58
  grantLeadEquivalence,
@@ -99,9 +104,60 @@ import {
99
104
  updateAgentStatusFromCapacity2,
100
105
  buildRoutingAffinityFromAgent2,
101
106
  isAgentEligibleForTask2,
102
- computeContentHash2,
103
- getContextVersion2,
104
- getContextVersionHistory2,
107
+ getWorkflowRunTriggeredByAgentId,
108
+ getWorkflowRunSummary,
109
+ getWorkflowRunStepsSlimByRunId,
110
+ getRunLineageBlock,
111
+ getWorkflowRunStatus,
112
+ disarmWorkflowTreeRetries,
113
+ getRunningSubWorkflowSteps,
114
+ getSettledChildRunParentSteps,
115
+ init_workflow_runs,
116
+ LEARNING_TTL_DAYS,
117
+ LEARNING_DUPLICATE_MIN_SIMILARITY,
118
+ CANDIDATE_SET_MULTIPLIER,
119
+ isGraphExpansionEnabled,
120
+ init_constants2,
121
+ LONGTERM_ROOT,
122
+ LEARNINGS_ROOT,
123
+ MEMORY_KEY_PATTERN,
124
+ MEMORY_KEY_PATTERN_MESSAGE,
125
+ MEMORY_KEY_MAX_LENGTH,
126
+ isLongtermKey,
127
+ longtermKeyError,
128
+ isConsolidatedKey,
129
+ consolidatedKeyMessage,
130
+ resolveStoreKey,
131
+ init_key_paths,
132
+ computeScore,
133
+ rerank,
134
+ init_reranker,
135
+ searchMemoryCandidates,
136
+ init_search_candidates,
137
+ rowToCandidate,
138
+ init_sqlite_store,
139
+ getEmbeddingProvider2,
140
+ getMemoryStore2,
141
+ init_memory,
142
+ embedScript2,
143
+ init_embeddings,
144
+ upsertScriptByName,
145
+ getScript,
146
+ getScriptById,
147
+ getScriptVersion,
148
+ deleteScript,
149
+ touchScratchScriptLastUsed,
150
+ restoreScratchScriptLastUsedIfUnchanged,
151
+ init_db3,
152
+ getOAuthApp,
153
+ getOAuthAppById,
154
+ getOAuthAppIdByProvider,
155
+ createOAuthApp,
156
+ upsertOAuthApp,
157
+ listAuthorizationsForApp,
158
+ getAuthorizationById,
159
+ getOAuthTokens,
160
+ init_oauth,
105
161
  taskModelPin,
106
162
  init_model_pin,
107
163
  upsertModelCatalogOverlay,
@@ -110,6 +166,7 @@ import {
110
166
  init_model_validation2,
111
167
  checkProfileForAgent,
112
168
  init_model_profile_check,
169
+ rowToAgentTask,
113
170
  getTaskById2,
114
171
  hasNonTerminalRerouteDecisionChild2,
115
172
  getAgentCurrentTask2,
@@ -143,68 +200,21 @@ import {
143
200
  taskProfileError,
144
201
  scheduleProfileUpdate,
145
202
  init_model_profiles,
146
- onTaskStarted,
147
- init_task_lifecycle_events,
148
- getOAuthApp,
149
- getOAuthAppById,
150
- getOAuthAppIdByProvider,
151
- createOAuthApp,
152
- upsertOAuthApp,
153
- listAuthorizationsForApp,
154
- getAuthorizationById,
155
- getOAuthTokens,
156
- init_oauth,
157
- LEARNING_TTL_DAYS,
158
- LEARNING_DUPLICATE_MIN_SIMILARITY,
159
- CANDIDATE_SET_MULTIPLIER,
160
- isGraphExpansionEnabled,
161
- init_constants2,
162
- LONGTERM_ROOT,
163
- LEARNINGS_ROOT,
164
- MEMORY_KEY_PATTERN,
165
- MEMORY_KEY_PATTERN_MESSAGE,
166
- MEMORY_KEY_MAX_LENGTH,
167
- isLongtermKey,
168
- longtermKeyError,
169
- isConsolidatedKey,
170
- consolidatedKeyMessage,
171
- resolveStoreKey,
172
- init_key_paths,
173
- computeScore,
174
- rerank,
175
- init_reranker,
176
- searchMemoryCandidates,
177
- init_search_candidates,
178
- rowToCandidate,
179
- init_sqlite_store,
180
- getEmbeddingProvider2,
181
- getMemoryStore2,
182
- init_memory,
183
- embedScript2,
184
- init_embeddings,
185
- upsertScriptByName,
186
- getScript,
187
- getScriptById,
188
- getScriptVersion,
189
- deleteScript,
190
- touchScratchScriptLastUsed,
191
- restoreScratchScriptLastUsedIfUnchanged,
192
- init_db3,
193
- getWorkflowRunTriggeredByAgentId,
194
- getWorkflowRunSummary,
195
- getWorkflowRunStepsSlimByRunId,
196
- getRunLineageBlock,
197
- getWorkflowRunStatus,
198
- disarmWorkflowTreeRetries,
199
- getRunningSubWorkflowSteps,
200
- getSettledChildRunParentSteps,
201
- init_workflow_runs,
202
203
  SteeringRequestError,
203
204
  SteeringBlockedError,
204
205
  isSteeringEnabled,
205
206
  carryUnhandledSteering,
206
207
  requestSteering,
207
208
  init_steering2,
209
+ computeContentHash2,
210
+ getContextVersion2,
211
+ getContextVersionHistory2,
212
+ AssetKeyMovesBlockedError2,
213
+ assertAssetKeyMovesAllowed2,
214
+ moveSessionChains,
215
+ init_session_moves,
216
+ onTaskStarted,
217
+ init_task_lifecycle_events,
208
218
  getPendingTaskForAgent2,
209
219
  startTask2,
210
220
  updateTaskClaudeSessionId2,
@@ -357,6 +367,7 @@ import {
357
367
  createUser2,
358
368
  updateUser2,
359
369
  deleteUser2,
370
+ getRootTaskChain2,
360
371
  getBudget2,
361
372
  getDailySpendForAgent2,
362
373
  getDailySpendGlobal2,
@@ -376,27 +387,27 @@ import {
376
387
  recordInlineScriptRun2,
377
388
  exports_db,
378
389
  init_db4
379
- } from "./cli-h9yy18gy.js";
390
+ } from "./cli-ctx0b85j.js";
380
391
  import {
381
392
  assertMayActOnOperatorGrantedTarget2,
382
393
  getUserGrant2,
383
394
  init_rbac_roles
384
- } from "./cli-n5t077me.js";
395
+ } from "./cli-pb2ay3sh.js";
385
396
  import {
386
397
  ensurePricingSeeded2,
387
398
  ensureRbacSeeded2,
388
399
  ensureModelProfilesSeeded2,
389
400
  init_boot_seeds
390
- } from "./cli-k2rw11py.js";
401
+ } from "./cli-b91nz213.js";
391
402
  import {
392
403
  requestModelCatalogRefresh2,
393
404
  startPricingRefreshLoop2,
394
405
  init_pricing_refresh
395
- } from "./cli-0vksaxvr.js";
406
+ } from "./cli-dgs10ttj.js";
396
407
  import {
397
408
  workflowEventBus2,
398
409
  init_event_bus
399
- } from "./cli-emekyyhr.js";
410
+ } from "./cli-q2d3e1k1.js";
400
411
  import {
401
412
  slackCode,
402
413
  slackMissingScopeMessage,
@@ -405,7 +416,11 @@ import {
405
416
  externalChannelToolError2,
406
417
  getChannelBlockReason2,
407
418
  init_external_channel
408
- } from "./cli-zeaehgyd.js";
419
+ } from "./cli-xag7btpe.js";
420
+ import {
421
+ tableToAscii2,
422
+ init_dist8
423
+ } from "./cli-9w8712tq.js";
409
424
  import {
410
425
  noteSlackInboundSideEffect,
411
426
  init_inbound_dispatch,
@@ -435,8 +450,23 @@ import {
435
450
  getTaskCitations,
436
451
  hasTaskCitationCheckRefusal,
437
452
  init_task_citations2,
453
+ getTaskUiSpec,
454
+ upsertTaskUiSpec,
455
+ hasTaskUiSpecCheckRefusal,
456
+ init_task_ui_spec,
457
+ standardComponentDefinitions,
458
+ CardSpecError,
459
+ toCard,
460
+ init_dist5,
461
+ UI_SPEC_ACTION_ID,
462
+ UI_SPEC_CARD_LIMITS,
463
+ init_task_ui_spec2,
464
+ validateTaskUiSpec,
465
+ init_validate2,
438
466
  ensure,
439
467
  init_business_use,
468
+ withUiSpecFallback,
469
+ init_fallback,
440
470
  getAgentDisplayName,
441
471
  getAgentSlackIcon,
442
472
  init_responses,
@@ -444,7 +474,28 @@ import {
444
474
  startSlackApp2,
445
475
  stopSlackAppUnderLifecycleLock2,
446
476
  init_app3
447
- } from "./cli-mwwmka77.js";
477
+ } from "./cli-pyjn0qhk.js";
478
+ import {
479
+ AGENT_MAX_TASKS_CONFIG_KEY,
480
+ resetAgentMaxTasksMirror,
481
+ upsertSwarmConfigWithPolicyMirror,
482
+ runtimeStaleThresholdMinutes,
483
+ getRuntimeInstanceById,
484
+ markRuntimeTerminated,
485
+ touchRuntimeInstance,
486
+ markRuntimeInstanceOffline,
487
+ reconcileAgentStatusFromRuntimes,
488
+ listRuntimeInstancesForPool,
489
+ init_multi_runtime,
490
+ ConfigQuestionSettingsSchema,
491
+ normalizeApprovalQuestions,
492
+ init_approval_config_question,
493
+ resolveSlackConversationId,
494
+ init_dm,
495
+ postApprovalCancellationUpdates2,
496
+ createApprovalFollowUpTask2,
497
+ init_approval_notifications
498
+ } from "./cli-jkw6ptfw.js";
448
499
  import {
449
500
  shapeApprovalResolution,
450
501
  init_approval_resolution,
@@ -468,7 +519,7 @@ import {
468
519
  resumeFromChildRun2,
469
520
  initWaitBusSubscriptions2,
470
521
  init_resume
471
- } from "./cli-sdvcrq5x.js";
522
+ } from "./cli-1jykg0py.js";
472
523
  import {
473
524
  FilesError,
474
525
  providerPath,
@@ -479,14 +530,10 @@ import {
479
530
  getFileStorageProvider2,
480
531
  init_registry2
481
532
  } from "./cli-7cp6aa1q.js";
482
- import {
483
- tableToAscii2,
484
- init_dist4
485
- } from "./cli-x6t50dmw.js";
486
533
  import {
487
534
  getRuntimePool2,
488
535
  init_db2
489
- } from "./cli-rjvsf9qa.js";
536
+ } from "./cli-mkwkwq81.js";
490
537
  import {
491
538
  duplicateGuardedQueryKey,
492
539
  parseQueryParams,
@@ -500,7 +547,10 @@ import {
500
547
  getSessionRoot,
501
548
  sessionAccessForRoot,
502
549
  init_session_shares,
550
+ resolveCallerTask,
551
+ resolveTaskGroupKey,
503
552
  resolveTaskAuditUserId,
553
+ resolveHttpAuditUserId,
504
554
  init_audit_user,
505
555
  resolveHttpFavoriteOwner,
506
556
  init_favorite_owner,
@@ -519,13 +569,13 @@ import {
519
569
  findRoute,
520
570
  route,
521
571
  init_route_def
522
- } from "./cli-sg27rk2t.js";
572
+ } from "./cli-nbt14he0.js";
523
573
  import {
524
574
  COMPOSIO_HTTP_METHODS,
525
575
  executeComposioRequest,
526
576
  composioArgsFromParts,
527
577
  init_composio
528
- } from "./cli-pe4d96rb.js";
578
+ } from "./cli-7zm3b3f5.js";
529
579
  import {
530
580
  object,
531
581
  init_v4_mini
@@ -544,7 +594,7 @@ import {
544
594
  init_llm
545
595
  } from "./cli-2xv18ywz.js";
546
596
  import {
547
- require_dist2,
597
+ require_dist,
548
598
  ConnectionAuthInputSchema,
549
599
  listRelationalCredentialBindings,
550
600
  upsertCredentialBinding,
@@ -621,7 +671,7 @@ import {
621
671
  init_typecheck,
622
672
  parseSkillContent,
623
673
  init_skill_parser
624
- } from "./cli-z8cvws4c.js";
674
+ } from "./cli-2yjj3e31.js";
625
675
  import {
626
676
  detachedProcessGroup,
627
677
  registerProcessGroup,
@@ -636,10 +686,24 @@ import {
636
686
  ensureToken,
637
687
  ensureTokenOrThrow,
638
688
  init_ensure_token
639
- } from "./cli-s8p8hhty.js";
689
+ } from "./cli-jm0hvmz2.js";
640
690
  import {
641
691
  require_fast_deep_equal
642
692
  } from "./cli-bhp11egn.js";
693
+ import {
694
+ ZodFirstPartyTypeKind,
695
+ objectType,
696
+ init_v3
697
+ } from "./cli-ytyvpye5.js";
698
+ import {
699
+ init_v4
700
+ } from "./cli-3kd08rej.js";
701
+ import {
702
+ SLACK_LEAVE_THREAD_DISABLE,
703
+ isSlackLeaveThreadDisabled,
704
+ leaveSlackThread,
705
+ init_left_threads
706
+ } from "./cli-br0924pw.js";
643
707
  import {
644
708
  notifyAutomationPreflightFailure,
645
709
  init_automation_preflight_alert,
@@ -652,23 +716,6 @@ import {
652
716
  init_automation_preflight,
653
717
  BaseExecutor,
654
718
  init_base,
655
- AGENT_MAX_TASKS_CONFIG_KEY,
656
- resetAgentMaxTasksMirror,
657
- upsertSwarmConfigWithPolicyMirror,
658
- getRuntimeInstanceById,
659
- markRuntimeTerminated,
660
- touchRuntimeInstance,
661
- markRuntimeInstanceOffline,
662
- reconcileAgentStatusFromRuntimes,
663
- init_multi_runtime,
664
- ConfigQuestionSettingsSchema,
665
- normalizeApprovalQuestions,
666
- init_approval_config_question,
667
- resolveSlackConversationId,
668
- init_dm,
669
- postApprovalCancellationUpdates,
670
- createApprovalFollowUpTask,
671
- init_approval_notifications,
672
719
  HumanInTheLoopExecutor,
673
720
  init_human_in_the_loop,
674
721
  resolveWorkflowLlmConfig,
@@ -731,36 +778,26 @@ import {
731
778
  validateDefinition,
732
779
  applyDefinitionPatch,
733
780
  init_definition2
734
- } from "./cli-c3ng0mb4.js";
781
+ } from "./cli-j7svy295.js";
735
782
  import {
736
783
  isMultiRuntimeEnabled,
737
784
  init_multi_runtime2
738
785
  } from "./cli-mdb054w3.js";
739
786
  import {
740
- ZodFirstPartyTypeKind,
741
- objectType,
742
- init_v3
743
- } from "./cli-ytyvpye5.js";
744
- import {
745
- init_v4
746
- } from "./cli-3kd08rej.js";
787
+ require_dist2
788
+ } from "./cli-xf1wn5ns.js";
747
789
  import {
748
- require_dist3
749
- } from "./cli-k28wkapa.js";
790
+ getApiKey,
791
+ init_api_key
792
+ } from "./cli-pax9q4ff.js";
750
793
  import {
751
- SLACK_LEAVE_THREAD_DISABLE,
752
- isSlackLeaveThreadDisabled,
753
- leaveSlackThread,
754
- init_left_threads
755
- } from "./cli-s7zz734a.js";
794
+ canProvisionKind,
795
+ init_runtime_providers
796
+ } from "./cli-6945ywhr.js";
756
797
  import {
757
798
  publicEndpointSsrfOptions,
758
799
  init_mcp_wrapper
759
- } from "./cli-qmqt520k.js";
760
- import {
761
- canProvisionKind,
762
- init_runtime_providers
763
- } from "./cli-t5ys4ebm.js";
800
+ } from "./cli-2dq9yv8p.js";
764
801
  import {
765
802
  findUserById,
766
803
  findUserByExternalId,
@@ -775,10 +812,12 @@ import {
775
812
  resolveSessionToken,
776
813
  fingerprintApiKey,
777
814
  init_users
778
- } from "./cli-c71n3bxq.js";
815
+ } from "./cli-v57d7fmm.js";
779
816
  import {
780
817
  normalizeAssetKey,
818
+ defaultAssetKey,
781
819
  SESSION_RESOURCE_KINDS,
820
+ isGroupKey,
782
821
  sessionResourceGroupOf,
783
822
  sessionGroupKey,
784
823
  parseAssetKey,
@@ -793,7 +832,7 @@ import {
793
832
  init_import,
794
833
  $OpenAPIRegistry,
795
834
  $OpenApiGeneratorV31,
796
- init_dist7,
835
+ init_dist9,
797
836
  init_zod_openapi,
798
837
  AssetKeySchema,
799
838
  ModelTierSchema,
@@ -823,6 +862,7 @@ import {
823
862
  AgentMemorySourceSchema,
824
863
  RuntimePoolUpdateSchema,
825
864
  RuntimePoolCreateAgentSchema,
865
+ SUPERSEDED_WORKFLOW_TASK_REASON,
826
866
  WorkflowDefinitionSchema,
827
867
  WorkflowNodePatchSchema,
828
868
  TriggerConfigSchema,
@@ -843,8 +883,15 @@ import {
843
883
  KvValueTypeSchema,
844
884
  KvNamespaceSchema,
845
885
  KvKeySchema,
846
- init_types4
847
- } from "./cli-qps8je6j.js";
886
+ init_types5
887
+ } from "./cli-bkjdknnp.js";
888
+ import {
889
+ resolveGitHubHost,
890
+ getGitHubLinkConfig,
891
+ getGitHubGraphqlUrl,
892
+ githubApiUrl,
893
+ init_github_host
894
+ } from "./cli-9ttx00s3.js";
848
895
  import {
849
896
  generateDefaultClaudeMd2,
850
897
  generateDefaultSoulMd2,
@@ -855,7 +902,7 @@ import {
855
902
  init_task_attachment_links,
856
903
  contentSha256,
857
904
  init_profile_sync
858
- } from "./cli-am1ptset.js";
905
+ } from "./cli-m7c2380k.js";
859
906
  import {
860
907
  getSlackConfiguration,
861
908
  isSlackConfigured,
@@ -868,7 +915,7 @@ import {
868
915
  import {
869
916
  selectCredential,
870
917
  init_credentials2
871
- } from "./cli-t4dv07kr.js";
918
+ } from "./cli-psffsanb.js";
872
919
  import {
873
920
  findInterpolationTokens,
874
921
  interpolate,
@@ -878,7 +925,7 @@ import {
878
925
  init_registry3,
879
926
  resolveTemplate,
880
927
  init_resolver
881
- } from "./cli-0bcgyj5b.js";
928
+ } from "./cli-6ehs4mta.js";
882
929
  import {
883
930
  init_zod
884
931
  } from "./cli-zcfpsfzf.js";
@@ -910,14 +957,6 @@ import {
910
957
  datetime,
911
958
  number3
912
959
  } from "./cli-hg42n3hx.js";
913
- import {
914
- init_package,
915
- package_default
916
- } from "./cli-922z7gwm.js";
917
- import {
918
- realtimeBus,
919
- init_bus
920
- } from "./cli-syfdvhkc.js";
921
960
  import {
922
961
  MAX_PROFILE_FILE_LENGTH,
923
962
  getConfiguredAppUrls,
@@ -930,21 +969,25 @@ import {
930
969
  getCombState,
931
970
  isAgentFsProxyEnabled,
932
971
  init_constants3
933
- } from "./cli-dns0y538.js";
972
+ } from "./cli-dqgnbnxs.js";
934
973
  import {
935
974
  parseEnvFlag,
936
975
  isEnvFlagEnabled,
937
976
  init_env_flag
938
977
  } from "./cli-cebvbc9t.js";
978
+ import {
979
+ init_package,
980
+ package_default
981
+ } from "./cli-h9yqfzx9.js";
939
982
  import {
940
983
  getNodeEnv,
941
984
  isDevOrTestNodeEnv,
942
985
  init_node_env
943
986
  } from "./cli-rgeadyvq.js";
944
987
  import {
945
- getApiKey,
946
- init_api_key
947
- } from "./cli-pax9q4ff.js";
988
+ realtimeBus,
989
+ init_bus
990
+ } from "./cli-syfdvhkc.js";
948
991
  import {
949
992
  openAICompatibleProviderIds,
950
993
  init_src2,
@@ -955,7 +998,7 @@ import {
955
998
  registerVolatileSecret,
956
999
  registerSensitiveKeyName,
957
1000
  init_secret_scrubber
958
- } from "./cli-f1kwb5fc.js";
1001
+ } from "./cli-5a6pqy45.js";
959
1002
  import {
960
1003
  __toESM,
961
1004
  __commonJS,
@@ -10702,7 +10745,7 @@ var require_limit = __commonJS(function(exports) {
10702
10745
  });
10703
10746
 
10704
10747
  // node_modules/ajv-formats/dist/index.js
10705
- var require_dist = __commonJS(function(exports, module) {
10748
+ var require_dist3 = __commonJS(function(exports, module) {
10706
10749
  Object.defineProperty(exports, "__esModule", { value: true });
10707
10750
  var formats_1 = require_formats();
10708
10751
  var limit_1 = require_limit();
@@ -10780,7 +10823,7 @@ class AjvJsonSchemaValidator {
10780
10823
  var import_ajv, import_ajv_formats;
10781
10824
  var init_ajv_provider = __esm(() => {
10782
10825
  import_ajv = __toESM(require_ajv(), 1);
10783
- import_ajv_formats = __toESM(require_dist(), 1);
10826
+ import_ajv_formats = __toESM(require_dist3(), 1);
10784
10827
  });
10785
10828
 
10786
10829
  // node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
@@ -12132,6 +12175,14 @@ function initGitHub() {
12132
12175
  console.log("[GitHub] Disabled via GITHUB_DISABLE");
12133
12176
  return false;
12134
12177
  }
12178
+ const host = resolveGitHubHost();
12179
+ if (!host.ok) {
12180
+ console.error(`[GitHub] ${host.error}; GitHub integration disabled`);
12181
+ return false;
12182
+ }
12183
+ if (host.warning)
12184
+ console.warn(`[GitHub] ${host.warning}`);
12185
+ console.log(`[GitHub] Host: web ${host.config.webUrl}, API ${host.config.apiUrl}`);
12135
12186
  webhookSecret = process.env.GITHUB_WEBHOOK_SECRET ?? null;
12136
12187
  if (!webhookSecret) {
12137
12188
  console.log("[GitHub] Missing GITHUB_WEBHOOK_SECRET, GitHub integration disabled");
@@ -12226,7 +12277,7 @@ async function getInstallationToken(installationId) {
12226
12277
  return null;
12227
12278
  }
12228
12279
  try {
12229
- const response = await fetch(`https://api.github.com/app/installations/${installationId}/access_tokens`, {
12280
+ const response = await fetch(githubApiUrl(`/app/installations/${installationId}/access_tokens`), {
12230
12281
  method: "POST",
12231
12282
  headers: {
12232
12283
  Accept: "application/vnd.github+json",
@@ -12252,6 +12303,7 @@ async function getInstallationToken(installationId) {
12252
12303
  var initialized = false, webhookSecret = null, appId = null, privateKey = null, tokenCache;
12253
12304
  var init_app4 = __esm(() => {
12254
12305
  init_env_flag();
12306
+ init_github_host();
12255
12307
  tokenCache = new Map;
12256
12308
  });
12257
12309
 
@@ -12274,7 +12326,7 @@ async function postRestReaction(repo, target, reaction, installationId, label) {
12274
12326
  if (!token)
12275
12327
  return false;
12276
12328
  try {
12277
- const response = await fetch(`https://api.github.com/repos/${repo}/${target}/reactions`, {
12329
+ const response = await fetch(githubApiUrl(`/repos/${repo}/${target}/reactions`), {
12278
12330
  method: "POST",
12279
12331
  headers: {
12280
12332
  Accept: "application/vnd.github+json",
@@ -12310,7 +12362,7 @@ async function addGraphQLReaction(nodeId, reaction, installationId) {
12310
12362
  if (!token)
12311
12363
  return false;
12312
12364
  try {
12313
- const response = await fetch("https://api.github.com/graphql", {
12365
+ const response = await fetch(getGitHubGraphqlUrl(), {
12314
12366
  method: "POST",
12315
12367
  headers: {
12316
12368
  Authorization: `Bearer ${token}`,
@@ -12345,6 +12397,7 @@ async function addGraphQLReaction(nodeId, reaction, installationId) {
12345
12397
  }
12346
12398
  }
12347
12399
  var init_reactions = __esm(() => {
12400
+ init_github_host();
12348
12401
  init_secret_scrubber();
12349
12402
  init_app4();
12350
12403
  });
@@ -19352,8 +19405,8 @@ var require_HttpErrors = __commonJS(function(exports) {
19352
19405
  var require_webhook = __commonJS(function(exports) {
19353
19406
  Object.defineProperty(exports, "__esModule", { value: true });
19354
19407
  exports.Webhook = exports.WebhookVerificationError = undefined;
19355
- var standardwebhooks_1 = require_dist3();
19356
- var standardwebhooks_2 = require_dist3();
19408
+ var standardwebhooks_1 = require_dist2();
19409
+ var standardwebhooks_2 = require_dist2();
19357
19410
  Object.defineProperty(exports, "WebhookVerificationError", { enumerable: true, get: function() {
19358
19411
  return standardwebhooks_2.WebhookVerificationError;
19359
19412
  } });
@@ -19894,7 +19947,7 @@ ${issues.join(`
19894
19947
  return parsed.data;
19895
19948
  }
19896
19949
  var init_manifest_format = __esm(() => {
19897
- init_types4();
19950
+ init_types5();
19898
19951
  });
19899
19952
 
19900
19953
  // src/workflows/recovery.ts
@@ -20303,7 +20356,7 @@ function startRetryPoller(registry, intervalMs = 5000) {
20303
20356
  if (!waiting)
20304
20357
  continue;
20305
20358
  if (result.waitFor === "workflow.child.finished") {
20306
- const { resumeFromChildRun } = await import("./resume-w1s1eh5v.js");
20359
+ const { resumeFromChildRun } = await import("./resume-5ep8agan.js");
20307
20360
  await resumeFromChildRun(step.id, registry);
20308
20361
  }
20309
20362
  } else {
@@ -20773,21 +20826,6 @@ var init_wait_poller = __esm(() => {
20773
20826
  init_resume();
20774
20827
  });
20775
20828
 
20776
- // src/tasks/errors.ts
20777
- var TaskCreationBlockedError;
20778
- var init_errors2 = __esm(() => {
20779
- TaskCreationBlockedError = class TaskCreationBlockedError extends Error {
20780
- reason;
20781
- extension;
20782
- constructor(reason, extension) {
20783
- super(reason);
20784
- this.reason = reason;
20785
- this.extension = extension;
20786
- this.name = "TaskCreationBlockedError";
20787
- }
20788
- };
20789
- });
20790
-
20791
20829
  // src/workflows/executors/agent-task.ts
20792
20830
  var AgentTaskConfigSchema, AgentTaskOutputSchema, AgentTaskExecutor;
20793
20831
  var init_agent_task = __esm(() => {
@@ -20797,7 +20835,7 @@ var init_agent_task = __esm(() => {
20797
20835
  init_apply_task_create();
20798
20836
  init_context_key();
20799
20837
  init_errors2();
20800
- init_types4();
20838
+ init_types5();
20801
20839
  init_base();
20802
20840
  AgentTaskConfigSchema = object2({
20803
20841
  template: string2(),
@@ -21049,7 +21087,7 @@ var init_notify = __esm(() => {
21049
21087
  }
21050
21088
  }
21051
21089
  case "slack": {
21052
- const { getSlackApp } = await import("./app-mkptw0k7.js");
21090
+ const { getSlackApp } = await import("./app-g2z15hax.js");
21053
21091
  let app = getSlackApp();
21054
21092
  if (!app) {
21055
21093
  if (!isSlackConfigured()) {
@@ -21182,7 +21220,7 @@ var init_property_match = __esm(() => {
21182
21220
  async function executeRawLlm(config) {
21183
21221
  let modelName = config.model ?? "google/gemini-3-flash-preview";
21184
21222
  try {
21185
- const { createOpenAI } = await import("./index-m5gx1xd6.js");
21223
+ const { createOpenAI } = await import("./index-9myfj74s.js");
21186
21224
  const llmConfig = await resolveWorkflowLlmConfig(config.model);
21187
21225
  modelName = llmConfig.model;
21188
21226
  const provider = createOpenAI({
@@ -21192,7 +21230,7 @@ async function executeRawLlm(config) {
21192
21230
  });
21193
21231
  const model = provider(llmConfig.model);
21194
21232
  if (config.schema) {
21195
- const { generateObject, jsonSchema } = await import("./index-0rvk3vd4.js");
21233
+ const { generateObject, jsonSchema } = await import("./index-b5wgnm78.js");
21196
21234
  const { object } = await generateObject({
21197
21235
  model,
21198
21236
  schema: jsonSchema(config.schema),
@@ -21206,7 +21244,7 @@ async function executeRawLlm(config) {
21206
21244
  output: { result: object, model: modelName }
21207
21245
  };
21208
21246
  }
21209
- const { generateText } = await import("./index-0rvk3vd4.js");
21247
+ const { generateText } = await import("./index-b5wgnm78.js");
21210
21248
  const { text } = await generateText({
21211
21249
  model,
21212
21250
  prompt: config.prompt
@@ -21687,7 +21725,7 @@ function validateJsonSchemaBasic(value, schema) {
21687
21725
  return errors;
21688
21726
  }
21689
21727
  var ValidateConfigSchema, ValidateOutputSchema, ValidateExecutor;
21690
- var init_validate2 = __esm(() => {
21728
+ var init_validate3 = __esm(() => {
21691
21729
  init_zod();
21692
21730
  init_base();
21693
21731
  init_workflow_llm();
@@ -21766,8 +21804,8 @@ var init_validate2 = __esm(() => {
21766
21804
  const interpolatedPrompt = this.deps.interpolate(prompt, context);
21767
21805
  const outputStr = typeof targetOutput === "string" ? targetOutput : JSON.stringify(targetOutput);
21768
21806
  try {
21769
- const { createOpenAI } = await import("./index-m5gx1xd6.js");
21770
- const { generateObject, jsonSchema } = await import("./index-0rvk3vd4.js");
21807
+ const { createOpenAI } = await import("./index-9myfj74s.js");
21808
+ const { generateObject, jsonSchema } = await import("./index-b5wgnm78.js");
21771
21809
  const llmConfig = await resolveWorkflowLlmConfig();
21772
21810
  const provider = createOpenAI({
21773
21811
  baseURL: llmConfig.baseURL,
@@ -21926,7 +21964,7 @@ var init_registry = __esm(() => {
21926
21964
  init_swarm_script();
21927
21965
  init_system_one_decision();
21928
21966
  init_system_one_extraction();
21929
- init_validate2();
21967
+ init_validate3();
21930
21968
  init_vcs();
21931
21969
  init_wait();
21932
21970
  });
@@ -22072,7 +22110,7 @@ async function resolveWaitCause(scheduleId, reason) {
22072
22110
  return;
22073
22111
  if (reason === "ceiling")
22074
22112
  return { wait, cause: "ceiling expired", matchedTaskIds: [] };
22075
- const members = await client.query(`SELECT m.taskId, t.status AS taskStatus, EXISTS (
22113
+ const members = await client.query(`SELECT m.taskId, ${WAIT_MEMBER_STATUS_SQL} AS taskStatus, EXISTS (
22076
22114
  SELECT 1 FROM scheduled_tasks d
22077
22115
  WHERE d.parentTaskId = t.id AND d.taskType = 'deferred' AND d.enabled = 1
22078
22116
  ) AS deferred
@@ -22189,16 +22227,17 @@ async function reconcileDeferredTaskWaits(taskId) {
22189
22227
  });
22190
22228
  return reconcileDeferredTaskWaits();
22191
22229
  }
22192
- const rows = await client.query(`SELECT DISTINCT w.*, t.status AS taskStatus FROM deferred_task_waits w
22230
+ const rows = await client.query(`SELECT DISTINCT w.*, ${WAIT_MEMBER_STATUS_SQL} AS taskStatus FROM deferred_task_waits w
22193
22231
  JOIN deferred_task_wait_members m ON m.scheduleId = w.scheduleId
22194
22232
  JOIN agent_tasks t ON t.id = m.taskId
22195
22233
  JOIN scheduled_tasks s ON s.id = w.scheduleId
22196
- WHERE w.status = 'pending' AND s.enabled = 1 AND t.status IN ('completed', 'failed', 'cancelled', 'skipped')
22234
+ WHERE w.status = 'pending' AND s.enabled = 1
22235
+ AND ${WAIT_MEMBER_STATUS_SQL} IN ('completed', 'failed', 'cancelled', 'skipped')
22197
22236
  AND NOT EXISTS (
22198
22237
  SELECT 1 FROM scheduled_tasks d
22199
22238
  WHERE d.parentTaskId = t.id AND d.taskType = 'deferred' AND d.enabled = 1
22200
22239
  )
22201
- AND (w.eventName = 'settled' OR w.eventName = 'task.' || t.status)
22240
+ AND (w.eventName = 'settled' OR w.eventName = 'task.' || ${WAIT_MEMBER_STATUS_SQL})
22202
22241
  ${taskId ? "AND m.taskId = ?" : ""}`, taskId ? [taskId] : []);
22203
22242
  for (const row of rows) {
22204
22243
  try {
@@ -22244,11 +22283,15 @@ function stopDeferredTaskWaits() {
22244
22283
  workflowEventBus2.off("task.superseded", onTaskEvent);
22245
22284
  workflowEventBus2.off("task.created", onTaskEvent);
22246
22285
  }
22247
- var DEFERRED_WAIT_WOKE_EVENT = "task_deferred_wait_woke", SPENT_DEFERRED_SCHEDULE_RETENTION_MS;
22286
+ var WAIT_MEMBER_STATUS_SQL, DEFERRED_WAIT_WOKE_EVENT = "task_deferred_wait_woke", SPENT_DEFERRED_SCHEDULE_RETENTION_MS;
22248
22287
  var init_deferred_task_waits = __esm(() => {
22249
22288
  init_db4();
22289
+ init_types5();
22250
22290
  init_event_bus();
22251
22291
  init_schedule_task();
22292
+ WAIT_MEMBER_STATUS_SQL = `CASE
22293
+ WHEN t.status = 'superseded' AND t.failureReason = '${SUPERSEDED_WORKFLOW_TASK_REASON}' THEN 'failed'
22294
+ ELSE t.status END`;
22252
22295
  SPENT_DEFERRED_SCHEDULE_RETENTION_MS = 30 * 24 * 60 * 60 * 1000;
22253
22296
  });
22254
22297
 
@@ -22686,7 +22729,7 @@ var init_scheduler = __esm(() => {
22686
22729
  init_deferred_task_waits();
22687
22730
  init_schedule_task();
22688
22731
  init_schedule_task();
22689
- import_cron_parser = __toESM(require_dist2(), 1);
22732
+ import_cron_parser = __toESM(require_dist(), 1);
22690
22733
  DEFERRED_REAP_INTERVAL_MS = 60 * 60 * 1000;
22691
22734
  AutomationNeedsSetupError = class AutomationNeedsSetupError extends Error {
22692
22735
  failureReason;
@@ -22762,7 +22805,7 @@ function liveWorkflowSpec(workflow) {
22762
22805
  triggerSchema: workflow.triggerSchema ?? null
22763
22806
  };
22764
22807
  }
22765
- function skillSpecOf(content, parsed) {
22808
+ function skillSpecOf(content, parsed, hasFiles) {
22766
22809
  return {
22767
22810
  name: parsed.name,
22768
22811
  description: parsed.description,
@@ -22781,7 +22824,7 @@ function skillSpecOf(content, parsed) {
22781
22824
  sourcePath: null,
22782
22825
  sourceBranch: "main",
22783
22826
  sourceHash: null,
22784
- isComplex: false
22827
+ isComplex: hasFiles
22785
22828
  };
22786
22829
  }
22787
22830
  function liveSkillSpec(skill) {
@@ -22917,7 +22960,7 @@ async function preflightAssets(manifest, files) {
22917
22960
  path: path.slice(filesPrefix.length),
22918
22961
  content: fileContent
22919
22962
  })).sort((a, b) => a.path.localeCompare(b.path));
22920
- const spec = skillSpecOf(content, parsed);
22963
+ const spec = skillSpecOf(content, parsed, skillFiles.length > 0);
22921
22964
  skills.push({
22922
22965
  kind: "skill",
22923
22966
  name: parsed.name,
@@ -24473,7 +24516,7 @@ function setPreloadedTools(server, names) {
24473
24516
  async function applyPreToolCall(name, args, requestInfo, inputSchema) {
24474
24517
  if (requestInfo.callOrigin !== "mcp")
24475
24518
  return { args };
24476
- const dispatcher = await import("./dispatcher-9tq2zzdj.js");
24519
+ const dispatcher = await import("./dispatcher-31sm0ej2.js");
24477
24520
  const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
24478
24521
  validateModify: async (data) => {
24479
24522
  const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
@@ -24725,7 +24768,7 @@ var init_utils = __esm(() => {
24725
24768
  init_otel();
24726
24769
  init_color_literals();
24727
24770
  init_types3();
24728
- init_types4();
24771
+ init_types5();
24729
24772
  init_secret_scrubber();
24730
24773
  scriptSdkRequestOrigins = new WeakSet;
24731
24774
  extensionRequestOrigins = new WeakSet;
@@ -25666,7 +25709,7 @@ async function bridgeFetch(url, init, { repeatSafe, readOnly }, signal) {
25666
25709
  }
25667
25710
  const delay = backoffMs(attempt, BRIDGE_MIN_DELAY_MS, BRIDGE_MAX_DELAY_MS);
25668
25711
  const aborted = signal?.aborted || error instanceof Error && error.name === "AbortError";
25669
- if (aborted || !repeatSafe || attempt > BRIDGE_MAX_RETRIES || !fits(delay))
25712
+ if (aborted || !repeatSafe || attempt > BRIDGE_MAX_RETRIES || readOnly && !fits(delay))
25670
25713
  throw error;
25671
25714
  previous = { error };
25672
25715
  await sleep2(delay, signal);
@@ -25678,7 +25721,7 @@ async function bridgeFetch(url, init, { repeatSafe, readOnly }, signal) {
25678
25721
  if (!retryable || attempt > BRIDGE_MAX_RETRIES || signal?.aborted)
25679
25722
  return res;
25680
25723
  const delay = (res.status === 429 ? retryAfterMs(res.headers.get("retry-after")) : undefined) ?? backoffMs(attempt, BRIDGE_MIN_DELAY_MS, BRIDGE_MAX_DELAY_MS);
25681
- if (!fits(delay))
25724
+ if ((readOnly || res.status === 429) && !fits(delay))
25682
25725
  return res;
25683
25726
  await res.body?.cancel().catch(() => {});
25684
25727
  previous = { response: res };
@@ -25979,7 +26022,7 @@ var EXTENSIONS_TMP_PARENT, EXTENSIONS_TMP_ROOT, ExtensionConfigError, successful
25979
26022
  var init_loader = __esm(() => {
25980
26023
  init_db();
25981
26024
  init_native();
25982
- init_types4();
26025
+ init_types5();
25983
26026
  init_secret_scrubber();
25984
26027
  init_bundle_path();
25985
26028
  EXTENSIONS_TMP_PARENT = `${tmpdir()}/swarm-extensions`;
@@ -26565,7 +26608,7 @@ var init_lifecycle = __esm(() => {
26565
26608
  init_db4();
26566
26609
  init_assets();
26567
26610
  init_db();
26568
- init_types4();
26611
+ init_types5();
26569
26612
  init_secret_scrubber();
26570
26613
  init_dispatcher();
26571
26614
  init_identity2();
@@ -27188,7 +27231,7 @@ async function applyPreTaskCreate(args) {
27188
27231
  var MODIFIABLE_OPTION_KEYS, MODIFIABLE_OPTION_KEY_SET;
27189
27232
  var init_apply_task_create = __esm(() => {
27190
27233
  init_model_validation2();
27191
- init_types4();
27234
+ init_types5();
27192
27235
  init_secret_scrubber();
27193
27236
  init_event_bus();
27194
27237
  init_dispatcher();
@@ -27328,6 +27371,14 @@ var init_sibling_block = __esm(() => {
27328
27371
  });
27329
27372
 
27330
27373
  // src/tasks/sibling-awareness.ts
27374
+ function withoutThreadContext(description) {
27375
+ if (!description.startsWith("<thread_context>"))
27376
+ return description;
27377
+ const close = `
27378
+ </thread_context>`;
27379
+ const end = description.indexOf(close);
27380
+ return end === -1 ? description : description.slice(end + close.length).trimStart();
27381
+ }
27331
27382
  async function toSiblingTaskInfo(task) {
27332
27383
  const agent = task.agentId ? await getAgentById2(task.agentId) : null;
27333
27384
  return {
@@ -27335,7 +27386,7 @@ async function toSiblingTaskInfo(task) {
27335
27386
  status: task.status,
27336
27387
  agentId: task.agentId,
27337
27388
  agentName: agent?.name ?? null,
27338
- description: stripSiblingBlock(task.task),
27389
+ description: withoutThreadContext(stripSiblingBlock(task.task)),
27339
27390
  updatedAt: task.lastUpdatedAt,
27340
27391
  createdAt: task.createdAt
27341
27392
  };
@@ -29117,7 +29168,7 @@ var init_boards_sync = __esm(() => {
29117
29168
  init_resolver();
29118
29169
  init_context_key();
29119
29170
  init_sibling_awareness();
29120
- init_types4();
29171
+ init_types5();
29121
29172
  init_event_bus();
29122
29173
  init_api();
29123
29174
  init_auth3();
@@ -31025,7 +31076,7 @@ async function fetchPaginatedReviewComments(initialUrl, headers) {
31025
31076
  }
31026
31077
  }
31027
31078
  async function fetchReviewScopedComments(repo, prNumber, reviewId, headers) {
31028
- const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/reviews/${reviewId}/comments?per_page=100`;
31079
+ const url = githubApiUrl(`/repos/${repo}/pulls/${prNumber}/reviews/${reviewId}/comments?per_page=100`);
31029
31080
  let result = await fetchPaginatedReviewComments(url, headers);
31030
31081
  if (result.degraded || result.comments.length > 0) {
31031
31082
  return result;
@@ -31040,7 +31091,7 @@ async function fetchReviewScopedComments(repo, prNumber, reviewId, headers) {
31040
31091
  return result;
31041
31092
  }
31042
31093
  async function fetchPrLevelReviewComments(repo, prNumber, reviewId, headers) {
31043
- const url = `https://api.github.com/repos/${repo}/pulls/${prNumber}/comments?per_page=100`;
31094
+ const url = githubApiUrl(`/repos/${repo}/pulls/${prNumber}/comments?per_page=100`);
31044
31095
  const result = await fetchPaginatedReviewComments(url, headers);
31045
31096
  return {
31046
31097
  comments: result.comments.filter((comment) => comment.pull_request_review_id === reviewId),
@@ -31124,7 +31175,7 @@ async function fetchPrReviewActionCounts(repo, prNumber, installationId) {
31124
31175
  if (!token || !owner || !name)
31125
31176
  return null;
31126
31177
  try {
31127
- const response = await fetch("https://api.github.com/graphql", {
31178
+ const response = await fetch(getGitHubGraphqlUrl(), {
31128
31179
  method: "POST",
31129
31180
  headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" },
31130
31181
  body: JSON.stringify({
@@ -31278,6 +31329,7 @@ var init_handlers4 = __esm(() => {
31278
31329
  init_context_key();
31279
31330
  init_sibling_awareness();
31280
31331
  init_env_flag();
31332
+ init_github_host();
31281
31333
  init_app4();
31282
31334
  init_mentions();
31283
31335
  init_task_reactions();
@@ -32212,7 +32264,7 @@ async function loadAdapter(name, config, logger) {
32212
32264
  const base = { ...config, apiUrl, logger };
32213
32265
  switch (name) {
32214
32266
  case "telegram": {
32215
- const { TelegramAdapter } = await import("./index-gjwaqaq8.js");
32267
+ const { TelegramAdapter } = await import("./index-8p0j4h4j.js");
32216
32268
 
32217
32269
  class SwarmTelegramAdapter extends TelegramAdapter {
32218
32270
  isBotMentioned(message, text) {
@@ -32226,7 +32278,7 @@ async function loadAdapter(name, config, logger) {
32226
32278
  });
32227
32279
  }
32228
32280
  case "slack": {
32229
- const { createSlackAdapter } = await import("./index-2skqtd76.js");
32281
+ const { createSlackAdapter } = await import("./index-620y7jzq.js");
32230
32282
  return createSlackAdapter({
32231
32283
  ...base,
32232
32284
  signingSecret: config.signingSecret ?? "",
@@ -32236,7 +32288,7 @@ async function loadAdapter(name, config, logger) {
32236
32288
  });
32237
32289
  }
32238
32290
  case "discord": {
32239
- const { createDiscordAdapter } = await import("./index-d6wkh8ar.js");
32291
+ const { createDiscordAdapter } = await import("./index-0h6qd4p1.js");
32240
32292
  return createDiscordAdapter({
32241
32293
  ...base,
32242
32294
  logger: withInfoFilter(logger, keepDiscordInfoLine),
@@ -32245,7 +32297,7 @@ async function loadAdapter(name, config, logger) {
32245
32297
  });
32246
32298
  }
32247
32299
  case "teams": {
32248
- const { createTeamsAdapter } = await import("./index-khe3gp0k.js");
32300
+ const { createTeamsAdapter } = await import("./index-4k7m5dgj.js");
32249
32301
  const { teamsWebhookVerifier, teamsToken } = getChatSdkTestHooks();
32250
32302
  return createTeamsAdapter({
32251
32303
  ...base,
@@ -32454,7 +32506,7 @@ async function readPersistedThreadHistory(threadId) {
32454
32506
  const rows = await new SqliteChatState().getList(`${SDK_THREAD_HISTORY_PREFIX}${threadId}`);
32455
32507
  if (rows.length === 0)
32456
32508
  return [];
32457
- const { Message: MessageClass } = await import("./index-hjhfk3ra.js");
32509
+ const { Message: MessageClass } = await import("./index-pe3d8jfy.js");
32458
32510
  return rows.map((row) => MessageClass.fromJSON(row));
32459
32511
  }
32460
32512
  var SDK_THREAD_HISTORY_PREFIX = "msg-history:";
@@ -32481,7 +32533,7 @@ async function callTelegramBotApi(baseUrl, token, method, body) {
32481
32533
  const payload = await response.json().catch(() => null);
32482
32534
  if (!response.ok || !payload?.ok) {
32483
32535
  const description = payload?.description ?? `HTTP ${response.status}`;
32484
- throw new TelegramBotApiError(`Telegram ${method} failed: ${scrubSecrets(description.replaceAll(token, "[REDACTED]"))}`);
32536
+ throw new TelegramBotApiError(`Telegram ${method} failed: ${scrubSecrets(description.replaceAll(token, "[REDACTED]"))}`, response.status);
32485
32537
  }
32486
32538
  return payload.result;
32487
32539
  }
@@ -32490,8 +32542,10 @@ var init_telegram_api = __esm(() => {
32490
32542
  init_secret_scrubber();
32491
32543
  init_logger();
32492
32544
  TelegramBotApiError = class TelegramBotApiError extends Error {
32493
- constructor(message) {
32545
+ status;
32546
+ constructor(message, status) {
32494
32547
  super(message);
32548
+ this.status = status;
32495
32549
  this.name = "TelegramBotApiError";
32496
32550
  }
32497
32551
  };
@@ -33532,7 +33586,7 @@ function render(node) {
33532
33586
  }
33533
33587
  }
33534
33588
  var init_message_text2 = __esm(() => {
33535
- init_dist4();
33589
+ init_dist8();
33536
33590
  });
33537
33591
 
33538
33592
  // src/integrations/chat-sdk/limits.ts
@@ -33611,12 +33665,16 @@ function escapeTelegramHashLines(markdown) {
33611
33665
  }).join(`
33612
33666
  `);
33613
33667
  }
33614
- async function postChunks(adapter, target, parts, replyFirst) {
33668
+ async function postChunks(adapter, target, parts, replyFirst, card) {
33615
33669
  const messageIds = [];
33616
33670
  let threadId;
33617
33671
  const limit = chatMessageLimit(adapter);
33618
- for (const chunk of parts.flatMap((part) => splitChatMessage(part, limit))) {
33619
- const message = { markdown: adapter === "telegram" ? escapeTelegramHashLines(chunk) : chunk };
33672
+ const messages = parts.flatMap((part) => splitChatMessage(part, limit)).map((chunk) => ({
33673
+ markdown: adapter === "telegram" ? escapeTelegramHashLines(chunk) : chunk
33674
+ }));
33675
+ if (card)
33676
+ messages.push(card);
33677
+ for (const message of messages) {
33620
33678
  const sent = replyFirst && messageIds.length === 0 ? await replyFirst(message) : await target.post(message);
33621
33679
  messageIds.push(sent.id);
33622
33680
  threadId ??= sent.threadId;
@@ -33742,22 +33800,26 @@ function formatUnsentFilesNote(unsent) {
33742
33800
  return [`Could not send ${count}:`, ...lines].join(`
33743
33801
  `);
33744
33802
  }
33803
+ function scrubCard(card) {
33804
+ return JSON.parse(JSON.stringify(card, (_key, value) => typeof value === "string" ? scrubSecrets(value) : value));
33805
+ }
33745
33806
  async function postChatMessage(args) {
33746
33807
  assertTrustedChatTarget(args.threadId ?? args.channelId ?? "");
33747
33808
  const chat = getChatInstance(args.adapter);
33748
33809
  if (!chat)
33749
33810
  throw new ChatAdapterUnavailableError(args.adapter);
33750
33811
  const parts = (typeof args.text === "string" ? [args.text] : args.text).map(scrubSecrets);
33812
+ const card = args.card && scrubCard(args.card);
33751
33813
  const text = parts.join(`
33752
33814
 
33753
- `);
33815
+ `) || (card?.title ?? "");
33754
33816
  let result;
33755
33817
  let target;
33756
33818
  if (args.threadId) {
33757
33819
  const thread = chat.thread(args.threadId);
33758
33820
  target = thread;
33759
33821
  const replyTo = args.replyToMessageId;
33760
- const sent = await postChunks(args.adapter, thread, parts, replyTo && thread.adapter.reply ? (message) => thread.reply(replyTo, message) : undefined);
33822
+ const sent = await postChunks(args.adapter, thread, parts, replyTo && thread.adapter.reply ? (message) => thread.reply(replyTo, message) : undefined, card);
33761
33823
  result = {
33762
33824
  adapter: args.adapter,
33763
33825
  threadId: thread.id,
@@ -33768,7 +33830,7 @@ async function postChatMessage(args) {
33768
33830
  } else if (args.channelId) {
33769
33831
  const channel = chat.channel(args.channelId);
33770
33832
  target = channel;
33771
- const sent = await postChunks(args.adapter, channel, parts);
33833
+ const sent = await postChunks(args.adapter, channel, parts, undefined, card);
33772
33834
  result = {
33773
33835
  adapter: args.adapter,
33774
33836
  threadId: sent.threadId ?? channel.id,
@@ -33826,6 +33888,47 @@ var init_outbound2 = __esm(() => {
33826
33888
  NON_HEADING_HASH = /^( {0,3}(?:>[ \t]?)*[ \t]*(?:(?:[-*+]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?)?)(#{7,}|#{1,6}(?=[^\s#]))/;
33827
33889
  });
33828
33890
 
33891
+ // src/be/runtime-pools/demand.ts
33892
+ async function pendingWorkForAgent(agentId) {
33893
+ const rows = await getDbClient2().query(`SELECT * FROM agent_tasks WHERE (agentId = ? AND status = 'pending')
33894
+ OR (offeredTo = ? AND status = 'offered') ORDER BY priority DESC, createdAt, rowid`, [agentId, agentId]);
33895
+ const tasks = [];
33896
+ for (const row of rows) {
33897
+ const task = rowToAgentTask(row);
33898
+ if (task.status === "offered" || (await checkDependencies2(task.id)).ready)
33899
+ tasks.push(task);
33900
+ }
33901
+ const mentions = await getDbClient2().get(`SELECT COUNT(DISTINCT m.channelId) AS count FROM channel_messages m
33902
+ JOIN channels c ON c.id = m.channelId
33903
+ LEFT JOIN channel_read_state s ON s.channelId = m.channelId AND s.agentId = ?
33904
+ WHERE m.mentions LIKE ? AND s.processing_since IS NULL
33905
+ AND (s.lastReadAt IS NULL OR m.createdAt > s.lastReadAt)`, [agentId, `%"${agentId}"%`]);
33906
+ return { work: tasks.length + (mentions?.count ?? 0), topTask: tasks[0] ?? null };
33907
+ }
33908
+ function agentRuntimeLimit(maxTasks, slotsPerRuntime) {
33909
+ return Math.floor(maxTasks / slotsPerRuntime);
33910
+ }
33911
+ function countPoolRuntimes(runtimes, now, staleMinutes) {
33912
+ return runtimes.filter((r) => r.status === "provisioning" || r.status === "active" && Date.parse(r.lastSeenAt) >= now.getTime() - staleMinutes * 60000).length;
33913
+ }
33914
+ function computeDesired(pool, agents) {
33915
+ const desired = new Map;
33916
+ let remaining = Math.max(0, (pool.maxRuntimes ?? Infinity) - agents.reduce((n, a) => n + a.current, 0));
33917
+ for (const agent of agents) {
33918
+ const uncovered = Math.max(0, agent.work - agent.freeSlots - agent.provisioning * pool.slotsPerRuntime);
33919
+ const limit = agentRuntimeLimit(agent.maxTasks, pool.slotsPerRuntime);
33920
+ const count = Math.min(limit, Math.max(pool.minRuntimes, agent.current + Math.ceil(uncovered / pool.slotsPerRuntime)));
33921
+ const added = Math.min(remaining, Math.max(0, count - agent.current));
33922
+ desired.set(agent.agentId, Math.min(count, agent.current + added));
33923
+ remaining -= added;
33924
+ }
33925
+ return desired;
33926
+ }
33927
+ var init_demand = __esm(() => {
33928
+ init_db4();
33929
+ init_read();
33930
+ });
33931
+
33829
33932
  // src/be/runtime-pools/reachability.ts
33830
33933
  function isRuntimePoolWakeable(pool, now = new Date) {
33831
33934
  if (!pool.enabled || pool.circuitOpenUntil && Date.parse(pool.circuitOpenUntil) > now.getTime())
@@ -33845,11 +33948,36 @@ async function isAgentReachable(agent) {
33845
33948
  return await getDbClient2().get(`SELECT id FROM runtime_instances WHERE agent_id = ? AND pool_id = ?
33846
33949
  AND status = 'provisioning' AND draining = 0 LIMIT 1`, [agent.id, pool.id]) !== null;
33847
33950
  }
33951
+ async function isAgentOnDemand(agent, now = new Date) {
33952
+ if (agent.status !== "offline" || !agent.runtimePoolId)
33953
+ return false;
33954
+ if (!isRuntimePoolsEnabled() || !isMultiRuntimeEnabled())
33955
+ return false;
33956
+ const pool = await getRuntimePool2(agent.runtimePoolId);
33957
+ if (!pool?.enabled)
33958
+ return false;
33959
+ const runtimes = await listRuntimeInstancesForPool(pool.id);
33960
+ const own = runtimes.filter((r) => r.agentId === agent.id);
33961
+ if (own.some((r) => r.status === "provisioning" && !r.draining))
33962
+ return true;
33963
+ if (!isRuntimePoolWakeable(pool, now))
33964
+ return false;
33965
+ const staleMinutes = runtimeStaleThresholdMinutes();
33966
+ const limit = agentRuntimeLimit(agent.maxTasks ?? 1, pool.slotsPerRuntime);
33967
+ if (countPoolRuntimes(own, now, staleMinutes) >= limit)
33968
+ return false;
33969
+ if (pool.maxRuntimes === null)
33970
+ return true;
33971
+ return countPoolRuntimes(runtimes, now, staleMinutes) < pool.maxRuntimes;
33972
+ }
33848
33973
  var init_reachability = __esm(() => {
33849
33974
  init_runtime_providers();
33975
+ init_multi_runtime2();
33850
33976
  init_runtime_pools_flag();
33851
33977
  init_db4();
33978
+ init_multi_runtime();
33852
33979
  init_db2();
33980
+ init_demand();
33853
33981
  });
33854
33982
 
33855
33983
  // src/integrations/chat-sdk/router.ts
@@ -34796,6 +34924,65 @@ ${piece}
34796
34924
  ${block}` : block;
34797
34925
  });
34798
34926
  }
34927
+ function withoutCallbackButtons(children) {
34928
+ return children.flatMap((child) => {
34929
+ if (child.type === "section") {
34930
+ return [{ ...child, children: withoutCallbackButtons(child.children) }];
34931
+ }
34932
+ if (child.type !== "actions")
34933
+ return [child];
34934
+ const kept = child.children.filter((element) => element.type !== "button");
34935
+ return kept.length ? [{ ...child, children: kept }] : [];
34936
+ });
34937
+ }
34938
+ async function chatRelayUiSpec(taskId) {
34939
+ if (!isEnvFlagEnabled("UI_SPEC_ENABLED", false))
34940
+ return null;
34941
+ const stored = await getTaskUiSpec(taskId);
34942
+ if (!stored)
34943
+ return null;
34944
+ try {
34945
+ const card = toCard(stored.spec, {
34946
+ limits: UI_SPEC_CARD_LIMITS
34947
+ });
34948
+ return {
34949
+ card: { ...card, children: withoutCallbackButtons(card.children) },
34950
+ fallbackText: stored.fallbackText
34951
+ };
34952
+ } catch (error) {
34953
+ if (!(error instanceof CardSpecError))
34954
+ throw error;
34955
+ console.warn(`[chat-sdk] stored uiSpec for task ${taskId} no longer renders: ${error.issues.join(" | ")}`);
34956
+ return { card: null, fallbackText: stored.fallbackText };
34957
+ }
34958
+ }
34959
+ async function postChatRelayCard(adapter, threadId, task) {
34960
+ let uiSpec;
34961
+ try {
34962
+ uiSpec = await chatRelayUiSpec(task.id);
34963
+ } catch (error) {
34964
+ console.error(`[chat-sdk] uiSpec of task ${task.id} unreadable: ${errorMessage(error)}`);
34965
+ return;
34966
+ }
34967
+ if (!uiSpec)
34968
+ return;
34969
+ if (uiSpec.card) {
34970
+ try {
34971
+ await postChatMessage({ adapter, threadId, text: [], card: uiSpec.card, taskId: task.id });
34972
+ return;
34973
+ } catch (error) {
34974
+ console.warn(`[chat-sdk] Card post of task ${task.id} failed: ${errorMessage(error)}`);
34975
+ }
34976
+ }
34977
+ if (!uiSpec.fallbackText)
34978
+ return;
34979
+ try {
34980
+ const text = scrubSecrets(uiSpec.fallbackText);
34981
+ await postChatMessage({ adapter, threadId, text, taskId: task.id });
34982
+ } catch (error) {
34983
+ console.error(`[chat-sdk] Card fallback of task ${task.id} failed: ${errorMessage(error)}`);
34984
+ }
34985
+ }
34799
34986
  async function processPendingChatRelays(now = Date.now(), signal) {
34800
34987
  const retired = await giveUpStaleChatRelays2(now, RELAY_GIVE_UP_AFTER_MS);
34801
34988
  if (retired > 0)
@@ -34834,6 +35021,7 @@ async function processPendingChatRelays(now = Date.now(), signal) {
34834
35021
  files: await taskOutputChatFiles(task.id),
34835
35022
  replyToMessageId: task.mentionMessageId
34836
35023
  });
35024
+ await postChatRelayCard(target.adapter, target.threadId, task);
34837
35025
  stopTypingKeepalive(target.threadId);
34838
35026
  await markChatRelayDelivered2(task.id, now);
34839
35027
  console.log(`[chat-sdk] Relayed ${task.status} task ${task.id} to ${target.adapter}`);
@@ -34900,10 +35088,14 @@ async function stopChatRelayWatcher() {
34900
35088
  }
34901
35089
  var RELAY_GIVE_UP_AFTER_MS, SWEEP_EVERY_N_TICKS = 20, EARLY_TICK_DEBOUNCE_MS = 250, TELEGRAM_FOLD_CHARS = 1000, FOLD_LEAD_MAX_CHARS = 280, FOLD_MARKUP_CHARS = 80, interval, earlyTick, processing, stopController, tickCount = 0, TERMINAL_EVENTS;
34902
35090
  var init_relay = __esm(() => {
35091
+ init_dist5();
34903
35092
  init_db4();
35093
+ init_task_ui_spec();
34904
35094
  init_reaction_events();
34905
35095
  init_context_key();
35096
+ init_env_flag();
34906
35097
  init_secret_scrubber();
35098
+ init_task_ui_spec2();
34907
35099
  init_event_bus();
34908
35100
  init_commands();
34909
35101
  init_limits();
@@ -34965,6 +35157,9 @@ async function startAdapter(name, config, state, ChatClass) {
34965
35157
  try {
34966
35158
  await registerTelegramCommands(config);
34967
35159
  } catch (error) {
35160
+ if (error instanceof TelegramBotApiError && error.status === 401) {
35161
+ throw new Error(`Telegram rejected the bot token: ${errorMessage(error)}`);
35162
+ }
34968
35163
  logger.warn(`Could not register the Telegram commands: ${errorMessage(error)}`);
34969
35164
  }
34970
35165
  }
@@ -34999,7 +35194,7 @@ async function startChatSdk() {
34999
35194
  for (const [name, reason] of Object.entries(config.incomplete ?? {})) {
35000
35195
  console.warn(`[chat-sdk] ${name} not started, incomplete: ${scrubSecrets(reason)}`);
35001
35196
  }
35002
- const { Chat: ChatClass } = await import("./index-hjhfk3ra.js");
35197
+ const { Chat: ChatClass } = await import("./index-pe3d8jfy.js");
35003
35198
  const state = new SqliteChatState;
35004
35199
  startChatRelayWatcher();
35005
35200
  await Promise.all(CHAT_SDK_ADAPTER_NAMES.map(async (name) => {
@@ -35105,6 +35300,7 @@ var init_runtime = __esm(() => {
35105
35300
  init_logger();
35106
35301
  init_relay();
35107
35302
  init_state();
35303
+ init_telegram_api();
35108
35304
  init_test_hooks();
35109
35305
  init_thread_buffer();
35110
35306
  init_typing();
@@ -35372,9 +35568,9 @@ async function handleTaskCompleted(data) {
35372
35568
  return;
35373
35569
  const trimmed = (output ?? "").slice(0, OUTPUT_TRUNCATE_CHARS);
35374
35570
  const ellipsized = output && output.length > OUTPUT_TRUNCATE_CHARS ? `${trimmed}…` : trimmed;
35375
- const body = ellipsized ? `✅ Swarm task completed.
35571
+ const body = await withUiSpecFallback(taskId, ellipsized ? `✅ Swarm task completed.
35376
35572
 
35377
- ${ellipsized}` : "✅ Swarm task completed.";
35573
+ ${ellipsized}` : "✅ Swarm task completed.");
35378
35574
  await postLifecycleComment(taskId, "task.completed", body);
35379
35575
  }
35380
35576
  async function handleTaskFailed(data) {
@@ -35432,6 +35628,7 @@ function shouldSkipForLoopPrevention(sync) {
35432
35628
  var subscribed3 = false, LOOP_PREVENTION_WINDOW_MS = 5000, OUTPUT_TRUNCATE_CHARS = 4000, onTaskCreated2, onTaskCompleted3, onTaskFailed2, onTaskCancelled2;
35433
35629
  var init_outbound3 = __esm(() => {
35434
35630
  init_tracker();
35631
+ init_fallback();
35435
35632
  init_secret_scrubber();
35436
35633
  init_event_bus();
35437
35634
  init_client2();
@@ -35880,7 +36077,7 @@ var init_sync2 = __esm(() => {
35880
36077
  init_resolver();
35881
36078
  init_context_key();
35882
36079
  init_sibling_awareness();
35883
- init_types4();
36080
+ init_types5();
35884
36081
  init_adf();
35885
36082
  init_metadata();
35886
36083
  init_templates10();
@@ -35906,7 +36103,7 @@ async function notifySlack(text) {
35906
36103
  return;
35907
36104
  }
35908
36105
  try {
35909
- const { getSlackApp } = await import("./app-mkptw0k7.js");
36106
+ const { getSlackApp } = await import("./app-g2z15hax.js");
35910
36107
  const app = getSlackApp();
35911
36108
  if (!app) {
35912
36109
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -35977,7 +36174,7 @@ async function deleteJiraWebhook(webhookId) {
35977
36174
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
35978
36175
  }
35979
36176
  async function overwriteWebhookIds(next) {
35980
- const { getDbClient } = await import("./db-y4wfrzbm.js");
36177
+ const { getDbClient } = await import("./db-kpmx06s9.js");
35981
36178
  await getDbClient().transaction(async (tx) => {
35982
36179
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
35983
36180
  if (!row) {
@@ -108473,7 +108670,7 @@ var init_sync = __esm(() => {
108473
108670
  init_resolver();
108474
108671
  init_context_key();
108475
108672
  init_sibling_awareness();
108476
- init_types4();
108673
+ init_types5();
108477
108674
  init_gate();
108478
108675
  init_templates11();
108479
108676
  taskSessionMap = new Map;
@@ -108567,7 +108764,7 @@ async function handleTaskCompleted2(data) {
108567
108764
  if (shouldSkipForLoopPrevention2(sync))
108568
108765
  return;
108569
108766
  const sessionId = taskSessionMap.get(taskId);
108570
- const body = output?.trim() ? formatLinearOutcomeBody(output, taskId) : "Task completed.";
108767
+ const body = output?.trim() ? formatLinearOutcomeBody(await withUiSpecFallback(taskId, output), taskId) : await withUiSpecFallback(taskId, "Task completed.");
108571
108768
  if (sessionId) {
108572
108769
  endAgentSession(sessionId, body, "response").catch((err) => {
108573
108770
  console.error(`[Linear Outbound] Failed to end AgentSession for task ${taskId}:`, err);
@@ -108682,6 +108879,7 @@ var subscribed4 = false, LOOP_PREVENTION_WINDOW_MS2 = 5000, onTaskCreated3, onTa
108682
108879
  var init_outbound4 = __esm(() => {
108683
108880
  init_tracker();
108684
108881
  init_ensure_token();
108882
+ init_fallback();
108685
108883
  init_secret_scrubber();
108686
108884
  init_event_bus();
108687
108885
  init_client3();
@@ -109418,7 +109616,7 @@ var ErrorResponseSchema, cachedSpec = null, SCALAR_HTML = `<!DOCTYPE html>
109418
109616
  </body>
109419
109617
  </html>`;
109420
109618
  var init_openapi = __esm(() => {
109421
- init_dist7();
109619
+ init_dist9();
109422
109620
  init_constants3();
109423
109621
  init_zod_openapi();
109424
109622
  init_route_def();
@@ -109472,7 +109670,7 @@ async function reloadGlobalConfigsAndIntegrations() {
109472
109670
  return runWithoutRequestAuth(() => runSlackLifecycleExclusive(() => reloadGlobalConfigsAndIntegrationsInner()));
109473
109671
  }
109474
109672
  async function reloadGlobalConfigsAndIntegrationsInner() {
109475
- const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-csgrxedz.js");
109673
+ const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-s71ez27v.js");
109476
109674
  const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
109477
109675
  const updated = await loadGlobalConfigsIntoEnv(true);
109478
109676
  await syncTelemetryEnabled("settings").catch((err) => {
@@ -109488,7 +109686,7 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
109488
109686
  integrations.push("embeddings");
109489
109687
  }
109490
109688
  if (isEmbeddingsConfigured) {
109491
- import("./embedding-space-wh8de1t9.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
109689
+ import("./embedding-space-qhw4g68n.js").then(({ runEmbeddingMaintenance }) => runEmbeddingMaintenance({ backfill: !wasEmbeddingsConfigured })).catch((err) => {
109492
109690
  console.error("[config-reload] embedding maintenance failed (non-fatal):", err);
109493
109691
  });
109494
109692
  }
@@ -110996,7 +111194,7 @@ var init_sync3 = __esm(() => {
110996
111194
  init_script_connections();
110997
111195
  init_db3();
110998
111196
  init_run_saved();
110999
- init_types4();
111197
+ init_types5();
111000
111198
  init_secret_scrubber();
111001
111199
  init_definition();
111002
111200
  init_row_store();
@@ -111041,6 +111239,9 @@ async function runAppAction({
111041
111239
  name,
111042
111240
  input = {},
111043
111241
  parentTaskId,
111242
+ followUp,
111243
+ requestedByUserId,
111244
+ contextKey,
111044
111245
  caller,
111045
111246
  actor
111046
111247
  }) {
@@ -111127,8 +111328,10 @@ async function runAppAction({
111127
111328
  routingReason: action.agentId ? "human_pinned" : lead ? "skill" : undefined,
111128
111329
  routingSource: action.agentId || lead ? "engine_default" : undefined,
111129
111330
  key: normalizeAssetKey(`shared/app:${app.id}/action:${name}/`),
111130
- ...actor.startsWith("user:") ? { requestedByUserId: actor.slice("user:".length) } : {},
111131
- ...parentTaskId ? { parentTaskId } : {}
111331
+ requestedByUserId: requestedByUserId ?? (actor.startsWith("user:") ? actor.slice("user:".length) : undefined),
111332
+ ...parentTaskId ? { parentTaskId } : {},
111333
+ followUpConfig: followUp === false ? { disabled: true } : undefined,
111334
+ contextKey
111132
111335
  }, { origin: "app" });
111133
111336
  return {
111134
111337
  status: 200,
@@ -112391,6 +112594,28 @@ var init_request_principal = __esm(() => {
112391
112594
  init_utils2();
112392
112595
  });
112393
112596
 
112597
+ // src/http/task-requester.ts
112598
+ async function resolveTaskRequester(req, myAgentId, bodyUserId, trustedUserId) {
112599
+ const trusted = trustedUserId === undefined ? await resolveHttpAuditUserId(req, myAgentId) : trustedUserId;
112600
+ if (trusted)
112601
+ return trusted;
112602
+ if (process.env.TRUST_BODY_REQUESTED_BY_USER_ID === "false" || !bodyUserId)
112603
+ return;
112604
+ const mayAssign = can({
112605
+ principal: await agentFirstPrincipal(req, myAgentId),
112606
+ verb: "task.requester.assign",
112607
+ resource: { kind: "none" },
112608
+ source: "http"
112609
+ }).allow;
112610
+ return mayAssign ? (await findUserById(bodyUserId))?.id : undefined;
112611
+ }
112612
+ var init_task_requester = __esm(() => {
112613
+ init_audit_user();
112614
+ init_users();
112615
+ init_rbac();
112616
+ init_request_principal();
112617
+ });
112618
+
112394
112619
  // src/http/apps.ts
112395
112620
  async function authorizeAppCaller(req, res, myAgentId, verb, resource) {
112396
112621
  const auth = getRequestAuth(req);
@@ -112928,9 +113153,9 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
112928
113153
  }
112929
113154
  if (definitionNeedsRepair(res, app))
112930
113155
  return true;
113156
+ const actions = app.definition.actions;
113157
+ const action = actions && Object.hasOwn(actions, parsed.params.name) ? actions[parsed.params.name] : undefined;
112931
113158
  if (parsed.body.parentTaskId) {
112932
- const actions = app.definition.actions;
112933
- const action = actions && Object.hasOwn(actions, parsed.params.name) ? actions[parsed.params.name] : undefined;
112934
113159
  if (action && action.kind !== "task") {
112935
113160
  jsonError(res, "parentTaskId is only supported for task-kind actions", 400);
112936
113161
  return true;
@@ -112946,11 +113171,34 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
112946
113171
  return true;
112947
113172
  }
112948
113173
  }
113174
+ const requestedByUserId = action?.kind === "task" ? await resolveTaskRequester(req, myAgentId, parsed.body.requestedByUserId) : undefined;
113175
+ let contextKey;
113176
+ const session = parsed.body.session;
113177
+ if (session && action?.kind === "task") {
113178
+ if (session.scope === "shared") {
113179
+ jsonError(res, 'session scope "shared" is not supported yet', 400);
113180
+ return true;
113181
+ }
113182
+ if (!requestedByUserId) {
113183
+ jsonError(res, "A user-scoped session needs a requesting user: sign in or pick an identity", 400);
113184
+ return true;
113185
+ }
113186
+ if (!parsed.body.parentTaskId) {
113187
+ contextKey = appSessionContextKey({
113188
+ appId: app.id,
113189
+ sessionKey: session.key,
113190
+ userId: requestedByUserId
113191
+ });
113192
+ }
113193
+ }
112949
113194
  const output = await runAppAction({
112950
113195
  app,
112951
113196
  name: parsed.params.name,
112952
113197
  input: parsed.body.input,
112953
113198
  parentTaskId: parsed.body.parentTaskId,
113199
+ followUp: parsed.body.followUp,
113200
+ requestedByUserId,
113201
+ contextKey,
112954
113202
  caller,
112955
113203
  actor
112956
113204
  });
@@ -113296,13 +113544,15 @@ var init_apps = __esm(() => {
113296
113544
  init_version4();
113297
113545
  init_db4();
113298
113546
  init_rbac();
113299
- init_types4();
113547
+ init_context_key();
113548
+ init_types5();
113300
113549
  init_request_auth_context();
113301
113550
  init_secret_scrubber();
113302
113551
  init_favorite_owner();
113303
113552
  init_request_principal();
113304
113553
  init_route_def();
113305
113554
  init_session_access();
113555
+ init_task_requester();
113306
113556
  init_utils2();
113307
113557
  MAX_APP_BODY_BYTES = 5 * 1024 * 1024;
113308
113558
  MAX_APP_ROW_BODY_BYTES = 1 * 1024 * 1024;
@@ -113764,7 +114014,13 @@ var init_apps = __esm(() => {
113764
114014
  params: object2({ id: string2().min(1), name: AppNameSchema }),
113765
114015
  body: object2({
113766
114016
  input: record2(string2(), unknown()).optional(),
113767
- parentTaskId: string2().min(1).optional()
114017
+ parentTaskId: string2().min(1).optional(),
114018
+ followUp: boolean().optional(),
114019
+ requestedByUserId: string2().min(1).optional(),
114020
+ session: object2({
114021
+ key: string2().regex(APP_SESSION_KEY_PATTERN),
114022
+ scope: _enum2(["user", "shared"]).optional()
114023
+ }).optional()
113768
114024
  }),
113769
114025
  responses: {
113770
114026
  200: { description: "Action invoked", schema: runActionResultSchema },
@@ -114707,7 +114963,7 @@ async function cancelApprovalRequestAndRun(id, data) {
114707
114963
  });
114708
114964
  if (!timedOut)
114709
114965
  return null;
114710
- await createApprovalFollowUpTask(timedOut, "hitl.timeout");
114966
+ await createApprovalFollowUpTask2(timedOut, "hitl.timeout");
114711
114967
  return { timedOut };
114712
114968
  }
114713
114969
  const request = await cancelApprovalRequestById2(id, {
@@ -114729,7 +114985,7 @@ async function cancelApprovalRequestAndRun(id, data) {
114729
114985
  }
114730
114986
  const slackReason = data.slackReason ?? data.reason;
114731
114987
  client.afterCommit(async () => {
114732
- await postApprovalCancellationUpdates([request], slackReason);
114988
+ await postApprovalCancellationUpdates2([request], slackReason);
114733
114989
  if (runCancelled) {
114734
114990
  await postTreeApprovalCancellations2(treeRunIds, data.reason, {
114735
114991
  exceptRequestId: request.id
@@ -114863,7 +115119,7 @@ var init_get_task_details = __esm(() => {
114863
115119
  init_db4();
114864
115120
  init_task_tool_ctx();
114865
115121
  init_utils();
114866
- init_types4();
115122
+ init_types5();
114867
115123
  init_requester_comms();
114868
115124
  getTaskDetailsInputSchema = object2({
114869
115125
  taskId: uuid().describe("The ID of the task to get details for.")
@@ -115211,17 +115467,101 @@ var init_chat_open_dm = __esm(() => {
115211
115467
  init_utils();
115212
115468
  });
115213
115469
 
115470
+ // src/integrations/cards/index.ts
115471
+ function renderCard(spec) {
115472
+ let card;
115473
+ try {
115474
+ card = toCard(spec, { components: chatCardComponents, limits: CARD_LIMITS });
115475
+ } catch (error) {
115476
+ if (error instanceof CardSpecError)
115477
+ return { issues: error.issues };
115478
+ throw error;
115479
+ }
115480
+ const issues = cardChildren(card).filter((child) => child.type === "table").flatMap((table) => {
115481
+ const chars = [table.headers, ...table.rows].flat().reduce((sum, cell) => sum + cell.length, 0);
115482
+ return chars > TABLE_MAX_CELL_CHARS ? [`Table: ${chars} characters in its cells, at most ${TABLE_MAX_CELL_CHARS}`] : [];
115483
+ });
115484
+ return issues.length ? { issues } : { card };
115485
+ }
115486
+ function cardChildren(card) {
115487
+ return card.children.flatMap((child) => child.type === "section" ? [child, ...cardChildren(child)] : [child]);
115488
+ }
115489
+ function cardIssuesMessage(issues) {
115490
+ return `Invalid card spec. Fix it and retry:
115491
+ ${issues.map((issue) => `- ${issue}`).join(`
115492
+ `)}`;
115493
+ }
115494
+ async function cardToSlack(card) {
115495
+ const { cardToBlockKit, cardToFallbackText } = await import("./index-620y7jzq.js");
115496
+ const issues = cardChildren(card).flatMap((child) => {
115497
+ const native = NATIVE_SLACK_BLOCKS[child.type];
115498
+ if (!native)
115499
+ return [];
115500
+ const [block] = cardToBlockKit({ type: "card", children: [child] });
115501
+ return block && native.includes(String(block.type)) ? [] : [`${child.type === "table" ? "Table" : "Chart"}: Slack cannot render it natively`];
115502
+ });
115503
+ if (issues.length)
115504
+ return { issues };
115505
+ return {
115506
+ blocks: cardToBlockKit(card),
115507
+ text: cardToFallbackText(card)
115508
+ };
115509
+ }
115510
+ async function renderCardFor(adapter, spec) {
115511
+ const rendered = renderCard(spec);
115512
+ if ("issues" in rendered || adapter !== "slack")
115513
+ return rendered;
115514
+ const slack = await cardToSlack(rendered.card);
115515
+ return "issues" in slack ? slack : rendered;
115516
+ }
115517
+ function slackFallbackText(message, cardText) {
115518
+ return [message, cardText].filter(Boolean).join(`
115519
+
115520
+ `);
115521
+ }
115522
+ var _button, standard, chatCardComponents, CARD_LIMITS, TABLE_MAX_CELL_CHARS = 1e4, catalogLines, CARD_RULES = 'Every element has "children" (leaves use []). Field goes inside Fields, LinkButton inside Actions. A bar, line or area Chart has one value per category per series; a pie Chart uses {"type":"pie","segments":[{"label","value"}]}.', cardSpecInputSchema, NATIVE_SLACK_BLOCKS;
115523
+ var init_cards = __esm(() => {
115524
+ init_dist5();
115525
+ init_zod();
115526
+ ({ Button: _button, ...standard } = standardComponentDefinitions);
115527
+ chatCardComponents = {
115528
+ ...standard,
115529
+ Actions: { ...standard.Actions, description: "Row of LinkButton elements." }
115530
+ };
115531
+ CARD_LIMITS = {
115532
+ tables: 1,
115533
+ charts: 2,
115534
+ fields: 10,
115535
+ tableRows: 101,
115536
+ tableColumns: 20,
115537
+ chartTitle: 50,
115538
+ chartLabel: 20,
115539
+ chartSeries: 12,
115540
+ chartPoints: 20
115541
+ };
115542
+ catalogLines = Object.entries(chatCardComponents).map(([name, def]) => `${name}: ${def.description} Props e.g. ${JSON.stringify(def.example)}.`).join(" ");
115543
+ cardSpecInputSchema = looseObject({
115544
+ root: string2().min(1).describe("Id of the root element. It must be a Card."),
115545
+ elements: record2(string2(), unknown()).describe('Map of element id to { type, props, children: [ids] }. Example: {"root":"c","elements":{"c":{"type":"Card","props":{"title":"Deploy"},"children":["f"]},"f":{"type":"Fields","props":{},"children":["f1"]},"f1":{"type":"Field","props":{"label":"Status","value":"green"},"children":[]}}}')
115546
+ }).describe(`Optional json-render card spec, rendered as a native card. Use it for structured results: key figures, a table, up to ${CARD_LIMITS.charts} charts, links. At most ${CARD_LIMITS.tables} table, of up to ${CARD_LIMITS.tableRows - 1} rows, ${CARD_LIMITS.tableColumns} columns and ${TABLE_MAX_CELL_CHARS} characters in all. ${CARD_RULES} Components: ${catalogLines}`);
115547
+ NATIVE_SLACK_BLOCKS = {
115548
+ table: ["table", "data_table"],
115549
+ chart: ["data_visualization"]
115550
+ };
115551
+ });
115552
+
115214
115553
  // src/tools/chat-post.ts
115215
115554
  var registerChatPostTool = (server) => {
115216
115555
  createToolRegistrar(server)("chat-post", {
115217
115556
  title: "Post to a chat thread or channel",
115218
- description: "Lead only. Post a message to any Chat SDK thread or channel (Telegram, Slack, Discord, Teams), outside the thread of your current task. Give threadId to reply in a thread, or channelId to start a new message in a channel. Ids carry the adapter prefix, such as telegram:12345. To answer the user of your current chat task, use chat-reply instead.",
115557
+ description: "Lead only. Post a message to any Chat SDK thread or channel (Telegram, Slack, Discord, Teams), outside the thread of your current task. Give threadId to reply in a thread, or channelId to start a new message in a channel. Ids carry the adapter prefix, such as telegram:12345. To answer the user of your current chat task, use chat-reply instead. For a structured result (key figures, a table, charts, links), send a `card`; it posts after the text as a native card.",
115219
115558
  annotations: { openWorldHint: true },
115220
115559
  inputSchema: object2({
115221
115560
  adapter: _enum2(CHAT_SDK_ADAPTER_NAMES).describe("Chat SDK adapter name."),
115222
115561
  threadId: string2().min(1).optional().describe("Full SDK thread id, such as telegram:12345 or slack:C123:1700000000.000100."),
115223
115562
  channelId: string2().min(1).optional().describe("Full SDK channel id, such as slack:C123. Ignored when threadId is set."),
115224
- text: string2().min(1).max(20000).describe("Markdown text to post."),
115563
+ text: string2().min(1).max(20000).optional().describe("Markdown text to post. Required unless card is given."),
115564
+ card: cardSpecInputSchema.optional(),
115225
115565
  attachments: chatAttachmentsSchema
115226
115566
  }),
115227
115567
  outputSchema: swarmToolOutputSchema({
@@ -115232,17 +115572,25 @@ var registerChatPostTool = (server) => {
115232
115572
  channelId: string2().optional(),
115233
115573
  unsentFiles: array2(looseObject({ name: string2().optional(), reason: string2().optional() })).optional()
115234
115574
  })
115235
- }, async ({ adapter, threadId, channelId, text, attachments }, requestInfo) => {
115575
+ }, async ({ adapter, threadId, channelId, text, card, attachments }, requestInfo) => {
115236
115576
  const data = { yourAgentId: requestInfo.agentId };
115237
115577
  const target = threadId ?? channelId;
115238
115578
  if (!target)
115239
115579
  return toolErr("Give a threadId or a channelId.", { data });
115580
+ if (!text && !card)
115581
+ return toolErr("Provide text or a card.", { data });
115240
115582
  if (adapterOfChatId(target) !== adapter) {
115241
115583
  return toolErr(`The id ${target} does not belong to the ${adapter} adapter.`, { data });
115242
115584
  }
115243
115585
  if (!await canUseChatVerb(requestInfo, "integration.chat.post")) {
115244
115586
  return toolErr("Permission denied. Only the lead can post outside the thread of its task. Use chat-reply for the thread of your current task.", { data });
115245
115587
  }
115588
+ const rendered = card ? await renderCardFor(adapter, card) : undefined;
115589
+ if (rendered && "issues" in rendered) {
115590
+ return toolErr(cardIssuesMessage(rendered.issues), {
115591
+ data: { ...data, issues: rendered.issues }
115592
+ });
115593
+ }
115246
115594
  const resolved = await resolveChatAttachmentRefs(attachments ?? [], requestInfo.sourceTaskId, requestInfo.agentId);
115247
115595
  if ("error" in resolved)
115248
115596
  return toolErr(resolved.error, { data });
@@ -115250,7 +115598,8 @@ var registerChatPostTool = (server) => {
115250
115598
  const sent = await postChatMessage({
115251
115599
  adapter,
115252
115600
  ...threadId ? { threadId } : { channelId },
115253
- text,
115601
+ text: text ?? [],
115602
+ card: rendered?.card,
115254
115603
  taskId: requestInfo.sourceTaskId,
115255
115604
  files: resolved.files
115256
115605
  });
@@ -115272,6 +115621,7 @@ var registerChatPostTool = (server) => {
115272
115621
  };
115273
115622
  var init_chat_post = __esm(() => {
115274
115623
  init_zod();
115624
+ init_cards();
115275
115625
  init_config();
115276
115626
  init_logger();
115277
115627
  init_outbound2();
@@ -115355,10 +115705,11 @@ var init_chat_read_thread = __esm(() => {
115355
115705
  var registerChatReplyTool = (server) => {
115356
115706
  createToolRegistrar(server)("chat-reply", {
115357
115707
  title: "Reply in the chat thread of this task",
115358
- description: "Post a message to the Telegram, Slack, Discord or Teams thread your current task came from. Works only on a task whose contextKey starts with task:chat-sdk:. The task's final output is posted to the thread automatically when the task ends, so use this only for a question to the user, a short progress note on long work, or to send files (attachments). Markdown is supported; long text is split into several messages. When the final output of a task is posted, the files attached to that task go with it.",
115708
+ description: "Post a message to the Telegram, Slack, Discord or Teams thread your current task came from. Works only on a task whose contextKey starts with task:chat-sdk:. The task's final output is posted to the thread automatically when the task ends, so use this only for a question to the user, a short progress note on long work, or to send files (attachments). Markdown is supported; long text is split into several messages. When the final output of a task is posted, the files attached to that task go with it. For a structured result (key figures, a table, charts, links), send a `card`; it posts after the text as a native card.",
115359
115709
  annotations: { openWorldHint: true },
115360
115710
  inputSchema: object2({
115361
- text: string2().min(1).max(20000).describe("Markdown text to post to the thread."),
115711
+ text: string2().min(1).max(20000).optional().describe("Markdown text to post to the thread. Required unless card is given."),
115712
+ card: cardSpecInputSchema.optional(),
115362
115713
  attachments: chatAttachmentsSchema
115363
115714
  }),
115364
115715
  outputSchema: swarmToolOutputSchema({
@@ -115368,10 +115719,12 @@ var registerChatReplyTool = (server) => {
115368
115719
  threadId: string2().optional(),
115369
115720
  unsentFiles: array2(looseObject({ name: string2().optional(), reason: string2().optional() })).optional()
115370
115721
  })
115371
- }, async ({ text, attachments }, requestInfo) => {
115722
+ }, async ({ text, card, attachments }, requestInfo) => {
115372
115723
  if (!requestInfo.agentId)
115373
115724
  return toolErr("Agent ID not found.");
115374
115725
  const data = { yourAgentId: requestInfo.agentId };
115726
+ if (!text && !card)
115727
+ return toolErr("Provide text or a card.", { data });
115375
115728
  const task = requestInfo.sourceTaskId ? await getTaskById2(requestInfo.sourceTaskId) : await getAgentCurrentTask2(requestInfo.agentId);
115376
115729
  if (!task)
115377
115730
  return toolErr("No current task found for chat-reply.", { data });
@@ -115382,6 +115735,12 @@ var registerChatReplyTool = (server) => {
115382
115735
  if (!thread) {
115383
115736
  return toolErr(`Task ${task.id} did not come from a chat thread (no task:chat-sdk contextKey). Use the tool of the channel the task came from.`, { data });
115384
115737
  }
115738
+ const rendered = card ? await renderCardFor(thread.adapter, card) : undefined;
115739
+ if (rendered && "issues" in rendered) {
115740
+ return toolErr(cardIssuesMessage(rendered.issues), {
115741
+ data: { ...data, issues: rendered.issues }
115742
+ });
115743
+ }
115385
115744
  const resolved = await resolveChatAttachmentRefs(attachments ?? [], task.id, requestInfo.agentId);
115386
115745
  if ("error" in resolved)
115387
115746
  return toolErr(resolved.error, { data });
@@ -115389,7 +115748,8 @@ var registerChatReplyTool = (server) => {
115389
115748
  const sent = await postChatMessage({
115390
115749
  adapter: thread.adapter,
115391
115750
  threadId: thread.threadId,
115392
- text,
115751
+ text: text ?? [],
115752
+ card: rendered?.card,
115393
115753
  taskId: task.id,
115394
115754
  files: resolved.files,
115395
115755
  replyToMessageId: task.mentionMessageId
@@ -115412,6 +115772,7 @@ var registerChatReplyTool = (server) => {
115412
115772
  var init_chat_reply = __esm(() => {
115413
115773
  init_zod();
115414
115774
  init_db4();
115775
+ init_cards();
115415
115776
  init_logger();
115416
115777
  init_outbound2();
115417
115778
  init_outbound_files();
@@ -115547,7 +115908,7 @@ var init_create_channel = __esm(() => {
115547
115908
  init_zod();
115548
115909
  init_db4();
115549
115910
  init_utils();
115550
- init_types4();
115911
+ init_types5();
115551
115912
  ChannelOutputSchema = looseObject({
115552
115913
  id: string2().optional(),
115553
115914
  name: string2().optional(),
@@ -115664,6 +116025,9 @@ function executeReadOnlyQuery(sql, params = [], maxRows) {
115664
116025
  function isDbQueryBoundedEnabled(env = process.env) {
115665
116026
  return isEnvFlagEnabled("DB_QUERY_BOUNDED_ENABLED", true, env);
115666
116027
  }
116028
+ function isDbQueryWorkerPoolEnabled(env = process.env) {
116029
+ return isEnvFlagEnabled("DB_QUERY_WORKER_POOL_ENABLED", true, env);
116030
+ }
115667
116031
  function readPositiveIntEnv(key, defaultValue, env = process.env, maxValue = Number.MAX_SAFE_INTEGER) {
115668
116032
  const raw = env[key];
115669
116033
  if (raw === undefined)
@@ -115755,7 +116119,8 @@ async function executeReadOnlyQueryBounded(sql, params = [], budgetMs, maxRows)
115755
116119
  assertNoDeniedTables(sql);
115756
116120
  acquireBoundedQuerySlot();
115757
116121
  try {
115758
- return await runBoundedQueryChild(sql, params, budgetMs, maxRows);
116122
+ const run = isDbQueryWorkerPoolEnabled() ? runPooledQuery : runBoundedQueryChild;
116123
+ return await run(sql, params, budgetMs, maxRows);
115759
116124
  } finally {
115760
116125
  releaseBoundedQuerySlot();
115761
116126
  }
@@ -115763,8 +116128,8 @@ async function executeReadOnlyQueryBounded(sql, params = [], budgetMs, maxRows)
115763
116128
  function isReportableTimeout(timedOut, exitCode, stdout) {
115764
116129
  return timedOut && !(exitCode === 0 && stdout.length > 0);
115765
116130
  }
115766
- async function runBoundedQueryChild(sql, params, budgetMs, maxRows) {
115767
- const payload = {
116131
+ function buildPayload(sql, params, budgetMs, maxRows) {
116132
+ return {
115768
116133
  file: getDb2().filename,
115769
116134
  sql,
115770
116135
  params,
@@ -115772,6 +116137,16 @@ async function runBoundedQueryChild(sql, params, budgetMs, maxRows) {
115772
116137
  maxRows,
115773
116138
  busyTimeoutMs: budgetMs
115774
116139
  };
116140
+ }
116141
+ function timeoutError(budgetMs) {
116142
+ return new DbQueryTimeoutError(`Query exceeded the ${budgetMs}ms budget and was terminated. Filter on an indexed column and add a LIMIT. Aggregates such as COUNT(*), SUM(...) or typeof() over session_logs, agent_log, events or task_context_snapshots read every row in range and cannot be made cheap by chunking on rowid.`);
116143
+ }
116144
+ function isMissingExecutable(err) {
116145
+ const message = err instanceof Error ? err.message : String(err);
116146
+ return /executable not found/i.test(message) || /enoent/i.test(message);
116147
+ }
116148
+ async function runBoundedQueryChild(sql, params, budgetMs, maxRows) {
116149
+ const payload = buildPayload(sql, params, budgetMs, maxRows);
115775
116150
  let proc;
115776
116151
  try {
115777
116152
  proc = Bun.spawn(["bun", "-e", CHILD_SCRIPT], {
@@ -115780,10 +116155,8 @@ async function runBoundedQueryChild(sql, params, budgetMs, maxRows) {
115780
116155
  stderr: "pipe"
115781
116156
  });
115782
116157
  } catch (err) {
115783
- const message = err instanceof Error ? err.message : String(err);
115784
- if (!/executable not found/i.test(message) && !/enoent/i.test(message)) {
116158
+ if (!isMissingExecutable(err))
115785
116159
  throw err;
115786
- }
115787
116160
  warnDbQuerySpawnUnavailableOnce();
115788
116161
  return executeReadOnlyQuery(sql, params, maxRows);
115789
116162
  }
@@ -115807,7 +116180,7 @@ async function runBoundedQueryChild(sql, params, budgetMs, maxRows) {
115807
116180
  clearTimeout(timer);
115808
116181
  }
115809
116182
  if (isReportableTimeout(timedOut, exitCode, stdout)) {
115810
- throw new DbQueryTimeoutError(`Query exceeded the ${budgetMs}ms budget and was terminated. Filter on an indexed column and add a LIMIT. Aggregates such as COUNT(*), SUM(...) or typeof() over session_logs, agent_log, events or task_context_snapshots read every row in range and cannot be made cheap by chunking on rowid.`);
116183
+ throw timeoutError(budgetMs);
115811
116184
  }
115812
116185
  if (exitCode === WRITE_REJECTED_EXIT_CODE) {
115813
116186
  throw new Error(stderr.trim() || "Only read-only queries are allowed");
@@ -115823,7 +116196,180 @@ async function runBoundedQueryChild(sql, params, budgetMs, maxRows) {
115823
116196
  total: parsed.total
115824
116197
  };
115825
116198
  }
115826
- var WRITE_REJECTED_EXIT_CODE = 2, CHILD_SCRIPT, activeBoundedQueryCount = 0;
116199
+ function retireWorker(w) {
116200
+ clearTimeout(w.idleTimer);
116201
+ const i = idleWorkers.indexOf(w);
116202
+ if (i >= 0)
116203
+ idleWorkers.splice(i, 1);
116204
+ w.proc.kill("SIGKILL");
116205
+ }
116206
+ async function pumpWorker(w) {
116207
+ const decoder = new TextDecoder;
116208
+ let partial = "";
116209
+ try {
116210
+ for await (const chunk of w.proc.stdout) {
116211
+ const text = decoder.decode(chunk, { stream: true });
116212
+ let from = 0;
116213
+ let nl = text.indexOf(`
116214
+ `, from);
116215
+ while (nl >= 0) {
116216
+ const line = partial + text.slice(from, nl);
116217
+ partial = "";
116218
+ from = nl + 1;
116219
+ w.onLine?.(line);
116220
+ nl = text.indexOf(`
116221
+ `, from);
116222
+ }
116223
+ partial += text.slice(from);
116224
+ }
116225
+ } catch {}
116226
+ const code = await w.proc.exited;
116227
+ const stderr = (await w.stderr).trim();
116228
+ retireWorker(w);
116229
+ w.onExit?.(stderr || `db-query worker exited with code ${code}`);
116230
+ }
116231
+ function spawnWorker() {
116232
+ const proc = Bun.spawn(["bun", "-e", WORKER_SCRIPT], {
116233
+ stdin: "pipe",
116234
+ stdout: "pipe",
116235
+ stderr: "pipe"
116236
+ });
116237
+ proc.unref();
116238
+ const w = { proc, queries: 0, stderr: new Response(proc.stderr).text() };
116239
+ pumpWorker(w);
116240
+ return w;
116241
+ }
116242
+ async function runPooledQuery(sql, params, budgetMs, maxRows) {
116243
+ let worker = idleWorkers.pop();
116244
+ if (worker) {
116245
+ clearTimeout(worker.idleTimer);
116246
+ } else {
116247
+ try {
116248
+ worker = spawnWorker();
116249
+ } catch (err) {
116250
+ if (!isMissingExecutable(err))
116251
+ throw err;
116252
+ warnDbQuerySpawnUnavailableOnce();
116253
+ return executeReadOnlyQuery(sql, params, maxRows);
116254
+ }
116255
+ }
116256
+ const w = worker;
116257
+ const request = `${JSON.stringify(buildPayload(sql, params, budgetMs, maxRows))}
116258
+ `;
116259
+ let reply;
116260
+ try {
116261
+ reply = await new Promise((resolve, reject) => {
116262
+ const timer = setTimeout(() => {
116263
+ retireWorker(w);
116264
+ reject(timeoutError(budgetMs));
116265
+ }, budgetMs);
116266
+ w.onLine = (line) => {
116267
+ clearTimeout(timer);
116268
+ resolve(line);
116269
+ };
116270
+ w.onExit = (reason) => {
116271
+ clearTimeout(timer);
116272
+ reject(new Error(reason));
116273
+ };
116274
+ w.proc.stdin.write(request);
116275
+ w.proc.stdin.flush();
116276
+ });
116277
+ } catch (err) {
116278
+ retireWorker(w);
116279
+ throw err;
116280
+ } finally {
116281
+ w.onLine = undefined;
116282
+ w.onExit = undefined;
116283
+ }
116284
+ w.queries++;
116285
+ if (w.queries >= POOL_MAX_QUERIES_PER_WORKER || reply.length > POOL_MAX_PARKED_REPLY_CHARS) {
116286
+ retireWorker(w);
116287
+ } else {
116288
+ w.idleTimer = setTimeout(() => retireWorker(w), POOL_IDLE_REAP_MS);
116289
+ idleWorkers.push(w);
116290
+ }
116291
+ const parsed = JSON.parse(reply);
116292
+ if (parsed.error !== undefined)
116293
+ throw new Error(parsed.error);
116294
+ return {
116295
+ columns: parsed.columns,
116296
+ rows: parsed.rows,
116297
+ elapsed: parsed.elapsed,
116298
+ total: parsed.total
116299
+ };
116300
+ }
116301
+ var WRITE_REJECTED_EXIT_CODE = 2, CHILD_SCRIPT, activeBoundedQueryCount = 0, POOL_MAX_QUERIES_PER_WORKER = 500, POOL_IDLE_REAP_MS = 60000, POOL_MAX_PARKED_REPLY_CHARS, WORKER_SCRIPT = `
116302
+ const { Database } = require("bun:sqlite");
116303
+
116304
+ let db = null;
116305
+ let dbFile = null;
116306
+
116307
+ function run(req) {
116308
+ const { file, sql, params, vecExtensionPath, maxRows, busyTimeoutMs } = req;
116309
+ if (!db || dbFile !== file) {
116310
+ if (db) db.close();
116311
+ db = null;
116312
+ const opened = new Database(file, { readonly: true });
116313
+ if (vecExtensionPath) {
116314
+ try {
116315
+ opened.loadExtension(vecExtensionPath);
116316
+ } catch {
116317
+ // Non-fatal: only queries that reference vec0 tables/functions need it.
116318
+ }
116319
+ }
116320
+ db = opened;
116321
+ dbFile = file;
116322
+ }
116323
+ db.exec("PRAGMA busy_timeout = " + Math.trunc(busyTimeoutMs) + ";");
116324
+ const stmt = db.prepare(sql);
116325
+ try {
116326
+ if (stmt.columnNames.length === 0) throw new Error("Only read-only queries are allowed");
116327
+ const columns = stmt.columnNames;
116328
+ const start = performance.now();
116329
+ const rowArrays = [];
116330
+ let total = 0;
116331
+ for (const row of stmt.iterate(...(params || []))) {
116332
+ total++;
116333
+ if (!maxRows || rowArrays.length < maxRows) {
116334
+ rowArrays.push(
116335
+ columns.map((col) => {
116336
+ const value = row[col];
116337
+ return value instanceof Uint8Array ? Array.from(value) : value;
116338
+ }),
116339
+ );
116340
+ }
116341
+ }
116342
+ return { columns, rows: rowArrays, elapsed: Math.round(performance.now() - start), total };
116343
+ } finally {
116344
+ // Finalize so no read transaction stays open and blocks WAL checkpoints.
116345
+ stmt.finalize();
116346
+ }
116347
+ }
116348
+
116349
+ function handle(line) {
116350
+ let out;
116351
+ try {
116352
+ out = JSON.stringify(run(JSON.parse(line)));
116353
+ } catch (err) {
116354
+ out = JSON.stringify({ error: err && err.message ? err.message : String(err) });
116355
+ }
116356
+ process.stdout.write(out + "\\n");
116357
+ }
116358
+
116359
+ (async () => {
116360
+ const decoder = new TextDecoder();
116361
+ let buf = "";
116362
+ for await (const chunk of Bun.stdin.stream()) {
116363
+ buf += decoder.decode(chunk, { stream: true });
116364
+ let nl;
116365
+ while ((nl = buf.indexOf("\\n")) >= 0) {
116366
+ const line = buf.slice(0, nl);
116367
+ buf = buf.slice(nl + 1);
116368
+ if (line) handle(line);
116369
+ }
116370
+ }
116371
+ })();
116372
+ `, idleWorkers;
115827
116373
  var init_db_query_bounded = __esm(() => {
115828
116374
  init_db4();
115829
116375
  init_db_query_shared();
@@ -115884,6 +116430,8 @@ const { Database } = require("bun:sqlite");
115884
116430
  }
115885
116431
  })();
115886
116432
  `;
116433
+ POOL_MAX_PARKED_REPLY_CHARS = 8 * 1024 * 1024;
116434
+ idleWorkers = [];
115887
116435
  });
115888
116436
 
115889
116437
  // src/http/db-query.ts
@@ -116105,7 +116653,7 @@ var init_create_metric = __esm(() => {
116105
116653
  init_db_query();
116106
116654
  init_version2();
116107
116655
  init_utils();
116108
- init_types4();
116656
+ init_types5();
116109
116657
  init_constants3();
116110
116658
  });
116111
116659
 
@@ -116142,6 +116690,68 @@ var init_asset_key_auth = __esm(() => {
116142
116690
  };
116143
116691
  });
116144
116692
 
116693
+ // src/be/caller-session-group.ts
116694
+ async function fileCallerSessionIntoGroup(input) {
116695
+ if (!input.agentId || !isGroupKey(input.key) || sourceOfKey(input.key))
116696
+ return null;
116697
+ try {
116698
+ const task = await resolveCallerTask(input.sourceTaskId, input.agentId);
116699
+ if (!task)
116700
+ return null;
116701
+ const root = await getSessionRoot(task.id);
116702
+ if (!root)
116703
+ return null;
116704
+ const rootKey = defaultAssetKey("task", root.id);
116705
+ const hasDefaultKey = (entry) => entry.key === rootKey || entry.key === defaultAssetKey("task", entry.id);
116706
+ if (!hasDefaultKey(task))
116707
+ return null;
116708
+ const chain = await getRootTaskChain2(root.id);
116709
+ if (chain[0]?.id !== root.id || chain[0].key !== rootKey)
116710
+ return null;
116711
+ const agent = await getAgentById2(input.agentId);
116712
+ const principal = {
116713
+ kind: "agent",
116714
+ agentId: input.agentId,
116715
+ isLead: agent?.isLead ?? false
116716
+ };
116717
+ const movable = chain.filter(hasDefaultKey);
116718
+ const allowed = movable.every((entry) => can({
116719
+ principal,
116720
+ verb: "task.fs.mutate",
116721
+ resource: {
116722
+ kind: "task",
116723
+ taskId: entry.id,
116724
+ agentId: entry.agentId,
116725
+ creatorAgentId: entry.creatorAgentId
116726
+ },
116727
+ source: "mcp"
116728
+ }).allow);
116729
+ if (!allowed)
116730
+ return null;
116731
+ await assertAssetKeyMovesAllowed2();
116732
+ const moved = await moveSessionChains({
116733
+ moves: [{ rootId: root.id, taskIds: movable.map((entry) => entry.id), key: input.key }],
116734
+ changedBy: input.changedBy
116735
+ });
116736
+ return moved.includes(root.id) ? root.id : null;
116737
+ } catch (error) {
116738
+ if (error instanceof AssetKeyMovesBlockedError2)
116739
+ return null;
116740
+ console.warn("[caller-session-group] Session move failed:", scrubSecrets(error instanceof Error ? error.message : String(error)));
116741
+ return null;
116742
+ }
116743
+ }
116744
+ var init_caller_session_group = __esm(() => {
116745
+ init_key();
116746
+ init_source_key();
116747
+ init_rbac();
116748
+ init_secret_scrubber();
116749
+ init_audit_user();
116750
+ init_db4();
116751
+ init_session_moves();
116752
+ init_session_shares();
116753
+ });
116754
+
116145
116755
  // src/be/db/page-versions.ts
116146
116756
  async function getPageEditCounter(pageId) {
116147
116757
  const row = await getDbClient2().get("SELECT MAX(version) AS latest FROM page_versions WHERE pageId = ?", [pageId]);
@@ -117447,7 +118057,7 @@ var SWARM_CLASS, COLOR_TOKEN_REFERENCE, PAGE_COLOR_TOKENS, registerCreatePageToo
117447
118057
  description: "Stores an HTML or JSON page in the swarm and returns shareable URLs. " + "Calls are upsert-by-(agent, slug): if you previously created a page " + "with the same slug, its prior state is snapshotted and the row is " + "updated. Use this for static reports, dashboards, or JSON action " + "specs that don't need a long-lived process. " + "HTML pages use the swarm design system (designVersion 2): theme " + "tokens such as var(--color-primary), the swarm-* primitives, and " + "Tailwind v4 utilities such as bg-card and text-muted-foreground. " + "Set `theme` to a preset id or pass `themeTokens` (a token map, or a " + 'CSS variable block with format "css") to restyle the whole page. ' + "Do not hardcode colors: inside the dashboard the page follows the " + "viewer's theme and dark mode. Pages created before designVersion 2 " + "keep the old look; pass designVersion: 2 when you rewrite one.",
117448
118058
  annotations: { destructiveHint: false },
117449
118059
  inputSchema: object2({
117450
- key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/page:<id>/ resource key."),
118060
+ key: AssetKeySchema.optional().describe("Logical namespace. Defaults to the calling task's group key when it has one, else shared/page:<id>/. An explicit use-case group key also files the calling task's session into that group while the session still has its default key."),
117451
118061
  title: string2().min(1).describe("Human-readable title shown in listings."),
117452
118062
  slug: string2().min(1).optional().describe("URL slug. Defaults to the kebab-cased title. Same slug → updates the existing row."),
117453
118063
  body: string2().min(1).describe("Full page body (HTML document, SVG image, or JSON-render spec, per contentType)."),
@@ -117471,7 +118081,8 @@ var SWARM_CLASS, COLOR_TOKEN_REFERENCE, PAGE_COLOR_TOKENS, registerCreatePageToo
117471
118081
  ignoredTokens: array2(string2()).optional(),
117472
118082
  colorLiteralCount: number2().optional(),
117473
118083
  usesDesignSystem: boolean().optional(),
117474
- lightOnlyColors: boolean().optional()
118084
+ lightOnlyColors: boolean().optional(),
118085
+ movedSessionRootId: string2().optional()
117475
118086
  })
117476
118087
  }, async (input, requestInfo, _meta) => {
117477
118088
  if (!requestInfo.agentId) {
@@ -117493,7 +118104,8 @@ var SWARM_CLASS, COLOR_TOKEN_REFERENCE, PAGE_COLOR_TOKENS, registerCreatePageToo
117493
118104
  let assetKey;
117494
118105
  try {
117495
118106
  if (input.key !== undefined || !existing) {
117496
- assetKey = input.key ? await authorizeAssetKeyWrite(input.key, trustedUserId) : undefined;
118107
+ const resolvedKey = input.key ?? await resolveTaskGroupKey(requestInfo.sourceTaskId, requestInfo.agentId);
118108
+ assetKey = resolvedKey ? await authorizeAssetKeyWrite(resolvedKey, trustedUserId) : undefined;
117497
118109
  }
117498
118110
  } catch (error) {
117499
118111
  const msg = error instanceof Error ? error.message : String(error);
@@ -117564,7 +118176,13 @@ var SWARM_CLASS, COLOR_TOKEN_REFERENCE, PAGE_COLOR_TOKENS, registerCreatePageToo
117564
118176
  ...fresh.designVersion >= 2 ? { colorLiteralCount: countColorLiterals(fresh.body) } : {}
117565
118177
  } : {};
117566
118178
  const { ignored } = themeFields;
117567
- return toolOk(`Page "${input.title}" saved (slug=${finalSlug}, version=${version}, designVersion=${fresh.designVersion}).` + (ignored.length > 0 ? " Some theme tokens were ignored (outside the page token contract or referencing a variable outside it)." : ""), {
118179
+ const movedSessionRootId = input.key !== undefined && assetKey ? await fileCallerSessionIntoGroup({
118180
+ sourceTaskId: requestInfo.sourceTaskId,
118181
+ agentId: requestInfo.agentId,
118182
+ key: assetKey,
118183
+ changedBy: trustedUserId ?? undefined
118184
+ }) : null;
118185
+ return toolOk(`Page "${input.title}" saved (slug=${finalSlug}, version=${version}, designVersion=${fresh.designVersion}).` + (ignored.length > 0 ? " Some theme tokens were ignored (outside the page token contract or referencing a variable outside it)." : "") + (movedSessionRootId ? ` This session moved into ${assetKey}.` : ""), {
117568
118186
  details: `API: ${apiUrl}
117569
118187
  App: ${appUrl}` + (ignored.length > 0 ? `
117570
118188
  Ignored theme tokens: ${ignored.join(", ")}` : ""),
@@ -117577,7 +118195,8 @@ var SWARM_CLASS, COLOR_TOKEN_REFERENCE, PAGE_COLOR_TOKENS, registerCreatePageToo
117577
118195
  api_url: apiUrl,
117578
118196
  designVersion: fresh.designVersion,
117579
118197
  ...ignored.length > 0 ? { ignoredTokens: ignored } : {},
117580
- ...designFlags
118198
+ ...designFlags,
118199
+ ...movedSessionRootId ? { movedSessionRootId } : {}
117581
118200
  }
117582
118201
  });
117583
118202
  });
@@ -117586,6 +118205,7 @@ var init_create_page = __esm(() => {
117586
118205
  init_zod();
117587
118206
  init_asset_key_auth();
117588
118207
  init_audit_user();
118208
+ init_caller_session_group();
117589
118209
  init_db4();
117590
118210
  init_page_versions();
117591
118211
  init_color_literals();
@@ -117593,7 +118213,7 @@ var init_create_page = __esm(() => {
117593
118213
  init_page_fields();
117594
118214
  init_tokens2();
117595
118215
  init_utils();
117596
- init_types4();
118216
+ init_types5();
117597
118217
  init_constants3();
117598
118218
  SWARM_CLASS = /(?:^|\s)swarm-/;
117599
118219
  COLOR_TOKEN_REFERENCE = /var\(\s*--color-/i;
@@ -117619,13 +118239,28 @@ var init_app_validation = __esm(() => {
117619
118239
 
117620
118240
  // src/oauth/presets.ts
117621
118241
  function listOAuthPresets() {
117622
- return OAUTH_PRESETS.map((preset) => ({ ...preset }));
118242
+ return OAUTH_PRESETS.map(withGitHubHost);
118243
+ }
118244
+ function withGitHubHost(preset) {
118245
+ if (preset.id !== "github")
118246
+ return { ...preset };
118247
+ const { webUrl, apiUrl, enterprise } = getGitHubLinkConfig();
118248
+ if (!enterprise)
118249
+ return { ...preset };
118250
+ return {
118251
+ ...preset,
118252
+ authorizeUrl: `${webUrl}/login/oauth/authorize`,
118253
+ tokenUrl: `${webUrl}/login/oauth/access_token`,
118254
+ userinfoUrl: `${apiUrl}/user`,
118255
+ setupHints: preset.setupHints.map((hint) => hint.replace("github.com/settings/developers", `${webUrl}/settings/developers`))
118256
+ };
117623
118257
  }
117624
118258
  function listOAuthPresetIds() {
117625
118259
  return OAUTH_PRESETS.map((preset) => preset.id);
117626
118260
  }
117627
118261
  function getOAuthPreset(id) {
117628
- return OAUTH_PRESETS.find((preset) => preset.id === id) ?? null;
118262
+ const preset = OAUTH_PRESETS.find((candidate) => candidate.id === id);
118263
+ return preset ? withGitHubHost(preset) : null;
117629
118264
  }
117630
118265
  function mergeExtraParams(base, override) {
117631
118266
  if (!base && !override)
@@ -117651,6 +118286,7 @@ function hydrateOAuthAppFromPreset(preset, overrides = {}) {
117651
118286
  }
117652
118287
  var OAUTH_PRESETS;
117653
118288
  var init_presets2 = __esm(() => {
118289
+ init_github_host();
117654
118290
  OAUTH_PRESETS = [
117655
118291
  {
117656
118292
  id: "google",
@@ -117708,6 +118344,7 @@ var init_presets2 = __esm(() => {
117708
118344
  },
117709
118345
  {
117710
118346
  id: "jira",
118347
+ hiddenInCatalog: true,
117711
118348
  displayName: "Jira (Atlassian)",
117712
118349
  provider: "jira",
117713
118350
  authorizeUrl: "https://auth.atlassian.com/authorize",
@@ -117727,6 +118364,7 @@ var init_presets2 = __esm(() => {
117727
118364
  },
117728
118365
  {
117729
118366
  id: "linear",
118367
+ hiddenInCatalog: true,
117730
118368
  displayName: "Linear",
117731
118369
  provider: "linear",
117732
118370
  authorizeUrl: "https://linear.app/oauth/authorize",
@@ -119839,7 +120477,7 @@ var init_worker_follow_up = __esm(() => {
119839
120477
  init_dispatcher();
119840
120478
  init_resolver();
119841
120479
  init_deferred_task_waits();
119842
- init_types4();
120480
+ init_types5();
119843
120481
  init_env_flag();
119844
120482
  init_task_attachment_links();
119845
120483
  init_context_key();
@@ -120052,7 +120690,7 @@ async function guardTerminalTaskResultWrite(task, write) {
120052
120690
  }
120053
120691
  var init_terminal_result_guard = __esm(() => {
120054
120692
  init_db4();
120055
- init_types4();
120693
+ init_types5();
120056
120694
  init_output_schema();
120057
120695
  init_secret_scrubber();
120058
120696
  init_json_schema_validator();
@@ -120155,7 +120793,7 @@ var DeferAbortedError, registerDeferTaskTool = (server) => {
120155
120793
  message: "Provide exactly one of wakeOn.taskId or wakeOn.taskIds."
120156
120794
  }).refine((wake) => !wake.taskIds || new Set(wake.taskIds).size === wake.taskIds.length, {
120157
120795
  message: "wakeOn.taskIds must not contain duplicates."
120158
- }).optional().describe("Wake early on a task event. Provide taskId or nonempty, unique taskIds. mode defaults to all (every member must match); any wakes on the first match. settled covers completed, failed, cancelled, or skipped. Deferred and superseded members follow their continuations; a superseded member without a resume child holds to the ceiling. Any already-terminal member rejects the request; one delayMs/runAt ceiling is still required for the whole set. The member whose settlement wakes you creates no separate lead follow-up for your agent unless its followUpConfig sets onCompleted/onFailed; an all-mode member that settles while others are pending still does."),
120796
+ }).optional().describe("Wake early on a task event. Provide taskId or nonempty, unique taskIds. mode defaults to all (every member must match); any wakes on the first match. settled covers completed, failed, cancelled, or skipped. Deferred and superseded members follow their continuations; a superseded member without a resume child holds to the ceiling, except a workflow step superseded by its queued retry, which counts as failed. Any already-terminal member rejects the request; one delayMs/runAt ceiling is still required for the whole set. The member whose settlement wakes you creates no separate lead follow-up for your agent unless its followUpConfig sets onCompleted/onFailed; an all-mode member that settles while others are pending still does."),
120159
120797
  summary: string2().min(1).max(4000).describe("What you did so far and where things stand. Stored in the task log for tasks with an outputSchema; otherwise becomes the task's output."),
120160
120798
  output: string2().optional().describe("Required when the task has an outputSchema: a JSON string matching that schema, stored verbatim as terminal output. Ignored for tasks without an outputSchema."),
120161
120799
  note: string2().min(1).max(2000).describe("What is pending, and what to check on wake-up."),
@@ -120341,7 +120979,7 @@ var init_defer_task = __esm(() => {
120341
120979
  init_terminal_result_guard();
120342
120980
  init_task_tool_ctx();
120343
120981
  init_utils();
120344
- init_types4();
120982
+ init_types5();
120345
120983
  init_business_use();
120346
120984
  DeferAbortedError = class DeferAbortedError extends Error {
120347
120985
  };
@@ -120931,7 +121569,7 @@ var EXTENSION_INSTALL_DESCRIPTION = "Install an extension from the catalog by `t
120931
121569
  var init_extension_install = __esm(() => {
120932
121570
  init_zod();
120933
121571
  init_utils();
120934
- init_types4();
121572
+ init_types5();
120935
121573
  init_extension_common();
120936
121574
  extensionInstallInputSchema = object2({
120937
121575
  template: string2().min(1).optional().describe("Name of a predefined extension from extension-catalog. Mutually exclusive with manifest and files."),
@@ -121045,8 +121683,11 @@ var agentOutputShape, registerGetSwarmTool = (server) => {
121045
121683
  agents: array2(agentOutputShape).optional()
121046
121684
  })
121047
121685
  }, async ({ includeFull }, requestInfo, _meta) => {
121048
- const agents = await getAllAgents2({ slim: !includeFull });
121049
- const agentList = agents.map((a) => `- ${a.name} (${a.status}${a.isLead ? ", lead" : ""}) — id: ${a.id}`).join(`
121686
+ const agents = await Promise.all((await getAllAgents2({ slim: !includeFull })).map(async (a) => await isAgentOnDemand(a) ? { ...a, onDemand: true } : a));
121687
+ const agentList = agents.map((a) => {
121688
+ const onDemand = "onDemand" in a ? ", on demand: send-task starts it" : "";
121689
+ return `- ${a.name} (${a.status}${onDemand}${a.isLead ? ", lead" : ""}) — id: ${a.id}`;
121690
+ }).join(`
121050
121691
  `);
121051
121692
  return toolOk(`Found ${agents.length} agent(s) in the swarm. Requested by session: ${requestInfo.sessionId}`, {
121052
121693
  details: agentList || undefined,
@@ -121057,13 +121698,15 @@ var agentOutputShape, registerGetSwarmTool = (server) => {
121057
121698
  var init_get_swarm = __esm(() => {
121058
121699
  init_zod();
121059
121700
  init_db4();
121701
+ init_reachability();
121060
121702
  init_utils();
121061
- init_types4();
121703
+ init_types5();
121062
121704
  agentOutputShape = looseObject({
121063
121705
  id: string2().optional(),
121064
121706
  name: string2().optional(),
121065
121707
  isLead: boolean().optional(),
121066
121708
  status: AgentStatusSchema.optional(),
121709
+ onDemand: boolean().optional().describe("True when the agent is offline but its runtime pool will start a runtime for it (multi-runtime on, pool capacity left, maxTasks fits one runtime). send-task to it starts a runtime."),
121067
121710
  description: string2().optional(),
121068
121711
  role: string2().optional(),
121069
121712
  capabilities: array2(string2()).optional(),
@@ -121212,7 +121855,7 @@ var init_get_tasks = __esm(() => {
121212
121855
  init_db4();
121213
121856
  init_task_tool_ctx();
121214
121857
  init_utils();
121215
- init_types4();
121858
+ init_types5();
121216
121859
  TaskSummarySchema = looseObject({
121217
121860
  id: string2().optional(),
121218
121861
  key: string2().optional(),
@@ -121392,7 +122035,7 @@ var agentOutputShape2, registerJoinSwarmTool = (server) => {
121392
122035
  capabilities,
121393
122036
  claudeMd: defaultClaudeMd,
121394
122037
  soulMd: defaultSoulMd,
121395
- identityMd: defaultIdentityMd
122038
+ identityMd: agent.identityMd || defaultIdentityMd
121396
122039
  });
121397
122040
  return updatedAgent ?? agent;
121398
122041
  });
@@ -121409,7 +122052,7 @@ var init_join_swarm = __esm(() => {
121409
122052
  init_db4();
121410
122053
  init_defaults();
121411
122054
  init_utils();
121412
- init_types4();
122055
+ init_types5();
121413
122056
  agentOutputShape2 = looseObject({
121414
122057
  id: string2().optional(),
121415
122058
  name: string2().optional(),
@@ -121439,6 +122082,9 @@ var init_join_swarm = __esm(() => {
121439
122082
  });
121440
122083
 
121441
122084
  // src/kv-reserved-namespaces.ts
122085
+ function requiresLeadToWrite(namespace) {
122086
+ return LEAD_ONLY_FAMILIES.has(namespace.split(":", 1)[0] ?? "");
122087
+ }
121442
122088
  function reservedNamespaceError(namespace) {
121443
122089
  return RESERVED_FAMILIES.get(namespace.split(":", 1)[0] ?? "") ?? null;
121444
122090
  }
@@ -121448,7 +122094,7 @@ function privateNamespaceError(namespace) {
121448
122094
  function reservedRoomKeyError(key) {
121449
122095
  return key.startsWith("_room/") ? "room snapshot keys are reserved; use the room endpoints" : null;
121450
122096
  }
121451
- var RESERVED_FAMILIES, PRIVATE_FAMILIES;
122097
+ var RESERVED_FAMILIES, PRIVATE_FAMILIES, LEAD_ONLY_FAMILIES;
121452
122098
  var init_kv_reserved_namespaces = __esm(() => {
121453
122099
  RESERVED_FAMILIES = new Map([
121454
122100
  ["apps", "namespace is reserved for swarm apps; use the app row endpoints"],
@@ -121457,12 +122103,14 @@ var init_kv_reserved_namespaces = __esm(() => {
121457
122103
  ["worker", "namespace is reserved for worker nudges"],
121458
122104
  ["slack-external-alert", "namespace is reserved for Slack external channel alerts"],
121459
122105
  ["slack-left-thread", "namespace is reserved for left Slack threads; use slack-leave-thread"],
122106
+ ["slack-thread-buffer", "namespace is reserved for the Slack thread buffer"],
121460
122107
  [
121461
122108
  "session-labels",
121462
122109
  "namespace is reserved for session source labels; GET /api/session-tree returns them"
121463
122110
  ]
121464
122111
  ]);
121465
- PRIVATE_FAMILIES = new Set(["session-labels"]);
122112
+ PRIVATE_FAMILIES = new Set(["session-labels", "slack-thread-buffer"]);
122113
+ LEAD_ONLY_FAMILIES = new Set(["usecase"]);
121466
122114
  });
121467
122115
 
121468
122116
  // src/tools/kv/kv-write-auth.ts
@@ -121481,6 +122129,17 @@ async function kvWriteAuthError(namespace, info, key) {
121481
122129
  if (namespace.startsWith("task:page:")) {
121482
122130
  return "task:page:* writes require a page-proxy request, not an MCP call";
121483
122131
  }
122132
+ if (requiresLeadToWrite(namespace)) {
122133
+ const agent = info.agentId ? await getAgentById2(info.agentId) : null;
122134
+ const allowed = info.agentId != null && can({
122135
+ principal: { kind: "agent", agentId: info.agentId, isLead: agent?.isLead ?? false },
122136
+ verb: "kv.write.any",
122137
+ resource: { kind: "kv-namespace", namespace },
122138
+ source: "mcp"
122139
+ }).allow;
122140
+ if (!allowed)
122141
+ return "writes to this namespace require lead";
122142
+ }
121484
122143
  if (namespace.startsWith("task:agent:")) {
121485
122144
  const ownNamespace = info.agentId != null && namespace === `task:agent:${info.agentId}`;
121486
122145
  const agent = !ownNamespace && info.agentId ? await getAgentById2(info.agentId) : null;
@@ -121569,7 +122228,7 @@ var init_kv_delete = __esm(() => {
121569
122228
  init_zod();
121570
122229
  init_db4();
121571
122230
  init_utils();
121572
- init_types4();
122231
+ init_types5();
121573
122232
  init_kv_write_auth();
121574
122233
  init_resolve_namespace();
121575
122234
  });
@@ -121693,7 +122352,7 @@ var init_kv_get = __esm(() => {
121693
122352
  init_db4();
121694
122353
  init_kv_view();
121695
122354
  init_utils();
121696
- init_types4();
122355
+ init_types5();
121697
122356
  init_kv_read_auth();
121698
122357
  init_resolve_namespace();
121699
122358
  kvEntryOutputSchema = looseObject({
@@ -121764,7 +122423,7 @@ var init_kv_incr = __esm(() => {
121764
122423
  init_zod();
121765
122424
  init_db4();
121766
122425
  init_utils();
121767
- init_types4();
122426
+ init_types5();
121768
122427
  init_kv_write_auth();
121769
122428
  init_resolve_namespace();
121770
122429
  kvEntryOutputSchema2 = looseObject({
@@ -121839,7 +122498,7 @@ var init_kv_list = __esm(() => {
121839
122498
  init_zod();
121840
122499
  init_db4();
121841
122500
  init_utils();
121842
- init_types4();
122501
+ init_types5();
121843
122502
  init_kv_read_auth();
121844
122503
  init_resolve_namespace();
121845
122504
  kvEntryOutputSchema3 = looseObject({
@@ -121945,7 +122604,7 @@ var init_kv_set = __esm(() => {
121945
122604
  init_zod();
121946
122605
  init_db4();
121947
122606
  init_utils();
121948
- init_types4();
122607
+ init_types5();
121949
122608
  init_kv_write_auth();
121950
122609
  init_resolve_namespace();
121951
122610
  MAX_KV_BODY_BYTES = 2 * 1024 * 1024;
@@ -121994,7 +122653,7 @@ var init_list_channels = __esm(() => {
121994
122653
  init_zod();
121995
122654
  init_db4();
121996
122655
  init_utils();
121997
- init_types4();
122656
+ init_types5();
121998
122657
  ChannelOutputSchema2 = looseObject({
121999
122658
  id: string2().optional(),
122000
122659
  name: string2().optional(),
@@ -122941,7 +123600,7 @@ var init_memory_edit = __esm(() => {
122941
123600
  init_link_resolver();
122942
123601
  init_rbac();
122943
123602
  init_utils();
122944
- init_types4();
123603
+ init_types5();
122945
123604
  agentMemoryOutputSchema = looseObject({
122946
123605
  id: string2().optional(),
122947
123606
  agentId: string2().nullable().optional(),
@@ -123139,7 +123798,7 @@ var init_memory_get = __esm(() => {
123139
123798
  init_links_store();
123140
123799
  init_retrieval();
123141
123800
  init_utils();
123142
- init_types4();
123801
+ init_types5();
123143
123802
  NUDGE_ELIGIBLE_SOURCES = new Set(["manual", "file_index"]);
123144
123803
  agentMemoryOutputSchema2 = looseObject({
123145
123804
  id: string2().optional(),
@@ -123514,7 +124173,7 @@ var init_memory_search = __esm(() => {
123514
124173
  init_reranker();
123515
124174
  init_search_candidates();
123516
124175
  init_utils();
123517
- init_types4();
124176
+ init_types5();
123518
124177
  NUDGE_ELIGIBLE_SOURCES2 = new Set(["manual", "file_index"]);
123519
124178
  memorySearchOutputSchema = swarmToolOutputSchema({
123520
124179
  yourAgentId: string2().optional(),
@@ -123615,7 +124274,7 @@ var init_memory_store = __esm(() => {
123615
124274
  init_key_guard();
123616
124275
  init_key_paths();
123617
124276
  init_utils();
123618
- init_types4();
124277
+ init_types5();
123619
124278
  });
123620
124279
 
123621
124280
  // src/tools/model-catalog/index.ts
@@ -123811,7 +124470,7 @@ var init_list_model_profiles = __esm(() => {
123811
124470
  init_zod();
123812
124471
  init_model_profiles();
123813
124472
  init_utils();
123814
- init_types4();
124473
+ init_types5();
123815
124474
  });
123816
124475
 
123817
124476
  // src/tools/my-agent-info.ts
@@ -123844,7 +124503,7 @@ var init_my_agent_info = __esm(() => {
123844
124503
  init_zod();
123845
124504
  init_db4();
123846
124505
  init_utils();
123847
- init_types4();
124506
+ init_types5();
123848
124507
  agentOutputShape3 = looseObject({
123849
124508
  id: string2().optional(),
123850
124509
  name: string2().optional(),
@@ -124472,7 +125131,7 @@ var init_list = __esm(() => {
124472
125131
  init_zod();
124473
125132
  init_db4();
124474
125133
  init_utils();
124475
- init_types4();
125134
+ init_types5();
124476
125135
  promptTemplateOutputShape2 = looseObject({
124477
125136
  id: string2().optional(),
124478
125137
  eventType: string2().optional(),
@@ -124596,7 +125255,7 @@ var init_set2 = __esm(() => {
124596
125255
  init_zod();
124597
125256
  init_db4();
124598
125257
  init_utils();
124599
- init_types4();
125258
+ init_types5();
124600
125259
  promptTemplateOutputShape3 = looseObject({
124601
125260
  id: string2().optional(),
124602
125261
  eventType: string2().optional(),
@@ -125422,7 +126081,7 @@ var init_update_repo = __esm(() => {
125422
126081
  init_repo_checked_update();
125423
126082
  init_rbac();
125424
126083
  init_utils();
125425
- init_types4();
126084
+ init_types5();
125426
126085
  swarmRepoOutputShape2 = looseObject({
125427
126086
  id: string2().optional(),
125428
126087
  url: string2().optional(),
@@ -131982,7 +132641,7 @@ var init_rooms2 = __esm(() => {
131982
132641
  init_document();
131983
132642
  init_rooms();
131984
132643
  init_utils();
131985
- init_types4();
132644
+ init_types5();
131986
132645
  roomInput = object2({
131987
132646
  name: string2().regex(/^[a-zA-Z0-9_-]{1,64}$/).default("default"),
131988
132647
  namespace: KvNamespaceSchema.optional(),
@@ -132105,7 +132764,7 @@ var registerRuntimePoolCreateAgentTool = (server) => {
132105
132764
  };
132106
132765
  var init_runtime_pool_create_agent = __esm(() => {
132107
132766
  init_zod();
132108
- init_types4();
132767
+ init_types5();
132109
132768
  init_runtime_pool_common();
132110
132769
  init_utils();
132111
132770
  });
@@ -132181,7 +132840,7 @@ var registerRuntimePoolUpsertTool = (server) => {
132181
132840
  };
132182
132841
  var init_runtime_pool_upsert = __esm(() => {
132183
132842
  init_zod();
132184
- init_types4();
132843
+ init_types5();
132185
132844
  init_runtime_pool_common();
132186
132845
  init_utils();
132187
132846
  });
@@ -132201,7 +132860,8 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132201
132860
  outputSchema: swarmToolOutputSchema({
132202
132861
  yourAgentId: string2().optional(),
132203
132862
  schedule: looseObject(scheduleDataShape).optional(),
132204
- modelTierDeprecated: modelTierDeprecatedOutputSchema.optional()
132863
+ modelTierDeprecated: modelTierDeprecatedOutputSchema.optional(),
132864
+ movedSessionRootId: string2().optional()
132205
132865
  })
132206
132866
  }, async ({
132207
132867
  key,
@@ -132327,7 +132987,8 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132327
132987
  nextRunAt = calculateNextRun2(tempSchedule, new Date);
132328
132988
  }
132329
132989
  const createdBy = await resolveTaskAuditUserId(requestInfo.sourceTaskId, requestInfo.agentId) ?? undefined;
132330
- const assetKey = key ? await authorizeAssetKeyWrite(key, createdBy) : undefined;
132990
+ const resolvedKey = key ?? await resolveTaskGroupKey(requestInfo.sourceTaskId, requestInfo.agentId);
132991
+ const assetKey = resolvedKey ? await authorizeAssetKeyWrite(resolvedKey, createdBy) : undefined;
132331
132992
  const schedule = await createScheduledTask2({
132332
132993
  key: assetKey,
132333
132994
  name,
@@ -132353,13 +133014,21 @@ var import_cron_parser2, createScheduleInputSchema, scheduleDataShape, registerC
132353
133014
  scheduleType: scheduleType ?? "recurring",
132354
133015
  createdBy
132355
133016
  });
133017
+ const movedSessionRootId = key !== undefined && assetKey ? await fileCallerSessionIntoGroup({
133018
+ sourceTaskId: requestInfo.sourceTaskId,
133019
+ agentId: requestInfo.agentId,
133020
+ key: assetKey,
133021
+ changedBy: createdBy
133022
+ }) : null;
132356
133023
  const scheduleDesc = isOneTime ? `one-time at ${schedule.nextRunAt}` : cronExpression || `every ${intervalMs}ms`;
132357
133024
  const modelTierDeprecated = modelTierDeprecation(modelTier, targetHarness);
132358
- return toolOk(`Created schedule "${name}" (${scheduleDesc}). Next run: ${schedule.nextRunAt || "disabled"}`, {
133025
+ const movedNote = movedSessionRootId ? `. This session moved into ${assetKey}.` : "";
133026
+ return toolOk(`Created schedule "${name}" (${scheduleDesc}). Next run: ${schedule.nextRunAt || "disabled"}${movedNote}`, {
132359
133027
  data: {
132360
133028
  yourAgentId: requestInfo.agentId,
132361
133029
  schedule,
132362
- ...modelTierDeprecated ? { modelTierDeprecated } : {}
133030
+ ...modelTierDeprecated ? { modelTierDeprecated } : {},
133031
+ ...movedSessionRootId ? { movedSessionRootId } : {}
132363
133032
  }
132364
133033
  });
132365
133034
  } catch (error) {
@@ -132379,16 +133048,17 @@ var init_create_schedule = __esm(() => {
132379
133048
  init_zod();
132380
133049
  init_asset_key_auth();
132381
133050
  init_audit_user();
133051
+ init_caller_session_group();
132382
133052
  init_db4();
132383
133053
  init_model_profiles();
132384
133054
  init_model_validation2();
132385
133055
  init_db3();
132386
133056
  init_scheduler2();
132387
133057
  init_utils();
132388
- init_types4();
132389
- import_cron_parser2 = __toESM(require_dist2(), 1);
133058
+ init_types5();
133059
+ import_cron_parser2 = __toESM(require_dist(), 1);
132390
133060
  createScheduleInputSchema = object2({
132391
- key: AssetKeySchema.optional().describe("Logical namespace. Defaults to a shared/schedule:<id>/ resource key."),
133061
+ key: AssetKeySchema.optional().describe("Logical namespace. Defaults to the calling task's group key when it has one, else shared/schedule:<id>/. An explicit use-case group key also files the calling task's session into that group while the session still has its default key, so the planning session, the schedule and its runs share one key."),
132392
133062
  name: string2().min(1).max(100).describe("Unique name for the schedule (e.g., 'daily-cleanup')"),
132393
133063
  taskTemplate: string2().min(1).optional().describe("The task description that will be created each time. Required when targetType is 'agent-task' (the default)."),
132394
133064
  targetType: ScheduledTaskTargetTypeSchema.default("agent-task").optional().describe("Execution target. Use 'workflow' + workflowId when the schedule only starts a workflow; " + "use 'script' + scriptName/scriptArgs when it only runs a catalog script; " + "use 'agent-task' only when a reasoning agent genuinely needs to be in the loop. " + "Do not create an agent-task whose taskTemplate just tells an agent to trigger a workflow or script."),
@@ -133005,7 +133675,7 @@ var init_list_schedules = __esm(() => {
133005
133675
  init_zod();
133006
133676
  init_db4();
133007
133677
  init_utils();
133008
- init_types4();
133678
+ init_types5();
133009
133679
  scheduleRowShape = {
133010
133680
  id: string2().optional(),
133011
133681
  key: AssetKeySchema.optional(),
@@ -133287,8 +133957,8 @@ var init_patch_schedule = __esm(() => {
133287
133957
  init_rbac();
133288
133958
  init_scheduler2();
133289
133959
  init_utils();
133290
- init_types4();
133291
- import_cron_parser3 = __toESM(require_dist2(), 1);
133960
+ init_types5();
133961
+ import_cron_parser3 = __toESM(require_dist(), 1);
133292
133962
  patchScheduleInputSchema = object2({
133293
133963
  key: AssetKeySchema.optional().describe("Move to a logical namespace."),
133294
133964
  scheduleId: string2().uuid().optional().describe("Schedule ID to patch"),
@@ -133645,8 +134315,8 @@ var init_update_schedule = __esm(() => {
133645
134315
  init_rbac();
133646
134316
  init_scheduler2();
133647
134317
  init_utils();
133648
- init_types4();
133649
- import_cron_parser4 = __toESM(require_dist2(), 1);
134318
+ init_types5();
134319
+ import_cron_parser4 = __toESM(require_dist(), 1);
133650
134320
  updateScheduleInputSchema = object2({
133651
134321
  key: AssetKeySchema.optional().describe("Move to a logical namespace."),
133652
134322
  scheduleId: string2().uuid().optional().describe("Schedule ID to update"),
@@ -134443,7 +135113,7 @@ var LAUNCH_SCRIPT_RUN_DESCRIPTION = "Launch a durable one-off script workflow ru
134443
135113
  var init_script_runs = __esm(() => {
134444
135114
  init_zod();
134445
135115
  init_utils();
134446
- init_types4();
135116
+ init_types5();
134447
135117
  init_script_common();
134448
135118
  });
134449
135119
 
@@ -135036,7 +135706,7 @@ var init_send_task = __esm(() => {
135036
135706
  init_task_dedup();
135037
135707
  init_task_tool_ctx();
135038
135708
  init_utils();
135039
- init_types4();
135709
+ init_types5();
135040
135710
  init_json_schema_validator();
135041
135711
  init_reachability();
135042
135712
  init_get_task_details();
@@ -136237,6 +136907,22 @@ function isTableBlock(block) {
136237
136907
  function decodeMrkdwn(text) {
136238
136908
  return text.replace(/<[^<>]*>/g, "").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
136239
136909
  }
136910
+ function decodeEntities(text) {
136911
+ return text.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&");
136912
+ }
136913
+ function collapseWhitespace(text) {
136914
+ return text.replace(/\s+/g, " ").trim();
136915
+ }
136916
+ function containsOnWordBoundaries(haystack, needle) {
136917
+ const WORD = "[\\p{L}\\p{N}\\p{M}_]";
136918
+ const isWord = (char) => char !== undefined && new RegExp(WORD, "u").test(char);
136919
+ const first = needle.codePointAt(0);
136920
+ const startsWord = first !== undefined && isWord(String.fromCodePoint(first));
136921
+ const endsWord = isWord(Array.from(needle).at(-1));
136922
+ const escaped = needle.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
136923
+ const pattern = `${startsWord ? `(?<!${WORD})` : ""}${escaped}${endsWord ? `(?!${WORD})` : ""}`;
136924
+ return new RegExp(pattern, "u").test(haystack);
136925
+ }
136240
136926
  function normalizeForDedupe(text) {
136241
136927
  return text.replace(/:[a-z0-9_+'-]+:/gi, "").replace(/^[ \t]*(?:>|[•◦▪‣-]|\d+\.)[ \t]*/gm, "").replace(/[*_~`]/g, "").replace(/\s+/g, "");
136242
136928
  }
@@ -136288,6 +136974,7 @@ function extractSlackMessageText(msg) {
136288
136974
  }
136289
136975
  const blockParts = [];
136290
136976
  const richTextRanges = [];
136977
+ const tableParts = new Set;
136291
136978
  if (Array.isArray(msg.blocks) && msg.blocks.length > 0) {
136292
136979
  for (const rawBlock of msg.blocks) {
136293
136980
  if (rawBlock == null || typeof rawBlock !== "object")
@@ -136312,8 +136999,10 @@ function extractSlackMessageText(msg) {
136312
136999
  richTextRanges.push([start, blockParts.length]);
136313
137000
  } else if (isTableBlock(block)) {
136314
137001
  const table = renderTableBlock(block);
136315
- if (table)
137002
+ if (table) {
137003
+ tableParts.add(blockParts.length);
136316
137004
  blockParts.push(table);
137005
+ }
136317
137006
  } else if (block.type === "header") {
136318
137007
  if (block.text?.text)
136319
137008
  blockParts.push(block.text.text);
@@ -136342,20 +137031,29 @@ function extractSlackMessageText(msg) {
136342
137031
  }
136343
137032
  }
136344
137033
  }
136345
- let bodyBlockParts = blockParts;
137034
+ const dropped = new Set;
136346
137035
  if (topText && richTextRanges.length > 0) {
136347
137036
  const richText = richTextRanges.map(([start, end]) => blockParts.slice(start, end).join(`
136348
137037
  `)).join(`
136349
137038
  `);
136350
137039
  if (normalizeForDedupe(richText) === normalizeForDedupe(decodeMrkdwn(topText))) {
136351
- const dropped = new Set;
136352
137040
  for (const [start, end] of richTextRanges) {
136353
137041
  for (let i = start;i < end; i++)
136354
137042
  dropped.add(i);
136355
137043
  }
136356
- bodyBlockParts = blockParts.filter((_, i) => !dropped.has(i));
136357
137044
  }
136358
137045
  }
137046
+ if (topText) {
137047
+ const covered = collapseWhitespace(decodeEntities(topText));
137048
+ blockParts.forEach((part, i) => {
137049
+ if (tableParts.has(i))
137050
+ return;
137051
+ const normalized = collapseWhitespace(decodeEntities(part));
137052
+ if (normalized && containsOnWordBoundaries(covered, normalized))
137053
+ dropped.add(i);
137054
+ });
137055
+ }
137056
+ const bodyBlockParts = blockParts.filter((_, i) => !dropped.has(i));
136359
137057
  const bodyText = [...attachmentParts, ...bodyBlockParts].filter(Boolean).join(`
136360
137058
  `);
136361
137059
  const bodyLines = new Set(bodyText.split(`
@@ -136474,6 +137172,77 @@ var init_slack_delete = __esm(() => {
136474
137172
  init_utils();
136475
137173
  });
136476
137174
 
137175
+ // src/be/db/tasks/slack-fold.ts
137176
+ async function getDeliveredSlackMessageTs(channelId, threadTs) {
137177
+ const rows = await getDbClient2().query(`SELECT slackTriggerMessageTs AS ts FROM agent_tasks
137178
+ WHERE slackChannelId = ? AND slackThreadTs = ? AND slackTriggerMessageTs IS NOT NULL
137179
+ UNION
137180
+ SELECT CASE WHEN json_valid(l.metadata) THEN json_extract(l.metadata, '$.slackMessageTs') END AS ts
137181
+ FROM agent_log l
137182
+ JOIN agent_tasks t ON t.id = l.taskId
137183
+ WHERE t.slackChannelId = ? AND t.slackThreadTs = ?
137184
+ AND l.eventType = 'task_steering' AND l.newValue = 'slack_reaction'`, [channelId, threadTs, channelId, threadTs]);
137185
+ return new Set(rows.flatMap((row) => row.ts ? [row.ts] : []));
137186
+ }
137187
+ async function foldIntoPendingSlackTask(args) {
137188
+ return await getDbClient2().transaction(async (tx) => {
137189
+ const result = await tx.run(`UPDATE agent_tasks
137190
+ SET task = ?,
137191
+ status = CASE WHEN ? THEN 'draft' ELSE status END,
137192
+ slackParticipants = COALESCE(?, slackParticipants),
137193
+ lastUpdatedAt = ?
137194
+ WHERE id = ? AND status = 'pending' AND task = ?`, [
137195
+ args.nextTask,
137196
+ args.toDraft ? 1 : 0,
137197
+ args.slackParticipants ? JSON.stringify(args.slackParticipants) : null,
137198
+ new Date().toISOString(),
137199
+ args.taskId,
137200
+ args.expectedTask
137201
+ ]);
137202
+ if (result.changes === 0)
137203
+ return false;
137204
+ if (args.toDraft) {
137205
+ await createLogEntry2({
137206
+ eventType: "task_status_change",
137207
+ taskId: args.taskId,
137208
+ oldValue: "pending",
137209
+ newValue: "draft"
137210
+ });
137211
+ }
137212
+ for (const messageTs of args.messageTs) {
137213
+ await createLogEntry2({
137214
+ eventType: "task_steering",
137215
+ taskId: args.taskId,
137216
+ newValue: "slack_reaction",
137217
+ metadata: { slackChannelId: args.slackChannelId, slackMessageTs: messageTs, folded: true }
137218
+ });
137219
+ }
137220
+ return true;
137221
+ });
137222
+ }
137223
+ async function createSlackTaskCarryingMessages(prepared, carried) {
137224
+ return await getDbClient2().transaction(async () => {
137225
+ const task = await createTaskExtended2(prepared.description, prepared.options);
137226
+ for (const messageTs of carried.messageTs) {
137227
+ await createLogEntry2({
137228
+ eventType: "task_steering",
137229
+ taskId: task.id,
137230
+ newValue: "slack_reaction",
137231
+ metadata: {
137232
+ slackChannelId: carried.slackChannelId,
137233
+ slackMessageTs: messageTs,
137234
+ buffered: true
137235
+ }
137236
+ });
137237
+ }
137238
+ return task;
137239
+ });
137240
+ }
137241
+ var init_slack_fold = __esm(() => {
137242
+ init_db4();
137243
+ init_runtime2();
137244
+ });
137245
+
136477
137246
  // src/slack/templates.ts
136478
137247
  var init_templates = __esm(() => {
136479
137248
  init_registry3();
@@ -136693,25 +137462,29 @@ async function downloadSlackFile(file, token, path) {
136693
137462
  return `download failed (${errorText2(error)})`;
136694
137463
  }
136695
137464
  }
136696
- async function createSlackTaskWithFiles(description, options, inbound, slack) {
137465
+ async function createSlackTaskWithFiles(description, options, inbound, slack, carriedMessageTs = []) {
137466
+ options = { ...options, routingAffinity: options.routingAffinity ?? { capabilities: [] } };
136697
137467
  noteSlackInboundSideEffect("task_created");
136698
137468
  const context = { origin: "slack", slack };
137469
+ const create = async (createOptions) => carriedMessageTs.length === 0 || !createOptions.slackChannelId ? await createTaskWithSiblingAwareness(description, createOptions, context) : await createSlackTaskCarryingMessages(await prepareTaskWithSiblingAwareness(description, createOptions, context), { slackChannelId: createOptions.slackChannelId, messageTs: carriedMessageTs });
136699
137470
  if (inbound.fetched.length === 0) {
136700
- const task = await createTaskWithSiblingAwareness(description, options, context);
137471
+ const task = await create(options);
136701
137472
  return { task, unattached: inbound.failed };
136702
137473
  }
136703
- const task = await createTaskWithSiblingAwareness(description, { ...options, status: "draft" }, context);
136704
- const unattached = [...inbound.failed];
137474
+ const task = await create({ ...options, status: "draft" });
137475
+ const unattached = [...inbound.failed, ...await attachSlackFilesToDraft(task.id, inbound)];
137476
+ return { task, unattached };
137477
+ }
137478
+ async function attachSlackFilesToDraft(taskId, inbound) {
136705
137479
  const lease = setInterval(() => {
136706
- refreshDraftTaskLease2(task.id).catch((error) => console.warn(`[Slack] could not renew the draft lease of task ${task.id}: ${errorText2(error)}`));
137480
+ refreshDraftTaskLease2(taskId).catch((error) => console.warn(`[Slack] could not renew the draft lease of task ${taskId}: ${errorText2(error)}`));
136707
137481
  }, draftLeaseRefreshMs);
136708
137482
  try {
136709
- unattached.push(...(await attachSlackFilesToTask(task.id, inbound.fetched, null)).unattached);
137483
+ return (await attachSlackFilesToTask(taskId, inbound.fetched, null)).unattached;
136710
137484
  } finally {
136711
137485
  clearInterval(lease);
136712
- await promoteDraftTask2(task.id);
137486
+ await promoteDraftTask2(taskId);
136713
137487
  }
136714
- return { task, unattached };
136715
137488
  }
136716
137489
  async function attachSlackFilesToTask(taskId, fetched, agentId) {
136717
137490
  const existing = await getTaskAttachments2(taskId);
@@ -136815,6 +137588,7 @@ async function notifySlackFileFailures(client, channel, threadTs, failures) {
136815
137588
  var DOWNLOAD_TIMEOUT_MS = 30000, SIGNED_OUT_REASON = "Slack returned its sign-in page instead of the file (is the files:read scope granted?)", SIGN_IN_MARKERS, SIGN_IN_SNIFF_BYTES = 4096, draftLeaseRefreshMs = 60000, SHARED_FILE_INTENT2 = "user-upload", FETCHED_FILE_INTENT = "slack-file", BUFFERED_REASON = "follow-ups queued by ADDITIVE_SLACK carry the file name only";
136816
137589
  var init_inbound_files = __esm(() => {
136817
137590
  init_db4();
137591
+ init_slack_fold();
136818
137592
  init_task_attachment_store();
136819
137593
  init_provider();
136820
137594
  init_registry2();
@@ -137177,18 +137951,19 @@ var init_slack_list_channels = __esm(() => {
137177
137951
  var registerSlackPostTool = (server) => {
137178
137952
  createToolRegistrar(server)("slack-post", {
137179
137953
  title: "Post message to Slack channel",
137180
- description: "Post a message to a Slack channel. By default creates a new top-level message; pass `threadTs` to post as a threaded reply under an existing message (obtain the ts from `slack-start-thread`). Requires lead privileges.",
137954
+ description: "Post a message to a Slack channel. By default creates a new top-level message; pass `threadTs` to post as a threaded reply under an existing message (obtain the ts from `slack-start-thread`). For a structured result (key figures, a table, charts, links), send a `card` instead of hand-built `blocks`. Requires lead privileges.",
137181
137955
  annotations: { openWorldHint: true },
137182
137956
  inputSchema: object2({
137183
137957
  channelId: string2().min(1).describe("The Slack channel ID to post to. A user ID (U…/W…) posts in the bot's DM with that user."),
137184
- message: string2().min(1).max(4000).describe("The message content to post."),
137185
- blocks: array2(record2(string2(), unknown())).max(50).optional().describe("Optional Block Kit blocks. When omitted, a mrkdwn section is generated."),
137958
+ message: string2().min(1).max(4000).optional().describe("The message content to post. Required unless card is given; with a card it renders above it."),
137959
+ blocks: array2(record2(string2(), unknown())).max(50).optional().describe("Optional raw Block Kit blocks. When omitted, a mrkdwn section is generated. Prefer card."),
137960
+ card: cardSpecInputSchema.optional(),
137186
137961
  threadTs: string2().optional().describe("Optional parent message ts to thread under. Obtain via `slack-start-thread`. When omitted, posts as a new top-level message.")
137187
137962
  }),
137188
137963
  outputSchema: swarmToolOutputSchema({
137189
137964
  messageTs: string2().optional()
137190
137965
  })
137191
- }, async ({ channelId: requestedChannelId, message, threadTs, blocks }, requestInfo, _meta) => {
137966
+ }, async ({ channelId: requestedChannelId, message, threadTs, blocks, card }, requestInfo, _meta) => {
137192
137967
  if (!requestInfo.agentId) {
137193
137968
  return toolErr("Agent ID not found.");
137194
137969
  }
@@ -137205,6 +137980,19 @@ var registerSlackPostTool = (server) => {
137205
137980
  if (!decision.allow) {
137206
137981
  return toolErr("Posting to Slack channels requires lead privileges.");
137207
137982
  }
137983
+ if (blocks && card)
137984
+ return toolErr("Provide either blocks or card, not both.");
137985
+ if (!message && !card)
137986
+ return toolErr("Provide a message or a card.");
137987
+ let cardSlack;
137988
+ if (card) {
137989
+ const rendered = renderCard(card);
137990
+ const slack = "card" in rendered ? await cardToSlack(rendered.card) : rendered;
137991
+ if ("issues" in slack) {
137992
+ return toolErr(cardIssuesMessage(slack.issues), { data: { issues: slack.issues } });
137993
+ }
137994
+ cardSlack = slack;
137995
+ }
137208
137996
  const app = getSlackApp2();
137209
137997
  if (!app) {
137210
137998
  return toolErr("Slack not configured.");
@@ -137221,12 +138009,13 @@ var registerSlackPostTool = (server) => {
137221
138009
  return toolErr(externalChannelToolError2(channelId, blockReason));
137222
138010
  }
137223
138011
  try {
137224
- const slackMessage = markdownToSlack(message);
138012
+ const slackMessage = message ? markdownToSlack(message) : "";
137225
138013
  const sourceTask = requestInfo.sourceTaskId ? await getTaskById2(requestInfo.sourceTaskId) : undefined;
137226
138014
  const contextKey = sourceTask?.contextKey;
137227
138015
  const tree = threadTs ? await getSlackTreeMessageByThread2(channelId, threadTs) : null;
137228
138016
  const messageBlocks = [
137229
- ...blocks ?? buildMrkdwnSectionBlocks(slackMessage)
138017
+ ...cardSlack && slackMessage ? buildMrkdwnSectionBlocks(slackMessage) : [],
138018
+ ...cardSlack?.blocks ?? blocks ?? buildMrkdwnSectionBlocks(slackMessage)
137230
138019
  ];
137231
138020
  if (sourceTask && tree) {
137232
138021
  if (messageBlocks.length >= 50) {
@@ -137244,7 +138033,7 @@ var registerSlackPostTool = (server) => {
137244
138033
  }
137245
138034
  const result = await withAutoJoin(app.client, channelId, () => app.client.chat.postMessage({
137246
138035
  channel: channelId,
137247
- text: slackMessage,
138036
+ text: slackFallbackText(slackMessage, cardSlack?.text),
137248
138037
  unfurl_links: false,
137249
138038
  unfurl_media: false,
137250
138039
  username: getAgentDisplayName(agent),
@@ -137279,6 +138068,7 @@ var registerSlackPostTool = (server) => {
137279
138068
  var init_slack_post = __esm(() => {
137280
138069
  init_zod();
137281
138070
  init_db4();
138071
+ init_cards();
137282
138072
  init_rbac();
137283
138073
  init_app3();
137284
138074
  init_blocks();
@@ -137550,18 +138340,19 @@ var init_slack_read = __esm(() => {
137550
138340
  var registerSlackReplyTool = (server) => {
137551
138341
  createToolRegistrar(server)("slack-reply", {
137552
138342
  title: "Reply to Slack thread",
137553
- description: "Send a reply to a Slack thread. Use inboxMessageId for inbox messages, or taskId for task-related threads. The engine already publishes the task tree and outcome card, so send only a distinct agent-authored message. Prefer one reply per task over several, do not post progress, receipt, or acknowledgment messages, and match its length to what the user asked for.",
138343
+ description: "Send a reply to a Slack thread. Use inboxMessageId for inbox messages, or taskId for task-related threads. The engine already publishes the task tree and outcome card, so send only a distinct agent-authored message. Prefer one reply per task over several, do not post progress, receipt, or acknowledgment messages, and match its length to what the user asked for. For a structured result (key figures, a table, charts, links), send a `card` instead of hand-built `blocks`.",
137554
138344
  annotations: { openWorldHint: true },
137555
138345
  inputSchema: object2({
137556
138346
  inboxMessageId: uuid().optional().describe("The inbox message ID to reply to (for leads responding to inbox)."),
137557
138347
  taskId: uuid().optional().describe("The task ID with Slack context (for task-related threads)."),
137558
- message: string2().min(1).max(4000).describe("The message to send to the Slack thread."),
137559
- blocks: array2(record2(string2(), unknown())).max(50).optional().describe("Optional Block Kit blocks. When omitted, a mrkdwn section is generated.")
138348
+ message: string2().min(1).max(4000).optional().describe("The message to send to the Slack thread. Required unless card is given; with a card it renders above it."),
138349
+ blocks: array2(record2(string2(), unknown())).max(50).optional().describe("Optional raw Block Kit blocks. When omitted, a mrkdwn section is generated. Prefer card."),
138350
+ card: cardSpecInputSchema.optional()
137560
138351
  }),
137561
138352
  outputSchema: swarmToolOutputSchema({
137562
138353
  messageTs: string2().optional()
137563
138354
  })
137564
- }, async ({ inboxMessageId, taskId, message, blocks }, requestInfo, _meta) => {
138355
+ }, async ({ inboxMessageId, taskId, message, blocks, card }, requestInfo, _meta) => {
137565
138356
  if (!requestInfo.agentId) {
137566
138357
  return toolErr("Agent ID not found.");
137567
138358
  }
@@ -137575,6 +138366,19 @@ var registerSlackReplyTool = (server) => {
137575
138366
  if (inboxMessageId && taskId) {
137576
138367
  return toolErr("Provide either inboxMessageId or taskId, not both.");
137577
138368
  }
138369
+ if (blocks && card)
138370
+ return toolErr("Provide either blocks or card, not both.");
138371
+ if (!message && !card)
138372
+ return toolErr("Provide a message or a card.");
138373
+ let cardSlack;
138374
+ if (card) {
138375
+ const rendered = renderCard(card);
138376
+ const slack = "card" in rendered ? await cardToSlack(rendered.card) : rendered;
138377
+ if ("issues" in slack) {
138378
+ return toolErr(cardIssuesMessage(slack.issues), { data: { issues: slack.issues } });
138379
+ }
138380
+ cardSlack = slack;
138381
+ }
137578
138382
  if (inboxMessageId) {
137579
138383
  const inboxMsg = await getInboxMessageById2(inboxMessageId);
137580
138384
  if (!inboxMsg) {
@@ -137585,7 +138389,7 @@ var registerSlackReplyTool = (server) => {
137585
138389
  }
137586
138390
  slackChannelId = inboxMsg.slackChannelId;
137587
138391
  slackThreadTs = inboxMsg.slackThreadTs;
137588
- await markInboxMessageResponded2(inboxMessageId, message);
138392
+ await markInboxMessageResponded2(inboxMessageId, slackFallbackText(message ?? "", cardSlack?.text));
137589
138393
  } else if (taskId) {
137590
138394
  const task = await getTaskById2(taskId);
137591
138395
  if (!task) {
@@ -137613,13 +138417,16 @@ var registerSlackReplyTool = (server) => {
137613
138417
  }
137614
138418
  try {
137615
138419
  const citations = taskId ? await getTaskCitations(taskId) : [];
137616
- const slackMessage = renderTaskCitations(markdownToSlack(message), citations, "slack", false);
137617
- const renderedBlocks = blocks?.map((block) => JSON.parse(JSON.stringify(block, (key, value) => key === "text" && typeof value === "string" ? stripInvalidTaskCitations(value, citations) : value?.type === "mrkdwn" && typeof value.text === "string" ? { ...value, text: renderTaskCitations(value.text, citations, "slack", false) } : value)));
138420
+ const slackMessage = message ? renderTaskCitations(markdownToSlack(message), citations, "slack", false) : "";
138421
+ const customBlocks = cardSlack?.blocks ?? blocks;
138422
+ const renderedBlocks = customBlocks?.map((block) => JSON.parse(JSON.stringify(block, (key, value) => key === "text" && typeof value === "string" ? stripInvalidTaskCitations(value, citations) : value?.type === "mrkdwn" && typeof value.text === "string" ? { ...value, text: renderTaskCitations(value.text, citations, "slack", false) } : value)));
137618
138423
  const tree = await getSlackTreeMessageByThread2(slackChannelId, slackThreadTs);
137619
138424
  const messageBlocks = [
138425
+ ...cardSlack && slackMessage ? buildMrkdwnSectionBlocks(slackMessage) : [],
137620
138426
  ...renderedBlocks ?? buildMrkdwnSectionBlocks(slackMessage)
137621
138427
  ];
137622
- for (const group of taskCitationSourceGroups(blocks ? JSON.stringify(blocks) : message, citations)) {
138428
+ for (const group of taskCitationSourceGroups(cardSlack ? `${message ?? ""}
138429
+ ${JSON.stringify(cardSlack.blocks)}` : blocks ? JSON.stringify(blocks) : message ?? "", citations)) {
137623
138430
  const caption = buildCaptionBlock(group.items, {
137624
138431
  heading: group.heading,
137625
138432
  ...taskId ? { moreUrl: getTaskUrl(taskId) } : {}
@@ -137646,7 +138453,7 @@ var registerSlackReplyTool = (server) => {
137646
138453
  const result = await withAutoJoin(app.client, slackChannelId, () => app.client.chat.postMessage({
137647
138454
  channel: slackChannelId,
137648
138455
  thread_ts: slackThreadTs,
137649
- text: slackMessage,
138456
+ text: slackFallbackText(slackMessage, cardSlack?.text),
137650
138457
  unfurl_links: false,
137651
138458
  unfurl_media: false,
137652
138459
  username: getAgentDisplayName(agent),
@@ -137683,6 +138490,7 @@ var init_slack_reply = __esm(() => {
137683
138490
  init_zod();
137684
138491
  init_db4();
137685
138492
  init_task_citations2();
138493
+ init_cards();
137686
138494
  init_app3();
137687
138495
  init_blocks();
137688
138496
  init_channel_join();
@@ -138168,7 +138976,7 @@ var init_steer_task = __esm(() => {
138168
138976
  init_rbac();
138169
138977
  init_task_tool_ctx();
138170
138978
  init_utils();
138171
- init_types4();
138979
+ init_types5();
138172
138980
  steerTaskInputSchema = object2({
138173
138981
  taskId: uuid().describe("The ID of the running task to steer."),
138174
138982
  message: string2().min(1).describe("The message to send to the task."),
@@ -138408,6 +139216,14 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138408
139216
  failureReason: string2().optional().describe("The reason for failure (used when failing), or the one-line reason for a skip (required with status 'skipped')."),
138409
139217
  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)."),
138410
139218
  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.'),
139219
+ uiSpec: object2({
139220
+ spec: object2({
139221
+ root: string2().min(1),
139222
+ elements: record2(string2(), unknown()),
139223
+ state: record2(string2(), unknown()).optional()
139224
+ }).describe("A json-render spec for the chat catalog. Root must be a Card."),
139225
+ actions: record2(string2().regex(UI_SPEC_ACTION_ID), object2({ kind: literal2("follow_up"), prompt: string2().min(1).max(4000) })).optional().describe("Actions that Button ids name. Needs UI_SPEC_ACTIONS_ENABLED=true.")
139226
+ }).optional().describe("Optional rich card for this result, rendered in the Slack outcome card, the session view and Chat SDK channels. `output` stays the prose answer. A Slack card shows only the spec of its own task. See the ui-spec skill."),
138411
139227
  learning: union3([
138412
139228
  string2(),
138413
139229
  object2({
@@ -138429,6 +139245,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138429
139245
  failureReason,
138430
139246
  attachments,
138431
139247
  citations,
139248
+ uiSpec,
138432
139249
  learning,
138433
139250
  persistMemory,
138434
139251
  chainedTaskId,
@@ -138531,6 +139348,7 @@ var BLOCKED_WAITING_PATTERN, BLOCKED_WAITING_MIN_ELAPSED_MS, storeProgressOutput
138531
139348
  }
138532
139349
  }
138533
139350
  let learningWrite;
139351
+ let uiSpecNote;
138534
139352
  const result = await getDbClient2().transaction(async () => {
138535
139353
  const agent = await getAgentById2(requestInfo.agentId ?? "");
138536
139354
  if (!agent) {
@@ -138661,8 +139479,46 @@ This check refuses once per task; the next completion is accepted and unfixed ci
138661
139479
  };
138662
139480
  }
138663
139481
  }
139482
+ let uiSpecToStore;
139483
+ if (uiSpec && !isEnvFlagEnabled("UI_SPEC_ENABLED", false)) {
139484
+ uiSpecNote = "uiSpec ignored: UI_SPEC_ENABLED is off.";
139485
+ } else if (uiSpec && status !== "completed") {
139486
+ uiSpecNote = 'uiSpec is stored only with status "completed".';
139487
+ } else if (uiSpec) {
139488
+ const validation = validateTaskUiSpec(uiSpec, {
139489
+ taskId,
139490
+ actionsEnabled: isEnvFlagEnabled("UI_SPEC_ACTIONS_ENABLED", false)
139491
+ });
139492
+ if (validation.ok) {
139493
+ uiSpecToStore = {
139494
+ spec: validation.spec,
139495
+ ...validation.actions ? { actions: validation.actions } : {},
139496
+ fallbackText: validation.fallbackText
139497
+ };
139498
+ } else if (!await hasTaskUiSpecCheckRefusal(taskId)) {
139499
+ await createLogEntry2({
139500
+ eventType: "task_ui_spec_check_refused",
139501
+ agentId: agent.id,
139502
+ taskId,
139503
+ newValue: validation.issues.join(`
139504
+ `)
139505
+ });
139506
+ return {
139507
+ success: false,
139508
+ task: existingTask,
139509
+ message: `Completion refused: uiSpec is not valid. The task stays ${existingTask.status}. Fix these, then call store-progress again:
139510
+ - ${validation.issues.join(`
139511
+ - `)}
139512
+ This check refuses once per task; the next completion is accepted without the spec.`
139513
+ };
139514
+ } else {
139515
+ uiSpecNote = `uiSpec dropped: ${validation.issues[0]}`;
139516
+ }
139517
+ }
138664
139518
  if (status === "completed") {
138665
139519
  const result = await completeTask2(taskId, output);
139520
+ if (result && uiSpecToStore)
139521
+ await upsertTaskUiSpec(taskId, uiSpecToStore);
138666
139522
  if (result) {
138667
139523
  updatedTask = result;
138668
139524
  getDbClient2().afterCommit(() => {
@@ -138748,7 +139604,11 @@ This check refuses once per task; the next completion is accepted and unfixed ci
138748
139604
  finalizeSkippedTaskReaction(result.task, "store-progress");
138749
139605
  const learningResult = await learningWrite;
138750
139606
  const { success } = result;
138751
- const message = learningResult ? `${result.message} ${learningSentence(learningResult)}` : result.message;
139607
+ const message = [
139608
+ result.message,
139609
+ ...learningResult ? [learningSentence(learningResult)] : [],
139610
+ ...success && uiSpecNote ? [uiSpecNote] : []
139611
+ ].join(" ");
138752
139612
  const task = result.task ? {
138753
139613
  id: result.task.id,
138754
139614
  status: result.task.status,
@@ -138773,15 +139633,19 @@ var init_store_progress = __esm(() => {
138773
139633
  init_constants2();
138774
139634
  init_task_learning();
138775
139635
  init_task_citations2();
139636
+ init_task_ui_spec();
138776
139637
  init_agent_fs_provider();
138777
139638
  init_rbac();
138778
139639
  init_task_skip();
138779
139640
  init_task_terminal_effects();
138780
139641
  init_terminal_result_guard();
138781
139642
  init_utils();
138782
- init_types4();
139643
+ init_types5();
139644
+ init_validate2();
139645
+ init_env_flag();
138783
139646
  init_secret_scrubber();
138784
139647
  init_task_citations();
139648
+ init_task_ui_spec2();
138785
139649
  init_business_use();
138786
139650
  BLOCKED_WAITING_PATTERN = /\b(waiting (for|on)|blocked (on|until|by)|still waiting|awaiting)\b/i;
138787
139651
  BLOCKED_WAITING_MIN_ELAPSED_MS = 3 * 60 * 1000;
@@ -139275,7 +140139,7 @@ var init_get_config = __esm(() => {
139275
140139
  init_swarm_config_guard();
139276
140140
  init_rbac();
139277
140141
  init_utils();
139278
- init_types4();
140142
+ init_types5();
139279
140143
  init_secret_scrubber();
139280
140144
  configEntryShape = looseObject({
139281
140145
  id: string2().optional(),
@@ -139371,7 +140235,7 @@ var init_list_config = __esm(() => {
139371
140235
  init_swarm_config_guard();
139372
140236
  init_rbac();
139373
140237
  init_utils();
139374
- init_types4();
140238
+ init_types5();
139375
140239
  init_secret_scrubber();
139376
140240
  configEntryShape2 = looseObject({
139377
140241
  id: string2().optional(),
@@ -139483,7 +140347,7 @@ var init_set_config = __esm(() => {
139483
140347
  init_core();
139484
140348
  init_rbac();
139485
140349
  init_utils();
139486
- init_types4();
140350
+ init_types5();
139487
140351
  configEntryShape3 = looseObject({
139488
140352
  id: string2().optional(),
139489
140353
  scope: SwarmConfigScopeSchema.optional(),
@@ -139769,7 +140633,7 @@ async function emitBudgetRefusalSideEffects(ctx, inserted) {
139769
140633
  console.warn(`[budget-refusal-notify] Failed to create follow-up task for budget refusal (task=${ctx.task.id.slice(0, 8)}): ${err}`);
139770
140634
  }
139771
140635
  }
139772
- import("./event-bus-tr6h3gv8.js").then(({ workflowEventBus }) => {
140636
+ import("./event-bus-xr83x566.js").then(({ workflowEventBus }) => {
139773
140637
  workflowEventBus.emit("task.budget_refused", {
139774
140638
  taskId: ctx.task.id,
139775
140639
  agentId: ctx.agentId,
@@ -140249,7 +141113,7 @@ var init_task_action = __esm(() => {
140249
141113
  init_apply_task_create();
140250
141114
  init_task_tool_ctx();
140251
141115
  init_utils();
140252
- init_types4();
141116
+ init_types5();
140253
141117
  init_multi_runtime2();
140254
141118
  init_get_task_details();
140255
141119
  TaskActionSchema = _enum2([
@@ -140714,7 +141578,7 @@ var init_update_profile = __esm(() => {
140714
141578
  init_db4();
140715
141579
  init_rbac();
140716
141580
  init_utils();
140717
- init_types4();
141581
+ init_types5();
140718
141582
  init_constants3();
140719
141583
  agentOutputShape4 = looseObject({
140720
141584
  id: string2().optional(),
@@ -140896,7 +141760,7 @@ async function workflowModelErrors(def, { vcsRepo } = {}) {
140896
141760
  var init_model_validation = __esm(() => {
140897
141761
  init_model_profiles();
140898
141762
  init_model_validation2();
140899
- init_types4();
141763
+ init_types5();
140900
141764
  });
140901
141765
 
140902
141766
  // src/tools/workflows/create-workflow.ts
@@ -140992,7 +141856,7 @@ var init_create_workflow = __esm(() => {
140992
141856
  init_audit_user();
140993
141857
  init_db4();
140994
141858
  init_utils();
140995
- init_types4();
141859
+ init_types5();
140996
141860
  init_workflows();
140997
141861
  init_definition2();
140998
141862
  init_model_validation();
@@ -141201,7 +142065,7 @@ var init_list_workflow_runs = __esm(() => {
141201
142065
  init_zod();
141202
142066
  init_db4();
141203
142067
  init_utils();
141204
- init_types4();
142068
+ init_types5();
141205
142069
  listWorkflowRunsInputSchema = object2({
141206
142070
  workflowId: string2().uuid().describe("Workflow ID to list runs for"),
141207
142071
  status: WorkflowRunStatusSchema.optional().describe("Filter by run status (running, waiting, completed, failed, skipped, cancelled)"),
@@ -141242,7 +142106,7 @@ var init_list_workflows = __esm(() => {
141242
142106
  init_zod();
141243
142107
  init_db4();
141244
142108
  init_utils();
141245
- init_types4();
142109
+ init_types5();
141246
142110
  });
141247
142111
 
141248
142112
  // src/workflows/patch-definition.ts
@@ -141388,7 +142252,7 @@ var init_patch_workflow = __esm(() => {
141388
142252
  init_asset_key_auth();
141389
142253
  init_audit_user();
141390
142254
  init_utils();
141391
- init_types4();
142255
+ init_types5();
141392
142256
  init_workflows();
141393
142257
  init_patch_definition();
141394
142258
  init_readiness();
@@ -141452,7 +142316,7 @@ var init_patch_workflow_node = __esm(() => {
141452
142316
  init_zod();
141453
142317
  init_audit_user();
141454
142318
  init_utils();
141455
- init_types4();
142319
+ init_types5();
141456
142320
  init_workflows();
141457
142321
  init_patch_definition();
141458
142322
  init_readiness();
@@ -141781,7 +142645,7 @@ var init_update_workflow = __esm(() => {
141781
142645
  init_audit_user();
141782
142646
  init_db4();
141783
142647
  init_utils();
141784
- init_types4();
142648
+ init_types5();
141785
142649
  init_workflows();
141786
142650
  init_definition2();
141787
142651
  init_model_validation();
@@ -141826,7 +142690,7 @@ function getEnabledCapabilities() {
141826
142690
  if (isChatSdkEnabled())
141827
142691
  capabilities.push("chat-sdk");
141828
142692
  const slack = getSlackConfiguration();
141829
- return slack.mode === "socket" && !slack.disabled ? capabilities : capabilities.filter((capability) => capability !== "slack");
142693
+ return slack.mode !== null && !slack.disabled ? capabilities : capabilities.filter((capability) => capability !== "slack");
141830
142694
  }
141831
142695
  function isScriptsOnlyMcp() {
141832
142696
  return resolveScriptsOnlyMode({ env: process.env.SCRIPTS_ONLY_MCP });
@@ -142309,4 +143173,4 @@ var init_server = __esm(() => {
142309
143173
  loggedToolAllowlistWarnings = new Set;
142310
143174
  });
142311
143175
 
142312
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, repointTrackerSyncBySwarmId, init_tracker, isRuntimePoolWakeable, isAgentReachable, init_reachability, referencedBundlePaths, skillDirs, init_manifest_format, TaskCreationBlockedError, init_errors2, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, init_inbound_files, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, retry, init_retry, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, nextFallback2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, DbQueryTimeoutError, DbQueryConcurrencyCapError, executeReadOnlyQuery, getDbQueryHttpBudgetMs, init_db_query_shared, assertSelectOnlyQuery, executeReadOnlyQueryGated, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };
143176
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, init_types, McpServer, init_mcp, referencedBundlePaths, skillDirs, init_manifest_format, recoverIncompleteRuns, init_recovery, handleWebhookTrigger, verifyHmacSignature, WebhookError, init_triggers, snapshotAndUpdateWorkflow, init_version, applyPreTaskCreate, init_apply_task_create, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, init_raw_llm, getExecutorRegistry2, initWorkflows2, init_workflows, stripSiblingBlock, init_sibling_block, createTaskWithSiblingAwareness, init_sibling_awareness, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, init_scheduler, ExtensionAssetConflictError, hashOf, scriptHash, liveScriptSpec, liveWorkflowSpec, skillSpecOf, liveSkillSpec, skillHash, init_assets, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, init_db, SDK_ALLOWLIST, mcpToolNameForSdkMethod, init_sdk_allowlist, MCP_OVERFLOW_NAMESPACE, mcpOverflowAuthError, init_kv_overflow, hasKvViewArgs, resolveKvView, init_kv_view, COLOR_LITERAL_THRESHOLD, countColorLiterals, init_color_literals, toolErr, createToolRegistrar, init_utils, handleMcpBridge, init_mcp_bridge, Redacted, init_redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, init_response_limit, retry, init_retry, ExtensionConfigError, init_loader, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, init_lifecycle, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, init_dispatcher, resolveIdentity, renderIdentity, init_identity, recordUnmappedIdentity, init_unmapped_identities, getDeliveredSlackMessageTs, foldIntoPendingSlackTask, init_slack_fold, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, scopeFromAttachment, backingProviderId, init_task_attachment_store, transcribeAudioNotes, init_transcription, init_templates, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, attachSlackFilesToDraft, notifySlackFileFailures, init_inbound_files, pendingWorkForAgent, countPoolRuntimes, computeDesired, init_demand, isRuntimePoolWakeable, isAgentReachable, isAgentOnDemand, init_reachability, isAddressedToOtherUser, broadcastMatches, routeMessage, extractTaskFromMessage, init_router, extractSlackMessageText, slackInboundMessageText, collectSlackMessageFiles, init_message_text, createAdditiveBuffer, init_additive_buffer, repointTrackerSyncBySwarmId, init_tracker, REBOOT_RETRY_PIN_TAG2, getPinCandidateAgent2, resolveLeadOnlyRecoveryAssignment2, getResumeGeneration2, getNextResumeGeneration2, inheritedModelSelection2, nextFallback2, createWorkerTaskFollowUp2, createResumeFollowUp2, createRerouteDecisionTask2, createPoolStarvationDecisionTask2, init_worker_follow_up, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, isInboxAllowed, isSenderAllowed, handleMessageReceived, init_agentmail, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, init_azure_devops, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, init_azure_devops2, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, init_rbac_audit, getTelemetryIngestAnchor, init_telemetry_ingest_anchor, initApiTelemetry, syncTelemetryEnabled, init_telemetry_enable, isBitbucketEnabled, initBitbucket, verifyBitbucketWebhook, isDuplicateDelivery, markDeliveryProcessed, pullRequestEventOf, pullRequestCommentEventOf, handlePullRequestCreated2, handlePullRequestCommentCreated, handlePullRequestClosed, init_bitbucket, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, init_github, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, init_gitlab, isChatSdkEnabled, getChatSdkConfig, init_config, errorMessage, init_logger, resolveAdapterApiUrl, init_adapters, trackBackground, init_background, TelegramBotApiError, callTelegramBotApi, init_telegram_api, isTrustedTeamsServiceUrl, init_teams_origin, getSessionLabels, rememberSessionLabel, getResourceSessionLabels, init_session_labels, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, init_runtime, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, init_metadata, registerJiraWebhook, deleteJiraWebhook, init_webhook_lifecycle, isJiraEnabled, initJira, init_app, handleJiraWebhook, init_webhook, init_jira, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, init_sync, isLinearEnabled, initLinear, init_app2, init_linear, init_slack, verifyPageSession, LEGACY_PAGE_SESSION_COOKIE, isCookieSafePageId, extractPageSession, extractLegacyPageSession, extractAndVerifyCookie, isLocalDevPageRequest, pageSessionSetCookies, init_page_session, resolveHttpRequestAuth, init_auth, getDeploymentEnvValue, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, init_core, MCP_MAX_TOOL_INPUT_ELEMENTS, MCP_MAX_REQUEST_BODY_BYTES, init_mcp_limits, userCtx, init_task_tool_ctx, resolveRequestPrincipal, requestPrincipal, agentFirstPrincipal, requireAuthKind, rejectGuest, init_request_principal, resolveTaskRequester, init_task_requester, handleApps, init_apps, cancelApprovalRequest, cancelApprovalRequestAndRun, init_approval_cancel, getUserCommsPrefs, init_requester_comms, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, init_get_task_details, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, init_cancel_task, DbQueryTimeoutError, DbQueryConcurrencyCapError, executeReadOnlyQuery, getDbQueryHttpBudgetMs, init_db_query_shared, assertSelectOnlyQuery, executeReadOnlyQueryGated, handleDbQuery, init_db_query, snapshotMetric, init_version2, AssetKeyAuthorizationError, authorizeAssetKeyWrite, init_asset_key_auth, getPageEditCounter, init_page_versions, snapshotPage, init_version3, DEFAULT_THEME_ID, THEME_PRESET_IDS, getThemePreset, init_presets, readThemeFields, init_page_fields, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, init_app_validation, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, init_presets2, scopedResourceScopeIdSchema, resolveScopedResourceId, init_scoped_resource, MemoryKeyError, init_key_guard, refreshLinks, init_link_resolver, indexMemoryContent, init_index_content, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, init_retrieval, ExplicitSelfDuplicateError, applyRating, init_store, shouldPersistAutomaticTaskMemory, init_automatic_task_gate, guardTerminalTaskResultWrite, init_terminal_result_guard, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, init_get_tasks, requiresLeadToWrite, reservedNamespaceError, privateNamespaceError, reservedRoomKeyError, init_kv_reserved_namespaces, updateMcpServerChecked, init_mcp_server_checked_update, updateTouchesStdioExecution, init_mcp_server_stdio_gate, canReadMemory, init_access, getLinksForMemory, init_links_store, expandCandidatesWithGraph, init_graph_expansion, isApiDraining, drainApi, init_api_drain, markKapsoMessageRead, sendKapsoReaction, init_client, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, init_config2, changesAllowMerge, init_repo_merge_policy, updateSwarmRepoChecked, init_repo_checked_update, getCombConfig, init_config3, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, init_auth2, RoomOperationSchema, init_document, removeAwarenessStates, init_awareness, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, init_rooms, init_scheduler2, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, init_key_browser, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, init_events, mergeScheduleTiming, validateRecurringTiming, init_validate, followUpThreadForSourceTask, evaluateFollowUpRedelegation, init_follow_up_redelegation_guard, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, init_send_task, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, init_steer_task, skipReasonFrom, finalizeSkippedTaskReaction, init_task_skip, IMPROVEMENT_TEXT_MAX, IMPROVEMENT_STATUSES, IMPROVEMENT_SOURCES, ImprovementError, isImprovementsEnabled, getImprovement, listImprovements, createImprovement, approveAndSend, discardImprovement, improvementLeakHints, init_improvements, canClaim, init_budget_admission, emitBudgetRefusalSideEffects, init_budget_refusal_notify, workflowModelErrors, init_model_validation, patchWorkflowDefinition, init_patch_definition, idempotencyKeyHeader, readIdempotencyKey, replayAcceptedOperation, init_idempotency_key, resolveScriptsOnlyMode, init_scripts_only_mode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer, init_server };