@remnic/core 9.54.8 → 9.55.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 +11 -11
- package/dist/access-admin-ops-surface.js +44 -43
- package/dist/access-authorization-probe.d.ts +11 -11
- package/dist/access-authorization-probe.js +45 -44
- package/dist/access-boundary.d.ts +11 -11
- package/dist/access-boundary.js +44 -43
- package/dist/access-cli.js +114 -112
- package/dist/access-cli.js.map +1 -1
- package/dist/access-coding-context-resolution.d.ts +1 -1
- package/dist/access-extraction-force-flush.d.ts +11 -11
- package/dist/access-extraction-force-flush.js +44 -43
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +11 -11
- package/dist/access-http-lifecycle-flush.d.ts +11 -11
- package/dist/access-http-offline-stream.d.ts +11 -11
- package/dist/access-http-query.js +44 -43
- package/dist/access-http.d.ts +12 -12
- package/dist/access-http.js +58 -57
- package/dist/access-identity-continuity-surface.d.ts +9 -9
- package/dist/access-identity-continuity-surface.js +44 -43
- package/dist/access-lcm-surface.d.ts +11 -11
- package/dist/access-lcm-surface.js +44 -43
- package/dist/access-mcp.d.ts +11 -11
- package/dist/access-mcp.js +53 -52
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/access-memory-search-fanout.js +3 -3
- package/dist/{access-namespace-preflight-CCNn_6NE.d.ts → access-namespace-preflight-Bpt-SYP0.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +44 -43
- package/dist/access-observe-write-surface.d.ts +11 -11
- package/dist/access-observe-write-surface.js +44 -43
- package/dist/access-offline-manifest.d.ts +9 -9
- package/dist/access-offline-manifest.js +9 -9
- package/dist/access-operations-batch.js +48 -47
- package/dist/access-operations.d.ts +14 -14
- package/dist/access-operations.js +52 -51
- package/dist/access-recall-concurrency.d.ts +11 -11
- package/dist/access-recall-concurrency.js +44 -43
- package/dist/access-recall-response.d.ts +11 -11
- package/dist/access-recall-response.js +44 -43
- package/dist/access-recall-surface.d.ts +11 -11
- package/dist/access-recall-surface.js +44 -43
- package/dist/access-schema.d.ts +88 -88
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-PEduVt8q.d.ts → access-service-4DO8XMq6.d.ts} +71 -71
- package/dist/access-service-helpers.d.ts +11 -11
- package/dist/access-service.d.ts +11 -11
- package/dist/access-service.js +44 -43
- package/dist/access-surface-catalog.d.ts +11 -11
- package/dist/access-surface-catalog.js +46 -45
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/access-wearables-meetings-surface.d.ts +3 -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/ambient-provenance.d.ts +1 -1
- package/dist/artifact-search.d.ts +1 -1
- package/dist/{auto-sync-NR3GPCOA.js → auto-sync-5HVRCMGZ.js} +3 -3
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +9 -9
- package/dist/briefing-window.d.ts +2 -2
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +14 -13
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer-turn-helpers.d.ts +1 -1
- package/dist/buffer.d.ts +2 -2
- package/dist/buffer.js +6 -5
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +8 -8
- package/dist/capabilities.js +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/{catalog-DGFf8mD9.d.ts → catalog-BasnO3Bw.d.ts} +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-behavior.js +2 -2
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +17 -16
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +2 -2
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/causal-trajectory-graph.js +2 -2
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-I6WYQSX4.js → chunk-2NKY7OC6.js} +14 -2
- package/dist/chunk-2NKY7OC6.js.map +1 -0
- package/dist/{chunk-E2GZSFR5.js → chunk-2YREVL4T.js} +2 -2
- package/dist/{chunk-PG4QBPVG.js → chunk-3VFVQDZO.js} +8 -4
- package/dist/chunk-3VFVQDZO.js.map +1 -0
- package/dist/{chunk-KM55SMLG.js → chunk-4KM3V6VS.js} +2 -2
- package/dist/{chunk-HAEU3ZW7.js → chunk-4OW2T32G.js} +2 -2
- package/dist/{chunk-PCRHFB75.js → chunk-4QFCAKNM.js} +1 -1
- package/dist/{chunk-OS5DYALF.js → chunk-4THNU7OF.js} +422 -47
- package/dist/chunk-4THNU7OF.js.map +1 -0
- package/dist/{chunk-76JJSXK7.js → chunk-5QHDXMXP.js} +1 -1
- package/dist/chunk-5QHDXMXP.js.map +1 -0
- package/dist/{chunk-OWC42MDT.js → chunk-5ZIWRMZM.js} +2 -2
- package/dist/{chunk-GWFSVJ4P.js → chunk-6KTXE6A3.js} +2 -2
- package/dist/{chunk-5V64M56S.js → chunk-6P2NUVM5.js} +26 -24
- package/dist/chunk-6P2NUVM5.js.map +1 -0
- package/dist/chunk-6Q3ZTEF6.js +54 -0
- package/dist/chunk-6Q3ZTEF6.js.map +1 -0
- package/dist/{chunk-P2FA65P2.js → chunk-7NSC4IVA.js} +2 -2
- package/dist/{chunk-QC6BILS7.js → chunk-7PKNOXYB.js} +11 -11
- package/dist/{chunk-AHVEHR6K.js → chunk-7ZNJN5WZ.js} +13 -1
- package/dist/chunk-7ZNJN5WZ.js.map +1 -0
- package/dist/{chunk-RZRUV6N2.js → chunk-ANMIOQPU.js} +2 -2
- package/dist/{chunk-RPSYDM6C.js → chunk-BPWZDHFM.js} +2 -2
- package/dist/{chunk-JKW663ZN.js → chunk-BVRREV3N.js} +2 -2
- package/dist/{chunk-XXRRHING.js → chunk-BWJMBJCY.js} +24 -15
- package/dist/chunk-BWJMBJCY.js.map +1 -0
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-ELXP665P.js → chunk-CKSEJD7K.js} +2 -2
- package/dist/{chunk-4GE3NA5I.js → chunk-CME347TM.js} +2 -2
- package/dist/{chunk-BGLY7EEM.js → chunk-CMRUIKVA.js} +3 -3
- package/dist/{chunk-HGJ6NJ4E.js → chunk-D4LVHPOA.js} +2 -2
- package/dist/{chunk-YK6BDDHP.js → chunk-DFEODULB.js} +2 -2
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-XWZ6KOL6.js → chunk-E57E5SCS.js} +2 -2
- package/dist/{chunk-M23RF3LJ.js → chunk-ER4BLWI6.js} +2 -2
- package/dist/{chunk-47J4EDGR.js → chunk-F7M36OG2.js} +3 -3
- package/dist/{chunk-MTF5EFFF.js → chunk-FK7T55BA.js} +60 -41
- package/dist/{chunk-MTF5EFFF.js.map → chunk-FK7T55BA.js.map} +1 -1
- package/dist/{chunk-ZUJW327U.js → chunk-FONW766A.js} +2 -2
- package/dist/{chunk-FEBHRT2I.js → chunk-FR3FNPCJ.js} +3 -3
- package/dist/{chunk-G6DFSS6A.js → chunk-GUNIXT36.js} +2 -2
- package/dist/{chunk-K2UGPTYY.js → chunk-H6ZXNH5I.js} +2 -2
- package/dist/{chunk-Z463UYI6.js → chunk-HC55YCNK.js} +2 -2
- package/dist/{chunk-IEQCHXUS.js → chunk-HQ2VGCGP.js} +14 -14
- package/dist/{chunk-ZXGKQQ3L.js → chunk-HXXGZ4KV.js} +1 -1
- package/dist/{chunk-YZFPEHXF.js → chunk-HYVBJLEK.js} +5 -5
- package/dist/{chunk-FPKKFDO4.js → chunk-IFFW25NG.js} +246 -118
- package/dist/chunk-IFFW25NG.js.map +1 -0
- package/dist/{chunk-3GD2HFR6.js → chunk-IGWVMA4Y.js} +2 -2
- package/dist/{chunk-FONWBCVY.js → chunk-IKT6ZVO7.js} +3 -3
- package/dist/{chunk-KMWYZTIE.js → chunk-ION47U3Z.js} +3 -3
- package/dist/{chunk-OCIP6YMD.js → chunk-IXGQP4RZ.js} +3 -3
- package/dist/{chunk-FYZKFLKY.js → chunk-JFPZEWY3.js} +3 -3
- package/dist/{chunk-SMNYAMJD.js → chunk-JKL53MOY.js} +4 -4
- package/dist/{chunk-2T5AWWMF.js → chunk-JOA4Q765.js} +3 -3
- package/dist/{chunk-2XRE6FLM.js → chunk-JUOZ62Y7.js} +3 -1
- package/dist/chunk-JUOZ62Y7.js.map +1 -0
- package/dist/{chunk-MLPTFODV.js → chunk-KHQ57QLJ.js} +4 -4
- package/dist/{chunk-NSVDUN76.js → chunk-LCU5R6TQ.js} +8 -3
- package/dist/chunk-LCU5R6TQ.js.map +1 -0
- package/dist/{chunk-OTUFRUV3.js → chunk-LYPG7GOO.js} +4 -4
- package/dist/{chunk-OTUFRUV3.js.map → chunk-LYPG7GOO.js.map} +1 -1
- package/dist/{chunk-KRTY3ENI.js → chunk-MDVBCPOS.js} +2 -2
- package/dist/{chunk-M3UYE6PS.js → chunk-N655QIA2.js} +4 -4
- package/dist/{chunk-5NB726GV.js → chunk-NFQB6RJT.js} +3 -3
- package/dist/{chunk-OIOV4RJE.js → chunk-NP7FLVZW.js} +2 -2
- package/dist/{chunk-CX5SW2EW.js → chunk-NRFU5MVH.js} +4 -4
- package/dist/{chunk-QDWDVNWU.js → chunk-O4TTIMOP.js} +2 -2
- package/dist/{chunk-XCO2NXPZ.js → chunk-O54B5YNM.js} +3 -3
- package/dist/{chunk-UQWUDD7E.js → chunk-ONCWJBWV.js} +3 -3
- package/dist/{chunk-Z3SQEEB6.js → chunk-PD66CVSD.js} +2 -2
- package/dist/{chunk-QYN5PXDZ.js → chunk-PPUTUOC3.js} +2 -2
- package/dist/{chunk-TPWBUKS3.js → chunk-PSH3VFZ7.js} +4 -4
- package/dist/{chunk-MK5VEWCR.js → chunk-QKPDN325.js} +2 -2
- package/dist/{chunk-EVWWT3KE.js → chunk-QP2IZTUR.js} +2 -2
- package/dist/{chunk-4ESX4WX2.js → chunk-QSDPVZPD.js} +5 -5
- package/dist/{chunk-LHIBA4G7.js → chunk-QV7OEHFN.js} +2 -2
- package/dist/{chunk-3DVG3GRQ.js → chunk-QZR3WT3L.js} +2 -2
- package/dist/{chunk-EEAMSNSG.js → chunk-R7TZ2HCS.js} +2 -2
- package/dist/{chunk-IOYXIY7W.js → chunk-R7UHWPYI.js} +2 -2
- package/dist/{chunk-L6Z5OAS4.js → chunk-RL3EGL7A.js} +2 -2
- package/dist/{chunk-7SF5BAWF.js → chunk-S6AH7WSF.js} +3 -3
- package/dist/{chunk-QGKCM7C4.js → chunk-SFCJCMZQ.js} +5 -5
- package/dist/{chunk-K44N3CFW.js → chunk-T3HC7RJ7.js} +2 -2
- package/dist/chunk-T3JQTCCO.js +94 -0
- package/dist/chunk-T3JQTCCO.js.map +1 -0
- package/dist/{chunk-6PCND4O2.js → chunk-T6EQPZ6E.js} +4 -4
- package/dist/{chunk-G7YUH4WT.js → chunk-TAMY4NKO.js} +2 -2
- package/dist/{chunk-XDBFSUHX.js → chunk-TAPFJ3ET.js} +2 -2
- package/dist/{chunk-MANCJV6J.js → chunk-TF3LMM5E.js} +2 -2
- package/dist/{chunk-2GD6MLXD.js → chunk-TFXYQNBH.js} +12 -12
- package/dist/{chunk-7DISPKXT.js → chunk-THACANBI.js} +4 -4
- package/dist/{chunk-6G4D222J.js → chunk-TLVLJSWS.js} +2 -2
- package/dist/{chunk-6QPI2ITJ.js → chunk-TVKWT2CY.js} +4 -4
- package/dist/{chunk-H7NAZ3UB.js → chunk-U7BMN33M.js} +2 -2
- package/dist/{chunk-BXIMH7MC.js → chunk-UTDMY476.js} +49 -5
- package/dist/chunk-UTDMY476.js.map +1 -0
- package/dist/{chunk-6LKEUCEM.js → chunk-UXREWVW4.js} +2 -2
- package/dist/{chunk-SUPEYLH2.js → chunk-UYCIS6V5.js} +2 -2
- package/dist/{chunk-F2BOUJUS.js → chunk-V3IT3XNG.js} +9 -9
- package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
- package/dist/{chunk-NUA4VM46.js → chunk-VWP5DEHU.js} +2 -2
- package/dist/{chunk-NQMSEB5D.js → chunk-X5OIPQME.js} +2 -2
- package/dist/{chunk-RBII7637.js → chunk-XRPPHIRI.js} +2 -2
- package/dist/{chunk-OLT3YTDH.js → chunk-YMOPYG3K.js} +4 -4
- package/dist/{cli-DNvGlD4i.d.ts → cli-CQdYilcx.d.ts} +61 -11
- package/dist/cli.d.ts +18 -18
- package/dist/cli.js +84 -80
- package/dist/coding/pre-action-gate.d.ts +1 -1
- package/dist/coding/pre-action-gate.js +2 -2
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +16 -15
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config-security.d.ts +7 -0
- package/dist/config-security.js +12 -0
- 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 -13
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +15 -14
- package/dist/consolidation-provenance-check.d.ts +2 -2
- package/dist/consolidation-undo.d.ts +2 -2
- package/dist/contradiction/index.d.ts +2 -2
- package/dist/contradiction/index.js +4 -4
- package/dist/{contradiction-scan-JDTBXRGW.js → contradiction-scan-522AYLQC.js} +3 -3
- package/dist/converge-config.d.ts +1 -1
- package/dist/convergence-refresh.d.ts +2 -2
- package/dist/convergence-refresh.js +16 -15
- package/dist/conversation-index/backend.d.ts +1 -1
- 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 +1 -1
- package/dist/corpus-watermark.js +16 -15
- package/dist/day-summary.d.ts +1 -1
- package/dist/day-summary.js +2 -2
- package/dist/delinearize.d.ts +1 -1
- package/dist/dependency-propagation-config.d.ts +1 -1
- package/dist/{dependency-propagation-delivery-CzEfB31P.d.ts → dependency-propagation-delivery-C_K_AHcv.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-retrieval.d.ts +4 -2
- package/dist/entity-retrieval.js +15 -13
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +9 -9
- package/dist/explicit-capture.js +6 -6
- package/dist/external-wiki-access.d.ts +11 -11
- package/dist/external-wiki-access.js +45 -44
- package/dist/external-wiki-collection-registration.d.ts +1 -1
- package/dist/external-wiki-collection.d.ts +1 -1
- package/dist/external-wiki-mcp-tools.d.ts +11 -11
- 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-normalization.d.ts +1 -1
- package/dist/extraction-normalization.js +3 -3
- package/dist/extraction-prompt.d.ts +1 -1
- package/dist/extraction-prompt.js +2 -2
- package/dist/extraction-source-grounding-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/extraction.js +25 -24
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/{first-start-migration-CRZCZAJN.js → first-start-migration-HZ4VPRFQ.js} +2 -2
- package/dist/{forget-EHGGJZLX.js → forget-5TWK7CZT.js} +3 -3
- 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-decay-JI2XDCTY.js → graph-edge-decay-ZXGBXNPW.js} +4 -4
- package/dist/graph-edge-reinforcement.d.ts +1 -1
- package/dist/graph-path-reconstruction.d.ts +1 -1
- package/dist/graph-path-scoring.d.ts +1 -1
- package/dist/graph-snapshot.d.ts +1 -1
- package/dist/graph-snapshot.js +3 -3
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +2 -2
- package/dist/harmonic-retrieval.js +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 +755 -706
- package/dist/index.js +158 -133
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +3 -3
- 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 -13
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +14 -13
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +15 -14
- package/dist/{maintenance-laHYTo0s.d.ts → maintenance-DdP931i9.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +11 -11
- 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-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-snapshot.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +2 -2
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +3 -3
- package/dist/namespaces/migrate.js +15 -14
- 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 +4 -4
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +14 -13
- 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 +5 -5
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +17 -16
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +29 -27
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/compression-guideline-coordinator.js +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +22 -21
- package/dist/{orchestrator-Cz2QmqsN.d.ts → orchestrator-DxUWX7gs.d.ts} +26 -20
- package/dist/orchestrator.d.ts +9 -9
- package/dist/orchestrator.js +114 -112
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-DPcUifCO.d.ts → pipeline-BKUMU1vU.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/{public-http-Dq2iqtcI.d.ts → public-http-Dw0bJhcC.d.ts} +1 -1
- package/dist/{qmd-dFCHp1r0.d.ts → qmd-DJP-GLFe.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-context-composition.d.ts +11 -1
- package/dist/recall-context-composition.js +4 -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-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/reconcile/cursor.d.ts +1 -1
- package/dist/reconcile/manifest.d.ts +1 -1
- package/dist/reconcile/manifest.js +3 -3
- package/dist/reconcile/plan.d.ts +1 -1
- 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 +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/{resolution-MMOD5WC4.js → resolution-DKMBPXHI.js} +3 -3
- package/dist/resolution-DKMBPXHI.js.map +1 -0
- package/dist/resolve-auth-token.d.ts +1 -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/salvage-envelope.js +2 -2
- package/dist/schemas.d.ts +138 -138
- package/dist/{scope-profiles-DICK7GtN.d.ts → scope-profiles-CaKcnB-6.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 +3 -3
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +3 -3
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/port.d.ts +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-BP7NAX0N.d.ts → semantic-consolidation-P0eMWqh-.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +15 -14
- package/dist/semantic-rule-promotion.js +14 -13
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +14 -13
- package/dist/{service-D_ddZmpI.d.ts → service-D5GQLxq_.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/source-agent-qualifier.d.ts +1 -1
- package/dist/source-agent-qualifier.js +20 -19
- package/dist/{storage-Cdz7jb9t.d.ts → storage-DIyil2ll.d.ts} +5 -2
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +13 -12
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +3 -3
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/support-passport/index.d.ts +14 -14
- package/dist/support-passport/index.js +47 -46
- package/dist/temporal-supersession.d.ts +2 -2
- package/dist/temporal-timeline-recall.d.ts +3 -1
- package/dist/temporal-timeline-recall.js +3 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +2 -2
- package/dist/tier-routing.d.ts +1 -1
- package/dist/{tier-stats-EXYSKSVN.js → tier-stats-7E6OBUSD.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-ed-SvS2t.d.ts → types-CbXieHKr.d.ts} +15 -3
- 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 -13
- package/dist/write-envelope.d.ts +5 -2
- package/dist/write-envelope.js +1 -1
- package/package.json +2 -2
- package/src/bitemporal-frontmatter.test.ts +20 -1
- package/src/capabilities.test.ts +2 -0
- package/src/capabilities.ts +17 -17
- package/src/cli.ts +14 -0
- package/src/config-security.ts +131 -0
- package/src/config.test.ts +61 -0
- package/src/config.ts +2 -1
- package/src/entity-retrieval.ts +31 -24
- package/src/index.ts +4 -6
- package/src/orchestration/conversation-index-coordinator.ts +13 -2
- package/src/orchestration/extraction-injection-gate.ts +154 -0
- package/src/orchestration/extraction-origin-context.ts +90 -0
- package/src/orchestration/extraction-persist.ts +66 -64
- package/src/orchestration/extraction-run.ts +4 -2
- package/src/orchestration/extraction-security.test.ts +271 -0
- package/src/orchestration/graph-recall-coordinator.ts +2 -0
- package/src/orchestration/namespace-read-fanout.ts +1 -0
- package/src/orchestration/qmd-result-resolver.ts +1 -0
- package/src/orchestration/recall-internal.ts +17 -11
- package/src/orchestration/recall-result-formatter.ts +35 -6
- package/src/orchestration/recall-search-pipeline.ts +3 -5
- package/src/orchestration/recall-search-prefilter.ts +1 -0
- package/src/orchestrator.ts +2 -1
- package/src/procedural/procedure-recall.ts +11 -1
- package/src/recall-authority-fence.test.ts +180 -0
- package/src/recall-context-composition.ts +28 -0
- package/src/security/audit-memory-cli.ts +42 -0
- package/src/security/audit-memory.test.ts +252 -0
- package/src/security/audit-memory.ts +318 -0
- package/src/security/injection-screen.test.ts +77 -0
- package/src/security/injection-screen.ts +158 -0
- package/src/security/origin-authority.test.ts +61 -0
- package/src/security/origin-authority.ts +88 -0
- package/src/security/types.ts +14 -0
- package/src/semantic-rule-promotion.ts +1 -1
- package/src/storage.ts +10 -2
- package/src/temporal-timeline-recall.test.ts +18 -0
- package/src/temporal-timeline-recall.ts +12 -1
- package/src/types.ts +4 -4
- package/src/write-envelope.test.ts +1 -0
- package/src/write-envelope.ts +9 -0
- package/dist/chunk-2XRE6FLM.js.map +0 -1
- package/dist/chunk-5V64M56S.js.map +0 -1
- package/dist/chunk-76JJSXK7.js.map +0 -1
- package/dist/chunk-AHVEHR6K.js.map +0 -1
- package/dist/chunk-BXIMH7MC.js.map +0 -1
- package/dist/chunk-FPKKFDO4.js.map +0 -1
- package/dist/chunk-I6WYQSX4.js.map +0 -1
- package/dist/chunk-NSVDUN76.js.map +0 -1
- package/dist/chunk-OS5DYALF.js.map +0 -1
- package/dist/chunk-PG4QBPVG.js.map +0 -1
- package/dist/chunk-XXRRHING.js.map +0 -1
- /package/dist/{auto-sync-NR3GPCOA.js.map → auto-sync-5HVRCMGZ.js.map} +0 -0
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-E2GZSFR5.js.map → chunk-2YREVL4T.js.map} +0 -0
- /package/dist/{chunk-KM55SMLG.js.map → chunk-4KM3V6VS.js.map} +0 -0
- /package/dist/{chunk-HAEU3ZW7.js.map → chunk-4OW2T32G.js.map} +0 -0
- /package/dist/{chunk-PCRHFB75.js.map → chunk-4QFCAKNM.js.map} +0 -0
- /package/dist/{chunk-OWC42MDT.js.map → chunk-5ZIWRMZM.js.map} +0 -0
- /package/dist/{chunk-GWFSVJ4P.js.map → chunk-6KTXE6A3.js.map} +0 -0
- /package/dist/{chunk-P2FA65P2.js.map → chunk-7NSC4IVA.js.map} +0 -0
- /package/dist/{chunk-QC6BILS7.js.map → chunk-7PKNOXYB.js.map} +0 -0
- /package/dist/{chunk-RZRUV6N2.js.map → chunk-ANMIOQPU.js.map} +0 -0
- /package/dist/{chunk-RPSYDM6C.js.map → chunk-BPWZDHFM.js.map} +0 -0
- /package/dist/{chunk-JKW663ZN.js.map → chunk-BVRREV3N.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-ELXP665P.js.map → chunk-CKSEJD7K.js.map} +0 -0
- /package/dist/{chunk-4GE3NA5I.js.map → chunk-CME347TM.js.map} +0 -0
- /package/dist/{chunk-BGLY7EEM.js.map → chunk-CMRUIKVA.js.map} +0 -0
- /package/dist/{chunk-HGJ6NJ4E.js.map → chunk-D4LVHPOA.js.map} +0 -0
- /package/dist/{chunk-YK6BDDHP.js.map → chunk-DFEODULB.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-XWZ6KOL6.js.map → chunk-E57E5SCS.js.map} +0 -0
- /package/dist/{chunk-M23RF3LJ.js.map → chunk-ER4BLWI6.js.map} +0 -0
- /package/dist/{chunk-47J4EDGR.js.map → chunk-F7M36OG2.js.map} +0 -0
- /package/dist/{chunk-ZUJW327U.js.map → chunk-FONW766A.js.map} +0 -0
- /package/dist/{chunk-FEBHRT2I.js.map → chunk-FR3FNPCJ.js.map} +0 -0
- /package/dist/{chunk-G6DFSS6A.js.map → chunk-GUNIXT36.js.map} +0 -0
- /package/dist/{chunk-K2UGPTYY.js.map → chunk-H6ZXNH5I.js.map} +0 -0
- /package/dist/{chunk-Z463UYI6.js.map → chunk-HC55YCNK.js.map} +0 -0
- /package/dist/{chunk-IEQCHXUS.js.map → chunk-HQ2VGCGP.js.map} +0 -0
- /package/dist/{chunk-ZXGKQQ3L.js.map → chunk-HXXGZ4KV.js.map} +0 -0
- /package/dist/{chunk-YZFPEHXF.js.map → chunk-HYVBJLEK.js.map} +0 -0
- /package/dist/{chunk-3GD2HFR6.js.map → chunk-IGWVMA4Y.js.map} +0 -0
- /package/dist/{chunk-FONWBCVY.js.map → chunk-IKT6ZVO7.js.map} +0 -0
- /package/dist/{chunk-KMWYZTIE.js.map → chunk-ION47U3Z.js.map} +0 -0
- /package/dist/{chunk-OCIP6YMD.js.map → chunk-IXGQP4RZ.js.map} +0 -0
- /package/dist/{chunk-FYZKFLKY.js.map → chunk-JFPZEWY3.js.map} +0 -0
- /package/dist/{chunk-SMNYAMJD.js.map → chunk-JKL53MOY.js.map} +0 -0
- /package/dist/{chunk-2T5AWWMF.js.map → chunk-JOA4Q765.js.map} +0 -0
- /package/dist/{chunk-MLPTFODV.js.map → chunk-KHQ57QLJ.js.map} +0 -0
- /package/dist/{chunk-KRTY3ENI.js.map → chunk-MDVBCPOS.js.map} +0 -0
- /package/dist/{chunk-M3UYE6PS.js.map → chunk-N655QIA2.js.map} +0 -0
- /package/dist/{chunk-5NB726GV.js.map → chunk-NFQB6RJT.js.map} +0 -0
- /package/dist/{chunk-OIOV4RJE.js.map → chunk-NP7FLVZW.js.map} +0 -0
- /package/dist/{chunk-CX5SW2EW.js.map → chunk-NRFU5MVH.js.map} +0 -0
- /package/dist/{chunk-QDWDVNWU.js.map → chunk-O4TTIMOP.js.map} +0 -0
- /package/dist/{chunk-XCO2NXPZ.js.map → chunk-O54B5YNM.js.map} +0 -0
- /package/dist/{chunk-UQWUDD7E.js.map → chunk-ONCWJBWV.js.map} +0 -0
- /package/dist/{chunk-Z3SQEEB6.js.map → chunk-PD66CVSD.js.map} +0 -0
- /package/dist/{chunk-QYN5PXDZ.js.map → chunk-PPUTUOC3.js.map} +0 -0
- /package/dist/{chunk-TPWBUKS3.js.map → chunk-PSH3VFZ7.js.map} +0 -0
- /package/dist/{chunk-MK5VEWCR.js.map → chunk-QKPDN325.js.map} +0 -0
- /package/dist/{chunk-EVWWT3KE.js.map → chunk-QP2IZTUR.js.map} +0 -0
- /package/dist/{chunk-4ESX4WX2.js.map → chunk-QSDPVZPD.js.map} +0 -0
- /package/dist/{chunk-LHIBA4G7.js.map → chunk-QV7OEHFN.js.map} +0 -0
- /package/dist/{chunk-3DVG3GRQ.js.map → chunk-QZR3WT3L.js.map} +0 -0
- /package/dist/{chunk-EEAMSNSG.js.map → chunk-R7TZ2HCS.js.map} +0 -0
- /package/dist/{chunk-IOYXIY7W.js.map → chunk-R7UHWPYI.js.map} +0 -0
- /package/dist/{chunk-L6Z5OAS4.js.map → chunk-RL3EGL7A.js.map} +0 -0
- /package/dist/{chunk-7SF5BAWF.js.map → chunk-S6AH7WSF.js.map} +0 -0
- /package/dist/{chunk-QGKCM7C4.js.map → chunk-SFCJCMZQ.js.map} +0 -0
- /package/dist/{chunk-K44N3CFW.js.map → chunk-T3HC7RJ7.js.map} +0 -0
- /package/dist/{chunk-6PCND4O2.js.map → chunk-T6EQPZ6E.js.map} +0 -0
- /package/dist/{chunk-G7YUH4WT.js.map → chunk-TAMY4NKO.js.map} +0 -0
- /package/dist/{chunk-XDBFSUHX.js.map → chunk-TAPFJ3ET.js.map} +0 -0
- /package/dist/{chunk-MANCJV6J.js.map → chunk-TF3LMM5E.js.map} +0 -0
- /package/dist/{chunk-2GD6MLXD.js.map → chunk-TFXYQNBH.js.map} +0 -0
- /package/dist/{chunk-7DISPKXT.js.map → chunk-THACANBI.js.map} +0 -0
- /package/dist/{chunk-6G4D222J.js.map → chunk-TLVLJSWS.js.map} +0 -0
- /package/dist/{chunk-6QPI2ITJ.js.map → chunk-TVKWT2CY.js.map} +0 -0
- /package/dist/{chunk-H7NAZ3UB.js.map → chunk-U7BMN33M.js.map} +0 -0
- /package/dist/{chunk-6LKEUCEM.js.map → chunk-UXREWVW4.js.map} +0 -0
- /package/dist/{chunk-SUPEYLH2.js.map → chunk-UYCIS6V5.js.map} +0 -0
- /package/dist/{chunk-F2BOUJUS.js.map → chunk-V3IT3XNG.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-NUA4VM46.js.map → chunk-VWP5DEHU.js.map} +0 -0
- /package/dist/{chunk-NQMSEB5D.js.map → chunk-X5OIPQME.js.map} +0 -0
- /package/dist/{chunk-RBII7637.js.map → chunk-XRPPHIRI.js.map} +0 -0
- /package/dist/{chunk-OLT3YTDH.js.map → chunk-YMOPYG3K.js.map} +0 -0
- /package/dist/{contradiction-scan-JDTBXRGW.js.map → config-security.js.map} +0 -0
- /package/dist/{graph-edge-decay-JI2XDCTY.js.map → contradiction-scan-522AYLQC.js.map} +0 -0
- /package/dist/{first-start-migration-CRZCZAJN.js.map → first-start-migration-HZ4VPRFQ.js.map} +0 -0
- /package/dist/{forget-EHGGJZLX.js.map → forget-5TWK7CZT.js.map} +0 -0
- /package/dist/{resolution-MMOD5WC4.js.map → graph-edge-decay-ZXGBXNPW.js.map} +0 -0
- /package/dist/{tier-stats-EXYSKSVN.js.map → tier-stats-7E6OBUSD.js.map} +0 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure issue #1955 injection-screen gate for extracted facts.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { normalizeAttributePairs } from "../structured-attributes.js";
|
|
6
|
+
import { buildProcedurePersistBody } from "../procedural/procedure-types.js";
|
|
7
|
+
import { screenCandidateFact } from "../security/injection-screen.js";
|
|
8
|
+
import type { EntityStructuredSection } from "../types.js";
|
|
9
|
+
|
|
10
|
+
export interface InjectionScreenCandidate {
|
|
11
|
+
content: string;
|
|
12
|
+
category?: string;
|
|
13
|
+
structuredAttributes?: Record<string, unknown>;
|
|
14
|
+
procedureSteps?: unknown;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface InjectionScreenGateResult {
|
|
18
|
+
status?: "pending_review";
|
|
19
|
+
tags: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Serialize the body fields that the persistence path will store. */
|
|
23
|
+
export function serializeInjectionScreenCandidate(candidate: InjectionScreenCandidate): string {
|
|
24
|
+
const body =
|
|
25
|
+
candidate.category === "procedure"
|
|
26
|
+
? buildProcedurePersistBody(candidate.content, candidate.procedureSteps)
|
|
27
|
+
: candidate.content;
|
|
28
|
+
// Salvage malformed extractor output: non-string attribute values (e.g.
|
|
29
|
+
// `{ priority: 1 }`) must not throw and abort the whole extraction batch
|
|
30
|
+
// (#1955 review). Coerce primitives; drop anything else.
|
|
31
|
+
const attrs = Object.fromEntries(
|
|
32
|
+
Object.entries(candidate.structuredAttributes ?? {}).flatMap(([key, value]): Array<[string, string]> => {
|
|
33
|
+
if (typeof value === "string") return [[key, value]];
|
|
34
|
+
if (typeof value === "number" || typeof value === "boolean") return [[key, String(value)]];
|
|
35
|
+
return [];
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
return Object.keys(attrs).length > 0
|
|
39
|
+
? `${body}\n[Attributes: ${normalizeAttributePairs(attrs)}]`
|
|
40
|
+
: body;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Screen one candidate and assemble the persistence effects. */
|
|
44
|
+
export function evaluateInjectionScreen(
|
|
45
|
+
candidate: InjectionScreenCandidate | string,
|
|
46
|
+
enabled: boolean,
|
|
47
|
+
): InjectionScreenGateResult {
|
|
48
|
+
if (!enabled) return { tags: [] };
|
|
49
|
+
const content =
|
|
50
|
+
typeof candidate === "string" ? candidate : serializeInjectionScreenCandidate(candidate);
|
|
51
|
+
const result = screenCandidateFact(content);
|
|
52
|
+
return {
|
|
53
|
+
status: result.quarantine === true ? "pending_review" : undefined,
|
|
54
|
+
tags: result.quarantine === true
|
|
55
|
+
? result.findings.map((finding) => `injection-screen:${finding.rule}`)
|
|
56
|
+
: [],
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Withhold injection-flagged strings from an entity-index write (#1955
|
|
62
|
+
* review): entity facts/sections have no review status, so a flagged field is
|
|
63
|
+
* excluded from the recallable index and surfaced via the returned rules for
|
|
64
|
+
* the caller to log. Screen off → strings pass through unfiltered.
|
|
65
|
+
*/
|
|
66
|
+
export function withholdScreenedStrings(
|
|
67
|
+
values: readonly unknown[],
|
|
68
|
+
enabled: boolean,
|
|
69
|
+
): { kept: string[]; withheldRules: string[] } {
|
|
70
|
+
const kept: string[] = [];
|
|
71
|
+
const withheldRules: string[] = [];
|
|
72
|
+
for (const value of values) {
|
|
73
|
+
if (typeof value !== "string") continue;
|
|
74
|
+
if (!enabled) {
|
|
75
|
+
kept.push(value);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const screened = screenCandidateFact(value);
|
|
79
|
+
if (screened.quarantine) {
|
|
80
|
+
withheldRules.push(...screened.findings.map((finding) => `injection-screen:${finding.rule}`));
|
|
81
|
+
} else {
|
|
82
|
+
kept.push(value);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { kept, withheldRules };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface ScreenedEntityWrite {
|
|
89
|
+
name: string;
|
|
90
|
+
type: string;
|
|
91
|
+
source: string;
|
|
92
|
+
facts: string[];
|
|
93
|
+
structuredSections?: EntityStructuredSection[];
|
|
94
|
+
withheldRules: string[];
|
|
95
|
+
/** True when the entity NAME itself was flagged — callers must not index it. */
|
|
96
|
+
withheld: boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Validate and screen one extracted entity before it enters the entity index
|
|
101
|
+
* (#1955 review): flagged facts/section facts are withheld and reported via
|
|
102
|
+
* `withheldRules` (entities carry no review status; routing is #2397).
|
|
103
|
+
* Returns null for entities without a usable name/type.
|
|
104
|
+
*/
|
|
105
|
+
export function screenEntityForIndex(entity: unknown, enabled: boolean): ScreenedEntityWrite | null {
|
|
106
|
+
const record = entity as { name?: unknown; type?: unknown; source?: unknown; facts?: unknown; structuredSections?: unknown } | null;
|
|
107
|
+
const name = record?.name;
|
|
108
|
+
const type = record?.type;
|
|
109
|
+
if (typeof name !== "string" || !name.trim() || typeof type !== "string" || !type.trim()) return null;
|
|
110
|
+
// #1955 review: the raw name is emitted as the entity target outside the
|
|
111
|
+
// snippet fence — a flagged name withholds the whole entity from the index.
|
|
112
|
+
const nameScreen = withholdScreenedStrings([name], enabled);
|
|
113
|
+
const factScreen = withholdScreenedStrings(Array.isArray(record?.facts) ? record.facts : [], enabled);
|
|
114
|
+
const rawSections: EntityStructuredSection[] | undefined = Array.isArray(record?.structuredSections)
|
|
115
|
+
? (record.structuredSections as EntityStructuredSection[])
|
|
116
|
+
: undefined;
|
|
117
|
+
const sectionScreens = enabled && rawSections
|
|
118
|
+
? rawSections.map((section) => ({ section, screen: withholdScreenedStrings(section?.facts ?? [], true) }))
|
|
119
|
+
: undefined;
|
|
120
|
+
return {
|
|
121
|
+
name,
|
|
122
|
+
type,
|
|
123
|
+
source: typeof record?.source === "string" ? record.source : "extraction",
|
|
124
|
+
facts: factScreen.kept,
|
|
125
|
+
...(sectionScreens
|
|
126
|
+
? { structuredSections: sectionScreens.map(({ section, screen }) => ({ ...section, facts: screen.kept })) }
|
|
127
|
+
: rawSections
|
|
128
|
+
? { structuredSections: rawSections }
|
|
129
|
+
: {}),
|
|
130
|
+
withheldRules: [
|
|
131
|
+
...nameScreen.withheldRules,
|
|
132
|
+
...factScreen.withheldRules,
|
|
133
|
+
...(sectionScreens ?? []).flatMap(({ screen }) => screen.withheldRules),
|
|
134
|
+
],
|
|
135
|
+
withheld: nameScreen.withheldRules.length > 0,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Screen a batch of persist-bound strings and preformat the withheld warning
|
|
141
|
+
* (#1955): keeps persist call sites within their file-size ratchet.
|
|
142
|
+
*/
|
|
143
|
+
export function screenPersistStrings(
|
|
144
|
+
values: readonly string[],
|
|
145
|
+
enabled: boolean,
|
|
146
|
+
): { kept: string[]; warning?: string } {
|
|
147
|
+
const screen = withholdScreenedStrings(values, enabled);
|
|
148
|
+
return {
|
|
149
|
+
kept: screen.kept,
|
|
150
|
+
...(screen.withheldRules.length > 0
|
|
151
|
+
? { warning: `injection screen withheld ${values.length - screen.kept.length} candidate(s) [${screen.withheldRules.join(", ")}]` }
|
|
152
|
+
: {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derive issue #1955 origin metadata at the extraction boundary.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { classifyOrigin, type OriginClass } from "../security/origin-authority.js";
|
|
6
|
+
import type { BufferTurn } from "../types.js";
|
|
7
|
+
|
|
8
|
+
export interface ExtractionSourceContext {
|
|
9
|
+
sessionKey?: string;
|
|
10
|
+
principal?: string;
|
|
11
|
+
validAt?: string;
|
|
12
|
+
sourceConnector?: string;
|
|
13
|
+
turnRole?: "user" | "assistant" | "tool" | string;
|
|
14
|
+
importAdapter?: string;
|
|
15
|
+
originConflict?: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Derive one origin context from the turns that supplied an extraction. */
|
|
19
|
+
export function deriveExtractionOriginContext(
|
|
20
|
+
targetTurns: readonly BufferTurn[],
|
|
21
|
+
fallbackConnector?: string,
|
|
22
|
+
): Pick<ExtractionSourceContext, "turnRole" | "importAdapter" | "sourceConnector" | "originConflict"> {
|
|
23
|
+
const originRoles = new Set(targetTurns.map((turn) => turn.role));
|
|
24
|
+
const turnRole = originRoles.size === 1 ? [...originRoles][0] : undefined;
|
|
25
|
+
const originConnectors = new Set(
|
|
26
|
+
targetTurns
|
|
27
|
+
.map((turn) => turn.sourceConnector)
|
|
28
|
+
.filter((connector): connector is string => typeof connector === "string" && connector.length > 0),
|
|
29
|
+
);
|
|
30
|
+
// Mirror the pre-#1955 provenance rule: a batch only carries a connector
|
|
31
|
+
// when EVERY turn is tagged with the same one — a mixed tagged+untagged
|
|
32
|
+
// batch must stay connector-less (connector-provenance-lifecycle tests).
|
|
33
|
+
const connector =
|
|
34
|
+
targetTurns.length > 0 &&
|
|
35
|
+
targetTurns.every(
|
|
36
|
+
(turn) => typeof turn.sourceConnector === "string" && turn.sourceConnector.length > 0,
|
|
37
|
+
) &&
|
|
38
|
+
originConnectors.size === 1
|
|
39
|
+
? [...originConnectors][0]
|
|
40
|
+
: undefined;
|
|
41
|
+
const originAdapters = new Set(
|
|
42
|
+
targetTurns
|
|
43
|
+
.map((turn) => turn.importProvenance?.sourceLabel)
|
|
44
|
+
.filter((adapter): adapter is string => typeof adapter === "string" && adapter.length > 0),
|
|
45
|
+
);
|
|
46
|
+
// Conflict when identities disagree OR are only partially present: a batch
|
|
47
|
+
// where some turns carry an import label (or connector) and others do not
|
|
48
|
+
// must classify as unknown, never fall back to the uniform turn role
|
|
49
|
+
// (#1955 review: mixed import labels previously became `user`).
|
|
50
|
+
const everyTurnHasConnector =
|
|
51
|
+
targetTurns.length > 0 &&
|
|
52
|
+
targetTurns.every((turn) => typeof turn.sourceConnector === "string" && turn.sourceConnector.length > 0);
|
|
53
|
+
const everyTurnHasAdapter =
|
|
54
|
+
targetTurns.length > 0 &&
|
|
55
|
+
targetTurns.every(
|
|
56
|
+
(turn) => typeof turn.importProvenance?.sourceLabel === "string" && turn.importProvenance.sourceLabel.length > 0,
|
|
57
|
+
);
|
|
58
|
+
const originConflict =
|
|
59
|
+
originConnectors.size > 1 ||
|
|
60
|
+
originAdapters.size > 1 ||
|
|
61
|
+
(originConnectors.size > 0 && originAdapters.size > 0) ||
|
|
62
|
+
(originConnectors.size > 0 && !everyTurnHasConnector) ||
|
|
63
|
+
(originAdapters.size > 0 && !everyTurnHasAdapter);
|
|
64
|
+
const importAdapter =
|
|
65
|
+
targetTurns.length > 0 &&
|
|
66
|
+
targetTurns.every(
|
|
67
|
+
(turn) =>
|
|
68
|
+
typeof turn.importProvenance?.sourceLabel === "string" &&
|
|
69
|
+
turn.importProvenance.sourceLabel.length > 0,
|
|
70
|
+
) &&
|
|
71
|
+
originAdapters.size === 1
|
|
72
|
+
? [...originAdapters][0]
|
|
73
|
+
: undefined;
|
|
74
|
+
return {
|
|
75
|
+
...(turnRole ? { turnRole } : {}),
|
|
76
|
+
...(importAdapter ? { importAdapter } : {}),
|
|
77
|
+
...(originConflict ? { originConflict: true } : {}),
|
|
78
|
+
sourceConnector: fallbackConnector ?? connector,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Classify the persisted origin without reading config flags. */
|
|
83
|
+
export function classifyExtractionOrigin(sourceContext?: ExtractionSourceContext): OriginClass {
|
|
84
|
+
if (sourceContext?.originConflict === true) return "unknown";
|
|
85
|
+
return classifyOrigin({
|
|
86
|
+
turnRole: sourceContext?.turnRole,
|
|
87
|
+
connectorId: sourceContext?.sourceConnector,
|
|
88
|
+
importAdapter: sourceContext?.importAdapter,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { classifyExtractionOrigin, type ExtractionSourceContext } from "./extraction-origin-context.js";
|
|
2
|
+
import { evaluateInjectionScreen, screenEntityForIndex, screenPersistStrings } from "./extraction-injection-gate.js";
|
|
1
3
|
/**
|
|
2
4
|
* Extraction persistence coordinator (issue #1526, seam 16).
|
|
3
5
|
*
|
|
@@ -26,9 +28,8 @@ import {
|
|
|
26
28
|
resolvePresentationCapabilities,
|
|
27
29
|
resolveNamespaceCapabilities,
|
|
28
30
|
resolveRecallEnhancementCapabilities,
|
|
29
|
-
resolveConversationContextCapabilities,
|
|
30
31
|
resolveRecallAuxiliaryCapabilities,
|
|
31
|
-
type GraphConstructionCapabilitySet,
|
|
32
|
+
resolveConversationContextCapabilities, resolveSecurityCapabilities, type GraphConstructionCapabilitySet,
|
|
32
33
|
type MemoryLifecycleCapabilitySet,
|
|
33
34
|
} from "../capabilities.js";
|
|
34
35
|
import { coerceBool } from "../connectors/coerce.js";
|
|
@@ -132,7 +133,7 @@ export class ExtractionPersistCoordinator {
|
|
|
132
133
|
result: ExtractionResult,
|
|
133
134
|
storage: StorageManager,
|
|
134
135
|
threadIdForExtraction?: string | null,
|
|
135
|
-
sourceContext?:
|
|
136
|
+
sourceContext?: ExtractionSourceContext,
|
|
136
137
|
baseNamespace?: string,
|
|
137
138
|
scopeProfileWritePlan?: ResolvedScopeProfilePlan | null,
|
|
138
139
|
/** Verbatim source turn text the facts were extracted from (faithfulness gate #1576). */
|
|
@@ -337,7 +338,7 @@ export class ExtractionPersistCoordinator {
|
|
|
337
338
|
// (pre-judge + write-loop) so no new scattered config.*Enabled read is
|
|
338
339
|
// introduced (ratchet scatteredConfigFlagReads; see #1523).
|
|
339
340
|
const namespacesEnabled = resolveNamespaceCapabilities(this.deps.config).namespaces;
|
|
340
|
-
const sourceConnector = sourceContext?.sourceConnector;
|
|
341
|
+
const sourceConnector = sourceContext?.sourceConnector; const origin = classifyExtractionOrigin(sourceContext);
|
|
341
342
|
const promoteMemoryToProfileTargets = async (options: {
|
|
342
343
|
sourceStorage: StorageManager;
|
|
343
344
|
category: string;
|
|
@@ -400,7 +401,7 @@ export class ExtractionPersistCoordinator {
|
|
|
400
401
|
{
|
|
401
402
|
content: citedContent,
|
|
402
403
|
category: options.category as MemoryCategory,
|
|
403
|
-
confidence: options.confidence,
|
|
404
|
+
origin, confidence: options.confidence,
|
|
404
405
|
tags: withReservedMarkerTag(options.tags, `${target.target}-promotion`),
|
|
405
406
|
entityRef: options.entityRef,
|
|
406
407
|
structuredAttributes: options.structuredAttributes,
|
|
@@ -643,7 +644,7 @@ export class ExtractionPersistCoordinator {
|
|
|
643
644
|
{
|
|
644
645
|
content: citedContent,
|
|
645
646
|
category: options.category as MemoryCategory,
|
|
646
|
-
confidence: options.confidence,
|
|
647
|
+
origin, confidence: options.confidence,
|
|
647
648
|
tags: withReservedMarkerTag(options.tags, "shared-promotion"),
|
|
648
649
|
entityRef: options.entityRef,
|
|
649
650
|
structuredAttributes: options.structuredAttributes,
|
|
@@ -1622,6 +1623,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1622
1623
|
entityRef: fact.entityRef,
|
|
1623
1624
|
validAt: biTemporal?.validFrom ?? sourceContext?.validAt,
|
|
1624
1625
|
};
|
|
1626
|
+
const { status: injectionScreenStatus, tags: injectionScreenTags } = evaluateInjectionScreen({ content: fact.content, category: writeCategory, structuredAttributes: fact.structuredAttributes, procedureSteps: fact.procedureSteps }, resolveSecurityCapabilities(this.deps.config).injectionScreen);
|
|
1625
1627
|
// #1669 redaction-rule gate: consult BOTH source and target namespace
|
|
1626
1628
|
// rules before any write. A never-store pattern registered under the
|
|
1627
1629
|
// source namespace must survive scope-routing to a different target
|
|
@@ -1724,7 +1726,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1724
1726
|
exactDuplicate = false;
|
|
1725
1727
|
}
|
|
1726
1728
|
}
|
|
1727
|
-
if (exactDuplicate) {
|
|
1729
|
+
if (exactDuplicate && injectionScreenStatus !== "pending_review") {
|
|
1728
1730
|
// #1671 — before short-circuiting, backfill bi-temporal bounds
|
|
1729
1731
|
// onto the existing source-namespace copy if it lacks bounds the
|
|
1730
1732
|
// incoming fact now carries (re-extraction with a resolved invalidAt).
|
|
@@ -1809,8 +1811,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1809
1811
|
dedupedCount++;
|
|
1810
1812
|
continue;
|
|
1811
1813
|
}
|
|
1812
|
-
|
|
1813
|
-
if (writeCategory === "procedure" && this.deps.config.procedural?.enabled !== true) {
|
|
1814
|
+
if (writeCategory === "procedure" && this.deps.config.procedural?.enabled !== true && injectionScreenStatus !== "pending_review") {
|
|
1814
1815
|
log.debug("persistExtraction: skip procedure memory (procedural.enabled is false)");
|
|
1815
1816
|
continue;
|
|
1816
1817
|
}
|
|
@@ -1824,6 +1825,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1824
1825
|
// gate, trivial turn-level chatter ("hi", "k", heartbeat pings) gets
|
|
1825
1826
|
// persisted as a fact memory and dilutes the store.
|
|
1826
1827
|
if (
|
|
1828
|
+
injectionScreenStatus !== "pending_review" &&
|
|
1827
1829
|
!isAboveImportanceThreshold(
|
|
1828
1830
|
importance.level,
|
|
1829
1831
|
this.deps.config.extractionMinImportanceLevel,
|
|
@@ -1851,7 +1853,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1851
1853
|
// extraction pass. The judge module tracks how many times the same
|
|
1852
1854
|
// content has been deferred and converts to reject at the configured
|
|
1853
1855
|
// cap, so the orchestrator only needs to skip the write here.
|
|
1854
|
-
if (judgeVerdictsByFactIndex) {
|
|
1856
|
+
if (judgeVerdictsByFactIndex && injectionScreenStatus !== "pending_review") {
|
|
1855
1857
|
const verdict = judgeVerdictsByFactIndex.get(factLoopIndex);
|
|
1856
1858
|
if (verdict && !verdict.durable) {
|
|
1857
1859
|
const verdictKind = getVerdictKind(verdict);
|
|
@@ -1878,7 +1880,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1878
1880
|
// Procedure extraction gate (issue #519): ≥2 steps + trigger phrasing.
|
|
1879
1881
|
// Runs even when extractionJudgeEnabled is false (durability judge is unrelated).
|
|
1880
1882
|
// Never tied to extractionJudgeShadow — that flag is only for the LLM durability judge.
|
|
1881
|
-
if (writeCategory === "procedure") {
|
|
1883
|
+
if (writeCategory === "procedure" && injectionScreenStatus !== "pending_review") {
|
|
1882
1884
|
const procGate = validateProcedureExtraction({
|
|
1883
1885
|
content: fact.content,
|
|
1884
1886
|
procedureSteps: fact.procedureSteps,
|
|
@@ -1918,7 +1920,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1918
1920
|
fact.requireSpansPending === true
|
|
1919
1921
|
? ("pending_review" as const)
|
|
1920
1922
|
: undefined;
|
|
1921
|
-
const faithfulnessEnforceStatus = faithfulnessGateStatus ?? requireSpansPendingStatus;
|
|
1923
|
+
const faithfulnessEnforceStatus = faithfulnessGateStatus ?? requireSpansPendingStatus ?? injectionScreenStatus;
|
|
1922
1924
|
|
|
1923
1925
|
// Issue #373 — write-time semantic similarity guard. Hook runs after
|
|
1924
1926
|
// the exact content-hash miss and the importance gate so that:
|
|
@@ -1939,7 +1941,7 @@ export class ExtractionPersistCoordinator {
|
|
|
1939
1941
|
// a high-similarity update/correction is linked as a superseding
|
|
1940
1942
|
// contradiction rather than silently dropped.
|
|
1941
1943
|
let pendingSemanticSkip: (SemanticDedupDecision & { action: "skip" }) | null = null;
|
|
1942
|
-
if (resolvePipelineProcessingCapabilities(this.deps.config).semanticDedup) {
|
|
1944
|
+
if (resolvePipelineProcessingCapabilities(this.deps.config).semanticDedup && injectionScreenStatus !== "pending_review") {
|
|
1943
1945
|
let semanticDecision: SemanticDedupDecision;
|
|
1944
1946
|
// UUI2: skip embedding lookup for the rest of this batch once we know
|
|
1945
1947
|
// the backend is unavailable. The flag is reset per-batch (set to false
|
|
@@ -2189,8 +2191,8 @@ export class ExtractionPersistCoordinator {
|
|
|
2189
2191
|
{
|
|
2190
2192
|
content: citedChunkedContent,
|
|
2191
2193
|
category: writeCategory,
|
|
2192
|
-
confidence: fact.confidence,
|
|
2193
|
-
tags: withReservedMarkerTag(fact.tags, "chunked"),
|
|
2194
|
+
origin, confidence: fact.confidence,
|
|
2195
|
+
tags: withReservedMarkerTag([...fact.tags, ...injectionScreenTags], "chunked"),
|
|
2194
2196
|
entityRef: fact.entityRef,
|
|
2195
2197
|
structuredAttributes: fact.structuredAttributes,
|
|
2196
2198
|
validAt: biTemporal ? biTemporal.validFrom : sourceContext?.validAt,
|
|
@@ -2302,7 +2304,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2302
2304
|
// the verified span (chatgpt-codex-connector thread Ocvmo).
|
|
2303
2305
|
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2304
2306
|
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2305
|
-
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2307
|
+
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}), ...(origin ? { origin } : {}),
|
|
2306
2308
|
...(factToolScoped ? { toolScoped: true as const } : {}),
|
|
2307
2309
|
},
|
|
2308
2310
|
);
|
|
@@ -2459,6 +2461,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2459
2461
|
intentActionType: inferredIntent?.actionType,
|
|
2460
2462
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
2461
2463
|
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2464
|
+
...(origin ? { origin } : {}),
|
|
2462
2465
|
...(factToolScoped ? { toolScoped: true as const } : {}),
|
|
2463
2466
|
});
|
|
2464
2467
|
}
|
|
@@ -2568,8 +2571,8 @@ export class ExtractionPersistCoordinator {
|
|
|
2568
2571
|
{
|
|
2569
2572
|
content: citedFactContent,
|
|
2570
2573
|
category: writeCategory,
|
|
2571
|
-
confidence: fact.confidence,
|
|
2572
|
-
tags: fact.tags,
|
|
2574
|
+
origin, confidence: fact.confidence,
|
|
2575
|
+
tags: [...fact.tags, ...injectionScreenTags],
|
|
2573
2576
|
entityRef:
|
|
2574
2577
|
typeof (fact as any).entityRef === "string"
|
|
2575
2578
|
? (fact as any).entityRef
|
|
@@ -2778,6 +2781,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2778
2781
|
intentActionType: inferredIntent?.actionType,
|
|
2779
2782
|
intentEntityTypes: inferredIntent?.entityTypes,
|
|
2780
2783
|
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2784
|
+
...(origin ? { origin } : {}),
|
|
2781
2785
|
...(factToolScoped ? { toolScoped: true as const } : {}),
|
|
2782
2786
|
});
|
|
2783
2787
|
}
|
|
@@ -2838,29 +2842,21 @@ export class ExtractionPersistCoordinator {
|
|
|
2838
2842
|
durableNonFactTouchRecorded = true;
|
|
2839
2843
|
touchBaseNonFactNamespace();
|
|
2840
2844
|
};
|
|
2845
|
+
// #1955 review: entity fields recall via entity hints — screened before
|
|
2846
|
+
// entering the index (screenEntityForIndex); withheld fields are logged.
|
|
2847
|
+
const entityScreenOn = resolveSecurityCapabilities(this.deps.config).injectionScreen;
|
|
2841
2848
|
for (const entity of entities) {
|
|
2842
2849
|
try {
|
|
2843
|
-
const
|
|
2844
|
-
|
|
2845
|
-
if (
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
const safeFacts = Array.isArray((entity as any)?.facts)
|
|
2854
|
-
? (entity as any).facts.filter((f: any) => typeof f === "string")
|
|
2855
|
-
: [];
|
|
2856
|
-
const id = await storage.writeEntity(name, type, safeFacts, {
|
|
2857
|
-
source: typeof (entity as any)?.source === "string" ? (entity as any).source : "extraction",
|
|
2858
|
-
timestamp: sourceContext?.validAt,
|
|
2859
|
-
sessionKey: sourceContext?.sessionKey,
|
|
2860
|
-
principal: sourceContext?.principal,
|
|
2861
|
-
structuredSections: Array.isArray((entity as any)?.structuredSections)
|
|
2862
|
-
? (entity as any).structuredSections
|
|
2863
|
-
: undefined,
|
|
2850
|
+
const screened = screenEntityForIndex(entity, entityScreenOn);
|
|
2851
|
+
if (!screened) continue;
|
|
2852
|
+
if (screened.withheldRules.length > 0) log.warn(`persistExtraction: injection screen withheld ${screened.withheldRules.length} entity field(s) for "${screened.name}" [${screened.withheldRules.join(", ")}]`);
|
|
2853
|
+
if (screened.withheld) continue;
|
|
2854
|
+
const id = await storage.writeEntity(screened.name, screened.type, screened.facts, {
|
|
2855
|
+
source: screened.source,
|
|
2856
|
+
timestamp: sourceContext?.validAt,
|
|
2857
|
+
sessionKey: sourceContext?.sessionKey,
|
|
2858
|
+
principal: sourceContext?.principal,
|
|
2859
|
+
structuredSections: screened.structuredSections,
|
|
2864
2860
|
});
|
|
2865
2861
|
if (id) {
|
|
2866
2862
|
trackPersistedId(storage, id);
|
|
@@ -2870,25 +2866,23 @@ export class ExtractionPersistCoordinator {
|
|
|
2870
2866
|
log.warn(`persistExtraction: entity write failed: ${err}`);
|
|
2871
2867
|
}
|
|
2872
2868
|
}
|
|
2873
|
-
|
|
2874
|
-
// Persist entity relationships (v7.0)
|
|
2869
|
+
// Persist entity relationships (v7.0). #1955 review: source/label/target are screened.
|
|
2875
2870
|
if (
|
|
2876
2871
|
resolveRecallEnhancementCapabilities(this.deps.config).entityRelationships &&
|
|
2877
2872
|
Array.isArray(result.relationships)
|
|
2878
2873
|
) {
|
|
2879
2874
|
for (const rel of result.relationships.slice(0, 5)) {
|
|
2880
2875
|
if (!rel.source || !rel.target || !rel.label) continue;
|
|
2876
|
+
const relScreen = screenPersistStrings([`${rel.source}\n${rel.label}\n${rel.target}`,
|
|
2877
|
+
`${rel.target}\n${rel.label} (reverse)\n${rel.source}`], entityScreenOn);
|
|
2878
|
+
if (relScreen.warning) {
|
|
2879
|
+
log.warn(`persistExtraction(relationship): ${relScreen.warning}`);
|
|
2880
|
+
continue;
|
|
2881
|
+
}
|
|
2881
2882
|
try {
|
|
2882
|
-
|
|
2883
|
-
await storage.addEntityRelationship(rel.source, {
|
|
2884
|
-
target: rel.target,
|
|
2885
|
-
label: rel.label,
|
|
2886
|
-
});
|
|
2883
|
+
await storage.addEntityRelationship(rel.source, { target: rel.target, label: rel.label });
|
|
2887
2884
|
recordDurableNonFactWrite();
|
|
2888
|
-
await storage.addEntityRelationship(rel.target, {
|
|
2889
|
-
target: rel.source,
|
|
2890
|
-
label: `${rel.label} (reverse)`,
|
|
2891
|
-
});
|
|
2885
|
+
await storage.addEntityRelationship(rel.target, { target: rel.source, label: `${rel.label} (reverse)` });
|
|
2892
2886
|
recordDurableNonFactWrite();
|
|
2893
2887
|
} catch (err) {
|
|
2894
2888
|
log.debug(`relationship persist failed: ${err}`);
|
|
@@ -2915,14 +2909,21 @@ export class ExtractionPersistCoordinator {
|
|
|
2915
2909
|
}
|
|
2916
2910
|
}
|
|
2917
2911
|
}
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2912
|
+
// #1955 review: profile + questions render verbatim into model context —
|
|
2913
|
+
// screened; questions screen question+context JOINED (routing: #2397).
|
|
2914
|
+
const profileScreen = screenPersistStrings(profileUpdates, entityScreenOn);
|
|
2915
|
+
if (profileScreen.warning) log.warn(`persistExtraction(profile): ${profileScreen.warning}`);
|
|
2916
|
+
if (profileScreen.kept.length > 0) {
|
|
2917
|
+
await storage.appendToProfile(profileScreen.kept);
|
|
2921
2918
|
recordDurableNonFactWrite();
|
|
2922
2919
|
}
|
|
2923
2920
|
|
|
2924
|
-
// Persist questions
|
|
2925
2921
|
for (const q of questions) {
|
|
2922
|
+
const qScreen = screenPersistStrings([`${q.question}\n${q.context ?? ""}`], entityScreenOn);
|
|
2923
|
+
if (qScreen.warning) {
|
|
2924
|
+
log.warn(`persistExtraction(question): ${qScreen.warning}`);
|
|
2925
|
+
continue;
|
|
2926
|
+
}
|
|
2926
2927
|
const id = await storage.writeQuestion(q.question, q.context, q.priority);
|
|
2927
2928
|
if (id) {
|
|
2928
2929
|
trackPersistedId(storage, id);
|
|
@@ -2930,17 +2931,18 @@ export class ExtractionPersistCoordinator {
|
|
|
2930
2931
|
}
|
|
2931
2932
|
}
|
|
2932
2933
|
|
|
2933
|
-
// Persist identity reflection
|
|
2934
|
-
//
|
|
2935
|
-
// counts as a durable non-fact write for the catalog touch below (NIIly).
|
|
2936
|
-
// Only count it when the write actually succeeds (best-effort write); the
|
|
2937
|
-
// touch is recorded AFTER this so a rolled-back/failed write never touches.
|
|
2934
|
+
// Persist identity reflection (screened — #1955): durable namespace-local
|
|
2935
|
+
// state; identity-ONLY extraction still counts as durable non-fact (NIIly).
|
|
2938
2936
|
if (resolveRecallEnhancementCapabilities(this.deps.config).identity && result.identityReflection) {
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2937
|
+
const idScreen = screenPersistStrings([result.identityReflection], entityScreenOn);
|
|
2938
|
+
if (idScreen.warning) log.warn(`persistExtraction(identity): ${idScreen.warning}`);
|
|
2939
|
+
else {
|
|
2940
|
+
try {
|
|
2941
|
+
await storage.appendIdentityReflection(result.identityReflection);
|
|
2942
|
+
recordDurableNonFactWrite();
|
|
2943
|
+
} catch (err) {
|
|
2944
|
+
log.debug(`identity reflection write failed: ${err}`);
|
|
2945
|
+
}
|
|
2944
2946
|
}
|
|
2945
2947
|
}
|
|
2946
2948
|
|
|
@@ -32,6 +32,7 @@ import { resolvePrincipal, defaultNamespaceForPrincipal } from "../namespaces/pr
|
|
|
32
32
|
import { resolveScopeProfilePlan, type ResolvedScopeProfilePlan } from "../namespaces/scope-profiles.js";
|
|
33
33
|
import { resolveCodingNamespaceOverlay } from "../coding/coding-namespace.js";
|
|
34
34
|
import type { CodingContext } from "../types.js";
|
|
35
|
+
import { deriveExtractionOriginContext, type ExtractionSourceContext } from "./extraction-origin-context.js";
|
|
35
36
|
import {
|
|
36
37
|
resolvePresentationCapabilities,
|
|
37
38
|
resolveMemoryLifecycleCapabilities,
|
|
@@ -76,7 +77,7 @@ export interface ExtractionRunCoordinatorDeps {
|
|
|
76
77
|
result: ExtractionResult,
|
|
77
78
|
storage: StorageManager,
|
|
78
79
|
threadIdForExtraction?: string | null,
|
|
79
|
-
sourceContext?:
|
|
80
|
+
sourceContext?: ExtractionSourceContext,
|
|
80
81
|
baseNamespace?: string,
|
|
81
82
|
scopeProfileWritePlan?: ResolvedScopeProfilePlan | null,
|
|
82
83
|
sourceText?: string,
|
|
@@ -1062,6 +1063,7 @@ export class ExtractionRunCoordinator {
|
|
|
1062
1063
|
log.warn("[threading] processTurn failed before persistence (non-fatal)", err);
|
|
1063
1064
|
}
|
|
1064
1065
|
}
|
|
1066
|
+
const originContext = deriveExtractionOriginContext(targetTurns, result.sourceConnector);
|
|
1065
1067
|
throwIfDeadlineExceeded("before_persist");
|
|
1066
1068
|
throwIfAborted("before_persist");
|
|
1067
1069
|
|
|
@@ -1069,7 +1071,7 @@ export class ExtractionRunCoordinator {
|
|
|
1069
1071
|
result,
|
|
1070
1072
|
storage,
|
|
1071
1073
|
threadIdForExtraction,
|
|
1072
|
-
{ sessionKey, principal, validAt: sourceValidAt,
|
|
1074
|
+
{ sessionKey, principal, validAt: sourceValidAt, ...originContext },
|
|
1073
1075
|
// Pass the KNOWN base namespace (NHIdx) so the catalog write touch records the
|
|
1074
1076
|
// real namespace rather than a guess decoded from the storage dir.
|
|
1075
1077
|
selfNamespace,
|