@remnic/core 9.32.0 → 9.33.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 +10 -10
- package/dist/access-admin-ops-surface.js +31 -30
- package/dist/access-authorization-probe.d.ts +10 -10
- package/dist/access-authorization-probe.js +32 -31
- package/dist/access-boundary.d.ts +10 -10
- package/dist/access-boundary.js +31 -30
- package/dist/access-cli.js +67 -65
- package/dist/access-cli.js.map +1 -1
- package/dist/access-extraction-force-flush.d.ts +10 -10
- package/dist/access-extraction-force-flush.js +31 -30
- package/dist/access-health-types.d.ts +1 -1
- package/dist/access-http-lcm-compaction.d.ts +10 -10
- package/dist/access-http-lifecycle-flush.d.ts +10 -10
- package/dist/access-http.d.ts +10 -10
- package/dist/access-http.js +40 -39
- package/dist/access-identity-continuity-surface.d.ts +8 -8
- package/dist/access-identity-continuity-surface.js +31 -30
- package/dist/access-lcm-surface.d.ts +10 -10
- package/dist/access-lcm-surface.js +31 -30
- package/dist/access-mcp.d.ts +10 -10
- package/dist/access-mcp.js +36 -35
- package/dist/access-memory-search-fanout.d.ts +2 -2
- package/dist/{access-namespace-preflight-COhbXBqS.d.ts → access-namespace-preflight-CWyL4Zai.d.ts} +1 -1
- package/dist/access-namespace-preflight.d.ts +3 -3
- package/dist/access-namespace-preflight.js +31 -30
- package/dist/access-observe-write-surface.d.ts +10 -10
- package/dist/access-observe-write-surface.js +31 -30
- package/dist/access-operations-batch.js +33 -32
- package/dist/access-operations.d.ts +10 -10
- package/dist/access-operations.js +35 -34
- package/dist/access-recall-concurrency.d.ts +10 -10
- package/dist/access-recall-concurrency.js +31 -30
- package/dist/access-recall-response.d.ts +10 -10
- package/dist/access-recall-response.js +31 -30
- package/dist/access-recall-surface.d.ts +10 -10
- package/dist/access-recall-surface.js +31 -30
- package/dist/access-schema.js +3 -3
- package/dist/{access-service-BmBTtEKO.d.ts → access-service-D9zIBlpp.d.ts} +7 -7
- package/dist/access-service-helpers.d.ts +10 -10
- package/dist/access-service.d.ts +10 -10
- package/dist/access-service.js +31 -30
- package/dist/access-surface-catalog.d.ts +10 -10
- 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-recall.d.ts +1 -1
- package/dist/adapters/index.js +4 -4
- package/dist/adapters/registry.js +2 -2
- package/dist/auto-sync-UPTUVE4X.js +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +8 -8
- package/dist/briefing.d.ts +2 -2
- package/dist/briefing.js +7 -7
- 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 +2 -2
- package/dist/bulk-import/index.d.ts +3 -3
- package/dist/calibration.d.ts +1 -1
- package/dist/capabilities.d.ts +1 -1
- package/dist/{capsule-crypto-7FJQINUR.js → capsule-crypto-YO5QJ6L3.js} +2 -2
- package/dist/{catalog-Dm-DvNBY.d.ts → catalog-Du4bpZWM.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 +8 -8
- package/dist/causal-trajectory-graph.d.ts +1 -1
- package/dist/{chunk-AU7Q3LSC.js → chunk-2QSZNTDO.js} +4 -4
- package/dist/{chunk-FHBITMRY.js → chunk-4TGZCYHH.js} +15 -15
- package/dist/{chunk-2NTGBZLZ.js → chunk-6JE3HGS4.js} +6 -6
- package/dist/{chunk-MAXVH44E.js → chunk-6NNNURLK.js} +4 -4
- package/dist/{chunk-65ZPVYTA.js → chunk-6NPZ3FP2.js} +2 -2
- package/dist/{chunk-BLAKS3CP.js → chunk-77CNV7DY.js} +4 -4
- package/dist/{chunk-227UFSEQ.js → chunk-7RZJWZ46.js} +5 -5
- package/dist/{chunk-2QIMTVEJ.js → chunk-7TWUCYER.js} +3 -1
- package/dist/chunk-7TWUCYER.js.map +1 -0
- package/dist/{chunk-UORKJ34C.js → chunk-7ZHGPX56.js} +2 -2
- package/dist/{chunk-G2YQ57YO.js → chunk-AEPYA55F.js} +2 -2
- package/dist/{chunk-AQEJE3WO.js → chunk-ATUURSST.js} +3 -3
- package/dist/chunk-B6XHIBIB.js +111 -0
- package/dist/chunk-B6XHIBIB.js.map +1 -0
- package/dist/{chunk-AJL6NNX6.js → chunk-BIXWNHIL.js} +2 -2
- package/dist/{chunk-2NLLXCJG.js → chunk-BXLOS5AJ.js} +2 -2
- package/dist/{chunk-FMFLGS5Z.js → chunk-C4PEMCP4.js} +8 -8
- package/dist/{chunk-TGTTESJS.js → chunk-CMQZNEIF.js} +2 -2
- package/dist/chunk-CMQZNEIF.js.map +1 -0
- package/dist/{chunk-QDTZ2HF7.js → chunk-DMT2RGAZ.js} +3 -3
- package/dist/{chunk-QIHIHZYC.js → chunk-DP7ZV2II.js} +42 -89
- package/dist/chunk-DP7ZV2II.js.map +1 -0
- package/dist/{chunk-X7Y7WX73.js → chunk-DQEMWVMT.js} +1 -1
- package/dist/{chunk-CJDNT45S.js → chunk-EHNENZHZ.js} +6 -6
- package/dist/{chunk-5WZVQRHV.js → chunk-EO7X2LDK.js} +2 -2
- package/dist/{chunk-TL4TO3EA.js → chunk-F3BNEYX2.js} +2 -2
- package/dist/{chunk-VVDPPDDF.js → chunk-HXDWZFNP.js} +1 -1
- package/dist/chunk-HXDWZFNP.js.map +1 -0
- package/dist/{chunk-3F2LKUMU.js → chunk-I5DQ6KZK.js} +2 -2
- package/dist/{chunk-3EQ2XB3W.js → chunk-IZXTZ7BF.js} +5 -5
- package/dist/{chunk-ODGOP7P2.js → chunk-J6BYDVPL.js} +2 -2
- package/dist/{chunk-THCPRMRF.js → chunk-J6SLNQRO.js} +2 -2
- package/dist/{chunk-IGWFKW4B.js → chunk-KEWUNL7P.js} +2 -2
- package/dist/{chunk-OPBTPRGY.js → chunk-KWU6MAD4.js} +2 -2
- package/dist/{chunk-2Q4JJ3FZ.js → chunk-MPH263X2.js} +2 -2
- package/dist/{chunk-VMZ56EE3.js → chunk-MYXWPG5O.js} +2 -2
- package/dist/{chunk-27HHNYSQ.js → chunk-N2B56SIS.js} +3 -3
- package/dist/{chunk-YX5LN6JR.js → chunk-OPRP6Q4Z.js} +3 -3
- package/dist/{chunk-ES36HTSC.js → chunk-PTN6UAUA.js} +4 -4
- package/dist/{chunk-CE5355TT.js → chunk-QHYB4MJV.js} +2 -2
- package/dist/{chunk-S2BBISHU.js → chunk-RYHWZ52A.js} +4 -4
- package/dist/{chunk-YPC7W6GA.js → chunk-RYMPLSIT.js} +3 -2
- package/dist/{chunk-YPC7W6GA.js.map → chunk-RYMPLSIT.js.map} +1 -1
- package/dist/{chunk-J7WZUL2K.js → chunk-SFW2NABJ.js} +11 -11
- package/dist/{chunk-QMWFQBIL.js → chunk-SIKCTPRK.js} +3 -3
- package/dist/{chunk-LUQ443JP.js → chunk-SPPL77NI.js} +28 -28
- package/dist/chunk-T2TTP3KU.js +28 -0
- package/dist/chunk-T2TTP3KU.js.map +1 -0
- package/dist/{chunk-35IVNNRK.js → chunk-TCIWHK3N.js} +2 -2
- package/dist/{chunk-HFQQWAMS.js → chunk-TITQYVKD.js} +36 -36
- package/dist/{chunk-E6BMSH7U.js → chunk-V2MVDDJF.js} +2 -2
- package/dist/{chunk-KQAFEZQX.js → chunk-VDX2J7OX.js} +2 -2
- package/dist/{chunk-HKPJPOW7.js → chunk-XABS455Y.js} +2 -2
- package/dist/{chunk-U7QYBSQJ.js → chunk-XWDZQIYU.js} +2 -2
- package/dist/{chunk-Z7XKUWYS.js → chunk-Y2ZD2RVG.js} +2 -2
- package/dist/{chunk-AQWVJURR.js → chunk-Y6OWJ3V5.js} +2 -2
- package/dist/{chunk-J3ZGPYXB.js → chunk-YFQMW2TH.js} +28 -30
- package/dist/chunk-YFQMW2TH.js.map +1 -0
- package/dist/{chunk-6P7MTSU5.js → chunk-YJ7PWEWI.js} +2 -2
- package/dist/{cli-DRJLv1Xt.d.ts → cli-mFX-QQvx.d.ts} +5 -5
- package/dist/cli.d.ts +12 -12
- package/dist/cli.js +56 -55
- package/dist/compounding/engine.d.ts +2 -2
- package/dist/compounding/engine.js +7 -7
- 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/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +7 -7
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +4 -2
- package/dist/connectors/index.js +12 -8
- 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/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 +1 -1
- package/dist/corpus-watermark.js +18 -18
- package/dist/day-summary.d.ts +1 -1
- 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/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +2 -2
- package/dist/entity-retrieval.js +7 -7
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +8 -8
- package/dist/explicit-capture.js +3 -3
- 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-rules.d.ts +1 -1
- package/dist/extraction-source-grounding.d.ts +1 -1
- package/dist/extraction.d.ts +1 -2
- package/dist/extraction.js +63 -2
- package/dist/fallback-llm.d.ts +1 -1
- 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 +19 -19
- package/dist/index.js +95 -93
- 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 +5 -5
- 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-model-endpoint.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +7 -7
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
- package/dist/maintenance/rebuild-memory-projection.d.ts +2 -2
- package/dist/maintenance/rebuild-memory-projection.js +8 -8
- package/dist/{maintenance-C6Pffz30.d.ts → maintenance-70Wq118b.d.ts} +3 -3
- package/dist/mcp-memory-inspector-app.d.ts +10 -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-store.d.ts +1 -1
- package/dist/memory-provenance.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 +17 -17
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +9 -9
- package/dist/namespaces/storage.d.ts +3 -3
- package/dist/namespaces/storage.js +7 -7
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/offline-sync-impression-drain.d.ts +1 -1
- package/dist/operator-doctor-corpus.d.ts +1 -1
- package/dist/operator-doctor-corpus.js +19 -19
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +22 -22
- package/dist/orchestration/compression-guideline-coordinator.d.ts +2 -2
- package/dist/orchestration/maintenance.d.ts +4 -4
- package/dist/orchestration/maintenance.js +12 -12
- package/dist/{orchestrator-eQlmasno.d.ts → orchestrator-BH8LT-NX.d.ts} +7 -7
- package/dist/orchestrator.d.ts +8 -8
- package/dist/orchestrator.js +67 -65
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/{pipeline-CZGmAMQ2.d.ts → pipeline-DSLWFeHz.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-DBj4MF8T.d.ts → qmd-BSDGyr0H.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-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 +1 -1
- package/dist/replica-peers-config.d.ts +1 -1
- package/dist/resolve-auth-token.d.ts +1 -1
- 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.js +1 -1
- package/dist/{scope-profiles-S85lrsUn.d.ts → scope-profiles-C4zY-a2K.d.ts} +1 -1
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +8 -8
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +13 -13
- 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-DVzDcV6x.d.ts → semantic-consolidation-ChKRYpRO.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +8 -8
- package/dist/semantic-rule-promotion.js +7 -7
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +7 -7
- package/dist/{service-C2M-wD4W.d.ts → service-CrxXHz5T.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 +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/source-agent-qualifier.d.ts +24 -0
- package/dist/source-agent-qualifier.js +98 -0
- package/dist/source-agent-qualifier.js.map +1 -0
- package/dist/{storage-dyBC3Q84.d.ts → storage-CyWa1Jm6.d.ts} +1 -1
- package/dist/storage.d.ts +2 -2
- package/dist/storage.js +6 -6
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/temporal-supersession.d.ts +2 -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 +2 -2
- package/dist/tier-routing.d.ts +1 -1
- 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/trust-score-stage.d.ts +1 -1
- package/dist/trust-score.d.ts +1 -1
- package/dist/{types-D63ZI--P.d.ts → types-5398p7Zm.d.ts} +7 -8
- 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 +7 -7
- package/dist/write-envelope.d.ts +1 -1
- package/package.json +2 -2
- package/src/connector-provenance-lifecycle.test.ts +86 -3
- package/src/connectors/index.ts +2 -2
- package/src/connectors/label.ts +18 -0
- package/src/extraction-scope-source-agent.test.ts +513 -0
- package/src/extraction.ts +45 -98
- package/src/orchestration/extraction-run.ts +1 -1
- package/src/orchestration/recall-result-formatter.ts +2 -1
- package/src/schemas.ts +1 -1
- package/src/source-agent-qualifier.ts +156 -0
- package/src/types.ts +7 -8
- package/dist/chunk-2QIMTVEJ.js.map +0 -1
- package/dist/chunk-J3ZGPYXB.js.map +0 -1
- package/dist/chunk-QIHIHZYC.js.map +0 -1
- package/dist/chunk-TGTTESJS.js.map +0 -1
- package/dist/chunk-VVDPPDDF.js.map +0 -1
- /package/dist/{capsule-crypto-7FJQINUR.js.map → capsule-crypto-YO5QJ6L3.js.map} +0 -0
- /package/dist/{chunk-AU7Q3LSC.js.map → chunk-2QSZNTDO.js.map} +0 -0
- /package/dist/{chunk-FHBITMRY.js.map → chunk-4TGZCYHH.js.map} +0 -0
- /package/dist/{chunk-2NTGBZLZ.js.map → chunk-6JE3HGS4.js.map} +0 -0
- /package/dist/{chunk-MAXVH44E.js.map → chunk-6NNNURLK.js.map} +0 -0
- /package/dist/{chunk-65ZPVYTA.js.map → chunk-6NPZ3FP2.js.map} +0 -0
- /package/dist/{chunk-BLAKS3CP.js.map → chunk-77CNV7DY.js.map} +0 -0
- /package/dist/{chunk-227UFSEQ.js.map → chunk-7RZJWZ46.js.map} +0 -0
- /package/dist/{chunk-UORKJ34C.js.map → chunk-7ZHGPX56.js.map} +0 -0
- /package/dist/{chunk-G2YQ57YO.js.map → chunk-AEPYA55F.js.map} +0 -0
- /package/dist/{chunk-AQEJE3WO.js.map → chunk-ATUURSST.js.map} +0 -0
- /package/dist/{chunk-AJL6NNX6.js.map → chunk-BIXWNHIL.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-BXLOS5AJ.js.map} +0 -0
- /package/dist/{chunk-FMFLGS5Z.js.map → chunk-C4PEMCP4.js.map} +0 -0
- /package/dist/{chunk-QDTZ2HF7.js.map → chunk-DMT2RGAZ.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-DQEMWVMT.js.map} +0 -0
- /package/dist/{chunk-CJDNT45S.js.map → chunk-EHNENZHZ.js.map} +0 -0
- /package/dist/{chunk-5WZVQRHV.js.map → chunk-EO7X2LDK.js.map} +0 -0
- /package/dist/{chunk-TL4TO3EA.js.map → chunk-F3BNEYX2.js.map} +0 -0
- /package/dist/{chunk-3F2LKUMU.js.map → chunk-I5DQ6KZK.js.map} +0 -0
- /package/dist/{chunk-3EQ2XB3W.js.map → chunk-IZXTZ7BF.js.map} +0 -0
- /package/dist/{chunk-ODGOP7P2.js.map → chunk-J6BYDVPL.js.map} +0 -0
- /package/dist/{chunk-THCPRMRF.js.map → chunk-J6SLNQRO.js.map} +0 -0
- /package/dist/{chunk-IGWFKW4B.js.map → chunk-KEWUNL7P.js.map} +0 -0
- /package/dist/{chunk-OPBTPRGY.js.map → chunk-KWU6MAD4.js.map} +0 -0
- /package/dist/{chunk-2Q4JJ3FZ.js.map → chunk-MPH263X2.js.map} +0 -0
- /package/dist/{chunk-VMZ56EE3.js.map → chunk-MYXWPG5O.js.map} +0 -0
- /package/dist/{chunk-27HHNYSQ.js.map → chunk-N2B56SIS.js.map} +0 -0
- /package/dist/{chunk-YX5LN6JR.js.map → chunk-OPRP6Q4Z.js.map} +0 -0
- /package/dist/{chunk-ES36HTSC.js.map → chunk-PTN6UAUA.js.map} +0 -0
- /package/dist/{chunk-CE5355TT.js.map → chunk-QHYB4MJV.js.map} +0 -0
- /package/dist/{chunk-S2BBISHU.js.map → chunk-RYHWZ52A.js.map} +0 -0
- /package/dist/{chunk-J7WZUL2K.js.map → chunk-SFW2NABJ.js.map} +0 -0
- /package/dist/{chunk-QMWFQBIL.js.map → chunk-SIKCTPRK.js.map} +0 -0
- /package/dist/{chunk-LUQ443JP.js.map → chunk-SPPL77NI.js.map} +0 -0
- /package/dist/{chunk-35IVNNRK.js.map → chunk-TCIWHK3N.js.map} +0 -0
- /package/dist/{chunk-HFQQWAMS.js.map → chunk-TITQYVKD.js.map} +0 -0
- /package/dist/{chunk-E6BMSH7U.js.map → chunk-V2MVDDJF.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-VDX2J7OX.js.map} +0 -0
- /package/dist/{chunk-HKPJPOW7.js.map → chunk-XABS455Y.js.map} +0 -0
- /package/dist/{chunk-U7QYBSQJ.js.map → chunk-XWDZQIYU.js.map} +0 -0
- /package/dist/{chunk-Z7XKUWYS.js.map → chunk-Y2ZD2RVG.js.map} +0 -0
- /package/dist/{chunk-AQWVJURR.js.map → chunk-Y6OWJ3V5.js.map} +0 -0
- /package/dist/{chunk-6P7MTSU5.js.map → chunk-YJ7PWEWI.js.map} +0 -0
package/src/extraction.ts
CHANGED
|
@@ -41,9 +41,9 @@ import { normalizeReasoningTrace } from "./reasoning-trace-types.js";
|
|
|
41
41
|
import { looksLikeMechanicalTelemetryTranscript } from "./telemetry-transcript.js";
|
|
42
42
|
import {
|
|
43
43
|
attachExtractionProvenance,
|
|
44
|
-
applyExtractionSourceGrounding,
|
|
45
44
|
type ExtractionGroundingRoleSources,
|
|
46
45
|
} from "./extraction-source-grounding.js";
|
|
46
|
+
import { applyGroundingWithConnector, headerConnector, renderExtractionConversation, resolveSourceConnector, type ExtractionGroundingContext } from "./source-agent-qualifier.js";
|
|
47
47
|
import { isMemoryCategory } from "./write-envelope.js";
|
|
48
48
|
import { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
|
|
49
49
|
export { classifyExtractionThrownError, classifyFallbackParseFailure } from "./extraction-error-classification.js";
|
|
@@ -666,10 +666,7 @@ export class ExtractionEngine {
|
|
|
666
666
|
private async applyProactiveQuestionPass(
|
|
667
667
|
conversation: string,
|
|
668
668
|
base: ExtractionResult,
|
|
669
|
-
|
|
670
|
-
assertionSource: string,
|
|
671
|
-
messageTimestamp?: Date,
|
|
672
|
-
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
669
|
+
ctx: ExtractionGroundingContext,
|
|
673
670
|
signal?: AbortSignal,
|
|
674
671
|
): Promise<ExtractionResult> {
|
|
675
672
|
if (!resolvePipelineProcessingCapabilities(this.config).proactiveExtraction) return base;
|
|
@@ -684,16 +681,11 @@ export class ExtractionEngine {
|
|
|
684
681
|
base,
|
|
685
682
|
proactive,
|
|
686
683
|
maxAdditional,
|
|
684
|
+
ctx.sourceConnector,
|
|
687
685
|
signal,
|
|
688
686
|
);
|
|
689
|
-
const sanitizedAdditions = this.sanitizeExtractionResult(proactiveAdditions, messageTimestamp);
|
|
690
|
-
const groundedAdditions = this.
|
|
691
|
-
sanitizedAdditions,
|
|
692
|
-
groundingSource,
|
|
693
|
-
assertionSource,
|
|
694
|
-
roleAssertionSources,
|
|
695
|
-
messageTimestamp,
|
|
696
|
-
);
|
|
687
|
+
const sanitizedAdditions = this.sanitizeExtractionResult(proactiveAdditions, ctx.messageTimestamp);
|
|
688
|
+
const groundedAdditions = applyGroundingWithConnector(this.config, sanitizedAdditions, ctx);
|
|
697
689
|
if (!this.hasExtractionOutputs(groundedAdditions)) return base;
|
|
698
690
|
return this.mergeProactiveExtractionPass(base, groundedAdditions, maxAdditional);
|
|
699
691
|
} catch (err) {
|
|
@@ -841,6 +833,7 @@ export class ExtractionEngine {
|
|
|
841
833
|
base: ExtractionResult,
|
|
842
834
|
proactiveQuestions: ExtractionQuestion[],
|
|
843
835
|
maxAdditional: number,
|
|
836
|
+
sourceConnector: string | undefined,
|
|
844
837
|
signal?: AbortSignal,
|
|
845
838
|
): Promise<ExtractionResult> {
|
|
846
839
|
const factsPreview = base.facts
|
|
@@ -870,6 +863,9 @@ export class ExtractionEngine {
|
|
|
870
863
|
// (chatgpt-codex thread on extraction.ts:1607). Returns "" when the
|
|
871
864
|
// bi-temporal gate is off, keeping the prompt unchanged by default.
|
|
872
865
|
this.eventTimePromptInstruction(),
|
|
866
|
+
headerConnector(sourceConnector) !== undefined && resolveMemoryLifecycleCapabilities(this.config).extractionScopeClassification
|
|
867
|
+
? `Tool, command, or CLI-flag instructions tied to the ${sourceConnector} agent are "project" scope; when you recover one, begin the fact with a leading "In ${sourceConnector}, " clause naming that agent (e.g. "In ${sourceConnector}, use the search tool with a repository path.").`
|
|
868
|
+
: "",
|
|
873
869
|
"",
|
|
874
870
|
"Base extracted facts (do not repeat):",
|
|
875
871
|
factsPreview || "(none)",
|
|
@@ -1097,27 +1093,6 @@ export class ExtractionEngine {
|
|
|
1097
1093
|
return null;
|
|
1098
1094
|
}
|
|
1099
1095
|
|
|
1100
|
-
private applySourceGrounding(
|
|
1101
|
-
result: ExtractionResult,
|
|
1102
|
-
sourceText: string,
|
|
1103
|
-
assertionSourceText: string = sourceText,
|
|
1104
|
-
roleAssertionSources?: ExtractionGroundingRoleSources,
|
|
1105
|
-
messageTimestamp?: Date,
|
|
1106
|
-
): ExtractionResult {
|
|
1107
|
-
const capabilities = resolvePipelineProcessingCapabilities(this.config);
|
|
1108
|
-
return applyExtractionSourceGrounding(
|
|
1109
|
-
result,
|
|
1110
|
-
sourceText,
|
|
1111
|
-
assertionSourceText,
|
|
1112
|
-
roleAssertionSources,
|
|
1113
|
-
messageTimestamp,
|
|
1114
|
-
{
|
|
1115
|
-
sourceGrounding: capabilities.sourceGrounding,
|
|
1116
|
-
anchorTemporalExpressions: capabilities.delinearize,
|
|
1117
|
-
},
|
|
1118
|
-
);
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
1096
|
private finalizeExtractionResult(
|
|
1122
1097
|
result: ExtractionResult,
|
|
1123
1098
|
turns: ReadonlyArray<{
|
|
@@ -1127,8 +1102,10 @@ export class ExtractionEngine {
|
|
|
1127
1102
|
timestamp: string;
|
|
1128
1103
|
turnFingerprint?: string;
|
|
1129
1104
|
}>,
|
|
1105
|
+
sourceConnector?: string,
|
|
1130
1106
|
): ExtractionResult {
|
|
1131
|
-
|
|
1107
|
+
const provenanced = attachExtractionProvenance(result, turns, this.config.provenance);
|
|
1108
|
+
return sourceConnector === undefined ? provenanced : { ...provenanced, sourceConnector };
|
|
1132
1109
|
}
|
|
1133
1110
|
|
|
1134
1111
|
async extract(
|
|
@@ -1153,13 +1130,17 @@ export class ExtractionEngine {
|
|
|
1153
1130
|
: turn.content,
|
|
1154
1131
|
}))
|
|
1155
1132
|
.filter((turn) => turn.content.trim().length > 0);
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1133
|
+
// One derivation, over the turns the model actually sees (boundedTurns) —
|
|
1134
|
+
// the same set the qualifier, grounding source, and telemetry filter
|
|
1135
|
+
// operate on. result.sourceConnector carries it to persistence so the
|
|
1136
|
+
// orchestrator does not recompute over a different turn set (#2183).
|
|
1137
|
+
const resolvedConnector = resolveSourceConnector(boundedTurns);
|
|
1138
|
+
// The header and qualifier strip/restore are gated on the scope-classification
|
|
1139
|
+
// capability; persistence records resolvedConnector regardless (trusted metadata).
|
|
1140
|
+
const sourceConnector = lifecycleCaps.extractionScopeClassification
|
|
1141
|
+
? resolvedConnector
|
|
1142
|
+
: undefined;
|
|
1143
|
+
const { conversation, renderedConversation } = renderExtractionConversation(boundedTurns, headerConnector(sourceConnector));
|
|
1163
1144
|
|
|
1164
1145
|
const groundingSource = boundedTurns
|
|
1165
1146
|
.map((turn) => turn.content)
|
|
@@ -1178,13 +1159,13 @@ export class ExtractionEngine {
|
|
|
1178
1159
|
.map((turn) => turn.content)
|
|
1179
1160
|
.join("\n\n"),
|
|
1180
1161
|
};
|
|
1181
|
-
if (
|
|
1162
|
+
if (renderedConversation.trim().length === 0) {
|
|
1182
1163
|
log.debug("extraction skipped — conversation only contained non-memory work-layer context");
|
|
1183
1164
|
return { facts: [], profileUpdates: [], entities: [], questions: [] };
|
|
1184
1165
|
}
|
|
1185
1166
|
if (
|
|
1186
1167
|
lifecycleCaps.extractionTelemetryPrefilter &&
|
|
1187
|
-
looksLikeMechanicalTelemetryTranscript(
|
|
1168
|
+
looksLikeMechanicalTelemetryTranscript(renderedConversation)
|
|
1188
1169
|
) {
|
|
1189
1170
|
log.debug("extraction skipped — mechanical action/state telemetry without durable-memory cues");
|
|
1190
1171
|
return {
|
|
@@ -1198,6 +1179,14 @@ export class ExtractionEngine {
|
|
|
1198
1179
|
// Use the last turn's timestamp for temporal anchoring (more accurate than wall-clock)
|
|
1199
1180
|
const lastTurnTs = boundedTurns.length > 0 ? new Date(boundedTurns[boundedTurns.length - 1].timestamp) : undefined;
|
|
1200
1181
|
const messageTimestamp = lastTurnTs && !isNaN(lastTurnTs.getTime()) ? lastTurnTs : undefined;
|
|
1182
|
+
const groundingContext: ExtractionGroundingContext = {
|
|
1183
|
+
groundingSource,
|
|
1184
|
+
assertionSource,
|
|
1185
|
+
roleAssertionSources,
|
|
1186
|
+
messageTimestamp,
|
|
1187
|
+
sourceConnector,
|
|
1188
|
+
scopeClassificationEnabled: lifecycleCaps.extractionScopeClassification,
|
|
1189
|
+
};
|
|
1201
1190
|
|
|
1202
1191
|
const traceId = crypto.randomUUID();
|
|
1203
1192
|
// Only emit llm_start for the direct path when a client or local LLM is configured.
|
|
@@ -1234,23 +1223,9 @@ export class ExtractionEngine {
|
|
|
1234
1223
|
this.emit({ kind: "llm_end", traceId, model: this.config.localLlmModel, operation: "extraction", durationMs });
|
|
1235
1224
|
log.debug(`extraction: used local LLM — ${localResult.facts.length} facts, ${localResult.entities.length} entities`);
|
|
1236
1225
|
const sanitized = this.sanitizeExtractionResult(localResult, messageTimestamp);
|
|
1237
|
-
const grounded = this.
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
assertionSource,
|
|
1241
|
-
roleAssertionSources,
|
|
1242
|
-
messageTimestamp,
|
|
1243
|
-
);
|
|
1244
|
-
const finalResult = await this.applyProactiveQuestionPass(
|
|
1245
|
-
conversation,
|
|
1246
|
-
grounded,
|
|
1247
|
-
groundingSource,
|
|
1248
|
-
assertionSource,
|
|
1249
|
-
messageTimestamp,
|
|
1250
|
-
roleAssertionSources,
|
|
1251
|
-
signal,
|
|
1252
|
-
);
|
|
1253
|
-
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1226
|
+
const grounded = applyGroundingWithConnector(this.config, sanitized, groundingContext);
|
|
1227
|
+
const finalResult = await this.applyProactiveQuestionPass(conversation, grounded, groundingContext, signal);
|
|
1228
|
+
return this.finalizeExtractionResult(finalResult, boundedTurns, resolvedConnector);
|
|
1254
1229
|
}
|
|
1255
1230
|
// Local failed, fall back if allowed
|
|
1256
1231
|
if (!this.config.localLlmFallback) {
|
|
@@ -1297,23 +1272,9 @@ export class ExtractionEngine {
|
|
|
1297
1272
|
this.emit({ kind: "llm_end", traceId, model: this.config.model, operation: "extraction", durationMs });
|
|
1298
1273
|
log.debug(`extraction: used direct client (${this.config.model}) — ${directResult.facts.length} facts, ${directResult.entities.length} entities`);
|
|
1299
1274
|
const sanitized = this.sanitizeExtractionResult(directResult, messageTimestamp);
|
|
1300
|
-
const grounded = this.
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
assertionSource,
|
|
1304
|
-
roleAssertionSources,
|
|
1305
|
-
messageTimestamp,
|
|
1306
|
-
);
|
|
1307
|
-
const finalResult = await this.applyProactiveQuestionPass(
|
|
1308
|
-
conversation,
|
|
1309
|
-
grounded,
|
|
1310
|
-
groundingSource,
|
|
1311
|
-
assertionSource,
|
|
1312
|
-
messageTimestamp,
|
|
1313
|
-
roleAssertionSources,
|
|
1314
|
-
signal,
|
|
1315
|
-
);
|
|
1316
|
-
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1275
|
+
const grounded = applyGroundingWithConnector(this.config, sanitized, groundingContext);
|
|
1276
|
+
const finalResult = await this.applyProactiveQuestionPass(conversation, grounded, groundingContext, signal);
|
|
1277
|
+
return this.finalizeExtractionResult(finalResult, boundedTurns, resolvedConnector);
|
|
1317
1278
|
}
|
|
1318
1279
|
// Emit error event so Opik sees the direct client failure before fallback.
|
|
1319
1280
|
// Wrapped in try/catch so a subscriber error doesn't break the fallback path.
|
|
@@ -1399,23 +1360,9 @@ export class ExtractionEngine {
|
|
|
1399
1360
|
);
|
|
1400
1361
|
const normalized = this.normalizeExtractionResultPayload(result);
|
|
1401
1362
|
const sanitized = this.sanitizeExtractionResult(normalized, messageTimestamp);
|
|
1402
|
-
const grounded = this.
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
assertionSource,
|
|
1406
|
-
roleAssertionSources,
|
|
1407
|
-
messageTimestamp,
|
|
1408
|
-
);
|
|
1409
|
-
const finalResult = await this.applyProactiveQuestionPass(
|
|
1410
|
-
conversation,
|
|
1411
|
-
grounded,
|
|
1412
|
-
groundingSource,
|
|
1413
|
-
assertionSource,
|
|
1414
|
-
messageTimestamp,
|
|
1415
|
-
roleAssertionSources,
|
|
1416
|
-
signal,
|
|
1417
|
-
);
|
|
1418
|
-
return this.finalizeExtractionResult(finalResult, boundedTurns);
|
|
1363
|
+
const grounded = applyGroundingWithConnector(this.config, sanitized, groundingContext);
|
|
1364
|
+
const finalResult = await this.applyProactiveQuestionPass(conversation, grounded, groundingContext, signal);
|
|
1365
|
+
return this.finalizeExtractionResult(finalResult, boundedTurns, resolvedConnector);
|
|
1419
1366
|
}
|
|
1420
1367
|
|
|
1421
1368
|
this.emit({
|
|
@@ -1519,7 +1466,7 @@ Rules:
|
|
|
1519
1466
|
- Add structuredAttributes only for concrete values.
|
|
1520
1467
|
- Include at most five durable relationships.${this.config.provenance?.enabled ? `
|
|
1521
1468
|
- Each fact must include a quote copied verbatim from one contiguous conversation span.` : ""}${lifecycleCaps.extractionScopeClassification ? `
|
|
1522
|
-
- Set each fact scope to "global" for cross-project knowledge or "project" for codebase-specific knowledge.` : ""}
|
|
1469
|
+
- Set each fact scope to "global" for cross-project knowledge or "project" for codebase-specific knowledge. Tool, command, or CLI-flag instructions tied to one agent are "project" (the same tool name can mean different things across agents); when keeping one, begin the fact with a leading "In <agent>," clause naming that agent.` : ""}
|
|
1523
1470
|
${this.eventTimePromptInstruction()}
|
|
1524
1471
|
Return only valid JSON matching this shape. Placeholder text describes field shape only and is never source evidence:
|
|
1525
1472
|
${EXTRACTION_RESPONSE_SHAPE}
|
|
@@ -1748,8 +1695,8 @@ Rules:
|
|
|
1748
1695
|
|
|
1749
1696
|
Scope classification:
|
|
1750
1697
|
For each fact, set "scope" to one of:
|
|
1751
|
-
- "global" — knowledge that applies across projects: core framework/library bugs, API behavior patterns, user preferences (editor, language, style),
|
|
1752
|
-
- "project" — knowledge specific to one codebase: file paths, environment configs, deployment details, project-specific workarounds, team/stakeholder info tied to one project, repo-specific conventions
|
|
1698
|
+
- "global" — knowledge that applies across projects: core framework/library bugs, API behavior patterns, user preferences (editor, language, style), general coding patterns, infrastructure knowledge, technology facts not tied to one codebase
|
|
1699
|
+
- "project" — knowledge specific to one codebase: file paths, environment configs, deployment details, project-specific workarounds, team/stakeholder info tied to one project, repo-specific conventions. Tool, command, or CLI-flag instructions TIED TO ONE AGENT are also "project", because the same tool name means different things in different agent integrations (a "search" tool may search repository code in one agent and the web in another); when keeping such an agent-tied instruction, the fact text MUST name the originating agent as a leading "In <agent>," clause (e.g. "In Pi, use the search tool with a repository path."). A tool/command fact that holds in every agent and every repo is NOT agent-tied — leave it "global" and do not add a qualifier (e.g. "\`git status --short\` emits compact output"). Examples: "In Pi, the search tool takes a repository path" -> "project"; "\`git status --short\` emits compact output" -> "global".
|
|
1753
1700
|
When in doubt, prefer "project" — it is safer to keep knowledge scoped narrowly.` : ""}
|
|
1754
1701
|
Entity creation rules (STRICT):
|
|
1755
1702
|
- Only create entities for DURABLE things: real people, companies, products, tools, ongoing projects
|
|
@@ -1067,7 +1067,7 @@ export class ExtractionRunCoordinator {
|
|
|
1067
1067
|
result,
|
|
1068
1068
|
storage,
|
|
1069
1069
|
threadIdForExtraction,
|
|
1070
|
-
{ sessionKey, principal, validAt: sourceValidAt, sourceConnector:
|
|
1070
|
+
{ sessionKey, principal, validAt: sourceValidAt, sourceConnector: result.sourceConnector },
|
|
1071
1071
|
// Pass the KNOWN base namespace (NHIdx) so the catalog write touch records the
|
|
1072
1072
|
// real namespace rather than a guess decoded from the storage dir.
|
|
1073
1073
|
selfNamespace,
|
|
@@ -31,6 +31,7 @@ import type { VerifiedSemanticRuleResult } from "../semantic-rule-verifier.js";
|
|
|
31
31
|
import type { WorkProductLedgerSearchResult } from "../work-product-ledger.js";
|
|
32
32
|
import { trustResultFor, type TrustStageResultItem } from "../trust-score-stage.js";
|
|
33
33
|
import { CONNECTOR_ID_PATTERN, CONNECTOR_LABEL_MAX_LENGTH } from "../connectors/label.js";
|
|
34
|
+
import { isValidConnectorId } from "../connectors/index.js";
|
|
34
35
|
import type {
|
|
35
36
|
ContinuityIncidentRecord,
|
|
36
37
|
IdentityInjectionMode,
|
|
@@ -49,7 +50,7 @@ import type {
|
|
|
49
50
|
* exact signal this PR adds). One resolver at the single render site.
|
|
50
51
|
*/
|
|
51
52
|
function renderConnectorLabel(connector: string | undefined): string | null {
|
|
52
|
-
if (!
|
|
53
|
+
if (!isValidConnectorId(connector)) return null;
|
|
53
54
|
return connector.length <= CONNECTOR_LABEL_MAX_LENGTH
|
|
54
55
|
? connector
|
|
55
56
|
: `${connector.slice(0, CONNECTOR_LABEL_MAX_LENGTH - 1)}…`;
|
package/src/schemas.ts
CHANGED
|
@@ -91,7 +91,7 @@ export const ExtractedFactSchema = z.object({
|
|
|
91
91
|
.optional()
|
|
92
92
|
.nullable()
|
|
93
93
|
.describe(
|
|
94
|
-
'Scope classification: "global" for cross-project knowledge (framework bugs, library behavior, API patterns, user preferences,
|
|
94
|
+
'Scope classification: "global" for cross-project knowledge (framework bugs, library behavior, API patterns, user preferences, general coding patterns); "project" for project-specific knowledge (file paths, env configs, deployment details, project workarounds) and for tool, command, or CLI-flag instructions tied to one agent, since the same tool name can mean different things across agents. When keeping such an agent-tied instruction, begin the fact with a leading "In <agent>," clause naming that agent. Defaults to "project" when a coding context is active.',
|
|
95
95
|
),
|
|
96
96
|
quote: z
|
|
97
97
|
.string()
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source-agent qualifier helpers for extraction (#2183).
|
|
3
|
+
*
|
|
4
|
+
* Pure leaf module: imports only types and sibling leaf/orchestration helpers,
|
|
5
|
+
* never `extraction.ts`, so it introduces no cycle (extraction-run.ts only
|
|
6
|
+
* type-imports extraction.ts).
|
|
7
|
+
*/
|
|
8
|
+
import { resolvePipelineProcessingCapabilities } from "./capabilities.js";
|
|
9
|
+
import { applyExtractionSourceGrounding } from "./extraction-source-grounding.js";
|
|
10
|
+
import type { ExtractionGroundingRoleSources } from "./extraction-source-grounding.js";
|
|
11
|
+
import { isValidConnectorId } from "./connectors/index.js";
|
|
12
|
+
import { CONNECTOR_LABEL_MAX_LENGTH, knownConnectorIds } from "./connectors/label.js";
|
|
13
|
+
import { deriveSourceConnector } from "./orchestration/extraction-run.js";
|
|
14
|
+
import type { BufferTurn, ExtractionResult, PluginConfig } from "./types.js";
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
export function resolveSourceConnector(turns: readonly BufferTurn[]): string | undefined {
|
|
18
|
+
const contributing = turns.filter((turn) => turn.extractionContextOnly !== true);
|
|
19
|
+
const derived = deriveSourceConnector(contributing);
|
|
20
|
+
if (derived === undefined || !isValidConnectorId(derived)) return undefined;
|
|
21
|
+
return /[\u0000-\u001F\u007F]/.test(derived) ? undefined : derived;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Same bound as the recall renderer (CONNECTOR_LABEL_MAX_LENGTH) but a DIFFERENT
|
|
25
|
+
// policy: recall TRUNCATES past the bound (a truncated display label cannot
|
|
26
|
+
// mislead), while the prompt SUPPRESSES (a truncated id could collide with a
|
|
27
|
+
// different connector). Do not "fix" this inconsistency — it is deliberate.
|
|
28
|
+
export function headerConnector(connector: string | undefined): string | undefined {
|
|
29
|
+
return connector !== undefined && connector.length <= CONNECTOR_LABEL_MAX_LENGTH ? connector : undefined;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function renderExtractionConversation(
|
|
33
|
+
boundedTurns: readonly BufferTurn[],
|
|
34
|
+
sourceConnector: string | undefined,
|
|
35
|
+
): { conversation: string; renderedConversation: string } {
|
|
36
|
+
const renderedConversation = boundedTurns
|
|
37
|
+
.map((t) => `[${t.extractionContextOnly === true ? `context ${t.role}` : t.role}] ${t.content}`)
|
|
38
|
+
.join("\n\n");
|
|
39
|
+
const conversation = sourceConnector === undefined
|
|
40
|
+
? renderedConversation
|
|
41
|
+
: `Source agent: ${sourceConnector}\n\nTool and command instructions in this conversation apply to the ${sourceConnector} agent unless they are clearly universal.\n\n${renderedConversation}`;
|
|
42
|
+
return { conversation, renderedConversation };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ExtractionGroundingContext {
|
|
46
|
+
groundingSource: string;
|
|
47
|
+
assertionSource: string;
|
|
48
|
+
roleAssertionSources?: ExtractionGroundingRoleSources;
|
|
49
|
+
messageTimestamp: Date | undefined;
|
|
50
|
+
sourceConnector?: string;
|
|
51
|
+
scopeClassificationEnabled?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function applyGroundingWithConnector(
|
|
55
|
+
config: PluginConfig,
|
|
56
|
+
result: ExtractionResult,
|
|
57
|
+
ctx: ExtractionGroundingContext,
|
|
58
|
+
): ExtractionResult {
|
|
59
|
+
const caps = resolvePipelineProcessingCapabilities(config);
|
|
60
|
+
const options = { sourceGrounding: caps.sourceGrounding, anchorTemporalExpressions: caps.delinearize };
|
|
61
|
+
const known = buildKnownConnectors(ctx.sourceConnector);
|
|
62
|
+
// Scope-forcing is decoupled from strip/restore (runs without a trusted
|
|
63
|
+
// connector) but gated on the capability: flag off = byte-identical pre-#2183.
|
|
64
|
+
const scoped = ctx.scopeClassificationEnabled === false
|
|
65
|
+
? result
|
|
66
|
+
: forceProjectScopeOnAnyQualifier(result, known);
|
|
67
|
+
if (ctx.sourceConnector === undefined) {
|
|
68
|
+
return applyExtractionSourceGrounding(scoped, ctx.groundingSource, ctx.assertionSource, ctx.roleAssertionSources, ctx.messageTimestamp, options);
|
|
69
|
+
}
|
|
70
|
+
const prepared = prepareTrustedConnectorQualifier(scoped, ctx.sourceConnector, known);
|
|
71
|
+
const grounded = applyExtractionSourceGrounding(prepared.result, ctx.groundingSource, ctx.assertionSource, ctx.roleAssertionSources, ctx.messageTimestamp, options);
|
|
72
|
+
return restoreTrustedConnectorQualifier(grounded);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function buildKnownConnectors(trusted: string | undefined): Set<string> {
|
|
76
|
+
const known = new Set<string>();
|
|
77
|
+
for (const id of knownConnectorIds()) known.add(id.toLowerCase());
|
|
78
|
+
if (trusted !== undefined) known.add(trusted.toLowerCase());
|
|
79
|
+
return known;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Parse a leading agent qualifier from fact text. ONE parser, ONE boundary
|
|
84
|
+
* rule, ONE case policy (case-insensitive), ONE definition of "agent" (the name
|
|
85
|
+
* must be a known connector ID). Returns the matched agent and the remaining
|
|
86
|
+
* text, or undefined. Both scope-forcing and strip/restore consume this single
|
|
87
|
+
* result so they can never disagree (#2183 round-11).
|
|
88
|
+
*/
|
|
89
|
+
function parseLeadingQualifier(content: string, known: ReadonlySet<string>): { agent: string; rest: string } | undefined {
|
|
90
|
+
const lower = content.toLowerCase();
|
|
91
|
+
for (const lead of ["in ", "for "]) {
|
|
92
|
+
if (!lower.startsWith(lead)) continue;
|
|
93
|
+
const m = lower.slice(lead.length).match(/^([a-z0-9][a-z0-9._-]*)\s*,/u);
|
|
94
|
+
if (m && known.has(m[1])) {
|
|
95
|
+
const consumed = lead.length + m[0].length;
|
|
96
|
+
return { agent: m[1], rest: content.slice(consumed).replace(/^[\s,.;:]+/u, "") };
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const pm = lower.match(/^([a-z0-9][a-z0-9._-]*)'s(?![\p{L}\p{N}])/u);
|
|
100
|
+
if (pm && known.has(pm[1])) {
|
|
101
|
+
return { agent: pm[1], rest: content.slice(pm[0].length).replace(/^[\s,.;:]+/u, "") };
|
|
102
|
+
}
|
|
103
|
+
return undefined;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Force "project" scope on any fact whose content starts with a recognised
|
|
108
|
+
* agent qualifier (a known connector name). A qualifier is evidence the fact is
|
|
109
|
+
* agent-tied; which connector it names does not matter.
|
|
110
|
+
*/
|
|
111
|
+
function forceProjectScopeOnAnyQualifier(result: ExtractionResult, known: ReadonlySet<string>): ExtractionResult {
|
|
112
|
+
let any = false;
|
|
113
|
+
const facts = result.facts.map((fact) => {
|
|
114
|
+
if (fact.scope === "project") return fact;
|
|
115
|
+
if (parseLeadingQualifier(fact.content, known) === undefined) return fact;
|
|
116
|
+
any = true;
|
|
117
|
+
return { ...fact, scope: "project" as const };
|
|
118
|
+
});
|
|
119
|
+
return any ? { ...result, facts } : result;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const RESTORE_KEY = "_qo";
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Strip the TRUSTED connector's qualifier for the grounding pass. Uses the same
|
|
126
|
+
* parseLeadingQualifier as scope-forcing, but only strips when the matched agent
|
|
127
|
+
* IS the trusted connector. Each stripped fact carries its original content
|
|
128
|
+
* positionally for collision-free restore.
|
|
129
|
+
*/
|
|
130
|
+
function prepareTrustedConnectorQualifier(
|
|
131
|
+
result: ExtractionResult,
|
|
132
|
+
trustedConnector: string,
|
|
133
|
+
known: ReadonlySet<string>,
|
|
134
|
+
): { result: ExtractionResult } {
|
|
135
|
+
const trusted = trustedConnector.toLowerCase();
|
|
136
|
+
const facts = result.facts.map((fact) => {
|
|
137
|
+
const parsed = parseLeadingQualifier(fact.content, known);
|
|
138
|
+
if (parsed === undefined || parsed.agent !== trusted) return fact;
|
|
139
|
+
return { ...fact, content: parsed.rest, [RESTORE_KEY]: fact.content };
|
|
140
|
+
}) as ExtractionResult["facts"];
|
|
141
|
+
return { result: { ...result, facts } };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function restoreTrustedConnectorQualifier(grounded: ExtractionResult): ExtractionResult {
|
|
145
|
+
let touched = false;
|
|
146
|
+
const facts = grounded.facts.map((fact) => {
|
|
147
|
+
const record = fact as unknown as Record<string, unknown>;
|
|
148
|
+
const original = record[RESTORE_KEY];
|
|
149
|
+
if (typeof original !== "string") return fact;
|
|
150
|
+
touched = true;
|
|
151
|
+
const rest = { ...record };
|
|
152
|
+
delete rest[RESTORE_KEY];
|
|
153
|
+
return { ...rest, content: original } as ExtractionResult["facts"][number];
|
|
154
|
+
});
|
|
155
|
+
return touched ? { ...grounded, facts } : grounded;
|
|
156
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -23,15 +23,12 @@ export type ExtractionPassSource = "base" | "proactive";
|
|
|
23
23
|
/**
|
|
24
24
|
* Scope classification for extracted facts (issue #XXX).
|
|
25
25
|
*
|
|
26
|
-
* - `"project"` —
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* library behavior, API patterns, user preferences, tool configurations,
|
|
31
|
-
* general coding patterns, infrastructure knowledge.
|
|
26
|
+
* - `"project"` — one codebase (paths, env configs, deployment, stakeholders);
|
|
27
|
+
* also tool/command or CLI-flag instructions tied to one agent.
|
|
28
|
+
* - `"global"` — across projects: framework bugs, library/API behavior,
|
|
29
|
+
* user preferences, coding patterns, infrastructure.
|
|
32
30
|
*
|
|
33
|
-
* Default is `"project"`
|
|
34
|
-
* coding context is present.
|
|
31
|
+
* Default is `"project"` with a coding context active, else `"global"`.
|
|
35
32
|
*/
|
|
36
33
|
export type MemoryScope = "project" | "global";
|
|
37
34
|
export type SlotMismatchMode = "error" | "warn" | "silent";
|
|
@@ -3333,6 +3330,8 @@ export interface ExtractionResult {
|
|
|
3333
3330
|
extractionFailure?: string;
|
|
3334
3331
|
/** Coarse class used by the retry/backoff + circuit-breaker layer (extraction hot loop). */
|
|
3335
3332
|
extractionFailureClass?: ExtractionFailureClass;
|
|
3333
|
+
/** Trusted source connector resolved over boundedTurns; persisted verbatim by the orchestrator so it is not recomputed (#2183). */
|
|
3334
|
+
sourceConnector?: string;
|
|
3336
3335
|
}
|
|
3337
3336
|
|
|
3338
3337
|
export interface EntityMention {
|