@remnic/core 9.27.0 → 9.29.0
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-admin-ops-surface.d.ts +13 -10
- package/dist/access-admin-ops-surface.js +46 -41
- package/dist/access-audit.js +2 -2
- package/dist/access-authorization-probe.d.ts +13 -10
- package/dist/access-authorization-probe.js +47 -42
- package/dist/access-boundary.d.ts +13 -10
- package/dist/access-boundary.js +46 -41
- package/dist/access-cli.js +105 -96
- package/dist/access-cli.js.map +1 -1
- package/dist/access-health-types.d.ts +10 -1
- package/dist/access-http-lcm-compaction.d.ts +13 -10
- package/dist/access-http.d.ts +13 -10
- package/dist/access-http.js +56 -51
- package/dist/access-identity-continuity-surface.d.ts +9 -8
- package/dist/access-identity-continuity-surface.js +46 -41
- package/dist/access-lcm-surface.d.ts +13 -10
- package/dist/access-lcm-surface.js +46 -41
- package/dist/access-mcp.d.ts +13 -10
- package/dist/access-mcp.js +51 -46
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/access-memory-search-fanout.js +3 -3
- package/dist/{access-namespace-preflight-wRSZEO5V.d.ts → access-namespace-preflight-DCXBkDp0.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +46 -41
- package/dist/access-observe-write-surface.d.ts +13 -10
- package/dist/access-observe-write-surface.js +46 -41
- package/dist/access-operations-batch.js +48 -43
- package/dist/access-operations.d.ts +16 -13
- package/dist/access-operations.js +50 -45
- package/dist/access-recall-concurrency.d.ts +13 -10
- package/dist/access-recall-concurrency.js +46 -41
- package/dist/access-recall-response.d.ts +13 -10
- package/dist/access-recall-response.js +46 -41
- package/dist/access-recall-surface.d.ts +13 -10
- package/dist/access-recall-surface.js +46 -41
- package/dist/access-schema.d.ts +80 -80
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-B4-Fu9x2.d.ts → access-service-DvPW_M5j.d.ts} +12 -8
- package/dist/access-service.d.ts +13 -10
- package/dist/access-service.js +46 -41
- package/dist/access-surface-catalog.d.ts +13 -10
- package/dist/access-wearables-meetings-surface.d.ts +4 -3
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-memory-bridge.js +3 -3
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +4 -2
- package/dist/active-recall.js.map +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -8
- package/dist/briefing.d.ts +3 -2
- package/dist/briefing.js +14 -12
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +3 -2
- package/dist/buffer.js +2 -2
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +3 -2
- package/dist/capabilities.js +1 -1
- package/dist/{capsule-crypto-YO5QJ6L3.js → capsule-crypto-GWVG7LGC.js} +2 -2
- package/dist/{catalog-BLLxZ5L5.d.ts → catalog-BIVgftWu.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +15 -13
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-CI26JDZA.js → chunk-2HNUMF5V.js} +6 -4
- package/dist/{chunk-CI26JDZA.js.map → chunk-2HNUMF5V.js.map} +1 -1
- package/dist/{chunk-NUWMZIYZ.js → chunk-2XC73SHY.js} +61 -43
- package/dist/chunk-2XC73SHY.js.map +1 -0
- package/dist/{chunk-RDQGLJRR.js → chunk-2XRE6FLM.js} +2 -1
- package/dist/{chunk-RDQGLJRR.js.map → chunk-2XRE6FLM.js.map} +1 -1
- package/dist/{chunk-2H7OEVPO.js → chunk-3GD2HFR6.js} +2 -2
- package/dist/{chunk-4TFIRMTE.js → chunk-4A6YGWQN.js} +2 -2
- package/dist/{chunk-JDOJZTFF.js → chunk-4PBVXX7L.js} +2 -2
- package/dist/{chunk-IKMAO55B.js → chunk-55MDBZLC.js} +2 -2
- package/dist/{chunk-VDX2J7OX.js → chunk-5W7CTZ2E.js} +4 -4
- package/dist/{chunk-B7GROTXD.js → chunk-6LKEUCEM.js} +2 -2
- package/dist/{chunk-2AJ72VVS.js → chunk-7BZOBA5J.js} +3 -3
- package/dist/{chunk-44DUJETW.js → chunk-7HXCF4RE.js} +2 -2
- package/dist/{chunk-X3SQYAPP.js → chunk-ACXPX4AG.js} +2 -2
- package/dist/{chunk-AJ7QCSIS.js → chunk-ALSGMEJR.js} +5 -5
- package/dist/{chunk-JGUXPJUQ.js → chunk-AS7YMSL6.js} +2 -2
- package/dist/{chunk-77CNV7DY.js → chunk-BLAKS3CP.js} +4 -4
- package/dist/{chunk-5BRT4Z2I.js → chunk-CMRQ34J5.js} +2 -2
- package/dist/{chunk-HEXSNYJD.js → chunk-CSMCNOPH.js} +8 -8
- package/dist/chunk-CVILPI77.js +432 -0
- package/dist/chunk-CVILPI77.js.map +1 -0
- package/dist/{chunk-SK3EYPKC.js → chunk-D2ANTDGO.js} +3 -3
- package/dist/{chunk-JCVQV6QX.js → chunk-D3LMYTBV.js} +7 -7
- package/dist/{chunk-GJJBPI6I.js → chunk-DRBXHRXE.js} +7 -3
- package/dist/chunk-DRBXHRXE.js.map +1 -0
- package/dist/{chunk-XY7QPJDA.js → chunk-E6EE5B67.js} +2 -2
- package/dist/{chunk-LLISELSY.js → chunk-EP5BVCRI.js} +2 -2
- package/dist/{chunk-PTN6UAUA.js → chunk-ES36HTSC.js} +4 -4
- package/dist/{chunk-WEAO45M4.js → chunk-ESBQWC3U.js} +4 -4
- package/dist/{chunk-EUSLKI4X.js → chunk-EVX44I7C.js} +5 -5
- package/dist/{chunk-CIQXI47W.js → chunk-FCDWWCLX.js} +1195 -271
- package/dist/chunk-FCDWWCLX.js.map +1 -0
- package/dist/{chunk-X6ROIHFE.js → chunk-G5R3D5UP.js} +2 -2
- package/dist/{chunk-MG6MNSP4.js → chunk-G6LBWZRF.js} +7 -7
- package/dist/{chunk-TKBDJTXG.js → chunk-GBJ4RDFR.js} +94 -20
- package/dist/chunk-GBJ4RDFR.js.map +1 -0
- package/dist/{chunk-FRVTCCGD.js → chunk-GGUBDXRR.js} +2 -2
- package/dist/{chunk-QH6CS6XJ.js → chunk-H24WNPA2.js} +2 -2
- package/dist/{chunk-V25OWXAC.js → chunk-HUHX2OCX.js} +1 -1
- package/dist/chunk-HUHX2OCX.js.map +1 -0
- package/dist/{chunk-TGQ2NTWH.js → chunk-IJ6WHMFB.js} +16 -2
- package/dist/{chunk-TGQ2NTWH.js.map → chunk-IJ6WHMFB.js.map} +1 -1
- package/dist/{chunk-EOLC6EXV.js → chunk-IMA2EWLV.js} +24 -3
- package/dist/chunk-IMA2EWLV.js.map +1 -0
- package/dist/{chunk-MQVINOJQ.js → chunk-IYZ5K7MU.js} +3 -3
- package/dist/{chunk-RPA2RX5P.js → chunk-JDZRYH2N.js} +2 -2
- package/dist/{chunk-M5EPMNS4.js → chunk-K5GB36ME.js} +2 -2
- package/dist/{chunk-UT3OQPFA.js → chunk-KUJQHXPH.js} +2 -2
- package/dist/{chunk-7RZJWZ46.js → chunk-LEPOP46W.js} +5 -5
- package/dist/{chunk-EYJSW2RV.js → chunk-NBDCZWP4.js} +4 -4
- package/dist/{chunk-XKGPIWGI.js → chunk-OFHFH655.js} +6 -6
- package/dist/{chunk-FGBJBYWP.js → chunk-OVRQLAYR.js} +3 -3
- package/dist/{chunk-BXLOS5AJ.js → chunk-OWHERGF2.js} +2 -2
- package/dist/chunk-P2BM76KT.js +528 -0
- package/dist/chunk-P2BM76KT.js.map +1 -0
- package/dist/{chunk-U3TH5Q2Q.js → chunk-P3MH72CI.js} +2 -2
- package/dist/{chunk-P2OZKKYP.js → chunk-PHWUFPCO.js} +2 -2
- package/dist/{chunk-KGTD2KZJ.js → chunk-PKRIQL3V.js} +2 -2
- package/dist/{chunk-BNGPHGVZ.js → chunk-Q6VFVAKZ.js} +13 -6
- package/dist/{chunk-BNGPHGVZ.js.map → chunk-Q6VFVAKZ.js.map} +1 -1
- package/dist/{chunk-4MJZTF42.js → chunk-QAOGGNE3.js} +3 -3
- package/dist/{chunk-RGJBM7Z3.js → chunk-QMBNMPQM.js} +84 -84
- package/dist/{chunk-RGJBM7Z3.js.map → chunk-QMBNMPQM.js.map} +1 -1
- package/dist/{chunk-2QSZNTDO.js → chunk-RKNJBZ55.js} +4 -4
- package/dist/chunk-RMMVQQA6.js +70 -0
- package/dist/chunk-RMMVQQA6.js.map +1 -0
- package/dist/{chunk-FCCMFVS6.js → chunk-RPSYDM6C.js} +2 -2
- package/dist/chunk-RPW2NOU6.js +33 -0
- package/dist/chunk-RPW2NOU6.js.map +1 -0
- package/dist/{chunk-RYHWZ52A.js → chunk-S2BBISHU.js} +4 -4
- package/dist/{chunk-RSYJV25N.js → chunk-SG265CVF.js} +10 -10
- package/dist/{chunk-UGH6VPPO.js → chunk-SH6YO3LT.js} +3 -3
- package/dist/{chunk-2RAC4JIG.js → chunk-T3GCXULH.js} +16 -16
- package/dist/chunk-T3GCXULH.js.map +1 -0
- package/dist/{chunk-FMLKOL2Z.js → chunk-TC3VNKGX.js} +4 -4
- package/dist/{chunk-7K5Q6COX.js → chunk-TVVEYCNW.js} +4 -4
- package/dist/{chunk-BJJAX3IZ.js → chunk-UTRO5UJU.js} +2 -2
- package/dist/{chunk-DQEMWVMT.js → chunk-UVYI6VIX.js} +1 -1
- package/dist/chunk-VNA7W7QF.js +134 -0
- package/dist/chunk-VNA7W7QF.js.map +1 -0
- package/dist/{chunk-BHLN7L7M.js → chunk-VVIW3PTA.js} +17 -17
- package/dist/chunk-WNIUPHWV.js +152 -0
- package/dist/chunk-WNIUPHWV.js.map +1 -0
- package/dist/chunk-WOCNN776.js +742 -0
- package/dist/chunk-WOCNN776.js.map +1 -0
- package/dist/{chunk-XQ4EH6DI.js → chunk-WONS4RZ2.js} +3 -3
- package/dist/chunk-WRJVB3C2.js +118 -0
- package/dist/chunk-WRJVB3C2.js.map +1 -0
- package/dist/{chunk-HORJVJ6K.js → chunk-WZ7UB7XQ.js} +42 -37
- package/dist/chunk-WZ7UB7XQ.js.map +1 -0
- package/dist/{chunk-MEBQFQ26.js → chunk-XEQ7OT7U.js} +8 -6
- package/dist/chunk-XEQ7OT7U.js.map +1 -0
- package/dist/{chunk-CSXHRAJJ.js → chunk-XOZ4ALGB.js} +3 -3
- package/dist/{chunk-XKO7BM2C.js → chunk-YGHMSDLK.js} +187 -26
- package/dist/chunk-YGHMSDLK.js.map +1 -0
- package/dist/chunk-YXZG5TVN.js +40 -0
- package/dist/chunk-YXZG5TVN.js.map +1 -0
- package/dist/{chunk-6NNNURLK.js → chunk-Z54EM5YZ.js} +4 -4
- package/dist/{chunk-YSGBD3QN.js → chunk-ZGOQTOYA.js} +3 -3
- package/dist/{chunk-4DJQYKMN.js → chunk-ZIKENA2C.js} +2 -2
- package/dist/chunk-ZIKENA2C.js.map +1 -0
- package/dist/{chunk-RNY3BO35.js → chunk-ZXAGJFHJ.js} +4 -4
- package/dist/{cli-Bz7X7dGx.d.ts → cli-CxoSOiG0.d.ts} +5 -5
- package/dist/cli.d.ts +14 -12
- package/dist/cli.js +73 -68
- package/dist/compounding/engine.d.ts +3 -2
- package/dist/compounding/engine.js +15 -13
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +4 -2
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +14 -12
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +15 -13
- package/dist/consolidation-provenance-check.d.ts +3 -2
- package/dist/consolidation-undo.d.ts +3 -2
- package/dist/contradiction/index.d.ts +3 -2
- package/dist/contradiction/index.js +6 -6
- package/dist/{contradiction-scan-HMF7CNKD.js → contradiction-scan-HYLIRMJ2.js} +3 -3
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/backend.js +2 -2
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/corpus-watermark.d.ts +15 -2
- package/dist/corpus-watermark.js +27 -23
- package/dist/day-summary.d.ts +1 -1
- package/dist/day-summary.js +2 -2
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/embedding-fallback.js +2 -2
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-id-normalization.d.ts +4 -0
- package/dist/entity-id-normalization.js +10 -0
- package/dist/entity-id-normalization.js.map +1 -0
- package/dist/entity-retrieval-boundaries.d.ts +3 -0
- package/dist/entity-retrieval-boundaries.js +8 -0
- package/dist/entity-retrieval-boundaries.js.map +1 -0
- package/dist/entity-retrieval.d.ts +3 -2
- package/dist/entity-retrieval.js +15 -12
- package/dist/entity-schema.d.ts +1 -1
- package/dist/entity-schema.js +1 -1
- package/dist/explicit-capture.d.ts +9 -8
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-error-classification.d.ts +1 -1
- package/dist/extraction-faithfulness.d.ts +1 -1
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction-liveness.d.ts +1 -1
- package/dist/extraction-source-grounding-helpers.d.ts +34 -0
- package/dist/extraction-source-grounding-helpers.js +62 -0
- package/dist/extraction-source-grounding-helpers.js.map +1 -0
- package/dist/extraction-source-grounding-rules.d.ts +18 -0
- package/dist/extraction-source-grounding-rules.js +12 -0
- package/dist/extraction-source-grounding-rules.js.map +1 -0
- package/dist/extraction-source-grounding.d.ts +11 -0
- package/dist/extraction-source-grounding.js +13 -0
- package/dist/extraction-source-grounding.js.map +1 -0
- package/dist/extraction.d.ts +3 -1
- package/dist/extraction.js +7 -4
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-LEXL3XYL.js → first-start-migration-F2QJD66E.js} +2 -2
- package/dist/graph-dashboard-diff.d.ts +1 -1
- package/dist/graph-dashboard-key.d.ts +1 -1
- package/dist/graph-dashboard-parser.d.ts +1 -1
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/importers/index.d.ts +1 -1
- package/dist/in-flight-reads.d.ts +1 -1
- package/dist/index.d.ts +407 -405
- package/dist/index.js +154 -145
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +2 -2
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +2 -2
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/local-llm.js +2 -2
- package/dist/local-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +14 -12
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -12
- package/dist/maintenance/rebuild-memory-projection.d.ts +3 -2
- package/dist/maintenance/rebuild-memory-projection.js +15 -13
- package/dist/{maintenance-DgnD2z8S.d.ts → maintenance-Cb-PjxQd.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +13 -10
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-mutations.d.ts +4 -0
- package/dist/memory-projection-mutations.js +15 -0
- package/dist/memory-projection-mutations.js.map +1 -0
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +3 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +4 -3
- package/dist/namespaces/migrate.js +24 -22
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/principal.js +2 -2
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +10 -10
- package/dist/namespaces/storage.d.ts +4 -3
- package/dist/namespaces/storage.js +14 -12
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/offline-sync-impression-drain.js +7 -7
- package/dist/operator-doctor-corpus.d.ts +22 -3
- package/dist/operator-doctor-corpus.js +34 -24
- package/dist/operator-doctor-replica.d.ts +52 -0
- package/dist/operator-doctor-replica.js +15 -0
- package/dist/operator-doctor-replica.js.map +1 -0
- package/dist/operator-toolkit.d.ts +7 -3
- package/dist/operator-toolkit.js +37 -31
- package/dist/orchestration/compression-guideline-coordinator.d.ts +3 -2
- package/dist/orchestration/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.d.ts +5 -4
- package/dist/orchestration/maintenance.js +21 -19
- package/dist/{orchestrator-rIHmHpv1.d.ts → orchestrator-5GKqb_HL.d.ts} +7 -7
- package/dist/orchestrator.d.ts +9 -8
- package/dist/orchestrator.js +105 -96
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-Bq5zU6Bp.d.ts → pipeline-3Qi1TpRo.d.ts} +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/proactive-contention.d.ts +1 -1
- package/dist/provenance.d.ts +1 -1
- package/dist/{qmd-3ILJkC70.d.ts → qmd-D9JqzzRX.d.ts} +1 -1
- package/dist/qmd-preflight.d.ts +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +2 -2
- package/dist/recall-concurrency-config.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-memory-map.d.ts +1 -1
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-state.js +2 -2
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-timings.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/replay/normalizers/chatgpt.d.ts +1 -1
- package/dist/replay/normalizers/claude.d.ts +1 -1
- package/dist/replay/normalizers/openclaw.d.ts +1 -1
- package/dist/replay/normalizers/shared.d.ts +1 -1
- package/dist/replay/runner.d.ts +1 -1
- package/dist/replay/types.d.ts +1 -1
- package/dist/replica-divergence.d.ts +279 -0
- package/dist/replica-divergence.js +28 -0
- package/dist/replica-divergence.js.map +1 -0
- package/dist/replica-peers-config.d.ts +5 -0
- package/dist/replica-peers-config.js +13 -0
- package/dist/replica-peers-config.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +21 -2
- package/dist/resolve-auth-token.js +5 -1
- package/dist/resume-bundles.js +5 -3
- package/dist/retrieval-agents.d.ts +2 -2
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/salvage-envelope.d.ts +1 -1
- package/dist/schemas.d.ts +54 -54
- package/dist/{scope-profiles-D0-ff4xT.d.ts → scope-profiles-C4g6_UdP.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/embed-helper.js +2 -2
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +9 -9
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +9 -9
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-4Tfh7c1g.d.ts → semantic-consolidation-BrxqnzTW.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +15 -13
- package/dist/semantic-rule-promotion.js +14 -12
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +14 -12
- package/dist/{service-cTvil7D_.d.ts → service-Bi1JgxdP.d.ts} +2 -2
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +9 -9
- package/dist/shared-context/manager.js +2 -2
- package/dist/signal.d.ts +1 -1
- package/dist/{storage-C9ibpTme.d.ts → storage-CcH6yPk2.d.ts} +13 -19
- package/dist/storage.d.ts +3 -2
- package/dist/storage.js +15 -12
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +3 -2
- package/dist/temporal-timeline-recall.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +3 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/{tier-stats-XKD7SXYY.js → tier-stats-OPTSBNRH.js} +2 -2
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/backup.js +2 -2
- package/dist/transfer/capsule-export.js +2 -2
- package/dist/transfer/capsule-import.js +2 -2
- package/dist/transfer/types.d.ts +66 -66
- package/dist/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-DHBxIF0s.d.ts → types-Dg0w9ADr.d.ts} +54 -4
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +14 -12
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/access-health-types.ts +8 -0
- package/src/access-http.test.ts +4 -0
- package/src/access-service-health.test.ts +23 -0
- package/src/access-service.ts +27 -4
- package/src/capabilities.test.ts +1 -0
- package/src/capabilities.ts +7 -7
- package/src/cli.ts +9 -7
- package/src/config.test.ts +5 -0
- package/src/config.ts +3 -2
- package/src/corpus-watermark.test.ts +21 -0
- package/src/corpus-watermark.ts +25 -3
- package/src/entity-id-normalization.ts +55 -0
- package/src/entity-retrieval-boundaries.ts +134 -0
- package/src/entity-retrieval.ts +253 -27
- package/src/entity-schema.ts +2 -1
- package/src/extraction-source-grounding-helpers.ts +603 -0
- package/src/extraction-source-grounding-rules.ts +1031 -0
- package/src/extraction-source-grounding.test.ts +2337 -0
- package/src/extraction-source-grounding.ts +50 -0
- package/src/extraction.ts +120 -15
- package/src/memory-projection-mutations.ts +132 -0
- package/src/namespaces/storage.ts +5 -3
- package/src/operator-doctor-corpus.ts +41 -0
- package/src/operator-doctor-replica.test.ts +261 -0
- package/src/operator-doctor-replica.ts +129 -0
- package/src/operator-toolkit.ts +5 -4
- package/src/orchestration/orchestrator-init.ts +2 -2
- package/src/replica-divergence.test.ts +1475 -0
- package/src/replica-divergence.ts +910 -0
- package/src/replica-peers-config.ts +250 -0
- package/src/resolve-auth-token.ts +38 -0
- package/src/storage/entity-canonical-id-migration-adapter.ts +72 -0
- package/src/storage/entity-canonical-id-migration-runner.ts +68 -0
- package/src/storage/entity-canonical-id-migration.ts +904 -0
- package/src/storage/entity-store.ts +44 -0
- package/src/storage/memory-frontmatter-metadata.ts +17 -0
- package/src/storage/memory-migration-serialization.ts +37 -0
- package/src/storage/memory-read-store.ts +3 -2
- package/src/storage/profile-header.ts +8 -7
- package/src/storage-profile-timestamp.test.ts +68 -0
- package/src/storage.ts +68 -69
- package/src/types.ts +5 -5
- package/dist/chunk-2RAC4JIG.js.map +0 -1
- package/dist/chunk-4DJQYKMN.js.map +0 -1
- package/dist/chunk-CIQXI47W.js.map +0 -1
- package/dist/chunk-EOLC6EXV.js.map +0 -1
- package/dist/chunk-GJJBPI6I.js.map +0 -1
- package/dist/chunk-HORJVJ6K.js.map +0 -1
- package/dist/chunk-MEBQFQ26.js.map +0 -1
- package/dist/chunk-NUWMZIYZ.js.map +0 -1
- package/dist/chunk-TKBDJTXG.js.map +0 -1
- package/dist/chunk-V25OWXAC.js.map +0 -1
- package/dist/chunk-XKO7BM2C.js.map +0 -1
- /package/dist/{capsule-crypto-YO5QJ6L3.js.map → capsule-crypto-GWVG7LGC.js.map} +0 -0
- /package/dist/{chunk-2H7OEVPO.js.map → chunk-3GD2HFR6.js.map} +0 -0
- /package/dist/{chunk-4TFIRMTE.js.map → chunk-4A6YGWQN.js.map} +0 -0
- /package/dist/{chunk-JDOJZTFF.js.map → chunk-4PBVXX7L.js.map} +0 -0
- /package/dist/{chunk-IKMAO55B.js.map → chunk-55MDBZLC.js.map} +0 -0
- /package/dist/{chunk-VDX2J7OX.js.map → chunk-5W7CTZ2E.js.map} +0 -0
- /package/dist/{chunk-B7GROTXD.js.map → chunk-6LKEUCEM.js.map} +0 -0
- /package/dist/{chunk-2AJ72VVS.js.map → chunk-7BZOBA5J.js.map} +0 -0
- /package/dist/{chunk-44DUJETW.js.map → chunk-7HXCF4RE.js.map} +0 -0
- /package/dist/{chunk-X3SQYAPP.js.map → chunk-ACXPX4AG.js.map} +0 -0
- /package/dist/{chunk-AJ7QCSIS.js.map → chunk-ALSGMEJR.js.map} +0 -0
- /package/dist/{chunk-JGUXPJUQ.js.map → chunk-AS7YMSL6.js.map} +0 -0
- /package/dist/{chunk-77CNV7DY.js.map → chunk-BLAKS3CP.js.map} +0 -0
- /package/dist/{chunk-5BRT4Z2I.js.map → chunk-CMRQ34J5.js.map} +0 -0
- /package/dist/{chunk-HEXSNYJD.js.map → chunk-CSMCNOPH.js.map} +0 -0
- /package/dist/{chunk-SK3EYPKC.js.map → chunk-D2ANTDGO.js.map} +0 -0
- /package/dist/{chunk-JCVQV6QX.js.map → chunk-D3LMYTBV.js.map} +0 -0
- /package/dist/{chunk-XY7QPJDA.js.map → chunk-E6EE5B67.js.map} +0 -0
- /package/dist/{chunk-LLISELSY.js.map → chunk-EP5BVCRI.js.map} +0 -0
- /package/dist/{chunk-PTN6UAUA.js.map → chunk-ES36HTSC.js.map} +0 -0
- /package/dist/{chunk-WEAO45M4.js.map → chunk-ESBQWC3U.js.map} +0 -0
- /package/dist/{chunk-EUSLKI4X.js.map → chunk-EVX44I7C.js.map} +0 -0
- /package/dist/{chunk-X6ROIHFE.js.map → chunk-G5R3D5UP.js.map} +0 -0
- /package/dist/{chunk-MG6MNSP4.js.map → chunk-G6LBWZRF.js.map} +0 -0
- /package/dist/{chunk-FRVTCCGD.js.map → chunk-GGUBDXRR.js.map} +0 -0
- /package/dist/{chunk-QH6CS6XJ.js.map → chunk-H24WNPA2.js.map} +0 -0
- /package/dist/{chunk-MQVINOJQ.js.map → chunk-IYZ5K7MU.js.map} +0 -0
- /package/dist/{chunk-RPA2RX5P.js.map → chunk-JDZRYH2N.js.map} +0 -0
- /package/dist/{chunk-M5EPMNS4.js.map → chunk-K5GB36ME.js.map} +0 -0
- /package/dist/{chunk-UT3OQPFA.js.map → chunk-KUJQHXPH.js.map} +0 -0
- /package/dist/{chunk-7RZJWZ46.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-EYJSW2RV.js.map → chunk-NBDCZWP4.js.map} +0 -0
- /package/dist/{chunk-XKGPIWGI.js.map → chunk-OFHFH655.js.map} +0 -0
- /package/dist/{chunk-FGBJBYWP.js.map → chunk-OVRQLAYR.js.map} +0 -0
- /package/dist/{chunk-BXLOS5AJ.js.map → chunk-OWHERGF2.js.map} +0 -0
- /package/dist/{chunk-U3TH5Q2Q.js.map → chunk-P3MH72CI.js.map} +0 -0
- /package/dist/{chunk-P2OZKKYP.js.map → chunk-PHWUFPCO.js.map} +0 -0
- /package/dist/{chunk-KGTD2KZJ.js.map → chunk-PKRIQL3V.js.map} +0 -0
- /package/dist/{chunk-4MJZTF42.js.map → chunk-QAOGGNE3.js.map} +0 -0
- /package/dist/{chunk-2QSZNTDO.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-FCCMFVS6.js.map → chunk-RPSYDM6C.js.map} +0 -0
- /package/dist/{chunk-RYHWZ52A.js.map → chunk-S2BBISHU.js.map} +0 -0
- /package/dist/{chunk-RSYJV25N.js.map → chunk-SG265CVF.js.map} +0 -0
- /package/dist/{chunk-UGH6VPPO.js.map → chunk-SH6YO3LT.js.map} +0 -0
- /package/dist/{chunk-FMLKOL2Z.js.map → chunk-TC3VNKGX.js.map} +0 -0
- /package/dist/{chunk-7K5Q6COX.js.map → chunk-TVVEYCNW.js.map} +0 -0
- /package/dist/{chunk-BJJAX3IZ.js.map → chunk-UTRO5UJU.js.map} +0 -0
- /package/dist/{chunk-DQEMWVMT.js.map → chunk-UVYI6VIX.js.map} +0 -0
- /package/dist/{chunk-BHLN7L7M.js.map → chunk-VVIW3PTA.js.map} +0 -0
- /package/dist/{chunk-XQ4EH6DI.js.map → chunk-WONS4RZ2.js.map} +0 -0
- /package/dist/{chunk-CSXHRAJJ.js.map → chunk-XOZ4ALGB.js.map} +0 -0
- /package/dist/{chunk-6NNNURLK.js.map → chunk-Z54EM5YZ.js.map} +0 -0
- /package/dist/{chunk-YSGBD3QN.js.map → chunk-ZGOQTOYA.js.map} +0 -0
- /package/dist/{chunk-RNY3BO35.js.map → chunk-ZXAGJFHJ.js.map} +0 -0
- /package/dist/{contradiction-scan-HMF7CNKD.js.map → contradiction-scan-HYLIRMJ2.js.map} +0 -0
- /package/dist/{first-start-migration-LEXL3XYL.js.map → first-start-migration-F2QJD66E.js.map} +0 -0
- /package/dist/{tier-stats-XKD7SXYY.js.map → tier-stats-OPTSBNRH.js.map} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ExtractionResult } from "./types.js";
|
|
2
|
+
import { delinearize } from "./delinearize.js";
|
|
3
|
+
import {
|
|
4
|
+
applyExtractionSourceGrounding as applyGroundingRules,
|
|
5
|
+
filterExtractionResultBySource as filterGroundingRules,
|
|
6
|
+
} from "./extraction-source-grounding-rules.js";
|
|
7
|
+
import type {
|
|
8
|
+
ExtractionGroundingRoleSources,
|
|
9
|
+
ExtractionSourceGroundingOptions,
|
|
10
|
+
} from "./extraction-source-grounding-rules.js";
|
|
11
|
+
|
|
12
|
+
export type { ExtractionGroundingRoleSources, ExtractionSourceGroundingOptions } from "./extraction-source-grounding-rules.js";
|
|
13
|
+
|
|
14
|
+
export function applyExtractionSourceGrounding(
|
|
15
|
+
result: ExtractionResult,
|
|
16
|
+
sourceText: string,
|
|
17
|
+
assertionSourceText: string = sourceText,
|
|
18
|
+
roleAssertionSources: ExtractionGroundingRoleSources | undefined,
|
|
19
|
+
messageTimestamp: Date | undefined,
|
|
20
|
+
options: ExtractionSourceGroundingOptions,
|
|
21
|
+
): ExtractionResult {
|
|
22
|
+
const sourceForGrounding = (source: string | undefined): string | undefined =>
|
|
23
|
+
source === undefined || !options.anchorTemporalExpressions
|
|
24
|
+
? source
|
|
25
|
+
: delinearize(source, result.entities, messageTimestamp ?? new Date());
|
|
26
|
+
const groundedRoleSources = roleAssertionSources === undefined
|
|
27
|
+
? undefined
|
|
28
|
+
: {
|
|
29
|
+
profile: sourceForGrounding(roleAssertionSources.profile),
|
|
30
|
+
identity: sourceForGrounding(roleAssertionSources.identity),
|
|
31
|
+
};
|
|
32
|
+
return applyGroundingRules(
|
|
33
|
+
result,
|
|
34
|
+
sourceForGrounding(sourceText) ?? sourceText,
|
|
35
|
+
sourceForGrounding(assertionSourceText) ?? assertionSourceText,
|
|
36
|
+
groundedRoleSources,
|
|
37
|
+
messageTimestamp,
|
|
38
|
+
options,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function filterExtractionResultBySource(
|
|
43
|
+
result: ExtractionResult,
|
|
44
|
+
source: string,
|
|
45
|
+
assertionSource?: string,
|
|
46
|
+
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
47
|
+
eventTimeNormalizer?: (eventTime: string) => string,
|
|
48
|
+
): ExtractionResult {
|
|
49
|
+
return filterGroundingRules(result, source, assertionSource, roleAssertionSources, eventTimeNormalizer);
|
|
50
|
+
}
|
package/src/extraction.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { normalizeProcedureSteps } from "./procedural/procedure-types.js";
|
|
|
40
40
|
import { normalizeReasoningTrace } from "./reasoning-trace-types.js";
|
|
41
41
|
import { looksLikeMechanicalTelemetryTranscript } from "./telemetry-transcript.js";
|
|
42
42
|
import { buildFactProvenance, type ProvenanceTurnInput } from "./provenance.js";
|
|
43
|
+
import { applyExtractionSourceGrounding, type ExtractionGroundingRoleSources } from "./extraction-source-grounding.js";
|
|
43
44
|
import { isMemoryCategory } from "./write-envelope.js";
|
|
44
45
|
import { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
|
|
45
46
|
export { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
|
|
@@ -656,6 +657,10 @@ export class ExtractionEngine {
|
|
|
656
657
|
private async applyProactiveQuestionPass(
|
|
657
658
|
conversation: string,
|
|
658
659
|
base: ExtractionResult,
|
|
660
|
+
groundingSource: string,
|
|
661
|
+
assertionSource: string,
|
|
662
|
+
messageTimestamp?: Date,
|
|
663
|
+
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
659
664
|
): Promise<ExtractionResult> {
|
|
660
665
|
if (!resolvePipelineProcessingCapabilities(this.config).proactiveExtraction) return base;
|
|
661
666
|
const maxAdditional = Math.max(0, Math.floor(this.config.maxProactiveQuestionsPerExtraction));
|
|
@@ -670,8 +675,16 @@ export class ExtractionEngine {
|
|
|
670
675
|
proactive,
|
|
671
676
|
maxAdditional,
|
|
672
677
|
);
|
|
673
|
-
|
|
674
|
-
|
|
678
|
+
const sanitizedAdditions = this.sanitizeExtractionResult(proactiveAdditions, messageTimestamp);
|
|
679
|
+
const groundedAdditions = this.applySourceGrounding(
|
|
680
|
+
sanitizedAdditions,
|
|
681
|
+
groundingSource,
|
|
682
|
+
assertionSource,
|
|
683
|
+
roleAssertionSources,
|
|
684
|
+
messageTimestamp,
|
|
685
|
+
);
|
|
686
|
+
if (!this.hasExtractionOutputs(groundedAdditions)) return base;
|
|
687
|
+
return this.mergeProactiveExtractionPass(base, groundedAdditions, maxAdditional);
|
|
675
688
|
} catch (err) {
|
|
676
689
|
log.debug(`proactive extraction question pass failed (ignored): ${err}`);
|
|
677
690
|
return base;
|
|
@@ -875,7 +888,7 @@ export class ExtractionEngine {
|
|
|
875
888
|
if (localResponse?.content) {
|
|
876
889
|
const parsed = this.parseProactiveExtractionResultFromText(localResponse.content.trim());
|
|
877
890
|
if (parsed) {
|
|
878
|
-
return
|
|
891
|
+
return parsed;
|
|
879
892
|
}
|
|
880
893
|
}
|
|
881
894
|
if (!this.config.localLlmFallback) {
|
|
@@ -906,12 +919,10 @@ export class ExtractionEngine {
|
|
|
906
919
|
if (!fallbackResult) {
|
|
907
920
|
return { facts: [], profileUpdates: [], entities: [], questions: [] };
|
|
908
921
|
}
|
|
909
|
-
return this.
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
}),
|
|
914
|
-
);
|
|
922
|
+
return this.normalizeExtractionResultPayload({
|
|
923
|
+
...fallbackResult,
|
|
924
|
+
questions: [],
|
|
925
|
+
});
|
|
915
926
|
}
|
|
916
927
|
|
|
917
928
|
private mergeProactiveExtractionPass(
|
|
@@ -1133,6 +1144,40 @@ export class ExtractionEngine {
|
|
|
1133
1144
|
return { ...result, facts };
|
|
1134
1145
|
}
|
|
1135
1146
|
|
|
1147
|
+
private applySourceGrounding(
|
|
1148
|
+
result: ExtractionResult,
|
|
1149
|
+
sourceText: string,
|
|
1150
|
+
assertionSourceText: string = sourceText,
|
|
1151
|
+
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
1152
|
+
messageTimestamp?: Date,
|
|
1153
|
+
): ExtractionResult {
|
|
1154
|
+
const capabilities = resolvePipelineProcessingCapabilities(this.config);
|
|
1155
|
+
return applyExtractionSourceGrounding(
|
|
1156
|
+
result,
|
|
1157
|
+
sourceText,
|
|
1158
|
+
assertionSourceText,
|
|
1159
|
+
roleAssertionSources,
|
|
1160
|
+
messageTimestamp,
|
|
1161
|
+
{
|
|
1162
|
+
sourceGrounding: capabilities.sourceGrounding,
|
|
1163
|
+
anchorTemporalExpressions: capabilities.delinearize,
|
|
1164
|
+
},
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
private finalizeExtractionResult(
|
|
1169
|
+
result: ExtractionResult,
|
|
1170
|
+
turns: ReadonlyArray<{
|
|
1171
|
+
content: string;
|
|
1172
|
+
sessionKey?: string;
|
|
1173
|
+
logicalSessionKey?: string;
|
|
1174
|
+
timestamp: string;
|
|
1175
|
+
turnFingerprint?: string;
|
|
1176
|
+
}>,
|
|
1177
|
+
): ExtractionResult {
|
|
1178
|
+
return this.attachProvenanceToResult(result, turns);
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1136
1181
|
async extract(turns: BufferTurn[], existingEntities?: string[]): Promise<ExtractionResult> {
|
|
1137
1182
|
const lifecycleCaps = resolveMemoryLifecycleCapabilities(this.config);
|
|
1138
1183
|
|
|
@@ -1158,6 +1203,24 @@ export class ExtractionEngine {
|
|
|
1158
1203
|
return `[${roleLabel}] ${t.content}`;
|
|
1159
1204
|
})
|
|
1160
1205
|
.join("\n\n");
|
|
1206
|
+
|
|
1207
|
+
const groundingSource = boundedTurns
|
|
1208
|
+
.map((turn) => turn.content)
|
|
1209
|
+
.join("\n\n");
|
|
1210
|
+
const assertionSource = boundedTurns
|
|
1211
|
+
.filter((turn) => turn.extractionContextOnly !== true)
|
|
1212
|
+
.map((turn) => turn.content)
|
|
1213
|
+
.join("\n\n");
|
|
1214
|
+
const roleAssertionSources: ExtractionGroundingRoleSources = {
|
|
1215
|
+
profile: boundedTurns
|
|
1216
|
+
.filter((turn) => turn.role === "user" && turn.extractionContextOnly !== true)
|
|
1217
|
+
.map((turn) => turn.content)
|
|
1218
|
+
.join("\n\n"),
|
|
1219
|
+
identity: boundedTurns
|
|
1220
|
+
.filter((turn) => turn.role === "assistant" && turn.extractionContextOnly !== true)
|
|
1221
|
+
.map((turn) => turn.content)
|
|
1222
|
+
.join("\n\n"),
|
|
1223
|
+
};
|
|
1161
1224
|
if (conversation.trim().length === 0) {
|
|
1162
1225
|
log.debug("extraction skipped — conversation only contained non-memory work-layer context");
|
|
1163
1226
|
return { facts: [], profileUpdates: [], entities: [], questions: [] };
|
|
@@ -1213,8 +1276,22 @@ export class ExtractionEngine {
|
|
|
1213
1276
|
this.emit({ kind: "llm_end", traceId, model: this.config.localLlmModel, operation: "extraction", durationMs });
|
|
1214
1277
|
log.debug(`extraction: used local LLM — ${localResult.facts.length} facts, ${localResult.entities.length} entities`);
|
|
1215
1278
|
const sanitized = this.sanitizeExtractionResult(localResult, messageTimestamp);
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1279
|
+
const grounded = this.applySourceGrounding(
|
|
1280
|
+
sanitized,
|
|
1281
|
+
groundingSource,
|
|
1282
|
+
assertionSource,
|
|
1283
|
+
roleAssertionSources,
|
|
1284
|
+
messageTimestamp,
|
|
1285
|
+
);
|
|
1286
|
+
const finalResult = await this.applyProactiveQuestionPass(
|
|
1287
|
+
conversation,
|
|
1288
|
+
grounded,
|
|
1289
|
+
groundingSource,
|
|
1290
|
+
assertionSource,
|
|
1291
|
+
messageTimestamp,
|
|
1292
|
+
roleAssertionSources,
|
|
1293
|
+
);
|
|
1294
|
+
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1218
1295
|
}
|
|
1219
1296
|
// Local failed, fall back if allowed
|
|
1220
1297
|
if (!this.config.localLlmFallback) {
|
|
@@ -1260,8 +1337,22 @@ export class ExtractionEngine {
|
|
|
1260
1337
|
this.emit({ kind: "llm_end", traceId, model: this.config.model, operation: "extraction", durationMs });
|
|
1261
1338
|
log.debug(`extraction: used direct client (${this.config.model}) — ${directResult.facts.length} facts, ${directResult.entities.length} entities`);
|
|
1262
1339
|
const sanitized = this.sanitizeExtractionResult(directResult, messageTimestamp);
|
|
1263
|
-
const
|
|
1264
|
-
|
|
1340
|
+
const grounded = this.applySourceGrounding(
|
|
1341
|
+
sanitized,
|
|
1342
|
+
groundingSource,
|
|
1343
|
+
assertionSource,
|
|
1344
|
+
roleAssertionSources,
|
|
1345
|
+
messageTimestamp,
|
|
1346
|
+
);
|
|
1347
|
+
const finalResult = await this.applyProactiveQuestionPass(
|
|
1348
|
+
conversation,
|
|
1349
|
+
grounded,
|
|
1350
|
+
groundingSource,
|
|
1351
|
+
assertionSource,
|
|
1352
|
+
messageTimestamp,
|
|
1353
|
+
roleAssertionSources,
|
|
1354
|
+
);
|
|
1355
|
+
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1265
1356
|
}
|
|
1266
1357
|
// Emit error event so Opik sees the direct client failure before fallback.
|
|
1267
1358
|
// Wrapped in try/catch so a subscriber error doesn't break the fallback path.
|
|
@@ -1345,8 +1436,22 @@ export class ExtractionEngine {
|
|
|
1345
1436
|
);
|
|
1346
1437
|
const normalized = this.normalizeExtractionResultPayload(result);
|
|
1347
1438
|
const sanitized = this.sanitizeExtractionResult(normalized, messageTimestamp);
|
|
1348
|
-
const
|
|
1349
|
-
|
|
1439
|
+
const grounded = this.applySourceGrounding(
|
|
1440
|
+
sanitized,
|
|
1441
|
+
groundingSource,
|
|
1442
|
+
assertionSource,
|
|
1443
|
+
roleAssertionSources,
|
|
1444
|
+
messageTimestamp,
|
|
1445
|
+
);
|
|
1446
|
+
const finalResult = await this.applyProactiveQuestionPass(
|
|
1447
|
+
conversation,
|
|
1448
|
+
grounded,
|
|
1449
|
+
groundingSource,
|
|
1450
|
+
assertionSource,
|
|
1451
|
+
messageTimestamp,
|
|
1452
|
+
roleAssertionSources,
|
|
1453
|
+
);
|
|
1454
|
+
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1350
1455
|
}
|
|
1351
1456
|
|
|
1352
1457
|
this.emit({
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { lstat, realpath } from "node:fs/promises";
|
|
2
|
+
import { isErrnoCode } from "./utils/errno.js";
|
|
3
|
+
import { assertPathInsideRoot } from "./utils/path-containment.js";
|
|
4
|
+
import { getMemoryProjectionPath, initializeMemoryProjectionDb } from "./memory-projection-store.js";
|
|
5
|
+
import { type BetterSqlite3Database, openBetterSqlite3 } from "./runtime/better-sqlite.js";
|
|
6
|
+
|
|
7
|
+
const PROJECTION_WRITE_BUSY_TIMEOUT_MS = 100;
|
|
8
|
+
const PROJECTION_WRITE_RETRY_COUNT = 4;
|
|
9
|
+
const PROJECTION_WRITE_RETRY_DELAY_MS = 100;
|
|
10
|
+
|
|
11
|
+
function isSqliteBusyError(error: unknown): boolean {
|
|
12
|
+
const messages: string[] = [];
|
|
13
|
+
const seen = new Set<unknown>();
|
|
14
|
+
let current: unknown = error;
|
|
15
|
+
while (current !== null && typeof current === "object" && !seen.has(current)) {
|
|
16
|
+
seen.add(current);
|
|
17
|
+
if (current instanceof Error) messages.push(current.message);
|
|
18
|
+
if (!("cause" in current)) break;
|
|
19
|
+
current = current.cause;
|
|
20
|
+
}
|
|
21
|
+
const lower = messages.join("\n").toLowerCase();
|
|
22
|
+
return lower.includes("database is locked") || lower.includes("sqlite_busy");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function validateProjectionPath(
|
|
26
|
+
memoryDir: string,
|
|
27
|
+
projectionPath: string,
|
|
28
|
+
): Promise<boolean> {
|
|
29
|
+
let projectionStat;
|
|
30
|
+
try {
|
|
31
|
+
projectionStat = await lstat(projectionPath);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (isErrnoCode(error, "ENOENT")) return false;
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
if (projectionStat.isSymbolicLink() || !projectionStat.isFile()) {
|
|
37
|
+
throw new Error(`Refusing memory projection rewrite through unsafe database path: ${projectionPath}.`);
|
|
38
|
+
}
|
|
39
|
+
const [memoryRoot, projectionReal] = await Promise.all([
|
|
40
|
+
realpath(memoryDir),
|
|
41
|
+
realpath(projectionPath),
|
|
42
|
+
]);
|
|
43
|
+
assertPathInsideRoot(memoryRoot, projectionReal, projectionPath);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function rewriteProjectedEntityReferenceRows(
|
|
48
|
+
memoryDir: string,
|
|
49
|
+
entries: ReadonlyArray<readonly [string, string]>,
|
|
50
|
+
memoryId?: string,
|
|
51
|
+
): Promise<void> {
|
|
52
|
+
if (memoryId !== undefined && memoryId.length === 0) {
|
|
53
|
+
throw new Error("Projection memoryId must not be empty.");
|
|
54
|
+
}
|
|
55
|
+
const scopedMemory = memoryId !== undefined;
|
|
56
|
+
const validEntries = entries.filter(
|
|
57
|
+
([previousEntityRef, nextEntityRef]) =>
|
|
58
|
+
previousEntityRef.length > 0 && nextEntityRef.length > 0 && previousEntityRef !== nextEntityRef,
|
|
59
|
+
);
|
|
60
|
+
if (validEntries.length === 0) return;
|
|
61
|
+
|
|
62
|
+
const projectionPath = getMemoryProjectionPath(memoryDir);
|
|
63
|
+
if (!(await validateProjectionPath(memoryDir, projectionPath))) return;
|
|
64
|
+
|
|
65
|
+
let lastError: unknown;
|
|
66
|
+
for (let attempt = 0; attempt < PROJECTION_WRITE_RETRY_COUNT; attempt += 1) {
|
|
67
|
+
if (!(await validateProjectionPath(memoryDir, projectionPath))) return;
|
|
68
|
+
let db: BetterSqlite3Database | null = null;
|
|
69
|
+
try {
|
|
70
|
+
db = openBetterSqlite3(projectionPath, { fileMustExist: true });
|
|
71
|
+
db.pragma(`busy_timeout = ${PROJECTION_WRITE_BUSY_TIMEOUT_MS}`);
|
|
72
|
+
initializeMemoryProjectionDb(db);
|
|
73
|
+
const updateCurrent = db.prepare(
|
|
74
|
+
scopedMemory
|
|
75
|
+
? "UPDATE memory_current SET entity_ref = ? WHERE memory_id = ? AND entity_ref = ?"
|
|
76
|
+
: "UPDATE memory_current SET entity_ref = ? WHERE entity_ref = ?",
|
|
77
|
+
);
|
|
78
|
+
const updateMentions = db.prepare(
|
|
79
|
+
scopedMemory
|
|
80
|
+
? `
|
|
81
|
+
UPDATE memory_entity_mentions
|
|
82
|
+
SET entity_ref = ?
|
|
83
|
+
WHERE memory_id = ? AND entity_ref = ? AND mention_source = 'frontmatter.entityRef'
|
|
84
|
+
`
|
|
85
|
+
: `
|
|
86
|
+
UPDATE memory_entity_mentions
|
|
87
|
+
SET entity_ref = ?
|
|
88
|
+
WHERE entity_ref = ? AND mention_source = 'frontmatter.entityRef'
|
|
89
|
+
`,
|
|
90
|
+
);
|
|
91
|
+
const rewrite = db.transaction(() => {
|
|
92
|
+
for (const [previousEntityRef, nextEntityRef] of validEntries) {
|
|
93
|
+
const params = scopedMemory
|
|
94
|
+
? [nextEntityRef, memoryId, previousEntityRef]
|
|
95
|
+
: [nextEntityRef, previousEntityRef];
|
|
96
|
+
updateCurrent.run(...params);
|
|
97
|
+
updateMentions.run(...params);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
rewrite();
|
|
101
|
+
return;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
lastError = error;
|
|
104
|
+
if (!isSqliteBusyError(error) || attempt === PROJECTION_WRITE_RETRY_COUNT - 1) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
const { promise, resolve } = Promise.withResolvers<void>();
|
|
108
|
+
setTimeout(resolve, PROJECTION_WRITE_RETRY_DELAY_MS);
|
|
109
|
+
await promise;
|
|
110
|
+
} finally {
|
|
111
|
+
db?.close();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
throw lastError instanceof Error ? lastError : new Error("Projection rewrite failed.");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export async function rewriteProjectedMemoryEntityReference(
|
|
119
|
+
memoryDir: string,
|
|
120
|
+
memoryId: string,
|
|
121
|
+
previousEntityRef: string,
|
|
122
|
+
nextEntityRef: string,
|
|
123
|
+
): Promise<void> {
|
|
124
|
+
await rewriteProjectedEntityReferenceRows(memoryDir, [[previousEntityRef, nextEntityRef]], memoryId);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export async function rewriteProjectedEntityReferences(
|
|
128
|
+
memoryDir: string,
|
|
129
|
+
replacements: Readonly<Record<string, string>>,
|
|
130
|
+
): Promise<void> {
|
|
131
|
+
await rewriteProjectedEntityReferenceRows(memoryDir, Object.entries(replacements));
|
|
132
|
+
}
|
|
@@ -284,6 +284,7 @@ export class NamespaceStorageRouter {
|
|
|
284
284
|
root = await this.defaultNamespaceRoot();
|
|
285
285
|
const cached = this.cache.get(ns);
|
|
286
286
|
if (cached && cached.dir === root) {
|
|
287
|
+
await this.applySecureStoreConfig(cached);
|
|
287
288
|
this.notifyResolved(ns, root);
|
|
288
289
|
return cached;
|
|
289
290
|
}
|
|
@@ -291,6 +292,7 @@ export class NamespaceStorageRouter {
|
|
|
291
292
|
const cached = this.cache.get(ns);
|
|
292
293
|
root = await this.namespaceRoot(ns);
|
|
293
294
|
if (cached && cached.dir === root) {
|
|
295
|
+
await this.applySecureStoreConfig(cached);
|
|
294
296
|
this.notifyResolved(ns, root);
|
|
295
297
|
return cached;
|
|
296
298
|
}
|
|
@@ -335,7 +337,7 @@ export class NamespaceStorageRouter {
|
|
|
335
337
|
// recovery paths (e.g. the CLI lifecycle-ledger rebuild) refuse an encrypted
|
|
336
338
|
// ledger they could actually rewrite, and namespace writes could silently
|
|
337
339
|
// fall back to plaintext. Mirror the orchestrator's setup exactly.
|
|
338
|
-
this.applySecureStoreConfig(sm);
|
|
340
|
+
await this.applySecureStoreConfig(sm);
|
|
339
341
|
this.cache.set(ns, sm);
|
|
340
342
|
// #2019: let the orchestrator wire write-triggered prioritized embedding on
|
|
341
343
|
// every router-created namespace storage, not just the primary default store.
|
|
@@ -478,12 +480,12 @@ export class NamespaceStorageRouter {
|
|
|
478
480
|
* root keyring id — exactly the id the orchestrator and `secure-store unlock`
|
|
479
481
|
* register under. No-op when secure-store is disabled.
|
|
480
482
|
*/
|
|
481
|
-
private applySecureStoreConfig(sm: StorageManager): void {
|
|
483
|
+
private async applySecureStoreConfig(sm: StorageManager): Promise<void> {
|
|
482
484
|
if (!resolveRecallAuxiliaryCapabilities(this.config).secureStore) return;
|
|
483
485
|
sm.setSecureStoreRequired(true);
|
|
484
486
|
const existingKey = keyring.getKey(secureStoreDir(this.config.memoryDir));
|
|
485
487
|
if (existingKey) {
|
|
486
|
-
sm.
|
|
488
|
+
await sm.setSecureStoreKeyAndWait(existingKey, this.config.secureStoreEncryptOnWrite);
|
|
487
489
|
}
|
|
488
490
|
}
|
|
489
491
|
|
|
@@ -23,7 +23,9 @@ import {
|
|
|
23
23
|
computeCorpusWatermarks,
|
|
24
24
|
resolveCorpusNamespaceRoots,
|
|
25
25
|
} from "./corpus-watermark.js";
|
|
26
|
+
import { summarizeReplicaDivergence } from "./operator-doctor-replica.js";
|
|
26
27
|
import type { OperatorDoctorCheck } from "./operator-toolkit.js";
|
|
28
|
+
import type { ResolveSecretRefFn } from "./resolve-auth-token.js";
|
|
27
29
|
import type { PluginConfig } from "./types.js";
|
|
28
30
|
|
|
29
31
|
const DIGEST_PREFIX_LENGTH = 12;
|
|
@@ -93,3 +95,42 @@ export async function summarizeCorpusWatermark(
|
|
|
93
95
|
details: { corpus: watermarks },
|
|
94
96
|
};
|
|
95
97
|
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Extract the watermark array this check stores under `details.corpus` (issue
|
|
101
|
+
* #2149). The replica-divergence doctor check reuses the local watermark set
|
|
102
|
+
* computed here rather than rescanning the corpus, and consumes it through this
|
|
103
|
+
* helper so the `details.corpus` shape stays owned by the module that produces it.
|
|
104
|
+
*/
|
|
105
|
+
export function corpusWatermarksFromCheck(check: OperatorDoctorCheck): CorpusWatermark[] {
|
|
106
|
+
const details = check.details;
|
|
107
|
+
if (!details || typeof details !== "object" || !("corpus" in details) || !Array.isArray(details.corpus)) {
|
|
108
|
+
return [];
|
|
109
|
+
}
|
|
110
|
+
// This check always stores a CorpusWatermark[] under `corpus` (guarded above).
|
|
111
|
+
return details.corpus as CorpusWatermark[];
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Build the corpus-watermark and replica-divergence doctor checks together.
|
|
116
|
+
*
|
|
117
|
+
* They are paired deliberately: the replica comparison consumes the corpus
|
|
118
|
+
* check's watermarks (one scan, not two) AND its completeness — an incomplete
|
|
119
|
+
* local census must not let the replica check certify convergence. The pairing
|
|
120
|
+
* lives HERE, next to the corpus check + `corpusWatermarksFromCheck` it consumes
|
|
121
|
+
* and the `PluginConfig` it needs, so the sibling replica module stays a light
|
|
122
|
+
* tsup DTS entry free of the heavy `PluginConfig` type graph (round 6, coderabbit).
|
|
123
|
+
*/
|
|
124
|
+
export async function summarizeCorpusAndReplica(
|
|
125
|
+
config: PluginConfig,
|
|
126
|
+
storageFactory: (dir: string) => CorpusStorage,
|
|
127
|
+
resolveSecretRef?: ResolveSecretRefFn | null,
|
|
128
|
+
): Promise<OperatorDoctorCheck[]> {
|
|
129
|
+
const watermarkCheck = await summarizeCorpusWatermark(config, storageFactory);
|
|
130
|
+
const replicaCheck = await summarizeReplicaDivergence(
|
|
131
|
+
config.replicaPeers,
|
|
132
|
+
corpusWatermarksFromCheck(watermarkCheck),
|
|
133
|
+
{ resolveSecretRef, localCensusComplete: watermarkCheck.status === "ok" },
|
|
134
|
+
);
|
|
135
|
+
return [watermarkCheck, replicaCheck];
|
|
136
|
+
}
|