@vue-skuilder/db 0.1.30 → 0.1.31-b

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/index.mjs CHANGED
@@ -943,6 +943,7 @@ var MAX_RUNS, runHistory, pipelineDebugAPI;
943
943
  var init_PipelineDebugger = __esm({
944
944
  "src/core/navigators/PipelineDebugger.ts"() {
945
945
  "use strict";
946
+ init_navigators();
946
947
  init_logger();
947
948
  MAX_RUNS = 10;
948
949
  runHistory = [];
@@ -1085,6 +1086,66 @@ var init_PipelineDebugger = __esm({
1085
1086
  runHistory.length = 0;
1086
1087
  logger.info("[Pipeline Debug] Run history cleared.");
1087
1088
  },
1089
+ /**
1090
+ * Show the navigator registry: all registered classes and their roles.
1091
+ *
1092
+ * Useful for verifying that consumer-defined navigators were registered
1093
+ * before pipeline assembly.
1094
+ */
1095
+ showRegistry() {
1096
+ const names = getRegisteredNavigatorNames();
1097
+ if (names.length === 0) {
1098
+ logger.info("[Pipeline Debug] Navigator registry is empty.");
1099
+ return;
1100
+ }
1101
+ console.group("\u{1F4E6} Navigator Registry");
1102
+ console.table(
1103
+ names.map((name) => {
1104
+ const registryRole = getRegisteredNavigatorRole(name);
1105
+ const builtinRole = NavigatorRoles[name];
1106
+ const effectiveRole = builtinRole || registryRole || "\u26A0\uFE0F NONE";
1107
+ const source = builtinRole ? "built-in" : registryRole ? "consumer" : "unclassified";
1108
+ return {
1109
+ name,
1110
+ role: effectiveRole,
1111
+ source,
1112
+ isGenerator: isGenerator(name),
1113
+ isFilter: isFilter(name)
1114
+ };
1115
+ })
1116
+ );
1117
+ console.groupEnd();
1118
+ },
1119
+ /**
1120
+ * Show strategy documents from the last pipeline run and how they mapped
1121
+ * to the registry.
1122
+ *
1123
+ * If no runs are captured yet, falls back to showing just the registry.
1124
+ */
1125
+ showStrategies() {
1126
+ this.showRegistry();
1127
+ if (runHistory.length === 0) {
1128
+ logger.info("[Pipeline Debug] No pipeline runs captured yet \u2014 cannot show strategy doc mapping.");
1129
+ return;
1130
+ }
1131
+ const run = runHistory[0];
1132
+ console.group("\u{1F50C} Pipeline Strategy Mapping (last run)");
1133
+ logger.info(`Generator: ${run.generatorName}`);
1134
+ if (run.generators && run.generators.length > 0) {
1135
+ for (const g of run.generators) {
1136
+ logger.info(` \u{1F4E5} ${g.name}: ${g.cardCount} cards (${g.newCount} new, ${g.reviewCount} reviews)`);
1137
+ }
1138
+ }
1139
+ if (run.filters.length > 0) {
1140
+ logger.info("Filters:");
1141
+ for (const f of run.filters) {
1142
+ logger.info(` \u{1F538} ${f.name}: \u2191${f.boosted} \u2193${f.penalized} =${f.passed} \u2715${f.removed}`);
1143
+ }
1144
+ } else {
1145
+ logger.info("Filters: (none)");
1146
+ }
1147
+ console.groupEnd();
1148
+ },
1088
1149
  /**
1089
1150
  * Show help.
1090
1151
  */
@@ -1097,6 +1158,8 @@ Commands:
1097
1158
  .showRun(id|index) Show summary of a specific run (by index or ID suffix)
1098
1159
  .showCard(cardId) Show provenance trail for a specific card
1099
1160
  .explainReviews() Analyze why reviews were/weren't selected
1161
+ .showRegistry() Show navigator registry (classes + roles)
1162
+ .showStrategies() Show registry + strategy mapping from last run
1100
1163
  .listRuns() List all captured runs in table format
1101
1164
  .export() Export run history as JSON for bug reports
1102
1165
  .clear() Clear run history
@@ -1359,19 +1422,20 @@ var init_elo = __esm({
1359
1422
  const scored = newCards.map((c, i) => {
1360
1423
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1361
1424
  const distance = Math.abs(cardElo - userGlobalElo);
1362
- const score = Math.max(0, 1 - distance / 500);
1425
+ const rawScore = Math.max(0, 1 - distance / 500);
1426
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1363
1427
  return {
1364
1428
  cardId: c.cardID,
1365
1429
  courseId: c.courseID,
1366
- score,
1430
+ score: samplingKey,
1367
1431
  provenance: [
1368
1432
  {
1369
1433
  strategy: "elo",
1370
1434
  strategyName: this.strategyName || this.name,
1371
1435
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1372
1436
  action: "generated",
1373
- score,
1374
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1437
+ score: samplingKey,
1438
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1375
1439
  }
1376
1440
  ]
1377
1441
  };
@@ -8258,6 +8322,7 @@ import moment8 from "moment";
8258
8322
  init_util();
8259
8323
  init_logger();
8260
8324
  import moment7 from "moment";
8325
+ import { isTaggedPerformance } from "@vue-skuilder/common";
8261
8326
  var duration = moment7.duration;
8262
8327
  function newInterval(user, cardHistory) {
8263
8328
  if (areQuestionRecords(cardHistory)) {
@@ -8277,7 +8342,9 @@ function newQuestionInterval(user, cardHistory) {
8277
8342
  });
8278
8343
  }
8279
8344
  if (currentAttempt.isCorrect) {
8280
- const skill = Math.min(1, Math.max(0, currentAttempt.performance));
8345
+ const rawPerf = currentAttempt.performance;
8346
+ const numericPerf = isTaggedPerformance(rawPerf) ? rawPerf._global : rawPerf;
8347
+ const skill = Math.min(1, Math.max(0, numericPerf));
8281
8348
  logger.debug(`Demontrated skill: ${skill}`);
8282
8349
  const interval = lastInterval * (0.75 + skill);
8283
8350
  cardHistory.lapses = getLapses(cardHistory.records);
@@ -8491,7 +8558,7 @@ var EloService = class {
8491
8558
  // src/study/services/ResponseProcessor.ts
8492
8559
  init_core();
8493
8560
  init_logger();
8494
- import { isTaggedPerformance } from "@vue-skuilder/common";
8561
+ import { isTaggedPerformance as isTaggedPerformance2 } from "@vue-skuilder/common";
8495
8562
  var ResponseProcessor = class {
8496
8563
  srsService;
8497
8564
  eloService;
@@ -8512,7 +8579,7 @@ var ResponseProcessor = class {
8512
8579
  taggedPerformance: null
8513
8580
  };
8514
8581
  }
8515
- if (isTaggedPerformance(performance2)) {
8582
+ if (isTaggedPerformance2(performance2)) {
8516
8583
  return {
8517
8584
  globalScore: performance2._global,
8518
8585
  taggedPerformance: performance2