@remnic/core 9.65.1 → 9.65.3

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 (576) hide show
  1. package/dist/access-admin-ops-surface.d.ts +44 -44
  2. package/dist/access-admin-ops-surface.js +36 -35
  3. package/dist/access-authorization-probe.d.ts +39 -40
  4. package/dist/access-authorization-probe.js +37 -36
  5. package/dist/access-boundary.d.ts +41 -185
  6. package/dist/access-boundary.js +36 -35
  7. package/dist/access-cli.js +110 -107
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-coding-context-resolution.d.ts +3 -1
  10. package/dist/access-extraction-force-flush.d.ts +25 -25
  11. package/dist/access-extraction-force-flush.js +36 -35
  12. package/dist/access-health-types.d.ts +3 -1
  13. package/dist/access-http-lcm-compaction.d.ts +39 -39
  14. package/dist/access-http-lifecycle-flush.d.ts +40 -41
  15. package/dist/access-http-offline-stream.d.ts +25 -25
  16. package/dist/access-http-query.d.ts +4 -2
  17. package/dist/access-http-query.js +38 -37
  18. package/dist/access-http.d.ts +51 -44
  19. package/dist/access-http.js +57 -56
  20. package/dist/access-identity-continuity-surface.d.ts +12 -12
  21. package/dist/access-identity-continuity-surface.js +36 -35
  22. package/dist/access-lcm-surface.d.ts +27 -27
  23. package/dist/access-lcm-surface.js +36 -35
  24. package/dist/access-mcp-admin-tools.d.ts +9 -1
  25. package/dist/access-mcp-admin-tools.js +3 -1
  26. package/dist/access-mcp-output-schemas.js +1 -1
  27. package/dist/access-mcp.d.ts +39 -39
  28. package/dist/access-mcp.js +50 -47
  29. package/dist/access-memory-search-fanout.d.ts +4 -2
  30. package/dist/{access-namespace-preflight-BKUnKsBv.d.ts → access-namespace-preflight-B7Usyz-K.d.ts} +1 -1
  31. package/dist/access-namespace-preflight.d.ts +5 -3
  32. package/dist/access-namespace-preflight.js +36 -35
  33. package/dist/access-observe-write-surface.d.ts +39 -39
  34. package/dist/access-observe-write-surface.js +36 -35
  35. package/dist/access-offline-manifest.d.ts +12 -12
  36. package/dist/access-offline-manifest.js +5 -5
  37. package/dist/access-operations-batch.js +41 -40
  38. package/dist/access-operations.d.ts +46 -47
  39. package/dist/access-operations.js +44 -43
  40. package/dist/access-recall-concurrency.d.ts +40 -40
  41. package/dist/access-recall-concurrency.js +36 -35
  42. package/dist/access-recall-response.d.ts +24 -24
  43. package/dist/access-recall-response.js +36 -35
  44. package/dist/access-recall-surface.d.ts +24 -24
  45. package/dist/access-recall-surface.js +36 -35
  46. package/dist/access-schema.d.ts +139 -139
  47. package/dist/access-schema.js +3 -3
  48. package/dist/{access-service-B1Lbb-nQ.d.ts → access-service-DkaIG3n8.d.ts} +688 -140
  49. package/dist/access-service-helpers.d.ts +40 -40
  50. package/dist/access-service.d.ts +47 -47
  51. package/dist/access-service.js +36 -35
  52. package/dist/access-surface-catalog.d.ts +41 -42
  53. package/dist/access-surface-catalog.js +44 -37
  54. package/dist/access-surface-catalog.js.map +1 -1
  55. package/dist/access-wearables-meetings-surface.d.ts +5 -3
  56. package/dist/action-confidence.d.ts +3 -1
  57. package/dist/active-memory-bridge.d.ts +3 -1
  58. package/dist/active-recall.d.ts +3 -1
  59. package/dist/active-recall.js +11 -1
  60. package/dist/active-recall.js.map +1 -1
  61. package/dist/adapters/index.js +4 -4
  62. package/dist/adapters/registry.js +2 -2
  63. package/dist/ambient-provenance.d.ts +3 -1
  64. package/dist/artifact-search.d.ts +3 -1
  65. package/dist/{auto-sync-5L7EUZ27.js → auto-sync-H64ZCNIR.js} +13 -5
  66. package/dist/{auto-sync-5L7EUZ27.js.map → auto-sync-H64ZCNIR.js.map} +1 -1
  67. package/dist/behavior-learner.d.ts +3 -1
  68. package/dist/behavior-signals.d.ts +3 -1
  69. package/dist/bootstrap.d.ts +12 -12
  70. package/dist/briefing-window.d.ts +4 -2
  71. package/dist/briefing.d.ts +4 -2
  72. package/dist/briefing.js +16 -15
  73. package/dist/buffer-surprise-report.d.ts +3 -1
  74. package/dist/buffer-turn-helpers.d.ts +3 -1
  75. package/dist/buffer.d.ts +4 -2
  76. package/dist/buffer.js +4 -4
  77. package/dist/bulk-import/index.d.ts +5 -3
  78. package/dist/calibration.d.ts +3 -1
  79. package/dist/calibration.js +1 -1
  80. package/dist/capabilities.d.ts +3 -1
  81. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  82. package/dist/{catalog-DjVhJoRM.d.ts → catalog-CX2BZEJh.d.ts} +1 -1
  83. package/dist/causal-behavior.d.ts +1 -1
  84. package/dist/causal-consolidation.d.ts +3 -1
  85. package/dist/causal-consolidation.js +20 -19
  86. package/dist/causal-consolidation.js.map +1 -1
  87. package/dist/causal-trajectory-graph.d.ts +1 -1
  88. package/dist/{chunk-MIBKEW7A.js → chunk-2VXWFYJE.js} +3 -3
  89. package/dist/{chunk-3YTTAGPB.js → chunk-3DVBKTSO.js} +2 -2
  90. package/dist/{chunk-EIR5VLIH.js → chunk-4K7IW3F7.js} +2 -2
  91. package/dist/chunk-4K7IW3F7.js.map +1 -0
  92. package/dist/{chunk-JTSVMJHV.js → chunk-4XDGYCZI.js} +3 -3
  93. package/dist/chunk-573TEZCD.js +88 -0
  94. package/dist/chunk-573TEZCD.js.map +1 -0
  95. package/dist/{chunk-HQSBYI5X.js → chunk-57HVIG5U.js} +2 -2
  96. package/dist/{chunk-PMVPCZJZ.js → chunk-6433HV72.js} +2 -2
  97. package/dist/{chunk-N6TRHP72.js → chunk-6TAX66IA.js} +2 -2
  98. package/dist/{chunk-AGKIG3YA.js → chunk-6VALIZKG.js} +2 -2
  99. package/dist/{chunk-YQ3CBLL4.js → chunk-76PL4XLG.js} +512 -8
  100. package/dist/chunk-76PL4XLG.js.map +1 -0
  101. package/dist/{chunk-4NZHHGVL.js → chunk-7BDZTALN.js} +4 -1
  102. package/dist/chunk-7BDZTALN.js.map +1 -0
  103. package/dist/{chunk-NS5ETDYD.js → chunk-7BEPVIH3.js} +3 -3
  104. package/dist/{chunk-JG22O53B.js → chunk-7CBKAQIG.js} +2 -1
  105. package/dist/chunk-7CBKAQIG.js.map +1 -0
  106. package/dist/{chunk-LYIZXQYY.js → chunk-7KFIMGMP.js} +2 -2
  107. package/dist/{chunk-LWVO2QZV.js → chunk-7QOO4LGC.js} +56 -56
  108. package/dist/chunk-AAXJNINV.js +55 -0
  109. package/dist/chunk-AAXJNINV.js.map +1 -0
  110. package/dist/{chunk-56BSXSHC.js → chunk-AB3A7EFH.js} +31 -2
  111. package/dist/{chunk-56BSXSHC.js.map → chunk-AB3A7EFH.js.map} +1 -1
  112. package/dist/{chunk-CCTVAVTT.js → chunk-AUO2LJ3K.js} +2 -2
  113. package/dist/{chunk-ALCJRQ72.js → chunk-AYDDB3XI.js} +2 -2
  114. package/dist/{chunk-3TMYV3LP.js → chunk-AYYGRVRP.js} +5 -5
  115. package/dist/{chunk-W6TSGWYS.js → chunk-AZAA5DNP.js} +2 -2
  116. package/dist/{chunk-WTOE7CW4.js → chunk-BKYPJUQL.js} +122 -16
  117. package/dist/chunk-BKYPJUQL.js.map +1 -0
  118. package/dist/{chunk-6JJT5AKI.js → chunk-BQUEAVNW.js} +2 -2
  119. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  120. package/dist/{chunk-CEH2AFXG.js → chunk-C24UZSFW.js} +6 -6
  121. package/dist/{chunk-ZPN7W3OP.js → chunk-CDUUDBWJ.js} +3 -3
  122. package/dist/{chunk-35NN3ZFA.js → chunk-CTVWELNK.js} +21 -3
  123. package/dist/chunk-CTVWELNK.js.map +1 -0
  124. package/dist/{chunk-Y23B2QXP.js → chunk-D27J626P.js} +2 -2
  125. package/dist/{chunk-2572MRP2.js → chunk-DHTQP334.js} +2 -2
  126. package/dist/{chunk-HJQZQUPC.js → chunk-DJZWNKFO.js} +5 -5
  127. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  128. package/dist/{chunk-VJ6ECBIP.js → chunk-E4MVQQVX.js} +2 -2
  129. package/dist/{chunk-SYJ6EKKE.js → chunk-EIVIB73I.js} +2 -2
  130. package/dist/{chunk-HUNSEO5U.js → chunk-EV3YFLCB.js} +2 -2
  131. package/dist/{chunk-GEULB2VI.js → chunk-FC7TIRFS.js} +21 -1
  132. package/dist/chunk-FC7TIRFS.js.map +1 -0
  133. package/dist/{chunk-VPGRXEAB.js → chunk-G57LQRP6.js} +2 -2
  134. package/dist/{chunk-BC4QD3FM.js → chunk-GN55KU2P.js} +2 -2
  135. package/dist/{chunk-4W6INNXO.js → chunk-GUXS322H.js} +2 -2
  136. package/dist/{chunk-DBXZZIDU.js → chunk-H5FW4S5Q.js} +434 -693
  137. package/dist/chunk-H5FW4S5Q.js.map +1 -0
  138. package/dist/chunk-I32NKXE2.js +879 -0
  139. package/dist/chunk-I32NKXE2.js.map +1 -0
  140. package/dist/{chunk-3MADV4YC.js → chunk-IQSC3V2E.js} +2 -2
  141. package/dist/{chunk-UYCIS6V5.js → chunk-JCWY73FK.js} +2 -2
  142. package/dist/{chunk-T42L3S6A.js → chunk-LBWQ65SX.js} +4 -4
  143. package/dist/{chunk-MSTNSVXI.js → chunk-LDBFXD4F.js} +2 -1
  144. package/dist/chunk-LDBFXD4F.js.map +1 -0
  145. package/dist/{chunk-CEQF6L5K.js → chunk-LUNJ3WFO.js} +9 -7
  146. package/dist/chunk-LUNJ3WFO.js.map +1 -0
  147. package/dist/{chunk-256FBCVX.js → chunk-M4AHBM72.js} +7 -7
  148. package/dist/{chunk-YEQEGSJA.js → chunk-MBDJJTAT.js} +3 -3
  149. package/dist/{chunk-IAY7YBXS.js → chunk-MRTUN665.js} +2 -2
  150. package/dist/{chunk-JFJ3MHGV.js → chunk-NXKJHSDN.js} +1 -1
  151. package/dist/chunk-NXKJHSDN.js.map +1 -0
  152. package/dist/{chunk-R3AAOKR2.js → chunk-NZWEEALH.js} +2 -2
  153. package/dist/{chunk-I2HTKOOP.js → chunk-ODZG724P.js} +2 -2
  154. package/dist/{chunk-7QFBLYFP.js → chunk-OJD4WS2E.js} +3 -3
  155. package/dist/{chunk-CUS6S7PN.js → chunk-OLWTCWQ2.js} +9 -9
  156. package/dist/chunk-OLWTCWQ2.js.map +1 -0
  157. package/dist/{chunk-53ENM6F6.js → chunk-P4DHENRE.js} +2 -2
  158. package/dist/{chunk-DEFI2QBT.js → chunk-PAYGC3BD.js} +52 -22
  159. package/dist/chunk-PAYGC3BD.js.map +1 -0
  160. package/dist/{chunk-KPBLJCCV.js → chunk-PDVQ5JU3.js} +2 -2
  161. package/dist/{chunk-7BY7V4YX.js → chunk-Q4WONDMJ.js} +4 -3
  162. package/dist/{chunk-7BY7V4YX.js.map → chunk-Q4WONDMJ.js.map} +1 -1
  163. package/dist/{chunk-ESCQ6LY7.js → chunk-QFMO32TO.js} +3 -3
  164. package/dist/{chunk-HQSPXTQO.js → chunk-QXIQPCCN.js} +1 -1
  165. package/dist/{chunk-CFRBTATE.js → chunk-R47WINCY.js} +3 -3
  166. package/dist/{chunk-G72IPMR7.js → chunk-R4OCGPSH.js} +2 -2
  167. package/dist/{chunk-LCU5R6TQ.js → chunk-RAIUTAZZ.js} +22 -3
  168. package/dist/chunk-RAIUTAZZ.js.map +1 -0
  169. package/dist/chunk-RIAM7DND.js +167 -0
  170. package/dist/chunk-RIAM7DND.js.map +1 -0
  171. package/dist/{chunk-VZVP2W4O.js → chunk-RK4WXUI2.js} +2 -2
  172. package/dist/{chunk-JBPKEARU.js → chunk-RKNJBZ55.js} +4 -4
  173. package/dist/{chunk-6L27N6YI.js → chunk-S7Q5CM7E.js} +2 -2
  174. package/dist/{chunk-CTQRPANJ.js → chunk-SVSRPG6M.js} +2 -2
  175. package/dist/{chunk-GXWDWOWP.js → chunk-TDKSCV62.js} +2 -2
  176. package/dist/{chunk-S2VBSTTA.js → chunk-THG4GYIE.js} +2 -2
  177. package/dist/{chunk-IXRC7EQG.js → chunk-TR7DGXGI.js} +2 -2
  178. package/dist/{chunk-63FHSH7E.js → chunk-TYUS5TLG.js} +4 -4
  179. package/dist/{chunk-7PWWGYGO.js → chunk-URHCUXKI.js} +2 -2
  180. package/dist/{chunk-Z54TXZ2F.js → chunk-VA5KMSAE.js} +16 -7
  181. package/dist/chunk-VA5KMSAE.js.map +1 -0
  182. package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
  183. package/dist/{chunk-MUJ4QFUQ.js → chunk-W4BMEGQA.js} +4 -4
  184. package/dist/{chunk-5HK3CJAR.js → chunk-W675UJCZ.js} +2 -2
  185. package/dist/{chunk-3PXVYJMC.js → chunk-WN5FSGLE.js} +2077 -215
  186. package/dist/chunk-WN5FSGLE.js.map +1 -0
  187. package/dist/{chunk-3RHFGGI5.js → chunk-YF6UHWOV.js} +30 -10
  188. package/dist/chunk-YF6UHWOV.js.map +1 -0
  189. package/dist/{chunk-X5SDZMO7.js → chunk-YHCBJULX.js} +2 -2
  190. package/dist/{chunk-5UYSCYR7.js → chunk-Z4RPXHJH.js} +4 -4
  191. package/dist/{cli-Pulnz-qm.d.ts → cli-ChKeYMZv.d.ts} +5 -5
  192. package/dist/cli.d.ts +25 -25
  193. package/dist/cli.js +81 -78
  194. package/dist/coding/pre-action-gate.d.ts +2 -60
  195. package/dist/compounding/engine.d.ts +4 -2
  196. package/dist/compounding/engine.js +17 -16
  197. package/dist/compounding/preference-consolidator.d.ts +3 -1
  198. package/dist/compression-optimizer.d.ts +3 -1
  199. package/dist/config.d.ts +3 -1
  200. package/dist/config.js +11 -1
  201. package/dist/connectors/codex-materialize-runner.d.ts +3 -1
  202. package/dist/connectors/codex-materialize-runner.js +16 -15
  203. package/dist/connectors/codex-materialize.d.ts +3 -1
  204. package/dist/connectors/index.d.ts +3 -1
  205. package/dist/connectors/index.js +16 -15
  206. package/dist/consolidation-provenance-check.d.ts +4 -2
  207. package/dist/consolidation-undo.d.ts +4 -2
  208. package/dist/contradiction/index.d.ts +10 -270
  209. package/dist/contradiction/index.js +20 -7
  210. package/dist/{contradiction-review-QKJH5DKD.js → contradiction-review-WRVLRWHS.js} +6 -2
  211. package/dist/{contradiction-scan-VOTQRRSX.js → contradiction-scan-AKUWPX5N.js} +5 -3
  212. package/dist/converge-config.d.ts +3 -1
  213. package/dist/convergence-refresh.d.ts +4 -2
  214. package/dist/convergence-refresh.js +18 -17
  215. package/dist/conversation-index/backend.d.ts +3 -1
  216. package/dist/conversation-index/chunker.d.ts +3 -1
  217. package/dist/conversation-index/faiss-adapter.d.ts +3 -1
  218. package/dist/conversation-index/indexer.d.ts +3 -1
  219. package/dist/conversation-index/search.d.ts +3 -1
  220. package/dist/corpus-watermark.d.ts +3 -1
  221. package/dist/corpus-watermark.js +18 -17
  222. package/dist/cross-lingual-recall.d.ts +3 -1
  223. package/dist/day-summary.d.ts +3 -1
  224. package/dist/delinearize.d.ts +3 -1
  225. package/dist/dependency-propagation-config.d.ts +3 -1
  226. package/dist/{dependency-propagation-delivery-Co17gxYb.d.ts → dependency-propagation-delivery-B8ZMBBCY.d.ts} +1 -1
  227. package/dist/direct-answer-wiring.d.ts +3 -1
  228. package/dist/direct-answer.d.ts +3 -1
  229. package/dist/embedding-fallback.d.ts +3 -1
  230. package/dist/enrichment/index.d.ts +3 -1
  231. package/dist/entity-origin-fields.d.ts +3 -1
  232. package/dist/entity-retrieval.d.ts +4 -2
  233. package/dist/entity-retrieval.js +16 -15
  234. package/dist/entity-schema.d.ts +3 -1
  235. package/dist/episodic-context.d.ts +3 -1
  236. package/dist/explicit-capture.d.ts +12 -12
  237. package/dist/explicit-capture.js +7 -6
  238. package/dist/external-wiki-access.d.ts +41 -42
  239. package/dist/external-wiki-access.js +37 -36
  240. package/dist/external-wiki-collection-registration.d.ts +3 -1
  241. package/dist/external-wiki-collection.d.ts +3 -1
  242. package/dist/external-wiki-mcp-tools.d.ts +40 -40
  243. package/dist/extraction-error-classification.d.ts +3 -1
  244. package/dist/extraction-faithfulness.d.ts +3 -1
  245. package/dist/extraction-judge-telemetry.d.ts +3 -1
  246. package/dist/extraction-judge-training.d.ts +3 -1
  247. package/dist/extraction-judge.d.ts +3 -1
  248. package/dist/extraction-judge.js +2 -2
  249. package/dist/extraction-liveness.d.ts +3 -1
  250. package/dist/extraction-normalization.d.ts +3 -1
  251. package/dist/extraction-normalization.js +2 -2
  252. package/dist/extraction-prompt.d.ts +4 -2
  253. package/dist/extraction-prompt.js +1 -1
  254. package/dist/extraction-source-grounding-rules.d.ts +3 -1
  255. package/dist/extraction-source-grounding.d.ts +3 -1
  256. package/dist/extraction.d.ts +3 -1
  257. package/dist/extraction.js +22 -21
  258. package/dist/fallback-llm.d.ts +3 -1
  259. package/dist/graph-dashboard-diff.d.ts +3 -1
  260. package/dist/graph-dashboard-key.d.ts +3 -1
  261. package/dist/graph-dashboard-parser.d.ts +3 -1
  262. package/dist/graph-edge-reinforcement.d.ts +3 -1
  263. package/dist/graph-path-reconstruction.d.ts +3 -1
  264. package/dist/graph-path-scoring.d.ts +3 -1
  265. package/dist/graph-snapshot.d.ts +3 -1
  266. package/dist/graph.d.ts +3 -1
  267. package/dist/harmonic-retrieval.js +1 -1
  268. package/dist/importance.d.ts +3 -1
  269. package/dist/importers/index.d.ts +3 -1
  270. package/dist/in-flight-reads.d.ts +3 -1
  271. package/dist/index-CexDrJzC.d.ts +284 -0
  272. package/dist/index.d.ts +946 -707
  273. package/dist/index.js +253 -151
  274. package/dist/intent.d.ts +3 -1
  275. package/dist/lcm/engine.d.ts +3 -1
  276. package/dist/lcm/engine.js +3 -3
  277. package/dist/lcm/index.d.ts +3 -1
  278. package/dist/lcm/index.js +6 -6
  279. package/dist/lcm/tools.d.ts +3 -1
  280. package/dist/lifecycle.d.ts +3 -1
  281. package/dist/live-connectors-runner.d.ts +3 -1
  282. package/dist/local-llm.d.ts +3 -1
  283. package/dist/local-model-endpoint.d.ts +3 -1
  284. package/dist/maintenance/memory-governance.d.ts +3 -1
  285. package/dist/maintenance/memory-governance.js +16 -15
  286. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +4 -2
  287. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +16 -15
  288. package/dist/maintenance/rebuild-memory-projection.d.ts +4 -2
  289. package/dist/maintenance/rebuild-memory-projection.js +17 -16
  290. package/dist/{maintenance-DiSLtVN7.d.ts → maintenance-nkdtSrVr.d.ts} +3 -3
  291. package/dist/mcp-memory-inspector-app.d.ts +37 -37
  292. package/dist/mcp-read-only-tools.js +1 -1
  293. package/dist/memory-action-policy.d.ts +3 -1
  294. package/dist/memory-cache.d.ts +3 -1
  295. package/dist/memory-lifecycle-ledger-utils.d.ts +3 -1
  296. package/dist/memory-projection-store.d.ts +3 -1
  297. package/dist/memory-provenance.d.ts +3 -1
  298. package/dist/memory-snapshot.d.ts +3 -1
  299. package/dist/memory-subject-cli.d.ts +177 -0
  300. package/dist/memory-subject-cli.js +16 -0
  301. package/dist/memory-subject.d.ts +128 -0
  302. package/dist/memory-subject.js +44 -0
  303. package/dist/memory-subject.js.map +1 -0
  304. package/dist/memory-worth-outcomes.d.ts +7 -4
  305. package/dist/memory-worth-outcomes.js +1 -1
  306. package/dist/models-json.d.ts +3 -1
  307. package/dist/namespaces/migrate.d.ts +5 -3
  308. package/dist/namespaces/migrate.js +17 -16
  309. package/dist/namespaces/principal.d.ts +3 -1
  310. package/dist/namespaces/search.d.ts +3 -1
  311. package/dist/namespaces/search.js +6 -6
  312. package/dist/namespaces/storage.d.ts +5 -3
  313. package/dist/namespaces/storage.js +16 -15
  314. package/dist/native-knowledge.d.ts +3 -1
  315. package/dist/offline-sync-impression-drain.d.ts +3 -1
  316. package/dist/operator-doctor-corpus.d.ts +3 -1
  317. package/dist/operator-doctor-corpus.js +19 -18
  318. package/dist/operator-doctor-replica.d.ts +3 -1
  319. package/dist/operator-toolkit.d.ts +5 -3
  320. package/dist/operator-toolkit.js +29 -24
  321. package/dist/orchestration/compression-guideline-coordinator.d.ts +4 -2
  322. package/dist/orchestration/maintenance.d.ts +6 -4
  323. package/dist/orchestration/maintenance.js +22 -21
  324. package/dist/{orchestrator-DzCaxNS4.d.ts → orchestrator-Bvq1-RQs.d.ts} +23 -9
  325. package/dist/orchestrator.d.ts +12 -12
  326. package/dist/orchestrator.js +111 -108
  327. package/dist/patterns-cli.d.ts +3 -1
  328. package/dist/{pipeline-HJ8DKbFl.d.ts → pipeline-C8vfIiTX.d.ts} +1 -1
  329. package/dist/policy-runtime.d.ts +3 -1
  330. package/dist/proactive-contention.d.ts +3 -1
  331. package/dist/provenance.d.ts +3 -1
  332. package/dist/{public-http-DwXauTX3.d.ts → public-http-Cy0aYbys.d.ts} +1 -1
  333. package/dist/{qmd-BzxluoLt.d.ts → qmd-B9p1SZTZ.d.ts} +1 -1
  334. package/dist/qmd-preflight.d.ts +4 -2
  335. package/dist/qmd-recall-cache.d.ts +3 -1
  336. package/dist/qmd.d.ts +4 -2
  337. package/dist/qmd.js +4 -4
  338. package/dist/recall-concurrency-config.d.ts +3 -1
  339. package/dist/recall-disclosure-escalation.d.ts +3 -1
  340. package/dist/recall-explain-renderer.d.ts +3 -1
  341. package/dist/recall-explain-renderer.js +3 -3
  342. package/dist/recall-memory-map.d.ts +3 -1
  343. package/dist/recall-planner-llm.d.ts +3 -1
  344. package/dist/recall-state.d.ts +3 -1
  345. package/dist/recall-tag-filter.d.ts +3 -1
  346. package/dist/recall-timings.d.ts +3 -1
  347. package/dist/recall-xray-cli.d.ts +3 -1
  348. package/dist/recall-xray-cli.js +4 -4
  349. package/dist/recall-xray-renderer.d.ts +3 -1
  350. package/dist/recall-xray-renderer.js +3 -3
  351. package/dist/recall-xray.d.ts +3 -1
  352. package/dist/recall-xray.js +2 -2
  353. package/dist/reconcile/cursor.d.ts +3 -1
  354. package/dist/reconcile/manifest.d.ts +3 -1
  355. package/dist/reconcile/manifest.js +3 -3
  356. package/dist/reconcile/plan.d.ts +3 -1
  357. package/dist/replay/normalizers/chatgpt.d.ts +3 -1
  358. package/dist/replay/normalizers/claude.d.ts +3 -1
  359. package/dist/replay/normalizers/openclaw.d.ts +3 -1
  360. package/dist/replay/normalizers/shared.d.ts +3 -1
  361. package/dist/replay/runner.d.ts +3 -1
  362. package/dist/replay/types.d.ts +3 -1
  363. package/dist/replica-divergence.d.ts +3 -1
  364. package/dist/replica-peers-config.d.ts +3 -1
  365. package/dist/resolution-4552BNRV.js +36 -0
  366. package/dist/resolution-4552BNRV.js.map +1 -0
  367. package/dist/resolve-auth-token.d.ts +3 -1
  368. package/dist/resume-bundles.js +9 -2
  369. package/dist/retrieval-agents.d.ts +4 -2
  370. package/dist/retrieval-tiers.d.ts +3 -1
  371. package/dist/routing/engine.d.ts +3 -1
  372. package/dist/routing/store.d.ts +3 -1
  373. package/dist/salvage-envelope.d.ts +3 -1
  374. package/dist/salvage-envelope.js +10 -2
  375. package/dist/schemas.d.ts +130 -116
  376. package/dist/schemas.js +1 -1
  377. package/dist/{scope-profiles-CEMZz0t5.d.ts → scope-profiles-DLrRxFWR.d.ts} +1 -1
  378. package/dist/search/embed-helper.d.ts +3 -1
  379. package/dist/search/factory.d.ts +3 -1
  380. package/dist/search/factory.js +5 -5
  381. package/dist/search/index.d.ts +3 -1
  382. package/dist/search/index.js +9 -9
  383. package/dist/search/lancedb-backend.d.ts +3 -1
  384. package/dist/search/meilisearch-backend.d.ts +3 -1
  385. package/dist/search/noop-backend.d.ts +3 -1
  386. package/dist/search/orama-backend.d.ts +3 -1
  387. package/dist/search/port.d.ts +3 -1
  388. package/dist/search/remote-backend.d.ts +3 -1
  389. package/dist/{semantic-TddhF0y7.d.ts → semantic-BalR6EXU.d.ts} +1 -1
  390. package/dist/{semantic-consolidation-D9dYj6vu.d.ts → semantic-consolidation-DlN6xe20.d.ts} +1 -1
  391. package/dist/semantic-consolidation.d.ts +4 -2
  392. package/dist/semantic-consolidation.js +17 -16
  393. package/dist/semantic-rule-promotion.js +16 -15
  394. package/dist/semantic-rule-verifier.d.ts +3 -1
  395. package/dist/semantic-rule-verifier.js +16 -15
  396. package/dist/{service-_qgST_0y.d.ts → service-GkYyVfm9.d.ts} +2 -2
  397. package/dist/session-observer-bands.d.ts +3 -1
  398. package/dist/session-observer-state.d.ts +3 -1
  399. package/dist/shared-context/manager.d.ts +13 -11
  400. package/dist/signal.d.ts +3 -1
  401. package/dist/source-agent-qualifier.d.ts +3 -1
  402. package/dist/source-agent-qualifier.js +18 -17
  403. package/dist/{storage-B9lbNTYE.d.ts → storage-BIDzuKIn.d.ts} +3 -2
  404. package/dist/storage.d.ts +4 -2
  405. package/dist/storage.js +18 -17
  406. package/dist/subject-config.d.ts +40 -0
  407. package/dist/subject-config.js +20 -0
  408. package/dist/subject-config.js.map +1 -0
  409. package/dist/summarizer.d.ts +3 -1
  410. package/dist/summary-snapshot.d.ts +3 -1
  411. package/dist/support-passport/index.d.ts +43 -43
  412. package/dist/support-passport/index.js +39 -38
  413. package/dist/temporal-supersession.d.ts +4 -2
  414. package/dist/temporal-timeline-recall.d.ts +3 -1
  415. package/dist/temporal-validity.d.ts +3 -1
  416. package/dist/threading.d.ts +3 -1
  417. package/dist/tier-migration.d.ts +4 -2
  418. package/dist/tier-routing.d.ts +3 -1
  419. package/dist/topics.d.ts +3 -1
  420. package/dist/transcript.d.ts +3 -1
  421. package/dist/transfer/backup.js +2 -2
  422. package/dist/transfer/capsule-export.js +2 -2
  423. package/dist/transfer/capsule-import.js +2 -2
  424. package/dist/transfer/types.d.ts +86 -86
  425. package/dist/trust-score-stage.d.ts +3 -1
  426. package/dist/trust-score.d.ts +3 -1
  427. package/dist/{types-BrEzuxPA.d.ts → types-BxAcOl5Q.d.ts} +360 -32
  428. package/dist/types.d.ts +3 -1
  429. package/dist/types.js +1 -1
  430. package/dist/utility-runtime.d.ts +3 -1
  431. package/dist/verified-recall.js +16 -15
  432. package/dist/who-knows-cli.d.ts +40 -40
  433. package/dist/who-knows-cli.js +17 -16
  434. package/dist/who-knows.d.ts +42 -42
  435. package/dist/who-knows.js +16 -15
  436. package/dist/write-envelope.d.ts +7 -2
  437. package/dist/write-envelope.js +10 -1
  438. package/package.json +2 -2
  439. package/scripts/build-with-heap.mjs +1 -1
  440. package/src/access-boundary.ts +6 -0
  441. package/src/access-http.ts +6 -5
  442. package/src/access-mcp-admin-tools.ts +38 -0
  443. package/src/access-mcp-output-schemas.ts +20 -0
  444. package/src/access-mcp.ts +8 -8
  445. package/src/access-operations-batch.ts +13 -0
  446. package/src/access-service.ts +112 -0
  447. package/src/access-surface-catalog.test.ts +24 -0
  448. package/src/access-surface-catalog.ts +6 -0
  449. package/src/coding/action-gate.test.ts +341 -0
  450. package/src/coding/action-gate.ts +556 -0
  451. package/src/config.ts +15 -17
  452. package/src/contradiction/contradiction-review.ts +50 -4
  453. package/src/contradiction/contradiction-scan.ts +14 -3
  454. package/src/contradiction/resolution.ts +50 -2
  455. package/src/extraction-prompt.ts +1 -0
  456. package/src/extraction.ts +4 -1
  457. package/src/index.ts +9 -9
  458. package/src/mcp-read-only-tools.ts +1 -0
  459. package/src/memory-subject-cli.ts +135 -0
  460. package/src/memory-subject.test.ts +48 -0
  461. package/src/memory-subject.ts +314 -0
  462. package/src/memory-worth-outcomes.test.ts +6 -2
  463. package/src/memory-worth-outcomes.ts +11 -7
  464. package/src/operator-toolkit.ts +1 -1
  465. package/src/orchestration/extraction-persist.ts +48 -48
  466. package/src/orchestration/recall-internal.ts +6 -5
  467. package/src/orchestration/recall-rerank-coordinator.ts +123 -4
  468. package/src/orchestration/recall-result-formatter.ts +6 -2
  469. package/src/orchestration/recall-search-pipeline.ts +14 -1
  470. package/src/preferences/drift-config.ts +118 -0
  471. package/src/preferences/drift-recall.ts +133 -0
  472. package/src/preferences/drift-types.ts +87 -0
  473. package/src/preferences/index.ts +12 -0
  474. package/src/preferences/preference-drift.test.ts +690 -0
  475. package/src/preferences/preference-drift.ts +724 -0
  476. package/src/procedural/library-maintenance.test.ts +582 -0
  477. package/src/procedural/library-maintenance.ts +546 -0
  478. package/src/procedural/maintenance-config.ts +78 -0
  479. package/src/procedural/procedure-recall.ts +29 -1
  480. package/src/procedural/procedure-stats.ts +20 -0
  481. package/src/review/review-deck-access.test.ts +325 -0
  482. package/src/review/review-deck-http-base.ts +133 -0
  483. package/src/review/review-deck-mutation.test.ts +417 -0
  484. package/src/review/review-deck-mutation.ts +677 -0
  485. package/src/review/review-deck-snapshot.ts +196 -0
  486. package/src/review/review-deck-surface.ts +117 -0
  487. package/src/review/review-deck.test.ts +347 -0
  488. package/src/review/review-deck.ts +311 -0
  489. package/src/schemas.ts +7 -0
  490. package/src/spaces/index.ts +38 -2
  491. package/src/storage.ts +10 -8
  492. package/src/subject-config.ts +80 -0
  493. package/src/types.ts +33 -32
  494. package/src/write-envelope.test.ts +14 -0
  495. package/src/write-envelope.ts +24 -3
  496. package/dist/chunk-35NN3ZFA.js.map +0 -1
  497. package/dist/chunk-3PXVYJMC.js.map +0 -1
  498. package/dist/chunk-3RHFGGI5.js.map +0 -1
  499. package/dist/chunk-4NZHHGVL.js.map +0 -1
  500. package/dist/chunk-CEQF6L5K.js.map +0 -1
  501. package/dist/chunk-CUS6S7PN.js.map +0 -1
  502. package/dist/chunk-DBXZZIDU.js.map +0 -1
  503. package/dist/chunk-DEFI2QBT.js.map +0 -1
  504. package/dist/chunk-EIR5VLIH.js.map +0 -1
  505. package/dist/chunk-GEULB2VI.js.map +0 -1
  506. package/dist/chunk-JFJ3MHGV.js.map +0 -1
  507. package/dist/chunk-JG22O53B.js.map +0 -1
  508. package/dist/chunk-LCU5R6TQ.js.map +0 -1
  509. package/dist/chunk-MDVBCPOS.js +0 -402
  510. package/dist/chunk-MDVBCPOS.js.map +0 -1
  511. package/dist/chunk-MSTNSVXI.js.map +0 -1
  512. package/dist/chunk-WTOE7CW4.js.map +0 -1
  513. package/dist/chunk-YQ3CBLL4.js.map +0 -1
  514. package/dist/chunk-Z54TXZ2F.js.map +0 -1
  515. package/dist/resolution-DKMBPXHI.js +0 -18
  516. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  517. /package/dist/{chunk-MIBKEW7A.js.map → chunk-2VXWFYJE.js.map} +0 -0
  518. /package/dist/{chunk-3YTTAGPB.js.map → chunk-3DVBKTSO.js.map} +0 -0
  519. /package/dist/{chunk-JTSVMJHV.js.map → chunk-4XDGYCZI.js.map} +0 -0
  520. /package/dist/{chunk-HQSBYI5X.js.map → chunk-57HVIG5U.js.map} +0 -0
  521. /package/dist/{chunk-PMVPCZJZ.js.map → chunk-6433HV72.js.map} +0 -0
  522. /package/dist/{chunk-N6TRHP72.js.map → chunk-6TAX66IA.js.map} +0 -0
  523. /package/dist/{chunk-AGKIG3YA.js.map → chunk-6VALIZKG.js.map} +0 -0
  524. /package/dist/{chunk-NS5ETDYD.js.map → chunk-7BEPVIH3.js.map} +0 -0
  525. /package/dist/{chunk-LYIZXQYY.js.map → chunk-7KFIMGMP.js.map} +0 -0
  526. /package/dist/{chunk-LWVO2QZV.js.map → chunk-7QOO4LGC.js.map} +0 -0
  527. /package/dist/{chunk-CCTVAVTT.js.map → chunk-AUO2LJ3K.js.map} +0 -0
  528. /package/dist/{chunk-ALCJRQ72.js.map → chunk-AYDDB3XI.js.map} +0 -0
  529. /package/dist/{chunk-3TMYV3LP.js.map → chunk-AYYGRVRP.js.map} +0 -0
  530. /package/dist/{chunk-W6TSGWYS.js.map → chunk-AZAA5DNP.js.map} +0 -0
  531. /package/dist/{chunk-6JJT5AKI.js.map → chunk-BQUEAVNW.js.map} +0 -0
  532. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  533. /package/dist/{chunk-CEH2AFXG.js.map → chunk-C24UZSFW.js.map} +0 -0
  534. /package/dist/{chunk-ZPN7W3OP.js.map → chunk-CDUUDBWJ.js.map} +0 -0
  535. /package/dist/{chunk-Y23B2QXP.js.map → chunk-D27J626P.js.map} +0 -0
  536. /package/dist/{chunk-2572MRP2.js.map → chunk-DHTQP334.js.map} +0 -0
  537. /package/dist/{chunk-HJQZQUPC.js.map → chunk-DJZWNKFO.js.map} +0 -0
  538. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  539. /package/dist/{chunk-VJ6ECBIP.js.map → chunk-E4MVQQVX.js.map} +0 -0
  540. /package/dist/{chunk-SYJ6EKKE.js.map → chunk-EIVIB73I.js.map} +0 -0
  541. /package/dist/{chunk-HUNSEO5U.js.map → chunk-EV3YFLCB.js.map} +0 -0
  542. /package/dist/{chunk-VPGRXEAB.js.map → chunk-G57LQRP6.js.map} +0 -0
  543. /package/dist/{chunk-BC4QD3FM.js.map → chunk-GN55KU2P.js.map} +0 -0
  544. /package/dist/{chunk-4W6INNXO.js.map → chunk-GUXS322H.js.map} +0 -0
  545. /package/dist/{chunk-3MADV4YC.js.map → chunk-IQSC3V2E.js.map} +0 -0
  546. /package/dist/{chunk-UYCIS6V5.js.map → chunk-JCWY73FK.js.map} +0 -0
  547. /package/dist/{chunk-T42L3S6A.js.map → chunk-LBWQ65SX.js.map} +0 -0
  548. /package/dist/{chunk-256FBCVX.js.map → chunk-M4AHBM72.js.map} +0 -0
  549. /package/dist/{chunk-YEQEGSJA.js.map → chunk-MBDJJTAT.js.map} +0 -0
  550. /package/dist/{chunk-IAY7YBXS.js.map → chunk-MRTUN665.js.map} +0 -0
  551. /package/dist/{chunk-R3AAOKR2.js.map → chunk-NZWEEALH.js.map} +0 -0
  552. /package/dist/{chunk-I2HTKOOP.js.map → chunk-ODZG724P.js.map} +0 -0
  553. /package/dist/{chunk-7QFBLYFP.js.map → chunk-OJD4WS2E.js.map} +0 -0
  554. /package/dist/{chunk-53ENM6F6.js.map → chunk-P4DHENRE.js.map} +0 -0
  555. /package/dist/{chunk-KPBLJCCV.js.map → chunk-PDVQ5JU3.js.map} +0 -0
  556. /package/dist/{chunk-ESCQ6LY7.js.map → chunk-QFMO32TO.js.map} +0 -0
  557. /package/dist/{chunk-HQSPXTQO.js.map → chunk-QXIQPCCN.js.map} +0 -0
  558. /package/dist/{chunk-CFRBTATE.js.map → chunk-R47WINCY.js.map} +0 -0
  559. /package/dist/{chunk-G72IPMR7.js.map → chunk-R4OCGPSH.js.map} +0 -0
  560. /package/dist/{chunk-VZVP2W4O.js.map → chunk-RK4WXUI2.js.map} +0 -0
  561. /package/dist/{chunk-JBPKEARU.js.map → chunk-RKNJBZ55.js.map} +0 -0
  562. /package/dist/{chunk-6L27N6YI.js.map → chunk-S7Q5CM7E.js.map} +0 -0
  563. /package/dist/{chunk-CTQRPANJ.js.map → chunk-SVSRPG6M.js.map} +0 -0
  564. /package/dist/{chunk-GXWDWOWP.js.map → chunk-TDKSCV62.js.map} +0 -0
  565. /package/dist/{chunk-S2VBSTTA.js.map → chunk-THG4GYIE.js.map} +0 -0
  566. /package/dist/{chunk-IXRC7EQG.js.map → chunk-TR7DGXGI.js.map} +0 -0
  567. /package/dist/{chunk-63FHSH7E.js.map → chunk-TYUS5TLG.js.map} +0 -0
  568. /package/dist/{chunk-7PWWGYGO.js.map → chunk-URHCUXKI.js.map} +0 -0
  569. /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
  570. /package/dist/{chunk-MUJ4QFUQ.js.map → chunk-W4BMEGQA.js.map} +0 -0
  571. /package/dist/{chunk-5HK3CJAR.js.map → chunk-W675UJCZ.js.map} +0 -0
  572. /package/dist/{chunk-X5SDZMO7.js.map → chunk-YHCBJULX.js.map} +0 -0
  573. /package/dist/{chunk-5UYSCYR7.js.map → chunk-Z4RPXHJH.js.map} +0 -0
  574. /package/dist/{contradiction-review-QKJH5DKD.js.map → contradiction-review-WRVLRWHS.js.map} +0 -0
  575. /package/dist/{contradiction-scan-VOTQRRSX.js.map → contradiction-scan-AKUWPX5N.js.map} +0 -0
  576. /package/dist/{resolution-DKMBPXHI.js.map → memory-subject-cli.js.map} +0 -0
@@ -6,23 +6,23 @@ import {
6
6
  loadSyncState,
7
7
  syncWearableSource,
8
8
  wearableSourceLabel
9
- } from "./chunk-ZPN7W3OP.js";
10
- import {
11
- runPeerProfileReasoner
12
- } from "./chunk-I74SUMNI.js";
9
+ } from "./chunk-CDUUDBWJ.js";
13
10
  import {
14
11
  CompressionGuidelineCoordinator
15
12
  } from "./chunk-UXREWVW4.js";
16
13
  import {
17
14
  ActivityStore,
18
15
  MaintenanceScheduler
19
- } from "./chunk-5UYSCYR7.js";
16
+ } from "./chunk-Z4RPXHJH.js";
17
+ import {
18
+ runPeerProfileReasoner
19
+ } from "./chunk-I74SUMNI.js";
20
20
  import {
21
21
  migrateFromEngram
22
22
  } from "./chunk-7HYPN2GC.js";
23
23
  import {
24
24
  LcmEngine
25
- } from "./chunk-256FBCVX.js";
25
+ } from "./chunk-M4AHBM72.js";
26
26
  import {
27
27
  chunkTranscriptEntries
28
28
  } from "./chunk-TECVW3JP.js";
@@ -32,10 +32,13 @@ import {
32
32
  import {
33
33
  CompoundingEngine,
34
34
  defaultTierMigrationCycleBudget
35
- } from "./chunk-CFRBTATE.js";
35
+ } from "./chunk-R47WINCY.js";
36
36
  import {
37
37
  SharedContextManager
38
38
  } from "./chunk-VI637ILW.js";
39
+ import {
40
+ cleanArchivedUserMessage
41
+ } from "./chunk-47DU4SGJ.js";
39
42
  import {
40
43
  applyUtilityPromotionRuntimePolicy,
41
44
  applyUtilityRankingRuntimeDelta,
@@ -45,8 +48,8 @@ import {
45
48
  extractTopics
46
49
  } from "./chunk-KVDUKH5E.js";
47
50
  import {
48
- cleanArchivedUserMessage
49
- } from "./chunk-47DU4SGJ.js";
51
+ buildTemporalTimelineRecallSection
52
+ } from "./chunk-2NKY7OC6.js";
50
53
  import {
51
54
  CODEX_THREAD_KEY_PREFIX
52
55
  } from "./chunk-4EX5WZ4M.js";
@@ -59,19 +62,21 @@ import {
59
62
  import {
60
63
  TmtBuilder
61
64
  } from "./chunk-ECZU5BJH.js";
65
+ import {
66
+ HourlySummarizer
67
+ } from "./chunk-EUYWQ7TS.js";
62
68
  import {
63
69
  buildTargetedFactRecallSection,
64
70
  shouldRecallTargetedFactEvidence
65
71
  } from "./chunk-T67LUYCR.js";
66
- import {
67
- buildTemporalTimelineRecallSection
68
- } from "./chunk-2NKY7OC6.js";
69
- import {
70
- HourlySummarizer
71
- } from "./chunk-EUYWQ7TS.js";
72
72
  import {
73
73
  SessionObserverState
74
74
  } from "./chunk-ODZKV2F7.js";
75
+ import {
76
+ RerankCache,
77
+ reorderByRankedKeys,
78
+ rerankLocalOrNoop
79
+ } from "./chunk-LUDXM7MD.js";
75
80
  import {
76
81
  buildResponseGuidanceRecallSection,
77
82
  shouldRecallResponseGuidance
@@ -106,11 +111,6 @@ import {
106
111
  import {
107
112
  RelevanceStore
108
113
  } from "./chunk-KATEWTQJ.js";
109
- import {
110
- RerankCache,
111
- reorderByRankedKeys,
112
- rerankLocalOrNoop
113
- } from "./chunk-LUDXM7MD.js";
114
114
  import {
115
115
  dedupeResultsByNamespace,
116
116
  hasMemoryForResult,
@@ -128,13 +128,13 @@ import {
128
128
  import {
129
129
  installPrioritizedEmbedding
130
130
  } from "./chunk-ROI7BK7H.js";
131
+ import {
132
+ NegativeExampleStore
133
+ } from "./chunk-23L3IXFD.js";
131
134
  import {
132
135
  applyMemoryWorthFilter,
133
136
  buildMemoryWorthCounterMap
134
137
  } from "./chunk-3GPTTA4J.js";
135
- import {
136
- NegativeExampleStore
137
- } from "./chunk-23L3IXFD.js";
138
138
  import {
139
139
  evaluateMemoryActionPolicy
140
140
  } from "./chunk-H63EDPFJ.js";
@@ -160,10 +160,10 @@ import {
160
160
  } from "./chunk-OH7QLI6W.js";
161
161
  import {
162
162
  ExtractionEngine
163
- } from "./chunk-CEQF6L5K.js";
163
+ } from "./chunk-LUNJ3WFO.js";
164
164
  import {
165
165
  parseMemoryActionEligibilityContext
166
- } from "./chunk-4NZHHGVL.js";
166
+ } from "./chunk-7BDZTALN.js";
167
167
  import {
168
168
  ModelRegistry
169
169
  } from "./chunk-WLZYGLJ4.js";
@@ -176,7 +176,7 @@ import {
176
176
  getVerdictKind,
177
177
  judgeFactDurability,
178
178
  validateProcedureExtraction
179
- } from "./chunk-3YTTAGPB.js";
179
+ } from "./chunk-3DVBKTSO.js";
180
180
  import {
181
181
  buildExplicitCueRecallSection
182
182
  } from "./chunk-TVIVY7KU.js";
@@ -184,7 +184,7 @@ import {
184
184
  buildEntityRecallSection,
185
185
  entityRecentTranscriptLookbackHours,
186
186
  readRecentEntityTranscriptEntries
187
- } from "./chunk-CCTVAVTT.js";
187
+ } from "./chunk-AUO2LJ3K.js";
188
188
  import {
189
189
  planEpisodeWindowsWithFallback
190
190
  } from "./chunk-T3GIETKV.js";
@@ -209,31 +209,31 @@ import {
209
209
  } from "./chunk-VY47VI2T.js";
210
210
  import {
211
211
  refreshConvergedNamespaces
212
- } from "./chunk-VJ6ECBIP.js";
212
+ } from "./chunk-E4MVQQVX.js";
213
213
  import {
214
214
  builtInConnectorPackageSpecifier,
215
215
  ensureBuiltInWearableConnectors,
216
216
  getWearableConnector,
217
217
  listWearableConnectors,
218
218
  screenCandidateFact
219
- } from "./chunk-LWVO2QZV.js";
220
- import {
221
- normalizeReplaySessionKey
222
- } from "./chunk-AJVLDJU6.js";
219
+ } from "./chunk-7QOO4LGC.js";
223
220
  import {
224
221
  RoutingRulesStore
225
222
  } from "./chunk-TBUEE7XF.js";
223
+ import {
224
+ normalizeReplaySessionKey
225
+ } from "./chunk-AJVLDJU6.js";
226
226
  import {
227
227
  compareVerifiedEpisodeResults,
228
228
  searchVerifiedEpisodes
229
- } from "./chunk-LYIZXQYY.js";
229
+ } from "./chunk-7KFIMGMP.js";
230
230
  import {
231
231
  ThreadingManager
232
232
  } from "./chunk-OJP3N7UK.js";
233
233
  import {
234
234
  compareVerifiedSemanticRuleResults,
235
235
  searchVerifiedSemanticRules
236
- } from "./chunk-ALCJRQ72.js";
236
+ } from "./chunk-AYDDB3XI.js";
237
237
  import {
238
238
  searchWorkProductLedgerEntries
239
239
  } from "./chunk-NRLELHAY.js";
@@ -246,13 +246,13 @@ import {
246
246
  import {
247
247
  runNamespaceMaintenanceFanout,
248
248
  summarizeNamespaceMaintenanceHealth
249
- } from "./chunk-CUS6S7PN.js";
249
+ } from "./chunk-OLWTCWQ2.js";
250
250
  import {
251
251
  planNamespaceMaintenance
252
- } from "./chunk-YEQEGSJA.js";
252
+ } from "./chunk-MBDJJTAT.js";
253
253
  import {
254
254
  searchHarmonicRetrieval
255
- } from "./chunk-HQSPXTQO.js";
255
+ } from "./chunk-QXIQPCCN.js";
256
256
  import {
257
257
  isAboveImportanceThreshold,
258
258
  scoreImportance
@@ -277,7 +277,7 @@ import {
277
277
  } from "./chunk-NOB2T2FC.js";
278
278
  import {
279
279
  SmartBuffer
280
- } from "./chunk-IXRC7EQG.js";
280
+ } from "./chunk-TR7DGXGI.js";
281
281
  import {
282
282
  buildConsolidationPrompt,
283
283
  buildExtensionsBlockForConsolidation,
@@ -287,7 +287,7 @@ import {
287
287
  materializeAfterSemanticConsolidation,
288
288
  parseConsolidationResponse,
289
289
  parseOperatorAwareConsolidationResponse
290
- } from "./chunk-VZVP2W4O.js";
290
+ } from "./chunk-RK4WXUI2.js";
291
291
  import {
292
292
  BootstrapEngine
293
293
  } from "./chunk-MYVPLJOO.js";
@@ -305,7 +305,7 @@ import {
305
305
  } from "./chunk-6TBIWIAG.js";
306
306
  import {
307
307
  detectMeetings
308
- } from "./chunk-YQ3CBLL4.js";
308
+ } from "./chunk-76PL4XLG.js";
309
309
  import {
310
310
  compileCorrectionRule,
311
311
  correctionsFilePath,
@@ -330,14 +330,14 @@ import {
330
330
  } from "./chunk-KD3QD3A5.js";
331
331
  import {
332
332
  MeetingsInputError
333
- } from "./chunk-WTOE7CW4.js";
333
+ } from "./chunk-BKYPJUQL.js";
334
334
  import {
335
335
  WearablesInputError,
336
336
  describeErrorForOperator
337
337
  } from "./chunk-V7IZKJI3.js";
338
338
  import {
339
339
  NamespaceCatalog
340
- } from "./chunk-IAY7YBXS.js";
340
+ } from "./chunk-MRTUN665.js";
341
341
  import {
342
342
  recordDreamsPhaseRun
343
343
  } from "./chunk-EQWEIIKQ.js";
@@ -354,10 +354,10 @@ import {
354
354
  filterRecallCandidates,
355
355
  isGenericRecallExcludedPath,
356
356
  isTopLevelArchivePath
357
- } from "./chunk-3PXVYJMC.js";
357
+ } from "./chunk-WN5FSGLE.js";
358
358
  import {
359
359
  importCapsule
360
- } from "./chunk-PMVPCZJZ.js";
360
+ } from "./chunk-6433HV72.js";
361
361
  import {
362
362
  isCodingGraphInstalled
363
363
  } from "./chunk-VQ7B2Q6M.js";
@@ -380,7 +380,7 @@ import {
380
380
  } from "./chunk-ZVZHG7AI.js";
381
381
  import {
382
382
  buildXraySnapshot
383
- } from "./chunk-VPGRXEAB.js";
383
+ } from "./chunk-G57LQRP6.js";
384
384
  import {
385
385
  objectiveStateStoreOverrideForNamespace,
386
386
  searchObjectiveStateSnapshots
@@ -400,7 +400,7 @@ import {
400
400
  } from "./chunk-QDW3E4RD.js";
401
401
  import {
402
402
  shouldSkipImplicitExtraction
403
- } from "./chunk-NS5ETDYD.js";
403
+ } from "./chunk-7BEPVIH3.js";
404
404
  import {
405
405
  boundRecallContextComposition,
406
406
  composeRecallContext,
@@ -411,7 +411,7 @@ import {
411
411
  } from "./chunk-7ZNJN5WZ.js";
412
412
  import {
413
413
  NamespaceStorageRouter
414
- } from "./chunk-2572MRP2.js";
414
+ } from "./chunk-DHTQP334.js";
415
415
  import {
416
416
  GraphIndex
417
417
  } from "./chunk-BIJAWZYW.js";
@@ -455,19 +455,16 @@ import {
455
455
  throwIfRecallAborted,
456
456
  tokenizeRecallQuery,
457
457
  utcDateKeysForLocalDay
458
- } from "./chunk-S2VBSTTA.js";
458
+ } from "./chunk-THG4GYIE.js";
459
459
  import {
460
460
  inferIntentFromText,
461
461
  intentCompatibilityScore,
462
462
  isTaskInitiationIntent,
463
463
  planRecallMode
464
464
  } from "./chunk-CSAKJVXW.js";
465
- import {
466
- searchCausalTrajectories
467
- } from "./chunk-PP7R754B.js";
468
465
  import {
469
466
  buildChainFollowupGenerator
470
- } from "./chunk-3TMYV3LP.js";
467
+ } from "./chunk-AYYGRVRP.js";
471
468
  import {
472
469
  QmdResultResolver,
473
470
  StorageManager,
@@ -486,10 +483,7 @@ import {
486
483
  reconstructFusionInputs,
487
484
  selfDeps,
488
485
  serializeFusionDay
489
- } from "./chunk-DEFI2QBT.js";
490
- import {
491
- buildRetiredFactTombstoneInputs
492
- } from "./chunk-46WM6JX2.js";
486
+ } from "./chunk-PAYGC3BD.js";
493
487
  import {
494
488
  bodyIsEscaped,
495
489
  decodeTranscriptBody,
@@ -500,15 +494,18 @@ import {
500
494
  saveSpeakerRegistry,
501
495
  speakerRegistryKey
502
496
  } from "./chunk-UHVXE24Y.js";
497
+ import {
498
+ buildRetiredFactTombstoneInputs
499
+ } from "./chunk-46WM6JX2.js";
503
500
  import {
504
501
  NamespaceSearchRouter,
505
502
  namespaceCollectionName
506
- } from "./chunk-X5SDZMO7.js";
503
+ } from "./chunk-YHCBJULX.js";
507
504
  import {
508
505
  createConversationIndexRuntime,
509
506
  createSearchBackend,
510
507
  isSearchBackendEnabled
511
- } from "./chunk-HJQZQUPC.js";
508
+ } from "./chunk-DJZWNKFO.js";
512
509
  import {
513
510
  NoopSearchBackend
514
511
  } from "./chunk-CYEPCZN5.js";
@@ -522,7 +519,7 @@ import {
522
519
  } from "./chunk-S2V7RUCL.js";
523
520
  import {
524
521
  confidenceTier
525
- } from "./chunk-JFJ3MHGV.js";
522
+ } from "./chunk-NXKJHSDN.js";
526
523
  import {
527
524
  lintWorkspaceFiles,
528
525
  rotateMarkdownFileToArchive
@@ -536,7 +533,7 @@ import {
536
533
  TAG_LIMITS,
537
534
  composeMemoryEnvelope,
538
535
  isMemoryCategory
539
- } from "./chunk-LCU5R6TQ.js";
536
+ } from "./chunk-RAIUTAZZ.js";
540
537
  import {
541
538
  normalizeTags
542
539
  } from "./chunk-BT7NVCML.js";
@@ -590,6 +587,14 @@ import {
590
587
  import {
591
588
  assertExternalWikiRootOutsideMemoryDirCanonical
592
589
  } from "./chunk-JV3C2MNQ.js";
590
+ import {
591
+ searchCausalTrajectories
592
+ } from "./chunk-PP7R754B.js";
593
+ import {
594
+ evaluateSubjectGuard,
595
+ isSharedPromotionTarget,
596
+ resolveWriteSubject
597
+ } from "./chunk-RIAM7DND.js";
593
598
  import {
594
599
  coerceBool
595
600
  } from "./chunk-PQVCH2AE.js";
@@ -641,9 +646,6 @@ import {
641
646
  isActiveMemoryStatus,
642
647
  toMemoryPathRel
643
648
  } from "./chunk-7RJUVTVF.js";
644
- import {
645
- ContentHashIndex
646
- } from "./chunk-JOEJG4SD.js";
647
649
  import {
648
650
  excludeSupportPassportPrivateMemories,
649
651
  isSupportPassportPrivateMemory
@@ -652,6 +654,9 @@ import {
652
654
  normalizeAttributePairs,
653
655
  stripAttributesSuffix
654
656
  } from "./chunk-JDSVLVCG.js";
657
+ import {
658
+ ContentHashIndex
659
+ } from "./chunk-JOEJG4SD.js";
655
660
  import {
656
661
  sanitizeMemoryContent
657
662
  } from "./chunk-5GKPFL3S.js";
@@ -2056,6 +2061,49 @@ ${body}
2056
2061
  }
2057
2062
  };
2058
2063
 
2064
+ // src/preferences/drift-recall.ts
2065
+ var DAY_MS = 24 * 60 * 60 * 1e3;
2066
+ function isPreferenceDriftStageActive(config) {
2067
+ if (!config) return false;
2068
+ const damping = config.recallDamping && config.stalePenalty < 1;
2069
+ return damping || config.annotateAfterDays > 0;
2070
+ }
2071
+ function driftAgeNote(frontmatter, config, now) {
2072
+ if (config.annotateAfterDays <= 0) return void 0;
2073
+ if (!frontmatter || frontmatter.category !== "preference") return void 0;
2074
+ const anchor = frontmatter.lastCorroborated ?? frontmatter.created;
2075
+ if (typeof anchor !== "string") return void 0;
2076
+ const anchorMs = Date.parse(anchor);
2077
+ if (!Number.isFinite(anchorMs)) return void 0;
2078
+ const ageDays = Math.floor((now.getTime() - anchorMs) / DAY_MS);
2079
+ if (ageDays < config.annotateAfterDays) return void 0;
2080
+ const stated = new Date(anchorMs).toISOString().slice(0, 7);
2081
+ return frontmatter.lastCorroborated ? `(corroborated ${stated}; not since)` : `(stated ${stated}; not corroborated since)`;
2082
+ }
2083
+ function applyPreferenceDriftRanking(inputs, options) {
2084
+ const { config, now } = options;
2085
+ const damping = config.recallDamping && config.stalePenalty < 1;
2086
+ const scored = inputs.map((input, index) => {
2087
+ const fm = input.frontmatter;
2088
+ const isStalePreference = fm?.category === "preference" && fm.driftState === "stale";
2089
+ const multiplier = damping && isStalePreference ? config.stalePenalty : 1;
2090
+ return {
2091
+ key: input.key,
2092
+ index,
2093
+ multiplier,
2094
+ damped: input.rank * multiplier,
2095
+ note: driftAgeNote(fm, config, now)
2096
+ };
2097
+ });
2098
+ scored.sort((a, b) => {
2099
+ if (a.damped !== b.damped) return a.damped > b.damped ? -1 : 1;
2100
+ if (a.index !== b.index) return a.index < b.index ? -1 : 1;
2101
+ if (a.key !== b.key) return a.key < b.key ? -1 : 1;
2102
+ return 0;
2103
+ });
2104
+ return scored.map((s) => s.note ? { key: s.key, multiplier: s.multiplier, note: s.note } : { key: s.key, multiplier: s.multiplier });
2105
+ }
2106
+
2059
2107
  // src/orchestration/recall-rerank-coordinator.ts
2060
2108
  function reconcileRecallResultPartition(partition, appliedResults) {
2061
2109
  return partition ? { appliedResults, headroomResults: partition.headroomResults } : null;
@@ -2255,7 +2303,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2255
2303
  namespaces,
2256
2304
  {
2257
2305
  readNamespaceMemories: async (ns) => (await this.getStorage(ns)).readAllMemories(),
2258
- readMemoryFrontmatter: async (path35, preferredNamespace) => {
2306
+ readMemoryFrontmatter: async (path34, preferredNamespace) => {
2259
2307
  if (!fallbackReader) {
2260
2308
  for (const ns of namespaces) {
2261
2309
  try {
@@ -2267,7 +2315,7 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2267
2315
  }
2268
2316
  if (!fallbackReader) return null;
2269
2317
  const memory = await this.readQmdResultMemory(
2270
- path35,
2318
+ path34,
2271
2319
  fallbackReader,
2272
2320
  namespaces,
2273
2321
  preferredNamespace
@@ -2332,9 +2380,13 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2332
2380
  * errors so a storage hiccup never breaks a fallback path.
2333
2381
  */
2334
2382
  async applyTrustScoreToBranch(results, namespaces, caps, label, preloadedFrontmatter, abortSignal) {
2383
+ let staged = results;
2384
+ let trustByPath = null;
2335
2385
  if (caps.recallTrustScore && results.length > 0) {
2336
2386
  try {
2337
- return await this.applyTrustScoreRerank(results, namespaces, preloadedFrontmatter, abortSignal);
2387
+ const outcome = await this.applyTrustScoreRerank(results, namespaces, preloadedFrontmatter, abortSignal);
2388
+ staged = outcome.results;
2389
+ trustByPath = outcome.trustByPath;
2338
2390
  } catch (err) {
2339
2391
  log.debug(`trust-score stage (${label}) failed open`, {
2340
2392
  error: err.message
@@ -2342,20 +2394,106 @@ var RecallRerankCoordinator = class _RecallRerankCoordinator {
2342
2394
  }
2343
2395
  } else if (caps.recallMemoryWorthFilter && results.length > 0) {
2344
2396
  try {
2345
- const filtered = await this.applyMemoryWorthRerank(
2397
+ staged = await this.applyMemoryWorthRerank(
2346
2398
  results,
2347
2399
  namespaces,
2348
2400
  preloadedFrontmatter,
2349
2401
  abortSignal
2350
2402
  );
2351
- return { results: filtered, trustByPath: null };
2352
2403
  } catch (err) {
2353
2404
  log.debug(`memory-worth filter (${label}) failed open`, {
2354
2405
  error: err.message
2355
2406
  });
2356
2407
  }
2357
2408
  }
2358
- return { results, trustByPath: null };
2409
+ const damped = await this.applyPreferenceDriftStage(
2410
+ staged,
2411
+ namespaces,
2412
+ preloadedFrontmatter,
2413
+ abortSignal
2414
+ );
2415
+ return { results: damped, trustByPath };
2416
+ }
2417
+ /**
2418
+ * Issue #2371 — stale-preference damping + injection annotation.
2419
+ *
2420
+ * Runs immediately after the trust/Memory-Worth stage on EVERY recall branch
2421
+ * (hot QMD, embedding fallback, recent scan, cold fallback), so the feature
2422
+ * gate applies uniformly and fallback parity holds (§27, AGENTS.md retrieval
2423
+ * guardrails). Fully inert on the default config: when neither damping nor
2424
+ * annotation is active the input array is returned untouched and NO
2425
+ * frontmatter is read, so recall ordering and injected text stay
2426
+ * byte-identical to pre-#2371.
2427
+ *
2428
+ * Fail-open: any lookup error leaves the branch's results unchanged.
2429
+ */
2430
+ async applyPreferenceDriftStage(results, namespaces, preloadedFrontmatter, abortSignal) {
2431
+ const config = this.getConfig();
2432
+ if (!isPreferenceDriftStageActive(config.driftDetection)) return results;
2433
+ if (results.length === 0) return results;
2434
+ try {
2435
+ const frontmatterByKey = /* @__PURE__ */ new Map();
2436
+ const missing = [];
2437
+ for (const r of results) {
2438
+ const key = memoryMapKey(r);
2439
+ const preloaded = preloadedFrontmatter?.get(key) ?? preloadedFrontmatter?.get(r.path);
2440
+ if (preloaded) {
2441
+ frontmatterByKey.set(key, preloaded.frontmatter);
2442
+ } else {
2443
+ missing.push(r);
2444
+ }
2445
+ }
2446
+ if (missing.length > 0) {
2447
+ let reader = null;
2448
+ for (const ns of namespaces) {
2449
+ try {
2450
+ reader = await this.getStorage(ns);
2451
+ break;
2452
+ } catch {
2453
+ }
2454
+ }
2455
+ if (reader) {
2456
+ const readerNn = reader;
2457
+ const BATCH = 16;
2458
+ for (let off = 0; off < missing.length; off += BATCH) {
2459
+ if (abortSignal?.aborted) break;
2460
+ await Promise.all(
2461
+ missing.slice(off, off + BATCH).map(async (r) => {
2462
+ try {
2463
+ const memory = await this.readQmdResultMemory(r.path, readerNn, namespaces, r.namespace);
2464
+ if (memory) frontmatterByKey.set(memoryMapKey(r), memory.frontmatter);
2465
+ } catch (err) {
2466
+ log.debug("preference-drift: direct path lookup failed", {
2467
+ path: r.path,
2468
+ error: err.message
2469
+ });
2470
+ }
2471
+ })
2472
+ );
2473
+ }
2474
+ }
2475
+ }
2476
+ const ranked = results.map((r, i) => ({
2477
+ key: memoryMapKey(r),
2478
+ rank: results.length - i,
2479
+ frontmatter: frontmatterByKey.get(memoryMapKey(r))
2480
+ }));
2481
+ const ordered = applyPreferenceDriftRanking(ranked, {
2482
+ config: config.driftDetection,
2483
+ now: /* @__PURE__ */ new Date()
2484
+ });
2485
+ const byKey = new Map(results.map((r) => [memoryMapKey(r), r]));
2486
+ const reordered = [];
2487
+ for (const item of ordered) {
2488
+ const original = byKey.get(item.key);
2489
+ if (!original) continue;
2490
+ reordered.push(item.note ? { ...original, driftNote: item.note } : original);
2491
+ }
2492
+ return reordered;
2493
+ } catch (err) {
2494
+ log.debug("preference-drift stage failed open", { error: err.message });
2495
+ return results;
2496
+ }
2359
2497
  }
2360
2498
  diversifyRecallResultsWithHeadroom(sectionId, results, limit, retrievalQuery, caps = resolveCapabilities(this.getConfig())) {
2361
2499
  const safeLimit = typeof limit === "number" && Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : 0;
@@ -5017,6 +5155,17 @@ var ExtractionPersistCoordinator = class {
5017
5155
  const namespacesEnabled = resolveNamespaceCapabilities(this.deps.config).namespaces;
5018
5156
  const sourceConnector = sourceContext?.sourceConnector;
5019
5157
  const origin = classifyExtractionOrigin(sourceContext);
5158
+ const subjectGuardAllows = (subject, target, label) => {
5159
+ const decision = evaluateSubjectGuard({
5160
+ subject,
5161
+ sharedTarget: isSharedPromotionTarget(target),
5162
+ mode: this.deps.config.subjectGuard
5163
+ });
5164
+ if (decision.action !== "allow") {
5165
+ log.warn(`subject-guard(${decision.action}) ${label}: ${decision.reason}`);
5166
+ }
5167
+ return decision.action !== "reject";
5168
+ };
5020
5169
  const promoteMemoryToProfileTargets = async (options) => {
5021
5170
  if (!scopeProfileWritePlan || !profileAutoPromotionAllows(scopeProfileWritePlan, options.category, options.confidence))
5022
5171
  return;
@@ -5033,6 +5182,7 @@ var ExtractionPersistCoordinator = class {
5033
5182
  try {
5034
5183
  const targetStorage = await this.deps.getStorageRouter().storageFor(target.namespace);
5035
5184
  if (targetStorage.dir === options.sourceStorage.dir) continue;
5185
+ if (!subjectGuardAllows(options.subject, target.target, `profile promotion to ${target.target}`)) continue;
5036
5186
  const targetPromotionEnvelope = composeSalvagedExtractionEnvelope(
5037
5187
  {
5038
5188
  content: citedContent,
@@ -5043,7 +5193,8 @@ var ExtractionPersistCoordinator = class {
5043
5193
  entityRef: options.entityRef,
5044
5194
  structuredAttributes: options.structuredAttributes,
5045
5195
  validAt: options.validAt,
5046
- ...sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {}
5196
+ ...sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {},
5197
+ ...options.subject !== void 0 ? { subject: options.subject } : {}
5047
5198
  },
5048
5199
  { source: `${options.source}-${target.target}-promotion` }
5049
5200
  );
@@ -5168,6 +5319,7 @@ var ExtractionPersistCoordinator = class {
5168
5319
  options.confidence
5169
5320
  ))
5170
5321
  return;
5322
+ if (!subjectGuardAllows(options.subject, "serverShared", "shared promotion")) return;
5171
5323
  try {
5172
5324
  const sharedStorage = await this.deps.getStorageRouter().storageFor(
5173
5325
  this.deps.config.sharedNamespace
@@ -5185,7 +5337,8 @@ var ExtractionPersistCoordinator = class {
5185
5337
  entityRef: options.entityRef,
5186
5338
  structuredAttributes: options.structuredAttributes,
5187
5339
  validAt: options.validAt,
5188
- ...sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {}
5340
+ ...sourceContext?.sourceConnector ? { sourceConnector: sourceContext.sourceConnector } : {},
5341
+ ...options.subject !== void 0 ? { subject: options.subject } : {}
5189
5342
  },
5190
5343
  { source: `${options.source}-shared-promotion` }
5191
5344
  );
@@ -5558,7 +5711,7 @@ var ExtractionPersistCoordinator = class {
5558
5711
  content: f.content,
5559
5712
  sourceConnector,
5560
5713
  procedureSteps: f.procedureSteps
5561
- })) {
5714
+ }) && subjectGuardAllows(f.subject, "serverShared", "pre-judge shared routing")) {
5562
5715
  factNs = this.deps.config.sharedNamespace;
5563
5716
  }
5564
5717
  if (factNs) {
@@ -5717,6 +5870,7 @@ var ExtractionPersistCoordinator = class {
5717
5870
  );
5718
5871
  }
5719
5872
  }
5873
+ const factSubject = this.deps.config.subjectClassification?.enabled === true ? resolveWriteSubject(writeCategory, fact.subject) : void 0;
5720
5874
  if (lifecycleCaps.extractionScopeClassification && namespacesEnabled && fact.scope === "global" && !routedNamespaceExplicit) {
5721
5875
  const currentNs = this.deps.storageDirNamespace(targetStorage.dir);
5722
5876
  if (currentNs !== this.deps.config.sharedNamespace && profileAllowsSharedWrites) {
@@ -5725,7 +5879,7 @@ var ExtractionPersistCoordinator = class {
5725
5879
  content: fact.content,
5726
5880
  sourceConnector,
5727
5881
  procedureSteps: fact.procedureSteps
5728
- })) {
5882
+ }) && subjectGuardAllows(fact.subject, "serverShared", "scope-routing")) {
5729
5883
  try {
5730
5884
  targetStorage = await this.deps.getStorageRouter().storageFor(
5731
5885
  this.deps.config.sharedNamespace
@@ -6178,6 +6332,7 @@ var ExtractionPersistCoordinator = class {
6178
6332
  sourceStorage: targetStorage,
6179
6333
  category: writeCategory,
6180
6334
  content: fact.content,
6335
+ subject: factSubject,
6181
6336
  confidence: fact.confidence,
6182
6337
  tags: fact.tags,
6183
6338
  entityRef: fact.entityRef,
@@ -6308,7 +6463,8 @@ var ExtractionPersistCoordinator = class {
6308
6463
  entityRef: typeof fact.entityRef === "string" ? fact.entityRef : void 0,
6309
6464
  structuredAttributes: fact.structuredAttributes,
6310
6465
  validAt: biTemporal ? biTemporal.validFrom : sourceContext?.validAt,
6311
- ...extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}
6466
+ ...extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {},
6467
+ ...factSubject !== void 0 ? { subject: factSubject } : {}
6312
6468
  },
6313
6469
  { source: extractionWriteSource }
6314
6470
  );
@@ -6405,6 +6561,7 @@ var ExtractionPersistCoordinator = class {
6405
6561
  category: writeCategory,
6406
6562
  content: fact.content,
6407
6563
  confidence: fact.confidence,
6564
+ subject: factSubject,
6408
6565
  tags: fact.tags,
6409
6566
  entityRef: typeof fact.entityRef === "string" ? fact.entityRef : void 0,
6410
6567
  structuredAttributes: fact.structuredAttributes,
@@ -8422,6 +8579,11 @@ async function buildProcedureRecallSection(storage, prompt, config, options) {
8422
8579
  (m) => m.frontmatter.category === "procedure" && isActiveMemoryStatus(m.frontmatter.status) && (options?.partitionToolScoped !== true || canRecallToolScopedMemory(m.frontmatter, options.requestingConnector))
8423
8580
  ).map((m) => ({ m, score: scoreProcedureForPrompt(m, trimmed, queryIntent) })).filter((x) => x.score > 0.04).sort((a, b) => b.score - a.score).slice(0, maxN);
8424
8581
  if (scored.length === 0) return null;
8582
+ if (options?.injectedMemories) {
8583
+ for (const { m } of scored) {
8584
+ options.injectedMemories.push({ id: m.frontmatter.id, path: m.path });
8585
+ }
8586
+ }
8425
8587
  const security = resolveSecurityCapabilities(config);
8426
8588
  const blocks = scored.map(({ m, score }) => {
8427
8589
  const id = m.frontmatter.id;
@@ -8440,6 +8602,16 @@ ${body}`;
8440
8602
 
8441
8603
  ${blocks.join("\n\n")}`;
8442
8604
  }
8605
+ function mergeProcedureInjections(existing, injected) {
8606
+ if (injected.length === 0) return existing;
8607
+ const seen = new Set(existing.map((memory) => memory.id));
8608
+ const extra = injected.filter((memory) => {
8609
+ if (seen.has(memory.id)) return false;
8610
+ seen.add(memory.id);
8611
+ return true;
8612
+ });
8613
+ return extra.length === 0 ? existing : [...existing, ...extra];
8614
+ }
8443
8615
 
8444
8616
  // src/orchestration/episodic-context-section.ts
8445
8617
  var EPISODIC_FACT_SCAN_LIMIT = 8;
@@ -10739,6 +10911,7 @@ ${formatted}`;
10739
10911
  });
10740
10912
  return section;
10741
10913
  })();
10914
+ const procedureInjectedMemories = [];
10742
10915
  const procedureRecallPromise = (async () => {
10743
10916
  if (this.deps.config.procedural?.enabled !== true) return null;
10744
10917
  if (!this.deps.isRecallSectionEnabled("procedure-recall", true)) return null;
@@ -10747,10 +10920,7 @@ ${formatted}`;
10747
10920
  profileStorage,
10748
10921
  retrievalQuery,
10749
10922
  this.deps.config,
10750
- {
10751
- partitionToolScoped: lifecycleCaps.extractionScopeClassification,
10752
- requestingConnector: options.sourceConnector
10753
- }
10923
+ { partitionToolScoped: lifecycleCaps.extractionScopeClassification, requestingConnector: options.sourceConnector, injectedMemories: procedureInjectedMemories }
10754
10924
  );
10755
10925
  } catch (err) {
10756
10926
  log.debug(
@@ -12469,6 +12639,9 @@ ${tmtNode.summary}`
12469
12639
  sectionBuckets,
12470
12640
  contextBudgetForFooter(recallBudgetChars, curiosityFooter)
12471
12641
  );
12642
+ if (procedureRecallSection !== null && assembledRecall.includedIds.includes("procedure-recall")) {
12643
+ assembledRecall.includedMemories = mergeProcedureInjections(assembledRecall.includedMemories, procedureInjectedMemories);
12644
+ }
12472
12645
  recalledMemoryIds = assembledRecall.includedMemories.map((memory) => memory.id);
12473
12646
  recalledMemoryPaths = assembledRecall.includedMemories.map((memory) => memory.path);
12474
12647
  recalledMemoryNamespaces = assembledRecall.includedMemories.map((memory) => memory.namespace);
@@ -13451,6 +13624,13 @@ var RecallSearchPipelineCoordinator = class {
13451
13624
  });
13452
13625
  }
13453
13626
  }
13627
+ if (results.length > 0) {
13628
+ results = await this.deps.recallRerankCoordinator.applyPreferenceDriftStage(
13629
+ results,
13630
+ options.recallNamespaces,
13631
+ boostInput.memoryByPath
13632
+ );
13633
+ }
13454
13634
  if (options.xrayPoolSizeSink) {
13455
13635
  options.xrayPoolSizeSink.size = Math.max(
13456
13636
  options.xrayPoolSizeSink.size,
@@ -15472,7 +15652,7 @@ var OrchestratorInitCoordinator = class {
15472
15652
  if (signal.aborted) return;
15473
15653
  if (!this.deps.wearablesAutoSyncHandle && this.deps.config.wearables.enabled && this.deps.config.wearables.autoSyncEnabled && Object.values(this.deps.config.wearables.sources).some((source) => source.enabled)) {
15474
15654
  try {
15475
- const { startWearablesAutoSync } = await import("./auto-sync-5L7EUZ27.js");
15655
+ const { startWearablesAutoSync } = await import("./auto-sync-H64ZCNIR.js");
15476
15656
  if (signal.aborted) return;
15477
15657
  this.deps.wearablesAutoSyncHandle = startWearablesAutoSync(
15478
15658
  {
@@ -22118,9 +22298,9 @@ function readStructuralSymbol(entry) {
22118
22298
  const rec = entry;
22119
22299
  const symbol = typeof rec.symbol === "string" ? rec.symbol.trim() : "";
22120
22300
  if (!symbol) return null;
22121
- const path35 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
22301
+ const path34 = typeof rec.path === "string" && rec.path.length > 0 ? rec.path : void 0;
22122
22302
  const kind = typeof rec.kind === "string" && rec.kind.length > 0 ? rec.kind : void 0;
22123
- const item = path35 !== void 0 && kind !== void 0 ? { symbol, path: path35, kind } : path35 !== void 0 ? { symbol, path: path35 } : kind !== void 0 ? { symbol, kind } : { symbol };
22303
+ const item = path34 !== void 0 && kind !== void 0 ? { symbol, path: path34, kind } : path34 !== void 0 ? { symbol, path: path34 } : kind !== void 0 ? { symbol, kind } : { symbol };
22124
22304
  return item;
22125
22305
  }
22126
22306
  function classifySpawnError(err) {
@@ -24391,474 +24571,9 @@ function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
24391
24571
  }
24392
24572
  }
24393
24573
 
24394
- // src/review/index.ts
24574
+ // src/sync/index.ts
24395
24575
  import fs5 from "fs";
24396
24576
  import path29 from "path";
24397
- var historicalIdCache3 = new HistoricalEntityCanonicalIdCache();
24398
- function writeReviewFileCanonicalized(memoryDir, filePath, content) {
24399
- const stateDir = path29.join(memoryDir, "state");
24400
- const idsAtWrite = historicalIdCache3.get(stateDir);
24401
- let originalBytes = null;
24402
- try {
24403
- originalBytes = fs5.readFileSync(filePath, "utf8");
24404
- } catch {
24405
- originalBytes = null;
24406
- }
24407
- const written = canonicalizeEntityRefFrontmatter(content, idsAtWrite);
24408
- fs5.writeFileSync(filePath, written, "utf8");
24409
- try {
24410
- repairContentAfterJournalMoveSync({
24411
- stateDir,
24412
- cache: historicalIdCache3,
24413
- idsAtWrite,
24414
- rawContent: content,
24415
- lastWritten: written,
24416
- rewrite: (next) => fs5.writeFileSync(filePath, next, "utf8")
24417
- });
24418
- } catch (err) {
24419
- try {
24420
- if (originalBytes === null) {
24421
- fs5.unlinkSync(filePath);
24422
- } else {
24423
- fs5.writeFileSync(filePath, originalBytes, "utf8");
24424
- }
24425
- } catch {
24426
- }
24427
- throw err;
24428
- }
24429
- }
24430
- var DEFAULT_CONFIDENCE_THRESHOLD = 0.7;
24431
- function realMemoryRoot(memoryDir) {
24432
- try {
24433
- const stat5 = fs5.lstatSync(memoryDir);
24434
- if (!stat5.isDirectory() || stat5.isSymbolicLink()) return null;
24435
- return fs5.realpathSync(memoryDir);
24436
- } catch {
24437
- return null;
24438
- }
24439
- }
24440
- function isPathInside2(rootReal, candidateReal) {
24441
- const relative = path29.relative(rootReal, candidateReal);
24442
- return relative === "" || !!relative && !relative.startsWith("..") && !path29.isAbsolute(relative);
24443
- }
24444
- function isSafeDirectory(rootReal, dir) {
24445
- try {
24446
- const stat5 = fs5.lstatSync(dir);
24447
- if (!stat5.isDirectory() || stat5.isSymbolicLink()) return false;
24448
- return isPathInside2(rootReal, fs5.realpathSync(dir));
24449
- } catch {
24450
- return false;
24451
- }
24452
- }
24453
- function ensureSafeDirectory(rootReal, dir) {
24454
- if (fs5.existsSync(dir)) {
24455
- if (!isSafeDirectory(rootReal, dir)) {
24456
- throw new Error(`Refusing to write through unsafe review path: ${dir}`);
24457
- }
24458
- return;
24459
- }
24460
- fs5.mkdirSync(dir, { recursive: true });
24461
- if (!isSafeDirectory(rootReal, dir)) {
24462
- throw new Error(`Refusing to write through unsafe review path: ${dir}`);
24463
- }
24464
- }
24465
- function listReviewItems(options) {
24466
- const startTime = Date.now();
24467
- const {
24468
- memoryDir,
24469
- reason: filterReason,
24470
- limit = 50,
24471
- confidenceThreshold = DEFAULT_CONFIDENCE_THRESHOLD
24472
- } = options;
24473
- const maxItems = Math.max(0, limit);
24474
- const rootReal = realMemoryRoot(memoryDir);
24475
- if (!rootReal || maxItems === 0) {
24476
- return { items: [], total: 0, durationMs: Date.now() - startTime };
24477
- }
24478
- const items = [];
24479
- const isLimitReached = () => items.length >= maxItems;
24480
- const addItem = (item) => {
24481
- if (isLimitReached()) return;
24482
- if (filterReason && item.reviewReason !== filterReason) return;
24483
- items.push(item);
24484
- };
24485
- const suggestionsDir = path29.join(memoryDir, "suggestions");
24486
- if (!isLimitReached() && fs5.existsSync(suggestionsDir) && isSafeDirectory(rootReal, suggestionsDir)) {
24487
- walkMd(rootReal, suggestionsDir, (filePath, content) => {
24488
- if (isLimitReached()) return true;
24489
- const fm = parseFrontmatter4(content);
24490
- const body = extractBody4(content);
24491
- if (!fm?.id) return false;
24492
- addItem({
24493
- id: fm.id,
24494
- content: body,
24495
- category: fm.category ?? "suggestion",
24496
- confidence: parseConfidence(fm.confidence, 0.5),
24497
- confidenceTier: fm.confidenceTier ?? "low",
24498
- source: fm.source ?? "unknown",
24499
- filePath,
24500
- created: fm.created ?? (/* @__PURE__ */ new Date()).toISOString(),
24501
- reviewReason: "suggestion"
24502
- });
24503
- return isLimitReached();
24504
- });
24505
- }
24506
- const reviewDir = path29.join(memoryDir, "review");
24507
- if (!isLimitReached() && fs5.existsSync(reviewDir) && isSafeDirectory(rootReal, reviewDir)) {
24508
- walkMd(rootReal, reviewDir, (filePath, content) => {
24509
- if (isLimitReached()) return true;
24510
- const fm = parseFrontmatter4(content);
24511
- const body = extractBody4(content);
24512
- if (!fm?.id) return false;
24513
- addItem({
24514
- id: fm.id,
24515
- content: body,
24516
- category: fm.category ?? "review",
24517
- confidence: parseConfidence(fm.confidence, 0.5),
24518
- confidenceTier: fm.confidenceTier ?? "low",
24519
- source: fm.source ?? "unknown",
24520
- filePath,
24521
- created: fm.created ?? (/* @__PURE__ */ new Date()).toISOString(),
24522
- reviewReason: fm.reviewReason ?? "low_confidence",
24523
- context: fm.context
24524
- });
24525
- return isLimitReached();
24526
- });
24527
- }
24528
- const categories = ALL_CATEGORY_DIRS;
24529
- for (const category of categories) {
24530
- if (isLimitReached()) break;
24531
- const dir = path29.join(memoryDir, category);
24532
- if (!fs5.existsSync(dir) || !isSafeDirectory(rootReal, dir)) continue;
24533
- walkMd(rootReal, dir, (filePath, content) => {
24534
- if (isLimitReached()) return true;
24535
- const fm = parseFrontmatter4(content);
24536
- const body = extractBody4(content);
24537
- if (!fm?.id) return false;
24538
- const confidence = parseConfidence(fm.confidence, 1);
24539
- if (confidence >= confidenceThreshold && !(typeof fm.blockedBy === "string" && fm.blockedBy.length > 0)) return false;
24540
- if (parseBoolean(fm.reviewDismissed)) return false;
24541
- if (items.some((i) => i.id === fm.id)) return false;
24542
- addItem({
24543
- id: fm.id,
24544
- content: body,
24545
- category: fm.category ?? category.slice(0, -1),
24546
- confidence,
24547
- confidenceTier: fm.confidenceTier ?? "low",
24548
- source: fm.source ?? "unknown",
24549
- filePath,
24550
- created: fm.created ?? (/* @__PURE__ */ new Date()).toISOString(),
24551
- reviewReason: typeof fm.blockedBy === "string" && fm.blockedBy.length > 0 ? "tombstone_blocked" : "low_confidence"
24552
- });
24553
- return isLimitReached();
24554
- });
24555
- }
24556
- return {
24557
- items,
24558
- total: items.length,
24559
- durationMs: Date.now() - startTime
24560
- };
24561
- }
24562
- function performReview(memoryDir, itemId, action, options = {}) {
24563
- const result = action === "approve" ? approveItem(memoryDir, itemId, options) : action === "dismiss" ? dismissItem(memoryDir, itemId, options) : flagItem(memoryDir, itemId, options);
24564
- if (result.updatedPath !== void 0) bumpMemoryCorpusVersionForDir(memoryDir);
24565
- return result;
24566
- }
24567
- function approveItem(memoryDir, itemId, options) {
24568
- const rootReal = realMemoryRoot(memoryDir);
24569
- if (!rootReal) return { itemId, action: "approve", message: "Item not found" };
24570
- const found = findReviewFileById(memoryDir, itemId, options);
24571
- if (!found) {
24572
- return { itemId, action: "approve", message: "Item not found" };
24573
- }
24574
- const content = fs5.readFileSync(found.filePath, "utf8");
24575
- const fm = parseFrontmatter4(content);
24576
- if (!fm) return { itemId, action: "approve", message: "Could not parse frontmatter" };
24577
- const blockedBy = typeof fm.blockedBy === "string" ? fm.blockedBy : null;
24578
- const fireBlockedRevocation = () => {
24579
- if (!blockedBy || !options.onApproveBlockedMemory) return;
24580
- try {
24581
- const maybe = options.onApproveBlockedMemory(blockedBy, itemId);
24582
- if (maybe && typeof maybe.then === "function") {
24583
- void maybe.catch(() => void 0);
24584
- }
24585
- } catch {
24586
- }
24587
- };
24588
- const updatedContent = updateFrontmatterFields(content, {
24589
- confidence: "0.9",
24590
- confidenceTier: "high",
24591
- reviewDismissed: null,
24592
- // Clear the tombstone-block markers so the promoted memory is active.
24593
- // Clear the tombstone-block markers AND restore active status so the
24594
- // promoted memory is fully active in recall + provenance (issue #1579
24595
- // review: leaving status: pending_review kept it invisible to recall).
24596
- ...blockedBy ? { blockedBy: null, tombstoneBlockTier: null, status: "active" } : {}
24597
- });
24598
- if (found.location === "category") {
24599
- writeReviewFileCanonicalized(memoryDir, found.filePath, updatedContent);
24600
- fireBlockedRevocation();
24601
- return {
24602
- itemId,
24603
- action: "approve",
24604
- updatedPath: found.filePath,
24605
- message: "Approved low-confidence memory in place with confidence 0.9",
24606
- ...blockedBy ? { clearedTombstoneId: blockedBy } : {}
24607
- };
24608
- }
24609
- const category = fm.category ?? "fact";
24610
- const targetDir = getCategoryDir(memoryDir, category);
24611
- const dateDir = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
24612
- ensureSafeDirectory(rootReal, targetDir);
24613
- const outputPath = path29.join(targetDir, dateDir, path29.basename(found.filePath));
24614
- ensureSafeDirectory(rootReal, path29.dirname(outputPath));
24615
- const reviewStateDir = path29.join(memoryDir, "state");
24616
- const idsAtWrite = historicalIdCache3.get(reviewStateDir);
24617
- const promotedWritten = canonicalizeEntityRefFrontmatter(updatedContent, idsAtWrite);
24618
- const promotedPath = writeFileWithoutClobber(outputPath, promotedWritten, itemId);
24619
- try {
24620
- repairContentAfterJournalMoveSync({
24621
- stateDir: reviewStateDir,
24622
- cache: historicalIdCache3,
24623
- idsAtWrite,
24624
- rawContent: updatedContent,
24625
- lastWritten: promotedWritten,
24626
- rewrite: (next) => fs5.writeFileSync(promotedPath, next, "utf8")
24627
- });
24628
- } catch (err) {
24629
- try {
24630
- fs5.unlinkSync(promotedPath);
24631
- } catch {
24632
- }
24633
- throw err;
24634
- }
24635
- fs5.unlinkSync(found.filePath);
24636
- fireBlockedRevocation();
24637
- return {
24638
- itemId,
24639
- action: "approve",
24640
- updatedPath: promotedPath,
24641
- message: `Promoted to ${category} with confidence 0.9`,
24642
- ...blockedBy ? { clearedTombstoneId: blockedBy } : {}
24643
- };
24644
- }
24645
- function dismissItem(memoryDir, itemId, options) {
24646
- const found = findReviewFileById(memoryDir, itemId, options);
24647
- if (!found) {
24648
- return { itemId, action: "dismiss", message: "Item not found" };
24649
- }
24650
- if (found.location === "queue") {
24651
- fs5.unlinkSync(found.filePath);
24652
- return { itemId, action: "dismiss", message: "Dismissed and removed" };
24653
- }
24654
- const content = fs5.readFileSync(found.filePath, "utf8");
24655
- writeReviewFileCanonicalized(
24656
- memoryDir,
24657
- found.filePath,
24658
- updateFrontmatterFields(content, {
24659
- reviewDismissed: "true",
24660
- reviewDismissedAt: (/* @__PURE__ */ new Date()).toISOString()
24661
- })
24662
- );
24663
- return {
24664
- itemId,
24665
- action: "dismiss",
24666
- updatedPath: found.filePath,
24667
- message: "Dismissed low-confidence memory in place"
24668
- };
24669
- }
24670
- function flagItem(memoryDir, itemId, options) {
24671
- const found = findReviewFileById(memoryDir, itemId, options);
24672
- if (!found) {
24673
- return { itemId, action: "flag", message: "Item not found" };
24674
- }
24675
- const content = fs5.readFileSync(found.filePath, "utf8");
24676
- const fixed = updateFrontmatterFields(content, {
24677
- flagged: "true",
24678
- flaggedAt: (/* @__PURE__ */ new Date()).toISOString()
24679
- });
24680
- writeReviewFileCanonicalized(memoryDir, found.filePath, fixed);
24681
- return {
24682
- itemId,
24683
- action: "flag",
24684
- updatedPath: found.filePath,
24685
- message: "Flagged for further review"
24686
- };
24687
- }
24688
- function findReviewFileById(memoryDir, id, options = {}) {
24689
- const rootReal = realMemoryRoot(memoryDir);
24690
- if (!rootReal) return null;
24691
- for (const loc of ["suggestions", "review"]) {
24692
- const dir = path29.join(memoryDir, loc);
24693
- if (!fs5.existsSync(dir) || !isSafeDirectory(rootReal, dir)) continue;
24694
- const found = findFileById(rootReal, dir, id);
24695
- if (found) return { filePath: found, location: "queue" };
24696
- }
24697
- for (const category of ALL_CATEGORY_DIRS) {
24698
- const dir = path29.join(memoryDir, category);
24699
- if (!fs5.existsSync(dir) || !isSafeDirectory(rootReal, dir)) continue;
24700
- const found = findFileById(rootReal, dir, id, (fm) => isLowConfidenceReviewCandidate(fm, options));
24701
- if (found) return { filePath: found, location: "category" };
24702
- }
24703
- return null;
24704
- }
24705
- function findFileById(rootReal, dir, id, include) {
24706
- const files = walkMdPaths(rootReal, dir);
24707
- for (const filePath of files) {
24708
- const content = readFileSafe3(filePath);
24709
- if (!content) continue;
24710
- const fm = parseFrontmatter4(content);
24711
- if (fm?.id === id && (!include || include(fm))) return filePath;
24712
- }
24713
- return null;
24714
- }
24715
- function isLowConfidenceReviewCandidate(fm, options) {
24716
- const threshold = options.confidenceThreshold ?? DEFAULT_CONFIDENCE_THRESHOLD;
24717
- if (typeof fm.blockedBy === "string" && fm.blockedBy.length > 0) {
24718
- return !parseBoolean(fm.reviewDismissed);
24719
- }
24720
- return parseConfidence(fm.confidence, 1) < threshold && !parseBoolean(fm.reviewDismissed);
24721
- }
24722
- function parseBoolean(value) {
24723
- if (typeof value === "boolean") return value;
24724
- if (typeof value !== "string") return false;
24725
- const normalized = value.trim().toLowerCase();
24726
- return normalized === "true" || normalized === "1" || normalized === "yes";
24727
- }
24728
- function parseConfidence(value, fallback) {
24729
- if (typeof value === "number") return Number.isFinite(value) ? value : fallback;
24730
- if (typeof value === "string") {
24731
- const n = parseFloat(value);
24732
- return Number.isFinite(n) ? n : fallback;
24733
- }
24734
- return fallback;
24735
- }
24736
- function updateFrontmatterFields(content, fields) {
24737
- const match = content.match(/^(---\n)([\s\S]*?)(\n---(?:\n|$))/);
24738
- if (!match) return content;
24739
- const seen = /* @__PURE__ */ new Set();
24740
- const lines = match[2].split("\n");
24741
- const nextLines = [];
24742
- for (const line of lines) {
24743
- const colonIdx = line.indexOf(":");
24744
- if (colonIdx === -1) {
24745
- nextLines.push(line);
24746
- continue;
24747
- }
24748
- const key = line.slice(0, colonIdx).trim();
24749
- if (!Object.prototype.hasOwnProperty.call(fields, key)) {
24750
- nextLines.push(line);
24751
- continue;
24752
- }
24753
- seen.add(key);
24754
- const value = fields[key];
24755
- if (value !== null) {
24756
- nextLines.push(`${key}: ${value}`);
24757
- }
24758
- }
24759
- for (const [key, value] of Object.entries(fields)) {
24760
- if (value !== null && !seen.has(key)) {
24761
- nextLines.push(`${key}: ${value}`);
24762
- }
24763
- }
24764
- return `${match[1]}${nextLines.join("\n")}${match[3]}${content.slice(match[0].length)}`;
24765
- }
24766
- function readFileSafe3(filePath) {
24767
- try {
24768
- return fs5.readFileSync(filePath, "utf8");
24769
- } catch {
24770
- return null;
24771
- }
24772
- }
24773
- function writeFileWithoutClobber(basePath, content, discriminator) {
24774
- const parsed = path29.parse(basePath);
24775
- const safeDiscriminator = sanitizeFilePart(discriminator);
24776
- for (let attempt = 0; attempt < 1e3; attempt++) {
24777
- const candidate = attempt === 0 ? basePath : path29.join(
24778
- parsed.dir,
24779
- `${parsed.name}-${safeDiscriminator}${attempt === 1 ? "" : `-${attempt}`}${parsed.ext || ".md"}`
24780
- );
24781
- try {
24782
- fs5.writeFileSync(candidate, content, { encoding: "utf8", flag: "wx" });
24783
- return candidate;
24784
- } catch (error) {
24785
- if (error.code === "EEXIST") continue;
24786
- throw error;
24787
- }
24788
- }
24789
- throw new Error(`Could not find a free review promotion path for ${basePath}`);
24790
- }
24791
- function sanitizeFilePart(value) {
24792
- const chars = [];
24793
- let previousWasDash = false;
24794
- for (const char of value) {
24795
- const next = isSafeFilePartChar(char) ? char : "-";
24796
- if (next === "-" && previousWasDash) continue;
24797
- chars.push(next);
24798
- previousWasDash = next === "-";
24799
- if (chars.length >= 64) break;
24800
- }
24801
- let start = 0;
24802
- let end = chars.length;
24803
- while (start < end && chars[start] === "-") start++;
24804
- while (end > start && chars[end - 1] === "-") end--;
24805
- const sanitized = chars.slice(start, end).join("");
24806
- return sanitized || "review-item";
24807
- }
24808
- function isSafeFilePartChar(value) {
24809
- if (value.length !== 1) return false;
24810
- const code = value.charCodeAt(0);
24811
- return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || value === "." || value === "_" || value === "-";
24812
- }
24813
- function parseFrontmatter4(content) {
24814
- const match = content.match(/^---\n([\s\S]*?)\n---/);
24815
- if (!match) return null;
24816
- const fm = {};
24817
- for (const line of match[1].split("\n")) {
24818
- const colonIdx = line.indexOf(":");
24819
- if (colonIdx === -1) continue;
24820
- const key = line.slice(0, colonIdx).trim();
24821
- const value = line.slice(colonIdx + 1).trim();
24822
- fm[key] = value;
24823
- }
24824
- return fm;
24825
- }
24826
- function extractBody4(content) {
24827
- const match = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)/);
24828
- return match ? match[1].trim() : content.trim();
24829
- }
24830
- function walkMd(rootReal, dir, callback) {
24831
- if (!isSafeDirectory(rootReal, dir)) return false;
24832
- for (const entry of fs5.readdirSync(dir, { withFileTypes: true })) {
24833
- const fullPath = path29.join(dir, entry.name);
24834
- if (entry.isSymbolicLink()) continue;
24835
- if (entry.isDirectory()) {
24836
- if (walkMd(rootReal, fullPath, callback)) return true;
24837
- } else if (entry.isFile() && entry.name.endsWith(".md")) {
24838
- const content = readFileSafe3(fullPath);
24839
- if (content && callback(fullPath, content) === true) return true;
24840
- }
24841
- }
24842
- return false;
24843
- }
24844
- function walkMdPaths(rootReal, dir) {
24845
- const results = [];
24846
- if (!isSafeDirectory(rootReal, dir)) return results;
24847
- for (const entry of fs5.readdirSync(dir, { withFileTypes: true })) {
24848
- const fullPath = path29.join(dir, entry.name);
24849
- if (entry.isSymbolicLink()) continue;
24850
- if (entry.isDirectory()) {
24851
- results.push(...walkMdPaths(rootReal, fullPath));
24852
- } else if (entry.isFile() && entry.name.endsWith(".md")) {
24853
- results.push(fullPath);
24854
- }
24855
- }
24856
- return results;
24857
- }
24858
-
24859
- // src/sync/index.ts
24860
- import fs6 from "fs";
24861
- import path30 from "path";
24862
24577
  import crypto6 from "crypto";
24863
24578
  var DEFAULT_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".txt", ".mdx", ".rst"]);
24864
24579
  var DEFAULT_EXCLUDE2 = /* @__PURE__ */ new Set([
@@ -24880,7 +24595,7 @@ function syncChanges(options) {
24880
24595
  } = options;
24881
24596
  const extSet = new Set(extensions);
24882
24597
  const excludeSet = /* @__PURE__ */ new Set([...DEFAULT_EXCLUDE2, ...excludeDirs]);
24883
- const stateFilePath = options.stateFile ?? path30.join(memoryDir, ".sync-state.json");
24598
+ const stateFilePath = options.stateFile ?? path29.join(memoryDir, ".sync-state.json");
24884
24599
  const prevState = loadState(stateFilePath);
24885
24600
  const currentFiles = scanFiles(sourceDir, extSet, excludeSet);
24886
24601
  const changes = computeDiff(currentFiles, prevState.fileHashes, sourceDir);
@@ -24896,8 +24611,8 @@ function syncChanges(options) {
24896
24611
  for (const [relPath, hash] of Object.entries(currentFiles)) {
24897
24612
  newState.fileHashes[relPath] = hash;
24898
24613
  }
24899
- fs6.mkdirSync(path30.dirname(stateFilePath), { recursive: true });
24900
- fs6.writeFileSync(stateFilePath, JSON.stringify(newState, null, 2));
24614
+ fs5.mkdirSync(path29.dirname(stateFilePath), { recursive: true });
24615
+ fs5.writeFileSync(stateFilePath, JSON.stringify(newState, null, 2));
24901
24616
  }
24902
24617
  return {
24903
24618
  scanned: Object.keys(currentFiles).length,
@@ -24951,7 +24666,7 @@ function scanFiles(root, extensions, exclude) {
24951
24666
  function walk(dir, isRoot = false) {
24952
24667
  let entries;
24953
24668
  try {
24954
- entries = fs6.readdirSync(dir, { withFileTypes: true });
24669
+ entries = fs5.readdirSync(dir, { withFileTypes: true });
24955
24670
  } catch (err) {
24956
24671
  if (isRoot) {
24957
24672
  throw new Error(
@@ -24962,15 +24677,15 @@ function scanFiles(root, extensions, exclude) {
24962
24677
  }
24963
24678
  for (const entry of entries) {
24964
24679
  if (exclude.has(entry.name)) continue;
24965
- const fullPath = path30.join(dir, entry.name);
24680
+ const fullPath = path29.join(dir, entry.name);
24966
24681
  if (entry.isDirectory()) {
24967
24682
  walk(fullPath);
24968
24683
  } else if (entry.isFile()) {
24969
- const ext = path30.extname(entry.name).toLowerCase();
24684
+ const ext = path29.extname(entry.name).toLowerCase();
24970
24685
  if (!extensions.has(ext)) continue;
24971
- const relPath = path30.relative(root, fullPath);
24686
+ const relPath = path29.relative(root, fullPath);
24972
24687
  try {
24973
- const content = fs6.readFileSync(fullPath, "utf8");
24688
+ const content = fs5.readFileSync(fullPath, "utf8");
24974
24689
  result[relPath] = hashContent3(content);
24975
24690
  } catch {
24976
24691
  }
@@ -24983,11 +24698,11 @@ function scanFiles(root, extensions, exclude) {
24983
24698
  function computeDiff(current, previous, sourceDir) {
24984
24699
  const changes = [];
24985
24700
  for (const [relPath, hash] of Object.entries(current)) {
24986
- const fullPath = path30.join(sourceDir, relPath);
24701
+ const fullPath = path29.join(sourceDir, relPath);
24987
24702
  if (!(relPath in previous)) {
24988
24703
  let size = 0;
24989
24704
  try {
24990
- size = fs6.statSync(fullPath).size;
24705
+ size = fs5.statSync(fullPath).size;
24991
24706
  } catch {
24992
24707
  }
24993
24708
  changes.push({
@@ -25000,7 +24715,7 @@ function computeDiff(current, previous, sourceDir) {
25000
24715
  } else if (previous[relPath] !== hash) {
25001
24716
  let size = 0;
25002
24717
  try {
25003
- size = fs6.statSync(fullPath).size;
24718
+ size = fs5.statSync(fullPath).size;
25004
24719
  } catch {
25005
24720
  }
25006
24721
  changes.push({
@@ -25016,7 +24731,7 @@ function computeDiff(current, previous, sourceDir) {
25016
24731
  for (const relPath of Object.keys(previous)) {
25017
24732
  if (!(relPath in current)) {
25018
24733
  changes.push({
25019
- filePath: path30.join(sourceDir, relPath),
24734
+ filePath: path29.join(sourceDir, relPath),
25020
24735
  relativePath: relPath,
25021
24736
  type: "deleted",
25022
24737
  currentHash: "",
@@ -25028,7 +24743,7 @@ function computeDiff(current, previous, sourceDir) {
25028
24743
  }
25029
24744
  function loadState(stateFilePath) {
25030
24745
  try {
25031
- const raw = fs6.readFileSync(stateFilePath, "utf8");
24746
+ const raw = fs5.readFileSync(stateFilePath, "utf8");
25032
24747
  return JSON.parse(raw);
25033
24748
  } catch {
25034
24749
  return {
@@ -25045,25 +24760,25 @@ function hashContent3(content) {
25045
24760
  // src/spaces/index.ts
25046
24761
  import { spawnSync } from "child_process";
25047
24762
  import crypto7 from "crypto";
25048
- import fs7 from "fs";
25049
- import path31 from "path";
25050
- var historicalIdCache4 = new HistoricalEntityCanonicalIdCache();
24763
+ import fs6 from "fs";
24764
+ import path30 from "path";
24765
+ var historicalIdCache3 = new HistoricalEntityCanonicalIdCache();
25051
24766
  var MANIFEST_VERSION = 1;
25052
24767
  var MANIFEST_LOCK_STALE_MS = 3e4;
25053
24768
  var MANIFEST_LOCK_TIMEOUT_MS = MANIFEST_LOCK_STALE_MS + 1e4;
25054
24769
  var MANIFEST_LOCK_SLEEP_MS = 20;
25055
24770
  function normalizeSpaceMemoryDir(memoryDir) {
25056
- return path31.resolve(memoryDir);
24771
+ return path30.resolve(memoryDir);
25057
24772
  }
25058
24773
  function getSpacesDir(baseDir) {
25059
24774
  const homeDir = baseDir ?? resolveHomeDir();
25060
- return path31.join(homeDir, ".config", "engram", "spaces");
24775
+ return path30.join(homeDir, ".config", "engram", "spaces");
25061
24776
  }
25062
24777
  function getManifestPath(baseDir) {
25063
- return path31.join(getSpacesDir(baseDir), "manifest.json");
24778
+ return path30.join(getSpacesDir(baseDir), "manifest.json");
25064
24779
  }
25065
24780
  function loadManifest(baseDir, memoryDirOverride) {
25066
- if (fs7.existsSync(getManifestPath(baseDir))) {
24781
+ if (fs6.existsSync(getManifestPath(baseDir))) {
25067
24782
  try {
25068
24783
  return readManifestUnlocked(baseDir, memoryDirOverride, { bootstrapIfMissing: false });
25069
24784
  } catch (error) {
@@ -25089,7 +24804,7 @@ function updateManifest(baseDir, updater, memoryDirOverride) {
25089
24804
  }
25090
24805
  function readManifestUnlocked(baseDir, memoryDirOverride, options = {}) {
25091
24806
  const manifestPath2 = getManifestPath(baseDir);
25092
- if (!fs7.existsSync(manifestPath2)) {
24807
+ if (!fs6.existsSync(manifestPath2)) {
25093
24808
  if (options.bootstrapIfMissing === false) {
25094
24809
  const error = new Error(`Spaces manifest not found: ${manifestPath2}`);
25095
24810
  error.code = "ENOENT";
@@ -25102,21 +24817,21 @@ function readManifestUnlocked(baseDir, memoryDirOverride, options = {}) {
25102
24817
  version: MANIFEST_VERSION
25103
24818
  };
25104
24819
  }
25105
- const raw = JSON.parse(fs7.readFileSync(manifestPath2, "utf8"));
24820
+ const raw = JSON.parse(fs6.readFileSync(manifestPath2, "utf8"));
25106
24821
  return raw;
25107
24822
  }
25108
24823
  function saveManifestUnlocked(manifest, baseDir) {
25109
24824
  const manifestPath2 = getManifestPath(baseDir);
25110
- const manifestDir2 = path31.dirname(manifestPath2);
25111
- fs7.mkdirSync(manifestDir2, { recursive: true });
25112
- const tempPath = path31.join(manifestDir2, `.manifest.${process.pid}.${Date.now()}.${crypto7.randomUUID()}.tmp`);
24825
+ const manifestDir2 = path30.dirname(manifestPath2);
24826
+ fs6.mkdirSync(manifestDir2, { recursive: true });
24827
+ const tempPath = path30.join(manifestDir2, `.manifest.${process.pid}.${Date.now()}.${crypto7.randomUUID()}.tmp`);
25113
24828
  try {
25114
- fs7.writeFileSync(tempPath, `${JSON.stringify(manifest, null, 2)}
24829
+ fs6.writeFileSync(tempPath, `${JSON.stringify(manifest, null, 2)}
25115
24830
  `, { flag: "wx" });
25116
- fs7.renameSync(tempPath, manifestPath2);
24831
+ fs6.renameSync(tempPath, manifestPath2);
25117
24832
  } catch (error) {
25118
24833
  try {
25119
- fs7.rmSync(tempPath, { force: true });
24834
+ fs6.rmSync(tempPath, { force: true });
25120
24835
  } catch {
25121
24836
  }
25122
24837
  throw error;
@@ -25124,7 +24839,7 @@ function saveManifestUnlocked(manifest, baseDir) {
25124
24839
  }
25125
24840
  function withManifestLock(baseDir, operation) {
25126
24841
  const lockDir = `${getManifestPath(baseDir)}.lock`;
25127
- fs7.mkdirSync(path31.dirname(lockDir), { recursive: true });
24842
+ fs6.mkdirSync(path30.dirname(lockDir), { recursive: true });
25128
24843
  const lockOwner = acquireManifestLock(lockDir);
25129
24844
  try {
25130
24845
  return operation();
@@ -25137,10 +24852,10 @@ function acquireManifestLock(lockDir) {
25137
24852
  const owner = createManifestLockOwner();
25138
24853
  const reclaimDir = getManifestLockReclaimDir(lockDir);
25139
24854
  while (true) {
25140
- if (fs7.existsSync(reclaimDir)) {
24855
+ if (fs6.existsSync(reclaimDir)) {
25141
24856
  removeStaleManifestReclaimLock(reclaimDir);
25142
24857
  }
25143
- if (fs7.existsSync(reclaimDir)) {
24858
+ if (fs6.existsSync(reclaimDir)) {
25144
24859
  if (Date.now() >= deadline) {
25145
24860
  throw new Error(`Timed out waiting for spaces manifest reclaim lock: ${reclaimDir}`);
25146
24861
  }
@@ -25148,15 +24863,15 @@ function acquireManifestLock(lockDir) {
25148
24863
  continue;
25149
24864
  }
25150
24865
  try {
25151
- fs7.mkdirSync(lockDir, { recursive: false });
24866
+ fs6.mkdirSync(lockDir, { recursive: false });
25152
24867
  try {
25153
- fs7.writeFileSync(path31.join(lockDir, "owner"), `${owner}
24868
+ fs6.writeFileSync(path30.join(lockDir, "owner"), `${owner}
25154
24869
  `, { flag: "wx" });
25155
24870
  } catch (error) {
25156
- fs7.rmSync(lockDir, { recursive: true, force: true });
24871
+ fs6.rmSync(lockDir, { recursive: true, force: true });
25157
24872
  throw error;
25158
24873
  }
25159
- if (fs7.existsSync(reclaimDir)) {
24874
+ if (fs6.existsSync(reclaimDir)) {
25160
24875
  releaseManifestLock(lockDir, owner);
25161
24876
  if (Date.now() >= deadline) {
25162
24877
  throw new Error(`Timed out waiting for spaces manifest reclaim lock: ${reclaimDir}`);
@@ -25180,9 +24895,9 @@ function acquireManifestLock(lockDir) {
25180
24895
  }
25181
24896
  function releaseManifestLock(lockDir, owner) {
25182
24897
  try {
25183
- const ownerPath = path31.join(lockDir, "owner");
25184
- if (fs7.readFileSync(ownerPath, "utf8").trim() === owner) {
25185
- fs7.rmSync(lockDir, { recursive: true, force: true });
24898
+ const ownerPath = path30.join(lockDir, "owner");
24899
+ if (fs6.readFileSync(ownerPath, "utf8").trim() === owner) {
24900
+ fs6.rmSync(lockDir, { recursive: true, force: true });
25186
24901
  }
25187
24902
  } catch (error) {
25188
24903
  if (error.code !== "ENOENT") {
@@ -25194,12 +24909,12 @@ function removeStaleManifestLock(lockDir) {
25194
24909
  const reclaimDir = getManifestLockReclaimDir(lockDir);
25195
24910
  const reclaimOwner = createManifestLockOwner();
25196
24911
  try {
25197
- fs7.mkdirSync(reclaimDir, { recursive: false });
24912
+ fs6.mkdirSync(reclaimDir, { recursive: false });
25198
24913
  try {
25199
- fs7.writeFileSync(path31.join(reclaimDir, "owner"), `${reclaimOwner}
24914
+ fs6.writeFileSync(path30.join(reclaimDir, "owner"), `${reclaimOwner}
25200
24915
  `, { flag: "wx" });
25201
24916
  } catch (error) {
25202
- fs7.rmSync(reclaimDir, { recursive: true, force: true });
24917
+ fs6.rmSync(reclaimDir, { recursive: true, force: true });
25203
24918
  throw error;
25204
24919
  }
25205
24920
  } catch (error) {
@@ -25219,16 +24934,16 @@ function removeStaleManifestLock(lockDir) {
25219
24934
  }
25220
24935
  const tombstoneDir = `${lockDir}.stale.${process.pid}.${crypto7.randomUUID()}`;
25221
24936
  try {
25222
- fs7.renameSync(lockDir, tombstoneDir);
24937
+ fs6.renameSync(lockDir, tombstoneDir);
25223
24938
  } catch (error) {
25224
24939
  if (error.code !== "ENOENT") {
25225
24940
  throw error;
25226
24941
  }
25227
24942
  return;
25228
24943
  }
25229
- fs7.rmSync(tombstoneDir, { recursive: true, force: true });
24944
+ fs6.rmSync(tombstoneDir, { recursive: true, force: true });
25230
24945
  } finally {
25231
- fs7.rmSync(reclaimDir, { recursive: true, force: true });
24946
+ fs6.rmSync(reclaimDir, { recursive: true, force: true });
25232
24947
  }
25233
24948
  }
25234
24949
  function getManifestLockReclaimDir(lockDir) {
@@ -25251,19 +24966,19 @@ function removeStaleManifestReclaimLock(reclaimDir) {
25251
24966
  }
25252
24967
  const tombstoneDir = `${reclaimDir}.stale.${process.pid}.${crypto7.randomUUID()}`;
25253
24968
  try {
25254
- fs7.renameSync(reclaimDir, tombstoneDir);
24969
+ fs6.renameSync(reclaimDir, tombstoneDir);
25255
24970
  } catch (error) {
25256
24971
  if (error.code !== "ENOENT") {
25257
24972
  throw error;
25258
24973
  }
25259
24974
  return;
25260
24975
  }
25261
- fs7.rmSync(tombstoneDir, { recursive: true, force: true });
24976
+ fs6.rmSync(tombstoneDir, { recursive: true, force: true });
25262
24977
  }
25263
24978
  function readManifestLockSnapshot(lockDir) {
25264
24979
  let stat5;
25265
24980
  try {
25266
- stat5 = fs7.statSync(lockDir);
24981
+ stat5 = fs6.statSync(lockDir);
25267
24982
  } catch (error) {
25268
24983
  if (error.code === "ENOENT") {
25269
24984
  return void 0;
@@ -25271,7 +24986,7 @@ function readManifestLockSnapshot(lockDir) {
25271
24986
  throw error;
25272
24987
  }
25273
24988
  try {
25274
- const owner = fs7.readFileSync(path31.join(lockDir, "owner"), "utf8").trim();
24989
+ const owner = fs6.readFileSync(path30.join(lockDir, "owner"), "utf8").trim();
25275
24990
  return { mtimeMs: stat5.mtimeMs, owner };
25276
24991
  } catch (error) {
25277
24992
  if (error.code === "ENOENT") {
@@ -25343,9 +25058,9 @@ function sleepSync(ms) {
25343
25058
  }
25344
25059
  function createPersonalSpace(baseDir, memoryDirOverride) {
25345
25060
  const homeDir = baseDir ?? resolveHomeDir();
25346
- const standalonePath = path31.join(homeDir, ".engram", "memory");
25347
- const openclawPath = path31.join(homeDir, ".openclaw", "workspace", "memory", "local");
25348
- const memoryDir = memoryDirOverride ?? readEnvVar("REMNIC_MEMORY_DIR") ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs7.existsSync(standalonePath) ? standalonePath : fs7.existsSync(openclawPath) ? openclawPath : standalonePath);
25061
+ const standalonePath = path30.join(homeDir, ".engram", "memory");
25062
+ const openclawPath = path30.join(homeDir, ".openclaw", "workspace", "memory", "local");
25063
+ const memoryDir = memoryDirOverride ?? readEnvVar("REMNIC_MEMORY_DIR") ?? readEnvVar("ENGRAM_MEMORY_DIR") ?? (fs6.existsSync(standalonePath) ? standalonePath : fs6.existsSync(openclawPath) ? openclawPath : standalonePath);
25349
25064
  const normalizedMemoryDir = normalizeSpaceMemoryDir(memoryDir);
25350
25065
  const now = (/* @__PURE__ */ new Date()).toISOString();
25351
25066
  return {
@@ -25373,7 +25088,7 @@ function createSpace(options) {
25373
25088
  const id = options.name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-");
25374
25089
  const now = (/* @__PURE__ */ new Date()).toISOString();
25375
25090
  const memoryDir = normalizeSpaceMemoryDir(
25376
- options.memoryDir ?? path31.join(getSpacesDir(options.baseDir), id, "memory")
25091
+ options.memoryDir ?? path30.join(getSpacesDir(options.baseDir), id, "memory")
25377
25092
  );
25378
25093
  const space = updateManifest(options.baseDir, (manifest) => {
25379
25094
  if (manifest.spaces.some((s) => s.id === id)) {
@@ -25393,7 +25108,7 @@ function createSpace(options) {
25393
25108
  owner: readEnvVar("USER"),
25394
25109
  parentSpaceId: options.parentSpaceId
25395
25110
  };
25396
- fs7.mkdirSync(memoryDir, { recursive: true });
25111
+ fs6.mkdirSync(memoryDir, { recursive: true });
25397
25112
  manifest.spaces.push(created);
25398
25113
  manifest.updatedAt = now;
25399
25114
  return created;
@@ -25548,6 +25263,29 @@ async function promoteSpace(sourceSpaceId, targetSpaceId, options) {
25548
25263
  throw new Error("Spaces must have a parent-child relationship for promotion. Use --force to override.");
25549
25264
  }
25550
25265
  }
25266
+ const subjectWarnings = [];
25267
+ const warnedMemoryIds = [];
25268
+ if (target.kind === "team") {
25269
+ const sourceFiles = fs6.existsSync(source.memoryDir) ? walkMd(fs6.realpathSync(source.memoryDir)) : [];
25270
+ for (const file of sourceFiles) {
25271
+ const fm = parseSimpleFrontmatter(fs6.readFileSync(file, "utf8"));
25272
+ if (!fm?.id) continue;
25273
+ if (options?.memoryIds?.length && !options.memoryIds.includes(fm.id)) continue;
25274
+ const decision = evaluateSubjectGuard({
25275
+ subject: fm.subject === "user" || fm.subject === "agent" ? fm.subject : void 0,
25276
+ sharedTarget: true,
25277
+ mode: options?.subjectGuard ?? "warn",
25278
+ allowUserSubject: options?.allowUserSubject
25279
+ });
25280
+ if (decision.action === "reject") {
25281
+ throw new Error(`space promote blocked by subject guard: memory ${fm.id} \u2014 ${decision.reason}`);
25282
+ }
25283
+ if (decision.action === "warn") {
25284
+ subjectWarnings.push(`memory ${fm.id}: ${decision.reason}`);
25285
+ warnedMemoryIds.push(fm.id);
25286
+ }
25287
+ }
25288
+ }
25551
25289
  const result = await copyMemories(source.memoryDir, target.memoryDir, {
25552
25290
  filterIds: options?.memoryIds,
25553
25291
  force: options?.forceOverwrite !== void 0 ? options.forceOverwrite : options?.force ?? false
@@ -25557,7 +25295,8 @@ async function promoteSpace(sourceSpaceId, targetSpaceId, options) {
25557
25295
  action: "space.promote",
25558
25296
  sourceSpaceId,
25559
25297
  targetSpaceId,
25560
- details: `Promoted ${result.merged} memories from "${source.name}" to "${target.name}"`
25298
+ details: `Promoted ${result.merged} memories from "${source.name}" to "${target.name}"${subjectWarnings.length > 0 ? `; subject-guard warned ${subjectWarnings.length} user-subject memories (${warnedMemoryIds.join(", ")})` : ""}${options?.allowUserSubject === true ? "; user-subject override: --allow-user-subject" : ""}`,
25299
+ ...warnedMemoryIds.length > 0 ? { memoryIds: warnedMemoryIds } : {}
25561
25300
  },
25562
25301
  options?.baseDir
25563
25302
  );
@@ -25566,7 +25305,8 @@ async function promoteSpace(sourceSpaceId, targetSpaceId, options) {
25566
25305
  targetSpaceId,
25567
25306
  memoriesPromoted: result.merged,
25568
25307
  conflicts: result.conflicts,
25569
- durationMs: Date.now() - startTime
25308
+ durationMs: Date.now() - startTime,
25309
+ ...subjectWarnings.length > 0 ? { subjectWarnings } : {}
25570
25310
  };
25571
25311
  }
25572
25312
  async function mergeSpaces(sourceSpaceId, targetSpaceId, options) {
@@ -25594,39 +25334,39 @@ async function mergeSpaces(sourceSpaceId, targetSpaceId, options) {
25594
25334
  };
25595
25335
  }
25596
25336
  function getAuditLog(baseDir) {
25597
- const auditPath = path31.join(getSpacesDir(baseDir), "audit.jsonl");
25598
- if (!fs7.existsSync(auditPath)) return [];
25599
- const lines = fs7.readFileSync(auditPath, "utf8").trim().split("\n");
25337
+ const auditPath = path30.join(getSpacesDir(baseDir), "audit.jsonl");
25338
+ if (!fs6.existsSync(auditPath)) return [];
25339
+ const lines = fs6.readFileSync(auditPath, "utf8").trim().split("\n");
25600
25340
  return lines.filter((l) => l.trim()).map((l) => JSON.parse(l));
25601
25341
  }
25602
25342
  function appendAudit(entry, baseDir) {
25603
- const auditPath = path31.join(getSpacesDir(baseDir), "audit.jsonl");
25604
- fs7.mkdirSync(path31.dirname(auditPath), { recursive: true });
25343
+ const auditPath = path30.join(getSpacesDir(baseDir), "audit.jsonl");
25344
+ fs6.mkdirSync(path30.dirname(auditPath), { recursive: true });
25605
25345
  const full = {
25606
25346
  id: crypto7.randomUUID(),
25607
25347
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
25608
25348
  ...entry
25609
25349
  };
25610
- fs7.appendFileSync(auditPath, `${JSON.stringify(full)}
25350
+ fs6.appendFileSync(auditPath, `${JSON.stringify(full)}
25611
25351
  `);
25612
25352
  }
25613
25353
  async function copyMemories(sourceDir, targetDir, options) {
25614
- if (!fs7.existsSync(sourceDir)) {
25354
+ if (!fs6.existsSync(sourceDir)) {
25615
25355
  return { merged: 0, conflicts: [], skipped: 0 };
25616
25356
  }
25617
- const sourceRoot = fs7.realpathSync(sourceDir);
25618
- fs7.mkdirSync(targetDir, { recursive: true });
25619
- const targetRoot = fs7.realpathSync(targetDir);
25620
- const sourceFiles = walkMd2(sourceRoot);
25357
+ const sourceRoot = fs6.realpathSync(sourceDir);
25358
+ fs6.mkdirSync(targetDir, { recursive: true });
25359
+ const targetRoot = fs6.realpathSync(targetDir);
25360
+ const sourceFiles = walkMd(sourceRoot);
25621
25361
  const sourceEntityIds = new Set(
25622
25362
  sourceFiles.filter((p) => {
25623
25363
  const rp = safeRealpath(p);
25624
25364
  if (!rp || !isPathInsideRoot(rp, sourceRoot)) return false;
25625
- const rel = path31.relative(sourceRoot, rp);
25626
- const mapped = path31.resolve(targetRoot, rel);
25365
+ const rel = path30.relative(sourceRoot, rp);
25366
+ const mapped = path30.resolve(targetRoot, rel);
25627
25367
  if (!isPathInsideRoot(mapped, targetRoot)) return false;
25628
25368
  return classifyEntityRefWritePath(targetRoot, mapped) === "entity";
25629
- }).map((p) => path31.basename(p, ".md"))
25369
+ }).map((p) => path30.basename(p, ".md"))
25630
25370
  );
25631
25371
  const firstEntityId = sourceEntityIds.values().next().value;
25632
25372
  if (firstEntityId === void 0) {
@@ -25634,7 +25374,7 @@ async function copyMemories(sourceDir, targetDir, options) {
25634
25374
  }
25635
25375
  return withRawEntityPageMutation(
25636
25376
  targetRoot,
25637
- path31.join(targetRoot, "entities", `${firstEntityId}.md`),
25377
+ path30.join(targetRoot, "entities", `${firstEntityId}.md`),
25638
25378
  async () => copyPreparedMemories(
25639
25379
  sourceFiles,
25640
25380
  sourceRoot,
@@ -25660,15 +25400,15 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
25660
25400
  skipped++;
25661
25401
  continue;
25662
25402
  }
25663
- const content = fs7.readFileSync(sourcePath, "utf8");
25664
- const relativePath = path31.relative(sourceRoot, sourceRealPath);
25665
- const targetPath = path31.resolve(targetRoot, relativePath);
25403
+ const content = fs6.readFileSync(sourcePath, "utf8");
25404
+ const relativePath = path30.relative(sourceRoot, sourceRealPath);
25405
+ const targetPath = path30.resolve(targetRoot, relativePath);
25666
25406
  if (!isPathInsideRoot(targetPath, targetRoot)) {
25667
25407
  skipped++;
25668
25408
  continue;
25669
25409
  }
25670
25410
  const targetKind = classifyEntityRefWritePath(targetRoot, targetPath);
25671
- const idsAtCompare = historicalIdCache4.get(path31.join(targetRoot, "state"));
25411
+ const idsAtCompare = historicalIdCache3.get(path30.join(targetRoot, "state"));
25672
25412
  const sourceRef = targetKind === "memory" ? readEntityRefFromFrontmatter(content) : null;
25673
25413
  const refHasSourceClaimant = sourceRef !== null && sourceEntityIds.has(sourceRef);
25674
25414
  const canonicalContent = targetKind === "memory" && !refHasSourceClaimant ? canonicalizeEntityRefFrontmatter(content, idsAtCompare) : content;
@@ -25680,7 +25420,7 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
25680
25420
  continue;
25681
25421
  }
25682
25422
  }
25683
- if (fs7.existsSync(targetPath)) {
25423
+ if (fs6.existsSync(targetPath)) {
25684
25424
  const targetStat = safeLstat(targetPath);
25685
25425
  if (!targetStat?.isFile() || targetStat.isSymbolicLink()) {
25686
25426
  skipped++;
@@ -25692,10 +25432,10 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
25692
25432
  continue;
25693
25433
  }
25694
25434
  }
25695
- if (fs7.existsSync(targetPath) && !options?.force) {
25696
- const targetContent = fs7.readFileSync(targetPath, "utf8");
25435
+ if (fs6.existsSync(targetPath) && !options?.force) {
25436
+ const targetContent = fs6.readFileSync(targetPath, "utf8");
25697
25437
  const targetHash = hashContent4(targetContent);
25698
- if (hashContent4(canonicalContent) === targetHash && historicalIdCache4.get(path31.join(targetRoot, "state")) === idsAtCompare) {
25438
+ if (hashContent4(canonicalContent) === targetHash && historicalIdCache3.get(path30.join(targetRoot, "state")) === idsAtCompare) {
25699
25439
  skipped++;
25700
25440
  continue;
25701
25441
  }
@@ -25711,48 +25451,48 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
25711
25451
  continue;
25712
25452
  }
25713
25453
  }
25714
- fs7.mkdirSync(path31.dirname(targetPath), { recursive: true });
25715
- const targetParentRealPath = safeRealpath(path31.dirname(targetPath));
25454
+ fs6.mkdirSync(path30.dirname(targetPath), { recursive: true });
25455
+ const targetParentRealPath = safeRealpath(path30.dirname(targetPath));
25716
25456
  if (!targetParentRealPath || !isPathInsideRoot(targetParentRealPath, targetRoot)) {
25717
25457
  skipped++;
25718
25458
  continue;
25719
25459
  }
25720
- const stateDir = path31.join(targetRoot, "state");
25460
+ const stateDir = path30.join(targetRoot, "state");
25721
25461
  if (targetKind === "memory" && !refHasSourceClaimant) {
25722
- const idsAtWrite = historicalIdCache4.get(stateDir);
25462
+ const idsAtWrite = historicalIdCache3.get(stateDir);
25723
25463
  const written = canonicalizeEntityRefFrontmatter(content, idsAtWrite);
25724
25464
  let priorTarget = null;
25725
25465
  try {
25726
- priorTarget = fs7.readFileSync(targetPath, "utf8");
25466
+ priorTarget = fs6.readFileSync(targetPath, "utf8");
25727
25467
  } catch {
25728
25468
  priorTarget = null;
25729
25469
  }
25730
- fs7.writeFileSync(targetPath, written);
25470
+ fs6.writeFileSync(targetPath, written);
25731
25471
  try {
25732
25472
  repairContentAfterJournalMoveSync({
25733
25473
  stateDir,
25734
- cache: historicalIdCache4,
25474
+ cache: historicalIdCache3,
25735
25475
  idsAtWrite,
25736
25476
  rawContent: content,
25737
25477
  lastWritten: written,
25738
- rewrite: (next) => fs7.writeFileSync(targetPath, next)
25478
+ rewrite: (next) => fs6.writeFileSync(targetPath, next)
25739
25479
  });
25740
25480
  } catch (err) {
25741
25481
  try {
25742
25482
  if (priorTarget === null) {
25743
- fs7.unlinkSync(targetPath);
25483
+ fs6.unlinkSync(targetPath);
25744
25484
  } else {
25745
- fs7.writeFileSync(targetPath, priorTarget);
25485
+ fs6.writeFileSync(targetPath, priorTarget);
25746
25486
  }
25747
25487
  } catch {
25748
25488
  }
25749
25489
  throw err;
25750
25490
  }
25751
25491
  } else if (targetKind === "memory") {
25752
- fs7.writeFileSync(targetPath, content);
25492
+ fs6.writeFileSync(targetPath, content);
25753
25493
  reconcileNeeded = true;
25754
25494
  } else {
25755
- fs7.writeFileSync(targetPath, content);
25495
+ fs6.writeFileSync(targetPath, content);
25756
25496
  if (targetKind === "entity") {
25757
25497
  reconcileNeeded = true;
25758
25498
  }
@@ -25761,18 +25501,18 @@ function copyPreparedMemories(sourceFiles, sourceRoot, targetRoot, sourceEntityI
25761
25501
  bumpMemoryCorpusVersionForDir(targetRoot);
25762
25502
  }
25763
25503
  if (reconcileNeeded) {
25764
- requestEntityCanonicalIdReconcileSync(path31.join(targetRoot, "state"));
25504
+ requestEntityCanonicalIdReconcileSync(path30.join(targetRoot, "state"));
25765
25505
  }
25766
25506
  return { merged, conflicts, skipped };
25767
25507
  }
25768
25508
  function hashContent4(content) {
25769
25509
  return crypto7.createHash("sha256").update(content).digest("hex").slice(0, 16);
25770
25510
  }
25771
- function walkMd2(dir) {
25511
+ function walkMd(dir) {
25772
25512
  const results = [];
25773
25513
  function walk(d) {
25774
- for (const entry of fs7.readdirSync(d, { withFileTypes: true })) {
25775
- const fullPath = path31.join(d, entry.name);
25514
+ for (const entry of fs6.readdirSync(d, { withFileTypes: true })) {
25515
+ const fullPath = path30.join(d, entry.name);
25776
25516
  if (entry.isSymbolicLink()) {
25777
25517
  continue;
25778
25518
  }
@@ -25788,21 +25528,21 @@ function walkMd2(dir) {
25788
25528
  }
25789
25529
  function safeLstat(filePath) {
25790
25530
  try {
25791
- return fs7.lstatSync(filePath);
25531
+ return fs6.lstatSync(filePath);
25792
25532
  } catch {
25793
25533
  return null;
25794
25534
  }
25795
25535
  }
25796
25536
  function safeRealpath(filePath) {
25797
25537
  try {
25798
- return fs7.realpathSync(filePath);
25538
+ return fs6.realpathSync(filePath);
25799
25539
  } catch {
25800
25540
  return null;
25801
25541
  }
25802
25542
  }
25803
25543
  function isPathInsideRoot(candidatePath, rootPath) {
25804
- const relative = path31.relative(rootPath, candidatePath);
25805
- return relative === "" || !relative.startsWith("..") && !path31.isAbsolute(relative);
25544
+ const relative = path30.relative(rootPath, candidatePath);
25545
+ return relative === "" || !relative.startsWith("..") && !path30.isAbsolute(relative);
25806
25546
  }
25807
25547
  function parseSimpleFrontmatter(content) {
25808
25548
  const match = content.match(/^---\n([\s\S]*?)\n---/);
@@ -25921,9 +25661,9 @@ var REMNIC_RECALL_DECISION_RULES = `## When to Use Recall vs Direct Read
25921
25661
  `;
25922
25662
 
25923
25663
  // src/memory-extension/codex-publisher.ts
25924
- import fs8 from "fs";
25664
+ import fs7 from "fs";
25925
25665
  import os from "os";
25926
- import path32 from "path";
25666
+ import path31 from "path";
25927
25667
  var REMNIC_EXTENSION_DIR_NAME = "remnic";
25928
25668
  function resolveEnvHome(env) {
25929
25669
  if (env === void 0) return resolveHomeDir();
@@ -25932,12 +25672,12 @@ function resolveEnvHome(env) {
25932
25672
  function expandTildeWithHome(input, homeDir) {
25933
25673
  if (input === "~") return homeDir;
25934
25674
  if (input.startsWith("~/") || input.startsWith("~\\")) {
25935
- return path32.join(homeDir, input.slice(2));
25675
+ return path31.join(homeDir, input.slice(2));
25936
25676
  }
25937
25677
  return input;
25938
25678
  }
25939
25679
  function normalizeHostRoot(input, homeDir) {
25940
- return path32.resolve(expandTildeWithHome(input.trim(), homeDir));
25680
+ return path31.resolve(expandTildeWithHome(input.trim(), homeDir));
25941
25681
  }
25942
25682
  var CodexMemoryExtensionPublisher = class {
25943
25683
  hostId = "codex";
@@ -25951,13 +25691,13 @@ var CodexMemoryExtensionPublisher = class {
25951
25691
  async resolveExtensionRoot(env) {
25952
25692
  const homeDir = resolveEnvHome(env);
25953
25693
  const codexHomeInput = env === void 0 ? readEnvVar("CODEX_HOME")?.trim() : env.CODEX_HOME?.trim();
25954
- const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) : path32.resolve(homeDir, ".codex");
25955
- return path32.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME);
25694
+ const codexHome = codexHomeInput ? normalizeHostRoot(codexHomeInput, homeDir) : path31.resolve(homeDir, ".codex");
25695
+ return path31.join(codexHome, "memories_extensions", REMNIC_EXTENSION_DIR_NAME);
25956
25696
  }
25957
25697
  async isHostAvailable() {
25958
25698
  try {
25959
- const home = readEnvVar("CODEX_HOME")?.trim() || path32.join(resolveHomeDir(), ".codex");
25960
- return fs8.existsSync(home);
25699
+ const home = readEnvVar("CODEX_HOME")?.trim() || path31.join(resolveHomeDir(), ".codex");
25700
+ return fs7.existsSync(home);
25961
25701
  } catch {
25962
25702
  return false;
25963
25703
  }
@@ -26007,22 +25747,22 @@ When running inside the Codex phase-2 consolidation sandbox:
26007
25747
  }
26008
25748
  async publish(ctx) {
26009
25749
  const extensionRoot = await this.resolveExtensionRoot();
26010
- const instructionsPath = path32.join(extensionRoot, "instructions.md");
25750
+ const instructionsPath = path31.join(extensionRoot, "instructions.md");
26011
25751
  const filesWritten = [];
26012
25752
  const skipped = [];
26013
25753
  ctx.log.info(`Publishing Codex memory extension to ${extensionRoot}`);
26014
- fs8.mkdirSync(extensionRoot, { recursive: true });
25754
+ fs7.mkdirSync(extensionRoot, { recursive: true });
26015
25755
  const content = await this.renderInstructions(ctx);
26016
25756
  const tmpPath = `${instructionsPath}.tmp-${process.pid}-${Date.now()}`;
26017
25757
  try {
26018
- fs8.writeFileSync(tmpPath, content, "utf-8");
26019
- fs8.renameSync(tmpPath, instructionsPath);
25758
+ fs7.writeFileSync(tmpPath, content, "utf-8");
25759
+ fs7.renameSync(tmpPath, instructionsPath);
26020
25760
  filesWritten.push(instructionsPath);
26021
25761
  ctx.log.info(`Wrote ${instructionsPath}`);
26022
25762
  } catch (err) {
26023
25763
  try {
26024
- if (fs8.existsSync(tmpPath)) {
26025
- fs8.unlinkSync(tmpPath);
25764
+ if (fs7.existsSync(tmpPath)) {
25765
+ fs7.unlinkSync(tmpPath);
26026
25766
  }
26027
25767
  } catch {
26028
25768
  }
@@ -26037,8 +25777,8 @@ When running inside the Codex phase-2 consolidation sandbox:
26037
25777
  }
26038
25778
  async unpublish() {
26039
25779
  const extensionRoot = await this.resolveExtensionRoot();
26040
- if (fs8.existsSync(extensionRoot)) {
26041
- fs8.rmSync(extensionRoot, { recursive: true, force: true });
25780
+ if (fs7.existsSync(extensionRoot)) {
25781
+ fs7.rmSync(extensionRoot, { recursive: true, force: true });
26042
25782
  }
26043
25783
  }
26044
25784
  };
@@ -26383,7 +26123,7 @@ async function generateActivityMemories(date, digestBody, config, deps) {
26383
26123
  // src/session-summaries/index.ts
26384
26124
  import { createHash as createHash9 } from "crypto";
26385
26125
  import { lstat as lstat3, mkdir as mkdir7, readFile as readFile7, readdir as readdir4, rename, rm, stat as stat4, writeFile as writeFile7 } from "fs/promises";
26386
- import path33 from "path";
26126
+ import path32 from "path";
26387
26127
 
26388
26128
  // src/session-summaries/adapters.ts
26389
26129
  var VALID_ROLES = /* @__PURE__ */ new Set(["user", "assistant", "tool", "system", "other"]);
@@ -26888,7 +26628,7 @@ function shortHash(value, length = 16) {
26888
26628
  async function listTranscriptFiles(root, maxFiles) {
26889
26629
  const out = [];
26890
26630
  let truncated = false;
26891
- const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path33.sep}` : entryName;
26631
+ const entrySortKey = (entryName, isDirectory) => isDirectory ? `${entryName}${path32.sep}` : entryName;
26892
26632
  async function visit(dir) {
26893
26633
  if (truncated) return;
26894
26634
  const entries = (await readdir4(dir, { withFileTypes: true })).sort(
@@ -26898,13 +26638,13 @@ async function listTranscriptFiles(root, maxFiles) {
26898
26638
  if (truncated) return;
26899
26639
  if (entry.name.startsWith(".")) continue;
26900
26640
  if (entry.isSymbolicLink()) continue;
26901
- const fullPath = path33.join(dir, entry.name);
26641
+ const fullPath = path32.join(dir, entry.name);
26902
26642
  if (entry.isDirectory()) {
26903
26643
  await visit(fullPath);
26904
26644
  continue;
26905
26645
  }
26906
26646
  if (!entry.isFile()) continue;
26907
- const ext = path33.extname(entry.name).toLowerCase();
26647
+ const ext = path32.extname(entry.name).toLowerCase();
26908
26648
  if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
26909
26649
  out.push(fullPath);
26910
26650
  if (out.length > maxFiles) {
@@ -26931,7 +26671,7 @@ function normalizeInputDir(inputDir) {
26931
26671
  if (typeof inputDir !== "string" || inputDir.trim().length === 0) {
26932
26672
  throw new Error("inputDir must be a non-empty string");
26933
26673
  }
26934
- return path33.resolve(expandTildePath(inputDir.trim()));
26674
+ return path32.resolve(expandTildePath(inputDir.trim()));
26935
26675
  }
26936
26676
  function initRoleCounts() {
26937
26677
  return {
@@ -27088,11 +26828,11 @@ async function collectLocalSessionSummaries(options) {
27088
26828
  continue;
27089
26829
  }
27090
26830
  seenFileHashes.add(fileHash);
27091
- const fileExtension = path33.extname(filePath).toLowerCase();
26831
+ const fileExtension = path32.extname(filePath).toLowerCase();
27092
26832
  const parsed = await adapter.parseFile(
27093
26833
  {
27094
26834
  content,
27095
- fileName: path33.basename(filePath),
26835
+ fileName: path32.basename(filePath),
27096
26836
  fileExtension,
27097
26837
  fileRef: fileHash
27098
26838
  },
@@ -27148,7 +26888,7 @@ async function collectLocalSessionSummaries(options) {
27148
26888
  }
27149
26889
  async function readRedactionConfig(pathLike) {
27150
26890
  if (!pathLike) return void 0;
27151
- const raw = await readFile7(path33.resolve(expandTildePath(pathLike)), "utf-8");
26891
+ const raw = await readFile7(path32.resolve(expandTildePath(pathLike)), "utf-8");
27152
26892
  const parsed = JSON.parse(raw);
27153
26893
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
27154
26894
  throw new Error("redaction config must be a JSON object");
@@ -27161,15 +26901,15 @@ function toJsonl(drafts) {
27161
26901
  }
27162
26902
  function defaultDraftOutputPath(memoryDir, generatedAt) {
27163
26903
  const stamp = generatedAt.replace(/[:.]/g, "-");
27164
- return path33.join(
27165
- path33.resolve(expandTildePath(memoryDir)),
26904
+ return path32.join(
26905
+ path32.resolve(expandTildePath(memoryDir)),
27166
26906
  "state",
27167
26907
  "session-summary-drafts",
27168
26908
  `session-summaries-${stamp}.jsonl`
27169
26909
  );
27170
26910
  }
27171
26911
  async function writeDrafts(filePath, drafts) {
27172
- await mkdir7(path33.dirname(filePath), { recursive: true });
26912
+ await mkdir7(path32.dirname(filePath), { recursive: true });
27173
26913
  const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
27174
26914
  try {
27175
26915
  await writeFile7(tempPath, toJsonl(drafts), "utf-8");
@@ -27187,7 +26927,7 @@ async function runLocalSessionSummaryCliCommand(options) {
27187
26927
  });
27188
26928
  const wroteFiles = [];
27189
26929
  if (options.output) {
27190
- const outputPath = path33.resolve(expandTildePath(options.output));
26930
+ const outputPath = path32.resolve(expandTildePath(options.output));
27191
26931
  await writeDrafts(outputPath, report.drafts);
27192
26932
  wroteFiles.push(outputPath);
27193
26933
  }
@@ -27222,19 +26962,19 @@ async function runLocalSessionSummaryCliCommand(options) {
27222
26962
 
27223
26963
  // src/transfer/capsule-fork.ts
27224
26964
  import { lstat as lstat4, mkdir as mkdir8, readFile as readFile8, realpath as realpath3, writeFile as writeFile8 } from "fs/promises";
27225
- import path34 from "path";
26965
+ import path33 from "path";
27226
26966
  async function forkCapsule(opts) {
27227
26967
  validateForkId(opts.forkId);
27228
- const rootAbs = path34.resolve(opts.targetRoot);
26968
+ const rootAbs = path33.resolve(opts.targetRoot);
27229
26969
  await assertIsDirectoryNotSymlink(rootAbs, "forkCapsule", "targetRoot");
27230
- const forkDirAbs = path34.join(rootAbs, "forks", opts.forkId);
26970
+ const forkDirAbs = path33.join(rootAbs, "forks", opts.forkId);
27231
26971
  const forkEntryExists = await pathEntryExists(forkDirAbs);
27232
26972
  if (forkEntryExists) {
27233
26973
  throw new Error(
27234
26974
  `forkCapsule: fork path already exists \u2014 forkId "${opts.forkId}" is already in use at: ${forkDirAbs}`
27235
26975
  );
27236
26976
  }
27237
- const archiveAbs = path34.resolve(opts.sourceArchive);
26977
+ const archiveAbs = path33.resolve(opts.sourceArchive);
27238
26978
  const importResult = await importCapsule({
27239
26979
  archivePath: archiveAbs,
27240
26980
  root: rootAbs,
@@ -27256,10 +26996,10 @@ async function forkCapsule(opts) {
27256
26996
  importedRecords: importResult.imported.length,
27257
26997
  skippedRecords: importResult.skipped.length
27258
26998
  };
27259
- const lineagePath = path34.join(forkDirAbs, "lineage.json");
26999
+ const lineagePath = path33.join(forkDirAbs, "lineage.json");
27260
27000
  const rootReal = await realpath3(rootAbs);
27261
27001
  await assertRealpathInsideRoot(rootReal, lineagePath, `forks/${opts.forkId}/lineage.json`, "forkCapsule");
27262
- await mkdir8(path34.dirname(lineagePath), { recursive: true });
27002
+ await mkdir8(path33.dirname(lineagePath), { recursive: true });
27263
27003
  await writeFile8(lineagePath, JSON.stringify(lineage, null, 2) + "\n", "utf-8");
27264
27004
  return {
27265
27005
  archivePath: archiveAbs,
@@ -27273,11 +27013,11 @@ async function readForkLineage(targetRoot, forkId) {
27273
27013
  if (typeof forkId !== "string" || forkId.length === 0 || forkId.length > 64 || !CAPSULE_ID_PATTERN.test(forkId)) {
27274
27014
  return null;
27275
27015
  }
27276
- const rootAbs = path34.resolve(targetRoot);
27016
+ const rootAbs = path33.resolve(targetRoot);
27277
27017
  const rootReal = await realpath3(rootAbs).catch(() => rootAbs);
27278
- const lineagePath = path34.join(rootReal, "forks", forkId, "lineage.json");
27279
- const rel = path34.relative(rootReal, lineagePath);
27280
- if (rel.startsWith("..") || path34.isAbsolute(rel)) {
27018
+ const lineagePath = path33.join(rootReal, "forks", forkId, "lineage.json");
27019
+ const rel = path33.relative(rootReal, lineagePath);
27020
+ if (rel.startsWith("..") || path33.isAbsolute(rel)) {
27281
27021
  return null;
27282
27022
  }
27283
27023
  if (!await isLineagePathContained(rootReal, lineagePath)) {
@@ -27318,23 +27058,26 @@ async function pathEntryExists(absPath) {
27318
27058
  async function isLineagePathContained(rootReal, lineagePath) {
27319
27059
  let existing = lineagePath;
27320
27060
  const suffix = [];
27321
- while (existing !== path34.dirname(existing)) {
27061
+ while (existing !== path33.dirname(existing)) {
27322
27062
  const st = await lstat4(existing).catch(() => null);
27323
27063
  if (st !== null) break;
27324
- suffix.unshift(path34.basename(existing));
27325
- existing = path34.dirname(existing);
27064
+ suffix.unshift(path33.basename(existing));
27065
+ existing = path33.dirname(existing);
27326
27066
  }
27327
27067
  const existingReal = await realpath3(existing).catch(() => existing);
27328
- const targetReal = suffix.length > 0 ? path34.join(existingReal, ...suffix) : existingReal;
27329
- const rel = path34.relative(rootReal, targetReal);
27068
+ const targetReal = suffix.length > 0 ? path33.join(existingReal, ...suffix) : existingReal;
27069
+ const rel = path33.relative(rootReal, targetReal);
27330
27070
  if (rel === "") return true;
27331
27071
  if (rel === "..") return false;
27332
- if (rel.startsWith(`..${path34.sep}`)) return false;
27333
- if (path34.isAbsolute(rel)) return false;
27072
+ if (rel.startsWith(`..${path33.sep}`)) return false;
27073
+ if (path33.isAbsolute(rel)) return false;
27334
27074
  return true;
27335
27075
  }
27336
27076
 
27337
27077
  export {
27078
+ isPreferenceDriftStageActive,
27079
+ driftAgeNote,
27080
+ applyPreferenceDriftRanking,
27338
27081
  buildProcedureRecallSection,
27339
27082
  RELAY_DEMO_MISSION_ID,
27340
27083
  RELAY_DEMO_NAMESPACE,
@@ -27373,8 +27116,6 @@ export {
27373
27116
  findDuplicates,
27374
27117
  findContradictions,
27375
27118
  decideSemanticDedup,
27376
- listReviewItems,
27377
- performReview,
27378
27119
  syncChanges,
27379
27120
  watchForChanges,
27380
27121
  getSpacesDir,
@@ -27449,4 +27190,4 @@ export {
27449
27190
  blendGraphExpandedRecallScore,
27450
27191
  Orchestrator
27451
27192
  };
27452
- //# sourceMappingURL=chunk-DBXZZIDU.js.map
27193
+ //# sourceMappingURL=chunk-H5FW4S5Q.js.map