@desplega.ai/agent-swarm 2.13.1 → 2.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/README.md +1 -1
  2. package/dist/acp-adapter-t2q6nsqv.js +17 -0
  3. package/dist/{acp-targets-n7vm5atw.js → acp-targets-k8xs4tj8.js} +7 -7
  4. package/dist/{actions-hq6wp9xv.js → actions-pg5fxjer.js} +25 -25
  5. package/dist/{agent-fs-provision-y0qc1rdd.js → agent-fs-provision-vbk3fppw.js} +4 -4
  6. package/dist/{amp-adapter-1qqs6h91.js → amp-adapter-adbhxsz9.js} +2 -2
  7. package/dist/{app-7m4z44rv.js → app-b267ggx1.js} +8 -8
  8. package/dist/{approval-notifications-8sr41gjx.js → approval-notifications-evc1a9z5.js} +9 -9
  9. package/dist/{assistant-hkczwfv6.js → assistant-wgz2ab84.js} +26 -26
  10. package/dist/{boot-args-schema-8025snev.js → boot-args-schema-6tpk28j4.js} +1 -1
  11. package/dist/{boot-reembed-15m87nr1.js → boot-reembed-ankp369c.js} +1 -1
  12. package/dist/{boot-reembed-4bbpxjh1.js → boot-reembed-r1zyvefv.js} +1 -1
  13. package/dist/{boot-scrub-sweep-eajr97e9.js → boot-scrub-sweep-cgb6r5bd.js} +2 -2
  14. package/dist/{boot-seeds-9cwy39jx.js → boot-seeds-bjceqg7b.js} +4 -4
  15. package/dist/{claude-adapter-g61wa4rt.js → claude-adapter-knztdnff.js} +9 -6
  16. package/dist/{claude-managed-adapter-znkk0prm.js → claude-managed-adapter-qwejzqkk.js} +3 -3
  17. package/dist/{claude-managed-setup-f1wndkr2.js → claude-managed-setup-0vgz4d1j.js} +4 -4
  18. package/dist/{claude-sdk-session-687xzf21.js → claude-sdk-session-c3g6dv0g.js} +11984 -11775
  19. package/dist/{cli-4mj5g29m.js → cli-0j4qmc80.js} +7 -7
  20. package/dist/{cli-fn8aj7gb.js → cli-1606qw3n.js} +98 -71
  21. package/dist/{cli-w41bvvms.js → cli-1gnf5c7x.js} +1 -1
  22. package/dist/{cli-aebswqmz.js → cli-1wew39p0.js} +15 -15
  23. package/dist/{cli-0fx95c06.js → cli-268b3dgn.js} +2 -2
  24. package/dist/cli-2ap1the6.js +11 -0
  25. package/dist/{cli-w6c6dj91.js → cli-4dyhzhpx.js} +1 -1
  26. package/dist/{cli-grcc2h2g.js → cli-55fqpd9q.js} +8 -8
  27. package/dist/{cli-p7g7wd9n.js → cli-61fzwtjk.js} +7 -7
  28. package/dist/{cli-zaate0rd.js → cli-61p7ty8d.js} +2 -2
  29. package/dist/{cli-cp0m07wb.js → cli-7fa6yv98.js} +2 -2
  30. package/dist/{cli-5v6b2am8.js → cli-7kv5d674.js} +7 -7
  31. package/dist/{cli-6r1dwegd.js → cli-80d5g0fa.js} +2 -2
  32. package/dist/{cli-0xwb7zpt.js → cli-88np9va3.js} +1 -1
  33. package/dist/{cli-1b5axkt1.js → cli-8m6gqnf1.js} +2 -2
  34. package/dist/{cli-0a336ze7.js → cli-8pnawt98.js} +3 -3
  35. package/dist/{cli-7ewre3dm.js → cli-8sayvj48.js} +2 -2
  36. package/dist/{cli-yeh3g1q6.js → cli-9gmkw6xn.js} +53 -32
  37. package/dist/{cli-h03j6je3.js → cli-a21cwm89.js} +2 -2
  38. package/dist/{cli-s6fhqbz1.js → cli-aytna2fm.js} +1 -1
  39. package/dist/{cli-84xtgbn6.js → cli-b0m3bg0f.js} +100 -2
  40. package/dist/{cli-mwxez0pz.js → cli-b768ek79.js} +1 -1
  41. package/dist/{cli-9xx36trj.js → cli-bh53ppqm.js} +2 -2
  42. package/dist/{cli-1carhg8g.js → cli-czeh7x13.js} +3 -3
  43. package/dist/{cli-cd9acnvd.js → cli-djwt4mtn.js} +71 -5
  44. package/dist/{cli-sfajkbd7.js → cli-dq30fq3q.js} +2 -2
  45. package/dist/{cli-a8ts6x1n.js → cli-dw43pnzp.js} +5 -5
  46. package/dist/{cli-h9bejmkf.js → cli-e4gx499y.js} +52 -29
  47. package/dist/{cli-t90k0phh.js → cli-ea367bdn.js} +32 -23
  48. package/dist/{cli-cmgdptmx.js → cli-ef590376.js} +29 -5
  49. package/dist/{cli-8rbkw18r.js → cli-fbmgpt72.js} +2 -2
  50. package/dist/{cli-tzzas8rb.js → cli-g4dhd3pr.js} +2 -2
  51. package/dist/{cli-snypfjgj.js → cli-gc715jrc.js} +1 -1
  52. package/dist/{cli-c0tyzt73.js → cli-gkjw33x5.js} +1 -1
  53. package/dist/{cli-z6m6xzxt.js → cli-grk77aen.js} +26 -5
  54. package/dist/{cli-hs3mqswp.js → cli-gxqwm3k3.js} +5 -5
  55. package/dist/{cli-4h90xaet.js → cli-h3drhntp.js} +1 -1
  56. package/dist/{cli-qn79645p.js → cli-h9d3sdnc.js} +1 -1
  57. package/dist/{cli-byxsctca.js → cli-hd2a204w.js} +6 -6
  58. package/dist/{cli-1dr5at77.js → cli-hhb8kbwd.js} +12 -12
  59. package/dist/{cli-zvpkrgsc.js → cli-hpxcfvdm.js} +3 -3
  60. package/dist/{cli-cqxwjb93.js → cli-hxj888w3.js} +1 -1
  61. package/dist/{cli-82j36f2m.js → cli-jjzxsk47.js} +9 -3
  62. package/dist/{cli-13t0smbk.js → cli-ka4tqjzd.js} +185 -58
  63. package/dist/{cli-jhtvt7gn.js → cli-kh973792.js} +3 -3
  64. package/dist/{cli-x5yb8zc8.js → cli-kwm1bek7.js} +1 -1
  65. package/dist/{cli-bjmq14k9.js → cli-mgr3gatr.js} +4 -4
  66. package/dist/{cli-c8kqmzzf.js → cli-nbawx3s0.js} +2 -2
  67. package/dist/{cli-04103ryh.js → cli-ppf9ap9n.js} +1 -1
  68. package/dist/{cli-dd57p1gd.js → cli-pzsedyb0.js} +4 -4
  69. package/dist/{cli-32xndx6b.js → cli-r6xnchva.js} +2 -2
  70. package/dist/{cli-4tbvndmm.js → cli-r8ddn0hf.js} +1 -1
  71. package/dist/{cli-y6qqbpwc.js → cli-snwz16eg.js} +1 -1
  72. package/dist/{cli-w24f3j49.js → cli-sy2ge2ye.js} +7 -6
  73. package/dist/{cli-3m8vqehw.js → cli-syqcny89.js} +3 -3
  74. package/dist/{cli-qx1dwrr5.js → cli-tjf1bh1v.js} +2 -2
  75. package/dist/{cli-xhkek467.js → cli-v1v49t36.js} +28 -2
  76. package/dist/{cli-cn6fpa1p.js → cli-v8rpjrnx.js} +1 -1
  77. package/dist/{cli-mmw2sjaf.js → cli-vgh5adn9.js} +5 -5
  78. package/dist/{cli-3zyme1wt.js → cli-w24741sm.js} +3 -3
  79. package/dist/{cli-gq6qhmrr.js → cli-wsnradtk.js} +3 -3
  80. package/dist/{cli-nk8swfpx.js → cli-wtffytm8.js} +3 -3
  81. package/dist/{cli-0m77n7ej.js → cli-xc8m5cjn.js} +54 -12
  82. package/dist/{cli-8cmjkbvj.js → cli-y0q92v4r.js} +2 -2
  83. package/dist/{cli-gedf48yw.js → cli-y754psdt.js} +4 -4
  84. package/dist/cli.js +19 -18
  85. package/dist/{codex-adapter-ysfg6ty3.js → codex-adapter-493vb8cv.js} +5 -5
  86. package/dist/{codex-hook-c0nvm30r.js → codex-hook-ej8hn6z5.js} +9 -2
  87. package/dist/{codex-session-runner-823scr6g.js → codex-session-runner-ps5m4z1g.js} +5 -5
  88. package/dist/{commands-5rbm07fz.js → commands-shktk0b8.js} +3 -3
  89. package/dist/{controllers-connect-34jzhfft.js → controllers-connect-yft057ws.js} +24 -24
  90. package/dist/core-nheayfgm.js +42 -0
  91. package/dist/{cursor-adapter-w1681kp1.js → cursor-adapter-8fpm4dng.js} +1 -1
  92. package/dist/{db-6bkgbfwk.js → db-0ezhdhz5.js} +3 -3
  93. package/dist/{db-hcj16x7z.js → db-84pz2w5c.js} +2 -2
  94. package/dist/{dispatcher-jgjqrfzv.js → dispatcher-h2rz69f6.js} +23 -23
  95. package/dist/{easter-egg-3d-w17nsny6.js → easter-egg-3d-m41ad78v.js} +1 -1
  96. package/dist/{embedding-space-v06fwy7b.js → embedding-space-yam9zwzj.js} +6 -6
  97. package/dist/{embeddings-g50dxea4.js → embeddings-g2be0y8q.js} +1 -1
  98. package/dist/{execute-1n36haw1.js → execute-hhdejgzf.js} +1 -1
  99. package/dist/{external-channel-43tv8pg6.js → external-channel-kjt2yzfj.js} +2 -2
  100. package/dist/fx-adapter-8g7xsp8q.js +20 -0
  101. package/dist/{grok-adapter-my5j8mdf.js → grok-adapter-ztk2zkz1.js} +9 -9
  102. package/dist/handlers-9ywssz71.js +41 -0
  103. package/dist/{heartbeat-sf3nk937.js → heartbeat-2e5jdexj.js} +25 -25
  104. package/dist/{hook-dqph1e05.js → hook-34s8cmgn.js} +9 -6
  105. package/dist/{hook-m1m9dm6w.js → hook-acg9saz7.js} +8 -5
  106. package/dist/{http-w0th1cz9.js → http-ra2zr2f8.js} +304 -111
  107. package/dist/{index-pb03vans.js → index-2z1z7qx6.js} +26 -26
  108. package/dist/{index-p2f5xg64.js → index-3j803vnb.js} +36259 -34299
  109. package/dist/index-6mgbdtv1.js +44 -0
  110. package/dist/{index-e8pz8qdg.js → index-7dgxveck.js} +2 -2
  111. package/dist/{index-gkpfgpg7.js → index-93bw5wds.js} +1 -1
  112. package/dist/{index-c0e8en64.js → index-9q42cr54.js} +1 -1
  113. package/dist/{index-ffba0z8q.js → index-9r4j0a60.js} +28 -18
  114. package/dist/index-hqdsn2t2.js +39 -0
  115. package/dist/{index-k8ajc0g0.js → index-maddg9ys.js} +1 -1
  116. package/dist/{index-y4vd4mhn.js → index-mbpxhc4w.js} +1 -1
  117. package/dist/index-rz8ve510.js +569 -0
  118. package/dist/index-st231bqv.js +40 -0
  119. package/dist/{index-ez823q84.js → index-ym9fgxad.js} +1 -1
  120. package/dist/{keepalive-2v06q2e8.js → keepalive-vjnnqbkm.js} +4 -4
  121. package/dist/lead-mk0xkth2.js +82 -0
  122. package/dist/{maintenance-vx7vjhhy.js → maintenance-px2g599e.js} +1 -1
  123. package/dist/{oauth-refresh-sweep-g06k4bza.js → oauth-refresh-sweep-nkykf09m.js} +3 -3
  124. package/dist/{object-webhooks-3dzdq4fm.js → object-webhooks-gt9xnq21.js} +7 -7
  125. package/dist/{onboard-232pazny.js → onboard-1f134p65.js} +3 -3
  126. package/dist/{opencode-adapter-t0paqbh8.js → opencode-adapter-94976yab.js} +6 -6
  127. package/dist/{otel-impl-kmpkyp4y.js → otel-impl-5d4p2fqs.js} +1 -1
  128. package/dist/{pending-x0z3vx1x.js → pending-vkk0vx6n.js} +24 -24
  129. package/dist/{pi-mono-adapter-7pmypn6d.js → pi-mono-adapter-cyzdv5er.js} +11 -11
  130. package/dist/{pricing-refresh-ytjmtyd7.js → pricing-refresh-jtmjwss9.js} +2 -2
  131. package/dist/{rbac-roles-xyaxekh3.js → rbac-roles-1fvmdyeb.js} +2 -2
  132. package/dist/{rbac-roles-fgm5mxr2.js → rbac-roles-yd1fgpsn.js} +3 -3
  133. package/dist/{render-v2-ws972g4r.js → render-v2-kb5s3vx4.js} +8 -8
  134. package/dist/{resume-m6mjzhkp.js → resume-z1vs44n5.js} +11 -11
  135. package/dist/{runtime-zzpc0c8a.js → runtime-gk6ct7r7.js} +1 -1
  136. package/dist/{session-access-vp35xs91.js → session-access-nz6nre4d.js} +5 -5
  137. package/dist/{session-source-backfill-p73e8zbe.js → session-source-backfill-wb60zjkd.js} +1 -1
  138. package/dist/{setup-r4kd7rxg.js → setup-2x8g8j4s.js} +1 -1
  139. package/dist/thread-buffer-d50rqpev.js +42 -0
  140. package/dist/{tree-visibility-07h2tbs2.js → tree-visibility-ts3z30kw.js} +2 -2
  141. package/dist/{user-merge-jobs-96vg9rpe.js → user-merge-jobs-zetg26e0.js} +3 -3
  142. package/dist/{virtual-modules-vgn3f2x4.js → virtual-modules-674fka8x.js} +3 -3
  143. package/dist/{work-objects-74hbcx3e.js → work-objects-w52yyjxm.js} +26 -26
  144. package/dist/worker-662x1vse.js +82 -0
  145. package/dist/{worker-follow-up-ezavwn5d.js → worker-follow-up-dyfxyjbj.js} +23 -23
  146. package/openapi.json +6 -2
  147. package/package.json +7 -6
  148. package/src/be/migrations/341_user_token_expiry.sql +4 -0
  149. package/src/be/scripts/run-credential.ts +55 -1
  150. package/src/be/scripts/typecheck.ts +4 -4
  151. package/src/be/scripts/user-code-mode.ts +160 -0
  152. package/src/be/users.ts +48 -7
  153. package/src/commands/onboard/agent-fs-version.ts +1 -1
  154. package/src/commands/runner.ts +62 -6
  155. package/src/hooks/codex-hook.ts +15 -4
  156. package/src/hooks/hook.ts +7 -0
  157. package/src/http/script-connection-proxy.ts +18 -6
  158. package/src/http/scripts.ts +2 -11
  159. package/src/http/session-cost-recompute.ts +3 -1
  160. package/src/http/session-data.ts +3 -0
  161. package/src/http/users.ts +1 -0
  162. package/src/integrations/chat-sdk/adapters.ts +29 -0
  163. package/src/integrations/chat-sdk/limits.ts +3 -0
  164. package/src/integrations/chat-sdk/rocketchat/README.md +8 -0
  165. package/src/integrations/chat-sdk/rocketchat/index.ts +790 -0
  166. package/src/integrations/chat-sdk/rocketchat/markdown.ts +210 -0
  167. package/src/integrations/chat-sdk/rocketchat/types.ts +249 -0
  168. package/src/integrations/chat-sdk/runtime.ts +11 -5
  169. package/src/integrations/chat-sdk/schema.ts +37 -3
  170. package/src/integrations/chat-sdk/status.ts +9 -0
  171. package/src/prompts/base-prompt.ts +1 -1
  172. package/src/prompts/session-templates.ts +1 -1
  173. package/src/providers/acp-targets.ts +2 -2
  174. package/src/providers/amp-adapter.ts +1 -1
  175. package/src/providers/claude-adapter.ts +21 -1
  176. package/src/providers/claude-sdk-session.ts +22 -3
  177. package/src/providers/claude-session-events.ts +76 -1
  178. package/src/providers/cursor-adapter.ts +1 -1
  179. package/src/providers/fx-adapter.ts +2 -2
  180. package/src/providers/pricing-sources.md +3 -0
  181. package/src/providers/types.ts +13 -0
  182. package/src/rbac/legacy-policy.ts +1 -0
  183. package/src/rbac/permissions.ts +4 -0
  184. package/src/scripts-runtime/executors/native.ts +225 -67
  185. package/src/scripts-runtime/mcp-client.ts +2 -1
  186. package/src/scripts-runtime/swarm-sdk.ts +2 -1
  187. package/src/scripts-runtime/types/stdlib.d.ts +4 -4
  188. package/src/scripts-runtime/types/swarm-sdk.d.ts +4 -4
  189. package/src/server-user.ts +98 -0
  190. package/src/slack/render-v2.ts +27 -7
  191. package/src/tests/base-prompt.test.ts +6 -2
  192. package/src/tests/chat-sdk-rocketchat-vendored.test.ts +67 -0
  193. package/src/tests/chat-sdk-status-route.test.ts +13 -1
  194. package/src/tests/claude-adapter.test.ts +115 -0
  195. package/src/tests/codex-app-server.test.ts +4 -6
  196. package/src/tests/fixtures/fx/acp-updates-recorded.jsonl +1 -1
  197. package/src/tests/internal-ai/complete-structured.test.ts +105 -0
  198. package/src/tests/internal-ai/credentials.test.ts +149 -0
  199. package/src/tests/internal-ai/task-title.test.ts +78 -0
  200. package/src/tests/mcp-input-caps.test.ts +16 -11
  201. package/src/tests/mcp-user-route.test.ts +10 -1
  202. package/src/tests/runner-slot-reconcile.test.ts +102 -0
  203. package/src/tests/script-connections-mcp.test.ts +14 -10
  204. package/src/tests/script-connections-sql.test.ts +6 -2
  205. package/src/tests/script-connections.test.ts +2 -0
  206. package/src/tests/slack-render-v2.test.ts +85 -0
  207. package/src/tools/script-common.ts +37 -22
  208. package/src/tools/script-query-types.ts +1 -1
  209. package/src/tools/script-run.ts +1 -1
  210. package/src/tools/script-search.ts +12 -10
  211. package/src/tools/utils.ts +7 -1
  212. package/src/types.ts +2 -1
  213. package/src/utils/internal-ai/complete-structured.ts +36 -5
  214. package/src/utils/internal-ai/credentials.ts +78 -2
  215. package/src/utils/internal-ai/models.ts +37 -1
  216. package/src/utils/internal-ai/task-title.ts +31 -1
  217. package/templates/skills/chat-sdk/content.md +2 -2
  218. package/templates/skills/swarm-docs/content.md +10 -0
  219. package/dist/acp-adapter-xtj40wd8.js +0 -17
  220. package/dist/core-kdehq26g.js +0 -42
  221. package/dist/fx-adapter-bvh05t4a.js +0 -20
  222. package/dist/handlers-wyymeeqh.js +0 -41
  223. package/dist/index-22khdtby.js +0 -44
  224. package/dist/index-np0582ac.js +0 -40
  225. package/dist/index-vgkrj1jt.js +0 -39
  226. package/dist/lead-55z813ng.js +0 -79
  227. package/dist/thread-buffer-cm2nzq6t.js +0 -42
  228. package/dist/worker-5pn2vzx6.js +0 -79
  229. /package/dist/{cli-m4ejz4nj.js → cli-cah298e5.js} +0 -0
@@ -1,6 +1,5 @@
1
- import {
2
- bedrockProviderModule
3
- } from "./cli-6p8p2e6r.js";
1
+ import"./cli-6p8p2e6r.js";
2
+ import"./cli-2ap1the6.js";
4
3
  import {
5
4
  auditAssetKeys,
6
5
  init_asset_key_audit,
@@ -557,7 +556,7 @@ import {
557
556
  countScriptRunJournalSteps2,
558
557
  countScriptRunJournalAgentTaskSteps2,
559
558
  init_db4
560
- } from "./cli-h9bejmkf.js";
559
+ } from "./cli-e4gx499y.js";
561
560
  import {
562
561
  PRIMARY_ROLE_NAMES2,
563
562
  OperatorGrantedTargetError2,
@@ -571,7 +570,7 @@ import {
571
570
  assertNotLastAdmin2,
572
571
  setUserRoles2,
573
572
  init_rbac_roles
574
- } from "./cli-qx1dwrr5.js";
573
+ } from "./cli-tjf1bh1v.js";
575
574
  import {
576
575
  MAX_MODEL_GROUP_MEMBERS,
577
576
  listModelGroups,
@@ -581,19 +580,19 @@ import {
581
580
  modelGroupReferences,
582
581
  deleteModelGroup,
583
582
  init_model_groups
584
- } from "./cli-8rbkw18r.js";
583
+ } from "./cli-fbmgpt72.js";
585
584
  import {
586
585
  requestModelCatalogRefresh2,
587
586
  init_pricing_refresh
588
- } from "./cli-4h90xaet.js";
587
+ } from "./cli-h3drhntp.js";
589
588
  import {
590
589
  workflowEventBus2,
591
590
  init_event_bus
592
591
  } from "./cli-vx9acp12.js";
593
- import"./cli-cqxwjb93.js";
594
- import"./cli-w6c6dj91.js";
592
+ import"./cli-hxj888w3.js";
593
+ import"./cli-4dyhzhpx.js";
595
594
  import"./cli-vr4eyq6p.js";
596
- import"./cli-4tbvndmm.js";
595
+ import"./cli-r8ddn0hf.js";
597
596
  import {
598
597
  require_dist4,
599
598
  getSlackConnectionState,
@@ -631,7 +630,7 @@ import {
631
630
  startSlackApp2,
632
631
  stopSlackApp2,
633
632
  init_app4
634
- } from "./cli-t90k0phh.js";
633
+ } from "./cli-ea367bdn.js";
635
634
  import {
636
635
  AGENT_MAX_TASKS_CONFIG_KEY,
637
636
  reconcileAgentMaxTasksPolicy,
@@ -660,12 +659,12 @@ import {
660
659
  dispatchApprovalNotifications2,
661
660
  createApprovalFollowUpTask2,
662
661
  init_approval_notifications
663
- } from "./cli-hs3mqswp.js";
662
+ } from "./cli-gxqwm3k3.js";
664
663
  import {
665
664
  retryFailedRun2,
666
665
  cancelWorkflowRun2,
667
666
  init_resume
668
- } from "./cli-zvpkrgsc.js";
667
+ } from "./cli-hpxcfvdm.js";
669
668
  import {
670
669
  safeParse,
671
670
  getObjectShape,
@@ -1030,6 +1029,10 @@ import {
1030
1029
  init_automatic_task_gate,
1031
1030
  guardTerminalTaskResultWrite,
1032
1031
  init_terminal_result_guard,
1032
+ scriptNameSchema,
1033
+ scriptToolOutputSchema,
1034
+ scriptsApiToolResult,
1035
+ init_script_common,
1033
1036
  getTasksInputSchema,
1034
1037
  getTasksOutputSchema,
1035
1038
  getTasksHandler,
@@ -1106,6 +1109,13 @@ import {
1106
1109
  validateRecurringTiming,
1107
1110
  changesScheduleTarget,
1108
1111
  init_validate,
1112
+ renderTypeBlobs,
1113
+ init_script_query_types,
1114
+ renderRunOutput,
1115
+ init_script_run,
1116
+ renderSearchResults,
1117
+ searchSuccessMessage,
1118
+ init_script_search,
1109
1119
  followUpThreadForSourceTask,
1110
1120
  evaluateFollowUpRedelegation,
1111
1121
  init_follow_up_redelegation_guard,
@@ -1157,7 +1167,7 @@ import {
1157
1167
  getEnabledCapabilities,
1158
1168
  createServer,
1159
1169
  init_server
1160
- } from "./cli-fn8aj7gb.js";
1170
+ } from "./cli-1606qw3n.js";
1161
1171
  import {
1162
1172
  getFileStorageProvider2,
1163
1173
  init_registry2
@@ -1183,7 +1193,7 @@ import {
1183
1193
  resolvePoolDelivery2,
1184
1194
  createPoolAgent2,
1185
1195
  init_db2
1186
- } from "./cli-0fx95c06.js";
1196
+ } from "./cli-268b3dgn.js";
1187
1197
  import {
1188
1198
  duplicateGuardedQueryKey,
1189
1199
  warnIfCorsAllowsAnyOrigin,
@@ -1234,7 +1244,7 @@ import {
1234
1244
  describeRequestRoute,
1235
1245
  route,
1236
1246
  init_route_def
1237
- } from "./cli-a8ts6x1n.js";
1247
+ } from "./cli-dw43pnzp.js";
1238
1248
  import {
1239
1249
  startPoolRouting,
1240
1250
  stopPoolRouting,
@@ -1247,17 +1257,17 @@ import {
1247
1257
  checkHeartbeatChecklist2,
1248
1258
  runHeartbeatSweep2,
1249
1259
  stopHeartbeat2
1250
- } from "./cli-aebswqmz.js";
1260
+ } from "./cli-1wew39p0.js";
1251
1261
  import"./cli-50whymxq.js";
1252
1262
  import {
1253
1263
  runtimeSupervisorStatus,
1254
1264
  startRuntimeSupervisor,
1255
1265
  stopRuntimeSupervisor
1256
- } from "./cli-byxsctca.js";
1266
+ } from "./cli-hd2a204w.js";
1257
1267
  import {
1258
1268
  TASK_TITLE_TIMEOUT_MS,
1259
1269
  generateTaskTitle
1260
- } from "./cli-cmgdptmx.js";
1270
+ } from "./cli-ef590376.js";
1261
1271
  import"./cli-ns59dc6r.js";
1262
1272
  import {
1263
1273
  ACP_TARGET_IDS
@@ -1279,7 +1289,7 @@ import {
1279
1289
  isUnknownModelError,
1280
1290
  checkProviderPoolKey,
1281
1291
  writeSkillsToFilesystem
1282
- } from "./cli-tzzas8rb.js";
1292
+ } from "./cli-g4dhd3pr.js";
1283
1293
  import {
1284
1294
  AgentFsRequestError2,
1285
1295
  resolveAgentFsSharedContext2,
@@ -1290,16 +1300,16 @@ import {
1290
1300
  agentFsRequest2,
1291
1301
  resolveApiUrl2,
1292
1302
  init_agent_fs_provision
1293
- } from "./cli-h03j6je3.js";
1303
+ } from "./cli-a21cwm89.js";
1294
1304
  import {
1295
1305
  Anthropic
1296
- } from "./cli-m4ejz4nj.js";
1306
+ } from "./cli-cah298e5.js";
1297
1307
  import {
1298
1308
  objectWebhookSecret2,
1299
1309
  handleObjectWebhookEvent2,
1300
1310
  init_object_webhooks
1301
- } from "./cli-0a336ze7.js";
1302
- import"./cli-1carhg8g.js";
1311
+ } from "./cli-8pnawt98.js";
1312
+ import"./cli-czeh7x13.js";
1303
1313
  import {
1304
1314
  createUserMergeJob2,
1305
1315
  getUserMergeJob2,
@@ -1308,7 +1318,7 @@ import {
1308
1318
  findFailedUserMergeJob2,
1309
1319
  requeueUserMergeJob2,
1310
1320
  runUserMergeJobs2
1311
- } from "./cli-6r1dwegd.js";
1321
+ } from "./cli-80d5g0fa.js";
1312
1322
  import {
1313
1323
  isCodexOAuthConfigKey
1314
1324
  } from "./cli-j4bwnpkm.js";
@@ -1319,7 +1329,7 @@ import {
1319
1329
  import {
1320
1330
  runTaskUiAction,
1321
1331
  init_actions
1322
- } from "./cli-jhtvt7gn.js";
1332
+ } from "./cli-kh973792.js";
1323
1333
  import {
1324
1334
  RATING_MODEL_MAX_LENGTH,
1325
1335
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -1390,6 +1400,7 @@ import {
1390
1400
  checkImportAllowlist,
1391
1401
  init_import_allowlist,
1392
1402
  runScriptWithRunCredential,
1403
+ runScriptAsUserWithRunCredential,
1393
1404
  init_run_credential,
1394
1405
  extractScriptSignature,
1395
1406
  init_extract_signature,
@@ -1414,7 +1425,7 @@ import {
1414
1425
  init_typecheck,
1415
1426
  parseSkillContent,
1416
1427
  init_skill_parser
1417
- } from "./cli-13t0smbk.js";
1428
+ } from "./cli-ka4tqjzd.js";
1418
1429
  import {
1419
1430
  signalProcessGroup,
1420
1431
  detachedProcessGroup,
@@ -1431,17 +1442,17 @@ import {
1431
1442
  forceRefreshAuthorizationOrThrow,
1432
1443
  forceRefreshTokenOrThrow,
1433
1444
  init_ensure_token
1434
- } from "./cli-7ewre3dm.js";
1445
+ } from "./cli-8sayvj48.js";
1435
1446
  import {
1436
1447
  PRIMITIVE_KINDS,
1437
1448
  ObjectsError,
1438
1449
  recordObjectVersion,
1439
1450
  init_objects
1440
- } from "./cli-3zyme1wt.js";
1451
+ } from "./cli-w24741sm.js";
1441
1452
  import {
1442
1453
  agentFsClientFor,
1443
1454
  init_agent_fs_identity
1444
- } from "./cli-y6qqbpwc.js";
1455
+ } from "./cli-snwz16eg.js";
1445
1456
  import {
1446
1457
  FilesError,
1447
1458
  normalizeFilesError,
@@ -1450,7 +1461,7 @@ import {
1450
1461
  AgentFsProvider,
1451
1462
  init_agent_fs_provider
1452
1463
  } from "./cli-skd2c4ej.js";
1453
- import"./cli-cn6fpa1p.js";
1464
+ import"./cli-v8rpjrnx.js";
1454
1465
  import {
1455
1466
  automationIntegrationFixUrl,
1456
1467
  preflightAutomation,
@@ -1472,7 +1483,7 @@ import {
1472
1483
  definitionNodeIds,
1473
1484
  validateDefinition,
1474
1485
  init_definition2
1475
- } from "./cli-1dr5at77.js";
1486
+ } from "./cli-hhb8kbwd.js";
1476
1487
  import {
1477
1488
  _fetchHolder,
1478
1489
  CLIENT_ID,
@@ -1504,7 +1515,7 @@ import {
1504
1515
  import {
1505
1516
  require_content_type
1506
1517
  } from "./cli-1jx0srjt.js";
1507
- import"./cli-84xtgbn6.js";
1518
+ import"./cli-b0m3bg0f.js";
1508
1519
  import {
1509
1520
  hasSessionAccess,
1510
1521
  getSessionRoot,
@@ -1514,7 +1525,7 @@ import {
1514
1525
  toSessionSharesState,
1515
1526
  setSessionShares,
1516
1527
  init_session_shares
1517
- } from "./cli-w41bvvms.js";
1528
+ } from "./cli-1gnf5c7x.js";
1518
1529
  import {
1519
1530
  isInvalidClientError,
1520
1531
  publicEndpointSsrfOptions,
@@ -1532,12 +1543,8 @@ import {
1532
1543
  revokeMcpToken,
1533
1544
  computeExpiresAt,
1534
1545
  init_mcp_wrapper
1535
- } from "./cli-c0tyzt73.js";
1546
+ } from "./cli-gkjw33x5.js";
1536
1547
  import"./cli-v41kn3cd.js";
1537
- import {
1538
- setBedrockProviderModule,
1539
- init_bedrock_converse_stream_lazy
1540
- } from "./cli-k3facve0.js";
1541
1548
  import {
1542
1549
  import_websocket,
1543
1550
  import_websocket_server,
@@ -1572,7 +1579,7 @@ import {
1572
1579
  revokeAllAgentSessionTokens,
1573
1580
  fingerprintApiKey,
1574
1581
  init_users
1575
- } from "./cli-z6m6xzxt.js";
1582
+ } from "./cli-grk77aen.js";
1576
1583
  import {
1577
1584
  CORE_TOOLS,
1578
1585
  init_tool_config
@@ -1600,7 +1607,7 @@ import {
1600
1607
  IDENTITY_FIELD_BUDGETS,
1601
1608
  IdentityFieldBudgetError,
1602
1609
  init_identity_field_budget
1603
- } from "./cli-s6fhqbz1.js";
1610
+ } from "./cli-aytna2fm.js";
1604
1611
  import {
1605
1612
  getSlackConfiguration,
1606
1613
  init_config4
@@ -1629,10 +1636,6 @@ import {
1629
1636
  selectCredential,
1630
1637
  init_credentials2
1631
1638
  } from "./cli-5basv0e7.js";
1632
- import {
1633
- getOpenRouterAttributionHeaders,
1634
- init_openrouter_base_url
1635
- } from "./cli-dfyv0jdy.js";
1636
1639
  import {
1637
1640
  interpolate,
1638
1641
  init_template2,
@@ -1642,7 +1645,11 @@ import {
1642
1645
  resolveTemplate,
1643
1646
  init_resolver,
1644
1647
  init_session_templates
1645
- } from "./cli-mwxez0pz.js";
1648
+ } from "./cli-b768ek79.js";
1649
+ import {
1650
+ getOpenRouterAttributionHeaders,
1651
+ init_openrouter_base_url
1652
+ } from "./cli-dfyv0jdy.js";
1646
1653
  import {
1647
1654
  ASSET_KEY_MAX_LENGTH,
1648
1655
  AssetKeyError,
@@ -1870,7 +1877,7 @@ import {
1870
1877
  import {
1871
1878
  init_package,
1872
1879
  package_default
1873
- } from "./cli-w24f3j49.js";
1880
+ } from "./cli-sy2ge2ye.js";
1874
1881
  import {
1875
1882
  realtimeBus,
1876
1883
  init_bus
@@ -1933,10 +1940,6 @@ function installConsoleScrub() {
1933
1940
  // src/utils/console-scrub-install.ts
1934
1941
  installConsoleScrub();
1935
1942
 
1936
- // src/utils/internal-ai/register-bedrock.ts
1937
- init_bedrock_converse_stream_lazy();
1938
- setBedrockProviderModule(bedrockProviderModule);
1939
-
1940
1943
  // src/http/index.ts
1941
1944
  init_server();
1942
1945
  init_agentmail();
@@ -12367,6 +12370,7 @@ var DEFAULT_MODES = {
12367
12370
  telegram: "webhook",
12368
12371
  slack: "webhook"
12369
12372
  };
12373
+ var ROCKETCHAT_NO_INSTANCE_URL = 'No instance URL. Set CHAT_SDK_API_URL_OVERRIDES to {"rocketchat":"https://chat.example.com"} in the deployment environment and restart the API.';
12370
12374
  var NOT_RUNNING = "The adapter is starting, or the last configuration save is still applying. Refresh in a few seconds.";
12371
12375
  var SLACK_CLASH_CAUSE = "the Slack adapter conflicts with the built-in Slack integration (set SLACK_DISABLE=true)";
12372
12376
  var MAX_STATUS_ERROR_CHARS = 300;
@@ -12438,6 +12442,9 @@ async function getChatSdkStatus() {
12438
12442
  } else if (config.enabled && configured) {
12439
12443
  error = blockedCause ? `Not started: ${blockedCause}` : NOT_RUNNING;
12440
12444
  }
12445
+ if (name === "rocketchat" && configured && enabled && resolveAdapterApiUrl(name) === "") {
12446
+ error = ROCKETCHAT_NO_INSTANCE_URL;
12447
+ }
12441
12448
  return {
12442
12449
  name,
12443
12450
  configured,
@@ -24791,11 +24798,148 @@ function registerUserEvents(server, user, tokenId, authorize) {
24791
24798
  // src/server-user.ts
24792
24799
  init_rbac_audit();
24793
24800
  init_rbac_roles();
24801
+
24802
+ // src/be/scripts/user-code-mode.ts
24803
+ init_registry();
24804
+ init_secret_scrubber();
24805
+ init_db4();
24806
+ init_db3();
24807
+ init_embeddings();
24808
+ init_run_credential();
24809
+
24810
+ // src/be/scripts/source-secrets.ts
24811
+ init_secret_scrubber();
24812
+ function refuseSourceWithSecrets(source) {
24813
+ const { knownValues, gitleaksRules } = findSecretsIn(source);
24814
+ if (knownValues.length === 0 && gitleaksRules.length === 0)
24815
+ return null;
24816
+ const findings = [
24817
+ ...knownValues.map((id) => ({ kind: "registered-secret", id })),
24818
+ ...gitleaksRules.map((id) => ({ kind: "gitleaks-rule", id }))
24819
+ ];
24820
+ const named = findings.map((f) => f.kind === "registered-secret" ? `registered secret ${f.id}` : `gitleaks rule ${f.id}`).join(", ");
24821
+ return {
24822
+ error: "source_contains_secret",
24823
+ message: `Script source contains a secret (${named}); nothing was saved or run. Source is stored and shown verbatim, so read secrets at run time instead: a credential binding (ctx.api.<slug> / ctx.mcp.<slug>) or ctx.swarm.config.get("<KEY>").`,
24824
+ findings
24825
+ };
24826
+ }
24827
+
24828
+ // src/be/scripts/user-code-mode.ts
24829
+ init_typecheck();
24830
+ var USER_SCRIPT_RUN_AGENT_ID = "user-mcp";
24831
+ function toScriptSearchResults(matches) {
24832
+ return matches.map(({ script, score }) => ({
24833
+ name: script.name,
24834
+ signature: JSON.parse(script.signatureJson),
24835
+ argsJsonSchema: script.argsJsonSchema ? JSON.parse(script.argsJsonSchema) : null,
24836
+ description: script.description,
24837
+ score
24838
+ }));
24839
+ }
24840
+ async function searchScriptsForUser(args) {
24841
+ const matches = await searchScripts2({ query: args.query, scope: "global", limit: args.limit });
24842
+ return { status: 200, body: { results: toScriptSearchResults(matches) } };
24843
+ }
24844
+ var EMPTY_API_TYPES = `export interface ScriptApiRegistry {}
24845
+ `;
24846
+ var EMPTY_MCP_TYPES = `export interface ScriptMcpRegistry {}
24847
+ `;
24848
+ async function scriptTypesForUser(name) {
24849
+ let script = null;
24850
+ if (name) {
24851
+ script = await getScript({ name, scope: "global" });
24852
+ if (!script)
24853
+ return { status: 404, body: { error: "Script not found" } };
24854
+ }
24855
+ const stdlibTypes = await scriptStdlibTypesWithGeneratedApis(EMPTY_API_TYPES, EMPTY_MCP_TYPES, "");
24856
+ if (!script)
24857
+ return { status: 200, body: { stdlibTypes } };
24858
+ return {
24859
+ status: 200,
24860
+ body: {
24861
+ signature: JSON.parse(script.signatureJson),
24862
+ argsJsonSchema: script.argsJsonSchema ? JSON.parse(script.argsJsonSchema) : null,
24863
+ stdlibTypes
24864
+ }
24865
+ };
24866
+ }
24867
+ async function runScriptForUser(args) {
24868
+ if (!args.name === !args.source) {
24869
+ return { status: 400, body: { error: "Pass exactly one of name or source" } };
24870
+ }
24871
+ let source = args.source;
24872
+ let fsMode = "none";
24873
+ let executor = null;
24874
+ if (args.name) {
24875
+ const script = await getScript({ name: args.name, scope: "global" });
24876
+ if (!script)
24877
+ return { status: 404, body: { error: "Script not found" } };
24878
+ ({ source, fsMode, executor } = script);
24879
+ } else {
24880
+ const refusal = refuseSourceWithSecrets(source);
24881
+ if (refusal)
24882
+ return { status: 400, body: refusal };
24883
+ }
24884
+ if (fsMode === "workspace-rw") {
24885
+ return { status: 501, body: { error: "workspace-rw scripts are not supported in v1" } };
24886
+ }
24887
+ if (executor && !isExecutorAllowedByDeployment(executor)) {
24888
+ return {
24889
+ status: 400,
24890
+ body: {
24891
+ error: 'Executor "native" is not permitted when deployment SCRIPT_EXECUTOR="quickjs"'
24892
+ }
24893
+ };
24894
+ }
24895
+ const startedAt = new Date().toISOString();
24896
+ const output = await runScriptAsUserWithRunCredential({ source, args: args.args, fsMode, executor }, args.userId);
24897
+ const ok = output.exitCode === 0 && !output.error && !output.runtimeError;
24898
+ try {
24899
+ await recordInlineScriptRun2({
24900
+ id: crypto.randomUUID(),
24901
+ agentId: USER_SCRIPT_RUN_AGENT_ID,
24902
+ requestedByUserId: args.userId,
24903
+ createdBy: args.userId,
24904
+ source,
24905
+ args: scrubObject(args.args ?? null),
24906
+ scriptName: args.name ?? "(inline source)",
24907
+ status: ok ? "completed" : "failed",
24908
+ output: scrubObject(output.result),
24909
+ error: ok ? undefined : scrubSecrets([
24910
+ output.error,
24911
+ output.stderr || undefined,
24912
+ output.runtimeError ? `${output.runtimeError.name}: ${output.runtimeError.message}` : undefined
24913
+ ].filter(Boolean).join(" — ") || `Script exited with code ${output.exitCode}`),
24914
+ startedAt,
24915
+ finishedAt: new Date().toISOString()
24916
+ });
24917
+ } catch {}
24918
+ return {
24919
+ status: 200,
24920
+ body: scrubObject({
24921
+ result: output.result,
24922
+ truncated: output.truncated,
24923
+ durationMs: output.durationMs,
24924
+ stdout: output.stdout,
24925
+ stderr: output.stderr,
24926
+ exitCode: output.exitCode,
24927
+ error: output.error,
24928
+ runtimeError: output.runtimeError
24929
+ })
24930
+ };
24931
+ }
24932
+
24933
+ // src/server-user.ts
24794
24934
  init_mcp_limits();
24795
24935
  init_rbac();
24796
24936
  init_cancel_task();
24797
24937
  init_get_task_details();
24798
24938
  init_get_tasks();
24939
+ init_script_common();
24940
+ init_script_query_types();
24941
+ init_script_run();
24942
+ init_script_search();
24799
24943
  init_send_task();
24800
24944
  init_steer_task();
24801
24945
  init_task_tool_ctx();
@@ -24811,6 +24955,11 @@ var userSendTaskInputSchema = object2({
24811
24955
  modelTier: ModelTierSchema.optional().describe("Portable model tier: 'smol', 'regular', 'smart', or 'ultra'. Resolved by the assignee's harness/provider."),
24812
24956
  outputSchema: record2(string2(), unknown()).optional().describe("Optional JSON Schema the assignee's final output must satisfy. store-progress rejects a completion that does not match. Supported keywords: type, required, properties, enum, const, items. An empty object {} means no schema.")
24813
24957
  }).superRefine((data, ctx) => checkOutputSchemaShape(data.outputSchema, ctx));
24958
+ var USER_CODE_MODE_SCOPE = "Runs as you: the script's swarm calls carry your permissions, no agent's credentials or connections, and no task is created. Only global scripts are visible.";
24959
+ function codeModeResult(response, rendering) {
24960
+ const ok = response.status >= 200 && response.status < 300;
24961
+ return scriptsApiToolResult(response.body, { ok, status: response.status }, rendering);
24962
+ }
24814
24963
  function permission(verb) {
24815
24964
  return { permission: verb };
24816
24965
  }
@@ -24915,6 +25064,68 @@ function createUserServer(user, tokenId) {
24915
25064
  return denied;
24916
25065
  return cancelTaskHandler(userCtx(user, info.sessionId), args);
24917
25066
  });
25067
+ const scriptSearchConfig = {
25068
+ title: "Script Search",
25069
+ description: `Search the swarm's reusable TypeScript scripts by intent. ${USER_CODE_MODE_SCOPE}`,
25070
+ annotations: { readOnlyHint: true, openWorldHint: false },
25071
+ rbac: permission("script.search"),
25072
+ inputSchema: object2({
25073
+ query: string2().default("").describe("What the script should do."),
25074
+ limit: number2().int().min(1).max(100).default(10).describe("Maximum results.")
25075
+ }),
25076
+ outputSchema: scriptToolOutputSchema
25077
+ };
25078
+ registerTool("script-search", scriptSearchConfig, async (args) => {
25079
+ const denied = await maybeDenyUserToolAdmission(user, "script-search", scriptSearchConfig);
25080
+ if (denied)
25081
+ return denied;
25082
+ return codeModeResult(await searchScriptsForUser(args), {
25083
+ successMessage: searchSuccessMessage,
25084
+ successDetails: renderSearchResults
25085
+ });
25086
+ });
25087
+ const scriptGetTypesConfig = {
25088
+ title: "Script Get Types",
25089
+ description: `Get the TypeScript declarations a script is written against: the \`swarm-sdk\` module (\`ScriptContext\`, \`ctx.swarm\`) and the \`stdlib\` module, about 12k tokens. Pass \`name\` to also get that script's signature and args schema. ${USER_CODE_MODE_SCOPE}`,
25090
+ annotations: { readOnlyHint: true, openWorldHint: false },
25091
+ inputSchema: object2({
25092
+ name: scriptNameSchema.optional().describe("Optional global script name.")
25093
+ }),
25094
+ outputSchema: scriptToolOutputSchema
25095
+ };
25096
+ registerTool("script-get-types", scriptGetTypesConfig, async ({ name }) => {
25097
+ const denied = await maybeDenyUserToolAdmission(user, "script-get-types", scriptGetTypesConfig);
25098
+ if (denied)
25099
+ return denied;
25100
+ const response = await scriptTypesForUser(name);
25101
+ const { stdlibTypes: _types, ...small } = response.body;
25102
+ return codeModeResult({ status: response.status, body: small }, {
25103
+ successMessage: () => name ? `Type definitions for script \`${name}\` fetched.` : "Script type definitions fetched.",
25104
+ successDetails: () => renderTypeBlobs(response.body),
25105
+ uncappedDetails: true
25106
+ });
25107
+ });
25108
+ const scriptRunConfig = {
25109
+ title: "Script Run",
25110
+ description: `Run a global script by \`name\`, or inline TypeScript \`source\` that does \`export default async function (args, ctx)\`. Inline source is not typechecked or saved. ${USER_CODE_MODE_SCOPE}`,
25111
+ annotations: { openWorldHint: true },
25112
+ rbac: permission("script.run"),
25113
+ inputSchema: object2({
25114
+ name: scriptNameSchema.optional().describe("Global script to run."),
25115
+ source: string2().min(1).optional().describe("Inline TypeScript source to run."),
25116
+ args: unknown().optional().describe("JSON-serializable script arguments.")
25117
+ }),
25118
+ outputSchema: scriptToolOutputSchema
25119
+ };
25120
+ registerTool("script-run", scriptRunConfig, async (args) => {
25121
+ const denied = await maybeDenyUserToolAdmission(user, "script-run", scriptRunConfig);
25122
+ if (denied)
25123
+ return denied;
25124
+ return codeModeResult(await runScriptForUser({ userId: user.id, ...args }), {
25125
+ successMessage: () => "Script run completed.",
25126
+ successDetails: renderRunOutput
25127
+ });
25128
+ });
24918
25129
  if (isSteeringEnabled2()) {
24919
25130
  const steerTaskConfig = {
24920
25131
  title: "Steer Task",
@@ -41389,13 +41600,19 @@ var sqlQueryRoute = route({
41389
41600
  404: { description: "Script connection or agent not found" }
41390
41601
  }
41391
41602
  });
41392
- function connectionScopeMatches(connection, agentId, syntheticPrincipal) {
41603
+ function connectionScopeMatches(connection, agentId, syntheticPrincipal, principal) {
41393
41604
  if (connection.scope === "global")
41394
41605
  return true;
41395
41606
  if (connection.scope === "agent")
41396
41607
  return !syntheticPrincipal && connection.scopeId === agentId;
41397
- if (connection.scope === "repo")
41398
- return true;
41608
+ if (connection.scope === "repo") {
41609
+ return !syntheticPrincipal && can({
41610
+ principal,
41611
+ verb: "config.read.secrets",
41612
+ resource: { kind: "none" },
41613
+ source: "http"
41614
+ }).allow;
41615
+ }
41399
41616
  return false;
41400
41617
  }
41401
41618
  function isSyntheticScriptPrincipal(agentId) {
@@ -41418,8 +41635,9 @@ async function handleScriptConnectionProxy(req, res, pathSegments, queryParams,
41418
41635
  jsonError(res, "Agent not found", 404);
41419
41636
  return true;
41420
41637
  }
41638
+ const principal = { kind: "agent", agentId, isLead: agent?.isLead ?? false };
41421
41639
  const decision = can({
41422
- principal: { kind: "agent", agentId, isLead: agent?.isLead ?? false },
41640
+ principal,
41423
41641
  verb: "script-connection.invoke",
41424
41642
  resource: { kind: "none" },
41425
41643
  source: "http"
@@ -41441,7 +41659,7 @@ async function handleScriptConnectionProxy(req, res, pathSegments, queryParams,
41441
41659
  jsonError(res, `Script connection is not ${isSql ? "a SQL" : "an MCP"} connection`, 400);
41442
41660
  return true;
41443
41661
  }
41444
- if (!connectionScopeMatches(connection, agentId, syntheticPrincipal)) {
41662
+ if (!connectionScopeMatches(connection, agentId, syntheticPrincipal, principal)) {
41445
41663
  jsonError(res, "Script connection is not available to this agent", 403);
41446
41664
  return true;
41447
41665
  }
@@ -43375,26 +43593,6 @@ async function handleScriptConnections(req, res, pathSegments, queryParams, agen
43375
43593
  init_zod();
43376
43594
  init_db4();
43377
43595
  init_model_validation2();
43378
-
43379
- // src/be/scripts/source-secrets.ts
43380
- init_secret_scrubber();
43381
- function refuseSourceWithSecrets(source) {
43382
- const { knownValues, gitleaksRules } = findSecretsIn(source);
43383
- if (knownValues.length === 0 && gitleaksRules.length === 0)
43384
- return null;
43385
- const findings = [
43386
- ...knownValues.map((id) => ({ kind: "registered-secret", id })),
43387
- ...gitleaksRules.map((id) => ({ kind: "gitleaks-rule", id }))
43388
- ];
43389
- const named = findings.map((f) => f.kind === "registered-secret" ? `registered secret ${f.id}` : `gitleaks rule ${f.id}`).join(", ");
43390
- return {
43391
- error: "source_contains_secret",
43392
- message: `Script source contains a secret (${named}); nothing was saved or run. Source is stored and shown verbatim, so read secrets at run time instead: a credential binding (ctx.api.<slug> / ctx.mcp.<slug>) or ctx.swarm.config.get("<KEY>").`,
43393
- findings
43394
- };
43395
- }
43396
-
43397
- // src/http/script-runs.ts
43398
43596
  init_rbac();
43399
43597
 
43400
43598
  // src/script-workflows/label-lint.ts
@@ -44167,9 +44365,9 @@ init_request_auth_context();
44167
44365
  init_secret_scrubber();
44168
44366
  init_route_def();
44169
44367
  init_utils2();
44170
- var scriptNameSchema = string2().min(1).max(200);
44368
+ var scriptNameSchema2 = string2().min(1).max(200);
44171
44369
  var upsertBodySchema = object2({
44172
- name: scriptNameSchema,
44370
+ name: scriptNameSchema2,
44173
44371
  source: string2().min(1),
44174
44372
  description: string2().default(""),
44175
44373
  intent: string2().default(""),
@@ -44178,7 +44376,7 @@ var upsertBodySchema = object2({
44178
44376
  executor: ScriptExecutorNameSchema.nullable().optional()
44179
44377
  });
44180
44378
  var runBodySchema = object2({
44181
- name: scriptNameSchema.optional(),
44379
+ name: scriptNameSchema2.optional(),
44182
44380
  source: string2().min(1).optional(),
44183
44381
  args: unknown().optional(),
44184
44382
  intent: string2().default(""),
@@ -44194,7 +44392,7 @@ var searchBodySchema = object2({
44194
44392
  scope: ScriptScopeSchema.optional(),
44195
44393
  limit: number2().int().min(1).max(100).default(10)
44196
44394
  });
44197
- var nameParamsSchema = object2({ name: scriptNameSchema });
44395
+ var nameParamsSchema = object2({ name: scriptNameSchema2 });
44198
44396
  var scopeQuerySchema = object2({ scope: ScriptScopeSchema.default("agent") });
44199
44397
  var optionalScopeQuerySchema = object2({ scope: ScriptScopeSchema.optional() });
44200
44398
  var idParamsSchema4 = object2({ id: string2().uuid() });
@@ -44838,15 +45036,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
44838
45036
  scopeId: agent.id,
44839
45037
  limit: parsed.body.limit
44840
45038
  });
44841
- searchRoute.respond(res, 200, {
44842
- results: matches.map(({ script, score }) => ({
44843
- name: script.name,
44844
- signature: JSON.parse(script.signatureJson),
44845
- argsJsonSchema: script.argsJsonSchema ? JSON.parse(script.argsJsonSchema) : null,
44846
- description: script.description,
44847
- score
44848
- }))
44849
- });
45039
+ searchRoute.respond(res, 200, { results: toScriptSearchResults(matches) });
44850
45040
  return true;
44851
45041
  }
44852
45042
  if (listScriptsRoute.match(req.method, pathSegments)) {
@@ -45227,6 +45417,7 @@ var createSessionCostRoute = route({
45227
45417
  harness: ProviderNameSchema.nullable().optional(),
45228
45418
  totalCostUsd: number2(),
45229
45419
  harnessCostBilled: boolean().optional(),
45420
+ estimated: boolean().optional(),
45230
45421
  taskId: string2().optional(),
45231
45422
  inputTokens: number2().int().nonnegative().optional(),
45232
45423
  outputTokens: number2().int().nonnegative().optional(),
@@ -45402,6 +45593,7 @@ async function handleSessionData(req, res, pathSegments, queryParams, myAgentId)
45402
45593
  model,
45403
45594
  harnessCostUsd: parsed.body.totalCostUsd,
45404
45595
  harnessCostBilled: parsed.body.harnessCostBilled,
45596
+ estimated: parsed.body.estimated,
45405
45597
  inputTokens,
45406
45598
  outputTokens,
45407
45599
  cacheReadTokens: cachedInputTokens,
@@ -50082,7 +50274,8 @@ var UNMAPPED_KINDS = [
50082
50274
  "kapso",
50083
50275
  "telegram",
50084
50276
  "discord",
50085
- "teams"
50277
+ "teams",
50278
+ "rocketchat"
50086
50279
  ];
50087
50280
  async function collectUnmappedForKind(kind, limit) {
50088
50281
  const namespace = `integration:unmapped:${kind}`;
@@ -53524,7 +53717,7 @@ var httpServer = createHttpServer(async (req, res) => {
53524
53717
  });
53525
53718
  });
53526
53719
  var detachRealtime = attachRealtimeTransport(httpServer);
53527
- var { attachControllerTransport } = await import("./controllers-connect-34jzhfft.js");
53720
+ var { attachControllerTransport } = await import("./controllers-connect-yft057ws.js");
53528
53721
  var detachControllers = attachControllerTransport(httpServer);
53529
53722
  var stopWorkerNudges = startWorkerNudgeListener();
53530
53723
  var taskAutoTitles = startTaskAutoTitleListener();
@@ -53555,7 +53748,7 @@ async function shutdown() {
53555
53748
  sessionsProcessed: getServerSessionsProcessed()
53556
53749
  });
53557
53750
  if (hasCapability("scheduling")) {
53558
- const { stopScheduler } = await import("./index-np0582ac.js");
53751
+ const { stopScheduler } = await import("./index-st231bqv.js");
53559
53752
  stopScheduler();
53560
53753
  }
53561
53754
  stopHeartbeat2();
@@ -53567,7 +53760,7 @@ async function shutdown() {
53567
53760
  await stopSlackApp2();
53568
53761
  await stopChatSdk();
53569
53762
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
53570
- const { stopOAuthKeepalive } = await import("./keepalive-2v06q2e8.js");
53763
+ const { stopOAuthKeepalive } = await import("./keepalive-vjnnqbkm.js");
53571
53764
  await stopOAuthKeepalive();
53572
53765
  }
53573
53766
  stopOAuthPendingGc();
@@ -53657,21 +53850,21 @@ try {
53657
53850
  console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
53658
53851
  }
53659
53852
  try {
53660
- const { ensurePricingSeeded } = await import("./boot-seeds-9cwy39jx.js");
53853
+ const { ensurePricingSeeded } = await import("./boot-seeds-bjceqg7b.js");
53661
53854
  ensurePricingSeeded();
53662
- const { startPricingRefreshLoop } = await import("./pricing-refresh-ytjmtyd7.js");
53855
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-jtmjwss9.js");
53663
53856
  startPricingRefreshLoop();
53664
53857
  } catch (err) {
53665
53858
  console.error("[startup] Failed to seed pricing rows:", err);
53666
53859
  }
53667
53860
  try {
53668
- const { ensureModelProfilesSeeded } = await import("./boot-seeds-9cwy39jx.js");
53861
+ const { ensureModelProfilesSeeded } = await import("./boot-seeds-bjceqg7b.js");
53669
53862
  await ensureModelProfilesSeeded();
53670
53863
  } catch (err) {
53671
53864
  console.error("[startup] Failed to seed model profiles:", err);
53672
53865
  }
53673
53866
  try {
53674
- const { ensureRbacSeeded } = await import("./boot-seeds-9cwy39jx.js");
53867
+ const { ensureRbacSeeded } = await import("./boot-seeds-bjceqg7b.js");
53675
53868
  ensureRbacSeeded();
53676
53869
  } catch (err) {
53677
53870
  console.error("[startup] Failed to sync RBAC seed rows:", err);
@@ -53679,13 +53872,13 @@ try {
53679
53872
  throw err;
53680
53873
  }
53681
53874
  try {
53682
- const { runAllSeeders } = await import("./index-ffba0z8q.js");
53875
+ const { runAllSeeders } = await import("./index-9r4j0a60.js");
53683
53876
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
53684
53877
  } catch (err) {
53685
53878
  console.error("[startup] Failed to seed built-in entities:", err);
53686
53879
  }
53687
53880
  try {
53688
- const { runImports } = await import("./index-pb03vans.js");
53881
+ const { runImports } = await import("./index-2z1z7qx6.js");
53689
53882
  await runImports();
53690
53883
  } catch (err) {
53691
53884
  console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
@@ -53736,10 +53929,10 @@ httpServer.listen(port, async () => {
53736
53929
  startChatSdk().catch((err) => {
53737
53930
  console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
53738
53931
  });
53739
- import("./agent-fs-provision-y0qc1rdd.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
53932
+ import("./agent-fs-provision-vbk3fppw.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
53740
53933
  console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
53741
53934
  });
53742
- import("./object-webhooks-3dzdq4fm.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
53935
+ import("./object-webhooks-gt9xnq21.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
53743
53936
  console.warn("[objects] agent-fs webhook boot check failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
53744
53937
  });
53745
53938
  startQueueStallAlarm();
@@ -53755,25 +53948,25 @@ httpServer.listen(port, async () => {
53755
53948
  await initWorkflows2();
53756
53949
  await startScriptRunSupervisor(getMcpBaseUrl());
53757
53950
  if (hasCapability("scheduling")) {
53758
- const { startScheduler } = await import("./index-np0582ac.js");
53759
- const { getExecutorRegistry } = await import("./index-22khdtby.js");
53951
+ const { startScheduler } = await import("./index-st231bqv.js");
53952
+ const { getExecutorRegistry } = await import("./index-6mgbdtv1.js");
53760
53953
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
53761
53954
  startScheduler(getExecutorRegistry(), intervalMs, {
53762
53955
  runId: globalState.__runId
53763
53956
  });
53764
53957
  }
53765
53958
  if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
53766
- const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-vgkrj1jt.js");
53959
+ const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-hqdsn2t2.js");
53767
53960
  startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
53768
53961
  }
53769
53962
  startPoolRouting();
53770
53963
  startRuntimeSupervisor();
53771
53964
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
53772
- const { startOAuthKeepalive } = await import("./keepalive-2v06q2e8.js");
53965
+ const { startOAuthKeepalive } = await import("./keepalive-vjnnqbkm.js");
53773
53966
  startOAuthKeepalive();
53774
53967
  }
53775
53968
  if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
53776
- const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-g06k4bza.js");
53969
+ const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-nkykf09m.js");
53777
53970
  startOAuthRefreshSweep();
53778
53971
  }
53779
53972
  startOAuthPendingGc();
@@ -53783,22 +53976,22 @@ httpServer.listen(port, async () => {
53783
53976
  startSavingsRollup(savingsRollupSql);
53784
53977
  startHumanFreeDrain();
53785
53978
  startTaskSearchBackfill();
53786
- import("./embedding-space-v06fwy7b.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
53979
+ import("./embedding-space-yam9zwzj.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
53787
53980
  setDeploymentEnvReader(getDeploymentEnvValue2);
53788
53981
  return runEmbeddingMaintenance({ backfill: true });
53789
53982
  }).catch((err) => {
53790
53983
  console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
53791
53984
  });
53792
- import("./boot-args-schema-8025snev.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
53985
+ import("./boot-args-schema-6tpk28j4.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
53793
53986
  console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
53794
53987
  });
53795
- import("./boot-scrub-sweep-eajr97e9.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
53988
+ import("./boot-scrub-sweep-cgb6r5bd.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
53796
53989
  console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
53797
53990
  });
53798
- import("./user-merge-jobs-96vg9rpe.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
53991
+ import("./user-merge-jobs-zetg26e0.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
53799
53992
  console.error("[user-merge] startup resume failed (non-fatal):", err);
53800
53993
  });
53801
- import("./session-source-backfill-p73e8zbe.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
53994
+ import("./session-source-backfill-wb60zjkd.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
53802
53995
  console.error("[session-source-backfill] startup run failed (non-fatal):", err);
53803
53996
  });
53804
53997
  }).on("error", (err) => {