@remnic/core 1.0.3 → 1.1.1
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/abort-error.d.ts +32 -0
- package/dist/abort-error.js +11 -0
- package/dist/access-audit.d.ts +56 -0
- package/dist/access-audit.js +9 -0
- package/dist/access-audit.js.map +1 -0
- package/dist/access-cli.js +72 -54
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +16 -8
- package/dist/access-http.js +25 -17
- package/dist/access-mcp.d.ts +16 -8
- package/dist/access-mcp.js +28 -6
- package/dist/access-schema.d.ts +130 -39
- package/dist/access-schema.js +5 -1
- package/dist/access-service-Br8ZydTK.d.ts +827 -0
- package/dist/access-service.d.ts +20 -660
- package/dist/access-service.js +22 -14
- package/dist/bootstrap.d.ts +6 -3
- package/dist/briefing.d.ts +1 -0
- package/dist/briefing.js +6 -5
- package/dist/buffer-surprise-report.d.ts +70 -0
- package/dist/buffer-surprise-report.js +7 -0
- package/dist/buffer-surprise-report.js.map +1 -0
- package/dist/buffer-surprise.d.ts +98 -0
- package/dist/buffer-surprise.js +11 -0
- package/dist/buffer-surprise.js.map +1 -0
- package/dist/buffer.d.ts +100 -2
- package/dist/buffer.js +1 -1
- package/dist/calibration.js +5 -5
- package/dist/causal-behavior.js +4 -4
- package/dist/causal-chain.js +2 -2
- package/dist/causal-consolidation.js +17 -16
- package/dist/causal-consolidation.js.map +1 -1
- package/dist/causal-retrieval.js +4 -4
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-QNJMBKFK.js → chunk-2LGMW3DJ.js} +3 -2
- package/dist/chunk-2LGMW3DJ.js.map +1 -0
- package/dist/{chunk-QDYXG4CS.js → chunk-3FPTCC3Z.js} +4 -3
- package/dist/chunk-3FPTCC3Z.js.map +1 -0
- package/dist/chunk-3GPTTA4J.js +57 -0
- package/dist/chunk-3GPTTA4J.js.map +1 -0
- package/dist/{chunk-QKAH5B6E.js → chunk-3GXCSUXR.js} +94 -6
- package/dist/chunk-3GXCSUXR.js.map +1 -0
- package/dist/{chunk-POBPGDWI.js → chunk-3OGMS3PE.js} +2 -2
- package/dist/chunk-54V4BZWP.js +139 -0
- package/dist/chunk-54V4BZWP.js.map +1 -0
- package/dist/chunk-5JRF2PZA.js +67 -0
- package/dist/chunk-5JRF2PZA.js.map +1 -0
- package/dist/chunk-64NJRYU2.js +332 -0
- package/dist/chunk-64NJRYU2.js.map +1 -0
- package/dist/chunk-6AUUAZEX.js +150 -0
- package/dist/chunk-6AUUAZEX.js.map +1 -0
- package/dist/{chunk-HITJFT7E.js → chunk-7I7FKFZH.js} +28 -21
- package/dist/chunk-7I7FKFZH.js.map +1 -0
- package/dist/chunk-AJU4PJGY.js +126 -0
- package/dist/chunk-AJU4PJGY.js.map +1 -0
- package/dist/chunk-ASAITVLA.js +64 -0
- package/dist/chunk-ASAITVLA.js.map +1 -0
- package/dist/{chunk-X4WESCKA.js → chunk-B5WXLVDY.js} +187 -6
- package/dist/chunk-B5WXLVDY.js.map +1 -0
- package/dist/{chunk-RCICHSHL.js → chunk-BGJGXLZ7.js} +111 -2
- package/dist/{chunk-RCICHSHL.js.map → chunk-BGJGXLZ7.js.map} +1 -1
- package/dist/{chunk-OJFGVJS6.js → chunk-BK2EFTE2.js} +319 -18
- package/dist/chunk-BK2EFTE2.js.map +1 -0
- package/dist/chunk-C4SQJZAF.js +486 -0
- package/dist/chunk-C4SQJZAF.js.map +1 -0
- package/dist/{chunk-GJQPH5G3.js → chunk-CUPFXL3J.js} +2 -2
- package/dist/chunk-DF3RVK3X.js +119 -0
- package/dist/chunk-DF3RVK3X.js.map +1 -0
- package/dist/{chunk-PMB3WGDL.js → chunk-DFTTJYSO.js} +167 -7
- package/dist/chunk-DFTTJYSO.js.map +1 -0
- package/dist/chunk-DGVM5SFL.js +69 -0
- package/dist/chunk-DGVM5SFL.js.map +1 -0
- package/dist/chunk-EIR5VLIH.js +90 -0
- package/dist/chunk-EIR5VLIH.js.map +1 -0
- package/dist/{chunk-PAORGQRI.js → chunk-EPQJM2GC.js} +37 -23
- package/dist/chunk-EPQJM2GC.js.map +1 -0
- package/dist/{chunk-POMSFKTB.js → chunk-F5VP6YCB.js} +368 -10
- package/dist/chunk-F5VP6YCB.js.map +1 -0
- package/dist/{chunk-6ZH4TU6I.js → chunk-FAAFWE4G.js} +2 -1
- package/dist/chunk-FAAFWE4G.js.map +1 -0
- package/dist/{chunk-74JR4N5J.js → chunk-FVA6TGI3.js} +2 -2
- package/dist/chunk-GDFS42HT.js +206 -0
- package/dist/chunk-GDFS42HT.js.map +1 -0
- package/dist/{chunk-BKQJBXXX.js → chunk-GGD5W7TB.js} +2 -2
- package/dist/chunk-GGD5W7TB.js.map +1 -0
- package/dist/{chunk-V7XCAHIB.js → chunk-GKFXUTJ2.js} +508 -26
- package/dist/chunk-GKFXUTJ2.js.map +1 -0
- package/dist/{chunk-NSB3WSYS.js → chunk-HK3FGIEW.js} +278 -3
- package/dist/chunk-HK3FGIEW.js.map +1 -0
- package/dist/{chunk-AAI7JARD.js → chunk-HMDCOMYU.js} +8 -11
- package/dist/chunk-HMDCOMYU.js.map +1 -0
- package/dist/chunk-IISBCCWR.js +52 -0
- package/dist/chunk-IISBCCWR.js.map +1 -0
- package/dist/{chunk-YFYL2SIJ.js → chunk-INXV5JBT.js} +290 -46
- package/dist/chunk-INXV5JBT.js.map +1 -0
- package/dist/chunk-JBMSGZEQ.js +441 -0
- package/dist/chunk-JBMSGZEQ.js.map +1 -0
- package/dist/{chunk-UPMD5XND.js → chunk-JL2PU6AI.js} +16 -5
- package/dist/chunk-JL2PU6AI.js.map +1 -0
- package/dist/{chunk-J4IYOZZ5.js → chunk-JXS5PDQ7.js} +3 -1
- package/dist/chunk-JXS5PDQ7.js.map +1 -0
- package/dist/{chunk-AYPYCLR7.js → chunk-KUB6JU6H.js} +4 -4
- package/dist/chunk-KVBLZUKV.js +173 -0
- package/dist/chunk-KVBLZUKV.js.map +1 -0
- package/dist/chunk-LBLXEFWK.js +51 -0
- package/dist/chunk-LBLXEFWK.js.map +1 -0
- package/dist/{chunk-U2IQTSBY.js → chunk-LTCGGW2D.js} +1 -1
- package/dist/chunk-LTCGGW2D.js.map +1 -0
- package/dist/{chunk-UEYA6UC7.js → chunk-NZLQTHS5.js} +25 -2
- package/dist/chunk-NZLQTHS5.js.map +1 -0
- package/dist/chunk-PVGDJXVK.js +21 -0
- package/dist/chunk-PVGDJXVK.js.map +1 -0
- package/dist/chunk-PVPWZSSI.js +37 -0
- package/dist/chunk-PVPWZSSI.js.map +1 -0
- package/dist/{chunk-4NRAJUDS.js → chunk-RBBWYEFJ.js} +1 -1
- package/dist/chunk-RFYAYKTD.js +146 -0
- package/dist/chunk-RFYAYKTD.js.map +1 -0
- package/dist/{chunk-JROGC36Y.js → chunk-RGLL5SPU.js} +2 -2
- package/dist/{chunk-2VFW5K5U.js → chunk-S3EEFKNY.js} +103 -65
- package/dist/chunk-S3EEFKNY.js.map +1 -0
- package/dist/chunk-SOBJ6NEY.js +18 -0
- package/dist/chunk-SOBJ6NEY.js.map +1 -0
- package/dist/{chunk-MYQWXITD.js → chunk-SPI27QT6.js} +2 -2
- package/dist/chunk-TVVEYCNW.js +65 -0
- package/dist/chunk-TVVEYCNW.js.map +1 -0
- package/dist/chunk-ULYOGL6R.js +322 -0
- package/dist/chunk-ULYOGL6R.js.map +1 -0
- package/dist/{chunk-S4LX5EBI.js → chunk-VBVG2M5G.js} +64 -10
- package/dist/chunk-VBVG2M5G.js.map +1 -0
- package/dist/{chunk-KWP7T3DP.js → chunk-VDX363PS.js} +2 -2
- package/dist/{chunk-XMGSSBFX.js → chunk-VYM3VWOF.js} +1560 -244
- package/dist/chunk-VYM3VWOF.js.map +1 -0
- package/dist/{chunk-MTLYEMJB.js → chunk-WCLICCGB.js} +18 -3
- package/dist/chunk-WCLICCGB.js.map +1 -0
- package/dist/{chunk-ECKDIK5F.js → chunk-WVVA7F5A.js} +2 -2
- package/dist/chunk-X6GF3FX2.js +26 -0
- package/dist/chunk-X6GF3FX2.js.map +1 -0
- package/dist/{chunk-3QFQGRHO.js → chunk-XMHBH5H6.js} +4 -4
- package/dist/{chunk-KEG4GNGI.js → chunk-XZ2TIKGC.js} +38 -8
- package/dist/chunk-XZ2TIKGC.js.map +1 -0
- package/dist/chunk-Y4FHOFJ2.js +140 -0
- package/dist/chunk-Y4FHOFJ2.js.map +1 -0
- package/dist/chunk-YNB73F22.js +137 -0
- package/dist/chunk-YNB73F22.js.map +1 -0
- package/dist/{chunk-7PA4OZEU.js → chunk-YNQKWQT4.js} +55 -30
- package/dist/chunk-YNQKWQT4.js.map +1 -0
- package/dist/chunk-ZAIM4TUE.js +488 -0
- package/dist/chunk-ZAIM4TUE.js.map +1 -0
- package/dist/{chunk-BTY5RRRF.js → chunk-ZEM3OK2K.js} +5 -5
- package/dist/chunk-ZZTOURJI.js +91 -0
- package/dist/chunk-ZZTOURJI.js.map +1 -0
- package/dist/{cli-DwIBnp2g.d.ts → cli-BkeRaYfk.d.ts} +2 -2
- package/dist/cli.d.ts +13 -5
- package/dist/cli.js +45 -33
- package/dist/config.js +1 -1
- package/dist/consolidation-operator.d.ts +41 -0
- package/dist/consolidation-operator.js +11 -0
- package/dist/consolidation-operator.js.map +1 -0
- package/dist/consolidation-provenance-check.d.ts +68 -0
- package/dist/consolidation-provenance-check.js +9 -0
- package/dist/consolidation-provenance-check.js.map +1 -0
- package/dist/consolidation-undo.d.ts +123 -0
- package/dist/consolidation-undo.js +426 -0
- package/dist/consolidation-undo.js.map +1 -0
- package/dist/contradiction-review-WIUBAR52.js +21 -0
- package/dist/contradiction-review-WIUBAR52.js.map +1 -0
- package/dist/contradiction-scan-E3GJTI4F.js +412 -0
- package/dist/contradiction-scan-E3GJTI4F.js.map +1 -0
- package/dist/cross-namespace-budget.d.ts +133 -0
- package/dist/cross-namespace-budget.js +9 -0
- package/dist/cross-namespace-budget.js.map +1 -0
- package/dist/direct-answer-wiring.d.ts +77 -0
- package/dist/direct-answer-wiring.js +10 -0
- package/dist/direct-answer-wiring.js.map +1 -0
- package/dist/direct-answer.d.ts +106 -0
- package/dist/direct-answer.js +10 -0
- package/dist/direct-answer.js.map +1 -0
- package/dist/{engine-X7X3AAG3.js → engine-F3GOXGE5.js} +7 -6
- package/dist/engine-F3GOXGE5.js.map +1 -0
- package/dist/entity-retrieval.d.ts +1 -0
- package/dist/entity-retrieval.js +6 -5
- package/dist/explicit-capture.d.ts +6 -3
- package/dist/explicit-capture.js +2 -2
- package/dist/extraction-judge-telemetry.d.ts +113 -0
- package/dist/extraction-judge-telemetry.js +14 -0
- package/dist/extraction-judge-telemetry.js.map +1 -0
- package/dist/extraction-judge-training.d.ts +85 -0
- package/dist/extraction-judge-training.js +16 -0
- package/dist/extraction-judge-training.js.map +1 -0
- package/dist/extraction-judge.d.ts +124 -2
- package/dist/extraction-judge.js +11 -1
- package/dist/extraction.js +7 -6
- package/dist/fallback-llm.d.ts +11 -2
- package/dist/fallback-llm.js +2 -2
- package/dist/graph-recall.d.ts +100 -0
- package/dist/graph-recall.js +8 -0
- package/dist/graph-recall.js.map +1 -0
- package/dist/graph-retrieval.d.ts +271 -0
- package/dist/graph-retrieval.js +21 -0
- package/dist/graph-retrieval.js.map +1 -0
- package/dist/harmonic-retrieval.js +2 -1
- package/dist/importance.js +1 -1
- package/dist/index.d.ts +589 -138
- package/dist/index.js +531 -403
- package/dist/index.js.map +1 -1
- package/dist/intent.js +1 -1
- package/dist/local-llm.d.ts +10 -3
- package/dist/local-llm.js +1 -1
- package/dist/memory-worth-bench.d.ts +51 -0
- package/dist/memory-worth-bench.js +131 -0
- package/dist/memory-worth-bench.js.map +1 -0
- package/dist/memory-worth-filter.d.ts +128 -0
- package/dist/memory-worth-filter.js +10 -0
- package/dist/memory-worth-filter.js.map +1 -0
- package/dist/memory-worth-outcomes.d.ts +118 -0
- package/dist/memory-worth-outcomes.js +9 -0
- package/dist/memory-worth-outcomes.js.map +1 -0
- package/dist/memory-worth.d.ts +102 -0
- package/dist/memory-worth.js +7 -0
- package/dist/memory-worth.js.map +1 -0
- package/dist/operator-toolkit.d.ts +40 -1
- package/dist/operator-toolkit.js +24 -14
- package/dist/{orchestrator-B9kwlCep.d.ts → orchestrator-CmJ-NTdJ.d.ts} +254 -10
- package/dist/orchestrator.d.ts +6 -3
- package/dist/orchestrator.js +59 -48
- package/dist/page-versioning.d.ts +12 -1
- package/dist/page-versioning.js +5 -3
- package/dist/{port-C1GZFv8h.d.ts → port-BADbLZU5.d.ts} +2 -2
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +5 -3
- package/dist/qmd.js +2 -1
- package/dist/reasoning-trace-recall.d.ts +90 -0
- package/dist/reasoning-trace-recall.js +13 -0
- package/dist/reasoning-trace-recall.js.map +1 -0
- package/dist/reasoning-trace-types.d.ts +54 -0
- package/dist/reasoning-trace-types.js +17 -0
- package/dist/reasoning-trace-types.js.map +1 -0
- package/dist/recall-audit-anomaly.d.ts +112 -0
- package/dist/recall-audit-anomaly.js +11 -0
- package/dist/recall-audit-anomaly.js.map +1 -0
- package/dist/recall-audit.js +5 -44
- package/dist/recall-audit.js.map +1 -1
- package/dist/recall-explain-renderer.d.ts +49 -0
- package/dist/recall-explain-renderer.js +18 -0
- package/dist/recall-explain-renderer.js.map +1 -0
- package/dist/recall-state.d.ts +39 -1
- package/dist/recall-state.js +1 -1
- package/dist/recall-xray-cli.d.ts +40 -0
- package/dist/recall-xray-cli.js +11 -0
- package/dist/recall-xray-cli.js.map +1 -0
- package/dist/recall-xray-renderer.d.ts +44 -0
- package/dist/recall-xray-renderer.js +18 -0
- package/dist/recall-xray-renderer.js.map +1 -0
- package/dist/recall-xray.d.ts +179 -0
- package/dist/recall-xray.js +13 -0
- package/dist/recall-xray.js.map +1 -0
- package/dist/resolution-QBTDHTG7.js +100 -0
- package/dist/resolution-QBTDHTG7.js.map +1 -0
- package/dist/resolve-provider-secret.d.ts +24 -1
- package/dist/resolve-provider-secret.js +3 -1
- package/dist/resume-bundles.js +6 -6
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +17 -0
- package/dist/retrieval-tiers.js +9 -0
- package/dist/retrieval-tiers.js.map +1 -0
- package/dist/schemas.d.ts +301 -45
- package/dist/schemas.js +1 -1
- package/dist/{semantic-consolidation-DrvSYRdB.d.ts → semantic-consolidation-CxJU6MJk.d.ts} +62 -1
- package/dist/semantic-consolidation.d.ts +2 -1
- package/dist/semantic-consolidation.js +20 -6
- package/dist/semantic-rule-promotion.js +6 -5
- package/dist/semantic-rule-verifier.js +6 -5
- package/dist/storage.d.ts +82 -1
- package/dist/storage.js +5 -4
- package/dist/summarizer.js +4 -4
- package/dist/temporal-supersession.d.ts +1 -0
- package/dist/tier-migration.d.ts +2 -1
- package/dist/types-DJhqDJUV.d.ts +50 -0
- package/dist/types.d.ts +309 -3
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +6 -5
- package/package.json +1 -1
- package/dist/chunk-2VFW5K5U.js.map +0 -1
- package/dist/chunk-6ZH4TU6I.js.map +0 -1
- package/dist/chunk-7PA4OZEU.js.map +0 -1
- package/dist/chunk-AAI7JARD.js.map +0 -1
- package/dist/chunk-BKQJBXXX.js.map +0 -1
- package/dist/chunk-HITJFT7E.js.map +0 -1
- package/dist/chunk-J4IYOZZ5.js.map +0 -1
- package/dist/chunk-KEG4GNGI.js.map +0 -1
- package/dist/chunk-LAYN4LDC.js +0 -267
- package/dist/chunk-LAYN4LDC.js.map +0 -1
- package/dist/chunk-MTLYEMJB.js.map +0 -1
- package/dist/chunk-NSB3WSYS.js.map +0 -1
- package/dist/chunk-OJFGVJS6.js.map +0 -1
- package/dist/chunk-PAORGQRI.js.map +0 -1
- package/dist/chunk-PMB3WGDL.js.map +0 -1
- package/dist/chunk-POMSFKTB.js.map +0 -1
- package/dist/chunk-QDYXG4CS.js.map +0 -1
- package/dist/chunk-QKAH5B6E.js.map +0 -1
- package/dist/chunk-QNJMBKFK.js.map +0 -1
- package/dist/chunk-S4LX5EBI.js.map +0 -1
- package/dist/chunk-U2IQTSBY.js.map +0 -1
- package/dist/chunk-UEYA6UC7.js.map +0 -1
- package/dist/chunk-UPMD5XND.js.map +0 -1
- package/dist/chunk-UVJFDP7P.js +0 -202
- package/dist/chunk-UVJFDP7P.js.map +0 -1
- package/dist/chunk-V7XCAHIB.js.map +0 -1
- package/dist/chunk-X4WESCKA.js.map +0 -1
- package/dist/chunk-XMGSSBFX.js.map +0 -1
- package/dist/chunk-YFYL2SIJ.js.map +0 -1
- /package/dist/{engine-X7X3AAG3.js.map → abort-error.js.map} +0 -0
- /package/dist/{chunk-POBPGDWI.js.map → chunk-3OGMS3PE.js.map} +0 -0
- /package/dist/{chunk-GJQPH5G3.js.map → chunk-CUPFXL3J.js.map} +0 -0
- /package/dist/{chunk-74JR4N5J.js.map → chunk-FVA6TGI3.js.map} +0 -0
- /package/dist/{chunk-AYPYCLR7.js.map → chunk-KUB6JU6H.js.map} +0 -0
- /package/dist/{chunk-4NRAJUDS.js.map → chunk-RBBWYEFJ.js.map} +0 -0
- /package/dist/{chunk-JROGC36Y.js.map → chunk-RGLL5SPU.js.map} +0 -0
- /package/dist/{chunk-MYQWXITD.js.map → chunk-SPI27QT6.js.map} +0 -0
- /package/dist/{chunk-KWP7T3DP.js.map → chunk-VDX363PS.js.map} +0 -0
- /package/dist/{chunk-ECKDIK5F.js.map → chunk-WVVA7F5A.js.map} +0 -0
- /package/dist/{chunk-3QFQGRHO.js.map → chunk-XMHBH5H6.js.map} +0 -0
- /package/dist/{chunk-BTY5RRRF.js.map → chunk-ZEM3OK2K.js.map} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { MemoryFile, PluginConfig } from './types.js';
|
|
2
|
+
import { TrustZoneName } from './trust-zones.js';
|
|
3
|
+
import { T as Taxonomy } from './types-DJhqDJUV.js';
|
|
4
|
+
import { DirectAnswerResult } from './direct-answer.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Direct-answer wiring (issue #518 slice 3).
|
|
8
|
+
*
|
|
9
|
+
* Binds the pure eligibility decision (`direct-answer.ts`) to the data
|
|
10
|
+
* sources needed to build candidates: storage, trust-zones, taxonomy,
|
|
11
|
+
* and importance scoring. Kept as a separate module so that:
|
|
12
|
+
*
|
|
13
|
+
* - The eligibility layer stays pure and unit-testable without stores.
|
|
14
|
+
* - Each caller injects its own source accessors. The orchestrator
|
|
15
|
+
* binding is a follow-on slice; tests here use mock sources.
|
|
16
|
+
* - The wiring is safe to ship alone — nothing calls `tryDirectAnswer`
|
|
17
|
+
* yet, so enabling this module's presence does not change recall
|
|
18
|
+
* behavior. The next slice adds exactly one call site before QMD.
|
|
19
|
+
*
|
|
20
|
+
* Short-circuit contract:
|
|
21
|
+
*
|
|
22
|
+
* - When `config.recallDirectAnswerEnabled === false`, the function
|
|
23
|
+
* returns the eligibility verdict with reason `"disabled"` without
|
|
24
|
+
* touching any source accessor. This is the documented default.
|
|
25
|
+
* - When enabled, the wiring cheaply drops non-trusted-zone memories
|
|
26
|
+
* and ineligible taxonomy buckets before computing importance, so
|
|
27
|
+
* the eligibility module sees a pre-filtered candidate set. The
|
|
28
|
+
* eligibility module still performs the same checks itself — this
|
|
29
|
+
* module is purely an I/O and prefiltering layer.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Caller-provided accessors for candidate sourcing. Decouples the
|
|
34
|
+
* wiring from any specific storage / trust-zone / importance backend.
|
|
35
|
+
*/
|
|
36
|
+
interface DirectAnswerSources {
|
|
37
|
+
/**
|
|
38
|
+
* List memories eligible to be considered for direct-answer.
|
|
39
|
+
* Callers are expected to return only active, non-superseded memories
|
|
40
|
+
* in the requested namespace; the wiring will cheaply re-filter on
|
|
41
|
+
* trust zone and taxonomy bucket and hand the rest to the eligibility
|
|
42
|
+
* module, which applies the full gate ladder.
|
|
43
|
+
*/
|
|
44
|
+
listCandidateMemories(options: {
|
|
45
|
+
namespace: string;
|
|
46
|
+
abortSignal?: AbortSignal;
|
|
47
|
+
}): Promise<MemoryFile[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the trust-zone record for a memory. Returns `null` when
|
|
50
|
+
* the memory has no trust-zone record (treated as not trusted).
|
|
51
|
+
*/
|
|
52
|
+
trustZoneFor(memoryId: string): Promise<TrustZoneName | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve a calibrated importance score in [0, 1] for a memory.
|
|
55
|
+
*/
|
|
56
|
+
importanceFor(memory: MemoryFile): number;
|
|
57
|
+
/**
|
|
58
|
+
* Taxonomy used to classify memories into direct-answer buckets.
|
|
59
|
+
*/
|
|
60
|
+
taxonomy: Taxonomy;
|
|
61
|
+
}
|
|
62
|
+
interface DirectAnswerWiringInput {
|
|
63
|
+
query: string;
|
|
64
|
+
namespace: string;
|
|
65
|
+
config: Pick<PluginConfig, "recallDirectAnswerEnabled" | "recallDirectAnswerTokenOverlapFloor" | "recallDirectAnswerImportanceFloor" | "recallDirectAnswerAmbiguityMargin" | "recallDirectAnswerEligibleTaxonomyBuckets">;
|
|
66
|
+
sources: DirectAnswerSources;
|
|
67
|
+
queryEntityRefs?: string[];
|
|
68
|
+
abortSignal?: AbortSignal;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Attempt direct-answer resolution. Returns the eligibility verdict
|
|
72
|
+
* produced by `isDirectAnswerEligible` with candidates materialized
|
|
73
|
+
* from the caller-supplied sources.
|
|
74
|
+
*/
|
|
75
|
+
declare function tryDirectAnswer(input: DirectAnswerWiringInput): Promise<DirectAnswerResult>;
|
|
76
|
+
|
|
77
|
+
export { type DirectAnswerSources, type DirectAnswerWiringInput, tryDirectAnswer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { MemoryFile } from './types.js';
|
|
2
|
+
import { TrustZoneName } from './trust-zones.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Direct-answer retrieval tier eligibility (issue #518 slice 2).
|
|
6
|
+
*
|
|
7
|
+
* This module is a pure decision layer. It takes a query, a set of
|
|
8
|
+
* caller-resolved candidates (each already decorated with trust-zone,
|
|
9
|
+
* taxonomy-bucket, and importance information), and the direct-answer
|
|
10
|
+
* config, then returns an eligibility verdict.
|
|
11
|
+
*
|
|
12
|
+
* Keeping the module pure means:
|
|
13
|
+
*
|
|
14
|
+
* - Tests do not need a trust-zones store, taxonomy resolver, or importance
|
|
15
|
+
* scorer on disk.
|
|
16
|
+
* - Slice 3 (retrieval.ts wiring) is responsible for resolving those signals
|
|
17
|
+
* before calling in; the wiring layer decides where candidates come from
|
|
18
|
+
* (entity index, token prefilter, etc.). This module only decides
|
|
19
|
+
* whether the surfaced candidates add up to a confident direct answer.
|
|
20
|
+
*
|
|
21
|
+
* Not wired into retrieval yet — see slice 3.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Caller-supplied candidate.
|
|
26
|
+
*
|
|
27
|
+
* `trustZone`, `taxonomyBucket`, and `importanceScore` are resolved outside
|
|
28
|
+
* this module because each comes from a different subsystem. Passing them
|
|
29
|
+
* as inputs keeps the function deterministic and easy to unit-test.
|
|
30
|
+
*
|
|
31
|
+
* `matchScore` is optional; if omitted, candidates are ranked by
|
|
32
|
+
* token-overlap ratio. Callers that already computed a better ranking
|
|
33
|
+
* score (e.g. BM25, vector similarity) can supply it to drive the
|
|
34
|
+
* ambiguity check.
|
|
35
|
+
*/
|
|
36
|
+
interface DirectAnswerCandidate {
|
|
37
|
+
memory: MemoryFile;
|
|
38
|
+
trustZone: TrustZoneName | null;
|
|
39
|
+
taxonomyBucket: string | null;
|
|
40
|
+
importanceScore: number;
|
|
41
|
+
matchScore?: number;
|
|
42
|
+
}
|
|
43
|
+
interface DirectAnswerConfig {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
tokenOverlapFloor: number;
|
|
46
|
+
importanceFloor: number;
|
|
47
|
+
ambiguityMargin: number;
|
|
48
|
+
eligibleTaxonomyBuckets: string[];
|
|
49
|
+
}
|
|
50
|
+
interface DirectAnswerInput {
|
|
51
|
+
query: string;
|
|
52
|
+
candidates: DirectAnswerCandidate[];
|
|
53
|
+
config: DirectAnswerConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Optional entity-ref hints resolved from the query upstream. When
|
|
56
|
+
* supplied, a candidate with a set `entityRef` must match one of these
|
|
57
|
+
* (case-insensitive) to remain eligible. Candidates without an
|
|
58
|
+
* `entityRef` are allowed through regardless.
|
|
59
|
+
*/
|
|
60
|
+
queryEntityRefs?: string[];
|
|
61
|
+
}
|
|
62
|
+
type DirectAnswerReason = "disabled" | "empty-query" | "no-candidates" | "no-eligible-candidates" | "below-token-overlap-floor" | "ambiguous" | "eligible";
|
|
63
|
+
interface DirectAnswerResult {
|
|
64
|
+
eligible: boolean;
|
|
65
|
+
reason: DirectAnswerReason;
|
|
66
|
+
/** Winning candidate when eligible. */
|
|
67
|
+
winner?: DirectAnswerCandidate;
|
|
68
|
+
/** Computed token-overlap ratio (0..1) of the winner. */
|
|
69
|
+
tokenOverlap?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Human-readable summary suitable for
|
|
72
|
+
* `RecallTierExplain.tierReason`.
|
|
73
|
+
*/
|
|
74
|
+
narrative: string;
|
|
75
|
+
/**
|
|
76
|
+
* Filter labels that eliminated at least one candidate along the way.
|
|
77
|
+
* Populated regardless of eligibility so the caller can surface the
|
|
78
|
+
* narrowing steps in `RecallTierExplain.filteredBy`.
|
|
79
|
+
*/
|
|
80
|
+
filteredBy: string[];
|
|
81
|
+
}
|
|
82
|
+
/** Filter labels — exported so callers and tests can match them structurally. */
|
|
83
|
+
declare const FILTER_LABELS: {
|
|
84
|
+
readonly nonActiveStatus: "non-active-status";
|
|
85
|
+
readonly notTrustedZone: "not-trusted-zone";
|
|
86
|
+
readonly ineligibleTaxonomyBucket: "ineligible-taxonomy-bucket";
|
|
87
|
+
readonly belowImportanceFloor: "below-importance-floor";
|
|
88
|
+
readonly entityRefMismatch: "entity-ref-mismatch";
|
|
89
|
+
readonly belowTokenOverlapFloor: "below-token-overlap-floor";
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Determine whether a query can be served by the direct-answer tier.
|
|
93
|
+
*
|
|
94
|
+
* Decision ladder, in order:
|
|
95
|
+
*
|
|
96
|
+
* 1. config.enabled === false → "disabled"
|
|
97
|
+
* 2. empty query tokens → "empty-query"
|
|
98
|
+
* 3. empty candidates → "no-candidates"
|
|
99
|
+
* 4. hard filters drop all candidates → "no-eligible-candidates"
|
|
100
|
+
* 5. token-overlap floor drops all → "below-token-overlap-floor"
|
|
101
|
+
* 6. top two candidates within ambiguityMargin → "ambiguous"
|
|
102
|
+
* 7. otherwise → "eligible"
|
|
103
|
+
*/
|
|
104
|
+
declare function isDirectAnswerEligible(input: DirectAnswerInput): DirectAnswerResult;
|
|
105
|
+
|
|
106
|
+
export { type DirectAnswerCandidate, type DirectAnswerConfig, type DirectAnswerInput, type DirectAnswerReason, type DirectAnswerResult, FILTER_LABELS, isDirectAnswerEligible };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CompoundingEngine,
|
|
3
3
|
defaultTierMigrationCycleBudget
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-RGLL5SPU.js";
|
|
5
|
+
import "./chunk-F5VP6YCB.js";
|
|
6
|
+
import "./chunk-LTCGGW2D.js";
|
|
7
7
|
import "./chunk-4KAN3GZ3.js";
|
|
8
|
-
import "./chunk-6ZH4TU6I.js";
|
|
9
8
|
import "./chunk-6PFRXT4K.js";
|
|
10
9
|
import "./chunk-TP4FZJIZ.js";
|
|
11
10
|
import "./chunk-SCU65EZI.js";
|
|
12
11
|
import "./chunk-BOUYNNYD.js";
|
|
13
|
-
import "./chunk-QSVPYQPG.js";
|
|
14
12
|
import "./chunk-DM2T26WE.js";
|
|
13
|
+
import "./chunk-QSVPYQPG.js";
|
|
15
14
|
import "./chunk-M62O4P4T.js";
|
|
16
15
|
import "./chunk-4DJQYKMN.js";
|
|
16
|
+
import "./chunk-X6GF3FX2.js";
|
|
17
|
+
import "./chunk-FAAFWE4G.js";
|
|
17
18
|
import "./chunk-2ODBA7MQ.js";
|
|
18
19
|
export {
|
|
19
20
|
CompoundingEngine,
|
|
20
21
|
defaultTierMigrationCycleBudget
|
|
21
22
|
};
|
|
22
|
-
//# sourceMappingURL=engine-
|
|
23
|
+
//# sourceMappingURL=engine-F3GOXGE5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/entity-retrieval.js
CHANGED
|
@@ -3,20 +3,21 @@ import {
|
|
|
3
3
|
entityIndexVersion,
|
|
4
4
|
entityRecentTranscriptLookbackHours,
|
|
5
5
|
readRecentEntityTranscriptEntries
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FVA6TGI3.js";
|
|
7
7
|
import "./chunk-7SEAZFFB.js";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-F5VP6YCB.js";
|
|
9
|
+
import "./chunk-LTCGGW2D.js";
|
|
10
10
|
import "./chunk-4KAN3GZ3.js";
|
|
11
|
-
import "./chunk-6ZH4TU6I.js";
|
|
12
11
|
import "./chunk-6PFRXT4K.js";
|
|
13
12
|
import "./chunk-TP4FZJIZ.js";
|
|
14
13
|
import "./chunk-SCU65EZI.js";
|
|
15
14
|
import "./chunk-BOUYNNYD.js";
|
|
16
|
-
import "./chunk-QSVPYQPG.js";
|
|
17
15
|
import "./chunk-DM2T26WE.js";
|
|
16
|
+
import "./chunk-QSVPYQPG.js";
|
|
18
17
|
import "./chunk-M62O4P4T.js";
|
|
19
18
|
import "./chunk-4DJQYKMN.js";
|
|
19
|
+
import "./chunk-X6GF3FX2.js";
|
|
20
|
+
import "./chunk-FAAFWE4G.js";
|
|
20
21
|
import "./chunk-2ODBA7MQ.js";
|
|
21
22
|
export {
|
|
22
23
|
buildEntityRecallSection,
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import { O as Orchestrator } from './orchestrator-
|
|
1
|
+
import { O as Orchestrator } from './orchestrator-CmJ-NTdJ.js';
|
|
2
2
|
import { MemoryCategory, PluginConfig } from './types.js';
|
|
3
3
|
import './buffer.js';
|
|
4
4
|
import './storage.js';
|
|
5
5
|
import './page-versioning.js';
|
|
6
|
+
import './consolidation-operator.js';
|
|
6
7
|
import './memory-projection-store-DeSXPh1j.js';
|
|
7
8
|
import 'better-sqlite3';
|
|
8
|
-
import './port-
|
|
9
|
+
import './port-BADbLZU5.js';
|
|
9
10
|
import './transcript.js';
|
|
10
11
|
import './session-integrity.js';
|
|
11
12
|
import './summarizer.js';
|
|
12
13
|
import './model-registry.js';
|
|
13
14
|
import './local-llm.js';
|
|
15
|
+
import './fallback-llm.js';
|
|
14
16
|
import './relevance.js';
|
|
15
17
|
import './negative.js';
|
|
16
18
|
import './recall-state.js';
|
|
19
|
+
import './recall-xray.js';
|
|
17
20
|
import './session-observer-state.js';
|
|
18
21
|
import './embedding-fallback.js';
|
|
19
|
-
import './semantic-consolidation-
|
|
22
|
+
import './semantic-consolidation-CxJU6MJk.js';
|
|
20
23
|
import './codex-materialize-CQlLTzke.js';
|
|
21
24
|
import './logger.js';
|
|
22
25
|
import 'zod';
|
package/dist/explicit-capture.js
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
shouldSkipImplicitExtraction,
|
|
8
8
|
stripInlineExplicitCaptureNotes,
|
|
9
9
|
validateExplicitCaptureInput
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-3FPTCC3Z.js";
|
|
11
|
+
import "./chunk-2LGMW3DJ.js";
|
|
12
12
|
import "./chunk-M62O4P4T.js";
|
|
13
13
|
export {
|
|
14
14
|
hasInlineExplicitCaptureMarkup,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { JudgeVerdictKind } from './extraction-judge.js';
|
|
2
|
+
import './types.js';
|
|
3
|
+
import './local-llm.js';
|
|
4
|
+
import './model-registry.js';
|
|
5
|
+
import './fallback-llm.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Extraction Judge Telemetry (issue #562, PR 3).
|
|
9
|
+
*
|
|
10
|
+
* Appends one structured event per judge verdict to the observation ledger
|
|
11
|
+
* under a dedicated JSONL file. The ledger is the same directory used by
|
|
12
|
+
* the turn-count observation writer
|
|
13
|
+
* (`state/observation-ledger/rebuilt-observations.jsonl`) but judge events
|
|
14
|
+
* live in their own file so aggregation stays cheap and schemas do not
|
|
15
|
+
* collide.
|
|
16
|
+
*
|
|
17
|
+
* Emit path is best-effort and fail-open: a telemetry write must never
|
|
18
|
+
* block an extraction run.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Observation-ledger category for judge verdict events. Callers that
|
|
23
|
+
* aggregate across event kinds can filter on this constant.
|
|
24
|
+
*/
|
|
25
|
+
declare const EXTRACTION_JUDGE_VERDICT_CATEGORY = "EXTRACTION_JUDGE_VERDICT";
|
|
26
|
+
/**
|
|
27
|
+
* Structured event written for every judge verdict (including verdicts
|
|
28
|
+
* served from cache). The `version` field lets future readers upgrade the
|
|
29
|
+
* schema without breaking older rows.
|
|
30
|
+
*/
|
|
31
|
+
interface JudgeVerdictEvent {
|
|
32
|
+
version: 1;
|
|
33
|
+
category: typeof EXTRACTION_JUDGE_VERDICT_CATEGORY;
|
|
34
|
+
ts: string;
|
|
35
|
+
verdictKind: JudgeVerdictKind;
|
|
36
|
+
/** Short free-text reason from the judge / deterministic fallback. */
|
|
37
|
+
reason: string;
|
|
38
|
+
/**
|
|
39
|
+
* How many times this candidate's content hash had already been deferred
|
|
40
|
+
* before this verdict. 0 for the first defer, 1 for the second, etc.
|
|
41
|
+
* Not applicable for non-defer kinds — emitted as 0.
|
|
42
|
+
*/
|
|
43
|
+
deferrals: number;
|
|
44
|
+
/**
|
|
45
|
+
* Milliseconds between batch start and batch return (the whole
|
|
46
|
+
* `judgeFactDurability` call, shared across all verdicts in a single
|
|
47
|
+
* batch).
|
|
48
|
+
*/
|
|
49
|
+
elapsedMs: number;
|
|
50
|
+
/** Candidate metadata for coarse filtering. */
|
|
51
|
+
candidateCategory: string;
|
|
52
|
+
confidence?: number;
|
|
53
|
+
/** SHA-256 of the (text\0category) pair, same as the verdict-cache key. */
|
|
54
|
+
contentHash: string;
|
|
55
|
+
/** Whether the verdict came from the in-memory verdict cache. */
|
|
56
|
+
fromCache: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* True when the judge forcibly converted a defer to reject because the
|
|
59
|
+
* defer cap was reached. Only set on cap-triggered rejects.
|
|
60
|
+
*/
|
|
61
|
+
deferCapTriggered?: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options to control emit behavior. `enabled` gates all writes; when
|
|
65
|
+
* false, `recordJudgeVerdict` is a no-op so callers can unconditionally
|
|
66
|
+
* invoke it.
|
|
67
|
+
*/
|
|
68
|
+
interface JudgeTelemetryOptions {
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
memoryDir: string;
|
|
71
|
+
}
|
|
72
|
+
declare function judgeTelemetryPath(memoryDir: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Append a single verdict event as a JSONL row. Fails open — if the write
|
|
75
|
+
* cannot be completed (directory missing, permissions, disk full), the
|
|
76
|
+
* error is logged at debug level and swallowed so extraction never fails
|
|
77
|
+
* because of telemetry.
|
|
78
|
+
*/
|
|
79
|
+
declare function recordJudgeVerdict(event: JudgeVerdictEvent, options: JudgeTelemetryOptions): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Aggregate statistics over the verdict ledger, optionally restricted to a
|
|
82
|
+
* time window. Returns zero-count stats when the ledger is missing or
|
|
83
|
+
* empty — callers do not need to special-case a cold install.
|
|
84
|
+
*/
|
|
85
|
+
interface JudgeVerdictStats {
|
|
86
|
+
total: number;
|
|
87
|
+
accept: number;
|
|
88
|
+
reject: number;
|
|
89
|
+
defer: number;
|
|
90
|
+
deferCapTriggered: number;
|
|
91
|
+
/** Mean elapsed milliseconds across all events in the window. */
|
|
92
|
+
meanElapsedMs: number;
|
|
93
|
+
/** Defer rate as `defer / total`, in `[0, 1]`. `0` when total is 0. */
|
|
94
|
+
deferRate: number;
|
|
95
|
+
/** First and last event timestamps observed in the window. */
|
|
96
|
+
firstTs?: string;
|
|
97
|
+
lastTs?: string;
|
|
98
|
+
/** Number of rows skipped because they were malformed or wrong shape. */
|
|
99
|
+
malformed: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Read and aggregate events from the verdict ledger.
|
|
103
|
+
*
|
|
104
|
+
* `sinceMs` / `untilMs` bound by `ts` parse — events with unparseable
|
|
105
|
+
* timestamps are counted toward `malformed`. The upper bound is exclusive
|
|
106
|
+
* (`ts < untilMs`), per CLAUDE.md gotcha 35.
|
|
107
|
+
*/
|
|
108
|
+
declare function readJudgeVerdictStats(memoryDir: string, opts?: {
|
|
109
|
+
sinceMs?: number;
|
|
110
|
+
untilMs?: number;
|
|
111
|
+
}): Promise<JudgeVerdictStats>;
|
|
112
|
+
|
|
113
|
+
export { EXTRACTION_JUDGE_VERDICT_CATEGORY, type JudgeTelemetryOptions, type JudgeVerdictEvent, type JudgeVerdictStats, judgeTelemetryPath, readJudgeVerdictStats, recordJudgeVerdict };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EXTRACTION_JUDGE_VERDICT_CATEGORY,
|
|
3
|
+
judgeTelemetryPath,
|
|
4
|
+
readJudgeVerdictStats,
|
|
5
|
+
recordJudgeVerdict
|
|
6
|
+
} from "./chunk-AJU4PJGY.js";
|
|
7
|
+
import "./chunk-2ODBA7MQ.js";
|
|
8
|
+
export {
|
|
9
|
+
EXTRACTION_JUDGE_VERDICT_CATEGORY,
|
|
10
|
+
judgeTelemetryPath,
|
|
11
|
+
readJudgeVerdictStats,
|
|
12
|
+
recordJudgeVerdict
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=extraction-judge-telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { JudgeVerdictKind } from './extraction-judge.js';
|
|
2
|
+
import './types.js';
|
|
3
|
+
import './local-llm.js';
|
|
4
|
+
import './model-registry.js';
|
|
5
|
+
import './fallback-llm.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Extraction Judge Training Data Shim (issue #562, PR 4).
|
|
9
|
+
*
|
|
10
|
+
* Opt-in collector for `(candidate_text, verdict_kind, reason,
|
|
11
|
+
* ground_truth_label?)` tuples. Rows are appended to JSONL files under
|
|
12
|
+
* `~/.remnic/judge-training/<YYYY-MM-DD>.jsonl` so operators can ship the
|
|
13
|
+
* data into a future GRPO training pipeline without exfiltrating live
|
|
14
|
+
* memory content through the regular observation ledger.
|
|
15
|
+
*
|
|
16
|
+
* Gating:
|
|
17
|
+
* - Off by default. Must be explicitly enabled via
|
|
18
|
+
* `collectJudgeTrainingPairs: true` in plugin config.
|
|
19
|
+
* - The ground-truth label is always optional — labels are added out-of-
|
|
20
|
+
* band once reviewers disambiguate the candidate's fate.
|
|
21
|
+
*
|
|
22
|
+
* Privacy: the row carries only what the judge already sees — the
|
|
23
|
+
* candidate text and its metadata. It does NOT carry session keys,
|
|
24
|
+
* principal IDs, or any user identifiers. The file lives in the user's
|
|
25
|
+
* home directory rather than the shared memory directory so it is never
|
|
26
|
+
* committed, sync'd, or bundled into exports.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Persisted training row. Intentionally minimal: just the signal needed
|
|
31
|
+
* to train a judge replacement policy. Schema version is tagged so future
|
|
32
|
+
* readers can migrate older rows.
|
|
33
|
+
*/
|
|
34
|
+
interface JudgeTrainingPair {
|
|
35
|
+
version: 1;
|
|
36
|
+
ts: string;
|
|
37
|
+
candidateText: string;
|
|
38
|
+
candidateCategory: string;
|
|
39
|
+
candidateConfidence?: number;
|
|
40
|
+
verdictKind: JudgeVerdictKind;
|
|
41
|
+
reason: string;
|
|
42
|
+
/**
|
|
43
|
+
* Number of prior deferrals when the verdict was resolved. `0` for the
|
|
44
|
+
* first resolution; only set when known (defer pathway).
|
|
45
|
+
*/
|
|
46
|
+
priorDeferrals?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Optional human-applied ground-truth label. Added after the fact by a
|
|
49
|
+
* reviewer / labelling script; not present on fresh rows.
|
|
50
|
+
*/
|
|
51
|
+
groundTruthLabel?: JudgeVerdictKind;
|
|
52
|
+
}
|
|
53
|
+
interface JudgeTrainingOptions {
|
|
54
|
+
enabled: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Override for the output directory. Defaults to
|
|
57
|
+
* `~/.remnic/judge-training`. Tests pass a temp path here.
|
|
58
|
+
*/
|
|
59
|
+
directory?: string;
|
|
60
|
+
}
|
|
61
|
+
declare function resolveTrainingDir(options: JudgeTrainingOptions): string;
|
|
62
|
+
declare function trainingFilePathFor(directory: string, iso: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Append a single training row. Fails open — write errors are logged at
|
|
65
|
+
* debug level and swallowed, same policy as the telemetry emitter.
|
|
66
|
+
* No-op when `options.enabled` is false.
|
|
67
|
+
*/
|
|
68
|
+
declare function recordJudgeTrainingPair(row: JudgeTrainingPair, options: JudgeTrainingOptions): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Read all training rows from the configured directory. Returns an empty
|
|
71
|
+
* array when the directory is missing. Malformed lines are skipped and
|
|
72
|
+
* counted in the returned `malformed` tally.
|
|
73
|
+
*/
|
|
74
|
+
declare function readJudgeTrainingPairs(options: Pick<JudgeTrainingOptions, "directory">): Promise<{
|
|
75
|
+
rows: JudgeTrainingPair[];
|
|
76
|
+
malformed: number;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Structural validator matching the persisted schema. Forward-compat: an
|
|
80
|
+
* unknown `verdictKind` string is treated as malformed (strict training
|
|
81
|
+
* signal — we do not want to admit unlabelled gibberish into a trainer).
|
|
82
|
+
*/
|
|
83
|
+
declare function isValidTrainingPair(value: unknown): value is JudgeTrainingPair;
|
|
84
|
+
|
|
85
|
+
export { type JudgeTrainingOptions, type JudgeTrainingPair, isValidTrainingPair, readJudgeTrainingPairs, recordJudgeTrainingPair, resolveTrainingDir, trainingFilePathFor };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isValidTrainingPair,
|
|
3
|
+
readJudgeTrainingPairs,
|
|
4
|
+
recordJudgeTrainingPair,
|
|
5
|
+
resolveTrainingDir,
|
|
6
|
+
trainingFilePathFor
|
|
7
|
+
} from "./chunk-DF3RVK3X.js";
|
|
8
|
+
import "./chunk-2ODBA7MQ.js";
|
|
9
|
+
export {
|
|
10
|
+
isValidTrainingPair,
|
|
11
|
+
readJudgeTrainingPairs,
|
|
12
|
+
recordJudgeTrainingPair,
|
|
13
|
+
resolveTrainingDir,
|
|
14
|
+
trainingFilePathFor
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=extraction-judge-training.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|