@thanh01.pmt/curriculum-kit 1.4.4 → 1.4.6

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.cjs CHANGED
@@ -530,7 +530,9 @@ Guidelines:
530
530
  if (isNvidiaPreferred || uniqueNvidiaModels.length > 0) {
531
531
  for (const model of uniqueNvidiaModels) {
532
532
  try {
533
- const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
533
+ const nvdIdle = options.idleTimeoutMs ?? 18e4;
534
+ const nvdTotal = options.timeoutMs ?? 6e5;
535
+ const idle = createStreamAbortController({ idleMs: nvdIdle, totalMs: nvdTotal });
534
536
  const res = await fetch("https://integrate.api.nvidia.com/v1/chat/completions", {
535
537
  method: "POST",
536
538
  headers: {
@@ -727,7 +729,9 @@ Guidelines:
727
729
  const { provider, model } = target;
728
730
  if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
729
731
  try {
730
- const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
732
+ const nvdIdle = options.idleTimeoutMs ?? 18e4;
733
+ const nvdTotal = options.timeoutMs ?? 6e5;
734
+ const idle = createStreamAbortController({ idleMs: nvdIdle, totalMs: nvdTotal });
731
735
  const res = await fetch("https://integrate.api.nvidia.com/v1/chat/completions", {
732
736
  method: "POST",
733
737
  headers: {
@@ -881,8 +885,8 @@ exports.DEFAULT_ARTIFACT_STREAM_IDLE_MS = void 0; exports.DEFAULT_ARTIFACT_STREA
881
885
  var init_streamRunner = __esm({
882
886
  "src/ai/streamRunner.ts"() {
883
887
  init_errors();
884
- exports.DEFAULT_ARTIFACT_STREAM_IDLE_MS = 45e3;
885
- exports.DEFAULT_ARTIFACT_STREAM_TOTAL_MS = 42e4;
888
+ exports.DEFAULT_ARTIFACT_STREAM_IDLE_MS = 9e4;
889
+ exports.DEFAULT_ARTIFACT_STREAM_TOTAL_MS = 48e4;
886
890
  }
887
891
  });
888
892
 
@@ -24588,6 +24592,7 @@ ${sg}
24588
24592
  ${ref}${standardsBlock}${glossaryBlock}${expositionBlock}${sessionSliceBlock}`;
24589
24593
  let commonContext = assembleCommonContext(effectiveRefPack, effectiveStyleGuide);
24590
24594
  const MAX_COMPOSITE_PROMPT_CHARS = 3e4;
24595
+ const runnerOptions = options.customInference ? { customInference: options.customInference } : {};
24591
24596
  if (commonContext.length > MAX_COMPOSITE_PROMPT_CHARS && effectiveRefPack.length > 1e3) {
24592
24597
  effectiveRefPack = buildSectionAwareExcerpt(refPack, {
24593
24598
  priorities: [
@@ -24634,7 +24639,7 @@ Khi n\u1ED9i dung c\u1EA7n minh h\u1ECDa (diagram quy tr\xECnh, s\u01A1 \u0111\u
24634
24639
  const rawLesson = await runCurriculumAIInference(
24635
24640
  [{ role: "user", content: lessonPrompt }],
24636
24641
  commonContext,
24637
- {},
24642
+ runnerOptions,
24638
24643
  (chunk, type) => {
24639
24644
  options.onProgress?.("@content", chunk, { type: type || "content", artifactType: "LESSON" });
24640
24645
  }
@@ -24663,7 +24668,7 @@ PREVIOUS ATTEMPT FAILED STRUCTURAL LINT:
24663
24668
  ${blockingIssues.map((i) => "- " + i.message).join("\n")}
24664
24669
  Fix ALL issues above and output the complete corrected document.` }],
24665
24670
  commonContext,
24666
- {},
24671
+ runnerOptions,
24667
24672
  (chunk, type) => {
24668
24673
  options.onProgress?.("@content", chunk, { type: type || "content", artifactType: "LESSON" });
24669
24674
  }
@@ -24787,7 +24792,7 @@ ${repairFeedback}
24787
24792
  CURRENT DOCUMENT:
24788
24793
  ${currentContent}` }],
24789
24794
  commonContext,
24790
- {},
24795
+ runnerOptions,
24791
24796
  (chunk, type) => {
24792
24797
  options.onProgress?.("@repair", chunk, { type: type || "content", artifactType: "LESSON" });
24793
24798
  }
@@ -25034,7 +25039,7 @@ ${buildHeadingDirective("ACT", slcMarkdown, targetLang)}`;
25034
25039
  const rawAct = await runCurriculumAIInference(
25035
25040
  [{ role: "user", content: actPrompt }],
25036
25041
  satelliteContext,
25037
- {},
25042
+ runnerOptions,
25038
25043
  (chunk, type) => {
25039
25044
  options.onProgress?.("@activity", chunk, { type: type || "content", artifactType: "ACT" });
25040
25045
  }
@@ -25098,7 +25103,7 @@ ${buildHeadingDirective("QUIZ", slcMarkdown, targetLang)}`;
25098
25103
  const rawQuiz = await runCurriculumAIInference(
25099
25104
  [{ role: "user", content: quizPrompt }],
25100
25105
  satelliteContext,
25101
- {},
25106
+ runnerOptions,
25102
25107
  (chunk, type) => {
25103
25108
  options.onProgress?.("@assessor", chunk, { type: type || "content", artifactType: "QUIZ" });
25104
25109
  }
@@ -25145,7 +25150,7 @@ ${glossaryContext}` : void 0,
25145
25150
  const rawSlide = await runCurriculumAIInference(
25146
25151
  [{ role: "user", content: slidePrompt }],
25147
25152
  satelliteContext,
25148
- {},
25153
+ runnerOptions,
25149
25154
  (chunk, type) => {
25150
25155
  options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25151
25156
  }
@@ -25186,7 +25191,7 @@ Fix ALL issues and output the complete corrected JSON object strictly matching t
25186
25191
  const repairedRaw = await runCurriculumAIInference(
25187
25192
  [{ role: "user", content: repairPrompt }],
25188
25193
  satelliteContext,
25189
- {},
25194
+ runnerOptions,
25190
25195
  (chunk, type) => {
25191
25196
  options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25192
25197
  }
@@ -25270,7 +25275,7 @@ footer: "Curriculum OS \u2022 ${lessonCode} (${pedagogyLabel})"
25270
25275
  const rawSlide = await runCurriculumAIInference(
25271
25276
  [{ role: "user", content: slidePrompt }],
25272
25277
  satelliteContext,
25273
- {},
25278
+ runnerOptions,
25274
25279
  (chunk, type) => {
25275
25280
  options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25276
25281
  }
@@ -25330,7 +25335,7 @@ ${buildHeadingDirective("GUIDE", slcMarkdown, targetLang)}`;
25330
25335
  const rawGuide = await runCurriculumAIInference(
25331
25336
  [{ role: "user", content: guidePrompt }],
25332
25337
  satelliteContext,
25333
- {},
25338
+ runnerOptions,
25334
25339
  (chunk, type) => {
25335
25340
  options.onProgress?.("@content", chunk, { type: type || "chunk", artifactType: "GUIDE" });
25336
25341
  }
@@ -25381,7 +25386,7 @@ ${buildHeadingDirective("HANDOUT", slcMarkdown, targetLang)}`;
25381
25386
  const rawHandout = await runCurriculumAIInference(
25382
25387
  [{ role: "user", content: handoutPrompt }],
25383
25388
  satelliteContext,
25384
- {},
25389
+ runnerOptions,
25385
25390
  (chunk, type) => {
25386
25391
  options.onProgress?.("@content", chunk, { type: type || "chunk", artifactType: "HANDOUT" });
25387
25392
  }
@@ -25436,7 +25441,7 @@ ${buildHeadingDirective("WKS", slcMarkdown, targetLang)}`;
25436
25441
  const rawWks = await runCurriculumAIInference(
25437
25442
  [{ role: "user", content: wksPrompt }],
25438
25443
  satelliteContext,
25439
- {},
25444
+ runnerOptions,
25440
25445
  (chunk, type) => {
25441
25446
  options.onProgress?.("@content", chunk, { type: type || "chunk", artifactType: "WKS" });
25442
25447
  }
@@ -25495,7 +25500,7 @@ ${buildHeadingDirective("CODE", slcMarkdown, targetLang)}`;
25495
25500
  const rawCode = await runCurriculumAIInference(
25496
25501
  [{ role: "user", content: codePrompt }],
25497
25502
  satelliteContext,
25498
- {},
25503
+ runnerOptions,
25499
25504
  (chunk, type) => {
25500
25505
  options.onProgress?.("@activity", chunk, { type: type || "chunk", artifactType: "CODE" });
25501
25506
  }
@@ -25553,7 +25558,7 @@ ${buildHeadingDirective("EXT", slcMarkdown, targetLang)}`;
25553
25558
  const rawExt = await runCurriculumAIInference(
25554
25559
  [{ role: "user", content: extPrompt }],
25555
25560
  satelliteContext,
25556
- {},
25561
+ runnerOptions,
25557
25562
  (chunk, type) => {
25558
25563
  options.onProgress?.("@activity", chunk, { type: type || "chunk", artifactType: "EXT" });
25559
25564
  }
@@ -27083,20 +27088,34 @@ var DeterministicPipelineRunner = class {
27083
27088
 
27084
27089
  // src/services/prefillService.ts
27085
27090
  init_streamRunner();
27086
- var DEFAULT_STREAM_IDLE_MS = 45e3;
27087
- var DEFAULT_STREAM_TOTAL_MS = 42e4;
27091
+ var DEFAULT_STREAM_IDLE_MS = 9e4;
27092
+ var DEFAULT_STREAM_TOTAL_MS = 48e4;
27093
+ var LAYER_IDLE_BUDGET_MS = {
27094
+ 1: 9e4,
27095
+ 2: 9e4,
27096
+ 3: 18e4
27097
+ // Layer 3 synthesizes all accumulated context + pathways (3 minutes idle protection)
27098
+ };
27088
27099
  var LAYER_TOTAL_BUDGET_MS = {
27089
- 1: 42e4,
27090
- 2: 42e4,
27091
- 3: 42e4
27100
+ 1: 48e4,
27101
+ 2: 48e4,
27102
+ 3: 6e5
27092
27103
  };
27093
27104
  function resolveStreamBudget(layer, opts) {
27094
27105
  const envIdle = Number(process.env.WIZARD_PREFILL_IDLE_TIMEOUT_MS);
27095
27106
  const envTotal = Number(process.env.WIZARD_PREFILL_TOTAL_TIMEOUT_MS);
27107
+ const isNvidia = Boolean(
27108
+ opts?.provider && opts.provider.toLowerCase().includes("nvidia") || opts?.model && (opts.model.toLowerCase().includes("nvidia") || opts.model.toLowerCase().includes("nemotron"))
27109
+ );
27110
+ const layerIdle = layer !== void 0 ? LAYER_IDLE_BUDGET_MS[layer] : void 0;
27111
+ const baseIdle = layerIdle ?? DEFAULT_STREAM_IDLE_MS;
27112
+ const computedDefaultIdle = isNvidia ? Math.max(baseIdle, 18e4) : baseIdle;
27096
27113
  const layerTotal = layer !== void 0 ? LAYER_TOTAL_BUDGET_MS[layer] : void 0;
27114
+ const baseTotal = layerTotal ?? DEFAULT_STREAM_TOTAL_MS;
27115
+ const computedDefaultTotal = isNvidia ? Math.max(baseTotal, 6e5) : baseTotal;
27097
27116
  return {
27098
- idleMs: opts?.idleMs ?? (Number.isFinite(envIdle) && envIdle > 0 ? envIdle : DEFAULT_STREAM_IDLE_MS),
27099
- totalMs: opts?.totalMs ?? (Number.isFinite(envTotal) && envTotal > 0 ? envTotal : layerTotal ?? DEFAULT_STREAM_TOTAL_MS)
27117
+ idleMs: opts?.idleMs ?? (Number.isFinite(envIdle) && envIdle > 0 ? envIdle : computedDefaultIdle),
27118
+ totalMs: opts?.totalMs ?? (Number.isFinite(envTotal) && envTotal > 0 ? envTotal : computedDefaultTotal)
27100
27119
  };
27101
27120
  }
27102
27121
  function createStreamChunkExtractor() {
@@ -27439,7 +27458,12 @@ Return concise JSON matching:
27439
27458
  options.model,
27440
27459
  options.provider,
27441
27460
  // Research may run live web grounding — generous budget, still idle-guarded.
27442
- resolveStreamBudget(void 0, { idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs })
27461
+ resolveStreamBudget(void 0, {
27462
+ idleMs: options.idleTimeoutMs,
27463
+ totalMs: options.timeoutMs,
27464
+ model: options.model,
27465
+ provider: options.provider
27466
+ })
27443
27467
  );
27444
27468
  let parsedResearch = {
27445
27469
  groundTruthSummary: `Verified ecosystem standards for ${projectName}`,
@@ -27642,9 +27666,14 @@ REQUIREMENT: Synthesize ALL parameters above \u2014 every single line in FULL AC
27642
27666
  },
27643
27667
  options.model,
27644
27668
  options.provider,
27645
- // RC-W1: layer-aware budget — Layer 2 has the largest output and free-tier
27646
- // models may think/stream for minutes. Idle window still catches hangs.
27647
- resolveStreamBudget(targetLayer, { idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs })
27669
+ // RC-W1: layer-aware budget — Layer 3 synthesizes full context and free-tier
27670
+ // models (especially NVIDIA NIM) may think/stream for minutes. Idle window still catches hangs.
27671
+ resolveStreamBudget(targetLayer, {
27672
+ idleMs: options.idleTimeoutMs,
27673
+ totalMs: options.timeoutMs,
27674
+ model: options.model,
27675
+ provider: options.provider
27676
+ })
27648
27677
  );
27649
27678
  const parsed = safeParseJson(rawContent);
27650
27679
  return {
@@ -30220,6 +30249,7 @@ exports.HandoutSectionSchema = HandoutSectionSchema;
30220
30249
  exports.InstructionSectionSchema = InstructionSectionSchema;
30221
30250
  exports.InstructionStepSchema = InstructionStepSchema;
30222
30251
  exports.JudgeCriterionSchema = JudgeCriterionSchema;
30252
+ exports.LAYER_IDLE_BUDGET_MS = LAYER_IDLE_BUDGET_MS;
30223
30253
  exports.LAYER_TOTAL_BUDGET_MS = LAYER_TOTAL_BUDGET_MS;
30224
30254
  exports.LESSON_PLAN_TEMPLATE = LESSON_PLAN_TEMPLATE;
30225
30255
  exports.LLMJudgeEngine = LLMJudgeEngine;