@vue-skuilder/db 0.2.29 → 0.2.30

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.
@@ -2949,6 +2949,7 @@ __export(eloDistance_exports, {
2949
2949
  DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
2950
2950
  createEloDistanceFilter: () => createEloDistanceFilter,
2951
2951
  default: () => EloDistanceFilter,
2952
+ mountMultiDimEloToggle: () => mountMultiDimEloToggle,
2952
2953
  tagAwareGap: () => tagAwareGap
2953
2954
  });
2954
2955
  function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
@@ -2959,6 +2960,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
2959
2960
  function resolveConfig(config) {
2960
2961
  return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
2961
2962
  }
2963
+ function readMultiDimElo() {
2964
+ try {
2965
+ return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
2966
+ } catch {
2967
+ return false;
2968
+ }
2969
+ }
2970
+ function mountMultiDimEloToggle() {
2971
+ if (typeof window === "undefined") return;
2972
+ const win = window;
2973
+ win.skuilder = win.skuilder || {};
2974
+ Object.defineProperty(win.skuilder, "multiDimElo", {
2975
+ configurable: true,
2976
+ enumerable: true,
2977
+ get: () => multiDimElo,
2978
+ set: (on) => {
2979
+ multiDimElo = on === true;
2980
+ try {
2981
+ if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
2982
+ else localStorage.removeItem(MULTI_DIM_ELO_KEY);
2983
+ } catch (e) {
2984
+ logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
2985
+ }
2986
+ logger.info(
2987
+ `[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
2988
+ );
2989
+ }
2990
+ });
2991
+ }
2962
2992
  function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
2963
2993
  const globalGap = cardElo.global.score - userElo.global.score;
2964
2994
  const tags = [];
@@ -2986,7 +3016,7 @@ function tagReason(tags, globalGap) {
2986
3016
  async function applyEloDistance(cards, context, config, source) {
2987
3017
  const { course, userElo, userCourseElo } = context;
2988
3018
  const { halfLife, minMultiplier, maxMultiplier } = config;
2989
- const tagAware = config.tagAware && userCourseElo !== void 0;
3019
+ const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
2990
3020
  const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
2991
3021
  const fetched = /* @__PURE__ */ new Map();
2992
3022
  if (missing.length > 0) {
@@ -3000,10 +3030,10 @@ async function applyEloDistance(cards, context, config, source) {
3000
3030
  const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
3001
3031
  let distance = Math.abs(cardElo - userElo);
3002
3032
  let how = "";
3003
- if (tagAware && full) {
3004
- const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
3005
- distance = Math.abs(t.gap);
3006
- if (t.tags.length > 0) how = tagReason(t.tags, t.globalGap);
3033
+ if (tagAware) {
3034
+ const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
3035
+ if (t) distance = Math.abs(t.gap);
3036
+ how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
3007
3037
  }
3008
3038
  const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
3009
3039
  const newScore = card.score * multiplier;
@@ -3036,21 +3066,25 @@ function createEloDistanceFilter(config) {
3036
3066
  transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
3037
3067
  };
3038
3068
  }
3039
- var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
3069
+ var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
3040
3070
  var init_eloDistance = __esm({
3041
3071
  "src/core/navigators/filters/eloDistance.ts"() {
3042
3072
  "use strict";
3043
3073
  init_navigators();
3074
+ init_logger();
3044
3075
  DEFAULT_ELO_DISTANCE_CONFIG = {
3045
3076
  halfLife: 300,
3046
3077
  minMultiplier: 0.05,
3047
3078
  maxMultiplier: 1,
3048
- tagAware: true,
3079
+ tagAware: false,
3049
3080
  minTagCount: 3
3050
3081
  };
3051
3082
  TAG_CONFIDENCE_HALF = 10;
3052
3083
  COUNT_ONLY_SENTINEL = -1;
3053
3084
  DEFAULT_CARD_ELO = 1e3;
3085
+ MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
3086
+ multiDimElo = readMultiDimElo();
3087
+ mountMultiDimEloToggle();
3054
3088
  EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
3055
3089
  name;
3056
3090
  /** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */