@remnic/core 9.3.736 → 9.3.738

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 (268) hide show
  1. package/dist/access-boundary.d.ts +17 -6
  2. package/dist/access-boundary.js +10 -10
  3. package/dist/access-cli.js +26 -26
  4. package/dist/access-http.d.ts +17 -6
  5. package/dist/access-http.js +15 -15
  6. package/dist/access-mcp.d.ts +17 -6
  7. package/dist/access-mcp.js +14 -14
  8. package/dist/access-operations-batch.js +12 -12
  9. package/dist/access-operations.d.ts +17 -6
  10. package/dist/access-operations.js +13 -13
  11. package/dist/{access-service-CdC0q4pr.d.ts → access-service-DwQ6BIQw.d.ts} +3 -3
  12. package/dist/access-service.d.ts +16 -5
  13. package/dist/access-service.js +9 -9
  14. package/dist/access-surface-catalog.d.ts +17 -6
  15. package/dist/action-confidence.d.ts +1 -1
  16. package/dist/active-memory-bridge.d.ts +1 -1
  17. package/dist/active-memory-bridge.js +3 -3
  18. package/dist/active-recall.d.ts +1 -1
  19. package/dist/behavior-learner.d.ts +1 -1
  20. package/dist/behavior-signals.d.ts +1 -1
  21. package/dist/bootstrap.d.ts +16 -4
  22. package/dist/briefing.d.ts +1 -1
  23. package/dist/buffer-surprise-report.d.ts +1 -1
  24. package/dist/buffer.d.ts +1 -1
  25. package/dist/buffer.js +2 -1
  26. package/dist/calibration.d.ts +1 -1
  27. package/dist/capabilities.d.ts +99 -2
  28. package/dist/capabilities.js +7 -1
  29. package/dist/{catalog-D2NLDg4S.d.ts → catalog-_Bap6vfD.d.ts} +1 -1
  30. package/dist/causal-behavior.d.ts +1 -1
  31. package/dist/causal-consolidation.d.ts +1 -1
  32. package/dist/causal-trajectory-graph.d.ts +1 -1
  33. package/dist/{chunk-G54IDCD3.js → chunk-23PLOBWT.js} +30 -27
  34. package/dist/chunk-23PLOBWT.js.map +1 -0
  35. package/dist/{chunk-K3Y2SJTN.js → chunk-56LP72AD.js} +6 -6
  36. package/dist/{chunk-ZBZ4XULO.js → chunk-66RZ4EIT.js} +3 -3
  37. package/dist/{chunk-IPI45Q4S.js → chunk-75PDC7VT.js} +9 -8
  38. package/dist/chunk-75PDC7VT.js.map +1 -0
  39. package/dist/{chunk-GB2FZOWB.js → chunk-7B7IPPN5.js} +5 -5
  40. package/dist/{chunk-QNTLWH3T.js → chunk-A7INTIC5.js} +3 -3
  41. package/dist/{chunk-FLPKEMSO.js → chunk-AKKFHN3I.js} +2 -2
  42. package/dist/{chunk-AAIHDIMD.js → chunk-BHJAMSVC.js} +7 -7
  43. package/dist/{chunk-BXPG5AVX.js → chunk-BHQQVUEQ.js} +6 -6
  44. package/dist/{chunk-HFXZIF3V.js → chunk-BVG2IZOB.js} +3 -3
  45. package/dist/{chunk-NDKW67ER.js → chunk-C53JDEH3.js} +4 -4
  46. package/dist/{chunk-AESC5OQJ.js → chunk-CKHPUOAP.js} +2 -2
  47. package/dist/{chunk-OYHYBHHI.js → chunk-DS3FZ7GS.js} +4 -4
  48. package/dist/{chunk-AE2HPUP7.js → chunk-EKQ3LWBM.js} +428 -370
  49. package/dist/chunk-EKQ3LWBM.js.map +1 -0
  50. package/dist/{chunk-UO6MPN77.js → chunk-EU543UDC.js} +10 -9
  51. package/dist/chunk-EU543UDC.js.map +1 -0
  52. package/dist/{chunk-E4LYJ7PY.js → chunk-IFCM6OLK.js} +6 -6
  53. package/dist/{chunk-5BOQNB2K.js → chunk-JQSP7YBJ.js} +3 -3
  54. package/dist/{chunk-2T2N7ISV.js → chunk-L3TYGUTH.js} +3 -3
  55. package/dist/{chunk-AB2E5DCN.js → chunk-MAU7DFCJ.js} +2 -2
  56. package/dist/{chunk-P6VLG7KE.js → chunk-N2O23WYA.js} +2 -2
  57. package/dist/{chunk-HYNHLBKA.js → chunk-OQQRWPFZ.js} +5 -2
  58. package/dist/chunk-OQQRWPFZ.js.map +1 -0
  59. package/dist/{chunk-IXGXALRV.js → chunk-QTJOORGN.js} +2 -2
  60. package/dist/{chunk-JWDE7OVJ.js → chunk-RJBW4EOU.js} +46 -2
  61. package/dist/{chunk-JWDE7OVJ.js.map → chunk-RJBW4EOU.js.map} +1 -1
  62. package/dist/{chunk-AE7NTZ75.js → chunk-TNLXCSXV.js} +3 -3
  63. package/dist/{chunk-NNJKEAP2.js → chunk-VRBBZH4U.js} +4 -4
  64. package/dist/{chunk-VOEVVIP3.js → chunk-W2FBVBQ4.js} +4 -4
  65. package/dist/{chunk-WNGXQMRI.js → chunk-WFNH4UDF.js} +5 -2
  66. package/dist/chunk-WFNH4UDF.js.map +1 -0
  67. package/dist/{chunk-CHJIWG2H.js → chunk-WVAEIKUY.js} +2 -2
  68. package/dist/{chunk-FF36YNKY.js → chunk-XIQAOGAA.js} +11 -10
  69. package/dist/chunk-XIQAOGAA.js.map +1 -0
  70. package/dist/{chunk-HLPYL6LC.js → chunk-Y5OOHER4.js} +14 -12
  71. package/dist/chunk-Y5OOHER4.js.map +1 -0
  72. package/dist/{chunk-GYICIICQ.js → chunk-YF2MMBKA.js} +9 -7
  73. package/dist/chunk-YF2MMBKA.js.map +1 -0
  74. package/dist/{chunk-IX4L7E5G.js → chunk-YXOXAQ5Y.js} +2 -2
  75. package/dist/{cli-BHy6Bo6u.d.ts → cli-BlEIWDQw.d.ts} +3 -3
  76. package/dist/cli.d.ts +9 -7
  77. package/dist/cli.js +21 -21
  78. package/dist/compounding/engine.d.ts +1 -1
  79. package/dist/compounding/engine.js +2 -2
  80. package/dist/compounding/preference-consolidator.d.ts +1 -1
  81. package/dist/compression-optimizer.d.ts +1 -1
  82. package/dist/config.d.ts +1 -1
  83. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  84. package/dist/connectors/codex-materialize.d.ts +1 -1
  85. package/dist/connectors/index.d.ts +1 -1
  86. package/dist/consolidation-provenance-check.d.ts +1 -1
  87. package/dist/consolidation-undo.d.ts +1 -1
  88. package/dist/contradiction/index.d.ts +1 -1
  89. package/dist/contradiction/index.js +2 -2
  90. package/dist/{contradiction-scan-2B4AE4TI.js → contradiction-scan-CWO3LIWV.js} +3 -3
  91. package/dist/conversation-index/backend.d.ts +1 -1
  92. package/dist/conversation-index/chunker.d.ts +1 -1
  93. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  94. package/dist/conversation-index/indexer.d.ts +1 -1
  95. package/dist/conversation-index/search.d.ts +1 -1
  96. package/dist/day-summary.d.ts +1 -1
  97. package/dist/delinearize.d.ts +1 -1
  98. package/dist/direct-answer-wiring.d.ts +1 -1
  99. package/dist/direct-answer.d.ts +1 -1
  100. package/dist/embedding-fallback.d.ts +1 -1
  101. package/dist/embedding-fallback.js +2 -2
  102. package/dist/enrichment/index.d.ts +1 -1
  103. package/dist/entity-retrieval.d.ts +1 -1
  104. package/dist/entity-retrieval.js +2 -2
  105. package/dist/entity-schema.d.ts +1 -1
  106. package/dist/explicit-capture.d.ts +16 -4
  107. package/dist/explicit-capture.js +2 -2
  108. package/dist/extraction-faithfulness.d.ts +1 -1
  109. package/dist/extraction-judge-telemetry.d.ts +1 -1
  110. package/dist/extraction-judge-training.d.ts +1 -1
  111. package/dist/extraction-judge.d.ts +1 -1
  112. package/dist/extraction.d.ts +1 -1
  113. package/dist/extraction.js +3 -3
  114. package/dist/fallback-llm.d.ts +1 -1
  115. package/dist/{first-start-migration-2RQYDIZ7.js → first-start-migration-5DXD3TF2.js} +2 -2
  116. package/dist/graph-dashboard-diff.d.ts +1 -1
  117. package/dist/graph-dashboard-key.d.ts +1 -1
  118. package/dist/graph-dashboard-parser.d.ts +1 -1
  119. package/dist/graph-edge-reinforcement.d.ts +1 -1
  120. package/dist/graph-snapshot.d.ts +1 -1
  121. package/dist/graph.d.ts +1 -1
  122. package/dist/identity-continuity.d.ts +1 -1
  123. package/dist/importance.d.ts +1 -1
  124. package/dist/index.d.ts +20 -18
  125. package/dist/index.js +32 -32
  126. package/dist/intent.d.ts +1 -1
  127. package/dist/lcm/engine.d.ts +1 -1
  128. package/dist/lcm/index.d.ts +1 -1
  129. package/dist/lcm/tools.d.ts +1 -1
  130. package/dist/lifecycle.d.ts +1 -1
  131. package/dist/live-connectors-runner.d.ts +1 -1
  132. package/dist/local-llm.d.ts +1 -1
  133. package/dist/local-llm.js +2 -2
  134. package/dist/local-model-endpoint.d.ts +1 -1
  135. package/dist/maintenance/memory-governance.d.ts +1 -1
  136. package/dist/mcp-memory-inspector-app.d.ts +17 -6
  137. package/dist/memory-action-policy.d.ts +1 -1
  138. package/dist/memory-cache.d.ts +1 -1
  139. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  140. package/dist/memory-projection-store.d.ts +1 -1
  141. package/dist/memory-provenance.d.ts +1 -1
  142. package/dist/memory-worth-outcomes.d.ts +1 -1
  143. package/dist/models-json.d.ts +1 -1
  144. package/dist/namespaces/migrate.d.ts +2 -2
  145. package/dist/namespaces/migrate.js +6 -6
  146. package/dist/namespaces/principal.d.ts +1 -1
  147. package/dist/namespaces/principal.js +2 -2
  148. package/dist/namespaces/search.d.ts +1 -1
  149. package/dist/namespaces/search.js +4 -4
  150. package/dist/namespaces/storage.d.ts +2 -2
  151. package/dist/namespaces/storage.js +2 -2
  152. package/dist/native-knowledge.d.ts +1 -1
  153. package/dist/operator-toolkit.d.ts +1 -1
  154. package/dist/operator-toolkit.js +11 -11
  155. package/dist/orchestration/compression-guideline-coordinator.d.ts +1 -1
  156. package/dist/orchestration/compression-guideline-coordinator.js +2 -2
  157. package/dist/orchestration/maintenance.d.ts +2 -2
  158. package/dist/orchestration/maintenance.js +6 -6
  159. package/dist/{orchestrator-C-xp_rtZ.d.ts → orchestrator-CJZ21ZiB.d.ts} +78 -12
  160. package/dist/orchestrator.d.ts +16 -4
  161. package/dist/orchestrator.js +21 -21
  162. package/dist/patterns-cli.d.ts +1 -1
  163. package/dist/policy-runtime.d.ts +1 -1
  164. package/dist/provenance.d.ts +1 -1
  165. package/dist/qmd-recall-cache.d.ts +1 -1
  166. package/dist/qmd.d.ts +1 -1
  167. package/dist/recall-disclosure-escalation.d.ts +1 -1
  168. package/dist/recall-explain-renderer.d.ts +1 -1
  169. package/dist/recall-planner-llm.d.ts +1 -1
  170. package/dist/recall-state.d.ts +1 -1
  171. package/dist/recall-tag-filter.d.ts +1 -1
  172. package/dist/recall-xray-cli.d.ts +1 -1
  173. package/dist/recall-xray-renderer.d.ts +1 -1
  174. package/dist/recall-xray.d.ts +1 -1
  175. package/dist/resolve-auth-token.d.ts +1 -1
  176. package/dist/retrieval-agents.d.ts +1 -1
  177. package/dist/retrieval-tiers.d.ts +1 -1
  178. package/dist/routing/engine.d.ts +1 -1
  179. package/dist/routing/store.d.ts +1 -1
  180. package/dist/schemas.d.ts +22 -22
  181. package/dist/search/embed-helper.d.ts +1 -1
  182. package/dist/search/embed-helper.js +2 -2
  183. package/dist/search/factory.d.ts +1 -1
  184. package/dist/search/factory.js +3 -3
  185. package/dist/search/index.d.ts +1 -1
  186. package/dist/search/index.js +3 -3
  187. package/dist/search/lancedb-backend.d.ts +1 -1
  188. package/dist/search/meilisearch-backend.d.ts +1 -1
  189. package/dist/search/noop-backend.d.ts +1 -1
  190. package/dist/search/orama-backend.d.ts +1 -1
  191. package/dist/search/port.d.ts +1 -1
  192. package/dist/search/remote-backend.d.ts +1 -1
  193. package/dist/{semantic-consolidation-COdwU-me.d.ts → semantic-consolidation-DsIEiCka.d.ts} +1 -1
  194. package/dist/semantic-consolidation.d.ts +2 -2
  195. package/dist/semantic-rule-verifier.d.ts +1 -1
  196. package/dist/session-observer-bands.d.ts +1 -1
  197. package/dist/session-observer-state.d.ts +1 -1
  198. package/dist/shared-context/manager.d.ts +1 -1
  199. package/dist/signal.d.ts +1 -1
  200. package/dist/storage.d.ts +1 -1
  201. package/dist/summarizer.d.ts +1 -1
  202. package/dist/summarizer.js +3 -3
  203. package/dist/summary-snapshot.d.ts +1 -1
  204. package/dist/temporal-supersession.d.ts +1 -1
  205. package/dist/temporal-validity.d.ts +1 -1
  206. package/dist/threading.d.ts +1 -1
  207. package/dist/tier-migration.d.ts +1 -1
  208. package/dist/tier-routing.d.ts +1 -1
  209. package/dist/{tier-stats-KPDIISG7.js → tier-stats-QID73BBB.js} +2 -2
  210. package/dist/topics.d.ts +1 -1
  211. package/dist/transcript.d.ts +1 -1
  212. package/dist/transfer/types.d.ts +12 -12
  213. package/dist/trust-score-stage.d.ts +2 -2
  214. package/dist/trust-score.d.ts +1 -1
  215. package/dist/{types-w3Y232yi.d.ts → types-CglNn2V-.d.ts} +1 -1
  216. package/dist/types.d.ts +1 -1
  217. package/dist/utility-runtime.d.ts +1 -1
  218. package/package.json +2 -2
  219. package/src/access-service.ts +7 -8
  220. package/src/buffer.ts +2 -1
  221. package/src/capabilities.test.ts +137 -0
  222. package/src/capabilities.ts +209 -0
  223. package/src/cli/creation-ledger-commands.ts +3 -3
  224. package/src/cli/research-status-commands.ts +4 -4
  225. package/src/cli.ts +9 -10
  226. package/src/compounding/engine.ts +7 -7
  227. package/src/correction/correction-access-wiring.ts +3 -2
  228. package/src/extraction.ts +8 -10
  229. package/src/operator-toolkit.ts +6 -7
  230. package/src/orchestration/entity-synthesis-coordinator.ts +2 -1
  231. package/src/orchestration/maintenance.ts +5 -7
  232. package/src/orchestration/recall-result-formatter.ts +438 -0
  233. package/src/orchestration/semantic-consolidation-coordinator.ts +2 -2
  234. package/src/orchestrator.ts +71 -355
  235. package/dist/chunk-AE2HPUP7.js.map +0 -1
  236. package/dist/chunk-FF36YNKY.js.map +0 -1
  237. package/dist/chunk-G54IDCD3.js.map +0 -1
  238. package/dist/chunk-GYICIICQ.js.map +0 -1
  239. package/dist/chunk-HLPYL6LC.js.map +0 -1
  240. package/dist/chunk-HYNHLBKA.js.map +0 -1
  241. package/dist/chunk-IPI45Q4S.js.map +0 -1
  242. package/dist/chunk-UO6MPN77.js.map +0 -1
  243. package/dist/chunk-WNGXQMRI.js.map +0 -1
  244. /package/dist/{chunk-K3Y2SJTN.js.map → chunk-56LP72AD.js.map} +0 -0
  245. /package/dist/{chunk-ZBZ4XULO.js.map → chunk-66RZ4EIT.js.map} +0 -0
  246. /package/dist/{chunk-GB2FZOWB.js.map → chunk-7B7IPPN5.js.map} +0 -0
  247. /package/dist/{chunk-QNTLWH3T.js.map → chunk-A7INTIC5.js.map} +0 -0
  248. /package/dist/{chunk-FLPKEMSO.js.map → chunk-AKKFHN3I.js.map} +0 -0
  249. /package/dist/{chunk-AAIHDIMD.js.map → chunk-BHJAMSVC.js.map} +0 -0
  250. /package/dist/{chunk-BXPG5AVX.js.map → chunk-BHQQVUEQ.js.map} +0 -0
  251. /package/dist/{chunk-HFXZIF3V.js.map → chunk-BVG2IZOB.js.map} +0 -0
  252. /package/dist/{chunk-NDKW67ER.js.map → chunk-C53JDEH3.js.map} +0 -0
  253. /package/dist/{chunk-AESC5OQJ.js.map → chunk-CKHPUOAP.js.map} +0 -0
  254. /package/dist/{chunk-OYHYBHHI.js.map → chunk-DS3FZ7GS.js.map} +0 -0
  255. /package/dist/{chunk-E4LYJ7PY.js.map → chunk-IFCM6OLK.js.map} +0 -0
  256. /package/dist/{chunk-5BOQNB2K.js.map → chunk-JQSP7YBJ.js.map} +0 -0
  257. /package/dist/{chunk-2T2N7ISV.js.map → chunk-L3TYGUTH.js.map} +0 -0
  258. /package/dist/{chunk-AB2E5DCN.js.map → chunk-MAU7DFCJ.js.map} +0 -0
  259. /package/dist/{chunk-P6VLG7KE.js.map → chunk-N2O23WYA.js.map} +0 -0
  260. /package/dist/{chunk-IXGXALRV.js.map → chunk-QTJOORGN.js.map} +0 -0
  261. /package/dist/{chunk-AE7NTZ75.js.map → chunk-TNLXCSXV.js.map} +0 -0
  262. /package/dist/{chunk-NNJKEAP2.js.map → chunk-VRBBZH4U.js.map} +0 -0
  263. /package/dist/{chunk-VOEVVIP3.js.map → chunk-W2FBVBQ4.js.map} +0 -0
  264. /package/dist/{chunk-CHJIWG2H.js.map → chunk-WVAEIKUY.js.map} +0 -0
  265. /package/dist/{chunk-IX4L7E5G.js.map → chunk-YXOXAQ5Y.js.map} +0 -0
  266. /package/dist/{contradiction-scan-2B4AE4TI.js.map → contradiction-scan-CWO3LIWV.js.map} +0 -0
  267. /package/dist/{first-start-migration-2RQYDIZ7.js.map → first-start-migration-5DXD3TF2.js.map} +0 -0
  268. /package/dist/{tier-stats-KPDIISG7.js.map → tier-stats-QID73BBB.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/buffer.ts"],"sourcesContent":["import { log } from \"./logger.js\";\nimport { scanSignals } from \"./signal.js\";\nimport type { StorageManager } from \"./storage.js\";\nimport type {\n BufferEntryState,\n BufferState,\n BufferSurpriseEvent,\n BufferTurn,\n PluginConfig,\n SignalLevel,\n} from \"./types.js\";\nimport { resolvePresentationCapabilities } from \"./capabilities.js\";\n\nexport type TriggerDecision = \"extract_now\" | \"extract_batch\" | \"keep_buffering\";\n\nexport interface AddTurnOutcome {\n decision: TriggerDecision;\n extractionTurns?: BufferTurn[];\n}\n\n/**\n * Optional surprise probe injected into `SmartBuffer`.\n *\n * Computes a D-MEM-style novelty score in `[0, 1]` for an incoming turn.\n * The buffer treats the probe as purely additive: if it is not provided, if\n * the feature flag is off, or if the probe throws/times out, the buffer\n * falls back to the existing signal/turn-count/time triggers unchanged.\n *\n * Callers are responsible for sampling recent memories and passing them\n * through the embedding pipeline — the buffer does not want to know about\n * storage, embeddings, or QMD.\n *\n * @param bufferKey Identifier for the active buffer (session/thread).\n * @param turn The incoming turn whose novelty is being scored.\n * @param recentTurns Turns already buffered for this key (most recent first\n * is NOT guaranteed — treat as unordered corpus).\n * @returns A surprise score in `[0, 1]`, or `null` if no score could be\n * produced (e.g. empty corpus, probe declined to embed).\n */\nexport interface BufferSurpriseProbe {\n scoreTurn(\n bufferKey: string,\n turn: BufferTurn,\n recentTurns: readonly BufferTurn[],\n ): Promise<number | null>;\n}\n\nconst MAX_BUFFER_ENTRY_COUNT = 200;\n\n/**\n * Minimal data carried on the serialized telemetry write chain\n * (issue #563 PR 3).\n *\n * We intentionally do NOT capture the full `BufferTurn` here: under\n * slow filesystem latency the chain can back up, and retaining\n * `turn.content` for every pending append causes memory pressure on\n * large conversations. Only the fields the ledger row actually needs\n * cross the chain boundary.\n */\ninterface SurpriseTelemetryQueueEntry {\n bufferKey: string;\n turnRole: \"user\" | \"assistant\";\n sessionKey: string | null;\n surpriseScore: number;\n triggered: boolean;\n turnCountInWindow: number;\n /**\n * ISO timestamp captured at the moment the turn was scored, NOT when\n * the ledger append eventually runs. Backpressure on the serialized\n * write chain could otherwise shift event timestamps away from the\n * real decision moment and distort the distribution report (p90\n * inflated, current-threshold row misidentified).\n */\n timestamp: string;\n /**\n * Threshold value in force when `triggered` was computed. Must be\n * snapshot here rather than read from `config` at emit time — a\n * concurrent config change between queue and write would otherwise\n * record `triggered=true` against a newer threshold the operator\n * never set, distorting precision/recall interpretation.\n */\n threshold: number;\n}\n\ninterface AddTurnMutationResult {\n decision: TriggerDecision;\n signalLevel: SignalLevel;\n priorTurns: BufferTurn[];\n activeTurnsSnapshot: BufferTurn[];\n retainedTurnsSnapshot: BufferTurn[];\n turnCountInWindow: number;\n}\n\nexport class SmartBuffer {\n private state: BufferState;\n private loaded = false;\n private loadPromise: Promise<void> | null = null;\n private readonly surpriseProbe: BufferSurpriseProbe | null;\n private mutationChain: Promise<unknown> = Promise.resolve();\n /**\n * Serialized write chain for `BUFFER_SURPRISE` telemetry events.\n *\n * The telemetry path is fire-and-forget (`addTurn` does not await the\n * ledger append), but multiple concurrent appends would still settle\n * out of order under variable filesystem latency. The report path\n * assumes chronological ordering — it slices the tail of the ledger\n * and treats the most recent entry as the current threshold in force.\n * Chaining ensures each append only runs after the previous settles,\n * preserving wall-clock order.\n *\n * We include a `.catch` on every link so a rejected append does not\n * poison the chain (CLAUDE.md rule #40).\n */\n private surpriseTelemetryWriteChain: Promise<unknown> = Promise.resolve();\n\n constructor(\n private readonly config: PluginConfig,\n private readonly storage: StorageManager,\n surpriseProbe: BufferSurpriseProbe | null = null,\n ) {\n this.state = { turns: [], lastExtractionAt: null, extractionCount: 0 };\n this.surpriseProbe = surpriseProbe;\n }\n\n private enqueueMutation<T>(op: () => Promise<T>): Promise<T> {\n const run = this.mutationChain.catch(() => {}).then(op);\n this.mutationChain = run.catch(() => {});\n return run;\n }\n\n private entryFor(key: string): BufferEntryState {\n if (!this.state.entries) {\n this.state.entries = Object.create(null) as NonNullable<BufferState[\"entries\"]>;\n }\n const entries = this.state.entries as NonNullable<BufferState[\"entries\"]>;\n if (Object.hasOwn(entries, key)) {\n const stored = entries[key];\n // Guard against corrupted state/buffer.json — if the stored entry\n // is not a valid object shape, discard it and recreate.\n if (stored && typeof stored === \"object\" && Array.isArray(stored.turns)) {\n return stored;\n }\n // Corrupted — fall through to recreate.\n }\n const created: BufferEntryState = {\n turns: [],\n lastExtractionAt: null,\n extractionCount: 0,\n };\n entries[key] = created;\n return created;\n }\n\n private peekEntry(key: string): BufferEntryState | null {\n const existing = this.state.entries?.[key];\n if (existing) return existing;\n if (key !== \"default\") return null;\n return {\n turns: Array.isArray(this.state.turns) ? this.state.turns : [],\n lastExtractionAt: this.state.lastExtractionAt ?? null,\n extractionCount:\n typeof this.state.extractionCount === \"number\" ? this.state.extractionCount : 0,\n };\n }\n\n private normalizeState(state: BufferState): BufferState {\n const entries = Object.assign(\n Object.create(null),\n state.entries ?? {},\n ) as NonNullable<BufferState[\"entries\"]>;\n if (!entries.default) {\n entries.default = {\n turns: Array.isArray(state.turns) ? [...state.turns] : [],\n lastExtractionAt: state.lastExtractionAt ?? null,\n extractionCount:\n typeof state.extractionCount === \"number\" ? state.extractionCount : 0,\n };\n }\n return {\n turns: entries.default.turns,\n lastExtractionAt: entries.default.lastExtractionAt,\n extractionCount: entries.default.extractionCount,\n entries,\n };\n }\n\n private entryActivityAt(entry: BufferEntryState): number {\n const lastTurnAt = entry.turns.reduce((latest, turn) => {\n const parsed = Date.parse(turn.timestamp);\n return Number.isFinite(parsed) ? Math.max(latest, parsed) : latest;\n }, -1);\n const lastExtractionAt =\n typeof entry.lastExtractionAt === \"string\"\n ? Date.parse(entry.lastExtractionAt)\n : Number.NaN;\n return Math.max(\n lastTurnAt,\n Number.isFinite(lastExtractionAt) ? lastExtractionAt : -1,\n );\n }\n\n private pruneEntries(retainKeys: string[]): void {\n const entries = this.state.entries;\n if (!entries) return;\n const keys = Object.keys(entries);\n if (keys.length <= MAX_BUFFER_ENTRY_COUNT) return;\n\n const insertionOrder = new Map(keys.map((key, index) => [key, index]));\n const removable = keys\n .filter((key) => key !== \"default\" && !retainKeys.includes(key))\n .filter((key) => (entries[key]?.turns.length ?? 0) === 0)\n .sort((left, right) => {\n const leftAt = this.entryActivityAt(entries[left] ?? {\n turns: [],\n lastExtractionAt: null,\n extractionCount: 0,\n });\n const rightAt = this.entryActivityAt(entries[right] ?? {\n turns: [],\n lastExtractionAt: null,\n extractionCount: 0,\n });\n if (leftAt !== rightAt) return leftAt - rightAt;\n return (insertionOrder.get(left) ?? 0) - (insertionOrder.get(right) ?? 0);\n });\n\n const removableCount = Math.max(0, keys.length - MAX_BUFFER_ENTRY_COUNT);\n for (const key of removable.slice(0, removableCount)) {\n delete entries[key];\n }\n }\n\n private async loadUnlocked(): Promise<void> {\n if (this.loaded) return;\n if (!this.loadPromise) {\n this.loadPromise = this.storage.loadBuffer()\n .then((state) => {\n this.state = this.normalizeState(state);\n this.loaded = true;\n })\n .finally(() => {\n this.loadPromise = null;\n });\n }\n await this.loadPromise;\n }\n\n async load(): Promise<void> {\n await this.enqueueMutation(async () => this.loadUnlocked());\n }\n\n /**\n * Reset the buffer to an empty, usable state.\n * Called when the persisted buffer file is corrupt and load() fails,\n * so the buffer can still accept new turns for the rest of the session.\n */\n resetToEmpty(): void {\n this.state = { turns: [], lastExtractionAt: null, extractionCount: 0 };\n this.loaded = true;\n }\n\n private async saveUnlocked(): Promise<void> {\n await this.storage.saveBuffer(this.state);\n }\n\n async save(): Promise<void> {\n await this.enqueueMutation(async () => this.saveUnlocked());\n }\n\n async addTurn(bufferKey: string, turn: BufferTurn): Promise<TriggerDecision> {\n return (await this.addTurnWithOutcome(bufferKey, turn)).decision;\n }\n\n async addTurnWithOutcome(\n bufferKey: string,\n turn: BufferTurn,\n ): Promise<AddTurnOutcome> {\n const mutation = await this.enqueueMutation(() => this.recordTurnUnlocked(bufferKey, turn));\n let decision = mutation.decision;\n let extractionTurns: BufferTurn[] | undefined;\n\n // Surprise-gated flush (issue #563). Additive only: if the probe is\n // disabled, unavailable, or the score is below threshold, the decision\n // from the existing trigger logic stands. The probe only ever *promotes*\n // `keep_buffering` → `extract_now`; it never suppresses an existing\n // flush. This preserves the invariant that enabling surprise cannot\n // *reduce* extraction frequency.\n if (\n decision === \"keep_buffering\" &&\n resolvePresentationCapabilities(this.config).bufferSurpriseTrigger &&\n this.surpriseProbe !== null &&\n // Matching the existing \"smart\" branch: surprise is a lower-tier\n // novelty signal that should not second-guess a high-signal hit\n // (which already flushes) or fight `every_n` / `time_based` modes.\n this.config.triggerMode === \"smart\" &&\n mutation.signalLevel !== \"high\"\n ) {\n const surprise = await this.computeSurpriseSafe(bufferKey, turn, mutation.priorTurns);\n if (surprise !== null) {\n const shouldPromote = surprise > this.config.bufferSurpriseThreshold;\n let triggered = false;\n if (shouldPromote) {\n const currentTurns = await this.getExtractionTurnsIfBufferSnapshotStillCurrent(\n bufferKey,\n mutation.activeTurnsSnapshot,\n mutation.retainedTurnsSnapshot,\n );\n if (currentTurns) {\n log.debug(\n `buffer[${bufferKey}]: surprise=${surprise.toFixed(3)} > threshold=${this.config.bufferSurpriseThreshold} → extract_now`,\n );\n decision = \"extract_now\";\n triggered = true;\n extractionTurns = currentTurns;\n } else {\n log.debug(\n `buffer[${bufferKey}]: surprise=${surprise.toFixed(3)} ignored because buffer changed before probe resolved`,\n );\n }\n }\n // Emit telemetry on every scored turn — both triggering and\n // non-triggering — so operators can fit the threshold to real\n // traffic distributions. Fire-and-forget: `addTurn` does NOT\n // await the ledger append, so slow/contended filesystems cannot\n // add JSONL-append latency to every `processTurn`. But we DO\n // serialize writes through a promise chain so concurrent\n // appends settle in wall-clock order — the report path assumes\n // chronological tail rows and reads the most recent as the\n // \"current\" threshold.\n //\n // Project only the fields we need into the queue entry rather\n // than capturing the full `BufferTurn` — under slow filesystem\n // latency the chain can back up, and we must not retain the\n // (potentially large) `turn.content` string for every pending\n // append.\n this.queueSurpriseTelemetryWrite({\n bufferKey,\n turnRole: turn.role,\n sessionKey:\n typeof turn.sessionKey === \"string\" ? turn.sessionKey : null,\n surpriseScore: surprise,\n triggered,\n turnCountInWindow: mutation.turnCountInWindow,\n // Stamp at decision time so backpressure on the write chain\n // does not shift the event's apparent moment away from when\n // the turn was actually scored.\n timestamp: new Date().toISOString(),\n // Snapshot the threshold used to compute `triggered` so a\n // concurrent config mutation cannot retroactively change\n // what the ledger row claims the decision was against.\n threshold: this.config.bufferSurpriseThreshold,\n });\n }\n }\n\n log.debug(\n `buffer[${bufferKey}]: ${mutation.turnCountInWindow} turns, signal=${mutation.signalLevel}, decision=${decision}`,\n );\n return extractionTurns ? { decision, extractionTurns } : { decision };\n }\n\n private async recordTurnUnlocked(bufferKey: string, turn: BufferTurn): Promise<AddTurnMutationResult> {\n await this.loadUnlocked();\n const entry = this.entryFor(bufferKey);\n const priorTurns = entry.turns.slice();\n entry.turns.push(turn);\n const activeTurnsSnapshot = entry.turns.map(copyBufferTurn);\n const retainedTurnsSnapshot = (entry.retainedTurns ?? []).map(copyBufferTurn);\n if (bufferKey === \"default\") {\n this.state.turns = entry.turns;\n }\n\n const signal = scanSignals(turn.content, this.config.highSignalPatterns);\n const decision = this.evaluate(entry, signal.level);\n const turnCountInWindow = entry.turns.length;\n\n this.pruneEntries([bufferKey]);\n await this.saveUnlocked();\n return {\n decision,\n signalLevel: signal.level,\n priorTurns,\n activeTurnsSnapshot,\n retainedTurnsSnapshot,\n turnCountInWindow,\n };\n }\n\n private async getExtractionTurnsIfBufferSnapshotStillCurrent(\n bufferKey: string,\n activeTurnsSnapshot: readonly BufferTurn[],\n retainedTurnsSnapshot: readonly BufferTurn[],\n ): Promise<BufferTurn[] | null> {\n return this.enqueueMutation(async () => {\n await this.loadUnlocked();\n const entry = this.peekEntry(bufferKey);\n if (!entry) return null;\n const retained = entry.retainedTurns ?? [];\n const stillCurrent =\n bufferTurnArrayIsSuffixOfSnapshot(entry.turns, activeTurnsSnapshot) &&\n bufferTurnArraysEqual(retained, retainedTurnsSnapshot);\n if (!stillCurrent) return null;\n return [...retained, ...entry.turns];\n });\n }\n\n /**\n * Enqueue a telemetry append on the serialized write chain.\n *\n * The chain is a classic `writeChain = writeChain.then(fn).catch(...)`\n * — each link waits for the previous to settle before its append\n * starts, so out-of-order chronology cannot happen even under\n * variable filesystem latency. We always attach `.catch` so one\n * rejection does not poison the chain for the rest of the session\n * (CLAUDE.md rule #40). The error is logged through\n * `emitSurpriseEventSafe` itself, which swallows its own rejections.\n *\n * Public surface is deliberately narrow — only `addTurn` should call\n * this, so the surprise telemetry path stays centralized.\n */\n private queueSurpriseTelemetryWrite(params: SurpriseTelemetryQueueEntry): void {\n this.surpriseTelemetryWriteChain = this.surpriseTelemetryWriteChain\n .then(() => this.emitSurpriseEventSafe(params))\n .catch(() => {\n // `emitSurpriseEventSafe` already handles the logging. We\n // swallow here only so one failure does not break the chain\n // for future writes.\n });\n }\n\n /**\n * Append a single `BUFFER_SURPRISE` telemetry row (issue #563 PR 3).\n *\n * Deliberately swallows write errors: the buffer must never fail to\n * record a turn because the observation ledger is read-only, out of\n * disk, or otherwise unhappy. The log line at debug lets operators\n * confirm the path fired without polluting the error channel.\n */\n private async emitSurpriseEventSafe(\n params: SurpriseTelemetryQueueEntry,\n ): Promise<void> {\n const storage = this.storage as StorageManager & {\n appendBufferSurpriseEvents?: (\n events: BufferSurpriseEvent[],\n ) => Promise<number>;\n };\n if (typeof storage.appendBufferSurpriseEvents !== \"function\") {\n // Older StorageManager / test double without the telemetry sink.\n // Silently skip — core path is still covered by the log line above.\n return;\n }\n const event: BufferSurpriseEvent = {\n event: \"BUFFER_SURPRISE\",\n // Use the decision-time stamp captured when the event was\n // queued, NOT `Date.now()` here — backpressure on the write\n // chain could otherwise shift timestamps into the future relative\n // to when the turn was scored.\n timestamp: params.timestamp,\n bufferKey: params.bufferKey,\n sessionKey: params.sessionKey,\n turnRole: params.turnRole,\n surpriseScore: params.surpriseScore,\n // Use the snapshotted threshold from the queue entry, not the\n // live config — see `SurpriseTelemetryQueueEntry.threshold`\n // doc for the rationale.\n threshold: params.threshold,\n triggeredFlush: params.triggered,\n turnCountInWindow: params.turnCountInWindow,\n };\n try {\n await storage.appendBufferSurpriseEvents([event]);\n } catch (err) {\n // Same guard as `computeSurpriseSafe`: non-Error rejections must\n // not crash the telemetry helper, which would defeat the whole\n // point of isolating the ledger write from the hot path.\n log.debug(\n `buffer[${params.bufferKey}]: surprise telemetry write failed, continuing: ${describeError(err)}`,\n );\n }\n }\n\n /**\n * Invoke the injected surprise probe defensively. Any error (probe throws,\n * embedder unavailable, timeout) is swallowed and logged at debug: the\n * surprise path must never crash the happy-path trigger evaluation. A\n * `null` return indicates \"no score available, fall through to existing\n * triggers\".\n */\n private async computeSurpriseSafe(\n bufferKey: string,\n turn: BufferTurn,\n priorTurns: readonly BufferTurn[],\n ): Promise<number | null> {\n if (!this.surpriseProbe) return null;\n try {\n // Hard timeout around the probe so a hung embedder cannot stall\n // `addTurn()` before `save()`. A slow probe would otherwise\n // prevent the just-appended turn from ever being persisted. The\n // timeout is a soft bound — we race it against the probe, take\n // whichever settles first, and treat the timeout as\n // \"probe unavailable, fall through\" rather than an error that\n // surfaces to the caller.\n const score = await probeWithTimeout(\n this.surpriseProbe.scoreTurn(bufferKey, turn, priorTurns),\n this.config.bufferSurpriseProbeTimeoutMs,\n );\n if (score === null) return null;\n if (typeof score !== \"number\" || !Number.isFinite(score)) {\n log.debug(\n `buffer[${bufferKey}]: surprise probe returned non-finite score (${String(score)}), ignoring`,\n );\n return null;\n }\n // Defensive clamp: formula lives in buffer-surprise.ts, but we never\n // want a misbehaving probe to inject an out-of-range value into the\n // threshold comparison.\n if (score < 0) return 0;\n if (score > 1) return 1;\n return score;\n } catch (err) {\n // `err` may be any thrown value — `throw null` and\n // `Promise.reject(\"x\")` are both legal. Accessing `.message` on a\n // non-Error would itself throw and defeat the failure-isolation\n // contract, so describe the value safely.\n log.debug(\n `buffer[${bufferKey}]: surprise probe failed, falling back to existing triggers: ${describeError(err)}`,\n );\n return null;\n }\n }\n\n private evaluate(entry: BufferEntryState, signalLevel: SignalLevel): TriggerDecision {\n if (this.config.triggerMode === \"smart\") {\n if (signalLevel === \"high\") return \"extract_now\";\n\n if (entry.turns.length >= this.config.bufferMaxTurns) {\n return \"extract_batch\";\n }\n\n if (entry.lastExtractionAt) {\n const elapsed =\n Date.now() - new Date(entry.lastExtractionAt).getTime();\n if (elapsed >= this.config.bufferMaxMinutes * 60_000) {\n return \"extract_batch\";\n }\n }\n\n return \"keep_buffering\";\n }\n\n if (this.config.triggerMode === \"every_n\") {\n return entry.turns.length >= this.config.bufferMaxTurns\n ? \"extract_batch\"\n : \"keep_buffering\";\n }\n\n if (this.config.triggerMode === \"time_based\") {\n if (!entry.lastExtractionAt) {\n return entry.turns.length >= this.config.bufferMaxTurns\n ? \"extract_batch\"\n : \"keep_buffering\";\n }\n const elapsed =\n Date.now() - new Date(entry.lastExtractionAt).getTime();\n return elapsed >= this.config.bufferMaxMinutes * 60_000\n ? \"extract_batch\"\n : \"keep_buffering\";\n }\n\n return \"keep_buffering\";\n }\n\n getTurns(bufferKey = \"default\"): BufferTurn[] {\n const entry = this.peekEntry(bufferKey);\n if (!entry) return [];\n const retained = entry.retainedTurns ?? [];\n // Retained turns (from a previous defer verdict, issue #562 PR 2) are\n // prepended so the chronological order — oldest context first — is\n // preserved for the next extraction pass.\n return [...retained, ...entry.turns];\n }\n\n /**\n * Retain a subset of the current turns across `clearAfterExtraction` so a\n * future extraction pass sees the context behind a deferred candidate\n * (issue #562, PR 2). Callers pass the turns that were seen during the\n * current extraction; the buffer keeps the tail (latest `max` turns) as\n * the retention window. Passing an empty array or `max <= 0` clears the\n * retention slot instead.\n */\n async retainDeferredTurns(\n bufferKey: string,\n turns: BufferTurn[],\n max = 10,\n ): Promise<void> {\n await this.enqueueMutation(async () => {\n await this.loadUnlocked();\n const entry = this.entryFor(bufferKey);\n if (!Array.isArray(turns) || turns.length === 0 || max <= 0) {\n delete entry.retainedTurns;\n } else {\n // Guard `slice(-max)` against `max === 0` (CLAUDE.md gotcha 27):\n // `slice(-0)` equals `slice(0)` and would return ALL entries. We\n // already early-return above when max <= 0.\n const tail = turns.slice(-max);\n // Copy explicit fields only — never spread an external object into a\n // plain object because spread preserves any own `__proto__` /\n // `constructor` keys that may have arrived via JSON deserialization\n // of untrusted input (CodeQL js/prototype-polluting-assignment).\n entry.retainedTurns = tail.map<BufferTurn>((t) => {\n const copy: BufferTurn = {\n role: t.role,\n content: typeof t.content === \"string\" ? t.content : \"\",\n timestamp:\n typeof t.timestamp === \"string\"\n ? t.timestamp\n : new Date().toISOString(),\n };\n if (typeof t.sessionKey === \"string\") copy.sessionKey = t.sessionKey;\n if (typeof t.logicalSessionKey === \"string\") {\n copy.logicalSessionKey = t.logicalSessionKey;\n }\n if (\n t.providerThreadId === null ||\n typeof t.providerThreadId === \"string\"\n ) {\n copy.providerThreadId = t.providerThreadId;\n }\n if (typeof t.turnFingerprint === \"string\") {\n copy.turnFingerprint = t.turnFingerprint;\n }\n if (typeof t.persistProcessedFingerprint === \"boolean\") {\n copy.persistProcessedFingerprint = t.persistProcessedFingerprint;\n }\n return copy;\n });\n }\n await this.saveUnlocked();\n });\n }\n\n /**\n * Return the current retention window (issue #562, PR 2). Primarily for\n * tests and diagnostics.\n */\n getRetainedDeferredTurns(bufferKey = \"default\"): BufferTurn[] {\n const entry = this.peekEntry(bufferKey);\n return entry?.retainedTurns ? [...entry.retainedTurns] : [];\n }\n\n async findBufferKeyForSession(sessionKey: string): Promise<string | null> {\n const bufferKeys = await this.findBufferKeysForSession(sessionKey);\n return bufferKeys[0] ?? null;\n }\n\n async findBufferKeysForSession(sessionKey: string): Promise<string[]> {\n if (typeof sessionKey !== \"string\" || sessionKey.length === 0) return [];\n await this.mutationChain.catch(() => {});\n await this.load();\n\n const matches: string[] = [];\n const directEntry = this.peekEntry(sessionKey);\n if ((directEntry?.turns.length ?? 0) > 0) {\n matches.push(sessionKey);\n }\n\n const entries = this.state.entries ?? {};\n for (const [bufferKey, entry] of Object.entries(entries)) {\n if (\n !matches.includes(bufferKey) &&\n entry.turns.some(\n (turn) =>\n typeof turn.sessionKey === \"string\" && turn.sessionKey === sessionKey,\n )\n ) {\n matches.push(bufferKey);\n }\n }\n\n return matches;\n }\n\n async clearAfterExtraction(\n bufferKey = \"default\",\n extractedTurns?: readonly BufferTurn[],\n ): Promise<void> {\n await this.enqueueMutation(async () => {\n await this.loadUnlocked();\n const entry = this.entryFor(bufferKey);\n if (Array.isArray(extractedTurns)) {\n const liveExtractedTurns = liveTurnsFromExtractionSnapshot(\n entry,\n extractedTurns,\n );\n let clearedLiveTurns = false;\n if (liveExtractedTurns.length > 0) {\n const matchedCount = matchingQueuedExtractionPrefixLength(\n entry.turns,\n liveExtractedTurns,\n );\n if (matchedCount > 0) {\n entry.turns = entry.turns.slice(matchedCount);\n clearedLiveTurns = true;\n } else {\n log.debug(\n `buffer[${bufferKey}]: extraction clear skipped because live turns changed before clear`,\n );\n }\n }\n if (!clearedLiveTurns) {\n await this.saveUnlocked();\n return;\n }\n } else {\n entry.turns = [];\n }\n entry.lastExtractionAt = new Date().toISOString();\n entry.extractionCount += 1;\n if (bufferKey === \"default\") {\n this.state.turns = entry.turns;\n this.state.lastExtractionAt = entry.lastExtractionAt;\n this.state.extractionCount = entry.extractionCount;\n }\n this.pruneEntries([bufferKey]);\n await this.saveUnlocked();\n });\n }\n\n getExtractionCount(bufferKey = \"default\"): number {\n return this.peekEntry(bufferKey)?.extractionCount ?? 0;\n }\n\n /**\n * Await any pending `BUFFER_SURPRISE` telemetry writes.\n *\n * The telemetry path is fire-and-forget from the hot path's point of\n * view, but tests and before-exit hooks sometimes need to make sure\n * the ledger has been flushed before they assert on its contents or\n * close the process. This method resolves once the current chain\n * head has settled; new writes scheduled after this call return a\n * separate, later settlement.\n *\n * Never throws — the chain already catches its own rejections.\n */\n async flushSurpriseTelemetry(): Promise<void> {\n await this.surpriseTelemetryWriteChain;\n }\n}\n\n/**\n * Render an arbitrary thrown value as a short string for debug logging.\n *\n * JavaScript permits throwing *any* value (`throw null`,\n * `Promise.reject(\"x\")`, `throw { reason: \"timeout\" }`) — not just\n * `Error` instances. The defensive catch blocks in `SmartBuffer` must\n * never themselves throw while trying to log the failure, or they\n * would defeat the whole point of isolating the surprise path from the\n * core extraction decision.\n */\nfunction describeError(err: unknown): string {\n if (err instanceof Error) return err.message;\n if (err === null) return \"null\";\n if (err === undefined) return \"undefined\";\n if (typeof err === \"string\") return err;\n try {\n return JSON.stringify(err);\n } catch {\n return String(err);\n }\n}\n\nfunction copyBufferTurn(turn: BufferTurn): BufferTurn {\n const copy: BufferTurn = {\n role: turn.role,\n content: turn.content,\n timestamp: turn.timestamp,\n };\n if (typeof turn.sessionKey === \"string\") copy.sessionKey = turn.sessionKey;\n if (typeof turn.logicalSessionKey === \"string\") {\n copy.logicalSessionKey = turn.logicalSessionKey;\n }\n if (\n turn.providerThreadId === null ||\n typeof turn.providerThreadId === \"string\"\n ) {\n copy.providerThreadId = turn.providerThreadId;\n }\n if (typeof turn.turnFingerprint === \"string\") {\n copy.turnFingerprint = turn.turnFingerprint;\n }\n if (typeof turn.persistProcessedFingerprint === \"boolean\") {\n copy.persistProcessedFingerprint = turn.persistProcessedFingerprint;\n }\n return copy;\n}\n\nfunction bufferTurnsEqual(left: BufferTurn | undefined, right: BufferTurn): boolean {\n if (!left) return false;\n return (\n left.role === right.role &&\n left.content === right.content &&\n left.timestamp === right.timestamp &&\n left.sessionKey === right.sessionKey &&\n left.logicalSessionKey === right.logicalSessionKey &&\n left.providerThreadId === right.providerThreadId &&\n left.turnFingerprint === right.turnFingerprint &&\n left.persistProcessedFingerprint === right.persistProcessedFingerprint\n );\n}\n\nfunction bufferTurnArraysEqual(\n left: readonly BufferTurn[],\n right: readonly BufferTurn[],\n): boolean {\n return (\n left.length === right.length &&\n left.every((turn, index) => bufferTurnsEqual(turn, right[index]))\n );\n}\n\nfunction bufferTurnArrayIsSuffixOfSnapshot(\n liveTurns: readonly BufferTurn[],\n snapshot: readonly BufferTurn[],\n): boolean {\n if (liveTurns.length === 0 || liveTurns.length > snapshot.length) {\n return false;\n }\n const offset = snapshot.length - liveTurns.length;\n return liveTurns.every((turn, index) =>\n bufferTurnsEqual(turn, snapshot[offset + index]),\n );\n}\n\nfunction liveTurnsFromExtractionSnapshot(\n entry: BufferEntryState,\n extractedTurns: readonly BufferTurn[],\n): readonly BufferTurn[] {\n const retainedTurns = entry.retainedTurns ?? [];\n if (\n retainedTurns.length > 0 &&\n extractedTurns.length >= retainedTurns.length &&\n retainedTurns.every((turn, index) =>\n bufferTurnsEqual(extractedTurns[index], turn),\n )\n ) {\n const withoutRetainedPrefix = extractedTurns.slice(retainedTurns.length);\n if (\n withoutRetainedPrefix.length > 0 &&\n matchingPrefixLength(entry.turns, withoutRetainedPrefix) > 0\n ) {\n return withoutRetainedPrefix;\n }\n }\n return extractedTurns;\n}\n\nfunction matchingPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let index = 0;\n while (\n index < liveTurns.length &&\n index < extractedTurns.length &&\n bufferTurnsEqual(liveTurns[index], extractedTurns[index])\n ) {\n index += 1;\n }\n return index;\n}\n\nfunction matchingQueuedExtractionPrefixLength(\n liveTurns: readonly BufferTurn[],\n extractedTurns: readonly BufferTurn[],\n): number {\n let bestMatchedCount = 0;\n for (let start = 0; start < extractedTurns.length; start += 1) {\n const matchedCount = matchingPrefixLength(\n liveTurns,\n extractedTurns.slice(start),\n );\n if (matchedCount > bestMatchedCount) {\n bestMatchedCount = matchedCount;\n if (bestMatchedCount === liveTurns.length) break;\n }\n }\n return bestMatchedCount;\n}\n\n/**\n * Sentinel error class for the probe timeout path. Catching it via\n * `instanceof` lets the buffer's surprise helper distinguish a timeout\n * from a probe rejection (which could carry operational context the\n * operator wants to see).\n */\nclass ProbeTimeoutError extends Error {\n constructor(timeoutMs: number) {\n super(`probe exceeded ${timeoutMs}ms`);\n this.name = \"ProbeTimeoutError\";\n }\n}\n\n/**\n * Race `inflight` against a timeout clock. Resolves with `inflight`'s\n * value if it settles first, otherwise rejects with `ProbeTimeoutError`.\n * The timer is cleared in both branches so a fast-resolving probe does\n * not leak a handle that would keep the Node event loop alive.\n */\nfunction probeWithTimeout<T>(\n inflight: Promise<T>,\n timeoutMs: number,\n): Promise<T> {\n let timer: NodeJS.Timeout | null = null;\n const timeout = new Promise<T>((_, reject) => {\n timer = setTimeout(() => reject(new ProbeTimeoutError(timeoutMs)), timeoutMs);\n // `.unref()` so the timer does not hold the event loop open if the\n // caller decides the probe result is no longer interesting.\n if (typeof (timer as NodeJS.Timeout).unref === \"function\") {\n (timer as NodeJS.Timeout).unref();\n }\n });\n return Promise.race([inflight, timeout]).finally(() => {\n if (timer) clearTimeout(timer);\n });\n}\n"],"mappings":";;;;;;;;;;;AA+CA,IAAM,yBAAyB;AA8CxB,IAAM,cAAN,MAAkB;AAAA,EAsBvB,YACmB,QACA,SACjB,gBAA4C,MAC5C;AAHiB;AACA;AAGjB,SAAK,QAAQ,EAAE,OAAO,CAAC,GAAG,kBAAkB,MAAM,iBAAiB,EAAE;AACrE,SAAK,gBAAgB;AAAA,EACvB;AAAA,EANmB;AAAA,EACA;AAAA,EAvBX;AAAA,EACA,SAAS;AAAA,EACT,cAAoC;AAAA,EAC3B;AAAA,EACT,gBAAkC,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAelD,8BAAgD,QAAQ,QAAQ;AAAA,EAWhE,gBAAmB,IAAkC;AAC3D,UAAM,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AAU,UAClB,QAAQ,eAAe,UACvB,iBAAiB,UAAU,KAAK,GAAG,eAAe,KAAK,CAAC,GACxD;AACA,aAAS;AAAA,EACX;AACA,SAAO;AACT;AAEA,SAAS,qCACP,WACA,gBACQ;AACR,MAAI,mBAAmB;AACvB,WAAS,QAAQ,GAAG,QAAQ,eAAe,QAAQ,SAAS,GAAG;AAC7D,UAAM,eAAe;AAAA,MACnB;AAAA,MACA,eAAe,MAAM,KAAK;AAAA,IAC5B;AACA,QAAI,eAAe,kBAAkB;AACnC,yBAAmB;AACnB,UAAI,qBAAqB,UAAU,OAAQ;AAAA,IAC7C;AAAA,EACF;AACA,SAAO;AACT;AAQA,IAAM,oBAAN,cAAgC,MAAM;AAAA,EACpC,YAAY,WAAmB;AAC7B,UAAM,kBAAkB,SAAS,IAAI;AACrC,SAAK,OAAO;AAAA,EACd;AACF;AAQA,SAAS,iBACP,UACA,WACY;AACZ,MAAI,QAA+B;AACnC,QAAM,UAAU,IAAI,QAAW,CAAC,GAAG,WAAW;AAC5C,YAAQ,WAAW,MAAM,OAAO,IAAI,kBAAkB,SAAS,CAAC,GAAG,SAAS;AAG5E,QAAI,OAAQ,MAAyB,UAAU,YAAY;AACzD,MAAC,MAAyB,MAAM;AAAA,IAClC;AAAA,EACF,CAAC;AACD,SAAO,QAAQ,KAAK,CAAC,UAAU,OAAO,CAAC,EAAE,QAAQ,MAAM;AACrD,QAAI,MAAO,cAAa,KAAK;AAAA,EAC/B,CAAC;AACH;","names":[]}
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-OD4FM2U7.js";
6
6
  import {
7
7
  resolveCompressionCapabilities
8
- } from "./chunk-JWDE7OVJ.js";
8
+ } from "./chunk-RJBW4EOU.js";
9
9
  import {
10
10
  log
11
11
  } from "./chunk-NU3CSQ4H.js";
@@ -283,4 +283,4 @@ export {
283
283
  CompressionGuidelineCoordinator,
284
284
  formatCompressionGuidelinesForRecall
285
285
  };
286
- //# sourceMappingURL=chunk-IXGXALRV.js.map
286
+ //# sourceMappingURL=chunk-QTJOORGN.js.map
@@ -138,6 +138,47 @@ function resolveCompressionCapabilities(config) {
138
138
  contextCompressionActions: config.contextCompressionActionsEnabled
139
139
  });
140
140
  }
141
+ function resolvePresentationCapabilities(config) {
142
+ return Object.freeze({
143
+ verbatimArtifacts: config.verbatimArtifactsEnabled,
144
+ memoryBoxes: config.memoryBoxesEnabled,
145
+ bufferSurpriseTrigger: config.bufferSurpriseTriggerEnabled,
146
+ threading: config.threadingEnabled,
147
+ episodeNoteMode: config.episodeNoteModeEnabled,
148
+ transcript: config.transcriptEnabled,
149
+ entitySummary: config.entitySummaryEnabled
150
+ });
151
+ }
152
+ function resolveConsolidationCapabilities(config) {
153
+ return Object.freeze({
154
+ compoundingSemantic: config.compoundingSemanticEnabled,
155
+ abstractionAnchors: config.abstractionAnchorsEnabled,
156
+ compounding: config.compoundingEnabled,
157
+ calibration: config.calibrationEnabled,
158
+ semanticConsolidation: config.semanticConsolidationEnabled,
159
+ patternReinforcement: config.patternReinforcementEnabled,
160
+ continuityAudit: config.continuityAuditEnabled,
161
+ graphEdgeDecay: config.graphEdgeDecayEnabled
162
+ });
163
+ }
164
+ function resolveRecallAuxiliaryCapabilities(config) {
165
+ return Object.freeze({
166
+ causalRuleExtraction: config.causalRuleExtractionEnabled,
167
+ correction: config.correctionEnabled,
168
+ continuityIncidentLogging: config.continuityIncidentLoggingEnabled,
169
+ daySummary: config.daySummaryEnabled,
170
+ versioning: config.versioningEnabled,
171
+ verifiedRecall: config.verifiedRecallEnabled,
172
+ semanticRuleVerification: config.semanticRuleVerificationEnabled,
173
+ workProductRecall: config.workProductRecallEnabled,
174
+ secureStore: config.secureStoreEnabled,
175
+ knowledgeIndex: config.knowledgeIndexEnabled,
176
+ factDeduplication: config.factDeduplicationEnabled,
177
+ compactionReset: config.compactionResetEnabled,
178
+ entityRetrieval: config.entityRetrievalEnabled,
179
+ cronRecallPolicy: config.cronRecallPolicyEnabled
180
+ });
181
+ }
141
182
 
142
183
  export {
143
184
  resolveCapabilities,
@@ -154,6 +195,9 @@ export {
154
195
  resolveEvalCapabilities,
155
196
  resolveUtilityLearningCapabilities,
156
197
  resolveObjectiveStateCapabilities,
157
- resolveCompressionCapabilities
198
+ resolveCompressionCapabilities,
199
+ resolvePresentationCapabilities,
200
+ resolveConsolidationCapabilities,
201
+ resolveRecallAuxiliaryCapabilities
158
202
  };
159
- //# sourceMappingURL=chunk-JWDE7OVJ.js.map
203
+ //# sourceMappingURL=chunk-RJBW4EOU.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/capabilities.ts"],"sourcesContent":["/**\n * CapabilitySet — recall-operation feature gates resolved once, then threaded.\n *\n * Issue #1523 (Phase 1 of epic #1520). Root cause this addresses: 161+\n * scattered `config.<flag>Enabled` reads mean each gate is re-derived at every\n * call site, and reviews keep finding parallel code paths where one branch\n * checks a gate the other forgot (CLAUDE.md rule 39 — the \"gate divergence\"\n * defect class). The fix is to resolve a frozen capability projection ONCE at\n * the top of the recall operation and pass it down explicitly.\n *\n * Scope of THIS module (first migration PR): only the recall-operation-scoped\n * flags below. Flags that are also read in graph construction, writes, CLI, or\n * the summarizer are deliberately deferred to a follow-up so we never leave a\n * single flag half-migrated (some sites on `caps.`, some on `config.`).\n *\n * Field naming: each field is the config flag name with the trailing `Enabled`\n * removed (`recallMmrEnabled` → `recallMmr`).\n *\n * This is plumbing, not a feature — there is deliberately NO `enabled` gate for\n * the CapabilitySet itself (rule 30 governs behavior changes; resolving and\n * threading a capability projection must stay behavior-preserving).\n */\n\nimport type { PluginConfig } from \"./types.js\";\n\n/**\n * Frozen projection of recall-operation feature gates.\n *\n * Every field is `readonly boolean`. The composition that maps a config flag to\n * a capability (including default-when-undefined semantics for optional flags)\n * lives ONLY in {@link resolveCapabilities} — call sites must read the\n * capability, never re-derive it from raw config.\n */\nexport interface CapabilitySet {\n /** `rerankCacheEnabled` — cache reranker scores across recall passes. */\n readonly rerankCache: boolean;\n /** `recallDirectAnswerEnabled` — observation-mode direct-answer tier. */\n readonly recallDirectAnswer: boolean;\n /** `recallMemoryWorthFilterEnabled` — Memory-Worth score reweighting. */\n readonly recallMemoryWorthFilter: boolean;\n /** `trustScoreEnabled` — unified TrustScore recall stage (issue #1577). */\n readonly recallTrustScore: boolean;\n /** `recallMmrEnabled` — maximal-marginal-relevance diversification. */\n readonly recallMmr: boolean;\n /** `recallReasoningTraceBoostEnabled` — boost reasoning-trace memories. */\n readonly recallReasoningTraceBoost: boolean;\n /** `recallPlannerLlmEnabled` — LLM-backed recall-mode planner. */\n readonly recallPlannerLlm: boolean;\n /** `recallPlannerEnabled` — recall-mode planner (heuristic + optional LLM). */\n readonly recallPlanner: boolean;\n /** `recallConfidenceGateEnabled` — Synapse-style confidence gate. */\n readonly recallConfidenceGate: boolean;\n /** `graphRecallEnabled` — graph-mode recall tier (gates planner graph mode). */\n readonly graphRecall: boolean;\n /** `graphAssistInFullModeEnabled` — graph-assist overlay in full mode. */\n readonly graphAssistInFullMode: boolean;\n /** `graphExpandedIntentEnabled` — promote broad-intent asks to graph mode. */\n readonly graphExpandedIntent: boolean;\n // --- Issue #1566 Cluster C: mixed-operation flags (recall + summarizer/CLI/writes) ---\n /** `rerankEnabled` — optional LLM reranking of recall candidates. */\n readonly rerank: boolean;\n /** `harmonicRetrievalEnabled` — abstraction-node harmonic retrieval tier. */\n readonly harmonicRetrieval: boolean;\n /** `parallelRetrievalEnabled` — three-agent parallel retrieval (DirectFact + Contextual + Temporal). */\n readonly parallelRetrieval: boolean;\n}\n\n/**\n * Resolve the recall-operation {@link CapabilitySet} from parsed config.\n *\n * Call this ONCE per recall operation (at the `recall()` / `recallInternal`\n * entry) and thread the result down. Composition lives here and only here.\n *\n * Session toggles are intentionally not a parameter yet: `session-toggles.ts`\n * is agent-scoped (per session/agent enable-disable of the whole plugin), not\n * flag-scoped — none of the flags projected here have a per-session override,\n * so there is nothing for a toggle argument to compose at this layer.\n */\nexport function resolveCapabilities(config: PluginConfig): CapabilitySet {\n return Object.freeze({\n rerankCache: config.rerankCacheEnabled,\n recallDirectAnswer: config.recallDirectAnswerEnabled,\n recallMemoryWorthFilter: config.recallMemoryWorthFilterEnabled,\n // Issue #1577: TrustScore subsumes the Memory Worth multiplier when on;\n // the orchestrator runs exactly one of the two (mutual exclusion, rule 39).\n recallTrustScore: config.trustScoreEnabled === true,\n recallMmr: config.recallMmrEnabled,\n recallReasoningTraceBoost: config.recallReasoningTraceBoostEnabled,\n recallPlannerLlm: config.recallPlannerLlmEnabled,\n recallPlanner: config.recallPlannerEnabled,\n recallConfidenceGate: config.recallConfidenceGateEnabled,\n graphRecall: config.graphRecallEnabled,\n // Optional flags: preserve the exact default-when-undefined semantics the\n // migrated call sites used (`!== false` = default-on, `=== true` = default-off).\n graphAssistInFullMode: config.graphAssistInFullModeEnabled !== false,\n graphExpandedIntent: config.graphExpandedIntentEnabled === true,\n // Issue #1566 Cluster C: mixed-operation flags resolved once per recall op.\n rerank: config.rerankEnabled,\n harmonicRetrieval: config.harmonicRetrievalEnabled,\n parallelRetrieval: config.parallelRetrievalEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Graph-construction capability set (issue #1566 Cluster A).\n//\n// The recall CapabilitySet above covers flags whose EVERY read site lives on\n// the recall call chain. The five flags below are read on graph-construction,\n// write/extraction, AND recall paths — so they cannot join the recall set\n// without leaving some sites on `caps.` and others on `config.` (the exact\n// divergence #1523 forbade). They get their own projection, resolved at graph\n// build/write entry (and alongside `caps` when recall reads them).\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of graph-construction feature gates.\n *\n * Every field is `readonly boolean`. Composition (including default-when-\n * undefined semantics for the optional `graphWriteSessionAdjacencyEnabled`)\n * lives ONLY in {@link resolveGraphConstructionCapabilities}.\n */\nexport interface GraphConstructionCapabilitySet {\n /** `entityGraphEnabled` — maintain entity co-reference graph edges. */\n readonly entityGraph: boolean;\n /** `timeGraphEnabled` — maintain thread-adjacency graph edges. */\n readonly timeGraph: boolean;\n /** `causalGraphEnabled` — maintain causal-language graph edges. */\n readonly causalGraph: boolean;\n /** `multiGraphMemoryEnabled` — master switch for multi-graph writes/traversal. */\n readonly multiGraphMemory: boolean;\n /** `graphWriteSessionAdjacencyEnabled` — session-adjacency fallback for time edges (default-on). */\n readonly graphWriteSessionAdjacency: boolean;\n}\n\n/**\n * Resolve the {@link GraphConstructionCapabilitySet} from parsed config.\n *\n * Call this ONCE at graph build/write entry (extraction, recall graph\n * expansion, graph-health/repair) and thread the result down — exactly the\n * pattern {@link resolveCapabilities} established for recall.\n */\nexport type GraphConstructionConfigProjection = Pick<\n PluginConfig,\n | \"entityGraphEnabled\"\n | \"timeGraphEnabled\"\n | \"causalGraphEnabled\"\n | \"multiGraphMemoryEnabled\"\n | \"graphWriteSessionAdjacencyEnabled\"\n>;\n\nexport function resolveGraphConstructionCapabilities(\n config: GraphConstructionConfigProjection,\n): GraphConstructionCapabilitySet {\n return Object.freeze({\n entityGraph: config.entityGraphEnabled,\n timeGraph: config.timeGraphEnabled,\n causalGraph: config.causalGraphEnabled,\n multiGraphMemory: config.multiGraphMemoryEnabled,\n // Optional flag: preserve the exact default-when-undefined semantics the\n // migrated call site used (`!== false` = default-on).\n graphWriteSessionAdjacency: config.graphWriteSessionAdjacencyEnabled !== false,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Access-setup capability set (issue #1566 Cluster B).\n//\n// These two flags gate cross-namespace recall budgeting and anomaly-detection\n// auditing. Resolved once at access-service handler entry (and the operator\n// doctor check) rather than re-derived from raw config at each site.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of access-setup feature gates (issue #1566 Cluster B).\n *\n * Every field is `readonly boolean`. Composition (including the default-off\n * semantics for the optional `recallAuditAnomalyDetectionEnabled`) lives ONLY\n * in {@link resolveAccessSetupCapabilities}.\n */\nexport interface AccessSetupCapabilitySet {\n /** `recallCrossNamespaceBudgetEnabled` — rolling cross-namespace recall budget. */\n readonly recallCrossNamespaceBudget: boolean;\n /** `recallAuditAnomalyDetectionEnabled` — access-audit anomaly detection (default-off). */\n readonly recallAuditAnomalyDetection: boolean;\n}\n\n/**\n * Resolve the {@link AccessSetupCapabilitySet} from parsed config.\n *\n * Call this ONCE at access-service handler entry and thread the result down.\n */\nexport type AccessSetupConfigProjection = Pick<\n PluginConfig,\n \"recallCrossNamespaceBudgetEnabled\" | \"recallAuditAnomalyDetectionEnabled\"\n>;\n\nexport function resolveAccessSetupCapabilities(\n config: AccessSetupConfigProjection,\n): AccessSetupCapabilitySet {\n return Object.freeze({\n recallCrossNamespaceBudget: config.recallCrossNamespaceBudgetEnabled,\n // Optional/default-off flag: preserve `=== true` semantics.\n recallAuditAnomalyDetection: config.recallAuditAnomalyDetectionEnabled === true,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Memory-lifecycle capability set (issue #1523 batch 3).\n//\n// The flags below gate memory WRITE/EXTRACTION (extraction judge, scope\n// classification, dedupe, telemetry prefilter), temporal supersession of\n// stored facts, and the lifecycle policy pass (promotion / decay / stale\n// filtering). They are read on the persistExtraction write path, the recall\n// candidate-filter path, and the maintenance / lifecycle-pass path — so, like\n// the graph-construction set above, they get their own projection resolved\n// ONCE at each operation entry that reads them (never re-derived from raw\n// config mid-operation — the gate-divergence defect class #1523 targets).\n//\n// Every field projects from an already-resolved PluginConfig boolean (defaults\n// are applied at the config-parse boundary, rule 36), so the resolver is a\n// pure projection — no `!== false` / `=== true` re-coercion here.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of memory-lifecycle feature gates (issue #1523 batch 3).\n *\n * Resolved once per write / recall-filter / maintenance operation and threaded\n * down. Composition lives ONLY in {@link resolveMemoryLifecycleCapabilities}.\n */\nexport interface MemoryLifecycleCapabilitySet {\n /** `temporalSupersessionEnabled` — supersede stale structured facts on write, filter on recall. */\n readonly temporalSupersession: boolean;\n /** `temporalMemoryTreeEnabled` — temporal-memory-tree build + recall tier. */\n readonly temporalMemoryTree: boolean;\n /** `lifecyclePolicyEnabled` — lifecycle promotion / decay metadata pass. */\n readonly lifecyclePolicy: boolean;\n /** `lifecycleFilterStaleEnabled` — filter stale-lifecycle memories from recall. */\n readonly lifecycleFilterStale: boolean;\n /** `lifecycleMetricsEnabled` — emit lifecycle-pass metrics. */\n readonly lifecycleMetrics: boolean;\n /** `extractionScopeClassificationEnabled` — LLM classifies each fact's scope. */\n readonly extractionScopeClassification: boolean;\n /** `extractionJudgeEnabled` — LLM-as-judge fact-worthiness gate. */\n readonly extractionJudge: boolean;\n /** `extractionDedupeEnabled` — dedupe against recent extractions. */\n readonly extractionDedupe: boolean;\n /** `extractionTelemetryPrefilterEnabled` — skip mechanical-telemetry transcripts. */\n readonly extractionTelemetryPrefilter: boolean;\n /** `extractionJudgeTelemetryEnabled` — collect judge verdict telemetry. */\n readonly extractionJudgeTelemetry: boolean;\n /** `embeddingFallbackEnabled` — semantic-dedup / archive-search embedding fallback. */\n readonly embeddingFallback: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveMemoryLifecycleCapabilities}.\n */\nexport type MemoryLifecycleConfigProjection = Pick<\n PluginConfig,\n | \"temporalSupersessionEnabled\"\n | \"temporalMemoryTreeEnabled\"\n | \"lifecyclePolicyEnabled\"\n | \"lifecycleFilterStaleEnabled\"\n | \"lifecycleMetricsEnabled\"\n | \"extractionScopeClassificationEnabled\"\n | \"extractionJudgeEnabled\"\n | \"extractionDedupeEnabled\"\n | \"extractionTelemetryPrefilterEnabled\"\n | \"extractionJudgeTelemetryEnabled\"\n | \"embeddingFallbackEnabled\"\n>;\n\n/**\n * Resolve the {@link MemoryLifecycleCapabilitySet} from parsed config.\n *\n * Call this ONCE per write / recall-filter / maintenance operation entry and\n * thread the result down — exactly the pattern {@link resolveCapabilities}\n * established for recall.\n */\nexport function resolveMemoryLifecycleCapabilities(\n config: MemoryLifecycleConfigProjection,\n): MemoryLifecycleCapabilitySet {\n return Object.freeze({\n temporalSupersession: config.temporalSupersessionEnabled,\n temporalMemoryTree: config.temporalMemoryTreeEnabled,\n lifecyclePolicy: config.lifecyclePolicyEnabled,\n lifecycleFilterStale: config.lifecycleFilterStaleEnabled,\n lifecycleMetrics: config.lifecycleMetricsEnabled,\n extractionScopeClassification: config.extractionScopeClassificationEnabled,\n extractionJudge: config.extractionJudgeEnabled,\n extractionDedupe: config.extractionDedupeEnabled,\n extractionTelemetryPrefilter: config.extractionTelemetryPrefilterEnabled,\n extractionJudgeTelemetry: config.extractionJudgeTelemetryEnabled,\n embeddingFallback: config.embeddingFallbackEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Indexing capability set (issue #1523 batch 4).\n//\n// The flags below gate query-aware indexing (temporal/tag index build +\n// prefilter) and the conversation index (QMD/FAISS backend selection). They\n// are read on the recall path, the extraction/persist path, and the\n// maintenance/invalidation path — so they get their own projection resolved\n// ONCE at each operation entry that reads them.\n//\n// Every field projects from an already-resolved PluginConfig boolean (defaults\n// applied at the parse boundary), so the resolver is a pure projection.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of indexing feature gates (issue #1523 batch 4).\n *\n * Resolved once per recall / extraction / maintenance operation and threaded\n * down. Composition lives ONLY in {@link resolveIndexingCapabilities}.\n */\nexport interface IndexingCapabilitySet {\n /** `queryAwareIndexingEnabled` — build + use temporal/tag index for recall prefilter. */\n readonly queryAwareIndexing: boolean;\n /** `conversationIndexEnabled` — conversation-index backend (QMD / FAISS). */\n readonly conversationIndex: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveIndexingCapabilities}.\n */\nexport type IndexingConfigProjection = Pick<\n PluginConfig,\n \"queryAwareIndexingEnabled\" | \"conversationIndexEnabled\"\n>;\n\n/**\n * Resolve the {@link IndexingCapabilitySet} from parsed config.\n *\n * Call this ONCE per recall / extraction / maintenance operation entry and\n * thread the result down — exactly the pattern {@link resolveCapabilities}\n * established for recall.\n */\nexport function resolveIndexingCapabilities(\n config: IndexingConfigProjection,\n): IndexingCapabilitySet {\n return Object.freeze({\n queryAwareIndexing: config.queryAwareIndexingEnabled,\n conversationIndex: config.conversationIndexEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Creation-memory capability set (issue #1523 batch 4).\n//\n// The flags below gate the creation-memory subsystem: resume-bundle handoff,\n// commitment ledger, commitment lifecycle, and the master creation-memory\n// switch. They are read on the extraction/persist path, the recall\n// enrichment path, and the CLI command surface — so they get their own\n// projection resolved ONCE at each operation entry that reads them.\n//\n// Every field projects from an already-resolved PluginConfig boolean (defaults\n// applied at the parse boundary), so the resolver is a pure projection.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of creation-memory feature gates (issue #1523 batch 4).\n *\n * Resolved once per creation-memory operation (CLI command, extraction,\n * recall enrichment) and threaded down. Composition lives ONLY in\n * {@link resolveCreationMemoryCapabilities}.\n */\nexport interface CreationMemoryCapabilitySet {\n /** `creationMemoryEnabled` — master switch for creation-memory subsystem. */\n readonly creationMemory: boolean;\n /** `commitmentLedgerEnabled` — commitment-ledger read/write. */\n readonly commitmentLedger: boolean;\n /** `resumeBundlesEnabled` — resume-bundle handoff bundles. */\n readonly resumeBundles: boolean;\n /** `commitmentLifecycleEnabled` — commitment lifecycle (promotion / decay). */\n readonly commitmentLifecycle: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveCreationMemoryCapabilities}.\n */\nexport type CreationMemoryConfigProjection = Pick<\n PluginConfig,\n | \"creationMemoryEnabled\"\n | \"commitmentLedgerEnabled\"\n | \"resumeBundlesEnabled\"\n | \"commitmentLifecycleEnabled\"\n>;\n\n/**\n * Resolve the {@link CreationMemoryCapabilitySet} from parsed config.\n *\n * Call this ONCE per creation-memory operation entry and thread the result\n * down — exactly the pattern {@link resolveCapabilities} established for\n * recall.\n */\nexport function resolveCreationMemoryCapabilities(\n config: CreationMemoryConfigProjection,\n): CreationMemoryCapabilitySet {\n return Object.freeze({\n creationMemory: config.creationMemoryEnabled,\n commitmentLedger: config.commitmentLedgerEnabled,\n resumeBundles: config.resumeBundlesEnabled,\n commitmentLifecycle: config.commitmentLifecycleEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Namespace capability set (issue #1523 batch 5).\n//\n// `namespacesEnabled` is the single most-scattered config flag in the codebase\n// (101 read sites outside config.ts across 18 files — orchestrator, access-service,\n// namespace modules, maintenance, CLI, admin). It gates whether the multi-namespace\n// system is active at all: every namespace resolution, storage path, recall budget,\n// and maintenance fanout checks it. Like the other projections above it gets its own\n// resolver invoked ONCE per operation entry rather than re-derived at each site.\n//\n// The field is a non-optional boolean in PluginConfig, so no coercion is needed.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of namespace feature gates (issue #1523 batch 5).\n *\n * Every field is `readonly boolean`. Composition lives ONLY in\n * {@link resolveNamespaceCapabilities}.\n */\nexport interface NamespaceCapabilitySet {\n /** `namespacesEnabled` — multi-namespace system master switch. */\n readonly namespaces: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveNamespaceCapabilities}.\n */\nexport type NamespaceConfigProjection = Pick<PluginConfig, \"namespacesEnabled\">;\n\n/**\n * Resolve the {@link NamespaceCapabilitySet} from parsed config.\n *\n * Call this ONCE at operation entry and thread the result down. The flag is a\n * non-optional boolean so the projection is a pure pass-through.\n */\nexport function resolveNamespaceCapabilities(\n config: NamespaceConfigProjection,\n): NamespaceCapabilitySet {\n return Object.freeze({\n namespaces: config.namespacesEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// QMD capability set (issue #1523 batch 6).\n//\n// The twelve QMD (query-managed database) flags are the largest remaining\n// scattered cluster after batch 5. They gate every aspect of the tiered\n// memory system: master switch, tier migration, cold tier, daemon, auto-embed,\n// maintenance, query rerank, intent hints, explain, auto-upgrade, and parity\n// graph. Read sites span orchestrator, operator-toolkit, access-service, and\n// search/factory. All flags are non-optional booleans on PluginConfig (defaults\n// resolved at the parse boundary), so the projection is pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of QMD feature gates (issue #1523 batch 6).\n *\n * Every field is `readonly boolean`. Composition lives ONLY in\n * {@link resolveQmdCapabilities}.\n */\nexport interface QmdCapabilitySet {\n /** `qmdEnabled` — QMD tiered-memory master switch. */\n readonly qmd: boolean;\n /** `qmdTierMigrationEnabled` — automatic tier promotion/demotion. */\n readonly qmdTierMigration: boolean;\n /** `qmdTierAutoBackfillEnabled` — backfill stale tier entries. */\n readonly qmdTierAutoBackfill: boolean;\n /** `qmdAutoEmbedEnabled` — auto-embed documents on write. */\n readonly qmdAutoEmbed: boolean;\n /** `qmdMaintenanceEnabled` — QMD maintenance pass runner. */\n readonly qmdMaintenance: boolean;\n /** `qmdColdTierEnabled` — cold-tier storage. */\n readonly qmdColdTier: boolean;\n /** `qmdDaemonEnabled` — background QMD daemon. */\n readonly qmdDaemon: boolean;\n /** `qmdTierParityGraphEnabled` — tier parity graph. */\n readonly qmdTierParityGraph: boolean;\n /** `qmdQueryRerankEnabled` — QMD query reranking. */\n readonly qmdQueryRerank: boolean;\n /** `qmdIntentHintsEnabled` — QMD intent hint extraction. */\n readonly qmdIntentHints: boolean;\n /** `qmdExplainEnabled` — QMD explain output. */\n readonly qmdExplain: boolean;\n /** `qmdAutoUpgradeEnabled` — QMD auto-upgrade tiers. */\n readonly qmdAutoUpgrade: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveQmdCapabilities}.\n */\nexport type QmdConfigProjection = Pick<\n PluginConfig,\n | \"qmdEnabled\"\n | \"qmdTierMigrationEnabled\"\n | \"qmdTierAutoBackfillEnabled\"\n | \"qmdAutoEmbedEnabled\"\n | \"qmdMaintenanceEnabled\"\n | \"qmdColdTierEnabled\"\n | \"qmdDaemonEnabled\"\n | \"qmdTierParityGraphEnabled\"\n | \"qmdQueryRerankEnabled\"\n | \"qmdIntentHintsEnabled\"\n | \"qmdExplainEnabled\"\n | \"qmdAutoUpgradeEnabled\"\n>;\n\n/**\n * Resolve the {@link QmdCapabilitySet} from parsed config.\n *\n * Call this ONCE at operation entry and thread the result down. Eleven flags\n * are non-optional booleans (pure pass-through); `qmdColdTierEnabled` is\n * optional and coerced with `=== true` (matching the pre-migration call sites).\n */\nexport function resolveQmdCapabilities(config: QmdConfigProjection): QmdCapabilitySet {\n return Object.freeze({\n qmd: config.qmdEnabled,\n qmdTierMigration: config.qmdTierMigrationEnabled,\n qmdTierAutoBackfill: config.qmdTierAutoBackfillEnabled,\n qmdAutoEmbed: config.qmdAutoEmbedEnabled,\n qmdMaintenance: config.qmdMaintenanceEnabled,\n qmdColdTier: config.qmdColdTierEnabled === true,\n qmdDaemon: config.qmdDaemonEnabled,\n qmdTierParityGraph: config.qmdTierParityGraphEnabled,\n qmdQueryRerank: config.qmdQueryRerankEnabled,\n qmdIntentHints: config.qmdIntentHintsEnabled,\n qmdExplain: config.qmdExplainEnabled,\n qmdAutoUpgrade: config.qmdAutoUpgradeEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Identity-continuity capability set (issue #1523 batch 6).\n//\n// `identityContinuityEnabled` gates the identity/continuity system (agent\n// identity tracking, continuity incident logging). Its 13 read sites span\n// orchestrator, access-service, and CLI. The flag is a non-optional boolean\n// on PluginConfig, so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of identity-continuity feature gates (issue #1523 batch 6).\n */\nexport interface IdentityContinuityCapabilitySet {\n /** `identityContinuityEnabled` — identity-continuity master switch. */\n readonly identityContinuity: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveIdentityContinuityCapabilities}.\n */\nexport type IdentityContinuityConfigProjection = Pick<PluginConfig, \"identityContinuityEnabled\">;\n\n/**\n * Resolve the {@link IdentityContinuityCapabilitySet} from parsed config.\n */\nexport function resolveIdentityContinuityCapabilities(\n config: IdentityContinuityConfigProjection,\n): IdentityContinuityCapabilitySet {\n return Object.freeze({\n identityContinuity: config.identityContinuityEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Local-LLM capability set (issue #1523 batch 6).\n//\n// `localLlmEnabled` gates whether a local (on-device) LLM is used for\n// summarization, embedding fallback, extraction, and search. Its 11 read\n// sites span orchestrator, extraction, embedding-fallback, local-llm,\n// search/embed-helper, and summarizer. The flag is a non-optional boolean.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of local-LLM feature gates (issue #1523 batch 6).\n */\nexport interface LocalLlmCapabilitySet {\n /** `localLlmEnabled` — local (on-device) LLM master switch. */\n readonly localLlm: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveLocalLlmCapabilities}.\n */\nexport type LocalLlmConfigProjection = Pick<PluginConfig, \"localLlmEnabled\">;\n\n/**\n * Resolve the {@link LocalLlmCapabilitySet} from parsed config.\n */\nexport function resolveLocalLlmCapabilities(\n config: LocalLlmConfigProjection,\n): LocalLlmCapabilitySet {\n return Object.freeze({\n localLlm: config.localLlmEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Security capability set (issue #1523 batch 7).\n//\n// The four security/trust-zone flags gate quarantine promotion, poisoning\n// defense, and trust-zone recall. Read sites span orchestrator, access-service,\n// CLI, and research-status commands. All flags are non-optional booleans on\n// PluginConfig (defaults resolved at the parse boundary), so the projection is\n// a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of security/trust-zone feature gates (issue #1523 batch 7).\n */\nexport interface SecurityCapabilitySet {\n /** `trustZonesEnabled` — master switch for trust-zone enforcement. */\n readonly trustZones: boolean;\n /** `quarantinePromotionEnabled` — promote quarantined memories after review. */\n readonly quarantinePromotion: boolean;\n /** `memoryPoisoningDefenseEnabled` — detect and defend against memory poisoning. */\n readonly memoryPoisoningDefense: boolean;\n /** `trustZoneRecallEnabled` — restrict recall to trusted zones. */\n readonly trustZoneRecall: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveSecurityCapabilities}.\n */\nexport type SecurityConfigProjection = Pick<\n PluginConfig,\n \"trustZonesEnabled\" | \"quarantinePromotionEnabled\" | \"memoryPoisoningDefenseEnabled\" | \"trustZoneRecallEnabled\"\n>;\n\n/**\n * Resolve the {@link SecurityCapabilitySet} from parsed config.\n */\nexport function resolveSecurityCapabilities(config: SecurityConfigProjection): SecurityCapabilitySet {\n return Object.freeze({\n trustZones: config.trustZonesEnabled,\n quarantinePromotion: config.quarantinePromotionEnabled,\n memoryPoisoningDefense: config.memoryPoisoningDefenseEnabled,\n trustZoneRecall: config.trustZoneRecallEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Eval/benchmark capability set (issue #1523 batch 7).\n//\n// The five eval/benchmark flags gate the evaluation harness, shadow mode,\n// baseline snapshot management, delta reporting, and red-team benchmarking.\n// Read sites span orchestrator, CLI, and operator-toolkit. All flags are\n// non-optional booleans on PluginConfig.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of eval/benchmark feature gates (issue #1523 batch 7).\n */\nexport interface EvalCapabilitySet {\n /** `evalHarnessEnabled` — master switch for the eval harness. */\n readonly evalHarness: boolean;\n /** `evalShadowModeEnabled` — run evaluations in shadow mode. */\n readonly evalShadowMode: boolean;\n /** `benchmarkBaselineSnapshotsEnabled` — manage baseline snapshots. */\n readonly benchmarkBaselineSnapshots: boolean;\n /** `benchmarkDeltaReporterEnabled` — report benchmark deltas. */\n readonly benchmarkDeltaReporter: boolean;\n /** `memoryRedTeamBenchEnabled` — red-team benchmarking of memory. */\n readonly memoryRedTeamBench: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveEvalCapabilities}.\n */\nexport type EvalConfigProjection = Pick<\n PluginConfig,\n \"evalHarnessEnabled\" | \"evalShadowModeEnabled\" | \"benchmarkBaselineSnapshotsEnabled\" | \"benchmarkDeltaReporterEnabled\" | \"memoryRedTeamBenchEnabled\"\n>;\n\n/**\n * Resolve the {@link EvalCapabilitySet} from parsed config.\n */\nexport function resolveEvalCapabilities(config: EvalConfigProjection): EvalCapabilitySet {\n return Object.freeze({\n evalHarness: config.evalHarnessEnabled,\n evalShadowMode: config.evalShadowModeEnabled,\n benchmarkBaselineSnapshots: config.benchmarkBaselineSnapshotsEnabled,\n benchmarkDeltaReporter: config.benchmarkDeltaReporterEnabled,\n memoryRedTeamBench: config.memoryRedTeamBenchEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Utility-learning capability set (issue #1523 batch 7).\n//\n// The two utility-learning flags gate memory utility learning and\n// promotion-by-outcome. Read sites span orchestrator, CLI research-status\n// commands, and maintenance files. Both flags are non-optional booleans.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of utility-learning feature gates (issue #1523 batch 7).\n */\nexport interface UtilityLearningCapabilitySet {\n /** `memoryUtilityLearningEnabled` — learn memory utility weights from outcomes. */\n readonly memoryUtilityLearning: boolean;\n /** `promotionByOutcomeEnabled` — promote memories by outcome tracking. */\n readonly promotionByOutcome: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveUtilityLearningCapabilities}.\n */\nexport type UtilityLearningConfigProjection = Pick<\n PluginConfig,\n \"memoryUtilityLearningEnabled\" | \"promotionByOutcomeEnabled\"\n>;\n\n/**\n * Resolve the {@link UtilityLearningCapabilitySet} from parsed config.\n */\nexport function resolveUtilityLearningCapabilities(config: UtilityLearningConfigProjection): UtilityLearningCapabilitySet {\n return Object.freeze({\n memoryUtilityLearning: config.memoryUtilityLearningEnabled,\n promotionByOutcome: config.promotionByOutcomeEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Objective-state capability set (issue #1523 batch 7).\n//\n// The three objective-state flags gate objective-state memory, snapshot\n// writes, and recall. Read sites span orchestrator, access-service, CLI\n// creation-ledger commands, and research-status commands. All flags are\n// non-optional booleans.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of objective-state feature gates (issue #1523 batch 7).\n */\nexport interface ObjectiveStateCapabilitySet {\n /** `objectiveStateMemoryEnabled` — store objective-state memories. */\n readonly objectiveStateMemory: boolean;\n /** `objectiveStateSnapshotWritesEnabled` — write objective-state snapshots. */\n readonly objectiveStateSnapshotWrites: boolean;\n /** `objectiveStateRecallEnabled` — recall objective-state memories. */\n readonly objectiveStateRecall: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveObjectiveStateCapabilities}.\n */\nexport type ObjectiveStateConfigProjection = Pick<\n PluginConfig,\n \"objectiveStateMemoryEnabled\" | \"objectiveStateSnapshotWritesEnabled\" | \"objectiveStateRecallEnabled\"\n>;\n\n/**\n * Resolve the {@link ObjectiveStateCapabilitySet} from parsed config.\n */\nexport function resolveObjectiveStateCapabilities(config: ObjectiveStateConfigProjection): ObjectiveStateCapabilitySet {\n return Object.freeze({\n objectiveStateMemory: config.objectiveStateMemoryEnabled,\n objectiveStateSnapshotWrites: config.objectiveStateSnapshotWritesEnabled,\n objectiveStateRecall: config.objectiveStateRecallEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Compression capability set (issue #1523 batch 7).\n//\n// The three compression flags gate guideline learning, semantic refinement,\n// and context-compression actions. Read sites span orchestrator,\n// access-service, and the compression-guideline coordinator. All flags are\n// non-optional booleans.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of compression feature gates (issue #1523 batch 7).\n */\nexport interface CompressionCapabilitySet {\n /** `compressionGuidelineLearningEnabled` — learn compression guidelines. */\n readonly compressionGuidelineLearning: boolean;\n /** `compressionGuidelineSemanticRefinementEnabled` — semantically refine guidelines. */\n readonly compressionGuidelineSemanticRefinement: boolean;\n /** `contextCompressionActionsEnabled` — apply context-compression actions. */\n readonly contextCompressionActions: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveCompressionCapabilities}.\n */\nexport type CompressionConfigProjection = Pick<\n PluginConfig,\n \"compressionGuidelineLearningEnabled\" | \"compressionGuidelineSemanticRefinementEnabled\" | \"contextCompressionActionsEnabled\"\n>;\n\n/**\n * Resolve the {@link CompressionCapabilitySet} from parsed config.\n */\nexport function resolveCompressionCapabilities(config: CompressionConfigProjection): CompressionCapabilitySet {\n return Object.freeze({\n compressionGuidelineLearning: config.compressionGuidelineLearningEnabled,\n compressionGuidelineSemanticRefinement: config.compressionGuidelineSemanticRefinementEnabled,\n contextCompressionActions: config.contextCompressionActionsEnabled,\n });\n}\n"],"mappings":";AA8EO,SAAS,oBAAoB,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AAO;AAAA,IACnB,aAAa,OAAO;AAAA,IACpB,gBAAgB,OAAO;AAAA,IACvB,4BAA4B,OAAO;AAAA,IACnC,wBAAwB,OAAO;AAAA,IAC/B,oBAAoB,OAAO;AAAA,EAC7B,CAAC;AACH;AA+BO,SAAS,mCAAmC,QAAuE;AACxH,SAAO,OAAO,OAAO;AAAA,IACnB,uBAAuB,OAAO;AAAA,IAC9B,oBAAoB,OAAO;AAAA,EAC7B,CAAC;AACH;AAkCO,SAAS,kCAAkC,QAAqE;AACrH,SAAO,OAAO,OAAO;AAAA,IACnB,sBAAsB,OAAO;AAAA,IAC7B,8BAA8B,OAAO;AAAA,IACrC,sBAAsB,OAAO;AAAA,EAC/B,CAAC;AACH;AAkCO,SAAS,+BAA+B,QAA+D;AAC5G,SAAO,OAAO,OAAO;AAAA,IACnB,8BAA8B,OAAO;AAAA,IACrC,wCAAwC,OAAO;AAAA,IAC/C,2BAA2B,OAAO;AAAA,EACpC,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../src/capabilities.ts"],"sourcesContent":["/**\n * CapabilitySet — recall-operation feature gates resolved once, then threaded.\n *\n * Issue #1523 (Phase 1 of epic #1520). Root cause this addresses: 161+\n * scattered `config.<flag>Enabled` reads mean each gate is re-derived at every\n * call site, and reviews keep finding parallel code paths where one branch\n * checks a gate the other forgot (CLAUDE.md rule 39 — the \"gate divergence\"\n * defect class). The fix is to resolve a frozen capability projection ONCE at\n * the top of the recall operation and pass it down explicitly.\n *\n * Scope of THIS module (first migration PR): only the recall-operation-scoped\n * flags below. Flags that are also read in graph construction, writes, CLI, or\n * the summarizer are deliberately deferred to a follow-up so we never leave a\n * single flag half-migrated (some sites on `caps.`, some on `config.`).\n *\n * Field naming: each field is the config flag name with the trailing `Enabled`\n * removed (`recallMmrEnabled` → `recallMmr`).\n *\n * This is plumbing, not a feature — there is deliberately NO `enabled` gate for\n * the CapabilitySet itself (rule 30 governs behavior changes; resolving and\n * threading a capability projection must stay behavior-preserving).\n */\n\nimport type { PluginConfig } from \"./types.js\";\n\n/**\n * Frozen projection of recall-operation feature gates.\n *\n * Every field is `readonly boolean`. The composition that maps a config flag to\n * a capability (including default-when-undefined semantics for optional flags)\n * lives ONLY in {@link resolveCapabilities} — call sites must read the\n * capability, never re-derive it from raw config.\n */\nexport interface CapabilitySet {\n /** `rerankCacheEnabled` — cache reranker scores across recall passes. */\n readonly rerankCache: boolean;\n /** `recallDirectAnswerEnabled` — observation-mode direct-answer tier. */\n readonly recallDirectAnswer: boolean;\n /** `recallMemoryWorthFilterEnabled` — Memory-Worth score reweighting. */\n readonly recallMemoryWorthFilter: boolean;\n /** `trustScoreEnabled` — unified TrustScore recall stage (issue #1577). */\n readonly recallTrustScore: boolean;\n /** `recallMmrEnabled` — maximal-marginal-relevance diversification. */\n readonly recallMmr: boolean;\n /** `recallReasoningTraceBoostEnabled` — boost reasoning-trace memories. */\n readonly recallReasoningTraceBoost: boolean;\n /** `recallPlannerLlmEnabled` — LLM-backed recall-mode planner. */\n readonly recallPlannerLlm: boolean;\n /** `recallPlannerEnabled` — recall-mode planner (heuristic + optional LLM). */\n readonly recallPlanner: boolean;\n /** `recallConfidenceGateEnabled` — Synapse-style confidence gate. */\n readonly recallConfidenceGate: boolean;\n /** `graphRecallEnabled` — graph-mode recall tier (gates planner graph mode). */\n readonly graphRecall: boolean;\n /** `graphAssistInFullModeEnabled` — graph-assist overlay in full mode. */\n readonly graphAssistInFullMode: boolean;\n /** `graphExpandedIntentEnabled` — promote broad-intent asks to graph mode. */\n readonly graphExpandedIntent: boolean;\n // --- Issue #1566 Cluster C: mixed-operation flags (recall + summarizer/CLI/writes) ---\n /** `rerankEnabled` — optional LLM reranking of recall candidates. */\n readonly rerank: boolean;\n /** `harmonicRetrievalEnabled` — abstraction-node harmonic retrieval tier. */\n readonly harmonicRetrieval: boolean;\n /** `parallelRetrievalEnabled` — three-agent parallel retrieval (DirectFact + Contextual + Temporal). */\n readonly parallelRetrieval: boolean;\n}\n\n/**\n * Resolve the recall-operation {@link CapabilitySet} from parsed config.\n *\n * Call this ONCE per recall operation (at the `recall()` / `recallInternal`\n * entry) and thread the result down. Composition lives here and only here.\n *\n * Session toggles are intentionally not a parameter yet: `session-toggles.ts`\n * is agent-scoped (per session/agent enable-disable of the whole plugin), not\n * flag-scoped — none of the flags projected here have a per-session override,\n * so there is nothing for a toggle argument to compose at this layer.\n */\nexport function resolveCapabilities(config: PluginConfig): CapabilitySet {\n return Object.freeze({\n rerankCache: config.rerankCacheEnabled,\n recallDirectAnswer: config.recallDirectAnswerEnabled,\n recallMemoryWorthFilter: config.recallMemoryWorthFilterEnabled,\n // Issue #1577: TrustScore subsumes the Memory Worth multiplier when on;\n // the orchestrator runs exactly one of the two (mutual exclusion, rule 39).\n recallTrustScore: config.trustScoreEnabled === true,\n recallMmr: config.recallMmrEnabled,\n recallReasoningTraceBoost: config.recallReasoningTraceBoostEnabled,\n recallPlannerLlm: config.recallPlannerLlmEnabled,\n recallPlanner: config.recallPlannerEnabled,\n recallConfidenceGate: config.recallConfidenceGateEnabled,\n graphRecall: config.graphRecallEnabled,\n // Optional flags: preserve the exact default-when-undefined semantics the\n // migrated call sites used (`!== false` = default-on, `=== true` = default-off).\n graphAssistInFullMode: config.graphAssistInFullModeEnabled !== false,\n graphExpandedIntent: config.graphExpandedIntentEnabled === true,\n // Issue #1566 Cluster C: mixed-operation flags resolved once per recall op.\n rerank: config.rerankEnabled,\n harmonicRetrieval: config.harmonicRetrievalEnabled,\n parallelRetrieval: config.parallelRetrievalEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Graph-construction capability set (issue #1566 Cluster A).\n//\n// The recall CapabilitySet above covers flags whose EVERY read site lives on\n// the recall call chain. The five flags below are read on graph-construction,\n// write/extraction, AND recall paths — so they cannot join the recall set\n// without leaving some sites on `caps.` and others on `config.` (the exact\n// divergence #1523 forbade). They get their own projection, resolved at graph\n// build/write entry (and alongside `caps` when recall reads them).\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of graph-construction feature gates.\n *\n * Every field is `readonly boolean`. Composition (including default-when-\n * undefined semantics for the optional `graphWriteSessionAdjacencyEnabled`)\n * lives ONLY in {@link resolveGraphConstructionCapabilities}.\n */\nexport interface GraphConstructionCapabilitySet {\n /** `entityGraphEnabled` — maintain entity co-reference graph edges. */\n readonly entityGraph: boolean;\n /** `timeGraphEnabled` — maintain thread-adjacency graph edges. */\n readonly timeGraph: boolean;\n /** `causalGraphEnabled` — maintain causal-language graph edges. */\n readonly causalGraph: boolean;\n /** `multiGraphMemoryEnabled` — master switch for multi-graph writes/traversal. */\n readonly multiGraphMemory: boolean;\n /** `graphWriteSessionAdjacencyEnabled` — session-adjacency fallback for time edges (default-on). */\n readonly graphWriteSessionAdjacency: boolean;\n}\n\n/**\n * Resolve the {@link GraphConstructionCapabilitySet} from parsed config.\n *\n * Call this ONCE at graph build/write entry (extraction, recall graph\n * expansion, graph-health/repair) and thread the result down — exactly the\n * pattern {@link resolveCapabilities} established for recall.\n */\nexport type GraphConstructionConfigProjection = Pick<\n PluginConfig,\n | \"entityGraphEnabled\"\n | \"timeGraphEnabled\"\n | \"causalGraphEnabled\"\n | \"multiGraphMemoryEnabled\"\n | \"graphWriteSessionAdjacencyEnabled\"\n>;\n\nexport function resolveGraphConstructionCapabilities(\n config: GraphConstructionConfigProjection,\n): GraphConstructionCapabilitySet {\n return Object.freeze({\n entityGraph: config.entityGraphEnabled,\n timeGraph: config.timeGraphEnabled,\n causalGraph: config.causalGraphEnabled,\n multiGraphMemory: config.multiGraphMemoryEnabled,\n // Optional flag: preserve the exact default-when-undefined semantics the\n // migrated call site used (`!== false` = default-on).\n graphWriteSessionAdjacency: config.graphWriteSessionAdjacencyEnabled !== false,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Access-setup capability set (issue #1566 Cluster B).\n//\n// These two flags gate cross-namespace recall budgeting and anomaly-detection\n// auditing. Resolved once at access-service handler entry (and the operator\n// doctor check) rather than re-derived from raw config at each site.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of access-setup feature gates (issue #1566 Cluster B).\n *\n * Every field is `readonly boolean`. Composition (including the default-off\n * semantics for the optional `recallAuditAnomalyDetectionEnabled`) lives ONLY\n * in {@link resolveAccessSetupCapabilities}.\n */\nexport interface AccessSetupCapabilitySet {\n /** `recallCrossNamespaceBudgetEnabled` — rolling cross-namespace recall budget. */\n readonly recallCrossNamespaceBudget: boolean;\n /** `recallAuditAnomalyDetectionEnabled` — access-audit anomaly detection (default-off). */\n readonly recallAuditAnomalyDetection: boolean;\n}\n\n/**\n * Resolve the {@link AccessSetupCapabilitySet} from parsed config.\n *\n * Call this ONCE at access-service handler entry and thread the result down.\n */\nexport type AccessSetupConfigProjection = Pick<\n PluginConfig,\n \"recallCrossNamespaceBudgetEnabled\" | \"recallAuditAnomalyDetectionEnabled\"\n>;\n\nexport function resolveAccessSetupCapabilities(\n config: AccessSetupConfigProjection,\n): AccessSetupCapabilitySet {\n return Object.freeze({\n recallCrossNamespaceBudget: config.recallCrossNamespaceBudgetEnabled,\n // Optional/default-off flag: preserve `=== true` semantics.\n recallAuditAnomalyDetection: config.recallAuditAnomalyDetectionEnabled === true,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Memory-lifecycle capability set (issue #1523 batch 3).\n//\n// The flags below gate memory WRITE/EXTRACTION (extraction judge, scope\n// classification, dedupe, telemetry prefilter), temporal supersession of\n// stored facts, and the lifecycle policy pass (promotion / decay / stale\n// filtering). They are read on the persistExtraction write path, the recall\n// candidate-filter path, and the maintenance / lifecycle-pass path — so, like\n// the graph-construction set above, they get their own projection resolved\n// ONCE at each operation entry that reads them (never re-derived from raw\n// config mid-operation — the gate-divergence defect class #1523 targets).\n//\n// Every field projects from an already-resolved PluginConfig boolean (defaults\n// are applied at the config-parse boundary, rule 36), so the resolver is a\n// pure projection — no `!== false` / `=== true` re-coercion here.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of memory-lifecycle feature gates (issue #1523 batch 3).\n *\n * Resolved once per write / recall-filter / maintenance operation and threaded\n * down. Composition lives ONLY in {@link resolveMemoryLifecycleCapabilities}.\n */\nexport interface MemoryLifecycleCapabilitySet {\n /** `temporalSupersessionEnabled` — supersede stale structured facts on write, filter on recall. */\n readonly temporalSupersession: boolean;\n /** `temporalMemoryTreeEnabled` — temporal-memory-tree build + recall tier. */\n readonly temporalMemoryTree: boolean;\n /** `lifecyclePolicyEnabled` — lifecycle promotion / decay metadata pass. */\n readonly lifecyclePolicy: boolean;\n /** `lifecycleFilterStaleEnabled` — filter stale-lifecycle memories from recall. */\n readonly lifecycleFilterStale: boolean;\n /** `lifecycleMetricsEnabled` — emit lifecycle-pass metrics. */\n readonly lifecycleMetrics: boolean;\n /** `extractionScopeClassificationEnabled` — LLM classifies each fact's scope. */\n readonly extractionScopeClassification: boolean;\n /** `extractionJudgeEnabled` — LLM-as-judge fact-worthiness gate. */\n readonly extractionJudge: boolean;\n /** `extractionDedupeEnabled` — dedupe against recent extractions. */\n readonly extractionDedupe: boolean;\n /** `extractionTelemetryPrefilterEnabled` — skip mechanical-telemetry transcripts. */\n readonly extractionTelemetryPrefilter: boolean;\n /** `extractionJudgeTelemetryEnabled` — collect judge verdict telemetry. */\n readonly extractionJudgeTelemetry: boolean;\n /** `embeddingFallbackEnabled` — semantic-dedup / archive-search embedding fallback. */\n readonly embeddingFallback: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveMemoryLifecycleCapabilities}.\n */\nexport type MemoryLifecycleConfigProjection = Pick<\n PluginConfig,\n | \"temporalSupersessionEnabled\"\n | \"temporalMemoryTreeEnabled\"\n | \"lifecyclePolicyEnabled\"\n | \"lifecycleFilterStaleEnabled\"\n | \"lifecycleMetricsEnabled\"\n | \"extractionScopeClassificationEnabled\"\n | \"extractionJudgeEnabled\"\n | \"extractionDedupeEnabled\"\n | \"extractionTelemetryPrefilterEnabled\"\n | \"extractionJudgeTelemetryEnabled\"\n | \"embeddingFallbackEnabled\"\n>;\n\n/**\n * Resolve the {@link MemoryLifecycleCapabilitySet} from parsed config.\n *\n * Call this ONCE per write / recall-filter / maintenance operation entry and\n * thread the result down — exactly the pattern {@link resolveCapabilities}\n * established for recall.\n */\nexport function resolveMemoryLifecycleCapabilities(\n config: MemoryLifecycleConfigProjection,\n): MemoryLifecycleCapabilitySet {\n return Object.freeze({\n temporalSupersession: config.temporalSupersessionEnabled,\n temporalMemoryTree: config.temporalMemoryTreeEnabled,\n lifecyclePolicy: config.lifecyclePolicyEnabled,\n lifecycleFilterStale: config.lifecycleFilterStaleEnabled,\n lifecycleMetrics: config.lifecycleMetricsEnabled,\n extractionScopeClassification: config.extractionScopeClassificationEnabled,\n extractionJudge: config.extractionJudgeEnabled,\n extractionDedupe: config.extractionDedupeEnabled,\n extractionTelemetryPrefilter: config.extractionTelemetryPrefilterEnabled,\n extractionJudgeTelemetry: config.extractionJudgeTelemetryEnabled,\n embeddingFallback: config.embeddingFallbackEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Indexing capability set (issue #1523 batch 4).\n//\n// The flags below gate query-aware indexing (temporal/tag index build +\n// prefilter) and the conversation index (QMD/FAISS backend selection). They\n// are read on the recall path, the extraction/persist path, and the\n// maintenance/invalidation path — so they get their own projection resolved\n// ONCE at each operation entry that reads them.\n//\n// Every field projects from an already-resolved PluginConfig boolean (defaults\n// applied at the parse boundary), so the resolver is a pure projection.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of indexing feature gates (issue #1523 batch 4).\n *\n * Resolved once per recall / extraction / maintenance operation and threaded\n * down. Composition lives ONLY in {@link resolveIndexingCapabilities}.\n */\nexport interface IndexingCapabilitySet {\n /** `queryAwareIndexingEnabled` — build + use temporal/tag index for recall prefilter. */\n readonly queryAwareIndexing: boolean;\n /** `conversationIndexEnabled` — conversation-index backend (QMD / FAISS). */\n readonly conversationIndex: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveIndexingCapabilities}.\n */\nexport type IndexingConfigProjection = Pick<\n PluginConfig,\n \"queryAwareIndexingEnabled\" | \"conversationIndexEnabled\"\n>;\n\n/**\n * Resolve the {@link IndexingCapabilitySet} from parsed config.\n *\n * Call this ONCE per recall / extraction / maintenance operation entry and\n * thread the result down — exactly the pattern {@link resolveCapabilities}\n * established for recall.\n */\nexport function resolveIndexingCapabilities(\n config: IndexingConfigProjection,\n): IndexingCapabilitySet {\n return Object.freeze({\n queryAwareIndexing: config.queryAwareIndexingEnabled,\n conversationIndex: config.conversationIndexEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Creation-memory capability set (issue #1523 batch 4).\n//\n// The flags below gate the creation-memory subsystem: resume-bundle handoff,\n// commitment ledger, commitment lifecycle, and the master creation-memory\n// switch. They are read on the extraction/persist path, the recall\n// enrichment path, and the CLI command surface — so they get their own\n// projection resolved ONCE at each operation entry that reads them.\n//\n// Every field projects from an already-resolved PluginConfig boolean (defaults\n// applied at the parse boundary), so the resolver is a pure projection.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of creation-memory feature gates (issue #1523 batch 4).\n *\n * Resolved once per creation-memory operation (CLI command, extraction,\n * recall enrichment) and threaded down. Composition lives ONLY in\n * {@link resolveCreationMemoryCapabilities}.\n */\nexport interface CreationMemoryCapabilitySet {\n /** `creationMemoryEnabled` — master switch for creation-memory subsystem. */\n readonly creationMemory: boolean;\n /** `commitmentLedgerEnabled` — commitment-ledger read/write. */\n readonly commitmentLedger: boolean;\n /** `resumeBundlesEnabled` — resume-bundle handoff bundles. */\n readonly resumeBundles: boolean;\n /** `commitmentLifecycleEnabled` — commitment lifecycle (promotion / decay). */\n readonly commitmentLifecycle: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveCreationMemoryCapabilities}.\n */\nexport type CreationMemoryConfigProjection = Pick<\n PluginConfig,\n | \"creationMemoryEnabled\"\n | \"commitmentLedgerEnabled\"\n | \"resumeBundlesEnabled\"\n | \"commitmentLifecycleEnabled\"\n>;\n\n/**\n * Resolve the {@link CreationMemoryCapabilitySet} from parsed config.\n *\n * Call this ONCE per creation-memory operation entry and thread the result\n * down — exactly the pattern {@link resolveCapabilities} established for\n * recall.\n */\nexport function resolveCreationMemoryCapabilities(\n config: CreationMemoryConfigProjection,\n): CreationMemoryCapabilitySet {\n return Object.freeze({\n creationMemory: config.creationMemoryEnabled,\n commitmentLedger: config.commitmentLedgerEnabled,\n resumeBundles: config.resumeBundlesEnabled,\n commitmentLifecycle: config.commitmentLifecycleEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Namespace capability set (issue #1523 batch 5).\n//\n// `namespacesEnabled` is the single most-scattered config flag in the codebase\n// (101 read sites outside config.ts across 18 files — orchestrator, access-service,\n// namespace modules, maintenance, CLI, admin). It gates whether the multi-namespace\n// system is active at all: every namespace resolution, storage path, recall budget,\n// and maintenance fanout checks it. Like the other projections above it gets its own\n// resolver invoked ONCE per operation entry rather than re-derived at each site.\n//\n// The field is a non-optional boolean in PluginConfig, so no coercion is needed.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of namespace feature gates (issue #1523 batch 5).\n *\n * Every field is `readonly boolean`. Composition lives ONLY in\n * {@link resolveNamespaceCapabilities}.\n */\nexport interface NamespaceCapabilitySet {\n /** `namespacesEnabled` — multi-namespace system master switch. */\n readonly namespaces: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveNamespaceCapabilities}.\n */\nexport type NamespaceConfigProjection = Pick<PluginConfig, \"namespacesEnabled\">;\n\n/**\n * Resolve the {@link NamespaceCapabilitySet} from parsed config.\n *\n * Call this ONCE at operation entry and thread the result down. The flag is a\n * non-optional boolean so the projection is a pure pass-through.\n */\nexport function resolveNamespaceCapabilities(\n config: NamespaceConfigProjection,\n): NamespaceCapabilitySet {\n return Object.freeze({\n namespaces: config.namespacesEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// QMD capability set (issue #1523 batch 6).\n//\n// The twelve QMD (query-managed database) flags are the largest remaining\n// scattered cluster after batch 5. They gate every aspect of the tiered\n// memory system: master switch, tier migration, cold tier, daemon, auto-embed,\n// maintenance, query rerank, intent hints, explain, auto-upgrade, and parity\n// graph. Read sites span orchestrator, operator-toolkit, access-service, and\n// search/factory. All flags are non-optional booleans on PluginConfig (defaults\n// resolved at the parse boundary), so the projection is pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of QMD feature gates (issue #1523 batch 6).\n *\n * Every field is `readonly boolean`. Composition lives ONLY in\n * {@link resolveQmdCapabilities}.\n */\nexport interface QmdCapabilitySet {\n /** `qmdEnabled` — QMD tiered-memory master switch. */\n readonly qmd: boolean;\n /** `qmdTierMigrationEnabled` — automatic tier promotion/demotion. */\n readonly qmdTierMigration: boolean;\n /** `qmdTierAutoBackfillEnabled` — backfill stale tier entries. */\n readonly qmdTierAutoBackfill: boolean;\n /** `qmdAutoEmbedEnabled` — auto-embed documents on write. */\n readonly qmdAutoEmbed: boolean;\n /** `qmdMaintenanceEnabled` — QMD maintenance pass runner. */\n readonly qmdMaintenance: boolean;\n /** `qmdColdTierEnabled` — cold-tier storage. */\n readonly qmdColdTier: boolean;\n /** `qmdDaemonEnabled` — background QMD daemon. */\n readonly qmdDaemon: boolean;\n /** `qmdTierParityGraphEnabled` — tier parity graph. */\n readonly qmdTierParityGraph: boolean;\n /** `qmdQueryRerankEnabled` — QMD query reranking. */\n readonly qmdQueryRerank: boolean;\n /** `qmdIntentHintsEnabled` — QMD intent hint extraction. */\n readonly qmdIntentHints: boolean;\n /** `qmdExplainEnabled` — QMD explain output. */\n readonly qmdExplain: boolean;\n /** `qmdAutoUpgradeEnabled` — QMD auto-upgrade tiers. */\n readonly qmdAutoUpgrade: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveQmdCapabilities}.\n */\nexport type QmdConfigProjection = Pick<\n PluginConfig,\n | \"qmdEnabled\"\n | \"qmdTierMigrationEnabled\"\n | \"qmdTierAutoBackfillEnabled\"\n | \"qmdAutoEmbedEnabled\"\n | \"qmdMaintenanceEnabled\"\n | \"qmdColdTierEnabled\"\n | \"qmdDaemonEnabled\"\n | \"qmdTierParityGraphEnabled\"\n | \"qmdQueryRerankEnabled\"\n | \"qmdIntentHintsEnabled\"\n | \"qmdExplainEnabled\"\n | \"qmdAutoUpgradeEnabled\"\n>;\n\n/**\n * Resolve the {@link QmdCapabilitySet} from parsed config.\n *\n * Call this ONCE at operation entry and thread the result down. Eleven flags\n * are non-optional booleans (pure pass-through); `qmdColdTierEnabled` is\n * optional and coerced with `=== true` (matching the pre-migration call sites).\n */\nexport function resolveQmdCapabilities(config: QmdConfigProjection): QmdCapabilitySet {\n return Object.freeze({\n qmd: config.qmdEnabled,\n qmdTierMigration: config.qmdTierMigrationEnabled,\n qmdTierAutoBackfill: config.qmdTierAutoBackfillEnabled,\n qmdAutoEmbed: config.qmdAutoEmbedEnabled,\n qmdMaintenance: config.qmdMaintenanceEnabled,\n qmdColdTier: config.qmdColdTierEnabled === true,\n qmdDaemon: config.qmdDaemonEnabled,\n qmdTierParityGraph: config.qmdTierParityGraphEnabled,\n qmdQueryRerank: config.qmdQueryRerankEnabled,\n qmdIntentHints: config.qmdIntentHintsEnabled,\n qmdExplain: config.qmdExplainEnabled,\n qmdAutoUpgrade: config.qmdAutoUpgradeEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Identity-continuity capability set (issue #1523 batch 6).\n//\n// `identityContinuityEnabled` gates the identity/continuity system (agent\n// identity tracking, continuity incident logging). Its 13 read sites span\n// orchestrator, access-service, and CLI. The flag is a non-optional boolean\n// on PluginConfig, so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of identity-continuity feature gates (issue #1523 batch 6).\n */\nexport interface IdentityContinuityCapabilitySet {\n /** `identityContinuityEnabled` — identity-continuity master switch. */\n readonly identityContinuity: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveIdentityContinuityCapabilities}.\n */\nexport type IdentityContinuityConfigProjection = Pick<PluginConfig, \"identityContinuityEnabled\">;\n\n/**\n * Resolve the {@link IdentityContinuityCapabilitySet} from parsed config.\n */\nexport function resolveIdentityContinuityCapabilities(\n config: IdentityContinuityConfigProjection,\n): IdentityContinuityCapabilitySet {\n return Object.freeze({\n identityContinuity: config.identityContinuityEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Local-LLM capability set (issue #1523 batch 6).\n//\n// `localLlmEnabled` gates whether a local (on-device) LLM is used for\n// summarization, embedding fallback, extraction, and search. Its 11 read\n// sites span orchestrator, extraction, embedding-fallback, local-llm,\n// search/embed-helper, and summarizer. The flag is a non-optional boolean.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of local-LLM feature gates (issue #1523 batch 6).\n */\nexport interface LocalLlmCapabilitySet {\n /** `localLlmEnabled` — local (on-device) LLM master switch. */\n readonly localLlm: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveLocalLlmCapabilities}.\n */\nexport type LocalLlmConfigProjection = Pick<PluginConfig, \"localLlmEnabled\">;\n\n/**\n * Resolve the {@link LocalLlmCapabilitySet} from parsed config.\n */\nexport function resolveLocalLlmCapabilities(\n config: LocalLlmConfigProjection,\n): LocalLlmCapabilitySet {\n return Object.freeze({\n localLlm: config.localLlmEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Security capability set (issue #1523 batch 7).\n//\n// The four security/trust-zone flags gate quarantine promotion, poisoning\n// defense, and trust-zone recall. Read sites span orchestrator, access-service,\n// CLI, and research-status commands. All flags are non-optional booleans on\n// PluginConfig (defaults resolved at the parse boundary), so the projection is\n// a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of security/trust-zone feature gates (issue #1523 batch 7).\n */\nexport interface SecurityCapabilitySet {\n /** `trustZonesEnabled` — master switch for trust-zone enforcement. */\n readonly trustZones: boolean;\n /** `quarantinePromotionEnabled` — promote quarantined memories after review. */\n readonly quarantinePromotion: boolean;\n /** `memoryPoisoningDefenseEnabled` — detect and defend against memory poisoning. */\n readonly memoryPoisoningDefense: boolean;\n /** `trustZoneRecallEnabled` — restrict recall to trusted zones. */\n readonly trustZoneRecall: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveSecurityCapabilities}.\n */\nexport type SecurityConfigProjection = Pick<\n PluginConfig,\n \"trustZonesEnabled\" | \"quarantinePromotionEnabled\" | \"memoryPoisoningDefenseEnabled\" | \"trustZoneRecallEnabled\"\n>;\n\n/**\n * Resolve the {@link SecurityCapabilitySet} from parsed config.\n */\nexport function resolveSecurityCapabilities(config: SecurityConfigProjection): SecurityCapabilitySet {\n return Object.freeze({\n trustZones: config.trustZonesEnabled,\n quarantinePromotion: config.quarantinePromotionEnabled,\n memoryPoisoningDefense: config.memoryPoisoningDefenseEnabled,\n trustZoneRecall: config.trustZoneRecallEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Eval/benchmark capability set (issue #1523 batch 7).\n//\n// The five eval/benchmark flags gate the evaluation harness, shadow mode,\n// baseline snapshot management, delta reporting, and red-team benchmarking.\n// Read sites span orchestrator, CLI, and operator-toolkit. All flags are\n// non-optional booleans on PluginConfig.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of eval/benchmark feature gates (issue #1523 batch 7).\n */\nexport interface EvalCapabilitySet {\n /** `evalHarnessEnabled` — master switch for the eval harness. */\n readonly evalHarness: boolean;\n /** `evalShadowModeEnabled` — run evaluations in shadow mode. */\n readonly evalShadowMode: boolean;\n /** `benchmarkBaselineSnapshotsEnabled` — manage baseline snapshots. */\n readonly benchmarkBaselineSnapshots: boolean;\n /** `benchmarkDeltaReporterEnabled` — report benchmark deltas. */\n readonly benchmarkDeltaReporter: boolean;\n /** `memoryRedTeamBenchEnabled` — red-team benchmarking of memory. */\n readonly memoryRedTeamBench: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveEvalCapabilities}.\n */\nexport type EvalConfigProjection = Pick<\n PluginConfig,\n \"evalHarnessEnabled\" | \"evalShadowModeEnabled\" | \"benchmarkBaselineSnapshotsEnabled\" | \"benchmarkDeltaReporterEnabled\" | \"memoryRedTeamBenchEnabled\"\n>;\n\n/**\n * Resolve the {@link EvalCapabilitySet} from parsed config.\n */\nexport function resolveEvalCapabilities(config: EvalConfigProjection): EvalCapabilitySet {\n return Object.freeze({\n evalHarness: config.evalHarnessEnabled,\n evalShadowMode: config.evalShadowModeEnabled,\n benchmarkBaselineSnapshots: config.benchmarkBaselineSnapshotsEnabled,\n benchmarkDeltaReporter: config.benchmarkDeltaReporterEnabled,\n memoryRedTeamBench: config.memoryRedTeamBenchEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Utility-learning capability set (issue #1523 batch 7).\n//\n// The two utility-learning flags gate memory utility learning and\n// promotion-by-outcome. Read sites span orchestrator, CLI research-status\n// commands, and maintenance files. Both flags are non-optional booleans.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of utility-learning feature gates (issue #1523 batch 7).\n */\nexport interface UtilityLearningCapabilitySet {\n /** `memoryUtilityLearningEnabled` — learn memory utility weights from outcomes. */\n readonly memoryUtilityLearning: boolean;\n /** `promotionByOutcomeEnabled` — promote memories by outcome tracking. */\n readonly promotionByOutcome: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveUtilityLearningCapabilities}.\n */\nexport type UtilityLearningConfigProjection = Pick<\n PluginConfig,\n \"memoryUtilityLearningEnabled\" | \"promotionByOutcomeEnabled\"\n>;\n\n/**\n * Resolve the {@link UtilityLearningCapabilitySet} from parsed config.\n */\nexport function resolveUtilityLearningCapabilities(config: UtilityLearningConfigProjection): UtilityLearningCapabilitySet {\n return Object.freeze({\n memoryUtilityLearning: config.memoryUtilityLearningEnabled,\n promotionByOutcome: config.promotionByOutcomeEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Objective-state capability set (issue #1523 batch 7).\n//\n// The three objective-state flags gate objective-state memory, snapshot\n// writes, and recall. Read sites span orchestrator, access-service, CLI\n// creation-ledger commands, and research-status commands. All flags are\n// non-optional booleans.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of objective-state feature gates (issue #1523 batch 7).\n */\nexport interface ObjectiveStateCapabilitySet {\n /** `objectiveStateMemoryEnabled` — store objective-state memories. */\n readonly objectiveStateMemory: boolean;\n /** `objectiveStateSnapshotWritesEnabled` — write objective-state snapshots. */\n readonly objectiveStateSnapshotWrites: boolean;\n /** `objectiveStateRecallEnabled` — recall objective-state memories. */\n readonly objectiveStateRecall: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveObjectiveStateCapabilities}.\n */\nexport type ObjectiveStateConfigProjection = Pick<\n PluginConfig,\n \"objectiveStateMemoryEnabled\" | \"objectiveStateSnapshotWritesEnabled\" | \"objectiveStateRecallEnabled\"\n>;\n\n/**\n * Resolve the {@link ObjectiveStateCapabilitySet} from parsed config.\n */\nexport function resolveObjectiveStateCapabilities(config: ObjectiveStateConfigProjection): ObjectiveStateCapabilitySet {\n return Object.freeze({\n objectiveStateMemory: config.objectiveStateMemoryEnabled,\n objectiveStateSnapshotWrites: config.objectiveStateSnapshotWritesEnabled,\n objectiveStateRecall: config.objectiveStateRecallEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Compression capability set (issue #1523 batch 7).\n//\n// The three compression flags gate guideline learning, semantic refinement,\n// and context-compression actions. Read sites span orchestrator,\n// access-service, and the compression-guideline coordinator. All flags are\n// non-optional booleans.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of compression feature gates (issue #1523 batch 7).\n */\nexport interface CompressionCapabilitySet {\n /** `compressionGuidelineLearningEnabled` — learn compression guidelines. */\n readonly compressionGuidelineLearning: boolean;\n /** `compressionGuidelineSemanticRefinementEnabled` — semantically refine guidelines. */\n readonly compressionGuidelineSemanticRefinement: boolean;\n /** `contextCompressionActionsEnabled` — apply context-compression actions. */\n readonly contextCompressionActions: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveCompressionCapabilities}.\n */\nexport type CompressionConfigProjection = Pick<\n PluginConfig,\n \"compressionGuidelineLearningEnabled\" | \"compressionGuidelineSemanticRefinementEnabled\" | \"contextCompressionActionsEnabled\"\n>;\n\n/**\n * Resolve the {@link CompressionCapabilitySet} from parsed config.\n */\nexport function resolveCompressionCapabilities(config: CompressionConfigProjection): CompressionCapabilitySet {\n return Object.freeze({\n compressionGuidelineLearning: config.compressionGuidelineLearningEnabled,\n compressionGuidelineSemanticRefinement: config.compressionGuidelineSemanticRefinementEnabled,\n contextCompressionActions: config.contextCompressionActionsEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Presentation capability set (issue #1523 batch 8).\n//\n// These flags gate output formatting and presentation across the orchestrator, extraction\n// pipeline, consolidation engine, and related modules. Resolved ONCE per\n// operation entry rather than re-derived from raw config at each read site.\n// All flags are non-optional booleans on PluginConfig (defaults applied at\n// the parse boundary), so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of output formatting and presentation feature gates (issue #1523 batch 8).\n */\nexport interface PresentationCapabilitySet {\n /** `verbatimArtifactsEnabled` — verbatim-artifact rendering in recall output. */\n readonly verbatimArtifacts: boolean;\n /** `memoryBoxesEnabled` — memory-box rendering in recall output. */\n readonly memoryBoxes: boolean;\n /** `bufferSurpriseTriggerEnabled` — buffer surprise-detection trigger. */\n readonly bufferSurpriseTrigger: boolean;\n /** `threadingEnabled` — conversation threading in output. */\n readonly threading: boolean;\n /** `episodeNoteModeEnabled` — episode note-mode formatting. */\n readonly episodeNoteMode: boolean;\n /** `transcriptEnabled` — transcript-mode output. */\n readonly transcript: boolean;\n /** `entitySummaryEnabled` — entity summary generation. */\n readonly entitySummary: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolvePresentationCapabilities}.\n */\nexport type PresentationConfigProjection = Pick<\n PluginConfig,\n \"verbatimArtifactsEnabled\" |\n \"memoryBoxesEnabled\" |\n \"bufferSurpriseTriggerEnabled\" |\n \"threadingEnabled\" |\n \"episodeNoteModeEnabled\" |\n \"transcriptEnabled\" |\n \"entitySummaryEnabled\"\n>;\n\n/**\n * Resolve the {@link PresentationCapabilitySet} from parsed config.\n */\nexport function resolvePresentationCapabilities(config: PresentationConfigProjection): PresentationCapabilitySet {\n return Object.freeze({\n verbatimArtifacts: config.verbatimArtifactsEnabled,\n memoryBoxes: config.memoryBoxesEnabled,\n bufferSurpriseTrigger: config.bufferSurpriseTriggerEnabled,\n threading: config.threadingEnabled,\n episodeNoteMode: config.episodeNoteModeEnabled,\n transcript: config.transcriptEnabled,\n entitySummary: config.entitySummaryEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// Consolidation capability set (issue #1523 batch 8).\n//\n// These flags gate memory consolidation, compounding, and abstraction across the orchestrator, extraction\n// pipeline, consolidation engine, and related modules. Resolved ONCE per\n// operation entry rather than re-derived from raw config at each read site.\n// All flags are non-optional booleans on PluginConfig (defaults applied at\n// the parse boundary), so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of memory consolidation, compounding, and abstraction feature gates (issue #1523 batch 8).\n */\nexport interface ConsolidationCapabilitySet {\n /** `compoundingSemanticEnabled` — semantic compounding of memories. */\n readonly compoundingSemantic: boolean;\n /** `abstractionAnchorsEnabled` — abstraction-anchor extraction. */\n readonly abstractionAnchors: boolean;\n /** `compoundingEnabled` — master compounding switch. */\n readonly compounding: boolean;\n /** `calibrationEnabled` — memory calibration pass. */\n readonly calibration: boolean;\n /** `semanticConsolidationEnabled` — semantic consolidation pass. */\n readonly semanticConsolidation: boolean;\n /** `patternReinforcementEnabled` — pattern reinforcement in consolidation. */\n readonly patternReinforcement: boolean;\n /** `continuityAuditEnabled` — continuity audit during consolidation. */\n readonly continuityAudit: boolean;\n /** `graphEdgeDecayEnabled` — graph edge decay in maintenance. */\n readonly graphEdgeDecay: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveConsolidationCapabilities}.\n */\nexport type ConsolidationConfigProjection = Pick<\n PluginConfig,\n \"compoundingSemanticEnabled\" |\n \"abstractionAnchorsEnabled\" |\n \"compoundingEnabled\" |\n \"calibrationEnabled\" |\n \"semanticConsolidationEnabled\" |\n \"patternReinforcementEnabled\" |\n \"continuityAuditEnabled\" |\n \"graphEdgeDecayEnabled\"\n>;\n\n/**\n * Resolve the {@link ConsolidationCapabilitySet} from parsed config.\n */\nexport function resolveConsolidationCapabilities(config: ConsolidationConfigProjection): ConsolidationCapabilitySet {\n return Object.freeze({\n compoundingSemantic: config.compoundingSemanticEnabled,\n abstractionAnchors: config.abstractionAnchorsEnabled,\n compounding: config.compoundingEnabled,\n calibration: config.calibrationEnabled,\n semanticConsolidation: config.semanticConsolidationEnabled,\n patternReinforcement: config.patternReinforcementEnabled,\n continuityAudit: config.continuityAuditEnabled,\n graphEdgeDecay: config.graphEdgeDecayEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// RecallAuxiliary capability set (issue #1523 batch 8).\n//\n// These flags gate extraction pipeline details and auxiliary recall enrichment across the orchestrator, extraction\n// pipeline, consolidation engine, and related modules. Resolved ONCE per\n// operation entry rather than re-derived from raw config at each read site.\n// All flags are non-optional booleans on PluginConfig (defaults applied at\n// the parse boundary), so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of extraction pipeline details and auxiliary recall enrichment feature gates (issue #1523 batch 8).\n */\nexport interface RecallAuxiliaryCapabilitySet {\n /** `causalRuleExtractionEnabled` — causal-rule extraction in pipeline. */\n readonly causalRuleExtraction: boolean;\n /** `correctionEnabled` — memory correction subsystem. */\n readonly correction: boolean;\n /** `continuityIncidentLoggingEnabled` — continuity incident logging. */\n readonly continuityIncidentLogging: boolean;\n /** `daySummaryEnabled` — day-summary generation. */\n readonly daySummary: boolean;\n /** `versioningEnabled` — memory versioning. */\n readonly versioning: boolean;\n /** `verifiedRecallEnabled` — verified-recall tier. */\n readonly verifiedRecall: boolean;\n /** `semanticRuleVerificationEnabled` — semantic-rule verification. */\n readonly semanticRuleVerification: boolean;\n /** `workProductRecallEnabled` — work-product recall tier. */\n readonly workProductRecall: boolean;\n /** `secureStoreEnabled` — secure storage mode. */\n readonly secureStore: boolean;\n /** `knowledgeIndexEnabled` — knowledge index in recall. */\n readonly knowledgeIndex: boolean;\n /** `factDeduplicationEnabled` — fact deduplication in recall. */\n readonly factDeduplication: boolean;\n /** `compactionResetEnabled` — compaction reset on re-ingest. */\n readonly compactionReset: boolean;\n /** `entityRetrievalEnabled` — entity retrieval tier. */\n readonly entityRetrieval: boolean;\n /** `cronRecallPolicyEnabled` — cron-based recall policy. */\n readonly cronRecallPolicy: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveRecallAuxiliaryCapabilities}.\n */\nexport type RecallAuxiliaryConfigProjection = Pick<\n PluginConfig,\n \"causalRuleExtractionEnabled\" |\n \"correctionEnabled\" |\n \"continuityIncidentLoggingEnabled\" |\n \"daySummaryEnabled\" |\n \"versioningEnabled\" |\n \"verifiedRecallEnabled\" |\n \"semanticRuleVerificationEnabled\" |\n \"workProductRecallEnabled\" |\n \"secureStoreEnabled\" |\n \"knowledgeIndexEnabled\" |\n \"factDeduplicationEnabled\" |\n \"compactionResetEnabled\" |\n \"entityRetrievalEnabled\" |\n \"cronRecallPolicyEnabled\"\n>;\n\n/**\n * Resolve the {@link RecallAuxiliaryCapabilitySet} from parsed config.\n */\nexport function resolveRecallAuxiliaryCapabilities(config: RecallAuxiliaryConfigProjection): RecallAuxiliaryCapabilitySet {\n return Object.freeze({\n causalRuleExtraction: config.causalRuleExtractionEnabled,\n correction: config.correctionEnabled,\n continuityIncidentLogging: config.continuityIncidentLoggingEnabled,\n daySummary: config.daySummaryEnabled,\n versioning: config.versioningEnabled,\n verifiedRecall: config.verifiedRecallEnabled,\n semanticRuleVerification: config.semanticRuleVerificationEnabled,\n workProductRecall: config.workProductRecallEnabled,\n secureStore: config.secureStoreEnabled,\n knowledgeIndex: config.knowledgeIndexEnabled,\n factDeduplication: config.factDeduplicationEnabled,\n compactionReset: config.compactionResetEnabled,\n entityRetrieval: config.entityRetrievalEnabled,\n cronRecallPolicy: config.cronRecallPolicyEnabled,\n });\n}\n"],"mappings":";AA8EO,SAAS,oBAAoB,QAAq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C7B,YAAY,OAAO;AAAA,IACnB,2BAA2B,OAAO;AAAA,IAClC,YAAY,OAAO;AAAA,IACnB,YAAY,OAAO;AAAA,IACnB,gBAAgB,OAAO;AAAA,IACvB,0BAA0B,OAAO;AAAA,IACjC,mBAAmB,OAAO;AAAA,IAC1B,aAAa,OAAO;AAAA,IACpB,gBAAgB,OAAO;AAAA,IACvB,mBAAmB,OAAO;AAAA,IAC1B,iBAAiB,OAAO;AAAA,IACxB,iBAAiB,OAAO;AAAA,IACxB,kBAAkB,OAAO;AAAA,EAC3B,CAAC;AACH;","names":[]}
@@ -3,10 +3,10 @@ import {
3
3
  readNamespaceMaintenanceLastRanStatuses,
4
4
  readNamespaceMaintenanceStatuses,
5
5
  runNamespaceMaintenancePlan
6
- } from "./chunk-BXPG5AVX.js";
6
+ } from "./chunk-BHQQVUEQ.js";
7
7
  import {
8
8
  resolveNamespaceCapabilities
9
- } from "./chunk-JWDE7OVJ.js";
9
+ } from "./chunk-RJBW4EOU.js";
10
10
 
11
11
  // src/maintenance/namespace-maintenance-fanout.ts
12
12
  var NAMESPACE_MAINTENANCE_JOBS = [
@@ -149,4 +149,4 @@ export {
149
149
  summarizeNamespaceMaintenanceHealth,
150
150
  formatNamespaceMaintenanceHealthText
151
151
  };
152
- //# sourceMappingURL=chunk-AE7NTZ75.js.map
152
+ //# sourceMappingURL=chunk-TNLXCSXV.js.map
@@ -11,12 +11,12 @@ import {
11
11
  import {
12
12
  ALL_CATEGORY_DIRS
13
13
  } from "./chunk-VS2IYZRU.js";
14
- import {
15
- resolveNamespaceCapabilities
16
- } from "./chunk-JWDE7OVJ.js";
17
14
  import {
18
15
  isSafeRouteNamespace
19
16
  } from "./chunk-U3PN77QT.js";
17
+ import {
18
+ resolveNamespaceCapabilities
19
+ } from "./chunk-RJBW4EOU.js";
20
20
 
21
21
  // src/namespaces/storage.ts
22
22
  import path from "path";
@@ -339,4 +339,4 @@ export {
339
339
  resolveNamespaceStorageRoot,
340
340
  NamespaceStorageRouter
341
341
  };
342
- //# sourceMappingURL=chunk-NNJKEAP2.js.map
342
+ //# sourceMappingURL=chunk-VRBBZH4U.js.map
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-FVZ2ISIX.js";
4
4
  import {
5
5
  defineOperation
6
- } from "./chunk-P6VLG7KE.js";
6
+ } from "./chunk-N2O23WYA.js";
7
7
  import {
8
8
  DECISION_SUBCOMMANDS,
9
9
  DELTA_SUBCOMMANDS,
10
10
  EngramAccessInputError,
11
11
  isCodegraphToolName
12
- } from "./chunk-HLPYL6LC.js";
12
+ } from "./chunk-Y5OOHER4.js";
13
13
  import {
14
14
  CorrectionContractError
15
- } from "./chunk-WNGXQMRI.js";
15
+ } from "./chunk-WFNH4UDF.js";
16
16
 
17
17
  // src/access-operations.ts
18
18
  import { z } from "zod";
@@ -465,4 +465,4 @@ export {
465
465
  codegraphIngestTracesOperation,
466
466
  REGISTERED_OPERATIONS
467
467
  };
468
- //# sourceMappingURL=chunk-VOEVVIP3.js.map
468
+ //# sourceMappingURL=chunk-W2FBVBQ4.js.map
@@ -13,6 +13,9 @@ import {
13
13
  import {
14
14
  computeContentHash
15
15
  } from "./chunk-W5H6ZRPT.js";
16
+ import {
17
+ resolveRecallAuxiliaryCapabilities
18
+ } from "./chunk-RJBW4EOU.js";
16
19
  import {
17
20
  sanitizeMemoryContent
18
21
  } from "./chunk-5GKPFL3S.js";
@@ -1462,7 +1465,7 @@ function toExecutorMemory(m) {
1462
1465
  };
1463
1466
  }
1464
1467
  function isCorrectionFeatureEnabled(config) {
1465
- if (typeof config.correctionEnabled === "boolean") return config.correctionEnabled;
1468
+ if (typeof resolveRecallAuxiliaryCapabilities(config).correction === "boolean") return resolveRecallAuxiliaryCapabilities(config).correction;
1466
1469
  const nested = config.correction;
1467
1470
  if (nested && typeof nested.enabled === "boolean") return nested.enabled;
1468
1471
  if (nested && typeof nested.enabled === "string") return nested.enabled === "true" || nested.enabled === "1";
@@ -1883,4 +1886,4 @@ export {
1883
1886
  capturePassiveCorrections,
1884
1887
  clusterByKey
1885
1888
  };
1886
- //# sourceMappingURL=chunk-WNGXQMRI.js.map
1889
+ //# sourceMappingURL=chunk-WFNH4UDF.js.map