@remnic/core 9.3.544 → 9.3.546

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 (82) hide show
  1. package/dist/access-cli.js +15 -15
  2. package/dist/access-http.js +9 -9
  3. package/dist/access-mcp.js +8 -8
  4. package/dist/access-schema.js +3 -3
  5. package/dist/access-service.js +6 -6
  6. package/dist/briefing.js +3 -3
  7. package/dist/causal-consolidation.js +4 -4
  8. package/dist/{chunk-FWYUJY4N.js → chunk-25BY3HHZ.js} +2 -2
  9. package/dist/{chunk-PR577DSG.js → chunk-2R6MP5C6.js} +12 -12
  10. package/dist/{chunk-K6OABSBA.js → chunk-5GX5MUQ2.js} +2 -2
  11. package/dist/{chunk-NHZHAZCJ.js → chunk-5RIRL3XL.js} +2 -2
  12. package/dist/{chunk-QKV4LVLA.js → chunk-5WLYNZPC.js} +2 -2
  13. package/dist/{chunk-25XNFWT3.js → chunk-BD5LHQWD.js} +2 -2
  14. package/dist/{chunk-BRCYNT4I.js → chunk-CC2ESOOG.js} +2 -2
  15. package/dist/{chunk-INMWM3UZ.js → chunk-DEGH5BUP.js} +4 -4
  16. package/dist/{chunk-QWQX7YK5.js → chunk-E5OECWZ5.js} +2 -2
  17. package/dist/{chunk-J62VXZR2.js → chunk-FADZBOR4.js} +2 -2
  18. package/dist/{chunk-GWUUEPOR.js → chunk-FVCZINOF.js} +2 -2
  19. package/dist/{chunk-7NEW7PTS.js → chunk-GSFFWOWU.js} +5 -5
  20. package/dist/{chunk-73JGZ5VA.js → chunk-ILXTATKK.js} +47 -20
  21. package/dist/chunk-ILXTATKK.js.map +1 -0
  22. package/dist/{chunk-FXE46BJ5.js → chunk-JFN6K74Q.js} +2 -2
  23. package/dist/{chunk-ENIIJ3MZ.js → chunk-M3BAMVAE.js} +2 -2
  24. package/dist/{chunk-QCJLDMY5.js → chunk-OF46AKZC.js} +8 -8
  25. package/dist/{chunk-LKUNOD7B.js → chunk-S53PAX2V.js} +2 -2
  26. package/dist/{chunk-3M7OTJ5H.js → chunk-SI3QCHWF.js} +4 -4
  27. package/dist/{chunk-UMXWQL3P.js → chunk-SOTR74FK.js} +2 -2
  28. package/dist/{chunk-A5TLPLUO.js → chunk-TVZ6LKKS.js} +2 -2
  29. package/dist/{chunk-RGLJNOQN.js → chunk-Y4YATXHL.js} +3 -3
  30. package/dist/{chunk-GAMKRZRP.js → chunk-YN3WHXBG.js} +5 -5
  31. package/dist/{chunk-XE23FSDQ.js → chunk-Z56KAZQL.js} +2 -2
  32. package/dist/{chunk-NJBIGWAI.js → chunk-ZLDUQWT2.js} +3 -2
  33. package/dist/chunk-ZLDUQWT2.js.map +1 -0
  34. package/dist/cli.js +18 -18
  35. package/dist/compounding/engine.js +3 -3
  36. package/dist/connectors/codex-materialize-runner.js +3 -3
  37. package/dist/connectors/index.js +3 -3
  38. package/dist/entity-retrieval.js +3 -3
  39. package/dist/index.js +24 -24
  40. package/dist/maintenance/memory-governance.js +3 -3
  41. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  42. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  43. package/dist/namespaces/migrate.js +4 -4
  44. package/dist/namespaces/storage.js +3 -3
  45. package/dist/offline-sync.js +2 -2
  46. package/dist/operator-toolkit.js +6 -6
  47. package/dist/orchestrator.js +11 -11
  48. package/dist/secure-store/index.js +2 -2
  49. package/dist/semantic-consolidation.js +4 -4
  50. package/dist/semantic-rule-promotion.js +3 -3
  51. package/dist/semantic-rule-verifier.js +3 -3
  52. package/dist/storage.js +2 -2
  53. package/dist/verified-recall.js +3 -3
  54. package/package.json +1 -1
  55. package/src/offline-sync.test.ts +1 -0
  56. package/src/offline-sync.ts +1 -0
  57. package/src/secure-store/secure-fs.ts +63 -38
  58. package/src/secure-store/secure-store.test.ts +155 -106
  59. package/dist/chunk-73JGZ5VA.js.map +0 -1
  60. package/dist/chunk-NJBIGWAI.js.map +0 -1
  61. /package/dist/{chunk-FWYUJY4N.js.map → chunk-25BY3HHZ.js.map} +0 -0
  62. /package/dist/{chunk-PR577DSG.js.map → chunk-2R6MP5C6.js.map} +0 -0
  63. /package/dist/{chunk-K6OABSBA.js.map → chunk-5GX5MUQ2.js.map} +0 -0
  64. /package/dist/{chunk-NHZHAZCJ.js.map → chunk-5RIRL3XL.js.map} +0 -0
  65. /package/dist/{chunk-QKV4LVLA.js.map → chunk-5WLYNZPC.js.map} +0 -0
  66. /package/dist/{chunk-25XNFWT3.js.map → chunk-BD5LHQWD.js.map} +0 -0
  67. /package/dist/{chunk-BRCYNT4I.js.map → chunk-CC2ESOOG.js.map} +0 -0
  68. /package/dist/{chunk-INMWM3UZ.js.map → chunk-DEGH5BUP.js.map} +0 -0
  69. /package/dist/{chunk-QWQX7YK5.js.map → chunk-E5OECWZ5.js.map} +0 -0
  70. /package/dist/{chunk-J62VXZR2.js.map → chunk-FADZBOR4.js.map} +0 -0
  71. /package/dist/{chunk-GWUUEPOR.js.map → chunk-FVCZINOF.js.map} +0 -0
  72. /package/dist/{chunk-7NEW7PTS.js.map → chunk-GSFFWOWU.js.map} +0 -0
  73. /package/dist/{chunk-FXE46BJ5.js.map → chunk-JFN6K74Q.js.map} +0 -0
  74. /package/dist/{chunk-ENIIJ3MZ.js.map → chunk-M3BAMVAE.js.map} +0 -0
  75. /package/dist/{chunk-QCJLDMY5.js.map → chunk-OF46AKZC.js.map} +0 -0
  76. /package/dist/{chunk-LKUNOD7B.js.map → chunk-S53PAX2V.js.map} +0 -0
  77. /package/dist/{chunk-3M7OTJ5H.js.map → chunk-SI3QCHWF.js.map} +0 -0
  78. /package/dist/{chunk-UMXWQL3P.js.map → chunk-SOTR74FK.js.map} +0 -0
  79. /package/dist/{chunk-A5TLPLUO.js.map → chunk-TVZ6LKKS.js.map} +0 -0
  80. /package/dist/{chunk-RGLJNOQN.js.map → chunk-Y4YATXHL.js.map} +0 -0
  81. /package/dist/{chunk-GAMKRZRP.js.map → chunk-YN3WHXBG.js.map} +0 -0
  82. /package/dist/{chunk-XE23FSDQ.js.map → chunk-Z56KAZQL.js.map} +0 -0
@@ -66,9 +66,7 @@ function decryptFileBody(buf, key, aad) {
66
66
  return open(key, envelope, aad ? { aad } : {});
67
67
  } catch (err) {
68
68
  const msg = err instanceof Error ? err.message : String(err);
69
- throw new SecureStoreDecryptError(
70
- `secure-store decryption failed: ${msg}`
71
- );
69
+ throw new SecureStoreDecryptError(`secure-store decryption failed: ${msg}`);
72
70
  }
73
71
  }
74
72
  function buildHeaderAad(salt) {
@@ -156,12 +154,7 @@ async function writeMaybeEncryptedFileFromChunks(filePath, chunks, key, options
156
154
  const final = cipher.final();
157
155
  if (final.length > 0) await handle.write(final);
158
156
  const authTag = cipher.getAuthTag();
159
- await handle.write(
160
- authTag,
161
- 0,
162
- authTag.length,
163
- MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag
164
- );
157
+ await handle.write(authTag, 0, authTag.length, MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag);
165
158
  } else {
166
159
  for await (const chunk of chunks) {
167
160
  if (chunk.length > 0) await handle.write(chunk);
@@ -315,15 +308,23 @@ async function collectEncryptableStorageFiles(dir, rootDir = dir) {
315
308
  }
316
309
  async function collectStorageManagedFiles(dir, includeFile, rootDir = dir) {
317
310
  const results = [];
311
+ let scanDir = dir;
312
+ let scanRootDir = rootDir;
313
+ if (path.resolve(dir) === path.resolve(rootDir)) {
314
+ const normalizedRoot = await resolveStorageManagedRootForScan(dir);
315
+ if (!normalizedRoot) return results;
316
+ scanDir = normalizedRoot;
317
+ scanRootDir = normalizedRoot;
318
+ }
318
319
  let names;
319
320
  try {
320
- names = await readdir(dir, { encoding: "utf8" });
321
+ names = await readdir(scanDir, { encoding: "utf8" });
321
322
  } catch {
322
323
  return results;
323
324
  }
324
325
  for (const name of names) {
325
326
  if (name.startsWith(".secure-store")) continue;
326
- const full = path.join(dir, name);
327
+ const full = path.join(scanDir, name);
327
328
  let isDir = false;
328
329
  let isFile = false;
329
330
  try {
@@ -335,14 +336,45 @@ async function collectStorageManagedFiles(dir, includeFile, rootDir = dir) {
335
336
  continue;
336
337
  }
337
338
  if (isDir) {
338
- const sub = await collectStorageManagedFiles(full, includeFile, rootDir);
339
+ const sub = await collectStorageManagedFiles(full, includeFile, scanRootDir);
339
340
  results.push(...sub);
340
- } else if (isFile && includeFile(full, rootDir)) {
341
+ } else if (isFile && includeFile(full, scanRootDir)) {
341
342
  results.push(full);
342
343
  }
343
344
  }
344
345
  return results;
345
346
  }
347
+ async function resolveStorageManagedRootForScan(dir) {
348
+ const lstatPath = normalizePathForLstat(dir);
349
+ let stat;
350
+ try {
351
+ stat = await lstat(lstatPath);
352
+ } catch (error) {
353
+ if (isFsErrorWithCode(error, "ENOENT")) return null;
354
+ throw error;
355
+ }
356
+ if (stat.isSymbolicLink()) {
357
+ throw new Error(`secure-store migration root must not be a symlink: ${dir}`);
358
+ }
359
+ if (!stat.isDirectory()) {
360
+ throw new Error(`secure-store migration root must be a directory: ${dir}`);
361
+ }
362
+ return lstatPath;
363
+ }
364
+ function normalizePathForLstat(filePath) {
365
+ return stripTrailingPathSeparators(path.normalize(filePath));
366
+ }
367
+ function isFsErrorWithCode(error, code) {
368
+ return typeof error === "object" && error !== null && error.code === code;
369
+ }
370
+ function stripTrailingPathSeparators(filePath) {
371
+ const root = path.parse(filePath).root;
372
+ let end = filePath.length;
373
+ while (end > root.length && (filePath[end - 1] === path.sep || filePath[end - 1] === path.posix.sep || filePath[end - 1] === path.win32.sep)) {
374
+ end -= 1;
375
+ }
376
+ return end === filePath.length ? filePath : filePath.slice(0, end);
377
+ }
346
378
  function isEncryptableStoragePath(filePath, rootDir) {
347
379
  const rel = path.relative(rootDir, filePath);
348
380
  if (rel === "" || rel.startsWith("..") || path.isAbsolute(rel)) return false;
@@ -401,12 +433,7 @@ function isEncryptableStateSidecar(normalized) {
401
433
  function isEncryptableSummarySidecar(normalized) {
402
434
  return normalized.startsWith("summaries/") && normalized.endsWith(".json");
403
435
  }
404
- var DECRYPTABLE_SIDECAR_ROOTS = /* @__PURE__ */ new Set([
405
- "state",
406
- "indexes",
407
- "index",
408
- "provenance"
409
- ]);
436
+ var DECRYPTABLE_SIDECAR_ROOTS = /* @__PURE__ */ new Set(["state", "indexes", "index", "provenance"]);
410
437
 
411
438
  export {
412
439
  SecureStoreLockedError,
@@ -426,4 +453,4 @@ export {
426
453
  migrateMemoryDirToEncrypted,
427
454
  decryptMemoryDirToPlaintext
428
455
  };
429
- //# sourceMappingURL=chunk-73JGZ5VA.js.map
456
+ //# sourceMappingURL=chunk-ILXTATKK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/secure-store/secure-fs.ts"],"sourcesContent":["/**\n * Transparent file-level encryption for the secure-store module.\n *\n * Issue #690 (PR 3/4) — storage.ts integration layer.\n *\n * This module sits between the raw filesystem and StorageManager.\n * Every memory file is either:\n * - a plain UTF-8 text file (legacy, back-compat), or\n * - a REMNIC-ENC sealed file (AES-256-GCM, see format below).\n *\n * On-disk format\n * --------------\n * Encrypted files begin with a 9-byte magic header:\n *\n * REMNIC-ENC (7 ASCII bytes)\n * VER (1 byte, currently 0x01)\n * FLAGS (1 byte, reserved, must be 0x00)\n *\n * Followed immediately by a `seal()` envelope from `cipher.ts`:\n *\n * [VERSION:1][SALT:16][IV:12][AUTHTAG:16][CIPHERTEXT:...]\n *\n * The magic header makes encrypted files sniffable without attempting\n * a full `open()` call and gives operators a clear signal that the\n * file cannot be read by opening it in an editor.\n *\n * AAD\n * ---\n * The file path relative to the memory root is bound as Associated\n * Authenticated Data (AAD) on both encrypt and decrypt. This means\n * moving or renaming an encrypted file without re-encrypting it will\n * cause auth-tag failure on the next read — the file is tied to its\n * path. Callers that move files must re-encrypt them.\n *\n * Back-compat\n * -----------\n * `readMaybeEncryptedFile` transparently handles both formats: if the\n * file does NOT start with the magic bytes, it is returned as-is (plain\n * text). This lets an operator migrate incrementally: newly-written\n * files are encrypted while existing files continue to be read in plain\n * form until `migrateMemoryDirToEncrypted` is run.\n *\n * Naming: `secure-fs.ts` (not `vault-fs.ts`) — see `kdf.ts` naming note.\n */\n\nimport { createCipheriv, randomBytes, randomUUID } from \"node:crypto\";\nimport { lstat, mkdir, open as openFile, readFile, readdir, rename, unlink, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nimport {\n AUTH_TAG_LENGTH,\n ENVELOPE_HEADER_SIZE,\n ENVELOPE_LAYOUT,\n ENVELOPE_SALT_LENGTH,\n ENVELOPE_VERSION,\n IV_LENGTH,\n generateSalt,\n open as openEnvelope,\n parseEnvelope,\n seal,\n} from \"./cipher.js\";\n\n// ---------------------------------------------------------------------------\n// Error classes\n// ---------------------------------------------------------------------------\n\n/**\n * Thrown when a read is attempted but the keyring entry for this\n * store is absent (i.e. `secure-store unlock` has not been run\n * since the last daemon start).\n */\nexport class SecureStoreLockedError extends Error {\n constructor(message = \"secure-store is locked — run `remnic secure-store unlock` to decrypt\") {\n super(message);\n this.name = \"SecureStoreLockedError\";\n }\n}\n\n/**\n * Thrown when `open()` fails because the auth tag does not validate.\n * This covers both wrong-key and tampered-ciphertext scenarios —\n * intentionally indistinguishable from the caller's perspective.\n */\nexport class SecureStoreDecryptError extends Error {\n constructor(message = \"secure-store decryption failed — wrong key or tampered ciphertext\") {\n super(message);\n this.name = \"SecureStoreDecryptError\";\n }\n}\n\n// ---------------------------------------------------------------------------\n// Magic header\n// ---------------------------------------------------------------------------\n\n/** Magic bytes: the ASCII string \"REMNIC-ENC\" (10 bytes). */\nexport const MAGIC_BYTES = Buffer.from(\"REMNIC-ENC\", \"ascii\");\n\n/** Current on-disk version byte. */\nexport const FILE_FORMAT_VERSION = 0x01;\n\n/** Reserved flags byte — must be 0x00. */\nexport const FILE_FORMAT_FLAGS = 0x00;\n\n/** Total size of the magic header prefix (magic + version + flags). */\nexport const MAGIC_HEADER_SIZE = MAGIC_BYTES.length + 2; // 12 bytes\n\n// ---------------------------------------------------------------------------\n// Detection\n// ---------------------------------------------------------------------------\n\n/**\n * Return true iff `buf` begins with the REMNIC-ENC magic header.\n * Does not validate the envelope; just identifies the format.\n */\nexport function isEncryptedFile(buf: Uint8Array): boolean {\n if (buf.length < MAGIC_HEADER_SIZE) return false;\n const b = Buffer.isBuffer(buf) ? buf : Buffer.from(buf);\n return b.subarray(0, MAGIC_BYTES.length).equals(MAGIC_BYTES);\n}\n\n// ---------------------------------------------------------------------------\n// Encrypt / decrypt file body\n// ---------------------------------------------------------------------------\n\n/**\n * Encrypt `plain` (UTF-8 content of a memory file) and return a\n * Buffer ready to write to disk.\n *\n * @param plain Plain-text file content (UTF-8 string or Buffer).\n * @param key 32-byte AES-256 key from the keyring.\n * @param aad Optional associated data — defaults to empty if omitted.\n * Callers should pass the file path relative to memoryDir\n * so the ciphertext is bound to its location.\n */\nexport function encryptFileBody(plain: string | Buffer, key: Buffer, aad?: Buffer): Buffer {\n const plainBuf = typeof plain === \"string\" ? Buffer.from(plain, \"utf8\") : plain;\n const salt = generateSalt();\n const envelope = seal(key, salt, plainBuf, aad ? { aad } : {});\n\n const header = Buffer.alloc(MAGIC_HEADER_SIZE);\n MAGIC_BYTES.copy(header, 0);\n header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);\n header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);\n\n return Buffer.concat([header, envelope]);\n}\n\n/**\n * Decrypt a buffer produced by `encryptFileBody` and return the\n * original UTF-8 content.\n *\n * Throws `SecureStoreDecryptError` on auth failure (wrong key or\n * tampered ciphertext). Throws a plain `Error` for structural problems\n * (truncated buffer, wrong magic, unsupported version).\n */\nexport function decryptFileBody(buf: Buffer, key: Buffer, aad?: Buffer): Buffer {\n if (!isEncryptedFile(buf)) {\n throw new Error(\"decryptFileBody: buffer does not start with REMNIC-ENC magic header\");\n }\n const version = buf.readUInt8(MAGIC_BYTES.length);\n if (version !== FILE_FORMAT_VERSION) {\n throw new Error(\n `decryptFileBody: unsupported file format version ${version} (this build supports ${FILE_FORMAT_VERSION})`\n );\n }\n const flags = buf.readUInt8(MAGIC_BYTES.length + 1);\n if (flags !== FILE_FORMAT_FLAGS) {\n throw new Error(`decryptFileBody: unknown flags byte 0x${flags.toString(16).padStart(2, \"0\")}`);\n }\n const envelope = buf.subarray(MAGIC_HEADER_SIZE);\n parseEnvelope(envelope);\n try {\n return openEnvelope(key, envelope, aad ? { aad } : {});\n } catch (err) {\n const msg = err instanceof Error ? err.message : String(err);\n throw new SecureStoreDecryptError(`secure-store decryption failed: ${msg}`);\n }\n}\n\nfunction buildHeaderAad(salt: Uint8Array): Buffer {\n const out = Buffer.alloc(1 + ENVELOPE_SALT_LENGTH);\n out.writeUInt8(ENVELOPE_VERSION, 0);\n Buffer.from(salt).copy(out, 1);\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Path → AAD helper\n// ---------------------------------------------------------------------------\n\n/**\n * Build the AAD buffer for a file at `filePath` relative to\n * `memoryDir`. The AAD binds the ciphertext to its path so a\n * file cannot be silently relocated without re-encryption.\n *\n * When `memoryDir` is supplied and `filePath` is absolute, the\n * relative sub-path is used. Otherwise `filePath` is used verbatim.\n */\nexport function filePathAad(filePath: string, memoryDir?: string): Buffer {\n let rel = filePath;\n if (memoryDir && path.isAbsolute(filePath)) {\n rel = path.relative(memoryDir, filePath);\n }\n return Buffer.from(rel, \"utf8\");\n}\n\n// ---------------------------------------------------------------------------\n// High-level read / write helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Read a file from `filePath`.\n *\n * - If the file is plaintext (no magic header), return its content\n * as-is — back-compat with unencrypted stores.\n * - If the file is encrypted AND `key` is provided, decrypt and return\n * the plaintext content.\n * - If the file is encrypted AND `key` is null, throw\n * `SecureStoreLockedError`.\n *\n * @param filePath Absolute path to the file.\n * @param key 32-byte AES-256 key, or null when the store is locked.\n * @param memoryDir Memory root for path-bound AAD. Should be absolute.\n */\nexport async function readMaybeEncryptedFileBuffer(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string\n): Promise<Buffer> {\n const buf = await readFile(filePath);\n if (!isEncryptedFile(buf)) {\n // Plain file — legacy or unencrypted store.\n return buf;\n }\n // Encrypted — key required.\n if (key === null) {\n throw new SecureStoreLockedError(\n `secure-store is locked — cannot read encrypted file at ${filePath}. Run \\`remnic secure-store unlock\\` to decrypt.`\n );\n }\n return decryptFileBodyForPath(buf, key, filePath, memoryDir);\n}\n\nexport async function readMaybeEncryptedFile(\n filePath: string,\n key: Buffer | null,\n memoryDir?: string\n): Promise<string> {\n return (await readMaybeEncryptedFileBuffer(filePath, key, memoryDir)).toString(\"utf8\");\n}\n\nexport interface WriteMaybeEncryptedFileOptions {\n /**\n * File mode bits. Default 0o600 (owner read/write only).\n * Applied only on create; existing files inherit their existing mode.\n */\n mode?: number;\n /**\n * If true, write atomically via a temp file + rename (CLAUDE.md gotcha #54).\n * Default true.\n */\n atomic?: boolean;\n}\n\n/**\n * Write `content` to `filePath`.\n *\n * - If `key` is provided and non-null, encrypt the content first.\n * - If `key` is null, write the content as plain UTF-8 (unencrypted store).\n *\n * Writes atomically: content is written to a unique temp file\n * first, then renamed into place (CLAUDE.md gotcha #54 — never delete\n * before write).\n */\nexport async function writeMaybeEncryptedFile(\n filePath: string,\n content: string | Buffer,\n key: Buffer | null,\n options: WriteMaybeEncryptedFileOptions = {},\n memoryDir?: string\n): Promise<void> {\n const { mode = 0o600, atomic = true } = options;\n await mkdir(path.dirname(filePath), { recursive: true });\n\n let data: Buffer | string;\n if (key !== null) {\n const aad = filePathAad(filePath, memoryDir);\n data = encryptFileBody(content, key, aad);\n } else {\n data = content;\n }\n\n if (atomic) {\n const tempPath = uniqueAtomicTempPath(filePath, \"tmp\");\n try {\n await writeFile(tempPath, data, { mode });\n await rename(tempPath, filePath);\n } catch (err) {\n // Best-effort cleanup of the temp file.\n try {\n await unlink(tempPath);\n } catch {\n // ignore\n }\n throw err;\n }\n } else {\n await writeFile(filePath, data, { mode });\n }\n}\n\nexport async function writeMaybeEncryptedFileFromChunks(\n filePath: string,\n chunks: AsyncIterable<Buffer>,\n key: Buffer | null,\n options: WriteMaybeEncryptedFileOptions = {},\n memoryDir?: string\n): Promise<void> {\n const { mode = 0o600, atomic = true } = options;\n await mkdir(path.dirname(filePath), { recursive: true });\n const writePath = atomic ? `${filePath}.tmp-${process.pid}-${Date.now()}` : filePath;\n let completed = false;\n try {\n const handle = await openFile(writePath, \"w\", mode);\n try {\n if (key !== null) {\n const salt = generateSalt();\n const iv = randomBytes(IV_LENGTH);\n const header = Buffer.alloc(MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE);\n MAGIC_BYTES.copy(header, 0);\n header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);\n header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);\n const envelopeOffset = MAGIC_HEADER_SIZE;\n header.writeUInt8(ENVELOPE_VERSION, envelopeOffset + ENVELOPE_LAYOUT.version);\n salt.copy(header, envelopeOffset + ENVELOPE_LAYOUT.salt);\n iv.copy(header, envelopeOffset + ENVELOPE_LAYOUT.iv);\n await handle.write(header);\n\n const cipher = createCipheriv(\"aes-256-gcm\", key, iv, { authTagLength: AUTH_TAG_LENGTH });\n const aad = filePathAad(filePath, memoryDir);\n cipher.setAAD(Buffer.concat([buildHeaderAad(salt), aad]));\n for await (const chunk of chunks) {\n if (chunk.length === 0) continue;\n const encrypted = cipher.update(chunk);\n if (encrypted.length > 0) await handle.write(encrypted);\n }\n const final = cipher.final();\n if (final.length > 0) await handle.write(final);\n const authTag = cipher.getAuthTag();\n await handle.write(authTag, 0, authTag.length, MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag);\n } else {\n for await (const chunk of chunks) {\n if (chunk.length > 0) await handle.write(chunk);\n }\n }\n } finally {\n await handle.close();\n }\n if (atomic) {\n await rename(writePath, filePath);\n }\n completed = true;\n } finally {\n if (!completed && atomic) {\n await unlink(writePath).catch(() => {});\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Migration\n// ---------------------------------------------------------------------------\n\nexport interface MigrateResult {\n /** Number of files successfully encrypted. */\n encrypted: number;\n /** Number of files already encrypted (skipped). */\n skipped: number;\n /** Files that failed to encrypt (path → error message). */\n errors: Array<{ filePath: string; error: string }>;\n}\n\nexport interface DecryptResult {\n /** Number of files successfully decrypted back to plaintext. */\n decrypted: number;\n /** Number of files already plaintext (skipped). */\n skipped: number;\n /** Files that failed to decrypt (path → error message). */\n errors: Array<{ filePath: string; error: string }>;\n}\n\n/**\n * Walk `dir` recursively, find encryptable storage-managed files that are not\n * yet encrypted, and re-write them as encrypted files under `key`.\n *\n * Safety rules per CLAUDE.md gotchas #54 and #25:\n * 1. A page-version snapshot is taken (via `createVersion`) BEFORE\n * each overwrite so the plaintext version is preserved in history.\n * Since this module has no direct access to `page-versioning.ts`\n * internals, callers who have page-versioning configured should\n * pass `onBeforeEncrypt` to take the snapshot.\n * 2. The new encrypted content is written to a temp file first,\n * then renamed atomically — never deleted before written.\n * 3. If encryption of any file fails, the error is recorded and the\n * original file is left intact (partial migration is safe).\n *\n * @param dir Absolute path to the memory directory.\n * @param key 32-byte AES-256 key.\n * @param onBeforeEncrypt Optional callback invoked before encrypting\n * each file. Can be used to take page-version\n * snapshots. Errors here are non-fatal.\n */\nexport async function migrateMemoryDirToEncrypted(\n dir: string,\n key: Buffer,\n onBeforeEncrypt?: (filePath: string) => Promise<void>\n): Promise<MigrateResult> {\n const result: MigrateResult = { encrypted: 0, skipped: 0, errors: [] };\n\n const files = await collectEncryptableStorageFiles(dir);\n for (const filePath of files) {\n try {\n const buf = await readFile(filePath);\n if (isEncryptedFile(buf)) {\n result.skipped++;\n continue;\n }\n // Call optional pre-encryption hook (e.g. page-version snapshot).\n if (onBeforeEncrypt) {\n try {\n await onBeforeEncrypt(filePath);\n } catch {\n // Non-fatal — continue with encryption even if snapshot fails.\n }\n }\n const content = buf.toString(\"utf8\");\n const aad = filePathAad(filePath, dir);\n const encrypted = encryptFileBody(content, key, aad);\n\n // Atomic write: temp → rename (gotcha #54).\n const tempPath = uniqueAtomicTempPath(filePath, \"enc-tmp\");\n try {\n await writeFile(tempPath, encrypted, { mode: 0o600 });\n await rename(tempPath, filePath);\n result.encrypted++;\n } catch (writeErr) {\n // Clean up temp file, leave original intact.\n try {\n const { unlink } = await import(\"node:fs/promises\");\n await unlink(tempPath);\n } catch {\n // ignore\n }\n throw writeErr;\n }\n } catch (err) {\n result.errors.push({\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return result;\n}\n\n/**\n * Walk `dir` recursively, find storage-managed encrypted files, and\n * re-write them as plaintext under the same paths.\n *\n * This is the reversible counterpart to {@link migrateMemoryDirToEncrypted}.\n * It only touches files under the same storage-managed roots, skips\n * plaintext files, skips symlinks, excludes `.secure-store/`, and writes\n * each plaintext replacement via temp-file + rename so a per-file failure\n * leaves the ciphertext intact.\n */\nexport async function decryptMemoryDirToPlaintext(dir: string, key: Buffer): Promise<DecryptResult> {\n const result: DecryptResult = { decrypted: 0, skipped: 0, errors: [] };\n\n const files = await collectStorageManagedFiles(dir, isDecryptableStoragePath);\n for (const filePath of files) {\n try {\n const buf = await readFile(filePath);\n if (!isEncryptedFile(buf)) {\n result.skipped++;\n continue;\n }\n\n const plaintext = decryptFileBodyForPath(buf, key, filePath, dir);\n const tempPath = uniqueAtomicTempPath(filePath, \"dec-tmp\");\n try {\n await writeFile(tempPath, plaintext, { mode: 0o600 });\n await rename(tempPath, filePath);\n result.decrypted++;\n } catch (writeErr) {\n try {\n await unlink(tempPath);\n } catch {\n // ignore cleanup errors; original ciphertext is still intact.\n }\n throw writeErr;\n }\n } catch (err) {\n result.errors.push({\n filePath,\n error: err instanceof Error ? err.message : String(err),\n });\n }\n }\n\n return result;\n}\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\nfunction uniqueAtomicTempPath(filePath: string, label: string): string {\n return `${filePath}.${label}-${process.pid}-${Date.now()}-${randomUUID()}`;\n}\n\nfunction decryptFileBodyForPath(buf: Buffer, key: Buffer, filePath: string, memoryDir?: string): Buffer {\n const aad = filePathAad(filePath, memoryDir);\n try {\n return decryptFileBody(buf, key, aad);\n } catch (err) {\n if (!(err instanceof SecureStoreDecryptError)) {\n throw err;\n }\n const legacyRoot = legacyNamespaceAadRootForFile(filePath, memoryDir);\n if (legacyRoot) {\n try {\n return decryptFileBody(buf, key, filePathAad(filePath, legacyRoot));\n } catch {\n // Fall through to the namespace-reader fallback below.\n }\n }\n\n const topLevelRoot = topLevelAadRootForNamespaceReader(filePath, memoryDir);\n if (topLevelRoot) {\n try {\n return decryptFileBody(buf, key, filePathAad(filePath, topLevelRoot));\n } catch {\n // Preserve the caller-facing error from the canonical decrypt attempt.\n }\n }\n\n throw err;\n }\n}\n\nfunction topLevelAadRootForNamespaceReader(filePath: string, memoryDir?: string): string | null {\n if (!memoryDir || !path.isAbsolute(filePath)) return null;\n const resolvedMemoryDir = path.resolve(memoryDir);\n const rel = path.relative(resolvedMemoryDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const parts = resolvedMemoryDir.split(path.sep);\n if (parts.length < 3 || parts.at(-2) !== \"namespaces\" || !parts.at(-1)) return null;\n const topLevelRoot = parts.slice(0, -2).join(path.sep) || path.sep;\n const topRel = path.relative(topLevelRoot, filePath);\n if (topRel === \"\" || topRel.startsWith(\"..\") || path.isAbsolute(topRel)) {\n return null;\n }\n const topParts = topRel.split(path.sep);\n if (topParts[0] !== \"namespaces\" || topParts[1] !== parts.at(-1)) {\n return null;\n }\n return topLevelRoot;\n}\n\nfunction legacyNamespaceAadRootForFile(filePath: string, memoryDir?: string): string | null {\n if (!memoryDir || !path.isAbsolute(filePath)) return null;\n const rel = path.relative(memoryDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return null;\n const parts = rel.split(path.sep);\n if (parts[0] === \"namespaces\" && parts.length >= 3 && parts[1]) {\n return path.join(memoryDir, \"namespaces\", parts[1]);\n }\n return null;\n}\n\n/**\n * Recursively collect files under `dir` that are read through the\n * storage-layer secure-store helpers, excluding symlinked entries and\n * `.secure-store/` metadata.\n */\nasync function collectEncryptableStorageFiles(dir: string, rootDir = dir): Promise<string[]> {\n return collectStorageManagedFiles(dir, isEncryptableStoragePath, rootDir);\n}\n\n/**\n * Recursively collect regular files under storage-managed roots, excluding\n * symlinked entries and `.secure-store/` metadata. This broader collector is\n * used by the decrypt/disable path so future encrypted sidecars can be\n * restored without requiring extension-specific logic.\n */\nasync function collectStorageManagedFiles(\n dir: string,\n includeFile: (filePath: string, rootDir: string) => boolean,\n rootDir = dir\n): Promise<string[]> {\n const results: string[] = [];\n let scanDir = dir;\n let scanRootDir = rootDir;\n if (path.resolve(dir) === path.resolve(rootDir)) {\n const normalizedRoot = await resolveStorageManagedRootForScan(dir);\n if (!normalizedRoot) return results;\n scanDir = normalizedRoot;\n scanRootDir = normalizedRoot;\n }\n let names: string[];\n try {\n names = await readdir(scanDir, { encoding: \"utf8\" });\n } catch {\n return results;\n }\n for (const name of names) {\n if (name.startsWith(\".secure-store\")) continue;\n const full = path.join(scanDir, name);\n let isDir = false;\n let isFile = false;\n try {\n const s = await lstat(full);\n if (s.isSymbolicLink()) continue;\n isDir = s.isDirectory();\n isFile = s.isFile();\n } catch {\n continue;\n }\n if (isDir) {\n const sub = await collectStorageManagedFiles(full, includeFile, scanRootDir);\n results.push(...sub);\n } else if (isFile && includeFile(full, scanRootDir)) {\n results.push(full);\n }\n }\n return results;\n}\n\nasync function resolveStorageManagedRootForScan(dir: string): Promise<string | null> {\n const lstatPath = normalizePathForLstat(dir);\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await lstat(lstatPath);\n } catch (error) {\n if (isFsErrorWithCode(error, \"ENOENT\")) return null;\n throw error;\n }\n if (stat.isSymbolicLink()) {\n throw new Error(`secure-store migration root must not be a symlink: ${dir}`);\n }\n if (!stat.isDirectory()) {\n throw new Error(`secure-store migration root must be a directory: ${dir}`);\n }\n return lstatPath;\n}\n\nfunction normalizePathForLstat(filePath: string): string {\n return stripTrailingPathSeparators(path.normalize(filePath));\n}\n\nfunction isFsErrorWithCode(error: unknown, code: string): boolean {\n return typeof error === \"object\" && error !== null && (error as { code?: unknown }).code === code;\n}\n\nfunction stripTrailingPathSeparators(filePath: string): string {\n const root = path.parse(filePath).root;\n let end = filePath.length;\n while (\n end > root.length &&\n (filePath[end - 1] === path.sep || filePath[end - 1] === path.posix.sep || filePath[end - 1] === path.win32.sep)\n ) {\n end -= 1;\n }\n return end === filePath.length ? filePath : filePath.slice(0, end);\n}\n\nfunction isEncryptableStoragePath(filePath: string, rootDir: string): boolean {\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return false;\n const normalized = normalizeStorageRelativePath(rel);\n if (normalized === \"profile.md\") return true;\n if (isEncryptableStateSidecar(normalized)) return true;\n if (isEncryptableSummarySidecar(normalized)) return true;\n const firstSegment = normalized.split(\"/\", 1)[0];\n return ENCRYPTABLE_MARKDOWN_STORAGE_ROOTS.has(firstSegment) && normalized.endsWith(\".md\");\n}\n\nfunction isDecryptableStoragePath(filePath: string, rootDir: string): boolean {\n if (isEncryptableStoragePath(filePath, rootDir)) return true;\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return false;\n const normalized = normalizeStorageRelativePath(rel);\n const firstSegment = normalized.split(\"/\", 1)[0];\n return DECRYPTABLE_SIDECAR_ROOTS.has(firstSegment);\n}\n\nfunction normalizeStorageRelativePath(rel: string): string {\n const normalized = rel.split(path.sep).join(\"/\");\n const parts = normalized.split(\"/\");\n if (parts[0] === \"namespaces\" && parts.length >= 3) {\n return parts.slice(2).join(\"/\");\n }\n return normalized;\n}\n\nconst ENCRYPTABLE_MARKDOWN_STORAGE_ROOTS = new Set([\n \"facts\",\n \"corrections\",\n \"procedures\",\n \"reasoning-traces\",\n \"artifacts\",\n \"archive\",\n \"entities\",\n \"identity\",\n]);\n\nconst ENCRYPTABLE_STATE_SIDECARS = new Set([\n \"state/behavior-signals.jsonl\",\n \"state/buffer-surprise-ledger.jsonl\",\n \"state/buffer.json\",\n \"state/compression-guideline-draft-state.json\",\n \"state/compression-guideline-state.json\",\n \"state/compression-guidelines.draft.md\",\n \"state/compression-guidelines.md\",\n \"state/entity-synthesis-queue.json\",\n \"state/fact-hashes.txt\",\n \"state/memory-actions.jsonl\",\n \"state/memory-lifecycle-ledger.jsonl\",\n \"state/meta.json\",\n \"state/reextract-jobs.jsonl\",\n \"state/topics.json\",\n]);\n\nfunction isEncryptableStateSidecar(normalized: string): boolean {\n return ENCRYPTABLE_STATE_SIDECARS.has(normalized);\n}\n\nfunction isEncryptableSummarySidecar(normalized: string): boolean {\n return normalized.startsWith(\"summaries/\") && normalized.endsWith(\".json\");\n}\n\nconst DECRYPTABLE_SIDECAR_ROOTS = new Set([\"state\", \"indexes\", \"index\", \"provenance\"]);\n"],"mappings":";;;;;;;;;;;;;;AA6CA,SAAS,gBAAgB,aAAa,kBAAkB;AACxD,SAAS,OAAO,OAAO,QAAQ,UAAU,UAAU,SAAS,QAAQ,QAAQ,iBAAiB;AAC7F,OAAO,UAAU;AAwBV,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAChD,YAAY,UAAU,6EAAwE;AAC5F,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAOO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACjD,YAAY,UAAU,0EAAqE;AACzF,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAOO,IAAM,cAAc,OAAO,KAAK,cAAc,OAAO;AAGrD,IAAM,sBAAsB;AAG5B,IAAM,oBAAoB;AAG1B,IAAM,oBAAoB,YAAY,SAAS;AAU/C,SAAS,gBAAgB,KAA0B;AACxD,MAAI,IAAI,SAAS,kBAAmB,QAAO;AAC3C,QAAM,IAAI,OAAO,SAAS,GAAG,IAAI,MAAM,OAA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AED,IAAM,6BAA6B,oBAAI,IAAI;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,0BAA0B,YAA6B;AAC9D,SAAO,2BAA2B,IAAI,UAAU;AAClD;AAEA,SAAS,4BAA4B,YAA6B;AAChE,SAAO,WAAW,WAAW,YAAY,KAAK,WAAW,SAAS,OAAO;AAC3E;AAEA,IAAM,4BAA4B,oBAAI,IAAI,CAAC,SAAS,WAAW,SAAS,YAAY,CAAC;","names":["unlink"]}
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  StorageManager,
3
3
  normalizeEntityName
4
- } from "./chunk-A5TLPLUO.js";
4
+ } from "./chunk-TVZ6LKKS.js";
5
5
  import {
6
6
  readEnvVar,
7
7
  resolveHomeDir
@@ -824,4 +824,4 @@ export {
824
824
  resolveBriefingSaveDir,
825
825
  briefingFilename
826
826
  };
827
- //# sourceMappingURL=chunk-FXE46BJ5.js.map
827
+ //# sourceMappingURL=chunk-JFN6K74Q.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-4426WSWL.js";
7
7
  import {
8
8
  StorageManager
9
- } from "./chunk-A5TLPLUO.js";
9
+ } from "./chunk-TVZ6LKKS.js";
10
10
  import {
11
11
  buildLifecycleEventsForMemory,
12
12
  sortMemoryLifecycleEvents
@@ -74,4 +74,4 @@ export {
74
74
  backupExistingLedger,
75
75
  rebuildMemoryLifecycleLedger
76
76
  };
77
- //# sourceMappingURL=chunk-ENIIJ3MZ.js.map
77
+ //# sourceMappingURL=chunk-M3BAMVAE.js.map
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  CompoundingEngine,
24
24
  defaultTierMigrationCycleBudget
25
- } from "./chunk-FWYUJY4N.js";
25
+ } from "./chunk-25BY3HHZ.js";
26
26
  import {
27
27
  SharedContextManager
28
28
  } from "./chunk-DRD2Q7HQ.js";
@@ -168,7 +168,7 @@ import {
168
168
  buildEntityRecallSection,
169
169
  entityRecentTranscriptLookbackHours,
170
170
  readRecentEntityTranscriptEntries
171
- } from "./chunk-GWUUEPOR.js";
171
+ } from "./chunk-FVCZINOF.js";
172
172
  import {
173
173
  buildEventOrderRecallSection,
174
174
  shouldRecallEventOrderEvidence
@@ -203,7 +203,7 @@ import {
203
203
  materializeAfterSemanticConsolidation,
204
204
  parseConsolidationResponse,
205
205
  parseOperatorAwareConsolidationResponse
206
- } from "./chunk-LKUNOD7B.js";
206
+ } from "./chunk-S53PAX2V.js";
207
207
  import {
208
208
  RoutingRulesStore
209
209
  } from "./chunk-HPWVAEET.js";
@@ -212,13 +212,13 @@ import {
212
212
  } from "./chunk-2PRQG7PV.js";
213
213
  import {
214
214
  searchVerifiedEpisodes
215
- } from "./chunk-QKV4LVLA.js";
215
+ } from "./chunk-5WLYNZPC.js";
216
216
  import {
217
217
  ThreadingManager
218
218
  } from "./chunk-W4RVMTHR.js";
219
219
  import {
220
220
  searchVerifiedSemanticRules
221
- } from "./chunk-J62VXZR2.js";
221
+ } from "./chunk-FADZBOR4.js";
222
222
  import {
223
223
  searchWorkProductLedgerEntries
224
224
  } from "./chunk-XPXEJRUB.js";
@@ -240,7 +240,7 @@ import {
240
240
  } from "./chunk-2I5JGH3M.js";
241
241
  import {
242
242
  NamespaceStorageRouter
243
- } from "./chunk-UMXWQL3P.js";
243
+ } from "./chunk-SOTR74FK.js";
244
244
  import {
245
245
  namespaceIdentityFromToken
246
246
  } from "./chunk-ZFXCQPNO.js";
@@ -342,7 +342,7 @@ import {
342
342
  normalizeAttributePairs,
343
343
  normalizeEntityName,
344
344
  parseEntityFile
345
- } from "./chunk-A5TLPLUO.js";
345
+ } from "./chunk-TVZ6LKKS.js";
346
346
  import {
347
347
  attachCitation,
348
348
  hasCitationForTemplate,
@@ -12398,4 +12398,4 @@ export {
12398
12398
  resolvePersistedMemoryRelativePath,
12399
12399
  Orchestrator
12400
12400
  };
12401
- //# sourceMappingURL=chunk-QCJLDMY5.js.map
12401
+ //# sourceMappingURL=chunk-OF46AKZC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runPostConsolidationMaterialize
3
- } from "./chunk-BRCYNT4I.js";
3
+ } from "./chunk-CC2ESOOG.js";
4
4
  import {
5
5
  discoverMemoryExtensions,
6
6
  renderExtensionsBlock,
@@ -217,4 +217,4 @@ export {
217
217
  buildExtensionsBlockForConsolidation,
218
218
  materializeAfterSemanticConsolidation
219
219
  };
220
- //# sourceMappingURL=chunk-LKUNOD7B.js.map
220
+ //# sourceMappingURL=chunk-S53PAX2V.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listNamespaces
3
- } from "./chunk-K6OABSBA.js";
3
+ } from "./chunk-5GX5MUQ2.js";
4
4
  import {
5
5
  runConsolidationProvenanceCheck
6
6
  } from "./chunk-LZ3VEOU5.js";
@@ -36,13 +36,13 @@ import {
36
36
  import {
37
37
  listMemoryGovernanceRuns,
38
38
  readMemoryGovernanceRunArtifact
39
- } from "./chunk-QWQX7YK5.js";
39
+ } from "./chunk-E5OECWZ5.js";
40
40
  import {
41
41
  analyzeGraphHealth
42
42
  } from "./chunk-4JRRISLU.js";
43
43
  import {
44
44
  StorageManager
45
- } from "./chunk-A5TLPLUO.js";
45
+ } from "./chunk-TVZ6LKKS.js";
46
46
  import {
47
47
  lintWorkspaceFiles
48
48
  } from "./chunk-DM2T26WE.js";
@@ -1333,4 +1333,4 @@ export {
1333
1333
  runBenchmarkRecall,
1334
1334
  runOperatorRepair
1335
1335
  };
1336
- //# sourceMappingURL=chunk-3M7OTJ5H.js.map
1336
+ //# sourceMappingURL=chunk-SI3QCHWF.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-ZFXCQPNO.js";
5
5
  import {
6
6
  StorageManager
7
- } from "./chunk-A5TLPLUO.js";
7
+ } from "./chunk-TVZ6LKKS.js";
8
8
  import {
9
9
  isSafeRouteNamespace
10
10
  } from "./chunk-U3PN77QT.js";
@@ -156,4 +156,4 @@ export {
156
156
  getCategoryDir,
157
157
  NamespaceStorageRouter
158
158
  };
159
- //# sourceMappingURL=chunk-UMXWQL3P.js.map
159
+ //# sourceMappingURL=chunk-SOTR74FK.js.map
@@ -69,7 +69,7 @@ import {
69
69
  readMaybeEncryptedFileBuffer,
70
70
  writeMaybeEncryptedFile,
71
71
  writeMaybeEncryptedFileFromChunks
72
- } from "./chunk-73JGZ5VA.js";
72
+ } from "./chunk-ILXTATKK.js";
73
73
  import {
74
74
  parseFlexibleIsoTimestamp
75
75
  } from "./chunk-P7FMDTKL.js";
@@ -5326,4 +5326,4 @@ export {
5326
5326
  serializeEntityFile,
5327
5327
  StorageManager
5328
5328
  };
5329
- //# sourceMappingURL=chunk-A5TLPLUO.js.map
5329
+ //# sourceMappingURL=chunk-TVZ6LKKS.js.map
@@ -10,10 +10,10 @@ import {
10
10
  import {
11
11
  listMemoryGovernanceRuns,
12
12
  readMemoryGovernanceRunArtifact
13
- } from "./chunk-QWQX7YK5.js";
13
+ } from "./chunk-E5OECWZ5.js";
14
14
  import {
15
15
  StorageManager
16
- } from "./chunk-A5TLPLUO.js";
16
+ } from "./chunk-TVZ6LKKS.js";
17
17
  import {
18
18
  normalizeProjectionPreview,
19
19
  normalizeProjectionTags
@@ -929,4 +929,4 @@ export {
929
929
  verifyMemoryProjection,
930
930
  repairMemoryProjection
931
931
  };
932
- //# sourceMappingURL=chunk-RGLJNOQN.js.map
932
+ //# sourceMappingURL=chunk-Y4YATXHL.js.map
@@ -50,7 +50,7 @@ import {
50
50
  listMemoryGovernanceRuns,
51
51
  readMemoryGovernanceRunArtifact,
52
52
  runMemoryGovernance
53
- } from "./chunk-QWQX7YK5.js";
53
+ } from "./chunk-E5OECWZ5.js";
54
54
  import {
55
55
  recordMemoryOutcome
56
56
  } from "./chunk-EIR5VLIH.js";
@@ -80,10 +80,10 @@ import {
80
80
  buildBriefing,
81
81
  parseBriefingFocus,
82
82
  parseBriefingWindow
83
- } from "./chunk-FXE46BJ5.js";
83
+ } from "./chunk-JFN6K74Q.js";
84
84
  import {
85
85
  parseEntityFile
86
- } from "./chunk-A5TLPLUO.js";
86
+ } from "./chunk-TVZ6LKKS.js";
87
87
  import {
88
88
  DEFAULT_RECALL_DISCLOSURE,
89
89
  isRecallDisclosure
@@ -135,7 +135,7 @@ import {
135
135
  buildOfflineSyncSnapshotFromBase,
136
136
  iterateOfflineSyncSnapshotFileRecords,
137
137
  readOfflineSyncFileContentChunk
138
- } from "./chunk-NJBIGWAI.js";
138
+ } from "./chunk-ZLDUQWT2.js";
139
139
  import {
140
140
  evaluateActionConfidence
141
141
  } from "./chunk-AH2JUU6X.js";
@@ -4211,4 +4211,4 @@ export {
4211
4211
  shapeMemorySummary,
4212
4212
  EngramAccessService
4213
4213
  };
4214
- //# sourceMappingURL=chunk-GAMKRZRP.js.map
4214
+ //# sourceMappingURL=chunk-YN3WHXBG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-A5TLPLUO.js";
3
+ } from "./chunk-TVZ6LKKS.js";
4
4
 
5
5
  // src/semantic-rule-promotion.ts
6
6
  function normalizeRuleWhitespace(value) {
@@ -132,4 +132,4 @@ async function promoteSemanticRuleFromMemory(options) {
132
132
  export {
133
133
  promoteSemanticRuleFromMemory
134
134
  };
135
- //# sourceMappingURL=chunk-XE23FSDQ.js.map
135
+ //# sourceMappingURL=chunk-Z56KAZQL.js.map
@@ -10,7 +10,7 @@ import {
10
10
  import {
11
11
  MAGIC_HEADER_SIZE,
12
12
  isEncryptedFile
13
- } from "./chunk-73JGZ5VA.js";
13
+ } from "./chunk-ILXTATKK.js";
14
14
  import {
15
15
  parseFlexibleIsoTimestamp
16
16
  } from "./chunk-P7FMDTKL.js";
@@ -300,6 +300,7 @@ var REMOTE_AUTHORITATIVE_RUNTIME_STATE_FILES = /* @__PURE__ */ new Set([
300
300
  "embeddings.json",
301
301
  "index_time.json",
302
302
  "last_intent.json",
303
+ "last_qmd_recall.json",
303
304
  "last_recall.json",
304
305
  "lcm.sqlite-shm",
305
306
  "lcm.sqlite-wal",
@@ -1641,4 +1642,4 @@ export {
1641
1642
  normalizeOfflineSyncState,
1642
1643
  fileStatesFromSnapshot
1643
1644
  };
1644
- //# sourceMappingURL=chunk-NJBIGWAI.js.map
1645
+ //# sourceMappingURL=chunk-ZLDUQWT2.js.map