@vue-skuilder/db 0.1.31-b → 0.1.31

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 (49) hide show
  1. package/dist/{contentSource-ygoFw9oV.d.ts → contentSource-Bdwkvqa8.d.ts} +16 -0
  2. package/dist/{contentSource-B7nXusjk.d.cts → contentSource-DF1nUbPQ.d.cts} +16 -0
  3. package/dist/core/index.d.cts +34 -3
  4. package/dist/core/index.d.ts +34 -3
  5. package/dist/core/index.js +510 -50
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +510 -50
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-BW7HvkMt.d.cts → dataLayerProvider-BKmVoyJR.d.ts} +20 -1
  10. package/dist/{dataLayerProvider-BfXUVDuG.d.ts → dataLayerProvider-BQdfJuBN.d.cts} +20 -1
  11. package/dist/impl/couch/index.d.cts +156 -4
  12. package/dist/impl/couch/index.d.ts +156 -4
  13. package/dist/impl/couch/index.js +730 -41
  14. package/dist/impl/couch/index.js.map +1 -1
  15. package/dist/impl/couch/index.mjs +729 -41
  16. package/dist/impl/couch/index.mjs.map +1 -1
  17. package/dist/impl/static/index.d.cts +3 -2
  18. package/dist/impl/static/index.d.ts +3 -2
  19. package/dist/impl/static/index.js +467 -31
  20. package/dist/impl/static/index.js.map +1 -1
  21. package/dist/impl/static/index.mjs +467 -31
  22. package/dist/impl/static/index.mjs.map +1 -1
  23. package/dist/index.d.cts +64 -3
  24. package/dist/index.d.ts +64 -3
  25. package/dist/index.js +948 -72
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +948 -72
  28. package/dist/index.mjs.map +1 -1
  29. package/package.json +3 -3
  30. package/src/core/interfaces/contentSource.ts +6 -0
  31. package/src/core/interfaces/courseDB.ts +6 -0
  32. package/src/core/interfaces/dataLayerProvider.ts +20 -0
  33. package/src/core/navigators/Pipeline.ts +414 -9
  34. package/src/core/navigators/PipelineAssembler.ts +23 -18
  35. package/src/core/navigators/PipelineDebugger.ts +35 -1
  36. package/src/core/navigators/filters/hierarchyDefinition.ts +78 -8
  37. package/src/core/navigators/generators/prescribed.ts +95 -0
  38. package/src/core/navigators/index.ts +12 -0
  39. package/src/impl/common/BaseUserDB.ts +4 -1
  40. package/src/impl/couch/CourseSyncService.ts +356 -0
  41. package/src/impl/couch/PouchDataLayerProvider.ts +21 -1
  42. package/src/impl/couch/courseDB.ts +60 -13
  43. package/src/impl/couch/index.ts +1 -0
  44. package/src/impl/static/courseDB.ts +5 -0
  45. package/src/study/ItemQueue.ts +42 -0
  46. package/src/study/SessionController.ts +195 -22
  47. package/src/study/SpacedRepetition.ts +3 -1
  48. package/tests/core/navigators/Pipeline.test.ts +1 -1
  49. package/tests/core/navigators/PipelineAssembler.test.ts +15 -14
@@ -240,6 +240,11 @@ interface CourseDBInterface extends NavigationStrategyManager, StudyContentSourc
240
240
  * @returns Map from cardId to array of tag names
241
241
  */
242
242
  getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
243
+ /**
244
+ * Get all card IDs in the course.
245
+ * Used by diagnostics to scan the full card space.
246
+ */
247
+ getAllCardIds(): Promise<string[]>;
243
248
  /**
244
249
  * Add a tag to a card
245
250
  */
@@ -908,6 +913,7 @@ declare function getCardOrigin(card: WeightedCard): 'new' | 'review' | 'failed';
908
913
  declare enum Navigators {
909
914
  ELO = "elo",
910
915
  SRS = "srs",
916
+ PRESCRIBED = "prescribed",
911
917
  HIERARCHY = "hierarchyDefinition",
912
918
  INTERFERENCE = "interferenceMitigator",
913
919
  RELATIVE_PRIORITY = "relativePriority",
@@ -1038,6 +1044,11 @@ declare abstract class ContentNavigator implements StudyContentSource {
1038
1044
  * @returns Cards sorted by score descending, with provenance trails
1039
1045
  */
1040
1046
  getWeightedCards(_limit: number): Promise<WeightedCard[]>;
1047
+ /**
1048
+ * Set ephemeral hints for the next pipeline run.
1049
+ * No-op for non-Pipeline navigators. Pipeline overrides this.
1050
+ */
1051
+ setEphemeralHints(_hints: Record<string, unknown>): void;
1041
1052
  }
1042
1053
 
1043
1054
  type StudySessionFailedItem = StudySessionFailedNewItem | StudySessionFailedReviewItem;
@@ -1096,6 +1107,11 @@ interface StudyContentSource {
1096
1107
  * Used for recording learning outcomes.
1097
1108
  */
1098
1109
  getOrchestrationContext?(): Promise<OrchestrationContext>;
1110
+ /**
1111
+ * Set ephemeral hints for the next pipeline run.
1112
+ * No-op for sources that don't support hints.
1113
+ */
1114
+ setEphemeralHints?(hints: Record<string, unknown>): void;
1099
1115
  }
1100
1116
  declare function getStudySource(source: ContentSourceID, user: UserDBInterface): Promise<StudyContentSource>;
1101
1117
 
@@ -240,6 +240,11 @@ interface CourseDBInterface extends NavigationStrategyManager, StudyContentSourc
240
240
  * @returns Map from cardId to array of tag names
241
241
  */
242
242
  getAppliedTagsBatch(cardIds: string[]): Promise<Map<string, string[]>>;
243
+ /**
244
+ * Get all card IDs in the course.
245
+ * Used by diagnostics to scan the full card space.
246
+ */
247
+ getAllCardIds(): Promise<string[]>;
243
248
  /**
244
249
  * Add a tag to a card
245
250
  */
@@ -908,6 +913,7 @@ declare function getCardOrigin(card: WeightedCard): 'new' | 'review' | 'failed';
908
913
  declare enum Navigators {
909
914
  ELO = "elo",
910
915
  SRS = "srs",
916
+ PRESCRIBED = "prescribed",
911
917
  HIERARCHY = "hierarchyDefinition",
912
918
  INTERFERENCE = "interferenceMitigator",
913
919
  RELATIVE_PRIORITY = "relativePriority",
@@ -1038,6 +1044,11 @@ declare abstract class ContentNavigator implements StudyContentSource {
1038
1044
  * @returns Cards sorted by score descending, with provenance trails
1039
1045
  */
1040
1046
  getWeightedCards(_limit: number): Promise<WeightedCard[]>;
1047
+ /**
1048
+ * Set ephemeral hints for the next pipeline run.
1049
+ * No-op for non-Pipeline navigators. Pipeline overrides this.
1050
+ */
1051
+ setEphemeralHints(_hints: Record<string, unknown>): void;
1041
1052
  }
1042
1053
 
1043
1054
  type StudySessionFailedItem = StudySessionFailedNewItem | StudySessionFailedReviewItem;
@@ -1096,6 +1107,11 @@ interface StudyContentSource {
1096
1107
  * Used for recording learning outcomes.
1097
1108
  */
1098
1109
  getOrchestrationContext?(): Promise<OrchestrationContext>;
1110
+ /**
1111
+ * Set ephemeral hints for the next pipeline run.
1112
+ * No-op for sources that don't support hints.
1113
+ */
1114
+ setEphemeralHints?(hints: Record<string, unknown>): void;
1099
1115
  }
1100
1116
  declare function getStudySource(source: ContentSourceID, user: UserDBInterface): Promise<StudyContentSource>;
1101
1117
 
@@ -1,6 +1,6 @@
1
- import { a2 as LearnableWeight, L as UserOutcomeRecord, a3 as OrchestrationContext, W as WeightedCard, U as UserDBInterface, C as CourseDBInterface, X as StrategyContribution } from '../contentSource-B7nXusjk.cjs';
2
- export { J as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, G as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, K as CourseRegistration, s as CourseRegistrationDoc, b as CoursesDBInterface, N as NavigatorConstructor, _ as NavigatorRole, $ as NavigatorRoles, Z as Navigators, j as ScheduledCard, H as SessionTrackingData, i as StudentClassroomDBInterface, h as StudyContentSource, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, I as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, B as UsrCrsDataInterface, a4 as computeDeviation, a6 as computeEffectiveWeight, a5 as computeSpread, a7 as createOrchestrationContext, Y as getCardOrigin, O as getRegisteredNavigator, R as getRegisteredNavigatorNames, Q as getRegisteredNavigatorRole, r as getStudySource, P as hasRegisteredNavigator, V as initializeNavigatorRegistry, a1 as isFilter, a0 as isGenerator, p as isReview, M as registerNavigator } from '../contentSource-B7nXusjk.cjs';
3
- export { D as DataLayerProvider } from '../dataLayerProvider-BW7HvkMt.cjs';
1
+ import { a2 as LearnableWeight, L as UserOutcomeRecord, a3 as OrchestrationContext, W as WeightedCard, U as UserDBInterface, C as CourseDBInterface, X as StrategyContribution } from '../contentSource-DF1nUbPQ.cjs';
2
+ export { J as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, G as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, K as CourseRegistration, s as CourseRegistrationDoc, b as CoursesDBInterface, N as NavigatorConstructor, _ as NavigatorRole, $ as NavigatorRoles, Z as Navigators, j as ScheduledCard, H as SessionTrackingData, i as StudentClassroomDBInterface, h as StudyContentSource, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, I as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, B as UsrCrsDataInterface, a4 as computeDeviation, a6 as computeEffectiveWeight, a5 as computeSpread, a7 as createOrchestrationContext, Y as getCardOrigin, O as getRegisteredNavigator, R as getRegisteredNavigatorNames, Q as getRegisteredNavigatorRole, r as getStudySource, P as hasRegisteredNavigator, V as initializeNavigatorRegistry, a1 as isFilter, a0 as isGenerator, p as isReview, M as registerNavigator } from '../contentSource-DF1nUbPQ.cjs';
3
+ export { D as DataLayerProvider } from '../dataLayerProvider-BQdfJuBN.cjs';
4
4
  import { D as DocType, i as QuestionRecord, b as DocTypePrefixes, C as CardHistory, c as CardRecord } from '../types-legacy-JXDxinpU.cjs';
5
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-JXDxinpU.cjs';
6
6
  import { DataShape, ParsedCard } from '@vue-skuilder/common';
@@ -383,6 +383,27 @@ interface CardGenerator {
383
383
  */
384
384
  type CardGeneratorFactory<TConfig = unknown> = (config: TConfig) => CardGenerator;
385
385
 
386
+ /**
387
+ * Diagnosis of the full card space for the current user.
388
+ */
389
+ interface CardSpaceDiagnosis {
390
+ totalCards: number;
391
+ threshold: number;
392
+ wellIndicated: number;
393
+ encountered: number;
394
+ wellIndicatedNew: number;
395
+ byType: Record<string, {
396
+ total: number;
397
+ wellIndicated: number;
398
+ new: number;
399
+ }>;
400
+ filterBreakdown: Array<{
401
+ name: string;
402
+ wellIndicated: number;
403
+ }>;
404
+ elapsedMs: number;
405
+ }
406
+
386
407
  /**
387
408
  * Summary of a single generator's contribution.
388
409
  */
@@ -424,6 +445,7 @@ interface PipelineRunReport {
424
445
  origin: 'new' | 'review' | 'unknown';
425
446
  finalScore: number;
426
447
  provenance: StrategyContribution[];
448
+ tags?: string[];
427
449
  selected: boolean;
428
450
  }>;
429
451
  }
@@ -477,6 +499,15 @@ declare const pipelineDebugAPI: {
477
499
  * If no runs are captured yet, falls back to showing just the registry.
478
500
  */
479
501
  showStrategies(): void;
502
+ /**
503
+ * Scan the full card space through the filter chain for the current user.
504
+ *
505
+ * Reports how many cards are well-indicated and how many are new.
506
+ * Use this to understand how the search space grows during onboarding.
507
+ *
508
+ * @param threshold - Score threshold for "well indicated" (default 0.10)
509
+ */
510
+ diagnoseCardSpace(threshold?: number): Promise<CardSpaceDiagnosis | null>;
480
511
  /**
481
512
  * Show help.
482
513
  */
@@ -1,6 +1,6 @@
1
- import { a2 as LearnableWeight, L as UserOutcomeRecord, a3 as OrchestrationContext, W as WeightedCard, U as UserDBInterface, C as CourseDBInterface, X as StrategyContribution } from '../contentSource-ygoFw9oV.js';
2
- export { J as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, G as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, K as CourseRegistration, s as CourseRegistrationDoc, b as CoursesDBInterface, N as NavigatorConstructor, _ as NavigatorRole, $ as NavigatorRoles, Z as Navigators, j as ScheduledCard, H as SessionTrackingData, i as StudentClassroomDBInterface, h as StudyContentSource, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, I as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, B as UsrCrsDataInterface, a4 as computeDeviation, a6 as computeEffectiveWeight, a5 as computeSpread, a7 as createOrchestrationContext, Y as getCardOrigin, O as getRegisteredNavigator, R as getRegisteredNavigatorNames, Q as getRegisteredNavigatorRole, r as getStudySource, P as hasRegisteredNavigator, V as initializeNavigatorRegistry, a1 as isFilter, a0 as isGenerator, p as isReview, M as registerNavigator } from '../contentSource-ygoFw9oV.js';
3
- export { D as DataLayerProvider } from '../dataLayerProvider-BfXUVDuG.js';
1
+ import { a2 as LearnableWeight, L as UserOutcomeRecord, a3 as OrchestrationContext, W as WeightedCard, U as UserDBInterface, C as CourseDBInterface, X as StrategyContribution } from '../contentSource-Bdwkvqa8.js';
2
+ export { J as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, G as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, K as CourseRegistration, s as CourseRegistrationDoc, b as CoursesDBInterface, N as NavigatorConstructor, _ as NavigatorRole, $ as NavigatorRoles, Z as Navigators, j as ScheduledCard, H as SessionTrackingData, i as StudentClassroomDBInterface, h as StudyContentSource, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, S as StudySessionItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, I as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, B as UsrCrsDataInterface, a4 as computeDeviation, a6 as computeEffectiveWeight, a5 as computeSpread, a7 as createOrchestrationContext, Y as getCardOrigin, O as getRegisteredNavigator, R as getRegisteredNavigatorNames, Q as getRegisteredNavigatorRole, r as getStudySource, P as hasRegisteredNavigator, V as initializeNavigatorRegistry, a1 as isFilter, a0 as isGenerator, p as isReview, M as registerNavigator } from '../contentSource-Bdwkvqa8.js';
3
+ export { D as DataLayerProvider } from '../dataLayerProvider-BKmVoyJR.js';
4
4
  import { D as DocType, i as QuestionRecord, b as DocTypePrefixes, C as CardHistory, c as CardRecord } from '../types-legacy-JXDxinpU.js';
5
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-JXDxinpU.js';
6
6
  import { DataShape, ParsedCard } from '@vue-skuilder/common';
@@ -383,6 +383,27 @@ interface CardGenerator {
383
383
  */
384
384
  type CardGeneratorFactory<TConfig = unknown> = (config: TConfig) => CardGenerator;
385
385
 
386
+ /**
387
+ * Diagnosis of the full card space for the current user.
388
+ */
389
+ interface CardSpaceDiagnosis {
390
+ totalCards: number;
391
+ threshold: number;
392
+ wellIndicated: number;
393
+ encountered: number;
394
+ wellIndicatedNew: number;
395
+ byType: Record<string, {
396
+ total: number;
397
+ wellIndicated: number;
398
+ new: number;
399
+ }>;
400
+ filterBreakdown: Array<{
401
+ name: string;
402
+ wellIndicated: number;
403
+ }>;
404
+ elapsedMs: number;
405
+ }
406
+
386
407
  /**
387
408
  * Summary of a single generator's contribution.
388
409
  */
@@ -424,6 +445,7 @@ interface PipelineRunReport {
424
445
  origin: 'new' | 'review' | 'unknown';
425
446
  finalScore: number;
426
447
  provenance: StrategyContribution[];
448
+ tags?: string[];
427
449
  selected: boolean;
428
450
  }>;
429
451
  }
@@ -477,6 +499,15 @@ declare const pipelineDebugAPI: {
477
499
  * If no runs are captured yet, falls back to showing just the registry.
478
500
  */
479
501
  showStrategies(): void;
502
+ /**
503
+ * Scan the full card space through the filter chain for the current user.
504
+ *
505
+ * Reports how many cards are well-indicated and how many are new.
506
+ * Use this to understand how the search space grows during onboarding.
507
+ *
508
+ * @param threshold - Score threshold for "well indicated" (default 0.10)
509
+ */
510
+ diagnoseCardSpace(threshold?: number): Promise<CardSpaceDiagnosis | null>;
480
511
  /**
481
512
  * Show help.
482
513
  */