@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
package/dist/index.js
CHANGED
|
@@ -10,6 +10,19 @@ import {
|
|
|
10
10
|
revokeToken,
|
|
11
11
|
saveTokenStore
|
|
12
12
|
} from "./chunk-O5ETUNBT.js";
|
|
13
|
+
import {
|
|
14
|
+
runGraphRecall
|
|
15
|
+
} from "./chunk-DGVM5SFL.js";
|
|
16
|
+
import {
|
|
17
|
+
DEFAULT_PPR_DAMPING,
|
|
18
|
+
DEFAULT_PPR_ITERATIONS,
|
|
19
|
+
DEFAULT_PPR_TOLERANCE,
|
|
20
|
+
buildGraphFromMemories,
|
|
21
|
+
extractGraphEdges,
|
|
22
|
+
isEdgeType,
|
|
23
|
+
isNodeType,
|
|
24
|
+
queryGraph
|
|
25
|
+
} from "./chunk-64NJRYU2.js";
|
|
13
26
|
import {
|
|
14
27
|
clearBulkImportSources,
|
|
15
28
|
clearTrainingExportAdapters,
|
|
@@ -27,117 +40,184 @@ import {
|
|
|
27
40
|
runBulkImportCliCommand,
|
|
28
41
|
runBulkImportPipeline,
|
|
29
42
|
validateImportTurn
|
|
30
|
-
} from "./chunk-
|
|
31
|
-
import "./chunk-
|
|
32
|
-
import "./chunk-
|
|
33
|
-
import
|
|
43
|
+
} from "./chunk-INXV5JBT.js";
|
|
44
|
+
import "./chunk-VDX363PS.js";
|
|
45
|
+
import "./chunk-KUB6JU6H.js";
|
|
46
|
+
import {
|
|
47
|
+
parseXrayBudgetFlag,
|
|
48
|
+
parseXrayCliOptions
|
|
49
|
+
} from "./chunk-PVPWZSSI.js";
|
|
50
|
+
import "./chunk-B5WXLVDY.js";
|
|
34
51
|
import "./chunk-HL4DB7TO.js";
|
|
52
|
+
import "./chunk-ULYOGL6R.js";
|
|
35
53
|
import "./chunk-ZPKBYX2F.js";
|
|
36
54
|
import "./chunk-3SLRNYNG.js";
|
|
37
55
|
import "./chunk-LIRZNNUP.js";
|
|
38
56
|
import "./chunk-Y4Z4I6WK.js";
|
|
39
57
|
import {
|
|
58
|
+
reportBufferSurpriseDistribution
|
|
59
|
+
} from "./chunk-ASAITVLA.js";
|
|
60
|
+
import {
|
|
61
|
+
DEFAULT_SURPRISE_K,
|
|
62
|
+
computeSurprise
|
|
63
|
+
} from "./chunk-5JRF2PZA.js";
|
|
64
|
+
import {
|
|
65
|
+
getMemoryForActiveMemory,
|
|
66
|
+
recallForActiveMemory
|
|
67
|
+
} from "./chunk-G4SK7DSQ.js";
|
|
68
|
+
import "./chunk-6MKAMLQL.js";
|
|
69
|
+
import {
|
|
70
|
+
DEFAULT_TAXONOMY,
|
|
40
71
|
Orchestrator,
|
|
72
|
+
branchNamespaceName,
|
|
41
73
|
buildProcedureRecallSection,
|
|
42
74
|
decideSemanticDedup,
|
|
43
75
|
defaultWorkspaceDir,
|
|
76
|
+
describeCodingScope,
|
|
77
|
+
generateResolverDocument,
|
|
78
|
+
getTaxonomyDir,
|
|
79
|
+
getTaxonomyFilePath,
|
|
80
|
+
loadTaxonomy,
|
|
44
81
|
migrateFromEngram,
|
|
82
|
+
normalizeOriginUrl,
|
|
83
|
+
projectNamespaceName,
|
|
84
|
+
resolveCodingNamespaceOverlay,
|
|
85
|
+
resolveGitContext,
|
|
45
86
|
rollbackFromEngramMigration,
|
|
46
|
-
sanitizeSessionKeyForFilename
|
|
47
|
-
|
|
48
|
-
|
|
87
|
+
sanitizeSessionKeyForFilename,
|
|
88
|
+
saveTaxonomy,
|
|
89
|
+
stableHash,
|
|
90
|
+
validateSlug,
|
|
91
|
+
validateTaxonomy
|
|
92
|
+
} from "./chunk-VYM3VWOF.js";
|
|
93
|
+
import "./chunk-RGLL5SPU.js";
|
|
94
|
+
import "./chunk-UHGBNIOS.js";
|
|
49
95
|
import "./chunk-FSFEQI74.js";
|
|
50
96
|
import "./chunk-W6SL7OFG.js";
|
|
51
97
|
import "./chunk-Z5AAYHUC.js";
|
|
52
98
|
import "./chunk-S75M5ZRK.js";
|
|
53
99
|
import "./chunk-TPB3I2AC.js";
|
|
54
|
-
import "./chunk-UHGBNIOS.js";
|
|
55
|
-
import "./chunk-BTY5RRRF.js";
|
|
56
|
-
import "./chunk-ETOW6ACV.js";
|
|
57
|
-
import "./chunk-KVE7R4CG.js";
|
|
58
100
|
import "./chunk-JR4ZC3G4.js";
|
|
101
|
+
import "./chunk-ZEM3OK2K.js";
|
|
102
|
+
import "./chunk-ETOW6ACV.js";
|
|
103
|
+
import "./chunk-5NPGSAVB.js";
|
|
59
104
|
import "./chunk-C7VW7C3F.js";
|
|
60
105
|
import "./chunk-K4FLSOR5.js";
|
|
61
106
|
import "./chunk-V3RXWQIE.js";
|
|
62
107
|
import "./chunk-5IZL4DCV.js";
|
|
108
|
+
import "./chunk-VBVG2M5G.js";
|
|
109
|
+
import "./chunk-KVBLZUKV.js";
|
|
110
|
+
import "./chunk-X7XN6YU4.js";
|
|
111
|
+
import {
|
|
112
|
+
DEFAULT_REASONING_TRACE_BOOST,
|
|
113
|
+
applyReasoningTraceBoost,
|
|
114
|
+
isReasoningTracePath,
|
|
115
|
+
looksLikeProblemSolvingQuery
|
|
116
|
+
} from "./chunk-ZZTOURJI.js";
|
|
63
117
|
import "./chunk-YDBIWGNI.js";
|
|
64
118
|
import "./chunk-7DHTMOND.js";
|
|
65
|
-
import "./chunk-S4LX5EBI.js";
|
|
66
|
-
import "./chunk-X7XN6YU4.js";
|
|
67
|
-
import "./chunk-5NPGSAVB.js";
|
|
68
119
|
import "./chunk-YCN4BVDK.js";
|
|
69
120
|
import "./chunk-D654IBA6.js";
|
|
70
121
|
import "./chunk-H63EDPFJ.js";
|
|
122
|
+
import {
|
|
123
|
+
applyMemoryWorthFilter,
|
|
124
|
+
buildMemoryWorthCounterMap
|
|
125
|
+
} from "./chunk-3GPTTA4J.js";
|
|
126
|
+
import {
|
|
127
|
+
computeMemoryWorth
|
|
128
|
+
} from "./chunk-IISBCCWR.js";
|
|
71
129
|
import {
|
|
72
130
|
hasBroadGraphIntent,
|
|
73
131
|
inferIntentFromText,
|
|
74
132
|
intentCompatibilityScore,
|
|
75
133
|
isTaskInitiationIntent,
|
|
76
134
|
planRecallMode
|
|
77
|
-
} from "./chunk-
|
|
135
|
+
} from "./chunk-GGD5W7TB.js";
|
|
78
136
|
import "./chunk-YAZNBMNF.js";
|
|
79
|
-
import "./chunk-
|
|
80
|
-
import
|
|
81
|
-
buildEntityRecallSection
|
|
82
|
-
} from "./chunk-74JR4N5J.js";
|
|
137
|
+
import "./chunk-AJU4PJGY.js";
|
|
138
|
+
import "./chunk-DF3RVK3X.js";
|
|
83
139
|
import {
|
|
84
140
|
clearVerdictCache,
|
|
85
141
|
createVerdictCache,
|
|
142
|
+
getVerdictKind,
|
|
143
|
+
isDurableVerdict,
|
|
144
|
+
isValidCachedVerdict,
|
|
86
145
|
judgeFactDurability,
|
|
146
|
+
normalizeCachedVerdict,
|
|
87
147
|
verdictCacheSize
|
|
88
|
-
} from "./chunk-
|
|
148
|
+
} from "./chunk-C4SQJZAF.js";
|
|
89
149
|
import {
|
|
90
150
|
ExtractionEngine
|
|
91
|
-
} from "./chunk-
|
|
92
|
-
import "./chunk-
|
|
151
|
+
} from "./chunk-S3EEFKNY.js";
|
|
152
|
+
import "./chunk-NZLQTHS5.js";
|
|
153
|
+
import "./chunk-54V4BZWP.js";
|
|
93
154
|
import "./chunk-NBNN5GOB.js";
|
|
94
|
-
import "./chunk-UPMD5XND.js";
|
|
95
155
|
import "./chunk-FEMOX5AD.js";
|
|
156
|
+
import "./chunk-JL2PU6AI.js";
|
|
96
157
|
import "./chunk-VEWZZM3H.js";
|
|
97
|
-
import
|
|
158
|
+
import {
|
|
159
|
+
resolveCategory
|
|
160
|
+
} from "./chunk-6AUUAZEX.js";
|
|
161
|
+
import {
|
|
162
|
+
FILTER_LABELS,
|
|
163
|
+
isDirectAnswerEligible
|
|
164
|
+
} from "./chunk-Y4FHOFJ2.js";
|
|
165
|
+
import "./chunk-ALXMCZEU.js";
|
|
166
|
+
import {
|
|
167
|
+
buildEntityRecallSection
|
|
168
|
+
} from "./chunk-FVA6TGI3.js";
|
|
169
|
+
import {
|
|
170
|
+
buildExtensionsFooterForSummary,
|
|
171
|
+
loadDaySummaryPrompt
|
|
172
|
+
} from "./chunk-GZCUW5IC.js";
|
|
173
|
+
import {
|
|
174
|
+
expandTildePath
|
|
175
|
+
} from "./chunk-EPQJM2GC.js";
|
|
98
176
|
import "./chunk-PYXS46O7.js";
|
|
99
177
|
import "./chunk-3QKK7QOS.js";
|
|
100
|
-
import "./chunk-
|
|
178
|
+
import "./chunk-CUPFXL3J.js";
|
|
101
179
|
import "./chunk-JRNQ3RNA.js";
|
|
102
|
-
import "./chunk-
|
|
180
|
+
import "./chunk-SPI27QT6.js";
|
|
103
181
|
import "./chunk-CULXMQJH.js";
|
|
104
182
|
import "./chunk-E6K4NIEU.js";
|
|
105
|
-
import "./chunk-EABGC2TL.js";
|
|
106
|
-
import "./chunk-LOBRX7VD.js";
|
|
107
183
|
import {
|
|
108
184
|
LanceDbBackend,
|
|
109
185
|
MeilisearchBackend,
|
|
110
186
|
OramaBackend
|
|
111
|
-
} from "./chunk-
|
|
187
|
+
} from "./chunk-7I7FKFZH.js";
|
|
112
188
|
import "./chunk-YRMVARQP.js";
|
|
189
|
+
import {
|
|
190
|
+
QmdClient
|
|
191
|
+
} from "./chunk-YNQKWQT4.js";
|
|
113
192
|
import {
|
|
114
193
|
LEGACY_PLUGIN_ID,
|
|
115
194
|
PLUGIN_ID,
|
|
116
195
|
resolveRemnicPluginEntry
|
|
117
196
|
} from "./chunk-U66YHYC7.js";
|
|
118
|
-
import
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
import "./chunk-
|
|
122
|
-
import "./chunk-
|
|
197
|
+
import "./chunk-EABGC2TL.js";
|
|
198
|
+
import "./chunk-LOBRX7VD.js";
|
|
199
|
+
import "./chunk-HMDCOMYU.js";
|
|
200
|
+
import "./chunk-JXS5PDQ7.js";
|
|
201
|
+
import "./chunk-LK6SGL53.js";
|
|
123
202
|
import "./chunk-7SEAZFFB.js";
|
|
124
203
|
import "./chunk-K6WK37A6.js";
|
|
125
|
-
import "./chunk-LK6SGL53.js";
|
|
126
|
-
import {
|
|
127
|
-
CODEX_THREAD_KEY_PREFIX
|
|
128
|
-
} from "./chunk-3PG3H5TD.js";
|
|
129
|
-
import "./chunk-FYIYMQ5N.js";
|
|
130
|
-
import "./chunk-2NMMFZ5T.js";
|
|
131
204
|
import {
|
|
132
205
|
coerceInstallExtension,
|
|
133
206
|
parseConfig
|
|
134
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-BK2EFTE2.js";
|
|
135
208
|
import "./chunk-Z5LAYHGJ.js";
|
|
136
209
|
import "./chunk-C6QPK5GG.js";
|
|
210
|
+
import "./chunk-C2EFFULQ.js";
|
|
137
211
|
import {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
212
|
+
CODEX_THREAD_KEY_PREFIX
|
|
213
|
+
} from "./chunk-3PG3H5TD.js";
|
|
214
|
+
import "./chunk-FYIYMQ5N.js";
|
|
215
|
+
import "./chunk-2NMMFZ5T.js";
|
|
216
|
+
import "./chunk-KVE7R4CG.js";
|
|
217
|
+
import "./chunk-4WMCPJWX.js";
|
|
218
|
+
import {
|
|
219
|
+
SmartBuffer
|
|
220
|
+
} from "./chunk-JBMSGZEQ.js";
|
|
141
221
|
import {
|
|
142
222
|
MATERIALIZE_VERSION,
|
|
143
223
|
SENTINEL_FILE,
|
|
@@ -147,7 +227,7 @@ import {
|
|
|
147
227
|
materializeForNamespace,
|
|
148
228
|
runCodexMaterialize,
|
|
149
229
|
runPostConsolidationMaterialize
|
|
150
|
-
} from "./chunk-
|
|
230
|
+
} from "./chunk-BGJGXLZ7.js";
|
|
151
231
|
import {
|
|
152
232
|
REMNIC_EXTENSIONS_TOTAL_TOKEN_LIMIT,
|
|
153
233
|
discoverMemoryExtensions,
|
|
@@ -155,28 +235,28 @@ import {
|
|
|
155
235
|
renderExtensionsFooter,
|
|
156
236
|
resolveExtensionsRoot
|
|
157
237
|
} from "./chunk-EJI5XIBB.js";
|
|
158
|
-
import
|
|
159
|
-
|
|
238
|
+
import {
|
|
239
|
+
FallbackLlmClient
|
|
240
|
+
} from "./chunk-3GXCSUXR.js";
|
|
241
|
+
import "./chunk-XZ2TIKGC.js";
|
|
242
|
+
import "./chunk-ODWDQNRE.js";
|
|
243
|
+
import "./chunk-Y27UJK6V.js";
|
|
244
|
+
import "./chunk-UZB5KHKX.js";
|
|
160
245
|
import "./chunk-6HZ6AO2P.js";
|
|
161
246
|
import "./chunk-JWPLJLDU.js";
|
|
162
247
|
import {
|
|
163
248
|
BootstrapEngine
|
|
164
249
|
} from "./chunk-N53K2EXC.js";
|
|
165
|
-
import "./chunk-URB2WSKZ.js";
|
|
166
|
-
import "./chunk-UVJFDP7P.js";
|
|
167
250
|
import "./chunk-XYIK4LF6.js";
|
|
168
|
-
import "./chunk-
|
|
169
|
-
import "./chunk-
|
|
170
|
-
import "./chunk-ODWDQNRE.js";
|
|
171
|
-
import "./chunk-Y27UJK6V.js";
|
|
172
|
-
import "./chunk-UZB5KHKX.js";
|
|
251
|
+
import "./chunk-URB2WSKZ.js";
|
|
252
|
+
import "./chunk-PVGDJXVK.js";
|
|
173
253
|
import "./chunk-NGAVDO7E.js";
|
|
174
254
|
import {
|
|
175
255
|
EngramAccessHttpServer
|
|
176
|
-
} from "./chunk-
|
|
256
|
+
} from "./chunk-DFTTJYSO.js";
|
|
177
257
|
import {
|
|
178
258
|
EngramMcpServer
|
|
179
|
-
} from "./chunk-
|
|
259
|
+
} from "./chunk-HK3FGIEW.js";
|
|
180
260
|
import {
|
|
181
261
|
buildCitationGuidance,
|
|
182
262
|
formatOaiMemCitation,
|
|
@@ -184,35 +264,46 @@ import {
|
|
|
184
264
|
sanitizeNoteForCitation
|
|
185
265
|
} from "./chunk-IQT3XTKW.js";
|
|
186
266
|
import "./chunk-MARWOCVP.js";
|
|
187
|
-
import {
|
|
188
|
-
formatZodError,
|
|
189
|
-
memoryStoreRequestSchema,
|
|
190
|
-
observeRequestSchema,
|
|
191
|
-
recallRequestSchema,
|
|
192
|
-
suggestionSubmitRequestSchema,
|
|
193
|
-
validateRequest
|
|
194
|
-
} from "./chunk-MTLYEMJB.js";
|
|
195
267
|
import {
|
|
196
268
|
EngramAccessInputError,
|
|
197
|
-
EngramAccessService
|
|
198
|
-
|
|
269
|
+
EngramAccessService,
|
|
270
|
+
computeProcedureStats,
|
|
271
|
+
formatProcedureStatsText
|
|
272
|
+
} from "./chunk-GKFXUTJ2.js";
|
|
273
|
+
import {
|
|
274
|
+
RECALL_XRAY_FORMATS,
|
|
275
|
+
parseXrayFormat,
|
|
276
|
+
renderXray,
|
|
277
|
+
renderXrayJson,
|
|
278
|
+
renderXrayMarkdown,
|
|
279
|
+
renderXrayText
|
|
280
|
+
} from "./chunk-ZAIM4TUE.js";
|
|
281
|
+
import "./chunk-SOBJ6NEY.js";
|
|
282
|
+
import "./chunk-3OGMS3PE.js";
|
|
199
283
|
import {
|
|
200
284
|
isTrustZoneName
|
|
201
285
|
} from "./chunk-EQINRHYR.js";
|
|
202
|
-
import
|
|
203
|
-
|
|
204
|
-
|
|
286
|
+
import {
|
|
287
|
+
memoryWorthOutcomeEligibleCategories,
|
|
288
|
+
recordMemoryOutcome
|
|
289
|
+
} from "./chunk-EIR5VLIH.js";
|
|
205
290
|
import "./chunk-EEQLFRUM.js";
|
|
206
291
|
import {
|
|
207
292
|
buildProcedureMarkdownBody,
|
|
208
293
|
parseProcedureStepsFromBody
|
|
209
294
|
} from "./chunk-QDW3E4RD.js";
|
|
210
|
-
import "./chunk-
|
|
295
|
+
import "./chunk-3FPTCC3Z.js";
|
|
296
|
+
import "./chunk-2LGMW3DJ.js";
|
|
297
|
+
import {
|
|
298
|
+
CrossNamespaceBudget,
|
|
299
|
+
DEFAULT_CROSS_NAMESPACE_BUDGET
|
|
300
|
+
} from "./chunk-GDFS42HT.js";
|
|
301
|
+
import "./chunk-RBBWYEFJ.js";
|
|
211
302
|
import "./chunk-DT5TVLJE.js";
|
|
303
|
+
import {
|
|
304
|
+
resolvePrincipal
|
|
305
|
+
} from "./chunk-N5AKDXAI.js";
|
|
212
306
|
import "./chunk-TBBDFYXW.js";
|
|
213
|
-
import "./chunk-DGXUHMOV.js";
|
|
214
|
-
import "./chunk-LPSF4OQH.js";
|
|
215
|
-
import "./chunk-XKECPATV.js";
|
|
216
307
|
import {
|
|
217
308
|
BRIEFING_FORMAT_ALLOWED,
|
|
218
309
|
FileCalendarSource,
|
|
@@ -225,11 +316,11 @@ import {
|
|
|
225
316
|
renderBriefingMarkdown,
|
|
226
317
|
resolveBriefingSaveDir,
|
|
227
318
|
validateBriefingFormat
|
|
228
|
-
} from "./chunk-
|
|
319
|
+
} from "./chunk-WVVA7F5A.js";
|
|
229
320
|
import {
|
|
230
321
|
StorageManager
|
|
231
|
-
} from "./chunk-
|
|
232
|
-
import "./chunk-
|
|
322
|
+
} from "./chunk-F5VP6YCB.js";
|
|
323
|
+
import "./chunk-LTCGGW2D.js";
|
|
233
324
|
import {
|
|
234
325
|
CITATION_UNKNOWN,
|
|
235
326
|
DEFAULT_CITATION_FORMAT,
|
|
@@ -241,33 +332,193 @@ import {
|
|
|
241
332
|
parseCitation,
|
|
242
333
|
stripCitation
|
|
243
334
|
} from "./chunk-4KAN3GZ3.js";
|
|
244
|
-
import {
|
|
245
|
-
createVersion,
|
|
246
|
-
diffVersions,
|
|
247
|
-
getVersion,
|
|
248
|
-
listVersions,
|
|
249
|
-
revertToVersion
|
|
250
|
-
} from "./chunk-6ZH4TU6I.js";
|
|
251
335
|
import "./chunk-6PFRXT4K.js";
|
|
252
336
|
import "./chunk-TP4FZJIZ.js";
|
|
253
337
|
import "./chunk-SCU65EZI.js";
|
|
254
338
|
import "./chunk-BOUYNNYD.js";
|
|
255
|
-
import "./chunk-QSVPYQPG.js";
|
|
256
339
|
import "./chunk-DM2T26WE.js";
|
|
340
|
+
import "./chunk-QSVPYQPG.js";
|
|
257
341
|
import "./chunk-M62O4P4T.js";
|
|
258
342
|
import "./chunk-4DJQYKMN.js";
|
|
343
|
+
import "./chunk-X6GF3FX2.js";
|
|
344
|
+
import {
|
|
345
|
+
createVersion,
|
|
346
|
+
diffVersions,
|
|
347
|
+
getVersion,
|
|
348
|
+
listVersions,
|
|
349
|
+
revertToVersion
|
|
350
|
+
} from "./chunk-FAAFWE4G.js";
|
|
259
351
|
import {
|
|
260
352
|
initLogger,
|
|
261
353
|
log
|
|
262
354
|
} from "./chunk-2ODBA7MQ.js";
|
|
355
|
+
import "./chunk-DGXUHMOV.js";
|
|
356
|
+
import "./chunk-LPSF4OQH.js";
|
|
263
357
|
import {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
} from "./chunk-G4SK7DSQ.js";
|
|
267
|
-
import "./chunk-6MKAMLQL.js";
|
|
358
|
+
AccessAuditAdapter
|
|
359
|
+
} from "./chunk-TVVEYCNW.js";
|
|
268
360
|
import {
|
|
269
|
-
|
|
270
|
-
|
|
361
|
+
DEFAULT_ANOMALY_DETECTOR_CONFIG,
|
|
362
|
+
detectRecallAnomalies,
|
|
363
|
+
normalizeQueryText
|
|
364
|
+
} from "./chunk-RFYAYKTD.js";
|
|
365
|
+
import "./chunk-LBLXEFWK.js";
|
|
366
|
+
import "./chunk-XKECPATV.js";
|
|
367
|
+
import {
|
|
368
|
+
formatZodError,
|
|
369
|
+
memoryStoreRequestSchema,
|
|
370
|
+
observeRequestSchema,
|
|
371
|
+
recallRequestSchema,
|
|
372
|
+
suggestionSubmitRequestSchema,
|
|
373
|
+
validateRequest
|
|
374
|
+
} from "./chunk-WCLICCGB.js";
|
|
375
|
+
|
|
376
|
+
// src/coding/review-context.ts
|
|
377
|
+
var REVIEW_KEYWORD_PATTERNS = [
|
|
378
|
+
/\breview\b/i,
|
|
379
|
+
/\bdiff\b/i,
|
|
380
|
+
/\bwhat changed\b/i,
|
|
381
|
+
/\blook at this pr\b/i,
|
|
382
|
+
/\bwhat('?s|\s+is)\s+in\s+this\s+(pr|patch|diff|change)\b/i,
|
|
383
|
+
/\bcode review\b/i
|
|
384
|
+
];
|
|
385
|
+
function isReviewPrompt(prompt) {
|
|
386
|
+
if (typeof prompt !== "string") return false;
|
|
387
|
+
const trimmed = prompt.trim();
|
|
388
|
+
if (!trimmed) return false;
|
|
389
|
+
return REVIEW_KEYWORD_PATTERNS.some((re) => re.test(trimmed));
|
|
390
|
+
}
|
|
391
|
+
function parseTouchedFiles(diff) {
|
|
392
|
+
if (typeof diff !== "string" || !diff.trim()) return [];
|
|
393
|
+
const touched = /* @__PURE__ */ new Set();
|
|
394
|
+
const lines = diff.split(/\r?\n/);
|
|
395
|
+
for (const line of lines) {
|
|
396
|
+
const gitPrefix = line.match(/^diff --git\s+/);
|
|
397
|
+
if (gitPrefix) {
|
|
398
|
+
const rest = line.slice(gitPrefix[0].length);
|
|
399
|
+
const paths = splitDiffGitPaths(rest);
|
|
400
|
+
if (paths) {
|
|
401
|
+
for (const raw of paths) {
|
|
402
|
+
const stripped = stripDiffPathPrefix(raw);
|
|
403
|
+
if (stripped && stripped !== "/dev/null") touched.add(stripped);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
const headerPrefix = line.match(/^(?:---|\+\+\+)[ \t]+/);
|
|
409
|
+
if (headerPrefix) {
|
|
410
|
+
const tail = line.slice(headerPrefix[0].length).replace(/[ \t]+$/, "");
|
|
411
|
+
const raw = extractSingleDiffPathToken(tail);
|
|
412
|
+
if (raw) {
|
|
413
|
+
const stripped = stripDiffPathPrefix(raw);
|
|
414
|
+
if (stripped && stripped !== "/dev/null") touched.add(stripped);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return Array.from(touched).sort();
|
|
419
|
+
}
|
|
420
|
+
function extractSingleDiffPathToken(tail) {
|
|
421
|
+
if (tail.length === 0) return null;
|
|
422
|
+
if (tail[0] === '"') {
|
|
423
|
+
let j2 = 1;
|
|
424
|
+
while (j2 < tail.length) {
|
|
425
|
+
if (tail[j2] === "\\" && j2 + 1 < tail.length) {
|
|
426
|
+
j2 += 2;
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
if (tail[j2] === '"') break;
|
|
430
|
+
j2 += 1;
|
|
431
|
+
}
|
|
432
|
+
if (j2 >= tail.length) return null;
|
|
433
|
+
return tail.slice(0, j2 + 1);
|
|
434
|
+
}
|
|
435
|
+
let j = 0;
|
|
436
|
+
while (j < tail.length && tail[j] !== " " && tail[j] !== " ") j += 1;
|
|
437
|
+
return tail.slice(0, j);
|
|
438
|
+
}
|
|
439
|
+
function splitDiffGitPaths(rest) {
|
|
440
|
+
const tokens = [];
|
|
441
|
+
let i = 0;
|
|
442
|
+
while (i < rest.length && tokens.length < 2) {
|
|
443
|
+
while (i < rest.length && (rest[i] === " " || rest[i] === " ")) i += 1;
|
|
444
|
+
if (i >= rest.length) break;
|
|
445
|
+
if (rest[i] === '"') {
|
|
446
|
+
let j = i + 1;
|
|
447
|
+
while (j < rest.length) {
|
|
448
|
+
if (rest[j] === "\\" && j + 1 < rest.length) {
|
|
449
|
+
j += 2;
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
if (rest[j] === '"') break;
|
|
453
|
+
j += 1;
|
|
454
|
+
}
|
|
455
|
+
if (j >= rest.length) return null;
|
|
456
|
+
tokens.push(rest.slice(i, j + 1));
|
|
457
|
+
i = j + 1;
|
|
458
|
+
} else {
|
|
459
|
+
let j = i;
|
|
460
|
+
while (j < rest.length && rest[j] !== " " && rest[j] !== " ") j += 1;
|
|
461
|
+
tokens.push(rest.slice(i, j));
|
|
462
|
+
i = j;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (tokens.length !== 2) return null;
|
|
466
|
+
return [tokens[0], tokens[1]];
|
|
467
|
+
}
|
|
468
|
+
function stripDiffPathPrefix(raw) {
|
|
469
|
+
let s = raw;
|
|
470
|
+
if (s.length >= 2 && s[0] === '"' && s[s.length - 1] === '"') {
|
|
471
|
+
s = s.slice(1, -1);
|
|
472
|
+
s = s.replace(/\\(["\\])/g, "$1");
|
|
473
|
+
}
|
|
474
|
+
s = s.replace(/\\/g, "/");
|
|
475
|
+
if (s.startsWith("a/") || s.startsWith("b/")) s = s.slice(2);
|
|
476
|
+
return s;
|
|
477
|
+
}
|
|
478
|
+
var BOOST_PER_MATCH = 0.5;
|
|
479
|
+
var MAX_BOOST = 1;
|
|
480
|
+
function countPathHits(entityRefs, touchedFiles) {
|
|
481
|
+
if (!entityRefs || entityRefs.length === 0) return 0;
|
|
482
|
+
if (touchedFiles.length === 0) return 0;
|
|
483
|
+
let hits = 0;
|
|
484
|
+
for (const ref of entityRefs) {
|
|
485
|
+
if (typeof ref !== "string" || !ref) continue;
|
|
486
|
+
const lowered = ref.toLowerCase();
|
|
487
|
+
for (const file of touchedFiles) {
|
|
488
|
+
const flower = file.toLowerCase();
|
|
489
|
+
if (lowered === flower) {
|
|
490
|
+
hits += 1;
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
if (lowered.includes(flower) || flower.includes(lowered)) {
|
|
494
|
+
hits += 1;
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
return hits;
|
|
500
|
+
}
|
|
501
|
+
function rankReviewCandidates(candidates, touchedFiles) {
|
|
502
|
+
const annotated = candidates.map((c) => {
|
|
503
|
+
const hits = countPathHits(c.entityRefs, touchedFiles);
|
|
504
|
+
const boost = Math.min(MAX_BOOST, hits * BOOST_PER_MATCH);
|
|
505
|
+
return { ...c, boost };
|
|
506
|
+
});
|
|
507
|
+
annotated.sort((a, b) => {
|
|
508
|
+
const adjA = a.score + a.boost;
|
|
509
|
+
const adjB = b.score + b.boost;
|
|
510
|
+
if (adjA !== adjB) return adjB - adjA;
|
|
511
|
+
if (a.id < b.id) return -1;
|
|
512
|
+
if (a.id > b.id) return 1;
|
|
513
|
+
return 0;
|
|
514
|
+
});
|
|
515
|
+
return annotated;
|
|
516
|
+
}
|
|
517
|
+
function packReviewContext(input) {
|
|
518
|
+
const touchedFiles = parseTouchedFiles(input.diff);
|
|
519
|
+
const rankedRecall = rankReviewCandidates(input.candidates, touchedFiles);
|
|
520
|
+
return { touchedFiles, rankedRecall };
|
|
521
|
+
}
|
|
271
522
|
|
|
272
523
|
// src/binary-lifecycle/types.ts
|
|
273
524
|
var DEFAULT_SCAN_PATTERNS = [
|
|
@@ -680,7 +931,8 @@ var CATEGORY_DIR_MAP = {
|
|
|
680
931
|
rule: "rules",
|
|
681
932
|
skill: "skills",
|
|
682
933
|
relationship: "relationships",
|
|
683
|
-
procedure: "procedures"
|
|
934
|
+
procedure: "procedures",
|
|
935
|
+
reasoning_trace: "reasoning-traces"
|
|
684
936
|
};
|
|
685
937
|
var ALL_CATEGORY_DIRS = [
|
|
686
938
|
"facts",
|
|
@@ -4767,313 +5019,6 @@ function publisherForConnector(connectorId) {
|
|
|
4767
5019
|
return publisherFor(hostIdForConnector(connectorId));
|
|
4768
5020
|
}
|
|
4769
5021
|
|
|
4770
|
-
// src/taxonomy/default-taxonomy.ts
|
|
4771
|
-
var DEFAULT_TAXONOMY = {
|
|
4772
|
-
version: 1,
|
|
4773
|
-
categories: [
|
|
4774
|
-
{
|
|
4775
|
-
id: "corrections",
|
|
4776
|
-
name: "Corrections",
|
|
4777
|
-
description: "Corrections to previously stored information",
|
|
4778
|
-
filingRules: ["Any update that supersedes a prior fact"],
|
|
4779
|
-
priority: 10,
|
|
4780
|
-
memoryCategories: ["correction"]
|
|
4781
|
-
},
|
|
4782
|
-
{
|
|
4783
|
-
id: "principles",
|
|
4784
|
-
name: "Principles",
|
|
4785
|
-
description: "Rules, guidelines, and recurring patterns",
|
|
4786
|
-
filingRules: ["A guiding principle, rule, or skill"],
|
|
4787
|
-
priority: 20,
|
|
4788
|
-
memoryCategories: ["principle", "rule", "skill"]
|
|
4789
|
-
},
|
|
4790
|
-
{
|
|
4791
|
-
id: "procedures",
|
|
4792
|
-
name: "Procedures",
|
|
4793
|
-
description: "Ordered multi-step workflows the user repeats",
|
|
4794
|
-
filingRules: ["A repeatable sequence of steps or commands for a task"],
|
|
4795
|
-
priority: 25,
|
|
4796
|
-
memoryCategories: ["procedure"]
|
|
4797
|
-
},
|
|
4798
|
-
{
|
|
4799
|
-
id: "entities",
|
|
4800
|
-
name: "Entities",
|
|
4801
|
-
description: "People, organizations, places, projects",
|
|
4802
|
-
filingRules: ["Named entity with attributes"],
|
|
4803
|
-
priority: 30,
|
|
4804
|
-
memoryCategories: ["entity", "relationship"]
|
|
4805
|
-
},
|
|
4806
|
-
{
|
|
4807
|
-
id: "decisions",
|
|
4808
|
-
name: "Decisions",
|
|
4809
|
-
description: "Choices made and their rationale",
|
|
4810
|
-
filingRules: ["A decision or commitment with reasoning"],
|
|
4811
|
-
priority: 35,
|
|
4812
|
-
memoryCategories: ["decision", "commitment"]
|
|
4813
|
-
},
|
|
4814
|
-
{
|
|
4815
|
-
id: "preferences",
|
|
4816
|
-
name: "Preferences",
|
|
4817
|
-
description: "User likes, dislikes, and style choices",
|
|
4818
|
-
filingRules: ["Anything expressing a preference or taste"],
|
|
4819
|
-
priority: 40,
|
|
4820
|
-
memoryCategories: ["preference"]
|
|
4821
|
-
},
|
|
4822
|
-
{
|
|
4823
|
-
id: "facts",
|
|
4824
|
-
name: "Facts",
|
|
4825
|
-
description: "Objective statements about the world",
|
|
4826
|
-
filingRules: ["Any factual claim or piece of information"],
|
|
4827
|
-
priority: 50,
|
|
4828
|
-
memoryCategories: ["fact"]
|
|
4829
|
-
},
|
|
4830
|
-
{
|
|
4831
|
-
id: "moments",
|
|
4832
|
-
name: "Moments",
|
|
4833
|
-
description: "Significant events or experiences",
|
|
4834
|
-
filingRules: ["A specific event worth remembering"],
|
|
4835
|
-
priority: 60,
|
|
4836
|
-
memoryCategories: ["moment"]
|
|
4837
|
-
}
|
|
4838
|
-
]
|
|
4839
|
-
};
|
|
4840
|
-
|
|
4841
|
-
// src/taxonomy/resolver.ts
|
|
4842
|
-
var DEFAULT_CATEGORY_ID = "facts";
|
|
4843
|
-
function resolveCategory(content, memoryCategory, taxonomy) {
|
|
4844
|
-
const contentLower = content.toLowerCase();
|
|
4845
|
-
const matches = taxonomy.categories.filter(
|
|
4846
|
-
(cat) => cat.memoryCategories.includes(memoryCategory)
|
|
4847
|
-
);
|
|
4848
|
-
if (matches.length === 0) {
|
|
4849
|
-
const fallback = taxonomy.categories.find((c) => c.id === DEFAULT_CATEGORY_ID) ?? taxonomy.categories[0];
|
|
4850
|
-
if (!fallback) {
|
|
4851
|
-
return {
|
|
4852
|
-
categoryId: DEFAULT_CATEGORY_ID,
|
|
4853
|
-
confidence: 0,
|
|
4854
|
-
reason: "Taxonomy is empty; using default category",
|
|
4855
|
-
alternatives: []
|
|
4856
|
-
};
|
|
4857
|
-
}
|
|
4858
|
-
const alternatives2 = taxonomy.categories.filter((c) => c.id !== fallback.id).map((c) => ({
|
|
4859
|
-
categoryId: c.id,
|
|
4860
|
-
reason: c.description
|
|
4861
|
-
}));
|
|
4862
|
-
return {
|
|
4863
|
-
categoryId: fallback.id,
|
|
4864
|
-
confidence: 0.3,
|
|
4865
|
-
reason: `No taxonomy category maps to MemoryCategory "${memoryCategory}"; falling back to "${fallback.name}"`,
|
|
4866
|
-
alternatives: alternatives2
|
|
4867
|
-
};
|
|
4868
|
-
}
|
|
4869
|
-
if (matches.length === 1) {
|
|
4870
|
-
const match = matches[0];
|
|
4871
|
-
const alternatives2 = taxonomy.categories.filter((c) => c.id !== match.id).map((c) => ({
|
|
4872
|
-
categoryId: c.id,
|
|
4873
|
-
reason: c.description
|
|
4874
|
-
}));
|
|
4875
|
-
return {
|
|
4876
|
-
categoryId: match.id,
|
|
4877
|
-
confidence: 1,
|
|
4878
|
-
reason: `Unique match: MemoryCategory "${memoryCategory}" maps to "${match.name}"`,
|
|
4879
|
-
alternatives: alternatives2
|
|
4880
|
-
};
|
|
4881
|
-
}
|
|
4882
|
-
const scored = matches.map((cat) => ({
|
|
4883
|
-
cat,
|
|
4884
|
-
keywordScore: computeKeywordScore(contentLower, cat)
|
|
4885
|
-
}));
|
|
4886
|
-
scored.sort((a, b) => {
|
|
4887
|
-
if (b.keywordScore !== a.keywordScore) return b.keywordScore - a.keywordScore;
|
|
4888
|
-
return a.cat.priority - b.cat.priority;
|
|
4889
|
-
});
|
|
4890
|
-
const best = scored[0];
|
|
4891
|
-
const runnerUp = scored[1];
|
|
4892
|
-
const confidence = best.keywordScore > 0 && (!runnerUp || best.keywordScore > runnerUp.keywordScore) ? 0.9 : 0.7;
|
|
4893
|
-
const alternatives = taxonomy.categories.filter((c) => c.id !== best.cat.id).map((c) => ({
|
|
4894
|
-
categoryId: c.id,
|
|
4895
|
-
reason: c.description
|
|
4896
|
-
}));
|
|
4897
|
-
const reason = best.keywordScore > 0 ? `Filing rules for "${best.cat.name}" matched content keywords (priority ${best.cat.priority})` : `Priority tie-break: "${best.cat.name}" has lowest priority number (${best.cat.priority})`;
|
|
4898
|
-
return {
|
|
4899
|
-
categoryId: best.cat.id,
|
|
4900
|
-
confidence,
|
|
4901
|
-
reason,
|
|
4902
|
-
alternatives
|
|
4903
|
-
};
|
|
4904
|
-
}
|
|
4905
|
-
function computeKeywordScore(contentLower, cat) {
|
|
4906
|
-
let score = 0;
|
|
4907
|
-
const ruleText = [...cat.filingRules, cat.description].join(" ").toLowerCase();
|
|
4908
|
-
const keywords = ruleText.split(/[^a-z0-9]+/).filter((w) => w.length >= 3);
|
|
4909
|
-
for (const kw of keywords) {
|
|
4910
|
-
if (contentLower.includes(kw)) {
|
|
4911
|
-
score += 1;
|
|
4912
|
-
}
|
|
4913
|
-
}
|
|
4914
|
-
return score;
|
|
4915
|
-
}
|
|
4916
|
-
|
|
4917
|
-
// src/taxonomy/resolver-doc-generator.ts
|
|
4918
|
-
function generateResolverDocument(taxonomy) {
|
|
4919
|
-
const sorted = [...taxonomy.categories].sort((a, b) => {
|
|
4920
|
-
if (a.priority !== b.priority) return a.priority - b.priority;
|
|
4921
|
-
return a.id.localeCompare(b.id);
|
|
4922
|
-
});
|
|
4923
|
-
const lines = [
|
|
4924
|
-
"# Memory Filing Resolver",
|
|
4925
|
-
"",
|
|
4926
|
-
"Given a new piece of knowledge, follow this tree to determine where it belongs.",
|
|
4927
|
-
""
|
|
4928
|
-
];
|
|
4929
|
-
let step = 1;
|
|
4930
|
-
for (const cat of sorted) {
|
|
4931
|
-
lines.push(`## Step ${step}: ${cat.description}?`);
|
|
4932
|
-
lines.push("");
|
|
4933
|
-
for (const rule of cat.filingRules) {
|
|
4934
|
-
lines.push(`- ${rule}`);
|
|
4935
|
-
}
|
|
4936
|
-
lines.push("");
|
|
4937
|
-
lines.push(
|
|
4938
|
-
`> YES: File under **${cat.id}/** (priority ${cat.priority})`
|
|
4939
|
-
);
|
|
4940
|
-
lines.push("");
|
|
4941
|
-
step++;
|
|
4942
|
-
}
|
|
4943
|
-
lines.push("## Tie-breaking");
|
|
4944
|
-
lines.push("");
|
|
4945
|
-
lines.push(
|
|
4946
|
-
"If a fact could go in multiple categories, file under the one with the **lowest priority number**."
|
|
4947
|
-
);
|
|
4948
|
-
lines.push("");
|
|
4949
|
-
lines.push(`---`);
|
|
4950
|
-
lines.push(`*Generated from taxonomy v${taxonomy.version}*`);
|
|
4951
|
-
lines.push("");
|
|
4952
|
-
return lines.join("\n");
|
|
4953
|
-
}
|
|
4954
|
-
|
|
4955
|
-
// src/taxonomy/taxonomy-loader.ts
|
|
4956
|
-
import { readFile, mkdir, writeFile } from "fs/promises";
|
|
4957
|
-
import path16 from "path";
|
|
4958
|
-
var TAXONOMY_DIR = ".taxonomy";
|
|
4959
|
-
var TAXONOMY_FILE = "taxonomy.json";
|
|
4960
|
-
var MAX_SLUG_LENGTH = 32;
|
|
4961
|
-
var SLUG_RE = /^[a-z][a-z0-9-]*$/;
|
|
4962
|
-
function validateSlug(slug) {
|
|
4963
|
-
if (slug.length === 0) {
|
|
4964
|
-
throw new Error("Taxonomy category ID must not be empty");
|
|
4965
|
-
}
|
|
4966
|
-
if (slug.length > MAX_SLUG_LENGTH) {
|
|
4967
|
-
throw new Error(
|
|
4968
|
-
`Taxonomy category ID "${slug}" exceeds ${MAX_SLUG_LENGTH} characters`
|
|
4969
|
-
);
|
|
4970
|
-
}
|
|
4971
|
-
if (!SLUG_RE.test(slug)) {
|
|
4972
|
-
throw new Error(
|
|
4973
|
-
`Taxonomy category ID "${slug}" is invalid: must be lowercase letters, digits, and hyphens, starting with a letter`
|
|
4974
|
-
);
|
|
4975
|
-
}
|
|
4976
|
-
}
|
|
4977
|
-
function validateTaxonomy(taxonomy) {
|
|
4978
|
-
if (typeof taxonomy.version !== "number" || taxonomy.version < 1) {
|
|
4979
|
-
throw new Error("Taxonomy version must be a positive integer");
|
|
4980
|
-
}
|
|
4981
|
-
if (!Array.isArray(taxonomy.categories)) {
|
|
4982
|
-
throw new Error("Taxonomy categories must be an array");
|
|
4983
|
-
}
|
|
4984
|
-
const seenIds = /* @__PURE__ */ new Set();
|
|
4985
|
-
for (const cat of taxonomy.categories) {
|
|
4986
|
-
validateSlug(cat.id);
|
|
4987
|
-
if (seenIds.has(cat.id)) {
|
|
4988
|
-
throw new Error(`Duplicate taxonomy category ID: "${cat.id}"`);
|
|
4989
|
-
}
|
|
4990
|
-
seenIds.add(cat.id);
|
|
4991
|
-
if (typeof cat.name !== "string" || cat.name.trim().length === 0) {
|
|
4992
|
-
throw new Error(`Taxonomy category "${cat.id}" must have a non-empty name`);
|
|
4993
|
-
}
|
|
4994
|
-
if (typeof cat.description !== "string" || cat.description.trim().length === 0) {
|
|
4995
|
-
throw new Error(`Taxonomy category "${cat.id}" must have a non-empty description`);
|
|
4996
|
-
}
|
|
4997
|
-
if (!Array.isArray(cat.filingRules)) {
|
|
4998
|
-
throw new Error(`Taxonomy category "${cat.id}" filingRules must be an array`);
|
|
4999
|
-
}
|
|
5000
|
-
if (typeof cat.priority !== "number" || !Number.isFinite(cat.priority)) {
|
|
5001
|
-
throw new Error(`Taxonomy category "${cat.id}" must have a finite numeric priority`);
|
|
5002
|
-
}
|
|
5003
|
-
if (!Array.isArray(cat.memoryCategories)) {
|
|
5004
|
-
throw new Error(`Taxonomy category "${cat.id}" memoryCategories must be an array`);
|
|
5005
|
-
}
|
|
5006
|
-
if (cat.parentId !== void 0) {
|
|
5007
|
-
if (typeof cat.parentId !== "string") {
|
|
5008
|
-
throw new Error(`Taxonomy category "${cat.id}" parentId must be a string if set`);
|
|
5009
|
-
}
|
|
5010
|
-
}
|
|
5011
|
-
}
|
|
5012
|
-
for (const cat of taxonomy.categories) {
|
|
5013
|
-
if (cat.parentId !== void 0 && !seenIds.has(cat.parentId)) {
|
|
5014
|
-
throw new Error(
|
|
5015
|
-
`Taxonomy category "${cat.id}" references unknown parentId "${cat.parentId}"`
|
|
5016
|
-
);
|
|
5017
|
-
}
|
|
5018
|
-
}
|
|
5019
|
-
}
|
|
5020
|
-
async function loadTaxonomy(memoryDir) {
|
|
5021
|
-
const taxonomyPath = path16.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
|
|
5022
|
-
let raw;
|
|
5023
|
-
try {
|
|
5024
|
-
raw = await readFile(taxonomyPath, "utf-8");
|
|
5025
|
-
} catch (err) {
|
|
5026
|
-
if (err instanceof Error && err.code === "ENOENT") {
|
|
5027
|
-
return structuredClone(DEFAULT_TAXONOMY);
|
|
5028
|
-
}
|
|
5029
|
-
throw err;
|
|
5030
|
-
}
|
|
5031
|
-
const parsed = JSON.parse(raw);
|
|
5032
|
-
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
5033
|
-
throw new Error("taxonomy.json must be a JSON object");
|
|
5034
|
-
}
|
|
5035
|
-
const obj = parsed;
|
|
5036
|
-
const userVersion = typeof obj.version === "number" ? obj.version : DEFAULT_TAXONOMY.version;
|
|
5037
|
-
const userCategories = Array.isArray(obj.categories) ? obj.categories : [];
|
|
5038
|
-
const userIdCounts = /* @__PURE__ */ new Map();
|
|
5039
|
-
for (const cat of userCategories) {
|
|
5040
|
-
const id = typeof cat.id === "string" ? cat.id : String(cat.id);
|
|
5041
|
-
userIdCounts.set(id, (userIdCounts.get(id) ?? 0) + 1);
|
|
5042
|
-
}
|
|
5043
|
-
const duplicateIds = [...userIdCounts.entries()].filter(([, count]) => count > 1).map(([id]) => id);
|
|
5044
|
-
if (duplicateIds.length > 0) {
|
|
5045
|
-
throw new Error(
|
|
5046
|
-
`Duplicate category IDs in taxonomy.json: ${duplicateIds.map((id) => `"${id}"`).join(", ")}`
|
|
5047
|
-
);
|
|
5048
|
-
}
|
|
5049
|
-
const mergedMap = /* @__PURE__ */ new Map();
|
|
5050
|
-
for (const cat of DEFAULT_TAXONOMY.categories) {
|
|
5051
|
-
mergedMap.set(cat.id, { ...cat });
|
|
5052
|
-
}
|
|
5053
|
-
for (const cat of userCategories) {
|
|
5054
|
-
mergedMap.set(cat.id, cat);
|
|
5055
|
-
}
|
|
5056
|
-
const merged = {
|
|
5057
|
-
version: userVersion,
|
|
5058
|
-
categories: [...mergedMap.values()]
|
|
5059
|
-
};
|
|
5060
|
-
validateTaxonomy(merged);
|
|
5061
|
-
return merged;
|
|
5062
|
-
}
|
|
5063
|
-
async function saveTaxonomy(memoryDir, taxonomy) {
|
|
5064
|
-
validateTaxonomy(taxonomy);
|
|
5065
|
-
const dir = path16.join(memoryDir, TAXONOMY_DIR);
|
|
5066
|
-
await mkdir(dir, { recursive: true });
|
|
5067
|
-
const filePath = path16.join(dir, TAXONOMY_FILE);
|
|
5068
|
-
await writeFile(filePath, JSON.stringify(taxonomy, null, 2) + "\n", "utf-8");
|
|
5069
|
-
}
|
|
5070
|
-
function getTaxonomyDir(memoryDir) {
|
|
5071
|
-
return path16.join(memoryDir, TAXONOMY_DIR);
|
|
5072
|
-
}
|
|
5073
|
-
function getTaxonomyFilePath(memoryDir) {
|
|
5074
|
-
return path16.join(memoryDir, TAXONOMY_DIR, TAXONOMY_FILE);
|
|
5075
|
-
}
|
|
5076
|
-
|
|
5077
5022
|
// src/enrichment/types.ts
|
|
5078
5023
|
function defaultEnrichmentPipelineConfig() {
|
|
5079
5024
|
return {
|
|
@@ -5299,22 +5244,22 @@ async function runEnrichmentPipeline(entities, registry, config, log2) {
|
|
|
5299
5244
|
}
|
|
5300
5245
|
|
|
5301
5246
|
// src/enrichment/audit.ts
|
|
5302
|
-
import { mkdir
|
|
5247
|
+
import { mkdir, readFile, appendFile } from "fs/promises";
|
|
5303
5248
|
import { existsSync as existsSync2 } from "fs";
|
|
5304
|
-
import
|
|
5249
|
+
import path16 from "path";
|
|
5305
5250
|
var AUDIT_FILENAME = "enrichment-audit.jsonl";
|
|
5306
5251
|
function auditFilePath(auditDir) {
|
|
5307
|
-
return
|
|
5252
|
+
return path16.join(auditDir, AUDIT_FILENAME);
|
|
5308
5253
|
}
|
|
5309
5254
|
async function appendAuditEntry(auditDir, entry) {
|
|
5310
|
-
await
|
|
5255
|
+
await mkdir(auditDir, { recursive: true });
|
|
5311
5256
|
const line = JSON.stringify(entry) + "\n";
|
|
5312
5257
|
await appendFile(auditFilePath(auditDir), line, "utf-8");
|
|
5313
5258
|
}
|
|
5314
5259
|
async function readAuditLog(auditDir, since) {
|
|
5315
5260
|
const filePath = auditFilePath(auditDir);
|
|
5316
5261
|
if (!existsSync2(filePath)) return [];
|
|
5317
|
-
const raw = await
|
|
5262
|
+
const raw = await readFile(filePath, "utf-8");
|
|
5318
5263
|
const entries = [];
|
|
5319
5264
|
for (const line of raw.split("\n")) {
|
|
5320
5265
|
const trimmed = line.trim();
|
|
@@ -5331,24 +5276,156 @@ async function readAuditLog(auditDir, since) {
|
|
|
5331
5276
|
}
|
|
5332
5277
|
return entries;
|
|
5333
5278
|
}
|
|
5279
|
+
|
|
5280
|
+
// src/importers/base.ts
|
|
5281
|
+
var DEFAULT_IMPORT_BATCH_SIZE = 25;
|
|
5282
|
+
var MIN_IMPORT_BATCH_SIZE = 1;
|
|
5283
|
+
var MAX_IMPORT_BATCH_SIZE = 500;
|
|
5284
|
+
function validateImportBatchSize(value) {
|
|
5285
|
+
if (value === void 0) return DEFAULT_IMPORT_BATCH_SIZE;
|
|
5286
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
5287
|
+
throw new Error(
|
|
5288
|
+
`batchSize must be a finite number, received ${String(value)}`
|
|
5289
|
+
);
|
|
5290
|
+
}
|
|
5291
|
+
if (!Number.isInteger(value)) {
|
|
5292
|
+
throw new Error(`batchSize must be an integer, received ${value}`);
|
|
5293
|
+
}
|
|
5294
|
+
if (value < MIN_IMPORT_BATCH_SIZE || value > MAX_IMPORT_BATCH_SIZE) {
|
|
5295
|
+
throw new Error(
|
|
5296
|
+
`batchSize must be between ${MIN_IMPORT_BATCH_SIZE} and ${MAX_IMPORT_BATCH_SIZE}, received ${value}`
|
|
5297
|
+
);
|
|
5298
|
+
}
|
|
5299
|
+
return value;
|
|
5300
|
+
}
|
|
5301
|
+
function validateImportRateLimit(value) {
|
|
5302
|
+
if (value === void 0) return void 0;
|
|
5303
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
5304
|
+
throw new Error(
|
|
5305
|
+
`rateLimit must be a finite number (requests per second), received ${String(value)}`
|
|
5306
|
+
);
|
|
5307
|
+
}
|
|
5308
|
+
if (value <= 0) {
|
|
5309
|
+
throw new Error(
|
|
5310
|
+
`rateLimit must be greater than 0 (requests per second), received ${value}`
|
|
5311
|
+
);
|
|
5312
|
+
}
|
|
5313
|
+
return value;
|
|
5314
|
+
}
|
|
5315
|
+
function importedMemoryToTurn(memory) {
|
|
5316
|
+
const timestamp = typeof memory.sourceTimestamp === "string" && memory.sourceTimestamp.length > 0 ? memory.sourceTimestamp : memory.importedAt ?? (/* @__PURE__ */ new Date()).toISOString();
|
|
5317
|
+
return {
|
|
5318
|
+
role: "user",
|
|
5319
|
+
content: memory.content,
|
|
5320
|
+
timestamp,
|
|
5321
|
+
participantName: memory.sourceLabel,
|
|
5322
|
+
...memory.sourceId !== void 0 ? { participantId: memory.sourceId } : {}
|
|
5323
|
+
};
|
|
5324
|
+
}
|
|
5325
|
+
async function runImporter(adapter, input, target, options = {}) {
|
|
5326
|
+
const batchSize = validateImportBatchSize(options.batchSize);
|
|
5327
|
+
validateImportRateLimit(options.rateLimit);
|
|
5328
|
+
const importedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5329
|
+
const dryRun = options.dryRun === true;
|
|
5330
|
+
const onProgress = options.onProgress;
|
|
5331
|
+
onProgress?.({ processed: 0, total: 0, phase: "parse" });
|
|
5332
|
+
const parseOptions = {
|
|
5333
|
+
...options.rateLimit !== void 0 ? { rateLimit: options.rateLimit } : {},
|
|
5334
|
+
...options.parseOptions ?? {}
|
|
5335
|
+
};
|
|
5336
|
+
const parsed = await adapter.parse(input, parseOptions);
|
|
5337
|
+
onProgress?.({ processed: 0, total: 0, phase: "transform" });
|
|
5338
|
+
const memoriesRaw = await adapter.transform(parsed, options.transformOptions);
|
|
5339
|
+
if (!Array.isArray(memoriesRaw)) {
|
|
5340
|
+
throw new Error(
|
|
5341
|
+
`Importer '${adapter.name}' transform() returned a non-array. Adapters must produce ImportedMemory[].`
|
|
5342
|
+
);
|
|
5343
|
+
}
|
|
5344
|
+
const memories = memoriesRaw.map((memory) => {
|
|
5345
|
+
const sourceLabel = typeof memory.sourceLabel === "string" && memory.sourceLabel.length > 0 ? memory.sourceLabel : adapter.sourceLabel;
|
|
5346
|
+
return {
|
|
5347
|
+
...memory,
|
|
5348
|
+
sourceLabel,
|
|
5349
|
+
importedAt: memory.importedAt ?? importedAt
|
|
5350
|
+
};
|
|
5351
|
+
});
|
|
5352
|
+
if (dryRun) {
|
|
5353
|
+
onProgress?.({
|
|
5354
|
+
processed: memories.length,
|
|
5355
|
+
total: memories.length,
|
|
5356
|
+
phase: "dry-run"
|
|
5357
|
+
});
|
|
5358
|
+
return {
|
|
5359
|
+
adapter: adapter.name,
|
|
5360
|
+
sourceLabel: adapter.sourceLabel,
|
|
5361
|
+
memoriesPlanned: memories.length,
|
|
5362
|
+
memoriesWritten: 0,
|
|
5363
|
+
batchesProcessed: 0,
|
|
5364
|
+
dryRun: true,
|
|
5365
|
+
importedAt
|
|
5366
|
+
};
|
|
5367
|
+
}
|
|
5368
|
+
let batchesProcessed = 0;
|
|
5369
|
+
let memoriesWritten = 0;
|
|
5370
|
+
for (let i = 0; i < memories.length; i += batchSize) {
|
|
5371
|
+
const batch = memories.slice(i, i + batchSize);
|
|
5372
|
+
const result = await adapter.writeTo(target, batch, options);
|
|
5373
|
+
memoriesWritten += result.memoriesIngested;
|
|
5374
|
+
batchesProcessed += 1;
|
|
5375
|
+
onProgress?.({
|
|
5376
|
+
processed: Math.min(i + batch.length, memories.length),
|
|
5377
|
+
total: memories.length,
|
|
5378
|
+
phase: "write"
|
|
5379
|
+
});
|
|
5380
|
+
}
|
|
5381
|
+
return {
|
|
5382
|
+
adapter: adapter.name,
|
|
5383
|
+
sourceLabel: adapter.sourceLabel,
|
|
5384
|
+
memoriesPlanned: memories.length,
|
|
5385
|
+
memoriesWritten,
|
|
5386
|
+
batchesProcessed,
|
|
5387
|
+
dryRun: false,
|
|
5388
|
+
importedAt
|
|
5389
|
+
};
|
|
5390
|
+
}
|
|
5391
|
+
async function defaultWriteMemoriesToOrchestrator(target, memories) {
|
|
5392
|
+
if (memories.length === 0) {
|
|
5393
|
+
return { memoriesIngested: 0 };
|
|
5394
|
+
}
|
|
5395
|
+
const turns = memories.map(importedMemoryToTurn);
|
|
5396
|
+
await target.ingestBulkImportBatch(turns);
|
|
5397
|
+
return { memoriesIngested: memories.length };
|
|
5398
|
+
}
|
|
5334
5399
|
export {
|
|
5400
|
+
AccessAuditAdapter,
|
|
5335
5401
|
BRIEFING_FORMAT_ALLOWED,
|
|
5336
5402
|
BootstrapEngine,
|
|
5337
5403
|
CITATION_UNKNOWN,
|
|
5338
5404
|
CODEX_THREAD_KEY_PREFIX,
|
|
5339
5405
|
ClaudeCodeMemoryExtensionPublisher,
|
|
5340
5406
|
CodexMemoryExtensionPublisher,
|
|
5407
|
+
CrossNamespaceBudget,
|
|
5408
|
+
DEFAULT_ANOMALY_DETECTOR_CONFIG,
|
|
5341
5409
|
DEFAULT_CITATION_FORMAT,
|
|
5410
|
+
DEFAULT_CROSS_NAMESPACE_BUDGET,
|
|
5342
5411
|
DEFAULT_GRACE_PERIOD_DAYS,
|
|
5412
|
+
DEFAULT_IMPORT_BATCH_SIZE,
|
|
5343
5413
|
DEFAULT_MAX_BINARY_SIZE_BYTES,
|
|
5414
|
+
DEFAULT_PPR_DAMPING,
|
|
5415
|
+
DEFAULT_PPR_ITERATIONS,
|
|
5416
|
+
DEFAULT_PPR_TOLERANCE,
|
|
5417
|
+
DEFAULT_REASONING_TRACE_BOOST,
|
|
5344
5418
|
DEFAULT_SCAN_PATTERNS,
|
|
5419
|
+
DEFAULT_SURPRISE_K,
|
|
5345
5420
|
DEFAULT_TAXONOMY,
|
|
5421
|
+
FILTER_LABELS as DIRECT_ANSWER_FILTER_LABELS,
|
|
5346
5422
|
EngramAccessHttpServer,
|
|
5347
5423
|
EngramAccessInputError,
|
|
5348
5424
|
EngramAccessService,
|
|
5349
5425
|
EngramMcpServer,
|
|
5350
5426
|
EnrichmentProviderRegistry,
|
|
5351
5427
|
ExtractionEngine,
|
|
5428
|
+
FallbackLlmClient,
|
|
5352
5429
|
FileCalendarSource,
|
|
5353
5430
|
FilesystemBackend,
|
|
5354
5431
|
HermesMemoryExtensionPublisher,
|
|
@@ -5364,22 +5441,29 @@ export {
|
|
|
5364
5441
|
PLUGIN_ID,
|
|
5365
5442
|
PUBLISHERS,
|
|
5366
5443
|
QmdClient,
|
|
5444
|
+
RECALL_XRAY_FORMATS,
|
|
5367
5445
|
REMNIC_CITATION_FORMAT,
|
|
5368
5446
|
REMNIC_EXTENSIONS_TOTAL_TOKEN_LIMIT,
|
|
5369
5447
|
REMNIC_MCP_TOOL_INVENTORY,
|
|
5370
5448
|
REMNIC_RECALL_DECISION_RULES,
|
|
5371
5449
|
REMNIC_SEMANTIC_OVERVIEW,
|
|
5372
5450
|
SENTINEL_FILE,
|
|
5451
|
+
SmartBuffer,
|
|
5373
5452
|
StorageManager,
|
|
5374
5453
|
WebSearchProvider,
|
|
5375
5454
|
appendAuditEntry,
|
|
5455
|
+
applyMemoryWorthFilter,
|
|
5456
|
+
applyReasoningTraceBoost,
|
|
5376
5457
|
attachCitation,
|
|
5458
|
+
branchNamespaceName,
|
|
5377
5459
|
briefingFilename,
|
|
5378
5460
|
buildBriefing,
|
|
5379
5461
|
buildCitationGuidance,
|
|
5380
5462
|
buildEntityRecallSection,
|
|
5381
5463
|
buildExtensionsBlockForConsolidation,
|
|
5382
5464
|
buildExtensionsFooterForSummary,
|
|
5465
|
+
buildGraphFromMemories,
|
|
5466
|
+
buildMemoryWorthCounterMap,
|
|
5383
5467
|
buildProcedureMarkdownBody,
|
|
5384
5468
|
buildProcedureRecallSection,
|
|
5385
5469
|
checkMarketplaceManifest,
|
|
@@ -5387,6 +5471,9 @@ export {
|
|
|
5387
5471
|
clearTrainingExportAdapters,
|
|
5388
5472
|
clearVerdictCache,
|
|
5389
5473
|
coerceInstallExtension,
|
|
5474
|
+
computeMemoryWorth,
|
|
5475
|
+
computeProcedureStats,
|
|
5476
|
+
computeSurprise,
|
|
5390
5477
|
convertMemoriesToRecords,
|
|
5391
5478
|
createBackend,
|
|
5392
5479
|
createSpace,
|
|
@@ -5396,14 +5483,19 @@ export {
|
|
|
5396
5483
|
decideSemanticDedup,
|
|
5397
5484
|
defaultEnrichmentPipelineConfig,
|
|
5398
5485
|
defaultWorkspaceDir,
|
|
5486
|
+
defaultWriteMemoriesToOrchestrator,
|
|
5399
5487
|
deleteSpace,
|
|
5400
5488
|
deriveSessionId,
|
|
5489
|
+
describeCodingScope,
|
|
5401
5490
|
describeMemoriesDir,
|
|
5491
|
+
detectRecallAnomalies,
|
|
5402
5492
|
diffVersions,
|
|
5403
5493
|
discoverMemoryExtensions,
|
|
5404
5494
|
doctorConnector,
|
|
5405
5495
|
emptyManifest,
|
|
5406
5496
|
ensureSentinel,
|
|
5497
|
+
expandTildePath,
|
|
5498
|
+
extractGraphEdges,
|
|
5407
5499
|
findContradictions,
|
|
5408
5500
|
findDuplicates,
|
|
5409
5501
|
focusMatchesEntity,
|
|
@@ -5411,6 +5503,7 @@ export {
|
|
|
5411
5503
|
formatBatchTranscript,
|
|
5412
5504
|
formatCitation,
|
|
5413
5505
|
formatOaiMemCitation,
|
|
5506
|
+
formatProcedureStatsText,
|
|
5414
5507
|
formatZodError,
|
|
5415
5508
|
generateContextTree,
|
|
5416
5509
|
generateMarketplaceManifest,
|
|
@@ -5427,18 +5520,27 @@ export {
|
|
|
5427
5520
|
getTaxonomyDir,
|
|
5428
5521
|
getTaxonomyFilePath,
|
|
5429
5522
|
getTrainingExportAdapter,
|
|
5523
|
+
getVerdictKind,
|
|
5430
5524
|
getVersion,
|
|
5431
5525
|
hasBroadGraphIntent,
|
|
5432
5526
|
hasCitation,
|
|
5433
5527
|
hostIdForConnector,
|
|
5528
|
+
importedMemoryToTurn,
|
|
5434
5529
|
inferIntentFromText,
|
|
5435
5530
|
initLogger,
|
|
5436
5531
|
installConnector,
|
|
5437
5532
|
installFromMarketplace,
|
|
5438
5533
|
intentCompatibilityScore,
|
|
5534
|
+
isDirectAnswerEligible,
|
|
5535
|
+
isDurableVerdict,
|
|
5536
|
+
isEdgeType,
|
|
5439
5537
|
isImportRole,
|
|
5538
|
+
isNodeType,
|
|
5539
|
+
isReasoningTracePath,
|
|
5540
|
+
isReviewPrompt,
|
|
5440
5541
|
isTaskInitiationIntent,
|
|
5441
5542
|
isTrustZoneName,
|
|
5543
|
+
isValidCachedVerdict,
|
|
5442
5544
|
judgeFactDurability,
|
|
5443
5545
|
listBulkImportSources,
|
|
5444
5546
|
listConnectors,
|
|
@@ -5453,15 +5555,21 @@ export {
|
|
|
5453
5555
|
loadTaxonomy,
|
|
5454
5556
|
loadTokenStore,
|
|
5455
5557
|
log,
|
|
5558
|
+
looksLikeProblemSolvingQuery,
|
|
5456
5559
|
manifestDir,
|
|
5457
5560
|
manifestPath,
|
|
5458
5561
|
matchesPatterns,
|
|
5459
5562
|
materializeForNamespace,
|
|
5460
5563
|
memoryStoreRequestSchema,
|
|
5564
|
+
memoryWorthOutcomeEligibleCategories,
|
|
5461
5565
|
mergeSpaces,
|
|
5462
5566
|
migrateFromEngram,
|
|
5567
|
+
normalizeCachedVerdict,
|
|
5568
|
+
normalizeOriginUrl,
|
|
5569
|
+
normalizeQueryText,
|
|
5463
5570
|
observeRequestSchema,
|
|
5464
5571
|
onboard,
|
|
5572
|
+
packReviewContext,
|
|
5465
5573
|
parseAllCitations,
|
|
5466
5574
|
parseBriefingFocus,
|
|
5467
5575
|
parseBriefingWindow,
|
|
@@ -5471,17 +5579,25 @@ export {
|
|
|
5471
5579
|
parseOaiMemCitation,
|
|
5472
5580
|
parseProcedureStepsFromBody,
|
|
5473
5581
|
parseStrictCliDate,
|
|
5582
|
+
parseTouchedFiles,
|
|
5583
|
+
parseXrayBudgetFlag,
|
|
5584
|
+
parseXrayCliOptions,
|
|
5585
|
+
parseXrayFormat,
|
|
5474
5586
|
performReview,
|
|
5475
5587
|
planRecallMode,
|
|
5588
|
+
projectNamespaceName,
|
|
5476
5589
|
promoteSpace,
|
|
5477
5590
|
publisherFor,
|
|
5478
5591
|
publisherForConnector,
|
|
5479
5592
|
pullFromSpace,
|
|
5480
5593
|
pushToSpace,
|
|
5594
|
+
queryGraph,
|
|
5595
|
+
rankReviewCandidates,
|
|
5481
5596
|
readAuditLog,
|
|
5482
5597
|
readManifest,
|
|
5483
5598
|
recallForActiveMemory,
|
|
5484
5599
|
recallRequestSchema,
|
|
5600
|
+
recordMemoryOutcome,
|
|
5485
5601
|
registerBulkImportSource,
|
|
5486
5602
|
registerPublisher,
|
|
5487
5603
|
registerTrainingExportAdapter,
|
|
@@ -5489,10 +5605,17 @@ export {
|
|
|
5489
5605
|
renderBriefingMarkdown,
|
|
5490
5606
|
renderExtensionsBlock,
|
|
5491
5607
|
renderExtensionsFooter,
|
|
5608
|
+
renderXray,
|
|
5609
|
+
renderXrayJson,
|
|
5610
|
+
renderXrayMarkdown,
|
|
5611
|
+
renderXrayText,
|
|
5612
|
+
reportBufferSurpriseDistribution,
|
|
5492
5613
|
resolveBriefingSaveDir,
|
|
5493
5614
|
resolveCategory,
|
|
5615
|
+
resolveCodingNamespaceOverlay,
|
|
5494
5616
|
resolveConnectorFromToken,
|
|
5495
5617
|
resolveExtensionsRoot,
|
|
5618
|
+
resolveGitContext,
|
|
5496
5619
|
resolvePrincipal,
|
|
5497
5620
|
resolveRemnicPluginEntry,
|
|
5498
5621
|
revertToVersion,
|
|
@@ -5503,6 +5626,8 @@ export {
|
|
|
5503
5626
|
runBulkImportPipeline,
|
|
5504
5627
|
runCodexMaterialize,
|
|
5505
5628
|
runEnrichmentPipeline,
|
|
5629
|
+
runGraphRecall,
|
|
5630
|
+
runImporter,
|
|
5506
5631
|
runPostConsolidationMaterialize,
|
|
5507
5632
|
sanitizeNoteForCitation,
|
|
5508
5633
|
sanitizeSessionKeyForFilename,
|
|
@@ -5512,11 +5637,14 @@ export {
|
|
|
5512
5637
|
saveTokenStore,
|
|
5513
5638
|
scanForBinaries,
|
|
5514
5639
|
shareSpace,
|
|
5640
|
+
stableHash,
|
|
5515
5641
|
stripCitation,
|
|
5516
5642
|
suggestionSubmitRequestSchema,
|
|
5517
5643
|
switchSpace,
|
|
5518
5644
|
syncChanges,
|
|
5519
5645
|
validateBriefingFormat,
|
|
5646
|
+
validateImportBatchSize,
|
|
5647
|
+
validateImportRateLimit,
|
|
5520
5648
|
validateImportTurn,
|
|
5521
5649
|
validateMarketplaceManifest,
|
|
5522
5650
|
validateRequest,
|