@askexenow/exe-os 0.9.359 → 0.9.362

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 (451) hide show
  1. package/deploy/compose/docker-compose.yml +7 -1
  2. package/deploy/compose/generate-env.ts +23 -4
  3. package/deploy/compose/sso-edge/default.conf.template +35 -0
  4. package/deploy/compose/sso-edge/sso-redirect.conf +23 -2
  5. package/deploy/stack-manifests/v0.9.json +228 -2
  6. package/dist/.dist-verified.json +3 -3
  7. package/dist/{active-agent-DMKNHGSG.js → active-agent-3FV5V7SS.js} +9 -8
  8. package/dist/{active-agent-Y3DCBD7J.js → active-agent-BPNEBKHI.js} +9 -8
  9. package/dist/{agentic-ontology-3233PNKV.js → agentic-ontology-RCVCJ6WB.js} +1 -1
  10. package/dist/{backfill-gate-DA7UT6UD.js → backfill-gate-LRX77SUD.js} +3 -2
  11. package/dist/{backfill-metadata-4DS4A5U3.js → backfill-metadata-Y3DGVCK5.js} +12 -11
  12. package/dist/{background-jobs-XGTLESKM.js → background-jobs-Z6KHCWES.js} +3 -2
  13. package/dist/{backup-verify-JNYKXIU2.js → backup-verify-TZPPUCLU.js} +5 -4
  14. package/dist/{behavior-injection-CGAMI552.js → behavior-injection-JMGGWCWG.js} +21 -13
  15. package/dist/{behaviors-57AMN5IP.js → behaviors-TT6CMEKC.js} +20 -12
  16. package/dist/bin/age-ontology-load.js +3 -2
  17. package/dist/bin/agentic-ontology-backfill.js +14 -13
  18. package/dist/bin/agentic-reflection-backfill.js +15 -14
  19. package/dist/bin/agentic-semantic-label.js +14 -13
  20. package/dist/bin/backfill-conversations.js +16 -14
  21. package/dist/bin/backfill-responses.js +16 -14
  22. package/dist/bin/backfill-vectors.js +20 -18
  23. package/dist/bin/bulk-sync-postgres.js +27 -24
  24. package/dist/bin/cc-doctor.js +13 -11
  25. package/dist/bin/cleanup-stale-review-tasks.js +31 -28
  26. package/dist/bin/cli.js +157 -47
  27. package/dist/bin/customer-readiness.js +10 -1
  28. package/dist/bin/deferred-daemon-restart.js +127 -104
  29. package/dist/bin/exe-agent-config.js +9 -8
  30. package/dist/bin/exe-agent.js +17 -16
  31. package/dist/bin/exe-assign.js +18 -16
  32. package/dist/bin/exe-boot.js +62 -49
  33. package/dist/bin/exe-call.js +10 -9
  34. package/dist/bin/exe-cloud.js +29 -26
  35. package/dist/bin/exe-config-dump.js +9 -8
  36. package/dist/bin/exe-dispatch.js +31 -28
  37. package/dist/bin/exe-doctor.js +14 -10
  38. package/dist/bin/exe-export-behaviors.js +22 -14
  39. package/dist/bin/exe-forget.js +14 -13
  40. package/dist/bin/exe-gateway.js +13 -12
  41. package/dist/bin/exe-grant.js +6 -6
  42. package/dist/bin/exe-healthcheck.js +13 -11
  43. package/dist/bin/exe-heartbeat.js +33 -30
  44. package/dist/bin/exe-kill.js +36 -33
  45. package/dist/bin/exe-launch-agent.js +126 -44
  46. package/dist/bin/exe-mcp.js +165 -1
  47. package/dist/bin/exe-memory-reads.js +12 -11
  48. package/dist/bin/exe-new-employee.js +20 -17
  49. package/dist/bin/exe-os-mcp-proxy.js +9 -8
  50. package/dist/bin/exe-pending-messages.js +32 -29
  51. package/dist/bin/exe-pending-notifications.js +31 -28
  52. package/dist/bin/exe-pending-reviews.js +31 -28
  53. package/dist/bin/exe-preflight.js +1 -1
  54. package/dist/bin/exe-rename.js +10 -9
  55. package/dist/bin/exe-review.js +35 -32
  56. package/dist/bin/exe-search.js +13 -12
  57. package/dist/bin/exe-session-cleanup.js +36 -33
  58. package/dist/bin/exe-settings.js +28 -25
  59. package/dist/bin/exe-start-codex.js +27 -19
  60. package/dist/bin/exe-start-opencode.js +23 -15
  61. package/dist/bin/exe-start.sh +11 -7
  62. package/dist/bin/exe-status.js +32 -29
  63. package/dist/bin/exe-support.js +5 -4
  64. package/dist/bin/exe-team.js +9 -8
  65. package/dist/bin/exe-watchdog.js +115 -30
  66. package/dist/bin/git-sweep.js +32 -29
  67. package/dist/bin/graph-backfill.js +14 -13
  68. package/dist/bin/graph-export.js +13 -12
  69. package/dist/bin/import-history.js +16 -15
  70. package/dist/bin/install.js +392 -201
  71. package/dist/bin/intercom-check.js +4 -4
  72. package/dist/bin/mcp-sessions.js +2 -2
  73. package/dist/bin/orchestration-metrics.js +10 -9
  74. package/dist/bin/postgres-agentic-reflection-backfill.js +5 -4
  75. package/dist/bin/postgres-agentic-semantic-backfill.js +4 -3
  76. package/dist/bin/reconcile-backlog.js +2 -2
  77. package/dist/bin/registry-proxy.js +1 -1
  78. package/dist/bin/scan-tasks.js +31 -28
  79. package/dist/bin/setup.js +7 -4
  80. package/dist/bin/shard-migrate.js +13 -12
  81. package/dist/bin/stack-update.js +45 -14
  82. package/dist/bin/update.js +4 -3
  83. package/dist/bin/vps-health-gate.js +1 -1
  84. package/dist/{boot-generation-4D3CTT7X.js → boot-generation-XABYKF5P.js} +9 -8
  85. package/dist/{boot-review-sections-NDFE5443.js → boot-review-sections-2X5TFIGU.js} +30 -27
  86. package/dist/{branch-hygiene-HNSOUDJE.js → branch-hygiene-Z4IBWAOX.js} +2 -1
  87. package/dist/{branding-6FHWZQYQ.js → branding-7MZDHTKN.js} +3 -2
  88. package/dist/build-manifest.json +1249 -1069
  89. package/dist/{capability-cards-OBB7BMMX.js → capability-cards-O5UXDOOA.js} +8 -7
  90. package/dist/{capacity-monitor-QLPEL6S5.js → capacity-monitor-IPXM726A.js} +32 -29
  91. package/dist/{catchup-brief-EN7QR6MP.js → catchup-brief-EBIGDXOK.js} +36 -33
  92. package/dist/{chunk-WRP5AG4D.js → chunk-23KWUA7Z.js} +2 -2
  93. package/dist/{chunk-PDRIIEFV.js → chunk-2FA4PYYX.js} +1 -1
  94. package/dist/chunk-2PRAXZWM.js +261 -0
  95. package/dist/{chunk-R6LNQAUG.js → chunk-327Q53AS.js} +34 -1
  96. package/dist/{chunk-MBULOZJF.js → chunk-32FEF5BW.js} +2 -2
  97. package/dist/{chunk-2YGAKBRG.js → chunk-35FD67ZB.js} +3 -3
  98. package/dist/{chunk-R62ITJDQ.js → chunk-3C7NE4JE.js} +1 -1
  99. package/dist/{chunk-YBX3G5OP.js → chunk-3ICF4IAZ.js} +1 -1
  100. package/dist/{chunk-CVTWQZOR.js → chunk-3L2QU5ZF.js} +14 -2
  101. package/dist/{chunk-I5AVZOL2.js → chunk-3YBJ36UX.js} +2 -2
  102. package/dist/{chunk-NKDKB2RT.js → chunk-465RCKVI.js} +6 -6
  103. package/dist/{chunk-QROIFRKI.js → chunk-4AFD4R35.js} +5 -5
  104. package/dist/{chunk-OSID72CN.js → chunk-4L33OFU4.js} +25 -1
  105. package/dist/{chunk-A6VIK3SS.js → chunk-4P2BFNSB.js} +2 -2
  106. package/dist/{chunk-SIGAQQHW.js → chunk-4R2WD6T3.js} +2 -2
  107. package/dist/{chunk-HPHF5VTT.js → chunk-4U56FZ7B.js} +4 -4
  108. package/dist/{chunk-2KLVTRY2.js → chunk-54USDN5Q.js} +1 -1
  109. package/dist/{chunk-CAEWPEBA.js → chunk-5C6ZIJ7J.js} +1 -1
  110. package/dist/{chunk-46RPEWTH.js → chunk-5H3RHWRE.js} +1 -1
  111. package/dist/chunk-5OPAUFLP.js +126 -0
  112. package/dist/{chunk-EHM4E62N.js → chunk-6DTALXOA.js} +1 -1
  113. package/dist/chunk-6EM6USV7.js +1332 -0
  114. package/dist/{chunk-JE34CB5H.js → chunk-6N3HUOV3.js} +2 -2
  115. package/dist/{chunk-6KREY2Q7.js → chunk-6QJXFLNN.js} +5 -5
  116. package/dist/{chunk-G37RG543.js → chunk-6UZDGEGQ.js} +1 -1
  117. package/dist/{chunk-APR556TY.js → chunk-6Y3KUO7Q.js} +190 -29
  118. package/dist/{chunk-2EAYZ3BK.js → chunk-7H3AZNQ7.js} +9 -9
  119. package/dist/{chunk-C5YZMYQH.js → chunk-7SY2NOMQ.js} +1 -1
  120. package/dist/{chunk-OAYTQ4RY.js → chunk-AL4HXKDJ.js} +55 -12
  121. package/dist/{chunk-VY5VU7SX.js → chunk-AOMFYUPT.js} +2 -2
  122. package/dist/{chunk-EX2SSLNU.js → chunk-AQO3BT3I.js} +12 -12
  123. package/dist/chunk-ARX6TAGN.js +102 -0
  124. package/dist/chunk-B6PFGUYJ.js +159 -0
  125. package/dist/{chunk-FASR2WLT.js → chunk-BDLRTLXY.js} +1 -1
  126. package/dist/chunk-BJEQBKGH.js +218 -0
  127. package/dist/{chunk-BCZF3AGJ.js → chunk-BRIZ6OZ3.js} +34 -44
  128. package/dist/{chunk-OMXJMOBD.js → chunk-BRZR76TS.js} +66 -0
  129. package/dist/{chunk-XV42EAVK.js → chunk-BT2PUK3S.js} +1 -1
  130. package/dist/{chunk-6EOLGE7T.js → chunk-CVYDJ2TW.js} +1 -1
  131. package/dist/{chunk-WCP4OQUL.js → chunk-CXQ724WH.js} +2 -2
  132. package/dist/{chunk-F3QTF4T7.js → chunk-CY5NVDTH.js} +3 -3
  133. package/dist/{chunk-3ODATKWH.js → chunk-D5CY4E7I.js} +1 -1
  134. package/dist/{chunk-W5YV2PZE.js → chunk-DKRDU2AX.js} +16 -16
  135. package/dist/{chunk-SNWV44E5.js → chunk-DSKEYEL2.js} +12 -5
  136. package/dist/{chunk-VXL7PJ56.js → chunk-E3YI6FVJ.js} +5 -24
  137. package/dist/{chunk-6SK4MM5B.js → chunk-E7PL3T2U.js} +1 -1
  138. package/dist/{chunk-IOEUAQWP.js → chunk-EEZOBN6X.js} +1 -1
  139. package/dist/{chunk-AHMUF6RO.js → chunk-G2M7WQ2M.js} +0 -2
  140. package/dist/{chunk-SKGMF2SO.js → chunk-GBNB4EWD.js} +22 -1
  141. package/dist/{chunk-UZ5RJYL3.js → chunk-HAXCUCJC.js} +1 -1
  142. package/dist/{chunk-VMR6M6GN.js → chunk-HISFWAAK.js} +1 -1
  143. package/dist/{chunk-DKRSKC5R.js → chunk-HKQ7UTSE.js} +1 -1
  144. package/dist/chunk-HLQ4MS42.js +257 -0
  145. package/dist/{chunk-EA5FVACM.js → chunk-HLU52KTO.js} +29 -18
  146. package/dist/{chunk-QWVXN224.js → chunk-HPXFKUGU.js} +350 -65
  147. package/dist/{chunk-2OVTGZYH.js → chunk-HSKABJE6.js} +46 -3
  148. package/dist/{chunk-NE57GONM.js → chunk-I3SF6QGV.js} +1 -1
  149. package/dist/chunk-J6KMGEJW.js +238 -0
  150. package/dist/chunk-JKKZGDLP.js +182 -0
  151. package/dist/{chunk-3ZEVMZ4G.js → chunk-JYKZVAS6.js} +1 -1
  152. package/dist/{chunk-4DYJ6NOK.js → chunk-KA4WVDLX.js} +2 -2
  153. package/dist/{chunk-QH2XAUZ5.js → chunk-KBI4FVBZ.js} +1 -1
  154. package/dist/{chunk-VAY6IXWY.js → chunk-KDMVVHZH.js} +1 -1
  155. package/dist/{chunk-4FQIWAXA.js → chunk-KID6T2A4.js} +10 -10
  156. package/dist/{chunk-HNPHPGGF.js → chunk-KIKB6FY3.js} +2 -2
  157. package/dist/{chunk-STFR72YH.js → chunk-LCDW2HUL.js} +1 -1
  158. package/dist/{chunk-RFUTLZ2U.js → chunk-LG37UBBE.js} +4 -4
  159. package/dist/{chunk-3QWOO74G.js → chunk-LLZNPOGB.js} +97 -3
  160. package/dist/chunk-M67ARGXY.js +175 -0
  161. package/dist/chunk-MPVXHYD5.js +85 -0
  162. package/dist/{chunk-RXL7A7JH.js → chunk-MZYNW5OY.js} +1 -1
  163. package/dist/{chunk-DQ75MEPU.js → chunk-MZZN5GFC.js} +1 -1
  164. package/dist/{chunk-X2F6Q7TW.js → chunk-NAHCSQWT.js} +1 -1
  165. package/dist/{chunk-AL7JMA54.js → chunk-NE4QI2GX.js} +2 -2
  166. package/dist/chunk-NGDXBN3M.js +254 -0
  167. package/dist/{chunk-HDSDXGLV.js → chunk-NO5KHKKB.js} +1 -1
  168. package/dist/chunk-NOKJCF27.js +437 -0
  169. package/dist/{chunk-PLOEFBFW.js → chunk-O32HTNRX.js} +3 -3
  170. package/dist/{chunk-UPM5JP6G.js → chunk-OZNCAMS3.js} +47 -4
  171. package/dist/{chunk-XLEYCOHX.js → chunk-P7CV4SHQ.js} +398 -58
  172. package/dist/{chunk-G2KK64UB.js → chunk-PDJWHL63.js} +101 -19
  173. package/dist/{chunk-W3XUU36X.js → chunk-PF7EQSE5.js} +5 -5
  174. package/dist/{chunk-QX7RWICL.js → chunk-PU7UYQRC.js} +1 -1
  175. package/dist/{chunk-A5WEEND7.js → chunk-PUMH7JSB.js} +3 -3
  176. package/dist/{chunk-POZGQQEZ.js → chunk-PV5BIXT6.js} +1 -1
  177. package/dist/{chunk-TG7JYSEA.js → chunk-Q2VQNAPU.js} +5 -2
  178. package/dist/{chunk-Z2PAVJJ4.js → chunk-Q7J2SQJ6.js} +127 -29
  179. package/dist/{chunk-4JERP7NT.js → chunk-QAEWWYHL.js} +29 -1
  180. package/dist/{chunk-6JTKIXLU.js → chunk-QCJT265O.js} +1 -1
  181. package/dist/{chunk-OY2PWHYR.js → chunk-QI25QRUP.js} +2 -2
  182. package/dist/chunk-QILQ5FCG.js +198 -0
  183. package/dist/{chunk-LRETL4I3.js → chunk-QJBX3MBV.js} +3 -3
  184. package/dist/{chunk-57GRYGDU.js → chunk-QP53XLC5.js} +1 -1
  185. package/dist/{chunk-JBAMYKBL.js → chunk-QQMYD4M7.js} +1 -1
  186. package/dist/{chunk-SHEWTDPC.js → chunk-QY3TM2T3.js} +4 -4
  187. package/dist/{chunk-WA2MJGPT.js → chunk-QYRI25IP.js} +3 -3
  188. package/dist/{chunk-QLFN3MUW.js → chunk-RCOIKTHM.js} +1 -1
  189. package/dist/{chunk-ITRKRKS7.js → chunk-RFKRCVGW.js} +1 -1
  190. package/dist/{chunk-HK7SQDKJ.js → chunk-RNSAVQEU.js} +2 -2
  191. package/dist/{chunk-44WFVMZ5.js → chunk-RUUX2ZST.js} +1 -1
  192. package/dist/{chunk-DWKH2H7W.js → chunk-RWKX2TK5.js} +1 -1
  193. package/dist/{chunk-MCNDZU5W.js → chunk-RYRNY6IF.js} +2 -2
  194. package/dist/{chunk-5I3YC7ER.js → chunk-SC6WDF3Q.js} +2 -2
  195. package/dist/chunk-SLBOKYYQ.js +197 -0
  196. package/dist/{chunk-74R44E4S.js → chunk-SQM4ZTL2.js} +246 -96
  197. package/dist/{chunk-KIXNMTGC.js → chunk-SRFRUN66.js} +5 -5
  198. package/dist/chunk-SXKIGBNF.js +61 -0
  199. package/dist/chunk-T2RZU7JA.js +2607 -0
  200. package/dist/{chunk-2I23RPSI.js → chunk-TKDITWDN.js} +9 -0
  201. package/dist/{chunk-5UAMBMNR.js → chunk-TN2E6ZCM.js} +44 -34
  202. package/dist/{chunk-SQBNN44X.js → chunk-TP7RXGMP.js} +49 -15
  203. package/dist/{chunk-GSVQBBE5.js → chunk-TY4JLBFO.js} +2 -2
  204. package/dist/{chunk-7QRMFYOV.js → chunk-UHPMK6QZ.js} +17 -3
  205. package/dist/{chunk-LPKTGK7L.js → chunk-UO5QJ2RX.js} +4 -4
  206. package/dist/{chunk-VCCZQDCU.js → chunk-URNVIZXU.js} +3 -3
  207. package/dist/{chunk-OIS5VIAH.js → chunk-UWEFIIEG.js} +6 -2
  208. package/dist/{chunk-IQWAYXVF.js → chunk-V5I5N7NC.js} +3 -3
  209. package/dist/{chunk-GD7VXXW6.js → chunk-V6YLIDLK.js} +801 -180
  210. package/dist/chunk-VAOUB2TK.js +23 -0
  211. package/dist/{chunk-XVTKJEI2.js → chunk-VDMFVUSY.js} +3 -3
  212. package/dist/{chunk-RJ67HG2P.js → chunk-VWTUKKUF.js} +4 -4
  213. package/dist/{chunk-4WSUP4CC.js → chunk-W3LKIQJ2.js} +43 -17
  214. package/dist/{chunk-EUQF3JOH.js → chunk-WBG7XYVR.js} +1 -1
  215. package/dist/{chunk-YKRNH5LU.js → chunk-WH2VVEGD.js} +1 -1
  216. package/dist/{chunk-NP2Y7P3I.js → chunk-WP2TGH5R.js} +1 -1
  217. package/dist/chunk-WT4RI36X.js +23 -0
  218. package/dist/{chunk-LXG37RB2.js → chunk-XJIRUTGJ.js} +1 -1
  219. package/dist/chunk-XRCX6R5S.js +57 -0
  220. package/dist/{chunk-XWWNRFRF.js → chunk-XSYQ5EPE.js} +11 -11
  221. package/dist/{chunk-HKK7LLS5.js → chunk-XTGR3LMF.js} +34 -3
  222. package/dist/{chunk-HLEZ5O5P.js → chunk-XUB4GFPN.js} +17 -15
  223. package/dist/chunk-YZUHSV24.js +277 -0
  224. package/dist/{chunk-6WHYSLGF.js → chunk-Z67DIJKT.js} +1 -1
  225. package/dist/{chunk-6LY3QSJA.js → chunk-ZI3HA3XW.js} +11 -6
  226. package/dist/{chunk-YEOIPUFO.js → chunk-ZR4CQBAP.js} +1 -1
  227. package/dist/{chunk-VNK3MNZE.js → chunk-ZZEKOI2M.js} +1 -1
  228. package/dist/{cleanup-graph-garbage-XFGY4EEE.js → cleanup-graph-garbage-6F22Y5SD.js} +13 -12
  229. package/dist/{cloud-sync-shutdown-XCOATIJW.js → cloud-sync-shutdown-FWERMZB5.js} +8 -7
  230. package/dist/{co-activation-XNBLOGK3.js → co-activation-UEEDCM5U.js} +8 -7
  231. package/dist/{co-occurrence-HO4PGQC4.js → co-occurrence-W6OPFRSY.js} +11 -10
  232. package/dist/{code-context-index-5RY66SWZ.js → code-context-index-DWR6HS35.js} +7 -5
  233. package/dist/consent-passphrase-Z64GFJXK.js +23 -0
  234. package/dist/{conversation-entity-extractor-5G5DGRJU.js → conversation-entity-extractor-LWUIH3UB.js} +3 -3
  235. package/dist/{conversation-wiki-populator-RZKG6PK4.js → conversation-wiki-populator-5EGRW2UZ.js} +1 -1
  236. package/dist/{crdt-sync-6TD7LSZW.js → crdt-sync-NHJX3ZJD.js} +5 -4
  237. package/dist/{crm-webhook-WZAV5776.js → crm-webhook-OY467ATC.js} +2 -2
  238. package/dist/{cto-delegation-gate-UHMYFM4D.js → cto-delegation-gate-XH4YSQVC.js} +30 -27
  239. package/dist/{daemon-auth-SXZHLUYS.js → daemon-auth-OCHW2U6B.js} +3 -2
  240. package/dist/{daemon-orchestration-DT5M2ZAR.js → daemon-orchestration-7425ZVNH.js} +35 -32
  241. package/dist/{daemon-ready-56VAPZU6.js → daemon-ready-VGPSRI3Z.js} +1 -1
  242. package/dist/{daemon-restart-circuit-breaker-5V6B6NLS.js → daemon-restart-circuit-breaker-SMTWFX27.js} +25 -3
  243. package/dist/db-backend-ODVJ3Q3D.js +7 -0
  244. package/dist/{db-restore-events-ZLD2HRQV.js → db-restore-events-TFCZ4CPM.js} +2 -1
  245. package/dist/{doc-graph-extractor-FNCYPFKY.js → doc-graph-extractor-RR2VSO4W.js} +11 -10
  246. package/dist/{documents-GKDZDUED.js → documents-TRZ4R2ZW.js} +18 -16
  247. package/dist/dreaming-MAMZAPYW.js +63 -0
  248. package/dist/{exe-drift-QTKD2FHT.js → exe-drift-VBWB5E6S.js} +9 -8
  249. package/dist/{exe-export-ESJ6KP6J.js → exe-export-XJJTVVT7.js} +21 -13
  250. package/dist/{exe-import-N4X3GEQB.js → exe-import-G6O7JFNZ.js} +21 -13
  251. package/dist/{exe-key-KZCCHX3W.js → exe-key-A2WJLLTM.js} +116 -99
  252. package/dist/exe-org-HXF4XBB3.js +672 -0
  253. package/dist/{exe-snapshot-SCRPHCPZ.js → exe-snapshot-TL3TLKLR.js} +38 -33
  254. package/dist/{fast-db-init-6H67K76Q.js → fast-db-init-SO2XUQ7T.js} +1 -1
  255. package/dist/{founder-context-C7X7IRDA.js → founder-context-IOCADC66.js} +4 -3
  256. package/dist/{founder-monitor-envelope-DHSUMBWU.js → founder-monitor-envelope-SMILO4BT.js} +7 -5
  257. package/dist/gateway/index.js +23 -22
  258. package/dist/{gateway-client-7LMZKHTH.js → gateway-client-JA2BH7QO.js} +1 -1
  259. package/dist/{git-staleness-JCKVMWPO.js → git-staleness-I6WT7EXV.js} +8 -7
  260. package/dist/{global-procedures-BR7WGSE7.js → global-procedures-3RMO6C3C.js} +9 -8
  261. package/dist/{graph-auto-extract-EOXWQRBZ.js → graph-auto-extract-NKTYPD2I.js} +11 -10
  262. package/dist/{graph-rag-5FVC5JXH.js → graph-rag-EOGPZOYI.js} +3 -3
  263. package/dist/{hook-integrity-TYGDD7OE.js → hook-integrity-RTBF2BL2.js} +1 -1
  264. package/dist/{hook-prefetch-2CN3MK4H.js → hook-prefetch-V5KCGW2N.js} +31 -28
  265. package/dist/hooks/bug-report-worker.js +35 -32
  266. package/dist/hooks/codex-stop-task-finalizer.js +36 -33
  267. package/dist/hooks/commit-complete.js +34 -31
  268. package/dist/hooks/error-recall.js +16 -15
  269. package/dist/hooks/exe-heartbeat-hook.js +10 -9
  270. package/dist/hooks/ingest-worker.js +12 -10
  271. package/dist/hooks/ingest.js +19 -18
  272. package/dist/hooks/instructions-loaded.js +11 -10
  273. package/dist/hooks/manifest.json +20 -20
  274. package/dist/hooks/notification.js +11 -10
  275. package/dist/hooks/post-compact.js +11 -115
  276. package/dist/hooks/post-tool-combined.js +11 -11
  277. package/dist/hooks/pre-compact.js +38 -64
  278. package/dist/hooks/pre-tool-use.js +95 -36
  279. package/dist/hooks/prompt-submit.js +50 -47
  280. package/dist/hooks/session-end.js +39 -36
  281. package/dist/hooks/session-start.js +64 -18
  282. package/dist/hooks/stop.js +40 -37
  283. package/dist/hooks/subagent-stop.js +35 -32
  284. package/dist/hooks/summary-worker.js +41 -38
  285. package/dist/index.js +45 -42
  286. package/dist/inrun-inbox-DRKVDPLY.js +29 -0
  287. package/dist/{installer-VPNTM3X6.js → installer-G67M3DME.js} +11 -10
  288. package/dist/{installer-YDLSXGD2.js → installer-L3ZKMOPU.js} +11 -10
  289. package/dist/{installer-7UV3CNWZ.js → installer-QBWZSYDG.js} +11 -10
  290. package/dist/{intercom-queue-KHKJJYCQ.js → intercom-queue-R5LSXD3V.js} +30 -27
  291. package/dist/{key-backup-status-YMS7YGWO.js → key-backup-status-3RC6XTUX.js} +2 -1
  292. package/dist/lib/agent-config.js +3 -2
  293. package/dist/lib/cloud-sync.js +27 -24
  294. package/dist/lib/config.js +6 -1
  295. package/dist/lib/consolidation.js +14 -13
  296. package/dist/lib/crypto.js +4 -3
  297. package/dist/lib/database.js +8 -7
  298. package/dist/lib/db-backup.js +4 -3
  299. package/dist/lib/db-checkpoint-worker.js +1 -1
  300. package/dist/lib/db-daemon-client.js +7 -5
  301. package/dist/lib/db-read-worker-client.js +1 -1
  302. package/dist/lib/db-read-worker.js +1 -1
  303. package/dist/lib/db-write-worker-client.js +4 -2
  304. package/dist/lib/db-write-worker.js +21 -3
  305. package/dist/lib/db.js +8 -7
  306. package/dist/lib/device-registry.js +3 -2
  307. package/dist/lib/embed-worker.js +2 -1
  308. package/dist/lib/embedder.js +7 -5
  309. package/dist/lib/employee-templates.js +10 -9
  310. package/dist/lib/employees.js +8 -7
  311. package/dist/lib/error-detector.js +1 -1
  312. package/dist/lib/exe-daemon-client.js +16 -6
  313. package/dist/lib/exe-daemon.js +342 -168
  314. package/dist/lib/hybrid-search.js +13 -12
  315. package/dist/lib/identity-templates.js +3 -1
  316. package/dist/lib/identity.js +8 -7
  317. package/dist/lib/keychain.js +41 -3
  318. package/dist/lib/license.js +12 -3
  319. package/dist/lib/messaging.js +31 -28
  320. package/dist/lib/platform-support.js +25 -0
  321. package/dist/lib/post-tool-memory.js +6 -4
  322. package/dist/lib/preflight.js +29 -0
  323. package/dist/lib/registry-proxy.js +1 -1
  324. package/dist/lib/reminders.js +9 -8
  325. package/dist/lib/schedules.js +13 -12
  326. package/dist/lib/session-registry.js +10 -9
  327. package/dist/lib/session-wrappers.js +7 -3
  328. package/dist/lib/skill-learning.js +21 -13
  329. package/dist/lib/status-brief.js +8 -3
  330. package/dist/lib/store.js +12 -11
  331. package/dist/lib/task-router.js +9 -8
  332. package/dist/lib/tasks.js +32 -29
  333. package/dist/lib/tmux-routing.js +45 -29
  334. package/dist/lib/tmux-status.js +7 -3
  335. package/dist/lib/token-spend.js +9 -8
  336. package/dist/lib/ws-client.js +1 -1
  337. package/dist/{license-gate-YXUSNA2I.js → license-gate-6R3F3NQR.js} +5 -4
  338. package/dist/{license-sync-XFDOXL3Z.js → license-sync-VBJCXBAP.js} +4 -3
  339. package/dist/linux-systemd-LRW3BYSS.js +38 -0
  340. package/dist/mailbox-inbox-CP2VRBXZ.js +10 -0
  341. package/dist/mailbox-outbox-HXI7DYNC.js +19 -0
  342. package/dist/mcp/register-tools.js +110 -94
  343. package/dist/mcp/server.js +113 -97
  344. package/dist/mcp/tools/complete-reminder.js +10 -9
  345. package/dist/mcp/tools/create-reminder.js +10 -9
  346. package/dist/mcp/tools/create-task.js +38 -31
  347. package/dist/mcp/tools/deactivate-behavior.js +22 -14
  348. package/dist/mcp/tools/list-reminders.js +10 -9
  349. package/dist/mcp/tools/list-tasks.js +34 -31
  350. package/dist/mcp/tools/send-message.js +33 -30
  351. package/dist/mcp/tools/update-task.js +33 -30
  352. package/dist/{mcp-http-config-HIP5CEDV.js → mcp-http-config-BWX7AMAZ.js} +9 -8
  353. package/dist/{mcp-session-identity-RTNZ2ZLW.js → mcp-session-identity-GOBGICLI.js} +30 -27
  354. package/dist/{memory-cards-KG4TPNKK.js → memory-cards-4EXX3BQS.js} +12 -11
  355. package/dist/{memory-graph-extractor-6HTBLO2N.js → memory-graph-extractor-OYVZIJ3R.js} +12 -11
  356. package/dist/{memory-poisoning-defense-3ZT57RSJ.js → memory-poisoning-defense-AHOD2EBX.js} +8 -7
  357. package/dist/{memory-pressure-watchdog-ZOZBIMKC.js → memory-pressure-watchdog-COJC3OYS.js} +31 -28
  358. package/dist/{memory-queue-W54BYW7V.js → memory-queue-4VN3DTOE.js} +3 -2
  359. package/dist/memory-queue-client-OI4LDT4W.js +18 -0
  360. package/dist/{memory-reflection-EQC4FXSW.js → memory-reflection-V2SNAUIB.js} +8 -7
  361. package/dist/{monitor-grants-BDLVFVDR.js → monitor-grants-W3ISOLMC.js} +6 -4
  362. package/dist/{monitor-identity-GLFZSEAH.js → monitor-identity-AN3B5QIN.js} +3 -2
  363. package/dist/{notification-ledger-NZ4HO3M5.js → notification-ledger-J6Q2GAYU.js} +117 -53
  364. package/dist/{notifications-74YECZ4V.js → notifications-56TP36IK.js} +30 -27
  365. package/dist/{orchestration-events-KRQI4ED5.js → orchestration-events-CKQ756NA.js} +9 -8
  366. package/dist/{orchestration-phase-KVF42ZKU.js → orchestration-phase-ZJ4XVNFO.js} +3 -2
  367. package/dist/orchestrator-ERSQ3KNT.js +55 -0
  368. package/dist/org-brief-session-FSZ3QJDN.js +45 -0
  369. package/dist/org-consent-policy-BN7MKCZ2.js +68 -0
  370. package/dist/org-join-HTQ57JYH.js +35 -0
  371. package/dist/org-key-admin-4W6LZ5KZ.js +242 -0
  372. package/dist/org-key-pin-OTOKAELD.js +37 -0
  373. package/dist/{org-membership-B32NS5NI.js → org-membership-SML6GCHP.js} +11 -7
  374. package/dist/org-partner-config-XQGOB7EJ.js +25 -0
  375. package/dist/org-partner-runtime-RNNUL5IN.js +44 -0
  376. package/dist/org-row-visibility-JZFJ3YRJ.js +18 -0
  377. package/dist/{pipeline-router-6ZZV7JMA.js → pipeline-router-IUENNTAY.js} +9 -8
  378. package/dist/{plan-limits-B7AZKZ6U.js → plan-limits-ZUII366B.js} +11 -10
  379. package/dist/postinstall-failure-A7WTAXD6.js +20 -0
  380. package/dist/{project-boot-WEQSKDD7.js → project-boot-3DFY5F35.js} +7 -2
  381. package/dist/{projection-worker-LRFFQ6JB.js → projection-worker-MBWUPB5O.js} +5 -4
  382. package/dist/{prospective-memory-A4GDTIWG.js → prospective-memory-GHE5ORN4.js} +8 -7
  383. package/dist/push-notifications-PTQ5DHCD.js +60 -0
  384. package/dist/{reranker-YVTLJCFC.js → reranker-NUIGAPA3.js} +3 -2
  385. package/dist/{retrieval-health-PK2ODTXM.js → retrieval-health-XHCERQPG.js} +1 -1
  386. package/dist/{review-polling-JFWRNQF6.js → review-polling-CYBCBHZA.js} +31 -28
  387. package/dist/runtime/index.js +41 -38
  388. package/dist/{session-events-VMQBCUH3.js → session-events-X33W4JNA.js} +31 -28
  389. package/dist/{session-kill-telemetry-Z3W256T5.js → session-kill-telemetry-I2F5PUIW.js} +31 -28
  390. package/dist/session-lineage-AGOHSXIS.js +66 -0
  391. package/dist/{session-scope-2ADEVY3C.js → session-scope-WXP4F7OF.js} +30 -27
  392. package/dist/setup-wizard-2CTVITIX.js +35 -0
  393. package/dist/{shard-manager-DFLCDZT5.js → shard-manager-YEOHEOHL.js} +4 -3
  394. package/dist/{skill-refinement-APBYOSGX.js → skill-refinement-VDR5OT4V.js} +9 -8
  395. package/dist/{stack-promote-SZYIPTFT.js → stack-promote-XVC7FRJW.js} +6 -5
  396. package/dist/{stack-release-EYRDEGPD.js → stack-release-6PWAACRM.js} +101 -80
  397. package/dist/{stack-update-YWK2YXP6.js → stack-update-24VRBQ3U.js} +9 -4
  398. package/dist/{steward-gate-CIOBPNX6.js → steward-gate-2ZNYDVFO.js} +9 -8
  399. package/dist/{support-inbox-OAWGFRKW.js → support-inbox-ZHKLDETT.js} +5 -4
  400. package/dist/{task-enforcement-YAU6ZGDC.js → task-enforcement-GQDUTIFY.js} +37 -28
  401. package/dist/task-request-inbox-BFXNUU44.js +64 -0
  402. package/dist/{task-scope-44N7XP5N.js → task-scope-ERHPHLUM.js} +30 -27
  403. package/dist/{tasks-crud-IWVDREXG.js → tasks-crud-NVNF3NRA.js} +30 -27
  404. package/dist/tasks-notify-DXLU5VCT.js +60 -0
  405. package/dist/{tasks-review-VDFWFETP.js → tasks-review-BST6N34P.js} +30 -27
  406. package/dist/{telemetry-upload-3X5ESEKM.js → telemetry-upload-NY3EKOGY.js} +13 -12
  407. package/dist/{token-budget-WZGO22ME.js → token-budget-CLB3GUIX.js} +9 -8
  408. package/dist/{tool-capability-index-IFNZ6QUS.js → tool-capability-index-WZWVBI2R.js} +1 -1
  409. package/dist/{tool-telemetry-F7RWUNVK.js → tool-telemetry-PALAZUXT.js} +1 -1
  410. package/dist/tui/App.js +44 -41
  411. package/dist/{tui-data-KT7YGVQS.js → tui-data-CNFSRZP7.js} +30 -27
  412. package/dist/{typed-messages-TKDGVPHS.js → typed-messages-RCMPEKJN.js} +1 -1
  413. package/dist/{update-support-ZVRMECNQ.js → update-support-ZVB3CNGY.js} +24 -22
  414. package/dist/{work-state-heartbeat-CA4CN7DQ.js → work-state-heartbeat-O7UMB6SE.js} +1 -1
  415. package/dist/{worker-gate-52MVKYGZ.js → worker-gate-6DQQWDNB.js} +3 -2
  416. package/dist/{workflow-engine-ZAFBPVUP.js → workflow-engine-5ZULFH7O.js} +2 -2
  417. package/dist/{worktree-NNVXVV6A.js → worktree-ZWA35PKW.js} +10 -9
  418. package/dist/{worktree-sweep-IM2ZQG6Z.js → worktree-sweep-5LCVT46V.js} +11 -10
  419. package/package.json +8 -20
  420. package/postinstall.mjs +124 -0
  421. package/release-notes.json +18 -16
  422. package/stack.release.schema.json +4 -0
  423. package/dist/chunk-AFNRE2RV.js +0 -408
  424. package/dist/chunk-OSKWCKUC.js +0 -6
  425. package/dist/chunk-S3FIQCSM.js +0 -232
  426. package/dist/chunk-W6UB2AWP.js +0 -656
  427. package/dist/dreaming-WPMQJAXW.js +0 -60
  428. package/dist/exe-org-UK77DUU4.js +0 -73
  429. package/dist/memory-queue-client-RRNW2IFZ.js +0 -16
  430. package/dist/orchestrator-WV2YCHTK.js +0 -52
  431. package/dist/push-notifications-GOFTDDWW.js +0 -15
  432. package/dist/setup-wizard-26B36FMC.js +0 -14
  433. package/dist/tasks-notify-WK5HA77D.js +0 -57
  434. /package/dist/{chunk-YL2JH3XV.js → chunk-6C4UAKMS.js} +0 -0
  435. /package/dist/{chunk-YMCIZCNK.js → chunk-BN26LSME.js} +0 -0
  436. /package/dist/{chunk-WTH4CSAP.js → chunk-DFQEUZSI.js} +0 -0
  437. /package/dist/{chunk-FVWI2AR4.js → chunk-FIPUVCKC.js} +0 -0
  438. /package/dist/{chunk-ZMYXQU4L.js → chunk-L4LPJMPV.js} +0 -0
  439. /package/dist/{chunk-COHHVCFA.js → chunk-UELGUVNL.js} +0 -0
  440. /package/dist/{chunk-U7RZIY74.js → chunk-X7LY3IOB.js} +0 -0
  441. /package/dist/{chunk-BGYCUZYK.js → chunk-YAZ5ECEG.js} +0 -0
  442. /package/dist/{chunk-DSGFX3RT.js → chunk-YWN3XMPU.js} +0 -0
  443. /package/dist/{chunk-YMUZWC33.js → chunk-YYB5PMTK.js} +0 -0
  444. /package/dist/{core-memory-AATZRQEY.js → core-memory-BZFPVS43.js} +0 -0
  445. /package/dist/{entity-boost-HLFG2CH3.js → entity-boost-VXXED26D.js} +0 -0
  446. /package/dist/{memory-isolation-CF6FYSXD.js → memory-isolation-3PIOWLYP.js} +0 -0
  447. /package/dist/{message-queue-client-AX6KQK7T.js → message-queue-client-5XW7ZOK2.js} +0 -0
  448. /package/dist/{oauth-server-VE5ELXTF.js → oauth-server-KW5M437C.js} +0 -0
  449. /package/dist/{webhook-pipe-A4X4SCMW.js → webhook-pipe-QJRFZVKA.js} +0 -0
  450. /package/dist/{wiki-acl-GNIXYWHJ.js → wiki-acl-RXFV5OEU.js} +0 -0
  451. /package/dist/{wiki-client-7RRYRSPS.js → wiki-client-57QWZIHQ.js} +0 -0
@@ -1,13 +1,14 @@
1
1
  import {
2
+ RESTART_BREAKER_THRESHOLD,
2
3
  readBreakerAlert,
3
4
  recordDaemonRestart,
4
5
  restartBootsInWindow,
5
6
  restartBreakerAlertPath,
6
7
  writeDaemonExitBreadcrumb
7
- } from "../chunk-S3FIQCSM.js";
8
+ } from "../chunk-NOKJCF27.js";
8
9
  import {
9
10
  pushNotifyAsync
10
- } from "../chunk-TG7JYSEA.js";
11
+ } from "../chunk-Q2VQNAPU.js";
11
12
  import {
12
13
  isDbVerifyStampFresh
13
14
  } from "../chunk-SVFNWBLF.js";
@@ -16,8 +17,9 @@ import {
16
17
  isDbWriteWorkerReady,
17
18
  isWriteWorkerEnabled,
18
19
  spawnDbWriteWorker,
20
+ sweepSessionEventsRetentionInWorker,
19
21
  writeMemoryInWorker
20
- } from "../chunk-7QRMFYOV.js";
22
+ } from "../chunk-UHPMK6QZ.js";
21
23
  import {
22
24
  shouldScheduleDaemonRestartHandoff
23
25
  } from "../chunk-PWRC5XZO.js";
@@ -29,7 +31,7 @@ import {
29
31
  getMcpToolFamily,
30
32
  inferMcpRuntime,
31
33
  recordMcpHttpEvent
32
- } from "../chunk-ITRKRKS7.js";
34
+ } from "../chunk-RFKRCVGW.js";
33
35
  import {
34
36
  deserializeArgs,
35
37
  serializeResultSet
@@ -41,30 +43,52 @@ import {
41
43
  findScopedDuplicate,
42
44
  governMemoryRecord,
43
45
  schedulePostWriteMemoryHygiene
44
- } from "../chunk-FVWI2AR4.js";
46
+ } from "../chunk-FIPUVCKC.js";
45
47
  import "../chunk-5MOYSU5A.js";
46
48
  import "../chunk-4QCFFW2H.js";
47
49
  import "../chunk-76CJBM36.js";
48
50
  import {
49
51
  BUSY_PATTERN
50
- } from "../chunk-OSKWCKUC.js";
52
+ } from "../chunk-SQM4ZTL2.js";
53
+ import "../chunk-5C6ZIJ7J.js";
54
+ import "../chunk-SXKIGBNF.js";
55
+ import "../chunk-BT2PUK3S.js";
51
56
  import {
52
57
  recordTimerPauseMs,
53
58
  runWithTimerPauseAccounting,
54
59
  sweepPauseTotalMs
55
60
  } from "../chunk-KI5PFRG6.js";
61
+ import "../chunk-WT4RI36X.js";
62
+ import "../chunk-Z67DIJKT.js";
63
+ import "../chunk-E23LNUWJ.js";
64
+ import "../chunk-QAEWWYHL.js";
65
+ import "../chunk-EIKATSE4.js";
66
+ import "../chunk-D5CY4E7I.js";
67
+ import "../chunk-UXLO7VHX.js";
68
+ import "../chunk-DSOQUQTV.js";
69
+ import "../chunk-GBNB4EWD.js";
70
+ import "../chunk-PV5BIXT6.js";
71
+ import "../chunk-AJIXH5JF.js";
72
+ import "../chunk-KDMVVHZH.js";
73
+ import "../chunk-AM7S2TY6.js";
74
+ import "../chunk-CY5NVDTH.js";
75
+ import "../chunk-CVYC6DUW.js";
76
+ import "../chunk-4P2BFNSB.js";
77
+ import "../chunk-MZYNW5OY.js";
78
+ import "../chunk-OPU3NYOO.js";
56
79
  import {
57
80
  attributeSignalSource,
58
81
  consumeRestartIntentDetail,
82
+ isRestartCooldownActive,
59
83
  logRestartEvent,
60
- requestRestart
61
- } from "../chunk-AFNRE2RV.js";
84
+ noteRestartAttempt
85
+ } from "../chunk-6EM6USV7.js";
62
86
  import {
63
87
  assessInitialBindIdentity,
64
88
  ensureDaemonToken,
65
89
  reconcileSessionAgentIdentity,
66
90
  shouldEnforceSessionIdentity
67
- } from "../chunk-VMR6M6GN.js";
91
+ } from "../chunk-HISFWAAK.js";
68
92
  import {
69
93
  DAEMON_RSS_RESTART_DEBOUNCE,
70
94
  DAEMON_RSS_STARTUP_GRACE_MS,
@@ -81,6 +105,11 @@ import {
81
105
  resolveEmbedWorkerRssKillMb,
82
106
  shouldRestartForRss
83
107
  } from "../chunk-NLEW62VC.js";
108
+ import "../chunk-HYZV25LY.js";
109
+ import "../chunk-GJV3WDWM.js";
110
+ import "../chunk-MP2AFCGL.js";
111
+ import "../chunk-HLU52KTO.js";
112
+ import "../chunk-TKDITWDN.js";
84
113
  import {
85
114
  logBoot,
86
115
  logCrash,
@@ -88,9 +117,12 @@ import {
88
117
  logHeartbeat,
89
118
  logShutdown
90
119
  } from "../chunk-BBMTVAE3.js";
120
+ import "../chunk-5YEUPUV4.js";
121
+ import "../chunk-Q7J2SQJ6.js";
91
122
  import {
92
123
  isPostgresBackendEnabled
93
- } from "../chunk-YMUZWC33.js";
124
+ } from "../chunk-YYB5PMTK.js";
125
+ import "../chunk-BRZR76TS.js";
94
126
  import {
95
127
  getEventLoopLagMs,
96
128
  isEventLoopDegraded,
@@ -106,13 +138,19 @@ import {
106
138
  import {
107
139
  EMBEDDING_DIM
108
140
  } from "../chunk-FXU7JOXK.js";
141
+ import "../chunk-WNBZJSQT.js";
142
+ import "../chunk-HSKABJE6.js";
143
+ import "../chunk-3ICF4IAZ.js";
144
+ import "../chunk-QILQ5FCG.js";
145
+ import "../chunk-ARX6TAGN.js";
109
146
  import {
110
147
  EXE_AI_DIR,
111
148
  MODELS_DIR,
112
149
  loadConfigSync,
113
150
  resolveEmbedModelFile
114
- } from "../chunk-BCZF3AGJ.js";
151
+ } from "../chunk-BRIZ6OZ3.js";
115
152
  import "../chunk-HSGBZSCA.js";
153
+ import "../chunk-JKKZGDLP.js";
116
154
  import "../chunk-MLKGABMK.js";
117
155
 
118
156
  // src/lib/exe-daemon.ts
@@ -122,7 +160,7 @@ import v8 from "v8";
122
160
  import { createServer as createHttpServer, request as httpRequest } from "http";
123
161
  import { randomUUID, timingSafeEqual } from "crypto";
124
162
  import { writeFileSync as writeFileSync5, unlinkSync as unlinkSync4, mkdirSync as mkdirSync5, existsSync as existsSync7, readFileSync as readFileSync6, chmodSync as chmodSync2, readdirSync as readdirSync2, renameSync as renameSync2, statSync as statSync4 } from "fs";
125
- import { writeFile } from "fs/promises";
163
+ import { access, appendFile, mkdir, readdir, readFile, rename, stat, unlink, writeFile } from "fs/promises";
126
164
  import { execSync as execSyncNode, execFile as execFileNode } from "child_process";
127
165
  import { promisify } from "util";
128
166
 
@@ -160,15 +198,15 @@ import { fileURLToPath } from "url";
160
198
 
161
199
  // src/lib/dist-drift.ts
162
200
  import { readdirSync } from "fs";
163
- function listDistChunkFiles(distDir, readdir = readdirSync) {
201
+ function listDistChunkFiles(distDir, readdir2 = readdirSync) {
164
202
  try {
165
- return readdir(distDir).filter((f) => typeof f === "string" && f.endsWith(".js")).sort();
203
+ return readdir2(distDir).filter((f) => typeof f === "string" && f.endsWith(".js")).sort();
166
204
  } catch {
167
205
  return [];
168
206
  }
169
207
  }
170
- function snapshotDist(distDir, pkgVersion, readdir = readdirSync) {
171
- return { version: pkgVersion, chunks: listDistChunkFiles(distDir, readdir) };
208
+ function snapshotDist(distDir, pkgVersion, readdir2 = readdirSync) {
209
+ return { version: pkgVersion, chunks: listDistChunkFiles(distDir, readdir2) };
172
210
  }
173
211
  function detectDistDrift(boot, current) {
174
212
  const versionChanged = boot.version !== "unknown" && current.version !== "unknown" && boot.version !== current.version;
@@ -190,6 +228,14 @@ function detectDistDrift(boot, current) {
190
228
  import { fork, spawn as spawn2 } from "child_process";
191
229
  import { Worker } from "worker_threads";
192
230
 
231
+ // src/lib/embed-oom-classify.ts
232
+ function isEmbedWorkerExitOom(exit) {
233
+ if (exit.code === 134) return true;
234
+ if (exit.signal === "SIGABRT") return true;
235
+ if (exit.signal === "SIGKILL") return exit.killReason === "rss-oom";
236
+ return false;
237
+ }
238
+
193
239
  // src/lib/daemon-sql-guard.ts
194
240
  var DAEMON_READ_SQL_RE = /^\s*(SELECT|WITH|EXPLAIN\s+QUERY\s+PLAN|EXPLAIN)\b/i;
195
241
  var DAEMON_WRITE_SQL_RE = /^\s*(INSERT|UPDATE|DELETE|REPLACE)\b/i;
@@ -445,8 +491,8 @@ var CloudSyncChildStderrLog = class {
445
491
  maybeRotate() {
446
492
  try {
447
493
  if (!existsSync2(this.logPath)) return;
448
- const stat = statSync(this.logPath);
449
- if (stat.size > this.maxLogSize) {
494
+ const stat2 = statSync(this.logPath);
495
+ if (stat2.size > this.maxLogSize) {
450
496
  try {
451
497
  renameSync(this.logPath, `${this.logPath}.1`);
452
498
  } catch {
@@ -874,6 +920,14 @@ function dispatchSelfHealRestart(lagMs, trigger, deps) {
874
920
  deps.writeBreadcrumb(lagMs, trigger);
875
921
  deps.shutdown(75);
876
922
  }
923
+ function dispatchDistSelfHealRestart(kind, reason, deps) {
924
+ const cooldown = deps.isCooldownActive();
925
+ if (cooldown.active) return false;
926
+ deps.noteRestartAttempt();
927
+ deps.writeBreadcrumb(kind, reason);
928
+ deps.shutdown(75, reason, kind);
929
+ return true;
930
+ }
877
931
  function resolveSelfHealThresholds(env = process.env) {
878
932
  return {
879
933
  singleMs: parseFloat(env.EXE_SELF_HEAL_SINGLE_MS ?? "") || 12e4,
@@ -1310,6 +1364,7 @@ var PACKAGE_JSON_PATH = (() => {
1310
1364
  var BOOT_DIST_SNAPSHOT = snapshotDist(DIST_DIR, PACKAGE_VERSION);
1311
1365
  var _embedWorker = null;
1312
1366
  var _embedWorkerReady = false;
1367
+ var _embedWorkerKillReason = null;
1313
1368
  var _embedLoadDeferrals = 0;
1314
1369
  var _embeddingsDisabledByDesign = false;
1315
1370
  var _embedConsecutiveTimeouts = 0;
@@ -1717,6 +1772,74 @@ function recordExitBreadcrumb(kind, exitCode, reason, extra) {
1717
1772
  };
1718
1773
  writeDaemonExitBreadcrumb(info);
1719
1774
  }
1775
+ var _restartHandoffScheduled = false;
1776
+ function scheduleRestartHandoff(exitCode, reason) {
1777
+ if (_restartHandoffScheduled) return;
1778
+ if (!shouldScheduleDaemonRestartHandoff(exitCode, reason)) return;
1779
+ _restartHandoffScheduled = true;
1780
+ try {
1781
+ const moduleDir = path4.dirname(fileURLToPath(import.meta.url));
1782
+ const helperPath = path4.resolve(moduleDir, "../bin/daemon-restart-handoff.js");
1783
+ const daemonPath = fileURLToPath(import.meta.url);
1784
+ const logPath = path4.join(EXE_AI_DIR, "logs", "exed.log");
1785
+ const lockPath = path4.join(EXE_AI_DIR, "exed-spawn.lock");
1786
+ const heapCapMb = computeDaemonHeapCapMb(os3.totalmem() / (1024 * 1024 * 1024));
1787
+ const config = {
1788
+ oldPid: process.pid,
1789
+ daemonPath,
1790
+ pidPath: PID_PATH,
1791
+ socketPath: SOCKET_PATH,
1792
+ lockPath,
1793
+ logPath,
1794
+ heapCapMb
1795
+ };
1796
+ const child = spawn2(process.execPath, [helperPath], {
1797
+ detached: true,
1798
+ stdio: "ignore",
1799
+ env: {
1800
+ ...process.env,
1801
+ EXE_DAEMON_HANDOFF_CONFIG: JSON.stringify(config)
1802
+ }
1803
+ });
1804
+ child.unref();
1805
+ process.stderr.write(`[exed] Restart handoff helper scheduled (pid ${child.pid ?? "unknown"}).
1806
+ `);
1807
+ } catch (e) {
1808
+ process.stderr.write(`[exed] Restart handoff helper schedule failed: ${e instanceof Error ? e.message : String(e)}
1809
+ `);
1810
+ }
1811
+ }
1812
+ var DIST_SELF_HEAL_DEPS = {
1813
+ isCooldownActive: () => {
1814
+ const cooldown = isRestartCooldownActive();
1815
+ if (cooldown.active) {
1816
+ process.stderr.write(
1817
+ `[exed] Dist self-heal deferred \u2014 restart cooldown active (${Math.round(cooldown.remainingMs / 1e3)}s left).
1818
+ `
1819
+ );
1820
+ logRestartEvent("self_heal_deferred", { remaining_ms: cooldown.remainingMs });
1821
+ }
1822
+ return cooldown;
1823
+ },
1824
+ // Stamp BEFORE exiting: the stamp must outlive this process to bound the next one.
1825
+ noteRestartAttempt: () => {
1826
+ noteRestartAttempt();
1827
+ },
1828
+ writeBreadcrumb: (restartKind, reason) => {
1829
+ recordExitBreadcrumb("self_heal", 75, reason, { restartKind });
1830
+ },
1831
+ shutdown: (code, reason, restartKind) => {
1832
+ void shutdown(code, reason, restartKind);
1833
+ },
1834
+ // Never called. Present so the seam's "never the external killer" invariant is
1835
+ // observable in tests/lib/dist-self-heal-routing.test.ts.
1836
+ killExternal: (reason) => {
1837
+ throw new Error(`dist self-heal must never use the external-killer path (reason: ${reason})`);
1838
+ }
1839
+ };
1840
+ function selfHealRestartForDist(restartKind, reason) {
1841
+ return dispatchDistSelfHealRestart(restartKind, reason, DIST_SELF_HEAL_DEPS);
1842
+ }
1720
1843
  function recordSelfHealBreadcrumb(lagMs, trigger) {
1721
1844
  const blk = _lastBlockingTimer && Date.now() - _lastBlockingTimer.ts < 6e4 ? _lastBlockingTimer : null;
1722
1845
  recordExitBreadcrumb("self_heal", 75, `self_heal_event_loop_lag:${trigger}`, {
@@ -2244,7 +2367,15 @@ async function loadModel() {
2244
2367
  _embedWorkerReady = false;
2245
2368
  _embedWorker = null;
2246
2369
  if (_shuttingDown) return;
2247
- const oomShaped = code === 134 || signal === "SIGKILL" || signal === "SIGABRT";
2370
+ const killReason = _embedWorkerKillReason;
2371
+ _embedWorkerKillReason = null;
2372
+ const oomShaped = isEmbedWorkerExitOom({ code, signal, killReason });
2373
+ if (signal === "SIGKILL" && !oomShaped) {
2374
+ process.stderr.write(
2375
+ `[exed] Embed worker SIGKILLed (reason=${killReason ?? "external/unattributed"}) \u2014 NOT treated as OOM; no OOM marker written (bug d53013c9). Respawn/backoff proceeds normally.
2376
+ `
2377
+ );
2378
+ }
2248
2379
  if (oomShaped) {
2249
2380
  try {
2250
2381
  mkdirSync5(path4.dirname(OOM_MARKER_PATH), { recursive: true });
@@ -2268,7 +2399,7 @@ async function loadModel() {
2268
2399
  void (async () => {
2269
2400
  try {
2270
2401
  if (_storeInitialized) {
2271
- const { writeNotification } = await import("../notifications-74YECZ4V.js");
2402
+ const { writeNotification } = await import("../notifications-56TP36IK.js");
2272
2403
  await writeNotification({
2273
2404
  agentId: "exe",
2274
2405
  agentRole: "system",
@@ -2301,6 +2432,7 @@ setInterval(() => {
2301
2432
  _embedWorker?.removeListener("message", onMsg);
2302
2433
  } catch {
2303
2434
  }
2435
+ _embedWorkerKillReason = "health-timeout";
2304
2436
  try {
2305
2437
  _embedWorker?.kill("SIGKILL");
2306
2438
  } catch {
@@ -2323,6 +2455,7 @@ setInterval(() => {
2323
2455
  if (msg.rss && msg.rss > EMBED_WORKER_RSS_KILL_MB) {
2324
2456
  process.stderr.write(`[exed] Embed worker RSS ${msg.rss}MB > ${EMBED_WORKER_RSS_KILL_MB}MB (heap=${EMBED_WORKER_HEAP_MB}MB) \u2014 runaway leak, killing.
2325
2457
  `);
2458
+ _embedWorkerKillReason = "rss-oom";
2326
2459
  try {
2327
2460
  _embedWorker?.kill("SIGKILL");
2328
2461
  } catch {
@@ -2362,6 +2495,7 @@ function disableEmbeddingsForInferenceTimeouts() {
2362
2495
  `
2363
2496
  );
2364
2497
  try {
2498
+ _embedWorkerKillReason = "inference-timeout";
2365
2499
  if (_embedWorker) _embedWorker.kill(process.platform === "darwin" ? "SIGKILL" : "SIGTERM");
2366
2500
  } catch {
2367
2501
  }
@@ -2384,7 +2518,7 @@ function disableEmbeddingsForInferenceTimeouts() {
2384
2518
  void (async () => {
2385
2519
  try {
2386
2520
  if (_storeInitialized) {
2387
- const { writeNotification } = await import("../notifications-74YECZ4V.js");
2521
+ const { writeNotification } = await import("../notifications-56TP36IK.js");
2388
2522
  await writeNotification({
2389
2523
  agentId: "exe",
2390
2524
  agentRole: "system",
@@ -2553,12 +2687,23 @@ function checkIdle() {
2553
2687
  _idleTimer.unref();
2554
2688
  }
2555
2689
  }
2556
- async function shutdown(exitCode = 0, reason = null) {
2690
+ async function shutdown(exitCode = 0, reason = null, restartKind) {
2557
2691
  if (_shuttingDown) return;
2558
2692
  _shuttingDown = true;
2559
2693
  _drainingWrites = true;
2694
+ try {
2695
+ const { stopOrgPartnerRuntime } = await import("../org-partner-runtime-RNNUL5IN.js");
2696
+ stopOrgPartnerRuntime();
2697
+ } catch {
2698
+ }
2560
2699
  const _exitKind = exitCode === 0 && !reason ? "clean" : reason ? "self_exit" : "restart-intent";
2561
- recordExitBreadcrumb(_exitKind, exitCode, reason);
2700
+ recordExitBreadcrumb(
2701
+ _exitKind,
2702
+ exitCode,
2703
+ reason,
2704
+ restartKind ? { restartKind } : _exitKind === "clean" ? { restartKind: "clean_stop" } : void 0
2705
+ );
2706
+ scheduleRestartHandoff(exitCode, reason);
2562
2707
  clearDaemonReady();
2563
2708
  if (exitCode !== 0) {
2564
2709
  recordDaemonCrash();
@@ -2630,7 +2775,7 @@ async function shutdown(exitCode = 0, reason = null) {
2630
2775
  dbBytes = dbPath ? statSync4(dbPath).size : 0;
2631
2776
  } catch {
2632
2777
  }
2633
- const { getAvailableMemoryBytesSync } = await import("../memory-pressure-watchdog-ZOZBIMKC.js");
2778
+ const { getAvailableMemoryBytesSync } = await import("../memory-pressure-watchdog-COJC3OYS.js");
2634
2779
  const freeBytes = getAvailableMemoryBytesSync();
2635
2780
  if (shouldSkipBackupUnderMemoryPressure(freeBytes, dbBytes)) {
2636
2781
  memoryGateSkip = true;
@@ -2661,7 +2806,7 @@ async function shutdown(exitCode = 0, reason = null) {
2661
2806
  process.stderr.write(`[exed] Pre-restart backup failed (non-fatal): ${e instanceof Error ? e.message : String(e)}
2662
2807
  `);
2663
2808
  }
2664
- const restartHandoff = shouldScheduleDaemonRestartHandoff(exitCode, reason);
2809
+ scheduleRestartHandoff(exitCode, reason);
2665
2810
  try {
2666
2811
  const { getClient } = await import("./database.js");
2667
2812
  const client = getClient();
@@ -2683,12 +2828,12 @@ async function shutdown(exitCode = 0, reason = null) {
2683
2828
  `);
2684
2829
  }
2685
2830
  try {
2686
- const { stopProjectionWorker } = await import("../projection-worker-LRFFQ6JB.js");
2831
+ const { stopProjectionWorker } = await import("../projection-worker-MBWUPB5O.js");
2687
2832
  stopProjectionWorker();
2688
2833
  } catch {
2689
2834
  }
2690
2835
  try {
2691
- const { disposeShards } = await import("../shard-manager-DFLCDZT5.js");
2836
+ const { disposeShards } = await import("../shard-manager-YEOHEOHL.js");
2692
2837
  disposeShards();
2693
2838
  } catch {
2694
2839
  }
@@ -2733,39 +2878,6 @@ async function shutdown(exitCode = 0, reason = null) {
2733
2878
  process.stderr.write(`[exed] pid cleanup: ${e.message}
2734
2879
  `);
2735
2880
  }
2736
- if (restartHandoff) {
2737
- try {
2738
- const moduleDir = path4.dirname(fileURLToPath(import.meta.url));
2739
- const helperPath = path4.resolve(moduleDir, "../bin/daemon-restart-handoff.js");
2740
- const daemonPath = fileURLToPath(import.meta.url);
2741
- const logPath = path4.join(EXE_AI_DIR, "logs", "exed.log");
2742
- const lockPath = path4.join(EXE_AI_DIR, "exed-spawn.lock");
2743
- const heapCapMb = computeDaemonHeapCapMb(os3.totalmem() / (1024 * 1024 * 1024));
2744
- const config = {
2745
- oldPid: process.pid,
2746
- daemonPath,
2747
- pidPath: PID_PATH,
2748
- socketPath: SOCKET_PATH,
2749
- lockPath,
2750
- logPath,
2751
- heapCapMb
2752
- };
2753
- const child = spawn2(process.execPath, [helperPath], {
2754
- detached: true,
2755
- stdio: "ignore",
2756
- env: {
2757
- ...process.env,
2758
- EXE_DAEMON_HANDOFF_CONFIG: JSON.stringify(config)
2759
- }
2760
- });
2761
- child.unref();
2762
- process.stderr.write(`[exed] Restart handoff helper scheduled (pid ${child.pid ?? "unknown"}).
2763
- `);
2764
- } catch (e) {
2765
- process.stderr.write(`[exed] Restart handoff helper schedule failed: ${e instanceof Error ? e.message : String(e)}
2766
- `);
2767
- }
2768
- }
2769
2881
  process.stderr.write(`[exed] Shutdown complete (exit ${exitCode}${exitCode === 0 ? "" : " \u2014 restart-intent, launchd will relaunch"}).
2770
2882
  `);
2771
2883
  process.exit(exitCode);
@@ -2779,7 +2891,7 @@ async function handleHealthCheck(socket, requestId) {
2779
2891
  let pipelineStatus = "unknown";
2780
2892
  if (dbConnected) {
2781
2893
  try {
2782
- await import("../pipeline-router-6ZZV7JMA.js");
2894
+ await import("../pipeline-router-IUENNTAY.js");
2783
2895
  pipelineStatus = "ok";
2784
2896
  } catch {
2785
2897
  pipelineStatus = "unavailable";
@@ -2825,7 +2937,7 @@ async function handleHealthCheck(socket, requestId) {
2825
2937
  if (!coreHealthy) {
2826
2938
  process.stderr.write("[exed] Health check failed (DB unavailable) \u2014 exiting for restart.\n");
2827
2939
  logRestartEvent("daemon_self_exit", { trigger: "health_check_failure", dbConnected, embedStatus, uptime_s: Math.floor((Date.now() - _startedAt2) / 1e3) });
2828
- void shutdown(1);
2940
+ void shutdown(1, "recoverable_db_unavailable:health_watchdog", "recoverable_db_unavailable");
2829
2941
  } else if (resolveEmbedFaultAction({ embedDisabledByDesign: _embeddingsDisabledByDesign, embedHealthy }) === "degrade") {
2830
2942
  if (_embedFailureRecordedForFault) return;
2831
2943
  _embedFailureRecordedForFault = true;
@@ -3222,7 +3334,7 @@ async function _writeMemoryRecordInner(entry, syncOnly = false) {
3222
3334
  const vRow = await client.execute({ sql: "SELECT version FROM memories WHERE id = ?", args: [id] });
3223
3335
  const version = Number(vRow.rows[0]?.version) || 0;
3224
3336
  try {
3225
- const { insertOntologyForMemory } = await import("../agentic-ontology-3233PNKV.js");
3337
+ const { insertOntologyForMemory } = await import("../agentic-ontology-RCVCJ6WB.js");
3226
3338
  await insertOntologyForMemory({
3227
3339
  id,
3228
3340
  agent_id: record.agent_id,
@@ -3252,7 +3364,7 @@ function startMemoryQueueDrain() {
3252
3364
  fired("memory_queue_drain");
3253
3365
  if (!await ensureStoreForPolling()) return;
3254
3366
  try {
3255
- const { ackQueue, claimQueue, retryQueueEntries, processQueueEntries } = await import("../memory-queue-W54BYW7V.js");
3367
+ const { ackQueue, claimQueue, retryQueueEntries, processQueueEntries } = await import("../memory-queue-4VN3DTOE.js");
3256
3368
  const lease = claimQueue();
3257
3369
  if (!lease || lease.entries.length === 0) return;
3258
3370
  acted("memory_queue_drain");
@@ -3339,7 +3451,7 @@ function startMessageQueueDrain() {
3339
3451
  fired("message_queue_drain");
3340
3452
  if (!await ensureStoreForPolling()) return;
3341
3453
  try {
3342
- const { claimMessageQueue, ackMessageQueue } = await import("../message-queue-client-AX6KQK7T.js");
3454
+ const { claimMessageQueue, ackMessageQueue } = await import("../message-queue-client-5XW7ZOK2.js");
3343
3455
  const lease = claimMessageQueue();
3344
3456
  if (!lease || lease.entries.length === 0) return;
3345
3457
  acted("message_queue_drain");
@@ -3561,6 +3673,7 @@ function startServer() {
3561
3673
  server.on("error", (err) => {
3562
3674
  if (err.code === "EADDRINUSE") {
3563
3675
  process.stderr.write("[exed] Socket already in use \u2014 another daemon is running. Exiting.\n");
3676
+ recordExitBreadcrumb("clean", 0, "socket-owned-by-live-daemon", { restartKind: "clean_stop" });
3564
3677
  process.exit(0);
3565
3678
  }
3566
3679
  process.stderr.write(`[exed] Server error: ${err.message}
@@ -3635,6 +3748,7 @@ async function resolveAndClaimPort() {
3635
3748
  if (isHealthy) {
3636
3749
  process.stderr.write(`[exed] Port ${targetPort} has a healthy daemon \u2014 exiting (not a duplicate)
3637
3750
  `);
3751
+ recordExitBreadcrumb("clean", 0, "port-owned-by-healthy-daemon", { restartKind: "clean_stop" });
3638
3752
  process.exit(0);
3639
3753
  }
3640
3754
  } catch {
@@ -4032,7 +4146,7 @@ async function startMcpHttpServer() {
4032
4146
  clearBootstrapFailureMarker();
4033
4147
  setBootPhase("db_ready");
4034
4148
  _storeInitialized = true;
4035
- const { initLicenseGate, getCachedLicenseGate } = await import("../license-gate-YXUSNA2I.js");
4149
+ const { initLicenseGate, getCachedLicenseGate } = await import("../license-gate-6R3F3NQR.js");
4036
4150
  const gateResult = await initLicenseGate();
4037
4151
  if (!gateResult.hasKey) {
4038
4152
  process.stderr.write(
@@ -4047,13 +4161,13 @@ async function startMcpHttpServer() {
4047
4161
  let _cachedWrapTelemetry = null;
4048
4162
  async function getWrapTelemetry() {
4049
4163
  if (!_cachedWrapTelemetry) {
4050
- const { wrapServerWithTelemetry } = await import("../tool-telemetry-F7RWUNVK.js");
4164
+ const { wrapServerWithTelemetry } = await import("../tool-telemetry-PALAZUXT.js");
4051
4165
  _cachedWrapTelemetry = wrapServerWithTelemetry;
4052
4166
  }
4053
4167
  return _cachedWrapTelemetry;
4054
4168
  }
4055
4169
  Promise.all([
4056
- import("../tool-capability-index-IFNZ6QUS.js"),
4170
+ import("../tool-capability-index-WZWVBI2R.js"),
4057
4171
  import("../tool-gates-3IC7DK4R.js")
4058
4172
  ]).then(async ([{ getToolCapabilityIndex }, { TOOL_CATEGORIES }]) => {
4059
4173
  const gateState = getCachedLicenseGate();
@@ -4119,7 +4233,7 @@ async function startMcpHttpServer() {
4119
4233
  const expectedBuf = Buffer.from(_daemonToken);
4120
4234
  if (tokenBuf.length === expectedBuf.length && timingSafeEqual(tokenBuf, expectedBuf)) return true;
4121
4235
  try {
4122
- const { verifyAccessToken } = await import("../oauth-server-VE5ELXTF.js");
4236
+ const { verifyAccessToken } = await import("../oauth-server-KW5M437C.js");
4123
4237
  const result = verifyAccessToken(token);
4124
4238
  return result.valid;
4125
4239
  } catch {
@@ -4372,7 +4486,7 @@ async function startMcpHttpServer() {
4372
4486
  return;
4373
4487
  }
4374
4488
  try {
4375
- const { handleOAuthRoute } = await import("../oauth-server-VE5ELXTF.js");
4489
+ const { handleOAuthRoute } = await import("../oauth-server-KW5M437C.js");
4376
4490
  const handled = await handleOAuthRoute(req, res, url, MCP_HTTP_PORT);
4377
4491
  if (handled) return;
4378
4492
  } catch (err) {
@@ -4404,7 +4518,7 @@ async function startMcpHttpServer() {
4404
4518
  for await (const chunk of req) chunks.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
4405
4519
  const rawBody = Buffer.concat(chunks);
4406
4520
  try {
4407
- const { loadWebhookConfig, verifyHmac, processWebhook } = await import("../webhook-pipe-A4X4SCMW.js");
4521
+ const { loadWebhookConfig, verifyHmac, processWebhook } = await import("../webhook-pipe-QJRFZVKA.js");
4408
4522
  const webhookConfig = await loadWebhookConfig();
4409
4523
  const serviceConfig = webhookConfig[serviceName];
4410
4524
  if (!serviceConfig) {
@@ -4500,7 +4614,7 @@ async function startMcpHttpServer() {
4500
4614
  contextPct: body.context_pct
4501
4615
  });
4502
4616
  if (body.context_pct !== void 0 && body.context_pct > 70) {
4503
- void import("../orchestration-events-KRQI4ED5.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
4617
+ void import("../orchestration-events-CKQ756NA.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
4504
4618
  recordOE({
4505
4619
  eventType: "context.pressure",
4506
4620
  source: "exe-daemon.heartbeat",
@@ -4585,7 +4699,7 @@ async function startMcpHttpServer() {
4585
4699
  let sessionHint = req.headers["x-exe-session-name"] || req.headers["x-exe-session"] || "";
4586
4700
  if (sessionHint) {
4587
4701
  try {
4588
- const { sanitizeSessionHintHeader, rejectForgedSessionHint } = await import("../mcp-session-identity-RTNZ2ZLW.js");
4702
+ const { sanitizeSessionHintHeader, rejectForgedSessionHint } = await import("../mcp-session-identity-GOBGICLI.js");
4589
4703
  const rawHint = sessionHint;
4590
4704
  sessionHint = sanitizeSessionHintHeader(sessionHint);
4591
4705
  if (!sessionHint) {
@@ -4624,7 +4738,7 @@ async function startMcpHttpServer() {
4624
4738
  try {
4625
4739
  const liveSessions = await getTmuxSessionsAsync();
4626
4740
  const paneCommands = await getPaneCommandsAsync();
4627
- const { resolveMcpSessionHint } = await import("../mcp-session-identity-RTNZ2ZLW.js");
4741
+ const { resolveMcpSessionHint } = await import("../mcp-session-identity-GOBGICLI.js");
4628
4742
  let registrySessions = [];
4629
4743
  try {
4630
4744
  const { listSessions: listRegistrySessions } = await import("./session-registry.js");
@@ -4761,7 +4875,7 @@ async function startMcpHttpServer() {
4761
4875
  bindLive = await getTmuxSessionsAsync();
4762
4876
  } catch {
4763
4877
  }
4764
- const { isLauncherCorroboratedIdentity } = await import("../mcp-session-identity-RTNZ2ZLW.js");
4878
+ const { isLauncherCorroboratedIdentity } = await import("../mcp-session-identity-GOBGICLI.js");
4765
4879
  const corroborated = isLauncherCorroboratedIdentity({
4766
4880
  agentId,
4767
4881
  registrySessions: bindRegistry,
@@ -5004,7 +5118,7 @@ async function startMcpHttpServer() {
5004
5118
  }
5005
5119
  }
5006
5120
  try {
5007
- const { reconcileHintWithRegistryIdentity } = await import("../mcp-session-identity-RTNZ2ZLW.js");
5121
+ const { reconcileHintWithRegistryIdentity } = await import("../mcp-session-identity-GOBGICLI.js");
5008
5122
  const { listSessions: listRegistrySessions } = await import("./session-registry.js");
5009
5123
  const recon = reconcileHintWithRegistryIdentity({
5010
5124
  agentId,
@@ -5113,7 +5227,7 @@ async function startMcpHttpServer() {
5113
5227
  `);
5114
5228
  logRestartEvent("daemon_self_exit", { trigger: "mcp_http_port_bind_failed", port: MCP_HTTP_PORT });
5115
5229
  rejectRealListen?.(err);
5116
- void shutdown(1);
5230
+ void shutdown(1, "mcp_http_port_bind_failed", "crash_port_bind");
5117
5231
  return;
5118
5232
  }
5119
5233
  const delay = _portRetries * 2e3;
@@ -5217,9 +5331,9 @@ async function ensureStoreForPolling() {
5217
5331
  await initDatabase({ dbPath: config.dbPath, encryptionKey: masterKey.toString("hex") });
5218
5332
  await ensureSchema();
5219
5333
  try {
5220
- const { isLedgerEnabled } = await import("../notification-ledger-NZ4HO3M5.js");
5334
+ const { isLedgerEnabled } = await import("../notification-ledger-J6Q2GAYU.js");
5221
5335
  if (isLedgerEnabled()) {
5222
- const { bumpBootGeneration } = await import("../boot-generation-4D3CTT7X.js");
5336
+ const { bumpBootGeneration } = await import("../boot-generation-XABYKF5P.js");
5223
5337
  const { setDaemonReadyGeneration } = await import("../daemon-ready-signal-CKXPUMJ2.js");
5224
5338
  const generation = await bumpBootGeneration();
5225
5339
  setDaemonReadyGeneration(generation);
@@ -5259,13 +5373,13 @@ async function ensureStoreForPolling() {
5259
5373
  }
5260
5374
  }
5261
5375
  async function startReviewPolling() {
5262
- const polling = await import("../review-polling-JFWRNQF6.js");
5376
+ const polling = await import("../review-polling-CYBCBHZA.js");
5263
5377
  const state = {
5264
5378
  lastIntercomSent: /* @__PURE__ */ new Map(),
5265
5379
  lastNudgeSent: /* @__PURE__ */ new Map(),
5266
5380
  intervalMs: REVIEW_POLL_INTERVAL_MS
5267
5381
  };
5268
- const { pollReviewNudge, createReviewNudgeRealDeps, loadNudgeState } = await import("../daemon-orchestration-DT5M2ZAR.js");
5382
+ const { pollReviewNudge, createReviewNudgeRealDeps, loadNudgeState } = await import("../daemon-orchestration-7425ZVNH.js");
5269
5383
  const nudgeState = loadNudgeState();
5270
5384
  const tick = async () => traceDaemonTimer("review_polling", async () => {
5271
5385
  fired("review_polling");
@@ -5273,7 +5387,7 @@ async function startReviewPolling() {
5273
5387
  try {
5274
5388
  const { getClient } = await import("./database.js");
5275
5389
  const deps = polling.createRealDeps(getClient);
5276
- const { strictSessionScopeFilter } = await import("../task-scope-44N7XP5N.js");
5390
+ const { strictSessionScopeFilter } = await import("../task-scope-ERHPHLUM.js");
5277
5391
  const { getCoordinatorName, DEFAULT_COORDINATOR_TEMPLATE_NAME } = await import("./employees.js");
5278
5392
  deps.findOrphanedDoneTasks = async (sessionScope) => {
5279
5393
  const coordinatorName = getCoordinatorName();
@@ -5352,7 +5466,7 @@ function startSessionTTL() {
5352
5466
  if (!await ensureStoreForPolling()) return;
5353
5467
  if (inPostRestartDestructiveGrace("session_ttl")) return;
5354
5468
  const { getClient } = await import("./database.js");
5355
- const { checkSessionTTL, createSessionTTLRealDeps } = await import("../daemon-orchestration-DT5M2ZAR.js");
5469
+ const { checkSessionTTL, createSessionTTLRealDeps } = await import("../daemon-orchestration-7425ZVNH.js");
5356
5470
  const deps = createSessionTTLRealDeps(getClient);
5357
5471
  const killed = await checkSessionTTL(deps, _wedgeObservations);
5358
5472
  if (killed.length > 0) acted("session_ttl");
@@ -5378,8 +5492,13 @@ function startIdleKill() {
5378
5492
  if (inPostRestartDestructiveGrace("idle_kill")) return;
5379
5493
  try {
5380
5494
  const signalDir = path4.join(os3.homedir(), ".exe-os", "task-signals");
5381
- if (existsSync7(signalDir)) {
5382
- const files = (await import("fs")).readdirSync(signalDir).filter((f) => f.endsWith(".terminate"));
5495
+ try {
5496
+ await access(signalDir);
5497
+ } catch {
5498
+ throw new Error("terminate-signal-dir-missing");
5499
+ }
5500
+ {
5501
+ const files = (await readdir(signalDir)).filter((f) => f.endsWith(".terminate"));
5383
5502
  for (const file of files) {
5384
5503
  const agentId = file.replace(".terminate", "");
5385
5504
  const signalPath = path4.join(signalDir, file);
@@ -5392,9 +5511,12 @@ function startIdleKill() {
5392
5511
  `);
5393
5512
  acted("idle_kill");
5394
5513
  }
5395
- unlinkSync4(signalPath);
5514
+ await unlink(signalPath);
5396
5515
  } catch {
5397
- unlinkSync4(signalPath);
5516
+ try {
5517
+ await unlink(signalPath);
5518
+ } catch {
5519
+ }
5398
5520
  }
5399
5521
  }
5400
5522
  }
@@ -5404,7 +5526,7 @@ function startIdleKill() {
5404
5526
  const cfg = await getCachedConfig();
5405
5527
  if (!cfg) return;
5406
5528
  const { getClient } = await import("./database.js");
5407
- const { pollIdleKill, createIdleKillRealDeps } = await import("../daemon-orchestration-DT5M2ZAR.js");
5529
+ const { pollIdleKill, createIdleKillRealDeps } = await import("../daemon-orchestration-7425ZVNH.js");
5408
5530
  const { sessions: liveSessions, paneCache, aliveSessions } = await getSharedOrchestrationCaches();
5409
5531
  const realDeps = createIdleKillRealDeps(
5410
5532
  getClient,
@@ -5777,7 +5899,7 @@ function startSkillRefinement() {
5777
5899
  if (!shouldRunHeavyJob("skill_refinement")) return;
5778
5900
  try {
5779
5901
  if (!await ensureStoreForPolling()) return;
5780
- const { runSkillRefinement } = await import("../skill-refinement-APBYOSGX.js");
5902
+ const { runSkillRefinement } = await import("../skill-refinement-VDR5OT4V.js");
5781
5903
  const result = await runSkillRefinement();
5782
5904
  if (result.reviewed > 0) {
5783
5905
  acted("skill_refinement");
@@ -5803,8 +5925,8 @@ function startStaleBranchSweep() {
5803
5925
  const tick = async () => {
5804
5926
  fired("stale_branch_sweep");
5805
5927
  try {
5806
- const { discoverRepoPaths } = await import("../worktree-sweep-IM2ZQG6Z.js");
5807
- const { scanUnmergedBranchesCached } = await import("../branch-hygiene-HNSOUDJE.js");
5928
+ const { discoverRepoPaths } = await import("../worktree-sweep-5LCVT46V.js");
5929
+ const { scanUnmergedBranchesCached } = await import("../branch-hygiene-Z4IBWAOX.js");
5808
5930
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
5809
5931
  for (const k of _staleBranchAlertedToday) {
5810
5932
  if (!k.endsWith(today)) _staleBranchAlertedToday.delete(k);
@@ -5835,7 +5957,7 @@ function startStaleBranchSweep() {
5835
5957
  if (!_storeInitialized) continue;
5836
5958
  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("; ");
5837
5959
  try {
5838
- const { writeNotification } = await import("../notifications-74YECZ4V.js");
5960
+ const { writeNotification } = await import("../notifications-56TP36IK.js");
5839
5961
  await writeNotification({
5840
5962
  agentId: "exe",
5841
5963
  agentRole: "system",
@@ -5890,7 +6012,7 @@ function startWorkStateHeartbeat() {
5890
6012
  const { getClient } = await import("./database.js");
5891
6013
  const { listSessions } = await import("./session-registry.js");
5892
6014
  const { isCoordinatorName } = await import("./employees.js");
5893
- const { runWorkStateTick } = await import("../work-state-heartbeat-CA4CN7DQ.js");
6015
+ const { runWorkStateTick } = await import("../work-state-heartbeat-O7UMB6SE.js");
5894
6016
  let liveTmux = null;
5895
6017
  const loadLiveTmux = async () => {
5896
6018
  if (!liveTmux) liveTmux = await listTmuxSessionNamesAsync();
@@ -5955,7 +6077,7 @@ function startGraphExtraction() {
5955
6077
  if (!await ensureStoreForPolling()) return;
5956
6078
  const { getClient } = await import("./database.js");
5957
6079
  const client = getClient();
5958
- const { extractBatch } = await import("../graph-rag-5FVC5JXH.js");
6080
+ const { extractBatch } = await import("../graph-rag-EOGPZOYI.js");
5959
6081
  const result = await extractBatch(client, 50, config.selfQueryModel);
5960
6082
  if (result.processed > 0) {
5961
6083
  acted("graph_extraction");
@@ -6276,7 +6398,7 @@ async function refreshAgentData() {
6276
6398
  const decision = evaluateSpendCapAlert(_lastSpendCapLevel, capStatus);
6277
6399
  _lastSpendCapLevel = decision.level;
6278
6400
  if (decision.shouldAlert && decision.summary) {
6279
- const { writeNotification } = await import("../notifications-74YECZ4V.js");
6401
+ const { writeNotification } = await import("../notifications-56TP36IK.js");
6280
6402
  await writeNotification({
6281
6403
  agentId: "system",
6282
6404
  agentRole: "system",
@@ -6398,7 +6520,7 @@ function startReflectionSweep() {
6398
6520
  );
6399
6521
  let runReflection;
6400
6522
  try {
6401
- ({ runReflection } = await import("../memory-reflection-EQC4FXSW.js"));
6523
+ ({ runReflection } = await import("../memory-reflection-V2SNAUIB.js"));
6402
6524
  } catch (importErr) {
6403
6525
  _reflectionImportFailed = true;
6404
6526
  process.stderr.write(`[exed] Reflection module unavailable (stale chunk hash?) \u2014 disabled until daemon restart: ${importErr instanceof Error ? importErr.message : String(importErr)}
@@ -6439,7 +6561,7 @@ function startReflectionSweep() {
6439
6561
  if (memories > 100 && cards < memories * 0.1) {
6440
6562
  process.stderr.write(`[exed] Memory cards sparse (${cards} cards / ${memories} memories) \u2014 running backfill...
6441
6563
  `);
6442
- const { insertMemoryCardsForBatch } = await import("../memory-cards-KG4TPNKK.js");
6564
+ const { insertMemoryCardsForBatch } = await import("../memory-cards-4EXX3BQS.js");
6443
6565
  const batchSize = 500;
6444
6566
  let offset = 0;
6445
6567
  let totalCards = 0;
@@ -6520,7 +6642,7 @@ function startDatabaseBackup() {
6520
6642
  `
6521
6643
  );
6522
6644
  try {
6523
- const { maybeVerifyDailyBackup } = await import("../backup-verify-JNYKXIU2.js");
6645
+ const { maybeVerifyDailyBackup } = await import("../backup-verify-TZPPUCLU.js");
6524
6646
  const verdict = await maybeVerifyDailyBackup(backupPath);
6525
6647
  if (verdict && !verdict.ok) {
6526
6648
  process.stderr.write(
@@ -6596,10 +6718,24 @@ function startSessionEventsRetention() {
6596
6718
  fired("session_events_retention");
6597
6719
  if (!await ensureStoreForPolling()) return;
6598
6720
  try {
6599
- const { getClient } = await import("./database.js");
6600
- const { sweepExpiredSessionEvents, DEFAULT_SESSION_EVENTS_RETENTION_DAYS } = await import("../session-events-VMQBCUH3.js");
6721
+ const { DEFAULT_SESSION_EVENTS_RETENTION_DAYS } = await import("../session-events-X33W4JNA.js");
6601
6722
  const days = SESSION_EVENTS_RETENTION_DAYS ?? DEFAULT_SESSION_EVENTS_RETENTION_DAYS;
6602
- const count = await sweepExpiredSessionEvents(getClient(), days);
6723
+ if (!isWriteWorkerEnabled() || !isDbWriteWorkerReady()) {
6724
+ process.stderr.write(
6725
+ "[exed] Session-events retention skipped: DB write worker unavailable (no daemon-direct write fallback)\n"
6726
+ );
6727
+ return;
6728
+ }
6729
+ let count;
6730
+ try {
6731
+ count = (await sweepSessionEventsRetentionInWorker(days)).deleted;
6732
+ } catch (err) {
6733
+ process.stderr.write(
6734
+ `[exed] Session-events retention worker failed (${err instanceof Error ? err.message : String(err)}) - skipping this tick
6735
+ `
6736
+ );
6737
+ return;
6738
+ }
6603
6739
  if (count > 0) {
6604
6740
  acted("session_events_retention");
6605
6741
  process.stderr.write(
@@ -6628,7 +6764,7 @@ function startIntercomQueueDrain() {
6628
6764
  const tick = async () => traceDaemonTimer("intercom_queue_drain", async () => {
6629
6765
  fired("intercom_queue_drain");
6630
6766
  try {
6631
- const { drainQueueAsync, readQueue } = await import("../intercom-queue-KHKJJYCQ.js");
6767
+ const { drainQueueAsync, readQueue } = await import("../intercom-queue-R5LSXD3V.js");
6632
6768
  const {
6633
6769
  sendIntercomAsync: centralSendIntercomAsync,
6634
6770
  countScopedPendingReviews,
@@ -6760,7 +6896,7 @@ function startLedgerDrain() {
6760
6896
  const tick = async () => traceDaemonTimer("ledger_drain", async () => {
6761
6897
  fired("ledger_drain");
6762
6898
  try {
6763
- const { isLedgerEnabled, drainLedger } = await import("../notification-ledger-NZ4HO3M5.js");
6899
+ const { isLedgerEnabled, drainLedger } = await import("../notification-ledger-J6Q2GAYU.js");
6764
6900
  if (!isLedgerEnabled()) return;
6765
6901
  const result = await drainLedger({
6766
6902
  // Shadow "would-deliver": idle target = would-deliver, busy = retry.
@@ -6799,7 +6935,7 @@ function startOrphanReaper() {
6799
6935
  const tick = async () => traceDaemonTimer("orphan_reaper", async () => {
6800
6936
  fired("orphan_reaper");
6801
6937
  try {
6802
- const { reapOrphanedMcpProcesses, createOrphanReaperRealDepsAsync } = await import("../daemon-orchestration-DT5M2ZAR.js");
6938
+ const { reapOrphanedMcpProcesses, createOrphanReaperRealDepsAsync } = await import("../daemon-orchestration-7425ZVNH.js");
6803
6939
  const deps = await createOrphanReaperRealDepsAsync();
6804
6940
  const reaped = await reapOrphanedMcpProcesses(deps);
6805
6941
  if (reaped.length > 0) acted("orphan_reaper");
@@ -6824,7 +6960,7 @@ function startZombieAgentReaper() {
6824
6960
  const tick = async () => traceDaemonTimer("zombie_agent_reaper", async () => {
6825
6961
  fired("zombie_agent_reaper");
6826
6962
  try {
6827
- const { reapZombieAgentProcesses, createZombieAgentReaperRealDepsAsync } = await import("../daemon-orchestration-DT5M2ZAR.js");
6963
+ const { reapZombieAgentProcesses, createZombieAgentReaperRealDepsAsync } = await import("../daemon-orchestration-7425ZVNH.js");
6828
6964
  const deps = await createZombieAgentReaperRealDepsAsync();
6829
6965
  const reaped = reapZombieAgentProcesses(deps);
6830
6966
  if (reaped.length > 0) acted("zombie_agent_reaper");
@@ -6848,7 +6984,7 @@ async function startDaemonMemoryPressureWatchdog() {
6848
6984
  try {
6849
6985
  const cfg = await getCachedConfig();
6850
6986
  if (!cfg) return;
6851
- const { startMemoryPressureWatchdog: startWatchdog, MEMORY_PRESSURE_WATCHDOG_DEFAULTS } = await import("../memory-pressure-watchdog-ZOZBIMKC.js");
6987
+ const { startMemoryPressureWatchdog: startWatchdog, MEMORY_PRESSURE_WATCHDOG_DEFAULTS } = await import("../memory-pressure-watchdog-COJC3OYS.js");
6852
6988
  const watchdogCfg = {
6853
6989
  ...MEMORY_PRESSURE_WATCHDOG_DEFAULTS,
6854
6990
  ...cfg.memoryPressureWatchdog ?? {}
@@ -6879,7 +7015,7 @@ function startWorktreeReaper() {
6879
7015
  const tick = async () => traceDaemonTimer("worktree_reaper", async () => {
6880
7016
  fired("worktree_reaper");
6881
7017
  try {
6882
- const { reapOrphanedWorktrees, createWorktreeReaperRealDeps } = await import("../daemon-orchestration-DT5M2ZAR.js");
7018
+ const { reapOrphanedWorktrees, createWorktreeReaperRealDeps } = await import("../daemon-orchestration-7425ZVNH.js");
6883
7019
  const deps = await createWorktreeReaperRealDeps();
6884
7020
  const result = await reapOrphanedWorktrees(deps);
6885
7021
  if (result.pruned.length > 0) {
@@ -6896,18 +7032,21 @@ function startWorktreeReaper() {
6896
7032
  );
6897
7033
  }
6898
7034
  try {
6899
- const { existsSync: sigExists, readdirSync: sigReaddir, readFileSync: sigRead, unlinkSync: sigUnlink } = await import("fs");
6900
- const sigPath = await import("path");
6901
7035
  const { EXE_AI_DIR: sigDir } = await import("./config.js");
6902
- const signalDir = sigPath.join(sigDir, "worktree-cleanup-signals");
6903
- if (sigExists(signalDir)) {
6904
- const files = sigReaddir(signalDir).filter((f) => f.endsWith(".json"));
7036
+ const signalDir = path4.join(sigDir, "worktree-cleanup-signals");
7037
+ try {
7038
+ await access(signalDir);
7039
+ } catch {
7040
+ return;
7041
+ }
7042
+ {
7043
+ const files = (await readdir(signalDir)).filter((f) => f.endsWith(".json"));
6905
7044
  for (const file of files) {
6906
7045
  try {
6907
- const fullPath = sigPath.join(signalDir, file);
6908
- const signal = JSON.parse(sigRead(fullPath, "utf8"));
7046
+ const fullPath = path4.join(signalDir, file);
7047
+ const signal = JSON.parse(await readFile(fullPath, "utf8"));
6909
7048
  try {
6910
- sigUnlink(fullPath);
7049
+ await unlink(fullPath);
6911
7050
  } catch {
6912
7051
  }
6913
7052
  if (!signal.worktreePath || !signal.safeToRemove) {
@@ -6919,8 +7058,8 @@ function startWorktreeReaper() {
6919
7058
  }
6920
7059
  continue;
6921
7060
  }
6922
- const { cleanupAgentWorktree } = await import("../worktree-sweep-IM2ZQG6Z.js");
6923
- const { getMainRepoRootAsync } = await import("../worktree-NNVXVV6A.js");
7061
+ const { cleanupAgentWorktree } = await import("../worktree-sweep-5LCVT46V.js");
7062
+ const { getMainRepoRootAsync } = await import("../worktree-ZWA35PKW.js");
6924
7063
  const repoRoot = await getMainRepoRootAsync(signal.worktreePath);
6925
7064
  if (repoRoot && signal.agentId) {
6926
7065
  const notes = await cleanupAgentWorktree(repoRoot, signal.agentId);
@@ -6953,7 +7092,7 @@ function startAutoWake() {
6953
7092
  if (!await ensureStoreForPolling()) return;
6954
7093
  try {
6955
7094
  const { getClient } = await import("./database.js");
6956
- const { pollOrphanedTasks, createAutoWakeRealDeps } = await import("../daemon-orchestration-DT5M2ZAR.js");
7095
+ const { pollOrphanedTasks, createAutoWakeRealDeps } = await import("../daemon-orchestration-7425ZVNH.js");
6957
7096
  const deps = createAutoWakeRealDeps(getClient, process.cwd(), getTmuxSessionsAsync);
6958
7097
  const woken = await pollOrphanedTasks(deps);
6959
7098
  if (woken.length > 0) acted("auto_wake");
@@ -6963,27 +7102,34 @@ function startAutoWake() {
6963
7102
  }
6964
7103
  try {
6965
7104
  const signalBase = path4.join(os3.homedir(), ".exe-os", "task-signals");
6966
- if (existsSync7(signalBase)) {
6967
- const { readdirSync: readdirSync3, statSync: statSyncFs } = await import("fs");
7105
+ try {
7106
+ await access(signalBase);
7107
+ } catch {
7108
+ return;
7109
+ }
7110
+ {
6968
7111
  const { sendIntercomAsync, extractRootExe } = await import("./tmux-routing.js");
6969
7112
  const sessionCache = path4.join(os3.homedir(), ".exe-os", "session-cache");
6970
7113
  const sessions = await getTmuxSessionsAsync();
6971
7114
  const signalDirs = [];
6972
- for (const entry of readdirSync3(signalBase, { withFileTypes: true })) {
7115
+ for (const entry of await readdir(signalBase, { withFileTypes: true })) {
6973
7116
  if (entry.isDirectory()) signalDirs.push({ dir: path4.join(signalBase, entry.name), scope: entry.name });
6974
7117
  }
6975
7118
  signalDirs.push({ dir: signalBase, scope: null });
6976
7119
  const _runtimeCache = /* @__PURE__ */ new Map();
6977
- const runtimeFor = (sessionName) => {
7120
+ const runtimeFor = async (sessionName) => {
6978
7121
  const cached = _runtimeCache.get(sessionName);
6979
7122
  if (cached && Date.now() - cached.ts < 3e4) return cached.runtime;
6980
7123
  try {
6981
7124
  const dispatchInfoPath = path4.join(sessionCache, `dispatch-info-${sessionName}.json`);
6982
- if (!existsSync7(dispatchInfoPath)) {
7125
+ let rawText;
7126
+ try {
7127
+ rawText = await readFile(dispatchInfoPath, "utf8");
7128
+ } catch {
6983
7129
  _runtimeCache.set(sessionName, { runtime: "claude", ts: Date.now() });
6984
7130
  return "claude";
6985
7131
  }
6986
- const raw = JSON.parse(readFileSync6(dispatchInfoPath, "utf8"));
7132
+ const raw = JSON.parse(rawText);
6987
7133
  const rt = raw.runtime ?? "claude";
6988
7134
  _runtimeCache.set(sessionName, { runtime: rt, ts: Date.now() });
6989
7135
  return rt;
@@ -6994,17 +7140,22 @@ function startAutoWake() {
6994
7140
  for (const { dir, scope } of signalDirs) {
6995
7141
  let files = [];
6996
7142
  try {
6997
- files = readdirSync3(dir).filter((f) => f.endsWith(".pending") && !f.includes("review-"));
7143
+ files = (await readdir(dir)).filter((f) => f.endsWith(".pending") && !f.includes("review-"));
6998
7144
  } catch {
6999
7145
  continue;
7000
7146
  }
7001
7147
  for (const file of files) {
7002
7148
  const signalPath = path4.join(dir, file);
7003
- const age = Date.now() - statSyncFs(signalPath).mtimeMs;
7149
+ let age;
7150
+ try {
7151
+ age = Date.now() - (await stat(signalPath)).mtimeMs;
7152
+ } catch {
7153
+ continue;
7154
+ }
7004
7155
  if (age > 60 * 60 * 1e3) {
7005
7156
  try {
7006
- unlinkSync4(signalPath);
7007
- void import("../orchestration-events-KRQI4ED5.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
7157
+ await unlink(signalPath);
7158
+ void import("../orchestration-events-CKQ756NA.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
7008
7159
  recordOE({ eventType: "signal.stale", source: "exe-daemon.autoWake", severity: "warn", payload: { file, ageMinutes: Math.round(age / 6e4) } });
7009
7160
  }).catch(() => {
7010
7161
  });
@@ -7024,7 +7175,7 @@ function startAutoWake() {
7024
7175
  if (!match) continue;
7025
7176
  const state = classifyPaneState(await capturePaneAsync(match, 5));
7026
7177
  if (state !== "idle") continue;
7027
- const runtime = runtimeFor(match);
7178
+ const runtime = await runtimeFor(match);
7028
7179
  if (runtime === "codex" || runtime === "opencode" || runtime === "exe-agent") {
7029
7180
  await killTmuxSessionAsync(match);
7030
7181
  acted("auto_wake");
@@ -7152,7 +7303,7 @@ function startStuckTaskRelease() {
7152
7303
  createStaleClaimRealDeps,
7153
7304
  escalateStuckBlockedTasks,
7154
7305
  createStuckBlockedRealDeps
7155
- } = await import("../daemon-orchestration-DT5M2ZAR.js");
7306
+ } = await import("../daemon-orchestration-7425ZVNH.js");
7156
7307
  const deps = createStuckTaskRealDeps(getClient);
7157
7308
  const released = await releaseStuckTasks(deps);
7158
7309
  if (released.length > 0) {
@@ -7353,12 +7504,12 @@ function startTaskEnforcementScanner() {
7353
7504
  const tick = async () => traceDaemonTimer("task_enforcement", async () => {
7354
7505
  fired("task_enforcement");
7355
7506
  try {
7356
- const { runTaskEnforcementTick } = await import("../task-enforcement-YAU6ZGDC.js");
7507
+ const { runTaskEnforcementTick } = await import("../task-enforcement-GQDUTIFY.js");
7357
7508
  const { getTransport } = await import("./transport.js");
7358
7509
  const { loadAgentConfig } = await import("./agent-config.js");
7359
7510
  const { getClient } = await import("./database.js");
7360
7511
  const { loadEmployeesSync } = await import("./employees.js");
7361
- const { sessionScopeFilter } = await import("../task-scope-44N7XP5N.js");
7512
+ const { sessionScopeFilter } = await import("../task-scope-ERHPHLUM.js");
7362
7513
  const transport = getTransport();
7363
7514
  const { sessions: allSessions, paneCache, aliveSessions } = await getSharedOrchestrationCaches();
7364
7515
  await yieldToEventLoop();
@@ -7369,10 +7520,10 @@ function startTaskEnforcementScanner() {
7369
7520
  sendKeysLiteral: transport.sendKeysLiteral?.bind(transport),
7370
7521
  isAlive: (session) => aliveSessions.has(session)
7371
7522
  };
7372
- const { checkAutoWakeGates } = await import("../daemon-orchestration-DT5M2ZAR.js");
7523
+ const { checkAutoWakeGates } = await import("../daemon-orchestration-7425ZVNH.js");
7373
7524
  const { ensureEmployeeAsync, employeeSessionName, sendIntercomAsync } = await import("./tmux-routing.js");
7374
7525
  const { shouldAutoInstance } = await import("./employees.js");
7375
- const { recordOrchestrationEventBestEffort } = await import("../orchestration-events-KRQI4ED5.js");
7526
+ const { recordOrchestrationEventBestEffort } = await import("../orchestration-events-CKQ756NA.js");
7376
7527
  const projectDir = process.cwd();
7377
7528
  await runTaskEnforcementTick({
7378
7529
  transport: enforcementTransport,
@@ -7474,7 +7625,7 @@ function startRssWatchdog() {
7474
7625
  data: { heapUsedMb: Math.round(mem.heapUsed / 1024 / 1024), heapLimitMb: Math.round(heapLimit / 1024 / 1024), rssMb: Math.round(rss / 1024 / 1024) }
7475
7626
  });
7476
7627
  global.gc?.();
7477
- void shutdown(1);
7628
+ void shutdown(1, "recoverable_v8_heap:watchdog_critical", "recoverable_v8_heap");
7478
7629
  return;
7479
7630
  }
7480
7631
  if (rss > RSS_RESTART_BYTES) {
@@ -7513,7 +7664,7 @@ function startRssWatchdog() {
7513
7664
  `);
7514
7665
  } catch {
7515
7666
  }
7516
- void shutdown(1);
7667
+ void shutdown(1, "self_heal_rss_watchdog_critical", "self_heal_rss");
7517
7668
  return;
7518
7669
  }
7519
7670
  _rssOverThresholdCount = 0;
@@ -7621,20 +7772,19 @@ function startApiWatchdog() {
7621
7772
  process.stderr.write(`[exed] API watchdog nudged ${session} (attempt ${nudgeCount}/3, matched: ${matchedPattern.source})
7622
7773
  `);
7623
7774
  try {
7624
- const { appendFileSync: appendFileSync2, mkdirSync: mkdirSync6, statSync: statSyncFs, renameSync: renameSyncFs } = await import("fs");
7625
7775
  const { join: join4 } = await import("path");
7626
7776
  const logDir = join4(process.env.EXE_OS_DIR ?? join4(process.env.HOME ?? "", ".exe-os"), "logs");
7627
7777
  try {
7628
- mkdirSync6(logDir, { recursive: true });
7778
+ await mkdir(logDir, { recursive: true });
7629
7779
  } catch {
7630
7780
  }
7631
7781
  const watchdogLogPath = join4(logDir, "api-watchdog.jsonl");
7632
7782
  try {
7633
- const wStat = statSyncFs(watchdogLogPath);
7634
- if (wStat.size > 5 * 1024 * 1024) renameSyncFs(watchdogLogPath, watchdogLogPath + ".1");
7783
+ const wStat = await stat(watchdogLogPath);
7784
+ if (wStat.size > 5 * 1024 * 1024) await rename(watchdogLogPath, watchdogLogPath + ".1");
7635
7785
  } catch {
7636
7786
  }
7637
- appendFileSync2(
7787
+ await appendFile(
7638
7788
  watchdogLogPath,
7639
7789
  JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString(), session, pattern: matchedPattern.source }) + "\n"
7640
7790
  );
@@ -7664,7 +7814,7 @@ function startBackgroundJobGuardrails() {
7664
7814
  const tick = async () => traceDaemonTimer("background_job_guardrails", async () => {
7665
7815
  fired("background_job_guardrails");
7666
7816
  try {
7667
- const { enforceBackgroundJobGuardrailsAsync } = await import("../background-jobs-XGTLESKM.js");
7817
+ const { enforceBackgroundJobGuardrailsAsync } = await import("../background-jobs-Z6KHCWES.js");
7668
7818
  const actions = await enforceBackgroundJobGuardrailsAsync();
7669
7819
  if (actions.length > 0) {
7670
7820
  acted("background_job_guardrails");
@@ -7699,7 +7849,7 @@ async function sweepExpiredTracesFromDaemonTimer() {
7699
7849
  const memoryIds = idsResult.rows.map((r) => String(r.id)).filter(Boolean);
7700
7850
  if (memoryIds.length === 0) return 0;
7701
7851
  const { getClient } = await import("./database.js");
7702
- const { cleanupGraphLinksForMemories, cleanupCardsForMemories } = await import("../graph-rag-5FVC5JXH.js");
7852
+ const { cleanupGraphLinksForMemories, cleanupCardsForMemories } = await import("../graph-rag-EOGPZOYI.js");
7703
7853
  const client = getClient();
7704
7854
  await cleanupGraphLinksForMemories(client, memoryIds);
7705
7855
  await cleanupCardsForMemories(client, memoryIds);
@@ -7738,6 +7888,7 @@ function handleSignalShutdown() {
7738
7888
  }
7739
7889
  process.on("SIGINT", handleSignalShutdown);
7740
7890
  process.on("SIGTERM", handleSignalShutdown);
7891
+ process.on("SIGHUP", handleSignalShutdown);
7741
7892
  process.on("exit", (code) => {
7742
7893
  if (_bootPhase !== "ready" && code !== 0) {
7743
7894
  recordExitBreadcrumb("boot-abort", code, `boot_abort:${_bootPhase}`);
@@ -7777,9 +7928,12 @@ function maybeSelfHealStaleDist(reason, source) {
7777
7928
  `);
7778
7929
  logRestartEvent("daemon_self_exit", { trigger: "stale_dist_chunk", source, uptime_s: Math.floor((Date.now() - _startedAt2) / 1e3) });
7779
7930
  try {
7780
- requestRestart("stale-dist-chunk-self-heal");
7931
+ if (!selfHealRestartForDist("self_heal_stale_dist", "self_heal_stale_dist_chunk")) {
7932
+ _staleDistRestartRequested = false;
7933
+ }
7781
7934
  } catch (err) {
7782
- process.stderr.write(`[exed] requestRestart for stale-dist self-heal failed (non-fatal): ${err instanceof Error ? err.message : String(err)}
7935
+ _staleDistRestartRequested = false;
7936
+ process.stderr.write(`[exed] stale-dist self-heal restart failed (non-fatal): ${err instanceof Error ? err.message : String(err)}
7783
7937
  `);
7784
7938
  }
7785
7939
  }
@@ -7845,12 +7999,13 @@ function startDistDriftWatch() {
7845
7999
  uptime_s: Math.floor((Date.now() - _startedAt2) / 1e3)
7846
8000
  });
7847
8001
  try {
7848
- const result = requestRestart("dist-drift-self-heal");
7849
- if (!result.ok) _distDriftRestartRequested = false;
8002
+ if (!selfHealRestartForDist("self_heal_dist_drift", `self_heal_dist_drift:${drift.reason ?? "unknown"}`)) {
8003
+ _distDriftRestartRequested = false;
8004
+ }
7850
8005
  } catch (err) {
7851
8006
  _distDriftRestartRequested = false;
7852
8007
  process.stderr.write(
7853
- `[exed] requestRestart for dist-drift self-heal failed (non-fatal): ${err instanceof Error ? err.message : String(err)}
8008
+ `[exed] dist-drift self-heal restart failed (non-fatal): ${err instanceof Error ? err.message : String(err)}
7854
8009
  `
7855
8010
  );
7856
8011
  }
@@ -8161,6 +8316,13 @@ function startAutoUpdateCheck() {
8161
8316
  });
8162
8317
  }
8163
8318
  if (checkExistingDaemon()) {
8319
+ const msg = "Singleton conflict \u2014 a healthy daemon already owns the lock; deferring to it and exiting cleanly (code 0, intentional \u2014 NOT a failure, NOT a restart signal).";
8320
+ process.stderr.write(`[exed] ${msg}
8321
+ `);
8322
+ try {
8323
+ logDaemonHealth({ event: "singleton_conflict", pid: process.pid, message: msg });
8324
+ } catch {
8325
+ }
8164
8326
  process.exit(0);
8165
8327
  }
8166
8328
  writeFileSync5(PID_PATH, String(process.pid));
@@ -8389,7 +8551,7 @@ function startEventLoopLagDetector() {
8389
8551
  const msg = `[exed] EVENT LOOP BLOCKED ${(lag / 1e3).toFixed(1)}s \u2014 MCP UNRESPONSIVE. Sessions will die.`;
8390
8552
  process.stderr.write(msg + "\n");
8391
8553
  logDaemonHealth({ event: "event_loop_blocked", pid: process.pid, message: msg, data: { lagMs: lag } });
8392
- void import("../orchestration-events-KRQI4ED5.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
8554
+ void import("../orchestration-events-CKQ756NA.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
8393
8555
  recordOE({ eventType: "daemon.event_loop_blocked", source: "exe-daemon.lagDetector", severity: "error", durationMs: lag });
8394
8556
  }).catch(() => {
8395
8557
  });
@@ -8536,7 +8698,7 @@ function startTaskFileResync() {
8536
8698
  setTimeout(() => void traceDaemonTimer("task_file_resync", async () => {
8537
8699
  try {
8538
8700
  if (!await ensureStoreForPolling()) return;
8539
- const { readdir, readFile } = await import("fs/promises");
8701
+ const { readdir: readdir2, readFile: readFile2 } = await import("fs/promises");
8540
8702
  const { getClient } = await import("./database.js");
8541
8703
  const { runBudgetedSweep } = await import("../sweep-budget-KMPJ7O5Z.js");
8542
8704
  const client = getClient();
@@ -8547,7 +8709,7 @@ function startTaskFileResync() {
8547
8709
  const walkAsync = async (dir) => {
8548
8710
  let entries;
8549
8711
  try {
8550
- entries = await readdir(dir, { withFileTypes: true });
8712
+ entries = await readdir2(dir, { withFileTypes: true });
8551
8713
  } catch {
8552
8714
  return;
8553
8715
  }
@@ -8565,7 +8727,7 @@ function startTaskFileResync() {
8565
8727
  await walkAsync(tasksRoot);
8566
8728
  await runBudgetedSweep(paths, async (full) => {
8567
8729
  try {
8568
- const content = await readFile(full, "utf8");
8730
+ const content = await readFile2(full, "utf8");
8569
8731
  const id = content.match(/\*\*ID:\*\*\s*([a-f0-9-]+)/)?.[1];
8570
8732
  const title = content.split("\n")[0]?.replace(/^# /, "") || "";
8571
8733
  const assignedTo = content.match(/\*\*Assigned to:\*\*\s*(\w+)/)?.[1];
@@ -8583,7 +8745,7 @@ function startTaskFileResync() {
8583
8745
  });
8584
8746
  if (Number(res.rowsAffected ?? 0) > 0) {
8585
8747
  synced++;
8586
- void import("../orchestration-events-KRQI4ED5.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
8748
+ void import("../orchestration-events-CKQ756NA.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
8587
8749
  recordOE({
8588
8750
  eventType: "task_file.resynced",
8589
8751
  source: "exe-daemon.taskFileResync",
@@ -8617,7 +8779,7 @@ function startTaskGroupBarriers() {
8617
8779
  fired("task_group_barriers");
8618
8780
  if (!await ensureStoreForPolling()) return;
8619
8781
  try {
8620
- const { pollTaskGroupBarriers } = await import("../daemon-orchestration-DT5M2ZAR.js");
8782
+ const { pollTaskGroupBarriers } = await import("../daemon-orchestration-7425ZVNH.js");
8621
8783
  const firedCount = await pollTaskGroupBarriers();
8622
8784
  if (firedCount > 0) {
8623
8785
  acted("task_group_barriers");
@@ -8639,7 +8801,7 @@ function startCheckpointGc() {
8639
8801
  fired("checkpoint_gc");
8640
8802
  if (!await ensureStoreForPolling()) return;
8641
8803
  try {
8642
- const { gcStaleCheckpoints } = await import("../daemon-orchestration-DT5M2ZAR.js");
8804
+ const { gcStaleCheckpoints } = await import("../daemon-orchestration-7425ZVNH.js");
8643
8805
  const cleared = await gcStaleCheckpoints();
8644
8806
  if (cleared > 0) {
8645
8807
  acted("checkpoint_gc");
@@ -8679,14 +8841,14 @@ function startDispatchAckCleanup() {
8679
8841
  function startProjectionWorkerDeferred() {
8680
8842
  setTimeout(async () => {
8681
8843
  try {
8682
- const { startProjectionWorker } = await import("../projection-worker-LRFFQ6JB.js");
8844
+ const { startProjectionWorker } = await import("../projection-worker-MBWUPB5O.js");
8683
8845
  startProjectionWorker();
8684
8846
  } catch {
8685
8847
  }
8686
8848
  }, 2e4);
8687
8849
  }
8688
8850
  async function startToolTelemetry() {
8689
- const { startToolTelemetryFlush } = await import("../tool-telemetry-F7RWUNVK.js");
8851
+ const { startToolTelemetryFlush } = await import("../tool-telemetry-PALAZUXT.js");
8690
8852
  startToolTelemetryFlush();
8691
8853
  process.stderr.write("[exed] Tool telemetry started (flush every 5m)\n");
8692
8854
  }
@@ -8809,11 +8971,12 @@ function startLocalFirstTimers() {
8809
8971
  fired("intercom_dedup_cleanup");
8810
8972
  if (_intercomDedupCompleted) return;
8811
8973
  try {
8812
- const { existsSync: markerExists } = await import("fs");
8813
8974
  const markerPath = path4.join(os3.homedir(), ".exe-os", ".intercom-dedup-done");
8814
- if (markerExists(markerPath)) {
8975
+ try {
8976
+ await access(markerPath);
8815
8977
  _intercomDedupCompleted = true;
8816
8978
  return;
8979
+ } catch {
8817
8980
  }
8818
8981
  if (!await ensureStoreForPolling()) return;
8819
8982
  const { getClient } = await import("./database.js");
@@ -8826,8 +8989,7 @@ function startLocalFirstTimers() {
8826
8989
  }
8827
8990
  _intercomDedupCompleted = true;
8828
8991
  try {
8829
- const { writeFileSync: writeFileSync6 } = await import("fs");
8830
- writeFileSync6(markerPath, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
8992
+ await writeFile(markerPath, (/* @__PURE__ */ new Date()).toISOString(), "utf8");
8831
8993
  } catch {
8832
8994
  }
8833
8995
  } catch (err) {
@@ -8854,7 +9016,7 @@ function startLocalFirstTimers() {
8854
9016
  fired("orphan_task_cleanup");
8855
9017
  try {
8856
9018
  if (!await ensureStoreForPolling()) return;
8857
- const { cleanOrphanedTaskFiles } = await import("../tasks-crud-IWVDREXG.js");
9019
+ const { cleanOrphanedTaskFiles } = await import("../tasks-crud-NVNF3NRA.js");
8858
9020
  const count = await cleanOrphanedTaskFiles();
8859
9021
  if (count > 0) {
8860
9022
  acted("orphan_task_cleanup");
@@ -8870,7 +9032,7 @@ function startLocalFirstTimers() {
8870
9032
  fired("task_file_consistency");
8871
9033
  try {
8872
9034
  if (!await ensureStoreForPolling()) return;
8873
- const { checkTaskFileConsistency } = await import("../tasks-crud-IWVDREXG.js");
9035
+ const { checkTaskFileConsistency } = await import("../tasks-crud-NVNF3NRA.js");
8874
9036
  const mismatches = await checkTaskFileConsistency();
8875
9037
  if (mismatches > 0) {
8876
9038
  acted("task_file_consistency");
@@ -8889,7 +9051,7 @@ function startLocalFirstTimers() {
8889
9051
  const TELEMETRY_DAILY_MS = 24 * 60 * 60 * 1e3;
8890
9052
  const telemetryDaily = async () => {
8891
9053
  try {
8892
- const { sendTelemetry, isTelemetryEnabled } = await import("../telemetry-upload-3X5ESEKM.js");
9054
+ const { sendTelemetry, isTelemetryEnabled } = await import("../telemetry-upload-NY3EKOGY.js");
8893
9055
  if (!isTelemetryEnabled()) return;
8894
9056
  const { upstream } = await sendTelemetry(24);
8895
9057
  if (upstream.startsWith("sent")) {
@@ -9015,7 +9177,7 @@ async function enterDegradedBreakerMode(crashCount) {
9015
9177
  jsonrpc: "2.0",
9016
9178
  error: {
9017
9179
  code: -32002,
9018
- message: `exe-os daemon is DEGRADED \u2014 restart circuit breaker OPEN after ${crashCount} crash restarts (bug 2fee6110). Heavy work is suspended to protect system memory. Recover: 'exe-os daemon reset-breaker' then relaunch. Details: 'exe-os daemon status'.`
9180
+ message: `exe-os daemon is DEGRADED \u2014 restart circuit breaker OPEN after ${crashCount} crash restarts (bug 2fee6110). Heavy work is suspended to protect system memory. Recover: 'exe-os daemon reset-breaker' then 'exe-os daemon restart'. Details: 'exe-os daemon status'.`
9019
9181
  },
9020
9182
  id: null
9021
9183
  });
@@ -9031,7 +9193,10 @@ async function enterDegradedBreakerMode(crashCount) {
9031
9193
  crashRestartsInWindow: crashCount,
9032
9194
  version: PACKAGE_VERSION,
9033
9195
  alert: readBreakerAlert() ?? void 0,
9034
- recovery: "exe-os daemon reset-breaker"
9196
+ // Both steps, in order. A parked degraded daemon is ALIVE, so nothing
9197
+ // respawns it on its own — reset-breaker alone leaves MCP down and the
9198
+ // user reasonably concludes the product is broken.
9199
+ recovery: "exe-os daemon reset-breaker && exe-os daemon restart"
9035
9200
  }));
9036
9201
  return;
9037
9202
  }
@@ -9054,7 +9219,7 @@ async function enterDegradedBreakerMode(crashCount) {
9054
9219
  });
9055
9220
  setInterval(() => {
9056
9221
  process.stderr.write(
9057
- `[exed] DEGRADED (breaker open, ${crashCount} crashes). No DB/backups/timers. Recover: 'exe-os daemon reset-breaker'. Alert: ${restartBreakerAlertPath()}
9222
+ `[exed] DEGRADED (breaker open, ${crashCount} crashes). No DB/backups/timers. Recover: 'exe-os daemon reset-breaker' then 'exe-os daemon restart'. Alert: ${restartBreakerAlertPath()}
9058
9223
  `
9059
9224
  );
9060
9225
  }, 5 * 60 * 1e3);
@@ -9080,7 +9245,7 @@ try {
9080
9245
  }
9081
9246
  const breaker = recordDaemonRestart(void 0, coverageGap);
9082
9247
  process.stderr.write(
9083
- `[exed] Boot classified as ${breaker.bootClass} (${breaker.reasonLabel}); crashes=${breaker.crashInWindow}/${5}, restarts=${breaker.restartsInWindow} in window.
9248
+ `[exed] Boot classified as ${breaker.bootClass} (${breaker.reasonLabel}); crashes=${breaker.crashInWindow}/${RESTART_BREAKER_THRESHOLD}, restarts=${breaker.restartsInWindow} in window.
9084
9249
  `
9085
9250
  );
9086
9251
  try {
@@ -9123,6 +9288,15 @@ try {
9123
9288
  await new Promise(() => {
9124
9289
  });
9125
9290
  }
9291
+ try {
9292
+ const { initOrgPartnerRuntime } = await import("../org-partner-runtime-RNNUL5IN.js");
9293
+ await initOrgPartnerRuntime();
9294
+ } catch (err) {
9295
+ process.stderr.write(
9296
+ `[exed] Org Partner runtime failed to start: ${err instanceof Error ? err.message : String(err)}
9297
+ `
9298
+ );
9299
+ }
9126
9300
  const mcpRegPath = new URL("../mcp/register-tools.js", import.meta.url).href;
9127
9301
  const { registerAllTools: regFn } = await import(
9128
9302
  /* @vite-ignore */