@vue-skuilder/db 0.2.27 → 0.2.29

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.
Files changed (82) hide show
  1. package/dist/classroomDB-DLTtLZct.d.cts +86 -0
  2. package/dist/classroomDB-DLTtLZct.d.ts +86 -0
  3. package/dist/{contentSource-LPf044hY.d.ts → contentSource-B6FrSihy.d.cts} +282 -99
  4. package/dist/{contentSource-D3c1fMAk.d.cts → contentSource-CqJmbOZN.d.ts} +282 -99
  5. package/dist/core/index.d.cts +16 -92
  6. package/dist/core/index.d.ts +16 -92
  7. package/dist/core/index.js +607 -179
  8. package/dist/core/index.js.map +1 -1
  9. package/dist/core/index.mjs +606 -179
  10. package/dist/core/index.mjs.map +1 -1
  11. package/dist/{dataLayerProvider-DaAootVV.d.ts → dataLayerProvider-B9_UCvkR.d.ts} +2 -8
  12. package/dist/{dataLayerProvider-CeLiFbHv.d.cts → dataLayerProvider-DUxDqMtZ.d.cts} +2 -8
  13. package/dist/diagnostics/index.d.cts +443 -0
  14. package/dist/diagnostics/index.d.ts +443 -0
  15. package/dist/diagnostics/index.js +932 -0
  16. package/dist/diagnostics/index.js.map +1 -0
  17. package/dist/diagnostics/index.mjs +881 -0
  18. package/dist/diagnostics/index.mjs.map +1 -0
  19. package/dist/impl/couch/index.d.cts +13 -3
  20. package/dist/impl/couch/index.d.ts +13 -3
  21. package/dist/impl/couch/index.js +605 -179
  22. package/dist/impl/couch/index.js.map +1 -1
  23. package/dist/impl/couch/index.mjs +605 -179
  24. package/dist/impl/couch/index.mjs.map +1 -1
  25. package/dist/impl/static/index.d.cts +11 -5
  26. package/dist/impl/static/index.d.ts +11 -5
  27. package/dist/impl/static/index.js +602 -185
  28. package/dist/impl/static/index.js.map +1 -1
  29. package/dist/impl/static/index.mjs +602 -185
  30. package/dist/impl/static/index.mjs.map +1 -1
  31. package/dist/{index-BkBJlGDX.d.ts → index-CVGehe_t.d.ts} +1 -1
  32. package/dist/{index-D7WdMDAs.d.cts → index-Ktg72jKb.d.cts} +1 -1
  33. package/dist/index.d.cts +73 -11
  34. package/dist/index.d.ts +73 -11
  35. package/dist/index.js +696 -200
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +683 -200
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/{types-DjiFOZxJ.d.cts → types-D0oQeJAi.d.cts} +1 -1
  40. package/dist/{types-uJ2Xn3_X.d.ts → types-dXWfyz9B.d.ts} +1 -1
  41. package/dist/{types-legacy-CrwyZIvI.d.cts → types-legacy-BkOYOR6U.d.cts} +1 -1
  42. package/dist/{types-legacy-CrwyZIvI.d.ts → types-legacy-BkOYOR6U.d.ts} +1 -1
  43. package/dist/util/packer/index.d.cts +3 -3
  44. package/dist/util/packer/index.d.ts +3 -3
  45. package/package.json +15 -3
  46. package/src/core/interfaces/contentSource.ts +7 -0
  47. package/src/core/interfaces/dataLayerProvider.ts +3 -8
  48. package/src/core/navigators/Pipeline.ts +149 -14
  49. package/src/core/navigators/PipelineAssembler.ts +19 -40
  50. package/src/core/navigators/PipelineDebugger.ts +74 -17
  51. package/src/core/navigators/SrsDebugger.ts +37 -12
  52. package/src/core/navigators/defaults.ts +29 -5
  53. package/src/core/navigators/filters/WeightedFilter.ts +5 -1
  54. package/src/core/navigators/filters/eloDistance.ts +261 -76
  55. package/src/core/navigators/filters/hierarchyDefinition.ts +5 -1
  56. package/src/core/navigators/filters/index.ts +2 -2
  57. package/src/core/navigators/filters/interferenceMitigator.ts +5 -1
  58. package/src/core/navigators/filters/relativePriority.ts +5 -1
  59. package/src/core/navigators/filters/types.ts +24 -1
  60. package/src/core/navigators/filters/userTagPreference.ts +5 -1
  61. package/src/core/navigators/generators/elo.ts +23 -53
  62. package/src/core/navigators/generators/srs.ts +27 -124
  63. package/src/core/navigators/index.ts +32 -5
  64. package/src/core/navigators/pipelinePlan.ts +245 -0
  65. package/src/core/navigators/regulators.ts +230 -0
  66. package/src/core/types/studySession.ts +40 -0
  67. package/src/diagnostics/dataset.ts +242 -0
  68. package/src/diagnostics/derive.ts +555 -0
  69. package/src/diagnostics/index.ts +27 -0
  70. package/src/diagnostics/loader.ts +194 -0
  71. package/src/diagnostics/pipeline.ts +236 -0
  72. package/src/diagnostics/text.ts +265 -0
  73. package/src/impl/couch/PouchDataLayerProvider.ts +0 -23
  74. package/src/impl/couch/courseDB.ts +13 -0
  75. package/src/impl/static/StaticDataLayerProvider.ts +0 -11
  76. package/src/impl/static/courseDB.ts +9 -0
  77. package/src/index.ts +4 -0
  78. package/src/study/SessionController.ts +76 -2
  79. package/src/study/SessionOverlay.ts +7 -4
  80. package/tests/core/navigators/PipelineAssembler.test.ts +20 -5
  81. package/tests/core/navigators/eloDistanceFilter.test.ts +9 -9
  82. package/tsup.config.ts +1 -0
@@ -1,8 +1,9 @@
1
- import { as as LearnableWeight, O as UserOutcomeRecord, at as OrchestrationContext, W as WeightedCard, U as UserDBInterface, C as CourseDBInterface } from '../contentSource-LPf044hY.js';
2
- export { M as ActivityRecord, A as AdminDBInterface, x as AssignedCard, g as AssignedContent, w as AssignedCourse, v as AssignedTag, af as CardGenerator, ah as CardGeneratorFactory, c as ClassroomDBInterface, I as ClassroomRegistration, H as ClassroomRegistrationDesignation, J as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, N as CourseRegistration, s as CourseRegistrationDoc, b as CoursesDBInterface, aq as FilterImpact, ag as GeneratorContext, G as GeneratorResult, ap as GeneratorSummary, $ as HYDRATION_MARKER_ID, a0 as HydrationMarker, a1 as NavigatorConstructor, ab as NavigatorRole, ac as NavigatorRoles, aa as Navigators, ar as PipelineForecaster, ao as PipelineRunReport, R as ReplanHints, j as ScheduledCard, t as SessionEloEvent, V as SessionStateSnapshot, u as SessionStateSnapshotProvider, K as SessionTrackingData, a8 as StrategyContribution, i as StudentClassroomDBInterface, h as StudyContentSource, P as StudySessionDoc, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionItem, n as StudySessionNewItem, o as StudySessionReviewItem, Q as StudySessionRunSummary, T as TeacherClassroomDBInterface, L as UserConfig, E as UserCourseSetting, B as UserCourseSettings, z as UserDBAuthenticator, a as UserDBReader, y as UserDBWriter, Z as UserHydrationState, _ as UserHydrationStatus, F as UsrCrsDataInterface, au as computeDeviation, aw as computeEffectiveWeight, av as computeSpread, ax as createOrchestrationContext, an as drainCapturedRuns, ak as getActivePipeline, a9 as getCardOrigin, a3 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a5 as getRegisteredNavigatorRole, am as getRunsForSession, r as getStudySource, a4 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, ae as isFilter, ad as isGenerator, p as isReview, X as makeStudySessionId, aj as mountPipelineDebugger, Y as newSessionId, ai as pipelineDebugAPI, a2 as registerNavigator, al as setDebugSessionId } from '../contentSource-LPf044hY.js';
3
- export { D as DataLayerProvider } from '../dataLayerProvider-DaAootVV.js';
4
- import { D as DocType, c as QuestionRecord, i as DocTypePrefixes, C as CardHistory, b as CardRecord } from '../types-legacy-CrwyZIvI.js';
5
- export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from '../types-legacy-CrwyZIvI.js';
1
+ export { A as AdminDBInterface, d as AssignedCard, a as AssignedContent, c as AssignedCourse, b as AssignedTag, C as ClassroomDBInterface, S as StudentClassroomDBInterface, T as TeacherClassroomDBInterface } from '../classroomDB-DLTtLZct.js';
2
+ import { av as LearnableWeight, T as UserOutcomeRecord, aw as OrchestrationContext, W as WeightedCard, C as CourseDBInterface } from '../contentSource-CqJmbOZN.js';
3
+ export { P as ActivityRecord, ae as CardFilter, ag as CardFilterFactory, ah as CardGenerator, aj as CardGeneratorFactory, K as ClassroomRegistration, J as ClassroomRegistrationDesignation, L as ClassroomRegistrationDoc, b as ContentNavigationStrategyData, m as ContentNavigator, v as ContentSourceID, k as CourseInfo, Q as CourseRegistration, d as CourseRegistrationDoc, a as CoursesDBInterface, af as FilterContext, at as FilterImpact, F as FilterKind, ai as GeneratorContext, G as GeneratorResult, as as GeneratorSummary, _ as HYDRATION_MARKER_ID, $ as HydrationMarker, a0 as NavigatorConstructor, N as NavigatorRole, ab as NavigatorRoles, aa as Navigators, au as PipelineForecaster, aq as PipelineRunReport, n as ReplanHints, ar as RunReportCard, c as ScheduledCard, h as SessionEloEvent, e as SessionStateSnapshot, x as SessionStateSnapshotProvider, M as SessionTrackingData, a8 as StrategyContribution, o as StudyContentSource, S as StudySessionDoc, p as StudySessionFailedItem, q as StudySessionFailedNewItem, r as StudySessionFailedReviewItem, l as StudySessionItem, s as StudySessionNewItem, t as StudySessionReviewItem, i as StudySessionRunCard, j as StudySessionRunCardTrail, f as StudySessionRunSummary, O as UserConfig, H as UserCourseSetting, E as UserCourseSettings, B as UserDBAuthenticator, U as UserDBInterface, z as UserDBReader, A as UserDBWriter, Y as UserHydrationState, Z as UserHydrationStatus, I as UsrCrsDataInterface, ax as computeDeviation, az as computeEffectiveWeight, ay as computeSpread, aA as createOrchestrationContext, ap as drainCapturedRuns, am as getActivePipeline, a9 as getCardOrigin, a5 as getRegisteredFilterKind, a2 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a4 as getRegisteredNavigatorRole, ao as getRunsForSession, w as getStudySource, a3 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, ad as isFilter, ac as isGenerator, u as isReview, V as makeStudySessionId, al as mountPipelineDebugger, X as newSessionId, ak as pipelineDebugAPI, a1 as registerNavigator, an as setDebugSessionId } from '../contentSource-CqJmbOZN.js';
4
+ export { D as DataLayerProvider } from '../dataLayerProvider-B9_UCvkR.js';
5
+ import { D as DocType, Q as QuestionRecord, f as DocTypePrefixes, c as CardHistory, b as CardRecord } from '../types-legacy-BkOYOR6U.js';
6
+ export { C as CardData, g as CourseListData, h as DataShapeData, a as DisplayableData, F as Field, G as GuestUsername, d as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, T as Tag, e as TagStub, l as log } from '../types-legacy-BkOYOR6U.js';
6
7
  import { DataShape, ParsedCard } from '@vue-skuilder/common';
7
8
  import 'moment';
8
9
 
@@ -229,13 +230,18 @@ interface SrsBacklogDebug {
229
230
  scheduledTotal: number;
230
231
  /** Reviews eligible (due) right now. */
231
232
  dueNow: number;
232
- /** Healthy backlog threshold; multiplier is ×1.0 at or below this. */
233
+ /** Healthy review mass (card-equivalents); the multiplier is ×1.0 at or below it. */
233
234
  healthyBacklog: number;
234
- /** Global multiplier applied to every due review's urgency this run (>= 1.0, unbounded). */
235
+ /**
236
+ * Review mass: the due reviews' filtered scores against a reference, each at
237
+ * most 1. Set by the regulator stage; null until it has run.
238
+ */
239
+ reviewMass: number | null;
240
+ /** Multiplier the regulator stage applied to every due review this run (>= 1.0, unbounded). */
235
241
  backlogMultiplier: number;
236
- /** Exponential growth-rate base the multiplier climbs by per multiple of healthyBacklog excess. */
242
+ /** Exponential growth-rate base the multiplier climbs by per multiple of healthy mass in excess. */
237
243
  backlogGrowthRate: number;
238
- /** Highest review score produced this run (post-multiplier; can exceed 1.0); null if none due. */
244
+ /** Highest review urgency score from the SRS generator (before filters and regulators); null if none due. */
239
245
  topReviewScore: number | null;
240
246
  /** Human-readable time until the next review comes due, or null if some are due now. */
241
247
  nextDueIn: string | null;
@@ -294,88 +300,6 @@ declare function getStrategyPressureDebug(): StrategyPressureDebug[];
294
300
  /** Drop all captured snapshots (called on session start, alongside pipeline history). */
295
301
  declare function clearStrategyPressureDebug(): void;
296
302
 
297
- /**
298
- * Shared context available to all filters in a pipeline.
299
- *
300
- * Built once per getWeightedCards() call and passed to each filter.
301
- * This avoids repeated lookups for common data like user ELO.
302
- */
303
- interface FilterContext {
304
- /** User database interface */
305
- user: UserDBInterface;
306
- /** Course database interface */
307
- course: CourseDBInterface;
308
- /** User's global ELO score for this course */
309
- userElo: number;
310
- /** Orchestration context for evolutionary weighting */
311
- orchestration?: OrchestrationContext;
312
- }
313
- /**
314
- * A filter that transforms a list of weighted cards.
315
- *
316
- * Filters are pure transforms - they receive cards and context,
317
- * and return a modified list of cards. No delegate wrapping,
318
- * no side effects beyond provenance tracking.
319
- *
320
- * ## Implementation Guidelines
321
- *
322
- * 1. **Append provenance**: Every filter should add a StrategyContribution
323
- * entry documenting its decision for each card.
324
- *
325
- * 2. **Use multipliers**: Adjust scores by multiplying, not replacing.
326
- * This ensures filter order doesn't matter.
327
- *
328
- * 3. **Score 0 for exclusion**: To exclude a card, set score to 0.
329
- * Don't filter it out - let provenance show why it was excluded.
330
- *
331
- * 4. **Don't sort**: The Pipeline handles final sorting.
332
- * Filters just transform scores.
333
- *
334
- * ## Example Implementation
335
- *
336
- * ```typescript
337
- * const myFilter: CardFilter = {
338
- * name: 'My Filter',
339
- * async transform(cards, context) {
340
- * return cards.map(card => {
341
- * const multiplier = computeMultiplier(card, context);
342
- * const newScore = card.score * multiplier;
343
- * return {
344
- * ...card,
345
- * score: newScore,
346
- * provenance: [...card.provenance, {
347
- * strategy: 'myFilter',
348
- * strategyName: 'My Filter',
349
- * strategyId: 'MY_FILTER',
350
- * action: multiplier < 1 ? 'penalized' : 'passed',
351
- * score: newScore,
352
- * reason: 'Explanation of decision'
353
- * }]
354
- * };
355
- * });
356
- * }
357
- * };
358
- * ```
359
- */
360
- interface CardFilter {
361
- /** Human-readable name for this filter */
362
- name: string;
363
- /**
364
- * Transform a list of weighted cards.
365
- *
366
- * @param cards - Cards to transform (already scored by generator)
367
- * @param context - Shared context (user, course, userElo, etc.)
368
- * @returns Transformed cards with updated scores and provenance
369
- */
370
- transform(cards: WeightedCard[], context: FilterContext): Promise<WeightedCard[]>;
371
- }
372
- /**
373
- * Factory function type for creating filters from configuration.
374
- *
375
- * Used by PipelineAssembler to instantiate filters from strategy documents.
376
- */
377
- type CardFilterFactory<TConfig = unknown> = (config: TConfig) => CardFilter;
378
-
379
303
  interface DiversityRerankOptions {
380
304
  /**
381
305
  * How hard repetition is penalised. Larger → steeper demotion of repeated
@@ -594,4 +518,4 @@ declare const userDBDebugAPI: {
594
518
  */
595
519
  declare function mountUserDBDebugger(): void;
596
520
 
597
- export { type BulkCardProcessorConfig, type CardFilter, type CardFilterFactory, CardHistory, CardRecord, CourseDBInterface, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, type DiversityRerankOptions, DocType, DocTypePrefixes, type FilterContext, type GradientObservation, type GradientResult, type ImportResult, LearnableWeight, Loggable, OrchestrationContext, type PeriodUpdateInput, type PeriodUpdateResult, type PressureGaugeDebug, QuestionRecord, type SignalConfig, type SrsBacklogDebug, type StrategyLearningState, type StrategyPressureDebug, type StrategyStateDoc, type StrategyStateId, UserDBInterface, UserOutcomeRecord, WeightedCard, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, captureStrategyPressure, clearSrsBacklogDebug, clearStrategyPressureDebug, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, getSrsBacklogDebug, getStrategyPressureDebug, importParsedCards, isQuestionRecord, mountUserDBDebugger, parseCardHistoryID, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig };
521
+ export { type BulkCardProcessorConfig, CardHistory, CardRecord, CourseDBInterface, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, type DiversityRerankOptions, DocType, DocTypePrefixes, type GradientObservation, type GradientResult, type ImportResult, LearnableWeight, Loggable, OrchestrationContext, type PeriodUpdateInput, type PeriodUpdateResult, type PressureGaugeDebug, QuestionRecord, type SignalConfig, type SrsBacklogDebug, type StrategyLearningState, type StrategyPressureDebug, type StrategyStateDoc, type StrategyStateId, UserOutcomeRecord, WeightedCard, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, captureStrategyPressure, clearSrsBacklogDebug, clearStrategyPressureDebug, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, getSrsBacklogDebug, getStrategyPressureDebug, importParsedCards, isQuestionRecord, mountUserDBDebugger, parseCardHistoryID, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig };