@askexenow/exe-os 0.9.239 → 0.9.244

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/deploy/compose/.env.customer.example +12 -0
  2. package/deploy/compose/.env.example +13 -1
  3. package/deploy/compose/cloudflared/config.yml.example +29 -5
  4. package/deploy/compose/docker-compose.yml +27 -7
  5. package/deploy/compose/generate-env.ts +49 -1
  6. package/deploy/compose/init-db.sql +10 -2
  7. package/deploy/stack-manifests/v0.9.json +113 -9
  8. package/dist/{active-agent-7MIVNARP.js → active-agent-KO4ZWDXE.js} +4 -4
  9. package/dist/{active-agent-55C5Y3XL.js → active-agent-KP2O52HA.js} +4 -4
  10. package/dist/{agentic-ontology-NCAQIQQI.js → agentic-ontology-DXE5J6I5.js} +1 -1
  11. package/dist/{backfill-metadata-3JP7EZ2U.js → backfill-metadata-DFTIGPXP.js} +7 -7
  12. package/dist/{background-jobs-RWL46VRD.js → background-jobs-CRXY7T4Y.js} +2 -2
  13. package/dist/{behaviors-6BGALYGW.js → behaviors-BL3QCHBT.js} +4 -4
  14. package/dist/bin/age-ontology-load.js +2 -2
  15. package/dist/bin/agentic-ontology-backfill.js +9 -9
  16. package/dist/bin/agentic-reflection-backfill.js +10 -10
  17. package/dist/bin/agentic-semantic-label.js +9 -9
  18. package/dist/bin/backfill-conversations.js +9 -9
  19. package/dist/bin/backfill-responses.js +9 -9
  20. package/dist/bin/backfill-vectors.js +11 -11
  21. package/dist/bin/bulk-sync-postgres.js +10 -10
  22. package/dist/bin/cc-doctor.js +3 -3
  23. package/dist/bin/cleanup-stale-review-tasks.js +13 -13
  24. package/dist/bin/cli.js +27 -22
  25. package/dist/bin/exe-agent-config.js +4 -4
  26. package/dist/bin/exe-agent.js +8 -8
  27. package/dist/bin/exe-assign.js +11 -11
  28. package/dist/bin/exe-boot.js +22 -22
  29. package/dist/bin/exe-call.js +5 -5
  30. package/dist/bin/exe-cloud.js +8 -8
  31. package/dist/bin/exe-dispatch.js +13 -13
  32. package/dist/bin/exe-doctor.js +1 -1
  33. package/dist/bin/exe-export-behaviors.js +10 -10
  34. package/dist/bin/exe-forget.js +9 -9
  35. package/dist/bin/exe-gateway.js +8 -8
  36. package/dist/bin/exe-healthcheck.js +3 -3
  37. package/dist/bin/exe-heartbeat.js +13 -13
  38. package/dist/bin/exe-kill.js +18 -18
  39. package/dist/bin/exe-launch-agent.js +22 -22
  40. package/dist/bin/exe-new-employee.js +8 -8
  41. package/dist/bin/exe-pending-messages.js +14 -14
  42. package/dist/bin/exe-pending-notifications.js +13 -13
  43. package/dist/bin/exe-pending-reviews.js +13 -13
  44. package/dist/bin/exe-rename.js +5 -5
  45. package/dist/bin/exe-review.js +17 -17
  46. package/dist/bin/exe-search.js +8 -8
  47. package/dist/bin/exe-session-cleanup.js +20 -20
  48. package/dist/bin/exe-settings.js +7 -7
  49. package/dist/bin/exe-start-codex.js +14 -14
  50. package/dist/bin/exe-start-opencode.js +11 -11
  51. package/dist/bin/exe-status.js +14 -14
  52. package/dist/bin/exe-support.js +3 -3
  53. package/dist/bin/exe-team.js +4 -4
  54. package/dist/bin/git-sweep.js +13 -13
  55. package/dist/bin/graph-backfill.js +8 -8
  56. package/dist/bin/graph-export.js +8 -8
  57. package/dist/bin/import-history.js +10 -10
  58. package/dist/bin/install.js +7 -7
  59. package/dist/bin/intercom-check.js +4 -4
  60. package/dist/bin/mcp-sessions.js +2 -2
  61. package/dist/bin/orchestration-metrics.js +5 -5
  62. package/dist/bin/postgres-agentic-reflection-backfill.js +4 -4
  63. package/dist/bin/postgres-agentic-semantic-backfill.js +3 -3
  64. package/dist/bin/registry-proxy.js +1 -1
  65. package/dist/bin/scan-tasks.js +13 -13
  66. package/dist/bin/setup.js +3 -3
  67. package/dist/bin/shard-migrate.js +8 -8
  68. package/dist/bin/stack-update.js +348 -20
  69. package/dist/bin/verify-stack.js +3 -383
  70. package/dist/bin/vps-backup.js +8 -160
  71. package/dist/bin/vps-health-gate.js +10 -220
  72. package/dist/{branding-I7YYX4FM.js → branding-XWMO5EDR.js} +1 -1
  73. package/dist/{capacity-monitor-IFCZKRPG.js → capacity-monitor-4CSBC7AP.js} +14 -14
  74. package/dist/{catchup-brief-PIDRWXOW.js → catchup-brief-LF5Z6Q6E.js} +17 -17
  75. package/dist/{chunk-FGJUGDNM.js → chunk-222SI7QC.js} +14 -14
  76. package/dist/{chunk-JZMVLAZ2.js → chunk-2WBBVEIB.js} +1 -1
  77. package/dist/{chunk-JDOE33C2.js → chunk-3V53HH5T.js} +4 -4
  78. package/dist/{chunk-2KZSKURT.js → chunk-57SULZJ2.js} +3 -3
  79. package/dist/{chunk-QI4IXJN7.js → chunk-5CHYEKMH.js} +7 -4
  80. package/dist/chunk-5DMAMQNU.js +168 -0
  81. package/dist/{chunk-PLQAFB3Z.js → chunk-5JIG2FP2.js} +1 -1
  82. package/dist/{chunk-UWQ3XCDG.js → chunk-5WK7X5CF.js} +2 -2
  83. package/dist/{chunk-DDPAQ4LT.js → chunk-6JAGJN77.js} +2 -2
  84. package/dist/{chunk-7F37NMKB.js → chunk-73UE2PHT.js} +1 -1
  85. package/dist/{chunk-JL3K5OTS.js → chunk-7IZWLMTP.js} +1 -1
  86. package/dist/{chunk-ELRRL2NC.js → chunk-A4K2ZT6N.js} +4 -4
  87. package/dist/{chunk-GWYADLIW.js → chunk-AHXEU5XB.js} +1 -1
  88. package/dist/{chunk-WSHMBME6.js → chunk-AWRL5FGM.js} +19 -78
  89. package/dist/{chunk-OMPCFLWA.js → chunk-BSPOEYAO.js} +1 -1
  90. package/dist/{chunk-F4TCKCKK.js → chunk-BYCNUKII.js} +47 -12
  91. package/dist/{chunk-DHVC4RN7.js → chunk-CBDPEJOR.js} +5 -5
  92. package/dist/{chunk-2H55BIV2.js → chunk-CEJO7244.js} +2 -2
  93. package/dist/{chunk-FKWZVO2T.js → chunk-CPXGLSIL.js} +3 -3
  94. package/dist/{chunk-HX5G4AS4.js → chunk-CWITU7DW.js} +2 -2
  95. package/dist/{chunk-5GG7MTRJ.js → chunk-DGBGIXCC.js} +4 -4
  96. package/dist/{chunk-IQXPMK46.js → chunk-DLZYAYVM.js} +60 -14
  97. package/dist/{chunk-PPYWQV2M.js → chunk-DR5BGWFR.js} +2 -2
  98. package/dist/{chunk-BZWKTFEB.js → chunk-ENVRFBTB.js} +2 -2
  99. package/dist/{chunk-DUVO2PUJ.js → chunk-F3GM6OOP.js} +4 -4
  100. package/dist/{chunk-HNLPLLE6.js → chunk-F7JLZXHC.js} +60 -26
  101. package/dist/{chunk-AL4DRC5H.js → chunk-FFLILAG6.js} +1 -1
  102. package/dist/{chunk-BZNI4OK5.js → chunk-GHEWRYMY.js} +18 -2
  103. package/dist/{chunk-C7SFJO5F.js → chunk-GHT4REOS.js} +5 -5
  104. package/dist/{chunk-FBWUJEXS.js → chunk-HANG6NLF.js} +4 -6
  105. package/dist/{chunk-5NJ4A4ZA.js → chunk-HCBMPZDT.js} +1 -1
  106. package/dist/chunk-HOGTZLVU.js +244 -0
  107. package/dist/{chunk-IQSCZDBQ.js → chunk-I5PIBL56.js} +3 -3
  108. package/dist/chunk-IRHNV4GY.js +388 -0
  109. package/dist/{chunk-4HROS3GJ.js → chunk-IZVKWBIP.js} +1 -1
  110. package/dist/{chunk-DKI5BTBC.js → chunk-J7V7LPPX.js} +2 -2
  111. package/dist/{chunk-TOZ5NN5V.js → chunk-JLKUVK5J.js} +1 -1
  112. package/dist/{chunk-4SC65UBG.js → chunk-JLNXKG3K.js} +1 -1
  113. package/dist/{chunk-KVSQOG3W.js → chunk-K2BDE2B5.js} +4 -4
  114. package/dist/{chunk-KDJRFJDL.js → chunk-K333WOW4.js} +30 -2
  115. package/dist/{chunk-6LBCUA2A.js → chunk-KEZXW3RP.js} +1 -1
  116. package/dist/{chunk-W7G3GY4I.js → chunk-KLQI7QY4.js} +3 -3
  117. package/dist/{chunk-UODVZGBQ.js → chunk-KN7LPTIB.js} +1 -1
  118. package/dist/{chunk-ESKBZN4Q.js → chunk-L4WRH3DL.js} +1 -1
  119. package/dist/{chunk-VFQKKMKE.js → chunk-LAOB5BKV.js} +2 -2
  120. package/dist/{chunk-MAN5LZQ4.js → chunk-LQSFP2BV.js} +1 -1
  121. package/dist/{chunk-EJ7LOTV2.js → chunk-LSFHEMVI.js} +9 -9
  122. package/dist/{chunk-RA2RO27E.js → chunk-MCESA5UW.js} +2 -2
  123. package/dist/{chunk-UPMHG7ET.js → chunk-MEIHREPM.js} +1 -1
  124. package/dist/{chunk-D5C56WO3.js → chunk-MOZ2YQ54.js} +1 -1
  125. package/dist/{chunk-CLGB3FGL.js → chunk-MPX3TRMQ.js} +2 -2
  126. package/dist/{chunk-5R75ODPS.js → chunk-NBY6R37W.js} +61 -232
  127. package/dist/{chunk-RWFGXC35.js → chunk-NEYQAEYU.js} +7 -7
  128. package/dist/{chunk-MBHZDXGN.js → chunk-NL35XNLI.js} +1 -1
  129. package/dist/{chunk-TPQVLYSV.js → chunk-NLGMHPEN.js} +1 -1
  130. package/dist/{chunk-5LMH4YHG.js → chunk-NRVV4Y5V.js} +4 -4
  131. package/dist/{chunk-GN5VHPPR.js → chunk-NVZR7T4E.js} +1 -1
  132. package/dist/{chunk-Y2L7RMGH.js → chunk-NWBHL5PI.js} +1 -1
  133. package/dist/{chunk-YPYDLW75.js → chunk-OEMX65EA.js} +1 -1
  134. package/dist/{chunk-UAFUGPKO.js → chunk-ONAQAL3O.js} +1 -1
  135. package/dist/{chunk-AVM7XZE4.js → chunk-OWQ3CCYJ.js} +7 -6
  136. package/dist/{chunk-K525WLL7.js → chunk-PI6V23GF.js} +5 -4
  137. package/dist/{chunk-AURM7FOT.js → chunk-Q2OAQPWY.js} +1 -1
  138. package/dist/{chunk-FB5VRO5S.js → chunk-QLDWASTX.js} +28 -32
  139. package/dist/{chunk-EPWDTS2Q.js → chunk-QMTGMCWB.js} +1 -1
  140. package/dist/{chunk-VI2FJY2M.js → chunk-QP4FHME2.js} +2 -2
  141. package/dist/{chunk-NJWK6J4N.js → chunk-QUNKPR6Y.js} +5 -5
  142. package/dist/{chunk-O6DAF2TY.js → chunk-QUZVAHO7.js} +2 -2
  143. package/dist/{chunk-VHKL4S4T.js → chunk-RRHSONV5.js} +2 -2
  144. package/dist/{chunk-GPF6X6HE.js → chunk-RYDHEWYY.js} +2 -2
  145. package/dist/{chunk-SVXDCELZ.js → chunk-SHN5O73O.js} +32 -4
  146. package/dist/chunk-TD5CADZ5.js +230 -0
  147. package/dist/{chunk-C2YS2AA6.js → chunk-U7WOVXBB.js} +2 -2
  148. package/dist/{chunk-FE45RXGC.js → chunk-V2GZMY6O.js} +1 -1
  149. package/dist/{chunk-PATCHPNY.js → chunk-VHALWCUO.js} +1 -1
  150. package/dist/{chunk-HLZSC5WK.js → chunk-VQAP35DA.js} +20 -18
  151. package/dist/{chunk-452XB7OZ.js → chunk-VRIMTCX2.js} +1 -1
  152. package/dist/{chunk-SUNYJ6YE.js → chunk-VT2B5BHM.js} +1 -1
  153. package/dist/{chunk-UZIJDYDA.js → chunk-VWVJVQDH.js} +2 -2
  154. package/dist/{chunk-TRZ5KA2R.js → chunk-VXIMSRTO.js} +2 -2
  155. package/dist/{chunk-DAZIV4QZ.js → chunk-WCXZF42W.js} +1 -1
  156. package/dist/{chunk-6OJJF4WP.js → chunk-XJUUWHVN.js} +1 -1
  157. package/dist/{chunk-F7LU65PQ.js → chunk-Y25OJWOQ.js} +14 -2
  158. package/dist/{chunk-2ORPA23Y.js → chunk-YMXXD2GW.js} +36 -8
  159. package/dist/{chunk-5WLMF6PL.js → chunk-YMZHTTOQ.js} +1 -1
  160. package/dist/{chunk-7DIDOQCX.js → chunk-YRVW57UW.js} +139 -125
  161. package/dist/{chunk-BRFH5X7G.js → chunk-Z7VDUS6L.js} +1 -1
  162. package/dist/{chunk-YFE6W75D.js → chunk-ZKFPHJIJ.js} +1 -1
  163. package/dist/{chunk-5WUTKDH6.js → chunk-ZVXJSQOR.js} +1 -1
  164. package/dist/{co-activation-VB4CJQZB.js → co-activation-L6I2LSJO.js} +3 -3
  165. package/dist/{co-occurrence-XZQJJIBM.js → co-occurrence-QARWYUAY.js} +3 -3
  166. package/dist/{code-context-index-FCQOPUEA.js → code-context-index-UIYQRDHD.js} +4 -4
  167. package/dist/{content-extractor-SPSH5X33.js → content-extractor-EYRVGD6O.js} +2 -2
  168. package/dist/{conversation-wiki-populator-YU35LNRK.js → conversation-wiki-populator-L7O6F3BB.js} +1 -1
  169. package/dist/{crdt-sync-KXETGV45.js → crdt-sync-R6YROKDH.js} +1 -1
  170. package/dist/{crm-webhook-JMOAHTJ6.js → crm-webhook-WK3PYJJK.js} +2 -2
  171. package/dist/{cto-delegation-gate-IJ3KQIKF.js → cto-delegation-gate-5JZORQIT.js} +12 -12
  172. package/dist/{daemon-auth-2IZACWSG.js → daemon-auth-2HEOL6VG.js} +2 -2
  173. package/dist/{daemon-orchestration-ZCY4GEI3.js → daemon-orchestration-BJ3T5MMF.js} +16 -15
  174. package/dist/{db-backup-HLX5OLIV.js → db-backup-EWS52P2W.js} +2 -2
  175. package/dist/{dreaming-2CJML3TU.js → dreaming-BOSBDRI3.js} +13 -13
  176. package/dist/{entity-boost-T5IYWWDZ.js → entity-boost-6ZVX7DFB.js} +26 -2
  177. package/dist/{exe-drift-P5OIRNSH.js → exe-drift-WRE6RADZ.js} +4 -4
  178. package/dist/{exe-export-QQL2H322.js → exe-export-7N5PBCMK.js} +8 -8
  179. package/dist/{exe-import-V4RJCUEP.js → exe-import-YOOE7S3H.js} +8 -8
  180. package/dist/{exe-key-MENJGDD7.js → exe-key-GXJSTCX2.js} +4 -4
  181. package/dist/{exe-org-3FNET2J7.js → exe-org-42YMQL75.js} +2 -2
  182. package/dist/{exe-snapshot-YRARQE7F.js → exe-snapshot-ODUCFW7G.js} +18 -18
  183. package/dist/{fast-db-init-HIJWWKAO.js → fast-db-init-YSR7RMVZ.js} +1 -1
  184. package/dist/{founder-context-BQ5NBDUV.js → founder-context-Q2HUCZX4.js} +2 -2
  185. package/dist/gateway/index.js +9 -9
  186. package/dist/{gateway-client-YGSA5QMC.js → gateway-client-4QXHKN5C.js} +1 -1
  187. package/dist/{git-staleness-IHTKCUMN.js → git-staleness-BJDTCDPC.js} +3 -3
  188. package/dist/{git-task-sweep-5ZPNQS7Y.js → git-task-sweep-L3U3T5HM.js} +13 -13
  189. package/dist/{global-procedures-XHDIZRJU.js → global-procedures-HCHEHKY2.js} +4 -4
  190. package/dist/{graph-auto-extract-5TPT67GP.js → graph-auto-extract-FP5C76LS.js} +3 -3
  191. package/dist/{hook-integrity-SB53Y7UK.js → hook-integrity-2OU3T6UC.js} +1 -1
  192. package/dist/hooks/bug-report-worker.js +15 -14
  193. package/dist/hooks/codex-stop-task-finalizer.js +15 -14
  194. package/dist/hooks/commit-complete.js +16 -16
  195. package/dist/hooks/error-recall.js +10 -10
  196. package/dist/hooks/exe-heartbeat-hook.js +5 -5
  197. package/dist/hooks/ingest-worker.js +8 -8
  198. package/dist/hooks/ingest.js +13 -13
  199. package/dist/hooks/instructions-loaded.js +7 -7
  200. package/dist/hooks/manifest.json +20 -20
  201. package/dist/hooks/notification.js +6 -6
  202. package/dist/hooks/post-compact.js +15 -15
  203. package/dist/hooks/post-tool-combined.js +7 -7
  204. package/dist/hooks/pre-compact.js +20 -20
  205. package/dist/hooks/pre-tool-use.js +28 -25
  206. package/dist/hooks/prompt-submit.js +62 -31
  207. package/dist/hooks/session-end.js +26 -26
  208. package/dist/hooks/session-start.js +39 -15
  209. package/dist/hooks/stop.js +22 -22
  210. package/dist/hooks/subagent-stop.js +15 -15
  211. package/dist/hooks/summary-worker.js +32 -27
  212. package/dist/index.js +21 -21
  213. package/dist/{installer-AMZM4MLS.js → installer-AWMUCRN4.js} +7 -7
  214. package/dist/{installer-KT5FW4CN.js → installer-HB3NH6FG.js} +9 -9
  215. package/dist/{installer-HW74W3IT.js → installer-RU6EVOBL.js} +6 -6
  216. package/dist/{intercom-queue-RNM6EPGA.js → intercom-queue-A6UJEFIF.js} +1 -1
  217. package/dist/{key-backup-status-OZ2CXUDW.js → key-backup-status-4YKCV4ZV.js} +1 -1
  218. package/dist/lib/agent-config.js +2 -2
  219. package/dist/lib/cloud-sync.js +10 -8
  220. package/dist/lib/config.js +1 -1
  221. package/dist/lib/consolidation.js +8 -8
  222. package/dist/lib/database.js +3 -3
  223. package/dist/lib/db-daemon-client.js +3 -3
  224. package/dist/lib/db.js +3 -3
  225. package/dist/lib/device-registry.js +1 -1
  226. package/dist/lib/embedder.js +4 -4
  227. package/dist/lib/employee-templates.js +5 -5
  228. package/dist/lib/employees.js +3 -3
  229. package/dist/lib/exe-daemon-client.js +3 -3
  230. package/dist/lib/exe-daemon.js +105 -74
  231. package/dist/lib/hybrid-search.js +8 -8
  232. package/dist/lib/identity.js +3 -3
  233. package/dist/lib/keychain.js +1 -1
  234. package/dist/lib/license.js +2 -2
  235. package/dist/lib/messaging.js +13 -13
  236. package/dist/lib/post-tool-memory.js +3 -3
  237. package/dist/lib/registry-proxy.js +1 -1
  238. package/dist/lib/reminders.js +4 -4
  239. package/dist/lib/schedules.js +8 -8
  240. package/dist/lib/session-registry.js +5 -5
  241. package/dist/lib/skill-learning.js +5 -5
  242. package/dist/lib/store.js +7 -7
  243. package/dist/lib/task-router.js +4 -4
  244. package/dist/lib/tasks.js +14 -13
  245. package/dist/lib/tmux-routing.js +12 -12
  246. package/dist/lib/token-spend.js +4 -4
  247. package/dist/lib/ws-client.js +1 -1
  248. package/dist/{license-gate-XJDIL6OZ.js → license-gate-6JQQFBHS.js} +3 -3
  249. package/dist/mcp/register-tools.js +68 -67
  250. package/dist/mcp/server.js +70 -69
  251. package/dist/mcp/tools/complete-reminder.js +5 -5
  252. package/dist/mcp/tools/create-reminder.js +5 -5
  253. package/dist/mcp/tools/create-task.js +16 -15
  254. package/dist/mcp/tools/deactivate-behavior.js +6 -6
  255. package/dist/mcp/tools/list-reminders.js +5 -5
  256. package/dist/mcp/tools/list-tasks.js +16 -15
  257. package/dist/mcp/tools/send-message.js +15 -15
  258. package/dist/mcp/tools/update-task.js +15 -14
  259. package/dist/{mcp-http-config-BXX3RZPR.js → mcp-http-config-XIJR5P2Z.js} +4 -4
  260. package/dist/{memory-cards-KRTP5GFM.js → memory-cards-H4BJJ5OK.js} +3 -3
  261. package/dist/{memory-graph-extractor-G532PUHC.js → memory-graph-extractor-SDGM3GVR.js} +4 -4
  262. package/dist/{memory-poisoning-defense-HJM3FQA3.js → memory-poisoning-defense-UVU67DGJ.js} +3 -3
  263. package/dist/{memory-queue-FTNBWLS4.js → memory-queue-FNT5WHXP.js} +2 -2
  264. package/dist/{memory-queue-client-DHSHEIHQ.js → memory-queue-client-JZCFYTWQ.js} +5 -5
  265. package/dist/{memory-reflection-RANRFUQL.js → memory-reflection-GGB5K35L.js} +3 -3
  266. package/dist/{notifications-4P2PVEOT.js → notifications-P3XQZDTH.js} +12 -12
  267. package/dist/{orchestration-events-IYTASMSN.js → orchestration-events-25WEKUKH.js} +4 -4
  268. package/dist/{orchestration-phase-SGA7PJ5G.js → orchestration-phase-C26XVKLZ.js} +2 -2
  269. package/dist/{orchestrator-VKVHZ4MV.js → orchestrator-VIXTY4E4.js} +14 -14
  270. package/dist/{pipeline-router-E4L5BDXN.js → pipeline-router-S5PE5U6B.js} +4 -4
  271. package/dist/{plan-limits-5O5QG55H.js → plan-limits-DGIVM42H.js} +5 -5
  272. package/dist/{prediction-log-OMWHW7FL.js → prediction-log-DOEOHDHS.js} +1 -1
  273. package/dist/{project-boot-WMI6CWRX.js → project-boot-4ZL2W7DN.js} +12 -2
  274. package/dist/{projection-worker-54KRNQSO.js → projection-worker-GG2W5OM3.js} +3 -3
  275. package/dist/{push-notifications-E2XXEWJZ.js → push-notifications-AMHVR6DF.js} +2 -2
  276. package/dist/{reranker-4NTUFNYT.js → reranker-UCPLQZE2.js} +2 -2
  277. package/dist/{review-polling-BFRJDLUA.js → review-polling-P2MWEXLR.js} +13 -13
  278. package/dist/runtime/index.js +15 -15
  279. package/dist/{session-events-KCZCWGE4.js → session-events-5CD66R6U.js} +13 -13
  280. package/dist/{session-kill-telemetry-TMNIDYWY.js → session-kill-telemetry-7FBHTEDN.js} +4 -4
  281. package/dist/{session-scope-DRZBQ32Y.js → session-scope-VMIPAZU7.js} +12 -12
  282. package/dist/{setup-wizard-TQKGDAHO.js → setup-wizard-BNR47URR.js} +3 -3
  283. package/dist/{shard-manager-G6MHCO7X.js → shard-manager-VGA2TYHM.js} +2 -2
  284. package/dist/{skill-refinement-Z5SWD3AM.js → skill-refinement-NRG4WWRW.js} +3 -3
  285. package/dist/stack-release-PFZI22WC.js +521 -0
  286. package/dist/{stack-update-NO5MNARG.js → stack-update-7F2E2MBJ.js} +3 -3
  287. package/dist/{steward-gate-7DWYS5AT.js → steward-gate-L7DJMF4C.js} +4 -4
  288. package/dist/{task-enforcement-2VL5J6JJ.js → task-enforcement-XQL77PZH.js} +52 -12
  289. package/dist/{task-scope-YHALISIB.js → task-scope-R3XKBIHL.js} +12 -12
  290. package/dist/{tasks-crud-JXZEBZFR.js → tasks-crud-DQOG2NPG.js} +12 -12
  291. package/dist/tasks-notify-4EQYG52H.js +37 -0
  292. package/dist/{tasks-review-PGPYJQF5.js → tasks-review-XPFJ4DSJ.js} +12 -12
  293. package/dist/{telemetry-upload-H7OJNBIF.js → telemetry-upload-OT5B5HUY.js} +7 -7
  294. package/dist/{token-budget-JJ7JQIA2.js → token-budget-D2LQKCAV.js} +3 -3
  295. package/dist/{tool-capability-index-WIV4K3FB.js → tool-capability-index-FAJ5ZHDF.js} +1 -1
  296. package/dist/{tool-telemetry-W4LFCHFT.js → tool-telemetry-QIF5BCLF.js} +1 -1
  297. package/dist/tui/App.js +26 -26
  298. package/dist/{tui-data-72U6N2DC.js → tui-data-UEV2QOR3.js} +108 -12
  299. package/dist/{whatsapp-config-W63RQ3AU.js → whatsapp-config-GOSELKTE.js} +7 -0
  300. package/dist/{worker-gate-SCSN6IHI.js → worker-gate-PRCKA23W.js} +2 -2
  301. package/dist/{workflow-engine-OICYBE4F.js → workflow-engine-7X6LLH3M.js} +2 -2
  302. package/dist/{worktree-JXN4RCWC.js → worktree-RICSCT2S.js} +5 -5
  303. package/package.json +1 -1
  304. package/release-notes.json +210 -298
  305. package/stack.release.json +4 -3
  306. package/dist/preflight-EAH2MI76.js +0 -287
  307. /package/dist/{chunk-H42LEGLB.js → chunk-AQBEG33D.js} +0 -0
  308. /package/dist/{chunk-AU5426YP.js → chunk-B7JGEDVE.js} +0 -0
  309. /package/dist/{chunk-YFDDTHNM.js → chunk-JXI4XUTV.js} +0 -0
  310. /package/dist/{chunk-SNYDRHV3.js → chunk-U3DUFHOT.js} +0 -0
  311. /package/dist/{chunk-N2XUH2HQ.js → chunk-VBPC7IC7.js} +0 -0
  312. /package/dist/{chunk-HTUJBTBM.js → chunk-VUS6WXQ3.js} +0 -0
  313. /package/dist/{chunk-NOLIN2YI.js → chunk-XAYRZHLV.js} +0 -0
  314. /package/dist/{core-memory-VOBGGB2Q.js → core-memory-4KAIKQRQ.js} +0 -0
  315. /package/dist/{message-queue-client-KAJN6TIJ.js → message-queue-client-S6W5VMJV.js} +0 -0
  316. /package/dist/{oauth-server-QEXRSXEP.js → oauth-server-2ESBZB7F.js} +0 -0
  317. /package/dist/{webhook-pipe-LY4XEDL7.js → webhook-pipe-ZRUVOG5H.js} +0 -0
  318. /package/dist/{wiki-acl-M3OR547L.js → wiki-acl-MFLSS6DE.js} +0 -0
  319. /package/dist/{wiki-client-MAFYBXCQ.js → wiki-client-GBPR45BQ.js} +0 -0
@@ -0,0 +1,230 @@
1
+ // src/bin/vps-health-gate.ts
2
+ import { spawnSync } from "child_process";
3
+ import { appendFileSync, existsSync, mkdirSync, readdirSync } from "fs";
4
+ import http from "http";
5
+ import path from "path";
6
+ var DEPLOY_LOG = "/opt/exe-stack/deploy-log.jsonl";
7
+ var BACKUP_DIR = "/opt/exe-stack/backups";
8
+ async function checkCRM() {
9
+ const start = Date.now();
10
+ try {
11
+ const status = await httpGet("http://localhost:3000/api");
12
+ return {
13
+ check: "crm",
14
+ status: status >= 200 && status < 400 ? "pass" : "fail",
15
+ message: status >= 200 && status < 400 ? `CRM healthy (HTTP ${status})` : `CRM unhealthy (HTTP ${status})`,
16
+ durationMs: Date.now() - start
17
+ };
18
+ } catch (err) {
19
+ return {
20
+ check: "crm",
21
+ status: "fail",
22
+ message: `CRM unreachable: ${err instanceof Error ? err.message : err}`,
23
+ durationMs: Date.now() - start
24
+ };
25
+ }
26
+ }
27
+ async function checkGateway() {
28
+ const start = Date.now();
29
+ try {
30
+ const status = await httpGet("http://localhost:3100/health");
31
+ return {
32
+ check: "gateway",
33
+ status: status >= 200 && status < 300 ? "pass" : "fail",
34
+ message: status >= 200 && status < 300 ? `Gateway healthy (HTTP ${status})` : `Gateway unhealthy (HTTP ${status})`,
35
+ durationMs: Date.now() - start
36
+ };
37
+ } catch (err) {
38
+ return {
39
+ check: "gateway",
40
+ status: "fail",
41
+ message: `Gateway unreachable: ${err instanceof Error ? err.message : err}`,
42
+ durationMs: Date.now() - start
43
+ };
44
+ }
45
+ }
46
+ function checkPostgres() {
47
+ const start = Date.now();
48
+ const databaseUrl = process.env.DATABASE_URL || "postgres://exe@localhost:5432/exedb";
49
+ const result = spawnSync("psql", [databaseUrl, "-c", "SELECT 1"], {
50
+ encoding: "utf8",
51
+ stdio: ["pipe", "pipe", "pipe"],
52
+ timeout: 1e4
53
+ });
54
+ return {
55
+ check: "postgres",
56
+ status: result.status === 0 ? "pass" : "fail",
57
+ message: result.status === 0 ? "Postgres responding" : `Postgres failed: ${result.stderr?.trim() || `exit ${result.status}`}`,
58
+ durationMs: Date.now() - start
59
+ };
60
+ }
61
+ function checkRawEvents() {
62
+ const start = Date.now();
63
+ const databaseUrl = process.env.DATABASE_URL || "postgres://exe@localhost:5432/exedb";
64
+ const result = spawnSync(
65
+ "psql",
66
+ [databaseUrl, "-t", "-c", "SELECT count(*) FROM raw.raw_events"],
67
+ {
68
+ encoding: "utf8",
69
+ stdio: ["pipe", "pipe", "pipe"],
70
+ timeout: 1e4
71
+ }
72
+ );
73
+ if (result.status !== 0) {
74
+ return {
75
+ check: "raw_events",
76
+ status: "fail",
77
+ message: `raw.raw_events query failed: ${result.stderr?.trim() || `exit ${result.status}`}`,
78
+ durationMs: Date.now() - start
79
+ };
80
+ }
81
+ const count = parseInt(result.stdout?.trim() || "0", 10);
82
+ return {
83
+ check: "raw_events",
84
+ status: count > 0 ? "pass" : "fail",
85
+ message: count > 0 ? `raw.raw_events has ${count} rows` : "raw.raw_events is empty",
86
+ durationMs: Date.now() - start
87
+ };
88
+ }
89
+ async function checkGoTrue() {
90
+ const start = Date.now();
91
+ try {
92
+ const status = await httpGet("http://localhost:9999/health");
93
+ return {
94
+ check: "gotrue",
95
+ status: status >= 200 && status < 300 ? "pass" : "fail",
96
+ message: status >= 200 && status < 300 ? `GoTrue healthy (HTTP ${status})` : `GoTrue unhealthy (HTTP ${status})`,
97
+ durationMs: Date.now() - start
98
+ };
99
+ } catch (err) {
100
+ return {
101
+ check: "gotrue",
102
+ status: "fail",
103
+ message: `GoTrue unreachable: ${err instanceof Error ? err.message : err}`,
104
+ durationMs: Date.now() - start
105
+ };
106
+ }
107
+ }
108
+ async function runHealthGate() {
109
+ console.log("[health-gate] Running post-deploy health checks...\n");
110
+ const results = [];
111
+ results.push(checkPostgres());
112
+ results.push(checkRawEvents());
113
+ results.push(await checkCRM());
114
+ results.push(await checkGateway());
115
+ results.push(await checkGoTrue());
116
+ const passed = results.every((r) => r.status === "pass");
117
+ for (const r of results) {
118
+ const icon = r.status === "pass" ? "\u2713" : "\u2717";
119
+ const color = r.status === "pass" ? "\x1B[32m" : "\x1B[31m";
120
+ console.log(` ${color}${icon}\x1B[0m ${r.check.padEnd(12)} ${r.message} (${r.durationMs}ms)`);
121
+ }
122
+ console.log("");
123
+ const result = {
124
+ passed,
125
+ results,
126
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
127
+ };
128
+ return result;
129
+ }
130
+ function logResult(result) {
131
+ mkdirSync(path.dirname(DEPLOY_LOG), { recursive: true });
132
+ const line = JSON.stringify({
133
+ ...result,
134
+ type: "health_gate"
135
+ }) + "\n";
136
+ try {
137
+ appendFileSync(DEPLOY_LOG, line);
138
+ console.log(`[health-gate] Result logged to ${DEPLOY_LOG}`);
139
+ } catch (err) {
140
+ console.warn(`[health-gate] Failed to write deploy log: ${err instanceof Error ? err.message : err}`);
141
+ }
142
+ }
143
+ function restorePreDeployBackup() {
144
+ if (!existsSync(BACKUP_DIR)) return false;
145
+ const backups = readdirSync(BACKUP_DIR).filter((f) => f.startsWith("pg-pre-deploy-") && f.endsWith(".dump")).sort().reverse();
146
+ if (backups.length === 0) {
147
+ console.warn("[health-gate] No pre-deploy backup found to restore");
148
+ return false;
149
+ }
150
+ const latest = backups[0];
151
+ const filepath = path.join(BACKUP_DIR, latest);
152
+ const databaseUrl = process.env.DATABASE_URL || "postgres://exe@localhost:5432/exedb";
153
+ console.log(`[health-gate] Restoring pre-deploy backup: ${latest}`);
154
+ const result = spawnSync("pg_restore", ["-d", databaseUrl, "--clean", "--if-exists", filepath], {
155
+ encoding: "utf8",
156
+ stdio: ["pipe", "pipe", "pipe"],
157
+ timeout: 3e5
158
+ });
159
+ if (result.status !== 0) {
160
+ console.error(`[health-gate] pg_restore failed: ${result.stderr?.trim() || `exit ${result.status}`}`);
161
+ return false;
162
+ }
163
+ console.log("[health-gate] \u2713 Pre-deploy backup restored");
164
+ return true;
165
+ }
166
+ function httpGet(url) {
167
+ return new Promise((resolve, reject) => {
168
+ const req = http.request(url, { method: "GET", timeout: 1e4 }, (res) => {
169
+ res.resume();
170
+ resolve(res.statusCode ?? 0);
171
+ });
172
+ req.on("timeout", () => req.destroy(new Error("timeout")));
173
+ req.on("error", reject);
174
+ req.end();
175
+ });
176
+ }
177
+ async function main(args) {
178
+ if (args.includes("--help") || args.includes("-h")) {
179
+ console.log(`
180
+ exe-os vps-health-gate \u2014 Post-deploy health checks
181
+
182
+ Runs 5 checks: Postgres, raw_events, CRM, Gateway, GoTrue.
183
+ If any check fails, triggers rollback and exits with code 1.
184
+
185
+ Usage:
186
+ exe-os vps-health-gate Run health gate
187
+ exe-os vps-health-gate --check-only Run checks without rollback on failure
188
+ `);
189
+ return;
190
+ }
191
+ const checkOnly = args.includes("--check-only");
192
+ const result = await runHealthGate();
193
+ logResult(result);
194
+ if (result.passed) {
195
+ console.log("[health-gate] \u2713 All checks passed \u2014 deploy is healthy");
196
+ return;
197
+ }
198
+ const failed = result.results.filter((r) => r.status === "fail");
199
+ console.error(`[health-gate] \u2717 ${failed.length} check(s) failed`);
200
+ if (checkOnly) {
201
+ process.exitCode = 1;
202
+ return;
203
+ }
204
+ console.log("[health-gate] Starting rollback...");
205
+ restorePreDeployBackup();
206
+ try {
207
+ const { rollbackStackUpdate, defaultStackPaths } = await import("./stack-update-7F2E2MBJ.js");
208
+ const paths = defaultStackPaths();
209
+ await rollbackStackUpdate({
210
+ manifestRef: paths.manifestRef,
211
+ composeFile: paths.composeFile,
212
+ envFile: paths.envFile
213
+ });
214
+ console.log("[health-gate] \u2713 Stack rolled back to previous version");
215
+ } catch (err) {
216
+ console.error(`[health-gate] Stack rollback failed: ${err instanceof Error ? err.message : err}`);
217
+ }
218
+ process.exitCode = 1;
219
+ }
220
+
221
+ export {
222
+ checkCRM,
223
+ checkGateway,
224
+ checkPostgres,
225
+ checkRawEvents,
226
+ checkGoTrue,
227
+ runHealthGate,
228
+ logResult,
229
+ main
230
+ };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  listBehaviors
3
- } from "./chunk-UAFUGPKO.js";
3
+ } from "./chunk-ONAQAL3O.js";
4
4
  import {
5
5
  loadConfigSync
6
- } from "./chunk-TRZ5KA2R.js";
6
+ } from "./chunk-VXIMSRTO.js";
7
7
 
8
8
  // src/lib/behaviors-export.ts
9
9
  import os from "os";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  executeAction,
3
3
  substituteTemplate
4
- } from "./chunk-AU5426YP.js";
4
+ } from "./chunk-B7JGEDVE.js";
5
5
 
6
6
  // src/automation/workflow-engine.ts
7
7
  import { randomUUID } from "crypto";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getIdentity,
3
3
  loadEmployeesSync
4
- } from "./chunk-2H55BIV2.js";
4
+ } from "./chunk-CEJO7244.js";
5
5
 
6
6
  // src/lib/drift-probes.ts
7
7
  var DRIFT_THRESHOLD = 80;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  recordSessionKill
3
- } from "./chunk-452XB7OZ.js";
3
+ } from "./chunk-VRIMTCX2.js";
4
4
  import {
5
5
  updateTask
6
- } from "./chunk-5R75ODPS.js";
6
+ } from "./chunk-NBY6R37W.js";
7
7
  import {
8
8
  ensureEmployee,
9
9
  extractRootExe,
@@ -14,13 +14,13 @@ import {
14
14
  sessionScopeFilter,
15
15
  strictSessionScopeFilter,
16
16
  writeNotification
17
- } from "./chunk-HNLPLLE6.js";
17
+ } from "./chunk-F7JLZXHC.js";
18
18
  import {
19
19
  queueIntercom
20
- } from "./chunk-QI4IXJN7.js";
20
+ } from "./chunk-5CHYEKMH.js";
21
21
  import {
22
22
  listSessions
23
- } from "./chunk-BZNI4OK5.js";
23
+ } from "./chunk-GHEWRYMY.js";
24
24
  import {
25
25
  getTransport
26
26
  } from "./chunk-MVW62NIZ.js";
@@ -30,18 +30,18 @@ import {
30
30
  } from "./chunk-CX6GL3ZJ.js";
31
31
  import {
32
32
  recordOrchestrationEventBestEffort
33
- } from "./chunk-5NJ4A4ZA.js";
33
+ } from "./chunk-HCBMPZDT.js";
34
34
  import {
35
35
  getAgentRuntime
36
- } from "./chunk-6OJJF4WP.js";
36
+ } from "./chunk-XJUUWHVN.js";
37
37
  import {
38
38
  baseAgentName,
39
39
  isCoordinatorName,
40
40
  shouldAutoInstance
41
- } from "./chunk-2H55BIV2.js";
41
+ } from "./chunk-CEJO7244.js";
42
42
  import {
43
43
  loadConfigSync
44
- } from "./chunk-TRZ5KA2R.js";
44
+ } from "./chunk-VXIMSRTO.js";
45
45
 
46
46
  // src/lib/daemon-orchestration.ts
47
47
  import { execSync } from "child_process";
@@ -473,7 +473,7 @@ function createReviewNudgeRealDeps(_getClient) {
473
473
  return Number(rows[0]?.cnt ?? 0);
474
474
  },
475
475
  sendNudge: (sessionName) => {
476
- queueIntercom(sessionName, "review nudge: pending reviews");
476
+ queueIntercom(sessionName, "review nudge: pending reviews", "completion");
477
477
  },
478
478
  persistState: saveNudgeState
479
479
  };
@@ -666,7 +666,8 @@ function shouldAutoWake(input) {
666
666
  return true;
667
667
  }
668
668
  async function pollOrphanedTasks(deps, nowMs = Date.now()) {
669
- const globalGate = checkAutoWakeGates("__global__", nowMs);
669
+ const checkGate = deps.checkGate ?? checkAutoWakeGates;
670
+ const globalGate = checkGate("__global__", nowMs);
670
671
  if (globalGate) {
671
672
  process.stderr.write(`[auto-wake] GLOBAL GATE BLOCKED: ${globalGate} \u2014 skipping all spawns
672
673
  `);
@@ -762,7 +763,7 @@ async function pollOrphanedTasks(deps, nowMs = Date.now()) {
762
763
  }
763
764
  continue;
764
765
  }
765
- const agentGate = checkAutoWakeGates(key, nowMs);
766
+ const agentGate = checkGate(key, nowMs);
766
767
  if (agentGate) {
767
768
  process.stderr.write(`[auto-wake] AGENT GATE BLOCKED: ${agentId} \u2014 ${agentGate}
768
769
  `);
@@ -874,7 +875,7 @@ async function releaseStuckTasks(deps, nowMs = Date.now()) {
874
875
  }
875
876
  if (deps.notifyOrphan) {
876
877
  try {
877
- await deps.notifyOrphan(t.taskId, t.agentId);
878
+ await deps.notifyOrphan(t.taskId, t.agentId, t.sessionScope);
878
879
  } catch {
879
880
  }
880
881
  }
@@ -887,7 +888,7 @@ async function releaseStuckTasks(deps, nowMs = Date.now()) {
887
888
  );
888
889
  if (deps.notifyOrphan) {
889
890
  try {
890
- await deps.notifyOrphan(t.taskId, t.agentId);
891
+ await deps.notifyOrphan(t.taskId, t.agentId, t.sessionScope);
891
892
  } catch {
892
893
  }
893
894
  }
@@ -937,13 +938,14 @@ function createStuckTaskRealDeps(getClient) {
937
938
  const agentPart = sessionName.split("-")[0];
938
939
  return baseAgentName(agentPart);
939
940
  },
940
- notifyOrphan: async (taskId, agentId) => {
941
+ notifyOrphan: async (taskId, agentId, sessionScope) => {
941
942
  await writeNotification({
942
943
  agentId,
943
944
  agentRole: "employee",
944
945
  event: "orphan_task",
945
946
  project: "",
946
- summary: `Agent "${agentId}" session died \u2014 task ${taskId.slice(0, 8)} needs review (auto-closed: session ended without completion)`
947
+ summary: `Agent "${agentId}" session died \u2014 task ${taskId.slice(0, 8)} needs review (auto-closed: session ended without completion)`,
948
+ sessionScope: sessionScope ?? void 0
947
949
  });
948
950
  }
949
951
  };
@@ -1655,7 +1657,7 @@ async function reapOrphanedWorktrees(deps, nowMs = Date.now()) {
1655
1657
  }
1656
1658
  async function createWorktreeReaperRealDeps() {
1657
1659
  const { getPaneCwdAsync } = await import("./lib/tmux-status.js");
1658
- const { getGitRoot, isWorktreeDirty: isDirty } = await import("./worktree-JXN4RCWC.js");
1660
+ const { getGitRoot, isWorktreeDirty: isDirty } = await import("./worktree-RICSCT2S.js");
1659
1661
  const { statSync: statSync2 } = await import("fs");
1660
1662
  const { basename } = await import("path");
1661
1663
  const { promisify } = await import("util");
@@ -1796,7 +1798,7 @@ async function gcStaleCheckpoints() {
1796
1798
  }
1797
1799
  async function pollTaskGroupBarriers() {
1798
1800
  try {
1799
- const { checkAndFireBarriers } = await import("./tasks-crud-JXZEBZFR.js");
1801
+ const { checkAndFireBarriers } = await import("./tasks-crud-DQOG2NPG.js");
1800
1802
  const firedGroupIds = await checkAndFireBarriers();
1801
1803
  if (firedGroupIds.length === 0) return 0;
1802
1804
  const { getClient } = await import("./lib/database.js");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-2H55BIV2.js";
3
+ } from "./chunk-CEJO7244.js";
4
4
 
5
5
  // src/lib/session-kill-telemetry.ts
6
6
  import crypto from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  redactSecrets
3
- } from "./chunk-F7LU65PQ.js";
3
+ } from "./chunk-Y25OJWOQ.js";
4
4
  import {
5
5
  isExeMcpTool,
6
6
  stripExeMcpPrefix
@@ -7,10 +7,10 @@ import {
7
7
  import {
8
8
  connectEmbedDaemon,
9
9
  embedBatchViaClient
10
- } from "./chunk-VHKL4S4T.js";
10
+ } from "./chunk-RRHSONV5.js";
11
11
  import {
12
12
  EXE_AI_DIR
13
- } from "./chunk-TRZ5KA2R.js";
13
+ } from "./chunk-VXIMSRTO.js";
14
14
 
15
15
  // src/lib/code-context-index.ts
16
16
  import crypto from "crypto";
@@ -27,7 +27,7 @@ function resolveDataDir() {
27
27
  }
28
28
  }
29
29
  if (process.getuid?.() === 0) {
30
- const sudoUser = process.env.SUDO_USER;
30
+ const sudoUser = process.env.SUDO_USER || "";
31
31
  if (sudoUser) {
32
32
  try {
33
33
  const sudoHome = execSync(`getent passwd ${sudoUser} | cut -d: -f6`, { encoding: "utf8" }).trim();
@@ -63,7 +63,7 @@ var DB_PATH = path.join(EXE_AI_DIR, "memories.db");
63
63
  var MODELS_DIR = path.join(EXE_AI_DIR, "models");
64
64
  var CONFIG_PATH = path.join(EXE_AI_DIR, "config.json");
65
65
  function isDbAuthorityEnabled() {
66
- return process.env.EXE_DB_AUTHORITY === "1";
66
+ return (process.env.EXE_DB_AUTHORITY ?? "") === "1";
67
67
  }
68
68
  var LEGACY_LANCE_PATH = path.join(EXE_AI_DIR, "local.lance");
69
69
  var CURRENT_CONFIG_VERSION = 1;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createReminder
3
- } from "./chunk-5WLMF6PL.js";
3
+ } from "./chunk-YMZHTTOQ.js";
4
4
 
5
5
  // src/mcp/tools/create-reminder.ts
6
6
  import { z } from "zod";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-NGP6LSV2.js";
5
5
  import {
6
6
  EXE_AI_DIR
7
- } from "./chunk-TRZ5KA2R.js";
7
+ } from "./chunk-VXIMSRTO.js";
8
8
  import {
9
9
  atomicWriteJsonSync,
10
10
  ensurePrivateDirSync
@@ -1,4 +1,5 @@
1
1
  // src/lib/secret-redaction.ts
2
+ import { validateMnemonic } from "bip39";
2
3
  var SECRET_PATTERNS = [
3
4
  { name: "openai_key", pattern: /\bsk-[A-Za-z0-9_-]{20,}\b/g },
4
5
  { name: "anthropic_key", pattern: /\bsk-ant-[A-Za-z0-9_-]{20,}\b/g },
@@ -10,9 +11,15 @@ var SECRET_PATTERNS = [
10
11
  { name: "private_key", pattern: /-----BEGIN (?:OPENSSH|RSA|DSA|EC|PGP)? ?PRIVATE KEY-----[\s\S]*?-----END (?:OPENSSH|RSA|DSA|EC|PGP)? ?PRIVATE KEY-----/g },
11
12
  { name: "db_url_password", pattern: /\b(postgres(?:ql)?|mysql|mongodb|redis):\/\/([^:\s/@]+):([^@\s]+)@/gi },
12
13
  { name: "assignment_secret", pattern: /\b(api[_-]?key|secret|token|password|passwd|pwd|private[_-]?key|access[_-]?key)\s*[:=]\s*(['\"]?)[^\s'"]{8,}\2/gi },
13
- { name: "env_secret", pattern: /\b[A-Z0-9_]*(?:API_KEY|SECRET|TOKEN|PASSWORD|PASSWD|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*\s*=\s*['\"]?[^'"\s]{8,}/g },
14
- { name: "recovery_phrase", pattern: /\b(?:[a-z]{3,12}\s+){23}[a-z]{3,12}\b/gi }
14
+ { name: "env_secret", pattern: /\b[A-Z0-9_]*(?:API_KEY|SECRET|TOKEN|PASSWORD|PASSWD|PRIVATE_KEY|ACCESS_KEY)[A-Z0-9_]*\s*=\s*['\"]?[^'"\s]{8,}/g }
15
15
  ];
16
+ var MNEMONIC_CANDIDATE_RE = /\b(?:[a-z]{3,12}\s+){11,23}[a-z]{3,12}\b/g;
17
+ var MNEMONIC_LENGTHS = /* @__PURE__ */ new Set([12, 15, 18, 21, 24]);
18
+ function looksLikeBip39Mnemonic(candidate) {
19
+ const words = candidate.trim().split(/\s+/);
20
+ if (!MNEMONIC_LENGTHS.has(words.length)) return false;
21
+ return validateMnemonic(words.join(" "));
22
+ }
16
23
  function redactSecrets(input) {
17
24
  let text = input;
18
25
  let redactedCount = 0;
@@ -25,6 +32,11 @@ function redactSecrets(input) {
25
32
  return `[REDACTED:${name}]`;
26
33
  });
27
34
  }
35
+ text = text.replace(MNEMONIC_CANDIDATE_RE, (match) => {
36
+ if (!looksLikeBip39Mnemonic(match)) return match;
37
+ redactedCount++;
38
+ return "[REDACTED:recovery_phrase]";
39
+ });
28
40
  return { text, redactedCount };
29
41
  }
30
42
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EXE_AI_DIR
3
- } from "./chunk-TRZ5KA2R.js";
3
+ } from "./chunk-VXIMSRTO.js";
4
4
 
5
5
  // src/lib/shard-manager.ts
6
6
  import path from "path";
@@ -17,24 +17,32 @@ var _encryptionKey = null;
17
17
  var _shardingEnabled = false;
18
18
  var _keyValidated = false;
19
19
  var _keyValidationPromise = null;
20
+ var _validationFailedForKey = null;
21
+ var _validationWarningEmitted = false;
20
22
  function initShardManager(encryptionKey) {
21
23
  _encryptionKey = encryptionKey;
22
- _keyValidated = false;
23
24
  _keyValidationPromise = null;
25
+ _keyValidated = false;
24
26
  if (!existsSync(SHARDS_DIR)) {
25
27
  mkdirSync(SHARDS_DIR, { recursive: true });
26
28
  }
27
29
  const existingShards = readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db"));
28
30
  if (existingShards.length === 0) {
29
31
  _keyValidated = true;
32
+ _validationFailedForKey = null;
33
+ }
34
+ if (_validationFailedForKey === encryptionKey && existingShards.length > 0) {
35
+ _keyValidated = true;
36
+ _shardingEnabled = false;
37
+ } else {
38
+ _shardingEnabled = true;
30
39
  }
31
- _shardingEnabled = true;
32
40
  if (_evictionTimer) clearInterval(_evictionTimer);
33
41
  _evictionTimer = setInterval(evictIdleShards, EVICTION_INTERVAL_MS);
34
42
  _evictionTimer.unref();
35
43
  }
36
44
  async function validateEncryptionKey() {
37
- if (_keyValidated) return true;
45
+ if (_keyValidated) return _shardingEnabled;
38
46
  if (!_encryptionKey) return false;
39
47
  const existingShards = readdirSync(SHARDS_DIR).filter((f) => f.endsWith(".db"));
40
48
  if (existingShards.length === 0) {
@@ -48,6 +56,8 @@ async function validateEncryptionKey() {
48
56
  await testClient.execute("SELECT COUNT(*) FROM sqlite_schema");
49
57
  testClient.close();
50
58
  _keyValidated = true;
59
+ _validationFailedForKey = null;
60
+ _validationWarningEmitted = false;
51
61
  return true;
52
62
  } catch {
53
63
  try {
@@ -56,10 +66,16 @@ async function validateEncryptionKey() {
56
66
  }
57
67
  }
58
68
  }
59
- process.stderr.write(
60
- `[shard-manager] WARNING: encryption key cannot read any existing shards (${existingShards.length} found). New shard creation disabled to prevent stranded files. Run /exe-doctor to audit.
69
+ if (!_validationWarningEmitted) {
70
+ process.stderr.write(
71
+ `[shard-manager] WARNING: encryption key cannot read any existing shards (${existingShards.length} found). New shard creation disabled to prevent stranded files. Run /exe-doctor to audit.
61
72
  `
62
- );
73
+ );
74
+ _validationWarningEmitted = true;
75
+ }
76
+ _validationFailedForKey = _encryptionKey;
77
+ _keyValidated = true;
78
+ _keyValidationPromise = null;
63
79
  _shardingEnabled = false;
64
80
  return false;
65
81
  }
@@ -324,7 +340,9 @@ async function ensureShardSchema(client) {
324
340
  // Session scope (must match database.ts)
325
341
  "ALTER TABLE memories ADD COLUMN session_scope TEXT",
326
342
  // Keywords for FTS5 dual-column search (must match database.ts)
327
- "ALTER TABLE memories ADD COLUMN keywords TEXT DEFAULT ''"
343
+ "ALTER TABLE memories ADD COLUMN keywords TEXT DEFAULT ''",
344
+ // Multi-user founder scope (must match database.ts)
345
+ "ALTER TABLE memories ADD COLUMN founder_id TEXT"
328
346
  ]) {
329
347
  try {
330
348
  await client.execute(col);
@@ -469,6 +487,11 @@ async function ensureShardSchema(client) {
469
487
  `);
470
488
  }
471
489
  async function getReadyShardClient(projectName) {
490
+ if (!_shardingEnabled && _validationFailedForKey === _encryptionKey) {
491
+ throw new Error(
492
+ `Shard creation blocked: encryption key mismatch with existing shards. Run /exe-doctor to audit.`
493
+ );
494
+ }
472
495
  if (!_keyValidated) {
473
496
  if (!_keyValidationPromise) {
474
497
  _keyValidationPromise = validateEncryptionKey();
@@ -480,6 +503,11 @@ async function getReadyShardClient(projectName) {
480
503
  );
481
504
  }
482
505
  }
506
+ if (!_shardingEnabled) {
507
+ throw new Error(
508
+ `Shard creation blocked: encryption key mismatch with existing shards. Run /exe-doctor to audit.`
509
+ );
510
+ }
483
511
  const safeName = safeShardName(projectName);
484
512
  let client = getShardClient(projectName);
485
513
  try {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getClient
3
- } from "./chunk-2H55BIV2.js";
3
+ } from "./chunk-CEJO7244.js";
4
4
 
5
5
  // src/lib/reminders.ts
6
6
  import crypto from "crypto";