@askexenow/exe-os 0.9.140 → 0.9.142

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 (277) hide show
  1. package/dist/{active-agent-GFBVE3ES.js → active-agent-OTOFSYIV.js} +6 -4
  2. package/dist/{active-agent-M3ZT74AM.js → active-agent-PNV6PKJK.js} +6 -4
  3. package/dist/{agentic-ontology-QRNPGDIM.js → agentic-ontology-GYJZMRNB.js} +1 -1
  4. package/dist/{backfill-metadata-DI7R3MXV.js → backfill-metadata-EDLDTB2G.js} +9 -11
  5. package/dist/{background-jobs-LUEOBAVF.js → background-jobs-TBUOKMJR.js} +3 -3
  6. package/dist/{behaviors-KTEEQ3KG.js → behaviors-GE4RY2HA.js} +5 -6
  7. package/dist/bin/age-ontology-load.js +3 -3
  8. package/dist/bin/agentic-ontology-backfill.js +9 -10
  9. package/dist/bin/agentic-reflection-backfill.js +10 -11
  10. package/dist/bin/agentic-semantic-label.js +9 -10
  11. package/dist/bin/backfill-conversations.js +11 -13
  12. package/dist/bin/backfill-responses.js +11 -13
  13. package/dist/bin/backfill-vectors.js +11 -12
  14. package/dist/bin/bulk-sync-postgres.js +10 -11
  15. package/dist/bin/cc-doctor.js +4 -4
  16. package/dist/bin/cleanup-stale-review-tasks.js +11 -12
  17. package/dist/bin/cli.js +18 -18
  18. package/dist/bin/exe-agent-config.js +6 -4
  19. package/dist/bin/exe-agent.js +7 -8
  20. package/dist/bin/exe-assign.js +12 -13
  21. package/dist/bin/exe-boot.js +23 -25
  22. package/dist/bin/exe-call.js +8 -9
  23. package/dist/bin/exe-cloud.js +9 -10
  24. package/dist/bin/exe-dispatch.js +11 -12
  25. package/dist/bin/exe-doctor.js +1 -1
  26. package/dist/bin/exe-export-behaviors.js +10 -11
  27. package/dist/bin/exe-forget.js +9 -10
  28. package/dist/bin/exe-gateway.js +9 -10
  29. package/dist/bin/exe-healthcheck.js +4 -4
  30. package/dist/bin/exe-heartbeat.js +13 -15
  31. package/dist/bin/exe-kill.js +9 -10
  32. package/dist/bin/exe-launch-agent.js +31 -19
  33. package/dist/bin/exe-new-employee.js +11 -12
  34. package/dist/bin/exe-pending-messages.js +12 -13
  35. package/dist/bin/exe-pending-notifications.js +11 -12
  36. package/dist/bin/exe-pending-reviews.js +11 -12
  37. package/dist/bin/exe-rename.js +13 -10
  38. package/dist/bin/exe-review.js +16 -18
  39. package/dist/bin/exe-search.js +8 -9
  40. package/dist/bin/exe-session-cleanup.js +16 -17
  41. package/dist/bin/exe-settings.js +9 -10
  42. package/dist/bin/exe-start-codex.js +16 -17
  43. package/dist/bin/exe-start-opencode.js +12 -13
  44. package/dist/bin/exe-status.js +12 -13
  45. package/dist/bin/exe-support.js +4 -4
  46. package/dist/bin/exe-team.js +7 -9
  47. package/dist/bin/git-sweep.js +11 -12
  48. package/dist/bin/graph-backfill.js +10 -10
  49. package/dist/bin/graph-export.js +8 -9
  50. package/dist/bin/install.js +10 -8
  51. package/dist/bin/intercom-check.js +4 -4
  52. package/dist/bin/postgres-agentic-reflection-backfill.js +5 -5
  53. package/dist/bin/postgres-agentic-semantic-backfill.js +4 -4
  54. package/dist/bin/pre-publish.js +1 -1
  55. package/dist/bin/scan-tasks.js +11 -12
  56. package/dist/bin/setup.js +4 -4
  57. package/dist/bin/shard-migrate.js +8 -9
  58. package/dist/bin/stack-update.js +3 -3
  59. package/dist/{branding-EKPE6CWW.js → branding-EKI27T6K.js} +2 -2
  60. package/dist/{capacity-monitor-HGD2C6CP.js → capacity-monitor-D3RGDLMN.js} +12 -13
  61. package/dist/{catchup-brief-OMDCLETB.js → catchup-brief-LD2QLE2D.js} +14 -15
  62. package/dist/{chunk-2JAEWE7P.js → chunk-25QUV6FU.js} +6 -6
  63. package/dist/{chunk-OIUPHIN2.js → chunk-2NWMGMNH.js} +9 -9
  64. package/dist/{chunk-CLIW2CES.js → chunk-32Z4GK25.js} +8 -10
  65. package/dist/{chunk-3SPQNGRT.js → chunk-4AZYVT6A.js} +1 -1
  66. package/dist/{chunk-5K3CCPNX.js → chunk-4CBBN2XD.js} +245 -111
  67. package/dist/{chunk-3WSH4P4Z.js → chunk-4GA5XZWY.js} +2 -2
  68. package/dist/{chunk-XUHFQHGZ.js → chunk-4JZNDVZH.js} +37 -4
  69. package/dist/{chunk-CSVYC6HH.js → chunk-4OHIVMHS.js} +1 -1
  70. package/dist/{chunk-STVJLWSA.js → chunk-4YSDLTCT.js} +4 -4
  71. package/dist/{chunk-UEWGUOXB.js → chunk-55LEDLDE.js} +499 -27
  72. package/dist/{chunk-UOCQQHZT.js → chunk-5PZ3HSGP.js} +87 -48
  73. package/dist/{chunk-7SVGVGE3.js → chunk-5UCBVXKO.js} +1 -1
  74. package/dist/{chunk-SQLEKC4E.js → chunk-6EZRMPDA.js} +1 -1
  75. package/dist/{chunk-35FFFDS2.js → chunk-6V6UTSOP.js} +1 -1
  76. package/dist/{chunk-LPG22IL5.js → chunk-7BPUBHGW.js} +2 -2
  77. package/dist/{chunk-4YNGDNDI.js → chunk-7M3DNYMR.js} +4 -4
  78. package/dist/{chunk-H24OVCAN.js → chunk-AJOZXJLJ.js} +1 -1
  79. package/dist/{chunk-YWCPAQBH.js → chunk-AOJHEMHE.js} +36 -15
  80. package/dist/{chunk-YYB6HGEY.js → chunk-BI3GMMTP.js} +1 -1
  81. package/dist/{chunk-3TTJPQAE.js → chunk-BKEJSHDE.js} +1 -1
  82. package/dist/{chunk-SCGCHM2H.js → chunk-BSSSCUQJ.js} +3 -3
  83. package/dist/{chunk-XDJWGR2S.js → chunk-CBSUVFZ7.js} +2 -2
  84. package/dist/{chunk-54MB5TNF.js → chunk-CHXX73NX.js} +2 -2
  85. package/dist/{chunk-5LJQSXUG.js → chunk-CK5ZAMWX.js} +3 -3
  86. package/dist/{chunk-VTZ4QOBS.js → chunk-CQX2WDI5.js} +1 -1
  87. package/dist/{chunk-7HZFWAIR.js → chunk-DH6N5G4T.js} +1 -1
  88. package/dist/{chunk-QVVV6DHI.js → chunk-DKWTDULH.js} +2 -2
  89. package/dist/{chunk-GUDCQBRY.js → chunk-DU4ZN7VF.js} +1 -1
  90. package/dist/{chunk-PS4UUDIG.js → chunk-DUDPJVAC.js} +5 -7
  91. package/dist/{chunk-5PB6BRLA.js → chunk-E2KEN3PG.js} +1 -1
  92. package/dist/{chunk-Q3MIJPXM.js → chunk-EAVACBVO.js} +2 -2
  93. package/dist/{chunk-FCO2K73K.js → chunk-EENNKZMN.js} +3 -3
  94. package/dist/{chunk-QUG6EMZQ.js → chunk-EZUWMBWA.js} +1 -1
  95. package/dist/{chunk-YKOW7KMK.js → chunk-F4OU2ETP.js} +23 -7
  96. package/dist/chunk-FZ23OZL3.js +78 -0
  97. package/dist/{chunk-KNEH2MGD.js → chunk-GIGLGGYL.js} +5 -5
  98. package/dist/{chunk-KNS5ETKF.js → chunk-GLVF7ENO.js} +1 -1
  99. package/dist/{chunk-D7BPHQGX.js → chunk-GOCW7Z6D.js} +2 -2
  100. package/dist/chunk-GUMRIUI5.js +63 -0
  101. package/dist/{chunk-HO4C7QMH.js → chunk-ITJMONDK.js} +1 -1
  102. package/dist/{chunk-OYBQKDV5.js → chunk-JAFHOB5P.js} +1 -1
  103. package/dist/{chunk-UE3BYGWY.js → chunk-JMMY24KD.js} +30 -15
  104. package/dist/{chunk-CYCRC2KN.js → chunk-JSVRX6IW.js} +30 -11
  105. package/dist/{chunk-ABCDEJUD.js → chunk-KCLL5ECT.js} +1 -1
  106. package/dist/{chunk-SPMZRVXK.js → chunk-LCZRXRB7.js} +2 -2
  107. package/dist/{chunk-XNWXVGEA.js → chunk-LD6WE7DK.js} +2 -2
  108. package/dist/{chunk-6EBG7VWN.js → chunk-LFVL3R6H.js} +2 -2
  109. package/dist/{chunk-RGKPVKUO.js → chunk-LGPTAJZC.js} +1 -1
  110. package/dist/{chunk-OX6D5AF3.js → chunk-LNX37VPO.js} +2 -2
  111. package/dist/{chunk-IU3CXV4S.js → chunk-LR3QFARI.js} +11 -11
  112. package/dist/{chunk-EWGZPTII.js → chunk-MQB2BE3I.js} +1 -1
  113. package/dist/{chunk-4ITOWLHX.js → chunk-MRX42FAS.js} +4 -6
  114. package/dist/{chunk-UCNCSKGH.js → chunk-N5MH3CN2.js} +3 -3
  115. package/dist/{chunk-QCJ3Y52V.js → chunk-NFX6MDEO.js} +1 -1
  116. package/dist/{chunk-F6PIXTHZ.js → chunk-NMG76472.js} +5 -7
  117. package/dist/{chunk-LUOLBU54.js → chunk-NMT6QFEE.js} +1 -1
  118. package/dist/{chunk-DEHYRM3I.js → chunk-NWUWTV7B.js} +1 -1
  119. package/dist/{chunk-2XUXMKX5.js → chunk-OC7FNHGA.js} +4 -4
  120. package/dist/{chunk-SPKE5ANC.js → chunk-OI3REUP5.js} +1 -1
  121. package/dist/{chunk-FLVDAA3Z.js → chunk-P2YTTKPR.js} +1 -1
  122. package/dist/{chunk-NX4WEVG6.js → chunk-Q53ZYTIU.js} +12 -8
  123. package/dist/{chunk-NTIWZFOJ.js → chunk-RZK7BZHP.js} +1 -1
  124. package/dist/{chunk-5WIEDLGY.js → chunk-S3FDCJNF.js} +6 -6
  125. package/dist/{chunk-SL47NHTE.js → chunk-SDYBAMPW.js} +2 -2
  126. package/dist/{chunk-2ZWYALO4.js → chunk-SFURTBMT.js} +1 -1
  127. package/dist/{chunk-HHV26QTD.js → chunk-SOHGHGWU.js} +5 -6
  128. package/dist/{chunk-73JE5PVU.js → chunk-TJI7DMBT.js} +7 -7
  129. package/dist/{chunk-O2RVWP3S.js → chunk-TSPBIMZV.js} +1 -1
  130. package/dist/{chunk-BZHXUKVC.js → chunk-U3Q3WNGY.js} +2 -2
  131. package/dist/{chunk-Z6BTUUPK.js → chunk-U7M7ZURS.js} +2 -2
  132. package/dist/{chunk-34O6PRWE.js → chunk-UB7E2FEB.js} +4 -6
  133. package/dist/{chunk-POU4ZLBM.js → chunk-UKCSMGNM.js} +2 -2
  134. package/dist/{chunk-BBVMIH76.js → chunk-UYFPFO6Q.js} +8 -8
  135. package/dist/{chunk-HIOFKHTO.js → chunk-UYNFWD54.js} +3 -3
  136. package/dist/{chunk-IG5XFUYJ.js → chunk-VA42PIIY.js} +25 -7
  137. package/dist/{chunk-DMFM77DV.js → chunk-WZDI6UJ6.js} +1 -1
  138. package/dist/{chunk-6LKDJ5WX.js → chunk-XOVQ43JR.js} +52 -10
  139. package/dist/{chunk-762FPANW.js → chunk-XRPIVNFS.js} +1 -1
  140. package/dist/{code-context-index-PIC37JSG.js → code-context-index-XCX6HB3T.js} +5 -5
  141. package/dist/{conversation-entity-extractor-HKSNDF4L.js → conversation-entity-extractor-FJNOZ4DO.js} +2 -1
  142. package/dist/{conversation-wiki-populator-7M5YYPXH.js → conversation-wiki-populator-HAW3EQD5.js} +1 -1
  143. package/dist/{crdt-sync-MDW6THU7.js → crdt-sync-WXVYQ5ZO.js} +1 -1
  144. package/dist/{crm-webhook-YZKCH7QB.js → crm-webhook-HGUHXI6W.js} +2 -2
  145. package/dist/{cto-delegation-gate-7SQNLKN7.js → cto-delegation-gate-RJ5EVOY3.js} +12 -14
  146. package/dist/{daemon-auth-6XMF4JG5.js → daemon-auth-VXM7MOF4.js} +3 -3
  147. package/dist/{daemon-orchestration-7YUD2H64.js → daemon-orchestration-3E3BIK7E.js} +14 -15
  148. package/dist/{db-backup-R4DLUO4C.js → db-backup-YHDR4SXR.js} +3 -3
  149. package/dist/{entity-boost-YQFREESI.js → entity-boost-27ENEPYC.js} +1 -1
  150. package/dist/{exe-drift-HKJONDA5.js → exe-drift-DBY7PC3H.js} +5 -7
  151. package/dist/{exe-export-TSZJEMWC.js → exe-export-FQPQCBDA.js} +9 -11
  152. package/dist/{exe-import-LAKNLCWI.js → exe-import-7CML2REU.js} +9 -11
  153. package/dist/{exe-key-ODHZVEGR.js → exe-key-KNR4LT2L.js} +5 -6
  154. package/dist/{exe-org-EVOEZY6H.js → exe-org-QKK7M6FR.js} +3 -3
  155. package/dist/{fast-db-init-6SRLEIFS.js → fast-db-init-ADRYLHUA.js} +1 -1
  156. package/dist/gateway/index.js +9 -10
  157. package/dist/{gateway-client-VFKE2WJX.js → gateway-client-CJNSI4GG.js} +1 -1
  158. package/dist/{git-staleness-H774CLPX.js → git-staleness-OL7J5CXL.js} +4 -5
  159. package/dist/{git-task-sweep-FMRECHV7.js → git-task-sweep-O4OIPQB3.js} +11 -12
  160. package/dist/{global-procedures-PYYMCJIW.js → global-procedures-L7AN2A5W.js} +6 -7
  161. package/dist/{graph-query-657O5JYJ.js → graph-query-JBQDJJFP.js} +2 -1
  162. package/dist/{graph-rag-ZE5N7C65.js → graph-rag-V3JU7GYG.js} +2 -1
  163. package/dist/{hook-integrity-S5EUKBL6.js → hook-integrity-HESSTSAK.js} +1 -1
  164. package/dist/hooks/bug-report-worker.js +13 -14
  165. package/dist/hooks/codex-stop-task-finalizer.js +13 -14
  166. package/dist/hooks/commit-complete.js +13 -14
  167. package/dist/hooks/error-recall.js +10 -11
  168. package/dist/hooks/exe-heartbeat-hook.js +6 -4
  169. package/dist/hooks/ingest-worker.js +6 -6
  170. package/dist/hooks/ingest.js +14 -12
  171. package/dist/hooks/instructions-loaded.js +10 -10
  172. package/dist/hooks/notification.js +7 -5
  173. package/dist/hooks/post-compact.js +12 -13
  174. package/dist/hooks/post-tool-combined.js +5 -5
  175. package/dist/hooks/pre-compact.js +17 -18
  176. package/dist/hooks/pre-tool-use.js +34 -17
  177. package/dist/hooks/prompt-submit.js +22 -23
  178. package/dist/hooks/session-end.js +21 -22
  179. package/dist/hooks/session-start.js +8 -8
  180. package/dist/hooks/stop.js +18 -19
  181. package/dist/hooks/subagent-stop.js +12 -13
  182. package/dist/hooks/summary-worker.js +23 -25
  183. package/dist/index.js +18 -19
  184. package/dist/{installer-MIBTZDDM.js → installer-4YA7JGL4.js} +9 -7
  185. package/dist/{installer-3RTZXZ57.js → installer-JF7ARD2O.js} +9 -7
  186. package/dist/{installer-4G4YDLGY.js → installer-ZF7VAXAE.js} +9 -7
  187. package/dist/{key-backup-status-6BBOUM2S.js → key-backup-status-M4W77D3P.js} +2 -2
  188. package/dist/lib/agent-config.js +3 -3
  189. package/dist/lib/cloud-sync.js +7 -8
  190. package/dist/lib/config.js +2 -2
  191. package/dist/lib/consolidation.js +8 -9
  192. package/dist/lib/database.js +4 -5
  193. package/dist/lib/db-daemon-client.js +4 -4
  194. package/dist/lib/db.js +4 -5
  195. package/dist/lib/device-registry.js +2 -2
  196. package/dist/lib/embedder.js +5 -5
  197. package/dist/lib/employee-templates.js +7 -8
  198. package/dist/lib/employees.js +7 -3
  199. package/dist/lib/exe-daemon-client.js +4 -4
  200. package/dist/lib/exe-daemon.js +151 -59
  201. package/dist/lib/hybrid-search.js +8 -9
  202. package/dist/lib/identity-templates.js +1 -1
  203. package/dist/lib/identity.js +6 -6
  204. package/dist/lib/keychain.js +1 -1
  205. package/dist/lib/license.js +3 -3
  206. package/dist/lib/messaging.js +11 -12
  207. package/dist/lib/reminders.js +5 -6
  208. package/dist/lib/schedules.js +8 -9
  209. package/dist/lib/skill-learning.js +6 -7
  210. package/dist/lib/status-brief.js +1 -1
  211. package/dist/lib/store.js +7 -8
  212. package/dist/lib/task-router.js +6 -4
  213. package/dist/lib/tasks.js +12 -13
  214. package/dist/lib/tmux-routing.js +10 -11
  215. package/dist/lib/token-spend.js +5 -6
  216. package/dist/lib/ws-client.js +1 -1
  217. package/dist/{license-gate-746LFKMY.js → license-gate-P6NDW4Z3.js} +4 -4
  218. package/dist/mcp/register-tools.js +64 -65
  219. package/dist/mcp/server.js +66 -67
  220. package/dist/mcp/tools/complete-reminder.js +6 -7
  221. package/dist/mcp/tools/create-reminder.js +6 -7
  222. package/dist/mcp/tools/create-task.js +14 -15
  223. package/dist/mcp/tools/deactivate-behavior.js +7 -8
  224. package/dist/mcp/tools/list-reminders.js +6 -7
  225. package/dist/mcp/tools/list-tasks.js +14 -15
  226. package/dist/mcp/tools/send-message.js +13 -14
  227. package/dist/mcp/tools/update-task.js +13 -14
  228. package/dist/{mcp-http-config-RD5MJYJD.js → mcp-http-config-TIY7CLWB.js} +6 -4
  229. package/dist/{memory-cards-CS3QQQST.js → memory-cards-MQBULX5V.js} +4 -5
  230. package/dist/{memory-poisoning-defense-XPM34UJQ.js → memory-poisoning-defense-EHSL5PZW.js} +4 -5
  231. package/dist/{memory-queue-B332RRFX.js → memory-queue-6YCGHJLQ.js} +3 -3
  232. package/dist/memory-queue-client-SZZDOZXE.js +14 -0
  233. package/dist/{memory-reflection-GH5BOH7A.js → memory-reflection-OTJBCQWK.js} +4 -5
  234. package/dist/message-queue-client-2YTGEB5H.js +92 -0
  235. package/dist/{notifications-WWROKWFT.js → notifications-APKWB63A.js} +10 -11
  236. package/dist/{orchestration-phase-SBCILK4O.js → orchestration-phase-365P32CD.js} +3 -3
  237. package/dist/{orchestrator-V3EMR3AU.js → orchestrator-W62CLQLP.js} +12 -13
  238. package/dist/{plan-limits-AMJUHUCR.js → plan-limits-BO2HMJ6S.js} +6 -7
  239. package/dist/{preferences-MW3BYTQ5.js → preferences-M7KQYRR2.js} +2 -2
  240. package/dist/{projection-worker-2YXEQRKI.js → projection-worker-6TGUPMLY.js} +3 -3
  241. package/dist/{push-notifications-NYQZGUJT.js → push-notifications-2SBCAIA2.js} +3 -3
  242. package/dist/{reranker-ZU3GWEBG.js → reranker-LV5BQIF4.js} +3 -3
  243. package/dist/runtime/index.js +13 -14
  244. package/dist/{session-events-RCAUFPNG.js → session-events-SR2WX2X4.js} +11 -12
  245. package/dist/{session-kill-telemetry-GUN2M2LJ.js → session-kill-telemetry-N2IKZK33.js} +5 -6
  246. package/dist/{session-scope-NGLL42BM.js → session-scope-S5DODJU4.js} +11 -12
  247. package/dist/setup-wizard-H4TZHU36.js +12 -0
  248. package/dist/{shard-manager-CIDCCPJ4.js → shard-manager-3MDFLDOZ.js} +3 -3
  249. package/dist/{task-enforcement-YMGIERU4.js → task-enforcement-L7EGD6LJ.js} +10 -11
  250. package/dist/{task-scope-RMJLXJ7S.js → task-scope-QNRAYD7S.js} +10 -11
  251. package/dist/{tasks-crud-ZRXPR3UB.js → tasks-crud-JHHIROCS.js} +10 -11
  252. package/dist/{tasks-review-NQUJR52I.js → tasks-review-TXMVOOFN.js} +10 -11
  253. package/dist/{tool-capability-index-6EKGND6H.js → tool-capability-index-7OF3LF4X.js} +1 -1
  254. package/dist/{tool-telemetry-4C6LTIPM.js → tool-telemetry-QPGPBV5R.js} +1 -1
  255. package/dist/tui/App.js +25 -26
  256. package/dist/{tui-data-A4GTAXBL.js → tui-data-65WM7L5Q.js} +10 -11
  257. package/dist/{worker-gate-H43H32OF.js → worker-gate-WM2RGEZE.js} +3 -3
  258. package/dist/{workflow-engine-EPWKDGHR.js → workflow-engine-PK2TC7UE.js} +2 -2
  259. package/package.json +1 -1
  260. package/release-notes.json +207 -199
  261. package/dist/chunk-MQV4UKTS.js +0 -142
  262. package/dist/chunk-X2IMCCM5.js +0 -49
  263. package/dist/chunk-ZHJNMC4W.js +0 -292
  264. package/dist/memory-queue-client-MPJ2B7RU.js +0 -14
  265. package/dist/setup-wizard-JAFJRWKE.js +0 -12
  266. /package/dist/{chunk-3RNNTTBH.js → chunk-267IKUT5.js} +0 -0
  267. /package/dist/{chunk-VEGDNUBO.js → chunk-72O7CSKA.js} +0 -0
  268. /package/dist/{chunk-ELXPFTBJ.js → chunk-7A2YCQNM.js} +0 -0
  269. /package/dist/{chunk-NBYMO4RZ.js → chunk-HBV3HSER.js} +0 -0
  270. /package/dist/{chunk-RCNCUSAF.js → chunk-JZB67O4M.js} +0 -0
  271. /package/dist/{chunk-OJ6Z2ZS2.js → chunk-NGAZPQQY.js} +0 -0
  272. /package/dist/{chunk-GSI6OPPH.js → chunk-NSA2JWNP.js} +0 -0
  273. /package/dist/{chunk-GLGWGMPD.js → chunk-XIIVMIS4.js} +0 -0
  274. /package/dist/{core-memory-JOTETVSY.js → core-memory-N74JWH4M.js} +0 -0
  275. /package/dist/{webhook-pipe-AFXVZ6YL.js → webhook-pipe-VOUF2Y43.js} +0 -0
  276. /package/dist/{wiki-acl-P7WEIMJV.js → wiki-acl-BIEVKTJC.js} +0 -0
  277. /package/dist/{wiki-client-UFR4R7YH.js → wiki-client-NGWOSMCV.js} +0 -0
@@ -1,17 +1,23 @@
1
1
  import {
2
2
  init_db_backup,
3
3
  listBackups
4
- } from "./chunk-7SVGVGE3.js";
4
+ } from "./chunk-5UCBVXKO.js";
5
5
  import {
6
6
  EMBEDDING_DIM,
7
7
  init_memory
8
8
  } from "./chunk-4NYQAS33.js";
9
9
  import {
10
- getCoordinatorName,
11
- init_employees
12
- } from "./chunk-ZHJNMC4W.js";
10
+ EXE_AI_DIR,
11
+ init_config
12
+ } from "./chunk-VA42PIIY.js";
13
13
  import {
14
- __esm
14
+ atomicWriteJson,
15
+ init_secure_files
16
+ } from "./chunk-FZ23OZL3.js";
17
+ import {
18
+ __esm,
19
+ __export,
20
+ __toCommonJS
15
21
  } from "./chunk-KFQGP6VL.js";
16
22
 
17
23
  // src/lib/db-retry.ts
@@ -69,9 +75,418 @@ var init_db_retry = __esm({
69
75
  }
70
76
  });
71
77
 
72
- // src/lib/database-adapter.ts
73
- import os from "os";
78
+ // src/lib/identity.ts
79
+ var identity_exports = {};
80
+ __export(identity_exports, {
81
+ getIdentity: () => getIdentity,
82
+ getIdentityInjection: () => getIdentityInjection,
83
+ identityPath: () => identityPath,
84
+ listIdentities: () => listIdentities,
85
+ updateIdentity: () => updateIdentity
86
+ });
87
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
88
+ import { readdirSync } from "fs";
74
89
  import path from "path";
90
+ import { createHash } from "crypto";
91
+ function ensureDir() {
92
+ if (!existsSync(IDENTITY_DIR)) {
93
+ mkdirSync(IDENTITY_DIR, { recursive: true });
94
+ }
95
+ }
96
+ function identityPath(agentId) {
97
+ return path.join(IDENTITY_DIR, `${agentId}.md`);
98
+ }
99
+ function sanitizeIdentityBody(body) {
100
+ return body.replace(/<!--[\s\S]*?-->/g, "").trim();
101
+ }
102
+ function parseFrontmatter(raw) {
103
+ const match = raw.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
104
+ if (!match) {
105
+ return {
106
+ frontmatter: {
107
+ role: "unknown",
108
+ title: "Unknown",
109
+ agent_id: "unknown",
110
+ org_level: "specialist",
111
+ created_by: "system",
112
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
113
+ },
114
+ body: sanitizeIdentityBody(raw)
115
+ };
116
+ }
117
+ const yamlStr = match[1];
118
+ const body = sanitizeIdentityBody(match[2]);
119
+ const fm = {};
120
+ for (const line of yamlStr.split("\n")) {
121
+ const kv = line.match(/^(\w+):\s*(.+)$/);
122
+ if (kv) fm[kv[1]] = kv[2].trim();
123
+ }
124
+ return {
125
+ frontmatter: {
126
+ role: fm.role ?? "unknown",
127
+ title: fm.title ?? "Unknown",
128
+ agent_id: fm.agent_id ?? "unknown",
129
+ org_level: fm.org_level ?? "specialist",
130
+ created_by: fm.created_by ?? "system",
131
+ updated_at: fm.updated_at ?? (/* @__PURE__ */ new Date()).toISOString()
132
+ },
133
+ body
134
+ };
135
+ }
136
+ function contentHash(content) {
137
+ return createHash("sha256").update(content).digest("hex").slice(0, 16);
138
+ }
139
+ function getIdentity(agentId) {
140
+ const filePath = identityPath(agentId);
141
+ if (!existsSync(filePath)) return null;
142
+ const raw = readFileSync(filePath, "utf-8");
143
+ const { frontmatter, body } = parseFrontmatter(raw);
144
+ return {
145
+ agentId,
146
+ frontmatter,
147
+ body,
148
+ raw,
149
+ contentHash: contentHash(raw)
150
+ };
151
+ }
152
+ async function updateIdentity(agentId, content, updatedBy) {
153
+ ensureDir();
154
+ const filePath = identityPath(agentId);
155
+ const hash = contentHash(content);
156
+ writeFileSync(filePath, content, "utf-8");
157
+ try {
158
+ const client = getClient();
159
+ await client.execute({
160
+ sql: `INSERT INTO identity (agent_id, content_hash, updated_at, updated_by)
161
+ VALUES (?, ?, ?, ?)
162
+ ON CONFLICT(agent_id) DO UPDATE SET
163
+ content_hash = excluded.content_hash,
164
+ updated_at = excluded.updated_at,
165
+ updated_by = excluded.updated_by`,
166
+ args: [agentId, hash, (/* @__PURE__ */ new Date()).toISOString(), updatedBy]
167
+ });
168
+ } catch {
169
+ }
170
+ }
171
+ function listIdentities() {
172
+ ensureDir();
173
+ const files = readdirSync(IDENTITY_DIR).filter((f) => f.endsWith(".md"));
174
+ const results = [];
175
+ for (const file of files) {
176
+ const agentId = file.replace(".md", "");
177
+ const identity = getIdentity(agentId);
178
+ if (!identity) continue;
179
+ const lines = identity.body.split("\n").filter((l) => l.trim() && !l.startsWith("#"));
180
+ const summary = lines[0]?.trim().slice(0, 120) ?? identity.frontmatter.title;
181
+ results.push({
182
+ agentId,
183
+ // User-facing/team-facing title only. `frontmatter.role` is internal
184
+ // routing metadata and must not leak as an external title.
185
+ title: identity.frontmatter.title,
186
+ summary
187
+ });
188
+ }
189
+ return results;
190
+ }
191
+ function getIdentityInjection(agentId) {
192
+ const own = getIdentity(agentId);
193
+ const all = listIdentities();
194
+ const parts = [];
195
+ if (own) {
196
+ parts.push(`## Your Identity (exe.md)
197
+ These define WHO YOU ARE. Non-negotiable. Permanent.
198
+
199
+ ${own.body}`);
200
+ }
201
+ const teamLines = all.filter((a) => a.agentId !== agentId).map((a) => `- ${a.agentId} (${a.title}): ${a.summary}`);
202
+ if (teamLines.length > 0) {
203
+ parts.push(`## Team Identities
204
+ ${teamLines.join("\n")}`);
205
+ }
206
+ return parts.join("\n\n");
207
+ }
208
+ var IDENTITY_DIR;
209
+ var init_identity = __esm({
210
+ "src/lib/identity.ts"() {
211
+ init_config();
212
+ init_database();
213
+ IDENTITY_DIR = path.join(EXE_AI_DIR, "identity");
214
+ }
215
+ });
216
+
217
+ // src/lib/employees.ts
218
+ var employees_exports = {};
219
+ __export(employees_exports, {
220
+ COORDINATOR_ROLE: () => COORDINATOR_ROLE,
221
+ DEFAULT_COORDINATOR_TEMPLATE_NAME: () => DEFAULT_COORDINATOR_TEMPLATE_NAME,
222
+ EMPLOYEES_PATH: () => EMPLOYEES_PATH,
223
+ addEmployee: () => addEmployee,
224
+ baseAgentName: () => baseAgentName,
225
+ canCoordinate: () => canCoordinate,
226
+ getCoordinatorDisplayTitle: () => getCoordinatorDisplayTitle,
227
+ getCoordinatorEmployee: () => getCoordinatorEmployee,
228
+ getCoordinatorName: () => getCoordinatorName,
229
+ getEmployee: () => getEmployee,
230
+ getEmployeeByRole: () => getEmployeeByRole,
231
+ getEmployeeNamesByRole: () => getEmployeeNamesByRole,
232
+ hasRole: () => hasRole,
233
+ hireEmployee: () => hireEmployee,
234
+ isCoordinatorName: () => isCoordinatorName,
235
+ isCoordinatorRole: () => isCoordinatorRole,
236
+ isMultiInstance: () => isMultiInstance,
237
+ loadEmployees: () => loadEmployees,
238
+ loadEmployeesSync: () => loadEmployeesSync,
239
+ normalizeRole: () => normalizeRole,
240
+ normalizeRosterCase: () => normalizeRosterCase,
241
+ registerBinSymlinks: () => registerBinSymlinks,
242
+ saveEmployees: () => saveEmployees,
243
+ validateEmployeeName: () => validateEmployeeName
244
+ });
245
+ import { readFile, mkdir } from "fs/promises";
246
+ import { existsSync as existsSync2, symlinkSync, readlinkSync, readFileSync as readFileSync2, renameSync, unlinkSync, writeFileSync as writeFileSync2 } from "fs";
247
+ import { execSync } from "child_process";
248
+ import path2 from "path";
249
+ import os from "os";
250
+ function normalizeRole(role) {
251
+ return (role ?? "").trim().toLowerCase();
252
+ }
253
+ function isCoordinatorRole(role) {
254
+ return normalizeRole(role) === normalizeRole(COORDINATOR_ROLE);
255
+ }
256
+ function getCoordinatorEmployee(employees) {
257
+ return employees.find((e) => isCoordinatorRole(e.role));
258
+ }
259
+ function getCoordinatorName(employees = loadEmployeesSync()) {
260
+ return getCoordinatorEmployee(employees)?.name ?? DEFAULT_COORDINATOR_TEMPLATE_NAME;
261
+ }
262
+ function getCoordinatorDisplayTitle(employees = loadEmployeesSync()) {
263
+ const coordinator = getCoordinatorEmployee(employees);
264
+ if (coordinator) {
265
+ try {
266
+ const { getIdentity: getIdentity2 } = (init_identity(), __toCommonJS(identity_exports));
267
+ const identity = getIdentity2(coordinator.name);
268
+ if (identity?.title) return identity.title;
269
+ } catch {
270
+ }
271
+ }
272
+ return "Coordinator";
273
+ }
274
+ function isCoordinatorName(agentName, employees = loadEmployeesSync()) {
275
+ if (!agentName) return false;
276
+ return agentName.toLowerCase() === getCoordinatorName(employees).toLowerCase();
277
+ }
278
+ function canCoordinate(agentName, agentRole, employees = loadEmployeesSync()) {
279
+ return agentName === "default" || isCoordinatorRole(agentRole) || isCoordinatorName(agentName, employees);
280
+ }
281
+ function validateEmployeeName(name) {
282
+ if (!name) {
283
+ return { valid: false, error: "Name is required" };
284
+ }
285
+ if (name.length > 32) {
286
+ return { valid: false, error: "Name must be 32 characters or fewer" };
287
+ }
288
+ if (!/^[a-z][a-z0-9]*$/.test(name)) {
289
+ return {
290
+ valid: false,
291
+ error: "Name must start with a letter and contain only lowercase alphanumeric characters"
292
+ };
293
+ }
294
+ return { valid: true };
295
+ }
296
+ async function loadEmployees(employeesPath = EMPLOYEES_PATH) {
297
+ if (!existsSync2(employeesPath)) {
298
+ return [];
299
+ }
300
+ const raw = await readFile(employeesPath, "utf-8");
301
+ try {
302
+ return JSON.parse(raw);
303
+ } catch {
304
+ return [];
305
+ }
306
+ }
307
+ async function saveEmployees(employees, employeesPath = EMPLOYEES_PATH) {
308
+ await mkdir(path2.dirname(employeesPath), { recursive: true });
309
+ await atomicWriteJson(employeesPath, employees);
310
+ }
311
+ function loadEmployeesSync(employeesPath = EMPLOYEES_PATH) {
312
+ if (!existsSync2(employeesPath)) return [];
313
+ try {
314
+ return JSON.parse(readFileSync2(employeesPath, "utf-8"));
315
+ } catch {
316
+ return [];
317
+ }
318
+ }
319
+ function getEmployee(employees, name) {
320
+ return employees.find((e) => e.name.toLowerCase() === name.toLowerCase());
321
+ }
322
+ function getEmployeeByRole(employees, role) {
323
+ const lower = role.toLowerCase();
324
+ return employees.find((e) => e.role.toLowerCase() === lower);
325
+ }
326
+ function getEmployeeNamesByRole(employees, role) {
327
+ const lower = role.toLowerCase();
328
+ return employees.filter((e) => e.role.toLowerCase() === lower).map((e) => e.name);
329
+ }
330
+ function hasRole(agentName, role) {
331
+ const employees = loadEmployeesSync();
332
+ const emp = getEmployee(employees, agentName);
333
+ return emp ? emp.role.toLowerCase() === role.toLowerCase() : false;
334
+ }
335
+ function baseAgentName(name, employees) {
336
+ const match = name.match(/^([a-zA-Z]+)\d+$/);
337
+ if (!match) return name;
338
+ const base = match[1];
339
+ const roster = employees ?? loadEmployeesSync();
340
+ if (getEmployee(roster, base)) return base;
341
+ return name;
342
+ }
343
+ function isMultiInstance(agentName, employees) {
344
+ const roster = employees ?? loadEmployeesSync();
345
+ const emp = getEmployee(roster, agentName);
346
+ if (!emp) return false;
347
+ return MULTI_INSTANCE_ROLES.has(emp.role.toLowerCase());
348
+ }
349
+ function addEmployee(employees, employee) {
350
+ const { systemPrompt: _legacyPrompt, ...rest } = employee;
351
+ const normalized = { ...rest, name: employee.name.toLowerCase() };
352
+ if (employees.some((e) => e.name.toLowerCase() === normalized.name)) {
353
+ throw new Error(`Employee '${normalized.name}' already exists`);
354
+ }
355
+ return [...employees, normalized];
356
+ }
357
+ function appendToCoordinatorTeam(employee) {
358
+ const coordinator = getCoordinatorEmployee(loadEmployeesSync());
359
+ if (!coordinator) return;
360
+ const idPath = path2.join(IDENTITY_DIR2, `${coordinator.name}.md`);
361
+ if (!existsSync2(idPath)) return;
362
+ const content = readFileSync2(idPath, "utf-8");
363
+ if (content.includes(`**${capitalize(employee.name)}`)) return;
364
+ const teamMatch = content.match(TEAM_SECTION_RE);
365
+ if (!teamMatch || teamMatch.index === void 0) return;
366
+ const afterTeam = content.slice(teamMatch.index + teamMatch[0].length);
367
+ const nextHeading = afterTeam.match(/\n## /);
368
+ const entry = `
369
+ **${capitalize(employee.name)} (${employee.role}):** Newly hired. Update this description as the role develops.
370
+ `;
371
+ let updated;
372
+ if (nextHeading && nextHeading.index !== void 0) {
373
+ const insertAt = teamMatch.index + teamMatch[0].length + nextHeading.index;
374
+ updated = content.slice(0, insertAt) + entry + content.slice(insertAt);
375
+ } else {
376
+ updated = content.trimEnd() + "\n" + entry;
377
+ }
378
+ writeFileSync2(idPath, updated, "utf-8");
379
+ }
380
+ function capitalize(s) {
381
+ return s.charAt(0).toUpperCase() + s.slice(1);
382
+ }
383
+ async function hireEmployee(employee) {
384
+ const employees = await loadEmployees();
385
+ const updated = addEmployee(employees, employee);
386
+ await saveEmployees(updated);
387
+ try {
388
+ appendToCoordinatorTeam(employee);
389
+ } catch {
390
+ }
391
+ try {
392
+ const { loadAgentConfig, saveAgentConfig } = await import("./lib/agent-config.js");
393
+ const config = loadAgentConfig();
394
+ const name = employee.name.toLowerCase();
395
+ if (!config[name] && config["default"]) {
396
+ config[name] = { ...config["default"] };
397
+ saveAgentConfig(config);
398
+ }
399
+ } catch {
400
+ }
401
+ return updated;
402
+ }
403
+ async function normalizeRosterCase(rosterPath) {
404
+ const employees = await loadEmployees(rosterPath);
405
+ let changed = false;
406
+ for (const emp of employees) {
407
+ if (emp.name !== emp.name.toLowerCase()) {
408
+ const oldName = emp.name;
409
+ emp.name = emp.name.toLowerCase();
410
+ changed = true;
411
+ try {
412
+ const identityDir = path2.join(os.homedir(), ".exe-os", "identity");
413
+ const oldPath = path2.join(identityDir, `${oldName}.md`);
414
+ const newPath = path2.join(identityDir, `${emp.name}.md`);
415
+ if (existsSync2(oldPath) && !existsSync2(newPath)) {
416
+ renameSync(oldPath, newPath);
417
+ } else if (existsSync2(oldPath) && oldPath !== newPath) {
418
+ const content = readFileSync2(oldPath, "utf-8");
419
+ writeFileSync2(newPath, content, "utf-8");
420
+ if (oldPath.toLowerCase() !== newPath.toLowerCase()) {
421
+ unlinkSync(oldPath);
422
+ }
423
+ }
424
+ } catch {
425
+ }
426
+ }
427
+ }
428
+ if (changed) {
429
+ await saveEmployees(employees, rosterPath);
430
+ }
431
+ return changed;
432
+ }
433
+ function findExeBin() {
434
+ try {
435
+ return execSync(process.platform === "win32" ? "where exe-os" : "which exe-os", { encoding: "utf8" }).trim();
436
+ } catch {
437
+ return null;
438
+ }
439
+ }
440
+ function registerBinSymlinks(name) {
441
+ const created = [];
442
+ const skipped = [];
443
+ const errors = [];
444
+ const exeBinPath = findExeBin();
445
+ if (!exeBinPath) {
446
+ errors.push("Could not find 'exe-os' in PATH");
447
+ return { created, skipped, errors };
448
+ }
449
+ const binDir = path2.dirname(exeBinPath);
450
+ let target;
451
+ try {
452
+ target = readlinkSync(exeBinPath);
453
+ } catch {
454
+ errors.push("Could not read 'exe' symlink");
455
+ return { created, skipped, errors };
456
+ }
457
+ for (const suffix of ["", "-opencode"]) {
458
+ const linkName = `${name}${suffix}`;
459
+ const linkPath = path2.join(binDir, linkName);
460
+ if (existsSync2(linkPath)) {
461
+ skipped.push(linkName);
462
+ continue;
463
+ }
464
+ try {
465
+ symlinkSync(target, linkPath);
466
+ created.push(linkName);
467
+ } catch (err) {
468
+ errors.push(`${linkName}: ${err instanceof Error ? err.message : String(err)}`);
469
+ }
470
+ }
471
+ return { created, skipped, errors };
472
+ }
473
+ var EMPLOYEES_PATH, DEFAULT_COORDINATOR_TEMPLATE_NAME, COORDINATOR_ROLE, MULTI_INSTANCE_ROLES, IDENTITY_DIR2, TEAM_SECTION_RE;
474
+ var init_employees = __esm({
475
+ "src/lib/employees.ts"() {
476
+ init_secure_files();
477
+ init_config();
478
+ EMPLOYEES_PATH = path2.join(EXE_AI_DIR, "exe-employees.json");
479
+ DEFAULT_COORDINATOR_TEMPLATE_NAME = "exe";
480
+ COORDINATOR_ROLE = "COO";
481
+ MULTI_INSTANCE_ROLES = /* @__PURE__ */ new Set(["principal engineer", "content production specialist", "staff code reviewer"]);
482
+ IDENTITY_DIR2 = path2.join(EXE_AI_DIR, "identity");
483
+ TEAM_SECTION_RE = /^## Team\b.*$/m;
484
+ }
485
+ });
486
+
487
+ // src/lib/database-adapter.ts
488
+ import os2 from "os";
489
+ import path3 from "path";
75
490
  import { createRequire } from "module";
76
491
  import { pathToFileURL } from "url";
77
492
  function quotedIdentifier(identifier) {
@@ -382,8 +797,8 @@ async function loadPrismaClient() {
382
797
  }
383
798
  return new PrismaClient2();
384
799
  }
385
- const exeDbRoot = process.env.EXE_DB_ROOT ?? path.join(os.homedir(), "exe-db");
386
- const requireFromExeDb = createRequire(path.join(exeDbRoot, "package.json"));
800
+ const exeDbRoot = process.env.EXE_DB_ROOT ?? path3.join(os2.homedir(), "exe-db");
801
+ const requireFromExeDb = createRequire(path3.join(exeDbRoot, "package.json"));
387
802
  const prismaEntry = requireFromExeDb.resolve("@prisma/client");
388
803
  const module = await import(pathToFileURL(prismaEntry).href);
389
804
  const PrismaClient = module.PrismaClient ?? module.default?.PrismaClient;
@@ -653,7 +1068,21 @@ var init_database_adapter = __esm({
653
1068
  });
654
1069
 
655
1070
  // src/lib/database.ts
656
- import { chmodSync, existsSync, statSync, copyFileSync, unlinkSync, openSync, closeSync, mkdirSync, renameSync } from "fs";
1071
+ var database_exports = {};
1072
+ __export(database_exports, {
1073
+ SOFT_DELETE_RETENTION_DAYS: () => SOFT_DELETE_RETENTION_DAYS,
1074
+ disposeDatabase: () => disposeDatabase,
1075
+ disposeTurso: () => disposeTurso,
1076
+ ensureSchema: () => ensureSchema,
1077
+ getClient: () => getClient,
1078
+ getRawClient: () => getRawClient,
1079
+ initDaemonClient: () => initDaemonClient,
1080
+ initDatabase: () => initDatabase,
1081
+ initTurso: () => initTurso,
1082
+ isInitialized: () => isInitialized,
1083
+ setExternalClient: () => setExternalClient
1084
+ });
1085
+ import { chmodSync, existsSync as existsSync3, statSync, copyFileSync, unlinkSync as unlinkSync2, openSync, closeSync, mkdirSync as mkdirSync2, renameSync as renameSync2 } from "fs";
657
1086
  import { createClient } from "@libsql/client";
658
1087
  import { homedir } from "os";
659
1088
  import { join } from "path";
@@ -666,7 +1095,7 @@ function logCatchDebug(context, err) {
666
1095
  }
667
1096
  }
668
1097
  function acquireDbLock() {
669
- mkdirSync(join(homedir(), ".exe-os"), { recursive: true });
1098
+ mkdirSync2(join(homedir(), ".exe-os"), { recursive: true });
670
1099
  try {
671
1100
  _lockFd = openSync(DB_LOCK_PATH, "wx");
672
1101
  } catch (err) {
@@ -674,7 +1103,7 @@ function acquireDbLock() {
674
1103
  try {
675
1104
  const lockStat = statSync(DB_LOCK_PATH);
676
1105
  if (Date.now() - lockStat.mtimeMs > 6e4) {
677
- unlinkSync(DB_LOCK_PATH);
1106
+ unlinkSync2(DB_LOCK_PATH);
678
1107
  _lockFd = openSync(DB_LOCK_PATH, "wx");
679
1108
  return;
680
1109
  }
@@ -699,7 +1128,7 @@ function releaseDbLock() {
699
1128
  _lockFd = null;
700
1129
  }
701
1130
  try {
702
- unlinkSync(DB_LOCK_PATH);
1131
+ unlinkSync2(DB_LOCK_PATH);
703
1132
  } catch (e) {
704
1133
  logCatchDebug("lock unlink", e);
705
1134
  }
@@ -736,12 +1165,12 @@ async function _attemptBackupRestore(config) {
736
1165
  const timestamp = Date.now();
737
1166
  const corruptPath = `${config.dbPath}.corrupt-${timestamp}`;
738
1167
  try {
739
- renameSync(config.dbPath, corruptPath);
1168
+ renameSync2(config.dbPath, corruptPath);
740
1169
  for (const suffix of ["-wal", "-shm"]) {
741
1170
  const sidePath = config.dbPath + suffix;
742
- if (existsSync(sidePath)) {
1171
+ if (existsSync3(sidePath)) {
743
1172
  try {
744
- renameSync(sidePath, corruptPath + suffix);
1173
+ renameSync2(sidePath, corruptPath + suffix);
745
1174
  } catch {
746
1175
  }
747
1176
  }
@@ -765,7 +1194,7 @@ async function _attemptBackupRestore(config) {
765
1194
  try {
766
1195
  copyFileSync(backup.path, config.dbPath);
767
1196
  const backupWal = backup.path + "-wal";
768
- if (existsSync(backupWal)) {
1197
+ if (existsSync3(backupWal)) {
769
1198
  copyFileSync(backupWal, config.dbPath + "-wal");
770
1199
  }
771
1200
  const opts = {
@@ -781,15 +1210,15 @@ async function _attemptBackupRestore(config) {
781
1210
  if (isCorrupt) {
782
1211
  testClient.close();
783
1212
  try {
784
- unlinkSync(config.dbPath);
1213
+ unlinkSync2(config.dbPath);
785
1214
  } catch {
786
1215
  }
787
1216
  try {
788
- unlinkSync(config.dbPath + "-wal");
1217
+ unlinkSync2(config.dbPath + "-wal");
789
1218
  } catch {
790
1219
  }
791
1220
  try {
792
- unlinkSync(config.dbPath + "-shm");
1221
+ unlinkSync2(config.dbPath + "-shm");
793
1222
  } catch {
794
1223
  }
795
1224
  process.stderr.write(
@@ -816,15 +1245,15 @@ async function _attemptBackupRestore(config) {
816
1245
  `
817
1246
  );
818
1247
  try {
819
- unlinkSync(config.dbPath);
1248
+ unlinkSync2(config.dbPath);
820
1249
  } catch {
821
1250
  }
822
1251
  try {
823
- unlinkSync(config.dbPath + "-wal");
1252
+ unlinkSync2(config.dbPath + "-wal");
824
1253
  } catch {
825
1254
  }
826
1255
  try {
827
- unlinkSync(config.dbPath + "-shm");
1256
+ unlinkSync2(config.dbPath + "-shm");
828
1257
  } catch {
829
1258
  }
830
1259
  continue;
@@ -839,14 +1268,14 @@ async function _attemptBackupRestore(config) {
839
1268
  }
840
1269
  async function initDatabase(config) {
841
1270
  acquireDbLock();
842
- if (existsSync(config.dbPath)) {
1271
+ if (existsSync3(config.dbPath)) {
843
1272
  const dbStat = statSync(config.dbPath);
844
1273
  if (dbStat.size === 0) {
845
1274
  const walPath = config.dbPath + "-wal";
846
- if (existsSync(walPath) && statSync(walPath).size > 0) {
1275
+ if (existsSync3(walPath) && statSync(walPath).size > 0) {
847
1276
  const backupPath = config.dbPath + ".zeroed-" + Date.now();
848
1277
  copyFileSync(config.dbPath, backupPath);
849
- unlinkSync(config.dbPath);
1278
+ unlinkSync2(config.dbPath);
850
1279
  process.stderr.write(
851
1280
  `[database] CRITICAL: DB was 0 bytes. Moved to ${backupPath}, attempting WAL recovery.
852
1281
  `
@@ -1796,6 +2225,16 @@ async function ensureSchema() {
1796
2225
  } catch (e) {
1797
2226
  logCatchDebug("migration", e);
1798
2227
  }
2228
+ try {
2229
+ await client.execute("ALTER TABLE entities ADD COLUMN parent_type TEXT");
2230
+ } catch (e) {
2231
+ logCatchDebug("migration", e);
2232
+ }
2233
+ try {
2234
+ await client.execute("CREATE INDEX IF NOT EXISTS idx_entities_parent_type ON entities(parent_type)");
2235
+ } catch (e) {
2236
+ logCatchDebug("migration", e);
2237
+ }
1799
2238
  for (const col of [
1800
2239
  "ALTER TABLE memories ADD COLUMN source_trust_level TEXT DEFAULT 'unknown'",
1801
2240
  "ALTER TABLE memories ADD COLUMN quarantined INTEGER DEFAULT 0",
@@ -2746,5 +3185,38 @@ export {
2746
3185
  ensureSchema,
2747
3186
  disposeTurso,
2748
3187
  disposeDatabase,
2749
- init_database
3188
+ database_exports,
3189
+ init_database,
3190
+ identityPath,
3191
+ getIdentity,
3192
+ updateIdentity,
3193
+ listIdentities,
3194
+ getIdentityInjection,
3195
+ init_identity,
3196
+ EMPLOYEES_PATH,
3197
+ DEFAULT_COORDINATOR_TEMPLATE_NAME,
3198
+ COORDINATOR_ROLE,
3199
+ normalizeRole,
3200
+ isCoordinatorRole,
3201
+ getCoordinatorEmployee,
3202
+ getCoordinatorName,
3203
+ getCoordinatorDisplayTitle,
3204
+ isCoordinatorName,
3205
+ canCoordinate,
3206
+ validateEmployeeName,
3207
+ loadEmployees,
3208
+ saveEmployees,
3209
+ loadEmployeesSync,
3210
+ getEmployee,
3211
+ getEmployeeByRole,
3212
+ getEmployeeNamesByRole,
3213
+ hasRole,
3214
+ baseAgentName,
3215
+ isMultiInstance,
3216
+ addEmployee,
3217
+ hireEmployee,
3218
+ normalizeRosterCase,
3219
+ registerBinSymlinks,
3220
+ employees_exports,
3221
+ init_employees
2750
3222
  };