@desplega.ai/agent-swarm 1.145.0 → 1.147.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 (221) hide show
  1. package/README.md +2 -1
  2. package/dist/{acp-adapter-580t41c0.js → acp-adapter-9n319wqc.js} +61 -6
  3. package/dist/{actions-m662tjng.js → actions-2vxqvpr9.js} +9 -8
  4. package/dist/{app-zb3rndm8.js → app-w066xfy0.js} +6 -5
  5. package/dist/assistant-kt31dj2h.js +236 -0
  6. package/dist/{boot-reembed-072x00vn.js → boot-reembed-az5rassp.js} +7 -6
  7. package/dist/{boot-reembed-65zz2smt.js → boot-reembed-j3mm3rfz.js} +8 -7
  8. package/dist/{boot-scrub-logs-yz0ams04.js → boot-scrub-logs-b6h54817.js} +4 -4
  9. package/dist/{claude-adapter-paj270y2.js → claude-adapter-w1z04ann.js} +8 -6
  10. package/dist/{claude-managed-setup-w619jncn.js → claude-managed-setup-f5pmsyrp.js} +24 -3
  11. package/dist/{claude-sdk-session-swt80j9z.js → claude-sdk-session-f0cc1kec.js} +8 -6
  12. package/dist/{cli-dt553ktb.js → cli-0b6y7kxm.js} +1 -1
  13. package/dist/{cli-bxdhw615.js → cli-12fz972k.js} +4 -4
  14. package/dist/{cli-s2f20r5w.js → cli-1th1728g.js} +2 -2
  15. package/dist/{cli-rs6ec3b9.js → cli-3tgwnf43.js} +3 -3
  16. package/dist/{cli-gxnzc6wh.js → cli-4nr988h6.js} +1 -1
  17. package/dist/{cli-axs8e6d4.js → cli-53s590z8.js} +1 -1
  18. package/dist/{cli-ygbjp3z8.js → cli-54wwve05.js} +5 -4
  19. package/dist/{cli-v0asr5yv.js → cli-719k9j2c.js} +2 -2
  20. package/dist/{cli-anktweqr.js → cli-89xfd7f9.js} +21 -47
  21. package/dist/{cli-q34a0e10.js → cli-8v0g1yc8.js} +1 -1
  22. package/dist/cli-9d8ntetj.js +42 -0
  23. package/dist/{cli-z9fprcrf.js → cli-atcve9y8.js} +881 -738
  24. package/dist/{cli-jmb7g47h.js → cli-b5bq9crk.js} +14 -31
  25. package/dist/cli-d8brzxjb.js +190 -0
  26. package/dist/{cli-gzky0gkr.js → cli-de14znh8.js} +2 -2
  27. package/dist/{cli-xytwff7f.js → cli-dttph1bw.js} +2 -2
  28. package/dist/cli-ep19k3mb.js +19 -0
  29. package/dist/{cli-m1xa8be7.js → cli-f146mn5s.js} +7 -50
  30. package/dist/{cli-1fj0chdk.js → cli-f7dsy61y.js} +5 -3
  31. package/dist/{cli-f567d5c1.js → cli-ftht3zzj.js} +2782 -2589
  32. package/dist/{cli-a0g1gbt5.js → cli-hbv0kq6w.js} +2 -2
  33. package/dist/{cli-fhsz3twr.js → cli-jsp14b6c.js} +171 -1
  34. package/dist/{cli-7fnkj1hj.js → cli-kpv03zhj.js} +21 -17
  35. package/dist/{cli-m4j6trn4.js → cli-m8yrsg97.js} +2 -2
  36. package/dist/cli-m9sxbkhm.js +779 -0
  37. package/dist/cli-mmemxxdc.js +823 -0
  38. package/dist/{cli-tqtvj5pt.js → cli-n8508nre.js} +1 -1
  39. package/dist/{cli-z96t0thj.js → cli-p1d5b073.js} +37 -2
  40. package/dist/{cli-gh8y8f36.js → cli-rw51bq3j.js} +13 -10
  41. package/dist/{cli-59ej1c07.js → cli-smby5m17.js} +7 -6
  42. package/dist/{cli-65vqzz3v.js → cli-tzvk9haz.js} +94 -372
  43. package/dist/{cli-dc9k2ba9.js → cli-w9kb3bk1.js} +1 -1
  44. package/dist/{cli-kpev657q.js → cli-y6b6fb76.js} +25 -3
  45. package/dist/{cli-123q2get.js → cli-yz3djrm0.js} +9 -9
  46. package/dist/{cli-wvp6bvy4.js → cli-zhjmqxzh.js} +1 -1
  47. package/dist/cli.js +13 -13
  48. package/dist/{codex-adapter-k98vaw2r.js → codex-adapter-zw4dwsx7.js} +2 -2
  49. package/dist/{codex-hook-9pf19cks.js → codex-hook-bw8p5nh4.js} +2 -2
  50. package/dist/{codex-session-runner-tngtphx7.js → codex-session-runner-k981s65v.js} +2 -2
  51. package/dist/{commands-y8nbr3fv.js → commands-sykrxx7e.js} +4 -4
  52. package/dist/{db-30p4h2t1.js → db-sfbsc8wt.js} +6 -4
  53. package/dist/handlers-0aspcejm.js +603 -0
  54. package/dist/{hook-dcw4jfbj.js → hook-4nvqj2sb.js} +7 -5
  55. package/dist/{hook-21jexvfx.js → hook-hxccs7m5.js} +24 -49
  56. package/dist/{http-r4kq5g8d.js → http-y06z517d.js} +230 -94
  57. package/dist/{index-q3qja6ta.js → index-hssww7kj.js} +15 -14
  58. package/dist/{index-gay66b9w.js → index-k8znfx0z.js} +13 -12
  59. package/dist/{index-53zyht4z.js → index-tce1rss4.js} +371 -110
  60. package/dist/{index-nqvf26za.js → index-x5j894zf.js} +14 -13
  61. package/dist/{keepalive-xs8fa55y.js → keepalive-w733ax66.js} +6 -6
  62. package/dist/{lead-d9m2t4s0.js → lead-75bjqa9d.js} +29 -27
  63. package/dist/{maintenance-3zh82g6z.js → maintenance-w4f1zjck.js} +8 -7
  64. package/dist/{oauth-refresh-sweep-03snsye5.js → oauth-refresh-sweep-wdetky26.js} +5 -5
  65. package/dist/{onboard-0cg1925x.js → onboard-bb5net8s.js} +2 -2
  66. package/dist/{otel-impl-0ab95z27.js → otel-impl-0w7c14ap.js} +1 -1
  67. package/dist/{pi-mono-adapter-dtkz4e7j.js → pi-mono-adapter-2has4gnp.js} +12 -2
  68. package/dist/{pricing-refresh-e5jhzz4j.js → pricing-refresh-9nzsrgcq.js} +6 -6
  69. package/dist/{rbac-roles-p1mf40z3.js → rbac-roles-r3hqjp09.js} +5 -5
  70. package/dist/{rbac-roles-2w3cmrkc.js → rbac-roles-z1jrffbt.js} +4 -4
  71. package/dist/{registry-9kdck5ye.js → registry-v5wytg0s.js} +1 -2
  72. package/dist/{render-v2-xhawry3k.js → render-v2-vbr89fnb.js} +6 -5
  73. package/dist/{seed-pricing-t223sw91.js → seed-pricing-g62hy1pk.js} +7 -5
  74. package/dist/{setup-zcs0rce7.js → setup-gnfqnptp.js} +2 -2
  75. package/dist/{worker-qnp2ka62.js → worker-kznxp4qm.js} +29 -27
  76. package/openapi.json +263 -12
  77. package/package.json +1 -1
  78. package/plugin/commands/start-worker.md +4 -9
  79. package/plugin/pi-skills/start-worker/SKILL.md +4 -9
  80. package/src/be/db/agents.ts +556 -0
  81. package/src/be/db/context-versions.ts +117 -0
  82. package/src/be/db/runtime.ts +406 -0
  83. package/src/be/db/tasks/read.ts +1167 -0
  84. package/src/be/db/tasks/write.ts +953 -0
  85. package/src/be/db.ts +584 -3429
  86. package/src/be/migrations/147_scheduled_tasks_parent_task.sql +7 -0
  87. package/src/be/migrations/148_pages_svg.sql +123 -0
  88. package/src/be/migrations/149_session_tokens.sql +24 -0
  89. package/src/be/scripts/typecheck.ts +1 -0
  90. package/src/be/seed-pricing.ts +13 -8
  91. package/src/be/seed-scripts/catalog/ops-catalog-audit.inline.ts +1 -1
  92. package/src/be/seed-scripts/catalog/ops-catalog-audit.ts +1 -1
  93. package/src/be/seed-scripts/catalog/star-history-refresh.ts +101 -0
  94. package/src/be/seed-scripts/catalog/star-history-renderer.ts +119 -0
  95. package/src/be/seed-scripts/index.ts +17 -0
  96. package/src/be/seed-skills/index.ts +14 -0
  97. package/src/be/swarm-config-guard.ts +5 -2
  98. package/src/be/task-attachment-store.ts +70 -0
  99. package/src/be/users.ts +77 -0
  100. package/src/commands/attachments-section.ts +37 -0
  101. package/src/commands/claude-managed-setup.ts +45 -3
  102. package/src/commands/claude-md-session.ts +408 -0
  103. package/src/commands/context-preamble.ts +15 -3
  104. package/src/commands/profile-sync.ts +205 -5
  105. package/src/commands/provider-credentials.ts +60 -27
  106. package/src/commands/runner.ts +63 -58
  107. package/src/commands/templates.ts +25 -2
  108. package/src/hooks/hook.ts +26 -67
  109. package/src/http/agents.ts +40 -1
  110. package/src/http/auth.ts +13 -1
  111. package/src/http/fs.ts +21 -51
  112. package/src/http/index.ts +2 -0
  113. package/src/http/mcp.ts +32 -0
  114. package/src/http/pages-public.ts +20 -4
  115. package/src/http/pages.ts +11 -3
  116. package/src/http/poll.ts +4 -0
  117. package/src/http/repos.ts +3 -3
  118. package/src/http/sessions.ts +82 -0
  119. package/src/http/tasks.ts +10 -2
  120. package/src/http/utils.ts +79 -1
  121. package/src/prompts/session-templates.ts +12 -8
  122. package/src/providers/acp-adapter.ts +62 -8
  123. package/src/providers/pi-mono-adapter.ts +23 -6
  124. package/src/providers/pricing-sources.md +11 -0
  125. package/src/scheduler/scheduler.test.ts +49 -2
  126. package/src/scheduler/scheduler.ts +4 -0
  127. package/src/scripts-runtime/sdk-allowlist.ts +1 -0
  128. package/src/scripts-runtime/types/stdlib.d.ts +8 -0
  129. package/src/scripts-runtime/types/swarm-sdk.d.ts +8 -0
  130. package/src/server.ts +2 -0
  131. package/src/slack/assistant.ts +87 -46
  132. package/src/slack/handlers.test.ts +1 -3
  133. package/src/slack/handlers.ts +102 -87
  134. package/src/slack/inbound-files.ts +466 -0
  135. package/src/slack/templates.ts +14 -0
  136. package/src/tasks/task-terminal-effects.ts +158 -0
  137. package/src/tests/acp-adapter.test.ts +369 -117
  138. package/src/tests/budget-claim-gate.test.ts +1 -0
  139. package/src/tests/build-pi-skills.test.ts +5 -7
  140. package/src/tests/claude-managed-setup.test.ts +52 -4
  141. package/src/tests/claude-md-session.test.ts +603 -0
  142. package/src/tests/codex-skill-resolver.test.ts +19 -0
  143. package/src/tests/context-versioning.test.ts +107 -0
  144. package/src/tests/cors-allowlist.test.ts +309 -0
  145. package/src/tests/credential-check.test.ts +157 -14
  146. package/src/tests/db-agents.test.ts +91 -0
  147. package/src/tests/db-context-versions.test.ts +37 -0
  148. package/src/tests/db-extraction-contract.test.ts +45 -0
  149. package/src/tests/db-runtime.test.ts +70 -0
  150. package/src/tests/db-task-read-contract.test.ts +624 -0
  151. package/src/tests/db-task-write-contract.test.ts +653 -0
  152. package/src/tests/db-tasks-read.test.ts +183 -0
  153. package/src/tests/db-tasks-write.test.ts +230 -0
  154. package/src/tests/defer-task.test.ts +389 -0
  155. package/src/tests/docs-index-footprint.test.js +2 -2
  156. package/src/tests/e2e-visuals-stage.test.ts +151 -0
  157. package/src/tests/file-lock.test.ts +144 -0
  158. package/src/tests/fixtures/file-lock-holder.ts +13 -0
  159. package/src/tests/fixtures/hold-file-lock.ts +25 -0
  160. package/src/tests/heartbeat-expiry.test.ts +188 -0
  161. package/src/tests/http-api-integration.test.ts +78 -1
  162. package/src/tests/pages-public-html.test.ts +43 -0
  163. package/src/tests/pages-svg-migration.test.ts +42 -0
  164. package/src/tests/preload.ts +4 -1
  165. package/src/tests/profile-sync-warning.test.ts +16 -0
  166. package/src/tests/profile-sync.test.ts +126 -0
  167. package/src/tests/prompt-template-session.test.ts +20 -4
  168. package/src/tests/provider-registration.test.ts +93 -0
  169. package/src/tests/rbac-e2e-helpers.test.ts +53 -0
  170. package/src/tests/rbac-e2e-helpers.ts +19 -2
  171. package/src/tests/reload-config.test.ts +26 -0
  172. package/src/tests/routing-affinity-inventory.test.ts +1 -1
  173. package/src/tests/runner-attachments-section.test.ts +22 -2
  174. package/src/tests/runner-context-preamble.test.ts +30 -0
  175. package/src/tests/runner-deployment-resume.test.ts +107 -0
  176. package/src/tests/runner-repo-autostash.test.ts +12 -0
  177. package/src/tests/script-connections.test.ts +4 -0
  178. package/src/tests/seed-scripts.test.ts +2 -2
  179. package/src/tests/session-tokens.test.ts +279 -0
  180. package/src/tests/slack-file-tools-attachments.test.ts +408 -0
  181. package/src/tests/slack-inbound-files.test.ts +847 -0
  182. package/src/tests/star-history-refresh.test.ts +102 -0
  183. package/src/tests/swarm-config-reserved-keys.test.ts +21 -0
  184. package/src/tests/swarm-repos.test.ts +20 -0
  185. package/src/tests/tool-annotations.test.ts +4 -3
  186. package/src/tests/ui-logs-parser.test.ts +176 -0
  187. package/src/tools/create-page.ts +4 -2
  188. package/src/tools/defer-task.ts +239 -0
  189. package/src/tools/repos/update-repo.ts +2 -2
  190. package/src/tools/schedules/create-schedule.ts +1 -0
  191. package/src/tools/schedules/list-schedules.ts +1 -0
  192. package/src/tools/schedules/patch-schedule.ts +1 -0
  193. package/src/tools/schedules/update-schedule.ts +1 -0
  194. package/src/tools/slack-download-file.ts +60 -29
  195. package/src/tools/slack-read.ts +73 -32
  196. package/src/tools/store-progress.ts +16 -146
  197. package/src/tools/tool-config.ts +1 -0
  198. package/src/tools/utils.ts +21 -0
  199. package/src/types.ts +37 -4
  200. package/src/utils/acp-session-token.ts +56 -0
  201. package/src/utils/file-lock.ts +111 -0
  202. package/src/utils/heartbeat-expiry.ts +78 -0
  203. package/src/utils/request-auth-context.ts +2 -0
  204. package/src/utils/task-attachment-links.ts +22 -0
  205. package/templates/skills/code-quality/content.md +8 -5
  206. package/templates/skills/download-task-attachment/content.md +2 -1
  207. package/{plugin/pi-skills → templates/skills}/review-offered-task/SKILL.md +5 -5
  208. package/templates/skills/review-offered-task/config.json +14 -0
  209. package/{plugin/commands/review-offered-task.md → templates/skills/review-offered-task/content.md} +3 -8
  210. package/templates/skills/scheduling/content.md +4 -0
  211. package/templates/skills/slack-interaction/content.md +2 -2
  212. package/templates/skills/work-on-task/SKILL.md +16 -0
  213. package/templates/skills/work-on-task/config.json +14 -0
  214. package/templates/skills/work-on-task/content.md +11 -0
  215. package/dist/assistant-0qt42nzg.js +0 -212
  216. package/dist/cli-fs1kkqgr.js +0 -317
  217. package/dist/cli-jnf5zghe.js +0 -269
  218. package/dist/cli-n1q8q14d.js +0 -177
  219. package/dist/handlers-yfp1qn81.js +0 -592
  220. package/plugin/commands/work-on-task.md +0 -39
  221. package/plugin/pi-skills/work-on-task/SKILL.md +0 -39
@@ -108,6 +108,7 @@ import {
108
108
  isJSONRPCResultResponse,
109
109
  isJiraEnabled,
110
110
  isLinearEnabled,
111
+ isOriginAllowedForCredentials,
111
112
  isSenderAllowed,
112
113
  issuePageSessionCookie,
113
114
  json,
@@ -178,9 +179,10 @@ import {
178
179
  verifyAgentMailWebhook,
179
180
  verifyGitLabWebhook,
180
181
  verifyWebhookSignature,
182
+ warnIfCorsAllowsAnyOrigin,
181
183
  wireHttpSpanLifecycle,
182
184
  writeSkillsToFilesystem
183
- } from "./cli-z9fprcrf.js";
185
+ } from "./cli-atcve9y8.js";
184
186
  import"./cli-8fc8de14.js";
185
187
  import {
186
188
  Anthropic
@@ -199,16 +201,16 @@ import {
199
201
  import {
200
202
  calculateNextRun,
201
203
  dispatchScheduleTarget
202
- } from "./cli-59ej1c07.js";
204
+ } from "./cli-smby5m17.js";
203
205
  import {
204
206
  getModelsCatalog
205
- } from "./cli-m4j6trn4.js";
207
+ } from "./cli-m8yrsg97.js";
206
208
  import {
207
209
  normalizeModelKey
208
- } from "./cli-gh8y8f36.js";
210
+ } from "./cli-rw51bq3j.js";
209
211
  import {
210
212
  getUserGrant
211
- } from "./cli-q34a0e10.js";
213
+ } from "./cli-8v0g1yc8.js";
212
214
  import {
213
215
  can,
214
216
  clearAuditSink,
@@ -225,12 +227,12 @@ import {
225
227
  scriptSdkTypesWithGeneratedApis,
226
228
  scriptStdlibTypesWithGeneratedApis,
227
229
  typecheckScript
228
- } from "./cli-ygbjp3z8.js";
230
+ } from "./cli-54wwve05.js";
229
231
  import {
230
232
  collectScriptReferences,
231
233
  getApp,
232
234
  listAppRecords
233
- } from "./cli-gzky0gkr.js";
235
+ } from "./cli-de14znh8.js";
234
236
  import {
235
237
  require_dist
236
238
  } from "./cli-qgm2pfpq.js";
@@ -238,7 +240,7 @@ import {
238
240
  checkHeartbeatChecklist,
239
241
  runHeartbeatSweep,
240
242
  stopHeartbeat
241
- } from "./cli-bxdhw615.js";
243
+ } from "./cli-12fz972k.js";
242
244
  import {
243
245
  AGENT_MAX_TASKS_CONFIG_KEY,
244
246
  createResumeFollowUp,
@@ -253,7 +255,7 @@ import {
253
255
  touchRuntimeInstance,
254
256
  upsertRuntimeInstance,
255
257
  upsertSwarmConfigWithPolicyMirror
256
- } from "./cli-1fj0chdk.js";
258
+ } from "./cli-f7dsy61y.js";
257
259
  import {
258
260
  isMultiRuntimeEnabled
259
261
  } from "./cli-07jd68a1.js";
@@ -276,7 +278,7 @@ import {
276
278
  startWorkflowExecution,
277
279
  validateJsonSchema,
278
280
  verifyHmacSignature
279
- } from "./cli-123q2get.js";
281
+ } from "./cli-yz3djrm0.js";
280
282
  import"./cli-1ebpar1q.js";
281
283
  import {
282
284
  deriveCodexKeySuffix,
@@ -361,11 +363,11 @@ import {
361
363
  upsertScriptByName,
362
364
  upsertScriptConnection,
363
365
  validateDefinition
364
- } from "./cli-rs6ec3b9.js";
366
+ } from "./cli-3tgwnf43.js";
365
367
  import"./cli-epan13p1.js";
366
368
  import {
367
369
  searchScripts
368
- } from "./cli-a0g1gbt5.js";
370
+ } from "./cli-hbv0kq6w.js";
369
371
  import {
370
372
  CANDIDATE_SET_MULTIPLIER,
371
373
  getEmbeddingProvider,
@@ -373,7 +375,7 @@ import {
373
375
  init_constants as init_constants2,
374
376
  init_reranker,
375
377
  rerank
376
- } from "./cli-s2f20r5w.js";
378
+ } from "./cli-1th1728g.js";
377
379
  import {
378
380
  detachedProcessGroup,
379
381
  forceTerminateProcessGroup,
@@ -384,7 +386,7 @@ import {
384
386
  import {
385
387
  getApiKey
386
388
  } from "./cli-f14fvzag.js";
387
- import"./cli-fs1kkqgr.js";
389
+ import"./cli-m9sxbkhm.js";
388
390
  import {
389
391
  acquireOAuthRefreshLock,
390
392
  buildAuthorizationUrl,
@@ -408,19 +410,20 @@ import {
408
410
  updateAuthorizationIdentity,
409
411
  updateOAuthAppById,
410
412
  upsertAuthorization
411
- } from "./cli-wvp6bvy4.js";
413
+ } from "./cli-zhjmqxzh.js";
412
414
  import"./cli-fad8m16k.js";
413
415
  import"./cli-aehm1rbq.js";
414
416
  import"./cli-bsakbbkm.js";
417
+ import"./cli-51tf7ac3.js";
415
418
  import {
416
- getFileStorageProvider
417
- } from "./cli-n1q8q14d.js";
419
+ MAX_TASK_ATTACHMENT_BYTES,
420
+ recordTaskAttachmentUpload
421
+ } from "./cli-mmemxxdc.js";
418
422
  import {
419
423
  FilesError,
424
+ getFileStorageProvider,
420
425
  normalizeFilesError
421
- } from "./cli-fhsz3twr.js";
422
- import"./cli-51tf7ac3.js";
423
- import"./cli-jnf5zghe.js";
426
+ } from "./cli-jsp14b6c.js";
424
427
  import {
425
428
  findUserById,
426
429
  fingerprintApiKey,
@@ -428,18 +431,20 @@ import {
428
431
  linkIdentity,
429
432
  listUserEvents,
430
433
  listUserTokens,
434
+ mintSessionToken,
431
435
  mintToken,
432
436
  recordIdentityEvent,
433
437
  recordUnmappedIdentity,
434
438
  renderIdentity,
435
439
  resolveIdentity,
436
440
  resolveUserByToken,
441
+ revokeSessionToken,
437
442
  revokeToken,
438
443
  unlinkIdentity
439
- } from "./cli-z96t0thj.js";
444
+ } from "./cli-p1d5b073.js";
440
445
  import {
441
446
  createTaskWithSiblingAwareness
442
- } from "./cli-axs8e6d4.js";
447
+ } from "./cli-53s590z8.js";
443
448
  import {
444
449
  ensure,
445
450
  getSlackApp,
@@ -455,8 +460,9 @@ import {
455
460
  withRemoteContext,
456
461
  withSpan,
457
462
  withSpanContext
458
- } from "./cli-jmb7g47h.js";
463
+ } from "./cli-b5bq9crk.js";
459
464
  import"./cli-q51yprfq.js";
465
+ import"./cli-9d8ntetj.js";
460
466
  import"./cli-yatxqynm.js";
461
467
  import {
462
468
  ActiveSessionSchema,
@@ -496,6 +502,7 @@ import {
496
502
  EventSourceSchema,
497
503
  EventStatusSchema,
498
504
  FavoriteItemTypeSchema,
505
+ HeartbeatExpiryError,
499
506
  InboxItemStateSchema,
500
507
  InboxItemStatusSchema,
501
508
  InboxItemTypeSchema,
@@ -526,7 +533,7 @@ import {
526
533
  PromptTemplateSchema,
527
534
  ProviderNameSchema,
528
535
  ReasoningEffortSchema,
529
- RepoGuidelinesSchema,
536
+ RepoGuidelinesInputSchema,
530
537
  RepoHooksSchema,
531
538
  ResumeReasonSchema,
532
539
  RuntimeInstanceSchema,
@@ -565,6 +572,7 @@ import {
565
572
  UserCommsPrefsSchema,
566
573
  UserFavoriteSchema,
567
574
  UserSchema,
575
+ VersionableFieldSchema,
568
576
  WorkflowDefinitionSchema,
569
577
  WorkflowEdgeSchema,
570
578
  WorkflowNodePatchSchema,
@@ -748,6 +756,7 @@ import {
748
756
  init_date_utils,
749
757
  init_db,
750
758
  init_default_drift,
759
+ init_heartbeat_expiry,
751
760
  init_request_auth_context,
752
761
  init_steering,
753
762
  init_swarm_config_guard,
@@ -756,7 +765,6 @@ import {
756
765
  init_types,
757
766
  insertActiveSession,
758
767
  insertPricingRow,
759
- insertTaskAttachment,
760
768
  installMcpServer,
761
769
  installSkill,
762
770
  isReservedConfigKey,
@@ -853,12 +861,12 @@ import {
853
861
  upsertSwarmConfig,
854
862
  validateConfigValue,
855
863
  withFavoriteFlags
856
- } from "./cli-f567d5c1.js";
864
+ } from "./cli-ftht3zzj.js";
857
865
  import {
858
866
  IDENTITY_FIELD_BUDGETS,
859
867
  IdentityFieldBudgetError,
860
868
  init_identity_field_budget
861
- } from "./cli-kpev657q.js";
869
+ } from "./cli-y6b6fb76.js";
862
870
  import {
863
871
  getAllTemplateDefinitions,
864
872
  getTemplateDefinition,
@@ -869,7 +877,7 @@ import {
869
877
  interpolate,
870
878
  isSteeringEnabled,
871
879
  resolveTemplate
872
- } from "./cli-7fnkj1hj.js";
880
+ } from "./cli-kpv03zhj.js";
873
881
  import {
874
882
  MAX_PROFILE_FILE_LENGTH,
875
883
  getAppUrl,
@@ -898,7 +906,7 @@ import {
898
906
  import {
899
907
  init_package,
900
908
  package_default
901
- } from "./cli-dc9k2ba9.js";
909
+ } from "./cli-w9kb3bk1.js";
902
910
  import {
903
911
  init_secret_scrubber,
904
912
  registerVolatileSecret,
@@ -2252,6 +2260,7 @@ var SDK_TOOL_NAME_MAP = {
2252
2260
  task_list: "get-tasks",
2253
2261
  task_get: "get-task-details",
2254
2262
  task_storeProgress: "store-progress",
2263
+ task_defer: "defer-task",
2255
2264
  task_poll: "poll-task",
2256
2265
  task_send: "send-task",
2257
2266
  task_cancel: "cancel-task",
@@ -3447,6 +3456,7 @@ init_db();
3447
3456
  init_telemetry();
3448
3457
  init_types();
3449
3458
  init_constants();
3459
+ init_heartbeat_expiry();
3450
3460
  init_identity_field_budget();
3451
3461
  init_secret_scrubber();
3452
3462
  function singleHeaderValue(req, name) {
@@ -3707,6 +3717,7 @@ var listAgentRuntimeInstances = route({
3707
3717
  404: { description: "Agent not found" }
3708
3718
  }
3709
3719
  });
3720
+ var ContentHashSchema = exports_external.string().regex(/^[0-9a-f]{64}$/, "sha256 hex");
3710
3721
  var ProfileSyncRejectionSchema = exports_external.object({
3711
3722
  field: exports_external.enum(["soulMd", "identityMd", "claudeMd", "toolsMd"]),
3712
3723
  diskSize: exports_external.number().int(),
@@ -3735,7 +3746,8 @@ var updateAgentProfileRoute = route({
3735
3746
  avatar: AgentAvatarSchema.nullable().optional(),
3736
3747
  changeSource: exports_external.string().optional(),
3737
3748
  changedByAgentId: exports_external.string().optional(),
3738
- changeReason: exports_external.string().optional()
3749
+ changeReason: exports_external.string().optional(),
3750
+ expectedHashes: exports_external.partialRecord(VersionableFieldSchema, ContentHashSchema).optional()
3739
3751
  }),
3740
3752
  responses: {
3741
3753
  200: { description: "Profile updated", schema: AgentWithCapacitySchema },
@@ -4022,6 +4034,7 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, _myAgentId)
4022
4034
  changedByAgentId: body.changedByAgentId ?? null,
4023
4035
  changeReason: body.changeReason ?? null
4024
4036
  } : undefined;
4037
+ const conflicts = [];
4025
4038
  let agent;
4026
4039
  try {
4027
4040
  agent = await updateAgentProfile(parsed.params.id, {
@@ -4035,8 +4048,15 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, _myAgentId)
4035
4048
  toolsMd: body.toolsMd,
4036
4049
  heartbeatMd: body.heartbeatMd,
4037
4050
  ...body.avatar !== undefined ? { avatar: body.avatar } : {}
4038
- }, versionMeta);
4051
+ }, versionMeta, {
4052
+ expectedHashes: body.expectedHashes,
4053
+ onConflict: (conflict) => conflicts.push(conflict)
4054
+ });
4039
4055
  } catch (error) {
4056
+ if (error instanceof HeartbeatExpiryError) {
4057
+ jsonError(res, error.message, 400);
4058
+ return true;
4059
+ }
4040
4060
  if (error instanceof IdentityFieldBudgetError) {
4041
4061
  if (versionMeta?.changeSource === "self_edit" || versionMeta?.changeSource === "session_sync") {
4042
4062
  try {
@@ -4070,10 +4090,25 @@ async function handleAgentsRest(req, res, pathSegments, queryParams, _myAgentId)
4070
4090
  jsonError(res, "Agent not found", 404);
4071
4091
  return true;
4072
4092
  }
4093
+ for (const conflict of conflicts) {
4094
+ try {
4095
+ await createEvent({
4096
+ category: "system",
4097
+ event: "system.profile_sync_conflict",
4098
+ status: "skipped",
4099
+ source: "api",
4100
+ agentId: parsed.params.id,
4101
+ data: { ...conflict, changeSource: versionMeta?.changeSource ?? null }
4102
+ });
4103
+ } catch (eventError) {
4104
+ const message = eventError instanceof Error ? eventError.message : String(eventError);
4105
+ console.error(scrubSecrets(`[profile-sync] Failed to persist conflict event: ${message}`));
4106
+ }
4107
+ }
4073
4108
  if (versionMeta?.changeSource === "self_edit" || versionMeta?.changeSource === "session_sync") {
4074
4109
  try {
4075
4110
  for (const field of Object.keys(IDENTITY_FIELD_BUDGETS)) {
4076
- if (body[field] === undefined)
4111
+ if (body[field] === undefined || conflicts.some((c) => c.field === field))
4077
4112
  continue;
4078
4113
  await createEvent({
4079
4114
  category: "system",
@@ -6463,7 +6498,6 @@ async function handleFavorites(req, res, pathSegments, queryParams, myAgentId) {
6463
6498
  // src/http/fs.ts
6464
6499
  init_zod();
6465
6500
  init_db();
6466
- import { createHash as createHash2 } from "node:crypto";
6467
6501
  init_types();
6468
6502
 
6469
6503
  // src/utils/content-disposition.ts
@@ -6477,7 +6511,6 @@ function attachmentContentDisposition(filename) {
6477
6511
  // src/http/fs.ts
6478
6512
  init_request_auth_context();
6479
6513
  init_secret_scrubber();
6480
- var MAX_UPLOAD_BYTES = 50 * 1024 * 1024;
6481
6514
  var SLOW_UPLOAD_LOG_MS = 3000;
6482
6515
  var taskParams = exports_external.object({ taskId: exports_external.uuid() });
6483
6516
  var attachmentParams = exports_external.object({ taskId: exports_external.uuid(), attachmentId: exports_external.uuid() });
@@ -6732,7 +6765,7 @@ async function handleFs(req, res, pathSegments, queryParams, myAgentId) {
6732
6765
  return sendDelete(res, attachment);
6733
6766
  }
6734
6767
  if (uploadTaskFileRoute.match(req.method, pathSegments)) {
6735
- if (enforceContentLengthCap(req, res, MAX_UPLOAD_BYTES) === BODY_TOO_LARGE)
6768
+ if (enforceContentLengthCap(req, res, MAX_TASK_ATTACHMENT_BYTES) === BODY_TOO_LARGE)
6736
6769
  return true;
6737
6770
  const parsed = await uploadTaskFileRoute.parse(req, res, pathSegments, queryParams);
6738
6771
  if (!parsed)
@@ -6766,9 +6799,9 @@ async function handleFs(req, res, pathSegments, queryParams, myAgentId) {
6766
6799
  return false;
6767
6800
  }
6768
6801
  async function sendUpload(req, res, taskId, query, agentId) {
6769
- const body = await readRawBody(req, MAX_UPLOAD_BYTES);
6802
+ const body = await readRawBody(req, MAX_TASK_ATTACHMENT_BYTES);
6770
6803
  if (body === BODY_TOO_LARGE) {
6771
- jsonError(res, `Payload too large (max ${MAX_UPLOAD_BYTES} bytes)`, 413);
6804
+ jsonError(res, `Payload too large (max ${MAX_TASK_ATTACHMENT_BYTES} bytes)`, 413);
6772
6805
  return true;
6773
6806
  }
6774
6807
  const provider = getFileStorageProvider();
@@ -6792,38 +6825,21 @@ async function sendUpload(req, res, taskId, query, agentId) {
6792
6825
  }
6793
6826
  return sendProviderError(res, error);
6794
6827
  }
6795
- try {
6796
- const auth = getCurrentRequestAuth();
6797
- const attachment = await insertTaskAttachment({
6798
- taskId,
6799
- agentId,
6800
- name: query.name,
6801
- kind: provider.id === "agent-fs" ? "agent-fs" : "shared-fs",
6802
- path: uploaded.key,
6803
- providerId: provider.id,
6804
- providerKey: uploaded.key,
6805
- capabilities: {
6806
- ...provider.capabilities,
6807
- version: uploaded.version,
6808
- etag: uploaded.etag
6809
- },
6810
- mimeType: uploaded.contentType ?? contentType,
6811
- sizeBytes: uploaded.sizeBytes ?? body.byteLength,
6812
- sha256: uploaded.sha256 ?? createHash2("sha256").update(body).digest("hex"),
6813
- intent: query.intent,
6814
- description: query.description,
6815
- isPrimary: query.isPrimary === "true",
6816
- createdBy: auth?.kind === "user" ? auth.userId : undefined
6817
- });
6818
- uploadTaskFileRoute.respond(res, 201, attachment);
6819
- } catch (error) {
6820
- try {
6821
- await provider.delete(scope);
6822
- } catch (cleanupError) {
6823
- console.warn(scrubSecrets(`[fs] upload metadata insert failed and blob cleanup failed: ${cleanupError instanceof Error ? cleanupError.message : String(cleanupError)}`));
6824
- }
6825
- throw error;
6826
- }
6828
+ const auth = getCurrentRequestAuth();
6829
+ const attachment = await recordTaskAttachmentUpload({
6830
+ provider,
6831
+ scope,
6832
+ uploaded,
6833
+ sizeBytes: body.byteLength,
6834
+ sha256: uploaded.sha256 ?? new Bun.CryptoHasher("sha256").update(body).digest("hex"),
6835
+ contentType,
6836
+ agentId,
6837
+ intent: query.intent,
6838
+ description: query.description,
6839
+ isPrimary: query.isPrimary === "true",
6840
+ createdBy: auth?.kind === "user" ? auth.userId : undefined
6841
+ });
6842
+ uploadTaskFileRoute.respond(res, 201, attachment);
6827
6843
  return true;
6828
6844
  }
6829
6845
  async function sendDownload(res, attachment) {
@@ -8961,6 +8977,7 @@ class StreamableHTTPServerTransport {
8961
8977
 
8962
8978
  // src/http/mcp.ts
8963
8979
  init_db();
8980
+ init_request_auth_context();
8964
8981
  var DEFAULT_MCP_TRANSPORT_IDLE_TIMEOUT_MS = 2 * 60 * 60 * 1000;
8965
8982
  function markMcpTransportActivity(sessionActivity, sessionId, now = Date.now()) {
8966
8983
  if (sessionId) {
@@ -8997,6 +9014,25 @@ function unauthorized(res, message = "Unauthorized") {
8997
9014
  res.end(JSON.stringify({ error: message }));
8998
9015
  return true;
8999
9016
  }
9017
+ function forbidden2(res, message) {
9018
+ res.writeHead(403, { "Content-Type": "application/json" });
9019
+ res.end(JSON.stringify({ error: message }));
9020
+ return true;
9021
+ }
9022
+ function validateAgentTokenIdentity(req, res) {
9023
+ const auth = getRequestAuth(req);
9024
+ if (!auth || auth.kind !== "agent")
9025
+ return;
9026
+ const agentId = headerValue(req.headers["x-agent-id"]);
9027
+ const taskId = headerValue(req.headers["x-source-task-id"]);
9028
+ if (!agentId || agentId !== auth.agentId) {
9029
+ return forbidden2(res, "X-Agent-ID does not match session token");
9030
+ }
9031
+ if (!taskId || taskId !== auth.taskId) {
9032
+ return forbidden2(res, "X-Source-Task-Id does not match session token");
9033
+ }
9034
+ return;
9035
+ }
9000
9036
  function headerValue(value) {
9001
9037
  return Array.isArray(value) ? value[0] : value;
9002
9038
  }
@@ -9028,6 +9064,9 @@ async function handleMcp(req, res, transports, sessionActivity = {}, sessionAgen
9028
9064
  if (req.url !== "/mcp") {
9029
9065
  return false;
9030
9066
  }
9067
+ const tokenIdentityMismatch = validateAgentTokenIdentity(req, res);
9068
+ if (tokenIdentityMismatch)
9069
+ return true;
9031
9070
  const agentMismatch = validateBoundAgent(req, res, sessionId, sessionAgents);
9032
9071
  if (agentMismatch)
9033
9072
  return true;
@@ -13222,9 +13261,11 @@ var getPageVersionRoute = route({
13222
13261
  function applyLaunchCors(req, res) {
13223
13262
  const origin = req.headers.origin ?? "";
13224
13263
  if (origin) {
13225
- res.setHeader("Access-Control-Allow-Origin", origin);
13226
13264
  res.setHeader("Vary", "Origin");
13227
- res.setHeader("Access-Control-Allow-Credentials", "true");
13265
+ if (isOriginAllowedForCredentials(origin)) {
13266
+ res.setHeader("Access-Control-Allow-Origin", origin);
13267
+ res.setHeader("Access-Control-Allow-Credentials", "true");
13268
+ }
13228
13269
  }
13229
13270
  res.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
13230
13271
  res.setHeader("Access-Control-Allow-Headers", "Authorization, Content-Type");
@@ -13568,13 +13609,13 @@ var publicPageRoute = route({
13568
13609
  method: "get",
13569
13610
  path: "/p/{id}",
13570
13611
  pattern: ["p", null],
13571
- summary: "Render a page (HTML inline; JSON redirects to SPA)",
13612
+ summary: "Render a page (HTML/SVG inline; JSON redirects to SPA)",
13572
13613
  tags: ["Pages"],
13573
13614
  params: exports_external.object({ id: exports_external.string() }),
13574
13615
  responses: {
13575
13616
  200: {
13576
- description: "Rendered HTML page",
13577
- unstructured: "Serves the page's raw agent-authored HTML body (SDK-injected) or, for ?print=1 on a JSON-content page, a standalone printable HTML document — not a JSON shape"
13617
+ description: "Rendered HTML page or raw SVG image",
13618
+ unstructured: "Serves raw image/svg+xml bytes, the page's agent-authored HTML body (SDK-injected) or, for ?print=1 on a JSON-content page, a standalone printable HTML document — not a JSON shape"
13578
13619
  },
13579
13620
  302: { description: "Redirect to SPA for JSON content" },
13580
13621
  401: { description: "Page requires an authenticated session" },
@@ -13921,6 +13962,20 @@ async function handlePagesPublic(req, res, pathSegments, queryParams) {
13921
13962
  await bumpViewCount(page.id);
13922
13963
  return true;
13923
13964
  }
13965
+ if (page.contentType === "image/svg+xml") {
13966
+ const headers3 = {
13967
+ "Content-Type": "image/svg+xml",
13968
+ "Cache-Control": page.authMode === "public" ? "public, max-age=1800" : "private, no-store",
13969
+ "X-Content-Type-Options": "nosniff",
13970
+ "Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; sandbox"
13971
+ };
13972
+ if (inlineSetCookie)
13973
+ headers3["Set-Cookie"] = inlineSetCookie;
13974
+ res.writeHead(200, headers3);
13975
+ res.end(page.body);
13976
+ await bumpViewCount(page.id);
13977
+ return true;
13978
+ }
13924
13979
  const wantsPrint = queryParams.get("print") === "1";
13925
13980
  if (page.contentType === "application/json") {
13926
13981
  if (wantsPrint) {
@@ -14103,11 +14158,13 @@ var PollTriggerAttachmentSchema = TaskAttachmentSchema.pick({
14103
14158
  sizeBytes: true
14104
14159
  });
14105
14160
  var PollRequestedBySchema = UserSchema.pick({
14161
+ id: true,
14106
14162
  name: true,
14107
14163
  email: true,
14108
14164
  role: true,
14109
14165
  notes: true
14110
14166
  }).extend({
14167
+ id: exports_external.string().optional(),
14111
14168
  comms: UserCommsPrefsSchema.optional()
14112
14169
  });
14113
14170
  var PollTaskOfferedTriggerSchema = exports_external.object({
@@ -14174,6 +14231,7 @@ async function buildTriggerRequestedBy(task) {
14174
14231
  const user = task.requestedByUserId ? await getUserById(task.requestedByUserId) : undefined;
14175
14232
  if (user) {
14176
14233
  return {
14234
+ id: user.id,
14177
14235
  name: user.name,
14178
14236
  email: user.email,
14179
14237
  role: user.role,
@@ -14499,13 +14557,13 @@ init_zod();
14499
14557
  init_db();
14500
14558
  init_types();
14501
14559
  init_secret_scrubber();
14502
- import { createHash as createHash3 } from "node:crypto";
14560
+ import { createHash as createHash2 } from "node:crypto";
14503
14561
  function apiKeyFingerprint2(req) {
14504
14562
  const authHeader = req.headers.authorization;
14505
14563
  const providedKey = authHeader?.startsWith("Bearer ") ? authHeader.slice(7) : "";
14506
14564
  if (!providedKey)
14507
14565
  return "";
14508
- const digest = createHash3("sha256").update(providedKey).digest("hex").slice(0, 8);
14566
+ const digest = createHash2("sha256").update(providedKey).digest("hex").slice(0, 8);
14509
14567
  return scrubSecrets(digest);
14510
14568
  }
14511
14569
  var PricingTriplePathParams = exports_external.object({
@@ -15160,7 +15218,7 @@ var createRepo = route({
15160
15218
  defaultBranch: exports_external.string().optional(),
15161
15219
  autoClone: exports_external.boolean().optional(),
15162
15220
  hooks: RepoHooksSchema.optional(),
15163
- guidelines: RepoGuidelinesSchema.nullable().optional()
15221
+ guidelines: RepoGuidelinesInputSchema.nullable().optional()
15164
15222
  }),
15165
15223
  responses: {
15166
15224
  201: { description: "Repo created", schema: SwarmRepoSchema },
@@ -15182,7 +15240,7 @@ var updateRepo = route({
15182
15240
  defaultBranch: exports_external.string().optional(),
15183
15241
  autoClone: exports_external.boolean().optional(),
15184
15242
  hooks: RepoHooksSchema.nullable().optional(),
15185
- guidelines: RepoGuidelinesSchema.nullable().optional()
15243
+ guidelines: RepoGuidelinesInputSchema.nullable().optional()
15186
15244
  }),
15187
15245
  responses: {
15188
15246
  200: { description: "Repo updated", schema: SwarmRepoSchema },
@@ -20051,6 +20109,7 @@ init_zod();
20051
20109
  init_db();
20052
20110
  init_steering();
20053
20111
  init_types();
20112
+ init_request_auth_context();
20054
20113
  var AgentTaskSummarySchema = AgentTaskSchema.pick({
20055
20114
  id: true,
20056
20115
  key: true,
@@ -20090,6 +20149,50 @@ var TaskWithSteeringSchema = AgentTaskSchema.extend({
20090
20149
  isLeadTask: exports_external.boolean(),
20091
20150
  supportedSteerModes: exports_external.array(SteerModeSchema)
20092
20151
  });
20152
+ var MAX_SESSION_TOKEN_TTL_MS = 7 * 24 * 60 * 60 * 1000;
20153
+ var mintSessionTokenRoute = route({
20154
+ method: "post",
20155
+ path: "/api/sessions/tokens",
20156
+ pattern: ["api", "sessions", "tokens"],
20157
+ summary: "Mint an ephemeral session token for an ACP provider session",
20158
+ description: "Returns a short-lived aseph_ bearer for use by the ACP adapter in place of the full " + "operator key. The token expires at the requested TTL and is actively revoked when the " + "session ends. Only the operator key may mint session tokens.",
20159
+ tags: ["Sessions"],
20160
+ body: exports_external.object({
20161
+ agentId: exports_external.string().min(1),
20162
+ taskId: exports_external.string().min(1),
20163
+ ttlMs: exports_external.number().int().positive().max(MAX_SESSION_TOKEN_TTL_MS)
20164
+ }),
20165
+ responses: {
20166
+ 200: {
20167
+ description: "Minted token plaintext (returned once) and its stable token ID",
20168
+ schema: exports_external.object({
20169
+ tokenId: exports_external.string(),
20170
+ plaintext: exports_external.string()
20171
+ })
20172
+ },
20173
+ 400: { description: "Validation error" },
20174
+ 401: { description: "Unauthorized" }
20175
+ },
20176
+ auth: { apiKey: true },
20177
+ rbac: { ungated: "operator-only: minting is gated on the full operator key in auth middleware" }
20178
+ });
20179
+ var revokeSessionTokenRoute = route({
20180
+ method: "delete",
20181
+ path: "/api/sessions/tokens/{tokenId}",
20182
+ pattern: ["api", "sessions", "tokens", null],
20183
+ summary: "Revoke an ephemeral session token",
20184
+ description: "Revokes an aseph_ bearer token by ID. No-op if already revoked.",
20185
+ tags: ["Sessions"],
20186
+ params: exports_external.object({ tokenId: exports_external.string() }),
20187
+ responses: {
20188
+ 204: { description: "Token revoked (or was already revoked)" },
20189
+ 401: { description: "Unauthorized" }
20190
+ },
20191
+ auth: { apiKey: true },
20192
+ rbac: {
20193
+ ungated: "operator-only: revocation is gated on the full operator key in auth middleware"
20194
+ }
20195
+ });
20093
20196
  var listSessions = route({
20094
20197
  method: "get",
20095
20198
  path: "/api/sessions",
@@ -20140,6 +20243,32 @@ var getSession = route({
20140
20243
  auth: { apiKey: true }
20141
20244
  });
20142
20245
  async function handleSessions(req, res, pathSegments, queryParams) {
20246
+ if (mintSessionTokenRoute.match(req.method, pathSegments)) {
20247
+ if (getRequestAuth(req)?.kind !== "operator") {
20248
+ jsonError(res, "Unauthorized", 401);
20249
+ return true;
20250
+ }
20251
+ const parsed = await mintSessionTokenRoute.parse(req, res, pathSegments, queryParams);
20252
+ if (!parsed)
20253
+ return true;
20254
+ const { agentId, taskId, ttlMs } = parsed.body;
20255
+ const token = await mintSessionToken(agentId, taskId, ttlMs);
20256
+ mintSessionTokenRoute.respond(res, 200, { tokenId: token.tokenId, plaintext: token.plaintext });
20257
+ return true;
20258
+ }
20259
+ if (revokeSessionTokenRoute.match(req.method, pathSegments)) {
20260
+ if (getRequestAuth(req)?.kind !== "operator") {
20261
+ jsonError(res, "Unauthorized", 401);
20262
+ return true;
20263
+ }
20264
+ const parsed = await revokeSessionTokenRoute.parse(req, res, pathSegments, queryParams);
20265
+ if (!parsed)
20266
+ return true;
20267
+ await revokeSessionToken(parsed.params.tokenId);
20268
+ res.writeHead(204);
20269
+ res.end();
20270
+ return true;
20271
+ }
20143
20272
  if (listSessions.match(req.method, pathSegments)) {
20144
20273
  const parsed = await listSessions.parse(req, res, pathSegments, queryParams);
20145
20274
  if (!parsed)
@@ -22144,7 +22273,9 @@ var listPausedTasks = route({
22144
22273
  responses: {
22145
22274
  200: {
22146
22275
  description: "Paused task list",
22147
- schema: exports_external.object({ tasks: exports_external.array(AgentTaskSchema) })
22276
+ schema: exports_external.object({
22277
+ tasks: exports_external.array(AgentTaskSchema.extend({ attachments: exports_external.array(TaskAttachmentSchema) }))
22278
+ })
22148
22279
  }
22149
22280
  }
22150
22281
  });
@@ -22850,7 +22981,11 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
22850
22981
  return true;
22851
22982
  }
22852
22983
  const pausedTasks = await getPausedTasksForAgent(myAgentId);
22853
- listPausedTasks.respond(res, 200, { tasks: pausedTasks });
22984
+ const tasks = await Promise.all(pausedTasks.map(async (task) => ({
22985
+ ...task,
22986
+ attachments: await getTaskAttachments(task.id)
22987
+ })));
22988
+ listPausedTasks.respond(res, 200, { tasks });
22854
22989
  return true;
22855
22990
  }
22856
22991
  if (pauseTaskRoute.match(req.method, pathSegments)) {
@@ -26369,7 +26504,7 @@ async function shutdown() {
26369
26504
  sessionsProcessed: getServerSessionsProcessed()
26370
26505
  });
26371
26506
  if (hasCapability("scheduling")) {
26372
- const { stopScheduler } = await import("./index-nqvf26za.js");
26507
+ const { stopScheduler } = await import("./index-x5j894zf.js");
26373
26508
  stopScheduler();
26374
26509
  }
26375
26510
  stopHeartbeat();
@@ -26377,7 +26512,7 @@ async function shutdown() {
26377
26512
  await stopScriptRunSupervisor();
26378
26513
  await stopSlackApp();
26379
26514
  if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
26380
- const { stopOAuthKeepalive } = await import("./keepalive-xs8fa55y.js");
26515
+ const { stopOAuthKeepalive } = await import("./keepalive-w733ax66.js");
26381
26516
  await stopOAuthKeepalive();
26382
26517
  }
26383
26518
  stopOAuthPendingGc();
@@ -26437,21 +26572,22 @@ try {
26437
26572
  process.exitCode = 1;
26438
26573
  throw err;
26439
26574
  }
26575
+ warnIfCorsAllowsAnyOrigin();
26440
26576
  try {
26441
26577
  await seedLegacyCapabilitiesConfig();
26442
26578
  } catch (err) {
26443
26579
  console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
26444
26580
  }
26445
26581
  try {
26446
- const { seedPricingFromModelsDev } = await import("./seed-pricing-t223sw91.js");
26582
+ const { seedPricingFromModelsDev } = await import("./seed-pricing-g62hy1pk.js");
26447
26583
  seedPricingFromModelsDev();
26448
- const { startPricingRefreshLoop } = await import("./pricing-refresh-e5jhzz4j.js");
26584
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-9nzsrgcq.js");
26449
26585
  startPricingRefreshLoop();
26450
26586
  } catch (err) {
26451
26587
  console.error("[startup] Failed to seed pricing rows:", err);
26452
26588
  }
26453
26589
  try {
26454
- const { ensureRbacSeedsSynced } = await import("./rbac-roles-p1mf40z3.js");
26590
+ const { ensureRbacSeedsSynced } = await import("./rbac-roles-r3hqjp09.js");
26455
26591
  ensureRbacSeedsSynced();
26456
26592
  } catch (err) {
26457
26593
  console.error("[startup] Failed to sync RBAC seed rows:", err);
@@ -26459,7 +26595,7 @@ try {
26459
26595
  throw err;
26460
26596
  }
26461
26597
  try {
26462
- const { runAllSeeders } = await import("./index-53zyht4z.js");
26598
+ const { runAllSeeders } = await import("./index-tce1rss4.js");
26463
26599
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
26464
26600
  } catch (err) {
26465
26601
  console.error("[startup] Failed to seed built-in entities:", err);
@@ -26500,36 +26636,36 @@ httpServer.listen(port, async () => {
26500
26636
  await initWorkflows();
26501
26637
  await startScriptRunSupervisor(getMcpBaseUrl());
26502
26638
  if (hasCapability("scheduling")) {
26503
- const { startScheduler } = await import("./index-nqvf26za.js");
26504
- const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-gay66b9w.js");
26639
+ const { startScheduler } = await import("./index-x5j894zf.js");
26640
+ const { getExecutorRegistry: getExecutorRegistry2 } = await import("./index-k8znfx0z.js");
26505
26641
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
26506
26642
  startScheduler(getExecutorRegistry2(), intervalMs, {
26507
26643
  runId: globalState.__runId
26508
26644
  });
26509
26645
  }
26510
26646
  if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
26511
- const { startHeartbeat } = await import("./index-q3qja6ta.js");
26647
+ const { startHeartbeat } = await import("./index-hssww7kj.js");
26512
26648
  const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
26513
26649
  startHeartbeat(heartbeatMs);
26514
26650
  }
26515
26651
  if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
26516
- const { startOAuthKeepalive } = await import("./keepalive-xs8fa55y.js");
26652
+ const { startOAuthKeepalive } = await import("./keepalive-w733ax66.js");
26517
26653
  startOAuthKeepalive();
26518
26654
  }
26519
26655
  if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
26520
- const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-03snsye5.js");
26656
+ const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-wdetky26.js");
26521
26657
  startOAuthRefreshSweep();
26522
26658
  }
26523
26659
  startOAuthPendingGc();
26524
26660
  await startMemoryGc();
26525
26661
  await startDbRetention();
26526
- import("./boot-reembed-072x00vn.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
26662
+ import("./boot-reembed-az5rassp.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
26527
26663
  console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
26528
26664
  });
26529
- import("./boot-reembed-65zz2smt.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
26665
+ import("./boot-reembed-j3mm3rfz.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
26530
26666
  console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
26531
26667
  });
26532
- import("./boot-scrub-logs-yz0ams04.js").then(({ runBootScrubLogs }) => runBootScrubLogs()).catch((err) => {
26668
+ import("./boot-scrub-logs-b6h54817.js").then(({ runBootScrubLogs }) => runBootScrubLogs()).catch((err) => {
26533
26669
  console.error("[boot-scrub-logs] startup scrub failed (non-fatal):", err);
26534
26670
  });
26535
26671
  }).on("error", (err) => {