@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.
@@ -616,6 +616,7 @@ var MAX_RUNS, runHistory, pipelineDebugAPI;
616
616
  var init_PipelineDebugger = __esm({
617
617
  "src/core/navigators/PipelineDebugger.ts"() {
618
618
  "use strict";
619
+ init_navigators();
619
620
  init_logger();
620
621
  MAX_RUNS = 10;
621
622
  runHistory = [];
@@ -758,6 +759,66 @@ var init_PipelineDebugger = __esm({
758
759
  runHistory.length = 0;
759
760
  logger.info("[Pipeline Debug] Run history cleared.");
760
761
  },
762
+ /**
763
+ * Show the navigator registry: all registered classes and their roles.
764
+ *
765
+ * Useful for verifying that consumer-defined navigators were registered
766
+ * before pipeline assembly.
767
+ */
768
+ showRegistry() {
769
+ const names = getRegisteredNavigatorNames();
770
+ if (names.length === 0) {
771
+ logger.info("[Pipeline Debug] Navigator registry is empty.");
772
+ return;
773
+ }
774
+ console.group("\u{1F4E6} Navigator Registry");
775
+ console.table(
776
+ names.map((name) => {
777
+ const registryRole = getRegisteredNavigatorRole(name);
778
+ const builtinRole = NavigatorRoles[name];
779
+ const effectiveRole = builtinRole || registryRole || "\u26A0\uFE0F NONE";
780
+ const source = builtinRole ? "built-in" : registryRole ? "consumer" : "unclassified";
781
+ return {
782
+ name,
783
+ role: effectiveRole,
784
+ source,
785
+ isGenerator: isGenerator(name),
786
+ isFilter: isFilter(name)
787
+ };
788
+ })
789
+ );
790
+ console.groupEnd();
791
+ },
792
+ /**
793
+ * Show strategy documents from the last pipeline run and how they mapped
794
+ * to the registry.
795
+ *
796
+ * If no runs are captured yet, falls back to showing just the registry.
797
+ */
798
+ showStrategies() {
799
+ this.showRegistry();
800
+ if (runHistory.length === 0) {
801
+ logger.info("[Pipeline Debug] No pipeline runs captured yet \u2014 cannot show strategy doc mapping.");
802
+ return;
803
+ }
804
+ const run = runHistory[0];
805
+ console.group("\u{1F50C} Pipeline Strategy Mapping (last run)");
806
+ logger.info(`Generator: ${run.generatorName}`);
807
+ if (run.generators && run.generators.length > 0) {
808
+ for (const g of run.generators) {
809
+ logger.info(` \u{1F4E5} ${g.name}: ${g.cardCount} cards (${g.newCount} new, ${g.reviewCount} reviews)`);
810
+ }
811
+ }
812
+ if (run.filters.length > 0) {
813
+ logger.info("Filters:");
814
+ for (const f of run.filters) {
815
+ logger.info(` \u{1F538} ${f.name}: \u2191${f.boosted} \u2193${f.penalized} =${f.passed} \u2715${f.removed}`);
816
+ }
817
+ } else {
818
+ logger.info("Filters: (none)");
819
+ }
820
+ console.groupEnd();
821
+ },
761
822
  /**
762
823
  * Show help.
763
824
  */
@@ -770,6 +831,8 @@ Commands:
770
831
  .showRun(id|index) Show summary of a specific run (by index or ID suffix)
771
832
  .showCard(cardId) Show provenance trail for a specific card
772
833
  .explainReviews() Analyze why reviews were/weren't selected
834
+ .showRegistry() Show navigator registry (classes + roles)
835
+ .showStrategies() Show registry + strategy mapping from last run
773
836
  .listRuns() List all captured runs in table format
774
837
  .export() Export run history as JSON for bug reports
775
838
  .clear() Clear run history
@@ -1032,19 +1095,20 @@ var init_elo = __esm({
1032
1095
  const scored = newCards.map((c, i) => {
1033
1096
  const cardElo = cardEloData[i]?.global?.score ?? 1e3;
1034
1097
  const distance = Math.abs(cardElo - userGlobalElo);
1035
- const score = Math.max(0, 1 - distance / 500);
1098
+ const rawScore = Math.max(0, 1 - distance / 500);
1099
+ const samplingKey = rawScore > 0 ? Math.random() ** (1 / rawScore) : 0;
1036
1100
  return {
1037
1101
  cardId: c.cardID,
1038
1102
  courseId: c.courseID,
1039
- score,
1103
+ score: samplingKey,
1040
1104
  provenance: [
1041
1105
  {
1042
1106
  strategy: "elo",
1043
1107
  strategyName: this.strategyName || this.name,
1044
1108
  strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
1045
1109
  action: "generated",
1046
- score,
1047
- reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
1110
+ score: samplingKey,
1111
+ reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), raw ${rawScore.toFixed(3)}, key ${samplingKey.toFixed(3)}`
1048
1112
  }
1049
1113
  ]
1050
1114
  };