@remnic/core 9.32.0 → 9.34.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 +29 -28
- package/dist/access-authorization-probe.d.ts +10 -10
- package/dist/access-authorization-probe.js +30 -29
- package/dist/access-boundary.d.ts +10 -10
- package/dist/access-boundary.js +29 -28
- package/dist/access-cli.js +71 -68
- 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 +29 -28
- 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 +41 -40
- package/dist/access-identity-continuity-surface.d.ts +8 -8
- package/dist/access-identity-continuity-surface.js +29 -28
- package/dist/access-lcm-surface.d.ts +10 -10
- package/dist/access-lcm-surface.js +29 -28
- package/dist/access-mcp.d.ts +10 -10
- package/dist/access-mcp.js +35 -34
- 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 +29 -28
- package/dist/access-observe-write-surface.d.ts +10 -10
- package/dist/access-observe-write-surface.js +29 -28
- package/dist/access-operations-batch.js +32 -31
- package/dist/access-operations.d.ts +10 -10
- package/dist/access-operations.js +34 -33
- package/dist/access-recall-concurrency.d.ts +10 -10
- package/dist/access-recall-concurrency.js +29 -28
- package/dist/access-recall-response.d.ts +10 -10
- package/dist/access-recall-response.js +29 -28
- package/dist/access-recall-surface.d.ts +10 -10
- package/dist/access-recall-surface.js +29 -28
- 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 +29 -28
- 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 +7 -7
- package/dist/adapters/registry.js +3 -3
- 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-GWVG7LGC.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-FHBITMRY.js → chunk-4TGZCYHH.js} +15 -15
- package/dist/{chunk-KQAFEZQX.js → chunk-5W7CTZ2E.js} +4 -4
- package/dist/{chunk-ODGOP7P2.js → chunk-6HXQ2YO5.js} +2 -2
- package/dist/{chunk-65ZPVYTA.js → chunk-7CCVK67W.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-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-TGTTESJS.js → chunk-CMQZNEIF.js} +2 -2
- package/dist/chunk-CMQZNEIF.js.map +1 -0
- package/dist/{chunk-J3ZGPYXB.js → chunk-DG2R7M7K.js} +34 -36
- package/dist/chunk-DG2R7M7K.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-5WZVQRHV.js → chunk-EO7X2LDK.js} +2 -2
- package/dist/{chunk-TL4TO3EA.js → chunk-F3BNEYX2.js} +2 -2
- package/dist/{chunk-AQEJE3WO.js → chunk-FL3AM5KE.js} +3 -3
- package/dist/{chunk-3F2LKUMU.js → chunk-FYO2GAZJ.js} +2 -2
- package/dist/{chunk-2Q4JJ3FZ.js → chunk-HULSU7PS.js} +2 -2
- package/dist/{chunk-VVDPPDDF.js → chunk-HXDWZFNP.js} +1 -1
- package/dist/chunk-HXDWZFNP.js.map +1 -0
- package/dist/{chunk-3EQ2XB3W.js → chunk-IZXTZ7BF.js} +5 -5
- package/dist/{chunk-THCPRMRF.js → chunk-J6SLNQRO.js} +2 -2
- package/dist/{chunk-IGWFKW4B.js → chunk-KEWUNL7P.js} +2 -2
- package/dist/{chunk-27HHNYSQ.js → chunk-KJT3PZAR.js} +3 -3
- package/dist/chunk-KWMXR7XS.js +138 -0
- package/dist/chunk-KWMXR7XS.js.map +1 -0
- package/dist/{chunk-OPBTPRGY.js → chunk-KWU6MAD4.js} +2 -2
- package/dist/{chunk-227UFSEQ.js → chunk-LEPOP46W.js} +4 -4
- package/dist/{chunk-HFQQWAMS.js → chunk-LRYAQGDR.js} +38 -38
- package/dist/{chunk-VMZ56EE3.js → chunk-MYXWPG5O.js} +2 -2
- package/dist/{chunk-YX5LN6JR.js → chunk-OPRP6Q4Z.js} +3 -3
- package/dist/{chunk-2NLLXCJG.js → chunk-OWHERGF2.js} +2 -2
- package/dist/{chunk-2NTGBZLZ.js → chunk-OXBPHIKH.js} +8 -8
- package/dist/{chunk-QMWFQBIL.js → chunk-QEPNZBBC.js} +3 -3
- package/dist/{chunk-CE5355TT.js → chunk-QHYB4MJV.js} +2 -2
- package/dist/{chunk-AU7Q3LSC.js → chunk-RKNJBZ55.js} +7 -7
- package/dist/{chunk-FMFLGS5Z.js → chunk-RLOVRJZN.js} +8 -8
- package/dist/{chunk-CJDNT45S.js → chunk-RQBF54FC.js} +6 -6
- package/dist/{chunk-LUQ443JP.js → chunk-RSFWAI4D.js} +68 -48
- package/dist/chunk-RSFWAI4D.js.map +1 -0
- 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-E6BMSH7U.js → chunk-SUZI6BHQ.js} +2 -2
- 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-X7Y7WX73.js → chunk-UVYI6VIX.js} +1 -1
- package/dist/{chunk-6P7MTSU5.js → chunk-WFYWGDM6.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-J7WZUL2K.js → chunk-Y6XRTQMV.js} +8 -8
- package/dist/{chunk-MAXVH44E.js → chunk-Z54EM5YZ.js} +7 -7
- package/dist/{cli-DRJLv1Xt.d.ts → cli-mFX-QQvx.d.ts} +5 -5
- package/dist/cli.d.ts +12 -12
- package/dist/cli.js +57 -56
- 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/contradiction/index.js +4 -4
- 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 +15 -15
- 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 +115 -112
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/index.js +6 -6
- 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 +14 -14
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +1 -1
- package/dist/namespaces/search.js +6 -6
- 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 +16 -16
- package/dist/operator-doctor-replica.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +3 -3
- package/dist/operator-toolkit.js +19 -19
- 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 +72 -69
- 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 +5 -5
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +9 -9
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/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-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/tool-scoped-memory.d.ts +47 -0
- package/dist/tool-scoped-memory.js +12 -0
- package/dist/tool-scoped-memory.js.map +1 -0
- 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-redaction-rules.test.ts +53 -0
- package/src/extraction-scope-source-agent.test.ts +513 -0
- package/src/extraction.ts +45 -98
- package/src/index.ts +1 -1
- package/src/orchestration/extraction-persist.ts +31 -32
- 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/tool-scoped-memory.test.ts +199 -0
- package/src/tool-scoped-memory.ts +190 -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-LUQ443JP.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-GWVG7LGC.js.map} +0 -0
- /package/dist/{chunk-FHBITMRY.js.map → chunk-4TGZCYHH.js.map} +0 -0
- /package/dist/{chunk-KQAFEZQX.js.map → chunk-5W7CTZ2E.js.map} +0 -0
- /package/dist/{chunk-ODGOP7P2.js.map → chunk-6HXQ2YO5.js.map} +0 -0
- /package/dist/{chunk-65ZPVYTA.js.map → chunk-7CCVK67W.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-AJL6NNX6.js.map → chunk-BIXWNHIL.js.map} +0 -0
- /package/dist/{chunk-QDTZ2HF7.js.map → chunk-DMT2RGAZ.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-AQEJE3WO.js.map → chunk-FL3AM5KE.js.map} +0 -0
- /package/dist/{chunk-3F2LKUMU.js.map → chunk-FYO2GAZJ.js.map} +0 -0
- /package/dist/{chunk-2Q4JJ3FZ.js.map → chunk-HULSU7PS.js.map} +0 -0
- /package/dist/{chunk-3EQ2XB3W.js.map → chunk-IZXTZ7BF.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-27HHNYSQ.js.map → chunk-KJT3PZAR.js.map} +0 -0
- /package/dist/{chunk-OPBTPRGY.js.map → chunk-KWU6MAD4.js.map} +0 -0
- /package/dist/{chunk-227UFSEQ.js.map → chunk-LEPOP46W.js.map} +0 -0
- /package/dist/{chunk-HFQQWAMS.js.map → chunk-LRYAQGDR.js.map} +0 -0
- /package/dist/{chunk-VMZ56EE3.js.map → chunk-MYXWPG5O.js.map} +0 -0
- /package/dist/{chunk-YX5LN6JR.js.map → chunk-OPRP6Q4Z.js.map} +0 -0
- /package/dist/{chunk-2NLLXCJG.js.map → chunk-OWHERGF2.js.map} +0 -0
- /package/dist/{chunk-2NTGBZLZ.js.map → chunk-OXBPHIKH.js.map} +0 -0
- /package/dist/{chunk-QMWFQBIL.js.map → chunk-QEPNZBBC.js.map} +0 -0
- /package/dist/{chunk-CE5355TT.js.map → chunk-QHYB4MJV.js.map} +0 -0
- /package/dist/{chunk-AU7Q3LSC.js.map → chunk-RKNJBZ55.js.map} +0 -0
- /package/dist/{chunk-FMFLGS5Z.js.map → chunk-RLOVRJZN.js.map} +0 -0
- /package/dist/{chunk-CJDNT45S.js.map → chunk-RQBF54FC.js.map} +0 -0
- /package/dist/{chunk-E6BMSH7U.js.map → chunk-SUZI6BHQ.js.map} +0 -0
- /package/dist/{chunk-35IVNNRK.js.map → chunk-TCIWHK3N.js.map} +0 -0
- /package/dist/{chunk-X7Y7WX73.js.map → chunk-UVYI6VIX.js.map} +0 -0
- /package/dist/{chunk-6P7MTSU5.js.map → chunk-WFYWGDM6.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-J7WZUL2K.js.map → chunk-Y6XRTQMV.js.map} +0 -0
- /package/dist/{chunk-MAXVH44E.js.map → chunk-Z54EM5YZ.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
|
package/src/index.ts
CHANGED
|
@@ -1439,7 +1439,6 @@ export {
|
|
|
1439
1439
|
type ForkLineage,
|
|
1440
1440
|
} from "./transfer/capsule-fork.js";
|
|
1441
1441
|
|
|
1442
|
-
|
|
1443
1442
|
// ---------------------------------------------------------------------------
|
|
1444
1443
|
// Coding-graph engine contract (#1551 PR1) — types owned by core,
|
|
1445
1444
|
// implemented by @remnic/coding-graph (à-la-carte optional).
|
|
@@ -1460,3 +1459,4 @@ export type {
|
|
|
1460
1459
|
ParseResult,
|
|
1461
1460
|
SymbolIR,
|
|
1462
1461
|
} from "./coding/coding-graph-types.js";
|
|
1462
|
+
export type { ResolvedScopeProfilePlan } from "./namespaces/scope-profiles.js";
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
stripCitationForTemplate,
|
|
83
83
|
} from "../source-attribution.js";
|
|
84
84
|
import { classifyMemoryKind } from "../himem.js";
|
|
85
|
+
import { shouldPromoteGlobalFactToShared, withholdToolScopedFromSharedNamespace } from "../tool-scoped-memory.js";
|
|
85
86
|
import {
|
|
86
87
|
buildBehaviorSignalsForMemory,
|
|
87
88
|
dedupeBehaviorSignalsByMemoryAndHash,
|
|
@@ -394,6 +395,7 @@ export class ExtractionPersistCoordinator {
|
|
|
394
395
|
// (pre-judge + write-loop) so no new scattered config.*Enabled read is
|
|
395
396
|
// introduced (ratchet scatteredConfigFlagReads; see #1523).
|
|
396
397
|
const namespacesEnabled = resolveNamespaceCapabilities(this.deps.config).namespaces;
|
|
398
|
+
const sourceConnector = sourceContext?.sourceConnector; // #2183 tool-scope guard input
|
|
397
399
|
const promoteMemoryToProfileTargets = async (options: {
|
|
398
400
|
sourceStorage: StorageManager;
|
|
399
401
|
category: string;
|
|
@@ -607,11 +609,14 @@ export class ExtractionPersistCoordinator {
|
|
|
607
609
|
observedAt?: string;
|
|
608
610
|
eventTimeSource?: "extracted" | "assumed";
|
|
609
611
|
source: string;
|
|
612
|
+
sourceConnector?: string;
|
|
613
|
+
procedureSteps?: ReadonlyArray<{ toolCall?: { kind?: string } }>;
|
|
610
614
|
/** Claim-level provenance spans (issue #1575 PR 2). */
|
|
611
615
|
sources?: ProvenanceSource[];
|
|
612
616
|
provenance?: "verified" | "unverified" | "none";
|
|
613
617
|
}): Promise<void> => {
|
|
614
618
|
await promoteMemoryToProfileTargets(options);
|
|
619
|
+
if (lifecycleCaps.extractionScopeClassification && withholdToolScopedFromSharedNamespace(options)) return;
|
|
615
620
|
if (
|
|
616
621
|
!shouldPromoteToShared(
|
|
617
622
|
this.deps.config,
|
|
@@ -629,7 +634,6 @@ export class ExtractionPersistCoordinator {
|
|
|
629
634
|
this.deps.config.sharedNamespace,
|
|
630
635
|
);
|
|
631
636
|
// Dedup gate: canonicalize content before hashing.
|
|
632
|
-
//
|
|
633
637
|
// Issue #369 (PR #401): When inline attribution is enabled,
|
|
634
638
|
// `applyInlineCitation` appends a timestamp-bearing marker (e.g.
|
|
635
639
|
// `[Source: ..., ts=2026-04-11T...]`). Because the timestamp changes
|
|
@@ -639,7 +643,6 @@ export class ExtractionPersistCoordinator {
|
|
|
639
643
|
// `fact.content`, which can already carry an inline citation (e.g. a
|
|
640
644
|
// relayed or reprocessed fact). Strip any pre-existing citation so the
|
|
641
645
|
// dedup key matches the hash stored from the original un-cited write.
|
|
642
|
-
//
|
|
643
646
|
// PR #402 round-6 (Fix #2 / chatgpt-codex P1 PRRT_kwDORJXyws56U74n):
|
|
644
647
|
// Compute the enriched content before the hash-dedup check so the
|
|
645
648
|
// lookup uses the same content that writeMemory will actually store.
|
|
@@ -652,7 +655,6 @@ export class ExtractionPersistCoordinator {
|
|
|
652
655
|
// key order and casing are canonical — identical to the enrichment
|
|
653
656
|
// applied by storage.writeMemory — preventing spurious hash misses
|
|
654
657
|
// when attribute maps arrive with different insertion orders or casing.
|
|
655
|
-
//
|
|
656
658
|
// Fix #4 (Low PRRT_kwDORJXyws56VHth): sanitize the base content before
|
|
657
659
|
// building dedupContent. writeMemory runs sanitizeMemoryContent on the
|
|
658
660
|
// enriched body before hashing; if sanitization redacts the content to
|
|
@@ -660,7 +662,6 @@ export class ExtractionPersistCoordinator {
|
|
|
660
662
|
// the raw form. Computing dedupContent from sanitized.text here ensures
|
|
661
663
|
// the hash lookup and the normalizedIncoming comparison both use the
|
|
662
664
|
// same content that writeMemory will actually store.
|
|
663
|
-
//
|
|
664
665
|
// Combined fix: strip any pre-existing citation FIRST to obtain
|
|
665
666
|
// rawContent (the canonical body), then sanitize rawContent (not
|
|
666
667
|
// options.content) when building dedupContent, so that citation
|
|
@@ -1350,20 +1351,18 @@ export class ExtractionPersistCoordinator {
|
|
|
1350
1351
|
// + PBJEe/PBKAj).
|
|
1351
1352
|
let factRedactionRules = preJudgeRedactionRules;
|
|
1352
1353
|
let factNs = preRoutedNamespaceByFact[fi];
|
|
1353
|
-
// #1713
|
|
1354
|
-
//
|
|
1355
|
-
//
|
|
1356
|
-
// namespace's rules too, or a never-store pattern under shared is
|
|
1357
|
-
// missed at pre-judge and only caught at the write gate — letting the
|
|
1358
|
-
// content reach the extraction judge/training path. Mirror the write
|
|
1359
|
-
// loop's scope-routing conditions exactly.
|
|
1354
|
+
// #1713: predict the same target namespace the write loop will route
|
|
1355
|
+
// this global fact to (shared, via shouldPromoteGlobalFactToShared) so
|
|
1356
|
+
// the pre-judge redaction filter consults that namespace's rules.
|
|
1360
1357
|
if (
|
|
1361
1358
|
!factNs &&
|
|
1362
1359
|
lifecycleCaps.extractionScopeClassification &&
|
|
1363
1360
|
namespacesEnabled &&
|
|
1364
1361
|
f.scope === "global" &&
|
|
1365
1362
|
profileAllowsSharedWrites &&
|
|
1366
|
-
this.deps.storageDirNamespace(storage.dir) !== this.deps.config.sharedNamespace
|
|
1363
|
+
this.deps.storageDirNamespace(storage.dir) !== this.deps.config.sharedNamespace &&
|
|
1364
|
+
shouldPromoteGlobalFactToShared({ scope: f.scope, content: f.content,
|
|
1365
|
+
sourceConnector, procedureSteps: f.procedureSteps })
|
|
1367
1366
|
) {
|
|
1368
1367
|
factNs = this.deps.config.sharedNamespace;
|
|
1369
1368
|
}
|
|
@@ -1611,14 +1610,9 @@ export class ExtractionPersistCoordinator {
|
|
|
1611
1610
|
}
|
|
1612
1611
|
}
|
|
1613
1612
|
|
|
1614
|
-
// Scope-based namespace routing:
|
|
1615
|
-
//
|
|
1616
|
-
// namespace
|
|
1617
|
-
// applies when namespaces are enabled and the fact was not already
|
|
1618
|
-
// routed to a specific namespace by a routing rule (routing rules
|
|
1619
|
-
// that set an explicit namespace take precedence; category-only rules
|
|
1620
|
-
// do not block scope routing). Rule 30: gated by
|
|
1621
|
-
// extractionScopeClassificationEnabled.
|
|
1613
|
+
// Scope-based namespace routing: a `global` fact (scope classification
|
|
1614
|
+
// on, no explicit routing-rule namespace) is promoted to the shared
|
|
1615
|
+
// namespace unless the tool-scope guard withholds it (#2183).
|
|
1622
1616
|
if (
|
|
1623
1617
|
lifecycleCaps.extractionScopeClassification &&
|
|
1624
1618
|
namespacesEnabled &&
|
|
@@ -1627,18 +1621,21 @@ export class ExtractionPersistCoordinator {
|
|
|
1627
1621
|
) {
|
|
1628
1622
|
const currentNs = this.deps.storageDirNamespace(targetStorage.dir);
|
|
1629
1623
|
if (currentNs !== this.deps.config.sharedNamespace && profileAllowsSharedWrites) {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1624
|
+
if (shouldPromoteGlobalFactToShared({ scope: fact.scope, content: fact.content,
|
|
1625
|
+
sourceConnector, procedureSteps: fact.procedureSteps })) {
|
|
1626
|
+
try {
|
|
1627
|
+
targetStorage = await this.deps.getStorageRouter().storageFor(
|
|
1628
|
+
this.deps.config.sharedNamespace,
|
|
1629
|
+
);
|
|
1630
|
+
targetNamespaceName = this.deps.config.sharedNamespace;
|
|
1631
|
+
log.debug(
|
|
1632
|
+
`scope-routing: fact "${fact.content.slice(0, 60)}…" routed to shared namespace (scope=global)`,
|
|
1633
|
+
);
|
|
1634
|
+
} catch (scopeRouteErr) {
|
|
1635
|
+
log.warn(
|
|
1636
|
+
`scope-routing: failed to resolve shared namespace storage; writing to session namespace (fail-open): ${scopeRouteErr}`,
|
|
1637
|
+
);
|
|
1638
|
+
}
|
|
1642
1639
|
}
|
|
1643
1640
|
} else if (currentNs !== this.deps.config.sharedNamespace) {
|
|
1644
1641
|
log.debug(
|
|
@@ -2404,6 +2401,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2404
2401
|
: {}),
|
|
2405
2402
|
source: extractionWriteSource,
|
|
2406
2403
|
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2404
|
+
...(fact.procedureSteps && fact.procedureSteps.length ? { procedureSteps: fact.procedureSteps } : {}),
|
|
2407
2405
|
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2408
2406
|
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2409
2407
|
});
|
|
@@ -2704,6 +2702,7 @@ export class ExtractionPersistCoordinator {
|
|
|
2704
2702
|
: {}),
|
|
2705
2703
|
source: extractionWriteSource,
|
|
2706
2704
|
...(extractionSourceConnector ? { sourceConnector: extractionSourceConnector } : {}),
|
|
2705
|
+
...(fact.procedureSteps && fact.procedureSteps.length ? { procedureSteps: fact.procedureSteps } : {}),
|
|
2707
2706
|
...(fact.sources && fact.sources.length > 0 ? { sources: fact.sources } : {}),
|
|
2708
2707
|
...(fact.provenance ? { provenance: fact.provenance } : {}),
|
|
2709
2708
|
});
|
|
@@ -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
|
+
}
|