@vue-skuilder/db 0.2.31 → 0.2.33

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 (46) hide show
  1. package/dist/{contentSource-Doh1aVBJ.d.cts → contentSource-CTQ4kWhR.d.cts} +22 -0
  2. package/dist/{contentSource-DMduBjDC.d.ts → contentSource-JmWYu8IK.d.ts} +22 -0
  3. package/dist/core/index.d.cts +3 -3
  4. package/dist/core/index.d.ts +3 -3
  5. package/dist/core/index.js +50 -3
  6. package/dist/core/index.js.map +1 -1
  7. package/dist/core/index.mjs +50 -3
  8. package/dist/core/index.mjs.map +1 -1
  9. package/dist/{dataLayerProvider-BW1CBAbb.d.cts → dataLayerProvider-DfI_KYAe.d.cts} +1 -1
  10. package/dist/{dataLayerProvider-Cxfe4nSK.d.ts → dataLayerProvider-rlLE2Mf-.d.ts} +1 -1
  11. package/dist/diagnostics/index.d.cts +2 -2
  12. package/dist/diagnostics/index.d.ts +2 -2
  13. package/dist/diagnostics/index.js +12 -0
  14. package/dist/diagnostics/index.js.map +1 -1
  15. package/dist/diagnostics/index.mjs +12 -0
  16. package/dist/diagnostics/index.mjs.map +1 -1
  17. package/dist/impl/couch/index.d.cts +17 -2
  18. package/dist/impl/couch/index.d.ts +17 -2
  19. package/dist/impl/couch/index.js +50 -3
  20. package/dist/impl/couch/index.js.map +1 -1
  21. package/dist/impl/couch/index.mjs +50 -3
  22. package/dist/impl/couch/index.mjs.map +1 -1
  23. package/dist/impl/static/index.d.cts +2 -2
  24. package/dist/impl/static/index.d.ts +2 -2
  25. package/dist/impl/static/index.js +50 -3
  26. package/dist/impl/static/index.js.map +1 -1
  27. package/dist/impl/static/index.mjs +50 -3
  28. package/dist/impl/static/index.mjs.map +1 -1
  29. package/dist/index.d.cts +14 -3
  30. package/dist/index.d.ts +14 -3
  31. package/dist/index.js +101 -8
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +101 -8
  34. package/dist/index.mjs.map +1 -1
  35. package/package.json +3 -3
  36. package/src/core/navigators/Pipeline.ts +13 -2
  37. package/src/core/navigators/PipelineAssembler.ts +2 -0
  38. package/src/core/navigators/PipelineDebugger.ts +12 -0
  39. package/src/core/navigators/defaults.ts +4 -1
  40. package/src/core/types/studySession.ts +11 -1
  41. package/src/core/versionStamps.ts +66 -0
  42. package/src/diagnostics/text.ts +13 -0
  43. package/src/factory.ts +6 -0
  44. package/src/study/SessionController.ts +3 -0
  45. package/src/study/services/EloService.ts +49 -4
  46. package/tsup.config.ts +5 -0
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
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, d as CourseRegistrationDoc, i as SessionEloEvent, l as StudySessionItem, W as WeightedCard, n as ReplanHints, o as StudyContentSource, x as SessionStateSnapshotProvider, G as GeneratorResult, N as NavigatorRole, b as ContentNavigationStrategyData, F as FilterKind, y as RegulatorConfig, C as CourseDBInterface } from './contentSource-Doh1aVBJ.cjs';
3
- export { P as ActivityRecord, ae as CardFilter, ag as CardFilterFactory, ah as CardGenerator, aj as CardGeneratorFactory, K as ClassroomRegistration, J as ClassroomRegistrationDesignation, L as ClassroomRegistrationDoc, m as ContentNavigator, v as ContentSourceID, k as CourseInfo, Q as CourseRegistration, a as CoursesDBInterface, aB as DEFAULT_REGULATOR_CONFIG, aM as DocumentUpdater, af as FilterContext, at as FilterImpact, ai as GeneratorContext, as as GeneratorSummary, _ as HYDRATION_MARKER_ID, $ as HydrationMarker, aF as INTAKE_CLOCK_KEY, aE as IntakeClockState, av as LearnableWeight, a0 as NavigatorConstructor, ab as NavigatorRoles, aa as Navigators, aw as OrchestrationContext, au as PipelineForecaster, aq as PipelineRunReport, h as RegulatorName, R as RegulatorReading, ar as RunReportCard, c as ScheduledCard, e as SessionStateSnapshot, M as SessionTrackingData, a8 as StrategyContribution, S as StudySessionDoc, p as StudySessionFailedItem, q as StudySessionFailedNewItem, r as StudySessionFailedReviewItem, s as StudySessionNewItem, t as StudySessionReviewItem, g as StudySessionRunCard, j as StudySessionRunCardTrail, f as StudySessionRunSummary, O as UserConfig, H as UserCourseSetting, E as UserCourseSettings, B as UserDBAuthenticator, z as UserDBReader, A as UserDBWriter, Y as UserHydrationState, Z as UserHydrationStatus, T as UserOutcomeRecord, I as UsrCrsDataInterface, aL as applyReading, ax as computeDeviation, az as computeEffectiveWeight, ay as computeSpread, aA as createOrchestrationContext, ap as drainCapturedRuns, aH as frozenMsAt, am as getActivePipeline, a9 as getCardOrigin, aP as getLapses, a5 as getRegisteredFilterKind, a2 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a4 as getRegisteredNavigatorRole, ao as getRunsForSession, aO as getStreak, w as getStudySource, a3 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, aI as intakeHours, aK as intakeReading, ad as isFilter, ac as isGenerator, u as isReview, V as makeStudySessionId, al as mountPipelineDebugger, aN as newInterval, X as newSessionId, ak as pipelineDebugAPI, a1 as registerNavigator, aG as resetIntakeClock, aD as reviewMassReading, aC as reviewWeight, an as setDebugSessionId, aJ as stepIntakeClock } from './contentSource-Doh1aVBJ.cjs';
4
- import { D as DataLayerProvider } from './dataLayerProvider-BW1CBAbb.cjs';
2
+ import { U as UserDBInterface, d as CourseRegistrationDoc, i as SessionEloEvent, l as StudySessionItem, W as WeightedCard, n as ReplanHints, o as StudyContentSource, x as SessionStateSnapshotProvider, G as GeneratorResult, N as NavigatorRole, b as ContentNavigationStrategyData, F as FilterKind, y as RegulatorConfig, C as CourseDBInterface } from './contentSource-CTQ4kWhR.cjs';
3
+ export { P as ActivityRecord, ae as CardFilter, ag as CardFilterFactory, ah as CardGenerator, aj as CardGeneratorFactory, K as ClassroomRegistration, J as ClassroomRegistrationDesignation, L as ClassroomRegistrationDoc, m as ContentNavigator, v as ContentSourceID, k as CourseInfo, Q as CourseRegistration, a as CoursesDBInterface, aB as DEFAULT_REGULATOR_CONFIG, aM as DocumentUpdater, af as FilterContext, at as FilterImpact, ai as GeneratorContext, as as GeneratorSummary, _ as HYDRATION_MARKER_ID, $ as HydrationMarker, aF as INTAKE_CLOCK_KEY, aE as IntakeClockState, av as LearnableWeight, a0 as NavigatorConstructor, ab as NavigatorRoles, aa as Navigators, aw as OrchestrationContext, au as PipelineForecaster, aq as PipelineRunReport, h as RegulatorName, R as RegulatorReading, ar as RunReportCard, c as ScheduledCard, e as SessionStateSnapshot, M as SessionTrackingData, a8 as StrategyContribution, S as StudySessionDoc, p as StudySessionFailedItem, q as StudySessionFailedNewItem, r as StudySessionFailedReviewItem, s as StudySessionNewItem, t as StudySessionReviewItem, g as StudySessionRunCard, j as StudySessionRunCardTrail, f as StudySessionRunSummary, O as UserConfig, H as UserCourseSetting, E as UserCourseSettings, B as UserDBAuthenticator, z as UserDBReader, A as UserDBWriter, Y as UserHydrationState, Z as UserHydrationStatus, T as UserOutcomeRecord, I as UsrCrsDataInterface, aL as applyReading, ax as computeDeviation, az as computeEffectiveWeight, ay as computeSpread, aA as createOrchestrationContext, ap as drainCapturedRuns, aH as frozenMsAt, am as getActivePipeline, a9 as getCardOrigin, aP as getLapses, a5 as getRegisteredFilterKind, a2 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a4 as getRegisteredNavigatorRole, ao as getRunsForSession, aO as getStreak, w as getStudySource, a3 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, aI as intakeHours, aK as intakeReading, ad as isFilter, ac as isGenerator, u as isReview, V as makeStudySessionId, al as mountPipelineDebugger, aN as newInterval, X as newSessionId, ak as pipelineDebugAPI, a1 as registerNavigator, aG as resetIntakeClock, aD as reviewMassReading, aC as reviewWeight, an as setDebugSessionId, aJ as stepIntakeClock } from './contentSource-CTQ4kWhR.cjs';
4
+ import { D as DataLayerProvider } from './dataLayerProvider-DfI_KYAe.cjs';
5
5
  import { c as CardHistory, b as CardRecord, Q as QuestionRecord } from './types-legacy-BkOYOR6U.cjs';
6
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';
7
7
  import { SrsBacklogDebug, StrategyPressureDebug, Loggable } from './core/index.cjs';
@@ -19,7 +19,16 @@ import moment from 'moment';
19
19
  declare class EloService {
20
20
  private dataLayer;
21
21
  private user;
22
+ /** Per course ID: its compiled `CourseConfig.qaUsernamePattern`, or null. */
23
+ private qaPatterns;
22
24
  constructor(dataLayer: DataLayerProvider, user: UserDBInterface);
25
+ /**
26
+ * Whether the current user is one of the course's QA accounts
27
+ * (`CourseConfig.qaUsernamePattern`), whose responses must not move card
28
+ * ELO. The pattern is read once per course. If the config is unreadable or
29
+ * the pattern doesn't compile, nobody is a QA account.
30
+ */
31
+ private isQaUser;
23
32
  /**
24
33
  * Updates both user and card ELO ratings based on user performance.
25
34
  * @param userScore Score between 0-1 representing user performance
@@ -1583,6 +1592,8 @@ interface DataLayerConfig {
1583
1592
  options: {
1584
1593
  staticContentPath?: string;
1585
1594
  localStoragePrefix?: string;
1595
+ /** The host app's version (e.g. a git SHA), stamped on every study session it records. */
1596
+ appVersion?: string;
1586
1597
  manifests?: Record<string, StaticCourseManifest>;
1587
1598
  COUCHDB_SERVER_URL?: string;
1588
1599
  COUCHDB_SERVER_PROTOCOL?: string;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
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, d as CourseRegistrationDoc, i as SessionEloEvent, l as StudySessionItem, W as WeightedCard, n as ReplanHints, o as StudyContentSource, x as SessionStateSnapshotProvider, G as GeneratorResult, N as NavigatorRole, b as ContentNavigationStrategyData, F as FilterKind, y as RegulatorConfig, C as CourseDBInterface } from './contentSource-DMduBjDC.js';
3
- export { P as ActivityRecord, ae as CardFilter, ag as CardFilterFactory, ah as CardGenerator, aj as CardGeneratorFactory, K as ClassroomRegistration, J as ClassroomRegistrationDesignation, L as ClassroomRegistrationDoc, m as ContentNavigator, v as ContentSourceID, k as CourseInfo, Q as CourseRegistration, a as CoursesDBInterface, aB as DEFAULT_REGULATOR_CONFIG, aM as DocumentUpdater, af as FilterContext, at as FilterImpact, ai as GeneratorContext, as as GeneratorSummary, _ as HYDRATION_MARKER_ID, $ as HydrationMarker, aF as INTAKE_CLOCK_KEY, aE as IntakeClockState, av as LearnableWeight, a0 as NavigatorConstructor, ab as NavigatorRoles, aa as Navigators, aw as OrchestrationContext, au as PipelineForecaster, aq as PipelineRunReport, h as RegulatorName, R as RegulatorReading, ar as RunReportCard, c as ScheduledCard, e as SessionStateSnapshot, M as SessionTrackingData, a8 as StrategyContribution, S as StudySessionDoc, p as StudySessionFailedItem, q as StudySessionFailedNewItem, r as StudySessionFailedReviewItem, s as StudySessionNewItem, t as StudySessionReviewItem, g as StudySessionRunCard, j as StudySessionRunCardTrail, f as StudySessionRunSummary, O as UserConfig, H as UserCourseSetting, E as UserCourseSettings, B as UserDBAuthenticator, z as UserDBReader, A as UserDBWriter, Y as UserHydrationState, Z as UserHydrationStatus, T as UserOutcomeRecord, I as UsrCrsDataInterface, aL as applyReading, ax as computeDeviation, az as computeEffectiveWeight, ay as computeSpread, aA as createOrchestrationContext, ap as drainCapturedRuns, aH as frozenMsAt, am as getActivePipeline, a9 as getCardOrigin, aP as getLapses, a5 as getRegisteredFilterKind, a2 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a4 as getRegisteredNavigatorRole, ao as getRunsForSession, aO as getStreak, w as getStudySource, a3 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, aI as intakeHours, aK as intakeReading, ad as isFilter, ac as isGenerator, u as isReview, V as makeStudySessionId, al as mountPipelineDebugger, aN as newInterval, X as newSessionId, ak as pipelineDebugAPI, a1 as registerNavigator, aG as resetIntakeClock, aD as reviewMassReading, aC as reviewWeight, an as setDebugSessionId, aJ as stepIntakeClock } from './contentSource-DMduBjDC.js';
4
- import { D as DataLayerProvider } from './dataLayerProvider-Cxfe4nSK.js';
2
+ import { U as UserDBInterface, d as CourseRegistrationDoc, i as SessionEloEvent, l as StudySessionItem, W as WeightedCard, n as ReplanHints, o as StudyContentSource, x as SessionStateSnapshotProvider, G as GeneratorResult, N as NavigatorRole, b as ContentNavigationStrategyData, F as FilterKind, y as RegulatorConfig, C as CourseDBInterface } from './contentSource-JmWYu8IK.js';
3
+ export { P as ActivityRecord, ae as CardFilter, ag as CardFilterFactory, ah as CardGenerator, aj as CardGeneratorFactory, K as ClassroomRegistration, J as ClassroomRegistrationDesignation, L as ClassroomRegistrationDoc, m as ContentNavigator, v as ContentSourceID, k as CourseInfo, Q as CourseRegistration, a as CoursesDBInterface, aB as DEFAULT_REGULATOR_CONFIG, aM as DocumentUpdater, af as FilterContext, at as FilterImpact, ai as GeneratorContext, as as GeneratorSummary, _ as HYDRATION_MARKER_ID, $ as HydrationMarker, aF as INTAKE_CLOCK_KEY, aE as IntakeClockState, av as LearnableWeight, a0 as NavigatorConstructor, ab as NavigatorRoles, aa as Navigators, aw as OrchestrationContext, au as PipelineForecaster, aq as PipelineRunReport, h as RegulatorName, R as RegulatorReading, ar as RunReportCard, c as ScheduledCard, e as SessionStateSnapshot, M as SessionTrackingData, a8 as StrategyContribution, S as StudySessionDoc, p as StudySessionFailedItem, q as StudySessionFailedNewItem, r as StudySessionFailedReviewItem, s as StudySessionNewItem, t as StudySessionReviewItem, g as StudySessionRunCard, j as StudySessionRunCardTrail, f as StudySessionRunSummary, O as UserConfig, H as UserCourseSetting, E as UserCourseSettings, B as UserDBAuthenticator, z as UserDBReader, A as UserDBWriter, Y as UserHydrationState, Z as UserHydrationStatus, T as UserOutcomeRecord, I as UsrCrsDataInterface, aL as applyReading, ax as computeDeviation, az as computeEffectiveWeight, ay as computeSpread, aA as createOrchestrationContext, ap as drainCapturedRuns, aH as frozenMsAt, am as getActivePipeline, a9 as getCardOrigin, aP as getLapses, a5 as getRegisteredFilterKind, a2 as getRegisteredNavigator, a6 as getRegisteredNavigatorNames, a4 as getRegisteredNavigatorRole, ao as getRunsForSession, aO as getStreak, w as getStudySource, a3 as hasRegisteredNavigator, a7 as initializeNavigatorRegistry, aI as intakeHours, aK as intakeReading, ad as isFilter, ac as isGenerator, u as isReview, V as makeStudySessionId, al as mountPipelineDebugger, aN as newInterval, X as newSessionId, ak as pipelineDebugAPI, a1 as registerNavigator, aG as resetIntakeClock, aD as reviewMassReading, aC as reviewWeight, an as setDebugSessionId, aJ as stepIntakeClock } from './contentSource-JmWYu8IK.js';
4
+ import { D as DataLayerProvider } from './dataLayerProvider-rlLE2Mf-.js';
5
5
  import { c as CardHistory, b as CardRecord, Q as QuestionRecord } from './types-legacy-BkOYOR6U.js';
6
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';
7
7
  import { SrsBacklogDebug, StrategyPressureDebug, Loggable } from './core/index.js';
@@ -19,7 +19,16 @@ import moment from 'moment';
19
19
  declare class EloService {
20
20
  private dataLayer;
21
21
  private user;
22
+ /** Per course ID: its compiled `CourseConfig.qaUsernamePattern`, or null. */
23
+ private qaPatterns;
22
24
  constructor(dataLayer: DataLayerProvider, user: UserDBInterface);
25
+ /**
26
+ * Whether the current user is one of the course's QA accounts
27
+ * (`CourseConfig.qaUsernamePattern`), whose responses must not move card
28
+ * ELO. The pattern is read once per course. If the config is unreadable or
29
+ * the pattern doesn't compile, nobody is a QA account.
30
+ */
31
+ private isQaUser;
23
32
  /**
24
33
  * Updates both user and card ELO ratings based on user performance.
25
34
  * @param userScore Score between 0-1 representing user performance
@@ -1583,6 +1592,8 @@ interface DataLayerConfig {
1583
1592
  options: {
1584
1593
  staticContentPath?: string;
1585
1594
  localStoragePrefix?: string;
1595
+ /** The host app's version (e.g. a git SHA), stamped on every study session it records. */
1596
+ appVersion?: string;
1586
1597
  manifests?: Record<string, StaticCourseManifest>;
1587
1598
  COUCHDB_SERVER_URL?: string;
1588
1599
  COUCHDB_SERVER_PROTOCOL?: string;
package/dist/index.js CHANGED
@@ -4792,6 +4792,11 @@ var init_Pipeline = __esm({
4792
4792
  * This eliminates a remote getCourseConfig() round trip per pipeline run.
4793
4793
  */
4794
4794
  _cachedOrchestration = null;
4795
+ /**
4796
+ * Hash of the strategy docs this pipeline was assembled from (see
4797
+ * versionStamps.ts), set by whoever builds it. Stamped on every run.
4798
+ */
4799
+ strategyHash;
4795
4800
  /**
4796
4801
  * Persistent tag cache. Maps cardId → tag names.
4797
4802
  *
@@ -4985,7 +4990,8 @@ var init_Pipeline = __esm({
4985
4990
  logResultCards(result);
4986
4991
  logCardProvenance(result, 3);
4987
4992
  try {
4988
- const courseName = await this.course?.getCourseConfig().then((c) => c.name).catch(() => void 0);
4993
+ const courseConfig = await this.course?.getCourseConfig().catch(() => void 0);
4994
+ const courseName = courseConfig?.name;
4989
4995
  const report = buildRunReport(
4990
4996
  this.course?.getCourseID() || "unknown",
4991
4997
  courseName,
@@ -5000,7 +5006,11 @@ var init_Pipeline = __esm({
5000
5006
  scoredCards,
5001
5007
  regulators
5002
5008
  );
5003
- captureRun(report);
5009
+ const versions = {
5010
+ ...this.strategyHash ? { strategies: this.strategyHash } : {},
5011
+ ...courseConfig?.contentVersion ? { content: courseConfig.contentVersion } : {}
5012
+ };
5013
+ captureRun({ ...report, ...Object.keys(versions).length ? { versions } : {} });
5004
5014
  } catch (e) {
5005
5015
  logger.debug(`[Pipeline] Failed to capture debug run: ${e}`);
5006
5016
  }
@@ -5497,6 +5507,43 @@ var init_Pipeline = __esm({
5497
5507
  }
5498
5508
  });
5499
5509
 
5510
+ // src/core/versionStamps.ts
5511
+ function setAppVersion(version) {
5512
+ hostAppVersion = version;
5513
+ }
5514
+ function sessionVersions() {
5515
+ return { framework: FRAMEWORK_VERSION, ...hostAppVersion ? { app: hostAppVersion } : {} };
5516
+ }
5517
+ function stableStringify(value) {
5518
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
5519
+ if (value && typeof value === "object") {
5520
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
5521
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
5522
+ }
5523
+ return JSON.stringify(value);
5524
+ }
5525
+ function strategyHash(strategies) {
5526
+ if (strategies.length === 0) return DEFAULT_STRATEGY_HASH;
5527
+ const text = strategies.map((s) => {
5528
+ const { _rev: _ignored, ...rest } = s;
5529
+ return stableStringify(rest);
5530
+ }).sort().join("\n");
5531
+ let h = 2166136261;
5532
+ for (let i = 0; i < text.length; i++) {
5533
+ h ^= text.charCodeAt(i);
5534
+ h = Math.imul(h, 16777619);
5535
+ }
5536
+ return (h >>> 0).toString(16).padStart(8, "0");
5537
+ }
5538
+ var FRAMEWORK_VERSION, hostAppVersion, DEFAULT_STRATEGY_HASH;
5539
+ var init_versionStamps = __esm({
5540
+ "src/core/versionStamps.ts"() {
5541
+ "use strict";
5542
+ FRAMEWORK_VERSION = true ? "0.2.33" : "dev";
5543
+ DEFAULT_STRATEGY_HASH = "default";
5544
+ }
5545
+ });
5546
+
5500
5547
  // src/core/navigators/defaults.ts
5501
5548
  var defaults_exports = {};
5502
5549
  __export(defaults_exports, {
@@ -5549,7 +5596,9 @@ function createDefaultPipeline(user, course) {
5549
5596
  course,
5550
5597
  createDefaultEloDistanceStrategy(courseId)
5551
5598
  );
5552
- return new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5599
+ const pipeline = new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5600
+ pipeline.strategyHash = DEFAULT_STRATEGY_HASH;
5601
+ return pipeline;
5553
5602
  }
5554
5603
  var init_defaults = __esm({
5555
5604
  "src/core/navigators/defaults.ts"() {
@@ -5561,6 +5610,7 @@ var init_defaults = __esm({
5561
5610
  init_srs();
5562
5611
  init_eloDistance();
5563
5612
  init_types_legacy();
5613
+ init_versionStamps();
5564
5614
  }
5565
5615
  });
5566
5616
 
@@ -5704,6 +5754,7 @@ var init_PipelineAssembler = __esm({
5704
5754
  init_logger();
5705
5755
  init_CompositeGenerator();
5706
5756
  init_pipelinePlan();
5757
+ init_versionStamps();
5707
5758
  PipelineAssembler = class {
5708
5759
  /**
5709
5760
  * Assembles a navigation pipeline from strategy documents.
@@ -5785,6 +5836,7 @@ var init_PipelineAssembler = __esm({
5785
5836
  }
5786
5837
  }
5787
5838
  const pipeline = new Pipeline(generator, filters, user, course);
5839
+ pipeline.strategyHash = strategyHash(strategies);
5788
5840
  logger.debug(
5789
5841
  `[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
5790
5842
  );
@@ -8234,10 +8286,30 @@ var init_EloService = __esm({
8234
8286
  EloService = class {
8235
8287
  dataLayer;
8236
8288
  user;
8289
+ /** Per course ID: its compiled `CourseConfig.qaUsernamePattern`, or null. */
8290
+ qaPatterns = /* @__PURE__ */ new Map();
8237
8291
  constructor(dataLayer, user) {
8238
8292
  this.dataLayer = dataLayer;
8239
8293
  this.user = user;
8240
8294
  }
8295
+ /**
8296
+ * Whether the current user is one of the course's QA accounts
8297
+ * (`CourseConfig.qaUsernamePattern`), whose responses must not move card
8298
+ * ELO. The pattern is read once per course. If the config is unreadable or
8299
+ * the pattern doesn't compile, nobody is a QA account.
8300
+ */
8301
+ async isQaUser(courseDB) {
8302
+ const courseId = courseDB.getCourseID();
8303
+ let pattern = this.qaPatterns.get(courseId);
8304
+ if (!pattern) {
8305
+ pattern = courseDB.getCourseConfig().then((cfg) => cfg.qaUsernamePattern ? new RegExp(cfg.qaUsernamePattern, "i") : null).catch((e) => {
8306
+ logger.warn(`[EloService] No QA username pattern for ${courseId}: ${e}`);
8307
+ return null;
8308
+ });
8309
+ this.qaPatterns.set(courseId, pattern);
8310
+ }
8311
+ return (await pattern)?.test(this.user.getUsername()) ?? false;
8312
+ }
8241
8313
  /**
8242
8314
  * Updates both user and card ELO ratings based on user performance.
8243
8315
  * @param userScore Score between 0-1 representing user performance
@@ -8264,6 +8336,7 @@ var init_EloService = __esm({
8264
8336
  const userElo = (0, import_common16.toCourseElo)(courseReg.elo);
8265
8337
  const cardElo = (await courseDB.getCardEloData([currentCard.card.card_id]))[0];
8266
8338
  if (cardElo && userElo) {
8339
+ const writeCard = !await this.isQaUser(courseDB);
8267
8340
  const beforeUserGlobal = userElo.global.score;
8268
8341
  const beforeCardGlobal = cardElo.global.score;
8269
8342
  const cardTagKeys = Object.keys(cardElo.tags);
@@ -8287,12 +8360,18 @@ var init_EloService = __esm({
8287
8360
  at: (/* @__PURE__ */ new Date()).toISOString(),
8288
8361
  userScore,
8289
8362
  global: { before: beforeUserGlobal, after: eloUpdate.userElo.global.score },
8290
- card: { before: beforeCardGlobal, after: eloUpdate.cardElo.global.score },
8363
+ card: {
8364
+ before: beforeCardGlobal,
8365
+ after: writeCard ? eloUpdate.cardElo.global.score : beforeCardGlobal
8366
+ },
8291
8367
  ...cardTagKeys.length ? { tags } : {}
8292
8368
  };
8369
+ if (!writeCard) {
8370
+ logger.info(`[EloService] QA account: card ELO for ${card_id} not written`);
8371
+ }
8293
8372
  const results = await Promise.allSettled([
8294
8373
  this.user.updateUserElo(course_id, eloUpdate.userElo),
8295
- courseDB.updateCardElo(card_id, eloUpdate.cardElo)
8374
+ writeCard ? courseDB.updateCardElo(card_id, eloUpdate.cardElo) : Promise.resolve(null)
8296
8375
  ]);
8297
8376
  const userEloStatus = results[0].status === "fulfilled";
8298
8377
  const cardEloStatus = results[1].status === "fulfilled";
@@ -8359,6 +8438,7 @@ var init_EloService = __esm({
8359
8438
  }
8360
8439
  }
8361
8440
  if (cardElo && userElo) {
8441
+ const writeCard = !await this.isQaUser(courseDB);
8362
8442
  const beforeUserGlobal = userElo.global.score;
8363
8443
  const beforeCardGlobal = cardElo.global.score;
8364
8444
  const touchedTags = Object.keys(enriched).filter((key) => key !== "_global");
@@ -8390,12 +8470,18 @@ var init_EloService = __esm({
8390
8470
  at,
8391
8471
  userScore: globalScore,
8392
8472
  global: { before: beforeUserGlobal, after: eloUpdate.userElo.global.score },
8393
- card: { before: beforeCardGlobal, after: eloUpdate.cardElo.global.score },
8473
+ card: {
8474
+ before: beforeCardGlobal,
8475
+ after: writeCard ? eloUpdate.cardElo.global.score : beforeCardGlobal
8476
+ },
8394
8477
  ...touchedTags.length ? { tags } : {}
8395
8478
  };
8479
+ if (!writeCard) {
8480
+ logger.info(`[EloService] QA account: card ELO for ${card_id} not written`);
8481
+ }
8396
8482
  const results = await Promise.allSettled([
8397
8483
  this.user.updateUserElo(course_id, eloUpdate.userElo),
8398
- courseDB.updateCardElo(card_id, eloUpdate.cardElo)
8484
+ writeCard ? courseDB.updateCardElo(card_id, eloUpdate.cardElo) : Promise.resolve(null)
8399
8485
  ]);
8400
8486
  const userEloStatus = results[0].status === "fulfilled";
8401
8487
  const cardEloStatus = results[1].status === "fulfilled";
@@ -11708,6 +11794,7 @@ var init_SessionController = __esm({
11708
11794
  init_util2();
11709
11795
  init_navigators();
11710
11796
  init_Pipeline();
11797
+ init_versionStamps();
11711
11798
  init_SourceMixer();
11712
11799
  init_MixerDebugger();
11713
11800
  init_SessionDebugger();
@@ -12006,7 +12093,8 @@ var init_SessionController = __esm({
12006
12093
  ...run.discardedTail ? { discardedTail: run.discardedTail } : {},
12007
12094
  cards: persistedRunCards(run),
12008
12095
  ...run.unselectedNew ? { unselectedNew: persistedUnselectedNew(run.unselectedNew) } : {},
12009
- ...run.regulators ? { regulators: run.regulators.map(persistedReading) } : {}
12096
+ ...run.regulators ? { regulators: run.regulators.map(persistedReading) } : {},
12097
+ ...run.versions ? { versions: run.versions } : {}
12010
12098
  });
12011
12099
  }
12012
12100
  }
@@ -12043,6 +12131,7 @@ var init_SessionController = __esm({
12043
12131
  sourceCount: this.sources.length,
12044
12132
  initHints: this._sessionHints
12045
12133
  },
12134
+ versions: sessionVersions(),
12046
12135
  initialQueues: { supplyQ: this.supplyQ.length, failedQ: this.failedQ.length },
12047
12136
  runs: [...this._runLog],
12048
12137
  stateAtStart: await this._captureState("start")
@@ -15749,6 +15838,9 @@ async function initializeDataLayer(config) {
15749
15838
  if (config.options.localStoragePrefix) {
15750
15839
  ENV.LOCAL_STORAGE_PREFIX = config.options.localStoragePrefix;
15751
15840
  }
15841
+ if (config.options.appVersion) {
15842
+ setAppVersion(config.options.appVersion);
15843
+ }
15752
15844
  if (config.type === "couch") {
15753
15845
  if (!config.options.COUCHDB_SERVER_URL || !config.options.COUCHDB_SERVER_PROTOCOL) {
15754
15846
  throw new Error("Missing CouchDB server URL or protocol");
@@ -15805,6 +15897,7 @@ var init_factory = __esm({
15805
15897
  init_common();
15806
15898
  init_logger();
15807
15899
  init_navigators();
15900
+ init_versionStamps();
15808
15901
  NOT_SET = "NOT_SET";
15809
15902
  ENV = {
15810
15903
  COUCHDB_SERVER_PROTOCOL: NOT_SET,