@askexenow/exe-os 0.9.302 → 0.9.310

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 (311) hide show
  1. package/deploy/compose/.env.example +8 -2
  2. package/deploy/compose/README.md +7 -3
  3. package/deploy/compose/add-routes.sh +107 -0
  4. package/deploy/compose/docker-compose.yml +91 -18
  5. package/deploy/compose/gateway-watchdog.sh +223 -0
  6. package/deploy/compose/generate-env.ts +16 -4
  7. package/deploy/compose/setup.sh +7 -8
  8. package/deploy/stack-manifests/v0.9.json +125 -4
  9. package/dist/{active-agent-ODI6GGVD.js → active-agent-ORX47ZKW.js} +4 -3
  10. package/dist/{active-agent-GGQAP4QE.js → active-agent-S5T2YMOR.js} +4 -3
  11. package/dist/{agentic-ontology-M7T72M6V.js → agentic-ontology-6KBAXLSJ.js} +1 -1
  12. package/dist/{backfill-metadata-GSZP2BEW.js → backfill-metadata-FV7GX6AS.js} +5 -4
  13. package/dist/{behaviors-JM6KFSXL.js → behaviors-47CPEKJ7.js} +6 -5
  14. package/dist/bin/agentic-ontology-backfill.js +6 -5
  15. package/dist/bin/agentic-reflection-backfill.js +7 -6
  16. package/dist/bin/agentic-semantic-label.js +6 -5
  17. package/dist/bin/backfill-conversations.js +8 -7
  18. package/dist/bin/backfill-responses.js +8 -7
  19. package/dist/bin/backfill-vectors.js +10 -9
  20. package/dist/bin/bulk-sync-postgres.js +14 -13
  21. package/dist/bin/cc-doctor.js +5 -4
  22. package/dist/bin/cleanup-stale-review-tasks.js +13 -12
  23. package/dist/bin/cli.js +20 -17
  24. package/dist/bin/deferred-daemon-restart.js +4 -4
  25. package/dist/bin/exe-agent-config.js +3 -2
  26. package/dist/bin/exe-agent.js +12 -11
  27. package/dist/bin/exe-assign.js +10 -9
  28. package/dist/bin/exe-boot.js +21 -20
  29. package/dist/bin/exe-call.js +5 -4
  30. package/dist/bin/exe-cloud.js +14 -13
  31. package/dist/bin/exe-config-dump.js +525 -0
  32. package/dist/bin/exe-dispatch.js +13 -12
  33. package/dist/bin/exe-doctor.js +2 -2
  34. package/dist/bin/exe-export-behaviors.js +8 -7
  35. package/dist/bin/exe-forget.js +7 -6
  36. package/dist/bin/exe-gateway.js +22 -11
  37. package/dist/bin/exe-healthcheck.js +7 -4
  38. package/dist/bin/exe-heartbeat.js +13 -12
  39. package/dist/bin/exe-kill.js +16 -15
  40. package/dist/bin/exe-launch-agent.js +41 -25
  41. package/dist/bin/exe-new-employee.js +9 -8
  42. package/dist/bin/exe-pending-messages.js +14 -13
  43. package/dist/bin/exe-pending-notifications.js +13 -12
  44. package/dist/bin/exe-pending-reviews.js +13 -12
  45. package/dist/bin/exe-preflight.js +108 -0
  46. package/dist/bin/exe-rename.js +5 -4
  47. package/dist/bin/exe-review.js +15 -14
  48. package/dist/bin/exe-search-quality.js +282 -0
  49. package/dist/bin/exe-search.js +6 -5
  50. package/dist/bin/exe-session-cleanup.js +18 -17
  51. package/dist/bin/exe-settings.js +15 -14
  52. package/dist/bin/exe-start-codex.js +13 -12
  53. package/dist/bin/exe-start-opencode.js +9 -8
  54. package/dist/bin/exe-status.js +14 -13
  55. package/dist/bin/exe-support.js +4 -4
  56. package/dist/bin/exe-team.js +4 -3
  57. package/dist/bin/exe-timers.js +237 -0
  58. package/dist/bin/git-sweep.js +14 -13
  59. package/dist/bin/graph-backfill.js +7 -6
  60. package/dist/bin/graph-export.js +6 -5
  61. package/dist/bin/import-history.js +10 -9
  62. package/dist/bin/install-launchd.js +5 -2
  63. package/dist/bin/install.js +16 -15
  64. package/dist/bin/intercom-check.js +4 -4
  65. package/dist/bin/mcp-sessions.js +2 -2
  66. package/dist/bin/orchestration-metrics.js +5 -4
  67. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  68. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  69. package/dist/bin/prune-orphan-chunks.js +43 -10
  70. package/dist/bin/scan-tasks.js +13 -12
  71. package/dist/bin/setup.js +1 -1
  72. package/dist/bin/shard-migrate.js +5 -4
  73. package/dist/bin/stack-update.js +30 -5
  74. package/dist/bin/vps-health-gate.js +1 -1
  75. package/dist/{capability-cards-BCTFKT4G.js → capability-cards-WQVY7WSS.js} +3 -2
  76. package/dist/{capacity-monitor-B4S3XEDO.js → capacity-monitor-BUKYPSWR.js} +14 -13
  77. package/dist/{catchup-brief-I35KHK62.js → catchup-brief-X5IVQAOH.js} +16 -15
  78. package/dist/{chunk-74TUYU5A.js → chunk-255DIG4B.js} +1 -1
  79. package/dist/{chunk-CXKR5Z5F.js → chunk-2EJ636HI.js} +4 -0
  80. package/dist/{chunk-ST3X3YMZ.js → chunk-2NGPZCWX.js} +4 -4
  81. package/dist/{chunk-LD2JKEJT.js → chunk-2NVEKSSP.js} +7 -7
  82. package/dist/{chunk-V6P7TPPA.js → chunk-2UVN2NBN.js} +148 -2
  83. package/dist/{chunk-OZRO37JW.js → chunk-3KH6GXXX.js} +2 -2
  84. package/dist/{chunk-IMJNYREY.js → chunk-43R2GILO.js} +1 -1
  85. package/dist/{chunk-6X2YNVLB.js → chunk-4BANMHJ5.js} +3 -3
  86. package/dist/{chunk-QNJPDIWY.js → chunk-4L4R6AQJ.js} +1 -1
  87. package/dist/{chunk-QWLPAEG5.js → chunk-4Q5VNQTV.js} +3 -3
  88. package/dist/{chunk-VLSYKMCJ.js → chunk-4RJJ5FJ2.js} +14 -2
  89. package/dist/{chunk-4AN6KMVG.js → chunk-5DPE7B7K.js} +1 -1
  90. package/dist/{chunk-H7ZNSQ2E.js → chunk-62UZWGFX.js} +2 -2
  91. package/dist/{chunk-ZQ2QHGWE.js → chunk-66JPZELX.js} +20 -24
  92. package/dist/{chunk-BUGMW7YF.js → chunk-6LNSZADA.js} +11 -11
  93. package/dist/{chunk-PBCRUNIK.js → chunk-6OD2RVIA.js} +492 -157
  94. package/dist/chunk-7ODTYODO.js +350 -0
  95. package/dist/{chunk-5YL4Y27D.js → chunk-7WDIGRSO.js} +1 -1
  96. package/dist/{chunk-WIL6LXNG.js → chunk-AC6DKMVS.js} +1 -1
  97. package/dist/{chunk-HZEAAKCR.js → chunk-B2J3BBJC.js} +3 -3
  98. package/dist/{chunk-LE7CDIOA.js → chunk-BUOMSIXH.js} +1 -1
  99. package/dist/{chunk-XKGNKH6V.js → chunk-DFUCFLZH.js} +1 -1
  100. package/dist/{chunk-U724Z3S3.js → chunk-DKHBMIVE.js} +100 -37
  101. package/dist/{chunk-MY36XDUK.js → chunk-DNFU56ZS.js} +1 -1
  102. package/dist/{chunk-GSWGOGP5.js → chunk-EOS7VPVT.js} +5 -5
  103. package/dist/{chunk-P33JVGSP.js → chunk-FM7XZDZI.js} +1 -1
  104. package/dist/chunk-G6EJKYK3.js +33 -0
  105. package/dist/{chunk-OMCNFTSI.js → chunk-GMZMBLHT.js} +1 -1
  106. package/dist/{chunk-4LZ54YGA.js → chunk-GSY6HL3T.js} +5 -5
  107. package/dist/{chunk-OVKNFTCL.js → chunk-HED6D5KR.js} +132 -21
  108. package/dist/{chunk-ALH6QLYF.js → chunk-HQODUV3G.js} +2 -2
  109. package/dist/{chunk-US64UR5O.js → chunk-IIHE3FNC.js} +3 -3
  110. package/dist/{chunk-H2ISTRWU.js → chunk-IRIPGGGL.js} +1 -1
  111. package/dist/{chunk-Z3EXECOX.js → chunk-ISILDO7P.js} +1 -1
  112. package/dist/{chunk-6ERZFDBS.js → chunk-IZPO6IOZ.js} +1 -1
  113. package/dist/{chunk-W65Z4SJS.js → chunk-J3QZPDNH.js} +1 -1
  114. package/dist/{chunk-3IJCP6ZH.js → chunk-JDYO76PI.js} +1 -1
  115. package/dist/{chunk-ORNKGGFX.js → chunk-JNARUXDC.js} +1 -1
  116. package/dist/{chunk-VME3UH4D.js → chunk-JV225JBX.js} +1 -1
  117. package/dist/{chunk-EI7PBUIA.js → chunk-JZW5AOWI.js} +1 -1
  118. package/dist/{chunk-TLOILHSL.js → chunk-K7KBAJQL.js} +36 -18
  119. package/dist/{chunk-RHMWSUJB.js → chunk-KAVUTP5G.js} +2 -2
  120. package/dist/{chunk-7FNELLMX.js → chunk-KPVVTHPK.js} +8 -8
  121. package/dist/{chunk-35U72CD2.js → chunk-KSMITUGY.js} +3 -3
  122. package/dist/{chunk-D6UICP3C.js → chunk-LMX7UKGX.js} +81 -3
  123. package/dist/{chunk-7ZWC5HVG.js → chunk-MTIJ2NXY.js} +1 -1
  124. package/dist/{chunk-KVHPBQV4.js → chunk-NCC3F6GM.js} +1 -1
  125. package/dist/{chunk-AYMSIV7X.js → chunk-NIZQ3CIS.js} +1 -1
  126. package/dist/{chunk-LTI2DLHY.js → chunk-OBJXZII2.js} +2 -2
  127. package/dist/{chunk-WHOT5NZ7.js → chunk-OR3TAZL3.js} +14 -2
  128. package/dist/{chunk-RQUHAXMM.js → chunk-PHFPIUWU.js} +2 -0
  129. package/dist/{chunk-N76VTMMF.js → chunk-PMEOSD6S.js} +2 -2
  130. package/dist/{chunk-TCJEFW5V.js → chunk-PPXQE7AS.js} +4 -4
  131. package/dist/{chunk-KHZQVLNZ.js → chunk-QE7UVQDP.js} +46 -0
  132. package/dist/{chunk-SXJACGQ5.js → chunk-QEGXNJGR.js} +4 -4
  133. package/dist/{chunk-W3E4VEEJ.js → chunk-RPBTYQKJ.js} +1 -1
  134. package/dist/chunk-RQ7OVXUZ.js +81 -0
  135. package/dist/{chunk-7L2EV3XX.js → chunk-RVXWGPD3.js} +39 -6
  136. package/dist/{chunk-YNALY3SX.js → chunk-RZJ6DXVE.js} +1 -1
  137. package/dist/{chunk-P3SIFDES.js → chunk-SCYWCWKY.js} +16 -4
  138. package/dist/{chunk-7I43GVER.js → chunk-SOT23KWW.js} +3 -3
  139. package/dist/{chunk-T62GAN7I.js → chunk-SPOXL7HF.js} +7 -7
  140. package/dist/{chunk-3YJMI422.js → chunk-TN2YCFQE.js} +4 -4
  141. package/dist/{chunk-YMSWCERY.js → chunk-U63BZI2B.js} +3 -3
  142. package/dist/{chunk-KA5RK5HZ.js → chunk-V42BSVX6.js} +2 -2
  143. package/dist/{chunk-PJTRAFL4.js → chunk-V4BW5HFQ.js} +3 -3
  144. package/dist/{chunk-4FG6IX7U.js → chunk-VFSYVQX4.js} +1 -1
  145. package/dist/chunk-VQRTO7IS.js +290 -0
  146. package/dist/{chunk-OR7J7TIA.js → chunk-VT6P7FV4.js} +1 -1
  147. package/dist/{chunk-BEIYF4NS.js → chunk-W2J2RF5N.js} +3 -3
  148. package/dist/{chunk-Y5ASPRP7.js → chunk-WBJXJ2R4.js} +17 -13
  149. package/dist/chunk-WCGNCH3Q.js +72 -0
  150. package/dist/{chunk-2LJDLQNO.js → chunk-WJ2PZGRV.js} +1 -1
  151. package/dist/{chunk-AAPPSMPH.js → chunk-WZBUKC5N.js} +1 -1
  152. package/dist/{chunk-RO7EXVSJ.js → chunk-X4AFBL4N.js} +1 -1
  153. package/dist/{chunk-BR74NYEF.js → chunk-XV5HRIXG.js} +5 -5
  154. package/dist/chunk-XXJRZ75E.js +43 -0
  155. package/dist/{chunk-VDHUHXFF.js → chunk-XYG722JW.js} +2 -2
  156. package/dist/{chunk-MM7SWUQ4.js → chunk-YB7U4WTY.js} +4 -4
  157. package/dist/{chunk-RMRZXPUU.js → chunk-Z6H6Y4BS.js} +1 -1
  158. package/dist/{token-budget-UMHRRDBT.js → chunk-ZOVHXTGC.js} +2 -9
  159. package/dist/{chunk-HNLBHP6P.js → chunk-ZZXADKAP.js} +3 -3
  160. package/dist/{co-activation-OKAHEMPE.js → co-activation-WN25AJOC.js} +3 -2
  161. package/dist/{co-occurrence-IHSPB53O.js → co-occurrence-YP2Q3OEA.js} +5 -4
  162. package/dist/{code-context-index-KGY4LKCA.js → code-context-index-ZWONKBKX.js} +4 -4
  163. package/dist/{conversation-entity-extractor-KXJSHRGJ.js → conversation-entity-extractor-KYOBXNID.js} +2 -2
  164. package/dist/{crdt-sync-K2G3C6XY.js → crdt-sync-ZFIFL2QM.js} +1 -1
  165. package/dist/{crm-webhook-ERZSQ3CW.js → crm-webhook-DGPHULOO.js} +2 -2
  166. package/dist/{cto-delegation-gate-ZCJ53LBQ.js → cto-delegation-gate-OF2A3TSS.js} +12 -11
  167. package/dist/daemon-auth-N6P2MZAV.js +17 -0
  168. package/dist/{daemon-orchestration-V6HALVDS.js → daemon-orchestration-G4RRTPP7.js} +16 -15
  169. package/dist/daemon-ready-signal-3L2MJT7C.js +13 -0
  170. package/dist/{db-backup-VZHSFUVA.js → db-backup-EORG4LBO.js} +1 -1
  171. package/dist/{doc-graph-extractor-LQ2IFND2.js → doc-graph-extractor-APZS3DFD.js} +5 -4
  172. package/dist/{dreaming-QAKUASYV.js → dreaming-Q4E3WBGY.js} +13 -12
  173. package/dist/{exe-drift-H3UWNFFY.js → exe-drift-CI5R6GUT.js} +4 -3
  174. package/dist/{exe-export-MN5D4JMT.js → exe-export-HQIQASIT.js} +7 -6
  175. package/dist/{exe-import-IFFMEVD7.js → exe-import-ULZK56WC.js} +7 -6
  176. package/dist/{exe-key-RSZC72QK.js → exe-key-ILNSBGRN.js} +5 -4
  177. package/dist/{exe-snapshot-I622MPLS.js → exe-snapshot-RUZTWZOF.js} +16 -15
  178. package/dist/{factory-CTFAGZUA.js → factory-YHQZ6RZZ.js} +14 -6
  179. package/dist/{fast-db-init-QEFVT7Q3.js → fast-db-init-KNJRL7T3.js} +1 -1
  180. package/dist/{founder-context-3SOKEW76.js → founder-context-QCTMEK66.js} +2 -2
  181. package/dist/gateway/index.js +12 -11
  182. package/dist/{git-staleness-E7RPQA5U.js → git-staleness-KIA5YI4H.js} +3 -2
  183. package/dist/{git-task-sweep-D3A2C5BW.js → git-task-sweep-WH6QE7HL.js} +13 -12
  184. package/dist/{global-procedures-POG4V6IK.js → global-procedures-SYZZCGDS.js} +4 -3
  185. package/dist/{graph-auto-extract-E7KALNWA.js → graph-auto-extract-J2TIWZEE.js} +5 -4
  186. package/dist/{graph-rag-3RZN7JR3.js → graph-rag-HITZZ63L.js} +2 -2
  187. package/dist/hooks/bug-report-worker.js +15 -14
  188. package/dist/hooks/codex-stop-task-finalizer.js +15 -14
  189. package/dist/hooks/commit-complete.js +15 -14
  190. package/dist/hooks/error-recall.js +8 -7
  191. package/dist/hooks/exe-heartbeat-hook.js +4 -3
  192. package/dist/hooks/ingest-worker.js +4 -4
  193. package/dist/hooks/ingest.js +8 -7
  194. package/dist/hooks/instructions-loaded.js +5 -4
  195. package/dist/hooks/manifest.json +20 -20
  196. package/dist/hooks/notification.js +5 -4
  197. package/dist/hooks/post-compact.js +14 -13
  198. package/dist/hooks/post-tool-combined.js +7 -7
  199. package/dist/hooks/pre-compact.js +19 -18
  200. package/dist/hooks/pre-tool-use.js +18 -17
  201. package/dist/hooks/prompt-submit.js +28 -27
  202. package/dist/hooks/session-end.js +24 -23
  203. package/dist/hooks/session-start.js +46 -22
  204. package/dist/hooks/stop.js +22 -21
  205. package/dist/hooks/subagent-stop.js +14 -13
  206. package/dist/hooks/summary-worker.js +22 -21
  207. package/dist/index.js +25 -23
  208. package/dist/{installer-IXUX73JN.js → installer-3NB3IBHF.js} +10 -9
  209. package/dist/{installer-RCUPPZ7Y.js → installer-IIJFCTMH.js} +10 -9
  210. package/dist/{installer-HDD6OH5Z.js → installer-PSDYMGN7.js} +7 -6
  211. package/dist/lib/cloud-sync.js +14 -13
  212. package/dist/lib/consolidation.js +8 -7
  213. package/dist/lib/database.js +3 -2
  214. package/dist/lib/db-daemon-client.js +4 -4
  215. package/dist/lib/db.js +3 -2
  216. package/dist/lib/device-registry.js +3 -1
  217. package/dist/lib/embedder.js +4 -4
  218. package/dist/lib/employee-templates.js +5 -4
  219. package/dist/lib/employees.js +3 -2
  220. package/dist/lib/exe-daemon-client.js +3 -3
  221. package/dist/lib/exe-daemon.js +256 -406
  222. package/dist/lib/hybrid-search.js +6 -5
  223. package/dist/lib/identity.js +3 -2
  224. package/dist/lib/license.js +2 -2
  225. package/dist/lib/messaging.js +13 -12
  226. package/dist/lib/reminders.js +4 -3
  227. package/dist/lib/schedules.js +6 -5
  228. package/dist/lib/session-registry.js +5 -4
  229. package/dist/lib/skill-learning.js +7 -6
  230. package/dist/lib/store.js +7 -4
  231. package/dist/lib/task-router.js +4 -3
  232. package/dist/lib/tasks.js +14 -13
  233. package/dist/lib/tmux-routing.js +16 -11
  234. package/dist/lib/token-spend.js +4 -3
  235. package/dist/{license-gate-V2UCK4KJ.js → license-gate-7SDHCJUO.js} +3 -3
  236. package/dist/mcp/register-tools.js +74 -73
  237. package/dist/mcp/server.js +97 -79
  238. package/dist/mcp/tools/complete-reminder.js +5 -4
  239. package/dist/mcp/tools/create-reminder.js +5 -4
  240. package/dist/mcp/tools/create-task.js +16 -15
  241. package/dist/mcp/tools/deactivate-behavior.js +8 -7
  242. package/dist/mcp/tools/list-reminders.js +5 -4
  243. package/dist/mcp/tools/list-tasks.js +16 -15
  244. package/dist/mcp/tools/send-message.js +15 -14
  245. package/dist/mcp/tools/update-task.js +15 -14
  246. package/dist/{mcp-http-config-7LFFPNGV.js → mcp-http-config-QSOVFXHW.js} +4 -3
  247. package/dist/mcp-tool-surface-CSPFXL3F.js +15 -0
  248. package/dist/{memory-cards-BGI6MJRN.js → memory-cards-II67WFL2.js} +3 -2
  249. package/dist/{memory-graph-extractor-DTRRNWHZ.js → memory-graph-extractor-PM4Q2KJG.js} +6 -5
  250. package/dist/{memory-poisoning-defense-MOCWJK6S.js → memory-poisoning-defense-ECXSX7HK.js} +3 -2
  251. package/dist/{memory-queue-client-DD4E5SIZ.js → memory-queue-client-HLURQEV6.js} +4 -4
  252. package/dist/{memory-reflection-UKKTGZYR.js → memory-reflection-PXF6YFDU.js} +3 -2
  253. package/dist/{notifications-AMJ2K3MM.js → notifications-UP7WQGG4.js} +12 -11
  254. package/dist/{orchestration-events-MB4QVHTD.js → orchestration-events-PZLLPCKY.js} +4 -3
  255. package/dist/orchestration-health-read-EJWVUARG.js +191 -0
  256. package/dist/{orchestrator-M7DJH6TN.js → orchestrator-PUT45J4O.js} +14 -13
  257. package/dist/{pipeline-router-4LT5YG5P.js → pipeline-router-5CRWKESM.js} +4 -3
  258. package/dist/{plan-limits-ENS7OJWP.js → plan-limits-SH2NDFNX.js} +6 -5
  259. package/dist/{project-boot-6W5JPGSB.js → project-boot-2TCPDZ4S.js} +25 -1
  260. package/dist/{projection-worker-WWXZK7QD.js → projection-worker-HWY37MNC.js} +2 -2
  261. package/dist/{prospective-memory-VNGLPMS6.js → prospective-memory-FQSVMCGG.js} +3 -2
  262. package/dist/{reranker-6XBS55FA.js → reranker-AALRMGMM.js} +1 -1
  263. package/dist/{retrieval-health-ATX5TIQ2.js → retrieval-health-PNWJSJNG.js} +1 -1
  264. package/dist/{review-polling-E4ALHTQE.js → review-polling-65JZUE3T.js} +13 -12
  265. package/dist/runtime/index.js +24 -22
  266. package/dist/{session-events-3J6APMKN.js → session-events-EJ3OSAA6.js} +13 -12
  267. package/dist/session-kill-telemetry-3HGM7SNQ.js +63 -0
  268. package/dist/{session-scope-E54VIYTJ.js → session-scope-JGDYAMJO.js} +12 -11
  269. package/dist/{setup-wizard-XV736U5D.js → setup-wizard-44LMFM2C.js} +1 -1
  270. package/dist/shared-rate-limit-store-QZPQEVE2.js +80 -0
  271. package/dist/{skill-refinement-FTURVWFN.js → skill-refinement-DUOO6B7V.js} +3 -2
  272. package/dist/{stack-release-JZVTSBJJ.js → stack-release-XYMKU7NT.js} +53 -4
  273. package/dist/{stack-update-BIK2QHOE.js → stack-update-XHQJRJEP.js} +5 -3
  274. package/dist/{steward-gate-YGU4VXPP.js → steward-gate-6NWRDLX2.js} +4 -3
  275. package/dist/{task-enforcement-GY3VTY6L.js → task-enforcement-UOULTGFB.js} +12 -11
  276. package/dist/{task-scope-PYOK7OQ6.js → task-scope-P5STKYAC.js} +12 -11
  277. package/dist/{tasks-crud-HLJEJ2UU.js → tasks-crud-24HMTULR.js} +12 -11
  278. package/dist/{tasks-notify-NGS3DWUJ.js → tasks-notify-LAIU7UUI.js} +13 -12
  279. package/dist/{tasks-review-BP5V2X34.js → tasks-review-AFJAU2DY.js} +12 -11
  280. package/dist/{telemetry-upload-AXYPFAPS.js → telemetry-upload-DWFGC2XJ.js} +8 -7
  281. package/dist/token-budget-4RFZKWGH.js +16 -0
  282. package/dist/{tool-capability-index-RHPVMMDD.js → tool-capability-index-ZEXBWKUZ.js} +1 -1
  283. package/dist/{tool-telemetry-BLSVABFJ.js → tool-telemetry-BS5JXM5M.js} +1 -1
  284. package/dist/tui/App.js +21 -20
  285. package/dist/{tui-data-EYPOFYLS.js → tui-data-UNO5B7PU.js} +12 -11
  286. package/dist/{worker-gate-SMFOBMMX.js → worker-gate-C6CTTYMD.js} +1 -1
  287. package/dist/{workflow-engine-TDJZ3TXB.js → workflow-engine-4W2KYCDV.js} +2 -2
  288. package/dist/{worktree-XISIYRM4.js → worktree-2CXY6NEB.js} +5 -4
  289. package/dist/{worktree-sweep-AS6GAR6X.js → worktree-sweep-K3CJFSUL.js} +6 -5
  290. package/package.json +9 -4
  291. package/release-notes.json +17 -88
  292. package/stack.release.json +51 -4
  293. package/dist/chunk-PHOQAVTK.js +0 -42
  294. package/dist/daemon-auth-BK7ON5ZH.js +0 -13
  295. package/dist/session-kill-telemetry-KOAHLRBT.js +0 -31
  296. package/dist/{chunk-XDE5IGBX.js → chunk-2NS3QRMJ.js} +0 -0
  297. package/dist/{chunk-JTMKRUX6.js → chunk-A2YZG4AD.js} +0 -0
  298. package/dist/{chunk-UZATXREL.js → chunk-AE74NOE6.js} +0 -0
  299. package/dist/{chunk-LUGWK6QB.js → chunk-FF5DA4XP.js} +3 -3
  300. /package/dist/{chunk-BGOMFGSW.js → chunk-GWPICNSO.js} +0 -0
  301. /package/dist/{chunk-NLHUA3YB.js → chunk-I3DPCSDG.js} +0 -0
  302. /package/dist/{chunk-YM3367VC.js → chunk-J3SR5MGG.js} +0 -0
  303. /package/dist/{chunk-FKFVNV7X.js → chunk-K4BKJJ4F.js} +0 -0
  304. /package/dist/{chunk-PTDBHQX7.js → chunk-MQCTK6EF.js} +0 -0
  305. /package/dist/{chunk-GBV5PV5T.js → chunk-QNXM2HXW.js} +0 -0
  306. /package/dist/{chunk-GZSG2ZOX.js → chunk-YUBTHJVV.js} +0 -0
  307. /package/dist/{core-memory-4OM7LR77.js → core-memory-OC5ITKKV.js} +0 -0
  308. /package/dist/{entity-boost-SFHIRXT5.js → entity-boost-NF3LE6OJ.js} +0 -0
  309. /package/dist/{message-queue-client-QTC3VHJT.js → message-queue-client-4VDU6BZY.js} +0 -0
  310. /package/dist/{oauth-server-BPN55EJM.js → oauth-server-EWUL7DMD.js} +0 -0
  311. /package/dist/{wiki-acl-45SIGG4O.js → wiki-acl-CONNF6ES.js} +0 -0
@@ -1,30 +1,31 @@
1
1
  import {
2
- StewardGate
3
- } from "./chunk-H2ISTRWU.js";
4
- import {
5
- listRecentSessionEvents
6
- } from "./chunk-4FG6IX7U.js";
7
- import {
8
- isRerankerAvailable,
9
- rerankWithScores
10
- } from "./chunk-GBV5PV5T.js";
2
+ exportOrchestration,
3
+ importOrchestration,
4
+ validatePackage
5
+ } from "./chunk-OBJXZII2.js";
11
6
  import {
12
- getToolUsageStats
13
- } from "./chunk-YM3367VC.js";
7
+ runDriftProbes
8
+ } from "./chunk-255DIG4B.js";
14
9
  import {
15
- getToolCapabilityIndex
16
- } from "./chunk-NLHUA3YB.js";
10
+ loadOrchestrationPhase,
11
+ setOrchestrationPhase
12
+ } from "./chunk-DAOHCXM2.js";
17
13
  import {
18
- isToolAllowed,
19
- isToolAllowedForPlan
20
- } from "./chunk-E6ORBQHP.js";
14
+ analyzeBlastRadius,
15
+ buildCodeContextIndex,
16
+ buildCodeContextIndexWithEmbeddings,
17
+ getCodeContextStats,
18
+ searchCodeContext,
19
+ searchCodeContextSemantic,
20
+ traceCodeSymbol
21
+ } from "./chunk-WZBUKC5N.js";
21
22
  import {
22
- AUTO_WAKE_MAX_RETRIES
23
- } from "./chunk-BUGMW7YF.js";
23
+ StewardGate
24
+ } from "./chunk-IRIPGGGL.js";
24
25
  import {
25
- getCachedLicenseGate,
26
- refreshLicenseGate
27
- } from "./chunk-RMRZXPUU.js";
26
+ isRerankerAvailable,
27
+ rerankWithScores
28
+ } from "./chunk-QNXM2HXW.js";
28
29
  import {
29
30
  getEntityByName,
30
31
  getEntityNeighbors,
@@ -34,83 +35,88 @@ import {
34
35
  searchEntities
35
36
  } from "./chunk-CRCB5S7I.js";
36
37
  import {
37
- analyzeBlastRadius,
38
- buildCodeContextIndex,
39
- buildCodeContextIndexWithEmbeddings,
40
- getCodeContextStats,
41
- searchCodeContext,
42
- searchCodeContextSemantic,
43
- traceCodeSymbol
44
- } from "./chunk-AAPPSMPH.js";
38
+ listRecentSessionEvents
39
+ } from "./chunk-VFSYVQX4.js";
45
40
  import {
46
41
  DreamingEngine
47
- } from "./chunk-6X2YNVLB.js";
48
- import {
49
- runDriftProbes
50
- } from "./chunk-74TUYU5A.js";
51
- import {
52
- exportOrchestration,
53
- importOrchestration,
54
- validatePackage
55
- } from "./chunk-LTI2DLHY.js";
42
+ } from "./chunk-4BANMHJ5.js";
56
43
  import {
57
- loadOrchestrationPhase,
58
- setOrchestrationPhase
59
- } from "./chunk-DAOHCXM2.js";
44
+ AUTO_WAKE_MAX_RETRIES
45
+ } from "./chunk-6LNSZADA.js";
60
46
  import {
61
- createOrRefreshResumeTask
62
- } from "./chunk-4LZ54YGA.js";
47
+ getCachedLicenseGate,
48
+ refreshLicenseGate
49
+ } from "./chunk-Z6H6Y4BS.js";
63
50
  import {
64
- registerSendMessage
65
- } from "./chunk-ALH6QLYF.js";
51
+ getToolUsageStats
52
+ } from "./chunk-J3SR5MGG.js";
66
53
  import {
67
- registerCreateTask
68
- } from "./chunk-7FNELLMX.js";
54
+ getToolCapabilityIndex
55
+ } from "./chunk-I3DPCSDG.js";
69
56
  import {
70
- registerListTasks
71
- } from "./chunk-US64UR5O.js";
57
+ isToolAllowed,
58
+ isToolAllowedForPlan
59
+ } from "./chunk-E6ORBQHP.js";
72
60
  import {
73
- registerUpdateTask
74
- } from "./chunk-35U72CD2.js";
61
+ createOrRefreshResumeTask
62
+ } from "./chunk-GSY6HL3T.js";
75
63
  import {
76
64
  registerCreateReminder
77
- } from "./chunk-OR7J7TIA.js";
65
+ } from "./chunk-VT6P7FV4.js";
78
66
  import {
79
67
  registerListReminders
80
- } from "./chunk-W3E4VEEJ.js";
68
+ } from "./chunk-RPBTYQKJ.js";
81
69
  import {
82
70
  registerCompleteReminder
83
- } from "./chunk-W65Z4SJS.js";
71
+ } from "./chunk-J3QZPDNH.js";
72
+ import {
73
+ registerDeactivateBehavior
74
+ } from "./chunk-QEGXNJGR.js";
84
75
  import {
85
76
  completeReminder,
86
77
  createReminder,
87
78
  listReminders
88
- } from "./chunk-ORNKGGFX.js";
79
+ } from "./chunk-JNARUXDC.js";
89
80
  import {
90
- registerDeactivateBehavior
91
- } from "./chunk-SXJACGQ5.js";
81
+ registerSendMessage
82
+ } from "./chunk-HQODUV3G.js";
92
83
  import {
93
- registerImportConversations
94
- } from "./chunk-PJTRAFL4.js";
84
+ registerCreateTask
85
+ } from "./chunk-KPVVTHPK.js";
86
+ import {
87
+ registerListTasks
88
+ } from "./chunk-IIHE3FNC.js";
89
+ import {
90
+ registerUpdateTask
91
+ } from "./chunk-KSMITUGY.js";
95
92
  import {
96
93
  TOKENS_PER_IDLE_MINUTE,
97
94
  countKillsSince,
98
95
  sumTokensSavedSince
99
- } from "./chunk-D6UICP3C.js";
96
+ } from "./chunk-LMX7UKGX.js";
97
+ import {
98
+ registerImportConversations
99
+ } from "./chunk-V4BW5HFQ.js";
100
100
  import {
101
101
  createSchedule,
102
102
  parseHumanCron
103
- } from "./chunk-KA5RK5HZ.js";
103
+ } from "./chunk-V42BSVX6.js";
104
104
  import {
105
105
  status
106
- } from "./chunk-YMSWCERY.js";
106
+ } from "./chunk-U63BZI2B.js";
107
107
  import {
108
108
  getAgentSpend
109
- } from "./chunk-4AN6KMVG.js";
109
+ } from "./chunk-5DPE7B7K.js";
110
110
  import {
111
111
  exportGraphHTML,
112
112
  generateGraphReport
113
113
  } from "./chunk-3OEVDGIY.js";
114
+ import {
115
+ runHealthCheck
116
+ } from "./chunk-2UVN2NBN.js";
117
+ import {
118
+ checkCpuStealSync
119
+ } from "./chunk-SSC7EKY2.js";
114
120
  import {
115
121
  fixBloated,
116
122
  fixDuplicates,
@@ -119,35 +125,32 @@ import {
119
125
  formatReport,
120
126
  runAudit,
121
127
  shouldFixShards
122
- } from "./chunk-LD2JKEJT.js";
128
+ } from "./chunk-2NVEKSSP.js";
123
129
  import {
124
130
  formatDegradations,
125
131
  getRetrievalHealth
126
- } from "./chunk-GZSG2ZOX.js";
127
- import {
128
- runHealthCheck
129
- } from "./chunk-V6P7TPPA.js";
132
+ } from "./chunk-YUBTHJVV.js";
130
133
  import {
131
134
  hasFailures,
132
135
  runHealth,
133
136
  runTest
134
- } from "./chunk-MM7SWUQ4.js";
135
- import {
136
- resolveSupportAdminToken,
137
- supportAdminHeaders
138
- } from "./chunk-2XZ6X3PJ.js";
137
+ } from "./chunk-YB7U4WTY.js";
139
138
  import {
140
139
  isSupportReportSentStatus,
141
140
  markSupportReportSent
142
141
  } from "./chunk-MMRUBN3I.js";
142
+ import {
143
+ resolveSupportAdminToken,
144
+ supportAdminHeaders
145
+ } from "./chunk-2XZ6X3PJ.js";
143
146
  import {
144
147
  renderClientCOOTemplate
145
- } from "./chunk-6ERZFDBS.js";
148
+ } from "./chunk-IZPO6IOZ.js";
146
149
  import {
147
150
  deactivateGlobalProcedure,
148
151
  loadGlobalProcedures,
149
152
  storeGlobalProcedure
150
- } from "./chunk-Z3EXECOX.js";
153
+ } from "./chunk-ISILDO7P.js";
151
154
  import {
152
155
  PLATFORM_PROCEDURES
153
156
  } from "./chunk-VUH67PT4.js";
@@ -156,14 +159,14 @@ import {
156
159
  cloudSync,
157
160
  getCloudReuploadRequired,
158
161
  markCloudReuploadRequired
159
- } from "./chunk-T62GAN7I.js";
162
+ } from "./chunk-SPOXL7HF.js";
160
163
  import {
161
164
  createARecord
162
165
  } from "./chunk-X2Z5GT3V.js";
163
166
  import {
164
167
  findSimilarTrajectories,
165
168
  hashSignature
166
- } from "./chunk-RHMWSUJB.js";
169
+ } from "./chunk-KAVUTP5G.js";
167
170
  import {
168
171
  GHOST_BEHAVIOR_SQL,
169
172
  deactivateBehavior,
@@ -172,20 +175,20 @@ import {
172
175
  reactivateBehavior,
173
176
  storeBehavior,
174
177
  storeReflexBehavior
175
- } from "./chunk-N76VTMMF.js";
178
+ } from "./chunk-PMEOSD6S.js";
176
179
  import {
177
180
  countUnconsolidated,
178
181
  groupMemories,
179
182
  runConsolidation,
180
183
  selectUnconsolidated
181
- } from "./chunk-HZEAAKCR.js";
184
+ } from "./chunk-B2J3BBJC.js";
182
185
  import {
183
186
  entityId,
184
187
  mergeEntities
185
- } from "./chunk-LUGWK6QB.js";
188
+ } from "./chunk-FF5DA4XP.js";
186
189
  import {
187
190
  embed
188
- } from "./chunk-IMJNYREY.js";
191
+ } from "./chunk-43R2GILO.js";
189
192
  import {
190
193
  readMcpHttpEvents,
191
194
  summarizeMcpTransport,
@@ -193,17 +196,20 @@ import {
193
196
  } from "./chunk-5A6KTWQL.js";
194
197
  import {
195
198
  updateTask
196
- } from "./chunk-GSWGOGP5.js";
199
+ } from "./chunk-EOS7VPVT.js";
197
200
  import {
198
201
  fastDbInit
199
- } from "./chunk-KHZQVLNZ.js";
202
+ } from "./chunk-QE7UVQDP.js";
200
203
  import {
201
204
  MAX_CONCURRENT_WORKERS
202
- } from "./chunk-OMCNFTSI.js";
205
+ } from "./chunk-GMZMBLHT.js";
206
+ import {
207
+ readDaemonToken
208
+ } from "./chunk-RQ7OVXUZ.js";
203
209
  import {
204
210
  hybridSearch,
205
211
  recentRecords
206
- } from "./chunk-ZQ2QHGWE.js";
212
+ } from "./chunk-66JPZELX.js";
207
213
  import {
208
214
  buildFtsMatch,
209
215
  tokenizeForFts
@@ -215,10 +221,10 @@ import {
215
221
  reserveVersions,
216
222
  vectorToBlob,
217
223
  writeMemory
218
- } from "./chunk-Y5ASPRP7.js";
224
+ } from "./chunk-WBJXJ2R4.js";
219
225
  import {
220
226
  getActiveAgent
221
- } from "./chunk-LE7CDIOA.js";
227
+ } from "./chunk-BUOMSIXH.js";
222
228
  import {
223
229
  getMySession,
224
230
  resolveExeSession,
@@ -226,13 +232,13 @@ import {
226
232
  sessionScopeFilter,
227
233
  updateTaskStatus,
228
234
  writeCheckpoint
229
- } from "./chunk-OVKNFTCL.js";
235
+ } from "./chunk-HED6D5KR.js";
230
236
  import {
231
237
  listSessions
232
- } from "./chunk-2LJDLQNO.js";
238
+ } from "./chunk-WJ2PZGRV.js";
233
239
  import {
234
240
  recordOrchestrationEventBestEffort
235
- } from "./chunk-WHOT5NZ7.js";
241
+ } from "./chunk-OR3TAZL3.js";
236
242
  import {
237
243
  DEFAULT_MODELS,
238
244
  KNOWN_RUNTIMES,
@@ -249,7 +255,7 @@ import {
249
255
  assertEmployeeLimit,
250
256
  assertFeature,
251
257
  assertMemoryLimit
252
- } from "./chunk-VDHUHXFF.js";
258
+ } from "./chunk-XYG722JW.js";
253
259
  import {
254
260
  getProjectName
255
261
  } from "./chunk-OPU3NYOO.js";
@@ -262,7 +268,7 @@ import {
262
268
  isScheduledTrigger,
263
269
  loadTriggers,
264
270
  sanitizeParam
265
- } from "./chunk-XDE5IGBX.js";
271
+ } from "./chunk-2NS3QRMJ.js";
266
272
  import {
267
273
  pushConversationToCRM
268
274
  } from "./chunk-ONKIWA3R.js";
@@ -283,7 +289,7 @@ import {
283
289
  loadEmployeesSync,
284
290
  saveEmployees,
285
291
  updateIdentity
286
- } from "./chunk-P3SIFDES.js";
292
+ } from "./chunk-SCYWCWKY.js";
287
293
  import {
288
294
  getEventLoopLagMs,
289
295
  isDaemonAlive,
@@ -304,7 +310,7 @@ import {
304
310
  readCachedLicenseToken,
305
311
  saveLicense,
306
312
  validateLicense
307
- } from "./chunk-VME3UH4D.js";
313
+ } from "./chunk-JV225JBX.js";
308
314
  import {
309
315
  EXE_AI_DIR,
310
316
  loadConfig
@@ -488,7 +494,7 @@ function registerRecallMyMemory(server) {
488
494
  }) => {
489
495
  try {
490
496
  if (!isInitialized()) {
491
- const { fastDbInit: fastDbInit2 } = await import("./fast-db-init-QEFVT7Q3.js");
497
+ const { fastDbInit: fastDbInit2 } = await import("./fast-db-init-KNJRL7T3.js");
492
498
  await fastDbInit2();
493
499
  }
494
500
  if (!recent && !query) {
@@ -535,7 +541,7 @@ function registerRecallMyMemory(server) {
535
541
  let federatedCount = 0;
536
542
  if (!recent && query && results.length < FEDERATION_THRESHOLD) {
537
543
  try {
538
- const { searchCodeContextSemantic: searchCodeContextSemantic2 } = await import("./code-context-index-KGY4LKCA.js");
544
+ const { searchCodeContextSemantic: searchCodeContextSemantic2 } = await import("./code-context-index-ZWONKBKX.js");
539
545
  const codeResults = await Promise.race([
540
546
  searchCodeContextSemantic2(query, { limit: 5 }),
541
547
  new Promise((_, rej) => setTimeout(() => rej(new Error("timeout")), 2e3))
@@ -773,7 +779,7 @@ function registerStoreMemory(server) {
773
779
  }
774
780
  const { agentId, agentRole } = getActiveAgent();
775
781
  if (kind === "prospective") {
776
- const { createProspectiveMemory } = await import("./prospective-memory-VNGLPMS6.js");
782
+ const { createProspectiveMemory } = await import("./prospective-memory-FQSVMCGG.js");
777
783
  let sessionScope = null;
778
784
  try {
779
785
  const { resolveExeSession: resolveExeSession2 } = await import("./lib/tmux-routing.js");
@@ -1759,7 +1765,7 @@ async function handleSupersede(input) {
1759
1765
  }
1760
1766
  try {
1761
1767
  const { getClient: getClient2 } = await import("./lib/database.js");
1762
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
1768
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
1763
1769
  const { writeMemory: writeMemory2, flushBatch: flushBatch2 } = await import("./lib/store.js");
1764
1770
  const { randomUUID: randomUUID2 } = await import("crypto");
1765
1771
  const client = getClient2();
@@ -1812,7 +1818,7 @@ New memory id: ${newId}`
1812
1818
  }
1813
1819
  async function handleResonanceQuery(input) {
1814
1820
  try {
1815
- const { getHotPairs, getCoActivationNeighbors } = await import("./co-activation-OKAHEMPE.js");
1821
+ const { getHotPairs, getCoActivationNeighbors } = await import("./co-activation-WN25AJOC.js");
1816
1822
  const subAction = input.resonance_action ?? "hot_pairs";
1817
1823
  const limit = input.limit ?? 20;
1818
1824
  if (subAction === "hot_pairs") {
@@ -1907,7 +1913,7 @@ function registerMemory(server) {
1907
1913
  return handleResonanceQuery(input);
1908
1914
  }
1909
1915
  if (action === "update_working_memory" || action === "get_working_memory") {
1910
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
1916
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
1911
1917
  const { agentId } = getActiveAgent2();
1912
1918
  const { readWorkingMemory, writeWorkingMemory, WORKING_MEMORY_MAX_BYTES } = await import("./working-memory-FXHQCJJE.js");
1913
1919
  if (action === "get_working_memory") {
@@ -1924,9 +1930,9 @@ function registerMemory(server) {
1924
1930
  }
1925
1931
  }
1926
1932
  if (action === "core_get" || action === "core_set" || action === "core_delete") {
1927
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
1933
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
1928
1934
  const { agentId } = getActiveAgent2();
1929
- const { getCoreMemory, setCoreMemory, deleteCoreMemory, formatCoreMemoryBlock } = await import("./core-memory-4OM7LR77.js");
1935
+ const { getCoreMemory, setCoreMemory, deleteCoreMemory, formatCoreMemoryBlock } = await import("./core-memory-OC5ITKKV.js");
1930
1936
  if (action === "core_get") {
1931
1937
  const entries = await getCoreMemory(agentId);
1932
1938
  const block = formatCoreMemoryBlock(entries);
@@ -1978,12 +1984,12 @@ function registerMemory(server) {
1978
1984
  if (!storeTrigger || !storeTriggerAction) {
1979
1985
  return errorResult('memory action "store" with kind="reflex" requires trigger and trigger_action fields');
1980
1986
  }
1981
- const { formatReflexContent, storeReflexBehavior: storeReflexBehavior2 } = await import("./behaviors-JM6KFSXL.js");
1987
+ const { formatReflexContent, storeReflexBehavior: storeReflexBehavior2 } = await import("./behaviors-47CPEKJ7.js");
1982
1988
  const reflexText = formatReflexContent(storeTrigger, storeTriggerAction);
1983
1989
  legacyArgs.text ??= reflexText;
1984
1990
  legacyArgs.query ??= reflexText;
1985
1991
  try {
1986
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
1992
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
1987
1993
  const { getProjectName: getProjectName2 } = await import("./project-name-EWG5KAZP.js");
1988
1994
  const agent = getActiveAgent2();
1989
1995
  const behaviorId = await storeReflexBehavior2({
@@ -2339,7 +2345,7 @@ function registerCloseTask(server) {
2339
2345
  async ({ task_id, result: result3, status: status2 }) => {
2340
2346
  const agent = getActiveAgent();
2341
2347
  try {
2342
- const { StewardGate: StewardGate2 } = await import("./steward-gate-YGU4VXPP.js");
2348
+ const { StewardGate: StewardGate2 } = await import("./steward-gate-6NWRDLX2.js");
2343
2349
  const steward = new StewardGate2();
2344
2350
  const gateDecision = await steward.checkAuthority(agent.agentId || "unknown", "close_task", task_id);
2345
2351
  if (!gateDecision.allowed) {
@@ -2520,8 +2526,8 @@ ${preflightWarnings.join("\n")}`;
2520
2526
  if (mergeNote) text5 += mergeNote;
2521
2527
  if (status2 === "closed" && assignee) {
2522
2528
  try {
2523
- const { cleanupAgentWorktree } = await import("./worktree-sweep-AS6GAR6X.js");
2524
- const { getGitRoot } = await import("./worktree-XISIYRM4.js");
2529
+ const { cleanupAgentWorktree } = await import("./worktree-sweep-K3CJFSUL.js");
2530
+ const { getGitRoot } = await import("./worktree-2CXY6NEB.js");
2525
2531
  const repoRoot = getGitRoot(baseDir);
2526
2532
  if (repoRoot) {
2527
2533
  const cleanupNotes = cleanupAgentWorktree(repoRoot, assignee);
@@ -2570,8 +2576,8 @@ ${preflightWarnings.join("\n")}`;
2570
2576
  } catch {
2571
2577
  }
2572
2578
  try {
2573
- const { cleanupAgentWorktree } = await import("./worktree-sweep-AS6GAR6X.js");
2574
- const { getGitRoot } = await import("./worktree-XISIYRM4.js");
2579
+ const { cleanupAgentWorktree } = await import("./worktree-sweep-K3CJFSUL.js");
2580
+ const { getGitRoot } = await import("./worktree-2CXY6NEB.js");
2575
2581
  const root = getGitRoot(_baseDir);
2576
2582
  if (root) {
2577
2583
  const notes = cleanupAgentWorktree(root, _assignee);
@@ -2673,6 +2679,10 @@ function registerResumeEmployee(server) {
2673
2679
  }
2674
2680
  },
2675
2681
  async ({ agent_id, project_name }) => {
2682
+ if (!isInitialized()) {
2683
+ const { fastDbInit: fastDbInit2 } = await import("./fast-db-init-KNJRL7T3.js");
2684
+ await fastDbInit2();
2685
+ }
2676
2686
  const client = getClient();
2677
2687
  const reScope = sessionScopeFilter();
2678
2688
  const openTasks = await client.execute({
@@ -2696,7 +2706,7 @@ function registerResumeEmployee(server) {
2696
2706
  };
2697
2707
  }
2698
2708
  try {
2699
- const { isTmuxSessionAlive } = await import("./tasks-crud-HLJEJ2UU.js");
2709
+ const { isTmuxSessionAlive } = await import("./tasks-crud-24HMTULR.js");
2700
2710
  const now = (/* @__PURE__ */ new Date()).toISOString();
2701
2711
  for (const row of openTasks.rows) {
2702
2712
  const status2 = String(row.status);
@@ -2724,7 +2734,7 @@ function registerResumeEmployee(server) {
2724
2734
  }
2725
2735
  let checkpointInfo = "";
2726
2736
  try {
2727
- const { readLatestCheckpoint } = await import("./tasks-crud-HLJEJ2UU.js");
2737
+ const { readLatestCheckpoint } = await import("./tasks-crud-24HMTULR.js");
2728
2738
  const checkpoint = await readLatestCheckpoint(agent_id);
2729
2739
  if (checkpoint) {
2730
2740
  const filesTouched = checkpoint.files_touched?.length > 0 ? checkpoint.files_touched.join(", ") : "none";
@@ -3123,7 +3133,7 @@ function registerTask(server) {
3123
3133
  const missing2 = missingRequiredFields2(args, REQUIRED_FIELDS2.create_group);
3124
3134
  if (missing2.length > 0) return errorResult2(`task action "create_group" missing required field(s): ${missing2.join(", ")}`);
3125
3135
  try {
3126
- const { createTaskGroup } = await import("./tasks-crud-HLJEJ2UU.js");
3136
+ const { createTaskGroup } = await import("./tasks-crud-24HMTULR.js");
3127
3137
  const group = await createTaskGroup({
3128
3138
  title: args.title,
3129
3139
  coordinator: args.coordinator,
@@ -3142,7 +3152,7 @@ function registerTask(server) {
3142
3152
  const missing2 = missingRequiredFields2(args, REQUIRED_FIELDS2.group_status);
3143
3153
  if (missing2.length > 0) return errorResult2(`task action "group_status" missing required field(s): ${missing2.join(", ")}`);
3144
3154
  try {
3145
- const { getGroupStatus } = await import("./tasks-crud-HLJEJ2UU.js");
3155
+ const { getGroupStatus } = await import("./tasks-crud-24HMTULR.js");
3146
3156
  const status2 = await getGroupStatus(args.group_id);
3147
3157
  return { content: [{ type: "text", text: JSON.stringify(status2, null, 2) }] };
3148
3158
  } catch (err) {
@@ -3154,7 +3164,7 @@ function registerTask(server) {
3154
3164
  const missing2 = missingRequiredFields2(args, REQUIRED_FIELDS2.group_results);
3155
3165
  if (missing2.length > 0) return errorResult2(`task action "group_results" missing required field(s): ${missing2.join(", ")}`);
3156
3166
  try {
3157
- const { getGroupResults } = await import("./tasks-crud-HLJEJ2UU.js");
3167
+ const { getGroupResults } = await import("./tasks-crud-24HMTULR.js");
3158
3168
  const results = await getGroupResults(args.group_id);
3159
3169
  return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }] };
3160
3170
  } catch (err) {
@@ -3405,7 +3415,7 @@ function registerMessage(server) {
3405
3415
  if (msgType && msgPayload) {
3406
3416
  try {
3407
3417
  const { buildTypedMessage, serializeMessage } = await import("./typed-messages-TKDGVPHS.js");
3408
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
3418
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
3409
3419
  const { sendMessage } = await import("./lib/messaging.js");
3410
3420
  const { agentId } = getActiveAgent2();
3411
3421
  const envelope = buildTypedMessage({
@@ -3439,7 +3449,7 @@ ID: ${msg.id}`
3439
3449
  if (action === "read") {
3440
3450
  try {
3441
3451
  const { getPendingMessages } = await import("./lib/messaging.js");
3442
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
3452
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
3443
3453
  const { agentId } = getActiveAgent2();
3444
3454
  const messages = await getPendingMessages(agentId);
3445
3455
  if (messages.length === 0) {
@@ -3970,7 +3980,7 @@ async function ingestDocument(input) {
3970
3980
  await client.batch([documentStmt, ...chunkStmts], "write");
3971
3981
  const embedded = vectors.filter((v) => v !== null).length;
3972
3982
  const originalTexts = input.chunks.map((c) => c.text);
3973
- import("./doc-graph-extractor-LQ2IFND2.js").then(
3983
+ import("./doc-graph-extractor-APZS3DFD.js").then(
3974
3984
  ({ extractAndStoreDocumentGraph }) => extractAndStoreDocumentGraph(documentId, originalTexts)
3975
3985
  ).catch((err) => {
3976
3986
  process.stderr.write(
@@ -4063,8 +4073,8 @@ function registerIngestDocument(server) {
4063
4073
  },
4064
4074
  async (input) => {
4065
4075
  try {
4066
- const { assertFeature: assertFeature2 } = await import("./plan-limits-ENS7OJWP.js");
4067
- const { assertMemoryLimit: assertMemoryLimit2 } = await import("./plan-limits-ENS7OJWP.js");
4076
+ const { assertFeature: assertFeature2 } = await import("./plan-limits-SH2NDFNX.js");
4077
+ const { assertMemoryLimit: assertMemoryLimit2 } = await import("./plan-limits-SH2NDFNX.js");
4068
4078
  await assertFeature2("wiki");
4069
4079
  await assertMemoryLimit2();
4070
4080
  const result3 = await ingestDocument(input);
@@ -4135,8 +4145,8 @@ function registerPurgeDocument(server) {
4135
4145
  },
4136
4146
  async ({ document_id }) => {
4137
4147
  try {
4138
- const { StewardGate: StewardGate2 } = await import("./steward-gate-YGU4VXPP.js");
4139
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
4148
+ const { StewardGate: StewardGate2 } = await import("./steward-gate-6NWRDLX2.js");
4149
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
4140
4150
  const steward = new StewardGate2();
4141
4151
  const agent = getActiveAgent2();
4142
4152
  const gateDecision = await steward.checkAuthority(agent.agentId || "unknown", "purge_document", document_id);
@@ -5285,7 +5295,7 @@ async function handleStatus() {
5285
5295
  detail: wikiUrl ? `API at ${wikiUrl}` : "EXE_WIKI_API_URL not set"
5286
5296
  };
5287
5297
  try {
5288
- await import("./graph-rag-3RZN7JR3.js");
5298
+ await import("./graph-rag-HITZZ63L.js");
5289
5299
  sinks.entity_extraction = { configured: true, detail: "GraphRAG available" };
5290
5300
  } catch {
5291
5301
  sinks.entity_extraction = { configured: false, detail: "graph-rag module unavailable" };
@@ -5312,7 +5322,7 @@ async function handleTrigger(limit) {
5312
5322
  if (rows.rows.length === 0) {
5313
5323
  return text3("No conversations found to re-process.");
5314
5324
  }
5315
- const { ingest } = await import("./pipeline-router-4LT5YG5P.js");
5325
+ const { ingest } = await import("./pipeline-router-5CRWKESM.js");
5316
5326
  const results = [];
5317
5327
  for (const row of rows.rows) {
5318
5328
  const r = row;
@@ -5943,8 +5953,8 @@ function registerMergeEntities(server) {
5943
5953
  },
5944
5954
  async ({ source_name, source_type, target_name, target_type }) => {
5945
5955
  try {
5946
- const { StewardGate: StewardGate2 } = await import("./steward-gate-YGU4VXPP.js");
5947
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
5956
+ const { StewardGate: StewardGate2 } = await import("./steward-gate-6NWRDLX2.js");
5957
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
5948
5958
  const steward = new StewardGate2();
5949
5959
  const agent = getActiveAgent2();
5950
5960
  const gateDecision = await steward.checkAuthority(agent.agentId || "unknown", "merge_entities", `${source_name}\u2192${target_name}`);
@@ -6142,7 +6152,7 @@ async function handleExtractFromDocument(args) {
6142
6152
  return errorResult7('graph action "extract_from_document" requires document_id');
6143
6153
  }
6144
6154
  try {
6145
- const { extractGraphFromExistingDocument } = await import("./doc-graph-extractor-LQ2IFND2.js");
6155
+ const { extractGraphFromExistingDocument } = await import("./doc-graph-extractor-APZS3DFD.js");
6146
6156
  const result3 = await extractGraphFromExistingDocument(documentId);
6147
6157
  const lines = [
6148
6158
  `## Graph Extraction for Document ${documentId}`,
@@ -6668,6 +6678,14 @@ function registerGetDaemonHealth(server) {
6668
6678
  const elLag = Math.round(getEventLoopLagMs());
6669
6679
  const elDegraded = isEventLoopDegraded();
6670
6680
  lines.push(`| Event loop lag | ${elLag}ms${elDegraded ? " **DEGRADED** (>5000ms)" : ""} |`);
6681
+ const cpuSteal = checkCpuStealSync(100);
6682
+ if (cpuSteal.available) {
6683
+ const pct = Math.round(cpuSteal.stealPercent ?? 0);
6684
+ const icon = cpuSteal.severity === "critical" ? "\u{1F534}" : cpuSteal.severity === "warning" ? "\u{1F7E0}" : "\u{1F7E2}";
6685
+ lines.push(`| CPU steal | ${icon} ${pct}% (${cpuSteal.severity}) |`);
6686
+ } else {
6687
+ lines.push(`| CPU steal | n/a (${cpuSteal.message.slice(0, 60)}) |`);
6688
+ }
6671
6689
  try {
6672
6690
  const { getQueryCacheStats } = await import("./self-query-router-S3NVLRQH.js");
6673
6691
  const cache = getQueryCacheStats();
@@ -6915,7 +6933,7 @@ async function getAgentSessionLoad() {
6915
6933
  return { sessions: [], totalLive: 0, busySessions: 0, idleSessions: 0 };
6916
6934
  }
6917
6935
  const { getClient: getClient2 } = await import("./lib/database.js");
6918
- const { sessionScopeFilter: sessionScopeFilter2 } = await import("./task-scope-PYOK7OQ6.js");
6936
+ const { sessionScopeFilter: sessionScopeFilter2 } = await import("./task-scope-P5STKYAC.js");
6919
6937
  const client = getClient2();
6920
6938
  const scope = sessionScopeFilter2();
6921
6939
  for (const s of liveAgentSessions) {
@@ -7042,7 +7060,7 @@ ${mode} Applying repairs...
7042
7060
  `];
7043
7061
  if (!isDryRun) {
7044
7062
  try {
7045
- const { createBackup: createBackup2 } = await import("./db-backup-VZHSFUVA.js");
7063
+ const { createBackup: createBackup2 } = await import("./db-backup-EORG4LBO.js");
7046
7064
  const backupPath = await createBackup2("pre-fix");
7047
7065
  if (backupPath) {
7048
7066
  fixLog.push(` Backup created: ${backupPath.split("/").pop()}`);
@@ -7281,7 +7299,7 @@ async function cloudStatusText() {
7281
7299
  if (lastReuploadedAt) lines.push(`- Last re-upload: ${lastReuploadedAt}`);
7282
7300
  lines.push("");
7283
7301
  try {
7284
- const { getRetrievalHealth: getRetrievalHealth2, formatDegradations: formatDegradations2 } = await import("./retrieval-health-ATX5TIQ2.js");
7302
+ const { getRetrievalHealth: getRetrievalHealth2, formatDegradations: formatDegradations2 } = await import("./retrieval-health-PNWJSJNG.js");
7285
7303
  const h = await getRetrievalHealth2();
7286
7304
  lines.push(formatDegradations2(h.degradations, "Health / Degradations"));
7287
7305
  lines.push("");
@@ -8609,7 +8627,7 @@ function registerCreateTrigger(server) {
8609
8627
  }
8610
8628
  },
8611
8629
  async ({ name, event, conditions, actions, project, enabled, schedule, query }) => {
8612
- const { assertFeature: assertFeature2 } = await import("./plan-limits-ENS7OJWP.js");
8630
+ const { assertFeature: assertFeature2 } = await import("./plan-limits-SH2NDFNX.js");
8613
8631
  const gatedActions = {
8614
8632
  send_whatsapp: "external_agents",
8615
8633
  update_wiki: "wiki"
@@ -9526,7 +9544,9 @@ var ACTION_TO_TOOL2 = {
9526
9544
  capability_cards: null,
9527
9545
  // Session admin (handled inline, feature 2e55cbe4)
9528
9546
  session_deregister: null,
9529
- session_cleanup: null
9547
+ session_cleanup: null,
9548
+ // Restart telemetry (handled inline, feature 3caa55e9)
9549
+ restart_telemetry: null
9530
9550
  };
9531
9551
  function errorResult8(text5) {
9532
9552
  return { content: [{ type: "text", text: text5 }], isError: true };
@@ -9573,8 +9593,8 @@ function buildHandlers5() {
9573
9593
  }
9574
9594
  async function handleDreaming(action, args) {
9575
9595
  try {
9576
- const { DreamingEngine: DreamingEngine2 } = await import("./dreaming-QAKUASYV.js");
9577
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
9596
+ const { DreamingEngine: DreamingEngine2 } = await import("./dreaming-Q4E3WBGY.js");
9597
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
9578
9598
  const { getClient: getClient2 } = await import("./lib/database.js");
9579
9599
  const agentId = args.agent_id ?? getActiveAgent2().agentId;
9580
9600
  if (action === "dreaming_run") {
@@ -9658,7 +9678,7 @@ function registerConfig(server) {
9658
9678
  title: "Config",
9659
9679
  description: "Consolidated COO/admin tool for runtime config, system health, licensing, triggers, orchestration import/export, company procedures, identity management, session inspection, dreaming self-improvement, and session closeout.",
9660
9680
  inputSchema: {
9661
- action: z75.enum(Object.keys(ACTION_TO_TOOL2)).describe("Admin/config operation. identity_get/identity_update manage agent identity files. session_events/session_last_response inspect session logs. dreaming_run/dreaming_status/dreaming_history manage the self-improvement loop. closeout runs dreaming + commits a structured session summary to memory. capability_cards returns A2A-style JSON manifests for all agents \u2014 domains, tools, delegation/review authority."),
9681
+ action: z75.enum(Object.keys(ACTION_TO_TOOL2)).describe("Admin/config operation. identity_get/identity_update manage agent identity files. session_events/session_last_response inspect session logs. dreaming_run/dreaming_status/dreaming_history manage the self-improvement loop. closeout runs dreaming + commits a structured session summary to memory. capability_cards returns A2A-style JSON manifests for all agents. restart_telemetry shows why the daemon restarted \u2014 cause breakdown, slowest timers, event-loop blocks."),
9662
9682
  agent_id: z75.string().optional().describe("Agent id for set_agent_config/agent_spend/session queries/hire"),
9663
9683
  role: z75.string().optional().describe("Role template for action=hire: coo, cto, cmo, gm, principal-engineer, content-specialist, ai-specialist, staff-code-reviewer"),
9664
9684
  runtime: z75.string().optional().describe("Runtime for set_agent_config"),
@@ -9702,7 +9722,7 @@ function registerConfig(server) {
9702
9722
  // Session params (absorbed from session tool)
9703
9723
  session_id: z75.string().optional().describe("Session ID for action=session_events"),
9704
9724
  // Dreaming params (absorbed from dreaming tool)
9705
- hours: z75.coerce.number().min(1).max(720).optional().describe("Lookback window in hours for action=dreaming_run. Default 24.")
9725
+ hours: z75.coerce.number().min(1).max(720).optional().describe("Lookback window in hours for action=dreaming_run/restart_telemetry. Default 24.")
9706
9726
  }
9707
9727
  }, async (input, extra) => {
9708
9728
  const action = input.action;
@@ -9730,8 +9750,8 @@ function registerConfig(server) {
9730
9750
  }
9731
9751
  if (action === "closeout") {
9732
9752
  try {
9733
- const { DreamingEngine: DreamingEngine2 } = await import("./dreaming-QAKUASYV.js");
9734
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
9753
+ const { DreamingEngine: DreamingEngine2 } = await import("./dreaming-Q4E3WBGY.js");
9754
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
9735
9755
  const { writeMemory: writeMemory2, flushBatch: flushBatch2 } = await import("./lib/store.js");
9736
9756
  const { randomUUID: randomUUID2 } = await import("crypto");
9737
9757
  const { getProjectName: getProjectName2 } = await import("./project-name-EWG5KAZP.js");
@@ -9802,7 +9822,7 @@ function registerConfig(server) {
9802
9822
  }
9803
9823
  if (action === "capability_cards") {
9804
9824
  try {
9805
- const { getAllCapabilityCards, findAgentForTask } = await import("./capability-cards-BCTFKT4G.js");
9825
+ const { getAllCapabilityCards, findAgentForTask } = await import("./capability-cards-WQVY7WSS.js");
9806
9826
  const cards = getAllCapabilityCards();
9807
9827
  const taskQuery = args.query;
9808
9828
  if (taskQuery) {
@@ -9853,7 +9873,7 @@ function registerConfig(server) {
9853
9873
  const existing = loadEmployeesSync2();
9854
9874
  if (existing.some((e) => e.name === employeeName)) return errorResult8(`Employee "${employeeName}" already exists.`);
9855
9875
  try {
9856
- const { assertEmployeeLimit: assertEmployeeLimit2 } = await import("./plan-limits-ENS7OJWP.js");
9876
+ const { assertEmployeeLimit: assertEmployeeLimit2 } = await import("./plan-limits-SH2NDFNX.js");
9857
9877
  await assertEmployeeLimit2();
9858
9878
  } catch (e) {
9859
9879
  return errorResult8(e instanceof Error ? e.message : "Employee limit reached.");
@@ -9894,7 +9914,7 @@ You are ${employeeName}. Role: ${role}.`, "utf-8");
9894
9914
  }
9895
9915
  try {
9896
9916
  const { generateSessionWrappers } = await import("./lib/session-wrappers.js");
9897
- const { resolvePackageRoot } = await import("./installer-HDD6OH5Z.js");
9917
+ const { resolvePackageRoot } = await import("./installer-PSDYMGN7.js");
9898
9918
  generateSessionWrappers(resolvePackageRoot());
9899
9919
  } catch {
9900
9920
  }
@@ -9905,6 +9925,28 @@ You are ${employeeName}. Role: ${role}.`, "utf-8");
9905
9925
  return errorResult8(`Hire failed: ${e instanceof Error ? e.message : String(e)}`);
9906
9926
  }
9907
9927
  }
9928
+ if (action === "restart_telemetry") {
9929
+ try {
9930
+ const { buildRestartReport, formatRestartReport } = await import("./daemon-restart-report-F3P5AQS4.js");
9931
+ const report = buildRestartReport();
9932
+ const humanReadable = formatRestartReport(report);
9933
+ return {
9934
+ content: [{
9935
+ type: "text",
9936
+ text: [
9937
+ humanReadable,
9938
+ "",
9939
+ "## Structured Data (JSON)",
9940
+ "```json",
9941
+ JSON.stringify(report, null, 2),
9942
+ "```"
9943
+ ].join("\n")
9944
+ }]
9945
+ };
9946
+ } catch (err) {
9947
+ return errorResult8(`Restart telemetry failed: ${err instanceof Error ? err.message : String(err)}`);
9948
+ }
9949
+ }
9908
9950
  if (action === "session_deregister") {
9909
9951
  const sessionName = args.name?.trim();
9910
9952
  if (!sessionName) return errorResult8('config action "session_deregister" requires name (session name)');
@@ -9959,7 +10001,7 @@ function registerListWikiPages(server) {
9959
10001
  }
9960
10002
  },
9961
10003
  async ({ workspace, folder }) => {
9962
- const { assertFeature: assertFeature2 } = await import("./plan-limits-ENS7OJWP.js");
10004
+ const { assertFeature: assertFeature2 } = await import("./plan-limits-SH2NDFNX.js");
9963
10005
  await assertFeature2("wiki");
9964
10006
  const apiUrl = process.env.EXE_WIKI_API_URL;
9965
10007
  const apiKey = process.env.EXE_WIKI_API_KEY;
@@ -10059,7 +10101,7 @@ function registerGetWikiPage(server) {
10059
10101
  }
10060
10102
  },
10061
10103
  async ({ workspace, document_id, title }) => {
10062
- const { assertFeature: assertFeature2 } = await import("./plan-limits-ENS7OJWP.js");
10104
+ const { assertFeature: assertFeature2 } = await import("./plan-limits-SH2NDFNX.js");
10063
10105
  await assertFeature2("wiki");
10064
10106
  const apiUrl = process.env.EXE_WIKI_API_URL;
10065
10107
  const apiKey = process.env.EXE_WIKI_API_KEY;
@@ -10253,10 +10295,10 @@ async function handleWikiSearch(input) {
10253
10295
  const userId = input.user_id;
10254
10296
  if (!workspace) return errorResult9('wiki action "search" requires workspace');
10255
10297
  if (!query) return errorResult9('wiki action "search" requires query');
10256
- const { assertFeature: assertFeature2 } = await import("./plan-limits-ENS7OJWP.js");
10298
+ const { assertFeature: assertFeature2 } = await import("./plan-limits-SH2NDFNX.js");
10257
10299
  await assertFeature2("wiki");
10258
10300
  if (userId) {
10259
- const { checkWikiAccess } = await import("./wiki-acl-45SIGG4O.js");
10301
+ const { checkWikiAccess } = await import("./wiki-acl-CONNF6ES.js");
10260
10302
  const { allowed } = await checkWikiAccess(String(userId), String(workspace), "read");
10261
10303
  if (!allowed) {
10262
10304
  return errorResult9(`Access denied: user "${userId}" does not have read access to workspace "${workspace}"`);
@@ -10359,7 +10401,7 @@ function registerWiki(server) {
10359
10401
  return errorResult9('wiki action "document_rerank" requires at least one candidate');
10360
10402
  }
10361
10403
  if (user_id && legacyArgs.workspace) {
10362
- const { checkWikiAccess } = await import("./wiki-acl-45SIGG4O.js");
10404
+ const { checkWikiAccess } = await import("./wiki-acl-CONNF6ES.js");
10363
10405
  const { allowed } = await checkWikiAccess(
10364
10406
  String(user_id),
10365
10407
  String(legacyArgs.workspace),
@@ -10674,7 +10716,7 @@ Use /exe-forget to remove any that this supersedes.`;
10674
10716
  }]
10675
10717
  };
10676
10718
  }
10677
- const { bulkPurgeGhostBehaviors } = await import("./behaviors-JM6KFSXL.js");
10719
+ const { bulkPurgeGhostBehaviors } = await import("./behaviors-47CPEKJ7.js");
10678
10720
  const res = await bulkPurgeGhostBehaviors({ batchSize: 5e3, vacuum: true });
10679
10721
  return {
10680
10722
  content: [{
@@ -10785,7 +10827,7 @@ Use /exe-forget to remove any that this supersedes.`;
10785
10827
  return { content: [{ type: "text", text: `Behavior not found: ${behavior_id}` }], isError: true };
10786
10828
  }
10787
10829
  const row2 = result4.rows[0];
10788
- const { reactivateBehavior: reactivateBehavior2 } = await import("./behaviors-JM6KFSXL.js");
10830
+ const { reactivateBehavior: reactivateBehavior2 } = await import("./behaviors-47CPEKJ7.js");
10789
10831
  const wasReactivated = await reactivateBehavior2(behavior_id);
10790
10832
  if (!wasReactivated) {
10791
10833
  return { content: [{ type: "text", text: `Behavior ${behavior_id} is already active.` }] };
@@ -11306,7 +11348,7 @@ function registerWorkflowTool(server) {
11306
11348
  getWorkflowInstance,
11307
11349
  listWorkflowInstances,
11308
11350
  approveWorkflowStep
11309
- } = await import("./workflow-engine-TDJZ3TXB.js");
11351
+ } = await import("./workflow-engine-4W2KYCDV.js");
11310
11352
  try {
11311
11353
  switch (input.action) {
11312
11354
  case "create_workflow": {
@@ -11590,7 +11632,7 @@ function registerCreateBugReport(server) {
11590
11632
  const version = package_version ?? "unknown";
11591
11633
  let metricsSnapshot = "";
11592
11634
  try {
11593
- const { getOrchestrationMetrics, formatOrchestrationMetrics } = await import("./orchestration-events-MB4QVHTD.js");
11635
+ const { getOrchestrationMetrics, formatOrchestrationMetrics } = await import("./orchestration-events-PZLLPCKY.js");
11594
11636
  const sinceIso = new Date(Date.now() - 60 * 60 * 1e3).toISOString();
11595
11637
  const metrics = await getOrchestrationMetrics({ sinceIso });
11596
11638
  if (metrics.totalEvents > 0) {
@@ -12848,7 +12890,7 @@ function registerCliParityTools(server) {
12848
12890
  const out = await runCommand("exe-os", ["cloud", "status"], 45e3);
12849
12891
  let healthSection = "";
12850
12892
  try {
12851
- const { getRetrievalHealth: getRetrievalHealth2, formatDegradations: formatDegradations2 } = await import("./retrieval-health-ATX5TIQ2.js");
12893
+ const { getRetrievalHealth: getRetrievalHealth2, formatDegradations: formatDegradations2 } = await import("./retrieval-health-PNWJSJNG.js");
12852
12894
  const h = await getRetrievalHealth2();
12853
12895
  const lines = [
12854
12896
  "",
@@ -12916,7 +12958,7 @@ function registerCodeContext(server) {
12916
12958
  const index = buildCodeContextIndex(opts);
12917
12959
  let graphExtract;
12918
12960
  try {
12919
- const { autoExtractGraphEntities } = await import("./graph-auto-extract-E7KALNWA.js");
12961
+ const { autoExtractGraphEntities } = await import("./graph-auto-extract-J2TIWZEE.js");
12920
12962
  graphExtract = await autoExtractGraphEntities(opts.projectRoot);
12921
12963
  } catch {
12922
12964
  }
@@ -13755,12 +13797,12 @@ function buildHandlers9() {
13755
13797
  function registerDiagnostics(server) {
13756
13798
  const handlers = buildHandlers9();
13757
13799
  const toolNames = Array.from(handlers.keys());
13758
- toolNames.push("tool_search", "drift", "merge_agent_memories", "agent_liveness", "steward_check", "steward_audit_log", "steward_override", "daemon_restarts");
13800
+ toolNames.push("tool_search", "drift", "merge_agent_memories", "agent_liveness", "steward_check", "steward_audit_log", "steward_override", "daemon_restarts", "spawn_failures", "orchestration_health", "work_map");
13759
13801
  server.registerTool(
13760
13802
  "diagnostics",
13761
13803
  {
13762
13804
  title: "Diagnostics",
13763
- description: `System diagnostics and admin operations. Actions: ${toolNames.join(", ")}. Covers health checks, update status, cloud status, key management, employee rename, semantic tool discovery (tool_search), identity drift detection (drift), agent liveness monitoring (agent_liveness), agent memory reassignment (merge_agent_memories), steward identity gate (steward_check, steward_audit_log, steward_override), and daemon restart forensics (daemon_restarts \u2014 'why did the daemon restart?': restart-cause breakdown, slowest-timer leaderboard, event-loop-block frequency).`,
13805
+ description: `System diagnostics and admin operations. Actions: ${toolNames.join(", ")}. Covers health checks, update status, cloud status, key management, employee rename, semantic tool discovery (tool_search), identity drift detection (drift), agent liveness monitoring (agent_liveness), agent memory reassignment (merge_agent_memories), steward identity gate (steward_check, steward_audit_log, steward_override), daemon restart forensics (daemon_restarts \u2014 'why did the daemon restart?': restart-cause breakdown, slowest-timer leaderboard, event-loop-block frequency), and orchestration-health visibility: spawn_failures ('why did dispatch fail?': tmux spawn fail count + cause breakdown path_not_found/claude_launch_failed/timeout + success-vs-fail ratio), orchestration_health ('is the box healthy / is the spiral happening?': load/core, event-loop lag, direct-SQLite-fallback count, event-loop blocks), and work_map ('who's doing what / who died and why?': live sessions \xD7 role \xD7 task \xD7 worktree flag, plus recent session deaths with cause/load + worktree violations).`,
13764
13806
  inputSchema: {
13765
13807
  action: z98.string().describe(`Diagnostic operation: ${toolNames.join(", ")}`),
13766
13808
  // Pass-through params used by various sub-tools
@@ -13809,6 +13851,15 @@ function registerDiagnostics(server) {
13809
13851
  return { content: [{ type: "text", text: `daemon_restarts failed: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
13810
13852
  }
13811
13853
  }
13854
+ if (action === "spawn_failures") {
13855
+ return handleSpawnFailures();
13856
+ }
13857
+ if (action === "orchestration_health") {
13858
+ return handleOrchestrationHealth();
13859
+ }
13860
+ if (action === "work_map") {
13861
+ return handleWorkMap();
13862
+ }
13812
13863
  if (action === "tool_search") {
13813
13864
  return handleToolSearch(input);
13814
13865
  }
@@ -13930,6 +13981,177 @@ async function handleMergeAgentMemories(input) {
13930
13981
  };
13931
13982
  }
13932
13983
  }
13984
+ async function handleSpawnFailures() {
13985
+ try {
13986
+ const { getOrchestrationMetrics } = await import("./orchestration-events-PZLLPCKY.js");
13987
+ const metrics = await getOrchestrationMetrics();
13988
+ const c = metrics.counts;
13989
+ const attempted = c.tmuxSpawnAttempted;
13990
+ const completed = c.tmuxSpawnCompleted;
13991
+ const failed = c.tmuxSpawnFailed;
13992
+ const succeeded = Math.max(0, completed - failed);
13993
+ const failRate = completed > 0 ? failed / completed : 0;
13994
+ const lines = [];
13995
+ lines.push("");
13996
+ lines.push("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
13997
+ lines.push("\u2551 Why Did Dispatch Fail? \u2551");
13998
+ lines.push("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
13999
+ lines.push("");
14000
+ lines.push(`Window: ${metrics.sinceIso ?? "beginning"} \u2192 ${metrics.generatedAt}`);
14001
+ lines.push("");
14002
+ const indicator = failed === 0 ? "\u{1F7E2}" : failRate >= 0.5 ? "\u{1F534}" : "\u{1F7E0}";
14003
+ lines.push("Spawn outcomes");
14004
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14005
+ lines.push(` attempted: ${attempted}`);
14006
+ lines.push(` completed: ${completed}`);
14007
+ lines.push(` succeeded: ${succeeded}`);
14008
+ lines.push(`${indicator} FAILED: ${failed}${completed > 0 ? ` (${Math.round(failRate * 100)}% of completed)` : ""}`);
14009
+ lines.push("");
14010
+ lines.push("Failure causes");
14011
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14012
+ const causeEntries = Object.entries(c.spawnFailureByCause).sort((a, b) => b[1] - a[1]);
14013
+ if (causeEntries.length === 0) {
14014
+ lines.push("\u{1F7E2} No spawn failures recorded.");
14015
+ } else {
14016
+ for (const [cause, n] of causeEntries) {
14017
+ const ci = cause === "path_not_found" ? "\u{1F534}" : cause === "claude_launch_failed" ? "\u{1F534}" : "\u{1F7E0}";
14018
+ lines.push(`${ci} ${String(n).padStart(4)}x ${cause}`);
14019
+ }
14020
+ if (c.spawnFailureByCause.path_not_found) {
14021
+ lines.push("");
14022
+ lines.push(" \u26A0\uFE0F path_not_found \u21D2 the daemon's PATH likely excludes the");
14023
+ lines.push(" nvm bin dir where exe-launch-agent / claude live (bug bbf7824c).");
14024
+ }
14025
+ }
14026
+ lines.push("");
14027
+ return { content: [{ type: "text", text: lines.join("\n") }] };
14028
+ } catch (err) {
14029
+ return { content: [{ type: "text", text: `spawn_failures failed: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
14030
+ }
14031
+ }
14032
+ async function handleOrchestrationHealth() {
14033
+ try {
14034
+ const { buildOrchestrationHealthSnapshot } = await import("./orchestration-health-read-EJWVUARG.js");
14035
+ const s = buildOrchestrationHealthSnapshot();
14036
+ const ms = (n) => {
14037
+ if (n == null) return "\u2014";
14038
+ return n >= 1e3 ? `${(n / 1e3).toFixed(1)}s` : `${Math.round(n)}ms`;
14039
+ };
14040
+ const shortIso = (iso) => iso ? iso.replace("T", " ").slice(0, 16) : "\u2014";
14041
+ const lines = [];
14042
+ lines.push("");
14043
+ lines.push("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
14044
+ lines.push("\u2551 Orchestration Health \u2551");
14045
+ lines.push("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
14046
+ lines.push("");
14047
+ const li = s.load.starved ? "\u{1F534}" : s.load.loadRatio >= 0.6 ? "\u{1F7E0}" : "\u{1F7E2}";
14048
+ lines.push("CPU load");
14049
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14050
+ lines.push(`${li} load1=${s.load.load1.toFixed(2)} on ${s.load.cpus} cores \u21D2 load/core=${s.load.loadRatio.toFixed(2)}${s.load.starved ? " (STARVED \u2014 \u22650.8)" : ""}`);
14051
+ lines.push(` load5=${s.load.load5.toFixed(2)} load15=${s.load.load15.toFixed(2)}`);
14052
+ lines.push("");
14053
+ const lag = s.eventLoopLag;
14054
+ const lagI = lag.latestMs == null ? "\u{1F7E2}" : lag.latestMs >= 1e3 ? "\u{1F534}" : lag.latestMs >= 200 ? "\u{1F7E0}" : "\u{1F7E2}";
14055
+ lines.push("Event-loop lag");
14056
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14057
+ if (lag.samples === 0) {
14058
+ lines.push("\u{1F7E2} No event_loop_lag samples logged.");
14059
+ } else {
14060
+ lines.push(`${lagI} latest=${ms(lag.latestMs)} max=${ms(lag.maxMs)} (n=${lag.samples}, last ${shortIso(lag.lastSeen)})`);
14061
+ }
14062
+ lines.push(` event-loop blocks: ${s.eventLoopBlocks.count}${s.eventLoopBlocks.count > 0 ? ` (last ${shortIso(s.eventLoopBlocks.lastSeen)})` : ""}`);
14063
+ lines.push("");
14064
+ const fb = s.directSqliteFallbacks;
14065
+ const fbI = fb.count === 0 ? "\u{1F7E2}" : "\u{1F534}";
14066
+ lines.push("Direct-SQLite fallback (spiral alarm)");
14067
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14068
+ lines.push(`${fbI} ${fb.count} direct-DB open(s)${fb.count > 0 ? ` \u2014 last ${shortIso(fb.lastSeen)}` : ""}`);
14069
+ if (fb.count > 0) {
14070
+ const byHook = Object.entries(fb.byHook).sort((a, b) => b[1] - a[1]).map(([h, n]) => `${h}=${n}`).join(" ");
14071
+ if (byHook) lines.push(` by hook: ${byHook}`);
14072
+ lines.push(" \u26A0\uFE0F Non-zero \u21D2 hooks are opening the 1.5GB DB directly because the");
14073
+ lines.push(" daemon looked down (hardening 02 CPU-starvation feedback spiral).");
14074
+ }
14075
+ lines.push("");
14076
+ if (!s.logsFound) {
14077
+ lines.push("\u{1F7E2} No daemon-health.log found (fresh install / daemon never ran).");
14078
+ lines.push("");
14079
+ }
14080
+ return { content: [{ type: "text", text: lines.join("\n") }] };
14081
+ } catch (err) {
14082
+ return { content: [{ type: "text", text: `orchestration_health failed: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
14083
+ }
14084
+ }
14085
+ async function handleWorkMap() {
14086
+ try {
14087
+ const { getAgentLivenessReport } = await import("./agent-heartbeat-I5UPGXAU.js");
14088
+ const { classifyRole } = await import("./session-kill-telemetry-3HGM7SNQ.js");
14089
+ const { buildSessionDeathSummary } = await import("./orchestration-health-read-EJWVUARG.js");
14090
+ const { getPaneCwd } = await import("./lib/tmux-status.js");
14091
+ const live = getAgentLivenessReport();
14092
+ const deaths = buildSessionDeathSummary({ recentLimit: 15 });
14093
+ const isWorktree = (cwd) => cwd.includes("/.worktrees/") || cwd.includes("/.claude/worktrees/");
14094
+ const shortIso = (iso) => iso ? iso.replace("T", " ").slice(0, 16) : "\u2014";
14095
+ const lines = [];
14096
+ lines.push("");
14097
+ lines.push("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
14098
+ lines.push("\u2551 Work Map \u2014 Who's Doing What \u2551");
14099
+ lines.push("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
14100
+ lines.push("");
14101
+ lines.push("Live sessions");
14102
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14103
+ if (live.length === 0) {
14104
+ lines.push(" No agent heartbeats recorded yet.");
14105
+ } else {
14106
+ let liveViolations = 0;
14107
+ for (const r of live.sort((a, b) => a.sessionName.localeCompare(b.sessionName))) {
14108
+ const role = classifyRole(r.sessionName, r.agentId);
14109
+ const statusIcon = r.status === "alive" ? "\u{1F7E2}" : r.status === "stale" ? "\u{1F7E0}" : "\u{1F534}";
14110
+ const task = r.meta?.taskId ? r.meta.taskId.slice(0, 8) : "\u2014";
14111
+ const age = r.ageSeconds != null ? `${r.ageSeconds}s` : "never";
14112
+ let cwdFlag = "";
14113
+ if (role === "worker" && r.status !== "dead") {
14114
+ const cwd = getPaneCwd(r.sessionName);
14115
+ if (cwd) {
14116
+ const ok = isWorktree(cwd);
14117
+ if (!ok) liveViolations++;
14118
+ cwdFlag = ok ? " cwd:\u{1F7E2}worktree" : " cwd:\u{1F534}MAIN-CHECKOUT";
14119
+ } else {
14120
+ cwdFlag = " cwd:?";
14121
+ }
14122
+ }
14123
+ lines.push(`${statusIcon} ${role.padEnd(11)} ${r.sessionName.padEnd(16)} task:${task.padEnd(9)} ${age.padStart(6)} ago${cwdFlag}`);
14124
+ }
14125
+ if (liveViolations > 0) {
14126
+ lines.push("");
14127
+ lines.push(`\u{1F534} ${liveViolations} code-role session(s) running in the MAIN checkout, not a worktree (hardening 03).`);
14128
+ }
14129
+ }
14130
+ lines.push("");
14131
+ lines.push("Recent session deaths");
14132
+ lines.push("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
14133
+ if (!deaths.logFound || deaths.total === 0) {
14134
+ lines.push("\u{1F7E2} No session deaths recorded.");
14135
+ } else {
14136
+ const di = deaths.coordinatorStarvationDeaths > 0 ? "\u{1F534}" : deaths.starvationDeaths > 0 ? "\u{1F7E0}" : "\u{1F7E2}";
14137
+ lines.push(`${di} ${deaths.total} death(s) total. By cause: ${Object.entries(deaths.byCause).map(([k, n]) => `${k}=${n}`).join(" ")}`);
14138
+ if (deaths.coordinatorStarvationDeaths > 0) {
14139
+ lines.push(` \u{1F534} ${deaths.coordinatorStarvationDeaths} COORDINATOR death(s) under CPU starvation \u2014 highest-signal failure.`);
14140
+ }
14141
+ lines.push("");
14142
+ for (const d of deaths.recent) {
14143
+ const causeIcon = d.cause === "cpu_starvation" ? "\u{1F534}" : d.cause === "daemon_loss" ? "\u{1F534}" : "\u{1F7E0}";
14144
+ const loadStr = d.loadRatio != null ? ` load/core=${d.loadRatio.toFixed(2)}` : "";
14145
+ const roleStr = d.role ?? "?";
14146
+ lines.push(`${causeIcon} ${shortIso(d.timestamp)} ${roleStr.padEnd(11)} ${d.session.padEnd(16)} cause:${d.cause}${loadStr}`);
14147
+ }
14148
+ }
14149
+ lines.push("");
14150
+ return { content: [{ type: "text", text: lines.join("\n") }] };
14151
+ } catch (err) {
14152
+ return { content: [{ type: "text", text: `work_map failed: ${err instanceof Error ? err.message : String(err)}` }], isError: true };
14153
+ }
14154
+ }
13933
14155
  async function handleToolSearch(input) {
13934
14156
  const query = input.query ?? "";
13935
14157
  const limit = input.limit ?? 20;
@@ -13998,7 +14220,7 @@ async function handleDrift(input) {
13998
14220
  }
13999
14221
  async function handleSteward(action, input) {
14000
14222
  const gate = new StewardGate();
14001
- const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-GGQAP4QE.js");
14223
+ const { getActiveAgent: getActiveAgent2 } = await import("./active-agent-S5T2YMOR.js");
14002
14224
  const inputAgent = input.agent_id;
14003
14225
  const operation = input.operation;
14004
14226
  const target = input.target;
@@ -14296,7 +14518,7 @@ function registerResonance(server) {
14296
14518
  }
14297
14519
  }, async ({ action, memory_id, entity_id, limit }) => {
14298
14520
  try {
14299
- const { getHotPairs, getCoActivationNeighbors } = await import("./co-activation-OKAHEMPE.js");
14521
+ const { getHotPairs, getCoActivationNeighbors } = await import("./co-activation-WN25AJOC.js");
14300
14522
  if (action === "hot_pairs") {
14301
14523
  const pairs = await getHotPairs(limit ?? 20);
14302
14524
  if (pairs.length === 0) return text4("No co-activation data yet. Pairs are recorded as memories are accessed together in searches.");
@@ -14317,6 +14539,7 @@ function registerResonance(server) {
14317
14539
  }
14318
14540
 
14319
14541
  // src/mcp/rate-limiter.ts
14542
+ import { request as httpRequest } from "http";
14320
14543
  function resolveDefaultMaxCalls() {
14321
14544
  const raw = process.env.EXE_MCP_MAX_CALLS_PER_MINUTE;
14322
14545
  if (raw) {
@@ -14331,6 +14554,90 @@ var MAX_WINDOW_KEYS = 5e3;
14331
14554
  var windows = /* @__PURE__ */ new Map();
14332
14555
  var lastSweep = 0;
14333
14556
  var SWEEP_INTERVAL_MS = WINDOW_MS;
14557
+ function sharedGateEnabled() {
14558
+ const v = process.env.EXE_MCP_SHARED_RATE_LIMIT;
14559
+ return v === "1" || v === "true";
14560
+ }
14561
+ function resolveSharedMaxCalls() {
14562
+ const raw = process.env.EXE_MCP_SHARED_MAX_CALLS_PER_MINUTE;
14563
+ if (raw) {
14564
+ const parsed = Number.parseInt(raw, 10);
14565
+ if (Number.isFinite(parsed) && parsed > 0) return parsed;
14566
+ }
14567
+ return DEFAULT_MAX_CALLS_PER_MINUTE;
14568
+ }
14569
+ var SHARED_REQUEST_TIMEOUT_MS = 1500;
14570
+ var sharedCountCache = /* @__PURE__ */ new Map();
14571
+ var MAX_SHARED_CACHE_KEYS = MAX_WINDOW_KEYS;
14572
+ function resolveDaemonPort() {
14573
+ const raw = process.env.EXE_MCP_PORT;
14574
+ if (raw) {
14575
+ const parsed = Number.parseInt(raw, 10);
14576
+ if (Number.isFinite(parsed) && parsed > 0 && parsed < 65536) return parsed;
14577
+ }
14578
+ return 48739;
14579
+ }
14580
+ function fireSharedIncrement(toolName, agentId, sharedMax) {
14581
+ const token = process.env.EXE_DAEMON_TOKEN ?? readDaemonToken();
14582
+ if (!token) return;
14583
+ const key = `${agentId}::${toolName}`;
14584
+ const payload = JSON.stringify({ tool: toolName, agent: agentId, limit: sharedMax });
14585
+ let settled = false;
14586
+ const finish = () => {
14587
+ settled = true;
14588
+ };
14589
+ try {
14590
+ const req = httpRequest(
14591
+ {
14592
+ host: "127.0.0.1",
14593
+ port: resolveDaemonPort(),
14594
+ path: "/v1/ratelimit",
14595
+ method: "POST",
14596
+ headers: {
14597
+ "Content-Type": "application/json",
14598
+ "Content-Length": Buffer.byteLength(payload),
14599
+ Authorization: `Bearer ${token}`
14600
+ },
14601
+ timeout: SHARED_REQUEST_TIMEOUT_MS
14602
+ },
14603
+ (res) => {
14604
+ if (res.statusCode !== 200) {
14605
+ res.resume();
14606
+ finish();
14607
+ return;
14608
+ }
14609
+ const chunks = [];
14610
+ res.on("data", (c) => chunks.push(c));
14611
+ res.on("end", () => {
14612
+ finish();
14613
+ try {
14614
+ const body = JSON.parse(Buffer.concat(chunks).toString("utf-8"));
14615
+ if (typeof body.count === "number" && Number.isFinite(body.count)) {
14616
+ if (sharedCountCache.size > MAX_SHARED_CACHE_KEYS) sharedCountCache.clear();
14617
+ sharedCountCache.set(key, body.count);
14618
+ }
14619
+ } catch {
14620
+ }
14621
+ });
14622
+ res.on("error", finish);
14623
+ }
14624
+ );
14625
+ req.on("timeout", () => {
14626
+ if (!settled) req.destroy();
14627
+ });
14628
+ req.on("error", () => {
14629
+ });
14630
+ req.end(payload);
14631
+ } catch {
14632
+ }
14633
+ }
14634
+ function sharedGateExceeded(toolName, agentId) {
14635
+ const sharedMax = resolveSharedMaxCalls();
14636
+ const key = `${agentId}::${toolName}`;
14637
+ const cached = sharedCountCache.get(key) ?? 0;
14638
+ fireSharedIncrement(toolName, agentId, sharedMax);
14639
+ return cached + 1 > sharedMax;
14640
+ }
14334
14641
  var McpRateLimitError = class extends Error {
14335
14642
  constructor(toolName, limit) {
14336
14643
  super(
@@ -14381,6 +14688,9 @@ function checkRateLimit(toolName, agentId = "unknown", maxCalls = DEFAULT_MAX_CA
14381
14688
  windows.delete(key);
14382
14689
  throw new McpRateLimitError(toolName, maxCalls);
14383
14690
  }
14691
+ if (sharedGateEnabled() && sharedGateExceeded(toolName, agentId)) {
14692
+ throw new McpRateLimitError(toolName, resolveSharedMaxCalls());
14693
+ }
14384
14694
  timestamps.push(now);
14385
14695
  windows.set(key, timestamps);
14386
14696
  return;
@@ -14388,18 +14698,34 @@ function checkRateLimit(toolName, agentId = "unknown", maxCalls = DEFAULT_MAX_CA
14388
14698
  if (timestamps.length >= maxCalls) {
14389
14699
  throw new McpRateLimitError(toolName, maxCalls);
14390
14700
  }
14701
+ if (sharedGateEnabled() && sharedGateExceeded(toolName, agentId)) {
14702
+ throw new McpRateLimitError(toolName, resolveSharedMaxCalls());
14703
+ }
14391
14704
  timestamps.push(now);
14392
14705
  }
14393
14706
  var mcpRateLimiter = {
14394
14707
  check: checkRateLimit,
14395
- /** Reset all windows — useful for tests. */
14708
+ /** Reset all windows (per-process AND shared cache) — useful for tests. */
14396
14709
  reset() {
14397
14710
  windows.clear();
14398
14711
  lastSweep = 0;
14712
+ sharedCountCache.clear();
14399
14713
  },
14400
14714
  /** Current number of retained window keys — for tests/diagnostics. */
14401
14715
  windowKeyCount() {
14402
14716
  return windows.size;
14717
+ },
14718
+ /**
14719
+ * Seed the process-local shared-count cache directly. Test-only: lets a test
14720
+ * simulate "the daemon reported the fleet-wide count is N" without standing up
14721
+ * a real daemon, so the eventually-consistent enforcement path is exercisable.
14722
+ */
14723
+ _setSharedCacheForTest(agentId, toolName, count) {
14724
+ sharedCountCache.set(`${agentId}::${toolName}`, count);
14725
+ },
14726
+ /** Read the cached shared count — diagnostics/tests. */
14727
+ _getSharedCacheForTest(agentId, toolName) {
14728
+ return sharedCountCache.get(`${agentId}::${toolName}`) ?? 0;
14403
14729
  }
14404
14730
  };
14405
14731
 
@@ -14435,7 +14761,16 @@ function registerAllTools(server, license, hasKey) {
14435
14761
  if (!isToolAllowed(name)) return;
14436
14762
  if (hasKey === false && !ALWAYS_ALLOWED.has(name)) return;
14437
14763
  if (license && !isToolAllowedForPlan(name, license.plan)) return;
14438
- fn(server);
14764
+ try {
14765
+ fn(server);
14766
+ } catch (err) {
14767
+ const msg = err instanceof Error ? `${err.message}
14768
+ ${err.stack ?? ""}` : String(err);
14769
+ process.stderr.write(
14770
+ `[register-tools] ERROR: tool registration "${name}" threw and was SKIPPED \u2014 this tool will be UNAVAILABLE for this daemon lifetime: ${msg}
14771
+ `
14772
+ );
14773
+ }
14439
14774
  };
14440
14775
  const mcpToolSurface = process.env.EXE_MCP_TOOL_SURFACE ?? "consolidated";
14441
14776
  const exposeConsolidatedTasks = mcpToolSurface === "both" || mcpToolSurface === "consolidated";