@vue-skuilder/db 0.1.22 → 0.1.24
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.
- package/dist/{contentSource-BP9hznNV.d.ts → contentSource-BotbOOfX.d.ts} +227 -3
- package/dist/{contentSource-DsJadoBU.d.cts → contentSource-C90LH-OH.d.cts} +227 -3
- package/dist/core/index.d.cts +220 -6
- package/dist/core/index.d.ts +220 -6
- package/dist/core/index.js +2052 -559
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +2035 -555
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-CHYrQ5pB.d.cts → dataLayerProvider-DGKp4zFB.d.cts} +1 -1
- package/dist/{dataLayerProvider-MDTxXq2l.d.ts → dataLayerProvider-SBpz9jQf.d.ts} +1 -1
- package/dist/impl/couch/index.d.cts +11 -3
- package/dist/impl/couch/index.d.ts +11 -3
- package/dist/impl/couch/index.js +1811 -574
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +1792 -550
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +4 -4
- package/dist/impl/static/index.d.ts +4 -4
- package/dist/impl/static/index.js +1797 -560
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +1789 -547
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-Dj0SEgk3.d.ts → index-BWvO-_rJ.d.ts} +1 -1
- package/dist/{index-B_j6u5E4.d.cts → index-Ba7hYbHj.d.cts} +1 -1
- package/dist/index.d.cts +150 -12
- package/dist/index.d.ts +150 -12
- package/dist/index.js +2658 -791
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2584 -747
- package/dist/index.mjs.map +1 -1
- package/dist/{types-DQaXnuoc.d.ts → types-CJrLM1Ew.d.ts} +1 -1
- package/dist/{types-Bn0itutr.d.cts → types-W8n-B6HG.d.cts} +1 -1
- package/dist/{types-legacy-DDY4N-Uq.d.cts → types-legacy-JXDxinpU.d.cts} +5 -1
- package/dist/{types-legacy-DDY4N-Uq.d.ts → types-legacy-JXDxinpU.d.ts} +5 -1
- package/dist/util/packer/index.d.cts +3 -3
- package/dist/util/packer/index.d.ts +3 -3
- package/docs/brainstorm-navigation-paradigm.md +40 -34
- package/docs/future-orchestration-vision.md +216 -0
- package/docs/navigators-architecture.md +188 -5
- package/docs/todo-strategy-authoring.md +8 -6
- package/package.json +3 -3
- package/src/core/index.ts +2 -0
- package/src/core/interfaces/contentSource.ts +7 -0
- package/src/core/interfaces/userDB.ts +6 -0
- package/src/core/navigators/Pipeline.ts +46 -0
- package/src/core/navigators/PipelineAssembler.ts +14 -1
- package/src/core/navigators/filters/WeightedFilter.ts +141 -0
- package/src/core/navigators/filters/types.ts +4 -0
- package/src/core/navigators/generators/CompositeGenerator.ts +61 -19
- package/src/core/navigators/generators/types.ts +4 -0
- package/src/core/navigators/index.ts +194 -13
- package/src/core/orchestration/gradient.ts +133 -0
- package/src/core/orchestration/index.ts +210 -0
- package/src/core/orchestration/learning.ts +250 -0
- package/src/core/orchestration/recording.ts +92 -0
- package/src/core/orchestration/signal.ts +67 -0
- package/src/core/types/contentNavigationStrategy.ts +38 -0
- package/src/core/types/learningState.ts +77 -0
- package/src/core/types/types-legacy.ts +4 -0
- package/src/core/types/userOutcome.ts +51 -0
- package/src/courseConfigRegistration.ts +546 -0
- package/src/factory.ts +6 -0
- package/src/impl/common/BaseUserDB.ts +16 -0
- package/src/index.ts +2 -0
- package/src/study/SessionController.ts +64 -1
- package/tests/core/navigators/Pipeline.test.ts +2 -0
- package/docs/todo-evolutionary-orchestration.md +0 -310
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
1
2
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
3
|
+
var __glob = (map) => (path2) => {
|
|
4
|
+
var fn = map[path2];
|
|
5
|
+
if (fn) return fn();
|
|
6
|
+
throw new Error("Module not found in bundle: " + path2);
|
|
7
|
+
};
|
|
2
8
|
var __esm = (fn, res) => function __init() {
|
|
3
9
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
4
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
5
15
|
|
|
6
16
|
// src/util/logger.ts
|
|
7
17
|
var isDevelopment, logger;
|
|
@@ -88,7 +98,9 @@ var init_types_legacy = __esm({
|
|
|
88
98
|
["VIEW" /* VIEW */]: "VIEW",
|
|
89
99
|
["PEDAGOGY" /* PEDAGOGY */]: "PEDAGOGY",
|
|
90
100
|
["NAVIGATION_STRATEGY" /* NAVIGATION_STRATEGY */]: "NAVIGATION_STRATEGY",
|
|
91
|
-
["STRATEGY_STATE" /* STRATEGY_STATE */]: "STRATEGY_STATE"
|
|
101
|
+
["STRATEGY_STATE" /* STRATEGY_STATE */]: "STRATEGY_STATE",
|
|
102
|
+
["USER_OUTCOME" /* USER_OUTCOME */]: "USER_OUTCOME",
|
|
103
|
+
["STRATEGY_LEARNING_STATE" /* STRATEGY_LEARNING_STATE */]: "STRATEGY_LEARNING_STATE"
|
|
92
104
|
};
|
|
93
105
|
}
|
|
94
106
|
});
|
|
@@ -461,173 +473,1382 @@ var init_courseLookupDB = __esm({
|
|
|
461
473
|
}
|
|
462
474
|
});
|
|
463
475
|
|
|
464
|
-
// src/core/navigators/
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
var
|
|
472
|
-
|
|
473
|
-
"src/core/navigators/index.ts"() {
|
|
476
|
+
// src/core/navigators/generators/CompositeGenerator.ts
|
|
477
|
+
var CompositeGenerator_exports = {};
|
|
478
|
+
__export(CompositeGenerator_exports, {
|
|
479
|
+
AggregationMode: () => AggregationMode,
|
|
480
|
+
default: () => CompositeGenerator
|
|
481
|
+
});
|
|
482
|
+
var AggregationMode, DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator;
|
|
483
|
+
var init_CompositeGenerator = __esm({
|
|
484
|
+
"src/core/navigators/generators/CompositeGenerator.ts"() {
|
|
474
485
|
"use strict";
|
|
486
|
+
init_navigators();
|
|
475
487
|
init_logger();
|
|
476
|
-
|
|
477
|
-
["
|
|
478
|
-
["
|
|
479
|
-
["
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
* Call this from subclass constructors to initialize common fields.
|
|
496
|
-
*
|
|
497
|
-
* Note: CompositeGenerator and Pipeline call super() without args, then set
|
|
498
|
-
* user/course fields directly if needed.
|
|
499
|
-
*/
|
|
500
|
-
constructor(user, course, strategyData) {
|
|
501
|
-
this.user = user;
|
|
502
|
-
this.course = course;
|
|
503
|
-
if (strategyData) {
|
|
504
|
-
this.strategyName = strategyData.name;
|
|
505
|
-
this.strategyId = strategyData._id;
|
|
488
|
+
AggregationMode = /* @__PURE__ */ ((AggregationMode2) => {
|
|
489
|
+
AggregationMode2["MAX"] = "max";
|
|
490
|
+
AggregationMode2["AVERAGE"] = "average";
|
|
491
|
+
AggregationMode2["FREQUENCY_BOOST"] = "frequencyBoost";
|
|
492
|
+
return AggregationMode2;
|
|
493
|
+
})(AggregationMode || {});
|
|
494
|
+
DEFAULT_AGGREGATION_MODE = "frequencyBoost" /* FREQUENCY_BOOST */;
|
|
495
|
+
FREQUENCY_BOOST_FACTOR = 0.1;
|
|
496
|
+
CompositeGenerator = class _CompositeGenerator extends ContentNavigator {
|
|
497
|
+
/** Human-readable name for CardGenerator interface */
|
|
498
|
+
name = "Composite Generator";
|
|
499
|
+
generators;
|
|
500
|
+
aggregationMode;
|
|
501
|
+
constructor(generators, aggregationMode = DEFAULT_AGGREGATION_MODE) {
|
|
502
|
+
super();
|
|
503
|
+
this.generators = generators;
|
|
504
|
+
this.aggregationMode = aggregationMode;
|
|
505
|
+
if (generators.length === 0) {
|
|
506
|
+
throw new Error("CompositeGenerator requires at least one generator");
|
|
506
507
|
}
|
|
508
|
+
logger.debug(
|
|
509
|
+
`[CompositeGenerator] Created with ${generators.length} generators, mode: ${aggregationMode}`
|
|
510
|
+
);
|
|
507
511
|
}
|
|
508
|
-
// ============================================================================
|
|
509
|
-
// STRATEGY STATE HELPERS
|
|
510
|
-
// ============================================================================
|
|
511
|
-
//
|
|
512
|
-
// These methods allow strategies to persist their own state (user preferences,
|
|
513
|
-
// learned patterns, temporal tracking) in the user database.
|
|
514
|
-
//
|
|
515
|
-
// ============================================================================
|
|
516
512
|
/**
|
|
517
|
-
*
|
|
513
|
+
* Creates a CompositeGenerator from strategy data.
|
|
518
514
|
*
|
|
519
|
-
*
|
|
520
|
-
* Override in subclasses if multiple instances of the same strategy type
|
|
521
|
-
* need separate state storage.
|
|
515
|
+
* This is a convenience factory for use by PipelineAssembler.
|
|
522
516
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
517
|
+
static async fromStrategies(user, course, strategies, aggregationMode = DEFAULT_AGGREGATION_MODE) {
|
|
518
|
+
const generators = await Promise.all(
|
|
519
|
+
strategies.map((s) => ContentNavigator.create(user, course, s))
|
|
520
|
+
);
|
|
521
|
+
return new _CompositeGenerator(generators, aggregationMode);
|
|
525
522
|
}
|
|
526
523
|
/**
|
|
527
|
-
* Get
|
|
524
|
+
* Get weighted cards from all generators, merge and deduplicate.
|
|
528
525
|
*
|
|
529
|
-
*
|
|
530
|
-
*
|
|
526
|
+
* Cards appearing in multiple generators receive a score boost.
|
|
527
|
+
* Provenance tracks which generators produced each card and how scores were aggregated.
|
|
528
|
+
*
|
|
529
|
+
* This method supports both the legacy signature (limit only) and the
|
|
530
|
+
* CardGenerator interface signature (limit, context).
|
|
531
|
+
*
|
|
532
|
+
* @param limit - Maximum number of cards to return
|
|
533
|
+
* @param context - GeneratorContext passed to child generators (required when called via Pipeline)
|
|
531
534
|
*/
|
|
532
|
-
async
|
|
533
|
-
if (!
|
|
535
|
+
async getWeightedCards(limit, context) {
|
|
536
|
+
if (!context) {
|
|
534
537
|
throw new Error(
|
|
535
|
-
|
|
538
|
+
"CompositeGenerator.getWeightedCards requires a GeneratorContext. It should be called via Pipeline, not directly."
|
|
536
539
|
);
|
|
537
540
|
}
|
|
538
|
-
|
|
541
|
+
const results = await Promise.all(
|
|
542
|
+
this.generators.map((g) => g.getWeightedCards(limit, context))
|
|
543
|
+
);
|
|
544
|
+
const byCardId = /* @__PURE__ */ new Map();
|
|
545
|
+
results.forEach((cards, index) => {
|
|
546
|
+
const gen = this.generators[index];
|
|
547
|
+
let weight = gen.learnable?.weight ?? 1;
|
|
548
|
+
let deviation;
|
|
549
|
+
if (gen.learnable && !gen.staticWeight && context.orchestration) {
|
|
550
|
+
const strategyId = gen.strategyId;
|
|
551
|
+
if (strategyId) {
|
|
552
|
+
weight = context.orchestration.getEffectiveWeight(strategyId, gen.learnable);
|
|
553
|
+
deviation = context.orchestration.getDeviation(strategyId);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
for (const card of cards) {
|
|
557
|
+
if (card.provenance.length > 0) {
|
|
558
|
+
card.provenance[0].effectiveWeight = weight;
|
|
559
|
+
card.provenance[0].deviation = deviation;
|
|
560
|
+
}
|
|
561
|
+
const existing = byCardId.get(card.cardId) || [];
|
|
562
|
+
existing.push({ card, weight });
|
|
563
|
+
byCardId.set(card.cardId, existing);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
const merged = [];
|
|
567
|
+
for (const [, items] of byCardId) {
|
|
568
|
+
const cards = items.map((i) => i.card);
|
|
569
|
+
const aggregatedScore = this.aggregateScores(items);
|
|
570
|
+
const finalScore = Math.min(1, aggregatedScore);
|
|
571
|
+
const mergedProvenance = cards.flatMap((c) => c.provenance);
|
|
572
|
+
const initialScore = cards[0].score;
|
|
573
|
+
const action = finalScore > initialScore ? "boosted" : finalScore < initialScore ? "penalized" : "passed";
|
|
574
|
+
const reason = this.buildAggregationReason(items, finalScore);
|
|
575
|
+
merged.push({
|
|
576
|
+
...cards[0],
|
|
577
|
+
score: finalScore,
|
|
578
|
+
provenance: [
|
|
579
|
+
...mergedProvenance,
|
|
580
|
+
{
|
|
581
|
+
strategy: "composite",
|
|
582
|
+
strategyName: "Composite Generator",
|
|
583
|
+
strategyId: "COMPOSITE_GENERATOR",
|
|
584
|
+
action,
|
|
585
|
+
score: finalScore,
|
|
586
|
+
reason
|
|
587
|
+
}
|
|
588
|
+
]
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
return merged.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
539
592
|
}
|
|
540
593
|
/**
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
* @param data - The strategy's data payload to store
|
|
544
|
-
* @throws Error if user or course is not initialized
|
|
594
|
+
* Build human-readable reason for score aggregation.
|
|
545
595
|
*/
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
596
|
+
buildAggregationReason(items, finalScore) {
|
|
597
|
+
const cards = items.map((i) => i.card);
|
|
598
|
+
const count = cards.length;
|
|
599
|
+
const scores = cards.map((c) => c.score.toFixed(2)).join(", ");
|
|
600
|
+
if (count === 1) {
|
|
601
|
+
const weightMsg = Math.abs(items[0].weight - 1) > 1e-3 ? ` (w=${items[0].weight.toFixed(2)})` : "";
|
|
602
|
+
return `Single generator, score ${finalScore.toFixed(2)}${weightMsg}`;
|
|
603
|
+
}
|
|
604
|
+
const strategies = cards.map((c) => c.provenance[0]?.strategy || "unknown").join(", ");
|
|
605
|
+
switch (this.aggregationMode) {
|
|
606
|
+
case "max" /* MAX */:
|
|
607
|
+
return `Max of ${count} generators (${strategies}): scores [${scores}] \u2192 ${finalScore.toFixed(2)}`;
|
|
608
|
+
case "average" /* AVERAGE */:
|
|
609
|
+
return `Weighted Avg of ${count} generators (${strategies}): scores [${scores}] \u2192 ${finalScore.toFixed(2)}`;
|
|
610
|
+
case "frequencyBoost" /* FREQUENCY_BOOST */: {
|
|
611
|
+
const totalWeight = items.reduce((sum, i) => sum + i.weight, 0);
|
|
612
|
+
const weightedSum = items.reduce((sum, i) => sum + i.card.score * i.weight, 0);
|
|
613
|
+
const avg = totalWeight > 0 ? weightedSum / totalWeight : 0;
|
|
614
|
+
const boost = 1 + FREQUENCY_BOOST_FACTOR * (count - 1);
|
|
615
|
+
return `Frequency boost from ${count} generators (${strategies}): w-avg ${avg.toFixed(2)} \xD7 ${boost.toFixed(2)} \u2192 ${finalScore.toFixed(2)}`;
|
|
616
|
+
}
|
|
617
|
+
default:
|
|
618
|
+
return `Aggregated from ${count} generators: ${finalScore.toFixed(2)}`;
|
|
551
619
|
}
|
|
552
|
-
return this.user.putStrategyState(this.course.getCourseID(), this.strategyKey, data);
|
|
553
620
|
}
|
|
554
621
|
/**
|
|
555
|
-
*
|
|
556
|
-
*
|
|
557
|
-
* @param user - User interface
|
|
558
|
-
* @param course - Course interface
|
|
559
|
-
* @param strategyData - Strategy configuration document
|
|
560
|
-
* @returns the runtime object used to steer a study session.
|
|
622
|
+
* Aggregate scores from multiple generators for the same card.
|
|
561
623
|
*/
|
|
562
|
-
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
NavigatorImpl = module.default;
|
|
573
|
-
break;
|
|
574
|
-
} catch (e) {
|
|
575
|
-
logger.debug(`Failed to load extension from ${loadFrom}:`, e);
|
|
576
|
-
}
|
|
624
|
+
aggregateScores(items) {
|
|
625
|
+
const scores = items.map((i) => i.card.score);
|
|
626
|
+
switch (this.aggregationMode) {
|
|
627
|
+
case "max" /* MAX */:
|
|
628
|
+
return Math.max(...scores);
|
|
629
|
+
case "average" /* AVERAGE */: {
|
|
630
|
+
const totalWeight = items.reduce((sum, i) => sum + i.weight, 0);
|
|
631
|
+
if (totalWeight === 0) return 0;
|
|
632
|
+
const weightedSum = items.reduce((sum, i) => sum + i.card.score * i.weight, 0);
|
|
633
|
+
return weightedSum / totalWeight;
|
|
577
634
|
}
|
|
635
|
+
case "frequencyBoost" /* FREQUENCY_BOOST */: {
|
|
636
|
+
const totalWeight = items.reduce((sum, i) => sum + i.weight, 0);
|
|
637
|
+
const weightedSum = items.reduce((sum, i) => sum + i.card.score * i.weight, 0);
|
|
638
|
+
const avg = totalWeight > 0 ? weightedSum / totalWeight : 0;
|
|
639
|
+
const frequencyBoost = 1 + FREQUENCY_BOOST_FACTOR * (items.length - 1);
|
|
640
|
+
return avg * frequencyBoost;
|
|
641
|
+
}
|
|
642
|
+
default:
|
|
643
|
+
return scores[0];
|
|
578
644
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
645
|
+
}
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
// src/core/navigators/generators/elo.ts
|
|
651
|
+
var elo_exports = {};
|
|
652
|
+
__export(elo_exports, {
|
|
653
|
+
default: () => ELONavigator
|
|
654
|
+
});
|
|
655
|
+
import { toCourseElo as toCourseElo2 } from "@vue-skuilder/common";
|
|
656
|
+
var ELONavigator;
|
|
657
|
+
var init_elo = __esm({
|
|
658
|
+
"src/core/navigators/generators/elo.ts"() {
|
|
659
|
+
"use strict";
|
|
660
|
+
init_navigators();
|
|
661
|
+
ELONavigator = class extends ContentNavigator {
|
|
662
|
+
/** Human-readable name for CardGenerator interface */
|
|
663
|
+
name;
|
|
664
|
+
constructor(user, course, strategyData) {
|
|
665
|
+
super(user, course, strategyData);
|
|
666
|
+
this.name = strategyData?.name || "ELO";
|
|
583
667
|
}
|
|
584
668
|
/**
|
|
585
|
-
* Get cards with suitability scores
|
|
586
|
-
*
|
|
587
|
-
* **This is the PRIMARY API for navigation strategies.**
|
|
588
|
-
*
|
|
589
|
-
* Returns cards ranked by suitability score (0-1). Higher scores indicate
|
|
590
|
-
* better candidates for presentation. Each card includes a provenance trail
|
|
591
|
-
* documenting how strategies contributed to the final score.
|
|
669
|
+
* Get new cards with suitability scores based on ELO distance.
|
|
592
670
|
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* not provide a default implementation.
|
|
671
|
+
* Cards closer to user's ELO get higher scores.
|
|
672
|
+
* Score formula: max(0, 1 - distance / 500)
|
|
596
673
|
*
|
|
597
|
-
*
|
|
598
|
-
*
|
|
599
|
-
* your strategy's logic (e.g., ELO proximity, review urgency). Create the
|
|
600
|
-
* initial provenance entry with action='generated'.
|
|
674
|
+
* NOTE: This generator only handles NEW cards. Reviews are handled by
|
|
675
|
+
* SRSNavigator. Use CompositeGenerator to combine both.
|
|
601
676
|
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* via Pipeline. Filters do not directly implement getWeightedCards().
|
|
677
|
+
* This method supports both the legacy signature (limit only) and the
|
|
678
|
+
* CardGenerator interface signature (limit, context).
|
|
605
679
|
*
|
|
606
|
-
* @param limit - Maximum cards to return
|
|
607
|
-
* @
|
|
680
|
+
* @param limit - Maximum number of cards to return
|
|
681
|
+
* @param context - Optional GeneratorContext (used when called via Pipeline)
|
|
608
682
|
*/
|
|
609
|
-
async getWeightedCards(
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
683
|
+
async getWeightedCards(limit, context) {
|
|
684
|
+
let userGlobalElo;
|
|
685
|
+
if (context?.userElo !== void 0) {
|
|
686
|
+
userGlobalElo = context.userElo;
|
|
687
|
+
} else {
|
|
688
|
+
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
689
|
+
const userElo = toCourseElo2(courseReg.elo);
|
|
690
|
+
userGlobalElo = userElo.global.score;
|
|
691
|
+
}
|
|
692
|
+
const activeCards = await this.user.getActiveCards();
|
|
693
|
+
const newCards = (await this.course.getCardsCenteredAtELO(
|
|
694
|
+
{ limit, elo: "user" },
|
|
695
|
+
(c) => !activeCards.some((ac) => c.cardID === ac.cardID)
|
|
696
|
+
)).map((c) => ({ ...c, status: "new" }));
|
|
697
|
+
const cardIds = newCards.map((c) => c.cardID);
|
|
698
|
+
const cardEloData = await this.course.getCardEloData(cardIds);
|
|
699
|
+
const scored = newCards.map((c, i) => {
|
|
700
|
+
const cardElo = cardEloData[i]?.global?.score ?? 1e3;
|
|
701
|
+
const distance = Math.abs(cardElo - userGlobalElo);
|
|
702
|
+
const score = Math.max(0, 1 - distance / 500);
|
|
703
|
+
return {
|
|
704
|
+
cardId: c.cardID,
|
|
705
|
+
courseId: c.courseID,
|
|
706
|
+
score,
|
|
707
|
+
provenance: [
|
|
708
|
+
{
|
|
709
|
+
strategy: "elo",
|
|
710
|
+
strategyName: this.strategyName || this.name,
|
|
711
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
|
|
712
|
+
action: "generated",
|
|
713
|
+
score,
|
|
714
|
+
reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
|
|
715
|
+
}
|
|
716
|
+
]
|
|
717
|
+
};
|
|
718
|
+
});
|
|
719
|
+
scored.sort((a, b) => b.score - a.score);
|
|
720
|
+
return scored.slice(0, limit);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
// src/core/navigators/generators/index.ts
|
|
727
|
+
var generators_exports = {};
|
|
728
|
+
var init_generators = __esm({
|
|
729
|
+
"src/core/navigators/generators/index.ts"() {
|
|
730
|
+
"use strict";
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// src/core/navigators/generators/srs.ts
|
|
735
|
+
var srs_exports = {};
|
|
736
|
+
__export(srs_exports, {
|
|
737
|
+
default: () => SRSNavigator
|
|
738
|
+
});
|
|
739
|
+
import moment3 from "moment";
|
|
740
|
+
var SRSNavigator;
|
|
741
|
+
var init_srs = __esm({
|
|
742
|
+
"src/core/navigators/generators/srs.ts"() {
|
|
743
|
+
"use strict";
|
|
744
|
+
init_navigators();
|
|
745
|
+
init_logger();
|
|
746
|
+
SRSNavigator = class extends ContentNavigator {
|
|
747
|
+
/** Human-readable name for CardGenerator interface */
|
|
748
|
+
name;
|
|
749
|
+
constructor(user, course, strategyData) {
|
|
750
|
+
super(user, course, strategyData);
|
|
751
|
+
this.name = strategyData?.name || "SRS";
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Get review cards scored by urgency.
|
|
755
|
+
*
|
|
756
|
+
* Score formula combines:
|
|
757
|
+
* - Relative overdueness: hoursOverdue / intervalHours
|
|
758
|
+
* - Interval recency: exponential decay favoring shorter intervals
|
|
759
|
+
*
|
|
760
|
+
* Cards not yet due are excluded (not scored as 0).
|
|
761
|
+
*
|
|
762
|
+
* This method supports both the legacy signature (limit only) and the
|
|
763
|
+
* CardGenerator interface signature (limit, context).
|
|
764
|
+
*
|
|
765
|
+
* @param limit - Maximum number of cards to return
|
|
766
|
+
* @param _context - Optional GeneratorContext (currently unused, but required for interface)
|
|
767
|
+
*/
|
|
768
|
+
async getWeightedCards(limit, _context) {
|
|
769
|
+
if (!this.user || !this.course) {
|
|
770
|
+
throw new Error("SRSNavigator requires user and course to be set");
|
|
771
|
+
}
|
|
772
|
+
const reviews = await this.user.getPendingReviews(this.course.getCourseID());
|
|
773
|
+
const now = moment3.utc();
|
|
774
|
+
const dueReviews = reviews.filter((r) => now.isAfter(moment3.utc(r.reviewTime)));
|
|
775
|
+
const scored = dueReviews.map((review) => {
|
|
776
|
+
const { score, reason } = this.computeUrgencyScore(review, now);
|
|
777
|
+
return {
|
|
778
|
+
cardId: review.cardId,
|
|
779
|
+
courseId: review.courseId,
|
|
780
|
+
score,
|
|
781
|
+
reviewID: review._id,
|
|
782
|
+
provenance: [
|
|
783
|
+
{
|
|
784
|
+
strategy: "srs",
|
|
785
|
+
strategyName: this.strategyName || this.name,
|
|
786
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-SRS-default",
|
|
787
|
+
action: "generated",
|
|
788
|
+
score,
|
|
789
|
+
reason
|
|
790
|
+
}
|
|
791
|
+
]
|
|
792
|
+
};
|
|
793
|
+
});
|
|
794
|
+
logger.debug(`[srsNav] got ${scored.length} weighted cards`);
|
|
795
|
+
return scored.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Compute urgency score for a review card.
|
|
799
|
+
*
|
|
800
|
+
* Two factors:
|
|
801
|
+
* 1. Relative overdueness = hoursOverdue / intervalHours
|
|
802
|
+
* - 2 days overdue on 3-day interval = 0.67 (urgent)
|
|
803
|
+
* - 2 days overdue on 180-day interval = 0.01 (not urgent)
|
|
804
|
+
*
|
|
805
|
+
* 2. Interval recency factor = 0.3 + 0.7 * exp(-intervalHours / 720)
|
|
806
|
+
* - 24h interval → ~1.0 (very recent learning)
|
|
807
|
+
* - 30 days (720h) → ~0.56
|
|
808
|
+
* - 180 days → ~0.30
|
|
809
|
+
*
|
|
810
|
+
* Combined: base 0.5 + weighted average of factors * 0.45
|
|
811
|
+
* Result range: approximately 0.5 to 0.95
|
|
812
|
+
*/
|
|
813
|
+
computeUrgencyScore(review, now) {
|
|
814
|
+
const scheduledAt = moment3.utc(review.scheduledAt);
|
|
815
|
+
const due = moment3.utc(review.reviewTime);
|
|
816
|
+
const intervalHours = Math.max(1, due.diff(scheduledAt, "hours"));
|
|
817
|
+
const hoursOverdue = now.diff(due, "hours");
|
|
818
|
+
const relativeOverdue = hoursOverdue / intervalHours;
|
|
819
|
+
const recencyFactor = 0.3 + 0.7 * Math.exp(-intervalHours / 720);
|
|
820
|
+
const overdueContribution = Math.min(1, Math.max(0, relativeOverdue));
|
|
821
|
+
const urgency = overdueContribution * 0.5 + recencyFactor * 0.5;
|
|
822
|
+
const score = Math.min(0.95, 0.5 + urgency * 0.45);
|
|
823
|
+
const reason = `${Math.round(hoursOverdue)}h overdue (interval: ${Math.round(intervalHours)}h, relative: ${relativeOverdue.toFixed(2)}), recency: ${recencyFactor.toFixed(2)}, review`;
|
|
824
|
+
return { score, reason };
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// src/core/navigators/generators/types.ts
|
|
831
|
+
var types_exports = {};
|
|
832
|
+
var init_types = __esm({
|
|
833
|
+
"src/core/navigators/generators/types.ts"() {
|
|
834
|
+
"use strict";
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
|
|
838
|
+
// import("./generators/**/*") in src/core/navigators/index.ts
|
|
839
|
+
var globImport_generators;
|
|
840
|
+
var init_ = __esm({
|
|
841
|
+
'import("./generators/**/*") in src/core/navigators/index.ts'() {
|
|
842
|
+
globImport_generators = __glob({
|
|
843
|
+
"./generators/CompositeGenerator.ts": () => Promise.resolve().then(() => (init_CompositeGenerator(), CompositeGenerator_exports)),
|
|
844
|
+
"./generators/elo.ts": () => Promise.resolve().then(() => (init_elo(), elo_exports)),
|
|
845
|
+
"./generators/index.ts": () => Promise.resolve().then(() => (init_generators(), generators_exports)),
|
|
846
|
+
"./generators/srs.ts": () => Promise.resolve().then(() => (init_srs(), srs_exports)),
|
|
847
|
+
"./generators/types.ts": () => Promise.resolve().then(() => (init_types(), types_exports))
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
// src/core/types/contentNavigationStrategy.ts
|
|
853
|
+
var DEFAULT_LEARNABLE_WEIGHT;
|
|
854
|
+
var init_contentNavigationStrategy = __esm({
|
|
855
|
+
"src/core/types/contentNavigationStrategy.ts"() {
|
|
856
|
+
"use strict";
|
|
857
|
+
DEFAULT_LEARNABLE_WEIGHT = {
|
|
858
|
+
weight: 1,
|
|
859
|
+
confidence: 0.1,
|
|
860
|
+
// Low confidence initially = wide exploration
|
|
861
|
+
sampleSize: 0
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
|
|
866
|
+
// src/core/navigators/filters/WeightedFilter.ts
|
|
867
|
+
var WeightedFilter_exports = {};
|
|
868
|
+
__export(WeightedFilter_exports, {
|
|
869
|
+
WeightedFilter: () => WeightedFilter
|
|
870
|
+
});
|
|
871
|
+
var WeightedFilter;
|
|
872
|
+
var init_WeightedFilter = __esm({
|
|
873
|
+
"src/core/navigators/filters/WeightedFilter.ts"() {
|
|
874
|
+
"use strict";
|
|
875
|
+
init_contentNavigationStrategy();
|
|
876
|
+
WeightedFilter = class {
|
|
877
|
+
name;
|
|
878
|
+
inner;
|
|
879
|
+
learnable;
|
|
880
|
+
staticWeight;
|
|
881
|
+
strategyId;
|
|
882
|
+
constructor(inner, learnable = DEFAULT_LEARNABLE_WEIGHT, staticWeight = false, strategyId) {
|
|
883
|
+
this.inner = inner;
|
|
884
|
+
this.name = inner.name;
|
|
885
|
+
this.learnable = learnable;
|
|
886
|
+
this.staticWeight = staticWeight;
|
|
887
|
+
this.strategyId = strategyId;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Apply the inner filter, then scale its effect by the configured weight.
|
|
891
|
+
*/
|
|
892
|
+
async transform(cards, context) {
|
|
893
|
+
let effectiveWeight = this.learnable.weight;
|
|
894
|
+
let deviation;
|
|
895
|
+
if (!this.staticWeight && context.orchestration) {
|
|
896
|
+
const strategyId = this.strategyId || this.inner.strategyId || this.name;
|
|
897
|
+
effectiveWeight = context.orchestration.getEffectiveWeight(strategyId, this.learnable);
|
|
898
|
+
deviation = context.orchestration.getDeviation(strategyId);
|
|
899
|
+
}
|
|
900
|
+
if (Math.abs(effectiveWeight - 1) < 1e-3) {
|
|
901
|
+
return this.inner.transform(cards, context);
|
|
902
|
+
}
|
|
903
|
+
const originalScores = /* @__PURE__ */ new Map();
|
|
904
|
+
for (const card of cards) {
|
|
905
|
+
originalScores.set(card.cardId, card.score);
|
|
906
|
+
}
|
|
907
|
+
const transformedCards = await this.inner.transform(cards, context);
|
|
908
|
+
return transformedCards.map((card) => {
|
|
909
|
+
const originalScore = originalScores.get(card.cardId);
|
|
910
|
+
if (originalScore === void 0 || originalScore === 0 || card.score === 0) {
|
|
911
|
+
return card;
|
|
912
|
+
}
|
|
913
|
+
const rawEffect = card.score / originalScore;
|
|
914
|
+
if (Math.abs(rawEffect - 1) < 1e-4) {
|
|
915
|
+
return card;
|
|
916
|
+
}
|
|
917
|
+
const weightedEffect = Math.pow(rawEffect, effectiveWeight);
|
|
918
|
+
const newScore = originalScore * weightedEffect;
|
|
919
|
+
const lastProvIndex = card.provenance.length - 1;
|
|
920
|
+
const lastProv = card.provenance[lastProvIndex];
|
|
921
|
+
if (lastProv) {
|
|
922
|
+
const updatedProvenance = [...card.provenance];
|
|
923
|
+
updatedProvenance[lastProvIndex] = {
|
|
924
|
+
...lastProv,
|
|
925
|
+
score: newScore,
|
|
926
|
+
effectiveWeight,
|
|
927
|
+
deviation
|
|
928
|
+
// We can optionally append to the reason, but the structured field is key
|
|
929
|
+
};
|
|
930
|
+
return {
|
|
931
|
+
...card,
|
|
932
|
+
score: newScore,
|
|
933
|
+
provenance: updatedProvenance
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
return {
|
|
937
|
+
...card,
|
|
938
|
+
score: newScore
|
|
939
|
+
};
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
|
|
946
|
+
// src/core/navigators/filters/eloDistance.ts
|
|
947
|
+
var eloDistance_exports = {};
|
|
948
|
+
__export(eloDistance_exports, {
|
|
949
|
+
DEFAULT_HALF_LIFE: () => DEFAULT_HALF_LIFE,
|
|
950
|
+
DEFAULT_MAX_MULTIPLIER: () => DEFAULT_MAX_MULTIPLIER,
|
|
951
|
+
DEFAULT_MIN_MULTIPLIER: () => DEFAULT_MIN_MULTIPLIER,
|
|
952
|
+
createEloDistanceFilter: () => createEloDistanceFilter
|
|
953
|
+
});
|
|
954
|
+
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
955
|
+
const normalizedDistance = distance / halfLife;
|
|
956
|
+
const decay = Math.exp(-(normalizedDistance * normalizedDistance));
|
|
957
|
+
return minMultiplier + (maxMultiplier - minMultiplier) * decay;
|
|
958
|
+
}
|
|
959
|
+
function createEloDistanceFilter(config) {
|
|
960
|
+
const halfLife = config?.halfLife ?? DEFAULT_HALF_LIFE;
|
|
961
|
+
const minMultiplier = config?.minMultiplier ?? DEFAULT_MIN_MULTIPLIER;
|
|
962
|
+
const maxMultiplier = config?.maxMultiplier ?? DEFAULT_MAX_MULTIPLIER;
|
|
963
|
+
return {
|
|
964
|
+
name: "ELO Distance Filter",
|
|
965
|
+
async transform(cards, context) {
|
|
966
|
+
const { course, userElo } = context;
|
|
967
|
+
const cardIds = cards.map((c) => c.cardId);
|
|
968
|
+
const cardElos = await course.getCardEloData(cardIds);
|
|
969
|
+
return cards.map((card, i) => {
|
|
970
|
+
const cardElo = cardElos[i]?.global?.score ?? 1e3;
|
|
971
|
+
const distance = Math.abs(cardElo - userElo);
|
|
972
|
+
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
973
|
+
const newScore = card.score * multiplier;
|
|
974
|
+
const action = multiplier < maxMultiplier - 0.01 ? "penalized" : "passed";
|
|
975
|
+
return {
|
|
976
|
+
...card,
|
|
977
|
+
score: newScore,
|
|
978
|
+
provenance: [
|
|
979
|
+
...card.provenance,
|
|
980
|
+
{
|
|
981
|
+
strategy: "eloDistance",
|
|
982
|
+
strategyName: "ELO Distance Filter",
|
|
983
|
+
strategyId: "ELO_DISTANCE_FILTER",
|
|
984
|
+
action,
|
|
985
|
+
score: newScore,
|
|
986
|
+
reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userElo)}) \u2192 ${multiplier.toFixed(2)}x`
|
|
987
|
+
}
|
|
988
|
+
]
|
|
989
|
+
};
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
var DEFAULT_HALF_LIFE, DEFAULT_MIN_MULTIPLIER, DEFAULT_MAX_MULTIPLIER;
|
|
995
|
+
var init_eloDistance = __esm({
|
|
996
|
+
"src/core/navigators/filters/eloDistance.ts"() {
|
|
997
|
+
"use strict";
|
|
998
|
+
DEFAULT_HALF_LIFE = 200;
|
|
999
|
+
DEFAULT_MIN_MULTIPLIER = 0.3;
|
|
1000
|
+
DEFAULT_MAX_MULTIPLIER = 1;
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
|
|
1004
|
+
// src/core/navigators/filters/hierarchyDefinition.ts
|
|
1005
|
+
var hierarchyDefinition_exports = {};
|
|
1006
|
+
__export(hierarchyDefinition_exports, {
|
|
1007
|
+
default: () => HierarchyDefinitionNavigator
|
|
1008
|
+
});
|
|
1009
|
+
import { toCourseElo as toCourseElo3 } from "@vue-skuilder/common";
|
|
1010
|
+
var DEFAULT_MIN_COUNT, HierarchyDefinitionNavigator;
|
|
1011
|
+
var init_hierarchyDefinition = __esm({
|
|
1012
|
+
"src/core/navigators/filters/hierarchyDefinition.ts"() {
|
|
1013
|
+
"use strict";
|
|
1014
|
+
init_navigators();
|
|
1015
|
+
DEFAULT_MIN_COUNT = 3;
|
|
1016
|
+
HierarchyDefinitionNavigator = class extends ContentNavigator {
|
|
1017
|
+
config;
|
|
1018
|
+
/** Human-readable name for CardFilter interface */
|
|
1019
|
+
name;
|
|
1020
|
+
constructor(user, course, strategyData) {
|
|
1021
|
+
super(user, course, strategyData);
|
|
1022
|
+
this.config = this.parseConfig(strategyData.serializedData);
|
|
1023
|
+
this.name = strategyData.name || "Hierarchy Definition";
|
|
1024
|
+
}
|
|
1025
|
+
parseConfig(serializedData) {
|
|
1026
|
+
try {
|
|
1027
|
+
const parsed = JSON.parse(serializedData);
|
|
1028
|
+
return {
|
|
1029
|
+
prerequisites: parsed.prerequisites || {}
|
|
1030
|
+
};
|
|
1031
|
+
} catch {
|
|
1032
|
+
return {
|
|
1033
|
+
prerequisites: {}
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Check if a specific prerequisite is satisfied
|
|
1039
|
+
*/
|
|
1040
|
+
isPrerequisiteMet(prereq, userTagElo, userGlobalElo) {
|
|
1041
|
+
if (!userTagElo) return false;
|
|
1042
|
+
const minCount = prereq.masteryThreshold?.minCount ?? DEFAULT_MIN_COUNT;
|
|
1043
|
+
if (userTagElo.count < minCount) return false;
|
|
1044
|
+
if (prereq.masteryThreshold?.minElo !== void 0) {
|
|
1045
|
+
return userTagElo.score >= prereq.masteryThreshold.minElo;
|
|
1046
|
+
} else {
|
|
1047
|
+
return userTagElo.score >= userGlobalElo;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Get the set of tags the user has mastered.
|
|
1052
|
+
* A tag is "mastered" if it appears as a prerequisite somewhere and meets its threshold.
|
|
1053
|
+
*/
|
|
1054
|
+
async getMasteredTags(context) {
|
|
1055
|
+
const mastered = /* @__PURE__ */ new Set();
|
|
1056
|
+
try {
|
|
1057
|
+
const courseReg = await context.user.getCourseRegDoc(context.course.getCourseID());
|
|
1058
|
+
const userElo = toCourseElo3(courseReg.elo);
|
|
1059
|
+
for (const prereqs of Object.values(this.config.prerequisites)) {
|
|
1060
|
+
for (const prereq of prereqs) {
|
|
1061
|
+
const tagElo = userElo.tags[prereq.tag];
|
|
1062
|
+
if (this.isPrerequisiteMet(prereq, tagElo, userElo.global.score)) {
|
|
1063
|
+
mastered.add(prereq.tag);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
} catch {
|
|
1068
|
+
}
|
|
1069
|
+
return mastered;
|
|
1070
|
+
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Get the set of tags that are unlocked (prerequisites met)
|
|
1073
|
+
*/
|
|
1074
|
+
getUnlockedTags(masteredTags) {
|
|
1075
|
+
const unlocked = /* @__PURE__ */ new Set();
|
|
1076
|
+
for (const [tagId, prereqs] of Object.entries(this.config.prerequisites)) {
|
|
1077
|
+
const allPrereqsMet = prereqs.every((prereq) => masteredTags.has(prereq.tag));
|
|
1078
|
+
if (allPrereqsMet) {
|
|
1079
|
+
unlocked.add(tagId);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return unlocked;
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Check if a tag has prerequisites defined in config
|
|
1086
|
+
*/
|
|
1087
|
+
hasPrerequisites(tagId) {
|
|
1088
|
+
return tagId in this.config.prerequisites;
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Check if a card is unlocked and generate reason.
|
|
1092
|
+
*/
|
|
1093
|
+
async checkCardUnlock(card, _course, unlockedTags, masteredTags) {
|
|
1094
|
+
try {
|
|
1095
|
+
const cardTags = card.tags ?? [];
|
|
1096
|
+
const lockedTags = cardTags.filter(
|
|
1097
|
+
(tag) => this.hasPrerequisites(tag) && !unlockedTags.has(tag)
|
|
1098
|
+
);
|
|
1099
|
+
if (lockedTags.length === 0) {
|
|
1100
|
+
const tagList = cardTags.length > 0 ? cardTags.join(", ") : "none";
|
|
1101
|
+
return {
|
|
1102
|
+
isUnlocked: true,
|
|
1103
|
+
reason: `Prerequisites met, tags: ${tagList}`
|
|
1104
|
+
};
|
|
1105
|
+
}
|
|
1106
|
+
const missingPrereqs = lockedTags.flatMap((tag) => {
|
|
1107
|
+
const prereqs = this.config.prerequisites[tag] || [];
|
|
1108
|
+
return prereqs.filter((p) => !masteredTags.has(p.tag)).map((p) => p.tag);
|
|
1109
|
+
});
|
|
1110
|
+
return {
|
|
1111
|
+
isUnlocked: false,
|
|
1112
|
+
reason: `Blocked: missing prerequisites ${missingPrereqs.join(", ")} for tags ${lockedTags.join(", ")}`
|
|
1113
|
+
};
|
|
1114
|
+
} catch {
|
|
1115
|
+
return {
|
|
1116
|
+
isUnlocked: true,
|
|
1117
|
+
reason: "Prerequisites check skipped (tag lookup failed)"
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
/**
|
|
1122
|
+
* CardFilter.transform implementation.
|
|
1123
|
+
*
|
|
1124
|
+
* Apply prerequisite gating to cards. Cards with locked tags receive score: 0.
|
|
1125
|
+
*/
|
|
1126
|
+
async transform(cards, context) {
|
|
1127
|
+
const masteredTags = await this.getMasteredTags(context);
|
|
1128
|
+
const unlockedTags = this.getUnlockedTags(masteredTags);
|
|
1129
|
+
const gated = [];
|
|
1130
|
+
for (const card of cards) {
|
|
1131
|
+
const { isUnlocked, reason } = await this.checkCardUnlock(
|
|
1132
|
+
card,
|
|
1133
|
+
context.course,
|
|
1134
|
+
unlockedTags,
|
|
1135
|
+
masteredTags
|
|
1136
|
+
);
|
|
1137
|
+
const finalScore = isUnlocked ? card.score : 0;
|
|
1138
|
+
const action = isUnlocked ? "passed" : "penalized";
|
|
1139
|
+
gated.push({
|
|
1140
|
+
...card,
|
|
1141
|
+
score: finalScore,
|
|
1142
|
+
provenance: [
|
|
1143
|
+
...card.provenance,
|
|
1144
|
+
{
|
|
1145
|
+
strategy: "hierarchyDefinition",
|
|
1146
|
+
strategyName: this.strategyName || this.name,
|
|
1147
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-hierarchy",
|
|
1148
|
+
action,
|
|
1149
|
+
score: finalScore,
|
|
1150
|
+
reason
|
|
1151
|
+
}
|
|
1152
|
+
]
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
return gated;
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Legacy getWeightedCards - now throws as filters should not be used as generators.
|
|
1159
|
+
*
|
|
1160
|
+
* Use transform() via Pipeline instead.
|
|
1161
|
+
*/
|
|
1162
|
+
async getWeightedCards(_limit) {
|
|
1163
|
+
throw new Error(
|
|
1164
|
+
"HierarchyDefinitionNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform()."
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
// src/core/navigators/filters/userTagPreference.ts
|
|
1172
|
+
var userTagPreference_exports = {};
|
|
1173
|
+
__export(userTagPreference_exports, {
|
|
1174
|
+
default: () => UserTagPreferenceFilter
|
|
1175
|
+
});
|
|
1176
|
+
var UserTagPreferenceFilter;
|
|
1177
|
+
var init_userTagPreference = __esm({
|
|
1178
|
+
"src/core/navigators/filters/userTagPreference.ts"() {
|
|
1179
|
+
"use strict";
|
|
1180
|
+
init_navigators();
|
|
1181
|
+
UserTagPreferenceFilter = class extends ContentNavigator {
|
|
1182
|
+
_strategyData;
|
|
1183
|
+
/** Human-readable name for CardFilter interface */
|
|
1184
|
+
name;
|
|
1185
|
+
constructor(user, course, strategyData) {
|
|
1186
|
+
super(user, course, strategyData);
|
|
1187
|
+
this._strategyData = strategyData;
|
|
1188
|
+
this.name = strategyData.name || "User Tag Preferences";
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Compute multiplier for a card based on its tags and user preferences.
|
|
1192
|
+
* Returns the maximum multiplier among all matching tags, or 1.0 if no matches.
|
|
1193
|
+
*/
|
|
1194
|
+
computeMultiplier(cardTags, boostMap) {
|
|
1195
|
+
const multipliers = cardTags.map((tag) => boostMap[tag]).filter((val) => val !== void 0);
|
|
1196
|
+
if (multipliers.length === 0) {
|
|
1197
|
+
return 1;
|
|
1198
|
+
}
|
|
1199
|
+
return Math.max(...multipliers);
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Build human-readable reason for the filter's decision.
|
|
1203
|
+
*/
|
|
1204
|
+
buildReason(cardTags, boostMap, multiplier) {
|
|
1205
|
+
const matchingTags = cardTags.filter((tag) => boostMap[tag] === multiplier);
|
|
1206
|
+
if (multiplier === 0) {
|
|
1207
|
+
return `Excluded by user preference: ${matchingTags.join(", ")} (${multiplier}x)`;
|
|
1208
|
+
}
|
|
1209
|
+
if (multiplier < 1) {
|
|
1210
|
+
return `Penalized by user preference: ${matchingTags.join(", ")} (${multiplier.toFixed(2)}x)`;
|
|
1211
|
+
}
|
|
1212
|
+
if (multiplier > 1) {
|
|
1213
|
+
return `Boosted by user preference: ${matchingTags.join(", ")} (${multiplier.toFixed(2)}x)`;
|
|
1214
|
+
}
|
|
1215
|
+
return "No matching user preferences";
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* CardFilter.transform implementation.
|
|
1219
|
+
*
|
|
1220
|
+
* Apply user tag preferences:
|
|
1221
|
+
* 1. Read preferences from strategy state
|
|
1222
|
+
* 2. If no preferences, pass through unchanged
|
|
1223
|
+
* 3. For each card:
|
|
1224
|
+
* - Look up tag in boost record
|
|
1225
|
+
* - If tag found: apply multiplier (0 = exclude, 1 = neutral, >1 = boost)
|
|
1226
|
+
* - If multiple tags match: use max multiplier
|
|
1227
|
+
* - Append provenance with clear reason
|
|
1228
|
+
*/
|
|
1229
|
+
async transform(cards, _context) {
|
|
1230
|
+
const prefs = await this.getStrategyState();
|
|
1231
|
+
if (!prefs || Object.keys(prefs.boost).length === 0) {
|
|
1232
|
+
return cards.map((card) => ({
|
|
1233
|
+
...card,
|
|
1234
|
+
provenance: [
|
|
1235
|
+
...card.provenance,
|
|
1236
|
+
{
|
|
1237
|
+
strategy: "userTagPreference",
|
|
1238
|
+
strategyName: this.strategyName || this.name,
|
|
1239
|
+
strategyId: this.strategyId || this._strategyData._id,
|
|
1240
|
+
action: "passed",
|
|
1241
|
+
score: card.score,
|
|
1242
|
+
reason: "No user tag preferences configured"
|
|
1243
|
+
}
|
|
1244
|
+
]
|
|
1245
|
+
}));
|
|
1246
|
+
}
|
|
1247
|
+
const adjusted = await Promise.all(
|
|
1248
|
+
cards.map(async (card) => {
|
|
1249
|
+
const cardTags = card.tags ?? [];
|
|
1250
|
+
const multiplier = this.computeMultiplier(cardTags, prefs.boost);
|
|
1251
|
+
const finalScore = Math.min(1, card.score * multiplier);
|
|
1252
|
+
let action;
|
|
1253
|
+
if (multiplier === 0 || multiplier < 1) {
|
|
1254
|
+
action = "penalized";
|
|
1255
|
+
} else if (multiplier > 1) {
|
|
1256
|
+
action = "boosted";
|
|
1257
|
+
} else {
|
|
1258
|
+
action = "passed";
|
|
1259
|
+
}
|
|
1260
|
+
return {
|
|
1261
|
+
...card,
|
|
1262
|
+
score: finalScore,
|
|
1263
|
+
provenance: [
|
|
1264
|
+
...card.provenance,
|
|
1265
|
+
{
|
|
1266
|
+
strategy: "userTagPreference",
|
|
1267
|
+
strategyName: this.strategyName || this.name,
|
|
1268
|
+
strategyId: this.strategyId || this._strategyData._id,
|
|
1269
|
+
action,
|
|
1270
|
+
score: finalScore,
|
|
1271
|
+
reason: this.buildReason(cardTags, prefs.boost, multiplier)
|
|
1272
|
+
}
|
|
1273
|
+
]
|
|
1274
|
+
};
|
|
1275
|
+
})
|
|
1276
|
+
);
|
|
1277
|
+
return adjusted;
|
|
1278
|
+
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Legacy getWeightedCards - throws as filters should not be used as generators.
|
|
1281
|
+
*/
|
|
1282
|
+
async getWeightedCards(_limit) {
|
|
1283
|
+
throw new Error(
|
|
1284
|
+
"UserTagPreferenceFilter is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform()."
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
};
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
// src/core/navigators/filters/index.ts
|
|
1292
|
+
var filters_exports = {};
|
|
1293
|
+
__export(filters_exports, {
|
|
1294
|
+
UserTagPreferenceFilter: () => UserTagPreferenceFilter,
|
|
1295
|
+
createEloDistanceFilter: () => createEloDistanceFilter
|
|
1296
|
+
});
|
|
1297
|
+
var init_filters = __esm({
|
|
1298
|
+
"src/core/navigators/filters/index.ts"() {
|
|
1299
|
+
"use strict";
|
|
1300
|
+
init_eloDistance();
|
|
1301
|
+
init_userTagPreference();
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
|
|
1305
|
+
// src/core/navigators/filters/inferredPreferenceStub.ts
|
|
1306
|
+
var inferredPreferenceStub_exports = {};
|
|
1307
|
+
__export(inferredPreferenceStub_exports, {
|
|
1308
|
+
INFERRED_PREFERENCE_NAVIGATOR_STUB: () => INFERRED_PREFERENCE_NAVIGATOR_STUB
|
|
1309
|
+
});
|
|
1310
|
+
var INFERRED_PREFERENCE_NAVIGATOR_STUB;
|
|
1311
|
+
var init_inferredPreferenceStub = __esm({
|
|
1312
|
+
"src/core/navigators/filters/inferredPreferenceStub.ts"() {
|
|
1313
|
+
"use strict";
|
|
1314
|
+
INFERRED_PREFERENCE_NAVIGATOR_STUB = true;
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
|
|
1318
|
+
// src/core/navigators/filters/interferenceMitigator.ts
|
|
1319
|
+
var interferenceMitigator_exports = {};
|
|
1320
|
+
__export(interferenceMitigator_exports, {
|
|
1321
|
+
default: () => InterferenceMitigatorNavigator
|
|
1322
|
+
});
|
|
1323
|
+
import { toCourseElo as toCourseElo4 } from "@vue-skuilder/common";
|
|
1324
|
+
var DEFAULT_MIN_COUNT2, DEFAULT_MIN_ELAPSED_DAYS, DEFAULT_INTERFERENCE_DECAY, InterferenceMitigatorNavigator;
|
|
1325
|
+
var init_interferenceMitigator = __esm({
|
|
1326
|
+
"src/core/navigators/filters/interferenceMitigator.ts"() {
|
|
1327
|
+
"use strict";
|
|
1328
|
+
init_navigators();
|
|
1329
|
+
DEFAULT_MIN_COUNT2 = 10;
|
|
1330
|
+
DEFAULT_MIN_ELAPSED_DAYS = 3;
|
|
1331
|
+
DEFAULT_INTERFERENCE_DECAY = 0.8;
|
|
1332
|
+
InterferenceMitigatorNavigator = class extends ContentNavigator {
|
|
1333
|
+
config;
|
|
1334
|
+
/** Human-readable name for CardFilter interface */
|
|
1335
|
+
name;
|
|
1336
|
+
/** Precomputed map: tag -> set of { partner, decay } it interferes with */
|
|
1337
|
+
interferenceMap;
|
|
1338
|
+
constructor(user, course, strategyData) {
|
|
1339
|
+
super(user, course, strategyData);
|
|
1340
|
+
this.config = this.parseConfig(strategyData.serializedData);
|
|
1341
|
+
this.interferenceMap = this.buildInterferenceMap();
|
|
1342
|
+
this.name = strategyData.name || "Interference Mitigator";
|
|
1343
|
+
}
|
|
1344
|
+
parseConfig(serializedData) {
|
|
1345
|
+
try {
|
|
1346
|
+
const parsed = JSON.parse(serializedData);
|
|
1347
|
+
let sets = parsed.interferenceSets || [];
|
|
1348
|
+
if (sets.length > 0 && Array.isArray(sets[0])) {
|
|
1349
|
+
sets = sets.map((tags) => ({ tags }));
|
|
1350
|
+
}
|
|
1351
|
+
return {
|
|
1352
|
+
interferenceSets: sets,
|
|
1353
|
+
maturityThreshold: {
|
|
1354
|
+
minCount: parsed.maturityThreshold?.minCount ?? DEFAULT_MIN_COUNT2,
|
|
1355
|
+
minElo: parsed.maturityThreshold?.minElo,
|
|
1356
|
+
minElapsedDays: parsed.maturityThreshold?.minElapsedDays ?? DEFAULT_MIN_ELAPSED_DAYS
|
|
1357
|
+
},
|
|
1358
|
+
defaultDecay: parsed.defaultDecay ?? DEFAULT_INTERFERENCE_DECAY
|
|
1359
|
+
};
|
|
1360
|
+
} catch {
|
|
1361
|
+
return {
|
|
1362
|
+
interferenceSets: [],
|
|
1363
|
+
maturityThreshold: {
|
|
1364
|
+
minCount: DEFAULT_MIN_COUNT2,
|
|
1365
|
+
minElapsedDays: DEFAULT_MIN_ELAPSED_DAYS
|
|
1366
|
+
},
|
|
1367
|
+
defaultDecay: DEFAULT_INTERFERENCE_DECAY
|
|
1368
|
+
};
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
/**
|
|
1372
|
+
* Build a map from each tag to its interference partners with decay coefficients.
|
|
1373
|
+
* If tags A, B, C are in an interference group with decay 0.8, then:
|
|
1374
|
+
* - A interferes with B (decay 0.8) and C (decay 0.8)
|
|
1375
|
+
* - B interferes with A (decay 0.8) and C (decay 0.8)
|
|
1376
|
+
* - etc.
|
|
1377
|
+
*/
|
|
1378
|
+
buildInterferenceMap() {
|
|
1379
|
+
const map = /* @__PURE__ */ new Map();
|
|
1380
|
+
for (const group of this.config.interferenceSets) {
|
|
1381
|
+
const decay = group.decay ?? this.config.defaultDecay ?? DEFAULT_INTERFERENCE_DECAY;
|
|
1382
|
+
for (const tag of group.tags) {
|
|
1383
|
+
if (!map.has(tag)) {
|
|
1384
|
+
map.set(tag, []);
|
|
1385
|
+
}
|
|
1386
|
+
const partners = map.get(tag);
|
|
1387
|
+
for (const other of group.tags) {
|
|
1388
|
+
if (other !== tag) {
|
|
1389
|
+
const existing = partners.find((p) => p.partner === other);
|
|
1390
|
+
if (existing) {
|
|
1391
|
+
existing.decay = Math.max(existing.decay, decay);
|
|
1392
|
+
} else {
|
|
1393
|
+
partners.push({ partner: other, decay });
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
return map;
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Get the set of tags that are currently immature for this user.
|
|
1403
|
+
* A tag is immature if the user has interacted with it but hasn't
|
|
1404
|
+
* reached the maturity threshold.
|
|
1405
|
+
*/
|
|
1406
|
+
async getImmatureTags(context) {
|
|
1407
|
+
const immature = /* @__PURE__ */ new Set();
|
|
1408
|
+
try {
|
|
1409
|
+
const courseReg = await context.user.getCourseRegDoc(context.course.getCourseID());
|
|
1410
|
+
const userElo = toCourseElo4(courseReg.elo);
|
|
1411
|
+
const minCount = this.config.maturityThreshold?.minCount ?? DEFAULT_MIN_COUNT2;
|
|
1412
|
+
const minElo = this.config.maturityThreshold?.minElo;
|
|
1413
|
+
const minElapsedDays = this.config.maturityThreshold?.minElapsedDays ?? DEFAULT_MIN_ELAPSED_DAYS;
|
|
1414
|
+
const minCountForElapsed = minElapsedDays * 2;
|
|
1415
|
+
for (const [tagId, tagElo] of Object.entries(userElo.tags)) {
|
|
1416
|
+
if (tagElo.count === 0) continue;
|
|
1417
|
+
const belowCount = tagElo.count < minCount;
|
|
1418
|
+
const belowElo = minElo !== void 0 && tagElo.score < minElo;
|
|
1419
|
+
const belowElapsed = tagElo.count < minCountForElapsed;
|
|
1420
|
+
if (belowCount || belowElo || belowElapsed) {
|
|
1421
|
+
immature.add(tagId);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
} catch {
|
|
1425
|
+
}
|
|
1426
|
+
return immature;
|
|
1427
|
+
}
|
|
1428
|
+
/**
|
|
1429
|
+
* Get all tags that interfere with any immature tag, along with their decay coefficients.
|
|
1430
|
+
* These are the tags we want to avoid introducing.
|
|
1431
|
+
*/
|
|
1432
|
+
getTagsToAvoid(immatureTags) {
|
|
1433
|
+
const avoid = /* @__PURE__ */ new Map();
|
|
1434
|
+
for (const immatureTag of immatureTags) {
|
|
1435
|
+
const partners = this.interferenceMap.get(immatureTag);
|
|
1436
|
+
if (partners) {
|
|
1437
|
+
for (const { partner, decay } of partners) {
|
|
1438
|
+
if (!immatureTags.has(partner)) {
|
|
1439
|
+
const existing = avoid.get(partner) ?? 0;
|
|
1440
|
+
avoid.set(partner, Math.max(existing, decay));
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
return avoid;
|
|
1446
|
+
}
|
|
1447
|
+
/**
|
|
1448
|
+
* Compute interference score reduction for a card.
|
|
1449
|
+
* Returns: { multiplier, interfering tags, reason }
|
|
1450
|
+
*/
|
|
1451
|
+
computeInterferenceEffect(cardTags, tagsToAvoid, immatureTags) {
|
|
1452
|
+
if (tagsToAvoid.size === 0) {
|
|
1453
|
+
return {
|
|
1454
|
+
multiplier: 1,
|
|
1455
|
+
interferingTags: [],
|
|
1456
|
+
reason: "No interference detected"
|
|
1457
|
+
};
|
|
1458
|
+
}
|
|
1459
|
+
let multiplier = 1;
|
|
1460
|
+
const interferingTags = [];
|
|
1461
|
+
for (const tag of cardTags) {
|
|
1462
|
+
const decay = tagsToAvoid.get(tag);
|
|
1463
|
+
if (decay !== void 0) {
|
|
1464
|
+
interferingTags.push(tag);
|
|
1465
|
+
multiplier *= 1 - decay;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
if (interferingTags.length === 0) {
|
|
1469
|
+
return {
|
|
1470
|
+
multiplier: 1,
|
|
1471
|
+
interferingTags: [],
|
|
1472
|
+
reason: "No interference detected"
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
const causingTags = /* @__PURE__ */ new Set();
|
|
1476
|
+
for (const tag of interferingTags) {
|
|
1477
|
+
for (const immatureTag of immatureTags) {
|
|
1478
|
+
const partners = this.interferenceMap.get(immatureTag);
|
|
1479
|
+
if (partners?.some((p) => p.partner === tag)) {
|
|
1480
|
+
causingTags.add(immatureTag);
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
}
|
|
1484
|
+
const reason = `Interferes with immature tags ${Array.from(causingTags).join(", ")} (tags: ${interferingTags.join(", ")}, multiplier: ${multiplier.toFixed(2)})`;
|
|
1485
|
+
return { multiplier, interferingTags, reason };
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* CardFilter.transform implementation.
|
|
1489
|
+
*
|
|
1490
|
+
* Apply interference-aware scoring. Cards with tags that interfere with
|
|
1491
|
+
* immature learnings get reduced scores.
|
|
1492
|
+
*/
|
|
1493
|
+
async transform(cards, context) {
|
|
1494
|
+
const immatureTags = await this.getImmatureTags(context);
|
|
1495
|
+
const tagsToAvoid = this.getTagsToAvoid(immatureTags);
|
|
1496
|
+
const adjusted = [];
|
|
1497
|
+
for (const card of cards) {
|
|
1498
|
+
const cardTags = card.tags ?? [];
|
|
1499
|
+
const { multiplier, reason } = this.computeInterferenceEffect(
|
|
1500
|
+
cardTags,
|
|
1501
|
+
tagsToAvoid,
|
|
1502
|
+
immatureTags
|
|
1503
|
+
);
|
|
1504
|
+
const finalScore = card.score * multiplier;
|
|
1505
|
+
const action = multiplier < 1 ? "penalized" : multiplier > 1 ? "boosted" : "passed";
|
|
1506
|
+
adjusted.push({
|
|
1507
|
+
...card,
|
|
1508
|
+
score: finalScore,
|
|
1509
|
+
provenance: [
|
|
1510
|
+
...card.provenance,
|
|
1511
|
+
{
|
|
1512
|
+
strategy: "interferenceMitigator",
|
|
1513
|
+
strategyName: this.strategyName || this.name,
|
|
1514
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-interference",
|
|
1515
|
+
action,
|
|
1516
|
+
score: finalScore,
|
|
1517
|
+
reason
|
|
1518
|
+
}
|
|
1519
|
+
]
|
|
1520
|
+
});
|
|
1521
|
+
}
|
|
1522
|
+
return adjusted;
|
|
1523
|
+
}
|
|
1524
|
+
/**
|
|
1525
|
+
* Legacy getWeightedCards - now throws as filters should not be used as generators.
|
|
1526
|
+
*
|
|
1527
|
+
* Use transform() via Pipeline instead.
|
|
1528
|
+
*/
|
|
1529
|
+
async getWeightedCards(_limit) {
|
|
1530
|
+
throw new Error(
|
|
1531
|
+
"InterferenceMitigatorNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform()."
|
|
1532
|
+
);
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
// src/core/navigators/filters/relativePriority.ts
|
|
1539
|
+
var relativePriority_exports = {};
|
|
1540
|
+
__export(relativePriority_exports, {
|
|
1541
|
+
default: () => RelativePriorityNavigator
|
|
1542
|
+
});
|
|
1543
|
+
var DEFAULT_PRIORITY, DEFAULT_PRIORITY_INFLUENCE, DEFAULT_COMBINE_MODE, RelativePriorityNavigator;
|
|
1544
|
+
var init_relativePriority = __esm({
|
|
1545
|
+
"src/core/navigators/filters/relativePriority.ts"() {
|
|
1546
|
+
"use strict";
|
|
1547
|
+
init_navigators();
|
|
1548
|
+
DEFAULT_PRIORITY = 0.5;
|
|
1549
|
+
DEFAULT_PRIORITY_INFLUENCE = 0.5;
|
|
1550
|
+
DEFAULT_COMBINE_MODE = "max";
|
|
1551
|
+
RelativePriorityNavigator = class extends ContentNavigator {
|
|
1552
|
+
config;
|
|
1553
|
+
/** Human-readable name for CardFilter interface */
|
|
1554
|
+
name;
|
|
1555
|
+
constructor(user, course, strategyData) {
|
|
1556
|
+
super(user, course, strategyData);
|
|
1557
|
+
this.config = this.parseConfig(strategyData.serializedData);
|
|
1558
|
+
this.name = strategyData.name || "Relative Priority";
|
|
1559
|
+
}
|
|
1560
|
+
parseConfig(serializedData) {
|
|
1561
|
+
try {
|
|
1562
|
+
const parsed = JSON.parse(serializedData);
|
|
1563
|
+
return {
|
|
1564
|
+
tagPriorities: parsed.tagPriorities || {},
|
|
1565
|
+
defaultPriority: parsed.defaultPriority ?? DEFAULT_PRIORITY,
|
|
1566
|
+
combineMode: parsed.combineMode ?? DEFAULT_COMBINE_MODE,
|
|
1567
|
+
priorityInfluence: parsed.priorityInfluence ?? DEFAULT_PRIORITY_INFLUENCE
|
|
1568
|
+
};
|
|
1569
|
+
} catch {
|
|
1570
|
+
return {
|
|
1571
|
+
tagPriorities: {},
|
|
1572
|
+
defaultPriority: DEFAULT_PRIORITY,
|
|
1573
|
+
combineMode: DEFAULT_COMBINE_MODE,
|
|
1574
|
+
priorityInfluence: DEFAULT_PRIORITY_INFLUENCE
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Look up the priority for a tag.
|
|
1580
|
+
*/
|
|
1581
|
+
getTagPriority(tagId) {
|
|
1582
|
+
return this.config.tagPriorities[tagId] ?? this.config.defaultPriority ?? DEFAULT_PRIORITY;
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Compute combined priority for a card based on its tags.
|
|
1586
|
+
*/
|
|
1587
|
+
computeCardPriority(cardTags) {
|
|
1588
|
+
if (cardTags.length === 0) {
|
|
1589
|
+
return this.config.defaultPriority ?? DEFAULT_PRIORITY;
|
|
1590
|
+
}
|
|
1591
|
+
const priorities = cardTags.map((tag) => this.getTagPriority(tag));
|
|
1592
|
+
switch (this.config.combineMode) {
|
|
1593
|
+
case "max":
|
|
1594
|
+
return Math.max(...priorities);
|
|
1595
|
+
case "min":
|
|
1596
|
+
return Math.min(...priorities);
|
|
1597
|
+
case "average":
|
|
1598
|
+
return priorities.reduce((sum, p) => sum + p, 0) / priorities.length;
|
|
1599
|
+
default:
|
|
1600
|
+
return Math.max(...priorities);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Compute boost factor based on priority.
|
|
1605
|
+
*
|
|
1606
|
+
* The formula: 1 + (priority - 0.5) * priorityInfluence
|
|
1607
|
+
*
|
|
1608
|
+
* This creates a multiplier centered around 1.0:
|
|
1609
|
+
* - Priority 1.0 with influence 0.5 → 1.25 (25% boost)
|
|
1610
|
+
* - Priority 0.5 with any influence → 1.00 (neutral)
|
|
1611
|
+
* - Priority 0.0 with influence 0.5 → 0.75 (25% reduction)
|
|
1612
|
+
*/
|
|
1613
|
+
computeBoostFactor(priority) {
|
|
1614
|
+
const influence = this.config.priorityInfluence ?? DEFAULT_PRIORITY_INFLUENCE;
|
|
1615
|
+
return 1 + (priority - 0.5) * influence;
|
|
1616
|
+
}
|
|
1617
|
+
/**
|
|
1618
|
+
* Build human-readable reason for priority adjustment.
|
|
1619
|
+
*/
|
|
1620
|
+
buildPriorityReason(cardTags, priority, boostFactor, finalScore) {
|
|
1621
|
+
if (cardTags.length === 0) {
|
|
1622
|
+
return `No tags, neutral priority (${priority.toFixed(2)})`;
|
|
1623
|
+
}
|
|
1624
|
+
const tagList = cardTags.slice(0, 3).join(", ");
|
|
1625
|
+
const more = cardTags.length > 3 ? ` (+${cardTags.length - 3} more)` : "";
|
|
1626
|
+
if (boostFactor === 1) {
|
|
1627
|
+
return `Neutral priority (${priority.toFixed(2)}) for tags: ${tagList}${more}`;
|
|
1628
|
+
} else if (boostFactor > 1) {
|
|
1629
|
+
return `High-priority tags: ${tagList}${more} (priority ${priority.toFixed(2)} \u2192 boost ${boostFactor.toFixed(2)}x \u2192 ${finalScore.toFixed(2)})`;
|
|
1630
|
+
} else {
|
|
1631
|
+
return `Low-priority tags: ${tagList}${more} (priority ${priority.toFixed(2)} \u2192 reduce ${boostFactor.toFixed(2)}x \u2192 ${finalScore.toFixed(2)})`;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
/**
|
|
1635
|
+
* CardFilter.transform implementation.
|
|
1636
|
+
*
|
|
1637
|
+
* Apply priority-adjusted scoring. Cards with high-priority tags get boosted,
|
|
1638
|
+
* cards with low-priority tags get reduced scores.
|
|
1639
|
+
*/
|
|
1640
|
+
async transform(cards, _context) {
|
|
1641
|
+
const adjusted = await Promise.all(
|
|
1642
|
+
cards.map(async (card) => {
|
|
1643
|
+
const cardTags = card.tags ?? [];
|
|
1644
|
+
const priority = this.computeCardPriority(cardTags);
|
|
1645
|
+
const boostFactor = this.computeBoostFactor(priority);
|
|
1646
|
+
const finalScore = Math.max(0, Math.min(1, card.score * boostFactor));
|
|
1647
|
+
const action = boostFactor > 1 ? "boosted" : boostFactor < 1 ? "penalized" : "passed";
|
|
1648
|
+
const reason = this.buildPriorityReason(cardTags, priority, boostFactor, finalScore);
|
|
1649
|
+
return {
|
|
1650
|
+
...card,
|
|
1651
|
+
score: finalScore,
|
|
1652
|
+
provenance: [
|
|
1653
|
+
...card.provenance,
|
|
1654
|
+
{
|
|
1655
|
+
strategy: "relativePriority",
|
|
1656
|
+
strategyName: this.strategyName || this.name,
|
|
1657
|
+
strategyId: this.strategyId || "NAVIGATION_STRATEGY-priority",
|
|
1658
|
+
action,
|
|
1659
|
+
score: finalScore,
|
|
1660
|
+
reason
|
|
1661
|
+
}
|
|
1662
|
+
]
|
|
1663
|
+
};
|
|
1664
|
+
})
|
|
1665
|
+
);
|
|
1666
|
+
return adjusted;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Legacy getWeightedCards - now throws as filters should not be used as generators.
|
|
1670
|
+
*
|
|
1671
|
+
* Use transform() via Pipeline instead.
|
|
1672
|
+
*/
|
|
1673
|
+
async getWeightedCards(_limit) {
|
|
1674
|
+
throw new Error(
|
|
1675
|
+
"RelativePriorityNavigator is a filter and should not be used as a generator. Use Pipeline with a generator and this filter via transform()."
|
|
1676
|
+
);
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1680
|
+
});
|
|
1681
|
+
|
|
1682
|
+
// src/core/navigators/filters/types.ts
|
|
1683
|
+
var types_exports2 = {};
|
|
1684
|
+
var init_types2 = __esm({
|
|
1685
|
+
"src/core/navigators/filters/types.ts"() {
|
|
1686
|
+
"use strict";
|
|
1687
|
+
}
|
|
1688
|
+
});
|
|
1689
|
+
|
|
1690
|
+
// src/core/navigators/filters/userGoalStub.ts
|
|
1691
|
+
var userGoalStub_exports = {};
|
|
1692
|
+
__export(userGoalStub_exports, {
|
|
1693
|
+
USER_GOAL_NAVIGATOR_STUB: () => USER_GOAL_NAVIGATOR_STUB
|
|
1694
|
+
});
|
|
1695
|
+
var USER_GOAL_NAVIGATOR_STUB;
|
|
1696
|
+
var init_userGoalStub = __esm({
|
|
1697
|
+
"src/core/navigators/filters/userGoalStub.ts"() {
|
|
1698
|
+
"use strict";
|
|
1699
|
+
USER_GOAL_NAVIGATOR_STUB = true;
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
|
|
1703
|
+
// import("./filters/**/*") in src/core/navigators/index.ts
|
|
1704
|
+
var globImport_filters;
|
|
1705
|
+
var init_2 = __esm({
|
|
1706
|
+
'import("./filters/**/*") in src/core/navigators/index.ts'() {
|
|
1707
|
+
globImport_filters = __glob({
|
|
1708
|
+
"./filters/WeightedFilter.ts": () => Promise.resolve().then(() => (init_WeightedFilter(), WeightedFilter_exports)),
|
|
1709
|
+
"./filters/eloDistance.ts": () => Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports)),
|
|
1710
|
+
"./filters/hierarchyDefinition.ts": () => Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
|
|
1711
|
+
"./filters/index.ts": () => Promise.resolve().then(() => (init_filters(), filters_exports)),
|
|
1712
|
+
"./filters/inferredPreferenceStub.ts": () => Promise.resolve().then(() => (init_inferredPreferenceStub(), inferredPreferenceStub_exports)),
|
|
1713
|
+
"./filters/interferenceMitigator.ts": () => Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
|
|
1714
|
+
"./filters/relativePriority.ts": () => Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
|
|
1715
|
+
"./filters/types.ts": () => Promise.resolve().then(() => (init_types2(), types_exports2)),
|
|
1716
|
+
"./filters/userGoalStub.ts": () => Promise.resolve().then(() => (init_userGoalStub(), userGoalStub_exports)),
|
|
1717
|
+
"./filters/userTagPreference.ts": () => Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports))
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
});
|
|
1721
|
+
|
|
1722
|
+
// src/core/orchestration/gradient.ts
|
|
1723
|
+
var init_gradient = __esm({
|
|
1724
|
+
"src/core/orchestration/gradient.ts"() {
|
|
1725
|
+
"use strict";
|
|
1726
|
+
init_logger();
|
|
1727
|
+
}
|
|
1728
|
+
});
|
|
1729
|
+
|
|
1730
|
+
// src/core/orchestration/learning.ts
|
|
1731
|
+
var init_learning = __esm({
|
|
1732
|
+
"src/core/orchestration/learning.ts"() {
|
|
1733
|
+
"use strict";
|
|
1734
|
+
init_contentNavigationStrategy();
|
|
1735
|
+
init_types_legacy();
|
|
1736
|
+
init_logger();
|
|
1737
|
+
}
|
|
1738
|
+
});
|
|
1739
|
+
|
|
1740
|
+
// src/core/orchestration/signal.ts
|
|
1741
|
+
var init_signal = __esm({
|
|
1742
|
+
"src/core/orchestration/signal.ts"() {
|
|
1743
|
+
"use strict";
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1747
|
+
// src/core/orchestration/recording.ts
|
|
1748
|
+
var init_recording = __esm({
|
|
1749
|
+
"src/core/orchestration/recording.ts"() {
|
|
1750
|
+
"use strict";
|
|
1751
|
+
init_signal();
|
|
1752
|
+
init_types_legacy();
|
|
1753
|
+
init_logger();
|
|
1754
|
+
}
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1757
|
+
// src/core/orchestration/index.ts
|
|
1758
|
+
function fnv1a(str) {
|
|
1759
|
+
let hash = 2166136261;
|
|
1760
|
+
for (let i = 0; i < str.length; i++) {
|
|
1761
|
+
hash ^= str.charCodeAt(i);
|
|
1762
|
+
hash = Math.imul(hash, 16777619);
|
|
1763
|
+
}
|
|
1764
|
+
return hash >>> 0;
|
|
1765
|
+
}
|
|
1766
|
+
function computeDeviation(userId, strategyId, salt) {
|
|
1767
|
+
const input = `${userId}:${strategyId}:${salt}`;
|
|
1768
|
+
const hash = fnv1a(input);
|
|
1769
|
+
const normalized = hash / 4294967296;
|
|
1770
|
+
return normalized * 2 - 1;
|
|
1771
|
+
}
|
|
1772
|
+
function computeSpread(confidence) {
|
|
1773
|
+
const clampedConfidence = Math.max(0, Math.min(1, confidence));
|
|
1774
|
+
return MAX_SPREAD - clampedConfidence * (MAX_SPREAD - MIN_SPREAD);
|
|
1775
|
+
}
|
|
1776
|
+
function computeEffectiveWeight(learnable, userId, strategyId, salt) {
|
|
1777
|
+
const deviation = computeDeviation(userId, strategyId, salt);
|
|
1778
|
+
const spread = computeSpread(learnable.confidence);
|
|
1779
|
+
const adjustment = deviation * spread * learnable.weight;
|
|
1780
|
+
const effective = learnable.weight + adjustment;
|
|
1781
|
+
return Math.max(MIN_WEIGHT, Math.min(MAX_WEIGHT, effective));
|
|
1782
|
+
}
|
|
1783
|
+
async function createOrchestrationContext(user, course) {
|
|
1784
|
+
let courseConfig;
|
|
1785
|
+
try {
|
|
1786
|
+
courseConfig = await course.getCourseConfig();
|
|
1787
|
+
} catch (e) {
|
|
1788
|
+
logger.error(`[Orchestration] Failed to load course config: ${e}`);
|
|
1789
|
+
courseConfig = {
|
|
1790
|
+
name: "Unknown",
|
|
1791
|
+
description: "",
|
|
1792
|
+
public: false,
|
|
1793
|
+
deleted: false,
|
|
1794
|
+
creator: "",
|
|
1795
|
+
admins: [],
|
|
1796
|
+
moderators: [],
|
|
1797
|
+
dataShapes: [],
|
|
1798
|
+
questionTypes: [],
|
|
1799
|
+
orchestration: { salt: "default" }
|
|
1800
|
+
};
|
|
1801
|
+
}
|
|
1802
|
+
const userId = user.getUsername();
|
|
1803
|
+
const salt = courseConfig.orchestration?.salt || "default_salt";
|
|
1804
|
+
return {
|
|
1805
|
+
user,
|
|
1806
|
+
course,
|
|
1807
|
+
userId,
|
|
1808
|
+
courseConfig,
|
|
1809
|
+
getEffectiveWeight(strategyId, learnable) {
|
|
1810
|
+
return computeEffectiveWeight(learnable, userId, strategyId, salt);
|
|
1811
|
+
},
|
|
1812
|
+
getDeviation(strategyId) {
|
|
1813
|
+
return computeDeviation(userId, strategyId, salt);
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
var MIN_SPREAD, MAX_SPREAD, MIN_WEIGHT, MAX_WEIGHT;
|
|
1818
|
+
var init_orchestration = __esm({
|
|
1819
|
+
"src/core/orchestration/index.ts"() {
|
|
1820
|
+
"use strict";
|
|
1821
|
+
init_logger();
|
|
1822
|
+
init_gradient();
|
|
1823
|
+
init_learning();
|
|
1824
|
+
init_signal();
|
|
1825
|
+
init_recording();
|
|
1826
|
+
MIN_SPREAD = 0.1;
|
|
1827
|
+
MAX_SPREAD = 0.5;
|
|
1828
|
+
MIN_WEIGHT = 0.1;
|
|
1829
|
+
MAX_WEIGHT = 3;
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
|
|
1833
|
+
// src/core/navigators/Pipeline.ts
|
|
1834
|
+
var Pipeline_exports = {};
|
|
1835
|
+
__export(Pipeline_exports, {
|
|
1836
|
+
Pipeline: () => Pipeline
|
|
1837
|
+
});
|
|
1838
|
+
import { toCourseElo as toCourseElo5 } from "@vue-skuilder/common";
|
|
1839
|
+
function logPipelineConfig(generator, filters) {
|
|
1840
|
+
const filterList = filters.length > 0 ? "\n - " + filters.map((f) => f.name).join("\n - ") : " none";
|
|
1841
|
+
logger.info(
|
|
1842
|
+
`[Pipeline] Configuration:
|
|
1843
|
+
Generator: ${generator.name}
|
|
1844
|
+
Filters:${filterList}`
|
|
1845
|
+
);
|
|
1846
|
+
}
|
|
1847
|
+
function logTagHydration(cards, tagsByCard) {
|
|
1848
|
+
const totalTags = Array.from(tagsByCard.values()).reduce((sum, tags) => sum + tags.length, 0);
|
|
1849
|
+
const cardsWithTags = Array.from(tagsByCard.values()).filter((tags) => tags.length > 0).length;
|
|
1850
|
+
logger.debug(
|
|
1851
|
+
`[Pipeline] Tag hydration: ${cards.length} cards, ${cardsWithTags} have tags (${totalTags} total tags) - single batch query`
|
|
631
1852
|
);
|
|
632
1853
|
}
|
|
633
1854
|
function logExecutionSummary(generatorName, generatedCount, filterCount, finalCount, topScores) {
|
|
@@ -656,6 +1877,7 @@ var init_Pipeline = __esm({
|
|
|
656
1877
|
"use strict";
|
|
657
1878
|
init_navigators();
|
|
658
1879
|
init_logger();
|
|
1880
|
+
init_orchestration();
|
|
659
1881
|
Pipeline = class extends ContentNavigator {
|
|
660
1882
|
generator;
|
|
661
1883
|
filters;
|
|
@@ -738,191 +1960,90 @@ var init_Pipeline = __esm({
|
|
|
738
1960
|
if (cards.length === 0) {
|
|
739
1961
|
return cards;
|
|
740
1962
|
}
|
|
741
|
-
const cardIds = cards.map((c) => c.cardId);
|
|
742
|
-
const tagsByCard = await this.course.getAppliedTagsBatch(cardIds);
|
|
743
|
-
logTagHydration(cards, tagsByCard);
|
|
744
|
-
return cards.map((card) => ({
|
|
745
|
-
...card,
|
|
746
|
-
tags: tagsByCard.get(card.cardId) ?? []
|
|
747
|
-
}));
|
|
748
|
-
}
|
|
749
|
-
/**
|
|
750
|
-
* Build shared context for generator and filters.
|
|
751
|
-
*
|
|
752
|
-
* Called once per getWeightedCards() invocation.
|
|
753
|
-
* Contains data that the generator and multiple filters might need.
|
|
754
|
-
*
|
|
755
|
-
* The context satisfies both GeneratorContext and FilterContext interfaces.
|
|
756
|
-
*/
|
|
757
|
-
async buildContext() {
|
|
758
|
-
let userElo = 1e3;
|
|
759
|
-
try {
|
|
760
|
-
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
761
|
-
const courseElo = toCourseElo2(courseReg.elo);
|
|
762
|
-
userElo = courseElo.global.score;
|
|
763
|
-
} catch (e) {
|
|
764
|
-
logger.debug(`[Pipeline] Could not get user ELO, using default: ${e}`);
|
|
765
|
-
}
|
|
766
|
-
return {
|
|
767
|
-
user: this.user,
|
|
768
|
-
course: this.course,
|
|
769
|
-
userElo
|
|
770
|
-
};
|
|
771
|
-
}
|
|
772
|
-
/**
|
|
773
|
-
* Get the course ID for this pipeline.
|
|
774
|
-
*/
|
|
775
|
-
getCourseID() {
|
|
776
|
-
return this.course.getCourseID();
|
|
777
|
-
}
|
|
778
|
-
};
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
|
|
782
|
-
// src/core/navigators/generators/CompositeGenerator.ts
|
|
783
|
-
var DEFAULT_AGGREGATION_MODE, FREQUENCY_BOOST_FACTOR, CompositeGenerator;
|
|
784
|
-
var init_CompositeGenerator = __esm({
|
|
785
|
-
"src/core/navigators/generators/CompositeGenerator.ts"() {
|
|
786
|
-
"use strict";
|
|
787
|
-
init_navigators();
|
|
788
|
-
init_logger();
|
|
789
|
-
DEFAULT_AGGREGATION_MODE = "frequencyBoost" /* FREQUENCY_BOOST */;
|
|
790
|
-
FREQUENCY_BOOST_FACTOR = 0.1;
|
|
791
|
-
CompositeGenerator = class _CompositeGenerator extends ContentNavigator {
|
|
792
|
-
/** Human-readable name for CardGenerator interface */
|
|
793
|
-
name = "Composite Generator";
|
|
794
|
-
generators;
|
|
795
|
-
aggregationMode;
|
|
796
|
-
constructor(generators, aggregationMode = DEFAULT_AGGREGATION_MODE) {
|
|
797
|
-
super();
|
|
798
|
-
this.generators = generators;
|
|
799
|
-
this.aggregationMode = aggregationMode;
|
|
800
|
-
if (generators.length === 0) {
|
|
801
|
-
throw new Error("CompositeGenerator requires at least one generator");
|
|
802
|
-
}
|
|
803
|
-
logger.debug(
|
|
804
|
-
`[CompositeGenerator] Created with ${generators.length} generators, mode: ${aggregationMode}`
|
|
805
|
-
);
|
|
806
|
-
}
|
|
807
|
-
/**
|
|
808
|
-
* Creates a CompositeGenerator from strategy data.
|
|
809
|
-
*
|
|
810
|
-
* This is a convenience factory for use by PipelineAssembler.
|
|
811
|
-
*/
|
|
812
|
-
static async fromStrategies(user, course, strategies, aggregationMode = DEFAULT_AGGREGATION_MODE) {
|
|
813
|
-
const generators = await Promise.all(
|
|
814
|
-
strategies.map((s) => ContentNavigator.create(user, course, s))
|
|
815
|
-
);
|
|
816
|
-
return new _CompositeGenerator(generators, aggregationMode);
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Get weighted cards from all generators, merge and deduplicate.
|
|
820
|
-
*
|
|
821
|
-
* Cards appearing in multiple generators receive a score boost.
|
|
822
|
-
* Provenance tracks which generators produced each card and how scores were aggregated.
|
|
823
|
-
*
|
|
824
|
-
* This method supports both the legacy signature (limit only) and the
|
|
825
|
-
* CardGenerator interface signature (limit, context).
|
|
826
|
-
*
|
|
827
|
-
* @param limit - Maximum number of cards to return
|
|
828
|
-
* @param context - GeneratorContext passed to child generators (required when called via Pipeline)
|
|
829
|
-
*/
|
|
830
|
-
async getWeightedCards(limit, context) {
|
|
831
|
-
if (!context) {
|
|
832
|
-
throw new Error(
|
|
833
|
-
"CompositeGenerator.getWeightedCards requires a GeneratorContext. It should be called via Pipeline, not directly."
|
|
834
|
-
);
|
|
835
|
-
}
|
|
836
|
-
const results = await Promise.all(
|
|
837
|
-
this.generators.map((g) => g.getWeightedCards(limit, context))
|
|
838
|
-
);
|
|
839
|
-
const byCardId = /* @__PURE__ */ new Map();
|
|
840
|
-
for (const cards of results) {
|
|
841
|
-
for (const card of cards) {
|
|
842
|
-
const existing = byCardId.get(card.cardId) || [];
|
|
843
|
-
existing.push(card);
|
|
844
|
-
byCardId.set(card.cardId, existing);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
const merged = [];
|
|
848
|
-
for (const [, cards] of byCardId) {
|
|
849
|
-
const aggregatedScore = this.aggregateScores(cards);
|
|
850
|
-
const finalScore = Math.min(1, aggregatedScore);
|
|
851
|
-
const mergedProvenance = cards.flatMap((c) => c.provenance);
|
|
852
|
-
const initialScore = cards[0].score;
|
|
853
|
-
const action = finalScore > initialScore ? "boosted" : finalScore < initialScore ? "penalized" : "passed";
|
|
854
|
-
const reason = this.buildAggregationReason(cards, finalScore);
|
|
855
|
-
merged.push({
|
|
856
|
-
...cards[0],
|
|
857
|
-
score: finalScore,
|
|
858
|
-
provenance: [
|
|
859
|
-
...mergedProvenance,
|
|
860
|
-
{
|
|
861
|
-
strategy: "composite",
|
|
862
|
-
strategyName: "Composite Generator",
|
|
863
|
-
strategyId: "COMPOSITE_GENERATOR",
|
|
864
|
-
action,
|
|
865
|
-
score: finalScore,
|
|
866
|
-
reason
|
|
867
|
-
}
|
|
868
|
-
]
|
|
869
|
-
});
|
|
870
|
-
}
|
|
871
|
-
return merged.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
1963
|
+
const cardIds = cards.map((c) => c.cardId);
|
|
1964
|
+
const tagsByCard = await this.course.getAppliedTagsBatch(cardIds);
|
|
1965
|
+
logTagHydration(cards, tagsByCard);
|
|
1966
|
+
return cards.map((card) => ({
|
|
1967
|
+
...card,
|
|
1968
|
+
tags: tagsByCard.get(card.cardId) ?? []
|
|
1969
|
+
}));
|
|
872
1970
|
}
|
|
873
1971
|
/**
|
|
874
|
-
* Build
|
|
1972
|
+
* Build shared context for generator and filters.
|
|
1973
|
+
*
|
|
1974
|
+
* Called once per getWeightedCards() invocation.
|
|
1975
|
+
* Contains data that the generator and multiple filters might need.
|
|
1976
|
+
*
|
|
1977
|
+
* The context satisfies both GeneratorContext and FilterContext interfaces.
|
|
875
1978
|
*/
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
case "max" /* MAX */:
|
|
885
|
-
return `Max of ${count} generators (${strategies}): scores [${scores}] \u2192 ${finalScore.toFixed(2)}`;
|
|
886
|
-
case "average" /* AVERAGE */:
|
|
887
|
-
return `Average of ${count} generators (${strategies}): scores [${scores}] \u2192 ${finalScore.toFixed(2)}`;
|
|
888
|
-
case "frequencyBoost" /* FREQUENCY_BOOST */: {
|
|
889
|
-
const avg = cards.reduce((sum, c) => sum + c.score, 0) / count;
|
|
890
|
-
const boost = 1 + FREQUENCY_BOOST_FACTOR * (count - 1);
|
|
891
|
-
return `Frequency boost from ${count} generators (${strategies}): avg ${avg.toFixed(2)} \xD7 ${boost.toFixed(2)} \u2192 ${finalScore.toFixed(2)}`;
|
|
892
|
-
}
|
|
893
|
-
default:
|
|
894
|
-
return `Aggregated from ${count} generators: ${finalScore.toFixed(2)}`;
|
|
1979
|
+
async buildContext() {
|
|
1980
|
+
let userElo = 1e3;
|
|
1981
|
+
try {
|
|
1982
|
+
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
1983
|
+
const courseElo = toCourseElo5(courseReg.elo);
|
|
1984
|
+
userElo = courseElo.global.score;
|
|
1985
|
+
} catch (e) {
|
|
1986
|
+
logger.debug(`[Pipeline] Could not get user ELO, using default: ${e}`);
|
|
895
1987
|
}
|
|
1988
|
+
const orchestration = await createOrchestrationContext(this.user, this.course);
|
|
1989
|
+
return {
|
|
1990
|
+
user: this.user,
|
|
1991
|
+
course: this.course,
|
|
1992
|
+
userElo,
|
|
1993
|
+
orchestration
|
|
1994
|
+
};
|
|
896
1995
|
}
|
|
897
1996
|
/**
|
|
898
|
-
*
|
|
1997
|
+
* Get the course ID for this pipeline.
|
|
899
1998
|
*/
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
1999
|
+
getCourseID() {
|
|
2000
|
+
return this.course.getCourseID();
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
* Get orchestration context for outcome recording.
|
|
2004
|
+
*/
|
|
2005
|
+
async getOrchestrationContext() {
|
|
2006
|
+
return createOrchestrationContext(this.user, this.course);
|
|
2007
|
+
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Get IDs of all strategies in this pipeline.
|
|
2010
|
+
* Used to record which strategies contributed to an outcome.
|
|
2011
|
+
*/
|
|
2012
|
+
getStrategyIds() {
|
|
2013
|
+
const ids = [];
|
|
2014
|
+
const extractId = (obj) => {
|
|
2015
|
+
if (obj.strategyId) return obj.strategyId;
|
|
2016
|
+
return null;
|
|
2017
|
+
};
|
|
2018
|
+
const genId = extractId(this.generator);
|
|
2019
|
+
if (genId) ids.push(genId);
|
|
2020
|
+
if (this.generator.generators && Array.isArray(this.generator.generators)) {
|
|
2021
|
+
this.generator.generators.forEach((g) => {
|
|
2022
|
+
const subId = extractId(g);
|
|
2023
|
+
if (subId) ids.push(subId);
|
|
2024
|
+
});
|
|
2025
|
+
}
|
|
2026
|
+
for (const filter of this.filters) {
|
|
2027
|
+
const fId = extractId(filter);
|
|
2028
|
+
if (fId) ids.push(fId);
|
|
914
2029
|
}
|
|
2030
|
+
return [...new Set(ids)];
|
|
915
2031
|
}
|
|
916
2032
|
};
|
|
917
2033
|
}
|
|
918
2034
|
});
|
|
919
2035
|
|
|
920
2036
|
// src/core/navigators/PipelineAssembler.ts
|
|
2037
|
+
var PipelineAssembler_exports = {};
|
|
2038
|
+
__export(PipelineAssembler_exports, {
|
|
2039
|
+
PipelineAssembler: () => PipelineAssembler
|
|
2040
|
+
});
|
|
921
2041
|
var PipelineAssembler;
|
|
922
2042
|
var init_PipelineAssembler = __esm({
|
|
923
2043
|
"src/core/navigators/PipelineAssembler.ts"() {
|
|
924
2044
|
"use strict";
|
|
925
2045
|
init_navigators();
|
|
2046
|
+
init_WeightedFilter();
|
|
926
2047
|
init_Pipeline();
|
|
927
2048
|
init_types_legacy();
|
|
928
2049
|
init_logger();
|
|
@@ -997,7 +2118,16 @@ var init_PipelineAssembler = __esm({
|
|
|
997
2118
|
try {
|
|
998
2119
|
const nav = await ContentNavigator.create(user, course, filterStrategy);
|
|
999
2120
|
if ("transform" in nav && typeof nav.transform === "function") {
|
|
1000
|
-
|
|
2121
|
+
let filter = nav;
|
|
2122
|
+
if (filterStrategy.learnable) {
|
|
2123
|
+
filter = new WeightedFilter(
|
|
2124
|
+
filter,
|
|
2125
|
+
filterStrategy.learnable,
|
|
2126
|
+
filterStrategy.staticWeight,
|
|
2127
|
+
filterStrategy._id
|
|
2128
|
+
);
|
|
2129
|
+
}
|
|
2130
|
+
filters.push(filter);
|
|
1001
2131
|
logger.debug(`[PipelineAssembler] Added filter: ${filterStrategy.name}`);
|
|
1002
2132
|
} else {
|
|
1003
2133
|
warnings.push(
|
|
@@ -1008,252 +2138,43 @@ var init_PipelineAssembler = __esm({
|
|
|
1008
2138
|
warnings.push(`Failed to instantiate filter '${filterStrategy.name}': ${e}`);
|
|
1009
2139
|
}
|
|
1010
2140
|
}
|
|
1011
|
-
const pipeline = new Pipeline(generator, filters, user, course);
|
|
1012
|
-
logger.debug(
|
|
1013
|
-
`[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
|
|
1014
|
-
);
|
|
1015
|
-
return {
|
|
1016
|
-
pipeline,
|
|
1017
|
-
generatorStrategies,
|
|
1018
|
-
filterStrategies: sortedFilterStrategies,
|
|
1019
|
-
warnings
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
/**
|
|
1023
|
-
* Creates a default ELO generator strategy.
|
|
1024
|
-
* Used when filters are configured but no generator is specified.
|
|
1025
|
-
*/
|
|
1026
|
-
makeDefaultEloStrategy(courseId) {
|
|
1027
|
-
return {
|
|
1028
|
-
_id: "NAVIGATION_STRATEGY-ELO-default",
|
|
1029
|
-
course: courseId,
|
|
1030
|
-
docType: "NAVIGATION_STRATEGY" /* NAVIGATION_STRATEGY */,
|
|
1031
|
-
name: "ELO (default)",
|
|
1032
|
-
description: "Default ELO-based generator",
|
|
1033
|
-
implementingClass: "elo" /* ELO */,
|
|
1034
|
-
serializedData: ""
|
|
1035
|
-
};
|
|
1036
|
-
}
|
|
1037
|
-
};
|
|
1038
|
-
}
|
|
1039
|
-
});
|
|
1040
|
-
|
|
1041
|
-
// src/core/navigators/generators/elo.ts
|
|
1042
|
-
import { toCourseElo as toCourseElo3 } from "@vue-skuilder/common";
|
|
1043
|
-
var ELONavigator;
|
|
1044
|
-
var init_elo = __esm({
|
|
1045
|
-
"src/core/navigators/generators/elo.ts"() {
|
|
1046
|
-
"use strict";
|
|
1047
|
-
init_navigators();
|
|
1048
|
-
ELONavigator = class extends ContentNavigator {
|
|
1049
|
-
/** Human-readable name for CardGenerator interface */
|
|
1050
|
-
name;
|
|
1051
|
-
constructor(user, course, strategyData) {
|
|
1052
|
-
super(user, course, strategyData);
|
|
1053
|
-
this.name = strategyData?.name || "ELO";
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* Get new cards with suitability scores based on ELO distance.
|
|
1057
|
-
*
|
|
1058
|
-
* Cards closer to user's ELO get higher scores.
|
|
1059
|
-
* Score formula: max(0, 1 - distance / 500)
|
|
1060
|
-
*
|
|
1061
|
-
* NOTE: This generator only handles NEW cards. Reviews are handled by
|
|
1062
|
-
* SRSNavigator. Use CompositeGenerator to combine both.
|
|
1063
|
-
*
|
|
1064
|
-
* This method supports both the legacy signature (limit only) and the
|
|
1065
|
-
* CardGenerator interface signature (limit, context).
|
|
1066
|
-
*
|
|
1067
|
-
* @param limit - Maximum number of cards to return
|
|
1068
|
-
* @param context - Optional GeneratorContext (used when called via Pipeline)
|
|
1069
|
-
*/
|
|
1070
|
-
async getWeightedCards(limit, context) {
|
|
1071
|
-
let userGlobalElo;
|
|
1072
|
-
if (context?.userElo !== void 0) {
|
|
1073
|
-
userGlobalElo = context.userElo;
|
|
1074
|
-
} else {
|
|
1075
|
-
const courseReg = await this.user.getCourseRegDoc(this.course.getCourseID());
|
|
1076
|
-
const userElo = toCourseElo3(courseReg.elo);
|
|
1077
|
-
userGlobalElo = userElo.global.score;
|
|
1078
|
-
}
|
|
1079
|
-
const activeCards = await this.user.getActiveCards();
|
|
1080
|
-
const newCards = (await this.course.getCardsCenteredAtELO(
|
|
1081
|
-
{ limit, elo: "user" },
|
|
1082
|
-
(c) => !activeCards.some((ac) => c.cardID === ac.cardID)
|
|
1083
|
-
)).map((c) => ({ ...c, status: "new" }));
|
|
1084
|
-
const cardIds = newCards.map((c) => c.cardID);
|
|
1085
|
-
const cardEloData = await this.course.getCardEloData(cardIds);
|
|
1086
|
-
const scored = newCards.map((c, i) => {
|
|
1087
|
-
const cardElo = cardEloData[i]?.global?.score ?? 1e3;
|
|
1088
|
-
const distance = Math.abs(cardElo - userGlobalElo);
|
|
1089
|
-
const score = Math.max(0, 1 - distance / 500);
|
|
1090
|
-
return {
|
|
1091
|
-
cardId: c.cardID,
|
|
1092
|
-
courseId: c.courseID,
|
|
1093
|
-
score,
|
|
1094
|
-
provenance: [
|
|
1095
|
-
{
|
|
1096
|
-
strategy: "elo",
|
|
1097
|
-
strategyName: this.strategyName || this.name,
|
|
1098
|
-
strategyId: this.strategyId || "NAVIGATION_STRATEGY-ELO-default",
|
|
1099
|
-
action: "generated",
|
|
1100
|
-
score,
|
|
1101
|
-
reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userGlobalElo)}), new card`
|
|
1102
|
-
}
|
|
1103
|
-
]
|
|
1104
|
-
};
|
|
1105
|
-
});
|
|
1106
|
-
scored.sort((a, b) => b.score - a.score);
|
|
1107
|
-
return scored.slice(0, limit);
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
}
|
|
1111
|
-
});
|
|
1112
|
-
|
|
1113
|
-
// src/core/navigators/generators/srs.ts
|
|
1114
|
-
import moment3 from "moment";
|
|
1115
|
-
var SRSNavigator;
|
|
1116
|
-
var init_srs = __esm({
|
|
1117
|
-
"src/core/navigators/generators/srs.ts"() {
|
|
1118
|
-
"use strict";
|
|
1119
|
-
init_navigators();
|
|
1120
|
-
init_logger();
|
|
1121
|
-
SRSNavigator = class extends ContentNavigator {
|
|
1122
|
-
/** Human-readable name for CardGenerator interface */
|
|
1123
|
-
name;
|
|
1124
|
-
constructor(user, course, strategyData) {
|
|
1125
|
-
super(user, course, strategyData);
|
|
1126
|
-
this.name = strategyData?.name || "SRS";
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Get review cards scored by urgency.
|
|
1130
|
-
*
|
|
1131
|
-
* Score formula combines:
|
|
1132
|
-
* - Relative overdueness: hoursOverdue / intervalHours
|
|
1133
|
-
* - Interval recency: exponential decay favoring shorter intervals
|
|
1134
|
-
*
|
|
1135
|
-
* Cards not yet due are excluded (not scored as 0).
|
|
1136
|
-
*
|
|
1137
|
-
* This method supports both the legacy signature (limit only) and the
|
|
1138
|
-
* CardGenerator interface signature (limit, context).
|
|
1139
|
-
*
|
|
1140
|
-
* @param limit - Maximum number of cards to return
|
|
1141
|
-
* @param _context - Optional GeneratorContext (currently unused, but required for interface)
|
|
1142
|
-
*/
|
|
1143
|
-
async getWeightedCards(limit, _context) {
|
|
1144
|
-
if (!this.user || !this.course) {
|
|
1145
|
-
throw new Error("SRSNavigator requires user and course to be set");
|
|
1146
|
-
}
|
|
1147
|
-
const reviews = await this.user.getPendingReviews(this.course.getCourseID());
|
|
1148
|
-
const now = moment3.utc();
|
|
1149
|
-
const dueReviews = reviews.filter((r) => now.isAfter(moment3.utc(r.reviewTime)));
|
|
1150
|
-
const scored = dueReviews.map((review) => {
|
|
1151
|
-
const { score, reason } = this.computeUrgencyScore(review, now);
|
|
1152
|
-
return {
|
|
1153
|
-
cardId: review.cardId,
|
|
1154
|
-
courseId: review.courseId,
|
|
1155
|
-
score,
|
|
1156
|
-
reviewID: review._id,
|
|
1157
|
-
provenance: [
|
|
1158
|
-
{
|
|
1159
|
-
strategy: "srs",
|
|
1160
|
-
strategyName: this.strategyName || this.name,
|
|
1161
|
-
strategyId: this.strategyId || "NAVIGATION_STRATEGY-SRS-default",
|
|
1162
|
-
action: "generated",
|
|
1163
|
-
score,
|
|
1164
|
-
reason
|
|
1165
|
-
}
|
|
1166
|
-
]
|
|
1167
|
-
};
|
|
1168
|
-
});
|
|
1169
|
-
logger.debug(`[srsNav] got ${scored.length} weighted cards`);
|
|
1170
|
-
return scored.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
1171
|
-
}
|
|
1172
|
-
/**
|
|
1173
|
-
* Compute urgency score for a review card.
|
|
1174
|
-
*
|
|
1175
|
-
* Two factors:
|
|
1176
|
-
* 1. Relative overdueness = hoursOverdue / intervalHours
|
|
1177
|
-
* - 2 days overdue on 3-day interval = 0.67 (urgent)
|
|
1178
|
-
* - 2 days overdue on 180-day interval = 0.01 (not urgent)
|
|
1179
|
-
*
|
|
1180
|
-
* 2. Interval recency factor = 0.3 + 0.7 * exp(-intervalHours / 720)
|
|
1181
|
-
* - 24h interval → ~1.0 (very recent learning)
|
|
1182
|
-
* - 30 days (720h) → ~0.56
|
|
1183
|
-
* - 180 days → ~0.30
|
|
1184
|
-
*
|
|
1185
|
-
* Combined: base 0.5 + weighted average of factors * 0.45
|
|
1186
|
-
* Result range: approximately 0.5 to 0.95
|
|
1187
|
-
*/
|
|
1188
|
-
computeUrgencyScore(review, now) {
|
|
1189
|
-
const scheduledAt = moment3.utc(review.scheduledAt);
|
|
1190
|
-
const due = moment3.utc(review.reviewTime);
|
|
1191
|
-
const intervalHours = Math.max(1, due.diff(scheduledAt, "hours"));
|
|
1192
|
-
const hoursOverdue = now.diff(due, "hours");
|
|
1193
|
-
const relativeOverdue = hoursOverdue / intervalHours;
|
|
1194
|
-
const recencyFactor = 0.3 + 0.7 * Math.exp(-intervalHours / 720);
|
|
1195
|
-
const overdueContribution = Math.min(1, Math.max(0, relativeOverdue));
|
|
1196
|
-
const urgency = overdueContribution * 0.5 + recencyFactor * 0.5;
|
|
1197
|
-
const score = Math.min(0.95, 0.5 + urgency * 0.45);
|
|
1198
|
-
const reason = `${Math.round(hoursOverdue)}h overdue (interval: ${Math.round(intervalHours)}h, relative: ${relativeOverdue.toFixed(2)}), recency: ${recencyFactor.toFixed(2)}, review`;
|
|
1199
|
-
return { score, reason };
|
|
2141
|
+
const pipeline = new Pipeline(generator, filters, user, course);
|
|
2142
|
+
logger.debug(
|
|
2143
|
+
`[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
|
|
2144
|
+
);
|
|
2145
|
+
return {
|
|
2146
|
+
pipeline,
|
|
2147
|
+
generatorStrategies,
|
|
2148
|
+
filterStrategies: sortedFilterStrategies,
|
|
2149
|
+
warnings
|
|
2150
|
+
};
|
|
1200
2151
|
}
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
function computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier) {
|
|
1207
|
-
const normalizedDistance = distance / halfLife;
|
|
1208
|
-
const decay = Math.exp(-(normalizedDistance * normalizedDistance));
|
|
1209
|
-
return minMultiplier + (maxMultiplier - minMultiplier) * decay;
|
|
1210
|
-
}
|
|
1211
|
-
function createEloDistanceFilter(config) {
|
|
1212
|
-
const halfLife = config?.halfLife ?? DEFAULT_HALF_LIFE;
|
|
1213
|
-
const minMultiplier = config?.minMultiplier ?? DEFAULT_MIN_MULTIPLIER;
|
|
1214
|
-
const maxMultiplier = config?.maxMultiplier ?? DEFAULT_MAX_MULTIPLIER;
|
|
1215
|
-
return {
|
|
1216
|
-
name: "ELO Distance Filter",
|
|
1217
|
-
async transform(cards, context) {
|
|
1218
|
-
const { course, userElo } = context;
|
|
1219
|
-
const cardIds = cards.map((c) => c.cardId);
|
|
1220
|
-
const cardElos = await course.getCardEloData(cardIds);
|
|
1221
|
-
return cards.map((card, i) => {
|
|
1222
|
-
const cardElo = cardElos[i]?.global?.score ?? 1e3;
|
|
1223
|
-
const distance = Math.abs(cardElo - userElo);
|
|
1224
|
-
const multiplier = computeMultiplier(distance, halfLife, minMultiplier, maxMultiplier);
|
|
1225
|
-
const newScore = card.score * multiplier;
|
|
1226
|
-
const action = multiplier < maxMultiplier - 0.01 ? "penalized" : "passed";
|
|
2152
|
+
/**
|
|
2153
|
+
* Creates a default ELO generator strategy.
|
|
2154
|
+
* Used when filters are configured but no generator is specified.
|
|
2155
|
+
*/
|
|
2156
|
+
makeDefaultEloStrategy(courseId) {
|
|
1227
2157
|
return {
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
strategyId: "ELO_DISTANCE_FILTER",
|
|
1236
|
-
action,
|
|
1237
|
-
score: newScore,
|
|
1238
|
-
reason: `ELO distance ${Math.round(distance)} (card: ${Math.round(cardElo)}, user: ${Math.round(userElo)}) \u2192 ${multiplier.toFixed(2)}x`
|
|
1239
|
-
}
|
|
1240
|
-
]
|
|
2158
|
+
_id: "NAVIGATION_STRATEGY-ELO-default",
|
|
2159
|
+
course: courseId,
|
|
2160
|
+
docType: "NAVIGATION_STRATEGY" /* NAVIGATION_STRATEGY */,
|
|
2161
|
+
name: "ELO (default)",
|
|
2162
|
+
description: "Default ELO-based generator",
|
|
2163
|
+
implementingClass: "elo" /* ELO */,
|
|
2164
|
+
serializedData: ""
|
|
1241
2165
|
};
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
|
-
var DEFAULT_HALF_LIFE, DEFAULT_MIN_MULTIPLIER, DEFAULT_MAX_MULTIPLIER;
|
|
1247
|
-
var init_eloDistance = __esm({
|
|
1248
|
-
"src/core/navigators/filters/eloDistance.ts"() {
|
|
1249
|
-
"use strict";
|
|
1250
|
-
DEFAULT_HALF_LIFE = 200;
|
|
1251
|
-
DEFAULT_MIN_MULTIPLIER = 0.3;
|
|
1252
|
-
DEFAULT_MAX_MULTIPLIER = 1;
|
|
2166
|
+
}
|
|
2167
|
+
};
|
|
1253
2168
|
}
|
|
1254
2169
|
});
|
|
1255
2170
|
|
|
1256
2171
|
// src/core/navigators/defaults.ts
|
|
2172
|
+
var defaults_exports = {};
|
|
2173
|
+
__export(defaults_exports, {
|
|
2174
|
+
createDefaultEloStrategy: () => createDefaultEloStrategy,
|
|
2175
|
+
createDefaultPipeline: () => createDefaultPipeline,
|
|
2176
|
+
createDefaultSrsStrategy: () => createDefaultSrsStrategy
|
|
2177
|
+
});
|
|
1257
2178
|
function createDefaultEloStrategy(courseId) {
|
|
1258
2179
|
return {
|
|
1259
2180
|
_id: "NAVIGATION_STRATEGY-ELO-default",
|
|
@@ -1297,12 +2218,310 @@ var init_defaults = __esm({
|
|
|
1297
2218
|
}
|
|
1298
2219
|
});
|
|
1299
2220
|
|
|
2221
|
+
// import("./**/*") in src/core/navigators/index.ts
|
|
2222
|
+
var globImport;
|
|
2223
|
+
var init_3 = __esm({
|
|
2224
|
+
'import("./**/*") in src/core/navigators/index.ts'() {
|
|
2225
|
+
globImport = __glob({
|
|
2226
|
+
"./Pipeline.ts": () => Promise.resolve().then(() => (init_Pipeline(), Pipeline_exports)),
|
|
2227
|
+
"./PipelineAssembler.ts": () => Promise.resolve().then(() => (init_PipelineAssembler(), PipelineAssembler_exports)),
|
|
2228
|
+
"./defaults.ts": () => Promise.resolve().then(() => (init_defaults(), defaults_exports)),
|
|
2229
|
+
"./filters/WeightedFilter.ts": () => Promise.resolve().then(() => (init_WeightedFilter(), WeightedFilter_exports)),
|
|
2230
|
+
"./filters/eloDistance.ts": () => Promise.resolve().then(() => (init_eloDistance(), eloDistance_exports)),
|
|
2231
|
+
"./filters/hierarchyDefinition.ts": () => Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
|
|
2232
|
+
"./filters/index.ts": () => Promise.resolve().then(() => (init_filters(), filters_exports)),
|
|
2233
|
+
"./filters/inferredPreferenceStub.ts": () => Promise.resolve().then(() => (init_inferredPreferenceStub(), inferredPreferenceStub_exports)),
|
|
2234
|
+
"./filters/interferenceMitigator.ts": () => Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
|
|
2235
|
+
"./filters/relativePriority.ts": () => Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
|
|
2236
|
+
"./filters/types.ts": () => Promise.resolve().then(() => (init_types2(), types_exports2)),
|
|
2237
|
+
"./filters/userGoalStub.ts": () => Promise.resolve().then(() => (init_userGoalStub(), userGoalStub_exports)),
|
|
2238
|
+
"./filters/userTagPreference.ts": () => Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports)),
|
|
2239
|
+
"./generators/CompositeGenerator.ts": () => Promise.resolve().then(() => (init_CompositeGenerator(), CompositeGenerator_exports)),
|
|
2240
|
+
"./generators/elo.ts": () => Promise.resolve().then(() => (init_elo(), elo_exports)),
|
|
2241
|
+
"./generators/index.ts": () => Promise.resolve().then(() => (init_generators(), generators_exports)),
|
|
2242
|
+
"./generators/srs.ts": () => Promise.resolve().then(() => (init_srs(), srs_exports)),
|
|
2243
|
+
"./generators/types.ts": () => Promise.resolve().then(() => (init_types(), types_exports)),
|
|
2244
|
+
"./index.ts": () => Promise.resolve().then(() => (init_navigators(), navigators_exports))
|
|
2245
|
+
});
|
|
2246
|
+
}
|
|
2247
|
+
});
|
|
2248
|
+
|
|
2249
|
+
// src/core/navigators/index.ts
|
|
2250
|
+
var navigators_exports = {};
|
|
2251
|
+
__export(navigators_exports, {
|
|
2252
|
+
ContentNavigator: () => ContentNavigator,
|
|
2253
|
+
NavigatorRole: () => NavigatorRole,
|
|
2254
|
+
NavigatorRoles: () => NavigatorRoles,
|
|
2255
|
+
Navigators: () => Navigators,
|
|
2256
|
+
getCardOrigin: () => getCardOrigin,
|
|
2257
|
+
getRegisteredNavigator: () => getRegisteredNavigator,
|
|
2258
|
+
getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
|
|
2259
|
+
hasRegisteredNavigator: () => hasRegisteredNavigator,
|
|
2260
|
+
initializeNavigatorRegistry: () => initializeNavigatorRegistry,
|
|
2261
|
+
isFilter: () => isFilter,
|
|
2262
|
+
isGenerator: () => isGenerator,
|
|
2263
|
+
registerNavigator: () => registerNavigator
|
|
2264
|
+
});
|
|
2265
|
+
function registerNavigator(implementingClass, constructor) {
|
|
2266
|
+
navigatorRegistry.set(implementingClass, constructor);
|
|
2267
|
+
logger.debug(`[NavigatorRegistry] Registered: ${implementingClass}`);
|
|
2268
|
+
}
|
|
2269
|
+
function getRegisteredNavigator(implementingClass) {
|
|
2270
|
+
return navigatorRegistry.get(implementingClass);
|
|
2271
|
+
}
|
|
2272
|
+
function hasRegisteredNavigator(implementingClass) {
|
|
2273
|
+
return navigatorRegistry.has(implementingClass);
|
|
2274
|
+
}
|
|
2275
|
+
function getRegisteredNavigatorNames() {
|
|
2276
|
+
return Array.from(navigatorRegistry.keys());
|
|
2277
|
+
}
|
|
2278
|
+
async function initializeNavigatorRegistry() {
|
|
2279
|
+
logger.debug("[NavigatorRegistry] Initializing built-in navigators...");
|
|
2280
|
+
const [eloModule, srsModule] = await Promise.all([
|
|
2281
|
+
Promise.resolve().then(() => (init_elo(), elo_exports)),
|
|
2282
|
+
Promise.resolve().then(() => (init_srs(), srs_exports))
|
|
2283
|
+
]);
|
|
2284
|
+
registerNavigator("elo", eloModule.default);
|
|
2285
|
+
registerNavigator("srs", srsModule.default);
|
|
2286
|
+
const [
|
|
2287
|
+
hierarchyModule,
|
|
2288
|
+
interferenceModule,
|
|
2289
|
+
relativePriorityModule,
|
|
2290
|
+
userTagPreferenceModule
|
|
2291
|
+
] = await Promise.all([
|
|
2292
|
+
Promise.resolve().then(() => (init_hierarchyDefinition(), hierarchyDefinition_exports)),
|
|
2293
|
+
Promise.resolve().then(() => (init_interferenceMitigator(), interferenceMitigator_exports)),
|
|
2294
|
+
Promise.resolve().then(() => (init_relativePriority(), relativePriority_exports)),
|
|
2295
|
+
Promise.resolve().then(() => (init_userTagPreference(), userTagPreference_exports))
|
|
2296
|
+
]);
|
|
2297
|
+
registerNavigator("hierarchyDefinition", hierarchyModule.default);
|
|
2298
|
+
registerNavigator("interferenceMitigator", interferenceModule.default);
|
|
2299
|
+
registerNavigator("relativePriority", relativePriorityModule.default);
|
|
2300
|
+
registerNavigator("userTagPreference", userTagPreferenceModule.default);
|
|
2301
|
+
logger.debug(
|
|
2302
|
+
`[NavigatorRegistry] Initialized ${navigatorRegistry.size} navigators: ${getRegisteredNavigatorNames().join(", ")}`
|
|
2303
|
+
);
|
|
2304
|
+
}
|
|
2305
|
+
function getCardOrigin(card) {
|
|
2306
|
+
if (card.provenance.length === 0) {
|
|
2307
|
+
throw new Error("Card has no provenance - cannot determine origin");
|
|
2308
|
+
}
|
|
2309
|
+
const firstEntry = card.provenance[0];
|
|
2310
|
+
const reason = firstEntry.reason.toLowerCase();
|
|
2311
|
+
if (reason.includes("failed")) {
|
|
2312
|
+
return "failed";
|
|
2313
|
+
}
|
|
2314
|
+
if (reason.includes("review")) {
|
|
2315
|
+
return "review";
|
|
2316
|
+
}
|
|
2317
|
+
return "new";
|
|
2318
|
+
}
|
|
2319
|
+
function isGenerator(impl) {
|
|
2320
|
+
return NavigatorRoles[impl] === "generator" /* GENERATOR */;
|
|
2321
|
+
}
|
|
2322
|
+
function isFilter(impl) {
|
|
2323
|
+
return NavigatorRoles[impl] === "filter" /* FILTER */;
|
|
2324
|
+
}
|
|
2325
|
+
var navigatorRegistry, Navigators, NavigatorRole, NavigatorRoles, ContentNavigator;
|
|
2326
|
+
var init_navigators = __esm({
|
|
2327
|
+
"src/core/navigators/index.ts"() {
|
|
2328
|
+
"use strict";
|
|
2329
|
+
init_logger();
|
|
2330
|
+
init_();
|
|
2331
|
+
init_2();
|
|
2332
|
+
init_3();
|
|
2333
|
+
navigatorRegistry = /* @__PURE__ */ new Map();
|
|
2334
|
+
Navigators = /* @__PURE__ */ ((Navigators2) => {
|
|
2335
|
+
Navigators2["ELO"] = "elo";
|
|
2336
|
+
Navigators2["SRS"] = "srs";
|
|
2337
|
+
Navigators2["HIERARCHY"] = "hierarchyDefinition";
|
|
2338
|
+
Navigators2["INTERFERENCE"] = "interferenceMitigator";
|
|
2339
|
+
Navigators2["RELATIVE_PRIORITY"] = "relativePriority";
|
|
2340
|
+
Navigators2["USER_TAG_PREFERENCE"] = "userTagPreference";
|
|
2341
|
+
return Navigators2;
|
|
2342
|
+
})(Navigators || {});
|
|
2343
|
+
NavigatorRole = /* @__PURE__ */ ((NavigatorRole2) => {
|
|
2344
|
+
NavigatorRole2["GENERATOR"] = "generator";
|
|
2345
|
+
NavigatorRole2["FILTER"] = "filter";
|
|
2346
|
+
return NavigatorRole2;
|
|
2347
|
+
})(NavigatorRole || {});
|
|
2348
|
+
NavigatorRoles = {
|
|
2349
|
+
["elo" /* ELO */]: "generator" /* GENERATOR */,
|
|
2350
|
+
["srs" /* SRS */]: "generator" /* GENERATOR */,
|
|
2351
|
+
["hierarchyDefinition" /* HIERARCHY */]: "filter" /* FILTER */,
|
|
2352
|
+
["interferenceMitigator" /* INTERFERENCE */]: "filter" /* FILTER */,
|
|
2353
|
+
["relativePriority" /* RELATIVE_PRIORITY */]: "filter" /* FILTER */,
|
|
2354
|
+
["userTagPreference" /* USER_TAG_PREFERENCE */]: "filter" /* FILTER */
|
|
2355
|
+
};
|
|
2356
|
+
ContentNavigator = class {
|
|
2357
|
+
/** User interface for this navigation session */
|
|
2358
|
+
user;
|
|
2359
|
+
/** Course interface for this navigation session */
|
|
2360
|
+
course;
|
|
2361
|
+
/** Human-readable name for this strategy instance (from ContentNavigationStrategyData.name) */
|
|
2362
|
+
strategyName;
|
|
2363
|
+
/** Unique document ID for this strategy instance (from ContentNavigationStrategyData._id) */
|
|
2364
|
+
strategyId;
|
|
2365
|
+
/** Evolutionary weighting configuration */
|
|
2366
|
+
learnable;
|
|
2367
|
+
/** Whether to bypass deviation (manual/static weighting) */
|
|
2368
|
+
staticWeight;
|
|
2369
|
+
/**
|
|
2370
|
+
* Constructor for standard navigators.
|
|
2371
|
+
* Call this from subclass constructors to initialize common fields.
|
|
2372
|
+
*
|
|
2373
|
+
* Note: CompositeGenerator and Pipeline call super() without args, then set
|
|
2374
|
+
* user/course fields directly if needed.
|
|
2375
|
+
*/
|
|
2376
|
+
constructor(user, course, strategyData) {
|
|
2377
|
+
this.user = user;
|
|
2378
|
+
this.course = course;
|
|
2379
|
+
if (strategyData) {
|
|
2380
|
+
this.strategyName = strategyData.name;
|
|
2381
|
+
this.strategyId = strategyData._id;
|
|
2382
|
+
this.learnable = strategyData.learnable;
|
|
2383
|
+
this.staticWeight = strategyData.staticWeight;
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
// ============================================================================
|
|
2387
|
+
// STRATEGY STATE HELPERS
|
|
2388
|
+
// ============================================================================
|
|
2389
|
+
//
|
|
2390
|
+
// These methods allow strategies to persist their own state (user preferences,
|
|
2391
|
+
// learned patterns, temporal tracking) in the user database.
|
|
2392
|
+
//
|
|
2393
|
+
// ============================================================================
|
|
2394
|
+
/**
|
|
2395
|
+
* Unique key identifying this strategy for state storage.
|
|
2396
|
+
*
|
|
2397
|
+
* Defaults to the constructor name (e.g., "UserTagPreferenceFilter").
|
|
2398
|
+
* Override in subclasses if multiple instances of the same strategy type
|
|
2399
|
+
* need separate state storage.
|
|
2400
|
+
*/
|
|
2401
|
+
get strategyKey() {
|
|
2402
|
+
return this.constructor.name;
|
|
2403
|
+
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Get this strategy's persisted state for the current course.
|
|
2406
|
+
*
|
|
2407
|
+
* @returns The strategy's data payload, or null if no state exists
|
|
2408
|
+
* @throws Error if user or course is not initialized
|
|
2409
|
+
*/
|
|
2410
|
+
async getStrategyState() {
|
|
2411
|
+
if (!this.user || !this.course) {
|
|
2412
|
+
throw new Error(
|
|
2413
|
+
`Cannot get strategy state: navigator not properly initialized. Ensure user and course are provided to constructor.`
|
|
2414
|
+
);
|
|
2415
|
+
}
|
|
2416
|
+
return this.user.getStrategyState(this.course.getCourseID(), this.strategyKey);
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* Persist this strategy's state for the current course.
|
|
2420
|
+
*
|
|
2421
|
+
* @param data - The strategy's data payload to store
|
|
2422
|
+
* @throws Error if user or course is not initialized
|
|
2423
|
+
*/
|
|
2424
|
+
async putStrategyState(data) {
|
|
2425
|
+
if (!this.user || !this.course) {
|
|
2426
|
+
throw new Error(
|
|
2427
|
+
`Cannot put strategy state: navigator not properly initialized. Ensure user and course are provided to constructor.`
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
return this.user.putStrategyState(this.course.getCourseID(), this.strategyKey, data);
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Factory method to create navigator instances.
|
|
2434
|
+
*
|
|
2435
|
+
* First checks the navigator registry for a pre-registered constructor.
|
|
2436
|
+
* If not found, falls back to dynamic import (for custom navigators).
|
|
2437
|
+
*
|
|
2438
|
+
* For reliable operation in test environments, call initializeNavigatorRegistry()
|
|
2439
|
+
* before using this method.
|
|
2440
|
+
*
|
|
2441
|
+
* @param user - User interface
|
|
2442
|
+
* @param course - Course interface
|
|
2443
|
+
* @param strategyData - Strategy configuration document
|
|
2444
|
+
* @returns the runtime object used to steer a study session.
|
|
2445
|
+
*/
|
|
2446
|
+
static async create(user, course, strategyData) {
|
|
2447
|
+
const implementingClass = strategyData.implementingClass;
|
|
2448
|
+
const RegisteredImpl = getRegisteredNavigator(implementingClass);
|
|
2449
|
+
if (RegisteredImpl) {
|
|
2450
|
+
logger.debug(`[ContentNavigator.create] Using registered navigator: ${implementingClass}`);
|
|
2451
|
+
return new RegisteredImpl(user, course, strategyData);
|
|
2452
|
+
}
|
|
2453
|
+
logger.debug(
|
|
2454
|
+
`[ContentNavigator.create] Navigator not in registry, attempting dynamic import: ${implementingClass}`
|
|
2455
|
+
);
|
|
2456
|
+
let NavigatorImpl;
|
|
2457
|
+
const variations = [".ts", ".js", ""];
|
|
2458
|
+
for (const ext of variations) {
|
|
2459
|
+
try {
|
|
2460
|
+
const module = await globImport_generators(`./generators/${implementingClass}${ext}`);
|
|
2461
|
+
NavigatorImpl = module.default;
|
|
2462
|
+
if (NavigatorImpl) break;
|
|
2463
|
+
} catch (e) {
|
|
2464
|
+
logger.debug(`Failed to load generator ${implementingClass}${ext}:`, e);
|
|
2465
|
+
}
|
|
2466
|
+
try {
|
|
2467
|
+
const module = await globImport_filters(`./filters/${implementingClass}${ext}`);
|
|
2468
|
+
NavigatorImpl = module.default;
|
|
2469
|
+
if (NavigatorImpl) break;
|
|
2470
|
+
} catch (e) {
|
|
2471
|
+
logger.debug(`Failed to load filter ${implementingClass}${ext}:`, e);
|
|
2472
|
+
}
|
|
2473
|
+
try {
|
|
2474
|
+
const module = await globImport(`./${implementingClass}${ext}`);
|
|
2475
|
+
NavigatorImpl = module.default;
|
|
2476
|
+
if (NavigatorImpl) break;
|
|
2477
|
+
} catch (e) {
|
|
2478
|
+
logger.debug(`Failed to load legacy ${implementingClass}${ext}:`, e);
|
|
2479
|
+
}
|
|
2480
|
+
if (NavigatorImpl) break;
|
|
2481
|
+
}
|
|
2482
|
+
if (!NavigatorImpl) {
|
|
2483
|
+
throw new Error(`Could not load navigator implementation for: ${implementingClass}`);
|
|
2484
|
+
}
|
|
2485
|
+
return new NavigatorImpl(user, course, strategyData);
|
|
2486
|
+
}
|
|
2487
|
+
/**
|
|
2488
|
+
* Get cards with suitability scores and provenance trails.
|
|
2489
|
+
*
|
|
2490
|
+
* **This is the PRIMARY API for navigation strategies.**
|
|
2491
|
+
*
|
|
2492
|
+
* Returns cards ranked by suitability score (0-1). Higher scores indicate
|
|
2493
|
+
* better candidates for presentation. Each card includes a provenance trail
|
|
2494
|
+
* documenting how strategies contributed to the final score.
|
|
2495
|
+
*
|
|
2496
|
+
* ## Implementation Required
|
|
2497
|
+
* All navigation strategies MUST override this method. The base class does
|
|
2498
|
+
* not provide a default implementation.
|
|
2499
|
+
*
|
|
2500
|
+
* ## For Generators
|
|
2501
|
+
* Override this method to generate candidates and compute scores based on
|
|
2502
|
+
* your strategy's logic (e.g., ELO proximity, review urgency). Create the
|
|
2503
|
+
* initial provenance entry with action='generated'.
|
|
2504
|
+
*
|
|
2505
|
+
* ## For Filters
|
|
2506
|
+
* Filters should implement the CardFilter interface instead and be composed
|
|
2507
|
+
* via Pipeline. Filters do not directly implement getWeightedCards().
|
|
2508
|
+
*
|
|
2509
|
+
* @param limit - Maximum cards to return
|
|
2510
|
+
* @returns Cards sorted by score descending, with provenance trails
|
|
2511
|
+
*/
|
|
2512
|
+
async getWeightedCards(_limit) {
|
|
2513
|
+
throw new Error(`${this.constructor.name} must implement getWeightedCards(). `);
|
|
2514
|
+
}
|
|
2515
|
+
};
|
|
2516
|
+
}
|
|
2517
|
+
});
|
|
2518
|
+
|
|
1300
2519
|
// src/impl/couch/courseDB.ts
|
|
1301
2520
|
import {
|
|
1302
2521
|
EloToNumber,
|
|
1303
2522
|
Status,
|
|
1304
2523
|
blankCourseElo as blankCourseElo2,
|
|
1305
|
-
toCourseElo as
|
|
2524
|
+
toCourseElo as toCourseElo6
|
|
1306
2525
|
} from "@vue-skuilder/common";
|
|
1307
2526
|
var init_courseDB = __esm({
|
|
1308
2527
|
"src/impl/couch/courseDB.ts"() {
|
|
@@ -2445,6 +3664,19 @@ Currently logged-in as ${this._username}.`
|
|
|
2445
3664
|
};
|
|
2446
3665
|
await this.localDB.put(doc);
|
|
2447
3666
|
}
|
|
3667
|
+
async putUserOutcome(record) {
|
|
3668
|
+
try {
|
|
3669
|
+
await this.localDB.put(record);
|
|
3670
|
+
} catch (err) {
|
|
3671
|
+
if (err.status === 409) {
|
|
3672
|
+
const existing = await this.localDB.get(record._id);
|
|
3673
|
+
record._rev = existing._rev;
|
|
3674
|
+
await this.localDB.put(record);
|
|
3675
|
+
} else {
|
|
3676
|
+
throw err;
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
}
|
|
2448
3680
|
async deleteStrategyState(courseId, strategyKey) {
|
|
2449
3681
|
const docId = buildStrategyStateId(courseId, strategyKey);
|
|
2450
3682
|
try {
|
|
@@ -2481,6 +3713,7 @@ var init_factory = __esm({
|
|
|
2481
3713
|
"use strict";
|
|
2482
3714
|
init_common();
|
|
2483
3715
|
init_logger();
|
|
3716
|
+
init_navigators();
|
|
2484
3717
|
NOT_SET = "NOT_SET";
|
|
2485
3718
|
ENV = {
|
|
2486
3719
|
COUCHDB_SERVER_PROTOCOL: NOT_SET,
|
|
@@ -2562,6 +3795,13 @@ var init_strategyState = __esm({
|
|
|
2562
3795
|
}
|
|
2563
3796
|
});
|
|
2564
3797
|
|
|
3798
|
+
// src/core/types/userOutcome.ts
|
|
3799
|
+
var init_userOutcome = __esm({
|
|
3800
|
+
"src/core/types/userOutcome.ts"() {
|
|
3801
|
+
"use strict";
|
|
3802
|
+
}
|
|
3803
|
+
});
|
|
3804
|
+
|
|
2565
3805
|
// src/core/bulkImport/cardProcessor.ts
|
|
2566
3806
|
import { Status as Status4 } from "@vue-skuilder/common";
|
|
2567
3807
|
var init_cardProcessor = __esm({
|
|
@@ -2572,7 +3812,7 @@ var init_cardProcessor = __esm({
|
|
|
2572
3812
|
});
|
|
2573
3813
|
|
|
2574
3814
|
// src/core/bulkImport/types.ts
|
|
2575
|
-
var
|
|
3815
|
+
var init_types3 = __esm({
|
|
2576
3816
|
"src/core/bulkImport/types.ts"() {
|
|
2577
3817
|
"use strict";
|
|
2578
3818
|
}
|
|
@@ -2583,7 +3823,7 @@ var init_bulkImport = __esm({
|
|
|
2583
3823
|
"src/core/bulkImport/index.ts"() {
|
|
2584
3824
|
"use strict";
|
|
2585
3825
|
init_cardProcessor();
|
|
2586
|
-
|
|
3826
|
+
init_types3();
|
|
2587
3827
|
}
|
|
2588
3828
|
});
|
|
2589
3829
|
|
|
@@ -2595,10 +3835,12 @@ var init_core = __esm({
|
|
|
2595
3835
|
init_types_legacy();
|
|
2596
3836
|
init_user();
|
|
2597
3837
|
init_strategyState();
|
|
3838
|
+
init_userOutcome();
|
|
2598
3839
|
init_Loggable();
|
|
2599
3840
|
init_util();
|
|
2600
3841
|
init_navigators();
|
|
2601
3842
|
init_bulkImport();
|
|
3843
|
+
init_orchestration();
|
|
2602
3844
|
}
|
|
2603
3845
|
});
|
|
2604
3846
|
|