@remnic/core 9.45.3 → 9.45.5

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 (766) hide show
  1. package/dist/abort-error.d.ts +2 -1
  2. package/dist/abort-error.js +3 -1
  3. package/dist/access-admin-ops-surface.d.ts +14 -10
  4. package/dist/access-admin-ops-surface.js +84 -75
  5. package/dist/access-audit.js +2 -2
  6. package/dist/access-authorization-probe.d.ts +14 -10
  7. package/dist/access-authorization-probe.js +85 -76
  8. package/dist/access-boundary.d.ts +15 -11
  9. package/dist/access-boundary.js +84 -75
  10. package/dist/access-citation-namespace.js +2 -2
  11. package/dist/access-cli.js +191 -177
  12. package/dist/access-cli.js.map +1 -1
  13. package/dist/access-coding-context-resolution.d.ts +16 -0
  14. package/dist/access-coding-context-resolution.js +13 -0
  15. package/dist/access-coding-context-resolution.js.map +1 -0
  16. package/dist/access-extraction-force-flush.d.ts +14 -10
  17. package/dist/access-extraction-force-flush.js +84 -75
  18. package/dist/access-health-types.d.ts +2 -1
  19. package/dist/access-http-lcm-compaction.d.ts +16 -12
  20. package/dist/access-http-lcm-compaction.js +3 -3
  21. package/dist/access-http-lifecycle-flush.d.ts +14 -10
  22. package/dist/access-http-lifecycle-flush.js +2 -2
  23. package/dist/access-http-offline-stream.d.ts +123 -0
  24. package/dist/access-http-offline-stream.js +10 -0
  25. package/dist/access-http-offline-stream.js.map +1 -0
  26. package/dist/access-http-query.js +84 -75
  27. package/dist/access-http.d.ts +15 -11
  28. package/dist/access-http.js +104 -90
  29. package/dist/access-identity-continuity-surface.d.ts +9 -8
  30. package/dist/access-identity-continuity-surface.js +84 -75
  31. package/dist/access-lcm-surface.d.ts +14 -10
  32. package/dist/access-lcm-surface.js +84 -75
  33. package/dist/access-mcp-output-schemas.js +1 -1
  34. package/dist/access-mcp.d.ts +14 -10
  35. package/dist/access-mcp.js +95 -82
  36. package/dist/access-memory-search-fanout.d.ts +3 -2
  37. package/dist/{access-namespace-preflight-5yZ4g6F8.d.ts → access-namespace-preflight-CWUDwB4M.d.ts} +1 -1
  38. package/dist/access-namespace-preflight.d.ts +4 -3
  39. package/dist/access-namespace-preflight.js +84 -75
  40. package/dist/access-observe-helpers.d.ts +1 -0
  41. package/dist/access-observe-helpers.js +1 -1
  42. package/dist/access-observe-write-surface.d.ts +16 -10
  43. package/dist/access-observe-write-surface.js +84 -75
  44. package/dist/access-offline-manifest.d.ts +104 -0
  45. package/dist/access-offline-manifest.js +45 -0
  46. package/dist/access-offline-manifest.js.map +1 -0
  47. package/dist/access-operations-batch.js +86 -77
  48. package/dist/access-operations.d.ts +18 -14
  49. package/dist/access-operations.js +91 -79
  50. package/dist/access-recall-concurrency.d.ts +16 -26
  51. package/dist/access-recall-concurrency.js +86 -76
  52. package/dist/access-recall-response.d.ts +18 -14
  53. package/dist/access-recall-response.js +84 -75
  54. package/dist/access-recall-surface.d.ts +29 -24
  55. package/dist/access-recall-surface.js +84 -75
  56. package/dist/access-schema.d.ts +84 -84
  57. package/dist/access-schema.js +3 -3
  58. package/dist/{access-service-CiJRsgAB.d.ts → access-service-CNN89xyn.d.ts} +25 -16
  59. package/dist/access-service-helpers.d.ts +14 -10
  60. package/dist/access-service.d.ts +14 -10
  61. package/dist/access-service.js +84 -75
  62. package/dist/access-surface-catalog.d.ts +14 -10
  63. package/dist/access-surface-catalog.js +4 -0
  64. package/dist/access-surface-catalog.js.map +1 -1
  65. package/dist/access-wearables-meetings-surface.d.ts +4 -3
  66. package/dist/action-confidence.d.ts +2 -1
  67. package/dist/active-memory-bridge.d.ts +2 -1
  68. package/dist/active-recall.d.ts +2 -1
  69. package/dist/active-recall.js +10 -8
  70. package/dist/active-recall.js.map +1 -1
  71. package/dist/adapters/index.js +4 -4
  72. package/dist/adapters/registry.js +2 -2
  73. package/dist/{auto-sync-5OE5QOZB.js → auto-sync-UPTUVE4X.js} +6 -6
  74. package/dist/behavior-learner.d.ts +2 -1
  75. package/dist/behavior-learner.js +1 -1
  76. package/dist/behavior-signals.d.ts +2 -1
  77. package/dist/bootstrap.d.ts +9 -8
  78. package/dist/briefing.d.ts +3 -2
  79. package/dist/briefing.js +24 -22
  80. package/dist/buffer-surprise-report.d.ts +2 -1
  81. package/dist/buffer-turn-helpers.d.ts +2 -1
  82. package/dist/buffer.d.ts +3 -2
  83. package/dist/buffer.js +12 -11
  84. package/dist/bulk-import/index.d.ts +4 -3
  85. package/dist/calibration.d.ts +2 -1
  86. package/dist/capabilities.d.ts +2 -1
  87. package/dist/{capsule-merge-IDWJPCWK.js → capsule-merge-Q6AR3XL7.js} +67 -54
  88. package/dist/capsule-merge-Q6AR3XL7.js.map +1 -0
  89. package/dist/{catalog-scBmy0sO.d.ts → catalog-bctMURhN.d.ts} +1 -1
  90. package/dist/causal-behavior.d.ts +2 -1
  91. package/dist/causal-behavior.js +2 -2
  92. package/dist/causal-chain.js +2 -2
  93. package/dist/causal-consolidation.d.ts +2 -1
  94. package/dist/causal-consolidation.js +28 -26
  95. package/dist/causal-consolidation.js.map +1 -1
  96. package/dist/causal-retrieval.js +2 -2
  97. package/dist/causal-trajectory-graph.d.ts +2 -1
  98. package/dist/causal-trajectory.js +1 -1
  99. package/dist/{chunk-E5UK4VPE.js → chunk-2FSTB6BJ.js} +5 -5
  100. package/dist/{chunk-5ZE7QHTK.js → chunk-2X2T2UVE.js} +5 -5
  101. package/dist/{chunk-P4DRWEYC.js → chunk-3COYXTGM.js} +2 -2
  102. package/dist/{chunk-5IVLTFOV.js → chunk-44N6ESJ4.js} +2 -2
  103. package/dist/{chunk-DL7ZD3JH.js → chunk-4FBVAGV3.js} +14 -9
  104. package/dist/chunk-4FBVAGV3.js.map +1 -0
  105. package/dist/{chunk-WOCNN776.js → chunk-4POAMKV6.js} +100 -41
  106. package/dist/chunk-4POAMKV6.js.map +1 -0
  107. package/dist/{chunk-HO3QBJEY.js → chunk-5546W5SI.js} +2 -2
  108. package/dist/{chunk-AAIUERNB.js → chunk-5QJQHBLE.js} +6 -6
  109. package/dist/{chunk-6CZPDBJS.js → chunk-5U7ID3EZ.js} +3 -3
  110. package/dist/{chunk-RN7DY3FC.js → chunk-6ISC4AVB.js} +31 -12
  111. package/dist/chunk-6ISC4AVB.js.map +1 -0
  112. package/dist/chunk-773TRRGT.js +36 -0
  113. package/dist/chunk-773TRRGT.js.map +1 -0
  114. package/dist/chunk-7T4TOGMS.js +242 -0
  115. package/dist/chunk-7T4TOGMS.js.map +1 -0
  116. package/dist/{chunk-DLVPUX7U.js → chunk-7YKVM5H3.js} +8 -6
  117. package/dist/chunk-7YKVM5H3.js.map +1 -0
  118. package/dist/chunk-7YQ6ESEA.js +322 -0
  119. package/dist/chunk-7YQ6ESEA.js.map +1 -0
  120. package/dist/{chunk-DNWXFTLD.js → chunk-A4IJCD2Z.js} +2 -2
  121. package/dist/{chunk-3CE77VAP.js → chunk-A4JMGKCD.js} +87 -74
  122. package/dist/chunk-A4JMGKCD.js.map +1 -0
  123. package/dist/chunk-A5KNZSNA.js +26 -0
  124. package/dist/chunk-A5KNZSNA.js.map +1 -0
  125. package/dist/{chunk-PKNLM44P.js → chunk-AC5OWJLV.js} +9 -9
  126. package/dist/{chunk-LZ4LDKHZ.js → chunk-AMAUBUKY.js} +6 -6
  127. package/dist/{chunk-CUM2BBPN.js → chunk-AUMWZSE7.js} +19 -10
  128. package/dist/chunk-AUMWZSE7.js.map +1 -0
  129. package/dist/{chunk-BUE5E2HL.js → chunk-BGLY7EEM.js} +5 -314
  130. package/dist/chunk-BGLY7EEM.js.map +1 -0
  131. package/dist/chunk-BIPBQQFI.js +44 -0
  132. package/dist/chunk-BIPBQQFI.js.map +1 -0
  133. package/dist/{chunk-S5SLVSVY.js → chunk-BQIFZ2MP.js} +5 -5
  134. package/dist/chunk-BTTPKDIL.js +34 -0
  135. package/dist/{chunk-PVGDJXVK.js.map → chunk-BTTPKDIL.js.map} +1 -1
  136. package/dist/chunk-CK5KOVHW.js +69 -0
  137. package/dist/chunk-CK5KOVHW.js.map +1 -0
  138. package/dist/{chunk-Q6IP2ARR.js → chunk-CSOYVTRX.js} +2 -2
  139. package/dist/{chunk-XOQSEF7X.js → chunk-CVILPI77.js} +6 -6
  140. package/dist/{chunk-VWAXN2BN.js → chunk-CX4ZUMC6.js} +91 -83
  141. package/dist/chunk-CX4ZUMC6.js.map +1 -0
  142. package/dist/{chunk-NVRYW264.js → chunk-DAJPRXBR.js} +16 -13
  143. package/dist/chunk-DAJPRXBR.js.map +1 -0
  144. package/dist/{chunk-J7VGGECD.js → chunk-DZPFMQZ7.js} +1 -1
  145. package/dist/chunk-DZPFMQZ7.js.map +1 -0
  146. package/dist/{chunk-4LMA77JH.js → chunk-E5XQIWAL.js} +3 -3
  147. package/dist/{chunk-WUNIWKY4.js → chunk-ELIL2A37.js} +6 -6
  148. package/dist/{chunk-OQ5PRDDS.js → chunk-ERZ2R42X.js} +6 -6
  149. package/dist/{chunk-U7GW7NE7.js → chunk-FIK3CQNA.js} +10 -10
  150. package/dist/{chunk-D3J5SLQK.js → chunk-FR27HBBA.js} +81 -20
  151. package/dist/chunk-FR27HBBA.js.map +1 -0
  152. package/dist/{chunk-E6PNLPGJ.js → chunk-FUCYDRE5.js} +838 -480
  153. package/dist/chunk-FUCYDRE5.js.map +1 -0
  154. package/dist/{chunk-HZFHQ4AQ.js → chunk-G7A5HLUS.js} +23 -17
  155. package/dist/chunk-G7A5HLUS.js.map +1 -0
  156. package/dist/{chunk-33PLLLL7.js → chunk-GFCVUY6G.js} +6 -6
  157. package/dist/{chunk-HREE4JHI.js → chunk-GODSPTOT.js} +477 -278
  158. package/dist/chunk-GODSPTOT.js.map +1 -0
  159. package/dist/{chunk-S2NCTZGJ.js → chunk-GRUYA45P.js} +15 -15
  160. package/dist/chunk-GRUYA45P.js.map +1 -0
  161. package/dist/{chunk-VUPTKTDV.js → chunk-GUAL4PQH.js} +3 -3
  162. package/dist/{chunk-CINZGPSJ.js → chunk-GUMZC2BO.js} +2 -2
  163. package/dist/{chunk-H24WNPA2.js → chunk-GWFSVJ4P.js} +3 -3
  164. package/dist/{chunk-7XC2HX75.js → chunk-GYPQL6XN.js} +157 -16
  165. package/dist/chunk-GYPQL6XN.js.map +1 -0
  166. package/dist/{chunk-TSH56VPU.js → chunk-HAYSYUAB.js} +2 -2
  167. package/dist/{chunk-PDLBLTOK.js → chunk-HC3PBX23.js} +9 -9
  168. package/dist/{chunk-TDHTVMPG.js → chunk-HFPASSFV.js} +7 -2
  169. package/dist/chunk-HFPASSFV.js.map +1 -0
  170. package/dist/chunk-J2WC5LF4.js +395 -0
  171. package/dist/chunk-J2WC5LF4.js.map +1 -0
  172. package/dist/{chunk-KXB4VXHY.js → chunk-JIYDRBVZ.js} +2 -2
  173. package/dist/chunk-JV3C2MNQ.js +74 -0
  174. package/dist/chunk-JV3C2MNQ.js.map +1 -0
  175. package/dist/{chunk-HLPD7B7P.js → chunk-JZH4LWHB.js} +2 -2
  176. package/dist/{chunk-AV5ZEH4M.js → chunk-KVJRXN2E.js} +2 -2
  177. package/dist/{chunk-WFTIGIIS.js → chunk-L6CQ7WIW.js} +5 -5
  178. package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
  179. package/dist/{chunk-EJUEXZHX.js → chunk-LLJMAULE.js} +2 -2
  180. package/dist/{chunk-N5Z4EVOR.js → chunk-LNEWDF2A.js} +36 -11
  181. package/dist/chunk-LNEWDF2A.js.map +1 -0
  182. package/dist/{chunk-QN25OCUF.js → chunk-LPYDOLSM.js} +5 -5
  183. package/dist/{chunk-AS7YMSL6.js → chunk-M23RF3LJ.js} +4 -4
  184. package/dist/{chunk-OAEQLRCY.js → chunk-MO4HSXHZ.js} +5 -5
  185. package/dist/{chunk-ECK75GDJ.js → chunk-N3LL5NEU.js} +43 -24
  186. package/dist/chunk-N3LL5NEU.js.map +1 -0
  187. package/dist/chunk-NEF7LR5J.js +29 -0
  188. package/dist/chunk-NEF7LR5J.js.map +1 -0
  189. package/dist/{chunk-3F2LKUMU.js → chunk-NIS256NW.js} +2 -2
  190. package/dist/{chunk-YIAA2X3D.js → chunk-NK5RGJ65.js} +3 -3
  191. package/dist/chunk-NLDVVWCL.js +84 -0
  192. package/dist/chunk-NLDVVWCL.js.map +1 -0
  193. package/dist/{chunk-4J7G5SY4.js → chunk-NZBZ7IS2.js} +72 -24
  194. package/dist/chunk-NZBZ7IS2.js.map +1 -0
  195. package/dist/{chunk-3TBLDMJA.js → chunk-O4KMGRXE.js} +5 -2
  196. package/dist/chunk-O4KMGRXE.js.map +1 -0
  197. package/dist/{chunk-7TWUCYER.js → chunk-PNRA7FAD.js} +7 -7
  198. package/dist/{chunk-5I4M26Q7.js → chunk-QBSFOKY6.js} +4 -4
  199. package/dist/{chunk-E53DSZEN.js → chunk-QR6G5KF4.js} +3 -3
  200. package/dist/{chunk-CJ2ZR7UA.js → chunk-QUENPGWZ.js} +261 -211
  201. package/dist/chunk-QUENPGWZ.js.map +1 -0
  202. package/dist/{chunk-4UH4BTGK.js → chunk-QVJPH7SH.js} +84 -84
  203. package/dist/{chunk-UYLMNVY6.js → chunk-R3KHKU7M.js} +16 -9
  204. package/dist/chunk-R3KHKU7M.js.map +1 -0
  205. package/dist/{chunk-JBPKEARU.js → chunk-RKNJBZ55.js} +4 -4
  206. package/dist/{chunk-WDISJRMG.js → chunk-RMMVQQA6.js} +2 -2
  207. package/dist/{chunk-JVLCVFQ4.js → chunk-RNHVVMFN.js} +3 -3
  208. package/dist/{chunk-QJAQNXWI.js → chunk-RVO6TCTU.js} +81 -84
  209. package/dist/chunk-RVO6TCTU.js.map +1 -0
  210. package/dist/chunk-S2HLHAZ4.js +16 -0
  211. package/dist/chunk-S2HLHAZ4.js.map +1 -0
  212. package/dist/{chunk-KWMXR7XS.js → chunk-S2V7RUCL.js} +8 -1
  213. package/dist/{chunk-KWMXR7XS.js.map → chunk-S2V7RUCL.js.map} +1 -1
  214. package/dist/{chunk-5SM35XZR.js → chunk-S5NZBKKQ.js} +2 -2
  215. package/dist/{chunk-VNA7W7QF.js → chunk-SVH57F5Z.js} +12 -4
  216. package/dist/chunk-SVH57F5Z.js.map +1 -0
  217. package/dist/{chunk-WIPEXG6R.js → chunk-SXIMQLGV.js} +2 -2
  218. package/dist/{chunk-RVLJEII5.js → chunk-SYUBB3WM.js} +256 -187
  219. package/dist/chunk-SYUBB3WM.js.map +1 -0
  220. package/dist/{chunk-VCD4PSK2.js → chunk-TQZ4DVBC.js} +7 -4
  221. package/dist/chunk-TQZ4DVBC.js.map +1 -0
  222. package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
  223. package/dist/{chunk-YV32N67O.js → chunk-URS5GSM7.js} +1 -1
  224. package/dist/chunk-URS5GSM7.js.map +1 -0
  225. package/dist/{chunk-4B77XSG5.js → chunk-UV72DEZD.js} +5 -5
  226. package/dist/{chunk-BJKPPZ6Z.js → chunk-UW66OZTD.js} +2 -2
  227. package/dist/{chunk-XYTOI63Z.js → chunk-V2TNYF6Q.js} +19 -11
  228. package/dist/chunk-V2TNYF6Q.js.map +1 -0
  229. package/dist/{chunk-S2BBISHU.js → chunk-VANZKHTN.js} +3 -3
  230. package/dist/chunk-VHFXP27N.js +250 -0
  231. package/dist/chunk-VHFXP27N.js.map +1 -0
  232. package/dist/chunk-VL35ZFSZ.js +102 -0
  233. package/dist/chunk-VL35ZFSZ.js.map +1 -0
  234. package/dist/{chunk-3Y224NYC.js → chunk-VYISFWVX.js} +2 -2
  235. package/dist/{chunk-JE7EK33X.js → chunk-W2V7UESE.js} +2 -2
  236. package/dist/{chunk-TIHMZFIV.js → chunk-W3IC7QOY.js} +3 -3
  237. package/dist/{chunk-NRV4Y3PM.js → chunk-W4FBGYGK.js} +1 -1
  238. package/dist/{chunk-P2BM76KT.js → chunk-WAS4HV46.js} +174 -43
  239. package/dist/chunk-WAS4HV46.js.map +1 -0
  240. package/dist/{chunk-57QKLRBV.js → chunk-WB7JSQCP.js} +2 -1
  241. package/dist/chunk-WB7JSQCP.js.map +1 -0
  242. package/dist/{chunk-A5OJCXZL.js → chunk-WZ3TOIDW.js} +15 -4
  243. package/dist/chunk-WZ3TOIDW.js.map +1 -0
  244. package/dist/{chunk-MU7ZHSZE.js → chunk-WZFAPHIK.js} +2 -2
  245. package/dist/{chunk-T2TTP3KU.js → chunk-X4IDNPOS.js} +2 -2
  246. package/dist/{chunk-UVIKWC7M.js → chunk-XAGYS7X6.js} +17 -17
  247. package/dist/{chunk-BLAKS3CP.js → chunk-XL3TATMJ.js} +3 -3
  248. package/dist/{chunk-W4XJFLAL.js → chunk-XPRJSHNI.js} +2 -2
  249. package/dist/{chunk-5TFP4CUL.js → chunk-XQ3HXAQH.js} +14 -11
  250. package/dist/chunk-XQ3HXAQH.js.map +1 -0
  251. package/dist/{chunk-E6EE5B67.js → chunk-YK6BDDHP.js} +4 -4
  252. package/dist/{chunk-ES36HTSC.js → chunk-YLHM5BQQ.js} +3 -3
  253. package/dist/{chunk-ULARSG5Z.js → chunk-YN6ASZUG.js} +10 -8
  254. package/dist/{chunk-ULARSG5Z.js.map → chunk-YN6ASZUG.js.map} +1 -1
  255. package/dist/{chunk-VOUOLGIP.js → chunk-YRFAYOFQ.js} +11 -13
  256. package/dist/chunk-YRFAYOFQ.js.map +1 -0
  257. package/dist/{chunk-IKKWIPYN.js → chunk-YYQAKIDJ.js} +37 -1
  258. package/dist/chunk-YYQAKIDJ.js.map +1 -0
  259. package/dist/{chunk-GF22HWS2.js → chunk-Z54EM5YZ.js} +4 -4
  260. package/dist/{chunk-64UDOIMI.js → chunk-ZLQ37WJX.js} +2 -2
  261. package/dist/{cli-BUGN3d6_.d.ts → cli-BHBswmUa.d.ts} +5 -5
  262. package/dist/cli.d.ts +16 -12
  263. package/dist/cli.js +138 -123
  264. package/dist/compounding/engine.d.ts +3 -2
  265. package/dist/compounding/engine.js +25 -23
  266. package/dist/compounding/preference-consolidator.d.ts +2 -1
  267. package/dist/compression-optimizer.d.ts +2 -1
  268. package/dist/config.d.ts +2 -1
  269. package/dist/config.js +10 -8
  270. package/dist/connectors/codex-materialize-runner.d.ts +2 -1
  271. package/dist/connectors/codex-materialize-runner.js +24 -22
  272. package/dist/connectors/codex-materialize.d.ts +2 -1
  273. package/dist/connectors/index.d.ts +2 -1
  274. package/dist/connectors/index.js +27 -25
  275. package/dist/consolidation-provenance-check.d.ts +3 -2
  276. package/dist/consolidation-provenance-check.js +4 -4
  277. package/dist/consolidation-undo.d.ts +3 -2
  278. package/dist/consolidation-undo.js +10 -7
  279. package/dist/consolidation-undo.js.map +1 -1
  280. package/dist/contradiction/index.d.ts +3 -2
  281. package/dist/converge-config.d.ts +2 -1
  282. package/dist/convergence-refresh.d.ts +4 -3
  283. package/dist/convergence-refresh.js +28 -26
  284. package/dist/conversation-index/backend.d.ts +2 -1
  285. package/dist/conversation-index/backend.js +2 -2
  286. package/dist/conversation-index/chunker.d.ts +2 -1
  287. package/dist/conversation-index/faiss-adapter.d.ts +2 -1
  288. package/dist/conversation-index/indexer.d.ts +2 -1
  289. package/dist/conversation-index/search.d.ts +2 -1
  290. package/dist/corpus-watermark.d.ts +2 -1
  291. package/dist/corpus-watermark.js +43 -41
  292. package/dist/day-summary.d.ts +2 -1
  293. package/dist/delinearize.d.ts +2 -1
  294. package/dist/direct-answer-wiring.d.ts +2 -1
  295. package/dist/direct-answer-wiring.js +2 -2
  296. package/dist/direct-answer.d.ts +2 -1
  297. package/dist/embedding-fallback.d.ts +2 -1
  298. package/dist/embedding-fallback.js +2 -2
  299. package/dist/enrichment/index.d.ts +2 -1
  300. package/dist/entity-retrieval-boundaries.js +1 -1
  301. package/dist/entity-retrieval.d.ts +3 -2
  302. package/dist/entity-retrieval.js +25 -23
  303. package/dist/entity-schema.d.ts +2 -1
  304. package/dist/explicit-capture.d.ts +9 -8
  305. package/dist/explicit-capture.js +11 -9
  306. package/dist/external-wiki-access.d.ts +127 -0
  307. package/dist/external-wiki-access.js +187 -0
  308. package/dist/external-wiki-access.js.map +1 -0
  309. package/dist/external-wiki-cli.d.ts +13 -0
  310. package/dist/external-wiki-cli.js +10 -0
  311. package/dist/external-wiki-cli.js.map +1 -0
  312. package/dist/external-wiki-collection-registration.d.ts +39 -0
  313. package/dist/external-wiki-collection-registration.js +79 -0
  314. package/dist/external-wiki-collection-registration.js.map +1 -0
  315. package/dist/external-wiki-collection.d.ts +50 -0
  316. package/dist/external-wiki-collection.js +387 -0
  317. package/dist/external-wiki-collection.js.map +1 -0
  318. package/dist/external-wiki-config.d.ts +13 -0
  319. package/dist/external-wiki-config.js +13 -0
  320. package/dist/external-wiki-config.js.map +1 -0
  321. package/dist/external-wiki-guard.d.ts +11 -0
  322. package/dist/external-wiki-guard.js +18 -0
  323. package/dist/external-wiki-guard.js.map +1 -0
  324. package/dist/external-wiki-mcp-tools.d.ts +123 -0
  325. package/dist/external-wiki-mcp-tools.js +8 -0
  326. package/dist/external-wiki-mcp-tools.js.map +1 -0
  327. package/dist/external-wiki-search.d.ts +42 -0
  328. package/dist/external-wiki-search.js +11 -0
  329. package/dist/external-wiki-search.js.map +1 -0
  330. package/dist/external-wiki.d.ts +39 -0
  331. package/dist/external-wiki.js +14 -0
  332. package/dist/external-wiki.js.map +1 -0
  333. package/dist/extraction-error-classification.d.ts +2 -1
  334. package/dist/extraction-faithfulness.d.ts +2 -1
  335. package/dist/extraction-judge-telemetry.d.ts +2 -1
  336. package/dist/extraction-judge-training.d.ts +2 -1
  337. package/dist/extraction-judge.d.ts +2 -1
  338. package/dist/extraction-liveness.d.ts +2 -1
  339. package/dist/extraction-source-grounding-helpers.d.ts +5 -3
  340. package/dist/extraction-source-grounding-helpers.js +1 -1
  341. package/dist/extraction-source-grounding-rules.d.ts +2 -1
  342. package/dist/extraction-source-grounding-rules.js +2 -2
  343. package/dist/extraction-source-grounding.d.ts +2 -1
  344. package/dist/extraction-source-grounding.js +5 -5
  345. package/dist/extraction.d.ts +2 -1
  346. package/dist/extraction.js +46 -43
  347. package/dist/fallback-llm.d.ts +2 -1
  348. package/dist/{first-start-migration-F2QJD66E.js → first-start-migration-ZSHEFEI3.js} +10 -12
  349. package/dist/{first-start-migration-F2QJD66E.js.map → first-start-migration-ZSHEFEI3.js.map} +1 -1
  350. package/dist/graph-dashboard-diff.d.ts +2 -1
  351. package/dist/graph-dashboard-key.d.ts +2 -1
  352. package/dist/graph-dashboard-parser.d.ts +2 -1
  353. package/dist/graph-edge-reinforcement.d.ts +2 -1
  354. package/dist/graph-snapshot.d.ts +2 -1
  355. package/dist/graph.d.ts +2 -1
  356. package/dist/harmonic-retrieval.js +2 -2
  357. package/dist/importance.d.ts +2 -1
  358. package/dist/importers/index.d.ts +2 -1
  359. package/dist/in-flight-reads.d.ts +2 -1
  360. package/dist/index.d.ts +443 -430
  361. package/dist/index.js +304 -269
  362. package/dist/intent.d.ts +2 -1
  363. package/dist/lcm/engine.d.ts +2 -1
  364. package/dist/lcm/engine.js +2 -2
  365. package/dist/lcm/index.d.ts +2 -1
  366. package/dist/lcm/index.js +7 -7
  367. package/dist/lcm/tools.d.ts +2 -1
  368. package/dist/lifecycle.d.ts +2 -1
  369. package/dist/live-connectors-runner.d.ts +2 -1
  370. package/dist/local-llm.d.ts +2 -1
  371. package/dist/local-llm.js +2 -2
  372. package/dist/local-model-endpoint.d.ts +2 -1
  373. package/dist/maintenance/memory-governance.d.ts +2 -1
  374. package/dist/maintenance/memory-governance.js +25 -23
  375. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
  376. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +25 -23
  377. package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
  378. package/dist/maintenance/rebuild-memory-projection.js +27 -25
  379. package/dist/{maintenance-LbuS2rUA.d.ts → maintenance-CoRikzIt.d.ts} +3 -3
  380. package/dist/mcp-memory-inspector-app.d.ts +14 -10
  381. package/dist/mcp-read-only-tools.js +1 -1
  382. package/dist/memory-action-policy.d.ts +2 -1
  383. package/dist/memory-cache.d.ts +2 -1
  384. package/dist/memory-lifecycle-ledger-utils.d.ts +2 -1
  385. package/dist/memory-projection-store.d.ts +2 -1
  386. package/dist/memory-provenance.d.ts +2 -1
  387. package/dist/memory-snapshot.d.ts +10 -0
  388. package/dist/memory-snapshot.js +8 -0
  389. package/dist/memory-snapshot.js.map +1 -0
  390. package/dist/memory-worth-outcomes.d.ts +3 -2
  391. package/dist/models-json.d.ts +2 -1
  392. package/dist/namespaces/migrate.d.ts +4 -3
  393. package/dist/namespaces/migrate.js +41 -39
  394. package/dist/namespaces/principal.d.ts +2 -1
  395. package/dist/namespaces/search.d.ts +2 -1
  396. package/dist/namespaces/search.js +18 -18
  397. package/dist/namespaces/storage.d.ts +4 -3
  398. package/dist/namespaces/storage.js +24 -22
  399. package/dist/native-knowledge.d.ts +2 -1
  400. package/dist/offline-sync-impression-drain.d.ts +2 -1
  401. package/dist/offline-sync-impression-drain.js +11 -9
  402. package/dist/offline-sync.d.ts +29 -3
  403. package/dist/offline-sync.js +6 -2
  404. package/dist/operator-doctor-corpus.d.ts +2 -1
  405. package/dist/operator-doctor-corpus.js +46 -44
  406. package/dist/operator-doctor-replica.d.ts +2 -1
  407. package/dist/operator-doctor-replica.js +3 -3
  408. package/dist/operator-toolkit.d.ts +4 -3
  409. package/dist/operator-toolkit.js +60 -55
  410. package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
  411. package/dist/orchestration/maintenance.d.ts +5 -4
  412. package/dist/orchestration/maintenance.js +37 -33
  413. package/dist/{orchestrator-rHiWt32X.d.ts → orchestrator-BJeq7Pw1.d.ts} +14 -7
  414. package/dist/orchestrator.d.ts +9 -8
  415. package/dist/orchestrator.js +200 -186
  416. package/dist/page-versioning.js +3 -3
  417. package/dist/patterns-cli.d.ts +2 -1
  418. package/dist/{pipeline-W_97O8BV.d.ts → pipeline-CNjY4wk3.d.ts} +1 -1
  419. package/dist/policy-runtime.d.ts +2 -1
  420. package/dist/policy-runtime.js +1 -1
  421. package/dist/proactive-contention.d.ts +2 -1
  422. package/dist/provenance.d.ts +2 -1
  423. package/dist/provenance.js +2 -2
  424. package/dist/{qmd-LWtMofAf.d.ts → qmd-C0UDZidt.d.ts} +9 -7
  425. package/dist/qmd-preflight.d.ts +5 -4
  426. package/dist/qmd-preflight.js +2 -2
  427. package/dist/qmd-recall-cache.d.ts +2 -1
  428. package/dist/qmd.d.ts +4 -3
  429. package/dist/qmd.js +8 -8
  430. package/dist/recall-concurrency-config.d.ts +2 -1
  431. package/dist/recall-disclosure-escalation.d.ts +2 -1
  432. package/dist/recall-explain-renderer.d.ts +2 -1
  433. package/dist/recall-explain-renderer.js +3 -3
  434. package/dist/recall-memory-map.d.ts +2 -1
  435. package/dist/recall-planner-llm.d.ts +2 -1
  436. package/dist/recall-state.d.ts +2 -1
  437. package/dist/recall-tag-filter.d.ts +2 -1
  438. package/dist/recall-timings.d.ts +2 -1
  439. package/dist/recall-xray-cli.d.ts +2 -1
  440. package/dist/recall-xray-cli.js +4 -4
  441. package/dist/recall-xray-renderer.d.ts +2 -1
  442. package/dist/recall-xray-renderer.js +3 -3
  443. package/dist/recall-xray.d.ts +8 -1
  444. package/dist/recall-xray.js +2 -2
  445. package/dist/reconcile/cursor.d.ts +12 -2
  446. package/dist/reconcile/cursor.js +46 -7
  447. package/dist/reconcile/cursor.js.map +1 -1
  448. package/dist/reconcile/manifest.d.ts +9 -2
  449. package/dist/reconcile/manifest.js +15 -268
  450. package/dist/reconcile/manifest.js.map +1 -1
  451. package/dist/reconcile/plan.d.ts +4 -1
  452. package/dist/reconcile/plan.js +4 -4
  453. package/dist/replay/normalizers/chatgpt.d.ts +2 -1
  454. package/dist/replay/normalizers/claude.d.ts +2 -1
  455. package/dist/replay/normalizers/openclaw.d.ts +2 -1
  456. package/dist/replay/normalizers/shared.d.ts +2 -1
  457. package/dist/replay/runner.d.ts +2 -1
  458. package/dist/replay/types.d.ts +2 -1
  459. package/dist/replica-divergence.d.ts +2 -1
  460. package/dist/replica-divergence.js +2 -2
  461. package/dist/replica-peers-config.d.ts +2 -1
  462. package/dist/resolve-auth-token.d.ts +2 -1
  463. package/dist/resume-bundles.js +12 -10
  464. package/dist/retrieval-agents.d.ts +4 -3
  465. package/dist/retrieval-agents.js +2 -2
  466. package/dist/retrieval-tiers.d.ts +2 -1
  467. package/dist/routing/engine.d.ts +2 -1
  468. package/dist/routing/store.d.ts +2 -1
  469. package/dist/salvage-envelope.d.ts +2 -1
  470. package/dist/schemas.d.ts +54 -54
  471. package/dist/{scope-profiles-BiQKOE-p.d.ts → scope-profiles-BJzp2F5A.d.ts} +1 -1
  472. package/dist/search/embed-helper.d.ts +2 -1
  473. package/dist/search/embed-helper.js +3 -3
  474. package/dist/search/factory.d.ts +4 -2
  475. package/dist/search/factory.js +20 -18
  476. package/dist/search/index.d.ts +2 -1
  477. package/dist/search/index.js +20 -20
  478. package/dist/search/lancedb-backend.d.ts +2 -1
  479. package/dist/search/lancedb-backend.js +4 -4
  480. package/dist/search/meilisearch-backend.d.ts +2 -1
  481. package/dist/search/meilisearch-backend.js +4 -4
  482. package/dist/search/noop-backend.d.ts +2 -1
  483. package/dist/search/orama-backend.d.ts +2 -1
  484. package/dist/search/orama-backend.js +4 -4
  485. package/dist/search/port.d.ts +18 -1
  486. package/dist/search/port.js +1 -1
  487. package/dist/search/remote-backend.d.ts +2 -1
  488. package/dist/search/remote-backend.js +2 -2
  489. package/dist/secure-store/index.js +2 -2
  490. package/dist/{semantic-consolidation-dHYCyqgh.d.ts → semantic-consolidation-D4KAZO2G.d.ts} +1 -1
  491. package/dist/semantic-consolidation.d.ts +3 -2
  492. package/dist/semantic-consolidation.js +26 -24
  493. package/dist/semantic-rule-promotion.js +24 -22
  494. package/dist/semantic-rule-verifier.d.ts +2 -1
  495. package/dist/semantic-rule-verifier.js +25 -23
  496. package/dist/{service-DJG3KCQ4.d.ts → service-DWC4tq7p.d.ts} +2 -2
  497. package/dist/session-observer-bands.d.ts +2 -1
  498. package/dist/session-observer-state.d.ts +2 -1
  499. package/dist/shared-context/manager.d.ts +10 -9
  500. package/dist/shared-context/manager.js +2 -2
  501. package/dist/signal.d.ts +2 -1
  502. package/dist/source-agent-qualifier.d.ts +2 -1
  503. package/dist/source-agent-qualifier.js +43 -40
  504. package/dist/{storage-F9FVh-w9.d.ts → storage-DPGjB-8e.d.ts} +28 -13
  505. package/dist/storage.d.ts +3 -2
  506. package/dist/storage.js +26 -24
  507. package/dist/summarizer.d.ts +2 -1
  508. package/dist/summarizer.js +5 -5
  509. package/dist/summary-snapshot.d.ts +2 -1
  510. package/dist/temporal-supersession.d.ts +3 -2
  511. package/dist/temporal-timeline-recall.d.ts +2 -1
  512. package/dist/temporal-validity.d.ts +2 -1
  513. package/dist/threading.d.ts +2 -1
  514. package/dist/tier-migration.d.ts +3 -2
  515. package/dist/tier-migration.js +1 -1
  516. package/dist/tier-routing.d.ts +2 -1
  517. package/dist/tool-scoped-memory.d.ts +5 -1
  518. package/dist/tool-scoped-memory.js +3 -1
  519. package/dist/topics.d.ts +2 -1
  520. package/dist/transcript.d.ts +2 -1
  521. package/dist/transfer/capsule-import.js +4 -4
  522. package/dist/transfer/types.d.ts +66 -66
  523. package/dist/trust-score-stage.d.ts +2 -1
  524. package/dist/trust-score.d.ts +2 -1
  525. package/dist/{types-rEwubvim.d.ts → types-yX_FwERf.d.ts} +8 -1
  526. package/dist/types.d.ts +2 -1
  527. package/dist/types.js +1 -1
  528. package/dist/utility-runtime.d.ts +2 -1
  529. package/dist/verified-recall.js +25 -23
  530. package/dist/write-envelope.d.ts +2 -1
  531. package/package.json +2 -2
  532. package/src/abort-error.ts +17 -0
  533. package/src/access-admin-ops-surface.ts +1 -0
  534. package/src/access-boundary.ts +1 -0
  535. package/src/access-coding-context-resolution.ts +42 -0
  536. package/src/access-extraction-force-flush.ts +38 -2
  537. package/src/access-http-lcm-compaction.ts +5 -2
  538. package/src/access-http-offline-stream.ts +80 -0
  539. package/src/access-http.test.ts +310 -3
  540. package/src/access-http.ts +84 -77
  541. package/src/access-mcp-output-schemas.ts +36 -0
  542. package/src/access-mcp.test.ts +95 -1
  543. package/src/access-mcp.ts +7 -9
  544. package/src/access-observe-helpers.ts +64 -22
  545. package/src/access-observe-write-surface.ts +8 -0
  546. package/src/access-offline-manifest.ts +54 -0
  547. package/src/access-operations-batch.ts +3 -3
  548. package/src/access-operations.ts +13 -7
  549. package/src/access-recall-concurrency.ts +3 -27
  550. package/src/access-recall-surface.ts +3 -0
  551. package/src/access-service-health.test.ts +32 -7
  552. package/src/access-service-namespace.test.ts +55 -0
  553. package/src/access-service-observe-idempotency.test.ts +34 -2
  554. package/src/access-service-observe-lcm-parity.test.ts +183 -23
  555. package/src/access-service-observe-scope.test.ts +160 -1
  556. package/src/access-service-offline-file-content.test.ts +345 -1
  557. package/src/access-service.ts +88 -62
  558. package/src/access-surface-catalog.ts +4 -0
  559. package/src/admin/admin-surfaces.ts +2 -0
  560. package/src/binary-lifecycle/pipeline.test.ts +106 -1
  561. package/src/binary-lifecycle/pipeline.ts +3 -0
  562. package/src/coding/git-context.test.ts +47 -0
  563. package/src/coding/git-context.ts +129 -27
  564. package/src/config.test.ts +24 -0
  565. package/src/config.ts +9 -12
  566. package/src/connector-provenance.test.ts +101 -0
  567. package/src/consolidation-undo.ts +3 -0
  568. package/src/convergence-refresh.ts +14 -2
  569. package/src/correction/correction-access-wiring.ts +9 -7
  570. package/src/correction/correction-executor.test.ts +206 -2
  571. package/src/correction/correction-executor.ts +29 -20
  572. package/src/correction/correction-planner.test.ts +36 -0
  573. package/src/correction/correction-planner.ts +9 -15
  574. package/src/correction/correction-service.ts +3 -1
  575. package/src/correction/correction-storage-integration.test.ts +77 -0
  576. package/src/correction/correction-surfaces.test.ts +41 -28
  577. package/src/correction/passive-capture.test.ts +59 -0
  578. package/src/correction/passive-capture.ts +4 -1
  579. package/src/entity-retrieval-boundaries.ts +17 -4
  580. package/src/entity-retrieval.ts +27 -6
  581. package/src/external-wiki-access.test.ts +65 -0
  582. package/src/external-wiki-access.ts +31 -0
  583. package/src/external-wiki-cli.ts +100 -0
  584. package/src/external-wiki-collection-registration.test.ts +163 -0
  585. package/src/external-wiki-collection-registration.ts +101 -0
  586. package/src/external-wiki-collection.test.ts +502 -0
  587. package/src/external-wiki-collection.ts +503 -0
  588. package/src/external-wiki-config.test.ts +135 -0
  589. package/src/external-wiki-config.ts +100 -0
  590. package/src/external-wiki-guard.ts +83 -0
  591. package/src/external-wiki-mcp-tools.ts +23 -0
  592. package/src/external-wiki-search.test.ts +367 -0
  593. package/src/external-wiki-search.ts +362 -0
  594. package/src/external-wiki.test.ts +240 -0
  595. package/src/external-wiki.ts +427 -0
  596. package/src/extraction-scope-source-agent.test.ts +21 -0
  597. package/src/extraction-source-grounding-helpers.ts +243 -53
  598. package/src/extraction-source-grounding-rules.ts +133 -39
  599. package/src/extraction-source-grounding.test.ts +363 -33
  600. package/src/extraction-timeout.test.ts +1 -0
  601. package/src/extraction-watermark.test.ts +150 -7
  602. package/src/extraction.ts +8 -1
  603. package/src/index.ts +9 -5
  604. package/src/maintenance/first-start-migration.ts +11 -11
  605. package/src/mcp-read-only-tools.ts +1 -0
  606. package/src/memory-snapshot.ts +15 -0
  607. package/src/offline-sync.test.ts +194 -0
  608. package/src/offline-sync.ts +217 -13
  609. package/src/orchestration/external-wiki-recall-guard.test.ts +94 -0
  610. package/src/orchestration/extraction-persist.ts +19 -2
  611. package/src/orchestration/extraction-run-helpers.ts +37 -19
  612. package/src/orchestration/extraction-run.test.ts +171 -2
  613. package/src/orchestration/extraction-run.ts +11 -13
  614. package/src/orchestration/extraction-watermark.ts +106 -17
  615. package/src/orchestration/generic-recall-paths.ts +14 -0
  616. package/src/orchestration/orchestrator-helpers.ts +2 -0
  617. package/src/orchestration/orchestrator-init.ts +9 -0
  618. package/src/orchestration/recall-internal-deps.ts +6 -0
  619. package/src/orchestration/recall-internal.ts +154 -33
  620. package/src/orchestration/recall-rerank-coordinator.ts +60 -25
  621. package/src/orchestration/recall-search-pipeline.test.ts +75 -1
  622. package/src/orchestration/recall-search-pipeline.ts +50 -10
  623. package/src/orchestrator-convergence-refresh.test.ts +36 -2
  624. package/src/orchestrator.ts +13 -3
  625. package/src/page-versioning.ts +5 -19
  626. package/src/procedural/procedure-recall.ts +5 -1
  627. package/src/provenance-surfaces.test.ts +3 -0
  628. package/src/qmd-client.test.ts +78 -17
  629. package/src/qmd.test.ts +24 -0
  630. package/src/qmd.ts +224 -315
  631. package/src/recall-explain-renderer.ts +3 -0
  632. package/src/recall-rerank-coordinator.test.ts +61 -0
  633. package/src/recall-xray-renderer.test.ts +6 -0
  634. package/src/recall-xray.test.ts +88 -1
  635. package/src/recall-xray.ts +15 -0
  636. package/src/reconcile/cursor.test.ts +48 -0
  637. package/src/reconcile/cursor.ts +58 -11
  638. package/src/reconcile/manifest.test.ts +4 -0
  639. package/src/reconcile/manifest.ts +41 -51
  640. package/src/reconcile/plan.test.ts +4 -0
  641. package/src/reconcile/plan.ts +28 -16
  642. package/src/search/factory.ts +6 -6
  643. package/src/search/port.ts +25 -9
  644. package/src/secure-store/secure-fs.ts +20 -12
  645. package/src/secure-store/secure-store.test.ts +41 -2
  646. package/src/spaces/index.test.ts +61 -2
  647. package/src/spaces/index.ts +44 -18
  648. package/src/storage/entity-alias-config.ts +97 -0
  649. package/src/storage/entity-canonical-id-lock.ts +53 -23
  650. package/src/storage/entity-canonical-id-migration.ts +53 -22
  651. package/src/storage/entity-canonical-id-references.ts +3 -0
  652. package/src/storage/entity-id-safety.ts +7 -0
  653. package/src/storage/entity-store.ts +6 -2
  654. package/src/storage/memory-frontmatter-metadata.ts +4 -9
  655. package/src/storage/memory-migration-serialization.ts +10 -15
  656. package/src/storage/tombstone-blocked-capture-mutation.ts +52 -64
  657. package/src/storage/tombstone-blocked-capture-sync.ts +244 -199
  658. package/src/storage-contract/cache-coherence.test.ts +99 -0
  659. package/src/storage-deletion-revisions.test.ts +91 -0
  660. package/src/storage-fact-hash-index-defer.test.ts +460 -170
  661. package/src/storage.ts +572 -284
  662. package/src/testing/subjects/first-start-tier-migration.test.ts +75 -0
  663. package/src/tier-migration.ts +10 -12
  664. package/src/tool-scoped-memory.ts +10 -0
  665. package/src/transfer/capsule-import.ts +13 -0
  666. package/src/transfer/capsule-merge.ts +13 -0
  667. package/src/trust-score-recall-paths.test.ts +75 -1
  668. package/src/types.ts +7 -3
  669. package/dist/capsule-merge-IDWJPCWK.js.map +0 -1
  670. package/dist/chunk-3CE77VAP.js.map +0 -1
  671. package/dist/chunk-3TBLDMJA.js.map +0 -1
  672. package/dist/chunk-4J7G5SY4.js.map +0 -1
  673. package/dist/chunk-57QKLRBV.js.map +0 -1
  674. package/dist/chunk-5TFP4CUL.js.map +0 -1
  675. package/dist/chunk-7XC2HX75.js.map +0 -1
  676. package/dist/chunk-A5OJCXZL.js.map +0 -1
  677. package/dist/chunk-BUE5E2HL.js.map +0 -1
  678. package/dist/chunk-CJ2ZR7UA.js.map +0 -1
  679. package/dist/chunk-CUM2BBPN.js.map +0 -1
  680. package/dist/chunk-D3J5SLQK.js.map +0 -1
  681. package/dist/chunk-DL7ZD3JH.js.map +0 -1
  682. package/dist/chunk-DLVPUX7U.js.map +0 -1
  683. package/dist/chunk-E6PNLPGJ.js.map +0 -1
  684. package/dist/chunk-ECK75GDJ.js.map +0 -1
  685. package/dist/chunk-HREE4JHI.js.map +0 -1
  686. package/dist/chunk-HZFHQ4AQ.js.map +0 -1
  687. package/dist/chunk-IKKWIPYN.js.map +0 -1
  688. package/dist/chunk-J7VGGECD.js.map +0 -1
  689. package/dist/chunk-N5Z4EVOR.js.map +0 -1
  690. package/dist/chunk-NVRYW264.js.map +0 -1
  691. package/dist/chunk-P2BM76KT.js.map +0 -1
  692. package/dist/chunk-PVGDJXVK.js +0 -21
  693. package/dist/chunk-QJAQNXWI.js.map +0 -1
  694. package/dist/chunk-RN7DY3FC.js.map +0 -1
  695. package/dist/chunk-RVLJEII5.js.map +0 -1
  696. package/dist/chunk-S2NCTZGJ.js.map +0 -1
  697. package/dist/chunk-TDHTVMPG.js.map +0 -1
  698. package/dist/chunk-UYLMNVY6.js.map +0 -1
  699. package/dist/chunk-VCD4PSK2.js.map +0 -1
  700. package/dist/chunk-VNA7W7QF.js.map +0 -1
  701. package/dist/chunk-VOUOLGIP.js.map +0 -1
  702. package/dist/chunk-VWAXN2BN.js.map +0 -1
  703. package/dist/chunk-WOCNN776.js.map +0 -1
  704. package/dist/chunk-XYTOI63Z.js.map +0 -1
  705. package/dist/chunk-YV32N67O.js.map +0 -1
  706. /package/dist/{auto-sync-5OE5QOZB.js.map → auto-sync-UPTUVE4X.js.map} +0 -0
  707. /package/dist/{chunk-E5UK4VPE.js.map → chunk-2FSTB6BJ.js.map} +0 -0
  708. /package/dist/{chunk-5ZE7QHTK.js.map → chunk-2X2T2UVE.js.map} +0 -0
  709. /package/dist/{chunk-P4DRWEYC.js.map → chunk-3COYXTGM.js.map} +0 -0
  710. /package/dist/{chunk-5IVLTFOV.js.map → chunk-44N6ESJ4.js.map} +0 -0
  711. /package/dist/{chunk-HO3QBJEY.js.map → chunk-5546W5SI.js.map} +0 -0
  712. /package/dist/{chunk-AAIUERNB.js.map → chunk-5QJQHBLE.js.map} +0 -0
  713. /package/dist/{chunk-6CZPDBJS.js.map → chunk-5U7ID3EZ.js.map} +0 -0
  714. /package/dist/{chunk-DNWXFTLD.js.map → chunk-A4IJCD2Z.js.map} +0 -0
  715. /package/dist/{chunk-PKNLM44P.js.map → chunk-AC5OWJLV.js.map} +0 -0
  716. /package/dist/{chunk-LZ4LDKHZ.js.map → chunk-AMAUBUKY.js.map} +0 -0
  717. /package/dist/{chunk-S5SLVSVY.js.map → chunk-BQIFZ2MP.js.map} +0 -0
  718. /package/dist/{chunk-Q6IP2ARR.js.map → chunk-CSOYVTRX.js.map} +0 -0
  719. /package/dist/{chunk-XOQSEF7X.js.map → chunk-CVILPI77.js.map} +0 -0
  720. /package/dist/{chunk-4LMA77JH.js.map → chunk-E5XQIWAL.js.map} +0 -0
  721. /package/dist/{chunk-WUNIWKY4.js.map → chunk-ELIL2A37.js.map} +0 -0
  722. /package/dist/{chunk-OQ5PRDDS.js.map → chunk-ERZ2R42X.js.map} +0 -0
  723. /package/dist/{chunk-U7GW7NE7.js.map → chunk-FIK3CQNA.js.map} +0 -0
  724. /package/dist/{chunk-33PLLLL7.js.map → chunk-GFCVUY6G.js.map} +0 -0
  725. /package/dist/{chunk-VUPTKTDV.js.map → chunk-GUAL4PQH.js.map} +0 -0
  726. /package/dist/{chunk-CINZGPSJ.js.map → chunk-GUMZC2BO.js.map} +0 -0
  727. /package/dist/{chunk-H24WNPA2.js.map → chunk-GWFSVJ4P.js.map} +0 -0
  728. /package/dist/{chunk-TSH56VPU.js.map → chunk-HAYSYUAB.js.map} +0 -0
  729. /package/dist/{chunk-PDLBLTOK.js.map → chunk-HC3PBX23.js.map} +0 -0
  730. /package/dist/{chunk-KXB4VXHY.js.map → chunk-JIYDRBVZ.js.map} +0 -0
  731. /package/dist/{chunk-HLPD7B7P.js.map → chunk-JZH4LWHB.js.map} +0 -0
  732. /package/dist/{chunk-AV5ZEH4M.js.map → chunk-KVJRXN2E.js.map} +0 -0
  733. /package/dist/{chunk-WFTIGIIS.js.map → chunk-L6CQ7WIW.js.map} +0 -0
  734. /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
  735. /package/dist/{chunk-EJUEXZHX.js.map → chunk-LLJMAULE.js.map} +0 -0
  736. /package/dist/{chunk-QN25OCUF.js.map → chunk-LPYDOLSM.js.map} +0 -0
  737. /package/dist/{chunk-AS7YMSL6.js.map → chunk-M23RF3LJ.js.map} +0 -0
  738. /package/dist/{chunk-OAEQLRCY.js.map → chunk-MO4HSXHZ.js.map} +0 -0
  739. /package/dist/{chunk-3F2LKUMU.js.map → chunk-NIS256NW.js.map} +0 -0
  740. /package/dist/{chunk-YIAA2X3D.js.map → chunk-NK5RGJ65.js.map} +0 -0
  741. /package/dist/{chunk-7TWUCYER.js.map → chunk-PNRA7FAD.js.map} +0 -0
  742. /package/dist/{chunk-5I4M26Q7.js.map → chunk-QBSFOKY6.js.map} +0 -0
  743. /package/dist/{chunk-E53DSZEN.js.map → chunk-QR6G5KF4.js.map} +0 -0
  744. /package/dist/{chunk-4UH4BTGK.js.map → chunk-QVJPH7SH.js.map} +0 -0
  745. /package/dist/{chunk-JBPKEARU.js.map → chunk-RKNJBZ55.js.map} +0 -0
  746. /package/dist/{chunk-WDISJRMG.js.map → chunk-RMMVQQA6.js.map} +0 -0
  747. /package/dist/{chunk-JVLCVFQ4.js.map → chunk-RNHVVMFN.js.map} +0 -0
  748. /package/dist/{chunk-5SM35XZR.js.map → chunk-S5NZBKKQ.js.map} +0 -0
  749. /package/dist/{chunk-WIPEXG6R.js.map → chunk-SXIMQLGV.js.map} +0 -0
  750. /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
  751. /package/dist/{chunk-4B77XSG5.js.map → chunk-UV72DEZD.js.map} +0 -0
  752. /package/dist/{chunk-BJKPPZ6Z.js.map → chunk-UW66OZTD.js.map} +0 -0
  753. /package/dist/{chunk-S2BBISHU.js.map → chunk-VANZKHTN.js.map} +0 -0
  754. /package/dist/{chunk-3Y224NYC.js.map → chunk-VYISFWVX.js.map} +0 -0
  755. /package/dist/{chunk-JE7EK33X.js.map → chunk-W2V7UESE.js.map} +0 -0
  756. /package/dist/{chunk-TIHMZFIV.js.map → chunk-W3IC7QOY.js.map} +0 -0
  757. /package/dist/{chunk-NRV4Y3PM.js.map → chunk-W4FBGYGK.js.map} +0 -0
  758. /package/dist/{chunk-MU7ZHSZE.js.map → chunk-WZFAPHIK.js.map} +0 -0
  759. /package/dist/{chunk-T2TTP3KU.js.map → chunk-X4IDNPOS.js.map} +0 -0
  760. /package/dist/{chunk-UVIKWC7M.js.map → chunk-XAGYS7X6.js.map} +0 -0
  761. /package/dist/{chunk-BLAKS3CP.js.map → chunk-XL3TATMJ.js.map} +0 -0
  762. /package/dist/{chunk-W4XJFLAL.js.map → chunk-XPRJSHNI.js.map} +0 -0
  763. /package/dist/{chunk-E6EE5B67.js.map → chunk-YK6BDDHP.js.map} +0 -0
  764. /package/dist/{chunk-ES36HTSC.js.map → chunk-YLHM5BQQ.js.map} +0 -0
  765. /package/dist/{chunk-GF22HWS2.js.map → chunk-Z54EM5YZ.js.map} +0 -0
  766. /package/dist/{chunk-64UDOIMI.js.map → chunk-ZLQ37WJX.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { createHash, randomUUID } from "node:crypto";
1
+ import { createHash, randomUUID, type Hash } from "node:crypto";
2
2
  import { unlink } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { isDeepStrictEqual } from "node:util";
@@ -7,21 +7,15 @@ import type { MemoryFile, MemoryFrontmatter } from "../types.js";
7
7
  import { markProjectedMemoryPathInvalid } from "../memory-projection-store.js";
8
8
  import { RECALL_FALLBACK_DIRS } from "../utils/category-dir.js";
9
9
  import { isErrnoCode } from "../utils/errno.js";
10
- import {
11
- pathMayCarryEntityRefs,
12
- requestEntityCanonicalIdReconcile,
13
- } from "./entity-canonical-id-references.js";
14
- import {
15
- readMaybeEncryptedFileFromChunks,
16
- writeMaybeEncryptedFileFromChunks,
17
- } from "../secure-store/secure-fs.js";
10
+ import { pathMayCarryEntityRefs, requestEntityCanonicalIdReconcile } from "./entity-canonical-id-references.js";
11
+ import { withRawEntityPageMutation } from "./entity-canonical-id-lock.js";
12
+ import { readMaybeEncryptedFileFromChunks, writeMaybeEncryptedFileFromChunks } from "../secure-store/secure-fs.js";
18
13
  import {
19
14
  buildExplicitCaptureDedupKey,
15
+ buildCapturePathLockIdentity,
20
16
  captureIdentityHash,
21
17
  tombstoneBlocked,
22
- isQueuedReviewFrontmatter,
23
18
  isQueuedReviewMemory,
24
- runTombstoneBlockedChunkMutation,
25
19
  runTombstoneBlockedMutation,
26
20
  type TombstoneBlockedMutationHost,
27
21
  } from "./tombstone-blocked-capture-mutation.js";
@@ -32,6 +26,9 @@ const OFFLINE_SYNC_BUFFER_LIMIT_BYTES = 1_048_576;
32
26
  const OFFLINE_SYNC_STAGE_READ_BYTES = 64 * 1024;
33
27
  const OFFLINE_SYNC_FRONTMATTER_DELIMITER = Buffer.from("\n---\n", "utf8");
34
28
 
29
+ const CASED_CHARACTER = /\p{Cased}/u;
30
+ const CASE_IGNORABLE_CHARACTER = /\p{Case_Ignorable}/u;
31
+
35
32
  type StreamedOfflineSyncIdentity = {
36
33
  identityHash: string;
37
34
  };
@@ -43,36 +40,75 @@ type PreparedOfflineSyncChunks = {
43
40
  streamedIdentity?: StreamedOfflineSyncIdentity;
44
41
  };
45
42
 
46
- function createExplicitContentNormalizer(onChunk: (chunk: string) => void): {
43
+ type ExplicitContentNormalizerSink = {
44
+ write: (chunk: string) => void;
45
+ beginConditionalSigma: () => void;
46
+ resolveConditionalSigma: (useFinalSigma: boolean) => void;
47
+ };
48
+
49
+ function createExplicitContentNormalizer(sink: ExplicitContentNormalizerSink): {
47
50
  push: (text: string) => void;
48
51
  finish: () => void;
49
52
  } {
50
53
  let started = false;
51
54
  let pendingSpace = false;
52
55
  let output = "";
56
+ let precededByCased = false;
57
+ let pendingSigma = false;
53
58
  const flush = () => {
54
59
  if (output.length > 0) {
55
- onChunk(output);
60
+ sink.write(output);
56
61
  output = "";
57
62
  }
58
63
  };
59
- return {
60
- push(text) {
61
- for (const character of text.toLowerCase()) {
62
- if (/\s/u.test(character)) {
63
- if (started) pendingSpace = true;
64
+ const emit = (text: string) => {
65
+ for (const character of text) {
66
+ if (/\s/u.test(character)) {
67
+ if (started) pendingSpace = true;
68
+ continue;
69
+ }
70
+ if (pendingSpace) {
71
+ output += " ";
72
+ pendingSpace = false;
73
+ }
74
+ output += character;
75
+ started = true;
76
+ if (output.length >= OFFLINE_SYNC_STAGE_READ_BYTES) flush();
77
+ }
78
+ };
79
+ const resolveSigma = (followedByCased: boolean) => {
80
+ flush();
81
+ sink.resolveConditionalSigma(!followedByCased);
82
+ pendingSigma = false;
83
+ };
84
+ const push = (text: string) => {
85
+ for (const character of text) {
86
+ const caseIgnorable = CASE_IGNORABLE_CHARACTER.test(character);
87
+ const cased = CASED_CHARACTER.test(character);
88
+ if (pendingSigma) {
89
+ if (caseIgnorable) {
90
+ emit(character.toLowerCase());
64
91
  continue;
65
92
  }
66
- if (pendingSpace) {
67
- output += " ";
68
- pendingSpace = false;
69
- }
70
- output += character;
71
- started = true;
72
- if (output.length >= OFFLINE_SYNC_STAGE_READ_BYTES) flush();
93
+ resolveSigma(cased);
94
+ }
95
+ if (character === "Σ" && precededByCased) {
96
+ flush();
97
+ sink.beginConditionalSigma();
98
+ pendingSigma = true;
99
+ precededByCased = true;
100
+ continue;
73
101
  }
102
+ emit(character.toLowerCase());
103
+ if (!caseIgnorable) precededByCased = cased;
104
+ }
105
+ };
106
+ return {
107
+ push,
108
+ finish() {
109
+ if (pendingSigma) resolveSigma(false);
110
+ flush();
74
111
  },
75
- finish: flush,
76
112
  };
77
113
  }
78
114
 
@@ -86,10 +122,7 @@ async function forEachStagedTextChunk(
86
122
  const decoder = new TextDecoder("utf-8");
87
123
  let remaining = offset;
88
124
  for await (const chunk of readMaybeEncryptedFileFromChunks(stagePath, key, memoryDir)) {
89
- const textChunk =
90
- remaining >= chunk.length
91
- ? null
92
- : chunk.subarray(remaining);
125
+ const textChunk = remaining >= chunk.length ? null : chunk.subarray(remaining);
93
126
  remaining = Math.max(0, remaining - chunk.length);
94
127
  if (textChunk === null || textChunk.length === 0) continue;
95
128
  const text = decoder.decode(textChunk, { stream: true });
@@ -99,11 +132,7 @@ async function forEachStagedTextChunk(
99
132
  if (finalText.length > 0) onText(finalText);
100
133
  }
101
134
 
102
- async function findStagedBodyOffset(
103
- stagePath: string,
104
- key: Buffer | null,
105
- memoryDir: string
106
- ): Promise<number | null> {
135
+ async function findStagedBodyOffset(stagePath: string, key: Buffer | null, memoryDir: string): Promise<number | null> {
107
136
  let scannedBytes = 0;
108
137
  let tail = Buffer.alloc(0);
109
138
  for await (const chunk of readMaybeEncryptedFileFromChunks(stagePath, key, memoryDir)) {
@@ -178,6 +207,8 @@ export abstract class TombstoneBlockedCaptureIndexHost {
178
207
  protected abstract bumpMemoryStatusVersion(): void;
179
208
  protected abstract bumpMemoryCorpusVersion(): void;
180
209
  protected abstract markFactHashIndexNotAuthoritative(): void;
210
+ protected abstract deleteManagedStorageFile(filePath: string, deletionMtimeMs?: number | null): Promise<boolean>;
211
+ protected abstract writeManagedStorageFile(filePath: string, write: () => Promise<void>): Promise<void>;
181
212
 
182
213
  private async writeStorageSecureFileChunks(filePath: string, chunks: AsyncIterable<Buffer>): Promise<void> {
183
214
  const options = this.tombstoneBlockedCaptureIndexOptions();
@@ -231,8 +262,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
231
262
  discardWrite: (marker) => this.getTombstoneBlockedCaptureIndex().discardWrite(marker),
232
263
  markUntrusted: () => this.getTombstoneBlockedCaptureIndex().markUntrusted(),
233
264
  writeStorageSecureFile: (target, content) => this.writeStorageSecureFile(target, content),
234
- withCaptureWriteLock: (task, lockIdentity) =>
235
- this.withTombstoneBlockedCaptureWriteLock(task, lockIdentity),
265
+ withCaptureWriteLock: (task, lockIdentity) => this.withTombstoneBlockedCaptureWriteLock(task, lockIdentity),
236
266
  logWarning: (message) => log.warn(message),
237
267
  };
238
268
  await runTombstoneBlockedMutation(host, {
@@ -257,30 +287,79 @@ export abstract class TombstoneBlockedCaptureIndexHost {
257
287
  tombstoneBlocked(frontmatter),
258
288
  pathname,
259
289
  fileContent,
260
- buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector),
290
+ [
291
+ buildCapturePathLockIdentity(pathname),
292
+ buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector),
293
+ ],
261
294
  (rebuildMarker) =>
262
295
  this.getTombstoneBlockedCaptureIndex().addWrittenMemory(pathname, frontmatter, content, rebuildMarker),
263
296
  beforeIndexUpdate
264
297
  );
265
298
  }
266
299
 
300
+ protected async withTombstoneBlockedMemoryPathLock<T>(
301
+ pathname: string,
302
+ task: (current: MemoryFile | null) => Promise<T>,
303
+ additionalPathnames: readonly string[] = []
304
+ ): Promise<T> {
305
+ let lockIdentities = [pathname, ...additionalPathnames].map(buildCapturePathLockIdentity);
306
+ for (;;) {
307
+ let retryIdentity: string | undefined;
308
+ let result: T | undefined;
309
+ await this.withTombstoneBlockedCaptureWriteLock(async () => {
310
+ const current = await this.readMemoryByPath(pathname);
311
+ if (current !== null) {
312
+ const currentIdentity = this.offlineSyncMemoryIdentity(current);
313
+ if (!lockIdentities.includes(currentIdentity)) {
314
+ retryIdentity = currentIdentity;
315
+ return;
316
+ }
317
+ }
318
+ result = await task(current);
319
+ }, lockIdentities);
320
+ if (retryIdentity !== undefined) {
321
+ lockIdentities = [...new Set([...lockIdentities, retryIdentity])];
322
+ continue;
323
+ }
324
+ return result!;
325
+ }
326
+ }
327
+
267
328
  protected async writeTombstoneBlockedChunk(
268
329
  pathname: string,
269
330
  fileContent: string,
270
331
  frontmatter: MemoryFrontmatter,
271
332
  content: string,
272
333
  findDuplicate: () => Promise<MemoryFile | null>,
273
- afterWrite: () => Promise<void>
334
+ afterWrite: (current: MemoryFile | null) => Promise<void>
274
335
  ): Promise<string> {
275
- return await runTombstoneBlockedChunkMutation({
276
- blocked: tombstoneBlocked(frontmatter),
277
- id: frontmatter.id,
278
- identity: buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector),
279
- findDuplicate,
280
- persistMemory: () => this.writeTombstoneBlockedMemory(pathname, fileContent, frontmatter, content),
281
- afterWrite,
282
- withCaptureWriteLock: (task, identity) => this.withTombstoneBlockedCaptureWriteLock(task, identity),
283
- });
336
+ const incomingIdentity = buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector);
337
+ let lockIdentities = [buildCapturePathLockIdentity(pathname), incomingIdentity];
338
+ for (;;) {
339
+ let retryIdentity: string | undefined;
340
+ let result = frontmatter.id;
341
+ await this.withTombstoneBlockedCaptureWriteLock(async () => {
342
+ const current = await this.readMemoryByPath(pathname);
343
+ if (current !== null) {
344
+ const currentIdentity = this.offlineSyncMemoryIdentity(current);
345
+ if (!lockIdentities.includes(currentIdentity)) {
346
+ retryIdentity = currentIdentity;
347
+ return;
348
+ }
349
+ }
350
+ if (tombstoneBlocked(frontmatter)) {
351
+ const duplicate = await findDuplicate();
352
+ if (duplicate) {
353
+ result = duplicate.frontmatter.id;
354
+ return;
355
+ }
356
+ }
357
+ await this.writeTombstoneBlockedMemory(pathname, fileContent, frontmatter, content);
358
+ await afterWrite(current);
359
+ }, lockIdentities);
360
+ if (retryIdentity === undefined) return result;
361
+ lockIdentities = [...new Set([...lockIdentities, retryIdentity])];
362
+ }
284
363
  }
285
364
 
286
365
  protected async writeTombstoneBlockedUpdate(
@@ -295,30 +374,9 @@ export abstract class TombstoneBlockedCaptureIndexHost {
295
374
  before.path,
296
375
  fileContent,
297
376
  [
298
- ...(tombstoneBlocked(before.frontmatter)
299
- ? [
300
- buildExplicitCaptureDedupKey(
301
- before.content,
302
- before.frontmatter.category,
303
- before.frontmatter.sourceConnector
304
- ),
305
- ]
306
- : []),
307
- ...(tombstoneBlocked(frontmatter)
308
- ? [buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector)]
309
- : []),
310
- ...(isQueuedReviewMemory(before)
311
- ? [
312
- buildExplicitCaptureDedupKey(
313
- before.content,
314
- before.frontmatter.category,
315
- before.frontmatter.sourceConnector
316
- ),
317
- ]
318
- : []),
319
- ...(isQueuedReviewFrontmatter(frontmatter)
320
- ? [buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector)]
321
- : []),
377
+ buildCapturePathLockIdentity(before.path),
378
+ this.offlineSyncMemoryIdentity(before),
379
+ buildExplicitCaptureDedupKey(content, frontmatter.category, frontmatter.sourceConnector),
322
380
  ],
323
381
  (rebuildMarker, current) =>
324
382
  this.getTombstoneBlockedCaptureIndex().syncUpdatedMemory(
@@ -328,7 +386,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
328
386
  rebuildMarker
329
387
  ),
330
388
  beforeIndexUpdate,
331
- isQueuedReviewMemory(before) || isQueuedReviewFrontmatter(frontmatter)
389
+ true
332
390
  );
333
391
  }
334
392
 
@@ -343,39 +401,14 @@ export abstract class TombstoneBlockedCaptureIndexHost {
343
401
  before.path,
344
402
  fileContent,
345
403
  [
346
- ...(tombstoneBlocked(before.frontmatter)
347
- ? [
348
- buildExplicitCaptureDedupKey(
349
- before.content,
350
- before.frontmatter.category,
351
- before.frontmatter.sourceConnector
352
- ),
353
- ]
354
- : []),
355
- ...(tombstoneBlocked(frontmatter)
356
- ? [buildExplicitCaptureDedupKey(before.content, frontmatter.category, frontmatter.sourceConnector)]
357
- : []),
358
- ...(isQueuedReviewMemory(before)
359
- ? [
360
- buildExplicitCaptureDedupKey(
361
- before.content,
362
- before.frontmatter.category,
363
- before.frontmatter.sourceConnector
364
- ),
365
- ]
366
- : []),
367
- ...(isQueuedReviewFrontmatter(frontmatter)
368
- ? [buildExplicitCaptureDedupKey(before.content, frontmatter.category, frontmatter.sourceConnector)]
369
- : []),
404
+ buildCapturePathLockIdentity(before.path),
405
+ this.offlineSyncMemoryIdentity(before),
406
+ buildExplicitCaptureDedupKey(before.content, frontmatter.category, frontmatter.sourceConnector),
370
407
  ],
371
408
  (rebuildMarker, current) =>
372
- this.getTombstoneBlockedCaptureIndex().syncUpdatedFrontmatter(
373
- current ?? before,
374
- frontmatter,
375
- rebuildMarker
376
- ),
409
+ this.getTombstoneBlockedCaptureIndex().syncUpdatedFrontmatter(current ?? before, frontmatter, rebuildMarker),
377
410
  beforeIndexUpdate,
378
- isQueuedReviewMemory(before) || isQueuedReviewFrontmatter(frontmatter)
411
+ true
379
412
  );
380
413
  }
381
414
 
@@ -440,45 +473,41 @@ export abstract class TombstoneBlockedCaptureIndexHost {
440
473
  memory: MemoryFile,
441
474
  task: (current: MemoryFile, markDurable: () => void) => Promise<string | null>
442
475
  ): Promise<string | null> {
443
- if (!this.isTombstoneBlockedMemory(memory) && !isQueuedReviewMemory(memory)) {
444
- return await task(memory, () => {});
445
- }
446
476
  let archivedPath: string | null = null;
447
- const archived = await this.runTombstoneBlockedInvalidation(
448
- memory,
449
- async (current, rebuildMarker, markDurable) => {
450
- let archiveDurable = false;
451
- const markArchiveDurable = () => {
452
- archiveDurable = true;
453
- markDurable();
454
- };
455
- archivedPath = await task(current, markArchiveDurable);
456
- if (rebuildMarker !== undefined && (archivedPath !== null || archiveDurable)) {
457
- await this.rebuildTombstoneBlockedCaptureAfterInvalidation(rebuildMarker);
458
- } else if (rebuildMarker !== undefined) {
459
- const index = this.getTombstoneBlockedCaptureIndex();
460
- try { await index.discardWrite(rebuildMarker); } catch { index.markUntrusted(); }
477
+ const archived = await this.runTombstoneBlockedInvalidation(memory, async (current, rebuildMarker, markDurable) => {
478
+ let archiveDurable = false;
479
+ const markArchiveDurable = () => {
480
+ archiveDurable = true;
481
+ markDurable();
482
+ };
483
+ archivedPath = await task(current, markArchiveDurable);
484
+ if (rebuildMarker !== undefined && (archivedPath !== null || archiveDurable)) {
485
+ await this.rebuildTombstoneBlockedCaptureAfterInvalidation(rebuildMarker);
486
+ } else if (rebuildMarker !== undefined) {
487
+ const index = this.getTombstoneBlockedCaptureIndex();
488
+ try {
489
+ await index.discardWrite(rebuildMarker);
490
+ } catch {
491
+ index.markUntrusted();
461
492
  }
462
- return archivedPath !== null;
463
493
  }
464
- );
494
+ return archivedPath !== null;
495
+ });
465
496
  return archived ? archivedPath : null;
466
497
  }
467
498
 
468
499
  protected async runTombstoneBlockedInvalidation(
469
500
  memory: MemoryFile,
470
- task: (
471
- current: MemoryFile,
472
- rebuildMarker: string | undefined,
473
- markDurable: () => void
474
- ) => Promise<boolean>,
501
+ task: (current: MemoryFile, rebuildMarker: string | undefined, markDurable: () => void) => Promise<boolean>,
475
502
  propagateErrors = false,
476
503
  coordinate = false
477
504
  ): Promise<boolean> {
478
- let lockIdentity =
479
- coordinate || this.isTombstoneBlockedMemory(memory) || isQueuedReviewMemory(memory)
480
- ? this.offlineSyncMemoryIdentity(memory)
481
- : undefined;
505
+ let lockIdentities = [
506
+ buildCapturePathLockIdentity(memory.path),
507
+ ...(coordinate || this.isTombstoneBlockedMemory(memory) || isQueuedReviewMemory(memory)
508
+ ? [this.offlineSyncMemoryIdentity(memory)]
509
+ : []),
510
+ ];
482
511
  for (;;) {
483
512
  const attempt = async () => {
484
513
  const options = this.tombstoneBlockedCaptureIndexOptions();
@@ -491,7 +520,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
491
520
  const queuedReview = isQueuedReviewMemory(current);
492
521
  if (blocked || queuedReview) {
493
522
  const currentIdentity = this.offlineSyncMemoryIdentity(current);
494
- if (lockIdentity !== currentIdentity) return { retryIdentity: currentIdentity };
523
+ if (!lockIdentities.includes(currentIdentity)) return { retryIdentity: currentIdentity };
495
524
  }
496
525
  const blockedIndex = blocked ? this.getTombstoneBlockedCaptureIndex() : null;
497
526
  let rebuildMarker: string | undefined;
@@ -521,12 +550,9 @@ export abstract class TombstoneBlockedCaptureIndexHost {
521
550
  return { result: false };
522
551
  }
523
552
  };
524
- const result =
525
- lockIdentity === undefined
526
- ? await attempt()
527
- : await this.withTombstoneBlockedCaptureWriteLock(attempt, lockIdentity);
553
+ const result = await this.withTombstoneBlockedCaptureWriteLock(attempt, lockIdentities);
528
554
  if (result.retryIdentity !== undefined) {
529
- lockIdentity = result.retryIdentity;
555
+ lockIdentities = [...new Set([...lockIdentities, result.retryIdentity])];
530
556
  continue;
531
557
  }
532
558
  return result.result;
@@ -541,7 +567,7 @@ export abstract class TombstoneBlockedCaptureIndexHost {
541
567
  memory,
542
568
  async (current, rebuildMarker, markDurable) => {
543
569
  if (!shouldDelete(current)) return false;
544
- await unlink(current.path);
570
+ if (!(await this.deleteManagedStorageFile(current.path))) return false;
545
571
  markDurable();
546
572
  deleted = current;
547
573
  const memoryDir = this.tombstoneBlockedCaptureIndexOptions().memoryDir;
@@ -570,22 +596,19 @@ export abstract class TombstoneBlockedCaptureIndexHost {
570
596
  ): Promise<void> {
571
597
  for (;;) {
572
598
  const before = await this.readMemoryByPath(target);
573
- const targetIdentity = this.isTombstoneBlockedMemory(before)
574
- ? this.offlineSyncMemoryIdentity(before)
575
- : undefined;
576
- const blocked = coordinate || targetIdentity !== undefined || this.isTombstoneBlockedMemory(after);
599
+ const targetIdentity = before === null ? undefined : this.offlineSyncMemoryIdentity(before);
600
+ const afterIdentity = after === null || streamedIdentity ? undefined : this.offlineSyncMemoryIdentity(after);
601
+ const mustCoordinate =
602
+ coordinate || targetIdentity !== undefined || afterIdentity !== undefined || streamedIdentity !== undefined;
577
603
  const identities = [
604
+ ...(mustCoordinate ? [buildCapturePathLockIdentity(target)] : []),
578
605
  ...(targetIdentity === undefined ? [] : [targetIdentity]),
579
- ...(!streamedIdentity && this.isTombstoneBlockedMemory(after)
580
- ? [this.offlineSyncMemoryIdentity(after)]
581
- : []),
582
- ...(coordinate ? [target] : []),
583
- ...(coordinate && after === null && streamedIdentity === undefined ? [""] : []),
606
+ ...(afterIdentity === undefined ? [] : [afterIdentity]),
584
607
  ];
585
608
  let retryIdentity: string | undefined;
586
609
  const mutate = async (): Promise<void> => {
587
610
  const current = await this.readMemoryByPath(target);
588
- if (this.isTombstoneBlockedMemory(current)) {
611
+ if (current !== null) {
589
612
  const currentIdentity = this.offlineSyncMemoryIdentity(current);
590
613
  if (currentIdentity !== targetIdentity) {
591
614
  retryIdentity = currentIdentity;
@@ -598,7 +621,9 @@ export abstract class TombstoneBlockedCaptureIndexHost {
598
621
  ) {
599
622
  return;
600
623
  }
601
- const marker = blocked ? await this.getTombstoneBlockedCaptureIndex().prepareWrite() : undefined;
624
+ const affectsBlockedIndex =
625
+ coordinate || this.isTombstoneBlockedMemory(current) || this.isTombstoneBlockedMemory(after);
626
+ const marker = affectsBlockedIndex ? await this.getTombstoneBlockedCaptureIndex().prepareWrite() : undefined;
602
627
  let durable = false;
603
628
  try {
604
629
  await write();
@@ -624,18 +649,12 @@ export abstract class TombstoneBlockedCaptureIndexHost {
624
649
  throw err;
625
650
  }
626
651
  };
627
- if (!blocked) {
652
+ if (!mustCoordinate) {
628
653
  await mutate();
654
+ } else if (streamedIdentity) {
655
+ await this.withTombstoneBlockedCaptureWriteLockAndHashes(mutate, identities, [streamedIdentity.identityHash]);
629
656
  } else {
630
- if (streamedIdentity) {
631
- await this.withTombstoneBlockedCaptureWriteLockAndHashes(
632
- mutate,
633
- identities,
634
- [streamedIdentity.identityHash]
635
- );
636
- } else {
637
- await this.withTombstoneBlockedCaptureWriteLock(mutate, identities);
638
- }
657
+ await this.withTombstoneBlockedCaptureWriteLock(mutate, identities);
639
658
  }
640
659
  if (retryIdentity !== undefined) continue;
641
660
  return;
@@ -643,11 +662,15 @@ export abstract class TombstoneBlockedCaptureIndexHost {
643
662
  }
644
663
 
645
664
  protected async writeTombstoneBlockedOfflineSyncFile(target: string, content: Buffer): Promise<void> {
646
- await this.runTombstoneBlockedOfflineSyncMutation(
647
- target,
648
- this.tombstoneBlockedCaptureIndexOptions().parseMemory?.(target, content) ?? null,
649
- () => this.writeStorageSecureFile(target, content)
650
- );
665
+ const options = this.tombstoneBlockedCaptureIndexOptions();
666
+ const after = options.parseMemory?.(target, content) ?? null;
667
+ await withRawEntityPageMutation(path.dirname(options.stateDir), target, async () => {
668
+ await this.runTombstoneBlockedOfflineSyncMutation(
669
+ target,
670
+ after,
671
+ () => this.writeManagedStorageFile(target, () => this.writeStorageSecureFile(target, content))
672
+ );
673
+ });
651
674
  }
652
675
 
653
676
  private async prepareTombstoneBlockedOfflineSyncChunks(
@@ -752,28 +775,48 @@ export abstract class TombstoneBlockedCaptureIndexHost {
752
775
  after: MemoryFile
753
776
  ): Promise<StreamedOfflineSyncIdentity> {
754
777
  let normalizedLength = 0;
755
- const countNormalizer = createExplicitContentNormalizer((chunk) => {
756
- normalizedLength += chunk.length;
778
+ const countNormalizer = createExplicitContentNormalizer({
779
+ write: (chunk) => {
780
+ normalizedLength += chunk.length;
781
+ },
782
+ beginConditionalSigma: () => {
783
+ normalizedLength += 1;
784
+ },
785
+ resolveConditionalSigma: () => {},
757
786
  });
758
787
  const options = this.tombstoneBlockedCaptureIndexOptions();
759
788
  const key = options.secureStoreKeyProvider();
760
- await forEachStagedTextChunk(
761
- stagePath,
762
- bodyOffset,
763
- (text) => countNormalizer.push(text),
764
- key,
765
- options.memoryDir
766
- );
789
+ await forEachStagedTextChunk(stagePath, bodyOffset, (text) => countNormalizer.push(text), key, options.memoryDir);
767
790
  countNormalizer.finish();
768
791
 
769
792
  const category = after.frontmatter.category;
770
793
  const connector = after.frontmatter.sourceConnector?.trim() ?? "";
771
794
  const encode = (label: string, value: string): string => `${label} ${value.length} ${value}`;
772
- const identityPrefix =
773
- [encode("category", category), encode("connector", connector), `content ${normalizedLength} `].join(" ");
774
- const identityHash = createHash("sha256");
795
+ const identityPrefix = [
796
+ encode("category", category),
797
+ encode("connector", connector),
798
+ `content ${normalizedLength} `,
799
+ ].join(" ");
800
+ let identityHash = createHash("sha256");
801
+ let normalSigmaIdentityHash: Hash | undefined;
775
802
  identityHash.update(identityPrefix);
776
- const identityNormalizer = createExplicitContentNormalizer((chunk) => identityHash.update(chunk));
803
+ const identityNormalizer = createExplicitContentNormalizer({
804
+ write: (chunk) => {
805
+ identityHash.update(chunk);
806
+ normalSigmaIdentityHash?.update(chunk);
807
+ },
808
+ beginConditionalSigma: () => {
809
+ normalSigmaIdentityHash = identityHash.copy().update("σ");
810
+ identityHash.update("ς");
811
+ },
812
+ resolveConditionalSigma: (useFinalSigma) => {
813
+ if (!useFinalSigma) {
814
+ if (normalSigmaIdentityHash === undefined) throw new Error("conditional sigma hash state is missing");
815
+ identityHash = normalSigmaIdentityHash;
816
+ }
817
+ normalSigmaIdentityHash = undefined;
818
+ },
819
+ });
777
820
  await forEachStagedTextChunk(
778
821
  stagePath,
779
822
  bodyOffset,
@@ -807,56 +850,58 @@ export abstract class TombstoneBlockedCaptureIndexHost {
807
850
  ? await this.prepareTombstoneBlockedOfflineSyncChunks(target, chunks)
808
851
  : { after: null, chunks };
809
852
  const streamedIdentity = prepared.streamedIdentity;
810
- const mutate = async (): Promise<void> => {
811
- try {
853
+ const baseDir = path.dirname(this.tombstoneBlockedCaptureIndexOptions().stateDir);
854
+ try {
855
+ await withRawEntityPageMutation(baseDir, target, async () => {
812
856
  await this.runTombstoneBlockedOfflineSyncMutation(
813
857
  target,
814
858
  prepared.after,
815
- () => this.writeStorageSecureFileChunks(target, prepared.chunks),
859
+ () => this.writeManagedStorageFile(target, () => this.writeStorageSecureFileChunks(target, prepared.chunks)),
816
860
  coordinate,
817
861
  streamedIdentity
818
862
  );
819
- } finally {
820
- if (prepared.stagePath !== undefined) await unlink(prepared.stagePath).catch(() => {});
821
- }
822
- };
823
- await mutate();
863
+ });
864
+ } finally {
865
+ if (prepared.stagePath !== undefined) await unlink(prepared.stagePath).catch(() => {});
866
+ }
824
867
  }
825
868
 
826
869
  async writeOfflineSyncFile(filePath: string, content: Buffer): Promise<void> {
827
870
  const target = this.assertManagedStoragePath(filePath, "storage.writeOfflineSyncFile");
828
871
  await this.writeTombstoneBlockedOfflineSyncFile(target, content);
829
- await this.requestSyncReconcileIfMemoryPath(target);
872
+ await this.requestSyncReconcileIfMigrationPath(target);
830
873
  }
831
874
 
832
875
  async writeOfflineSyncFileChunks(filePath: string, chunks: AsyncIterable<Buffer>): Promise<void> {
833
876
  const target = this.assertManagedStoragePath(filePath, "storage.writeOfflineSyncFileChunks");
834
877
  await this.writeTombstoneBlockedOfflineSyncFileChunks(target, chunks);
835
- await this.requestSyncReconcileIfMemoryPath(target);
878
+ await this.requestSyncReconcileIfMigrationPath(target);
836
879
  }
837
880
 
838
881
  /**
839
- * Replicated bytes are opaque (possibly encrypted) and can carry legacy
840
- * entity references a completed migration already renamed (issue #2213) —
841
- * but only memory-tier markdown can, so transcript/state/other sync traffic
842
- * must not trigger the full-corpus reconcile pass.
882
+ * Opaque replicated bytes can restore legacy memory references or entity
883
+ * relationship targets. Other sync traffic must not request reconciliation.
843
884
  */
844
- private async requestSyncReconcileIfMemoryPath(target: string): Promise<void> {
885
+ private async requestSyncReconcileIfMigrationPath(target: string): Promise<void> {
845
886
  const stateDir = this.tombstoneBlockedCaptureIndexOptions().stateDir;
846
887
  if (!pathMayCarryEntityRefs(path.dirname(stateDir), target)) return;
847
888
  await requestEntityCanonicalIdReconcile(stateDir);
848
889
  }
849
890
 
850
- async deleteOfflineSyncFile(filePath: string): Promise<void> {
891
+ async deleteOfflineSyncFile(filePath: string, deletionMtimeMs?: number | null): Promise<void> {
851
892
  const target = this.assertManagedStoragePath(filePath, "storage.deleteOfflineSyncFile");
852
- await this.deleteTombstoneBlockedOfflineSyncFile(target);
893
+ await this.deleteTombstoneBlockedOfflineSyncFile(target, deletionMtimeMs);
894
+ await this.requestSyncReconcileIfMigrationPath(target);
853
895
  }
854
896
 
855
- protected async deleteTombstoneBlockedOfflineSyncFile(target: string): Promise<void> {
856
- await this.runTombstoneBlockedOfflineSyncMutation(target, null, async () => {
857
- await unlink(target).catch((error: unknown) => {
858
- if (isErrnoCode(error, "ENOENT")) return;
859
- throw error;
897
+ protected async deleteTombstoneBlockedOfflineSyncFile(
898
+ target: string,
899
+ deletionMtimeMs?: number | null
900
+ ): Promise<void> {
901
+ const stateDir = this.tombstoneBlockedCaptureIndexOptions().stateDir;
902
+ await withRawEntityPageMutation(path.dirname(stateDir), target, async () => {
903
+ await this.runTombstoneBlockedOfflineSyncMutation(target, null, async () => {
904
+ await this.deleteManagedStorageFile(target, deletionMtimeMs);
860
905
  });
861
906
  });
862
907
  }