@remnic/core 9.3.663 → 9.3.664

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 (143) hide show
  1. package/dist/access-cli.js +25 -23
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.js +20 -18
  4. package/dist/access-mcp.js +19 -17
  5. package/dist/access-schema.js +4 -3
  6. package/dist/access-service.js +17 -15
  7. package/dist/briefing.js +5 -4
  8. package/dist/{capsule-merge-T2JRE46P.js → capsule-merge-GK5E647P.js} +3 -2
  9. package/dist/{capsule-merge-T2JRE46P.js.map → capsule-merge-GK5E647P.js.map} +1 -1
  10. package/dist/causal-consolidation.js +6 -5
  11. package/dist/causal-consolidation.js.map +1 -1
  12. package/dist/{chunk-2KDQI363.js → chunk-2HEZXPYU.js} +4 -4
  13. package/dist/chunk-5GPPACXK.js +16 -0
  14. package/dist/chunk-5GPPACXK.js.map +1 -0
  15. package/dist/{chunk-F6O7IOS3.js → chunk-6JBKHTQD.js} +2 -2
  16. package/dist/{chunk-TBLGI2LT.js → chunk-7ILWCUWH.js} +5 -3
  17. package/dist/{chunk-TBLGI2LT.js.map → chunk-7ILWCUWH.js.map} +1 -1
  18. package/dist/{chunk-AL4RAJL5.js → chunk-7XH7VJN4.js} +6 -4
  19. package/dist/chunk-7XH7VJN4.js.map +1 -0
  20. package/dist/{chunk-Q4CAQGKQ.js → chunk-AER6MT24.js} +12 -21
  21. package/dist/chunk-AER6MT24.js.map +1 -0
  22. package/dist/{chunk-DHGSZ3UD.js → chunk-ARV3AUOM.js} +2 -2
  23. package/dist/{chunk-PXVFMQLD.js → chunk-BZG2CWOQ.js} +3 -3
  24. package/dist/{chunk-ANJOULTP.js → chunk-C7AF236A.js} +2 -2
  25. package/dist/{chunk-FZC2WSDB.js → chunk-DOCTITOP.js} +2 -2
  26. package/dist/{chunk-WOQIHC67.js → chunk-DQY7NJ5L.js} +2 -2
  27. package/dist/{chunk-NMPEJV5M.js → chunk-DSLUOQDY.js} +2 -2
  28. package/dist/{chunk-A7EF2XRO.js → chunk-EXXBA5OM.js} +30 -8
  29. package/dist/chunk-EXXBA5OM.js.map +1 -0
  30. package/dist/{chunk-QXHBWFR3.js → chunk-IHG6CC7T.js} +2 -2
  31. package/dist/{chunk-4KDLCMLK.js → chunk-IROWLAWG.js} +5 -5
  32. package/dist/{chunk-ILXTATKK.js → chunk-J2HSAU72.js} +5 -5
  33. package/dist/chunk-J2HSAU72.js.map +1 -0
  34. package/dist/{chunk-DFAXGZKI.js → chunk-JIX3ZL2J.js} +8 -8
  35. package/dist/{chunk-GY3V3SUI.js → chunk-KHGE6PMF.js} +2 -2
  36. package/dist/{chunk-TGOOJCGA.js → chunk-LIERUFPO.js} +76 -54
  37. package/dist/chunk-LIERUFPO.js.map +1 -0
  38. package/dist/{chunk-HSCJYHYV.js → chunk-NLF54XMD.js} +49 -19
  39. package/dist/chunk-NLF54XMD.js.map +1 -0
  40. package/dist/{chunk-TWAJICBN.js → chunk-OHJFJ4HI.js} +2 -2
  41. package/dist/{chunk-WSQG37DV.js → chunk-OUWAQVDJ.js} +2 -2
  42. package/dist/{chunk-ZLDUQWT2.js → chunk-PWWWLD7D.js} +2 -2
  43. package/dist/{chunk-ZJH723NM.js → chunk-Q5ZU3RNY.js} +2 -2
  44. package/dist/{chunk-35HP3TGR.js → chunk-ROHLEUTH.js} +4 -4
  45. package/dist/{chunk-5RIRL3XL.js → chunk-RS25QOKZ.js} +2 -2
  46. package/dist/{chunk-RQGR3ETH.js → chunk-T2AN3BSP.js} +2 -2
  47. package/dist/{chunk-UAU5U5ML.js → chunk-UDJLF3BO.js} +2 -2
  48. package/dist/{chunk-ALEPI75L.js → chunk-VF4XKTX3.js} +6 -4
  49. package/dist/{chunk-ALEPI75L.js.map → chunk-VF4XKTX3.js.map} +1 -1
  50. package/dist/{chunk-AX5O25EF.js → chunk-VH6EIKVS.js} +152 -190
  51. package/dist/chunk-VH6EIKVS.js.map +1 -0
  52. package/dist/chunk-VS2IYZRU.js +43 -0
  53. package/dist/chunk-VS2IYZRU.js.map +1 -0
  54. package/dist/{chunk-YYQRVNSV.js → chunk-XB5P5P2L.js} +6 -6
  55. package/dist/{chunk-D2EFNQMY.js → chunk-XW3W4PV4.js} +2 -2
  56. package/dist/{chunk-5AYAZN45.js → chunk-YKX63GBK.js} +5 -5
  57. package/dist/{chunk-TYIXG4VR.js → chunk-YW52BQSU.js} +2 -2
  58. package/dist/{cli-C6twwe84.d.ts → cli-BQRqR9N-.d.ts} +12 -1
  59. package/dist/cli.d.ts +1 -1
  60. package/dist/cli.js +32 -28
  61. package/dist/compounding/engine.js +5 -4
  62. package/dist/connectors/codex-materialize-runner.js +5 -4
  63. package/dist/connectors/index.js +5 -4
  64. package/dist/consolidation-provenance-check.js +3 -2
  65. package/dist/consolidation-undo.js +2 -1
  66. package/dist/consolidation-undo.js.map +1 -1
  67. package/dist/entity-retrieval.js +5 -4
  68. package/dist/index.d.ts +1 -1
  69. package/dist/index.js +39 -36
  70. package/dist/index.js.map +1 -1
  71. package/dist/maintenance/memory-governance.js +6 -4
  72. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +5 -4
  73. package/dist/maintenance/rebuild-memory-projection.js +7 -5
  74. package/dist/namespaces/migrate.js +13 -11
  75. package/dist/namespaces/search.js +8 -6
  76. package/dist/namespaces/storage.js +5 -4
  77. package/dist/offline-sync.js +3 -2
  78. package/dist/operator-toolkit.js +16 -14
  79. package/dist/orchestrator.js +21 -19
  80. package/dist/page-versioning.js +2 -1
  81. package/dist/schemas.d.ts +22 -22
  82. package/dist/search/document-scanner.d.ts +11 -7
  83. package/dist/search/document-scanner.js +3 -1
  84. package/dist/search/factory.js +7 -5
  85. package/dist/search/index.js +7 -5
  86. package/dist/search/lancedb-backend.js +4 -2
  87. package/dist/search/meilisearch-backend.js +4 -2
  88. package/dist/search/orama-backend.js +4 -2
  89. package/dist/secure-store/index.js +3 -2
  90. package/dist/semantic-consolidation.js +6 -5
  91. package/dist/semantic-rule-promotion.js +5 -4
  92. package/dist/semantic-rule-verifier.js +5 -4
  93. package/dist/storage.d.ts +17 -3
  94. package/dist/storage.js +4 -3
  95. package/dist/transfer/capsule-import.js +3 -2
  96. package/dist/transfer/types.d.ts +12 -12
  97. package/dist/verified-recall.js +5 -4
  98. package/package.json +1 -1
  99. package/src/cli.ts +62 -23
  100. package/src/consolidation-provenance-check.ts +7 -6
  101. package/src/maintenance/memory-governance.ts +47 -7
  102. package/src/orchestrator.ts +84 -58
  103. package/src/page-versioning.ts +7 -4
  104. package/src/search/document-scanner.test.ts +29 -0
  105. package/src/search/document-scanner.ts +17 -29
  106. package/src/secure-store/secure-fs.ts +19 -5
  107. package/src/secure-store/secure-store.test.ts +28 -0
  108. package/src/storage.ts +42 -43
  109. package/src/training-export/converter.test.ts +19 -0
  110. package/src/training-export/converter.ts +8 -5
  111. package/src/utils/category-dir.ts +10 -4
  112. package/src/utils/path-containment.ts +40 -0
  113. package/dist/chunk-A7EF2XRO.js.map +0 -1
  114. package/dist/chunk-AL4RAJL5.js.map +0 -1
  115. package/dist/chunk-AX5O25EF.js.map +0 -1
  116. package/dist/chunk-HSCJYHYV.js.map +0 -1
  117. package/dist/chunk-ILXTATKK.js.map +0 -1
  118. package/dist/chunk-Q4CAQGKQ.js.map +0 -1
  119. package/dist/chunk-TGOOJCGA.js.map +0 -1
  120. /package/dist/{chunk-2KDQI363.js.map → chunk-2HEZXPYU.js.map} +0 -0
  121. /package/dist/{chunk-F6O7IOS3.js.map → chunk-6JBKHTQD.js.map} +0 -0
  122. /package/dist/{chunk-DHGSZ3UD.js.map → chunk-ARV3AUOM.js.map} +0 -0
  123. /package/dist/{chunk-PXVFMQLD.js.map → chunk-BZG2CWOQ.js.map} +0 -0
  124. /package/dist/{chunk-ANJOULTP.js.map → chunk-C7AF236A.js.map} +0 -0
  125. /package/dist/{chunk-FZC2WSDB.js.map → chunk-DOCTITOP.js.map} +0 -0
  126. /package/dist/{chunk-WOQIHC67.js.map → chunk-DQY7NJ5L.js.map} +0 -0
  127. /package/dist/{chunk-NMPEJV5M.js.map → chunk-DSLUOQDY.js.map} +0 -0
  128. /package/dist/{chunk-QXHBWFR3.js.map → chunk-IHG6CC7T.js.map} +0 -0
  129. /package/dist/{chunk-4KDLCMLK.js.map → chunk-IROWLAWG.js.map} +0 -0
  130. /package/dist/{chunk-DFAXGZKI.js.map → chunk-JIX3ZL2J.js.map} +0 -0
  131. /package/dist/{chunk-GY3V3SUI.js.map → chunk-KHGE6PMF.js.map} +0 -0
  132. /package/dist/{chunk-TWAJICBN.js.map → chunk-OHJFJ4HI.js.map} +0 -0
  133. /package/dist/{chunk-WSQG37DV.js.map → chunk-OUWAQVDJ.js.map} +0 -0
  134. /package/dist/{chunk-ZLDUQWT2.js.map → chunk-PWWWLD7D.js.map} +0 -0
  135. /package/dist/{chunk-ZJH723NM.js.map → chunk-Q5ZU3RNY.js.map} +0 -0
  136. /package/dist/{chunk-35HP3TGR.js.map → chunk-ROHLEUTH.js.map} +0 -0
  137. /package/dist/{chunk-5RIRL3XL.js.map → chunk-RS25QOKZ.js.map} +0 -0
  138. /package/dist/{chunk-RQGR3ETH.js.map → chunk-T2AN3BSP.js.map} +0 -0
  139. /package/dist/{chunk-UAU5U5ML.js.map → chunk-UDJLF3BO.js.map} +0 -0
  140. /package/dist/{chunk-YYQRVNSV.js.map → chunk-XB5P5P2L.js.map} +0 -0
  141. /package/dist/{chunk-D2EFNQMY.js.map → chunk-XW3W4PV4.js.map} +0 -0
  142. /package/dist/{chunk-5AYAZN45.js.map → chunk-YKX63GBK.js.map} +0 -0
  143. /package/dist/{chunk-TYIXG4VR.js.map → chunk-YW52BQSU.js.map} +0 -0
@@ -29,7 +29,7 @@ import {
29
29
  import {
30
30
  CompoundingEngine,
31
31
  defaultTierMigrationCycleBudget
32
- } from "./chunk-TWAJICBN.js";
32
+ } from "./chunk-OHJFJ4HI.js";
33
33
  import {
34
34
  SharedContextManager
35
35
  } from "./chunk-DRD2Q7HQ.js";
@@ -170,7 +170,7 @@ import {
170
170
  buildEntityRecallSection,
171
171
  entityRecentTranscriptLookbackHours,
172
172
  readRecentEntityTranscriptEntries
173
- } from "./chunk-RQGR3ETH.js";
173
+ } from "./chunk-T2AN3BSP.js";
174
174
  import {
175
175
  buildEventOrderRecallSection,
176
176
  shouldRecallEventOrderEvidence
@@ -205,7 +205,7 @@ import {
205
205
  materializeAfterSemanticConsolidation,
206
206
  parseConsolidationResponse,
207
207
  parseOperatorAwareConsolidationResponse
208
- } from "./chunk-D2EFNQMY.js";
208
+ } from "./chunk-XW3W4PV4.js";
209
209
  import {
210
210
  normalizeReplaySessionKey
211
211
  } from "./chunk-2PRQG7PV.js";
@@ -215,14 +215,14 @@ import {
215
215
  import {
216
216
  compareVerifiedEpisodeResults,
217
217
  searchVerifiedEpisodes
218
- } from "./chunk-TYIXG4VR.js";
218
+ } from "./chunk-YW52BQSU.js";
219
219
  import {
220
220
  ThreadingManager
221
221
  } from "./chunk-W4RVMTHR.js";
222
222
  import {
223
223
  compareVerifiedSemanticRuleResults,
224
224
  searchVerifiedSemanticRules
225
- } from "./chunk-NMPEJV5M.js";
225
+ } from "./chunk-DSLUOQDY.js";
226
226
  import {
227
227
  searchWorkProductLedgerEntries
228
228
  } from "./chunk-ZRWB5D4H.js";
@@ -236,7 +236,7 @@ import {
236
236
  NamespaceStorageRouter,
237
237
  resolveDefaultNamespaceRoot,
238
238
  resolveNamespaceStorageRoot
239
- } from "./chunk-TBLGI2LT.js";
239
+ } from "./chunk-7ILWCUWH.js";
240
240
  import {
241
241
  isAboveImportanceThreshold,
242
242
  scoreImportance
@@ -319,11 +319,11 @@ import {
319
319
  } from "./chunk-2MXEVL75.js";
320
320
  import {
321
321
  NamespaceSearchRouter
322
- } from "./chunk-WOQIHC67.js";
322
+ } from "./chunk-DQY7NJ5L.js";
323
323
  import {
324
324
  createConversationIndexRuntime,
325
325
  createSearchBackend
326
- } from "./chunk-35HP3TGR.js";
326
+ } from "./chunk-ROHLEUTH.js";
327
327
  import {
328
328
  NoopSearchBackend
329
329
  } from "./chunk-CYEPCZN5.js";
@@ -332,6 +332,9 @@ import {
332
332
  namespaceIdentityToken,
333
333
  normalizeNamespaceIdentity
334
334
  } from "./chunk-ZFXCQPNO.js";
335
+ import {
336
+ assertPathInsideRoot
337
+ } from "./chunk-5GPPACXK.js";
335
338
  import {
336
339
  writeConversationChunks
337
340
  } from "./chunk-OIF36KGD.js";
@@ -356,9 +359,8 @@ import {
356
359
  } from "./chunk-Y56J7CXW.js";
357
360
  import {
358
361
  buildChainFollowupGenerator
359
- } from "./chunk-GY3V3SUI.js";
362
+ } from "./chunk-KHGE6PMF.js";
360
363
  import {
361
- ALL_CATEGORY_DIRS,
362
364
  ContentHashIndex,
363
365
  StorageManager,
364
366
  compareEntityTimestamps,
@@ -366,7 +368,7 @@ import {
366
368
  normalizeAttributePairs,
367
369
  parseEntityFile,
368
370
  stripAttributesSuffix
369
- } from "./chunk-AX5O25EF.js";
371
+ } from "./chunk-VH6EIKVS.js";
370
372
  import {
371
373
  isValidTranscriptDate,
372
374
  loadSpeakerRegistry,
@@ -435,10 +437,15 @@ import {
435
437
  } from "./chunk-BJMBJZ2Y.js";
436
438
  import {
437
439
  SecureStoreLockedError
438
- } from "./chunk-ILXTATKK.js";
440
+ } from "./chunk-J2HSAU72.js";
439
441
  import {
440
442
  parseFlexibleIsoTimestamp
441
443
  } from "./chunk-P7FMDTKL.js";
444
+ import {
445
+ ALL_CATEGORY_DIRS,
446
+ RECALL_FALLBACK_DIRS,
447
+ categoryDirName
448
+ } from "./chunk-VS2IYZRU.js";
442
449
  import {
443
450
  buildRetrievedMemoryProvenance
444
451
  } from "./chunk-AC5LO7IU.js";
@@ -449,9 +456,11 @@ import os from "os";
449
456
  import { createHash as createHash2, randomBytes } from "crypto";
450
457
  import { existsSync, readFileSync } from "fs";
451
458
  import {
459
+ lstat as lstat3,
452
460
  mkdir as mkdir4,
453
461
  readdir as readdir3,
454
462
  readFile as readFile4,
463
+ realpath as realpath2,
455
464
  stat as stat3,
456
465
  unlink as unlink2,
457
466
  writeFile as writeFile4
@@ -4213,7 +4222,7 @@ function resolvePersistedMemoryRelativePath(options) {
4213
4222
  if (options.category === "correction") {
4214
4223
  return path4.join("corrections", `${options.memoryId}.md`);
4215
4224
  }
4216
- const subtree = options.category === "procedure" ? "procedures" : options.category === "reasoning_trace" ? "reasoning-traces" : "facts";
4225
+ const subtree = categoryDirName(options.category);
4217
4226
  const idParts = options.memoryId.split("-");
4218
4227
  const maybeTimestamp = Number(idParts[1]);
4219
4228
  if (Number.isFinite(maybeTimestamp) && maybeTimestamp > 0) {
@@ -6456,51 +6465,64 @@ ${evidenceText}`
6456
6465
  const now = options.now instanceof Date && Number.isFinite(options.now.getTime()) ? options.now : /* @__PURE__ */ new Date();
6457
6466
  const targetLocalDate = formatDateInTimeZone(now, timeZone);
6458
6467
  const datesToScan = utcDateKeysForLocalDay(now, timeZone);
6459
- const factsBaseDir = path4.join(storage.dir, "facts");
6460
6468
  const MAX_CHARS = 1e5;
6461
6469
  const facts = [];
6462
- for (const date of datesToScan) {
6463
- const factsDir = path4.join(factsBaseDir, date);
6464
- try {
6465
- const entries = await readdir3(factsDir, { withFileTypes: true });
6466
- for (const entry of entries) {
6467
- if (!entry.name.endsWith(".md")) continue;
6468
- const fullPath = path4.join(factsDir, entry.name);
6469
- try {
6470
- const raw = await readFile4(fullPath, "utf-8");
6471
- const fmMatch = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
6472
- if (!fmMatch) continue;
6473
- const fmBlock = fmMatch[1];
6474
- const content = fmMatch[2].trim();
6475
- const fm = {};
6476
- for (const line of fmBlock.split("\n")) {
6477
- const colonIdx = line.indexOf(":");
6478
- if (colonIdx === -1) continue;
6479
- fm[line.slice(0, colonIdx).trim()] = line.slice(colonIdx + 1).trim();
6480
- }
6481
- const created = fm.created || "unknown";
6482
- const createdAt = parseFiniteDate(created);
6483
- if (createdAt && formatDateInTimeZone(createdAt, timeZone) !== targetLocalDate) {
6484
- continue;
6470
+ let memoryRootReal = null;
6471
+ try {
6472
+ memoryRootReal = await realpath2(storage.dir);
6473
+ } catch {
6474
+ memoryRootReal = null;
6475
+ }
6476
+ for (const categoryDir of RECALL_FALLBACK_DIRS) {
6477
+ if (memoryRootReal === null) break;
6478
+ for (const date of datesToScan) {
6479
+ const dateDir = path4.join(storage.dir, categoryDir, date);
6480
+ try {
6481
+ const dirStat = await lstat3(dateDir);
6482
+ if (dirStat.isSymbolicLink() || !dirStat.isDirectory()) continue;
6483
+ assertPathInsideRoot(memoryRootReal, await realpath2(dateDir), dateDir);
6484
+ const entries = await readdir3(dateDir, { withFileTypes: true });
6485
+ for (const entry of entries) {
6486
+ if (entry.isSymbolicLink()) continue;
6487
+ if (!entry.name.endsWith(".md")) continue;
6488
+ const fullPath = path4.join(dateDir, entry.name);
6489
+ try {
6490
+ assertPathInsideRoot(memoryRootReal, await realpath2(fullPath), fullPath);
6491
+ const raw = await readFile4(fullPath, "utf-8");
6492
+ const fmMatch = raw.match(/^---\n([\s\S]*?)\n---\n?([\s\S]*)$/);
6493
+ if (!fmMatch) continue;
6494
+ const fmBlock = fmMatch[1];
6495
+ const content = fmMatch[2].trim();
6496
+ const fm = {};
6497
+ for (const line of fmBlock.split("\n")) {
6498
+ const colonIdx = line.indexOf(":");
6499
+ if (colonIdx === -1) continue;
6500
+ fm[line.slice(0, colonIdx).trim()] = line.slice(colonIdx + 1).trim();
6501
+ }
6502
+ const created = fm.created || "unknown";
6503
+ const createdAt = parseFiniteDate(created);
6504
+ if (createdAt && formatDateInTimeZone(createdAt, timeZone) !== targetLocalDate) {
6505
+ continue;
6506
+ }
6507
+ facts.push({
6508
+ path: fullPath,
6509
+ frontmatter: {
6510
+ id: fm.id || path4.basename(entry.name, ".md"),
6511
+ category: fm.category || "fact",
6512
+ created,
6513
+ updated: fm.updated || created,
6514
+ source: fm.source || "unknown",
6515
+ confidence: parseFloat(fm.confidence || "0.8"),
6516
+ confidenceTier: fm.confidenceTier || "implied",
6517
+ tags: []
6518
+ },
6519
+ content
6520
+ });
6521
+ } catch {
6485
6522
  }
6486
- facts.push({
6487
- path: fullPath,
6488
- frontmatter: {
6489
- id: fm.id || path4.basename(entry.name, ".md"),
6490
- category: fm.category || "fact",
6491
- created,
6492
- updated: fm.updated || created,
6493
- source: fm.source || "unknown",
6494
- confidence: parseFloat(fm.confidence || "0.8"),
6495
- confidenceTier: fm.confidenceTier || "implied",
6496
- tags: []
6497
- },
6498
- content
6499
- });
6500
- } catch {
6501
6523
  }
6524
+ } catch {
6502
6525
  }
6503
- } catch {
6504
6526
  }
6505
6527
  }
6506
6528
  facts.sort((a, b) => {
@@ -17335,4 +17357,4 @@ export {
17335
17357
  resolvePersistedMemoryRelativePath,
17336
17358
  Orchestrator
17337
17359
  };
17338
- //# sourceMappingURL=chunk-TGOOJCGA.js.map
17360
+ //# sourceMappingURL=chunk-LIERUFPO.js.map