@remnic/core 9.35.2 → 9.35.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/dist/access-admin-ops-surface.d.ts +5 -5
  2. package/dist/access-admin-ops-surface.js +19 -18
  3. package/dist/access-authorization-probe.d.ts +5 -5
  4. package/dist/access-authorization-probe.js +20 -19
  5. package/dist/access-boundary.d.ts +5 -5
  6. package/dist/access-boundary.js +19 -18
  7. package/dist/access-cli.js +39 -38
  8. package/dist/access-cli.js.map +1 -1
  9. package/dist/access-extraction-force-flush.d.ts +5 -5
  10. package/dist/access-extraction-force-flush.js +19 -18
  11. package/dist/access-http-lcm-compaction.d.ts +5 -5
  12. package/dist/access-http-lifecycle-flush.d.ts +5 -5
  13. package/dist/access-http.d.ts +5 -5
  14. package/dist/access-http.js +24 -23
  15. package/dist/access-identity-continuity-surface.d.ts +4 -4
  16. package/dist/access-identity-continuity-surface.js +19 -18
  17. package/dist/access-lcm-surface.d.ts +5 -5
  18. package/dist/access-lcm-surface.js +19 -18
  19. package/dist/access-mcp.d.ts +5 -5
  20. package/dist/access-mcp.js +22 -21
  21. package/dist/access-namespace-preflight.js +19 -18
  22. package/dist/access-observe-write-surface.d.ts +5 -5
  23. package/dist/access-observe-write-surface.js +19 -18
  24. package/dist/access-operations-batch.js +20 -19
  25. package/dist/access-operations.d.ts +5 -5
  26. package/dist/access-operations.js +21 -20
  27. package/dist/access-recall-concurrency.d.ts +5 -5
  28. package/dist/access-recall-concurrency.js +19 -18
  29. package/dist/access-recall-response.d.ts +5 -5
  30. package/dist/access-recall-response.js +19 -18
  31. package/dist/access-recall-surface.d.ts +5 -5
  32. package/dist/access-recall-surface.js +19 -18
  33. package/dist/access-schema.d.ts +4 -4
  34. package/dist/{access-service-D9zIBlpp.d.ts → access-service-C2WYT1pO.d.ts} +3 -3
  35. package/dist/access-service-helpers.d.ts +5 -5
  36. package/dist/access-service.d.ts +5 -5
  37. package/dist/access-service.js +19 -18
  38. package/dist/access-surface-catalog.d.ts +5 -5
  39. package/dist/access-wearables-meetings-surface.d.ts +2 -2
  40. package/dist/bootstrap.d.ts +4 -4
  41. package/dist/briefing.d.ts +1 -1
  42. package/dist/briefing.js +10 -9
  43. package/dist/buffer.d.ts +1 -1
  44. package/dist/{capsule-merge-2H2IUTBT.js → capsule-merge-IDWJPCWK.js} +77 -8
  45. package/dist/capsule-merge-IDWJPCWK.js.map +1 -0
  46. package/dist/causal-consolidation.js +11 -10
  47. package/dist/causal-consolidation.js.map +1 -1
  48. package/dist/{chunk-65ZPVYTA.js → chunk-3CE77VAP.js} +55 -5
  49. package/dist/chunk-3CE77VAP.js.map +1 -0
  50. package/dist/chunk-4J7G5SY4.js +338 -0
  51. package/dist/chunk-4J7G5SY4.js.map +1 -0
  52. package/dist/{chunk-EO7X2LDK.js → chunk-4TAD3B56.js} +2 -2
  53. package/dist/{chunk-QHYB4MJV.js → chunk-5ZGHUWTT.js} +2 -2
  54. package/dist/{chunk-TCIWHK3N.js → chunk-6D5D5A4M.js} +5 -5
  55. package/dist/{chunk-BIXWNHIL.js → chunk-6TF4M2LB.js} +5 -5
  56. package/dist/{chunk-FHYGLITW.js → chunk-AKELMJO2.js} +217 -45
  57. package/dist/{chunk-FHYGLITW.js.map → chunk-AKELMJO2.js.map} +1 -1
  58. package/dist/{chunk-FBUE6PD3.js → chunk-BEQOZOYZ.js} +21 -4
  59. package/dist/chunk-BEQOZOYZ.js.map +1 -0
  60. package/dist/{chunk-SA3WJJF2.js → chunk-BGLDKAYY.js} +2 -2
  61. package/dist/{chunk-OPRP6Q4Z.js → chunk-DKKZ6SO2.js} +3 -3
  62. package/dist/{chunk-6TAUHL33.js → chunk-DLVPUX7U.js} +10 -2
  63. package/dist/chunk-DLVPUX7U.js.map +1 -0
  64. package/dist/{chunk-QNWXCJ76.js → chunk-ENTCVTQR.js} +18 -1
  65. package/dist/{chunk-QNWXCJ76.js.map → chunk-ENTCVTQR.js.map} +1 -1
  66. package/dist/{chunk-AEPYA55F.js → chunk-FE7MUX7M.js} +2 -2
  67. package/dist/{chunk-GHR7WHZX.js → chunk-GORHSN5C.js} +2 -2
  68. package/dist/{chunk-7TEZUUGM.js → chunk-HUS2XN3T.js} +2 -2
  69. package/dist/{chunk-XWDZQIYU.js → chunk-IJAQCBGV.js} +2 -2
  70. package/dist/{chunk-TJLLYV2X.js → chunk-IMEXE4XS.js} +7 -7
  71. package/dist/{chunk-IZXTZ7BF.js → chunk-JYLN6KHH.js} +6 -6
  72. package/dist/{chunk-HEVWWPTL.js → chunk-LH3KXIBJ.js} +17 -17
  73. package/dist/{chunk-EH5U2YCX.js → chunk-M3DBB2ND.js} +2 -2
  74. package/dist/{chunk-XABS455Y.js → chunk-NBAEGFXT.js} +5 -5
  75. package/dist/{chunk-T4HH5Q3U.js → chunk-OJRLTZQM.js} +3 -3
  76. package/dist/{chunk-7ZHGPX56.js → chunk-PRP3M5Y3.js} +2 -2
  77. package/dist/{chunk-Y2ZD2RVG.js → chunk-PYTUBWAS.js} +2 -2
  78. package/dist/{chunk-4TGZCYHH.js → chunk-Q3CVY7LV.js} +1954 -1642
  79. package/dist/chunk-Q3CVY7LV.js.map +1 -0
  80. package/dist/{chunk-PH3ZWL3W.js → chunk-Q53RLEW7.js} +2 -2
  81. package/dist/{chunk-Y6OWJ3V5.js → chunk-RY2XZTFN.js} +2 -2
  82. package/dist/{chunk-2SHIWGY7.js → chunk-RY7CHVGE.js} +2 -2
  83. package/dist/{chunk-7VUAG236.js → chunk-T3FVAHM7.js} +4 -4
  84. package/dist/{chunk-2LTDWSR6.js → chunk-TSH56VPU.js} +2 -2
  85. package/dist/{chunk-J6SLNQRO.js → chunk-UBWOCQ3I.js} +6 -2
  86. package/dist/chunk-UBWOCQ3I.js.map +1 -0
  87. package/dist/{chunk-5FHE4JI7.js → chunk-VEUVON5I.js} +2 -2
  88. package/dist/{chunk-KEWUNL7P.js → chunk-WET4M3R6.js} +2 -2
  89. package/dist/{chunk-SLPLPGJQ.js → chunk-WL2S2UBB.js} +5 -5
  90. package/dist/{chunk-AHZYNPLX.js → chunk-YVMVVE4B.js} +2 -2
  91. package/dist/{chunk-5HTAJCTO.js → chunk-ZB3YODID.js} +15 -15
  92. package/dist/{cli-mFX-QQvx.d.ts → cli-jkmzdT8P.d.ts} +3 -3
  93. package/dist/cli.d.ts +6 -6
  94. package/dist/cli.js +34 -33
  95. package/dist/compounding/engine.d.ts +1 -1
  96. package/dist/compounding/engine.js +10 -9
  97. package/dist/connectors/codex-materialize-runner.js +10 -9
  98. package/dist/connectors/index.js +10 -9
  99. package/dist/consolidation-provenance-check.d.ts +1 -1
  100. package/dist/consolidation-provenance-check.js +8 -2
  101. package/dist/consolidation-undo.d.ts +1 -1
  102. package/dist/consolidation-undo.js +10 -1
  103. package/dist/consolidation-undo.js.map +1 -1
  104. package/dist/contradiction/index.d.ts +1 -1
  105. package/dist/corpus-watermark.js +12 -11
  106. package/dist/entity-retrieval.d.ts +1 -1
  107. package/dist/entity-retrieval.js +10 -9
  108. package/dist/explicit-capture.d.ts +4 -4
  109. package/dist/explicit-capture.js +6 -3
  110. package/dist/extraction.js +10 -9
  111. package/dist/{forget-4UY2EOKH.js → forget-DNAJ66ZD.js} +2 -2
  112. package/dist/index.d.ts +10 -10
  113. package/dist/index.js +39 -38
  114. package/dist/maintenance/memory-governance.js +10 -9
  115. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +1 -1
  116. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +10 -9
  117. package/dist/maintenance/rebuild-memory-projection.d.ts +1 -1
  118. package/dist/maintenance/rebuild-memory-projection.js +11 -10
  119. package/dist/{maintenance-70Wq118b.d.ts → maintenance-Ha9Dg93M.d.ts} +1 -1
  120. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  121. package/dist/memory-worth-outcomes.d.ts +1 -1
  122. package/dist/namespaces/migrate.d.ts +1 -1
  123. package/dist/namespaces/migrate.js +11 -10
  124. package/dist/namespaces/storage.d.ts +1 -1
  125. package/dist/namespaces/storage.js +10 -9
  126. package/dist/offline-sync-impression-drain.js +3 -3
  127. package/dist/operator-doctor-corpus.js +13 -12
  128. package/dist/operator-toolkit.d.ts +1 -1
  129. package/dist/operator-toolkit.js +17 -16
  130. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  131. package/dist/orchestration/maintenance.d.ts +2 -2
  132. package/dist/orchestration/maintenance.js +15 -14
  133. package/dist/{orchestrator-BH8LT-NX.d.ts → orchestrator-DV_u9bfx.d.ts} +3 -3
  134. package/dist/orchestrator.d.ts +4 -4
  135. package/dist/orchestrator.js +39 -38
  136. package/dist/page-versioning.js +7 -1
  137. package/dist/semantic-consolidation.js +11 -10
  138. package/dist/semantic-rule-promotion.js +10 -9
  139. package/dist/semantic-rule-verifier.js +10 -9
  140. package/dist/{service-CrxXHz5T.d.ts → service-JxXXY-Eh.d.ts} +1 -1
  141. package/dist/source-agent-qualifier.js +10 -9
  142. package/dist/{storage-CyWa1Jm6.d.ts → storage-BbH4HDUS.d.ts} +30 -26
  143. package/dist/storage.d.ts +1 -1
  144. package/dist/storage.js +9 -8
  145. package/dist/temporal-supersession.d.ts +1 -1
  146. package/dist/tier-migration.d.ts +1 -1
  147. package/dist/transfer/capsule-import.js +8 -2
  148. package/dist/verified-recall.js +10 -9
  149. package/package.json +2 -2
  150. package/src/binary-lifecycle/pipeline.ts +52 -1
  151. package/src/consolidation-undo.ts +4 -0
  152. package/src/curation/index.ts +41 -5
  153. package/src/lifecycle/tombstones.ts +40 -0
  154. package/src/maintenance/memory-governance.ts +4 -0
  155. package/src/page-versioning.ts +16 -1
  156. package/src/review/index.ts +97 -13
  157. package/src/spaces/index.ts +127 -6
  158. package/src/storage/citation-hash-source.ts +97 -0
  159. package/src/storage/entity-canonical-id-lock.ts +33 -0
  160. package/src/storage/entity-canonical-id-migration-adapter.ts +8 -4
  161. package/src/storage/entity-canonical-id-migration.ts +129 -77
  162. package/src/storage/entity-canonical-id-references.ts +557 -0
  163. package/src/storage/entity-ref-repair.ts +171 -0
  164. package/src/storage/entity-store.ts +163 -2
  165. package/src/storage/tombstone-blocked-capture-sync.ts +18 -0
  166. package/src/storage.ts +363 -396
  167. package/src/transfer/capsule-import.ts +91 -3
  168. package/src/transfer/capsule-merge.ts +128 -10
  169. package/dist/capsule-merge-2H2IUTBT.js.map +0 -1
  170. package/dist/chunk-4TGZCYHH.js.map +0 -1
  171. package/dist/chunk-65ZPVYTA.js.map +0 -1
  172. package/dist/chunk-6TAUHL33.js.map +0 -1
  173. package/dist/chunk-FBUE6PD3.js.map +0 -1
  174. package/dist/chunk-J6SLNQRO.js.map +0 -1
  175. /package/dist/{chunk-EO7X2LDK.js.map → chunk-4TAD3B56.js.map} +0 -0
  176. /package/dist/{chunk-QHYB4MJV.js.map → chunk-5ZGHUWTT.js.map} +0 -0
  177. /package/dist/{chunk-TCIWHK3N.js.map → chunk-6D5D5A4M.js.map} +0 -0
  178. /package/dist/{chunk-BIXWNHIL.js.map → chunk-6TF4M2LB.js.map} +0 -0
  179. /package/dist/{chunk-SA3WJJF2.js.map → chunk-BGLDKAYY.js.map} +0 -0
  180. /package/dist/{chunk-OPRP6Q4Z.js.map → chunk-DKKZ6SO2.js.map} +0 -0
  181. /package/dist/{chunk-AEPYA55F.js.map → chunk-FE7MUX7M.js.map} +0 -0
  182. /package/dist/{chunk-GHR7WHZX.js.map → chunk-GORHSN5C.js.map} +0 -0
  183. /package/dist/{chunk-7TEZUUGM.js.map → chunk-HUS2XN3T.js.map} +0 -0
  184. /package/dist/{chunk-XWDZQIYU.js.map → chunk-IJAQCBGV.js.map} +0 -0
  185. /package/dist/{chunk-TJLLYV2X.js.map → chunk-IMEXE4XS.js.map} +0 -0
  186. /package/dist/{chunk-IZXTZ7BF.js.map → chunk-JYLN6KHH.js.map} +0 -0
  187. /package/dist/{chunk-HEVWWPTL.js.map → chunk-LH3KXIBJ.js.map} +0 -0
  188. /package/dist/{chunk-EH5U2YCX.js.map → chunk-M3DBB2ND.js.map} +0 -0
  189. /package/dist/{chunk-XABS455Y.js.map → chunk-NBAEGFXT.js.map} +0 -0
  190. /package/dist/{chunk-T4HH5Q3U.js.map → chunk-OJRLTZQM.js.map} +0 -0
  191. /package/dist/{chunk-7ZHGPX56.js.map → chunk-PRP3M5Y3.js.map} +0 -0
  192. /package/dist/{chunk-Y2ZD2RVG.js.map → chunk-PYTUBWAS.js.map} +0 -0
  193. /package/dist/{chunk-PH3ZWL3W.js.map → chunk-Q53RLEW7.js.map} +0 -0
  194. /package/dist/{chunk-Y6OWJ3V5.js.map → chunk-RY2XZTFN.js.map} +0 -0
  195. /package/dist/{chunk-2SHIWGY7.js.map → chunk-RY7CHVGE.js.map} +0 -0
  196. /package/dist/{chunk-7VUAG236.js.map → chunk-T3FVAHM7.js.map} +0 -0
  197. /package/dist/{chunk-2LTDWSR6.js.map → chunk-TSH56VPU.js.map} +0 -0
  198. /package/dist/{chunk-5FHE4JI7.js.map → chunk-VEUVON5I.js.map} +0 -0
  199. /package/dist/{chunk-KEWUNL7P.js.map → chunk-WET4M3R6.js.map} +0 -0
  200. /package/dist/{chunk-SLPLPGJQ.js.map → chunk-WL2S2UBB.js.map} +0 -0
  201. /package/dist/{chunk-AHZYNPLX.js.map → chunk-YVMVVE4B.js.map} +0 -0
  202. /package/dist/{chunk-5HTAJCTO.js.map → chunk-ZB3YODID.js.map} +0 -0
  203. /package/dist/{forget-4UY2EOKH.js.map → forget-DNAJ66ZD.js.map} +0 -0
@@ -16,7 +16,7 @@ import {
16
16
  import {
17
17
  ActivityStore,
18
18
  MaintenanceScheduler
19
- } from "./chunk-IZXTZ7BF.js";
19
+ } from "./chunk-JYLN6KHH.js";
20
20
  import {
21
21
  migrateFromEngram
22
22
  } from "./chunk-7HYPN2GC.js";
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  CompoundingEngine,
34
34
  defaultTierMigrationCycleBudget
35
- } from "./chunk-XWDZQIYU.js";
35
+ } from "./chunk-IJAQCBGV.js";
36
36
  import {
37
37
  SharedContextManager
38
38
  } from "./chunk-AS7YMSL6.js";
@@ -198,7 +198,7 @@ import {
198
198
  buildEntityRecallSection,
199
199
  entityRecentTranscriptLookbackHours,
200
200
  readRecentEntityTranscriptEntries
201
- } from "./chunk-Y6OWJ3V5.js";
201
+ } from "./chunk-RY2XZTFN.js";
202
202
  import {
203
203
  buildEventOrderRecallSection,
204
204
  shouldRecallEventOrderEvidence
@@ -214,7 +214,7 @@ import {
214
214
  ensureBuiltInWearableConnectors,
215
215
  getWearableConnector,
216
216
  listWearableConnectors
217
- } from "./chunk-HEVWWPTL.js";
217
+ } from "./chunk-LH3KXIBJ.js";
218
218
  import {
219
219
  normalizeReplaySessionKey
220
220
  } from "./chunk-AJVLDJU6.js";
@@ -224,14 +224,14 @@ import {
224
224
  import {
225
225
  compareVerifiedEpisodeResults,
226
226
  searchVerifiedEpisodes
227
- } from "./chunk-EO7X2LDK.js";
227
+ } from "./chunk-4TAD3B56.js";
228
228
  import {
229
229
  ThreadingManager
230
230
  } from "./chunk-OJP3N7UK.js";
231
231
  import {
232
232
  compareVerifiedSemanticRuleResults,
233
233
  searchVerifiedSemanticRules
234
- } from "./chunk-7ZHGPX56.js";
234
+ } from "./chunk-PRP3M5Y3.js";
235
235
  import {
236
236
  searchWorkProductLedgerEntries
237
237
  } from "./chunk-ZRWB5D4H.js";
@@ -244,11 +244,11 @@ import {
244
244
  import {
245
245
  runNamespaceMaintenanceFanout,
246
246
  summarizeNamespaceMaintenanceHealth
247
- } from "./chunk-TJLLYV2X.js";
247
+ } from "./chunk-IMEXE4XS.js";
248
248
  import {
249
249
  NamespaceCatalog,
250
250
  planNamespaceMaintenance
251
- } from "./chunk-TCIWHK3N.js";
251
+ } from "./chunk-6D5D5A4M.js";
252
252
  import {
253
253
  isAboveImportanceThreshold,
254
254
  scoreImportance
@@ -283,7 +283,7 @@ import {
283
283
  materializeAfterSemanticConsolidation,
284
284
  parseConsolidationResponse,
285
285
  parseOperatorAwareConsolidationResponse
286
- } from "./chunk-AEPYA55F.js";
286
+ } from "./chunk-FE7MUX7M.js";
287
287
  import {
288
288
  buildBehaviorSignalsForMemory,
289
289
  dedupeBehaviorSignalsByMemoryAndHash
@@ -322,7 +322,7 @@ import {
322
322
  } from "./chunk-LBJBNWS2.js";
323
323
  import {
324
324
  MeetingsInputError
325
- } from "./chunk-SLPLPGJQ.js";
325
+ } from "./chunk-WL2S2UBB.js";
326
326
  import {
327
327
  WearablesInputError,
328
328
  describeErrorForOperator
@@ -340,10 +340,10 @@ import {
340
340
  capturePassiveCorrections,
341
341
  clusterByKey,
342
342
  detectPassiveCorrections
343
- } from "./chunk-5HTAJCTO.js";
343
+ } from "./chunk-ZB3YODID.js";
344
344
  import {
345
345
  importCapsule
346
- } from "./chunk-65ZPVYTA.js";
346
+ } from "./chunk-3CE77VAP.js";
347
347
  import {
348
348
  isCodingGraphInstalled
349
349
  } from "./chunk-VQ7B2Q6M.js";
@@ -385,7 +385,7 @@ import {
385
385
  } from "./chunk-QDW3E4RD.js";
386
386
  import {
387
387
  shouldSkipImplicitExtraction
388
- } from "./chunk-PH3ZWL3W.js";
388
+ } from "./chunk-Q53RLEW7.js";
389
389
  import {
390
390
  NamespaceSearchRouter,
391
391
  namespaceCollectionName
@@ -399,7 +399,7 @@ import {
399
399
  } from "./chunk-CYEPCZN5.js";
400
400
  import {
401
401
  NamespaceStorageRouter
402
- } from "./chunk-Y2ZD2RVG.js";
402
+ } from "./chunk-PYTUBWAS.js";
403
403
  import {
404
404
  writeConversationChunks
405
405
  } from "./chunk-72A4L5JJ.js";
@@ -462,7 +462,7 @@ import {
462
462
  } from "./chunk-NRV4Y3PM.js";
463
463
  import {
464
464
  buildChainFollowupGenerator
465
- } from "./chunk-BIXWNHIL.js";
465
+ } from "./chunk-6TF4M2LB.js";
466
466
  import {
467
467
  QmdResultResolver,
468
468
  StorageManager,
@@ -481,7 +481,7 @@ import {
481
481
  reconstructFusionInputs,
482
482
  selfDeps,
483
483
  serializeFusionDay
484
- } from "./chunk-4TGZCYHH.js";
484
+ } from "./chunk-Q3CVY7LV.js";
485
485
  import {
486
486
  bodyIsEscaped,
487
487
  decodeTranscriptBody,
@@ -494,17 +494,7 @@ import {
494
494
  } from "./chunk-UHVXE24Y.js";
495
495
  import {
496
496
  buildRetiredFactTombstoneInputs
497
- } from "./chunk-QNWXCJ76.js";
498
- import {
499
- applyTemporalSupersession,
500
- normalizeSupersessionKey,
501
- shouldFilterSupersededFromRecall,
502
- supersessionKeysForFact
503
- } from "./chunk-DNHVPZOD.js";
504
- import {
505
- isValidAsOf,
506
- isValidityExpiredNow
507
- } from "./chunk-6CIAGZ6X.js";
497
+ } from "./chunk-ENTCVTQR.js";
508
498
  import {
509
499
  attachCitation,
510
500
  hasCitationForTemplate,
@@ -531,7 +521,7 @@ import {
531
521
  } from "./chunk-DM2T26WE.js";
532
522
  import {
533
523
  ContentHashIndex
534
- } from "./chunk-FBUE6PD3.js";
524
+ } from "./chunk-BEQOZOYZ.js";
535
525
  import {
536
526
  TAG_LIMITS,
537
527
  composeMemoryEnvelope,
@@ -552,6 +542,26 @@ import {
552
542
  import {
553
543
  bumpMemoryCorpusVersionForDir
554
544
  } from "./chunk-IJ7HK452.js";
545
+ import {
546
+ HistoricalEntityCanonicalIdCache,
547
+ canonicalizeEntityRefFrontmatter,
548
+ classifyEntityRefWritePath,
549
+ readEntityRefFromFrontmatter,
550
+ repairContentAfterJournalMove,
551
+ repairContentAfterJournalMoveSync,
552
+ requestEntityCanonicalIdReconcile,
553
+ requestEntityCanonicalIdReconcileSync
554
+ } from "./chunk-4J7G5SY4.js";
555
+ import {
556
+ applyTemporalSupersession,
557
+ normalizeSupersessionKey,
558
+ shouldFilterSupersededFromRecall,
559
+ supersessionKeysForFact
560
+ } from "./chunk-DNHVPZOD.js";
561
+ import {
562
+ isValidAsOf,
563
+ isValidityExpiredNow
564
+ } from "./chunk-6CIAGZ6X.js";
555
565
  import {
556
566
  buildQmdRecallCacheKey,
557
567
  getCachedQmdRecall,
@@ -19092,6 +19102,7 @@ function emptyManifest() {
19092
19102
  import fsp4 from "fs/promises";
19093
19103
  import path20 from "path";
19094
19104
  import crypto3 from "crypto";
19105
+ var historicalIdCache = new HistoricalEntityCanonicalIdCache();
19095
19106
  function isRecallCorpusMarkdown(mdPath, memoryDir) {
19096
19107
  const rel = path20.relative(memoryDir, mdPath);
19097
19108
  if (rel.startsWith("..") || path20.isAbsolute(rel)) return false;
@@ -19290,7 +19301,34 @@ async function stageRedirect(memoryDir, assets, log2, dryRun, readMarkdownFile,
19290
19301
  let writeFailCount = 0;
19291
19302
  for (const update of updates) {
19292
19303
  try {
19293
- await writeMarkdownFile(update.mdPath, update.content);
19304
+ const stateDir = path20.join(memoryDir, "state");
19305
+ const kind = classifyEntityRefWritePath(memoryDir, update.mdPath);
19306
+ if (kind === "memory") {
19307
+ const idsAtWrite = historicalIdCache.get(stateDir);
19308
+ const written = canonicalizeEntityRefFrontmatter(update.content, idsAtWrite);
19309
+ const originalBytes = await readMarkdownFile(update.mdPath).catch(() => null);
19310
+ await writeMarkdownFile(update.mdPath, written);
19311
+ try {
19312
+ await repairContentAfterJournalMove({
19313
+ stateDir,
19314
+ cache: historicalIdCache,
19315
+ idsAtWrite,
19316
+ rawContent: update.content,
19317
+ lastWritten: written,
19318
+ rewrite: (next) => writeMarkdownFile(update.mdPath, next)
19319
+ });
19320
+ } catch (err) {
19321
+ if (originalBytes !== null) {
19322
+ await writeMarkdownFile(update.mdPath, originalBytes).catch(() => void 0);
19323
+ }
19324
+ throw err;
19325
+ }
19326
+ } else {
19327
+ await writeMarkdownFile(update.mdPath, update.content);
19328
+ if (kind === "entity") {
19329
+ await requestEntityCanonicalIdReconcile(stateDir);
19330
+ }
19331
+ }
19294
19332
  if (isRecallCorpusMarkdown(update.mdPath, memoryDir)) {
19295
19333
  bumpMemoryCorpusVersionForDir(memoryDir);
19296
19334
  }
@@ -20512,6 +20550,7 @@ function loadExistingMemories(memoryDir) {
20512
20550
  }
20513
20551
  return result;
20514
20552
  }
20553
+ var historicalIdCache2 = new HistoricalEntityCanonicalIdCache();
20515
20554
  function writeStatement(stmt, memoryDir) {
20516
20555
  const now = /* @__PURE__ */ new Date();
20517
20556
  const dateDir = now.toISOString().split("T")[0];
@@ -20520,7 +20559,8 @@ function writeStatement(stmt, memoryDir) {
20520
20559
  fs3.mkdirSync(dir, { recursive: true });
20521
20560
  const fileName = `${stmt.category}-${Date.now()}-${stmt.id.slice(0, 8)}.md`;
20522
20561
  const filePath = path23.join(dir, fileName);
20523
- const frontmatter = [
20562
+ const historicalIds = historicalIdCache2.get(path23.join(memoryDir, "state"));
20563
+ const rawBody = `${[
20524
20564
  "---",
20525
20565
  `id: ${stmt.id}`,
20526
20566
  `category: ${stmt.category}`,
@@ -20534,12 +20574,28 @@ function writeStatement(stmt, memoryDir) {
20534
20574
  `provenanceFile: ${stmt.provenance.relativePath}`,
20535
20575
  `provenanceHash: ${stmt.provenance.sourceFileHash}`,
20536
20576
  "---"
20537
- ].filter(Boolean).join("\n");
20538
- const body = `${frontmatter}
20577
+ ].filter(Boolean).join("\n")}
20539
20578
 
20540
20579
  ${stmt.content}
20541
20580
  `;
20581
+ const body = canonicalizeEntityRefFrontmatter(rawBody, historicalIds);
20542
20582
  fs3.writeFileSync(filePath, body);
20583
+ try {
20584
+ repairContentAfterJournalMoveSync({
20585
+ stateDir: path23.join(memoryDir, "state"),
20586
+ cache: historicalIdCache2,
20587
+ idsAtWrite: historicalIds,
20588
+ rawContent: rawBody,
20589
+ lastWritten: body,
20590
+ rewrite: (next) => fs3.writeFileSync(filePath, next)
20591
+ });
20592
+ } catch (err) {
20593
+ try {
20594
+ fs3.unlinkSync(filePath);
20595
+ } catch {
20596
+ }
20597
+ throw err;
20598
+ }
20543
20599
  bumpMemoryCorpusVersionForDir(memoryDir);
20544
20600
  return filePath;
20545
20601
  }
@@ -20828,6 +20884,39 @@ function walkMdFiles(dir, memoryRootReal, categoryRootReal, callback) {
20828
20884
  // src/review/index.ts
20829
20885
  import fs5 from "fs";
20830
20886
  import path25 from "path";
20887
+ var historicalIdCache3 = new HistoricalEntityCanonicalIdCache();
20888
+ function writeReviewFileCanonicalized(memoryDir, filePath, content) {
20889
+ const stateDir = path25.join(memoryDir, "state");
20890
+ const idsAtWrite = historicalIdCache3.get(stateDir);
20891
+ let originalBytes = null;
20892
+ try {
20893
+ originalBytes = fs5.readFileSync(filePath, "utf8");
20894
+ } catch {
20895
+ originalBytes = null;
20896
+ }
20897
+ const written = canonicalizeEntityRefFrontmatter(content, idsAtWrite);
20898
+ fs5.writeFileSync(filePath, written, "utf8");
20899
+ try {
20900
+ repairContentAfterJournalMoveSync({
20901
+ stateDir,
20902
+ cache: historicalIdCache3,
20903
+ idsAtWrite,
20904
+ rawContent: content,
20905
+ lastWritten: written,
20906
+ rewrite: (next) => fs5.writeFileSync(filePath, next, "utf8")
20907
+ });
20908
+ } catch (err) {
20909
+ try {
20910
+ if (originalBytes === null) {
20911
+ fs5.unlinkSync(filePath);
20912
+ } else {
20913
+ fs5.writeFileSync(filePath, originalBytes, "utf8");
20914
+ }
20915
+ } catch {
20916
+ }
20917
+ throw err;
20918
+ }
20919
+ }
20831
20920
  var DEFAULT_CONFIDENCE_THRESHOLD = 0.7;
20832
20921
  function realMemoryRoot(memoryDir) {
20833
20922
  try {
@@ -20976,7 +21065,8 @@ function approveItem(memoryDir, itemId, options) {
20976
21065
  const fm = parseFrontmatter4(content);
20977
21066
  if (!fm) return { itemId, action: "approve", message: "Could not parse frontmatter" };
20978
21067
  const blockedBy = typeof fm.blockedBy === "string" ? fm.blockedBy : null;
20979
- if (blockedBy && options.onApproveBlockedMemory) {
21068
+ const fireBlockedRevocation = () => {
21069
+ if (!blockedBy || !options.onApproveBlockedMemory) return;
20980
21070
  try {
20981
21071
  const maybe = options.onApproveBlockedMemory(blockedBy, itemId);
20982
21072
  if (maybe && typeof maybe.then === "function") {
@@ -20984,7 +21074,7 @@ function approveItem(memoryDir, itemId, options) {
20984
21074
  }
20985
21075
  } catch {
20986
21076
  }
20987
- }
21077
+ };
20988
21078
  const updatedContent = updateFrontmatterFields(content, {
20989
21079
  confidence: "0.9",
20990
21080
  confidenceTier: "high",
@@ -20996,7 +21086,8 @@ function approveItem(memoryDir, itemId, options) {
20996
21086
  ...blockedBy ? { blockedBy: null, tombstoneBlockTier: null, status: "active" } : {}
20997
21087
  });
20998
21088
  if (found.location === "category") {
20999
- fs5.writeFileSync(found.filePath, updatedContent, "utf8");
21089
+ writeReviewFileCanonicalized(memoryDir, found.filePath, updatedContent);
21090
+ fireBlockedRevocation();
21000
21091
  return {
21001
21092
  itemId,
21002
21093
  action: "approve",
@@ -21011,8 +21102,28 @@ function approveItem(memoryDir, itemId, options) {
21011
21102
  ensureSafeDirectory(rootReal, targetDir);
21012
21103
  const outputPath = path25.join(targetDir, dateDir, path25.basename(found.filePath));
21013
21104
  ensureSafeDirectory(rootReal, path25.dirname(outputPath));
21014
- const promotedPath = writeFileWithoutClobber(outputPath, updatedContent, itemId);
21105
+ const reviewStateDir = path25.join(memoryDir, "state");
21106
+ const idsAtWrite = historicalIdCache3.get(reviewStateDir);
21107
+ const promotedWritten = canonicalizeEntityRefFrontmatter(updatedContent, idsAtWrite);
21108
+ const promotedPath = writeFileWithoutClobber(outputPath, promotedWritten, itemId);
21109
+ try {
21110
+ repairContentAfterJournalMoveSync({
21111
+ stateDir: reviewStateDir,
21112
+ cache: historicalIdCache3,
21113
+ idsAtWrite,
21114
+ rawContent: updatedContent,
21115
+ lastWritten: promotedWritten,
21116
+ rewrite: (next) => fs5.writeFileSync(promotedPath, next, "utf8")
21117
+ });
21118
+ } catch (err) {
21119
+ try {
21120
+ fs5.unlinkSync(promotedPath);
21121
+ } catch {
21122
+ }
21123
+ throw err;
21124
+ }
21015
21125
  fs5.unlinkSync(found.filePath);
21126
+ fireBlockedRevocation();
21016
21127
  return {
21017
21128
  itemId,
21018
21129
  action: "approve",
@@ -21031,13 +21142,13 @@ function dismissItem(memoryDir, itemId, options) {
21031
21142
  return { itemId, action: "dismiss", message: "Dismissed and removed" };
21032
21143
  }
21033
21144
  const content = fs5.readFileSync(found.filePath, "utf8");
21034
- fs5.writeFileSync(
21145
+ writeReviewFileCanonicalized(
21146
+ memoryDir,
21035
21147
  found.filePath,
21036
21148
  updateFrontmatterFields(content, {
21037
21149
  reviewDismissed: "true",
21038
21150
  reviewDismissedAt: (/* @__PURE__ */ new Date()).toISOString()
21039
- }),
21040
- "utf8"
21151
+ })
21041
21152
  );
21042
21153
  return {
21043
21154
  itemId,
@@ -21056,7 +21167,7 @@ function flagItem(memoryDir, itemId, options) {
21056
21167
  flagged: "true",
21057
21168
  flaggedAt: (/* @__PURE__ */ new Date()).toISOString()
21058
21169
  });
21059
- fs5.writeFileSync(found.filePath, fixed);
21170
+ writeReviewFileCanonicalized(memoryDir, found.filePath, fixed);
21060
21171
  return {
21061
21172
  itemId,
21062
21173
  action: "flag",
@@ -21426,6 +21537,7 @@ import { spawnSync } from "child_process";
21426
21537
  import crypto7 from "crypto";
21427
21538
  import fs7 from "fs";
21428
21539
  import path27 from "path";
21540
+ var historicalIdCache4 = new HistoricalEntityCanonicalIdCache();
21429
21541
  var MANIFEST_VERSION = 1;
21430
21542
  var MANIFEST_LOCK_STALE_MS = 3e4;
21431
21543
  var MANIFEST_LOCK_TIMEOUT_MS = MANIFEST_LOCK_STALE_MS + 1e4;
@@ -21999,6 +22111,17 @@ function copyMemories(sourceDir, targetDir, options) {
21999
22111
  fs7.mkdirSync(targetDir, { recursive: true });
22000
22112
  const targetRoot = fs7.realpathSync(targetDir);
22001
22113
  const sourceFiles = walkMd2(sourceRoot);
22114
+ const sourceEntityIds = new Set(
22115
+ sourceFiles.filter((p) => {
22116
+ const rp = safeRealpath(p);
22117
+ if (!rp || !isPathInsideRoot(rp, sourceRoot)) return false;
22118
+ const rel = path27.relative(sourceRoot, rp);
22119
+ const mapped = path27.resolve(targetRoot, rel);
22120
+ if (!isPathInsideRoot(mapped, targetRoot)) return false;
22121
+ return classifyEntityRefWritePath(targetRoot, mapped) === "entity";
22122
+ }).map((p) => path27.basename(p, ".md"))
22123
+ );
22124
+ let reconcileNeeded = false;
22002
22125
  for (const sourcePath of sourceFiles) {
22003
22126
  const sourceRealPath = safeRealpath(sourcePath);
22004
22127
  if (!sourceRealPath || !isPathInsideRoot(sourceRealPath, sourceRoot)) {
@@ -22017,6 +22140,11 @@ function copyMemories(sourceDir, targetDir, options) {
22017
22140
  skipped++;
22018
22141
  continue;
22019
22142
  }
22143
+ const targetKind = classifyEntityRefWritePath(targetRoot, targetPath);
22144
+ const idsAtCompare = historicalIdCache4.get(path27.join(targetRoot, "state"));
22145
+ const sourceRef = targetKind === "memory" ? readEntityRefFromFrontmatter(content) : null;
22146
+ const refHasSourceClaimant = sourceRef !== null && sourceEntityIds.has(sourceRef);
22147
+ const canonicalContent = targetKind === "memory" && !refHasSourceClaimant ? canonicalizeEntityRefFrontmatter(content, idsAtCompare) : content;
22020
22148
  const sourceHash = hashContent4(content);
22021
22149
  if (options?.filterIds?.length) {
22022
22150
  const fm = parseSimpleFrontmatter(content);
@@ -22040,7 +22168,11 @@ function copyMemories(sourceDir, targetDir, options) {
22040
22168
  if (fs7.existsSync(targetPath) && !options?.force) {
22041
22169
  const targetContent = fs7.readFileSync(targetPath, "utf8");
22042
22170
  const targetHash = hashContent4(targetContent);
22043
- if (sourceHash !== targetHash) {
22171
+ if (hashContent4(canonicalContent) === targetHash && historicalIdCache4.get(path27.join(targetRoot, "state")) === idsAtCompare) {
22172
+ skipped++;
22173
+ continue;
22174
+ }
22175
+ if (hashContent4(canonicalContent) !== targetHash && sourceHash !== targetHash) {
22044
22176
  conflicts.push({
22045
22177
  memoryId: parseSimpleFrontmatter(content)?.id ?? relativePath,
22046
22178
  sourcePath,
@@ -22051,8 +22183,6 @@ function copyMemories(sourceDir, targetDir, options) {
22051
22183
  });
22052
22184
  continue;
22053
22185
  }
22054
- skipped++;
22055
- continue;
22056
22186
  }
22057
22187
  fs7.mkdirSync(path27.dirname(targetPath), { recursive: true });
22058
22188
  const targetParentRealPath = safeRealpath(path27.dirname(targetPath));
@@ -22060,10 +22190,52 @@ function copyMemories(sourceDir, targetDir, options) {
22060
22190
  skipped++;
22061
22191
  continue;
22062
22192
  }
22063
- fs7.writeFileSync(targetPath, content);
22193
+ const stateDir = path27.join(targetRoot, "state");
22194
+ if (targetKind === "memory" && !refHasSourceClaimant) {
22195
+ const idsAtWrite = historicalIdCache4.get(stateDir);
22196
+ const written = canonicalizeEntityRefFrontmatter(content, idsAtWrite);
22197
+ let priorTarget = null;
22198
+ try {
22199
+ priorTarget = fs7.readFileSync(targetPath, "utf8");
22200
+ } catch {
22201
+ priorTarget = null;
22202
+ }
22203
+ fs7.writeFileSync(targetPath, written);
22204
+ try {
22205
+ repairContentAfterJournalMoveSync({
22206
+ stateDir,
22207
+ cache: historicalIdCache4,
22208
+ idsAtWrite,
22209
+ rawContent: content,
22210
+ lastWritten: written,
22211
+ rewrite: (next) => fs7.writeFileSync(targetPath, next)
22212
+ });
22213
+ } catch (err) {
22214
+ try {
22215
+ if (priorTarget === null) {
22216
+ fs7.unlinkSync(targetPath);
22217
+ } else {
22218
+ fs7.writeFileSync(targetPath, priorTarget);
22219
+ }
22220
+ } catch {
22221
+ }
22222
+ throw err;
22223
+ }
22224
+ } else if (targetKind === "memory") {
22225
+ fs7.writeFileSync(targetPath, content);
22226
+ reconcileNeeded = true;
22227
+ } else {
22228
+ fs7.writeFileSync(targetPath, content);
22229
+ if (targetKind === "entity") {
22230
+ reconcileNeeded = true;
22231
+ }
22232
+ }
22064
22233
  merged++;
22065
22234
  bumpMemoryCorpusVersionForDir(targetRoot);
22066
22235
  }
22236
+ if (reconcileNeeded) {
22237
+ requestEntityCanonicalIdReconcileSync(path27.join(targetRoot, "state"));
22238
+ }
22067
22239
  return { merged, conflicts, skipped };
22068
22240
  }
22069
22241
  function hashContent4(content) {
@@ -23751,4 +23923,4 @@ export {
23751
23923
  filterRecallCandidates,
23752
23924
  Orchestrator
23753
23925
  };
23754
- //# sourceMappingURL=chunk-FHYGLITW.js.map
23926
+ //# sourceMappingURL=chunk-AKELMJO2.js.map