@vue-skuilder/db 0.1.40 → 0.2.1

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/index.mjs CHANGED
@@ -9814,9 +9814,14 @@ var init_UserDBDebugger = __esm({
9814
9814
  */
9815
9815
  async showScheduledReviews(courseId) {
9816
9816
  const userDB = getUserDB();
9817
- if (!userDB) return;
9817
+ if (!userDB) {
9818
+ logger.info("[UserDB Debug] Data layer not available");
9819
+ return;
9820
+ }
9821
+ logger.info(`[UserDB Debug] Fetching pending reviews${courseId ? ` for course: ${courseId}` : ""}...`);
9818
9822
  try {
9819
9823
  const reviews = await userDB.getPendingReviews(courseId);
9824
+ logger.info(`[UserDB Debug] Got ${reviews.length} reviews`);
9820
9825
  console.group(`\u{1F4C5} Scheduled Reviews${courseId ? ` (${courseId})` : ""}`);
9821
9826
  logger.info(`Total: ${reviews.length}`);
9822
9827
  if (reviews.length > 0) {
@@ -13594,6 +13599,19 @@ var SessionController = class _SessionController extends Loggable {
13594
13599
  * know or care which strategy assigned the score.
13595
13600
  */
13596
13601
  static WELL_INDICATED_SCORE = 0.1;
13602
+ /**
13603
+ * newQ length at or below which the opportunistic depletion-prefetch
13604
+ * fires. Sets the lead time available for the background replan to land
13605
+ * before the user actually empties the queue and falls into the
13606
+ * (synchronous) wedge-breaker path.
13607
+ *
13608
+ * Set to a small absolute value (not a fraction of batch limit) because
13609
+ * pipeline latency is roughly fixed regardless of batch size — what
13610
+ * matters is "how many cards of user-pace do we have left." 3 cards
13611
+ * × ~3-5s/card = ~10-15s of lead time, comfortably exceeding typical
13612
+ * pipeline latency.
13613
+ */
13614
+ static DEPLETION_PREFETCH_THRESHOLD = 3;
13597
13615
  /**
13598
13616
  * Internal replan execution. Runs the pipeline, builds a new newQ,
13599
13617
  * atomically swaps it in, and triggers hydration for the new contents.
@@ -13900,7 +13918,7 @@ var SessionController = class _SessionController extends Loggable {
13900
13918
  this.log("nextCard: queues empty, awaiting in-flight replan before drawing");
13901
13919
  await this._replanPromise;
13902
13920
  }
13903
- if (this.newQ.length <= 1 && this._secondsRemaining > 0 && !this._replanPromise) {
13921
+ if (this.newQ.length <= _SessionController.DEPLETION_PREFETCH_THRESHOLD && this._secondsRemaining > 0 && !this._replanPromise) {
13904
13922
  this._suppressQualityReplan = false;
13905
13923
  const otherContent = this.reviewQ.length + this.failedQ.length;
13906
13924
  this.log(