@desplega.ai/agent-swarm 2.11.0 → 2.12.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 (382) hide show
  1. package/dist/acp-adapter-11m13kx4.js +16 -0
  2. package/dist/{acp-targets-5wyy2b9m.js → acp-targets-311gcyvw.js} +9 -9
  3. package/dist/{actions-4nxq386s.js → actions-c4chgxp6.js} +24 -22
  4. package/dist/{agent-fs-provision-v6enh76w.js → agent-fs-provision-0b9awm5n.js} +10 -5
  5. package/dist/{amp-adapter-ze3x22qn.js → amp-adapter-r0veq6x5.js} +3 -3
  6. package/dist/{app-kyqt8ehw.js → app-hn5fftf5.js} +5 -5
  7. package/dist/{approval-notifications-a0db0esw.js → approval-notifications-3g6yc8nv.js} +7 -7
  8. package/dist/{assistant-9g5jzq25.js → assistant-cpjgpjvp.js} +24 -22
  9. package/dist/{boot-args-schema-d7fme4q1.js → boot-args-schema-hce1av1h.js} +1 -1
  10. package/dist/{boot-reembed-jrwxeye2.js → boot-reembed-bztbxc4z.js} +1 -1
  11. package/dist/{boot-reembed-6wpazmpw.js → boot-reembed-d7xcym0j.js} +1 -1
  12. package/dist/{boot-scrub-sweep-52h7yntp.js → boot-scrub-sweep-mkmm16gk.js} +2 -2
  13. package/dist/{boot-seeds-kb3dxjex.js → boot-seeds-arrkbe8t.js} +4 -4
  14. package/dist/{boxd-jrrmkv3w.js → boxd-68n75y1s.js} +1 -1
  15. package/dist/{claude-adapter-0c0y8fqp.js → claude-adapter-ykpyr5p8.js} +8 -8
  16. package/dist/{claude-managed-adapter-w2es07qq.js → claude-managed-adapter-ssg6z4bt.js} +4 -4
  17. package/dist/{claude-managed-setup-9ssb7ct4.js → claude-managed-setup-trd59v7b.js} +4 -4
  18. package/dist/{claude-sdk-session-p6t0gyse.js → claude-sdk-session-yjcze0j1.js} +10 -10
  19. package/dist/{cli-2gvdvsxj.js → cli-01tvvtad.js} +63 -60
  20. package/dist/{cli-rhsc2zyx.js → cli-04zc3f7b.js} +1 -1
  21. package/dist/{cli-p1a4khta.js → cli-0k1a0sde.js} +6 -6
  22. package/dist/{cli-atm0hkes.js → cli-0pp1yjg2.js} +4 -4
  23. package/dist/{cli-0b4zam62.js → cli-0vcqcwfn.js} +18 -0
  24. package/dist/{cli-zhn4r1rz.js → cli-12vek61e.js} +72 -49
  25. package/dist/{cli-j2r1apqm.js → cli-1htmtqc2.js} +45 -44
  26. package/dist/{cli-a6q6x15h.js → cli-2amwhyv2.js} +8 -5
  27. package/dist/{cli-w5dar1bk.js → cli-2m6yaq6b.js} +1 -1
  28. package/dist/{cli-a02habn6.js → cli-2tw284hj.js} +2 -2
  29. package/dist/{cli-nc39ym5q.js → cli-39qm0rtm.js} +6 -6
  30. package/dist/{cli-6c9ve77f.js → cli-3p288654.js} +2 -2
  31. package/dist/cli-52nfye5j.js +673 -0
  32. package/dist/cli-55tc8cj4.js +252 -0
  33. package/dist/cli-5r95eqbh.js +186 -0
  34. package/dist/{cli-892y3vfp.js → cli-5tg94mdw.js} +7 -7
  35. package/dist/{cli-ynph3b70.js → cli-5x03v6en.js} +8 -8
  36. package/dist/{cli-1h4njv9y.js → cli-5z0g0e8v.js} +11 -2
  37. package/dist/{cli-6a3j25xd.js → cli-72yms3ey.js} +16 -16
  38. package/dist/{cli-h2qtafm4.js → cli-73q4g5nx.js} +17 -17
  39. package/dist/{cli-k3c13za2.js → cli-7wy8gbwb.js} +1 -1
  40. package/dist/{cli-9g12h1aq.js → cli-7yn42w6m.js} +1 -1
  41. package/dist/{cli-g56fxddf.js → cli-8hp56wat.js} +3 -2
  42. package/dist/{cli-4aswccje.js → cli-9qe5y107.js} +2 -2
  43. package/dist/{cli-7cp6aa1q.js → cli-9y4tgrkf.js} +23 -177
  44. package/dist/{cli-mhrr4d5b.js → cli-agjbj5x0.js} +1 -1
  45. package/dist/{cli-hnh8erra.js → cli-b93d81yg.js} +2 -2
  46. package/dist/{cli-9yjhshah.js → cli-bhgrhedp.js} +1 -1
  47. package/dist/{cli-b82a13ga.js → cli-bp6k9acz.js} +17 -21
  48. package/dist/{cli-7e8sxqv5.js → cli-bpje8n65.js} +30 -3
  49. package/dist/{cli-t2s7j5cy.js → cli-bz97ff9n.js} +2 -2
  50. package/dist/{cli-0bgj4rh5.js → cli-c7j31hq9.js} +3 -3
  51. package/dist/{cli-p8zqbbt1.js → cli-cah298e5.js} +1 -1
  52. package/dist/{cli-9knhkkgr.js → cli-cjqyse9q.js} +3 -3
  53. package/dist/{cli-tb4j757d.js → cli-dkvtfgn4.js} +6 -6
  54. package/dist/{cli-14xdms9a.js → cli-e3ahxq5y.js} +6 -6
  55. package/dist/{cli-6n7y5ypy.js → cli-e8n0hdzd.js} +1 -1
  56. package/dist/{cli-q71g5q39.js → cli-en6dmkxd.js} +3 -3
  57. package/dist/{cli-xqbqwpxr.js → cli-eq4kew31.js} +9 -9
  58. package/dist/{cli-4kzp7r0q.js → cli-eqq0hwvx.js} +3 -3
  59. package/dist/{cli-bf0t77nf.js → cli-ercwc8xn.js} +1 -1
  60. package/dist/{cli-qncx2r0s.js → cli-ex1y88j3.js} +1 -1
  61. package/dist/{cli-bq97k63w.js → cli-fxd1mwtr.js} +2 -2
  62. package/dist/{cli-kbm659dk.js → cli-fy4gb74g.js} +2 -2
  63. package/dist/{cli-djt6wmrc.js → cli-fyaq4zdv.js} +6 -6
  64. package/dist/{cli-raqw9fw9.js → cli-gfy6hbd9.js} +6 -6
  65. package/dist/{cli-s9twe4x0.js → cli-h70a2mxy.js} +13 -8
  66. package/dist/cli-hbvgzjq4.js +69 -0
  67. package/dist/{cli-vy3fn0mz.js → cli-hhc47ack.js} +4 -4
  68. package/dist/{cli-m00c47q6.js → cli-j5gtytvg.js} +54 -24
  69. package/dist/{cli-ha4ek2nb.js → cli-js10kdk7.js} +1 -1
  70. package/dist/{cli-yzxqwcvq.js → cli-k5jx8jya.js} +10 -3
  71. package/dist/{cli-rytq7dm2.js → cli-krbcr00p.js} +3 -3
  72. package/dist/{cli-453497a0.js → cli-kwr5qv5g.js} +2 -2
  73. package/dist/{cli-czvvnfr9.js → cli-m5qtmrbc.js} +2 -2
  74. package/dist/{cli-cstggwq7.js → cli-ma9ys8rt.js} +2 -2
  75. package/dist/{cli-htymm48w.js → cli-mbwmqb5w.js} +1 -1
  76. package/dist/{cli-wz4e5am2.js → cli-mcymtvwn.js} +320 -70
  77. package/dist/{cli-2aacfdcn.js → cli-mq2fbgva.js} +64 -3
  78. package/dist/{cli-ramn8jae.js → cli-n85m2wkq.js} +1 -1
  79. package/dist/{cli-k4r5sfaj.js → cli-n8f0fs3c.js} +4 -4
  80. package/dist/{cli-f8yhybxr.js → cli-nja15knq.js} +3 -3
  81. package/dist/{cli-6tvh1fwq.js → cli-pe3yxedk.js} +3 -3
  82. package/dist/{cli-3bpr3wks.js → cli-pqfecppn.js} +1 -1
  83. package/dist/{cli-n6ygvrrm.js → cli-q2dywc8h.js} +4 -4
  84. package/dist/{cli-8zmpwe79.js → cli-q8tc22bj.js} +5 -5
  85. package/dist/{cli-yvzxbztc.js → cli-r0mz92by.js} +2 -2
  86. package/dist/{cli-v3zcnr8g.js → cli-r14ac1y0.js} +1 -1
  87. package/dist/{cli-fwjwkw66.js → cli-rtmqzat7.js} +2 -2
  88. package/dist/{cli-zqq57pgx.js → cli-s6zk31gr.js} +4 -4
  89. package/dist/{cli-27fat7st.js → cli-sv2r3bw8.js} +7 -7
  90. package/dist/{cli-zb1hff00.js → cli-t75xngj1.js} +9 -9
  91. package/dist/{cli-r813c7rb.js → cli-tdk7jtka.js} +1 -1
  92. package/dist/{cli-5ptj757f.js → cli-tm60vtax.js} +1 -1
  93. package/dist/{cli-rpmw4fsv.js → cli-v9ya390t.js} +12 -12
  94. package/dist/{cli-075ccjh6.js → cli-wvjqaqcp.js} +2607 -65
  95. package/dist/{cli-2jtfm8kh.js → cli-xf4z5bdn.js} +4 -4
  96. package/dist/{cli-4g323fjh.js → cli-xm34qj8m.js} +2 -2
  97. package/dist/{cli-f7dhm7hh.js → cli-ya3kf4gs.js} +1 -1
  98. package/dist/{cli-rwgwen5v.js → cli-yegz2g06.js} +4 -4
  99. package/dist/{cli-nbakg5xh.js → cli-yfpc6qy9.js} +3 -3
  100. package/dist/{cli-thd3005a.js → cli-z4f346g5.js} +1 -1
  101. package/dist/cli.js +24 -21
  102. package/dist/{codex-adapter-ssahg4h4.js → codex-adapter-wc6e4wct.js} +8 -8
  103. package/dist/{codex-login-9c7aggxe.js → codex-login-1ven7yje.js} +1 -1
  104. package/dist/{codex-session-runner-xn63q3h7.js → codex-session-runner-ppfgjd97.js} +9 -9
  105. package/dist/{commands-ctey7tr5.js → commands-tsv2vx5b.js} +3 -3
  106. package/dist/{controller-rqhbppg9.js → controller-ye4sdwsy.js} +4 -4
  107. package/dist/{controllers-connect-w3qbpbt1.js → controllers-connect-zn4dg69h.js} +25 -23
  108. package/dist/core-dxcy02sc.js +41 -0
  109. package/dist/{cursor-adapter-r819hf1a.js → cursor-adapter-q2g9vwts.js} +2 -2
  110. package/dist/{db-2ah39cyx.js → db-3r1fyr2n.js} +6 -2
  111. package/dist/{db-p5drc1d1.js → db-g111qn9j.js} +3 -3
  112. package/dist/{devin-adapter-bc6g0x29.js → devin-adapter-t8d86q9x.js} +1 -1
  113. package/dist/{dispatcher-x6w14pde.js → dispatcher-4q8s0mx8.js} +22 -20
  114. package/dist/{docker-6c4reetq.js → docker-1b41eysj.js} +2 -2
  115. package/dist/{dsh-adapter-h8qn14n4.js → dsh-adapter-mmcw1z5s.js} +2 -2
  116. package/dist/{e2b-z4ec0qve.js → e2b-ew8c5j5v.js} +2 -2
  117. package/dist/{e2b-jg7kyyef.js → e2b-xm60c8ad.js} +2 -2
  118. package/dist/{easter-egg-3d-1y6r9gxy.js → easter-egg-3d-04ke6hcp.js} +1 -1
  119. package/dist/{embedding-space-z6ptw3jk.js → embedding-space-kcdn52vz.js} +6 -6
  120. package/dist/{embeddings-0sxb1d2h.js → embeddings-jnzcd91a.js} +1 -1
  121. package/dist/{event-bus-swr88jg5.js → event-bus-v4ywhc2p.js} +1 -1
  122. package/dist/{execute-6m1ex8ce.js → execute-74amghty.js} +1 -1
  123. package/dist/{external-channel-ezer7pk0.js → external-channel-v9zgxnxz.js} +2 -2
  124. package/dist/fx-adapter-0ar6pqm3.js +19 -0
  125. package/dist/grok-adapter-t6m74fb1.js +19 -0
  126. package/dist/handlers-9kwcrc4k.js +38 -0
  127. package/dist/{heartbeat-6c4fr49t.js → heartbeat-p8pk1msj.js} +25 -23
  128. package/dist/{hook-t1c5avbv.js → hook-k1h73zd7.js} +5 -5
  129. package/dist/{hook-02rt5tvq.js → hook-p5reemds.js} +7 -7
  130. package/dist/{http-qa3h32a1.js → http-ms1z5xxy.js} +565 -141
  131. package/dist/index-23cdfzr6.js +39 -0
  132. package/dist/{index-kqv9ebfj.js → index-76zzxtzf.js} +1 -1
  133. package/dist/{index-e42j998x.js → index-fbkqhvvj.js} +38 -19
  134. package/dist/index-g7kkjs5b.js +38 -0
  135. package/dist/{index-qpjk2hxk.js → index-gjn6qfgn.js} +1 -1
  136. package/dist/{index-akbgsdhh.js → index-kn63q1gr.js} +26 -24
  137. package/dist/index-stk36pa5.js +43 -0
  138. package/dist/{k8s-7jrh5va2.js → k8s-fy8hbhkg.js} +2 -2
  139. package/dist/{keepalive-jmf6pn8c.js → keepalive-031js8jz.js} +4 -4
  140. package/dist/lead-mfggjtfk.js +77 -0
  141. package/dist/{maintenance-g7v15tj1.js → maintenance-sq9v3qx9.js} +1 -1
  142. package/dist/{oauth-refresh-sweep-ywgf8tbr.js → oauth-refresh-sweep-zqmnyvs8.js} +3 -3
  143. package/dist/object-webhooks-r24wwb5y.js +21 -0
  144. package/dist/{onboard-m3fedypq.js → onboard-p25yhh7t.js} +5 -5
  145. package/dist/{opencode-adapter-19ktcbb9.js → opencode-adapter-wcjc4zdk.js} +7 -7
  146. package/dist/{otel-impl-3ehm1hgc.js → otel-impl-ff1gf20m.js} +2 -2
  147. package/dist/{pending-fwj2fatd.js → pending-hxj5yatb.js} +23 -21
  148. package/dist/{pi-mono-adapter-xdeesvc4.js → pi-mono-adapter-vkp4zz7p.js} +12 -12
  149. package/dist/{pricing-refresh-4j8dzvxg.js → pricing-refresh-9w7gx41w.js} +2 -2
  150. package/dist/{rbac-roles-8msjr07m.js → rbac-roles-84aw10nz.js} +3 -3
  151. package/dist/{rbac-roles-n7t2acv8.js → rbac-roles-hz74vckp.js} +2 -2
  152. package/dist/{registry-32b1mft6.js → registry-eeyx1201.js} +1 -1
  153. package/dist/{render-v2-j7qggj8h.js → render-v2-nrdkg9gf.js} +5 -5
  154. package/dist/{resume-hj1mn65y.js → resume-s6ey36rh.js} +9 -9
  155. package/dist/{runtime-z31mdsgv.js → runtime-x0b4pyam.js} +1 -1
  156. package/dist/{session-access-w38fh09a.js → session-access-xv49tk14.js} +4 -4
  157. package/dist/{session-source-backfill-ax6qxv20.js → session-source-backfill-r5j988ah.js} +3 -3
  158. package/dist/{setup-dsqmpfcr.js → setup-mj0krk1p.js} +1 -1
  159. package/dist/thread-buffer-temgaqsy.js +41 -0
  160. package/dist/{tree-visibility-6vqmnr71.js → tree-visibility-cbrsfaar.js} +2 -2
  161. package/dist/{user-merge-jobs-mvheb3ed.js → user-merge-jobs-f9d8nwnw.js} +3 -3
  162. package/dist/{virtual-modules-w2qk2wew.js → virtual-modules-ns0ryw05.js} +3 -3
  163. package/dist/{work-objects-4ahy5es5.js → work-objects-pydhzast.js} +25 -23
  164. package/dist/worker-efcemc22.js +77 -0
  165. package/dist/{worker-follow-up-1gs4aw7y.js → worker-follow-up-9z2xec5e.js} +22 -20
  166. package/dist/{x-3wr8c5sh.js → x-3dtaf2r9.js} +2 -2
  167. package/openapi.json +788 -253
  168. package/package.json +8 -5
  169. package/src/azure-devops/auth.ts +2 -3
  170. package/src/be/agent-fs-identity.ts +46 -0
  171. package/src/be/agent-history.ts +215 -0
  172. package/src/be/db/agents.ts +34 -12
  173. package/src/be/db/tasks/write.ts +2 -2
  174. package/src/be/db.ts +2 -0
  175. package/src/be/migrations/332_primitive_objects.sql +31 -0
  176. package/src/be/migrations/334_agent_history.sql +23 -0
  177. package/src/be/migrations/335_primitive_object_webhooks.sql +36 -0
  178. package/src/be/primitives/boards/elements.ts +717 -0
  179. package/src/be/primitives/boards/excalifont-metrics.json +516 -0
  180. package/src/be/primitives/boards/service.ts +121 -0
  181. package/src/be/primitives/object-webhooks.ts +348 -0
  182. package/src/be/primitives/objects.ts +686 -0
  183. package/src/be/primitives/sheets/a1.ts +136 -0
  184. package/src/be/primitives/sheets/engine-worker.ts +194 -0
  185. package/src/be/primitives/sheets/engine.ts +199 -0
  186. package/src/be/primitives/sheets/format.ts +106 -0
  187. package/src/be/primitives/sheets/service.ts +415 -0
  188. package/src/be/primitives/write-object.ts +83 -0
  189. package/src/be/script-credential-broker.ts +8 -27
  190. package/src/be/scripts/typecheck.ts +216 -0
  191. package/src/be/seed/agent-fs-provision.ts +18 -0
  192. package/src/be/users.ts +19 -0
  193. package/src/commands/onboard/agent-fs-version.ts +1 -1
  194. package/src/commands/onboard/steps/harness.tsx +1 -1
  195. package/src/commands/provider-credentials.ts +1 -0
  196. package/src/e2b/env.ts +3 -1
  197. package/src/fs/agent-fs-provider.ts +33 -2
  198. package/src/gitlab/auth.ts +3 -4
  199. package/src/heartbeat/heartbeat.ts +11 -11
  200. package/src/http/agent-lifecycle.ts +152 -0
  201. package/src/http/agents.ts +12 -0
  202. package/src/http/all-routes.ts +2 -0
  203. package/src/http/auth.ts +2 -1
  204. package/src/http/index.ts +15 -0
  205. package/src/http/object-webhooks.ts +101 -0
  206. package/src/http/operator-actor.ts +2 -1
  207. package/src/http/sessions.ts +7 -0
  208. package/src/http/workflows.ts +32 -0
  209. package/src/integrations/chat-sdk/outbound-files.ts +3 -2
  210. package/src/providers/acp-targets.ts +2 -2
  211. package/src/providers/amp-adapter.ts +1 -1
  212. package/src/providers/opencode-adapter.ts +4 -1
  213. package/src/rbac/legacy-policy.ts +2 -0
  214. package/src/rbac/permissions.ts +5 -0
  215. package/src/script-workflows/guest-ctx.ts +32 -0
  216. package/src/script-workflows/workflow-ctx.ts +2 -0
  217. package/src/scripts-runtime/ctx.ts +9 -1
  218. package/src/scripts-runtime/executors/native.ts +106 -21
  219. package/src/scripts-runtime/executors/quickjs-prelude.ts +9 -2
  220. package/src/scripts-runtime/executors/quickjs-runner.ts +12 -1
  221. package/src/scripts-runtime/sdk-allowlist.ts +88 -0
  222. package/src/scripts-runtime/swarm-sdk.ts +51 -3
  223. package/src/scripts-runtime/types/stdlib.d.ts +267 -0
  224. package/src/scripts-runtime/types/swarm-sdk.d.ts +267 -0
  225. package/src/server.ts +48 -0
  226. package/src/tests/agent-history.test.ts +313 -0
  227. package/src/tests/azure-devops-auth.test.ts +6 -0
  228. package/src/tests/chat-sdk-outbound-files.test.ts +3 -1
  229. package/src/tests/check-unit-test-allowlist.test.ts +193 -0
  230. package/src/tests/credential-check.test.ts +12 -0
  231. package/src/tests/db-task-read-contract.test.ts +2 -0
  232. package/src/tests/db-task-write-contract.test.ts +2 -0
  233. package/src/tests/e2e-coverage-contract.test.ts +6 -2
  234. package/src/tests/e2e-diff-coverage.test.ts +154 -0
  235. package/src/tests/e2e-rerun-quarantine.test.ts +180 -0
  236. package/src/tests/e2e-shards.test.ts +137 -0
  237. package/src/tests/e2e-tracker-ingest.test.ts +266 -0
  238. package/src/tests/extensions-heartbeat.test.ts +34 -0
  239. package/src/tests/gitlab-auth.test.ts +10 -0
  240. package/src/tests/heartbeat.test.ts +38 -0
  241. package/src/tests/http-api-integration.test.ts +0 -6
  242. package/src/tests/opencode-adapter.test.ts +11 -0
  243. package/src/tests/primitives-boards.test.ts +686 -0
  244. package/src/tests/primitives-object-webhooks.test.ts +642 -0
  245. package/src/tests/primitives-objects.test.ts +248 -0
  246. package/src/tests/reasoning-kind-ui-parity.test.ts +112 -0
  247. package/src/tests/script-native-sandbox-identity.test.ts +264 -0
  248. package/src/tests/scripts-namespaces.test.ts +211 -0
  249. package/src/tests/secret-scrub-gate.test.ts +1 -0
  250. package/src/tests/secret-scrubber-convex.test.ts +168 -0
  251. package/src/tests/secret-scrubber.test.ts +1 -1
  252. package/src/tests/session-tokens.test.ts +27 -0
  253. package/src/tests/sheet-engine.test.ts +58 -0
  254. package/src/tests/slack-file-tools-attachments.test.ts +74 -6
  255. package/src/tests/slack-read-boundaries.test.ts +4 -2
  256. package/src/tests/task-start-after-commit.test.ts +82 -0
  257. package/src/tests/ui-logs-parser.test.ts +67 -0
  258. package/src/tests/workflow-retry-v2.test.ts +101 -0
  259. package/src/tests/workflow-tla-races.test.ts +29 -0
  260. package/src/tools/boards.ts +260 -0
  261. package/src/tools/objects.ts +191 -0
  262. package/src/tools/sheets.ts +312 -0
  263. package/src/tools/slack-read.ts +10 -3
  264. package/src/tools/tool-config.ts +23 -0
  265. package/src/tools/workflows/create-workflow.ts +11 -1
  266. package/src/tools/workflows/patch-workflow-node.ts +4 -0
  267. package/src/tools/workflows/patch-workflow.ts +4 -0
  268. package/src/tools/workflows/update-workflow.ts +17 -0
  269. package/src/types.ts +16 -0
  270. package/src/utils/sandboxed-process.ts +47 -2
  271. package/src/utils/secret-scrubber.ts +61 -6
  272. package/src/workflows/engine.ts +35 -21
  273. package/src/workflows/input.ts +29 -1
  274. package/src/workflows/patch-definition.ts +15 -1
  275. package/src/workflows/retry-poller.ts +15 -2
  276. package/src/workflows/validation.ts +10 -0
  277. package/templates/ai-toolbox.manifest.json +1 -1
  278. package/templates/skills/agent-browser/SKILL.md +1 -0
  279. package/templates/skills/agent-browser/content.md +1 -0
  280. package/templates/skills/pages/content.md +5 -0
  281. package/templates/skills/swarm-docs/content.md +6 -1
  282. package/templates/skills/swarm-scripts/SKILL.md +1 -0
  283. package/templates/skills/swarm-scripts/content.md +1 -0
  284. package/templates/skills/tdd-planning/content.md +5 -2
  285. package/dist/acp-adapter-weaaxey3.js +0 -16
  286. package/dist/core-df1n049h.js +0 -39
  287. package/dist/fx-adapter-zwmps9re.js +0 -19
  288. package/dist/grok-adapter-q0avf919.js +0 -19
  289. package/dist/handlers-g5jq0e4q.js +0 -36
  290. package/dist/index-1f6m47mq.js +0 -37
  291. package/dist/index-1p1mpqda.js +0 -36
  292. package/dist/index-tnkd410q.js +0 -41
  293. package/dist/lead-m5e7xt93.js +0 -75
  294. package/dist/thread-buffer-nf55vwx3.js +0 -39
  295. package/dist/worker-ews1nyhw.js +0 -75
  296. package/src/slack/socket-mode-guard.test.ts +0 -25
  297. package/src/tests/agent-activity.test.ts +0 -247
  298. package/src/tests/agent-fs-live-url.test.ts +0 -55
  299. package/src/tests/agentmail-inbox-mapping.test.ts +0 -73
  300. package/src/tests/approval-sweeps-config.test.ts +0 -47
  301. package/src/tests/cards.test.ts +0 -169
  302. package/src/tests/chat-sdk-facts.test.ts +0 -23
  303. package/src/tests/config-env-export-chat-sdk.test.ts +0 -11
  304. package/src/tests/core-auth.test.ts +0 -156
  305. package/src/tests/date-utils.test.ts +0 -48
  306. package/src/tests/db-context-versions.test.ts +0 -37
  307. package/src/tests/db-runtime.test.ts +0 -132
  308. package/src/tests/enabled-capabilities.test.ts +0 -20
  309. package/src/tests/extensions-example-mcp-install.test.ts +0 -67
  310. package/src/tests/extensions-lead-equivalence.test.ts +0 -70
  311. package/src/tests/get-workflow-run-tool.test.ts +0 -98
  312. package/src/tests/github-event-labels.test.ts +0 -24
  313. package/src/tests/haiku-5-5-pricing.test.ts +0 -38
  314. package/src/tests/http-log-scrubbing.test.ts +0 -123
  315. package/src/tests/http-semconv-attributes.test.ts +0 -92
  316. package/src/tests/identity.test.ts +0 -117
  317. package/src/tests/inbox-state.test.ts +0 -167
  318. package/src/tests/internal-ai/models.test.ts +0 -54
  319. package/src/tests/launch-password-rejection.test.ts +0 -140
  320. package/src/tests/list-total-cache.test.ts +0 -88
  321. package/src/tests/match-route.test.ts +0 -187
  322. package/src/tests/memory-feature-flags.test.ts +0 -45
  323. package/src/tests/memory-get-tool.test.ts +0 -269
  324. package/src/tests/memory-health-endpoint.test.ts +0 -78
  325. package/src/tests/memory-http-access.test.ts +0 -221
  326. package/src/tests/memory-retrieval-purge.test.ts +0 -99
  327. package/src/tests/multi-runtime-enabled-stats.test.ts +0 -229
  328. package/src/tests/openai-embedding-provider.test.ts +0 -159
  329. package/src/tests/org-identity.test.ts +0 -44
  330. package/src/tests/pages-actions-endpoint.test.ts +0 -103
  331. package/src/tests/pages-browser-sdk.test.ts +0 -76
  332. package/src/tests/pages-feedback-keys.test.ts +0 -121
  333. package/src/tests/pages-frame-ancestors.test.ts +0 -189
  334. package/src/tests/pages-list-endpoint.test.ts +0 -148
  335. package/src/tests/pages-password-mode.test.ts +0 -266
  336. package/src/tests/pages-public-authed-401.test.ts +0 -103
  337. package/src/tests/pages-public-html.test.ts +0 -297
  338. package/src/tests/pages-public-json-redirect.test.ts +0 -122
  339. package/src/tests/pages-view-count.test.ts +0 -245
  340. package/src/tests/prompt-templates-db.test.ts +0 -616
  341. package/src/tests/rbac-engine.test.ts +0 -742
  342. package/src/tests/repo-allow-merge-gate.test.ts +0 -389
  343. package/src/tests/route-def-find-route.test.ts +0 -192
  344. package/src/tests/runtime-stale-threshold.test.ts +0 -40
  345. package/src/tests/schedule-validation-helper.test.ts +0 -51
  346. package/src/tests/scheduled-tasks-api.test.ts +0 -355
  347. package/src/tests/scheduler-backoff.test.ts +0 -166
  348. package/src/tests/script-run-token.test.ts +0 -75
  349. package/src/tests/scripts-extract-signature.test.ts +0 -47
  350. package/src/tests/scripts-sdk-bridge-tool-failure.test.ts +0 -141
  351. package/src/tests/seed-workflow-dreaming.test.ts +0 -117
  352. package/src/tests/short-id.test.ts +0 -23
  353. package/src/tests/skill-files-http.test.ts +0 -222
  354. package/src/tests/skill-get-file-tool.test.ts +0 -110
  355. package/src/tests/skill-script-refs.test.ts +0 -63
  356. package/src/tests/skill-update-scope.test.ts +0 -252
  357. package/src/tests/skills-bundle.test.ts +0 -99
  358. package/src/tests/slack-app-icon.test.ts +0 -94
  359. package/src/tests/slack-assistant-comention.test.ts +0 -139
  360. package/src/tests/slack-delete.test.ts +0 -157
  361. package/src/tests/slack-inbound-diagnostics-auth.test.ts +0 -93
  362. package/src/tests/slack-manifest.test.ts +0 -23
  363. package/src/tests/slack-task-output.test.ts +0 -90
  364. package/src/tests/store-progress-output-guidance.test.ts +0 -34
  365. package/src/tests/swarm-diff.test.ts +0 -728
  366. package/src/tests/task-lifecycle-events.test.ts +0 -53
  367. package/src/tests/template-asset-config.test.ts +0 -18
  368. package/src/tests/template-fetch.test.ts +0 -490
  369. package/src/tests/themes-page-theme.test.ts +0 -155
  370. package/src/tests/tool-annotations.test.ts +0 -442
  371. package/src/tests/tool-output-agent-id.test.ts +0 -202
  372. package/src/tests/update-profile-agentid.test.ts +0 -248
  373. package/src/tests/whoami-route.test.ts +0 -162
  374. package/src/tests/workflow-definition-telemetry.test.ts +0 -144
  375. package/src/tests/workflow-patch.test.ts +0 -169
  376. package/src/tests/workflow-run-steps-index.test.ts +0 -65
  377. package/src/tests/workflow-schedule-trigger.test.ts +0 -104
  378. package/src/tests/workflow-step-claims.test.ts +0 -152
  379. package/src/tests/workflow-step-order.test.ts +0 -92
  380. package/src/tests/workflow-trigger-schema.test.ts +0 -359
  381. package/src/tests/workflow-versions.test.ts +0 -240
  382. package/src/tests/workflow-wait.test.ts +0 -26
@@ -129,6 +129,8 @@ import {
129
129
  init_date_utils,
130
130
  updateAgentCredentialState2,
131
131
  updateAgentCredentialMissing2,
132
+ AgentDeletedError2,
133
+ isAgentDeleted2,
132
134
  createAgent2,
133
135
  getAgentById2,
134
136
  EXTENSION_AGENT_ROLE2,
@@ -149,6 +151,7 @@ import {
149
151
  getAgentHarnessProviders2,
150
152
  updateAgentActivity2,
151
153
  resetEmptyPollCount2,
154
+ deleteAgent2,
152
155
  hasCapacity2,
153
156
  updateAgentStatusFromCapacity2,
154
157
  getAgentDailyTaskCounts2,
@@ -471,6 +474,7 @@ import {
471
474
  listSkills2,
472
475
  searchSkills2,
473
476
  installSkill2,
477
+ installSystemDefaultSkillsForAgent2,
474
478
  uninstallSkill2,
475
479
  getAgentSkills2,
476
480
  createMcpServer2,
@@ -550,7 +554,7 @@ import {
550
554
  countScriptRunJournalSteps2,
551
555
  countScriptRunJournalAgentTaskSteps2,
552
556
  init_db4
553
- } from "./cli-zhn4r1rz.js";
557
+ } from "./cli-12vek61e.js";
554
558
  import {
555
559
  PRIMARY_ROLE_NAMES2,
556
560
  OperatorGrantedTargetError2,
@@ -564,7 +568,7 @@ import {
564
568
  assertNotLastAdmin2,
565
569
  setUserRoles2,
566
570
  init_rbac_roles
567
- } from "./cli-cstggwq7.js";
571
+ } from "./cli-ma9ys8rt.js";
568
572
  import {
569
573
  MAX_MODEL_GROUP_MEMBERS,
570
574
  listModelGroups,
@@ -574,17 +578,17 @@ import {
574
578
  modelGroupReferences,
575
579
  deleteModelGroup,
576
580
  init_model_groups
577
- } from "./cli-f8yhybxr.js";
581
+ } from "./cli-nja15knq.js";
578
582
  import {
579
583
  requestModelCatalogRefresh2,
580
584
  init_pricing_refresh
581
- } from "./cli-hnh8erra.js";
585
+ } from "./cli-b93d81yg.js";
582
586
  import {
583
587
  workflowEventBus2,
584
588
  init_event_bus
585
- } from "./cli-thd3005a.js";
586
- import"./cli-bq97k63w.js";
587
- import"./cli-rhsc2zyx.js";
589
+ } from "./cli-z4f346g5.js";
590
+ import"./cli-fxd1mwtr.js";
591
+ import"./cli-04zc3f7b.js";
588
592
  import"./cli-9w8712tq.js";
589
593
  import"./cli-47hz21se.js";
590
594
  import {
@@ -622,7 +626,7 @@ import {
622
626
  startSlackApp2,
623
627
  stopSlackApp2,
624
628
  init_app4
625
- } from "./cli-6a3j25xd.js";
629
+ } from "./cli-72yms3ey.js";
626
630
  import {
627
631
  AGENT_MAX_TASKS_CONFIG_KEY,
628
632
  reconcileAgentMaxTasksPolicy,
@@ -650,12 +654,12 @@ import {
650
654
  dispatchApprovalNotifications2,
651
655
  createApprovalFollowUpTask2,
652
656
  init_approval_notifications
653
- } from "./cli-raqw9fw9.js";
657
+ } from "./cli-gfy6hbd9.js";
654
658
  import {
655
659
  retryFailedRun2,
656
660
  cancelWorkflowRun2,
657
661
  init_resume
658
- } from "./cli-14xdms9a.js";
662
+ } from "./cli-e3ahxq5y.js";
659
663
  import {
660
664
  safeParse,
661
665
  getObjectShape,
@@ -707,6 +711,9 @@ import {
707
711
  init_manifest_format,
708
712
  handleWebhookTrigger,
709
713
  verifyHmacSignature,
714
+ decodeStandardWebhookSecret,
715
+ verifyStandardWebhookSignature,
716
+ verifyTokenEquality,
710
717
  WebhookError,
711
718
  init_triggers,
712
719
  snapshotAndUpdateWorkflow,
@@ -1129,17 +1136,11 @@ import {
1129
1136
  getEnabledCapabilities,
1130
1137
  createServer,
1131
1138
  init_server
1132
- } from "./cli-075ccjh6.js";
1139
+ } from "./cli-wvjqaqcp.js";
1133
1140
  import {
1134
- FilesError,
1135
- normalizeFilesError,
1136
- init_provider,
1137
- agentFsRequestTimeoutMs,
1138
- AgentFsProvider,
1139
- init_agent_fs_provider,
1140
1141
  getFileStorageProvider2,
1141
1142
  init_registry2
1142
- } from "./cli-7cp6aa1q.js";
1143
+ } from "./cli-5r95eqbh.js";
1143
1144
  import {
1144
1145
  RuntimePoolError2,
1145
1146
  mintControllerToken,
@@ -1161,7 +1162,7 @@ import {
1161
1162
  resolvePoolDelivery2,
1162
1163
  createPoolAgent2,
1163
1164
  init_db2
1164
- } from "./cli-8zmpwe79.js";
1165
+ } from "./cli-q8tc22bj.js";
1165
1166
  import {
1166
1167
  duplicateGuardedQueryKey,
1167
1168
  warnIfCorsAllowsAnyOrigin,
@@ -1218,7 +1219,7 @@ import {
1218
1219
  describeRequestRoute,
1219
1220
  route,
1220
1221
  init_route_def
1221
- } from "./cli-nc39ym5q.js";
1222
+ } from "./cli-39qm0rtm.js";
1222
1223
  import {
1223
1224
  startPoolRouting,
1224
1225
  stopPoolRouting,
@@ -1231,28 +1232,28 @@ import {
1231
1232
  checkHeartbeatChecklist2,
1232
1233
  runHeartbeatSweep2,
1233
1234
  stopHeartbeat2
1234
- } from "./cli-b82a13ga.js";
1235
- import"./cli-yvzxbztc.js";
1235
+ } from "./cli-bp6k9acz.js";
1236
+ import"./cli-r0mz92by.js";
1236
1237
  import {
1237
1238
  runtimeSupervisorStatus,
1238
1239
  startRuntimeSupervisor,
1239
1240
  stopRuntimeSupervisor
1240
- } from "./cli-rpmw4fsv.js";
1241
+ } from "./cli-v9ya390t.js";
1241
1242
  import {
1242
1243
  TASK_TITLE_TIMEOUT_MS,
1243
1244
  generateTaskTitle
1244
- } from "./cli-4kzp7r0q.js";
1245
+ } from "./cli-eqq0hwvx.js";
1245
1246
  import"./cli-ns59dc6r.js";
1246
1247
  import {
1247
1248
  ACP_TARGET_IDS
1248
- } from "./cli-r813c7rb.js";
1249
+ } from "./cli-tdk7jtka.js";
1249
1250
  import {
1250
1251
  reasoningCapability,
1251
1252
  supportedReasoningLevels
1252
- } from "./cli-fwjwkw66.js";
1253
+ } from "./cli-rtmqzat7.js";
1253
1254
  import {
1254
1255
  MAX_RATE_LIMIT_RESET_MS
1255
- } from "./cli-ramn8jae.js";
1256
+ } from "./cli-n85m2wkq.js";
1256
1257
  import {
1257
1258
  isLeadChannelMonitoringEnabled,
1258
1259
  ORG_IDENTITY_KEYS,
@@ -1262,7 +1263,7 @@ import {
1262
1263
  isUnknownModelError,
1263
1264
  checkProviderPoolKey,
1264
1265
  writeSkillsToFilesystem
1265
- } from "./cli-2jtfm8kh.js";
1266
+ } from "./cli-xf4z5bdn.js";
1266
1267
  import {
1267
1268
  AgentFsRequestError2,
1268
1269
  resolveAgentFsSharedContext2,
@@ -1271,12 +1272,18 @@ import {
1271
1272
  getCurrentOrgMembers2,
1272
1273
  roleRank2,
1273
1274
  agentFsRequest2,
1274
- resolveApiUrl2
1275
- } from "./cli-2gvdvsxj.js";
1275
+ resolveApiUrl2,
1276
+ init_agent_fs_provision
1277
+ } from "./cli-01tvvtad.js";
1276
1278
  import {
1277
1279
  Anthropic
1278
- } from "./cli-p8zqbbt1.js";
1279
- import"./cli-rwgwen5v.js";
1280
+ } from "./cli-cah298e5.js";
1281
+ import {
1282
+ objectWebhookSecret2,
1283
+ handleObjectWebhookEvent2,
1284
+ init_object_webhooks
1285
+ } from "./cli-55tc8cj4.js";
1286
+ import"./cli-yegz2g06.js";
1280
1287
  import {
1281
1288
  createUserMergeJob2,
1282
1289
  getUserMergeJob2,
@@ -1285,7 +1292,7 @@ import {
1285
1292
  findFailedUserMergeJob2,
1286
1293
  requeueUserMergeJob2,
1287
1294
  runUserMergeJobs2
1288
- } from "./cli-q71g5q39.js";
1295
+ } from "./cli-en6dmkxd.js";
1289
1296
  import {
1290
1297
  isCodexOAuthConfigKey
1291
1298
  } from "./cli-j4bwnpkm.js";
@@ -1296,7 +1303,7 @@ import {
1296
1303
  import {
1297
1304
  runTaskUiAction,
1298
1305
  init_actions
1299
- } from "./cli-9knhkkgr.js";
1306
+ } from "./cli-cjqyse9q.js";
1300
1307
  import {
1301
1308
  RATING_MODEL_MAX_LENGTH,
1302
1309
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -1391,7 +1398,7 @@ import {
1391
1398
  init_typecheck,
1392
1399
  parseSkillContent,
1393
1400
  init_skill_parser
1394
- } from "./cli-wz4e5am2.js";
1401
+ } from "./cli-mcymtvwn.js";
1395
1402
  import {
1396
1403
  signalProcessGroup,
1397
1404
  detachedProcessGroup,
@@ -1408,8 +1415,18 @@ import {
1408
1415
  forceRefreshAuthorizationOrThrow,
1409
1416
  forceRefreshTokenOrThrow,
1410
1417
  init_ensure_token
1411
- } from "./cli-4aswccje.js";
1412
- import"./cli-v3zcnr8g.js";
1418
+ } from "./cli-9qe5y107.js";
1419
+ import"./cli-52nfye5j.js";
1420
+ import"./cli-hbvgzjq4.js";
1421
+ import {
1422
+ FilesError,
1423
+ normalizeFilesError,
1424
+ init_provider,
1425
+ agentFsRequestTimeoutMs,
1426
+ AgentFsProvider,
1427
+ init_agent_fs_provider
1428
+ } from "./cli-9y4tgrkf.js";
1429
+ import"./cli-r14ac1y0.js";
1413
1430
  import {
1414
1431
  automationIntegrationFixUrl,
1415
1432
  preflightAutomation,
@@ -1417,6 +1434,9 @@ import {
1417
1434
  listEnabledAutomationPreflightInputs,
1418
1435
  setupIntegrationFlags,
1419
1436
  init_automation_preflight,
1437
+ serverRefInputKeys,
1438
+ serverRefInputDeniedMessage,
1439
+ init_input,
1420
1440
  validateJsonSchema,
1421
1441
  init_json_schema_validator,
1422
1442
  workflowSaveWarnings,
@@ -1428,7 +1448,7 @@ import {
1428
1448
  definitionNodeIds,
1429
1449
  validateDefinition,
1430
1450
  init_definition2
1431
- } from "./cli-m00c47q6.js";
1451
+ } from "./cli-j5gtytvg.js";
1432
1452
  import {
1433
1453
  _fetchHolder,
1434
1454
  CLIENT_ID,
@@ -1444,7 +1464,7 @@ import {
1444
1464
  loadAllCodexOAuthSlots,
1445
1465
  getValidCodexOAuth,
1446
1466
  init_storage
1447
- } from "./cli-w5dar1bk.js";
1467
+ } from "./cli-2m6yaq6b.js";
1448
1468
  import {
1449
1469
  isMultiRuntimeEnabled,
1450
1470
  init_multi_runtime2
@@ -1456,7 +1476,7 @@ import {
1456
1476
  import {
1457
1477
  createRuntimeProvider,
1458
1478
  init_runtime_providers
1459
- } from "./cli-zqq57pgx.js";
1479
+ } from "./cli-s6zk31gr.js";
1460
1480
  import {
1461
1481
  require_content_type
1462
1482
  } from "./cli-1jx0srjt.js";
@@ -1478,7 +1498,7 @@ import {
1478
1498
  revokeMcpToken,
1479
1499
  computeExpiresAt,
1480
1500
  init_mcp_wrapper
1481
- } from "./cli-t2s7j5cy.js";
1501
+ } from "./cli-bz97ff9n.js";
1482
1502
  import"./cli-v41kn3cd.js";
1483
1503
  import {
1484
1504
  setBedrockProviderModule,
@@ -1515,9 +1535,10 @@ import {
1515
1535
  mintAgentToken,
1516
1536
  rotateAgentToken,
1517
1537
  revokeAgentTokens,
1538
+ revokeAllAgentSessionTokens,
1518
1539
  fingerprintApiKey,
1519
1540
  init_users
1520
- } from "./cli-yzxqwcvq.js";
1541
+ } from "./cli-k5jx8jya.js";
1521
1542
  import {
1522
1543
  MAX_PROVIDER_QUOTA_ENTRIES,
1523
1544
  ProviderQuotaCapacityError,
@@ -1526,21 +1547,11 @@ import {
1526
1547
  providerAccountTelemetrySchema,
1527
1548
  rateLimitReplacementSchema,
1528
1549
  init_provider_account_telemetry
1529
- } from "./cli-k3c13za2.js";
1550
+ } from "./cli-7wy8gbwb.js";
1530
1551
  import {
1531
1552
  resolveGitHubHost,
1532
1553
  init_github_host
1533
1554
  } from "./cli-9ttx00s3.js";
1534
- import {
1535
- CORE_TOOLS,
1536
- init_tool_config
1537
- } from "./cli-0b4zam62.js";
1538
- import {
1539
- CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
1540
- CODEX_AUTH_WATCH_NAMESPACE,
1541
- codexAuthBenchMarkerKey,
1542
- init_codex_auth_failure
1543
- } from "./cli-fw2w0kva.js";
1544
1555
  import {
1545
1556
  ASSET_KEY_MAX_LENGTH,
1546
1557
  AssetKeyError,
@@ -1608,6 +1619,7 @@ import {
1608
1619
  AgentAvatarSchema,
1609
1620
  AgentSlackIconSchema,
1610
1621
  AgentSchema,
1622
+ AgentHistoryEventSchema,
1611
1623
  AgentLatestModelSchema,
1612
1624
  AgentAcpStatusSchema,
1613
1625
  AgentCredStatusSchema,
@@ -1713,12 +1725,22 @@ import {
1713
1725
  KvKeySchema,
1714
1726
  KvEntrySchema,
1715
1727
  init_types5
1716
- } from "./cli-1h4njv9y.js";
1728
+ } from "./cli-5z0g0e8v.js";
1729
+ import {
1730
+ CORE_TOOLS,
1731
+ init_tool_config
1732
+ } from "./cli-0vcqcwfn.js";
1733
+ import {
1734
+ CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
1735
+ CODEX_AUTH_WATCH_NAMESPACE,
1736
+ codexAuthBenchMarkerKey,
1737
+ init_codex_auth_failure
1738
+ } from "./cli-fw2w0kva.js";
1717
1739
  import {
1718
1740
  IDENTITY_FIELD_BUDGETS,
1719
1741
  IdentityFieldBudgetError,
1720
1742
  init_identity_field_budget
1721
- } from "./cli-mhrr4d5b.js";
1743
+ } from "./cli-agjbj5x0.js";
1722
1744
  import {
1723
1745
  isSteeringEnabled2,
1724
1746
  init_steering_enabled
@@ -1746,7 +1768,7 @@ import {
1746
1768
  splitCredentialPool,
1747
1769
  selectCredential,
1748
1770
  init_credentials2
1749
- } from "./cli-ha4ek2nb.js";
1771
+ } from "./cli-js10kdk7.js";
1750
1772
  import {
1751
1773
  getOpenRouterAttributionHeaders,
1752
1774
  init_openrouter_base_url
@@ -1813,7 +1835,7 @@ import {
1813
1835
  import {
1814
1836
  init_package,
1815
1837
  package_default
1816
- } from "./cli-a6q6x15h.js";
1838
+ } from "./cli-2amwhyv2.js";
1817
1839
  import {
1818
1840
  realtimeBus,
1819
1841
  init_bus
@@ -1829,7 +1851,7 @@ import {
1829
1851
  registerVolatileSecret,
1830
1852
  registerEnvSecrets,
1831
1853
  init_secret_scrubber
1832
- } from "./cli-7e8sxqv5.js";
1854
+ } from "./cli-bpje8n65.js";
1833
1855
  import {
1834
1856
  __toESM
1835
1857
  } from "./cli-242037k3.js";
@@ -7089,6 +7111,319 @@ async function handleActiveSessions(req, res, pathSegments, queryParams, myAgent
7089
7111
  return false;
7090
7112
  }
7091
7113
 
7114
+ // src/http/agent-lifecycle.ts
7115
+ init_zod();
7116
+
7117
+ // src/be/agent-history.ts
7118
+ init_types5();
7119
+ init_secret_scrubber();
7120
+ init_db4();
7121
+ init_users();
7122
+
7123
+ class AgentHistoryError extends Error {
7124
+ status;
7125
+ code;
7126
+ blockers;
7127
+ constructor(message, status, code, blockers = []) {
7128
+ super(message);
7129
+ this.status = status;
7130
+ this.code = code;
7131
+ this.blockers = blockers;
7132
+ this.name = "AgentHistoryError";
7133
+ }
7134
+ }
7135
+ var NON_TERMINAL_SQL = `status NOT IN (${TERMINAL_TASK_STATUSES.map((s) => `'${s}'`).join(", ")})`;
7136
+ var COUNT_BLOCKERS = [
7137
+ [
7138
+ "open_tasks",
7139
+ `SELECT COUNT(*) AS n FROM agent_tasks WHERE (agentId = ?1 OR offeredTo = ?1) AND ${NON_TERMINAL_SQL}`,
7140
+ "non-terminal task(s) are assigned or offered to it; finish, cancel or reassign them"
7141
+ ],
7142
+ [
7143
+ "schedules",
7144
+ "SELECT COUNT(*) AS n FROM scheduled_tasks WHERE targetAgentId = ?1 AND enabled = 1",
7145
+ "enabled schedule(s) target it; disable or retarget them"
7146
+ ],
7147
+ [
7148
+ "owned_skills",
7149
+ "SELECT COUNT(*) AS n FROM skills WHERE ownerAgentId = ?1",
7150
+ "skill(s) are owned by it"
7151
+ ],
7152
+ [
7153
+ "owned_mcp_servers",
7154
+ "SELECT COUNT(*) AS n FROM mcp_servers WHERE ownerAgentId = ?1",
7155
+ "MCP server(s) are owned by it"
7156
+ ],
7157
+ [
7158
+ "inboxes",
7159
+ "SELECT COUNT(*) AS n FROM agentmail_inbox_mappings WHERE agentId = ?1",
7160
+ "AgentMail inbox(es) map to it"
7161
+ ]
7162
+ ];
7163
+ async function deleteBlockers(agent) {
7164
+ const blockers = [];
7165
+ if (agent.isLead)
7166
+ blockers.push({ code: "lead", message: "The lead agent cannot be deleted." });
7167
+ if (isExtensionAgent2(agent)) {
7168
+ blockers.push({ code: "extension", message: "Uninstall the extension instead." });
7169
+ }
7170
+ if (agent.status !== "offline") {
7171
+ blockers.push({ code: "not_offline", message: `Agent is ${agent.status}. Stop its worker.` });
7172
+ }
7173
+ if (agent.runtimePoolId) {
7174
+ blockers.push({ code: "pool_bound", message: `Unbind it from pool ${agent.runtimePoolId}.` });
7175
+ }
7176
+ for (const [code, sql, what] of COUNT_BLOCKERS) {
7177
+ const n = (await getDbClient2().get(sql, [agent.id]))?.n ?? 0;
7178
+ if (n > 0)
7179
+ blockers.push({ code, message: `${n} ${what}.` });
7180
+ }
7181
+ return blockers;
7182
+ }
7183
+ function rowToEvent(row) {
7184
+ return {
7185
+ id: row.id,
7186
+ agentId: row.agent_id,
7187
+ event: row.event,
7188
+ actorRef: row.actor_ref,
7189
+ reason: row.reason,
7190
+ snapshot: JSON.parse(row.snapshot_json),
7191
+ createdAt: row.created_at
7192
+ };
7193
+ }
7194
+ async function appendEvent(agentId, event, actorRef, reason) {
7195
+ const snapshot = await getDbClient2().get("SELECT * FROM agents WHERE id = ?", [agentId]);
7196
+ const row = await getDbClient2().get(`INSERT INTO agent_history (id, agent_id, event, actor_ref, reason, snapshot_json, created_at)
7197
+ VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING *`, [
7198
+ crypto.randomUUID(),
7199
+ agentId,
7200
+ event,
7201
+ actorRef,
7202
+ scrubSecrets(reason.trim()),
7203
+ JSON.stringify(snapshot),
7204
+ new Date().toISOString()
7205
+ ]);
7206
+ if (!row)
7207
+ throw new Error("Failed to append agent history");
7208
+ return rowToEvent(row);
7209
+ }
7210
+ async function latestEvent(agentId) {
7211
+ return await getDbClient2().get("SELECT * FROM agent_history WHERE agent_id = ? ORDER BY created_at DESC, rowid DESC LIMIT 1", [agentId]);
7212
+ }
7213
+ async function deleteAgentToHistory(agentId, reason, actorRef) {
7214
+ return await getDbClient2().transaction(async () => {
7215
+ const agent = await getAgentById2(agentId);
7216
+ if (!agent)
7217
+ throw new AgentHistoryError("Agent not found", 404, "not_found");
7218
+ const blockers = await deleteBlockers(agent);
7219
+ if (blockers.length > 0) {
7220
+ throw new AgentHistoryError(blockers[0].message, 409, blockers[0].code, blockers);
7221
+ }
7222
+ const event = await appendEvent(agentId, "deleted", actorRef, reason);
7223
+ await revokeAllAgentSessionTokens(agentId);
7224
+ await getDbClient2().run("DELETE FROM agent_skills WHERE agentId = ?", [agentId]);
7225
+ await getDbClient2().run("DELETE FROM agent_mcp_servers WHERE agentId = ?", [agentId]);
7226
+ await deleteAgent2(agentId);
7227
+ return event;
7228
+ });
7229
+ }
7230
+ async function restoreAgentFromHistory(agentId, input, actorRef) {
7231
+ return await getDbClient2().transaction(async () => {
7232
+ if (await getAgentById2(agentId)) {
7233
+ throw new AgentHistoryError("Agent exists; nothing to restore", 409, "not_deleted");
7234
+ }
7235
+ const last = await latestEvent(agentId);
7236
+ if (last?.event !== "deleted") {
7237
+ throw new AgentHistoryError("No deleted agent with this id", 404, "not_found");
7238
+ }
7239
+ const row = JSON.parse(last.snapshot_json);
7240
+ const name = input.newName?.trim() || String(row.name);
7241
+ row.name = name;
7242
+ row.lastUpdatedAt = new Date().toISOString();
7243
+ const taken = await getDbClient2().get("SELECT id FROM agents WHERE name = ?", [name]);
7244
+ if (taken) {
7245
+ throw new AgentHistoryError(`Another agent is named "${name}". Pass newName.`, 409, "name_taken");
7246
+ }
7247
+ const columns = (await getDbClient2().query("SELECT name FROM pragma_table_info('agents')")).map((c) => c.name).filter((c) => (c in row));
7248
+ await getDbClient2().run(`INSERT INTO agents (${columns.map((c) => `"${c}"`).join(", ")}) VALUES (${columns.map(() => "?").join(", ")})`, columns.map((c) => row[c] ?? null));
7249
+ await installSystemDefaultSkillsForAgent2(agentId);
7250
+ const event = await appendEvent(agentId, "restored", actorRef, input.reason);
7251
+ return { agent: await getAgentById2(agentId), event };
7252
+ });
7253
+ }
7254
+ async function listAgentHistory(agentId) {
7255
+ const rows = await getDbClient2().query(`SELECT * FROM agent_history ${agentId ? "WHERE agent_id = ?" : ""}
7256
+ ORDER BY created_at DESC, rowid DESC LIMIT 500`, agentId ? [agentId] : []);
7257
+ return rows.map(rowToEvent);
7258
+ }
7259
+
7260
+ // src/http/agent-lifecycle.ts
7261
+ init_rbac();
7262
+ init_types5();
7263
+ init_secret_scrubber();
7264
+
7265
+ // src/http/operator-actor.ts
7266
+ init_users();
7267
+ init_api_key();
7268
+ init_request_auth_context();
7269
+ init_triggers();
7270
+ init_request_principal();
7271
+ init_utils2();
7272
+ function extractBearer(req) {
7273
+ const raw = req.headers.authorization;
7274
+ const header = Array.isArray(raw) ? raw[0] : raw;
7275
+ if (!header || !header.startsWith("Bearer "))
7276
+ return null;
7277
+ return header.slice(7);
7278
+ }
7279
+ function getOperatorActor(req, res) {
7280
+ if (rejectGuest(req, res))
7281
+ return null;
7282
+ const auth = getRequestAuth(req);
7283
+ const userId = authUserId(auth);
7284
+ if (userId) {
7285
+ const tokenId = auth?.kind === "user" ? auth.tokenId : undefined;
7286
+ return tokenId ? { kind: "user", id: userId, tokenId } : { kind: "user", id: userId };
7287
+ }
7288
+ if (isOperatorAuth(auth)) {
7289
+ return { kind: "operator", id: auth.fingerprint };
7290
+ }
7291
+ const rawKey = extractBearer(req);
7292
+ const swarmKey = getApiKey();
7293
+ if (!swarmKey) {
7294
+ return { kind: "operator", id: fingerprintApiKey("") };
7295
+ }
7296
+ if (!rawKey || !verifyTokenEquality(swarmKey, rawKey)) {
7297
+ jsonError(res, "Unauthorized", 401);
7298
+ return null;
7299
+ }
7300
+ return { kind: "operator", id: fingerprintApiKey(rawKey) };
7301
+ }
7302
+
7303
+ // src/http/agent-lifecycle.ts
7304
+ init_request_principal();
7305
+ init_route_def();
7306
+ init_utils2();
7307
+ var params = object2({ id: string2().min(1) });
7308
+ var reason = string2().trim().min(3).max(2000);
7309
+ var RefusalSchema = object2({
7310
+ error: string2(),
7311
+ code: string2(),
7312
+ blockers: array2(object2({ code: string2(), message: string2() }))
7313
+ });
7314
+ var RBAC = { permission: "agent.lifecycle.manage" };
7315
+ var DENIED = { description: "Operator or user credentials required" };
7316
+ var deleteRoute = route({
7317
+ method: "post",
7318
+ path: "/api/agents/{id}/delete",
7319
+ pattern: ["api", "agents", null, "delete"],
7320
+ summary: "Delete an agent into agent_history",
7321
+ description: "Appends the agent row to `agent_history`, revokes its session tokens, and deletes the row. Refused with 409 while the agent is the lead, an extension identity, not offline, pool-bound, holds open tasks or enabled schedules, or owns skills, MCP servers or inboxes.",
7322
+ tags: ["Agents"],
7323
+ params,
7324
+ body: object2({ reason }),
7325
+ responses: {
7326
+ 200: { description: "Agent deleted", schema: object2({ event: AgentHistoryEventSchema }) },
7327
+ 400: { description: "Validation error" },
7328
+ 403: DENIED,
7329
+ 404: { description: "Agent not found" },
7330
+ 409: { description: "A blocker refuses the delete", schema: RefusalSchema }
7331
+ },
7332
+ rbac: RBAC
7333
+ });
7334
+ var restoreRoute = route({
7335
+ method: "post",
7336
+ path: "/api/agents/{id}/restore",
7337
+ pattern: ["api", "agents", null, "restore"],
7338
+ summary: "Restore a deleted agent from agent_history",
7339
+ description: "Reinserts the latest deleted snapshot under the same id. Rows a cascading foreign key removed on delete do not come back.",
7340
+ tags: ["Agents"],
7341
+ params,
7342
+ body: object2({ reason, newName: string2().trim().min(1).optional() }),
7343
+ responses: {
7344
+ 200: {
7345
+ description: "Agent restored",
7346
+ schema: object2({ agent: AgentSchema, event: AgentHistoryEventSchema })
7347
+ },
7348
+ 400: { description: "Validation error" },
7349
+ 403: DENIED,
7350
+ 404: { description: "No deleted agent with this id" },
7351
+ 409: { description: "The agent exists, or its name is taken", schema: RefusalSchema }
7352
+ },
7353
+ rbac: RBAC
7354
+ });
7355
+ var historyRoute = route({
7356
+ method: "get",
7357
+ path: "/api/agent-history",
7358
+ pattern: ["api", "agent-history"],
7359
+ summary: "List agent delete and restore events",
7360
+ description: "Newest first, at most 500. Filter by `agentId`.",
7361
+ tags: ["Agents"],
7362
+ query: object2({ agentId: string2().min(1).optional() }),
7363
+ responses: {
7364
+ 200: {
7365
+ description: "Events",
7366
+ schema: object2({ events: array2(AgentHistoryEventSchema) })
7367
+ },
7368
+ 403: DENIED
7369
+ },
7370
+ rbac: RBAC
7371
+ });
7372
+ async function handleAgentLifecycle(req, res, pathSegments, queryParams, myAgentId) {
7373
+ const matched = [deleteRoute, restoreRoute, historyRoute].find((r) => r.match(req.method, pathSegments));
7374
+ if (!matched)
7375
+ return false;
7376
+ const decision = can({
7377
+ principal: await agentFirstPrincipal(req, myAgentId),
7378
+ verb: "agent.lifecycle.manage",
7379
+ resource: matched === historyRoute ? { kind: "none" } : { kind: "agent", agentId: pathSegments[2] },
7380
+ source: "http"
7381
+ });
7382
+ if (!decision.allow) {
7383
+ jsonError(res, scrubSecrets(decision.reason), 403);
7384
+ return true;
7385
+ }
7386
+ if (matched === historyRoute) {
7387
+ const parsed = await historyRoute.parse(req, res, pathSegments, queryParams);
7388
+ if (!parsed)
7389
+ return true;
7390
+ historyRoute.respond(res, 200, { events: await listAgentHistory(parsed.query.agentId) });
7391
+ return true;
7392
+ }
7393
+ const operator = getOperatorActor(req, res);
7394
+ if (!operator)
7395
+ return true;
7396
+ const actorRef = operator.kind === "user" ? `user:${operator.id}` : operator.id;
7397
+ try {
7398
+ if (matched === deleteRoute) {
7399
+ const parsed = await deleteRoute.parse(req, res, pathSegments, queryParams);
7400
+ if (!parsed)
7401
+ return true;
7402
+ const event = await deleteAgentToHistory(parsed.params.id, parsed.body.reason, actorRef);
7403
+ deleteRoute.respond(res, 200, { event });
7404
+ return true;
7405
+ }
7406
+ const parsed = await restoreRoute.parse(req, res, pathSegments, queryParams);
7407
+ if (!parsed)
7408
+ return true;
7409
+ restoreRoute.respond(res, 200, await restoreAgentFromHistory(parsed.params.id, parsed.body, actorRef));
7410
+ return true;
7411
+ } catch (error) {
7412
+ if (!(error instanceof AgentHistoryError))
7413
+ throw error;
7414
+ if (error.status === 404) {
7415
+ jsonError(res, error.message, 404);
7416
+ return true;
7417
+ }
7418
+ const body = { error: error.message, code: error.code, blockers: error.blockers };
7419
+ if (matched === restoreRoute)
7420
+ restoreRoute.respond(res, 409, body);
7421
+ else
7422
+ deleteRoute.respond(res, 409, body);
7423
+ return true;
7424
+ }
7425
+ }
7426
+
7092
7427
  // src/http/agentfs-proxy.ts
7093
7428
  init_api_key();
7094
7429
  init_constants3();
@@ -7525,7 +7860,10 @@ var registerAgent = route({
7525
7860
  description: "Agent created. Response includes `enabledCapabilities` (see 200).",
7526
7861
  schema: RegisterAgentResponseSchema
7527
7862
  },
7528
- 400: { description: "Validation error" }
7863
+ 400: { description: "Validation error" },
7864
+ 410: {
7865
+ description: "An operator deleted this agent id (`agent_deleted`); the worker must stop"
7866
+ }
7529
7867
  }
7530
7868
  });
7531
7869
  var setAgentHarnessProviderRoute = route({
@@ -7979,6 +8317,8 @@ async function handleAgentRegister(req, res, pathSegments, myAgentId) {
7979
8317
  }
7980
8318
  return { agent: await getAgentById2(agentId), created: false };
7981
8319
  }
8320
+ if (await isAgentDeleted2(agentId))
8321
+ return null;
7982
8322
  const agent = await createAgent2({
7983
8323
  id: agentId,
7984
8324
  name: parsed.body.name,
@@ -8005,6 +8345,10 @@ async function handleAgentRegister(req, res, pathSegments, myAgentId) {
8005
8345
  }
8006
8346
  return { agent, created: true };
8007
8347
  });
8348
+ if (!result) {
8349
+ jsonError(res, "agent_deleted", 410);
8350
+ return true;
8351
+ }
8008
8352
  if (parsed.body.harnessCliVersion !== undefined) {
8009
8353
  await setAgentHarnessCliVersion(agentId, parsed.body.harnessCliVersion.trim() || null);
8010
8354
  }
@@ -18011,7 +18355,7 @@ var patchRoute = route({
18011
18355
  },
18012
18356
  rbac: { permission: "extension.write" }
18013
18357
  });
18014
- var deleteRoute = route({
18358
+ var deleteRoute2 = route({
18015
18359
  method: "delete",
18016
18360
  path: "/api/extensions/{id}",
18017
18361
  pattern: ["api", "extensions", null],
@@ -18356,8 +18700,8 @@ async function handleExtensions(req, res, pathSegments, queryParams, agentId) {
18356
18700
  patchRoute.respond(res, 200, { extension: redactExtension(extension) });
18357
18701
  return true;
18358
18702
  }
18359
- if (deleteRoute.match(req.method, pathSegments)) {
18360
- const parsed = await deleteRoute.parse(req, res, pathSegments, queryParams);
18703
+ if (deleteRoute2.match(req.method, pathSegments)) {
18704
+ const parsed = await deleteRoute2.parse(req, res, pathSegments, queryParams);
18361
18705
  if (!parsed)
18362
18706
  return true;
18363
18707
  const stored = await getExtensionById(parsed.params.id);
@@ -18384,7 +18728,7 @@ async function handleExtensions(req, res, pathSegments, queryParams, agentId) {
18384
18728
  respondLifecycleError(res, error);
18385
18729
  return true;
18386
18730
  }
18387
- deleteRoute.respond(res, 200, { deleted: true, assets });
18731
+ deleteRoute2.respond(res, 200, { deleted: true, assets });
18388
18732
  return true;
18389
18733
  }
18390
18734
  if (enableRoute.match(req.method, pathSegments)) {
@@ -18858,6 +19202,7 @@ init_zod();
18858
19202
  // src/be/agent-fs-user-keys.ts
18859
19203
  init_secret_scrubber();
18860
19204
  init_rbac_roles();
19205
+ init_agent_fs_provision();
18861
19206
  init_users();
18862
19207
 
18863
19208
  class AgentFsKeyValidationError extends Error {
@@ -19003,6 +19348,7 @@ ${block}`, new Date().toISOString(), taskId]);
19003
19348
 
19004
19349
  // src/http/fs.ts
19005
19350
  init_rbac_roles();
19351
+ init_agent_fs_provision();
19006
19352
  init_task_attachment_store();
19007
19353
  init_users();
19008
19354
  init_config3();
@@ -24539,7 +24885,7 @@ function unauthorized2(res) {
24539
24885
  res.end(JSON.stringify({ error: "Unauthorized" }));
24540
24886
  return true;
24541
24887
  }
24542
- function extractBearer(req) {
24888
+ function extractBearer2(req) {
24543
24889
  const header = req.headers.authorization;
24544
24890
  if (!header?.startsWith("Bearer "))
24545
24891
  return null;
@@ -24547,7 +24893,7 @@ function extractBearer(req) {
24547
24893
  return token.startsWith("aswt_") ? token : null;
24548
24894
  }
24549
24895
  async function resolveActiveUser(req) {
24550
- const token = extractBearer(req);
24896
+ const token = extractBearer2(req);
24551
24897
  if (!token)
24552
24898
  return null;
24553
24899
  const resolved = await resolveUserToken(token);
@@ -27985,6 +28331,86 @@ async function handleOAuthLocks(req, res, pathSegments, queryParams) {
27985
28331
  return false;
27986
28332
  }
27987
28333
 
28334
+ // src/http/object-webhooks.ts
28335
+ init_zod();
28336
+ init_object_webhooks();
28337
+ init_triggers();
28338
+ init_route_def();
28339
+ init_utils2();
28340
+ var MAX_BODY_BYTES = 64 * 1024;
28341
+ var objectWebhook = route({
28342
+ method: "post",
28343
+ path: "/api/objects/agent-fs-webhook/{id}",
28344
+ pattern: ["api", "objects", "agent-fs-webhook", null],
28345
+ summary: "Receive agent-fs file.changed events that keep primitive objects in sync",
28346
+ tags: ["Webhooks"],
28347
+ params: object2({ id: string2().describe("Receiver id the swarm registered with agent-fs") }),
28348
+ auth: { apiKey: false },
28349
+ rbac: {
28350
+ ungated: "provider webhook: authenticated by the per-drive Standard Webhooks HMAC secret the swarm registered with agent-fs, not a swarm principal"
28351
+ },
28352
+ responses: {
28353
+ 200: {
28354
+ description: "Event applied or ignored",
28355
+ schema: object2({
28356
+ action: _enum2(["updated", "tombstoned", "restored", "moved", "ignored"]),
28357
+ path: string2(),
28358
+ id: string2().optional(),
28359
+ reason: string2().optional()
28360
+ })
28361
+ },
28362
+ 400: { description: "Body is not a valid event" },
28363
+ 401: { description: "Unknown receiver, missing headers or invalid signature" },
28364
+ 413: { description: "Body exceeds 64 KiB" },
28365
+ 503: { description: "agent-fs could not be read; agent-fs retries the delivery" }
28366
+ }
28367
+ });
28368
+ var header2 = (req, name) => {
28369
+ const value = req.headers[name];
28370
+ return Array.isArray(value) ? value[0] : value;
28371
+ };
28372
+ async function handleObjectWebhooks(req, res, pathSegments) {
28373
+ if (!objectWebhook.match(req.method, pathSegments))
28374
+ return false;
28375
+ if (enforceContentLengthCap(req, res, MAX_BODY_BYTES) === BODY_TOO_LARGE)
28376
+ return true;
28377
+ const chunks = [];
28378
+ let received = 0;
28379
+ for await (const chunk of req) {
28380
+ received += chunk.byteLength;
28381
+ if (received > MAX_BODY_BYTES) {
28382
+ jsonError(res, `Payload too large (max ${MAX_BODY_BYTES} bytes)`, 413);
28383
+ req.resume();
28384
+ return true;
28385
+ }
28386
+ chunks.push(chunk);
28387
+ }
28388
+ const rawBody = Buffer.concat(chunks).toString("utf-8");
28389
+ const id = header2(req, "webhook-id");
28390
+ const timestamp = header2(req, "webhook-timestamp");
28391
+ const signature = header2(req, "webhook-signature");
28392
+ const hook = await objectWebhookSecret2(pathSegments[3] ?? "");
28393
+ const key = hook ? decodeStandardWebhookSecret(hook.secret) : null;
28394
+ if (!hook || !key || !id || !timestamp || !signature || !verifyStandardWebhookSignature(key, rawBody, { id, timestamp, signature })) {
28395
+ jsonError(res, "Invalid webhook signature", 401);
28396
+ return true;
28397
+ }
28398
+ let envelope;
28399
+ try {
28400
+ envelope = JSON.parse(rawBody);
28401
+ } catch {
28402
+ jsonError(res, "Invalid JSON body", 400);
28403
+ return true;
28404
+ }
28405
+ const outcome = await handleObjectWebhookEvent2(hook, envelope);
28406
+ if (outcome.status === 200) {
28407
+ objectWebhook.respond(res, 200, outcome.result);
28408
+ } else {
28409
+ jsonError(res, outcome.error, outcome.status);
28410
+ }
28411
+ return true;
28412
+ }
28413
+
27988
28414
  // src/http/onboarding.ts
27989
28415
  init_openai2();
27990
28416
  init_automation_preflight();
@@ -43409,7 +43835,7 @@ var searchRoute = route({
43409
43835
  },
43410
43836
  rbac: { permission: "script.search" }
43411
43837
  });
43412
- var deleteRoute2 = route({
43838
+ var deleteRoute3 = route({
43413
43839
  method: "delete",
43414
43840
  path: "/api/scripts/{name}",
43415
43841
  pattern: ["api", "scripts", null],
@@ -44000,8 +44426,8 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
44000
44426
  });
44001
44427
  return true;
44002
44428
  }
44003
- if (deleteRoute2.match(req.method, pathSegments)) {
44004
- const parsed = await deleteRoute2.parse(req, res, pathSegments, queryParams);
44429
+ if (deleteRoute3.match(req.method, pathSegments)) {
44430
+ const parsed = await deleteRoute3.parse(req, res, pathSegments, queryParams);
44005
44431
  if (!parsed)
44006
44432
  return true;
44007
44433
  const agent = await requireAgent2(res, agentId);
@@ -44040,7 +44466,7 @@ async function handleScripts(req, res, pathSegments, queryParams, agentId) {
44040
44466
  }, 409);
44041
44467
  return true;
44042
44468
  }
44043
- deleteRoute2.respond(res, 200, { deleted: outcome.deleted });
44469
+ deleteRoute3.respond(res, 200, { deleted: outcome.deleted });
44044
44470
  return true;
44045
44471
  }
44046
44472
  if (createScriptApiRoute.match(req.method, pathSegments)) {
@@ -44860,7 +45286,8 @@ var mintAgentTokenRoute = route({
44860
45286
  },
44861
45287
  403: { description: "Operator or user credentials required" },
44862
45288
  404: { description: "Agent not found and no name given" },
44863
- 409: { description: "Agent already holds an active token" }
45289
+ 409: { description: "Agent already holds an active token" },
45290
+ 410: { description: "An operator deleted this agent id (`agent_deleted`); restore it first" }
44864
45291
  },
44865
45292
  rbac: { permission: "agent.token.manage" }
44866
45293
  });
@@ -44977,8 +45404,14 @@ async function handleAgentTokens(req, res, pathSegments, queryParams) {
44977
45404
  }).catch((error) => {
44978
45405
  if (error instanceof AgentTokenExistsError)
44979
45406
  return { status: 409 };
45407
+ if (error instanceof AgentDeletedError2)
45408
+ return { status: 410 };
44980
45409
  throw error;
44981
45410
  });
45411
+ if (result.status === 410) {
45412
+ jsonError(res, "agent_deleted", 410);
45413
+ return true;
45414
+ }
44982
45415
  if (result.status === 404) {
44983
45416
  jsonError(res, "Agent not found; pass name to create it", 404);
44984
45417
  return true;
@@ -46889,7 +47322,7 @@ var slackEventsRoute = route({
46889
47322
  }
46890
47323
  });
46891
47324
  var SLACK_EVENTS_MAX_BODY_BYTES = 1024 * 1024;
46892
- function header2(req, name) {
47325
+ function header3(req, name) {
46893
47326
  const value = req.headers[name];
46894
47327
  return Array.isArray(value) ? value[0] : value;
46895
47328
  }
@@ -46929,11 +47362,11 @@ async function handleSlackEvents(req, res, pathSegments) {
46929
47362
  return true;
46930
47363
  const result = await receiver.handle({
46931
47364
  rawBody: Buffer.concat(chunks),
46932
- signature: header2(req, "x-slack-signature"),
46933
- timestamp: header2(req, "x-slack-request-timestamp"),
46934
- contentType: header2(req, "content-type"),
46935
- retryNum: header2(req, "x-slack-retry-num"),
46936
- retryReason: header2(req, "x-slack-retry-reason"),
47365
+ signature: header3(req, "x-slack-signature"),
47366
+ timestamp: header3(req, "x-slack-request-timestamp"),
47367
+ contentType: header3(req, "content-type"),
47368
+ retryNum: header3(req, "x-slack-retry-num"),
47369
+ retryReason: header3(req, "x-slack-retry-reason"),
46937
47370
  signingSecret: process.env.SLACK_SIGNING_SECRET
46938
47371
  });
46939
47372
  res.writeHead(result.status, {
@@ -47526,7 +47959,7 @@ var toolHookRoute = route({
47526
47959
  400: { description: "Invalid body or missing X-Agent-ID header" }
47527
47960
  }
47528
47961
  });
47529
- function header3(req, name) {
47962
+ function header4(req, name) {
47530
47963
  const raw = req.headers[name];
47531
47964
  return Array.isArray(raw) ? raw[0] : raw;
47532
47965
  }
@@ -47544,9 +47977,9 @@ async function handleToolHooks(req, res, pathSegments, queryParams, myAgentId) {
47544
47977
  const requestInfo = {
47545
47978
  sessionId: undefined,
47546
47979
  agentId: myAgentId,
47547
- runtimeInstanceId: header3(req, "x-runtime-instance-id"),
47548
- sourceTaskId: header3(req, "x-source-task-id"),
47549
- contextKey: header3(req, "x-context-key"),
47980
+ runtimeInstanceId: header4(req, "x-runtime-instance-id"),
47981
+ sourceTaskId: header4(req, "x-source-task-id"),
47982
+ contextKey: header4(req, "x-context-key"),
47550
47983
  callOrigin: "native",
47551
47984
  harness: body.harness
47552
47985
  };
@@ -48334,45 +48767,6 @@ init_rbac_roles();
48334
48767
  init_users();
48335
48768
  init_rbac();
48336
48769
  init_types5();
48337
-
48338
- // src/http/operator-actor.ts
48339
- init_users();
48340
- init_api_key();
48341
- init_request_auth_context();
48342
- init_request_principal();
48343
- init_utils2();
48344
- function extractBearer2(req) {
48345
- const raw = req.headers.authorization;
48346
- const header = Array.isArray(raw) ? raw[0] : raw;
48347
- if (!header || !header.startsWith("Bearer "))
48348
- return null;
48349
- return header.slice(7);
48350
- }
48351
- function getOperatorActor(req, res) {
48352
- if (rejectGuest(req, res))
48353
- return null;
48354
- const auth = getRequestAuth(req);
48355
- const userId = authUserId(auth);
48356
- if (userId) {
48357
- const tokenId = auth?.kind === "user" ? auth.tokenId : undefined;
48358
- return tokenId ? { kind: "user", id: userId, tokenId } : { kind: "user", id: userId };
48359
- }
48360
- if (isOperatorAuth(auth)) {
48361
- return { kind: "operator", id: auth.fingerprint };
48362
- }
48363
- const rawKey = extractBearer2(req);
48364
- const swarmKey = getApiKey();
48365
- if (!swarmKey) {
48366
- return { kind: "operator", id: fingerprintApiKey("") };
48367
- }
48368
- if (!rawKey || rawKey !== swarmKey) {
48369
- jsonError(res, "Unauthorized", 401);
48370
- return null;
48371
- }
48372
- return { kind: "operator", id: fingerprintApiKey(rawKey) };
48373
- }
48374
-
48375
- // src/http/user-roles.ts
48376
48770
  init_request_principal();
48377
48771
  init_route_def();
48378
48772
  init_utils2();
@@ -51041,6 +51435,7 @@ init_types5();
51041
51435
  init_workflows();
51042
51436
  init_definition2();
51043
51437
  init_engine();
51438
+ init_input();
51044
51439
  init_json_schema_validator();
51045
51440
  init_model_validation();
51046
51441
  init_patch_definition();
@@ -51139,6 +51534,7 @@ var createWorkflowRoute = route({
51139
51534
  responses: {
51140
51535
  201: { description: "Workflow created", schema: WorkflowSaveResponseSchema },
51141
51536
  400: { description: "Invalid definition, or a malformed Idempotency-Key" },
51537
+ 403: { description: "Env var or secret input requires config.read.secrets" },
51142
51538
  409: { description: "Idempotency-Key was already used for a different request" },
51143
51539
  410: { description: "The workflow created under this Idempotency-Key was deleted" }
51144
51540
  }
@@ -51190,6 +51586,7 @@ var updateWorkflowRoute = route({
51190
51586
  schema: WorkflowSaveResponseSchema
51191
51587
  },
51192
51588
  400: { description: "Invalid definition" },
51589
+ 403: { description: "Env var or secret input requires config.read.secrets" },
51193
51590
  404: { description: "Workflow not found" }
51194
51591
  }
51195
51592
  });
@@ -51207,6 +51604,7 @@ var patchWorkflowRoute = route({
51207
51604
  schema: WorkflowSaveResponseSchema
51208
51605
  },
51209
51606
  400: { description: "Invalid patch or resulting definition" },
51607
+ 403: { description: "Stored env var or secret input requires config.read.secrets" },
51210
51608
  404: { description: "Workflow not found" }
51211
51609
  }
51212
51610
  });
@@ -51224,6 +51622,7 @@ var patchWorkflowNodeRoute = route({
51224
51622
  schema: WorkflowSaveResponseSchema
51225
51623
  },
51226
51624
  400: { description: "Invalid patch or resulting definition" },
51625
+ 403: { description: "Stored env var or secret input requires config.read.secrets" },
51227
51626
  404: { description: "Workflow or node not found" }
51228
51627
  }
51229
51628
  });
@@ -51595,6 +51994,11 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
51595
51994
  jsonError(res, `Invalid definition: ${modelErrors.join("; ")}`, 400);
51596
51995
  return true;
51597
51996
  }
51997
+ const refKeys = serverRefInputKeys(parsed.body.input);
51998
+ if (refKeys.length > 0 && await requestSecretReadScope(req) !== "all") {
51999
+ jsonError(res, serverRefInputDeniedMessage(refKeys), 403);
52000
+ return true;
52001
+ }
51598
52002
  const trustedUserId = await resolveHttpAuditUserId(req, myAgentId);
51599
52003
  let key;
51600
52004
  try {
@@ -51683,6 +52087,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
51683
52087
  registry: getExecutorRegistry2(),
51684
52088
  snapshotAgentId: myAgentId,
51685
52089
  snapshotOptional: true,
52090
+ serverRefInputAllowed: await requestSecretReadScope(req) === "all",
51686
52091
  updates: { updatedBy: updatedBy0 }
51687
52092
  });
51688
52093
  if (!result.ok) {
@@ -51691,6 +52096,10 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
51691
52096
  res.end();
51692
52097
  return true;
51693
52098
  }
52099
+ if (result.reason === "forbidden") {
52100
+ jsonError(res, result.errors.join("; "), 403);
52101
+ return true;
52102
+ }
51694
52103
  if (result.reason === "patch") {
51695
52104
  jsonError(res, result.errors.join("; "), 404);
51696
52105
  return true;
@@ -51738,6 +52147,7 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
51738
52147
  registry: getExecutorRegistry2(),
51739
52148
  snapshotAgentId: myAgentId,
51740
52149
  snapshotOptional: true,
52150
+ serverRefInputAllowed: await requestSecretReadScope(req) === "all",
51741
52151
  updates: updateArgs
51742
52152
  });
51743
52153
  if (!result.ok) {
@@ -51746,6 +52156,10 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
51746
52156
  res.end();
51747
52157
  return true;
51748
52158
  }
52159
+ if (result.reason === "forbidden") {
52160
+ jsonError(res, result.errors.join("; "), 403);
52161
+ return true;
52162
+ }
51749
52163
  jsonError(res, result.reason === "patch" ? result.errors.join("; ") : `Invalid definition: ${result.errors.join("; ")}`, 400);
51750
52164
  return true;
51751
52165
  }
@@ -51784,6 +52198,11 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
51784
52198
  return true;
51785
52199
  }
51786
52200
  }
52201
+ const refKeys = serverRefInputKeys(body.input !== undefined ? body.input : body.definition ? existing.input : undefined);
52202
+ if (refKeys.length > 0 && await requestSecretReadScope(req) !== "all") {
52203
+ jsonError(res, serverRefInputDeniedMessage(refKeys), 403);
52204
+ return true;
52205
+ }
51787
52206
  const updatedBy2 = await resolveHttpAuditUserId(req, myAgentId) ?? undefined;
51788
52207
  let key;
51789
52208
  if (body.key !== undefined) {
@@ -52029,7 +52448,7 @@ init_utils2();
52029
52448
  import { timingSafeEqual as timingSafeEqual3 } from "node:crypto";
52030
52449
  var DEFAULT_TIMEOUT_MS = 60000;
52031
52450
  var TIMEOUT_HEADER = "x-swarm-timeout-ms";
52032
- var MAX_BODY_BYTES = 1 * 1024 * 1024;
52451
+ var MAX_BODY_BYTES2 = 1 * 1024 * 1024;
52033
52452
  var XScriptErrorSchema = object2({
52034
52453
  type: string2(),
52035
52454
  message: string2(),
@@ -52133,7 +52552,7 @@ async function handleX(req, res, pathSegments) {
52133
52552
  return true;
52134
52553
  }
52135
52554
  }
52136
- if (enforceContentLengthCap(req, res, MAX_BODY_BYTES) === BODY_TOO_LARGE)
52555
+ if (enforceContentLengthCap(req, res, MAX_BODY_BYTES2) === BODY_TOO_LARGE)
52137
52556
  return true;
52138
52557
  let args;
52139
52558
  try {
@@ -52341,6 +52760,8 @@ var httpServer = createHttpServer(async (req, res) => {
52341
52760
  () => handleSessionData(req, res, pathSegments, queryParams, myAgentId),
52342
52761
  () => handleTrackers(req, res, pathSegments),
52343
52762
  () => handleWebhooks(req, res, pathSegments),
52763
+ () => handleObjectWebhooks(req, res, pathSegments),
52764
+ () => handleAgentLifecycle(req, res, pathSegments, queryParams, myAgentId),
52344
52765
  () => handleAgentsRest(req, res, pathSegments, queryParams, myAgentId),
52345
52766
  () => handleBudgets(req, res, pathSegments, queryParams, myAgentId),
52346
52767
  () => handleContext(req, res, pathSegments, queryParams, myAgentId),
@@ -52441,7 +52862,7 @@ var httpServer = createHttpServer(async (req, res) => {
52441
52862
  });
52442
52863
  });
52443
52864
  var detachRealtime = attachRealtimeTransport(httpServer);
52444
- var { attachControllerTransport } = await import("./controllers-connect-w3qbpbt1.js");
52865
+ var { attachControllerTransport } = await import("./controllers-connect-zn4dg69h.js");
52445
52866
  var detachControllers = attachControllerTransport(httpServer);
52446
52867
  var stopWorkerNudges = startWorkerNudgeListener();
52447
52868
  var taskAutoTitles = startTaskAutoTitleListener();
@@ -52472,7 +52893,7 @@ async function shutdown() {
52472
52893
  sessionsProcessed: getServerSessionsProcessed()
52473
52894
  });
52474
52895
  if (hasCapability("scheduling")) {
52475
- const { stopScheduler } = await import("./index-1f6m47mq.js");
52896
+ const { stopScheduler } = await import("./index-23cdfzr6.js");
52476
52897
  stopScheduler();
52477
52898
  }
52478
52899
  stopHeartbeat2();
@@ -52484,7 +52905,7 @@ async function shutdown() {
52484
52905
  await stopSlackApp2();
52485
52906
  await stopChatSdk();
52486
52907
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
52487
- const { stopOAuthKeepalive } = await import("./keepalive-jmf6pn8c.js");
52908
+ const { stopOAuthKeepalive } = await import("./keepalive-031js8jz.js");
52488
52909
  await stopOAuthKeepalive();
52489
52910
  }
52490
52911
  stopOAuthPendingGc();
@@ -52574,21 +52995,21 @@ try {
52574
52995
  console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
52575
52996
  }
52576
52997
  try {
52577
- const { ensurePricingSeeded } = await import("./boot-seeds-kb3dxjex.js");
52998
+ const { ensurePricingSeeded } = await import("./boot-seeds-arrkbe8t.js");
52578
52999
  ensurePricingSeeded();
52579
- const { startPricingRefreshLoop } = await import("./pricing-refresh-4j8dzvxg.js");
53000
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-9w7gx41w.js");
52580
53001
  startPricingRefreshLoop();
52581
53002
  } catch (err) {
52582
53003
  console.error("[startup] Failed to seed pricing rows:", err);
52583
53004
  }
52584
53005
  try {
52585
- const { ensureModelProfilesSeeded } = await import("./boot-seeds-kb3dxjex.js");
53006
+ const { ensureModelProfilesSeeded } = await import("./boot-seeds-arrkbe8t.js");
52586
53007
  await ensureModelProfilesSeeded();
52587
53008
  } catch (err) {
52588
53009
  console.error("[startup] Failed to seed model profiles:", err);
52589
53010
  }
52590
53011
  try {
52591
- const { ensureRbacSeeded } = await import("./boot-seeds-kb3dxjex.js");
53012
+ const { ensureRbacSeeded } = await import("./boot-seeds-arrkbe8t.js");
52592
53013
  ensureRbacSeeded();
52593
53014
  } catch (err) {
52594
53015
  console.error("[startup] Failed to sync RBAC seed rows:", err);
@@ -52596,13 +53017,13 @@ try {
52596
53017
  throw err;
52597
53018
  }
52598
53019
  try {
52599
- const { runAllSeeders } = await import("./index-e42j998x.js");
53020
+ const { runAllSeeders } = await import("./index-fbkqhvvj.js");
52600
53021
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
52601
53022
  } catch (err) {
52602
53023
  console.error("[startup] Failed to seed built-in entities:", err);
52603
53024
  }
52604
53025
  try {
52605
- const { runImports } = await import("./index-akbgsdhh.js");
53026
+ const { runImports } = await import("./index-kn63q1gr.js");
52606
53027
  await runImports();
52607
53028
  } catch (err) {
52608
53029
  console.error("[startup] File import failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
@@ -52653,9 +53074,12 @@ httpServer.listen(port, async () => {
52653
53074
  startChatSdk().catch((err) => {
52654
53075
  console.error("[chat-sdk] Failed to start, continuing without Chat SDK:", scrubSecrets(err instanceof Error ? err.message : String(err)));
52655
53076
  });
52656
- import("./agent-fs-provision-v6enh76w.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
53077
+ import("./agent-fs-provision-0b9awm5n.js").then(({ syncAgentFsOrgSwarmUrl }) => syncAgentFsOrgSwarmUrl(getConfiguredAppUrls()[0])).catch((err) => {
52657
53078
  console.warn("[agent-fs] Failed to set the org swarm URL:", scrubSecrets(err instanceof Error ? err.message : String(err)));
52658
53079
  });
53080
+ import("./object-webhooks-r24wwb5y.js").then(({ ensureObjectWebhooksForKnownDrives }) => ensureObjectWebhooksForKnownDrives()).catch((err) => {
53081
+ console.warn("[objects] agent-fs webhook boot check failed:", scrubSecrets(err instanceof Error ? err.message : String(err)));
53082
+ });
52659
53083
  startQueueStallAlarm();
52660
53084
  initGitHub();
52661
53085
  initGitLab();
@@ -52669,25 +53093,25 @@ httpServer.listen(port, async () => {
52669
53093
  await initWorkflows2();
52670
53094
  await startScriptRunSupervisor(getMcpBaseUrl());
52671
53095
  if (hasCapability("scheduling")) {
52672
- const { startScheduler } = await import("./index-1f6m47mq.js");
52673
- const { getExecutorRegistry } = await import("./index-tnkd410q.js");
53096
+ const { startScheduler } = await import("./index-23cdfzr6.js");
53097
+ const { getExecutorRegistry } = await import("./index-stk36pa5.js");
52674
53098
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
52675
53099
  startScheduler(getExecutorRegistry(), intervalMs, {
52676
53100
  runId: globalState.__runId
52677
53101
  });
52678
53102
  }
52679
53103
  if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
52680
- const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-1p1mpqda.js");
53104
+ const { parseHeartbeatIntervalMs, startHeartbeat } = await import("./index-g7kkjs5b.js");
52681
53105
  startHeartbeat(parseHeartbeatIntervalMs(process.env.HEARTBEAT_INTERVAL_MS));
52682
53106
  }
52683
53107
  startPoolRouting();
52684
53108
  startRuntimeSupervisor();
52685
53109
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
52686
- const { startOAuthKeepalive } = await import("./keepalive-jmf6pn8c.js");
53110
+ const { startOAuthKeepalive } = await import("./keepalive-031js8jz.js");
52687
53111
  startOAuthKeepalive();
52688
53112
  }
52689
53113
  if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
52690
- const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-ywgf8tbr.js");
53114
+ const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-zqmnyvs8.js");
52691
53115
  startOAuthRefreshSweep();
52692
53116
  }
52693
53117
  startOAuthPendingGc();
@@ -52697,22 +53121,22 @@ httpServer.listen(port, async () => {
52697
53121
  startSavingsRollup(savingsRollupSql);
52698
53122
  startHumanFreeDrain();
52699
53123
  startTaskSearchBackfill();
52700
- import("./embedding-space-z6ptw3jk.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
53124
+ import("./embedding-space-kcdn52vz.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
52701
53125
  setDeploymentEnvReader(getDeploymentEnvValue2);
52702
53126
  return runEmbeddingMaintenance({ backfill: true });
52703
53127
  }).catch((err) => {
52704
53128
  console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
52705
53129
  });
52706
- import("./boot-args-schema-d7fme4q1.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
53130
+ import("./boot-args-schema-hce1av1h.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
52707
53131
  console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
52708
53132
  });
52709
- import("./boot-scrub-sweep-52h7yntp.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
53133
+ import("./boot-scrub-sweep-mkmm16gk.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
52710
53134
  console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
52711
53135
  });
52712
- import("./user-merge-jobs-mvheb3ed.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
53136
+ import("./user-merge-jobs-f9d8nwnw.js").then(({ resumeUserMergeJobs }) => resumeUserMergeJobs()).catch((err) => {
52713
53137
  console.error("[user-merge] startup resume failed (non-fatal):", err);
52714
53138
  });
52715
- import("./session-source-backfill-ax6qxv20.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
53139
+ import("./session-source-backfill-r5j988ah.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
52716
53140
  console.error("[session-source-backfill] startup run failed (non-fatal):", err);
52717
53141
  });
52718
53142
  }).on("error", (err) => {