@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 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/extraction-source-grounding-rules.ts"],"sourcesContent":["import type { ExtractionResult } from \"./types.js\";\nimport { anchorTemporalExpressions } from \"./delinearize.js\";\nimport {\n GROUNDING_AUXILIARY_TOKENS,\n GROUNDING_COPULAR_FORMS,\n GROUNDING_ENTITY_TYPE_PREFIXES,\n GROUNDING_MIN_COVERAGE,\n GROUNDING_MIN_SHARED_TOKENS,\n GROUNDING_STOPWORDS,\n areGroundingTokensCompatible,\n containsContiguousGroundingTokens,\n containsExactTokenSequence,\n groundingLexemes,\n groundingTokenSequence,\n hasContradictoryPolarity,\n hasExplicitRoleSubjectToken,\n isAttachedNegatedAuxiliary,\n isInterrogativeSourceSentence,\n normalizeForExactMatch,\n normalizedGroundingAlignmentTokenSequence,\n normalizedGroundingTokenSequence,\n sourceSentences,\n splitGroundingClauses,\n stemToken,\n tokenize,\n tokenSequence,\n} from \"./extraction-source-grounding-helpers.js\";\n\nexport interface ExtractionSourceGroundingOptions {\n sourceGrounding: boolean;\n anchorTemporalExpressions: boolean;\n}\n\nexport function applyExtractionSourceGrounding(\n result: ExtractionResult,\n sourceText: string,\n assertionSourceText: string = sourceText,\n roleAssertionSources: ExtractionGroundingRoleSources | undefined,\n messageTimestamp: Date | undefined,\n options: ExtractionSourceGroundingOptions,\n): ExtractionResult {\n if (!options.sourceGrounding) return result;\n const anchorSource = (source: string): string =>\n options.anchorTemporalExpressions\n ? anchorTemporalExpressions(source, messageTimestamp ?? new Date())\n : source;\n const anchoredRoleSources = roleAssertionSources === undefined\n ? undefined\n : {\n profile: roleAssertionSources.profile === undefined\n ? undefined\n : anchorSource(roleAssertionSources.profile),\n identity: roleAssertionSources.identity === undefined\n ? undefined\n : anchorSource(roleAssertionSources.identity),\n };\n return filterExtractionResultBySource(\n result,\n anchorSource(sourceText),\n anchorSource(assertionSourceText),\n anchoredRoleSources,\n options.anchorTemporalExpressions ? anchorSource : undefined,\n );\n}\n\nexport interface ExtractionGroundingRoleSources {\n profile?: string;\n identity?: string;\n}\n\n\n\ninterface GroundingCopularClaim {\n subject: string;\n predicate: string;\n}\n\nfunction groundingCopularClaim(text: string): GroundingCopularClaim | undefined {\n const lexemes = groundingLexemes(text);\n const copulaIndex = lexemes.findIndex(({ token }) => GROUNDING_COPULAR_FORMS.has(token));\n if (copulaIndex <= 0) return undefined;\n\n let subjectIndex = copulaIndex - 1;\n while (\n subjectIndex >= 0\n && GROUNDING_AUXILIARY_TOKENS.has(lexemes[subjectIndex]!.token)\n ) {\n subjectIndex -= 1;\n }\n const subjectLexeme = lexemes[subjectIndex];\n const predicateLexeme = lexemes\n .slice(copulaIndex + 1)\n .find(({ token }) => GROUNDING_STOPWORDS[token] !== true);\n if (subjectLexeme === undefined || predicateLexeme === undefined) return undefined;\n\n return {\n subject: stemToken(subjectLexeme.token, subjectLexeme.preserveTerminalS),\n predicate: stemToken(predicateLexeme.token, predicateLexeme.preserveTerminalS),\n };\n}\n\nfunction hasCopularPredicateEvidence(candidate: string, source: string): boolean {\n const candidateClaim = groundingCopularClaim(candidate);\n if (candidateClaim === undefined) return true;\n const sourceClaim = groundingCopularClaim(source);\n return sourceClaim !== undefined\n && areGroundingTokensCompatible(candidateClaim.subject, sourceClaim.subject)\n && areGroundingTokensCompatible(candidateClaim.predicate, sourceClaim.predicate);\n}\nconst GROUNDING_ALIGNMENT_MODIFIERS = new Set([\n \"actively\",\n \"again\",\n \"already\",\n \"currently\",\n \"eventually\",\n \"finally\",\n \"generally\",\n \"mainly\",\n \"newly\",\n \"now\",\n \"often\",\n \"previously\",\n \"primarily\",\n \"quickly\",\n \"recently\",\n \"repeatedly\",\n \"simply\",\n \"slowly\",\n \"sometimes\",\n \"still\",\n \"successfully\",\n \"typically\",\n \"usually\",\n]);\n\nfunction isGroundingAlignmentModifier(token: string): boolean {\n return GROUNDING_ALIGNMENT_MODIFIERS.has(token);\n}\n\n\nfunction hasAlignedSubjectPredicateOverlap(candidate: string, source: string): boolean {\n const candidateTokens = normalizedGroundingAlignmentTokenSequence(candidate);\n const sourceTokens = normalizedGroundingAlignmentTokenSequence(source);\n if (candidateTokens.length < 3 || sourceTokens.length < 3) {\n return hasCopularPredicateEvidence(candidate, source);\n }\n\n const candidateSubject = candidateTokens[0];\n if (candidateSubject === undefined) return false;\n const hasCorrectionReordering = /\\b(?:rather\\s+than|instead\\s+of)\\b/iu.test(candidate)\n && /\\b(?:not|rather\\s+than|instead\\s+of)\\b/iu.test(source);\n for (let sourceSubjectIndex = 0; sourceSubjectIndex < sourceTokens.length; sourceSubjectIndex += 1) {\n if (!areGroundingTokensCompatible(candidateSubject, sourceTokens[sourceSubjectIndex]!)) continue;\n let sourceCursor = sourceSubjectIndex + 1;\n let foundAlignedToken = false;\n let aligned = true;\n for (let candidateIndex = 1; candidateIndex < candidateTokens.length; candidateIndex += 1) {\n const candidateToken = candidateTokens[candidateIndex]!;\n const sourceIndex = sourceTokens.findIndex(\n (sourceToken, index) =>\n index >= sourceCursor && areGroundingTokensCompatible(candidateToken, sourceToken),\n );\n if (sourceIndex === -1) {\n if (hasCorrectionReordering) continue;\n aligned = false;\n break;\n }\n foundAlignedToken = true;\n const candidateNext = candidateTokens[candidateIndex + 1];\n const sourceNext = sourceTokens[sourceIndex + 1];\n if (\n candidateNext !== undefined\n && sourceNext !== undefined\n && !hasCorrectionReordering\n && !areGroundingTokensCompatible(candidateNext, sourceNext)\n && !isGroundingAlignmentModifier(sourceNext)\n ) {\n aligned = false;\n break;\n }\n sourceCursor = sourceIndex + 1;\n }\n if (aligned && foundAlignedToken) return true;\n }\n return false;\n}\n\nfunction groundedTokenScore(\n candidate: string,\n source: string,\n requireAlignedArguments = true,\n requireAllCandidateTokensGrounded = true,\n): number {\n const candidateTokens = tokenize(candidate);\n if (candidateTokens.size === 0) return 0;\n const sourceTokens = tokenize(source);\n const allowCorrectionReordering = /\\b(?:rather\\s+than|instead\\s+of)\\b/iu.test(candidate);\n let sharedTokens = 0;\n let allCandidateTokensGrounded = true;\n for (const token of candidateTokens) {\n if ([...sourceTokens].some((sourceToken) => areGroundingTokensCompatible(token, sourceToken))) {\n sharedTokens += 1;\n } else if (!allowCorrectionReordering && token !== \"rather\" && token !== \"instead\") {\n allCandidateTokensGrounded = false;\n }\n }\n if (\n (requireAllCandidateTokensGrounded && !allCandidateTokensGrounded)\n || sharedTokens < GROUNDING_MIN_SHARED_TOKENS\n || sharedTokens / candidateTokens.size < GROUNDING_MIN_COVERAGE\n ) {\n return 0;\n }\n if (requireAlignedArguments && !hasAlignedSubjectPredicateOverlap(candidate, source)) return 0;\n return sharedTokens / candidateTokens.size;\n}\n\nfunction candidateClauses(candidate: string): string[] {\n return splitGroundingClauses(sourceSentences(candidate));\n}\n\nfunction isSourceGroundedClause(\n candidate: string,\n source: string,\n includeInterrogativeSource = false,\n): boolean {\n let bestSupportedScore = 0;\n let bestContradictedScore = 0;\n const sentences = sourceSentences(source);\n for (let index = 0; index < sentences.length; index += 1) {\n const sentence = sentences[index];\n if (isYesNoAnswer(sentence)) {\n const precedingSentence = sentences[index - 1];\n const answerToken = tokenSequence(sentence)[0];\n const contradictoryPolarity = precedingSentence !== undefined\n ? hasContradictoryPolarity(candidate, precedingSentence)\n : false;\n if (\n precedingSentence !== undefined\n && isInterrogativeSourceSentence(precedingSentence)\n && groundedTokenScore(candidate, precedingSentence) === 1\n && (\n (answerToken === \"yes\" && !contradictoryPolarity)\n || (answerToken === \"no\" && contradictoryPolarity)\n )\n ) {\n return true;\n }\n continue;\n }\n const sentenceText = normalizeForExactMatch(sentence);\n const isExplanatoryLabel = sentenceText.startsWith(`${normalizeForExactMatch(candidate)}:`)\n && !sentence.trim().endsWith(\"?\");\n if (!includeInterrogativeSource && isInterrogativeSourceSentence(sentence) && !isExplanatoryLabel) {\n continue;\n }\n const sourceSpans = /\\b(?:rather\\s+than|instead\\s+of)\\b/iu.test(candidate)\n ? [sentence]\n : splitGroundingClauses([sentence]);\n for (const sourceSpan of sourceSpans) {\n const sourceSpanText = normalizeForExactMatch(sourceSpan);\n if (containsExactTokenSequence(candidate, sourceSpanText)) {\n if (!hasContradictoryPolarity(candidate, sourceSpan)) return true;\n bestContradictedScore = Math.max(bestContradictedScore, 1);\n continue;\n }\n const score = groundedTokenScore(\n candidate,\n sourceSpan,\n !includeInterrogativeSource,\n !includeInterrogativeSource,\n );\n if (score === 0) continue;\n if (hasContradictoryPolarity(candidate, sourceSpan)) {\n bestContradictedScore = Math.max(bestContradictedScore, score);\n } else {\n bestSupportedScore = Math.max(bestSupportedScore, score);\n }\n }\n }\n return bestSupportedScore > bestContradictedScore;\n}\nfunction isSourceGrounded(\n candidate: string,\n source: string,\n includeInterrogativeSource = false,\n): boolean {\n const candidateText = normalizeForExactMatch(candidate);\n const sourceText = source.normalize(\"NFKC\").trim();\n if (candidateText.length === 0 || sourceText.length === 0) return false;\n const hasSupportedExactMatch = sourceSentences(sourceText).some((sentence) => {\n const sentenceText = normalizeForExactMatch(sentence);\n const isExplanatoryLabel = sentenceText.startsWith(`${candidateText}:`)\n && !sentence.trim().endsWith(\"?\");\n if (!includeInterrogativeSource && isInterrogativeSourceSentence(sentence) && !isExplanatoryLabel) return false;\n return containsExactTokenSequence(candidateText, sentenceText)\n && !hasContradictoryPolarity(candidateText, sentenceText);\n });\n if (hasSupportedExactMatch) return true;\n\n const clauses = candidateClauses(candidateText);\n if (clauses.length > 1) {\n return clauses.every((clause) =>\n isSourceGroundedClause(clause, sourceText, includeInterrogativeSource));\n }\n return isSourceGroundedClause(candidateText, sourceText, includeInterrogativeSource);\n}\n\nfunction normalizedEntityIdentifierTokens(name: string): string[] {\n const identifier = normalizeForExactMatch(name).replace(/[-_]+/gu, \" \");\n const tokens = groundingLexemes(identifier)\n .filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)\n .map(({ token }) => stemToken(token, true));\n return tokens.length > 1 && GROUNDING_ENTITY_TYPE_PREFIXES.has(tokens[0] ?? \"\")\n ? tokens.slice(1)\n : tokens;\n}\n\nfunction isGroundedEntityName(name: string, source: string): boolean {\n const nameTokens = normalizedEntityIdentifierTokens(name);\n return nameTokens.length > 0 && sourceSentences(source).some((sentence) => {\n const sentenceTokens = groundingLexemes(sentence)\n .filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)\n .map(({ token, preserveTerminalS }) => stemToken(token, preserveTerminalS));\n return containsContiguousGroundingTokens(nameTokens, sentenceTokens);\n });\n}\nfunction buildEntitySupportSource(name: string, source: string): string {\n const nameTokens = normalizedEntityIdentifierTokens(name);\n if (nameTokens.length === 0) return \"\";\n return sourceSentences(source)\n .filter((sentence) => {\n const sentenceTokens = groundingLexemes(sentence)\n .filter(({ token }) => GROUNDING_STOPWORDS[token] !== true)\n .map(({ token, preserveTerminalS }) => stemToken(token, preserveTerminalS));\n return containsContiguousGroundingTokens(nameTokens, sentenceTokens);\n })\n .join(\" \");\n}\n\nfunction hasGroundedPredicateAnchor(candidate: string, sentence: string): boolean {\n const candidateTokens = normalizedGroundingTokenSequence(candidate);\n const sourceTokens = normalizedGroundingTokenSequence(sentence);\n const comparableCandidateTokens = GROUNDING_ROLE_SUBJECT_TOKENS.has(candidateTokens[0] ?? \"\")\n ? candidateTokens.slice(1)\n : candidateTokens;\n if (comparableCandidateTokens.length < 2) return false;\n const subjectToken = comparableCandidateTokens[0];\n if (subjectToken === undefined || !sourceTokens.includes(subjectToken)) {\n return false;\n }\n const candidatePredicateTokens = comparableCandidateTokens.slice(1);\n const sourceTokenSet = new Set(sourceTokens);\n const sharedPredicateTokens = candidatePredicateTokens.filter((token) => sourceTokenSet.has(token));\n const requiredSharedTokens = Math.min(2, candidatePredicateTokens.length);\n return sharedPredicateTokens.length >= requiredSharedTokens;\n}\nfunction hasGroundingAnchor(\n candidate: string,\n assertionSource: string,\n includeInterrogativeSource = false,\n requirePredicateSupport = false,\n): boolean {\n return sourceSentences(assertionSource).some((sentence) => {\n if (!includeInterrogativeSource && isInterrogativeSourceSentence(sentence)) return false;\n const sourceSpans = /\\b(?:rather\\s+than|instead\\s+of)\\b/iu.test(candidate)\n ? [sentence]\n : splitGroundingClauses([sentence]);\n return sourceSpans.some((sourceSpan) => {\n const exactMatch = containsExactTokenSequence(candidate, sourceSpan)\n && !hasContradictoryPolarity(candidate, sourceSpan);\n if (exactMatch) return true;\n if (requirePredicateSupport && !hasGroundedPredicateAnchor(candidate, sourceSpan)) return false;\n return groundedTokenScore(candidate, sourceSpan) > 0\n || hasRoleNormalizedGrounding(candidate, sourceSpan);\n });\n });\n}\n\nfunction hasAnswerSupport(\n candidate: string,\n source: string,\n assertionSource: string,\n): boolean {\n const assertedAnswerSentences = new Set(\n sourceSentences(assertionSource)\n .filter((sentence) => {\n const answerToken = tokenSequence(sentence)[0];\n return answerToken === \"yes\" || answerToken === \"no\";\n })\n .map((sentence) => normalizeForExactMatch(sentence)),\n );\n if (assertedAnswerSentences.size === 0) return false;\n const sentences = sourceSentences(source);\n return sentences.some((sentence, index) => {\n const answerToken = tokenSequence(sentence)[0];\n if (answerToken !== \"yes\" && answerToken !== \"no\") return false;\n if (!assertedAnswerSentences.has(normalizeForExactMatch(sentence))) return false;\n const precedingSentence = sentences[index - 1];\n if (\n precedingSentence === undefined\n || !isInterrogativeSourceSentence(precedingSentence)\n || groundedTokenScore(candidate, precedingSentence) !== 1\n ) {\n return false;\n }\n const contradictoryPolarity = hasContradictoryPolarity(candidate, precedingSentence);\n return answerToken === \"yes\" ? !contradictoryPolarity : contradictoryPolarity;\n });\n}\n\nconst GROUNDING_ROLE_SUBJECT_TOKENS = new Set([\"assistant\", \"user\"]);\n\nfunction hasRoleNormalizedGrounding(candidate: string, source: string): boolean {\n const candidateTokens = groundingTokenSequence(candidate);\n if (!GROUNDING_ROLE_SUBJECT_TOKENS.has(candidateTokens[0] ?? \"\")) return false;\n const claimTokens = candidateTokens.slice(1);\n if (claimTokens.length === 0) return false;\n\n return sourceSentences(source).some((sentence) => {\n if (isInterrogativeSourceSentence(sentence)) return false;\n const sourceTokens = groundingTokenSequence(sentence);\n const requiredSharedTokens = Math.min(GROUNDING_MIN_SHARED_TOKENS, claimTokens.length);\n let sourceIndex = 0;\n let sharedTokens = 0;\n for (const claimToken of claimTokens) {\n const matchingIndex = sourceTokens.indexOf(claimToken, sourceIndex);\n if (matchingIndex === -1) continue;\n sharedTokens += 1;\n sourceIndex = matchingIndex + 1;\n }\n return sharedTokens >= requiredSharedTokens\n && !hasContradictoryPolarity(candidate, sentence);\n });\n}\n\ninterface GroundingContext {\n source: string;\n assertionSource: string | undefined;\n allowRoleNormalization: boolean;\n fallbackSource?: string;\n fallbackAssertionSource?: string;\n}\n\nfunction resolveGroundingContext(\n candidate: string,\n source: string,\n assertionSource: string | undefined,\n roleAssertionSources: ExtractionGroundingRoleSources | undefined,\n): GroundingContext {\n const candidateRole = groundingTokenSequence(candidate)[0];\n if (!GROUNDING_ROLE_SUBJECT_TOKENS.has(candidateRole ?? \"\")) {\n return { source, assertionSource, allowRoleNormalization: false };\n }\n if (roleAssertionSources === undefined) {\n return { source, assertionSource, allowRoleNormalization: true };\n }\n const roleSource = candidateRole === \"user\"\n ? roleAssertionSources.profile\n : roleAssertionSources.identity;\n return {\n source: roleSource ?? \"\",\n assertionSource: roleSource ?? \"\",\n allowRoleNormalization: true,\n fallbackSource: source,\n fallbackAssertionSource: assertionSource,\n };\n}\n\nfunction selectGroundingContext(candidate: string, context: GroundingContext): GroundingContext {\n if (isGroundedCandidate(\n candidate,\n context.source,\n context.assertionSource,\n false,\n context.allowRoleNormalization,\n )) {\n return context;\n }\n if (\n context.fallbackSource === undefined\n || !hasExplicitRoleSubjectToken(\n groundingTokenSequence(candidate)[0],\n sourceSentences(context.fallbackSource).map((sentence) => groundingTokenSequence(sentence)),\n )\n ) return context;\n const fallbackContext: GroundingContext = {\n source: context.fallbackSource,\n assertionSource: context.fallbackAssertionSource,\n allowRoleNormalization: false,\n };\n return isGroundedCandidate(\n candidate,\n fallbackContext.source,\n fallbackContext.assertionSource,\n false,\n fallbackContext.allowRoleNormalization,\n )\n ? fallbackContext\n : context;\n}\n\nfunction isGroundedCandidate(\n candidate: string,\n source: string,\n assertionSource: string | undefined,\n includeInterrogativeSource = false,\n allowRoleNormalization = false,\n): boolean {\n const allowInterrogativeSource = includeInterrogativeSource\n || (\n assertionSource !== undefined\n && normalizeForExactMatch(assertionSource) !== normalizeForExactMatch(source)\n );\n const sourceGrounded = isSourceGrounded(candidate, source, allowInterrogativeSource);\n const roleGrounded = allowRoleNormalization && hasRoleNormalizedGrounding(candidate, source);\n const candidateTokens = groundingTokenSequence(candidate);\n const roleNormalizedCandidate = allowRoleNormalization\n && GROUNDING_ROLE_SUBJECT_TOKENS.has(candidateTokens[0] ?? \"\");\n if (roleNormalizedCandidate && !roleGrounded) return false;\n if (!sourceGrounded && !roleGrounded) return false;\n if (assertionSource === undefined) return true;\n const clauses = candidateClauses(candidate);\n const requirePredicateSupport = !includeInterrogativeSource\n && assertionSource !== undefined\n && normalizeForExactMatch(assertionSource) !== normalizeForExactMatch(source);\n return clauses.length > 0\n && (\n clauses.every((clause) =>\n hasGroundingAnchor(clause, assertionSource, includeInterrogativeSource, requirePredicateSupport))\n || hasAnswerSupport(candidate, source, assertionSource)\n );\n}\n\nfunction buildFactSupportSource(\n source: string,\n supportingSentences: ReadonlyArray<string>,\n): string {\n const sentences = sourceSentences(source);\n const selectedIndices = new Set<number>();\n for (const supportingSentence of supportingSentences) {\n const supportIndex = sentences.indexOf(supportingSentence);\n if (supportIndex < 0) continue;\n let endIndex = supportIndex;\n while (\n endIndex < sentences.length - 1\n && sentences[endIndex]!.trimEnd().endsWith(\";\")\n && /^(?:its|their|this|that|these|those)\\b/iu.test(\n sentences[endIndex + 1]!.trimStart(),\n )\n ) {\n endIndex += 1;\n }\n for (let index = supportIndex; index <= endIndex; index += 1) {\n selectedIndices.add(index);\n }\n }\n return [...selectedIndices]\n .sort((left, right) => left - right)\n .map((index) => sentences[index]!)\n .join(\" \");\n}\nfunction buildProcedureSupportSource(\n fact: ExtractionResult[\"facts\"][number],\n source: string,\n factSupportSource: string,\n): string {\n if (fact.category !== \"procedure\" || fact.procedureSteps === undefined) return factSupportSource;\n const parentSupportSentences = new Set(\n sourceSentences(factSupportSource).map((sentence) => normalizeForExactMatch(sentence)),\n );\n const parentGroundedSteps = fact.procedureSteps.filter((step) =>\n isGroundedCandidate(step.intent, factSupportSource, undefined, false),\n );\n if (parentGroundedSteps.length === 0) return factSupportSource;\n return sourceSentences(source)\n .filter((sentence) => {\n if (parentSupportSentences.has(normalizeForExactMatch(sentence))) return true;\n const sentenceTokens = tokenize(sentence);\n return parentGroundedSteps.some((step) =>\n [...tokenize(step.intent)].some((token) =>\n [...sentenceTokens].some((sourceToken) => areGroundingTokensCompatible(token, sourceToken)),\n ),\n );\n })\n .join(\" \");\n}\nfunction filterGroundedFact(\n fact: ExtractionResult[\"facts\"][number],\n source: string,\n assertionSource: string | undefined,\n roleAssertionSources: ExtractionGroundingRoleSources | undefined,\n eventTimeNormalizer: ((eventTime: string) => string) | undefined,\n): ExtractionResult[\"facts\"][number] | undefined {\n const factContext = selectGroundingContext(\n fact.content,\n resolveGroundingContext(fact.content, source, assertionSource, roleAssertionSources),\n );\n if (!isGroundedCandidate(\n fact.content,\n factContext.source,\n factContext.assertionSource,\n false,\n factContext.allowRoleNormalization,\n )) return undefined;\n const factEventTime = fact.eventTime;\n const groundedFactEventTime = factEventTime === undefined\n ? undefined\n : eventTimeNormalizer?.(factEventTime) ?? factEventTime;\n const factSupportingSentences = sourceSentences(factContext.assertionSource ?? factContext.source).filter(\n (sentence) =>\n isGroundedCandidate(\n fact.content,\n sentence,\n undefined,\n false,\n factContext.allowRoleNormalization,\n ),\n );\n const factSupportingSource = factEventTime === undefined\n ? factSupportingSentences[0]\n : factSupportingSentences.find((sentence) =>\n isGroundedCandidate(\n groundedFactEventTime ?? factEventTime,\n sentence,\n undefined,\n false,\n factContext.allowRoleNormalization,\n ),\n ) ?? factSupportingSentences[0];\n const eventTimeSource = factSupportingSource ?? factContext.source;\n const eventTimeAssertionSource = factSupportingSource === undefined\n ? factContext.assertionSource\n : undefined;\n\n const factSupportSource = buildFactSupportSource(\n factContext.assertionSource ?? factContext.source,\n factSupportingSentences,\n );\n const groundedAttributes = fact.structuredAttributes\n ? Object.fromEntries(\n Object.entries(fact.structuredAttributes)\n .filter(([key, value]) =>\n isGroundedCandidate(\n `${key}: ${value}`,\n factSupportSource,\n undefined,\n false,\n factContext.allowRoleNormalization,\n ),\n ),\n )\n : undefined;\n const procedureGroundingSource = buildProcedureSupportSource(\n fact,\n factContext.assertionSource ?? factContext.source,\n factSupportSource,\n );\n const groundedProcedureSteps = fact.procedureSteps\n ? fact.procedureSteps.flatMap((step) => {\n if (!isGroundedCandidate(step.intent, procedureGroundingSource, undefined, false)) return [];\n const expectedOutcome = step.expectedOutcome\n && isGroundedCandidate(step.expectedOutcome, procedureGroundingSource, undefined, false)\n ? step.expectedOutcome\n : undefined;\n const toolCall = step.toolCall\n && isGroundedCandidate(step.toolCall.signature, procedureGroundingSource, undefined, false)\n ? step.toolCall\n : undefined;\n const {\n expectedOutcome: _expectedOutcome,\n toolCall: _toolCall,\n ...stepWithoutOptionalFields\n } = step;\n return [{\n ...stepWithoutOptionalFields,\n ...(expectedOutcome !== undefined ? { expectedOutcome } : {}),\n ...(toolCall !== undefined ? { toolCall } : {}),\n }];\n })\n : undefined;\n const groundedReasoningTrace = fact.reasoningTrace\n && fact.reasoningTrace.steps.length > 0\n && isGroundedCandidate(\n fact.reasoningTrace.finalAnswer,\n factContext.source,\n factContext.assertionSource,\n false,\n factContext.allowRoleNormalization,\n )\n && fact.reasoningTrace.steps.every((step) =>\n isGroundedCandidate(\n step.description,\n factContext.source,\n factContext.assertionSource,\n false,\n factContext.allowRoleNormalization,\n ),\n )\n ? {\n steps: fact.reasoningTrace.steps,\n finalAnswer: fact.reasoningTrace.finalAnswer,\n ...(fact.reasoningTrace.observedOutcome\n && isGroundedCandidate(\n fact.reasoningTrace.observedOutcome,\n factContext.source,\n factContext.assertionSource,\n false,\n factContext.allowRoleNormalization,\n )\n ? { observedOutcome: fact.reasoningTrace.observedOutcome }\n : {}),\n }\n : undefined;\n const groundedEventTime = groundedFactEventTime\n && isGroundedCandidate(groundedFactEventTime, eventTimeSource, eventTimeAssertionSource)\n ? factEventTime\n : undefined;\n const groundedEntityRef = fact.entityRef !== undefined\n && isGroundedEntityName(fact.entityRef, factSupportSource)\n ? fact.entityRef\n : undefined;\n const {\n entityRef: _entityRef,\n structuredAttributes: _structuredAttributes,\n procedureSteps: _procedureSteps,\n reasoningTrace: _reasoningTrace,\n eventTime: _eventTime,\n ...factWithoutGroundingFields\n } = fact;\n return {\n ...factWithoutGroundingFields,\n ...(groundedEntityRef !== undefined ? { entityRef: groundedEntityRef } : {}),\n ...(groundedAttributes && Object.keys(groundedAttributes).length > 0\n ? { structuredAttributes: groundedAttributes }\n : {}),\n ...(groundedProcedureSteps && groundedProcedureSteps.length > 0\n ? { procedureSteps: groundedProcedureSteps }\n : {}),\n ...(groundedReasoningTrace !== undefined ? { reasoningTrace: groundedReasoningTrace } : {}),\n ...(groundedEventTime !== undefined ? { eventTime: groundedEventTime } : {}),\n };\n}\n\nfunction filterGroundedEntity(\n entity: ExtractionResult[\"entities\"][number],\n source: string,\n assertionSource: string | undefined,\n): ExtractionResult[\"entities\"][number] | undefined {\n if (!isGroundedEntityName(entity.name, source)) return undefined;\n const entitySource = buildEntitySupportSource(entity.name, source);\n const entityAssertionSource = assertionSource === undefined\n ? undefined\n : buildEntitySupportSource(entity.name, assertionSource);\n const facts = entity.facts.filter((fact) =>\n isGroundedCandidate(fact, entitySource, entityAssertionSource),\n );\n const structuredSections = entity.structuredSections\n ?.flatMap((section) => {\n const groundedFacts = section.facts.filter((fact) =>\n isGroundedCandidate(fact, entitySource, entityAssertionSource),\n );\n return groundedFacts.length > 0\n ? [{ ...section, facts: groundedFacts }]\n : [];\n });\n if (facts.length === 0 && (structuredSections === undefined || structuredSections.length === 0)) {\n return undefined;\n }\n const { structuredSections: _structuredSections, ...entityWithoutSections } = entity;\n return {\n ...entityWithoutSections,\n facts,\n ...(structuredSections && structuredSections.length > 0 ? { structuredSections } : {}),\n };\n}\n\nfunction normalizedEntitySourceText(name: string): string {\n return normalizedEntityIdentifierTokens(name).join(\" \");\n}\n\nfunction isGroundedRelationship(\n relationship: NonNullable<ExtractionResult[\"relationships\"]>[number],\n source: string,\n assertionSource: string | undefined,\n): boolean {\n const sourceName = normalizedEntitySourceText(relationship.source);\n const targetName = normalizedEntitySourceText(relationship.target);\n const labelTokens = tokenize(relationship.label);\n if (sourceName.length === 0 || targetName.length === 0 || labelTokens.size === 0) return false;\n const relationText = `${sourceName} ${relationship.label} ${targetName}`;\n const hasCoherentSourceSpan = sourceSentences(source).some((sentence) => {\n if (isInterrogativeSourceSentence(sentence)) return false;\n return groundedTokenScore(relationText, sentence) === 1\n && !hasContradictoryPolarity(relationText, sentence);\n });\n return hasCoherentSourceSpan\n && isGroundedCandidate(relationText, source, assertionSource);\n}\nconst GROUNDING_TEMPORAL_WORDS = new Set([\n \"today\",\n \"yesterday\",\n \"tomorrow\",\n \"now\",\n \"recently\",\n \"earlier\",\n \"later\",\n \"soon\",\n \"morning\",\n \"afternoon\",\n \"evening\",\n \"tonight\",\n \"night\",\n \"noon\",\n \"midnight\",\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n \"january\",\n \"february\",\n \"march\",\n \"april\",\n \"may\",\n \"june\",\n \"july\",\n \"august\",\n \"september\",\n \"october\",\n \"november\",\n \"december\",\n \"q1\",\n \"q2\",\n \"q3\",\n \"q4\",\n]);\nconst GROUNDING_TEMPORAL_CLOCK_PATTERN = /\\b\\d{1,2}:\\d{2}(?:\\s*[ap]\\.?m\\.?)?\\b/iu;\nconst GROUNDING_TEMPORAL_DURATION_PATTERN = new RegExp(\n \"\\\\b(?:\\\\d+|one|two|three|four|five|six|seven|eight|nine|ten)\\\\s+\"\n + \"(?:seconds?|minutes?|hours?|days?|weeks?|months?|quarters?|years?)\\\\b\",\n \"iu\",\n);\n\nfunction isWhenQuestion(question: string): boolean {\n return /^(?:when|what\\s+(?:time|date)|which\\s+day)\\b/iu.test(question.trim());\n}\nfunction isWhyQuestion(question: string): boolean {\n return /^why\\b/iu.test(question.trim());\n}\n\nfunction hasCausalAnswerEvidence(question: string, sentence: string): boolean {\n if (!isWhyQuestion(question)) return true;\n return /\\b(?:because|since|due\\s+to|owing\\s+to|thanks\\s+to|therefore|thus|hence|so)\\b/iu.test(\n sentence,\n );\n}\n\nfunction hasTemporalAnswerEvidence(question: string, sentence: string): boolean {\n if (!isWhenQuestion(question)) return true;\n return groundingLexemes(sentence).some(({ token }) =>\n GROUNDING_TEMPORAL_WORDS.has(token) || /^(?:19|20)\\d{2}$/u.test(token),\n )\n || GROUNDING_TEMPORAL_CLOCK_PATTERN.test(sentence)\n || GROUNDING_TEMPORAL_DURATION_PATTERN.test(sentence);\n}\n\n\nfunction isUnknownAnswerSentence(sentence: string): boolean {\n return /\\b(?:unknown|unclear|unsure|unresolved|unanswered|not\\s+(?:known|sure|available)|don't\\s+know|do\\s+not\\s+know|no\\s+idea|pending)\\b/iu\n .test(sentence);\n}\n\nfunction isYesNoAnswer(sentence: string): boolean {\n return /^(?:yes|no)(?:[.!?]|,\\s*(?:absolutely|definitely|indeed|exactly|correct|of\\s+course|use\\s+that|do\\s+that)[.!?]?)?$/iu\n .test(sentence.trim());\n}\n\nfunction hasWhAnswerRoleAlignment(question: string, sentence: string): boolean {\n const normalizedQuestion = question.trim();\n const objectQuestionMatch = /^(?:what|which)\\s+.+?\\s+(?:is|are|was|were|do|does|did|can|could|will|would|should|has|have|had)\\s+(.+?)\\s+([^\\s?]+)\\??$/iu\n .exec(normalizedQuestion);\n const sourceTokens = normalizedGroundingTokenSequence(sentence);\n if (objectQuestionMatch !== null) {\n const subjectTokens = groundingTokenSequence(objectQuestionMatch[1] ?? \"\");\n const predicateTokens = groundingTokenSequence(objectQuestionMatch[2] ?? \"\");\n if (subjectTokens.length === 0 || predicateTokens.length === 0) return true;\n let sourceIndex = 0;\n for (const token of [...subjectTokens, ...predicateTokens]) {\n const matchedIndex = sourceTokens.indexOf(token, sourceIndex);\n if (matchedIndex === -1) return false;\n sourceIndex = matchedIndex + 1;\n }\n return true;\n }\n\n const subjectQuestionMatch = /^(?:who|what)\\s+([^\\s?]+)\\s+(.+?)\\??$/iu.exec(normalizedQuestion);\n if (subjectQuestionMatch === null) return true;\n const predicateTokens = groundingTokenSequence(subjectQuestionMatch[1] ?? \"\");\n const objectTokens = groundingTokenSequence(subjectQuestionMatch[2] ?? \"\");\n if (predicateTokens.length === 0 || objectTokens.length === 0) return true;\n const predicateStart = sourceTokens.indexOf(predicateTokens[0]!);\n if (predicateStart === -1) return false;\n let sourceIndex = predicateStart + predicateTokens.length;\n for (const objectToken of objectTokens) {\n const objectIndex = sourceTokens.indexOf(objectToken, sourceIndex);\n if (objectIndex === -1) return false;\n sourceIndex = objectIndex + 1;\n }\n return true;\n}\n\nfunction isQuestionAnsweredBySource(\n question: string,\n source: string,\n assertionSource: string | undefined,\n): boolean {\n const questionTokens = tokenize(question);\n if (questionTokens.size === 0) return false;\n const isYesNoQuestion = /^(?:is|are|am|was|were|do|does|did|can|could|will|would|should|has|have|had)\\b/iu\n .test(question.trim());\n const assertedSentences = new Set(sourceSentences(assertionSource ?? source).map((sentence) => normalizeForExactMatch(sentence)));\n const sentences = sourceSentences(source);\n return sentences.some((sentence, index) => {\n if (!assertedSentences.has(normalizeForExactMatch(sentence))) return false;\n if (isInterrogativeSourceSentence(sentence)) return false;\n if (isYesNoAnswer(sentence)) {\n const precedingSentence = sentences[index - 1];\n return precedingSentence !== undefined\n && isInterrogativeSourceSentence(precedingSentence)\n && groundedTokenScore(question, precedingSentence) === 1;\n }\n if (isUnknownAnswerSentence(sentence)) return false;\n const score = groundedTokenScore(question, sentence, false);\n if (score !== 1) return false;\n const sentenceTokens = tokenize(sentence);\n const hasAnswerToken = [...sentenceTokens].some((token) => !questionTokens.has(token));\n return (isYesNoQuestion || hasAnswerToken)\n && hasTemporalAnswerEvidence(question, sentence)\n && hasCausalAnswerEvidence(question, sentence)\n && hasWhAnswerRoleAlignment(question, sentence);\n });\n}\n\nfunction groundQuestion(\n question: ExtractionResult[\"questions\"][number],\n source: string,\n assertionSource: string | undefined,\n): ExtractionResult[\"questions\"][number] | undefined {\n if (isQuestionAnsweredBySource(question.question, source, assertionSource)) return undefined;\n if (!isGroundedCandidate(question.question, source, assertionSource, true)) return undefined;\n const normalizedContext = question.context.trim();\n if (\n normalizedContext.length > 0\n && !isGroundedCandidate(normalizedContext, assertionSource ?? source, undefined, false)\n ) {\n return { ...question, context: \"\" };\n }\n return question;\n}\n\nexport function filterExtractionResultBySource(\n result: ExtractionResult,\n source: string,\n assertionSource?: string,\n roleAssertionSources?: ExtractionGroundingRoleSources,\n eventTimeNormalizer?: (eventTime: string) => string,\n): ExtractionResult {\n if (source.trim().length === 0) {\n return {\n ...result,\n facts: [],\n profileUpdates: [],\n entities: [],\n questions: [],\n ...(result.relationships !== undefined ? { relationships: [] } : {}),\n identityReflection: undefined,\n };\n }\n\n const facts = result.facts.flatMap((fact) => {\n const grounded = filterGroundedFact(\n fact,\n source,\n assertionSource,\n roleAssertionSources,\n eventTimeNormalizer,\n );\n return grounded === undefined ? [] : [grounded];\n });\n const profileGroundingSource = roleAssertionSources?.profile ?? source;\n const profileAssertionSource = roleAssertionSources?.profile ?? assertionSource;\n const profileUpdates = result.profileUpdates.filter((update) =>\n isGroundedCandidate(update, profileGroundingSource, profileAssertionSource, false, true),\n );\n const entities = result.entities.flatMap((entity) => {\n const grounded = filterGroundedEntity(entity, source, assertionSource);\n return grounded === undefined ? [] : [grounded];\n });\n const questions = result.questions.flatMap((question) => {\n const grounded = groundQuestion(question, source, assertionSource);\n return grounded === undefined ? [] : [grounded];\n });\n const relationships = result.relationships?.filter((relationship) =>\n isGroundedRelationship(relationship, source, assertionSource),\n );\n const identityGroundingSource = roleAssertionSources?.identity ?? source;\n const identityAssertionSource = roleAssertionSources?.identity ?? assertionSource;\n const identityReflection = result.identityReflection\n && isGroundedCandidate(\n result.identityReflection,\n identityGroundingSource,\n identityAssertionSource,\n false,\n true,\n )\n ? result.identityReflection\n : undefined;\n\n return {\n ...result,\n facts,\n profileUpdates,\n entities,\n questions,\n ...(result.relationships !== undefined ? { relationships } : {}),\n ...(identityReflection !== undefined ? { identityReflection } : { identityReflection: undefined }),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCO,SAAS,+BACd,QACA,YACA,sBAA8B,YAC9B,sBACA,kBACA,SACkB;AAClB,MAAI,CAAC,QAAQ,gBAAiB,QAAO;AACrC,QAAM,eAAe,CAAC,WACpB,QAAQ,4BACJ,0BAA0B,QAAQ,oBAAoB,oBAAI,KAAK,CAAC,IAChE;AACN,QAAM,sBAAsB,yBAAyB,SACjD,SACA;AAAA,IACA,SAAS,qBAAqB,YAAY,SACtC,SACA,aAAa,qBAAqB,OAAO;AAAA,IAC7C,UAAU,qBAAqB,aAAa,SACxC,SACA,aAAa,qBAAqB,QAAQ;AAAA,EAChD;AACF,SAAO;AAAA,IACL;AAAA,IACA,aAAa,UAAU;AAAA,IACvB,aAAa,mBAAmB;AAAA,IAChC;AAAA,IACA,QAAQ,4BAA4B,eAAe;AAAA,EACrD;AACF;AAcA,SAAS,sBAAsB,MAAiD;AAC9E,QAAM,UAAU,iBAAiB,IAAI;AACrC,QAAM,cAAc,QAAQ,UAAU,CAAC,EAAE,MAAM,MAAM,wBAAwB,IAAI,KAAK,CAAC;AACvF,MAAI,eAAe,EAAG,QAAO;AAE7B,MAAI,eAAe,cAAc;AACjC,SACE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Q;AAAA,EAChD,CAAC;AACD,QAAM,YAAY,OAAO,UAAU,QAAQ,CAAC,aAAa;AACvD,UAAM,WAAW,eAAe,UAAU,QAAQ,eAAe;AACjE,WAAO,aAAa,SAAY,CAAC,IAAI,CAAC,QAAQ;AAAA,EAChD,CAAC;AACD,QAAM,gBAAgB,OAAO,eAAe;AAAA,IAAO,CAAC,iBAClD,uBAAuB,cAAc,QAAQ,eAAe;AAAA,EAC9D;AACA,QAAM,0BAA0B,sBAAsB,YAAY;AAClE,QAAM,0BAA0B,sBAAsB,YAAY;AAClE,QAAM,qBAAqB,OAAO,sBAC7B;AAAA,IACD,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IACE,OAAO,qBACP;AAEJ,SAAO;AAAA,IACL,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAI,OAAO,kBAAkB,SAAY,EAAE,cAAc,IAAI,CAAC;AAAA,IAC9D,GAAI,uBAAuB,SAAY,EAAE,mBAAmB,IAAI,EAAE,oBAAoB,OAAU;AAAA,EAClG;AACF;","names":["predicateTokens","sourceIndex"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runPostConsolidationMaterialize
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JDZRYH2N.js";
|
|
4
4
|
import {
|
|
5
5
|
discoverMemoryExtensions,
|
|
6
6
|
renderExtensionsBlock,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./chunk-ZBJMUXZH.js";
|
|
16
16
|
import {
|
|
17
17
|
resolvePipelineProcessingCapabilities
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-2XRE6FLM.js";
|
|
19
19
|
import {
|
|
20
20
|
log
|
|
21
21
|
} from "./chunk-3WCASNQZ.js";
|
|
@@ -220,4 +220,4 @@ export {
|
|
|
220
220
|
buildExtensionsBlockForConsolidation,
|
|
221
221
|
materializeAfterSemanticConsolidation
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-WONS4RZ2.js.map
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import {
|
|
2
|
+
assertPathInsideRoot
|
|
3
|
+
} from "./chunk-GCASGYIO.js";
|
|
4
|
+
import {
|
|
5
|
+
getMemoryProjectionPath,
|
|
6
|
+
initializeMemoryProjectionDb
|
|
7
|
+
} from "./chunk-3CSX3ETE.js";
|
|
8
|
+
import {
|
|
9
|
+
openBetterSqlite3
|
|
10
|
+
} from "./chunk-RL6NEVXT.js";
|
|
11
|
+
import {
|
|
12
|
+
isErrnoCode
|
|
13
|
+
} from "./chunk-5UZXUTVO.js";
|
|
14
|
+
|
|
15
|
+
// src/memory-projection-mutations.ts
|
|
16
|
+
import { lstat, realpath } from "fs/promises";
|
|
17
|
+
var PROJECTION_WRITE_BUSY_TIMEOUT_MS = 100;
|
|
18
|
+
var PROJECTION_WRITE_RETRY_COUNT = 4;
|
|
19
|
+
var PROJECTION_WRITE_RETRY_DELAY_MS = 100;
|
|
20
|
+
function isSqliteBusyError(error) {
|
|
21
|
+
const messages = [];
|
|
22
|
+
const seen = /* @__PURE__ */ new Set();
|
|
23
|
+
let current = error;
|
|
24
|
+
while (current !== null && typeof current === "object" && !seen.has(current)) {
|
|
25
|
+
seen.add(current);
|
|
26
|
+
if (current instanceof Error) messages.push(current.message);
|
|
27
|
+
if (!("cause" in current)) break;
|
|
28
|
+
current = current.cause;
|
|
29
|
+
}
|
|
30
|
+
const lower = messages.join("\n").toLowerCase();
|
|
31
|
+
return lower.includes("database is locked") || lower.includes("sqlite_busy");
|
|
32
|
+
}
|
|
33
|
+
async function validateProjectionPath(memoryDir, projectionPath) {
|
|
34
|
+
let projectionStat;
|
|
35
|
+
try {
|
|
36
|
+
projectionStat = await lstat(projectionPath);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (isErrnoCode(error, "ENOENT")) return false;
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
if (projectionStat.isSymbolicLink() || !projectionStat.isFile()) {
|
|
42
|
+
throw new Error(`Refusing memory projection rewrite through unsafe database path: ${projectionPath}.`);
|
|
43
|
+
}
|
|
44
|
+
const [memoryRoot, projectionReal] = await Promise.all([
|
|
45
|
+
realpath(memoryDir),
|
|
46
|
+
realpath(projectionPath)
|
|
47
|
+
]);
|
|
48
|
+
assertPathInsideRoot(memoryRoot, projectionReal, projectionPath);
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
async function rewriteProjectedEntityReferenceRows(memoryDir, entries, memoryId) {
|
|
52
|
+
if (memoryId !== void 0 && memoryId.length === 0) {
|
|
53
|
+
throw new Error("Projection memoryId must not be empty.");
|
|
54
|
+
}
|
|
55
|
+
const scopedMemory = memoryId !== void 0;
|
|
56
|
+
const validEntries = entries.filter(
|
|
57
|
+
([previousEntityRef, nextEntityRef]) => previousEntityRef.length > 0 && nextEntityRef.length > 0 && previousEntityRef !== nextEntityRef
|
|
58
|
+
);
|
|
59
|
+
if (validEntries.length === 0) return;
|
|
60
|
+
const projectionPath = getMemoryProjectionPath(memoryDir);
|
|
61
|
+
if (!await validateProjectionPath(memoryDir, projectionPath)) return;
|
|
62
|
+
let lastError;
|
|
63
|
+
for (let attempt = 0; attempt < PROJECTION_WRITE_RETRY_COUNT; attempt += 1) {
|
|
64
|
+
if (!await validateProjectionPath(memoryDir, projectionPath)) return;
|
|
65
|
+
let db = null;
|
|
66
|
+
try {
|
|
67
|
+
db = openBetterSqlite3(projectionPath, { fileMustExist: true });
|
|
68
|
+
db.pragma(`busy_timeout = ${PROJECTION_WRITE_BUSY_TIMEOUT_MS}`);
|
|
69
|
+
initializeMemoryProjectionDb(db);
|
|
70
|
+
const updateCurrent = db.prepare(
|
|
71
|
+
scopedMemory ? "UPDATE memory_current SET entity_ref = ? WHERE memory_id = ? AND entity_ref = ?" : "UPDATE memory_current SET entity_ref = ? WHERE entity_ref = ?"
|
|
72
|
+
);
|
|
73
|
+
const updateMentions = db.prepare(
|
|
74
|
+
scopedMemory ? `
|
|
75
|
+
UPDATE memory_entity_mentions
|
|
76
|
+
SET entity_ref = ?
|
|
77
|
+
WHERE memory_id = ? AND entity_ref = ? AND mention_source = 'frontmatter.entityRef'
|
|
78
|
+
` : `
|
|
79
|
+
UPDATE memory_entity_mentions
|
|
80
|
+
SET entity_ref = ?
|
|
81
|
+
WHERE entity_ref = ? AND mention_source = 'frontmatter.entityRef'
|
|
82
|
+
`
|
|
83
|
+
);
|
|
84
|
+
const rewrite = db.transaction(() => {
|
|
85
|
+
for (const [previousEntityRef, nextEntityRef] of validEntries) {
|
|
86
|
+
const params = scopedMemory ? [nextEntityRef, memoryId, previousEntityRef] : [nextEntityRef, previousEntityRef];
|
|
87
|
+
updateCurrent.run(...params);
|
|
88
|
+
updateMentions.run(...params);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
rewrite();
|
|
92
|
+
return;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
lastError = error;
|
|
95
|
+
if (!isSqliteBusyError(error) || attempt === PROJECTION_WRITE_RETRY_COUNT - 1) {
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
99
|
+
setTimeout(resolve, PROJECTION_WRITE_RETRY_DELAY_MS);
|
|
100
|
+
await promise;
|
|
101
|
+
} finally {
|
|
102
|
+
db?.close();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
throw lastError instanceof Error ? lastError : new Error("Projection rewrite failed.");
|
|
106
|
+
}
|
|
107
|
+
async function rewriteProjectedMemoryEntityReference(memoryDir, memoryId, previousEntityRef, nextEntityRef) {
|
|
108
|
+
await rewriteProjectedEntityReferenceRows(memoryDir, [[previousEntityRef, nextEntityRef]], memoryId);
|
|
109
|
+
}
|
|
110
|
+
async function rewriteProjectedEntityReferences(memoryDir, replacements) {
|
|
111
|
+
await rewriteProjectedEntityReferenceRows(memoryDir, Object.entries(replacements));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export {
|
|
115
|
+
rewriteProjectedMemoryEntityReference,
|
|
116
|
+
rewriteProjectedEntityReferences
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=chunk-WRJVB3C2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/memory-projection-mutations.ts"],"sourcesContent":["import { lstat, realpath } from \"node:fs/promises\";\nimport { isErrnoCode } from \"./utils/errno.js\";\nimport { assertPathInsideRoot } from \"./utils/path-containment.js\";\nimport { getMemoryProjectionPath, initializeMemoryProjectionDb } from \"./memory-projection-store.js\";\nimport { type BetterSqlite3Database, openBetterSqlite3 } from \"./runtime/better-sqlite.js\";\n\nconst PROJECTION_WRITE_BUSY_TIMEOUT_MS = 100;\nconst PROJECTION_WRITE_RETRY_COUNT = 4;\nconst PROJECTION_WRITE_RETRY_DELAY_MS = 100;\n\nfunction isSqliteBusyError(error: unknown): boolean {\n const messages: string[] = [];\n const seen = new Set<unknown>();\n let current: unknown = error;\n while (current !== null && typeof current === \"object\" && !seen.has(current)) {\n seen.add(current);\n if (current instanceof Error) messages.push(current.message);\n if (!(\"cause\" in current)) break;\n current = current.cause;\n }\n const lower = messages.join(\"\\n\").toLowerCase();\n return lower.includes(\"database is locked\") || lower.includes(\"sqlite_busy\");\n}\n\nasync function validateProjectionPath(\n memoryDir: string,\n projectionPath: string,\n): Promise<boolean> {\n let projectionStat;\n try {\n projectionStat = await lstat(projectionPath);\n } catch (error) {\n if (isErrnoCode(error, \"ENOENT\")) return false;\n throw error;\n }\n if (projectionStat.isSymbolicLink() || !projectionStat.isFile()) {\n throw new Error(`Refusing memory projection rewrite through unsafe database path: ${projectionPath}.`);\n }\n const [memoryRoot, projectionReal] = await Promise.all([\n realpath(memoryDir),\n realpath(projectionPath),\n ]);\n assertPathInsideRoot(memoryRoot, projectionReal, projectionPath);\n return true;\n}\n\nasync function rewriteProjectedEntityReferenceRows(\n memoryDir: string,\n entries: ReadonlyArray<readonly [string, string]>,\n memoryId?: string,\n): Promise<void> {\n if (memoryId !== undefined && memoryId.length === 0) {\n throw new Error(\"Projection memoryId must not be empty.\");\n }\n const scopedMemory = memoryId !== undefined;\n const validEntries = entries.filter(\n ([previousEntityRef, nextEntityRef]) =>\n previousEntityRef.length > 0 && nextEntityRef.length > 0 && previousEntityRef !== nextEntityRef,\n );\n if (validEntries.length === 0) return;\n\n const projectionPath = getMemoryProjectionPath(memoryDir);\n if (!(await validateProjectionPath(memoryDir, projectionPath))) return;\n\n let lastError: unknown;\n for (let attempt = 0; attempt < PROJECTION_WRITE_RETRY_COUNT; attempt += 1) {\n if (!(await validateProjectionPath(memoryDir, projectionPath))) return;\n let db: BetterSqlite3Database | null = null;\n try {\n db = openBetterSqlite3(projectionPath, { fileMustExist: true });\n db.pragma(`busy_timeout = ${PROJECTION_WRITE_BUSY_TIMEOUT_MS}`);\n initializeMemoryProjectionDb(db);\n const updateCurrent = db.prepare(\n scopedMemory\n ? \"UPDATE memory_current SET entity_ref = ? WHERE memory_id = ? AND entity_ref = ?\"\n : \"UPDATE memory_current SET entity_ref = ? WHERE entity_ref = ?\",\n );\n const updateMentions = db.prepare(\n scopedMemory\n ? `\n UPDATE memory_entity_mentions\n SET entity_ref = ?\n WHERE memory_id = ? AND entity_ref = ? AND mention_source = 'frontmatter.entityRef'\n `\n : `\n UPDATE memory_entity_mentions\n SET entity_ref = ?\n WHERE entity_ref = ? AND mention_source = 'frontmatter.entityRef'\n `,\n );\n const rewrite = db.transaction(() => {\n for (const [previousEntityRef, nextEntityRef] of validEntries) {\n const params = scopedMemory\n ? [nextEntityRef, memoryId, previousEntityRef]\n : [nextEntityRef, previousEntityRef];\n updateCurrent.run(...params);\n updateMentions.run(...params);\n }\n });\n rewrite();\n return;\n } catch (error) {\n lastError = error;\n if (!isSqliteBusyError(error) || attempt === PROJECTION_WRITE_RETRY_COUNT - 1) {\n throw error;\n }\n const { promise, resolve } = Promise.withResolvers<void>();\n setTimeout(resolve, PROJECTION_WRITE_RETRY_DELAY_MS);\n await promise;\n } finally {\n db?.close();\n }\n }\n\n throw lastError instanceof Error ? lastError : new Error(\"Projection rewrite failed.\");\n}\n\nexport async function rewriteProjectedMemoryEntityReference(\n memoryDir: string,\n memoryId: string,\n previousEntityRef: string,\n nextEntityRef: string,\n): Promise<void> {\n await rewriteProjectedEntityReferenceRows(memoryDir, [[previousEntityRef, nextEntityRef]], memoryId);\n}\n\nexport async function rewriteProjectedEntityReferences(\n memoryDir: string,\n replacements: Readonly<Record<string, string>>,\n): Promise<void> {\n await rewriteProjectedEntityReferenceRows(memoryDir, Object.entries(replacements));\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,OAAO,gBAAgB;AAMhC,IAAM,mCAAmC;AACzC,IAAM,+BAA+B;AACrC,IAAM,kCAAkC;AAExC,SAAS,kBAAkB,OAAyB;AAClD,QAAM,WAAqB,CAAC;AAC5B,QAAM,OAAO,oBAAI,IAAa;AAC9B,MAAI,UAAmB;AACvB,SAAO,YAAY,QAAQ,OAAO,YAAY,YAAY,CAAC,KAAK,IAAI,OAAO,GAAG;AAC5E,SAAK,IAAI,OAAO;AAChB,QAAI,mBAAmB,MAAO,UAAS,KAAK,QAAQ,OAAO;AAC3D,QAAI,EAAE,WAAW,SAAU;AAC3B,cAAU,QAAQ;AAAA,EACpB;AACA,QAAM,QAAQ,SAAS,KAAK,IAAI,EAAE,YAAY;AAC9C,SAAO,MAAM,SAAS,oBAAoB,KAAK,MAAM,SAAS,aAAa;AAC7E;AAEA,eAAe,uBACb,WACA,gBACkB;AAClB,MAAI;AACJ,MAAI;AACF,qBAAiB,MAAM,MAAM,cAAc;AAAA,EAC7C,SAAS,OAAO;AACd,QAAI,YAAY,OAAO,QAAQ,EAAG,QAAO;AACzC,UAAM;AAAA,EACR;AACA,MAAI,eAAe,eAAe,KAAK,CAAC,eAAe,OAAO,GAAG;AAC/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AM;AAC3B,yBAAe,IAAI,GAAG,MAAM;AAAA,QAC9B;AAAA,MACF,CAAC;AACD,cAAQ;AACR;AAAA,IACF,SAAS,OAAO;AACd,kBAAY;AACZ,UAAI,CAAC,kBAAkB,KAAK,KAAK,YAAY,+BAA+B,GAAG;AAC7E,cAAM;AAAA,MACR;AACA,YAAM,EAAE,SAAS,QAAQ,IAAI,QAAQ,cAAoB;AACzD,iBAAW,SAAS,+BAA+B;AACnD,YAAM;AAAA,IACR,UAAE;AACA,UAAI,MAAM;AAAA,IACZ;AAAA,EACF;AAEA,QAAM,qBAAqB,QAAQ,YAAY,IAAI,MAAM,4BAA4B;AACvF;AAEA,eAAsB,sCACpB,WACA,UACA,mBACA,eACe;AACf,QAAM,oCAAoC,WAAW,CAAC,CAAC,mBAAmB,aAAa,CAAC,GAAG,QAAQ;AACrG;AAEA,eAAsB,iCACpB,WACA,cACe;AACf,QAAM,oCAAoC,WAAW,OAAO,QAAQ,YAAY,CAAC;AACnF;","names":[]}
|
|
@@ -13,6 +13,9 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
importSqlite
|
|
15
15
|
} from "./chunk-PYHOAXTI.js";
|
|
16
|
+
import {
|
|
17
|
+
backupMemoryDir
|
|
18
|
+
} from "./chunk-OWHERGF2.js";
|
|
16
19
|
import {
|
|
17
20
|
exportJsonBundle
|
|
18
21
|
} from "./chunk-UP6MOYCB.js";
|
|
@@ -25,9 +28,6 @@ import {
|
|
|
25
28
|
import {
|
|
26
29
|
importJsonBundle
|
|
27
30
|
} from "./chunk-2DL3OFLD.js";
|
|
28
|
-
import {
|
|
29
|
-
backupMemoryDir
|
|
30
|
-
} from "./chunk-BXLOS5AJ.js";
|
|
31
31
|
import {
|
|
32
32
|
exportMarkdownBundle
|
|
33
33
|
} from "./chunk-765K3SAT.js";
|
|
@@ -54,12 +54,12 @@ import {
|
|
|
54
54
|
} from "./chunk-MNB5RMAY.js";
|
|
55
55
|
import {
|
|
56
56
|
rebuildMemoryLifecycleLedger
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-EVX44I7C.js";
|
|
58
58
|
import {
|
|
59
59
|
rebuildMemoryProjection,
|
|
60
60
|
repairMemoryProjection,
|
|
61
61
|
verifyMemoryProjection
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-VVIW3PTA.js";
|
|
63
63
|
import {
|
|
64
64
|
rebuildObservations
|
|
65
65
|
} from "./chunk-DX3XRGLH.js";
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
} from "./chunk-HSSERO3E.js";
|
|
78
78
|
import {
|
|
79
79
|
searchVerifiedEpisodes
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-KUJQHXPH.js";
|
|
81
81
|
import {
|
|
82
82
|
getUtilityLearningStatus,
|
|
83
83
|
learnUtilityPromotionWeights
|
|
@@ -91,15 +91,15 @@ import {
|
|
|
91
91
|
} from "./chunk-OJP3N7UK.js";
|
|
92
92
|
import {
|
|
93
93
|
promoteSemanticRuleFromMemory
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-CMRQ34J5.js";
|
|
95
95
|
import {
|
|
96
96
|
searchVerifiedSemanticRules
|
|
97
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-4PBVXX7L.js";
|
|
98
98
|
import {
|
|
99
99
|
buildResumeBundleFromState,
|
|
100
100
|
getResumeBundleStatus,
|
|
101
101
|
recordResumeBundle
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-EP5BVCRI.js";
|
|
103
103
|
import {
|
|
104
104
|
getWorkProductLedgerStatus,
|
|
105
105
|
recordWorkProductLedgerEntry,
|
|
@@ -110,10 +110,7 @@ import {
|
|
|
110
110
|
} from "./chunk-HYQJQGD3.js";
|
|
111
111
|
import {
|
|
112
112
|
parseXrayCliOptions
|
|
113
|
-
} from "./chunk-
|
|
114
|
-
import {
|
|
115
|
-
resolveAgentAccessAuthToken
|
|
116
|
-
} from "./chunk-TGQ2NTWH.js";
|
|
113
|
+
} from "./chunk-XOZ4ALGB.js";
|
|
117
114
|
import {
|
|
118
115
|
collectPatternMemories,
|
|
119
116
|
explainPatternMemory,
|
|
@@ -135,7 +132,7 @@ import {
|
|
|
135
132
|
runOperatorInventory,
|
|
136
133
|
runOperatorRepair,
|
|
137
134
|
runOperatorSetup
|
|
138
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-T3GCXULH.js";
|
|
139
136
|
import {
|
|
140
137
|
analyzeSessionIntegrity,
|
|
141
138
|
applySessionRepair,
|
|
@@ -158,12 +155,12 @@ import {
|
|
|
158
155
|
import {
|
|
159
156
|
listConnectorStates
|
|
160
157
|
} from "./chunk-6GUG4YNM.js";
|
|
161
|
-
import {
|
|
162
|
-
searchHarmonicRetrieval
|
|
163
|
-
} from "./chunk-AV5ZEH4M.js";
|
|
164
158
|
import {
|
|
165
159
|
rescoreMemoryImportance
|
|
166
160
|
} from "./chunk-JXS5PDQ7.js";
|
|
161
|
+
import {
|
|
162
|
+
searchHarmonicRetrieval
|
|
163
|
+
} from "./chunk-AV5ZEH4M.js";
|
|
167
164
|
import {
|
|
168
165
|
createEvalBaselineSnapshot,
|
|
169
166
|
getEvalHarnessStatus,
|
|
@@ -202,11 +199,11 @@ import {
|
|
|
202
199
|
} from "./chunk-UQ7RN5HK.js";
|
|
203
200
|
import {
|
|
204
201
|
parseConfig
|
|
205
|
-
} from "./chunk-
|
|
202
|
+
} from "./chunk-DRBXHRXE.js";
|
|
206
203
|
import {
|
|
207
204
|
EngramAccessHttpServer,
|
|
208
205
|
MeetingsInputError
|
|
209
|
-
} from "./chunk-
|
|
206
|
+
} from "./chunk-SG265CVF.js";
|
|
210
207
|
import {
|
|
211
208
|
WearablesInputError
|
|
212
209
|
} from "./chunk-V7IZKJI3.js";
|
|
@@ -219,13 +216,13 @@ import {
|
|
|
219
216
|
createProductionChatLlmAdapter,
|
|
220
217
|
loadChatSession,
|
|
221
218
|
sessionBelongsToPrincipal
|
|
222
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-ZGOQTOYA.js";
|
|
223
220
|
import {
|
|
224
221
|
getAbstractionNodeStoreStatus
|
|
225
222
|
} from "./chunk-OADWQ5CR.js";
|
|
226
223
|
import {
|
|
227
224
|
EngramAccessService
|
|
228
|
-
} from "./chunk-
|
|
225
|
+
} from "./chunk-2XC73SHY.js";
|
|
229
226
|
import {
|
|
230
227
|
WorkStorage
|
|
231
228
|
} from "./chunk-GDB4J2H3.js";
|
|
@@ -242,13 +239,13 @@ import {
|
|
|
242
239
|
parseRecallExplainFormat,
|
|
243
240
|
renderRecallExplain,
|
|
244
241
|
renderXray
|
|
245
|
-
} from "./chunk-
|
|
242
|
+
} from "./chunk-K5GB36ME.js";
|
|
246
243
|
import {
|
|
247
244
|
listMemoryGovernanceRuns,
|
|
248
245
|
readMemoryGovernanceRunArtifact,
|
|
249
246
|
restoreMemoryGovernanceRun,
|
|
250
247
|
runMemoryGovernance
|
|
251
|
-
} from "./chunk-
|
|
248
|
+
} from "./chunk-GGUBDXRR.js";
|
|
252
249
|
import {
|
|
253
250
|
getObjectiveStateStoreStatus
|
|
254
251
|
} from "./chunk-6HMYUWXR.js";
|
|
@@ -256,7 +253,7 @@ import {
|
|
|
256
253
|
listNamespaces,
|
|
257
254
|
runNamespaceMigration,
|
|
258
255
|
verifyNamespaces
|
|
259
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-NBDCZWP4.js";
|
|
260
257
|
import {
|
|
261
258
|
renderQmdBacklogStatus
|
|
262
259
|
} from "./chunk-IUM3VSHI.js";
|
|
@@ -265,17 +262,17 @@ import {
|
|
|
265
262
|
} from "./chunk-L2DPF4DF.js";
|
|
266
263
|
import {
|
|
267
264
|
meetingIdDate
|
|
268
|
-
} from "./chunk-
|
|
265
|
+
} from "./chunk-FCDWWCLX.js";
|
|
269
266
|
import {
|
|
270
267
|
isValidTranscriptDate
|
|
271
268
|
} from "./chunk-UHVXE24Y.js";
|
|
272
269
|
import {
|
|
273
270
|
RECALL_DISCLOSURE_LEVELS,
|
|
274
271
|
isRecallDisclosure
|
|
275
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-HUHX2OCX.js";
|
|
276
273
|
import {
|
|
277
274
|
STATE_FILE_MAX_DECRYPT_BYTES
|
|
278
|
-
} from "./chunk-
|
|
275
|
+
} from "./chunk-OFHFH655.js";
|
|
279
276
|
import {
|
|
280
277
|
assertPathInsideRoot
|
|
281
278
|
} from "./chunk-GCASGYIO.js";
|
|
@@ -285,6 +282,11 @@ import {
|
|
|
285
282
|
import {
|
|
286
283
|
getCausalTrajectoryStoreStatus
|
|
287
284
|
} from "./chunk-W4FBGYGK.js";
|
|
285
|
+
import {
|
|
286
|
+
hostSecretRefResolver,
|
|
287
|
+
loadHostSecretRefResolver,
|
|
288
|
+
resolveAgentAccessAuthToken
|
|
289
|
+
} from "./chunk-IJ6WHMFB.js";
|
|
288
290
|
import {
|
|
289
291
|
renderExtractionLivenessStats
|
|
290
292
|
} from "./chunk-443XCR34.js";
|
|
@@ -319,7 +321,7 @@ import {
|
|
|
319
321
|
resolveRecallEnhancementCapabilities,
|
|
320
322
|
resolveSecurityCapabilities,
|
|
321
323
|
resolveUtilityLearningCapabilities
|
|
322
|
-
} from "./chunk-
|
|
324
|
+
} from "./chunk-2XRE6FLM.js";
|
|
323
325
|
import {
|
|
324
326
|
SECURE_STORE_ENVELOPE_OVERHEAD_BYTES,
|
|
325
327
|
probeEncryptedRegularFileHeader
|
|
@@ -3953,7 +3955,8 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
3953
3955
|
});
|
|
3954
3956
|
cmd.command("doctor").description("Run safe Engram health diagnostics with remediation guidance").option("--json", "Emit machine-readable JSON only").action(async (...args) => {
|
|
3955
3957
|
const options = args[0] ?? {};
|
|
3956
|
-
const
|
|
3958
|
+
const resolveSecretRef = await loadHostSecretRefResolver(registerOptions);
|
|
3959
|
+
const report = await runOperatorDoctor({ orchestrator, resolveSecretRef });
|
|
3957
3960
|
if (reportHasMachineReadableOutput(options)) {
|
|
3958
3961
|
console.log(JSON.stringify(report, null, 2));
|
|
3959
3962
|
} else {
|
|
@@ -3970,7 +3973,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
3970
3973
|
);
|
|
3971
3974
|
tierCmd.command("list").description("Summarize tier distribution across all memories").option("--json", "Emit machine-readable JSON only").action(async (...args) => {
|
|
3972
3975
|
const options = args[0] ?? {};
|
|
3973
|
-
const { summarizeTiers, formatTierSummaryText } = await import("./tier-stats-
|
|
3976
|
+
const { summarizeTiers, formatTierSummaryText } = await import("./tier-stats-OPTSBNRH.js");
|
|
3974
3977
|
const summary = await summarizeTiers(orchestrator.storage);
|
|
3975
3978
|
if (reportHasMachineReadableOutput(options)) {
|
|
3976
3979
|
console.log(JSON.stringify(summary, null, 2));
|
|
@@ -3981,7 +3984,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
3981
3984
|
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) => {
|
|
3982
3985
|
const idArg = typeof args[0] === "string" ? args[0] : "";
|
|
3983
3986
|
const options = args[1] ?? {};
|
|
3984
|
-
const { explainTierForMemory, formatTierExplainText } = await import("./tier-stats-
|
|
3987
|
+
const { explainTierForMemory, formatTierExplainText } = await import("./tier-stats-OPTSBNRH.js");
|
|
3985
3988
|
try {
|
|
3986
3989
|
const explain = await explainTierForMemory(
|
|
3987
3990
|
orchestrator.storage,
|
|
@@ -4572,7 +4575,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
4572
4575
|
}
|
|
4573
4576
|
}
|
|
4574
4577
|
if (sourceArchive.endsWith(".enc")) {
|
|
4575
|
-
const { isEncryptedCapsuleFile } = await import("./capsule-crypto-
|
|
4578
|
+
const { isEncryptedCapsuleFile } = await import("./capsule-crypto-GWVG7LGC.js");
|
|
4576
4579
|
const encDetected = await isEncryptedCapsuleFile(sourceArchive).catch(() => true);
|
|
4577
4580
|
if (encDetected) {
|
|
4578
4581
|
throw new Error(
|
|
@@ -4735,7 +4738,7 @@ function registerCli(api, orchestrator, registerOptions = {}) {
|
|
|
4735
4738
|
const { parseExportBundle } = await import("./transfer/types.js");
|
|
4736
4739
|
let decryptedBuf;
|
|
4737
4740
|
try {
|
|
4738
|
-
const { decryptCapsuleFileInMemory } = await import("./capsule-crypto-
|
|
4741
|
+
const { decryptCapsuleFileInMemory } = await import("./capsule-crypto-GWVG7LGC.js");
|
|
4739
4742
|
decryptedBuf = await decryptCapsuleFileInMemory(archivePath, memoryDir);
|
|
4740
4743
|
} catch (decErr) {
|
|
4741
4744
|
const msg = decErr instanceof Error ? decErr.message : String(decErr);
|
|
@@ -5967,14 +5970,16 @@ ${doc.content}` : doc.content,
|
|
|
5967
5970
|
console.log(JSON.stringify(status, null, 2));
|
|
5968
5971
|
console.log("OK");
|
|
5969
5972
|
});
|
|
5970
|
-
const accessService = new EngramAccessService(orchestrator
|
|
5973
|
+
const accessService = new EngramAccessService(orchestrator, {
|
|
5974
|
+
resolveSecretRef: hostSecretRefResolver(registerOptions)
|
|
5975
|
+
});
|
|
5971
5976
|
const accessCmd = cmd.command("access").description("Manage Engram HTTP and MCP access surfaces");
|
|
5972
5977
|
accessCmd.command("http-serve").description("Start local authenticated HTTP access server").option("--host <host>", "Bind host", "127.0.0.1").option("--port <n>", "Bind port", "4318").option("--token <token>", "Bearer token (defaults to config/env)").option("--principal <principal>", "Trusted principal (defaults to config/env)").option("--max-body-bytes <n>", "Maximum request body size", "131072").option("--trust-principal-header", "Trust the X-Engram-Principal header for per-request principal resolution. Only enable when the server is behind a trusted proxy or when the auth token provides sufficient trust.").action(async (...args) => {
|
|
5973
5978
|
const options = args[0] ?? {};
|
|
5974
5979
|
const portRaw = parseInt(String(options.port ?? "4318"), 10);
|
|
5975
5980
|
const maxBodyBytesRaw = parseInt(String(options.maxBodyBytes ?? "131072"), 10);
|
|
5976
5981
|
const cliTokenOverride = typeof options.token === "string" && options.token.trim().length > 0 ? options.token : void 0;
|
|
5977
|
-
const resolveSecretRef =
|
|
5982
|
+
const resolveSecretRef = await loadHostSecretRefResolver(registerOptions);
|
|
5978
5983
|
const resolvedConfigAuthToken = cliTokenOverride ? void 0 : await resolveAgentAccessAuthToken(
|
|
5979
5984
|
orchestrator.config.agentAccessHttp.authToken,
|
|
5980
5985
|
{ resolveSecretRef }
|
|
@@ -7249,7 +7254,7 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
7249
7254
|
});
|
|
7250
7255
|
reviewCmd.command("scan").description("Run an on-demand contradiction scan").option("--namespace <ns>", "Namespace to scan").action(async (...args) => {
|
|
7251
7256
|
const options = args[0] ?? {};
|
|
7252
|
-
const { runContradictionScan } = await import("./contradiction-scan-
|
|
7257
|
+
const { runContradictionScan } = await import("./contradiction-scan-HYLIRMJ2.js");
|
|
7253
7258
|
console.log("Running contradiction scan...");
|
|
7254
7259
|
const result = await runContradictionScan({
|
|
7255
7260
|
storage: orchestrator.storage,
|
|
@@ -7976,4 +7981,4 @@ export {
|
|
|
7976
7981
|
listMemoryMarkdownFilePaths,
|
|
7977
7982
|
registerCli
|
|
7978
7983
|
};
|
|
7979
|
-
//# sourceMappingURL=chunk-
|
|
7984
|
+
//# sourceMappingURL=chunk-WZ7UB7XQ.js.map
|