@askexenow/exe-os 0.9.322 → 0.9.324

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 (319) hide show
  1. package/deploy/compose/.env.customer.example +1 -1
  2. package/deploy/compose/.env.example +18 -1
  3. package/deploy/compose/PROTECTED_FILES.md +4 -1
  4. package/deploy/compose/add-routes.sh +22 -0
  5. package/deploy/compose/cloudflared/config.yml.example +6 -3
  6. package/deploy/compose/docker-compose.yml +36 -1
  7. package/deploy/compose/generate-env.ts +40 -2
  8. package/deploy/compose/sso-edge/default.conf.template +11 -0
  9. package/deploy/compose/sso-edge/sso-redirect.conf +90 -21
  10. package/deploy/stack-manifests/v0.9.json +110 -2
  11. package/dist/{active-agent-M5NJFEBM.js → active-agent-CVSB2EER.js} +3 -3
  12. package/dist/{active-agent-SHM4QSRJ.js → active-agent-IUVRZOSF.js} +3 -3
  13. package/dist/{agentic-ontology-HQKCU7LG.js → agentic-ontology-2QFPBIQP.js} +1 -1
  14. package/dist/backfill-gate-J7UXFNXU.js +19 -0
  15. package/dist/{backfill-metadata-CXWFCTBO.js → backfill-metadata-W3PRQPVV.js} +4 -4
  16. package/dist/{behaviors-J47D342W.js → behaviors-MQCADHAD.js} +5 -5
  17. package/dist/bin/agentic-ontology-backfill.js +5 -5
  18. package/dist/bin/agentic-reflection-backfill.js +6 -6
  19. package/dist/bin/agentic-semantic-label.js +5 -5
  20. package/dist/bin/backfill-conversations.js +11 -11
  21. package/dist/bin/backfill-responses.js +11 -11
  22. package/dist/bin/backfill-vectors.js +102 -22
  23. package/dist/bin/bulk-sync-postgres.js +14 -14
  24. package/dist/bin/cc-doctor.js +5 -5
  25. package/dist/bin/cleanup-stale-review-tasks.js +20 -13
  26. package/dist/bin/cli.js +28 -31
  27. package/dist/bin/customer-readiness.js +1 -0
  28. package/dist/bin/deferred-daemon-restart.js +80 -77
  29. package/dist/bin/exe-agent-config.js +3 -3
  30. package/dist/bin/exe-agent.js +5 -5
  31. package/dist/bin/exe-assign.js +10 -10
  32. package/dist/bin/exe-boot.js +32 -23
  33. package/dist/bin/exe-call.js +5 -5
  34. package/dist/bin/exe-cloud.js +120 -47
  35. package/dist/bin/exe-config-dump.js +3 -3
  36. package/dist/bin/exe-dispatch.js +48 -14
  37. package/dist/bin/exe-doctor.js +4 -4
  38. package/dist/bin/exe-export-behaviors.js +7 -7
  39. package/dist/bin/exe-forget.js +6 -6
  40. package/dist/bin/exe-gateway.js +8 -8
  41. package/dist/bin/exe-healthcheck.js +17 -8
  42. package/dist/bin/exe-heartbeat.js +20 -13
  43. package/dist/bin/exe-kill.js +23 -16
  44. package/dist/bin/exe-launch-agent.js +30 -27
  45. package/dist/bin/exe-new-employee.js +9 -9
  46. package/dist/bin/exe-pending-messages.js +21 -14
  47. package/dist/bin/exe-pending-notifications.js +20 -13
  48. package/dist/bin/exe-pending-reviews.js +20 -13
  49. package/dist/bin/exe-rename.js +5 -5
  50. package/dist/bin/exe-review.js +22 -15
  51. package/dist/bin/exe-search.js +8 -13
  52. package/dist/bin/exe-session-cleanup.js +39 -22
  53. package/dist/bin/exe-settings.js +15 -15
  54. package/dist/bin/exe-start-codex.js +51 -34
  55. package/dist/bin/exe-start-opencode.js +8 -8
  56. package/dist/bin/exe-status.js +21 -14
  57. package/dist/bin/exe-support.js +3 -3
  58. package/dist/bin/exe-team.js +3 -3
  59. package/dist/bin/exe-watchdog.js +278 -39
  60. package/dist/bin/git-sweep.js +21 -14
  61. package/dist/bin/graph-backfill.js +4 -4
  62. package/dist/bin/graph-export.js +5 -5
  63. package/dist/bin/import-history.js +7 -7
  64. package/dist/bin/install-launchd.js +2 -2
  65. package/dist/bin/install.js +121 -88
  66. package/dist/bin/intercom-check.js +4 -4
  67. package/dist/bin/mcp-sessions.js +2 -2
  68. package/dist/bin/orchestration-metrics.js +4 -4
  69. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  70. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  71. package/dist/bin/pre-publish.js +1 -1
  72. package/dist/bin/registry-proxy.js +1 -1
  73. package/dist/bin/scan-tasks.js +20 -13
  74. package/dist/bin/setup.js +1 -1
  75. package/dist/bin/shard-migrate.js +4 -4
  76. package/dist/bin/stack-update.js +4 -4
  77. package/dist/bin/vps-health-gate.js +1 -1
  78. package/dist/{capability-cards-H7H3MU74.js → capability-cards-STD3NMCR.js} +2 -2
  79. package/dist/{capacity-monitor-WAEHVBL7.js → capacity-monitor-6O3PWYNM.js} +21 -14
  80. package/dist/{catchup-brief-L42STIDR.js → catchup-brief-EDQ3VZCF.js} +23 -16
  81. package/dist/{chunk-HKSJSW2V.js → chunk-2E2NKFXK.js} +1 -1
  82. package/dist/{chunk-NYFPFOYM.js → chunk-2NY7LZT7.js} +1 -1
  83. package/dist/{chunk-DGFIXJ4S.js → chunk-2QD5M47V.js} +3 -3
  84. package/dist/{chunk-3M73L663.js → chunk-2YWUZPHE.js} +2 -2
  85. package/dist/{chunk-LB77CSLO.js → chunk-2ZW4AQ24.js} +3 -3
  86. package/dist/{chunk-E32KARET.js → chunk-376J36IW.js} +4 -4
  87. package/dist/{chunk-CWQAXO3O.js → chunk-5RACW3LX.js} +28 -3
  88. package/dist/{chunk-VSXGFHJY.js → chunk-5VT45EV6.js} +1 -1
  89. package/dist/{chunk-X62GD6QW.js → chunk-5YCOEPEX.js} +2 -2
  90. package/dist/{chunk-TKBWBHFV.js → chunk-6FWMLTF2.js} +1 -1
  91. package/dist/chunk-6IWLAQ7O.js +40 -0
  92. package/dist/{chunk-WFHYAKEU.js → chunk-6XAAJ5OV.js} +1 -1
  93. package/dist/{chunk-4Z47UMMM.js → chunk-7M6TXYRQ.js} +23 -23
  94. package/dist/{chunk-HWC5W34K.js → chunk-7PLMYXPG.js} +1 -1
  95. package/dist/{chunk-DDKDN4HV.js → chunk-A47MXY2I.js} +7 -0
  96. package/dist/{chunk-SQ5JWDJ2.js → chunk-AEFZEJKW.js} +1 -1
  97. package/dist/{chunk-657AQEPY.js → chunk-AVKZIG4A.js} +1 -1
  98. package/dist/{chunk-EPBB2OD3.js → chunk-BB5IKY7B.js} +2 -2
  99. package/dist/{chunk-3JW3ZXCP.js → chunk-BC7IIR3A.js} +65 -39
  100. package/dist/{chunk-WSYKLS2Y.js → chunk-BDJQWBWF.js} +3 -3
  101. package/dist/{chunk-VY7345RO.js → chunk-BMSAJ2IH.js} +1 -1
  102. package/dist/{chunk-OI63OVCR.js → chunk-C7B44DJI.js} +1 -1
  103. package/dist/{chunk-GA76RGSP.js → chunk-CS6MYGNB.js} +5 -5
  104. package/dist/{chunk-6N4LYEDI.js → chunk-CSPHV5DJ.js} +1 -1
  105. package/dist/{chunk-HGM6NZQH.js → chunk-DYUISOIT.js} +1 -1
  106. package/dist/{signal-paths-4GOIRLGH.js → chunk-EIKATSE4.js} +3 -4
  107. package/dist/{chunk-G5TP2D2U.js → chunk-EWDTTTZP.js} +3 -3
  108. package/dist/{chunk-TI6YX3L5.js → chunk-F2RK5YWB.js} +36 -27
  109. package/dist/{chunk-HV5CUDOE.js → chunk-F6TJIWN5.js} +1 -1
  110. package/dist/{chunk-WCCR5IFR.js → chunk-FPTBCPI3.js} +2 -2
  111. package/dist/{chunk-QVFJCFNM.js → chunk-FROUDYRT.js} +33 -2
  112. package/dist/{chunk-T6AUMO5X.js → chunk-GIFDGNIL.js} +1 -1
  113. package/dist/{chunk-OFR7KQ37.js → chunk-HAYDXMW6.js} +3 -3
  114. package/dist/{chunk-V2ESQU3S.js → chunk-HBKYKN3S.js} +3 -3
  115. package/dist/{chunk-LCZ55G5G.js → chunk-HZ5J2GFE.js} +136 -66
  116. package/dist/{chunk-EOPSIIEH.js → chunk-ID3V4BWS.js} +1 -1
  117. package/dist/{chunk-ABGDTMKC.js → chunk-JRD7ARQ6.js} +60 -2
  118. package/dist/{chunk-7FBPLVHM.js → chunk-KADUJ7PE.js} +3 -3
  119. package/dist/{chunk-KLG53B63.js → chunk-KJOQLNX2.js} +1 -1
  120. package/dist/{chunk-AZL3EUR3.js → chunk-KK67DSCO.js} +229 -29
  121. package/dist/{chunk-H2SD2EA7.js → chunk-KLDQFOFY.js} +23 -9
  122. package/dist/chunk-KPIN44GZ.js +67 -0
  123. package/dist/{chunk-PLBDXCYZ.js → chunk-KUJGADX6.js} +1491 -606
  124. package/dist/{chunk-GN3IWZDH.js → chunk-KWWHRJGG.js} +660 -539
  125. package/dist/{chunk-ERSFOJGC.js → chunk-LUOQCGBO.js} +20 -11
  126. package/dist/{chunk-CXXERHNC.js → chunk-LWAGAC3H.js} +1 -1
  127. package/dist/{chunk-7BZ6TOZN.js → chunk-MB2YT5VQ.js} +3 -3
  128. package/dist/{chunk-KXP3CUTL.js → chunk-MCEXBLLK.js} +3 -3
  129. package/dist/{chunk-A3KUGBDP.js → chunk-MIWPKWXQ.js} +1 -1
  130. package/dist/{chunk-7CUF27OT.js → chunk-MKIFYIXC.js} +1 -1
  131. package/dist/{chunk-ONKIWA3R.js → chunk-ML4S5SHZ.js} +3 -1
  132. package/dist/{chunk-BFHBHQFA.js → chunk-MWIX3YKA.js} +5 -5
  133. package/dist/{chunk-6UQRJCKK.js → chunk-NBDTQVWU.js} +2 -2
  134. package/dist/{chunk-KK4ZOYXJ.js → chunk-NGACCR2M.js} +80 -40
  135. package/dist/{chunk-CMDC5D7S.js → chunk-NLEW62VC.js} +6 -0
  136. package/dist/{chunk-QYLDCPNG.js → chunk-PGFYWVOB.js} +1 -1
  137. package/dist/{chunk-XEBN5CPD.js → chunk-PGUISLOT.js} +3 -3
  138. package/dist/{chunk-MYMA23KC.js → chunk-PJTEZLAM.js} +1 -1
  139. package/dist/{chunk-QNUHDEPI.js → chunk-POOMY3CS.js} +4 -4
  140. package/dist/{chunk-2GBGIXKH.js → chunk-PV7IG4V6.js} +1 -1
  141. package/dist/{chunk-SENJA7BZ.js → chunk-QDI77B3E.js} +54 -7
  142. package/dist/{chunk-XLNF3CIO.js → chunk-QGOMYIVT.js} +119 -24
  143. package/dist/{chunk-HIOO7DZ2.js → chunk-QQFZ32WS.js} +5 -5
  144. package/dist/{chunk-KL5WYWS3.js → chunk-SOXUF34Y.js} +2 -2
  145. package/dist/{chunk-6XM6PZXQ.js → chunk-SPO2RLOB.js} +1 -1
  146. package/dist/{chunk-ROMB2HH4.js → chunk-T3XHH5FE.js} +6 -6
  147. package/dist/{chunk-6SXJZHRJ.js → chunk-TA3A4UQL.js} +1 -1
  148. package/dist/{chunk-XP53WEXP.js → chunk-TGVKQ3QB.js} +3 -3
  149. package/dist/{chunk-XC7C3GQ2.js → chunk-TNS6U2K7.js} +30 -19
  150. package/dist/{chunk-JXEMAB4M.js → chunk-UAIMI7CK.js} +1 -1
  151. package/dist/{chunk-YIFZZYQD.js → chunk-UBYAKNRF.js} +2 -2
  152. package/dist/{chunk-6IBUQBMY.js → chunk-UXYQLOFW.js} +198 -39
  153. package/dist/{chunk-C4BIZXKB.js → chunk-UYOW7U24.js} +1 -1
  154. package/dist/{chunk-NFM6VHL7.js → chunk-V4VYIHSL.js} +1 -1
  155. package/dist/{chunk-QQOH3I4A.js → chunk-VDUHWQFA.js} +1 -1
  156. package/dist/{chunk-EVUXF2G4.js → chunk-W5GBB23I.js} +1 -1
  157. package/dist/{chunk-FANIBYUO.js → chunk-WF3J6GJZ.js} +2 -2
  158. package/dist/{chunk-NAHAOFTY.js → chunk-WGHTISNK.js} +3 -3
  159. package/dist/{chunk-F5FAD2YR.js → chunk-WGOAILWE.js} +2 -2
  160. package/dist/{chunk-LOE2N23P.js → chunk-WJICX53Z.js} +1 -1
  161. package/dist/{skill-refinement-YLIAY7V4.js → chunk-Y2KBHLEO.js} +3 -11
  162. package/dist/{chunk-PISGLNV7.js → chunk-Y34FDPOY.js} +5 -5
  163. package/dist/{chunk-ORC5AO7E.js → chunk-YBHOWK3L.js} +2 -2
  164. package/dist/{chunk-7SDS5VCL.js → chunk-ZDNJ3TSB.js} +7 -7
  165. package/dist/{chunk-CHSRSESS.js → chunk-ZRZ2Z6RZ.js} +1 -1
  166. package/dist/{cleanup-graph-garbage-MX5JDTJA.js → cleanup-graph-garbage-2YH52ADR.js} +4 -4
  167. package/dist/{co-activation-K44LGZ7A.js → co-activation-7F3J2GC7.js} +2 -2
  168. package/dist/{co-occurrence-N62HJTRP.js → co-occurrence-B36Q5GY3.js} +2 -2
  169. package/dist/{code-context-index-6YQ3DGCN.js → code-context-index-2PUBBQOE.js} +3 -3
  170. package/dist/{crdt-sync-BO76VVRX.js → crdt-sync-MXHPR6V6.js} +1 -1
  171. package/dist/{crm-bridge-BVTB6LZK.js → crm-bridge-CZLEW2LW.js} +1 -1
  172. package/dist/{crm-webhook-UZLTHXAS.js → crm-webhook-56MWGMRY.js} +2 -2
  173. package/dist/{cto-delegation-gate-NVMRONA2.js → cto-delegation-gate-26BD7NEE.js} +19 -12
  174. package/dist/{daemon-orchestration-JI3RD5EZ.js → daemon-orchestration-IBP6PWEG.js} +31 -16
  175. package/dist/{db-backup-ITRADB2J.js → db-backup-XLID57KW.js} +1 -1
  176. package/dist/{doc-graph-extractor-L7YESUSI.js → doc-graph-extractor-VBZ6XTTE.js} +2 -2
  177. package/dist/{documents-7BFXA6V3.js → documents-C5LYSJT3.js} +10 -10
  178. package/dist/{dreaming-NRTMPNPZ.js → dreaming-LMVDIC5C.js} +20 -13
  179. package/dist/{exe-drift-GLJIM7EI.js → exe-drift-T3K6WA47.js} +3 -3
  180. package/dist/{exe-export-THIAYHXK.js → exe-export-QCTASWXI.js} +7 -7
  181. package/dist/{exe-import-3Y4VOUYL.js → exe-import-WNP5A7VA.js} +7 -7
  182. package/dist/{exe-key-IPGY4RMU.js → exe-key-JM3JXE2E.js} +78 -75
  183. package/dist/{exe-snapshot-2ZEWCDYK.js → exe-snapshot-ODDJUEM5.js} +23 -16
  184. package/dist/{fast-db-init-TLYUWCDE.js → fast-db-init-O6A3TK3F.js} +1 -1
  185. package/dist/{founder-context-J362DNU4.js → founder-context-FYTF4IMD.js} +2 -2
  186. package/dist/gateway/index.js +9 -9
  187. package/dist/{git-staleness-BRDHTHNS.js → git-staleness-YA5J6VYJ.js} +2 -2
  188. package/dist/{global-procedures-FNUKY2LF.js → global-procedures-76NDWTYN.js} +4 -4
  189. package/dist/{graph-auto-extract-AJZUV3PO.js → graph-auto-extract-I7QL2TY5.js} +2 -2
  190. package/dist/hooks/bug-report-worker.js +22 -15
  191. package/dist/hooks/codex-stop-task-finalizer.js +22 -15
  192. package/dist/hooks/commit-complete.js +22 -15
  193. package/dist/hooks/error-recall.js +6 -6
  194. package/dist/hooks/exe-heartbeat-hook.js +3 -3
  195. package/dist/hooks/ingest-worker.js +6 -6
  196. package/dist/hooks/ingest.js +6 -6
  197. package/dist/hooks/instructions-loaded.js +4 -4
  198. package/dist/hooks/manifest.json +20 -20
  199. package/dist/hooks/notification.js +4 -4
  200. package/dist/hooks/post-compact.js +21 -14
  201. package/dist/hooks/post-tool-combined.js +8 -8
  202. package/dist/hooks/pre-compact.js +22 -21
  203. package/dist/hooks/pre-tool-use.js +29 -19
  204. package/dist/hooks/prompt-submit.js +89 -72
  205. package/dist/hooks/session-end.js +27 -26
  206. package/dist/hooks/session-start.js +13 -13
  207. package/dist/hooks/stop.js +28 -21
  208. package/dist/hooks/subagent-stop.js +24 -41
  209. package/dist/hooks/summary-worker.js +27 -25
  210. package/dist/index.js +30 -23
  211. package/dist/{installer-SC7CQBYY.js → installer-3EYHBKWB.js} +5 -5
  212. package/dist/{installer-UEF44TWQ.js → installer-3VZMDDMJ.js} +5 -5
  213. package/dist/{installer-2EKTDQZB.js → installer-GYABVCB7.js} +5 -5
  214. package/dist/intercom-queue-ZCNT4LYU.js +53 -0
  215. package/dist/lib/agent-config.js +7 -1
  216. package/dist/lib/cloud-sync.js +16 -14
  217. package/dist/lib/consolidation.js +5 -5
  218. package/dist/lib/database.js +10 -2
  219. package/dist/lib/db-daemon-client.js +3 -3
  220. package/dist/lib/db.js +10 -2
  221. package/dist/lib/device-registry.js +1 -1
  222. package/dist/lib/embed-worker.js +28 -0
  223. package/dist/lib/embedder.js +3 -3
  224. package/dist/lib/employee-templates.js +5 -5
  225. package/dist/lib/employees.js +2 -2
  226. package/dist/lib/exe-daemon-client.js +2 -2
  227. package/dist/lib/exe-daemon.js +393 -140
  228. package/dist/lib/hybrid-search.js +5 -5
  229. package/dist/lib/identity.js +2 -2
  230. package/dist/lib/license.js +2 -2
  231. package/dist/lib/messaging.js +20 -13
  232. package/dist/lib/registry-proxy.js +1 -1
  233. package/dist/lib/reminders.js +3 -3
  234. package/dist/lib/schedules.js +5 -5
  235. package/dist/lib/session-registry.js +6 -4
  236. package/dist/lib/skill-learning.js +6 -6
  237. package/dist/lib/store.js +4 -4
  238. package/dist/lib/task-router.js +3 -3
  239. package/dist/lib/tasks.js +21 -14
  240. package/dist/lib/tmux-routing.js +29 -12
  241. package/dist/lib/token-spend.js +3 -3
  242. package/dist/{license-gate-YUUSIPJ7.js → license-gate-73XGUIVP.js} +3 -3
  243. package/dist/{license-sync-LX73IEBH.js → license-sync-CG5YRUVH.js} +2 -2
  244. package/dist/mcp/register-tools.js +75 -72
  245. package/dist/mcp/server.js +96 -130
  246. package/dist/mcp/tools/complete-reminder.js +4 -4
  247. package/dist/mcp/tools/create-reminder.js +4 -4
  248. package/dist/mcp/tools/create-task.js +37 -18
  249. package/dist/mcp/tools/deactivate-behavior.js +7 -7
  250. package/dist/mcp/tools/list-reminders.js +4 -4
  251. package/dist/mcp/tools/list-tasks.js +23 -16
  252. package/dist/mcp/tools/send-message.js +22 -15
  253. package/dist/mcp/tools/update-task.js +22 -15
  254. package/dist/{mcp-http-config-MBG5AQNH.js → mcp-http-config-TT7PXZLX.js} +3 -3
  255. package/dist/{memory-cards-MGZ4P3AA.js → memory-cards-6NGUDUDN.js} +4 -4
  256. package/dist/{memory-graph-extractor-44P2ATID.js → memory-graph-extractor-FIMS3VQR.js} +3 -3
  257. package/dist/{memory-poisoning-defense-3CYFKNLA.js → memory-poisoning-defense-M3LOQ3XU.js} +2 -2
  258. package/dist/{memory-pressure-watchdog-6PFLEOUO.js → memory-pressure-watchdog-45GABDWH.js} +20 -13
  259. package/dist/{memory-queue-client-BZD6MXA5.js → memory-queue-client-BDYKFNB4.js} +3 -3
  260. package/dist/{memory-reflection-AYPJRPU7.js → memory-reflection-LANCFYK2.js} +7 -9
  261. package/dist/{notifications-BBQ23ORD.js → notifications-N5NKUYAU.js} +19 -12
  262. package/dist/{orchestration-events-O5P5NEKS.js → orchestration-events-KVNRNIPR.js} +3 -3
  263. package/dist/{orchestrator-SERM6FDY.js → orchestrator-VTF5BR26.js} +21 -14
  264. package/dist/{pipeline-router-T673WGL3.js → pipeline-router-KQAYWDPH.js} +3 -3
  265. package/dist/{plan-limits-QWBN2EKH.js → plan-limits-EUZI4X5W.js} +5 -5
  266. package/dist/{projection-worker-K6TILAZH.js → projection-worker-FG6G226D.js} +12 -2
  267. package/dist/{prospective-memory-XRNRMEDL.js → prospective-memory-FVDNUSIL.js} +2 -2
  268. package/dist/{reranker-3XC5UM4F.js → reranker-54Q3L32E.js} +1 -1
  269. package/dist/{retrieval-health-ULVVOIPL.js → retrieval-health-YJ7CXYVD.js} +1 -1
  270. package/dist/{review-polling-5YGDPJUX.js → review-polling-TKXYSXH6.js} +20 -13
  271. package/dist/runtime/index.js +23 -16
  272. package/dist/{session-events-D52HNUJK.js → session-events-WQHTP65R.js} +20 -13
  273. package/dist/{session-kill-telemetry-IBNCJSI7.js → session-kill-telemetry-2HSE7IGH.js} +20 -13
  274. package/dist/{session-scope-5FWZ4AYR.js → session-scope-RBKAC75W.js} +19 -12
  275. package/dist/{setup-wizard-KVTLSSRD.js → setup-wizard-AA6ZV57H.js} +1 -1
  276. package/dist/signal-paths-4G53QTII.js +11 -0
  277. package/dist/skill-refinement-QI35LMTZ.js +20 -0
  278. package/dist/{stack-update-OWWGTYRB.js → stack-update-BE6PX4AG.js} +9 -3
  279. package/dist/{steward-gate-3ZITRYVH.js → steward-gate-2XD5BXH6.js} +3 -3
  280. package/dist/{support-outbox-QPQQK7F7.js → support-outbox-MGUVVGHT.js} +96 -44
  281. package/dist/sweep-budget-WB2FKPYN.js +64 -0
  282. package/dist/{task-enforcement-L4YTDOOX.js → task-enforcement-DMOCBRLB.js} +191 -17
  283. package/dist/{task-scope-OIHLMQOQ.js → task-scope-ULBNFBFH.js} +25 -12
  284. package/dist/{tasks-crud-QUIIRWE3.js → tasks-crud-6SJOKES5.js} +25 -12
  285. package/dist/{tasks-notify-ANYLB5GU.js → tasks-notify-TESRABUM.js} +20 -13
  286. package/dist/{tasks-review-BWSCXFMB.js → tasks-review-INDAGLWJ.js} +27 -14
  287. package/dist/{telemetry-upload-XLDBCD7B.js → telemetry-upload-6XB3Q3IH.js} +7 -7
  288. package/dist/{token-budget-OQCLPV3A.js → token-budget-NOF27AZC.js} +3 -3
  289. package/dist/{tool-capability-index-3UWKZZED.js → tool-capability-index-EFBBPTBI.js} +1 -1
  290. package/dist/{tool-telemetry-AQTFWOWG.js → tool-telemetry-OEK6KQFF.js} +1 -1
  291. package/dist/tui/App.js +28 -21
  292. package/dist/{tui-data-3Y5L5LJB.js → tui-data-EG6LEZFF.js} +19 -12
  293. package/dist/{worker-gate-WJS2MFNA.js → worker-gate-YA35VMAN.js} +1 -1
  294. package/dist/{workflow-engine-EPPZ226V.js → workflow-engine-3AVKRE5I.js} +2 -2
  295. package/dist/{worktree-OYGDGJP7.js → worktree-72QYYL5L.js} +4 -4
  296. package/dist/{worktree-sweep-KV4H4766.js → worktree-sweep-GDISKGQ2.js} +5 -5
  297. package/package.json +1 -1
  298. package/release-notes.json +45 -45
  299. package/dist/chunk-4FVVJ7ME.js +0 -193
  300. package/dist/completion-nudge-dedup-DBZF24MM.js +0 -74
  301. package/dist/git-task-sweep-7GVUKDBW.js +0 -47
  302. package/dist/intercom-queue-6M5IRX3Y.js +0 -17
  303. /package/dist/{chunk-QTEHH4LG.js → chunk-24WPWCD6.js} +0 -0
  304. /package/dist/{chunk-IZY6V4FI.js → chunk-4O3N7I5Z.js} +0 -0
  305. /package/dist/{chunk-WXRVHXVP.js → chunk-7577GDDG.js} +0 -0
  306. /package/dist/{chunk-Q5YKWFVO.js → chunk-EWKZKO7F.js} +0 -0
  307. /package/dist/{chunk-DY3J6GQO.js → chunk-H43BPGIV.js} +0 -0
  308. /package/dist/{chunk-DQJ3WZRK.js → chunk-IHRXCNSC.js} +0 -0
  309. /package/dist/{chunk-RRQI5PSJ.js → chunk-NIB2N6L2.js} +0 -0
  310. /package/dist/{chunk-ZU6767WK.js → chunk-QMUSJESS.js} +0 -0
  311. /package/dist/{chunk-72LWCZTJ.js → chunk-RXS2LBKE.js} +0 -0
  312. /package/dist/{chunk-SJZT66LM.js → chunk-SNFYZFXY.js} +0 -0
  313. /package/dist/{chunk-SIJSFULW.js → chunk-TSYMWC53.js} +0 -0
  314. /package/dist/{core-memory-DARTILJG.js → core-memory-NKKP2XUB.js} +0 -0
  315. /package/dist/{entity-boost-VR5YOQCT.js → entity-boost-DRIUFTYB.js} +0 -0
  316. /package/dist/{message-queue-client-HVFR67QH.js → message-queue-client-4ERC7HLX.js} +0 -0
  317. /package/dist/{oauth-server-UQHCFVHT.js → oauth-server-PECJREY2.js} +0 -0
  318. /package/dist/{project-boot-22ZZL2GE.js → project-boot-SFKP2MFW.js} +0 -0
  319. /package/dist/{wiki-acl-EZMGL6KW.js → wiki-acl-QIBDNXSM.js} +0 -0
@@ -9,11 +9,20 @@ import {
9
9
  getMcpToolFamily,
10
10
  inferMcpRuntime,
11
11
  recordMcpHttpEvent
12
- } from "../chunk-CWQAXO3O.js";
12
+ } from "../chunk-5RACW3LX.js";
13
13
  import {
14
14
  deserializeArgs,
15
15
  serializeResultSet
16
16
  } from "../chunk-QGGH7LOU.js";
17
+ import {
18
+ resolveEmbeddingsEnabled
19
+ } from "../chunk-KWOAM7TA.js";
20
+ import {
21
+ findScopedDuplicate,
22
+ governMemoryRecord,
23
+ schedulePostWriteMemoryHygiene
24
+ } from "../chunk-TSYMWC53.js";
25
+ import "../chunk-Y25OJWOQ.js";
17
26
  import {
18
27
  attributeSignalSource,
19
28
  consumeRestartIntentDetail,
@@ -40,16 +49,7 @@ import {
40
49
  resolveEmbedWorkerHeapMb,
41
50
  resolveEmbedWorkerRssKillMb,
42
51
  shouldRestartForRss
43
- } from "../chunk-CMDC5D7S.js";
44
- import {
45
- resolveEmbeddingsEnabled
46
- } from "../chunk-KWOAM7TA.js";
47
- import {
48
- findScopedDuplicate,
49
- governMemoryRecord,
50
- schedulePostWriteMemoryHygiene
51
- } from "../chunk-SIJSFULW.js";
52
- import "../chunk-Y25OJWOQ.js";
52
+ } from "../chunk-NLEW62VC.js";
53
53
  import {
54
54
  logBoot,
55
55
  logCrash,
@@ -85,7 +85,7 @@ import { writeFile } from "fs/promises";
85
85
  import { execSync as execSyncNode, execFile as execFileNode } from "child_process";
86
86
  import { promisify } from "util";
87
87
  import path3 from "path";
88
- import { fork } from "child_process";
88
+ import { fork, spawn } from "child_process";
89
89
  import { Worker } from "worker_threads";
90
90
 
91
91
  // src/lib/daemon-sql-guard.ts
@@ -487,6 +487,25 @@ function decideDaemonSelfHeal(s) {
487
487
  }
488
488
  return { restart: false, reason: "not_critical", consecutiveSevereAfter: 0 };
489
489
  }
490
+ function decideOrchestrationTickSkip(s) {
491
+ if (isHostCpuStarved(s.load1m, s.cpuCount, s.starvationRatio)) {
492
+ return { skip: true, reason: "starved_skip" };
493
+ }
494
+ return { skip: false, reason: "run" };
495
+ }
496
+ function decideBootBackoff(s) {
497
+ if (!isHostCpuStarved(s.load1m, s.cpuCount, s.starvationRatio)) {
498
+ return { wait: false, delayMs: 0, reason: "not_starved" };
499
+ }
500
+ if (s.attempt >= s.maxAttempts) {
501
+ return { wait: false, delayMs: 0, reason: "max_attempts_proceed" };
502
+ }
503
+ const base = Number.isFinite(s.baseDelayMs) && s.baseDelayMs > 0 ? s.baseDelayMs : 0;
504
+ const cap = Number.isFinite(s.maxDelayMs) && s.maxDelayMs > 0 ? s.maxDelayMs : base;
505
+ const exp = base * Math.pow(2, Math.max(0, s.attempt));
506
+ const delayMs = Math.min(cap, exp);
507
+ return { wait: true, delayMs, reason: "backoff" };
508
+ }
490
509
 
491
510
  // src/lib/exe-daemon.ts
492
511
  var SOCKET_PATH = process.env.EXE_DAEMON_SOCK ?? process.env.EXE_EMBED_SOCK ?? path3.join(EXE_AI_DIR, "exed.sock");
@@ -542,9 +561,45 @@ async function getTmuxSessionsAsync() {
542
561
  }
543
562
  return _tmuxSessionCache;
544
563
  }
564
+ var _paneCommandCache = /* @__PURE__ */ new Map();
565
+ var _paneCommandCacheTs = 0;
566
+ var PANE_COMMAND_CACHE_TTL_MS = 5e3;
567
+ var BARE_SHELL_COMMANDS = /* @__PURE__ */ new Set(["zsh", "bash", "sh", "-zsh", "-bash", "-sh", "fish", "-fish", "login", "tmux"]);
568
+ async function getPaneCommandsAsync() {
569
+ const now = Date.now();
570
+ if (now - _paneCommandCacheTs < PANE_COMMAND_CACHE_TTL_MS) return _paneCommandCache;
571
+ const map = /* @__PURE__ */ new Map();
572
+ try {
573
+ const { stdout } = await execFileAsync(
574
+ "tmux",
575
+ ["list-panes", "-a", "-F", "#{session_name} #{pane_current_command}"],
576
+ { encoding: "utf8", timeout: 3e3 }
577
+ );
578
+ for (const line of String(stdout ?? "").split("\n")) {
579
+ const [session, command] = line.split(" ");
580
+ if (!session) continue;
581
+ const existing = map.get(session);
582
+ if (existing && !BARE_SHELL_COMMANDS.has(existing)) continue;
583
+ map.set(session, (command ?? "").trim());
584
+ }
585
+ _paneCommandCache = map;
586
+ _paneCommandCacheTs = now;
587
+ } catch {
588
+ _paneCommandCache = /* @__PURE__ */ new Map();
589
+ _paneCommandCacheTs = now;
590
+ }
591
+ return _paneCommandCache;
592
+ }
593
+ function coordinatorPaneHasLiveAgent(session, paneCommands) {
594
+ const cmd = paneCommands.get(session);
595
+ if (cmd === void 0) return true;
596
+ if (cmd === "") return true;
597
+ return !BARE_SHELL_COMMANDS.has(cmd);
598
+ }
545
599
  var _paneCacheMap = /* @__PURE__ */ new Map();
546
600
  var PANE_CACHE_TTL_MS = 1e4;
547
601
  var _reflectionImportFailed = false;
602
+ var _reflectionSweepRunning = false;
548
603
  var _intercomDedupCompleted = false;
549
604
  var _sharedPaneCache = null;
550
605
  var _sharedAliveSessions = null;
@@ -581,8 +636,34 @@ var _orchestrationSteps = {
581
636
  };
582
637
  var _orchestrationBusy = false;
583
638
  var _orchestrationTickCount = 0;
639
+ var _lastTickSkipLogTs = 0;
640
+ var TICK_SKIP_LOG_THROTTLE_MS = 5 * 60 * 1e3;
584
641
  async function runOrchestrationTick() {
585
642
  if (_orchestrationBusy) return;
643
+ const tickSkip = decideOrchestrationTickSkip({
644
+ load1m: os2.loadavg()[0] ?? 0,
645
+ cpuCount: os2.cpus().length || 1,
646
+ starvationRatio: parseFloat(process.env.EXE_STARVATION_LOAD_RATIO ?? "1.5")
647
+ });
648
+ if (tickSkip.skip) {
649
+ const now = Date.now();
650
+ if (now - _lastTickSkipLogTs > TICK_SKIP_LOG_THROTTLE_MS) {
651
+ _lastTickSkipLogTs = now;
652
+ const load1m = os2.loadavg()[0] ?? 0;
653
+ const cpuCount = os2.cpus().length || 1;
654
+ process.stderr.write(
655
+ `[exed] Orchestration tick SKIPPED: load=${load1m.toFixed(2)} cpus=${cpuCount} \u2014 CPU starved, deferring per-session pass to avoid feeding the event-loop-block spiral.
656
+ `
657
+ );
658
+ logDaemonHealth({
659
+ event: "orchestration_tick_skipped_starvation",
660
+ pid: process.pid,
661
+ message: `orchestration tick skipped \u2014 CPU starved (load=${load1m.toFixed(2)} / cpus=${cpuCount})`,
662
+ data: { load1m, cpuCount, loadPerCore: load1m / cpuCount }
663
+ });
664
+ }
665
+ return;
666
+ }
586
667
  _orchestrationBusy = true;
587
668
  _orchestrationTickCount++;
588
669
  try {
@@ -738,6 +819,10 @@ var _requestsServed = 0;
738
819
  var _droppedRequests = 0;
739
820
  var _startedAt2 = Date.now();
740
821
  process.env.EXE_DAEMON_STARTED_AT_ISO ??= new Date(_startedAt2).toISOString();
822
+ var _bootPhase = "pre_init";
823
+ function setBootPhase(phase) {
824
+ _bootPhase = phase;
825
+ }
741
826
  var TIMER_TRACE_BOOT_WINDOW_MS = Number(process.env.EXE_TIMER_TRACE_BOOT_WINDOW_MS) || 10 * 60 * 1e3;
742
827
  var TIMER_TRACE_SLOW_MS = Number(process.env.EXE_TIMER_TRACE_SLOW_MS) || 500;
743
828
  var TIMER_TIMEOUT_MS = Number(process.env.EXE_TIMER_TIMEOUT_MS) || 1e4;
@@ -1210,7 +1295,7 @@ async function loadModel() {
1210
1295
  void (async () => {
1211
1296
  try {
1212
1297
  if (_storeInitialized) {
1213
- const { writeNotification } = await import("../notifications-BBQ23ORD.js");
1298
+ const { writeNotification } = await import("../notifications-N5NKUYAU.js");
1214
1299
  await writeNotification({
1215
1300
  agentId: "exe",
1216
1301
  agentRole: "system",
@@ -1326,7 +1411,7 @@ function disableEmbeddingsForInferenceTimeouts() {
1326
1411
  void (async () => {
1327
1412
  try {
1328
1413
  if (_storeInitialized) {
1329
- const { writeNotification } = await import("../notifications-BBQ23ORD.js");
1414
+ const { writeNotification } = await import("../notifications-N5NKUYAU.js");
1330
1415
  await writeNotification({
1331
1416
  agentId: "exe",
1332
1417
  agentRole: "system",
@@ -1537,7 +1622,7 @@ async function shutdown(exitCode = 0) {
1537
1622
  }
1538
1623
  }
1539
1624
  try {
1540
- const { createBackupAsync, enforceRetention, hasRecentBackup } = await import("../db-backup-ITRADB2J.js");
1625
+ const { createBackupAsync, enforceRetention, hasRecentBackup } = await import("../db-backup-XLID57KW.js");
1541
1626
  const PRE_RESTART_DEDUP_MS = 2 * 60 * 1e3;
1542
1627
  if (hasRecentBackup("pre-restart", PRE_RESTART_DEDUP_MS)) {
1543
1628
  const deleted = enforceRetention("pre-restart");
@@ -1568,7 +1653,7 @@ async function shutdown(exitCode = 0) {
1568
1653
  `);
1569
1654
  }
1570
1655
  try {
1571
- const { stopProjectionWorker } = await import("../projection-worker-K6TILAZH.js");
1656
+ const { stopProjectionWorker } = await import("../projection-worker-FG6G226D.js");
1572
1657
  stopProjectionWorker();
1573
1658
  } catch {
1574
1659
  }
@@ -1634,7 +1719,7 @@ async function handleHealthCheck(socket, requestId) {
1634
1719
  let pipelineStatus = "unknown";
1635
1720
  if (dbConnected) {
1636
1721
  try {
1637
- await import("../pipeline-router-T673WGL3.js");
1722
+ await import("../pipeline-router-KQAYWDPH.js");
1638
1723
  pipelineStatus = "ok";
1639
1724
  } catch {
1640
1725
  pipelineStatus = "unavailable";
@@ -2030,7 +2115,7 @@ async function _writeMemoryRecordInner(entry) {
2030
2115
  const vRow = await client.execute({ sql: "SELECT version FROM memories WHERE id = ?", args: [id] });
2031
2116
  const version = Number(vRow.rows[0]?.version) || 0;
2032
2117
  try {
2033
- const { insertOntologyForMemory } = await import("../agentic-ontology-HQKCU7LG.js");
2118
+ const { insertOntologyForMemory } = await import("../agentic-ontology-2QFPBIQP.js");
2034
2119
  await insertOntologyForMemory({
2035
2120
  id,
2036
2121
  agent_id: record.agent_id,
@@ -2053,7 +2138,7 @@ async function _writeMemoryRecordInner(entry) {
2053
2138
  return id;
2054
2139
  }
2055
2140
  var MEMORY_DRAIN_INTERVAL_MS = 30 * 1e3;
2056
- var MEMORY_DRAIN_BATCH = Math.max(1, Number(process.env.EXE_MEMORY_DRAIN_BATCH) || 25);
2141
+ var MEMORY_DRAIN_BATCH = Math.max(1, Number(process.env.EXE_MEMORY_DRAIN_BATCH) || 1);
2057
2142
  function startMemoryQueueDrain() {
2058
2143
  const drain = async () => traceDaemonTimer("memory_queue_drain", async () => {
2059
2144
  fired("memory_queue_drain");
@@ -2120,7 +2205,7 @@ function startMessageQueueDrain() {
2120
2205
  fired("message_queue_drain");
2121
2206
  if (!await ensureStoreForPolling()) return;
2122
2207
  try {
2123
- const { claimMessageQueue, ackMessageQueue } = await import("../message-queue-client-HVFR67QH.js");
2208
+ const { claimMessageQueue, ackMessageQueue } = await import("../message-queue-client-4ERC7HLX.js");
2124
2209
  const lease = claimMessageQueue();
2125
2210
  if (!lease || lease.entries.length === 0) return;
2126
2211
  acted("message_queue_drain");
@@ -2704,6 +2789,52 @@ async function startMcpHttpServer() {
2704
2789
  resolve();
2705
2790
  });
2706
2791
  });
2792
+ setBootPhase("db_init");
2793
+ {
2794
+ const BOOT_BACKOFF_BASE_MS = parseInt(process.env.EXE_BOOT_BACKOFF_BASE_MS ?? "") || 2e3;
2795
+ const BOOT_BACKOFF_MAX_MS = parseInt(process.env.EXE_BOOT_BACKOFF_MAX_MS ?? "") || 15e3;
2796
+ const BOOT_BACKOFF_MAX_ATTEMPTS = parseInt(process.env.EXE_BOOT_BACKOFF_MAX_ATTEMPTS ?? "") || 5;
2797
+ const starvationRatio = parseFloat(process.env.EXE_STARVATION_LOAD_RATIO ?? "1.5");
2798
+ for (let attempt = 0; ; attempt++) {
2799
+ const decision = decideBootBackoff({
2800
+ load1m: os2.loadavg()[0] ?? 0,
2801
+ cpuCount: os2.cpus().length || 1,
2802
+ starvationRatio,
2803
+ attempt,
2804
+ baseDelayMs: BOOT_BACKOFF_BASE_MS,
2805
+ maxDelayMs: BOOT_BACKOFF_MAX_MS,
2806
+ maxAttempts: BOOT_BACKOFF_MAX_ATTEMPTS
2807
+ });
2808
+ if (!decision.wait) {
2809
+ if (decision.reason === "max_attempts_proceed") {
2810
+ process.stderr.write(
2811
+ `[exed] Boot backoff: still starved after ${BOOT_BACKOFF_MAX_ATTEMPTS} attempts \u2014 proceeding with DB init anyway.
2812
+ `
2813
+ );
2814
+ logDaemonHealth({
2815
+ event: "boot_backoff_starvation",
2816
+ pid: process.pid,
2817
+ message: `boot backoff exhausted (${BOOT_BACKOFF_MAX_ATTEMPTS} attempts) \u2014 proceeding`,
2818
+ data: { load1m: os2.loadavg()[0] ?? 0, cpuCount: os2.cpus().length || 1, attempts: attempt }
2819
+ });
2820
+ }
2821
+ break;
2822
+ }
2823
+ const load1m = os2.loadavg()[0] ?? 0;
2824
+ const cpuCount = os2.cpus().length || 1;
2825
+ process.stderr.write(
2826
+ `[exed] Boot backoff: CPU starved (load=${load1m.toFixed(2)} cpus=${cpuCount}) \u2014 delaying DB init ${Math.round(decision.delayMs / 1e3)}s (attempt ${attempt + 1}/${BOOT_BACKOFF_MAX_ATTEMPTS}).
2827
+ `
2828
+ );
2829
+ logDaemonHealth({
2830
+ event: "boot_backoff_starvation",
2831
+ pid: process.pid,
2832
+ message: `boot delayed ${Math.round(decision.delayMs / 1e3)}s before DB init \u2014 CPU starved (load=${load1m.toFixed(2)} / cpus=${cpuCount})`,
2833
+ data: { load1m, cpuCount, loadPerCore: load1m / cpuCount, delayMs: decision.delayMs, attempt }
2834
+ });
2835
+ await new Promise((resolve) => setTimeout(resolve, decision.delayMs));
2836
+ }
2837
+ }
2707
2838
  process.stderr.write("[exed] MCP HTTP: SDK imports done, initializing DB...\n");
2708
2839
  const dbReady = await ensureStoreForPolling();
2709
2840
  if (!dbReady) {
@@ -2718,8 +2849,9 @@ async function startMcpHttpServer() {
2718
2849
  return;
2719
2850
  }
2720
2851
  process.stderr.write("[exed] MCP HTTP: DB ready\n");
2852
+ setBootPhase("db_ready");
2721
2853
  _storeInitialized = true;
2722
- const { initLicenseGate, getCachedLicenseGate } = await import("../license-gate-YUUSIPJ7.js");
2854
+ const { initLicenseGate, getCachedLicenseGate } = await import("../license-gate-73XGUIVP.js");
2723
2855
  const gateResult = await initLicenseGate();
2724
2856
  if (!gateResult.hasKey) {
2725
2857
  process.stderr.write(
@@ -2734,13 +2866,13 @@ async function startMcpHttpServer() {
2734
2866
  let _cachedWrapTelemetry = null;
2735
2867
  async function getWrapTelemetry() {
2736
2868
  if (!_cachedWrapTelemetry) {
2737
- const { wrapServerWithTelemetry } = await import("../tool-telemetry-AQTFWOWG.js");
2869
+ const { wrapServerWithTelemetry } = await import("../tool-telemetry-OEK6KQFF.js");
2738
2870
  _cachedWrapTelemetry = wrapServerWithTelemetry;
2739
2871
  }
2740
2872
  return _cachedWrapTelemetry;
2741
2873
  }
2742
2874
  Promise.all([
2743
- import("../tool-capability-index-3UWKZZED.js"),
2875
+ import("../tool-capability-index-EFBBPTBI.js"),
2744
2876
  import("../tool-gates-3IC7DK4R.js")
2745
2877
  ]).then(async ([{ getToolCapabilityIndex }, { TOOL_CATEGORIES }]) => {
2746
2878
  const gateState = getCachedLicenseGate();
@@ -2804,7 +2936,7 @@ async function startMcpHttpServer() {
2804
2936
  if (!token || token === header) return false;
2805
2937
  if (token === _daemonToken) return true;
2806
2938
  try {
2807
- const { verifyAccessToken } = await import("../oauth-server-UQHCFVHT.js");
2939
+ const { verifyAccessToken } = await import("../oauth-server-PECJREY2.js");
2808
2940
  const result = verifyAccessToken(token);
2809
2941
  return result.valid;
2810
2942
  } catch {
@@ -3049,7 +3181,7 @@ async function startMcpHttpServer() {
3049
3181
  return;
3050
3182
  }
3051
3183
  try {
3052
- const { handleOAuthRoute } = await import("../oauth-server-UQHCFVHT.js");
3184
+ const { handleOAuthRoute } = await import("../oauth-server-PECJREY2.js");
3053
3185
  const handled = await handleOAuthRoute(req, res, url, MCP_HTTP_PORT);
3054
3186
  if (handled) return;
3055
3187
  } catch (err) {
@@ -3177,7 +3309,7 @@ async function startMcpHttpServer() {
3177
3309
  contextPct: body.context_pct
3178
3310
  });
3179
3311
  if (body.context_pct !== void 0 && body.context_pct > 70) {
3180
- void import("../orchestration-events-O5P5NEKS.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
3312
+ void import("../orchestration-events-KVNRNIPR.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
3181
3313
  recordOE({
3182
3314
  eventType: "context.pressure",
3183
3315
  source: "exe-daemon.heartbeat",
@@ -3266,14 +3398,16 @@ async function startMcpHttpServer() {
3266
3398
  const clientProvidedSessionHint = Boolean(sessionHint);
3267
3399
  if (!sessionHint && agentId) {
3268
3400
  try {
3269
- const { getTransport } = await import("./transport.js");
3270
- const liveSessions = getTransport().listSessions();
3401
+ const liveSessions = await getTmuxSessionsAsync();
3271
3402
  const agentSessions = liveSessions.filter((s) => s.startsWith(agentId + "-"));
3272
3403
  if (agentSessions.length === 1) {
3273
3404
  sessionHint = agentSessions[0];
3274
3405
  }
3275
3406
  if (!sessionHint) {
3276
- const roots = liveSessions.filter((s) => !s.includes("-") && /^[a-z]+\d*$/.test(s));
3407
+ const paneCommands = await getPaneCommandsAsync();
3408
+ const roots = liveSessions.filter(
3409
+ (s) => !s.includes("-") && /^[a-z]+\d*$/.test(s) && coordinatorPaneHasLiveAgent(s, paneCommands)
3410
+ );
3277
3411
  if (roots.length === 1) {
3278
3412
  sessionHint = roots[0];
3279
3413
  } else if (roots.length > 1 && agentId) {
@@ -3661,42 +3795,27 @@ async function startMcpHttpServer() {
3661
3795
  }
3662
3796
  }
3663
3797
  });
3664
- const startRealListen = () => {
3665
- httpServer.listen(MCP_HTTP_PORT, MCP_HTTP_HOST, () => {
3666
- process.stderr.write(`[exed] MCP HTTP listening on ${MCP_HTTP_HOST}:${MCP_HTTP_PORT}
3667
- `);
3668
- _boundMcpPort = MCP_HTTP_PORT;
3669
- writeDaemonReady({ pid: process.pid, port: MCP_HTTP_PORT });
3670
- void import("../mcp-port-config-FFAMMLLE.js").then(({ persistMcpPortToConfig }) => persistMcpPortToConfig(String(MCP_HTTP_PORT))).catch(() => {
3671
- });
3672
- recordMcpHttpEvent({
3673
- level: "info",
3674
- message: "server_started",
3675
- activeSessions: transports.size
3676
- });
3677
- setTimeout(() => {
3678
- resetCrashCounterOnHealthy();
3679
- }, 5 * 60 * 1e3);
3680
- });
3681
- };
3682
- if (_bootstrapServerRef) {
3683
- const srv = _bootstrapServerRef;
3684
- _bootstrapServerRef = null;
3685
- srv.close(() => startRealListen());
3686
- } else {
3687
- startRealListen();
3688
- }
3689
- httpServer.on("close", () => {
3690
- clearInterval(sessionSweepTimer);
3691
- });
3692
3798
  let _portRetries = 0;
3693
3799
  const MAX_PORT_RETRIES = 5;
3800
+ let resolveRealListen = null;
3801
+ let rejectRealListen = null;
3802
+ const realListenReady = new Promise((resolve, reject) => {
3803
+ resolveRealListen = resolve;
3804
+ rejectRealListen = reject;
3805
+ });
3806
+ const markRealListenReady = () => {
3807
+ resolveRealListen?.();
3808
+ resolveRealListen = null;
3809
+ rejectRealListen = null;
3810
+ };
3694
3811
  const retryPortBind = () => {
3695
3812
  _portRetries++;
3696
3813
  if (_portRetries > MAX_PORT_RETRIES) {
3697
- process.stderr.write(`[exed] MCP HTTP port ${MCP_HTTP_PORT} still in use after ${MAX_PORT_RETRIES} retries \u2014 shutting down for launchd restart
3814
+ const err = new Error(`MCP HTTP port ${MCP_HTTP_PORT} still in use after ${MAX_PORT_RETRIES} retries`);
3815
+ process.stderr.write(`[exed] ${err.message} \u2014 shutting down for launchd restart
3698
3816
  `);
3699
3817
  logRestartEvent("daemon_self_exit", { trigger: "mcp_http_port_bind_failed", port: MCP_HTTP_PORT });
3818
+ rejectRealListen?.(err);
3700
3819
  void shutdown(1);
3701
3820
  return;
3702
3821
  }
@@ -3707,6 +3826,7 @@ async function startMcpHttpServer() {
3707
3826
  httpServer.listen(MCP_HTTP_PORT, MCP_HTTP_HOST, () => {
3708
3827
  process.stderr.write(`[exed] MCP HTTP listening on ${MCP_HTTP_HOST}:${MCP_HTTP_PORT} (retry ${_portRetries})
3709
3828
  `);
3829
+ markRealListenReady();
3710
3830
  });
3711
3831
  }, delay);
3712
3832
  };
@@ -3716,8 +3836,39 @@ async function startMcpHttpServer() {
3716
3836
  } else {
3717
3837
  process.stderr.write(`[exed] MCP HTTP error: ${err.message}
3718
3838
  `);
3839
+ rejectRealListen?.(err instanceof Error ? err : new Error(String(err)));
3719
3840
  }
3720
3841
  });
3842
+ const startRealListen = () => {
3843
+ httpServer.listen(MCP_HTTP_PORT, MCP_HTTP_HOST, () => {
3844
+ process.stderr.write(`[exed] MCP HTTP listening on ${MCP_HTTP_HOST}:${MCP_HTTP_PORT}
3845
+ `);
3846
+ _boundMcpPort = MCP_HTTP_PORT;
3847
+ writeDaemonReady({ pid: process.pid, port: MCP_HTTP_PORT });
3848
+ void import("../mcp-port-config-FFAMMLLE.js").then(({ persistMcpPortToConfig }) => persistMcpPortToConfig(String(MCP_HTTP_PORT))).catch(() => {
3849
+ });
3850
+ recordMcpHttpEvent({
3851
+ level: "info",
3852
+ message: "server_started",
3853
+ activeSessions: transports.size
3854
+ });
3855
+ setTimeout(() => {
3856
+ resetCrashCounterOnHealthy();
3857
+ }, 5 * 60 * 1e3);
3858
+ markRealListenReady();
3859
+ });
3860
+ };
3861
+ if (_bootstrapServerRef) {
3862
+ const srv = _bootstrapServerRef;
3863
+ _bootstrapServerRef = null;
3864
+ srv.close(() => startRealListen());
3865
+ } else {
3866
+ startRealListen();
3867
+ }
3868
+ httpServer.on("close", () => {
3869
+ clearInterval(sessionSweepTimer);
3870
+ });
3871
+ await realListenReady;
3721
3872
  } catch (err) {
3722
3873
  const msg = err instanceof Error ? err.stack ?? err.message : String(err);
3723
3874
  process.stderr.write(`[exed] MCP HTTP setup FAILED: ${msg}
@@ -3771,13 +3922,13 @@ async function ensureStoreForPolling() {
3771
3922
  }
3772
3923
  }
3773
3924
  async function startReviewPolling() {
3774
- const polling = await import("../review-polling-5YGDPJUX.js");
3925
+ const polling = await import("../review-polling-TKXYSXH6.js");
3775
3926
  const state = {
3776
3927
  lastIntercomSent: /* @__PURE__ */ new Map(),
3777
3928
  lastNudgeSent: /* @__PURE__ */ new Map(),
3778
3929
  intervalMs: REVIEW_POLL_INTERVAL_MS
3779
3930
  };
3780
- const { pollReviewNudge, createReviewNudgeRealDeps, loadNudgeState } = await import("../daemon-orchestration-JI3RD5EZ.js");
3931
+ const { pollReviewNudge, createReviewNudgeRealDeps, loadNudgeState } = await import("../daemon-orchestration-IBP6PWEG.js");
3781
3932
  const nudgeState = loadNudgeState();
3782
3933
  const tick = async () => traceDaemonTimer("review_polling", async () => {
3783
3934
  fired("review_polling");
@@ -3821,7 +3972,7 @@ function startSessionTTL() {
3821
3972
  if (!await ensureStoreForPolling()) return;
3822
3973
  try {
3823
3974
  const { getClient } = await import("./database.js");
3824
- const { checkSessionTTL, createSessionTTLRealDeps } = await import("../daemon-orchestration-JI3RD5EZ.js");
3975
+ const { checkSessionTTL, createSessionTTLRealDeps } = await import("../daemon-orchestration-IBP6PWEG.js");
3825
3976
  const deps = createSessionTTLRealDeps(getClient);
3826
3977
  const killed = await checkSessionTTL(deps);
3827
3978
  if (killed.length > 0) acted("session_ttl");
@@ -3869,7 +4020,7 @@ function startIdleKill() {
3869
4020
  const cfg = await getCachedConfig();
3870
4021
  if (!cfg) return;
3871
4022
  const { getClient } = await import("./database.js");
3872
- const { pollIdleKill, createIdleKillRealDeps } = await import("../daemon-orchestration-JI3RD5EZ.js");
4023
+ const { pollIdleKill, createIdleKillRealDeps } = await import("../daemon-orchestration-IBP6PWEG.js");
3873
4024
  const { sessions: liveSessions, paneCache, aliveSessions } = await getSharedOrchestrationCaches();
3874
4025
  const realDeps = createIdleKillRealDeps(
3875
4026
  getClient,
@@ -3938,7 +4089,7 @@ function startConsolidation() {
3938
4089
  `);
3939
4090
  }
3940
4091
  try {
3941
- const { createBackupAsync, enforceRetention } = await import("../db-backup-ITRADB2J.js");
4092
+ const { createBackupAsync, enforceRetention } = await import("../db-backup-XLID57KW.js");
3942
4093
  const p = await createBackupAsync("pre-consolidation");
3943
4094
  if (p) enforceRetention("pre-consolidation");
3944
4095
  } catch (e) {
@@ -3982,12 +4133,54 @@ var _cloudSyncBackoffMs = 0;
3982
4133
  var _cloudSyncPaused = false;
3983
4134
  var _cloudSyncPausedAt = 0;
3984
4135
  var _cloudSyncRunning = false;
4136
+ var _cloudSyncChild = null;
3985
4137
  var CLOUD_SYNC_AUTO_RECOVERY_MS = 30 * 6e4;
4138
+ var CLOUD_SYNC_CHILD_TIMEOUT_MS = Number(process.env.EXE_CLOUD_SYNC_CHILD_TIMEOUT_MS) || 10 * 6e4;
4139
+ function runCloudSyncChild() {
4140
+ return new Promise((resolve, reject) => {
4141
+ const cliPath = new URL("../bin/cli.js", import.meta.url);
4142
+ const env = { ...process.env, EXE_BACKGROUND_CLOUD_SYNC: "1" };
4143
+ delete env.EXE_IS_DAEMON;
4144
+ const child = spawn(process.execPath, [cliPath.pathname, "cloud", "sync"], {
4145
+ env,
4146
+ stdio: "ignore",
4147
+ detached: false
4148
+ });
4149
+ _cloudSyncChild = child;
4150
+ let settled = false;
4151
+ const finish = (err, result) => {
4152
+ if (settled) return;
4153
+ settled = true;
4154
+ clearTimeout(timeout);
4155
+ _cloudSyncChild = null;
4156
+ if (err) reject(err);
4157
+ else resolve(result);
4158
+ };
4159
+ const timeout = setTimeout(() => {
4160
+ process.stderr.write(`[exed] Cloud sync child timed out after ${Math.round(CLOUD_SYNC_CHILD_TIMEOUT_MS / 1e3)}s \u2014 killing child
4161
+ `);
4162
+ try {
4163
+ child.kill("SIGTERM");
4164
+ } catch {
4165
+ }
4166
+ setTimeout(() => {
4167
+ try {
4168
+ if (!child.killed) child.kill("SIGKILL");
4169
+ } catch {
4170
+ }
4171
+ }, 5e3).unref();
4172
+ finish(new Error("cloud sync child timed out"), { code: null, signal: "SIGTERM" });
4173
+ }, CLOUD_SYNC_CHILD_TIMEOUT_MS);
4174
+ timeout.unref();
4175
+ child.once("error", (err) => finish(err, { code: null, signal: null }));
4176
+ child.once("exit", (code, signal) => finish(null, { code, signal }));
4177
+ });
4178
+ }
3986
4179
  function startCloudSyncTimer() {
3987
4180
  const tick = async () => {
3988
4181
  fired("cloud_sync");
3989
4182
  if (_shuttingDown) return;
3990
- if (_cloudSyncRunning) {
4183
+ if (_cloudSyncRunning || _cloudSyncChild) {
3991
4184
  process.stderr.write(`[exed] Cloud sync skipped \u2014 previous sync still running
3992
4185
  `);
3993
4186
  return;
@@ -4018,11 +4211,10 @@ function startCloudSyncTimer() {
4018
4211
  const { loadConfig } = await import("./config.js");
4019
4212
  const config = await loadConfig();
4020
4213
  if (!config.cloud?.apiKey || !config.cloud?.endpoint) return;
4021
- const { cloudSync } = await import("./cloud-sync.js");
4022
- const result = await cloudSync({
4023
- apiKey: config.cloud.apiKey,
4024
- endpoint: config.cloud.endpoint
4025
- });
4214
+ const result = await runCloudSyncChild();
4215
+ if (result.code !== 0) {
4216
+ throw new Error(`cloud sync child exited code=${result.code ?? "null"} signal=${result.signal ?? "null"}`);
4217
+ }
4026
4218
  if (_cloudSyncConsecutiveFailures > 0) {
4027
4219
  process.stderr.write(`[exed] Cloud sync recovered after ${_cloudSyncConsecutiveFailures} failures
4028
4220
  `);
@@ -4030,13 +4222,9 @@ function startCloudSyncTimer() {
4030
4222
  _cloudSyncConsecutiveFailures = 0;
4031
4223
  _cloudSyncBackoffMs = 0;
4032
4224
  _cloudSyncPaused = false;
4033
- if (result.pushed > 0 || result.pulled > 0) {
4034
- acted("cloud_sync");
4035
- process.stderr.write(
4036
- `[exed] Cloud sync: pushed=${result.pushed} pulled=${result.pulled} total=${result.totalMemories}
4037
- `
4038
- );
4039
- }
4225
+ acted("cloud_sync");
4226
+ process.stderr.write(`[exed] Cloud sync child completed successfully
4227
+ `);
4040
4228
  } catch (err) {
4041
4229
  _cloudSyncConsecutiveFailures++;
4042
4230
  const msg = err instanceof Error ? err.message : String(err);
@@ -4068,10 +4256,10 @@ function startCloudSyncTimer() {
4068
4256
  _cloudSyncRunning = false;
4069
4257
  }
4070
4258
  };
4071
- const timer = setInterval(() => void tick(), CLOUD_SYNC_INTERVAL_MS);
4259
+ const timer = setInterval(() => void traceDaemonTimer("cloud_sync", tick), CLOUD_SYNC_INTERVAL_MS);
4072
4260
  timer.unref();
4073
- setTimeout(() => void tick(), 3e4);
4074
- process.stderr.write(`[exed] Cloud sync timer started (every ${CLOUD_SYNC_INTERVAL_MS / 6e4}m, backoff on failure)
4261
+ setTimeout(() => void traceDaemonTimer("cloud_sync", tick), 3e4);
4262
+ process.stderr.write(`[exed] Cloud sync timer started (every ${CLOUD_SYNC_INTERVAL_MS / 6e4}m, backoff on failure, child-process mode)
4075
4263
  `);
4076
4264
  }
4077
4265
  var SKILL_SWEEP_INTERVAL_MS = 60 * 60 * 1e3;
@@ -4087,10 +4275,16 @@ function shouldRunHeavyJob(name) {
4087
4275
  }
4088
4276
  return true;
4089
4277
  }
4278
+ var _skillSweepRunning = false;
4090
4279
  function startSkillSweep() {
4091
4280
  const tick = async () => {
4092
4281
  fired("skill_sweep");
4093
4282
  if (!shouldRunHeavyJob("skill_sweep")) return;
4283
+ if (_skillSweepRunning) {
4284
+ process.stderr.write("[exed] Skill sweep skipped: previous sweep still in progress\n");
4285
+ return;
4286
+ }
4287
+ _skillSweepRunning = true;
4094
4288
  try {
4095
4289
  const { loadConfig: lc } = await import("./config.js");
4096
4290
  const config = await lc();
@@ -4109,6 +4303,8 @@ function startSkillSweep() {
4109
4303
  } catch (err) {
4110
4304
  process.stderr.write(`[exed] Skill sweep error: ${err instanceof Error ? err.message : String(err)}
4111
4305
  `);
4306
+ } finally {
4307
+ _skillSweepRunning = false;
4112
4308
  }
4113
4309
  };
4114
4310
  const timer = setInterval(() => void traceDaemonTimer("skill_sweep", tick), SKILL_SWEEP_INTERVAL_MS);
@@ -4122,7 +4318,7 @@ function startSkillRefinement() {
4122
4318
  if (!shouldRunHeavyJob("skill_refinement")) return;
4123
4319
  try {
4124
4320
  if (!await ensureStoreForPolling()) return;
4125
- const { runSkillRefinement } = await import("../skill-refinement-YLIAY7V4.js");
4321
+ const { runSkillRefinement } = await import("../skill-refinement-QI35LMTZ.js");
4126
4322
  const result = await runSkillRefinement();
4127
4323
  if (result.reviewed > 0) {
4128
4324
  acted("skill_refinement");
@@ -4148,7 +4344,7 @@ function startStaleBranchSweep() {
4148
4344
  const tick = async () => {
4149
4345
  fired("stale_branch_sweep");
4150
4346
  try {
4151
- const { discoverRepoPaths } = await import("../worktree-sweep-KV4H4766.js");
4347
+ const { discoverRepoPaths } = await import("../worktree-sweep-GDISKGQ2.js");
4152
4348
  const { scanUnmergedBranches } = await import("../branch-hygiene-55TKIWAZ.js");
4153
4349
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
4154
4350
  for (const k of _staleBranchAlertedToday) {
@@ -4175,7 +4371,7 @@ function startStaleBranchSweep() {
4175
4371
  if (!_storeInitialized) continue;
4176
4372
  const stale = scan.branches.filter((b) => b.ageHours >= STALE_BRANCH_HOURS).slice(0, 5).map((b) => `${b.name} (+${b.ahead} commits, ${(b.ageHours / 24).toFixed(1)}d)`).join("; ");
4177
4373
  try {
4178
- const { writeNotification } = await import("../notifications-BBQ23ORD.js");
4374
+ const { writeNotification } = await import("../notifications-N5NKUYAU.js");
4179
4375
  await writeNotification({
4180
4376
  agentId: "exe",
4181
4377
  agentRole: "system",
@@ -4619,32 +4815,37 @@ function startReflectionSweep() {
4619
4815
  const tick = async () => {
4620
4816
  fired("reflection_sweep");
4621
4817
  if (_reflectionImportFailed) return;
4818
+ if (_reflectionSweepRunning) {
4819
+ process.stderr.write("[exed] Reflection sweep skipped: previous sweep still in progress\n");
4820
+ return;
4821
+ }
4622
4822
  if (!await ensureStoreForPolling()) return;
4823
+ _reflectionSweepRunning = true;
4623
4824
  try {
4624
- const { getClient } = await import("./database.js");
4625
- const client = getClient();
4626
- const agents = await client.execute(
4825
+ const { offloadReadQuery } = await import("./database.js");
4826
+ const agents = await offloadReadQuery(
4627
4827
  "SELECT DISTINCT agent_id FROM memory_cards WHERE active = 1 LIMIT 50"
4628
4828
  );
4629
4829
  let runReflection;
4630
4830
  try {
4631
- ({ runReflection } = await import("../memory-reflection-AYPJRPU7.js"));
4831
+ ({ runReflection } = await import("../memory-reflection-LANCFYK2.js"));
4632
4832
  } catch (importErr) {
4633
4833
  _reflectionImportFailed = true;
4634
4834
  process.stderr.write(`[exed] Reflection module unavailable (stale chunk hash?) \u2014 disabled until daemon restart: ${importErr instanceof Error ? importErr.message : String(importErr)}
4635
4835
  `);
4636
4836
  return;
4637
4837
  }
4838
+ const { runBudgetedSweep } = await import("../sweep-budget-WB2FKPYN.js");
4638
4839
  let totalInsights = 0;
4639
- for (const row of agents.rows) {
4640
- const agentId = row.agent_id;
4641
- try {
4840
+ await runBudgetedSweep(
4841
+ agents.rows,
4842
+ async (row) => {
4843
+ const agentId = row.agent_id;
4642
4844
  const result = await runReflection(agentId);
4643
4845
  totalInsights += result.contradictions + result.patterns + result.summaries;
4644
- } catch (e) {
4645
- process.stderr.write("[exe-daemon] reflection for agent " + agentId + ": " + (e instanceof Error ? e.message : String(e)) + "\n");
4646
- }
4647
- }
4846
+ },
4847
+ { label: "reflection_sweep" }
4848
+ );
4648
4849
  if (totalInsights > 0) {
4649
4850
  acted("reflection_sweep");
4650
4851
  process.stderr.write(`[exed] Reflection sweep: ${totalInsights} insights for ${agents.rows.length} agents
@@ -4653,13 +4854,14 @@ function startReflectionSweep() {
4653
4854
  } catch (err) {
4654
4855
  process.stderr.write(`[exed] Reflection sweep error: ${err instanceof Error ? err.message : String(err)}
4655
4856
  `);
4857
+ } finally {
4858
+ _reflectionSweepRunning = false;
4656
4859
  }
4657
4860
  };
4658
4861
  setTimeout(() => void traceDaemonTimer("memory_card_backfill", async () => {
4659
4862
  try {
4660
4863
  if (!await ensureStoreForPolling()) return;
4661
- const { getClient: gc, offloadReadQuery } = await import("./database.js");
4662
- const c = gc();
4864
+ const { offloadReadQuery } = await import("./database.js");
4663
4865
  const memCount = await offloadReadQuery("SELECT COUNT(*) as cnt FROM memories WHERE deleted_at IS NULL");
4664
4866
  const cardCount = await offloadReadQuery("SELECT COUNT(*) as cnt FROM memory_cards");
4665
4867
  const memories = Number(memCount.rows[0]?.cnt ?? 0);
@@ -4667,18 +4869,18 @@ function startReflectionSweep() {
4667
4869
  if (memories > 100 && cards < memories * 0.1) {
4668
4870
  process.stderr.write(`[exed] Memory cards sparse (${cards} cards / ${memories} memories) \u2014 running backfill...
4669
4871
  `);
4670
- const { insertMemoryCardsForBatch } = await import("../memory-cards-MGZ4P3AA.js");
4872
+ const { insertMemoryCardsForBatch } = await import("../memory-cards-6NGUDUDN.js");
4671
4873
  const batchSize = 500;
4672
4874
  let offset = 0;
4673
4875
  let totalCards = 0;
4674
4876
  while (true) {
4675
- const batch = await c.execute({
4676
- sql: `SELECT id, agent_id, session_id, project_name, timestamp, tool_name, raw_text
4877
+ const batch = await offloadReadQuery(
4878
+ `SELECT id, agent_id, session_id, project_name, timestamp, tool_name, raw_text
4677
4879
  FROM memories WHERE deleted_at IS NULL
4678
4880
  AND id NOT IN (SELECT DISTINCT memory_id FROM memory_cards)
4679
4881
  LIMIT ?`,
4680
- args: [batchSize]
4681
- });
4882
+ [batchSize]
4883
+ );
4682
4884
  if (batch.rows.length === 0) break;
4683
4885
  try {
4684
4886
  const inserted = await insertMemoryCardsForBatch(batch.rows);
@@ -4689,7 +4891,7 @@ function startReflectionSweep() {
4689
4891
  }
4690
4892
  offset += batch.rows.length;
4691
4893
  if (offset > 5e4) break;
4692
- if (offset % (batchSize * 5) === 0) await new Promise((r) => setTimeout(r, 100));
4894
+ await new Promise((r) => setImmediate(r));
4693
4895
  }
4694
4896
  if (totalCards > 0) {
4695
4897
  process.stderr.write(`[exed] Card backfill: ${totalCards} cards from ${offset} memories
@@ -4712,7 +4914,7 @@ function startDatabaseBackup() {
4712
4914
  fired("db_backup");
4713
4915
  if (!shouldRunHeavyJob("db_backup")) return;
4714
4916
  try {
4715
- const { createBackupAsync, enforceRetention, hasBackupToday } = await import("../db-backup-ITRADB2J.js");
4917
+ const { createBackupAsync, enforceRetention, hasBackupToday } = await import("../db-backup-XLID57KW.js");
4716
4918
  if (hasBackupToday("daily")) return;
4717
4919
  const backupPath = await createBackupAsync("daily");
4718
4920
  if (backupPath) {
@@ -4781,7 +4983,7 @@ function startSessionEventsRetention() {
4781
4983
  if (!await ensureStoreForPolling()) return;
4782
4984
  try {
4783
4985
  const { getClient } = await import("./database.js");
4784
- const { sweepExpiredSessionEvents, DEFAULT_SESSION_EVENTS_RETENTION_DAYS } = await import("../session-events-D52HNUJK.js");
4986
+ const { sweepExpiredSessionEvents, DEFAULT_SESSION_EVENTS_RETENTION_DAYS } = await import("../session-events-WQHTP65R.js");
4785
4987
  const days = SESSION_EVENTS_RETENTION_DAYS ?? DEFAULT_SESSION_EVENTS_RETENTION_DAYS;
4786
4988
  const count = await sweepExpiredSessionEvents(getClient(), days);
4787
4989
  if (count > 0) {
@@ -4811,9 +5013,14 @@ function startIntercomQueueDrain() {
4811
5013
  const tick = async () => traceDaemonTimer("intercom_queue_drain", async () => {
4812
5014
  fired("intercom_queue_drain");
4813
5015
  try {
4814
- const { drainQueue, readQueue } = await import("../intercom-queue-6M5IRX3Y.js");
4815
- const { isSessionBusy } = await import("./tmux-routing.js");
4816
- const { baseAgentName } = await import("./employees.js");
5016
+ const { drainQueue, readQueue } = await import("../intercom-queue-ZCNT4LYU.js");
5017
+ const {
5018
+ isSessionBusy,
5019
+ sendIntercom: centralSendIntercom,
5020
+ decideQueuedNudgeDrain,
5021
+ countScopedPendingReviews
5022
+ } = await import("./tmux-routing.js");
5023
+ const { baseAgentName, getCoordinatorName } = await import("./employees.js");
4817
5024
  const agentsWithEmptyInbox = /* @__PURE__ */ new Set();
4818
5025
  try {
4819
5026
  const queue = readQueue();
@@ -4832,24 +5039,38 @@ function startIntercomQueueDrain() {
4832
5039
  }
4833
5040
  } catch {
4834
5041
  }
4835
- const { sendIntercom: centralSendIntercom } = await import("./tmux-routing.js");
5042
+ const pendingReviewCounts = /* @__PURE__ */ new Map();
5043
+ {
5044
+ const queue = readQueue();
5045
+ const reviewTargets = new Set(
5046
+ queue.filter((q) => q.intercomReason === "completion" || q.intercomReason === "notification").map((q) => q.targetSession)
5047
+ );
5048
+ for (const target of reviewTargets) {
5049
+ const reviewer = target.includes("-") ? baseAgentName(target.split("-")[0] ?? target) : getCoordinatorName();
5050
+ const count = await countScopedPendingReviews(target, reviewer);
5051
+ if (count !== null) pendingReviewCounts.set(target, count);
5052
+ }
5053
+ }
4836
5054
  const result = drainQueue(
4837
5055
  (session) => isSessionBusy(session),
4838
5056
  (session, item) => {
4839
5057
  try {
4840
- if (item.intercomReason === "message") {
4841
- const agentRaw = session.split("-")[0] ?? session;
4842
- const agent = baseAgentName(agentRaw);
4843
- if (agentsWithEmptyInbox.has(agent)) {
4844
- process.stderr.write(`[exe-daemon] skipping stale message intercom for ${session} (inbox empty)
5058
+ const agentRaw = session.split("-")[0] ?? session;
5059
+ const agent = baseAgentName(agentRaw);
5060
+ const decision = decideQueuedNudgeDrain(item.intercomReason, {
5061
+ hasUnreadMessages: !agentsWithEmptyInbox.has(agent),
5062
+ pendingReviewCount: pendingReviewCounts.get(session) ?? null,
5063
+ hasInProgressTask: false
5064
+ });
5065
+ if (decision.action === "drop") {
5066
+ process.stderr.write(`[exe-daemon] dropping stale ${item.intercomReason ?? "nudge"} intercom for ${session} (${decision.reason})
4845
5067
  `);
4846
- return true;
4847
- }
5068
+ return true;
4848
5069
  }
4849
5070
  const outcome = centralSendIntercom(session, {
4850
5071
  reason: item.intercomReason ?? "nudge"
4851
5072
  });
4852
- return outcome !== "failed";
5073
+ return outcome === "delivered" || outcome === "debounced" || outcome === "skipped_exe";
4853
5074
  } catch (e) {
4854
5075
  process.stderr.write("[exe-daemon] intercom send to " + session + ": " + (e instanceof Error ? e.message : String(e)) + "\n");
4855
5076
  return false;
@@ -4877,7 +5098,7 @@ function startOrphanReaper() {
4877
5098
  const tick = async () => traceDaemonTimer("orphan_reaper", async () => {
4878
5099
  fired("orphan_reaper");
4879
5100
  try {
4880
- const { reapOrphanedMcpProcesses, createOrphanReaperRealDepsAsync } = await import("../daemon-orchestration-JI3RD5EZ.js");
5101
+ const { reapOrphanedMcpProcesses, createOrphanReaperRealDepsAsync } = await import("../daemon-orchestration-IBP6PWEG.js");
4881
5102
  const deps = await createOrphanReaperRealDepsAsync();
4882
5103
  const reaped = await reapOrphanedMcpProcesses(deps);
4883
5104
  if (reaped.length > 0) acted("orphan_reaper");
@@ -4902,7 +5123,7 @@ function startZombieAgentReaper() {
4902
5123
  const tick = async () => traceDaemonTimer("zombie_agent_reaper", async () => {
4903
5124
  fired("zombie_agent_reaper");
4904
5125
  try {
4905
- const { reapZombieAgentProcesses, createZombieAgentReaperRealDepsAsync } = await import("../daemon-orchestration-JI3RD5EZ.js");
5126
+ const { reapZombieAgentProcesses, createZombieAgentReaperRealDepsAsync } = await import("../daemon-orchestration-IBP6PWEG.js");
4906
5127
  const deps = await createZombieAgentReaperRealDepsAsync();
4907
5128
  const reaped = reapZombieAgentProcesses(deps);
4908
5129
  if (reaped.length > 0) acted("zombie_agent_reaper");
@@ -4926,7 +5147,7 @@ async function startDaemonMemoryPressureWatchdog() {
4926
5147
  try {
4927
5148
  const cfg = await getCachedConfig();
4928
5149
  if (!cfg) return;
4929
- const { startMemoryPressureWatchdog: startWatchdog, MEMORY_PRESSURE_WATCHDOG_DEFAULTS } = await import("../memory-pressure-watchdog-6PFLEOUO.js");
5150
+ const { startMemoryPressureWatchdog: startWatchdog, MEMORY_PRESSURE_WATCHDOG_DEFAULTS } = await import("../memory-pressure-watchdog-45GABDWH.js");
4930
5151
  const watchdogCfg = {
4931
5152
  ...MEMORY_PRESSURE_WATCHDOG_DEFAULTS,
4932
5153
  ...cfg.memoryPressureWatchdog ?? {}
@@ -4957,7 +5178,7 @@ function startWorktreeReaper() {
4957
5178
  const tick = async () => traceDaemonTimer("worktree_reaper", async () => {
4958
5179
  fired("worktree_reaper");
4959
5180
  try {
4960
- const { reapOrphanedWorktrees, createWorktreeReaperRealDeps } = await import("../daemon-orchestration-JI3RD5EZ.js");
5181
+ const { reapOrphanedWorktrees, createWorktreeReaperRealDeps } = await import("../daemon-orchestration-IBP6PWEG.js");
4961
5182
  const deps = await createWorktreeReaperRealDeps();
4962
5183
  const result = await reapOrphanedWorktrees(deps);
4963
5184
  if (result.pruned.length > 0) {
@@ -4997,8 +5218,8 @@ function startWorktreeReaper() {
4997
5218
  }
4998
5219
  continue;
4999
5220
  }
5000
- const { cleanupAgentWorktree } = await import("../worktree-sweep-KV4H4766.js");
5001
- const { getMainRepoRoot } = await import("../worktree-OYGDGJP7.js");
5221
+ const { cleanupAgentWorktree } = await import("../worktree-sweep-GDISKGQ2.js");
5222
+ const { getMainRepoRoot } = await import("../worktree-72QYYL5L.js");
5002
5223
  const repoRoot = getMainRepoRoot(signal.worktreePath);
5003
5224
  if (repoRoot && signal.agentId) {
5004
5225
  const notes = cleanupAgentWorktree(repoRoot, signal.agentId);
@@ -5031,7 +5252,7 @@ function startAutoWake() {
5031
5252
  if (!await ensureStoreForPolling()) return;
5032
5253
  try {
5033
5254
  const { getClient } = await import("./database.js");
5034
- const { pollOrphanedTasks, createAutoWakeRealDeps } = await import("../daemon-orchestration-JI3RD5EZ.js");
5255
+ const { pollOrphanedTasks, createAutoWakeRealDeps } = await import("../daemon-orchestration-IBP6PWEG.js");
5035
5256
  const deps = createAutoWakeRealDeps(getClient, process.cwd());
5036
5257
  const woken = await pollOrphanedTasks(deps);
5037
5258
  if (woken.length > 0) acted("auto_wake");
@@ -5082,7 +5303,7 @@ function startAutoWake() {
5082
5303
  if (age > 60 * 60 * 1e3) {
5083
5304
  try {
5084
5305
  unlinkSync2(signalPath);
5085
- void import("../orchestration-events-O5P5NEKS.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
5306
+ void import("../orchestration-events-KVNRNIPR.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
5086
5307
  recordOE({ eventType: "signal.stale", source: "exe-daemon.autoWake", severity: "warn", payload: { file, ageMinutes: Math.round(age / 6e4) } });
5087
5308
  }).catch(() => {
5088
5309
  });
@@ -5142,7 +5363,7 @@ function startWalCheckpoint() {
5142
5363
  try {
5143
5364
  const { getClient, runWalCheckpoint } = await import("./database.js");
5144
5365
  const client = getClient();
5145
- const { findActiveDb } = await import("../db-backup-ITRADB2J.js");
5366
+ const { findActiveDb } = await import("../db-backup-XLID57KW.js");
5146
5367
  const dbPath = findActiveDb();
5147
5368
  const started = Date.now();
5148
5369
  const result = await runWalCheckpoint(client, dbPath, true);
@@ -5214,7 +5435,7 @@ function startStuckTaskRelease() {
5214
5435
  if (!await ensureStoreForPolling()) return;
5215
5436
  try {
5216
5437
  const { getClient } = await import("./database.js");
5217
- const { releaseStuckTasks, createStuckTaskRealDeps } = await import("../daemon-orchestration-JI3RD5EZ.js");
5438
+ const { releaseStuckTasks, createStuckTaskRealDeps } = await import("../daemon-orchestration-IBP6PWEG.js");
5218
5439
  const deps = createStuckTaskRealDeps(getClient);
5219
5440
  const released = await releaseStuckTasks(deps);
5220
5441
  if (released.length > 0) {
@@ -5401,12 +5622,12 @@ function startTaskEnforcementScanner() {
5401
5622
  const tick = async () => traceDaemonTimer("task_enforcement", async () => {
5402
5623
  fired("task_enforcement");
5403
5624
  try {
5404
- const { runTaskEnforcementTick } = await import("../task-enforcement-L4YTDOOX.js");
5625
+ const { runTaskEnforcementTick } = await import("../task-enforcement-DMOCBRLB.js");
5405
5626
  const { getTransport } = await import("./transport.js");
5406
5627
  const { loadAgentConfig } = await import("./agent-config.js");
5407
5628
  const { getClient } = await import("./database.js");
5408
5629
  const { loadEmployeesSync } = await import("./employees.js");
5409
- const { sessionScopeFilter } = await import("../task-scope-OIHLMQOQ.js");
5630
+ const { sessionScopeFilter } = await import("../task-scope-ULBNFBFH.js");
5410
5631
  const transport = getTransport();
5411
5632
  const { sessions: allSessions, paneCache, aliveSessions } = await getSharedOrchestrationCaches();
5412
5633
  await yieldToEventLoop();
@@ -5417,10 +5638,10 @@ function startTaskEnforcementScanner() {
5417
5638
  sendKeysLiteral: transport.sendKeysLiteral?.bind(transport),
5418
5639
  isAlive: (session) => aliveSessions.has(session)
5419
5640
  };
5420
- const { checkAutoWakeGates } = await import("../daemon-orchestration-JI3RD5EZ.js");
5641
+ const { checkAutoWakeGates } = await import("../daemon-orchestration-IBP6PWEG.js");
5421
5642
  const { ensureEmployeeAsync, employeeSessionName } = await import("./tmux-routing.js");
5422
5643
  const { shouldAutoInstance } = await import("./employees.js");
5423
- const { recordOrchestrationEventBestEffort } = await import("../orchestration-events-O5P5NEKS.js");
5644
+ const { recordOrchestrationEventBestEffort } = await import("../orchestration-events-KVNRNIPR.js");
5424
5645
  const projectDir = process.cwd();
5425
5646
  await runTaskEnforcementTick({
5426
5647
  transport: enforcementTransport,
@@ -5739,6 +5960,18 @@ function handleSignalShutdown() {
5739
5960
  }
5740
5961
  process.on("SIGINT", handleSignalShutdown);
5741
5962
  process.on("SIGTERM", handleSignalShutdown);
5963
+ process.on("exit", (code) => {
5964
+ if (_bootPhase === "ready") return;
5965
+ try {
5966
+ logDaemonHealth({
5967
+ event: "boot_abort",
5968
+ pid: process.pid,
5969
+ message: `daemon exited during boot (phase=${_bootPhase}, code=${code}) before reaching ready`,
5970
+ data: { phase: _bootPhase, exitCode: code, uptimeMs: Date.now() - _startedAt2 }
5971
+ });
5972
+ } catch {
5973
+ }
5974
+ });
5742
5975
  var _staleDistRe = /(?:ERR_MODULE_NOT_FOUND|Cannot find module)[^\n]*dist[\\/]/i;
5743
5976
  var _staleDistRestartRequested = false;
5744
5977
  function isStaleDistChunkError(reason) {
@@ -6098,7 +6331,7 @@ if (process.platform === "darwin") {
6098
6331
  logBoot({ socketPath: SOCKET_PATH, pidPath: PID_PATH });
6099
6332
  void (async () => {
6100
6333
  try {
6101
- const { cleanupCrashDebris } = await import("../db-backup-ITRADB2J.js");
6334
+ const { cleanupCrashDebris } = await import("../db-backup-XLID57KW.js");
6102
6335
  const removed = cleanupCrashDebris();
6103
6336
  if (removed > 0) {
6104
6337
  process.stderr.write(`[exed] Startup cleanup: pruned ${removed} crash-debris file(s) (backups/quarantine).
@@ -6264,7 +6497,7 @@ function startEventLoopLagDetector() {
6264
6497
  const msg = `[exed] EVENT LOOP BLOCKED ${(lag / 1e3).toFixed(1)}s \u2014 MCP UNRESPONSIVE. Sessions will die.`;
6265
6498
  process.stderr.write(msg + "\n");
6266
6499
  logDaemonHealth({ event: "event_loop_blocked", pid: process.pid, message: msg, data: { lagMs: lag } });
6267
- void import("../orchestration-events-O5P5NEKS.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
6500
+ void import("../orchestration-events-KVNRNIPR.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
6268
6501
  recordOE({ eventType: "daemon.event_loop_blocked", source: "exe-daemon.lagDetector", severity: "error", durationMs: lag });
6269
6502
  }).catch(() => {
6270
6503
  });
@@ -6391,7 +6624,7 @@ function startTaskFileResync() {
6391
6624
  });
6392
6625
  if (Number(res.rowsAffected ?? 0) > 0) {
6393
6626
  synced++;
6394
- void import("../orchestration-events-O5P5NEKS.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
6627
+ void import("../orchestration-events-KVNRNIPR.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
6395
6628
  recordOE({
6396
6629
  eventType: "task_file.resynced",
6397
6630
  source: "exe-daemon.taskFileResync",
@@ -6428,7 +6661,7 @@ function startTaskGroupBarriers() {
6428
6661
  fired("task_group_barriers");
6429
6662
  if (!await ensureStoreForPolling()) return;
6430
6663
  try {
6431
- const { pollTaskGroupBarriers } = await import("../daemon-orchestration-JI3RD5EZ.js");
6664
+ const { pollTaskGroupBarriers } = await import("../daemon-orchestration-IBP6PWEG.js");
6432
6665
  const firedCount = await pollTaskGroupBarriers();
6433
6666
  if (firedCount > 0) {
6434
6667
  acted("task_group_barriers");
@@ -6450,7 +6683,7 @@ function startCheckpointGc() {
6450
6683
  fired("checkpoint_gc");
6451
6684
  if (!await ensureStoreForPolling()) return;
6452
6685
  try {
6453
- const { gcStaleCheckpoints } = await import("../daemon-orchestration-JI3RD5EZ.js");
6686
+ const { gcStaleCheckpoints } = await import("../daemon-orchestration-IBP6PWEG.js");
6454
6687
  const cleared = await gcStaleCheckpoints();
6455
6688
  if (cleared > 0) {
6456
6689
  acted("checkpoint_gc");
@@ -6490,14 +6723,14 @@ function startDispatchAckCleanup() {
6490
6723
  function startProjectionWorkerDeferred() {
6491
6724
  setTimeout(async () => {
6492
6725
  try {
6493
- const { startProjectionWorker } = await import("../projection-worker-K6TILAZH.js");
6726
+ const { startProjectionWorker } = await import("../projection-worker-FG6G226D.js");
6494
6727
  startProjectionWorker();
6495
6728
  } catch {
6496
6729
  }
6497
6730
  }, 2e4);
6498
6731
  }
6499
6732
  async function startToolTelemetry() {
6500
- const { startToolTelemetryFlush } = await import("../tool-telemetry-AQTFWOWG.js");
6733
+ const { startToolTelemetryFlush } = await import("../tool-telemetry-OEK6KQFF.js");
6501
6734
  startToolTelemetryFlush();
6502
6735
  process.stderr.write("[exed] Tool telemetry started (flush every 5m)\n");
6503
6736
  }
@@ -6549,12 +6782,31 @@ function startLocalFirstTimers() {
6549
6782
  fired("session_registry_consistency");
6550
6783
  try {
6551
6784
  const liveTmux = await getTmuxSessionsAsync();
6552
- const { cleanupDeadSessions, checkSessionRegistryConsistency } = await import("./session-registry.js");
6785
+ const { cleanupDeadSessions, checkSessionRegistryConsistency, reapOrphanedCoordinatorSessions } = await import("./session-registry.js");
6553
6786
  const cleaned = cleanupDeadSessions(liveTmux);
6554
6787
  if (cleaned.pruned > 0) {
6555
6788
  acted("session_registry_consistency");
6556
6789
  process.stderr.write(
6557
6790
  `[exed] Session registry reaped ${cleaned.pruned} ghost session(s) (dead PID + absent tmux): ${cleaned.removed.slice(0, 10).join(", ")}
6791
+ `
6792
+ );
6793
+ }
6794
+ const paneCommands = await getPaneCommandsAsync();
6795
+ const { getTransport: getTransportForReap } = await import("./transport.js");
6796
+ const orphanReap = reapOrphanedCoordinatorSessions({
6797
+ liveTmux,
6798
+ paneHasLiveAgent: (s) => coordinatorPaneHasLiveAgent(s, paneCommands),
6799
+ killTmux: (s) => {
6800
+ try {
6801
+ getTransportForReap().kill(s, s);
6802
+ } catch {
6803
+ }
6804
+ }
6805
+ });
6806
+ if (orphanReap.orphaned.length > 0) {
6807
+ acted("session_registry_consistency");
6808
+ process.stderr.write(
6809
+ `[exed] Reaped ${orphanReap.orphaned.length} orphaned coordinator session(s) (live shell, dead agent): ${orphanReap.orphaned.slice(0, 10).join(", ")} (deregistered=${orphanReap.deregistered.length}, killed=${orphanReap.killed.length})
6558
6810
  `
6559
6811
  );
6560
6812
  }
@@ -6643,7 +6895,7 @@ function startLocalFirstTimers() {
6643
6895
  fired("orphan_task_cleanup");
6644
6896
  try {
6645
6897
  if (!await ensureStoreForPolling()) return;
6646
- const { cleanOrphanedTaskFiles } = await import("../tasks-crud-QUIIRWE3.js");
6898
+ const { cleanOrphanedTaskFiles } = await import("../tasks-crud-6SJOKES5.js");
6647
6899
  const count = await cleanOrphanedTaskFiles();
6648
6900
  if (count > 0) {
6649
6901
  acted("orphan_task_cleanup");
@@ -6659,7 +6911,7 @@ function startLocalFirstTimers() {
6659
6911
  fired("task_file_consistency");
6660
6912
  try {
6661
6913
  if (!await ensureStoreForPolling()) return;
6662
- const { checkTaskFileConsistency } = await import("../tasks-crud-QUIIRWE3.js");
6914
+ const { checkTaskFileConsistency } = await import("../tasks-crud-6SJOKES5.js");
6663
6915
  const mismatches = await checkTaskFileConsistency();
6664
6916
  if (mismatches > 0) {
6665
6917
  acted("task_file_consistency");
@@ -6678,7 +6930,7 @@ function startLocalFirstTimers() {
6678
6930
  const TELEMETRY_DAILY_MS = 24 * 60 * 60 * 1e3;
6679
6931
  const telemetryDaily = async () => {
6680
6932
  try {
6681
- const { sendTelemetry, isTelemetryEnabled } = await import("../telemetry-upload-XLDBCD7B.js");
6933
+ const { sendTelemetry, isTelemetryEnabled } = await import("../telemetry-upload-6XB3Q3IH.js");
6682
6934
  if (!isTelemetryEnabled()) return;
6683
6935
  const { upstream } = await sendTelemetry(24);
6684
6936
  if (upstream.startsWith("sent")) {
@@ -6813,6 +7065,7 @@ try {
6813
7065
  } else {
6814
7066
  startLocalFirstTimers();
6815
7067
  }
7068
+ setBootPhase("ready");
6816
7069
  runSmokeTests().catch((err) => {
6817
7070
  process.stderr.write(`[exed] Smoke tests failed to run: ${err instanceof Error ? err.message : String(err)}
6818
7071
  `);