@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.
@@ -3163,6 +3163,7 @@ __export(eloDistance_exports, {
3163
3163
  DEFAULT_ELO_DISTANCE_CONFIG: () => DEFAULT_ELO_DISTANCE_CONFIG,
3164
3164
  createEloDistanceFilter: () => createEloDistanceFilter,
3165
3165
  default: () => EloDistanceFilter,
3166
+ mountMultiDimEloToggle: () => mountMultiDimEloToggle,
3166
3167
  tagAwareGap: () => tagAwareGap
3167
3168
  });
3168
3169
  function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
@@ -3173,6 +3174,35 @@ function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
3173
3174
  function resolveConfig(config) {
3174
3175
  return { ...DEFAULT_ELO_DISTANCE_CONFIG, ...config };
3175
3176
  }
3177
+ function readMultiDimElo() {
3178
+ try {
3179
+ return typeof localStorage !== "undefined" && localStorage.getItem(MULTI_DIM_ELO_KEY) === "true";
3180
+ } catch {
3181
+ return false;
3182
+ }
3183
+ }
3184
+ function mountMultiDimEloToggle() {
3185
+ if (typeof window === "undefined") return;
3186
+ const win = window;
3187
+ win.skuilder = win.skuilder || {};
3188
+ Object.defineProperty(win.skuilder, "multiDimElo", {
3189
+ configurable: true,
3190
+ enumerable: true,
3191
+ get: () => multiDimElo,
3192
+ set: (on) => {
3193
+ multiDimElo = on === true;
3194
+ try {
3195
+ if (multiDimElo) localStorage.setItem(MULTI_DIM_ELO_KEY, "true");
3196
+ else localStorage.removeItem(MULTI_DIM_ELO_KEY);
3197
+ } catch (e) {
3198
+ logger.warn(`[EloDistance] multiDimElo not persisted (localStorage unavailable): ${e}`);
3199
+ }
3200
+ logger.info(
3201
+ `[EloDistance] multiDimElo ${multiDimElo ? "on: tag-aware" : "off: per strategy config"} ELO distance from the next replan`
3202
+ );
3203
+ }
3204
+ });
3205
+ }
3176
3206
  function tagAwareGap(cardTags, cardElo, userElo, minTagCount) {
3177
3207
  const globalGap = cardElo.global.score - userElo.global.score;
3178
3208
  const tags = [];
@@ -3200,7 +3230,7 @@ function tagReason(tags, globalGap) {
3200
3230
  async function applyEloDistance(cards, context, config, source) {
3201
3231
  const { course, userElo, userCourseElo } = context;
3202
3232
  const { halfLife, minMultiplier, maxMultiplier } = config;
3203
- const tagAware = config.tagAware && userCourseElo !== void 0;
3233
+ const tagAware = (config.tagAware || multiDimElo) && userCourseElo !== void 0;
3204
3234
  const missing = cards.filter((c) => tagAware || c.cardElo === void 0).map((c) => c.cardId);
3205
3235
  const fetched = /* @__PURE__ */ new Map();
3206
3236
  if (missing.length > 0) {
@@ -3214,10 +3244,10 @@ async function applyEloDistance(cards, context, config, source) {
3214
3244
  const cardElo = full?.global?.score ?? card.cardElo ?? DEFAULT_CARD_ELO;
3215
3245
  let distance = Math.abs(cardElo - userElo);
3216
3246
  let how = "";
3217
- if (tagAware && full) {
3218
- const t = tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount);
3219
- distance = Math.abs(t.gap);
3220
- if (t.tags.length > 0) how = tagReason(t.tags, t.globalGap);
3247
+ if (tagAware) {
3248
+ const t = full ? tagAwareGap(card.tags ?? [], full, userCourseElo, config.minTagCount) : void 0;
3249
+ if (t) distance = Math.abs(t.gap);
3250
+ how = t?.tags.length ? `, tag-aware${tagReason(t.tags, t.globalGap)}` : ", tag-aware: global (no shared tags)";
3221
3251
  }
3222
3252
  const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
3223
3253
  const newScore = card.score * multiplier;
@@ -3250,21 +3280,25 @@ function createEloDistanceFilter(config) {
3250
3280
  transform: (cards, context) => applyEloDistance(cards, context, resolved, source)
3251
3281
  };
3252
3282
  }
3253
- var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, EloDistanceFilter;
3283
+ var DEFAULT_ELO_DISTANCE_CONFIG, TAG_CONFIDENCE_HALF, COUNT_ONLY_SENTINEL, DEFAULT_CARD_ELO, MULTI_DIM_ELO_KEY, multiDimElo, EloDistanceFilter;
3254
3284
  var init_eloDistance = __esm({
3255
3285
  "src/core/navigators/filters/eloDistance.ts"() {
3256
3286
  "use strict";
3257
3287
  init_navigators();
3288
+ init_logger();
3258
3289
  DEFAULT_ELO_DISTANCE_CONFIG = {
3259
3290
  halfLife: 300,
3260
3291
  minMultiplier: 0.05,
3261
3292
  maxMultiplier: 1,
3262
- tagAware: true,
3293
+ tagAware: false,
3263
3294
  minTagCount: 3
3264
3295
  };
3265
3296
  TAG_CONFIDENCE_HALF = 10;
3266
3297
  COUNT_ONLY_SENTINEL = -1;
3267
3298
  DEFAULT_CARD_ELO = 1e3;
3299
+ MULTI_DIM_ELO_KEY = "skuilder:multiDimElo";
3300
+ multiDimElo = readMultiDimElo();
3301
+ mountMultiDimEloToggle();
3268
3302
  EloDistanceFilter = class _EloDistanceFilter extends ContentNavigator {
3269
3303
  name;
3270
3304
  /** See CardFilter.kind. Static, so the pipeline plan can read it without an instance. */