@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,91 @@
|
|
|
1
|
+
// src/reasoning-trace-recall.ts
|
|
2
|
+
function looksLikeProblemSolvingQuery(query) {
|
|
3
|
+
if (typeof query !== "string") return false;
|
|
4
|
+
const q = query.trim().toLowerCase();
|
|
5
|
+
if (q.length === 0) return false;
|
|
6
|
+
const startsWithPatterns = [
|
|
7
|
+
/^how\s+do\s+i\b/,
|
|
8
|
+
/^how\s+can\s+i\b/,
|
|
9
|
+
/^how\s+would\s+i\b/,
|
|
10
|
+
/^how\s+should\s+i\b/,
|
|
11
|
+
/^how\s+to\b/,
|
|
12
|
+
/^what'?s?\s+the\s+best\s+way\s+to\b/,
|
|
13
|
+
/^can\s+you\s+walk\s+me\s+through\b/,
|
|
14
|
+
/^walk\s+me\s+through\b/,
|
|
15
|
+
/^help\s+me\s+debug\b/,
|
|
16
|
+
/^help\s+me\s+figure\s+out\b/,
|
|
17
|
+
/^why\s+(does|is|did)\b/
|
|
18
|
+
];
|
|
19
|
+
for (const re of startsWithPatterns) {
|
|
20
|
+
if (re.test(q)) return true;
|
|
21
|
+
}
|
|
22
|
+
const phrases = [
|
|
23
|
+
"step by step",
|
|
24
|
+
"step-by-step",
|
|
25
|
+
"work through",
|
|
26
|
+
"walk through",
|
|
27
|
+
"walk me through",
|
|
28
|
+
"reason through",
|
|
29
|
+
"think through",
|
|
30
|
+
"figure out",
|
|
31
|
+
"chain of thought",
|
|
32
|
+
"reasoning trace",
|
|
33
|
+
"solution chain",
|
|
34
|
+
"troubleshoot",
|
|
35
|
+
"debug this",
|
|
36
|
+
"debug the",
|
|
37
|
+
" debug "
|
|
38
|
+
];
|
|
39
|
+
for (const phrase of phrases) {
|
|
40
|
+
if (q.includes(phrase)) return true;
|
|
41
|
+
}
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
function isReasoningTracePath(candidatePath) {
|
|
45
|
+
if (typeof candidatePath !== "string") return false;
|
|
46
|
+
return /(^|[\\/])reasoning-traces([\\/]|$)/.test(candidatePath);
|
|
47
|
+
}
|
|
48
|
+
var DEFAULT_REASONING_TRACE_BOOST = 0.15;
|
|
49
|
+
function applyReasoningTraceBoost(results, options) {
|
|
50
|
+
if (!options.enabled) return [...results];
|
|
51
|
+
if (!Array.isArray(results) || results.length === 0) return [...results];
|
|
52
|
+
if (!looksLikeProblemSolvingQuery(options.query)) return [...results];
|
|
53
|
+
const boostAmount = typeof options.boost === "number" && Number.isFinite(options.boost) && options.boost >= 0 ? options.boost : DEFAULT_REASONING_TRACE_BOOST;
|
|
54
|
+
const boosted = [];
|
|
55
|
+
let changed = false;
|
|
56
|
+
for (const r of results) {
|
|
57
|
+
if (isReasoningTracePath(r.path)) {
|
|
58
|
+
changed = true;
|
|
59
|
+
const baseScore = typeof r.score === "number" && Number.isFinite(r.score) ? r.score : 0;
|
|
60
|
+
boosted.push({ ...r, score: baseScore + boostAmount });
|
|
61
|
+
} else {
|
|
62
|
+
boosted.push(r);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (!changed) return boosted;
|
|
66
|
+
const out = boosted.slice();
|
|
67
|
+
for (let i = 0; i < out.length; i++) {
|
|
68
|
+
if (!isReasoningTracePath(out[i].path)) continue;
|
|
69
|
+
const trace = out[i];
|
|
70
|
+
const traceScore = typeof trace.score === "number" && Number.isFinite(trace.score) ? trace.score : 0;
|
|
71
|
+
let j = i;
|
|
72
|
+
while (j > 0) {
|
|
73
|
+
const prev = out[j - 1];
|
|
74
|
+
if (isReasoningTracePath(prev.path)) break;
|
|
75
|
+
const prevScore = typeof prev.score === "number" && Number.isFinite(prev.score) ? prev.score : 0;
|
|
76
|
+
if (prevScore >= traceScore) break;
|
|
77
|
+
out[j] = prev;
|
|
78
|
+
j -= 1;
|
|
79
|
+
}
|
|
80
|
+
if (j !== i) out[j] = trace;
|
|
81
|
+
}
|
|
82
|
+
return out;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export {
|
|
86
|
+
looksLikeProblemSolvingQuery,
|
|
87
|
+
isReasoningTracePath,
|
|
88
|
+
DEFAULT_REASONING_TRACE_BOOST,
|
|
89
|
+
applyReasoningTraceBoost
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=chunk-ZZTOURJI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/reasoning-trace-recall.ts"],"sourcesContent":["/**\n * Reasoning-trace recall boost (issue #564 PR 3).\n *\n * Pure helpers for:\n * - detecting whether a user query looks like a problem-solving ask\n * (\"how do I…\", \"step by step\", etc.)\n * - boosting stored reasoning_trace memories within a result list when that\n * condition matches.\n *\n * Callers gate these helpers behind the `recallReasoningTraceBoostEnabled`\n * config flag (default false); the helpers themselves are also no-ops when\n * `enabled` is false so they can be safely chained into the recall pipeline.\n */\n\n/**\n * Heuristic: does the incoming query read like the user wants a stored\n * solution chain (reasoning trace)?\n *\n * Positive signals:\n * - starts with \"how do I\", \"how can I\", \"how would I\", \"how to\"\n * - contains \"step by step\", \"walk me through\", \"work through\"\n * - contains \"reasoning\", \"think through\", \"figure out\", \"debug\"\n * - explicitly mentions \"trace\" or \"chain of thought\"\n *\n * This is intentionally conservative — the boost is OFF by default, so false\n * negatives are cheap, but false positives would shift retrieval for ordinary\n * queries on an opt-in install.\n */\nexport function looksLikeProblemSolvingQuery(query: string): boolean {\n if (typeof query !== \"string\") return false;\n const q = query.trim().toLowerCase();\n if (q.length === 0) return false;\n\n // Starts-with patterns.\n const startsWithPatterns = [\n /^how\\s+do\\s+i\\b/,\n /^how\\s+can\\s+i\\b/,\n /^how\\s+would\\s+i\\b/,\n /^how\\s+should\\s+i\\b/,\n /^how\\s+to\\b/,\n /^what'?s?\\s+the\\s+best\\s+way\\s+to\\b/,\n /^can\\s+you\\s+walk\\s+me\\s+through\\b/,\n /^walk\\s+me\\s+through\\b/,\n /^help\\s+me\\s+debug\\b/,\n /^help\\s+me\\s+figure\\s+out\\b/,\n /^why\\s+(does|is|did)\\b/,\n ];\n for (const re of startsWithPatterns) {\n if (re.test(q)) return true;\n }\n\n // Anywhere-in-string phrases. These mirror the doc-comment's stated\n // positive signals: broader variants (\"work through\", \"figure out\",\n // \"debug this\") are included so \"how do I debug this\" doesn't have to\n // lean on the `help me debug` starts-with entry alone, and so queries\n // like \"work through the problem\" or \"figure out why it broke\" trigger\n // the heuristic as the docstring claims.\n const phrases = [\n \"step by step\",\n \"step-by-step\",\n \"work through\",\n \"walk through\",\n \"walk me through\",\n \"reason through\",\n \"think through\",\n \"figure out\",\n \"chain of thought\",\n \"reasoning trace\",\n \"solution chain\",\n \"troubleshoot\",\n \"debug this\",\n \"debug the\",\n \" debug \",\n ];\n for (const phrase of phrases) {\n if (q.includes(phrase)) return true;\n }\n\n return false;\n}\n\n/**\n * Minimal shape the boost helper needs to read from a recall result. Matches\n * QmdSearchResult as of issue #564 but kept structural so tests and future\n * callers don't have to import orchestrator-level types.\n */\nexport interface BoostableResult {\n path: string;\n score: number;\n docid?: string;\n}\n\n/**\n * Path-based marker for memories that live in the dedicated\n * reasoning-traces/ subtree. Using a path segment keeps this cheap: no\n * frontmatter parsing or extra I/O is needed.\n */\nexport function isReasoningTracePath(candidatePath: string): boolean {\n if (typeof candidatePath !== \"string\") return false;\n // Match \"/reasoning-traces/\" as a full path segment to avoid false\n // positives like \"my-reasoning-traces-notes/\".\n return /(^|[\\\\/])reasoning-traces([\\\\/]|$)/.test(candidatePath);\n}\n\n/**\n * Default additive boost applied to a reasoning_trace candidate when the\n * current query looks like a problem-solving ask.\n *\n * Chosen to be roughly the same magnitude as the existing CATEGORY_BOOSTS\n * entry for reasoning_trace (0.09 in importance scoring), keeping the signal\n * visible but not overwhelming stronger lexical/vector matches.\n */\nexport const DEFAULT_REASONING_TRACE_BOOST = 0.15;\n\nexport interface ApplyReasoningTraceBoostOptions {\n enabled: boolean;\n query: string;\n boost?: number;\n}\n\n/**\n * Apply a score boost to results whose path sits under reasoning-traces/\n * when the query looks like a problem-solving ask. Returns a new array;\n * the input array is not mutated.\n *\n * Ordering policy: the helper walks the results in order, boosts every\n * matching reasoning trace in place, then promotes each boosted trace\n * upward PAST any non-boosted neighbor whose score is strictly lower\n * than the trace's boosted score. Non-matching results keep their\n * incoming relative order — so reranker-driven path ordering and any\n * other upstream nudges on non-trace items are preserved. We do NOT\n * re-sort the full list, which would wipe out rerank priority on\n * non-trace items (whose numeric scores may have been left stale by the\n * rerank pass). This matters because MMR runs immediately after and\n * truncates to a topN window — globally re-sorting would silently drop\n * reranker-promoted items below the cutoff.\n *\n * No-ops (returns a copy of the input unchanged) when:\n * - `enabled` is false,\n * - `query` is empty / not a problem-solving ask,\n * - the result list contains no reasoning-trace paths.\n *\n * Note on legacy paths: this helper intentionally only matches paths\n * under the dedicated `reasoning-traces/` subtree introduced by PR 3.\n * Historical reasoning_trace memories (if any) written before that\n * subtree existed were routed to `facts/<date>/` and are NOT\n * boost-eligible. Operators upgrading across that boundary should run\n * the migration CLI or rewrite old paths before enabling the boost.\n */\nexport function applyReasoningTraceBoost<R extends BoostableResult>(\n results: readonly R[],\n options: ApplyReasoningTraceBoostOptions,\n): R[] {\n if (!options.enabled) return [...results];\n if (!Array.isArray(results) || results.length === 0) return [...results];\n if (!looksLikeProblemSolvingQuery(options.query)) return [...results];\n\n const boostAmount =\n typeof options.boost === \"number\" && Number.isFinite(options.boost) && options.boost >= 0\n ? options.boost\n : DEFAULT_REASONING_TRACE_BOOST;\n\n // Step 1: boost the scores of matching traces, preserving positions.\n const boosted: R[] = [];\n let changed = false;\n for (const r of results) {\n if (isReasoningTracePath(r.path)) {\n changed = true;\n const baseScore = typeof r.score === \"number\" && Number.isFinite(r.score) ? r.score : 0;\n boosted.push({ ...r, score: baseScore + boostAmount } as R);\n } else {\n boosted.push(r);\n }\n }\n if (!changed) return boosted;\n\n // Step 2: promote each boosted trace upward past any non-trace neighbor\n // whose score is strictly lower than the boosted score. Non-trace items\n // never move past each other, so reranker-driven ordering on non-trace\n // items is preserved.\n const out = boosted.slice();\n for (let i = 0; i < out.length; i++) {\n if (!isReasoningTracePath(out[i].path)) continue;\n const trace = out[i];\n const traceScore =\n typeof trace.score === \"number\" && Number.isFinite(trace.score) ? trace.score : 0;\n let j = i;\n while (j > 0) {\n const prev = out[j - 1];\n if (isReasoningTracePath(prev.path)) break; // don't reorder traces vs each other\n const prevScore =\n typeof prev.score === \"number\" && Number.isFinite(prev.score) ? prev.score : 0;\n if (prevScore >= traceScore) break;\n out[j] = prev;\n j -= 1;\n }\n if (j !== i) out[j] = trace;\n }\n\n return out;\n}\n"],"mappings":";AA4BO,SAAS,6BAA6B,OAAwB;AACnE,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAM,IAAI,MAAM,KAAK,EAAE,YAAY;AACnC,MAAI,EAAE,WAAW,EAAG,QAAO;AAG3B,QAAM,qBAAqB;AAAA,IACzB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,aAAW,MAAM,oBAAoB;AACnC,QAAI,GAAG,KAAK,CAAC,EAAG,QAAO;AAAA,EACzB;AAQA,QAAM,UAAU;AAAA,IACd;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,aAAW,UAAU,SAAS;AAC5B,QAAI,EAAE,SAAS,MAAM,EAAG,QAAO;AAAA,EACjC;AAEA,SAAO;AACT;AAkBO,SAAS,qBAAqB,eAAgC;AACnE,MAAI,OAAO,kBAAkB,SAAU,QAAO;AAG9C,SAAO,qCAAqC,KAAK,aAAa;AAChE;AAUO,IAAM,gCAAgC;AAqCtC,SAAS,yBACd,SACA,SACK;AACL,MAAI,CAAC,QAAQ,QAAS,QAAO,CAAC,GAAG,OAAO;AACxC,MAAI,CAAC,MAAM,QAAQ,OAAO,KAAK,QAAQ,WAAW,EAAG,QAAO,CAAC,GAAG,OAAO;AACvE,MAAI,CAAC,6BAA6B,QAAQ,KAAK,EAAG,QAAO,CAAC,GAAG,OAAO;AAEpE,QAAM,cACJ,OAAO,QAAQ,UAAU,YAAY,OAAO,SAAS,QAAQ,KAAK,KAAK,QAAQ,SAAS,IACpF,QAAQ,QACR;AAGN,QAAM,UAAe,CAAC;AACtB,MAAI,UAAU;AACd,aAAW,KAAK,SAAS;AACvB,QAAI,qBAAqB,EAAE,IAAI,GAAG;AAChC,gBAAU;AACV,YAAM,YAAY,OAAO,EAAE,UAAU,YAAY,OAAO,SAAS,EAAE,KAAK,IAAI,EAAE,QAAQ;AACtF,cAAQ,KAAK,EAAE,GAAG,GAAG,OAAO,YAAY,YAAY,CAAM;AAAA,IAC5D,OAAO;AACL,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AACA,MAAI,CAAC,QAAS,QAAO;AAMrB,QAAM,MAAM,QAAQ,MAAM;AAC1B,WAAS,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AACnC,QAAI,CAAC,qBAAqB,IAAI,CAAC,EAAE,IAAI,EAAG;AACxC,UAAM,QAAQ,IAAI,CAAC;AACnB,UAAM,aACJ,OAAO,MAAM,UAAU,YAAY,OAAO,SAAS,MAAM,KAAK,IAAI,MAAM,QAAQ;AAClF,QAAI,IAAI;AACR,WAAO,IAAI,GAAG;AACZ,YAAM,OAAO,IAAI,IAAI,CAAC;AACtB,UAAI,qBAAqB,KAAK,IAAI,EAAG;AACrC,YAAM,YACJ,OAAO,KAAK,UAAU,YAAY,OAAO,SAAS,KAAK,KAAK,IAAI,KAAK,QAAQ;AAC/E,UAAI,aAAa,WAAY;AAC7B,UAAI,CAAC,IAAI;AACT,WAAK;AAAA,IACP;AACA,QAAI,MAAM,EAAG,KAAI,CAAC,IAAI;AAAA,EACxB;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { R as ReplaySource, a as ReplayWarning, b as ImportTurn, B as BulkImportSource, c as BulkImportOptions, d as BulkImportResult, e as ReplayTurn, O as Orchestrator, C as CompoundingPromotionReport } from './orchestrator-
|
|
1
|
+
import { R as ReplaySource, a as ReplayWarning, b as ImportTurn, B as BulkImportSource, c as BulkImportOptions, d as BulkImportResult, e as ReplayTurn, O as Orchestrator, C as CompoundingPromotionReport } from './orchestrator-CmJ-NTdJ.js';
|
|
2
2
|
import { M as MemoryGovernanceRunResult, c as MemoryGovernanceSummary, d as MemoryGovernanceMetrics, e as MemoryGovernanceQualityScore, f as MemoryGovernanceReviewQueueEntry, g as MemoryGovernanceAppliedAction, h as MemoryGovernanceTransitionReport, i as MemoryGovernanceManifest, j as MemoryGovernanceRestoreManifest, R as RestoreMemoryGovernanceRunResult } from './memory-projection-store-DeSXPh1j.js';
|
|
3
3
|
import { MemoryStatus, MemoryFile, BehaviorSignalEvent, MemoryActionEvent, MemoryLifecycleEvent } from './types.js';
|
|
4
4
|
import { Writable, Readable } from 'node:stream';
|
|
5
5
|
import { DashboardStatus } from './dashboard-runtime.js';
|
|
6
|
-
import { EngramAccessService } from './access-service.js';
|
|
6
|
+
import { E as EngramAccessService } from './access-service-Br8ZydTK.js';
|
|
7
7
|
import { EvalBaselineDeltaReport, EvalBaselineSnapshot, EvalCiGateReport, EvalBenchmarkPackSummary, EvalHarnessStatus, EvalStoredBaselineCiGateReport } from './evals.js';
|
|
8
8
|
import { GraphHealthReport } from './graph.js';
|
|
9
9
|
import { CausalTrajectoryStoreStatus } from './causal-trajectory.js';
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import './orchestrator-
|
|
2
|
-
export { A as AccessHttpServeCliCommandOptions, c as ArchiveObservationsCliCommandOptions, B as BulkImportCliCommandOptions, C as CompatCliCommandOptions, d as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, e as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, g as MemoryActionAuditCliNamespaceSummary, h as MemoryActionAuditCliReport, i as MemoryGovernanceCliCommandOptions, j as MemoryGovernanceReportCliCommandOptions, k as MemoryGovernanceRestoreCliCommandOptions, l as MemoryReviewDispositionCliCommandOptions, m as MemoryTimelineCliCommandOptions, n as MigrateCliOrchestrator, o as MigrateCliReport, q as MigrateObservationsCliCommandOptions, s as PolicyDiffCliReport, t as PolicyDiffEntry, u as PolicyRollbackCliReport, v as PolicyStatusCliReport, w as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, x as RebuildMemoryProjectionCliCommandOptions, y as RebuildObservationsCliCommandOptions, z as RepairMemoryProjectionCliCommandOptions, F as ReplayCliCommandOptions, H as ReplayCliOrchestrator, I as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, J as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, K as TailscaleSyncCliCommandOptions, L as TierMigrationCliOrchestrator, N as TrainingExportCliCommandOptions, V as VerifyMemoryProjectionCliCommandOptions, W as WebDavServeCliCommandOptions, O as WorkProjectCliCommandOptions, Q as WorkTaskCliCommandOptions, U as parseStrictCliDate, X as planAggressiveDuplicateDeletions, Y as planExactDuplicateDeletions, Z as registerCli, _ as resolveAccessPrincipalOverride, $ as resolveMemoryDirForNamespace, a0 as runAbstractionNodeStatusCliCommand, a1 as runAccessHttpServeCliCommand, a2 as runAccessHttpStatusCliCommand, a3 as runAccessHttpStopCliCommand, a4 as runAccessMcpServeCliCommand, a5 as runArchiveObservationsCliCommand, a6 as runBenchmarkBaselineReportCliCommand, a7 as runBenchmarkBaselineSnapshotCliCommand, a8 as runBenchmarkCiGateCliCommand, a9 as runBenchmarkImportCliCommand, aa as runBenchmarkStatusCliCommand, ab as runBenchmarkStoredBaselineCiGateCliCommand, ac as runBenchmarkValidateCliCommand, r as runBulkImportCliCommand, ad as runCausalTrajectoryStatusCliCommand, ae as runCommitmentLifecycleCliCommand, af as runCommitmentRecordCliCommand, ag as runCommitmentSetStateCliCommand, ah as runCommitmentStatusCliCommand, ai as runCompatCliCommand, aj as runCompoundingPromoteCliCommand, ak as runConversationIndexHealthCliCommand, al as runConversationIndexInspectCliCommand, am as runConversationIndexRebuildCliCommand, an as runCueAnchorStatusCliCommand, ao as runDashboardStartCliCommand, ap as runDashboardStatusCliCommand, aq as runDashboardStopCliCommand, ar as runGraphHealthCliCommand, as as runHarmonicSearchCliCommand, at as runMemoryActionAuditCliCommand, au as runMemoryGovernanceCliCommand, av as runMemoryGovernanceReportCliCommand, aw as runMemoryGovernanceRestoreCliCommand, ax as runMemoryReviewDispositionCliCommand, ay as runMemoryTimelineCliCommand, az as runMigrateNormalizeFrontmatterCliCommand, aA as runMigrateObservationsCliCommand, aB as runMigrateRechunkCliCommand, aC as runMigrateReextractCliCommand, aD as runMigrateRescoreImportanceCliCommand, aE as runObjectiveStateStatusCliCommand, aF as runPolicyDiffCliCommand, aG as runPolicyRollbackCliCommand, aH as runPolicyStatusCliCommand, aI as runRebuildMemoryLifecycleLedgerCliCommand, aJ as runRebuildMemoryProjectionCliCommand, aK as runRebuildObservationsCliCommand, aL as runRepairMemoryProjectionCliCommand, aM as runReplayCliCommand, aN as runResumeBundleBuildCliCommand, aO as runResumeBundleRecordCliCommand, aP as runResumeBundleStatusCliCommand, aQ as runRouteCliCommand, aR as runSemanticRulePromoteCliCommand, aS as runSemanticRuleVerifyCliCommand, aT as runSessionCheckCliCommand, aU as runSessionRepairCliCommand, aV as runTailscaleStatusCliCommand, aW as runTailscaleSyncCliCommand, aX as runTierMigrateCliCommand, aY as runTierStatusCliCommand, aZ as runTrainingExportCliCommand, a_ as runTrustZoneDemoSeedCliCommand, a$ as runTrustZonePromoteCliCommand, b0 as runTrustZoneStatusCliCommand, b1 as runUtilityLearningCliCommand, b2 as runUtilityLearningStatusCliCommand, b3 as runUtilityTelemetryRecordCliCommand, b4 as runUtilityTelemetryStatusCliCommand, b5 as runVerifiedRecallSearchCliCommand, b6 as runVerifyMemoryProjectionCliCommand, b7 as runWebDavServeCliCommand, b8 as runWebDavStopCliCommand, b9 as runWorkProductRecallSearchCliCommand, ba as runWorkProductRecordCliCommand, bb as runWorkProductStatusCliCommand, bc as runWorkProjectCliCommand, bd as runWorkTaskCliCommand } from './cli-
|
|
1
|
+
import './orchestrator-CmJ-NTdJ.js';
|
|
2
|
+
export { A as AccessHttpServeCliCommandOptions, c as ArchiveObservationsCliCommandOptions, B as BulkImportCliCommandOptions, C as CompatCliCommandOptions, d as ConversationIndexHealthCliOrchestrator, D as DashboardStartCliCommandOptions, e as DedupeCandidate, E as ExactDedupePlan, G as GraphHealthCliCommandOptions, M as MemoryActionAuditCliCommandOptions, g as MemoryActionAuditCliNamespaceSummary, h as MemoryActionAuditCliReport, i as MemoryGovernanceCliCommandOptions, j as MemoryGovernanceReportCliCommandOptions, k as MemoryGovernanceRestoreCliCommandOptions, l as MemoryReviewDispositionCliCommandOptions, m as MemoryTimelineCliCommandOptions, n as MigrateCliOrchestrator, o as MigrateCliReport, q as MigrateObservationsCliCommandOptions, s as PolicyDiffCliReport, t as PolicyDiffEntry, u as PolicyRollbackCliReport, v as PolicyStatusCliReport, w as PolicyTuningCliOrchestrator, R as RebuildMemoryLifecycleLedgerCliCommandOptions, x as RebuildMemoryProjectionCliCommandOptions, y as RebuildObservationsCliCommandOptions, z as RepairMemoryProjectionCliCommandOptions, F as ReplayCliCommandOptions, H as ReplayCliOrchestrator, I as RouteCliCommandOptions, S as SessionIntegrityCliCommandOptions, J as SessionRepairCliCommandOptions, T as TailscaleStatusCliCommandOptions, K as TailscaleSyncCliCommandOptions, L as TierMigrationCliOrchestrator, N as TrainingExportCliCommandOptions, V as VerifyMemoryProjectionCliCommandOptions, W as WebDavServeCliCommandOptions, O as WorkProjectCliCommandOptions, Q as WorkTaskCliCommandOptions, U as parseStrictCliDate, X as planAggressiveDuplicateDeletions, Y as planExactDuplicateDeletions, Z as registerCli, _ as resolveAccessPrincipalOverride, $ as resolveMemoryDirForNamespace, a0 as runAbstractionNodeStatusCliCommand, a1 as runAccessHttpServeCliCommand, a2 as runAccessHttpStatusCliCommand, a3 as runAccessHttpStopCliCommand, a4 as runAccessMcpServeCliCommand, a5 as runArchiveObservationsCliCommand, a6 as runBenchmarkBaselineReportCliCommand, a7 as runBenchmarkBaselineSnapshotCliCommand, a8 as runBenchmarkCiGateCliCommand, a9 as runBenchmarkImportCliCommand, aa as runBenchmarkStatusCliCommand, ab as runBenchmarkStoredBaselineCiGateCliCommand, ac as runBenchmarkValidateCliCommand, r as runBulkImportCliCommand, ad as runCausalTrajectoryStatusCliCommand, ae as runCommitmentLifecycleCliCommand, af as runCommitmentRecordCliCommand, ag as runCommitmentSetStateCliCommand, ah as runCommitmentStatusCliCommand, ai as runCompatCliCommand, aj as runCompoundingPromoteCliCommand, ak as runConversationIndexHealthCliCommand, al as runConversationIndexInspectCliCommand, am as runConversationIndexRebuildCliCommand, an as runCueAnchorStatusCliCommand, ao as runDashboardStartCliCommand, ap as runDashboardStatusCliCommand, aq as runDashboardStopCliCommand, ar as runGraphHealthCliCommand, as as runHarmonicSearchCliCommand, at as runMemoryActionAuditCliCommand, au as runMemoryGovernanceCliCommand, av as runMemoryGovernanceReportCliCommand, aw as runMemoryGovernanceRestoreCliCommand, ax as runMemoryReviewDispositionCliCommand, ay as runMemoryTimelineCliCommand, az as runMigrateNormalizeFrontmatterCliCommand, aA as runMigrateObservationsCliCommand, aB as runMigrateRechunkCliCommand, aC as runMigrateReextractCliCommand, aD as runMigrateRescoreImportanceCliCommand, aE as runObjectiveStateStatusCliCommand, aF as runPolicyDiffCliCommand, aG as runPolicyRollbackCliCommand, aH as runPolicyStatusCliCommand, aI as runRebuildMemoryLifecycleLedgerCliCommand, aJ as runRebuildMemoryProjectionCliCommand, aK as runRebuildObservationsCliCommand, aL as runRepairMemoryProjectionCliCommand, aM as runReplayCliCommand, aN as runResumeBundleBuildCliCommand, aO as runResumeBundleRecordCliCommand, aP as runResumeBundleStatusCliCommand, aQ as runRouteCliCommand, aR as runSemanticRulePromoteCliCommand, aS as runSemanticRuleVerifyCliCommand, aT as runSessionCheckCliCommand, aU as runSessionRepairCliCommand, aV as runTailscaleStatusCliCommand, aW as runTailscaleSyncCliCommand, aX as runTierMigrateCliCommand, aY as runTierStatusCliCommand, aZ as runTrainingExportCliCommand, a_ as runTrustZoneDemoSeedCliCommand, a$ as runTrustZonePromoteCliCommand, b0 as runTrustZoneStatusCliCommand, b1 as runUtilityLearningCliCommand, b2 as runUtilityLearningStatusCliCommand, b3 as runUtilityTelemetryRecordCliCommand, b4 as runUtilityTelemetryStatusCliCommand, b5 as runVerifiedRecallSearchCliCommand, b6 as runVerifyMemoryProjectionCliCommand, b7 as runWebDavServeCliCommand, b8 as runWebDavStopCliCommand, b9 as runWorkProductRecallSearchCliCommand, ba as runWorkProductRecordCliCommand, bb as runWorkProductStatusCliCommand, bc as runWorkProjectCliCommand, bd as runWorkTaskCliCommand } from './cli-BkeRaYfk.js';
|
|
3
3
|
import './memory-projection-store-DeSXPh1j.js';
|
|
4
4
|
import './types.js';
|
|
5
5
|
import 'node:stream';
|
|
6
6
|
import './dashboard-runtime.js';
|
|
7
|
-
import './access-service.js';
|
|
7
|
+
import './access-service-Br8ZydTK.js';
|
|
8
8
|
import './evals.js';
|
|
9
9
|
import './graph.js';
|
|
10
10
|
import './causal-trajectory.js';
|
|
@@ -27,20 +27,28 @@ import './policy-runtime.js';
|
|
|
27
27
|
import './buffer.js';
|
|
28
28
|
import './storage.js';
|
|
29
29
|
import './page-versioning.js';
|
|
30
|
+
import './consolidation-operator.js';
|
|
30
31
|
import 'better-sqlite3';
|
|
31
|
-
import './port-
|
|
32
|
+
import './port-BADbLZU5.js';
|
|
32
33
|
import './transcript.js';
|
|
33
34
|
import './summarizer.js';
|
|
34
35
|
import './model-registry.js';
|
|
35
36
|
import './local-llm.js';
|
|
37
|
+
import './fallback-llm.js';
|
|
36
38
|
import './relevance.js';
|
|
37
39
|
import './negative.js';
|
|
40
|
+
import './recall-xray.js';
|
|
38
41
|
import './session-observer-state.js';
|
|
39
42
|
import './embedding-fallback.js';
|
|
40
|
-
import './semantic-consolidation-
|
|
43
|
+
import './semantic-consolidation-CxJU6MJk.js';
|
|
41
44
|
import './codex-materialize-CQlLTzke.js';
|
|
42
45
|
import './logger.js';
|
|
43
46
|
import 'zod';
|
|
44
47
|
import './profiling.js';
|
|
48
|
+
import './recall-explain-renderer.js';
|
|
49
|
+
import './recall-audit-anomaly.js';
|
|
50
|
+
import './recall-audit.js';
|
|
45
51
|
import './explicit-capture.js';
|
|
52
|
+
import './cross-namespace-budget.js';
|
|
53
|
+
import './memory-worth-outcomes.js';
|
|
46
54
|
import './boxes.js';
|
package/dist/cli.js
CHANGED
|
@@ -84,76 +84,88 @@ import {
|
|
|
84
84
|
runWorkProductStatusCliCommand,
|
|
85
85
|
runWorkProjectCliCommand,
|
|
86
86
|
runWorkTaskCliCommand
|
|
87
|
-
} from "./chunk-
|
|
88
|
-
import "./chunk-
|
|
89
|
-
import "./chunk-
|
|
90
|
-
import "./chunk-
|
|
87
|
+
} from "./chunk-INXV5JBT.js";
|
|
88
|
+
import "./chunk-VDX363PS.js";
|
|
89
|
+
import "./chunk-KUB6JU6H.js";
|
|
90
|
+
import "./chunk-PVPWZSSI.js";
|
|
91
|
+
import "./chunk-B5WXLVDY.js";
|
|
91
92
|
import "./chunk-HL4DB7TO.js";
|
|
93
|
+
import "./chunk-ULYOGL6R.js";
|
|
92
94
|
import "./chunk-ZPKBYX2F.js";
|
|
93
95
|
import "./chunk-3SLRNYNG.js";
|
|
94
96
|
import "./chunk-LIRZNNUP.js";
|
|
95
97
|
import "./chunk-Y4Z4I6WK.js";
|
|
96
|
-
import "./chunk-
|
|
98
|
+
import "./chunk-ASAITVLA.js";
|
|
99
|
+
import "./chunk-EPQJM2GC.js";
|
|
97
100
|
import "./chunk-PYXS46O7.js";
|
|
98
101
|
import "./chunk-3QKK7QOS.js";
|
|
99
|
-
import "./chunk-
|
|
102
|
+
import "./chunk-CUPFXL3J.js";
|
|
100
103
|
import "./chunk-JRNQ3RNA.js";
|
|
101
|
-
import "./chunk-
|
|
104
|
+
import "./chunk-SPI27QT6.js";
|
|
102
105
|
import "./chunk-CULXMQJH.js";
|
|
103
106
|
import "./chunk-E6K4NIEU.js";
|
|
104
|
-
import "./chunk-
|
|
105
|
-
import "./chunk-LOBRX7VD.js";
|
|
106
|
-
import "./chunk-HITJFT7E.js";
|
|
107
|
+
import "./chunk-7I7FKFZH.js";
|
|
107
108
|
import "./chunk-YRMVARQP.js";
|
|
109
|
+
import "./chunk-YNQKWQT4.js";
|
|
108
110
|
import "./chunk-U66YHYC7.js";
|
|
109
|
-
import "./chunk-
|
|
110
|
-
import "./chunk-
|
|
111
|
-
import "./chunk-
|
|
111
|
+
import "./chunk-EABGC2TL.js";
|
|
112
|
+
import "./chunk-LOBRX7VD.js";
|
|
113
|
+
import "./chunk-HMDCOMYU.js";
|
|
114
|
+
import "./chunk-JXS5PDQ7.js";
|
|
115
|
+
import "./chunk-LK6SGL53.js";
|
|
112
116
|
import "./chunk-7SEAZFFB.js";
|
|
113
117
|
import "./chunk-K6WK37A6.js";
|
|
114
|
-
import "./chunk-
|
|
115
|
-
import "./chunk-FYIYMQ5N.js";
|
|
116
|
-
import "./chunk-OJFGVJS6.js";
|
|
118
|
+
import "./chunk-BK2EFTE2.js";
|
|
117
119
|
import "./chunk-Z5LAYHGJ.js";
|
|
118
120
|
import "./chunk-C6QPK5GG.js";
|
|
119
121
|
import "./chunk-C2EFFULQ.js";
|
|
122
|
+
import "./chunk-FYIYMQ5N.js";
|
|
120
123
|
import "./chunk-4WMCPJWX.js";
|
|
121
124
|
import "./chunk-6HZ6AO2P.js";
|
|
122
125
|
import "./chunk-URB2WSKZ.js";
|
|
126
|
+
import "./chunk-PVGDJXVK.js";
|
|
123
127
|
import "./chunk-NGAVDO7E.js";
|
|
124
|
-
import "./chunk-
|
|
125
|
-
import "./chunk-
|
|
128
|
+
import "./chunk-DFTTJYSO.js";
|
|
129
|
+
import "./chunk-HK3FGIEW.js";
|
|
126
130
|
import "./chunk-IQT3XTKW.js";
|
|
127
131
|
import "./chunk-MARWOCVP.js";
|
|
128
|
-
import "./chunk-
|
|
129
|
-
import "./chunk-
|
|
132
|
+
import "./chunk-GKFXUTJ2.js";
|
|
133
|
+
import "./chunk-ZAIM4TUE.js";
|
|
134
|
+
import "./chunk-SOBJ6NEY.js";
|
|
135
|
+
import "./chunk-3OGMS3PE.js";
|
|
130
136
|
import "./chunk-EQINRHYR.js";
|
|
131
|
-
import "./chunk-
|
|
132
|
-
import "./chunk-QDYXG4CS.js";
|
|
133
|
-
import "./chunk-QNJMBKFK.js";
|
|
137
|
+
import "./chunk-EIR5VLIH.js";
|
|
134
138
|
import "./chunk-EEQLFRUM.js";
|
|
135
139
|
import "./chunk-QDW3E4RD.js";
|
|
136
|
-
import "./chunk-
|
|
140
|
+
import "./chunk-3FPTCC3Z.js";
|
|
141
|
+
import "./chunk-2LGMW3DJ.js";
|
|
142
|
+
import "./chunk-GDFS42HT.js";
|
|
143
|
+
import "./chunk-RBBWYEFJ.js";
|
|
137
144
|
import "./chunk-DT5TVLJE.js";
|
|
145
|
+
import "./chunk-N5AKDXAI.js";
|
|
138
146
|
import "./chunk-TBBDFYXW.js";
|
|
139
|
-
import "./chunk-
|
|
140
|
-
import "./chunk-
|
|
141
|
-
import "./chunk-
|
|
142
|
-
import "./chunk-ECKDIK5F.js";
|
|
143
|
-
import "./chunk-POMSFKTB.js";
|
|
144
|
-
import "./chunk-U2IQTSBY.js";
|
|
147
|
+
import "./chunk-WVVA7F5A.js";
|
|
148
|
+
import "./chunk-F5VP6YCB.js";
|
|
149
|
+
import "./chunk-LTCGGW2D.js";
|
|
145
150
|
import "./chunk-4KAN3GZ3.js";
|
|
146
|
-
import "./chunk-6ZH4TU6I.js";
|
|
147
151
|
import "./chunk-6PFRXT4K.js";
|
|
148
152
|
import "./chunk-TP4FZJIZ.js";
|
|
149
153
|
import "./chunk-SCU65EZI.js";
|
|
150
154
|
import "./chunk-BOUYNNYD.js";
|
|
151
|
-
import "./chunk-QSVPYQPG.js";
|
|
152
155
|
import "./chunk-DM2T26WE.js";
|
|
156
|
+
import "./chunk-QSVPYQPG.js";
|
|
153
157
|
import "./chunk-M62O4P4T.js";
|
|
154
158
|
import "./chunk-4DJQYKMN.js";
|
|
159
|
+
import "./chunk-X6GF3FX2.js";
|
|
160
|
+
import "./chunk-FAAFWE4G.js";
|
|
155
161
|
import "./chunk-2ODBA7MQ.js";
|
|
156
|
-
import "./chunk-
|
|
162
|
+
import "./chunk-DGXUHMOV.js";
|
|
163
|
+
import "./chunk-LPSF4OQH.js";
|
|
164
|
+
import "./chunk-TVVEYCNW.js";
|
|
165
|
+
import "./chunk-RFYAYKTD.js";
|
|
166
|
+
import "./chunk-LBLXEFWK.js";
|
|
167
|
+
import "./chunk-XKECPATV.js";
|
|
168
|
+
import "./chunk-WCLICCGB.js";
|
|
157
169
|
export {
|
|
158
170
|
parseStrictCliDate,
|
|
159
171
|
planAggressiveDuplicateDeletions,
|
package/dist/config.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* consolidation-operator.ts — Standalone operator vocabulary + validators
|
|
3
|
+
* for the consolidation subsystem (issue #561, All-Mem paper
|
|
4
|
+
* arxiv:2603.19595).
|
|
5
|
+
*
|
|
6
|
+
* This module is intentionally dependency-free so storage, the `remnic
|
|
7
|
+
* doctor` check (PR 4), and the undo CLI (PR 5) can import the validators
|
|
8
|
+
* without dragging in the full consolidation engine — which in turn pulls
|
|
9
|
+
* in the Codex materialize runner and creates a `storage → consolidation
|
|
10
|
+
* → codex-materialize-runner → storage` import cycle.
|
|
11
|
+
*
|
|
12
|
+
* The `semantic-consolidation.ts` module re-exports these symbols so
|
|
13
|
+
* existing import paths continue to work.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Operator algebra for non-destructive consolidation.
|
|
17
|
+
*
|
|
18
|
+
* - `split` — one source memory is rewritten as multiple smaller memories.
|
|
19
|
+
* - `merge` — multiple source memories are collapsed into one canonical
|
|
20
|
+
* memory.
|
|
21
|
+
* - `update` — a newer value supersedes an older value within the same
|
|
22
|
+
* logical fact.
|
|
23
|
+
*/
|
|
24
|
+
type ConsolidationOperator = "split" | "merge" | "update";
|
|
25
|
+
/**
|
|
26
|
+
* Allowed values for the `derived_via` frontmatter field. Used by storage
|
|
27
|
+
* validation to reject unknown operator values on write.
|
|
28
|
+
*/
|
|
29
|
+
declare const CONSOLIDATION_OPERATORS: readonly ConsolidationOperator[];
|
|
30
|
+
/**
|
|
31
|
+
* Validate a `derived_from` entry string. Returns `true` if the entry
|
|
32
|
+
* parses as `<non-empty path>:<integer >= 0>`. Kept pure so storage and
|
|
33
|
+
* future CLI/doctor paths can share the same validator.
|
|
34
|
+
*/
|
|
35
|
+
declare function isValidDerivedFromEntry(entry: unknown): entry is string;
|
|
36
|
+
/**
|
|
37
|
+
* Type guard for `ConsolidationOperator`.
|
|
38
|
+
*/
|
|
39
|
+
declare function isConsolidationOperator(value: unknown): value is ConsolidationOperator;
|
|
40
|
+
|
|
41
|
+
export { CONSOLIDATION_OPERATORS, type ConsolidationOperator, isConsolidationOperator, isValidDerivedFromEntry };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONSOLIDATION_OPERATORS,
|
|
3
|
+
isConsolidationOperator,
|
|
4
|
+
isValidDerivedFromEntry
|
|
5
|
+
} from "./chunk-X6GF3FX2.js";
|
|
6
|
+
export {
|
|
7
|
+
CONSOLIDATION_OPERATORS,
|
|
8
|
+
isConsolidationOperator,
|
|
9
|
+
isValidDerivedFromEntry
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=consolidation-operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { StorageManager } from './storage.js';
|
|
2
|
+
import './page-versioning.js';
|
|
3
|
+
import './consolidation-operator.js';
|
|
4
|
+
import './types.js';
|
|
5
|
+
import './memory-projection-store-DeSXPh1j.js';
|
|
6
|
+
import 'better-sqlite3';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Consolidation provenance integrity check (issue #561 PR 4).
|
|
10
|
+
*
|
|
11
|
+
* Validates that every memory carrying consolidation provenance frontmatter
|
|
12
|
+
* (`derived_from`, `derived_via`) resolves to real data:
|
|
13
|
+
*
|
|
14
|
+
* - Each `derived_from` entry `"<path>:<version>"` must name a
|
|
15
|
+
* page-version snapshot that exists on disk (via the sidecar layout
|
|
16
|
+
* documented in `page-versioning.ts`).
|
|
17
|
+
* - Each `derived_via` must be one of the known
|
|
18
|
+
* `ConsolidationOperator` values — malformed values are surfaced as
|
|
19
|
+
* warnings rather than crashes so legacy or future operators survive a
|
|
20
|
+
* rollback.
|
|
21
|
+
*
|
|
22
|
+
* Non-fatal: every failure renders a warning with the offending file path
|
|
23
|
+
* and a human-readable reason. Integrity problems are informational for
|
|
24
|
+
* now — we do not auto-heal or archive broken memories.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* One integrity warning attached to a specific memory.
|
|
29
|
+
*/
|
|
30
|
+
interface ConsolidationProvenanceIssue {
|
|
31
|
+
/** Absolute path to the memory markdown file. */
|
|
32
|
+
memoryPath: string;
|
|
33
|
+
/** Memory id from frontmatter. */
|
|
34
|
+
memoryId: string;
|
|
35
|
+
/** Type of integrity issue. */
|
|
36
|
+
kind: "derived_from_missing_snapshot" | "derived_from_malformed_entry" | "derived_via_unknown_operator";
|
|
37
|
+
/** Human-readable detail — includes the offending value when relevant. */
|
|
38
|
+
detail: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Summary of a provenance-integrity scan. Used by the operator-doctor
|
|
42
|
+
* report and surfaced in the CLI output.
|
|
43
|
+
*/
|
|
44
|
+
interface ConsolidationProvenanceReport {
|
|
45
|
+
/** Total memories inspected. */
|
|
46
|
+
scanned: number;
|
|
47
|
+
/** Memories that carry `derived_from` and/or `derived_via`. */
|
|
48
|
+
withProvenance: number;
|
|
49
|
+
/** One entry per problem detected (may be empty). */
|
|
50
|
+
issues: ConsolidationProvenanceIssue[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Scan every memory under `storage` and flag consolidation-provenance
|
|
54
|
+
* problems. Does not throw on individual failures — collects them in the
|
|
55
|
+
* returned report.
|
|
56
|
+
*/
|
|
57
|
+
declare function runConsolidationProvenanceCheck(options: {
|
|
58
|
+
storage: StorageManager;
|
|
59
|
+
memoryDir: string;
|
|
60
|
+
/**
|
|
61
|
+
* Page-versioning sidecar directory name. Defaults to `.versions` —
|
|
62
|
+
* matches the baked-in default used by `setVersioningConfig` when
|
|
63
|
+
* versioning is enabled via config.
|
|
64
|
+
*/
|
|
65
|
+
sidecarDir?: string;
|
|
66
|
+
}): Promise<ConsolidationProvenanceReport>;
|
|
67
|
+
|
|
68
|
+
export { type ConsolidationProvenanceIssue, type ConsolidationProvenanceReport, runConsolidationProvenanceCheck };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { StorageManager } from './storage.js';
|
|
2
|
+
import { VersioningConfig } from './page-versioning.js';
|
|
3
|
+
import './consolidation-operator.js';
|
|
4
|
+
import './types.js';
|
|
5
|
+
import './memory-projection-store-DeSXPh1j.js';
|
|
6
|
+
import 'better-sqlite3';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Consolidation undo (issue #561 PR 5).
|
|
10
|
+
*
|
|
11
|
+
* Reverts a consolidated memory by restoring each source memory from its
|
|
12
|
+
* `derived_from` snapshot and archiving the target.
|
|
13
|
+
*
|
|
14
|
+
* Contract:
|
|
15
|
+
* - Load the target memory markdown file via its absolute path.
|
|
16
|
+
* - For every `"<rel>:<version>"` entry in `derived_from`, fetch the
|
|
17
|
+
* snapshot content via `page-versioning.getVersion` and restore it
|
|
18
|
+
* to the original relative path. If the restore target file
|
|
19
|
+
* already exists, we skip overwriting it (the source was never
|
|
20
|
+
* archived, or was re-created since) and record the skip.
|
|
21
|
+
* - Archive the target with reason code `"consolidation-undo"` so the
|
|
22
|
+
* lifecycle ledger records the undo.
|
|
23
|
+
* - Dry-run mode produces the same plan without touching disk.
|
|
24
|
+
*
|
|
25
|
+
* The helper is kept pure over `StorageManager` so the CLI can reuse it
|
|
26
|
+
* without additional wiring, and tests can exercise the plan logic
|
|
27
|
+
* directly.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Outcome of restoring a single `derived_from` source.
|
|
32
|
+
*/
|
|
33
|
+
interface ConsolidationUndoRestore {
|
|
34
|
+
/** The raw `"<relpath>:<version>"` entry from `derived_from`. */
|
|
35
|
+
entry: string;
|
|
36
|
+
/** Absolute path where the source would be / was restored. */
|
|
37
|
+
sourcePath: string;
|
|
38
|
+
/** What actually happened. */
|
|
39
|
+
outcome: "restored" | "skipped_file_exists" | "skipped_non_regular_file" | "skipped_snapshot_missing" | "skipped_malformed_entry" | "skipped_outside_memory_dir" | "skipped_non_active_path" | "skipped_self_referential" | "skipped_write_failed" | "skipped_blocked_by_other_failures" | "skipped_dry_run";
|
|
40
|
+
/** Human-readable detail. */
|
|
41
|
+
detail?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Plan + result of a `remnic consolidate undo` invocation.
|
|
45
|
+
*/
|
|
46
|
+
interface ConsolidationUndoResult {
|
|
47
|
+
/** Absolute path to the target memory. */
|
|
48
|
+
targetPath: string;
|
|
49
|
+
/** True when the target was archived successfully. */
|
|
50
|
+
targetArchived: boolean;
|
|
51
|
+
/** Per-source restore outcomes. */
|
|
52
|
+
restores: ConsolidationUndoRestore[];
|
|
53
|
+
/** Whether the run was a dry-run plan only. */
|
|
54
|
+
dryRun: boolean;
|
|
55
|
+
/** Fatal error, if any — the run bails early. */
|
|
56
|
+
error?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Verify that `candidate` resolves inside `root` (defense against
|
|
60
|
+
* path-traversal in `derived_from` entries and user-facing target
|
|
61
|
+
* paths). Path-string normalization only; for symlink-aware checks
|
|
62
|
+
* use `isInsideDirectoryRealpath`. Both paths are resolved to
|
|
63
|
+
* absolute form before comparison so `..` segments, symlinks-as-
|
|
64
|
+
* strings, and relative prefixes are normalized.
|
|
65
|
+
*/
|
|
66
|
+
declare function isInsideDirectory(candidate: string, root: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Symlink-aware containment check (PR #637 round-2 review, codex P1).
|
|
69
|
+
*
|
|
70
|
+
* `isInsideDirectory` only normalizes path strings — if a `derived_from`
|
|
71
|
+
* entry resolves through a symlink inside `memoryDir` that points
|
|
72
|
+
* outside, the string check passes but the subsequent `writeFile` would
|
|
73
|
+
* land outside the memory tree. Use this guard for any path that is
|
|
74
|
+
* about to be written.
|
|
75
|
+
*
|
|
76
|
+
* Walks every parent directory between `candidate` and `root`,
|
|
77
|
+
* `realpath`-ing each segment that exists and rejecting when any
|
|
78
|
+
* segment escapes `root`. Non-existent parents are resolved as the
|
|
79
|
+
* canonicalized deepest-existing ancestor plus the trailing segments,
|
|
80
|
+
* so a not-yet-created target file still gets the symlink check on its
|
|
81
|
+
* existing parent directories.
|
|
82
|
+
*/
|
|
83
|
+
declare function isInsideDirectoryRealpath(candidate: string, root: string): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Check that a relative path (relative to memoryDir) points to an
|
|
86
|
+
* active memory location rather than an internal/archive directory.
|
|
87
|
+
* Returns `true` when the normalised `pagePath` does NOT start with
|
|
88
|
+
* a known non-active prefix.
|
|
89
|
+
*
|
|
90
|
+
* @param pagePath Relative path from `derived_from` entry.
|
|
91
|
+
* @param sidecarDir Optional versioning sidecar directory name
|
|
92
|
+
* (e.g. `".versions"`). When provided, paths
|
|
93
|
+
* under this directory are also rejected as
|
|
94
|
+
* non-active.
|
|
95
|
+
*/
|
|
96
|
+
declare function isActiveMemoryRelativePath(pagePath: string, sidecarDir?: string): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Perform a consolidation-undo operation.
|
|
99
|
+
*
|
|
100
|
+
* @param options.storage Storage manager for the memory directory.
|
|
101
|
+
* @param options.memoryDir Absolute memory directory root.
|
|
102
|
+
* @param options.targetPath Absolute path to the consolidated memory.
|
|
103
|
+
* @param options.versioning Page-versioning config (sidecarDir must
|
|
104
|
+
* match the sidecar layout used when the
|
|
105
|
+
* snapshots were created).
|
|
106
|
+
* @param options.dryRun When true, compute the plan but do not
|
|
107
|
+
* write or archive.
|
|
108
|
+
*/
|
|
109
|
+
declare function runConsolidationUndo(options: {
|
|
110
|
+
storage: StorageManager;
|
|
111
|
+
memoryDir: string;
|
|
112
|
+
targetPath: string;
|
|
113
|
+
versioning: VersioningConfig;
|
|
114
|
+
dryRun?: boolean;
|
|
115
|
+
}): Promise<ConsolidationUndoResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Render a consolidation-undo result as a human-readable multi-line
|
|
118
|
+
* string for the CLI. Extracted so tests can snapshot the formatting
|
|
119
|
+
* without parsing stdout.
|
|
120
|
+
*/
|
|
121
|
+
declare function formatConsolidationUndoResult(result: ConsolidationUndoResult): string;
|
|
122
|
+
|
|
123
|
+
export { type ConsolidationUndoRestore, type ConsolidationUndoResult, formatConsolidationUndoResult, isActiveMemoryRelativePath, isInsideDirectory, isInsideDirectoryRealpath, runConsolidationUndo };
|