@askexenow/exe-os 0.9.384 → 0.9.389

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/deploy/compose/.env.askexe-control-plane.example +6 -0
  2. package/deploy/compose/.env.customer.example +1 -1
  3. package/deploy/compose/.env.example +1 -1
  4. package/deploy/compose/docker-compose.yml +16 -0
  5. package/deploy/compose/generate-env.ts +1 -1
  6. package/deploy/compose/sso-edge/sso-redirect.conf +18 -3
  7. package/deploy/stack-manifests/v0.9.json +1160 -1
  8. package/dist/.dist-verified.json +3 -3
  9. package/dist/{active-agent-F5V4E4UL.js → active-agent-RZ24KSJN.js} +8 -6
  10. package/dist/{active-agent-YTBB4ZQM.js → active-agent-YWSWPIEA.js} +8 -6
  11. package/dist/{agent-defs-generator-7TFISIJQ.js → agent-defs-generator-GY3UBREJ.js} +8 -6
  12. package/dist/{agent-heartbeat-CQPGJIFF.js → agent-heartbeat-GUVUUQVM.js} +1 -1
  13. package/dist/{agent-loop-EZ7LDAGD.js → agent-loop-HPNCH3HK.js} +1 -1
  14. package/dist/{agentic-ontology-XVTUVV7W.js → agentic-ontology-RHYNXEKE.js} +1 -1
  15. package/dist/{artifact-backup-TF6YWQT2.js → artifact-backup-HGUFSIJH.js} +19 -6
  16. package/dist/{backfill-metadata-J6MXIDCW.js → backfill-metadata-XLFASEOD.js} +11 -9
  17. package/dist/{backup-verify-6DVBQMDP.js → backup-verify-TUQEICWA.js} +1 -1
  18. package/dist/{behavior-injection-XDA7ZCYN.js → behavior-injection-GXO7ERGN.js} +14 -12
  19. package/dist/{behavior-promotion-4VLQ7LXK.js → behavior-promotion-V63WIZ4N.js} +13 -11
  20. package/dist/{behaviors-SCCZP7RZ.js → behaviors-RMLDPLOF.js} +18 -11
  21. package/dist/bin/agentic-ontology-backfill.js +12 -10
  22. package/dist/bin/agentic-reflection-backfill.js +13 -11
  23. package/dist/bin/agentic-semantic-label.js +12 -10
  24. package/dist/bin/backfill-conversations.js +11 -9
  25. package/dist/bin/backfill-responses.js +11 -9
  26. package/dist/bin/backfill-vectors.js +13 -11
  27. package/dist/bin/bulk-sync-postgres.js +20 -18
  28. package/dist/bin/cc-doctor.js +15 -13
  29. package/dist/bin/cleanup-stale-review-tasks.js +44 -32
  30. package/dist/bin/cli.js +109 -30
  31. package/dist/bin/customer-readiness.js +55 -25
  32. package/dist/bin/deferred-daemon-restart.js +111 -108
  33. package/dist/bin/exe-actions.js +7 -1
  34. package/dist/bin/exe-agent-config.js +8 -6
  35. package/dist/bin/exe-agent.js +18 -16
  36. package/dist/bin/exe-assign.js +13 -11
  37. package/dist/bin/exe-boot.js +49 -47
  38. package/dist/bin/exe-call.js +9 -7
  39. package/dist/bin/exe-cicd.js +19 -8
  40. package/dist/bin/exe-cloud.js +59 -25
  41. package/dist/bin/exe-config-dump.js +8 -6
  42. package/dist/bin/exe-dispatch.js +23 -21
  43. package/dist/bin/exe-doctor.js +11 -8
  44. package/dist/bin/exe-export-behaviors.js +16 -14
  45. package/dist/bin/exe-forget.js +14 -12
  46. package/dist/bin/exe-gateway.js +12 -10
  47. package/dist/bin/exe-grant.js +6 -6
  48. package/dist/bin/exe-healthcheck.js +15 -13
  49. package/dist/bin/exe-heartbeat.js +28 -26
  50. package/dist/bin/exe-kill.js +28 -26
  51. package/dist/bin/exe-launch-agent.js +35 -33
  52. package/dist/bin/exe-mcp.js +9 -7
  53. package/dist/bin/exe-memory-reads.js +11 -9
  54. package/dist/bin/exe-new-employee.js +13 -11
  55. package/dist/bin/exe-os-mcp-proxy.js +9 -7
  56. package/dist/bin/exe-pending-messages.js +23 -21
  57. package/dist/bin/exe-pending-notifications.js +22 -20
  58. package/dist/bin/exe-pending-reviews.js +23 -21
  59. package/dist/bin/exe-preflight.js +1 -1
  60. package/dist/bin/exe-rename.js +9 -7
  61. package/dist/bin/exe-review.js +59 -55
  62. package/dist/bin/exe-search-quality.js +16 -3
  63. package/dist/bin/exe-search.js +13 -11
  64. package/dist/bin/exe-session-cleanup.js +29 -27
  65. package/dist/bin/exe-settings.js +22 -20
  66. package/dist/bin/exe-start-codex.js +23 -21
  67. package/dist/bin/exe-start-opencode.js +21 -19
  68. package/dist/bin/exe-status.js +24 -22
  69. package/dist/bin/exe-support.js +3 -3
  70. package/dist/bin/exe-team.js +8 -6
  71. package/dist/bin/exe-verify-running-images.js +644 -17
  72. package/dist/bin/git-sweep.js +24 -22
  73. package/dist/bin/graph-backfill.js +12 -10
  74. package/dist/bin/graph-export.js +12 -10
  75. package/dist/bin/hooks-cli.js +4 -4
  76. package/dist/bin/import-history.js +16 -14
  77. package/dist/bin/install.js +113 -110
  78. package/dist/bin/intercom-check.js +5 -5
  79. package/dist/bin/mcp-sessions.js +2 -2
  80. package/dist/bin/orchestration-metrics.js +8 -6
  81. package/dist/bin/postgres-agentic-reflection-backfill.js +2 -2
  82. package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
  83. package/dist/bin/pre-build-guard.js +55 -16
  84. package/dist/bin/pre-publish.js +1 -1
  85. package/dist/bin/prune-orphan-chunks.js +154 -28
  86. package/dist/bin/reconcile-backlog.js +5 -3
  87. package/dist/bin/registry-proxy.js +1 -1
  88. package/dist/bin/repair-document-chunks.js +11 -9
  89. package/dist/bin/scan-tasks.js +23 -21
  90. package/dist/bin/setup.js +3 -3
  91. package/dist/bin/shard-migrate.js +12 -10
  92. package/dist/bin/stack-update.js +622 -43
  93. package/dist/bin/verify-stack.js +2 -2
  94. package/dist/bin/vps-health-gate.js +1 -1
  95. package/dist/{boot-generation-Q7LGQ3AO.js → boot-generation-VCQXVYGT.js} +7 -5
  96. package/dist/{boot-review-sections-G5774FR5.js → boot-review-sections-3QO6Q7MP.js} +21 -19
  97. package/dist/{branch-hygiene-44WLSOZR.js → branch-hygiene-DDXXI6ZA.js} +59 -21
  98. package/dist/bug-landed-reconciler-TQVNOUCU.js +353 -0
  99. package/dist/build-manifest.json +1269 -1194
  100. package/dist/{capability-cards-I3RHCF4F.js → capability-cards-XPDLT6LU.js} +6 -4
  101. package/dist/{capacity-monitor-7I7GDONU.js → capacity-monitor-N3AW242L.js} +23 -21
  102. package/dist/{catchup-brief-3T5PARIR.js → catchup-brief-3PKX7FUP.js} +29 -27
  103. package/dist/{chunk-C5ISP5FO.js → chunk-2BKJAOO4.js} +11 -1
  104. package/dist/{chunk-JJTPPAZY.js → chunk-2CUQHG6H.js} +1609 -1356
  105. package/dist/{chunk-HU3VD4MQ.js → chunk-2Q2GGYBX.js} +1 -1
  106. package/dist/{chunk-CHIUS5QB.js → chunk-36LMIOVU.js} +9 -9
  107. package/dist/{chunk-46VSBDUW.js → chunk-3DCBDG4T.js} +2 -2
  108. package/dist/{chunk-W3KPQE7H.js → chunk-3GL3E4TD.js} +3 -3
  109. package/dist/{chunk-GL47M7NY.js → chunk-3UD3OF3X.js} +202 -117
  110. package/dist/{chunk-WNBZJSQT.js → chunk-3VW5ZP2F.js} +1 -1
  111. package/dist/{chunk-JDDM6C57.js → chunk-3X74IQBU.js} +1 -1
  112. package/dist/{chunk-NVFNADTX.js → chunk-3ZL4MDQ6.js} +18 -4
  113. package/dist/{chunk-R5E7WNAC.js → chunk-4ESNDGMB.js} +3 -3
  114. package/dist/{chunk-CYCIX7AW.js → chunk-4FLLIQRQ.js} +2 -2
  115. package/dist/{chunk-3RGTLZNO.js → chunk-4GAKF7KR.js} +99 -74
  116. package/dist/{chunk-RVO5O5SR.js → chunk-4S3A52AV.js} +38 -10
  117. package/dist/{chunk-7J2ZQ4XN.js → chunk-4VQ3QR6B.js} +29 -28
  118. package/dist/{chunk-MROSARM5.js → chunk-5BJBTFFQ.js} +7 -1
  119. package/dist/chunk-5LQZABW5.js +6 -0
  120. package/dist/chunk-5ONMHTNI.js +236 -0
  121. package/dist/{chunk-APL7HUE3.js → chunk-5QQJUO3F.js} +200 -31
  122. package/dist/{chunk-UOPCVFVR.js → chunk-5RK75SWH.js} +205 -278
  123. package/dist/{chunk-T5FEAQES.js → chunk-5TYJYGS5.js} +1 -1
  124. package/dist/{chunk-P3QQ52QK.js → chunk-5U6EOTZV.js} +3 -3
  125. package/dist/{chunk-ALRHGEAJ.js → chunk-637FL62O.js} +1 -1
  126. package/dist/{chunk-PUBA5B4M.js → chunk-6L4VIYLZ.js} +33 -19
  127. package/dist/{chunk-VF2KRROX.js → chunk-754P2UXM.js} +1 -1
  128. package/dist/{chunk-CM7N5MBY.js → chunk-7FZG7WP4.js} +5 -5
  129. package/dist/{chunk-NYLJQ2M2.js → chunk-7NEBFB3L.js} +4 -4
  130. package/dist/{chunk-E7C2WNR5.js → chunk-AEIOFFFX.js} +5 -5
  131. package/dist/{chunk-VOVFUKEB.js → chunk-AIB2EWO2.js} +5 -5
  132. package/dist/{chunk-EGOEB42T.js → chunk-AP2C4OGS.js} +3 -3
  133. package/dist/{chunk-MPZ2AVNS.js → chunk-ATNV3BVZ.js} +1 -1
  134. package/dist/{chunk-F4BBMIPG.js → chunk-B4XJQBQB.js} +2 -2
  135. package/dist/{chunk-BPVFZ6Q4.js → chunk-B5EGDNG6.js} +2 -2
  136. package/dist/{chunk-AGC2V7JS.js → chunk-B6CBN6EF.js} +1 -1
  137. package/dist/{chunk-KTKIFXIP.js → chunk-B7FDRN7G.js} +1 -1
  138. package/dist/{chunk-C5HUMAA7.js → chunk-B7WVYLAQ.js} +67 -15
  139. package/dist/chunk-BGVP5RMT.js +185 -0
  140. package/dist/{chunk-FVLNNNH6.js → chunk-BNI4LIU5.js} +35 -4
  141. package/dist/{chunk-P4XLIPB7.js → chunk-BU5JRLZT.js} +1 -1
  142. package/dist/{chunk-PHUHIVD5.js → chunk-C6U7XWOC.js} +34 -5
  143. package/dist/chunk-C7GHNJPW.js +8 -0
  144. package/dist/{chunk-4AR5XKCH.js → chunk-CL2MU3OX.js} +1 -1
  145. package/dist/{chunk-ZPP63JSQ.js → chunk-CL3AB7Z2.js} +1 -1
  146. package/dist/{chunk-FHIFTSPL.js → chunk-CP7XUSOF.js} +8 -3
  147. package/dist/{chunk-3OX34OC3.js → chunk-CUDNRHHT.js} +30 -10
  148. package/dist/chunk-CYUUNIEL.js +21 -0
  149. package/dist/{chunk-P2UY34XE.js → chunk-D4C57S2H.js} +5 -5
  150. package/dist/{chunk-XSUALA32.js → chunk-DDYFNBYV.js} +3 -3
  151. package/dist/{chunk-LSNBTGW4.js → chunk-DPYZW42H.js} +1 -1
  152. package/dist/{chunk-FMIYFHLE.js → chunk-E2PRXEZK.js} +9 -3
  153. package/dist/{chunk-L63V25HS.js → chunk-E54SPUYJ.js} +3 -3
  154. package/dist/{chunk-DMUOTCDN.js → chunk-E5CKRHIZ.js} +1 -1
  155. package/dist/{chunk-BV2IET6B.js → chunk-EVMOKRBC.js} +15 -2
  156. package/dist/{chunk-YLFCH3VA.js → chunk-FDWI3T6I.js} +133 -31
  157. package/dist/{chunk-PWC3C5ME.js → chunk-FNJTCJGY.js} +4 -4
  158. package/dist/{chunk-TNS63ATU.js → chunk-FWRPDSO3.js} +350 -50
  159. package/dist/{chunk-JA3Y5TV6.js → chunk-GDLB6BPM.js} +141 -74
  160. package/dist/{chunk-IGJMS7C5.js → chunk-GOVGG7HU.js} +2 -2
  161. package/dist/{chunk-MB47DRF5.js → chunk-GP7CTIUK.js} +2 -2
  162. package/dist/{chunk-L5EPGGDP.js → chunk-GWAN2BDB.js} +4 -4
  163. package/dist/{chunk-YRQ26MNP.js → chunk-H3YF7X4J.js} +12 -5
  164. package/dist/{chunk-VLBHZ6TF.js → chunk-H6PLIFUE.js} +2 -2
  165. package/dist/{chunk-GSLFH4AI.js → chunk-HRNM3N4Y.js} +6 -15
  166. package/dist/chunk-IG2ISRTF.js +48 -0
  167. package/dist/{chunk-MWEIBVBS.js → chunk-IJCWBYA5.js} +14 -1
  168. package/dist/{chunk-NKEFYE4R.js → chunk-IPTUKX3N.js} +1 -1
  169. package/dist/{chunk-RB3J2WYQ.js → chunk-IVE7H6KA.js} +1 -1
  170. package/dist/{chunk-HA63SH5W.js → chunk-IWY2OGQG.js} +1 -1
  171. package/dist/{chunk-BQEZPRUC.js → chunk-IZWMWJZT.js} +64 -46
  172. package/dist/{chunk-AHESD3KW.js → chunk-J4UVI652.js} +1 -1
  173. package/dist/{chunk-PLII76NJ.js → chunk-JBUCA4OX.js} +33 -6
  174. package/dist/{chunk-2PZTMSMG.js → chunk-JOF4HQDF.js} +5 -5
  175. package/dist/{chunk-OBBO6EJR.js → chunk-JQN3QGSF.js} +1 -1
  176. package/dist/{chunk-P4PIZOL2.js → chunk-JWYIH5DR.js} +3 -3
  177. package/dist/{chunk-3XY57PKT.js → chunk-KZLKE7I3.js} +210 -48
  178. package/dist/{chunk-DYVLEMKS.js → chunk-L3GXMYBK.js} +1 -1
  179. package/dist/{chunk-72V3S44T.js → chunk-LUA4SLJY.js} +46 -19
  180. package/dist/{chunk-ZT4LFTUJ.js → chunk-LW3JCBXP.js} +20 -3
  181. package/dist/{chunk-YLB365YX.js → chunk-M5XHN4OM.js} +3 -3
  182. package/dist/{chunk-VHHX4UCP.js → chunk-MDTWARSF.js} +22 -93
  183. package/dist/{chunk-JFJP6ATJ.js → chunk-MWKXQSF6.js} +3 -2
  184. package/dist/{chunk-VJEJ7JNB.js → chunk-N32DVIKY.js} +1 -1
  185. package/dist/{chunk-MUCNYSJP.js → chunk-NRLJOV7M.js} +32 -4
  186. package/dist/{chunk-PL4CFSQ7.js → chunk-NSXJOSH7.js} +1 -1
  187. package/dist/{chunk-NF5FOSLD.js → chunk-NVTG66CK.js} +1 -1
  188. package/dist/chunk-O45GBJEH.js +1500 -0
  189. package/dist/{chunk-4AAMFWJT.js → chunk-OHZSTZXN.js} +4 -2
  190. package/dist/chunk-OSIS7ZQW.js +344 -0
  191. package/dist/{chunk-E3ZM32LF.js → chunk-P22VFGFK.js} +14 -5
  192. package/dist/{chunk-KILR4FBR.js → chunk-PAFLR7WD.js} +3 -3
  193. package/dist/{chunk-R3CZWFFC.js → chunk-PEYQ6MWO.js} +15 -3
  194. package/dist/{chunk-RDWIKDMY.js → chunk-PZR54BEI.js} +8 -20
  195. package/dist/{chunk-2FKU4ZEO.js → chunk-QDBKMEYY.js} +9 -9
  196. package/dist/{chunk-7UHZBVP3.js → chunk-QDVLVLXP.js} +97 -31
  197. package/dist/{chunk-PRDDPQLC.js → chunk-QLXEQRHD.js} +5 -5
  198. package/dist/{chunk-MUAWCFW6.js → chunk-QNPDXV5V.js} +5 -2
  199. package/dist/{chunk-LR5O2XWZ.js → chunk-QUZYLDNJ.js} +5 -5
  200. package/dist/chunk-RBQUXHYK.js +48 -0
  201. package/dist/{chunk-3SUPEE6H.js → chunk-RDMBSHGG.js} +3 -3
  202. package/dist/{chunk-I5XIW2BP.js → chunk-RGUM474V.js} +7 -7
  203. package/dist/{chunk-OAFENIHN.js → chunk-RJ67XAJU.js} +76 -28
  204. package/dist/{chunk-LFUBEHFW.js → chunk-RT57D7C4.js} +39 -1
  205. package/dist/{chunk-MKM6D7JM.js → chunk-RWG7DLOG.js} +42 -5
  206. package/dist/{chunk-P3UX5EH4.js → chunk-RWKAHHIX.js} +3 -3
  207. package/dist/{chunk-XEBKIWI7.js → chunk-RYNT3HB7.js} +12 -12
  208. package/dist/{chunk-EUGEFBGV.js → chunk-S2V272KJ.js} +3 -3
  209. package/dist/{chunk-W6BZ4UGA.js → chunk-SGYEM2PD.js} +1 -1
  210. package/dist/{chunk-VROK4X2L.js → chunk-SJP57MQM.js} +1 -1
  211. package/dist/{chunk-5MVKTNZP.js → chunk-SL4JWAMQ.js} +54 -4
  212. package/dist/{chunk-MOANZQXF.js → chunk-SLMKLEU6.js} +1 -1
  213. package/dist/{chunk-RZN2LEAK.js → chunk-SQA7XCYI.js} +3 -3
  214. package/dist/{chunk-4YNA3CM6.js → chunk-SSFS4NCH.js} +262 -56
  215. package/dist/{chunk-6FIC57PH.js → chunk-T4P2G3PO.js} +1 -1
  216. package/dist/{chunk-5U2IJBFV.js → chunk-TA3B4N24.js} +1 -1
  217. package/dist/{chunk-ZOTTYCP5.js → chunk-TEWWBVQP.js} +40 -4
  218. package/dist/{chunk-SDYWZRPN.js → chunk-TLSFGXXE.js} +1 -1
  219. package/dist/{chunk-L3VUW5M4.js → chunk-TQS2YHLB.js} +1 -1
  220. package/dist/{chunk-KXYKSLW4.js → chunk-TU4M757W.js} +399 -116
  221. package/dist/{chunk-MC4IM2CC.js → chunk-TYD4F4XU.js} +6 -6
  222. package/dist/{chunk-TKS5GMYA.js → chunk-U44Y7RC7.js} +2 -0
  223. package/dist/{chunk-B7AMNZTC.js → chunk-UKBPEEEQ.js} +2 -2
  224. package/dist/{chunk-ZBPZDADW.js → chunk-UWVXQEQQ.js} +467 -78
  225. package/dist/{chunk-P2VVMGMI.js → chunk-V4WH3FV7.js} +35 -16
  226. package/dist/{worktree-ownership-guard-O6JQF2CL.js → chunk-V6F4I2XY.js} +13 -14
  227. package/dist/{chunk-JFTUAV4J.js → chunk-VBKUESIW.js} +1 -1
  228. package/dist/{chunk-AZSTIAVL.js → chunk-VBPYYJPC.js} +1 -1
  229. package/dist/{chunk-LKTN22L6.js → chunk-VIP4LKLO.js} +57 -24
  230. package/dist/{chunk-L5CGXEZC.js → chunk-WAAGVFFN.js} +63 -71
  231. package/dist/{chunk-D3LXVAIQ.js → chunk-WC7AE3PT.js} +244 -103
  232. package/dist/{chunk-EOTZSAQL.js → chunk-WUCUDHKR.js} +1 -1
  233. package/dist/{chunk-VF3BZOZK.js → chunk-X7HZHKY4.js} +50 -3
  234. package/dist/{chunk-LFBLQE2P.js → chunk-XCAKYVKI.js} +1 -1
  235. package/dist/{chunk-UXN4BICC.js → chunk-XMX5J52Z.js} +1 -1
  236. package/dist/{chunk-6YDY6ZTD.js → chunk-XTCXGWTV.js} +9 -4
  237. package/dist/{chunk-XUZK23V7.js → chunk-XW2FW6LS.js} +2 -2
  238. package/dist/{chunk-CH7BUBP3.js → chunk-XWVHUDEK.js} +5 -4
  239. package/dist/{chunk-S26CV7BE.js → chunk-YA5LK6KB.js} +45 -8
  240. package/dist/{chunk-ELCRJGCH.js → chunk-YMRQIENV.js} +2 -2
  241. package/dist/{chunk-QNZ4562V.js → chunk-Z3LXWCB7.js} +1 -1
  242. package/dist/{chunk-EYMFVITZ.js → chunk-Z7I6NQMA.js} +2 -2
  243. package/dist/{chunk-6BJCDWSM.js → chunk-ZB4FS2EG.js} +1 -1
  244. package/dist/{chunk-ZAEUEDTN.js → chunk-ZD6FZ3WL.js} +1 -1
  245. package/dist/{chunk-FEU6QEEL.js → chunk-ZM6EZAVY.js} +1 -0
  246. package/dist/{chunk-2KY7WZZF.js → chunk-ZPA4R2UI.js} +1 -1
  247. package/dist/chunk-ZPPPHVSU.js +285 -0
  248. package/dist/{chunk-ELEGH4DX.js → chunk-ZUGQPYUY.js} +51 -4
  249. package/dist/{chunk-UX2EO653.js → chunk-ZZWFZ46U.js} +66 -8
  250. package/dist/{cleanup-graph-garbage-VQAJ2RBT.js → cleanup-graph-garbage-HFUD5ZQT.js} +12 -10
  251. package/dist/{cloud-sync-command-J7NEFUY7.js → cloud-sync-command-3JHJJKPN.js} +25 -3
  252. package/dist/{cloud-sync-db-init-KWEMNMGA.js → cloud-sync-db-init-2LHIQOSF.js} +1 -1
  253. package/dist/{cloud-sync-shutdown-P63AUTUI.js → cloud-sync-shutdown-ZXAXA3Z7.js} +6 -4
  254. package/dist/{cloud-sync-state-QF3TMMJ4.js → cloud-sync-state-VSQFGPP6.js} +1 -1
  255. package/dist/{co-activation-7IHRPBZN.js → co-activation-NX4EH4AP.js} +6 -4
  256. package/dist/{co-occurrence-R5AG4OAU.js → co-occurrence-5LBYCW3U.js} +10 -8
  257. package/dist/{consent-passphrase-5ZBDJ5G7.js → consent-passphrase-65W3DJIJ.js} +2 -2
  258. package/dist/{content-extractor-ZLXC6GNR.js → content-extractor-OGXETBOX.js} +2 -2
  259. package/dist/{conversation-entity-extractor-7FRKLLBD.js → conversation-entity-extractor-FQCOAH4F.js} +5 -4
  260. package/dist/conversations-retention-XTBFJBUM.js +166 -0
  261. package/dist/{crdt-sync-IFRZOEIS.js → crdt-sync-7TDUBTLH.js} +4 -4
  262. package/dist/{crm-webhook-L2S63ASV.js → crm-webhook-776JTY55.js} +2 -2
  263. package/dist/{cto-delegation-gate-3WU7OHX7.js → cto-delegation-gate-ZNUWVYCN.js} +25 -23
  264. package/dist/{daemon-orchestration-3VQYKLOR.js → daemon-orchestration-76BOFDEP.js} +30 -24
  265. package/dist/{doc-graph-extractor-YIR5E7OF.js → doc-graph-extractor-F724KZJX.js} +10 -8
  266. package/dist/{documents-QEHPTYIY.js → documents-Q24V4GRD.js} +13 -11
  267. package/dist/{dreaming-LNFE7DTN.js → dreaming-IY6NQTSP.js} +27 -25
  268. package/dist/{employee-boot-brief-ZTXDYNWM.js → employee-boot-brief-CCTXO5DQ.js} +35 -29
  269. package/dist/{entity-boost-R5N6JWXD.js → entity-boost-XGOB7HDM.js} +1 -1
  270. package/dist/{exe-drift-WYSJVZFO.js → exe-drift-NEPXLNGP.js} +7 -5
  271. package/dist/{exe-export-GOLNAEAV.js → exe-export-ZHJQFKR2.js} +14 -12
  272. package/dist/{exe-import-U4BSI6OH.js → exe-import-7SVNI4FW.js} +14 -12
  273. package/dist/{exe-key-V42G3NGO.js → exe-key-QJKU56WZ.js} +119 -108
  274. package/dist/{exe-org-U4GLQ6OP.js → exe-org-SJXHLV6K.js} +76 -51
  275. package/dist/{exe-snapshot-U7ONBYNY.js → exe-snapshot-EFWPXTXE.js} +45 -36
  276. package/dist/{fast-db-init-W3NGKAEU.js → fast-db-init-BQZOQNT3.js} +1 -1
  277. package/dist/{founder-context-ZSIBRVDM.js → founder-context-KG2ZAOXY.js} +2 -2
  278. package/dist/{founder-monitor-envelope-L3IWZLFY.js → founder-monitor-envelope-NYB5LLU4.js} +4 -4
  279. package/dist/gateway/index.js +20 -18
  280. package/dist/{gateway-client-DJFCVIPT.js → gateway-client-ODMUXUL3.js} +1 -1
  281. package/dist/{git-staleness-OF24QXFZ.js → git-staleness-OPGEAJA7.js} +6 -4
  282. package/dist/{global-procedures-WSIOWO43.js → global-procedures-3KXY4LL6.js} +8 -6
  283. package/dist/{graph-auto-extract-IEVVN3L3.js → graph-auto-extract-I7H2F5NJ.js} +10 -8
  284. package/dist/{graph-query-JDZWAVCU.js → graph-query-E7JBSNY5.js} +1 -1
  285. package/dist/{graph-rag-BKAD2XQA.js → graph-rag-H24CMFP2.js} +5 -4
  286. package/dist/{hook-integrity-TPWDGX2M.js → hook-integrity-PGQ3OX4S.js} +1 -1
  287. package/dist/{hook-prefetch-FD6VGJJA.js → hook-prefetch-7AZJER6Z.js} +23 -21
  288. package/dist/hook-registration-liveness-NGQRFKAA.js +11 -0
  289. package/dist/hooks/bug-report-worker.js +26 -24
  290. package/dist/hooks/codex-stop-task-finalizer.js +28 -26
  291. package/dist/hooks/commit-complete.js +26 -24
  292. package/dist/hooks/error-recall.js +16 -14
  293. package/dist/hooks/exe-heartbeat-hook.js +9 -7
  294. package/dist/hooks/ingest-worker.js +12 -10
  295. package/dist/hooks/ingest.js +22 -17
  296. package/dist/hooks/instructions-loaded.js +11 -9
  297. package/dist/hooks/manifest.json +20 -20
  298. package/dist/hooks/notification.js +10 -8
  299. package/dist/hooks/post-compact.js +9 -7
  300. package/dist/hooks/post-tool-combined.js +14 -14
  301. package/dist/hooks/pre-compact.js +26 -24
  302. package/dist/hooks/pre-tool-use.js +2 -2
  303. package/dist/hooks/prompt-submit.js +47 -41
  304. package/dist/hooks/session-end.js +38 -42
  305. package/dist/hooks/session-start.js +26 -18
  306. package/dist/hooks/stop.js +29 -27
  307. package/dist/hooks/subagent-stop.js +29 -27
  308. package/dist/hooks/summary-worker.js +32 -30
  309. package/dist/index.js +37 -35
  310. package/dist/{installer-OTI5SA43.js → installer-2ZS3LHCU.js} +12 -9
  311. package/dist/{installer-NMOBSEZ2.js → installer-NH3A3HWC.js} +14 -9
  312. package/dist/{installer-SRJGE4GU.js → installer-UJ73PGRD.js} +21 -9
  313. package/dist/{intercom-queue-4FFXCBHO.js → intercom-queue-OE25GJF2.js} +21 -19
  314. package/dist/lib/agent-config.js +2 -2
  315. package/dist/lib/cloud-sync.js +24 -18
  316. package/dist/lib/consolidation.js +13 -11
  317. package/dist/lib/crypto.js +3 -3
  318. package/dist/lib/database.js +6 -4
  319. package/dist/lib/db-backup.js +1 -1
  320. package/dist/lib/db-write-worker-client.js +3 -1
  321. package/dist/lib/db-write-worker.js +65 -89
  322. package/dist/lib/db.js +6 -4
  323. package/dist/lib/delivery-truth.js +5 -1
  324. package/dist/lib/device-registry.js +1 -1
  325. package/dist/lib/embedder.js +2 -2
  326. package/dist/lib/employee-templates.js +9 -7
  327. package/dist/lib/employees.js +6 -4
  328. package/dist/lib/exe-daemon.js +425 -314
  329. package/dist/lib/file-grep.js +15 -21
  330. package/dist/lib/hybrid-search.js +19 -13
  331. package/dist/lib/identity-templates.js +1 -1
  332. package/dist/lib/identity.js +6 -4
  333. package/dist/lib/keychain.js +1 -1
  334. package/dist/lib/license.js +22 -6
  335. package/dist/lib/messaging.js +22 -20
  336. package/dist/lib/post-tool-memory.js +10 -8
  337. package/dist/lib/registry-proxy.js +1 -1
  338. package/dist/lib/reminders.js +7 -5
  339. package/dist/lib/runtime-table.js +1 -1
  340. package/dist/lib/schedules.js +12 -10
  341. package/dist/lib/session-registry.js +8 -6
  342. package/dist/lib/skill-learning.js +13 -11
  343. package/dist/lib/status-brief.js +2 -2
  344. package/dist/lib/store.js +17 -9
  345. package/dist/lib/task-router.js +7 -5
  346. package/dist/lib/tasks.js +23 -21
  347. package/dist/lib/tmux-routing.js +21 -19
  348. package/dist/lib/tmux-status.js +4 -1
  349. package/dist/lib/token-spend.js +7 -5
  350. package/dist/lib/ws-client.js +1 -1
  351. package/dist/{license-gate-R4JWTWM4.js → license-gate-XQ2KN5I5.js} +3 -3
  352. package/dist/{license-recheck-3MBJ4IJX.js → license-recheck-IIBKR2V5.js} +1 -1
  353. package/dist/{license-sync-BVSG3WMW.js → license-sync-76JVI2M5.js} +151 -8
  354. package/dist/{local-secret-inventory-JWNBHZZ4.js → local-secret-inventory-MJT7NJLY.js} +2 -2
  355. package/dist/{mailbox-inbox-MTAT4MXX.js → mailbox-inbox-BPZP4GIZ.js} +1 -1
  356. package/dist/maintenance-worker-54VZTFIK.js +371 -0
  357. package/dist/mcp/register-tools.js +110 -107
  358. package/dist/mcp/server.js +113 -110
  359. package/dist/mcp/tools/complete-reminder.js +8 -6
  360. package/dist/mcp/tools/create-reminder.js +8 -6
  361. package/dist/mcp/tools/create-task.js +26 -24
  362. package/dist/mcp/tools/deactivate-behavior.js +15 -13
  363. package/dist/mcp/tools/list-reminders.js +8 -6
  364. package/dist/mcp/tools/list-tasks.js +26 -24
  365. package/dist/mcp/tools/send-message.js +25 -23
  366. package/dist/mcp/tools/update-task.js +24 -22
  367. package/dist/{mcp-child-registry-TIZERM7O.js → mcp-child-registry-5VUG5ATZ.js} +1 -1
  368. package/dist/{mcp-http-config-VUMSFWFH.js → mcp-http-config-SKXESWHA.js} +9 -7
  369. package/dist/{mcp-session-identity-DZHWEJRV.js → mcp-session-identity-HYMLJXXA.js} +21 -19
  370. package/dist/{memory-cards-JVXTMSAT.js → memory-cards-PAZDUQ3B.js} +16 -32
  371. package/dist/{memory-graph-extractor-PPBJMYFJ.js → memory-graph-extractor-BC6QKBY6.js} +11 -9
  372. package/dist/{memory-poisoning-defense-K5Q74XQ4.js → memory-poisoning-defense-BRGIHF6J.js} +9 -7
  373. package/dist/{memory-pressure-watchdog-YMJH5CSA.js → memory-pressure-watchdog-HR6TPOMT.js} +22 -20
  374. package/dist/{memory-reflection-7BZWIHRE.js → memory-reflection-LO7VFBL3.js} +38 -59
  375. package/dist/memory-write-repository-J25USX63.js +16 -0
  376. package/dist/{monitor-grants-Q7X3MYQP.js → monitor-grants-YQTO6NWR.js} +3 -3
  377. package/dist/{monitor-identity-ZQB4IXEE.js → monitor-identity-POVTG76Y.js} +2 -2
  378. package/dist/{notification-ledger-XRAXL5OI.js → notification-ledger-KLD6GZTG.js} +22 -20
  379. package/dist/{notifications-JE3PX55X.js → notifications-3R6HNHDR.js} +21 -19
  380. package/dist/{orchestration-events-JCQ5F5IJ.js → orchestration-events-CHY3GOJD.js} +7 -5
  381. package/dist/{orchestrator-X65INDTR.js → orchestrator-GAL3HOAD.js} +23 -21
  382. package/dist/{org-brief-session-3PQ22UIX.js → org-brief-session-LQ2DBYVF.js} +17 -15
  383. package/dist/{org-consent-policy-VGELJ7K7.js → org-consent-policy-KFUP7QPG.js} +5 -5
  384. package/dist/{org-join-6TO5ZYUZ.js → org-join-MXZCIQWX.js} +8 -8
  385. package/dist/{org-key-admin-XHYVRRAZ.js → org-key-admin-4UK6QUT7.js} +9 -9
  386. package/dist/{org-key-pin-TTTYGTQL.js → org-key-pin-ZOX4OM3O.js} +3 -3
  387. package/dist/{org-membership-Y7T2BS57.js → org-membership-D5TPN45F.js} +4 -4
  388. package/dist/{org-partner-config-OP4NEUNF.js → org-partner-config-3FXSYPQA.js} +7 -7
  389. package/dist/{org-partner-runtime-YNVUNT2R.js → org-partner-runtime-TH3LMPII.js} +20 -16
  390. package/dist/{org-row-visibility-JBBXNYXD.js → org-row-visibility-Y5R33C5U.js} +1 -1
  391. package/dist/{pipeline-router-EIBB7QNG.js → pipeline-router-E2JZLDK6.js} +7 -5
  392. package/dist/{plan-limits-MEWXYLEN.js → plan-limits-NYI6R4IK.js} +9 -7
  393. package/dist/{platform-procedures-Z7ZGBJWN.js → platform-procedures-RTD5E3BD.js} +5 -3
  394. package/dist/{pre-tool-use-impl-C6KJY22W.js → pre-tool-use-impl-LT4FRXBP.js} +127 -83
  395. package/dist/{project-boot-VEYFCCSL.js → project-boot-LIMXQKAF.js} +25 -17
  396. package/dist/{project-name-UYORSNGE.js → project-name-V62GWALX.js} +7 -5
  397. package/dist/{projection-worker-WYFDWS57.js → projection-worker-KLE3IZQ2.js} +5 -2
  398. package/dist/{prospective-memory-E6XBQFJA.js → prospective-memory-HRN7JFT2.js} +6 -4
  399. package/dist/{push-notifications-M7YU63FY.js → push-notifications-XC6EQEXF.js} +22 -20
  400. package/dist/{reproject-worktree-memories-B5XMGJSD.js → reproject-worktree-memories-4CAVZSFE.js} +21 -19
  401. package/dist/{reranker-SRA4BR7N.js → reranker-2RU6IIX2.js} +1 -1
  402. package/dist/{retrieval-health-P2JPZUPV.js → retrieval-health-4Q5TOV2S.js} +1 -1
  403. package/dist/{review-polling-KQPN7IQE.js → review-polling-WOWIMBCL.js} +22 -20
  404. package/dist/runtime/index.js +30 -28
  405. package/dist/{session-events-6LDDKKY3.js → session-events-OPMS2C5F.js} +22 -20
  406. package/dist/{session-kill-telemetry-5DSRGWCL.js → session-kill-telemetry-3GWATSIX.js} +22 -20
  407. package/dist/{session-scope-XG5R3P3D.js → session-scope-TIRGR4MH.js} +21 -19
  408. package/dist/{setup-wizard-7QFLZIKT.js → setup-wizard-B2JBVGNH.js} +3 -3
  409. package/dist/{shard-manager-HHHHV2KZ.js → shard-manager-C7LYX6E4.js} +5 -1
  410. package/dist/{skill-refinement-I5RMAHSC.js → skill-refinement-FWQFYNBI.js} +7 -5
  411. package/dist/skill-retrieval-PPLFC5RY.js +166 -0
  412. package/dist/skill-usage-NDB67PU2.js +25 -0
  413. package/dist/{stack-generate-manifest-AKMZ3AUX.js → stack-generate-manifest-AXI55MEQ.js} +6 -6
  414. package/dist/{stack-promote-34CE2HHF.js → stack-promote-6N23OGZY.js} +6 -6
  415. package/dist/stack-release-2CXFYVWM.js +2770 -0
  416. package/dist/{stack-update-ZQQ5YYPJ.js → stack-update-U53FBVCQ.js} +13 -5
  417. package/dist/{steward-gate-AQJ6KT2C.js → steward-gate-TUA3QCN7.js} +7 -5
  418. package/dist/{subagent-brief-injection-3GU7YAWY.js → subagent-brief-injection-N52RWYFZ.js} +34 -32
  419. package/dist/{subagent-spawn-ledger-52I66CLW.js → subagent-spawn-ledger-OI23OT4I.js} +1 -1
  420. package/dist/support-bug-actions-XWCJI6S5.js +30 -0
  421. package/dist/support-inbox-MMVTCXRX.js +77 -0
  422. package/dist/{support-outbox-KNI3FR3G.js → support-outbox-2TG2UV6J.js} +2 -2
  423. package/dist/{task-enforcement-CAA6D2MH.js → task-enforcement-JDMBAAOY.js} +22 -20
  424. package/dist/{task-request-inbox-QBZVU66E.js → task-request-inbox-PKJCYKJV.js} +9 -5
  425. package/dist/{task-scope-NHXB4ZRN.js → task-scope-32HQEV6W.js} +27 -19
  426. package/dist/{tasks-crud-JHSWL5NM.js → tasks-crud-CYKUKS3F.js} +21 -19
  427. package/dist/{tasks-notify-7PBE4U7T.js → tasks-notify-YND5MKWJ.js} +22 -20
  428. package/dist/{tasks-review-PPPVEE62.js → tasks-review-CG2A5GM3.js} +23 -19
  429. package/dist/{telemetry-upload-YU2VRNHX.js → telemetry-upload-WLUMEFAB.js} +11 -9
  430. package/dist/{token-budget-QCMWKG3K.js → token-budget-3YHAY5LL.js} +7 -5
  431. package/dist/{tool-capability-index-7AWQAJRP.js → tool-capability-index-2ADOWH43.js} +2 -2
  432. package/dist/{tool-gates-5Q3RSQEG.js → tool-gates-7ENOOYMR.js} +5 -3
  433. package/dist/{tool-gates-QD26D2NE.js → tool-gates-EKJTLVGN.js} +1 -1
  434. package/dist/{tool-telemetry-LTOIC64I.js → tool-telemetry-VUP7S6HC.js} +1 -1
  435. package/dist/tui/App.js +59 -35
  436. package/dist/{tui-data-NDBXD6U7.js → tui-data-BOQTOW2G.js} +25 -23
  437. package/dist/{update-support-BMJM4NG7.js → update-support-WT3S3AQ4.js} +21 -21
  438. package/dist/{whatsapp-QQLDAHUX.js → whatsapp-OZGIF2EM.js} +2 -2
  439. package/dist/{wiki-acl-W6WDCVCP.js → wiki-acl-LTEQJVDA.js} +1 -1
  440. package/dist/{work-claims-6DM32MGO.js → work-claims-CMV2GWIW.js} +8 -6
  441. package/dist/{work-state-heartbeat-HG7D4AWJ.js → work-state-heartbeat-S45TXK4M.js} +1 -1
  442. package/dist/{worker-gate-FTMW7GBB.js → worker-gate-7Z6NMM3G.js} +1 -1
  443. package/dist/{workflow-engine-ZWC6CCXE.js → workflow-engine-ZSQDXZQ7.js} +2 -2
  444. package/dist/{worktree-EMQCPGFE.js → worktree-NMWDVT6N.js} +8 -6
  445. package/dist/worktree-ownership-guard-ZVIWJAOP.js +35 -0
  446. package/dist/{worktree-sweep-XVUJZBXV.js → worktree-sweep-Q62ZIT3U.js} +9 -7
  447. package/package.json +14 -8
  448. package/release-notes.json +7 -41
  449. package/src/commands/exe/afk.md +6 -0
  450. package/src/commands/exe/call.md +6 -0
  451. package/src/commands/exe/employee-heartbeat.md +6 -0
  452. package/src/commands/exe/intercom.md +6 -0
  453. package/src/commands/exe/kill.md +6 -0
  454. package/src/commands/exe/launch.md +6 -0
  455. package/src/commands/exe/logs.md +1 -1
  456. package/src/commands/exe/sessions.md +6 -0
  457. package/src/commands/exe/setup.md +7 -3
  458. package/src/commands/exe/status.md +6 -0
  459. package/src/commands/exe-reference.md +25 -36
  460. package/src/commands/exe.md +19 -28
  461. package/stack.release.json +11 -11
  462. package/dist/chunk-3B6FLNLV.js +0 -30
  463. package/dist/chunk-FXU7JOXK.js +0 -6
  464. package/dist/chunk-QFAFKEB5.js +0 -820
  465. package/dist/conversations-retention-C4BLKFEL.js +0 -54
  466. package/dist/stack-release-5PGWV5D4.js +0 -1607
  467. package/dist/support-inbox-NY5TB3FN.js +0 -51
  468. /package/dist/{chunk-U2D6PJ5T.js → chunk-65G7ZTGE.js} +0 -0
  469. /package/dist/{chunk-DN3ZR3UE.js → chunk-CP7Z35MJ.js} +0 -0
  470. /package/dist/{chunk-XDVOGDBC.js → chunk-KBBWALJV.js} +0 -0
  471. /package/dist/{chunk-JRIH6I7D.js → chunk-LZXYPTY4.js} +0 -0
  472. /package/dist/{chunk-GIRD7O5X.js → chunk-MCWEW2SG.js} +0 -0
  473. /package/dist/{chunk-TKAU7IJ2.js → chunk-MQHUJLCA.js} +0 -0
  474. /package/dist/{chunk-M4XY4JRK.js → chunk-O53LTOXK.js} +0 -0
  475. /package/dist/{chunk-DZN7SDY2.js → chunk-OSVTH3SG.js} +0 -0
  476. /package/dist/{chunk-AJK2PVQW.js → chunk-QXXEXGX3.js} +0 -0
  477. /package/dist/{chunk-AWWDKF22.js → chunk-SFWNTO2F.js} +0 -0
  478. /package/dist/{chunk-2Q2CD6CD.js → chunk-WC5HF2FN.js} +0 -0
  479. /package/dist/{core-memory-O6D5UC3T.js → core-memory-MMMW3TF3.js} +0 -0
  480. /package/dist/{memory-isolation-EBFFC6HF.js → memory-isolation-67ACKQ2M.js} +0 -0
  481. /package/dist/{oauth-server-ZKBUHDFI.js → oauth-server-OILIKR7D.js} +0 -0
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  createMailboxInboxPoller,
3
3
  getMailboxInboxState
4
- } from "./chunk-BV2IET6B.js";
4
+ } from "./chunk-EVMOKRBC.js";
5
5
  import {
6
6
  registerDaemonScopedQueryChokepoint
7
- } from "./chunk-IGJMS7C5.js";
7
+ } from "./chunk-GOVGG7HU.js";
8
8
  import {
9
9
  orgPartnerModeActive,
10
10
  resolveOrgPartnerBindings,
11
11
  resolvePartnerIdentities,
12
12
  rosterKeyLookupFor
13
- } from "./chunk-VOVFUKEB.js";
13
+ } from "./chunk-AIB2EWO2.js";
14
14
  import {
15
15
  createDerivedSeqStore,
16
16
  createMailboxOpener,
@@ -19,7 +19,7 @@ import {
19
19
  isConsentMacPrimed,
20
20
  primeTaskOriginMarkerKey,
21
21
  scopedQueryChokepointStatus
22
- } from "./chunk-YLFCH3VA.js";
22
+ } from "./chunk-FDWI3T6I.js";
23
23
  import {
24
24
  flushMailboxOutbox
25
25
  } from "./chunk-3FGBBJYM.js";
@@ -187,6 +187,19 @@ async function startPollerFor(binding, opts, log) {
187
187
  poller.start();
188
188
  _pollers.push({ orgId: binding.orgId, poller });
189
189
  }
190
+ async function stopOrgPartnerPollerFor(orgId) {
191
+ const running = _pollers.filter((p) => p.orgId === orgId);
192
+ if (running.length === 0) return false;
193
+ _pollers = _pollers.filter((p) => p.orgId !== orgId);
194
+ for (const p of running) {
195
+ try {
196
+ p.poller.stop();
197
+ } catch {
198
+ }
199
+ }
200
+ await Promise.allSettled(running.map((p) => p.poller.drain()));
201
+ return true;
202
+ }
190
203
  function stopOrgPartnerRuntime() {
191
204
  for (const p of _pollers) {
192
205
  try {
@@ -217,6 +230,7 @@ export {
217
230
  orgPartnerRuntimeStatus,
218
231
  assertOrgPartnerRuntimeReady,
219
232
  initOrgPartnerRuntime,
233
+ stopOrgPartnerPollerFor,
220
234
  stopOrgPartnerRuntime,
221
235
  _resetOrgPartnerRuntimeForTests
222
236
  };
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  extractMemoryGraph
3
- } from "./chunk-P4PIZOL2.js";
3
+ } from "./chunk-JWYIH5DR.js";
4
4
  import {
5
5
  flushBatch,
6
6
  writeMemory
7
- } from "./chunk-UOPCVFVR.js";
7
+ } from "./chunk-5RK75SWH.js";
8
8
  import {
9
9
  extractKeywords
10
10
  } from "./chunk-CHCA3ZM2.js";
11
11
  import {
12
12
  getActiveAgent
13
- } from "./chunk-F4BBMIPG.js";
13
+ } from "./chunk-B4XJQBQB.js";
14
14
 
15
15
  // src/mcp/tools/import-conversations.ts
16
16
  import { z } from "zod";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  getActiveAgent
3
- } from "./chunk-F4BBMIPG.js";
3
+ } from "./chunk-B4XJQBQB.js";
4
4
  import {
5
5
  loadEmployeesSync
6
- } from "./chunk-GL47M7NY.js";
6
+ } from "./chunk-3UD3OF3X.js";
7
7
  import {
8
8
  resolveMcpHttpPort
9
9
  } from "./chunk-B6TI3TZT.js";
@@ -1,21 +1,22 @@
1
- import {
2
- filterWikiRecallResults
3
- } from "./chunk-M4XY4JRK.js";
4
1
  import {
5
2
  buildFtsMatch,
6
3
  buildFtsMatchWithModifiers,
7
4
  extractFtsModifiers,
8
5
  tokenizeForFts
9
6
  } from "./chunk-VMHZSZQJ.js";
7
+ import {
8
+ filterWikiRecallResults
9
+ } from "./chunk-O53LTOXK.js";
10
10
  import {
11
11
  attachDocumentMetadata,
12
12
  buildRawVisibilityFilter,
13
13
  buildStatusFilter,
14
14
  buildSystemStateExclusionFilter,
15
+ buildTemporalFilter,
15
16
  buildVisibilityTierFilter,
16
17
  buildWikiScopeFilter,
17
18
  searchMemories
18
- } from "./chunk-UOPCVFVR.js";
19
+ } from "./chunk-5RK75SWH.js";
19
20
  import {
20
21
  blobToVector
21
22
  } from "./chunk-OTVEIJUQ.js";
@@ -30,7 +31,7 @@ import {
30
31
  getClient,
31
32
  isFtsShadowCorruptionMessage,
32
33
  repairFtsTable
33
- } from "./chunk-GL47M7NY.js";
34
+ } from "./chunk-3UD3OF3X.js";
34
35
 
35
36
  // src/lib/memory-reads.ts
36
37
  import crypto from "crypto";
@@ -262,6 +263,10 @@ function logDaemonGraphFtsSkipOnce(terms) {
262
263
  );
263
264
  }
264
265
  function appendSessionScopeFilter(sql, args, options, columnPrefix = "") {
266
+ if (options?.strictSessionScope && options.sessionScope !== void 0) {
267
+ args.push(options.sessionScope ?? "");
268
+ return sql + ` AND COALESCE(${columnPrefix}session_scope, '') = ?`;
269
+ }
265
270
  if (!options?.sessionScope) return sql;
266
271
  sql += options.strictSessionScope ? ` AND ${columnPrefix}session_scope = ?` : ` AND (${columnPrefix}session_scope = ? OR ${columnPrefix}session_scope IS NULL)`;
267
272
  args.push(options.sessionScope);
@@ -292,19 +297,6 @@ var ABSTENTION_THRESHOLD = parseFloat(
292
297
  );
293
298
  var CONTRADICTION_TEMPORAL_BOOST = 1.5;
294
299
  var AFFINITY_BOOST = 0.3;
295
- function buildTemporalFilter(options, columnPrefix) {
296
- const asOf = options?.asOf;
297
- if (asOf) {
298
- return {
299
- clause: ` AND (${columnPrefix}valid_from IS NULL OR ${columnPrefix}valid_from <= ?) AND (${columnPrefix}invalid_at IS NULL OR ${columnPrefix}invalid_at > ?)`,
300
- args: [asOf, asOf]
301
- };
302
- }
303
- return {
304
- clause: ` AND ${columnPrefix}invalid_at IS NULL`,
305
- args: []
306
- };
307
- }
308
300
  function appendMemoryTypeFilter(sql, args, column, options) {
309
301
  if (options?.memoryTypes && options.memoryTypes.length > 0) {
310
302
  const uniqueTypes = [...new Set(options.memoryTypes)];
@@ -316,13 +308,36 @@ function appendMemoryTypeFilter(sql, args, column, options) {
316
308
  }
317
309
  return sql;
318
310
  }
311
+ var GRAPH_ARM_TIMEOUT_MS = 2e3;
312
+ async function runGraphArm(search, timeoutMs = GRAPH_ARM_TIMEOUT_MS) {
313
+ const TIMED_OUT = /* @__PURE__ */ Symbol("graph-arm-timeout");
314
+ let timer;
315
+ try {
316
+ const raced = await Promise.race([
317
+ search.then((results) => results),
318
+ new Promise((resolve) => {
319
+ timer = setTimeout(() => resolve(TIMED_OUT), timeoutMs);
320
+ })
321
+ ]);
322
+ if (raced === TIMED_OUT) {
323
+ search.catch(() => {
324
+ });
325
+ return { status: "timeout", results: [] };
326
+ }
327
+ return Array.isArray(raced) ? { status: "ran", results: raced } : raced;
328
+ } catch (err) {
329
+ return { status: "error", results: [], detail: err instanceof Error ? err.message : String(err) };
330
+ } finally {
331
+ if (timer) clearTimeout(timer);
332
+ }
333
+ }
319
334
  async function graphSearch(query, agentId, options, limit) {
320
335
  const client = getClient();
321
336
  const queryWords = tokenizeForFts(query, { maxTerms: 16 });
322
- if (queryWords.length === 0) return [];
337
+ if (queryWords.length === 0) return { status: "skipped", results: [] };
323
338
  if (isDaemonProcess() && queryWords.length >= DAEMON_SAFE_FTS_TERM_THRESHOLD) {
324
339
  logDaemonGraphFtsSkipOnce(queryWords);
325
- return [];
340
+ return { status: "skipped", results: [] };
326
341
  }
327
342
  let entityIds = [];
328
343
  try {
@@ -338,17 +353,13 @@ async function graphSearch(query, agentId, options, limit) {
338
353
  });
339
354
  entityIds = ftsResult.rows.map((r) => String(r.id));
340
355
  } catch {
341
- try {
342
- const conditions = queryWords.map(() => `LOWER(name) LIKE ? ESCAPE '\\'`);
343
- const args = queryWords.map((w) => `%${escapeLikePattern(w)}%`);
344
- const likeResult = await client.execute({
345
- sql: `SELECT id FROM entities WHERE ${conditions.join(" OR ")} LIMIT 10`,
346
- args: [...args]
347
- });
348
- entityIds = likeResult.rows.map((r) => String(r.id));
349
- } catch {
350
- return [];
351
- }
356
+ const conditions = queryWords.map(() => `LOWER(name) LIKE ? ESCAPE '\\'`);
357
+ const args = queryWords.map((w) => `%${escapeLikePattern(w)}%`);
358
+ const likeResult = await client.execute({
359
+ sql: `SELECT id FROM entities WHERE ${conditions.join(" OR ")} LIMIT 10`,
360
+ args: [...args]
361
+ });
362
+ entityIds = likeResult.rows.map((r) => String(r.id));
352
363
  }
353
364
  if (entityIds.length === 0) return [];
354
365
  const allEntityIds = new Set(entityIds);
@@ -370,7 +381,7 @@ async function graphSearch(query, agentId, options, limit) {
370
381
  }
371
382
  const entityIdArr = Array.from(allEntityIds);
372
383
  const placeholders = entityIdArr.map(() => "?").join(",");
373
- const { statusClause: statusFilter, draftClause: draftFilter } = buildStatusFilter(options, "m.", "\n ");
384
+ const { clause: eligibilityFilter } = buildStatusFilter(options, "m.", "\n ");
374
385
  const memArgs = [...entityIdArr, agentId];
375
386
  let memSql = `SELECT DISTINCT m.id, m.agent_id, m.agent_role, m.session_id, m.timestamp,
376
387
  m.tool_name, m.project_name, m.has_error, m.raw_text, m.vector,
@@ -380,7 +391,7 @@ async function graphSearch(query, agentId, options, limit) {
380
391
  FROM memories m
381
392
  JOIN entity_memories em ON m.id = em.memory_id
382
393
  WHERE em.entity_id IN (${placeholders})
383
- AND (m.agent_id = ? OR m.agent_id = 'wiki')${statusFilter}${draftFilter}
394
+ AND (m.agent_id = ? OR m.agent_id = 'wiki')${eligibilityFilter}
384
395
  AND COALESCE(m.confidence, 0.7) >= 0.3`;
385
396
  if (options?.agentRole) {
386
397
  memSql += `
@@ -398,15 +409,11 @@ async function graphSearch(query, agentId, options, limit) {
398
409
  ORDER BY m.importance DESC, m.timestamp DESC
399
410
  LIMIT ?`;
400
411
  memArgs.push(limit);
401
- try {
402
- const memResult = await client.execute({
403
- sql: memSql,
404
- args: memArgs
405
- });
406
- return memResult.rows.map((row) => rowToMemoryRecord(row));
407
- } catch {
408
- return [];
409
- }
412
+ const memResult = await client.execute({
413
+ sql: memSql,
414
+ args: memArgs
415
+ });
416
+ return memResult.rows.map((row) => rowToMemoryRecord(row));
410
417
  }
411
418
  function escapeLikePattern(value) {
412
419
  return value.replace(/[\\%_]/g, (ch) => `\\${ch}`);
@@ -586,7 +593,7 @@ async function hybridSearch(queryText, agentId, options) {
586
593
  let rerankerAvailable = false;
587
594
  if (process.env.EXE_IS_DAEMON === "1") {
588
595
  try {
589
- const { isRerankerAvailable } = await import("./reranker-SRA4BR7N.js");
596
+ const { isRerankerAvailable } = await import("./reranker-2RU6IIX2.js");
590
597
  rerankerAvailable = isRerankerAvailable();
591
598
  } catch {
592
599
  }
@@ -626,7 +633,7 @@ ${hydeDoc}`;
626
633
  if (config.fileGrepEnabled === true && !process.env.VITEST && !onFailOpenHotPath) {
627
634
  try {
628
635
  if (process.env.EXE_IS_DAEMON !== "1") {
629
- const { getProjectName } = await import("./project-name-UYORSNGE.js");
636
+ const { getProjectName } = await import("./project-name-V62GWALX.js");
630
637
  const projectRoot = process.cwd();
631
638
  const projectName = getProjectName(projectRoot);
632
639
  if (projectName && projectName !== "tmp") {
@@ -649,7 +656,7 @@ ${hydeDoc}`;
649
656
  (sq) => lightweightSearch(sq, agentId, { ...fetchOptions, limit: Math.min(fetchLimit, 20) }).catch(() => [])
650
657
  );
651
658
  const includeStructuredCards = effectiveIsBroad || effectiveOptions.includeStructuredCards === true;
652
- const [ftsResults, vectorResults, graphResults, cardResults, reflectionResults, grepResults, ...subqueryResults] = await Promise.all([
659
+ const [ftsResults, vectorResults, graphArm, cardResults, reflectionResults, grepResults, ...subqueryResults] = await Promise.all([
653
660
  lightweightSearch(effectiveQuery, agentId, fetchOptions),
654
661
  queryVector ? searchMemories(queryVector, agentId, fetchOptions).catch((err) => {
655
662
  if (!process.env.VITEST) {
@@ -659,14 +666,17 @@ ${hydeDoc}`;
659
666
  return [];
660
667
  }) : Promise.resolve([]),
661
668
  // Graph search: first-class parallel signal via entity → memory linkage.
662
- // Non-blocking with 2s timeout — graph is a bonus, not a requirement.
663
- Promise.race([
664
- graphSearch(effectiveQuery, agentId, fetchOptions, Math.min(fetchLimit, 20)),
665
- new Promise((resolve) => setTimeout(() => resolve([]), 2e3))
666
- ]).catch(() => []),
669
+ // Non-blocking with a timeout — graph is a bonus, not a requirement.
670
+ // Bug 62c4ad60: the outcome is TAGGED. This arm has three distinct endings —
671
+ // searched and matched nothing, timed out, threw — and all three used to
672
+ // resolve to the same `[]`, so `graph: 0` in the telemetry could not tell a
673
+ // legitimately empty result from a pillar that never ran at all. The graph
674
+ // is one of the three retrieval pillars the product's core claim rests on;
675
+ // it going dark has to be expressible, not merely survivable.
676
+ runGraphArm(graphSearch(effectiveQuery, agentId, fetchOptions, Math.min(fetchLimit, 20))),
667
677
  includeStructuredCards ? (async () => {
668
678
  try {
669
- const { searchMemoryCards } = await import("./memory-cards-JVXTMSAT.js");
679
+ const { searchMemoryCards } = await import("./memory-cards-PAZDUQ3B.js");
670
680
  return await searchMemoryCards(effectiveQuery, agentId, fetchOptions);
671
681
  } catch {
672
682
  return [];
@@ -675,15 +685,8 @@ ${hydeDoc}`;
675
685
  // Reflection insights: patterns, contradictions, summaries across sessions
676
686
  includeStructuredCards ? (async () => {
677
687
  try {
678
- const { searchReflections } = await import("./memory-reflection-7BZWIHRE.js");
679
- const insights = await searchReflections(effectiveQuery, agentId, 5, {
680
- includeArchived: options?.includeArchived,
681
- visibilityFilter: options?.visibilityFilter,
682
- // Bug 186c1317: propagate the hard agent_role filter into the
683
- // reflection arm so role-scoped recall does not leak reflections
684
- // grounded only in non-matching-role source memories.
685
- agentRole: fetchOptions.agentRole
686
- });
688
+ const { searchReflections } = await import("./memory-reflection-LO7VFBL3.js");
689
+ const insights = await searchReflections(effectiveQuery, agentId, 5, fetchOptions);
687
690
  return insights.map((ins) => ({
688
691
  id: ins.id,
689
692
  agent_id: ins.agent_id,
@@ -700,6 +703,13 @@ ${hydeDoc}`;
700
703
  grepPromise,
701
704
  ...subqueryPromises
702
705
  ]);
706
+ const graphResults = graphArm.results;
707
+ if (graphArm.status !== "ran" && !process.env.VITEST) {
708
+ process.stderr.write(
709
+ `[hybrid-search] GRAPH PILLAR DID NOT RUN (${graphArm.status})${graphArm.detail ? `: ${graphArm.detail}` : ""} \u2014 results are missing a retrieval pillar, not merely unmatched
710
+ `
711
+ );
712
+ }
703
713
  for (const r of ftsResults) {
704
714
  r._source = "fts";
705
715
  }
@@ -783,7 +793,7 @@ ${hydeDoc}`;
783
793
  let entityBoostRan = false;
784
794
  if (merged.length > 0) {
785
795
  try {
786
- const { applyEntityBoost } = await import("./entity-boost-R5N6JWXD.js");
796
+ const { applyEntityBoost } = await import("./entity-boost-XGOB7HDM.js");
787
797
  const boosted = await applyEntityBoost(merged, effectiveQuery, getClient());
788
798
  merged = boosted.results;
789
799
  graphContextMap = boosted.graphContext;
@@ -807,7 +817,7 @@ ${hydeDoc}`;
807
817
  try {
808
818
  let rerankedRecords;
809
819
  if (graphContextMap.size > 0) {
810
- const { rerankWithContext } = await import("./reranker-SRA4BR7N.js");
820
+ const { rerankWithContext } = await import("./reranker-2RU6IIX2.js");
811
821
  const candidates = merged.map((m) => ({
812
822
  text: m.raw_text,
813
823
  context: graphContextMap.get(m.id)
@@ -815,7 +825,7 @@ ${hydeDoc}`;
815
825
  const scored = await rerankWithContext(effectiveQuery, candidates, rerankReturnLimit);
816
826
  rerankedRecords = scored.map((s) => merged[s.index]);
817
827
  } else {
818
- const { rerank } = await import("./reranker-SRA4BR7N.js");
828
+ const { rerank } = await import("./reranker-2RU6IIX2.js");
819
829
  rerankedRecords = await rerank(effectiveQuery, merged, rerankReturnLimit);
820
830
  }
821
831
  if (rerankedRecords.length > 0) {
@@ -874,7 +884,12 @@ ${hydeDoc}`;
874
884
  signals: {
875
885
  fts: ftsResults.length,
876
886
  vector: vectorResults.length,
877
- graph: graphResults.length,
887
+ // Bug 62c4ad60: `graph` alone is ambiguous at 0. `graphStatus` carries
888
+ // which retrieval outcome produced it, and every consumer must keep
889
+ // them apart — collapsing them back into one number one layer up is
890
+ // exactly how this defect was created.
891
+ graph: graphArm.status === "ran" ? graphResults.length : null,
892
+ graphStatus: graphArm.status,
878
893
  cards: cardResults.length,
879
894
  reflections: reflectionResults.length,
880
895
  grep: grepResults.length,
@@ -1231,7 +1246,7 @@ async function lightweightSearch(queryText, agentId, options) {
1231
1246
  }
1232
1247
  if (results.length >= 2) {
1233
1248
  try {
1234
- const { recordCoActivations } = await import("./co-activation-7IHRPBZN.js");
1249
+ const { recordCoActivations } = await import("./co-activation-NX4EH4AP.js");
1235
1250
  const ids = results.slice(0, 10).map((r) => r.id);
1236
1251
  void recordCoActivations(ids).catch((e) => {
1237
1252
  try {
@@ -1247,7 +1262,7 @@ async function lightweightSearch(queryText, agentId, options) {
1247
1262
  }
1248
1263
  if (options?.includeStructuredCards !== true) return results;
1249
1264
  try {
1250
- const { searchMemoryCards } = await import("./memory-cards-JVXTMSAT.js");
1265
+ const { searchMemoryCards } = await import("./memory-cards-PAZDUQ3B.js");
1251
1266
  const cardResults = await searchMemoryCards(queryText, agentId, options);
1252
1267
  if (cardResults.length > 0) {
1253
1268
  return rrfMergeMulti([results, cardResults], limit, RRF_K, [1, 0.85]);
@@ -1257,7 +1272,7 @@ async function lightweightSearch(queryText, agentId, options) {
1257
1272
  return results;
1258
1273
  }
1259
1274
  async function ftsQuery(client, matchExpr, agentId, options, limit) {
1260
- const { statusClause: statusFilter, draftClause: draftFilter } = buildStatusFilter(options, "m.", "\n ");
1275
+ const { clause: eligibilityFilter } = buildStatusFilter(options, "m.", "\n ");
1261
1276
  let sql = `SELECT m.id, m.agent_id, m.agent_role, m.session_id, m.timestamp,
1262
1277
  m.tool_name, m.project_name,
1263
1278
  m.has_error, m.raw_text, m.vector, m.task_id,
@@ -1268,7 +1283,7 @@ async function ftsQuery(client, matchExpr, agentId, options, limit) {
1268
1283
  FROM memories m
1269
1284
  JOIN memories_fts fts ON m.rowid = fts.rowid
1270
1285
  WHERE memories_fts MATCH ?
1271
- AND (m.agent_id = ? OR m.agent_id = 'wiki')${statusFilter}${draftFilter}
1286
+ AND (m.agent_id = ? OR m.agent_id = 'wiki')${eligibilityFilter}
1272
1287
  AND COALESCE(m.confidence, 0.7) >= 0.3`;
1273
1288
  const args = [matchExpr, agentId];
1274
1289
  const temporal = buildTemporalFilter(options, "m.");
@@ -1417,7 +1432,7 @@ async function recentRecords(agentId, options, limit, textFilter) {
1417
1432
  }
1418
1433
  } catch {
1419
1434
  }
1420
- const { statusClause: statusFilter, draftClause: draftFilter } = buildStatusFilter(options, "", "\n ");
1435
+ const { clause: eligibilityFilter } = buildStatusFilter(options, "", "\n ");
1421
1436
  let sql = `SELECT id, agent_id, agent_role, session_id, timestamp,
1422
1437
  tool_name, project_name,
1423
1438
  has_error, raw_text, vector, task_id,
@@ -1426,7 +1441,7 @@ async function recentRecords(agentId, options, limit, textFilter) {
1426
1441
  char_offset, page_number,
1427
1442
  source_path, source_type, memory_type, strength
1428
1443
  FROM memories
1429
- WHERE (agent_id = ? OR agent_id = 'wiki')${statusFilter}${draftFilter}
1444
+ WHERE (agent_id = ? OR agent_id = 'wiki')${eligibilityFilter}
1430
1445
  AND COALESCE(confidence, 0.7) >= 0.3`;
1431
1446
  const args = [agentId];
1432
1447
  const temporal = buildTemporalFilter(options, "");
@@ -1551,7 +1566,7 @@ async function expandNeighborChunks(results, limit, agentId, options) {
1551
1566
  });
1552
1567
  if (pivotResult.rows.length === 0) continue;
1553
1568
  const pivotRowid = pivotResult.rows[0].rowid;
1554
- const { statusClause: neighborStatusFilter, draftClause: neighborDraftFilter } = buildStatusFilter(options, "", "\n ");
1569
+ const { clause: neighborEligibilityFilter } = buildStatusFilter(options, "", "\n ");
1555
1570
  const neighborVisibility = buildVisibilityTierFilter(options, "");
1556
1571
  let neighborSql = `SELECT id, agent_id, agent_role, session_id, timestamp,
1557
1572
  tool_name, project_name, has_error, raw_text, vector,
@@ -1563,7 +1578,7 @@ async function expandNeighborChunks(results, limit, agentId, options) {
1563
1578
  AND (agent_id = ? OR agent_id = 'wiki')
1564
1579
  AND id != ?
1565
1580
  AND rowid BETWEEN ? AND ?
1566
- ${options?.agentRole ? "AND LOWER(agent_role) = LOWER(?)" : ""}${neighborStatusFilter}${neighborDraftFilter}${neighborVisibility.clause}`;
1581
+ ${options?.agentRole ? "AND LOWER(agent_role) = LOWER(?)" : ""}${neighborEligibilityFilter}${neighborVisibility.clause}`;
1567
1582
  const neighborArgs = [
1568
1583
  documentId,
1569
1584
  agentId,
@@ -1579,6 +1594,14 @@ async function expandNeighborChunks(results, limit, agentId, options) {
1579
1594
  "memory_type",
1580
1595
  options
1581
1596
  );
1597
+ const neighborScope = buildWikiScopeFilter(options, "");
1598
+ const neighborTemporal = buildTemporalFilter(options, "");
1599
+ neighborSql += neighborScope.clause + neighborTemporal.clause;
1600
+ neighborArgs.push(...neighborScope.args, ...neighborTemporal.args);
1601
+ if (options?.projectName) {
1602
+ neighborSql += " AND project_name = ?";
1603
+ neighborArgs.push(options.projectName);
1604
+ }
1582
1605
  neighborSql = appendSessionScopeFilter(neighborSql, neighborArgs, options);
1583
1606
  neighborSql += `
1584
1607
  ORDER BY rowid`;
@@ -1644,7 +1667,7 @@ async function trajectoryBypass(queryText, agentId, options, limit) {
1644
1667
  if (!toolName) return null;
1645
1668
  try {
1646
1669
  const client = getClient();
1647
- const { statusClause: statusFilter, draftClause: draftFilter } = buildStatusFilter(options, "", "\n ");
1670
+ const { clause: eligibilityFilter } = buildStatusFilter(options, "", "\n ");
1648
1671
  let sql = `SELECT id, agent_id, agent_role, session_id, timestamp,
1649
1672
  tool_name, project_name,
1650
1673
  has_error, raw_text, vector, task_id,
@@ -1655,7 +1678,7 @@ async function trajectoryBypass(queryText, agentId, options, limit) {
1655
1678
  FROM memories
1656
1679
  WHERE trajectory IS NOT NULL
1657
1680
  AND json_extract(trajectory, '$.tool') = ?
1658
- AND (agent_id = ? OR agent_id = 'wiki')${statusFilter}${draftFilter}`;
1681
+ AND (agent_id = ? OR agent_id = 'wiki')${eligibilityFilter}`;
1659
1682
  const args = [toolName, agentId];
1660
1683
  const temporal = buildTemporalFilter(options, "");
1661
1684
  sql += temporal.clause;
@@ -1715,6 +1738,8 @@ async function trajectoryBypass(queryText, agentId, options, limit) {
1715
1738
  }
1716
1739
 
1717
1740
  export {
1741
+ GRAPH_ARM_TIMEOUT_MS,
1742
+ runGraphArm,
1718
1743
  hybridSearch,
1719
1744
  estimateCardinality,
1720
1745
  rrfMerge,
@@ -5,26 +5,26 @@ import {
5
5
  behaviorTruncationNotice,
6
6
  fetchInjectableBehaviors,
7
7
  selectInjectedBehaviors
8
- } from "./chunk-4AAMFWJT.js";
8
+ } from "./chunk-OHZSTZXN.js";
9
9
  import {
10
10
  countActiveBehaviors,
11
11
  listBehaviors
12
- } from "./chunk-S26CV7BE.js";
12
+ } from "./chunk-YA5LK6KB.js";
13
13
  import {
14
14
  lightweightSearch
15
- } from "./chunk-3RGTLZNO.js";
15
+ } from "./chunk-4GAKF7KR.js";
16
16
  import {
17
17
  getCurrentSessionScope
18
- } from "./chunk-7UHZBVP3.js";
18
+ } from "./chunk-QDVLVLXP.js";
19
19
  import {
20
20
  getSessionKey
21
21
  } from "./chunk-CVYC6DUW.js";
22
22
  import {
23
23
  getProjectName
24
- } from "./chunk-UX2EO653.js";
24
+ } from "./chunk-ZZWFZ46U.js";
25
25
  import {
26
26
  getClient
27
- } from "./chunk-GL47M7NY.js";
27
+ } from "./chunk-3UD3OF3X.js";
28
28
 
29
29
  // src/lib/session-summary.ts
30
30
  var MAX_CHARS = 800;
@@ -305,6 +305,18 @@ function renderBehaviorLine(row) {
305
305
  const scope = row.project_name ? ` (${row.project_name})` : "";
306
306
  return `- ${clip(`${tag}${row.content}${scope}`, BEHAVIOR_LINE_CAP)}`;
307
307
  }
308
+ var BEHAVIOR_SECTION_CHAR_BUDGET = 4e3;
309
+ function capBehaviorsToCharBudget(behaviors, budget) {
310
+ const kept = [];
311
+ let used = 0;
312
+ for (const b of behaviors) {
313
+ const lineLen = renderBehaviorLine(b).length + 1;
314
+ if (kept.length > 0 && used + lineLen > budget) break;
315
+ kept.push(b);
316
+ used += lineLen;
317
+ }
318
+ return kept;
319
+ }
308
320
  function renderBehaviorSection(behaviors, counts) {
309
321
  const lines = behaviors.map(renderBehaviorLine).join("\n");
310
322
  const notice = behaviorTruncationNotice(behaviors, counts);
@@ -324,7 +336,17 @@ async function activeBehaviorBrief(agentId, projectName) {
324
336
  safeCounts()
325
337
  ]);
326
338
  const injected = selectInjectedBehaviors(behaviors, BEHAVIOR_LIMIT);
327
- return renderBehaviorSection(injected, counts);
339
+ const rendered = capBehaviorsToCharBudget(injected, BEHAVIOR_SECTION_CHAR_BUDGET);
340
+ const notice = behaviorTruncationNotice(rendered, counts);
341
+ const text = renderBehaviorSection(rendered, counts);
342
+ if (rendered.length > 0) {
343
+ try {
344
+ const { recordBehaviorsConsulted } = await import("./skill-usage-NDB67PU2.js");
345
+ void recordBehaviorsConsulted(rendered.map((b) => b.id));
346
+ } catch {
347
+ }
348
+ }
349
+ return { text, notice };
328
350
  }
329
351
  function renderScratchSection(scratchDir, isolated) {
330
352
  const shared = [
@@ -356,7 +378,7 @@ async function buildEmployeeBootBriefInner(input, degraded) {
356
378
  runSection("session-context", () => lastSessionSummary(agentId, projectName, sessionScope ?? null, input.mode), "", degraded),
357
379
  runSection("working-memory", () => readWorkingMemory(agentId) ?? "", "", degraded),
358
380
  runSection("memories", () => recentProjectMemories(agentId, projectName, sessionScope ?? null, input.mode), "", degraded),
359
- runSection("behaviors", () => activeBehaviorBrief(agentId, projectName), "", degraded)
381
+ runSection("behaviors", () => activeBehaviorBrief(agentId, projectName), { text: "", notice: null }, degraded)
360
382
  ]);
361
383
  const instanceId = input.mode === "session-start" ? MAIN_LOOP_INSTANCE : input.agentInstanceId ?? "";
362
384
  const scratchIsolated = scratchInstanceSegment(instanceId).length > 0;
@@ -367,6 +389,10 @@ async function buildEmployeeBootBriefInner(input, degraded) {
367
389
  scratchDir = "";
368
390
  }
369
391
  const sections = [];
392
+ if (behaviors.notice) {
393
+ sections.push(`## \u26A0\uFE0F BEHAVIOR RULESET TRUNCATED \u2014 READ THIS FIRST
394
+ ${behaviors.notice}`);
395
+ }
370
396
  if (input.mode === "subagent") {
371
397
  sections.push(`## Employee Memory Brief
372
398
  Bound roster employee: **${agentId}**. Project: ${projectName}.`);
@@ -381,11 +407,11 @@ ${capBlock(workingMemory.trim(), WORKING_MEMORY_CAP)}`);
381
407
  if (memories) sections.push(`## Memory Brief
382
408
  Recent memories from this project:
383
409
  ${memories}`);
384
- if (behaviors) {
410
+ if (behaviors.text) {
385
411
  sections.push([
386
412
  "## Your Behavioral Memory",
387
413
  "These are validated patterns and corrections. Follow them.",
388
- behaviors
414
+ behaviors.text
389
415
  ].join("\n"));
390
416
  }
391
417
  return capBlock(sections.join("\n\n"), FINAL_CAP);
@@ -417,6 +443,8 @@ ${notice}`;
417
443
  }
418
444
 
419
445
  export {
446
+ BEHAVIOR_SECTION_CHAR_BUDGET,
447
+ capBehaviorsToCharBudget,
420
448
  renderBehaviorSection,
421
449
  buildEmployeeBootBrief
422
450
  };