@vue-skuilder/db 0.2.31 → 0.2.32

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 (45) 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 +8 -2
  18. package/dist/impl/couch/index.d.ts +8 -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 +5 -3
  30. package/dist/index.d.ts +5 -3
  31. package/dist/index.js +63 -4
  32. package/dist/index.js.map +1 -1
  33. package/dist/index.mjs +63 -4
  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/tsup.config.ts +5 -0
@@ -4488,6 +4488,11 @@ var init_Pipeline = __esm({
4488
4488
  * This eliminates a remote getCourseConfig() round trip per pipeline run.
4489
4489
  */
4490
4490
  _cachedOrchestration = null;
4491
+ /**
4492
+ * Hash of the strategy docs this pipeline was assembled from (see
4493
+ * versionStamps.ts), set by whoever builds it. Stamped on every run.
4494
+ */
4495
+ strategyHash;
4491
4496
  /**
4492
4497
  * Persistent tag cache. Maps cardId → tag names.
4493
4498
  *
@@ -4681,7 +4686,8 @@ var init_Pipeline = __esm({
4681
4686
  logResultCards(result);
4682
4687
  logCardProvenance(result, 3);
4683
4688
  try {
4684
- const courseName = await this.course?.getCourseConfig().then((c) => c.name).catch(() => void 0);
4689
+ const courseConfig = await this.course?.getCourseConfig().catch(() => void 0);
4690
+ const courseName = courseConfig?.name;
4685
4691
  const report = buildRunReport(
4686
4692
  this.course?.getCourseID() || "unknown",
4687
4693
  courseName,
@@ -4696,7 +4702,11 @@ var init_Pipeline = __esm({
4696
4702
  scoredCards,
4697
4703
  regulators
4698
4704
  );
4699
- captureRun(report);
4705
+ const versions = {
4706
+ ...this.strategyHash ? { strategies: this.strategyHash } : {},
4707
+ ...courseConfig?.contentVersion ? { content: courseConfig.contentVersion } : {}
4708
+ };
4709
+ captureRun({ ...report, ...Object.keys(versions).length ? { versions } : {} });
4700
4710
  } catch (e) {
4701
4711
  logger.debug(`[Pipeline] Failed to capture debug run: ${e}`);
4702
4712
  }
@@ -5193,6 +5203,36 @@ var init_Pipeline = __esm({
5193
5203
  }
5194
5204
  });
5195
5205
 
5206
+ // src/core/versionStamps.ts
5207
+ function stableStringify(value) {
5208
+ if (Array.isArray(value)) return `[${value.map(stableStringify).join(",")}]`;
5209
+ if (value && typeof value === "object") {
5210
+ const entries = Object.entries(value).filter(([, v]) => v !== void 0).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
5211
+ return `{${entries.map(([k, v]) => `${JSON.stringify(k)}:${stableStringify(v)}`).join(",")}}`;
5212
+ }
5213
+ return JSON.stringify(value);
5214
+ }
5215
+ function strategyHash(strategies) {
5216
+ if (strategies.length === 0) return DEFAULT_STRATEGY_HASH;
5217
+ const text = strategies.map((s) => {
5218
+ const { _rev: _ignored, ...rest } = s;
5219
+ return stableStringify(rest);
5220
+ }).sort().join("\n");
5221
+ let h = 2166136261;
5222
+ for (let i = 0; i < text.length; i++) {
5223
+ h ^= text.charCodeAt(i);
5224
+ h = Math.imul(h, 16777619);
5225
+ }
5226
+ return (h >>> 0).toString(16).padStart(8, "0");
5227
+ }
5228
+ var DEFAULT_STRATEGY_HASH;
5229
+ var init_versionStamps = __esm({
5230
+ "src/core/versionStamps.ts"() {
5231
+ "use strict";
5232
+ DEFAULT_STRATEGY_HASH = "default";
5233
+ }
5234
+ });
5235
+
5196
5236
  // src/core/navigators/defaults.ts
5197
5237
  var defaults_exports = {};
5198
5238
  __export(defaults_exports, {
@@ -5245,7 +5285,9 @@ function createDefaultPipeline(user, course) {
5245
5285
  course,
5246
5286
  createDefaultEloDistanceStrategy(courseId)
5247
5287
  );
5248
- return new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5288
+ const pipeline = new Pipeline(compositeGenerator, [eloDistanceFilter], user, course);
5289
+ pipeline.strategyHash = DEFAULT_STRATEGY_HASH;
5290
+ return pipeline;
5249
5291
  }
5250
5292
  var init_defaults = __esm({
5251
5293
  "src/core/navigators/defaults.ts"() {
@@ -5257,6 +5299,7 @@ var init_defaults = __esm({
5257
5299
  init_srs();
5258
5300
  init_eloDistance();
5259
5301
  init_types_legacy();
5302
+ init_versionStamps();
5260
5303
  }
5261
5304
  });
5262
5305
 
@@ -5400,6 +5443,7 @@ var init_PipelineAssembler = __esm({
5400
5443
  init_logger();
5401
5444
  init_CompositeGenerator();
5402
5445
  init_pipelinePlan();
5446
+ init_versionStamps();
5403
5447
  PipelineAssembler = class {
5404
5448
  /**
5405
5449
  * Assembles a navigation pipeline from strategy documents.
@@ -5481,6 +5525,7 @@ var init_PipelineAssembler = __esm({
5481
5525
  }
5482
5526
  }
5483
5527
  const pipeline = new Pipeline(generator, filters, user, course);
5528
+ pipeline.strategyHash = strategyHash(strategies);
5484
5529
  logger.debug(
5485
5530
  `[PipelineAssembler] Assembled pipeline with ${generatorStrategies.length} generator(s) and ${filters.length} filter(s)`
5486
5531
  );
@@ -9734,6 +9779,7 @@ var init_SessionController = __esm({
9734
9779
  init_util2();
9735
9780
  init_navigators();
9736
9781
  init_Pipeline();
9782
+ init_versionStamps();
9737
9783
  init_SourceMixer();
9738
9784
  init_MixerDebugger();
9739
9785
  init_SessionDebugger();
@@ -11136,6 +11182,7 @@ var init_factory = __esm({
11136
11182
  init_common();
11137
11183
  init_logger();
11138
11184
  init_navigators();
11185
+ init_versionStamps();
11139
11186
  NOT_SET = "NOT_SET";
11140
11187
  ENV = {
11141
11188
  COUCHDB_SERVER_PROTOCOL: NOT_SET,