@vue-skuilder/db 0.2.11 → 0.2.13
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/core/index.d.cts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +27 -17
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +27 -17
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.js +35 -17
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +35 -17
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.js +27 -17
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +27 -17
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +47 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/navigators/SrsDebugger.ts +8 -7
- package/src/core/navigators/generators/srs.ts +40 -28
- package/src/impl/common/BaseUserDB.ts +13 -0
- package/src/impl/couch/CouchDBSyncStrategy.ts +17 -0
- package/src/study/SessionController.ts +5 -1
- package/src/study/SessionDebugger.ts +16 -8
- package/src/study/SessionOverlay.ts +17 -23
|
@@ -2668,7 +2668,7 @@ __export(srs_exports, {
|
|
|
2668
2668
|
default: () => SRSNavigator
|
|
2669
2669
|
});
|
|
2670
2670
|
import moment from "moment";
|
|
2671
|
-
var DEFAULT_HEALTHY_BACKLOG,
|
|
2671
|
+
var DEFAULT_HEALTHY_BACKLOG, BACKLOG_GROWTH_RATE, SRSNavigator;
|
|
2672
2672
|
var init_srs = __esm({
|
|
2673
2673
|
"src/core/navigators/generators/srs.ts"() {
|
|
2674
2674
|
"use strict";
|
|
@@ -2676,7 +2676,7 @@ var init_srs = __esm({
|
|
|
2676
2676
|
init_SrsDebugger();
|
|
2677
2677
|
init_logger();
|
|
2678
2678
|
DEFAULT_HEALTHY_BACKLOG = 20;
|
|
2679
|
-
|
|
2679
|
+
BACKLOG_GROWTH_RATE = 2;
|
|
2680
2680
|
SRSNavigator = class extends ContentNavigator {
|
|
2681
2681
|
/** Human-readable name for CardGenerator interface */
|
|
2682
2682
|
name;
|
|
@@ -2798,7 +2798,7 @@ var init_srs = __esm({
|
|
|
2798
2798
|
dueNow: dueReviews.length,
|
|
2799
2799
|
healthyBacklog: this.healthyBacklog,
|
|
2800
2800
|
backlogMultiplier,
|
|
2801
|
-
|
|
2801
|
+
backlogGrowthRate: BACKLOG_GROWTH_RATE,
|
|
2802
2802
|
topReviewScore: sorted.length > 0 ? sorted[0].score : null,
|
|
2803
2803
|
nextDueIn,
|
|
2804
2804
|
timestamp: Date.now()
|
|
@@ -2808,25 +2808,30 @@ var init_srs = __esm({
|
|
|
2808
2808
|
/**
|
|
2809
2809
|
* Compute the multiplicative backlog pressure based on number of due reviews.
|
|
2810
2810
|
*
|
|
2811
|
-
* ×1.0 at or below the healthy threshold (no boost),
|
|
2812
|
-
*
|
|
2811
|
+
* ×1.0 at or below the healthy threshold (no boost); above it, grows as
|
|
2812
|
+
* BACKLOG_GROWTH_RATE raised to the excess expressed in multiples of the
|
|
2813
|
+
* healthy threshold. Uncapped — self-regulating instead: reviews winning
|
|
2814
|
+
* slots depletes dueCount, which drops the ratio and relaxes the multiplier
|
|
2815
|
+
* next run.
|
|
2813
2816
|
*
|
|
2814
|
-
* Examples (with default healthyBacklog=20,
|
|
2815
|
-
* - 10 due reviews → ×1.00
|
|
2816
|
-
* - 20 due reviews → ×1.00
|
|
2817
|
-
* - 40 due reviews → ×1.50
|
|
2818
|
-
* - 60 due reviews → ×2.
|
|
2817
|
+
* Examples (with default healthyBacklog=20, BACKLOG_GROWTH_RATE=1.5):
|
|
2818
|
+
* - 10 due reviews → ×1.00 (healthy)
|
|
2819
|
+
* - 20 due reviews → ×1.00 (at threshold, ratio 0)
|
|
2820
|
+
* - 40 due reviews → ×1.50 (ratio 1, 2x threshold)
|
|
2821
|
+
* - 60 due reviews → ×2.25 (ratio 2, 3x threshold — old hard cap was ×2.00 here)
|
|
2822
|
+
* - 100 due reviews → ×5.06 (ratio 4, 5x threshold)
|
|
2823
|
+
* - 160 due reviews → ×17.09 (ratio 7, 8x threshold)
|
|
2819
2824
|
*
|
|
2820
2825
|
* @param dueCount - Number of reviews currently due
|
|
2821
|
-
* @returns Multiplier applied to review urgency (1.0
|
|
2826
|
+
* @returns Multiplier applied to review urgency (>= 1.0, unbounded)
|
|
2822
2827
|
*/
|
|
2823
2828
|
computeBacklogMultiplier(dueCount) {
|
|
2824
2829
|
if (dueCount <= this.healthyBacklog) {
|
|
2825
2830
|
return 1;
|
|
2826
2831
|
}
|
|
2827
2832
|
const excess = dueCount - this.healthyBacklog;
|
|
2828
|
-
const
|
|
2829
|
-
return Math.
|
|
2833
|
+
const ratio = excess / this.healthyBacklog;
|
|
2834
|
+
return Math.pow(BACKLOG_GROWTH_RATE, ratio);
|
|
2830
2835
|
}
|
|
2831
2836
|
/**
|
|
2832
2837
|
* Compute urgency score for a review card.
|
|
@@ -2842,17 +2847,17 @@ var init_srs = __esm({
|
|
|
2842
2847
|
* - 180 days → ~0.30
|
|
2843
2848
|
*
|
|
2844
2849
|
* 3. Backlog pressure = global *multiplier* when review backlog exceeds the
|
|
2845
|
-
* healthy threshold (×1.0 healthy →
|
|
2850
|
+
* healthy threshold (×1.0 healthy → exponential growth, uncapped, above it).
|
|
2846
2851
|
*
|
|
2847
2852
|
* Combined: (base 0.5 + urgency factors * 0.45) × backlog multiplier.
|
|
2848
2853
|
* Per-card range before pressure: ~0.57–0.95. NOT clamped to 1.0 — under a
|
|
2849
2854
|
* heavy backlog reviews scale onto the open scale to compete with (and exceed)
|
|
2850
|
-
* new cards;
|
|
2851
|
-
*
|
|
2855
|
+
* new cards; there's no ceiling at all now, so a bad enough backlog always
|
|
2856
|
+
* wins eventually — self-regulating because winning slots depletes dueCount.
|
|
2852
2857
|
*
|
|
2853
2858
|
* @param review - The scheduled card to score
|
|
2854
2859
|
* @param now - Current time
|
|
2855
|
-
* @param backlogMultiplier - Pre-computed backlog multiplier (1.0
|
|
2860
|
+
* @param backlogMultiplier - Pre-computed backlog multiplier (>= 1.0, unbounded)
|
|
2856
2861
|
*/
|
|
2857
2862
|
computeUrgencyScore(review, now, backlogMultiplier) {
|
|
2858
2863
|
const scheduledAt = moment.utc(review.scheduledAt);
|
|
@@ -7499,6 +7504,11 @@ Currently logged-in as ${this._username}.`
|
|
|
7499
7504
|
return { ok: true };
|
|
7500
7505
|
}
|
|
7501
7506
|
const ret = await this.syncStrategy.logout();
|
|
7507
|
+
try {
|
|
7508
|
+
localStorage.removeItem("sk-guest-uuid");
|
|
7509
|
+
} catch (e) {
|
|
7510
|
+
logger.warn("localStorage not available (Node.js environment):", e);
|
|
7511
|
+
}
|
|
7502
7512
|
this._username = await this.syncStrategy.getCurrentUsername();
|
|
7503
7513
|
await this.init();
|
|
7504
7514
|
return ret;
|
|
@@ -8873,6 +8883,14 @@ var init_CouchDBSyncStrategy = __esm({
|
|
|
8873
8883
|
} else {
|
|
8874
8884
|
logger.info("No documents to migrate from funnel account");
|
|
8875
8885
|
}
|
|
8886
|
+
try {
|
|
8887
|
+
await oldLocalDB.destroy();
|
|
8888
|
+
logger.info(`Destroyed consumed guest DB for ${oldUsername}`);
|
|
8889
|
+
} catch (destroyErr) {
|
|
8890
|
+
logger.warn(
|
|
8891
|
+
`Failed to destroy consumed guest DB for ${oldUsername} (non-fatal): ${destroyErr instanceof Error ? destroyErr.message : String(destroyErr)}`
|
|
8892
|
+
);
|
|
8893
|
+
}
|
|
8876
8894
|
return { success: true };
|
|
8877
8895
|
} catch (error) {
|
|
8878
8896
|
logger.error("Migration failed:", error);
|