@vue-skuilder/db 0.1.31 → 0.1.32-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.
@@ -278,6 +278,8 @@ declare class CourseDB implements CourseDBInterface {
278
278
  * @param limit - Maximum number of cards to return
279
279
  * @returns Cards sorted by score descending
280
280
  */
281
+ private _pendingHints;
282
+ setEphemeralHints(hints: Record<string, unknown>): void;
281
283
  getWeightedCards(limit: number): Promise<WeightedCard[]>;
282
284
  getCardsCenteredAtELO(options?: {
283
285
  limit: number;
@@ -278,6 +278,8 @@ declare class CourseDB implements CourseDBInterface {
278
278
  * @param limit - Maximum number of cards to return
279
279
  * @returns Cards sorted by score descending
280
280
  */
281
+ private _pendingHints;
282
+ setEphemeralHints(hints: Record<string, unknown>): void;
281
283
  getWeightedCards(limit: number): Promise<WeightedCard[]>;
282
284
  getCardsCenteredAtELO(options?: {
283
285
  limit: number;
@@ -1707,6 +1707,7 @@ var init_hierarchyDefinition = __esm({
1707
1707
  "use strict";
1708
1708
  init_navigators();
1709
1709
  import_common6 = require("@vue-skuilder/common");
1710
+ init_logger();
1710
1711
  DEFAULT_MIN_COUNT = 3;
1711
1712
  HierarchyDefinitionNavigator = class extends ContentNavigator {
1712
1713
  config;
@@ -1874,6 +1875,9 @@ var init_hierarchyDefinition = __esm({
1874
1875
  finalScore *= maxBoost;
1875
1876
  action = "boosted";
1876
1877
  finalReason = `${reason} | preReqBoost \xD7${maxBoost.toFixed(2)} for ${boostedPrereqs.join(", ")}`;
1878
+ logger.info(
1879
+ `[HierarchyDefinition] preReqBoost \xD7${maxBoost.toFixed(2)} applied to card ${card.cardId} via tags [${boostedPrereqs.join(", ")}] (score: ${card.score.toFixed(3)} \u2192 ${finalScore.toFixed(3)})`
1880
+ );
1877
1881
  }
1878
1882
  }
1879
1883
  gated.push({
@@ -2383,7 +2387,7 @@ var init_relativePriority = __esm({
2383
2387
  const cardTags = card.tags ?? [];
2384
2388
  const priority = this.computeCardPriority(cardTags);
2385
2389
  const boostFactor = this.computeBoostFactor(priority);
2386
- const finalScore = Math.max(0, Math.min(1, card.score * boostFactor));
2390
+ const finalScore = Math.max(0, card.score * boostFactor);
2387
2391
  const action = boostFactor > 1 ? "boosted" : boostFactor < 1 ? "penalized" : "passed";
2388
2392
  const reason = this.buildPriorityReason(cardTags, priority, boostFactor, finalScore);
2389
2393
  return {
@@ -2902,7 +2906,7 @@ var init_Pipeline = __esm({
2902
2906
  card.provenance.push({
2903
2907
  strategy: "ephemeralHint",
2904
2908
  strategyId: "ephemeral-hint",
2905
- strategyName: "Replan Hint",
2909
+ strategyName: hints._label ? `Replan Hint (${hints._label})` : "Replan Hint",
2906
2910
  action: "boosted",
2907
2911
  score: card.score,
2908
2912
  reason: `boostTag ${pattern} \xD7${factor}`
@@ -2919,7 +2923,7 @@ var init_Pipeline = __esm({
2919
2923
  card.provenance.push({
2920
2924
  strategy: "ephemeralHint",
2921
2925
  strategyId: "ephemeral-hint",
2922
- strategyName: "Replan Hint",
2926
+ strategyName: hints._label ? `Replan Hint (${hints._label})` : "Replan Hint",
2923
2927
  action: "boosted",
2924
2928
  score: card.score,
2925
2929
  reason: `boostCard ${pattern} \xD7${factor}`
@@ -2929,6 +2933,7 @@ var init_Pipeline = __esm({
2929
2933
  }
2930
2934
  }
2931
2935
  const cardIds = new Set(cards.map((c) => c.cardId));
2936
+ const hintLabel = hints._label ? `Replan Hint (${hints._label})` : "Replan Hint";
2932
2937
  const inject = (card, reason) => {
2933
2938
  if (!cardIds.has(card.cardId)) {
2934
2939
  const floorScore = Math.max(card.score, 1);
@@ -2940,7 +2945,7 @@ var init_Pipeline = __esm({
2940
2945
  {
2941
2946
  strategy: "ephemeralHint",
2942
2947
  strategyId: "ephemeral-hint",
2943
- strategyName: "Replan Hint",
2948
+ strategyName: hintLabel,
2944
2949
  action: "boosted",
2945
2950
  score: floorScore,
2946
2951
  reason
@@ -4231,10 +4236,18 @@ ${above.rows.map((r) => ` ${r.id}-${r.key}
4231
4236
  * @param limit - Maximum number of cards to return
4232
4237
  * @returns Cards sorted by score descending
4233
4238
  */
4239
+ _pendingHints = null;
4240
+ setEphemeralHints(hints) {
4241
+ this._pendingHints = hints;
4242
+ }
4234
4243
  async getWeightedCards(limit) {
4235
4244
  const u = await this._getCurrentUser();
4236
4245
  try {
4237
4246
  const navigator = await this.createNavigator(u);
4247
+ if (this._pendingHints) {
4248
+ navigator.setEphemeralHints(this._pendingHints);
4249
+ this._pendingHints = null;
4250
+ }
4238
4251
  return navigator.getWeightedCards(limit);
4239
4252
  } catch (e) {
4240
4253
  logger.error(`[courseDB] Error getting weighted cards: ${e}`);