@vue-skuilder/db 0.1.32-b → 0.1.32-c

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 (50) hide show
  1. package/dist/core/index.d.cts +16 -12
  2. package/dist/core/index.d.ts +16 -12
  3. package/dist/core/index.js +2262 -223
  4. package/dist/core/index.js.map +1 -1
  5. package/dist/core/index.mjs +2239 -196
  6. package/dist/core/index.mjs.map +1 -1
  7. package/dist/{contentSource-Bdwkvqa8.d.ts → dataLayerProvider-BAn-LRh5.d.ts} +626 -83
  8. package/dist/{contentSource-DF1nUbPQ.d.cts → dataLayerProvider-BJqBlMIl.d.cts} +626 -83
  9. package/dist/impl/couch/index.d.cts +17 -4
  10. package/dist/impl/couch/index.d.ts +17 -4
  11. package/dist/impl/couch/index.js +2306 -220
  12. package/dist/impl/couch/index.js.map +1 -1
  13. package/dist/impl/couch/index.mjs +2294 -204
  14. package/dist/impl/couch/index.mjs.map +1 -1
  15. package/dist/impl/static/index.d.cts +4 -5
  16. package/dist/impl/static/index.d.ts +4 -5
  17. package/dist/impl/static/index.js +2266 -227
  18. package/dist/impl/static/index.js.map +1 -1
  19. package/dist/impl/static/index.mjs +2251 -208
  20. package/dist/impl/static/index.mjs.map +1 -1
  21. package/dist/{index-BWvO-_rJ.d.ts → index-X6wHrURm.d.ts} +1 -1
  22. package/dist/{index-Ba7hYbHj.d.cts → index-m8MMGxxR.d.cts} +1 -1
  23. package/dist/index.d.cts +9 -444
  24. package/dist/index.d.ts +9 -444
  25. package/dist/index.js +9637 -8931
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +9539 -8833
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/{types-CJrLM1Ew.d.ts → types-DZ5dUqbL.d.ts} +1 -1
  30. package/dist/{types-W8n-B6HG.d.cts → types-ZL8tOPQZ.d.cts} +1 -1
  31. package/dist/{types-legacy-JXDxinpU.d.cts → types-legacy-C7r0T4OV.d.cts} +1 -1
  32. package/dist/{types-legacy-JXDxinpU.d.ts → types-legacy-C7r0T4OV.d.ts} +1 -1
  33. package/dist/util/packer/index.d.cts +3 -3
  34. package/dist/util/packer/index.d.ts +3 -3
  35. package/docs/navigators-architecture.md +2 -2
  36. package/package.json +2 -2
  37. package/src/core/interfaces/contentSource.ts +2 -1
  38. package/src/core/navigators/Pipeline.ts +47 -29
  39. package/src/core/navigators/PipelineDebugger.ts +49 -1
  40. package/src/core/navigators/filters/hierarchyDefinition.ts +88 -5
  41. package/src/core/navigators/generators/prescribed.ts +618 -43
  42. package/src/core/navigators/index.ts +2 -1
  43. package/src/impl/couch/CourseSyncService.ts +72 -4
  44. package/src/impl/couch/courseDB.ts +3 -2
  45. package/src/impl/static/courseDB.ts +3 -2
  46. package/src/study/SessionController.ts +79 -9
  47. package/src/study/services/EloService.ts +22 -3
  48. package/src/study/services/ResponseProcessor.ts +7 -3
  49. package/dist/dataLayerProvider-BKmVoyJR.d.ts +0 -67
  50. package/dist/dataLayerProvider-BQdfJuBN.d.cts +0 -67
package/dist/index.d.ts CHANGED
@@ -1,113 +1,14 @@
1
- import { U as UserDBInterface, s as CourseRegistrationDoc, S as StudySessionItem, W as WeightedCard, h as StudyContentSource, C as CourseDBInterface } 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, b as CoursesDBInterface, a8 as DocumentUpdater, a2 as LearnableWeight, N as NavigatorConstructor, _ as NavigatorRole, $ as NavigatorRoles, Z as Navigators, a3 as OrchestrationContext, j as ScheduledCard, H as SessionTrackingData, X as StrategyContribution, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, 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, L as UserOutcomeRecord, 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, a9 as newInterval, M as registerNavigator } from './contentSource-Bdwkvqa8.js';
3
- import { D as DataLayerProvider } from './dataLayerProvider-BKmVoyJR.js';
4
- import { C as CardHistory, c as CardRecord } from './types-legacy-JXDxinpU.js';
5
- export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, i as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-JXDxinpU.js';
6
- import { Loggable } from './core/index.js';
1
+ import { i as StudyContentSource, U as UserDBInterface, W as WeightedCard, t as SourceBatch, C as CourseDBInterface, D as DataLayerProvider } from './dataLayerProvider-BAn-LRh5.js';
2
+ export { K as ActivityRecord, A as AdminDBInterface, w as AssignedCard, h as AssignedContent, v as AssignedCourse, u as AssignedTag, b as ClassroomDBInterface, G as ClassroomRegistration, F as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, f as ContentNavigationStrategyData, g as ContentNavigator, r as ContentSourceID, d as CourseInfo, L as CourseRegistration, M as CourseRegistrationDoc, a as CoursesDBInterface, aj as DocumentUpdater, a6 as LearnableWeight, O as Loggable, P as NavigatorConstructor, a2 as NavigatorRole, a3 as NavigatorRoles, a1 as Navigators, a7 as OrchestrationContext, ai as QuotaRoundRobinMixer, R as ReplanHints, ac as ReplanOptions, af as ResponseResult, k as ScheduledCard, ae as SessionAction, ag as SessionController, I as SessionTrackingData, ah as SourceMixer, $ as StrategyContribution, j as StudentClassroomDBInterface, l as StudySessionFailedItem, m as StudySessionFailedNewItem, n as StudySessionFailedReviewItem, S as StudySessionItem, o as StudySessionNewItem, ad as StudySessionRecord, p as StudySessionReviewItem, T as TeacherClassroomDBInterface, J as UserConfig, B as UserCourseSetting, z as UserCourseSettings, y as UserDBAuthenticator, c as UserDBReader, x as UserDBWriter, N as UserOutcomeRecord, E as UsrCrsDataInterface, a8 as computeDeviation, aa as computeEffectiveWeight, a9 as computeSpread, ab as createOrchestrationContext, a0 as getCardOrigin, V as getRegisteredNavigator, Z as getRegisteredNavigatorNames, Y as getRegisteredNavigatorRole, s as getStudySource, X as hasRegisteredNavigator, _ as initializeNavigatorRegistry, a5 as isFilter, a4 as isGenerator, q as isReview, ak as newInterval, Q as registerNavigator } from './dataLayerProvider-BAn-LRh5.js';
3
+ export { C as CardData, g as CardHistory, h as CardRecord, b as CourseListData, d as DataShapeData, c as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, e as QuestionData, i as QuestionRecord, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-C7r0T4OV.js';
7
4
  export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, CardGenerator, CardGeneratorFactory, FilterContext, FilterImpact, GeneratorContext, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, importParsedCards, isQuestionRecord, mountPipelineDebugger, mountUserDBDebugger, parseCardHistoryID, pipelineDebugAPI, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.js';
8
- import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
- import { S as StaticCourseManifest } from './types-CJrLM1Ew.js';
10
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-CJrLM1Ew.js';
11
- import { F as FileSystemAdapter } from './index-BWvO-_rJ.js';
12
- export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-BWvO-_rJ.js';
5
+ import { TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
6
+ import { S as StaticCourseManifest } from './types-DZ5dUqbL.js';
7
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-DZ5dUqbL.js';
8
+ import { F as FileSystemAdapter } from './index-X6wHrURm.js';
9
+ export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-X6wHrURm.js';
13
10
  import 'moment';
14
11
 
15
- /**
16
- * Service responsible for ELO rating calculations and updates.
17
- */
18
- declare class EloService {
19
- private dataLayer;
20
- private user;
21
- constructor(dataLayer: DataLayerProvider, user: UserDBInterface);
22
- /**
23
- * Updates both user and card ELO ratings based on user performance.
24
- * @param userScore Score between 0-1 representing user performance
25
- * @param course_id Course identifier
26
- * @param card_id Card identifier
27
- * @param userCourseRegDoc User's course registration document (will be mutated)
28
- * @param currentCard Current card session record
29
- * @param k Optional K-factor for ELO calculation
30
- */
31
- updateUserAndCardElo(userScore: number, course_id: string, card_id: string, userCourseRegDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, k?: number): Promise<void>;
32
- /**
33
- * Updates both user and card ELO ratings with per-tag granularity.
34
- * Tags in taggedPerformance but not on card will be created dynamically.
35
- *
36
- * @param taggedPerformance Performance object with _global and per-tag scores
37
- * @param course_id Course identifier
38
- * @param card_id Card identifier
39
- * @param userCourseRegDoc User's course registration document (will be mutated)
40
- * @param currentCard Current card session record
41
- */
42
- updateUserAndCardEloPerTag(taggedPerformance: TaggedPerformance, course_id: string, card_id: string, userCourseRegDoc: CourseRegistrationDoc, currentCard: StudySessionRecord): Promise<void>;
43
- }
44
-
45
- /**
46
- * Service responsible for Spaced Repetition System (SRS) scheduling logic.
47
- */
48
- declare class SrsService {
49
- private user;
50
- constructor(user: UserDBInterface);
51
- /**
52
- * Remove a scheduled review from the user's database.
53
- * Used to clean up orphaned reviews (e.g., card deleted from course DB).
54
- */
55
- removeReview(reviewID: string): void;
56
- /**
57
- * Calculates the next review time for a card based on its history and
58
- * schedules it in the user's database.
59
- * @param history The full history of the card.
60
- * @param item The study session item, used to determine if a previous review needs to be cleared.
61
- */
62
- scheduleReview(history: CardHistory<CardRecord>, item: StudySessionItem): Promise<void>;
63
- }
64
-
65
- /**
66
- * Service responsible for orchestrating the complete response processing workflow.
67
- * Coordinates SRS scheduling and ELO updates for user card interactions.
68
- */
69
- declare class ResponseProcessor {
70
- private srsService;
71
- private eloService;
72
- constructor(srsService: SrsService, eloService: EloService);
73
- /**
74
- * Parses performance data into global score and optional per-tag scores.
75
- *
76
- * @param performance - Numeric or structured performance from QuestionRecord
77
- * @returns Parsed performance with global score and optional tag scores
78
- */
79
- private parsePerformance;
80
- /**
81
- * Processes a user's response to a card, handling SRS scheduling and ELO updates.
82
- * @param cardRecord User's response record
83
- * @param cardHistory Promise resolving to the card's history
84
- * @param studySessionItem Current study session item
85
- * @param courseRegistrationDoc User's course registration (for ELO updates)
86
- * @param currentCard Current study session record
87
- * @param courseId Course identifier
88
- * @param cardId Card identifier
89
- * @param maxAttemptsPerView Maximum attempts allowed per view
90
- * @param maxSessionViews Maximum session views for this card
91
- * @param sessionViews Current number of session views
92
- * @returns ResponseResult with navigation and UI instructions
93
- */
94
- processResponse(cardRecord: CardRecord, cardHistory: Promise<CardHistory<CardRecord>>, studySessionItem: StudySessionItem, courseRegistrationDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, courseId: string, cardId: string, maxAttemptsPerView: number, maxSessionViews: number, sessionViews: number): Promise<ResponseResult>;
95
- /**
96
- * Handles processing for correct responses: SRS scheduling and ELO updates.
97
- */
98
- private processCorrectResponse;
99
- /**
100
- * Handles processing for incorrect responses: ELO updates only.
101
- */
102
- private processIncorrectResponse;
103
- }
104
-
105
- interface HydratedCard<TView = unknown> {
106
- item: StudySessionItem;
107
- view: TView;
108
- data: any[];
109
- }
110
-
111
12
  interface MigrationOptions {
112
13
  chunkBatchSize: number;
113
14
  validateRoundTrip: boolean;
@@ -264,342 +165,6 @@ declare function getDbPath(dbName: string): string;
264
165
  */
265
166
  declare function initializeDataDirectory(): Promise<void>;
266
167
 
267
- /**
268
- * Represents a batch of content fetched from a single StudyContentSource.
269
- */
270
- interface SourceBatch {
271
- sourceIndex: number;
272
- weighted: WeightedCard[];
273
- }
274
- /**
275
- * Strategy interface for mixing content from multiple sources into a unified
276
- * set of weighted candidates.
277
- *
278
- * Different implementations can provide different balancing strategies:
279
- * - QuotaRoundRobinMixer: Equal representation per source
280
- * - MinMaxNormalizingMixer: Score normalization then global sort
281
- * - PercentileBucketMixer: Bucketed round-robin
282
- * etc.
283
- */
284
- interface SourceMixer {
285
- /**
286
- * Mix weighted cards from multiple sources into a unified, ordered list.
287
- *
288
- * @param batches - Content batches from each source
289
- * @param limit - Target number of cards to return
290
- * @returns Mixed and ordered weighted cards
291
- */
292
- mix(batches: SourceBatch[], limit: number): WeightedCard[];
293
- }
294
- /**
295
- * Quota-based mixer with interleaved output.
296
- *
297
- * Allocates equal representation to each source (top-N by score), then
298
- * interleaves the results by dealing from a randomly-shuffled source order.
299
- * Within each source, cards are dealt in score-descending order.
300
- *
301
- * This ensures that cards from different courses are spread throughout the
302
- * queue rather than clustered by score bands, which matters because
303
- * SessionController consumes queues front-to-back and sessions often end
304
- * before reaching the tail.
305
- */
306
- declare class QuotaRoundRobinMixer implements SourceMixer {
307
- mix(batches: SourceBatch[], limit: number): WeightedCard[];
308
- }
309
-
310
- /**
311
- * Options for requesting a mid-session replan.
312
- *
313
- * All fields are optional — callers can pass just the fields they need.
314
- * When omitted, defaults match the existing behaviour (full 20-card
315
- * replace with no hints).
316
- */
317
- interface ReplanOptions {
318
- /** Scoring hints forwarded to the pipeline (boost/exclude/require). */
319
- hints?: Record<string, unknown>;
320
- /**
321
- * Maximum number of new cards to return from the pipeline.
322
- * Default: 20 (the standard session batch size).
323
- */
324
- limit?: number;
325
- /**
326
- * How to integrate the new cards into the existing newQ.
327
- * - `'replace'` (default): atomically swap the entire newQ.
328
- * - `'merge'`: insert new cards at the front, keeping existing cards.
329
- */
330
- mode?: 'replace' | 'merge';
331
- /**
332
- * Human-readable label for debugging / provenance.
333
- * Appears in console logs and in card provenance entries created
334
- * by ephemeral hint application.
335
- */
336
- label?: string;
337
- }
338
- interface StudySessionRecord {
339
- card: {
340
- course_id: string;
341
- card_id: string;
342
- card_elo: number;
343
- };
344
- item: StudySessionItem;
345
- records: CardRecord[];
346
- }
347
-
348
- type SessionAction = 'dismiss-success' | 'dismiss-failed' | 'marked-failed' | 'dismiss-error';
349
- interface ResponseResult {
350
- nextCardAction: Exclude<SessionAction, 'dismiss-error'> | 'none';
351
- shouldLoadNextCard: boolean;
352
- /**
353
- * When true, the card requested deferred advancement via `deferAdvance`.
354
- * The record was logged and ELO updated, but navigation was suppressed.
355
- * StudySession should stash `nextCardAction` and wait for a
356
- * `ready-to-advance` event from the card before calling `nextCard()`.
357
- */
358
- deferred?: boolean;
359
- isCorrect: boolean;
360
- performanceScore?: number;
361
- shouldClearFeedbackShadow: boolean;
362
- }
363
- interface SessionServices {
364
- response: ResponseProcessor;
365
- }
366
- declare class SessionController<TView = unknown> extends Loggable {
367
- _className: string;
368
- services: SessionServices;
369
- private srsService;
370
- private eloService;
371
- private hydrationService;
372
- private mixer;
373
- private dataLayer;
374
- private courseNameCache;
375
- /**
376
- * Default pipeline batch size for new-card planning.
377
- * Set via constructor options; falls back to 20 when not specified.
378
- * Individual replans can override via `ReplanOptions.limit`.
379
- */
380
- private _defaultBatchLimit;
381
- private sources;
382
- private _sessionRecord;
383
- set sessionRecord(r: StudySessionRecord[]);
384
- private _currentCard;
385
- private reviewQ;
386
- private newQ;
387
- private failedQ;
388
- /**
389
- * Promise tracking a currently in-progress replan, or null if idle.
390
- * Used by nextCard() to await completion before drawing from queues.
391
- */
392
- private _replanPromise;
393
- /**
394
- * Number of well-indicated new cards remaining before the queue
395
- * degrades to poorly-indicated content. Decremented on each newQ
396
- * draw; when it hits 0, a replan is triggered automatically
397
- * (user state has changed from completing good cards).
398
- */
399
- private _wellIndicatedRemaining;
400
- /**
401
- * When true, suppresses the quality-based auto-replan trigger in
402
- * nextCard(). Set after a burst replan (small limit) to prevent the
403
- * auto-replan from clobbering the burst cards before they're consumed.
404
- * Cleared when the depletion-triggered replan fires (newQ exhausted).
405
- */
406
- private _suppressQualityReplan;
407
- /**
408
- * Guards against infinite depletion-triggered replans. Set to true
409
- * when a depletion replan fires; cleared when a replan produces
410
- * content (newQ.length > 0 after replan) or when an explicit
411
- * (non-auto) replan is requested.
412
- */
413
- private _depletionReplanAttempted;
414
- private startTime;
415
- private endTime;
416
- private _secondsRemaining;
417
- get secondsRemaining(): number;
418
- get report(): string;
419
- get detailedReport(): string;
420
- private _intervalHandle;
421
- /**
422
- * @param sources - Array of content sources to mix for the session
423
- * @param time - Session duration in seconds
424
- * @param dataLayer - Data layer provider
425
- * @param getViewComponent - Function to resolve view components
426
- * @param mixer - Optional source mixer strategy (defaults to QuotaRoundRobinMixer)
427
- * @param options - Optional session-level configuration
428
- * @param options.defaultBatchLimit - Default pipeline batch size (default: 20).
429
- * Smaller values for newer users cause more frequent replans, keeping plans
430
- * aligned with rapidly-changing user state.
431
- */
432
- constructor(sources: StudyContentSource[], time: number, dataLayer: DataLayerProvider, getViewComponent: (viewId: string) => TView, mixer?: SourceMixer, options?: {
433
- defaultBatchLimit?: number;
434
- });
435
- private tick;
436
- /**
437
- * Returns a rough, erring toward conservative, guess at
438
- * the amount of time the failed cards queue will require
439
- * to clean up.
440
- *
441
- * (seconds)
442
- */
443
- private estimateCleanupTime;
444
- /**
445
- * Extremely rough, conservative, estimate of amound of time to complete
446
- * all scheduled reviews
447
- */
448
- private estimateReviewTime;
449
- prepareSession(): Promise<void>;
450
- /**
451
- * Request a mid-session replan. Re-runs the pipeline with current user state
452
- * and atomically replaces the newQ contents. Safe to call at any time during
453
- * a session — if called while a replan is already in progress, returns the
454
- * existing replan promise (no duplicate work).
455
- *
456
- * Does NOT affect reviewQ or failedQ.
457
- *
458
- * If nextCard() is called while a replan is in flight, it will automatically
459
- * await the replan before drawing from queues, ensuring the user always sees
460
- * cards scored against their latest state.
461
- *
462
- * Typical trigger: application-level code (e.g. after a GPC intro completion)
463
- * calls this to ensure newly-unlocked content appears in the session.
464
- */
465
- requestReplan(options?: ReplanOptions | Record<string, unknown>): Promise<void>;
466
- /**
467
- * Normalise the requestReplan argument. Accepts either a ReplanOptions
468
- * object (new API) or a plain Record<string, unknown> (legacy callers
469
- * that passed hints directly). Distinguishes the two by checking for
470
- * the presence of ReplanOptions-specific keys.
471
- */
472
- private normalizeReplanOptions;
473
- /** Minimum well-indicated cards before an additive retry is attempted */
474
- private static readonly MIN_WELL_INDICATED;
475
- /**
476
- * Score threshold for considering a card "well-indicated."
477
- * Cards below this score are treated as fallback filler — present only
478
- * because no strategy hard-removed them, but likely penalized by one
479
- * or more filters. Strategy-agnostic: the SessionController doesn't
480
- * know or care which strategy assigned the score.
481
- */
482
- private static readonly WELL_INDICATED_SCORE;
483
- /**
484
- * Internal replan execution. Runs the pipeline, builds a new newQ,
485
- * atomically swaps it in, and triggers hydration for the new contents.
486
- *
487
- * If the initial replan produces fewer than MIN_WELL_INDICATED cards that
488
- * pass all hierarchy filters, one additive retry is attempted — merging
489
- * any new high-quality candidates into the front of the queue.
490
- */
491
- private _executeReplan;
492
- addTime(seconds: number): void;
493
- get failedCount(): number;
494
- toString(): string;
495
- reportString(): string;
496
- /**
497
- * Returns debug information about the current session state.
498
- * Used by SessionControllerDebug component for runtime inspection.
499
- */
500
- getDebugInfo(): {
501
- api: {
502
- mode: string;
503
- description: string;
504
- };
505
- reviewQueue: {
506
- length: number;
507
- dequeueCount: number;
508
- items: {
509
- courseID: any;
510
- cardID: any;
511
- status: any;
512
- }[];
513
- };
514
- newQueue: {
515
- length: number;
516
- dequeueCount: number;
517
- items: {
518
- courseID: any;
519
- cardID: any;
520
- status: any;
521
- }[];
522
- };
523
- failedQueue: {
524
- length: number;
525
- dequeueCount: number;
526
- items: {
527
- courseID: any;
528
- cardID: any;
529
- status: any;
530
- }[];
531
- };
532
- hydratedCache: {
533
- count: number;
534
- cardIds: string[];
535
- };
536
- replan: {
537
- inProgress: boolean;
538
- suppressQualityReplan: boolean;
539
- defaultBatchLimit: number;
540
- };
541
- };
542
- /**
543
- * Fetch content using the getWeightedCards API and mix across sources.
544
- *
545
- * This method:
546
- * 1. Fetches weighted cards from each source
547
- * 2. Fetches full review data (we need ScheduledCard fields for queue)
548
- * 3. Uses SourceMixer to balance content across sources
549
- * 4. Populates review and new card queues with mixed results
550
- */
551
- /**
552
- * Fetch weighted content from all sources and populate session queues.
553
- *
554
- * @param options.replan - If true, this is a mid-session replan rather than
555
- * initial session setup. Skips review queue population (avoiding duplicates),
556
- * atomically replaces newQ contents, and treats empty results as non-fatal.
557
- * @param options.additive - If true (replan only), merge new high-quality
558
- * candidates into the front of the existing newQ instead of replacing it.
559
- * @returns Number of "well-indicated" cards (passed all hierarchy filters)
560
- * in the new content. Returns -1 if no content was loaded.
561
- */
562
- private getWeightedContent;
563
- /**
564
- * Returns items that should be pre-hydrated.
565
- * Deterministic: top N items from each queue to ensure coverage.
566
- * Failed queue items will typically already be hydrated (from initial render).
567
- */
568
- private _getItemsToHydrate;
569
- /**
570
- * Selects the next item to present to the user.
571
- * Nondeterministic: uses probability to balance between queues based on session state.
572
- */
573
- private _selectNextItemToHydrate;
574
- nextCard(action?: SessionAction): Promise<HydratedCard<TView> | null>;
575
- /**
576
- * Public API for processing user responses to cards.
577
- * @param cardRecord User's response record
578
- * @param cardHistory Promise resolving to the card's history
579
- * @param courseRegistrationDoc User's course registration document
580
- * @param currentCard Current study session record
581
- * @param courseId Course identifier
582
- * @param cardId Card identifier
583
- * @param maxAttemptsPerView Maximum attempts allowed per view
584
- * @param maxSessionViews Maximum session views for this card
585
- * @param sessionViews Current number of session views
586
- * @returns ResponseResult with navigation and UI instructions
587
- */
588
- submitResponse(cardRecord: CardRecord, cardHistory: Promise<CardHistory<CardRecord>>, courseRegistrationDoc: CourseRegistrationDoc, currentCard: StudySessionRecord, courseId: string, cardId: string, maxAttemptsPerView: number, maxSessionViews: number, sessionViews: number): Promise<ResponseResult>;
589
- private dismissCurrentCard;
590
- /**
591
- * Remove an item from its source queue after consumption by nextCard().
592
- */
593
- private removeItemFromQueue;
594
- /**
595
- * End the session and record learning outcomes.
596
- *
597
- * This method aggregates all responses from the session and records a
598
- * UserOutcomeRecord if evolutionary orchestration is enabled.
599
- */
600
- endSession(): Promise<void>;
601
- }
602
-
603
168
  /**
604
169
  * A StudyContentSource that filters cards based on tag inclusion/exclusion.
605
170
  *
@@ -1087,4 +652,4 @@ interface CouchDbUserDoc extends PouchDB.Authentication.User {
1087
652
  entitlements: UserEntitlements;
1088
653
  }
1089
654
 
1090
- export { type AggregatedDocument, type AttachmentUploadResult, CardHistory, type CardPresentation, CardRecord, type CouchDbUserDoc, CourseDBInterface, CourseLookup, CourseRegistrationDoc, type CustomQuestionsData, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, type Entitlement, FileSystemAdapter, Loggable, type MigrationOptions, type MigrationResult, type MixerCardInfo, type MixerRunReport, NOT_SET, type ProcessedDataShape, type ProcessedQuestionData, type QueueSnapshot, QuotaRoundRobinMixer, type ReplanOptions, type ResponseResult, type RestoreProgress, type SessionAction, SessionController, type SessionRunReport, type SourceBatch, type SourceMixer, type SourceSelectionBreakdown, type SourceSummary, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, StudySessionItem, type StudySessionRecord, TagFilteredContentSource, type UserAccountStatus, UserDBInterface, type UserEntitlements, type ValidationIssue, type ValidationResult, WeightedCard, _resetDataLayer, captureMixerRun, endSessionTracking, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, initializeDataDirectory, initializeDataLayer, isDataShapeRegistered, isDataShapeSchemaAvailable, isQuestionTypeRegistered, mixerDebugAPI, mountMixerDebugger, mountSessionDebugger, processCustomQuestionsData, recordCardPresentation, registerBlanksCard, registerCustomQuestionTypes, registerDataShape, registerQuestionType, registerSeedData, removeCustomQuestionTypes, removeDataShape, removeQuestionType, sessionDebugAPI, snapshotQueues, startSessionTracking, validateMigration, validateStaticCourse };
655
+ export { type AggregatedDocument, type AttachmentUploadResult, type CardPresentation, type CouchDbUserDoc, CourseDBInterface, CourseLookup, type CustomQuestionsData, DEFAULT_MIGRATION_OPTIONS, type DataLayerConfig, DataLayerProvider, type DocumentCounts, ENV, type Entitlement, FileSystemAdapter, type MigrationOptions, type MigrationResult, type MixerCardInfo, type MixerRunReport, NOT_SET, type ProcessedDataShape, type ProcessedQuestionData, type QueueSnapshot, type RestoreProgress, type SessionRunReport, SourceBatch, type SourceSelectionBreakdown, type SourceSummary, StaticCourseManifest, type StaticCourseValidation, StaticToCouchDBMigrator, StudyContentSource, TagFilteredContentSource, type UserAccountStatus, UserDBInterface, type UserEntitlements, type ValidationIssue, type ValidationResult, WeightedCard, _resetDataLayer, captureMixerRun, endSessionTracking, ensureAppDataDirectory, getAppDataDirectory, getDataLayer, getDbPath, initializeDataDirectory, initializeDataLayer, isDataShapeRegistered, isDataShapeSchemaAvailable, isQuestionTypeRegistered, mixerDebugAPI, mountMixerDebugger, mountSessionDebugger, processCustomQuestionsData, recordCardPresentation, registerBlanksCard, registerCustomQuestionTypes, registerDataShape, registerQuestionType, registerSeedData, removeCustomQuestionTypes, removeDataShape, removeQuestionType, sessionDebugAPI, snapshotQueues, startSessionTracking, validateMigration, validateStaticCourse };