@vue-skuilder/standalone-ui 0.2.2 → 0.2.3

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.
@@ -27958,7 +27958,10 @@ var import___vite_browser_external, import___vite_browser_external$1, import___v
27958
27958
  init_signal(), init_types_legacy(), init_logger();
27959
27959
  } }), init_orchestration = __esm({ "src/core/orchestration/index.ts"() {
27960
27960
  init_logger(), init_gradient(), init_learning(), init_signal(), init_recording(), MIN_SPREAD = .1, MAX_SPREAD = .5, MIN_WEIGHT = .1, MAX_WEIGHT = 3;
27961
- } }), Pipeline_exports = {}, __export(Pipeline_exports, { Pipeline: () => Pipeline }), init_Pipeline = __esm({ "src/core/navigators/Pipeline.ts"() {
27961
+ } }), Pipeline_exports = {}, __export(Pipeline_exports, {
27962
+ Pipeline: () => Pipeline,
27963
+ mergeHints: () => mergeHints2
27964
+ }), init_Pipeline = __esm({ "src/core/navigators/Pipeline.ts"() {
27962
27965
  init_navigators(), init_logger(), init_orchestration(), init_PipelineDebugger(), VERBOSE_RESULTS = !0, Pipeline = class extends ContentNavigator {
27963
27966
  constructor(t, c, u, d) {
27964
27967
  super(), _defineProperty$2(this, "generator", void 0), _defineProperty$2(this, "filters", void 0), _defineProperty$2(this, "_cachedOrchestration", null), _defineProperty$2(this, "_tagCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_ephemeralHints", null), this.generator = t, this.filters = c, this.user = u, this.course = d, d.getCourseConfig().then((t) => {
@@ -30974,7 +30977,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
30974
30977
  return `${typeof this.q[0]}:
30975
30978
  ` + this.q.map((t) => ` ${t.courseID}+${t.cardID}: ${t.status}`).join("\n");
30976
30979
  }
30977
- }, init_couch(), init_recording(), init_Loggable(), init_types_legacy(), init_logger(), CouchDBToStaticPacker = class {
30980
+ }, init_couch(), init_core(), init_recording(), init_Loggable(), init_types_legacy(), init_logger(), CouchDBToStaticPacker = class {
30978
30981
  constructor(t = {}) {
30979
30982
  _defineProperty$2(this, "config", void 0), _defineProperty$2(this, "sourceDB", null), this.config = {
30980
30983
  chunkSize: 1e3,
@@ -31574,7 +31577,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31574
31577
  isLocalPath(t) {
31575
31578
  return !t.startsWith("http://") && !t.startsWith("https://");
31576
31579
  }
31577
- }, init_dataDirectory(), init_navigators(), QuotaRoundRobinMixer = class {
31580
+ }, init_dataDirectory(), init_navigators(), init_Pipeline(), QuotaRoundRobinMixer = class {
31578
31581
  mix(t, c) {
31579
31582
  if (t.length === 0) return [];
31580
31583
  let u = Math.ceil(c / t.length), d = t.map((t) => [...t.weighted].sort((t, c) => c.score - t.score).slice(0, u));
@@ -31747,7 +31750,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31747
31750
  return this.newQ.toString + "\n" + this.reviewQ.toString + "\n" + this.failedQ.toString;
31748
31751
  }
31749
31752
  constructor(t, c, u, d, m, g) {
31750
- super(), _defineProperty$2(this, "_className", "SessionController"), _defineProperty$2(this, "services", void 0), _defineProperty$2(this, "srsService", void 0), _defineProperty$2(this, "eloService", void 0), _defineProperty$2(this, "hydrationService", void 0), _defineProperty$2(this, "mixer", void 0), _defineProperty$2(this, "dataLayer", void 0), _defineProperty$2(this, "courseNameCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_defaultBatchLimit", 20), _defineProperty$2(this, "_initialReviewCap", 200), _defineProperty$2(this, "sources", void 0), _defineProperty$2(this, "_sessionRecord", []), _defineProperty$2(this, "_currentCard", null), _defineProperty$2(this, "reviewQ", new ItemQueue()), _defineProperty$2(this, "newQ", new ItemQueue()), _defineProperty$2(this, "failedQ", new ItemQueue()), _defineProperty$2(this, "_replanPromise", null), _defineProperty$2(this, "_wellIndicatedRemaining", 0), _defineProperty$2(this, "_suppressQualityReplan", !1), _defineProperty$2(this, "_minCardsGuarantee", 0), _defineProperty$2(this, "startTime", void 0), _defineProperty$2(this, "endTime", void 0), _defineProperty$2(this, "_secondsRemaining", void 0), _defineProperty$2(this, "_intervalHandle", void 0), this.dataLayer = u, this.mixer = m || new QuotaRoundRobinMixer(), this.srsService = new SrsService(u.getUserDB()), this.eloService = new EloService(u, u.getUserDB()), this.hydrationService = new CardHydrationService(d, (t) => u.getCourseDB(t), () => this._getItemsToHydrate()), this.services = { response: new ResponseProcessor(this.srsService, this.eloService) }, this.sources = t, this.startTime = /* @__PURE__ */ new Date(), this._secondsRemaining = c, this.endTime = new Date(this.startTime.valueOf() + 1e3 * this._secondsRemaining), g?.defaultBatchLimit !== void 0 && (this._defaultBatchLimit = g.defaultBatchLimit), g?.initialReviewCap !== void 0 && (this._initialReviewCap = g.initialReviewCap), this.log(`Session constructed:
31753
+ super(), _defineProperty$2(this, "_className", "SessionController"), _defineProperty$2(this, "services", void 0), _defineProperty$2(this, "srsService", void 0), _defineProperty$2(this, "eloService", void 0), _defineProperty$2(this, "hydrationService", void 0), _defineProperty$2(this, "mixer", void 0), _defineProperty$2(this, "dataLayer", void 0), _defineProperty$2(this, "courseNameCache", /* @__PURE__ */ new Map()), _defineProperty$2(this, "_defaultBatchLimit", 20), _defineProperty$2(this, "_initialReviewCap", 200), _defineProperty$2(this, "sources", void 0), _defineProperty$2(this, "_sessionRecord", []), _defineProperty$2(this, "_currentCard", null), _defineProperty$2(this, "reviewQ", new ItemQueue()), _defineProperty$2(this, "newQ", new ItemQueue()), _defineProperty$2(this, "failedQ", new ItemQueue()), _defineProperty$2(this, "_replanPromise", null), _defineProperty$2(this, "_wellIndicatedRemaining", 0), _defineProperty$2(this, "_suppressQualityReplan", !1), _defineProperty$2(this, "_minCardsGuarantee", 0), _defineProperty$2(this, "_sessionHints", null), _defineProperty$2(this, "_outcomeObservers", []), _defineProperty$2(this, "_sessionControls", null), _defineProperty$2(this, "startTime", void 0), _defineProperty$2(this, "endTime", void 0), _defineProperty$2(this, "_secondsRemaining", void 0), _defineProperty$2(this, "_intervalHandle", void 0), this.dataLayer = u, this.mixer = m || new QuotaRoundRobinMixer(), this.srsService = new SrsService(u.getUserDB()), this.eloService = new EloService(u, u.getUserDB()), this.hydrationService = new CardHydrationService(d, (t) => u.getCourseDB(t), () => this._getItemsToHydrate()), this.services = { response: new ResponseProcessor(this.srsService, this.eloService) }, this.sources = t, this.startTime = /* @__PURE__ */ new Date(), this._secondsRemaining = c, this.endTime = new Date(this.startTime.valueOf() + 1e3 * this._secondsRemaining), g?.defaultBatchLimit !== void 0 && (this._defaultBatchLimit = g.defaultBatchLimit), g?.initialReviewCap !== void 0 && (this._initialReviewCap = g.initialReviewCap), g?.outcomeObservers?.length && (this._outcomeObservers = [...g.outcomeObservers]), this.log(`Session constructed:
31751
31754
  startTime: ${this.startTime}
31752
31755
  endTime: ${this.endTime}
31753
31756
  defaultBatchLimit: ${this._defaultBatchLimit}
@@ -31796,23 +31799,54 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31796
31799
  }), await d;
31797
31800
  }
31798
31801
  _replanHasIntent(t) {
31799
- return !!(t.label || t.limit !== void 0 || t.minFollowUpCards !== void 0 || t.mode && t.mode !== "replace" || t.hints && Object.keys(t.hints).length > 0);
31802
+ return !!(t.label || t.limit !== void 0 || t.minFollowUpCards !== void 0 || t.mode && t.mode !== "replace" || t.hints && Object.keys(t.hints).length > 0 || t.sessionHints !== void 0);
31800
31803
  }
31801
31804
  async _runReplan(t) {
31802
31805
  t.hints || (t.hints = {});
31803
31806
  let c = t.hints, u = new Set(c.excludeCards ?? []);
31804
31807
  this._currentCard?.item.cardID && u.add(this._currentCard.item.cardID);
31805
31808
  for (let t of this._sessionRecord) u.add(t.card.card_id);
31806
- if (this.newQ.length > 0 && u.add(this.newQ.peek(0).cardID), c.excludeCards = [...u], t.hints) {
31807
- let c = t.label ? {
31808
- ...t.hints,
31809
- _label: t.label
31810
- } : t.hints;
31811
- for (let t of this.sources) t.setEphemeralHints?.(c);
31812
- }
31809
+ this.newQ.length > 0 && u.add(this.newQ.peek(0).cardID), c.excludeCards = [...u], t.sessionHints !== void 0 && (this._sessionHints = t.sessionHints, this.log(`[Replan] Session hints ${t.sessionHints ? "set" : "cleared"}: ${JSON.stringify(t.sessionHints)}`)), this._applyHintsToSources(t.hints, t.label);
31813
31810
  let d = t.label ? ` [${t.label}]` : "";
31814
31811
  this.log(`Mid-session replan requested${d} (limit: ${t.limit ?? "default"}, mode: ${t.mode ?? "replace"}${t.hints ? ", with hints" : ""})`), t.minFollowUpCards !== void 0 && t.minFollowUpCards > 0 && (this._minCardsGuarantee = Math.max(this._minCardsGuarantee, t.minFollowUpCards), this.log(`[Replan] Card guarantee set to ${this._minCardsGuarantee}`)), await this._executeReplan(t);
31815
31812
  }
31813
+ setSessionHints(t) {
31814
+ this._sessionHints = t, this.log(`Session hints ${t ? "set" : "cleared"}: ${JSON.stringify(t)}`);
31815
+ }
31816
+ getSessionHints() {
31817
+ return this._sessionHints;
31818
+ }
31819
+ mergeSessionHints(t) {
31820
+ this._sessionHints = mergeHints2([this._sessionHints, t]) ?? null, this.log(`Session hints merged: ${JSON.stringify(this._sessionHints)}`);
31821
+ }
31822
+ _applyHintsToSources(t, c) {
31823
+ let u = t && c ? {
31824
+ ...t,
31825
+ _label: c
31826
+ } : t, d = mergeHints2([this._sessionHints, u]);
31827
+ if (d) for (let t of this.sources) t.setEphemeralHints?.(d);
31828
+ }
31829
+ _getSessionControls() {
31830
+ return this._sessionControls || (this._sessionControls = {
31831
+ getSessionHints: () => this.getSessionHints(),
31832
+ setSessionHints: (t) => this.setSessionHints(t),
31833
+ mergeSessionHints: (t) => this.mergeSessionHints(t),
31834
+ requestReplan: (t) => this.requestReplan(t)
31835
+ }), this._sessionControls;
31836
+ }
31837
+ async _notifyOutcomeObservers(t, c, u) {
31838
+ if (this._outcomeObservers.length === 0 || !isQuestionRecord(t)) return;
31839
+ let d = {
31840
+ record: t,
31841
+ card: c.card,
31842
+ result: u
31843
+ }, m = this._getSessionControls();
31844
+ for (let t of this._outcomeObservers) try {
31845
+ await t(d, m);
31846
+ } catch (t) {
31847
+ this.error("[OutcomeObserver] observer threw; ignoring", t);
31848
+ }
31849
+ }
31816
31850
  async _replanUncoalesced(t) {
31817
31851
  let c = this._runReplan(t);
31818
31852
  this._replanPromise = c.finally(() => {
@@ -31823,6 +31857,7 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31823
31857
  if (!t) return {};
31824
31858
  let c = [
31825
31859
  "hints",
31860
+ "sessionHints",
31826
31861
  "limit",
31827
31862
  "mode",
31828
31863
  "label",
@@ -31898,7 +31933,9 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
31898
31933
  };
31899
31934
  }
31900
31935
  async getWeightedContent(t) {
31901
- let c = t?.replan ?? !1, u = t?.additive ?? !1, d = t?.limit ?? this._defaultBatchLimit, m = c ? d : d + this._initialReviewCap, g = [];
31936
+ let c = t?.replan ?? !1, u = t?.additive ?? !1, d = t?.limit ?? this._defaultBatchLimit, m = c ? d : d + this._initialReviewCap;
31937
+ c || this._applyHintsToSources();
31938
+ let g = [];
31902
31939
  for (let t = 0; t < this.sources.length; t++) {
31903
31940
  let c = this.sources[t];
31904
31941
  try {
@@ -32004,8 +32041,8 @@ ${c.id}:`), logger.info(JSON.stringify(c.doc, null, 2));
32004
32041
  return this.log("Exhausted 20 skip attempts finding a hydratable card"), this._currentCard = null, endSessionTracking(), null;
32005
32042
  }
32006
32043
  async submitResponse(t, c, u, d, m, g, b, S, C) {
32007
- let w = { ...d.item };
32008
- return await this.services.response.processResponse(t, c, w, u, d, m, g, b, S, C);
32044
+ let w = { ...d.item }, T = await this.services.response.processResponse(t, c, w, u, d, m, g, b, S, C);
32045
+ return await this._notifyOutcomeObservers(t, d, T), T;
32009
32046
  }
32010
32047
  dismissCurrentCard(t = "dismiss-success") {
32011
32048
  if (this._currentCard) if (t === "dismiss-success") this.hydrationService.removeCard(this._currentCard.item.cardID);
@@ -42954,11 +42991,7 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
42954
42991
  }
42955
42992
  }))).filter((t) => t !== null)), this.timeRemaining = this.sessionTimeLimit * 60, t = await Promise.all(this.contentSources.filter((t) => t.type === "classroom").map(async (t) => await this.dataLayer.getClassroomDB(t.id, "student"))), t.forEach((t) => {});
42956
42993
  let c = {};
42957
- if (this.sessionConfig?.defaultBatchLimit !== void 0 && (c.defaultBatchLimit = this.sessionConfig.defaultBatchLimit), this.sessionConfig?.initialReviewCap !== void 0 && (c.initialReviewCap = this.sessionConfig.initialReviewCap), this.sessionController = markRaw(new SessionController(this.sessionContentSources, 60 * this.sessionTimeLimit, this.dataLayer, this.getViewComponent, void 0, c)), this.sessionController.sessionRecord = this.sessionRecord, this.sessionConfig?.initHints) {
42958
- for (let t of this.sessionContentSources) t.setEphemeralHints?.(this.sessionConfig.initHints);
42959
- console.log("[StudySession] Applied init hints to content sources");
42960
- }
42961
- await this.sessionController.prepareSession(), this.intervalHandler = setInterval(this.tick, 1e3), this.sessionPrepared = !0, console.log("[StudySession] Session preparation complete, emitting session-prepared event"), this.$emit("session-prepared"), console.log("[StudySession] Event emission completed");
42994
+ this.sessionConfig?.defaultBatchLimit !== void 0 && (c.defaultBatchLimit = this.sessionConfig.defaultBatchLimit), this.sessionConfig?.initialReviewCap !== void 0 && (c.initialReviewCap = this.sessionConfig.initialReviewCap), this.sessionConfig?.outcomeObservers?.length && (c.outcomeObservers = this.sessionConfig.outcomeObservers), this.sessionController = markRaw(new SessionController(this.sessionContentSources, 60 * this.sessionTimeLimit, this.dataLayer, this.getViewComponent, void 0, c)), this.sessionController.sessionRecord = this.sessionRecord, this.sessionConfig?.initHints && (this.sessionController.setSessionHints(this.sessionConfig.initHints), console.log("[StudySession] Applied init hints as session-durable hints")), await this.sessionController.prepareSession(), this.intervalHandler = setInterval(this.tick, 1e3), this.sessionPrepared = !0, console.log("[StudySession] Session preparation complete, emitting session-prepared event"), this.$emit("session-prepared"), console.log("[StudySession] Event emission completed");
42962
42995
  } catch (t) {
42963
42996
  console.error("[StudySession] Error during session preparation:", t), this.$emit("session-error", {
42964
42997
  message: "Failed to prepare study session",
@@ -43075,7 +43108,7 @@ var Ee$1, De$1, Oe$1, ke$1, Ae$1, je$1, Me$1, Ne$1, Pe$1, Fe$1, Ie$1, Le$1, Z$2,
43075
43108
  key: 4,
43076
43109
  ref: "shadowWrapper",
43077
43110
  class: "card-transition-container"
43078
- }, on = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), sn = /* @__PURE__ */ F$3(Qt, [["render", _sfc_render$15], ["__scopeId", "data-v-bc445530"]]), cn = /* @__PURE__ */ defineComponent({
43111
+ }, on = { key: 0 }, __name(_sfc_render$15, "_sfc_render"), sn = /* @__PURE__ */ F$3(Qt, [["render", _sfc_render$15], ["__scopeId", "data-v-de7119e9"]]), cn = /* @__PURE__ */ defineComponent({
43079
43112
  name: "MultipleChoiceOption",
43080
43113
  components: { MarkdownRenderer: /* @__PURE__ */ defineAsyncComponent(() => Promise.resolve().then(() => (init_MarkdownRenderer_DoVbFpA6(), MarkdownRenderer_DoVbFpA6_exports)).then((t) => t.n)) },
43081
43114
  props: {