@vue-skuilder/db 0.2.7 → 0.2.8

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.
package/dist/index.d.cts CHANGED
@@ -4,7 +4,7 @@ import { D as DataLayerProvider } from './dataLayerProvider-CiA2Rr0v.cjs';
4
4
  import { C as CardHistory, c as CardRecord, d as QuestionRecord } from './types-legacy-4tlwHnXo.cjs';
5
5
  export { e as CardData, f as CourseListData, h as DataShapeData, g as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-4tlwHnXo.cjs';
6
6
  import { Loggable } from './core/index.cjs';
7
- export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, FilterImpact, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, importParsedCards, isQuestionRecord, mountPipelineDebugger, mountUserDBDebugger, parseCardHistoryID, pipelineDebugAPI, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.cjs';
7
+ export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, FilterImpact, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineForecaster, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getActivePipeline, getCardHistoryID, getDefaultLearnableWeight, importParsedCards, isQuestionRecord, mountPipelineDebugger, mountUserDBDebugger, parseCardHistoryID, pipelineDebugAPI, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.cjs';
8
8
  import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
9
  import { S as StaticCourseManifest } from './types-BFUa1pa3.cjs';
10
10
  export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-BFUa1pa3.cjs';
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { D as DataLayerProvider } from './dataLayerProvider-DrBqOUa3.js';
4
4
  import { C as CardHistory, c as CardRecord, d as QuestionRecord } from './types-legacy-4tlwHnXo.js';
5
5
  export { e as CardData, f as CourseListData, h as DataShapeData, g as DisplayableData, D as DocType, b as DocTypePrefixes, F as Field, G as GuestUsername, Q as QualifiedCardID, i as QuestionData, S as SkuilderCourseData, a as Tag, T as TagStub, l as log } from './types-legacy-4tlwHnXo.js';
6
6
  import { Loggable } from './core/index.js';
7
- export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, FilterImpact, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getCardHistoryID, getDefaultLearnableWeight, importParsedCards, isQuestionRecord, mountPipelineDebugger, mountUserDBDebugger, parseCardHistoryID, pipelineDebugAPI, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.js';
7
+ export { BulkCardProcessorConfig, CardFilter, CardFilterFactory, DIVERSITY_FLOOR, DIVERSITY_STRENGTH, DiversityRerankOptions, FilterContext, FilterImpact, GeneratorSummary, GradientObservation, GradientResult, ImportResult, PeriodUpdateInput, PeriodUpdateResult, PipelineForecaster, PipelineRunReport, SignalConfig, StrategyLearningState, StrategyStateDoc, StrategyStateId, aggregateOutcomesForGradient, areQuestionRecords, buildStrategyStateId, computeOutcomeSignal, computeStrategyGradient, diversityRerank, docIsDeleted, getActivePipeline, getCardHistoryID, getDefaultLearnableWeight, importParsedCards, isQuestionRecord, mountPipelineDebugger, mountUserDBDebugger, parseCardHistoryID, pipelineDebugAPI, recordUserOutcome, runPeriodUpdate, scoreAccuracyInZone, updateLearningState, updateStrategyWeight, userDBDebugAPI, validateProcessorConfig } from './core/index.js';
8
8
  import { TaggedPerformance, TagFilter, DataShape, CourseConfig } from '@vue-skuilder/common';
9
9
  import { S as StaticCourseManifest } from './types-CHgpWQAY.js';
10
10
  export { A as AttachmentData, C as ChunkMetadata, D as DesignDocument, I as IndexMetadata, a as PackedCourseData, P as PackerConfig } from './types-CHgpWQAY.js';
package/dist/index.js CHANGED
@@ -967,6 +967,7 @@ __export(PipelineDebugger_exports, {
967
967
  buildRunReport: () => buildRunReport,
968
968
  captureRun: () => captureRun,
969
969
  clearRunHistory: () => clearRunHistory,
970
+ getActivePipeline: () => getActivePipeline,
970
971
  mountPipelineDebugger: () => mountPipelineDebugger,
971
972
  pipelineDebugAPI: () => pipelineDebugAPI,
972
973
  registerPipelineForDebug: () => registerPipelineForDebug
@@ -974,6 +975,9 @@ __export(PipelineDebugger_exports, {
974
975
  function registerPipelineForDebug(pipeline) {
975
976
  _activePipeline = pipeline;
976
977
  }
978
+ function getActivePipeline() {
979
+ return _activePipeline;
980
+ }
977
981
  function clearRunHistory() {
978
982
  runHistory.length = 0;
979
983
  }
@@ -5006,6 +5010,68 @@ var init_Pipeline = __esm({
5006
5010
  // ---------------------------------------------------------------------------
5007
5011
  // Card-space diagnostic
5008
5012
  // ---------------------------------------------------------------------------
5013
+ /**
5014
+ * Commit-free forecast: score the user's full card space through the filter
5015
+ * chain and return the cards that are currently *reachable* (score >=
5016
+ * threshold), optionally nudged by caller-supplied hints and/or restricted
5017
+ * to cards the user hasn't seen yet.
5018
+ *
5019
+ * This is a GENERIC primitive — it returns scored, tag-hydrated cards and
5020
+ * stops there. It has no knowledge of any particular tag convention; callers
5021
+ * decide what the surviving cards mean (e.g. filter to their own "intro"
5022
+ * tag family). Nothing is written and no session is started.
5023
+ *
5024
+ * The optional `hints` are the "out-of-band kick": they run through the same
5025
+ * {@link applyHints} path a live replan uses, so the two semantics carry over —
5026
+ * - `boostTags`/`boostCards` reweight *within* gating (a gated score-0 card
5027
+ * stays out), and
5028
+ * - `requireTags`/`requireCards` inject from the full pre-filter pool,
5029
+ * *bypassing* gating (use when you want a card regardless of reachability).
5030
+ * Note `unseenOnly` is applied LAST, so it can drop a `require`d card that the
5031
+ * user has already seen — pass `unseenOnly: false` if that matters.
5032
+ *
5033
+ * Cost note: like {@link diagnoseCardSpace}, this scans every card through the
5034
+ * filters, so it's heavier than a normal replan. Intended for one-shot
5035
+ * out-of-band use (e.g. a session-end "what's next" snapshot), not the hot path.
5036
+ *
5037
+ * @param opts.hints Optional ephemeral hints to apply after the filter chain.
5038
+ * @param opts.unseenOnly Only return cards the user hasn't encountered (default true).
5039
+ * @param opts.threshold Min score to count as reachable (default 0.10).
5040
+ * @param opts.limit Optional cap on results (already sorted desc).
5041
+ */
5042
+ async forecast(opts) {
5043
+ const threshold = opts?.threshold ?? 0.1;
5044
+ const unseenOnly = opts?.unseenOnly ?? true;
5045
+ const courseId = this.course.getCourseID();
5046
+ const allCardIds = await this.course.getAllCardIds();
5047
+ let cards = allCardIds.map((cardId) => ({
5048
+ cardId,
5049
+ courseId,
5050
+ score: 1,
5051
+ provenance: []
5052
+ }));
5053
+ cards = await this.hydrateTags(cards);
5054
+ const fullPool = cards.slice();
5055
+ const context = await this.buildContext();
5056
+ for (const filter of this.filters) {
5057
+ cards = await filter.transform(cards, context);
5058
+ }
5059
+ if (opts?.hints) {
5060
+ cards = this.applyHints(cards, opts.hints, fullPool);
5061
+ }
5062
+ cards = cards.filter((c) => c.score >= threshold);
5063
+ if (unseenOnly) {
5064
+ let encountered;
5065
+ try {
5066
+ encountered = new Set(await this.user.getSeenCards(courseId));
5067
+ } catch {
5068
+ encountered = /* @__PURE__ */ new Set();
5069
+ }
5070
+ cards = cards.filter((c) => !encountered.has(c.cardId));
5071
+ }
5072
+ cards.sort((a, b) => b.score - a.score);
5073
+ return opts?.limit ? cards.slice(0, opts.limit) : cards;
5074
+ }
5009
5075
  /**
5010
5076
  * Scan every card in the course through the filter chain and report
5011
5077
  * how many are "well indicated" (score >= threshold) for the current user.
@@ -5303,6 +5369,7 @@ __export(navigators_exports, {
5303
5369
  NavigatorRoles: () => NavigatorRoles,
5304
5370
  Navigators: () => Navigators,
5305
5371
  diversityRerank: () => diversityRerank,
5372
+ getActivePipeline: () => getActivePipeline,
5306
5373
  getCardOrigin: () => getCardOrigin,
5307
5374
  getRegisteredNavigator: () => getRegisteredNavigator,
5308
5375
  getRegisteredNavigatorNames: () => getRegisteredNavigatorNames,
@@ -10420,6 +10487,7 @@ __export(index_exports, {
10420
10487
  docIsDeleted: () => docIsDeleted,
10421
10488
  endSessionTracking: () => endSessionTracking,
10422
10489
  ensureAppDataDirectory: () => ensureAppDataDirectory,
10490
+ getActivePipeline: () => getActivePipeline,
10423
10491
  getAppDataDirectory: () => getAppDataDirectory,
10424
10492
  getCardHistoryID: () => getCardHistoryID,
10425
10493
  getCardOrigin: () => getCardOrigin,
@@ -15076,6 +15144,7 @@ init_factory();
15076
15144
  docIsDeleted,
15077
15145
  endSessionTracking,
15078
15146
  ensureAppDataDirectory,
15147
+ getActivePipeline,
15079
15148
  getAppDataDirectory,
15080
15149
  getCardHistoryID,
15081
15150
  getCardOrigin,