@thanh01.pmt/curriculum-kit 1.4.4 → 1.4.5

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
 
@@ -27083,20 +27087,34 @@ var DeterministicPipelineRunner = class {
27083
27087
 
27084
27088
  // src/services/prefillService.ts
27085
27089
  init_streamRunner();
27086
- var DEFAULT_STREAM_IDLE_MS = 45e3;
27087
- var DEFAULT_STREAM_TOTAL_MS = 42e4;
27090
+ var DEFAULT_STREAM_IDLE_MS = 9e4;
27091
+ var DEFAULT_STREAM_TOTAL_MS = 48e4;
27092
+ var LAYER_IDLE_BUDGET_MS = {
27093
+ 1: 9e4,
27094
+ 2: 9e4,
27095
+ 3: 18e4
27096
+ // Layer 3 synthesizes all accumulated context + pathways (3 minutes idle protection)
27097
+ };
27088
27098
  var LAYER_TOTAL_BUDGET_MS = {
27089
- 1: 42e4,
27090
- 2: 42e4,
27091
- 3: 42e4
27099
+ 1: 48e4,
27100
+ 2: 48e4,
27101
+ 3: 6e5
27092
27102
  };
27093
27103
  function resolveStreamBudget(layer, opts) {
27094
27104
  const envIdle = Number(process.env.WIZARD_PREFILL_IDLE_TIMEOUT_MS);
27095
27105
  const envTotal = Number(process.env.WIZARD_PREFILL_TOTAL_TIMEOUT_MS);
27106
+ const isNvidia = Boolean(
27107
+ opts?.provider && opts.provider.toLowerCase().includes("nvidia") || opts?.model && (opts.model.toLowerCase().includes("nvidia") || opts.model.toLowerCase().includes("nemotron"))
27108
+ );
27109
+ const layerIdle = layer !== void 0 ? LAYER_IDLE_BUDGET_MS[layer] : void 0;
27110
+ const baseIdle = layerIdle ?? DEFAULT_STREAM_IDLE_MS;
27111
+ const computedDefaultIdle = isNvidia ? Math.max(baseIdle, 18e4) : baseIdle;
27096
27112
  const layerTotal = layer !== void 0 ? LAYER_TOTAL_BUDGET_MS[layer] : void 0;
27113
+ const baseTotal = layerTotal ?? DEFAULT_STREAM_TOTAL_MS;
27114
+ const computedDefaultTotal = isNvidia ? Math.max(baseTotal, 6e5) : baseTotal;
27097
27115
  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)
27116
+ idleMs: opts?.idleMs ?? (Number.isFinite(envIdle) && envIdle > 0 ? envIdle : computedDefaultIdle),
27117
+ totalMs: opts?.totalMs ?? (Number.isFinite(envTotal) && envTotal > 0 ? envTotal : computedDefaultTotal)
27100
27118
  };
27101
27119
  }
27102
27120
  function createStreamChunkExtractor() {
@@ -27439,7 +27457,12 @@ Return concise JSON matching:
27439
27457
  options.model,
27440
27458
  options.provider,
27441
27459
  // Research may run live web grounding — generous budget, still idle-guarded.
27442
- resolveStreamBudget(void 0, { idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs })
27460
+ resolveStreamBudget(void 0, {
27461
+ idleMs: options.idleTimeoutMs,
27462
+ totalMs: options.timeoutMs,
27463
+ model: options.model,
27464
+ provider: options.provider
27465
+ })
27443
27466
  );
27444
27467
  let parsedResearch = {
27445
27468
  groundTruthSummary: `Verified ecosystem standards for ${projectName}`,
@@ -27642,9 +27665,14 @@ REQUIREMENT: Synthesize ALL parameters above \u2014 every single line in FULL AC
27642
27665
  },
27643
27666
  options.model,
27644
27667
  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 })
27668
+ // RC-W1: layer-aware budget — Layer 3 synthesizes full context and free-tier
27669
+ // models (especially NVIDIA NIM) may think/stream for minutes. Idle window still catches hangs.
27670
+ resolveStreamBudget(targetLayer, {
27671
+ idleMs: options.idleTimeoutMs,
27672
+ totalMs: options.timeoutMs,
27673
+ model: options.model,
27674
+ provider: options.provider
27675
+ })
27648
27676
  );
27649
27677
  const parsed = safeParseJson(rawContent);
27650
27678
  return {
@@ -30220,6 +30248,7 @@ exports.HandoutSectionSchema = HandoutSectionSchema;
30220
30248
  exports.InstructionSectionSchema = InstructionSectionSchema;
30221
30249
  exports.InstructionStepSchema = InstructionStepSchema;
30222
30250
  exports.JudgeCriterionSchema = JudgeCriterionSchema;
30251
+ exports.LAYER_IDLE_BUDGET_MS = LAYER_IDLE_BUDGET_MS;
30223
30252
  exports.LAYER_TOTAL_BUDGET_MS = LAYER_TOTAL_BUDGET_MS;
30224
30253
  exports.LESSON_PLAN_TEMPLATE = LESSON_PLAN_TEMPLATE;
30225
30254
  exports.LLMJudgeEngine = LLMJudgeEngine;