@askexenow/exe-os 0.9.127 → 0.9.129

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 (373) hide show
  1. package/dist/active-agent-3FDJYREJ.js +22 -0
  2. package/dist/active-agent-WC7YK3L5.js +23 -0
  3. package/dist/agent-context-CDWUZEXY.js +11 -0
  4. package/dist/agent-loop-G4VUR5ME.js +10 -0
  5. package/dist/agentic-ontology-2VYNTMNO.js +25 -0
  6. package/dist/backfill-metadata-OJWOCLSZ.js +601 -0
  7. package/dist/background-jobs-LGRDXGXC.js +25 -0
  8. package/dist/bash-Y5PEW5UQ.js +8 -0
  9. package/dist/behaviors-CSB2YLDT.js +22 -0
  10. package/dist/bin/age-ontology-load.js +10 -258
  11. package/dist/bin/agentic-ontology-backfill.js +23 -5296
  12. package/dist/bin/agentic-reflection-backfill.js +19 -4739
  13. package/dist/bin/agentic-semantic-label.js +28 -4723
  14. package/dist/bin/backfill-conversations.js +42 -5543
  15. package/dist/bin/backfill-responses.js +41 -5542
  16. package/dist/bin/backfill-vectors.js +43 -4795
  17. package/dist/bin/bulk-sync-postgres.js +22 -5313
  18. package/dist/bin/cc-doctor.js +10 -602
  19. package/dist/bin/cleanup-stale-review-tasks.js +32 -6803
  20. package/dist/bin/cli.js +169 -38993
  21. package/dist/bin/exe-agent-config.js +21 -253
  22. package/dist/bin/exe-agent.js +63 -2429
  23. package/dist/bin/exe-assign.js +34 -5810
  24. package/dist/bin/exe-boot.js +180 -12726
  25. package/dist/bin/exe-call.js +48 -1409
  26. package/dist/bin/exe-cloud.js +64 -8516
  27. package/dist/bin/exe-dispatch.js +35 -10818
  28. package/dist/bin/exe-doctor.js +24 -7537
  29. package/dist/bin/exe-export-behaviors.js +18 -6122
  30. package/dist/bin/exe-forget.js +22 -6274
  31. package/dist/bin/exe-gateway.js +62 -15286
  32. package/dist/bin/exe-healthcheck.js +9 -602
  33. package/dist/bin/exe-heartbeat.js +51 -6898
  34. package/dist/bin/exe-kill.js +30 -5961
  35. package/dist/bin/exe-launch-agent.js +101 -6788
  36. package/dist/bin/exe-new-employee.js +42 -3774
  37. package/dist/bin/exe-pending-messages.js +28 -6833
  38. package/dist/bin/exe-pending-notifications.js +31 -6869
  39. package/dist/bin/exe-pending-reviews.js +38 -6910
  40. package/dist/bin/exe-rename.js +57 -5766
  41. package/dist/bin/exe-review.js +29 -5948
  42. package/dist/bin/exe-search.js +22 -7692
  43. package/dist/bin/exe-session-cleanup.js +52 -11147
  44. package/dist/bin/exe-settings.js +35 -524
  45. package/dist/bin/exe-start-codex.js +70 -6641
  46. package/dist/bin/exe-start-opencode.js +54 -6584
  47. package/dist/bin/exe-status.js +26 -7081
  48. package/dist/bin/exe-support.js +10 -546
  49. package/dist/bin/exe-team.js +18 -5942
  50. package/dist/bin/git-sweep.js +26 -10909
  51. package/dist/bin/graph-backfill.js +24 -5979
  52. package/dist/bin/graph-export.js +31 -6128
  53. package/dist/bin/graph-layer-benchmark.js +4 -8
  54. package/dist/bin/install.js +47 -2322
  55. package/dist/bin/intercom-check.js +25 -11501
  56. package/dist/bin/list-providers.js +4 -18
  57. package/dist/bin/postgres-agentic-reflection-backfill.js +14 -357
  58. package/dist/bin/postgres-agentic-semantic-backfill.js +14 -404
  59. package/dist/bin/pre-publish.js +4 -298
  60. package/dist/bin/registry-proxy.js +8 -172
  61. package/dist/bin/scan-tasks.js +47 -10881
  62. package/dist/bin/setup.js +6 -9492
  63. package/dist/bin/shard-migrate.js +30 -5149
  64. package/dist/bin/stack-update.js +75 -203
  65. package/dist/bin/update.js +20 -654
  66. package/dist/capacity-monitor-3GZIHLB4.js +46 -0
  67. package/dist/catchup-brief-67QDCINS.js +148 -0
  68. package/dist/chunk-2QD7KBJN.js +664 -0
  69. package/dist/chunk-2WGSIVI4.js +149 -0
  70. package/dist/chunk-35TVNLJI.js +57 -0
  71. package/dist/chunk-3SYV36U5.js +47 -0
  72. package/dist/chunk-46SQTBQW.js +207 -0
  73. package/dist/chunk-4CMVLKEI.js +171 -0
  74. package/dist/chunk-4FLUOZTR.js +116 -0
  75. package/dist/chunk-4NYQAS33.js +17 -0
  76. package/dist/chunk-4QNPADWL.js +902 -0
  77. package/dist/chunk-4Y6QZBEO.js +58 -0
  78. package/dist/chunk-557C2IGL.js +0 -0
  79. package/dist/chunk-55S56YDO.js +305 -0
  80. package/dist/chunk-5BS5ELMC.js +85 -0
  81. package/dist/chunk-5DHM77JE.js +256 -0
  82. package/dist/chunk-5QTWQKNF.js +137 -0
  83. package/dist/chunk-6A7P74QV.js +53 -0
  84. package/dist/chunk-6BFIFI5F.js +45 -0
  85. package/dist/chunk-6KFICEAT.js +20 -0
  86. package/dist/chunk-6LKDJ5WX.js +317 -0
  87. package/dist/chunk-6M5II4EV.js +148 -0
  88. package/dist/chunk-6QEFN3DV.js +302 -0
  89. package/dist/chunk-6WTMJAG3.js +171 -0
  90. package/dist/chunk-6Y4B3QF6.js +19 -0
  91. package/dist/chunk-7RK3AYJE.js +163 -0
  92. package/dist/chunk-7TCP2XTP.js +390 -0
  93. package/dist/chunk-A2NZP64U.js +2307 -0
  94. package/dist/chunk-AFYIYM2K.js +322 -0
  95. package/dist/chunk-AJWFPKQS.js +573 -0
  96. package/dist/chunk-AVE2B4DQ.js +140 -0
  97. package/dist/chunk-B4TT2QQA.js +87 -0
  98. package/dist/chunk-BCMOO4OQ.js +1066 -0
  99. package/dist/chunk-BU3ID2WT.js +432 -0
  100. package/dist/chunk-CFIM43JH.js +862 -0
  101. package/dist/chunk-CURJUF3W.js +66 -0
  102. package/dist/chunk-DC4ZD76Y.js +288 -0
  103. package/dist/chunk-DL52JPGF.js +706 -0
  104. package/dist/chunk-DRSC6ZRA.js +36 -0
  105. package/dist/chunk-E2Q4Y22A.js +86 -0
  106. package/dist/chunk-ECGTESAP.js +236 -0
  107. package/dist/chunk-EHOJUXYG.js +365 -0
  108. package/dist/chunk-EIT6J37V.js +119 -0
  109. package/dist/chunk-ELE2C7L4.js +31 -0
  110. package/dist/chunk-EQSQ4HBW.js +9 -0
  111. package/dist/chunk-FWFFZGSC.js +94 -0
  112. package/dist/chunk-GCNWCYJI.js +249 -0
  113. package/dist/chunk-GGTUUI7J.js +6 -0
  114. package/dist/chunk-GU56L7OY.js +223 -0
  115. package/dist/chunk-HF25XPZE.js +83 -0
  116. package/dist/chunk-HOKOOBDL.js +52 -0
  117. package/dist/chunk-HP43GLZ6.js +89 -0
  118. package/dist/chunk-HSRM6PNM.js +682 -0
  119. package/dist/chunk-HVRTW3OP.js +164 -0
  120. package/dist/chunk-IHDHL5ML.js +125 -0
  121. package/dist/chunk-IHF5RXJM.js +168 -0
  122. package/dist/chunk-IJ73YE73.js +409 -0
  123. package/dist/chunk-INO4ZD5Y.js +162 -0
  124. package/dist/chunk-IRQTM7DY.js +475 -0
  125. package/dist/chunk-JD4FAPYG.js +1208 -0
  126. package/dist/chunk-JN44LQ53.js +316 -0
  127. package/dist/chunk-JQ6TLNIV.js +133 -0
  128. package/dist/chunk-JT76KRZQ.js +35 -0
  129. package/dist/chunk-K6OEWZTB.js +262 -0
  130. package/dist/chunk-KCUYRZSX.js +72 -0
  131. package/dist/chunk-KFQGP6VL.js +33 -0
  132. package/dist/chunk-KRLOFIPI.js +83 -0
  133. package/dist/chunk-KVPG5UT6.js +305 -0
  134. package/dist/chunk-L3TB7CC3.js +170 -0
  135. package/dist/chunk-L4X5EUHR.js +283 -0
  136. package/dist/chunk-LAN26C3W.js +655 -0
  137. package/dist/chunk-LPGBKR4H.js +54 -0
  138. package/dist/chunk-LVNMOVGD.js +132 -0
  139. package/dist/chunk-LX5WEEZ7.js +157 -0
  140. package/dist/chunk-MBH42QNH.js +295 -0
  141. package/dist/chunk-MFO7MNSD.js +102 -0
  142. package/dist/chunk-MILTNDZH.js +736 -0
  143. package/dist/chunk-MJAE4NB7.js +1090 -0
  144. package/dist/chunk-MLCUPTP7.js +132 -0
  145. package/dist/chunk-MPURH6JI.js +445 -0
  146. package/dist/chunk-MVBWW2EO.js +89 -0
  147. package/dist/chunk-MZIGUUDQ.js +42 -0
  148. package/dist/chunk-N3DTSVKE.js +157 -0
  149. package/dist/chunk-N5RRQOAC.js +134 -0
  150. package/dist/chunk-N7L33TED.js +1664 -0
  151. package/dist/chunk-NDYSNVI5.js +122 -0
  152. package/dist/chunk-NEAHEC5G.js +155 -0
  153. package/dist/chunk-NGVOA6ZQ.js +84 -0
  154. package/dist/chunk-NHK5KW6Y.js +193 -0
  155. package/dist/chunk-NMQKGFEP.js +458 -0
  156. package/dist/chunk-NPT4EHZK.js +352 -0
  157. package/dist/chunk-NXFJHTED.js +55 -0
  158. package/dist/chunk-NZLCDI6Y.js +216 -0
  159. package/dist/chunk-O377P7GM.js +100 -0
  160. package/dist/chunk-O4VFZRA5.js +33 -0
  161. package/dist/chunk-O7YD7JYE.js +237 -0
  162. package/dist/chunk-OFK72LTZ.js +81 -0
  163. package/dist/chunk-ORCCI2VV.js +140 -0
  164. package/dist/chunk-OVQR4KMC.js +579 -0
  165. package/dist/chunk-P3CVUMEH.js +54 -0
  166. package/dist/chunk-P4HIF72O.js +30 -0
  167. package/dist/chunk-PEDLSJBL.js +1039 -0
  168. package/dist/chunk-PFICKZZ5.js +219 -0
  169. package/dist/chunk-PGW7TIV6.js +142 -0
  170. package/dist/chunk-PJHHFJAN.js +63 -0
  171. package/dist/chunk-PP4SNOJ5.js +471 -0
  172. package/dist/chunk-PRKVT4KN.js +90 -0
  173. package/dist/chunk-Q2O4VJHH.js +305 -0
  174. package/dist/chunk-Q36CMZIX.js +38 -0
  175. package/dist/chunk-Q3V7K4ME.js +149 -0
  176. package/dist/chunk-QGYPJGHB.js +81 -0
  177. package/dist/chunk-R23EMFJV.js +198 -0
  178. package/dist/chunk-R4M6XCMU.js +39 -0
  179. package/dist/chunk-R4WMF32C.js +81 -0
  180. package/dist/chunk-RJT7H2KR.js +349 -0
  181. package/dist/chunk-RJZMRZNV.js +280 -0
  182. package/dist/chunk-RMFDPCA2.js +72 -0
  183. package/dist/chunk-RUG3N6P4.js +292 -0
  184. package/dist/chunk-RWO327FJ.js +84 -0
  185. package/dist/chunk-SG7EFHQ7.js +108 -0
  186. package/dist/chunk-SH45SJQW.js +0 -0
  187. package/dist/chunk-SPKE5ANC.js +42 -0
  188. package/dist/chunk-SVMFVPBF.js +104 -0
  189. package/dist/chunk-SVXDCELZ.js +163 -0
  190. package/dist/chunk-TMEE7AT7.js +72 -0
  191. package/dist/chunk-TWYEE4FB.js +125 -0
  192. package/dist/chunk-TYLF4LSW.js +110 -0
  193. package/dist/chunk-V4TZI6EO.js +60 -0
  194. package/dist/chunk-VFZTXKQI.js +372 -0
  195. package/dist/chunk-VQ4K2MLM.js +199 -0
  196. package/dist/chunk-VU447UAO.js +173 -0
  197. package/dist/chunk-WMC3TXJF.js +50 -0
  198. package/dist/chunk-WPOA7XAE.js +84 -0
  199. package/dist/chunk-WZQ4CPRG.js +64 -0
  200. package/dist/chunk-X2IMCCM5.js +49 -0
  201. package/dist/chunk-X2Z5GT3V.js +118 -0
  202. package/dist/chunk-XEKO37NM.js +43 -0
  203. package/dist/chunk-XUHFQHGZ.js +505 -0
  204. package/dist/chunk-YGAAZN3E.js +47 -0
  205. package/dist/chunk-YKOW7KMK.js +558 -0
  206. package/dist/chunk-YOQKMB6N.js +145 -0
  207. package/dist/chunk-YZFZDJWZ.js +107 -0
  208. package/dist/chunk-ZBY4AUD4.js +10342 -0
  209. package/dist/chunk-ZOJYPNCM.js +127 -0
  210. package/dist/chunk-ZS7MGQSD.js +1494 -0
  211. package/dist/chunk-ZTZQ5A6B.js +191 -0
  212. package/dist/code-context-index-HXGC4IJL.js +28 -0
  213. package/dist/content-extractor-UVZXRIPC.js +8 -0
  214. package/dist/conversation-entity-extractor-HKSNDF4L.js +113 -0
  215. package/dist/conversation-wiki-populator-NKDAQEZ5.js +105 -0
  216. package/dist/crdt-sync-T7MHVQCS.js +33 -0
  217. package/dist/crm-bridge-Q5JBVJ6P.js +19 -0
  218. package/dist/crm-webhook-OAFTLJYA.js +10 -0
  219. package/dist/cto-delegation-gate-XWHZCUJH.js +208 -0
  220. package/dist/daemon-auth-GWUXTUYO.js +15 -0
  221. package/dist/daemon-orchestration-2C3TVOHO.js +91 -0
  222. package/dist/daemon-protocol-RLH2XM2K.js +19 -0
  223. package/dist/db-backup-CH2KG3JY.js +23 -0
  224. package/dist/devtools-PLJCAU53.js +8 -0
  225. package/dist/discord-G4BQJ2VX.js +7 -0
  226. package/dist/email-XMRNMFXR.js +137 -0
  227. package/dist/entity-boost-IOER4VRR.js +249 -0
  228. package/dist/exe-drift-2IJFQV43.js +68 -0
  229. package/dist/exe-export-Y2RFXGNB.js +71 -0
  230. package/dist/exe-import-LN6PE2YT.js +74 -0
  231. package/dist/exe-key-DHKBWLIT.js +571 -0
  232. package/dist/exe-org-F7LZRHFB.js +73 -0
  233. package/dist/factory-YTD23AW7.js +67 -0
  234. package/dist/fast-db-init-IIP6EGWT.js +7 -0
  235. package/dist/file-edit-FJVEO7XZ.js +8 -0
  236. package/dist/file-read-Q2NH3J35.js +8 -0
  237. package/dist/file-write-UNSFXNH4.js +8 -0
  238. package/dist/gateway/index.js +87 -16563
  239. package/dist/gateway-client-APTYJNCL.js +11 -0
  240. package/dist/git-staleness-I2BUEDE2.js +111 -0
  241. package/dist/git-task-sweep-UEOTXRW4.js +35 -0
  242. package/dist/glob-GRMXLDMB.js +7 -0
  243. package/dist/global-procedures-MFE5LGRF.js +19 -0
  244. package/dist/graph-query-657O5JYJ.js +25 -0
  245. package/dist/graph-rag-ZE5N7C65.js +28 -0
  246. package/dist/grep-NBV6SKYZ.js +7 -0
  247. package/dist/hooks/bug-report-worker.js +41 -10823
  248. package/dist/hooks/codex-stop-task-finalizer.js +38 -9055
  249. package/dist/hooks/commit-complete.js +32 -10914
  250. package/dist/hooks/error-recall.js +35 -7955
  251. package/dist/hooks/exe-heartbeat-hook.js +17 -327
  252. package/dist/hooks/ingest-worker.js +16 -565
  253. package/dist/hooks/ingest.js +98 -11436
  254. package/dist/hooks/instructions-loaded.js +25 -6209
  255. package/dist/hooks/notification.js +16 -6098
  256. package/dist/hooks/post-compact.js +34 -7041
  257. package/dist/hooks/post-tool-combined.js +27 -9751
  258. package/dist/hooks/pre-compact.js +38 -11130
  259. package/dist/hooks/pre-tool-use.js +61 -7233
  260. package/dist/hooks/prompt-submit.js +113 -13358
  261. package/dist/hooks/session-end.js +57 -11503
  262. package/dist/hooks/session-start.js +46 -9423
  263. package/dist/hooks/stop.js +70 -7210
  264. package/dist/hooks/subagent-stop.js +33 -6897
  265. package/dist/hooks/summary-worker.js +86 -8629
  266. package/dist/hooks-KD3N2D7P.js +9 -0
  267. package/dist/imessage-L7WKA2WD.js +7 -0
  268. package/dist/index.js +49 -19391
  269. package/dist/installer-5N24GXFB.js +32 -0
  270. package/dist/installer-QSD76YRY.js +291 -0
  271. package/dist/installer-ZPQUKHU5.js +331 -0
  272. package/dist/intercom-queue-PEEGAJ33.js +19 -0
  273. package/dist/key-backup-status-57UB74DU.js +41 -0
  274. package/dist/lib/agent-config.js +19 -224
  275. package/dist/lib/cloud-sync.js +44 -5398
  276. package/dist/lib/cloudflare-dns.js +7 -111
  277. package/dist/lib/config.js +18 -278
  278. package/dist/lib/consolidation.js +21 -1047
  279. package/dist/lib/crypto.js +7 -45
  280. package/dist/lib/database.js +20 -2932
  281. package/dist/lib/db-daemon-client.js +24 -460
  282. package/dist/lib/db.js +22 -2932
  283. package/dist/lib/device-registry.js +20 -2992
  284. package/dist/lib/embedder.js +14 -822
  285. package/dist/lib/employee-templates.js +21 -1102
  286. package/dist/lib/employees.js +30 -497
  287. package/dist/lib/error-detector.js +9 -149
  288. package/dist/lib/exe-daemon-client.js +16 -570
  289. package/dist/lib/exe-daemon.js +509 -18398
  290. package/dist/lib/file-grep.js +2 -0
  291. package/dist/lib/hybrid-search.js +18 -7674
  292. package/dist/lib/identity-templates.js +2 -0
  293. package/dist/lib/identity.js +13 -309
  294. package/dist/lib/keychain.js +9 -499
  295. package/dist/lib/license.js +21 -549
  296. package/dist/lib/messaging.js +35 -1631
  297. package/dist/lib/post-tool-memory.js +8 -370
  298. package/dist/lib/registry-proxy.js +8 -155
  299. package/dist/lib/reminders.js +11 -231
  300. package/dist/lib/runtime-table.js +7 -20
  301. package/dist/lib/schedules.js +16 -4614
  302. package/dist/lib/session-registry.js +9 -57
  303. package/dist/lib/session-wrappers.js +3 -127
  304. package/dist/lib/skill-learning.js +20 -2101
  305. package/dist/lib/status-brief.js +4 -368
  306. package/dist/lib/store.js +25 -5593
  307. package/dist/lib/task-router.js +12 -254
  308. package/dist/lib/tasks.js +44 -5801
  309. package/dist/lib/tmux-routing.js +45 -5804
  310. package/dist/lib/tmux-status.js +16 -248
  311. package/dist/lib/tmux-transport.js +6 -90
  312. package/dist/lib/token-spend.js +9 -337
  313. package/dist/lib/transport.js +8 -134
  314. package/dist/lib/ws-auth.js +6 -14
  315. package/dist/lib/ws-client.js +4 -22
  316. package/dist/license-gate-NXXDOOAQ.js +14 -0
  317. package/dist/mcp/register-tools.js +90 -32454
  318. package/dist/mcp/server.js +139 -32625
  319. package/dist/mcp/tools/complete-reminder.js +10 -237
  320. package/dist/mcp/tools/create-reminder.js +10 -222
  321. package/dist/mcp/tools/create-task.js +28 -6730
  322. package/dist/mcp/tools/deactivate-behavior.js +13 -476
  323. package/dist/mcp/tools/list-reminders.js +10 -232
  324. package/dist/mcp/tools/list-tasks.js +28 -1571
  325. package/dist/mcp/tools/send-message.js +25 -1672
  326. package/dist/mcp/tools/update-task.js +27 -6123
  327. package/dist/mcp-diagnostics-OOZ3TDPY.js +200 -0
  328. package/dist/memory-cards-RIL5BZHK.js +175 -0
  329. package/dist/memory-queue-JYIJ7TMQ.js +13 -0
  330. package/dist/memory-queue-client-PE7757HU.js +14 -0
  331. package/dist/notifications-CJFULBMN.js +42 -0
  332. package/dist/orchestration-phase-Y2TYNW5H.js +23 -0
  333. package/dist/orchestrator-RXIPT6PZ.js +29 -0
  334. package/dist/permission-presets-WI524OSE.js +25 -0
  335. package/dist/permissions-TYT6YMNZ.js +14 -0
  336. package/dist/pg-ssl-KFHNJPGO.js +7 -0
  337. package/dist/plan-limits-5WY5YK6X.js +27 -0
  338. package/dist/preferences-MW3BYTQ5.js +10 -0
  339. package/dist/project-name-PL2ZDWNU.js +11 -0
  340. package/dist/projection-worker-OY4WYZW6.js +661 -0
  341. package/dist/reranker-LFJ73RRS.js +19 -0
  342. package/dist/review-gate-E6K7QQE5.js +120 -0
  343. package/dist/runtime/index.js +82 -13408
  344. package/dist/self-query-router-IZANO632.js +83 -0
  345. package/dist/session-events-TQ6S5KQN.js +32 -0
  346. package/dist/session-kill-telemetry-46YIJWE2.js +30 -0
  347. package/dist/session-scope-3MYK3YRV.js +34 -0
  348. package/dist/setup-wizard-ZJ7UCRBP.js +12 -0
  349. package/dist/shard-manager-RCFZ6RXY.js +29 -0
  350. package/dist/signal-XN2C7PIG.js +7 -0
  351. package/dist/slack-Z77TFJCK.js +7 -0
  352. package/dist/task-enforcement-337DZI3I.js +252 -0
  353. package/dist/task-scanner-IMIR3T7T.js +11 -0
  354. package/dist/task-scope-MUU4KXE6.js +32 -0
  355. package/dist/tasks-crud-PMLK3MM4.js +53 -0
  356. package/dist/tasks-review-56LVKKNL.js +44 -0
  357. package/dist/telegram-CRPZO7JT.js +7 -0
  358. package/dist/telemetry-SPVGPKU7.js +9 -0
  359. package/dist/tool-capability-index-XNBSDCH3.js +10 -0
  360. package/dist/tool-gates-LGH6CSY4.js +14 -0
  361. package/dist/tool-gates-W7SZCYTX.js +13 -0
  362. package/dist/tool-registry-436LVVLY.js +11 -0
  363. package/dist/tool-telemetry-L77WNAYT.js +15 -0
  364. package/dist/tui/App.js +253 -14668
  365. package/dist/tui-data-SB45REYU.js +161 -0
  366. package/dist/update-check-LZGZISRJ.js +11 -0
  367. package/dist/webhook-VVP7KQVC.js +96 -0
  368. package/dist/whatsapp-J6QNDBGY.js +9 -0
  369. package/dist/whatsapp-accounts-RTJF3LM6.js +15 -0
  370. package/dist/wiki-client-EKCIKCVC.js +136 -0
  371. package/dist/worker-gate-UYNN62GJ.js +19 -0
  372. package/dist/worktree-4T4BPWPN.js +205 -0
  373. package/package.json +1 -1
@@ -0,0 +1,1066 @@
1
+ import {
2
+ loadPreferences
3
+ } from "./chunk-SPKE5ANC.js";
4
+ import {
5
+ EXE_HOOKS,
6
+ isLegacyHomeDirHookCommand,
7
+ isLegacySplitPostToolCommand
8
+ } from "./chunk-L3TB7CC3.js";
9
+ import {
10
+ ensureAllAgentSymlinks,
11
+ init_agent_symlinks
12
+ } from "./chunk-OFK72LTZ.js";
13
+ import {
14
+ MCP_LEGACY_KEY,
15
+ MCP_PRIMARY_KEY,
16
+ init_mcp_prefix
17
+ } from "./chunk-6BFIFI5F.js";
18
+ import {
19
+ employees_exports,
20
+ init_employees
21
+ } from "./chunk-RUG3N6P4.js";
22
+ import {
23
+ __toCommonJS
24
+ } from "./chunk-KFQGP6VL.js";
25
+
26
+ // src/adapters/claude/installer.ts
27
+ init_agent_symlinks();
28
+ init_mcp_prefix();
29
+ import { readFile, writeFile, mkdir, readdir, rm } from "fs/promises";
30
+ import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2, copyFileSync, mkdirSync as mkdirSync2 } from "fs";
31
+ import { createHash } from "crypto";
32
+ import path2 from "path";
33
+ import os2 from "os";
34
+ import { execSync } from "child_process";
35
+ import { fileURLToPath } from "url";
36
+
37
+ // src/adapters/mcp-http-config.ts
38
+ import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
39
+ import { randomBytes } from "crypto";
40
+ import path from "path";
41
+ import os from "os";
42
+ var DEFAULT_MCP_HTTP_PORT = "48739";
43
+ function resolveDefaultAgentId() {
44
+ if (process.env.AGENT_ID && process.env.AGENT_ID !== "default") return process.env.AGENT_ID;
45
+ try {
46
+ const { loadEmployeesSync } = (init_employees(), __toCommonJS(employees_exports));
47
+ const coo = loadEmployeesSync().find((e) => e.role === "COO");
48
+ if (coo) return coo.name;
49
+ } catch {
50
+ }
51
+ return "exe";
52
+ }
53
+ var DEFAULT_MCP_HTTP_AGENT_ID = resolveDefaultAgentId();
54
+ var DEFAULT_MCP_HTTP_AGENT_ROLE = "COO";
55
+ function mcpHttpPort() {
56
+ return process.env.EXE_MCP_PORT || DEFAULT_MCP_HTTP_PORT;
57
+ }
58
+ function mcpHttpUrl() {
59
+ return `http://127.0.0.1:${mcpHttpPort()}/mcp`;
60
+ }
61
+ function readOrCreateDaemonToken(homeDir = os.homedir()) {
62
+ const exeDir = path.join(homeDir, ".exe-os");
63
+ const tokenPath = path.join(exeDir, "exed.token");
64
+ if (existsSync(tokenPath)) {
65
+ try {
66
+ const token2 = readFileSync(tokenPath, "utf-8").trim();
67
+ if (/^[a-f0-9]{64}$/i.test(token2)) return token2;
68
+ } catch {
69
+ }
70
+ }
71
+ const token = randomBytes(32).toString("hex");
72
+ mkdirSync(exeDir, { recursive: true });
73
+ writeFileSync(tokenPath, `${token}
74
+ `, "utf-8");
75
+ try {
76
+ chmodSync(tokenPath, 384);
77
+ } catch {
78
+ }
79
+ return token;
80
+ }
81
+ function buildMcpHttpHeaders(homeDir = os.homedir(), opts = {}) {
82
+ const agentId = opts.useShellPlaceholders ? "${AGENT_ID:-exe}" : opts.agentId ?? DEFAULT_MCP_HTTP_AGENT_ID;
83
+ const agentRole = opts.useShellPlaceholders ? "${AGENT_ROLE:-COO}" : opts.agentRole ?? DEFAULT_MCP_HTTP_AGENT_ROLE;
84
+ const sessionName = opts.useShellPlaceholders ? "" : process.env.EXE_SESSION_NAME ?? "";
85
+ const headers = {
86
+ Authorization: `Bearer ${readOrCreateDaemonToken(homeDir)}`,
87
+ "X-Agent-Id": agentId,
88
+ "X-Agent-Role": agentRole
89
+ };
90
+ if (sessionName) headers["X-Exe-Session"] = sessionName;
91
+ return headers;
92
+ }
93
+ function buildClaudeHttpMcpEntry(homeDir = os.homedir()) {
94
+ return {
95
+ type: "http",
96
+ url: mcpHttpUrl(),
97
+ headers: buildMcpHttpHeaders(homeDir, { useShellPlaceholders: true })
98
+ };
99
+ }
100
+
101
+ // src/adapters/claude/installer.ts
102
+ function resolvePackageRoot() {
103
+ const thisFile = fileURLToPath(import.meta.url);
104
+ let dir = path2.dirname(thisFile);
105
+ const root = path2.parse(dir).root;
106
+ while (dir !== root) {
107
+ const pkgPath = path2.join(dir, "package.json");
108
+ if (existsSync2(pkgPath)) {
109
+ try {
110
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
111
+ if (pkg.name === "@askexenow/exe-os" || pkg.name === "exe-os") return dir;
112
+ } catch {
113
+ }
114
+ }
115
+ dir = path2.dirname(dir);
116
+ }
117
+ return path2.resolve(path2.dirname(thisFile), "..", "..", "..");
118
+ }
119
+ async function copySlashCommands(packageRoot, homeDir = os2.homedir()) {
120
+ let copied = 0;
121
+ let skipped = 0;
122
+ const skillsBase = path2.join(homeDir, ".claude", "skills");
123
+ const deprecatedExeLink = path2.join(skillsBase, "exe-link");
124
+ if (existsSync2(deprecatedExeLink)) {
125
+ await rm(deprecatedExeLink, { recursive: true, force: true });
126
+ }
127
+ const exeDir = path2.join(packageRoot, "src", "commands", "exe");
128
+ if (existsSync2(exeDir)) {
129
+ const entries = await readdir(exeDir);
130
+ const mdFiles = entries.filter((f) => f.endsWith(".md"));
131
+ for (const file of mdFiles) {
132
+ const name = file.replace(".md", "");
133
+ const destDir = path2.join(skillsBase, `exe-${name}`);
134
+ await mkdir(destDir, { recursive: true });
135
+ const srcPath = path2.join(exeDir, file);
136
+ const destPath = path2.join(destDir, "SKILL.md");
137
+ const result = await copyAsSkill(srcPath, destPath, `exe-${name}`);
138
+ if (result) copied++;
139
+ else skipped++;
140
+ }
141
+ }
142
+ const topLevelSrc = path2.join(packageRoot, "src", "commands", "exe.md");
143
+ if (existsSync2(topLevelSrc)) {
144
+ const destDir = path2.join(skillsBase, "exe");
145
+ await mkdir(destDir, { recursive: true });
146
+ const destPath = path2.join(destDir, "SKILL.md");
147
+ const result = await copyAsSkill(topLevelSrc, destPath, "exe");
148
+ if (result) copied++;
149
+ else skipped++;
150
+ }
151
+ return { copied, skipped };
152
+ }
153
+ async function copyAsSkill(srcPath, destPath, skillName) {
154
+ let content = await readFile(srcPath, "utf-8");
155
+ const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
156
+ if (fmMatch?.[1]) {
157
+ const fm = fmMatch[1];
158
+ if (fm.includes("name:")) {
159
+ content = content.replace(
160
+ /^(---\n[\s\S]*?)name:\s*[^\n]+/,
161
+ `$1name: ${skillName}`
162
+ );
163
+ } else {
164
+ content = content.replace(/^---\n/, `---
165
+ name: ${skillName}
166
+ `);
167
+ }
168
+ }
169
+ if (existsSync2(destPath)) {
170
+ const existing = await readFile(destPath, "utf-8");
171
+ if (existing === content) return false;
172
+ }
173
+ await writeFile(destPath, content);
174
+ return true;
175
+ }
176
+ function readJsonFile(filePath) {
177
+ try {
178
+ return JSON.parse(readFileSync2(filePath, "utf-8"));
179
+ } catch {
180
+ return null;
181
+ }
182
+ }
183
+ function findAncestorMcpJsons(startDir, homeDir) {
184
+ const files = [];
185
+ let dir = path2.resolve(startDir);
186
+ const root = path2.parse(dir).root;
187
+ const stop = path2.resolve(homeDir);
188
+ while (dir !== root) {
189
+ const candidate = path2.join(dir, ".mcp.json");
190
+ if (existsSync2(candidate)) files.push(candidate);
191
+ if (dir === stop) break;
192
+ dir = path2.dirname(dir);
193
+ }
194
+ return files;
195
+ }
196
+ function pathApplies(projectPath, cwd) {
197
+ const project = path2.resolve(projectPath);
198
+ const current = path2.resolve(cwd);
199
+ return current === project || current.startsWith(project + path2.sep);
200
+ }
201
+ function detectMcpNameCollisions(homeDir = os2.homedir(), cwd = process.cwd()) {
202
+ const claudeJsonPath = path2.join(homeDir, ".claude.json");
203
+ if (!existsSync2(claudeJsonPath)) return [];
204
+ const claudeJson = readJsonFile(claudeJsonPath);
205
+ if (!claudeJson?.projects) return [];
206
+ const collisions = [];
207
+ const mcpJsons = findAncestorMcpJsons(cwd, homeDir);
208
+ if (mcpJsons.length === 0) return [];
209
+ for (const [projectPath, projectConfig] of Object.entries(claudeJson.projects)) {
210
+ if (!pathApplies(projectPath, cwd)) continue;
211
+ const projectServerNames = new Set(Object.keys(projectConfig.mcpServers ?? {}));
212
+ if (projectServerNames.size === 0) continue;
213
+ const enabled = new Set(projectConfig.enabledMcpjsonServers ?? []);
214
+ for (const mcpJsonPath of mcpJsons) {
215
+ const mcpJson = readJsonFile(mcpJsonPath);
216
+ const mcpServerNames = Object.keys(mcpJson?.mcpServers ?? {});
217
+ for (const serverName of mcpServerNames) {
218
+ if (!projectServerNames.has(serverName)) continue;
219
+ collisions.push({
220
+ mcpJsonPath,
221
+ projectPath,
222
+ serverName,
223
+ disabledInMcpJson: !enabled.has(serverName)
224
+ });
225
+ }
226
+ }
227
+ }
228
+ return collisions;
229
+ }
230
+ function buildStdioMcpEntry(packageRoot) {
231
+ return {
232
+ type: "stdio",
233
+ command: "node",
234
+ args: [path2.join(packageRoot, "dist", "mcp", "server.js")],
235
+ env: {}
236
+ };
237
+ }
238
+ function mcpTransportMode() {
239
+ const value = process.env.EXE_OS_MCP_TRANSPORT?.trim().toLowerCase();
240
+ if (value === "stdio") return "stdio";
241
+ if (value === "http") return "http";
242
+ const totalGB = os2.totalmem() / (1024 * 1024 * 1024);
243
+ if (totalGB <= 8) return "stdio";
244
+ return "http";
245
+ }
246
+ async function registerMcpServer(packageRoot, homeDir = os2.homedir()) {
247
+ const claudeJsonPath = path2.join(homeDir, ".claude.json");
248
+ let claudeJson = {};
249
+ if (existsSync2(claudeJsonPath)) {
250
+ try {
251
+ claudeJson = JSON.parse(await readFile(claudeJsonPath, "utf-8"));
252
+ } catch {
253
+ claudeJson = {};
254
+ }
255
+ }
256
+ if (!claudeJson.mcpServers) {
257
+ claudeJson.mcpServers = {};
258
+ }
259
+ const newEntry = mcpTransportMode() === "stdio" ? buildStdioMcpEntry(packageRoot) : buildClaudeHttpMcpEntry(homeDir);
260
+ if (claudeJson.mcpServers[MCP_LEGACY_KEY]) {
261
+ delete claudeJson.mcpServers[MCP_LEGACY_KEY];
262
+ process.stderr.write("exe-os: migrated MCP server key exe-mem \u2192 exe-os\n");
263
+ }
264
+ if (claudeJson.projects) {
265
+ for (const [projectPath, projectConfig] of Object.entries(claudeJson.projects)) {
266
+ if (projectConfig.mcpServers?.[MCP_LEGACY_KEY]) {
267
+ delete projectConfig.mcpServers[MCP_LEGACY_KEY];
268
+ process.stderr.write(`exe-os: removed stale project-level exe-mem from ${projectPath}
269
+ `);
270
+ }
271
+ }
272
+ }
273
+ const currentOs = claudeJson.mcpServers[MCP_PRIMARY_KEY];
274
+ const osMatches = currentOs && JSON.stringify(currentOs) === JSON.stringify(newEntry);
275
+ if (osMatches) {
276
+ await cleanSettingsJsonMcp(path2.join(homeDir, ".claude", "settings.json"));
277
+ await migratePermissionsToExeOs(path2.join(homeDir, ".claude", "settings.json"));
278
+ const collisions2 = detectMcpNameCollisions(homeDir, packageRoot).filter((c) => c.serverName === MCP_PRIMARY_KEY || c.serverName === MCP_LEGACY_KEY);
279
+ for (const c of collisions2) {
280
+ process.stderr.write(
281
+ `exe-os: WARNING Claude Code MCP name collision: ${c.serverName} exists in ${c.mcpJsonPath} and ~/.claude.json project ${c.projectPath}. Remove or rename the .mcp.json entry if tools do not surface.
282
+ `
283
+ );
284
+ }
285
+ await registerExeRustMcpConfig(packageRoot, homeDir);
286
+ return false;
287
+ }
288
+ claudeJson.mcpServers[MCP_PRIMARY_KEY] = newEntry;
289
+ await writeFile(claudeJsonPath, JSON.stringify(claudeJson, null, 2) + "\n");
290
+ await cleanSettingsJsonMcp(path2.join(homeDir, ".claude", "settings.json"));
291
+ await migratePermissionsToExeOs(path2.join(homeDir, ".claude", "settings.json"));
292
+ const collisions = detectMcpNameCollisions(homeDir, packageRoot).filter((c) => c.serverName === MCP_PRIMARY_KEY || c.serverName === MCP_LEGACY_KEY);
293
+ for (const c of collisions) {
294
+ process.stderr.write(
295
+ `exe-os: WARNING Claude Code MCP name collision: ${c.serverName} exists in ${c.mcpJsonPath} and ~/.claude.json project ${c.projectPath}. Remove or rename the .mcp.json entry if tools do not surface.
296
+ `
297
+ );
298
+ }
299
+ await registerExeRustMcpConfig(packageRoot, homeDir);
300
+ return true;
301
+ }
302
+ async function registerExeRustMcpConfig(packageRoot, homeDir) {
303
+ const exeDir = path2.join(homeDir, ".exe");
304
+ const exeMcpPath = path2.join(exeDir, "mcp.json");
305
+ await mkdir(exeDir, { recursive: true });
306
+ let config = { servers: {} };
307
+ if (existsSync2(exeMcpPath)) {
308
+ try {
309
+ config = JSON.parse(await readFile(exeMcpPath, "utf-8"));
310
+ if (!config.servers) config.servers = {};
311
+ } catch {
312
+ config = { servers: {} };
313
+ }
314
+ }
315
+ const stdioEntry = {
316
+ command: "node",
317
+ args: [path2.join(packageRoot, "dist", "mcp", "server.js")],
318
+ env: {},
319
+ shared: true
320
+ };
321
+ const existing = config.servers[MCP_PRIMARY_KEY];
322
+ if (existing && JSON.stringify(existing) === JSON.stringify(stdioEntry)) {
323
+ return;
324
+ }
325
+ if (config.servers[MCP_LEGACY_KEY]) {
326
+ delete config.servers[MCP_LEGACY_KEY];
327
+ }
328
+ config.servers[MCP_PRIMARY_KEY] = stdioEntry;
329
+ await writeFile(exeMcpPath, JSON.stringify(config, null, 2) + "\n");
330
+ process.stderr.write("exe-os: registered MCP server in ~/.exe/mcp.json (Rust runtime)\n");
331
+ }
332
+ async function cleanSettingsJsonMcp(settingsPath) {
333
+ if (!existsSync2(settingsPath)) return;
334
+ try {
335
+ const settings = JSON.parse(await readFile(settingsPath, "utf-8"));
336
+ const servers = settings.mcpServers;
337
+ if (!servers) return;
338
+ let changed = false;
339
+ if (servers[MCP_PRIMARY_KEY]) {
340
+ delete servers[MCP_PRIMARY_KEY];
341
+ changed = true;
342
+ }
343
+ if (servers[MCP_LEGACY_KEY]) {
344
+ delete servers[MCP_LEGACY_KEY];
345
+ changed = true;
346
+ }
347
+ if (changed) {
348
+ await writeFile(settingsPath, JSON.stringify(settings, null, 2) + "\n");
349
+ }
350
+ } catch {
351
+ }
352
+ }
353
+ async function migratePermissionsToExeOs(settingsPath) {
354
+ if (!existsSync2(settingsPath)) return;
355
+ try {
356
+ const settings = JSON.parse(await readFile(settingsPath, "utf-8"));
357
+ const permissions = settings.permissions;
358
+ if (!permissions || !Array.isArray(permissions.allow)) return;
359
+ const allow = permissions.allow;
360
+ let migrated = 0;
361
+ for (let i = 0; i < allow.length; i++) {
362
+ if (allow[i].startsWith("mcp__exe-mem__")) {
363
+ const newName = allow[i].replace("mcp__exe-mem__", "mcp__exe-os__");
364
+ if (!allow.includes(newName)) {
365
+ allow[i] = newName;
366
+ } else {
367
+ allow[i] = "__REMOVE__";
368
+ }
369
+ migrated++;
370
+ }
371
+ }
372
+ if (migrated > 0) {
373
+ permissions.allow = allow.filter((e) => e !== "__REMOVE__");
374
+ permissions.allow = [...new Set(permissions.allow)];
375
+ await writeFile(settingsPath, JSON.stringify(settings, null, 2) + "\n");
376
+ process.stderr.write(`exe-os: migrated ${migrated} permission(s) from exe-mem \u2192 exe-os
377
+ `);
378
+ }
379
+ } catch {
380
+ }
381
+ }
382
+ async function mergeHooks(packageRoot, homeDir = os2.homedir()) {
383
+ const settingsPath = path2.join(homeDir, ".claude", "settings.json");
384
+ const logsDir = path2.join(homeDir, ".exe-os", "logs");
385
+ const hookLogPath = path2.join(logsDir, "hooks.log");
386
+ const logSuffix = ` 2>> "${hookLogPath}"`;
387
+ await mkdir(logsDir, { recursive: true });
388
+ let settings = {};
389
+ if (existsSync2(settingsPath)) {
390
+ try {
391
+ settings = JSON.parse(await readFile(settingsPath, "utf-8"));
392
+ } catch {
393
+ settings = {};
394
+ }
395
+ }
396
+ if (!settings.hooks) {
397
+ settings.hooks = {};
398
+ }
399
+ if (settings.hooks && typeof settings.hooks !== "object") {
400
+ console.warn("[exe-os] Unexpected hooks schema in settings.json \u2014 skipping hook installation");
401
+ return { added: 0, skipped: 0 };
402
+ }
403
+ const hooksToRegister = [
404
+ {
405
+ event: "PostToolUse",
406
+ group: {
407
+ matcher: "Bash|Edit|Write|Read|Glob|Grep|Agent|mcp__.*",
408
+ hooks: [
409
+ {
410
+ type: "command",
411
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "post-tool-combined.js")}"${logSuffix}`
412
+ }
413
+ ]
414
+ },
415
+ marker: EXE_HOOKS.postToolCombined
416
+ },
417
+ {
418
+ event: "SessionStart",
419
+ group: {
420
+ hooks: [
421
+ {
422
+ type: "command",
423
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "session-start.js")}"${logSuffix}`,
424
+ timeout: 1e4
425
+ }
426
+ ]
427
+ },
428
+ marker: EXE_HOOKS.sessionStart
429
+ },
430
+ {
431
+ event: "UserPromptSubmit",
432
+ group: {
433
+ hooks: [
434
+ {
435
+ type: "command",
436
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "prompt-submit.js")}"${logSuffix}`
437
+ }
438
+ ]
439
+ },
440
+ marker: EXE_HOOKS.promptSubmit
441
+ },
442
+ {
443
+ event: "UserPromptSubmit",
444
+ group: {
445
+ hooks: [
446
+ {
447
+ type: "command",
448
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "exe-heartbeat-hook.js")}"${logSuffix}`,
449
+ timeout: 5e3
450
+ }
451
+ ]
452
+ },
453
+ marker: EXE_HOOKS.heartbeat
454
+ },
455
+ {
456
+ event: "Stop",
457
+ group: {
458
+ hooks: [
459
+ {
460
+ type: "command",
461
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "stop.js")}"${logSuffix}`
462
+ }
463
+ ]
464
+ },
465
+ marker: EXE_HOOKS.stop
466
+ },
467
+ {
468
+ event: "PreToolUse",
469
+ group: {
470
+ matcher: "Write|Edit|Read|Bash",
471
+ hooks: [
472
+ {
473
+ type: "command",
474
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "pre-tool-use.js")}"${logSuffix}`
475
+ }
476
+ ]
477
+ },
478
+ marker: EXE_HOOKS.preToolUse
479
+ },
480
+ {
481
+ event: "SubagentStop",
482
+ group: {
483
+ hooks: [
484
+ {
485
+ type: "command",
486
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "subagent-stop.js")}"${logSuffix}`
487
+ }
488
+ ]
489
+ },
490
+ marker: EXE_HOOKS.subagentStop
491
+ },
492
+ {
493
+ event: "PreCompact",
494
+ group: {
495
+ hooks: [
496
+ {
497
+ type: "command",
498
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "pre-compact.js")}"${logSuffix}`,
499
+ timeout: 1e4
500
+ }
501
+ ]
502
+ },
503
+ marker: EXE_HOOKS.preCompact
504
+ },
505
+ {
506
+ event: "SessionEnd",
507
+ group: {
508
+ hooks: [
509
+ {
510
+ type: "command",
511
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "session-end.js")}"${logSuffix}`
512
+ }
513
+ ]
514
+ },
515
+ marker: EXE_HOOKS.sessionEnd
516
+ },
517
+ {
518
+ event: "Notification",
519
+ group: {
520
+ hooks: [
521
+ {
522
+ type: "command",
523
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "notification.js")}"${logSuffix}`
524
+ }
525
+ ]
526
+ },
527
+ marker: EXE_HOOKS.notification
528
+ },
529
+ {
530
+ event: "PostCompact",
531
+ group: {
532
+ hooks: [
533
+ {
534
+ type: "command",
535
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "post-compact.js")}"${logSuffix}`,
536
+ timeout: 1e4
537
+ }
538
+ ]
539
+ },
540
+ marker: EXE_HOOKS.postCompact
541
+ },
542
+ {
543
+ event: "InstructionsLoaded",
544
+ group: {
545
+ hooks: [
546
+ {
547
+ type: "command",
548
+ command: `node "${path2.join(packageRoot, "dist", "hooks", "instructions-loaded.js")}"${logSuffix}`
549
+ }
550
+ ]
551
+ },
552
+ marker: EXE_HOOKS.instructionsLoaded
553
+ }
554
+ ];
555
+ let added = 0;
556
+ let skipped = 0;
557
+ for (const eventKey of Object.keys(settings.hooks)) {
558
+ const groups = settings.hooks[eventKey];
559
+ if (!Array.isArray(groups)) continue;
560
+ settings.hooks[eventKey] = groups.map((g) => ({
561
+ ...g,
562
+ hooks: g.hooks.filter((h) => !isLegacyHomeDirHookCommand(h.command))
563
+ })).filter((g) => g.hooks.length > 0);
564
+ }
565
+ const postToolGroups = settings.hooks["PostToolUse"];
566
+ if (Array.isArray(postToolGroups)) {
567
+ settings.hooks["PostToolUse"] = postToolGroups.map((g) => ({
568
+ ...g,
569
+ hooks: g.hooks.filter((h) => !isLegacySplitPostToolCommand(h.command))
570
+ })).filter((g) => g.hooks.length > 0);
571
+ }
572
+ for (const { event, group, marker } of hooksToRegister) {
573
+ if (!settings.hooks[event]) {
574
+ settings.hooks[event] = [];
575
+ }
576
+ if (!Array.isArray(settings.hooks[event])) {
577
+ console.warn(`[exe-os] Hook event "${event}" has unexpected structure \u2014 skipping`);
578
+ skipped++;
579
+ continue;
580
+ }
581
+ const existing = settings.hooks[event];
582
+ const correctCommand = group.hooks[0]?.command ?? "";
583
+ const alreadyCorrect = existing.some(
584
+ (g) => g.hooks.some((h) => h.command === correctCommand)
585
+ );
586
+ if (alreadyCorrect) {
587
+ skipped++;
588
+ } else {
589
+ settings.hooks[event] = existing.filter(
590
+ (g) => !g.hooks.some((h) => h.command.includes(marker))
591
+ );
592
+ settings.hooks[event].push(group);
593
+ added++;
594
+ }
595
+ }
596
+ const perms = settings.permissions;
597
+ if (!perms) {
598
+ settings.permissions = {};
599
+ }
600
+ const permissions = settings.permissions;
601
+ if (!Array.isArray(permissions.allow)) {
602
+ permissions.allow = [];
603
+ }
604
+ const toolNames = [
605
+ // Core memory
606
+ "store_memory",
607
+ "recall_my_memory",
608
+ "commit_to_long_term_memory",
609
+ "consolidate_memories",
610
+ "ask_team_memory",
611
+ "get_session_context",
612
+ // Tasks
613
+ "create_task",
614
+ "list_tasks",
615
+ "get_task",
616
+ "update_task",
617
+ "close_task",
618
+ "checkpoint_task",
619
+ // Behaviors
620
+ "store_behavior",
621
+ "deactivate_behavior",
622
+ "list_behaviors",
623
+ // Identity
624
+ "get_identity",
625
+ "update_identity",
626
+ // Messaging
627
+ "send_message",
628
+ "acknowledge_messages",
629
+ "send_whatsapp",
630
+ "query_conversations",
631
+ // Reminders + triggers
632
+ "create_reminder",
633
+ "complete_reminder",
634
+ "list_reminders",
635
+ "create_trigger",
636
+ "list_triggers",
637
+ // GraphRAG
638
+ "query_relationships",
639
+ "merge_entities",
640
+ // Documents + wiki
641
+ "ingest_document",
642
+ "list_documents",
643
+ "purge_document",
644
+ "rerank_documents",
645
+ "set_document_importance",
646
+ "get_wiki_page",
647
+ "list_wiki_pages",
648
+ // System
649
+ "load_skill",
650
+ "apply_starter_pack",
651
+ "resume_employee",
652
+ "deploy_client"
653
+ ];
654
+ const allowList = permissions.allow;
655
+ for (const name of toolNames) {
656
+ const fullName = `mcp__${MCP_PRIMARY_KEY}__${name}`;
657
+ if (!allowList.includes(fullName)) {
658
+ allowList.push(fullName);
659
+ }
660
+ }
661
+ await mkdir(path2.dirname(settingsPath), { recursive: true });
662
+ await writeFile(settingsPath, JSON.stringify(settings, null, 2) + "\n");
663
+ return { added, skipped };
664
+ }
665
+ async function cleanOldShellFunctions(homeDir = os2.homedir()) {
666
+ const rosterPath = path2.join(homeDir, ".exe-os", "exe-employees.json");
667
+ if (!existsSync2(rosterPath)) return 0;
668
+ let employees;
669
+ try {
670
+ employees = JSON.parse(await readFile(rosterPath, "utf-8"));
671
+ } catch {
672
+ return 0;
673
+ }
674
+ if (employees.length === 0) return 0;
675
+ const names = employees.map((e) => e.name);
676
+ const funcPatterns = names.map((n) => {
677
+ const funcDef = new RegExp(`^\\s*(function\\s+)?${escapeRegExp(n)}\\d+\\s*\\(\\)`, "m");
678
+ const forLoop = new RegExp(`${escapeRegExp(n)}\\$\\{?[a-zA-Z_][a-zA-Z0-9_]*\\}?`, "m");
679
+ return { name: n, funcDef, forLoop };
680
+ });
681
+ const rcFiles = [
682
+ path2.join(homeDir, ".zshrc"),
683
+ path2.join(homeDir, ".bashrc")
684
+ ];
685
+ const REMOVED_MARKER = "# Removed by exe-os \u2014 wrappers now at ~/.exe-os/bin/";
686
+ let totalRemoved = 0;
687
+ for (const rcPath of rcFiles) {
688
+ if (!existsSync2(rcPath)) continue;
689
+ let content;
690
+ try {
691
+ content = await readFile(rcPath, "utf-8");
692
+ } catch {
693
+ continue;
694
+ }
695
+ if (content.includes(REMOVED_MARKER)) continue;
696
+ const lines = content.split("\n");
697
+ let changed = false;
698
+ let inForLoop = false;
699
+ let forLoopMatchesEmployee = false;
700
+ for (let i = 0; i < lines.length; i++) {
701
+ const line = lines[i];
702
+ const trimmed = line.trim();
703
+ if (trimmed.startsWith("#")) continue;
704
+ if (/^\s*for\s+/.test(trimmed)) {
705
+ inForLoop = true;
706
+ forLoopMatchesEmployee = false;
707
+ for (const { forLoop } of funcPatterns) {
708
+ if (forLoop.test(trimmed)) {
709
+ forLoopMatchesEmployee = true;
710
+ break;
711
+ }
712
+ }
713
+ if (forLoopMatchesEmployee) {
714
+ lines[i] = `${REMOVED_MARKER}
715
+ # ${line}`;
716
+ changed = true;
717
+ totalRemoved++;
718
+ continue;
719
+ }
720
+ }
721
+ if (inForLoop) {
722
+ if (!forLoopMatchesEmployee) {
723
+ for (const { forLoop } of funcPatterns) {
724
+ if (forLoop.test(trimmed)) {
725
+ forLoopMatchesEmployee = true;
726
+ for (let j = i - 1; j >= 0; j--) {
727
+ if (/^\s*for\s+/.test(lines[j].replace(/^#\s*/, ""))) {
728
+ if (!lines[j].startsWith("#")) {
729
+ lines[j] = `${REMOVED_MARKER}
730
+ # ${lines[j]}`;
731
+ totalRemoved++;
732
+ }
733
+ break;
734
+ }
735
+ }
736
+ break;
737
+ }
738
+ }
739
+ }
740
+ if (forLoopMatchesEmployee && !trimmed.startsWith("#")) {
741
+ lines[i] = `# ${line}`;
742
+ changed = true;
743
+ totalRemoved++;
744
+ }
745
+ if (trimmed === "done" || trimmed.startsWith("done;") || trimmed.startsWith("done ")) {
746
+ inForLoop = false;
747
+ forLoopMatchesEmployee = false;
748
+ }
749
+ continue;
750
+ }
751
+ for (const { funcDef } of funcPatterns) {
752
+ if (funcDef.test(trimmed)) {
753
+ lines[i] = `${REMOVED_MARKER}
754
+ # ${line}`;
755
+ changed = true;
756
+ totalRemoved++;
757
+ let braceDepth = 0;
758
+ const hasBrace = trimmed.includes("{");
759
+ if (hasBrace) braceDepth = 1;
760
+ for (let j = i + 1; j < lines.length; j++) {
761
+ const bodyLine = lines[j].trim();
762
+ if (!hasBrace && braceDepth === 0) {
763
+ if (bodyLine === "{") {
764
+ braceDepth = 1;
765
+ lines[j] = `# ${lines[j]}`;
766
+ totalRemoved++;
767
+ continue;
768
+ }
769
+ }
770
+ if (braceDepth > 0) {
771
+ braceDepth += (bodyLine.match(/{/g) ?? []).length;
772
+ braceDepth -= (bodyLine.match(/}/g) ?? []).length;
773
+ lines[j] = `# ${lines[j]}`;
774
+ totalRemoved++;
775
+ if (braceDepth <= 0) break;
776
+ }
777
+ }
778
+ break;
779
+ }
780
+ }
781
+ }
782
+ if (changed) {
783
+ await writeFile(rcPath, lines.join("\n"));
784
+ }
785
+ }
786
+ return totalRemoved;
787
+ }
788
+ function escapeRegExp(s) {
789
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
790
+ }
791
+ var EXE_SECTION_START = "<!-- exe-os:orchestration-start -->";
792
+ var EXE_SECTION_END = "<!-- exe-os:orchestration-end -->";
793
+ var ORCHESTRATION_RULES = `${EXE_SECTION_START}
794
+ ## exe-os Multi-Agent Orchestration (auto-managed \u2014 do not edit)
795
+
796
+ These rules are injected by exe-os and override default behavior for multi-agent coordination.
797
+
798
+ - **Session routing is deterministic.** When working in a coordinator session, ALL employee sessions use that same coordinator-session suffix. NEVER reference, consider, or dispatch to employee sessions from other project sessions. This is not a choice \u2014 it is a hard constraint.
799
+ - **Always use create_task to assign work.** Never use messages, tmux send-keys, or ad-hoc instructions as a substitute for tasks.
800
+ - **Never modify another agent's in-progress task.** Create a new task instead. Modifying active tasks causes race conditions.
801
+ - **Chain of command:** founder -> coordinator/executive agent (internal routing slot may be "COO") -> managers -> specialists. The coordinator does not bypass managers for specialist work. Internal role labels are plumbing, not user-facing titles.
802
+ - **Verify dispatch.** After every create_task, confirm the employee received and started the task via tmux capture-pane.
803
+ ${EXE_SECTION_END}`;
804
+ async function injectOrchestrationRules(homeDir) {
805
+ const claudeDir = path2.join(homeDir, ".claude");
806
+ const claudeMdPath = path2.join(claudeDir, "CLAUDE.md");
807
+ await mkdir(claudeDir, { recursive: true });
808
+ let existing = "";
809
+ try {
810
+ existing = await readFile(claudeMdPath, "utf-8");
811
+ } catch {
812
+ }
813
+ const startIdx = existing.indexOf(EXE_SECTION_START);
814
+ const endIdx = existing.indexOf(EXE_SECTION_END);
815
+ if (startIdx !== -1 && endIdx !== -1) {
816
+ const currentSection = existing.slice(startIdx, endIdx + EXE_SECTION_END.length);
817
+ if (currentSection === ORCHESTRATION_RULES) {
818
+ return "unchanged";
819
+ }
820
+ const updated = existing.slice(0, startIdx) + ORCHESTRATION_RULES + existing.slice(endIdx + EXE_SECTION_END.length);
821
+ await writeFile(claudeMdPath, updated, "utf-8");
822
+ return "updated";
823
+ }
824
+ const separator = existing.length > 0 && !existing.endsWith("\n\n") ? "\n\n" : "";
825
+ await writeFile(claudeMdPath, existing + separator + ORCHESTRATION_RULES + "\n", "utf-8");
826
+ return "injected";
827
+ }
828
+ async function installStatusLine(packageRoot, homeDir = os2.homedir()) {
829
+ const prefs = loadPreferences(homeDir);
830
+ if (prefs.ccStatusLine === false) return "opted-out";
831
+ const claudeDir = path2.join(homeDir, ".claude");
832
+ await mkdir(claudeDir, { recursive: true });
833
+ const assetPath = path2.join(packageRoot, "dist", "assets", "statusline-command.sh");
834
+ if (!existsSync2(assetPath)) return "asset-missing";
835
+ const destScript = path2.join(claudeDir, "statusline-command.sh");
836
+ const assetContent = await readFile(assetPath, "utf-8");
837
+ await writeFile(destScript, assetContent, { mode: 493 });
838
+ const settingsPath = path2.join(claudeDir, "settings.json");
839
+ let settings = {};
840
+ if (existsSync2(settingsPath)) {
841
+ try {
842
+ settings = JSON.parse(await readFile(settingsPath, "utf-8"));
843
+ } catch {
844
+ settings = {};
845
+ }
846
+ }
847
+ if (settings.statusLine) return "already-configured";
848
+ settings.statusLine = {
849
+ type: "command",
850
+ command: `bash ${destScript}`
851
+ };
852
+ await writeFile(settingsPath, JSON.stringify(settings, null, 2) + "\n");
853
+ return "installed";
854
+ }
855
+ async function runInstaller(homeDir) {
856
+ const packageRoot = resolvePackageRoot();
857
+ process.stderr.write(`exe-os installer v1.3.0
858
+ `);
859
+ process.stderr.write(`Package root: ${packageRoot}
860
+
861
+ `);
862
+ const cmdResult = await copySlashCommands(packageRoot, homeDir);
863
+ process.stderr.write(
864
+ `Slash commands: ${cmdResult.copied} copied, ${cmdResult.skipped} unchanged
865
+ `
866
+ );
867
+ const mcpChanged = await registerMcpServer(packageRoot, homeDir);
868
+ process.stderr.write(
869
+ `MCP server: ${mcpChanged ? "registered" : "already registered"}
870
+ `
871
+ );
872
+ const hookResult = await mergeHooks(packageRoot, homeDir);
873
+ process.stderr.write(
874
+ `Hooks: ${hookResult.added} added, ${hookResult.skipped} unchanged
875
+ `
876
+ );
877
+ const resolvedHome = homeDir ?? os2.homedir();
878
+ const exeWorkspace = path2.join(resolvedHome, "exe");
879
+ if (!existsSync2(exeWorkspace)) {
880
+ try {
881
+ await mkdir(path2.join(exeWorkspace, "content"), { recursive: true });
882
+ await mkdir(path2.join(exeWorkspace, "operations"), { recursive: true });
883
+ await mkdir(path2.join(exeWorkspace, "output"), { recursive: true });
884
+ process.stderr.write(
885
+ `Created ~/exe/ \u2014 your automation workspace for non-code projects
886
+ `
887
+ );
888
+ } catch {
889
+ }
890
+ }
891
+ const claudeMdResult = await injectOrchestrationRules(resolvedHome);
892
+ process.stderr.write(
893
+ `CLAUDE.md orchestration: ${claudeMdResult}
894
+ `
895
+ );
896
+ const symlinkResults = await ensureAllAgentSymlinks(resolvedHome);
897
+ process.stderr.write(
898
+ `Agent symlinks: ${summarizeSymlinkResults(symlinkResults)}
899
+ `
900
+ );
901
+ const statusLineResult = await installStatusLine(packageRoot, resolvedHome);
902
+ process.stderr.write(
903
+ `Status line: ${statusLineResult}
904
+ `
905
+ );
906
+ const shellFuncsCleaned = await cleanOldShellFunctions(resolvedHome);
907
+ if (shellFuncsCleaned > 0) {
908
+ process.stderr.write(
909
+ `Shell cleanup: removed ${shellFuncsCleaned} old shell function(s) that were shadowing exe-os wrappers
910
+ `
911
+ );
912
+ }
913
+ process.stderr.write(`
914
+ exe-os installed successfully.
915
+ `);
916
+ }
917
+ function setupTmux(home) {
918
+ const homeDir = home ?? os2.homedir();
919
+ const exeDir = path2.join(homeDir, ".exe-os");
920
+ const exeTmuxConf = path2.join(exeDir, "tmux.conf");
921
+ const userTmuxConf = path2.join(homeDir, ".tmux.conf");
922
+ const backupPath = path2.join(homeDir, ".tmux.conf.backup");
923
+ const sourceLine = "source-file ~/.exe-os/tmux.conf";
924
+ const pkgRoot = resolvePackageRoot();
925
+ const assetPath = path2.join(pkgRoot, "dist", "assets", "tmux.conf");
926
+ if (!existsSync2(assetPath)) {
927
+ process.stderr.write(`exe-os: tmux.conf asset not found at ${assetPath} \u2014 skipping tmux setup
928
+ `);
929
+ return;
930
+ }
931
+ mkdirSync2(exeDir, { recursive: true });
932
+ if (existsSync2(exeTmuxConf)) {
933
+ const currentContent = readFileSync2(exeTmuxConf, "utf8");
934
+ const newContent = readFileSync2(assetPath, "utf8");
935
+ const currentHash = createHash("sha256").update(currentContent).digest("hex");
936
+ const newHash = createHash("sha256").update(newContent).digest("hex");
937
+ if (currentHash !== newHash) {
938
+ const shippedPath = path2.join(exeDir, ".tmux.conf.shipped-hash");
939
+ const lastShippedHash = existsSync2(shippedPath) ? readFileSync2(shippedPath, "utf8").trim() : "";
940
+ if (lastShippedHash && currentHash !== lastShippedHash) {
941
+ process.stderr.write("exe-os: tmux config has user customizations \u2014 skipping overwrite\n");
942
+ } else {
943
+ copyFileSync(assetPath, exeTmuxConf);
944
+ process.stderr.write("exe-os: tmux config updated\n");
945
+ }
946
+ writeFileSync2(shippedPath, newHash, "utf8");
947
+ } else {
948
+ process.stderr.write("exe-os: tmux config already up to date\n");
949
+ }
950
+ } else {
951
+ copyFileSync(assetPath, exeTmuxConf);
952
+ const newContent = readFileSync2(assetPath, "utf8");
953
+ const newHash = createHash("sha256").update(newContent).digest("hex");
954
+ writeFileSync2(path2.join(exeDir, ".tmux.conf.shipped-hash"), newHash, "utf8");
955
+ }
956
+ if (existsSync2(userTmuxConf)) {
957
+ const existing = readFileSync2(userTmuxConf, "utf8");
958
+ if (!existing.includes(sourceLine)) {
959
+ if (!existsSync2(backupPath)) {
960
+ copyFileSync(userTmuxConf, backupPath);
961
+ process.stderr.write(`exe-os: backed up existing tmux config to ${backupPath}
962
+ `);
963
+ }
964
+ writeFileSync2(userTmuxConf, `${sourceLine}
965
+ ${existing}`);
966
+ }
967
+ } else {
968
+ writeFileSync2(userTmuxConf, `# Exe OS tmux defaults \u2014 remove this line to use your own config
969
+ ${sourceLine}
970
+ `);
971
+ }
972
+ try {
973
+ execSync(`tmux source-file ${exeTmuxConf} 2>/dev/null`);
974
+ } catch {
975
+ }
976
+ process.stderr.write("exe-os: tmux config installed\n");
977
+ }
978
+ function setupGhostty(home) {
979
+ const homeDir = home ?? os2.homedir();
980
+ const xdgConfig = path2.join(homeDir, ".config", "ghostty");
981
+ const macConfig = path2.join(homeDir, "Library", "Application Support", "com.mitchellh.ghostty");
982
+ const ghosttyInstalled = existsSync2(xdgConfig) || existsSync2(macConfig) || (() => {
983
+ try {
984
+ execSync("which ghostty 2>/dev/null");
985
+ return true;
986
+ } catch {
987
+ return false;
988
+ }
989
+ })();
990
+ if (!ghosttyInstalled) {
991
+ return;
992
+ }
993
+ const pkgRoot = resolvePackageRoot();
994
+ const assetPath = path2.join(pkgRoot, "dist", "assets", "ghostty.conf");
995
+ if (!existsSync2(assetPath)) {
996
+ process.stderr.write("exe-os: ghostty.conf asset not found \u2014 skipping Ghostty setup\n");
997
+ return;
998
+ }
999
+ const configDir = xdgConfig;
1000
+ const configPath = path2.join(configDir, "config");
1001
+ const backupPath = path2.join(configDir, "config.backup");
1002
+ mkdirSync2(configDir, { recursive: true });
1003
+ const START_MARKER = "# \u2500\u2500 exe-os:ghostty-start \u2500\u2500";
1004
+ const END_MARKER = "# \u2500\u2500 exe-os:ghostty-end \u2500\u2500";
1005
+ const assetContent = readFileSync2(assetPath, "utf8").trim();
1006
+ const markedSection = `${START_MARKER}
1007
+ ${assetContent}
1008
+ ${END_MARKER}`;
1009
+ if (existsSync2(configPath)) {
1010
+ const existing = readFileSync2(configPath, "utf8");
1011
+ if (existing.includes(START_MARKER) && existing.includes(END_MARKER)) {
1012
+ process.stderr.write("exe-os: Ghostty config already installed \u2014 preserving local settings\n");
1013
+ return;
1014
+ } else if (existing.includes("Exe OS")) {
1015
+ if (!existsSync2(backupPath)) {
1016
+ copyFileSync(configPath, backupPath);
1017
+ process.stderr.write(`exe-os: backed up existing Ghostty config to ${backupPath}
1018
+ `);
1019
+ }
1020
+ writeFileSync2(configPath, `${START_MARKER}
1021
+ ${existing.trim()}
1022
+ ${END_MARKER}
1023
+ `);
1024
+ } else {
1025
+ if (!existsSync2(backupPath)) {
1026
+ copyFileSync(configPath, backupPath);
1027
+ process.stderr.write(`exe-os: backed up existing Ghostty config to ${backupPath}
1028
+ `);
1029
+ }
1030
+ writeFileSync2(configPath, `${markedSection}
1031
+
1032
+ ${existing}`);
1033
+ }
1034
+ } else {
1035
+ writeFileSync2(configPath, `${markedSection}
1036
+ `);
1037
+ }
1038
+ process.stderr.write("exe-os: Ghostty config installed\n");
1039
+ }
1040
+ function summarizeSymlinkResults(results) {
1041
+ if (results.length === 0) return "no employees in roster";
1042
+ const created = results.filter((r) => r.action === "created").length;
1043
+ const already = results.filter((r) => r.action === "already_correct").length;
1044
+ const conflicts = results.filter((r) => r.action === "conflict");
1045
+ let summary = `${created} created, ${already} already linked`;
1046
+ if (conflicts.length > 0) {
1047
+ const details = conflicts.map((r) => `${r.agentId} (${r.conflict ?? "unknown"})`).join(", ");
1048
+ summary += `, ${conflicts.length} conflict(s): ${details}`;
1049
+ }
1050
+ return summary;
1051
+ }
1052
+
1053
+ export {
1054
+ mcpHttpUrl,
1055
+ buildMcpHttpHeaders,
1056
+ resolvePackageRoot,
1057
+ copySlashCommands,
1058
+ detectMcpNameCollisions,
1059
+ registerMcpServer,
1060
+ mergeHooks,
1061
+ cleanOldShellFunctions,
1062
+ installStatusLine,
1063
+ runInstaller,
1064
+ setupTmux,
1065
+ setupGhostty
1066
+ };