@remnic/core 1.1.11 → 1.1.12
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/README.md +3 -3
- package/dist/access-cli.js +67 -59
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +7 -4
- package/dist/access-http.js +30 -26
- package/dist/access-mcp.d.ts +9 -4
- package/dist/access-mcp.js +29 -25
- package/dist/access-schema.d.ts +188 -8
- package/dist/access-schema.js +12 -3
- package/dist/{access-service-BkXt3di1.d.ts → access-service-DDjzFALq.d.ts} +60 -11
- package/dist/access-service.d.ts +7 -4
- package/dist/access-service.js +26 -23
- package/dist/action-confidence.d.ts +83 -0
- package/dist/action-confidence.js +22 -0
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +4 -2
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +5 -5
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/calibration.js +4 -4
- package/dist/{capsule-export-LLEVB2RG.js → capsule-export-7QNCBZOQ.js} +3 -3
- package/dist/{capsule-import-UW45R2MZ.js → capsule-import-EPBHD2EN.js} +3 -3
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +11 -11
- package/dist/{chunk-VQXK37XA.js → chunk-23ZZK64Y.js} +1 -1
- package/dist/chunk-23ZZK64Y.js.map +1 -0
- package/dist/{chunk-HJYHRE4S.js → chunk-242S3I2A.js} +2 -2
- package/dist/{chunk-MCC6KDQF.js → chunk-3B6KIRBH.js} +131 -13
- package/dist/chunk-3B6KIRBH.js.map +1 -0
- package/dist/chunk-4RA3C3EV.js +60 -0
- package/dist/chunk-4RA3C3EV.js.map +1 -0
- package/dist/{chunk-EYNQTST2.js → chunk-4YM32CRU.js} +4 -4
- package/dist/{chunk-6AUUAZEX.js → chunk-5NXIJZFX.js} +38 -8
- package/dist/chunk-5NXIJZFX.js.map +1 -0
- package/dist/chunk-6NKAQ74D.js +2237 -0
- package/dist/chunk-6NKAQ74D.js.map +1 -0
- package/dist/{chunk-PHNGXFQ6.js → chunk-7V22HTMD.js} +3 -3
- package/dist/{chunk-363MWCD3.js → chunk-7ZM3BFKK.js} +84 -62
- package/dist/chunk-7ZM3BFKK.js.map +1 -0
- package/dist/chunk-AC5LO7IU.js +308 -0
- package/dist/chunk-AC5LO7IU.js.map +1 -0
- package/dist/chunk-AH2JUU6X.js +336 -0
- package/dist/chunk-AH2JUU6X.js.map +1 -0
- package/dist/{chunk-VX2IUQFE.js → chunk-AQJNPMOA.js} +41 -11
- package/dist/chunk-AQJNPMOA.js.map +1 -0
- package/dist/{chunk-P73JTV34.js → chunk-BBE34QBJ.js} +4 -4
- package/dist/{chunk-KUHRUM6B.js → chunk-BZSQEPRW.js} +452 -139
- package/dist/chunk-BZSQEPRW.js.map +1 -0
- package/dist/chunk-C5BCH4ZS.js +317 -0
- package/dist/chunk-C5BCH4ZS.js.map +1 -0
- package/dist/{chunk-C5HUWVH2.js → chunk-CPKTBRS2.js} +6 -6
- package/dist/{chunk-IBX3VFOM.js → chunk-D4GAOFF6.js} +118 -2
- package/dist/chunk-D4GAOFF6.js.map +1 -0
- package/dist/chunk-DB5A3NHS.js +906 -0
- package/dist/chunk-DB5A3NHS.js.map +1 -0
- package/dist/{chunk-I6BQZSML.js → chunk-DZZPC36E.js} +10 -10
- package/dist/{chunk-O4XJUPSF.js → chunk-E2UCDP5S.js} +39 -2
- package/dist/chunk-E2UCDP5S.js.map +1 -0
- package/dist/{chunk-SRBJUAMP.js → chunk-FMEBPEAO.js} +11 -67
- package/dist/chunk-FMEBPEAO.js.map +1 -0
- package/dist/{chunk-4DXC6HQQ.js → chunk-FQDPCE3I.js} +5 -5
- package/dist/{chunk-NN3LPQ5D.js → chunk-HELQZFZO.js} +155 -16
- package/dist/chunk-HELQZFZO.js.map +1 -0
- package/dist/{chunk-57QNCUEZ.js → chunk-HL5LRPNA.js} +2 -2
- package/dist/{chunk-VTU2B4VF.js → chunk-HQZVVSVB.js} +2 -1
- package/dist/chunk-HQZVVSVB.js.map +1 -0
- package/dist/{chunk-6Z6UH6TK.js → chunk-HY3L4WKC.js} +69 -3
- package/dist/chunk-HY3L4WKC.js.map +1 -0
- package/dist/{chunk-QIGOEM65.js → chunk-IB3BFHGN.js} +5 -5
- package/dist/{chunk-RXTFCYQF.js → chunk-JESOB2HO.js} +6 -6
- package/dist/{chunk-2YMTO4ZJ.js → chunk-JKDVIE52.js} +9 -2
- package/dist/chunk-JKDVIE52.js.map +1 -0
- package/dist/{chunk-WGK4VHGP.js → chunk-MNU6ZBWT.js} +302 -140
- package/dist/chunk-MNU6ZBWT.js.map +1 -0
- package/dist/chunk-OAZ5MFUB.js +4124 -0
- package/dist/chunk-OAZ5MFUB.js.map +1 -0
- package/dist/{chunk-ZTSE2ZJ6.js → chunk-OIGNEXKZ.js} +50 -3
- package/dist/chunk-OIGNEXKZ.js.map +1 -0
- package/dist/chunk-OZKZ2TRP.js +3729 -0
- package/dist/chunk-OZKZ2TRP.js.map +1 -0
- package/dist/{chunk-GGD5W7TB.js → chunk-PD6O7AXF.js} +7 -2
- package/dist/chunk-PD6O7AXF.js.map +1 -0
- package/dist/{chunk-S3IP6R6K.js → chunk-PH4C2U43.js} +23 -3
- package/dist/chunk-PH4C2U43.js.map +1 -0
- package/dist/chunk-PYPOFEMK.js +294 -0
- package/dist/chunk-PYPOFEMK.js.map +1 -0
- package/dist/{chunk-EQINRHYR.js → chunk-QDZ2RLEC.js} +243 -7
- package/dist/chunk-QDZ2RLEC.js.map +1 -0
- package/dist/{chunk-KWBPHZUU.js → chunk-RK6F44Y6.js} +3 -2
- package/dist/chunk-RK6F44Y6.js.map +1 -0
- package/dist/{chunk-36CTNQY7.js → chunk-RVPLBATS.js} +42 -10
- package/dist/chunk-RVPLBATS.js.map +1 -0
- package/dist/chunk-SOAU2OE2.js +125 -0
- package/dist/chunk-SOAU2OE2.js.map +1 -0
- package/dist/{chunk-A4ACKWIW.js → chunk-U5JMRGKX.js} +55 -4
- package/dist/chunk-U5JMRGKX.js.map +1 -0
- package/dist/{chunk-LIO5X3CM.js → chunk-UVMUAWVT.js} +2 -2
- package/dist/chunk-VWT3F4IV.js +2161 -0
- package/dist/chunk-VWT3F4IV.js.map +1 -0
- package/dist/{chunk-PB5KW5PL.js → chunk-WEJG4TB5.js} +6 -6
- package/dist/{chunk-KBYWQWSB.js → chunk-X7HPGUVG.js} +2 -2
- package/dist/{chunk-Y5KDIOKF.js → chunk-XAMBKFQS.js} +383 -9
- package/dist/chunk-XAMBKFQS.js.map +1 -0
- package/dist/{chunk-ZL4S7ARC.js → chunk-Y3VMVTYX.js} +3 -3
- package/dist/{chunk-Z5S5HNGY.js → chunk-ZG7PTKBK.js} +21 -5
- package/dist/chunk-ZG7PTKBK.js.map +1 -0
- package/dist/{chunk-6XA7UN4Z.js → chunk-ZNQN6ZTA.js} +2 -2
- package/dist/{chunk-WTFWLUSX.js → chunk-ZVTKDVVM.js} +2 -2
- package/dist/{cli-Cvy2SNhF.d.ts → cli-BR8KpIU0.d.ts} +2 -2
- package/dist/cli.d.ts +7 -4
- package/dist/cli.js +44 -40
- package/dist/codex-cli-fallback.d.ts +1 -0
- package/dist/codex-cli-fallback.js +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/{contradiction-scan-3Z6YW7YA.js → contradiction-scan-QTXAMBUA.js} +3 -2
- package/dist/contradiction-scan-QTXAMBUA.js.map +1 -0
- 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-wiring.js +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/{engine-FOC3IJLA.js → engine-35M5BKQ7.js} +7 -7
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +5 -5
- package/dist/entity-schema.d.ts +1 -1
- package/dist/event-order-recall.d.ts +17 -0
- package/dist/event-order-recall.js +11 -0
- package/dist/event-order-recall.js.map +1 -0
- package/dist/evidence-pack.d.ts +3 -1
- package/dist/evidence-pack.js +5 -3
- package/dist/explicit-capture.d.ts +4 -2
- package/dist/explicit-cue-recall.d.ts +4 -1
- package/dist/explicit-cue-recall.js +4 -2
- 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.d.ts +1 -1
- package/dist/extraction.js +8 -7
- package/dist/fallback-llm.d.ts +2 -1
- package/dist/fallback-llm.js +4 -4
- package/dist/focused-list-recall.d.ts +17 -0
- package/dist/focused-list-recall.js +11 -0
- package/dist/focused-list-recall.js.map +1 -0
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/{index-1qIcnbG1.d.ts → index-DJ9QWMw-.d.ts} +3 -2
- package/dist/index.d.ts +49 -12
- package/dist/index.js +284 -114
- package/dist/index.js.map +1 -1
- package/dist/intent.d.ts +1 -1
- package/dist/intent.js +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +8 -4
- package/dist/local-llm.js +1 -1
- package/dist/mcp-memory-inspector-app.d.ts +106 -0
- package/dist/mcp-memory-inspector-app.js +20 -0
- package/dist/mcp-memory-inspector-app.js.map +1 -0
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/{memory-governance-F3QOJGEY.js → memory-governance-IMPQZXFC.js} +7 -7
- package/dist/memory-governance-IMPQZXFC.js.map +1 -0
- 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 +57 -0
- package/dist/memory-provenance.js +13 -0
- package/dist/memory-provenance.js.map +1 -0
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/objective-state-writers.d.ts +1 -1
- package/dist/objective-state-writers.js +2 -2
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +11 -11
- package/dist/{orchestrator-AOQMo7QI.d.ts → orchestrator-DDMPqU6R.d.ts} +9 -1
- package/dist/orchestrator.d.ts +4 -2
- package/dist/orchestrator.js +53 -46
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +1 -1
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +3 -1
- package/dist/recall-explain-renderer.js +5 -3
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +3 -1
- package/dist/recall-xray-cli.d.ts +3 -1
- package/dist/recall-xray-cli.js +6 -4
- package/dist/recall-xray-renderer.d.ts +3 -1
- package/dist/recall-xray-renderer.js +5 -3
- package/dist/recall-xray.d.ts +8 -1
- package/dist/recall-xray.js +4 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/resolve-provider-secret.js +1 -1
- package/dist/response-guidance-recall.d.ts +18 -0
- package/dist/response-guidance-recall.js +11 -0
- package/dist/response-guidance-recall.js.map +1 -0
- package/dist/resume-bundles.js +3 -3
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/semantic-consolidation.d.ts +1 -1
- package/dist/semantic-consolidation.js +6 -6
- package/dist/semantic-rule-promotion.js +5 -5
- package/dist/semantic-rule-verifier.d.ts +1 -1
- package/dist/semantic-rule-verifier.js +6 -6
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +3 -1
- package/dist/storage.js +4 -4
- package/dist/summarizer.d.ts +1 -1
- package/dist/summarizer.js +6 -6
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/targeted-fact-recall.d.ts +17 -0
- package/dist/targeted-fact-recall.js +11 -0
- package/dist/targeted-fact-recall.js.map +1 -0
- package/dist/telemetry-transcript.d.ts +7 -0
- package/dist/telemetry-transcript.js +16 -0
- package/dist/telemetry-transcript.js.map +1 -0
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-supersession.js +2 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/tokens.js +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/trust-zones.d.ts +3 -2
- package/dist/trust-zones.js +1 -1
- package/dist/types.d.ts +60 -2
- package/dist/types.js +1 -1
- package/dist/user-model.d.ts +37 -0
- package/dist/user-model.js +28 -0
- package/dist/user-model.js.map +1 -0
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.js +6 -6
- package/package.json +1 -1
- package/dist/chunk-2YMTO4ZJ.js.map +0 -1
- package/dist/chunk-363MWCD3.js.map +0 -1
- package/dist/chunk-36CTNQY7.js.map +0 -1
- package/dist/chunk-6AUUAZEX.js.map +0 -1
- package/dist/chunk-6Z6UH6TK.js.map +0 -1
- package/dist/chunk-74WWN7ZW.js +0 -82
- package/dist/chunk-74WWN7ZW.js.map +0 -1
- package/dist/chunk-A4ACKWIW.js.map +0 -1
- package/dist/chunk-EQINRHYR.js.map +0 -1
- package/dist/chunk-GGD5W7TB.js.map +0 -1
- package/dist/chunk-IBX3VFOM.js.map +0 -1
- package/dist/chunk-KUHRUM6B.js.map +0 -1
- package/dist/chunk-KWBPHZUU.js.map +0 -1
- package/dist/chunk-MCC6KDQF.js.map +0 -1
- package/dist/chunk-NN3LPQ5D.js.map +0 -1
- package/dist/chunk-O4XJUPSF.js.map +0 -1
- package/dist/chunk-S2JJBLJG.js +0 -2101
- package/dist/chunk-S2JJBLJG.js.map +0 -1
- package/dist/chunk-S3IP6R6K.js.map +0 -1
- package/dist/chunk-SRBJUAMP.js.map +0 -1
- package/dist/chunk-VQXK37XA.js.map +0 -1
- package/dist/chunk-VTU2B4VF.js.map +0 -1
- package/dist/chunk-VX2IUQFE.js.map +0 -1
- package/dist/chunk-WGK4VHGP.js.map +0 -1
- package/dist/chunk-Y5KDIOKF.js.map +0 -1
- package/dist/chunk-Z5S5HNGY.js.map +0 -1
- package/dist/chunk-ZTSE2ZJ6.js.map +0 -1
- package/dist/contradiction-scan-3Z6YW7YA.js.map +0 -1
- /package/dist/{capsule-export-LLEVB2RG.js.map → action-confidence.js.map} +0 -0
- /package/dist/{capsule-import-UW45R2MZ.js.map → capsule-export-7QNCBZOQ.js.map} +0 -0
- /package/dist/{engine-FOC3IJLA.js.map → capsule-import-EPBHD2EN.js.map} +0 -0
- /package/dist/{chunk-HJYHRE4S.js.map → chunk-242S3I2A.js.map} +0 -0
- /package/dist/{chunk-EYNQTST2.js.map → chunk-4YM32CRU.js.map} +0 -0
- /package/dist/{chunk-PHNGXFQ6.js.map → chunk-7V22HTMD.js.map} +0 -0
- /package/dist/{chunk-P73JTV34.js.map → chunk-BBE34QBJ.js.map} +0 -0
- /package/dist/{chunk-C5HUWVH2.js.map → chunk-CPKTBRS2.js.map} +0 -0
- /package/dist/{chunk-I6BQZSML.js.map → chunk-DZZPC36E.js.map} +0 -0
- /package/dist/{chunk-4DXC6HQQ.js.map → chunk-FQDPCE3I.js.map} +0 -0
- /package/dist/{chunk-57QNCUEZ.js.map → chunk-HL5LRPNA.js.map} +0 -0
- /package/dist/{chunk-QIGOEM65.js.map → chunk-IB3BFHGN.js.map} +0 -0
- /package/dist/{chunk-RXTFCYQF.js.map → chunk-JESOB2HO.js.map} +0 -0
- /package/dist/{chunk-LIO5X3CM.js.map → chunk-UVMUAWVT.js.map} +0 -0
- /package/dist/{chunk-PB5KW5PL.js.map → chunk-WEJG4TB5.js.map} +0 -0
- /package/dist/{chunk-KBYWQWSB.js.map → chunk-X7HPGUVG.js.map} +0 -0
- /package/dist/{chunk-ZL4S7ARC.js.map → chunk-Y3VMVTYX.js.map} +0 -0
- /package/dist/{chunk-6XA7UN4Z.js.map → chunk-ZNQN6ZTA.js.map} +0 -0
- /package/dist/{chunk-WTFWLUSX.js.map → chunk-ZVTKDVVM.js.map} +0 -0
- /package/dist/{memory-governance-F3QOJGEY.js.map → engine-35M5BKQ7.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -88,13 +88,13 @@ import {
|
|
|
88
88
|
runWorkProductStatusCliCommand,
|
|
89
89
|
runWorkProjectCliCommand,
|
|
90
90
|
runWorkTaskCliCommand
|
|
91
|
-
} from "./chunk-
|
|
92
|
-
import "./chunk-
|
|
93
|
-
import "./chunk-KBYWQWSB.js";
|
|
91
|
+
} from "./chunk-7ZM3BFKK.js";
|
|
92
|
+
import "./chunk-ZNQN6ZTA.js";
|
|
94
93
|
import "./chunk-MXC3AP5I.js";
|
|
95
|
-
import "./chunk-
|
|
96
|
-
import "./chunk-
|
|
94
|
+
import "./chunk-X7HPGUVG.js";
|
|
95
|
+
import "./chunk-Y3VMVTYX.js";
|
|
97
96
|
import "./chunk-AJA46VX5.js";
|
|
97
|
+
import "./chunk-DZZPC36E.js";
|
|
98
98
|
import "./chunk-HL4DB7TO.js";
|
|
99
99
|
import "./chunk-ZPKBYX2F.js";
|
|
100
100
|
import "./chunk-3SLRNYNG.js";
|
|
@@ -102,29 +102,29 @@ import "./chunk-LIRZNNUP.js";
|
|
|
102
102
|
import "./chunk-Y4Z4I6WK.js";
|
|
103
103
|
import "./chunk-5HRY2WRF.js";
|
|
104
104
|
import "./chunk-ASAITVLA.js";
|
|
105
|
-
import "./chunk-
|
|
105
|
+
import "./chunk-FMEBPEAO.js";
|
|
106
106
|
import "./chunk-PYXS46O7.js";
|
|
107
107
|
import "./chunk-3QKK7QOS.js";
|
|
108
|
-
import "./chunk-
|
|
108
|
+
import "./chunk-JESOB2HO.js";
|
|
109
109
|
import "./chunk-JRNQ3RNA.js";
|
|
110
|
-
import "./chunk-
|
|
110
|
+
import "./chunk-WEJG4TB5.js";
|
|
111
111
|
import "./chunk-CULXMQJH.js";
|
|
112
112
|
import "./chunk-E6K4NIEU.js";
|
|
113
|
-
import "./chunk-
|
|
113
|
+
import "./chunk-EABGC2TL.js";
|
|
114
|
+
import "./chunk-HL5LRPNA.js";
|
|
114
115
|
import "./chunk-YRMVARQP.js";
|
|
115
|
-
import "./chunk-P77UEOU2.js";
|
|
116
116
|
import "./chunk-U66YHYC7.js";
|
|
117
|
-
import "./chunk-
|
|
117
|
+
import "./chunk-P77UEOU2.js";
|
|
118
118
|
import "./chunk-4IS4SXIQ.js";
|
|
119
119
|
import "./chunk-6TBWYBJ3.js";
|
|
120
|
-
import "./chunk-HMDCOMYU.js";
|
|
121
120
|
import "./chunk-JXS5PDQ7.js";
|
|
121
|
+
import "./chunk-HMDCOMYU.js";
|
|
122
|
+
import "./chunk-7SEAZFFB.js";
|
|
122
123
|
import "./chunk-K6WK37A6.js";
|
|
123
124
|
import "./chunk-AJU4PJGY.js";
|
|
124
125
|
import "./chunk-C6QPK5GG.js";
|
|
125
|
-
import "./chunk-7SEAZFFB.js";
|
|
126
126
|
import "./chunk-FYIYMQ5N.js";
|
|
127
|
-
import "./chunk-
|
|
127
|
+
import "./chunk-HY3L4WKC.js";
|
|
128
128
|
import "./chunk-Z5LAYHGJ.js";
|
|
129
129
|
import "./chunk-OZHRDTDX.js";
|
|
130
130
|
import "./chunk-4WMCPJWX.js";
|
|
@@ -132,56 +132,57 @@ import "./chunk-6HZ6AO2P.js";
|
|
|
132
132
|
import "./chunk-URB2WSKZ.js";
|
|
133
133
|
import "./chunk-PVGDJXVK.js";
|
|
134
134
|
import "./chunk-NGAVDO7E.js";
|
|
135
|
-
import "./chunk-
|
|
136
|
-
import "./chunk-
|
|
135
|
+
import "./chunk-RVPLBATS.js";
|
|
136
|
+
import "./chunk-XAMBKFQS.js";
|
|
137
|
+
import "./chunk-C5BCH4ZS.js";
|
|
137
138
|
import "./chunk-IQT3XTKW.js";
|
|
138
|
-
import "./chunk-
|
|
139
|
-
import "./chunk-
|
|
139
|
+
import "./chunk-MNU6ZBWT.js";
|
|
140
|
+
import "./chunk-IB3BFHGN.js";
|
|
140
141
|
import "./chunk-BT7NVCML.js";
|
|
141
|
-
import "./chunk-O4XJUPSF.js";
|
|
142
|
-
import "./chunk-SOBJ6NEY.js";
|
|
143
142
|
import "./chunk-H7XKCNR6.js";
|
|
144
|
-
import "./chunk-
|
|
143
|
+
import "./chunk-E2UCDP5S.js";
|
|
144
|
+
import "./chunk-SOBJ6NEY.js";
|
|
145
145
|
import "./chunk-D54LZC5L.js";
|
|
146
|
-
import "./chunk-
|
|
147
|
-
import "./chunk-
|
|
148
|
-
import "./chunk-
|
|
149
|
-
import "./chunk-
|
|
150
|
-
import "./chunk-IBX3VFOM.js";
|
|
146
|
+
import "./chunk-QDZ2RLEC.js";
|
|
147
|
+
import "./chunk-JKDVIE52.js";
|
|
148
|
+
import "./chunk-242S3I2A.js";
|
|
149
|
+
import "./chunk-D4GAOFF6.js";
|
|
151
150
|
import "./chunk-5UM2VJ6D.js";
|
|
151
|
+
import "./chunk-4YM32CRU.js";
|
|
152
|
+
import "./chunk-EIR5VLIH.js";
|
|
152
153
|
import "./chunk-PCUKNJAZ.js";
|
|
153
154
|
import "./chunk-EEQLFRUM.js";
|
|
154
155
|
import "./chunk-NBNN5GOB.js";
|
|
155
156
|
import "./chunk-OR64ZGRZ.js";
|
|
157
|
+
import "./chunk-QDW3E4RD.js";
|
|
156
158
|
import "./chunk-GVPWB7EY.js";
|
|
157
159
|
import "./chunk-2LGMW3DJ.js";
|
|
158
|
-
import "./chunk-QDW3E4RD.js";
|
|
159
160
|
import "./chunk-GDFS42HT.js";
|
|
160
161
|
import "./chunk-RK2Y4XOM.js";
|
|
161
162
|
import "./chunk-2LSZVONP.js";
|
|
162
163
|
import "./chunk-WIICJPET.js";
|
|
163
164
|
import "./chunk-G2WADRQ3.js";
|
|
164
|
-
import "./chunk-
|
|
165
|
-
import "./chunk-
|
|
166
|
-
import "./chunk-DT5TVLJE.js";
|
|
167
|
-
import "./chunk-N5AKDXAI.js";
|
|
168
|
-
import "./chunk-TBBDFYXW.js";
|
|
169
|
-
import "./chunk-WTFWLUSX.js";
|
|
170
|
-
import "./chunk-MCC6KDQF.js";
|
|
165
|
+
import "./chunk-ZVTKDVVM.js";
|
|
166
|
+
import "./chunk-3B6KIRBH.js";
|
|
171
167
|
import "./chunk-YNJHCGDT.js";
|
|
172
168
|
import "./chunk-NN2DKE4T.js";
|
|
173
|
-
import "./chunk-
|
|
174
|
-
import "./chunk-PFV5C235.js";
|
|
175
|
-
import "./chunk-RULE4VG5.js";
|
|
169
|
+
import "./chunk-23ZZK64Y.js";
|
|
176
170
|
import "./chunk-SCU65EZI.js";
|
|
177
171
|
import "./chunk-XJKFSSDW.js";
|
|
172
|
+
import "./chunk-PFV5C235.js";
|
|
173
|
+
import "./chunk-RULE4VG5.js";
|
|
178
174
|
import "./chunk-DM2T26WE.js";
|
|
179
175
|
import "./chunk-QSVPYQPG.js";
|
|
180
176
|
import "./chunk-FVQJYWH7.js";
|
|
181
177
|
import "./chunk-4DJQYKMN.js";
|
|
182
178
|
import "./chunk-G7D6GZ5J.js";
|
|
183
179
|
import "./chunk-FAAFWE4G.js";
|
|
180
|
+
import "./chunk-IXEJRKCZ.js";
|
|
184
181
|
import "./chunk-MARWOCVP.js";
|
|
182
|
+
import "./chunk-74EMIVE4.js";
|
|
183
|
+
import "./chunk-DT5TVLJE.js";
|
|
184
|
+
import "./chunk-N5AKDXAI.js";
|
|
185
|
+
import "./chunk-TBBDFYXW.js";
|
|
185
186
|
import "./chunk-2ODBA7MQ.js";
|
|
186
187
|
import "./chunk-DGXUHMOV.js";
|
|
187
188
|
import "./chunk-LPSF4OQH.js";
|
|
@@ -189,15 +190,18 @@ import "./chunk-TVVEYCNW.js";
|
|
|
189
190
|
import "./chunk-RFYAYKTD.js";
|
|
190
191
|
import "./chunk-LBLXEFWK.js";
|
|
191
192
|
import "./chunk-XKECPATV.js";
|
|
192
|
-
import "./chunk-
|
|
193
|
-
import "./chunk-
|
|
193
|
+
import "./chunk-U5JMRGKX.js";
|
|
194
|
+
import "./chunk-BBE34QBJ.js";
|
|
195
|
+
import "./chunk-767ODGE6.js";
|
|
194
196
|
import "./chunk-457A4P3L.js";
|
|
195
197
|
import "./chunk-OA3L7BFR.js";
|
|
196
|
-
import "./chunk-767ODGE6.js";
|
|
197
198
|
import "./chunk-BJMBJZ2Y.js";
|
|
198
199
|
import "./chunk-UKJAGEXH.js";
|
|
199
200
|
import "./chunk-FP2373TW.js";
|
|
200
201
|
import "./chunk-A6XUJE5D.js";
|
|
202
|
+
import "./chunk-AH2JUU6X.js";
|
|
203
|
+
import "./chunk-AC5LO7IU.js";
|
|
204
|
+
import "./chunk-SOAU2OE2.js";
|
|
201
205
|
import "./chunk-PZ5AY32C.js";
|
|
202
206
|
export {
|
|
203
207
|
filterNormalMemorySearchResults,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CompressionGuidelineOptimizerEventCounts, CompressionGuidelineOptimizerActionSummary, CompressionGuidelineOptimizerRuleUpdate, MemoryActionType, MemoryActionEvent, CompressionGuidelineOptimizerState } from './types.js';
|
|
2
|
-
import './index-
|
|
2
|
+
import './index-DJ9QWMw-.js';
|
|
3
3
|
|
|
4
4
|
interface CompressionGuidelineCandidate {
|
|
5
5
|
generatedAt: string;
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -2,7 +2,7 @@ import { StorageManager } from './storage.js';
|
|
|
2
2
|
import './page-versioning.js';
|
|
3
3
|
import './consolidation-operator.js';
|
|
4
4
|
import './types.js';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-DJ9QWMw-.js';
|
|
6
6
|
import './memory-projection-store-CY8TU40w.js';
|
|
7
7
|
import 'better-sqlite3';
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@ import { StorageManager } from './storage.js';
|
|
|
2
2
|
import { VersioningConfig } from './page-versioning.js';
|
|
3
3
|
import './consolidation-operator.js';
|
|
4
4
|
import './types.js';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-DJ9QWMw-.js';
|
|
6
6
|
import './memory-projection-store-CY8TU40w.js';
|
|
7
7
|
import 'better-sqlite3';
|
|
8
8
|
|
|
@@ -135,7 +135,8 @@ async function callLlm(client, config, userMessage) {
|
|
|
135
135
|
if ("chatCompletion" in client && typeof client.chatCompletion === "function") {
|
|
136
136
|
const result = await client.chatCompletion(messages, {
|
|
137
137
|
temperature: 0.1,
|
|
138
|
-
maxTokens: 4096
|
|
138
|
+
maxTokens: 4096,
|
|
139
|
+
operation: "contradiction-judge"
|
|
139
140
|
});
|
|
140
141
|
return result?.content ?? "";
|
|
141
142
|
}
|
|
@@ -410,4 +411,4 @@ export {
|
|
|
410
411
|
ACTIVE_STATUSES,
|
|
411
412
|
runContradictionScan
|
|
412
413
|
};
|
|
413
|
-
//# sourceMappingURL=contradiction-scan-
|
|
414
|
+
//# sourceMappingURL=contradiction-scan-QTXAMBUA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contradiction/contradiction-judge.ts","../src/contradiction/contradiction-scan.ts"],"sourcesContent":["/**\n * Contradiction Judge — LLM-as-judge for semantic contradiction detection (issue #520).\n *\n * Pairs semantically-similar memories and classifies their relationship.\n * Reuses the extraction-judge adapter pattern but with a contradiction-specific\n * prompt and verdict taxonomy.\n *\n * Design constraints:\n * - Default verdict on any failure is \"needs-user\" (rule 48: least-privileged default).\n * - Never auto-resolve; all verdicts enter the review queue.\n * - Content-hash caching avoids redundant LLM calls across runs.\n */\n\nimport { createHash } from \"node:crypto\";\nimport { log } from \"../logger.js\";\nimport type { PluginConfig } from \"../types.js\";\nimport type { LocalLlmClient } from \"../local-llm.js\";\nimport type { FallbackLlmClient } from \"../fallback-llm.js\";\nimport { extractJsonCandidates } from \"../json-extract.js\";\n\n// ── Types ──────────────────────────────────────────────────────────────────────\n\nexport type ContradictionVerdict =\n | \"contradicts\"\n | \"independent\"\n | \"duplicates\"\n | \"needs-user\";\n\nexport interface ContradictionJudgeInput {\n /** Memory ID of the first fact. */\n memoryIdA: string;\n /** Memory ID of the second fact. */\n memoryIdB: string;\n /** Content text of the first fact. */\n textA: string;\n /** Content text of the second fact. */\n textB: string;\n /** Category of the first fact (optional context). */\n categoryA?: string;\n /** Category of the second fact (optional context). */\n categoryB?: string;\n}\n\nexport interface ContradictionJudgeResult {\n /** Memory IDs of the pair. */\n memoryIdA: string;\n memoryIdB: string;\n /** Verdict from the judge. */\n verdict: ContradictionVerdict;\n /** Human-readable rationale. */\n rationale: string;\n /** Confidence in [0, 1]. */\n confidence: number;\n}\n\nexport interface ContradictionJudgeBatchResult {\n /** Results keyed by pair key (\"idA:idB\"). */\n results: Map<string, ContradictionJudgeResult>;\n /** Number served from cache. */\n cached: number;\n /** Number produced by LLM call. */\n judged: number;\n /** Total wall-clock time in ms. */\n elapsed: number;\n}\n\n// ── Prompt ─────────────────────────────────────────────────────────────────────\n\nconst CONTRADICTION_JUDGE_PROMPT = `You are a memory contradiction classifier. You will receive pairs of stored memories and must classify their semantic relationship.\n\nFor each pair, respond with a JSON array where each element has:\n- \"pairKey\": the pairKey provided in the input\n- \"verdict\": one of \"contradicts\", \"independent\", \"duplicates\", \"needs-user\"\n- \"rationale\": one sentence explaining why\n- \"confidence\": number between 0 and 1\n\nVERDICT DEFINITIONS:\n- \"contradicts\": The two memories make claims that cannot both be true. One must be wrong or outdated.\n- \"duplicates\": The two memories convey essentially the same information (near-paraphrase).\n- \"independent\": The memories are topically similar but do not conflict or duplicate.\n- \"needs-user\": Cannot determine with sufficient confidence; requires human review.\n\nIMPORTANT:\n- Be conservative. When in doubt, prefer \"needs-user\" over a wrong classification.\n- Two memories about the same entity/topic are NOT necessarily contradictory.\n- Temporal changes (\"Joshua uses pnpm\" vs \"Joshua switched to npm\") ARE contradictions.\n- Different aspects of the same entity (\"Joshua uses pnpm\" vs \"Joshua works on Remnic\") are \"independent\".`;\n\n// ── Cache ──────────────────────────────────────────────────────────────────────\n\n/** Module-level fallback cache — only used when caller does not supply one. */\nlet defaultVerdictCache: Map<string, ContradictionJudgeResult> = new Map();\nconst CACHE_MAX = 10_000;\n\nfunction pairKey(idA: string, idB: string): string {\n const sorted = [idA, idB].sort();\n return `${sorted[0]}:${sorted[1]}`;\n}\n\nfunction contentHash(a: ContradictionJudgeInput): string {\n // Sort each side pair to be order-independent (matching pairKey behavior)\n const sides = [\n [a.textA.trim(), (a.categoryA ?? \"\").trim()].join(\"|\"),\n [a.textB.trim(), (a.categoryB ?? \"\").trim()].join(\"|\"),\n ].sort();\n const normalized = sides.join(\"|||\");\n return createHash(\"sha256\").update(normalized).digest(\"hex\").slice(0, 16);\n}\n\nexport function createVerdictCache(): Map<string, ContradictionJudgeResult> {\n return new Map();\n}\n\nexport function clearVerdictCache(): void {\n defaultVerdictCache.clear();\n}\n\nexport function verdictCacheSize(): number {\n return defaultVerdictCache.size;\n}\n\n// ── Public API ──────────────────────────────────────────────────────────────────\n\n/**\n * Judge a batch of memory pairs for contradiction.\n *\n * Uses content-hash caching to skip pairs already judged in a prior run.\n * On any LLM failure, all unresolved pairs default to \"needs-user\".\n */\nexport async function judgeContradictionPairs(\n pairs: ContradictionJudgeInput[],\n config: PluginConfig,\n localLlm: LocalLlmClient | null,\n fallbackLlm: FallbackLlmClient | null,\n cache?: Map<string, ContradictionJudgeResult>,\n): Promise<ContradictionJudgeBatchResult> {\n const startTime = Date.now();\n const results = new Map<string, ContradictionJudgeResult>();\n const activeCache = cache ?? defaultVerdictCache;\n let cached = 0;\n let judged = 0;\n\n // Partition into cached vs needs-judging\n const toJudge: ContradictionJudgeInput[] = [];\n for (const pair of pairs) {\n const key = pairKey(pair.memoryIdA, pair.memoryIdB);\n const hash = contentHash(pair);\n const cachedResult = activeCache.get(hash);\n if (cachedResult) {\n results.set(key, { ...cachedResult, memoryIdA: pair.memoryIdA, memoryIdB: pair.memoryIdB });\n cached++;\n } else {\n toJudge.push(pair);\n }\n }\n\n if (toJudge.length === 0) {\n return { results, cached, judged, elapsed: Date.now() - startTime };\n }\n\n // Build the prompt with all pairs\n const pairDescriptions = toJudge.map((p, i) => {\n const pk = pairKey(p.memoryIdA, p.memoryIdB);\n const catA = p.categoryA ? ` [${p.categoryA}]` : \"\";\n const catB = p.categoryB ? ` [${p.categoryB}]` : \"\";\n return `Pair ${i + 1} (pairKey: \"${pk}\"):${catA} \"${p.textA}\"${catB} \"${p.textB}\"`;\n });\n\n const userMessage = `Classify these ${toJudge.length} memory pair(s):\\n\\n${pairDescriptions.join(\"\\n\\n\")}`;\n\n // Try LLM call\n let llmResponse: string | null = null;\n\n if (localLlm) {\n try {\n llmResponse = await callLlm(localLlm, config, userMessage);\n } catch (err) {\n log.warn(\"[contradiction-judge] local LLM call failed: %s\", err instanceof Error ? err.message : err);\n }\n }\n\n if (!llmResponse && fallbackLlm) {\n try {\n llmResponse = await callLlm(fallbackLlm, config, userMessage);\n } catch (err) {\n log.warn(\"[contradiction-judge] fallback LLM call failed: %s\", err instanceof Error ? err.message : err);\n }\n }\n\n // Parse response or default to needs-user\n if (llmResponse) {\n const candidates = extractJsonCandidates(llmResponse);\n const parsed = parseJudgeResponse(candidates, toJudge);\n\n for (const result of parsed) {\n const key = pairKey(result.memoryIdA, result.memoryIdB);\n results.set(key, result);\n\n // Update cache\n const input = toJudge.find(\n (p) => pairKey(p.memoryIdA, p.memoryIdB) === key,\n );\n if (input) {\n const hash = contentHash(input);\n if (activeCache.size >= CACHE_MAX) {\n const firstKey = activeCache.keys().next().value;\n if (firstKey !== undefined) activeCache.delete(firstKey);\n }\n activeCache.set(hash, result);\n }\n judged++;\n }\n } else {\n // All unresolved → needs-user (rule 48)\n for (const pair of toJudge) {\n const key = pairKey(pair.memoryIdA, pair.memoryIdB);\n const result: ContradictionJudgeResult = {\n memoryIdA: pair.memoryIdA,\n memoryIdB: pair.memoryIdB,\n verdict: \"needs-user\",\n rationale: \"LLM call failed; requires manual review\",\n confidence: 0,\n };\n results.set(key, result);\n judged++;\n }\n }\n\n return { results, cached, judged, elapsed: Date.now() - startTime };\n}\n\n// ── Internals ──────────────────────────────────────────────────────────────────\n\nasync function callLlm(\n client: LocalLlmClient | FallbackLlmClient,\n config: PluginConfig,\n userMessage: string,\n): Promise<string> {\n const messages: Array<{ role: \"user\" | \"assistant\" | \"system\"; content: string }> = [\n { role: \"system\", content: CONTRADICTION_JUDGE_PROMPT },\n { role: \"user\", content: userMessage },\n ];\n if (\"chatCompletion\" in client && typeof client.chatCompletion === \"function\") {\n const result = await client.chatCompletion(messages, {\n temperature: 0.1,\n maxTokens: 4096,\n operation: \"contradiction-judge\",\n });\n return result?.content ?? \"\";\n }\n // FallbackLlmClient — try OpenAI-compatible chat completions\n if (\"complete\" in client && typeof (client as Record<string, unknown>).complete === \"function\") {\n const result = await (client as { complete: (msg: Array<{ role: string; content: string }>) => Promise<{ content: string }> }).complete(messages);\n return result.content ?? \"\";\n }\n return \"\";\n}\n\nfunction parseJudgeResponse(\n candidates: string[],\n inputs: ContradictionJudgeInput[],\n): ContradictionJudgeResult[] {\n const VALID_VERDICTS: ContradictionVerdict[] = [\"contradicts\", \"independent\", \"duplicates\", \"needs-user\"];\n\n for (const candidate of candidates) {\n try {\n const parsed = JSON.parse(candidate);\n const items = Array.isArray(parsed) ? parsed : [parsed];\n const results: ContradictionJudgeResult[] = [];\n const matchedKeys = new Set<string>();\n\n for (const item of items) {\n if (!item || typeof item !== \"object\") continue;\n\n const verdict = typeof item.verdict === \"string\" && VALID_VERDICTS.includes(item.verdict as ContradictionVerdict)\n ? (item.verdict as ContradictionVerdict)\n : \"needs-user\";\n\n const pairKeyVal = typeof item.pairKey === \"string\" ? item.pairKey : null;\n const input = pairKeyVal\n ? inputs.find((p) => pairKey(p.memoryIdA, p.memoryIdB) === pairKeyVal)\n : null;\n\n // If we can't match the pairKey, fall back to index-based matching\n const fallbackInput = input ?? inputs[results.length] ?? inputs[0];\n if (!fallbackInput) continue;\n\n matchedKeys.add(pairKey(fallbackInput.memoryIdA, fallbackInput.memoryIdB));\n\n const confidence = typeof item.confidence === \"number\"\n ? Math.min(1, Math.max(0, item.confidence))\n : 0.5;\n\n results.push({\n memoryIdA: fallbackInput.memoryIdA,\n memoryIdB: fallbackInput.memoryIdB,\n verdict,\n rationale: typeof item.rationale === \"string\" ? item.rationale : \"No rationale provided\",\n confidence,\n });\n }\n\n // Backfill any inputs the LLM omitted with needs-user\n for (const inp of inputs) {\n const key = pairKey(inp.memoryIdA, inp.memoryIdB);\n if (!matchedKeys.has(key)) {\n results.push({\n memoryIdA: inp.memoryIdA,\n memoryIdB: inp.memoryIdB,\n verdict: \"needs-user\",\n rationale: \"LLM response omitted this pair\",\n confidence: 0,\n });\n }\n }\n\n if (results.length > 0) return results;\n } catch {\n continue;\n }\n }\n\n // All parse attempts failed → needs-user for every input\n return inputs.map((p) => ({\n memoryIdA: p.memoryIdA,\n memoryIdB: p.memoryIdB,\n verdict: \"needs-user\" as ContradictionVerdict,\n rationale: \"Failed to parse judge response\",\n confidence: 0,\n }));\n}\n\nexport { pairKey as _pairKey, contentHash as _contentHash };\n","/**\n * Contradiction Scan — pair generator + scan driver (issue #520).\n *\n * Nightly cron that pairs semantically-similar active memories within\n * the same namespace, sends candidate pairs to the LLM-as-judge\n * contradiction classifier, and drops contradicting pairs into a\n * review queue for user resolution.\n *\n * Pair generation (cheap pre-filter):\n * 1. Find candidate peers via embedding cosine >= similarityFloor.\n * 2. Restrict to pairs sharing at least one entityRef OR overlapping\n * topic tokens >= topicOverlapFloor.\n * 3. Skip pairs already judged independent/both-valid within cooldown.\n * 4. Cap per-run work at maxPairsPerRun.\n */\n\nimport type { StorageManager } from \"../storage.js\";\nimport type { PluginConfig, MemoryFile, MemoryStatus } from \"../types.js\";\nimport type { SemanticDedupLookup } from \"../dedup/semantic.js\";\nimport { log } from \"../logger.js\";\nimport { judgeContradictionPairs, type ContradictionJudgeInput } from \"./contradiction-judge.js\";\nimport {\n writePairs,\n listPairs,\n isCoolingDown,\n computePairId,\n type ContradictionPair,\n} from \"./contradiction-review.js\";\nimport type { LocalLlmClient } from \"../local-llm.js\";\nimport type { FallbackLlmClient } from \"../fallback-llm.js\";\n\n// ── Types ──────────────────────────────────────────────────────────────────────\n\n/** The set of statuses that represent \"live\" memories eligible for scanning. */\nexport const ACTIVE_STATUSES: Set<MemoryStatus> = new Set([\"active\"]);\n\n/** High-value taxonomy buckets to scan. */\nconst SCAN_CATEGORIES = new Set([\n \"decision\",\n \"principle\",\n \"rule\",\n \"entity\",\n \"fact\",\n \"preference\",\n]);\n\nexport interface ScanResult {\n /** Total active memories scanned. */\n scanned: number;\n /** Candidate pairs generated by the pre-filter. */\n candidates: number;\n /** Pairs sent to judge. */\n judged: number;\n /** Pairs written to review queue. */\n queued: number;\n /** Pairs skipped due to cooldown. */\n cooledDown: number;\n /** Total wall-clock time in ms. */\n elapsedMs: number;\n}\n\nexport interface ScanDependencies {\n storage: StorageManager;\n config: PluginConfig;\n memoryDir: string;\n /** Pre-built embedding lookup. When provided, used as-is for Strategy 3. */\n embeddingLookup?: SemanticDedupLookup;\n /**\n * Factory to build a namespace-scoped embedding lookup.\n * When provided, takes precedence over `embeddingLookup`.\n * The scan driver passes its own `storage` so the lookup queries the correct index.\n */\n embeddingLookupFactory?: (storage: StorageManager) => SemanticDedupLookup | undefined;\n localLlm: LocalLlmClient | null;\n fallbackLlm: FallbackLlmClient | null;\n namespace?: string;\n}\n\n// ── Main scan driver ───────────────────────────────────────────────────────────\n\n/**\n * Run a contradiction scan over the memory corpus.\n *\n * This is the entry point called by the nightly cron and by the CLI.\n */\nexport async function runContradictionScan(deps: ScanDependencies): Promise<ScanResult> {\n const startTime = Date.now();\n const { storage, config, memoryDir, embeddingLookup, embeddingLookupFactory, localLlm, fallbackLlm, namespace } = deps;\n const scanConfig = config.contradictionScan;\n\n // Prefer the factory (which uses the scan's own storage for correct namespace scoping)\n // over a pre-built lookup (which may use default-namespace storage).\n const scopedEmbeddingLookup = embeddingLookupFactory\n ? embeddingLookupFactory(storage)\n : embeddingLookup;\n\n if (!scanConfig.enabled) {\n log.info(\"[contradiction-scan] disabled by config\");\n return { scanned: 0, candidates: 0, judged: 0, queued: 0, cooledDown: 0, elapsedMs: 0 };\n }\n\n // 1. Load active memories in scan categories\n const memories = await loadEligibleMemories(storage, namespace);\n log.info(\"[contradiction-scan] loaded %d eligible memories\", memories.length);\n\n if (memories.length < 2) {\n return { scanned: memories.length, candidates: 0, judged: 0, queued: 0, cooledDown: 0, elapsedMs: Date.now() - startTime };\n }\n\n // 2. Load existing review pairs for cooldown checking\n const existingPairs = listPairs(memoryDir, { filter: \"all\", namespace, limit: 10000 }).pairs;\n const existingMap = new Map<string, ContradictionPair>();\n for (const p of existingPairs) {\n existingMap.set(p.pairId, p);\n }\n\n // 3. Generate candidate pairs\n const candidates = await generatePairs(memories, existingMap, scanConfig, scopedEmbeddingLookup);\n const cooledDown = candidates.skipped;\n log.info(\"[contradiction-scan] generated %d candidates (%d cooled down)\", candidates.pairs.length, cooledDown);\n\n if (candidates.pairs.length === 0) {\n return {\n scanned: memories.length,\n candidates: 0,\n judged: 0,\n queued: 0,\n cooledDown,\n elapsedMs: Date.now() - startTime,\n };\n }\n\n // 4. Cap at maxPairsPerRun (deterministic selection by pairId)\n const capped = candidates.pairs\n .sort((a, b) => computePairId(a.idA, a.idB).localeCompare(computePairId(b.idA, b.idB)))\n .slice(0, scanConfig.maxPairsPerRun);\n\n // 5. Build judge inputs\n const judgeInputs: ContradictionJudgeInput[] = capped.map((pair) => ({\n memoryIdA: pair.idA,\n memoryIdB: pair.idB,\n textA: pair.textA,\n textB: pair.textB,\n categoryA: pair.categoryA,\n categoryB: pair.categoryB,\n }));\n\n // 6. Send to judge (per-scan cache avoids module-level singleton leak)\n const scanCache = new Map<string, import(\"./contradiction-judge.js\").ContradictionJudgeResult>();\n const judgeResult = await judgeContradictionPairs(judgeInputs, config, localLlm, fallbackLlm, scanCache);\n log.info(\"[contradiction-scan] judge completed: %d judged, %d cached in %dms\", judgeResult.judged, judgeResult.cached, judgeResult.elapsed);\n\n // 7. Write to review queue\n const queueEntries: Array<Omit<ContradictionPair, \"pairId\"> & { memoryIds: [string, string] }> = [];\n for (const [key, result] of judgeResult.results) {\n queueEntries.push({\n memoryIds: [result.memoryIdA, result.memoryIdB],\n verdict: result.verdict,\n rationale: result.rationale,\n confidence: result.confidence,\n detectedAt: new Date().toISOString(),\n // Set lastReviewedAt for non-actionable verdicts so cooldown prevents re-judging\n lastReviewedAt: result.verdict === \"independent\" ? new Date().toISOString() : undefined,\n namespace,\n });\n }\n\n const written = writePairs(memoryDir, queueEntries);\n const elapsed = Date.now() - startTime;\n log.info(\"[contradiction-scan] complete: %d queued in %dms\", written.length, elapsed);\n\n return {\n scanned: memories.length,\n candidates: candidates.pairs.length,\n judged: judgeResult.judged,\n queued: written.length,\n cooledDown,\n elapsedMs: elapsed,\n };\n}\n\n// ── Pair generation ────────────────────────────────────────────────────────────\n\ninterface CandidatePair {\n idA: string;\n idB: string;\n textA: string;\n textB: string;\n categoryA?: string;\n categoryB?: string;\n}\n\ninterface PairGenResult {\n pairs: CandidatePair[];\n skipped: number;\n}\n\nasync function generatePairs(\n memories: MemoryFile[],\n existingPairs: Map<string, ContradictionPair>,\n scanConfig: PluginConfig[\"contradictionScan\"],\n embeddingLookup?: SemanticDedupLookup,\n): Promise<PairGenResult> {\n const pairs: CandidatePair[] = [];\n const embeddingPairs: CandidatePair[] = [];\n let skipped = 0;\n const seen = new Set<string>();\n\n // Build index by entityRef for fast lookup\n const byEntity = new Map<string, MemoryFile[]>();\n for (const mem of memories) {\n const entity = mem.frontmatter.entityRef;\n if (entity) {\n const existing = byEntity.get(entity) ?? [];\n existing.push(mem);\n byEntity.set(entity, existing);\n }\n }\n\n // Strategy 1: Entity-ref based pairing (high precision)\n for (const [, group] of byEntity) {\n if (group.length < 2) continue;\n for (let i = 0; i < group.length; i++) {\n for (let j = i + 1; j < group.length; j++) {\n const a = group[i];\n const b = group[j];\n const pairId = computePairId(a.frontmatter.id!, b.frontmatter.id!);\n\n if (seen.has(pairId)) continue;\n seen.add(pairId);\n\n // Check cooldown\n const existing = existingPairs.get(pairId);\n if (existing && isCoolingDown(existing, scanConfig.cooldownDays)) {\n skipped++;\n continue;\n }\n\n pairs.push({\n idA: a.frontmatter.id!,\n idB: b.frontmatter.id!,\n textA: a.content,\n textB: b.content,\n categoryA: a.frontmatter.category as string | undefined,\n categoryB: b.frontmatter.category as string | undefined,\n });\n }\n }\n }\n\n // Strategy 2: Tag/topic overlap for memories without shared entityRef\n const noEntity = memories.filter((m) => !m.frontmatter.entityRef);\n for (let i = 0; i < noEntity.length; i++) {\n for (let j = i + 1; j < noEntity.length; j++) {\n const a = noEntity[i];\n const b = noEntity[j];\n const overlap = jaccardOverlap(\n (a.frontmatter.tags as string[]) ?? [],\n (b.frontmatter.tags as string[]) ?? [],\n );\n\n if (overlap < scanConfig.topicOverlapFloor) continue;\n\n const pairId = computePairId(a.frontmatter.id!, b.frontmatter.id!);\n if (seen.has(pairId)) continue;\n seen.add(pairId);\n\n const existing = existingPairs.get(pairId);\n if (existing && isCoolingDown(existing, scanConfig.cooldownDays)) {\n skipped++;\n continue;\n }\n\n pairs.push({\n idA: a.frontmatter.id!,\n idB: b.frontmatter.id!,\n textA: a.content,\n textB: b.content,\n categoryA: a.frontmatter.category as string | undefined,\n categoryB: b.frontmatter.category as string | undefined,\n });\n }\n }\n\n // Strategy 3: Embedding cosine similarity (enforces similarityFloor config)\n if (embeddingLookup) {\n const memoryById = new Map(memories.map((m) => [m.frontmatter.id!, m]));\n for (const mem of memories) {\n const id = mem.frontmatter.id!;\n try {\n const hits = await embeddingLookup(mem.content, 20);\n for (const hit of hits) {\n if (hit.score < scanConfig.similarityFloor) continue;\n if (hit.id === id) continue;\n const peer = memoryById.get(hit.id);\n if (!peer) continue;\n\n const pairId = computePairId(id, hit.id);\n if (seen.has(pairId)) continue;\n seen.add(pairId);\n\n const existing = existingPairs.get(pairId);\n if (existing && isCoolingDown(existing, scanConfig.cooldownDays)) {\n skipped++;\n continue;\n }\n\n embeddingPairs.push({\n idA: id,\n idB: hit.id,\n textA: mem.content,\n textB: peer.content,\n categoryA: mem.frontmatter.category as string | undefined,\n categoryB: peer.frontmatter.category as string | undefined,\n });\n }\n } catch {\n // Embedding backend unavailable — skip, entity-ref/tag strategies already covered\n }\n }\n }\n\n // Append embedding pairs after high-precision entity/topic pairs so the\n // downstream sort+slice(maxPairsPerRun) keeps precision-first ordering.\n pairs.push(...embeddingPairs);\n\n return { pairs, skipped };\n}\n\n// ── Helpers ────────────────────────────────────────────────────────────────────\n\nasync function loadEligibleMemories(storage: StorageManager, namespace?: string): Promise<MemoryFile[]> {\n let all: MemoryFile[];\n try {\n all = await storage.readAllMemories();\n } catch {\n return [];\n }\n\n return all.filter((mem) => {\n const fm = mem.frontmatter;\n // Only active memories (rule 53: explicit ACTIVE_STATUSES set)\n const status = (fm.status as MemoryStatus) ?? \"active\";\n if (!ACTIVE_STATUSES.has(status)) return false;\n\n // Only scan high-value categories\n const category = fm.category as string | undefined;\n if (category && !SCAN_CATEGORIES.has(category)) return false;\n\n // Must have content\n if (!mem.content || mem.content.trim().length === 0) return false;\n\n // Must have an ID\n if (!fm.id) return false;\n\n // Namespace scoping is handled at the storage layer — memoryDir is\n // already namespace-scoped, so readAllMemories() returns only memories\n // within the requested namespace.\n\n return true;\n });\n}\n\nfunction jaccardOverlap(a: string[], b: string[]): number {\n if (a.length === 0 && b.length === 0) return 0;\n const setA = new Set(a.map((t) => t.toLowerCase()));\n const setB = new Set(b.map((t) => t.toLowerCase()));\n let intersection = 0;\n for (const item of setA) {\n if (setB.has(item)) intersection++;\n }\n const union = setA.size + setB.size - intersection;\n return union === 0 ? 0 : intersection / union;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAS,kBAAkB;AAuD3B,IAAM,6BAA6B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAuBnC,IAAI,sBAA6D,oBAAI,IAAI;AACzE,IAAM,YAAY;AAElB,SAAS,QAAQ,KAAa,KAAqB;AACjD,QAAM,SAAS,CAAC,KAAK,GAAG,EAAE,KAAK;AAC/B,SAAO,GAAG,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC;AAClC;AAEA,SAAS,YAAY,GAAoC;AAEvD,QAAM,QAAQ;AAAA,IACZ,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,aAAa,IAAI,KAAK,CAAC,EAAE,KAAK,GAAG;AAAA,IACrD,CAAC,EAAE,MAAM,KAAK,IAAI,EAAE,aAAa,IAAI,KAAK,CAAC,EAAE,KAAK,GAAG;AAAA,EACvD,EAAE,KAAK;AACP,QAAM,aAAa,MAAM,KAAK,KAAK;AACnC,SAAO,WAAW,QAAQ,EAAE,OAAO,UAAU,EAAE,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE;AAC1E;AAsBA,eAAsB,wBACpB,OACA,QACA,UACA,aACA,OACwC;AACxC,QAAM,YAAY,KAAK,IAAI;AAC3B,QAAM,UAAU,oBAAI,IAAsC;AAC1D,QAAM,cAAc,SAAS;AAC7B,MAAI,SAAS;AACb,MAAI,SAAS;AAGb,QAAM,UAAqC,CAAC;AAC5C,aAAW,QAAQ,OAAO;AACxB,UAAM,MAAM,QAAQ,KAAK,WAAW,KA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AAE,WAAW,EAAG,QAAO;AAG5D,QAAI,CAAC,GAAG,GAAI,QAAO;AAMnB,WAAO;AAAA,EACT,CAAC;AACH;AAEA,SAAS,eAAe,GAAa,GAAqB;AACxD,MAAI,EAAE,WAAW,KAAK,EAAE,WAAW,EAAG,QAAO;AAC7C,QAAM,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAClD,QAAM,OAAO,IAAI,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAClD,MAAI,eAAe;AACnB,aAAW,QAAQ,MAAM;AACvB,QAAI,KAAK,IAAI,IAAI,EAAG;AAAA,EACtB;AACA,QAAM,QAAQ,KAAK,OAAO,KAAK,OAAO;AACtC,SAAO,UAAU,IAAI,IAAI,eAAe;AAC1C;","names":[]}
|
package/dist/day-summary.d.ts
CHANGED
package/dist/delinearize.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MemoryFile, PluginConfig } from './types.js';
|
|
|
2
2
|
import { TrustZoneName } from './trust-zones.js';
|
|
3
3
|
import { T as Taxonomy } from './types-DJhqDJUV.js';
|
|
4
4
|
import { DirectAnswerResult } from './direct-answer.js';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-DJ9QWMw-.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Direct-answer wiring (issue #518 slice 3).
|
package/dist/direct-answer.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompoundingEngine,
|
|
3
3
|
defaultTierMigrationCycleBudget
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-MCC6KDQF.js";
|
|
4
|
+
} from "./chunk-FQDPCE3I.js";
|
|
5
|
+
import "./chunk-3B6KIRBH.js";
|
|
7
6
|
import "./chunk-YNJHCGDT.js";
|
|
8
7
|
import "./chunk-NN2DKE4T.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-PFV5C235.js";
|
|
11
|
-
import "./chunk-RULE4VG5.js";
|
|
8
|
+
import "./chunk-23ZZK64Y.js";
|
|
12
9
|
import "./chunk-SCU65EZI.js";
|
|
13
10
|
import "./chunk-XJKFSSDW.js";
|
|
11
|
+
import "./chunk-PFV5C235.js";
|
|
12
|
+
import "./chunk-RULE4VG5.js";
|
|
14
13
|
import "./chunk-DM2T26WE.js";
|
|
15
14
|
import "./chunk-QSVPYQPG.js";
|
|
16
15
|
import "./chunk-FVQJYWH7.js";
|
|
17
16
|
import "./chunk-4DJQYKMN.js";
|
|
18
17
|
import "./chunk-G7D6GZ5J.js";
|
|
19
18
|
import "./chunk-FAAFWE4G.js";
|
|
19
|
+
import "./chunk-IXEJRKCZ.js";
|
|
20
20
|
import "./chunk-MARWOCVP.js";
|
|
21
21
|
import "./chunk-2ODBA7MQ.js";
|
|
22
22
|
import "./chunk-A6XUJE5D.js";
|
|
@@ -25,4 +25,4 @@ export {
|
|
|
25
25
|
CompoundingEngine,
|
|
26
26
|
defaultTierMigrationCycleBudget
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=engine-
|
|
28
|
+
//# sourceMappingURL=engine-35M5BKQ7.js.map
|
|
@@ -4,7 +4,7 @@ import './page-versioning.js';
|
|
|
4
4
|
import './consolidation-operator.js';
|
|
5
5
|
import './memory-projection-store-CY8TU40w.js';
|
|
6
6
|
import 'better-sqlite3';
|
|
7
|
-
import './index-
|
|
7
|
+
import './index-DJ9QWMw-.js';
|
|
8
8
|
|
|
9
9
|
interface BuildEntityRecallSectionOptions {
|
|
10
10
|
config: PluginConfig;
|
package/dist/entity-retrieval.js
CHANGED
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
entityIndexVersion,
|
|
4
4
|
entityRecentTranscriptLookbackHours,
|
|
5
5
|
readRecentEntityTranscriptEntries
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UVMUAWVT.js";
|
|
7
7
|
import "./chunk-7SEAZFFB.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-3B6KIRBH.js";
|
|
9
9
|
import "./chunk-YNJHCGDT.js";
|
|
10
10
|
import "./chunk-NN2DKE4T.js";
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-PFV5C235.js";
|
|
13
|
-
import "./chunk-RULE4VG5.js";
|
|
11
|
+
import "./chunk-23ZZK64Y.js";
|
|
14
12
|
import "./chunk-SCU65EZI.js";
|
|
15
13
|
import "./chunk-XJKFSSDW.js";
|
|
14
|
+
import "./chunk-PFV5C235.js";
|
|
15
|
+
import "./chunk-RULE4VG5.js";
|
|
16
16
|
import "./chunk-DM2T26WE.js";
|
|
17
17
|
import "./chunk-QSVPYQPG.js";
|
|
18
18
|
import "./chunk-FVQJYWH7.js";
|
package/dist/entity-schema.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntitySchemaDefinition, EntitySchemaSectionDefinition, EntityStructuredSection } from './types.js';
|
|
2
|
-
import './index-
|
|
2
|
+
import './index-DJ9QWMw-.js';
|
|
3
3
|
|
|
4
4
|
declare function normalizeEntityText(value: string): string;
|
|
5
5
|
declare function normalizeEntitySchemas(raw: unknown): Record<string, EntitySchemaDefinition> | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExplicitCueRecallEngine } from './explicit-cue-recall.js';
|
|
2
|
+
|
|
3
|
+
interface EventOrderRecallOptions {
|
|
4
|
+
engine: ExplicitCueRecallEngine | null | undefined;
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
query: string;
|
|
7
|
+
maxChars: number;
|
|
8
|
+
maxItemChars?: number;
|
|
9
|
+
maxScanWindowTurns?: number;
|
|
10
|
+
maxScanWindowTokens?: number;
|
|
11
|
+
maxItems?: number;
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
declare function shouldRecallEventOrderEvidence(query: string): boolean;
|
|
15
|
+
declare function buildEventOrderRecallSection(options: EventOrderRecallOptions): Promise<string>;
|
|
16
|
+
|
|
17
|
+
export { type EventOrderRecallOptions, buildEventOrderRecallSection, shouldRecallEventOrderEvidence };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildEventOrderRecallSection,
|
|
3
|
+
shouldRecallEventOrderEvidence
|
|
4
|
+
} from "./chunk-6NKAQ74D.js";
|
|
5
|
+
import "./chunk-PYPOFEMK.js";
|
|
6
|
+
import "./chunk-PZ5AY32C.js";
|
|
7
|
+
export {
|
|
8
|
+
buildEventOrderRecallSection,
|
|
9
|
+
shouldRecallEventOrderEvidence
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=event-order-recall.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/evidence-pack.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ interface EvidencePackOptions {
|
|
|
10
10
|
title?: string;
|
|
11
11
|
maxChars: number;
|
|
12
12
|
maxItemChars?: number;
|
|
13
|
+
query?: string;
|
|
13
14
|
}
|
|
14
15
|
declare function buildEvidencePack(items: readonly EvidencePackItem[], options: EvidencePackOptions): string;
|
|
16
|
+
declare function insertAfterEvidenceHeading(evidence: string, title: string, insert: string): string;
|
|
15
17
|
|
|
16
|
-
export { type EvidencePackItem, type EvidencePackOptions, buildEvidencePack };
|
|
18
|
+
export { type EvidencePackItem, type EvidencePackOptions, buildEvidencePack, insertAfterEvidenceHeading };
|
package/dist/evidence-pack.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
buildEvidencePack
|
|
3
|
-
|
|
2
|
+
buildEvidencePack,
|
|
3
|
+
insertAfterEvidenceHeading
|
|
4
|
+
} from "./chunk-PYPOFEMK.js";
|
|
4
5
|
import "./chunk-PZ5AY32C.js";
|
|
5
6
|
export {
|
|
6
|
-
buildEvidencePack
|
|
7
|
+
buildEvidencePack,
|
|
8
|
+
insertAfterEvidenceHeading
|
|
7
9
|
};
|
|
8
10
|
//# sourceMappingURL=evidence-pack.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as Orchestrator } from './orchestrator-
|
|
1
|
+
import { O as Orchestrator } from './orchestrator-DDMPqU6R.js';
|
|
2
2
|
import { MemoryCategory, PluginConfig } from './types.js';
|
|
3
3
|
import './buffer.js';
|
|
4
4
|
import './storage.js';
|
|
@@ -6,7 +6,7 @@ import './page-versioning.js';
|
|
|
6
6
|
import './consolidation-operator.js';
|
|
7
7
|
import './memory-projection-store-CY8TU40w.js';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
|
-
import './index-
|
|
9
|
+
import './index-DJ9QWMw-.js';
|
|
10
10
|
import './port-B6VEDIkC.js';
|
|
11
11
|
import './transcript.js';
|
|
12
12
|
import './session-integrity.js';
|
|
@@ -20,6 +20,8 @@ import './relevance.js';
|
|
|
20
20
|
import './negative.js';
|
|
21
21
|
import './recall-state.js';
|
|
22
22
|
import './recall-xray.js';
|
|
23
|
+
import './memory-provenance.js';
|
|
24
|
+
import './user-model.js';
|
|
23
25
|
import './session-observer-state.js';
|
|
24
26
|
import './embedding-fallback.js';
|
|
25
27
|
import './semantic-consolidation-ByBXb-sf.js';
|
|
@@ -24,6 +24,7 @@ interface ExplicitCueRecallOptions {
|
|
|
24
24
|
maxItemChars?: number;
|
|
25
25
|
maxReferences?: number;
|
|
26
26
|
includeBenchmarkAnchorCues?: boolean;
|
|
27
|
+
includeContentLexicalCues?: boolean;
|
|
27
28
|
includeStructuredPlanCues?: boolean;
|
|
28
29
|
}
|
|
29
30
|
interface TrajectoryAnalysisRecallOptions {
|
|
@@ -45,11 +46,13 @@ declare function normalizeTurnExpansionEnd(stats: {
|
|
|
45
46
|
declare function collectExplicitTurnReferences(query: string): ExplicitTurnReference[];
|
|
46
47
|
declare function collectLexicalCues(query: string, options?: {
|
|
47
48
|
includeBenchmarkAnchorCues?: boolean;
|
|
49
|
+
includeContentLexicalCues?: boolean;
|
|
48
50
|
includeStructuredPlanCues?: boolean;
|
|
49
51
|
}): string[];
|
|
50
52
|
declare function collectQuestionSlotCues(query: string): string[];
|
|
53
|
+
declare function collectContentLexicalCues(query: string): string[];
|
|
51
54
|
declare function collectBenchmarkAnchorCues(query: string): string[];
|
|
52
55
|
declare function collectStructuredPlanCues(query: string): string[];
|
|
53
56
|
declare function collectTemporalLexicalCues(query: string): string[];
|
|
54
57
|
|
|
55
|
-
export { type ExplicitCueRecallEngine, type ExplicitCueRecallOptions, type ExplicitTurnReference, type TrajectoryAnalysisRecallOptions, buildExplicitCueRecallSection, buildTrajectoryAnalysisRecallSection, collectBenchmarkAnchorCues, collectExplicitTurnReferences, collectLexicalCues, collectQuestionSlotCues, collectStructuredPlanCues, collectTemporalLexicalCues, normalizeTurnExpansionEnd };
|
|
58
|
+
export { type ExplicitCueRecallEngine, type ExplicitCueRecallOptions, type ExplicitTurnReference, type TrajectoryAnalysisRecallOptions, buildExplicitCueRecallSection, buildTrajectoryAnalysisRecallSection, collectBenchmarkAnchorCues, collectContentLexicalCues, collectExplicitTurnReferences, collectLexicalCues, collectQuestionSlotCues, collectStructuredPlanCues, collectTemporalLexicalCues, normalizeTurnExpansionEnd };
|
|
@@ -2,19 +2,21 @@ import {
|
|
|
2
2
|
buildExplicitCueRecallSection,
|
|
3
3
|
buildTrajectoryAnalysisRecallSection,
|
|
4
4
|
collectBenchmarkAnchorCues,
|
|
5
|
+
collectContentLexicalCues,
|
|
5
6
|
collectExplicitTurnReferences,
|
|
6
7
|
collectLexicalCues,
|
|
7
8
|
collectQuestionSlotCues,
|
|
8
9
|
collectStructuredPlanCues,
|
|
9
10
|
collectTemporalLexicalCues,
|
|
10
11
|
normalizeTurnExpansionEnd
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-OAZ5MFUB.js";
|
|
13
|
+
import "./chunk-PYPOFEMK.js";
|
|
13
14
|
import "./chunk-PZ5AY32C.js";
|
|
14
15
|
export {
|
|
15
16
|
buildExplicitCueRecallSection,
|
|
16
17
|
buildTrajectoryAnalysisRecallSection,
|
|
17
18
|
collectBenchmarkAnchorCues,
|
|
19
|
+
collectContentLexicalCues,
|
|
18
20
|
collectExplicitTurnReferences,
|
|
19
21
|
collectLexicalCues,
|
|
20
22
|
collectQuestionSlotCues,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ImportanceLevel, PluginConfig } from './types.js';
|
|
2
2
|
import { LocalLlmClient } from './local-llm.js';
|
|
3
3
|
import { FallbackLlmClient } from './fallback-llm.js';
|
|
4
|
-
import './index-
|
|
4
|
+
import './index-DJ9QWMw-.js';
|
|
5
5
|
import './model-registry.js';
|
|
6
6
|
|
|
7
7
|
/**
|
package/dist/extraction.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ContradictionVerificationResult, SuggestedLinks, MemorySummaryResult }
|
|
|
3
3
|
import { PluginConfig, GatewayConfig, BufferTurn, ExtractionResult, MemoryFile, ConsolidationResult, DaySummaryResult } from './types.js';
|
|
4
4
|
import { ModelRegistry } from './model-registry.js';
|
|
5
5
|
import { ProfilingCollector } from './profiling.js';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-DJ9QWMw-.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
9
|
declare class ExtractionEngine {
|