@desplega.ai/agent-swarm 2.4.3 → 2.4.4

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 (150) hide show
  1. package/dist/{acp-adapter-1885dpr7.js → acp-adapter-thq04adh.js} +1 -2
  2. package/dist/{actions-pn76n32q.js → actions-j6ywh6x5.js} +17 -17
  3. package/dist/{amp-adapter-af84rx1d.js → amp-adapter-k8b5xmj8.js} +2 -2
  4. package/dist/{app-6sv8mhzm.js → app-rb7vc02s.js} +3 -3
  5. package/dist/{assistant-sc2tf825.js → assistant-ftta1zjf.js} +18 -18
  6. package/dist/{boot-reembed-y3m0ydzj.js → boot-reembed-srp6v6af.js} +1 -1
  7. package/dist/{boot-reembed-gvxjs2py.js → boot-reembed-xns7h5h9.js} +1 -1
  8. package/dist/{boot-scrub-sweep-1j9mk05f.js → boot-scrub-sweep-3qqrh2mz.js} +2 -2
  9. package/dist/{boot-seeds-37sp626b.js → boot-seeds-9ks8hce7.js} +4 -4
  10. package/dist/{claude-adapter-rp0jtnwr.js → claude-adapter-k5ksyres.js} +2 -2
  11. package/dist/{claude-managed-setup-rdt248k7.js → claude-managed-setup-n5a5eqks.js} +1 -1
  12. package/dist/{claude-sdk-session-53rcw5we.js → claude-sdk-session-2j3j4kwn.js} +2 -2
  13. package/dist/{cli-v87dr6e3.js → cli-1d70crsy.js} +1 -1
  14. package/dist/{cli-1ma335fz.js → cli-1ephgwnq.js} +2 -2
  15. package/dist/{cli-4yef8ghv.js → cli-2v045xyf.js} +3 -3
  16. package/dist/{cli-73ezfhha.js → cli-2y91wnbh.js} +10 -5
  17. package/dist/{cli-1eszr343.js → cli-2zqpkvtt.js} +1 -1
  18. package/dist/{cli-e4d78xsv.js → cli-37yb7307.js} +1 -1
  19. package/dist/{cli-8y99kfey.js → cli-3cgngyd8.js} +9 -9
  20. package/dist/{cli-wk28hzqn.js → cli-44159k28.js} +1 -1
  21. package/dist/{cli-qp2m4btv.js → cli-4dg55wsk.js} +2 -2
  22. package/dist/{cli-0dxxwfkt.js → cli-51y09c6p.js} +17 -14
  23. package/dist/{cli-aa3tb29r.js → cli-55qmbp6z.js} +1 -1
  24. package/dist/{cli-mzkwkbdy.js → cli-82d3nkc3.js} +1 -1
  25. package/dist/{cli-sds5zzs8.js → cli-9fhkkpj5.js} +78 -12
  26. package/dist/{cli-vq9gqarq.js → cli-amyhm3gj.js} +1 -1
  27. package/dist/{cli-bxrqvpg5.js → cli-b8k7epj1.js} +5 -5
  28. package/dist/{cli-8vverzf7.js → cli-ba8ne1es.js} +5 -0
  29. package/dist/{cli-58vwn100.js → cli-bnz0r3kc.js} +1 -1
  30. package/dist/{cli-6eyncg0y.js → cli-cynvc9fj.js} +34 -6
  31. package/dist/{cli-f0p0f6ja.js → cli-dqb4n629.js} +7 -7
  32. package/dist/{cli-pygdsgh8.js → cli-esxerzg7.js} +1 -1
  33. package/dist/{cli-dm8p2dpf.js → cli-gqvh8d8a.js} +6 -6
  34. package/dist/{cli-p0qerd2r.js → cli-hj3debgw.js} +1 -1
  35. package/dist/{cli-836ehxmt.js → cli-nc35pxb7.js} +2 -2
  36. package/dist/{cli-vcgscaan.js → cli-p20r8w42.js} +8 -6
  37. package/dist/{cli-1xsraagq.js → cli-pccfmtb5.js} +4 -4
  38. package/dist/{cli-s9rr4gr2.js → cli-q6r7t299.js} +1036 -298
  39. package/dist/{cli-tkf4x6ha.js → cli-qkhc5aqy.js} +11 -11
  40. package/dist/{cli-1n9gdg56.js → cli-t7cyef5g.js} +4 -4
  41. package/dist/{cli-038fga5k.js → cli-te6b5wvg.js} +148 -183
  42. package/dist/{cli-kgnkyabk.js → cli-v3yr2gbg.js} +109 -35
  43. package/dist/{cli-h0mgxann.js → cli-vdm20wej.js} +2 -2
  44. package/dist/{cli-zvbb4n0e.js → cli-vq97g1jq.js} +2 -2
  45. package/dist/{cli-gx0j2khs.js → cli-w6nadkh4.js} +3 -3
  46. package/dist/{cli-99jez72r.js → cli-w9etnnxk.js} +6 -1
  47. package/dist/{cli-npfe9t1s.js → cli-xc27fwzg.js} +2 -2
  48. package/dist/{cli-6aen3ezb.js → cli-xj0re5tm.js} +1 -1
  49. package/dist/{cli-aypbg9r2.js → cli-zrk6jxv8.js} +1 -1
  50. package/dist/{cli-1012xb7j.js → cli-zrwpctp4.js} +20 -20
  51. package/dist/cli.js +41 -16
  52. package/dist/{codex-adapter-2zrmab9b.js → codex-adapter-968xwfy7.js} +1 -1
  53. package/dist/{codex-session-runner-kbkz62vc.js → codex-session-runner-ht4z99fa.js} +1 -1
  54. package/dist/{commands-hd574th6.js → commands-pcymaeg9.js} +2 -2
  55. package/dist/{controller-pz5mcfg4.js → controller-fpjyk46r.js} +2 -2
  56. package/dist/{controllers-connect-5rgq2hfk.js → controllers-connect-mwzx1fh6.js} +18 -18
  57. package/dist/{cursor-adapter-mgaprq0j.js → cursor-adapter-cp4s2e2f.js} +1 -1
  58. package/dist/{db-h06dxp05.js → db-sgd12bt9.js} +3 -3
  59. package/dist/{db-6nf1207q.js → db-xsjg9jqq.js} +1 -1
  60. package/dist/{dispatcher-zthpy4m1.js → dispatcher-x0jfw2c9.js} +16 -16
  61. package/dist/{dsh-adapter-64dhw0j7.js → dsh-adapter-jrq7ma7h.js} +1 -1
  62. package/dist/{external-channel-x01t7ke6.js → external-channel-8njj4h3b.js} +2 -2
  63. package/dist/{grok-adapter-h21jv594.js → grok-adapter-kkr97v2f.js} +2 -3
  64. package/dist/handlers-0pvee9nw.js +39 -0
  65. package/dist/{heartbeat-zzfksckz.js → heartbeat-wd03zhn0.js} +19 -19
  66. package/dist/{hook-z4zhzj1f.js → hook-f0vghj42.js} +1 -1
  67. package/dist/{hook-3xfqhh2s.js → hook-xzj2ts2p.js} +1 -1
  68. package/dist/{http-q813tmya.js → http-4hwxv62p.js} +255 -117
  69. package/dist/{index-va3y63es.js → index-6srwvd5b.js} +1 -2
  70. package/dist/{index-220tk9bw.js → index-97q4xn03.js} +19 -10
  71. package/dist/{index-s98037v0.js → index-cbxkmfc5.js} +1 -2
  72. package/dist/{index-m0a4ydqj.js → index-gdh8jrdm.js} +16 -16
  73. package/dist/{index-wbbs14c5.js → index-hg0x2cdv.js} +16 -16
  74. package/dist/{index-d0g18bax.js → index-thm0y6a8.js} +19 -19
  75. package/dist/{index-x8xbyn1t.js → index-ww2vznkp.js} +1 -1
  76. package/dist/{keepalive-y5t1my7m.js → keepalive-hrh7xnr9.js} +3 -3
  77. package/dist/{lead-2xwtq66b.js → lead-ee8vazz2.js} +26 -27
  78. package/dist/{maintenance-ybfsaedv.js → maintenance-e8wnwnqx.js} +1 -1
  79. package/dist/{oauth-refresh-sweep-909jmn12.js → oauth-refresh-sweep-zm0yj4sj.js} +2 -2
  80. package/dist/{onboard-xn6fkkys.js → onboard-dtwcq603.js} +2 -2
  81. package/dist/{otel-impl-e6mn0z13.js → otel-impl-w3fbhpn0.js} +1 -1
  82. package/dist/{pricing-refresh-ygd362ep.js → pricing-refresh-j38dehfs.js} +3 -3
  83. package/dist/{rbac-roles-c9axvfnz.js → rbac-roles-ae8yttq4.js} +2 -2
  84. package/dist/{rbac-roles-mb470p4e.js → rbac-roles-ejxx9b35.js} +2 -2
  85. package/dist/{render-v2-g0306nh1.js → render-v2-n16n0phe.js} +3 -3
  86. package/dist/{resume-v315hnq6.js → resume-z0fgjc38.js} +5 -5
  87. package/dist/{session-access-2zg285a1.js → session-access-cv3mq6mc.js} +6 -4
  88. package/dist/{setup-a4mtf02k.js → setup-mafhj3yt.js} +1 -1
  89. package/dist/{work-objects-9fr0fgtn.js → work-objects-8b86mgjp.js} +19 -19
  90. package/dist/{worker-qae22jeb.js → worker-16s75hm5.js} +26 -27
  91. package/dist/worker-token-xf11yyds.js +136 -0
  92. package/openapi.json +295 -12
  93. package/package.json +4 -4
  94. package/src/apps/action-runner.ts +4 -0
  95. package/src/apps/catalog.generated.json +3 -0
  96. package/src/apps/page-validator.ts +8 -2
  97. package/src/be/migrations/232_agent_session_tokens.sql +41 -0
  98. package/src/be/seed-scripts/catalog/heartbeat-jev-gate.ts +10 -1
  99. package/src/be/swarm-config-guard.ts +16 -0
  100. package/src/be/users.ts +169 -12
  101. package/src/cli.tsx +24 -0
  102. package/src/commands/worker-token.ts +164 -0
  103. package/src/http/apps.ts +43 -5
  104. package/src/http/codex-oauth-keep-warm.ts +27 -9
  105. package/src/http/config.ts +5 -3
  106. package/src/http/core.ts +2 -0
  107. package/src/http/session-access.ts +51 -2
  108. package/src/http/sessions.ts +249 -10
  109. package/src/http/tasks.ts +4 -32
  110. package/src/providers/acp-adapter.ts +33 -13
  111. package/src/providers/acp-swarm-events.ts +1 -1
  112. package/src/providers/amp-adapter.ts +1 -1
  113. package/src/providers/codex-oauth/storage.ts +1 -1
  114. package/src/rbac/legacy-policy.ts +3 -1
  115. package/src/rbac/permissions.ts +4 -0
  116. package/src/tests/acp-adapter.test.ts +10 -23
  117. package/src/tests/acp-fake-agent.ts +36 -0
  118. package/src/tests/acp-swarm-events.test.ts +1 -1
  119. package/src/tests/agent-session-tokens.test.ts +452 -0
  120. package/src/tests/apps-action-parent-task.test.ts +295 -0
  121. package/src/tests/codex-oauth-keep-warm.test.ts +85 -1
  122. package/src/tests/config-session-auth.test.ts +14 -0
  123. package/src/tests/docs-index-footprint.test.js +2 -2
  124. package/src/tests/grok-adapter.test.ts +3 -3
  125. package/src/tests/heartbeat-jev-gate.test.ts +23 -0
  126. package/src/tests/migration-232-agent-session-tokens.test.ts +67 -0
  127. package/src/tests/rbac-engine.test.ts +1 -0
  128. package/src/tests/runtime-child-token-cleanup.test.ts +3 -3
  129. package/src/tests/script-connections.test.ts +2 -0
  130. package/src/tests/session-route-posture.test.ts +2 -0
  131. package/src/tests/worker-token-cli.test.ts +76 -0
  132. package/src/tests/workflow-executors.test.ts +4 -2
  133. package/src/tests/workflow-system-one-extraction.test.ts +805 -0
  134. package/src/types.ts +2 -1
  135. package/src/utils/request-auth-context.ts +2 -1
  136. package/src/workflows/definition.ts +7 -1
  137. package/src/workflows/engine.ts +18 -12
  138. package/src/workflows/executors/index.ts +1 -0
  139. package/src/workflows/executors/registry.ts +2 -0
  140. package/src/workflows/executors/system-one-decision.ts +56 -255
  141. package/src/workflows/executors/system-one-extract-wire.ts +57 -0
  142. package/src/workflows/executors/system-one-extraction.ts +830 -0
  143. package/src/workflows/executors/system-one-providers.ts +277 -110
  144. package/src/workflows/executors/system-one-transport.ts +264 -0
  145. package/templates/official/lead/HEARTBEAT.md +1 -1
  146. package/templates/skills/apps/SKILL.md +3 -1
  147. package/templates/skills/apps/content.md +3 -1
  148. package/templates/skills/heartbeat-runbook/content.md +3 -3
  149. package/dist/cli-v1sjhn52.js +0 -7
  150. package/dist/handlers-2qjw434w.js +0 -39
@@ -177,6 +177,9 @@ import {
177
177
  scheduleIntegrationsReload,
178
178
  handleCore,
179
179
  userCtx,
180
+ requestPrincipal,
181
+ agentFirstPrincipal,
182
+ rejectGuest,
180
183
  handleApps,
181
184
  cancelApprovalRequest,
182
185
  getUserCommsPrefs,
@@ -280,7 +283,7 @@ import {
280
283
  hasCapability,
281
284
  getEnabledCapabilities,
282
285
  createServer
283
- } from "./cli-kgnkyabk.js";
286
+ } from "./cli-v3yr2gbg.js";
284
287
  import {
285
288
  chatThreadOfContextKey,
286
289
  agentContextKey,
@@ -446,6 +449,7 @@ import {
446
449
  reservedKeyError,
447
450
  MAX_DB_RETENTION_DAYS,
448
451
  DB_RETENTION_TUNING_BOUNDS,
452
+ CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS,
449
453
  validateConfigValue,
450
454
  validateExportToEnv,
451
455
  init_swarm_config_guard,
@@ -716,26 +720,26 @@ import {
716
720
  countScriptRunJournalSteps2,
717
721
  countScriptRunJournalAgentTaskSteps2,
718
722
  init_db3
719
- } from "./cli-vcgscaan.js";
723
+ } from "./cli-p20r8w42.js";
720
724
  import {
721
725
  getUserGrant2,
722
726
  init_rbac_roles
723
- } from "./cli-qp2m4btv.js";
724
- import"./cli-1n9gdg56.js";
727
+ } from "./cli-4dg55wsk.js";
728
+ import"./cli-t7cyef5g.js";
725
729
  import {
726
730
  normalizeModelKey
727
- } from "./cli-vq9gqarq.js";
731
+ } from "./cli-amyhm3gj.js";
728
732
  import {
729
733
  upsertModelCatalogOverlay,
730
734
  deleteModelCatalogOverlay,
731
735
  loadModelsCatalog,
732
736
  requestModelCatalogRefresh2
733
- } from "./cli-npfe9t1s.js";
737
+ } from "./cli-xc27fwzg.js";
734
738
  import {
735
739
  AMP_ESTIMATE_MODELS,
736
740
  ampBillsCacheWrites,
737
741
  resolveAmpModel
738
- } from "./cli-1eszr343.js";
742
+ } from "./cli-2zqpkvtt.js";
739
743
  import {
740
744
  automationIntegrationFixUrl,
741
745
  preflightAutomation,
@@ -747,7 +751,7 @@ import {
747
751
  cancelWorkflowRun2,
748
752
  TriggerSchemaError,
749
753
  startWorkflowExecution2
750
- } from "./cli-0dxxwfkt.js";
754
+ } from "./cli-51y09c6p.js";
751
755
  import {
752
756
  require_dist2,
753
757
  isInvalidClientError,
@@ -827,14 +831,14 @@ import {
827
831
  typecheckWithAmbient,
828
832
  typecheckScript,
829
833
  parseSkillContent
830
- } from "./cli-73ezfhha.js";
834
+ } from "./cli-2y91wnbh.js";
831
835
  import {
832
836
  buildAuthorizationUrl,
833
837
  exchangeAuthorizationCode,
834
838
  oauthAppRowToProviderConfig,
835
839
  forceRefreshAuthorizationOrThrow,
836
840
  forceRefreshTokenOrThrow
837
- } from "./cli-pygdsgh8.js";
841
+ } from "./cli-esxerzg7.js";
838
842
  import {
839
843
  signalProcessGroup,
840
844
  detachedProcessGroup,
@@ -862,14 +866,14 @@ import {
862
866
  getSlackApp2,
863
867
  startSlackApp2,
864
868
  stopSlackApp2
865
- } from "./cli-tkf4x6ha.js";
866
- import"./cli-v87dr6e3.js";
869
+ } from "./cli-qkhc5aqy.js";
870
+ import"./cli-1d70crsy.js";
867
871
  import {
868
872
  createApprovalFollowUpTask,
869
873
  generateEdges,
870
874
  definitionNodeIds,
871
875
  validateDefinition
872
- } from "./cli-s9rr4gr2.js";
876
+ } from "./cli-q6r7t299.js";
873
877
  import"./cli-8nyhf7za.js";
874
878
  import {
875
879
  _fetchHolder,
@@ -922,12 +926,13 @@ import {
922
926
  canReadSession2,
923
927
  readableByFor2,
924
928
  SESSION_WRITE_DENIED2,
929
+ denyParentAttach2,
925
930
  runtimeInstanceHeader,
926
931
  bodyTask,
927
932
  bodyListTask,
928
933
  describeRequestRoute,
929
934
  route
930
- } from "./cli-6eyncg0y.js";
935
+ } from "./cli-cynvc9fj.js";
931
936
  import {
932
937
  isMultiRuntimeEnabled
933
938
  } from "./cli-e8xyjvfc.js";
@@ -958,7 +963,7 @@ import {
958
963
  resolvePoolDelivery2,
959
964
  createPoolAgent2,
960
965
  init_db
961
- } from "./cli-gx0j2khs.js";
966
+ } from "./cli-w6nadkh4.js";
962
967
  import {
963
968
  RATING_MODEL_MAX_LENGTH,
964
969
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -974,8 +979,8 @@ import {
974
979
  checkHeartbeatChecklist2,
975
980
  runHeartbeatSweep2,
976
981
  stopHeartbeat2
977
- } from "./cli-8y99kfey.js";
978
- import"./cli-mzkwkbdy.js";
982
+ } from "./cli-3cgngyd8.js";
983
+ import"./cli-82d3nkc3.js";
979
984
  import {
980
985
  import_websocket,
981
986
  import_websocket_server
@@ -984,7 +989,7 @@ import {
984
989
  runtimeSupervisorStatus,
985
990
  startRuntimeSupervisor,
986
991
  stopRuntimeSupervisor
987
- } from "./cli-f0p0f6ja.js";
992
+ } from "./cli-dqb4n629.js";
988
993
  import"./cli-ns59dc6r.js";
989
994
  import {
990
995
  ACP_TARGET_IDS
@@ -1004,11 +1009,11 @@ import {
1004
1009
  memoryRelevance,
1005
1010
  isUnknownModelError,
1006
1011
  writeSkillsToFilesystem
1007
- } from "./cli-6aen3ezb.js";
1012
+ } from "./cli-xj0re5tm.js";
1008
1013
  import {
1009
1014
  inviteEmailToSharedOrg,
1010
1015
  ensureAgentFsCredentialsForAgent
1011
- } from "./cli-p0qerd2r.js";
1016
+ } from "./cli-hj3debgw.js";
1012
1017
  import {
1013
1018
  Anthropic
1014
1019
  } from "./cli-er83cjbn.js";
@@ -1041,9 +1046,13 @@ import {
1041
1046
  mintSessionToken,
1042
1047
  mintRuntimeToken,
1043
1048
  revokeSessionToken,
1049
+ AgentTokenExistsError,
1050
+ mintAgentToken,
1051
+ rotateAgentToken,
1052
+ revokeAgentTokens,
1044
1053
  fingerprintApiKey,
1045
1054
  init_users
1046
- } from "./cli-sds5zzs8.js";
1055
+ } from "./cli-9fhkkpj5.js";
1047
1056
  import"./cli-v41kn3cd.js";
1048
1057
  import"./cli-wgtk7xxr.js";
1049
1058
  import {
@@ -1057,7 +1066,7 @@ import {
1057
1066
  clearAuditSink,
1058
1067
  can,
1059
1068
  init_rbac
1060
- } from "./cli-8vverzf7.js";
1069
+ } from "./cli-ba8ne1es.js";
1061
1070
  import {
1062
1071
  isSafeBundlePath,
1063
1072
  init_bundle_path,
@@ -1199,7 +1208,7 @@ import {
1199
1208
  KvKeySchema,
1200
1209
  KvEntrySchema,
1201
1210
  init_types
1202
- } from "./cli-836ehxmt.js";
1211
+ } from "./cli-nc35pxb7.js";
1203
1212
  import {
1204
1213
  IDENTITY_FIELD_BUDGETS,
1205
1214
  IdentityFieldBudgetError,
@@ -1272,7 +1281,7 @@ import {
1272
1281
  import {
1273
1282
  init_package,
1274
1283
  package_default
1275
- } from "./cli-1xsraagq.js";
1284
+ } from "./cli-pccfmtb5.js";
1276
1285
  import {
1277
1286
  realtimeBus,
1278
1287
  init_bus
@@ -6511,47 +6520,6 @@ init_db2();
6511
6520
  init_rbac();
6512
6521
  init_types();
6513
6522
  init_request_auth_context();
6514
-
6515
- // src/http/request-principal.ts
6516
- init_db3();
6517
- init_request_auth_context();
6518
- async function requestPrincipal(req, myAgentId) {
6519
- const auth = getRequestAuth(req);
6520
- if (auth?.kind === "controller")
6521
- return { kind: "guest" };
6522
- if (auth?.kind === "operator")
6523
- return { kind: "operator" };
6524
- if (auth?.kind === "user")
6525
- return { kind: "user", userId: auth.userId };
6526
- if (auth?.kind === "guest")
6527
- return { kind: "guest" };
6528
- if (!myAgentId)
6529
- return null;
6530
- const agent = await getAgentById2(myAgentId);
6531
- return { kind: "agent", agentId: myAgentId, isLead: agent?.isLead ?? false };
6532
- }
6533
- async function agentFirstPrincipal(req, myAgentId) {
6534
- const auth = getRequestAuth(req);
6535
- if (auth?.kind === "controller")
6536
- return { kind: "guest" };
6537
- if (auth?.kind === "user")
6538
- return { kind: "user", userId: auth.userId };
6539
- if (auth?.kind === "guest")
6540
- return { kind: "guest" };
6541
- const agentId = auth?.kind === "agent" ? auth.agentId : myAgentId;
6542
- if (!agentId)
6543
- return { kind: "operator" };
6544
- const agent = await getAgentById2(agentId);
6545
- return { kind: "agent", agentId, isLead: agent?.isLead === true };
6546
- }
6547
- function rejectGuest(req, res) {
6548
- if (getRequestAuth(req)?.kind !== "guest")
6549
- return false;
6550
- jsonError(res, "Forbidden", 403);
6551
- return true;
6552
- }
6553
-
6554
- // src/http/assets.ts
6555
6523
  var AssetKeyAuditIssueSchema = object2({
6556
6524
  severity: _enum2(["fatal", "warning"]),
6557
6525
  code: _enum2([
@@ -8150,7 +8118,7 @@ async function requestSecretReadScope(req, resolvedScope) {
8150
8118
  source: "http"
8151
8119
  }).allow)
8152
8120
  return "all";
8153
- if (!auth.runtimeId || resolvedScope?.agentId !== auth.agentId)
8121
+ if (auth.tokenKind === "task" || resolvedScope?.agentId !== auth.agentId)
8154
8122
  return "none";
8155
8123
  return "self";
8156
8124
  }
@@ -8168,7 +8136,7 @@ async function resolveSecretsRead(req, includeSecrets, resolvedScope) {
8168
8136
  const auth = getRequestAuth(req);
8169
8137
  return {
8170
8138
  effectiveIncludeSecrets: includeSecrets && scope !== "none",
8171
- includeRepoSecrets: !(auth?.kind === "agent" && auth.runtimeId && scope !== "all"),
8139
+ includeRepoSecrets: !(auth?.kind === "agent" && auth.tokenKind !== "task" && scope !== "all"),
8172
8140
  secretsNote: includeSecrets && scope === "none" ? SECRETS_FORCE_MASK_NOTE : ""
8173
8141
  };
8174
8142
  }
@@ -8350,7 +8318,7 @@ async function handleConfig(req, res, pathSegments, queryParams) {
8350
8318
  const key = parsed.query.key;
8351
8319
  const auth = getRequestAuth(req);
8352
8320
  const resolvedScope = {
8353
- agentId: parsed.query.agentId || (auth?.kind === "agent" && auth.runtimeId ? auth.agentId : undefined),
8321
+ agentId: parsed.query.agentId || (auth?.kind === "agent" && auth.tokenKind !== "task" ? auth.agentId : undefined),
8354
8322
  repoId: parsed.query.repoId || undefined
8355
8323
  };
8356
8324
  const { effectiveIncludeSecrets, includeRepoSecrets, secretsNote } = await resolveSecretsRead(req, includeSecrets, resolvedScope);
@@ -8824,10 +8792,18 @@ async function handleCodexOAuthDevice(req, res, pathSegments, queryParams) {
8824
8792
  // src/http/codex-oauth-keep-warm.ts
8825
8793
  init_zod();
8826
8794
  init_db3();
8795
+ init_swarm_config_guard();
8827
8796
  init_api_key();
8828
8797
  init_codex_auth_failure();
8829
8798
  init_constants2();
8830
- var KEEP_WARM_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
8799
+ var DEFAULT_KEEP_WARM_MAX_AGE_HOURS = 120;
8800
+ function keepWarmMaxAgeMs(env = process.env) {
8801
+ const raw = env.CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS?.trim();
8802
+ const { min, max } = CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS_BOUNDS;
8803
+ const value = raw && /^\d+$/.test(raw) ? Number(raw) : Number.NaN;
8804
+ const hours = value >= min && value <= max ? value : DEFAULT_KEEP_WARM_MAX_AGE_HOURS;
8805
+ return hours * 60 * 60 * 1000;
8806
+ }
8831
8807
  var slotOutcomeSchema = discriminatedUnion("outcome", [
8832
8808
  object2({ slot: number2(), keySuffix: string2(), outcome: literal2("warm") }),
8833
8809
  object2({ slot: number2(), keySuffix: string2(), outcome: literal2("refreshed") }),
@@ -8845,7 +8821,7 @@ var keepWarmRoute = route({
8845
8821
  path: "/api/oauth/keep-warm/codex",
8846
8822
  pattern: ["api", "oauth", "keep-warm", "codex"],
8847
8823
  summary: "Locked keep-warm refresh sweep across all Codex OAuth pool slots",
8848
- description: "Enumerates codex_oauth_* slots and refreshes any older than ~7 days through the same locked getValidCodexOAuth path used at task time. Skips slots with a codex-auth-watch bench marker (auth-failure bench or codex-auth-expiry-watch).",
8824
+ description: "Enumerates codex_oauth_* slots and refreshes any older than CODEX_OAUTH_KEEP_WARM_MAX_AGE_HOURS (default 120 hours) through the same locked getValidCodexOAuth path used at task time. Skips slots with a codex-auth-watch bench marker (auth-failure bench or codex-auth-expiry-watch).",
8849
8825
  tags: ["OAuth"],
8850
8826
  responses: {
8851
8827
  200: {
@@ -8862,6 +8838,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
8862
8838
  return true;
8863
8839
  const apiUrl = getMcpBaseUrl();
8864
8840
  const apiKey = getApiKey();
8841
+ const maxAgeMs = keepWarmMaxAgeMs();
8865
8842
  const slots = await loadAllCodexOAuthSlots(apiUrl, apiKey);
8866
8843
  const results = [];
8867
8844
  for (const { slot, creds } of slots) {
@@ -8872,9 +8849,7 @@ async function handleCodexOAuthKeepWarm(req, res, pathSegments) {
8872
8849
  }
8873
8850
  try {
8874
8851
  const beforeAccess = creds.access;
8875
- const refreshed = await getValidCodexOAuth(apiUrl, apiKey, slot, {
8876
- maxAgeMs: KEEP_WARM_MAX_AGE_MS
8877
- });
8852
+ const refreshed = await getValidCodexOAuth(apiUrl, apiKey, slot, { maxAgeMs });
8878
8853
  if (!refreshed) {
8879
8854
  results.push({ slot, outcome: "no-credentials" });
8880
8855
  } else {
@@ -22736,10 +22711,6 @@ var updateTaskTitleRoute = route({
22736
22711
  ungated: "mirrors the pre-RBAC PATCH /api/tasks/{id}/vcs sibling route: bearer auth only"
22737
22712
  }
22738
22713
  });
22739
- async function hasSessionWrite(req, myAgentId, taskId) {
22740
- const access = await sessionAccessFor2(await resolveSessionActor2(req, myAgentId), taskId);
22741
- return hasSessionAccess(access, "write");
22742
- }
22743
22714
  async function canSteerTask(req, myAgentId, task, sessionAccess = "none") {
22744
22715
  const auth = getRequestAuth(req);
22745
22716
  const resource = {
@@ -22919,23 +22890,7 @@ async function handleTasks(req, res, pathSegments, queryParams, myAgentId) {
22919
22890
  }
22920
22891
  const parentTask = parsed.body.parentTaskId ? await getTaskById2(parsed.body.parentTaskId) : null;
22921
22892
  const principal = await resolveTaskWritePrincipal(req, myAgentId);
22922
- if (parentTask && !can({
22923
- principal,
22924
- verb: "task.parent.attach",
22925
- resource: {
22926
- kind: "task",
22927
- taskId: parentTask.id,
22928
- requestedByUserId: parentTask.requestedByUserId,
22929
- creatorAgentId: parentTask.creatorAgentId,
22930
- agentId: parentTask.agentId
22931
- },
22932
- source: "http"
22933
- }).allow) {
22934
- jsonError(res, `You don't have context for parent task ${parentTask.id}.`, 403);
22935
- return true;
22936
- }
22937
- if (parentTask && !await hasSessionWrite(req, myAgentId, parentTask.id)) {
22938
- jsonError(res, SESSION_WRITE_DENIED2, 403);
22893
+ if (parentTask && await denyParentAttach2(req, res, myAgentId, parentTask, principal)) {
22939
22894
  return true;
22940
22895
  }
22941
22896
  if (principal.kind === "agent" && parsed.body.contextKey && parsed.body.contextKey !== parentTask?.contextKey && chatThreadOfContextKey(parsed.body.contextKey) && !can({ principal, verb: "integration.chat.post", resource: { kind: "none" }, source: "http" }).allow) {
@@ -33147,6 +33102,7 @@ async function handleSessionData(req, res, pathSegments, queryParams, myAgentId)
33147
33102
  // src/http/sessions.ts
33148
33103
  init_zod();
33149
33104
  init_db3();
33105
+ init_rbac_roles();
33150
33106
  init_steering();
33151
33107
  init_users();
33152
33108
  init_rbac();
@@ -33203,7 +33159,7 @@ var mintSessionTokenRoute = route({
33203
33159
  none: "user tokens cannot mint: the handler admits only the operator key or the task's own runtime"
33204
33160
  },
33205
33161
  summary: "Mint an ephemeral task or runtime token",
33206
- description: "Operators can mint task or runtime tokens. Runtime tokens can mint task tokens for their own assigned tasks. Child tokens expire with their parent runtime.",
33162
+ description: "Operators can mint task or runtime tokens. Runtime and agent tokens can mint task tokens for their own assigned tasks. A child token never outlives its parent and is revoked with it.",
33207
33163
  tags: ["Sessions"],
33208
33164
  body: object2({
33209
33165
  agentId: string2().min(1),
@@ -33229,7 +33185,7 @@ var mintSessionTokenRoute = route({
33229
33185
  },
33230
33186
  auth: { apiKey: true },
33231
33187
  rbac: {
33232
- ungated: "operator or runtime token minting for its own assigned task, enforced in the handler"
33188
+ ungated: "operator, or a runtime or agent token minting for its own assigned task, enforced in the handler"
33233
33189
  }
33234
33190
  });
33235
33191
  var revokeSessionTokenRoute = route({
@@ -33237,7 +33193,7 @@ var revokeSessionTokenRoute = route({
33237
33193
  path: "/api/sessions/tokens/{tokenId}",
33238
33194
  pattern: ["api", "sessions", "tokens", null],
33239
33195
  summary: "Revoke an ephemeral session token",
33240
- description: "Operators can revoke any ephemeral token. With runtime pools enabled, runtime tokens can revoke their own child task tokens. Repeated revocation has no effect.",
33196
+ description: "Operators can revoke any ephemeral token. Agent tokens, and runtime tokens when runtime pools are enabled, can revoke their own child task tokens. Repeated revocation has no effect.",
33241
33197
  tags: ["Sessions"],
33242
33198
  params: object2({ tokenId: string2() }),
33243
33199
  responses: {
@@ -33247,9 +33203,188 @@ var revokeSessionTokenRoute = route({
33247
33203
  },
33248
33204
  auth: { apiKey: true },
33249
33205
  rbac: {
33250
- ungated: "operator or runtime token revoking its own child, enforced in the handler"
33206
+ ungated: "operator, or a runtime or agent token revoking its own child, enforced in the handler"
33251
33207
  }
33252
33208
  });
33209
+ var AGENT_TOKEN_ROTATE_GRACE_SEC = 300;
33210
+ var AgentTokenSchema = object2({
33211
+ agentId: string2(),
33212
+ tokenId: string2(),
33213
+ plaintext: string2(),
33214
+ expiresAt: string2().nullable().describe("null when the token does not expire")
33215
+ });
33216
+ var agentTokenTtl = number2().int().positive().optional().describe("Token lifetime in ms. Omit for the default (no expiry).");
33217
+ var mintAgentTokenRoute = route({
33218
+ method: "post",
33219
+ path: "/api/agents/{id}/token",
33220
+ pattern: ["api", "agents", null, "token"],
33221
+ operationId: "agents_mintWorkerToken",
33222
+ summary: "Mint an agent-bound worker token",
33223
+ description: "Returns the token once. A worker runs on it in place of the swarm API key and acts only as this agent. Creates the agent when it does not exist and `name` is given. Fails with 409 when the agent already holds an active token.",
33224
+ tags: ["Sessions"],
33225
+ params: object2({ id: string2().min(1) }),
33226
+ body: object2({ name: string2().min(1).optional(), ttlMs: agentTokenTtl }).strict().optional(),
33227
+ responses: {
33228
+ 200: {
33229
+ description: "Minted worker token",
33230
+ schema: AgentTokenSchema.extend({ agentCreated: boolean() })
33231
+ },
33232
+ 403: { description: "Operator or user credentials required" },
33233
+ 404: { description: "Agent not found and no name given" },
33234
+ 409: { description: "Agent already holds an active token" }
33235
+ },
33236
+ rbac: { permission: "agent.token.manage" }
33237
+ });
33238
+ var rotateAgentTokenRoute = route({
33239
+ method: "post",
33240
+ path: "/api/agents/{id}/token/rotate",
33241
+ pattern: ["api", "agents", null, "token", "rotate"],
33242
+ operationId: "agents_rotateWorkerToken",
33243
+ summary: "Rotate an agent-bound worker token",
33244
+ description: "Returns a new token once. The previous token keeps working for `graceSec` (default 300), then expires. Use revoke for a token that must stop now.",
33245
+ tags: ["Sessions"],
33246
+ params: object2({ id: string2().min(1) }),
33247
+ body: object2({ graceSec: number2().int().min(0).max(86400).optional(), ttlMs: agentTokenTtl }).strict().optional(),
33248
+ responses: {
33249
+ 200: {
33250
+ description: "New worker token",
33251
+ schema: AgentTokenSchema.extend({ previousExpiresAt: string2() })
33252
+ },
33253
+ 403: { description: "Operator or user credentials required" },
33254
+ 404: { description: "Agent holds no active token" }
33255
+ },
33256
+ rbac: { permission: "agent.token.manage" }
33257
+ });
33258
+ var revokeAgentTokenRoute = route({
33259
+ method: "delete",
33260
+ path: "/api/agents/{id}/token",
33261
+ pattern: ["api", "agents", null, "token"],
33262
+ operationId: "agents_revokeWorkerToken",
33263
+ summary: "Revoke an agent-bound worker token",
33264
+ description: "Revokes every active worker token of the agent and the task tokens they minted. Open realtime connections on them close.",
33265
+ tags: ["Sessions"],
33266
+ params: object2({ id: string2().min(1) }),
33267
+ responses: {
33268
+ 200: {
33269
+ description: "Number of worker tokens revoked (0 when none was active)",
33270
+ schema: object2({ revoked: number2().int() })
33271
+ },
33272
+ 403: { description: "Operator or user credentials required" }
33273
+ },
33274
+ rbac: { permission: "agent.token.manage" }
33275
+ });
33276
+ var AGENT_TOKEN_ROUTES = [mintAgentTokenRoute, rotateAgentTokenRoute, revokeAgentTokenRoute];
33277
+ async function ensureAgentTokenManager(req, res, agentId) {
33278
+ const auth = getRequestAuth(req);
33279
+ if (auth?.kind !== "operator" && auth?.kind !== "user") {
33280
+ jsonError(res, "Worker tokens require operator or user credentials", 403);
33281
+ return false;
33282
+ }
33283
+ const header = req.headers["x-agent-id"];
33284
+ const decision = can({
33285
+ principal: await agentFirstPrincipal(req, Array.isArray(header) ? header[0] : header),
33286
+ verb: "agent.token.manage",
33287
+ resource: { kind: "agent", agentId },
33288
+ source: "http"
33289
+ });
33290
+ if (!decision.allow) {
33291
+ jsonError(res, decision.reason, 403);
33292
+ return false;
33293
+ }
33294
+ if (auth.kind === "user" && isRbacEnabled()) {
33295
+ const grant = await getUserGrant2(auth.userId);
33296
+ if (!grant.grantsAll) {
33297
+ const target = await getAgentById2(agentId);
33298
+ const targetActsOnAny = can({
33299
+ principal: { kind: "agent", agentId, isLead: target?.isLead ?? false },
33300
+ verb: "agent.act.any",
33301
+ resource: { kind: "agent", agentId },
33302
+ source: "http"
33303
+ }).allow;
33304
+ if (targetActsOnAny) {
33305
+ jsonError(res, "A lead agent's worker token requires a grant-all role", 403);
33306
+ return false;
33307
+ }
33308
+ const missing = ["agent.act.any", "config.read.secrets"].filter((verb) => !grant.verbs.has(verb));
33309
+ if (missing.length > 0) {
33310
+ jsonError(res, `Worker tokens also require: ${missing.join(", ")}`, 403);
33311
+ return false;
33312
+ }
33313
+ }
33314
+ }
33315
+ return true;
33316
+ }
33317
+ async function handleAgentTokens(req, res, pathSegments, queryParams) {
33318
+ const matched = AGENT_TOKEN_ROUTES.find((def) => def.match(req.method, pathSegments));
33319
+ if (!matched)
33320
+ return false;
33321
+ if (!await ensureAgentTokenManager(req, res, pathSegments[2]))
33322
+ return true;
33323
+ res.setHeader("Cache-Control", "no-store");
33324
+ if (matched === mintAgentTokenRoute) {
33325
+ const parsed = await mintAgentTokenRoute.parse(req, res, pathSegments, queryParams);
33326
+ if (!parsed)
33327
+ return true;
33328
+ const agentId = parsed.params.id;
33329
+ const result = await getDbClient2().transaction(async () => {
33330
+ let agentCreated = false;
33331
+ if (!await getAgentById2(agentId)) {
33332
+ if (!parsed.body?.name)
33333
+ return { status: 404 };
33334
+ await createAgent2({
33335
+ id: agentId,
33336
+ name: parsed.body.name,
33337
+ isLead: false,
33338
+ status: "offline",
33339
+ capabilities: [],
33340
+ maxTasks: 1
33341
+ });
33342
+ agentCreated = true;
33343
+ }
33344
+ return {
33345
+ status: 200,
33346
+ agentCreated,
33347
+ token: await mintAgentToken(agentId, parsed.body?.ttlMs)
33348
+ };
33349
+ }).catch((error) => {
33350
+ if (error instanceof AgentTokenExistsError)
33351
+ return { status: 409 };
33352
+ throw error;
33353
+ });
33354
+ if (result.status === 404) {
33355
+ jsonError(res, "Agent not found; pass name to create it", 404);
33356
+ return true;
33357
+ }
33358
+ if (result.status === 409) {
33359
+ jsonError(res, "Agent already holds an active worker token; rotate or revoke it", 409);
33360
+ return true;
33361
+ }
33362
+ mintAgentTokenRoute.respond(res, 200, {
33363
+ agentId,
33364
+ ...result.token,
33365
+ agentCreated: result.agentCreated
33366
+ });
33367
+ return true;
33368
+ }
33369
+ if (matched === rotateAgentTokenRoute) {
33370
+ const parsed = await rotateAgentTokenRoute.parse(req, res, pathSegments, queryParams);
33371
+ if (!parsed)
33372
+ return true;
33373
+ const graceSec = parsed.body?.graceSec ?? AGENT_TOKEN_ROTATE_GRACE_SEC;
33374
+ const token = await rotateAgentToken(parsed.params.id, graceSec * 1000, parsed.body?.ttlMs);
33375
+ if (!token) {
33376
+ jsonError(res, "Agent holds no active worker token", 404);
33377
+ return true;
33378
+ }
33379
+ rotateAgentTokenRoute.respond(res, 200, { agentId: parsed.params.id, ...token });
33380
+ return true;
33381
+ }
33382
+ const parsed = await revokeAgentTokenRoute.parse(req, res, pathSegments, queryParams);
33383
+ if (!parsed)
33384
+ return true;
33385
+ revokeAgentTokenRoute.respond(res, 200, { revoked: await revokeAgentTokens(parsed.params.id) });
33386
+ return true;
33387
+ }
33253
33388
  var listSessions = route({
33254
33389
  method: "get",
33255
33390
  path: "/api/sessions",
@@ -33347,9 +33482,11 @@ async function accessForRoot(actor, root) {
33347
33482
  return actor.kind === "bypass" ? "owner" : sessionAccessForRoot(actor.userId, root);
33348
33483
  }
33349
33484
  async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
33485
+ if (await handleAgentTokens(req, res, pathSegments, queryParams))
33486
+ return true;
33350
33487
  if (mintSessionTokenRoute.match(req.method, pathSegments)) {
33351
33488
  const auth = getRequestAuth(req);
33352
- if (auth?.kind !== "operator" && !(auth?.kind === "agent" && auth.runtimeId)) {
33489
+ if (auth?.kind !== "operator" && !(auth?.kind === "agent" && auth.tokenKind !== "task")) {
33353
33490
  jsonError(res, "Unauthorized", 401);
33354
33491
  return true;
33355
33492
  }
@@ -33394,7 +33531,7 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
33394
33531
  }
33395
33532
  if (revokeSessionTokenRoute.match(req.method, pathSegments)) {
33396
33533
  const auth = getRequestAuth(req);
33397
- if (auth?.kind !== "operator" && !(isRuntimePoolsEnabled() && auth?.kind === "agent" && auth.runtimeId)) {
33534
+ if (auth?.kind !== "operator" && !(auth?.kind === "agent" && (auth.tokenKind === "agent" || auth.tokenKind === "runtime" && isRuntimePoolsEnabled()))) {
33398
33535
  jsonError(res, "Unauthorized", 401);
33399
33536
  return true;
33400
33537
  }
@@ -33403,7 +33540,8 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
33403
33540
  return true;
33404
33541
  const revoked = await getDbClient2().transaction(async (client) => {
33405
33542
  if (auth.kind === "agent") {
33406
- const child = await client.get("SELECT id FROM session_tokens WHERE id = ? AND agentId = ? AND parentRuntimeId = ? AND taskId IS NOT NULL", [parsed.params.tokenId, auth.agentId, auth.runtimeId]);
33543
+ const child = await client.get(`SELECT id FROM session_tokens WHERE id = ? AND agentId = ? AND taskId IS NOT NULL
33544
+ AND ${auth.runtimeId ? "parentRuntimeId" : "parentTokenId"} = ?`, [parsed.params.tokenId, auth.agentId, auth.runtimeId ?? auth.tokenId]);
33407
33545
  if (!child)
33408
33546
  return false;
33409
33547
  }
@@ -39126,7 +39264,7 @@ var httpServer = createHttpServer(async (req, res) => {
39126
39264
  });
39127
39265
  });
39128
39266
  var detachRealtime = attachRealtimeTransport(httpServer);
39129
- var { attachControllerTransport } = await import("./controllers-connect-5rgq2hfk.js");
39267
+ var { attachControllerTransport } = await import("./controllers-connect-mwzx1fh6.js");
39130
39268
  var detachControllers = attachControllerTransport(httpServer);
39131
39269
  var stopWorkerNudges = startWorkerNudgeListener();
39132
39270
  var stopRoomDeletion = realtimeBus.subscribe("room:namespace-deleted", (namespace) => {
@@ -39155,7 +39293,7 @@ async function shutdown() {
39155
39293
  sessionsProcessed: getServerSessionsProcessed()
39156
39294
  });
39157
39295
  if (hasCapability("scheduling")) {
39158
- const { stopScheduler } = await import("./index-wbbs14c5.js");
39296
+ const { stopScheduler } = await import("./index-hg0x2cdv.js");
39159
39297
  stopScheduler();
39160
39298
  }
39161
39299
  stopHeartbeat2();
@@ -39167,7 +39305,7 @@ async function shutdown() {
39167
39305
  await stopSlackApp2();
39168
39306
  await stopChatSdk();
39169
39307
  if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
39170
- const { stopOAuthKeepalive } = await import("./keepalive-y5t1my7m.js");
39308
+ const { stopOAuthKeepalive } = await import("./keepalive-hrh7xnr9.js");
39171
39309
  await stopOAuthKeepalive();
39172
39310
  }
39173
39311
  stopOAuthPendingGc();
@@ -39247,21 +39385,21 @@ try {
39247
39385
  console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
39248
39386
  }
39249
39387
  try {
39250
- const { ensurePricingSeeded } = await import("./boot-seeds-37sp626b.js");
39388
+ const { ensurePricingSeeded } = await import("./boot-seeds-9ks8hce7.js");
39251
39389
  ensurePricingSeeded();
39252
- const { startPricingRefreshLoop } = await import("./pricing-refresh-ygd362ep.js");
39390
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-j38dehfs.js");
39253
39391
  startPricingRefreshLoop();
39254
39392
  } catch (err) {
39255
39393
  console.error("[startup] Failed to seed pricing rows:", err);
39256
39394
  }
39257
39395
  try {
39258
- const { ensureModelProfilesSeeded } = await import("./boot-seeds-37sp626b.js");
39396
+ const { ensureModelProfilesSeeded } = await import("./boot-seeds-9ks8hce7.js");
39259
39397
  await ensureModelProfilesSeeded();
39260
39398
  } catch (err) {
39261
39399
  console.error("[startup] Failed to seed model profiles:", err);
39262
39400
  }
39263
39401
  try {
39264
- const { ensureRbacSeeded } = await import("./boot-seeds-37sp626b.js");
39402
+ const { ensureRbacSeeded } = await import("./boot-seeds-9ks8hce7.js");
39265
39403
  ensureRbacSeeded();
39266
39404
  } catch (err) {
39267
39405
  console.error("[startup] Failed to sync RBAC seed rows:", err);
@@ -39269,7 +39407,7 @@ try {
39269
39407
  throw err;
39270
39408
  }
39271
39409
  try {
39272
- const { runAllSeeders } = await import("./index-220tk9bw.js");
39410
+ const { runAllSeeders } = await import("./index-97q4xn03.js");
39273
39411
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
39274
39412
  } catch (err) {
39275
39413
  console.error("[startup] Failed to seed built-in entities:", err);
@@ -39331,39 +39469,39 @@ httpServer.listen(port, async () => {
39331
39469
  await initWorkflows2();
39332
39470
  await startScriptRunSupervisor(getMcpBaseUrl());
39333
39471
  if (hasCapability("scheduling")) {
39334
- const { startScheduler } = await import("./index-wbbs14c5.js");
39335
- const { getExecutorRegistry } = await import("./index-m0a4ydqj.js");
39472
+ const { startScheduler } = await import("./index-hg0x2cdv.js");
39473
+ const { getExecutorRegistry } = await import("./index-gdh8jrdm.js");
39336
39474
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
39337
39475
  startScheduler(getExecutorRegistry(), intervalMs, {
39338
39476
  runId: globalState.__runId
39339
39477
  });
39340
39478
  }
39341
39479
  if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
39342
- const { startHeartbeat } = await import("./index-d0g18bax.js");
39480
+ const { startHeartbeat } = await import("./index-thm0y6a8.js");
39343
39481
  const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
39344
39482
  startHeartbeat(heartbeatMs);
39345
39483
  }
39346
39484
  startPoolRouting();
39347
39485
  startRuntimeSupervisor();
39348
39486
  if (process.env.OAUTH_KEEPALIVE_DISABLE !== "true") {
39349
- const { startOAuthKeepalive } = await import("./keepalive-y5t1my7m.js");
39487
+ const { startOAuthKeepalive } = await import("./keepalive-hrh7xnr9.js");
39350
39488
  startOAuthKeepalive();
39351
39489
  }
39352
39490
  if (process.env.OAUTH_REFRESH_SWEEP_DISABLE !== "true") {
39353
- const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-909jmn12.js");
39491
+ const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-zm0yj4sj.js");
39354
39492
  startOAuthRefreshSweep();
39355
39493
  }
39356
39494
  startOAuthPendingGc();
39357
39495
  await startMemoryGc();
39358
39496
  await startDbRetention();
39359
39497
  startHumanFreeDrain();
39360
- import("./boot-reembed-y3m0ydzj.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
39498
+ import("./boot-reembed-srp6v6af.js").then(({ runBootReembed }) => runBootReembed()).catch((err) => {
39361
39499
  console.error("[boot-reembed] startup backfill failed (non-fatal):", err);
39362
39500
  });
39363
- import("./boot-reembed-gvxjs2py.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
39501
+ import("./boot-reembed-xns7h5h9.js").then(({ runBootReembedScripts }) => runBootReembedScripts()).catch((err) => {
39364
39502
  console.error("[boot-reembed-scripts] startup backfill failed (non-fatal):", err);
39365
39503
  });
39366
- import("./boot-scrub-sweep-1j9mk05f.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
39504
+ import("./boot-scrub-sweep-3qqrh2mz.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
39367
39505
  console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
39368
39506
  });
39369
39507
  }).on("error", (err) => {