@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/index.mjs
CHANGED
|
@@ -784,13 +784,12 @@ function clearRunHistory() {
|
|
|
784
784
|
_pendingRuns = [];
|
|
785
785
|
}
|
|
786
786
|
function getOrigin(card) {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
return "unknown";
|
|
787
|
+
return card.reviewID ? "review" : "new";
|
|
788
|
+
}
|
|
789
|
+
function requiredBy(card) {
|
|
790
|
+
return card.provenance.find(
|
|
791
|
+
(p) => p.strategy === "ephemeralHint" && p.score === Number.POSITIVE_INFINITY
|
|
792
|
+
)?.strategyName;
|
|
794
793
|
}
|
|
795
794
|
function captureRun(report) {
|
|
796
795
|
const fullReport = {
|
|
@@ -814,17 +813,23 @@ function parseCardElo(provenance) {
|
|
|
814
813
|
}
|
|
815
814
|
function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints, scoredCards, regulators) {
|
|
816
815
|
const selectedIds = new Set(selectedCards.map((c) => c.cardId));
|
|
817
|
-
const toReport = (card) =>
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
816
|
+
const toReport = (card) => {
|
|
817
|
+
const required = requiredBy(card);
|
|
818
|
+
const first = card.provenance[0];
|
|
819
|
+
const generator = first && first.strategy !== "ephemeralHint" ? first.strategyName || first.strategy : void 0;
|
|
820
|
+
return {
|
|
821
|
+
cardId: card.cardId,
|
|
822
|
+
courseId: card.courseId,
|
|
823
|
+
origin: getOrigin(card),
|
|
824
|
+
...generator ? { generator } : {},
|
|
825
|
+
...required ? { required } : {},
|
|
826
|
+
finalScore: card.score,
|
|
827
|
+
cardElo: card.cardElo ?? parseCardElo(card.provenance),
|
|
828
|
+
provenance: card.provenance,
|
|
829
|
+
tags: card.tags,
|
|
830
|
+
selected: selectedIds.has(card.cardId)
|
|
831
|
+
};
|
|
832
|
+
};
|
|
828
833
|
const selectedReported = [];
|
|
829
834
|
const nearMissReported = [];
|
|
830
835
|
const discardedTailCards = [];
|
|
@@ -1953,10 +1958,14 @@ var init_elo = __esm({
|
|
|
1953
1958
|
const userElo = toCourseElo2(courseReg.elo);
|
|
1954
1959
|
userGlobalElo = userElo.global.score;
|
|
1955
1960
|
}
|
|
1956
|
-
const activeCards = await
|
|
1961
|
+
const [activeCards, seenCards] = await Promise.all([
|
|
1962
|
+
this.user.getActiveCards(),
|
|
1963
|
+
this.user.getSeenCards(this.course.getCourseID()).catch(() => [])
|
|
1964
|
+
]);
|
|
1965
|
+
const notNew = /* @__PURE__ */ new Set([...activeCards.map((ac) => ac.cardID), ...seenCards]);
|
|
1957
1966
|
const newCards = (await this.course.getCardsCenteredAtELO(
|
|
1958
1967
|
{ limit, elo: "user" },
|
|
1959
|
-
(c) => !
|
|
1968
|
+
(c) => !notNew.has(c.cardID)
|
|
1960
1969
|
)).map((c) => ({ ...c, status: "new" }));
|
|
1961
1970
|
const scored = newCards.map((c) => {
|
|
1962
1971
|
const cardElo = c.elo ?? 1e3;
|
|
@@ -2009,6 +2018,7 @@ __export(prescribed_exports, {
|
|
|
2009
2018
|
default: () => PrescribedCardsGenerator,
|
|
2010
2019
|
unmetIntroExposeTags: () => unmetIntroExposeTags
|
|
2011
2020
|
});
|
|
2021
|
+
import { tagRole, withTagRole } from "@vue-skuilder/common";
|
|
2012
2022
|
function dedupe(arr) {
|
|
2013
2023
|
return [...new Set(arr)];
|
|
2014
2024
|
}
|
|
@@ -2049,11 +2059,11 @@ function formatAge(ms) {
|
|
|
2049
2059
|
}
|
|
2050
2060
|
function unmetIntroExposeTags(tags, userTagElo, minCount) {
|
|
2051
2061
|
if (minCount <= 0) return [];
|
|
2052
|
-
const exposeTags = new Set(tags.filter((tag) => tag
|
|
2062
|
+
const exposeTags = new Set(tags.filter((tag) => tagRole(tag) === "expose"));
|
|
2053
2063
|
for (const tag of tags) {
|
|
2054
|
-
if (
|
|
2055
|
-
const
|
|
2056
|
-
if (
|
|
2064
|
+
if (tagRole(tag) !== "intro") continue;
|
|
2065
|
+
const expose = withTagRole(tag, "expose");
|
|
2066
|
+
if (expose) exposeTags.add(expose);
|
|
2057
2067
|
}
|
|
2058
2068
|
return [...exposeTags].filter((tag) => {
|
|
2059
2069
|
const tagElo = userTagElo[tag];
|
|
@@ -3252,8 +3262,10 @@ __export(eloDistance_exports, {
|
|
|
3252
3262
|
DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
|
|
3253
3263
|
createEloDistanceFilter: () => createEloDistanceFilter,
|
|
3254
3264
|
default: () => EloDistanceFilter,
|
|
3265
|
+
mountMultiDimEloToggle: () => mountMultiDimEloToggle,
|
|
3255
3266
|
tagAwareGap: () => tagAwareGap
|
|
3256
3267
|
});
|
|
3268
|
+
import { COUNT_ONLY_SCORE, isCountOnlyTag } from "@vue-skuilder/common";
|
|
3257
3269
|
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
3258
3270
|
const normalizedDistance = distance / halfLife;
|
|
3259
3271
|
const decay = Math.exp(-(normalizedDistance * normalizedDistance));
|
|
@@ -3262,12 +3274,43 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
|
3262
3274
|
function resolveConfig(config) {
|
|
3263
3275
|
return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
|
|
3264
3276
|
}
|
|
3277
|
+
function readMultiDimElo() {
|
|
3278
|
+
try {
|
|
3279
|
+
return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
|
|
3280
|
+
} catch {
|
|
3281
|
+
return false;
|
|
3282
|
+
}
|
|
3283
|
+
}
|
|
3284
|
+
function mountMultiDimEloToggle() {
|
|
3285
|
+
if (typeof window === "undefined") return;
|
|
3286
|
+
const win = window;
|
|
3287
|
+
win.skuilder = win.skuilder || {};
|
|
3288
|
+
Object.defineProperty(win.skuilder, "multiDimElo", {
|
|
3289
|
+
configurable: true,
|
|
3290
|
+
enumerable: true,
|
|
3291
|
+
get: () => multiDimElo,
|
|
3292
|
+
set: (on) => {
|
|
3293
|
+
multiDimElo = on === true;
|
|
3294
|
+
try {
|
|
3295
|
+
if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
|
|
3296
|
+
else localStorage.removeItem(MULTI_DIM_ELO_KEY);
|
|
3297
|
+
} catch (e) {
|
|
3298
|
+
logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
|
|
3299
|
+
}
|
|
3300
|
+
logger.info(
|
|
3301
|
+
`[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
|
|
3302
|
+
);
|
|
3303
|
+
}
|
|
3304
|
+
});
|
|
3305
|
+
}
|
|
3265
3306
|
function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
|
|
3266
3307
|
const globalGap = cardElo.global.score - userElo.global.score;
|
|
3267
3308
|
const tags = [];
|
|
3268
3309
|
for (const tag of cardTags) {
|
|
3269
3310
|
const user = userElo.tags[tag];
|
|
3270
|
-
if (!user || user.score ===
|
|
3311
|
+
if (isCountOnlyTag(tag) || !user || user.score === COUNT_ONLY_SCORE || user.count < minTagCount) {
|
|
3312
|
+
continue;
|
|
3313
|
+
}
|
|
3271
3314
|
const card = cardElo.tags[tag]?.score ?? cardElo.global.score;
|
|
3272
3315
|
tags.push({
|
|
3273
3316
|
tag,
|
|
@@ -3289,7 +3332,7 @@ function tagReason(tags, globalGap) {
|
|
|
3289
3332
|
async function applyEloDistance(cards, context, config, source) {
|
|
3290
3333
|
const { course, userElo, userCourseElo } = context;
|
|
3291
3334
|
const { halfLife, minMultiplier, maxMultiplier } = config;
|
|
3292
|
-
const tagAware = config.tagAware && userCourseElo !== void 0;
|
|
3335
|
+
const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
|
|
3293
3336
|
const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
|
|
3294
3337
|
const fetched = /* @__PURE__ */ new Map();
|
|
3295
3338
|
if (missing.length > 0) {
|
|
@@ -3303,10 +3346,10 @@ async function applyEloDistance(cards, context, config, source) {
|
|
|
3303
3346
|
const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
|
|
3304
3347
|
let distance = Math.abs(cardElo - userElo);
|
|
3305
3348
|
let how = "";
|
|
3306
|
-
if (tagAware
|
|
3307
|
-
const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
|
|
3308
|
-
distance = Math.abs(t.gap);
|
|
3309
|
-
|
|
3349
|
+
if (tagAware) {
|
|
3350
|
+
const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
|
|
3351
|
+
if (t) distance = Math.abs(t.gap);
|
|
3352
|
+
how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
|
|
3310
3353
|
}
|
|
3311
3354
|
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
3312
3355
|
const newScore = card.score * multiplier;
|
|
@@ -3339,21 +3382,24 @@ function createEloDistanceFilter(config) {
|
|
|
3339
3382
|
transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
|
|
3340
3383
|
};
|
|
3341
3384
|
}
|
|
3342
|
-
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF,
|
|
3385
|
+
var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
|
|
3343
3386
|
var init_eloDistance = __esm({
|
|
3344
3387
|
"src/core/navigators/filters/eloDistance.ts"() {
|
|
3345
3388
|
"use strict";
|
|
3346
3389
|
init_navigators();
|
|
3390
|
+
init_logger();
|
|
3347
3391
|
DEFAULT_ELO_DISTANCE_CONFIG = {
|
|
3348
3392
|
halfLife: 300,
|
|
3349
3393
|
minMultiplier: 0.05,
|
|
3350
3394
|
maxMultiplier: 1,
|
|
3351
|
-
tagAware:
|
|
3395
|
+
tagAware: false,
|
|
3352
3396
|
minTagCount: 3
|
|
3353
3397
|
};
|
|
3354
3398
|
TAG_CONFIDENCE_HALF = 10;
|
|
3355
|
-
COUNT_ONLY_SENTINEL = -1;
|
|
3356
3399
|
DEFAULT_CARD_ELO = 1e3;
|
|
3400
|
+
MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
|
|
3401
|
+
multiDimElo = readMultiDimElo();
|
|
3402
|
+
mountMultiDimEloToggle();
|
|
3357
3403
|
EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
|
|
3358
3404
|
name;
|
|
3359
3405
|
/** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */
|
|
@@ -8149,8 +8195,24 @@ var init_tagRecent = __esm({
|
|
|
8149
8195
|
import {
|
|
8150
8196
|
adjustCourseScores,
|
|
8151
8197
|
adjustCourseScoresPerTag,
|
|
8198
|
+
isCountOnlyTag as isCountOnlyTag2,
|
|
8152
8199
|
toCourseElo as toCourseElo7
|
|
8153
8200
|
} from "@vue-skuilder/common";
|
|
8201
|
+
function withCountOnlyRoles(perf, cardId) {
|
|
8202
|
+
const out = { ...perf };
|
|
8203
|
+
const counted = [];
|
|
8204
|
+
for (const [tag, score] of Object.entries(perf)) {
|
|
8205
|
+
if (tag === "_global" || score === null || !isCountOnlyTag2(tag)) continue;
|
|
8206
|
+
out[tag] = null;
|
|
8207
|
+
counted.push(tag);
|
|
8208
|
+
}
|
|
8209
|
+
if (counted.length) {
|
|
8210
|
+
logger.warn(
|
|
8211
|
+
`[EloService] ${cardId} sent scores for bookkeeping tags [${counted.join(", ")}]; counted, not graded`
|
|
8212
|
+
);
|
|
8213
|
+
}
|
|
8214
|
+
return out;
|
|
8215
|
+
}
|
|
8154
8216
|
var EloService;
|
|
8155
8217
|
var init_EloService = __esm({
|
|
8156
8218
|
"src/study/services/EloService.ts"() {
|
|
@@ -8201,10 +8263,11 @@ var init_EloService = __esm({
|
|
|
8201
8263
|
courseReg.elo = eloUpdate.userElo;
|
|
8202
8264
|
const tags = {};
|
|
8203
8265
|
for (const tag of cardTagKeys) {
|
|
8266
|
+
const countOnly = isCountOnlyTag2(tag);
|
|
8204
8267
|
tags[tag] = {
|
|
8205
8268
|
before: beforeUserTag[tag],
|
|
8206
|
-
after: eloUpdate.userElo.tags[tag].score,
|
|
8207
|
-
score: userScore
|
|
8269
|
+
after: countOnly ? beforeUserTag[tag] : eloUpdate.userElo.tags[tag].score,
|
|
8270
|
+
score: countOnly ? null : userScore
|
|
8208
8271
|
};
|
|
8209
8272
|
}
|
|
8210
8273
|
const event = {
|
|
@@ -8275,11 +8338,12 @@ var init_EloService = __esm({
|
|
|
8275
8338
|
]);
|
|
8276
8339
|
const cardElo = cardEloResults[0];
|
|
8277
8340
|
const cardTags = cardTagsMap.get(card_id) ?? [];
|
|
8278
|
-
const
|
|
8341
|
+
const graded = withCountOnlyRoles(taggedPerformance, card_id);
|
|
8342
|
+
const enriched = { ...graded };
|
|
8279
8343
|
const globalScore = taggedPerformance._global;
|
|
8280
8344
|
for (const tag of cardTags) {
|
|
8281
8345
|
if (!(tag in enriched)) {
|
|
8282
|
-
enriched[tag] = globalScore;
|
|
8346
|
+
enriched[tag] = isCountOnlyTag2(tag) ? null : globalScore;
|
|
8283
8347
|
}
|
|
8284
8348
|
}
|
|
8285
8349
|
if (cardElo && userElo) {
|
|
@@ -8294,7 +8358,7 @@ var init_EloService = __esm({
|
|
|
8294
8358
|
const at = (/* @__PURE__ */ new Date()).toISOString();
|
|
8295
8359
|
const recorded = recordTagPresentations(
|
|
8296
8360
|
eloUpdate.userElo,
|
|
8297
|
-
|
|
8361
|
+
graded,
|
|
8298
8362
|
currentCard.records,
|
|
8299
8363
|
card_id,
|
|
8300
8364
|
at
|
|
@@ -11582,7 +11646,9 @@ function toRunCard(c) {
|
|
|
11582
11646
|
cardId: c.cardId,
|
|
11583
11647
|
origin: c.origin,
|
|
11584
11648
|
...c.generator ? { generator: c.generator } : {},
|
|
11585
|
-
|
|
11649
|
+
...c.required ? { required: c.required } : {},
|
|
11650
|
+
// A required card's score is infinite, which JSON can't hold: say so with null.
|
|
11651
|
+
score: Number.isFinite(c.finalScore) ? sig4(c.finalScore) : null,
|
|
11586
11652
|
selected: c.selected
|
|
11587
11653
|
};
|
|
11588
11654
|
}
|