@remnic/core 1.1.0 → 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/access-audit.d.ts +56 -0
- package/dist/access-audit.js +9 -0
- package/dist/access-cli.js +62 -45
- package/dist/access-cli.js.map +1 -1
- package/dist/access-http.d.ts +16 -9
- package/dist/access-http.js +25 -17
- package/dist/access-mcp.d.ts +16 -9
- package/dist/access-mcp.js +29 -7
- package/dist/access-schema.d.ts +124 -33
- package/dist/access-schema.js +5 -1
- package/dist/{access-service-HmO1Trrx.d.ts → access-service-Br8ZydTK.d.ts} +158 -63
- package/dist/access-service.d.ts +13 -6
- 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 +7 -6
- 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-44ICJRF3.js → chunk-3GXCSUXR.js} +4 -4
- package/dist/{chunk-ITRLGI2T.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-OIT5QGG4.js → chunk-6AUUAZEX.js} +72 -2
- package/dist/chunk-6AUUAZEX.js.map +1 -0
- package/dist/{chunk-ZVBB3T7V.js → chunk-7I7FKFZH.js} +24 -22
- 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-3QHL5ABG.js → chunk-B5WXLVDY.js} +187 -6
- package/dist/chunk-B5WXLVDY.js.map +1 -0
- package/dist/{chunk-SYUK3VLY.js → chunk-BGJGXLZ7.js} +111 -2
- package/dist/{chunk-SYUK3VLY.js.map → chunk-BGJGXLZ7.js.map} +1 -1
- package/dist/{chunk-MBJHSA7F.js → chunk-BK2EFTE2.js} +258 -13
- 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-6UJ47TVX.js → chunk-CUPFXL3J.js} +2 -2
- package/dist/chunk-DF3RVK3X.js +119 -0
- package/dist/chunk-DF3RVK3X.js.map +1 -0
- package/dist/{chunk-37UIFYWO.js → chunk-DFTTJYSO.js} +108 -9
- 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-GV6NLQ4X.js → chunk-F5VP6YCB.js} +374 -16
- 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-7WQ6SLIE.js → chunk-FVA6TGI3.js} +2 -2
- package/dist/chunk-GDFS42HT.js +206 -0
- package/dist/chunk-GDFS42HT.js.map +1 -0
- package/dist/{chunk-MVTHXUBX.js → chunk-GKFXUTJ2.js} +479 -20
- package/dist/chunk-GKFXUTJ2.js.map +1 -0
- package/dist/{chunk-NQEVYWX6.js → chunk-HK3FGIEW.js} +209 -5
- package/dist/chunk-HK3FGIEW.js.map +1 -0
- package/dist/chunk-IISBCCWR.js +52 -0
- package/dist/chunk-IISBCCWR.js.map +1 -0
- package/dist/{chunk-WBSAYXVI.js → chunk-INXV5JBT.js} +198 -42
- 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-J4IYOZZ5.js → chunk-JXS5PDQ7.js} +3 -1
- package/dist/chunk-JXS5PDQ7.js.map +1 -0
- package/dist/{chunk-6LX5ORAS.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-3WHVNEN7.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-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-DHHP2Z4X.js → chunk-RGLL5SPU.js} +2 -2
- package/dist/{chunk-3SV6CQHO.js → chunk-S3EEFKNY.js} +101 -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-JIU55F3X.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-47UU5PU2.js → chunk-VBVG2M5G.js} +18 -3
- package/dist/chunk-VBVG2M5G.js.map +1 -0
- package/dist/{chunk-7ECD5ATE.js → chunk-VDX363PS.js} +2 -2
- package/dist/{chunk-DEPL3635.js → chunk-VYM3VWOF.js} +1432 -188
- 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-4LACOVZX.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-BLKTA7MM.js → chunk-YNQKWQT4.js} +50 -17
- 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-N42IWANG.js → chunk-ZEM3OK2K.js} +2 -2
- package/dist/chunk-ZZTOURJI.js +91 -0
- package/dist/chunk-ZZTOURJI.js.map +1 -0
- package/dist/{cli-BneVIEvh.d.ts → cli-BkeRaYfk.d.ts} +2 -2
- package/dist/cli.d.ts +13 -6
- package/dist/cli.js +40 -29
- 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-scan-GR33PONM.js → contradiction-scan-E3GJTI4F.js} +43 -7
- 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.js +5 -70
- package/dist/direct-answer-wiring.js.map +1 -1
- package/dist/{engine-5TIQBYZR.js → engine-F3GOXGE5.js} +8 -7
- package/dist/engine-F3GOXGE5.js.map +1 -0
- package/dist/entity-retrieval.d.ts +1 -0
- package/dist/entity-retrieval.js +7 -6
- 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 +6 -5
- 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/importance.js +1 -1
- package/dist/index.d.ts +585 -20
- package/dist/index.js +503 -312
- package/dist/index.js.map +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 +23 -14
- package/dist/{orchestrator-DRYA6_lW.d.ts → orchestrator-CmJ-NTdJ.d.ts} +233 -8
- package/dist/orchestrator.d.ts +6 -3
- package/dist/orchestrator.js +49 -39
- 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 +1 -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 +12 -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/resume-bundles.js +5 -5
- 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 +287 -31
- 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 +21 -7
- package/dist/semantic-rule-promotion.js +7 -6
- package/dist/semantic-rule-verifier.js +7 -6
- package/dist/storage.d.ts +82 -1
- package/dist/storage.js +6 -5
- package/dist/summarizer.js +3 -3
- package/dist/temporal-supersession.d.ts +1 -0
- package/dist/tier-migration.d.ts +2 -1
- package/dist/types.d.ts +276 -2
- package/dist/types.js +1 -1
- package/dist/verified-recall.js +7 -6
- package/package.json +1 -1
- package/dist/chunk-37UIFYWO.js.map +0 -1
- package/dist/chunk-3QHL5ABG.js.map +0 -1
- package/dist/chunk-3SV6CQHO.js.map +0 -1
- package/dist/chunk-3WHVNEN7.js.map +0 -1
- package/dist/chunk-47UU5PU2.js.map +0 -1
- package/dist/chunk-6ZH4TU6I.js.map +0 -1
- package/dist/chunk-BLKTA7MM.js.map +0 -1
- package/dist/chunk-DEPL3635.js.map +0 -1
- package/dist/chunk-GV6NLQ4X.js.map +0 -1
- package/dist/chunk-J4IYOZZ5.js.map +0 -1
- package/dist/chunk-LAYN4LDC.js +0 -267
- package/dist/chunk-LAYN4LDC.js.map +0 -1
- package/dist/chunk-MBJHSA7F.js.map +0 -1
- package/dist/chunk-MTLYEMJB.js.map +0 -1
- package/dist/chunk-MVTHXUBX.js.map +0 -1
- package/dist/chunk-NQEVYWX6.js.map +0 -1
- package/dist/chunk-OIT5QGG4.js.map +0 -1
- package/dist/chunk-PAORGQRI.js.map +0 -1
- package/dist/chunk-QDYXG4CS.js.map +0 -1
- package/dist/chunk-QNJMBKFK.js.map +0 -1
- package/dist/chunk-UEYA6UC7.js.map +0 -1
- package/dist/chunk-UVJFDP7P.js +0 -202
- package/dist/chunk-UVJFDP7P.js.map +0 -1
- package/dist/chunk-WBSAYXVI.js.map +0 -1
- package/dist/chunk-ZVBB3T7V.js.map +0 -1
- package/dist/contradiction-scan-GR33PONM.js.map +0 -1
- /package/dist/{engine-5TIQBYZR.js.map → access-audit.js.map} +0 -0
- /package/dist/{chunk-44ICJRF3.js.map → chunk-3GXCSUXR.js.map} +0 -0
- /package/dist/{chunk-ITRLGI2T.js.map → chunk-3OGMS3PE.js.map} +0 -0
- /package/dist/{chunk-6UJ47TVX.js.map → chunk-CUPFXL3J.js.map} +0 -0
- /package/dist/{chunk-7WQ6SLIE.js.map → chunk-FVA6TGI3.js.map} +0 -0
- /package/dist/{chunk-6LX5ORAS.js.map → chunk-KUB6JU6H.js.map} +0 -0
- /package/dist/{chunk-4NRAJUDS.js.map → chunk-RBBWYEFJ.js.map} +0 -0
- /package/dist/{chunk-DHHP2Z4X.js.map → chunk-RGLL5SPU.js.map} +0 -0
- /package/dist/{chunk-JIU55F3X.js.map → chunk-SPI27QT6.js.map} +0 -0
- /package/dist/{chunk-7ECD5ATE.js.map → chunk-VDX363PS.js.map} +0 -0
- /package/dist/{chunk-4LACOVZX.js.map → chunk-WVVA7F5A.js.map} +0 -0
- /package/dist/{chunk-3QFQGRHO.js.map → chunk-XMHBH5H6.js.map} +0 -0
- /package/dist/{chunk-N42IWANG.js.map → chunk-ZEM3OK2K.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/memory-worth.ts"],"sourcesContent":["/**\n * Issue #560 PR 2 — Memory Worth scoring (pure helper).\n *\n * Given per-memory outcome counters (`mw_success`, `mw_fail` — added to\n * frontmatter in PR 1), compute a scalar worth score plus interpretable\n * metadata. The score is a Laplace-smoothed success probability with an\n * optional recency decay, and is meant to be used as a multiplier on existing\n * recall scores (PR 4) to sink memories that consistently lead to failed\n * sessions and keep uninstrumented memories at a neutral baseline.\n *\n * Intentional properties:\n * - Pure function. No I/O, no time-of-import side effects. Testable in\n * isolation; callers pass `now` so tests don't depend on the wall clock.\n * - Laplace-smoothed ratio `(s + 1) / (s + f + 2)` ensures a memory with\n * zero observations scores exactly 0.5 — neither boosted nor penalized.\n * A single failure on a new memory lands at 1/3, not 0, so one bad\n * session doesn't permanently exile a fact.\n * - Recency decay is optional. When a memory hasn't been touched in a long\n * time, its `p_success` is pulled back toward 0.5 (the prior). Decay is\n * exponential with an operator-configured half-life so old verdicts\n * aren't treated as equally informative as fresh ones.\n * - Corrupt / missing inputs fail safely to the prior. Callers upstream of\n * this helper (see `storage.parseMemoryWorthCounterField` in PR 1) already\n * strip negatives and non-integers, but the helper re-validates so it\n * survives being called directly from tests / ad-hoc tooling.\n * - Confidence is the effective number of observations (post-decay). PR 4\n * and PR 5 use it to decide whether the Memory Worth multiplier should\n * actually be applied vs. left at 1.0 (i.e., \"not enough signal yet\").\n *\n * Out of scope here:\n * - Mutating frontmatter (PR 3).\n * - Recall integration / feature flag (PR 4).\n * - Benchmark & default-flip (PR 5).\n */\n\n/**\n * Input to `computeMemoryWorth`.\n *\n * All fields are optional so a legacy (pre-PR-1) memory can be passed through\n * without upstream guards — it will simply score to the neutral prior.\n */\nexport interface ComputeMemoryWorthInput {\n /** Count of sessions where this memory was recalled and the outcome was success. */\n mw_success?: number;\n /** Count of sessions where this memory was recalled and the outcome was failure. */\n mw_fail?: number;\n /**\n * ISO timestamp of the most recent outcome observation for this memory.\n * When provided together with `halfLifeMs`, observations decay exponentially\n * toward the uniform prior as they age. Absent / unparseable timestamp →\n * decay is skipped and raw counters are used directly.\n */\n lastAccessed?: string | null;\n /**\n * Current wall-clock reference. Required in the signature (not defaulted to\n * `Date.now()`) so the function stays pure and tests are deterministic.\n */\n now: Date;\n /**\n * Half-life for outcome decay, in milliseconds. When `undefined` or `<= 0`,\n * no decay is applied (raw counts are used). When positive, counter weights\n * are multiplied by `2^(-age / halfLifeMs)`.\n */\n halfLifeMs?: number;\n}\n\n/**\n * Output of `computeMemoryWorth`.\n *\n * `score` is the value recall callers multiply into their base score.\n * `p_success` is the same number pre-clamped — exposed separately so\n * observability surfaces can log the probability distinctly from the\n * multiplier. `confidence` is the effective observation count after decay,\n * useful for UIs that want to render \"strong signal\" vs. \"tentative\".\n */\nexport interface MemoryWorthResult {\n /**\n * The Laplace-smoothed success probability, post-decay, clamped to\n * `[0, 1]`. This is the multiplier PR 4 applies to the base recall score.\n */\n score: number;\n /**\n * Same as `score` conceptually, surfaced separately so telemetry /\n * xray surfaces can report probability independently of whatever final\n * multiplier PR 4 chooses to apply.\n */\n p_success: number;\n /**\n * Effective observation count (`s_eff + f_eff`). With decay enabled this is\n * fractional; without decay it equals `mw_success + mw_fail` exactly.\n * Zero indicates no signal — callers should treat the score as a prior.\n */\n confidence: number;\n}\n\n/**\n * Treat fractional or negative counter inputs as zero. Upstream writers in\n * PR 1 already reject these, but this helper is also called from tests and\n * benchmark seeders that build inputs by hand, so we defend here too.\n */\n/**\n * Upper bound for a plausible counter. `Number.MAX_SAFE_INTEGER` would\n * be technically correct but still overflows the sum `sEff + fEff + 2`\n * when both counters are near the max. A more conservative cap also\n * doubles as a sanity check against clearly-corrupt frontmatter (no\n * single memory should have 10B recorded outcomes), and leaves plenty\n * of headroom for the sum.\n */\nconst MAX_COUNTER = 1e12;\n\n/**\n * Classify a counter into `{ok, value}` for the scorer:\n * - `{ok: true, value}` means the input was absent or a valid non-negative\n * integer within range. Treated as a normal signal.\n * - `{ok: false}` means the caller supplied a value but it was corrupt\n * (negative, NaN, Infinity, non-integer, or absurdly large). The scorer\n * treats the record as corrupted and collapses BOTH counters to the\n * prior — a partial-corruption record (e.g. `mw_success: 10` with\n * `mw_fail: NaN`) must not be read as strong evidence.\n */\nfunction classifyCounter(value: number | undefined): { ok: true; value: number } | { ok: false } {\n // Absent counter is a legitimate \"no data yet\" signal, not corruption.\n if (value === undefined) return { ok: true, value: 0 };\n if (typeof value !== \"number\") return { ok: false };\n if (!Number.isFinite(value)) return { ok: false };\n if (value < 0) return { ok: false };\n // Non-integer counters are refused outright (not floored). Fractional\n // counters can only arise from hand-edited frontmatter or a mis-seeded\n // bench fixture — the PR 1 serializer rejects them on write. Treating\n // `1.9` as `1` would give obviously-corrupt data non-zero confidence and\n // shift the score away from the neutral prior.\n if (!Number.isInteger(value)) return { ok: false };\n // Overflow guard. `mw_success: 1e308` (or anything past `MAX_COUNTER`)\n // would let `sEff + fEff + 2` overflow to `Infinity` and drive the\n // computed score to 0 for symmetric counts — exactly the opposite of\n // the neutral-prior fail-safe contract.\n if (value > MAX_COUNTER) return { ok: false };\n return { ok: true, value };\n}\n\n/**\n * Parse `lastAccessed` into a millisecond timestamp. Any parse failure\n * collapses to `null`, which disables decay rather than throwing.\n */\nfunction parseLastAccessedMs(lastAccessed: string | null | undefined): number | null {\n if (!lastAccessed) return null;\n const parsed = Date.parse(lastAccessed);\n if (!Number.isFinite(parsed)) return null;\n return parsed;\n}\n\n/**\n * Compute the decay multiplier for an observation of age `ageMs` given a\n * `halfLifeMs`. Returns `1` when decay is disabled or age is non-positive\n * (can happen if a test seeds `lastAccessed` slightly in the future).\n */\nfunction decayFactor(ageMs: number, halfLifeMs: number | undefined): number {\n if (typeof halfLifeMs !== \"number\") return 1;\n if (!Number.isFinite(halfLifeMs)) return 1;\n if (halfLifeMs <= 0) return 1;\n if (ageMs <= 0) return 1;\n return Math.pow(2, -ageMs / halfLifeMs);\n}\n\n/**\n * Score a single memory's worth based on outcome history.\n *\n * Returns the neutral prior (`0.5`, `confidence=0`) for uninstrumented\n * memories so the caller can treat \"no data\" and \"data says 50/50\"\n * identically — neither should be penalized.\n */\nexport function computeMemoryWorth(input: ComputeMemoryWorthInput): MemoryWorthResult {\n const sClass = classifyCounter(input.mw_success);\n const fClass = classifyCounter(input.mw_fail);\n // If EITHER counter is corrupt, fail the whole record to the prior. A\n // partially-corrupt record (e.g. `mw_success: 10` with `mw_fail: NaN`)\n // would otherwise read as strong positive evidence — the exact opposite\n // of the documented \"corrupt inputs fail safely\" contract.\n if (!sClass.ok || !fClass.ok) {\n return { score: 0.5, p_success: 0.5, confidence: 0 };\n }\n const rawS = sClass.value;\n const rawF = fClass.value;\n\n const lastAccessedMs = parseLastAccessedMs(input.lastAccessed);\n const nowMs = input.now.getTime();\n // An invalid `now` Date (`new Date(\"bad\")`) would otherwise propagate\n // NaN through `ageMs` → `decayFactor` → score and poison any downstream\n // sort that treats NaN as \"less than everything\". Skip decay in that\n // case — the raw counters are still well-defined.\n const nowUsable = Number.isFinite(nowMs);\n const ageMs =\n !nowUsable || lastAccessedMs === null ? 0 : Math.max(0, nowMs - lastAccessedMs);\n const factor = nowUsable ? decayFactor(ageMs, input.halfLifeMs) : 1;\n\n const sEff = rawS * factor;\n const fEff = rawF * factor;\n\n // Laplace smoothing: Beta(1,1) prior ⇒ (s+1) / (s+f+2).\n // This is equivalent to adding one imaginary success + one imaginary\n // failure before computing the ratio, and guarantees a finite non-zero\n // result even when both counters are 0.\n const pSuccess = (sEff + 1) / (sEff + fEff + 2);\n\n // Clamp defensively — floating-point noise can push (s+1)/(s+f+2) a hair\n // outside [0, 1] when `factor` is very small, and the callers (recall\n // score multiplication) expect a well-formed probability.\n const clamped = Math.max(0, Math.min(1, pSuccess));\n\n return {\n score: clamped,\n p_success: clamped,\n confidence: sEff + fEff,\n };\n}\n"],"mappings":";AA4GA,IAAM,cAAc;AAYpB,SAAS,gBAAgB,OAAwE;AAE/F,MAAI,UAAU,OAAW,QAAO,EAAE,IAAI,MAAM,OAAO,EAAE;AACrD,MAAI,OAAO,UAAU,SAAU,QAAO,EAAE,IAAI,MAAM;AAClD,MAAI,CAAC,OAAO,SAAS,KAAK,EAAG,QAAO,EAAE,IAAI,MAAM;AAChD,MAAI,QAAQ,EAAG,QAAO,EAAE,IAAI,MAAM;AAMlC,MAAI,CAAC,OAAO,UAAU,KAAK,EAAG,QAAO,EAAE,IAAI,MAAM;AAKjD,MAAI,QAAQ,YAAa,QAAO,EAAE,IAAI,MAAM;AAC5C,SAAO,EAAE,IAAI,MAAM,MAAM;AAC3B;AAMA,SAAS,oBAAoB,cAAwD;AACnF,MAAI,CAAC,aAAc,QAAO;AAC1B,QAAM,SAAS,KAAK,MAAM,YAAY;AACtC,MAAI,CAAC,OAAO,SAAS,MAAM,EAAG,QAAO;AACrC,SAAO;AACT;AAOA,SAAS,YAAY,OAAe,YAAwC;AAC1E,MAAI,OAAO,eAAe,SAAU,QAAO;AAC3C,MAAI,CAAC,OAAO,SAAS,UAAU,EAAG,QAAO;AACzC,MAAI,cAAc,EAAG,QAAO;AAC5B,MAAI,SAAS,EAAG,QAAO;AACvB,SAAO,KAAK,IAAI,GAAG,CAAC,QAAQ,UAAU;AACxC;AASO,SAAS,mBAAmB,OAAmD;AACpF,QAAM,SAAS,gBAAgB,MAAM,UAAU;AAC/C,QAAM,SAAS,gBAAgB,MAAM,OAAO;AAK5C,MAAI,CAAC,OAAO,MAAM,CAAC,OAAO,IAAI;AAC5B,WAAO,EAAE,OAAO,KAAK,WAAW,KAAK,YAAY,EAAE;AAAA,EACrD;AACA,QAAM,OAAO,OAAO;AACpB,QAAM,OAAO,OAAO;AAEpB,QAAM,iBAAiB,oBAAoB,MAAM,YAAY;AAC7D,QAAM,QAAQ,MAAM,IAAI,QAAQ;AAKhC,QAAM,YAAY,OAAO,SAAS,KAAK;AACvC,QAAM,QACJ,CAAC,aAAa,mBAAmB,OAAO,IAAI,KAAK,IAAI,GAAG,QAAQ,cAAc;AAChF,QAAM,SAAS,YAAY,YAAY,OAAO,MAAM,UAAU,IAAI;AAElE,QAAM,OAAO,OAAO;AACpB,QAAM,OAAO,OAAO;AAMpB,QAAM,YAAY,OAAO,MAAM,OAAO,OAAO;AAK7C,QAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,QAAQ,CAAC;AAEjD,SAAO;AAAA,IACL,OAAO;AAAA,IACP,WAAW;AAAA,IACX,YAAY,OAAO;AAAA,EACrB;AACF;","names":[]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
promoteSemanticRuleFromMemory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VDX363PS.js";
|
|
4
4
|
import {
|
|
5
5
|
buildResumeBundleFromState,
|
|
6
6
|
getResumeBundleStatus,
|
|
7
7
|
recordResumeBundle
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KUB6JU6H.js";
|
|
9
|
+
import {
|
|
10
|
+
parseXrayCliOptions
|
|
11
|
+
} from "./chunk-PVPWZSSI.js";
|
|
9
12
|
import {
|
|
10
13
|
listNamespaces,
|
|
11
14
|
runBenchmarkRecall,
|
|
@@ -16,7 +19,7 @@ import {
|
|
|
16
19
|
runOperatorRepair,
|
|
17
20
|
runOperatorSetup,
|
|
18
21
|
verifyNamespaces
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-B5WXLVDY.js";
|
|
20
23
|
import {
|
|
21
24
|
compareVersions
|
|
22
25
|
} from "./chunk-HL4DB7TO.js";
|
|
@@ -25,16 +28,14 @@ import {
|
|
|
25
28
|
} from "./chunk-ZPKBYX2F.js";
|
|
26
29
|
import {
|
|
27
30
|
RoutingRulesStore,
|
|
31
|
+
expandTildePath,
|
|
28
32
|
isReplayRole,
|
|
29
33
|
isReplaySource,
|
|
30
34
|
normalizeReplaySessionKey,
|
|
31
35
|
parseIsoOffsetTimestamp,
|
|
32
36
|
parseIsoTimestamp,
|
|
33
37
|
validateReplayTurn
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import {
|
|
36
|
-
searchVerifiedEpisodes
|
|
37
|
-
} from "./chunk-6UJ47TVX.js";
|
|
38
|
+
} from "./chunk-EPQJM2GC.js";
|
|
38
39
|
import {
|
|
39
40
|
getUtilityLearningStatus,
|
|
40
41
|
learnUtilityPromotionWeights
|
|
@@ -43,12 +44,15 @@ import {
|
|
|
43
44
|
getUtilityTelemetryStatus,
|
|
44
45
|
recordUtilityTelemetryEvent
|
|
45
46
|
} from "./chunk-3QKK7QOS.js";
|
|
47
|
+
import {
|
|
48
|
+
searchVerifiedEpisodes
|
|
49
|
+
} from "./chunk-CUPFXL3J.js";
|
|
46
50
|
import {
|
|
47
51
|
ThreadingManager
|
|
48
52
|
} from "./chunk-JRNQ3RNA.js";
|
|
49
53
|
import {
|
|
50
54
|
searchVerifiedSemanticRules
|
|
51
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-SPI27QT6.js";
|
|
52
56
|
import {
|
|
53
57
|
getWorkProductLedgerStatus,
|
|
54
58
|
recordWorkProductLedgerEntry,
|
|
@@ -75,7 +79,7 @@ import {
|
|
|
75
79
|
} from "./chunk-HMDCOMYU.js";
|
|
76
80
|
import {
|
|
77
81
|
rescoreMemoryImportance
|
|
78
|
-
} from "./chunk-
|
|
82
|
+
} from "./chunk-JXS5PDQ7.js";
|
|
79
83
|
import {
|
|
80
84
|
launchProcess
|
|
81
85
|
} from "./chunk-LK6SGL53.js";
|
|
@@ -91,21 +95,21 @@ import {
|
|
|
91
95
|
runEvalStoredBaselineCiGate,
|
|
92
96
|
validateEvalBenchmarkPack
|
|
93
97
|
} from "./chunk-K6WK37A6.js";
|
|
94
|
-
import {
|
|
95
|
-
applyCommitmentLedgerLifecycle,
|
|
96
|
-
getCommitmentLedgerStatus,
|
|
97
|
-
recordCommitmentLedgerEntry,
|
|
98
|
-
transitionCommitmentLedgerEntryState
|
|
99
|
-
} from "./chunk-FYIYMQ5N.js";
|
|
100
98
|
import {
|
|
101
99
|
parseConfig
|
|
102
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-BK2EFTE2.js";
|
|
103
101
|
import {
|
|
104
102
|
getCueAnchorStoreStatus
|
|
105
103
|
} from "./chunk-C6QPK5GG.js";
|
|
106
104
|
import {
|
|
107
105
|
analyzeGraphHealth
|
|
108
106
|
} from "./chunk-C2EFFULQ.js";
|
|
107
|
+
import {
|
|
108
|
+
applyCommitmentLedgerLifecycle,
|
|
109
|
+
getCommitmentLedgerStatus,
|
|
110
|
+
recordCommitmentLedgerEntry,
|
|
111
|
+
transitionCommitmentLedgerEntryState
|
|
112
|
+
} from "./chunk-FYIYMQ5N.js";
|
|
109
113
|
import {
|
|
110
114
|
chunkContent
|
|
111
115
|
} from "./chunk-4WMCPJWX.js";
|
|
@@ -114,23 +118,28 @@ import {
|
|
|
114
118
|
} from "./chunk-NGAVDO7E.js";
|
|
115
119
|
import {
|
|
116
120
|
EngramAccessHttpServer
|
|
117
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-DFTTJYSO.js";
|
|
118
122
|
import {
|
|
119
123
|
EngramMcpServer
|
|
120
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-HK3FGIEW.js";
|
|
121
125
|
import {
|
|
122
126
|
resolveHomeDir
|
|
123
127
|
} from "./chunk-MARWOCVP.js";
|
|
124
128
|
import {
|
|
125
129
|
EngramAccessService,
|
|
126
130
|
WorkStorage
|
|
127
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-GKFXUTJ2.js";
|
|
132
|
+
import {
|
|
133
|
+
parseRecallExplainFormat,
|
|
134
|
+
renderRecallExplain,
|
|
135
|
+
renderXray
|
|
136
|
+
} from "./chunk-ZAIM4TUE.js";
|
|
128
137
|
import {
|
|
129
138
|
listMemoryGovernanceRuns,
|
|
130
139
|
readMemoryGovernanceRunArtifact,
|
|
131
140
|
restoreMemoryGovernanceRun,
|
|
132
141
|
runMemoryGovernance
|
|
133
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-3OGMS3PE.js";
|
|
134
143
|
import {
|
|
135
144
|
getTrustZoneStoreStatus,
|
|
136
145
|
promoteTrustZoneRecord,
|
|
@@ -139,13 +148,20 @@ import {
|
|
|
139
148
|
import {
|
|
140
149
|
selectRouteRule,
|
|
141
150
|
validateRouteTarget
|
|
142
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-2LGMW3DJ.js";
|
|
143
152
|
import {
|
|
144
153
|
getCausalTrajectoryStoreStatus
|
|
145
|
-
} from "./chunk-
|
|
154
|
+
} from "./chunk-RBBWYEFJ.js";
|
|
146
155
|
import {
|
|
147
156
|
StorageManager
|
|
148
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-F5VP6YCB.js";
|
|
158
|
+
import {
|
|
159
|
+
MEMORY_LIFECYCLE_EVENT_SORT_ORDER,
|
|
160
|
+
buildLifecycleEventsForMemory,
|
|
161
|
+
inferMemoryStatus,
|
|
162
|
+
sortMemoryLifecycleEvents,
|
|
163
|
+
toMemoryPathRel
|
|
164
|
+
} from "./chunk-TP4FZJIZ.js";
|
|
149
165
|
import {
|
|
150
166
|
normalizeProjectionPreview,
|
|
151
167
|
normalizeProjectionTags
|
|
@@ -162,13 +178,6 @@ import {
|
|
|
162
178
|
readProjectedGovernanceRecord,
|
|
163
179
|
readProjectedNativeKnowledgeChunks
|
|
164
180
|
} from "./chunk-BOUYNNYD.js";
|
|
165
|
-
import {
|
|
166
|
-
MEMORY_LIFECYCLE_EVENT_SORT_ORDER,
|
|
167
|
-
buildLifecycleEventsForMemory,
|
|
168
|
-
inferMemoryStatus,
|
|
169
|
-
sortMemoryLifecycleEvents,
|
|
170
|
-
toMemoryPathRel
|
|
171
|
-
} from "./chunk-TP4FZJIZ.js";
|
|
172
181
|
|
|
173
182
|
// src/cli.ts
|
|
174
183
|
import path19 from "path";
|
|
@@ -3785,13 +3794,6 @@ function isWorkTaskPriority(value) {
|
|
|
3785
3794
|
function isWorkProjectStatus(value) {
|
|
3786
3795
|
return value === "active" || value === "on_hold" || value === "completed" || value === "archived";
|
|
3787
3796
|
}
|
|
3788
|
-
function expandTildePath(p) {
|
|
3789
|
-
if (p === "~") return resolveHomeDir();
|
|
3790
|
-
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
3791
|
-
return path19.join(resolveHomeDir(), p.slice(2));
|
|
3792
|
-
}
|
|
3793
|
-
return p;
|
|
3794
|
-
}
|
|
3795
3797
|
async function runTrainingExportCliCommand(opts) {
|
|
3796
3798
|
const expandedMemoryDir = expandTildePath(opts.memoryDir);
|
|
3797
3799
|
const expandedOutput = expandTildePath(opts.output);
|
|
@@ -4121,7 +4123,7 @@ async function runSemanticRulePromoteCliCommand(options) {
|
|
|
4121
4123
|
});
|
|
4122
4124
|
}
|
|
4123
4125
|
async function runCompoundingPromoteCliCommand(options) {
|
|
4124
|
-
const { CompoundingEngine } = await import("./engine-
|
|
4126
|
+
const { CompoundingEngine } = await import("./engine-F3GOXGE5.js");
|
|
4125
4127
|
const config = parseConfig({
|
|
4126
4128
|
memoryDir: options.memoryDir,
|
|
4127
4129
|
qmdEnabled: false,
|
|
@@ -5531,6 +5533,68 @@ function registerCli(api, orchestrator) {
|
|
|
5531
5533
|
}
|
|
5532
5534
|
}
|
|
5533
5535
|
});
|
|
5536
|
+
cmd.command("judge-stats").description(
|
|
5537
|
+
"Show extraction-judge verdict stats from the observation ledger"
|
|
5538
|
+
).option("--since <iso>", "Start timestamp (inclusive, ISO-8601)").option("--until <iso>", "End timestamp (exclusive, ISO-8601)").option("--json", "Emit machine-readable JSON only").action(async (...args) => {
|
|
5539
|
+
const options = args[0] ?? {};
|
|
5540
|
+
const sinceRaw = typeof options.since === "string" ? options.since : void 0;
|
|
5541
|
+
const untilRaw = typeof options.until === "string" ? options.until : void 0;
|
|
5542
|
+
const sinceMs = sinceRaw ? Date.parse(sinceRaw) : void 0;
|
|
5543
|
+
const untilMs = untilRaw ? Date.parse(untilRaw) : void 0;
|
|
5544
|
+
if (sinceRaw && !Number.isFinite(sinceMs)) {
|
|
5545
|
+
throw new Error(
|
|
5546
|
+
`Invalid --since value: ${sinceRaw}. Use ISO-8601, e.g. 2026-04-01T00:00:00Z`
|
|
5547
|
+
);
|
|
5548
|
+
}
|
|
5549
|
+
if (untilRaw && !Number.isFinite(untilMs)) {
|
|
5550
|
+
throw new Error(
|
|
5551
|
+
`Invalid --until value: ${untilRaw}. Use ISO-8601, e.g. 2026-04-15T00:00:00Z`
|
|
5552
|
+
);
|
|
5553
|
+
}
|
|
5554
|
+
const { readJudgeVerdictStats } = await import("./extraction-judge-telemetry.js");
|
|
5555
|
+
const stats = await readJudgeVerdictStats(
|
|
5556
|
+
orchestrator.config.memoryDir,
|
|
5557
|
+
{
|
|
5558
|
+
...typeof sinceMs === "number" && Number.isFinite(sinceMs) ? { sinceMs } : {},
|
|
5559
|
+
...typeof untilMs === "number" && Number.isFinite(untilMs) ? { untilMs } : {}
|
|
5560
|
+
}
|
|
5561
|
+
);
|
|
5562
|
+
if (options.json === true) {
|
|
5563
|
+
console.log(JSON.stringify(stats, null, 2));
|
|
5564
|
+
return;
|
|
5565
|
+
}
|
|
5566
|
+
console.log("=== Extraction Judge Verdict Stats ===\n");
|
|
5567
|
+
console.log(`Total verdicts: ${stats.total}`);
|
|
5568
|
+
if (stats.total === 0) {
|
|
5569
|
+
if (!orchestrator.config.extractionJudgeTelemetryEnabled) {
|
|
5570
|
+
console.log(
|
|
5571
|
+
"\nNote: extractionJudgeTelemetryEnabled is OFF. Enable it in plugin config to collect verdict telemetry."
|
|
5572
|
+
);
|
|
5573
|
+
}
|
|
5574
|
+
return;
|
|
5575
|
+
}
|
|
5576
|
+
console.log(
|
|
5577
|
+
` accept: ${stats.accept} (${(stats.accept / stats.total * 100).toFixed(1)}%)`
|
|
5578
|
+
);
|
|
5579
|
+
console.log(
|
|
5580
|
+
` reject: ${stats.reject} (${(stats.reject / stats.total * 100).toFixed(1)}%)`
|
|
5581
|
+
);
|
|
5582
|
+
console.log(
|
|
5583
|
+
` defer: ${stats.defer} (${(stats.deferRate * 100).toFixed(1)}%)`
|
|
5584
|
+
);
|
|
5585
|
+
if (stats.deferCapTriggered > 0) {
|
|
5586
|
+
console.log(
|
|
5587
|
+
` of which ${stats.deferCapTriggered} cap-rejected (defer \u2192 reject)`
|
|
5588
|
+
);
|
|
5589
|
+
}
|
|
5590
|
+
console.log(` mean elapsed: ${stats.meanElapsedMs.toFixed(1)} ms`);
|
|
5591
|
+
if (stats.firstTs && stats.lastTs) {
|
|
5592
|
+
console.log(` window: ${stats.firstTs} \u2026 ${stats.lastTs}`);
|
|
5593
|
+
}
|
|
5594
|
+
if (stats.malformed > 0) {
|
|
5595
|
+
console.log(` malformed rows skipped: ${stats.malformed}`);
|
|
5596
|
+
}
|
|
5597
|
+
});
|
|
5534
5598
|
cmd.command("setup").description("Validate config, scaffold directories, and print first-run next steps").option("--install-capture-instructions", "Create workspace MEMORY.md when explicit capture is enabled and missing").option("--preview-capture-instructions", "Print the managed explicit-capture instruction snippet without writing files").option("--remove-capture-instructions", "Remove the managed explicit-capture instruction snippet from MEMORY.md").option("--json", "Emit machine-readable JSON only").action(async (...args) => {
|
|
5535
5599
|
const options = args[0] ?? {};
|
|
5536
5600
|
const captureInstructionsMode = options.removeCaptureInstructions === true ? "remove" : options.previewCaptureInstructions === true ? "preview" : options.installCaptureInstructions === true ? "install" : void 0;
|
|
@@ -5950,6 +6014,59 @@ function registerCli(api, orchestrator) {
|
|
|
5950
6014
|
}
|
|
5951
6015
|
if (!reportHasMachineReadableOutput(options)) console.log("OK");
|
|
5952
6016
|
});
|
|
6017
|
+
cmd.command("recall-explain").description(
|
|
6018
|
+
"Show tier explain for the most recent recall (or a specific session)"
|
|
6019
|
+
).option(
|
|
6020
|
+
"--session <key>",
|
|
6021
|
+
"Session key to look up; omit to use the most recent snapshot"
|
|
6022
|
+
).option("--format <fmt>", "Output format: text (default) or json", "text").action(async (...args) => {
|
|
6023
|
+
const options = args[0] ?? {};
|
|
6024
|
+
const format = parseRecallExplainFormat(options.format);
|
|
6025
|
+
await orchestrator.lastRecall.load();
|
|
6026
|
+
const sessionKey = typeof options.session === "string" && options.session.length > 0 ? options.session : void 0;
|
|
6027
|
+
let snapshot = null;
|
|
6028
|
+
try {
|
|
6029
|
+
snapshot = sessionKey ? orchestrator.lastRecall.get(sessionKey) : orchestrator.lastRecall.getMostRecent();
|
|
6030
|
+
} catch {
|
|
6031
|
+
snapshot = null;
|
|
6032
|
+
}
|
|
6033
|
+
console.log(renderRecallExplain(snapshot, format));
|
|
6034
|
+
});
|
|
6035
|
+
cmd.command("xray").description(
|
|
6036
|
+
"Run a recall with X-ray capture and print the unified snapshot (tier + audit + MMR + filters). Part of #570."
|
|
6037
|
+
).argument("<query>", "Query to recall against").option(
|
|
6038
|
+
"--format <fmt>",
|
|
6039
|
+
"Output format: text (default), markdown, or json",
|
|
6040
|
+
"text"
|
|
6041
|
+
).option(
|
|
6042
|
+
"--budget <chars>",
|
|
6043
|
+
"Override recall character budget for this call (positive integer)"
|
|
6044
|
+
).option(
|
|
6045
|
+
"--namespace <ns>",
|
|
6046
|
+
"Namespace to scope the recall to (defaults to configured namespace)"
|
|
6047
|
+
).option(
|
|
6048
|
+
"--out <path>",
|
|
6049
|
+
"Write the rendered snapshot to a file instead of stdout"
|
|
6050
|
+
).action(async (...args) => {
|
|
6051
|
+
const parsed = parseXrayCliOptions(
|
|
6052
|
+
args[0],
|
|
6053
|
+
args[1] ?? {}
|
|
6054
|
+
);
|
|
6055
|
+
const xrayService = new EngramAccessService(orchestrator);
|
|
6056
|
+
const response = await xrayService.recallXray({
|
|
6057
|
+
query: parsed.query,
|
|
6058
|
+
...parsed.namespace ? { namespace: parsed.namespace } : {},
|
|
6059
|
+
...parsed.budget !== void 0 ? { budget: parsed.budget } : {}
|
|
6060
|
+
});
|
|
6061
|
+
const snapshot = response.snapshotFound ? response.snapshot ?? null : null;
|
|
6062
|
+
const rendered = renderXray(snapshot, parsed.format);
|
|
6063
|
+
if (parsed.outPath) {
|
|
6064
|
+
const { writeFile: fsWriteFile } = await import("fs/promises");
|
|
6065
|
+
await fsWriteFile(expandTildePath(parsed.outPath), rendered, "utf8");
|
|
6066
|
+
} else {
|
|
6067
|
+
console.log(rendered);
|
|
6068
|
+
}
|
|
6069
|
+
});
|
|
5953
6070
|
cmd.command("benchmark-validate").description("Validate a benchmark manifest file or pack directory without importing it").argument("<path>", "Path to a benchmark manifest JSON file or a directory with manifest.json").action(async (...args) => {
|
|
5954
6071
|
const inputPath = args[0];
|
|
5955
6072
|
const summary = await runBenchmarkValidateCliCommand({
|
|
@@ -7336,6 +7453,36 @@ Clusters found: ${result.clustersFound}`);
|
|
|
7336
7453
|
Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=${result.memoriesConsolidated}, archived=${result.memoriesArchived}, errors=${result.errors}`
|
|
7337
7454
|
);
|
|
7338
7455
|
});
|
|
7456
|
+
cmd.command("consolidate-undo <target>").description(
|
|
7457
|
+
"Undo a consolidation: restore source memories from their derived_from snapshots and archive the target"
|
|
7458
|
+
).option("--dry-run", "Show the restore plan without modifying files").action(async (...args) => {
|
|
7459
|
+
const rawTarget = typeof args[0] === "string" ? args[0] : "";
|
|
7460
|
+
const options = args[1] ?? {};
|
|
7461
|
+
const dryRun = options.dryRun === true;
|
|
7462
|
+
if (!rawTarget) {
|
|
7463
|
+
console.error("consolidate-undo: missing <target> argument");
|
|
7464
|
+
process.exitCode = 1;
|
|
7465
|
+
return;
|
|
7466
|
+
}
|
|
7467
|
+
const expandedTarget = expandTildePath(rawTarget);
|
|
7468
|
+
const targetPath = path19.isAbsolute(expandedTarget) ? expandedTarget : path19.join(orchestrator.config.memoryDir, expandedTarget);
|
|
7469
|
+
const { runConsolidationUndo, formatConsolidationUndoResult } = await import("./consolidation-undo.js");
|
|
7470
|
+
const result = await runConsolidationUndo({
|
|
7471
|
+
storage: orchestrator.storage,
|
|
7472
|
+
memoryDir: orchestrator.config.memoryDir,
|
|
7473
|
+
targetPath,
|
|
7474
|
+
versioning: {
|
|
7475
|
+
enabled: orchestrator.config.versioningEnabled,
|
|
7476
|
+
maxVersionsPerPage: orchestrator.config.versioningMaxPerPage,
|
|
7477
|
+
sidecarDir: orchestrator.config.versioningSidecarDir
|
|
7478
|
+
},
|
|
7479
|
+
dryRun
|
|
7480
|
+
});
|
|
7481
|
+
console.log(formatConsolidationUndoResult(result));
|
|
7482
|
+
if (result.error) {
|
|
7483
|
+
process.exitCode = 1;
|
|
7484
|
+
}
|
|
7485
|
+
});
|
|
7339
7486
|
cmd.command("questions").description("List open questions from memory extraction").option("-a, --all", "Show all questions including resolved").action(async (...args) => {
|
|
7340
7487
|
const options = args[0] ?? {};
|
|
7341
7488
|
const showAll = options.all === true;
|
|
@@ -7802,15 +7949,24 @@ Semantic consolidation complete. clusters=${result.clustersFound}, consolidated=
|
|
|
7802
7949
|
});
|
|
7803
7950
|
reviewCmd.command("scan").description("Run an on-demand contradiction scan").option("--namespace <ns>", "Namespace to scan").action(async (...args) => {
|
|
7804
7951
|
const options = args[0] ?? {};
|
|
7805
|
-
const { runContradictionScan } = await import("./contradiction-scan-
|
|
7952
|
+
const { runContradictionScan } = await import("./contradiction-scan-E3GJTI4F.js");
|
|
7806
7953
|
console.log("Running contradiction scan...");
|
|
7807
7954
|
const result = await runContradictionScan({
|
|
7808
7955
|
storage: orchestrator.storage,
|
|
7809
7956
|
config: orchestrator.config,
|
|
7810
7957
|
memoryDir: orchestrator.config.memoryDir,
|
|
7811
|
-
|
|
7958
|
+
embeddingLookupFactory: (storage) => {
|
|
7959
|
+
if (!orchestrator.config.embeddingFallbackEnabled) return void 0;
|
|
7960
|
+
return async (content, limit) => {
|
|
7961
|
+
try {
|
|
7962
|
+
return await orchestrator.semanticDedupLookup(content, limit, storage);
|
|
7963
|
+
} catch {
|
|
7964
|
+
return [];
|
|
7965
|
+
}
|
|
7966
|
+
};
|
|
7967
|
+
},
|
|
7812
7968
|
localLlm: orchestrator.localLlm ?? null,
|
|
7813
|
-
fallbackLlm: null,
|
|
7969
|
+
fallbackLlm: orchestrator.fastGatewayLlm ?? null,
|
|
7814
7970
|
namespace: options.namespace
|
|
7815
7971
|
});
|
|
7816
7972
|
console.log(`Scan complete in ${result.elapsedMs}ms:`);
|
|
@@ -7942,4 +8098,4 @@ export {
|
|
|
7942
8098
|
resolveMemoryDirForNamespace,
|
|
7943
8099
|
registerCli
|
|
7944
8100
|
};
|
|
7945
|
-
//# sourceMappingURL=chunk-
|
|
8101
|
+
//# sourceMappingURL=chunk-INXV5JBT.js.map
|