@askexenow/exe-os 0.9.295 → 0.9.296

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 (279) hide show
  1. package/deploy/compose/cloudflared/config.yml.example +14 -9
  2. package/deploy/compose/docker-compose.yml +86 -8
  3. package/deploy/compose/sso-edge/default.conf.template +87 -0
  4. package/deploy/compose/sso-edge/entrypoint.sh +23 -0
  5. package/deploy/compose/sso-edge/sso-redirect.conf +63 -0
  6. package/deploy/stack-manifests/v0.9.json +1 -1
  7. package/dist/active-agent-AFX2FODG.js +28 -0
  8. package/dist/active-agent-E2IJA7YX.js +27 -0
  9. package/dist/agentic-ontology-A2YUZK5O.js +25 -0
  10. package/dist/assets/com.askexe.exed.plist +4 -1
  11. package/dist/backfill-metadata-OC7EOD5U.js +600 -0
  12. package/dist/behaviors-H5ZOVHDH.js +46 -0
  13. package/dist/bin/agentic-ontology-backfill.js +5 -5
  14. package/dist/bin/agentic-reflection-backfill.js +6 -6
  15. package/dist/bin/agentic-semantic-label.js +5 -5
  16. package/dist/bin/backfill-conversations.js +6 -6
  17. package/dist/bin/backfill-responses.js +6 -6
  18. package/dist/bin/backfill-vectors.js +8 -8
  19. package/dist/bin/bulk-sync-postgres.js +7 -7
  20. package/dist/bin/cc-doctor.js +4 -4
  21. package/dist/bin/cleanup-stale-review-tasks.js +11 -11
  22. package/dist/bin/cli.js +16 -16
  23. package/dist/bin/deferred-daemon-restart.js +1 -1
  24. package/dist/bin/exe-agent-config.js +2 -2
  25. package/dist/bin/exe-agent.js +4 -4
  26. package/dist/bin/exe-assign.js +8 -8
  27. package/dist/bin/exe-boot.js +21 -18
  28. package/dist/bin/exe-call.js +4 -4
  29. package/dist/bin/exe-cloud.js +7 -7
  30. package/dist/bin/exe-dispatch.js +11 -11
  31. package/dist/bin/exe-doctor.js +3 -2
  32. package/dist/bin/exe-export-behaviors.js +7 -7
  33. package/dist/bin/exe-forget.js +6 -6
  34. package/dist/bin/exe-gateway.js +7 -7
  35. package/dist/bin/exe-healthcheck.js +6 -4
  36. package/dist/bin/exe-heartbeat.js +11 -11
  37. package/dist/bin/exe-kill.js +14 -14
  38. package/dist/bin/exe-launch-agent.js +18 -18
  39. package/dist/bin/exe-new-employee.js +6 -6
  40. package/dist/bin/exe-pending-messages.js +12 -12
  41. package/dist/bin/exe-pending-notifications.js +11 -11
  42. package/dist/bin/exe-pending-reviews.js +11 -11
  43. package/dist/bin/exe-rename.js +4 -4
  44. package/dist/bin/exe-review.js +13 -13
  45. package/dist/bin/exe-search.js +5 -5
  46. package/dist/bin/exe-session-cleanup.js +16 -16
  47. package/dist/bin/exe-settings.js +39 -9
  48. package/dist/bin/exe-start-codex.js +11 -11
  49. package/dist/bin/exe-start-opencode.js +8 -8
  50. package/dist/bin/exe-status.js +12 -12
  51. package/dist/bin/exe-team.js +3 -3
  52. package/dist/bin/git-sweep.js +12 -12
  53. package/dist/bin/graph-backfill.js +4 -4
  54. package/dist/bin/graph-export.js +5 -5
  55. package/dist/bin/import-history.js +7 -7
  56. package/dist/bin/install-launchd.js +13 -6
  57. package/dist/bin/install.js +26 -14
  58. package/dist/bin/intercom-check.js +4 -4
  59. package/dist/bin/mcp-sessions.js +2 -2
  60. package/dist/bin/orchestration-metrics.js +4 -4
  61. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  62. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  63. package/dist/bin/scan-tasks.js +11 -11
  64. package/dist/bin/setup.js +1 -1
  65. package/dist/bin/shard-migrate.js +4 -4
  66. package/dist/bin/stack-update.js +2 -2
  67. package/dist/bin/vps-health-gate.js +1 -1
  68. package/dist/capability-cards-4USI7CUW.js +89 -0
  69. package/dist/capacity-monitor-WLCBTEYR.js +51 -0
  70. package/dist/catchup-brief-ZR3NX6LZ.js +175 -0
  71. package/dist/chunk-22TVSRQQ.js +226 -0
  72. package/dist/chunk-2E43UXRH.js +395 -0
  73. package/dist/chunk-2PIGT6UJ.js +460 -0
  74. package/dist/chunk-3XTMW2MZ.js +535 -0
  75. package/dist/chunk-465PQFTH.js +262 -0
  76. package/dist/chunk-5CCXU2AW.js +129 -0
  77. package/dist/chunk-5D6MPWR7.js +1094 -0
  78. package/dist/chunk-5Q4MR6SL.js +123 -0
  79. package/dist/chunk-6327RBWR.js +345 -0
  80. package/dist/chunk-6MZZREZY.js +199 -0
  81. package/dist/chunk-7DI2Q4O5.js +1186 -0
  82. package/dist/chunk-7PW5VNIY.js +122 -0
  83. package/dist/chunk-7T7Y56HW.js +43 -0
  84. package/dist/chunk-7UHCWCLT.js +128 -0
  85. package/dist/chunk-A2ZUMF6L.js +1350 -0
  86. package/dist/chunk-AKV44JEH.js +185 -0
  87. package/dist/chunk-ANHWGX5N.js +735 -0
  88. package/dist/chunk-BQ3P4TKD.js +97 -0
  89. package/dist/chunk-BUZMT3KZ.js +604 -0
  90. package/dist/chunk-C2SBESBO.js +210 -0
  91. package/dist/chunk-CLSXZUZW.js +51 -0
  92. package/dist/chunk-CONHLVAR.js +1079 -0
  93. package/dist/chunk-D3WTZPFX.js +456 -0
  94. package/dist/chunk-DE6SOIYL.js +197 -0
  95. package/dist/chunk-EIVNMA3Q.js +284 -0
  96. package/dist/chunk-EJIF4FNT.js +12 -0
  97. package/dist/chunk-FDFOW564.js +171 -0
  98. package/dist/chunk-GZUBJ5EC.js +127 -0
  99. package/dist/chunk-HGZITN22.js +105 -0
  100. package/dist/chunk-HSRKDU6X.js +362 -0
  101. package/dist/chunk-IIEN2PHV.js +85 -0
  102. package/dist/chunk-JQ56VLMM.js +567 -0
  103. package/dist/chunk-JVHHXRFY.js +280 -0
  104. package/dist/chunk-JXCXGZ3S.js +55 -0
  105. package/dist/chunk-K5ZO532Q.js +4388 -0
  106. package/dist/chunk-K6CAAMXF.js +97 -0
  107. package/dist/chunk-KA26YTNU.js +81 -0
  108. package/dist/chunk-KMUW5C3R.js +381 -0
  109. package/dist/chunk-KOO3J5PV.js +20 -0
  110. package/dist/chunk-LSV7OFIH.js +290 -0
  111. package/dist/chunk-LSVFDVNY.js +1158 -0
  112. package/dist/chunk-LXDQTW32.js +230 -0
  113. package/dist/chunk-MEP7OUVZ.js +181 -0
  114. package/dist/chunk-MN2B2LKS.js +240 -0
  115. package/dist/chunk-N2EAYPYQ.js +1352 -0
  116. package/dist/chunk-N7I2A667.js +70 -0
  117. package/dist/chunk-NLZHVIOP.js +630 -0
  118. package/dist/chunk-NUH5TRZL.js +227 -0
  119. package/dist/chunk-OAHEIH3G.js +167 -0
  120. package/dist/chunk-OBHRQGCK.js +58 -0
  121. package/dist/chunk-ODFA7B2V.js +54 -0
  122. package/dist/chunk-OSNUP45F.js +731 -0
  123. package/dist/chunk-OTPRHBTO.js +33 -0
  124. package/dist/chunk-P6MUA4QU.js +157 -0
  125. package/dist/chunk-PGIOFKSK.js +2093 -0
  126. package/dist/chunk-PSE7VHWK.js +50 -0
  127. package/dist/chunk-QIFUVZFW.js +331 -0
  128. package/dist/chunk-RDPXKTVK.js +221 -0
  129. package/dist/chunk-RKYTYJGB.js +76 -0
  130. package/dist/chunk-RXLR6EFM.js +348 -0
  131. package/dist/chunk-SDB67PQJ.js +159 -0
  132. package/dist/chunk-SF2T7MP3.js +402 -0
  133. package/dist/chunk-SLU3FRFQ.js +2133 -0
  134. package/dist/chunk-SNDZJ5IV.js +214 -0
  135. package/dist/chunk-STEEAABW.js +448 -0
  136. package/dist/chunk-TUTWNHIQ.js +244 -0
  137. package/dist/chunk-UDP35QBR.js +30 -0
  138. package/dist/chunk-UKFHNJBI.js +85 -0
  139. package/dist/chunk-VC2DTK2X.js +382 -0
  140. package/dist/chunk-VRRAE5JX.js +836 -0
  141. package/dist/chunk-VVJTBQPR.js +38 -0
  142. package/dist/chunk-W3EQ362K.js +581 -0
  143. package/dist/chunk-WHIXIFHC.js +2242 -0
  144. package/dist/chunk-WRNGJJNR.js +377 -0
  145. package/dist/chunk-WUKHLCBE.js +3313 -0
  146. package/dist/chunk-WVPLHGDG.js +150 -0
  147. package/dist/chunk-XJZBSTL5.js +204 -0
  148. package/dist/chunk-Y3PMNUM5.js +304 -0
  149. package/dist/chunk-YHVS4QOV.js +14597 -0
  150. package/dist/chunk-YJ2OYAOC.js +668 -0
  151. package/dist/chunk-YYAD2GXX.js +128 -0
  152. package/dist/chunk-ZQML7EWE.js +333 -0
  153. package/dist/co-activation-XJLH46OX.js +74 -0
  154. package/dist/co-occurrence-GNN2X526.js +95 -0
  155. package/dist/code-context-index-OCPRLFG5.js +30 -0
  156. package/dist/core-memory-J4W2IYOF.js +110 -0
  157. package/dist/crdt-sync-QCBTSHIH.js +33 -0
  158. package/dist/crm-webhook-EM442VUW.js +10 -0
  159. package/dist/cto-delegation-gate-MLJMVHBK.js +280 -0
  160. package/dist/daemon-orchestration-2VNLZVTW.js +139 -0
  161. package/dist/db-backup-VUGFTPJ4.js +43 -0
  162. package/dist/doc-graph-extractor-PNRSFPSS.js +133 -0
  163. package/dist/dreaming-SK5VEQRF.js +34 -0
  164. package/dist/entity-boost-TQWWJUC2.js +375 -0
  165. package/dist/exe-drift-N34UPO7S.js +70 -0
  166. package/dist/exe-export-KACBKGVV.js +77 -0
  167. package/dist/exe-import-GXGDWACG.js +80 -0
  168. package/dist/exe-key-XPDOZBWW.js +673 -0
  169. package/dist/exe-snapshot-32GQKGQ5.js +338 -0
  170. package/dist/fast-db-init-F3TDD5VV.js +7 -0
  171. package/dist/gateway/index.js +8 -8
  172. package/dist/git-staleness-J45WNYRF.js +112 -0
  173. package/dist/git-task-sweep-BTGVQPFB.js +42 -0
  174. package/dist/global-procedures-6JCQWU4D.js +22 -0
  175. package/dist/graph-auto-extract-3ZQNXTPC.js +183 -0
  176. package/dist/hooks/bug-report-worker.js +13 -13
  177. package/dist/hooks/codex-stop-task-finalizer.js +13 -13
  178. package/dist/hooks/commit-complete.js +13 -13
  179. package/dist/hooks/error-recall.js +6 -6
  180. package/dist/hooks/exe-heartbeat-hook.js +3 -3
  181. package/dist/hooks/ingest-worker.js +3 -3
  182. package/dist/hooks/ingest.js +6 -6
  183. package/dist/hooks/instructions-loaded.js +4 -4
  184. package/dist/hooks/manifest.json +20 -20
  185. package/dist/hooks/notification.js +4 -4
  186. package/dist/hooks/post-compact.js +12 -12
  187. package/dist/hooks/post-tool-combined.js +6 -6
  188. package/dist/hooks/pre-compact.js +16 -16
  189. package/dist/hooks/pre-tool-use.js +16 -16
  190. package/dist/hooks/prompt-submit.js +24 -24
  191. package/dist/hooks/session-end.js +21 -21
  192. package/dist/hooks/session-start.js +12 -12
  193. package/dist/hooks/stop.js +19 -19
  194. package/dist/hooks/subagent-stop.js +12 -12
  195. package/dist/hooks/summary-worker.js +19 -19
  196. package/dist/index.js +19 -19
  197. package/dist/installer-5VPFY7SB.js +298 -0
  198. package/dist/installer-OENFPMA2.js +344 -0
  199. package/dist/installer-OIX4QOG5.js +40 -0
  200. package/dist/lib/cloud-sync.js +7 -7
  201. package/dist/lib/consolidation.js +6 -5
  202. package/dist/lib/database.js +2 -2
  203. package/dist/lib/db-daemon-client.js +2 -2
  204. package/dist/lib/db.js +2 -2
  205. package/dist/lib/embed-worker.js +1 -0
  206. package/dist/lib/embedder.js +7 -3
  207. package/dist/lib/employee-templates.js +4 -4
  208. package/dist/lib/employees.js +2 -2
  209. package/dist/lib/exe-daemon-client.js +2 -2
  210. package/dist/lib/exe-daemon.js +160 -79
  211. package/dist/lib/hybrid-search.js +5 -5
  212. package/dist/lib/identity.js +2 -2
  213. package/dist/lib/messaging.js +11 -11
  214. package/dist/lib/reminders.js +3 -3
  215. package/dist/lib/schedules.js +5 -5
  216. package/dist/lib/session-registry.js +4 -4
  217. package/dist/lib/skill-learning.js +6 -6
  218. package/dist/lib/store.js +4 -4
  219. package/dist/lib/task-router.js +3 -3
  220. package/dist/lib/tasks.js +12 -12
  221. package/dist/lib/tmux-routing.js +12 -10
  222. package/dist/lib/tmux-transport.js +1 -1
  223. package/dist/lib/token-spend.js +3 -3
  224. package/dist/lib/transport.js +2 -2
  225. package/dist/mcp/register-tools.js +62 -61
  226. package/dist/mcp/server.js +63 -62
  227. package/dist/mcp/tools/complete-reminder.js +4 -4
  228. package/dist/mcp/tools/create-reminder.js +4 -4
  229. package/dist/mcp/tools/create-task.js +14 -14
  230. package/dist/mcp/tools/deactivate-behavior.js +7 -7
  231. package/dist/mcp/tools/list-reminders.js +4 -4
  232. package/dist/mcp/tools/list-tasks.js +14 -14
  233. package/dist/mcp/tools/send-message.js +13 -13
  234. package/dist/mcp/tools/update-task.js +13 -13
  235. package/dist/mcp-http-config-PQTOLCTP.js +29 -0
  236. package/dist/memory-cards-4RVDZIY2.js +180 -0
  237. package/dist/memory-graph-extractor-L6YC7G4M.js +22 -0
  238. package/dist/memory-poisoning-defense-4YVJYH4G.js +224 -0
  239. package/dist/memory-queue-client-MVAUOZNJ.js +16 -0
  240. package/dist/memory-reflection-SHHDQNOH.js +244 -0
  241. package/dist/message-queue-client-DCKZT6X2.js +92 -0
  242. package/dist/notifications-JFR3G42W.js +47 -0
  243. package/dist/orchestration-events-MGCGPTDN.js +27 -0
  244. package/dist/orchestrator-DAFL2YZB.js +35 -0
  245. package/dist/pipeline-router-WWSZVPCH.js +15 -0
  246. package/dist/plan-limits-C7XCSDZC.js +28 -0
  247. package/dist/project-boot-N3NTBVLE.js +299 -0
  248. package/dist/projection-worker-MTPAPCWX.js +1084 -0
  249. package/dist/prospective-memory-BTIVUJSB.js +232 -0
  250. package/dist/reranker-UA6WVESJ.js +19 -0
  251. package/dist/retrieval-health-7XNZJEBF.js +12 -0
  252. package/dist/review-polling-4ALGMXC3.js +126 -0
  253. package/dist/runtime/index.js +13 -13
  254. package/dist/self-query-router-MROFQLQB.js +192 -0
  255. package/dist/session-events-CK44XOU4.js +38 -0
  256. package/dist/session-kill-telemetry-MT6ITDOG.js +31 -0
  257. package/dist/session-scope-3XDBWV65.js +88 -0
  258. package/dist/setup-wizard-X6DOD7MC.js +12 -0
  259. package/dist/skill-refinement-G2CCY3GM.js +159 -0
  260. package/dist/stack-update-JF7F56AS.js +84 -0
  261. package/dist/steward-gate-YF2CYXE7.js +15 -0
  262. package/dist/task-enforcement-YN6HK7NE.js +506 -0
  263. package/dist/task-scope-CVK6ISCZ.js +37 -0
  264. package/dist/tasks-crud-NTNET4JE.js +79 -0
  265. package/dist/tasks-notify-4LJVFPCV.js +40 -0
  266. package/dist/tasks-review-3V4WOIRG.js +49 -0
  267. package/dist/telemetry-upload-5PNUKGTM.js +741 -0
  268. package/dist/token-budget-E46G7ZAQ.js +86 -0
  269. package/dist/tool-capability-index-JDSMKJER.js +10 -0
  270. package/dist/tool-telemetry-J3NLS3LJ.js +17 -0
  271. package/dist/tui/App.js +18 -18
  272. package/dist/tui-data-6DOMUUCM.js +260 -0
  273. package/dist/wiki-acl-5UK37LKF.js +111 -0
  274. package/dist/worker-gate-FM7AEC7G.js +21 -0
  275. package/dist/workflow-engine-2EDUHUIY.js +28 -0
  276. package/dist/worktree-7YKKJIYR.js +28 -0
  277. package/dist/worktree-sweep-C3ELFGDN.js +21 -0
  278. package/package.json +1 -1
  279. package/release-notes.json +23 -23
@@ -17,8 +17,19 @@ import {
17
17
  findScopedDuplicate,
18
18
  governMemoryRecord,
19
19
  schedulePostWriteMemoryHygiene
20
- } from "../chunk-DQBHY3Q4.js";
20
+ } from "../chunk-C2SBESBO.js";
21
21
  import "../chunk-Y25OJWOQ.js";
22
+ import {
23
+ resolveEmbeddingsEnabled
24
+ } from "../chunk-CLSXZUZW.js";
25
+ import {
26
+ EMBED_MAX_RESPAWNS,
27
+ HEAP_FLAG_RE,
28
+ buildEmbedWorkerExecArgv,
29
+ computeEmbedRespawnDelayMs,
30
+ resolveEmbedWorkerHeapMb,
31
+ resolveEmbedWorkerRssKillMb
32
+ } from "../chunk-7T7Y56HW.js";
22
33
  import {
23
34
  consumeRestartIntent,
24
35
  logRestartEvent
@@ -904,18 +915,18 @@ function enqueue(queue, entry) {
904
915
  var OOM_MARKER_PATH = path4.join(os3.homedir(), ".exe-os", "embedding-oom-marker");
905
916
  var EMBEDDINGS_OPT_IN_PATH = path4.join(os3.homedir(), ".exe-os", "embeddings-enabled");
906
917
  var MIN_FREE_MEM_BYTES = 2 * 1024 ** 3;
918
+ var EMBED_WORKER_HEAP_MB = resolveEmbedWorkerHeapMb(process.env.EXE_EMBED_WORKER_HEAP_MB);
919
+ var EMBED_WORKER_RSS_KILL_MB = resolveEmbedWorkerRssKillMb(
920
+ process.env.EXE_EMBED_WORKER_RSS_KILL_MB,
921
+ EMBED_WORKER_HEAP_MB
922
+ );
907
923
  function resolveEmbeddingsOptIn() {
908
- const env = process.env.EXE_EMBEDDINGS;
909
- if (env === "1" || env === "true") return true;
910
- if (env === "0" || env === "false") return false;
924
+ let cfg = null;
911
925
  try {
912
- if (existsSync4(EMBEDDINGS_OPT_IN_PATH)) {
913
- const raw = readFileSync3(EMBEDDINGS_OPT_IN_PATH, "utf8").trim().toLowerCase();
914
- return raw === "" || raw === "1" || raw === "true";
915
- }
926
+ cfg = _loadConfigSyncFn?.() ?? _configCache;
916
927
  } catch {
917
928
  }
918
- return false;
929
+ return resolveEmbeddingsEnabled(process.env.EXE_EMBEDDINGS, cfg, EMBEDDINGS_OPT_IN_PATH);
919
930
  }
920
931
  var MAX_SMALL_TOTAL_BYTES = 16 * 1024 ** 3;
921
932
  var OOM_MARKER_TTL_MS = 1 * 60 * 60 * 1e3;
@@ -994,6 +1005,33 @@ function clearStaleOomMarker() {
994
1005
  return false;
995
1006
  }
996
1007
  }
1008
+ function checkLaunchdPlistHealth() {
1009
+ try {
1010
+ if (process.platform !== "darwin") return;
1011
+ const plistPath = path4.join(os3.homedir(), "Library", "LaunchAgents", "com.askexe.exed.plist");
1012
+ if (!existsSync4(plistPath)) return;
1013
+ const plist = readFileSync3(plistPath, "utf8");
1014
+ const heapMatch = plist.match(/--max-old-space-size=(\d+)/);
1015
+ const heap = heapMatch?.[1] ? parseInt(heapMatch[1], 10) : null;
1016
+ if (heap !== null && heap !== 2048) {
1017
+ process.stderr.write(
1018
+ `[exed] STALE PLIST (bug 5de6e765): launchd heap cap is ${heap}MB, expected 2048MB. A larger cap lets the embed model load IN-PROCESS and OOM the daemon. Fix: run \`exe-os update\` (or \`exe-os-install --global\`) to regenerate the plist.
1019
+ `
1020
+ );
1021
+ }
1022
+ const pathMatch = plist.match(/<key>PATH<\/key>\s*<string>([^<]*)<\/string>/);
1023
+ const exportedPath = pathMatch?.[1] ?? "";
1024
+ const nodeBinDir = path4.dirname(process.execPath);
1025
+ const systemDirs = /* @__PURE__ */ new Set(["/usr/local/bin", "/usr/bin", "/bin", "/opt/homebrew/bin"]);
1026
+ if (exportedPath && !systemDirs.has(nodeBinDir) && !exportedPath.split(":").includes(nodeBinDir)) {
1027
+ process.stderr.write(
1028
+ `[exed] STALE PLIST (bug 19d3bfdb): launchd PATH is missing node bin dir ${nodeBinDir}. A pure launchd restart would fail with "exec: node: not found". Fix: run \`exe-os update\` (or \`exe-os-install --global\`) to regenerate the plist.
1029
+ `
1030
+ );
1031
+ }
1032
+ } catch {
1033
+ }
1034
+ }
997
1035
  async function loadModel() {
998
1036
  if (SERVER_MODE) {
999
1037
  process.stderr.write("[exed] EXE_SERVER_MODE=1 \u2014 embeddings disabled; skipping model/worker startup.\n");
@@ -1082,9 +1120,15 @@ async function loadModel() {
1082
1120
  `);
1083
1121
  return;
1084
1122
  }
1085
- const HEAP_FLAG_RE = /^--(max[-_]old[-_]space[-_]size|max[-_]semi[-_]space[-_]size|max[-_]heap[-_]size)(=|$)/i;
1086
- const workerExecArgv = process.execArgv.filter((a) => !HEAP_FLAG_RE.test(a));
1087
- const workerEnv = { ...process.env, EXE_EMBED_MODEL: MODEL_FILE };
1123
+ const workerHeapMb = EMBED_WORKER_HEAP_MB;
1124
+ const workerExecArgv = buildEmbedWorkerExecArgv(process.execArgv, workerHeapMb);
1125
+ const workerEnv = {
1126
+ ...process.env,
1127
+ EXE_EMBED_MODEL: MODEL_FILE,
1128
+ // Mark the worker context so the in-process model-load guard
1129
+ // (embedder.ts assertEmbedWorkerContext) permits loading ONLY here.
1130
+ EXE_EMBED_WORKER_CONTEXT: "1"
1131
+ };
1088
1132
  if (workerEnv.NODE_OPTIONS) {
1089
1133
  const cleaned = workerEnv.NODE_OPTIONS.split(/\s+/).filter((tok) => tok && !HEAP_FLAG_RE.test(tok)).join(" ");
1090
1134
  if (cleaned) workerEnv.NODE_OPTIONS = cleaned;
@@ -1165,18 +1209,19 @@ async function loadModel() {
1165
1209
  }
1166
1210
  }
1167
1211
  _embedRespawnCount++;
1168
- if (_embedRespawnCount <= 3) {
1169
- const delay = _embedRespawnCount * 1e4;
1170
- process.stderr.write(`[exed] Respawning embed worker in ${delay / 1e3}s (attempt ${_embedRespawnCount}/3).
1212
+ const respawnDelay = computeEmbedRespawnDelayMs(_embedRespawnCount);
1213
+ if (respawnDelay !== null) {
1214
+ process.stderr.write(`[exed] Respawning embed worker in ${respawnDelay / 1e3}s (attempt ${_embedRespawnCount}/${EMBED_MAX_RESPAWNS}, exponential backoff).
1171
1215
  `);
1172
- setTimeout(() => loadModel(), delay);
1216
+ setTimeout(() => loadModel(), respawnDelay);
1173
1217
  } else {
1174
- process.stderr.write(`[exed] Embed worker failed 3 times \u2014 running without embeddings.
1218
+ _embeddingsDisabledByDesign = true;
1219
+ process.stderr.write(`[exed] Embed worker failed ${EMBED_MAX_RESPAWNS} times \u2014 DEGRADED MODE: embeddings disabled, FTS+Graph still serving, daemon stays healthy.
1175
1220
  `);
1176
1221
  void (async () => {
1177
1222
  try {
1178
1223
  if (_storeInitialized) {
1179
- const { writeNotification } = await import("../notifications-B2YCZD3T.js");
1224
+ const { writeNotification } = await import("../notifications-JFR3G42W.js");
1180
1225
  await writeNotification({
1181
1226
  agentId: "exe",
1182
1227
  agentRole: "system",
@@ -1227,8 +1272,8 @@ setInterval(() => {
1227
1272
  resetBackoffState("embed");
1228
1273
  clearStaleOomMarker();
1229
1274
  }
1230
- if (msg.rss && msg.rss > 4096) {
1231
- process.stderr.write(`[exed] Embed worker RSS ${msg.rss}MB > 4GB \u2014 killing to prevent OOM.
1275
+ if (msg.rss && msg.rss > EMBED_WORKER_RSS_KILL_MB) {
1276
+ process.stderr.write(`[exed] Embed worker RSS ${msg.rss}MB > ${EMBED_WORKER_RSS_KILL_MB}MB (heap=${EMBED_WORKER_HEAP_MB}MB) \u2014 runaway leak, killing.
1232
1277
  `);
1233
1278
  try {
1234
1279
  _embedWorker?.kill("SIGKILL");
@@ -1438,12 +1483,19 @@ async function shutdown(exitCode = 0) {
1438
1483
  }
1439
1484
  }
1440
1485
  try {
1441
- const { createBackupAsync, enforceRetention } = await import("../db-backup-T4OALIZH.js");
1442
- const backupPath = await createBackupAsync("pre-restart", { checkpointMode: "PASSIVE" });
1443
- if (backupPath) {
1486
+ const { createBackupAsync, enforceRetention, hasRecentBackup } = await import("../db-backup-VUGFTPJ4.js");
1487
+ const PRE_RESTART_DEDUP_MS = 2 * 60 * 1e3;
1488
+ if (hasRecentBackup("pre-restart", PRE_RESTART_DEDUP_MS)) {
1444
1489
  const deleted = enforceRetention("pre-restart");
1445
- process.stderr.write(`[exed] Pre-restart backup: ${backupPath}${deleted > 0 ? ` (rotated ${deleted} old)` : ""}
1490
+ process.stderr.write(`[exed] Pre-restart backup skipped \u2014 recent snapshot exists (crash-loop dedup)${deleted > 0 ? `; rotated ${deleted} old` : ""}.
1491
+ `);
1492
+ } else {
1493
+ const backupPath = await createBackupAsync("pre-restart", { checkpointMode: "PASSIVE" });
1494
+ if (backupPath) {
1495
+ const deleted = enforceRetention("pre-restart");
1496
+ process.stderr.write(`[exed] Pre-restart backup: ${backupPath}${deleted > 0 ? ` (rotated ${deleted} old)` : ""}
1446
1497
  `);
1498
+ }
1447
1499
  }
1448
1500
  } catch (e) {
1449
1501
  process.stderr.write(`[exed] Pre-restart backup failed (non-fatal): ${e instanceof Error ? e.message : String(e)}
@@ -1462,7 +1514,7 @@ async function shutdown(exitCode = 0) {
1462
1514
  `);
1463
1515
  }
1464
1516
  try {
1465
- const { stopProjectionWorker } = await import("../projection-worker-XVOLBYQC.js");
1517
+ const { stopProjectionWorker } = await import("../projection-worker-MTPAPCWX.js");
1466
1518
  stopProjectionWorker();
1467
1519
  } catch {
1468
1520
  }
@@ -1523,7 +1575,7 @@ async function handleHealthCheck(socket, requestId) {
1523
1575
  let pipelineStatus = "unknown";
1524
1576
  if (dbConnected) {
1525
1577
  try {
1526
- await import("../pipeline-router-ITQDOV2B.js");
1578
+ await import("../pipeline-router-WWSZVPCH.js");
1527
1579
  pipelineStatus = "ok";
1528
1580
  } catch {
1529
1581
  pipelineStatus = "unavailable";
@@ -1933,7 +1985,7 @@ async function _writeMemoryRecordInner(entry) {
1933
1985
  const vRow = await client.execute({ sql: "SELECT version FROM memories WHERE id = ?", args: [id] });
1934
1986
  const version = Number(vRow.rows[0]?.version) || 0;
1935
1987
  try {
1936
- const { insertOntologyForMemory } = await import("../agentic-ontology-WTXI6RLB.js");
1988
+ const { insertOntologyForMemory } = await import("../agentic-ontology-A2YUZK5O.js");
1937
1989
  await insertOntologyForMemory({
1938
1990
  id,
1939
1991
  agent_id: record.agent_id,
@@ -2017,7 +2069,7 @@ function startMessageQueueDrain() {
2017
2069
  fired("message_queue_drain");
2018
2070
  if (!await ensureStoreForPolling()) return;
2019
2071
  try {
2020
- const { claimMessageQueue, ackMessageQueue } = await import("../message-queue-client-L5VZ44IN.js");
2072
+ const { claimMessageQueue, ackMessageQueue } = await import("../message-queue-client-DCKZT6X2.js");
2021
2073
  const lease = claimMessageQueue();
2022
2074
  if (!lease || lease.entries.length === 0) return;
2023
2075
  acted("message_queue_drain");
@@ -2207,6 +2259,13 @@ function startServer() {
2207
2259
  _mcpHttpReady = startMcpHttpServer();
2208
2260
  }
2209
2261
  var FIXED_MCP_PORT = 48739;
2262
+ function decidePortHolderAction(args) {
2263
+ const { holderPid, selfPid, parentPid, command } = args;
2264
+ if (!Number.isInteger(holderPid) || holderPid <= 0) return "skip-invalid";
2265
+ if (holderPid === selfPid || holderPid === parentPid || holderPid === 1) return "skip-self";
2266
+ if (!command.includes("exe-daemon")) return "skip-non-daemon";
2267
+ return "kill-stale-daemon";
2268
+ }
2210
2269
  async function resolveAndClaimPort() {
2211
2270
  if (process.env.EXE_MCP_PORT) {
2212
2271
  const envPort = parseInt(process.env.EXE_MCP_PORT, 10);
@@ -2253,19 +2312,29 @@ async function resolveAndClaimPort() {
2253
2312
  }
2254
2313
  try {
2255
2314
  const { execFileSync } = await import("child_process");
2315
+ const selfPid = process.pid;
2316
+ const parentPid = process.ppid;
2256
2317
  const pids = execFileSync("lsof", ["-ti", `:${targetPort}`, "-sTCP:LISTEN"], { encoding: "utf8" }).trim();
2257
2318
  if (pids) {
2258
2319
  for (const pid of pids.split("\n").filter(Boolean)) {
2320
+ const numericPid = parseInt(pid, 10);
2259
2321
  try {
2260
- const cmd = execFileSync("ps", ["-p", pid, "-o", "command="], { encoding: "utf8", timeout: 2e3 }).trim();
2261
- if (!cmd.includes("exe-daemon")) {
2262
- process.stderr.write(`[exed] Port ${targetPort} held by non-daemon PID ${pid} (${cmd.slice(0, 120)}) \u2014 not killing
2263
- `);
2264
- continue;
2322
+ let command = "";
2323
+ if (numericPid !== selfPid && numericPid !== parentPid && numericPid !== 1) {
2324
+ command = execFileSync("ps", ["-p", pid, "-o", "command="], { encoding: "utf8", timeout: 2e3 }).trim();
2265
2325
  }
2266
- process.stderr.write(`[exed] Port ${targetPort} held by stale daemon PID ${pid} \u2014 SIGTERM
2326
+ const action = decidePortHolderAction({ holderPid: numericPid, selfPid, parentPid, command });
2327
+ if (action === "skip-self") {
2328
+ process.stderr.write(`[exed] Port ${targetPort} held by self/init PID ${numericPid} \u2014 owns the port, not killing
2329
+ `);
2330
+ } else if (action === "skip-non-daemon") {
2331
+ process.stderr.write(`[exed] Port ${targetPort} held by non-daemon PID ${pid} (${command.slice(0, 120)}) \u2014 not killing
2267
2332
  `);
2268
- process.kill(parseInt(pid, 10), "SIGTERM");
2333
+ } else if (action === "kill-stale-daemon") {
2334
+ process.stderr.write(`[exed] Port ${targetPort} held by stale daemon PID ${pid} \u2014 SIGTERM
2335
+ `);
2336
+ process.kill(numericPid, "SIGTERM");
2337
+ }
2269
2338
  } catch {
2270
2339
  }
2271
2340
  }
@@ -2517,13 +2586,13 @@ async function startMcpHttpServer() {
2517
2586
  let _cachedWrapTelemetry = null;
2518
2587
  async function getWrapTelemetry() {
2519
2588
  if (!_cachedWrapTelemetry) {
2520
- const { wrapServerWithTelemetry } = await import("../tool-telemetry-4YD2E6UU.js");
2589
+ const { wrapServerWithTelemetry } = await import("../tool-telemetry-J3NLS3LJ.js");
2521
2590
  _cachedWrapTelemetry = wrapServerWithTelemetry;
2522
2591
  }
2523
2592
  return _cachedWrapTelemetry;
2524
2593
  }
2525
2594
  Promise.all([
2526
- import("../tool-capability-index-4M3BFQTU.js"),
2595
+ import("../tool-capability-index-JDSMKJER.js"),
2527
2596
  import("../tool-gates-3IC7DK4R.js")
2528
2597
  ]).then(async ([{ getToolCapabilityIndex }, { TOOL_CATEGORIES }]) => {
2529
2598
  const gateState = getCachedLicenseGate();
@@ -2932,7 +3001,7 @@ async function startMcpHttpServer() {
2932
3001
  contextPct: body.context_pct
2933
3002
  });
2934
3003
  if (body.context_pct !== void 0 && body.context_pct > 70) {
2935
- void import("../orchestration-events-VJTAOA2R.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
3004
+ void import("../orchestration-events-MGCGPTDN.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
2936
3005
  recordOE({
2937
3006
  eventType: "context.pressure",
2938
3007
  source: "exe-daemon.heartbeat",
@@ -3397,13 +3466,13 @@ async function ensureStoreForPolling() {
3397
3466
  }
3398
3467
  }
3399
3468
  async function startReviewPolling() {
3400
- const polling = await import("../review-polling-YDS35QTO.js");
3469
+ const polling = await import("../review-polling-4ALGMXC3.js");
3401
3470
  const state = {
3402
3471
  lastIntercomSent: /* @__PURE__ */ new Map(),
3403
3472
  lastNudgeSent: /* @__PURE__ */ new Map(),
3404
3473
  intervalMs: REVIEW_POLL_INTERVAL_MS
3405
3474
  };
3406
- const { pollReviewNudge, createReviewNudgeRealDeps, loadNudgeState } = await import("../daemon-orchestration-EEPWOFMX.js");
3475
+ const { pollReviewNudge, createReviewNudgeRealDeps, loadNudgeState } = await import("../daemon-orchestration-2VNLZVTW.js");
3407
3476
  const nudgeState = loadNudgeState();
3408
3477
  const tick = async () => traceDaemonTimer("review_polling", async () => {
3409
3478
  fired("review_polling");
@@ -3440,13 +3509,14 @@ async function startReviewPolling() {
3440
3509
  `);
3441
3510
  }
3442
3511
  var SESSION_TTL_INTERVAL_MS = 5 * 60 * 1e3;
3512
+ var SESSION_REGISTRY_MAINTENANCE_INTERVAL_MS = 5 * 60 * 1e3;
3443
3513
  function startSessionTTL() {
3444
3514
  const tick = async () => traceDaemonTimer("session_ttl", async () => {
3445
3515
  fired("session_ttl");
3446
3516
  if (!await ensureStoreForPolling()) return;
3447
3517
  try {
3448
3518
  const { getClient } = await import("./database.js");
3449
- const { checkSessionTTL, createSessionTTLRealDeps } = await import("../daemon-orchestration-EEPWOFMX.js");
3519
+ const { checkSessionTTL, createSessionTTLRealDeps } = await import("../daemon-orchestration-2VNLZVTW.js");
3450
3520
  const deps = createSessionTTLRealDeps(getClient);
3451
3521
  const killed = await checkSessionTTL(deps);
3452
3522
  if (killed.length > 0) acted("session_ttl");
@@ -3494,7 +3564,7 @@ function startIdleKill() {
3494
3564
  const cfg = await getCachedConfig();
3495
3565
  if (!cfg) return;
3496
3566
  const { getClient } = await import("./database.js");
3497
- const { pollIdleKill, createIdleKillRealDeps } = await import("../daemon-orchestration-EEPWOFMX.js");
3567
+ const { pollIdleKill, createIdleKillRealDeps } = await import("../daemon-orchestration-2VNLZVTW.js");
3498
3568
  const { sessions: liveSessions, paneCache, aliveSessions } = await getSharedOrchestrationCaches();
3499
3569
  const realDeps = createIdleKillRealDeps(
3500
3570
  getClient,
@@ -3563,7 +3633,7 @@ function startConsolidation() {
3563
3633
  `);
3564
3634
  }
3565
3635
  try {
3566
- const { createBackupAsync, enforceRetention } = await import("../db-backup-T4OALIZH.js");
3636
+ const { createBackupAsync, enforceRetention } = await import("../db-backup-VUGFTPJ4.js");
3567
3637
  const p = await createBackupAsync("pre-consolidation");
3568
3638
  if (p) enforceRetention("pre-consolidation");
3569
3639
  } catch (e) {
@@ -3747,7 +3817,7 @@ function startSkillRefinement() {
3747
3817
  if (!shouldRunHeavyJob("skill_refinement")) return;
3748
3818
  try {
3749
3819
  if (!await ensureStoreForPolling()) return;
3750
- const { runSkillRefinement } = await import("../skill-refinement-RYBLDKDP.js");
3820
+ const { runSkillRefinement } = await import("../skill-refinement-G2CCY3GM.js");
3751
3821
  const result = await runSkillRefinement();
3752
3822
  if (result.reviewed > 0) {
3753
3823
  acted("skill_refinement");
@@ -3773,7 +3843,7 @@ function startStaleBranchSweep() {
3773
3843
  const tick = async () => {
3774
3844
  fired("stale_branch_sweep");
3775
3845
  try {
3776
- const { discoverRepoPaths } = await import("../worktree-sweep-M64OW2MU.js");
3846
+ const { discoverRepoPaths } = await import("../worktree-sweep-C3ELFGDN.js");
3777
3847
  const { scanUnmergedBranches } = await import("../branch-hygiene-55TKIWAZ.js");
3778
3848
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
3779
3849
  for (const k of _staleBranchAlertedToday) {
@@ -3800,7 +3870,7 @@ function startStaleBranchSweep() {
3800
3870
  if (!_storeInitialized) continue;
3801
3871
  const stale = scan.branches.filter((b) => b.ageHours >= STALE_BRANCH_HOURS).slice(0, 5).map((b) => `${b.name} (+${b.ahead} commits, ${(b.ageHours / 24).toFixed(1)}d)`).join("; ");
3802
3872
  try {
3803
- const { writeNotification } = await import("../notifications-B2YCZD3T.js");
3873
+ const { writeNotification } = await import("../notifications-JFR3G42W.js");
3804
3874
  await writeNotification({
3805
3875
  agentId: "exe",
3806
3876
  agentRole: "system",
@@ -4235,7 +4305,7 @@ function startReflectionSweep() {
4235
4305
  );
4236
4306
  let runReflection;
4237
4307
  try {
4238
- ({ runReflection } = await import("../memory-reflection-35NUYL3Z.js"));
4308
+ ({ runReflection } = await import("../memory-reflection-SHHDQNOH.js"));
4239
4309
  } catch (importErr) {
4240
4310
  _reflectionImportFailed = true;
4241
4311
  process.stderr.write(`[exed] Reflection module unavailable (stale chunk hash?) \u2014 disabled until daemon restart: ${importErr instanceof Error ? importErr.message : String(importErr)}
@@ -4274,7 +4344,7 @@ function startReflectionSweep() {
4274
4344
  if (memories > 100 && cards < memories * 0.1) {
4275
4345
  process.stderr.write(`[exed] Memory cards sparse (${cards} cards / ${memories} memories) \u2014 running backfill...
4276
4346
  `);
4277
- const { insertMemoryCardsForBatch } = await import("../memory-cards-EIA3YLFA.js");
4347
+ const { insertMemoryCardsForBatch } = await import("../memory-cards-4RVDZIY2.js");
4278
4348
  const batchSize = 500;
4279
4349
  let offset = 0;
4280
4350
  let totalCards = 0;
@@ -4319,7 +4389,7 @@ function startDatabaseBackup() {
4319
4389
  fired("db_backup");
4320
4390
  if (!shouldRunHeavyJob("db_backup")) return;
4321
4391
  try {
4322
- const { createBackupAsync, enforceRetention, hasBackupToday } = await import("../db-backup-T4OALIZH.js");
4392
+ const { createBackupAsync, enforceRetention, hasBackupToday } = await import("../db-backup-VUGFTPJ4.js");
4323
4393
  if (hasBackupToday("daily")) return;
4324
4394
  const backupPath = await createBackupAsync("daily");
4325
4395
  if (backupPath) {
@@ -4428,7 +4498,7 @@ function startOrphanReaper() {
4428
4498
  const tick = async () => traceDaemonTimer("orphan_reaper", async () => {
4429
4499
  fired("orphan_reaper");
4430
4500
  try {
4431
- const { reapOrphanedMcpProcesses, createOrphanReaperRealDeps } = await import("../daemon-orchestration-EEPWOFMX.js");
4501
+ const { reapOrphanedMcpProcesses, createOrphanReaperRealDeps } = await import("../daemon-orchestration-2VNLZVTW.js");
4432
4502
  const deps = createOrphanReaperRealDeps();
4433
4503
  const reaped = await reapOrphanedMcpProcesses(deps);
4434
4504
  if (reaped.length > 0) acted("orphan_reaper");
@@ -4438,10 +4508,8 @@ function startOrphanReaper() {
4438
4508
  }
4439
4509
  } catch (err) {
4440
4510
  const msg = err instanceof Error ? err.message : String(err);
4441
- if (!msg.includes("ENOBUFS")) {
4442
- process.stderr.write(`[exed] Orphan reaper error: ${msg}
4511
+ process.stderr.write(`[exed] Orphan reaper error (continuing): ${msg}
4443
4512
  `);
4444
- }
4445
4513
  }
4446
4514
  await yieldToEventLoop();
4447
4515
  });
@@ -4455,7 +4523,7 @@ function startZombieAgentReaper() {
4455
4523
  const tick = async () => traceDaemonTimer("zombie_agent_reaper", async () => {
4456
4524
  fired("zombie_agent_reaper");
4457
4525
  try {
4458
- const { reapZombieAgentProcesses, createZombieAgentReaperRealDeps } = await import("../daemon-orchestration-EEPWOFMX.js");
4526
+ const { reapZombieAgentProcesses, createZombieAgentReaperRealDeps } = await import("../daemon-orchestration-2VNLZVTW.js");
4459
4527
  const deps = createZombieAgentReaperRealDeps();
4460
4528
  const reaped = reapZombieAgentProcesses(deps);
4461
4529
  if (reaped.length > 0) acted("zombie_agent_reaper");
@@ -4465,10 +4533,8 @@ function startZombieAgentReaper() {
4465
4533
  }
4466
4534
  } catch (err) {
4467
4535
  const msg = err instanceof Error ? err.message : String(err);
4468
- if (!msg.includes("ENOBUFS")) {
4469
- process.stderr.write(`[exed] Zombie agent reaper error: ${msg}
4536
+ process.stderr.write(`[exed] Zombie agent reaper error (continuing): ${msg}
4470
4537
  `);
4471
- }
4472
4538
  }
4473
4539
  await yieldToEventLoop();
4474
4540
  });
@@ -4481,7 +4547,7 @@ function startWorktreeReaper() {
4481
4547
  const tick = async () => traceDaemonTimer("worktree_reaper", async () => {
4482
4548
  fired("worktree_reaper");
4483
4549
  try {
4484
- const { reapOrphanedWorktrees, createWorktreeReaperRealDeps } = await import("../daemon-orchestration-EEPWOFMX.js");
4550
+ const { reapOrphanedWorktrees, createWorktreeReaperRealDeps } = await import("../daemon-orchestration-2VNLZVTW.js");
4485
4551
  const deps = await createWorktreeReaperRealDeps();
4486
4552
  const result = await reapOrphanedWorktrees(deps);
4487
4553
  if (result.pruned.length > 0) {
@@ -4521,8 +4587,8 @@ function startWorktreeReaper() {
4521
4587
  }
4522
4588
  continue;
4523
4589
  }
4524
- const { cleanupAgentWorktree } = await import("../worktree-sweep-M64OW2MU.js");
4525
- const { getMainRepoRoot } = await import("../worktree-OJMZ4RG4.js");
4590
+ const { cleanupAgentWorktree } = await import("../worktree-sweep-C3ELFGDN.js");
4591
+ const { getMainRepoRoot } = await import("../worktree-7YKKJIYR.js");
4526
4592
  const repoRoot = getMainRepoRoot(signal.worktreePath);
4527
4593
  if (repoRoot && signal.agentId) {
4528
4594
  const notes = cleanupAgentWorktree(repoRoot, signal.agentId);
@@ -4558,7 +4624,7 @@ function startWalCheckpoint() {
4558
4624
  const client = getClient();
4559
4625
  const started = Date.now();
4560
4626
  await client.execute("PRAGMA wal_checkpoint(PASSIVE)");
4561
- const { findActiveDb } = await import("../db-backup-T4OALIZH.js");
4627
+ const { findActiveDb } = await import("../db-backup-VUGFTPJ4.js");
4562
4628
  const dbPath = findActiveDb();
4563
4629
  if (dbPath) {
4564
4630
  const { checkpointWalIfLarge } = await import("./database.js");
@@ -4585,7 +4651,7 @@ function startStuckTaskRelease() {
4585
4651
  if (!await ensureStoreForPolling()) return;
4586
4652
  try {
4587
4653
  const { getClient } = await import("./database.js");
4588
- const { releaseStuckTasks, createStuckTaskRealDeps } = await import("../daemon-orchestration-EEPWOFMX.js");
4654
+ const { releaseStuckTasks, createStuckTaskRealDeps } = await import("../daemon-orchestration-2VNLZVTW.js");
4589
4655
  const deps = createStuckTaskRealDeps(getClient);
4590
4656
  const released = await releaseStuckTasks(deps);
4591
4657
  if (released.length > 0) {
@@ -4689,12 +4755,12 @@ function startTaskEnforcementScanner() {
4689
4755
  const tick = async () => traceDaemonTimer("task_enforcement", async () => {
4690
4756
  fired("task_enforcement");
4691
4757
  try {
4692
- const { runTaskEnforcementTick } = await import("../task-enforcement-NL6WPS3T.js");
4758
+ const { runTaskEnforcementTick } = await import("../task-enforcement-YN6HK7NE.js");
4693
4759
  const { getTransport } = await import("./transport.js");
4694
4760
  const { loadAgentConfig } = await import("./agent-config.js");
4695
4761
  const { getClient } = await import("./database.js");
4696
4762
  const { loadEmployeesSync } = await import("./employees.js");
4697
- const { sessionScopeFilter } = await import("../task-scope-BR4ZJLQT.js");
4763
+ const { sessionScopeFilter } = await import("../task-scope-CVK6ISCZ.js");
4698
4764
  const transport = getTransport();
4699
4765
  const { sessions: allSessions, paneCache, aliveSessions } = await getSharedOrchestrationCaches();
4700
4766
  await yieldToEventLoop();
@@ -4705,10 +4771,10 @@ function startTaskEnforcementScanner() {
4705
4771
  sendKeysLiteral: transport.sendKeysLiteral?.bind(transport),
4706
4772
  isAlive: (session) => aliveSessions.has(session)
4707
4773
  };
4708
- const { checkAutoWakeGates } = await import("../daemon-orchestration-EEPWOFMX.js");
4774
+ const { checkAutoWakeGates } = await import("../daemon-orchestration-2VNLZVTW.js");
4709
4775
  const { ensureEmployeeAsync, employeeSessionName } = await import("./tmux-routing.js");
4710
4776
  const { shouldAutoInstance } = await import("./employees.js");
4711
- const { recordOrchestrationEventBestEffort } = await import("../orchestration-events-VJTAOA2R.js");
4777
+ const { recordOrchestrationEventBestEffort } = await import("../orchestration-events-MGCGPTDN.js");
4712
4778
  const projectDir = process.cwd();
4713
4779
  await runTaskEnforcementTick({
4714
4780
  transport: enforcementTransport,
@@ -5300,7 +5366,7 @@ if (process.platform === "darwin") {
5300
5366
  logBoot({ socketPath: SOCKET_PATH, pidPath: PID_PATH });
5301
5367
  void (async () => {
5302
5368
  try {
5303
- const { cleanupCrashDebris } = await import("../db-backup-T4OALIZH.js");
5369
+ const { cleanupCrashDebris } = await import("../db-backup-VUGFTPJ4.js");
5304
5370
  const removed = cleanupCrashDebris();
5305
5371
  if (removed > 0) {
5306
5372
  process.stderr.write(`[exed] Startup cleanup: pruned ${removed} crash-debris file(s) (backups/quarantine).
@@ -5465,7 +5531,7 @@ function startEventLoopLagDetector() {
5465
5531
  const msg = `[exed] EVENT LOOP BLOCKED ${(lag / 1e3).toFixed(1)}s \u2014 MCP UNRESPONSIVE. Sessions will die.`;
5466
5532
  process.stderr.write(msg + "\n");
5467
5533
  logDaemonHealth({ event: "event_loop_blocked", pid: process.pid, message: msg, data: { lagMs: lag } });
5468
- void import("../orchestration-events-VJTAOA2R.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
5534
+ void import("../orchestration-events-MGCGPTDN.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
5469
5535
  recordOE({ eventType: "daemon.event_loop_blocked", source: "exe-daemon.lagDetector", severity: "error", durationMs: lag });
5470
5536
  }).catch(() => {
5471
5537
  });
@@ -5571,7 +5637,7 @@ function startTaskFileResync() {
5571
5637
  });
5572
5638
  if (Number(res.rowsAffected ?? 0) > 0) {
5573
5639
  synced++;
5574
- void import("../orchestration-events-VJTAOA2R.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
5640
+ void import("../orchestration-events-MGCGPTDN.js").then(({ recordOrchestrationEventBestEffort: recordOE }) => {
5575
5641
  recordOE({
5576
5642
  eventType: "task_file.resynced",
5577
5643
  source: "exe-daemon.taskFileResync",
@@ -5607,7 +5673,7 @@ function startTaskGroupBarriers() {
5607
5673
  fired("task_group_barriers");
5608
5674
  if (!await ensureStoreForPolling()) return;
5609
5675
  try {
5610
- const { pollTaskGroupBarriers } = await import("../daemon-orchestration-EEPWOFMX.js");
5676
+ const { pollTaskGroupBarriers } = await import("../daemon-orchestration-2VNLZVTW.js");
5611
5677
  const firedCount = await pollTaskGroupBarriers();
5612
5678
  if (firedCount > 0) {
5613
5679
  acted("task_group_barriers");
@@ -5629,7 +5695,7 @@ function startCheckpointGc() {
5629
5695
  fired("checkpoint_gc");
5630
5696
  if (!await ensureStoreForPolling()) return;
5631
5697
  try {
5632
- const { gcStaleCheckpoints } = await import("../daemon-orchestration-EEPWOFMX.js");
5698
+ const { gcStaleCheckpoints } = await import("../daemon-orchestration-2VNLZVTW.js");
5633
5699
  const cleared = await gcStaleCheckpoints();
5634
5700
  if (cleared > 0) {
5635
5701
  acted("checkpoint_gc");
@@ -5668,14 +5734,14 @@ function startDispatchAckCleanup() {
5668
5734
  function startProjectionWorkerDeferred() {
5669
5735
  setTimeout(async () => {
5670
5736
  try {
5671
- const { startProjectionWorker } = await import("../projection-worker-XVOLBYQC.js");
5737
+ const { startProjectionWorker } = await import("../projection-worker-MTPAPCWX.js");
5672
5738
  startProjectionWorker();
5673
5739
  } catch {
5674
5740
  }
5675
5741
  }, 2e4);
5676
5742
  }
5677
5743
  async function startToolTelemetry() {
5678
- const { startToolTelemetryFlush } = await import("../tool-telemetry-4YD2E6UU.js");
5744
+ const { startToolTelemetryFlush } = await import("../tool-telemetry-J3NLS3LJ.js");
5679
5745
  startToolTelemetryFlush();
5680
5746
  process.stderr.write("[exed] Tool telemetry started (flush every 5m)\n");
5681
5747
  }
@@ -5719,11 +5785,20 @@ function startLocalFirstTimers() {
5719
5785
  startCheckpointGc();
5720
5786
  setTimeout(startCloudSyncTimer, 25e3);
5721
5787
  setTimeout(startAgentStats, 3e4);
5722
- setTimeout(() => void traceDaemonTimer("session_registry_consistency", async () => {
5788
+ const runSessionRegistryMaintenance = () => void traceDaemonTimer("session_registry_consistency", async () => {
5723
5789
  fired("session_registry_consistency");
5724
5790
  try {
5725
- const { checkSessionRegistryConsistency } = await import("./session-registry.js");
5726
- const result = checkSessionRegistryConsistency(await getTmuxSessionsAsync());
5791
+ const liveTmux = await getTmuxSessionsAsync();
5792
+ const { cleanupDeadSessions, checkSessionRegistryConsistency } = await import("./session-registry.js");
5793
+ const cleaned = cleanupDeadSessions(liveTmux);
5794
+ if (cleaned.pruned > 0) {
5795
+ acted("session_registry_consistency");
5796
+ process.stderr.write(
5797
+ `[exed] Session registry reaped ${cleaned.pruned} ghost session(s) (dead PID + absent tmux): ${cleaned.removed.slice(0, 10).join(", ")}
5798
+ `
5799
+ );
5800
+ }
5801
+ const result = checkSessionRegistryConsistency(liveTmux);
5727
5802
  if (result.missingTmux > 0 || result.missingRegistry > 0) {
5728
5803
  acted("session_registry_consistency");
5729
5804
  process.stderr.write(
@@ -5735,7 +5810,11 @@ function startLocalFirstTimers() {
5735
5810
  process.stderr.write(`[exed] Session registry consistency error: ${err instanceof Error ? err.message : String(err)}
5736
5811
  `);
5737
5812
  }
5738
- }), 35e3);
5813
+ });
5814
+ setTimeout(() => {
5815
+ runSessionRegistryMaintenance();
5816
+ setInterval(runSessionRegistryMaintenance, SESSION_REGISTRY_MAINTENANCE_INTERVAL_MS);
5817
+ }, 35e3);
5739
5818
  setTimeout(() => void traceDaemonTimer("consolidation_start", () => startConsolidation()), 6e4);
5740
5819
  setTimeout(startSkillSweep, 9e4);
5741
5820
  setTimeout(startSkillRefinement, 18e4);
@@ -5802,7 +5881,7 @@ function startLocalFirstTimers() {
5802
5881
  fired("orphan_task_cleanup");
5803
5882
  try {
5804
5883
  if (!await ensureStoreForPolling()) return;
5805
- const { cleanOrphanedTaskFiles, checkTaskFileConsistency } = await import("../tasks-crud-LWTHIDHF.js");
5884
+ const { cleanOrphanedTaskFiles, checkTaskFileConsistency } = await import("../tasks-crud-NTNET4JE.js");
5806
5885
  const count = await cleanOrphanedTaskFiles();
5807
5886
  if (count > 0) {
5808
5887
  acted("orphan_task_cleanup");
@@ -5825,7 +5904,7 @@ function startLocalFirstTimers() {
5825
5904
  const TELEMETRY_DAILY_MS = 24 * 60 * 60 * 1e3;
5826
5905
  const telemetryDaily = async () => {
5827
5906
  try {
5828
- const { sendTelemetry, isTelemetryEnabled } = await import("../telemetry-upload-PQLC5A4D.js");
5907
+ const { sendTelemetry, isTelemetryEnabled } = await import("../telemetry-upload-5PNUKGTM.js");
5829
5908
  if (!isTelemetryEnabled()) return;
5830
5909
  const { upstream } = await sendTelemetry(24);
5831
5910
  if (upstream.startsWith("sent")) {
@@ -5947,6 +6026,7 @@ try {
5947
6026
  initMetrics();
5948
6027
  startServer();
5949
6028
  await _mcpHttpReady;
6029
+ checkLaunchdPlistHealth();
5950
6030
  loadModel().catch((err) => {
5951
6031
  process.stderr.write(
5952
6032
  `[exed] Background model load failed: ${err instanceof Error ? err.message : String(err)}
@@ -5977,6 +6057,7 @@ try {
5977
6057
  process.exit(1);
5978
6058
  }
5979
6059
  export {
6060
+ decidePortHolderAction,
5980
6061
  injectRegisterAllTools,
5981
6062
  isCrashLoopBreakerActive,
5982
6063
  recordDaemonCrash,
@@ -5,17 +5,17 @@ import {
5
5
  recentRecords,
6
6
  rrfMerge,
7
7
  rrfMergeMulti
8
- } from "../chunk-CZYJEUNA.js";
8
+ } from "../chunk-N2EAYPYQ.js";
9
9
  import "../chunk-AB4PAQYK.js";
10
- import "../chunk-EM5WXY6H.js";
10
+ import "../chunk-VRRAE5JX.js";
11
11
  import "../chunk-CHCA3ZM2.js";
12
12
  import "../chunk-OTVEIJUQ.js";
13
- import "../chunk-DQBHY3Q4.js";
13
+ import "../chunk-C2SBESBO.js";
14
14
  import "../chunk-Y25OJWOQ.js";
15
15
  import "../chunk-MP2AFCGL.js";
16
- import "../chunk-TM2GZWIT.js";
16
+ import "../chunk-WUKHLCBE.js";
17
17
  import "../chunk-2I23RPSI.js";
18
- import "../chunk-D3X64YSB.js";
18
+ import "../chunk-2E43UXRH.js";
19
19
  import "../chunk-PNQDP3OA.js";
20
20
  import "../chunk-7HLWBYH7.js";
21
21
  import "../chunk-FXU7JOXK.js";
@@ -4,9 +4,9 @@ import {
4
4
  identityPath,
5
5
  listIdentities,
6
6
  updateIdentity
7
- } from "../chunk-TM2GZWIT.js";
7
+ } from "../chunk-WUKHLCBE.js";
8
8
  import "../chunk-2I23RPSI.js";
9
- import "../chunk-D3X64YSB.js";
9
+ import "../chunk-2E43UXRH.js";
10
10
  import "../chunk-PNQDP3OA.js";
11
11
  import "../chunk-7HLWBYH7.js";
12
12
  import "../chunk-FXU7JOXK.js";