@remnic/core 1.1.14 → 1.1.16

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 (132) hide show
  1. package/dist/access-cli.js +34 -33
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.d.ts +2 -1
  4. package/dist/access-http.js +15 -14
  5. package/dist/access-mcp.d.ts +2 -1
  6. package/dist/access-mcp.js +14 -13
  7. package/dist/access-schema.d.ts +36 -5
  8. package/dist/access-schema.js +9 -5
  9. package/dist/{access-service-DcCDmNYC.d.ts → access-service-DZXc7qwR.d.ts} +31 -1
  10. package/dist/access-service.d.ts +2 -1
  11. package/dist/access-service.js +12 -11
  12. package/dist/briefing.js +4 -4
  13. package/dist/causal-consolidation.js +5 -5
  14. package/dist/chunk-2OZ6GP27.js +832 -0
  15. package/dist/chunk-2OZ6GP27.js.map +1 -0
  16. package/dist/{chunk-VNO6ZJ35.js → chunk-2PRLKQAH.js} +5 -5
  17. package/dist/{chunk-EFJ3MQ4V.js → chunk-65HQPW6O.js} +2 -2
  18. package/dist/{chunk-A2XUIMJ3.js → chunk-66H2DZYB.js} +18 -2
  19. package/dist/chunk-66H2DZYB.js.map +1 -0
  20. package/dist/{chunk-GA454ALV.js → chunk-AAX3SUM3.js} +39 -39
  21. package/dist/{chunk-QQUAB63I.js → chunk-BEB4GUU5.js} +2 -2
  22. package/dist/{chunk-KUJVMMZQ.js → chunk-C7DGCHJE.js} +2 -2
  23. package/dist/{chunk-PR5FBTFU.js → chunk-CYFQJMUV.js} +5 -5
  24. package/dist/{chunk-KLAO5DGL.js → chunk-G7JBLD65.js} +3 -3
  25. package/dist/{chunk-CHEL3SKB.js → chunk-HJILHQOR.js} +27 -27
  26. package/dist/{chunk-ME6ESPZU.js → chunk-IG5VGHYB.js} +2 -2
  27. package/dist/{chunk-7AAT6G4Q.js → chunk-IOAY54RF.js} +57 -5
  28. package/dist/chunk-IOAY54RF.js.map +1 -0
  29. package/dist/{chunk-XVZ7B3HG.js → chunk-JFEH2LZM.js} +2 -2
  30. package/dist/{chunk-JLFA7DQG.js → chunk-M3AA636B.js} +2 -2
  31. package/dist/{chunk-P4NEIHUT.js → chunk-MS3ULOZF.js} +2 -2
  32. package/dist/{chunk-CQZRLNMV.js → chunk-MTYLGYOQ.js} +53 -4
  33. package/dist/chunk-MTYLGYOQ.js.map +1 -0
  34. package/dist/{chunk-7IASACLB.js → chunk-NOHC2L57.js} +2 -2
  35. package/dist/{chunk-6RVI47ZR.js → chunk-NTUNYIF7.js} +5 -5
  36. package/dist/{chunk-CK5NTM2S.js → chunk-OGROP7ZN.js} +2 -2
  37. package/dist/{chunk-MT25YHYH.js → chunk-OJRKZLZ4.js} +5 -5
  38. package/dist/{chunk-2F2W355T.js → chunk-QA2ZAPBU.js} +4 -4
  39. package/dist/{chunk-MC26UJIM.js → chunk-QLKBF3TI.js} +2 -2
  40. package/dist/{chunk-YNJHCGDT.js → chunk-SH5S7XYD.js} +8 -5
  41. package/dist/chunk-SH5S7XYD.js.map +1 -0
  42. package/dist/{chunk-WZYKANL3.js → chunk-SK42SSAN.js} +4 -4
  43. package/dist/{chunk-VW676BEI.js → chunk-V7WH7DEM.js} +2 -2
  44. package/dist/{chunk-PU63GXWS.js → chunk-W7DK3CYM.js} +2 -2
  45. package/dist/{chunk-TFO23QT4.js → chunk-XKLD5OK4.js} +4 -4
  46. package/dist/{chunk-M23FSH32.js → chunk-Y2YBRCEF.js} +79 -6
  47. package/dist/chunk-Y2YBRCEF.js.map +1 -0
  48. package/dist/{chunk-I5V2VDIW.js → chunk-YCVWX2NF.js} +2 -2
  49. package/dist/{chunk-UXHQAFNA.js → chunk-ZPXYWTN5.js} +4 -4
  50. package/dist/{chunk-GGKRUQOO.js → chunk-ZYVPLJ4T.js} +4 -4
  51. package/dist/{cli-D3VpkVwB.d.ts → cli-kVwab1_L.d.ts} +1 -1
  52. package/dist/cli.d.ts +3 -2
  53. package/dist/cli.js +35 -34
  54. package/dist/compounding/engine.js +4 -4
  55. package/dist/connectors/codex-materialize-runner.js +4 -4
  56. package/dist/connectors/index.js +4 -4
  57. package/dist/conversation-index/backend.js +2 -2
  58. package/dist/entity-retrieval.js +4 -4
  59. package/dist/index.d.ts +4 -3
  60. package/dist/index.js +92 -58
  61. package/dist/index.js.map +1 -1
  62. package/dist/lcm/engine.js +2 -2
  63. package/dist/lcm/index.js +5 -5
  64. package/dist/maintenance/memory-governance.js +4 -4
  65. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +4 -4
  66. package/dist/maintenance/rebuild-memory-projection.js +5 -5
  67. package/dist/mcp-memory-inspector-app.d.ts +2 -1
  68. package/dist/namespaces/migrate.js +10 -10
  69. package/dist/namespaces/search.js +5 -5
  70. package/dist/namespaces/storage.js +4 -4
  71. package/dist/offline-sync.d.ts +145 -0
  72. package/dist/offline-sync.js +43 -0
  73. package/dist/offline-sync.js.map +1 -0
  74. package/dist/operator-toolkit.js +13 -13
  75. package/dist/orchestrator.js +24 -24
  76. package/dist/schemas.d.ts +22 -22
  77. package/dist/search/factory.js +4 -4
  78. package/dist/search/index.js +6 -6
  79. package/dist/secure-store/index.d.ts +1 -15
  80. package/dist/secure-store/index.js +2 -2
  81. package/dist/semantic-consolidation.js +5 -5
  82. package/dist/semantic-rule-promotion.js +4 -4
  83. package/dist/semantic-rule-verifier.js +4 -4
  84. package/dist/storage.d.ts +7 -0
  85. package/dist/storage.js +3 -3
  86. package/dist/transfer/backup.js +2 -2
  87. package/dist/transfer/capsule-export.js +4 -4
  88. package/dist/transfer/capsule-import.js +3 -3
  89. package/dist/transfer/import-sqlite.js +2 -2
  90. package/dist/transfer/types.d.ts +12 -12
  91. package/dist/verified-recall.js +4 -4
  92. package/package.json +1 -1
  93. package/src/access-http.test.ts +289 -0
  94. package/src/access-http.ts +69 -0
  95. package/src/access-schema.ts +30 -0
  96. package/src/access-service-namespace.test.ts +64 -1
  97. package/src/access-service.ts +120 -0
  98. package/src/index.ts +34 -0
  99. package/src/offline-sync.test.ts +646 -0
  100. package/src/offline-sync.ts +1087 -0
  101. package/src/secure-store/secure-fs.ts +14 -7
  102. package/src/storage.ts +59 -0
  103. package/dist/chunk-7AAT6G4Q.js.map +0 -1
  104. package/dist/chunk-A2XUIMJ3.js.map +0 -1
  105. package/dist/chunk-CQZRLNMV.js.map +0 -1
  106. package/dist/chunk-M23FSH32.js.map +0 -1
  107. package/dist/chunk-YNJHCGDT.js.map +0 -1
  108. /package/dist/{chunk-VNO6ZJ35.js.map → chunk-2PRLKQAH.js.map} +0 -0
  109. /package/dist/{chunk-EFJ3MQ4V.js.map → chunk-65HQPW6O.js.map} +0 -0
  110. /package/dist/{chunk-GA454ALV.js.map → chunk-AAX3SUM3.js.map} +0 -0
  111. /package/dist/{chunk-QQUAB63I.js.map → chunk-BEB4GUU5.js.map} +0 -0
  112. /package/dist/{chunk-KUJVMMZQ.js.map → chunk-C7DGCHJE.js.map} +0 -0
  113. /package/dist/{chunk-PR5FBTFU.js.map → chunk-CYFQJMUV.js.map} +0 -0
  114. /package/dist/{chunk-KLAO5DGL.js.map → chunk-G7JBLD65.js.map} +0 -0
  115. /package/dist/{chunk-CHEL3SKB.js.map → chunk-HJILHQOR.js.map} +0 -0
  116. /package/dist/{chunk-ME6ESPZU.js.map → chunk-IG5VGHYB.js.map} +0 -0
  117. /package/dist/{chunk-XVZ7B3HG.js.map → chunk-JFEH2LZM.js.map} +0 -0
  118. /package/dist/{chunk-JLFA7DQG.js.map → chunk-M3AA636B.js.map} +0 -0
  119. /package/dist/{chunk-P4NEIHUT.js.map → chunk-MS3ULOZF.js.map} +0 -0
  120. /package/dist/{chunk-7IASACLB.js.map → chunk-NOHC2L57.js.map} +0 -0
  121. /package/dist/{chunk-6RVI47ZR.js.map → chunk-NTUNYIF7.js.map} +0 -0
  122. /package/dist/{chunk-CK5NTM2S.js.map → chunk-OGROP7ZN.js.map} +0 -0
  123. /package/dist/{chunk-MT25YHYH.js.map → chunk-OJRKZLZ4.js.map} +0 -0
  124. /package/dist/{chunk-2F2W355T.js.map → chunk-QA2ZAPBU.js.map} +0 -0
  125. /package/dist/{chunk-MC26UJIM.js.map → chunk-QLKBF3TI.js.map} +0 -0
  126. /package/dist/{chunk-WZYKANL3.js.map → chunk-SK42SSAN.js.map} +0 -0
  127. /package/dist/{chunk-VW676BEI.js.map → chunk-V7WH7DEM.js.map} +0 -0
  128. /package/dist/{chunk-PU63GXWS.js.map → chunk-W7DK3CYM.js.map} +0 -0
  129. /package/dist/{chunk-TFO23QT4.js.map → chunk-XKLD5OK4.js.map} +0 -0
  130. /package/dist/{chunk-I5V2VDIW.js.map → chunk-YCVWX2NF.js.map} +0 -0
  131. /package/dist/{chunk-UXHQAFNA.js.map → chunk-ZPXYWTN5.js.map} +0 -0
  132. /package/dist/{chunk-GGKRUQOO.js.map → chunk-ZYVPLJ4T.js.map} +0 -0
@@ -12,25 +12,25 @@ import {
12
12
  } from "./chunk-TK4UEOSK.js";
13
13
  import {
14
14
  importSqlite
15
- } from "./chunk-TFO23QT4.js";
16
- import {
17
- backupMemoryDir
18
- } from "./chunk-7OZ53EXP.js";
19
- import {
20
- exportJsonBundle
21
- } from "./chunk-GIF42EW3.js";
22
- import {
23
- exportSqlite
24
- } from "./chunk-66DHUKLO.js";
15
+ } from "./chunk-XKLD5OK4.js";
25
16
  import {
26
17
  detectImportFormat
27
18
  } from "./chunk-DOM4GKSW.js";
28
19
  import {
29
20
  importJsonBundle
30
21
  } from "./chunk-W4L6CZKA.js";
22
+ import {
23
+ backupMemoryDir
24
+ } from "./chunk-7OZ53EXP.js";
25
+ import {
26
+ exportJsonBundle
27
+ } from "./chunk-GIF42EW3.js";
31
28
  import {
32
29
  exportMarkdownBundle
33
30
  } from "./chunk-6H2TESSP.js";
31
+ import {
32
+ exportSqlite
33
+ } from "./chunk-66DHUKLO.js";
34
34
  import {
35
35
  TailscaleHelper
36
36
  } from "./chunk-TKWGAOLV.js";
@@ -44,12 +44,12 @@ import {
44
44
  } from "./chunk-TPMQ3G6Z.js";
45
45
  import {
46
46
  rebuildMemoryLifecycleLedger
47
- } from "./chunk-JLFA7DQG.js";
47
+ } from "./chunk-M3AA636B.js";
48
48
  import {
49
49
  rebuildMemoryProjection,
50
50
  repairMemoryProjection,
51
51
  verifyMemoryProjection
52
- } from "./chunk-KLAO5DGL.js";
52
+ } from "./chunk-G7JBLD65.js";
53
53
  import {
54
54
  rebuildObservations
55
55
  } from "./chunk-PZIAX57I.js";
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-TMM4S4IJ.js";
65
65
  import {
66
66
  promoteSemanticRuleFromMemory
67
- } from "./chunk-XVZ7B3HG.js";
67
+ } from "./chunk-JFEH2LZM.js";
68
68
  import {
69
69
  resolveAgentAccessAuthToken
70
70
  } from "./chunk-MXC3AP5I.js";
@@ -92,12 +92,12 @@ import {
92
92
  runOperatorInventory,
93
93
  runOperatorRepair,
94
94
  runOperatorSetup
95
- } from "./chunk-UXHQAFNA.js";
95
+ } from "./chunk-ZPXYWTN5.js";
96
96
  import {
97
97
  listNamespaces,
98
98
  runNamespaceMigration,
99
99
  verifyNamespaces
100
- } from "./chunk-MT25YHYH.js";
100
+ } from "./chunk-OJRKZLZ4.js";
101
101
  import {
102
102
  GraphDashboardServer
103
103
  } from "./chunk-ZPKBYX2F.js";
@@ -108,6 +108,9 @@ import {
108
108
  import {
109
109
  RoutingRulesStore
110
110
  } from "./chunk-LUDTDZLK.js";
111
+ import {
112
+ searchVerifiedEpisodes
113
+ } from "./chunk-MS3ULOZF.js";
111
114
  import {
112
115
  getUtilityLearningStatus,
113
116
  learnUtilityPromotionWeights
@@ -116,15 +119,12 @@ import {
116
119
  getUtilityTelemetryStatus,
117
120
  recordUtilityTelemetryEvent
118
121
  } from "./chunk-3QKK7QOS.js";
119
- import {
120
- searchVerifiedEpisodes
121
- } from "./chunk-P4NEIHUT.js";
122
122
  import {
123
123
  ThreadingManager
124
124
  } from "./chunk-W4RVMTHR.js";
125
125
  import {
126
126
  searchVerifiedSemanticRules
127
- } from "./chunk-MC26UJIM.js";
127
+ } from "./chunk-QLKBF3TI.js";
128
128
  import {
129
129
  getWorkProductLedgerStatus,
130
130
  recordWorkProductLedgerEntry,
@@ -196,13 +196,13 @@ import {
196
196
  } from "./chunk-NGAVDO7E.js";
197
197
  import {
198
198
  EngramAccessHttpServer
199
- } from "./chunk-CQZRLNMV.js";
199
+ } from "./chunk-MTYLGYOQ.js";
200
200
  import {
201
201
  EngramMcpServer
202
- } from "./chunk-WZYKANL3.js";
202
+ } from "./chunk-SK42SSAN.js";
203
203
  import {
204
204
  EngramAccessService
205
- } from "./chunk-M23FSH32.js";
205
+ } from "./chunk-Y2YBRCEF.js";
206
206
  import {
207
207
  WorkStorage
208
208
  } from "./chunk-WELDCG6C.js";
@@ -224,7 +224,7 @@ import {
224
224
  readMemoryGovernanceRunArtifact,
225
225
  restoreMemoryGovernanceRun,
226
226
  runMemoryGovernance
227
- } from "./chunk-EFJ3MQ4V.js";
227
+ } from "./chunk-65HQPW6O.js";
228
228
  import {
229
229
  selectRouteRule,
230
230
  validateRouteTarget
@@ -232,13 +232,13 @@ import {
232
232
  import {
233
233
  analyzeGraphHealth
234
234
  } from "./chunk-RK2Y4XOM.js";
235
- import {
236
- parseIsoOffsetTimestamp
237
- } from "./chunk-P7FMDTKL.js";
238
235
  import {
239
236
  RECALL_DISCLOSURE_LEVELS,
240
237
  isRecallDisclosure
241
238
  } from "./chunk-Q7P4WJDP.js";
239
+ import {
240
+ parseIsoOffsetTimestamp
241
+ } from "./chunk-P7FMDTKL.js";
242
242
  import {
243
243
  expandTildePath
244
244
  } from "./chunk-QRNI5JBH.js";
@@ -6755,4 +6755,4 @@ export {
6755
6755
  resolveMemoryDirForNamespace,
6756
6756
  registerCli
6757
6757
  };
6758
- //# sourceMappingURL=chunk-CHEL3SKB.js.map
6758
+ //# sourceMappingURL=chunk-HJILHQOR.js.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-U3PN77QT.js";
11
11
  import {
12
12
  StorageManager
13
- } from "./chunk-7AAT6G4Q.js";
13
+ } from "./chunk-IOAY54RF.js";
14
14
  import {
15
15
  log
16
16
  } from "./chunk-2ODBA7MQ.js";
@@ -116,4 +116,4 @@ export {
116
116
  runCodexMaterialize,
117
117
  runPostConsolidationMaterialize
118
118
  };
119
- //# sourceMappingURL=chunk-ME6ESPZU.js.map
119
+ //# sourceMappingURL=chunk-IG5VGHYB.js.map
@@ -5,11 +5,9 @@ import {
5
5
  SecureStoreLockedError,
6
6
  isEncryptedFile,
7
7
  readMaybeEncryptedFile,
8
+ readMaybeEncryptedFileBuffer,
8
9
  writeMaybeEncryptedFile
9
- } from "./chunk-YNJHCGDT.js";
10
- import {
11
- parseFlexibleIsoTimestamp
12
- } from "./chunk-P7FMDTKL.js";
10
+ } from "./chunk-SH5S7XYD.js";
13
11
  import {
14
12
  DEFAULT_CITATION_FORMAT,
15
13
  hasCitation,
@@ -19,6 +17,9 @@ import {
19
17
  SPECULATIVE_TTL_DAYS,
20
18
  confidenceTier
21
19
  } from "./chunk-Q7P4WJDP.js";
20
+ import {
21
+ parseFlexibleIsoTimestamp
22
+ } from "./chunk-P7FMDTKL.js";
22
23
  import {
23
24
  normalizeProjectionPreview,
24
25
  normalizeProjectionTags
@@ -774,6 +775,13 @@ var ContentHashIndex = class _ContentHashIndex {
774
775
  get size() {
775
776
  return this.hashes.size;
776
777
  }
778
+ /** Clear all loaded hashes so the next save rewrites the index from scratch. */
779
+ clear() {
780
+ if (this.hashes.size > 0) {
781
+ this.hashes.clear();
782
+ }
783
+ this.dirty = true;
784
+ }
777
785
  /** Persist index to disk if changed. */
778
786
  async save() {
779
787
  if (!this.dirty) return;
@@ -1908,6 +1916,49 @@ var StorageManager = class _StorageManager {
1908
1916
  writeStorageSecureFile(filePath, content) {
1909
1917
  return writeMaybeEncryptedFile(filePath, content, this.resolveWriteKey(), {}, this.baseDir);
1910
1918
  }
1919
+ assertManagedStoragePath(filePath, method) {
1920
+ const resolved = path.resolve(filePath);
1921
+ const base = path.resolve(this.baseDir);
1922
+ const rel = path.relative(base, resolved);
1923
+ if (rel === "" || rel === ".." || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel)) {
1924
+ throw new Error(`${method}: file path escapes memory dir`);
1925
+ }
1926
+ return resolved;
1927
+ }
1928
+ async readOfflineSyncFile(filePath) {
1929
+ const target = this.assertManagedStoragePath(filePath, "storage.readOfflineSyncFile");
1930
+ return readMaybeEncryptedFileBuffer(target, this._secureStoreKey, this.baseDir);
1931
+ }
1932
+ async writeOfflineSyncFile(filePath, content) {
1933
+ const target = this.assertManagedStoragePath(filePath, "storage.writeOfflineSyncFile");
1934
+ await writeMaybeEncryptedFile(target, content, this.resolveWriteKey(), {}, this.baseDir);
1935
+ await this.invalidateAfterOfflineSyncMutation(target);
1936
+ }
1937
+ async deleteOfflineSyncFile(filePath) {
1938
+ const target = this.assertManagedStoragePath(filePath, "storage.deleteOfflineSyncFile");
1939
+ await unlink(target).catch((error) => {
1940
+ if (isErrnoCode(error, "ENOENT")) return;
1941
+ throw error;
1942
+ });
1943
+ await this.invalidateAfterOfflineSyncMutation(target);
1944
+ }
1945
+ async invalidateAfterOfflineSyncMutation(filePath) {
1946
+ this.invalidateAllMemoriesCache();
1947
+ invalidateCachedEntities(this.baseDir);
1948
+ this.invalidateKnowledgeIndexCache();
1949
+ this.factHashIndexAuthoritative = false;
1950
+ await unlink(this.factHashIndexReadyPath).catch((error) => {
1951
+ if (isErrnoCode(error, "ENOENT")) return;
1952
+ throw error;
1953
+ });
1954
+ if (filePath.includes(`${path.sep}cold${path.sep}`)) {
1955
+ this.invalidateColdMemoriesCache();
1956
+ }
1957
+ if (filePath.includes(`${path.sep}artifacts${path.sep}`)) {
1958
+ this.bumpArtifactWriteVersion();
1959
+ }
1960
+ this.bumpMemoryStatusVersion();
1961
+ }
1911
1962
  createContentHashIndex() {
1912
1963
  return new ContentHashIndex(
1913
1964
  this.stateDir,
@@ -1994,6 +2045,7 @@ var StorageManager = class _StorageManager {
1994
2045
  } catch {
1995
2046
  }
1996
2047
  const factHashIndex = await this.getFactHashIndex();
2048
+ factHashIndex.clear();
1997
2049
  const existing = await this.readAllMemories();
1998
2050
  let legacyRecovered = 0;
1999
2051
  for (const memory of existing) {
@@ -5114,4 +5166,4 @@ export {
5114
5166
  serializeEntityFile,
5115
5167
  StorageManager
5116
5168
  };
5117
- //# sourceMappingURL=chunk-7AAT6G4Q.js.map
5169
+ //# sourceMappingURL=chunk-IOAY54RF.js.map