@vue-skuilder/db 0.2.30 → 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 +88 -76
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +40 -27
- 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 +92 -80
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +40 -27
- 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 +79 -67
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +40 -27
- 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 +141 -110
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -33
- 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 +7 -8
- 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
|
@@ -379,7 +379,7 @@ function attachEloEvents(responses, events, interp) {
|
|
|
379
379
|
let bestGap = Infinity;
|
|
380
380
|
responses.forEach((r, i) => {
|
|
381
381
|
if (used.has(i) || r.cardId !== ev.cardId) return;
|
|
382
|
-
const gap = Math.abs(Date.parse(r.at) - evT);
|
|
382
|
+
const gap = Math.abs(Date.parse(r.at) + r.timeSpentMs - evT);
|
|
383
383
|
if (gap < bestGap) {
|
|
384
384
|
bestGap = gap;
|
|
385
385
|
best = i;
|
|
@@ -526,6 +526,150 @@ function recordPerformance(r) {
|
|
|
526
526
|
return null;
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
+
// src/diagnostics/pipeline.ts
|
|
530
|
+
function runCardSource(card) {
|
|
531
|
+
if (card.required) return `required: ${card.required}`;
|
|
532
|
+
return card.generator ?? "unknown";
|
|
533
|
+
}
|
|
534
|
+
function selectedBySource(run) {
|
|
535
|
+
const counts = /* @__PURE__ */ new Map();
|
|
536
|
+
for (const c of run.cards ?? []) {
|
|
537
|
+
if (!c.selected) continue;
|
|
538
|
+
const source = runCardSource(c);
|
|
539
|
+
counts.set(source, (counts.get(source) ?? 0) + 1);
|
|
540
|
+
}
|
|
541
|
+
return [...counts].map(([source, count]) => ({ source, count })).sort((a, b) => b.count - a.count);
|
|
542
|
+
}
|
|
543
|
+
function pipelineRunStats(ds, opts = {}) {
|
|
544
|
+
const sessions = ds.sessions.filter((s) => !opts.since || s.startTime >= opts.since);
|
|
545
|
+
const recordsBySession = /* @__PURE__ */ new Map();
|
|
546
|
+
for (const h of ds.cardHistories) {
|
|
547
|
+
for (const record of h.records) {
|
|
548
|
+
if (!record.sessionId) continue;
|
|
549
|
+
const list = recordsBySession.get(record.sessionId) ?? [];
|
|
550
|
+
list.push({ cardId: h.cardID, record });
|
|
551
|
+
recordsBySession.set(record.sessionId, list);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
const gens = /* @__PURE__ */ new Map();
|
|
555
|
+
const gen = (name) => {
|
|
556
|
+
let g = gens.get(name);
|
|
557
|
+
if (!g) {
|
|
558
|
+
g = {
|
|
559
|
+
name,
|
|
560
|
+
runs: 0,
|
|
561
|
+
cards: 0,
|
|
562
|
+
newCards: 0,
|
|
563
|
+
reviewCards: 0,
|
|
564
|
+
topScoreMax: 0,
|
|
565
|
+
topScoreLast: 0,
|
|
566
|
+
selected: 0,
|
|
567
|
+
firstAttempts: 0,
|
|
568
|
+
firstAttemptsCorrect: 0
|
|
569
|
+
};
|
|
570
|
+
gens.set(name, g);
|
|
571
|
+
}
|
|
572
|
+
return g;
|
|
573
|
+
};
|
|
574
|
+
const filters = /* @__PURE__ */ new Map();
|
|
575
|
+
const regulators = /* @__PURE__ */ new Map();
|
|
576
|
+
let runs = 0;
|
|
577
|
+
let runsWithSelection = 0;
|
|
578
|
+
let selectedUnattributed = 0;
|
|
579
|
+
let firstRunAt;
|
|
580
|
+
let lastRunAt;
|
|
581
|
+
for (const session of sessions) {
|
|
582
|
+
const originBySelectedCard = /* @__PURE__ */ new Map();
|
|
583
|
+
for (const run of session.runs ?? []) {
|
|
584
|
+
runs++;
|
|
585
|
+
if (!firstRunAt || run.at < firstRunAt) firstRunAt = run.at;
|
|
586
|
+
if (!lastRunAt || run.at > lastRunAt) lastRunAt = run.at;
|
|
587
|
+
for (const s of run.generators ?? []) {
|
|
588
|
+
const g = gen(s.name);
|
|
589
|
+
g.runs++;
|
|
590
|
+
g.cards += s.cardCount;
|
|
591
|
+
g.newCards += s.newCount;
|
|
592
|
+
g.reviewCards += s.reviewCount;
|
|
593
|
+
g.topScoreMax = Math.max(g.topScoreMax, s.topScore);
|
|
594
|
+
g.topScoreLast = s.topScore;
|
|
595
|
+
}
|
|
596
|
+
for (const f of run.filters ?? []) {
|
|
597
|
+
const acc = filters.get(f.name) ?? {
|
|
598
|
+
name: f.name,
|
|
599
|
+
runs: 0,
|
|
600
|
+
boosted: 0,
|
|
601
|
+
penalized: 0,
|
|
602
|
+
passed: 0,
|
|
603
|
+
removed: 0
|
|
604
|
+
};
|
|
605
|
+
acc.runs++;
|
|
606
|
+
if (f.kind) acc.kind = f.kind;
|
|
607
|
+
acc.boosted += f.boosted;
|
|
608
|
+
acc.penalized += f.penalized;
|
|
609
|
+
acc.passed += f.passed;
|
|
610
|
+
acc.removed += f.removed;
|
|
611
|
+
filters.set(f.name, acc);
|
|
612
|
+
}
|
|
613
|
+
for (const r of run.regulators ?? []) {
|
|
614
|
+
const acc = regulators.get(r.name) ?? {
|
|
615
|
+
name: r.name,
|
|
616
|
+
class: r.class,
|
|
617
|
+
runs: 0,
|
|
618
|
+
meanMultiplier: 0,
|
|
619
|
+
maxMultiplier: 0,
|
|
620
|
+
runsActive: 0,
|
|
621
|
+
last: r,
|
|
622
|
+
sumMultiplier: 0
|
|
623
|
+
};
|
|
624
|
+
acc.runs++;
|
|
625
|
+
acc.sumMultiplier += r.multiplier;
|
|
626
|
+
acc.maxMultiplier = Math.max(acc.maxMultiplier, r.multiplier);
|
|
627
|
+
if (r.multiplier > 1) acc.runsActive++;
|
|
628
|
+
acc.last = r;
|
|
629
|
+
regulators.set(r.name, acc);
|
|
630
|
+
}
|
|
631
|
+
if (run.cards) {
|
|
632
|
+
runsWithSelection++;
|
|
633
|
+
for (const c of run.cards) {
|
|
634
|
+
if (!c.selected) continue;
|
|
635
|
+
if (!c.generator) {
|
|
636
|
+
selectedUnattributed++;
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
gen(c.generator).selected++;
|
|
640
|
+
if (!originBySelectedCard.has(c.cardId)) originBySelectedCard.set(c.cardId, c.generator);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
for (const { cardId, record } of recordsBySession.get(session.sessionId) ?? []) {
|
|
645
|
+
const origin = originBySelectedCard.get(cardId);
|
|
646
|
+
if (!origin || record.priorAttemps !== 0) continue;
|
|
647
|
+
const g = gen(origin);
|
|
648
|
+
g.firstAttempts++;
|
|
649
|
+
if (record.isCorrect === true) g.firstAttemptsCorrect++;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
return {
|
|
653
|
+
sessions: sessions.length,
|
|
654
|
+
runs,
|
|
655
|
+
runsWithSelection,
|
|
656
|
+
firstRunAt,
|
|
657
|
+
lastRunAt,
|
|
658
|
+
generators: [...gens.values()].map(({ cards, newCards, reviewCards, ...g }) => ({
|
|
659
|
+
...g,
|
|
660
|
+
meanCards: g.runs ? cards / g.runs : 0,
|
|
661
|
+
meanNew: g.runs ? newCards / g.runs : 0,
|
|
662
|
+
meanReview: g.runs ? reviewCards / g.runs : 0
|
|
663
|
+
})).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name)),
|
|
664
|
+
filters: [...filters.values()].sort((a, b) => a.name.localeCompare(b.name)),
|
|
665
|
+
regulators: [...regulators.values()].map(({ sumMultiplier, ...r }) => ({
|
|
666
|
+
...r,
|
|
667
|
+
meanMultiplier: r.runs ? sumMultiplier / r.runs : 0
|
|
668
|
+
})),
|
|
669
|
+
selectedUnattributed
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
|
|
529
673
|
// src/diagnostics/text.ts
|
|
530
674
|
function fmtDelta(d) {
|
|
531
675
|
if (d === null) return "\u2014";
|
|
@@ -551,11 +695,12 @@ function fmtAnswer(a, max = 40) {
|
|
|
551
695
|
}
|
|
552
696
|
}
|
|
553
697
|
function fmtScore(n) {
|
|
698
|
+
if (n === null || !Number.isFinite(n)) return "\u221E";
|
|
554
699
|
return Math.abs(n) >= 0.01 || n === 0 ? n.toFixed(2) : n.toExponential(1);
|
|
555
700
|
}
|
|
556
701
|
function trailText(label, t) {
|
|
557
702
|
const lines = [
|
|
558
|
-
` ${label}: ${t.cardId} (${t.origin}, ${t
|
|
703
|
+
` ${label}: ${t.cardId} (${t.origin}, ${runCardSource(t)}) final ${fmtScore(t.score)}`
|
|
559
704
|
];
|
|
560
705
|
for (const p of t.trail) {
|
|
561
706
|
lines.push(` ${p.action} ${p.strategyName} \u2192 ${fmtScore(p.score)}: ${p.reason}`);
|
|
@@ -598,10 +743,12 @@ function runText(run) {
|
|
|
598
743
|
}
|
|
599
744
|
if (run.hints) L.push(` hints: ${JSON.stringify(run.hints)}`);
|
|
600
745
|
if (run.cards?.length) {
|
|
746
|
+
const sources = selectedBySource(run).map((s) => `${s.source} ${s.count}`);
|
|
747
|
+
if (sources.length) L.push(` selected by source: ${sources.join(" \xB7 ")}`);
|
|
601
748
|
L.push(" selection (\u2713 selected, \xB7 runner-up):");
|
|
602
749
|
for (const c of run.cards) {
|
|
603
750
|
L.push(
|
|
604
|
-
` ${c.selected ? "\u2713" : "\xB7"} ${c.cardId} (${c.origin}, ${c
|
|
751
|
+
` ${c.selected ? "\u2713" : "\xB7"} ${c.cardId} (${c.origin}, ${runCardSource(c)}) ${fmtScore(c.score)}`
|
|
605
752
|
);
|
|
606
753
|
}
|
|
607
754
|
}
|
|
@@ -651,7 +798,9 @@ function sessionText(username, detail, extras = {}, interp) {
|
|
|
651
798
|
L.push(" hints: the ReplanHints the navigator was told (_label = replan reason).");
|
|
652
799
|
L.push(' selection: the chosen cards and top runners-up. "next new in line" / "top-generated');
|
|
653
800
|
L.push(' new (sunk)": the unselected new cards worth explaining, with each score change.');
|
|
654
|
-
L.push(
|
|
801
|
+
L.push(" Each card reads (origin, source). origin: review = a scheduled review, new = anything");
|
|
802
|
+
L.push(' else. source: the generator that produced it, or "required: <hint>" when a hint forced');
|
|
803
|
+
L.push(' it. Older runs show origin "unknown" for prescribed and hint-required cards.');
|
|
655
804
|
L.push(`- RESP "\u2713/\u2717 type <cardId> [tags] Ts (attempt k) 'answer'": one presentation and`);
|
|
656
805
|
L.push(' its outcome. A trailing "ELO g:before\u2192after (\u0394) | tag:\u0394 \u2026" is the exchange it');
|
|
657
806
|
L.push(" produced. Only first attempts move ELO.");
|
|
@@ -720,137 +869,6 @@ function sessionText(username, detail, extras = {}, interp) {
|
|
|
720
869
|
}
|
|
721
870
|
return L.join("\n");
|
|
722
871
|
}
|
|
723
|
-
|
|
724
|
-
// src/diagnostics/pipeline.ts
|
|
725
|
-
function pipelineRunStats(ds, opts = {}) {
|
|
726
|
-
const sessions = ds.sessions.filter((s) => !opts.since || s.startTime >= opts.since);
|
|
727
|
-
const recordsBySession = /* @__PURE__ */ new Map();
|
|
728
|
-
for (const h of ds.cardHistories) {
|
|
729
|
-
for (const record of h.records) {
|
|
730
|
-
if (!record.sessionId) continue;
|
|
731
|
-
const list = recordsBySession.get(record.sessionId) ?? [];
|
|
732
|
-
list.push({ cardId: h.cardID, record });
|
|
733
|
-
recordsBySession.set(record.sessionId, list);
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
const gens = /* @__PURE__ */ new Map();
|
|
737
|
-
const gen = (name) => {
|
|
738
|
-
let g = gens.get(name);
|
|
739
|
-
if (!g) {
|
|
740
|
-
g = {
|
|
741
|
-
name,
|
|
742
|
-
runs: 0,
|
|
743
|
-
cards: 0,
|
|
744
|
-
newCards: 0,
|
|
745
|
-
reviewCards: 0,
|
|
746
|
-
topScoreMax: 0,
|
|
747
|
-
topScoreLast: 0,
|
|
748
|
-
selected: 0,
|
|
749
|
-
firstAttempts: 0,
|
|
750
|
-
firstAttemptsCorrect: 0
|
|
751
|
-
};
|
|
752
|
-
gens.set(name, g);
|
|
753
|
-
}
|
|
754
|
-
return g;
|
|
755
|
-
};
|
|
756
|
-
const filters = /* @__PURE__ */ new Map();
|
|
757
|
-
const regulators = /* @__PURE__ */ new Map();
|
|
758
|
-
let runs = 0;
|
|
759
|
-
let runsWithSelection = 0;
|
|
760
|
-
let selectedUnattributed = 0;
|
|
761
|
-
let firstRunAt;
|
|
762
|
-
let lastRunAt;
|
|
763
|
-
for (const session of sessions) {
|
|
764
|
-
const originBySelectedCard = /* @__PURE__ */ new Map();
|
|
765
|
-
for (const run of session.runs ?? []) {
|
|
766
|
-
runs++;
|
|
767
|
-
if (!firstRunAt || run.at < firstRunAt) firstRunAt = run.at;
|
|
768
|
-
if (!lastRunAt || run.at > lastRunAt) lastRunAt = run.at;
|
|
769
|
-
for (const s of run.generators ?? []) {
|
|
770
|
-
const g = gen(s.name);
|
|
771
|
-
g.runs++;
|
|
772
|
-
g.cards += s.cardCount;
|
|
773
|
-
g.newCards += s.newCount;
|
|
774
|
-
g.reviewCards += s.reviewCount;
|
|
775
|
-
g.topScoreMax = Math.max(g.topScoreMax, s.topScore);
|
|
776
|
-
g.topScoreLast = s.topScore;
|
|
777
|
-
}
|
|
778
|
-
for (const f of run.filters ?? []) {
|
|
779
|
-
const acc = filters.get(f.name) ?? {
|
|
780
|
-
name: f.name,
|
|
781
|
-
runs: 0,
|
|
782
|
-
boosted: 0,
|
|
783
|
-
penalized: 0,
|
|
784
|
-
passed: 0,
|
|
785
|
-
removed: 0
|
|
786
|
-
};
|
|
787
|
-
acc.runs++;
|
|
788
|
-
if (f.kind) acc.kind = f.kind;
|
|
789
|
-
acc.boosted += f.boosted;
|
|
790
|
-
acc.penalized += f.penalized;
|
|
791
|
-
acc.passed += f.passed;
|
|
792
|
-
acc.removed += f.removed;
|
|
793
|
-
filters.set(f.name, acc);
|
|
794
|
-
}
|
|
795
|
-
for (const r of run.regulators ?? []) {
|
|
796
|
-
const acc = regulators.get(r.name) ?? {
|
|
797
|
-
name: r.name,
|
|
798
|
-
class: r.class,
|
|
799
|
-
runs: 0,
|
|
800
|
-
meanMultiplier: 0,
|
|
801
|
-
maxMultiplier: 0,
|
|
802
|
-
runsActive: 0,
|
|
803
|
-
last: r,
|
|
804
|
-
sumMultiplier: 0
|
|
805
|
-
};
|
|
806
|
-
acc.runs++;
|
|
807
|
-
acc.sumMultiplier += r.multiplier;
|
|
808
|
-
acc.maxMultiplier = Math.max(acc.maxMultiplier, r.multiplier);
|
|
809
|
-
if (r.multiplier > 1) acc.runsActive++;
|
|
810
|
-
acc.last = r;
|
|
811
|
-
regulators.set(r.name, acc);
|
|
812
|
-
}
|
|
813
|
-
if (run.cards) {
|
|
814
|
-
runsWithSelection++;
|
|
815
|
-
for (const c of run.cards) {
|
|
816
|
-
if (!c.selected) continue;
|
|
817
|
-
if (!c.generator) {
|
|
818
|
-
selectedUnattributed++;
|
|
819
|
-
continue;
|
|
820
|
-
}
|
|
821
|
-
gen(c.generator).selected++;
|
|
822
|
-
if (!originBySelectedCard.has(c.cardId)) originBySelectedCard.set(c.cardId, c.generator);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
for (const { cardId, record } of recordsBySession.get(session.sessionId) ?? []) {
|
|
827
|
-
const origin = originBySelectedCard.get(cardId);
|
|
828
|
-
if (!origin || record.priorAttemps !== 0) continue;
|
|
829
|
-
const g = gen(origin);
|
|
830
|
-
g.firstAttempts++;
|
|
831
|
-
if (record.isCorrect === true) g.firstAttemptsCorrect++;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
return {
|
|
835
|
-
sessions: sessions.length,
|
|
836
|
-
runs,
|
|
837
|
-
runsWithSelection,
|
|
838
|
-
firstRunAt,
|
|
839
|
-
lastRunAt,
|
|
840
|
-
generators: [...gens.values()].map(({ cards, newCards, reviewCards, ...g }) => ({
|
|
841
|
-
...g,
|
|
842
|
-
meanCards: g.runs ? cards / g.runs : 0,
|
|
843
|
-
meanNew: g.runs ? newCards / g.runs : 0,
|
|
844
|
-
meanReview: g.runs ? reviewCards / g.runs : 0
|
|
845
|
-
})).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name)),
|
|
846
|
-
filters: [...filters.values()].sort((a, b) => a.name.localeCompare(b.name)),
|
|
847
|
-
regulators: [...regulators.values()].map(({ sumMultiplier, ...r }) => ({
|
|
848
|
-
...r,
|
|
849
|
-
meanMultiplier: r.runs ? sumMultiplier / r.runs : 0
|
|
850
|
-
})),
|
|
851
|
-
selectedUnattributed
|
|
852
|
-
};
|
|
853
|
-
}
|
|
854
872
|
export {
|
|
855
873
|
SESSION_FLAGS,
|
|
856
874
|
SESSION_FLAG_THRESHOLDS,
|
|
@@ -861,14 +879,17 @@ export {
|
|
|
861
879
|
fmtAnswer,
|
|
862
880
|
fmtDelta,
|
|
863
881
|
fmtDuration,
|
|
882
|
+
fmtScore,
|
|
864
883
|
fromDump,
|
|
865
884
|
isSkillTag,
|
|
866
885
|
parseLearnerDump,
|
|
867
886
|
pipelineRunStats,
|
|
868
887
|
recordPerformance,
|
|
869
888
|
regulatorText,
|
|
889
|
+
runCardSource,
|
|
870
890
|
runText,
|
|
871
891
|
scoredTagDeltas,
|
|
892
|
+
selectedBySource,
|
|
872
893
|
servedTags,
|
|
873
894
|
sessionDetail,
|
|
874
895
|
sessionText,
|