@vue-skuilder/db 0.2.29 → 0.2.31
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/{contentSource-CqJmbOZN.d.ts → contentSource-DMduBjDC.d.ts} +19 -4
- package/dist/{contentSource-B6FrSihy.d.cts → contentSource-Doh1aVBJ.d.cts} +19 -4
- package/dist/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +128 -82
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +80 -33
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-DUxDqMtZ.d.cts → dataLayerProvider-BW1CBAbb.d.cts} +1 -1
- package/dist/{dataLayerProvider-B9_UCvkR.d.ts → dataLayerProvider-Cxfe4nSK.d.ts} +1 -1
- package/dist/diagnostics/index.d.cts +18 -3
- package/dist/diagnostics/index.d.ts +18 -3
- package/dist/diagnostics/index.js +159 -135
- package/dist/diagnostics/index.js.map +1 -1
- package/dist/diagnostics/index.mjs +156 -135
- package/dist/diagnostics/index.mjs.map +1 -1
- package/dist/impl/couch/index.d.cts +2 -2
- package/dist/impl/couch/index.d.ts +2 -2
- package/dist/impl/couch/index.js +132 -86
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +80 -33
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +2 -2
- package/dist/impl/static/index.d.ts +2 -2
- package/dist/impl/static/index.js +119 -73
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +80 -33
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +181 -116
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/PipelineDebugger.ts +42 -23
- package/src/core/navigators/filters/eloDistance.ts +79 -21
- package/src/core/navigators/generators/elo.ts +8 -2
- package/src/core/navigators/generators/prescribed.ts +7 -5
- package/src/core/types/studySession.ts +12 -1
- package/src/diagnostics/derive.ts +5 -2
- package/src/diagnostics/pipeline.ts +28 -0
- package/src/diagnostics/text.ts +11 -4
- package/src/study/SessionController.ts +3 -1
- package/src/study/services/EloService.ts +33 -6
package/dist/core/index.mjs
CHANGED
|
@@ -673,13 +673,12 @@ function clearRunHistory() {
|
|
|
673
673
|
_pendingRuns = [];
|
|
674
674
|
}
|
|
675
675
|
function getOrigin(card) {
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
return "unknown";
|
|
676
|
+
return card.reviewID ? "review" : "new";
|
|
677
|
+
}
|
|
678
|
+
function requiredBy(card) {
|
|
679
|
+
return card.provenance.find(
|
|
680
|
+
(p) => p.strategy === "ephemeralHint" && p.score === Number.POSITIVE_INFINITY
|
|
681
|
+
)?.strategyName;
|
|
683
682
|
}
|
|
684
683
|
function captureRun(report) {
|
|
685
684
|
const fullReport = {
|
|
@@ -703,17 +702,23 @@ function parseCardElo(provenance) {
|
|
|
703
702
|
}
|
|
704
703
|
function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints, scoredCards, regulators) {
|
|
705
704
|
const selectedIds = new Set(selectedCards.map((c) => c.cardId));
|
|
706
|
-
const toReport = (card) =>
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
705
|
+
const toReport = (card) => {
|
|
706
|
+
const required = requiredBy(card);
|
|
707
|
+
const first = card.provenance[0];
|
|
708
|
+
const generator = first && first.strategy !== "ephemeralHint" ? first.strategyName || first.strategy : void 0;
|
|
709
|
+
return {
|
|
710
|
+
cardId: card.cardId,
|
|
711
|
+
courseId: card.courseId,
|
|
712
|
+
origin: getOrigin(card),
|
|
713
|
+
...generator ? { generator } : {},
|
|
714
|
+
...required ? { required } : {},
|
|
715
|
+
finalScore: card.score,
|
|
716
|
+
cardElo: card.cardElo ?? parseCardElo(card.provenance),
|
|
717
|
+
provenance: card.provenance,
|
|
718
|
+
tags: card.tags,
|
|
719
|
+
selected: selectedIds.has(card.cardId)
|
|
720
|
+
};
|
|
721
|
+
};
|
|
717
722
|
const selectedReported = [];
|
|
718
723
|
const nearMissReported = [];
|
|
719
724
|
const discardedTailCards = [];
|
|
@@ -1842,10 +1847,14 @@ var init_elo = __esm({
|
|
|
1842
1847
|
const userElo = toCourseElo2(courseReg.elo);
|
|
1843
1848
|
userGlobalElo = userElo.global.score;
|
|
1844
1849
|
}
|
|
1845
|
-
const activeCards = await
|
|
1850
|
+
const [activeCards, seenCards] = await Promise.all([
|
|
1851
|
+
this.user.getActiveCards(),
|
|
1852
|
+
this.user.getSeenCards(this.course.getCourseID()).catch(() => [])
|
|
1853
|
+
]);
|
|
1854
|
+
const notNew = /* @__PURE__ */ new Set([...activeCards.map((ac) => ac.cardID), ...seenCards]);
|
|
1846
1855
|
const newCards = (await this.course.getCardsCenteredAtELO(
|
|
1847
1856
|
{ limit, elo: "user" },
|
|
1848
|
-
(c) => !
|
|
1857
|
+
(c) => !notNew.has(c.cardID)
|
|
1849
1858
|
)).map((c) => ({ ...c, status: "new" }));
|
|
1850
1859
|
const scored = newCards.map((c) => {
|
|
1851
1860
|
const cardElo = c.elo ?? 1e3;
|
|
@@ -1898,6 +1907,7 @@ __export(prescribed_exports, {
|
|
|
1898
1907
|
default: () => PrescribedCardsGenerator,
|
|
1899
1908
|
unmetIntroExposeTags: () => unmetIntroExposeTags
|
|
1900
1909
|
});
|
|
1910
|
+
import { tagRole, withTagRole } from "@vue-skuilder/common";
|
|
1901
1911
|
function dedupe(arr) {
|
|
1902
1912
|
return [...new Set(arr)];
|
|
1903
1913
|
}
|
|
@@ -1938,11 +1948,11 @@ function formatAge(ms) {
|
|
|
1938
1948
|
}
|
|
1939
1949
|
function unmetIntroExposeTags(tags, userTagElo, minCount) {
|
|
1940
1950
|
if (minCount <= 0) return [];
|
|
1941
|
-
const exposeTags = new Set(tags.filter((tag) => tag
|
|
1951
|
+
const exposeTags = new Set(tags.filter((tag) => tagRole(tag) === "expose"));
|
|
1942
1952
|
for (const tag of tags) {
|
|
1943
|
-
if (
|
|
1944
|
-
const
|
|
1945
|
-
if (
|
|
1953
|
+
if (tagRole(tag) !== "intro") continue;
|
|
1954
|
+
const expose = withTagRole(tag, "expose");
|
|
1955
|
+
if (expose) exposeTags.add(expose);
|
|
1946
1956
|
}
|
|
1947
1957
|
return [...exposeTags].filter((tag) => {
|
|
1948
1958
|
const tagElo = userTagElo[tag];
|
|
@@ -3141,8 +3151,10 @@ __export(eloDistance_exports, {
|
|
|
3141
3151
|
DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
|
|
3142
3152
|
createEloDistanceFilter: () => createEloDistanceFilter,
|
|
3143
3153
|
default: () => EloDistanceFilter,
|
|
3154
|
+
mountMultiDimEloToggle: () => mountMultiDimEloToggle,
|
|
3144
3155
|
tagAwareGap: () => tagAwareGap
|
|
3145
3156
|
});
|
|
3157
|
+
import { COUNT_ONLY_SCORE, isCountOnlyTag } from "@vue-skuilder/common";
|
|
3146
3158
|
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
3147
3159
|
const normalizedDistance = distance / halfLife;
|
|
3148
3160
|
const decay = Math.exp(-(normalizedDistance * normalizedDistance));
|
|
@@ -3151,12 +3163,43 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
|
3151
3163
|
function resolveConfig(config) {
|
|
3152
3164
|
return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
|
|
3153
3165
|
}
|
|
3166
|
+
function readMultiDimElo() {
|
|
3167
|
+
try {
|
|
3168
|
+
return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
|
|
3169
|
+
} catch {
|
|
3170
|
+
return false;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
function mountMultiDimEloToggle() {
|
|
3174
|
+
if (typeof window === "undefined") return;
|
|
3175
|
+
const win = window;
|
|
3176
|
+
win.skuilder = win.skuilder || {};
|
|
3177
|
+
Object.defineProperty(win.skuilder, "multiDimElo", {
|
|
3178
|
+
configurable: true,
|
|
3179
|
+
enumerable: true,
|
|
3180
|
+
get: () => multiDimElo,
|
|
3181
|
+
set: (on) => {
|
|
3182
|
+
multiDimElo = on === true;
|
|
3183
|
+
try {
|
|
3184
|
+
if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
|
|
3185
|
+
else localStorage.removeItem(MULTI_DIM_ELO_KEY);
|
|
3186
|
+
} catch (e) {
|
|
3187
|
+
logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
|
|
3188
|
+
}
|
|
3189
|
+
logger.info(
|
|
3190
|
+
`[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
|
|
3191
|
+
);
|
|
3192
|
+
}
|
|
3193
|
+
});
|
|
3194
|
+
}
|
|
3154
3195
|
function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
|
|
3155
3196
|
const globalGap = cardElo.global.score - userElo.global.score;
|
|
3156
3197
|
const tags = [];
|
|
3157
3198
|
for (const tag of cardTags) {
|
|
3158
3199
|
const user = userElo.tags[tag];
|
|
3159
|
-
if (!user || user.score ===
|
|
3200
|
+
if (isCountOnlyTag(tag) || !user || user.score === COUNT_ONLY_SCORE || user.count < minTagCount) {
|
|
3201
|
+
continue;
|
|
3202
|
+
}
|
|
3160
3203
|
const card = cardElo.tags[tag]?.score ?? cardElo.global.score;
|
|
3161
3204
|
tags.push({
|
|
3162
3205
|
tag,
|
|
@@ -3178,7 +3221,7 @@ function tagReason(tags, globalGap) {
|
|
|
3178
3221
|
async function applyEloDistance(cards, context, config, source) {
|
|
3179
3222
|
const { course, userElo, userCourseElo } = context;
|
|
3180
3223
|
const { halfLife, minMultiplier, maxMultiplier } = config;
|
|
3181
|
-
const tagAware = config.tagAware && userCourseElo !== void 0;
|
|
3224
|
+
const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
|
|
3182
3225
|
const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
|
|
3183
3226
|
const fetched = /* @__PURE__ */ new Map();
|
|
3184
3227
|
if (missing.length > 0) {
|
|
@@ -3192,10 +3235,10 @@ async function applyEloDistance(cards, context, config, source) {
|
|
|
3192
3235
|
const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
|
|
3193
3236
|
let distance = Math.abs(cardElo - userElo);
|
|
3194
3237
|
let how = "";
|
|
3195
|
-
if (tagAware
|
|
3196
|
-
const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
|
|
3197
|
-
distance = Math.abs(t.gap);
|
|
3198
|
-
|
|
3238
|
+
if (tagAware) {
|
|
3239
|
+
const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
|
|
3240
|
+
if (t) distance = Math.abs(t.gap);
|
|
3241
|
+
how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
|
|
3199
3242
|
}
|
|
3200
3243
|
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
3201
3244
|
const newScore = card.score * multiplier;
|
|
@@ -3228,21 +3271,24 @@ function createEloDistanceFilter(config) {
|
|
|
3228
3271
|
transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
|
|
3229
3272
|
};
|
|
3230
3273
|
}
|
|
3231
|
-
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF,
|
|
3274
|
+
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
|
|
3232
3275
|
var init_eloDistance = __esm({
|
|
3233
3276
|
"src/core/navigators/filters/eloDistance.ts"() {
|
|
3234
3277
|
"use strict";
|
|
3235
3278
|
init_navigators();
|
|
3279
|
+
init_logger();
|
|
3236
3280
|
DEFAULT_ELO_DISTANCE_CONFIG = {
|
|
3237
3281
|
halfLife: 300,
|
|
3238
3282
|
minMultiplier: 0.05,
|
|
3239
3283
|
maxMultiplier: 1,
|
|
3240
|
-
tagAware:
|
|
3284
|
+
tagAware: false,
|
|
3241
3285
|
minTagCount: 3
|
|
3242
3286
|
};
|
|
3243
3287
|
TAG_CONFIDENCE_HALF = 10;
|
|
3244
|
-
COUNT_ONLY_SENTINEL = -1;
|
|
3245
3288
|
DEFAULT_CARD_ELO = 1e3;
|
|
3289
|
+
MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
|
|
3290
|
+
multiDimElo = readMultiDimElo();
|
|
3291
|
+
mountMultiDimEloToggle();
|
|
3246
3292
|
EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
|
|
3247
3293
|
name;
|
|
3248
3294
|
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|
|
@@ -7099,6 +7145,7 @@ var init_tagRecent = __esm({
|
|
|
7099
7145
|
import {
|
|
7100
7146
|
adjustCourseScores,
|
|
7101
7147
|
adjustCourseScoresPerTag,
|
|
7148
|
+
isCountOnlyTag as isCountOnlyTag2,
|
|
7102
7149
|
toCourseElo as toCourseElo7
|
|
7103
7150
|
} from "@vue-skuilder/common";
|
|
7104
7151
|
var init_EloService = __esm({
|