@desplega.ai/agent-swarm 2.7.7 → 2.7.8

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 (251) hide show
  1. package/dist/{acp-adapter-7b4vk3h5.js → acp-adapter-vg5hqkvj.js} +6 -6
  2. package/dist/{actions-3tt153af.js → actions-4m1ct4nh.js} +18 -18
  3. package/dist/{amp-adapter-njpts0yr.js → amp-adapter-txqh7eqj.js} +2 -2
  4. package/dist/{app-nky4378f.js → app-e00m45gn.js} +3 -3
  5. package/dist/{assistant-jnb669pa.js → assistant-gd08kr9e.js} +20 -20
  6. package/dist/boot-args-schema-tjrkpbvm.js +89 -0
  7. package/dist/{boot-reembed-9mgvaztt.js → boot-reembed-21hbck22.js} +1 -1
  8. package/dist/{boot-reembed-qs2djdej.js → boot-reembed-mdxd3wgp.js} +1 -1
  9. package/dist/{boot-scrub-sweep-yjpdj7s1.js → boot-scrub-sweep-qy0zr9t2.js} +3 -3
  10. package/dist/{boot-seeds-5cm6ambd.js → boot-seeds-n46eaxdv.js} +4 -4
  11. package/dist/{claude-adapter-fn287zmm.js → claude-adapter-j37w2eds.js} +6 -6
  12. package/dist/{claude-managed-adapter-dvs2xw5n.js → claude-managed-adapter-8jvcma9a.js} +3 -3
  13. package/dist/{claude-managed-setup-wtdz2mj2.js → claude-managed-setup-rzkjmgc1.js} +3 -3
  14. package/dist/{claude-sdk-session-x91kqyhm.js → claude-sdk-session-4k7w73t0.js} +7 -7
  15. package/dist/{cli-rtt8g4v9.js → cli-0ykgn1h5.js} +1 -1
  16. package/dist/{cli-5b456bpf.js → cli-1cxrbkk6.js} +2 -2
  17. package/dist/{cli-5jnhv72d.js → cli-269q28a1.js} +4 -2
  18. package/dist/{cli-k1nje3v3.js → cli-32m9eda8.js} +49 -37
  19. package/dist/{cli-35rsp8ye.js → cli-3e4snnzf.js} +1 -1
  20. package/dist/{cli-5zx699j9.js → cli-4t50yq3j.js} +2 -2
  21. package/dist/{cli-n6bv12jn.js → cli-5j0m12ns.js} +10 -3
  22. package/dist/{cli-dhar9qay.js → cli-5ja3b75e.js} +2 -2
  23. package/dist/{cli-g08zdaec.js → cli-66ww7fer.js} +1 -1
  24. package/dist/{cli-nmzhp1b5.js → cli-7axf41jq.js} +25 -14
  25. package/dist/{cli-gz6q4eve.js → cli-84rj785g.js} +5 -5
  26. package/dist/{cli-fyt2g4wd.js → cli-85gzce7b.js} +5 -5
  27. package/dist/{cli-3fg0bdcv.js → cli-8h0ayw8c.js} +1 -1
  28. package/dist/{cli-qghe0h66.js → cli-8rpcng8j.js} +2 -2
  29. package/dist/{cli-ws19768n.js → cli-8sdejs1f.js} +115 -51
  30. package/dist/{cli-8305gbq0.js → cli-9m8hdawy.js} +3 -3
  31. package/dist/{cli-excnnjg2.js → cli-ae0dnfee.js} +1 -1
  32. package/dist/{cli-e0kmphd6.js → cli-bb0mmdk8.js} +2 -2
  33. package/dist/{cli-1c6tzt8g.js → cli-bbw9wj9m.js} +8 -8
  34. package/dist/{cli-pjctyea3.js → cli-bshb7jas.js} +2 -2
  35. package/dist/{cli-08bmz9z9.js → cli-btfsp3mv.js} +3 -3
  36. package/dist/{cli-4zsenjhy.js → cli-c0kqky8y.js} +16 -3
  37. package/dist/{cli-tgrv9cjx.js → cli-dq8x79v8.js} +1 -1
  38. package/dist/{cli-ftyxyspd.js → cli-eqtfgfr6.js} +1 -1
  39. package/dist/{cli-ddaanqkd.js → cli-eyg1pa00.js} +3 -3
  40. package/dist/{cli-8sckt74b.js → cli-fyhr5h4s.js} +34 -12
  41. package/dist/{cli-q3tkegby.js → cli-fzachfnf.js} +1 -1
  42. package/dist/{cli-ayayvfg4.js → cli-ga786dzg.js} +13 -10
  43. package/dist/{cli-yyj3j5m4.js → cli-gazw7kpa.js} +2 -2
  44. package/dist/{cli-e46hg0xw.js → cli-gvx71kqv.js} +2 -2
  45. package/dist/{cli-pc6n7fre.js → cli-jdv6ypxs.js} +1 -1
  46. package/dist/{cli-cm5yqn35.js → cli-kf3pxxdg.js} +1 -0
  47. package/dist/{cli-6g0hb4cp.js → cli-kyr67fgx.js} +7 -7
  48. package/dist/{cli-95jzxcp3.js → cli-m0hmeqma.js} +2 -2
  49. package/dist/{cli-6pfd54vx.js → cli-msg9m2ny.js} +3 -1
  50. package/dist/{cli-afkqkrtw.js → cli-nbsf8yvn.js} +15 -3
  51. package/dist/{cli-tfyyvzx6.js → cli-njwac61j.js} +5 -0
  52. package/dist/{cli-vz22fyqv.js → cli-nn3ysbqk.js} +1 -1
  53. package/dist/{cli-m0da8j35.js → cli-p3vsj0d3.js} +5 -5
  54. package/dist/{cli-72v799xn.js → cli-ppjxh6ah.js} +3 -3
  55. package/dist/{cli-k899ehvh.js → cli-q4ebh7h7.js} +4 -4
  56. package/dist/{cli-75gkpjvw.js → cli-qd57hhhh.js} +2 -2
  57. package/dist/{cli-qh4d4tvk.js → cli-rjknb2ae.js} +4 -4
  58. package/dist/{cli-caj33vcq.js → cli-s4ss5g59.js} +1 -1
  59. package/dist/{cli-cb2a8pna.js → cli-sq4n7af4.js} +1 -1
  60. package/dist/{cli-vfym7wmz.js → cli-ssnjfg5p.js} +5 -5
  61. package/dist/{cli-je518txm.js → cli-t60ajbbp.js} +8 -8
  62. package/dist/{cli-adeegh7d.js → cli-tpksw2nr.js} +21 -17
  63. package/dist/{cli-wk5yrfwd.js → cli-w4xnbm46.js} +150 -58
  64. package/dist/{cli-k8196sh2.js → cli-wemma3jd.js} +8 -7
  65. package/dist/{cli-cppkf404.js → cli-xq9r2wtt.js} +45 -21
  66. package/dist/{cli-bfv7vdg6.js → cli-xr8908my.js} +11 -11
  67. package/dist/{cli-73jzwksr.js → cli-ycscb2ar.js} +4 -1
  68. package/dist/{cli-p82cnnjq.js → cli-yqefz277.js} +1 -1
  69. package/dist/{cli-jtjtabxe.js → cli-z1srzaf6.js} +11 -3
  70. package/dist/{cli-pq73h5mz.js → cli-z75yxkjh.js} +3 -3
  71. package/dist/{cli-e5bzrn01.js → cli-zkky4t5g.js} +1 -1
  72. package/dist/cli.js +17 -15
  73. package/dist/{codex-adapter-cf2yxe9m.js → codex-adapter-88z6psm4.js} +5 -5
  74. package/dist/{codex-hook-a0c6g6t6.js → codex-hook-fac6175r.js} +1 -1
  75. package/dist/{codex-login-y0pmff1c.js → codex-login-74wa4hmq.js} +1 -1
  76. package/dist/{codex-session-runner-6vfzdgbd.js → codex-session-runner-zwbcwzvx.js} +5 -5
  77. package/dist/{commands-t3mfy7vn.js → commands-7amxs716.js} +3 -3
  78. package/dist/{controller-q7xrbaz0.js → controller-5rkkc37m.js} +2 -2
  79. package/dist/{controllers-connect-c6nm70kg.js → controllers-connect-m7d4vxxb.js} +19 -19
  80. package/dist/{cursor-adapter-ftd81ga8.js → cursor-adapter-x1q18693.js} +1 -1
  81. package/dist/{db-vemtpmcc.js → db-athc68zt.js} +4 -2
  82. package/dist/{db-dk572x25.js → db-h2fsfve3.js} +3 -3
  83. package/dist/{dispatcher-kh7ecxh9.js → dispatcher-b1yz2bnn.js} +17 -17
  84. package/dist/{dsh-adapter-v8628r89.js → dsh-adapter-e33bkxq9.js} +1 -1
  85. package/dist/{easter-egg-3d-nenw4x63.js → easter-egg-3d-pv5qnzc8.js} +1 -1
  86. package/dist/{embedding-space-0jepb239.js → embedding-space-b4txbwrk.js} +6 -6
  87. package/dist/{embeddings-xxt49yxg.js → embeddings-m6zn6tad.js} +1 -1
  88. package/dist/{execute-1mhw6e4x.js → execute-68nwny8m.js} +1 -1
  89. package/dist/{external-channel-55v12e60.js → external-channel-gkckmhzh.js} +2 -2
  90. package/dist/{fx-adapter-bs8wqrk5.js → fx-adapter-m5jbgd5q.js} +7 -7
  91. package/dist/{grok-adapter-gpjqmkcq.js → grok-adapter-csvv7sac.js} +7 -7
  92. package/dist/handlers-8x5gfbzx.js +32 -0
  93. package/dist/{heartbeat-k42svnr0.js → heartbeat-6c2y3267.js} +20 -20
  94. package/dist/{hook-6nphweh0.js → hook-q5fv0jy2.js} +6 -6
  95. package/dist/{hook-114m7hap.js → hook-w0q2wcrv.js} +5 -5
  96. package/dist/{http-r8cc4wz7.js → http-bxat8dg3.js} +260 -120
  97. package/dist/{index-nh3wyqdt.js → index-bxrexmfy.js} +13 -13
  98. package/dist/{index-e3s8wmxy.js → index-cqhqpgrv.js} +1 -1
  99. package/dist/{index-fpk4bcd9.js → index-fm0czesf.js} +1 -1
  100. package/dist/index-hpfte8jd.js +33 -0
  101. package/dist/index-ncf7yb5s.js +30 -0
  102. package/dist/index-vte6dyeh.js +37 -0
  103. package/dist/{keepalive-x060nt9p.js → keepalive-qnt21cv0.js} +3 -3
  104. package/dist/lead-4bvftzm6.js +71 -0
  105. package/dist/{maintenance-2xxfexhf.js → maintenance-btdr68y4.js} +1 -1
  106. package/dist/{oauth-refresh-sweep-fckc4ar5.js → oauth-refresh-sweep-vczabeh4.js} +2 -2
  107. package/dist/{onboard-zc48j237.js → onboard-k33ezyq8.js} +2 -2
  108. package/dist/{opencode-adapter-r690h1cr.js → opencode-adapter-3dst2ka7.js} +5 -5
  109. package/dist/{otel-impl-r5xbh81q.js → otel-impl-13am7a65.js} +1 -1
  110. package/dist/{pi-mono-adapter-c7v8sdec.js → pi-mono-adapter-c53de1gd.js} +15 -9
  111. package/dist/{pricing-refresh-3pmre11v.js → pricing-refresh-9fcbnq3f.js} +3 -3
  112. package/dist/{rbac-roles-910mmkgz.js → rbac-roles-66j5h4y5.js} +5 -3
  113. package/dist/{rbac-roles-3vbshwsb.js → rbac-roles-gw0p9h3j.js} +2 -2
  114. package/dist/{render-v2-pxykkbab.js → render-v2-fg8bmdn4.js} +3 -3
  115. package/dist/{resume-adda0bwy.js → resume-1c8kr3nh.js} +6 -6
  116. package/dist/{runtime-fnbm7stk.js → runtime-tzf9j7tc.js} +1 -1
  117. package/dist/{session-access-2fvamrdc.js → session-access-d0atq10j.js} +7 -5
  118. package/dist/{session-source-backfill-08xvv0sm.js → session-source-backfill-0vscqmsa.js} +2 -2
  119. package/dist/{setup-1aqmvmh1.js → setup-tvfa7rwe.js} +1 -1
  120. package/dist/{virtual-modules-d2pjk9j1.js → virtual-modules-efxcp740.js} +2 -2
  121. package/dist/{work-objects-9s0yrm5j.js → work-objects-ks71xqeb.js} +20 -20
  122. package/dist/worker-e7v2bvm9.js +71 -0
  123. package/dist/{worker-follow-up-3q78fqmr.js → worker-follow-up-bfx0h9hg.js} +17 -17
  124. package/openapi.json +104 -24
  125. package/package.json +3 -1
  126. package/src/be/db/model-profiles.ts +1 -1
  127. package/src/be/db/session-tree.ts +9 -5
  128. package/src/be/db/session-visibility.ts +25 -9
  129. package/src/be/db/tasks/read.ts +11 -6
  130. package/src/be/db/tasks/write.ts +77 -7
  131. package/src/be/db-queries/tracker.ts +4 -2
  132. package/src/be/db.ts +49 -17
  133. package/src/be/migrations/271_subscription_usage_model.sql +30 -0
  134. package/src/be/model-validation.ts +19 -1
  135. package/src/be/rbac-roles.ts +21 -0
  136. package/src/be/runtime-pools/routing.ts +1 -1
  137. package/src/be/scripts/boot-args-schema.ts +95 -0
  138. package/src/be/scripts/extract-schema.ts +15 -10
  139. package/src/be/seed-scripts/catalog/boot-triage.inline.ts +1 -1
  140. package/src/be/seed-scripts/catalog/boot-triage.ts +1 -1
  141. package/src/be/seed-scripts/catalog/get-child-outputs.ts +1 -1
  142. package/src/be/seed-scripts/catalog/wait-for-task.ts +1 -1
  143. package/src/be/swarm-config-guard.ts +7 -0
  144. package/src/be/users.ts +6 -4
  145. package/src/commands/claude-managed-setup.ts +1 -1
  146. package/src/commands/runner.ts +26 -9
  147. package/src/extensions/contract-types.generated.ts +1 -1
  148. package/src/http/agents.ts +7 -1
  149. package/src/http/approval-requests.ts +30 -6
  150. package/src/http/codex-oauth-device.ts +2 -2
  151. package/src/http/index.ts +8 -0
  152. package/src/http/mcp-oauth.ts +6 -0
  153. package/src/http/mcp-servers.ts +8 -0
  154. package/src/http/models-catalog.ts +1 -1
  155. package/src/http/pages-public.ts +38 -1
  156. package/src/http/poll.ts +3 -4
  157. package/src/http/prompt-templates.ts +1 -1
  158. package/src/http/schedules.ts +4 -0
  159. package/src/http/script-runs.ts +6 -1
  160. package/src/http/session-access.ts +61 -6
  161. package/src/http/sessions.ts +23 -7
  162. package/src/http/tasks.ts +53 -9
  163. package/src/http/users.ts +30 -1
  164. package/src/http/utils.ts +2 -1
  165. package/src/http/workflows.ts +11 -7
  166. package/src/prompts/session-templates.ts +1 -0
  167. package/src/providers/acp-targets.ts +1 -1
  168. package/src/providers/amp-adapter.ts +1 -1
  169. package/src/providers/codex-adapter.ts +9 -2
  170. package/src/providers/codex-oauth/device.ts +49 -15
  171. package/src/providers/codex-oauth/flow.ts +2 -1
  172. package/src/providers/pi-mono-adapter.ts +8 -0
  173. package/src/providers/pricing-sources.md +16 -1
  174. package/src/providers/swarm-events-shared.ts +15 -2
  175. package/src/rbac/legacy-policy.ts +1 -0
  176. package/src/rbac/permissions.ts +5 -0
  177. package/src/scheduler/deferred-task-waits.ts +9 -4
  178. package/src/scripts-runtime/extract-args-schema.ts +3 -1
  179. package/src/scripts-runtime/swarm-sdk.ts +1 -1
  180. package/src/scripts-runtime/types/swarm-extension.d.ts +29 -28
  181. package/src/server-user.ts +1 -1
  182. package/src/slack/ack.ts +48 -12
  183. package/src/slack/blocks.ts +1 -0
  184. package/src/slack/reaction-shortcode.ts +8 -2
  185. package/src/slack/render-v2.ts +30 -3
  186. package/src/slack/task-output.ts +4 -1
  187. package/src/slack/thread-buffer.ts +2 -2
  188. package/src/tasks/task-skip.ts +28 -0
  189. package/src/tasks/terminal-result-guard.ts +3 -2
  190. package/src/telemetry.ts +28 -1
  191. package/src/tests/agentmail-inbox-mapping.test.ts +73 -0
  192. package/src/tests/approval-requests.test.ts +58 -0
  193. package/src/tests/claude-managed-setup.test.ts +36 -0
  194. package/src/tests/codex-adapter.test.ts +2 -2
  195. package/src/tests/codex-oauth-device.test.ts +60 -0
  196. package/src/tests/codex-swarm-events.test.ts +43 -1
  197. package/src/tests/context-window.test.ts +14 -0
  198. package/src/tests/db-queries-tracker.test.ts +2 -1
  199. package/src/tests/db-task-read-contract.test.ts +1 -0
  200. package/src/tests/db-task-write-contract.test.ts +2 -0
  201. package/src/tests/deferred-task-wake.test.ts +7 -2
  202. package/src/tests/e2e-coverage-contract.test.ts +235 -0
  203. package/src/tests/empty-output-schema.test.ts +160 -0
  204. package/src/tests/env-flag.test.ts +1 -0
  205. package/src/tests/explicit-model-validation.test.ts +14 -0
  206. package/src/tests/http-api-integration.test.ts +2 -2
  207. package/src/tests/http-users.test.ts +63 -0
  208. package/src/tests/mcp-input-caps.test.ts +4 -3
  209. package/src/tests/merge-gate-detect-changes.test.ts +22 -0
  210. package/src/tests/pages-authed-mode.test.ts +13 -2
  211. package/src/tests/pi-mono-adapter.test.ts +39 -4
  212. package/src/tests/rbac-engine.test.ts +1 -0
  213. package/src/tests/runner-context-usage.test.ts +119 -0
  214. package/src/tests/script-connections.test.ts +2 -0
  215. package/src/tests/script-executor-quickjs.test.ts +2 -0
  216. package/src/tests/script-runs-http.test.ts +57 -0
  217. package/src/tests/scripts-boot-args-schema.test.ts +181 -0
  218. package/src/tests/scripts-runtime.test.ts +24 -0
  219. package/src/tests/sdk-store-progress-skipped.test.ts +155 -0
  220. package/src/tests/session-costs-model-key-normalize.test.ts +59 -0
  221. package/src/tests/session-sharing.test.ts +212 -2
  222. package/src/tests/slack-reaction-config.test.ts +1 -0
  223. package/src/tests/slack-render-v2.test.ts +73 -0
  224. package/src/tests/slack-skip-reaction.test.ts +203 -0
  225. package/src/tests/store-progress-skipped.test.ts +159 -0
  226. package/src/tests/subscription-usage-migration.test.ts +57 -0
  227. package/src/tests/swarm-config-reserved-keys.test.ts +3 -0
  228. package/src/tests/telemetry-endpoint-override.test.ts +27 -0
  229. package/src/tests/trigger-claiming.test.ts +2 -0
  230. package/src/tests/workflow-system-one-extraction.test.ts +29 -0
  231. package/src/tools/create-channel.ts +1 -1
  232. package/src/tools/defer-task.ts +1 -1
  233. package/src/tools/register-agentmail-inbox.ts +5 -0
  234. package/src/tools/repos/update-repo.ts +1 -1
  235. package/src/tools/request-human-input.ts +1 -1
  236. package/src/tools/send-task.ts +1 -1
  237. package/src/tools/store-progress.ts +39 -8
  238. package/src/tools/tracker/tracker-unlink.ts +2 -1
  239. package/src/tools/workflows/retry-workflow-run.ts +3 -0
  240. package/src/types.ts +11 -2
  241. package/src/utils/context-window.ts +6 -1
  242. package/src/utils/output-schema.ts +23 -0
  243. package/src/workflows/executors/system-one-providers.ts +25 -6
  244. package/src/workflows/recovery.ts +8 -4
  245. package/src/workflows/resume.ts +19 -0
  246. package/dist/handlers-zxmp1ta4.js +0 -32
  247. package/dist/index-a8phxqnk.js +0 -37
  248. package/dist/index-k6h00t4c.js +0 -30
  249. package/dist/index-xrz7te8h.js +0 -33
  250. package/dist/lead-956sd2yc.js +0 -71
  251. package/dist/worker-y15hy08h.js +0 -71
@@ -252,6 +252,7 @@ import {
252
252
  completeTask2,
253
253
  failTask2,
254
254
  cancelTask2,
255
+ skipTask2,
255
256
  supersedeTask2,
256
257
  settleSupersededTaskDependents2,
257
258
  backfillSupersedeTaskResumeTaskId2,
@@ -299,7 +300,6 @@ import {
299
300
  getUnassignedTaskIdsForAgent2,
300
301
  updateAgentProfile2,
301
302
  updateAgentName2,
302
- getInboxSummary2,
303
303
  claimMentions2,
304
304
  createSessionLogs2,
305
305
  getSessionLogsByTaskId2,
@@ -479,7 +479,7 @@ import {
479
479
  countScriptRunJournalSteps2,
480
480
  countScriptRunJournalAgentTaskSteps2,
481
481
  init_db4
482
- } from "./cli-wk5yrfwd.js";
482
+ } from "./cli-w4xnbm46.js";
483
483
  import {
484
484
  PRIMARY_ROLE_NAMES2,
485
485
  getUserGrant2,
@@ -490,8 +490,8 @@ import {
490
490
  assertNotLastAdmin2,
491
491
  setUserRoles2,
492
492
  init_rbac_roles
493
- } from "./cli-jtjtabxe.js";
494
- import"./cli-qh4d4tvk.js";
493
+ } from "./cli-z1srzaf6.js";
494
+ import"./cli-rjknb2ae.js";
495
495
  import {
496
496
  upsertModelCatalogOverlay,
497
497
  deleteModelCatalogOverlay,
@@ -499,12 +499,12 @@ import {
499
499
  init_model_catalog_store,
500
500
  requestModelCatalogRefresh2,
501
501
  init_pricing_refresh
502
- } from "./cli-5b456bpf.js";
502
+ } from "./cli-1cxrbkk6.js";
503
503
  import {
504
504
  workflowEventBus2,
505
505
  init_event_bus
506
506
  } from "./cli-wx3rhnm0.js";
507
- import"./cli-rtt8g4v9.js";
507
+ import"./cli-0ykgn1h5.js";
508
508
  import {
509
509
  require_dist4,
510
510
  getSlackConnectionState,
@@ -535,12 +535,12 @@ import {
535
535
  startSlackApp2,
536
536
  stopSlackApp2,
537
537
  init_app3
538
- } from "./cli-cppkf404.js";
538
+ } from "./cli-xq9r2wtt.js";
539
539
  import {
540
540
  retryFailedRun2,
541
541
  cancelWorkflowRun2,
542
542
  init_resume
543
- } from "./cli-afkqkrtw.js";
543
+ } from "./cli-nbsf8yvn.js";
544
544
  import {
545
545
  DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
546
546
  SUPPORTED_PROTOCOL_VERSIONS,
@@ -771,6 +771,8 @@ import {
771
771
  init_app2,
772
772
  init_linear,
773
773
  init_slack,
774
+ verifyPageSession,
775
+ LEGACY_PAGE_SESSION_COOKIE,
774
776
  isCookieSafePageId,
775
777
  extractPageSession,
776
778
  extractLegacyPageSession,
@@ -940,6 +942,9 @@ import {
940
942
  steerTaskOutputSchema,
941
943
  steerTaskHandler,
942
944
  init_steer_task,
945
+ skipReasonFrom,
946
+ finalizeSkippedTaskReaction,
947
+ init_task_skip,
943
948
  canClaim,
944
949
  init_budget_admission,
945
950
  emitBudgetRefusalSideEffects,
@@ -959,7 +964,7 @@ import {
959
964
  getEnabledCapabilities,
960
965
  createServer,
961
966
  init_server
962
- } from "./cli-ws19768n.js";
967
+ } from "./cli-8sdejs1f.js";
963
968
  import {
964
969
  FilesError,
965
970
  normalizeFilesError,
@@ -991,7 +996,7 @@ import {
991
996
  resolvePoolDelivery2,
992
997
  createPoolAgent2,
993
998
  init_db2
994
- } from "./cli-ddaanqkd.js";
999
+ } from "./cli-eyg1pa00.js";
995
1000
  import {
996
1001
  duplicateGuardedQueryKey,
997
1002
  warnIfCorsAllowsAnyOrigin,
@@ -1029,6 +1034,7 @@ import {
1029
1034
  resolveHttpFavoriteOwner,
1030
1035
  init_favorite_owner,
1031
1036
  resolveSessionActor2,
1037
+ withReadAll2,
1032
1038
  sessionAccessFor2,
1033
1039
  SESSION_READ_DENIED2,
1034
1040
  canReadSession2,
@@ -1045,7 +1051,7 @@ import {
1045
1051
  describeRequestRoute,
1046
1052
  route,
1047
1053
  init_route_def
1048
- } from "./cli-8sckt74b.js";
1054
+ } from "./cli-fyhr5h4s.js";
1049
1055
  import {
1050
1056
  startPoolRouting,
1051
1057
  stopPoolRouting,
@@ -1058,17 +1064,17 @@ import {
1058
1064
  checkHeartbeatChecklist2,
1059
1065
  runHeartbeatSweep2,
1060
1066
  stopHeartbeat2
1061
- } from "./cli-bfv7vdg6.js";
1062
- import"./cli-3fg0bdcv.js";
1067
+ } from "./cli-xr8908my.js";
1068
+ import"./cli-8h0ayw8c.js";
1063
1069
  import {
1064
1070
  runtimeSupervisorStatus,
1065
1071
  startRuntimeSupervisor,
1066
1072
  stopRuntimeSupervisor
1067
- } from "./cli-je518txm.js";
1073
+ } from "./cli-t60ajbbp.js";
1068
1074
  import {
1069
1075
  TASK_TITLE_TIMEOUT_MS,
1070
1076
  generateTaskTitle
1071
- } from "./cli-vz22fyqv.js";
1077
+ } from "./cli-nn3ysbqk.js";
1072
1078
  import"./cli-ns59dc6r.js";
1073
1079
  import {
1074
1080
  ACP_TARGET_IDS
@@ -1089,11 +1095,11 @@ import {
1089
1095
  isUnknownModelError,
1090
1096
  checkProviderPoolKey,
1091
1097
  writeSkillsToFilesystem
1092
- } from "./cli-yyj3j5m4.js";
1098
+ } from "./cli-gazw7kpa.js";
1093
1099
  import {
1094
1100
  inviteEmailToSharedOrg,
1095
1101
  ensureAgentFsCredentialsForAgent
1096
- } from "./cli-pjctyea3.js";
1102
+ } from "./cli-bshb7jas.js";
1097
1103
  import {
1098
1104
  Anthropic
1099
1105
  } from "./cli-318r69gq.js";
@@ -1109,7 +1115,7 @@ import {
1109
1115
  ampBillsCacheWrites,
1110
1116
  resolveAmpModel,
1111
1117
  init_amp_models
1112
- } from "./cli-35rsp8ye.js";
1118
+ } from "./cli-3e4snnzf.js";
1113
1119
  import {
1114
1120
  RATING_MODEL_MAX_LENGTH,
1115
1121
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -1119,7 +1125,7 @@ import {
1119
1125
  import {
1120
1126
  normalizeModelKey,
1121
1127
  init_pricing_normalize
1122
- } from "./cli-pc6n7fre.js";
1128
+ } from "./cli-jdv6ypxs.js";
1123
1129
  import {
1124
1130
  require_dist2,
1125
1131
  getMcpOAuthToken,
@@ -1208,7 +1214,7 @@ import {
1208
1214
  init_typecheck,
1209
1215
  parseSkillContent,
1210
1216
  init_skill_parser
1211
- } from "./cli-adeegh7d.js";
1217
+ } from "./cli-tpksw2nr.js";
1212
1218
  import {
1213
1219
  signalProcessGroup,
1214
1220
  detachedProcessGroup,
@@ -1225,7 +1231,7 @@ import {
1225
1231
  forceRefreshAuthorizationOrThrow,
1226
1232
  forceRefreshTokenOrThrow,
1227
1233
  init_ensure_token
1228
- } from "./cli-q3tkegby.js";
1234
+ } from "./cli-fzachfnf.js";
1229
1235
  import {
1230
1236
  automationIntegrationFixUrl,
1231
1237
  preflightAutomation,
@@ -1269,7 +1275,7 @@ import {
1269
1275
  definitionNodeIds,
1270
1276
  validateDefinition,
1271
1277
  init_definition2
1272
- } from "./cli-nmzhp1b5.js";
1278
+ } from "./cli-7axf41jq.js";
1273
1279
  import {
1274
1280
  _fetchHolder,
1275
1281
  CLIENT_ID,
@@ -1285,7 +1291,7 @@ import {
1285
1291
  loadAllCodexOAuthSlots,
1286
1292
  getValidCodexOAuth,
1287
1293
  init_storage
1288
- } from "./cli-75gkpjvw.js";
1294
+ } from "./cli-qd57hhhh.js";
1289
1295
  import {
1290
1296
  isMultiRuntimeEnabled,
1291
1297
  init_multi_runtime2
@@ -1293,7 +1299,7 @@ import {
1293
1299
  import {
1294
1300
  require_content_type
1295
1301
  } from "./cli-yjdgea32.js";
1296
- import"./cli-g08zdaec.js";
1302
+ import"./cli-66ww7fer.js";
1297
1303
  import {
1298
1304
  isInvalidClientError,
1299
1305
  publicEndpointSsrfOptions,
@@ -1311,7 +1317,7 @@ import {
1311
1317
  revokeMcpToken,
1312
1318
  computeExpiresAt,
1313
1319
  init_mcp_wrapper
1314
- } from "./cli-caj33vcq.js";
1320
+ } from "./cli-s4ss5g59.js";
1315
1321
  import {
1316
1322
  createRuntimeProvider,
1317
1323
  init_runtime_providers
@@ -1342,7 +1348,7 @@ import {
1342
1348
  revokeAgentTokens,
1343
1349
  fingerprintApiKey,
1344
1350
  init_users
1345
- } from "./cli-5jnhv72d.js";
1351
+ } from "./cli-269q28a1.js";
1346
1352
  import"./cli-v41kn3cd.js";
1347
1353
  import {
1348
1354
  setBedrockProviderModule,
@@ -1361,7 +1367,7 @@ import {
1361
1367
  clearAuditSink,
1362
1368
  can,
1363
1369
  init_rbac
1364
- } from "./cli-tfyyvzx6.js";
1370
+ } from "./cli-njwac61j.js";
1365
1371
  import {
1366
1372
  ASSET_KEY_MAX_LENGTH,
1367
1373
  normalizeAssetKey,
@@ -1519,7 +1525,7 @@ import {
1519
1525
  KvKeySchema,
1520
1526
  KvEntrySchema,
1521
1527
  init_types4
1522
- } from "./cli-n6bv12jn.js";
1528
+ } from "./cli-5j0m12ns.js";
1523
1529
  import {
1524
1530
  CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
1525
1531
  CODEX_AUTH_WATCH_NAMESPACE,
@@ -1530,7 +1536,7 @@ import {
1530
1536
  IDENTITY_FIELD_BUDGETS,
1531
1537
  IdentityFieldBudgetError,
1532
1538
  init_identity_field_budget
1533
- } from "./cli-tgrv9cjx.js";
1539
+ } from "./cli-dq8x79v8.js";
1534
1540
  import {
1535
1541
  getSlackConfiguration,
1536
1542
  init_config4
@@ -1567,7 +1573,7 @@ import {
1567
1573
  resolveTemplate,
1568
1574
  init_resolver,
1569
1575
  init_session_templates
1570
- } from "./cli-cm5yqn35.js";
1576
+ } from "./cli-kf3pxxdg.js";
1571
1577
  import {
1572
1578
  init_zod
1573
1579
  } from "./cli-k5671be5.js";
@@ -1599,7 +1605,7 @@ import {
1599
1605
  import {
1600
1606
  init_package,
1601
1607
  package_default
1602
- } from "./cli-6pfd54vx.js";
1608
+ } from "./cli-msg9m2ny.js";
1603
1609
  import {
1604
1610
  realtimeBus,
1605
1611
  init_bus
@@ -5407,7 +5413,7 @@ var updateAgentProfileRoute = route({
5407
5413
  profileSyncRejection: ProfileSyncRejectionSchema.optional()
5408
5414
  })
5409
5415
  },
5410
- 404: { description: "Agent not found" }
5416
+ 404: { description: "Agent not found, or changedByAgentId names no agent" }
5411
5417
  }
5412
5418
  });
5413
5419
  var updateAgentActivityRoute = route({
@@ -5722,6 +5728,10 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, myAgentId)
5722
5728
  jsonError(res, "At least one field (role, description, capabilities, claudeMd, soulMd, identityMd, setupScript, toolsMd, heartbeatMd, avatar, or slackIcon) must be provided", 400);
5723
5729
  return true;
5724
5730
  }
5731
+ if (body.changedByAgentId && !await getAgentById2(body.changedByAgentId)) {
5732
+ jsonError(res, "changed_by_agent_not_found", 404);
5733
+ return true;
5734
+ }
5725
5735
  const validChangeSources = ["self_edit", "lead_coaching", "api", "system", "session_sync"];
5726
5736
  const versionMeta = body.changeSource || body.changedByAgentId || body.changeReason ? {
5727
5737
  changeSource: validChangeSources.includes(body.changeSource ?? "") ? body.changeSource : undefined,
@@ -7815,7 +7825,10 @@ var QuestionSchema = object2({
7815
7825
  defaultValue: boolean().optional(),
7816
7826
  config: ConfigQuestionSettingsSchema.optional().describe("Config question settings. Answers are written to swarm_config and replaced by a result that never holds a secret value.")
7817
7827
  });
7818
- var QuestionInputSchema = QuestionSchema.extend({ label: string2().optional() });
7828
+ var QuestionInputSchema = QuestionSchema.extend({
7829
+ label: string2().optional(),
7830
+ required: boolean().default(true)
7831
+ });
7819
7832
  var ApproversSchema = object2({
7820
7833
  users: array2(string2()).optional(),
7821
7834
  roles: array2(string2()).optional(),
@@ -7961,8 +7974,18 @@ function hasRequiredResponse(question, response) {
7961
7974
  }
7962
7975
  }
7963
7976
  }
7977
+ function isUnanswered(response) {
7978
+ return response === undefined || response === null || typeof response === "string" && response.trim() === "" || Array.isArray(response) && response.length === 0;
7979
+ }
7964
7980
  function missingRequiredResponseIds(questions, responses) {
7965
- return questions.filter((question) => question.required && !hasRequiredResponse(question, responses[question.id])).map((question) => question.id);
7981
+ return questions.filter((question) => {
7982
+ const response = responses[question.id];
7983
+ if (hasRequiredResponse(question, response))
7984
+ return false;
7985
+ if (question.required)
7986
+ return true;
7987
+ return question.type !== "config" && !isUnanswered(response);
7988
+ }).map((question) => question.id);
7966
7989
  }
7967
7990
  var createRoute = route({
7968
7991
  method: "post",
@@ -8142,7 +8165,7 @@ async function handleApprovalRequests(req, res, pathSegments, queryParams) {
8142
8165
  const questions = existing.questions;
8143
8166
  const missingRequired = missingRequiredResponseIds(questions, parsed.body.responses);
8144
8167
  if (missingRequired.length > 0) {
8145
- jsonError(res, `Required responses missing or invalid: ${missingRequired.join(", ")}`, 400);
8168
+ jsonError(res, `Responses missing or invalid: ${missingRequired.join(", ")}`, 400);
8146
8169
  return true;
8147
8170
  }
8148
8171
  const configQuestions = questions.filter(isConfigQuestion);
@@ -9779,11 +9802,27 @@ init_auth_json();
9779
9802
 
9780
9803
  // src/providers/codex-oauth/device.ts
9781
9804
  init_flow();
9782
- var DEVICE_CODE_URL = "https://auth.openai.com/api/accounts/deviceauth/usercode";
9783
- var DEVICE_TOKEN_URL = "https://auth.openai.com/api/accounts/deviceauth/token";
9784
- var DEVICE_REDIRECT_URI = "https://auth.openai.com/deviceauth/callback";
9805
+ var DEFAULT_DEVICE_BASE_URL = "https://auth.openai.com";
9785
9806
  var UPSTREAM_TIMEOUT_MS = 15000;
9786
- var CODEX_DEVICE_VERIFICATION_URL = "https://auth.openai.com/codex/device";
9807
+ function resolveCodexDeviceBaseUrl(raw) {
9808
+ const configured = raw?.trim();
9809
+ if (!configured)
9810
+ return DEFAULT_DEVICE_BASE_URL;
9811
+ try {
9812
+ const url = new URL(configured);
9813
+ const loopback = url.hostname === "127.0.0.1" || url.hostname === "localhost" || url.hostname === "[::1]";
9814
+ if (url.protocol === "http:" && loopback)
9815
+ return url.origin;
9816
+ } catch {}
9817
+ console.warn("[codex-oauth] CODEX_OAUTH_DEVICE_BASE_URL must be a loopback http origin; ignored");
9818
+ return DEFAULT_DEVICE_BASE_URL;
9819
+ }
9820
+ function deviceBaseUrl() {
9821
+ return resolveCodexDeviceBaseUrl(process.env.CODEX_OAUTH_DEVICE_BASE_URL);
9822
+ }
9823
+ function codexDeviceVerificationUrl() {
9824
+ return `${deviceBaseUrl()}/codex/device`;
9825
+ }
9787
9826
 
9788
9827
  class DeviceCodeNotEnabledError extends Error {
9789
9828
  }
@@ -9798,7 +9837,7 @@ function parseInterval(value) {
9798
9837
  return 5;
9799
9838
  }
9800
9839
  async function requestDeviceCode() {
9801
- const response = await _fetchHolder.current(DEVICE_CODE_URL, {
9840
+ const response = await _fetchHolder.current(`${deviceBaseUrl()}/api/accounts/deviceauth/usercode`, {
9802
9841
  method: "POST",
9803
9842
  headers: {
9804
9843
  "Content-Type": "application/json",
@@ -9825,7 +9864,7 @@ async function requestDeviceCode() {
9825
9864
  };
9826
9865
  }
9827
9866
  async function pollDeviceToken(deviceAuthId, userCode) {
9828
- const response = await _fetchHolder.current(DEVICE_TOKEN_URL, {
9867
+ const response = await _fetchHolder.current(`${deviceBaseUrl()}/api/accounts/deviceauth/token`, {
9829
9868
  method: "POST",
9830
9869
  headers: {
9831
9870
  "Content-Type": "application/json",
@@ -9850,7 +9889,7 @@ async function pollDeviceToken(deviceAuthId, userCode) {
9850
9889
  };
9851
9890
  }
9852
9891
  async function exchangeDeviceAuthorizationCode(authorizationCode, codeVerifier) {
9853
- const token = await exchangeAuthorizationCode2(authorizationCode, codeVerifier, DEVICE_REDIRECT_URI, AbortSignal.timeout(UPSTREAM_TIMEOUT_MS));
9892
+ const token = await exchangeAuthorizationCode2(authorizationCode, codeVerifier, `${deviceBaseUrl()}/deviceauth/callback`, AbortSignal.timeout(UPSTREAM_TIMEOUT_MS), `${deviceBaseUrl()}/oauth/token`);
9854
9893
  if (token.type !== "success")
9855
9894
  return null;
9856
9895
  const accountId = getAccountId(token.access);
@@ -10101,7 +10140,7 @@ async function handleCodexOAuthDevice(req, res, pathSegments, queryParams) {
10101
10140
  startDeviceFlow.respond(res, 200, {
10102
10141
  flowId,
10103
10142
  userCode: device.userCode,
10104
- verificationUrl: CODEX_DEVICE_VERIFICATION_URL,
10143
+ verificationUrl: codexDeviceVerificationUrl(),
10105
10144
  intervalSeconds: device.intervalSeconds,
10106
10145
  expiresAt: new Date(expiresAt).toISOString()
10107
10146
  });
@@ -11088,6 +11127,7 @@ declare module "swarm-extension" {
11088
11127
  agentId?: string | null | undefined;
11089
11128
  creatorAgentId?: string | undefined;
11090
11129
  source?:
11130
+ | "chat"
11091
11131
  | "workflow"
11092
11132
  | "schedule"
11093
11133
  | "slack"
@@ -11103,7 +11143,6 @@ declare module "swarm-extension" {
11103
11143
  | "ui"
11104
11144
  | "system"
11105
11145
  | "comb"
11106
- | "chat"
11107
11146
  | undefined;
11108
11147
  routingReason?:
11109
11148
  | "skill"
@@ -11143,7 +11182,7 @@ declare module "swarm-extension" {
11143
11182
  parentTaskId?: string | undefined;
11144
11183
  model?: string | undefined;
11145
11184
  modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;
11146
- effort?: "off" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11185
+ effort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;
11147
11186
  profile?: string | undefined;
11148
11187
  scheduleId?: string | undefined;
11149
11188
  workflowRunId?: string | undefined;
@@ -11170,18 +11209,18 @@ declare module "swarm-extension" {
11170
11209
  sourceAgentId?: string | undefined;
11171
11210
  role?: string | undefined;
11172
11211
  harnessProvider?:
11173
- | "claude"
11174
- | "codex"
11175
11212
  | "pi"
11176
- | "devin"
11213
+ | "claude"
11177
11214
  | "claude-managed"
11215
+ | "codex"
11216
+ | "grok"
11217
+ | "fx"
11178
11218
  | "opencode"
11179
- | "acp"
11180
11219
  | "dsh"
11181
- | "amp"
11182
11220
  | "cursor"
11183
- | "grok"
11184
- | "fx"
11221
+ | "amp"
11222
+ | "devin"
11223
+ | "acp"
11185
11224
  | undefined;
11186
11225
  leadOnly?: boolean | undefined;
11187
11226
  }
@@ -11194,6 +11233,7 @@ declare module "swarm-extension" {
11194
11233
  agentId: string | null;
11195
11234
  task: string;
11196
11235
  status:
11236
+ | "skipped"
11197
11237
  | "draft"
11198
11238
  | "backlog"
11199
11239
  | "unassigned"
@@ -11207,6 +11247,7 @@ declare module "swarm-extension" {
11207
11247
  | "cancelled"
11208
11248
  | "superseded";
11209
11249
  source:
11250
+ | "chat"
11210
11251
  | "workflow"
11211
11252
  | "schedule"
11212
11253
  | "slack"
@@ -11221,8 +11262,7 @@ declare module "swarm-extension" {
11221
11262
  | "api"
11222
11263
  | "ui"
11223
11264
  | "system"
11224
- | "comb"
11225
- | "chat";
11265
+ | "comb";
11226
11266
  tags: string[];
11227
11267
  priority: number;
11228
11268
  dependsOn: string[];
@@ -11277,11 +11317,11 @@ declare module "swarm-extension" {
11277
11317
  claudeSessionId?: string | undefined;
11278
11318
  model?: string | undefined;
11279
11319
  modelTier?: "smol" | "regular" | "smart" | "ultra" | undefined;
11280
- effort?: "off" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11320
+ effort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;
11281
11321
  resolvedModel?: string | undefined;
11282
11322
  modelSource?: string | undefined;
11283
11323
  modelAlias?: string | undefined;
11284
- resolvedEffort?: "off" | "low" | "medium" | "high" | "xhigh" | "max" | undefined;
11324
+ resolvedEffort?: "low" | "medium" | "high" | "max" | "off" | "xhigh" | undefined;
11285
11325
  profile?: string | undefined;
11286
11326
  resolvedProfile?: string | undefined;
11287
11327
  scheduleId?: string | undefined;
@@ -11306,18 +11346,18 @@ declare module "swarm-extension" {
11306
11346
  requestedByUserId?: string | undefined;
11307
11347
  swarmVersion?: string | undefined;
11308
11348
  provider?:
11309
- | "claude"
11310
- | "codex"
11311
11349
  | "pi"
11312
- | "devin"
11350
+ | "claude"
11313
11351
  | "claude-managed"
11352
+ | "codex"
11353
+ | "grok"
11354
+ | "fx"
11314
11355
  | "opencode"
11315
- | "acp"
11316
11356
  | "dsh"
11317
- | "amp"
11318
11357
  | "cursor"
11319
- | "grok"
11320
- | "fx"
11358
+ | "amp"
11359
+ | "devin"
11360
+ | "acp"
11321
11361
  | undefined;
11322
11362
  providerMeta?: Record<string, unknown> | undefined;
11323
11363
  harnessVariant?: string | undefined;
@@ -11329,18 +11369,18 @@ declare module "swarm-extension" {
11329
11369
  sourceAgentId?: string | undefined;
11330
11370
  role?: string | undefined;
11331
11371
  harnessProvider?:
11332
- | "claude"
11333
- | "codex"
11334
11372
  | "pi"
11335
- | "devin"
11373
+ | "claude"
11336
11374
  | "claude-managed"
11375
+ | "codex"
11376
+ | "grok"
11377
+ | "fx"
11337
11378
  | "opencode"
11338
- | "acp"
11339
11379
  | "dsh"
11340
- | "amp"
11341
11380
  | "cursor"
11342
- | "grok"
11343
- | "fx"
11381
+ | "amp"
11382
+ | "devin"
11383
+ | "acp"
11344
11384
  | undefined;
11345
11385
  leadOnly?: boolean | undefined;
11346
11386
  }
@@ -11364,7 +11404,7 @@ declare module "swarm-extension" {
11364
11404
 
11365
11405
  export type SteerMode = "steer" | "queue";
11366
11406
 
11367
- export type SteeringSource = "script" | "slack" | "mcp" | "api" | "ui" | "chat";
11407
+ export type SteeringSource = "chat" | "script" | "slack" | "mcp" | "api" | "ui";
11368
11408
 
11369
11409
  export type RequestInfo = {
11370
11410
  sessionId: string | undefined;
@@ -18720,7 +18760,10 @@ var metadataRoute = route({
18720
18760
  schema: MetadataResponseSchema
18721
18761
  },
18722
18762
  400: { description: "MCP has no URL / invalid transport" },
18723
- 404: { description: "MCP server not found" }
18763
+ 404: { description: "MCP server not found" },
18764
+ 502: {
18765
+ description: "Metadata discovery failed: the protected-resource or authorization-server metadata could not be fetched or was refused by the egress guard"
18766
+ }
18724
18767
  }
18725
18768
  });
18726
18769
  var statusRoute = route({
@@ -18820,6 +18863,7 @@ var disconnectRoute = route({
18820
18863
  path: "/api/mcp-oauth/{mcpServerId}",
18821
18864
  pattern: ["api", "mcp-oauth", null],
18822
18865
  summary: "Revoke and delete the OAuth token for an MCP server",
18866
+ description: "Idempotent: the connection row is kept with status revoked (its tokens are cleared) and the server returns to static auth, so a repeat call answers 200 and /status keeps returning the revoked token object.",
18823
18867
  tags: ["MCP OAuth"],
18824
18868
  auth: { apiKey: true },
18825
18869
  params: object2({ mcpServerId: string2() }),
@@ -19393,7 +19437,10 @@ var createMcpServerRoute = route({
19393
19437
  }),
19394
19438
  responses: {
19395
19439
  201: { description: "MCP server created", schema: object2({ server: McpServerSchema }) },
19396
- 400: { description: "Validation error" }
19440
+ 400: { description: "Validation error" },
19441
+ 409: {
19442
+ description: "A server with this name already exists in the same scope and owner (mcp_server_name_taken)"
19443
+ }
19397
19444
  },
19398
19445
  rbac: { permission: "mcp-server.create.swarm" }
19399
19446
  });
@@ -19716,6 +19763,10 @@ async function handleMcpServers(req, res, pathSegments, queryParams) {
19716
19763
  await emitMcpServerConnectedTelemetry2();
19717
19764
  createMcpServerRoute.respond(res, 201, { server });
19718
19765
  } catch (err) {
19766
+ if (err instanceof Error && err.message.includes("UNIQUE constraint")) {
19767
+ jsonError(res, "mcp_server_name_taken", 409);
19768
+ return true;
19769
+ }
19719
19770
  jsonError(res, err instanceof Error ? err.message : "Create failed", 400);
19720
19771
  }
19721
19772
  return true;
@@ -19815,7 +19866,7 @@ var userSendTaskInputSchema = object2({
19815
19866
  priority: number2().int().min(0).max(100).optional().describe("Priority 0-100 (default: 50)."),
19816
19867
  model: string2().trim().min(1).optional().describe("Concrete model override interpreted by the assignee's harness/provider."),
19817
19868
  modelTier: ModelTierSchema.optional().describe("Portable model tier: 'smol', 'regular', 'smart', or 'ultra'. Resolved by the assignee's harness/provider."),
19818
- 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.")
19869
+ 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.")
19819
19870
  }).superRefine((data, ctx) => checkOutputSchemaShape(data.outputSchema, ctx));
19820
19871
  function permission(verb) {
19821
19872
  return { permission: verb };
@@ -22322,7 +22373,7 @@ var getCatalog = route({
22322
22373
  path: "/api/models-catalog",
22323
22374
  pattern: ["api", "models-catalog"],
22324
22375
  summary: "Get the live model catalog for the picker-reachable providers",
22325
- description: "Slim projection of the models.dev payload (openrouter / anthropic / openai / amazon-bedrock only), refreshed server-side at boot and every 12h by the pricing-refresh loop. `source` is 'snapshot' with `updatedAt: null` until the first successful fetch (or when models.dev is unreachable), in which case the vendored snapshot is served instead.",
22376
+ description: "Slim projection of the models.dev payload (the vendored models.dev snapshot, or the live fetch once one succeeds) plus the OpenAI-compatible registry providers; see the `providers` field for the live list. Refreshed server-side at boot and every 12h by the pricing-refresh loop. `source` is 'snapshot' with `updatedAt: null` until the first successful fetch (or when models.dev is unreachable), in which case the vendored snapshot is served instead.",
22326
22377
  tags: ["Pricing"],
22327
22378
  responses: {
22328
22379
  200: {
@@ -24292,6 +24343,7 @@ init_rbac();
24292
24343
  init_context_key();
24293
24344
  init_errors2();
24294
24345
  init_sibling_awareness();
24346
+ init_task_skip();
24295
24347
  init_terminal_result_guard();
24296
24348
  init_worker_follow_up();
24297
24349
  init_types4();
@@ -24470,7 +24522,7 @@ var listTasks = route({
24470
24522
  path: "/api/tasks",
24471
24523
  pattern: ["api", "tasks"],
24472
24524
  summary: "List tasks with filters",
24473
- description: "Returns tasks with the full `task` text replaced by a bounded `taskPreview` and completion/integration blobs dropped by default — list views only need the preview. Pass `fields=full` to restore the full `AgentTask`, or `fields=timeline` for the narrow shape the dashboard timeline draws. Every shape gives a user caller only tasks of sessions they can read. Fetch a single task in full via `GET /api/tasks/{id}`. `total` (the filtered row count, ignoring limit/offset) is computed only with `includeTotal=true`.",
24525
+ description: "Returns tasks with the full `task` text replaced by a bounded `taskPreview` and completion/integration blobs dropped by default — list views only need the preview. Pass `fields=full` to restore the full `AgentTask`, or `fields=timeline` for the narrow shape the dashboard timeline draws. Every shape gives a user caller only tasks of sessions they can read, unless `scope=all` applies. Fetch a single task in full via `GET /api/tasks/{id}`. `total` (the filtered row count, ignoring limit/offset) is computed only with `includeTotal=true`.",
24474
24526
  tags: ["Tasks"],
24475
24527
  query: object2({
24476
24528
  status: string2().optional(),
@@ -24489,7 +24541,8 @@ var listTasks = route({
24489
24541
  limit: exports_coerce.number().int().optional(),
24490
24542
  offset: exports_coerce.number().int().optional(),
24491
24543
  fields: _enum2(["full", "slim", "timeline"]).optional(),
24492
- includeTotal: _enum2(["true", "false"]).optional()
24544
+ includeTotal: _enum2(["true", "false"]).optional(),
24545
+ scope: _enum2(["all"]).optional().describe("all: every user's tasks, read-only, for a user with an admin role or session.read.all; ignored for anyone else. The X-Swarm-Session-Scope: all header opts in the same way.")
24493
24546
  }),
24494
24547
  responses: {
24495
24548
  200: {
@@ -24823,11 +24876,12 @@ var finishTask = route({
24823
24876
  path: "/api/tasks/{id}/finish",
24824
24877
  pattern: ["api", "tasks", null, "finish"],
24825
24878
  session: { taskParam: "id" },
24826
- summary: "Mark task as completed or failed (runner endpoint)",
24879
+ summary: "Mark task as completed, failed, or skipped (runner endpoint)",
24880
+ description: "`skipped` ends a task that is not the caller's to handle. It needs a one-line reason in `failureReason` (or `output`), keeps `output` empty, posts nothing, and creates no follow-up.",
24827
24881
  tags: ["Tasks"],
24828
24882
  params: object2({ id: string2() }),
24829
24883
  body: object2({
24830
- status: _enum2(["completed", "failed"]),
24884
+ status: _enum2(["completed", "failed", "skipped"]),
24831
24885
  output: string2().optional(),
24832
24886
  failureReason: string2().optional(),
24833
24887
  force: boolean().optional(),
@@ -24836,7 +24890,7 @@ var finishTask = route({
24836
24890
  auth: { apiKey: true, agentId: true },
24837
24891
  responses: {
24838
24892
  200: { description: "Task finished", schema: FinishTaskSuccessSchema },
24839
- 400: { description: "Invalid status" },
24893
+ 400: { description: "Invalid status, or a skip without a reason" },
24840
24894
  403: { description: "Not assigned to this agent" },
24841
24895
  404: { description: "Task not found" },
24842
24896
  409: {
@@ -25067,7 +25121,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25067
25121
  if (validated.length > 0)
25068
25122
  source = validated;
25069
25123
  }
25070
- const actor = await resolveSessionActor2(req, myAgentId);
25124
+ const actor = await resolveSessionActor2(req, myAgentId, {
25125
+ allUsers: parsed.query.scope === "all"
25126
+ });
25071
25127
  const filters = {
25072
25128
  status,
25073
25129
  agentId: parsed.query.agentId || undefined,
@@ -25085,7 +25141,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25085
25141
  orderBy: parsed.query.orderBy,
25086
25142
  limit: parsed.query.limit,
25087
25143
  offset: parsed.query.offset,
25088
- readableBy: actor.kind === "user" ? { userId: actor.userId } : undefined
25144
+ readableBy: readableByFor2(actor)
25089
25145
  };
25090
25146
  const tasks = parsed.query.fields === "full" ? await getAllTasks2(filters) : parsed.query.fields === "timeline" ? await getAllTasks2(filters, { fields: "timeline" }) : await getAllTasks2(filters, { slim: true });
25091
25147
  if (parsed.query.includeTotal === "true") {
@@ -25643,7 +25699,14 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25643
25699
  if (task.agentId && task.agentId !== myAgentId) {
25644
25700
  return { error: "Task is assigned to another agent", status: 403 };
25645
25701
  }
25646
- const terminalResultGuard = await guardTerminalTaskResultWrite(task, parsed.body);
25702
+ const skipReason = parsed.body.status === "skipped" ? skipReasonFrom(parsed.body.failureReason, parsed.body.output) : undefined;
25703
+ if (parsed.body.status === "skipped" && !skipReason) {
25704
+ return {
25705
+ error: 'Status "skipped" needs a one-line reason in failureReason',
25706
+ status: 400
25707
+ };
25708
+ }
25709
+ const terminalResultGuard = await guardTerminalTaskResultWrite(task, parsed.body.status === "skipped" ? { status: "skipped", failureReason: skipReason, force: parsed.body.force } : parsed.body);
25647
25710
  if (terminalResultGuard.handled) {
25648
25711
  const { handled: _handled, ...guardResult } = terminalResultGuard;
25649
25712
  return { ...guardResult, alreadyFinished: true };
@@ -25662,6 +25725,12 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25662
25725
  return { error: "Failed to complete task", status: 500 };
25663
25726
  }
25664
25727
  updatedTask = result;
25728
+ } else if (parsed.body.status === "skipped") {
25729
+ const result = await skipTask2(parsed.params.id, skipReason);
25730
+ if (!result) {
25731
+ return { error: "Failed to mark task as skipped", status: 500 };
25732
+ }
25733
+ updatedTask = result;
25665
25734
  } else {
25666
25735
  const result = await failTask2(parsed.params.id, parsed.body.failureReason || "Process exited without explicit completion");
25667
25736
  if (!result) {
@@ -25685,7 +25754,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25685
25754
  });
25686
25755
  return true;
25687
25756
  }
25688
- if (result.task && isFreshFinishResult(result)) {
25757
+ if (result.task && isFreshFinishResult(result) && parsed.body.status === "skipped") {
25758
+ finalizeSkippedTaskReaction(result.task, "tasks.finish");
25759
+ } else if (result.task && isFreshFinishResult(result)) {
25689
25760
  const finishEventId = parsed.body.status === "completed" ? "completed" : "failed";
25690
25761
  ensure({
25691
25762
  id: finishEventId,
@@ -25705,7 +25776,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25705
25776
  try {
25706
25777
  const followUp = await createWorkerTaskFollowUp2({
25707
25778
  task: result.task,
25708
- status: parsed.body.status,
25779
+ status: finishEventId,
25709
25780
  output: parsed.body.output,
25710
25781
  failureReason: parsed.body.failureReason
25711
25782
  });
@@ -25904,6 +25975,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25904
25975
  }
25905
25976
  if (task.workflowRunStepId != null) {
25906
25977
  const failed = await failTask2(parsed.params.id, SUPERSEDED_WORKFLOW_TASK_REASON);
25978
+ if (task.agentId) {
25979
+ await updateAgentStatusFromCapacity2(task.agentId);
25980
+ }
25907
25981
  ensure({
25908
25982
  id: "task.workflow_step_failed_on_supersede",
25909
25983
  flow: "task",
@@ -25937,6 +26011,9 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
25937
26011
  });
25938
26012
  return true;
25939
26013
  }
26014
+ if (task.agentId) {
26015
+ await updateAgentStatusFromCapacity2(task.agentId);
26016
+ }
25940
26017
  const followUp = await createResumeFollowUp2({
25941
26018
  parentId: parsed.params.id,
25942
26019
  reason: parsed.body.reason
@@ -29051,6 +29128,25 @@ function isAccessible(page, cookiePayload) {
29051
29128
  needsPassword: true
29052
29129
  };
29053
29130
  }
29131
+ async function hasSessionForOtherPage(req, pageId) {
29132
+ const header = req.headers.cookie;
29133
+ if (!header)
29134
+ return false;
29135
+ const pairs = (Array.isArray(header) ? header.join("; ") : header).split(";");
29136
+ for (const pair of pairs) {
29137
+ const eq = pair.indexOf("=");
29138
+ if (eq === -1)
29139
+ continue;
29140
+ const name = pair.slice(0, eq).trim();
29141
+ if (name !== LEGACY_PAGE_SESSION_COOKIE && !name.startsWith(`${LEGACY_PAGE_SESSION_COOKIE}_`)) {
29142
+ continue;
29143
+ }
29144
+ const payload = await verifyPageSession(pair.slice(eq + 1).trim());
29145
+ if (payload && payload.pageId !== pageId)
29146
+ return true;
29147
+ }
29148
+ return false;
29149
+ }
29054
29150
  function extractPasswordCandidate(req, queryParams) {
29055
29151
  const fromQuery = queryParams.get("key");
29056
29152
  if (fromQuery !== null)
@@ -29132,6 +29228,13 @@ async function handlePagesPublic(req, res, pathSegments, queryParams) {
29132
29228
  return true;
29133
29229
  }
29134
29230
  } else {
29231
+ if (await hasSessionForOtherPage(req, page.id)) {
29232
+ res.writeHead(403, { "Content-Type": "application/json" });
29233
+ res.end(JSON.stringify({
29234
+ error: "page-session cookie does not match this page id; POST /api/pages/:id/launch"
29235
+ }));
29236
+ return true;
29237
+ }
29135
29238
  res.writeHead(access.status, { "Content-Type": "application/json" });
29136
29239
  res.end(JSON.stringify({ error: scrubSecrets(access.reason) }));
29137
29240
  return true;
@@ -29642,11 +29745,10 @@ async function handlePoll(req, res, pathSegments, queryParams, myAgentId) {
29642
29745
  }
29643
29746
  const claimedChannels = hasCapability("messaging") ? await claimMentions2(myAgentId) : [];
29644
29747
  if (claimedChannels.length > 0) {
29645
- const inbox = await getInboxSummary2(myAgentId);
29646
29748
  return {
29647
29749
  trigger: {
29648
29750
  type: "unread_mentions",
29649
- mentionsCount: inbox.mentionsCount,
29751
+ mentionsCount: claimedChannels.reduce((sum, c) => sum + c.mentionsCount, 0),
29650
29752
  claimedChannels: claimedChannels.map((c) => c.channelId)
29651
29753
  }
29652
29754
  };
@@ -30576,7 +30678,7 @@ ${templateBody}` : templateBody;
30576
30678
  checkoutRoute.respond(res, 200, { template: toPromptTemplateResponse(template) });
30577
30679
  } catch (error) {
30578
30680
  const message = error instanceof Error ? error.message : "Unknown error";
30579
- if (message.includes("not found")) {
30681
+ if (message.includes("not found") || message.startsWith("No history entry")) {
30580
30682
  jsonError(res, message, 404);
30581
30683
  } else {
30582
30684
  jsonError(res, message, 400);
@@ -31950,6 +32052,10 @@ async function handleSchedules(req, res, pathSegments, queryParams, myAgentId) {
31950
32052
  jsonError(res, "delayMs and runAt are only for one-time schedules. Set scheduleType to 'one_time'.", 400);
31951
32053
  return true;
31952
32054
  }
32055
+ if (!body.cronExpression && !body.intervalMs) {
32056
+ jsonError(res, "Either cronExpression or intervalMs must be provided.", 400);
32057
+ return true;
32058
+ }
31953
32059
  }
31954
32060
  if (body.cronExpression) {
31955
32061
  try {
@@ -34608,6 +34714,7 @@ var postInternalStepRoute = route({
34608
34714
  pattern: ["api", "internal", "script-runs", null, "steps"],
34609
34715
  operationId: "script_runs_internal_step_create",
34610
34716
  summary: "Write a script run journal step",
34717
+ description: "Write-once per stepKey; a replay keeps the first journal entry and still answers 201.",
34611
34718
  tags: ["Script Runs"],
34612
34719
  params: runIdParamsSchema,
34613
34720
  body: journalStepBodySchema,
@@ -35109,7 +35216,7 @@ async function handleScriptRuns(req, res, pathSegments, queryParams, agentId) {
35109
35216
  agentTaskRoute.respond(res, 200, { taskId: latest.id, taskOutput: latest.output ?? null });
35110
35217
  return true;
35111
35218
  }
35112
- if (latest.status === "failed" || latest.status === "cancelled" || latest.status === "superseded") {
35219
+ if (latest.status === "failed" || latest.status === "cancelled" || latest.status === "superseded" || latest.status === "skipped") {
35113
35220
  json(res, { error: `Agent task ${latest.status}`, taskId: latest.id }, 409);
35114
35221
  return true;
35115
35222
  }
@@ -37045,7 +37152,7 @@ var listSessions = route({
37045
37152
  status: _enum2(["running", "failed", "needs"]).optional(),
37046
37153
  withUserId: string2().min(1).optional(),
37047
37154
  fields: _enum2(["full", "slim"]).optional(),
37048
- scope: _enum2(["mine", "shared", "tree"]).optional().describe("mine: owned sessions. shared: sessions shared with me. tree: Sessions that GET /api/session-tree counts: mine plus shared with me, no ownerless roots. A bypass actor sees every root with tree scope."),
37155
+ scope: _enum2(["mine", "shared", "tree", "all"]).optional().describe("mine: owned sessions. shared: sessions shared with me. tree: Sessions that GET /api/session-tree counts: mine plus shared with me, no ownerless roots. A bypass actor sees every root with tree scope. all: every user's sessions, read-only, for a user with an admin role or session.read.all; ignored for anyone else. The X-Swarm-Session-Scope: all header opts in the same way, also for tree."),
37049
37156
  show: SessionShowSchema,
37050
37157
  hideSource: SessionHideSourceSchema,
37051
37158
  showSource: SessionShowSourceSchema
@@ -37272,7 +37379,7 @@ var putSessionShares = route({
37272
37379
  rbac: { permission: "session.share" }
37273
37380
  });
37274
37381
  async function accessForRoot(actor, root) {
37275
- return actor.kind === "bypass" ? "owner" : sessionAccessForRoot(actor.userId, root);
37382
+ return actor.kind === "bypass" ? "owner" : withReadAll2(actor, await sessionAccessForRoot(actor.userId, root));
37276
37383
  }
37277
37384
  async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37278
37385
  if (await handleAgentTokens(req, res, pathSegments, queryParams))
@@ -37354,9 +37461,10 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37354
37461
  if (!parsed)
37355
37462
  return true;
37356
37463
  const sources = parsed.query.source ? parsed.query.source.split(",").map((s) => s.trim()).filter(Boolean) : undefined;
37357
- const actor = await resolveSessionActor2(req, myAgentId);
37464
+ const allUsers = parsed.query.scope === "all";
37465
+ const actor = await resolveSessionActor2(req, myAgentId, { allUsers });
37358
37466
  const limit = Math.min(200, Math.max(0, parsed.query.limit ?? 25));
37359
- if (actor.kind === "bypass" && parsed.query.scope && parsed.query.scope !== "tree") {
37467
+ if (actor.kind === "bypass" && (parsed.query.scope === "mine" || parsed.query.scope === "shared")) {
37360
37468
  listSessions.respond(res, 200, {
37361
37469
  sessions: [],
37362
37470
  total: 0,
@@ -37384,7 +37492,8 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37384
37492
  ...actor.kind === "user" ? {
37385
37493
  viewer: {
37386
37494
  userId: actor.userId,
37387
- scope: parsed.query.scope === "tree" ? "all" : parsed.query.scope ?? "all"
37495
+ scope: parsed.query.scope === "mine" || parsed.query.scope === "shared" ? parsed.query.scope : "all",
37496
+ readAll: actor.readAll
37388
37497
  }
37389
37498
  } : {}
37390
37499
  };
@@ -37430,7 +37539,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37430
37539
  return true;
37431
37540
  }
37432
37541
  const { action, show, ...list } = parsed.body;
37433
- const updated = await triageSessionList(actor.userId, { ...list, mine: show !== "all" }, action);
37542
+ const updated = await triageSessionList(actor.userId, { ...list, mine: show !== "all" }, action, actor.readAll);
37434
37543
  triageSessionListRoute.respond(res, 200, { updated });
37435
37544
  return true;
37436
37545
  }
@@ -37557,7 +37666,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37557
37666
  getTaskSteeringFieldsForTasks(tasks),
37558
37667
  getTaskCitationsForTasks(tasks.map((task) => task.id)),
37559
37668
  getPendingApprovalsForTasks2(tasks.map((task) => task.id)),
37560
- actor.kind === "user" && actor.userId ? getSessionReadState(sessionRoot.id, actor.userId) : Promise.resolve(null),
37669
+ actor.kind === "user" && actor.userId ? getSessionReadState(sessionRoot.id, actor.userId, undefined, actor.readAll) : Promise.resolve(null),
37561
37670
  getSessionGroupKey(root)
37562
37671
  ]);
37563
37672
  const decorate = (task) => ({
@@ -40240,6 +40349,7 @@ init_constants3();
40240
40349
  init_egress_guard();
40241
40350
  init_request_auth_context();
40242
40351
  init_route_def();
40352
+ init_session_access();
40243
40353
  init_utils2();
40244
40354
  async function composeUser(userId, recentEventLimit = 5) {
40245
40355
  const user = await getUserById2(userId);
@@ -40317,7 +40427,8 @@ var whoamiRoute = route({
40317
40427
  grantsAll: boolean(),
40318
40428
  verbs: array2(string2()),
40319
40429
  roles: array2(string2())
40320
- }).optional()
40430
+ }).optional(),
40431
+ sessionReadAll: boolean().optional()
40321
40432
  })
40322
40433
  },
40323
40434
  401: { description: "Unauthorized" }
@@ -40367,7 +40478,8 @@ var createUserRoute = route({
40367
40478
  schema: object2({ user: ComposedUserSchema.nullable() })
40368
40479
  },
40369
40480
  400: { description: "Validation error" },
40370
- 401: { description: "Unauthorized" }
40481
+ 401: { description: "Unauthorized" },
40482
+ 409: { description: "A user with this email already exists (user_exists)" }
40371
40483
  },
40372
40484
  auth: { apiKey: true }
40373
40485
  });
@@ -40705,9 +40817,10 @@ var addIdentityRoute = route({
40705
40817
  description: "Updated identity list",
40706
40818
  schema: object2({ identities: array2(UserIdentityLinkSchema) })
40707
40819
  },
40708
- 400: { description: "Validation error or PK collision" },
40820
+ 400: { description: "Validation error" },
40709
40821
  401: { description: "Unauthorized" },
40710
- 404: { description: "User not found" }
40822
+ 404: { description: "User not found" },
40823
+ 409: { description: "The (kind, externalId) identity is already linked (identity_taken)" }
40711
40824
  },
40712
40825
  auth: { apiKey: true }
40713
40826
  });
@@ -40728,6 +40841,9 @@ var deleteIdentityRoute = route({
40728
40841
  },
40729
40842
  auth: { apiKey: true }
40730
40843
  });
40844
+ function isUniqueViolation(err, target) {
40845
+ return err instanceof Error && err.message.includes("UNIQUE constraint") && err.message.includes(target);
40846
+ }
40731
40847
  var UNMAPPED_KINDS = [
40732
40848
  "slack",
40733
40849
  "github",
@@ -40838,6 +40954,8 @@ async function handleUsers(req, res, pathSegments, queryParams) {
40838
40954
  if (!parsed)
40839
40955
  return true;
40840
40956
  const user = authUser(getRequestAuth(req));
40957
+ const scopeActor = await resolveSessionActor2(req, undefined, { allUsers: true });
40958
+ const sessionReadAll = scopeActor.kind === "bypass" || scopeActor.readAll === true;
40841
40959
  if (user) {
40842
40960
  const [grant, roles] = await Promise.all([getUserGrant2(user.id), listUserRoles2(user.id)]);
40843
40961
  const grantsAll = !isRbacEnabled() || grant.grantsAll;
@@ -40848,13 +40966,15 @@ async function handleUsers(req, res, pathSegments, queryParams) {
40848
40966
  grantsAll,
40849
40967
  verbs: grantsAll ? [] : [...grant.verbs].sort(),
40850
40968
  roles: roles.map((role) => role.name)
40851
- }
40969
+ },
40970
+ sessionReadAll
40852
40971
  });
40853
40972
  } else {
40854
40973
  whoamiRoute.respond(res, 200, {
40855
40974
  kind: "operator",
40856
40975
  user: null,
40857
- grants: { grantsAll: true, verbs: [], roles: [] }
40976
+ grants: { grantsAll: true, verbs: [], roles: [] },
40977
+ sessionReadAll
40858
40978
  });
40859
40979
  }
40860
40980
  return true;
@@ -40891,6 +41011,10 @@ async function handleUsers(req, res, pathSegments, queryParams) {
40891
41011
  const composed = await composeUser(user.id);
40892
41012
  createUserRoute.respond(res, 200, { user: composed });
40893
41013
  } catch (err) {
41014
+ if (isUniqueViolation(err, "users.email")) {
41015
+ jsonError(res, "user_exists", 409);
41016
+ return true;
41017
+ }
40894
41018
  jsonError(res, err instanceof Error ? err.message : "Failed to create user", 500);
40895
41019
  }
40896
41020
  return true;
@@ -41209,6 +41333,10 @@ async function handleUsers(req, res, pathSegments, queryParams) {
41209
41333
  identities: await getUserIdentities(parsed.params.id)
41210
41334
  });
41211
41335
  } catch (err) {
41336
+ if (isUniqueViolation(err, "user_external_ids")) {
41337
+ jsonError(res, "identity_taken", 409);
41338
+ return true;
41339
+ }
41212
41340
  jsonError(res, err instanceof Error ? err.message : "Failed to link identity", 400);
41213
41341
  }
41214
41342
  return true;
@@ -42863,7 +42991,8 @@ var retryWorkflowRunRoute = route({
42863
42991
  params: object2({ id: string2() }),
42864
42992
  responses: {
42865
42993
  200: { description: "Retry started", schema: SuccessResponseSchema },
42866
- 400: { description: "Cannot retry" }
42994
+ 400: { description: "Cannot retry" },
42995
+ 404: { description: "Run not found" }
42867
42996
  }
42868
42997
  });
42869
42998
  var cancelWorkflowRunRoute = route({
@@ -43164,7 +43293,11 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
43164
43293
  res.end();
43165
43294
  return true;
43166
43295
  }
43167
- jsonError(res, result.reason === "patch" ? result.errors.join("; ") : `Invalid definition: ${result.errors.join("; ")}`, 400);
43296
+ if (result.reason === "patch") {
43297
+ jsonError(res, result.errors.join("; "), 404);
43298
+ return true;
43299
+ }
43300
+ jsonError(res, `Invalid definition: ${result.errors.join("; ")}`, 400);
43168
43301
  return true;
43169
43302
  }
43170
43303
  patchWorkflowNodeRoute.respond(res, 200, await withSaveWarnings(result.workflow));
@@ -43447,6 +43580,10 @@ async function handleWorkflows(req, res, pathSegments, queryParams, myAgentId) {
43447
43580
  const parsed = await retryWorkflowRunRoute.parse(req, res, pathSegments, queryParams);
43448
43581
  if (!parsed)
43449
43582
  return true;
43583
+ if (!await getWorkflowRunSummary(parsed.params.id)) {
43584
+ jsonError(res, `Workflow run not found: ${parsed.params.id}`, 404);
43585
+ return true;
43586
+ }
43450
43587
  try {
43451
43588
  await retryFailedRun2(parsed.params.id, getExecutorRegistry2());
43452
43589
  } catch (err) {
@@ -43895,7 +44032,7 @@ var httpServer = createHttpServer(async (req, res) => {
43895
44032
  });
43896
44033
  });
43897
44034
  var detachRealtime = attachRealtimeTransport(httpServer);
43898
- var { attachControllerTransport } = await import("./controllers-connect-c6nm70kg.js");
44035
+ var { attachControllerTransport } = await import("./controllers-connect-m7d4vxxb.js");
43899
44036
  var detachControllers = attachControllerTransport(httpServer);
43900
44037
  var stopWorkerNudges = startWorkerNudgeListener();
43901
44038
  var taskAutoTitles = startTaskAutoTitleListener();
@@ -43926,7 +44063,7 @@ async function shutdown() {
43926
44063
  sessionsProcessed: getServerSessionsProcessed()
43927
44064
  });
43928
44065
  if (hasCapability("scheduling")) {
43929
- const { stopScheduler } = await import("./index-xrz7te8h.js");
44066
+ const { stopScheduler } = await import("./index-hpfte8jd.js");
43930
44067
  stopScheduler();
43931
44068
  }
43932
44069
  stopHeartbeat2();
@@ -43938,7 +44075,7 @@ async function shutdown() {
43938
44075
  await stopSlackApp2();
43939
44076
  await stopChatSdk();
43940
44077
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
43941
- const { stopOAuthKeepalive } = await import("./keepalive-x060nt9p.js");
44078
+ const { stopOAuthKeepalive } = await import("./keepalive-qnt21cv0.js");
43942
44079
  await stopOAuthKeepalive();
43943
44080
  }
43944
44081
  stopOAuthPendingGc();
@@ -44020,21 +44157,21 @@ try {
44020
44157
  console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
44021
44158
  }
44022
44159
  try {
44023
- const { ensurePricingSeeded } = await import("./boot-seeds-5cm6ambd.js");
44160
+ const { ensurePricingSeeded } = await import("./boot-seeds-n46eaxdv.js");
44024
44161
  ensurePricingSeeded();
44025
- const { startPricingRefreshLoop } = await import("./pricing-refresh-3pmre11v.js");
44162
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-9fcbnq3f.js");
44026
44163
  startPricingRefreshLoop();
44027
44164
  } catch (err) {
44028
44165
  console.error("[startup] Failed to seed pricing rows:", err);
44029
44166
  }
44030
44167
  try {
44031
- const { ensureModelProfilesSeeded } = await import("./boot-seeds-5cm6ambd.js");
44168
+ const { ensureModelProfilesSeeded } = await import("./boot-seeds-n46eaxdv.js");
44032
44169
  await ensureModelProfilesSeeded();
44033
44170
  } catch (err) {
44034
44171
  console.error("[startup] Failed to seed model profiles:", err);
44035
44172
  }
44036
44173
  try {
44037
- const { ensureRbacSeeded } = await import("./boot-seeds-5cm6ambd.js");
44174
+ const { ensureRbacSeeded } = await import("./boot-seeds-n46eaxdv.js");
44038
44175
  ensureRbacSeeded();
44039
44176
  } catch (err) {
44040
44177
  console.error("[startup] Failed to sync RBAC seed rows:", err);
@@ -44042,7 +44179,7 @@ try {
44042
44179
  throw err;
44043
44180
  }
44044
44181
  try {
44045
- const { runAllSeeders } = await import("./index-nh3wyqdt.js");
44182
+ const { runAllSeeders } = await import("./index-bxrexmfy.js");
44046
44183
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
44047
44184
  } catch (err) {
44048
44185
  console.error("[startup] Failed to seed built-in entities:", err);
@@ -44105,26 +44242,26 @@ httpServer.listen(port, async () => {
44105
44242
  await initWorkflows2();
44106
44243
  await startScriptRunSupervisor(getMcpBaseUrl());
44107
44244
  if (hasCapability("scheduling")) {
44108
- const { startScheduler } = await import("./index-xrz7te8h.js");
44109
- const { getExecutorRegistry } = await import("./index-a8phxqnk.js");
44245
+ const { startScheduler } = await import("./index-hpfte8jd.js");
44246
+ const { getExecutorRegistry } = await import("./index-vte6dyeh.js");
44110
44247
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
44111
44248
  startScheduler(getExecutorRegistry(), intervalMs, {
44112
44249
  runId: globalState.__runId
44113
44250
  });
44114
44251
  }
44115
44252
  if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
44116
- const { startHeartbeat } = await import("./index-k6h00t4c.js");
44253
+ const { startHeartbeat } = await import("./index-ncf7yb5s.js");
44117
44254
  const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
44118
44255
  startHeartbeat(heartbeatMs);
44119
44256
  }
44120
44257
  startPoolRouting();
44121
44258
  startRuntimeSupervisor();
44122
44259
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
44123
- const { startOAuthKeepalive } = await import("./keepalive-x060nt9p.js");
44260
+ const { startOAuthKeepalive } = await import("./keepalive-qnt21cv0.js");
44124
44261
  startOAuthKeepalive();
44125
44262
  }
44126
44263
  if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
44127
- const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-fckc4ar5.js");
44264
+ const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-vczabeh4.js");
44128
44265
  startOAuthRefreshSweep();
44129
44266
  }
44130
44267
  startOAuthPendingGc();
@@ -44133,16 +44270,19 @@ httpServer.listen(port, async () => {
44133
44270
  await startDbRetention();
44134
44271
  startHumanFreeDrain();
44135
44272
  startTaskSearchBackfill();
44136
- import("./embedding-space-0jepb239.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
44273
+ import("./embedding-space-b4txbwrk.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
44137
44274
  setDeploymentEnvReader(getDeploymentEnvValue);
44138
44275
  return runEmbeddingMaintenance({ backfill: true });
44139
44276
  }).catch((err) => {
44140
44277
  console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
44141
44278
  });
44142
- import("./boot-scrub-sweep-yjpdj7s1.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
44279
+ import("./boot-args-schema-tjrkpbvm.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
44280
+ console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
44281
+ });
44282
+ import("./boot-scrub-sweep-qy0zr9t2.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
44143
44283
  console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
44144
44284
  });
44145
- import("./session-source-backfill-08xvv0sm.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
44285
+ import("./session-source-backfill-0vscqmsa.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
44146
44286
  console.error("[session-source-backfill] startup run failed (non-fatal):", err);
44147
44287
  });
44148
44288
  }).on("error", (err) => {