@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
@@ -1,8 +1,9 @@
1
- import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-D3c1fMAk.cjs';
2
- import { D as DataLayerProvider } from '../../dataLayerProvider-CeLiFbHv.cjs';
3
- import { S as StaticCourseManifest } from '../../types-DjiFOZxJ.cjs';
1
+ import { C as ClassroomDBInterface, A as AdminDBInterface } from '../../classroomDB-DLTtLZct.cjs';
2
+ import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, i as CourseInfo, j as StudySessionItem, D as DataLayerResult, k as ContentNavigationStrategyData, l as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-DpQqTG3m.cjs';
3
+ import { D as DataLayerProvider } from '../../dataLayerProvider-Dl3cAAvQ.cjs';
4
+ import { S as StaticCourseManifest } from '../../types-D0oQeJAi.cjs';
4
5
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
5
- import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-CrwyZIvI.cjs';
6
+ import { S as SkuilderCourseData, d as QualifiedCardID, e as TagStub, T as Tag } from '../../types-legacy-BkOYOR6U.cjs';
6
7
  import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-BXliog1m.cjs';
7
8
  import 'moment';
8
9
 
@@ -32,7 +33,6 @@ declare class StaticDataLayerProvider implements DataLayerProvider {
32
33
  getCoursesDB(): CoursesDBInterface;
33
34
  getClassroomDB(_classId: string, _type: 'student' | 'teacher'): Promise<ClassroomDBInterface>;
34
35
  getAdminDB(): AdminDBInterface;
35
- createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
36
36
  isReadOnly(): boolean;
37
37
  }
38
38
 
@@ -1,8 +1,9 @@
1
- import { U as UserDBInterface, C as CourseDBInterface, b as CoursesDBInterface, c as ClassroomDBInterface, A as AdminDBInterface, a as UserDBReader, d as CourseInfo, S as StudySessionItem, D as DataLayerResult, e as ContentNavigationStrategyData, f as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-LPf044hY.js';
2
- import { D as DataLayerProvider } from '../../dataLayerProvider-DaAootVV.js';
3
- import { S as StaticCourseManifest } from '../../types-uJ2Xn3_X.js';
1
+ import { C as ClassroomDBInterface, A as AdminDBInterface } from '../../classroomDB-DLTtLZct.js';
2
+ import { U as UserDBInterface, C as CourseDBInterface, a as CoursesDBInterface, i as CourseInfo, j as StudySessionItem, D as DataLayerResult, k as ContentNavigationStrategyData, l as ContentNavigator, R as ReplanHints, G as GeneratorResult } from '../../contentSource-BoFBwvYa.js';
3
+ import { D as DataLayerProvider } from '../../dataLayerProvider-D_LJT3F4.js';
4
+ import { S as StaticCourseManifest } from '../../types-dXWfyz9B.js';
4
5
  import { CourseConfig, CourseElo, DataShape } from '@vue-skuilder/common';
5
- import { S as SkuilderCourseData, Q as QualifiedCardID, T as TagStub, a as Tag } from '../../types-legacy-CrwyZIvI.js';
6
+ import { S as SkuilderCourseData, d as QualifiedCardID, e as TagStub, T as Tag } from '../../types-legacy-BkOYOR6U.js';
6
7
  import { S as SyncStrategy, A as AccountCreationResult, a as AuthenticationResult } from '../../SyncStrategy-BXliog1m.js';
7
8
  import 'moment';
8
9
 
@@ -32,7 +33,6 @@ declare class StaticDataLayerProvider implements DataLayerProvider {
32
33
  getCoursesDB(): CoursesDBInterface;
33
34
  getClassroomDB(_classId: string, _type: 'student' | 'teacher'): Promise<ClassroomDBInterface>;
34
35
  getAdminDB(): AdminDBInterface;
35
- createUserReaderForUser(targetUsername: string): Promise<UserDBReader>;
36
36
  isReadOnly(): boolean;
37
37
  }
38
38
 
@@ -532,7 +532,7 @@ function parseCardElo(provenance) {
532
532
  const match = eloEntry.reason.match(/card:\s*(\d+)/);
533
533
  return match ? parseInt(match[1], 10) : void 0;
534
534
  }
535
- function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints) {
535
+ function buildRunReport(courseId, courseName, generatorName, generators, generatedCount, filters, allCards, selectedCards, userElo, hints, scoredCards) {
536
536
  const selectedIds = new Set(selectedCards.map((c) => c.cardId));
537
537
  const toReport = (card) => ({
538
538
  cardId: card.cardId,
@@ -585,6 +585,23 @@ function buildRunReport(courseId, courseName, generatorName, generators, generat
585
585
  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.`
586
586
  };
587
587
  }
588
+ const isUnselectedNew = (c) => !c.reviewID && !selectedIds.has(c.cardId);
589
+ const generatorScore = (c) => c.provenance[0]?.score ?? 0;
590
+ const keptIds = new Set(allCards.map((c) => c.cardId));
591
+ const hintExcluded = (c) => c.score > 0 && !keptIds.has(c.cardId);
592
+ let nextInLine;
593
+ for (const c of allCards) {
594
+ if (isUnselectedNew(c) && (!nextInLine || c.score > nextInLine.score)) nextInLine = c;
595
+ }
596
+ let topGenerated;
597
+ for (const c of scoredCards ?? allCards) {
598
+ if (!isUnselectedNew(c) || hintExcluded(c)) continue;
599
+ if (!topGenerated || generatorScore(c) > generatorScore(topGenerated)) topGenerated = c;
600
+ }
601
+ const unselectedNew = nextInLine || topGenerated ? {
602
+ ...nextInLine ? { nextInLine: toReport(nextInLine) } : {},
603
+ ...topGenerated && topGenerated.cardId !== nextInLine?.cardId ? { topGenerated: toReport(topGenerated) } : {}
604
+ } : void 0;
588
605
  const reviewsSelected = selectedCards.filter((c) => getOrigin(c) === "review").length;
589
606
  const newSelected = selectedCards.filter((c) => getOrigin(c) === "new").length;
590
607
  return {
@@ -600,6 +617,7 @@ function buildRunReport(courseId, courseName, generatorName, generators, generat
600
617
  reviewsSelected,
601
618
  newSelected,
602
619
  cards,
620
+ unselectedNew,
603
621
  discardedTail
604
622
  };
605
623
  }
@@ -1698,7 +1716,8 @@ var init_generators = __esm({
1698
1716
  // src/core/navigators/generators/prescribed.ts
1699
1717
  var prescribed_exports = {};
1700
1718
  __export(prescribed_exports, {
1701
- default: () => PrescribedCardsGenerator
1719
+ default: () => PrescribedCardsGenerator,
1720
+ unmetIntroExposeTags: () => unmetIntroExposeTags
1702
1721
  });
1703
1722
  function dedupe(arr) {
1704
1723
  return [...new Set(arr)];
@@ -1738,6 +1757,19 @@ function formatAge(ms) {
1738
1757
  if (hours < 24) return `${hours}h`;
1739
1758
  return `${Math.round(hours / 24)}d`;
1740
1759
  }
1760
+ function unmetIntroExposeTags(tags, userTagElo, minCount) {
1761
+ if (minCount <= 0) return [];
1762
+ const exposeTags = new Set(tags.filter((tag) => tag.startsWith("gpc:expose:")));
1763
+ for (const tag of tags) {
1764
+ if (!tag.startsWith("gpc:intro:")) continue;
1765
+ const suffix = tag.slice("gpc:intro:".length);
1766
+ if (suffix) exposeTags.add(`gpc:expose:${suffix}`);
1767
+ }
1768
+ return [...exposeTags].filter((tag) => {
1769
+ const tagElo = userTagElo[tag];
1770
+ return !tagElo || tagElo.count < minCount;
1771
+ });
1772
+ }
1741
1773
  function pickTopByScore(cards, limit) {
1742
1774
  return [...cards].sort((a, b) => b.score - a.score || a.cardId.localeCompare(b.cardId)).slice(0, limit);
1743
1775
  }
@@ -2036,6 +2068,7 @@ var init_prescribed = __esm({
2036
2068
  freshnessWindowSessions: typeof raw.freshnessWindowSessions === "number" ? raw.freshnessWindowSessions : DEFAULT_FRESHNESS_WINDOW,
2037
2069
  maxDirectTargetsPerRun: typeof raw.maxDirectTargetsPerRun === "number" ? raw.maxDirectTargetsPerRun : DEFAULT_MAX_DIRECT_PER_RUN,
2038
2070
  maxSupportCardsPerRun: typeof raw.maxSupportCardsPerRun === "number" ? raw.maxSupportCardsPerRun : DEFAULT_MAX_SUPPORT_PER_RUN,
2071
+ introExposeMinCount: typeof raw.introExposeMinCount === "number" ? raw.introExposeMinCount : DEFAULT_MIN_COUNT,
2039
2072
  hierarchyWalk: {
2040
2073
  enabled: raw.hierarchyWalk?.enabled !== false,
2041
2074
  maxDepth: typeof raw.hierarchyWalk?.maxDepth === "number" ? raw.hierarchyWalk.maxDepth : DEFAULT_HIERARCHY_DEPTH
@@ -2111,18 +2144,11 @@ var init_prescribed = __esm({
2111
2144
  group.hierarchyWalk?.enabled !== false,
2112
2145
  group.hierarchyWalk?.maxDepth ?? DEFAULT_HIERARCHY_DEPTH
2113
2146
  );
2114
- const introTags = tags.filter((tag) => tag.startsWith("gpc:intro:"));
2115
- const exposeTags = new Set(tags.filter((tag) => tag.startsWith("gpc:expose:")));
2116
- for (const introTag of introTags) {
2117
- const suffix = introTag.slice("gpc:intro:".length);
2118
- if (suffix) {
2119
- exposeTags.add(`gpc:expose:${suffix}`);
2120
- }
2121
- }
2122
- const unmetExposeTags = [...exposeTags].filter((tag) => {
2123
- const tagElo = userTagElo[tag];
2124
- return !tagElo || tagElo.count < DEFAULT_MIN_COUNT;
2125
- });
2147
+ const unmetExposeTags = unmetIntroExposeTags(
2148
+ tags,
2149
+ userTagElo,
2150
+ group.introExposeMinCount ?? DEFAULT_MIN_COUNT
2151
+ );
2126
2152
  if (unmetExposeTags.length > 0) {
2127
2153
  unmetExposeTags.forEach((tag) => supportTags.add(tag));
2128
2154
  }
@@ -4165,6 +4191,7 @@ var init_Pipeline = __esm({
4165
4191
  }
4166
4192
  logger.debug(`[Pipeline] Filter '${filter.name}': ${beforeScores.size} \u2192 ${cards.length} cards (\u2191${boosted} \u2193${penalized} =${passed})`);
4167
4193
  }
4194
+ const scoredCards = cards;
4168
4195
  cards = cards.filter((c) => c.score > 0);
4169
4196
  const hints = this._ephemeralHints;
4170
4197
  if (hints) {
@@ -4201,7 +4228,8 @@ var init_Pipeline = __esm({
4201
4228
  cards,
4202
4229
  result,
4203
4230
  context.userElo,
4204
- hints ?? void 0
4231
+ hints ?? void 0,
4232
+ scoredCards
4205
4233
  );
4206
4234
  captureRun(report);
4207
4235
  } catch (e) {
@@ -10213,12 +10241,6 @@ var init_StaticDataLayerProvider = __esm({
10213
10241
  getAdminDB() {
10214
10242
  throw new Error("Admin functions not supported in static mode");
10215
10243
  }
10216
- async createUserReaderForUser(targetUsername) {
10217
- logger.warn(`StaticDataLayerProvider: Multi-user access not supported in static mode`);
10218
- logger.warn(`Request: trying to access data for ${targetUsername}`);
10219
- logger.warn(`Returning current user's data instead`);
10220
- return this.getUserDB();
10221
- }
10222
10244
  isReadOnly() {
10223
10245
  return true;
10224
10246
  }