@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.
@@ -2972,6 +2972,7 @@ __export(eloDistance_exports, {
2972
2972
  DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
2973
2973
  createEloDistanceFilter: () => createEloDistanceFilter,
2974
2974
  default: () => EloDistanceFilter,
2975
+ mountMultiDimEloToggle: () => mountMultiDimEloToggle,
2975
2976
  tagAwareGap: () => tagAwareGap
2976
2977
  });
2977
2978
  function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
@@ -2982,6 +2983,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
2982
2983
  function resolveConfig(config) {
2983
2984
  return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
2984
2985
  }
2986
+ function readMultiDimElo() {
2987
+ try {
2988
+ return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
2989
+ } catch {
2990
+ return false;
2991
+ }
2992
+ }
2993
+ function mountMultiDimEloToggle() {
2994
+ if (typeof window === "undefined") return;
2995
+ const win = window;
2996
+ win.skuilder = win.skuilder || {};
2997
+ Object.defineProperty(win.skuilder, "multiDimElo", {
2998
+ configurable: true,
2999
+ enumerable: true,
3000
+ get: () => multiDimElo,
3001
+ set: (on) => {
3002
+ multiDimElo = on === true;
3003
+ try {
3004
+ if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
3005
+ else localStorage.removeItem(MULTI_DIM_ELO_KEY);
3006
+ } catch (e) {
3007
+ logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
3008
+ }
3009
+ logger.info(
3010
+ `[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
3011
+ );
3012
+ }
3013
+ });
3014
+ }
2985
3015
  function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
2986
3016
  const globalGap = cardElo.global.score - userElo.global.score;
2987
3017
  const tags = [];
@@ -3009,7 +3039,7 @@ function tagReason(tags, globalGap) {
3009
3039
  async function applyEloDistance(cards, context, config, source) {
3010
3040
  const { course, userElo, userCourseElo } = context;
3011
3041
  const { halfLife, minMultiplier, maxMultiplier } = config;
3012
- const tagAware = config.tagAware && userCourseElo !== void 0;
3042
+ const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
3013
3043
  const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
3014
3044
  const fetched = /* @__PURE__ */ new Map();
3015
3045
  if (missing.length > 0) {
@@ -3023,10 +3053,10 @@ async function applyEloDistance(cards, context, config, source) {
3023
3053
  const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
3024
3054
  let distance = Math.abs(cardElo - userElo);
3025
3055
  let how = "";
3026
- if (tagAware && full) {
3027
- const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
3028
- distance = Math.abs(t.gap);
3029
- if (t.tags.length > 0) how = tagReason(t.tags, t.globalGap);
3056
+ if (tagAware) {
3057
+ const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
3058
+ if (t) distance = Math.abs(t.gap);
3059
+ how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
3030
3060
  }
3031
3061
  const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
3032
3062
  const newScore = card.score * multiplier;
@@ -3059,21 +3089,25 @@ function createEloDistanceFilter(config) {
3059
3089
  transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
3060
3090
  };
3061
3091
  }
3062
- var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
3092
+ var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
3063
3093
  var init_eloDistance = __esm({
3064
3094
  "src/core/navigators/filters/eloDistance.ts"() {
3065
3095
  "use strict";
3066
3096
  init_navigators();
3097
+ init_logger();
3067
3098
  DEFAULT_ELO_DISTANCE_CONFIG = {
3068
3099
  halfLife: 300,
3069
3100
  minMultiplier: 0.05,
3070
3101
  maxMultiplier: 1,
3071
- tagAware: true,
3102
+ tagAware: false,
3072
3103
  minTagCount: 3
3073
3104
  };
3074
3105
  TAG_CONFIDENCE_HALF = 10;
3075
3106
  COUNT_ONLY_SENTINEL = -1;
3076
3107
  DEFAULT_CARD_ELO = 1e3;
3108
+ MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
3109
+ multiDimElo = readMultiDimElo();
3110
+ mountMultiDimEloToggle();
3077
3111
  EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
3078
3112
  name;
3079
3113
  /** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */