@remnic/core 1.1.22 → 1.1.23

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 (103) hide show
  1. package/dist/access-cli.js +15 -15
  2. package/dist/access-http.d.ts +9 -1
  3. package/dist/access-http.js +9 -9
  4. package/dist/access-mcp.d.ts +1 -1
  5. package/dist/access-mcp.js +8 -8
  6. package/dist/access-schema.js +3 -3
  7. package/dist/{access-service-DT9L2DW4.d.ts → access-service-CEyV8XJ5.d.ts} +19 -2
  8. package/dist/access-service.d.ts +1 -1
  9. package/dist/access-service.js +6 -6
  10. package/dist/briefing.js +3 -3
  11. package/dist/causal-consolidation.js +4 -4
  12. package/dist/{chunk-YO3AZEE5.js → chunk-25YQM6XW.js} +3 -3
  13. package/dist/{chunk-TLM762GT.js → chunk-2WIPXV3Y.js} +2 -2
  14. package/dist/{chunk-QOHBYVZG.js → chunk-3F24QTRI.js} +2 -2
  15. package/dist/{chunk-5IQC4OG6.js → chunk-4H6DURG6.js} +2 -2
  16. package/dist/{chunk-NOQ74SJN.js → chunk-7D6O46PF.js} +2 -2
  17. package/dist/{chunk-VMQRBXJ5.js → chunk-7E7SZRPP.js} +2 -2
  18. package/dist/{chunk-7Q2P774N.js → chunk-F33CJ5CH.js} +13 -3
  19. package/dist/chunk-F33CJ5CH.js.map +1 -0
  20. package/dist/{chunk-26OQECWH.js → chunk-FHXVW3L4.js} +4 -4
  21. package/dist/{chunk-UA6OCL6S.js → chunk-HWF42K6J.js} +103 -4
  22. package/dist/chunk-HWF42K6J.js.map +1 -0
  23. package/dist/{chunk-FSODDMR2.js → chunk-IANK6Y5W.js} +2 -2
  24. package/dist/{chunk-FF46Q3SN.js → chunk-JKXFF3NT.js} +356 -32
  25. package/dist/chunk-JKXFF3NT.js.map +1 -0
  26. package/dist/{chunk-NGPO6S3M.js → chunk-MM5EBZVW.js} +42 -5
  27. package/dist/chunk-MM5EBZVW.js.map +1 -0
  28. package/dist/{chunk-GGCJ253V.js → chunk-MVAOT247.js} +8 -8
  29. package/dist/{chunk-SH5S7XYD.js → chunk-MXFBBHJU.js} +72 -2
  30. package/dist/chunk-MXFBBHJU.js.map +1 -0
  31. package/dist/{chunk-SZKCBLS5.js → chunk-PUXCIHRL.js} +2 -2
  32. package/dist/{chunk-2IRT26RZ.js → chunk-QYHQ2JHL.js} +2 -2
  33. package/dist/{chunk-LDJANWTK.js → chunk-RA73CTVY.js} +12 -12
  34. package/dist/{chunk-CN4P6SVA.js → chunk-RCZRL5BE.js} +2 -2
  35. package/dist/{chunk-SGIXDVSF.js → chunk-S27EXIHY.js} +2 -2
  36. package/dist/{chunk-5ML4TH3E.js → chunk-TFORLO3O.js} +4 -4
  37. package/dist/{chunk-TOFUTKQN.js → chunk-TR4DK5OH.js} +2 -2
  38. package/dist/{chunk-6ORWKANA.js → chunk-VYU7PXUS.js} +2 -2
  39. package/dist/{chunk-FFU4GMST.js → chunk-WNARATI3.js} +2 -2
  40. package/dist/{chunk-KSFBM6TV.js → chunk-YITUHONZ.js} +2 -2
  41. package/dist/{cli-BN0CkYzI.d.ts → cli-BguVmIwO.d.ts} +1 -1
  42. package/dist/cli.d.ts +2 -2
  43. package/dist/cli.js +18 -18
  44. package/dist/compounding/engine.js +3 -3
  45. package/dist/connectors/codex-materialize-runner.js +3 -3
  46. package/dist/connectors/index.js +3 -3
  47. package/dist/entity-retrieval.js +3 -3
  48. package/dist/index.d.ts +4 -4
  49. package/dist/index.js +26 -24
  50. package/dist/index.js.map +1 -1
  51. package/dist/maintenance/memory-governance.js +3 -3
  52. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  53. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  54. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  55. package/dist/namespaces/migrate.js +4 -4
  56. package/dist/namespaces/storage.js +3 -3
  57. package/dist/offline-sync.d.ts +36 -1
  58. package/dist/offline-sync.js +4 -2
  59. package/dist/operator-toolkit.js +6 -6
  60. package/dist/orchestrator.js +11 -11
  61. package/dist/schemas.d.ts +22 -22
  62. package/dist/secure-store/index.js +2 -2
  63. package/dist/semantic-consolidation.js +4 -4
  64. package/dist/semantic-rule-promotion.js +3 -3
  65. package/dist/semantic-rule-verifier.js +3 -3
  66. package/dist/storage.d.ts +2 -0
  67. package/dist/storage.js +2 -2
  68. package/dist/transfer/types.d.ts +12 -12
  69. package/dist/verified-recall.js +3 -3
  70. package/package.json +1 -1
  71. package/src/access-http.test.ts +176 -0
  72. package/src/access-http.ts +116 -0
  73. package/src/access-service-offline-file-content.test.ts +37 -0
  74. package/src/access-service.ts +70 -0
  75. package/src/index.ts +2 -0
  76. package/src/offline-sync.test.ts +395 -79
  77. package/src/offline-sync.ts +471 -32
  78. package/src/secure-store/secure-fs.ts +84 -3
  79. package/src/storage.ts +12 -0
  80. package/dist/chunk-7Q2P774N.js.map +0 -1
  81. package/dist/chunk-FF46Q3SN.js.map +0 -1
  82. package/dist/chunk-NGPO6S3M.js.map +0 -1
  83. package/dist/chunk-SH5S7XYD.js.map +0 -1
  84. package/dist/chunk-UA6OCL6S.js.map +0 -1
  85. /package/dist/{chunk-YO3AZEE5.js.map → chunk-25YQM6XW.js.map} +0 -0
  86. /package/dist/{chunk-TLM762GT.js.map → chunk-2WIPXV3Y.js.map} +0 -0
  87. /package/dist/{chunk-QOHBYVZG.js.map → chunk-3F24QTRI.js.map} +0 -0
  88. /package/dist/{chunk-5IQC4OG6.js.map → chunk-4H6DURG6.js.map} +0 -0
  89. /package/dist/{chunk-NOQ74SJN.js.map → chunk-7D6O46PF.js.map} +0 -0
  90. /package/dist/{chunk-VMQRBXJ5.js.map → chunk-7E7SZRPP.js.map} +0 -0
  91. /package/dist/{chunk-26OQECWH.js.map → chunk-FHXVW3L4.js.map} +0 -0
  92. /package/dist/{chunk-FSODDMR2.js.map → chunk-IANK6Y5W.js.map} +0 -0
  93. /package/dist/{chunk-GGCJ253V.js.map → chunk-MVAOT247.js.map} +0 -0
  94. /package/dist/{chunk-SZKCBLS5.js.map → chunk-PUXCIHRL.js.map} +0 -0
  95. /package/dist/{chunk-2IRT26RZ.js.map → chunk-QYHQ2JHL.js.map} +0 -0
  96. /package/dist/{chunk-LDJANWTK.js.map → chunk-RA73CTVY.js.map} +0 -0
  97. /package/dist/{chunk-CN4P6SVA.js.map → chunk-RCZRL5BE.js.map} +0 -0
  98. /package/dist/{chunk-SGIXDVSF.js.map → chunk-S27EXIHY.js.map} +0 -0
  99. /package/dist/{chunk-5ML4TH3E.js.map → chunk-TFORLO3O.js.map} +0 -0
  100. /package/dist/{chunk-TOFUTKQN.js.map → chunk-TR4DK5OH.js.map} +0 -0
  101. /package/dist/{chunk-6ORWKANA.js.map → chunk-VYU7PXUS.js.map} +0 -0
  102. /package/dist/{chunk-FFU4GMST.js.map → chunk-WNARATI3.js.map} +0 -0
  103. /package/dist/{chunk-KSFBM6TV.js.map → chunk-YITUHONZ.js.map} +0 -0
@@ -22,7 +22,7 @@ import {
22
22
  import {
23
23
  CompoundingEngine,
24
24
  defaultTierMigrationCycleBudget
25
- } from "./chunk-FSODDMR2.js";
25
+ } from "./chunk-IANK6Y5W.js";
26
26
  import {
27
27
  SharedContextManager
28
28
  } from "./chunk-U4SCL7B7.js";
@@ -168,7 +168,7 @@ import {
168
168
  buildEntityRecallSection,
169
169
  entityRecentTranscriptLookbackHours,
170
170
  readRecentEntityTranscriptEntries
171
- } from "./chunk-2IRT26RZ.js";
171
+ } from "./chunk-QYHQ2JHL.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-SZKCBLS5.js";
206
+ } from "./chunk-PUXCIHRL.js";
207
207
  import {
208
208
  normalizeReplaySessionKey
209
209
  } from "./chunk-2PRQG7PV.js";
@@ -212,13 +212,13 @@ import {
212
212
  } from "./chunk-LUDTDZLK.js";
213
213
  import {
214
214
  searchVerifiedEpisodes
215
- } from "./chunk-5IQC4OG6.js";
215
+ } from "./chunk-4H6DURG6.js";
216
216
  import {
217
217
  ThreadingManager
218
218
  } from "./chunk-W4RVMTHR.js";
219
219
  import {
220
220
  searchVerifiedSemanticRules
221
- } from "./chunk-QOHBYVZG.js";
221
+ } from "./chunk-3F24QTRI.js";
222
222
  import {
223
223
  searchWorkProductLedgerEntries
224
224
  } from "./chunk-CULXMQJH.js";
@@ -230,7 +230,7 @@ import {
230
230
  } from "./chunk-EABGC2TL.js";
231
231
  import {
232
232
  NamespaceStorageRouter
233
- } from "./chunk-TLM762GT.js";
233
+ } from "./chunk-2WIPXV3Y.js";
234
234
  import {
235
235
  NamespaceSearchRouter
236
236
  } from "./chunk-W7DK3CYM.js";
@@ -340,7 +340,7 @@ import {
340
340
  normalizeAttributePairs,
341
341
  normalizeEntityName,
342
342
  parseEntityFile
343
- } from "./chunk-7Q2P774N.js";
343
+ } from "./chunk-F33CJ5CH.js";
344
344
  import {
345
345
  attachCitation,
346
346
  hasCitationForTemplate,
@@ -12433,4 +12433,4 @@ export {
12433
12433
  resolvePersistedMemoryRelativePath,
12434
12434
  Orchestrator
12435
12435
  };
12436
- //# sourceMappingURL=chunk-GGCJ253V.js.map
12436
+ //# sourceMappingURL=chunk-MVAOT247.js.map
@@ -1,11 +1,18 @@
1
1
  import {
2
+ AUTH_TAG_LENGTH,
3
+ ENVELOPE_HEADER_SIZE,
4
+ ENVELOPE_LAYOUT,
5
+ ENVELOPE_SALT_LENGTH,
6
+ ENVELOPE_VERSION,
7
+ IV_LENGTH,
2
8
  generateSalt,
3
9
  open,
4
10
  seal
5
11
  } from "./chunk-A6XUJE5D.js";
6
12
 
7
13
  // src/secure-store/secure-fs.ts
8
- import { lstat, mkdir, readFile, readdir, rename, unlink, writeFile } from "fs/promises";
14
+ import { createCipheriv, randomBytes } from "crypto";
15
+ import { lstat, mkdir, open as openFile, readFile, readdir, rename, unlink, writeFile } from "fs/promises";
9
16
  import path from "path";
10
17
  var SecureStoreLockedError = class extends Error {
11
18
  constructor(message = "secure-store is locked \u2014 run `remnic secure-store unlock` to decrypt") {
@@ -62,6 +69,12 @@ function decryptFileBody(buf, key, aad) {
62
69
  );
63
70
  }
64
71
  }
72
+ function buildHeaderAad(salt) {
73
+ const out = Buffer.alloc(1 + ENVELOPE_SALT_LENGTH);
74
+ out.writeUInt8(ENVELOPE_VERSION, 0);
75
+ Buffer.from(salt).copy(out, 1);
76
+ return out;
77
+ }
65
78
  function filePathAad(filePath, memoryDir) {
66
79
  let rel = filePath;
67
80
  if (memoryDir && path.isAbsolute(filePath)) {
@@ -111,6 +124,62 @@ async function writeMaybeEncryptedFile(filePath, content, key, options = {}, mem
111
124
  await writeFile(filePath, data, { mode });
112
125
  }
113
126
  }
127
+ async function writeMaybeEncryptedFileFromChunks(filePath, chunks, key, options = {}, memoryDir) {
128
+ const { mode = 384, atomic = true } = options;
129
+ await mkdir(path.dirname(filePath), { recursive: true });
130
+ const writePath = atomic ? `${filePath}.tmp-${process.pid}-${Date.now()}` : filePath;
131
+ let completed = false;
132
+ try {
133
+ const handle = await openFile(writePath, "w", mode);
134
+ try {
135
+ if (key !== null) {
136
+ const salt = generateSalt();
137
+ const iv = randomBytes(IV_LENGTH);
138
+ const header = Buffer.alloc(MAGIC_HEADER_SIZE + ENVELOPE_HEADER_SIZE);
139
+ MAGIC_BYTES.copy(header, 0);
140
+ header.writeUInt8(FILE_FORMAT_VERSION, MAGIC_BYTES.length);
141
+ header.writeUInt8(FILE_FORMAT_FLAGS, MAGIC_BYTES.length + 1);
142
+ const envelopeOffset = MAGIC_HEADER_SIZE;
143
+ header.writeUInt8(ENVELOPE_VERSION, envelopeOffset + ENVELOPE_LAYOUT.version);
144
+ salt.copy(header, envelopeOffset + ENVELOPE_LAYOUT.salt);
145
+ iv.copy(header, envelopeOffset + ENVELOPE_LAYOUT.iv);
146
+ await handle.write(header);
147
+ const cipher = createCipheriv("aes-256-gcm", key, iv, { authTagLength: AUTH_TAG_LENGTH });
148
+ const aad = filePathAad(filePath, memoryDir);
149
+ cipher.setAAD(Buffer.concat([buildHeaderAad(salt), aad]));
150
+ for await (const chunk of chunks) {
151
+ if (chunk.length === 0) continue;
152
+ const encrypted = cipher.update(chunk);
153
+ if (encrypted.length > 0) await handle.write(encrypted);
154
+ }
155
+ const final = cipher.final();
156
+ if (final.length > 0) await handle.write(final);
157
+ const authTag = cipher.getAuthTag();
158
+ await handle.write(
159
+ authTag,
160
+ 0,
161
+ authTag.length,
162
+ MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag
163
+ );
164
+ } else {
165
+ for await (const chunk of chunks) {
166
+ if (chunk.length > 0) await handle.write(chunk);
167
+ }
168
+ }
169
+ } finally {
170
+ await handle.close();
171
+ }
172
+ if (atomic) {
173
+ await rename(writePath, filePath);
174
+ }
175
+ completed = true;
176
+ } finally {
177
+ if (!completed && atomic) {
178
+ await unlink(writePath).catch(() => {
179
+ });
180
+ }
181
+ }
182
+ }
114
183
  async function migrateMemoryDirToEncrypted(dir, key, onBeforeEncrypt) {
115
184
  const result = { encrypted: 0, skipped: 0, errors: [] };
116
185
  const files = await collectEncryptableStorageFiles(dir);
@@ -306,7 +375,8 @@ export {
306
375
  readMaybeEncryptedFileBuffer,
307
376
  readMaybeEncryptedFile,
308
377
  writeMaybeEncryptedFile,
378
+ writeMaybeEncryptedFileFromChunks,
309
379
  migrateMemoryDirToEncrypted,
310
380
  decryptMemoryDirToPlaintext
311
381
  };
312
- //# sourceMappingURL=chunk-SH5S7XYD.js.map
382
+ //# sourceMappingURL=chunk-MXFBBHJU.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 } 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 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 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(\n `secure-store decryption failed: ${msg}`,\n );\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}. ` +\n \"Run `remnic secure-store unlock` to decrypt.\",\n );\n }\n const aad = filePathAad(filePath, memoryDir);\n return decryptFileBody(buf, key, aad);\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 `.tmp-<pid>-<ts>` 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 = `${filePath}.tmp-${process.pid}-${Date.now()}`;\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(\n authTag,\n 0,\n authTag.length,\n MAGIC_HEADER_SIZE + ENVELOPE_LAYOUT.authTag,\n );\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, storageAadRootForFile(filePath, dir));\n const encrypted = encryptFileBody(content, key, aad);\n\n // Atomic write: temp → rename (gotcha #54).\n const tempPath = `${filePath}.enc-tmp-${process.pid}-${Date.now()}`;\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(\n dir: string,\n key: Buffer,\n): 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 aad = filePathAad(filePath, storageAadRootForFile(filePath, dir));\n const plaintext = decryptFileBody(buf, key, aad);\n const tempPath = `${filePath}.dec-tmp-${process.pid}-${Date.now()}`;\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\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 names: string[];\n try {\n names = await readdir(dir, { 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(dir, 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, rootDir);\n results.push(...sub);\n } else if (isFile && includeFile(full, rootDir)) {\n results.push(full);\n }\n }\n return results;\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\nfunction storageAadRootForFile(filePath: string, rootDir: string): string {\n const rel = path.relative(rootDir, filePath);\n if (rel === \"\" || rel.startsWith(\"..\") || path.isAbsolute(rel)) return rootDir;\n const parts = rel.split(path.sep);\n if (parts[0] === \"namespaces\" && parts.length >= 3 && parts[1]) {\n return path.join(rootDir, \"namespaces\", parts[1]);\n }\n return rootDir;\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([\n \"state\",\n \"indexes\",\n \"index\",\n \"provenance\",\n]);\n"],"mappings":";;;;;;;;;;;;;AA6CA,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,OAAO,OAAO,QAAQ,UAAU,UAAU,SAAS,QAAQ,QAAQ,iBAAiB;AAC7F,OAAO,UAAU;AAuBV,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,OAA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A,EACA;AAAA,EACA;AACF,CAAC;AAED,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;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":["unlink"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runPostConsolidationMaterialize
3
- } from "./chunk-KSFBM6TV.js";
3
+ } from "./chunk-YITUHONZ.js";
4
4
  import {
5
5
  discoverMemoryExtensions,
6
6
  renderExtensionsBlock,
@@ -216,4 +216,4 @@ export {
216
216
  buildExtensionsBlockForConsolidation,
217
217
  materializeAfterSemanticConsolidation
218
218
  };
219
- //# sourceMappingURL=chunk-SZKCBLS5.js.map
219
+ //# sourceMappingURL=chunk-PUXCIHRL.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  compareEntityTimestamps,
6
6
  normalizeEntityName
7
- } from "./chunk-7Q2P774N.js";
7
+ } from "./chunk-F33CJ5CH.js";
8
8
  import {
9
9
  sanitizeMemoryContent
10
10
  } from "./chunk-FVQJYWH7.js";
@@ -593,4 +593,4 @@ export {
593
593
  entityIndexVersion,
594
594
  entityRecentTranscriptLookbackHours
595
595
  };
596
- //# sourceMappingURL=chunk-2IRT26RZ.js.map
596
+ //# sourceMappingURL=chunk-QYHQ2JHL.js.map
@@ -44,12 +44,12 @@ import {
44
44
  } from "./chunk-TPMQ3G6Z.js";
45
45
  import {
46
46
  rebuildMemoryLifecycleLedger
47
- } from "./chunk-NOQ74SJN.js";
47
+ } from "./chunk-7D6O46PF.js";
48
48
  import {
49
49
  rebuildMemoryProjection,
50
50
  repairMemoryProjection,
51
51
  verifyMemoryProjection
52
- } from "./chunk-YO3AZEE5.js";
52
+ } from "./chunk-25YQM6XW.js";
53
53
  import {
54
54
  rebuildObservations
55
55
  } from "./chunk-PZIAX57I.js";
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-TMM4S4IJ.js";
65
65
  import {
66
66
  promoteSemanticRuleFromMemory
67
- } from "./chunk-CN4P6SVA.js";
67
+ } from "./chunk-RCZRL5BE.js";
68
68
  import {
69
69
  resolveAgentAccessAuthToken
70
70
  } from "./chunk-MXC3AP5I.js";
@@ -92,12 +92,12 @@ import {
92
92
  runOperatorInventory,
93
93
  runOperatorRepair,
94
94
  runOperatorSetup
95
- } from "./chunk-5ML4TH3E.js";
95
+ } from "./chunk-TFORLO3O.js";
96
96
  import {
97
97
  listNamespaces,
98
98
  runNamespaceMigration,
99
99
  verifyNamespaces
100
- } from "./chunk-SGIXDVSF.js";
100
+ } from "./chunk-S27EXIHY.js";
101
101
  import {
102
102
  GraphDashboardServer
103
103
  } from "./chunk-ZPKBYX2F.js";
@@ -110,7 +110,7 @@ import {
110
110
  } from "./chunk-LUDTDZLK.js";
111
111
  import {
112
112
  searchVerifiedEpisodes
113
- } from "./chunk-5IQC4OG6.js";
113
+ } from "./chunk-4H6DURG6.js";
114
114
  import {
115
115
  getUtilityLearningStatus,
116
116
  learnUtilityPromotionWeights
@@ -124,7 +124,7 @@ import {
124
124
  } from "./chunk-W4RVMTHR.js";
125
125
  import {
126
126
  searchVerifiedSemanticRules
127
- } from "./chunk-QOHBYVZG.js";
127
+ } from "./chunk-3F24QTRI.js";
128
128
  import {
129
129
  getWorkProductLedgerStatus,
130
130
  recordWorkProductLedgerEntry,
@@ -196,13 +196,13 @@ import {
196
196
  } from "./chunk-NGAVDO7E.js";
197
197
  import {
198
198
  EngramAccessHttpServer
199
- } from "./chunk-UA6OCL6S.js";
199
+ } from "./chunk-HWF42K6J.js";
200
200
  import {
201
201
  EngramMcpServer
202
- } from "./chunk-26OQECWH.js";
202
+ } from "./chunk-FHXVW3L4.js";
203
203
  import {
204
204
  EngramAccessService
205
- } from "./chunk-NGPO6S3M.js";
205
+ } from "./chunk-MM5EBZVW.js";
206
206
  import {
207
207
  WorkStorage
208
208
  } from "./chunk-WELDCG6C.js";
@@ -224,7 +224,7 @@ import {
224
224
  readMemoryGovernanceRunArtifact,
225
225
  restoreMemoryGovernanceRun,
226
226
  runMemoryGovernance
227
- } from "./chunk-TOFUTKQN.js";
227
+ } from "./chunk-TR4DK5OH.js";
228
228
  import {
229
229
  selectRouteRule,
230
230
  validateRouteTarget
@@ -6755,4 +6755,4 @@ export {
6755
6755
  resolveMemoryDirForNamespace,
6756
6756
  registerCli
6757
6757
  };
6758
- //# sourceMappingURL=chunk-LDJANWTK.js.map
6758
+ //# sourceMappingURL=chunk-RA73CTVY.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-7Q2P774N.js";
3
+ } from "./chunk-F33CJ5CH.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-CN4P6SVA.js.map
135
+ //# sourceMappingURL=chunk-RCZRL5BE.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NamespaceStorageRouter
3
- } from "./chunk-TLM762GT.js";
3
+ } from "./chunk-2WIPXV3Y.js";
4
4
  import {
5
5
  namespaceCollectionName
6
6
  } from "./chunk-W7DK3CYM.js";
@@ -138,4 +138,4 @@ export {
138
138
  verifyNamespaces,
139
139
  runNamespaceMigration
140
140
  };
141
- //# sourceMappingURL=chunk-SGIXDVSF.js.map
141
+ //# sourceMappingURL=chunk-S27EXIHY.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listNamespaces
3
- } from "./chunk-SGIXDVSF.js";
3
+ } from "./chunk-S27EXIHY.js";
4
4
  import {
5
5
  runConsolidationProvenanceCheck
6
6
  } from "./chunk-5HRY2WRF.js";
@@ -36,13 +36,13 @@ import {
36
36
  import {
37
37
  listMemoryGovernanceRuns,
38
38
  readMemoryGovernanceRunArtifact
39
- } from "./chunk-TOFUTKQN.js";
39
+ } from "./chunk-TR4DK5OH.js";
40
40
  import {
41
41
  analyzeGraphHealth
42
42
  } from "./chunk-RK2Y4XOM.js";
43
43
  import {
44
44
  StorageManager
45
- } from "./chunk-7Q2P774N.js";
45
+ } from "./chunk-F33CJ5CH.js";
46
46
  import {
47
47
  lintWorkspaceFiles
48
48
  } from "./chunk-DM2T26WE.js";
@@ -1314,4 +1314,4 @@ export {
1314
1314
  runBenchmarkRecall,
1315
1315
  runOperatorRepair
1316
1316
  };
1317
- //# sourceMappingURL=chunk-5ML4TH3E.js.map
1317
+ //# sourceMappingURL=chunk-TFORLO3O.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-7Q2P774N.js";
3
+ } from "./chunk-F33CJ5CH.js";
4
4
  import {
5
5
  decideLifecycleTransition
6
6
  } from "./chunk-TBBDFYXW.js";
@@ -718,4 +718,4 @@ export {
718
718
  listMemoryGovernanceRuns,
719
719
  readMemoryGovernanceRunArtifact
720
720
  };
721
- //# sourceMappingURL=chunk-TOFUTKQN.js.map
721
+ //# sourceMappingURL=chunk-TR4DK5OH.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  StorageManager,
3
3
  normalizeEntityName
4
- } from "./chunk-7Q2P774N.js";
4
+ } from "./chunk-F33CJ5CH.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-6ORWKANA.js.map
827
+ //# sourceMappingURL=chunk-VYU7PXUS.js.map
@@ -19,7 +19,7 @@ import {
19
19
  import {
20
20
  decryptMemoryDirToPlaintext,
21
21
  migrateMemoryDirToEncrypted
22
- } from "./chunk-SH5S7XYD.js";
22
+ } from "./chunk-MXFBBHJU.js";
23
23
  import {
24
24
  generateSalt
25
25
  } from "./chunk-A6XUJE5D.js";
@@ -451,4 +451,4 @@ export {
451
451
  renderStatusReport,
452
452
  createPassphraseReader
453
453
  };
454
- //# sourceMappingURL=chunk-FFU4GMST.js.map
454
+ //# sourceMappingURL=chunk-WNARATI3.js.map
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-U3PN77QT.js";
11
11
  import {
12
12
  StorageManager
13
- } from "./chunk-7Q2P774N.js";
13
+ } from "./chunk-F33CJ5CH.js";
14
14
  import {
15
15
  log
16
16
  } from "./chunk-2ODBA7MQ.js";
@@ -116,4 +116,4 @@ export {
116
116
  runCodexMaterialize,
117
117
  runPostConsolidationMaterialize
118
118
  };
119
- //# sourceMappingURL=chunk-KSFBM6TV.js.map
119
+ //# sourceMappingURL=chunk-YITUHONZ.js.map
@@ -14,7 +14,7 @@ import { WorkProjectStatus, WorkTaskStatus, WorkTaskPriority } from './work/type
14
14
  import { RoutePatternType } from './routing/engine.js';
15
15
  import { TailscaleSyncOptions } from './network/tailscale.js';
16
16
  import { DashboardStatus } from './dashboard-runtime.js';
17
- import { E as EngramAccessService } from './access-service-DT9L2DW4.js';
17
+ import { E as EngramAccessService } from './access-service-CEyV8XJ5.js';
18
18
  import { ResolveSecretRefFn } from './resolve-auth-token.js';
19
19
  import { CompatRunner, CompatReport } from './compat/types.js';
20
20
  import { EvalBaselineDeltaReport, EvalBaselineSnapshot, EvalCiGateReport, EvalBenchmarkPackSummary, EvalHarnessStatus, EvalStoredBaselineCiGateReport } from './evals.js';
package/dist/cli.d.ts CHANGED
@@ -10,12 +10,12 @@ import 'node:stream';
10
10
  import './orchestrator-DuWl9Hwx.js';
11
11
  import './replay/runner.js';
12
12
  import './replay/types.js';
13
- export { A as AccessHttpServeCliCommandOptions, c as ArchiveObservationsCliCommandOptions, B as BulkImportCliCommandOptions, C as CompatCliCommandOptions, d as ConnectorsRunCliOutputOptions, e as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, g as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, h as MemoryActionAuditCliNamespaceSummary, i as MemoryActionAuditCliReport, j as MemoryGovernanceCliCommandOptions, k as MemoryGovernanceReportCliCommandOptions, l as MemoryGovernanceRestoreCliCommandOptions, m as MemoryReviewDispositionCliCommandOptions, n as MemoryTimelineCliCommandOptions, o as MigrateCliOrchestrator, q as MigrateCliReport, s as MigrateObservationsCliCommandOptions, t as PolicyDiffCliReport, u as PolicyDiffEntry, v as PolicyRollbackCliReport, w as PolicyStatusCliReport, x as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, y as RebuildMemoryProjectionCliCommandOptions, z as RebuildObservationsCliCommandOptions, F as RepairMemoryProjectionCliCommandOptions, H as ReplayCliCommandOptions, I as ReplayCliOrchestrator, J as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, K as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, L as TailscaleSyncCliCommandOptions, N as TierMigrationCliOrchestrator, O as TrainingExportCliCommandOptions, V as VerifyMemoryProjectionCliCommandOptions, W as WebDavServeCliCommandOptions, Q as WorkProjectCliCommandOptions, U as WorkTaskCliCommandOptions, X as emitConnectorsRunCliResult, Y as filterNormalMemorySearchResults, Z as hasDestructivePurgeFailures, _ as isNormalRetrievalVisibleMemory, $ as parseDurationToMs, a0 as parseStrictCliDate, a1 as planAggressiveDuplicateDeletions, a2 as planExactDuplicateDeletions, a3 as registerCli, a4 as resolveAccessPrincipalOverride, a5 as resolveMemoryDirForNamespace, a6 as runAbstractionNodeStatusCliCommand, a7 as runAccessHttpServeCliCommand, a8 as runAccessHttpStatusCliCommand, a9 as runAccessHttpStopCliCommand, aa as runAccessMcpServeCliCommand, ab as runArchiveObservationsCliCommand, ac as runBenchmarkBaselineReportCliCommand, ad as runBenchmarkBaselineSnapshotCliCommand, ae as runBenchmarkCiGateCliCommand, af as runBenchmarkImportCliCommand, ag as runBenchmarkStatusCliCommand, ah as runBenchmarkStoredBaselineCiGateCliCommand, ai as runBenchmarkValidateCliCommand, r as runBulkImportCliCommand, aj as runCausalTrajectoryStatusCliCommand, ak as runCommitmentLifecycleCliCommand, al as runCommitmentRecordCliCommand, am as runCommitmentSetStateCliCommand, an as runCommitmentStatusCliCommand, ao as runCompatCliCommand, ap as runCompoundingPromoteCliCommand, aq as runConversationIndexHealthCliCommand, ar as runConversationIndexInspectCliCommand, as as runConversationIndexRebuildCliCommand, at as runCueAnchorStatusCliCommand, au as runDashboardStartCliCommand, av as runDashboardStatusCliCommand, aw as runDashboardStopCliCommand, ax as runGraphHealthCliCommand, ay as runHarmonicSearchCliCommand, az as runMemoryActionAuditCliCommand, aA as runMemoryGovernanceCliCommand, aB as runMemoryGovernanceReportCliCommand, aC as runMemoryGovernanceRestoreCliCommand, aD as runMemoryReviewDispositionCliCommand, aE as runMemoryTimelineCliCommand, aF as runMigrateNormalizeFrontmatterCliCommand, aG as runMigrateObservationsCliCommand, aH as runMigrateRechunkCliCommand, aI as runMigrateReextractCliCommand, aJ as runMigrateRescoreImportanceCliCommand, aK as runObjectiveStateStatusCliCommand, aL as runPolicyDiffCliCommand, aM as runPolicyRollbackCliCommand, aN as runPolicyStatusCliCommand, aO as runRebuildMemoryLifecycleLedgerCliCommand, aP as runRebuildMemoryProjectionCliCommand, aQ as runRebuildObservationsCliCommand, aR as runRepairMemoryProjectionCliCommand, aS as runReplayCliCommand, aT as runResumeBundleBuildCliCommand, aU as runResumeBundleRecordCliCommand, aV as runResumeBundleStatusCliCommand, aW as runRouteCliCommand, aX as runSemanticRulePromoteCliCommand, aY as runSemanticRuleVerifyCliCommand, aZ as runSessionCheckCliCommand, a_ as runSessionRepairCliCommand, a$ as runTailscaleStatusCliCommand, b0 as runTailscaleSyncCliCommand, b1 as runTierMigrateCliCommand, b2 as runTierStatusCliCommand, b3 as runTrainingExportCliCommand, b4 as runTrustZoneDemoSeedCliCommand, b5 as runTrustZonePromoteCliCommand, b6 as runTrustZoneStatusCliCommand, b7 as runUtilityLearningCliCommand, b8 as runUtilityLearningStatusCliCommand, b9 as runUtilityTelemetryRecordCliCommand, ba as runUtilityTelemetryStatusCliCommand, bb as runVerifiedRecallSearchCliCommand, bc as runVerifyMemoryProjectionCliCommand, bd as runWebDavServeCliCommand, be as runWebDavStopCliCommand, bf as runWorkProductRecallSearchCliCommand, bg as runWorkProductRecordCliCommand, bh as runWorkProductStatusCliCommand, bi as runWorkProjectCliCommand, bj as runWorkTaskCliCommand } from './cli-BN0CkYzI.js';
13
+ export { A as AccessHttpServeCliCommandOptions, c as ArchiveObservationsCliCommandOptions, B as BulkImportCliCommandOptions, C as CompatCliCommandOptions, d as ConnectorsRunCliOutputOptions, e as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, g as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, h as MemoryActionAuditCliNamespaceSummary, i as MemoryActionAuditCliReport, j as MemoryGovernanceCliCommandOptions, k as MemoryGovernanceReportCliCommandOptions, l as MemoryGovernanceRestoreCliCommandOptions, m as MemoryReviewDispositionCliCommandOptions, n as MemoryTimelineCliCommandOptions, o as MigrateCliOrchestrator, q as MigrateCliReport, s as MigrateObservationsCliCommandOptions, t as PolicyDiffCliReport, u as PolicyDiffEntry, v as PolicyRollbackCliReport, w as PolicyStatusCliReport, x as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, y as RebuildMemoryProjectionCliCommandOptions, z as RebuildObservationsCliCommandOptions, F as RepairMemoryProjectionCliCommandOptions, H as ReplayCliCommandOptions, I as ReplayCliOrchestrator, J as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, K as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, L as TailscaleSyncCliCommandOptions, N as TierMigrationCliOrchestrator, O as TrainingExportCliCommandOptions, V as VerifyMemoryProjectionCliCommandOptions, W as WebDavServeCliCommandOptions, Q as WorkProjectCliCommandOptions, U as WorkTaskCliCommandOptions, X as emitConnectorsRunCliResult, Y as filterNormalMemorySearchResults, Z as hasDestructivePurgeFailures, _ as isNormalRetrievalVisibleMemory, $ as parseDurationToMs, a0 as parseStrictCliDate, a1 as planAggressiveDuplicateDeletions, a2 as planExactDuplicateDeletions, a3 as registerCli, a4 as resolveAccessPrincipalOverride, a5 as resolveMemoryDirForNamespace, a6 as runAbstractionNodeStatusCliCommand, a7 as runAccessHttpServeCliCommand, a8 as runAccessHttpStatusCliCommand, a9 as runAccessHttpStopCliCommand, aa as runAccessMcpServeCliCommand, ab as runArchiveObservationsCliCommand, ac as runBenchmarkBaselineReportCliCommand, ad as runBenchmarkBaselineSnapshotCliCommand, ae as runBenchmarkCiGateCliCommand, af as runBenchmarkImportCliCommand, ag as runBenchmarkStatusCliCommand, ah as runBenchmarkStoredBaselineCiGateCliCommand, ai as runBenchmarkValidateCliCommand, r as runBulkImportCliCommand, aj as runCausalTrajectoryStatusCliCommand, ak as runCommitmentLifecycleCliCommand, al as runCommitmentRecordCliCommand, am as runCommitmentSetStateCliCommand, an as runCommitmentStatusCliCommand, ao as runCompatCliCommand, ap as runCompoundingPromoteCliCommand, aq as runConversationIndexHealthCliCommand, ar as runConversationIndexInspectCliCommand, as as runConversationIndexRebuildCliCommand, at as runCueAnchorStatusCliCommand, au as runDashboardStartCliCommand, av as runDashboardStatusCliCommand, aw as runDashboardStopCliCommand, ax as runGraphHealthCliCommand, ay as runHarmonicSearchCliCommand, az as runMemoryActionAuditCliCommand, aA as runMemoryGovernanceCliCommand, aB as runMemoryGovernanceReportCliCommand, aC as runMemoryGovernanceRestoreCliCommand, aD as runMemoryReviewDispositionCliCommand, aE as runMemoryTimelineCliCommand, aF as runMigrateNormalizeFrontmatterCliCommand, aG as runMigrateObservationsCliCommand, aH as runMigrateRechunkCliCommand, aI as runMigrateReextractCliCommand, aJ as runMigrateRescoreImportanceCliCommand, aK as runObjectiveStateStatusCliCommand, aL as runPolicyDiffCliCommand, aM as runPolicyRollbackCliCommand, aN as runPolicyStatusCliCommand, aO as runRebuildMemoryLifecycleLedgerCliCommand, aP as runRebuildMemoryProjectionCliCommand, aQ as runRebuildObservationsCliCommand, aR as runRepairMemoryProjectionCliCommand, aS as runReplayCliCommand, aT as runResumeBundleBuildCliCommand, aU as runResumeBundleRecordCliCommand, aV as runResumeBundleStatusCliCommand, aW as runRouteCliCommand, aX as runSemanticRulePromoteCliCommand, aY as runSemanticRuleVerifyCliCommand, aZ as runSessionCheckCliCommand, a_ as runSessionRepairCliCommand, a$ as runTailscaleStatusCliCommand, b0 as runTailscaleSyncCliCommand, b1 as runTierMigrateCliCommand, b2 as runTierStatusCliCommand, b3 as runTrainingExportCliCommand, b4 as runTrustZoneDemoSeedCliCommand, b5 as runTrustZonePromoteCliCommand, b6 as runTrustZoneStatusCliCommand, b7 as runUtilityLearningCliCommand, b8 as runUtilityLearningStatusCliCommand, b9 as runUtilityTelemetryRecordCliCommand, ba as runUtilityTelemetryStatusCliCommand, bb as runVerifiedRecallSearchCliCommand, bc as runVerifyMemoryProjectionCliCommand, bd as runWebDavServeCliCommand, be as runWebDavStopCliCommand, bf as runWorkProductRecallSearchCliCommand, bg as runWorkProductRecordCliCommand, bh as runWorkProductStatusCliCommand, bi as runWorkProjectCliCommand, bj as runWorkTaskCliCommand } from './cli-BguVmIwO.js';
14
14
  import './work/types.js';
15
15
  import './routing/engine.js';
16
16
  import './network/tailscale.js';
17
17
  import './dashboard-runtime.js';
18
- import './access-service-DT9L2DW4.js';
18
+ import './access-service-CEyV8XJ5.js';
19
19
  import './resolve-auth-token.js';
20
20
  import './compat/types.js';
21
21
  import './evals.js';
package/dist/cli.js CHANGED
@@ -89,7 +89,7 @@ import {
89
89
  runWorkProductStatusCliCommand,
90
90
  runWorkProjectCliCommand,
91
91
  runWorkTaskCliCommand
92
- } from "./chunk-LDJANWTK.js";
92
+ } from "./chunk-RA73CTVY.js";
93
93
  import "./chunk-ICRIXAP2.js";
94
94
  import "./chunk-EHRTFRWW.js";
95
95
  import "./chunk-S7KDBTWT.js";
@@ -107,21 +107,21 @@ import "./chunk-Z734BLO3.js";
107
107
  import "./chunk-TKWGAOLV.js";
108
108
  import "./chunk-FIT6DMX6.js";
109
109
  import "./chunk-TPMQ3G6Z.js";
110
- import "./chunk-NOQ74SJN.js";
111
- import "./chunk-YO3AZEE5.js";
110
+ import "./chunk-7D6O46PF.js";
111
+ import "./chunk-25YQM6XW.js";
112
112
  import "./chunk-PZIAX57I.js";
113
113
  import "./chunk-65PG43EQ.js";
114
114
  import "./chunk-KJTKLXTH.js";
115
115
  import "./chunk-PK7H5L6Y.js";
116
116
  import "./chunk-LT3NLYSI.js";
117
117
  import "./chunk-TMM4S4IJ.js";
118
- import "./chunk-CN4P6SVA.js";
118
+ import "./chunk-RCZRL5BE.js";
119
119
  import "./chunk-MXC3AP5I.js";
120
120
  import "./chunk-4CRG46BG.js";
121
121
  import "./chunk-MT4HVDUZ.js";
122
122
  import "./chunk-AJA46VX5.js";
123
- import "./chunk-5ML4TH3E.js";
124
- import "./chunk-SGIXDVSF.js";
123
+ import "./chunk-TFORLO3O.js";
124
+ import "./chunk-S27EXIHY.js";
125
125
  import "./chunk-HL4DB7TO.js";
126
126
  import "./chunk-ZPKBYX2F.js";
127
127
  import "./chunk-3SLRNYNG.js";
@@ -131,16 +131,16 @@ import "./chunk-5HRY2WRF.js";
131
131
  import "./chunk-YBPYIAA5.js";
132
132
  import "./chunk-2PRQG7PV.js";
133
133
  import "./chunk-LUDTDZLK.js";
134
- import "./chunk-5IQC4OG6.js";
134
+ import "./chunk-4H6DURG6.js";
135
135
  import "./chunk-PYXS46O7.js";
136
136
  import "./chunk-3QKK7QOS.js";
137
137
  import "./chunk-W4RVMTHR.js";
138
- import "./chunk-QOHBYVZG.js";
138
+ import "./chunk-3F24QTRI.js";
139
139
  import "./chunk-CULXMQJH.js";
140
140
  import "./chunk-5375UYTQ.js";
141
141
  import "./chunk-FF4KLI5W.js";
142
142
  import "./chunk-EABGC2TL.js";
143
- import "./chunk-TLM762GT.js";
143
+ import "./chunk-2WIPXV3Y.js";
144
144
  import "./chunk-W7DK3CYM.js";
145
145
  import "./chunk-NTUNYIF7.js";
146
146
  import "./chunk-NJ3MJQZX.js";
@@ -176,7 +176,7 @@ import "./chunk-6HZ6AO2P.js";
176
176
  import "./chunk-NZL6GGQE.js";
177
177
  import "./chunk-PVGDJXVK.js";
178
178
  import "./chunk-NGAVDO7E.js";
179
- import "./chunk-UA6OCL6S.js";
179
+ import "./chunk-HWF42K6J.js";
180
180
  import "./chunk-SEDEKFYQ.js";
181
181
  import "./chunk-6FC5EGNV.js";
182
182
  import "./chunk-3Y4P7RXM.js";
@@ -184,10 +184,10 @@ import "./chunk-6LVVDPJ4.js";
184
184
  import "./chunk-7MNMYOFP.js";
185
185
  import "./chunk-FKFMOY3N.js";
186
186
  import "./chunk-FAJ7FZYM.js";
187
- import "./chunk-26OQECWH.js";
187
+ import "./chunk-FHXVW3L4.js";
188
188
  import "./chunk-C5BCH4ZS.js";
189
189
  import "./chunk-IQT3XTKW.js";
190
- import "./chunk-NGPO6S3M.js";
190
+ import "./chunk-MM5EBZVW.js";
191
191
  import "./chunk-ZKSK55RC.js";
192
192
  import "./chunk-WELDCG6C.js";
193
193
  import "./chunk-ZYVPLJ4T.js";
@@ -201,7 +201,7 @@ import "./chunk-MGKYQQYF.js";
201
201
  import "./chunk-GL6I6MEQ.js";
202
202
  import "./chunk-3APJ5EVB.js";
203
203
  import "./chunk-5UM2VJ6D.js";
204
- import "./chunk-TOFUTKQN.js";
204
+ import "./chunk-TR4DK5OH.js";
205
205
  import "./chunk-EIR5VLIH.js";
206
206
  import "./chunk-PCUKNJAZ.js";
207
207
  import "./chunk-RRF5UOBJ.js";
@@ -214,8 +214,8 @@ import "./chunk-U3PN77QT.js";
214
214
  import "./chunk-RK2Y4XOM.js";
215
215
  import "./chunk-2LSZVONP.js";
216
216
  import "./chunk-WIICJPET.js";
217
- import "./chunk-6ORWKANA.js";
218
- import "./chunk-7Q2P774N.js";
217
+ import "./chunk-VYU7PXUS.js";
218
+ import "./chunk-F33CJ5CH.js";
219
219
  import "./chunk-5UZXUTVO.js";
220
220
  import "./chunk-NN2DKE4T.js";
221
221
  import "./chunk-Q7P4WJDP.js";
@@ -244,7 +244,7 @@ import "./chunk-TVVEYCNW.js";
244
244
  import "./chunk-RFYAYKTD.js";
245
245
  import "./chunk-LBLXEFWK.js";
246
246
  import "./chunk-XKECPATV.js";
247
- import "./chunk-VMQRBXJ5.js";
247
+ import "./chunk-7E7SZRPP.js";
248
248
  import "./chunk-QA2ZAPBU.js";
249
249
  import "./chunk-WEHSQBFR.js";
250
250
  import "./chunk-KNKUID7G.js";
@@ -252,10 +252,10 @@ import "./chunk-J4EB7DNW.js";
252
252
  import "./chunk-BJMBJZ2Y.js";
253
253
  import "./chunk-UKJAGEXH.js";
254
254
  import "./chunk-FP2373TW.js";
255
- import "./chunk-FF46Q3SN.js";
255
+ import "./chunk-JKXFF3NT.js";
256
256
  import "./chunk-I6K5FBRQ.js";
257
257
  import "./chunk-AGZQD76C.js";
258
- import "./chunk-SH5S7XYD.js";
258
+ import "./chunk-MXFBBHJU.js";
259
259
  import "./chunk-A6XUJE5D.js";
260
260
  import "./chunk-P7FMDTKL.js";
261
261
  import "./chunk-AH2JUU6X.js";