@remnic/core 9.3.738 → 9.3.740
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.
- package/dist/access-boundary.d.ts +6 -6
- package/dist/access-boundary.js +13 -13
- package/dist/access-cli.js +35 -35
- package/dist/access-http.d.ts +6 -6
- package/dist/access-http.js +18 -18
- package/dist/access-mcp.d.ts +6 -6
- package/dist/access-mcp.js +17 -17
- package/dist/access-operations-batch.js +15 -15
- package/dist/access-operations.d.ts +6 -6
- package/dist/access-operations.js +16 -16
- package/dist/{access-service-DwQ6BIQw.d.ts → access-service-Cbk-Kv_A.d.ts} +1 -1
- package/dist/access-service.d.ts +6 -6
- package/dist/access-service.js +12 -12
- package/dist/access-surface-catalog.d.ts +6 -6
- package/dist/active-memory-bridge.js +3 -3
- package/dist/bootstrap.d.ts +5 -5
- package/dist/briefing.js +2 -2
- package/dist/buffer.js +2 -2
- package/dist/capabilities.d.ts +97 -1
- package/dist/capabilities.js +7 -1
- package/dist/causal-consolidation.js +4 -3
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/{chunk-IFCM6OLK.js → chunk-3TUDKDTQ.js} +7 -7
- package/dist/{chunk-A7INTIC5.js → chunk-4J53ZVPQ.js} +3 -3
- package/dist/{chunk-XYUFGHUW.js → chunk-56F6EAQ6.js} +2 -2
- package/dist/{chunk-F6OEXJQQ.js → chunk-6XG3NQRC.js} +2 -2
- package/dist/{chunk-24ZLC5QN.js → chunk-7N7S2RKF.js} +2 -2
- package/dist/{chunk-Y5OOHER4.js → chunk-7Y5KKMIP.js} +12 -11
- package/dist/chunk-7Y5KKMIP.js.map +1 -0
- package/dist/{chunk-VRBBZH4U.js → chunk-AX4TRSRE.js} +3 -3
- package/dist/{chunk-66RZ4EIT.js → chunk-BE6NEQLF.js} +3 -3
- package/dist/{chunk-YF2MMBKA.js → chunk-BJPL5WAL.js} +3 -3
- package/dist/{chunk-EO5QWINU.js → chunk-C3Z5YJSM.js} +5 -2
- package/dist/chunk-C3Z5YJSM.js.map +1 -0
- package/dist/{chunk-GEXI357K.js → chunk-C7C5WIIF.js} +2 -2
- package/dist/{chunk-L3TYGUTH.js → chunk-CMPXLMC3.js} +3 -3
- package/dist/{chunk-W2FBVBQ4.js → chunk-DBVBV2RF.js} +4 -4
- package/dist/{chunk-JQSP7YBJ.js → chunk-ELL5VYXC.js} +5 -4
- package/dist/chunk-ELL5VYXC.js.map +1 -0
- package/dist/{chunk-IQOEW5YV.js → chunk-FCQ7ZYCQ.js} +2 -2
- package/dist/{chunk-IIBFCZA7.js → chunk-FWXLKH2H.js} +3 -3
- package/dist/{chunk-RJBW4EOU.js → chunk-G7Q4D2G3.js} +74 -2
- package/dist/{chunk-RJBW4EOU.js.map → chunk-G7Q4D2G3.js.map} +1 -1
- package/dist/{chunk-WVAEIKUY.js → chunk-GPX5E36D.js} +5 -4
- package/dist/chunk-GPX5E36D.js.map +1 -0
- package/dist/{chunk-23PLOBWT.js → chunk-H3WSZWHK.js} +22 -20
- package/dist/chunk-H3WSZWHK.js.map +1 -0
- package/dist/{chunk-Q6BAA57B.js → chunk-JFCS6PQU.js} +2 -2
- package/dist/chunk-JFCS6PQU.js.map +1 -0
- package/dist/{chunk-CKHPUOAP.js → chunk-K2N6WIZM.js} +3 -3
- package/dist/{chunk-BHJAMSVC.js → chunk-LD6A7XG5.js} +7 -7
- package/dist/{chunk-AKKFHN3I.js → chunk-M4WI23X3.js} +2 -2
- package/dist/{chunk-N2O23WYA.js → chunk-M5KLYHHI.js} +2 -2
- package/dist/{chunk-TNLXCSXV.js → chunk-O4IWVWSW.js} +5 -4
- package/dist/chunk-O4IWVWSW.js.map +1 -0
- package/dist/{chunk-OQQRWPFZ.js → chunk-OS5RKJOH.js} +2 -2
- package/dist/{chunk-MAU7DFCJ.js → chunk-OT5K26NG.js} +5 -4
- package/dist/chunk-OT5K26NG.js.map +1 -0
- package/dist/{chunk-DS3FZ7GS.js → chunk-OUSOMUFV.js} +2 -2
- package/dist/{chunk-7B7IPPN5.js → chunk-OVYBENIJ.js} +3 -3
- package/dist/{chunk-5RZOFIDL.js → chunk-PI4JHLDD.js} +6 -3
- package/dist/chunk-PI4JHLDD.js.map +1 -0
- package/dist/{chunk-EU543UDC.js → chunk-QCO2QFLZ.js} +7 -7
- package/dist/chunk-QCO2QFLZ.js.map +1 -0
- package/dist/{chunk-YXOXAQ5Y.js → chunk-TQQN64J2.js} +5 -4
- package/dist/chunk-TQQN64J2.js.map +1 -0
- package/dist/{chunk-WDJCZQB4.js → chunk-UGFPGWJB.js} +2 -2
- package/dist/{chunk-75PDC7VT.js → chunk-UOVDO6TC.js} +6 -5
- package/dist/chunk-UOVDO6TC.js.map +1 -0
- package/dist/{chunk-BVG2IZOB.js → chunk-USHVHI6J.js} +7 -6
- package/dist/chunk-USHVHI6J.js.map +1 -0
- package/dist/{chunk-56LP72AD.js → chunk-UYYSOMS2.js} +4 -4
- package/dist/{chunk-EKQ3LWBM.js → chunk-VC7QELR6.js} +659 -584
- package/dist/chunk-VC7QELR6.js.map +1 -0
- package/dist/{chunk-XIQAOGAA.js → chunk-WGDE2TJP.js} +7 -6
- package/dist/chunk-WGDE2TJP.js.map +1 -0
- package/dist/{chunk-UFS7OXGL.js → chunk-WHEF76BQ.js} +5 -2
- package/dist/chunk-WHEF76BQ.js.map +1 -0
- package/dist/{chunk-QTJOORGN.js → chunk-WIMKOTNY.js} +2 -2
- package/dist/{chunk-GXTYEG7Q.js → chunk-WO22UEM3.js} +2 -2
- package/dist/{chunk-BHQQVUEQ.js → chunk-X5PMDVY4.js} +6 -5
- package/dist/{chunk-BHQQVUEQ.js.map → chunk-X5PMDVY4.js.map} +1 -1
- package/dist/{chunk-C53JDEH3.js → chunk-Y62QPRKV.js} +2 -2
- package/dist/{chunk-WFNH4UDF.js → chunk-Y6PNYJVO.js} +3 -3
- package/dist/{chunk-6YKIYQU7.js → chunk-YNHRWFAP.js} +5 -2
- package/dist/{chunk-6YKIYQU7.js.map → chunk-YNHRWFAP.js.map} +1 -1
- package/dist/{cli-BlEIWDQw.d.ts → cli-BQW2xKdb.d.ts} +2 -2
- package/dist/cli.d.ts +7 -7
- package/dist/cli.js +29 -29
- package/dist/compounding/engine.js +4 -4
- package/dist/connectors/codex-materialize-runner.js +2 -2
- package/dist/connectors/index.js +4 -3
- package/dist/contradiction/index.js +2 -2
- package/dist/{contradiction-scan-CWO3LIWV.js → contradiction-scan-UERKJESC.js} +3 -3
- package/dist/day-summary.js +2 -1
- package/dist/embedding-fallback.js +2 -2
- package/dist/entity-retrieval.js +3 -3
- package/dist/explicit-capture.d.ts +5 -5
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction.js +4 -4
- package/dist/{first-start-migration-5DXD3TF2.js → first-start-migration-GQ3UQNIL.js} +2 -2
- package/dist/index.d.ts +8 -8
- package/dist/index.js +45 -45
- package/dist/local-llm.js +2 -2
- package/dist/maintenance/memory-governance.js +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +6 -6
- package/dist/namespaces/migrate.js +7 -7
- package/dist/namespaces/principal.js +2 -2
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.js +3 -3
- package/dist/operator-toolkit.js +13 -13
- package/dist/orchestration/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.js +7 -7
- package/dist/{orchestrator-CJZ21ZiB.d.ts → orchestrator-BOAFN_Yr.d.ts} +186 -56
- package/dist/orchestrator.d.ts +4 -4
- package/dist/orchestrator.js +29 -29
- package/dist/search/embed-helper.js +2 -2
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +3 -3
- package/dist/semantic-consolidation.js +4 -3
- package/dist/semantic-rule-promotion.js +2 -2
- package/dist/semantic-rule-verifier.js +2 -2
- package/dist/shared-context/manager.js +2 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/{tier-stats-QID73BBB.js → tier-stats-CSKL7BDG.js} +2 -2
- package/dist/verified-recall.js +2 -2
- package/package.json +2 -2
- package/src/access-service.ts +2 -1
- package/src/capabilities.test.ts +166 -0
- package/src/capabilities.ts +267 -0
- package/src/cli/research-status-commands.ts +2 -1
- package/src/cli.ts +3 -2
- package/src/compounding/engine.ts +2 -1
- package/src/connectors/codex-marketplace.ts +2 -1
- package/src/day-summary.ts +2 -1
- package/src/embedding-fallback.ts +2 -1
- package/src/extraction.ts +3 -2
- package/src/local-llm.ts +2 -1
- package/src/maintenance/namespace-maintenance-fanout.ts +2 -1
- package/src/maintenance/namespace-planner.ts +2 -1
- package/src/operator-toolkit.ts +1 -0
- package/src/orchestration/conversation-index-coordinator.ts +344 -0
- package/src/orchestration/recall-rerank-coordinator.ts +425 -0
- package/src/orchestration/semantic-consolidation-coordinator.ts +3 -2
- package/src/orchestrator.ts +89 -598
- package/src/search/embed-helper.ts +2 -1
- package/src/search/factory.ts +2 -1
- package/src/semantic-consolidation.ts +2 -1
- package/src/shared-context/manager.ts +3 -2
- package/src/storage.ts +1 -1
- package/src/summarizer.ts +3 -2
- package/dist/chunk-23PLOBWT.js.map +0 -1
- package/dist/chunk-5RZOFIDL.js.map +0 -1
- package/dist/chunk-75PDC7VT.js.map +0 -1
- package/dist/chunk-BVG2IZOB.js.map +0 -1
- package/dist/chunk-EKQ3LWBM.js.map +0 -1
- package/dist/chunk-EO5QWINU.js.map +0 -1
- package/dist/chunk-EU543UDC.js.map +0 -1
- package/dist/chunk-JQSP7YBJ.js.map +0 -1
- package/dist/chunk-MAU7DFCJ.js.map +0 -1
- package/dist/chunk-Q6BAA57B.js.map +0 -1
- package/dist/chunk-TNLXCSXV.js.map +0 -1
- package/dist/chunk-UFS7OXGL.js.map +0 -1
- package/dist/chunk-WVAEIKUY.js.map +0 -1
- package/dist/chunk-XIQAOGAA.js.map +0 -1
- package/dist/chunk-Y5OOHER4.js.map +0 -1
- package/dist/chunk-YXOXAQ5Y.js.map +0 -1
- /package/dist/{chunk-IFCM6OLK.js.map → chunk-3TUDKDTQ.js.map} +0 -0
- /package/dist/{chunk-A7INTIC5.js.map → chunk-4J53ZVPQ.js.map} +0 -0
- /package/dist/{chunk-XYUFGHUW.js.map → chunk-56F6EAQ6.js.map} +0 -0
- /package/dist/{chunk-F6OEXJQQ.js.map → chunk-6XG3NQRC.js.map} +0 -0
- /package/dist/{chunk-24ZLC5QN.js.map → chunk-7N7S2RKF.js.map} +0 -0
- /package/dist/{chunk-VRBBZH4U.js.map → chunk-AX4TRSRE.js.map} +0 -0
- /package/dist/{chunk-66RZ4EIT.js.map → chunk-BE6NEQLF.js.map} +0 -0
- /package/dist/{chunk-YF2MMBKA.js.map → chunk-BJPL5WAL.js.map} +0 -0
- /package/dist/{chunk-GEXI357K.js.map → chunk-C7C5WIIF.js.map} +0 -0
- /package/dist/{chunk-L3TYGUTH.js.map → chunk-CMPXLMC3.js.map} +0 -0
- /package/dist/{chunk-W2FBVBQ4.js.map → chunk-DBVBV2RF.js.map} +0 -0
- /package/dist/{chunk-IQOEW5YV.js.map → chunk-FCQ7ZYCQ.js.map} +0 -0
- /package/dist/{chunk-IIBFCZA7.js.map → chunk-FWXLKH2H.js.map} +0 -0
- /package/dist/{chunk-CKHPUOAP.js.map → chunk-K2N6WIZM.js.map} +0 -0
- /package/dist/{chunk-BHJAMSVC.js.map → chunk-LD6A7XG5.js.map} +0 -0
- /package/dist/{chunk-AKKFHN3I.js.map → chunk-M4WI23X3.js.map} +0 -0
- /package/dist/{chunk-N2O23WYA.js.map → chunk-M5KLYHHI.js.map} +0 -0
- /package/dist/{chunk-OQQRWPFZ.js.map → chunk-OS5RKJOH.js.map} +0 -0
- /package/dist/{chunk-DS3FZ7GS.js.map → chunk-OUSOMUFV.js.map} +0 -0
- /package/dist/{chunk-7B7IPPN5.js.map → chunk-OVYBENIJ.js.map} +0 -0
- /package/dist/{chunk-WDJCZQB4.js.map → chunk-UGFPGWJB.js.map} +0 -0
- /package/dist/{chunk-56LP72AD.js.map → chunk-UYYSOMS2.js.map} +0 -0
- /package/dist/{chunk-QTJOORGN.js.map → chunk-WIMKOTNY.js.map} +0 -0
- /package/dist/{chunk-GXTYEG7Q.js.map → chunk-WO22UEM3.js.map} +0 -0
- /package/dist/{chunk-C53JDEH3.js.map → chunk-Y62QPRKV.js.map} +0 -0
- /package/dist/{chunk-WFNH4UDF.js.map → chunk-Y6PNYJVO.js.map} +0 -0
- /package/dist/{contradiction-scan-CWO3LIWV.js.map → contradiction-scan-UERKJESC.js.map} +0 -0
- /package/dist/{first-start-migration-5DXD3TF2.js.map → first-start-migration-GQ3UQNIL.js.map} +0 -0
- /package/dist/{tier-stats-QID73BBB.js.map → tier-stats-CSKL7BDG.js.map} +0 -0
|
@@ -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\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,QAAqC;AACvE,SAAO,OAAO,OAAO;AAAA,IACnB,aAAa,OAAO;AAAA,IACpB,oBAAoB,OAAO;AAAA,IAC3B,yBAAyB,OAAO;A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AAgB,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":[]}
|
|
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\n// ---------------------------------------------------------------------------\n// RecallEnhancement capability set (issue #1523 batch 9).\n//\n// These 24 flags gate recall enrichment, memory reconstruction, entity\n// relationships, causal trajectory recall, CMC retrieval, and related\n// enhancement paths. Read sites span orchestrator, access-service, graph-recall,\n// and CLI research-status commands. All flags are non-optional booleans on\n// PluginConfig (defaults resolved at the parse boundary), so the projection\n// is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of recall-enhancement feature gates (issue #1523 batch 9).\n */\nexport interface RecallEnhancementCapabilitySet {\n readonly explicitCueRecall: boolean;\n readonly targetedFactRecall: boolean;\n readonly focusedListRecall: boolean;\n readonly responseGuidanceRecall: boolean;\n readonly eventOrderRecall: boolean;\n readonly reinforcementRecallBoost: boolean;\n readonly recallPlannerTelemetry: boolean;\n readonly peerProfileRecall: boolean;\n readonly graphAssistShadowEval: boolean;\n readonly memoryReconstruction: boolean;\n readonly memoryLinking: boolean;\n readonly causalTrajectoryRecall: boolean;\n readonly causalTrajectoryMemory: boolean;\n readonly cmcRetrieval: boolean;\n readonly contradictionDetection: boolean;\n readonly factArchival: boolean;\n readonly entityRelationships: boolean;\n readonly entityActivityLog: boolean;\n readonly compoundingInject: boolean;\n readonly accessTracking: boolean;\n readonly autoPromoteToShared: boolean;\n readonly recallGraph: boolean;\n readonly feedback: boolean;\n readonly identity: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveRecallEnhancementCapabilities}.\n */\nexport type RecallEnhancementConfigProjection = Pick<\n PluginConfig,\n | \"explicitCueRecallEnabled\"\n | \"targetedFactRecallEnabled\"\n | \"focusedListRecallEnabled\"\n | \"responseGuidanceRecallEnabled\"\n | \"eventOrderRecallEnabled\"\n | \"reinforcementRecallBoostEnabled\"\n | \"recallPlannerTelemetryEnabled\"\n | \"peerProfileRecallEnabled\"\n | \"graphAssistShadowEvalEnabled\"\n | \"memoryReconstructionEnabled\"\n | \"memoryLinkingEnabled\"\n | \"causalTrajectoryRecallEnabled\"\n | \"causalTrajectoryMemoryEnabled\"\n | \"cmcRetrievalEnabled\"\n | \"contradictionDetectionEnabled\"\n | \"factArchivalEnabled\"\n | \"entityRelationshipsEnabled\"\n | \"entityActivityLogEnabled\"\n | \"compoundingInjectEnabled\"\n | \"accessTrackingEnabled\"\n | \"autoPromoteToSharedEnabled\"\n | \"recallGraphEnabled\"\n | \"feedbackEnabled\"\n | \"identityEnabled\"\n>;\n\n/**\n * Resolve the {@link RecallEnhancementCapabilitySet} from parsed config.\n */\nexport function resolveRecallEnhancementCapabilities(config: RecallEnhancementConfigProjection): RecallEnhancementCapabilitySet {\n return Object.freeze({\n explicitCueRecall: config.explicitCueRecallEnabled,\n targetedFactRecall: config.targetedFactRecallEnabled,\n focusedListRecall: config.focusedListRecallEnabled,\n responseGuidanceRecall: config.responseGuidanceRecallEnabled,\n eventOrderRecall: config.eventOrderRecallEnabled,\n reinforcementRecallBoost: config.reinforcementRecallBoostEnabled,\n recallPlannerTelemetry: config.recallPlannerTelemetryEnabled,\n peerProfileRecall: config.peerProfileRecallEnabled,\n graphAssistShadowEval: config.graphAssistShadowEvalEnabled === true,\n memoryReconstruction: config.memoryReconstructionEnabled,\n memoryLinking: config.memoryLinkingEnabled,\n causalTrajectoryRecall: config.causalTrajectoryRecallEnabled,\n causalTrajectoryMemory: config.causalTrajectoryMemoryEnabled,\n cmcRetrieval: config.cmcRetrievalEnabled,\n contradictionDetection: config.contradictionDetectionEnabled,\n factArchival: config.factArchivalEnabled,\n entityRelationships: config.entityRelationshipsEnabled,\n entityActivityLog: config.entityActivityLogEnabled,\n compoundingInject: config.compoundingInjectEnabled,\n accessTracking: config.accessTrackingEnabled,\n autoPromoteToShared: config.autoPromoteToSharedEnabled,\n recallGraph: config.recallGraphEnabled,\n feedback: config.feedbackEnabled,\n identity: config.identityEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// PipelineProcessing capability set (issue #1523 batch 9).\n//\n// These 22 flags gate the extraction/chunking/summarization pipeline and LLM\n// infrastructure. Read sites span orchestrator, extraction, summarizer,\n// embedding-fallback, local-llm, search, day-summary, and semantic-consolidation.\n// All flags are non-optional booleans on PluginConfig (defaults resolved at\n// the parse boundary), so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of pipeline-processing feature gates (issue #1523 batch 9).\n */\nexport interface PipelineProcessingCapabilitySet {\n readonly chunking: boolean;\n readonly semanticChunking: boolean;\n readonly semanticDedup: boolean;\n readonly summarization: boolean;\n readonly topicExtraction: boolean;\n readonly sessionObserver: boolean;\n readonly profiling: boolean;\n readonly checkpoint: boolean;\n readonly traceWeaver: boolean;\n readonly routingRules: boolean;\n readonly inlineSourceAttribution: boolean;\n readonly negativeExamples: boolean;\n readonly hourlySummaries: boolean;\n readonly lcm: boolean;\n readonly localLlmFast: boolean;\n readonly proactiveExtraction: boolean;\n readonly delinearize: boolean;\n readonly slowLog: boolean;\n readonly hostEmbeddingProvider: boolean;\n readonly memoryExtensions: boolean;\n readonly hourlySummariesExtended: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolvePipelineProcessingCapabilities}.\n */\nexport type PipelineProcessingConfigProjection = Pick<\n PluginConfig,\n | \"chunkingEnabled\"\n | \"semanticChunkingEnabled\"\n | \"semanticDedupEnabled\"\n | \"summarizationEnabled\"\n | \"topicExtractionEnabled\"\n | \"sessionObserverEnabled\"\n | \"profilingEnabled\"\n | \"checkpointEnabled\"\n | \"traceWeaverEnabled\"\n | \"routingRulesEnabled\"\n | \"inlineSourceAttributionEnabled\"\n | \"negativeExamplesEnabled\"\n | \"hourlySummariesEnabled\"\n | \"lcmEnabled\"\n | \"localLlmFastEnabled\"\n | \"proactiveExtractionEnabled\"\n | \"delinearizeEnabled\"\n | \"slowLogEnabled\"\n | \"hostEmbeddingProviderEnabled\"\n | \"memoryExtensionsEnabled\"\n | \"hourlySummariesExtendedEnabled\"\n>;\n\n/**\n * Resolve the {@link PipelineProcessingCapabilitySet} from parsed config.\n */\nexport function resolvePipelineProcessingCapabilities(config: PipelineProcessingConfigProjection): PipelineProcessingCapabilitySet {\n return Object.freeze({\n chunking: config.chunkingEnabled,\n semanticChunking: config.semanticChunkingEnabled,\n semanticDedup: config.semanticDedupEnabled,\n summarization: config.summarizationEnabled,\n topicExtraction: config.topicExtractionEnabled,\n sessionObserver: config.sessionObserverEnabled === true,\n profiling: config.profilingEnabled,\n checkpoint: config.checkpointEnabled,\n traceWeaver: config.traceWeaverEnabled,\n routingRules: config.routingRulesEnabled,\n inlineSourceAttribution: config.inlineSourceAttributionEnabled,\n negativeExamples: config.negativeExamplesEnabled,\n hourlySummaries: config.hourlySummariesEnabled,\n lcm: config.lcmEnabled,\n localLlmFast: config.localLlmFastEnabled,\n proactiveExtraction: config.proactiveExtractionEnabled,\n delinearize: config.delinearizeEnabled,\n slowLog: config.slowLogEnabled,\n hostEmbeddingProvider: config.hostEmbeddingProviderEnabled,\n memoryExtensions: config.memoryExtensionsEnabled,\n hourlySummariesExtended: config.hourlySummariesExtendedEnabled,\n });\n}\n\n// ---------------------------------------------------------------------------\n// ConversationContext capability set (issue #1523 batch 9).\n//\n// These 12 flags gate conversation context, shared signals, intent routing,\n// operator-aware consolidation, CMC consolidation, maintenance fanout, CLI\n// presentation, and code connectors. Read sites span orchestrator, CLI,\n// shared-context/manager, semantic-consolidation-coordinator, compounding/engine,\n// maintenance modules, procedural stats, connectors, and wearables. All flags\n// are non-optional booleans on PluginConfig (defaults resolved at the parse\n// boundary), so the projection is a pure pass-through.\n// ---------------------------------------------------------------------------\n\n/**\n * Frozen projection of conversation/context feature gates (issue #1523 batch 9).\n */\nexport interface ConversationContextCapabilitySet {\n readonly sharedContext: boolean;\n readonly intentRouting: boolean;\n readonly crossSignalsSemantic: boolean;\n readonly sharedCrossSignalSemantic: boolean;\n readonly operatorAwareConsolidation: boolean;\n readonly peerProfileReasoner: boolean;\n readonly cmcConsolidation: boolean;\n readonly maintenanceNamespaceFanout: boolean;\n readonly citations: boolean;\n readonly behaviorLoopAutoTune: boolean;\n readonly semanticRulePromotion: boolean;\n readonly codexMarketplace: boolean;\n}\n\n/**\n * Config projection consumed by {@link resolveConversationContextCapabilities}.\n */\nexport type ConversationContextConfigProjection = Pick<\n PluginConfig,\n | \"sharedContextEnabled\"\n | \"intentRoutingEnabled\"\n | \"crossSignalsSemanticEnabled\"\n | \"sharedCrossSignalSemanticEnabled\"\n | \"operatorAwareConsolidationEnabled\"\n | \"peerProfileReasonerEnabled\"\n | \"cmcConsolidationEnabled\"\n | \"maintenanceNamespaceFanoutEnabled\"\n | \"citationsEnabled\"\n | \"behaviorLoopAutoTuneEnabled\"\n | \"semanticRulePromotionEnabled\"\n | \"codexMarketplaceEnabled\"\n>;\n\n/**\n * Resolve the {@link ConversationContextCapabilitySet} from parsed config.\n */\nexport function resolveConversationContextCapabilities(config: ConversationContextConfigProjection): ConversationContextCapabilitySet {\n return Object.freeze({\n sharedContext: config.sharedContextEnabled,\n intentRouting: config.intentRoutingEnabled,\n crossSignalsSemantic: config.crossSignalsSemanticEnabled,\n sharedCrossSignalSemantic: config.sharedCrossSignalSemanticEnabled === true,\n operatorAwareConsolidation: config.operatorAwareConsolidationEnabled,\n peerProfileReasoner: config.peerProfileReasonerEnabled,\n cmcConsolidation: config.cmcConsolidationEnabled,\n maintenanceNamespaceFanout: config.maintenanceNamespaceFanoutEnabled,\n citations: config.citationsEnabled,\n behaviorLoopAutoTune: config.behaviorLoopAutoTuneEnabled,\n semanticRulePromotion: config.semanticRulePromotionEnabled,\n codexMarketplace: config.codexMarketplaceEnabled,\n });\n}\n"],"mappings":";AA8EO,SAAS,oBAAoB,QAAqC;AACvE,SAAO,OAAO,OAAO;AAAA,IACnB,aAAa,OAAO;AAAA,IACpB,oBAAoB,OAAO;AAAA,IAC3B,yBAAyB,OAAO;AAAA;AAAA;AAAA,IAGhC,kBAAkB,OAAO,sBAAsB;AAAA,IAC/C,WAAW,OAAO;AAAA,IAClB,2BAA2B,OAAO;AAAA,IAClC,kBAAkB,OAAO;AAAA,IACzB,eAAe,OAAO;AAAA,IACtB,sBAAsB,OAAO;AAAA,IAC7B,aAAa,OAAO;AAAA;AAAA;AAAA,IAGpB,uBAAuB,OAAO,iCAAiC;AAAA,IAC/D,qBAAqB,OAAO,+BAA+B;AAAA;AAAA,IAE3D,QAAQ,OAAO;AAAA,IACf,mBAAmB,OAAO;AAAA,IAC1B,mBAAmB,OAAO;AAAA,EAC5B,CAAC;AACH;AAiDO,SAAS,qCACd,QACgC;AAChC,SAAO,OAAO,OAAO;AAAA,IACnB,aAAa,OAAO;AAAA,IACpB,WAAW,OAAO;AAAA,IAClB,aAAa,OAAO;AAAA,IACpB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ACvE,4BAA4B,OAAO;AAAA,IACnC,qBAAqB,OAAO;AAAA,IAC5B,kBAAkB,OAAO;AAAA,IACzB,4BAA4B,OAAO;AAAA,IACnC,WAAW,OAAO;AAAA,IAClB,sBAAsB,OAAO;AAAA,IAC7B,uBAAuB,OAAO;AAAA,IAC9B,kBAAkB,OAAO;AAAA,EAC3B,CAAC;AACH;","names":[]}
|
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
} from "./chunk-3ONXXHQO.js";
|
|
5
5
|
import {
|
|
6
6
|
resolveLocalLlmCapabilities,
|
|
7
|
-
resolveMemoryLifecycleCapabilities
|
|
8
|
-
|
|
7
|
+
resolveMemoryLifecycleCapabilities,
|
|
8
|
+
resolvePipelineProcessingCapabilities
|
|
9
|
+
} from "./chunk-G7Q4D2G3.js";
|
|
9
10
|
import {
|
|
10
11
|
readEnvVar
|
|
11
12
|
} from "./chunk-JUC24CTX.js";
|
|
@@ -230,7 +231,7 @@ var EmbeddingFallback = class {
|
|
|
230
231
|
}
|
|
231
232
|
async resolveProvider(options = {}) {
|
|
232
233
|
if (!resolveMemoryLifecycleCapabilities(this.config).embeddingFallback) return null;
|
|
233
|
-
if (options.includeHost !== false && this.config.
|
|
234
|
+
if (options.includeHost !== false && resolvePipelineProcessingCapabilities(this.config).hostEmbeddingProvider !== false) {
|
|
234
235
|
const hostProvider = getHostEmbeddingProvider(this.config.memoryDir);
|
|
235
236
|
if (hostProvider) {
|
|
236
237
|
return {
|
|
@@ -514,4 +515,4 @@ export {
|
|
|
514
515
|
EmbeddingProviderUnavailableError,
|
|
515
516
|
EmbeddingFallback
|
|
516
517
|
};
|
|
517
|
-
//# sourceMappingURL=chunk-
|
|
518
|
+
//# sourceMappingURL=chunk-GPX5E36D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/embedding-fallback.ts"],"sourcesContent":["import path from \"node:path\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { log } from \"./logger.js\";\nimport {\n resolveMemoryLifecycleCapabilities,\n resolveLocalLlmCapabilities,\n} from \"./capabilities.js\";\nimport { readEnvVar } from \"./runtime/env.js\";\nimport type { PluginConfig } from \"./types.js\";\nimport { resolvePipelineProcessingCapabilities } from \"./capabilities.js\";\nimport {\n getHostEmbeddingProvider,\n type HostEmbeddingProvider,\n normalizeHostEmbeddingVector,\n} from \"./host-embedding-provider.js\";\n\ntype EmbeddingProviderType = \"openai\" | \"local\" | \"host\";\n\ntype ProviderConfig = {\n type: EmbeddingProviderType;\n model: string;\n endpoint?: string;\n headers?: Record<string, string>;\n hostProvider?: HostEmbeddingProvider;\n};\n\ntype EmbeddingIndexEntry = {\n vector: number[];\n path: string;\n};\n\ntype EmbeddingResult = {\n provider: ProviderConfig;\n vector: number[];\n};\n\ntype EmbeddingIndexFile = {\n version: 1;\n provider: EmbeddingProviderType;\n model: string;\n entries: Record<string, EmbeddingIndexEntry>;\n};\n\ntype EmbeddingIndexIdentity = Pick<EmbeddingIndexFile, \"provider\" | \"model\">;\ntype EmbeddingIndexComparable =\n | EmbeddingIndexIdentity\n | Pick<ProviderConfig, \"type\" | \"model\">;\n\nconst DEFAULT_OPENAI_MODEL = \"text-embedding-3-small\";\n\n/**\n * Thrown by `EmbeddingFallback.search()` (via `embed()`) when the embedding\n * backend is effectively unavailable on the lookup path — either because the\n * HTTP fetch exceeded its deadline OR because the endpoint returned a non-2xx\n * status code. Callers that need to distinguish a backend outage from \"no\n * candidates\" can `instanceof`-check against this class.\n *\n * Round 9 fix (Finding UZqB): previously a timeout returned null from embed(),\n * which caused search() to return [] silently. decideSemanticDedup then\n * classified the result as no_candidates instead of backend_unavailable, so\n * the per-batch batchBackendUnavailable short-circuit never activated and\n * batches of N facts each paid a full timeout roundtrip.\n *\n * Round 10 fix (Findings Ui1J + Ui1L): search() now only re-throws this error\n * when the caller explicitly passes `{ throwOnTimeout: true }`. Without that\n * flag search() catches it and returns [] instead, preserving fail-open\n * semantics for recall-path callers (searchEmbeddingFallback) that have no\n * try/catch. Only the semantic-dedup path (semanticDedupLookup) passes the\n * flag so it can still reach decideSemanticDedup's backend_unavailable branch.\n *\n * Round 11 fix (Finding Ur_J): `embed()` now also throws this error from the\n * lookup path when the HTTP response is non-2xx (e.g. 429, 500, 503). Without\n * this, repeated 5xx outages would each return null → [] → no_candidates and\n * subsequent facts in the same batch would all pay full roundtrips instead of\n * tripping the per-batch backend_unavailable short-circuit.\n *\n * The class name is kept for backward compatibility — `EmbeddingTimeoutError`\n * now signals \"lookup backend unavailable\" rather than strictly \"timed out\".\n */\nexport class EmbeddingTimeoutError extends Error {\n override readonly name = \"EmbeddingTimeoutError\" as const;\n constructor(message: string) {\n super(message);\n }\n}\n\nexport class EmbeddingProviderUnavailableError extends Error {\n override readonly name = \"EmbeddingProviderUnavailableError\" as const;\n constructor(message: string) {\n super(message);\n }\n}\n\nfunction isLookupBackendUnavailableError(err: unknown): boolean {\n return (\n err instanceof EmbeddingTimeoutError ||\n err instanceof EmbeddingProviderUnavailableError\n );\n}\n\n/**\n * Maximum time to wait for an embedding HTTP request on the LOOKUP/query\n * path before giving up.\n *\n * The write-time semantic dedup guard in orchestrator.persistExtraction()\n * blocks each candidate fact on an embedding lookup. If the embedding\n * endpoint hangs (degraded OpenAI, stalled local gateway, DNS timeout),\n * extraction would otherwise stall indefinitely — a single bad backend\n * could freeze the entire persist loop. Bounding the fetch here ensures\n * the decision path fails open (returns null) within a predictable window\n * and writes proceed as non-duplicates.\n *\n * Tests can override via REMNIC_EMBEDDING_FETCH_TIMEOUT_MS so they don't\n * have to wait the full default on hung-fetch assertions.\n *\n * Related: joshuaswarren/remnic#373, PR #399 P1/P2 review.\n */\nconst DEFAULT_EMBEDDING_LOOKUP_TIMEOUT_MS = 5000;\n\n/**\n * Maximum time to wait for an embedding HTTP request on the INDEX path.\n *\n * Indexing runs asynchronously after a memory has already been persisted\n * to disk. It does not block extraction or writes — it only updates the\n * embedding index used by later semantic dedup lookups. A slow local\n * CPU-backed embedding model can legitimately take tens of seconds per\n * call, so applying the short lookup timeout here silently dropped index\n * updates and caused later dedup lookups to miss recently persisted\n * memories. Use a much larger budget on this path.\n *\n * Tests can override via REMNIC_EMBEDDING_INDEX_TIMEOUT_MS.\n */\nconst DEFAULT_EMBEDDING_INDEX_TIMEOUT_MS = 120_000;\n\nfunction resolveEmbeddingLookupTimeoutMs(): number {\n const raw = readEnvVar(\"REMNIC_EMBEDDING_FETCH_TIMEOUT_MS\");\n if (raw) {\n const parsed = Number(raw);\n if (Number.isFinite(parsed) && parsed > 0) {\n return Math.floor(parsed);\n }\n }\n return DEFAULT_EMBEDDING_LOOKUP_TIMEOUT_MS;\n}\n\nfunction resolveEmbeddingIndexTimeoutMs(): number {\n const raw = readEnvVar(\"REMNIC_EMBEDDING_INDEX_TIMEOUT_MS\");\n if (raw) {\n const parsed = Number(raw);\n if (Number.isFinite(parsed) && parsed > 0) {\n return Math.floor(parsed);\n }\n }\n return DEFAULT_EMBEDDING_INDEX_TIMEOUT_MS;\n}\n\n/**\n * Options for the low-level embed() call.\n *\n * `mode` selects the timeout profile:\n * - \"lookup\" (default): bounded by the short lookup budget; fails open fast.\n * - \"index\": bounded by a much longer budget so slow backends can still\n * index newly persisted memories.\n */\nexport type EmbedMode = \"lookup\" | \"index\";\n\nexport class EmbeddingFallback {\n private readonly indexPath: string;\n private loaded: EmbeddingIndexFile | null = null;\n private mutationQueue: Promise<void> = Promise.resolve();\n\n constructor(private readonly config: PluginConfig) {\n this.indexPath = path.join(config.memoryDir, \"state\", \"embeddings.json\");\n }\n\n async isAvailable(): Promise<boolean> {\n return (await this.resolveProvider()) !== null;\n }\n\n /**\n * Embed an array of texts and return their embedding vectors.\n *\n * This is the public batch-embed interface used by semantic chunking\n * (Finding 1, PR #420 post-merge). Texts are grouped into batches of\n * `embeddingBatchSize` (from `semanticChunkingConfig`, default 32) and\n * each batch is dispatched concurrently via `Promise.all()`. This\n * preserves the semantic intent of `embeddingBatchSize` — without batching,\n * every text incurred a sequential HTTP round-trip, making the batch size\n * config ineffective. (PR #439 post-merge Finding 2.)\n *\n * If the provider is unavailable or any single embedding fails, the method\n * throws so the caller can fall back to recursive chunking.\n */\n async embedTexts(texts: string[]): Promise<number[][]> {\n const provider = await this.resolveProvider();\n if (!provider) {\n throw new Error(\"Embedding provider is not available\");\n }\n\n const batchSize = Math.max(\n 1,\n this.config.semanticChunkingConfig?.embeddingBatchSize ?? 32,\n );\n\n const vectors: number[][] = [];\n for (let i = 0; i < texts.length; i += batchSize) {\n const batch = texts.slice(i, i + batchSize);\n const batchResults = await Promise.all(\n batch.map((text) => this.embed(text, provider, { mode: \"lookup\" })),\n );\n for (const vec of batchResults) {\n if (!vec) {\n throw new Error(\"Embedding returned null for input text\");\n }\n vectors.push(vec);\n }\n }\n return vectors;\n }\n\n /**\n * Nearest-neighbor search against the embedding index.\n *\n * @param query The query string to embed and search for.\n * @param limit Max number of hits to return.\n * @param options Optional filters.\n * - `pathPrefix` Restrict candidates to entries whose indexed `path`\n * starts with this prefix (relative to `memoryDir`).\n * Used by the semantic dedup guard to scope lookups\n * to the target namespace so a high-similarity hit\n * from a different namespace can't suppress a write\n * in the target namespace. Default: no filter.\n * - `pathExcludePrefixes`\n * Exclude any entry whose indexed `path` starts with\n * any of these prefixes. Used for the default\n * namespace case: when the default namespace lives at\n * `memoryDir` root (legacy layout) we still want to\n * exclude `namespaces/<other>/…` entries.\n */\n async search(\n query: string,\n limit: number,\n options: {\n pathPrefix?: string;\n pathExcludePrefixes?: readonly string[];\n /**\n * When true, an `EmbeddingTimeoutError` from the embedding backend is\n * re-thrown to the caller. Use this on the semantic-dedup path so\n * `decideSemanticDedup`'s catch block can classify the result as\n * `reason=\"backend_unavailable\"` and activate the per-batch\n * short-circuit.\n *\n * When false (the default), a timeout is caught here and search()\n * returns [] instead — preserving fail-open semantics for the recall\n * path (`searchEmbeddingFallback`) which has no surrounding try/catch.\n * Without this gate a timed-out embedding request on the recall path\n * would propagate as an unhandled rejection and abort recall entirely.\n * (Round 10 fix, Findings Ui1J + Ui1L.)\n */\n throwOnTimeout?: boolean;\n } = {},\n ): Promise<Array<{ id: string; score: number; path: string }>> {\n const provider = await this.resolveProvider();\n if (!provider) return [];\n\n let queryResult = await this.embedForSearch(query, provider, options);\n if (!queryResult) return [];\n\n const diskIdentity = await this.readIndexIdentityFromDisk();\n if (diskIdentity && !sameIndexIdentity(diskIdentity, queryResult.provider)) {\n const diskProvider = await this.resolveFallbackProviderForIndexIdentity(diskIdentity);\n if (diskProvider) {\n const diskQueryResult = await this.embedForSearch(query, diskProvider, options);\n if (diskQueryResult && sameIndexIdentity(diskIdentity, diskQueryResult.provider)) {\n queryResult = diskQueryResult;\n } else {\n log.debug(\n `embedding fallback search skipped: preserved ${diskIdentity.provider}/${diskIdentity.model} index is unavailable for lookup`,\n );\n return [];\n }\n } else {\n log.debug(\n `embedding fallback search skipped: query provider ${queryResult.provider.type}/${queryResult.provider.model} does not match existing ${diskIdentity.provider}/${diskIdentity.model} index`,\n );\n return [];\n }\n }\n\n const index = await this.loadIndex(queryResult.provider);\n const ids = Object.keys(index.entries);\n if (ids.length === 0) return [];\n\n const includePrefix = normalizePathPrefix(options.pathPrefix);\n const excludePrefixes = (options.pathExcludePrefixes ?? [])\n .map((p) => normalizePathPrefix(p))\n .filter((p): p is string => typeof p === \"string\");\n\n const scored = ids\n .map((id) => {\n const entry = index.entries[id];\n return {\n id,\n path: entry.path,\n score: cosineSimilarity(queryResult.vector, entry.vector),\n };\n })\n .filter((r) => {\n if (!Number.isFinite(r.score)) return false;\n const normalized = normalizeEntryPath(r.path);\n if (includePrefix !== undefined && !normalized.startsWith(includePrefix)) {\n return false;\n }\n for (const excl of excludePrefixes) {\n if (normalized.startsWith(excl)) return false;\n }\n return true;\n })\n .sort((a, b) => b.score - a.score)\n .slice(0, Math.max(1, limit));\n\n return scored;\n }\n\n async indexFile(memoryId: string, content: string, filePath: string): Promise<void> {\n const provider = await this.resolveProvider();\n if (!provider) return;\n // Indexing is not on the write-critical path: a newly persisted memory\n // has already been written to disk by the time we reach this call. Use\n // the long \"index\" timeout so slow local embedding backends can still\n // add the entry to the index. Previously this used the short lookup\n // budget and silently dropped updates, leaving later dedup lookups\n // blind to the memory. Related: PR #399 P2.\n const result = await this.embedWithEffectiveProvider(content, provider, {\n mode: \"index\",\n });\n if (!result) return;\n\n await this.enqueueIndexMutation(async () => {\n const existing = await this.readIndexIdentityFromDisk();\n if (\n existing &&\n !sameIndexIdentity(existing, result.provider) &&\n !canReplaceIndexIdentity(existing, result.provider)\n ) {\n log.debug(\n `embedding fallback index update skipped: ${result.provider.type}/${result.provider.model} would replace existing ${existing.provider}/${existing.model} index`,\n );\n return;\n }\n const index = await this.loadIndex(result.provider);\n const relPath = toMemoryRelativePath(this.config.memoryDir, filePath);\n index.entries[memoryId] = {\n vector: result.vector,\n path: relPath,\n };\n await this.saveIndex(index);\n });\n }\n\n async removeFromIndex(memoryId: string): Promise<void> {\n const provider = await this.resolveProvider();\n if (!provider) return;\n\n await this.enqueueIndexMutation(async () => {\n const providers = [provider];\n const diskIdentity = await this.readIndexIdentityFromDisk();\n if (\n diskIdentity &&\n !providers.some((entry) => sameIndexIdentity(entry, diskIdentity))\n ) {\n providers.push(providerFromIndexIdentity(diskIdentity));\n }\n if (provider.type === \"host\") {\n const fallbackProvider = await this.resolveProvider({ includeHost: false });\n if (\n fallbackProvider &&\n !providers.some((entry) => sameIndexIdentity(entry, fallbackProvider))\n ) {\n providers.push(fallbackProvider);\n }\n }\n\n for (const indexProvider of providers) {\n const index = await this.loadIndex(indexProvider);\n if (!index.entries[memoryId]) continue;\n delete index.entries[memoryId];\n await this.saveIndex(index);\n }\n });\n }\n\n private enqueueIndexMutation<T>(mutation: () => Promise<T>): Promise<T> {\n const run = this.mutationQueue.catch(() => undefined).then(mutation);\n this.mutationQueue = run.then(\n () => undefined,\n () => undefined,\n );\n return run;\n }\n\n private async resolveProvider(\n options: { includeHost?: boolean } = {},\n ): Promise<ProviderConfig | null> {\n if (!resolveMemoryLifecycleCapabilities(this.config).embeddingFallback) return null;\n\n if (\n options.includeHost !== false &&\n resolvePipelineProcessingCapabilities(this.config).hostEmbeddingProvider !== false\n ) {\n const hostProvider = getHostEmbeddingProvider(this.config.memoryDir);\n if (hostProvider) {\n return {\n type: \"host\",\n model: hostProvider.model || hostProvider.id,\n hostProvider,\n };\n }\n }\n\n const preferred = this.config.embeddingFallbackProvider;\n const providers = preferred === \"auto\" ? [\"openai\", \"local\"] : [preferred];\n\n for (const p of providers) {\n if (p === \"openai\") {\n const provider = this.createOpenAiProvider();\n if (provider) return provider;\n }\n\n if (p === \"local\") {\n const provider = this.createLocalProvider();\n if (provider) return provider;\n }\n }\n\n return null;\n }\n\n private async resolveFallbackProviderForIndexIdentity(\n identity: EmbeddingIndexIdentity,\n ): Promise<ProviderConfig | null> {\n if (identity.provider === \"openai\") {\n const provider = this.createOpenAiProvider();\n return provider && sameIndexIdentity(provider, identity) ? provider : null;\n }\n if (identity.provider === \"local\") {\n const provider = this.createLocalProvider();\n return provider && sameIndexIdentity(provider, identity) ? provider : null;\n }\n return null;\n }\n\n private createOpenAiProvider(): ProviderConfig | null {\n if (!this.config.openaiApiKey) return null;\n const baseUrl = this.config.openaiBaseUrl ?? \"https://api.openai.com/v1\";\n return {\n type: \"openai\",\n model: DEFAULT_OPENAI_MODEL,\n endpoint: `${baseUrl.replace(/\\/$/, \"\")}/embeddings`,\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${this.config.openaiApiKey}`,\n },\n };\n }\n\n private createLocalProvider(): ProviderConfig | null {\n if (!resolveLocalLlmCapabilities(this.config).localLlm || !this.config.localLlmUrl) return null;\n const base = this.config.localLlmUrl.replace(/\\/$/, \"\");\n const endpoint = /\\/v1$/i.test(base) ? `${base}/embeddings` : `${base}/v1/embeddings`;\n const headers: Record<string, string> = {\n \"Content-Type\": \"application/json\",\n ...(this.config.localLlmHeaders ?? {}),\n };\n if (this.config.localLlmApiKey && this.config.localLlmAuthHeader !== false) {\n headers.Authorization = `Bearer ${this.config.localLlmApiKey}`;\n }\n return {\n type: \"local\",\n model:\n this.config.embeddingFallbackModel ||\n this.config.localLlmModel ||\n DEFAULT_OPENAI_MODEL,\n endpoint,\n headers,\n };\n }\n\n private async embedForSearch(\n query: string,\n provider: ProviderConfig,\n options: { throwOnTimeout?: boolean } = {},\n ): Promise<EmbeddingResult | null> {\n try {\n return await this.embedWithEffectiveProvider(query, provider, {\n mode: \"lookup\",\n });\n } catch (err) {\n if (isLookupBackendUnavailableError(err)) {\n if (options.throwOnTimeout) {\n throw err;\n }\n // Fail-open: recall-path callers get an empty result rather than an\n // unhandled rejection that would abort recall entirely.\n log.debug(\"embedding fallback search: backend unavailable on lookup, returning [] (throwOnTimeout=false)\");\n return null;\n }\n throw err;\n }\n }\n\n private async embed(\n input: string,\n provider: ProviderConfig,\n options: { mode?: EmbedMode } = {},\n ): Promise<number[] | null> {\n const result = await this.embedWithEffectiveProvider(input, provider, options);\n return result?.vector ?? null;\n }\n\n private async embedWithEffectiveProvider(\n input: string,\n provider: ProviderConfig,\n options: { mode?: EmbedMode } = {},\n ): Promise<EmbeddingResult | null> {\n // Bound the fetch so a hung embedding endpoint cannot stall callers.\n // The lookup path uses a short budget (see DEFAULT_EMBEDDING_LOOKUP_TIMEOUT_MS\n // docblock) so semantic dedup fails open fast. The index path uses a\n // much longer budget because slow local backends (CPU embedding models)\n // otherwise drop index updates and blind later dedup lookups. See\n // DEFAULT_EMBEDDING_INDEX_TIMEOUT_MS docblock and PR #399 P2 review.\n const mode: EmbedMode = options.mode ?? \"lookup\";\n const timeoutMs =\n mode === \"index\"\n ? resolveEmbeddingIndexTimeoutMs()\n : resolveEmbeddingLookupTimeoutMs();\n if (provider.type === \"host\") {\n const vector = await this.embedWithHostProvider(input, provider, mode, timeoutMs);\n if (vector) return { provider, vector };\n const fallbackProvider = await this.resolveProvider({ includeHost: false });\n if (!fallbackProvider) {\n if (mode === \"lookup\") {\n throw new EmbeddingProviderUnavailableError(\n `host embedding provider unavailable (${provider.hostProvider?.id ?? provider.model})`,\n );\n }\n return null;\n }\n return this.embedWithEffectiveProvider(input, fallbackProvider, options);\n }\n if (!provider.endpoint || !provider.headers) return null;\n try {\n const res = await fetch(provider.endpoint, {\n method: \"POST\",\n headers: provider.headers,\n body: JSON.stringify({\n model: provider.model,\n input: input.slice(0, 8000),\n encoding_format: \"float\",\n }),\n signal: AbortSignal.timeout(timeoutMs),\n });\n if (!res.ok) {\n log.debug(`embedding fallback request failed: ${provider.type} ${res.status}`);\n // Round 11 fix (Finding Ur_J): on the LOOKUP path, a non-2xx response\n // means the embedding backend is effectively unavailable. Throw the\n // tagged error so search() (when called with throwOnTimeout) propagates\n // to decideSemanticDedup's backend_unavailable branch, activating the\n // per-batch short-circuit. Without this, repeated 429/5xx responses\n // would silently return [] for every fact in the batch.\n //\n // On the INDEX path a non-2xx is non-fatal (the memory is already\n // persisted; index update can be skipped) — return null there.\n if (mode === \"lookup\") {\n throw new EmbeddingTimeoutError(\n `embedding backend returned ${res.status} (${provider.type})`,\n );\n }\n return null;\n }\n const payload = (await res.json()) as any;\n const vector = payload?.data?.[0]?.embedding;\n if (!Array.isArray(vector)) return null;\n const normalized = vector\n .map((n: unknown) => Number(n))\n .filter((n: number) => Number.isFinite(n));\n return normalized.length > 0 ? { provider, vector: normalized } : null;\n } catch (err) {\n // Round 11 (Finding Ur_J): the !res.ok branch above throws\n // EmbeddingTimeoutError directly. Re-throw it here so the catch does\n // not swallow our own intentional signal back into a null return.\n if (isLookupBackendUnavailableError(err)) {\n throw err;\n }\n // AbortSignal.timeout throws a DOMException with name \"TimeoutError\";\n // surface at warn level so operators can distinguish slow backends from\n // generic errors.\n const isTimeout =\n err instanceof Error &&\n (err.name === \"TimeoutError\" || err.name === \"AbortError\");\n if (isTimeout) {\n log.warn(\n `embedding fallback fetch timed out after ${timeoutMs}ms (${provider.type}, mode=${mode})`,\n );\n // Round 9 fix (Finding UZqB): on the LOOKUP path a timeout means the\n // embedding backend is effectively unavailable — re-throw so that\n // search() propagates the error to semanticDedupLookup, which lets it\n // reach decideSemanticDedup's catch block and return\n // reason=\"backend_unavailable\". Without this, search() would silently\n // return [] and the per-batch batchBackendUnavailable flag would never\n // flip, causing subsequent facts in the same batch to each pay a full\n // timeout roundtrip (N × timeout instead of 1 × timeout).\n //\n // On the INDEX path a timeout is not fatal (the memory is already\n // persisted; index update can be skipped) — return null there so\n // indexFile() stays non-blocking.\n if (mode === \"lookup\") {\n throw new EmbeddingTimeoutError(\n `embedding backend timed out after ${timeoutMs}ms (${provider.type})`,\n );\n }\n } else {\n // Round 12 fix (PR #399 thread PRRT_kwDORJXyws56U6Gi): non-timeout\n // transport failures (ECONNREFUSED, DNS errors, TLS failures) are just\n // as fatal as timeouts on the LOOKUP path — the embedding backend is\n // effectively unreachable. Throw EmbeddingTimeoutError so that\n // search() (when called with throwOnTimeout:true) propagates the error\n // to decideSemanticDedup's backend_unavailable branch, activating the\n // per-batch short-circuit. Without this, each fact in the batch would\n // pay a full ECONNREFUSED roundtrip and return null → [] → no_candidates,\n // preventing batchBackendUnavailable from ever being set.\n //\n // On the INDEX path a transport failure is non-fatal — the memory is\n // already persisted; index update can be safely skipped.\n if (mode === \"lookup\") {\n log.warn(\n `embedding fallback transport error on lookup path (${provider.type}): ${err}`,\n );\n throw new EmbeddingTimeoutError(\n `embedding backend transport failure (${provider.type}): ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n log.debug(`embedding fallback error: ${err}`);\n }\n return null;\n }\n }\n\n private async embedWithHostProvider(\n input: string,\n provider: ProviderConfig,\n mode: EmbedMode,\n timeoutMs: number,\n ): Promise<number[] | null> {\n const hostProvider = provider.hostProvider;\n if (!hostProvider) return null;\n try {\n const vector = await hostProvider.embed(input.slice(0, 8000), {\n signal: AbortSignal.timeout(timeoutMs),\n inputType: mode === \"lookup\" ? \"query\" : \"document\",\n });\n return normalizeHostEmbeddingVector(vector);\n } catch (err) {\n log.debug(`host embedding provider error: ${hostProvider.id}: ${err}`);\n return null;\n }\n }\n\n private async loadIndex(provider: ProviderConfig): Promise<EmbeddingIndexFile> {\n if (this.loaded && this.loaded.provider === provider.type && this.loaded.model === provider.model) {\n return this.loaded;\n }\n\n try {\n const raw = await readFile(this.indexPath, \"utf-8\");\n const parsed = JSON.parse(raw) as EmbeddingIndexFile;\n if (\n parsed &&\n parsed.version === 1 &&\n parsed.provider === provider.type &&\n parsed.model === provider.model &&\n parsed.entries &&\n typeof parsed.entries === \"object\"\n ) {\n this.loaded = {\n version: 1,\n provider: provider.type,\n model: provider.model,\n entries: parsed.entries,\n };\n return this.loaded;\n }\n } catch {\n // ignore and create a new index\n }\n\n this.loaded = {\n version: 1,\n provider: provider.type,\n model: provider.model,\n entries: {},\n };\n return this.loaded;\n }\n\n private async readIndexIdentityFromDisk(): Promise<EmbeddingIndexIdentity | null> {\n try {\n const raw = await readFile(this.indexPath, \"utf-8\");\n const parsed = JSON.parse(raw) as Partial<EmbeddingIndexFile> | null;\n if (\n parsed &&\n parsed.version === 1 &&\n (parsed.provider === \"openai\" ||\n parsed.provider === \"local\" ||\n parsed.provider === \"host\") &&\n typeof parsed.model === \"string\" &&\n parsed.model.length > 0\n ) {\n return {\n provider: parsed.provider,\n model: parsed.model,\n };\n }\n } catch {\n // Missing or invalid indexes are treated as absent; loadIndex() owns\n // creating a fresh file when it is safe to write.\n }\n return null;\n }\n\n private async saveIndex(index: EmbeddingIndexFile): Promise<void> {\n const dir = path.dirname(this.indexPath);\n await mkdir(dir, { recursive: true });\n const tempPath = path.join(\n dir,\n `.embeddings.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2)}.tmp`,\n );\n try {\n await writeFile(tempPath, JSON.stringify(index), \"utf-8\");\n await rename(tempPath, this.indexPath);\n } catch (err) {\n await rm(tempPath, { force: true }).catch(() => undefined);\n throw err;\n }\n this.loaded = index;\n }\n}\n\nfunction toMemoryRelativePath(memoryDir: string, filePath: string): string {\n if (!path.isAbsolute(filePath)) return filePath;\n const rel = path.relative(memoryDir, filePath);\n return rel.startsWith(\"..\") ? filePath : rel;\n}\n\n/**\n * Normalize an index entry path to forward-slashes for stable prefix\n * comparison. Entries are stored as `path.relative(memoryDir, …)` output,\n * which on Windows uses back-slashes. Normalize both sides so prefix\n * matching is OS-independent.\n *\n * Also strip a leading `./` so this helper's output is symmetric with\n * `normalizePathPrefix` below. `toMemoryRelativePath` is a pass-through for\n * non-absolute filePath inputs, so an index entry could legitimately carry a\n * stored path like `\"./namespaces/alpha/facts/f.md\"`. Without this strip, a\n * caller-supplied prefix `\"./namespaces/alpha\"` (which `normalizePathPrefix`\n * rewrites to `\"namespaces/alpha/\"`) would silently miss that entry and\n * namespace-scoped dedup would either let a near-duplicate through or fail\n * to exclude a cross-namespace hit.\n */\nfunction normalizeEntryPath(p: string): string {\n let out = p.replace(/\\\\/g, \"/\");\n if (out.startsWith(\"./\")) out = out.slice(2);\n return out;\n}\n\n/**\n * Normalize a caller-supplied path prefix:\n * - Return `undefined` for nullish/empty input (no filter).\n * - Replace back-slashes with forward-slashes.\n * - Strip a leading `./`.\n * - Ensure a trailing `/` so `\"namespaces/a\"` doesn't accidentally match\n * `\"namespaces/another/…\"`.\n */\nfunction normalizePathPrefix(prefix: string | undefined): string | undefined {\n if (prefix === undefined || prefix === null) return undefined;\n let p = String(prefix).replace(/\\\\/g, \"/\");\n if (p.startsWith(\"./\")) p = p.slice(2);\n if (p.length === 0) return undefined;\n if (!p.endsWith(\"/\")) p = `${p}/`;\n return p;\n}\n\nfunction sameIndexIdentity(\n left: EmbeddingIndexComparable,\n right: EmbeddingIndexComparable,\n): boolean {\n return indexIdentityProvider(left) === indexIdentityProvider(right) && left.model === right.model;\n}\n\nfunction indexIdentityProvider(identity: EmbeddingIndexComparable): EmbeddingProviderType {\n return \"provider\" in identity ? identity.provider : identity.type;\n}\n\nfunction canReplaceIndexIdentity(\n existing: EmbeddingIndexIdentity,\n replacement: Pick<ProviderConfig, \"type\" | \"model\">,\n): boolean {\n return existing.provider === \"host\" && !sameIndexIdentity(existing, replacement);\n}\n\nfunction providerFromIndexIdentity(identity: EmbeddingIndexIdentity): ProviderConfig {\n return {\n type: identity.provider,\n model: identity.model,\n };\n}\n\nfunction cosineSimilarity(a: number[], b: number[]): number {\n const n = Math.min(a.length, b.length);\n if (n === 0) return 0;\n let dot = 0;\n let normA = 0;\n let normB = 0;\n for (let i = 0; i < n; i++) {\n const av = a[i] ?? 0;\n const bv = b[i] ?? 0;\n dot += av * bv;\n normA += av * av;\n normB += bv * bv;\n }\n const denom = Math.sqrt(normA) * Math.sqrt(normB);\n if (denom === 0) return 0;\n return dot / denom;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,OAAO,UAAU,QAAQ,IAAI,iBAAiB;AA+CvD,IAAM,uBAAuB;AA+BtB,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC7B,OAAO;AAAA,EACzB,YAAY,SAAiB;AAC3B,UAAM,OAAO;AAAA,EACf;AACF;AAEO,IAAM,oCAAN,cAAgD,MAAM;AAAA,EACzC,OAAO;AAAA,EACzB,YAAY,SAAiB;AAC3B,UAAM,OAAO;AAAA,EACf;AACF;AAEA,SAAS,gCAAgC,KAAuB;AAC9D,SACE,eAAe,yBACf,eAAe;AAEnB;AAmBA,IAAM,sCAAsC;AAe5C,IAAM,qCAAqC;AAE3C,SAAS,kCAA0C;AACjD,QAAM,MAAM,WAAW,mCAAmC;AAC1D,MAAI,KAAK;AACP,UAAM,SAAS,OAAO,GAAG;AACzB,QAAI,OAAO,SAAS,MAAM,KAAK,SAAS,GAAG;AACzC,aAAO,KAAK,MAAM,MAAM;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,iCAAyC;AAChD,QAAM,MAAM,WAAW,mCAAmC;AAC1D,MAAI,KAAK;AACP,UAAM,SAAS,OAAO,GAAG;AACzB,QAAI,OAAO,SAAS,MAAM,KAAK,SAAS,GAAG;AACz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MAAM;AACrC,MAAI,MAAM,EAAG,QAAO;AACpB,MAAI,MAAM;AACV,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,WAAS,IAAI,GAAG,IAAI,GAAG,KAAK;AAC1B,UAAM,KAAK,EAAE,CAAC,KAAK;AACnB,UAAM,KAAK,EAAE,CAAC,KAAK;AACnB,WAAO,KAAK;AACZ,aAAS,KAAK;AACd,aAAS,KAAK;AAAA,EAChB;AACA,QAAM,QAAQ,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK;AAChD,MAAI,UAAU,EAAG,QAAO;AACxB,SAAO,MAAM;AACf;","names":[]}
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
rebuildMemoryProjection,
|
|
47
47
|
repairMemoryProjection,
|
|
48
48
|
verifyMemoryProjection
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-FWXLKH2H.js";
|
|
50
50
|
import {
|
|
51
51
|
rebuildObservations
|
|
52
52
|
} from "./chunk-LZZNTPLR.js";
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
} from "./chunk-D6RIFG4O.js";
|
|
59
59
|
import {
|
|
60
60
|
rebuildMemoryLifecycleLedger
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-56F6EAQ6.js";
|
|
62
62
|
import {
|
|
63
63
|
getBulkImportSource,
|
|
64
64
|
listBulkImportSources,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
} from "./chunk-GQL52GQ5.js";
|
|
71
71
|
import {
|
|
72
72
|
promoteSemanticRuleFromMemory
|
|
73
|
-
} from "./chunk-
|
|
73
|
+
} from "./chunk-WO22UEM3.js";
|
|
74
74
|
import {
|
|
75
75
|
buildResumeBundleFromState,
|
|
76
76
|
getResumeBundleStatus,
|
|
@@ -98,12 +98,12 @@ import {
|
|
|
98
98
|
runOperatorInventory,
|
|
99
99
|
runOperatorRepair,
|
|
100
100
|
runOperatorSetup
|
|
101
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-QCO2QFLZ.js";
|
|
102
102
|
import {
|
|
103
103
|
listNamespaces,
|
|
104
104
|
runNamespaceMigration,
|
|
105
105
|
verifyNamespaces
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-UYYSOMS2.js";
|
|
107
107
|
import {
|
|
108
108
|
GraphDashboardServer
|
|
109
109
|
} from "./chunk-EZ25VE3G.js";
|
|
@@ -116,7 +116,7 @@ import {
|
|
|
116
116
|
} from "./chunk-2PRQG7PV.js";
|
|
117
117
|
import {
|
|
118
118
|
searchVerifiedEpisodes
|
|
119
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-UGFPGWJB.js";
|
|
120
120
|
import {
|
|
121
121
|
getUtilityLearningStatus,
|
|
122
122
|
learnUtilityPromotionWeights
|
|
@@ -130,7 +130,7 @@ import {
|
|
|
130
130
|
} from "./chunk-QRDOSYOR.js";
|
|
131
131
|
import {
|
|
132
132
|
searchVerifiedSemanticRules
|
|
133
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-FCQ7ZYCQ.js";
|
|
134
134
|
import {
|
|
135
135
|
getWorkProductLedgerStatus,
|
|
136
136
|
recordWorkProductLedgerEntry,
|
|
@@ -145,7 +145,7 @@ import {
|
|
|
145
145
|
} from "./chunk-33JBK2XP.js";
|
|
146
146
|
import {
|
|
147
147
|
formatNamespaceMaintenanceHealthText
|
|
148
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-O4IWVWSW.js";
|
|
149
149
|
import {
|
|
150
150
|
analyzeSessionIntegrity,
|
|
151
151
|
applySessionRepair,
|
|
@@ -215,7 +215,7 @@ import {
|
|
|
215
215
|
} from "./chunk-OADWQ5CR.js";
|
|
216
216
|
import {
|
|
217
217
|
EngramAccessHttpServer
|
|
218
|
-
} from "./chunk-
|
|
218
|
+
} from "./chunk-LD6A7XG5.js";
|
|
219
219
|
import {
|
|
220
220
|
WearablesInputError
|
|
221
221
|
} from "./chunk-7WV3F5DQ.js";
|
|
@@ -228,10 +228,10 @@ import {
|
|
|
228
228
|
createProductionChatLlmAdapter,
|
|
229
229
|
loadChatSession,
|
|
230
230
|
sessionBelongsToPrincipal
|
|
231
|
-
} from "./chunk-
|
|
231
|
+
} from "./chunk-4J53ZVPQ.js";
|
|
232
232
|
import {
|
|
233
233
|
EngramAccessService
|
|
234
|
-
} from "./chunk-
|
|
234
|
+
} from "./chunk-7Y5KKMIP.js";
|
|
235
235
|
import {
|
|
236
236
|
WorkStorage
|
|
237
237
|
} from "./chunk-GDB4J2H3.js";
|
|
@@ -249,7 +249,7 @@ import {
|
|
|
249
249
|
readMemoryGovernanceRunArtifact,
|
|
250
250
|
restoreMemoryGovernanceRun,
|
|
251
251
|
runMemoryGovernance
|
|
252
|
-
} from "./chunk-
|
|
252
|
+
} from "./chunk-7N7S2RKF.js";
|
|
253
253
|
import {
|
|
254
254
|
getTrustZoneStoreStatus,
|
|
255
255
|
promoteTrustZoneRecord,
|
|
@@ -286,6 +286,7 @@ import {
|
|
|
286
286
|
import {
|
|
287
287
|
resolveCapabilities,
|
|
288
288
|
resolveConsolidationCapabilities,
|
|
289
|
+
resolveConversationContextCapabilities,
|
|
289
290
|
resolveCreationMemoryCapabilities,
|
|
290
291
|
resolveEvalCapabilities,
|
|
291
292
|
resolveGraphConstructionCapabilities,
|
|
@@ -295,9 +296,10 @@ import {
|
|
|
295
296
|
resolveObjectiveStateCapabilities,
|
|
296
297
|
resolvePresentationCapabilities,
|
|
297
298
|
resolveRecallAuxiliaryCapabilities,
|
|
299
|
+
resolveRecallEnhancementCapabilities,
|
|
298
300
|
resolveSecurityCapabilities,
|
|
299
301
|
resolveUtilityLearningCapabilities
|
|
300
|
-
} from "./chunk-
|
|
302
|
+
} from "./chunk-G7Q4D2G3.js";
|
|
301
303
|
import {
|
|
302
304
|
expandTildePath
|
|
303
305
|
} from "./chunk-EYIEWJNI.js";
|
|
@@ -751,7 +753,7 @@ function registerResearchStatusCommands(cmd, orchestrator) {
|
|
|
751
753
|
const status = await runCausalTrajectoryStatusCliCommand({
|
|
752
754
|
memoryDir: orchestrator.config.memoryDir,
|
|
753
755
|
causalTrajectoryStoreDir: orchestrator.config.causalTrajectoryStoreDir,
|
|
754
|
-
causalTrajectoryMemoryEnabled: orchestrator.config.
|
|
756
|
+
causalTrajectoryMemoryEnabled: resolveRecallEnhancementCapabilities(orchestrator.config).causalTrajectoryMemory
|
|
755
757
|
});
|
|
756
758
|
console.log(JSON.stringify(status, null, 2));
|
|
757
759
|
console.log("OK");
|
|
@@ -3545,7 +3547,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
3545
3547
|
);
|
|
3546
3548
|
tierCmd.command("list").description("Summarize tier distribution across all memories").option("--json", "Emit machine-readable JSON only").action(async (...args) => {
|
|
3547
3549
|
const options = args[0] ?? {};
|
|
3548
|
-
const { summarizeTiers, formatTierSummaryText } = await import("./tier-stats-
|
|
3550
|
+
const { summarizeTiers, formatTierSummaryText } = await import("./tier-stats-CSKL7BDG.js");
|
|
3549
3551
|
const summary = await summarizeTiers(orchestrator.storage);
|
|
3550
3552
|
if (reportHasMachineReadableOutput(options)) {
|
|
3551
3553
|
console.log(JSON.stringify(summary, null, 2));
|
|
@@ -3556,7 +3558,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
3556
3558
|
tierCmd.command("explain").description("Explain the tier-transition decision for a single memory").argument("<id>", "Memory id to explain").option("--json", "Emit machine-readable JSON only").action(async (...args) => {
|
|
3557
3559
|
const idArg = typeof args[0] === "string" ? args[0] : "";
|
|
3558
3560
|
const options = args[1] ?? {};
|
|
3559
|
-
const { explainTierForMemory, formatTierExplainText } = await import("./tier-stats-
|
|
3561
|
+
const { explainTierForMemory, formatTierExplainText } = await import("./tier-stats-CSKL7BDG.js");
|
|
3560
3562
|
try {
|
|
3561
3563
|
const explain = await explainTierForMemory(
|
|
3562
3564
|
orchestrator.storage,
|
|
@@ -5249,7 +5251,7 @@ ${doc.content}` : doc.content,
|
|
|
5249
5251
|
const options = args[0] ?? {};
|
|
5250
5252
|
const result = await runSemanticRulePromoteCliCommand({
|
|
5251
5253
|
memoryDir: orchestrator.config.memoryDir,
|
|
5252
|
-
semanticRulePromotionEnabled: orchestrator.config.
|
|
5254
|
+
semanticRulePromotionEnabled: resolveConversationContextCapabilities(orchestrator.config).semanticRulePromotion,
|
|
5253
5255
|
sourceMemoryId: String(options.memoryId ?? ""),
|
|
5254
5256
|
dryRun: options.dryRun === true
|
|
5255
5257
|
});
|
|
@@ -5546,7 +5548,7 @@ ${doc.content}` : doc.content,
|
|
|
5546
5548
|
principal: resolveAccessPrincipalOverride(options.principal, orchestrator.config.agentAccessHttp.principal),
|
|
5547
5549
|
maxBodyBytes: Number.isFinite(maxBodyBytesRaw) ? maxBodyBytesRaw : 131072,
|
|
5548
5550
|
trustPrincipalHeader: options.trustPrincipalHeader === true,
|
|
5549
|
-
citationsEnabled: orchestrator.config.
|
|
5551
|
+
citationsEnabled: resolveConversationContextCapabilities(orchestrator.config).citations,
|
|
5550
5552
|
citationsAutoDetect: orchestrator.config.citationsAutoDetect,
|
|
5551
5553
|
emitLegacyTools: orchestrator.config.emitLegacyTools
|
|
5552
5554
|
});
|
|
@@ -6799,7 +6801,7 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
6799
6801
|
});
|
|
6800
6802
|
reviewCmd.command("scan").description("Run an on-demand contradiction scan").option("--namespace <ns>", "Namespace to scan").action(async (...args) => {
|
|
6801
6803
|
const options = args[0] ?? {};
|
|
6802
|
-
const { runContradictionScan } = await import("./contradiction-scan-
|
|
6804
|
+
const { runContradictionScan } = await import("./contradiction-scan-UERKJESC.js");
|
|
6803
6805
|
console.log("Running contradiction scan...");
|
|
6804
6806
|
const result = await runContradictionScan({
|
|
6805
6807
|
storage: orchestrator.storage,
|
|
@@ -7519,4 +7521,4 @@ export {
|
|
|
7519
7521
|
listMemoryMarkdownFilePaths,
|
|
7520
7522
|
registerCli
|
|
7521
7523
|
};
|
|
7522
|
-
//# sourceMappingURL=chunk-
|
|
7524
|
+
//# sourceMappingURL=chunk-H3WSZWHK.js.map
|