@remnic/core 9.3.768 → 9.3.770

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 (162) hide show
  1. package/dist/access-admin-ops-surface.js +29 -29
  2. package/dist/access-boundary.d.ts +2 -1
  3. package/dist/access-boundary.js +30 -30
  4. package/dist/access-cli.js +85 -83
  5. package/dist/access-cli.js.map +1 -1
  6. package/dist/access-errors.d.ts +5 -0
  7. package/dist/access-errors.js +8 -0
  8. package/dist/access-errors.js.map +1 -0
  9. package/dist/access-http.d.ts +51 -1
  10. package/dist/access-http.js +38 -36
  11. package/dist/access-identity-continuity-surface.js +29 -29
  12. package/dist/access-lcm-surface.js +29 -29
  13. package/dist/access-mcp.d.ts +7 -1
  14. package/dist/access-mcp.js +41 -37
  15. package/dist/access-observe-write-surface.js +29 -29
  16. package/dist/access-operations-batch.js +34 -32
  17. package/dist/access-operations.d.ts +4 -4
  18. package/dist/access-operations.js +36 -34
  19. package/dist/access-recall-surface.js +29 -29
  20. package/dist/access-schema.d.ts +68 -68
  21. package/dist/access-service.js +29 -29
  22. package/dist/access-surface-catalog.js +1 -0
  23. package/dist/access-surface-catalog.js.map +1 -1
  24. package/dist/active-recall.js +5 -5
  25. package/dist/auto-sync-2SOUW4JW.js +1 -1
  26. package/dist/briefing.js +7 -7
  27. package/dist/causal-behavior.js +5 -5
  28. package/dist/causal-chain.js +3 -3
  29. package/dist/causal-consolidation.js +11 -11
  30. package/dist/causal-retrieval.js +3 -3
  31. package/dist/causal-trajectory.js +1 -1
  32. package/dist/{chunk-R3K4CXPR.js → chunk-3JOFWTQD.js} +2 -2
  33. package/dist/{chunk-QOGXUNWL.js → chunk-3O3BZNSH.js} +4 -4
  34. package/dist/{chunk-SFNQDXXL.js → chunk-3YYWUHA7.js} +3 -3
  35. package/dist/{chunk-GLERZDM7.js → chunk-52TEPNL7.js} +29 -7
  36. package/dist/chunk-52TEPNL7.js.map +1 -0
  37. package/dist/{chunk-N4ZA2I7M.js → chunk-5ACKQLGA.js} +2 -2
  38. package/dist/{chunk-YDYC6PIS.js → chunk-5QJZLJ7Q.js} +2 -2
  39. package/dist/{chunk-ORAK3LNZ.js → chunk-6SHAUM5S.js} +5 -5
  40. package/dist/{chunk-CKNAVW34.js → chunk-7OSULYN2.js} +2 -2
  41. package/dist/{chunk-PA5ALD3S.js → chunk-7XGF5HCC.js} +106 -86
  42. package/dist/chunk-7XGF5HCC.js.map +1 -0
  43. package/dist/{chunk-6T4LTI2F.js → chunk-7XH7VJN4.js} +4 -4
  44. package/dist/{chunk-OX272PBW.js → chunk-CSHUSYUM.js} +2 -2
  45. package/dist/{chunk-UG274TNV.js → chunk-E2SPGGUI.js} +13 -8
  46. package/dist/chunk-E2SPGGUI.js.map +1 -0
  47. package/dist/{chunk-HBOPSFQQ.js → chunk-E6LXM2GE.js} +41 -41
  48. package/dist/{chunk-OAREUC7N.js → chunk-EWGMA5W5.js} +28 -28
  49. package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
  50. package/dist/chunk-FTYDWKO6.js +101 -0
  51. package/dist/chunk-FTYDWKO6.js.map +1 -0
  52. package/dist/{chunk-2RLECZ6J.js → chunk-IOENSSZC.js} +2 -2
  53. package/dist/{chunk-VKHZFF5P.js → chunk-KFIAFHOC.js} +2 -2
  54. package/dist/{chunk-NDXJJKT2.js → chunk-KMKBD66B.js} +2 -2
  55. package/dist/{chunk-SQNED75R.js → chunk-KYC3RLYJ.js} +1 -1
  56. package/dist/{chunk-V5RVMULT.js → chunk-MLDAD27I.js} +7 -7
  57. package/dist/{chunk-IGVKWKR2.js → chunk-O5EKTMOJ.js} +6 -6
  58. package/dist/{chunk-TVLN5EZZ.js → chunk-OP43P53G.js} +83 -8
  59. package/dist/chunk-OP43P53G.js.map +1 -0
  60. package/dist/{chunk-4HYFKIGH.js → chunk-PSNMICC2.js} +4 -4
  61. package/dist/{chunk-IVFIYAIP.js → chunk-QKUWPSU3.js} +5 -5
  62. package/dist/{chunk-4DLFJJOQ.js → chunk-QMN3CIFS.js} +2 -2
  63. package/dist/chunk-RANHFI3P.js +8 -0
  64. package/dist/chunk-RANHFI3P.js.map +1 -0
  65. package/dist/{chunk-AS2NRB45.js → chunk-RZ3KJZYE.js} +2 -2
  66. package/dist/{chunk-4JG55YV3.js → chunk-SRSPVFSJ.js} +3 -3
  67. package/dist/{chunk-DTTVX6EO.js → chunk-STN5KMSS.js} +12 -12
  68. package/dist/{chunk-J3UJJZKI.js → chunk-TGROC2UP.js} +108 -7
  69. package/dist/chunk-TGROC2UP.js.map +1 -0
  70. package/dist/{chunk-QPTP6SKC.js → chunk-U72WWTLR.js} +2 -2
  71. package/dist/{chunk-U5GFYMV7.js → chunk-W7VA5667.js} +3 -3
  72. package/dist/{chunk-X7HTU4HO.js → chunk-WB4CFKZ4.js} +2 -2
  73. package/dist/{chunk-NFWTMM2M.js → chunk-XDRJQMYL.js} +2 -2
  74. package/dist/{chunk-CVINPTKG.js → chunk-ZG4FT6IT.js} +5 -5
  75. package/dist/{chunk-MSGPLITO.js → chunk-ZT34X56N.js} +2 -2
  76. package/dist/{chunk-MSGPLITO.js.map → chunk-ZT34X56N.js.map} +1 -1
  77. package/dist/cli.js +58 -56
  78. package/dist/compounding/engine.js +7 -7
  79. package/dist/config.js +2 -2
  80. package/dist/connectors/codex-materialize-runner.js +7 -7
  81. package/dist/connectors/index.js +9 -9
  82. package/dist/consolidation-provenance-check.js +2 -2
  83. package/dist/dashboard-runtime.js +2 -2
  84. package/dist/entity-retrieval.js +7 -7
  85. package/dist/extraction.js +3 -3
  86. package/dist/index.d.ts +1 -1
  87. package/dist/index.js +141 -133
  88. package/dist/lcm/engine.js +3 -3
  89. package/dist/lcm/index.js +11 -11
  90. package/dist/maintenance/memory-governance.js +8 -8
  91. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
  92. package/dist/maintenance/rebuild-memory-projection.js +9 -9
  93. package/dist/namespaces/migrate.js +12 -12
  94. package/dist/namespaces/search.js +4 -4
  95. package/dist/namespaces/storage.js +7 -7
  96. package/dist/operator-toolkit.js +17 -17
  97. package/dist/orchestration/maintenance.js +9 -9
  98. package/dist/orchestrator.js +85 -83
  99. package/dist/recall-timings.d.ts +26 -0
  100. package/dist/recall-timings.js +16 -0
  101. package/dist/recall-timings.js.map +1 -0
  102. package/dist/resume-bundles.js +3 -3
  103. package/dist/schemas.d.ts +84 -84
  104. package/dist/search/factory.js +3 -3
  105. package/dist/search/index.js +7 -7
  106. package/dist/semantic-consolidation.js +10 -10
  107. package/dist/semantic-rule-promotion.js +7 -7
  108. package/dist/semantic-rule-verifier.js +8 -8
  109. package/dist/shared-context/manager.d.ts +8 -8
  110. package/dist/storage.js +8 -8
  111. package/dist/tokens.d.ts +3 -1
  112. package/dist/tokens.js +3 -1
  113. package/dist/transfer/types.d.ts +66 -66
  114. package/dist/verified-recall.js +8 -8
  115. package/package.json +2 -2
  116. package/src/access-boundary.ts +2 -0
  117. package/src/access-errors.ts +2 -0
  118. package/src/access-http.test.ts +350 -0
  119. package/src/access-http.ts +192 -7
  120. package/src/access-mcp.ts +120 -3
  121. package/src/access-operations-batch.ts +19 -0
  122. package/src/access-surface-catalog.ts +1 -0
  123. package/src/index.ts +3 -0
  124. package/src/orchestration/recall-internal.ts +21 -3
  125. package/src/recall-timings-access.test.ts +301 -0
  126. package/src/recall-timings.ts +141 -0
  127. package/src/tokens.test.ts +58 -0
  128. package/src/tokens.ts +19 -8
  129. package/dist/chunk-GLERZDM7.js.map +0 -1
  130. package/dist/chunk-J3UJJZKI.js.map +0 -1
  131. package/dist/chunk-PA5ALD3S.js.map +0 -1
  132. package/dist/chunk-TVLN5EZZ.js.map +0 -1
  133. package/dist/chunk-UG274TNV.js.map +0 -1
  134. /package/dist/{chunk-R3K4CXPR.js.map → chunk-3JOFWTQD.js.map} +0 -0
  135. /package/dist/{chunk-QOGXUNWL.js.map → chunk-3O3BZNSH.js.map} +0 -0
  136. /package/dist/{chunk-SFNQDXXL.js.map → chunk-3YYWUHA7.js.map} +0 -0
  137. /package/dist/{chunk-N4ZA2I7M.js.map → chunk-5ACKQLGA.js.map} +0 -0
  138. /package/dist/{chunk-YDYC6PIS.js.map → chunk-5QJZLJ7Q.js.map} +0 -0
  139. /package/dist/{chunk-ORAK3LNZ.js.map → chunk-6SHAUM5S.js.map} +0 -0
  140. /package/dist/{chunk-CKNAVW34.js.map → chunk-7OSULYN2.js.map} +0 -0
  141. /package/dist/{chunk-6T4LTI2F.js.map → chunk-7XH7VJN4.js.map} +0 -0
  142. /package/dist/{chunk-OX272PBW.js.map → chunk-CSHUSYUM.js.map} +0 -0
  143. /package/dist/{chunk-HBOPSFQQ.js.map → chunk-E6LXM2GE.js.map} +0 -0
  144. /package/dist/{chunk-OAREUC7N.js.map → chunk-EWGMA5W5.js.map} +0 -0
  145. /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
  146. /package/dist/{chunk-2RLECZ6J.js.map → chunk-IOENSSZC.js.map} +0 -0
  147. /package/dist/{chunk-VKHZFF5P.js.map → chunk-KFIAFHOC.js.map} +0 -0
  148. /package/dist/{chunk-NDXJJKT2.js.map → chunk-KMKBD66B.js.map} +0 -0
  149. /package/dist/{chunk-SQNED75R.js.map → chunk-KYC3RLYJ.js.map} +0 -0
  150. /package/dist/{chunk-V5RVMULT.js.map → chunk-MLDAD27I.js.map} +0 -0
  151. /package/dist/{chunk-IGVKWKR2.js.map → chunk-O5EKTMOJ.js.map} +0 -0
  152. /package/dist/{chunk-4HYFKIGH.js.map → chunk-PSNMICC2.js.map} +0 -0
  153. /package/dist/{chunk-IVFIYAIP.js.map → chunk-QKUWPSU3.js.map} +0 -0
  154. /package/dist/{chunk-4DLFJJOQ.js.map → chunk-QMN3CIFS.js.map} +0 -0
  155. /package/dist/{chunk-AS2NRB45.js.map → chunk-RZ3KJZYE.js.map} +0 -0
  156. /package/dist/{chunk-4JG55YV3.js.map → chunk-SRSPVFSJ.js.map} +0 -0
  157. /package/dist/{chunk-DTTVX6EO.js.map → chunk-STN5KMSS.js.map} +0 -0
  158. /package/dist/{chunk-QPTP6SKC.js.map → chunk-U72WWTLR.js.map} +0 -0
  159. /package/dist/{chunk-U5GFYMV7.js.map → chunk-W7VA5667.js.map} +0 -0
  160. /package/dist/{chunk-X7HTU4HO.js.map → chunk-WB4CFKZ4.js.map} +0 -0
  161. /package/dist/{chunk-NFWTMM2M.js.map → chunk-XDRJQMYL.js.map} +0 -0
  162. /package/dist/{chunk-CVINPTKG.js.map → chunk-ZG4FT6IT.js.map} +0 -0
@@ -1,10 +1,10 @@
1
- import {
2
- sidecarKey
3
- } from "./chunk-VF4XKTX3.js";
4
1
  import {
5
2
  DERIVED_FROM_MEMORY_ID_RE,
6
3
  isConsolidationOperator
7
4
  } from "./chunk-G7D6GZ5J.js";
5
+ import {
6
+ sidecarKey
7
+ } from "./chunk-VF4XKTX3.js";
8
8
  import {
9
9
  RECALL_FALLBACK_DIRS
10
10
  } from "./chunk-VS2IYZRU.js";
@@ -342,4 +342,4 @@ function isPathWithin(candidate, root) {
342
342
  export {
343
343
  runConsolidationProvenanceCheck
344
344
  };
345
- //# sourceMappingURL=chunk-6T4LTI2F.js.map
345
+ //# sourceMappingURL=chunk-7XH7VJN4.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-EGGE52UU.js";
5
5
  import {
6
6
  StorageManager
7
- } from "./chunk-DTTVX6EO.js";
7
+ } from "./chunk-STN5KMSS.js";
8
8
  import {
9
9
  MutationSerializer
10
10
  } from "./chunk-LTJAMRGI.js";
@@ -339,4 +339,4 @@ export {
339
339
  resolveNamespaceStorageRoot,
340
340
  NamespaceStorageRouter
341
341
  };
342
- //# sourceMappingURL=chunk-OX272PBW.js.map
342
+ //# sourceMappingURL=chunk-CSHUSYUM.js.map
@@ -21,7 +21,8 @@ var TOKEN_PREFIXES = {
21
21
  "roo-code": "remnic_rc_",
22
22
  "windsurf": "remnic_ws_",
23
23
  "amp": "remnic_am_",
24
- "generic-mcp": "remnic_gm_"
24
+ "generic-mcp": "remnic_gm_",
25
+ "chatgpt": "remnic_cg_"
25
26
  };
26
27
  function defaultTokensPath() {
27
28
  return path.join(resolveHomeDir(), ".remnic", "tokens.json");
@@ -209,21 +210,24 @@ function getAllValidTokens(tokensPath) {
209
210
  return loadTokenStore(tokensPath).tokens.map((t) => t.token);
210
211
  }
211
212
  var TOKEN_CACHE_TTL_MS = 5e3;
212
- var _cachedTokens = [];
213
+ var _cachedEntries = [];
213
214
  var _cachedAt = 0;
214
215
  var _cachedPath;
215
216
  function invalidateTokenCache() {
216
- _cachedTokens = [];
217
+ _cachedEntries = [];
217
218
  _cachedAt = 0;
218
219
  _cachedPath = void 0;
219
220
  }
220
- function getAllValidTokensCached(tokensPath) {
221
+ function getAllValidTokenEntriesCached(tokensPath) {
221
222
  const now = Date.now();
222
- if (now - _cachedAt < TOKEN_CACHE_TTL_MS && tokensPath === _cachedPath) return _cachedTokens;
223
- _cachedTokens = getAllValidTokens(tokensPath);
223
+ if (now - _cachedAt < TOKEN_CACHE_TTL_MS && tokensPath === _cachedPath) return _cachedEntries;
224
+ _cachedEntries = loadTokenStore(tokensPath).tokens;
224
225
  _cachedAt = now;
225
226
  _cachedPath = tokensPath;
226
- return _cachedTokens;
227
+ return _cachedEntries;
228
+ }
229
+ function getAllValidTokensCached(tokensPath) {
230
+ return getAllValidTokenEntriesCached(tokensPath).map((entry) => entry.token);
227
231
  }
228
232
  function resolveConnectorFromToken(token, tokensPath) {
229
233
  return loadTokenStore(tokensPath).tokens.find((t) => t.token === token)?.connector;
@@ -238,7 +242,8 @@ export {
238
242
  listTokens,
239
243
  revokeToken,
240
244
  getAllValidTokens,
245
+ getAllValidTokenEntriesCached,
241
246
  getAllValidTokensCached,
242
247
  resolveConnectorFromToken
243
248
  };
244
- //# sourceMappingURL=chunk-UG274TNV.js.map
249
+ //# sourceMappingURL=chunk-E2SPGGUI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/tokens.ts"],"sourcesContent":["/**\n * Token management for Remnic multi-connector auth.\n *\n * Manages per-connector tokens in ~/.remnic/tokens.json.\n * Each connector gets a unique token with a recognizable prefix.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { randomBytes, randomUUID } from \"node:crypto\";\nimport { resolveHomeDir } from \"./runtime/env.js\";\n\nexport interface TokenEntry {\n token: string;\n connector: string;\n createdAt: string;\n}\n\nexport interface TokenStore {\n tokens: TokenEntry[];\n}\n\nconst TOKEN_PREFIXES: Record<string, string> = {\n \"openclaw\": \"remnic_oc_\",\n \"claude-code\": \"remnic_cc_\",\n \"codex-cli\": \"remnic_cx_\",\n \"codex\": \"remnic_cx_\",\n \"hermes\": \"remnic_hm_\",\n \"pi\": \"remnic_pi_\",\n \"omp\": \"remnic_op_\",\n \"replit\": \"remnic_rl_\",\n \"cursor\": \"remnic_cu_\",\n \"cline\": \"remnic_cl_\",\n \"github-copilot\": \"remnic_gh_\",\n \"roo-code\": \"remnic_rc_\",\n \"windsurf\": \"remnic_ws_\",\n \"amp\": \"remnic_am_\",\n \"generic-mcp\": \"remnic_gm_\",\n \"chatgpt\": \"remnic_cg_\",\n};\n\nfunction defaultTokensPath(): string {\n return path.join(resolveHomeDir(), \".remnic\", \"tokens.json\");\n}\n\nfunction legacyTokensPath(): string {\n return path.join(resolveHomeDir(), \".engram\", \"tokens.json\");\n}\n\nfunction resolveReadPath(tokensPath?: string): string {\n const primary = tokensPath ?? defaultTokensPath();\n if (tokensPath) return primary;\n if (fs.existsSync(primary)) return primary;\n const legacy = legacyTokensPath();\n return fs.existsSync(legacy) ? legacy : primary;\n}\n\nfunction ensureDir(filePath: string): void {\n const dir = path.dirname(filePath);\n fs.mkdirSync(dir, { recursive: true });\n}\n\nfunction isEnoent(error: unknown): boolean {\n return error instanceof Error && \"code\" in error && (error as NodeJS.ErrnoException).code === \"ENOENT\";\n}\n\nfunction validateTokenEntry(raw: unknown, index: number): TokenEntry {\n if (typeof raw !== \"object\" || raw === null || Array.isArray(raw)) {\n throw new Error(`invalid token entry at index ${index}: expected object`);\n }\n const entry = raw as Record<string, unknown>;\n if (typeof entry.token !== \"string\" || entry.token.length === 0) {\n throw new Error(`invalid token entry at index ${index}: token must be a non-empty string`);\n }\n if (typeof entry.connector !== \"string\" || entry.connector.length === 0) {\n throw new Error(`invalid token entry at index ${index}: connector must be a non-empty string`);\n }\n return {\n token: entry.token,\n connector: entry.connector,\n createdAt:\n typeof entry.createdAt === \"string\" && entry.createdAt.length > 0\n ? entry.createdAt\n : new Date(0).toISOString(),\n };\n}\n\nfunction parseTokenStore(rawText: string, filePath: string): { store: TokenStore; migratedLegacy: boolean } {\n let raw: unknown;\n try {\n raw = JSON.parse(rawText);\n } catch (error) {\n throw new Error(\n `failed to parse token store at ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n\n if (typeof raw === \"object\" && raw !== null && !Array.isArray(raw)) {\n const record = raw as Record<string, unknown>;\n if (record.tokens !== undefined) {\n if (!Array.isArray(record.tokens)) {\n throw new Error(`invalid token store at ${filePath}: tokens must be an array`);\n }\n return {\n store: {\n tokens: record.tokens.map((entry, index) => validateTokenEntry(entry, index)),\n },\n migratedLegacy: false,\n };\n }\n\n // Migrate legacy flat-map format: { \"connector\": \"token_value\", ... }\n const migrated: TokenEntry[] = [];\n for (const [key, value] of Object.entries(record)) {\n if (typeof value === \"string\" && value.length > 0) {\n migrated.push(\n validateTokenEntry(\n { token: value, connector: key, createdAt: new Date().toISOString() },\n migrated.length,\n ),\n );\n }\n }\n if (migrated.length > 0) {\n return { store: { tokens: migrated }, migratedLegacy: true };\n }\n }\n\n throw new Error(`invalid token store at ${filePath}: expected token array or legacy connector map`);\n}\n\nexport function loadTokenStore(tokensPath?: string): TokenStore {\n const p = resolveReadPath(tokensPath);\n try {\n const rawText = fs.readFileSync(p, \"utf8\");\n const { store, migratedLegacy } = parseTokenStore(rawText, p);\n if (migratedLegacy) {\n // Auto-migrate legacy flat-map stores in new format. This is best-effort:\n // a migration write failure must not hide the successfully parsed tokens.\n try {\n saveTokenStore(store, tokensPath);\n } catch {\n // Migration write failed (e.g., read-only fs) — still return parsed tokens.\n }\n }\n return store;\n } catch (error) {\n if (isEnoent(error)) {\n return { tokens: [] };\n }\n throw error;\n }\n}\n\nfunction fsyncDirectoryBestEffort(dirPath: string): void {\n let dirFd: number | null = null;\n try {\n dirFd = fs.openSync(dirPath, \"r\");\n fs.fsyncSync(dirFd);\n } catch {\n // Directory fsync is not supported on every platform/filesystem.\n } finally {\n if (dirFd !== null) {\n try { fs.closeSync(dirFd); } catch { /* ignore */ }\n }\n }\n}\n\nexport function saveTokenStore(store: TokenStore, tokensPath?: string): void {\n const p = tokensPath ?? defaultTokensPath();\n ensureDir(p);\n const validated: TokenStore = {\n tokens: store.tokens.map((entry, index) => validateTokenEntry(entry, index)),\n };\n const dir = path.dirname(p);\n const tmpPath = path.join(dir, `.${path.basename(p)}.${process.pid}.${randomUUID()}.tmp`);\n let fd: number | null = null;\n try {\n fd = fs.openSync(tmpPath, \"w\", 0o600);\n fs.writeFileSync(fd, JSON.stringify(validated, null, 2) + \"\\n\", \"utf8\");\n fs.fsyncSync(fd);\n fs.closeSync(fd);\n fd = null;\n fs.renameSync(tmpPath, p);\n // Tighten permissions on pre-existing files after atomic replacement.\n try { fs.chmodSync(p, 0o600); } catch { /* ignore on platforms without chmod */ }\n fsyncDirectoryBestEffort(dir);\n invalidateTokenCache();\n } catch (error) {\n if (fd !== null) {\n try { fs.closeSync(fd); } catch { /* ignore */ }\n }\n try { fs.rmSync(tmpPath, { force: true }); } catch { /* ignore cleanup failure */ }\n throw error;\n }\n}\n\n/**\n * Build a TokenEntry candidate WITHOUT saving it to the store.\n * Callers use this when they need to defer the save until after a\n * dependent write (e.g. Hermes config.yaml) succeeds — see\n * commitTokenEntry() to persist the candidate.\n */\nexport function buildTokenEntry(connector: string): TokenEntry {\n const prefix = TOKEN_PREFIXES[connector] ?? \"remnic_xx_\";\n const token = prefix + randomBytes(24).toString(\"hex\");\n return {\n token,\n connector,\n createdAt: new Date().toISOString(),\n };\n}\n\n/**\n * Persist a pre-built TokenEntry into the store, replacing any existing\n * entry for the same connector. Used together with buildTokenEntry() when\n * the caller wants to defer the save until after a dependent write succeeds.\n *\n * For transactional rollback, callers should snapshot the full store via\n * loadTokenStore() BEFORE calling commitTokenEntry() and restore it with\n * saveTokenStore() on failure. A full-store snapshot handles partial writes\n * of tokens.json atomically — single-entry restore via the return value is\n * insufficient because if this function throws during saveTokenStore, the\n * return statement never executes (UXJI/UXJT fix).\n */\nexport function commitTokenEntry(entry: TokenEntry, tokensPath?: string): void {\n const store = loadTokenStore(tokensPath);\n store.tokens = store.tokens.filter((t) => t.connector !== entry.connector);\n store.tokens.push(entry);\n saveTokenStore(store, tokensPath);\n}\n\nexport function generateToken(connector: string, tokensPath?: string): TokenEntry {\n const store = loadTokenStore(tokensPath);\n\n // Remove existing token for this connector\n store.tokens = store.tokens.filter((t) => t.connector !== connector);\n\n const entry = buildTokenEntry(connector);\n store.tokens.push(entry);\n saveTokenStore(store, tokensPath);\n return entry;\n}\n\nexport function listTokens(tokensPath?: string): TokenEntry[] {\n return loadTokenStore(tokensPath).tokens;\n}\n\nexport function revokeToken(connector: string, tokensPath?: string): boolean {\n const store = loadTokenStore(tokensPath);\n const before = store.tokens.length;\n store.tokens = store.tokens.filter((t) => t.connector !== connector);\n if (store.tokens.length < before) {\n saveTokenStore(store, tokensPath);\n return true;\n }\n return false;\n}\n\nexport function getAllValidTokens(tokensPath?: string): string[] {\n return loadTokenStore(tokensPath).tokens.map((t) => t.token);\n}\n\n// Cached token-entry snapshot to avoid synchronous disk I/O on every HTTP\n// request. Re-reads tokens.json at most once per TTL interval (default 5s).\n// There is deliberately exactly ONE cache: validation (token strings) and\n// identity (connector ids) are derived from the SAME snapshot, so a token\n// can never validate against a fresher snapshot than the one that resolves\n// its connector. saveTokenStore() invalidates on every mutation, so a\n// freshly minted or revoked token is coherent immediately.\nconst TOKEN_CACHE_TTL_MS = 5_000;\nlet _cachedEntries: TokenEntry[] = [];\nlet _cachedAt = 0;\nlet _cachedPath: string | undefined;\n\nfunction invalidateTokenCache(): void {\n _cachedEntries = [];\n _cachedAt = 0;\n _cachedPath = undefined;\n}\n\n/** Cached token-entry snapshot ({token, connector} pairs). */\nexport function getAllValidTokenEntriesCached(tokensPath?: string): readonly TokenEntry[] {\n const now = Date.now();\n if (now - _cachedAt < TOKEN_CACHE_TTL_MS && tokensPath === _cachedPath) return _cachedEntries;\n _cachedEntries = loadTokenStore(tokensPath).tokens;\n _cachedAt = now;\n _cachedPath = tokensPath;\n return _cachedEntries;\n}\n\nexport function getAllValidTokensCached(tokensPath?: string): string[] {\n return getAllValidTokenEntriesCached(tokensPath).map((entry) => entry.token);\n}\n\nexport function resolveConnectorFromToken(token: string, tokensPath?: string): string | undefined {\n return loadTokenStore(tokensPath).tokens.find((t) => t.token === token)?.connector;\n}\n"],"mappings":";;;;;AAOA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,aAAa,kBAAkB;AAaxC,IAAM,iBAAyC;AAAA,EAC7C,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,SAAS;AAAA,EACT,UAAU;AAAA,EACV,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,UAAU;AAAA,EACV,SAAS;AAAA,EACT,kBAAkB;AAAA,EAClB,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,eAAe;AAAA,EACf,WAAW;AACb;AAEA,SAAS,oBAA4B;AACnC,SAAO,KAAK,KAAK,eAAe,GAAG,WAAW,aAAa;AAC7D;AAEA,SAAS,mBAA2B;AAClC,SAAO,KAAK,KAAK,eAAe,GAAG,WAAW,aAAa;AAC7D;AAEA,SAAS,gBAAgB,YAA6B;AACpD,QAAM,UAAU,cAAc,kBAAkB;AAChD,MAAI,WAAY,QAAO;AACvB,MAAI,GAAG,WAA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,sBAAsB,eAAe,YAAa,QAAO;AAC/E,mBAAiB,eAAe,UAAU,EAAE;AAC5C,cAAY;AACZ,gBAAc;AACd,SAAO;AACT;AAEO,SAAS,wBAAwB,YAA+B;AACrE,SAAO,8BAA8B,UAAU,EAAE,IAAI,CAAC,UAAU,MAAM,KAAK;AAC7E;AAEO,SAAS,0BAA0B,OAAe,YAAyC;AAChG,SAAO,eAAe,UAAU,EAAE,OAAO,KAAK,CAAC,MAAM,EAAE,UAAU,KAAK,GAAG;AAC3E;","names":[]}
@@ -1,12 +1,15 @@
1
- import {
2
- chatgptReplayNormalizer
3
- } from "./chunk-MC4FJXPA.js";
4
1
  import {
5
2
  claudeReplayNormalizer
6
3
  } from "./chunk-LQHDIS7L.js";
7
4
  import {
8
5
  openclawReplayNormalizer
9
6
  } from "./chunk-7F7Z6MOS.js";
7
+ import {
8
+ chatgptReplayNormalizer
9
+ } from "./chunk-MC4FJXPA.js";
10
+ import {
11
+ exportJsonBundle
12
+ } from "./chunk-UP6MOYCB.js";
10
13
  import {
11
14
  exportSqlite
12
15
  } from "./chunk-7VFZTJ7K.js";
@@ -25,12 +28,15 @@ import {
25
28
  import {
26
29
  backupMemoryDir
27
30
  } from "./chunk-2BFLDH5F.js";
28
- import {
29
- exportJsonBundle
30
- } from "./chunk-UP6MOYCB.js";
31
31
  import {
32
32
  exportMarkdownBundle
33
33
  } from "./chunk-765K3SAT.js";
34
+ import {
35
+ RoutingRulesStore
36
+ } from "./chunk-WIWPSQYU.js";
37
+ import {
38
+ TailscaleHelper
39
+ } from "./chunk-EEC4PCG5.js";
34
40
  import {
35
41
  WebDavServer
36
42
  } from "./chunk-PYIFUBRK.js";
@@ -44,28 +50,22 @@ import {
44
50
  normalizeReplaySessionKey
45
51
  } from "./chunk-2PRQG7PV.js";
46
52
  import {
47
- RoutingRulesStore
48
- } from "./chunk-WIWPSQYU.js";
53
+ rebuildMemoryLifecycleLedger
54
+ } from "./chunk-KMKBD66B.js";
55
+ import {
56
+ rebuildMemoryProjection,
57
+ repairMemoryProjection,
58
+ verifyMemoryProjection
59
+ } from "./chunk-3YYWUHA7.js";
49
60
  import {
50
61
  rebuildObservations
51
62
  } from "./chunk-LZZNTPLR.js";
52
- import {
53
- TailscaleHelper
54
- } from "./chunk-EEC4PCG5.js";
55
63
  import {
56
64
  archiveObservations
57
65
  } from "./chunk-WMWVO45V.js";
58
66
  import {
59
67
  migrateObservations
60
68
  } from "./chunk-D6RIFG4O.js";
61
- import {
62
- rebuildMemoryLifecycleLedger
63
- } from "./chunk-NDXJJKT2.js";
64
- import {
65
- rebuildMemoryProjection,
66
- repairMemoryProjection,
67
- verifyMemoryProjection
68
- } from "./chunk-SFNQDXXL.js";
69
69
  import {
70
70
  getBulkImportSource,
71
71
  listBulkImportSources,
@@ -75,6 +75,9 @@ import {
75
75
  import {
76
76
  runCompatChecks
77
77
  } from "./chunk-GQL52GQ5.js";
78
+ import {
79
+ searchVerifiedEpisodes
80
+ } from "./chunk-5ACKQLGA.js";
78
81
  import {
79
82
  getUtilityLearningStatus,
80
83
  learnUtilityPromotionWeights
@@ -83,21 +86,15 @@ import {
83
86
  getUtilityTelemetryStatus,
84
87
  recordUtilityTelemetryEvent
85
88
  } from "./chunk-TERNBNJB.js";
86
- import {
87
- searchVerifiedEpisodes
88
- } from "./chunk-N4ZA2I7M.js";
89
89
  import {
90
90
  ThreadingManager
91
91
  } from "./chunk-QRDOSYOR.js";
92
92
  import {
93
93
  promoteSemanticRuleFromMemory
94
- } from "./chunk-X7HTU4HO.js";
94
+ } from "./chunk-WB4CFKZ4.js";
95
95
  import {
96
96
  searchVerifiedSemanticRules
97
- } from "./chunk-VKHZFF5P.js";
98
- import {
99
- resolveAgentAccessAuthToken
100
- } from "./chunk-TGQ2NTWH.js";
97
+ } from "./chunk-KFIAFHOC.js";
101
98
  import {
102
99
  buildResumeBundleFromState,
103
100
  getResumeBundleStatus,
@@ -111,6 +108,9 @@ import {
111
108
  import {
112
109
  utcDayRange
113
110
  } from "./chunk-GY3SKOS4.js";
111
+ import {
112
+ resolveAgentAccessAuthToken
113
+ } from "./chunk-TGQ2NTWH.js";
114
114
  import {
115
115
  parseXrayCliOptions
116
116
  } from "./chunk-DANV2HTH.js";
@@ -126,12 +126,12 @@ import {
126
126
  runOperatorInventory,
127
127
  runOperatorRepair,
128
128
  runOperatorSetup
129
- } from "./chunk-IGVKWKR2.js";
129
+ } from "./chunk-O5EKTMOJ.js";
130
130
  import {
131
131
  listNamespaces,
132
132
  runNamespaceMigration,
133
133
  verifyNamespaces
134
- } from "./chunk-U5GFYMV7.js";
134
+ } from "./chunk-W7VA5667.js";
135
135
  import {
136
136
  analyzeSessionIntegrity,
137
137
  applySessionRepair,
@@ -183,7 +183,7 @@ import {
183
183
  } from "./chunk-FZZ2QTJI.js";
184
184
  import {
185
185
  GraphDashboardServer
186
- } from "./chunk-YNDLCWXS.js";
186
+ } from "./chunk-EZ25VE3G.js";
187
187
  import {
188
188
  applyCommitmentLedgerLifecycle,
189
189
  getCommitmentLedgerStatus,
@@ -213,7 +213,7 @@ import {
213
213
  } from "./chunk-OADWQ5CR.js";
214
214
  import {
215
215
  EngramAccessHttpServer
216
- } from "./chunk-J3UJJZKI.js";
216
+ } from "./chunk-TGROC2UP.js";
217
217
  import {
218
218
  WearablesInputError
219
219
  } from "./chunk-7WV3F5DQ.js";
@@ -226,10 +226,10 @@ import {
226
226
  createProductionChatLlmAdapter,
227
227
  loadChatSession,
228
228
  sessionBelongsToPrincipal
229
- } from "./chunk-TVLN5EZZ.js";
229
+ } from "./chunk-OP43P53G.js";
230
230
  import {
231
231
  EngramAccessService
232
- } from "./chunk-OAREUC7N.js";
232
+ } from "./chunk-EWGMA5W5.js";
233
233
  import {
234
234
  WorkStorage
235
235
  } from "./chunk-GDB4J2H3.js";
@@ -252,7 +252,7 @@ import {
252
252
  readMemoryGovernanceRunArtifact,
253
253
  restoreMemoryGovernanceRun,
254
254
  runMemoryGovernance
255
- } from "./chunk-IVFIYAIP.js";
255
+ } from "./chunk-QKUWPSU3.js";
256
256
  import {
257
257
  getObjectiveStateStoreStatus
258
258
  } from "./chunk-6HMYUWXR.js";
@@ -261,7 +261,7 @@ import {
261
261
  } from "./chunk-EHQ5HO5T.js";
262
262
  import {
263
263
  getCausalTrajectoryStoreStatus
264
- } from "./chunk-SQNED75R.js";
264
+ } from "./chunk-KYC3RLYJ.js";
265
265
  import {
266
266
  assertPathInsideRoot
267
267
  } from "./chunk-5GPPACXK.js";
@@ -269,6 +269,11 @@ import {
269
269
  RECALL_DISCLOSURE_LEVELS,
270
270
  isRecallDisclosure
271
271
  } from "./chunk-JS2HKKOK.js";
272
+ import {
273
+ buildActionConfidenceInputFromOptions,
274
+ evaluateActionConfidence,
275
+ renderActionConfidenceText
276
+ } from "./chunk-Z2YFLXHU.js";
272
277
  import {
273
278
  selectRouteRule,
274
279
  validateRouteTarget
@@ -296,11 +301,6 @@ import {
296
301
  import {
297
302
  resolveHomeDir
298
303
  } from "./chunk-JUC24CTX.js";
299
- import {
300
- buildActionConfidenceInputFromOptions,
301
- evaluateActionConfidence,
302
- renderActionConfidenceText
303
- } from "./chunk-Z2YFLXHU.js";
304
304
  import {
305
305
  RECALL_FALLBACK_DIRS
306
306
  } from "./chunk-VS2IYZRU.js";
@@ -7520,4 +7520,4 @@ export {
7520
7520
  listMemoryMarkdownFilePaths,
7521
7521
  registerCli
7522
7522
  };
7523
- //# sourceMappingURL=chunk-HBOPSFQQ.js.map
7523
+ //# sourceMappingURL=chunk-E6LXM2GE.js.map
@@ -53,7 +53,7 @@ import {
53
53
  } from "./chunk-BAVVI5GP.js";
54
54
  import {
55
55
  namespaceCollectionName
56
- } from "./chunk-CKNAVW34.js";
56
+ } from "./chunk-7OSULYN2.js";
57
57
  import {
58
58
  namespaceIdentityFromToken
59
59
  } from "./chunk-EGGE52UU.js";
@@ -64,7 +64,7 @@ import {
64
64
  listMemoryGovernanceRuns,
65
65
  readMemoryGovernanceRunArtifact,
66
66
  runMemoryGovernance
67
- } from "./chunk-IVFIYAIP.js";
67
+ } from "./chunk-QKUWPSU3.js";
68
68
  import {
69
69
  recordMemoryOutcome
70
70
  } from "./chunk-EIR5VLIH.js";
@@ -83,42 +83,45 @@ import {
83
83
  import {
84
84
  formatProfileTraceAscii
85
85
  } from "./chunk-PNLCEFE4.js";
86
+ import {
87
+ buildProcedurePersistBody,
88
+ normalizeProcedureSteps
89
+ } from "./chunk-QDW3E4RD.js";
86
90
  import {
87
91
  persistExplicitCapture,
88
92
  queueExplicitCaptureForReview,
89
93
  validateExplicitCaptureInput
90
94
  } from "./chunk-K5LLP4CY.js";
91
- import {
92
- buildProcedurePersistBody,
93
- normalizeProcedureSteps
94
- } from "./chunk-QDW3E4RD.js";
95
95
  import {
96
96
  CrossNamespaceBudget
97
97
  } from "./chunk-ODPLEWB6.js";
98
+ import {
99
+ defaultCapsulesDir
100
+ } from "./chunk-ZY2MNJR6.js";
98
101
  import {
99
102
  filterTrajectoriesByLookbackDays,
100
103
  readCausalTrajectoryRecords
101
- } from "./chunk-SQNED75R.js";
104
+ } from "./chunk-KYC3RLYJ.js";
102
105
  import {
103
106
  FileCalendarSource,
104
107
  buildBriefing,
105
108
  enqueuePassiveCorrectionNotification,
106
109
  parseBriefingFocus,
107
110
  parseBriefingWindow
108
- } from "./chunk-R3K4CXPR.js";
111
+ } from "./chunk-3JOFWTQD.js";
109
112
  import {
110
113
  parseEntityFile,
111
114
  selfDeps
112
- } from "./chunk-DTTVX6EO.js";
115
+ } from "./chunk-STN5KMSS.js";
116
+ import {
117
+ stripAttributesSuffix
118
+ } from "./chunk-SVOZFLIQ.js";
113
119
  import {
114
120
  serializeMutations
115
121
  } from "./chunk-LTJAMRGI.js";
116
122
  import {
117
123
  supersessionKeysForFact
118
124
  } from "./chunk-TKZ3AL5V.js";
119
- import {
120
- stripAttributesSuffix
121
- } from "./chunk-SVOZFLIQ.js";
122
125
  import {
123
126
  DEFAULT_RECALL_DISCLOSURE,
124
127
  isRecallDisclosure
@@ -144,8 +147,11 @@ import {
144
147
  computeContentHash
145
148
  } from "./chunk-W5H6ZRPT.js";
146
149
  import {
147
- defaultCapsulesDir
148
- } from "./chunk-ZY2MNJR6.js";
150
+ exportCapsule
151
+ } from "./chunk-FLVL4L3L.js";
152
+ import {
153
+ evaluateActionConfidence
154
+ } from "./chunk-Z2YFLXHU.js";
149
155
  import {
150
156
  canReadNamespace,
151
157
  canWriteNamespace,
@@ -174,18 +180,9 @@ import {
174
180
  import {
175
181
  expandTildePath
176
182
  } from "./chunk-EYIEWJNI.js";
177
- import {
178
- isHandleToken
179
- } from "./chunk-JAKIDQB2.js";
180
183
  import {
181
184
  log
182
185
  } from "./chunk-NU3CSQ4H.js";
183
- import {
184
- exportCapsule
185
- } from "./chunk-FLVL4L3L.js";
186
- import {
187
- evaluateActionConfidence
188
- } from "./chunk-Z2YFLXHU.js";
189
186
  import {
190
187
  OFFLINE_SYNC_SNAPSHOT_FORMAT,
191
188
  applyOfflineSyncChangeset,
@@ -200,16 +197,19 @@ import {
200
197
  import {
201
198
  SecureStoreLockedError
202
199
  } from "./chunk-J2HSAU72.js";
200
+ import {
201
+ isHandleToken
202
+ } from "./chunk-JAKIDQB2.js";
203
+ import {
204
+ AccessIdempotencyStore,
205
+ hashAccessIdempotencyPayload
206
+ } from "./chunk-VFUEZZBS.js";
203
207
  import {
204
208
  throwIfAborted
205
209
  } from "./chunk-PVGDJXVK.js";
206
210
  import {
207
211
  AccessAuditAdapter
208
212
  } from "./chunk-TVVEYCNW.js";
209
- import {
210
- AccessIdempotencyStore,
211
- hashAccessIdempotencyPayload
212
- } from "./chunk-VFUEZZBS.js";
213
213
 
214
214
  // src/access-observe-write-surface.ts
215
215
  import { createHash as createHash6 } from "crypto";
@@ -10924,4 +10924,4 @@ export {
10924
10924
  EngramAccessService,
10925
10925
  AccessAdminOpsSurface
10926
10926
  };
10927
- //# sourceMappingURL=chunk-OAREUC7N.js.map
10927
+ //# sourceMappingURL=chunk-EWGMA5W5.js.map
@@ -1,9 +1,9 @@
1
- import {
2
- diffGraphSnapshots
3
- } from "./chunk-AUDJPF4N.js";
4
1
  import {
5
2
  graphSnapshotFromMemoryDir
6
3
  } from "./chunk-44442YCH.js";
4
+ import {
5
+ diffGraphSnapshots
6
+ } from "./chunk-AUDJPF4N.js";
7
7
 
8
8
  // src/dashboard-runtime.ts
9
9
  import { createHash, timingSafeEqual } from "crypto";
@@ -370,4 +370,4 @@ var GraphDashboardServer = class {
370
370
  export {
371
371
  GraphDashboardServer
372
372
  };
373
- //# sourceMappingURL=chunk-YNDLCWXS.js.map
373
+ //# sourceMappingURL=chunk-EZ25VE3G.js.map
@@ -0,0 +1,101 @@
1
+ // src/recall-timings.ts
2
+ var RECALL_TIMING_HISTORY_LIMIT = 50;
3
+ var TIMING_FIELD_ALLOWLIST = [
4
+ "total",
5
+ "sharedCtx",
6
+ "profile",
7
+ "peerProfile",
8
+ "identityContinuity",
9
+ "entityRetrieval",
10
+ "ki",
11
+ "artifacts",
12
+ "objectiveState",
13
+ "causalTrajectories",
14
+ "cmcCausalChains",
15
+ "calibrationRules",
16
+ "trustZones",
17
+ "harmonicRetrieval",
18
+ "verifiedRecall",
19
+ "verifiedRules",
20
+ "workProducts",
21
+ "qmd",
22
+ "transcript",
23
+ "summaries",
24
+ "nativeKnowledge",
25
+ "convRecall",
26
+ "compounding",
27
+ "graphShadow",
28
+ "qmdPost"
29
+ ];
30
+ var PROCESS_STARTED_AT = new Date(Date.now() - process.uptime() * 1e3).toISOString();
31
+ var histories = /* @__PURE__ */ new WeakMap();
32
+ function numericMilliseconds(value) {
33
+ if (typeof value === "number" && Number.isFinite(value) && value >= 0) {
34
+ return value;
35
+ }
36
+ if (typeof value !== "string") return void 0;
37
+ const match = /^(\d+)ms/.exec(value);
38
+ return match ? Number(match[1]) : void 0;
39
+ }
40
+ function sanitizeRecallTiming(input) {
41
+ const timingsMs = {
42
+ total: numericMilliseconds(input.total) ?? 0
43
+ };
44
+ for (const field of TIMING_FIELD_ALLOWLIST) {
45
+ if (field === "total") continue;
46
+ const value = numericMilliseconds(input[field]);
47
+ if (value !== void 0) timingsMs[field] = value;
48
+ }
49
+ return {
50
+ timestamp: typeof input.timestamp === "string" ? input.timestamp : "",
51
+ namespace: typeof input.namespace === "string" ? input.namespace : "",
52
+ recallPlan: typeof input.recallPlan === "string" ? input.recallPlan : "",
53
+ queryPolicy: typeof input.queryPolicy === "string" ? input.queryPolicy : "",
54
+ timingsMs
55
+ };
56
+ }
57
+ function recordRecallTiming(config, input) {
58
+ const history = histories.get(config) ?? [];
59
+ history.push(sanitizeRecallTiming(input));
60
+ if (history.length > RECALL_TIMING_HISTORY_LIMIT) history.shift();
61
+ histories.set(config, history);
62
+ }
63
+ function resolveRecallTimingsOperatorPrincipal(config, transportPrincipal) {
64
+ return config.agentAccessHttp.principal?.trim() || transportPrincipal?.trim() || void 0;
65
+ }
66
+ function isRecallTimingsOperator(config, authenticatedPrincipal, transportPrincipal) {
67
+ const operatorPrincipal = resolveRecallTimingsOperatorPrincipal(
68
+ config,
69
+ transportPrincipal
70
+ );
71
+ return Boolean(
72
+ operatorPrincipal && authenticatedPrincipal && authenticatedPrincipal === operatorPrincipal
73
+ );
74
+ }
75
+ function getRecallTimings(config) {
76
+ const history = histories.get(config) ?? [];
77
+ return history.slice().reverse().map((record) => ({
78
+ ...record,
79
+ timingsMs: { ...record.timingsMs }
80
+ }));
81
+ }
82
+ function getRecallTimingStatus(config) {
83
+ const records = getRecallTimings(config);
84
+ return {
85
+ generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
86
+ processStartedAt: PROCESS_STARTED_AT,
87
+ capacity: RECALL_TIMING_HISTORY_LIMIT,
88
+ count: records.length,
89
+ order: "newest-first",
90
+ records
91
+ };
92
+ }
93
+
94
+ export {
95
+ recordRecallTiming,
96
+ resolveRecallTimingsOperatorPrincipal,
97
+ isRecallTimingsOperator,
98
+ getRecallTimings,
99
+ getRecallTimingStatus
100
+ };
101
+ //# sourceMappingURL=chunk-FTYDWKO6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/recall-timings.ts"],"sourcesContent":["import type { PluginConfig } from \"./types.js\";\n\nexport interface RecallTimingRecord {\n readonly timestamp: string;\n readonly namespace: string;\n readonly recallPlan: string;\n readonly queryPolicy: string;\n readonly timingsMs: Readonly<Record<string, number>>;\n}\n\nexport interface RecallTimingStatus {\n readonly generatedAt: string;\n readonly processStartedAt: string;\n readonly capacity: number;\n readonly count: number;\n readonly order: \"newest-first\";\n readonly records: RecallTimingRecord[];\n}\n\nconst RECALL_TIMING_HISTORY_LIMIT = 50;\nconst TIMING_FIELD_ALLOWLIST = [\n \"total\",\n \"sharedCtx\",\n \"profile\",\n \"peerProfile\",\n \"identityContinuity\",\n \"entityRetrieval\",\n \"ki\",\n \"artifacts\",\n \"objectiveState\",\n \"causalTrajectories\",\n \"cmcCausalChains\",\n \"calibrationRules\",\n \"trustZones\",\n \"harmonicRetrieval\",\n \"verifiedRecall\",\n \"verifiedRules\",\n \"workProducts\",\n \"qmd\",\n \"transcript\",\n \"summaries\",\n \"nativeKnowledge\",\n \"convRecall\",\n \"compounding\",\n \"graphShadow\",\n \"qmdPost\",\n] as const;\n// The ring buffer is process-local: a daemon restart or haproxy failover to\n// the other backend starts an empty history. processStartedAt lets consumers\n// detect that discontinuity. Derived from the process time origin, not module\n// initialization, so lazy imports cannot skew it.\nconst PROCESS_STARTED_AT = new Date(Date.now() - process.uptime() * 1000).toISOString();\nconst histories = new WeakMap<PluginConfig, RecallTimingRecord[]>();\n\nfunction numericMilliseconds(value: unknown): number | undefined {\n if (typeof value === \"number\" && Number.isFinite(value) && value >= 0) {\n return value;\n }\n if (typeof value !== \"string\") return undefined;\n const match = /^(\\d+)ms/.exec(value);\n return match ? Number(match[1]) : undefined;\n}\n\nfunction sanitizeRecallTiming(\n input: Record<string, unknown>,\n): RecallTimingRecord {\n // Serialization boundary: ONLY allowlisted numeric phases reach timingsMs,\n // and the four dimension strings are copied field-by-field. Never spread\n // the internal record into the public shape.\n const timingsMs: Record<string, number> = {\n total: numericMilliseconds(input.total) ?? 0,\n };\n for (const field of TIMING_FIELD_ALLOWLIST) {\n if (field === \"total\") continue;\n const value = numericMilliseconds(input[field]);\n // Phases that did not run are omitted; 0 means \"ran, measured zero\".\n if (value !== undefined) timingsMs[field] = value;\n }\n return {\n timestamp: typeof input.timestamp === \"string\" ? input.timestamp : \"\",\n namespace: typeof input.namespace === \"string\" ? input.namespace : \"\",\n recallPlan: typeof input.recallPlan === \"string\" ? input.recallPlan : \"\",\n queryPolicy: typeof input.queryPolicy === \"string\" ? input.queryPolicy : \"\",\n timingsMs,\n };\n}\n\nexport function recordRecallTiming(\n config: PluginConfig,\n input: Record<string, unknown>,\n): void {\n const history = histories.get(config) ?? [];\n history.push(sanitizeRecallTiming(input));\n if (history.length > RECALL_TIMING_HISTORY_LIMIT) history.shift();\n histories.set(config, history);\n}\n\nexport function resolveRecallTimingsOperatorPrincipal(\n config: PluginConfig,\n transportPrincipal?: string,\n): string | undefined {\n return config.agentAccessHttp.principal?.trim()\n || transportPrincipal?.trim()\n || undefined;\n}\n\nexport function isRecallTimingsOperator(\n config: PluginConfig,\n authenticatedPrincipal?: string,\n transportPrincipal?: string,\n): boolean {\n const operatorPrincipal = resolveRecallTimingsOperatorPrincipal(\n config,\n transportPrincipal,\n );\n return Boolean(\n operatorPrincipal\n && authenticatedPrincipal\n && authenticatedPrincipal === operatorPrincipal,\n );\n}\n\nexport function getRecallTimings(config: PluginConfig): RecallTimingRecord[] {\n const history = histories.get(config) ?? [];\n return history.slice().reverse().map((record) => ({\n ...record,\n timingsMs: { ...record.timingsMs },\n }));\n}\n\nexport function getRecallTimingStatus(config: PluginConfig): RecallTimingStatus {\n const records = getRecallTimings(config);\n return {\n generatedAt: new Date().toISOString(),\n processStartedAt: PROCESS_STARTED_AT,\n capacity: RECALL_TIMING_HISTORY_LIMIT,\n count: records.length,\n order: \"newest-first\",\n records,\n };\n}\n"],"mappings":";AAmBA,IAAM,8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,IAAI,MAAM,KAAK,CAAC;AAC1C,UAAQ,KAAK,qBAAqB,KAAK,CAAC;AACxC,MAAI,QAAQ,SAAS,4BAA6B,SAAQ,MAAM;AAChE,YAAU,IAAI,QAAQ,OAAO;AAC/B;AAEO,SAAS,sCACd,QACA,oBACoB;AACpB,SAAO,OAAO,gBAAgB,WAAW,KAAK,KACzC,oBAAoB,KAAK,KACzB;AACP;AAEO,SAAS,wBACd,QACA,wBACA,oBACS;AACT,QAAM,oBAAoB;AAAA,IACxB;AAAA,IACA;AAAA,EACF;AACA,SAAO;AAAA,IACL,qBACG,0BACA,2BAA2B;AAAA,EAChC;AACF;AAEO,SAAS,iBAAiB,QAA4C;AAC3E,QAAM,UAAU,UAAU,IAAI,MAAM,KAAK,CAAC;AAC1C,SAAO,QAAQ,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,YAAY;AAAA,IAChD,GAAG;AAAA,IACH,WAAW,EAAE,GAAG,OAAO,UAAU;AAAA,EACnC,EAAE;AACJ;AAEO,SAAS,sBAAsB,QAA0C;AAC9E,QAAM,UAAU,iBAAiB,MAAM;AACvC,SAAO;AAAA,IACL,cAAa,oBAAI,KAAK,GAAE,YAAY;AAAA,IACpC,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,OAAO,QAAQ;AAAA,IACf,OAAO;AAAA,IACP;AAAA,EACF;AACF;","names":[]}
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-3UXOZBHV.js";
8
8
  import {
9
9
  StorageManager
10
- } from "./chunk-DTTVX6EO.js";
10
+ } from "./chunk-STN5KMSS.js";
11
11
  import {
12
12
  isSafeRouteNamespace
13
13
  } from "./chunk-U3PN77QT.js";
@@ -118,4 +118,4 @@ export {
118
118
  runCodexMaterialize,
119
119
  runPostConsolidationMaterialize
120
120
  };
121
- //# sourceMappingURL=chunk-2RLECZ6J.js.map
121
+ //# sourceMappingURL=chunk-IOENSSZC.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-DTTVX6EO.js";
3
+ } from "./chunk-STN5KMSS.js";
4
4
  import {
5
5
  getCachedRuleMemories,
6
6
  setCachedRuleMemories
@@ -117,4 +117,4 @@ export {
117
117
  compareVerifiedSemanticRuleResults,
118
118
  searchVerifiedSemanticRules
119
119
  };
120
- //# sourceMappingURL=chunk-VKHZFF5P.js.map
120
+ //# sourceMappingURL=chunk-KFIAFHOC.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-SFQ6QNL7.js";
7
7
  import {
8
8
  StorageManager
9
- } from "./chunk-DTTVX6EO.js";
9
+ } from "./chunk-STN5KMSS.js";
10
10
  import {
11
11
  buildLifecycleEventsForMemory,
12
12
  sortMemoryLifecycleEvents
@@ -115,4 +115,4 @@ export {
115
115
  backupExistingLedger,
116
116
  rebuildMemoryLifecycleLedger
117
117
  };
118
- //# sourceMappingURL=chunk-NDXJJKT2.js.map
118
+ //# sourceMappingURL=chunk-KMKBD66B.js.map
@@ -216,4 +216,4 @@ export {
216
216
  getCausalTrajectoryStoreStatus,
217
217
  searchCausalTrajectories
218
218
  };
219
- //# sourceMappingURL=chunk-SQNED75R.js.map
219
+ //# sourceMappingURL=chunk-KYC3RLYJ.js.map