@vue-skuilder/db 0.2.2 → 0.2.4
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/{contentSource-Ht3N2f-y.d.ts → contentSource-Cplhv3bJ.d.ts} +1 -1
- package/dist/{contentSource-BMlMwSiG.d.cts → contentSource-kI9_jwTu.d.cts} +1 -1
- package/dist/core/index.d.cts +5 -5
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +2 -1
- package/dist/core/index.mjs.map +1 -1
- package/dist/{dataLayerProvider-BEqB8VBR.d.cts → dataLayerProvider-CiA2Rr0v.d.cts} +1 -1
- package/dist/{dataLayerProvider-DObSXjnf.d.ts → dataLayerProvider-DrBqOUa3.d.ts} +1 -1
- package/dist/impl/couch/index.d.cts +3 -3
- package/dist/impl/couch/index.d.ts +3 -3
- package/dist/impl/couch/index.js +2 -1
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +2 -1
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.d.cts +4 -4
- package/dist/impl/static/index.d.ts +4 -4
- package/dist/impl/static/index.js +2 -1
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs +2 -1
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/{index-BWvO-_rJ.d.ts → index-BLLT5BYE.d.ts} +1 -1
- package/dist/{index-Ba7hYbHj.d.cts → index-k9NFHpS1.d.cts} +1 -1
- package/dist/index.d.cts +209 -10
- package/dist/index.d.ts +209 -10
- package/dist/index.js +361 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +361 -17
- package/dist/index.mjs.map +1 -1
- package/dist/{types-W8n-B6HG.d.cts → types-BFUa1pa3.d.cts} +1 -1
- package/dist/{types-CJrLM1Ew.d.ts → types-CHgpWQAY.d.ts} +1 -1
- package/dist/{types-legacy-JXDxinpU.d.cts → types-legacy-4tlwHnXo.d.cts} +1 -1
- package/dist/{types-legacy-JXDxinpU.d.ts → types-legacy-4tlwHnXo.d.ts} +1 -1
- package/dist/util/packer/index.d.cts +3 -3
- package/dist/util/packer/index.d.ts +3 -3
- package/package.json +3 -3
- package/src/core/navigators/Pipeline.ts +1 -1
- package/src/study/SessionController.ts +347 -22
- package/src/study/SessionDebugger.ts +10 -0
- package/src/study/SessionOverlay.ts +276 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-
|
|
1
|
+
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-CHgpWQAY.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Abstraction for file system operations needed by the migrator.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-
|
|
1
|
+
import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-BFUa1pa3.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Abstraction for file system operations needed by the migrator.
|
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { U as UserDBInterface, s as CourseRegistrationDoc, S as StudySessionItem, W as WeightedCard, R as ReplanHints, h as StudyContentSource, G as GeneratorResult, C as CourseDBInterface } from './contentSource-
|
|
2
|
-
export { K as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, a4 as CardGenerator, a6 as CardGeneratorFactory, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, L as CourseRegistration, b as CoursesDBInterface, ad as DocumentUpdater, a5 as GeneratorContext, a7 as LearnableWeight, N as NavigatorConstructor, a0 as NavigatorRole, a1 as NavigatorRoles, $ as Navigators, a8 as OrchestrationContext, j as ScheduledCard, I as SessionTrackingData, Z as StrategyContribution, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, J as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, M as UserOutcomeRecord, B as UsrCrsDataInterface, a9 as computeDeviation, ab as computeEffectiveWeight, aa as computeSpread, ac as createOrchestrationContext, _ as getCardOrigin, P as getRegisteredNavigator, X as getRegisteredNavigatorNames, V as getRegisteredNavigatorRole, r as getStudySource, Q as hasRegisteredNavigator, Y as initializeNavigatorRegistry, a3 as isFilter, a2 as isGenerator, p as isReview, ae as newInterval, O as registerNavigator } from './contentSource-
|
|
3
|
-
import { D as DataLayerProvider } from './dataLayerProvider-
|
|
4
|
-
import { C as CardHistory, c as CardRecord } from './types-legacy-
|
|
5
|
-
export {
|
|
1
|
+
import { U as UserDBInterface, s as CourseRegistrationDoc, S as StudySessionItem, W as WeightedCard, R as ReplanHints, h as StudyContentSource, G as GeneratorResult, C as CourseDBInterface } from './contentSource-kI9_jwTu.cjs';
|
|
2
|
+
export { K as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, a4 as CardGenerator, a6 as CardGeneratorFactory, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, L as CourseRegistration, b as CoursesDBInterface, ad as DocumentUpdater, a5 as GeneratorContext, a7 as LearnableWeight, N as NavigatorConstructor, a0 as NavigatorRole, a1 as NavigatorRoles, $ as Navigators, a8 as OrchestrationContext, j as ScheduledCard, I as SessionTrackingData, Z as StrategyContribution, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, J as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, M as UserOutcomeRecord, B as UsrCrsDataInterface, a9 as computeDeviation, ab as computeEffectiveWeight, aa as computeSpread, ac as createOrchestrationContext, _ as getCardOrigin, P as getRegisteredNavigator, X as getRegisteredNavigatorNames, V as getRegisteredNavigatorRole, r as getStudySource, Q as hasRegisteredNavigator, Y as initializeNavigatorRegistry, a3 as isFilter, a2 as isGenerator, p as isReview, ae as newInterval, O as registerNavigator } from './contentSource-kI9_jwTu.cjs';
|
|
3
|
+
import { D as DataLayerProvider } from './dataLayerProvider-CiA2Rr0v.cjs';
|
|
4
|
+
import { C as CardHistory, c as CardRecord, d as QuestionRecord } from './types-legacy-4tlwHnXo.cjs';
|
|
5
|
+
export { e as CardData, f as CourseListData, h as DataShapeData, g as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-4tlwHnXo.cjs';
|
|
6
6
|
import { Loggable } from './core/index.cjs';
|
|
7
7
|
export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, FilterContext, FilterImpact, 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.cjs';
|
|
8
8
|
import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
|
|
9
|
-
import { S as StaticCourseManifest } from './types-
|
|
10
|
-
export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-
|
|
11
|
-
import { F as FileSystemAdapter } from './index-
|
|
12
|
-
export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-
|
|
9
|
+
import { S as StaticCourseManifest } from './types-BFUa1pa3.cjs';
|
|
10
|
+
export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-BFUa1pa3.cjs';
|
|
11
|
+
import { F as FileSystemAdapter } from './index-k9NFHpS1.cjs';
|
|
12
|
+
export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-k9NFHpS1.cjs';
|
|
13
13
|
import 'moment';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -308,6 +308,32 @@ declare class QuotaRoundRobinMixer implements SourceMixer {
|
|
|
308
308
|
mix(batches: SourceBatch[], limit: number): WeightedCard[];
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
/** Per-queue debug view: total length, cumulative draws, and head-first cardIDs. */
|
|
312
|
+
interface SessionQueueDebug {
|
|
313
|
+
length: number;
|
|
314
|
+
dequeueCount: number;
|
|
315
|
+
/** cardIDs in queue order, head (next draw) first. */
|
|
316
|
+
cards: string[];
|
|
317
|
+
}
|
|
318
|
+
/** Live snapshot of the controller, read fresh on each overlay tick. */
|
|
319
|
+
interface SessionDebugSnapshot {
|
|
320
|
+
secondsRemaining: number;
|
|
321
|
+
hasCardGuarantee: boolean;
|
|
322
|
+
minCardsGuarantee: number;
|
|
323
|
+
wellIndicatedRemaining: number;
|
|
324
|
+
/** cardID of the card currently in front of the learner, if any. */
|
|
325
|
+
currentCard: string | null;
|
|
326
|
+
/** Session-durable hints re-merged into every pipeline run this session. */
|
|
327
|
+
sessionHints: ReplanHints | null;
|
|
328
|
+
/** True while a replan is executing (in-flight). */
|
|
329
|
+
replanActive: boolean;
|
|
330
|
+
/** Reason for the in-flight replan (caller label, or '(auto)'); may be stale when idle. */
|
|
331
|
+
replanLabel: string | null;
|
|
332
|
+
reviewQ: SessionQueueDebug;
|
|
333
|
+
newQ: SessionQueueDebug;
|
|
334
|
+
failedQ: SessionQueueDebug;
|
|
335
|
+
}
|
|
336
|
+
|
|
311
337
|
/**
|
|
312
338
|
* Options for requesting a mid-session replan.
|
|
313
339
|
*
|
|
@@ -318,6 +344,28 @@ declare class QuotaRoundRobinMixer implements SourceMixer {
|
|
|
318
344
|
interface ReplanOptions {
|
|
319
345
|
/** Scoring hints forwarded to the pipeline (boost/exclude/require). */
|
|
320
346
|
hints?: ReplanHints;
|
|
347
|
+
/**
|
|
348
|
+
* Session-durable scoring hints. Unlike `hints` (one-shot, applied to
|
|
349
|
+
* exactly the run this replan triggers), `sessionHints` are stashed on
|
|
350
|
+
* the controller and re-merged into *every* subsequent pipeline run for
|
|
351
|
+
* the remainder of the session — including the bare auto-replans
|
|
352
|
+
* (depletion/quality) that carry no caller hints, and the wedge-breaker.
|
|
353
|
+
*
|
|
354
|
+
* Use for "emphasis that should outlive a single queue rebuild" — e.g.
|
|
355
|
+
* boosting a just-failed concept tag, or a post-lesson concept boost set
|
|
356
|
+
* at session start. Without this, a one-shot `hints` boost evaporates on
|
|
357
|
+
* the next replan and the freshly-rebuilt (replace-mode) queue clobbers
|
|
358
|
+
* whatever it surfaced.
|
|
359
|
+
*
|
|
360
|
+
* Semantics (KISS): setting `sessionHints` *replaces* the prior session
|
|
361
|
+
* hints wholesale (caller beware — no accumulation, no decay). They live
|
|
362
|
+
* until session end or until explicitly overwritten. Normal usage applies
|
|
363
|
+
* a fixed boost, so repeated identical requests are no-ops.
|
|
364
|
+
*
|
|
365
|
+
* Merged with per-run `hints` via the pipeline's `mergeHints` (boosts
|
|
366
|
+
* multiply, require/exclude lists concatenate).
|
|
367
|
+
*/
|
|
368
|
+
sessionHints?: ReplanHints;
|
|
321
369
|
/**
|
|
322
370
|
* Maximum number of new cards to return from the pipeline.
|
|
323
371
|
* Default: 20 (the standard session batch size).
|
|
@@ -369,6 +417,58 @@ interface ResponseResult {
|
|
|
369
417
|
performanceScore?: number;
|
|
370
418
|
shouldClearFeedbackShadow: boolean;
|
|
371
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Read-only snapshot of a single processed response, handed to every
|
|
422
|
+
* registered {@link OutcomeObserver} after ELO/SRS have been recorded.
|
|
423
|
+
*
|
|
424
|
+
* Only emitted for question records (non-question dismisses are skipped).
|
|
425
|
+
*/
|
|
426
|
+
interface SessionOutcome {
|
|
427
|
+
/** The user's response. Includes `isCorrect`, `performance`, `priorAttemps`. */
|
|
428
|
+
readonly record: QuestionRecord;
|
|
429
|
+
/**
|
|
430
|
+
* The card that was answered, including its `tags` — the primary key an
|
|
431
|
+
* observer matches against (e.g. `gpc:exercise:*`). `card_elo` reflects
|
|
432
|
+
* pre-update state; the ELO write for this response is already in flight.
|
|
433
|
+
*/
|
|
434
|
+
readonly card: StudySessionRecord['card'];
|
|
435
|
+
/** The navigation decision produced for this response (read-only). */
|
|
436
|
+
readonly result: Readonly<ResponseResult>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* The narrow capability surface handed to an {@link OutcomeObserver}. This is
|
|
440
|
+
* the *only* way an observer can affect the session — it cannot touch ELO,
|
|
441
|
+
* the queues, the timer, or mutate the `ResponseResult`. A misbehaving
|
|
442
|
+
* observer degrades to "wrong boost", never "corrupted session".
|
|
443
|
+
*/
|
|
444
|
+
interface SessionControls {
|
|
445
|
+
/** Current session-durable hints, or null. For read-modify-write. */
|
|
446
|
+
getSessionHints(): ReplanHints | null;
|
|
447
|
+
/** Replace the session-durable hints wholesale (no decay). */
|
|
448
|
+
setSessionHints(hints: ReplanHints | null): void;
|
|
449
|
+
/**
|
|
450
|
+
* Merge `hints` into the existing session-durable hints via the pipeline's
|
|
451
|
+
* `mergeHints` (boosts multiply, require/exclude lists concat-dedup).
|
|
452
|
+
* Convenience for the common "add a boost on top of what's there" case.
|
|
453
|
+
* Note: multiplicative + no decay — clamp boost factors yourself if a
|
|
454
|
+
* repeatedly-failed tag could compound unboundedly.
|
|
455
|
+
*/
|
|
456
|
+
mergeSessionHints(hints: ReplanHints): void;
|
|
457
|
+
/** Request a replan (e.g. `{ mode: 'merge' }` for immediate visibility). */
|
|
458
|
+
requestReplan(opts?: ReplanOptions): Promise<void>;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* A consumer-supplied hook invoked after each question response is processed.
|
|
462
|
+
*
|
|
463
|
+
* Fires on *every* question response (gate inside on `record.isCorrect` /
|
|
464
|
+
* `result.nextCardAction` as needed). Awaited but isolated: a throwing
|
|
465
|
+
* observer is caught and logged, never wedging the session. Keep the
|
|
466
|
+
* synchronous body cheap and `void` any long work (e.g. a triggered replan)
|
|
467
|
+
* so you don't stall navigation.
|
|
468
|
+
*
|
|
469
|
+
* Registered via `StudySessionConfig.outcomeObservers` → constructor options.
|
|
470
|
+
*/
|
|
471
|
+
type OutcomeObserver = (outcome: SessionOutcome, controls: SessionControls) => void | Promise<void>;
|
|
372
472
|
interface SessionServices {
|
|
373
473
|
response: ResponseProcessor;
|
|
374
474
|
}
|
|
@@ -408,6 +508,13 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
408
508
|
* Used by nextCard() to await completion before drawing from queues.
|
|
409
509
|
*/
|
|
410
510
|
private _replanPromise;
|
|
511
|
+
/**
|
|
512
|
+
* Reason for the replan currently executing in `_runReplan`, surfaced by the
|
|
513
|
+
* debug overlay's spinner. The caller's `opts.label` when present, else
|
|
514
|
+
* `'(auto)'`. Only meaningful while `_replanPromise` is non-null; cleared
|
|
515
|
+
* when the in-flight chain settles.
|
|
516
|
+
*/
|
|
517
|
+
private _activeReplanLabel;
|
|
411
518
|
/**
|
|
412
519
|
* Number of well-indicated new cards remaining before the queue
|
|
413
520
|
* degrades to poorly-indicated content. Decremented on each newQ
|
|
@@ -427,6 +534,32 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
427
534
|
* each nextCard() draw. Set by replans that include `minFollowUpCards`.
|
|
428
535
|
*/
|
|
429
536
|
private _minCardsGuarantee;
|
|
537
|
+
/**
|
|
538
|
+
* Session-durable scoring hints. Re-merged into every pipeline run for
|
|
539
|
+
* the rest of the session (initial plan + every replan, including bare
|
|
540
|
+
* auto-replans and the wedge-breaker), via `_applyHintsToSources`.
|
|
541
|
+
*
|
|
542
|
+
* Set by `setSessionHints()` (e.g. session-start post-lesson boost) or by
|
|
543
|
+
* any replan carrying `ReplanOptions.sessionHints` (e.g. a just-failed
|
|
544
|
+
* concept boost). Replace semantics, no decay — lives until overwritten
|
|
545
|
+
* or session end. See `ReplanOptions.sessionHints` for rationale.
|
|
546
|
+
*
|
|
547
|
+
* Note: the controller-managed auto-excludes (current card, session
|
|
548
|
+
* record, imminent draw) are intentionally NOT folded in here — those are
|
|
549
|
+
* recomputed per-run in `_runReplan` and would otherwise go stale.
|
|
550
|
+
*/
|
|
551
|
+
private _sessionHints;
|
|
552
|
+
/**
|
|
553
|
+
* Consumer-supplied hooks invoked after each question response is processed.
|
|
554
|
+
* Seeded from constructor options (threaded from
|
|
555
|
+
* `StudySessionConfig.outcomeObservers`). See {@link OutcomeObserver}.
|
|
556
|
+
*/
|
|
557
|
+
private _outcomeObservers;
|
|
558
|
+
/**
|
|
559
|
+
* Lazily-built, stable capability object handed to observers. Bound to
|
|
560
|
+
* `this`; constructed once so observers can rely on referential identity.
|
|
561
|
+
*/
|
|
562
|
+
private _sessionControls;
|
|
430
563
|
private startTime;
|
|
431
564
|
private endTime;
|
|
432
565
|
private _secondsRemaining;
|
|
@@ -452,6 +585,7 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
452
585
|
constructor(sources: StudyContentSource[], time: number, dataLayer: DataLayerProvider, getViewComponent: (viewId: string) => TView, mixer?: SourceMixer, options?: {
|
|
453
586
|
defaultBatchLimit?: number;
|
|
454
587
|
initialReviewCap?: number;
|
|
588
|
+
outcomeObservers?: OutcomeObserver[];
|
|
455
589
|
});
|
|
456
590
|
private tick;
|
|
457
591
|
/**
|
|
@@ -514,6 +648,66 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
514
648
|
* newQ.peek(0) is the imminent draw we need to exclude.
|
|
515
649
|
*/
|
|
516
650
|
private _runReplan;
|
|
651
|
+
/**
|
|
652
|
+
* Set the session-durable scoring hints (replace semantics, no decay).
|
|
653
|
+
*
|
|
654
|
+
* Unlike a one-shot replan hint, these are re-merged into every pipeline
|
|
655
|
+
* run for the rest of the session — including the initial plan when set
|
|
656
|
+
* before `prepareSession()`, every replan, the bare auto-replans, and the
|
|
657
|
+
* wedge-breaker. Pass `null` to clear.
|
|
658
|
+
*
|
|
659
|
+
* Typical callers:
|
|
660
|
+
* - `StudySession` at session start, threading `StudySessionConfig.initHints`
|
|
661
|
+
* (e.g. a post-lesson concept boost) — so the boost outlives the first
|
|
662
|
+
* queue rebuild instead of being clobbered by the first auto-replan.
|
|
663
|
+
* - A consumer view on a failure, boosting the just-failed concept tag.
|
|
664
|
+
*
|
|
665
|
+
* Does not itself trigger a replan; the next plan/replan picks it up.
|
|
666
|
+
*/
|
|
667
|
+
setSessionHints(hints: ReplanHints | null): void;
|
|
668
|
+
/**
|
|
669
|
+
* Read the current session-durable hints (for read-modify-write callers,
|
|
670
|
+
* e.g. an outcome observer that clamps a compounding boost).
|
|
671
|
+
*/
|
|
672
|
+
getSessionHints(): ReplanHints | null;
|
|
673
|
+
/**
|
|
674
|
+
* Live state snapshot for the debug overlay (window.skuilder.session
|
|
675
|
+
* .dbgOverlay()). Reads directly from the private queues and hints, so it
|
|
676
|
+
* always reflects the current moment — unlike the passive SessionDebugger
|
|
677
|
+
* snapshots, which only capture what was explicitly pushed to them.
|
|
678
|
+
*/
|
|
679
|
+
getDebugSnapshot(): SessionDebugSnapshot;
|
|
680
|
+
/**
|
|
681
|
+
* Merge `hints` into the durable session hints via the pipeline's
|
|
682
|
+
* `mergeHints` (boosts multiply, require/exclude lists concat-dedup).
|
|
683
|
+
* Convenience over get-then-set for the common additive case. Note the
|
|
684
|
+
* multiplicative, no-decay semantics — clamp boost factors at the call
|
|
685
|
+
* site if a repeatedly-emphasised tag could compound unboundedly.
|
|
686
|
+
*/
|
|
687
|
+
mergeSessionHints(hints: ReplanHints): void;
|
|
688
|
+
/**
|
|
689
|
+
* Merge the durable `_sessionHints` with this run's one-shot hints and
|
|
690
|
+
* push the result to every source for consumption on the next pipeline
|
|
691
|
+
* run. Centralised so the initial plan and all replan paths apply session
|
|
692
|
+
* emphasis identically. No-op when there are no hints of either kind.
|
|
693
|
+
*/
|
|
694
|
+
private _applyHintsToSources;
|
|
695
|
+
/**
|
|
696
|
+
* Build (once) the stable capability object handed to outcome observers.
|
|
697
|
+
* Methods are bound to `this`; the object identity is stable across calls
|
|
698
|
+
* so observers may key off it.
|
|
699
|
+
*/
|
|
700
|
+
private _getSessionControls;
|
|
701
|
+
/**
|
|
702
|
+
* Notify registered outcome observers about a processed response.
|
|
703
|
+
*
|
|
704
|
+
* Only question records are surfaced (non-question dismisses are skipped).
|
|
705
|
+
* Observers run after ELO/SRS are recorded and before navigation. Each is
|
|
706
|
+
* awaited but isolated in try/catch — a throwing observer is logged and
|
|
707
|
+
* skipped, never wedging the session. Keep observers cheap and `void` any
|
|
708
|
+
* long work (e.g. a triggered replan) to avoid stalling the draw.
|
|
709
|
+
*/
|
|
710
|
+
private _notifyOutcomeObservers;
|
|
517
711
|
/**
|
|
518
712
|
* Run a replan, bypassing requestReplan()'s coalesce logic.
|
|
519
713
|
*
|
|
@@ -906,6 +1100,11 @@ declare const sessionDebugAPI: {
|
|
|
906
1100
|
* Show current queue state.
|
|
907
1101
|
*/
|
|
908
1102
|
showQueue(): void;
|
|
1103
|
+
/**
|
|
1104
|
+
* Toggle the pinned, live-updating DOM overlay for the active controller
|
|
1105
|
+
* (queues, session hints, timer). No-ops in non-browser hosts.
|
|
1106
|
+
*/
|
|
1107
|
+
dbgOverlay(): void;
|
|
909
1108
|
/**
|
|
910
1109
|
* Show presentation history for current or past session.
|
|
911
1110
|
*/
|
|
@@ -1176,4 +1375,4 @@ interface CouchDbUserDoc extends PouchDB.Authentication.User {
|
|
|
1176
1375
|
entitlements: UserEntitlements;
|
|
1177
1376
|
}
|
|
1178
1377
|
|
|
1179
|
-
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, GeneratorResult, Loggable, type MigrationOptions, type MigrationResult, type MixerCardInfo, type MixerRunReport, NOT_SET, type ProcessedDataShape, type ProcessedQuestionData, type QueueSnapshot, QuotaRoundRobinMixer, ReplanHints, 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 };
|
|
1378
|
+
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, GeneratorResult, Loggable, type MigrationOptions, type MigrationResult, type MixerCardInfo, type MixerRunReport, NOT_SET, type OutcomeObserver, type ProcessedDataShape, type ProcessedQuestionData, QuestionRecord, type QueueSnapshot, QuotaRoundRobinMixer, ReplanHints, type ReplanOptions, type ResponseResult, type RestoreProgress, type SessionAction, SessionController, type SessionControls, type SessionOutcome, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { U as UserDBInterface, s as CourseRegistrationDoc, S as StudySessionItem, W as WeightedCard, R as ReplanHints, h as StudyContentSource, G as GeneratorResult, C as CourseDBInterface } from './contentSource-
|
|
2
|
-
export { K as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, a4 as CardGenerator, a6 as CardGeneratorFactory, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, L as CourseRegistration, b as CoursesDBInterface, ad as DocumentUpdater, a5 as GeneratorContext, a7 as LearnableWeight, N as NavigatorConstructor, a0 as NavigatorRole, a1 as NavigatorRoles, $ as Navigators, a8 as OrchestrationContext, j as ScheduledCard, I as SessionTrackingData, Z as StrategyContribution, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, J as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, M as UserOutcomeRecord, B as UsrCrsDataInterface, a9 as computeDeviation, ab as computeEffectiveWeight, aa as computeSpread, ac as createOrchestrationContext, _ as getCardOrigin, P as getRegisteredNavigator, X as getRegisteredNavigatorNames, V as getRegisteredNavigatorRole, r as getStudySource, Q as hasRegisteredNavigator, Y as initializeNavigatorRegistry, a3 as isFilter, a2 as isGenerator, p as isReview, ae as newInterval, O as registerNavigator } from './contentSource-
|
|
3
|
-
import { D as DataLayerProvider } from './dataLayerProvider-
|
|
4
|
-
import { C as CardHistory, c as CardRecord } from './types-legacy-
|
|
5
|
-
export {
|
|
1
|
+
import { U as UserDBInterface, s as CourseRegistrationDoc, S as StudySessionItem, W as WeightedCard, R as ReplanHints, h as StudyContentSource, G as GeneratorResult, C as CourseDBInterface } from './contentSource-Cplhv3bJ.js';
|
|
2
|
+
export { K as ActivityRecord, A as AdminDBInterface, v as AssignedCard, g as AssignedContent, u as AssignedCourse, t as AssignedTag, a4 as CardGenerator, a6 as CardGeneratorFactory, c as ClassroomDBInterface, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, L as CourseRegistration, b as CoursesDBInterface, ad as DocumentUpdater, a5 as GeneratorContext, a7 as LearnableWeight, N as NavigatorConstructor, a0 as NavigatorRole, a1 as NavigatorRoles, $ as Navigators, a8 as OrchestrationContext, j as ScheduledCard, I as SessionTrackingData, Z as StrategyContribution, i as StudentClassroomDBInterface, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, T as TeacherClassroomDBInterface, J as UserConfig, z as UserCourseSetting, y as UserCourseSettings, x as UserDBAuthenticator, a as UserDBReader, w as UserDBWriter, M as UserOutcomeRecord, B as UsrCrsDataInterface, a9 as computeDeviation, ab as computeEffectiveWeight, aa as computeSpread, ac as createOrchestrationContext, _ as getCardOrigin, P as getRegisteredNavigator, X as getRegisteredNavigatorNames, V as getRegisteredNavigatorRole, r as getStudySource, Q as hasRegisteredNavigator, Y as initializeNavigatorRegistry, a3 as isFilter, a2 as isGenerator, p as isReview, ae as newInterval, O as registerNavigator } from './contentSource-Cplhv3bJ.js';
|
|
3
|
+
import { D as DataLayerProvider } from './dataLayerProvider-DrBqOUa3.js';
|
|
4
|
+
import { C as CardHistory, c as CardRecord, d as QuestionRecord } from './types-legacy-4tlwHnXo.js';
|
|
5
|
+
export { e as CardData, f as CourseListData, h as DataShapeData, g as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-4tlwHnXo.js';
|
|
6
6
|
import { Loggable } from './core/index.js';
|
|
7
7
|
export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, FilterContext, FilterImpact, 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
8
|
import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
|
|
9
|
-
import { S as StaticCourseManifest } from './types-
|
|
10
|
-
export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-
|
|
11
|
-
import { F as FileSystemAdapter } from './index-
|
|
12
|
-
export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-
|
|
9
|
+
import { S as StaticCourseManifest } from './types-CHgpWQAY.js';
|
|
10
|
+
export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-CHgpWQAY.js';
|
|
11
|
+
import { F as FileSystemAdapter } from './index-BLLT5BYE.js';
|
|
12
|
+
export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-BLLT5BYE.js';
|
|
13
13
|
import 'moment';
|
|
14
14
|
|
|
15
15
|
/**
|
|
@@ -308,6 +308,32 @@ declare class QuotaRoundRobinMixer implements SourceMixer {
|
|
|
308
308
|
mix(batches: SourceBatch[], limit: number): WeightedCard[];
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
/** Per-queue debug view: total length, cumulative draws, and head-first cardIDs. */
|
|
312
|
+
interface SessionQueueDebug {
|
|
313
|
+
length: number;
|
|
314
|
+
dequeueCount: number;
|
|
315
|
+
/** cardIDs in queue order, head (next draw) first. */
|
|
316
|
+
cards: string[];
|
|
317
|
+
}
|
|
318
|
+
/** Live snapshot of the controller, read fresh on each overlay tick. */
|
|
319
|
+
interface SessionDebugSnapshot {
|
|
320
|
+
secondsRemaining: number;
|
|
321
|
+
hasCardGuarantee: boolean;
|
|
322
|
+
minCardsGuarantee: number;
|
|
323
|
+
wellIndicatedRemaining: number;
|
|
324
|
+
/** cardID of the card currently in front of the learner, if any. */
|
|
325
|
+
currentCard: string | null;
|
|
326
|
+
/** Session-durable hints re-merged into every pipeline run this session. */
|
|
327
|
+
sessionHints: ReplanHints | null;
|
|
328
|
+
/** True while a replan is executing (in-flight). */
|
|
329
|
+
replanActive: boolean;
|
|
330
|
+
/** Reason for the in-flight replan (caller label, or '(auto)'); may be stale when idle. */
|
|
331
|
+
replanLabel: string | null;
|
|
332
|
+
reviewQ: SessionQueueDebug;
|
|
333
|
+
newQ: SessionQueueDebug;
|
|
334
|
+
failedQ: SessionQueueDebug;
|
|
335
|
+
}
|
|
336
|
+
|
|
311
337
|
/**
|
|
312
338
|
* Options for requesting a mid-session replan.
|
|
313
339
|
*
|
|
@@ -318,6 +344,28 @@ declare class QuotaRoundRobinMixer implements SourceMixer {
|
|
|
318
344
|
interface ReplanOptions {
|
|
319
345
|
/** Scoring hints forwarded to the pipeline (boost/exclude/require). */
|
|
320
346
|
hints?: ReplanHints;
|
|
347
|
+
/**
|
|
348
|
+
* Session-durable scoring hints. Unlike `hints` (one-shot, applied to
|
|
349
|
+
* exactly the run this replan triggers), `sessionHints` are stashed on
|
|
350
|
+
* the controller and re-merged into *every* subsequent pipeline run for
|
|
351
|
+
* the remainder of the session — including the bare auto-replans
|
|
352
|
+
* (depletion/quality) that carry no caller hints, and the wedge-breaker.
|
|
353
|
+
*
|
|
354
|
+
* Use for "emphasis that should outlive a single queue rebuild" — e.g.
|
|
355
|
+
* boosting a just-failed concept tag, or a post-lesson concept boost set
|
|
356
|
+
* at session start. Without this, a one-shot `hints` boost evaporates on
|
|
357
|
+
* the next replan and the freshly-rebuilt (replace-mode) queue clobbers
|
|
358
|
+
* whatever it surfaced.
|
|
359
|
+
*
|
|
360
|
+
* Semantics (KISS): setting `sessionHints` *replaces* the prior session
|
|
361
|
+
* hints wholesale (caller beware — no accumulation, no decay). They live
|
|
362
|
+
* until session end or until explicitly overwritten. Normal usage applies
|
|
363
|
+
* a fixed boost, so repeated identical requests are no-ops.
|
|
364
|
+
*
|
|
365
|
+
* Merged with per-run `hints` via the pipeline's `mergeHints` (boosts
|
|
366
|
+
* multiply, require/exclude lists concatenate).
|
|
367
|
+
*/
|
|
368
|
+
sessionHints?: ReplanHints;
|
|
321
369
|
/**
|
|
322
370
|
* Maximum number of new cards to return from the pipeline.
|
|
323
371
|
* Default: 20 (the standard session batch size).
|
|
@@ -369,6 +417,58 @@ interface ResponseResult {
|
|
|
369
417
|
performanceScore?: number;
|
|
370
418
|
shouldClearFeedbackShadow: boolean;
|
|
371
419
|
}
|
|
420
|
+
/**
|
|
421
|
+
* Read-only snapshot of a single processed response, handed to every
|
|
422
|
+
* registered {@link OutcomeObserver} after ELO/SRS have been recorded.
|
|
423
|
+
*
|
|
424
|
+
* Only emitted for question records (non-question dismisses are skipped).
|
|
425
|
+
*/
|
|
426
|
+
interface SessionOutcome {
|
|
427
|
+
/** The user's response. Includes `isCorrect`, `performance`, `priorAttemps`. */
|
|
428
|
+
readonly record: QuestionRecord;
|
|
429
|
+
/**
|
|
430
|
+
* The card that was answered, including its `tags` — the primary key an
|
|
431
|
+
* observer matches against (e.g. `gpc:exercise:*`). `card_elo` reflects
|
|
432
|
+
* pre-update state; the ELO write for this response is already in flight.
|
|
433
|
+
*/
|
|
434
|
+
readonly card: StudySessionRecord['card'];
|
|
435
|
+
/** The navigation decision produced for this response (read-only). */
|
|
436
|
+
readonly result: Readonly<ResponseResult>;
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* The narrow capability surface handed to an {@link OutcomeObserver}. This is
|
|
440
|
+
* the *only* way an observer can affect the session — it cannot touch ELO,
|
|
441
|
+
* the queues, the timer, or mutate the `ResponseResult`. A misbehaving
|
|
442
|
+
* observer degrades to "wrong boost", never "corrupted session".
|
|
443
|
+
*/
|
|
444
|
+
interface SessionControls {
|
|
445
|
+
/** Current session-durable hints, or null. For read-modify-write. */
|
|
446
|
+
getSessionHints(): ReplanHints | null;
|
|
447
|
+
/** Replace the session-durable hints wholesale (no decay). */
|
|
448
|
+
setSessionHints(hints: ReplanHints | null): void;
|
|
449
|
+
/**
|
|
450
|
+
* Merge `hints` into the existing session-durable hints via the pipeline's
|
|
451
|
+
* `mergeHints` (boosts multiply, require/exclude lists concat-dedup).
|
|
452
|
+
* Convenience for the common "add a boost on top of what's there" case.
|
|
453
|
+
* Note: multiplicative + no decay — clamp boost factors yourself if a
|
|
454
|
+
* repeatedly-failed tag could compound unboundedly.
|
|
455
|
+
*/
|
|
456
|
+
mergeSessionHints(hints: ReplanHints): void;
|
|
457
|
+
/** Request a replan (e.g. `{ mode: 'merge' }` for immediate visibility). */
|
|
458
|
+
requestReplan(opts?: ReplanOptions): Promise<void>;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* A consumer-supplied hook invoked after each question response is processed.
|
|
462
|
+
*
|
|
463
|
+
* Fires on *every* question response (gate inside on `record.isCorrect` /
|
|
464
|
+
* `result.nextCardAction` as needed). Awaited but isolated: a throwing
|
|
465
|
+
* observer is caught and logged, never wedging the session. Keep the
|
|
466
|
+
* synchronous body cheap and `void` any long work (e.g. a triggered replan)
|
|
467
|
+
* so you don't stall navigation.
|
|
468
|
+
*
|
|
469
|
+
* Registered via `StudySessionConfig.outcomeObservers` → constructor options.
|
|
470
|
+
*/
|
|
471
|
+
type OutcomeObserver = (outcome: SessionOutcome, controls: SessionControls) => void | Promise<void>;
|
|
372
472
|
interface SessionServices {
|
|
373
473
|
response: ResponseProcessor;
|
|
374
474
|
}
|
|
@@ -408,6 +508,13 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
408
508
|
* Used by nextCard() to await completion before drawing from queues.
|
|
409
509
|
*/
|
|
410
510
|
private _replanPromise;
|
|
511
|
+
/**
|
|
512
|
+
* Reason for the replan currently executing in `_runReplan`, surfaced by the
|
|
513
|
+
* debug overlay's spinner. The caller's `opts.label` when present, else
|
|
514
|
+
* `'(auto)'`. Only meaningful while `_replanPromise` is non-null; cleared
|
|
515
|
+
* when the in-flight chain settles.
|
|
516
|
+
*/
|
|
517
|
+
private _activeReplanLabel;
|
|
411
518
|
/**
|
|
412
519
|
* Number of well-indicated new cards remaining before the queue
|
|
413
520
|
* degrades to poorly-indicated content. Decremented on each newQ
|
|
@@ -427,6 +534,32 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
427
534
|
* each nextCard() draw. Set by replans that include `minFollowUpCards`.
|
|
428
535
|
*/
|
|
429
536
|
private _minCardsGuarantee;
|
|
537
|
+
/**
|
|
538
|
+
* Session-durable scoring hints. Re-merged into every pipeline run for
|
|
539
|
+
* the rest of the session (initial plan + every replan, including bare
|
|
540
|
+
* auto-replans and the wedge-breaker), via `_applyHintsToSources`.
|
|
541
|
+
*
|
|
542
|
+
* Set by `setSessionHints()` (e.g. session-start post-lesson boost) or by
|
|
543
|
+
* any replan carrying `ReplanOptions.sessionHints` (e.g. a just-failed
|
|
544
|
+
* concept boost). Replace semantics, no decay — lives until overwritten
|
|
545
|
+
* or session end. See `ReplanOptions.sessionHints` for rationale.
|
|
546
|
+
*
|
|
547
|
+
* Note: the controller-managed auto-excludes (current card, session
|
|
548
|
+
* record, imminent draw) are intentionally NOT folded in here — those are
|
|
549
|
+
* recomputed per-run in `_runReplan` and would otherwise go stale.
|
|
550
|
+
*/
|
|
551
|
+
private _sessionHints;
|
|
552
|
+
/**
|
|
553
|
+
* Consumer-supplied hooks invoked after each question response is processed.
|
|
554
|
+
* Seeded from constructor options (threaded from
|
|
555
|
+
* `StudySessionConfig.outcomeObservers`). See {@link OutcomeObserver}.
|
|
556
|
+
*/
|
|
557
|
+
private _outcomeObservers;
|
|
558
|
+
/**
|
|
559
|
+
* Lazily-built, stable capability object handed to observers. Bound to
|
|
560
|
+
* `this`; constructed once so observers can rely on referential identity.
|
|
561
|
+
*/
|
|
562
|
+
private _sessionControls;
|
|
430
563
|
private startTime;
|
|
431
564
|
private endTime;
|
|
432
565
|
private _secondsRemaining;
|
|
@@ -452,6 +585,7 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
452
585
|
constructor(sources: StudyContentSource[], time: number, dataLayer: DataLayerProvider, getViewComponent: (viewId: string) => TView, mixer?: SourceMixer, options?: {
|
|
453
586
|
defaultBatchLimit?: number;
|
|
454
587
|
initialReviewCap?: number;
|
|
588
|
+
outcomeObservers?: OutcomeObserver[];
|
|
455
589
|
});
|
|
456
590
|
private tick;
|
|
457
591
|
/**
|
|
@@ -514,6 +648,66 @@ declare class SessionController<TView = unknown> extends Loggable {
|
|
|
514
648
|
* newQ.peek(0) is the imminent draw we need to exclude.
|
|
515
649
|
*/
|
|
516
650
|
private _runReplan;
|
|
651
|
+
/**
|
|
652
|
+
* Set the session-durable scoring hints (replace semantics, no decay).
|
|
653
|
+
*
|
|
654
|
+
* Unlike a one-shot replan hint, these are re-merged into every pipeline
|
|
655
|
+
* run for the rest of the session — including the initial plan when set
|
|
656
|
+
* before `prepareSession()`, every replan, the bare auto-replans, and the
|
|
657
|
+
* wedge-breaker. Pass `null` to clear.
|
|
658
|
+
*
|
|
659
|
+
* Typical callers:
|
|
660
|
+
* - `StudySession` at session start, threading `StudySessionConfig.initHints`
|
|
661
|
+
* (e.g. a post-lesson concept boost) — so the boost outlives the first
|
|
662
|
+
* queue rebuild instead of being clobbered by the first auto-replan.
|
|
663
|
+
* - A consumer view on a failure, boosting the just-failed concept tag.
|
|
664
|
+
*
|
|
665
|
+
* Does not itself trigger a replan; the next plan/replan picks it up.
|
|
666
|
+
*/
|
|
667
|
+
setSessionHints(hints: ReplanHints | null): void;
|
|
668
|
+
/**
|
|
669
|
+
* Read the current session-durable hints (for read-modify-write callers,
|
|
670
|
+
* e.g. an outcome observer that clamps a compounding boost).
|
|
671
|
+
*/
|
|
672
|
+
getSessionHints(): ReplanHints | null;
|
|
673
|
+
/**
|
|
674
|
+
* Live state snapshot for the debug overlay (window.skuilder.session
|
|
675
|
+
* .dbgOverlay()). Reads directly from the private queues and hints, so it
|
|
676
|
+
* always reflects the current moment — unlike the passive SessionDebugger
|
|
677
|
+
* snapshots, which only capture what was explicitly pushed to them.
|
|
678
|
+
*/
|
|
679
|
+
getDebugSnapshot(): SessionDebugSnapshot;
|
|
680
|
+
/**
|
|
681
|
+
* Merge `hints` into the durable session hints via the pipeline's
|
|
682
|
+
* `mergeHints` (boosts multiply, require/exclude lists concat-dedup).
|
|
683
|
+
* Convenience over get-then-set for the common additive case. Note the
|
|
684
|
+
* multiplicative, no-decay semantics — clamp boost factors at the call
|
|
685
|
+
* site if a repeatedly-emphasised tag could compound unboundedly.
|
|
686
|
+
*/
|
|
687
|
+
mergeSessionHints(hints: ReplanHints): void;
|
|
688
|
+
/**
|
|
689
|
+
* Merge the durable `_sessionHints` with this run's one-shot hints and
|
|
690
|
+
* push the result to every source for consumption on the next pipeline
|
|
691
|
+
* run. Centralised so the initial plan and all replan paths apply session
|
|
692
|
+
* emphasis identically. No-op when there are no hints of either kind.
|
|
693
|
+
*/
|
|
694
|
+
private _applyHintsToSources;
|
|
695
|
+
/**
|
|
696
|
+
* Build (once) the stable capability object handed to outcome observers.
|
|
697
|
+
* Methods are bound to `this`; the object identity is stable across calls
|
|
698
|
+
* so observers may key off it.
|
|
699
|
+
*/
|
|
700
|
+
private _getSessionControls;
|
|
701
|
+
/**
|
|
702
|
+
* Notify registered outcome observers about a processed response.
|
|
703
|
+
*
|
|
704
|
+
* Only question records are surfaced (non-question dismisses are skipped).
|
|
705
|
+
* Observers run after ELO/SRS are recorded and before navigation. Each is
|
|
706
|
+
* awaited but isolated in try/catch — a throwing observer is logged and
|
|
707
|
+
* skipped, never wedging the session. Keep observers cheap and `void` any
|
|
708
|
+
* long work (e.g. a triggered replan) to avoid stalling the draw.
|
|
709
|
+
*/
|
|
710
|
+
private _notifyOutcomeObservers;
|
|
517
711
|
/**
|
|
518
712
|
* Run a replan, bypassing requestReplan()'s coalesce logic.
|
|
519
713
|
*
|
|
@@ -906,6 +1100,11 @@ declare const sessionDebugAPI: {
|
|
|
906
1100
|
* Show current queue state.
|
|
907
1101
|
*/
|
|
908
1102
|
showQueue(): void;
|
|
1103
|
+
/**
|
|
1104
|
+
* Toggle the pinned, live-updating DOM overlay for the active controller
|
|
1105
|
+
* (queues, session hints, timer). No-ops in non-browser hosts.
|
|
1106
|
+
*/
|
|
1107
|
+
dbgOverlay(): void;
|
|
909
1108
|
/**
|
|
910
1109
|
* Show presentation history for current or past session.
|
|
911
1110
|
*/
|
|
@@ -1176,4 +1375,4 @@ interface CouchDbUserDoc extends PouchDB.Authentication.User {
|
|
|
1176
1375
|
entitlements: UserEntitlements;
|
|
1177
1376
|
}
|
|
1178
1377
|
|
|
1179
|
-
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, GeneratorResult, Loggable, type MigrationOptions, type MigrationResult, type MixerCardInfo, type MixerRunReport, NOT_SET, type ProcessedDataShape, type ProcessedQuestionData, type QueueSnapshot, QuotaRoundRobinMixer, ReplanHints, 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 };
|
|
1378
|
+
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, GeneratorResult, Loggable, type MigrationOptions, type MigrationResult, type MixerCardInfo, type MixerRunReport, NOT_SET, type OutcomeObserver, type ProcessedDataShape, type ProcessedQuestionData, QuestionRecord, type QueueSnapshot, QuotaRoundRobinMixer, ReplanHints, type ReplanOptions, type ResponseResult, type RestoreProgress, type SessionAction, SessionController, type SessionControls, type SessionOutcome, 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 };
|