@remnic/core 9.44.0 → 9.45.0

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 (187) hide show
  1. package/dist/access-admin-ops-surface.d.ts +5 -5
  2. package/dist/access-admin-ops-surface.js +14 -13
  3. package/dist/access-authorization-probe.d.ts +5 -5
  4. package/dist/access-authorization-probe.js +15 -14
  5. package/dist/access-boundary.d.ts +5 -5
  6. package/dist/access-boundary.js +14 -13
  7. package/dist/access-cli.js +37 -36
  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 +14 -13
  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-query.js +14 -13
  14. package/dist/access-http.d.ts +5 -5
  15. package/dist/access-http.js +21 -20
  16. package/dist/access-identity-continuity-surface.d.ts +4 -4
  17. package/dist/access-identity-continuity-surface.js +14 -13
  18. package/dist/access-lcm-surface.d.ts +5 -5
  19. package/dist/access-lcm-surface.js +14 -13
  20. package/dist/access-mcp.d.ts +5 -5
  21. package/dist/access-mcp.js +19 -18
  22. package/dist/access-namespace-preflight.js +14 -13
  23. package/dist/access-observe-write-surface.d.ts +5 -5
  24. package/dist/access-observe-write-surface.js +14 -13
  25. package/dist/access-operations-batch.js +16 -15
  26. package/dist/access-operations.d.ts +8 -8
  27. package/dist/access-operations.js +18 -17
  28. package/dist/access-recall-concurrency.d.ts +5 -5
  29. package/dist/access-recall-concurrency.js +14 -13
  30. package/dist/access-recall-response.d.ts +5 -5
  31. package/dist/access-recall-response.js +14 -13
  32. package/dist/access-recall-surface.d.ts +5 -5
  33. package/dist/access-recall-surface.js +14 -13
  34. package/dist/access-schema.d.ts +84 -84
  35. package/dist/access-schema.js +3 -3
  36. package/dist/{access-service-BCZJbX0f.d.ts → access-service-DBo88Dmm.d.ts} +3 -3
  37. package/dist/access-service-helpers.d.ts +5 -5
  38. package/dist/access-service.d.ts +5 -5
  39. package/dist/access-service.js +14 -13
  40. package/dist/access-surface-catalog.d.ts +5 -5
  41. package/dist/access-wearables-meetings-surface.d.ts +2 -2
  42. package/dist/bootstrap.d.ts +4 -4
  43. package/dist/briefing.d.ts +1 -1
  44. package/dist/briefing.js +4 -3
  45. package/dist/buffer.d.ts +1 -1
  46. package/dist/causal-consolidation.js +5 -4
  47. package/dist/causal-consolidation.js.map +1 -1
  48. package/dist/{chunk-OHLNFI6Z.js → chunk-3HKQOFOV.js} +7 -5
  49. package/dist/{chunk-OHLNFI6Z.js.map → chunk-3HKQOFOV.js.map} +1 -1
  50. package/dist/{chunk-PJUHQC4T.js → chunk-3HLCRYBV.js} +3 -3
  51. package/dist/{chunk-N7LPS4Z3.js → chunk-5SM35XZR.js} +2 -2
  52. package/dist/{chunk-E6JYVPBK.js → chunk-5YGO5VEH.js} +2 -2
  53. package/dist/{chunk-EUVPB5TA.js → chunk-65V4K4MT.js} +8 -8
  54. package/dist/{chunk-WX6KOVVK.js → chunk-6OLQJJYE.js} +2 -2
  55. package/dist/chunk-6UWB5PTR.js +413 -0
  56. package/dist/chunk-6UWB5PTR.js.map +1 -0
  57. package/dist/{chunk-G24HJJ67.js → chunk-7JO6RVBI.js} +6 -6
  58. package/dist/{chunk-WUDWRUGK.js → chunk-7PVFOFPJ.js} +2 -2
  59. package/dist/{chunk-UUQLB2HJ.js → chunk-C7EI7CA6.js} +2 -2
  60. package/dist/{chunk-MUKLQDJP.js → chunk-FLBPATMZ.js} +18 -18
  61. package/dist/{chunk-HGFILS2Q.js → chunk-FVGQ5LIS.js} +2 -2
  62. package/dist/{chunk-OPVOUBHT.js → chunk-G24XIK6H.js} +2 -2
  63. package/dist/{chunk-CH2WTP6R.js → chunk-GBJJUPNV.js} +2 -2
  64. package/dist/{chunk-HXTUA7QM.js → chunk-GOPWZYZH.js} +6 -6
  65. package/dist/{chunk-WMHO3WLC.js → chunk-GQBZ7EVF.js} +2 -2
  66. package/dist/{chunk-KQAFEZQX.js → chunk-IPLYGWQF.js} +5 -5
  67. package/dist/{chunk-OZL7KB6B.js → chunk-J4OKD6QX.js} +2 -2
  68. package/dist/{chunk-TRBIJS2T.js → chunk-JZ7SSAQ5.js} +3 -3
  69. package/dist/{chunk-YUOKZ3LJ.js → chunk-K6OTW3TP.js} +2 -2
  70. package/dist/{chunk-I22U5YYD.js → chunk-QQ3NDJOM.js} +2 -2
  71. package/dist/{chunk-2FTRRQKZ.js → chunk-RVLJEII5.js} +30 -511
  72. package/dist/chunk-RVLJEII5.js.map +1 -0
  73. package/dist/chunk-S5SLVSVY.js +517 -0
  74. package/dist/chunk-S5SLVSVY.js.map +1 -0
  75. package/dist/{chunk-7PLHD7EO.js → chunk-SS7YWVPF.js} +2 -2
  76. package/dist/{chunk-J43XN7N3.js → chunk-U5G66ORD.js} +18 -18
  77. package/dist/{chunk-EMC5GT4H.js → chunk-VCGPO2VD.js} +4 -4
  78. package/dist/{chunk-JDDTNK5P.js → chunk-VRYJSKOM.js} +2 -2
  79. package/dist/{chunk-PLQCPMJA.js → chunk-WC4SPYHX.js} +7 -7
  80. package/dist/{chunk-IADUAH35.js → chunk-WG2PI44B.js} +2 -2
  81. package/dist/{chunk-35IC3EVP.js → chunk-XFQRFWVS.js} +2 -2
  82. package/dist/{chunk-MYFFOPO2.js → chunk-XMZV27S5.js} +2 -2
  83. package/dist/{chunk-IXFI6E3Q.js → chunk-YQQK7W7T.js} +2 -2
  84. package/dist/{chunk-3F2LKUMU.js → chunk-ZAB5PG65.js} +2 -2
  85. package/dist/{chunk-O4BADU6R.js → chunk-ZPJJE7MF.js} +2 -2
  86. package/dist/{chunk-U5SX74DV.js → chunk-ZS5UZU5M.js} +3 -3
  87. package/dist/{cli-U30A3jyx.d.ts → cli-DQ4VhjqX.d.ts} +3 -3
  88. package/dist/cli.d.ts +6 -6
  89. package/dist/cli.js +31 -30
  90. package/dist/compounding/engine.d.ts +1 -1
  91. package/dist/compounding/engine.js +4 -3
  92. package/dist/connectors/codex-materialize-runner.js +4 -3
  93. package/dist/connectors/index.js +4 -3
  94. package/dist/consolidation-provenance-check.d.ts +1 -1
  95. package/dist/consolidation-undo.d.ts +1 -1
  96. package/dist/contradiction/index.d.ts +1 -1
  97. package/dist/convergence-refresh.d.ts +1 -1
  98. package/dist/convergence-refresh.js +6 -5
  99. package/dist/corpus-watermark.js +6 -5
  100. package/dist/entity-retrieval.d.ts +1 -1
  101. package/dist/entity-retrieval.js +4 -3
  102. package/dist/explicit-capture.d.ts +4 -4
  103. package/dist/explicit-capture.js +3 -2
  104. package/dist/extraction.js +4 -3
  105. package/dist/index.d.ts +398 -398
  106. package/dist/index.js +37 -36
  107. package/dist/maintenance/memory-governance.js +4 -3
  108. package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +1 -1
  109. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -3
  110. package/dist/maintenance/rebuild-memory-projection.d.ts +1 -1
  111. package/dist/maintenance/rebuild-memory-projection.js +5 -4
  112. package/dist/{maintenance-DVBLXkFw.d.ts → maintenance-_RV38GlE.d.ts} +1 -1
  113. package/dist/mcp-memory-inspector-app.d.ts +5 -5
  114. package/dist/memory-worth-outcomes.d.ts +1 -1
  115. package/dist/namespaces/migrate.d.ts +1 -1
  116. package/dist/namespaces/migrate.js +5 -4
  117. package/dist/namespaces/storage.d.ts +1 -1
  118. package/dist/namespaces/storage.js +4 -3
  119. package/dist/operator-doctor-corpus.js +7 -6
  120. package/dist/operator-toolkit.d.ts +1 -1
  121. package/dist/operator-toolkit.js +11 -10
  122. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  123. package/dist/orchestration/maintenance.d.ts +2 -2
  124. package/dist/orchestration/maintenance.js +9 -8
  125. package/dist/{orchestrator-DUxbhhqO.d.ts → orchestrator-B2ecFpRO.d.ts} +3 -3
  126. package/dist/orchestrator.d.ts +4 -4
  127. package/dist/orchestrator.js +37 -36
  128. package/dist/reconcile/manifest.d.ts +33 -0
  129. package/dist/reconcile/manifest.js +248 -0
  130. package/dist/reconcile/manifest.js.map +1 -0
  131. package/dist/reconcile/plan.d.ts +1 -1
  132. package/dist/reconcile/plan.js +8 -404
  133. package/dist/reconcile/plan.js.map +1 -1
  134. package/dist/schemas.d.ts +76 -76
  135. package/dist/semantic-consolidation.js +5 -4
  136. package/dist/semantic-rule-promotion.js +4 -3
  137. package/dist/semantic-rule-verifier.js +4 -3
  138. package/dist/{service-CLuMO-pa.d.ts → service-DW06sY3P.d.ts} +1 -1
  139. package/dist/shared-context/manager.d.ts +8 -8
  140. package/dist/source-agent-qualifier.js +4 -3
  141. package/dist/{storage-Blr71GpS.d.ts → storage-qRIQPA6F.d.ts} +12 -0
  142. package/dist/storage.d.ts +1 -1
  143. package/dist/storage.js +3 -2
  144. package/dist/temporal-supersession.d.ts +1 -1
  145. package/dist/tier-migration.d.ts +1 -1
  146. package/dist/transfer/autodetect.js +1 -1
  147. package/dist/transfer/backup.js +1 -1
  148. package/dist/transfer/capsule-export.js +2 -2
  149. package/dist/transfer/types.d.ts +66 -66
  150. package/dist/verified-recall.js +4 -3
  151. package/package.json +12 -2
  152. package/src/reconcile/manifest.test.ts +261 -0
  153. package/src/reconcile/manifest.ts +278 -0
  154. package/src/reconcile/plan.ts +1 -0
  155. package/src/storage/content-hash-index.ts +26 -0
  156. package/dist/chunk-2FTRRQKZ.js.map +0 -1
  157. /package/dist/{chunk-PJUHQC4T.js.map → chunk-3HLCRYBV.js.map} +0 -0
  158. /package/dist/{chunk-N7LPS4Z3.js.map → chunk-5SM35XZR.js.map} +0 -0
  159. /package/dist/{chunk-E6JYVPBK.js.map → chunk-5YGO5VEH.js.map} +0 -0
  160. /package/dist/{chunk-EUVPB5TA.js.map → chunk-65V4K4MT.js.map} +0 -0
  161. /package/dist/{chunk-WX6KOVVK.js.map → chunk-6OLQJJYE.js.map} +0 -0
  162. /package/dist/{chunk-G24HJJ67.js.map → chunk-7JO6RVBI.js.map} +0 -0
  163. /package/dist/{chunk-WUDWRUGK.js.map → chunk-7PVFOFPJ.js.map} +0 -0
  164. /package/dist/{chunk-UUQLB2HJ.js.map → chunk-C7EI7CA6.js.map} +0 -0
  165. /package/dist/{chunk-MUKLQDJP.js.map → chunk-FLBPATMZ.js.map} +0 -0
  166. /package/dist/{chunk-HGFILS2Q.js.map → chunk-FVGQ5LIS.js.map} +0 -0
  167. /package/dist/{chunk-OPVOUBHT.js.map → chunk-G24XIK6H.js.map} +0 -0
  168. /package/dist/{chunk-CH2WTP6R.js.map → chunk-GBJJUPNV.js.map} +0 -0
  169. /package/dist/{chunk-HXTUA7QM.js.map → chunk-GOPWZYZH.js.map} +0 -0
  170. /package/dist/{chunk-WMHO3WLC.js.map → chunk-GQBZ7EVF.js.map} +0 -0
  171. /package/dist/{chunk-KQAFEZQX.js.map → chunk-IPLYGWQF.js.map} +0 -0
  172. /package/dist/{chunk-OZL7KB6B.js.map → chunk-J4OKD6QX.js.map} +0 -0
  173. /package/dist/{chunk-TRBIJS2T.js.map → chunk-JZ7SSAQ5.js.map} +0 -0
  174. /package/dist/{chunk-YUOKZ3LJ.js.map → chunk-K6OTW3TP.js.map} +0 -0
  175. /package/dist/{chunk-I22U5YYD.js.map → chunk-QQ3NDJOM.js.map} +0 -0
  176. /package/dist/{chunk-7PLHD7EO.js.map → chunk-SS7YWVPF.js.map} +0 -0
  177. /package/dist/{chunk-J43XN7N3.js.map → chunk-U5G66ORD.js.map} +0 -0
  178. /package/dist/{chunk-EMC5GT4H.js.map → chunk-VCGPO2VD.js.map} +0 -0
  179. /package/dist/{chunk-JDDTNK5P.js.map → chunk-VRYJSKOM.js.map} +0 -0
  180. /package/dist/{chunk-PLQCPMJA.js.map → chunk-WC4SPYHX.js.map} +0 -0
  181. /package/dist/{chunk-IADUAH35.js.map → chunk-WG2PI44B.js.map} +0 -0
  182. /package/dist/{chunk-35IC3EVP.js.map → chunk-XFQRFWVS.js.map} +0 -0
  183. /package/dist/{chunk-MYFFOPO2.js.map → chunk-XMZV27S5.js.map} +0 -0
  184. /package/dist/{chunk-IXFI6E3Q.js.map → chunk-YQQK7W7T.js.map} +0 -0
  185. /package/dist/{chunk-3F2LKUMU.js.map → chunk-ZAB5PG65.js.map} +0 -0
  186. /package/dist/{chunk-O4BADU6R.js.map → chunk-ZPJJE7MF.js.map} +0 -0
  187. /package/dist/{chunk-U5SX74DV.js.map → chunk-ZS5UZU5M.js.map} +0 -0
@@ -3,12 +3,12 @@ import { BriefingFollowupGenerator } from './briefing.js';
3
3
  import { SmartBuffer } from './buffer.js';
4
4
  import { FaithfulnessGateCounters } from './extraction-faithfulness.js';
5
5
  import { SearchBackend, SearchQueryOptions, SearchExecutionOptions } from './search/port.js';
6
- import { S as StorageManager } from './storage-Blr71GpS.js';
6
+ import { S as StorageManager } from './storage-qRIQPA6F.js';
7
7
  import { TranscriptManager } from './transcript.js';
8
8
  import { HourlySummarizer } from './summarizer.js';
9
9
  import { LocalLlmClient } from './local-llm.js';
10
10
  import { FallbackLlmClient } from './fallback-llm.js';
11
- import { M as MaintenanceScheduler } from './maintenance-DVBLXkFw.js';
11
+ import { M as MaintenanceScheduler } from './maintenance-_RV38GlE.js';
12
12
  import { P as PluginConfig, M as MemoryFile, ag as MemoryActionEvent, Q as QmdSearchResult, R as RecallPlanMode, I as IdentityInjectionMode, ba as RecallSectionConfig, aN as MemoryLink, J as ExtractionResult, j as BufferTurn, b8 as CodingContext, n as SourceConnectorProvenance, ao as MemoryIntent, l as MemoryFrontmatter, r as BehaviorLoopPolicyState, bb as BootstrapOptions, bc as BootstrapResult, bd as ConsolidationObservation, N as DaySummaryResult, a8 as ImportTurn } from './types-CqWwMPr_.js';
13
13
  import { CompoundingEngine } from './compounding/engine.js';
14
14
  import { UtilityRuntimeValues } from './utility-runtime.js';
@@ -43,7 +43,7 @@ import { NegativeExampleStore } from './negative.js';
43
43
  import { SessionObserverState } from './session-observer-state.js';
44
44
  import { a as SemanticDedupHit } from './semantic-TddhF0y7.js';
45
45
  import { ReplayTurn } from './replay/types.js';
46
- import { W as WearablesService, M as MeetingsService } from './service-CLuMO-pa.js';
46
+ import { W as WearablesService, M as MeetingsService } from './service-DW06sY3P.js';
47
47
  import { LcmEngine } from './lcm/engine.js';
48
48
  import { b as NamespaceKind, N as NamespaceCatalog } from './catalog-DPQynQZG.js';
49
49
  import { NamespaceSearchHealth } from './namespaces/search.js';
@@ -3,13 +3,13 @@ import './briefing.js';
3
3
  import './buffer.js';
4
4
  import './extraction-faithfulness.js';
5
5
  import './search/port.js';
6
- import './storage-Blr71GpS.js';
6
+ import './storage-qRIQPA6F.js';
7
7
  import './transcript.js';
8
8
  import './summarizer.js';
9
9
  import './local-llm.js';
10
10
  import './fallback-llm.js';
11
- import './maintenance-DVBLXkFw.js';
12
- export { B as BulkImportBatchIngestResult, a as BulkImportBatchPartialFailureError, b as COMPACTION_SIGNAL_MAX_AGE_MS, D as DaySummaryGatherOptions, E as ExtractionRunResult, c as GraphRecallRankedResult, e as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, Q as QmdRecallSnapshot, f as QueryAwarePrefilter, R as RecallInvocationOptions, g as RecallModeDecision, h as appendMemoryToGraphContext, i as applyQueryAwareCandidateFilter, j as blendGraphExpandedRecallScore, k as buildCompressionGuidelinesMarkdown, l as buildMemoryPathById, m as computeArtifactCandidateFetchLimit, n as computeArtifactRecallLimit, o as computeQmdHybridFetchLimit, d as defaultWorkspaceDir, p as deriveTopicsFromExtraction, q as filterHourlySummaryMarkdownForLocalDay, r as filterRecallCandidates, t as formatDateInTimeZone, u as graphPathRelativeToStorage, v as hasIdentityRecoveryIntent, w as isArtifactMemoryPath, x as lifecycleRecallScoreAdjustment, y as mapRecallSourceToXrayServedBy, z as mergeArtifactRecallCandidates, A as mergeGraphExpandedResults, F as normalizeIanaTimeZone, H as parseFiniteDate, J as parseGraphRecallRankedResults, K as parseMemoryIntentSnapshot, L as parseQmdRecallResults, M as qmdStartupCollectionCheckWithTimeout, N as raceRecallAbort, S as resolveEffectiveIdentityInjectionMode, U as resolveEffectiveRecallMode, V as resolvePersistedMemoryRelativePath, W as resolveRecallModeDecision, X as resolveRecallModeDecisionAsync, Y as resolveRecentThreadMemoryPaths, s as sanitizeSessionKeyForFilename, Z as shouldFilterLifecycleRecallCandidate, _ as splitTurnsBySourceValidAt, $ as summarizeGraphShadowComparison, a0 as targetSourceValidAtSortMs, a1 as throwIfRecallAborted, a2 as tokenizeRecallQuery, a3 as utcDateKeysForLocalDay } from './orchestrator-DUxbhhqO.js';
11
+ import './maintenance-_RV38GlE.js';
12
+ export { B as BulkImportBatchIngestResult, a as BulkImportBatchPartialFailureError, b as COMPACTION_SIGNAL_MAX_AGE_MS, D as DaySummaryGatherOptions, E as ExtractionRunResult, c as GraphRecallRankedResult, e as GraphRecallShadowComparison, G as GraphRecallSnapshot, I as IntentDebugSnapshot, O as Orchestrator, Q as QmdRecallSnapshot, f as QueryAwarePrefilter, R as RecallInvocationOptions, g as RecallModeDecision, h as appendMemoryToGraphContext, i as applyQueryAwareCandidateFilter, j as blendGraphExpandedRecallScore, k as buildCompressionGuidelinesMarkdown, l as buildMemoryPathById, m as computeArtifactCandidateFetchLimit, n as computeArtifactRecallLimit, o as computeQmdHybridFetchLimit, d as defaultWorkspaceDir, p as deriveTopicsFromExtraction, q as filterHourlySummaryMarkdownForLocalDay, r as filterRecallCandidates, t as formatDateInTimeZone, u as graphPathRelativeToStorage, v as hasIdentityRecoveryIntent, w as isArtifactMemoryPath, x as lifecycleRecallScoreAdjustment, y as mapRecallSourceToXrayServedBy, z as mergeArtifactRecallCandidates, A as mergeGraphExpandedResults, F as normalizeIanaTimeZone, H as parseFiniteDate, J as parseGraphRecallRankedResults, K as parseMemoryIntentSnapshot, L as parseQmdRecallResults, M as qmdStartupCollectionCheckWithTimeout, N as raceRecallAbort, S as resolveEffectiveIdentityInjectionMode, U as resolveEffectiveRecallMode, V as resolvePersistedMemoryRelativePath, W as resolveRecallModeDecision, X as resolveRecallModeDecisionAsync, Y as resolveRecentThreadMemoryPaths, s as sanitizeSessionKeyForFilename, Z as shouldFilterLifecycleRecallCandidate, _ as splitTurnsBySourceValidAt, $ as summarizeGraphShadowComparison, a0 as targetSourceValidAtSortMs, a1 as throwIfRecallAborted, a2 as tokenizeRecallQuery, a3 as utcDateKeysForLocalDay } from './orchestrator-B2ecFpRO.js';
13
13
  export { formatCompressionGuidelinesForRecall } from './orchestration/compression-guideline-coordinator.js';
14
14
  import './live-connectors-runner.js';
15
15
  import './model-registry.js';
@@ -22,7 +22,7 @@ import './semantic-TddhF0y7.js';
22
22
  import './capabilities.js';
23
23
  import './replay/types.js';
24
24
  import './types-CqWwMPr_.js';
25
- import './service-CLuMO-pa.js';
25
+ import './service-DW06sY3P.js';
26
26
  import './lcm/engine.js';
27
27
  import './semantic-consolidation-BWxOBMtz.js';
28
28
  import './catalog-DPQynQZG.js';
@@ -4,12 +4,12 @@ import {
4
4
  filterRecallCandidates,
5
5
  graphPathRelativeToStorage,
6
6
  mergeGraphExpandedResults
7
- } from "./chunk-J43XN7N3.js";
7
+ } from "./chunk-U5G66ORD.js";
8
8
  import "./chunk-4B77XSG5.js";
9
9
  import {
10
10
  formatCompressionGuidelinesForRecall
11
11
  } from "./chunk-6LKEUCEM.js";
12
- import "./chunk-EMC5GT4H.js";
12
+ import "./chunk-VCGPO2VD.js";
13
13
  import "./chunk-I74SUMNI.js";
14
14
  import "./chunk-ILNPU5W5.js";
15
15
  import "./chunk-7HYPN2GC.js";
@@ -26,7 +26,7 @@ import "./chunk-KBL3JJR6.js";
26
26
  import "./chunk-FQ7HAWWC.js";
27
27
  import "./chunk-LTAVSOZW.js";
28
28
  import "./chunk-7N4KAIGN.js";
29
- import "./chunk-IADUAH35.js";
29
+ import "./chunk-WG2PI44B.js";
30
30
  import "./chunk-AS7YMSL6.js";
31
31
  import "./chunk-V5OCT34X.js";
32
32
  import "./chunk-TECVW3JP.js";
@@ -90,16 +90,16 @@ import "./chunk-BLDBT6HZ.js";
90
90
  import "./chunk-Q6IP2ARR.js";
91
91
  import "./chunk-6HEM6HTQ.js";
92
92
  import "./chunk-E6EE5B67.js";
93
- import "./chunk-OZL7KB6B.js";
93
+ import "./chunk-J4OKD6QX.js";
94
94
  import "./chunk-VNA7W7QF.js";
95
- import "./chunk-YUOKZ3LJ.js";
95
+ import "./chunk-K6OTW3TP.js";
96
96
  import "./chunk-RPSYDM6C.js";
97
97
  import "./chunk-VEWZZM3H.js";
98
98
  import "./chunk-3I4FUAVJ.js";
99
- import "./chunk-MUKLQDJP.js";
99
+ import "./chunk-FLBPATMZ.js";
100
+ import "./chunk-MMACM5G2.js";
100
101
  import "./chunk-54BGIBCR.js";
101
102
  import "./chunk-H4CKS5B2.js";
102
- import "./chunk-MMACM5G2.js";
103
103
  import "./chunk-FXZTL7F7.js";
104
104
  import "./chunk-UP6MOYCB.js";
105
105
  import "./chunk-BV2TIZ4F.js";
@@ -117,7 +117,7 @@ import "./chunk-AJVLDJU6.js";
117
117
  import "./chunk-EEC4PCG5.js";
118
118
  import "./chunk-PYIFUBRK.js";
119
119
  import "./chunk-MNB5RMAY.js";
120
- import "./chunk-I22U5YYD.js";
120
+ import "./chunk-QQ3NDJOM.js";
121
121
  import "./chunk-DX3XRGLH.js";
122
122
  import "./chunk-P65YJEEL.js";
123
123
  import "./chunk-MC6XO7T4.js";
@@ -126,21 +126,21 @@ import "./chunk-NOUJNHWG.js";
126
126
  import "./chunk-GQL52GQ5.js";
127
127
  import "./chunk-2F6NP3NT.js";
128
128
  import "./chunk-TERNBNJB.js";
129
- import "./chunk-HGFILS2Q.js";
129
+ import "./chunk-FVGQ5LIS.js";
130
130
  import "./chunk-OJP3N7UK.js";
131
- import "./chunk-O4BADU6R.js";
132
- import "./chunk-CH2WTP6R.js";
131
+ import "./chunk-ZPJJE7MF.js";
132
+ import "./chunk-GBJJUPNV.js";
133
133
  import "./chunk-GDC4INBF.js";
134
134
  import "./chunk-ZRWB5D4H.js";
135
135
  import "./chunk-HYQJQGD3.js";
136
136
  import "./chunk-FXGLFGIG.js";
137
137
  import "./chunk-3T74IZB3.js";
138
138
  import "./chunk-33JBK2XP.js";
139
- import "./chunk-PLQCPMJA.js";
140
- import "./chunk-WX6KOVVK.js";
139
+ import "./chunk-WC4SPYHX.js";
140
+ import "./chunk-6OLQJJYE.js";
141
141
  import "./chunk-KFY3SGN7.js";
142
142
  import "./chunk-CMTINOFS.js";
143
- import "./chunk-OPVOUBHT.js";
143
+ import "./chunk-G24XIK6H.js";
144
144
  import "./chunk-WDISJRMG.js";
145
145
  import "./chunk-HL4DB7TO.js";
146
146
  import "./chunk-UR6PBX2J.js";
@@ -150,7 +150,7 @@ import "./chunk-AV5ZEH4M.js";
150
150
  import "./chunk-OZKOPQCM.js";
151
151
  import "./chunk-3PY7VHV7.js";
152
152
  import "./chunk-C7SRUWBW.js";
153
- import "./chunk-U5SX74DV.js";
153
+ import "./chunk-ZS5UZU5M.js";
154
154
  import "./chunk-KJTKLXTH.js";
155
155
  import "./chunk-2DQ2XREU.js";
156
156
  import "./chunk-FZZ2QTJI.js";
@@ -163,7 +163,7 @@ import "./chunk-TSH56VPU.js";
163
163
  import "./chunk-LMDRGRJ2.js";
164
164
  import "./chunk-4LMA77JH.js";
165
165
  import "./chunk-ER7W6H4T.js";
166
- import "./chunk-7PLHD7EO.js";
166
+ import "./chunk-SS7YWVPF.js";
167
167
  import "./chunk-JLNBQWZ2.js";
168
168
  import "./chunk-LBJBNWS2.js";
169
169
  import "./chunk-KD3QD3A5.js";
@@ -184,7 +184,7 @@ import "./chunk-H4WG3UQZ.js";
184
184
  import "./chunk-OO42R444.js";
185
185
  import "./chunk-PIG4WJFQ.js";
186
186
  import "./chunk-KFZY2OFH.js";
187
- import "./chunk-HXTUA7QM.js";
187
+ import "./chunk-GOPWZYZH.js";
188
188
  import "./chunk-V7IZKJI3.js";
189
189
  import "./chunk-MKQBXQKU.js";
190
190
  import "./chunk-SEDEKFYQ.js";
@@ -194,30 +194,30 @@ import "./chunk-RSUYKGGZ.js";
194
194
  import "./chunk-42NQ7AVG.js";
195
195
  import "./chunk-TMSXWOBZ.js";
196
196
  import "./chunk-7RXCMVFQ.js";
197
- import "./chunk-PJUHQC4T.js";
197
+ import "./chunk-3HLCRYBV.js";
198
198
  import "./chunk-57QKLRBV.js";
199
199
  import "./chunk-D24OXEPB.js";
200
- import "./chunk-TRBIJS2T.js";
201
- import "./chunk-G24HJJ67.js";
202
- import "./chunk-W6ROK2KU.js";
200
+ import "./chunk-JZ7SSAQ5.js";
201
+ import "./chunk-7JO6RVBI.js";
203
202
  import "./chunk-EQWEIIKQ.js";
203
+ import "./chunk-W6ROK2KU.js";
204
204
  import "./chunk-UTRO5UJU.js";
205
205
  import "./chunk-WG5HSQ4P.js";
206
206
  import "./chunk-35NN3ZFA.js";
207
207
  import "./chunk-CEN6DW6X.js";
208
208
  import "./chunk-T4WDJPEZ.js";
209
- import "./chunk-3F2LKUMU.js";
209
+ import "./chunk-ZAB5PG65.js";
210
210
  import "./chunk-56BSXSHC.js";
211
211
  import "./chunk-IKKWIPYN.js";
212
212
  import "./chunk-5IVLTFOV.js";
213
213
  import "./chunk-VCD4PSK2.js";
214
214
  import "./chunk-6ZYQ36IB.js";
215
215
  import "./chunk-OADWQ5CR.js";
216
- import "./chunk-E6JYVPBK.js";
216
+ import "./chunk-5YGO5VEH.js";
217
217
  import {
218
218
  hasIdentityRecoveryIntent,
219
219
  resolveEffectiveIdentityInjectionMode
220
- } from "./chunk-EUVPB5TA.js";
220
+ } from "./chunk-65V4K4MT.js";
221
221
  import "./chunk-GDASG7NC.js";
222
222
  import "./chunk-GDB4J2H3.js";
223
223
  import "./chunk-3CE77VAP.js";
@@ -233,7 +233,7 @@ import "./chunk-H7XKCNR6.js";
233
233
  import "./chunk-TXBU7YDV.js";
234
234
  import "./chunk-SOBJ6NEY.js";
235
235
  import "./chunk-R4Q7CQGZ.js";
236
- import "./chunk-WMHO3WLC.js";
236
+ import "./chunk-GQBZ7EVF.js";
237
237
  import "./chunk-XOQSEF7X.js";
238
238
  import "./chunk-ICP53SKG.js";
239
239
  import "./chunk-AQEJKOKI.js";
@@ -249,12 +249,12 @@ import "./chunk-7TWUCYER.js";
249
249
  import "./chunk-EMDLM3LW.js";
250
250
  import "./chunk-NLE6TSLG.js";
251
251
  import "./chunk-QDW3E4RD.js";
252
- import "./chunk-N7LPS4Z3.js";
252
+ import "./chunk-5SM35XZR.js";
253
253
  import "./chunk-C37ZRXX7.js";
254
- import "./chunk-MYFFOPO2.js";
254
+ import "./chunk-XMZV27S5.js";
255
255
  import "./chunk-R6YJI3HE.js";
256
- import "./chunk-WUDWRUGK.js";
257
- import "./chunk-IXFI6E3Q.js";
256
+ import "./chunk-7PVFOFPJ.js";
257
+ import "./chunk-YQQK7W7T.js";
258
258
  import "./chunk-HLPD7B7P.js";
259
259
  import "./chunk-NVRYW264.js";
260
260
  import "./chunk-BLAKS3CP.js";
@@ -265,7 +265,7 @@ import "./chunk-3Y224NYC.js";
265
265
  import "./chunk-W7IGLX4G.js";
266
266
  import "./chunk-H24WNPA2.js";
267
267
  import "./chunk-CINZGPSJ.js";
268
- import "./chunk-JDDTNK5P.js";
268
+ import "./chunk-VRYJSKOM.js";
269
269
  import "./chunk-227UFSEQ.js";
270
270
  import "./chunk-ET356KSB.js";
271
271
  import "./chunk-72A4L5JJ.js";
@@ -323,13 +323,13 @@ import "./chunk-IUM3VSHI.js";
323
323
  import "./chunk-O75CRYGF.js";
324
324
  import "./chunk-OD4FM2U7.js";
325
325
  import "./chunk-ZY2MNJR6.js";
326
- import "./chunk-UUQLB2HJ.js";
326
+ import "./chunk-C7EI7CA6.js";
327
327
  import "./chunk-KSXJOC4F.js";
328
328
  import "./chunk-CAGPP5NB.js";
329
329
  import "./chunk-TBBDFYXW.js";
330
330
  import "./chunk-ZBJMUXZH.js";
331
- import "./chunk-35IC3EVP.js";
332
- import "./chunk-OHLNFI6Z.js";
331
+ import "./chunk-XFQRFWVS.js";
332
+ import "./chunk-3HKQOFOV.js";
333
333
  import "./chunk-ENTCVTQR.js";
334
334
  import "./chunk-UHVXE24Y.js";
335
335
  import "./chunk-WIPEXG6R.js";
@@ -344,7 +344,8 @@ import "./chunk-7RJUVTVF.js";
344
344
  import "./chunk-SCU65EZI.js";
345
345
  import "./chunk-DM2T26WE.js";
346
346
  import "./chunk-LDXUBPMO.js";
347
- import "./chunk-2FTRRQKZ.js";
347
+ import "./chunk-RVLJEII5.js";
348
+ import "./chunk-S5SLVSVY.js";
348
349
  import "./chunk-CGASUJVP.js";
349
350
  import "./chunk-R3DJVOSM.js";
350
351
  import "./chunk-BT7NVCML.js";
@@ -387,10 +388,10 @@ import "./chunk-JUC24CTX.js";
387
388
  import "./chunk-6MKAMLQL.js";
388
389
  import "./chunk-JAKIDQB2.js";
389
390
  import "./chunk-N5Z4EVOR.js";
390
- import "./chunk-KQAFEZQX.js";
391
+ import "./chunk-IPLYGWQF.js";
392
+ import "./chunk-J4EB7DNW.js";
391
393
  import "./chunk-WEHSQBFR.js";
392
394
  import "./chunk-X7Y7WX73.js";
393
- import "./chunk-J4EB7DNW.js";
394
395
  import "./chunk-BJMBJZ2Y.js";
395
396
  import "./chunk-UKJAGEXH.js";
396
397
  import "./chunk-FP2373TW.js";
@@ -0,0 +1,33 @@
1
+ import { x as MemoryStatus } from '../types-CqWwMPr_.js';
2
+ import { ReconcileFileState, ReconcilePlan } from './plan.js';
3
+ import '../message-parts/index.js';
4
+ import '../bounded-jsonl-state.js';
5
+ import '../operator-doctor-types.js';
6
+ import '../types-continuity.js';
7
+ import '../offline-sync.js';
8
+
9
+ declare const RECONCILE_MANIFEST_FORMAT = "remnic-reconcile-manifest";
10
+ declare const RECONCILE_MANIFEST_SCHEMA_VERSION = 1;
11
+ interface ReconcileMemoryIdentity {
12
+ id: string;
13
+ category: string;
14
+ contentHash: string;
15
+ status: MemoryStatus;
16
+ }
17
+ interface ReconcileManifestFile extends ReconcileFileState {
18
+ memory?: ReconcileMemoryIdentity;
19
+ }
20
+ interface ReconcileManifest {
21
+ format: typeof RECONCILE_MANIFEST_FORMAT;
22
+ schemaVersion: typeof RECONCILE_MANIFEST_SCHEMA_VERSION;
23
+ files: ReconcileManifestFile[];
24
+ }
25
+ interface BuildReconcileManifestOptions {
26
+ files: Iterable<ReconcileFileState>;
27
+ readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>;
28
+ cachedFiles?: Iterable<ReconcileManifestFile>;
29
+ }
30
+ declare function buildReconcileManifest(options: BuildReconcileManifestOptions): Promise<ReconcileManifest>;
31
+ declare function collapseActiveFactDuplicates(plan: ReconcilePlan, localManifests: ReadonlyMap<string, ReconcileManifest>, peerManifests: ReadonlyMap<string, ReconcileManifest>): ReconcilePlan;
32
+
33
+ export { type BuildReconcileManifestOptions, RECONCILE_MANIFEST_FORMAT, RECONCILE_MANIFEST_SCHEMA_VERSION, type ReconcileManifest, type ReconcileManifestFile, type ReconcileMemoryIdentity, buildReconcileManifest, collapseActiveFactDuplicates };
@@ -0,0 +1,248 @@
1
+ import {
2
+ summarizeReconcilePlan
3
+ } from "../chunk-6UWB5PTR.js";
4
+ import "../chunk-EGGE52UU.js";
5
+ import {
6
+ inferMemoryStatus
7
+ } from "../chunk-7RJUVTVF.js";
8
+ import {
9
+ ContentHashIndex
10
+ } from "../chunk-S5SLVSVY.js";
11
+ import "../chunk-W5H6ZRPT.js";
12
+ import "../chunk-FFAZ2XFU.js";
13
+ import "../chunk-7XC2HX75.js";
14
+ import "../chunk-UI3NYK34.js";
15
+ import "../chunk-GCGJW34D.js";
16
+ import "../chunk-AREGMX2J.js";
17
+ import "../chunk-P7FMDTKL.js";
18
+ import "../chunk-5TFP4CUL.js";
19
+ import "../chunk-A6XUJE5D.js";
20
+ import "../chunk-5UZXUTVO.js";
21
+ import {
22
+ RECALL_FALLBACK_DIRS
23
+ } from "../chunk-VS2IYZRU.js";
24
+ import "../chunk-3WCASNQZ.js";
25
+ import "../chunk-PZ5AY32C.js";
26
+
27
+ // src/reconcile/manifest.ts
28
+ import { createHash } from "crypto";
29
+ var RECONCILE_MANIFEST_FORMAT = "remnic-reconcile-manifest";
30
+ var RECONCILE_MANIFEST_SCHEMA_VERSION = 1;
31
+ var SHA256_PATTERN = /^[a-f0-9]{64}$/i;
32
+ var MEMORY_DIRS = new Set(RECALL_FALLBACK_DIRS);
33
+ function isMemoryPath(filePath) {
34
+ if (!filePath.endsWith(".md")) return false;
35
+ const segments = filePath.split("/");
36
+ let index = 0;
37
+ if (segments[index] === "cold" || segments[index] === "archive") index += 1;
38
+ return MEMORY_DIRS.has(segments[index] ?? "");
39
+ }
40
+ function parseScalar(value) {
41
+ if (value === void 0) return void 0;
42
+ const trimmed = value.trim();
43
+ if (trimmed.length === 0) return void 0;
44
+ if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
45
+ try {
46
+ const parsed = JSON.parse(trimmed);
47
+ return typeof parsed === "string" ? parsed : trimmed;
48
+ } catch {
49
+ return trimmed.slice(1, -1).replace(/\\"/g, '"');
50
+ }
51
+ }
52
+ if (trimmed.startsWith("'") && trimmed.endsWith("'")) {
53
+ return trimmed.slice(1, -1).replace(/''/g, "'");
54
+ }
55
+ return trimmed;
56
+ }
57
+ function parsedMemoryIdentity(filePath, raw) {
58
+ if (!isMemoryPath(filePath)) return void 0;
59
+ const match = (Buffer.isBuffer(raw) ? raw.toString("utf8") : raw).match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
60
+ if (!match) return void 0;
61
+ const fields = /* @__PURE__ */ new Map();
62
+ for (const line of match[1].split("\n")) {
63
+ const separator = line.indexOf(":");
64
+ if (separator > 0) fields.set(line.slice(0, separator).trim(), line.slice(separator + 1).trim());
65
+ }
66
+ const id = parseScalar(fields.get("id"));
67
+ if (!id) return void 0;
68
+ const category = parseScalar(fields.get("category")) ?? "fact";
69
+ const storedHash = parseScalar(fields.get("contentHash"));
70
+ const contentHash = storedHash && SHA256_PATTERN.test(storedHash) ? storedHash.toLowerCase() : ContentHashIndex.computeHash(match[2].trim());
71
+ const status = inferMemoryStatus(
72
+ {
73
+ status: parseScalar(fields.get("status")),
74
+ archivedAt: parseScalar(fields.get("archivedAt"))
75
+ },
76
+ filePath
77
+ );
78
+ return { id, category, contentHash, status };
79
+ }
80
+ async function buildReconcileManifest(options) {
81
+ const cachedByPath = /* @__PURE__ */ new Map();
82
+ for (const cached of options.cachedFiles ?? []) {
83
+ cachedByPath.set(cached.path, cached);
84
+ }
85
+ const files = [];
86
+ for (const file of options.files) {
87
+ const cached = cachedByPath.get(file.path);
88
+ if (cached?.sha256.toLowerCase() === file.sha256.toLowerCase()) {
89
+ files.push({ ...file, ...cached.memory ? { memory: cached.memory } : {} });
90
+ continue;
91
+ }
92
+ let raw = null;
93
+ if (isMemoryPath(file.path)) {
94
+ try {
95
+ raw = await options.readFile(file);
96
+ } catch {
97
+ raw = null;
98
+ }
99
+ }
100
+ if (raw !== null && createHash("sha256").update(raw).digest("hex") !== file.sha256.toLowerCase()) {
101
+ raw = null;
102
+ }
103
+ const memory = raw === null ? void 0 : parsedMemoryIdentity(file.path, raw);
104
+ files.push({ ...file, ...memory ? { memory } : {} });
105
+ }
106
+ files.sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);
107
+ return {
108
+ format: RECONCILE_MANIFEST_FORMAT,
109
+ schemaVersion: RECONCILE_MANIFEST_SCHEMA_VERSION,
110
+ files
111
+ };
112
+ }
113
+ function activeFactByPath(manifest) {
114
+ const result = /* @__PURE__ */ new Map();
115
+ for (const file of manifest?.files ?? []) {
116
+ if (file.memory?.category === "fact" && file.memory.status === "active") {
117
+ result.set(file.path, file);
118
+ }
119
+ }
120
+ return result;
121
+ }
122
+ function contentHashRows(files) {
123
+ const rows = [];
124
+ for (const file of files) {
125
+ rows.push({ path: file.path, contentHash: file.memory.contentHash });
126
+ }
127
+ return rows;
128
+ }
129
+ function comparePlanEntries(left, right) {
130
+ if (left.namespace !== right.namespace) return left.namespace < right.namespace ? -1 : 1;
131
+ return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;
132
+ }
133
+ function collapseActiveFactDuplicates(plan, localManifests, peerManifests) {
134
+ const entriesByNamespace = /* @__PURE__ */ new Map();
135
+ for (const entry of plan.entries) {
136
+ const entries2 = entriesByNamespace.get(entry.namespace) ?? [];
137
+ entries2.push({ ...entry });
138
+ entriesByNamespace.set(entry.namespace, entries2);
139
+ }
140
+ let changed = false;
141
+ for (const namespace of /* @__PURE__ */ new Set([...localManifests.keys(), ...peerManifests.keys()])) {
142
+ const entries2 = entriesByNamespace.get(namespace) ?? [];
143
+ const localManifest = localManifests.get(namespace);
144
+ const peerManifest = peerManifests.get(namespace);
145
+ const localByPath = activeFactByPath(localManifest);
146
+ const peerByPath = activeFactByPath(peerManifest);
147
+ const localFilesByPath = new Map((localManifest?.files ?? []).map((file) => [file.path, file]));
148
+ const peerFilesByPath = new Map((peerManifest?.files ?? []).map((file) => [file.path, file]));
149
+ const localByHash = /* @__PURE__ */ new Map();
150
+ const peerByHash = /* @__PURE__ */ new Map();
151
+ for (const file of localByPath.values()) {
152
+ const hash = file.memory.contentHash;
153
+ const bucket = localByHash.get(hash) ?? [];
154
+ bucket.push(file);
155
+ localByHash.set(hash, bucket);
156
+ }
157
+ for (const file of peerByPath.values()) {
158
+ const hash = file.memory.contentHash;
159
+ const bucket = peerByHash.get(hash) ?? [];
160
+ bucket.push(file);
161
+ peerByHash.set(hash, bucket);
162
+ }
163
+ const removed = /* @__PURE__ */ new Set();
164
+ const replacements = [];
165
+ for (const hash of /* @__PURE__ */ new Set([...localByHash.keys(), ...peerByHash.keys()])) {
166
+ const localCandidates = (localByHash.get(hash) ?? []).filter((file) => {
167
+ const opposite = peerFilesByPath.get(file.path);
168
+ const activeOpposite = peerByPath.get(file.path);
169
+ return opposite === void 0 || activeOpposite?.memory.contentHash === hash;
170
+ });
171
+ const peerCandidates = (peerByHash.get(hash) ?? []).filter((file) => {
172
+ const opposite = localFilesByPath.get(file.path);
173
+ const activeOpposite = localByPath.get(file.path);
174
+ return opposite === void 0 || activeOpposite?.memory.contentHash === hash;
175
+ });
176
+ const localPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(localCandidates));
177
+ const peerPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(peerCandidates));
178
+ if (localPath && peerPath && localPath !== peerPath) {
179
+ const localFile = localByPath.get(localPath);
180
+ const peerFile = peerByPath.get(peerPath);
181
+ if (!localFile || !peerFile) continue;
182
+ const duplicatePaths = /* @__PURE__ */ new Set([
183
+ ...localCandidates.map((file) => file.path),
184
+ ...peerCandidates.map((file) => file.path)
185
+ ]);
186
+ const unsafeEntry = entries2.some(
187
+ (entry) => duplicatePaths.has(entry.path) && (entry.action === "suppress" || entry.action === "conflict")
188
+ );
189
+ if (unsafeEntry) continue;
190
+ for (const entry of entries2) {
191
+ if (duplicatePaths.has(entry.path) && (entry.action === "pull" || entry.action === "push" || entry.action === "identical")) {
192
+ removed.add(entry);
193
+ }
194
+ }
195
+ replacements.push({
196
+ path: localPath < peerPath ? localPath : peerPath,
197
+ namespace,
198
+ action: "identical",
199
+ reason: "semantic_duplicate",
200
+ localSha256: localFile.sha256,
201
+ peerSha256: peerFile.sha256
202
+ });
203
+ changed = true;
204
+ continue;
205
+ }
206
+ const sameSideEntries = entries2.filter((entry) => {
207
+ if (localPath && entry.reason === "local_only") {
208
+ return localCandidates.some((file) => file.path === entry.path);
209
+ }
210
+ if (peerPath && entry.reason === "peer_only") {
211
+ return peerCandidates.some((file) => file.path === entry.path);
212
+ }
213
+ return false;
214
+ });
215
+ const canonicalPath = localPath ?? peerPath;
216
+ const hasSharedCanonical = localPath !== void 0 && localPath === peerPath;
217
+ if (!canonicalPath || sameSideEntries.length === 0 || !hasSharedCanonical && sameSideEntries.length < 2) {
218
+ continue;
219
+ }
220
+ for (const entry of sameSideEntries) {
221
+ if (entry.path !== canonicalPath) {
222
+ removed.add(entry);
223
+ changed = true;
224
+ }
225
+ }
226
+ }
227
+ if (removed.size > 0 || replacements.length > 0) {
228
+ entriesByNamespace.set(
229
+ namespace,
230
+ [...entries2.filter((entry) => !removed.has(entry)), ...replacements].sort(comparePlanEntries)
231
+ );
232
+ }
233
+ }
234
+ if (!changed) return plan;
235
+ const entries = [...entriesByNamespace.values()].flat().sort(comparePlanEntries);
236
+ return {
237
+ entries,
238
+ byNamespace: summarizeReconcilePlan(entries),
239
+ converged: entries.every((entry) => entry.action === "identical")
240
+ };
241
+ }
242
+ export {
243
+ RECONCILE_MANIFEST_FORMAT,
244
+ RECONCILE_MANIFEST_SCHEMA_VERSION,
245
+ buildReconcileManifest,
246
+ collapseActiveFactDuplicates
247
+ };
248
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/reconcile/manifest.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { inferMemoryStatus } from \"../memory-lifecycle-ledger-utils.js\";\nimport { ContentHashIndex, type ContentHashPathEntry } from \"../storage/content-hash-index.js\";\nimport type { MemoryFrontmatter, MemoryStatus } from \"../types.js\";\nimport { RECALL_FALLBACK_DIRS } from \"../utils/category-dir.js\";\nimport {\n type ReconcileFileState,\n type ReconcilePlan,\n type ReconcilePlanEntry,\n summarizeReconcilePlan,\n} from \"./plan.js\";\n\nexport const RECONCILE_MANIFEST_FORMAT = \"remnic-reconcile-manifest\";\nexport const RECONCILE_MANIFEST_SCHEMA_VERSION = 1;\n\nexport interface ReconcileMemoryIdentity {\n id: string;\n category: string;\n contentHash: string;\n status: MemoryStatus;\n}\n\nexport interface ReconcileManifestFile extends ReconcileFileState {\n memory?: ReconcileMemoryIdentity;\n}\n\ntype ActiveFactManifestFile = ReconcileManifestFile & { memory: ReconcileMemoryIdentity };\n\nexport interface ReconcileManifest {\n format: typeof RECONCILE_MANIFEST_FORMAT;\n schemaVersion: typeof RECONCILE_MANIFEST_SCHEMA_VERSION;\n files: ReconcileManifestFile[];\n}\n\nexport interface BuildReconcileManifestOptions {\n files: Iterable<ReconcileFileState>;\n readFile: (file: ReconcileFileState) => Promise<Buffer | string | null>;\n cachedFiles?: Iterable<ReconcileManifestFile>;\n}\n\nconst SHA256_PATTERN = /^[a-f0-9]{64}$/i;\nconst MEMORY_DIRS = new Set(RECALL_FALLBACK_DIRS);\n\nfunction isMemoryPath(filePath: string): boolean {\n if (!filePath.endsWith(\".md\")) return false;\n const segments = filePath.split(\"/\");\n let index = 0;\n if (segments[index] === \"cold\" || segments[index] === \"archive\") index += 1;\n return MEMORY_DIRS.has(segments[index] ?? \"\");\n}\n\nfunction parseScalar(value: string | undefined): string | undefined {\n if (value === undefined) return undefined;\n const trimmed = value.trim();\n if (trimmed.length === 0) return undefined;\n if (trimmed.startsWith('\"') && trimmed.endsWith('\"')) {\n try {\n const parsed = JSON.parse(trimmed) as unknown;\n return typeof parsed === \"string\" ? parsed : trimmed;\n } catch {\n return trimmed.slice(1, -1).replace(/\\\\\"/g, '\"');\n }\n }\n if (trimmed.startsWith(\"'\") && trimmed.endsWith(\"'\")) {\n return trimmed.slice(1, -1).replace(/''/g, \"'\");\n }\n return trimmed;\n}\n\nfunction parsedMemoryIdentity(filePath: string, raw: Buffer | string): ReconcileMemoryIdentity | undefined {\n if (!isMemoryPath(filePath)) return undefined;\n const match = (Buffer.isBuffer(raw) ? raw.toString(\"utf8\") : raw).match(/^---\\n([\\s\\S]*?)\\n---\\n?([\\s\\S]*)$/);\n if (!match) return undefined;\n const fields = new Map<string, string>();\n for (const line of match[1].split(\"\\n\")) {\n const separator = line.indexOf(\":\");\n if (separator > 0) fields.set(line.slice(0, separator).trim(), line.slice(separator + 1).trim());\n }\n const id = parseScalar(fields.get(\"id\"));\n if (!id) return undefined;\n const category = parseScalar(fields.get(\"category\")) ?? \"fact\";\n const storedHash = parseScalar(fields.get(\"contentHash\"));\n const contentHash =\n storedHash && SHA256_PATTERN.test(storedHash)\n ? storedHash.toLowerCase()\n : ContentHashIndex.computeHash(match[2].trim());\n const status = inferMemoryStatus(\n {\n status: parseScalar(fields.get(\"status\")) as MemoryStatus | undefined,\n archivedAt: parseScalar(fields.get(\"archivedAt\")),\n } as MemoryFrontmatter,\n filePath\n );\n return { id, category, contentHash, status };\n}\n\nexport async function buildReconcileManifest(options: BuildReconcileManifestOptions): Promise<ReconcileManifest> {\n const cachedByPath = new Map<string, ReconcileManifestFile>();\n for (const cached of options.cachedFiles ?? []) {\n cachedByPath.set(cached.path, cached);\n }\n\n const files: ReconcileManifestFile[] = [];\n for (const file of options.files) {\n const cached = cachedByPath.get(file.path);\n if (cached?.sha256.toLowerCase() === file.sha256.toLowerCase()) {\n files.push({ ...file, ...(cached.memory ? { memory: cached.memory } : {}) });\n continue;\n }\n\n let raw: Buffer | string | null = null;\n if (isMemoryPath(file.path)) {\n try {\n raw = await options.readFile(file);\n } catch {\n raw = null;\n }\n }\n if (raw !== null && createHash(\"sha256\").update(raw).digest(\"hex\") !== file.sha256.toLowerCase()) {\n raw = null;\n }\n const memory = raw === null ? undefined : parsedMemoryIdentity(file.path, raw);\n files.push({ ...file, ...(memory ? { memory } : {}) });\n }\n files.sort((left, right) => (left.path < right.path ? -1 : left.path > right.path ? 1 : 0));\n return {\n format: RECONCILE_MANIFEST_FORMAT,\n schemaVersion: RECONCILE_MANIFEST_SCHEMA_VERSION,\n files,\n };\n}\n\nfunction activeFactByPath(manifest: ReconcileManifest | undefined): Map<string, ActiveFactManifestFile> {\n const result = new Map<string, ActiveFactManifestFile>();\n for (const file of manifest?.files ?? []) {\n if (file.memory?.category === \"fact\" && file.memory.status === \"active\") {\n result.set(file.path, file as ActiveFactManifestFile);\n }\n }\n return result;\n}\n\nfunction contentHashRows(files: Iterable<ActiveFactManifestFile>): ContentHashPathEntry[] {\n const rows: ContentHashPathEntry[] = [];\n for (const file of files) {\n rows.push({ path: file.path, contentHash: file.memory.contentHash });\n }\n return rows;\n}\n\nfunction comparePlanEntries(left: ReconcilePlanEntry, right: ReconcilePlanEntry): number {\n if (left.namespace !== right.namespace) return left.namespace < right.namespace ? -1 : 1;\n return left.path < right.path ? -1 : left.path > right.path ? 1 : 0;\n}\n\nexport function collapseActiveFactDuplicates(\n plan: ReconcilePlan,\n localManifests: ReadonlyMap<string, ReconcileManifest>,\n peerManifests: ReadonlyMap<string, ReconcileManifest>\n): ReconcilePlan {\n const entriesByNamespace = new Map<string, ReconcilePlanEntry[]>();\n for (const entry of plan.entries) {\n const entries = entriesByNamespace.get(entry.namespace) ?? [];\n entries.push({ ...entry });\n entriesByNamespace.set(entry.namespace, entries);\n }\n\n let changed = false;\n for (const namespace of new Set([...localManifests.keys(), ...peerManifests.keys()])) {\n const entries = entriesByNamespace.get(namespace) ?? [];\n const localManifest = localManifests.get(namespace);\n const peerManifest = peerManifests.get(namespace);\n const localByPath = activeFactByPath(localManifest);\n const peerByPath = activeFactByPath(peerManifest);\n const localFilesByPath = new Map((localManifest?.files ?? []).map((file) => [file.path, file]));\n const peerFilesByPath = new Map((peerManifest?.files ?? []).map((file) => [file.path, file]));\n const localByHash = new Map<string, ActiveFactManifestFile[]>();\n const peerByHash = new Map<string, ActiveFactManifestFile[]>();\n\n for (const file of localByPath.values()) {\n const hash = file.memory.contentHash;\n const bucket = localByHash.get(hash) ?? [];\n bucket.push(file);\n localByHash.set(hash, bucket);\n }\n for (const file of peerByPath.values()) {\n const hash = file.memory.contentHash;\n const bucket = peerByHash.get(hash) ?? [];\n bucket.push(file);\n peerByHash.set(hash, bucket);\n }\n\n const removed = new Set<ReconcilePlanEntry>();\n const replacements: ReconcilePlanEntry[] = [];\n for (const hash of new Set([...localByHash.keys(), ...peerByHash.keys()])) {\n const localCandidates = (localByHash.get(hash) ?? []).filter((file) => {\n const opposite = peerFilesByPath.get(file.path);\n const activeOpposite = peerByPath.get(file.path);\n return opposite === undefined || activeOpposite?.memory.contentHash === hash;\n });\n const peerCandidates = (peerByHash.get(hash) ?? []).filter((file) => {\n const opposite = localFilesByPath.get(file.path);\n const activeOpposite = localByPath.get(file.path);\n return opposite === undefined || activeOpposite?.memory.contentHash === hash;\n });\n const localPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(localCandidates));\n const peerPath = ContentHashIndex.resolvePathByHash(hash, contentHashRows(peerCandidates));\n\n if (localPath && peerPath && localPath !== peerPath) {\n const localFile = localByPath.get(localPath);\n const peerFile = peerByPath.get(peerPath);\n if (!localFile || !peerFile) continue;\n const duplicatePaths = new Set([\n ...localCandidates.map((file) => file.path),\n ...peerCandidates.map((file) => file.path),\n ]);\n const unsafeEntry = entries.some(\n (entry) => duplicatePaths.has(entry.path) && (entry.action === \"suppress\" || entry.action === \"conflict\")\n );\n if (unsafeEntry) continue;\n for (const entry of entries) {\n if (\n duplicatePaths.has(entry.path) &&\n (entry.action === \"pull\" || entry.action === \"push\" || entry.action === \"identical\")\n ) {\n removed.add(entry);\n }\n }\n replacements.push({\n path: localPath < peerPath ? localPath : peerPath,\n namespace,\n action: \"identical\",\n reason: \"semantic_duplicate\",\n localSha256: localFile.sha256,\n peerSha256: peerFile.sha256,\n });\n changed = true;\n continue;\n }\n\n const sameSideEntries = entries.filter((entry) => {\n if (localPath && entry.reason === \"local_only\") {\n return localCandidates.some((file) => file.path === entry.path);\n }\n if (peerPath && entry.reason === \"peer_only\") {\n return peerCandidates.some((file) => file.path === entry.path);\n }\n return false;\n });\n const canonicalPath = localPath ?? peerPath;\n const hasSharedCanonical = localPath !== undefined && localPath === peerPath;\n if (!canonicalPath || sameSideEntries.length === 0 || (!hasSharedCanonical && sameSideEntries.length < 2)) {\n continue;\n }\n for (const entry of sameSideEntries) {\n if (entry.path !== canonicalPath) {\n removed.add(entry);\n changed = true;\n }\n }\n }\n\n if (removed.size > 0 || replacements.length > 0) {\n entriesByNamespace.set(\n namespace,\n [...entries.filter((entry) => !removed.has(entry)), ...replacements].sort(comparePlanEntries)\n );\n }\n }\n\n if (!changed) return plan;\n const entries = [...entriesByNamespace.values()].flat().sort(comparePlanEntries);\n return {\n entries,\n byNamespace: summarizeReconcilePlan(entries),\n converged: entries.every((entry) => entry.action === \"identical\"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U,MAAM,WAAW,WAAW;AAAA,EAClE;AACF;","names":["entries"]}
@@ -66,7 +66,7 @@ interface ReconcilePlanEntry {
66
66
  }
67
67
  type ReconcileReason = "peer_only" | "local_only"
68
68
  /** Cursor showed only that side moved since agreement; both still hold the path. */
69
- | "peer_changed" | "local_changed" | "same_content" | "both_modified" | "peer_deleted" | "local_deleted"
69
+ | "peer_changed" | "local_changed" | "same_content" | "semantic_duplicate" | "both_modified" | "peer_deleted" | "local_deleted"
70
70
  /** Peer deleted it while this side edited it — the offline-sync delete/modify pair. */
71
71
  | "local_modified_peer_deleted" | "local_deleted_peer_modified" | "tombstoned";
72
72
  interface ReconcileNamespaceReport {