@vue-skuilder/db 0.2.4 → 0.2.7

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/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { D as DataLayerProvider } from './dataLayerProvider-CiA2Rr0v.cjs';
4
4
  import { C as CardHistory, c as CardRecord, d as QuestionRecord } from './types-legacy-4tlwHnXo.cjs';
5
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
- 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';
7
+ export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, FilterImpact, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, diversityRerank, 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
9
  import { S as StaticCourseManifest } from './types-BFUa1pa3.cjs';
10
10
  export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-BFUa1pa3.cjs';
@@ -315,6 +315,21 @@ interface SessionQueueDebug {
315
315
  /** cardIDs in queue order, head (next draw) first. */
316
316
  cards: string[];
317
317
  }
318
+ /**
319
+ * A card the learner has interacted with this session (one entry per card in
320
+ * the session record, regardless of which queue — if any — still holds it).
321
+ */
322
+ interface SessionDrawnCardDebug {
323
+ cardID: string;
324
+ /** Queue status at draw time: 'new' | 'review' | 'failed-new' | 'failed-review'. */
325
+ status: string;
326
+ /** Number of CardRecords logged for this card this session (≥1). */
327
+ attempts: number;
328
+ /** Latest record's correctness; null for non-question (info) records. */
329
+ correct: boolean | null;
330
+ /** Total time spent across all of this card's records, in ms. */
331
+ timeSpentMs: number;
332
+ }
318
333
  /** Live snapshot of the controller, read fresh on each overlay tick. */
319
334
  interface SessionDebugSnapshot {
320
335
  secondsRemaining: number;
@@ -332,6 +347,8 @@ interface SessionDebugSnapshot {
332
347
  reviewQ: SessionQueueDebug;
333
348
  newQ: SessionQueueDebug;
334
349
  failedQ: SessionQueueDebug;
350
+ /** Every card the learner has interacted with this session, draw order. */
351
+ drawnCards: SessionDrawnCardDebug[];
335
352
  }
336
353
 
337
354
  /**
@@ -366,6 +383,21 @@ interface ReplanOptions {
366
383
  * multiply, require/exclude lists concatenate).
367
384
  */
368
385
  sessionHints?: ReplanHints;
386
+ /**
387
+ * Like `sessionHints`, but *merged* into the existing session-durable hints
388
+ * (via `mergeHints`) instead of replacing them. Use when emphasis should
389
+ * *accumulate* across replans rather than clobber — e.g. introducing a second
390
+ * concept mid-session must not wipe the first concept's boost, nor any
391
+ * `difficultyBooster`/`conceptBackoff` state on other concepts.
392
+ *
393
+ * Merge semantics (see `mergeHints`): boosts MULTIPLY, require/exclude lists
394
+ * concat-dedup. Re-emphasising the *same* tag therefore compounds — callers
395
+ * boosting a tag they may have already boosted should clamp at the call site.
396
+ *
397
+ * If both `sessionHints` and `mergeSessionHints` are supplied, the replace is
398
+ * applied first, then the merge — but they are normally mutually exclusive.
399
+ */
400
+ mergeSessionHints?: ReplanHints;
369
401
  /**
370
402
  * Maximum number of new cards to return from the pipeline.
371
403
  * Default: 20 (the standard session batch size).
@@ -549,6 +581,21 @@ declare class SessionController<TView = unknown> extends Loggable {
549
581
  * recomputed per-run in `_runReplan` and would otherwise go stale.
550
582
  */
551
583
  private _sessionHints;
584
+ /**
585
+ * Card IDs that have been *served* (drawn/consumed) this session. Populated
586
+ * at the single consumption choke-point (removeItemFromQueue), so it reflects
587
+ * a draw the instant it happens — earlier than `_sessionRecord`, which only
588
+ * lands once the card is *responded to*.
589
+ *
590
+ * Used to keep already-served cards out of newQ on every (re)plan: a `new`
591
+ * card shown once must never re-enter newQ this session. This is the general
592
+ * guard against re-presentation — including the case where a replan in flight
593
+ * captured a now-drawn card (e.g. a +INF require-injected follow-up the
594
+ * depletion prefetch grabbed just before it was drawn). Reviews/failed cards
595
+ * legitimately recur and are tracked by their own queues, so this only gates
596
+ * `new`-origin candidates.
597
+ */
598
+ private _servedCardIds;
552
599
  /**
553
600
  * Consumer-supplied hooks invoked after each question response is processed.
554
601
  * Seeded from constructor options (threaded from
@@ -863,6 +910,17 @@ declare class SessionController<TView = unknown> extends Loggable {
863
910
  * Remove an item from its source queue after consumption by nextCard().
864
911
  */
865
912
  private removeItemFromQueue;
913
+ /**
914
+ * Remove a satisfied card ID from the durable session-hint `requireCards`
915
+ * list. Called when a card is consumed (see removeItemFromQueue). No-op if
916
+ * the card was not a durable requirement.
917
+ *
918
+ * Matches literal IDs only: a glob/pattern requirement (which may stand for
919
+ * several cards) is NOT considered satisfied by a single draw and is left in
920
+ * place — durable patterns are the caller's responsibility, one-shot `hints`
921
+ * remain the right tool for them.
922
+ */
923
+ private _clearDurableRequirement;
866
924
  /**
867
925
  * End the session and record learning outcomes.
868
926
  *
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { D as DataLayerProvider } from './dataLayerProvider-DrBqOUa3.js';
4
4
  import { C as CardHistory, c as CardRecord, d as QuestionRecord } from './types-legacy-4tlwHnXo.js';
5
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
- 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';
7
+ export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, FilterImpact, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, diversityRerank, 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
9
  import { S as StaticCourseManifest } from './types-CHgpWQAY.js';
10
10
  export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-CHgpWQAY.js';
@@ -315,6 +315,21 @@ interface SessionQueueDebug {
315
315
  /** cardIDs in queue order, head (next draw) first. */
316
316
  cards: string[];
317
317
  }
318
+ /**
319
+ * A card the learner has interacted with this session (one entry per card in
320
+ * the session record, regardless of which queue — if any — still holds it).
321
+ */
322
+ interface SessionDrawnCardDebug {
323
+ cardID: string;
324
+ /** Queue status at draw time: 'new' | 'review' | 'failed-new' | 'failed-review'. */
325
+ status: string;
326
+ /** Number of CardRecords logged for this card this session (≥1). */
327
+ attempts: number;
328
+ /** Latest record's correctness; null for non-question (info) records. */
329
+ correct: boolean | null;
330
+ /** Total time spent across all of this card's records, in ms. */
331
+ timeSpentMs: number;
332
+ }
318
333
  /** Live snapshot of the controller, read fresh on each overlay tick. */
319
334
  interface SessionDebugSnapshot {
320
335
  secondsRemaining: number;
@@ -332,6 +347,8 @@ interface SessionDebugSnapshot {
332
347
  reviewQ: SessionQueueDebug;
333
348
  newQ: SessionQueueDebug;
334
349
  failedQ: SessionQueueDebug;
350
+ /** Every card the learner has interacted with this session, draw order. */
351
+ drawnCards: SessionDrawnCardDebug[];
335
352
  }
336
353
 
337
354
  /**
@@ -366,6 +383,21 @@ interface ReplanOptions {
366
383
  * multiply, require/exclude lists concatenate).
367
384
  */
368
385
  sessionHints?: ReplanHints;
386
+ /**
387
+ * Like `sessionHints`, but *merged* into the existing session-durable hints
388
+ * (via `mergeHints`) instead of replacing them. Use when emphasis should
389
+ * *accumulate* across replans rather than clobber — e.g. introducing a second
390
+ * concept mid-session must not wipe the first concept's boost, nor any
391
+ * `difficultyBooster`/`conceptBackoff` state on other concepts.
392
+ *
393
+ * Merge semantics (see `mergeHints`): boosts MULTIPLY, require/exclude lists
394
+ * concat-dedup. Re-emphasising the *same* tag therefore compounds — callers
395
+ * boosting a tag they may have already boosted should clamp at the call site.
396
+ *
397
+ * If both `sessionHints` and `mergeSessionHints` are supplied, the replace is
398
+ * applied first, then the merge — but they are normally mutually exclusive.
399
+ */
400
+ mergeSessionHints?: ReplanHints;
369
401
  /**
370
402
  * Maximum number of new cards to return from the pipeline.
371
403
  * Default: 20 (the standard session batch size).
@@ -549,6 +581,21 @@ declare class SessionController<TView = unknown> extends Loggable {
549
581
  * recomputed per-run in `_runReplan` and would otherwise go stale.
550
582
  */
551
583
  private _sessionHints;
584
+ /**
585
+ * Card IDs that have been *served* (drawn/consumed) this session. Populated
586
+ * at the single consumption choke-point (removeItemFromQueue), so it reflects
587
+ * a draw the instant it happens — earlier than `_sessionRecord`, which only
588
+ * lands once the card is *responded to*.
589
+ *
590
+ * Used to keep already-served cards out of newQ on every (re)plan: a `new`
591
+ * card shown once must never re-enter newQ this session. This is the general
592
+ * guard against re-presentation — including the case where a replan in flight
593
+ * captured a now-drawn card (e.g. a +INF require-injected follow-up the
594
+ * depletion prefetch grabbed just before it was drawn). Reviews/failed cards
595
+ * legitimately recur and are tracked by their own queues, so this only gates
596
+ * `new`-origin candidates.
597
+ */
598
+ private _servedCardIds;
552
599
  /**
553
600
  * Consumer-supplied hooks invoked after each question response is processed.
554
601
  * Seeded from constructor options (threaded from
@@ -863,6 +910,17 @@ declare class SessionController<TView = unknown> extends Loggable {
863
910
  * Remove an item from its source queue after consumption by nextCard().
864
911
  */
865
912
  private removeItemFromQueue;
913
+ /**
914
+ * Remove a satisfied card ID from the durable session-hint `requireCards`
915
+ * list. Called when a card is consumed (see removeItemFromQueue). No-op if
916
+ * the card was not a durable requirement.
917
+ *
918
+ * Matches literal IDs only: a glob/pattern requirement (which may stand for
919
+ * several cards) is NOT considered satisfied by a single draw and is left in
920
+ * place — durable patterns are the caller's responsibility, one-shot `hints`
921
+ * remain the right tool for them.
922
+ */
923
+ private _clearDurableRequirement;
866
924
  /**
867
925
  * End the session and record learning outcomes.
868
926
  *