@remnic/core 9.3.645 → 9.3.647

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 (98) hide show
  1. package/dist/access-cli.js +18 -17
  2. package/dist/access-cli.js.map +1 -1
  3. package/dist/access-http.js +13 -13
  4. package/dist/access-mcp.js +10 -10
  5. package/dist/access-schema.js +3 -3
  6. package/dist/access-service.js +8 -8
  7. package/dist/adapters/index.js +4 -4
  8. package/dist/adapters/registry.js +2 -2
  9. package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-GWVG7LGC.js} +2 -2
  10. package/dist/{chunk-6YLJZ2EU.js → chunk-3D6L7CEP.js} +92 -29
  11. package/dist/chunk-3D6L7CEP.js.map +1 -0
  12. package/dist/{chunk-3SF7QNKF.js → chunk-6BNFVP7Y.js} +2 -2
  13. package/dist/{chunk-AGNBY3VG.js → chunk-APJQ6UEA.js} +4 -4
  14. package/dist/{chunk-HRXCPKN4.js → chunk-APWJRJFW.js} +2 -2
  15. package/dist/{chunk-VDX2J7OX.js → chunk-BUKK5SWA.js} +2 -2
  16. package/dist/{chunk-T22TZJWJ.js → chunk-DC66QVL2.js} +2 -2
  17. package/dist/chunk-EVWIEEKZ.js +315 -0
  18. package/dist/chunk-EVWIEEKZ.js.map +1 -0
  19. package/dist/{chunk-IZXOO6NP.js → chunk-FAYDM5WD.js} +2 -2
  20. package/dist/{chunk-Y2XKJJEI.js → chunk-IMWFHBG2.js} +10 -33
  21. package/dist/chunk-IMWFHBG2.js.map +1 -0
  22. package/dist/{chunk-W5ISYSIL.js → chunk-L7W5YW6Y.js} +4 -4
  23. package/dist/{chunk-DGNQRNLL.js → chunk-NT5TINK5.js} +2 -2
  24. package/dist/{chunk-BXLOS5AJ.js → chunk-OWHERGF2.js} +2 -2
  25. package/dist/{chunk-CDHRUNBX.js → chunk-QKE4LHNR.js} +2 -2
  26. package/dist/{chunk-BTRL6GG7.js → chunk-RAELB5NX.js} +5 -5
  27. package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
  28. package/dist/chunk-S4DDLTPX.js +140 -0
  29. package/dist/chunk-S4DDLTPX.js.map +1 -0
  30. package/dist/{chunk-MBT3ASYV.js → chunk-TA4LQ5SR.js} +12 -12
  31. package/dist/{chunk-KVUG7FF7.js → chunk-U55D5UD5.js} +7 -7
  32. package/dist/{chunk-DQEMWVMT.js → chunk-UVYI6VIX.js} +1 -1
  33. package/dist/{chunk-D2B22JDF.js → chunk-WEPMT6SC.js} +7 -7
  34. package/dist/{chunk-IHG27THY.js → chunk-XUGQQPGO.js} +77 -61
  35. package/dist/chunk-XUGQQPGO.js.map +1 -0
  36. package/dist/{chunk-YOXCJP3A.js → chunk-ZPPFKVSD.js} +3 -3
  37. package/dist/cli.js +30 -28
  38. package/dist/{first-start-migration-FF7YFGRP.js → first-start-migration-PG5HBC3K.js} +4 -4
  39. package/dist/index.d.ts +2 -0
  40. package/dist/index.js +77 -63
  41. package/dist/index.js.map +1 -1
  42. package/dist/lcm/engine.js +3 -3
  43. package/dist/lcm/index.js +11 -11
  44. package/dist/namespaces/migrate.js +5 -5
  45. package/dist/namespaces/search.js +4 -4
  46. package/dist/operator-toolkit.js +6 -6
  47. package/dist/orchestrator.js +14 -13
  48. package/dist/resume-bundles.js +3 -2
  49. package/dist/schemas.d.ts +22 -22
  50. package/dist/search/factory.js +3 -3
  51. package/dist/search/index.js +7 -7
  52. package/dist/session-identity.d.ts +118 -0
  53. package/dist/session-identity.js +21 -0
  54. package/dist/session-identity.js.map +1 -0
  55. package/dist/session-transcript-migration.d.ts +65 -0
  56. package/dist/session-transcript-migration.js +16 -0
  57. package/dist/session-transcript-migration.js.map +1 -0
  58. package/dist/summarizer.js +2 -1
  59. package/dist/transcript.d.ts +18 -6
  60. package/dist/transcript.js +2 -1
  61. package/dist/transfer/backup.js +2 -2
  62. package/dist/transfer/capsule-export.js +2 -2
  63. package/dist/transfer/capsule-import.js +2 -2
  64. package/dist/transfer/import-sqlite.js +2 -2
  65. package/dist/transfer/types.d.ts +12 -12
  66. package/package.json +1 -1
  67. package/src/cli.ts +79 -0
  68. package/src/index.ts +18 -0
  69. package/src/session-identity.test.ts +130 -0
  70. package/src/session-identity.ts +281 -0
  71. package/src/session-transcript-migration.test.ts +350 -0
  72. package/src/session-transcript-migration.ts +527 -0
  73. package/src/summarizer.ts +15 -35
  74. package/src/transcript-session-identity.test.ts +424 -0
  75. package/src/transcript.test.ts +110 -0
  76. package/src/transcript.ts +121 -73
  77. package/dist/chunk-6YLJZ2EU.js.map +0 -1
  78. package/dist/chunk-IHG27THY.js.map +0 -1
  79. package/dist/chunk-Y2XKJJEI.js.map +0 -1
  80. /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-GWVG7LGC.js.map} +0 -0
  81. /package/dist/{chunk-3SF7QNKF.js.map → chunk-6BNFVP7Y.js.map} +0 -0
  82. /package/dist/{chunk-AGNBY3VG.js.map → chunk-APJQ6UEA.js.map} +0 -0
  83. /package/dist/{chunk-HRXCPKN4.js.map → chunk-APWJRJFW.js.map} +0 -0
  84. /package/dist/{chunk-VDX2J7OX.js.map → chunk-BUKK5SWA.js.map} +0 -0
  85. /package/dist/{chunk-T22TZJWJ.js.map → chunk-DC66QVL2.js.map} +0 -0
  86. /package/dist/{chunk-IZXOO6NP.js.map → chunk-FAYDM5WD.js.map} +0 -0
  87. /package/dist/{chunk-W5ISYSIL.js.map → chunk-L7W5YW6Y.js.map} +0 -0
  88. /package/dist/{chunk-DGNQRNLL.js.map → chunk-NT5TINK5.js.map} +0 -0
  89. /package/dist/{chunk-BXLOS5AJ.js.map → chunk-OWHERGF2.js.map} +0 -0
  90. /package/dist/{chunk-CDHRUNBX.js.map → chunk-QKE4LHNR.js.map} +0 -0
  91. /package/dist/{chunk-BTRL6GG7.js.map → chunk-RAELB5NX.js.map} +0 -0
  92. /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
  93. /package/dist/{chunk-MBT3ASYV.js.map → chunk-TA4LQ5SR.js.map} +0 -0
  94. /package/dist/{chunk-KVUG7FF7.js.map → chunk-U55D5UD5.js.map} +0 -0
  95. /package/dist/{chunk-DQEMWVMT.js.map → chunk-UVYI6VIX.js.map} +0 -0
  96. /package/dist/{chunk-D2B22JDF.js.map → chunk-WEPMT6SC.js.map} +0 -0
  97. /package/dist/{chunk-YOXCJP3A.js.map → chunk-ZPPFKVSD.js.map} +0 -0
  98. /package/dist/{first-start-migration-FF7YFGRP.js.map → first-start-migration-PG5HBC3K.js.map} +0 -0
@@ -1,12 +1,11 @@
1
+ import {
2
+ sessionStoragePaths
3
+ } from "./chunk-S4DDLTPX.js";
1
4
  import {
2
5
  analyzeSessionIntegrity
3
6
  } from "./chunk-KFY3SGN7.js";
4
7
  import {
5
- encodeStoragePathSegment,
6
- encodeStoragePathSegmentWithHash,
7
- isSafeLegacyPathSegment,
8
- resolveSafeStoragePath,
9
- storagePathHash
8
+ resolveSafeStoragePath
10
9
  } from "./chunk-FF4KLI5W.js";
11
10
  import {
12
11
  log
@@ -15,12 +14,13 @@ import {
15
14
  // src/transcript.ts
16
15
  import { appendFile, mkdir, readdir, readFile, stat, unlink, writeFile } from "fs/promises";
17
16
  import path from "path";
18
- function legacyTranscriptDirFor(channelType, channelId, encodedDir) {
19
- if (!isSafeLegacyPathSegment(channelType) || !isSafeLegacyPathSegment(channelId)) {
20
- return void 0;
21
- }
22
- const legacyDir = path.join(channelType, channelId);
23
- return legacyDir === encodedDir ? void 0 : legacyDir;
17
+ function makeRawLineDeduper() {
18
+ const seen = /* @__PURE__ */ new Set();
19
+ return (rawLine) => {
20
+ if (seen.has(rawLine)) return false;
21
+ seen.add(rawLine);
22
+ return true;
23
+ };
24
24
  }
25
25
  var TranscriptManager = class _TranscriptManager {
26
26
  transcriptsDir;
@@ -42,50 +42,31 @@ var TranscriptManager = class _TranscriptManager {
42
42
  this.toolUsageDir = path.join(this.stateDir, "tool-usage");
43
43
  }
44
44
  /**
45
- * Parse a sessionKey to extract channel type and ID.
45
+ * Resolve the storage path pieces for a sessionKey via the shared
46
+ * {@link sessionStoragePaths} helper (issue #1496, rule #22).
46
47
  *
47
- * SessionKey patterns:
48
- * - agent:<agent-id>:main type="main", id="default"
49
- * - agent:<agent-id>:discord:channel:<channel-id> type="discord", id="<channel-id>"
50
- * - agent:<agent-id>:cron:<job-id> type="cron", id="<job-id>"
51
- * - agent:<agent-id>:slack:channel:<channel-id> type="slack", id="<channel-id>"
48
+ * Legacy `agent:<id>:...` shapes keep their existing readable channel paths.
49
+ * Arbitrary / non-legacy keys (e.g. `pi-geek:abc123`) route to
50
+ * `transcripts/session/<hash>/YYYY-MM-DD.jsonl` from the FIRST write — they
51
+ * never start life in `other/default`. For those keys a list of
52
+ * read-back-only `readbackDirs` is returned so data written by older builds
53
+ * (under `other/default`, or under an old `parts.length >= 3` directory such
54
+ * as `baz/default`) stays discoverable until migrated. New writes never
55
+ * target read-back dirs. See `session-identity.ts`.
52
56
  *
53
57
  * @returns Object with raw channel identifiers and encoded storage path pieces.
54
58
  */
55
59
  getTranscriptPath(sessionKey) {
56
- const parts = sessionKey.split(":");
57
- let channelType = "other";
58
- let channelId = "default";
59
- if (parts.length >= 3) {
60
- channelType = parts[2];
61
- if (channelType === "main") {
62
- channelId = "default";
63
- } else if (channelType === "discord" && parts.length >= 5 && parts[3] === "channel") {
64
- channelId = parts[4];
65
- } else if (channelType === "slack" && parts.length >= 5 && parts[3] === "channel") {
66
- channelId = parts[4];
67
- } else if (channelType === "cron" && parts.length >= 4) {
68
- channelId = parts[3];
69
- } else if (parts.length >= 4) {
70
- channelId = parts[3];
71
- }
72
- }
60
+ const paths = sessionStoragePaths(sessionKey);
73
61
  const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
74
- const dir = path.join(
75
- encodeStoragePathSegment(channelType),
76
- encodeStoragePathSegment(channelId)
77
- );
78
- const alternateDir = path.join(
79
- encodeStoragePathSegmentWithHash(channelType),
80
- `${encodeStoragePathSegmentWithHash(channelId)}--session-${storagePathHash(sessionKey)}`
81
- );
82
62
  return {
83
- dir,
63
+ dir: paths.dir,
84
64
  file: `${today}.jsonl`,
85
- channelType,
86
- channelId,
87
- alternateDir,
88
- legacyDir: legacyTranscriptDirFor(channelType, channelId, dir)
65
+ channelType: paths.channelType,
66
+ channelId: paths.channelId,
67
+ alternateDir: paths.alternateDir,
68
+ legacyDir: paths.legacyDir,
69
+ readbackDirs: paths.readbackDirs
89
70
  };
90
71
  }
91
72
  /**
@@ -136,7 +117,13 @@ var TranscriptManager = class _TranscriptManager {
136
117
  }
137
118
  getToolUsagePath(sessionKey) {
138
119
  const p = this.getTranscriptPath(sessionKey);
139
- return { dir: p.dir, file: p.file, alternateDir: p.alternateDir, legacyDir: p.legacyDir };
120
+ return {
121
+ dir: p.dir,
122
+ file: p.file,
123
+ alternateDir: p.alternateDir,
124
+ legacyDir: p.legacyDir,
125
+ readbackDirs: p.readbackDirs
126
+ };
140
127
  }
141
128
  async selectStorageDirForWrite(root, dir, legacyDir, sessionKey, alternateDir) {
142
129
  const channelDir = await resolveSafeStoragePath(root, dir);
@@ -247,10 +234,10 @@ var TranscriptManager = class _TranscriptManager {
247
234
  } catch {
248
235
  }
249
236
  }
250
- async getSessionStorageFiles(root, dir, legacyDir, alternateDir) {
237
+ async getSessionStorageFiles(root, dir, legacyDir, alternateDir, readbackDirs = []) {
251
238
  const files = [];
252
239
  const seenDirs = /* @__PURE__ */ new Set();
253
- for (const candidateDir of [dir, alternateDir, legacyDir]) {
240
+ for (const candidateDir of [dir, alternateDir, legacyDir, ...readbackDirs]) {
254
241
  if (!candidateDir || seenDirs.has(candidateDir)) continue;
255
242
  seenDirs.add(candidateDir);
256
243
  let channelDir;
@@ -292,10 +279,17 @@ var TranscriptManager = class _TranscriptManager {
292
279
  await this.rememberDirectoryOwnership(this.toolUsageDir, writeDir, entry.sessionKey);
293
280
  }
294
281
  async readToolUse(sessionKey, startTime, endTime) {
295
- const { dir, alternateDir, legacyDir } = this.getToolUsagePath(sessionKey);
282
+ const { dir, alternateDir, legacyDir, readbackDirs } = this.getToolUsagePath(sessionKey);
296
283
  try {
297
- const files = await this.getSessionStorageFiles(this.toolUsageDir, dir, legacyDir, alternateDir);
284
+ const files = await this.getSessionStorageFiles(
285
+ this.toolUsageDir,
286
+ dir,
287
+ legacyDir,
288
+ alternateDir,
289
+ readbackDirs
290
+ );
298
291
  const out = [];
292
+ const keepRawLine = makeRawLineDeduper();
299
293
  for (const file of files) {
300
294
  const raw = await readFile(file.path, "utf-8");
301
295
  for (const line of raw.split("\n")) {
@@ -306,7 +300,7 @@ var TranscriptManager = class _TranscriptManager {
306
300
  if (!Number.isFinite(ts)) continue;
307
301
  if (ts >= startTime.getTime() && ts < endTime.getTime()) {
308
302
  if (typeof obj.tool === "string" && typeof obj.sessionKey === "string") {
309
- if (obj.sessionKey === sessionKey) {
303
+ if (obj.sessionKey === sessionKey && keepRawLine(line)) {
310
304
  out.push({ timestamp: obj.timestamp, sessionKey: obj.sessionKey, tool: obj.tool });
311
305
  }
312
306
  }
@@ -321,10 +315,16 @@ var TranscriptManager = class _TranscriptManager {
321
315
  }
322
316
  }
323
317
  async estimateSessionFootprint(sessionKey) {
324
- const { dir, alternateDir, legacyDir } = this.getTranscriptPath(sessionKey);
318
+ const { dir, alternateDir, legacyDir, readbackDirs } = this.getTranscriptPath(sessionKey);
325
319
  let bytes = 0;
326
320
  try {
327
- const files = await this.getSessionStorageFiles(this.transcriptsDir, dir, legacyDir, alternateDir);
321
+ const files = await this.getSessionStorageFiles(
322
+ this.transcriptsDir,
323
+ dir,
324
+ legacyDir,
325
+ alternateDir,
326
+ readbackDirs
327
+ );
328
328
  const cached = this.sessionFootprintCache.get(sessionKey);
329
329
  if (!cached) {
330
330
  const fileBytes = /* @__PURE__ */ new Map();
@@ -489,11 +489,18 @@ var TranscriptManager = class _TranscriptManager {
489
489
  * Read transcript entries for a date range.
490
490
  * Returns entries within the time range, optionally filtered by sessionKey.
491
491
  * Reads from all channel subdirectories in the hierarchical structure.
492
+ *
493
+ * The window is half-open `[start, end)`: the upper bound is exclusive so
494
+ * caller-specified ranges (explicit dates, analytics buckets) don't
495
+ * double-count at shared boundaries (CLAUDE.md rule #35 / AGENTS.md rule 23).
496
+ * readRecent's inclusive-of-now behavior is handled by readRecent itself
497
+ * extending its end, not by relaxing this bound.
492
498
  */
493
499
  async readRange(startTime, endTime, sessionKey) {
494
500
  const start = new Date(startTime);
495
501
  const end = new Date(endTime);
496
502
  const entries = [];
503
+ const keepRawLine = sessionKey ? makeRawLineDeduper() : void 0;
497
504
  try {
498
505
  const transcriptFiles = await this.getAllTranscriptFiles();
499
506
  for (const relativePath of transcriptFiles) {
@@ -507,6 +514,7 @@ var TranscriptManager = class _TranscriptManager {
507
514
  const entryTime = new Date(entry.timestamp);
508
515
  if (entryTime >= start && entryTime < end) {
509
516
  if (!sessionKey || entry.sessionKey === sessionKey) {
517
+ if (keepRawLine && !keepRawLine(line)) continue;
510
518
  entries.push(entry);
511
519
  }
512
520
  }
@@ -532,8 +540,9 @@ var TranscriptManager = class _TranscriptManager {
532
540
  * specific channel instead of scanning all 95+ transcript files across all channels.
533
541
  */
534
542
  async readRecent(hours, sessionKey) {
535
- const end = /* @__PURE__ */ new Date();
536
- const start = new Date(end.getTime() - hours * 60 * 60 * 1e3);
543
+ const now = /* @__PURE__ */ new Date();
544
+ const end = new Date(now.getTime() + 1);
545
+ const start = new Date(now.getTime() - hours * 60 * 60 * 1e3);
537
546
  if (sessionKey) {
538
547
  return this.readRecentForSession(start, end, sessionKey);
539
548
  }
@@ -544,7 +553,7 @@ var TranscriptManager = class _TranscriptManager {
544
553
  * directory and only reads files whose date falls within the lookback window.
545
554
  */
546
555
  async readRecentForSession(start, end, sessionKey) {
547
- const { dir, alternateDir, legacyDir } = this.getTranscriptPath(sessionKey);
556
+ const { dir, alternateDir, legacyDir, readbackDirs } = this.getTranscriptPath(sessionKey);
548
557
  const dateStrings = /* @__PURE__ */ new Set();
549
558
  const cursor = new Date(start);
550
559
  while (cursor <= end) {
@@ -553,7 +562,14 @@ var TranscriptManager = class _TranscriptManager {
553
562
  }
554
563
  dateStrings.add(end.toISOString().slice(0, 10));
555
564
  const entries = [];
556
- const files = await this.getSessionStorageFiles(this.transcriptsDir, dir, legacyDir, alternateDir);
565
+ const files = await this.getSessionStorageFiles(
566
+ this.transcriptsDir,
567
+ dir,
568
+ legacyDir,
569
+ alternateDir,
570
+ readbackDirs
571
+ );
572
+ const keepRawLine = makeRawLineDeduper();
557
573
  for (const file of files) {
558
574
  const dateStr = file.name.slice(0, 10);
559
575
  if (!dateStrings.has(dateStr)) continue;
@@ -564,7 +580,7 @@ var TranscriptManager = class _TranscriptManager {
564
580
  try {
565
581
  const entry = JSON.parse(line);
566
582
  const ts = new Date(entry.timestamp);
567
- if (ts >= start && ts < end && entry.sessionKey === sessionKey) {
583
+ if (ts >= start && ts < end && entry.sessionKey === sessionKey && keepRawLine(line)) {
568
584
  entries.push(entry);
569
585
  }
570
586
  } catch {
@@ -911,4 +927,4 @@ var TranscriptManager = class _TranscriptManager {
911
927
  export {
912
928
  TranscriptManager
913
929
  };
914
- //# sourceMappingURL=chunk-IHG27THY.js.map
930
+ //# sourceMappingURL=chunk-XUGQQPGO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/transcript.ts"],"sourcesContent":["import { appendFile, mkdir, readdir, readFile, stat, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { log } from \"./logger.js\";\nimport type { TranscriptEntry, Checkpoint, PluginConfig } from \"./types.js\";\nimport { analyzeSessionIntegrity, type SessionIntegrityReport } from \"./session-integrity.js\";\nimport { resolveSafeStoragePath } from \"./storage-paths.js\";\nimport { sessionStoragePaths } from \"./session-identity.js\";\n\ntype DirectorySessionStatus = \"missing\" | \"empty\" | \"matches\" | \"occupied\";\ntype DirectoryOwnershipCacheEntry = {\n status: \"empty\" | \"matches\";\n fileSizes: Map<string, number>;\n};\n\n/**\n * De-duplicate JSONL lines collected across multiple read-back candidate\n * directories. A partially-applied migration (issue #1496) can leave the SAME\n * raw row in both the primary `session/<hash>` tree and a legacy read-back dir\n * (`other/default` or an old `parts.length >= 3` directory) when the source was\n * copied but not yet trimmed. Without this guard, `readRecent`, `readToolUse`,\n * footprint estimation, and the summarizer fetch would return that row twice\n * (cursor review on PR #1504). The exact raw JSONL line is the stable identity:\n * the migration preserves byte content per session, so a copied-but-not-trimmed\n * row is byte-identical in both locations. Returns `true` the first time a line\n * is seen, `false` for every subsequent duplicate.\n */\nfunction makeRawLineDeduper(): (rawLine: string) => boolean {\n const seen = new Set<string>();\n return (rawLine: string): boolean => {\n if (seen.has(rawLine)) return false;\n seen.add(rawLine);\n return true;\n };\n}\n\n/**\n * Manages conversation transcript storage, checkpointing, and recall formatting.\n *\n * Transcripts are stored as JSONL files in a hierarchical structure:\n * transcripts/{channelType}/{channelId}.jsonl\n *\n * Channel types are extracted from sessionKey (discord, slack, cron, main, etc.)\n * Checkpoints are used to preserve conversation context across compaction events.\n */\nexport class TranscriptManager {\n private transcriptsDir: string;\n private checkpointPath: string;\n private stateDir: string;\n private toolUsageDir: string;\n private config: PluginConfig;\n private sessionFootprintCache = new Map<\n string,\n { totalBytes: number; fileBytes: Map<string, number>; fileSizes: Map<string, number> }\n >();\n private directoryOwnershipCache = new Map<string, DirectoryOwnershipCacheEntry>();\n\n /** Default checkpoint TTL in hours */\n private static readonly DEFAULT_CHECKPOINT_TTL_HOURS = 24;\n /** Approximate characters per token for rough estimation */\n private static readonly CHARS_PER_TOKEN = 4;\n\n constructor(config: PluginConfig) {\n this.config = config;\n this.transcriptsDir = path.join(config.memoryDir, \"transcripts\");\n this.stateDir = path.join(config.memoryDir, \"state\");\n this.checkpointPath = path.join(this.stateDir, \"checkpoint.json\");\n this.toolUsageDir = path.join(this.stateDir, \"tool-usage\");\n }\n\n /**\n * Resolve the storage path pieces for a sessionKey via the shared\n * {@link sessionStoragePaths} helper (issue #1496, rule #22).\n *\n * Legacy `agent:<id>:...` shapes keep their existing readable channel paths.\n * Arbitrary / non-legacy keys (e.g. `pi-geek:abc123`) route to\n * `transcripts/session/<hash>/YYYY-MM-DD.jsonl` from the FIRST write — they\n * never start life in `other/default`. For those keys a list of\n * read-back-only `readbackDirs` is returned so data written by older builds\n * (under `other/default`, or under an old `parts.length >= 3` directory such\n * as `baz/default`) stays discoverable until migrated. New writes never\n * target read-back dirs. See `session-identity.ts`.\n *\n * @returns Object with raw channel identifiers and encoded storage path pieces.\n */\n getTranscriptPath(sessionKey: string): {\n dir: string;\n file: string;\n channelType: string;\n channelId: string;\n alternateDir: string;\n legacyDir?: string;\n readbackDirs: string[];\n } {\n const paths = sessionStoragePaths(sessionKey);\n\n // Daily rotation: transcripts/{channelType}/{channelId}/YYYY-MM-DD.jsonl\n const today = new Date().toISOString().slice(0, 10);\n\n return {\n dir: paths.dir,\n file: `${today}.jsonl`,\n channelType: paths.channelType,\n channelId: paths.channelId,\n alternateDir: paths.alternateDir,\n legacyDir: paths.legacyDir,\n readbackDirs: paths.readbackDirs,\n };\n }\n\n /**\n * Initialize the transcript manager by ensuring directories exist.\n */\n async initialize(): Promise<void> {\n await mkdir(this.transcriptsDir, { recursive: true });\n await mkdir(this.stateDir, { recursive: true });\n await mkdir(this.toolUsageDir, { recursive: true });\n log.info(\"transcript manager initialized\");\n }\n\n /**\n * Best-effort list of sessionKeys that have transcript files on disk.\n * This is used by cron-style tooling (hourly summaries, conversation indexing)\n * to iterate across \"active\" sessions.\n */\n async listSessionKeys(): Promise<string[]> {\n const transcriptDir = this.transcriptsDir;\n const sessionKeys = new Set<string>();\n\n try {\n const typeEntries = await readdir(transcriptDir, { withFileTypes: true });\n for (const typeEnt of typeEntries) {\n if (!typeEnt.isDirectory()) continue;\n const typeDir = path.join(transcriptDir, typeEnt.name);\n const idEntries = await readdir(typeDir, { withFileTypes: true });\n for (const idEnt of idEntries) {\n if (!idEnt.isDirectory()) continue;\n const chanDir = path.join(typeDir, idEnt.name);\n const files = (await readdir(chanDir)).filter((f) => f.endsWith(\".jsonl\")).sort();\n const last = files[files.length - 1];\n if (!last) continue;\n try {\n const raw = await readFile(path.join(chanDir, last), \"utf-8\");\n const firstLine = raw.split(\"\\n\").find((l) => l.trim().length > 0);\n if (!firstLine) continue;\n const entry = JSON.parse(firstLine) as TranscriptEntry;\n if (typeof entry.sessionKey === \"string\" && entry.sessionKey.length > 0) {\n sessionKeys.add(entry.sessionKey);\n }\n } catch {\n // ignore\n }\n }\n }\n } catch {\n return [];\n }\n\n return Array.from(sessionKeys);\n }\n\n getToolUsagePath(sessionKey: string): {\n dir: string;\n file: string;\n alternateDir: string;\n legacyDir?: string;\n readbackDirs: string[];\n } {\n const p = this.getTranscriptPath(sessionKey);\n return {\n dir: p.dir,\n file: p.file,\n alternateDir: p.alternateDir,\n legacyDir: p.legacyDir,\n readbackDirs: p.readbackDirs,\n };\n }\n\n private async selectStorageDirForWrite(\n root: string,\n dir: string,\n legacyDir?: string,\n sessionKey?: string,\n alternateDir?: string,\n ): Promise<{ dir: string; channelDir: string }> {\n const channelDir = await resolveSafeStoragePath(root, dir);\n const encodedStatus = await this.directorySessionStatus(root, dir, sessionKey);\n if (encodedStatus === \"matches\" || encodedStatus === \"empty\") return { dir, channelDir };\n\n if (legacyDir) {\n const legacyChannelDir = await resolveSafeStoragePath(root, legacyDir);\n if ((await this.directorySessionStatus(root, legacyDir, sessionKey)) === \"matches\") {\n return { dir: legacyDir, channelDir: legacyChannelDir };\n }\n }\n\n if (encodedStatus === \"missing\") return { dir, channelDir };\n\n if (alternateDir) {\n const alternateChannelDir = await resolveSafeStoragePath(root, alternateDir);\n const alternateStatus = await this.directorySessionStatus(root, alternateDir, sessionKey);\n if (\n alternateStatus === \"missing\" ||\n alternateStatus === \"empty\" ||\n alternateStatus === \"matches\"\n ) {\n return { dir: alternateDir, channelDir: alternateChannelDir };\n }\n }\n\n throw new Error(`transcript storage path collision for session: ${sessionKey ?? \"(unknown)\"}`);\n }\n\n private async directorySessionStatus(\n root: string,\n dir: string,\n sessionKey?: string,\n ): Promise<DirectorySessionStatus> {\n let channelDir: string;\n try {\n channelDir = await resolveSafeStoragePath(root, dir);\n if (!(await stat(channelDir)).isDirectory()) return \"occupied\";\n } catch (err) {\n const code =\n err && typeof err === \"object\" && \"code\" in err\n ? (err as { code?: string }).code\n : undefined;\n if (code === \"ENOENT\") return \"missing\";\n throw err;\n }\n\n let names: string[];\n try {\n names = (await readdir(channelDir)).filter((file) => file.endsWith(\".jsonl\"));\n } catch {\n return \"occupied\";\n }\n\n const fileSizes = await this.directoryJsonlFileSizes(root, dir, names);\n if (!fileSizes) return \"occupied\";\n\n if (!sessionKey) return \"matches\";\n const cacheKey = this.directoryOwnershipCacheKey(root, dir, sessionKey);\n const cached = this.directoryOwnershipCache.get(cacheKey);\n if (cached && this.sameFileSizes(cached.fileSizes, fileSizes)) {\n return cached.status;\n }\n\n let hasEntries = false;\n let hasMatchingEntry = false;\n\n for (const name of names) {\n const filePath = await resolveSafeStoragePath(root, dir, name).catch(() => null);\n if (filePath === null) return \"occupied\";\n try {\n const raw = await readFile(filePath, \"utf-8\");\n for (const line of raw.split(\"\\n\")) {\n if (!line.trim()) continue;\n hasEntries = true;\n try {\n const obj = JSON.parse(line) as { sessionKey?: string };\n if (obj.sessionKey === sessionKey) {\n hasMatchingEntry = true;\n } else {\n return \"occupied\";\n }\n } catch {\n return \"occupied\";\n }\n }\n } catch {\n return \"occupied\";\n }\n }\n\n const status = hasMatchingEntry ? \"matches\" : hasEntries ? \"occupied\" : \"empty\";\n if (status === \"matches\" || status === \"empty\") {\n this.directoryOwnershipCache.set(cacheKey, { status, fileSizes });\n }\n return status;\n }\n\n private directoryOwnershipCacheKey(root: string, dir: string, sessionKey: string): string {\n return `${path.resolve(root)}\\0${dir}\\0${sessionKey}`;\n }\n\n private sameFileSizes(left: Map<string, number>, right: Map<string, number>): boolean {\n if (left.size !== right.size) return false;\n for (const [name, size] of left) {\n if (right.get(name) !== size) return false;\n }\n return true;\n }\n\n private async directoryJsonlFileSizes(\n root: string,\n dir: string,\n names: string[],\n ): Promise<Map<string, number> | null> {\n const fileSizes = new Map<string, number>();\n for (const name of names) {\n const filePath = await resolveSafeStoragePath(root, dir, name).catch(() => null);\n if (filePath === null) return null;\n const fileInfo = await stat(filePath).catch(() => null);\n if (!fileInfo?.isFile()) return null;\n fileSizes.set(name, Math.max(0, fileInfo.size));\n }\n return fileSizes;\n }\n\n private async rememberDirectoryOwnership(\n root: string,\n dir: string,\n sessionKey: string,\n ): Promise<void> {\n try {\n const channelDir = await resolveSafeStoragePath(root, dir);\n const names = (await readdir(channelDir)).filter((file) => file.endsWith(\".jsonl\"));\n const fileSizes = await this.directoryJsonlFileSizes(root, dir, names);\n if (!fileSizes) return;\n this.directoryOwnershipCache.set(\n this.directoryOwnershipCacheKey(root, dir, sessionKey),\n { status: \"matches\", fileSizes },\n );\n } catch {\n // Cache refresh is best-effort; write path correctness does not depend on it.\n }\n }\n\n private async getSessionStorageFiles(\n root: string,\n dir: string,\n legacyDir?: string,\n alternateDir?: string,\n readbackDirs: string[] = [],\n ): Promise<Array<{ cacheKey: string; name: string; path: string }>> {\n const files: Array<{ cacheKey: string; name: string; path: string }> = [];\n const seenDirs = new Set<string>();\n\n for (const candidateDir of [dir, alternateDir, legacyDir, ...readbackDirs]) {\n if (!candidateDir || seenDirs.has(candidateDir)) continue;\n seenDirs.add(candidateDir);\n\n let channelDir: string;\n try {\n channelDir = await resolveSafeStoragePath(root, candidateDir);\n } catch {\n continue;\n }\n\n let names: string[];\n try {\n names = (await readdir(channelDir)).filter((file) => file.endsWith(\".jsonl\")).sort();\n } catch {\n continue;\n }\n\n for (const name of names) {\n const filePath = await resolveSafeStoragePath(root, candidateDir, name).catch(() => null);\n if (filePath === null) continue;\n files.push({\n cacheKey: path.join(candidateDir, name),\n name,\n path: filePath,\n });\n }\n }\n\n return files.sort((a, b) => a.cacheKey.localeCompare(b.cacheKey));\n }\n\n async appendToolUse(entry: { timestamp: string; sessionKey: string; tool: string }): Promise<void> {\n const { dir, file, alternateDir, legacyDir } = this.getToolUsagePath(entry.sessionKey);\n const { dir: writeDir, channelDir } = await this.selectStorageDirForWrite(\n this.toolUsageDir,\n dir,\n legacyDir,\n entry.sessionKey,\n alternateDir,\n );\n await mkdir(channelDir, { recursive: true });\n const filePath = await resolveSafeStoragePath(this.toolUsageDir, writeDir, file);\n await appendFile(filePath, JSON.stringify(entry) + \"\\n\", \"utf-8\");\n await this.rememberDirectoryOwnership(this.toolUsageDir, writeDir, entry.sessionKey);\n }\n\n async readToolUse(\n sessionKey: string,\n startTime: Date,\n endTime: Date,\n ): Promise<Array<{ timestamp: string; sessionKey: string; tool: string }>> {\n const { dir, alternateDir, legacyDir, readbackDirs } = this.getToolUsagePath(sessionKey);\n try {\n const files = await this.getSessionStorageFiles(\n this.toolUsageDir,\n dir,\n legacyDir,\n alternateDir,\n readbackDirs,\n );\n const out: Array<{ timestamp: string; sessionKey: string; tool: string }> = [];\n // Dedup identical raw rows that a partially-applied migration may have left\n // in both the primary dir and a read-back dir (issue #1496, cursor review).\n const keepRawLine = makeRawLineDeduper();\n for (const file of files) {\n const raw = await readFile(file.path, \"utf-8\");\n for (const line of raw.split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n const obj = JSON.parse(line) as any;\n const ts = new Date(String(obj.timestamp ?? \"\")).getTime();\n if (!Number.isFinite(ts)) continue;\n if (ts >= startTime.getTime() && ts < endTime.getTime()) {\n if (typeof obj.tool === \"string\" && typeof obj.sessionKey === \"string\") {\n if (obj.sessionKey === sessionKey && keepRawLine(line)) {\n out.push({ timestamp: obj.timestamp, sessionKey: obj.sessionKey, tool: obj.tool });\n }\n }\n }\n } catch {\n // ignore\n }\n }\n }\n return out;\n } catch {\n return [];\n }\n }\n\n async estimateSessionFootprint(sessionKey: string): Promise<{ bytes: number; tokens: number }> {\n const { dir, alternateDir, legacyDir, readbackDirs } = this.getTranscriptPath(sessionKey);\n let bytes = 0;\n\n // NOTE: this is a best-effort byte ESTIMATE for compaction sizing, not an\n // exact row count, and is maintained via an incremental per-file cache. A\n // copied-but-not-trimmed migration window (issue #1496) can transiently\n // over-estimate by counting a duplicated row in both the primary and a\n // read-back dir; that self-heals once the migration trims the source. The\n // exact-once guarantee that matters for callers lives in readRecent /\n // readToolUse / the summarizer fetch, which dedup by raw line.\n try {\n const files = await this.getSessionStorageFiles(\n this.transcriptsDir,\n dir,\n legacyDir,\n alternateDir,\n readbackDirs,\n );\n const cached = this.sessionFootprintCache.get(sessionKey);\n if (!cached) {\n const fileBytes = new Map<string, number>();\n const fileSizes = new Map<string, number>();\n for (const file of files) {\n try {\n const fileInfo = await stat(file.path);\n const sessionBytes = await this.estimateSessionBytesInFile(\n file.path,\n sessionKey,\n );\n fileBytes.set(file.cacheKey, sessionBytes);\n fileSizes.set(file.cacheKey, Math.max(0, fileInfo.size));\n bytes += sessionBytes;\n } catch {\n // fail-open\n }\n }\n this.sessionFootprintCache.set(sessionKey, { totalBytes: bytes, fileBytes, fileSizes });\n } else {\n bytes = cached.totalBytes;\n const seen = new Set(files.map((file) => file.cacheKey));\n\n // Drop removed files from the cached total.\n for (const [cachedFile, cachedSessionBytes] of cached.fileBytes.entries()) {\n if (!seen.has(cachedFile)) {\n bytes -= cachedSessionBytes;\n cached.fileBytes.delete(cachedFile);\n cached.fileSizes.delete(cachedFile);\n }\n }\n\n // Read only newly discovered files.\n for (const file of files) {\n if (cached.fileBytes.has(file.cacheKey)) continue;\n try {\n const fileInfo = await stat(file.path);\n const sessionBytes = await this.estimateSessionBytesInFile(file.path, sessionKey);\n cached.fileBytes.set(file.cacheKey, sessionBytes);\n cached.fileSizes.set(file.cacheKey, Math.max(0, fileInfo.size));\n bytes += sessionBytes;\n } catch {\n // fail-open\n }\n }\n\n // Recompute any shard whose file size changed. A session can have both\n // encoded and legacy directories during migration, so path ordering does\n // not reliably identify the file that can grow.\n for (const file of files) {\n try {\n const fileInfo = await stat(file.path);\n const size = Math.max(0, fileInfo.size);\n const previousSessionBytes = cached.fileBytes.get(file.cacheKey) ?? 0;\n const previousSize = cached.fileSizes.get(file.cacheKey) ?? -1;\n if (size !== previousSize) {\n const sessionBytes = await this.estimateSessionBytesInFile(file.path, sessionKey);\n cached.fileBytes.set(file.cacheKey, sessionBytes);\n cached.fileSizes.set(file.cacheKey, size);\n bytes += sessionBytes - previousSessionBytes;\n }\n } catch {\n // fail-open\n }\n }\n\n if (bytes < 0) bytes = 0;\n cached.totalBytes = bytes;\n }\n } catch {\n // fail-open\n this.sessionFootprintCache.delete(sessionKey);\n }\n\n return {\n bytes,\n tokens: Math.floor(bytes / TranscriptManager.CHARS_PER_TOKEN),\n };\n }\n\n private async estimateSessionBytesInFile(filePath: string, sessionKey: string): Promise<number> {\n try {\n const raw = await readFile(filePath, \"utf-8\");\n let total = 0;\n for (const line of raw.split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n const parsed = JSON.parse(line) as { sessionKey?: string };\n if (parsed.sessionKey === sessionKey) {\n total += Buffer.byteLength(`${line}\\n`, \"utf-8\");\n }\n } catch {\n // fail-open for malformed lines\n }\n }\n return total;\n } catch {\n return 0;\n }\n }\n\n /**\n * Check if a file is a legacy flat transcript file (YYYY-MM-DD.jsonl format).\n */\n private isLegacyTranscriptFile(filename: string): boolean {\n return /^\\d{4}-\\d{2}-\\d{2}\\.jsonl$/.test(filename);\n }\n\n /**\n * Append a turn to the appropriate transcript file.\n * Files are stored hierarchically: transcripts/{channelType}/{channelId}.jsonl\n *\n * Skips channel types in config.transcriptSkipChannelTypes (e.g., \"cron\").\n */\n async append(entry: TranscriptEntry): Promise<void> {\n try {\n const { dir, file, channelType, alternateDir, legacyDir } = this.getTranscriptPath(entry.sessionKey);\n\n // Skip if this channel type is in the skip list\n if (this.config.transcriptSkipChannelTypes.includes(channelType)) {\n return;\n }\n\n const { dir: writeDir, channelDir } = await this.selectStorageDirForWrite(\n this.transcriptsDir,\n dir,\n legacyDir,\n entry.sessionKey,\n alternateDir,\n );\n const filePath = await resolveSafeStoragePath(this.transcriptsDir, writeDir, file);\n\n // Ensure channel directory exists\n await mkdir(channelDir, { recursive: true });\n\n const line = JSON.stringify(entry) + \"\\n\";\n await appendFile(filePath, line, \"utf-8\");\n await this.rememberDirectoryOwnership(this.transcriptsDir, writeDir, entry.sessionKey);\n log.debug(`appended transcript entry for ${entry.sessionKey}: ${entry.turnId}`);\n } catch (err) {\n log.error(\"failed to append transcript entry:\", err);\n throw err;\n }\n }\n\n /**\n * Get all transcript files from the hierarchical directory structure.\n * Recursively finds all .jsonl files in transcripts/{channelType}/{channelId}/ subdirectories.\n */\n private async getAllTranscriptFiles(): Promise<string[]> {\n const files: string[] = [];\n\n try {\n const entries = await readdir(this.transcriptsDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n // This is a channel type directory (discord, slack, cron, main, etc.)\n const channelTypeDir = path.join(this.transcriptsDir, entry.name);\n try {\n const channelTypeEntries = await readdir(channelTypeDir, { withFileTypes: true });\n\n for (const channelTypeEntry of channelTypeEntries) {\n if (channelTypeEntry.isDirectory()) {\n // This is a channel ID directory - contains daily transcript files\n const channelDir = path.join(channelTypeDir, channelTypeEntry.name);\n try {\n const channelFiles = await readdir(channelDir);\n for (const file of channelFiles) {\n if (file.endsWith(\".jsonl\")) {\n files.push(path.join(entry.name, channelTypeEntry.name, file));\n }\n }\n } catch {\n // Skip unreadable directories\n }\n } else if (channelTypeEntry.isFile() && channelTypeEntry.name.endsWith(\".jsonl\")) {\n // Legacy: channel type dir contains .jsonl files directly\n files.push(path.join(entry.name, channelTypeEntry.name));\n }\n }\n } catch {\n // Skip unreadable directories\n }\n } else if (entry.isFile() && entry.name.endsWith(\".jsonl\")) {\n // Legacy flat file - still include for backward compatibility\n files.push(entry.name);\n }\n }\n } catch {\n // Directory doesn't exist or is unreadable\n }\n\n return files;\n }\n\n /**\n * Read transcript entries for a date range.\n * Returns entries within the time range, optionally filtered by sessionKey.\n * Reads from all channel subdirectories in the hierarchical structure.\n *\n * The window is half-open `[start, end)`: the upper bound is exclusive so\n * caller-specified ranges (explicit dates, analytics buckets) don't\n * double-count at shared boundaries (CLAUDE.md rule #35 / AGENTS.md rule 23).\n * readRecent's inclusive-of-now behavior is handled by readRecent itself\n * extending its end, not by relaxing this bound.\n */\n async readRange(startTime: string, endTime: string, sessionKey?: string): Promise<TranscriptEntry[]> {\n const start = new Date(startTime);\n const end = new Date(endTime);\n const entries: TranscriptEntry[] = [];\n\n // When a sessionKey is given, a partially-applied #1496 migration can leave\n // the SAME raw row in both the primary `session/<hash>` dir and a read-back\n // dir (`other/default` or an old `parts.length >= 3` dir). `readRange` scans\n // EVERY transcript file, so it would append that row once per directory.\n // Dedup by exact raw line to give the same exact-once guarantee `readRecent`\n // / `readToolUse` / the summarizer fetch already provide (cursor review on\n // PR #1504). Only applied for the session-scoped path so unfiltered range\n // scans (each file already enumerated once) keep their existing behavior.\n const keepRawLine = sessionKey ? makeRawLineDeduper() : undefined;\n\n try {\n // Get all transcript files from the hierarchical structure\n const transcriptFiles = await this.getAllTranscriptFiles();\n\n // Read each relevant file\n for (const relativePath of transcriptFiles) {\n const filePath = path.join(this.transcriptsDir, relativePath);\n try {\n const content = await readFile(filePath, \"utf-8\");\n const lines = content.trim().split(\"\\n\").filter(Boolean);\n\n for (const line of lines) {\n try {\n const entry = JSON.parse(line) as TranscriptEntry;\n const entryTime = new Date(entry.timestamp);\n\n // Check if entry is within time range (half-open: exclusive end)\n if (entryTime >= start && entryTime < end) {\n // Filter by sessionKey if provided\n if (!sessionKey || entry.sessionKey === sessionKey) {\n if (keepRawLine && !keepRawLine(line)) continue;\n entries.push(entry);\n }\n }\n } catch {\n // Skip malformed lines\n log.debug(`skipped malformed transcript line in ${relativePath}`);\n }\n }\n } catch {\n // File doesn't exist or is unreadable - skip\n }\n }\n\n // Sort by timestamp\n entries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());\n\n log.debug(`read ${entries.length} transcript entries from ${transcriptFiles.length} file(s)`);\n return entries;\n } catch (err) {\n log.error(\"failed to read transcript range:\", err);\n return [];\n }\n }\n\n /**\n * Read the last N hours of transcript.\n *\n * Fast path: when sessionKey is given, reads only the 1-2 daily files for that\n * specific channel instead of scanning all 95+ transcript files across all channels.\n */\n async readRecent(hours: number, sessionKey?: string): Promise<TranscriptEntry[]> {\n const now = new Date();\n // The recent-read window is inclusive of \"now\": a turn that is buffered and\n // then immediately read back can carry the same millisecond timestamp as\n // this read, so a half-open [start, now) filter would drop it. Extend the\n // upper bound by 1ms so the exclusive [start, end) filters in\n // readRecentForSession / readRange (which stay half-open for\n // caller-specified ranges, CLAUDE.md rule #35) still capture an entry\n // stamped at exactly \"now\". This is the only place the \"up to now\" boundary\n // is widened; explicit ranges are unaffected.\n const end = new Date(now.getTime() + 1);\n const start = new Date(now.getTime() - hours * 60 * 60 * 1000);\n\n if (sessionKey) {\n return this.readRecentForSession(start, end, sessionKey);\n }\n return this.readRange(start.toISOString(), end.toISOString(), undefined);\n }\n\n /**\n * Optimized read for a specific session: only looks in that session's channel\n * directory and only reads files whose date falls within the lookback window.\n */\n private async readRecentForSession(\n start: Date,\n end: Date,\n sessionKey: string,\n ): Promise<TranscriptEntry[]> {\n const { dir, alternateDir, legacyDir, readbackDirs } = this.getTranscriptPath(sessionKey);\n\n // Build set of date strings that overlap with [start, end].\n // Always include end's date to handle midnight-crossing lookbacks\n // (e.g. start=23:30 yesterday, end=00:30 today).\n const dateStrings = new Set<string>();\n const cursor = new Date(start);\n while (cursor <= end) {\n dateStrings.add(cursor.toISOString().slice(0, 10));\n cursor.setDate(cursor.getDate() + 1);\n }\n dateStrings.add(end.toISOString().slice(0, 10));\n\n const entries: TranscriptEntry[] = [];\n const files = await this.getSessionStorageFiles(\n this.transcriptsDir,\n dir,\n legacyDir,\n alternateDir,\n readbackDirs,\n );\n\n // Dedup identical raw rows that a partially-applied migration may have left\n // in both the primary dir and a read-back dir (issue #1496, cursor review).\n const keepRawLine = makeRawLineDeduper();\n for (const file of files) {\n // Only read files whose date is within the window\n const dateStr = file.name.slice(0, 10);\n if (!dateStrings.has(dateStr)) continue;\n\n try {\n const content = await readFile(file.path, \"utf-8\");\n for (const line of content.split(\"\\n\")) {\n if (!line.trim()) continue;\n try {\n const entry = JSON.parse(line) as TranscriptEntry;\n const ts = new Date(entry.timestamp);\n // Half-open window: exclusive end. readRecent widens its own end by\n // 1ms so a just-written \"now\" entry is still captured here without\n // relaxing this bound for direct callers (tests/transcript-boundary).\n if (ts >= start && ts < end && entry.sessionKey === sessionKey && keepRawLine(line)) {\n entries.push(entry);\n }\n } catch {\n // skip malformed line\n }\n }\n } catch {\n // skip unreadable file\n }\n }\n\n entries.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime());\n log.debug(`readRecentForSession: ${entries.length} entries from ${files.length} file(s) in ${dir}`);\n return entries;\n }\n\n /**\n * Cleanup old transcript entries that are older than retentionDays.\n * For hierarchical structure, reads each file and rewrites without old entries.\n * Legacy flat files are deleted if their date is older than retentionDays.\n * Returns the number of files processed (cleaned or deleted).\n */\n async cleanup(retentionDays: number): Promise<number> {\n if (retentionDays <= 0) {\n log.warn(\"cleanup called with invalid retentionDays:\", retentionDays);\n return 0;\n }\n\n const cutoff = new Date();\n cutoff.setDate(cutoff.getDate() - retentionDays);\n cutoff.setHours(0, 0, 0, 0);\n\n let processed = 0;\n\n try {\n const entries = await readdir(this.transcriptsDir, { withFileTypes: true });\n\n for (const entry of entries) {\n if (entry.isDirectory()) {\n // This is a channel type directory (discord, slack, cron, main, etc.)\n const channelTypeDir = path.join(this.transcriptsDir, entry.name);\n try {\n const channelTypeEntries = await readdir(channelTypeDir, { withFileTypes: true });\n\n for (const channelTypeEntry of channelTypeEntries) {\n if (channelTypeEntry.isDirectory()) {\n // This is a channel ID directory - contains daily transcript files\n const channelDir = path.join(channelTypeDir, channelTypeEntry.name);\n try {\n const channelFiles = await readdir(channelDir);\n for (const file of channelFiles) {\n if (!file.endsWith(\".jsonl\")) continue;\n\n const filePath = path.join(channelDir, file);\n\n // Check if file is a daily transcript file (YYYY-MM-DD.jsonl)\n if (this.isLegacyTranscriptFile(file)) {\n const dateStr = file.slice(0, 10);\n const fileDate = new Date(dateStr);\n\n if (!isNaN(fileDate.getTime()) && fileDate < cutoff) {\n try {\n await unlink(filePath);\n processed++;\n log.debug(`deleted old daily transcript file: ${entry.name}/${channelTypeEntry.name}/${file}`);\n } catch (err) {\n log.error(`failed to delete transcript file ${filePath}:`, err);\n }\n }\n } else {\n // Legacy file in new structure - clean up old entries\n const cleaned = await this.cleanupTranscriptFile(filePath, cutoff);\n if (cleaned) {\n processed++;\n }\n }\n }\n } catch (err) {\n log.debug(`failed to process channel directory ${entry.name}/${channelTypeEntry.name}:`, err);\n }\n } else if (channelTypeEntry.isFile() && channelTypeEntry.name.endsWith(\".jsonl\")) {\n // Legacy: channel type dir contains .jsonl files directly\n const filePath = path.join(channelTypeDir, channelTypeEntry.name);\n const cleaned = await this.cleanupTranscriptFile(filePath, cutoff);\n if (cleaned) {\n processed++;\n }\n }\n }\n } catch (err) {\n log.debug(`failed to process channel type directory ${entry.name}:`, err);\n }\n } else if (entry.isFile() && entry.name.endsWith(\".jsonl\")) {\n // Handle legacy flat files - delete if older than retentionDays\n if (this.isLegacyTranscriptFile(entry.name)) {\n const dateStr = entry.name.slice(0, 10);\n const fileDate = new Date(dateStr);\n\n if (!isNaN(fileDate.getTime()) && fileDate < cutoff) {\n const filePath = path.join(this.transcriptsDir, entry.name);\n try {\n await unlink(filePath);\n processed++;\n log.debug(`deleted old legacy transcript file: ${entry.name}`);\n } catch (err) {\n log.error(`failed to delete legacy transcript file ${entry.name}:`, err);\n }\n }\n }\n }\n }\n\n if (processed > 0) {\n log.info(`cleaned up ${processed} transcript file(s) older than ${retentionDays} days`);\n }\n\n return processed;\n } catch (err) {\n log.error(\"failed to cleanup old transcripts:\", err);\n return 0;\n }\n }\n\n /**\n * Clean up old entries from a single transcript file.\n * Reads the file, filters out entries older than cutoff, and rewrites if needed.\n * Returns true if the file was processed (cleaned or deleted).\n */\n private async cleanupTranscriptFile(filePath: string, cutoff: Date): Promise<boolean> {\n try {\n const content = await readFile(filePath, \"utf-8\");\n const lines = content.trim().split(\"\\n\").filter(Boolean);\n\n const validLines: string[] = [];\n let hasOldEntries = false;\n\n for (const line of lines) {\n try {\n const entry = JSON.parse(line) as TranscriptEntry;\n const entryTime = new Date(entry.timestamp);\n\n if (entryTime >= cutoff) {\n validLines.push(line);\n } else {\n hasOldEntries = true;\n }\n } catch {\n // Keep malformed lines to avoid data loss\n validLines.push(line);\n }\n }\n\n if (validLines.length === 0) {\n // No valid entries left, delete the file\n try {\n await unlink(filePath);\n log.debug(`deleted empty transcript file: ${filePath}`);\n return true;\n } catch (err) {\n log.error(`failed to delete empty transcript file ${filePath}:`, err);\n return false;\n }\n }\n\n if (hasOldEntries) {\n // Rewrite file without old entries\n await writeFile(filePath, validLines.join(\"\\n\") + \"\\n\", \"utf-8\");\n log.debug(`cleaned old entries from transcript file: ${filePath}`);\n return true;\n }\n\n // No old entries found, no action needed\n return false;\n } catch (err) {\n // File doesn't exist or is unreadable\n return false;\n }\n }\n\n /**\n * Save a checkpoint to preserve conversation context.\n * Called when compaction is detected.\n */\n async saveCheckpoint(checkpoint: Checkpoint): Promise<void> {\n try {\n await writeFile(this.checkpointPath, JSON.stringify(checkpoint, null, 2), \"utf-8\");\n log.info(`saved checkpoint for session ${checkpoint.sessionKey} with ${checkpoint.turns.length} turn(s)`);\n } catch (err) {\n log.error(\"failed to save checkpoint:\", err);\n throw err;\n }\n }\n\n /**\n * Load a checkpoint if one exists and is not expired.\n * Returns null if no checkpoint exists or if it has expired.\n */\n async loadCheckpoint(sessionKey?: string): Promise<Checkpoint | null> {\n try {\n const raw = await readFile(this.checkpointPath, \"utf-8\");\n const checkpoint = JSON.parse(raw) as Checkpoint;\n\n // Validate checkpoint structure\n if (!checkpoint.sessionKey || !checkpoint.capturedAt || !checkpoint.ttl || !Array.isArray(checkpoint.turns)) {\n log.warn(\"checkpoint file has invalid structure\");\n return null;\n }\n\n // Check if checkpoint is for the requested session (if specified)\n if (sessionKey && checkpoint.sessionKey !== sessionKey) {\n log.debug(`checkpoint session mismatch: ${checkpoint.sessionKey} vs ${sessionKey}`);\n return null;\n }\n\n // Check if checkpoint has expired\n const ttl = new Date(checkpoint.ttl);\n if (isNaN(ttl.getTime())) {\n log.warn(\"checkpoint has invalid TTL format\");\n return null;\n }\n\n if (ttl < new Date()) {\n log.info(`checkpoint expired at ${checkpoint.ttl}`);\n return null;\n }\n\n log.info(`loaded checkpoint with ${checkpoint.turns.length} turn(s), expires at ${checkpoint.ttl}`);\n return checkpoint;\n } catch (err) {\n // File doesn't exist or is unreadable - that's fine\n log.debug(\"no valid checkpoint found\");\n return null;\n }\n }\n\n /**\n * Clear (delete) the checkpoint file.\n * Called after successful injection of checkpoint context.\n */\n async clearCheckpoint(): Promise<void> {\n try {\n await unlink(this.checkpointPath);\n log.info(\"cleared checkpoint\");\n } catch (err) {\n // File doesn't exist - that's fine\n log.debug(\"no checkpoint to clear\");\n }\n }\n\n /**\n * Format entries for recall injection.\n * Returns a formatted string suitable for injecting into agent context.\n *\n * Format:\n * ## Recent Conversation (last X hours)\n * [10:32] User: message content\n * [10:33] Assistant: response content\n *\n * Content is trimmed to approximately maxTokens.\n */\n formatForRecall(entries: TranscriptEntry[], maxTokens: number): string {\n if (entries.length === 0) {\n return \"\";\n }\n\n const maxChars = maxTokens * TranscriptManager.CHARS_PER_TOKEN;\n const lines: string[] = [];\n\n // Calculate time range for header\n const firstEntry = new Date(entries[0].timestamp);\n const lastEntry = new Date(entries[entries.length - 1].timestamp);\n const hoursDiff = Math.round((lastEntry.getTime() - firstEntry.getTime()) / (60 * 60 * 1000));\n\n // Add header\n if (hoursDiff < 1) {\n lines.push(\"## Recent Conversation (last few minutes)\");\n } else {\n lines.push(`## Recent Conversation (last ${hoursDiff} hour${hoursDiff === 1 ? \"\" : \"s\"})`);\n }\n lines.push(\"\");\n\n // Format each entry\n const formattedEntries: string[] = [];\n for (const entry of entries) {\n const time = new Date(entry.timestamp);\n const timeStr = time.toLocaleTimeString(\"en-US\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: false,\n });\n const roleLabel = entry.role === \"user\" ? \"User\" : \"Assistant\";\n formattedEntries.push(`[${timeStr}] ${roleLabel}: ${entry.content}`);\n }\n\n // Build output, trimming from the beginning if too long\n // (we want to keep the most recent context)\n let totalChars = lines.join(\"\\n\").length;\n const selectedEntries: string[] = [];\n\n for (let i = formattedEntries.length - 1; i >= 0; i--) {\n const entry = formattedEntries[i];\n const entryChars = entry.length + 1; // +1 for newline\n\n if (totalChars + entryChars > maxChars && selectedEntries.length > 0) {\n // Adding this entry would exceed limit, and we have some entries already\n break;\n }\n\n selectedEntries.unshift(entry);\n totalChars += entryChars;\n }\n\n lines.push(...selectedEntries);\n lines.push(\"\"); // Trailing newline\n\n const result = lines.join(\"\\n\");\n log.debug(`formatted ${selectedEntries.length}/${entries.length} transcript entries for recall (~${result.length} chars)`);\n\n return result;\n }\n\n /**\n * Create a checkpoint from the current buffer state.\n * Helper method for creating checkpoints before compaction.\n */\n createCheckpoint(sessionKey: string, turns: TranscriptEntry[], ttlHours?: number): Checkpoint {\n const ttl = ttlHours ?? TranscriptManager.DEFAULT_CHECKPOINT_TTL_HOURS;\n const expiresAt = new Date();\n expiresAt.setHours(expiresAt.getHours() + ttl);\n\n return {\n sessionKey,\n capturedAt: new Date().toISOString(),\n turns: [...turns], // Copy turns to avoid mutation\n ttl: expiresAt.toISOString(),\n };\n }\n\n /**\n * Get statistics about stored transcripts.\n * Returns counts from the hierarchical directory structure.\n */\n async getStats(): Promise<{\n totalFiles: number;\n totalEntries: number;\n oldestFile: string | null;\n newestFile: string | null;\n channelTypes: Record<string, number>;\n }> {\n try {\n const allFiles = await this.getAllTranscriptFiles();\n\n if (allFiles.length === 0) {\n return {\n totalFiles: 0,\n totalEntries: 0,\n oldestFile: null,\n newestFile: null,\n channelTypes: {},\n };\n }\n\n // Sort files by path\n const sortedFiles = allFiles.sort();\n\n let totalEntries = 0;\n const channelTypes: Record<string, number> = {};\n\n for (const relativePath of allFiles) {\n const filePath = path.join(this.transcriptsDir, relativePath);\n try {\n const content = await readFile(filePath, \"utf-8\");\n const lines = content.trim().split(\"\\n\").filter(Boolean);\n totalEntries += lines.length;\n\n // Count by channel type (first directory in path)\n const channelType = relativePath.includes(path.sep)\n ? relativePath.split(path.sep)[0]\n : \"legacy\";\n channelTypes[channelType] = (channelTypes[channelType] || 0) + 1;\n } catch {\n // Skip unreadable files\n }\n }\n\n return {\n totalFiles: allFiles.length,\n totalEntries,\n oldestFile: sortedFiles[0],\n newestFile: sortedFiles[sortedFiles.length - 1],\n channelTypes,\n };\n } catch (err) {\n log.error(\"failed to get transcript stats:\", err);\n return {\n totalFiles: 0,\n totalEntries: 0,\n oldestFile: null,\n newestFile: null,\n channelTypes: {},\n };\n }\n }\n\n async analyzeIntegrity(): Promise<SessionIntegrityReport> {\n return analyzeSessionIntegrity({ memoryDir: this.config.memoryDir });\n }\n\n async getRecoverySummary(sessionKey?: string): Promise<{\n generatedAt: string;\n sessionKey?: string;\n healthy: boolean;\n issueCount: number;\n incompleteTurns: number;\n brokenChains: number;\n checkpointHealthy: boolean;\n }> {\n const report = await this.analyzeIntegrity();\n const selectedSessions = sessionKey\n ? report.sessions.filter((session) => session.sessionKey === sessionKey)\n : report.sessions;\n const incompleteTurns = selectedSessions.reduce((sum, session) => sum + session.incompleteTurns, 0);\n const brokenChains = selectedSessions.reduce((sum, session) => sum + session.brokenChains, 0);\n const filteredIssues = report.issues.filter((issue) => !sessionKey || issue.sessionKey === sessionKey);\n const issueCount = filteredIssues.length;\n const severeIssueCount = filteredIssues.filter((issue) => issue.severity !== \"info\").length;\n return {\n generatedAt: report.generatedAt,\n sessionKey,\n healthy: sessionKey ? severeIssueCount === 0 && report.checkpoint.healthy : report.healthy,\n issue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"./chunk-W5ISYSIL.js";
14
+ } from "./chunk-L7W5YW6Y.js";
15
15
  import {
16
16
  projectTagProjectId
17
17
  } from "./chunk-6GIKAUTN.js";
@@ -26,7 +26,7 @@ import {
26
26
  } from "./chunk-JUC24CTX.js";
27
27
  import {
28
28
  validateRequest
29
- } from "./chunk-CDHRUNBX.js";
29
+ } from "./chunk-QKE4LHNR.js";
30
30
 
31
31
  // src/access-mcp.ts
32
32
  import { readFile } from "fs/promises";
@@ -3102,4 +3102,4 @@ ${body}`;
3102
3102
  export {
3103
3103
  EngramMcpServer
3104
3104
  };
3105
- //# sourceMappingURL=chunk-YOXCJP3A.js.map
3105
+ //# sourceMappingURL=chunk-ZPPFKVSD.js.map
package/dist/cli.js CHANGED
@@ -89,40 +89,41 @@ import {
89
89
  runWorkProductStatusCliCommand,
90
90
  runWorkProjectCliCommand,
91
91
  runWorkTaskCliCommand
92
- } from "./chunk-6YLJZ2EU.js";
92
+ } from "./chunk-3D6L7CEP.js";
93
93
  import "./chunk-MC4FJXPA.js";
94
94
  import "./chunk-LQHDIS7L.js";
95
95
  import "./chunk-7F7Z6MOS.js";
96
96
  import "./chunk-JJEJJ7RK.js";
97
97
  import "./chunk-HDDRVXX4.js";
98
- import "./chunk-AGNBY3VG.js";
99
- import "./chunk-UP6MOYCB.js";
100
- import "./chunk-7VFZTJ7K.js";
101
- import "./chunk-Z734BLO3.js";
98
+ import "./chunk-APJQ6UEA.js";
102
99
  import "./chunk-OZKVVUJB.js";
103
100
  import "./chunk-2DL3OFLD.js";
104
101
  import "./chunk-G4IAEX6D.js";
105
- import "./chunk-BXLOS5AJ.js";
102
+ import "./chunk-OWHERGF2.js";
103
+ import "./chunk-UP6MOYCB.js";
106
104
  import "./chunk-765K3SAT.js";
107
- import "./chunk-HOJZMQ4J.js";
108
- import "./chunk-LZZNTPLR.js";
105
+ import "./chunk-7VFZTJ7K.js";
106
+ import "./chunk-Z734BLO3.js";
109
107
  import "./chunk-EEC4PCG5.js";
110
108
  import "./chunk-PYIFUBRK.js";
111
- import "./chunk-WMWVO45V.js";
112
- import "./chunk-D6RIFG4O.js";
113
- import "./chunk-JCK7V6SN.js";
109
+ import "./chunk-HOJZMQ4J.js";
114
110
  import "./chunk-PQFUUXWK.js";
115
111
  import "./chunk-MCYT2RNT.js";
112
+ import "./chunk-LZZNTPLR.js";
113
+ import "./chunk-WMWVO45V.js";
116
114
  import "./chunk-KJTKLXTH.js";
115
+ import "./chunk-D6RIFG4O.js";
116
+ import "./chunk-JCK7V6SN.js";
117
117
  import "./chunk-CKITWVWJ.js";
118
118
  import "./chunk-OUELRE5E.js";
119
119
  import "./chunk-GQL52GQ5.js";
120
+ import "./chunk-EVWIEEKZ.js";
120
121
  import "./chunk-OTC2KOZ2.js";
121
- import "./chunk-3SF7QNKF.js";
122
+ import "./chunk-6BNFVP7Y.js";
122
123
  import "./chunk-WLGE6KEO.js";
123
124
  import "./chunk-TGQ2NTWH.js";
124
- import "./chunk-T22TZJWJ.js";
125
- import "./chunk-IZXOO6NP.js";
125
+ import "./chunk-DC66QVL2.js";
126
+ import "./chunk-FAYDM5WD.js";
126
127
  import "./chunk-3T74IZB3.js";
127
128
  import "./chunk-HL4DB7TO.js";
128
129
  import "./chunk-YNDLCWXS.js";
@@ -139,7 +140,8 @@ import "./chunk-UMKPSD35.js";
139
140
  import "./chunk-W4RVMTHR.js";
140
141
  import "./chunk-4BISW7RX.js";
141
142
  import "./chunk-ZRWB5D4H.js";
142
- import "./chunk-IHG27THY.js";
143
+ import "./chunk-XUGQQPGO.js";
144
+ import "./chunk-S4DDLTPX.js";
143
145
  import "./chunk-SFQ6QNL7.js";
144
146
  import "./chunk-D6WVJIS3.js";
145
147
  import "./chunk-KFY3SGN7.js";
@@ -164,22 +166,22 @@ import "./chunk-Z5LAYHGJ.js";
164
166
  import "./chunk-LBJBNWS2.js";
165
167
  import "./chunk-HQ6NIBL6.js";
166
168
  import "./chunk-OADWQ5CR.js";
167
- import "./chunk-BTRL6GG7.js";
169
+ import "./chunk-RAELB5NX.js";
168
170
  import "./chunk-SEDEKFYQ.js";
169
- import "./chunk-2QSZNTDO.js";
171
+ import "./chunk-RKNJBZ55.js";
172
+ import "./chunk-J64TK33U.js";
170
173
  import "./chunk-RSUYKGGZ.js";
171
174
  import "./chunk-42NQ7AVG.js";
172
175
  import "./chunk-TMSXWOBZ.js";
173
- import "./chunk-J64TK33U.js";
174
176
  import "./chunk-7RXCMVFQ.js";
175
177
  import "./chunk-7WV3F5DQ.js";
176
- import "./chunk-YOXCJP3A.js";
178
+ import "./chunk-ZPPFKVSD.js";
177
179
  import "./chunk-T4WDJPEZ.js";
178
180
  import "./chunk-D24OXEPB.js";
179
- import "./chunk-W5ISYSIL.js";
181
+ import "./chunk-L7W5YW6Y.js";
180
182
  import "./chunk-GDASG7NC.js";
181
183
  import "./chunk-GDB4J2H3.js";
182
- import "./chunk-DGNQRNLL.js";
184
+ import "./chunk-NT5TINK5.js";
183
185
  import "./chunk-IENGGY2C.js";
184
186
  import "./chunk-SOBJ6NEY.js";
185
187
  import "./chunk-BT7NVCML.js";
@@ -190,14 +192,14 @@ import "./chunk-5RIRL3XL.js";
190
192
  import "./chunk-JGSKJHF7.js";
191
193
  import "./chunk-FF4KLI5W.js";
192
194
  import "./chunk-BEMWL2FZ.js";
193
- import "./chunk-HRXCPKN4.js";
194
- import "./chunk-KVUG7FF7.js";
195
+ import "./chunk-APWJRJFW.js";
196
+ import "./chunk-U55D5UD5.js";
197
+ import "./chunk-CYEPCZN5.js";
198
+ import "./chunk-DCGT4FPP.js";
195
199
  import "./chunk-JOASJWQR.js";
196
200
  import "./chunk-RN7MUWON.js";
197
201
  import "./chunk-3MAONBX3.js";
198
202
  import "./chunk-RG3LBSGH.js";
199
- import "./chunk-CYEPCZN5.js";
200
- import "./chunk-DCGT4FPP.js";
201
203
  import "./chunk-Q4CAQGKQ.js";
202
204
  import "./chunk-CINZGPSJ.js";
203
205
  import "./chunk-ZFXCQPNO.js";
@@ -256,10 +258,10 @@ import "./chunk-TVVEYCNW.js";
256
258
  import "./chunk-RFYAYKTD.js";
257
259
  import "./chunk-LBLXEFWK.js";
258
260
  import "./chunk-VFUEZZBS.js";
259
- import "./chunk-CDHRUNBX.js";
260
- import "./chunk-VDX2J7OX.js";
261
+ import "./chunk-QKE4LHNR.js";
262
+ import "./chunk-BUKK5SWA.js";
261
263
  import "./chunk-WEHSQBFR.js";
262
- import "./chunk-DQEMWVMT.js";
264
+ import "./chunk-UVYI6VIX.js";
263
265
  import "./chunk-J4EB7DNW.js";
264
266
  import "./chunk-BJMBJZ2Y.js";
265
267
  import "./chunk-UKJAGEXH.js";
@@ -2,12 +2,12 @@ import {
2
2
  applyUtilityPromotionRuntimePolicy,
3
3
  loadUtilityRuntimeValues
4
4
  } from "./chunk-LXOM6IQU.js";
5
- import {
6
- decideTierTransition
7
- } from "./chunk-S75M5ZRK.js";
8
5
  import {
9
6
  TierMigrationExecutor
10
7
  } from "./chunk-VOUOLGIP.js";
8
+ import {
9
+ decideTierTransition
10
+ } from "./chunk-S75M5ZRK.js";
11
11
  import "./chunk-2F6NP3NT.js";
12
12
  import "./chunk-TERNBNJB.js";
13
13
  import "./chunk-TBBDFYXW.js";
@@ -260,4 +260,4 @@ export {
260
260
  LIFECYCLE_INIT_DONE_MARKER,
261
261
  runFirstStartMigration
262
262
  };
263
- //# sourceMappingURL=first-start-migration-FF7YFGRP.js.map
263
+ //# sourceMappingURL=first-start-migration-PG5HBC3K.js.map
package/dist/index.d.ts CHANGED
@@ -38,6 +38,8 @@ export { OramaBackend } from './search/orama-backend.js';
38
38
  export { MeilisearchBackend } from './search/meilisearch-backend.js';
39
39
  export { buildEntityRecallSection } from './entity-retrieval.js';
40
40
  export { resolvePrincipal } from './namespaces/principal.js';
41
+ export { SESSION_CHANNEL_TYPE, SessionIdentity, SessionStoragePaths, legacyParserReadbackDir, parseSessionIdentity, sessionStoragePaths } from './session-identity.js';
42
+ export { storagePathHash } from './storage-paths.js';
41
43
  export { TrustZoneName, TrustZoneRecord, TrustZoneRecordKind, TrustZoneSourceClass, isTrustZoneName } from './trust-zones.js';
42
44
  export { EngramAccessHttpServer, RemnicAdminConfigPatch, RemnicAdminControls, RemnicAdminDashboardStatus, RemnicAdminFeatureStatus, RemnicAdminHarnessStatus, RemnicAdminModelOption } from './access-http.js';
43
45
  export { EngramMcpServer } from './access-mcp.js';