@desplega.ai/agent-swarm 2.7.9 → 2.7.10

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 (212) hide show
  1. package/dist/{acp-adapter-dn4gdsgr.js → acp-adapter-srfhs1s9.js} +5 -5
  2. package/dist/{actions-g563mbn2.js → actions-b8aqhrsg.js} +19 -18
  3. package/dist/{amp-adapter-q61w05eb.js → amp-adapter-4c165vgn.js} +1 -1
  4. package/dist/app-m9khefrh.js +20 -0
  5. package/dist/{assistant-p477rjwj.js → assistant-rh4v3ntz.js} +21 -20
  6. package/dist/{boot-args-schema-h4qj462e.js → boot-args-schema-hwkc8bzv.js} +1 -1
  7. package/dist/{boot-reembed-n1ehfbsw.js → boot-reembed-5y6yw9sj.js} +1 -1
  8. package/dist/{boot-reembed-qw4mc0pt.js → boot-reembed-fdyk55h4.js} +1 -1
  9. package/dist/{boot-scrub-sweep-9w9jp4sm.js → boot-scrub-sweep-r5r8kqsn.js} +3 -3
  10. package/dist/{boot-seeds-qdaf3sdy.js → boot-seeds-8f9zt5cm.js} +5 -5
  11. package/dist/{claude-adapter-348p5hx9.js → claude-adapter-s5df247c.js} +5 -5
  12. package/dist/{claude-managed-setup-7787fxtp.js → claude-managed-setup-9gsmwzyx.js} +1 -1
  13. package/dist/{claude-sdk-session-hbszbt8a.js → claude-sdk-session-dq1j4nz9.js} +5 -5
  14. package/dist/{cli-btf6fw39.js → cli-0m7rtm11.js} +1 -1
  15. package/dist/{cli-cseh6f8w.js → cli-16phend6.js} +1 -1
  16. package/dist/{cli-ms5m5r1y.js → cli-18qt3few.js} +1 -1
  17. package/dist/{cli-sgs5k6yd.js → cli-2tsfpc70.js} +1 -1
  18. package/dist/{cli-rwymrnaz.js → cli-36wdfzgn.js} +8 -8
  19. package/dist/{cli-qzt90yze.js → cli-38yww4e9.js} +8 -8
  20. package/dist/{cli-2a8py3sx.js → cli-3xddv0rk.js} +4 -4
  21. package/dist/{cli-p0m0p34z.js → cli-4vwxp550.js} +2 -2
  22. package/dist/{cli-bc779n4v.js → cli-55bkx8hh.js} +1 -1
  23. package/dist/{cli-21159vea.js → cli-5wfz00be.js} +2 -2
  24. package/dist/{cli-9aezs55w.js → cli-5xcb8gxq.js} +4 -4
  25. package/dist/{cli-12xyjhws.js → cli-6m6b4bep.js} +2 -2
  26. package/dist/{cli-fayav105.js → cli-7wz05bx3.js} +292 -83
  27. package/dist/{cli-y8nbefpb.js → cli-8ewkreqd.js} +9 -5
  28. package/dist/{cli-0whpms1z.js → cli-an1knn2k.js} +4 -4
  29. package/dist/{cli-qmd3mse0.js → cli-bxz823sz.js} +1 -1
  30. package/dist/{cli-a0657jmf.js → cli-bzvs88tv.js} +1 -1
  31. package/dist/{cli-agyaeef4.js → cli-cr14kftt.js} +2 -2
  32. package/dist/{cli-715t1gx6.js → cli-eb2azq8n.js} +3 -3
  33. package/dist/{cli-530hkwdy.js → cli-ed6yqpf1.js} +2 -2
  34. package/dist/{cli-k70e3x9e.js → cli-eqk5p56g.js} +3 -3
  35. package/dist/{cli-4t0fmf3z.js → cli-g1px1g2e.js} +1 -1
  36. package/dist/{cli-09kmfkmq.js → cli-h49ejvmc.js} +1 -1
  37. package/dist/{cli-cvs2r2vq.js → cli-hfkwwy1h.js} +39 -5
  38. package/dist/{cli-neyag5p6.js → cli-j7d73g1y.js} +371 -116
  39. package/dist/{cli-p17970qv.js → cli-jg24scat.js} +2 -2
  40. package/dist/{cli-varqt4d1.js → cli-kx4c8j05.js} +16 -13
  41. package/dist/{cli-jfx48xrj.js → cli-mp9aa8g5.js} +1 -1
  42. package/dist/{cli-605nn699.js → cli-mr97t7cc.js} +644 -225
  43. package/dist/{cli-v3cf1ts9.js → cli-n07eecjs.js} +3 -3
  44. package/dist/{cli-y5rbvxhc.js → cli-n515ex5z.js} +14 -14
  45. package/dist/{cli-3tqcamp6.js → cli-n9abj89w.js} +13 -12
  46. package/dist/{cli-ypff1qwp.js → cli-n9ftpys4.js} +7 -7
  47. package/dist/{cli-xk879m3k.js → cli-nj3x45rw.js} +27 -27
  48. package/dist/{cli-9r5gtwjr.js → cli-pyrxt9gw.js} +196 -1
  49. package/dist/{cli-mnrkgg60.js → cli-q581b386.js} +2 -2
  50. package/dist/{cli-hwprv9e4.js → cli-rjyghzg4.js} +2 -2
  51. package/dist/{cli-650zv9q9.js → cli-rt0ag4x1.js} +3 -3
  52. package/dist/{cli-vxh6acp7.js → cli-td33w98c.js} +2 -2
  53. package/dist/{cli-tqq0hspb.js → cli-tmft5dz2.js} +1 -1
  54. package/dist/{cli-q26b9wre.js → cli-tph5wt3y.js} +4 -4
  55. package/dist/{cli-qkdmz8c8.js → cli-ttbqe3q4.js} +1 -1
  56. package/dist/{cli-zgv8gxgs.js → cli-v2fwbnsk.js} +6 -6
  57. package/dist/{cli-b932gexn.js → cli-w3bk0dgv.js} +1 -1
  58. package/dist/{cli-serm8zrx.js → cli-x9exydey.js} +1 -1
  59. package/dist/{cli-hae9j8sv.js → cli-xbtq4d6s.js} +3 -3
  60. package/dist/{cli-587857ys.js → cli-xd5ebp64.js} +3 -3
  61. package/dist/{cli-ejkvvqbe.js → cli-xncjscpm.js} +10 -10
  62. package/dist/{cli-gce09r66.js → cli-xvymtmv4.js} +2 -2
  63. package/dist/{cli-btc9cb4c.js → cli-yz7v0sh4.js} +2 -2
  64. package/dist/{cli-sya22y84.js → cli-z9cs5m0w.js} +3 -3
  65. package/dist/{cli-2ccpqyyf.js → cli-zjphdj1a.js} +71 -10
  66. package/dist/cli.js +15 -15
  67. package/dist/{codex-adapter-ysq6bzha.js → codex-adapter-yr60sme6.js} +3 -3
  68. package/dist/{codex-session-runner-qakzfx93.js → codex-session-runner-pch8x584.js} +3 -3
  69. package/dist/{commands-rs7hkv9r.js → commands-phjfbkv0.js} +3 -3
  70. package/dist/{controller-r5x9bg6e.js → controller-jkx994pz.js} +2 -2
  71. package/dist/{controllers-connect-498hrxvk.js → controllers-connect-c4448kwa.js} +20 -19
  72. package/dist/{cursor-adapter-d46qszer.js → cursor-adapter-ndebqnm8.js} +1 -1
  73. package/dist/{db-pm96nhdb.js → db-ef32tbfc.js} +4 -2
  74. package/dist/{db-s13dqhr6.js → db-ez6egt6v.js} +3 -3
  75. package/dist/{dispatcher-j3h81t7m.js → dispatcher-g3tt9hs9.js} +18 -17
  76. package/dist/{dsh-adapter-rw0d5rc4.js → dsh-adapter-tcyn3099.js} +1 -1
  77. package/dist/{easter-egg-3d-qtgfxgze.js → easter-egg-3d-e36hk5td.js} +1 -1
  78. package/dist/{embedding-space-xh8p4q4x.js → embedding-space-4kyh5qqj.js} +6 -6
  79. package/dist/{embeddings-wp745m91.js → embeddings-6a8v4a6t.js} +1 -1
  80. package/dist/{execute-2fzb9z74.js → execute-3cbg0twf.js} +1 -1
  81. package/dist/{external-channel-ys21h3sy.js → external-channel-se646snz.js} +2 -2
  82. package/dist/{fx-adapter-vz0b9z3g.js → fx-adapter-yw795hqq.js} +6 -6
  83. package/dist/{google-generative-ai-ytpgncx9.js → google-generative-ai-h7s3e9kk.js} +1 -1
  84. package/dist/{google-vertex-tqhze5j7.js → google-vertex-fhxaafzw.js} +1 -1
  85. package/dist/{grok-adapter-spea7zkj.js → grok-adapter-ttmcss2j.js} +6 -6
  86. package/dist/handlers-17wha3ze.js +33 -0
  87. package/dist/{heartbeat-8phn1kdq.js → heartbeat-gwewgdms.js} +21 -20
  88. package/dist/{hook-amcj4s10.js → hook-g3nhexsy.js} +5 -5
  89. package/dist/{hook-bc6n49qn.js → hook-hq93y5ej.js} +4 -4
  90. package/dist/{http-7374brv5.js → http-5a9p4h6y.js} +210 -69
  91. package/dist/{index-pxn30mse.js → index-0eny15vj.js} +8 -8
  92. package/dist/{index-5a9jtqde.js → index-0rvk3vd4.js} +46 -46
  93. package/dist/{index-fvzke5kx.js → index-1qw6f2dc.js} +10 -10
  94. package/dist/{index-p4hjwbvw.js → index-3c5pxbge.js} +1 -1
  95. package/dist/{index-q5cmtbz5.js → index-6haqt3v5.js} +12296 -11042
  96. package/dist/index-8arwq8mw.js +34 -0
  97. package/dist/{index-h7f61sy9.js → index-e5pfbsys.js} +3 -3
  98. package/dist/{index-c9y31ytf.js → index-hgn3c961.js} +12 -11
  99. package/dist/{index-hsad2t3r.js → index-m5gx1xd6.js} +38 -38
  100. package/dist/{index-5fx3b3kw.js → index-rvccek1w.js} +9 -9
  101. package/dist/{index-w4m9z29z.js → index-s72rqgsx.js} +1 -1
  102. package/dist/index-tpw054az.js +38 -0
  103. package/dist/{index-514d9pf6.js → index-w7em4ktq.js} +8 -8
  104. package/dist/index-waq75j2j.js +31 -0
  105. package/dist/{keepalive-wy29kbrg.js → keepalive-1j4n4dmk.js} +3 -3
  106. package/dist/lead-re73kdgc.js +72 -0
  107. package/dist/{maintenance-h2ds9w6c.js → maintenance-dmghacy5.js} +1 -1
  108. package/dist/{oauth-refresh-sweep-q7mtbyp3.js → oauth-refresh-sweep-yy06c03c.js} +2 -2
  109. package/dist/{onboard-vw8r2fdw.js → onboard-52f9t5dm.js} +3 -3
  110. package/dist/{opencode-adapter-mtb0953j.js → opencode-adapter-krnh9jkn.js} +4 -4
  111. package/dist/{otel-impl-j42czw3r.js → otel-impl-xjqz6wjj.js} +1 -1
  112. package/dist/{pi-mono-adapter-zk8pg9jr.js → pi-mono-adapter-dbxyp0qv.js} +6 -6
  113. package/dist/{pricing-refresh-x7nhv23d.js → pricing-refresh-ctdr74pd.js} +3 -3
  114. package/dist/{rbac-roles-bzvee6cf.js → rbac-roles-ehv8s10n.js} +3 -3
  115. package/dist/{rbac-roles-9044425x.js → rbac-roles-q0gr8eyj.js} +2 -2
  116. package/dist/{render-v2-t7bn4skz.js → render-v2-5b6chvcq.js} +9 -4
  117. package/dist/{resume-x94gemep.js → resume-5a5d2845.js} +6 -6
  118. package/dist/{runtime-breq6fmv.js → runtime-khxszyfp.js} +1 -1
  119. package/dist/{session-access-q7dmqjvt.js → session-access-gj0bjhqg.js} +4 -4
  120. package/dist/{session-source-backfill-440ysamr.js → session-source-backfill-2sy0krfk.js} +2 -2
  121. package/dist/{setup-07n4727s.js → setup-7ssfakk1.js} +1 -1
  122. package/dist/{virtual-modules-z5h6mcyf.js → virtual-modules-pjj0knwf.js} +3 -3
  123. package/dist/{work-objects-pnq5y534.js → work-objects-bf3syvhq.js} +22 -21
  124. package/dist/{worker-follow-up-7z1gfkr8.js → worker-follow-up-38xevga6.js} +18 -17
  125. package/dist/worker-r8mz7a65.js +72 -0
  126. package/openapi.json +1 -1
  127. package/package.json +3 -3
  128. package/src/apps/catalog.generated.json +55 -0
  129. package/src/apps/page-validator.ts +19 -0
  130. package/src/assets/key.ts +77 -4
  131. package/src/be/db/session-labels.ts +57 -0
  132. package/src/be/db/session-tree.ts +51 -7
  133. package/src/be/db/slack-trees.ts +146 -0
  134. package/src/be/db/tasks/read.ts +102 -7
  135. package/src/be/db-client.ts +8 -2
  136. package/src/be/db.ts +95 -84
  137. package/src/be/event-loop-lag.ts +146 -0
  138. package/src/be/mcp-overflow-sweep.ts +2 -1
  139. package/src/be/memory/providers/sqlite-store.ts +39 -8
  140. package/src/be/migrations/278_slack_render_v2_reconcile.sql +108 -0
  141. package/src/be/swarm-config-guard.ts +2 -0
  142. package/src/commands/context-preamble.ts +258 -0
  143. package/src/commands/onboard/agent-fs-version.ts +1 -1
  144. package/src/extensions/catalog.generated.json +3 -3
  145. package/src/heartbeat/heartbeat.ts +5 -4
  146. package/src/http/core.ts +9 -3
  147. package/src/http/index.ts +10 -6
  148. package/src/http/memory.ts +9 -4
  149. package/src/http/sessions.ts +16 -3
  150. package/src/http/utils.ts +18 -0
  151. package/src/http/webhooks.ts +48 -0
  152. package/src/integrations/chat-sdk/commands.ts +167 -31
  153. package/src/integrations/chat-sdk/inbound.ts +10 -8
  154. package/src/integrations/chat-sdk/message-text.ts +117 -0
  155. package/src/providers/amp-adapter.ts +1 -1
  156. package/src/providers/cursor-adapter.ts +1 -1
  157. package/src/providers/dsh-adapter.ts +1 -1
  158. package/src/scheduler/scheduler.ts +4 -1
  159. package/src/scripts-runtime/executors/quickjs-runner.ts +2 -0
  160. package/src/scripts-runtime/executors/quickjs-structured-clone.ts +180 -0
  161. package/src/scripts-runtime/quickjs-compat.ts +0 -1
  162. package/src/slack/app.ts +332 -10
  163. package/src/slack/handlers.ts +9 -2
  164. package/src/slack/index.ts +7 -1
  165. package/src/slack/lifecycle-lock.ts +29 -0
  166. package/src/slack/render-v2.ts +424 -212
  167. package/src/slack/socket-fence.ts +64 -0
  168. package/src/slack/watcher.ts +42 -8
  169. package/src/tests/apps-schema-form.test.ts +151 -0
  170. package/src/tests/chat-sdk-commands.test.ts +359 -2
  171. package/src/tests/chat-sdk-inbound.test.ts +20 -0
  172. package/src/tests/chat-sdk-slack.test.ts +189 -1
  173. package/src/tests/db-client-busy-retry.test.ts +69 -18
  174. package/src/tests/db-client.test.ts +26 -1
  175. package/src/tests/db-task-read-contract.test.ts +2 -0
  176. package/src/tests/db-task-write-contract.test.ts +1 -0
  177. package/src/tests/dsh-adapter.test.ts +1 -1
  178. package/src/tests/event-loop-lag.test.ts +184 -0
  179. package/src/tests/extensions-example-comms-adherence-gate.test.ts +115 -0
  180. package/src/tests/github-webhook-early-ack.test.ts +144 -0
  181. package/src/tests/http-api-integration.test.ts +2 -0
  182. package/src/tests/http-log-scrubbing.test.ts +68 -2
  183. package/src/tests/kv-storage.test.ts +92 -1
  184. package/src/tests/memory-key-paths.test.ts +57 -0
  185. package/src/tests/memory-retrieval-purge.test.ts +19 -0
  186. package/src/tests/quickjs-compat.test.ts +1 -1
  187. package/src/tests/runner-context-preamble.test.ts +552 -0
  188. package/src/tests/script-connections.test.ts +3 -0
  189. package/src/tests/script-executor-conformance.test.ts +188 -0
  190. package/src/tests/sessions-tree.test.ts +133 -2
  191. package/src/tests/slack-app-icon.test.ts +4 -0
  192. package/src/tests/slack-dm-implicit-mention.test.ts +236 -0
  193. package/src/tests/slack-file-tools-attachments.test.ts +1 -0
  194. package/src/tests/slack-read-boundaries.test.ts +4 -3
  195. package/src/tests/slack-render-v2-query-plans.test.ts +262 -3
  196. package/src/tests/slack-render-v2-reconcile.test.ts +201 -0
  197. package/src/tests/slack-socket-watchdog.test.ts +748 -0
  198. package/src/tests/vcs-identity-inheritance.test.ts +85 -0
  199. package/src/tools/utils.ts +16 -7
  200. package/templates/extensions/comms-adherence-gate/README.md +25 -0
  201. package/templates/extensions/comms-adherence-gate/hooks.ts +100 -11
  202. package/templates/extensions/comms-adherence-gate/manifest.json +1 -1
  203. package/templates/skills/apps/SKILL.md +7 -0
  204. package/templates/skills/apps/content.md +7 -0
  205. package/dist/app-a66ssc4k.js +0 -17
  206. package/dist/handlers-crckt5dq.js +0 -32
  207. package/dist/index-4x08sjtk.js +0 -30
  208. package/dist/index-8ybffts4.js +0 -37
  209. package/dist/index-nfy4kkg5.js +0 -33
  210. package/dist/lead-zdqxsvjn.js +0 -71
  211. package/dist/worker-y62rvvq3.js +0 -71
  212. package/dist/{cli-gxy8y1dt.js → cli-8bpgbr8k.js} +3 -3
@@ -52,6 +52,10 @@ import {
52
52
  decryptSecret,
53
53
  getEncryptionKey,
54
54
  init_crypto,
55
+ withLoopPath,
56
+ startEventLoopLagProbe,
57
+ stopEventLoopLagProbe,
58
+ init_event_loop_lag,
55
59
  getPromptTemplateDefaultDrift,
56
60
  init_default_drift,
57
61
  init_templates2,
@@ -480,7 +484,7 @@ import {
480
484
  countScriptRunJournalSteps2,
481
485
  countScriptRunJournalAgentTaskSteps2,
482
486
  init_db4
483
- } from "./cli-neyag5p6.js";
487
+ } from "./cli-j7d73g1y.js";
484
488
  import {
485
489
  PRIMARY_ROLE_NAMES2,
486
490
  OperatorGrantedTargetError2,
@@ -494,8 +498,8 @@ import {
494
498
  assertNotLastAdmin2,
495
499
  setUserRoles2,
496
500
  init_rbac_roles
497
- } from "./cli-btc9cb4c.js";
498
- import"./cli-2a8py3sx.js";
501
+ } from "./cli-yz7v0sh4.js";
502
+ import"./cli-3xddv0rk.js";
499
503
  import {
500
504
  upsertModelCatalogOverlay,
501
505
  deleteModelCatalogOverlay,
@@ -503,12 +507,12 @@ import {
503
507
  init_model_catalog_store,
504
508
  requestModelCatalogRefresh2,
505
509
  init_pricing_refresh
506
- } from "./cli-530hkwdy.js";
510
+ } from "./cli-ed6yqpf1.js";
507
511
  import {
508
512
  workflowEventBus2,
509
513
  init_event_bus
510
514
  } from "./cli-eddnyg3t.js";
511
- import"./cli-qmd3mse0.js";
515
+ import"./cli-bxz823sz.js";
512
516
  import {
513
517
  require_dist4,
514
518
  getSlackConnectionState,
@@ -539,12 +543,12 @@ import {
539
543
  startSlackApp2,
540
544
  stopSlackApp2,
541
545
  init_app3
542
- } from "./cli-605nn699.js";
546
+ } from "./cli-mr97t7cc.js";
543
547
  import {
544
548
  retryFailedRun2,
545
549
  cancelWorkflowRun2,
546
550
  init_resume
547
- } from "./cli-sya22y84.js";
551
+ } from "./cli-z9cs5m0w.js";
548
552
  import {
549
553
  DEFAULT_NEGOTIATED_PROTOCOL_VERSION,
550
554
  SUPPORTED_PROTOCOL_VERSIONS,
@@ -744,6 +748,7 @@ import {
744
748
  init_teams_origin,
745
749
  getSessionLabels,
746
750
  rememberSessionLabel,
751
+ getResourceSessionLabels,
747
752
  init_session_labels,
748
753
  isChatSdkStopping,
749
754
  startChatSdk,
@@ -980,7 +985,7 @@ import {
980
985
  getEnabledCapabilities,
981
986
  createServer,
982
987
  init_server
983
- } from "./cli-fayav105.js";
988
+ } from "./cli-7wz05bx3.js";
984
989
  import {
985
990
  FilesError,
986
991
  normalizeFilesError,
@@ -991,6 +996,7 @@ import {
991
996
  getFileStorageProvider2,
992
997
  init_registry2
993
998
  } from "./cli-3xj33nrx.js";
999
+ import"./cli-n9ftpys4.js";
994
1000
  import {
995
1001
  RuntimePoolError2,
996
1002
  mintControllerToken,
@@ -1012,7 +1018,7 @@ import {
1012
1018
  resolvePoolDelivery2,
1013
1019
  createPoolAgent2,
1014
1020
  init_db2
1015
- } from "./cli-587857ys.js";
1021
+ } from "./cli-xd5ebp64.js";
1016
1022
  import {
1017
1023
  duplicateGuardedQueryKey,
1018
1024
  warnIfCorsAllowsAnyOrigin,
@@ -1023,6 +1029,7 @@ import {
1023
1029
  getPathSegments,
1024
1030
  wireHttpSpanLifecycle,
1025
1031
  redactShareTokenInPath,
1032
+ loopPathForRequest,
1026
1033
  safeRequestUrlForLog,
1027
1034
  agentWithCapacity,
1028
1035
  RequestBodyTooLargeError,
@@ -1068,7 +1075,7 @@ import {
1068
1075
  describeRequestRoute,
1069
1076
  route,
1070
1077
  init_route_def
1071
- } from "./cli-y8nbefpb.js";
1078
+ } from "./cli-8ewkreqd.js";
1072
1079
  import {
1073
1080
  startPoolRouting,
1074
1081
  stopPoolRouting,
@@ -1081,17 +1088,17 @@ import {
1081
1088
  checkHeartbeatChecklist2,
1082
1089
  runHeartbeatSweep2,
1083
1090
  stopHeartbeat2
1084
- } from "./cli-varqt4d1.js";
1085
- import"./cli-serm8zrx.js";
1091
+ } from "./cli-kx4c8j05.js";
1092
+ import"./cli-x9exydey.js";
1086
1093
  import {
1087
1094
  runtimeSupervisorStatus,
1088
1095
  startRuntimeSupervisor,
1089
1096
  stopRuntimeSupervisor
1090
- } from "./cli-qzt90yze.js";
1097
+ } from "./cli-38yww4e9.js";
1091
1098
  import {
1092
1099
  TASK_TITLE_TIMEOUT_MS,
1093
1100
  generateTaskTitle
1094
- } from "./cli-b932gexn.js";
1101
+ } from "./cli-w3bk0dgv.js";
1095
1102
  import"./cli-ns59dc6r.js";
1096
1103
  import {
1097
1104
  ACP_TARGET_IDS
@@ -1112,11 +1119,11 @@ import {
1112
1119
  isUnknownModelError,
1113
1120
  checkProviderPoolKey,
1114
1121
  writeSkillsToFilesystem
1115
- } from "./cli-p17970qv.js";
1122
+ } from "./cli-jg24scat.js";
1116
1123
  import {
1117
1124
  inviteEmailToSharedOrg,
1118
1125
  ensureAgentFsCredentialsForAgent
1119
- } from "./cli-agyaeef4.js";
1126
+ } from "./cli-cr14kftt.js";
1120
1127
  import {
1121
1128
  Anthropic
1122
1129
  } from "./cli-t73cas91.js";
@@ -1132,7 +1139,7 @@ import {
1132
1139
  ampBillsCacheWrites,
1133
1140
  resolveAmpModel,
1134
1141
  init_amp_models
1135
- } from "./cli-qkdmz8c8.js";
1142
+ } from "./cli-ttbqe3q4.js";
1136
1143
  import {
1137
1144
  RATING_MODEL_MAX_LENGTH,
1138
1145
  REFERENCES_SOURCE_MAX_LENGTH,
@@ -1142,7 +1149,7 @@ import {
1142
1149
  import {
1143
1150
  normalizeModelKey,
1144
1151
  init_pricing_normalize
1145
- } from "./cli-a0657jmf.js";
1152
+ } from "./cli-bzvs88tv.js";
1146
1153
  import {
1147
1154
  require_dist2,
1148
1155
  getMcpOAuthToken,
@@ -1231,7 +1238,7 @@ import {
1231
1238
  init_typecheck,
1232
1239
  parseSkillContent,
1233
1240
  init_skill_parser
1234
- } from "./cli-2ccpqyyf.js";
1241
+ } from "./cli-zjphdj1a.js";
1235
1242
  import {
1236
1243
  signalProcessGroup,
1237
1244
  detachedProcessGroup,
@@ -1248,7 +1255,7 @@ import {
1248
1255
  forceRefreshAuthorizationOrThrow,
1249
1256
  forceRefreshTokenOrThrow,
1250
1257
  init_ensure_token
1251
- } from "./cli-cseh6f8w.js";
1258
+ } from "./cli-16phend6.js";
1252
1259
  import {
1253
1260
  automationIntegrationFixUrl,
1254
1261
  preflightAutomation,
@@ -1292,7 +1299,7 @@ import {
1292
1299
  definitionNodeIds,
1293
1300
  validateDefinition,
1294
1301
  init_definition2
1295
- } from "./cli-ejkvvqbe.js";
1302
+ } from "./cli-xncjscpm.js";
1296
1303
  import {
1297
1304
  _fetchHolder,
1298
1305
  CLIENT_ID,
@@ -1316,7 +1323,7 @@ import {
1316
1323
  import {
1317
1324
  require_content_type
1318
1325
  } from "./cli-yjdgea32.js";
1319
- import"./cli-sgs5k6yd.js";
1326
+ import"./cli-2tsfpc70.js";
1320
1327
  import {
1321
1328
  isInvalidClientError,
1322
1329
  publicEndpointSsrfOptions,
@@ -1334,7 +1341,7 @@ import {
1334
1341
  revokeMcpToken,
1335
1342
  computeExpiresAt,
1336
1343
  init_mcp_wrapper
1337
- } from "./cli-btf6fw39.js";
1344
+ } from "./cli-0m7rtm11.js";
1338
1345
  import {
1339
1346
  createRuntimeProvider,
1340
1347
  init_runtime_providers
@@ -1384,11 +1391,13 @@ import {
1384
1391
  revokeAgentTokens,
1385
1392
  fingerprintApiKey,
1386
1393
  init_users
1387
- } from "./cli-4t0fmf3z.js";
1394
+ } from "./cli-g1px1g2e.js";
1388
1395
  import {
1389
1396
  ASSET_KEY_MAX_LENGTH,
1390
1397
  normalizeAssetKey,
1391
1398
  defaultAssetKey,
1399
+ isResourceGroupPrefix,
1400
+ RESOURCE_GROUPS_READ_ONLY,
1392
1401
  parseAssetKey,
1393
1402
  init_key,
1394
1403
  isSafeBundlePath,
@@ -1542,7 +1551,7 @@ import {
1542
1551
  KvKeySchema,
1543
1552
  KvEntrySchema,
1544
1553
  init_types4
1545
- } from "./cli-cvs2r2vq.js";
1554
+ } from "./cli-hfkwwy1h.js";
1546
1555
  import {
1547
1556
  CODEX_AUTH_FAILURE_BENCH_THRESHOLD,
1548
1557
  CODEX_AUTH_WATCH_NAMESPACE,
@@ -1553,7 +1562,7 @@ import {
1553
1562
  IDENTITY_FIELD_BUDGETS,
1554
1563
  IdentityFieldBudgetError,
1555
1564
  init_identity_field_budget
1556
- } from "./cli-9r5gtwjr.js";
1565
+ } from "./cli-pyrxt9gw.js";
1557
1566
  import {
1558
1567
  getSlackConfiguration,
1559
1568
  init_config4
@@ -1622,7 +1631,7 @@ import {
1622
1631
  import {
1623
1632
  init_package,
1624
1633
  package_default
1625
- } from "./cli-650zv9q9.js";
1634
+ } from "./cli-rt0ag4x1.js";
1626
1635
  import {
1627
1636
  realtimeBus,
1628
1637
  init_bus
@@ -2248,6 +2257,9 @@ async function stopDbRetention() {
2248
2257
  await retentionTickPromise;
2249
2258
  }
2250
2259
 
2260
+ // src/http/index.ts
2261
+ init_event_loop_lag();
2262
+
2251
2263
  // src/be/human-free-drain.ts
2252
2264
  init_human_free();
2253
2265
  var YIELD_MS2 = 25;
@@ -2307,6 +2319,7 @@ function stopHumanFreeDrain() {
2307
2319
  // src/be/mcp-overflow-sweep.ts
2308
2320
  init_kv_overflow();
2309
2321
  init_db4();
2322
+ init_event_loop_lag();
2310
2323
  var MCP_OVERFLOW_SWEEP_INTERVAL_MS = 10 * 60 * 1000;
2311
2324
  var sweepTimer = null;
2312
2325
  async function runMcpOverflowSweep(now = Date.now()) {
@@ -2325,7 +2338,7 @@ function startMcpOverflowSweep(intervalMs = MCP_OVERFLOW_SWEEP_INTERVAL_MS) {
2325
2338
  if (sweepTimer)
2326
2339
  return;
2327
2340
  sweepTimer = setInterval(() => {
2328
- runMcpOverflowSweep();
2341
+ withLoopPath("mcp-overflow.sweep", () => runMcpOverflowSweep());
2329
2342
  }, intervalMs);
2330
2343
  if (typeof sweepTimer?.unref === "function")
2331
2344
  sweepTimer.unref();
@@ -12125,7 +12138,7 @@ var catalog_generated_default = {
12125
12138
  $schema: "../manifest.schema.json",
12126
12139
  name: "comms-adherence-gate",
12127
12140
  description: "Judges every Slack-facing store-progress completion and agent Slack post against the comms preferences of the requester, or of the person it @-mentions, their latest request and a plain-language rubric with Jev (TypeSafe or OpenRouter), and in enforce blocks a failing call once per task",
12128
- version: "1.7.0",
12141
+ version: "1.8.0",
12129
12142
  runtime: "api",
12130
12143
  assets: {
12131
12144
  hooks: "hooks.ts"
@@ -12188,6 +12201,12 @@ export const config = z.object({
12188
12201
  openrouterModel: z.string().default("typesafe/jev-1.13"),
12189
12202
  /** Explicit TypeSafe key; otherwise TYPESAFE_API_KEY from the API process env. */
12190
12203
  apiKey: z.string().optional(),
12204
+ /**
12205
+ * Fixed text the operator's own templates mandate, judged by the self-test and
12206
+ * expected to pass. Kept loose here and parsed per entry by \`fixturesOf\`, so one
12207
+ * bad entry cannot fail the whole config and drop \`mode\` back to its default.
12208
+ */
12209
+ fixtures: z.unknown().optional(),
12191
12210
  });
12192
12211
 
12193
12212
  type Cfg = z.infer<typeof config>;
@@ -12388,6 +12407,27 @@ export const resolveTransport = (cfg: Cfg): JevTransport => {
12388
12407
  );
12389
12408
  };
12390
12409
 
12410
+ /**
12411
+ * The judge input for one message. The live gate and the self-test fixtures build it
12412
+ * here, so a fixture is judged exactly like real traffic.
12413
+ */
12414
+ export const gateState = (s: {
12415
+ requester: string;
12416
+ prefs: Prefs;
12417
+ ask: string;
12418
+ threadOpening: string;
12419
+ text: string;
12420
+ }): Record<string, unknown> => ({
12421
+ role: "You audit an AI agent's message to the human who requested the work.",
12422
+ requester: s.requester,
12423
+ requester_preferences: s.prefs,
12424
+ latest_request: s.ask,
12425
+ thread_opening: s.threadOpening,
12426
+ judging_rules: JUDGING_RULES,
12427
+ plain_language_rules: PLAIN_RULES,
12428
+ agent_message: s.text,
12429
+ });
12430
+
12391
12431
  /** One Jev call; returns the \`noul\` score per question. Throws on any failure. */
12392
12432
  export const askJev = async (
12393
12433
  state: Record<string, unknown>,
@@ -12444,6 +12484,72 @@ const SELFTEST_PLAIN_GOOD =
12444
12484
  const below = (bad: unknown, good: unknown, threshold: number): boolean =>
12445
12485
  typeof bad === "number" && typeof good === "number" && bad < threshold && good >= threshold;
12446
12486
 
12487
+ /** Fixtures judged per self-test run: one Jev call each, inside the 5 s handler budget. */
12488
+ export const MAX_FIXTURES = 8;
12489
+ const fixture = z.object({
12490
+ name: z.string().min(1).max(80),
12491
+ /** The fixed text as it will be posted, placeholders filled with sample values. */
12492
+ text: z.string().min(1).max(4000),
12493
+ /** Audience preferences; omit to judge \`plain\` only. */
12494
+ prefs: z
12495
+ .object({
12496
+ verbosity: z.string().optional(),
12497
+ tone: z.string().optional(),
12498
+ language: z.string().optional(),
12499
+ })
12500
+ .optional(),
12501
+ /** The request the text answers, as \`latest_request\`. */
12502
+ request: z.string().max(900).optional(),
12503
+ });
12504
+ export type Fixture = z.infer<typeof fixture>;
12505
+
12506
+ /** Valid fixture entries, in order, capped at MAX_FIXTURES; invalid entries are skipped. */
12507
+ export const fixturesOf = (raw: unknown): Fixture[] =>
12508
+ (Array.isArray(raw) ? raw : [])
12509
+ .map((f) => fixture.safeParse(f))
12510
+ .filter((r) => r.success)
12511
+ .map((r) => r.data)
12512
+ .slice(0, MAX_FIXTURES);
12513
+
12514
+ /**
12515
+ * Judge each fixture with the live gate's questions and state. A fixture is fixed
12516
+ * text the operator expects to pass, so any dimension below its threshold fails it.
12517
+ */
12518
+ const judgeFixtures = async (
12519
+ fixtures: Fixture[],
12520
+ transport: JevTransport,
12521
+ cfg: Cfg,
12522
+ signal?: AbortSignal,
12523
+ ) =>
12524
+ Promise.all(
12525
+ fixtures.map(async (f) => {
12526
+ const prefs: Prefs = f.prefs ?? {};
12527
+ const questions = { ...buildQuestions(prefs), plain: PLAIN_QUESTION };
12528
+ try {
12529
+ const { scores } = await askJev(
12530
+ gateState({
12531
+ requester: "the requester",
12532
+ prefs,
12533
+ ask: f.request ?? "",
12534
+ threadOpening: "",
12535
+ text: f.text,
12536
+ }),
12537
+ questions,
12538
+ transport,
12539
+ cfg,
12540
+ signal,
12541
+ );
12542
+ const failed = Object.keys(questions).filter((dim) => {
12543
+ const s = scores[dim];
12544
+ return typeof s !== "number" || s < (dim === "plain" ? cfg.plainThreshold : cfg.threshold);
12545
+ });
12546
+ return { name: f.name, scores, failed, pass: failed.length === 0 };
12547
+ } catch (err) {
12548
+ return { name: f.name, error: String(err).slice(0, 200), pass: false };
12549
+ }
12550
+ }),
12551
+ );
12552
+
12447
12553
  /**
12448
12554
  * Run the judge on known-bad (positive control, must score below threshold) and
12449
12555
  * known-good (negative control, must score at or above it) messages and record
@@ -12464,11 +12570,13 @@ const selfTest = async (swarm: Swarm, cfg: Cfg, signal?: AbortSignal): Promise<v
12464
12570
  cfg,
12465
12571
  signal,
12466
12572
  ).then((r) => r.scores[dim] ?? null);
12467
- const [bad, good, plainBad, plainGood] = await Promise.all([
12573
+ const fixtures = fixturesOf(cfg.fixtures);
12574
+ const [bad, good, plainBad, plainGood, fixtureResults] = await Promise.all([
12468
12575
  judge(SELFTEST_BAD, "verbosity"),
12469
12576
  judge(SELFTEST_GOOD, "verbosity"),
12470
12577
  judge(SELFTEST_PLAIN_BAD, "plain"),
12471
12578
  judge(SELFTEST_PLAIN_GOOD, "plain"),
12579
+ judgeFixtures(fixtures, transport, cfg, signal),
12472
12580
  ]);
12473
12581
  await swarm.kv_set({
12474
12582
  namespace: NS,
@@ -12484,6 +12592,9 @@ const selfTest = async (swarm: Swarm, cfg: Cfg, signal?: AbortSignal): Promise<v
12484
12592
  plainPositiveControlBadScore: plainBad,
12485
12593
  plainNegativeControlGoodScore: plainGood,
12486
12594
  plainControlsOk: below(plainBad, plainGood, cfg.plainThreshold),
12595
+ fixtures: fixtureResults,
12596
+ // null when none are configured: zero fixtures is not a pass.
12597
+ fixturesOk: fixtureResults.length === 0 ? null : fixtureResults.every((f) => f.pass),
12487
12598
  latencyMs: Date.now() - started,
12488
12599
  },
12489
12600
  });
@@ -12695,16 +12806,7 @@ const extension: SwarmExtension = (api) => {
12695
12806
 
12696
12807
  const transport = resolveTransport(cfg);
12697
12808
  const { scores, latencyMs } = await askJev(
12698
- {
12699
- role: "You audit an AI agent's message to the human who requested the work.",
12700
- requester: audienceName,
12701
- requester_preferences: prefs,
12702
- latest_request: ask,
12703
- thread_opening: threadOpening,
12704
- judging_rules: JUDGING_RULES,
12705
- plain_language_rules: PLAIN_RULES,
12706
- agent_message: text,
12707
- },
12809
+ gateState({ requester: audienceName, prefs, ask, threadOpening, text }),
12708
12810
  questions,
12709
12811
  transport,
12710
12812
  cfg,
@@ -12826,7 +12928,7 @@ const extension: SwarmExtension = (api) => {
12826
12928
  export default extension;
12827
12929
  `
12828
12930
  },
12829
- readme: '# comms-adherence-gate\n\nAgents finish Slack tasks with a final message a human reads, and post to Slack threads directly. This extension judges that text with Jev, [TypeSafe](https://typesafe.ai)\'s decision model: against the requester\'s stated comms preferences and their latest request, and against a plain-language rubric that applies to every message. In `enforce` it blocks a failing call once and tells the agent what to fix. A `plain` failure points the agent at the `comms` skill.\n\nInstall config:\n\n```json\n{ "mode": "shadow", "plainMode": "shadow" }\n```\n\nStart in `shadow`, read the verdicts in KV for a few days, then switch to `enforce`. `mode` and `plainMode` move independently.\n\n## Modes\n\n| `mode` | Effect |\n|---|---|\n| `off` | Never evaluates. |\n| `shadow` (default) | Asks Jev and records the verdict. Never blocks. |\n| `enforce` | Asks Jev, records the verdict, and blocks the call when a dimension fails, at most `maxBlocksPerTask` times per task. The agent gets the failed dimensions, their scores and the stated preference, and calls again. |\n\n`mode` governs the preference dimensions (`verbosity`, `tone`, `language`). `plainMode` governs `plain`. A dimension blocks only when its own mode is `enforce`. Both share one block budget per task, across every gated tool.\n\n## What it gates\n\nHook: `pre.tool.call` on:\n\n- `store-progress` with `status: "completed"` and a non-empty `output`, on a task that came from Slack (`source = "slack"` or a `slackThreadTs`). Other completions pass without a Jev call.\n- `slack-reply`, `slack-post`, `slack-start-thread` and `slack-update`, judged on `message`. The task is `slack-reply`\'s `taskId`, else the caller\'s task context. A post with no task context passes.\n\nOnly a call the tool itself accepts is judged, so no other task\'s text reaches Jev. For `store-progress` the caller must own the task, the task must be unassigned, or the caller must be a lead. For the Slack tools the caller must be the task\'s assignee or its creator, the rule `slack-reply` enforces. Calls made by extensions are skipped. Script SDK calls never reach `pre.tool.call` (the tool registrar dispatches it only for MCP calls); if one ever does, the gate records it and never blocks.\n\nA requester with no stated preferences in `users.metadata.comms` still gets the `plain` question. Set preferences with the `manage-user` tool.\n\nIn a thread with several people, the requester is the person whose message created the task. A message that @-mentions someone (`<@U123>`) is judged against the first mentioned person with stored preferences, resolved through their Slack identity in `user_external_ids`; otherwise against the requester. The lookup is one SQL read, only when the text mentions someone and `mode` is not `off`. The verdict records who was judged in `judgedFor` (`mention` or `requester`) and `audience`.\n\n## Decision\n\nThe gate reads the task row and asks one `noul` question per stated preference it knows: `verbosity`, `tone`, `language`. Any other key in `comms` is context only.\n\nJev sees the preferences, the requester\'s latest message (the text after the last `</thread_context>`, from the last 1,400 characters of the task), the first 400 characters of the task, and the output. Its judging rules say an explicit request outranks the stored default. A requested long answer, story or document is not a verbosity failure.\n\nIt also asks `plain` on every message unless `plainMode` is `off` or the text is a JSON document (structured output for an `outputSchema`). The rubric comes from the `comms` skill: everyday words, one idea per sentence, every number with a unit and a direction word, and no unexplained shorthand (n, median, p90, cohort, baseline, delta, `±X at 95%`). Code identifiers, task ids, PR numbers, links and versions are fine. Jev gets contrasting plain and dense examples in `plain_language_rules`; a prose-only rubric scored plain rewrites as low as the dense originals.\n\nAll questions go in one Jev request. A preference dimension fails below `threshold`; `plain` fails below `plainThreshold`. Any failed dimension fails the message.\n\n### Calibration of `plain`\n\nJev scores dense status text near 0 and plain text near 0.8 to 0.9, with a wide middle of compact but readable engineering notes. Measured on 400 Slack-facing completions over 7 days, at `threshold` 0.75 for preferences:\n\n| `plainThreshold` | Newly blocked (of messages that pass today) |\n|---|---|\n| 0.75 | 81% to 83% |\n| 0.3 | 9% to 13% |\n| 0.25 (default) | 5% to 7% |\n\nAt 0.25 the dense prompt-cache-monitor post scores about 0.15 and its plain rewrite about 0.81.\n\n## Jev transport\n\nJev is reachable two ways. Both take the same request and return the same answer.\n\n| `provider` | Endpoint | Key | Model |\n|---|---|---|---|\n| `typesafe` | `POST https://api.typesafe.ai/v1/systemone` | `TYPESAFE_API_KEY` (or `apiKey`) | `model`, default `jev-latest` |\n| `openrouter` | `POST https://openrouter.ai/api/alpha/decisions` | `OPENROUTER_API_KEY` | `openrouterModel`, default `typesafe/jev-1.13` |\n| `auto` (default) | TypeSafe when its key is set, else OpenRouter | | |\n\nEach verdict row records the `provider` that answered.\n\n## Fail open\n\nEvery error lets the completion through: a missing key, an HTTP error, a network error, a timeout, a malformed answer, or a failed DB read. The handler never throws, so an outage cannot auto-disable the extension. Each failure bumps the `error` counter and overwrites `error:last`.\n\n## Self-test\n\nCall `store-progress` with a non-completed status and `progress` starting with `comms-gate-selftest`. The gate judges a known-bad and a known-good message against a terse preference, and a dense and a plain message on `plain`, then writes `selftest:last`: every score, both thresholds, the provider, `controlsOk` (verbosity: bad below `threshold`, good at or above it) and `plainControlsOk` (the same against `plainThreshold`). Real traffic is untouched.\n\n## Config\n\n| Key | Default | Notes |\n|---|---|---|\n| `mode` | `shadow` | `off`, `shadow`, or `enforce` |\n| `threshold` | `0.5` | A preference dimension scoring below this fails |\n| `plainMode` | `shadow` | `off`, `shadow`, or `enforce` for the `plain` dimension |\n| `plainThreshold` | `0.25` | `plain` scoring below this fails. See [Calibration](#calibration-of-plain) |\n| `timeoutMs` | `4000` | Jev call timeout, capped at 4000 (the dispatcher cancels a handler at 5 s) |\n| `maxBlocksPerTask` | `1` | Blocks per task in `enforce`; after that the gate records and lets it through |\n| `provider` | `auto` | `auto`, `typesafe`, or `openrouter`. See [Jev transport](#jev-transport) |\n| `model` | `jev-latest` | Jev model on TypeSafe |\n| `openrouterModel` | `typesafe/jev-1.13` | Jev model on OpenRouter |\n| `apiKey` | unset | Explicit TypeSafe key. Prefer the `TYPESAFE_API_KEY` secret below |\n\n## Required secrets\n\nRead from the API process environment at call time. Set them as global `swarm_config` secrets: the API process loads global rows into `process.env` at boot and on config reload.\n\n- `TYPESAFE_API_KEY` or `OPENROUTER_API_KEY`: one is required for any evaluation. Under `auto`, TypeSafe wins when both are set. Without either, every completion fails open.\n\nNo key is written to config, KV, logs, or a block reason.\n\n## KV namespace `ext:comms-gate`\n\n- `last`: the latest verdict, with `tool`, `scores`, `failed`, `mode`, `plainMode`, `provider`, `latencyMs`, the preferences, a 400-character `askPreview` and a 700-character `outputPreview`.\n- `fail:<epochMs>:<taskId>`: one row per failed verdict, with `action` (`blocked` or `recorded`).\n- `blocks:<taskId>`: blocks issued for that task.\n- `error:last`, `selftest:last`.\n- Counters: `total`, `pass`, `fail`, `blocked`, `escaped` (a blocking dimension failed, block budget spent), `shadowed` (only non-blocking dimensions failed), `error`, and `dim:<dimension>`.\n\n## Known limits\n\n- Only the last 1,400 characters of the task are searched for the latest request. A very long final message is cut to its last 900 characters.\n- The block budget is per task, so a retried call after a block goes through once the budget is spent, even if it still fails.\n- Each gated Slack post waits for one Jev call (about 0.2 s measured, capped by `timeoutMs`).\n'
12931
+ readme: '# comms-adherence-gate\n\nAgents finish Slack tasks with a final message a human reads, and post to Slack threads directly. This extension judges that text with Jev, [TypeSafe](https://typesafe.ai)\'s decision model: against the requester\'s stated comms preferences and their latest request, and against a plain-language rubric that applies to every message. In `enforce` it blocks a failing call once and tells the agent what to fix. A `plain` failure points the agent at the `comms` skill.\n\nInstall config:\n\n```json\n{ "mode": "shadow", "plainMode": "shadow" }\n```\n\nStart in `shadow`, read the verdicts in KV for a few days, then switch to `enforce`. `mode` and `plainMode` move independently.\n\n## Modes\n\n| `mode` | Effect |\n|---|---|\n| `off` | Never evaluates. |\n| `shadow` (default) | Asks Jev and records the verdict. Never blocks. |\n| `enforce` | Asks Jev, records the verdict, and blocks the call when a dimension fails, at most `maxBlocksPerTask` times per task. The agent gets the failed dimensions, their scores and the stated preference, and calls again. |\n\n`mode` governs the preference dimensions (`verbosity`, `tone`, `language`). `plainMode` governs `plain`. A dimension blocks only when its own mode is `enforce`. Both share one block budget per task, across every gated tool.\n\n## What it gates\n\nHook: `pre.tool.call` on:\n\n- `store-progress` with `status: "completed"` and a non-empty `output`, on a task that came from Slack (`source = "slack"` or a `slackThreadTs`). Other completions pass without a Jev call.\n- `slack-reply`, `slack-post`, `slack-start-thread` and `slack-update`, judged on `message`. The task is `slack-reply`\'s `taskId`, else the caller\'s task context. A post with no task context passes.\n\nOnly a call the tool itself accepts is judged, so no other task\'s text reaches Jev. For `store-progress` the caller must own the task, the task must be unassigned, or the caller must be a lead. For the Slack tools the caller must be the task\'s assignee or its creator, the rule `slack-reply` enforces. Calls made by extensions are skipped. Script SDK calls never reach `pre.tool.call` (the tool registrar dispatches it only for MCP calls); if one ever does, the gate records it and never blocks.\n\nA requester with no stated preferences in `users.metadata.comms` still gets the `plain` question. Set preferences with the `manage-user` tool.\n\nIn a thread with several people, the requester is the person whose message created the task. A message that @-mentions someone (`<@U123>`) is judged against the first mentioned person with stored preferences, resolved through their Slack identity in `user_external_ids`; otherwise against the requester. The lookup is one SQL read, only when the text mentions someone and `mode` is not `off`. The verdict records who was judged in `judgedFor` (`mention` or `requester`) and `audience`.\n\n## Decision\n\nThe gate reads the task row and asks one `noul` question per stated preference it knows: `verbosity`, `tone`, `language`. Any other key in `comms` is context only.\n\nJev sees the preferences, the requester\'s latest message (the text after the last `</thread_context>`, from the last 1,400 characters of the task), the first 400 characters of the task, and the output. Its judging rules say an explicit request outranks the stored default. A requested long answer, story or document is not a verbosity failure.\n\nIt also asks `plain` on every message unless `plainMode` is `off` or the text is a JSON document (structured output for an `outputSchema`). The rubric comes from the `comms` skill: everyday words, one idea per sentence, every number with a unit and a direction word, and no unexplained shorthand (n, median, p90, cohort, baseline, delta, `±X at 95%`). Code identifiers, task ids, PR numbers, links and versions are fine. Jev gets contrasting plain and dense examples in `plain_language_rules`; a prose-only rubric scored plain rewrites as low as the dense originals.\n\nAll questions go in one Jev request. A preference dimension fails below `threshold`; `plain` fails below `plainThreshold`. Any failed dimension fails the message.\n\n### Calibration of `plain`\n\nJev scores dense status text near 0 and plain text near 0.8 to 0.9, with a wide middle of compact but readable engineering notes. Measured on 400 Slack-facing completions over 7 days, at `threshold` 0.75 for preferences:\n\n| `plainThreshold` | Newly blocked (of messages that pass today) |\n|---|---|\n| 0.75 | 81% to 83% |\n| 0.3 | 9% to 13% |\n| 0.25 (default) | 5% to 7% |\n\nAt 0.25 the dense prompt-cache-monitor post scores about 0.15 and its plain rewrite about 0.81.\n\n## Jev transport\n\nJev is reachable two ways. Both take the same request and return the same answer.\n\n| `provider` | Endpoint | Key | Model |\n|---|---|---|---|\n| `typesafe` | `POST https://api.typesafe.ai/v1/systemone` | `TYPESAFE_API_KEY` (or `apiKey`) | `model`, default `jev-latest` |\n| `openrouter` | `POST https://openrouter.ai/api/alpha/decisions` | `OPENROUTER_API_KEY` | `openrouterModel`, default `typesafe/jev-1.13` |\n| `auto` (default) | TypeSafe when its key is set, else OpenRouter | | |\n\nEach verdict row records the `provider` that answered.\n\n## Fail open\n\nEvery error lets the completion through: a missing key, an HTTP error, a network error, a timeout, a malformed answer, or a failed DB read. The handler never throws, so an outage cannot auto-disable the extension. Each failure bumps the `error` counter and overwrites `error:last`.\n\n## Self-test\n\nCall `store-progress` with a non-completed status and `progress` starting with `comms-gate-selftest`. The gate judges a known-bad and a known-good message against a terse preference, and a dense and a plain message on `plain`, then writes `selftest:last`: every score, both thresholds, the provider, `controlsOk` (verbosity: bad below `threshold`, good at or above it) and `plainControlsOk` (the same against `plainThreshold`). Real traffic is untouched.\n\n### Fixtures\n\nFixed text that your own templates tell an agent to post (a daily report\'s all-clear line, a standard reply) should pass the gate. List it under `fixtures` and the self-test judges each entry with the same state and questions as real traffic, then records `fixtures` (per entry: `name`, `scores`, `failed`, `pass`) and `fixturesOk` in `selftest:last`. A failing fixture means the template line or the gate needs a fix before a quiet day forces an ad-hoc rewrite.\n\n```json\n{\n "fixtures": [\n { "name": "daily-report-all-clear", "text": "📊 11-03: all clear, nothing for you. 56 of 73 workflows are turned on." },\n {\n "name": "short-reply",\n "text": "Went with option B: it keeps the migration reversible. PR #123.",\n "prefs": { "verbosity": "very terse, ~400 chars max" },\n "request": "which option did you pick?"\n }\n ]\n}\n```\n\nFill placeholders with realistic sample values. `prefs` adds the preference dimensions it names; without it only `plain` is judged. At most 8 entries run; an invalid entry is skipped, never fatal to the rest of the config.\n\n`fixturesOk` is `true` only when at least one entry ran and every entry passed. It is `null` when no valid entry ran: `fixtures` unset, an explicit `fixtures: []`, or every entry invalid. `null` means nothing was checked, so never read it as a pass. A skipped entry is missing from `fixtures` in `selftest:last`, so compare that list with your config.\n\nUnit tests mock Jev, so they cannot show that a line passes. Only the self-test, which calls the live judge, can.\n\n## Config\n\n| Key | Default | Notes |\n|---|---|---|\n| `mode` | `shadow` | `off`, `shadow`, or `enforce` |\n| `threshold` | `0.5` | A preference dimension scoring below this fails |\n| `plainMode` | `shadow` | `off`, `shadow`, or `enforce` for the `plain` dimension |\n| `plainThreshold` | `0.25` | `plain` scoring below this fails. See [Calibration](#calibration-of-plain) |\n| `timeoutMs` | `4000` | Jev call timeout, capped at 4000 (the dispatcher cancels a handler at 5 s) |\n| `maxBlocksPerTask` | `1` | Blocks per task in `enforce`; after that the gate records and lets it through |\n| `provider` | `auto` | `auto`, `typesafe`, or `openrouter`. See [Jev transport](#jev-transport) |\n| `model` | `jev-latest` | Jev model on TypeSafe |\n| `openrouterModel` | `typesafe/jev-1.13` | Jev model on OpenRouter |\n| `apiKey` | unset | Explicit TypeSafe key. Prefer the `TYPESAFE_API_KEY` secret below |\n| `fixtures` | unset | Fixed template text the self-test expects to pass. See [Fixtures](#fixtures) |\n\n## Required secrets\n\nRead from the API process environment at call time. Set them as global `swarm_config` secrets: the API process loads global rows into `process.env` at boot and on config reload.\n\n- `TYPESAFE_API_KEY` or `OPENROUTER_API_KEY`: one is required for any evaluation. Under `auto`, TypeSafe wins when both are set. Without either, every completion fails open.\n\nNo key is written to config, KV, logs, or a block reason.\n\n## KV namespace `ext:comms-gate`\n\n- `last`: the latest verdict, with `tool`, `scores`, `failed`, `mode`, `plainMode`, `provider`, `latencyMs`, the preferences, a 400-character `askPreview` and a 700-character `outputPreview`.\n- `fail:<epochMs>:<taskId>`: one row per failed verdict, with `action` (`blocked` or `recorded`).\n- `blocks:<taskId>`: blocks issued for that task.\n- `error:last`, `selftest:last`.\n- Counters: `total`, `pass`, `fail`, `blocked`, `escaped` (a blocking dimension failed, block budget spent), `shadowed` (only non-blocking dimensions failed), `error`, and `dim:<dimension>`.\n\n## Known limits\n\n- Only the last 1,400 characters of the task are searched for the latest request. A very long final message is cut to its last 900 characters.\n- The block budget is per task, so a retried call after a block goes through once the budget is spent, even if it still fails.\n- Each gated Slack post waits for one Jev call (about 0.2 s measured, capped by `timeoutMs`).\n'
12830
12932
  },
12831
12933
  "deploy-awareness": {
12832
12934
  manifestFile: "manifest.json",
@@ -20374,6 +20476,7 @@ function closeIdleMcpUserTransports(transports, sessionUsers, sessionActivity, o
20374
20476
  // src/http/memory.ts
20375
20477
  init_zod();
20376
20478
  init_db4();
20479
+ init_event_loop_lag();
20377
20480
  init_memory();
20378
20481
  init_access();
20379
20482
  init_constants2();
@@ -21823,7 +21926,7 @@ async function handleMemory(req, res, pathSegments, callerAgentId) {
21823
21926
  var MEMORY_GC_INTERVAL_MS = 60 * 60 * 1000;
21824
21927
  var memoryGcTimer = null;
21825
21928
  var SEARCH_RETRIEVAL_TTL_DAYS = 90;
21826
- var SEARCH_RETRIEVAL_PURGE_BATCH = 2000;
21929
+ var SEARCH_RETRIEVAL_PURGE_BATCH = 500;
21827
21930
  async function purgeStaleSearchRetrievals(batchSize = SEARCH_RETRIEVAL_PURGE_BATCH) {
21828
21931
  try {
21829
21932
  const cutoff = new Date(Date.now() - SEARCH_RETRIEVAL_TTL_DAYS * 24 * 60 * 60 * 1000).toISOString();
@@ -21863,12 +21966,12 @@ async function startMemoryGc(intervalMs = MEMORY_GC_INTERVAL_MS, initialDelayMs
21863
21966
  return;
21864
21967
  memoryGcInitialTimer = setTimeout(() => {
21865
21968
  memoryGcInitialTimer = null;
21866
- runMemoryGcTick("Initial");
21969
+ withLoopPath("memory-gc.tick", () => runMemoryGcTick("Initial"));
21867
21970
  }, initialDelayMs);
21868
21971
  if (typeof memoryGcInitialTimer?.unref === "function")
21869
21972
  memoryGcInitialTimer.unref();
21870
21973
  memoryGcTimer = setInterval(() => {
21871
- runMemoryGcTick("Periodic");
21974
+ withLoopPath("memory-gc.tick", () => runMemoryGcTick("Periodic"));
21872
21975
  }, intervalMs);
21873
21976
  if (typeof memoryGcTimer?.unref === "function")
21874
21977
  memoryGcTimer.unref();
@@ -37838,8 +37941,12 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37838
37941
  hideSource: parsed.query.hideSource,
37839
37942
  showSource: parsed.query.showSource
37840
37943
  });
37841
- const { sourceGroups, slackChannels, threadLabels, ...counts } = tree;
37842
- const labels = { ...threadLabels, ...await getSessionLabels(sourceGroups) };
37944
+ const { sourceGroups, slackChannels, threadLabels, resourceGroups, ...counts } = tree;
37945
+ const [sourceLabels, resourceLabels] = await Promise.all([
37946
+ getSessionLabels(sourceGroups),
37947
+ getResourceSessionLabels(resourceGroups)
37948
+ ]);
37949
+ const labels = { ...threadLabels, ...sourceLabels, ...resourceLabels };
37843
37950
  warmSlackChannelLabels(slackChannels.map((id) => `shared/slack/${id}/`).filter((key) => labels[key] === undefined));
37844
37951
  sessionTree.respond(res, 200, { ...counts, labels });
37845
37952
  return true;
@@ -37893,6 +38000,10 @@ async function handleSessions(req, res, pathSegments, queryParams, myAgentId) {
37893
38000
  jsonError(res, SOURCE_GROUPS_READ_ONLY, 400);
37894
38001
  return true;
37895
38002
  }
38003
+ if (isResourceGroupPrefix(from) || parsed.body.to && isResourceGroupPrefix(normalizeAssetKey(parsed.body.to))) {
38004
+ jsonError(res, RESOURCE_GROUPS_READ_ONLY, 400);
38005
+ return true;
38006
+ }
37896
38007
  if (parseAssetKey(from).relativeSegments.length === 0) {
37897
38008
  jsonError(res, "Cannot move a namespace root", 400);
37898
38009
  return true;
@@ -42151,6 +42262,32 @@ async function runBlockableHandler(source, handler) {
42151
42262
  return { created: false, skipped: true, reason: err.reason, extension: err.extension };
42152
42263
  }
42153
42264
  }
42265
+ var GITHUB_VERIFIED_EVENTS = new Set([
42266
+ "ping",
42267
+ "pull_request",
42268
+ "issues",
42269
+ "issue_comment",
42270
+ "pull_request_review_comment",
42271
+ "pull_request_review"
42272
+ ]);
42273
+ var GITHUB_IGNORED_SUMMARY_MS = 60000;
42274
+ var githubIgnoredCounts = new Map;
42275
+ var githubIgnoredTimer = null;
42276
+ function flushGithubIgnoredCounts() {
42277
+ if (githubIgnoredCounts.size === 0)
42278
+ return;
42279
+ const parts = [...githubIgnoredCounts.entries()].map(([name, n]) => `${name}=${n}`);
42280
+ githubIgnoredCounts.clear();
42281
+ console.log(`[GitHub] ignored events last ${GITHUB_IGNORED_SUMMARY_MS / 1000}s: ${parts.join(" ")}`);
42282
+ }
42283
+ function countGithubIgnoredEvent(eventType) {
42284
+ const key = githubIgnoredCounts.has(eventType) || githubIgnoredCounts.size < 50 ? eventType : "other";
42285
+ githubIgnoredCounts.set(key, (githubIgnoredCounts.get(key) ?? 0) + 1);
42286
+ if (!githubIgnoredTimer) {
42287
+ githubIgnoredTimer = setInterval(flushGithubIgnoredCounts, GITHUB_IGNORED_SUMMARY_MS);
42288
+ githubIgnoredTimer.unref();
42289
+ }
42290
+ }
42154
42291
  var githubWebhook = route({
42155
42292
  method: "post",
42156
42293
  path: "/api/github/webhook",
@@ -42355,6 +42492,12 @@ async function handleWebhooks(req, res, pathSegments) {
42355
42492
  }
42356
42493
  const eventType = req.headers["x-github-event"];
42357
42494
  const signature = req.headers["x-hub-signature-256"];
42495
+ if (typeof eventType === "string" && eventType && !GITHUB_VERIFIED_EVENTS.has(eventType)) {
42496
+ countGithubIgnoredEvent(eventType);
42497
+ githubWebhook.respond(res, 200, { created: false });
42498
+ req.resume();
42499
+ return true;
42500
+ }
42358
42501
  const chunks = [];
42359
42502
  for await (const chunk of req) {
42360
42503
  chunks.push(chunk);
@@ -44238,7 +44381,7 @@ function startApiGcInterval() {
44238
44381
  console.log("[HTTP] Explicit GC unavailable; idle MCP transport sweeps remain enabled");
44239
44382
  }
44240
44383
  const interval = setInterval(() => {
44241
- sweepRooms().catch((error) => console.error("[rooms] Sweep failed:", scrubSecrets(String(error))));
44384
+ withLoopPath("http.gc-interval", () => sweepRooms()).catch((error) => console.error("[rooms] Sweep failed:", scrubSecrets(String(error))));
44242
44385
  const closedOwnerTransports = closeIdleMcpTransports(transports, transportActivity, {
44243
44386
  idleTimeoutMs: MCP_TRANSPORT_IDLE_TIMEOUT_MS,
44244
44387
  label: "MCP",
@@ -44406,15 +44549,11 @@ var httpServer = createHttpServer(async (req, res) => {
44406
44549
  writeUnhandledError(res, err, req);
44407
44550
  }
44408
44551
  };
44409
- if (span) {
44410
- await withSpanContext2(span, handleRequest);
44411
- } else {
44412
- await handleRequest();
44413
- }
44552
+ await withLoopPath(loopPathForRequest(req.method, pathSegments), () => span ? withSpanContext2(span, handleRequest) : handleRequest());
44414
44553
  });
44415
44554
  });
44416
44555
  var detachRealtime = attachRealtimeTransport(httpServer);
44417
- var { attachControllerTransport } = await import("./controllers-connect-498hrxvk.js");
44556
+ var { attachControllerTransport } = await import("./controllers-connect-c4448kwa.js");
44418
44557
  var detachControllers = attachControllerTransport(httpServer);
44419
44558
  var stopWorkerNudges = startWorkerNudgeListener();
44420
44559
  var taskAutoTitles = startTaskAutoTitleListener();
@@ -44445,7 +44584,7 @@ async function shutdown() {
44445
44584
  sessionsProcessed: getServerSessionsProcessed()
44446
44585
  });
44447
44586
  if (hasCapability("scheduling")) {
44448
- const { stopScheduler } = await import("./index-nfy4kkg5.js");
44587
+ const { stopScheduler } = await import("./index-8arwq8mw.js");
44449
44588
  stopScheduler();
44450
44589
  }
44451
44590
  stopHeartbeat2();
@@ -44457,7 +44596,7 @@ async function shutdown() {
44457
44596
  await stopSlackApp2();
44458
44597
  await stopChatSdk();
44459
44598
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
44460
- const { stopOAuthKeepalive } = await import("./keepalive-wy29kbrg.js");
44599
+ const { stopOAuthKeepalive } = await import("./keepalive-1j4n4dmk.js");
44461
44600
  await stopOAuthKeepalive();
44462
44601
  }
44463
44602
  stopOAuthPendingGc();
@@ -44476,6 +44615,7 @@ async function shutdown() {
44476
44615
  clearInterval(globalState.__apiGcInterval);
44477
44616
  delete globalState.__apiGcInterval;
44478
44617
  }
44618
+ stopEventLoopLagProbe();
44479
44619
  for (const [id, transport] of Object.entries(transports)) {
44480
44620
  console.log(`[HTTP] Closing transport ${id}`);
44481
44621
  transport.close();
@@ -44513,6 +44653,7 @@ if (!globalState.__runId) {
44513
44653
  globalState.__runId = `run_${Date.now()}`;
44514
44654
  }
44515
44655
  startApiGcInterval();
44656
+ startEventLoopLagProbe();
44516
44657
  var startupConfigsInjected = [];
44517
44658
  try {
44518
44659
  startupConfigsInjected = await loadGlobalConfigsIntoEnv(true);
@@ -44539,21 +44680,21 @@ try {
44539
44680
  console.warn("[startup] CAPABILITIES upgrade seed failed (non-fatal):", err);
44540
44681
  }
44541
44682
  try {
44542
- const { ensurePricingSeeded } = await import("./boot-seeds-qdaf3sdy.js");
44683
+ const { ensurePricingSeeded } = await import("./boot-seeds-8f9zt5cm.js");
44543
44684
  ensurePricingSeeded();
44544
- const { startPricingRefreshLoop } = await import("./pricing-refresh-x7nhv23d.js");
44685
+ const { startPricingRefreshLoop } = await import("./pricing-refresh-ctdr74pd.js");
44545
44686
  startPricingRefreshLoop();
44546
44687
  } catch (err) {
44547
44688
  console.error("[startup] Failed to seed pricing rows:", err);
44548
44689
  }
44549
44690
  try {
44550
- const { ensureModelProfilesSeeded } = await import("./boot-seeds-qdaf3sdy.js");
44691
+ const { ensureModelProfilesSeeded } = await import("./boot-seeds-8f9zt5cm.js");
44551
44692
  await ensureModelProfilesSeeded();
44552
44693
  } catch (err) {
44553
44694
  console.error("[startup] Failed to seed model profiles:", err);
44554
44695
  }
44555
44696
  try {
44556
- const { ensureRbacSeeded } = await import("./boot-seeds-qdaf3sdy.js");
44697
+ const { ensureRbacSeeded } = await import("./boot-seeds-8f9zt5cm.js");
44557
44698
  ensureRbacSeeded();
44558
44699
  } catch (err) {
44559
44700
  console.error("[startup] Failed to sync RBAC seed rows:", err);
@@ -44561,7 +44702,7 @@ try {
44561
44702
  throw err;
44562
44703
  }
44563
44704
  try {
44564
- const { runAllSeeders } = await import("./index-c9y31ytf.js");
44705
+ const { runAllSeeders } = await import("./index-hgn3c961.js");
44565
44706
  await runAllSeeders({ scriptEmbeddingMode: "skip" });
44566
44707
  } catch (err) {
44567
44708
  console.error("[startup] Failed to seed built-in entities:", err);
@@ -44624,26 +44765,26 @@ httpServer.listen(port, async () => {
44624
44765
  await initWorkflows2();
44625
44766
  await startScriptRunSupervisor(getMcpBaseUrl());
44626
44767
  if (hasCapability("scheduling")) {
44627
- const { startScheduler } = await import("./index-nfy4kkg5.js");
44628
- const { getExecutorRegistry } = await import("./index-8ybffts4.js");
44768
+ const { startScheduler } = await import("./index-8arwq8mw.js");
44769
+ const { getExecutorRegistry } = await import("./index-tpw054az.js");
44629
44770
  const intervalMs = Number(process.env.SCHEDULER_INTERVAL_MS) || 1e4;
44630
44771
  startScheduler(getExecutorRegistry(), intervalMs, {
44631
44772
  runId: globalState.__runId
44632
44773
  });
44633
44774
  }
44634
44775
  if (!isEnvFlagEnabled("HEARTBEAT_DISABLE", false)) {
44635
- const { startHeartbeat } = await import("./index-4x08sjtk.js");
44776
+ const { startHeartbeat } = await import("./index-waq75j2j.js");
44636
44777
  const heartbeatMs = Number(process.env.HEARTBEAT_INTERVAL_MS) || 90000;
44637
44778
  startHeartbeat(heartbeatMs);
44638
44779
  }
44639
44780
  startPoolRouting();
44640
44781
  startRuntimeSupervisor();
44641
44782
  if (!isEnvFlagEnabled("OAUTH_KEEPALIVE_DISABLE", false)) {
44642
- const { startOAuthKeepalive } = await import("./keepalive-wy29kbrg.js");
44783
+ const { startOAuthKeepalive } = await import("./keepalive-1j4n4dmk.js");
44643
44784
  startOAuthKeepalive();
44644
44785
  }
44645
44786
  if (!isEnvFlagEnabled("OAUTH_REFRESH_SWEEP_DISABLE", false)) {
44646
- const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-q7mtbyp3.js");
44787
+ const { startOAuthRefreshSweep } = await import("./oauth-refresh-sweep-yy06c03c.js");
44647
44788
  startOAuthRefreshSweep();
44648
44789
  }
44649
44790
  startOAuthPendingGc();
@@ -44652,19 +44793,19 @@ httpServer.listen(port, async () => {
44652
44793
  await startDbRetention();
44653
44794
  startHumanFreeDrain();
44654
44795
  startTaskSearchBackfill();
44655
- import("./embedding-space-xh8p4q4x.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
44796
+ import("./embedding-space-4kyh5qqj.js").then(({ runEmbeddingMaintenance, setDeploymentEnvReader }) => {
44656
44797
  setDeploymentEnvReader(getDeploymentEnvValue);
44657
44798
  return runEmbeddingMaintenance({ backfill: true });
44658
44799
  }).catch((err) => {
44659
44800
  console.error("[embedding-space] startup maintenance failed (non-fatal):", err);
44660
44801
  });
44661
- import("./boot-args-schema-h4qj462e.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
44802
+ import("./boot-args-schema-hwkc8bzv.js").then(({ runBootArgsSchemaBackfill }) => runBootArgsSchemaBackfill()).catch((err) => {
44662
44803
  console.error("[boot-args-schema] startup backfill failed (non-fatal):", err);
44663
44804
  });
44664
- import("./boot-scrub-sweep-9w9jp4sm.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
44805
+ import("./boot-scrub-sweep-r5r8kqsn.js").then(({ runBootScrubSweep }) => runBootScrubSweep()).catch((err) => {
44665
44806
  console.error("[boot-scrub-sweep] startup scrub failed (non-fatal):", err);
44666
44807
  });
44667
- import("./session-source-backfill-440ysamr.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
44808
+ import("./session-source-backfill-2sy0krfk.js").then(({ runSessionSourceBackfill }) => runSessionSourceBackfill()).catch((err) => {
44668
44809
  console.error("[session-source-backfill] startup run failed (non-fatal):", err);
44669
44810
  });
44670
44811
  }).on("error", (err) => {