@vue-skuilder/db 0.2.26 → 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 (61) 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 +43 -15
  8. package/dist/core/index.js.map +1 -1
  9. package/dist/core/index.mjs +43 -15
  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 +43 -15
  22. package/dist/impl/couch/index.js.map +1 -1
  23. package/dist/impl/couch/index.mjs +43 -15
  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 +43 -21
  28. package/dist/impl/static/index.js.map +1 -1
  29. package/dist/impl/static/index.mjs +43 -21
  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 +85 -36
  36. package/dist/index.js.map +1 -1
  37. package/dist/index.mjs +85 -36
  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/generators/prescribed.ts +43 -14
  50. package/src/core/navigators/index.ts +1 -0
  51. package/src/core/types/studySession.ts +37 -0
  52. package/src/diagnostics/dataset.ts +231 -0
  53. package/src/diagnostics/derive.ts +555 -0
  54. package/src/diagnostics/index.ts +24 -0
  55. package/src/diagnostics/loader.ts +191 -0
  56. package/src/diagnostics/text.ts +242 -0
  57. package/src/impl/couch/PouchDataLayerProvider.ts +0 -23
  58. package/src/impl/static/StaticDataLayerProvider.ts +0 -11
  59. package/src/study/SessionController.ts +56 -2
  60. package/tests/core/navigators/prescribedIntroExposure.test.ts +29 -0
  61. package/tsup.config.ts +1 -0
@@ -509,7 +509,7 @@ function parseCardElo(provenance) {
509
509
  const match = eloEntry.reason.match(/card:\s*(\d+)/);
510
510
  return match ? parseInt(match[1], 10) : void 0;
511
511
  }
512
- function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints) {
512
+ function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints, scoredCards) {
513
513
  const selectedIds = new Set(selectedCards.map((c) => c.cardId));
514
514
  const toReport = (card) => ({
515
515
  cardId: card.cardId,
@@ -562,6 +562,23 @@ function buildRunReport(courseId, courseName, generatorName, generators, generat
562
562
  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.`
563
563
  };
564
564
  }
565
+ const isUnselectedNew = (c) => !c.reviewID && !selectedIds.has(c.cardId);
566
+ const generatorScore = (c) => c.provenance[0]?.score ?? 0;
567
+ const keptIds = new Set(allCards.map((c) => c.cardId));
568
+ const hintExcluded = (c) => c.score > 0 && !keptIds.has(c.cardId);
569
+ let nextInLine;
570
+ for (const c of allCards) {
571
+ if (isUnselectedNew(c) && (!nextInLine || c.score > nextInLine.score)) nextInLine = c;
572
+ }
573
+ let topGenerated;
574
+ for (const c of scoredCards ?? allCards) {
575
+ if (!isUnselectedNew(c) || hintExcluded(c)) continue;
576
+ if (!topGenerated || generatorScore(c) > generatorScore(topGenerated)) topGenerated = c;
577
+ }
578
+ const unselectedNew = nextInLine || topGenerated ? {
579
+ ...nextInLine ? { nextInLine: toReport(nextInLine) } : {},
580
+ ...topGenerated && topGenerated.cardId !== nextInLine?.cardId ? { topGenerated: toReport(topGenerated) } : {}
581
+ } : void 0;
565
582
  const reviewsSelected = selectedCards.filter((c) => getOrigin(c) === "review").length;
566
583
  const newSelected = selectedCards.filter((c) => getOrigin(c) === "new").length;
567
584
  return {
@@ -577,6 +594,7 @@ function buildRunReport(courseId, courseName, generatorName, generators, generat
577
594
  reviewsSelected,
578
595
  newSelected,
579
596
  cards,
597
+ unselectedNew,
580
598
  discardedTail
581
599
  };
582
600
  }
@@ -1675,7 +1693,8 @@ var init_generators = __esm({
1675
1693
  // src/core/navigators/generators/prescribed.ts
1676
1694
  var prescribed_exports = {};
1677
1695
  __export(prescribed_exports, {
1678
- default: () => PrescribedCardsGenerator
1696
+ default: () => PrescribedCardsGenerator,
1697
+ unmetIntroExposeTags: () => unmetIntroExposeTags
1679
1698
  });
1680
1699
  function dedupe(arr) {
1681
1700
  return [...new Set(arr)];
@@ -1715,6 +1734,19 @@ function formatAge(ms) {
1715
1734
  if (hours < 24) return `${hours}h`;
1716
1735
  return `${Math.round(hours / 24)}d`;
1717
1736
  }
1737
+ function unmetIntroExposeTags(tags, userTagElo, minCount) {
1738
+ if (minCount <= 0) return [];
1739
+ const exposeTags = new Set(tags.filter((tag) => tag.startsWith("gpc:expose:")));
1740
+ for (const tag of tags) {
1741
+ if (!tag.startsWith("gpc:intro:")) continue;
1742
+ const suffix = tag.slice("gpc:intro:".length);
1743
+ if (suffix) exposeTags.add(`gpc:expose:${suffix}`);
1744
+ }
1745
+ return [...exposeTags].filter((tag) => {
1746
+ const tagElo = userTagElo[tag];
1747
+ return !tagElo || tagElo.count < minCount;
1748
+ });
1749
+ }
1718
1750
  function pickTopByScore(cards, limit) {
1719
1751
  return [...cards].sort((a, b) => b.score - a.score || a.cardId.localeCompare(b.cardId)).slice(0, limit);
1720
1752
  }
@@ -2013,6 +2045,7 @@ var init_prescribed = __esm({
2013
2045
  freshnessWindowSessions: typeof raw.freshnessWindowSessions === "number" ? raw.freshnessWindowSessions : DEFAULT_FRESHNESS_WINDOW,
2014
2046
  maxDirectTargetsPerRun: typeof raw.maxDirectTargetsPerRun === "number" ? raw.maxDirectTargetsPerRun : DEFAULT_MAX_DIRECT_PER_RUN,
2015
2047
  maxSupportCardsPerRun: typeof raw.maxSupportCardsPerRun === "number" ? raw.maxSupportCardsPerRun : DEFAULT_MAX_SUPPORT_PER_RUN,
2048
+ introExposeMinCount: typeof raw.introExposeMinCount === "number" ? raw.introExposeMinCount : DEFAULT_MIN_COUNT,
2016
2049
  hierarchyWalk: {
2017
2050
  enabled: raw.hierarchyWalk?.enabled !== false,
2018
2051
  maxDepth: typeof raw.hierarchyWalk?.maxDepth === "number" ? raw.hierarchyWalk.maxDepth : DEFAULT_HIERARCHY_DEPTH
@@ -2088,18 +2121,11 @@ var init_prescribed = __esm({
2088
2121
  group.hierarchyWalk?.enabled !== false,
2089
2122
  group.hierarchyWalk?.maxDepth ?? DEFAULT_HIERARCHY_DEPTH
2090
2123
  );
2091
- const introTags = tags.filter((tag) => tag.startsWith("gpc:intro:"));
2092
- const exposeTags = new Set(tags.filter((tag) => tag.startsWith("gpc:expose:")));
2093
- for (const introTag of introTags) {
2094
- const suffix = introTag.slice("gpc:intro:".length);
2095
- if (suffix) {
2096
- exposeTags.add(`gpc:expose:${suffix}`);
2097
- }
2098
- }
2099
- const unmetExposeTags = [...exposeTags].filter((tag) => {
2100
- const tagElo = userTagElo[tag];
2101
- return !tagElo || tagElo.count < DEFAULT_MIN_COUNT;
2102
- });
2124
+ const unmetExposeTags = unmetIntroExposeTags(
2125
+ tags,
2126
+ userTagElo,
2127
+ group.introExposeMinCount ?? DEFAULT_MIN_COUNT
2128
+ );
2103
2129
  if (unmetExposeTags.length > 0) {
2104
2130
  unmetExposeTags.forEach((tag) => supportTags.add(tag));
2105
2131
  }
@@ -4142,6 +4168,7 @@ var init_Pipeline = __esm({
4142
4168
  }
4143
4169
  logger.debug(`[Pipeline] Filter '${filter.name}': ${beforeScores.size} \u2192 ${cards.length} cards (\u2191${boosted} \u2193${penalized} =${passed})`);
4144
4170
  }
4171
+ const scoredCards = cards;
4145
4172
  cards = cards.filter((c) => c.score > 0);
4146
4173
  const hints = this._ephemeralHints;
4147
4174
  if (hints) {
@@ -4178,7 +4205,8 @@ var init_Pipeline = __esm({
4178
4205
  cards,
4179
4206
  result,
4180
4207
  context.userElo,
4181
- hints ?? void 0
4208
+ hints ?? void 0,
4209
+ scoredCards
4182
4210
  );
4183
4211
  captureRun(report);
4184
4212
  } catch (e) {
@@ -10192,12 +10220,6 @@ var init_StaticDataLayerProvider = __esm({
10192
10220
  getAdminDB() {
10193
10221
  throw new Error("Admin functions not supported in static mode");
10194
10222
  }
10195
- async createUserReaderForUser(targetUsername) {
10196
- logger.warn(`StaticDataLayerProvider: Multi-user access not supported in static mode`);
10197
- logger.warn(`Request: trying to access data for ${targetUsername}`);
10198
- logger.warn(`Returning current user's data instead`);
10199
- return this.getUserDB();
10200
- }
10201
10223
  isReadOnly() {
10202
10224
  return true;
10203
10225
  }