@remnic/core 9.23.3 → 9.23.4

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 (211) hide show
  1. package/dist/access-admin-ops-surface.d.ts +6 -5
  2. package/dist/access-admin-ops-surface.js +36 -33
  3. package/dist/access-boundary.d.ts +6 -5
  4. package/dist/access-boundary.js +36 -33
  5. package/dist/access-cli.js +92 -90
  6. package/dist/access-cli.js.map +1 -1
  7. package/dist/access-http.d.ts +7 -6
  8. package/dist/access-http.js +46 -43
  9. package/dist/access-identity-continuity-surface.d.ts +4 -4
  10. package/dist/access-identity-continuity-surface.js +36 -33
  11. package/dist/access-lcm-surface.d.ts +6 -5
  12. package/dist/access-lcm-surface.js +36 -33
  13. package/dist/access-mcp.d.ts +6 -5
  14. package/dist/access-mcp.js +41 -38
  15. package/dist/access-namespace-preflight.js +36 -33
  16. package/dist/access-observe-write-surface.d.ts +6 -5
  17. package/dist/access-observe-write-surface.js +36 -33
  18. package/dist/access-operations-batch.js +38 -35
  19. package/dist/access-operations.d.ts +6 -5
  20. package/dist/access-operations.js +40 -37
  21. package/dist/access-recall-concurrency.d.ts +6 -5
  22. package/dist/access-recall-concurrency.js +36 -33
  23. package/dist/access-recall-response.d.ts +6 -5
  24. package/dist/access-recall-response.js +36 -33
  25. package/dist/access-recall-surface.d.ts +6 -5
  26. package/dist/access-recall-surface.js +36 -33
  27. package/dist/access-schema.js +4 -4
  28. package/dist/{access-service-CKEROeFP.d.ts → access-service-Pl-h7x4p.d.ts} +6 -3
  29. package/dist/access-service.d.ts +8 -7
  30. package/dist/access-service.js +36 -33
  31. package/dist/access-surface-catalog.d.ts +6 -5
  32. package/dist/access-wearables-meetings-surface.d.ts +2 -2
  33. package/dist/active-recall.js +1 -1
  34. package/dist/adapters/index.js +7 -7
  35. package/dist/adapters/registry.js +3 -3
  36. package/dist/bootstrap.d.ts +4 -4
  37. package/dist/briefing.d.ts +1 -1
  38. package/dist/briefing.js +7 -7
  39. package/dist/buffer.d.ts +1 -1
  40. package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
  41. package/dist/causal-behavior.js +2 -2
  42. package/dist/causal-chain.js +2 -2
  43. package/dist/causal-consolidation.js +10 -10
  44. package/dist/causal-retrieval.js +2 -2
  45. package/dist/causal-trajectory-graph.js +2 -2
  46. package/dist/causal-trajectory.js +1 -1
  47. package/dist/{chunk-L2DPF4DF.js → chunk-3SHB4YAW.js} +4 -4
  48. package/dist/{chunk-ATEAL5EI.js → chunk-3UD5ZAUA.js} +2 -2
  49. package/dist/{chunk-ES5IHQ6M.js → chunk-4E3DWNTJ.js} +2 -2
  50. package/dist/{chunk-QCKQEBIY.js → chunk-5XMJ2P62.js} +5 -5
  51. package/dist/{chunk-WZVIB5BK.js → chunk-6MFMTNY4.js} +38 -29
  52. package/dist/chunk-6MFMTNY4.js.map +1 -0
  53. package/dist/{chunk-7CPOZH6Y.js → chunk-AJ7QCSIS.js} +2 -2
  54. package/dist/{chunk-M6LJXJ3J.js → chunk-AT7XL2JJ.js} +3 -3
  55. package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
  56. package/dist/{chunk-NRV4Y3PM.js → chunk-CAGPP5NB.js} +1 -1
  57. package/dist/{chunk-XGEFGNL5.js → chunk-CNUZ2PN2.js} +13 -9
  58. package/dist/chunk-CNUZ2PN2.js.map +1 -0
  59. package/dist/chunk-D5ILARSD.js +60 -0
  60. package/dist/chunk-D5ILARSD.js.map +1 -0
  61. package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
  62. package/dist/{chunk-P2BLHUL2.js → chunk-EHOTE26K.js} +5 -5
  63. package/dist/{chunk-DLKRXYRL.js → chunk-EXH5AK46.js} +6 -6
  64. package/dist/{chunk-JNIJBXVK.js → chunk-FPJWQZ35.js} +2 -2
  65. package/dist/{chunk-XWPFZX6S.js → chunk-GCQIMJFH.js} +97 -26
  66. package/dist/chunk-GCQIMJFH.js.map +1 -0
  67. package/dist/{chunk-GD3QOBMB.js → chunk-H2M4YA6K.js} +2 -2
  68. package/dist/{chunk-3ZW6ZQO6.js → chunk-HVYOZAQ7.js} +6 -6
  69. package/dist/{chunk-3UOSVTFR.js → chunk-JRQBPN63.js} +8 -8
  70. package/dist/{chunk-3L5O7SMT.js → chunk-JVOA5VDZ.js} +3 -3
  71. package/dist/{chunk-WWZ35GWW.js → chunk-K3C6CJOF.js} +2 -2
  72. package/dist/{chunk-4PQ4KLLK.js → chunk-KYP5FSPG.js} +6 -6
  73. package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
  74. package/dist/{chunk-V2XVMCP6.js → chunk-M2PG7OTI.js} +2 -2
  75. package/dist/{chunk-HSSIWAZP.js → chunk-NSRTLSBX.js} +114 -98
  76. package/dist/{chunk-HSSIWAZP.js.map → chunk-NSRTLSBX.js.map} +1 -1
  77. package/dist/{chunk-MU7ZHSZE.js → chunk-PO5LSKQO.js} +2 -2
  78. package/dist/{chunk-6TWXQ4E2.js → chunk-POHSSW2T.js} +2 -2
  79. package/dist/{chunk-AU7Q3LSC.js → chunk-RKNJBZ55.js} +7 -7
  80. package/dist/{chunk-QE63OHLB.js → chunk-RPOSRICW.js} +5 -5
  81. package/dist/{chunk-ZN4UZWMT.js → chunk-RSLXMGFP.js} +2 -2
  82. package/dist/{chunk-7I7AYIUQ.js → chunk-SPWOLGXT.js} +5 -5
  83. package/dist/{chunk-E3ZMFFQZ.js → chunk-TMX4MBSK.js} +2 -2
  84. package/dist/{chunk-SVZGA2MK.js → chunk-UZ7HGRHK.js} +2 -2
  85. package/dist/{chunk-JYIFGGEM.js → chunk-UZGJFIIG.js} +2 -2
  86. package/dist/{chunk-IPLYGWQF.js → chunk-VDX2J7OX.js} +6 -6
  87. package/dist/{chunk-CUUY5CC4.js → chunk-W3BKLKG6.js} +2 -2
  88. package/dist/{chunk-HNZKVLAN.js → chunk-W6ROK2KU.js} +2 -2
  89. package/dist/chunk-XJTYLU6J.js +261 -0
  90. package/dist/chunk-XJTYLU6J.js.map +1 -0
  91. package/dist/{chunk-5FZQ74K5.js → chunk-XPLTZEJU.js} +2 -2
  92. package/dist/{chunk-MAXVH44E.js → chunk-Z54EM5YZ.js} +7 -7
  93. package/dist/{chunk-KXGE7L62.js → chunk-ZLDMAGCB.js} +59 -59
  94. package/dist/{cli-BrwT9YMD.d.ts → cli-DuMB83Mw.d.ts} +3 -3
  95. package/dist/cli.d.ts +7 -6
  96. package/dist/cli.js +66 -64
  97. package/dist/compounding/engine.d.ts +1 -1
  98. package/dist/compounding/engine.js +7 -7
  99. package/dist/config.js +1 -1
  100. package/dist/connectors/codex-materialize-runner.js +7 -7
  101. package/dist/connectors/index.js +7 -7
  102. package/dist/consolidation-provenance-check.d.ts +1 -1
  103. package/dist/consolidation-undo.d.ts +1 -1
  104. package/dist/contradiction/index.d.ts +1 -1
  105. package/dist/conversation-index/backend.js +2 -2
  106. package/dist/corpus-watermark.d.ts +227 -0
  107. package/dist/corpus-watermark.js +106 -0
  108. package/dist/entity-retrieval.d.ts +1 -1
  109. package/dist/entity-retrieval.js +7 -7
  110. package/dist/explicit-capture.d.ts +4 -4
  111. package/dist/extraction.js +1 -1
  112. package/dist/{graph-edge-decay-Z6ENALU2.js → graph-edge-decay-GF3ZSGSP.js} +4 -4
  113. package/dist/graph-edge-decay-GF3ZSGSP.js.map +1 -0
  114. package/dist/graph-snapshot.js +3 -3
  115. package/dist/graph.js +2 -2
  116. package/dist/index.d.ts +12 -11
  117. package/dist/index.js +136 -134
  118. package/dist/lcm/engine.js +3 -3
  119. package/dist/lcm/index.js +6 -6
  120. package/dist/maintenance/memory-governance.js +7 -7
  121. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +1 -1
  122. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
  123. package/dist/maintenance/rebuild-memory-projection.d.ts +1 -1
  124. package/dist/maintenance/rebuild-memory-projection.js +8 -8
  125. package/dist/{maintenance-C98njYb8.d.ts → maintenance-DGvDB1xF.d.ts} +1 -1
  126. package/dist/mcp-memory-inspector-app.d.ts +6 -5
  127. package/dist/memory-worth-outcomes.d.ts +1 -1
  128. package/dist/namespaces/migrate.d.ts +1 -1
  129. package/dist/namespaces/migrate.js +14 -14
  130. package/dist/namespaces/search.js +6 -6
  131. package/dist/namespaces/storage.d.ts +1 -1
  132. package/dist/namespaces/storage.js +7 -7
  133. package/dist/operator-doctor-corpus.d.ts +44 -0
  134. package/dist/operator-doctor-corpus.js +91 -0
  135. package/dist/operator-doctor-corpus.js.map +1 -0
  136. package/dist/operator-toolkit.d.ts +1 -1
  137. package/dist/operator-toolkit.js +22 -20
  138. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  139. package/dist/orchestration/maintenance.d.ts +2 -2
  140. package/dist/orchestration/maintenance.js +12 -12
  141. package/dist/{orchestrator-C9ZVppNh.d.ts → orchestrator-RXHefhAy.d.ts} +3 -3
  142. package/dist/orchestrator.d.ts +4 -4
  143. package/dist/orchestrator.js +91 -89
  144. package/dist/resume-bundles.js +1 -1
  145. package/dist/search/factory.js +5 -5
  146. package/dist/search/index.js +9 -9
  147. package/dist/semantic-consolidation.js +8 -8
  148. package/dist/semantic-rule-promotion.js +7 -7
  149. package/dist/semantic-rule-verifier.js +7 -7
  150. package/dist/{service-DgFWlZ-r.d.ts → service-BrWqlsZ4.d.ts} +1 -1
  151. package/dist/{storage-XGawwqXE.d.ts → storage-DgNVexXm.d.ts} +24 -1
  152. package/dist/storage.d.ts +1 -1
  153. package/dist/storage.js +6 -6
  154. package/dist/temporal-supersession.d.ts +1 -1
  155. package/dist/tier-migration.d.ts +1 -1
  156. package/dist/transfer/autodetect.js +1 -1
  157. package/dist/transfer/backup.js +2 -2
  158. package/dist/transfer/capsule-export.js +3 -3
  159. package/dist/transfer/capsule-import.js +2 -2
  160. package/dist/verified-recall.js +7 -7
  161. package/package.json +12 -2
  162. package/src/access-http.test.ts +4 -2
  163. package/src/access-service.ts +5 -0
  164. package/src/corpus-watermark.test.ts +840 -0
  165. package/src/corpus-watermark.ts +531 -0
  166. package/src/operator-doctor-corpus.test.ts +171 -0
  167. package/src/operator-doctor-corpus.ts +95 -0
  168. package/src/operator-toolkit.ts +3 -3
  169. package/src/recall/archive-scoring.ts +18 -0
  170. package/src/storage/memory-read-store.ts +91 -22
  171. package/src/storage.ts +27 -2
  172. package/dist/chunk-WZVIB5BK.js.map +0 -1
  173. package/dist/chunk-XGEFGNL5.js.map +0 -1
  174. package/dist/chunk-XWPFZX6S.js.map +0 -1
  175. /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
  176. /package/dist/{chunk-L2DPF4DF.js.map → chunk-3SHB4YAW.js.map} +0 -0
  177. /package/dist/{chunk-ATEAL5EI.js.map → chunk-3UD5ZAUA.js.map} +0 -0
  178. /package/dist/{chunk-ES5IHQ6M.js.map → chunk-4E3DWNTJ.js.map} +0 -0
  179. /package/dist/{chunk-QCKQEBIY.js.map → chunk-5XMJ2P62.js.map} +0 -0
  180. /package/dist/{chunk-7CPOZH6Y.js.map → chunk-AJ7QCSIS.js.map} +0 -0
  181. /package/dist/{chunk-M6LJXJ3J.js.map → chunk-AT7XL2JJ.js.map} +0 -0
  182. /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
  183. /package/dist/{chunk-NRV4Y3PM.js.map → chunk-CAGPP5NB.js.map} +0 -0
  184. /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
  185. /package/dist/{chunk-P2BLHUL2.js.map → chunk-EHOTE26K.js.map} +0 -0
  186. /package/dist/{chunk-DLKRXYRL.js.map → chunk-EXH5AK46.js.map} +0 -0
  187. /package/dist/{chunk-JNIJBXVK.js.map → chunk-FPJWQZ35.js.map} +0 -0
  188. /package/dist/{chunk-GD3QOBMB.js.map → chunk-H2M4YA6K.js.map} +0 -0
  189. /package/dist/{chunk-3ZW6ZQO6.js.map → chunk-HVYOZAQ7.js.map} +0 -0
  190. /package/dist/{chunk-3UOSVTFR.js.map → chunk-JRQBPN63.js.map} +0 -0
  191. /package/dist/{chunk-3L5O7SMT.js.map → chunk-JVOA5VDZ.js.map} +0 -0
  192. /package/dist/{chunk-WWZ35GWW.js.map → chunk-K3C6CJOF.js.map} +0 -0
  193. /package/dist/{chunk-4PQ4KLLK.js.map → chunk-KYP5FSPG.js.map} +0 -0
  194. /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
  195. /package/dist/{chunk-V2XVMCP6.js.map → chunk-M2PG7OTI.js.map} +0 -0
  196. /package/dist/{chunk-MU7ZHSZE.js.map → chunk-PO5LSKQO.js.map} +0 -0
  197. /package/dist/{chunk-6TWXQ4E2.js.map → chunk-POHSSW2T.js.map} +0 -0
  198. /package/dist/{chunk-AU7Q3LSC.js.map → chunk-RKNJBZ55.js.map} +0 -0
  199. /package/dist/{chunk-QE63OHLB.js.map → chunk-RPOSRICW.js.map} +0 -0
  200. /package/dist/{chunk-ZN4UZWMT.js.map → chunk-RSLXMGFP.js.map} +0 -0
  201. /package/dist/{chunk-7I7AYIUQ.js.map → chunk-SPWOLGXT.js.map} +0 -0
  202. /package/dist/{chunk-E3ZMFFQZ.js.map → chunk-TMX4MBSK.js.map} +0 -0
  203. /package/dist/{chunk-SVZGA2MK.js.map → chunk-UZ7HGRHK.js.map} +0 -0
  204. /package/dist/{chunk-JYIFGGEM.js.map → chunk-UZGJFIIG.js.map} +0 -0
  205. /package/dist/{chunk-IPLYGWQF.js.map → chunk-VDX2J7OX.js.map} +0 -0
  206. /package/dist/{chunk-CUUY5CC4.js.map → chunk-W3BKLKG6.js.map} +0 -0
  207. /package/dist/{chunk-HNZKVLAN.js.map → chunk-W6ROK2KU.js.map} +0 -0
  208. /package/dist/{chunk-5FZQ74K5.js.map → chunk-XPLTZEJU.js.map} +0 -0
  209. /package/dist/{chunk-MAXVH44E.js.map → chunk-Z54EM5YZ.js.map} +0 -0
  210. /package/dist/{chunk-KXGE7L62.js.map → chunk-ZLDMAGCB.js.map} +0 -0
  211. /package/dist/{graph-edge-decay-Z6ENALU2.js.map → corpus-watermark.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-V7IZKJI3.js";
4
4
  import {
5
5
  AdapterRegistry
6
- } from "./chunk-AU7Q3LSC.js";
6
+ } from "./chunk-RKNJBZ55.js";
7
7
  import {
8
8
  WriteRateLimiter
9
9
  } from "./chunk-MKQBXQKU.js";
@@ -16,13 +16,13 @@ import {
16
16
  processChatMessage,
17
17
  sessionBelongsToPrincipal,
18
18
  subscribeChatTranscript
19
- } from "./chunk-M6LJXJ3J.js";
19
+ } from "./chunk-AT7XL2JJ.js";
20
20
  import {
21
21
  RelayMissionStoreError
22
- } from "./chunk-3L5O7SMT.js";
22
+ } from "./chunk-JVOA5VDZ.js";
23
23
  import {
24
24
  validateRequest
25
- } from "./chunk-V2XVMCP6.js";
25
+ } from "./chunk-M2PG7OTI.js";
26
26
  import {
27
27
  executeResolution,
28
28
  isValidResolutionVerb
@@ -36,7 +36,7 @@ import {
36
36
  CorrectionContractError,
37
37
  getOperation,
38
38
  resolveQueryNamespaceWritablePreflight
39
- } from "./chunk-WZVIB5BK.js";
39
+ } from "./chunk-6MFMTNY4.js";
40
40
  import {
41
41
  isTrustZoneName
42
42
  } from "./chunk-JGSKJHF7.js";
@@ -3197,4 +3197,4 @@ export {
3197
3197
  MeetingsInputError,
3198
3198
  EngramAccessHttpServer
3199
3199
  };
3200
- //# sourceMappingURL=chunk-DLKRXYRL.js.map
3200
+ //# sourceMappingURL=chunk-EXH5AK46.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  StorageManager,
3
3
  normalizeEntityName
4
- } from "./chunk-XWPFZX6S.js";
4
+ } from "./chunk-GCQIMJFH.js";
5
5
  import {
6
6
  serializeMutations
7
7
  } from "./chunk-WL5EBRDH.js";
@@ -956,4 +956,4 @@ export {
956
956
  resolveBriefingSaveDir,
957
957
  briefingFilename
958
958
  };
959
- //# sourceMappingURL=chunk-JNIJBXVK.js.map
959
+ //# sourceMappingURL=chunk-FPJWQZ35.js.map
@@ -1,8 +1,3 @@
1
- import {
2
- TombstoneStore,
3
- buildRetiredFactTombstoneInputs,
4
- collectRetiredMemoriesForRebuild
5
- } from "./chunk-2QMKMVHH.js";
6
1
  import {
7
2
  WEARABLES_DIR_NAME,
8
3
  escapeSegmentText,
@@ -14,6 +9,11 @@ import {
14
9
  unescapeSegmentText,
15
10
  unescapeSpeakerLabel
16
11
  } from "./chunk-UHVXE24Y.js";
12
+ import {
13
+ TombstoneStore,
14
+ buildRetiredFactTombstoneInputs,
15
+ collectRetiredMemoriesForRebuild
16
+ } from "./chunk-2QMKMVHH.js";
17
17
  import {
18
18
  supersessionKeysForFact
19
19
  } from "./chunk-DNHVPZOD.js";
@@ -69,6 +69,9 @@ import {
69
69
  readProjectedMemoryTimeline,
70
70
  updateProjectedMemoryPath
71
71
  } from "./chunk-3CSX3ETE.js";
72
+ import {
73
+ rotateMarkdownFileToArchive
74
+ } from "./chunk-DM2T26WE.js";
72
75
  import {
73
76
  closeContinuityIncidentRecord,
74
77
  createContinuityIncidentRecord,
@@ -78,13 +81,6 @@ import {
78
81
  serializeContinuityIncident,
79
82
  upsertContinuityLoopInMarkdown
80
83
  } from "./chunk-LDXUBPMO.js";
81
- import {
82
- rotateMarkdownFileToArchive
83
- } from "./chunk-DM2T26WE.js";
84
- import {
85
- parseFaithfulnessField,
86
- serializeFaithfulnessFields
87
- } from "./chunk-JYIJNNN3.js";
88
84
  import {
89
85
  composeMemoryEnvelope,
90
86
  isSealedMemoryEnvelope,
@@ -94,6 +90,10 @@ import {
94
90
  assemblePersistedBody,
95
91
  stripAttributesSuffix
96
92
  } from "./chunk-R3DJVOSM.js";
93
+ import {
94
+ parseFaithfulnessField,
95
+ serializeFaithfulnessFields
96
+ } from "./chunk-JYIJNNN3.js";
97
97
  import {
98
98
  isConsolidationOperator,
99
99
  isValidDerivedFromEntry
@@ -131,14 +131,14 @@ import {
131
131
  reconcileProvenanceRead,
132
132
  serializeProvenanceFields
133
133
  } from "./chunk-5I4M26Q7.js";
134
+ import {
135
+ sanitizeMemoryContent
136
+ } from "./chunk-5GKPFL3S.js";
134
137
  import {
135
138
  matchEntitySchemaSection,
136
139
  normalizeEntityStructuredSection,
137
140
  sortStructuredSectionsBySchema
138
141
  } from "./chunk-4DJQYKMN.js";
139
- import {
140
- sanitizeMemoryContent
141
- } from "./chunk-5GKPFL3S.js";
142
142
  import {
143
143
  parseFlexibleIsoTimestamp
144
144
  } from "./chunk-P7FMDTKL.js";
@@ -213,6 +213,10 @@ import path9 from "path";
213
213
  // src/storage/memory-read-store.ts
214
214
  import { lstat, readdir, realpath, stat } from "fs/promises";
215
215
  import path2 from "path";
216
+ function isPropagatableReadError(err) {
217
+ const code = err.code;
218
+ return typeof code === "string" && code !== "ENOENT";
219
+ }
216
220
  var MemoryReadStore = class {
217
221
  constructor(deps) {
218
222
  this.deps = deps;
@@ -302,22 +306,44 @@ var MemoryReadStore = class {
302
306
  this.deps.artifactIndexCache = null;
303
307
  return latestArtifacts;
304
308
  }
305
- async collectActiveMemoryPaths() {
309
+ /**
310
+ * Recursively collect `*.md` paths under `startDirs`, hardened against symlink
311
+ * escape: a category dir symlinked outside memoryDir (e.g. decisions/ -> an
312
+ * external dir) must NOT pull out-of-store files into a scan (info leak). Same
313
+ * walker-hardening pattern as document-scanner.ts / cli.ts /
314
+ * consolidation-provenance-check.ts; reuses the shared containment helper.
315
+ * Paths only — no frontmatter parse.
316
+ */
317
+ async collectContainedMarkdownPaths(startDirs, propagateReadErrors = false) {
306
318
  const filePaths = [];
307
319
  let memoryRootReal;
308
320
  try {
309
321
  memoryRootReal = await realpath(this.deps.baseDir);
310
- } catch {
322
+ } catch (err) {
323
+ if (propagateReadErrors && isPropagatableReadError(err)) throw err;
311
324
  return filePaths;
312
325
  }
313
326
  const collectPaths = async (dir) => {
327
+ let dirStat;
328
+ try {
329
+ dirStat = await lstat(dir);
330
+ } catch (err) {
331
+ if (propagateReadErrors && isPropagatableReadError(err)) throw err;
332
+ return;
333
+ }
334
+ if (dirStat.isSymbolicLink()) return;
335
+ if (!dirStat.isDirectory()) {
336
+ if (propagateReadErrors) {
337
+ throw new Error(`corpus scan: expected a directory but found a non-directory at ${dir}`);
338
+ }
339
+ return;
340
+ }
314
341
  let entries;
315
342
  try {
316
- const dirStat = await lstat(dir);
317
- if (dirStat.isSymbolicLink() || !dirStat.isDirectory()) return;
318
343
  assertPathInsideRoot(memoryRootReal, await realpath(dir), dir);
319
344
  entries = await readdir(dir, { withFileTypes: true });
320
- } catch {
345
+ } catch (err) {
346
+ if (propagateReadErrors && isPropagatableReadError(err)) throw err;
321
347
  return;
322
348
  }
323
349
  const subdirs = [];
@@ -330,7 +356,8 @@ var MemoryReadStore = class {
330
356
  try {
331
357
  assertPathInsideRoot(memoryRootReal, await realpath(fullPath), fullPath);
332
358
  filePaths.push(fullPath);
333
- } catch {
359
+ } catch (err) {
360
+ if (propagateReadErrors && isPropagatableReadError(err)) throw err;
334
361
  }
335
362
  }
336
363
  }
@@ -338,11 +365,32 @@ var MemoryReadStore = class {
338
365
  await collectPaths(subdir);
339
366
  }
340
367
  };
341
- for (const dir of RECALL_FALLBACK_DIRS) {
342
- await collectPaths(path2.join(this.deps.baseDir, dir));
368
+ for (const dir of startDirs) {
369
+ await collectPaths(dir);
343
370
  }
344
371
  return filePaths;
345
372
  }
373
+ async collectActiveMemoryPaths(options) {
374
+ return this.collectContainedMarkdownPaths(
375
+ RECALL_FALLBACK_DIRS.map((dir) => path2.join(this.deps.baseDir, dir)),
376
+ options?.propagateReadErrors ?? false
377
+ );
378
+ }
379
+ /**
380
+ * Cold-tier memory paths for the corpus census (issue #2156 finding D).
381
+ * Demoted memories move to `<baseDir>/cold/...` but stay active and reachable
382
+ * via cold recall, so the divergence census MUST count them — otherwise two
383
+ * replicas whose cold tiers differ show a false "converged" digest. Paths
384
+ * only, same symlink/containment hardening as the hot scan. This is NOT part
385
+ * of the recall fallback corpus (collectActiveMemoryPaths), whose scan is
386
+ * intentionally unchanged.
387
+ */
388
+ async collectColdMemoryPaths(options) {
389
+ return this.collectContainedMarkdownPaths(
390
+ [this.deps.resolveTierRootDir("cold")],
391
+ options?.propagateReadErrors ?? false
392
+ );
393
+ }
346
394
  async readMemoriesWindow(options = {}) {
347
395
  const allPaths = await this.deps.collectActiveMemoryPaths();
348
396
  const sortedPaths = this.deps.orderWindowPaths(allPaths);
@@ -7009,8 +7057,31 @@ ${sanitized.text}
7009
7057
  }
7010
7058
  return Math.max(1, Math.floor(batchSize));
7011
7059
  }
7012
- async collectActiveMemoryPaths() {
7013
- return this.memoryReadStore.collectActiveMemoryPaths();
7060
+ /**
7061
+ * Public cheap active-memory path scan (issue #2149 corpus watermark). Lists
7062
+ * active memory file paths without parsing frontmatter — safe on a 100k+
7063
+ * corpus, unlike readAllMemories().
7064
+ */
7065
+ async collectActiveMemoryPaths(options) {
7066
+ return this.memoryReadStore.collectActiveMemoryPaths(options);
7067
+ }
7068
+ /**
7069
+ * Public cheap cold-tier path scan (issue #2156 finding D corpus census).
7070
+ * Lists demoted-but-reachable memory paths under `cold/` without parsing
7071
+ * frontmatter, so the divergence watermark counts the cold tier too.
7072
+ */
7073
+ async collectColdMemoryPaths(options) {
7074
+ return this.memoryReadStore.collectColdMemoryPaths(options);
7075
+ }
7076
+ /**
7077
+ * Combined hot+cold corpus-mutation sentinel (issue #2156). Changes whenever
7078
+ * EITHER tier is written, so a divergence census can bracket its hot/cold scan
7079
+ * and detect a tier migration (write-cold-then-unlink-hot) racing the walkers,
7080
+ * then retry for a consistent snapshot instead of caching a transient
7081
+ * double-count or miss.
7082
+ */
7083
+ getCorpusScanVersion() {
7084
+ return `${this.getMemoryCorpusVersion()}:${this.readColdWriteVersion()}`;
7014
7085
  }
7015
7086
  async readParsedMemoriesFromPaths(filePaths, batchSize) {
7016
7087
  if (filePaths.length === 0) return [];
@@ -8911,4 +8982,4 @@ export {
8911
8982
  isValidBufferSurpriseEvent,
8912
8983
  StorageManager3 as StorageManager
8913
8984
  };
8914
- //# sourceMappingURL=chunk-XWPFZX6S.js.map
8985
+ //# sourceMappingURL=chunk-GCQIMJFH.js.map