@vue-skuilder/db 0.2.27 → 0.2.28

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 (59) hide show
  1. package/dist/classroomDB-DLTtLZct.d.cts +86 -0
  2. package/dist/classroomDB-DLTtLZct.d.ts +86 -0
  3. package/dist/{contentSource-LPf044hY.d.ts → contentSource-BoFBwvYa.d.ts} +65 -98
  4. package/dist/{contentSource-D3c1fMAk.d.cts → contentSource-DpQqTG3m.d.cts} +65 -98
  5. package/dist/core/index.d.cts +6 -5
  6. package/dist/core/index.d.ts +6 -5
  7. package/dist/core/index.js +22 -2
  8. package/dist/core/index.js.map +1 -1
  9. package/dist/core/index.mjs +22 -2
  10. package/dist/core/index.mjs.map +1 -1
  11. package/dist/{dataLayerProvider-DaAootVV.d.ts → dataLayerProvider-D_LJT3F4.d.ts} +2 -8
  12. package/dist/{dataLayerProvider-CeLiFbHv.d.cts → dataLayerProvider-Dl3cAAvQ.d.cts} +2 -8
  13. package/dist/diagnostics/index.d.cts +370 -0
  14. package/dist/diagnostics/index.d.ts +370 -0
  15. package/dist/diagnostics/index.js +778 -0
  16. package/dist/diagnostics/index.js.map +1 -0
  17. package/dist/diagnostics/index.mjs +729 -0
  18. package/dist/diagnostics/index.mjs.map +1 -0
  19. package/dist/impl/couch/index.d.cts +4 -3
  20. package/dist/impl/couch/index.d.ts +4 -3
  21. package/dist/impl/couch/index.js +22 -2
  22. package/dist/impl/couch/index.js.map +1 -1
  23. package/dist/impl/couch/index.mjs +22 -2
  24. package/dist/impl/couch/index.mjs.map +1 -1
  25. package/dist/impl/static/index.d.cts +5 -5
  26. package/dist/impl/static/index.d.ts +5 -5
  27. package/dist/impl/static/index.js +22 -8
  28. package/dist/impl/static/index.js.map +1 -1
  29. package/dist/impl/static/index.mjs +22 -8
  30. package/dist/impl/static/index.mjs.map +1 -1
  31. package/dist/{index-BkBJlGDX.d.ts → index-CVGehe_t.d.ts} +1 -1
  32. package/dist/{index-D7WdMDAs.d.cts → index-Ktg72jKb.d.cts} +1 -1
  33. package/dist/index.d.cts +10 -9
  34. package/dist/index.d.ts +10 -9
  35. package/dist/index.js +64 -23
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +64 -23
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/{types-DjiFOZxJ.d.cts → types-D0oQeJAi.d.cts} +1 -1
  40. package/dist/{types-uJ2Xn3_X.d.ts → types-dXWfyz9B.d.ts} +1 -1
  41. package/dist/{types-legacy-CrwyZIvI.d.cts → types-legacy-BkOYOR6U.d.cts} +1 -1
  42. package/dist/{types-legacy-CrwyZIvI.d.ts → types-legacy-BkOYOR6U.d.ts} +1 -1
  43. package/dist/util/packer/index.d.cts +3 -3
  44. package/dist/util/packer/index.d.ts +3 -3
  45. package/package.json +15 -3
  46. package/src/core/interfaces/dataLayerProvider.ts +3 -8
  47. package/src/core/navigators/Pipeline.ts +5 -2
  48. package/src/core/navigators/PipelineDebugger.ts +64 -16
  49. package/src/core/navigators/index.ts +1 -0
  50. package/src/core/types/studySession.ts +37 -0
  51. package/src/diagnostics/dataset.ts +231 -0
  52. package/src/diagnostics/derive.ts +555 -0
  53. package/src/diagnostics/index.ts +24 -0
  54. package/src/diagnostics/loader.ts +191 -0
  55. package/src/diagnostics/text.ts +242 -0
  56. package/src/impl/couch/PouchDataLayerProvider.ts +0 -23
  57. package/src/impl/static/StaticDataLayerProvider.ts +0 -11
  58. package/src/study/SessionController.ts +56 -2
  59. package/tsup.config.ts +1 -0
@@ -1,4 +1,4 @@
1
- import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-uJ2Xn3_X.js';
1
+ import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-dXWfyz9B.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-DjiFOZxJ.cjs';
1
+ import { P as PackerConfig, a as PackedCourseData, S as StaticCourseManifest } from './types-D0oQeJAi.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,16 @@
1
- import { U as UserDBInterface, s as CourseRegistrationDoc, t as SessionEloEvent, S as StudySessionItem, W as WeightedCard, R as ReplanHints, h as StudyContentSource, u as SessionStateSnapshotProvider, G as GeneratorResult, C as CourseDBInterface } from './contentSource-D3c1fMAk.cjs';
2
- export { M as ActivityRecord, A as AdminDBInterface, x as AssignedCard, g as AssignedContent, w as AssignedCourse, v as AssignedTag, af as CardGenerator, ah as CardGeneratorFactory, c as ClassroomDBInterface, I as ClassroomRegistration, H as ClassroomRegistrationDesignation, J as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, N as CourseRegistration, b as CoursesDBInterface, ay as DocumentUpdater, aq as FilterImpact, ag as GeneratorContext, ap as GeneratorSummary, $ as HYDRATION_MARKER_ID, a0 as HydrationMarker, as as LearnableWeight, a1 as NavigatorConstructor, ab as NavigatorRole, ac as NavigatorRoles, aa as Navigators, at as OrchestrationContext, ar as PipelineForecaster, ao as PipelineRunReport, j as ScheduledCard, V as SessionStateSnapshot, K as SessionTrackingData, a8 as StrategyContribution, i as StudentClassroomDBInterface, P as StudySessionDoc, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, Q as StudySessionRunSummary, T as TeacherClassroomDBInterface, L as UserConfig, E as UserCourseSetting, B as UserCourseSettings, z as UserDBAuthenticator, a as UserDBReader, y as UserDBWriter, Z as UserHydrationState, _ as UserHydrationStatus, O as UserOutcomeRecord, F as UsrCrsDataInterface, au as computeDeviation, aw as computeEffectiveWeight, av as computeSpread, ax as createOrchestrationContext, an as drainCapturedRuns, ak as getActivePipeline, a9 as getCardOrigin, aB as getLapses, a3 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a5 as getRegisteredNavigatorRole, am as getRunsForSession, aA as getStreak, r as getStudySource, a4 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, ae as isFilter, ad as isGenerator, p as isReview, X as makeStudySessionId, aj as mountPipelineDebugger, az as newInterval, Y as newSessionId, ai as pipelineDebugAPI, a2 as registerNavigator, al as setDebugSessionId } from './contentSource-D3c1fMAk.cjs';
3
- import { D as DataLayerProvider } from './dataLayerProvider-CeLiFbHv.cjs';
4
- import { C as CardHistory, b as CardRecord, c as QuestionRecord } from './types-legacy-CrwyZIvI.cjs';
5
- export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, D as DocType, i as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-CrwyZIvI.cjs';
1
+ export { A as AdminDBInterface, d as AssignedCard, a as AssignedContent, c as AssignedCourse, b as AssignedTag, C as ClassroomDBInterface, S as StudentClassroomDBInterface, T as TeacherClassroomDBInterface } from './classroomDB-DLTtLZct.cjs';
2
+ import { U as UserDBInterface, c as CourseRegistrationDoc, f as SessionEloEvent, j as StudySessionItem, W as WeightedCard, R as ReplanHints, m as StudyContentSource, v as SessionStateSnapshotProvider, G as GeneratorResult, C as CourseDBInterface } from './contentSource-DpQqTG3m.cjs';
3
+ export { K as ActivityRecord, a9 as CardGenerator, ab as CardGeneratorFactory, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, k as ContentNavigationStrategyData, l as ContentNavigator, t as ContentSourceID, i as CourseInfo, L as CourseRegistration, a as CoursesDBInterface, at as DocumentUpdater, al as FilterImpact, aa as GeneratorContext, ak as GeneratorSummary, T as HYDRATION_MARKER_ID, V as HydrationMarker, an as LearnableWeight, X as NavigatorConstructor, a5 as NavigatorRole, a6 as NavigatorRoles, a4 as Navigators, ao as OrchestrationContext, am as PipelineForecaster, ai as PipelineRunReport, aj as RunReportCard, b as ScheduledCard, d as SessionStateSnapshot, I as SessionTrackingData, a2 as StrategyContribution, S as StudySessionDoc, n as StudySessionFailedItem, o as StudySessionFailedNewItem, p as StudySessionFailedReviewItem, q as StudySessionNewItem, r as StudySessionReviewItem, g as StudySessionRunCard, h as StudySessionRunCardTrail, e as StudySessionRunSummary, J as UserConfig, A as UserCourseSetting, z as UserCourseSettings, y as UserDBAuthenticator, w as UserDBReader, x as UserDBWriter, P as UserHydrationState, Q as UserHydrationStatus, M as UserOutcomeRecord, B as UsrCrsDataInterface, ap as computeDeviation, ar as computeEffectiveWeight, aq as computeSpread, as as createOrchestrationContext, ah as drainCapturedRuns, ae as getActivePipeline, a3 as getCardOrigin, aw as getLapses, Z as getRegisteredNavigator, a0 as getRegisteredNavigatorNames, $ as getRegisteredNavigatorRole, ag as getRunsForSession, av as getStreak, u as getStudySource, _ as hasRegisteredNavigator, a1 as initializeNavigatorRegistry, a8 as isFilter, a7 as isGenerator, s as isReview, N as makeStudySessionId, ad as mountPipelineDebugger, au as newInterval, O as newSessionId, ac as pipelineDebugAPI, Y as registerNavigator, af as setDebugSessionId } from './contentSource-DpQqTG3m.cjs';
4
+ import { D as DataLayerProvider } from './dataLayerProvider-Dl3cAAvQ.cjs';
5
+ import { c as CardHistory, b as CardRecord, Q as QuestionRecord } from './types-legacy-BkOYOR6U.cjs';
6
+ export { C as CardData, g as CourseListData, h as DataShapeData, a as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, d as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, T as Tag, e as TagStub, l as log } from './types-legacy-BkOYOR6U.cjs';
6
7
  import { SrsBacklogDebug, StrategyPressureDebug, Loggable } from './core/index.cjs';
7
8
  export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PressureGaugeDebug, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, captureStrategyPressure, clearSrsBacklogDebug, clearStrategyPressureDebug, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, getSrsBacklogDebug, getStrategyPressureDebug, importParsedCards, isQuestionRecord, mountUserDBDebugger, parseCardHistoryID, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.cjs';
8
9
  import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
- import { S as StaticCourseManifest } from './types-DjiFOZxJ.cjs';
10
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-DjiFOZxJ.cjs';
11
- import { F as FileSystemAdapter } from './index-D7WdMDAs.cjs';
12
- export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-D7WdMDAs.cjs';
10
+ import { S as StaticCourseManifest } from './types-D0oQeJAi.cjs';
11
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-D0oQeJAi.cjs';
12
+ import { F as FileSystemAdapter } from './index-Ktg72jKb.cjs';
13
+ export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-Ktg72jKb.cjs';
13
14
  import moment from 'moment';
14
15
 
15
16
  /**
package/dist/index.d.ts CHANGED
@@ -1,15 +1,16 @@
1
- import { U as UserDBInterface, s as CourseRegistrationDoc, t as SessionEloEvent, S as StudySessionItem, W as WeightedCard, R as ReplanHints, h as StudyContentSource, u as SessionStateSnapshotProvider, G as GeneratorResult, C as CourseDBInterface } from './contentSource-LPf044hY.js';
2
- export { M as ActivityRecord, A as AdminDBInterface, x as AssignedCard, g as AssignedContent, w as AssignedCourse, v as AssignedTag, af as CardGenerator, ah as CardGeneratorFactory, c as ClassroomDBInterface, I as ClassroomRegistration, H as ClassroomRegistrationDesignation, J as ClassroomRegistrationDoc, e as ContentNavigationStrategyData, f as ContentNavigator, q as ContentSourceID, d as CourseInfo, N as CourseRegistration, b as CoursesDBInterface, ay as DocumentUpdater, aq as FilterImpact, ag as GeneratorContext, ap as GeneratorSummary, $ as HYDRATION_MARKER_ID, a0 as HydrationMarker, as as LearnableWeight, a1 as NavigatorConstructor, ab as NavigatorRole, ac as NavigatorRoles, aa as Navigators, at as OrchestrationContext, ar as PipelineForecaster, ao as PipelineRunReport, j as ScheduledCard, V as SessionStateSnapshot, K as SessionTrackingData, a8 as StrategyContribution, i as StudentClassroomDBInterface, P as StudySessionDoc, k as StudySessionFailedItem, l as StudySessionFailedNewItem, m as StudySessionFailedReviewItem, n as StudySessionNewItem, o as StudySessionReviewItem, Q as StudySessionRunSummary, T as TeacherClassroomDBInterface, L as UserConfig, E as UserCourseSetting, B as UserCourseSettings, z as UserDBAuthenticator, a as UserDBReader, y as UserDBWriter, Z as UserHydrationState, _ as UserHydrationStatus, O as UserOutcomeRecord, F as UsrCrsDataInterface, au as computeDeviation, aw as computeEffectiveWeight, av as computeSpread, ax as createOrchestrationContext, an as drainCapturedRuns, ak as getActivePipeline, a9 as getCardOrigin, aB as getLapses, a3 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a5 as getRegisteredNavigatorRole, am as getRunsForSession, aA as getStreak, r as getStudySource, a4 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, ae as isFilter, ad as isGenerator, p as isReview, X as makeStudySessionId, aj as mountPipelineDebugger, az as newInterval, Y as newSessionId, ai as pipelineDebugAPI, a2 as registerNavigator, al as setDebugSessionId } from './contentSource-LPf044hY.js';
3
- import { D as DataLayerProvider } from './dataLayerProvider-DaAootVV.js';
4
- import { C as CardHistory, b as CardRecord, c as QuestionRecord } from './types-legacy-CrwyZIvI.js';
5
- export { d as CardData, e as CourseListData, g as DataShapeData, f as DisplayableData, D as DocType, i as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, h as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-CrwyZIvI.js';
1
+ export { A as AdminDBInterface, d as AssignedCard, a as AssignedContent, c as AssignedCourse, b as AssignedTag, C as ClassroomDBInterface, S as StudentClassroomDBInterface, T as TeacherClassroomDBInterface } from './classroomDB-DLTtLZct.js';
2
+ import { U as UserDBInterface, c as CourseRegistrationDoc, f as SessionEloEvent, j as StudySessionItem, W as WeightedCard, R as ReplanHints, m as StudyContentSource, v as SessionStateSnapshotProvider, G as GeneratorResult, C as CourseDBInterface } from './contentSource-BoFBwvYa.js';
3
+ export { K as ActivityRecord, a9 as CardGenerator, ab as CardGeneratorFactory, F as ClassroomRegistration, E as ClassroomRegistrationDesignation, H as ClassroomRegistrationDoc, k as ContentNavigationStrategyData, l as ContentNavigator, t as ContentSourceID, i as CourseInfo, L as CourseRegistration, a as CoursesDBInterface, at as DocumentUpdater, al as FilterImpact, aa as GeneratorContext, ak as GeneratorSummary, T as HYDRATION_MARKER_ID, V as HydrationMarker, an as LearnableWeight, X as NavigatorConstructor, a5 as NavigatorRole, a6 as NavigatorRoles, a4 as Navigators, ao as OrchestrationContext, am as PipelineForecaster, ai as PipelineRunReport, aj as RunReportCard, b as ScheduledCard, d as SessionStateSnapshot, I as SessionTrackingData, a2 as StrategyContribution, S as StudySessionDoc, n as StudySessionFailedItem, o as StudySessionFailedNewItem, p as StudySessionFailedReviewItem, q as StudySessionNewItem, r as StudySessionReviewItem, g as StudySessionRunCard, h as StudySessionRunCardTrail, e as StudySessionRunSummary, J as UserConfig, A as UserCourseSetting, z as UserCourseSettings, y as UserDBAuthenticator, w as UserDBReader, x as UserDBWriter, P as UserHydrationState, Q as UserHydrationStatus, M as UserOutcomeRecord, B as UsrCrsDataInterface, ap as computeDeviation, ar as computeEffectiveWeight, aq as computeSpread, as as createOrchestrationContext, ah as drainCapturedRuns, ae as getActivePipeline, a3 as getCardOrigin, aw as getLapses, Z as getRegisteredNavigator, a0 as getRegisteredNavigatorNames, $ as getRegisteredNavigatorRole, ag as getRunsForSession, av as getStreak, u as getStudySource, _ as hasRegisteredNavigator, a1 as initializeNavigatorRegistry, a8 as isFilter, a7 as isGenerator, s as isReview, N as makeStudySessionId, ad as mountPipelineDebugger, au as newInterval, O as newSessionId, ac as pipelineDebugAPI, Y as registerNavigator, af as setDebugSessionId } from './contentSource-BoFBwvYa.js';
4
+ import { D as DataLayerProvider } from './dataLayerProvider-D_LJT3F4.js';
5
+ import { c as CardHistory, b as CardRecord, Q as QuestionRecord } from './types-legacy-BkOYOR6U.js';
6
+ export { C as CardData, g as CourseListData, h as DataShapeData, a as DisplayableData, D as DocType, f as DocTypePrefixes, F as Field, G as GuestUsername, d as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, T as Tag, e as TagStub, l as log } from './types-legacy-BkOYOR6U.js';
6
7
  import { SrsBacklogDebug, StrategyPressureDebug, Loggable } from './core/index.js';
7
8
  export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PressureGaugeDebug, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, captureStrategyPressure, clearSrsBacklogDebug, clearStrategyPressureDebug, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, getSrsBacklogDebug, getStrategyPressureDebug, importParsedCards, isQuestionRecord, mountUserDBDebugger, parseCardHistoryID, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.js';
8
9
  import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
- import { S as StaticCourseManifest } from './types-uJ2Xn3_X.js';
10
- export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-uJ2Xn3_X.js';
11
- import { F as FileSystemAdapter } from './index-BkBJlGDX.js';
12
- export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-BkBJlGDX.js';
10
+ import { S as StaticCourseManifest } from './types-dXWfyz9B.js';
11
+ export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-dXWfyz9B.js';
12
+ import { F as FileSystemAdapter } from './index-CVGehe_t.js';
13
+ export { C as CouchDBToStaticPacker, a as FileStats, b as FileSystemError } from './index-CVGehe_t.js';
13
14
  import moment from 'moment';
14
15
 
15
16
  /**
package/dist/index.js CHANGED
@@ -834,7 +834,7 @@ function parseCardElo(provenance) {
834
834
  const match = eloEntry.reason.match(/card:\s*(\d+)/);
835
835
  return match ? parseInt(match[1], 10) : void 0;
836
836
  }
837
- function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints) {
837
+ function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints, scoredCards) {
838
838
  const selectedIds = new Set(selectedCards.map((c) => c.cardId));
839
839
  const toReport = (card) => ({
840
840
  cardId: card.cardId,
@@ -887,6 +887,23 @@ function buildRunReport(courseId, courseName, generatorName, generators, generat
887
887
  note: `${discardedTailCards.length} additional candidate(s) scored below the top ${DISCARDED_KEEP_TOP} near-misses and were not retained (score ${scoreMin.toExponential(2)}\u2013${scoreMax.toExponential(2)}${eloFragment}). Likely ELO-window pull remnants filtered out by hierarchy/lesson/priority gates.`
888
888
  };
889
889
  }
890
+ const isUnselectedNew = (c) => !c.reviewID && !selectedIds.has(c.cardId);
891
+ const generatorScore = (c) => c.provenance[0]?.score ?? 0;
892
+ const keptIds = new Set(allCards.map((c) => c.cardId));
893
+ const hintExcluded = (c) => c.score > 0 && !keptIds.has(c.cardId);
894
+ let nextInLine;
895
+ for (const c of allCards) {
896
+ if (isUnselectedNew(c) && (!nextInLine || c.score > nextInLine.score)) nextInLine = c;
897
+ }
898
+ let topGenerated;
899
+ for (const c of scoredCards ?? allCards) {
900
+ if (!isUnselectedNew(c) || hintExcluded(c)) continue;
901
+ if (!topGenerated || generatorScore(c) > generatorScore(topGenerated)) topGenerated = c;
902
+ }
903
+ const unselectedNew = nextInLine || topGenerated ? {
904
+ ...nextInLine ? { nextInLine: toReport(nextInLine) } : {},
905
+ ...topGenerated && topGenerated.cardId !== nextInLine?.cardId ? { topGenerated: toReport(topGenerated) } : {}
906
+ } : void 0;
890
907
  const reviewsSelected = selectedCards.filter((c) => getOrigin(c) === "review").length;
891
908
  const newSelected = selectedCards.filter((c) => getOrigin(c) === "new").length;
892
909
  return {
@@ -902,6 +919,7 @@ function buildRunReport(courseId, courseName, generatorName, generators, generat
902
919
  reviewsSelected,
903
920
  newSelected,
904
921
  cards,
922
+ unselectedNew,
905
923
  discardedTail
906
924
  };
907
925
  }
@@ -4721,6 +4739,7 @@ var init_Pipeline = __esm({
4721
4739
  }
4722
4740
  logger.debug(`[Pipeline] Filter '${filter.name}': ${beforeScores.size} \u2192 ${cards.length} cards (\u2191${boosted} \u2193${penalized} =${passed})`);
4723
4741
  }
4742
+ const scoredCards = cards;
4724
4743
  cards = cards.filter((c) => c.score > 0);
4725
4744
  const hints = this._ephemeralHints;
4726
4745
  if (hints) {
@@ -4757,7 +4776,8 @@ var init_Pipeline = __esm({
4757
4776
  cards,
4758
4777
  result,
4759
4778
  context.userElo,
4760
- hints ?? void 0
4779
+ hints ?? void 0,
4780
+ scoredCards
4761
4781
  );
4762
4782
  captureRun(report);
4763
4783
  } catch (e) {
@@ -11158,7 +11178,41 @@ Example:
11158
11178
  });
11159
11179
 
11160
11180
  // src/study/SessionController.ts
11161
- var SessionController;
11181
+ function sig4(x) {
11182
+ return Number(x.toPrecision(4));
11183
+ }
11184
+ function toRunCard(c) {
11185
+ return {
11186
+ cardId: c.cardId,
11187
+ origin: c.origin,
11188
+ ...c.generator ? { generator: c.generator } : {},
11189
+ score: sig4(c.finalScore),
11190
+ selected: c.selected
11191
+ };
11192
+ }
11193
+ function toRunCardTrail(c) {
11194
+ return {
11195
+ ...toRunCard(c),
11196
+ trail: c.provenance.filter((p) => p.action !== "passed").map((p) => ({
11197
+ strategyName: p.strategyName,
11198
+ action: p.action,
11199
+ score: sig4(p.score),
11200
+ reason: p.reason
11201
+ }))
11202
+ };
11203
+ }
11204
+ function persistedRunCards(run) {
11205
+ const selected = run.cards.filter((c) => c.selected);
11206
+ const runnersUp = run.cards.filter((c) => !c.selected).slice(0, PERSISTED_RUNNERS_UP);
11207
+ return [...selected, ...runnersUp].map(toRunCard);
11208
+ }
11209
+ function persistedUnselectedNew(u) {
11210
+ return {
11211
+ ...u.nextInLine ? { nextInLine: toRunCardTrail(u.nextInLine) } : {},
11212
+ ...u.topGenerated ? { topGenerated: toRunCardTrail(u.topGenerated) } : {}
11213
+ };
11214
+ }
11215
+ var PERSISTED_RUNNERS_UP, SessionController;
11162
11216
  var init_SessionController = __esm({
11163
11217
  "src/study/SessionController.ts"() {
11164
11218
  "use strict";
@@ -11180,6 +11234,7 @@ var init_SessionController = __esm({
11180
11234
  init_SessionDebugger();
11181
11235
  init_SessionOverlay();
11182
11236
  init_logger();
11237
+ PERSISTED_RUNNERS_UP = 5;
11183
11238
  SessionController = class _SessionController extends Loggable {
11184
11239
  _className = "SessionController";
11185
11240
  services;
@@ -11462,13 +11517,16 @@ var init_SessionController = __esm({
11462
11517
  newSelected: run.newSelected,
11463
11518
  // Compact detail projected off the full report so a persisted run is
11464
11519
  // self-explanatory once the in-memory ring buffer has rolled over.
11465
- // Per-card provenance (`run.cards`) is intentionally left out — it's
11466
- // the dominant memory cost and not worth persisting per run.
11520
+ // Per-card provenance is the dominant cost, so it's kept only for the
11521
+ // (at most two) `unselectedNew` cards, and only its score-changing
11522
+ // entries. Everything else is ids and scores.
11467
11523
  ...typeof run.userElo === "number" ? { userElo: run.userElo } : {},
11468
11524
  ...run.generators ? { generators: run.generators } : {},
11469
11525
  ...run.filters ? { filters: run.filters } : {},
11470
11526
  ...run.hints ? { hints: run.hints } : {},
11471
- ...run.discardedTail ? { discardedTail: run.discardedTail } : {}
11527
+ ...run.discardedTail ? { discardedTail: run.discardedTail } : {},
11528
+ cards: persistedRunCards(run),
11529
+ ...run.unselectedNew ? { unselectedNew: persistedUnselectedNew(run.unselectedNew) } : {}
11472
11530
  });
11473
11531
  }
11474
11532
  }
@@ -14097,7 +14155,6 @@ var init_PouchDataLayerProvider = __esm({
14097
14155
  "use strict";
14098
14156
  init_logger();
14099
14157
  init_dataDirectory();
14100
- init_auth();
14101
14158
  init_adminDB2();
14102
14159
  init_classroomDB2();
14103
14160
  init_courseDB();
@@ -14171,16 +14228,6 @@ var init_PouchDataLayerProvider = __esm({
14171
14228
  getAdminDB() {
14172
14229
  return new AdminDB();
14173
14230
  }
14174
- async createUserReaderForUser(targetUsername) {
14175
- const requestingUsername = await getLoggedInUsername();
14176
- if (requestingUsername !== "admin") {
14177
- throw new Error("Unauthorized: Only admin users can access other users' data");
14178
- }
14179
- logger.info(`Admin user '${requestingUsername}' requesting UserDBReader for '${targetUsername}'`);
14180
- const syncStrategy = new CouchDBSyncStrategy();
14181
- const targetUserDB = await BaseUser.instance(syncStrategy, targetUsername);
14182
- return targetUserDB;
14183
- }
14184
14231
  isReadOnly() {
14185
14232
  return false;
14186
14233
  }
@@ -15193,12 +15240,6 @@ var init_StaticDataLayerProvider = __esm({
15193
15240
  getAdminDB() {
15194
15241
  throw new Error("Admin functions not supported in static mode");
15195
15242
  }
15196
- async createUserReaderForUser(targetUsername) {
15197
- logger.warn(`StaticDataLayerProvider: Multi-user access not supported in static mode`);
15198
- logger.warn(`Request: trying to access data for ${targetUsername}`);
15199
- logger.warn(`Returning current user's data instead`);
15200
- return this.getUserDB();
15201
- }
15202
15243
  isReadOnly() {
15203
15244
  return true;
15204
15245
  }