@askexenow/exe-os 0.9.384 → 0.9.389

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 (481) hide show
  1. package/deploy/compose/.env.askexe-control-plane.example +6 -0
  2. package/deploy/compose/.env.customer.example +1 -1
  3. package/deploy/compose/.env.example +1 -1
  4. package/deploy/compose/docker-compose.yml +16 -0
  5. package/deploy/compose/generate-env.ts +1 -1
  6. package/deploy/compose/sso-edge/sso-redirect.conf +18 -3
  7. package/deploy/stack-manifests/v0.9.json +1160 -1
  8. package/dist/.dist-verified.json +3 -3
  9. package/dist/{active-agent-F5V4E4UL.js → active-agent-RZ24KSJN.js} +8 -6
  10. package/dist/{active-agent-YTBB4ZQM.js → active-agent-YWSWPIEA.js} +8 -6
  11. package/dist/{agent-defs-generator-7TFISIJQ.js → agent-defs-generator-GY3UBREJ.js} +8 -6
  12. package/dist/{agent-heartbeat-CQPGJIFF.js → agent-heartbeat-GUVUUQVM.js} +1 -1
  13. package/dist/{agent-loop-EZ7LDAGD.js → agent-loop-HPNCH3HK.js} +1 -1
  14. package/dist/{agentic-ontology-XVTUVV7W.js → agentic-ontology-RHYNXEKE.js} +1 -1
  15. package/dist/{artifact-backup-TF6YWQT2.js → artifact-backup-HGUFSIJH.js} +19 -6
  16. package/dist/{backfill-metadata-J6MXIDCW.js → backfill-metadata-XLFASEOD.js} +11 -9
  17. package/dist/{backup-verify-6DVBQMDP.js → backup-verify-TUQEICWA.js} +1 -1
  18. package/dist/{behavior-injection-XDA7ZCYN.js → behavior-injection-GXO7ERGN.js} +14 -12
  19. package/dist/{behavior-promotion-4VLQ7LXK.js → behavior-promotion-V63WIZ4N.js} +13 -11
  20. package/dist/{behaviors-SCCZP7RZ.js → behaviors-RMLDPLOF.js} +18 -11
  21. package/dist/bin/agentic-ontology-backfill.js +12 -10
  22. package/dist/bin/agentic-reflection-backfill.js +13 -11
  23. package/dist/bin/agentic-semantic-label.js +12 -10
  24. package/dist/bin/backfill-conversations.js +11 -9
  25. package/dist/bin/backfill-responses.js +11 -9
  26. package/dist/bin/backfill-vectors.js +13 -11
  27. package/dist/bin/bulk-sync-postgres.js +20 -18
  28. package/dist/bin/cc-doctor.js +15 -13
  29. package/dist/bin/cleanup-stale-review-tasks.js +44 -32
  30. package/dist/bin/cli.js +109 -30
  31. package/dist/bin/customer-readiness.js +55 -25
  32. package/dist/bin/deferred-daemon-restart.js +111 -108
  33. package/dist/bin/exe-actions.js +7 -1
  34. package/dist/bin/exe-agent-config.js +8 -6
  35. package/dist/bin/exe-agent.js +18 -16
  36. package/dist/bin/exe-assign.js +13 -11
  37. package/dist/bin/exe-boot.js +49 -47
  38. package/dist/bin/exe-call.js +9 -7
  39. package/dist/bin/exe-cicd.js +19 -8
  40. package/dist/bin/exe-cloud.js +59 -25
  41. package/dist/bin/exe-config-dump.js +8 -6
  42. package/dist/bin/exe-dispatch.js +23 -21
  43. package/dist/bin/exe-doctor.js +11 -8
  44. package/dist/bin/exe-export-behaviors.js +16 -14
  45. package/dist/bin/exe-forget.js +14 -12
  46. package/dist/bin/exe-gateway.js +12 -10
  47. package/dist/bin/exe-grant.js +6 -6
  48. package/dist/bin/exe-healthcheck.js +15 -13
  49. package/dist/bin/exe-heartbeat.js +28 -26
  50. package/dist/bin/exe-kill.js +28 -26
  51. package/dist/bin/exe-launch-agent.js +35 -33
  52. package/dist/bin/exe-mcp.js +9 -7
  53. package/dist/bin/exe-memory-reads.js +11 -9
  54. package/dist/bin/exe-new-employee.js +13 -11
  55. package/dist/bin/exe-os-mcp-proxy.js +9 -7
  56. package/dist/bin/exe-pending-messages.js +23 -21
  57. package/dist/bin/exe-pending-notifications.js +22 -20
  58. package/dist/bin/exe-pending-reviews.js +23 -21
  59. package/dist/bin/exe-preflight.js +1 -1
  60. package/dist/bin/exe-rename.js +9 -7
  61. package/dist/bin/exe-review.js +59 -55
  62. package/dist/bin/exe-search-quality.js +16 -3
  63. package/dist/bin/exe-search.js +13 -11
  64. package/dist/bin/exe-session-cleanup.js +29 -27
  65. package/dist/bin/exe-settings.js +22 -20
  66. package/dist/bin/exe-start-codex.js +23 -21
  67. package/dist/bin/exe-start-opencode.js +21 -19
  68. package/dist/bin/exe-status.js +24 -22
  69. package/dist/bin/exe-support.js +3 -3
  70. package/dist/bin/exe-team.js +8 -6
  71. package/dist/bin/exe-verify-running-images.js +644 -17
  72. package/dist/bin/git-sweep.js +24 -22
  73. package/dist/bin/graph-backfill.js +12 -10
  74. package/dist/bin/graph-export.js +12 -10
  75. package/dist/bin/hooks-cli.js +4 -4
  76. package/dist/bin/import-history.js +16 -14
  77. package/dist/bin/install.js +113 -110
  78. package/dist/bin/intercom-check.js +5 -5
  79. package/dist/bin/mcp-sessions.js +2 -2
  80. package/dist/bin/orchestration-metrics.js +8 -6
  81. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  82. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  83. package/dist/bin/pre-build-guard.js +55 -16
  84. package/dist/bin/pre-publish.js +1 -1
  85. package/dist/bin/prune-orphan-chunks.js +154 -28
  86. package/dist/bin/reconcile-backlog.js +5 -3
  87. package/dist/bin/registry-proxy.js +1 -1
  88. package/dist/bin/repair-document-chunks.js +11 -9
  89. package/dist/bin/scan-tasks.js +23 -21
  90. package/dist/bin/setup.js +3 -3
  91. package/dist/bin/shard-migrate.js +12 -10
  92. package/dist/bin/stack-update.js +622 -43
  93. package/dist/bin/verify-stack.js +2 -2
  94. package/dist/bin/vps-health-gate.js +1 -1
  95. package/dist/{boot-generation-Q7LGQ3AO.js → boot-generation-VCQXVYGT.js} +7 -5
  96. package/dist/{boot-review-sections-G5774FR5.js → boot-review-sections-3QO6Q7MP.js} +21 -19
  97. package/dist/{branch-hygiene-44WLSOZR.js → branch-hygiene-DDXXI6ZA.js} +59 -21
  98. package/dist/bug-landed-reconciler-TQVNOUCU.js +353 -0
  99. package/dist/build-manifest.json +1269 -1194
  100. package/dist/{capability-cards-I3RHCF4F.js → capability-cards-XPDLT6LU.js} +6 -4
  101. package/dist/{capacity-monitor-7I7GDONU.js → capacity-monitor-N3AW242L.js} +23 -21
  102. package/dist/{catchup-brief-3T5PARIR.js → catchup-brief-3PKX7FUP.js} +29 -27
  103. package/dist/{chunk-C5ISP5FO.js → chunk-2BKJAOO4.js} +11 -1
  104. package/dist/{chunk-JJTPPAZY.js → chunk-2CUQHG6H.js} +1609 -1356
  105. package/dist/{chunk-HU3VD4MQ.js → chunk-2Q2GGYBX.js} +1 -1
  106. package/dist/{chunk-CHIUS5QB.js → chunk-36LMIOVU.js} +9 -9
  107. package/dist/{chunk-46VSBDUW.js → chunk-3DCBDG4T.js} +2 -2
  108. package/dist/{chunk-W3KPQE7H.js → chunk-3GL3E4TD.js} +3 -3
  109. package/dist/{chunk-GL47M7NY.js → chunk-3UD3OF3X.js} +202 -117
  110. package/dist/{chunk-WNBZJSQT.js → chunk-3VW5ZP2F.js} +1 -1
  111. package/dist/{chunk-JDDM6C57.js → chunk-3X74IQBU.js} +1 -1
  112. package/dist/{chunk-NVFNADTX.js → chunk-3ZL4MDQ6.js} +18 -4
  113. package/dist/{chunk-R5E7WNAC.js → chunk-4ESNDGMB.js} +3 -3
  114. package/dist/{chunk-CYCIX7AW.js → chunk-4FLLIQRQ.js} +2 -2
  115. package/dist/{chunk-3RGTLZNO.js → chunk-4GAKF7KR.js} +99 -74
  116. package/dist/{chunk-RVO5O5SR.js → chunk-4S3A52AV.js} +38 -10
  117. package/dist/{chunk-7J2ZQ4XN.js → chunk-4VQ3QR6B.js} +29 -28
  118. package/dist/{chunk-MROSARM5.js → chunk-5BJBTFFQ.js} +7 -1
  119. package/dist/chunk-5LQZABW5.js +6 -0
  120. package/dist/chunk-5ONMHTNI.js +236 -0
  121. package/dist/{chunk-APL7HUE3.js → chunk-5QQJUO3F.js} +200 -31
  122. package/dist/{chunk-UOPCVFVR.js → chunk-5RK75SWH.js} +205 -278
  123. package/dist/{chunk-T5FEAQES.js → chunk-5TYJYGS5.js} +1 -1
  124. package/dist/{chunk-P3QQ52QK.js → chunk-5U6EOTZV.js} +3 -3
  125. package/dist/{chunk-ALRHGEAJ.js → chunk-637FL62O.js} +1 -1
  126. package/dist/{chunk-PUBA5B4M.js → chunk-6L4VIYLZ.js} +33 -19
  127. package/dist/{chunk-VF2KRROX.js → chunk-754P2UXM.js} +1 -1
  128. package/dist/{chunk-CM7N5MBY.js → chunk-7FZG7WP4.js} +5 -5
  129. package/dist/{chunk-NYLJQ2M2.js → chunk-7NEBFB3L.js} +4 -4
  130. package/dist/{chunk-E7C2WNR5.js → chunk-AEIOFFFX.js} +5 -5
  131. package/dist/{chunk-VOVFUKEB.js → chunk-AIB2EWO2.js} +5 -5
  132. package/dist/{chunk-EGOEB42T.js → chunk-AP2C4OGS.js} +3 -3
  133. package/dist/{chunk-MPZ2AVNS.js → chunk-ATNV3BVZ.js} +1 -1
  134. package/dist/{chunk-F4BBMIPG.js → chunk-B4XJQBQB.js} +2 -2
  135. package/dist/{chunk-BPVFZ6Q4.js → chunk-B5EGDNG6.js} +2 -2
  136. package/dist/{chunk-AGC2V7JS.js → chunk-B6CBN6EF.js} +1 -1
  137. package/dist/{chunk-KTKIFXIP.js → chunk-B7FDRN7G.js} +1 -1
  138. package/dist/{chunk-C5HUMAA7.js → chunk-B7WVYLAQ.js} +67 -15
  139. package/dist/chunk-BGVP5RMT.js +185 -0
  140. package/dist/{chunk-FVLNNNH6.js → chunk-BNI4LIU5.js} +35 -4
  141. package/dist/{chunk-P4XLIPB7.js → chunk-BU5JRLZT.js} +1 -1
  142. package/dist/{chunk-PHUHIVD5.js → chunk-C6U7XWOC.js} +34 -5
  143. package/dist/chunk-C7GHNJPW.js +8 -0
  144. package/dist/{chunk-4AR5XKCH.js → chunk-CL2MU3OX.js} +1 -1
  145. package/dist/{chunk-ZPP63JSQ.js → chunk-CL3AB7Z2.js} +1 -1
  146. package/dist/{chunk-FHIFTSPL.js → chunk-CP7XUSOF.js} +8 -3
  147. package/dist/{chunk-3OX34OC3.js → chunk-CUDNRHHT.js} +30 -10
  148. package/dist/chunk-CYUUNIEL.js +21 -0
  149. package/dist/{chunk-P2UY34XE.js → chunk-D4C57S2H.js} +5 -5
  150. package/dist/{chunk-XSUALA32.js → chunk-DDYFNBYV.js} +3 -3
  151. package/dist/{chunk-LSNBTGW4.js → chunk-DPYZW42H.js} +1 -1
  152. package/dist/{chunk-FMIYFHLE.js → chunk-E2PRXEZK.js} +9 -3
  153. package/dist/{chunk-L63V25HS.js → chunk-E54SPUYJ.js} +3 -3
  154. package/dist/{chunk-DMUOTCDN.js → chunk-E5CKRHIZ.js} +1 -1
  155. package/dist/{chunk-BV2IET6B.js → chunk-EVMOKRBC.js} +15 -2
  156. package/dist/{chunk-YLFCH3VA.js → chunk-FDWI3T6I.js} +133 -31
  157. package/dist/{chunk-PWC3C5ME.js → chunk-FNJTCJGY.js} +4 -4
  158. package/dist/{chunk-TNS63ATU.js → chunk-FWRPDSO3.js} +350 -50
  159. package/dist/{chunk-JA3Y5TV6.js → chunk-GDLB6BPM.js} +141 -74
  160. package/dist/{chunk-IGJMS7C5.js → chunk-GOVGG7HU.js} +2 -2
  161. package/dist/{chunk-MB47DRF5.js → chunk-GP7CTIUK.js} +2 -2
  162. package/dist/{chunk-L5EPGGDP.js → chunk-GWAN2BDB.js} +4 -4
  163. package/dist/{chunk-YRQ26MNP.js → chunk-H3YF7X4J.js} +12 -5
  164. package/dist/{chunk-VLBHZ6TF.js → chunk-H6PLIFUE.js} +2 -2
  165. package/dist/{chunk-GSLFH4AI.js → chunk-HRNM3N4Y.js} +6 -15
  166. package/dist/chunk-IG2ISRTF.js +48 -0
  167. package/dist/{chunk-MWEIBVBS.js → chunk-IJCWBYA5.js} +14 -1
  168. package/dist/{chunk-NKEFYE4R.js → chunk-IPTUKX3N.js} +1 -1
  169. package/dist/{chunk-RB3J2WYQ.js → chunk-IVE7H6KA.js} +1 -1
  170. package/dist/{chunk-HA63SH5W.js → chunk-IWY2OGQG.js} +1 -1
  171. package/dist/{chunk-BQEZPRUC.js → chunk-IZWMWJZT.js} +64 -46
  172. package/dist/{chunk-AHESD3KW.js → chunk-J4UVI652.js} +1 -1
  173. package/dist/{chunk-PLII76NJ.js → chunk-JBUCA4OX.js} +33 -6
  174. package/dist/{chunk-2PZTMSMG.js → chunk-JOF4HQDF.js} +5 -5
  175. package/dist/{chunk-OBBO6EJR.js → chunk-JQN3QGSF.js} +1 -1
  176. package/dist/{chunk-P4PIZOL2.js → chunk-JWYIH5DR.js} +3 -3
  177. package/dist/{chunk-3XY57PKT.js → chunk-KZLKE7I3.js} +210 -48
  178. package/dist/{chunk-DYVLEMKS.js → chunk-L3GXMYBK.js} +1 -1
  179. package/dist/{chunk-72V3S44T.js → chunk-LUA4SLJY.js} +46 -19
  180. package/dist/{chunk-ZT4LFTUJ.js → chunk-LW3JCBXP.js} +20 -3
  181. package/dist/{chunk-YLB365YX.js → chunk-M5XHN4OM.js} +3 -3
  182. package/dist/{chunk-VHHX4UCP.js → chunk-MDTWARSF.js} +22 -93
  183. package/dist/{chunk-JFJP6ATJ.js → chunk-MWKXQSF6.js} +3 -2
  184. package/dist/{chunk-VJEJ7JNB.js → chunk-N32DVIKY.js} +1 -1
  185. package/dist/{chunk-MUCNYSJP.js → chunk-NRLJOV7M.js} +32 -4
  186. package/dist/{chunk-PL4CFSQ7.js → chunk-NSXJOSH7.js} +1 -1
  187. package/dist/{chunk-NF5FOSLD.js → chunk-NVTG66CK.js} +1 -1
  188. package/dist/chunk-O45GBJEH.js +1500 -0
  189. package/dist/{chunk-4AAMFWJT.js → chunk-OHZSTZXN.js} +4 -2
  190. package/dist/chunk-OSIS7ZQW.js +344 -0
  191. package/dist/{chunk-E3ZM32LF.js → chunk-P22VFGFK.js} +14 -5
  192. package/dist/{chunk-KILR4FBR.js → chunk-PAFLR7WD.js} +3 -3
  193. package/dist/{chunk-R3CZWFFC.js → chunk-PEYQ6MWO.js} +15 -3
  194. package/dist/{chunk-RDWIKDMY.js → chunk-PZR54BEI.js} +8 -20
  195. package/dist/{chunk-2FKU4ZEO.js → chunk-QDBKMEYY.js} +9 -9
  196. package/dist/{chunk-7UHZBVP3.js → chunk-QDVLVLXP.js} +97 -31
  197. package/dist/{chunk-PRDDPQLC.js → chunk-QLXEQRHD.js} +5 -5
  198. package/dist/{chunk-MUAWCFW6.js → chunk-QNPDXV5V.js} +5 -2
  199. package/dist/{chunk-LR5O2XWZ.js → chunk-QUZYLDNJ.js} +5 -5
  200. package/dist/chunk-RBQUXHYK.js +48 -0
  201. package/dist/{chunk-3SUPEE6H.js → chunk-RDMBSHGG.js} +3 -3
  202. package/dist/{chunk-I5XIW2BP.js → chunk-RGUM474V.js} +7 -7
  203. package/dist/{chunk-OAFENIHN.js → chunk-RJ67XAJU.js} +76 -28
  204. package/dist/{chunk-LFUBEHFW.js → chunk-RT57D7C4.js} +39 -1
  205. package/dist/{chunk-MKM6D7JM.js → chunk-RWG7DLOG.js} +42 -5
  206. package/dist/{chunk-P3UX5EH4.js → chunk-RWKAHHIX.js} +3 -3
  207. package/dist/{chunk-XEBKIWI7.js → chunk-RYNT3HB7.js} +12 -12
  208. package/dist/{chunk-EUGEFBGV.js → chunk-S2V272KJ.js} +3 -3
  209. package/dist/{chunk-W6BZ4UGA.js → chunk-SGYEM2PD.js} +1 -1
  210. package/dist/{chunk-VROK4X2L.js → chunk-SJP57MQM.js} +1 -1
  211. package/dist/{chunk-5MVKTNZP.js → chunk-SL4JWAMQ.js} +54 -4
  212. package/dist/{chunk-MOANZQXF.js → chunk-SLMKLEU6.js} +1 -1
  213. package/dist/{chunk-RZN2LEAK.js → chunk-SQA7XCYI.js} +3 -3
  214. package/dist/{chunk-4YNA3CM6.js → chunk-SSFS4NCH.js} +262 -56
  215. package/dist/{chunk-6FIC57PH.js → chunk-T4P2G3PO.js} +1 -1
  216. package/dist/{chunk-5U2IJBFV.js → chunk-TA3B4N24.js} +1 -1
  217. package/dist/{chunk-ZOTTYCP5.js → chunk-TEWWBVQP.js} +40 -4
  218. package/dist/{chunk-SDYWZRPN.js → chunk-TLSFGXXE.js} +1 -1
  219. package/dist/{chunk-L3VUW5M4.js → chunk-TQS2YHLB.js} +1 -1
  220. package/dist/{chunk-KXYKSLW4.js → chunk-TU4M757W.js} +399 -116
  221. package/dist/{chunk-MC4IM2CC.js → chunk-TYD4F4XU.js} +6 -6
  222. package/dist/{chunk-TKS5GMYA.js → chunk-U44Y7RC7.js} +2 -0
  223. package/dist/{chunk-B7AMNZTC.js → chunk-UKBPEEEQ.js} +2 -2
  224. package/dist/{chunk-ZBPZDADW.js → chunk-UWVXQEQQ.js} +467 -78
  225. package/dist/{chunk-P2VVMGMI.js → chunk-V4WH3FV7.js} +35 -16
  226. package/dist/{worktree-ownership-guard-O6JQF2CL.js → chunk-V6F4I2XY.js} +13 -14
  227. package/dist/{chunk-JFTUAV4J.js → chunk-VBKUESIW.js} +1 -1
  228. package/dist/{chunk-AZSTIAVL.js → chunk-VBPYYJPC.js} +1 -1
  229. package/dist/{chunk-LKTN22L6.js → chunk-VIP4LKLO.js} +57 -24
  230. package/dist/{chunk-L5CGXEZC.js → chunk-WAAGVFFN.js} +63 -71
  231. package/dist/{chunk-D3LXVAIQ.js → chunk-WC7AE3PT.js} +244 -103
  232. package/dist/{chunk-EOTZSAQL.js → chunk-WUCUDHKR.js} +1 -1
  233. package/dist/{chunk-VF3BZOZK.js → chunk-X7HZHKY4.js} +50 -3
  234. package/dist/{chunk-LFBLQE2P.js → chunk-XCAKYVKI.js} +1 -1
  235. package/dist/{chunk-UXN4BICC.js → chunk-XMX5J52Z.js} +1 -1
  236. package/dist/{chunk-6YDY6ZTD.js → chunk-XTCXGWTV.js} +9 -4
  237. package/dist/{chunk-XUZK23V7.js → chunk-XW2FW6LS.js} +2 -2
  238. package/dist/{chunk-CH7BUBP3.js → chunk-XWVHUDEK.js} +5 -4
  239. package/dist/{chunk-S26CV7BE.js → chunk-YA5LK6KB.js} +45 -8
  240. package/dist/{chunk-ELCRJGCH.js → chunk-YMRQIENV.js} +2 -2
  241. package/dist/{chunk-QNZ4562V.js → chunk-Z3LXWCB7.js} +1 -1
  242. package/dist/{chunk-EYMFVITZ.js → chunk-Z7I6NQMA.js} +2 -2
  243. package/dist/{chunk-6BJCDWSM.js → chunk-ZB4FS2EG.js} +1 -1
  244. package/dist/{chunk-ZAEUEDTN.js → chunk-ZD6FZ3WL.js} +1 -1
  245. package/dist/{chunk-FEU6QEEL.js → chunk-ZM6EZAVY.js} +1 -0
  246. package/dist/{chunk-2KY7WZZF.js → chunk-ZPA4R2UI.js} +1 -1
  247. package/dist/chunk-ZPPPHVSU.js +285 -0
  248. package/dist/{chunk-ELEGH4DX.js → chunk-ZUGQPYUY.js} +51 -4
  249. package/dist/{chunk-UX2EO653.js → chunk-ZZWFZ46U.js} +66 -8
  250. package/dist/{cleanup-graph-garbage-VQAJ2RBT.js → cleanup-graph-garbage-HFUD5ZQT.js} +12 -10
  251. package/dist/{cloud-sync-command-J7NEFUY7.js → cloud-sync-command-3JHJJKPN.js} +25 -3
  252. package/dist/{cloud-sync-db-init-KWEMNMGA.js → cloud-sync-db-init-2LHIQOSF.js} +1 -1
  253. package/dist/{cloud-sync-shutdown-P63AUTUI.js → cloud-sync-shutdown-ZXAXA3Z7.js} +6 -4
  254. package/dist/{cloud-sync-state-QF3TMMJ4.js → cloud-sync-state-VSQFGPP6.js} +1 -1
  255. package/dist/{co-activation-7IHRPBZN.js → co-activation-NX4EH4AP.js} +6 -4
  256. package/dist/{co-occurrence-R5AG4OAU.js → co-occurrence-5LBYCW3U.js} +10 -8
  257. package/dist/{consent-passphrase-5ZBDJ5G7.js → consent-passphrase-65W3DJIJ.js} +2 -2
  258. package/dist/{content-extractor-ZLXC6GNR.js → content-extractor-OGXETBOX.js} +2 -2
  259. package/dist/{conversation-entity-extractor-7FRKLLBD.js → conversation-entity-extractor-FQCOAH4F.js} +5 -4
  260. package/dist/conversations-retention-XTBFJBUM.js +166 -0
  261. package/dist/{crdt-sync-IFRZOEIS.js → crdt-sync-7TDUBTLH.js} +4 -4
  262. package/dist/{crm-webhook-L2S63ASV.js → crm-webhook-776JTY55.js} +2 -2
  263. package/dist/{cto-delegation-gate-3WU7OHX7.js → cto-delegation-gate-ZNUWVYCN.js} +25 -23
  264. package/dist/{daemon-orchestration-3VQYKLOR.js → daemon-orchestration-76BOFDEP.js} +30 -24
  265. package/dist/{doc-graph-extractor-YIR5E7OF.js → doc-graph-extractor-F724KZJX.js} +10 -8
  266. package/dist/{documents-QEHPTYIY.js → documents-Q24V4GRD.js} +13 -11
  267. package/dist/{dreaming-LNFE7DTN.js → dreaming-IY6NQTSP.js} +27 -25
  268. package/dist/{employee-boot-brief-ZTXDYNWM.js → employee-boot-brief-CCTXO5DQ.js} +35 -29
  269. package/dist/{entity-boost-R5N6JWXD.js → entity-boost-XGOB7HDM.js} +1 -1
  270. package/dist/{exe-drift-WYSJVZFO.js → exe-drift-NEPXLNGP.js} +7 -5
  271. package/dist/{exe-export-GOLNAEAV.js → exe-export-ZHJQFKR2.js} +14 -12
  272. package/dist/{exe-import-U4BSI6OH.js → exe-import-7SVNI4FW.js} +14 -12
  273. package/dist/{exe-key-V42G3NGO.js → exe-key-QJKU56WZ.js} +119 -108
  274. package/dist/{exe-org-U4GLQ6OP.js → exe-org-SJXHLV6K.js} +76 -51
  275. package/dist/{exe-snapshot-U7ONBYNY.js → exe-snapshot-EFWPXTXE.js} +45 -36
  276. package/dist/{fast-db-init-W3NGKAEU.js → fast-db-init-BQZOQNT3.js} +1 -1
  277. package/dist/{founder-context-ZSIBRVDM.js → founder-context-KG2ZAOXY.js} +2 -2
  278. package/dist/{founder-monitor-envelope-L3IWZLFY.js → founder-monitor-envelope-NYB5LLU4.js} +4 -4
  279. package/dist/gateway/index.js +20 -18
  280. package/dist/{gateway-client-DJFCVIPT.js → gateway-client-ODMUXUL3.js} +1 -1
  281. package/dist/{git-staleness-OF24QXFZ.js → git-staleness-OPGEAJA7.js} +6 -4
  282. package/dist/{global-procedures-WSIOWO43.js → global-procedures-3KXY4LL6.js} +8 -6
  283. package/dist/{graph-auto-extract-IEVVN3L3.js → graph-auto-extract-I7H2F5NJ.js} +10 -8
  284. package/dist/{graph-query-JDZWAVCU.js → graph-query-E7JBSNY5.js} +1 -1
  285. package/dist/{graph-rag-BKAD2XQA.js → graph-rag-H24CMFP2.js} +5 -4
  286. package/dist/{hook-integrity-TPWDGX2M.js → hook-integrity-PGQ3OX4S.js} +1 -1
  287. package/dist/{hook-prefetch-FD6VGJJA.js → hook-prefetch-7AZJER6Z.js} +23 -21
  288. package/dist/hook-registration-liveness-NGQRFKAA.js +11 -0
  289. package/dist/hooks/bug-report-worker.js +26 -24
  290. package/dist/hooks/codex-stop-task-finalizer.js +28 -26
  291. package/dist/hooks/commit-complete.js +26 -24
  292. package/dist/hooks/error-recall.js +16 -14
  293. package/dist/hooks/exe-heartbeat-hook.js +9 -7
  294. package/dist/hooks/ingest-worker.js +12 -10
  295. package/dist/hooks/ingest.js +22 -17
  296. package/dist/hooks/instructions-loaded.js +11 -9
  297. package/dist/hooks/manifest.json +20 -20
  298. package/dist/hooks/notification.js +10 -8
  299. package/dist/hooks/post-compact.js +9 -7
  300. package/dist/hooks/post-tool-combined.js +14 -14
  301. package/dist/hooks/pre-compact.js +26 -24
  302. package/dist/hooks/pre-tool-use.js +2 -2
  303. package/dist/hooks/prompt-submit.js +47 -41
  304. package/dist/hooks/session-end.js +38 -42
  305. package/dist/hooks/session-start.js +26 -18
  306. package/dist/hooks/stop.js +29 -27
  307. package/dist/hooks/subagent-stop.js +29 -27
  308. package/dist/hooks/summary-worker.js +32 -30
  309. package/dist/index.js +37 -35
  310. package/dist/{installer-OTI5SA43.js → installer-2ZS3LHCU.js} +12 -9
  311. package/dist/{installer-NMOBSEZ2.js → installer-NH3A3HWC.js} +14 -9
  312. package/dist/{installer-SRJGE4GU.js → installer-UJ73PGRD.js} +21 -9
  313. package/dist/{intercom-queue-4FFXCBHO.js → intercom-queue-OE25GJF2.js} +21 -19
  314. package/dist/lib/agent-config.js +2 -2
  315. package/dist/lib/cloud-sync.js +24 -18
  316. package/dist/lib/consolidation.js +13 -11
  317. package/dist/lib/crypto.js +3 -3
  318. package/dist/lib/database.js +6 -4
  319. package/dist/lib/db-backup.js +1 -1
  320. package/dist/lib/db-write-worker-client.js +3 -1
  321. package/dist/lib/db-write-worker.js +65 -89
  322. package/dist/lib/db.js +6 -4
  323. package/dist/lib/delivery-truth.js +5 -1
  324. package/dist/lib/device-registry.js +1 -1
  325. package/dist/lib/embedder.js +2 -2
  326. package/dist/lib/employee-templates.js +9 -7
  327. package/dist/lib/employees.js +6 -4
  328. package/dist/lib/exe-daemon.js +425 -314
  329. package/dist/lib/file-grep.js +15 -21
  330. package/dist/lib/hybrid-search.js +19 -13
  331. package/dist/lib/identity-templates.js +1 -1
  332. package/dist/lib/identity.js +6 -4
  333. package/dist/lib/keychain.js +1 -1
  334. package/dist/lib/license.js +22 -6
  335. package/dist/lib/messaging.js +22 -20
  336. package/dist/lib/post-tool-memory.js +10 -8
  337. package/dist/lib/registry-proxy.js +1 -1
  338. package/dist/lib/reminders.js +7 -5
  339. package/dist/lib/runtime-table.js +1 -1
  340. package/dist/lib/schedules.js +12 -10
  341. package/dist/lib/session-registry.js +8 -6
  342. package/dist/lib/skill-learning.js +13 -11
  343. package/dist/lib/status-brief.js +2 -2
  344. package/dist/lib/store.js +17 -9
  345. package/dist/lib/task-router.js +7 -5
  346. package/dist/lib/tasks.js +23 -21
  347. package/dist/lib/tmux-routing.js +21 -19
  348. package/dist/lib/tmux-status.js +4 -1
  349. package/dist/lib/token-spend.js +7 -5
  350. package/dist/lib/ws-client.js +1 -1
  351. package/dist/{license-gate-R4JWTWM4.js → license-gate-XQ2KN5I5.js} +3 -3
  352. package/dist/{license-recheck-3MBJ4IJX.js → license-recheck-IIBKR2V5.js} +1 -1
  353. package/dist/{license-sync-BVSG3WMW.js → license-sync-76JVI2M5.js} +151 -8
  354. package/dist/{local-secret-inventory-JWNBHZZ4.js → local-secret-inventory-MJT7NJLY.js} +2 -2
  355. package/dist/{mailbox-inbox-MTAT4MXX.js → mailbox-inbox-BPZP4GIZ.js} +1 -1
  356. package/dist/maintenance-worker-54VZTFIK.js +371 -0
  357. package/dist/mcp/register-tools.js +110 -107
  358. package/dist/mcp/server.js +113 -110
  359. package/dist/mcp/tools/complete-reminder.js +8 -6
  360. package/dist/mcp/tools/create-reminder.js +8 -6
  361. package/dist/mcp/tools/create-task.js +26 -24
  362. package/dist/mcp/tools/deactivate-behavior.js +15 -13
  363. package/dist/mcp/tools/list-reminders.js +8 -6
  364. package/dist/mcp/tools/list-tasks.js +26 -24
  365. package/dist/mcp/tools/send-message.js +25 -23
  366. package/dist/mcp/tools/update-task.js +24 -22
  367. package/dist/{mcp-child-registry-TIZERM7O.js → mcp-child-registry-5VUG5ATZ.js} +1 -1
  368. package/dist/{mcp-http-config-VUMSFWFH.js → mcp-http-config-SKXESWHA.js} +9 -7
  369. package/dist/{mcp-session-identity-DZHWEJRV.js → mcp-session-identity-HYMLJXXA.js} +21 -19
  370. package/dist/{memory-cards-JVXTMSAT.js → memory-cards-PAZDUQ3B.js} +16 -32
  371. package/dist/{memory-graph-extractor-PPBJMYFJ.js → memory-graph-extractor-BC6QKBY6.js} +11 -9
  372. package/dist/{memory-poisoning-defense-K5Q74XQ4.js → memory-poisoning-defense-BRGIHF6J.js} +9 -7
  373. package/dist/{memory-pressure-watchdog-YMJH5CSA.js → memory-pressure-watchdog-HR6TPOMT.js} +22 -20
  374. package/dist/{memory-reflection-7BZWIHRE.js → memory-reflection-LO7VFBL3.js} +38 -59
  375. package/dist/memory-write-repository-J25USX63.js +16 -0
  376. package/dist/{monitor-grants-Q7X3MYQP.js → monitor-grants-YQTO6NWR.js} +3 -3
  377. package/dist/{monitor-identity-ZQB4IXEE.js → monitor-identity-POVTG76Y.js} +2 -2
  378. package/dist/{notification-ledger-XRAXL5OI.js → notification-ledger-KLD6GZTG.js} +22 -20
  379. package/dist/{notifications-JE3PX55X.js → notifications-3R6HNHDR.js} +21 -19
  380. package/dist/{orchestration-events-JCQ5F5IJ.js → orchestration-events-CHY3GOJD.js} +7 -5
  381. package/dist/{orchestrator-X65INDTR.js → orchestrator-GAL3HOAD.js} +23 -21
  382. package/dist/{org-brief-session-3PQ22UIX.js → org-brief-session-LQ2DBYVF.js} +17 -15
  383. package/dist/{org-consent-policy-VGELJ7K7.js → org-consent-policy-KFUP7QPG.js} +5 -5
  384. package/dist/{org-join-6TO5ZYUZ.js → org-join-MXZCIQWX.js} +8 -8
  385. package/dist/{org-key-admin-XHYVRRAZ.js → org-key-admin-4UK6QUT7.js} +9 -9
  386. package/dist/{org-key-pin-TTTYGTQL.js → org-key-pin-ZOX4OM3O.js} +3 -3
  387. package/dist/{org-membership-Y7T2BS57.js → org-membership-D5TPN45F.js} +4 -4
  388. package/dist/{org-partner-config-OP4NEUNF.js → org-partner-config-3FXSYPQA.js} +7 -7
  389. package/dist/{org-partner-runtime-YNVUNT2R.js → org-partner-runtime-TH3LMPII.js} +20 -16
  390. package/dist/{org-row-visibility-JBBXNYXD.js → org-row-visibility-Y5R33C5U.js} +1 -1
  391. package/dist/{pipeline-router-EIBB7QNG.js → pipeline-router-E2JZLDK6.js} +7 -5
  392. package/dist/{plan-limits-MEWXYLEN.js → plan-limits-NYI6R4IK.js} +9 -7
  393. package/dist/{platform-procedures-Z7ZGBJWN.js → platform-procedures-RTD5E3BD.js} +5 -3
  394. package/dist/{pre-tool-use-impl-C6KJY22W.js → pre-tool-use-impl-LT4FRXBP.js} +127 -83
  395. package/dist/{project-boot-VEYFCCSL.js → project-boot-LIMXQKAF.js} +25 -17
  396. package/dist/{project-name-UYORSNGE.js → project-name-V62GWALX.js} +7 -5
  397. package/dist/{projection-worker-WYFDWS57.js → projection-worker-KLE3IZQ2.js} +5 -2
  398. package/dist/{prospective-memory-E6XBQFJA.js → prospective-memory-HRN7JFT2.js} +6 -4
  399. package/dist/{push-notifications-M7YU63FY.js → push-notifications-XC6EQEXF.js} +22 -20
  400. package/dist/{reproject-worktree-memories-B5XMGJSD.js → reproject-worktree-memories-4CAVZSFE.js} +21 -19
  401. package/dist/{reranker-SRA4BR7N.js → reranker-2RU6IIX2.js} +1 -1
  402. package/dist/{retrieval-health-P2JPZUPV.js → retrieval-health-4Q5TOV2S.js} +1 -1
  403. package/dist/{review-polling-KQPN7IQE.js → review-polling-WOWIMBCL.js} +22 -20
  404. package/dist/runtime/index.js +30 -28
  405. package/dist/{session-events-6LDDKKY3.js → session-events-OPMS2C5F.js} +22 -20
  406. package/dist/{session-kill-telemetry-5DSRGWCL.js → session-kill-telemetry-3GWATSIX.js} +22 -20
  407. package/dist/{session-scope-XG5R3P3D.js → session-scope-TIRGR4MH.js} +21 -19
  408. package/dist/{setup-wizard-7QFLZIKT.js → setup-wizard-B2JBVGNH.js} +3 -3
  409. package/dist/{shard-manager-HHHHV2KZ.js → shard-manager-C7LYX6E4.js} +5 -1
  410. package/dist/{skill-refinement-I5RMAHSC.js → skill-refinement-FWQFYNBI.js} +7 -5
  411. package/dist/skill-retrieval-PPLFC5RY.js +166 -0
  412. package/dist/skill-usage-NDB67PU2.js +25 -0
  413. package/dist/{stack-generate-manifest-AKMZ3AUX.js → stack-generate-manifest-AXI55MEQ.js} +6 -6
  414. package/dist/{stack-promote-34CE2HHF.js → stack-promote-6N23OGZY.js} +6 -6
  415. package/dist/stack-release-2CXFYVWM.js +2770 -0
  416. package/dist/{stack-update-ZQQ5YYPJ.js → stack-update-U53FBVCQ.js} +13 -5
  417. package/dist/{steward-gate-AQJ6KT2C.js → steward-gate-TUA3QCN7.js} +7 -5
  418. package/dist/{subagent-brief-injection-3GU7YAWY.js → subagent-brief-injection-N52RWYFZ.js} +34 -32
  419. package/dist/{subagent-spawn-ledger-52I66CLW.js → subagent-spawn-ledger-OI23OT4I.js} +1 -1
  420. package/dist/support-bug-actions-XWCJI6S5.js +30 -0
  421. package/dist/support-inbox-MMVTCXRX.js +77 -0
  422. package/dist/{support-outbox-KNI3FR3G.js → support-outbox-2TG2UV6J.js} +2 -2
  423. package/dist/{task-enforcement-CAA6D2MH.js → task-enforcement-JDMBAAOY.js} +22 -20
  424. package/dist/{task-request-inbox-QBZVU66E.js → task-request-inbox-PKJCYKJV.js} +9 -5
  425. package/dist/{task-scope-NHXB4ZRN.js → task-scope-32HQEV6W.js} +27 -19
  426. package/dist/{tasks-crud-JHSWL5NM.js → tasks-crud-CYKUKS3F.js} +21 -19
  427. package/dist/{tasks-notify-7PBE4U7T.js → tasks-notify-YND5MKWJ.js} +22 -20
  428. package/dist/{tasks-review-PPPVEE62.js → tasks-review-CG2A5GM3.js} +23 -19
  429. package/dist/{telemetry-upload-YU2VRNHX.js → telemetry-upload-WLUMEFAB.js} +11 -9
  430. package/dist/{token-budget-QCMWKG3K.js → token-budget-3YHAY5LL.js} +7 -5
  431. package/dist/{tool-capability-index-7AWQAJRP.js → tool-capability-index-2ADOWH43.js} +2 -2
  432. package/dist/{tool-gates-5Q3RSQEG.js → tool-gates-7ENOOYMR.js} +5 -3
  433. package/dist/{tool-gates-QD26D2NE.js → tool-gates-EKJTLVGN.js} +1 -1
  434. package/dist/{tool-telemetry-LTOIC64I.js → tool-telemetry-VUP7S6HC.js} +1 -1
  435. package/dist/tui/App.js +59 -35
  436. package/dist/{tui-data-NDBXD6U7.js → tui-data-BOQTOW2G.js} +25 -23
  437. package/dist/{update-support-BMJM4NG7.js → update-support-WT3S3AQ4.js} +21 -21
  438. package/dist/{whatsapp-QQLDAHUX.js → whatsapp-OZGIF2EM.js} +2 -2
  439. package/dist/{wiki-acl-W6WDCVCP.js → wiki-acl-LTEQJVDA.js} +1 -1
  440. package/dist/{work-claims-6DM32MGO.js → work-claims-CMV2GWIW.js} +8 -6
  441. package/dist/{work-state-heartbeat-HG7D4AWJ.js → work-state-heartbeat-S45TXK4M.js} +1 -1
  442. package/dist/{worker-gate-FTMW7GBB.js → worker-gate-7Z6NMM3G.js} +1 -1
  443. package/dist/{workflow-engine-ZWC6CCXE.js → workflow-engine-ZSQDXZQ7.js} +2 -2
  444. package/dist/{worktree-EMQCPGFE.js → worktree-NMWDVT6N.js} +8 -6
  445. package/dist/worktree-ownership-guard-ZVIWJAOP.js +35 -0
  446. package/dist/{worktree-sweep-XVUJZBXV.js → worktree-sweep-Q62ZIT3U.js} +9 -7
  447. package/package.json +14 -8
  448. package/release-notes.json +7 -41
  449. package/src/commands/exe/afk.md +6 -0
  450. package/src/commands/exe/call.md +6 -0
  451. package/src/commands/exe/employee-heartbeat.md +6 -0
  452. package/src/commands/exe/intercom.md +6 -0
  453. package/src/commands/exe/kill.md +6 -0
  454. package/src/commands/exe/launch.md +6 -0
  455. package/src/commands/exe/logs.md +1 -1
  456. package/src/commands/exe/sessions.md +6 -0
  457. package/src/commands/exe/setup.md +7 -3
  458. package/src/commands/exe/status.md +6 -0
  459. package/src/commands/exe-reference.md +25 -36
  460. package/src/commands/exe.md +19 -28
  461. package/stack.release.json +11 -11
  462. package/dist/chunk-3B6FLNLV.js +0 -30
  463. package/dist/chunk-FXU7JOXK.js +0 -6
  464. package/dist/chunk-QFAFKEB5.js +0 -820
  465. package/dist/conversations-retention-C4BLKFEL.js +0 -54
  466. package/dist/stack-release-5PGWV5D4.js +0 -1607
  467. package/dist/support-inbox-NY5TB3FN.js +0 -51
  468. /package/dist/{chunk-U2D6PJ5T.js → chunk-65G7ZTGE.js} +0 -0
  469. /package/dist/{chunk-DN3ZR3UE.js → chunk-CP7Z35MJ.js} +0 -0
  470. /package/dist/{chunk-XDVOGDBC.js → chunk-KBBWALJV.js} +0 -0
  471. /package/dist/{chunk-JRIH6I7D.js → chunk-LZXYPTY4.js} +0 -0
  472. /package/dist/{chunk-GIRD7O5X.js → chunk-MCWEW2SG.js} +0 -0
  473. /package/dist/{chunk-TKAU7IJ2.js → chunk-MQHUJLCA.js} +0 -0
  474. /package/dist/{chunk-M4XY4JRK.js → chunk-O53LTOXK.js} +0 -0
  475. /package/dist/{chunk-DZN7SDY2.js → chunk-OSVTH3SG.js} +0 -0
  476. /package/dist/{chunk-AJK2PVQW.js → chunk-QXXEXGX3.js} +0 -0
  477. /package/dist/{chunk-AWWDKF22.js → chunk-SFWNTO2F.js} +0 -0
  478. /package/dist/{chunk-2Q2CD6CD.js → chunk-WC5HF2FN.js} +0 -0
  479. /package/dist/{core-memory-O6D5UC3T.js → core-memory-MMMW3TF3.js} +0 -0
  480. /package/dist/{memory-isolation-EBFFC6HF.js → memory-isolation-67ACKQ2M.js} +0 -0
  481. /package/dist/{oauth-server-ZKBUHDFI.js → oauth-server-OILIKR7D.js} +0 -0
@@ -4,11 +4,13 @@ import {
4
4
  assertHostReadyForApply,
5
5
  assertProductionDeployGate,
6
6
  assertSignedManifestDeliveryGate,
7
+ backupStackConfig,
7
8
  bootstrapStackHost,
8
9
  builtinStackManifestPublicKeyPath,
9
10
  composeArgsForStack,
10
11
  computeServiceSelectionMerge,
11
12
  createStackUpdatePlan,
13
+ defaultPostJson,
12
14
  defaultStackPaths,
13
15
  detectDanglingVolumes,
14
16
  detectMissingRequiredEnvVars,
@@ -22,6 +24,7 @@ import {
22
24
  printDanglingVolumes,
23
25
  printVolumeCleanupResult,
24
26
  readCurrentStackVersion,
27
+ reconcileStackLockFromContainers,
25
28
  removeDanglingVolumes,
26
29
  reportStackManifestSource,
27
30
  requiredImagePinKeys,
@@ -30,31 +33,32 @@ import {
30
33
  runStackUpdate,
31
34
  saveServiceSelection,
32
35
  serviceSelectionPath,
36
+ verifyComposeServicesRunning,
33
37
  verifyManifestImagesAvailable,
34
38
  warnUnmanagedManifestServices
35
- } from "../chunk-ZBPZDADW.js";
39
+ } from "../chunk-UWVXQEQQ.js";
36
40
  import "../chunk-EC5H53YD.js";
37
41
  import {
38
42
  runVerifyStack
39
- } from "../chunk-AGC2V7JS.js";
43
+ } from "../chunk-B6CBN6EF.js";
40
44
  import {
41
45
  assertPreflightGate,
42
46
  runPreflightOnManifest
43
- } from "../chunk-PLII76NJ.js";
44
- import "../chunk-C5HUMAA7.js";
47
+ } from "../chunk-JBUCA4OX.js";
48
+ import "../chunk-B7WVYLAQ.js";
45
49
  import {
46
50
  preDeployBackup
47
51
  } from "../chunk-5DMAMQNU.js";
48
52
  import {
49
53
  logResult,
50
54
  runHealthGate
51
- } from "../chunk-AHESD3KW.js";
55
+ } from "../chunk-J4UVI652.js";
52
56
  import "../chunk-L25OAFOU.js";
53
- import "../chunk-LFUBEHFW.js";
57
+ import "../chunk-RT57D7C4.js";
54
58
  import "../chunk-FTZET5YX.js";
55
- import "../chunk-TNS63ATU.js";
59
+ import "../chunk-FWRPDSO3.js";
56
60
  import "../chunk-A7XLR3K7.js";
57
- import "../chunk-DZN7SDY2.js";
61
+ import "../chunk-OSVTH3SG.js";
58
62
  import {
59
63
  SYSTEMD_DAEMON_UNIT,
60
64
  SYSTEMD_WATCHDOG_UNIT
@@ -251,6 +255,27 @@ function checkGoTrueSecurity(envContent) {
251
255
  }
252
256
  return { check: "gotrue_security", status: "pass", message: "GoTrue auth settings are secure" };
253
257
  }
258
+ function smtpConfigFindings({
259
+ smtpUser,
260
+ smtpPass,
261
+ smtpFrom,
262
+ smtpPortRaw,
263
+ credentialsAlreadyChecked = false
264
+ }) {
265
+ const findings = [];
266
+ if (!credentialsAlreadyChecked) {
267
+ if (smtpUser === "") findings.push("SMTP_USER is empty \u2014 GoTrue cannot authenticate to the SMTP server");
268
+ if (smtpPass === "") findings.push("SMTP_PASS is empty \u2014 GoTrue cannot authenticate to the SMTP server");
269
+ }
270
+ if (smtpFrom === "") findings.push("SMTP_FROM is empty \u2014 GoTrue needs a sender address");
271
+ const portNum = Number(smtpPortRaw);
272
+ if (smtpPortRaw !== "" && (!Number.isInteger(portNum) || portNum <= 0 || portNum > 65535)) {
273
+ findings.push(`SMTP_PORT="${smtpPortRaw}" is not a valid port`);
274
+ } else if (![25, 465, 587, 2525].includes(portNum)) {
275
+ findings.push(`SMTP_PORT=${portNum} is unusual (typical: 587 STARTTLS / 465 implicit TLS / 25) \u2014 confirm the provider expects it`);
276
+ }
277
+ return findings;
278
+ }
254
279
  function checkSmtpRecovery(envContent) {
255
280
  const env = parseEnvFile(envContent);
256
281
  const autoconfirm = env.get("GOTRUE_MAILER_AUTOCONFIRM");
@@ -260,7 +285,15 @@ function checkSmtpRecovery(envContent) {
260
285
  const smtpFrom = (env.get("SMTP_FROM") ?? env.get("GOTRUE_SMTP_ADMIN_EMAIL") ?? "").trim();
261
286
  const smtpPortRaw = (env.get("SMTP_PORT") ?? env.get("GOTRUE_SMTP_PORT") ?? "587").trim();
262
287
  if (autoconfirm === "true") {
263
- return { check: "smtp_recovery", status: "pass", message: "GOTRUE_MAILER_AUTOCONFIRM=true \u2014 auth email flows disabled by design" };
288
+ if (smtpHost === "") {
289
+ return { check: "smtp_recovery", status: "pass", message: "GOTRUE_MAILER_AUTOCONFIRM=true and no SMTP host configured \u2014 auth email flows disabled by design" };
290
+ }
291
+ const findings = smtpConfigFindings({ smtpUser, smtpPass, smtpFrom, smtpPortRaw });
292
+ return {
293
+ check: "smtp_recovery",
294
+ status: "warn",
295
+ message: "GOTRUE_MAILER_AUTOCONFIRM=true while SMTP_HOST is set \u2014 these contradict: email flows are disabled, yet an SMTP server is configured. This is intentional on an invite-only stack; on a stack that was switched from --no-email to SMTP it means recovery mail is off and nobody was told. " + (findings.length > 0 ? `The SMTP config here is ALSO incomplete: ${findings.join("; ")}. Fix those before setting GOTRUE_MAILER_AUTOCONFIRM=false.` : "The SMTP config itself looks complete, so setting GOTRUE_MAILER_AUTOCONFIRM=false would enable recovery mail.")
296
+ };
264
297
  }
265
298
  if (smtpHost === "") {
266
299
  return {
@@ -280,14 +313,7 @@ function checkSmtpRecovery(envContent) {
280
313
  message: `SMTP_HOST is set but ${missingCreds.join(" and ")} ${isPlural ? "are" : "is"} empty \u2014 GoTrue cannot authenticate to the SMTP server, so recovery/signup emails will SILENTLY never send. Set ${missingCreds.join(", ")} in .env (or GOTRUE_MAILER_AUTOCONFIRM=true to disable email flows).`
281
314
  };
282
315
  }
283
- const warns = [];
284
- if (smtpFrom === "") warns.push("SMTP_FROM is empty \u2014 GoTrue needs a sender address");
285
- const portNum = Number(smtpPortRaw);
286
- if (smtpPortRaw !== "" && (!Number.isInteger(portNum) || portNum <= 0 || portNum > 65535)) {
287
- warns.push(`SMTP_PORT="${smtpPortRaw}" is not a valid port`);
288
- } else if (![25, 465, 587, 2525].includes(portNum)) {
289
- warns.push(`SMTP_PORT=${portNum} is unusual (typical: 587 STARTTLS / 465 implicit TLS / 25) \u2014 confirm the provider expects it`);
290
- }
316
+ const warns = smtpConfigFindings({ smtpUser, smtpPass, smtpFrom, smtpPortRaw, credentialsAlreadyChecked: true });
291
317
  if (warns.length > 0) {
292
318
  return { check: "smtp_recovery", status: "warn", message: `SMTP host + credentials are set, but: ${warns.join("; ")}.` };
293
319
  }
@@ -540,7 +566,7 @@ if (process.argv[1]?.endsWith("preflight.ts") || process.argv[1]?.endsWith("pref
540
566
  // src/lib/stack-config-update.ts
541
567
  import { spawnSync as spawnSync2 } from "child_process";
542
568
  import { createHash } from "crypto";
543
- import { existsSync as existsSync2, mkdtempSync, readFileSync as readFileSync2, readdirSync, rmSync as rmSync2, statSync, writeFileSync as writeFileSync2 } from "fs";
569
+ import { chmodSync, existsSync as existsSync2, mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync2, readdirSync, rmSync as rmSync2, statSync, writeFileSync as writeFileSync2 } from "fs";
544
570
  import { tmpdir } from "os";
545
571
  import path2 from "path";
546
572
  function computeConfigDigest(raw) {
@@ -689,6 +715,44 @@ function parseComposeImages(configJson) {
689
715
  }
690
716
  return images;
691
717
  }
718
+ function parseOneShotServices(configJson) {
719
+ const oneShot = /* @__PURE__ */ new Set();
720
+ const parsed = JSON.parse(configJson);
721
+ for (const [service, def] of Object.entries(parsed.services ?? {})) {
722
+ if (typeof def?.restart === "string" && def.restart.trim().toLowerCase() === "no") oneShot.add(service);
723
+ }
724
+ return oneShot;
725
+ }
726
+ function orderServicesByDependencies(configJson, services) {
727
+ const selected = new Set(services);
728
+ const parsed = JSON.parse(configJson);
729
+ const ordered = [];
730
+ const visiting = /* @__PURE__ */ new Set();
731
+ const visited = /* @__PURE__ */ new Set();
732
+ const visit = (service) => {
733
+ if (visited.has(service)) return;
734
+ if (visiting.has(service)) {
735
+ throw new Error(`Config-only delivery refused: dependency cycle includes ${service}`);
736
+ }
737
+ visiting.add(service);
738
+ const raw = parsed.services?.[service]?.depends_on;
739
+ const dependencies = Array.isArray(raw) ? raw : Object.keys(raw ?? {});
740
+ for (const dependency of dependencies.sort()) {
741
+ if (selected.has(dependency)) visit(dependency);
742
+ }
743
+ visiting.delete(service);
744
+ visited.add(service);
745
+ ordered.push(service);
746
+ };
747
+ for (const service of [...selected].sort()) visit(service);
748
+ return ordered;
749
+ }
750
+ function failedRollbackDependencies(configJson, selectedServices, blockedServices, service) {
751
+ const parsed = JSON.parse(configJson);
752
+ const raw = parsed.services?.[service]?.depends_on;
753
+ const dependencies = Array.isArray(raw) ? raw : Object.keys(raw ?? {});
754
+ return dependencies.filter((dependency) => selectedServices.has(dependency) && blockedServices.has(dependency)).sort();
755
+ }
692
756
  function collectImageMovements(before, after) {
693
757
  const movements = [];
694
758
  for (const [service, afterImage] of after) {
@@ -701,23 +765,126 @@ function collectPendingImageMovements(rendered, deployed, servicesToRecreate) {
701
765
  const movements = [];
702
766
  for (const service of servicesToRecreate) {
703
767
  const running = deployed.get(service);
704
- if (!running) continue;
705
768
  const next = rendered.get(service);
706
769
  if (next && next !== running) movements.push({ service, before: running, after: next });
707
770
  }
708
771
  return movements.sort((a, b) => a.service.localeCompare(b.service));
709
772
  }
710
- function collectRenderedEnvDrift(templateConfigJson, liveConfigJson) {
711
- const template = parseComposeServiceEnvKeys(templateConfigJson);
712
- const live = parseComposeServiceEnvKeys(liveConfigJson);
773
+ function assertNoPendingImageMovement(rendered, deployed, servicesToRecreate) {
774
+ const movements = collectPendingImageMovements(rendered, deployed, servicesToRecreate);
775
+ if (movements.length === 0) return;
776
+ const detail = movements.map((m) => ` - ${m.service}: deployed ${m.before ?? "(no container/image witness)"} \u2192 would start ${m.after}`).join("\n");
777
+ throw new Error(
778
+ `Config-only delivery refused: recreating ${movements.length} service(s) lacks an exact deployed-image match.
779
+ ${detail}
780
+ The rendered config names a different image, or no deployed container/image can witness the prior state. This mode holds live image and existence state where they are. Run a normal stack update.`
781
+ );
782
+ }
783
+ function assertNoImageMovement(before, after) {
784
+ const movements = collectImageMovements(before, after);
785
+ if (movements.length === 0) return;
786
+ const detail = movements.map((m) => ` - ${m.service}: ${m.before ?? "(new service \u2014 no deployed image)"} \u2192 ${m.after ?? "(removed)"}`).join("\n");
787
+ throw new Error(
788
+ `Config-only delivery refused: the refreshed config would move ${movements.length} image pin(s).
789
+ ${detail}
790
+ This mode holds every image at what is currently deployed. Run a normal stack update to move images.`
791
+ );
792
+ }
793
+ function collectRenderedEnvDrift(intendedConfigJson, deployed) {
794
+ const intended = parseComposeServiceEnvKeys(intendedConfigJson);
713
795
  const drift = [];
714
- for (const [service, keys] of template) {
715
- const liveKeys = live.get(service);
716
- if (!liveKeys) continue;
717
- const missingKeys = [...keys].filter((k) => !liveKeys.has(k)).sort();
796
+ const unverified = [];
797
+ for (const [service, keys] of intended) {
798
+ if (!deployed.deployedServices.has(service)) continue;
799
+ const containerKeys = deployed.envKeys.get(service);
800
+ if (!containerKeys) {
801
+ unverified.push(service);
802
+ continue;
803
+ }
804
+ const missingKeys = [...keys].filter((k) => !containerKeys.has(k)).sort();
718
805
  if (missingKeys.length > 0) drift.push({ service, missingKeys });
719
806
  }
720
- return drift.sort((a, b) => a.service.localeCompare(b.service));
807
+ return {
808
+ drift: drift.sort((a, b) => a.service.localeCompare(b.service)),
809
+ unverified: unverified.sort()
810
+ };
811
+ }
812
+ var DEPLOYED_ENV_INSPECT_FORMAT = '{{index .Config.Labels "com.docker.compose.service"}} {{json .Config.Env}}';
813
+ function deployedEnvInspectArgs(containerIds) {
814
+ return ["inspect", "--format", DEPLOYED_ENV_INSPECT_FORMAT, ...containerIds];
815
+ }
816
+ function parseDeployedContainerIds(stdout) {
817
+ const ids = /* @__PURE__ */ new Map();
818
+ for (const line of stdout.split("\n")) {
819
+ const trimmed = line.trim();
820
+ if (!trimmed) continue;
821
+ try {
822
+ const parsed = JSON.parse(trimmed);
823
+ for (const entry of Array.isArray(parsed) ? parsed : [parsed]) {
824
+ const row = entry;
825
+ if (row?.Service && row.ID) ids.set(row.Service, row.ID);
826
+ }
827
+ } catch {
828
+ }
829
+ }
830
+ return ids;
831
+ }
832
+ function parseDeployedServices(stdout) {
833
+ const services = /* @__PURE__ */ new Set();
834
+ for (const line of stdout.split("\n")) {
835
+ const trimmed = line.trim();
836
+ if (!trimmed) continue;
837
+ try {
838
+ const parsed = JSON.parse(trimmed);
839
+ for (const entry of Array.isArray(parsed) ? parsed : [parsed]) {
840
+ const row = entry;
841
+ if (row?.Service) services.add(row.Service);
842
+ }
843
+ } catch {
844
+ }
845
+ }
846
+ return services;
847
+ }
848
+ function parseContainerEnvKeys(stdout) {
849
+ const out = /* @__PURE__ */ new Map();
850
+ for (const line of stdout.split("\n")) {
851
+ const trimmed = line.trim();
852
+ if (!trimmed) continue;
853
+ const tab = trimmed.indexOf(" ");
854
+ if (tab === -1) continue;
855
+ const service = trimmed.slice(0, tab).trim();
856
+ if (!service) continue;
857
+ let entries;
858
+ try {
859
+ entries = JSON.parse(trimmed.slice(tab + 1));
860
+ } catch {
861
+ continue;
862
+ }
863
+ if (!Array.isArray(entries)) continue;
864
+ const keys = /* @__PURE__ */ new Set();
865
+ for (const entry of entries) keys.add(String(entry).split("=")[0]);
866
+ out.set(service, keys);
867
+ }
868
+ return out;
869
+ }
870
+ function readDeployedServiceEnv(capture, psStdout) {
871
+ const deployedServices = parseDeployedServices(psStdout);
872
+ const ids = parseDeployedContainerIds(psStdout);
873
+ if (ids.size === 0) return { deployedServices, envKeys: /* @__PURE__ */ new Map() };
874
+ let inspected = /* @__PURE__ */ new Map();
875
+ try {
876
+ inspected = parseContainerEnvKeys(capture(deployedEnvInspectArgs([...ids.values()])));
877
+ } catch (err) {
878
+ console.warn(
879
+ `[stack-config-update] \u26A0 Could not read container environments (${err instanceof Error ? err.message : String(err)}) \u2014 the rendered-env check is UNVERIFIED this run.`
880
+ );
881
+ }
882
+ const envKeys = /* @__PURE__ */ new Map();
883
+ for (const service of deployedServices) {
884
+ const keys = inspected.get(service);
885
+ if (keys) envKeys.set(service, keys);
886
+ }
887
+ return { deployedServices, envKeys };
721
888
  }
722
889
  function parseComposeServiceEnvKeys(configJson) {
723
890
  const out = /* @__PURE__ */ new Map();
@@ -768,6 +935,7 @@ function imagePinKeyByService(composeRaw) {
768
935
  return byService;
769
936
  }
770
937
  var DEPLOYED_IMAGE_PS_ARGS = ["ps", "--all", "--format", "json"];
938
+ var NO_IMAGE_FETCH_ARGS = ["--pull", "never", "--no-build"];
771
939
  function parseDeployedImages(stdout) {
772
940
  const images = /* @__PURE__ */ new Map();
773
941
  for (const line of stdout.split("\n")) {
@@ -784,6 +952,35 @@ function parseDeployedImages(stdout) {
784
952
  }
785
953
  return images;
786
954
  }
955
+ function parseDeployedConfigHashes(stdout) {
956
+ const hashes = /* @__PURE__ */ new Map();
957
+ for (const line of stdout.split("\n")) {
958
+ const trimmed = line.trim();
959
+ if (!trimmed) continue;
960
+ try {
961
+ const parsed = JSON.parse(trimmed);
962
+ for (const entry of Array.isArray(parsed) ? parsed : [parsed]) {
963
+ const row = entry;
964
+ if (!row.Service || !row.Labels) continue;
965
+ const value = typeof row.Labels === "string" ? row.Labels.split(",").map((part) => part.trim()).find((part) => part.startsWith("com.docker.compose.config-hash="))?.split("=").slice(1).join("=") : row.Labels["com.docker.compose.config-hash"];
966
+ if (typeof value === "string" && value) hashes.set(row.Service, value);
967
+ }
968
+ } catch {
969
+ }
970
+ }
971
+ return hashes;
972
+ }
973
+ function assertRollbackConfigMatchesDeployed(renderedBefore, deployed, services) {
974
+ const unsafe = services.filter((service) => {
975
+ const rendered = renderedBefore.get(service);
976
+ const live = deployed.get(service);
977
+ return !rendered || !live || rendered !== live;
978
+ });
979
+ if (unsafe.length === 0) return;
980
+ throw new Error(
981
+ `Config-only delivery refused: the pre-run on-disk config is not proven to match the deployed container config for ${unsafe.join(", ")}. Rollback would force-apply unverified host edits. Converge the stack with a normal update first.`
982
+ );
983
+ }
787
984
  function adoptDeployedImagePins(input) {
788
985
  const byService = imagePinKeyByService(input.stagedComposeRaw);
789
986
  const adopted = {};
@@ -831,6 +1028,12 @@ Set them in ${envFile}, then re-run.`
831
1028
  );
832
1029
  }
833
1030
  }
1031
+ var STACK_VERSION_SOURCE_LABEL = {
1032
+ "target-flag": "--target (operator-supplied)",
1033
+ "lock-file": ".exe-stack-lock.json (what the updater last committed)",
1034
+ "env-file": "STACK_VERSION in the stack .env",
1035
+ "manifest-latest": "the manifest's LATEST release \u2014 no deployed version resolved"
1036
+ };
834
1037
  function defaultComposeCapture(args) {
835
1038
  const result = spawnSync2("docker", args, { encoding: "utf8", timeout: 12e4 });
836
1039
  if (result.status !== 0) {
@@ -839,8 +1042,15 @@ function defaultComposeCapture(args) {
839
1042
  return result.stdout ?? "";
840
1043
  }
841
1044
  async function runStackConfigUpdate(options) {
1045
+ const now = options.now ?? (() => /* @__PURE__ */ new Date());
1046
+ const exec = options.exec ?? ((cmd, args) => {
1047
+ const result2 = spawnSync2(cmd, args, { stdio: "inherit", timeout: 6e5 });
1048
+ if (result2.status !== 0) throw new Error(`${cmd} ${args.join(" ")} failed (exit ${result2.status})`);
1049
+ });
842
1050
  const capture = options.composeCapture ?? defaultComposeCapture;
1051
+ const healthCapture = options.composePsCapture ?? (options.composeCapture ? (args) => capture([...args, "ps", "--all", "--format", "json"]) : void 0);
843
1052
  const composeArgs = composeArgsForStack(options.composeFile, options.envFile);
1053
+ const stackDir = path2.dirname(options.envFile);
844
1054
  const configDir = path2.dirname(options.composeFile);
845
1055
  const templatePath = options.composeTemplateFileForUpdate ?? path2.join(resolvePackagedComposeDir(), "docker-compose.yml");
846
1056
  if (!existsSync2(templatePath)) {
@@ -851,14 +1061,16 @@ async function runStackConfigUpdate(options) {
851
1061
  `Config-only delivery aborted: this mode UPDATES an existing install, and ${!existsSync2(options.composeFile) ? options.composeFile : options.envFile} does not exist. Run a normal stack update to install.`
852
1062
  );
853
1063
  }
854
- const { release, stackVersion } = await resolveSignedRelease(options);
1064
+ const { release, stackVersion, stackVersionSource } = await resolveSignedRelease(options);
855
1065
  const stagedComposeRaw = readFileSync2(templatePath, "utf8");
856
1066
  const stagedAssetDigests = collectConfigAssetDigests(path2.dirname(templatePath));
857
1067
  assertStagedConfigMatchesManifest({
858
1068
  release,
859
1069
  composeRaw: stagedComposeRaw,
860
1070
  assetDigests: stagedAssetDigests,
861
- strict: options.requireConfigDigest ?? process.env.EXE_STACK_REQUIRE_CONFIG_DIGEST === "1"
1071
+ // Applying bytes requires the signed release to cover every byte this mode
1072
+ // can write. Planning may inspect legacy releases, but apply never does.
1073
+ strict: options.dryRun ? options.requireConfigDigest ?? process.env.EXE_STACK_REQUIRE_CONFIG_DIGEST === "1" : true
862
1074
  });
863
1075
  const currentComposeRaw = readFileSync2(options.composeFile, "utf8");
864
1076
  const currentEnvRaw = readFileSync2(options.envFile, "utf8");
@@ -893,8 +1105,34 @@ async function runStackConfigUpdate(options) {
893
1105
  });
894
1106
  const composeChanged = stagedComposeRaw !== currentComposeRaw;
895
1107
  if (!composeChanged && assetChanges.length === 0) {
896
- console.log("[stack-config-update] Host compose template and config assets already match the packaged config \u2014 nothing to deliver.");
897
- return { status: "no-change", stackVersion, changed: [], added: [], removed: [], envDrift: [], assets: [] };
1108
+ const envVerdict = collectRenderedEnvDrift(
1109
+ beforeConfigJson,
1110
+ readDeployedServiceEnv(capture, capture([...composeArgs, ...DEPLOYED_IMAGE_PS_ARGS]))
1111
+ );
1112
+ console.log(
1113
+ "[stack-config-update] Host compose template and config assets already match the packaged config \u2014 nothing to DELIVER. That is a statement about FILES ON DISK."
1114
+ );
1115
+ for (const d of envVerdict.drift) {
1116
+ console.warn(
1117
+ `[stack-config-update] \u26A0 CONTAINER DRIFT: ${d.service} is RUNNING without env key(s) the current config renders: ${d.missingKeys.join(", ")}. The files are current; the container is not. Recreate that service \u2014 config-only delivery has nothing to write here.`
1118
+ );
1119
+ }
1120
+ if (envVerdict.unverified.length > 0) {
1121
+ console.warn(
1122
+ `[stack-config-update] \u26A0 UNVERIFIED: the container environment could not be read for ${envVerdict.unverified.join(", ")}, so "already current" is asserted about files alone for them.`
1123
+ );
1124
+ }
1125
+ return {
1126
+ status: "no-change",
1127
+ stackVersion,
1128
+ stackVersionSource,
1129
+ changed: [],
1130
+ added: [],
1131
+ removed: [],
1132
+ envDrift: envVerdict.drift,
1133
+ envUnverified: envVerdict.unverified,
1134
+ assets: []
1135
+ };
898
1136
  }
899
1137
  console.log(`[stack-config-update] Compose template: ${composeChanged ? "REFRESH" : "already current"}`);
900
1138
  if (assetChanges.length > 0) {
@@ -925,12 +1163,13 @@ async function runStackConfigUpdate(options) {
925
1163
  beforeHashes,
926
1164
  parseComposeConfigHashes(capture([...scratchArgs, "config", "--hash=*"]))
927
1165
  );
928
- const envDrift = collectRenderedEnvDrift(afterConfigJson, beforeConfigJson);
1166
+ const psJson = capture([...composeArgs, ...DEPLOYED_IMAGE_PS_ARGS]);
1167
+ const envVerdict = collectRenderedEnvDrift(afterConfigJson, readDeployedServiceEnv(capture, psJson));
929
1168
  const assetServices = assetChanges.length > 0 ? servicesMountingPaths(afterConfigJson, configDir, assetChanges.map((a) => a.rel)) : [];
930
1169
  const wouldRecreate = [.../* @__PURE__ */ new Set([...changeSet.changed, ...assetServices])].sort();
931
1170
  const pending = collectPendingImageMovements(
932
1171
  parseComposeImages(afterConfigJson),
933
- parseDeployedImages(capture([...composeArgs, ...DEPLOYED_IMAGE_PS_ARGS])),
1172
+ parseDeployedImages(psJson),
934
1173
  wouldRecreate
935
1174
  );
936
1175
  console.log("[stack-config-update] DRY RUN \u2014 nothing written, no container touched.");
@@ -940,7 +1179,16 @@ async function runStackConfigUpdate(options) {
940
1179
  console.log(` services added by the template: ${changeSet.added.join(", ") || "none"}`);
941
1180
  console.log(` services no longer in the template: ${changeSet.removed.join(", ") || "none"}`);
942
1181
  console.log(` services recreated for a changed asset: ${assetServices.join(", ") || "none"}`);
943
- for (const d of envDrift) console.log(` rendered env keys added to ${d.service}: ${d.missingKeys.join(", ")}`);
1182
+ for (const d of envVerdict.drift) {
1183
+ console.log(
1184
+ ` env keys the ${d.service} CONTAINER is missing and this config renders: ${d.missingKeys.join(", ")}`
1185
+ );
1186
+ }
1187
+ if (envVerdict.unverified.length > 0) {
1188
+ console.log(
1189
+ ` \u26A0 UNVERIFIED \u2014 container environment unreadable for: ${envVerdict.unverified.join(", ")}. No rendered-env verdict was reached for those services; this is NOT "no drift".`
1190
+ );
1191
+ }
944
1192
  if (assetChanges.length > 0 && assetServices.length === 0) {
945
1193
  console.log(" \u26A0 assets would be delivered that NO service mounts \u2014 they would not be served.");
946
1194
  }
@@ -956,19 +1204,286 @@ async function runStackConfigUpdate(options) {
956
1204
  // for a PENDING movement exactly as it does for a rendered one.
957
1205
  status: movements.length > 0 || pending.length > 0 ? "aborted" : "no-change",
958
1206
  stackVersion,
1207
+ stackVersionSource,
959
1208
  changed: wouldRecreate,
960
1209
  added: changeSet.added,
961
1210
  removed: changeSet.removed,
962
- envDrift,
1211
+ envDrift: envVerdict.drift,
1212
+ envUnverified: envVerdict.unverified,
963
1213
  assets: assetChanges
964
1214
  };
965
1215
  } finally {
966
1216
  rmSync2(scratch, { recursive: true, force: true });
967
1217
  }
968
1218
  }
969
- throw new Error(
970
- `Config-only APPLY is not available in this build \u2014 only the read-only plan is. Run with --check (or --dry-run) to see exactly what a config-only delivery would change: the services whose rendered config moves, the assets that would be delivered, the services that mount them, and the image-movement verdict. To actually apply a config change today, run a normal stack update.`
971
- );
1219
+ const deployedBeforeJson = capture([...composeArgs, ...DEPLOYED_IMAGE_PS_ARGS]);
1220
+ const backup = backupStackConfig(stackDir, options.composeFile, currentEnvRaw, now);
1221
+ console.log(`[stack-config-update] Backed up compose + env to ${backup.updateBackupDir}`);
1222
+ const assetRollback = /* @__PURE__ */ new Map();
1223
+ const assetBackupDir = path2.join(backup.updateBackupDir, "config-assets");
1224
+ const addedRels = [];
1225
+ for (const change of assetChanges) {
1226
+ const target = path2.join(configDir, change.rel);
1227
+ const priorMode = existsSync2(target) ? statSync(target).mode & 511 : void 0;
1228
+ const prior = priorMode === void 0 ? null : { bytes: readFileSync2(target), mode: priorMode };
1229
+ assetRollback.set(change.rel, prior);
1230
+ if (prior === null) {
1231
+ addedRels.push(change.rel);
1232
+ continue;
1233
+ }
1234
+ const backupPath = path2.join(assetBackupDir, change.rel);
1235
+ mkdirSync2(path2.dirname(backupPath), { recursive: true });
1236
+ writeFileSync2(backupPath, prior.bytes);
1237
+ chmodSync(backupPath, prior.mode);
1238
+ }
1239
+ if (addedRels.length > 0) {
1240
+ mkdirSync2(assetBackupDir, { recursive: true });
1241
+ writeFileSync2(
1242
+ path2.join(assetBackupDir, "ADDED-BY-THIS-RUN.txt"),
1243
+ `These paths did not exist before this run. To undo it by hand, DELETE them (relative to ${configDir}):
1244
+ ${addedRels.map((r) => `${r}
1245
+ `).join("")}`
1246
+ );
1247
+ }
1248
+ if (assetChanges.length > 0) {
1249
+ console.log(`[stack-config-update] Backed up ${assetChanges.length - addedRels.length} pre-existing asset(s) to ${assetBackupDir}`);
1250
+ }
1251
+ const restore = async () => {
1252
+ const failures = [];
1253
+ const reason = (e) => e instanceof Error ? e.message : String(e);
1254
+ const step = (what, fn) => {
1255
+ try {
1256
+ fn();
1257
+ return true;
1258
+ } catch (err) {
1259
+ failures.push(`${what}: ${reason(err)}`);
1260
+ return false;
1261
+ }
1262
+ };
1263
+ const composeRestored = step(`restore ${options.composeFile}`, () => writeFileSync2(options.composeFile, currentComposeRaw));
1264
+ const envRestored = step(`restore ${options.envFile}`, () => writeFileSync2(options.envFile, currentEnvRaw));
1265
+ const unsafeServices = /* @__PURE__ */ new Set();
1266
+ for (const [rel, prior] of assetRollback) {
1267
+ const restored = step(`restore asset ${rel}`, () => {
1268
+ const target = path2.join(configDir, rel);
1269
+ if (prior === null) {
1270
+ rmSync2(target, { force: true });
1271
+ return;
1272
+ }
1273
+ writeFileSync2(target, prior.bytes);
1274
+ chmodSync(target, prior.mode);
1275
+ });
1276
+ if (!restored) {
1277
+ for (const service of servicesMountingPaths(beforeConfigJson, configDir, [rel])) {
1278
+ unsafeServices.add(service);
1279
+ }
1280
+ }
1281
+ }
1282
+ console.error(`[stack-config-update] Restored ${options.composeFile}, ${options.envFile} and ${assetRollback.size} asset(s) from ${backup.updateBackupDir}`);
1283
+ if (recreated.length > 0) {
1284
+ console.error(`[stack-config-update] Recreating ${recreated.length} already-recreated service(s) from the restored config: ${recreated.join(", ")}`);
1285
+ const back = [];
1286
+ const selected = new Set(recreated);
1287
+ const blocked = /* @__PURE__ */ new Set();
1288
+ for (const service of orderServicesByDependencies(beforeConfigJson, recreated)) {
1289
+ const failedDependencies = failedRollbackDependencies(
1290
+ beforeConfigJson,
1291
+ selected,
1292
+ blocked,
1293
+ service
1294
+ );
1295
+ if (!composeRestored || !envRestored) {
1296
+ blocked.add(service);
1297
+ failures.push(
1298
+ `skip recreate ${service}: compose/environment restoration is incomplete`
1299
+ );
1300
+ continue;
1301
+ }
1302
+ if (unsafeServices.has(service)) {
1303
+ blocked.add(service);
1304
+ failures.push(`skip recreate ${service}: a mounted asset was not restored`);
1305
+ continue;
1306
+ }
1307
+ if (failedDependencies.length > 0) {
1308
+ blocked.add(service);
1309
+ failures.push(
1310
+ `skip recreate ${service}: restored prerequisite(s) did not recover: ${failedDependencies.join(", ")}`
1311
+ );
1312
+ continue;
1313
+ }
1314
+ if (step(
1315
+ `recreate ${service} from restored config`,
1316
+ () => exec("docker", [...composeArgs, "up", "-d", "--no-deps", ...NO_IMAGE_FETCH_ARGS, "--force-recreate", service])
1317
+ )) {
1318
+ back.push(service);
1319
+ try {
1320
+ await verifyComposeServicesRunning(
1321
+ composeArgs,
1322
+ [service],
1323
+ options.healthTimeoutSecs ?? 180,
1324
+ healthCapture,
1325
+ parseOneShotServices(beforeConfigJson),
1326
+ true
1327
+ );
1328
+ } catch (err) {
1329
+ blocked.add(service);
1330
+ failures.push(`health of rolled-back service ${service}: ${reason(err)}`);
1331
+ }
1332
+ } else {
1333
+ blocked.add(service);
1334
+ }
1335
+ }
1336
+ }
1337
+ if (failures.length === 0) {
1338
+ if (recreated.length > 0) console.error(`[stack-config-update] \u2713 Rolled-back service(s) running & healthy.`);
1339
+ return { ok: true };
1340
+ }
1341
+ for (const f of failures) console.error(`[stack-config-update] rollback failure: ${f}`);
1342
+ return {
1343
+ ok: false,
1344
+ error: `${failures.length} rollback step(s) failed (service(s) this run had recreated: ${recreated.join(", ") || "none"}):
1345
+ ` + failures.map((f) => ` - ${f}`).join("\n")
1346
+ };
1347
+ };
1348
+ let result;
1349
+ const recreated = [];
1350
+ try {
1351
+ if (composeChanged) writeFileSync2(options.composeFile, stagedComposeRaw);
1352
+ if (plannedEnvRaw !== currentEnvRaw) writeFileSync2(options.envFile, plannedEnvRaw);
1353
+ for (const change of assetChanges) {
1354
+ const target = path2.join(configDir, change.rel);
1355
+ const source = path2.join(path2.dirname(templatePath), change.rel);
1356
+ mkdirSync2(path2.dirname(target), { recursive: true });
1357
+ writeFileSync2(target, readFileSync2(source));
1358
+ chmodSync(target, statSync(source).mode & 511);
1359
+ }
1360
+ const afterConfigJson = capture([...composeArgs, "config", "--format", "json"]);
1361
+ const afterImages = parseComposeImages(afterConfigJson);
1362
+ assertNoImageMovement(beforeImages, afterImages);
1363
+ const afterHashes = parseComposeConfigHashes(capture([...composeArgs, "config", "--hash=*"]));
1364
+ const changeSet = servicesWithChangedConfig(beforeHashes, afterHashes);
1365
+ const envVerdict = collectRenderedEnvDrift(
1366
+ afterConfigJson,
1367
+ readDeployedServiceEnv(capture, capture([...composeArgs, ...DEPLOYED_IMAGE_PS_ARGS]))
1368
+ );
1369
+ if (changeSet.added.length > 0) {
1370
+ throw new Error(
1371
+ `Config-only delivery refused: the refreshed template adds service(s) ${changeSet.added.join(", ")}, which would require pulling images this mode does not move. Run a normal stack update.`
1372
+ );
1373
+ }
1374
+ if (changeSet.removed.length > 0) {
1375
+ console.warn(
1376
+ `[stack-config-update] \u26A0 The refreshed template no longer defines: ${changeSet.removed.join(", ")}. They are left RUNNING and untouched \u2014 removing a service is a stack-update operation, not a config one.`
1377
+ );
1378
+ }
1379
+ if (envVerdict.drift.length > 0) {
1380
+ console.log("[stack-config-update] Rendered per-service env keys this delivery adds (the class of defect preflight cannot see):");
1381
+ for (const d of envVerdict.drift) console.log(` - ${d.service}: ${d.missingKeys.join(", ")}`);
1382
+ }
1383
+ const assetServices = assetChanges.length > 0 ? servicesMountingPaths(afterConfigJson, configDir, assetChanges.map((a) => a.rel)) : [];
1384
+ const orphanAssets = assetChanges.length > 0 && assetServices.length === 0;
1385
+ if (orphanAssets) {
1386
+ console.warn(
1387
+ `[stack-config-update] \u26A0 ${assetChanges.length} config asset(s) were delivered but NO compose service bind-mounts them, so nothing serves them. This is the half-delivered shape of bug a72b2fd4 \u2014 the compose template that mounts them has not reached this host.`
1388
+ );
1389
+ for (const a of assetChanges) console.warn(` unmounted: ${a.rel}`);
1390
+ }
1391
+ if (assetServices.length > 0) {
1392
+ console.log(`[stack-config-update] Services mounting a changed asset: ${assetServices.join(", ")}`);
1393
+ }
1394
+ const forceRecreate = new Set(assetServices);
1395
+ changeSet.changed = orderServicesByDependencies(
1396
+ afterConfigJson,
1397
+ [.../* @__PURE__ */ new Set([...changeSet.changed, ...assetServices])]
1398
+ );
1399
+ if (changeSet.changed.length > 0) {
1400
+ assertRollbackConfigMatchesDeployed(
1401
+ beforeHashes,
1402
+ parseDeployedConfigHashes(deployedBeforeJson),
1403
+ changeSet.changed
1404
+ );
1405
+ assertNoPendingImageMovement(
1406
+ afterImages,
1407
+ parseDeployedImages(deployedBeforeJson),
1408
+ changeSet.changed
1409
+ );
1410
+ }
1411
+ if (changeSet.changed.length === 0) {
1412
+ console.log("[stack-config-update] Compose template refreshed; no service's rendered config changed. No container recreated.");
1413
+ result = { status: "applied", stackVersion, stackVersionSource, changed: [], added: [], removed: changeSet.removed, envDrift: envVerdict.drift, envUnverified: envVerdict.unverified, assets: assetChanges, backup };
1414
+ } else {
1415
+ console.log(`[stack-config-update] Recreating ${changeSet.changed.length} service(s) whose rendered config changed: ${changeSet.changed.join(", ")}`);
1416
+ for (const service of changeSet.changed) {
1417
+ const upArgs = [...composeArgs, "up", "-d", "--no-deps", ...NO_IMAGE_FETCH_ARGS];
1418
+ if (forceRecreate.has(service)) {
1419
+ console.log(`[stack-config-update] ${service}: --force-recreate (mounts a changed bind-mounted asset; compose's hash does not cover asset BYTES, and the container's own stored hash may already match, so plain \`up\` can do nothing and the new asset would never be loaded)`);
1420
+ upArgs.push("--force-recreate");
1421
+ }
1422
+ upArgs.push(service);
1423
+ recreated.push(service);
1424
+ exec("docker", upArgs);
1425
+ await verifyComposeServicesRunning(
1426
+ composeArgs,
1427
+ [service],
1428
+ options.healthTimeoutSecs ?? 180,
1429
+ healthCapture,
1430
+ parseOneShotServices(afterConfigJson),
1431
+ true
1432
+ );
1433
+ }
1434
+ if (changeSet.changed.length > 0) {
1435
+ console.log(`[stack-config-update] \u2713 ${changeSet.changed.length} recreated service(s) running & healthy.`);
1436
+ }
1437
+ result = { status: "applied", stackVersion, stackVersionSource, changed: changeSet.changed, added: [], removed: changeSet.removed, envDrift: envVerdict.drift, envUnverified: envVerdict.unverified, assets: assetChanges, backup };
1438
+ }
1439
+ } catch (err) {
1440
+ const original = err instanceof Error ? err : new Error(String(err));
1441
+ const rollback = await restore();
1442
+ await postConfigAudit(
1443
+ options,
1444
+ rollback.ok ? "failed-rolled-back" : "failed-rollback-failed",
1445
+ stackVersion,
1446
+ rollback.ok ? original.message : `${original.message} | ROLLBACK FAILED: ${rollback.error}`,
1447
+ { rolledBack: rollback.ok, rollbackError: rollback.ok ? void 0 : rollback.error, backupDir: backup.updateBackupDir }
1448
+ );
1449
+ if (!rollback.ok) {
1450
+ console.error(`[stack-config-update] \u203C ROLLBACK FAILED \u2014 this host is left HALF-APPLIED and is NOT restored.`);
1451
+ console.error(`[stack-config-update] original failure: ${original.message}`);
1452
+ console.error(`[stack-config-update] rollback failure: ${rollback.error}`);
1453
+ console.error(`[stack-config-update] restore by hand from ${backup.updateBackupDir}`);
1454
+ throw new Error(
1455
+ `Config-only delivery FAILED and its ROLLBACK ALSO FAILED \u2014 ${options.composeFile}, ${options.envFile} and/or the delivered config assets are left HALF-APPLIED. Restore by hand from ${backup.updateBackupDir} (the previous asset bytes are under its config-assets/ subdirectory). Original failure: ${original.message} | Rollback failure: ${rollback.error}`,
1456
+ { cause: original }
1457
+ );
1458
+ }
1459
+ throw original;
1460
+ }
1461
+ await postConfigAudit(options, "succeeded", stackVersion, void 0, {
1462
+ changedServices: result.changed,
1463
+ removedFromTemplate: result.removed,
1464
+ // Keys only — never values.
1465
+ renderedEnvKeysAdded: result.envDrift,
1466
+ configAssets: result.assets,
1467
+ backupDir: result.backup?.updateBackupDir
1468
+ });
1469
+ return result;
1470
+ }
1471
+ async function postConfigAudit(options, status, stackVersion, error, metadata) {
1472
+ if (!options.auditUrl) return;
1473
+ const postJson = options.postJson ?? defaultPostJson;
1474
+ try {
1475
+ await postJson(options.auditUrl, {
1476
+ stackVersion,
1477
+ previousVersion: stackVersion,
1478
+ status,
1479
+ error,
1480
+ metadata: { ...metadata ?? {}, mode: "config-only" },
1481
+ deviceId: options.deviceId,
1482
+ licenseKey: options.licenseKey
1483
+ }, options.manifestAuthToken);
1484
+ } catch (err) {
1485
+ console.warn(`[stack-config-update] deploy audit failed: ${err instanceof Error ? err.message : String(err)}`);
1486
+ }
972
1487
  }
973
1488
  function resolvePackagedComposeDir() {
974
1489
  const packageRoot = path2.resolve(path2.dirname(builtinStackManifestPublicKeyPath()), "..", "..");
@@ -990,20 +1505,26 @@ async function resolveSignedRelease(options) {
990
1505
  );
991
1506
  reportStackManifestSource(loaded);
992
1507
  const lockFile = options.lockFile ?? path2.join(path2.dirname(options.envFile), ".exe-stack-lock.json");
993
- const deployedVersion = readCurrentStackVersion(lockFile) ?? readEnvValue(readFileSync2(options.envFile, "utf8"), "STACK_VERSION");
1508
+ const lockVersion = readCurrentStackVersion(lockFile);
1509
+ const envVersion = lockVersion ? void 0 : readEnvValue(readFileSync2(options.envFile, "utf8"), "STACK_VERSION");
1510
+ const deployedVersion = lockVersion ?? envVersion;
994
1511
  if (!options.targetVersion && !deployedVersion) {
995
1512
  console.warn(
996
1513
  `[stack-config-update] \u26A0 Could not determine the DEPLOYED stack version: ${lockFile} records none and ${options.envFile} carries no STACK_VERSION. Falling back to the manifest's latest release (${loaded.manifest.latest}) \u2014 its config digests and the deploy audit will describe THAT release, not necessarily what this host runs. Pass --target to name the deployed version.`
997
1514
  );
998
1515
  }
999
1516
  const stackVersion = options.targetVersion ?? deployedVersion ?? loaded.manifest.latest;
1517
+ const stackVersionSource = options.targetVersion ? "target-flag" : lockVersion ? "lock-file" : envVersion ? "env-file" : "manifest-latest";
1518
+ console.log(
1519
+ `[stack-config-update] Deployed stack version ${stackVersion} \u2014 source: ${STACK_VERSION_SOURCE_LABEL[stackVersionSource]}` + (stackVersionSource === "target-flag" ? "." : ". UNVERIFIED against the running containers: nothing stamps a deployed stack version on a container, so this is a claim about a FILE.")
1520
+ );
1000
1521
  const release = loaded.manifest.stacks[stackVersion];
1001
1522
  if (!release) {
1002
1523
  console.warn(
1003
1524
  `[stack-config-update] The signed manifest has no release entry for the deployed version ${stackVersion}; config provenance cannot be checked against it.`
1004
1525
  );
1005
1526
  }
1006
- return { manifest: loaded.manifest, release, stackVersion };
1527
+ return { manifest: loaded.manifest, release, stackVersion, stackVersionSource };
1007
1528
  }
1008
1529
  function readEnvValue(envRaw, key) {
1009
1530
  for (const line of envRaw.split("\n")) {
@@ -1100,6 +1621,7 @@ function parseArgs(args) {
1100
1621
  verifyManifestSignature: !(process.env.EXE_STACK_SKIP_SIGNATURE === "1" || process.env.EXE_STACK_SKIP_SIGNATURE === "true"),
1101
1622
  requireManifestSignature: process.env.EXE_STACK_REQUIRE_SIGNATURE === "1" || process.env.EXE_STACK_REQUIRE_SIGNATURE === "true",
1102
1623
  cleanupVolumes: false,
1624
+ reconcileLock: false,
1103
1625
  allowRed: false,
1104
1626
  configOnly: false,
1105
1627
  adoptDeployedPins: false,
@@ -1172,6 +1694,7 @@ function parseArgs(args) {
1172
1694
  else if (arg === "--skip-hardening") opts.skipHardening = true;
1173
1695
  else if (arg === "--strict-provenance") opts.strictProvenance = true;
1174
1696
  else if (arg === "--cleanup-volumes") opts.cleanupVolumes = true;
1697
+ else if (arg === "--reconcile-lock") opts.reconcileLock = true;
1175
1698
  else if (arg === "--allow-red") opts.allowRed = true;
1176
1699
  else if (arg === "--allow-canary") opts.allowCanary = true;
1177
1700
  else if (arg === "--no-verify-manifest-signature") opts.verifyManifestSignature = false;
@@ -1221,6 +1744,13 @@ Options:
1221
1744
  --stack-env-file <path> .env path (default: ./.env or /opt/exe-stack/.env)
1222
1745
  --env-file <path> Alias; prefer --stack-env-file because Node 22 reserves --env-file
1223
1746
  --lock-file <path> Lock file path (default: beside .env)
1747
+ --reconcile-lock Re-derive .exe-stack-lock.json from the RUNNING containers'
1748
+ org.exe.git_sha labels and exit. Call this from any delivery
1749
+ route that changes what runs without going through
1750
+ stack-update. With --check/--dry-run it writes nothing and
1751
+ exits 1 if the record disagrees with reality (bug 32920edc).
1752
+ Exits 2 when the containers could not be fully observed \u2014
1753
+ an unread service is never reported as agreeing.
1224
1754
  --check Print available changes only
1225
1755
  --dry-run Plan only; do not run Docker
1226
1756
  --config-only Deliver a compose/env/config-asset change ONLY, holding every
@@ -1460,9 +1990,9 @@ async function main(args = process.argv.slice(2)) {
1460
1990
  }
1461
1991
  if (opts.configOnly) {
1462
1992
  const readOnly = opts.check || opts.dryRun;
1463
- if (!readOnly) {
1993
+ if (!readOnly && !opts.yes) {
1464
1994
  console.error(
1465
- "Config-only APPLY is not available in this build \u2014 only the read-only plan is.\n Run `--config-only --check` to see exactly what a config-only delivery would change.\n To apply a config change today, run a normal stack update."
1995
+ "Refusing to apply a config-only update without --yes. Use --check (or --dry-run) to see what it would change."
1466
1996
  );
1467
1997
  process.exit(2);
1468
1998
  }
@@ -1474,6 +2004,53 @@ async function main(args = process.argv.slice(2)) {
1474
2004
  }
1475
2005
  const result2 = await runStackConfigUpdate(configOnlyOptionsFromCli(opts, readOnly));
1476
2006
  console.log(`[stack-config-update] ${result2.status} \u2014 ${result2.changed.length} service(s) recreated, ${result2.assets.length} asset(s) delivered.`);
2007
+ for (const d of result2.envDrift) {
2008
+ console.log(
2009
+ `[stack-config-update] \u26A0 CONTAINER DRIFT \u2014 ${d.service} is running without env key(s) this config renders: ${d.missingKeys.join(", ")}`
2010
+ );
2011
+ }
2012
+ if (result2.envUnverified.length > 0) {
2013
+ console.log(
2014
+ `[stack-config-update] \u26A0 UNVERIFIED \u2014 no container env verdict for ${result2.envUnverified.join(", ")}. This is NOT "no drift".`
2015
+ );
2016
+ }
2017
+ console.log(
2018
+ `[stack-config-update] Deployed version ${result2.stackVersion} claimed from ${STACK_VERSION_SOURCE_LABEL[result2.stackVersionSource]}.`
2019
+ );
2020
+ return;
2021
+ }
2022
+ if (opts.reconcileLock) {
2023
+ const composeArgs = composeArgsForStack(opts.composeFile, opts.envFile);
2024
+ const lockFile2 = opts.lockFile ?? path3.join(path3.dirname(opts.envFile), ".exe-stack-lock.json");
2025
+ const readOnly = opts.check || opts.dryRun;
2026
+ const result2 = reconcileStackLockFromContainers(lockFile2, composeArgs, { dryRun: readOnly });
2027
+ if (result2.unobservable) {
2028
+ console.error(
2029
+ `[stack-update] Could not derive ${lockFile2}: the running containers were not observable (no lock file, or docker did not answer). Nothing was written.`
2030
+ );
2031
+ process.exit(2);
2032
+ }
2033
+ if (result2.drifted.length > 0) {
2034
+ if (readOnly) {
2035
+ console.error(
2036
+ `[stack-update] ${result2.drifted.length} service(s) are running something the deploy record does not name. Re-run without --check/--dry-run to derive the record from the containers.`
2037
+ );
2038
+ process.exit(1);
2039
+ }
2040
+ console.log(`[stack-update] Derived ${lockFile2} from ${result2.drifted.length} drifted container(s).`);
2041
+ }
2042
+ if (result2.incomplete) {
2043
+ const inconsistent = result2.drifted.filter((o) => o.staleContainers?.length).map((o) => o.service);
2044
+ console.error(
2045
+ `[stack-update] Deploy record NOT verified: ${result2.observed} service(s) were read from containers` + (result2.uninspectable.length > 0 ? `; could not inspect: ${result2.uninspectable.join(", ")}` : "") + (result2.unobserved.length > 0 ? `; no running container: ${result2.unobserved.join(", ")}` : "") + (inconsistent.length > 0 ? `; inconsistent containers: ${inconsistent.join(", ")}` : "") + `. ${lockFile2} is UNVERIFIED for those services \u2014 this is not agreement.`
2046
+ );
2047
+ process.exit(2);
2048
+ }
2049
+ if (result2.drifted.length === 0) {
2050
+ console.log(
2051
+ `[stack-update] Deploy record agrees with the running containers \u2014 ${lockFile2} is accurate (${result2.observed} service(s) verified).`
2052
+ );
2053
+ }
1477
2054
  return;
1478
2055
  }
1479
2056
  let usingPackagedCheckTemplates = false;
@@ -1786,12 +2363,14 @@ function configOnlyOptionsFromCli(opts, readOnly) {
1786
2363
  manifestPublicKey: opts.manifestPublicKey,
1787
2364
  manifestAuthToken: opts.manifestAuthToken,
1788
2365
  targetVersion: opts.targetVersion,
2366
+ auditUrl: opts.auditUrl,
1789
2367
  deviceId: opts.deviceId,
1790
2368
  licenseKey: opts.licenseKey,
1791
2369
  dryRun: readOnly,
1792
2370
  yes: opts.yes,
1793
2371
  requireConfigDigest: opts.requireConfigDigest,
1794
- adoptDeployedPins: opts.adoptDeployedPins
2372
+ adoptDeployedPins: opts.adoptDeployedPins,
2373
+ healthTimeoutSecs: opts.healthTimeoutSecs
1795
2374
  };
1796
2375
  }
1797
2376
  function resolveManifestSignaturePolicy(input) {