@desplega.ai/agent-swarm 2.2.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/README.md +1 -0
  2. package/dist/{acp-adapter-k0vwfyvn.js → acp-adapter-kedstxx6.js} +6 -6
  3. package/dist/{actions-w4pnb8vz.js → actions-vget6r1k.js} +18 -16
  4. package/dist/{amp-adapter-0cmxb2t5.js → amp-adapter-xeb5mktv.js} +2 -2
  5. package/dist/{app-zneem7g9.js → app-mqap8t8m.js} +3 -3
  6. package/dist/{assistant-wbzd2rnr.js → assistant-h0gv97mv.js} +20 -18
  7. package/dist/{boot-reembed-4kx69j3g.js → boot-reembed-qr8a894z.js} +1 -1
  8. package/dist/{boot-reembed-db0wwgy1.js → boot-reembed-rj85jjhw.js} +1 -1
  9. package/dist/{boot-scrub-sweep-tfv4d3mm.js → boot-scrub-sweep-eyfvn6v9.js} +3 -3
  10. package/dist/{boot-seeds-w2hmkxn5.js → boot-seeds-xs9a8dx1.js} +4 -4
  11. package/dist/{claude-adapter-5qrc2paq.js → claude-adapter-bm23cye7.js} +5 -5
  12. package/dist/{claude-managed-adapter-n7ahjyx6.js → claude-managed-adapter-1mwrsm9d.js} +2 -2
  13. package/dist/{claude-managed-setup-7ra32em4.js → claude-managed-setup-gkfgks4j.js} +1 -1
  14. package/dist/{claude-sdk-session-cd02gc76.js → claude-sdk-session-apb4ypz3.js} +5 -5
  15. package/dist/cli-02vhhssk.js +848 -0
  16. package/dist/{cli-4ync7m60.js → cli-0ebey9hg.js} +1 -1
  17. package/dist/{cli-665j3feb.js → cli-0xk505e8.js} +1 -1
  18. package/dist/{cli-8c1m9mhy.js → cli-1cevz46c.js} +5 -5
  19. package/dist/{cli-gzvb3d4a.js → cli-1jx0srjt.js} +3 -3
  20. package/dist/{cli-zj4d6afs.js → cli-1pa3rz69.js} +21 -6
  21. package/dist/{cli-vmbakbq0.js → cli-2rwet3r7.js} +1 -1
  22. package/dist/{cli-azs9bhc5.js → cli-3wjs22x3.js} +2 -2
  23. package/dist/{cli-tba8fxf9.js → cli-4fhyq711.js} +45 -36
  24. package/dist/{cli-ak4c12mh.js → cli-5ff2sjyt.js} +1 -1
  25. package/dist/{cli-6q7pyd3k.js → cli-5s5hx57y.js} +5 -3
  26. package/dist/{cli-h23mr2s6.js → cli-6ftrrwm1.js} +9 -371
  27. package/dist/{cli-9ac0mkg5.js → cli-8b9wvjps.js} +1 -1
  28. package/dist/cli-8cxkw1f5.js +382 -0
  29. package/dist/{cli-xhgtay7w.js → cli-8rwvksbc.js} +2 -2
  30. package/dist/{cli-e09hj50q.js → cli-8wkb09q5.js} +11 -11
  31. package/dist/{cli-ksrphveb.js → cli-a1esmmee.js} +14 -2
  32. package/dist/{cli-xnp2vkx7.js → cli-avmqhatn.js} +7 -7
  33. package/dist/{cli-xx13gqf3.js → cli-b80a1100.js} +1 -1
  34. package/dist/{cli-z1hh99j0.js → cli-bfc3k1x5.js} +3 -3
  35. package/dist/{cli-0k9rcwfy.js → cli-bhwa8rzc.js} +33 -15
  36. package/dist/{cli-8cvvytad.js → cli-bn26xbcs.js} +2 -2
  37. package/dist/{cli-k28p6xh7.js → cli-c8fwpgqb.js} +1 -1
  38. package/dist/{cli-rc3r0bnh.js → cli-ccn0eybf.js} +1 -1
  39. package/dist/{cli-9td5ss65.js → cli-dsgj3e7a.js} +2 -2
  40. package/dist/{cli-jrk8mj0t.js → cli-ecshf504.js} +2 -2
  41. package/dist/{cli-raejy0mp.js → cli-eqgfs202.js} +1 -1
  42. package/dist/{cli-ppapy34w.js → cli-f3nx1h8z.js} +2 -2
  43. package/dist/{cli-c9vrwcpb.js → cli-ffbrkh1r.js} +74 -35
  44. package/dist/{cli-mnry16kh.js → cli-kk2r80n5.js} +4 -4
  45. package/dist/{cli-c0dpzwnx.js → cli-kz116kvw.js} +3 -3
  46. package/dist/{cli-e5y285rg.js → cli-mvg2hf8p.js} +4 -4
  47. package/dist/{cli-2jm992rm.js → cli-mz1ezzzh.js} +2 -2
  48. package/dist/{cli-dw0njd9q.js → cli-nme7wery.js} +6 -6
  49. package/dist/{cli-mvsfbbgq.js → cli-nrrg0fvy.js} +18 -4
  50. package/dist/{cli-8jtrekpy.js → cli-p1m2b6gc.js} +7 -7
  51. package/dist/{cli-4c7k75rq.js → cli-rg7ntypm.js} +378 -84
  52. package/dist/{cli-z3dk189k.js → cli-rsd7ga7v.js} +10 -8
  53. package/dist/{cli-etvn5ej2.js → cli-sppc0cmw.js} +1 -1
  54. package/dist/{cli-8w65vwee.js → cli-tg9ksbn8.js} +1 -1
  55. package/dist/{cli-th8krqbf.js → cli-tgvpmnwz.js} +2 -2
  56. package/dist/{cli-hwc4a9xm.js → cli-tj4j2ts4.js} +6 -6
  57. package/dist/{cli-jhhb2v9n.js → cli-ttaz6c7m.js} +2 -2
  58. package/dist/{cli-w7z94e6c.js → cli-tx00c0h6.js} +4 -2
  59. package/dist/{cli-4g629sgr.js → cli-wrv09v7q.js} +20 -1
  60. package/dist/{cli-cby329ny.js → cli-wyrr38xm.js} +2 -2
  61. package/dist/{cli-5ks6x36q.js → cli-x1p5dhq2.js} +3 -3
  62. package/dist/{cli-bddxamg7.js → cli-x719j3vs.js} +220 -629
  63. package/dist/{cli-ztcxv5nv.js → cli-xfe63zx3.js} +1 -1
  64. package/dist/{cli-q6gw45wj.js → cli-ywyrffff.js} +1 -1
  65. package/dist/{cli-p46xdr1m.js → cli-zvze9rbm.js} +1 -1
  66. package/dist/cli.js +15 -15
  67. package/dist/{codex-adapter-m0fx3v3s.js → codex-adapter-pp2gq8gr.js} +3 -3
  68. package/dist/{codex-hook-x6tm6y5m.js → codex-hook-qwzccd64.js} +1 -1
  69. package/dist/{codex-session-runner-j9m2gfyy.js → codex-session-runner-0vzn09t8.js} +3 -3
  70. package/dist/{commands-ktnqwrv4.js → commands-psqhkttb.js} +2 -2
  71. package/dist/{controller-nex2he8v.js → controller-t20vz2k8.js} +2 -2
  72. package/dist/{controllers-connect-6yhwqv9v.js → controllers-connect-gkxmqw9d.js} +24 -20
  73. package/dist/{cursor-adapter-02s5ekva.js → cursor-adapter-3v542qe5.js} +1 -1
  74. package/dist/{db-jvr86v7f.js → db-2xbyenjr.js} +2 -2
  75. package/dist/{db-19tw9r5s.js → db-nc1rd869.js} +3 -2
  76. package/dist/{dispatcher-d3mnsg2y.js → dispatcher-ewceb8ts.js} +17 -15
  77. package/dist/{dsh-adapter-63rvej88.js → dsh-adapter-75xwh78t.js} +1 -1
  78. package/dist/{easter-egg-3d-6hg2r942.js → easter-egg-3d-xsc47jwf.js} +1 -1
  79. package/dist/{execute-bcqc69a5.js → execute-gzmw1mnw.js} +1 -1
  80. package/dist/{external-channel-44cwer32.js → external-channel-a5dsmxn4.js} +2 -2
  81. package/dist/{google-generative-ai-phpmwxvg.js → google-generative-ai-bmq8gkf3.js} +1 -1
  82. package/dist/{google-vertex-es9ybgdy.js → google-vertex-b1rvp52s.js} +1 -1
  83. package/dist/{grok-adapter-ysp907f6.js → grok-adapter-vj88xr23.js} +7 -7
  84. package/dist/handlers-zbs90bny.js +39 -0
  85. package/dist/{heartbeat-2etacsqq.js → heartbeat-t2m9r3wa.js} +20 -18
  86. package/dist/{hook-mzxxs5n2.js → hook-8femx1bg.js} +4 -4
  87. package/dist/{hook-3kvmax6d.js → hook-xa677f8r.js} +5 -5
  88. package/dist/{http-fn978m0g.js → http-xpmmq028.js} +940 -269
  89. package/dist/{index-e4tsa1h7.js → index-8pwc1jc8.js} +17 -15
  90. package/dist/{index-w2wr89xd.js → index-cdzyfrsp.js} +1 -1
  91. package/dist/{index-1r8hw4vd.js → index-dg2tmj99.js} +17 -15
  92. package/dist/index-nxa6me0q.js +41 -0
  93. package/dist/{index-039x2sag.js → index-s7ckdajq.js} +42 -14
  94. package/dist/{index-wgsw9xcz.js → index-syztqdt6.js} +1 -1
  95. package/dist/{index-x0q2a4f9.js → index-ysd45kgc.js} +1 -1
  96. package/dist/{index-g909y089.js → index-zgvqzjsw.js} +8 -8
  97. package/dist/{keepalive-d4nzs76x.js → keepalive-3nr4st3r.js} +3 -3
  98. package/dist/{lead-8h5n9k5f.js → lead-td8h2sfn.js} +33 -31
  99. package/dist/{maintenance-ea6jfw42.js → maintenance-verwpe2c.js} +1 -1
  100. package/dist/{oauth-refresh-sweep-3f25djq3.js → oauth-refresh-sweep-9q2t0y3q.js} +2 -2
  101. package/dist/{onboard-pvk7hdb2.js → onboard-aytqedmq.js} +2 -2
  102. package/dist/{opencode-adapter-eeesgfqk.js → opencode-adapter-f4hryjny.js} +4 -4
  103. package/dist/{otel-impl-qb7nhgdp.js → otel-impl-hckw4wt1.js} +1 -1
  104. package/dist/{pi-mono-adapter-zasp3ze3.js → pi-mono-adapter-hxby0ce1.js} +6 -6
  105. package/dist/{pricing-refresh-6ehwkcmp.js → pricing-refresh-5nvme3sm.js} +3 -3
  106. package/dist/{rbac-roles-km0f9cmm.js → rbac-roles-pd8c26m1.js} +5 -3
  107. package/dist/{rbac-roles-9648nh00.js → rbac-roles-vbpy21mg.js} +2 -2
  108. package/dist/{render-v2-xkze1wef.js → render-v2-7nqgvk2q.js} +3 -3
  109. package/dist/{resume-tq0bbvt5.js → resume-b6djcj3c.js} +6 -6
  110. package/dist/{runtime-ar8310ba.js → runtime-txrxc9za.js} +1 -1
  111. package/dist/session-access-fc3f9y12.js +25 -0
  112. package/dist/{setup-rnrazxvd.js → setup-n39szm6b.js} +1 -1
  113. package/dist/{virtual-modules-wzk6jf3a.js → virtual-modules-wyp2k6z3.js} +2 -2
  114. package/dist/{work-objects-e75q2rqs.js → work-objects-jem2fre0.js} +20 -18
  115. package/dist/{worker-4ww4hjef.js → worker-wr6xgfr2.js} +33 -31
  116. package/openapi.json +1011 -115
  117. package/package.json +2 -2
  118. package/src/apps/action-caller.ts +6 -0
  119. package/src/apps/script-types.ts +16 -3
  120. package/src/be/asset-key-audit.ts +4 -13
  121. package/src/be/db/active-sessions.ts +5 -0
  122. package/src/be/db/session-visibility.ts +29 -0
  123. package/src/be/db/tasks/read.ts +61 -3
  124. package/src/be/db/tasks/write.ts +15 -6
  125. package/src/be/db.ts +149 -66
  126. package/src/be/events.ts +11 -0
  127. package/src/be/migrations/227_inbox_item_state_last_read_at.sql +1 -0
  128. package/src/be/migrations/230_session_shares.sql +23 -0
  129. package/src/be/rbac-roles.ts +2 -0
  130. package/src/be/seed-scripts/catalog/heartbeat-jev-gate.ts +22 -4
  131. package/src/be/session-shares.ts +244 -0
  132. package/src/be/swarm-config-guard.ts +23 -2
  133. package/src/commands/runner.ts +11 -0
  134. package/src/heartbeat/heartbeat.ts +25 -7
  135. package/src/http/active-sessions.ts +13 -2
  136. package/src/http/agents.ts +10 -3
  137. package/src/http/all-routes.ts +1 -0
  138. package/src/http/api-keys.ts +3 -1
  139. package/src/http/approval-requests.ts +2 -1
  140. package/src/http/apps.ts +36 -11
  141. package/src/http/assets.ts +26 -4
  142. package/src/http/config.ts +3 -0
  143. package/src/http/context.ts +2 -0
  144. package/src/http/core.ts +39 -2
  145. package/src/http/events.ts +6 -2
  146. package/src/http/favorite-owner.ts +1 -1
  147. package/src/http/fs.ts +38 -3
  148. package/src/http/inbox-state.ts +58 -8
  149. package/src/http/index.ts +3 -1
  150. package/src/http/memory.ts +3 -1
  151. package/src/http/ranking.ts +367 -0
  152. package/src/http/realtime.ts +26 -21
  153. package/src/http/route-def.ts +77 -11
  154. package/src/http/script-runs.ts +2 -1
  155. package/src/http/scripts.ts +8 -0
  156. package/src/http/session-access.ts +179 -0
  157. package/src/http/session-data.ts +10 -2
  158. package/src/http/sessions.ts +212 -12
  159. package/src/http/stats.ts +7 -3
  160. package/src/http/tasks.ts +83 -7
  161. package/src/http/used-by.ts +11 -3
  162. package/src/kv-reserved-namespaces.ts +1 -0
  163. package/src/prompts/session-templates.ts +3 -1
  164. package/src/providers/amp-adapter.ts +1 -1
  165. package/src/ranking/telemetry-ranking.ts +147 -0
  166. package/src/ranking/usage.ts +57 -0
  167. package/src/rbac/admission.ts +22 -7
  168. package/src/rbac/legacy-policy.ts +2 -0
  169. package/src/rbac/permissions.ts +9 -0
  170. package/src/realtime/auth.ts +69 -0
  171. package/src/realtime/tickets.ts +4 -1
  172. package/src/realtime/transport.ts +77 -9
  173. package/src/slack/blocks.ts +18 -0
  174. package/src/slack/dm.ts +29 -0
  175. package/src/telemetry-contract/EVENTS.md +3 -0
  176. package/src/telemetry-contract/SOURCE.json +37 -4
  177. package/src/telemetry-contract/catalog.json +69 -0
  178. package/src/telemetry-contract/ranking/fixtures/expected.json +30 -0
  179. package/src/telemetry-contract/ranking/fixtures/invalid/bad-category.json +11 -0
  180. package/src/telemetry-contract/ranking/fixtures/invalid/bad-claim.json +11 -0
  181. package/src/telemetry-contract/ranking/fixtures/invalid/blank-description.json +11 -0
  182. package/src/telemetry-contract/ranking/fixtures/invalid/blank-name.json +11 -0
  183. package/src/telemetry-contract/ranking/fixtures/invalid/description-too-long.json +11 -0
  184. package/src/telemetry-contract/ranking/fixtures/invalid/domain-uppercase.json +11 -0
  185. package/src/telemetry-contract/ranking/fixtures/invalid/domain-with-scheme.json +11 -0
  186. package/src/telemetry-contract/ranking/fixtures/invalid/domain-with-www.json +11 -0
  187. package/src/telemetry-contract/ranking/fixtures/invalid/http-source-url.json +11 -0
  188. package/src/telemetry-contract/ranking/fixtures/invalid/missing-description.json +10 -0
  189. package/src/telemetry-contract/ranking/fixtures/invalid/missing-version.json +10 -0
  190. package/src/telemetry-contract/ranking/fixtures/invalid/name-not-string.json +11 -0
  191. package/src/telemetry-contract/ranking/fixtures/invalid/name-too-long.json +11 -0
  192. package/src/telemetry-contract/ranking/fixtures/invalid/not-object.json +1 -0
  193. package/src/telemetry-contract/ranking/fixtures/invalid/null.json +1 -0
  194. package/src/telemetry-contract/ranking/fixtures/invalid/other-with-subcategory.json +11 -0
  195. package/src/telemetry-contract/ranking/fixtures/invalid/oversize.json +1 -0
  196. package/src/telemetry-contract/ranking/fixtures/invalid/short-claim.json +11 -0
  197. package/src/telemetry-contract/ranking/fixtures/invalid/subcategory-other-category.json +11 -0
  198. package/src/telemetry-contract/ranking/fixtures/invalid/trailing-data.json +1 -0
  199. package/src/telemetry-contract/ranking/fixtures/invalid/unknown-field.json +12 -0
  200. package/src/telemetry-contract/ranking/fixtures/invalid/unsupported-version.json +11 -0
  201. package/src/telemetry-contract/ranking/fixtures/invalid/updated-at-not-date.json +11 -0
  202. package/src/telemetry-contract/ranking/fixtures/invalid/updated-at-offset.json +11 -0
  203. package/src/telemetry-contract/ranking/fixtures/invalid/wrong-case-field.json +11 -0
  204. package/src/telemetry-contract/ranking/fixtures/valid/category-without-subcategory.json +11 -0
  205. package/src/telemetry-contract/ranking/fixtures/valid/full.json +11 -0
  206. package/src/telemetry-contract/ranking/fixtures/valid/minimal.json +11 -0
  207. package/src/telemetry-contract/ranking/fixtures/valid/padded-text.json +11 -0
  208. package/src/telemetry-contract/ranking/fixtures/valid/unicode-name.json +11 -0
  209. package/src/telemetry-contract/ranking/listing.v1.schema.json +61 -0
  210. package/src/telemetry-contract/ranking/taxonomy.json +8 -0
  211. package/src/telemetry-contract/ranking-taxonomy.gen.ts +11 -0
  212. package/src/telemetry-contract/types.gen.ts +708 -1
  213. package/src/telemetry.ts +26 -2
  214. package/src/tests/apps-rbac.test.ts +189 -2
  215. package/src/tests/apps-script-types.test.ts +16 -3
  216. package/src/tests/asset-key-api.test.ts +128 -0
  217. package/src/tests/asset-key-invariants.test.ts +179 -3
  218. package/src/tests/asset-key-migration.test.ts +35 -0
  219. package/src/tests/check-pr-body.test.ts +23 -0
  220. package/src/tests/check-ranking-entry.test.ts +146 -0
  221. package/src/tests/db-extraction-contract.test.ts +1 -0
  222. package/src/tests/db-task-read-contract.test.ts +1 -0
  223. package/src/tests/docs-index-footprint.test.js +2 -2
  224. package/src/tests/heartbeat-checklist.test.ts +88 -0
  225. package/src/tests/heartbeat-jev-gate.test.ts +394 -10
  226. package/src/tests/inbox-state.test.ts +167 -0
  227. package/src/tests/kv-tool.test.ts +15 -0
  228. package/src/tests/org-identity.test.ts +44 -0
  229. package/src/tests/ranking-listing.test.ts +112 -0
  230. package/src/tests/ranking-route.test.ts +319 -0
  231. package/src/tests/ranking-usage.test.ts +50 -0
  232. package/src/tests/rbac-admission-e2e.test.ts +8 -0
  233. package/src/tests/rbac-admission.test.ts +38 -0
  234. package/src/tests/rbac-charact-http.test.ts +4 -3
  235. package/src/tests/rbac-engine.test.ts +2 -0
  236. package/src/tests/rbac-roles.test.ts +2 -0
  237. package/src/tests/realtime-room-surfaces.test.ts +3 -1
  238. package/src/tests/realtime-session-join-race.test.ts +142 -0
  239. package/src/tests/realtime-tickets.test.ts +24 -17
  240. package/src/tests/realtime-transport.test.ts +91 -0
  241. package/src/tests/script-connections.test.ts +2 -0
  242. package/src/tests/session-route-posture.test.ts +639 -0
  243. package/src/tests/session-sharing-routes.test.ts +282 -0
  244. package/src/tests/session-sharing.test.ts +526 -0
  245. package/src/tests/sessions-detail-batch.test.ts +7 -1
  246. package/src/tests/slack-tool-blocks.test.ts +101 -0
  247. package/src/tests/slack-update.test.ts +55 -0
  248. package/src/tests/slack-user-dm.test.ts +177 -0
  249. package/src/tests/used-by-route.test.ts +10 -0
  250. package/src/tools/slack-post.ts +18 -12
  251. package/src/tools/slack-read.ts +13 -1
  252. package/src/tools/slack-reply.ts +7 -10
  253. package/src/tools/slack-start-thread.ts +18 -11
  254. package/src/tools/slack-update.ts +2 -9
  255. package/src/types.ts +37 -0
  256. package/src/utils/org-identity.ts +33 -0
  257. package/templates/skills/apps/SKILL.md +17 -0
  258. package/templates/skills/apps/content.md +17 -0
  259. package/templates/skills/code-quality/content.md +2 -2
  260. package/templates/skills/pages/content.md +4 -0
  261. package/templates/skills/swarm-scripts/SKILL.md +6 -0
  262. package/templates/skills/swarm-scripts/content.md +6 -0
  263. package/dist/handlers-t5pbabwf.js +0 -37
  264. package/dist/index-qyjbb7br.js +0 -39
  265. package/dist/{cli-n5mrsg0f.js → cli-60cgh1rv.js} +3 -3
  266. /package/dist/{cli-j0v75y13.js → cli-y83zk5sb.js} +0 -0
@@ -72,6 +72,7 @@ import {
72
72
  hasNonTerminalRerouteDecisionChild2,
73
73
  getAgentCurrentTask2,
74
74
  findTaskByVcs2,
75
+ readableSessionCondition,
75
76
  getAllTasks2,
76
77
  getPendingChatRelayTasks2,
77
78
  giveUpStaleChatRelays2,
@@ -89,6 +90,7 @@ import {
89
90
  getLatestLeadTaskByContextKey2,
90
91
  findCompletedTaskInThread2,
91
92
  findRecentCancelledTaskInThread2,
93
+ init_read,
92
94
  listModelProfiles,
93
95
  getModelProfileByName,
94
96
  modelProfileRefError,
@@ -330,19 +332,19 @@ import {
330
332
  recordInlineScriptRun2,
331
333
  exports_db,
332
334
  init_db3
333
- } from "./cli-4c7k75rq.js";
335
+ } from "./cli-rg7ntypm.js";
334
336
  import {
335
337
  getUserGrant2,
336
338
  init_rbac_roles
337
- } from "./cli-6q7pyd3k.js";
339
+ } from "./cli-5s5hx57y.js";
338
340
  import {
339
341
  ensurePricingSeeded2,
340
342
  ensureRbacSeeded2,
341
343
  ensureModelProfilesSeeded2
342
- } from "./cli-mnry16kh.js";
344
+ } from "./cli-kk2r80n5.js";
343
345
  import {
344
346
  loadModelsDevCache
345
- } from "./cli-8w65vwee.js";
347
+ } from "./cli-tg9ksbn8.js";
346
348
  import {
347
349
  buildCatalogEntries,
348
350
  listModelCatalog,
@@ -352,12 +354,12 @@ import {
352
354
  loadModelsCatalog,
353
355
  requestModelCatalogRefresh2,
354
356
  startPricingRefreshLoop2
355
- } from "./cli-jhhb2v9n.js";
357
+ } from "./cli-ttaz6c7m.js";
356
358
  import {
357
359
  ampPinProviderError,
358
360
  ampPinCatalogError,
359
361
  ampModelError
360
- } from "./cli-vmbakbq0.js";
362
+ } from "./cli-2rwet3r7.js";
361
363
  import {
362
364
  notifyAutomationPreflightFailure,
363
365
  isNeedsSetupFailure,
@@ -408,7 +410,7 @@ import {
408
410
  buildNodeInterpolationCtx,
409
411
  interpolateNodeConfig,
410
412
  scriptBodyInterpolationError
411
- } from "./cli-dw0njd9q.js";
413
+ } from "./cli-nme7wery.js";
412
414
  import {
413
415
  require_dist2,
414
416
  publicEndpointSsrfOptions,
@@ -465,14 +467,14 @@ import {
465
467
  deleteApp,
466
468
  typecheckScript,
467
469
  parseSkillContent
468
- } from "./cli-mvsfbbgq.js";
470
+ } from "./cli-nrrg0fvy.js";
469
471
  import {
470
472
  buildAuthorizationUrl,
471
473
  onAuthorizationRefreshed,
472
474
  ensureAuthorizationTokenOrThrow,
473
475
  ensureToken,
474
476
  ensureTokenOrThrow
475
- } from "./cli-xx13gqf3.js";
477
+ } from "./cli-b80a1100.js";
476
478
  import {
477
479
  detachedProcessGroup,
478
480
  registerProcessGroup,
@@ -484,6 +486,7 @@ import {
484
486
  getTaskLink,
485
487
  getTaskUrl,
486
488
  markdownToSlack,
489
+ buildMrkdwnSectionBlocks,
487
490
  buildCaptionBlock,
488
491
  taskCitationIssues,
489
492
  stripInvalidTaskCitations,
@@ -501,14 +504,14 @@ import {
501
504
  getSlackApp2,
502
505
  startSlackApp2,
503
506
  stopSlackApp2
504
- } from "./cli-tba8fxf9.js";
507
+ } from "./cli-4fhyq711.js";
505
508
  import {
506
509
  slackCode,
507
510
  slackMissingScopeMessage,
508
511
  withAutoJoin,
509
512
  externalChannelToolError2,
510
513
  getChannelBlockReason2
511
- } from "./cli-ztcxv5nv.js";
514
+ } from "./cli-xfe63zx3.js";
512
515
  import {
513
516
  BaseExecutor,
514
517
  postApprovalCancellationUpdates,
@@ -525,11 +528,36 @@ import {
525
528
  definitionNodeIds,
526
529
  validateDefinition,
527
530
  applyDefinitionPatch
528
- } from "./cli-hwc4a9xm.js";
531
+ } from "./cli-tj4j2ts4.js";
529
532
  import {
530
533
  workflowEventBus2,
531
534
  init_event_bus
532
535
  } from "./cli-ptkpaqfy.js";
536
+ import {
537
+ duplicateGuardedQueryKey,
538
+ parseQueryParams,
539
+ getPathSegments,
540
+ agentWithCapacity,
541
+ BODY_TOO_LARGE,
542
+ enforceContentLengthCap,
543
+ json,
544
+ jsonError,
545
+ getSessionRoot,
546
+ sessionAccessForRoot,
547
+ resolveTaskAuditUserId,
548
+ resolveHttpFavoriteOwner,
549
+ resolveSessionActor2,
550
+ SESSION_READ_DENIED2,
551
+ canReadSession2,
552
+ readableByFor2,
553
+ pathSessionDenial2,
554
+ userAgentIdentityDenial2,
555
+ runtimeInstanceHeader,
556
+ routeRegistry,
557
+ isPublicRoute,
558
+ findRoute,
559
+ route
560
+ } from "./cli-02vhhssk.js";
533
561
  import {
534
562
  isMultiRuntimeEnabled
535
563
  } from "./cli-7a91w22y.js";
@@ -539,23 +567,9 @@ import {
539
567
  getFileStorageProvider2
540
568
  } from "./cli-qje9k2nh.js";
541
569
  import {
542
- findUserById,
543
- findUserByExternalId,
544
- findUserByEmail,
545
- findUsersByName,
546
- getUserIdentities,
547
- recordIdentityEvent,
548
- findOrCreateUserByEmail,
549
- linkIdentity,
550
- unlinkIdentity,
551
- resolveUserByToken,
552
- revokeRuntimeTokensForRuntime,
553
- resolveSessionToken,
554
- fingerprintApiKey,
555
- init_users,
556
570
  getRuntimePool2,
557
571
  init_db
558
- } from "./cli-h23mr2s6.js";
572
+ } from "./cli-6ftrrwm1.js";
559
573
  import {
560
574
  getMemoryRaterNames,
561
575
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -581,6 +595,22 @@ import {
581
595
  canProvisionKind,
582
596
  init_runtime_providers
583
597
  } from "./cli-wk8ccrz6.js";
598
+ import {
599
+ findUserById,
600
+ findUserByExternalId,
601
+ findUserByEmail,
602
+ findUsersByName,
603
+ getUserIdentities,
604
+ recordIdentityEvent,
605
+ findOrCreateUserByEmail,
606
+ linkIdentity,
607
+ unlinkIdentity,
608
+ resolveUserByToken,
609
+ revokeRuntimeTokensForRuntime,
610
+ resolveSessionToken,
611
+ fingerprintApiKey,
612
+ init_users
613
+ } from "./cli-8cxkw1f5.js";
584
614
  import {
585
615
  isRbacEnabled,
586
616
  decideAdmission,
@@ -589,7 +619,7 @@ import {
589
619
  init_elevated_agents,
590
620
  can,
591
621
  init_rbac
592
- } from "./cli-zj4d6afs.js";
622
+ } from "./cli-1pa3rz69.js";
593
623
  import {
594
624
  normalizeAssetKey,
595
625
  parseAssetKey,
@@ -649,7 +679,7 @@ import {
649
679
  KvNamespaceSchema,
650
680
  KvKeySchema,
651
681
  init_types
652
- } from "./cli-ksrphveb.js";
682
+ } from "./cli-a1esmmee.js";
653
683
  import {
654
684
  generateDefaultClaudeMd2,
655
685
  generateDefaultSoulMd2,
@@ -658,7 +688,7 @@ import {
658
688
  taskAttachmentFetchCommand,
659
689
  taskAttachmentDisplayUrl,
660
690
  init_task_attachment_links
661
- } from "./cli-cby329ny.js";
691
+ } from "./cli-wyrr38xm.js";
662
692
  import {
663
693
  getSlackConfiguration,
664
694
  init_config
@@ -677,7 +707,7 @@ import {
677
707
  init_registry,
678
708
  resolveTemplate,
679
709
  init_resolver
680
- } from "./cli-w7z94e6c.js";
710
+ } from "./cli-tx00c0h6.js";
681
711
  import {
682
712
  init_zod
683
713
  } from "./cli-4chz1hye.js";
@@ -689,7 +719,6 @@ import {
689
719
  init_json_schema_processors,
690
720
  init_core,
691
721
  datetime,
692
- ZodError,
693
722
  string2,
694
723
  uuid,
695
724
  number2,
@@ -721,7 +750,7 @@ import {
721
750
  import {
722
751
  init_package,
723
752
  package_default
724
- } from "./cli-2jm992rm.js";
753
+ } from "./cli-mz1ezzzh.js";
725
754
  import {
726
755
  realtimeBus,
727
756
  init_bus
@@ -21125,7 +21154,7 @@ class NotifyExecutor extends BaseExecutor {
21125
21154
  }
21126
21155
  }
21127
21156
  case "slack": {
21128
- const { getSlackApp } = await import("./app-zneem7g9.js");
21157
+ const { getSlackApp } = await import("./app-mqap8t8m.js");
21129
21158
  const app = getSlackApp();
21130
21159
  if (!app) {
21131
21160
  return {
@@ -24480,7 +24509,7 @@ function setPreloadedTools(server, names) {
24480
24509
  async function applyPreToolCall(name, args, requestInfo, inputSchema) {
24481
24510
  if (requestInfo.callOrigin !== "mcp")
24482
24511
  return { args };
24483
- const dispatcher = await import("./dispatcher-d3mnsg2y.js");
24512
+ const dispatcher = await import("./dispatcher-ewceb8ts.js");
24484
24513
  const result = await dispatcher.dispatchPre("pre.tool.call", { tool: name, args, requestInfo }, inputSchema ? {
24485
24514
  validateModify: async (data) => {
24486
24515
  const schema = normalizeObjectSchema(inputSchema) ?? inputSchema;
@@ -24575,469 +24604,6 @@ var createToolRegistrar = (server) => {
24575
24604
  };
24576
24605
  };
24577
24606
 
24578
- // src/http/route-def.ts
24579
- init_zod();
24580
- init_node_env();
24581
- init_secret_scrubber();
24582
-
24583
- // src/http/utils.ts
24584
- init_db3();
24585
- init_env_flag();
24586
- init_node_env();
24587
- init_secret_scrubber();
24588
- function duplicateGuardedQueryKey(query) {
24589
- return ["agentId", "repoId", "includeSecrets", "resolveSecrets"].find((key) => query.getAll(key).length > 1);
24590
- }
24591
- var DEFAULT_ALLOWED_ORIGINS = [
24592
- "https://*.agent-swarm.dev",
24593
- "https://*.agent-swarm.cloud",
24594
- "http://localhost:5274",
24595
- "http://127.0.0.1:5274",
24596
- "http://[::1]:5274",
24597
- "https://ui.swarm.localhost:1355"
24598
- ];
24599
- var warnedAboutAllowAnyOrigin = false;
24600
- function warnIfCorsAllowsAnyOrigin() {
24601
- if (isEnvFlagEnabled("CORS_ALLOW_ANY_ORIGIN", false) && !warnedAboutAllowAnyOrigin) {
24602
- warnedAboutAllowAnyOrigin = true;
24603
- console.warn("[CORS] CORS_ALLOW_ANY_ORIGIN=true: any request origin can receive non-credentialed responses; cookie-authenticated responses still require CORS_ALLOWED_ORIGINS. Set CORS_ALLOWED_ORIGINS and disable CORS_ALLOW_ANY_ORIGIN to restrict access.");
24604
- }
24605
- }
24606
- function getAllowedOrigins() {
24607
- const raw = process.env.CORS_ALLOWED_ORIGINS;
24608
- if (!raw || !raw.trim())
24609
- return DEFAULT_ALLOWED_ORIGINS;
24610
- return raw.split(",").map((entry) => entry.trim()).filter(Boolean);
24611
- }
24612
- function isDevLoopbackOrigin(origin) {
24613
- if (getNodeEnv() !== "development")
24614
- return false;
24615
- return /^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])(:\d{1,5})?$/.test(origin);
24616
- }
24617
- function originAllowedForCredentials(origin) {
24618
- if (isDevLoopbackOrigin(origin))
24619
- return true;
24620
- return getAllowedOrigins().some((entry) => {
24621
- if (!entry.includes("*"))
24622
- return entry === origin;
24623
- const pattern = /^([a-zA-Z][a-zA-Z0-9+.-]*):\/\/\*\.([a-zA-Z0-9.-]+)(:\d+)?$/.exec(entry);
24624
- const candidate = /^([a-zA-Z][a-zA-Z0-9+.-]*):\/\/([a-zA-Z0-9.-]+)(:\d+)?$/.exec(origin);
24625
- if (!pattern || !candidate)
24626
- return false;
24627
- if (pattern[1] !== candidate[1] || pattern[3] !== candidate[3])
24628
- return false;
24629
- const suffix = pattern[2].toLowerCase();
24630
- const hostname = candidate[2].toLowerCase();
24631
- const validLabel = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
24632
- if (![...suffix.split("."), ...hostname.split(".")].every((label) => validLabel.test(label))) {
24633
- return false;
24634
- }
24635
- return hostname.endsWith(`.${suffix}`);
24636
- });
24637
- }
24638
- function isOriginAllowedForCredentials(origin) {
24639
- const allowed = originAllowedForCredentials(origin);
24640
- if (!allowed) {
24641
- console.warn(`[CORS] Denied credentialed origin ${scrubSecrets(JSON.stringify(origin.slice(0, 512)))}; add the trusted SPA origin to CORS_ALLOWED_ORIGINS (custom values replace hosted/dev defaults).`);
24642
- }
24643
- return allowed;
24644
- }
24645
- function allowedCredentialRedirect(raw) {
24646
- if (!raw)
24647
- return;
24648
- try {
24649
- const redirect = new URL(raw);
24650
- if (redirect.protocol !== "http:" && redirect.protocol !== "https:")
24651
- return;
24652
- return originAllowedForCredentials(redirect.origin) ? redirect.toString() : undefined;
24653
- } catch {
24654
- return;
24655
- }
24656
- }
24657
- function setCorsHeaders(req, res) {
24658
- const rawOrigin = req.headers.origin;
24659
- const origin = Array.isArray(rawOrigin) ? rawOrigin[0] : rawOrigin;
24660
- const allowCredentials = origin ? isOriginAllowedForCredentials(origin) : false;
24661
- const allowAnyOrigin = isEnvFlagEnabled("CORS_ALLOW_ANY_ORIGIN", false);
24662
- if (allowAnyOrigin)
24663
- warnIfCorsAllowsAnyOrigin();
24664
- if (origin && !allowCredentials && !allowAnyOrigin) {
24665
- res.setHeader("Vary", "Origin");
24666
- return;
24667
- }
24668
- if (origin) {
24669
- res.setHeader("Access-Control-Allow-Origin", origin);
24670
- res.setHeader("Vary", "Origin");
24671
- if (allowCredentials)
24672
- res.setHeader("Access-Control-Allow-Credentials", "true");
24673
- const reqHeaders = req.headers["access-control-request-headers"];
24674
- const askedHeaders = Array.isArray(reqHeaders) ? reqHeaders.join(", ") : reqHeaders;
24675
- res.setHeader("Access-Control-Allow-Headers", askedHeaders ?? "Authorization, Content-Type, X-Agent-ID, X-Requested-With, X-Swarm-User-Id");
24676
- res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS");
24677
- res.setHeader("Access-Control-Expose-Headers", "Content-Type, Content-Length, ETag, Location");
24678
- } else {
24679
- res.setHeader("Access-Control-Allow-Origin", "*");
24680
- res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, PATCH, DELETE, OPTIONS");
24681
- res.setHeader("Access-Control-Allow-Headers", "*");
24682
- res.setHeader("Access-Control-Expose-Headers", "*");
24683
- }
24684
- }
24685
- function parseQueryParams(url) {
24686
- const queryIndex = url.indexOf("?");
24687
- if (queryIndex === -1)
24688
- return new URLSearchParams;
24689
- return new URLSearchParams(url.slice(queryIndex + 1));
24690
- }
24691
- function getPathSegments(url) {
24692
- const pathEnd = url.indexOf("?");
24693
- const path = pathEnd === -1 ? url : url.slice(0, pathEnd);
24694
- return path.split("/").filter(Boolean);
24695
- }
24696
- function abortedStatusCodeAttribute(headersSent, statusCode) {
24697
- return headersSent ? statusCode : undefined;
24698
- }
24699
- function wireHttpSpanLifecycle(res, span, getStatusCode, startTime) {
24700
- let spanEnded = false;
24701
- res.on("finish", () => {
24702
- if (spanEnded)
24703
- return;
24704
- spanEnded = true;
24705
- const statusCode = getStatusCode();
24706
- span.setAttributes({
24707
- "http.response.status_code": statusCode,
24708
- "agentswarm.http.duration_ms": Math.round((performance.now() - startTime) * 10) / 10
24709
- });
24710
- if (statusCode >= 500) {
24711
- span.setStatus({ code: 2, message: `HTTP ${statusCode}` });
24712
- }
24713
- span.end();
24714
- });
24715
- res.on("error", (err) => {
24716
- if (spanEnded)
24717
- return;
24718
- spanEnded = true;
24719
- if (err)
24720
- span.recordException(err);
24721
- span.setStatus({ code: 2, message: err?.message });
24722
- span.end();
24723
- });
24724
- res.on("close", () => {
24725
- if (spanEnded)
24726
- return;
24727
- spanEnded = true;
24728
- span.setAttributes({
24729
- "http.response.status_code": abortedStatusCodeAttribute(res.headersSent, getStatusCode()),
24730
- "agentswarm.http.duration_ms": Math.round((performance.now() - startTime) * 10) / 10,
24731
- "agentswarm.http.aborted": true
24732
- });
24733
- span.end();
24734
- });
24735
- }
24736
- function safeRequestUrlForLog(rawUrl) {
24737
- if (!rawUrl)
24738
- return "";
24739
- try {
24740
- const url = new URL(rawUrl, "http://localhost");
24741
- const params = Array.from(url.searchParams.keys());
24742
- if (params.length === 0)
24743
- return url.pathname;
24744
- const redactedQuery = params.map((key) => `${key}=[REDACTED]`).join("&");
24745
- return `${url.pathname}?${redactedQuery}`;
24746
- } catch {
24747
- const pathOnly = rawUrl.split("?")[0] || rawUrl;
24748
- return scrubSecrets(pathOnly);
24749
- }
24750
- }
24751
- async function agentWithCapacity(agent) {
24752
- const activeCount = await getActiveTaskCount2(agent.id);
24753
- const max = agent.maxTasks ?? 1;
24754
- return {
24755
- ...agent,
24756
- capacity: {
24757
- current: activeCount,
24758
- max,
24759
- available: Math.max(0, max - activeCount)
24760
- }
24761
- };
24762
- }
24763
-
24764
- class RequestBodyTooLargeError extends Error {
24765
- maxBytes;
24766
- constructor(maxBytes) {
24767
- super(`Payload too large (max ${maxBytes} bytes)`);
24768
- this.name = "RequestBodyTooLargeError";
24769
- this.maxBytes = maxBytes;
24770
- }
24771
- }
24772
- function requestContentLength(req) {
24773
- const raw = req.headers["content-length"];
24774
- const value = Array.isArray(raw) ? raw[0] : raw;
24775
- if (!value)
24776
- return;
24777
- const parsed = Number(value);
24778
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : undefined;
24779
- }
24780
- async function parseBody(req, maxBytes = Number.POSITIVE_INFINITY) {
24781
- const contentLength = requestContentLength(req);
24782
- if (contentLength !== undefined && contentLength > maxBytes) {
24783
- req.resume();
24784
- throw new RequestBodyTooLargeError(maxBytes);
24785
- }
24786
- return await new Promise((resolve, reject) => {
24787
- const chunks = [];
24788
- let totalBytes = 0;
24789
- let settled = false;
24790
- const cleanup = () => {
24791
- req.off("data", onData);
24792
- req.off("end", onEnd);
24793
- req.off("error", onError);
24794
- req.off("aborted", onAborted);
24795
- req.off("close", onClose);
24796
- };
24797
- const rejectTooLarge = () => {
24798
- if (settled)
24799
- return;
24800
- settled = true;
24801
- reject(new RequestBodyTooLargeError(maxBytes));
24802
- req.resume();
24803
- };
24804
- const onData = (chunk) => {
24805
- if (settled)
24806
- return;
24807
- const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
24808
- totalBytes += buffer.byteLength;
24809
- if (totalBytes > maxBytes) {
24810
- rejectTooLarge();
24811
- return;
24812
- }
24813
- chunks.push(buffer);
24814
- };
24815
- const onEnd = () => {
24816
- if (settled) {
24817
- cleanup();
24818
- return;
24819
- }
24820
- settled = true;
24821
- cleanup();
24822
- const raw = Buffer.concat(chunks).toString();
24823
- if (raw.trim() === "") {
24824
- resolve({});
24825
- return;
24826
- }
24827
- try {
24828
- resolve(JSON.parse(raw));
24829
- } catch (error) {
24830
- reject(error);
24831
- }
24832
- };
24833
- const onError = (error) => {
24834
- cleanup();
24835
- if (!settled) {
24836
- settled = true;
24837
- reject(error);
24838
- }
24839
- };
24840
- const onAborted = () => onError(new Error("Request body was aborted"));
24841
- const onClose = () => {
24842
- if (!req.readableEnded)
24843
- onError(new Error("Request body closed before completion"));
24844
- };
24845
- req.on("data", onData);
24846
- req.on("end", onEnd);
24847
- req.on("error", onError);
24848
- req.on("aborted", onAborted);
24849
- req.on("close", onClose);
24850
- req.resume();
24851
- });
24852
- }
24853
- var BODY_TOO_LARGE = Symbol("body-too-large");
24854
- function enforceContentLengthCap(req, res, maxBytes) {
24855
- const raw = req.headers["content-length"];
24856
- const val = Array.isArray(raw) ? raw[0] : raw;
24857
- if (!val)
24858
- return null;
24859
- const n = Number(val);
24860
- if (!Number.isFinite(n) || n < 0)
24861
- return null;
24862
- if (n > maxBytes) {
24863
- res.writeHead(413, { "Content-Type": "application/json" });
24864
- res.end(JSON.stringify({ error: `Payload too large (max ${maxBytes} bytes)` }));
24865
- return BODY_TOO_LARGE;
24866
- }
24867
- return null;
24868
- }
24869
- function json(res, data, status = 200) {
24870
- res.writeHead(status, { "Content-Type": "application/json" });
24871
- res.end(JSON.stringify(data));
24872
- }
24873
- function jsonError(res, error, status = 400) {
24874
- res.writeHead(status, { "Content-Type": "application/json" });
24875
- res.end(JSON.stringify({ error: scrubSecrets(error) }));
24876
- }
24877
- function writeUnhandledError(res, err, req) {
24878
- const message = err instanceof Error ? err.message : String(err);
24879
- console.error(`[HTTP] ❌ ${req?.method ?? ""} ${safeRequestUrlForLog(req?.url)} → ${scrubSecrets(message)}`);
24880
- if (!res.headersSent) {
24881
- jsonError(res, message, 500);
24882
- } else if (!res.writableEnded) {
24883
- res.end();
24884
- }
24885
- }
24886
- function triggerSchemaErrorResponse(res, message, details) {
24887
- res.writeHead(400, { "Content-Type": "application/json" });
24888
- res.end(JSON.stringify({ error: "TriggerSchemaError", message, details }));
24889
- }
24890
- function deriveApiBaseUrl(req) {
24891
- const publicBase = process.env.PUBLIC_MCP_BASE_URL?.trim();
24892
- if (publicBase)
24893
- return publicBase.replace(/\/+$/, "");
24894
- const envBase = process.env.MCP_BASE_URL?.trim();
24895
- if (envBase)
24896
- return envBase.replace(/\/+$/, "");
24897
- const fwdProtoRaw = req.headers["x-forwarded-proto"];
24898
- const fwdHostRaw = req.headers["x-forwarded-host"];
24899
- const fwdProto = Array.isArray(fwdProtoRaw) ? fwdProtoRaw[0] : fwdProtoRaw;
24900
- const fwdHost = Array.isArray(fwdHostRaw) ? fwdHostRaw[0] : fwdHostRaw;
24901
- const proto = fwdProto?.split(",")[0]?.trim() || "http";
24902
- const host = fwdHost?.split(",")[0]?.trim() || req.headers.host;
24903
- if (host)
24904
- return `${proto}://${host}`;
24905
- return `http://localhost:${process.env.PORT || "3013"}`;
24906
- }
24907
- function httpServerSemconvAttributes(req) {
24908
- const headerValue = (v) => Array.isArray(v) ? v[0] : v;
24909
- const firstHop = (v) => headerValue(v)?.split(",")[0]?.trim() || undefined;
24910
- const fwdProto = firstHop(req.headers["x-forwarded-proto"]);
24911
- const host = firstHop(req.headers["x-forwarded-host"]) ?? headerValue(req.headers.host)?.trim();
24912
- return {
24913
- "server.address": host ? host.replace(/:\d+$/, "") || undefined : undefined,
24914
- "url.scheme": fwdProto ?? "http",
24915
- "network.protocol.version": req.httpVersion || undefined,
24916
- "user_agent.original": headerValue(req.headers["user-agent"])
24917
- };
24918
- }
24919
- function matchRoute(method, pathSegments, expectedMethod, pattern, exact = false) {
24920
- if (method !== expectedMethod)
24921
- return false;
24922
- for (let i = 0;i < pattern.length; i++) {
24923
- const seg = pattern[i];
24924
- if (seg === null) {
24925
- if (!pathSegments[i])
24926
- return false;
24927
- } else {
24928
- if (pathSegments[i] !== seg)
24929
- return false;
24930
- }
24931
- }
24932
- if (exact && pathSegments[pattern.length])
24933
- return false;
24934
- return true;
24935
- }
24936
-
24937
- // src/http/route-def.ts
24938
- var runtimeInstanceHeader = (operation) => object2({
24939
- "X-Runtime-Instance-ID": string2().optional().describe("Identifies the concrete runtime instance (worker process) making the call, " + `as generated at its boot. Required to ${operation} when multi-runtime mode ` + "(MULTI_RUNTIME_ENABLED) is on; ignored otherwise.")
24940
- });
24941
- var routeRegistry = [];
24942
- function isPublicRoute(method, pathSegments) {
24943
- for (const def of routeRegistry) {
24944
- if (def.auth?.apiKey === false) {
24945
- if (matchRoute(method, pathSegments, def.method.toUpperCase(), def.pattern, def.exact ?? true)) {
24946
- return true;
24947
- }
24948
- }
24949
- }
24950
- return false;
24951
- }
24952
- function findRoute(method, pathSegments) {
24953
- for (const def of routeRegistry) {
24954
- if (matchRoute(method, pathSegments, def.method.toUpperCase(), def.pattern, def.exact ?? true)) {
24955
- return def;
24956
- }
24957
- }
24958
- return;
24959
- }
24960
- var CORE_ROUTE_TEMPLATES = {
24961
- health: { path: "/health" },
24962
- "openapi.json": { path: "/openapi.json" },
24963
- docs: { path: "/docs", toleratesTrailingSlash: true },
24964
- me: { path: "/me", methods: ["GET"], toleratesQueryString: true },
24965
- "cancelled-tasks": {
24966
- path: "/cancelled-tasks",
24967
- methods: ["GET"],
24968
- toleratesQueryString: true
24969
- },
24970
- "internal/reload-config": { path: "/internal/reload-config", methods: ["POST"] },
24971
- mcp: { path: "/mcp", methods: ["GET", "POST", "DELETE"] },
24972
- "mcp-user": { path: "/mcp-user", methods: ["GET", "POST", "DELETE"] }
24973
- };
24974
- function describeRequestRoute(method, pathSegments, hasQueryString = false, hasTrailingSlash = false) {
24975
- const m = (method ?? "").toUpperCase() || "UNKNOWN";
24976
- const matched = findRoute(method, pathSegments);
24977
- if (matched)
24978
- return { spanName: `${m} ${matched.path}`, httpRoute: matched.path };
24979
- const coreTemplate = CORE_ROUTE_TEMPLATES[pathSegments.join("/")];
24980
- if (coreTemplate && (!coreTemplate.methods || coreTemplate.methods.includes(m)) && (!hasQueryString || coreTemplate.toleratesQueryString) && (!hasTrailingSlash || coreTemplate.toleratesTrailingSlash)) {
24981
- return { spanName: `${m} ${coreTemplate.path}`, httpRoute: coreTemplate.path };
24982
- }
24983
- const first = pathSegments[0];
24984
- return { spanName: first ? `${m} /${first}` : m };
24985
- }
24986
- var VALIDATE_RESPONSES = getNodeEnv() === "test" || getNodeEnv() === "development" || process.env.VALIDATE_HTTP_RESPONSES === "true";
24987
- function route(def) {
24988
- routeRegistry.push(def);
24989
- return {
24990
- def,
24991
- respond(res, code, data) {
24992
- if (VALIDATE_RESPONSES) {
24993
- const schema = def.responses[code]?.schema;
24994
- if (schema) {
24995
- const result = schema.safeParse(data);
24996
- if (!result.success) {
24997
- const detail = `Response schema violation: ${def.method.toUpperCase()} ${def.path} ${code} — ` + result.error.issues.map((i) => `${i.path.join(".") || "<root>"}: ${i.message}`).join("; ");
24998
- if (getNodeEnv() === "test") {
24999
- throw new Error(detail);
25000
- }
25001
- console.error(`[route-def] ${scrubSecrets(detail)}`);
25002
- }
25003
- }
25004
- }
25005
- res.writeHead(code, { "Content-Type": "application/json" });
25006
- res.end(JSON.stringify(data));
25007
- },
25008
- match(method, pathSegments) {
25009
- return matchRoute(method, pathSegments, def.method.toUpperCase(), def.pattern, def.exact ?? true);
25010
- },
25011
- async parse(req, res, pathSegments, queryParams) {
25012
- try {
25013
- const rawParams = {};
25014
- if (def.params) {
25015
- const paramNames = def.path.match(/\{(\w+)\}/g)?.map((p) => p.slice(1, -1)) ?? [];
25016
- for (let i = 0;i < def.pattern.length; i++) {
25017
- if (def.pattern[i] === null && paramNames.length > 0) {
25018
- rawParams[paramNames.shift()] = pathSegments[i] ?? "";
25019
- }
25020
- }
25021
- }
25022
- const params = def.params ? def.params.parse(rawParams) : undefined;
25023
- const query = def.query ? def.query.parse(Object.fromEntries(queryParams)) : undefined;
25024
- const body = def.body ? def.body.parse(await parseBody(req, def.maxBodyBytes)) : undefined;
25025
- return { params, query, body };
25026
- } catch (err) {
25027
- if (err instanceof ZodError) {
25028
- jsonError(res, `Validation error: ${err.issues.map((e) => `${e.path.join(".")}: ${e.message}`).join(", ")}`, 400);
25029
- return null;
25030
- }
25031
- if (err instanceof RequestBodyTooLargeError) {
25032
- jsonError(res, err.message, 413);
25033
- return null;
25034
- }
25035
- throw err;
25036
- }
25037
- }
25038
- };
25039
- }
25040
-
25041
24607
  // src/http/mcp-bridge.ts
25042
24608
  var _bridgeServer = null;
25043
24609
  async function getBridgeServer() {
@@ -31701,7 +31267,7 @@ async function loadAdapter(name, config, logger) {
31701
31267
  return createTelegramAdapter({ ...base, allowUnverifiedWebhooks: false });
31702
31268
  }
31703
31269
  case "slack": {
31704
- const { createSlackAdapter } = await import("./index-g909y089.js");
31270
+ const { createSlackAdapter } = await import("./index-zgvqzjsw.js");
31705
31271
  return createSlackAdapter({
31706
31272
  ...base,
31707
31273
  signingSecret: config.signingSecret ?? "",
@@ -31720,7 +31286,7 @@ async function loadAdapter(name, config, logger) {
31720
31286
  });
31721
31287
  }
31722
31288
  case "teams": {
31723
- const { createTeamsAdapter } = await import("./index-x0q2a4f9.js");
31289
+ const { createTeamsAdapter } = await import("./index-ysd45kgc.js");
31724
31290
  const { teamsWebhookVerifier, teamsToken } = getChatSdkTestHooks();
31725
31291
  return createTeamsAdapter({
31726
31292
  ...base,
@@ -34256,7 +33822,7 @@ async function notifySlack(text) {
34256
33822
  return;
34257
33823
  }
34258
33824
  try {
34259
- const { getSlackApp } = await import("./app-zneem7g9.js");
33825
+ const { getSlackApp } = await import("./app-mqap8t8m.js");
34260
33826
  const app = getSlackApp();
34261
33827
  if (!app) {
34262
33828
  console.warn("[Jira webhook keepalive] Slack not available, cannot send notification");
@@ -34327,7 +33893,7 @@ async function deleteJiraWebhook(webhookId) {
34327
33893
  console.log(`[Jira webhook keepalive] Deleted webhook id=${webhookId}`);
34328
33894
  }
34329
33895
  async function overwriteWebhookIds(next) {
34330
- const { getDbClient } = await import("./db-jvr86v7f.js");
33896
+ const { getDbClient } = await import("./db-2xbyenjr.js");
34331
33897
  await getDbClient().transaction(async (tx) => {
34332
33898
  const row = await tx.get("SELECT metadata FROM oauth_apps WHERE provider = 'jira'");
34333
33899
  if (!row) {
@@ -107677,7 +107243,7 @@ async function reloadGlobalConfigsAndIntegrations() {
107677
107243
  return runWithoutRequestAuth(() => reloadGlobalConfigsAndIntegrationsInner());
107678
107244
  }
107679
107245
  async function reloadGlobalConfigsAndIntegrationsInner() {
107680
- const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-w2wr89xd.js");
107246
+ const { getEmbeddingProvider, resetEmbeddingProvider } = await import("./index-cdzyfrsp.js");
107681
107247
  const wasEmbeddingsConfigured = getEmbeddingProvider().isConfigured();
107682
107248
  const updated = await loadGlobalConfigsIntoEnv(true);
107683
107249
  await syncTelemetryEnabled("settings").catch((err) => {
@@ -107693,10 +107259,10 @@ async function reloadGlobalConfigsAndIntegrationsInner() {
107693
107259
  integrations.push("embeddings");
107694
107260
  }
107695
107261
  if (!wasEmbeddingsConfigured && isEmbeddingsConfigured) {
107696
- import("./boot-reembed-4kx69j3g.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
107262
+ import("./boot-reembed-qr8a894z.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
107697
107263
  console.error("[config-reload] memory backfill failed (non-fatal):", err);
107698
107264
  });
107699
- import("./boot-reembed-db0wwgy1.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
107265
+ import("./boot-reembed-rj85jjhw.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
107700
107266
  console.error("[config-reload] script backfill failed (non-fatal):", err);
107701
107267
  });
107702
107268
  }
@@ -107854,6 +107420,12 @@ async function handleCore(req, res, myAgentId, apiKey) {
107854
107420
  }
107855
107421
  setRequestAuth(req, auth);
107856
107422
  }
107423
+ const routeDef = findRoute(req.method, pathSegments);
107424
+ const agentIdentityDenial = await userAgentIdentityDenial2(req, routeDef, pathSegments);
107425
+ if (agentIdentityDenial) {
107426
+ jsonError(res, agentIdentityDenial, 403);
107427
+ return true;
107428
+ }
107857
107429
  if (auth?.kind === "agent") {
107858
107430
  const query = parseQueryParams(req.url || "");
107859
107431
  const duplicate = duplicateGuardedQueryKey(query);
@@ -107905,7 +107477,7 @@ async function handleCore(req, res, myAgentId, apiKey) {
107905
107477
  if (auth?.kind === "user" && isRbacEnabled()) {
107906
107478
  const grant = await getUserGrant2(auth.userId);
107907
107479
  if (!grant.grantsAll) {
107908
- const def = findRoute(req.method, pathSegments);
107480
+ const def = routeDef;
107909
107481
  const decision = decideAdmission({
107910
107482
  method: req.method ?? "",
107911
107483
  rbac: def?.rbac,
@@ -107924,6 +107496,13 @@ async function handleCore(req, res, myAgentId, apiKey) {
107924
107496
  }
107925
107497
  }
107926
107498
  }
107499
+ if (routeDef?.session) {
107500
+ const sessionDenial = await pathSessionDenial2(req, myAgentId, routeDef, pathSegments);
107501
+ if (sessionDenial) {
107502
+ jsonError(res, sessionDenial, 403);
107503
+ return true;
107504
+ }
107505
+ }
107927
107506
  if (req.method === "POST" && req.url === "/internal/reload-config") {
107928
107507
  try {
107929
107508
  const result = await reloadGlobalConfigsAndIntegrations();
@@ -107979,7 +107558,13 @@ async function handleCore(req, res, myAgentId, apiKey) {
107979
107558
  }
107980
107559
  const queryParams = parseQueryParams(req.url || "");
107981
107560
  const taskId = queryParams.get("taskId");
107561
+ const sessionActor = await resolveSessionActor2(req, myAgentId);
107982
107562
  if (taskId) {
107563
+ if (!await canReadSession2(req, myAgentId, taskId)) {
107564
+ res.writeHead(403, { "Content-Type": "application/json" });
107565
+ res.end(JSON.stringify({ error: SESSION_READ_DENIED2 }));
107566
+ return true;
107567
+ }
107983
107568
  const task = await getTaskById2(taskId);
107984
107569
  if (task && task.status === "cancelled") {
107985
107570
  res.writeHead(200, { "Content-Type": "application/json" });
@@ -107998,7 +107583,7 @@ async function handleCore(req, res, myAgentId, apiKey) {
107998
107583
  res.end(JSON.stringify({ cancelled: [] }));
107999
107584
  return true;
108000
107585
  }
108001
- const cancelledTasks = await getRecentlyCancelledTasksForAgent2(myAgentId);
107586
+ const cancelledTasks = await getRecentlyCancelledTasksForAgent2(myAgentId, readableByFor2(sessionActor));
108002
107587
  res.writeHead(200, { "Content-Type": "application/json" });
108003
107588
  res.end(JSON.stringify({ cancelled: cancelledTasks }));
108004
107589
  return true;
@@ -110296,78 +109881,6 @@ init_rbac();
110296
109881
  init_types();
110297
109882
  init_request_auth_context();
110298
109883
  init_secret_scrubber();
110299
-
110300
- // src/be/audit-user.ts
110301
- init_request_auth_context();
110302
- init_db3();
110303
- init_users();
110304
- async function resolveTaskAuditUserId(sourceTaskId, callerAgentId) {
110305
- if (!callerAgentId)
110306
- return null;
110307
- let resolvedSourceTaskId = sourceTaskId;
110308
- if (!resolvedSourceTaskId) {
110309
- const currentTask = await getAgentCurrentTask2(callerAgentId);
110310
- if (currentTask)
110311
- resolvedSourceTaskId = currentTask.id;
110312
- }
110313
- if (!resolvedSourceTaskId)
110314
- return null;
110315
- const task = await getTaskById2(resolvedSourceTaskId);
110316
- if (!task)
110317
- return null;
110318
- if (task.agentId !== callerAgentId)
110319
- return null;
110320
- if (task.requestedByUserId)
110321
- return task.requestedByUserId;
110322
- if (task.slackUserId) {
110323
- const user = await findUserByExternalId("slack", task.slackUserId);
110324
- if (user)
110325
- return user.id;
110326
- }
110327
- return null;
110328
- }
110329
- async function resolveHttpAuditUserId(req, callerAgentId) {
110330
- const auth = getRequestAuth(req);
110331
- if (auth?.kind === "user")
110332
- return auth.userId;
110333
- const header = req.headers["x-source-task-id"];
110334
- const sourceTaskId = Array.isArray(header) ? header[0] : header;
110335
- return resolveTaskAuditUserId(sourceTaskId, callerAgentId);
110336
- }
110337
-
110338
- // src/http/favorite-owner.ts
110339
- init_users();
110340
- init_request_auth_context();
110341
- var DASHBOARD_USER_HEADER = "x-swarm-user-id";
110342
- function dashboardUserIdHeader(req) {
110343
- const raw = req.headers[DASHBOARD_USER_HEADER];
110344
- const value = (Array.isArray(raw) ? raw[0] : raw)?.trim();
110345
- return value ? value : null;
110346
- }
110347
- async function resolveHttpFavoriteOwner(req, callerAgentId, opts = {}) {
110348
- const auth = getRequestAuth(req);
110349
- if (auth?.kind === "user") {
110350
- return { scope: `user:${auth.userId}`, userId: auth.userId, actorId: auth.userId };
110351
- }
110352
- if (auth?.kind === "operator" && !callerAgentId) {
110353
- const pickedUserId = opts.dashboardUser === false || auth.page ? null : dashboardUserIdHeader(req);
110354
- if (pickedUserId) {
110355
- const user = await findUserById(pickedUserId);
110356
- if (user?.status === "active") {
110357
- return { scope: `user:${user.id}`, userId: user.id, actorId: user.id };
110358
- }
110359
- }
110360
- return {
110361
- scope: "operator",
110362
- userId: null,
110363
- actorId: auth.fingerprint
110364
- };
110365
- }
110366
- const userId = await resolveHttpAuditUserId(req, callerAgentId);
110367
- return userId ? { scope: `user:${userId}`, userId, actorId: userId } : null;
110368
- }
110369
-
110370
- // src/http/apps.ts
110371
109884
  var MAX_APP_BODY_BYTES = 5 * 1024 * 1024;
110372
109885
  var MAX_APP_ROW_BODY_BYTES = 1 * 1024 * 1024;
110373
109886
  var MAX_APP_BULK_ROWS_BODY_BYTES = 10 * 1024 * 1024;
@@ -110851,24 +110364,32 @@ var syncAppRoute = route({
110851
110364
  },
110852
110365
  rbac: { permission: "app.use" }
110853
110366
  });
110854
- async function authorizeApp(req, res, myAgentId, verb, resource) {
110367
+ async function authorizeAppCaller(req, res, myAgentId, verb, resource) {
110855
110368
  const auth = getRequestAuth(req);
110856
110369
  let principal;
110857
110370
  let actor;
110371
+ let caller;
110858
110372
  if (auth?.kind === "operator") {
110859
110373
  principal = { kind: "operator" };
110860
- actor = "operator";
110374
+ const agent = myAgentId && !auth.page ? await getAgentById2(myAgentId) : null;
110375
+ actor = agent ? `agent:${agent.id}` : "operator";
110376
+ caller = agent ? { kind: "agent", id: agent.id, name: agent.name } : { kind: "operator", id: null };
110861
110377
  } else if (auth?.kind === "user") {
110862
110378
  principal = { kind: "user", userId: auth.userId };
110863
110379
  actor = `user:${auth.userId}`;
110864
- } else if (auth?.kind === "guest") {
110380
+ caller = { kind: "user", id: auth.userId, name: auth.user.name };
110381
+ } else if (auth?.kind === "guest" || auth?.kind === "controller") {
110865
110382
  principal = { kind: "guest" };
110866
110383
  actor = "guest";
110384
+ caller = { kind: "guest", id: null };
110867
110385
  } else {
110868
110386
  const agent = myAgentId ? await getAgentById2(myAgentId) : null;
110869
110387
  principal = { kind: "agent", agentId: myAgentId ?? "", isLead: agent?.isLead ?? false };
110870
110388
  actor = myAgentId ? `agent:${myAgentId}` : "agent";
110389
+ caller = { kind: "agent", id: myAgentId ?? null, name: agent?.name };
110871
110390
  }
110391
+ if (auth?.page)
110392
+ caller.pageId = auth.page.id;
110872
110393
  const decision = can({
110873
110394
  principal,
110874
110395
  verb,
@@ -110876,10 +110397,13 @@ async function authorizeApp(req, res, myAgentId, verb, resource) {
110876
110397
  source: "http"
110877
110398
  });
110878
110399
  if (decision.allow)
110879
- return actor;
110400
+ return { actor, caller };
110880
110401
  jsonError(res, decision.reason, 403);
110881
110402
  return null;
110882
110403
  }
110404
+ async function authorizeApp(req, res, myAgentId, verb, resource) {
110405
+ return (await authorizeAppCaller(req, res, myAgentId, verb, resource))?.actor ?? null;
110406
+ }
110883
110407
  async function authorizeAppManage(req, res, myAgentId, appId) {
110884
110408
  return await authorizeApp(req, res, myAgentId, "app.manage", appId ? { kind: "app", appId } : { kind: "none" });
110885
110409
  }
@@ -111359,9 +110883,13 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
111359
110883
  const parsed = await runActionRoute.parse(req, res, pathSegments, queryParams);
111360
110884
  if (!parsed)
111361
110885
  return true;
111362
- const actor = await authorizeAppUse(req, res, myAgentId, parsed.params.id);
111363
- if (!actor)
110886
+ const identity = await authorizeAppCaller(req, res, myAgentId, "app.use", {
110887
+ kind: "app",
110888
+ appId: parsed.params.id
110889
+ });
110890
+ if (!identity)
111364
110891
  return true;
110892
+ const { actor, caller } = identity;
111365
110893
  const app = await getApp(parsed.params.id);
111366
110894
  if (!app) {
111367
110895
  jsonError(res, "app not found", 404);
@@ -111397,7 +110925,7 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
111397
110925
  }
111398
110926
  const output = await runSavedScriptAsAgent({
111399
110927
  script,
111400
- input: { ...action.args, ...input, app: { id: app.id } },
110928
+ input: { ...action.args, ...input, app: { id: app.id }, caller },
111401
110929
  agentId: runAsAgentId
111402
110930
  });
111403
110931
  const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
@@ -111438,7 +110966,8 @@ async function handleApps(req, res, pathSegments, queryParams, myAgentId) {
111438
110966
  prompt: action.prompt,
111439
110967
  app_id: app.id,
111440
110968
  action_name: parsed.params.name,
111441
- input_json: JSON.stringify(input)
110969
+ input_json: JSON.stringify(input),
110970
+ caller_json: JSON.stringify(caller)
111442
110971
  });
111443
110972
  const task = await createTaskWithSiblingAwareness(taskPrompt.text, {
111444
110973
  source: "api",
@@ -116853,6 +116382,7 @@ init_db3();
116853
116382
  var RESERVED_FAMILIES = new Map([
116854
116383
  ["apps", "namespace is reserved for swarm apps; use the app row endpoints"],
116855
116384
  ["comb", "namespace is reserved for Comb; use POST /api/comb/review-batches"],
116385
+ ["heartbeat-checklist", "namespace is reserved for heartbeat checklist receipts"],
116856
116386
  ["worker", "namespace is reserved for worker nudges"],
116857
116387
  ["slack-external-alert", "namespace is reserved for Slack external channel alerts"]
116858
116388
  ]);
@@ -121282,6 +120812,7 @@ init_context_key();
121282
120812
  init_runtime_pools_flag();
121283
120813
  var COMB_PRESENCE_NAMESPACE = /^presence:comb:[A-Za-z0-9_-]{1,64}:[A-Za-z0-9_-]{1,64}$/;
121284
120814
  var COMB_PRESENCE_OPERATIONS = new Set(["join", "leave", "presence"]);
120815
+ var SESSION_PRESENCE_NAMESPACE = /^presence:session:([A-Za-z0-9_-]{1,64})$/;
121285
120816
  function pageNamespace(pageId) {
121286
120817
  try {
121287
120818
  return pageContextKey({ pageId });
@@ -121374,6 +120905,9 @@ async function authorizeRoomNamespace(namespace, info, access, name) {
121374
120905
  }
121375
120906
  return null;
121376
120907
  }
120908
+ if (namespace.startsWith("presence:session:")) {
120909
+ return authorizeSessionPresence(namespace, info, access);
120910
+ }
121377
120911
  const reservedError = reservedNamespaceError(namespace);
121378
120912
  if (reservedError)
121379
120913
  return reservedError;
@@ -121409,6 +120943,48 @@ async function authorizeRoomNamespace(namespace, info, access, name) {
121409
120943
  }
121410
120944
  return null;
121411
120945
  }
120946
+ function sessionAccessTopic(rootTaskId) {
120947
+ return `session-access:${rootTaskId}`;
120948
+ }
120949
+ function sessionPresenceRoot(namespace) {
120950
+ return SESSION_PRESENCE_NAMESPACE.exec(namespace)?.[1];
120951
+ }
120952
+ async function authorizeSessionPresence(namespace, info, access) {
120953
+ const match = SESSION_PRESENCE_NAMESPACE.exec(namespace);
120954
+ if (!match)
120955
+ return "invalid session presence namespace";
120956
+ if (info.pageId || info.agentId || !info.isOperator && !info.userId) {
120957
+ return "Session presence requires dashboard authentication";
120958
+ }
120959
+ if (typeof access !== "string" || !COMB_PRESENCE_OPERATIONS.has(access)) {
120960
+ return "Session presence rooms only allow join, leave, and presence";
120961
+ }
120962
+ const principal = info.isOperator ? { kind: "operator" } : { kind: "user", userId: info.userId };
120963
+ if (!can({
120964
+ principal,
120965
+ verb: "session.presence",
120966
+ resource: { kind: "kv-namespace", namespace },
120967
+ source: info.callOrigin === "mcp" ? "mcp" : "http"
120968
+ }).allow) {
120969
+ return "Session presence requires the session.presence permission";
120970
+ }
120971
+ if (info.userId && isRbacEnabled()) {
120972
+ const grant = await getUserGrant2(info.userId);
120973
+ if (!grant.grantsAll && !grant.verbs.has("session.presence")) {
120974
+ return "Session presence requires the session.presence permission";
120975
+ }
120976
+ }
120977
+ const viewerId = info.isOperator ? info.dashboardUserId : info.userId;
120978
+ if (info.isOperator && !viewerId)
120979
+ return null;
120980
+ const root = await getSessionRoot(match[1]);
120981
+ if (!root || root.id !== match[1])
120982
+ return "session not found";
120983
+ if (await sessionAccessForRoot(viewerId ?? null, root) === "none") {
120984
+ return "You don't have access to this session";
120985
+ }
120986
+ return null;
120987
+ }
121412
120988
 
121413
120989
  // node_modules/lib0/map.js
121414
120990
  var create = () => new Map;
@@ -128072,6 +127648,7 @@ init_db3();
128072
127648
  // src/be/events.ts
128073
127649
  init_secret_scrubber();
128074
127650
  init_db3();
127651
+ init_read();
128075
127652
  init_scrub_json();
128076
127653
 
128077
127654
  // src/be/memory/key-browser.ts
@@ -128401,6 +127978,13 @@ async function getEventCountsFiltered(filters) {
128401
127978
  async function getEventsFiltered(filters) {
128402
127979
  const conditions = [];
128403
127980
  const params = [];
127981
+ if (filters.readableBy) {
127982
+ const readable = readableSessionCondition(filters.readableBy.userId, "events.taskId", {
127983
+ nullable: true
127984
+ });
127985
+ conditions.push(readable.sql);
127986
+ params.push(...readable.params);
127987
+ }
128404
127988
  if (filters.category) {
128405
127989
  conditions.push("category = ?");
128406
127990
  params.push(filters.category);
@@ -132265,13 +131849,30 @@ var registerSlackListChannelsTool = (server) => {
132265
131849
  init_zod();
132266
131850
  init_db3();
132267
131851
  init_rbac();
131852
+
131853
+ // src/slack/dm.ts
131854
+ function isSlackUserId(id) {
131855
+ return /^[UW][A-Z0-9]+$/.test(id);
131856
+ }
131857
+ async function resolveSlackConversationId(client, channelId) {
131858
+ if (!isSlackUserId(channelId))
131859
+ return channelId;
131860
+ const result = await client.conversations.open({ users: channelId });
131861
+ const dmId = result.channel?.id;
131862
+ if (!dmId) {
131863
+ throw new Error(`conversations.open returned no DM channel for user ${channelId}`);
131864
+ }
131865
+ return dmId;
131866
+ }
131867
+
131868
+ // src/tools/slack-post.ts
132268
131869
  var registerSlackPostTool = (server) => {
132269
131870
  createToolRegistrar(server)("slack-post", {
132270
131871
  title: "Post message to Slack channel",
132271
131872
  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.",
132272
131873
  annotations: { openWorldHint: true },
132273
131874
  inputSchema: object2({
132274
- channelId: string2().min(1).describe("The Slack channel ID to post to."),
131875
+ 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."),
132275
131876
  message: string2().min(1).max(4000).describe("The message content to post."),
132276
131877
  blocks: array2(record2(string2(), unknown())).max(50).optional().describe("Optional Block Kit blocks. When omitted, a mrkdwn section is generated."),
132277
131878
  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.")
@@ -132279,7 +131880,7 @@ var registerSlackPostTool = (server) => {
132279
131880
  outputSchema: swarmToolOutputSchema({
132280
131881
  messageTs: string2().optional()
132281
131882
  })
132282
- }, async ({ channelId, message, threadTs, blocks }, requestInfo, _meta) => {
131883
+ }, async ({ channelId: requestedChannelId, message, threadTs, blocks }, requestInfo, _meta) => {
132283
131884
  if (!requestInfo.agentId) {
132284
131885
  return toolErr("Agent ID not found.");
132285
131886
  }
@@ -132300,6 +131901,13 @@ var registerSlackPostTool = (server) => {
132300
131901
  if (!app) {
132301
131902
  return toolErr("Slack not configured.");
132302
131903
  }
131904
+ let channelId;
131905
+ try {
131906
+ channelId = await resolveSlackConversationId(app.client, requestedChannelId);
131907
+ } catch (error) {
131908
+ const errorMsg = error instanceof Error ? error.message : String(error);
131909
+ return toolErr(`Failed to open a DM with ${requestedChannelId}: ${errorMsg}`);
131910
+ }
132303
131911
  const blockReason = await getChannelBlockReason2(app.client, channelId);
132304
131912
  if (blockReason) {
132305
131913
  return toolErr(externalChannelToolError2(channelId, blockReason));
@@ -132310,15 +131918,7 @@ var registerSlackPostTool = (server) => {
132310
131918
  const contextKey = sourceTask?.contextKey;
132311
131919
  const tree = threadTs ? await getSlackTreeMessageByThread2(channelId, threadTs) : null;
132312
131920
  const messageBlocks = [
132313
- ...blocks ?? [
132314
- {
132315
- type: "section",
132316
- text: {
132317
- type: "mrkdwn",
132318
- text: slackMessage
132319
- }
132320
- }
132321
- ]
131921
+ ...blocks ?? buildMrkdwnSectionBlocks(slackMessage)
132322
131922
  ];
132323
131923
  if (sourceTask && tree) {
132324
131924
  if (messageBlocks.length >= 50) {
@@ -132402,7 +132002,7 @@ var registerSlackReadTool = (server) => {
132402
132002
  inputSchema: object2({
132403
132003
  inboxMessageId: uuid().optional().describe("Read thread history for an inbox message."),
132404
132004
  taskId: uuid().optional().describe("Read thread history for a task."),
132405
- channelId: string2().optional().describe("Slack channel ID to read from (requires lead privileges)."),
132005
+ channelId: string2().optional().describe("Slack channel ID to read from (requires lead privileges). A user ID (U…/W…) reads the bot's DM with that user."),
132406
132006
  threadTs: string2().optional().describe("Thread timestamp (required with channelId for thread history)."),
132407
132007
  limit: number2().int().min(1).max(100).default(20).describe("Maximum number of messages to retrieve (default: 20, max: 100)."),
132408
132008
  includeFiles: boolean().default(true).describe("Include file attachments in the response (default: true). From a task, they are also stored as attachments of that task.")
@@ -132470,6 +132070,14 @@ var registerSlackReadTool = (server) => {
132470
132070
  if (!app) {
132471
132071
  return toolErr("Slack not configured.", { data: { messages: [] } });
132472
132072
  }
132073
+ try {
132074
+ slackChannelId = await resolveSlackConversationId(app.client, slackChannelId);
132075
+ } catch (error) {
132076
+ const errorMsg = error instanceof Error ? error.message : String(error);
132077
+ return toolErr(`Failed to open a DM with ${slackChannelId}: ${errorMsg}`, {
132078
+ data: { messages: [] }
132079
+ });
132080
+ }
132473
132081
  const blockReason = await getChannelBlockReason2(app.client, slackChannelId);
132474
132082
  if (blockReason) {
132475
132083
  return toolErr(externalChannelToolError2(slackChannelId, blockReason), {
@@ -132678,15 +132286,7 @@ var registerSlackReplyTool = (server) => {
132678
132286
  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)));
132679
132287
  const tree = await getSlackTreeMessageByThread2(slackChannelId, slackThreadTs);
132680
132288
  const messageBlocks = [
132681
- ...renderedBlocks ?? [
132682
- {
132683
- type: "section",
132684
- text: {
132685
- type: "mrkdwn",
132686
- text: slackMessage
132687
- }
132688
- }
132689
- ]
132289
+ ...renderedBlocks ?? buildMrkdwnSectionBlocks(slackMessage)
132690
132290
  ];
132691
132291
  for (const group of taskCitationSourceGroups(blocks ? JSON.stringify(blocks) : message, citations)) {
132692
132292
  const caption = buildCaptionBlock(group.items, {
@@ -132759,7 +132359,7 @@ var registerSlackStartThreadTool = (server) => {
132759
132359
  description: "Post a new top-level message to a Slack channel and return its ts so the caller can thread replies under it. Pass the returned `ts` as `threadTs` on subsequent `slack-post` calls to keep replies in the same thread. Requires lead privileges.",
132760
132360
  annotations: { openWorldHint: true },
132761
132361
  inputSchema: object2({
132762
- channelId: string2().min(1).describe("The Slack channel ID to post to."),
132362
+ channelId: string2().min(1).describe("The Slack channel ID to post to. A user ID (U…/W…) opens the bot's DM with that user; use the returned channelId afterwards."),
132763
132363
  message: string2().min(1).max(4000).describe("The message content to post."),
132764
132364
  blocks: array2(record2(string2(), unknown())).max(50).optional().describe("Optional Block Kit blocks. When omitted, a mrkdwn section is generated.")
132765
132365
  }),
@@ -132768,7 +132368,7 @@ var registerSlackStartThreadTool = (server) => {
132768
132368
  ts: string2().optional(),
132769
132369
  messageTs: string2().optional()
132770
132370
  })
132771
- }, async ({ channelId, message, blocks }, requestInfo, _meta) => {
132371
+ }, async ({ channelId: requestedChannelId, message, blocks }, requestInfo, _meta) => {
132772
132372
  if (!requestInfo.agentId) {
132773
132373
  return toolErr("Agent ID not found.");
132774
132374
  }
@@ -132789,21 +132389,20 @@ var registerSlackStartThreadTool = (server) => {
132789
132389
  if (!app) {
132790
132390
  return toolErr("Slack not configured.");
132791
132391
  }
132392
+ let channelId;
132393
+ try {
132394
+ channelId = await resolveSlackConversationId(app.client, requestedChannelId);
132395
+ } catch (error) {
132396
+ const errorMsg = error instanceof Error ? error.message : String(error);
132397
+ return toolErr(`Failed to open a DM with ${requestedChannelId}: ${errorMsg}`);
132398
+ }
132792
132399
  const blockReason = await getChannelBlockReason2(app.client, channelId);
132793
132400
  if (blockReason) {
132794
132401
  return toolErr(externalChannelToolError2(channelId, blockReason));
132795
132402
  }
132796
132403
  try {
132797
132404
  const slackMessage = markdownToSlack(message);
132798
- const messageBlocks = blocks ?? [
132799
- {
132800
- type: "section",
132801
- text: {
132802
- type: "mrkdwn",
132803
- text: slackMessage
132804
- }
132805
- }
132806
- ];
132405
+ const messageBlocks = blocks ?? buildMrkdwnSectionBlocks(slackMessage);
132807
132406
  const result = await withAutoJoin(app.client, channelId, () => app.client.chat.postMessage({
132808
132407
  channel: channelId,
132809
132408
  text: slackMessage,
@@ -132893,15 +132492,7 @@ var registerSlackUpdateTool = (server) => {
132893
132492
  text: slackMessage,
132894
132493
  unfurl_links: false,
132895
132494
  unfurl_media: false,
132896
- blocks: [
132897
- {
132898
- type: "section",
132899
- text: {
132900
- type: "mrkdwn",
132901
- text: slackMessage
132902
- }
132903
- }
132904
- ]
132495
+ blocks: buildMrkdwnSectionBlocks(slackMessage)
132905
132496
  };
132906
132497
  const result = await app.client.chat.update(updatePayload);
132907
132498
  return toolOk("Message updated successfully.", { data: { messageTs: result.ts } });
@@ -136293,4 +135884,4 @@ async function createServer(opts = {}) {
136293
135884
  return server;
136294
135885
  }
136295
135886
 
136296
- export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, resolveIdentity, renderIdentity, createAdditiveBuffer, taskModelPin, resumedTaskModelSelection, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, isRuntimePoolWakeable, isAgentReachable, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, recoverIncompleteRuns, handleWebhookTrigger, verifyHmacSignature, WebhookError, snapshotAndUpdateWorkflow, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry2, initWorkflows2, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, hasKvViewArgs, resolveKvView, toolErr, createToolRegistrar, duplicateGuardedQueryKey, warnIfCorsAllowsAnyOrigin, isOriginAllowedForCredentials, allowedCredentialRedirect, setCorsHeaders, parseQueryParams, getPathSegments, wireHttpSpanLifecycle, safeRequestUrlForLog, agentWithCapacity, parseBody, BODY_TOO_LARGE, enforceContentLengthCap, json, jsonError, writeUnhandledError, triggerSchemaErrorResponse, deriveApiBaseUrl, httpServerSemconvAttributes, runtimeInstanceHeader, describeRequestRoute, route, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, stripSiblingBlock, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, AGENT_MAX_TASKS_CONFIG_KEY, reconcileAgentMaxTasksPolicy, resetAgentMaxTasksMirror, upsertSwarmConfigWithPolicyMirror, runtimeStaleThresholdMinutes, upsertRuntimeInstance, getRuntimeInstanceById, insertProvisioningRuntime, markRuntimeTerminated, touchRuntimeInstance, countActiveRuntimeInstancesForAgent, listRuntimeInstancesForAgent, setRuntimeCredentialReady, reconcileAgentStatusFromRuntimes, agentsWithLiveRuntime, expireStaleRuntimeInstances, listRuntimeInstancesForPool, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, getTelemetryIngestAnchor, initApiTelemetry, syncTelemetryEnabled, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, isChatSdkEnabled, getChatSdkConfig, errorMessage, resolveAdapterApiUrl, trackBackground, TelegramBotApiError, callTelegramBotApi, isTrustedTeamsServiceUrl, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, parseCookieHeader, extractAndVerifyCookie, issuePageSessionCookie, resolveHttpRequestAuth, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, userCtx, resolveTaskAuditUserId, resolveHttpAuditUserId, resolveHttpFavoriteOwner, handleApps, cancelApprovalRequest, cancelApprovalRequestAndRun, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, getPageEditCounter, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, inheritedModelSelection, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, reservedRoomKeyError, updateMcpServerChecked, updateTouchesStdioExecution, MemoryKeyError, refreshLinks, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, indexMemoryContent, isApiDraining, drainApi, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, changesAllowMerge, updateSwarmRepoChecked, getCombConfig, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, workflowModelErrors, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };
135887
+ export { DEFAULT_NEGOTIATED_PROTOCOL_VERSION, SUPPORTED_PROTOCOL_VERSIONS, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCErrorResponse, JSONRPCMessageSchema, isInitializeRequest, McpServer, isGitHubEnabled, initGitHub, verifyWebhookSignature, isAgentMailEnabled, initAgentMail, verifyAgentMailWebhook, resolveIdentity, renderIdentity, createAdditiveBuffer, taskModelPin, resumedTaskModelSelection, listHarnessModelSupport, recordHarnessModelSupport, agentRanModel, getAgentHarnessCliVersion, setAgentHarnessCliVersion, sanitizeModelTierOverrides, parseModelTierOverridesHeader, setAgentModelTierOverrides, previewModelTiers, recordClaimModelResolution, harnessModelErrorFor, poolTaskRunsOnHarness, explicitModelError, explicitModelErrorForAgent, referencedBundlePaths, skillDirs, TaskCreationBlockedError, recordUnmappedIdentity, MAX_TASK_ATTACHMENT_BYTES, recordTaskAttachmentUpload, buildEffectiveText, bufferedFileFailures, fetchSlackFiles, createSlackTaskWithFiles, notifySlackFileFailures, isRuntimePoolWakeable, isAgentReachable, hasOtherUserMention, broadcastMatches, routeMessage, extractTaskFromMessage, extractSlackMessageText, recoverIncompleteRuns, handleWebhookTrigger, verifyHmacSignature, WebhookError, snapshotAndUpdateWorkflow, RawLlmConfigSchema, RawLlmOutputSchema, executeRawLlm, getExecutorRegistry2, initWorkflows2, dispatchScheduleTarget, calculateNextRun2, startScheduler2, stopScheduler2, runScheduleNow2, ExtensionAssetConflictError, ExtensionOwnershipError, getExtensionFiles, getExtensionById, getExtensionByName, listExtensions, listExtensionVersions, updateExtensionMeta, listExtensionRuns, SDK_ALLOWLIST, mcpToolNameForSdkMethod, mcpOverflowAuthError, hasKvViewArgs, resolveKvView, toolErr, createToolRegistrar, handleMcpBridge, Redacted, SCRIPT_SDK_RESPONSE_LIMIT_BYTES, readScriptSdkJsonResponse, ExtensionConfigError, ExtensionLifecycleError, setExtensionLoopbackBaseUrl, enableExtension, disableExtension, activateVersion, ExtensionAssetsInvalidError, installExtensionWithAssets, uninstallExtension, reloadExtension, loadEnabledExtensions, stopExtensionRuntime, ExtensionAbortedError2, isRegistered2, isExtensionAgentId2, getExtensionBridgeToken2, resolveBridgeCallOrigin2, extensionIdForAgent2, runContext2, registerLoaded2, unregister2, listRegistered2, dispatchPre2, dispatchPost2, stripSiblingBlock, createTaskWithSiblingAwareness, isInboxAllowed, isSenderAllowed, handleMessageReceived, isAzureDevOpsEnabled, initAzureDevOps, verifyAzureDevOpsWebhook, repointTrackerSyncBySwarmId, isAzureDevOpsUrl, canonicalAzureDevOpsRepoUrl, parseAzureDevOpsRepoUrl, createdPullRequestOf, commentedPayloadOf, handlePullRequestCreated, handlePullRequestCommented, handleWorkItemCreated, handleWorkItemUpdated, handleWorkItemCommented, handleWorkItemDeleted, handleWorkItemRestored, initAzureDevOpsOutbound, AGENT_MAX_TASKS_CONFIG_KEY, reconcileAgentMaxTasksPolicy, resetAgentMaxTasksMirror, upsertSwarmConfigWithPolicyMirror, runtimeStaleThresholdMinutes, upsertRuntimeInstance, getRuntimeInstanceById, insertProvisioningRuntime, markRuntimeTerminated, touchRuntimeInstance, countActiveRuntimeInstancesForAgent, listRuntimeInstancesForAgent, setRuntimeCredentialReady, reconcileAgentStatusFromRuntimes, agentsWithLiveRuntime, expireStaleRuntimeInstances, listRuntimeInstancesForPool, enqueueAuditRow, enqueueAdmissionRow, flushAuditBuffer, startAuditWriter, stopAuditWriter, startAuditGc, stopAuditGc, getTelemetryIngestAnchor, initApiTelemetry, syncTelemetryEnabled, handlePullRequest, handleIssue, handleComment, handlePullRequestReview, handleCheckRun, handleCheckSuite, handleWorkflowRun, isGitLabEnabled, initGitLab, verifyGitLabWebhook, handleMergeRequest, handleIssue2, handleNote, handlePipeline, isChatSdkEnabled, getChatSdkConfig, errorMessage, resolveAdapterApiUrl, trackBackground, TelegramBotApiError, callTelegramBotApi, isTrustedTeamsServiceUrl, isChatSdkStopping, startChatSdk, getChatInstance, isChatAdapterConfigured, getChatSdkHealth, stopChatSdk, getJiraMetadata, updateJiraMetadata, clearJiraMetadata, registerJiraWebhook, deleteJiraWebhook, isJiraEnabled, initJira, handleJiraWebhook, handleAgentSessionEvent, handleIssueUpdate, handleIssueDelete, handleAgentSessionPrompted, isLinearEnabled, initLinear, parseCookieHeader, extractAndVerifyCookie, issuePageSessionCookie, resolveHttpRequestAuth, loadGlobalConfigsIntoEnv, reloadGlobalConfigsAndIntegrations, scheduleIntegrationsReload, handleCore, userCtx, handleApps, cancelApprovalRequest, cancelApprovalRequestAndRun, getUserCommsPrefs, getTaskDetailsInputSchema, getTaskDetailsOutputSchema, getTaskDetailsHandler, cancelTaskInputSchema, cancelTaskOutputSchema, cancelTaskHandler, executeReadOnlyQuery, assertSelectOnlyQuery, handleDbQuery, snapshotMetric, AssetKeyAuthorizationError, authorizeAssetKeyWrite, getPageEditCounter, snapshotPage, assertOAuthAppUrlsSafe, assertOAuthEgressUrlSafe, listOAuthPresets, listOAuthPresetIds, getOAuthPreset, hydrateOAuthAppFromPreset, scopedResourceScopeIdSchema, resolveScopedResourceId, dedupeMemoryDocumentIds, recordMemoryAccesses, recordRetrievals, ExplicitSelfDuplicateError, applyRating, shouldPersistAutomaticTaskMemory, REBOOT_RETRY_PIN_TAG, getPinCandidateAgent, resolveLeadOnlyRecoveryAssignment, getResumeGeneration, getNextResumeGeneration, inheritedModelSelection, createWorkerTaskFollowUp, createResumeFollowUp, createRerouteDecisionTask, createPoolStarvationDecisionTask, guardTerminalTaskResultWrite, getTasksInputSchema, getTasksOutputSchema, getTasksHandler, reservedNamespaceError, reservedRoomKeyError, updateMcpServerChecked, updateTouchesStdioExecution, MemoryKeyError, refreshLinks, canReadMemory, getLinksForMemory, expandCandidatesWithGraph, indexMemoryContent, isApiDraining, drainApi, markKapsoMessageRead, sendKapsoReaction, getKapsoConfig, getKapsoNumberMapping, markKapsoMessageSeen, changesAllowMerge, updateSwarmRepoChecked, getCombConfig, resolveRoomNamespace, roomRequestInfo, authorizeRoomNamespace, sessionAccessTopic, sessionPresenceRoot, RoomOperationSchema, removeAwarenessStates, roomTopic, decodeRoomSnapshot, roomView, getRoom, changeRoom, applyRoomUpdate, resetRoom, sweepRooms, closeRooms, removeNamespaceRooms, MEMORY_KEYS_DEFAULT_PREFIX, MEMORY_KEYS_MAX_LIMIT, estimateTokens, posteriorMean, listMemoryKeys, checkChunkIntegrity, getMemoryChunks, getPosteriorsByIds, createEvent, createEventsBatch, getEventCountsFiltered, getEventsFiltered, mergeScheduleTiming, validateRecurringTiming, checkOutputSchemaShape, sendTaskOutputSchema, sendTaskHandler, steerTaskUserInputSchema, steerTaskOutputSchema, steerTaskHandler, canClaim, emitBudgetRefusalSideEffects, workflowModelErrors, patchWorkflowDefinition, resolveScriptsOnlyMode, ALL_CAPABILITIES, hasCapability, getEnabledCapabilities, createServer };