@thanh01.pmt/curriculum-kit 1.0.8 → 1.0.10

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 (42) hide show
  1. package/dist/ai/index.cjs +36 -10
  2. package/dist/ai/index.cjs.map +1 -1
  3. package/dist/ai/index.d.cts +5 -5
  4. package/dist/ai/index.d.ts +5 -5
  5. package/dist/ai/index.mjs +36 -10
  6. package/dist/ai/index.mjs.map +1 -1
  7. package/dist/{index-BfDHBO7f.d.ts → index-B8lOdFuz.d.ts} +1 -1
  8. package/dist/{index-BEicVaQ9.d.cts → index-DhxvfPoW.d.cts} +1 -1
  9. package/dist/index.cjs +43 -16
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +6 -6
  12. package/dist/index.d.ts +6 -6
  13. package/dist/index.mjs +43 -16
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/media/index.cjs +30 -4
  16. package/dist/media/index.cjs.map +1 -1
  17. package/dist/media/index.d.cts +1 -1
  18. package/dist/media/index.d.ts +1 -1
  19. package/dist/media/index.mjs +30 -4
  20. package/dist/media/index.mjs.map +1 -1
  21. package/dist/{milestoneBundleGenerator-CbXhs1CP.d.ts → milestoneBundleGenerator-Bkba8OPG.d.ts} +1 -1
  22. package/dist/{milestoneBundleGenerator-DrBtHzBO.d.cts → milestoneBundleGenerator-CzSOeAzU.d.cts} +1 -1
  23. package/dist/pipeline/index.cjs +5 -5
  24. package/dist/pipeline/index.cjs.map +1 -1
  25. package/dist/pipeline/index.d.cts +3 -3
  26. package/dist/pipeline/index.d.ts +3 -3
  27. package/dist/pipeline/index.mjs +5 -5
  28. package/dist/pipeline/index.mjs.map +1 -1
  29. package/dist/{provider-factory-DH3udYlN.d.ts → provider-factory-DxzOVEmh.d.cts} +1 -1
  30. package/dist/{provider-factory-DH3udYlN.d.cts → provider-factory-DxzOVEmh.d.ts} +1 -1
  31. package/dist/storage/index.d.cts +2 -2
  32. package/dist/storage/index.d.ts +2 -2
  33. package/dist/{streamRunner-C7j5LKon.d.cts → streamRunner-CcpmxOf1.d.cts} +20 -1
  34. package/dist/{streamRunner-C7j5LKon.d.ts → streamRunner-CcpmxOf1.d.ts} +20 -1
  35. package/dist/workflow/index.cjs +33 -7
  36. package/dist/workflow/index.cjs.map +1 -1
  37. package/dist/workflow/index.d.cts +2 -2
  38. package/dist/workflow/index.d.ts +2 -2
  39. package/dist/workflow/index.mjs +33 -7
  40. package/dist/workflow/index.mjs.map +1 -1
  41. package/package.json +22 -21
  42. package/LICENSE +0 -21
@@ -1,9 +1,9 @@
1
- import { M as ModelResolutionOptions } from '../provider-factory-DH3udYlN.cjs';
2
- export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from '../provider-factory-DH3udYlN.cjs';
1
+ import { M as ModelResolutionOptions } from '../provider-factory-DxzOVEmh.cjs';
2
+ export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from '../provider-factory-DxzOVEmh.cjs';
3
3
  import { MilestoneInput, LessonPlan, ActivityLab, ProjectGraph, CodeLab, Worksheet, Handout, SlideDeck, TeacherGuide, Extension, CurriculumQualityReport, ProjectInstruction, SelfLab, DiagnosticQuiz } from '../schemas/index.cjs';
4
4
  import * as ai from 'ai';
5
- import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-C7j5LKon.cjs';
6
- export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-C7j5LKon.cjs';
5
+ import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-CcpmxOf1.cjs';
6
+ export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-CcpmxOf1.cjs';
7
7
  import { z } from 'zod';
8
8
 
9
9
  interface LessonPromptInput {
@@ -1142,7 +1142,7 @@ declare const packagerTools: {
1142
1142
  * - OpenRouter / Google: google/gemini-3.7-flash (Opus-grade accuracy, 1M context)
1143
1143
  * - DeepSeek: deepseek-v4-pro (Build 0813 - Deep CoT Reasoning)
1144
1144
  * - Alibaba: qwen3.8-max (2.4T MoE Flagship)
1145
- * - NVIDIA NIM: nvidia/nemotron-3-ultra-550b-a55b (Robust Free Fallback)
1145
+ * - NVIDIA NIM: nvidia/nemotron-3-ultra-550b-a55b:free (Robust Free Fallback)
1146
1146
  *
1147
1147
  * 2. Mid & Mid-High Production / Copilot (Tier 2 - Primary Economic):
1148
1148
  * - DeepSeek: deepseek-v4-flash (Build 0731 - $0.22/1M, 1M context, 284B MoE)
@@ -1,9 +1,9 @@
1
- import { M as ModelResolutionOptions } from '../provider-factory-DH3udYlN.js';
2
- export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from '../provider-factory-DH3udYlN.js';
1
+ import { M as ModelResolutionOptions } from '../provider-factory-DxzOVEmh.js';
2
+ export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from '../provider-factory-DxzOVEmh.js';
3
3
  import { MilestoneInput, LessonPlan, ActivityLab, ProjectGraph, CodeLab, Worksheet, Handout, SlideDeck, TeacherGuide, Extension, CurriculumQualityReport, ProjectInstruction, SelfLab, DiagnosticQuiz } from '../schemas/index.js';
4
4
  import * as ai from 'ai';
5
- import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-C7j5LKon.js';
6
- export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-C7j5LKon.js';
5
+ import { C as ChatMessage, S as StreamRunnerOptions, c as ChunkType } from '../streamRunner-CcpmxOf1.js';
6
+ export { F as FallbackTarget, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from '../streamRunner-CcpmxOf1.js';
7
7
  import { z } from 'zod';
8
8
 
9
9
  interface LessonPromptInput {
@@ -1142,7 +1142,7 @@ declare const packagerTools: {
1142
1142
  * - OpenRouter / Google: google/gemini-3.7-flash (Opus-grade accuracy, 1M context)
1143
1143
  * - DeepSeek: deepseek-v4-pro (Build 0813 - Deep CoT Reasoning)
1144
1144
  * - Alibaba: qwen3.8-max (2.4T MoE Flagship)
1145
- * - NVIDIA NIM: nvidia/nemotron-3-ultra-550b-a55b (Robust Free Fallback)
1145
+ * - NVIDIA NIM: nvidia/nemotron-3-ultra-550b-a55b:free (Robust Free Fallback)
1146
1146
  *
1147
1147
  * 2. Mid & Mid-High Production / Copilot (Tier 2 - Primary Economic):
1148
1148
  * - DeepSeek: deepseek-v4-flash (Build 0731 - $0.22/1M, 1M context, 284B MoE)
package/dist/ai/index.mjs CHANGED
@@ -168,7 +168,7 @@ function isModelAllowed(model) {
168
168
  }
169
169
  function getDesignatedFallbackChain() {
170
170
  const rawProviders = resolveApiKey("FALLBACK_AI_PROVIDER") || resolveApiKey("FALLBACK_AI_PROVIDERS") || resolveApiKey("DEFAULT_AI_PROVIDER") || "nvidia,openrouter";
171
- const rawModels = resolveApiKey("FALLBACK_AI_MODEL") || resolveApiKey("FALLBACK_AI_MODELS") || resolveApiKey("DEFAULT_AI_MODEL") || "nvidia/nemotron-3-ultra-550b-a55b,@preset/coding-free,deepseek/deepseek-chat:free";
171
+ const rawModels = resolveApiKey("FALLBACK_AI_MODEL") || resolveApiKey("FALLBACK_AI_MODELS") || resolveApiKey("DEFAULT_AI_MODEL") || "nvidia/nemotron-3-ultra-550b-a55b:free,@preset/coding-free,deepseek/deepseek-chat:free";
172
172
  const providerList = rawProviders.split(",").map((p) => p.trim().toLowerCase()).filter((p) => p.length > 0 && isProviderEnabled(p));
173
173
  const modelList = rawModels.split(",").map((m) => m.trim()).filter((m) => m.length > 0 && isModelAllowed(m));
174
174
  const chain = [];
@@ -177,7 +177,7 @@ function getDesignatedFallbackChain() {
177
177
  if (provider === "nvidia") {
178
178
  providerModels = modelList.filter((m) => m.startsWith("nvidia/") || m.startsWith("meta/") || m.startsWith("mistralai/"));
179
179
  if (providerModels.length === 0) {
180
- providerModels = ["nvidia/nemotron-3-ultra-550b-a55b", "nvidia/nemotron-3.5-lightning-30b-a3b"];
180
+ providerModels = ["nvidia/nemotron-3-ultra-550b-a55b:free", "nvidia/nemotron-3.5-lightning-30b-a3b"];
181
181
  }
182
182
  } else if (provider === "openrouter") {
183
183
  providerModels = modelList.filter((m) => m.startsWith("@") || m.includes("/") || m.includes(":"));
@@ -213,7 +213,7 @@ function getDesignatedFallbackChain() {
213
213
  function getDesignatedFallbackConfig() {
214
214
  const chain = getDesignatedFallbackChain();
215
215
  if (chain.length > 0) return chain[0];
216
- return { provider: "nvidia", model: "nvidia/nemotron-3-ultra-550b-a55b" };
216
+ return { provider: "nvidia", model: "nvidia/nemotron-3-ultra-550b-a55b:free" };
217
217
  }
218
218
  function extractThoughtAndContent(rawText) {
219
219
  let text = rawText || "";
@@ -406,6 +406,32 @@ Guidelines:
406
406
  3. Keep technical terminology and official API symbols intact.
407
407
  4. Format output using clean Markdown, clear sections, bullet points, and code blocks where required.
408
408
  5. Do NOT use emojis in headings, tab titles, or UI navigation labels.`;
409
+ if (options.customInference) {
410
+ try {
411
+ const text = await options.customInference({
412
+ systemInstruction,
413
+ userPrompt: messages.map((m) => m.content).join("\n\n"),
414
+ messages,
415
+ temperature,
416
+ maxTokens,
417
+ onChunk: onChunk ?? (() => {
418
+ })
419
+ });
420
+ if (text && text.trim()) return text;
421
+ throw createAiInferenceError({
422
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
423
+ message: "customInference returned empty output",
424
+ rawError: { customInference: "empty response" }
425
+ });
426
+ } catch (e) {
427
+ if (e?.errorCode || e?.name === "AiInferenceError") throw e;
428
+ throw createAiInferenceError({
429
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
430
+ message: `customInference failed: ${e?.message || e}`,
431
+ rawError: { customInference: String(e?.message || e) }
432
+ });
433
+ }
434
+ }
409
435
  const formattedMessages = [
410
436
  { role: "system", content: systemInstruction },
411
437
  ...messages.map((m) => ({
@@ -418,8 +444,8 @@ Guidelines:
418
444
  const isNvidiaPreferred = requestedModel.startsWith("nvidia/") || Boolean(nvidiaKey && !openrouterKey) && isProviderEnabled("nvidia");
419
445
  if (nvidiaKey && isProviderEnabled("nvidia")) {
420
446
  const candidateNemotronModels = [
421
- requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b",
422
- "nvidia/nemotron-3-ultra-550b-a55b",
447
+ requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b:free",
448
+ "nvidia/nemotron-3-ultra-550b-a55b:free",
423
449
  "nvidia/nemotron-3.5-lightning-30b-a3b",
424
450
  "nvidia/nemotron-3-super-120b-a12b",
425
451
  "nvidia/llama-3.1-nemotron-70b-instruct"
@@ -778,7 +804,7 @@ async function runCurriculumAIInference(messages, projectContext, options = {},
778
804
 
779
805
  // src/ai/provider-factory.ts
780
806
  var DEFAULT_MODELS = {
781
- nvidia: "nvidia/nemotron-3-ultra-550b-a55b",
807
+ nvidia: "nvidia/nemotron-3-ultra-550b-a55b:free",
782
808
  openrouter: "@preset/coding-free",
783
809
  alibaba: "qwen3.7-plus",
784
810
  dashscope: "qwen3.7-plus",
@@ -789,7 +815,7 @@ var DEFAULT_MODELS = {
789
815
  };
790
816
  var NVIDIA_MODELS = {
791
817
  codingFast: "nvidia/nemotron-3.5-lightning-30b-a3b",
792
- reasoningUltra: "nvidia/nemotron-3-ultra-550b-a55b",
818
+ reasoningUltra: "nvidia/nemotron-3-ultra-550b-a55b:free",
793
819
  superMoE: "nvidia/nemotron-3-super-120b-a12b",
794
820
  llamaNemotron: "nvidia/llama-3.1-nemotron-70b-instruct",
795
821
  translation: "nvidia/riva-translate-4b-instruct-v2",
@@ -815,7 +841,7 @@ function getAIModel(options = {}) {
815
841
  apiKey,
816
842
  baseURL: options.baseURL || "https://integrate.api.nvidia.com/v1"
817
843
  });
818
- return nvidia.chat(resolvedModelName || "nvidia/nemotron-3-ultra-550b-a55b");
844
+ return nvidia.chat(resolvedModelName || "nvidia/nemotron-3-ultra-550b-a55b:free");
819
845
  }
820
846
  if (provider === "openrouter") {
821
847
  const apiKey = options.apiKey || process.env.OPENROUTER_API_KEY || process.env.OPENAI_API_KEY || "";
@@ -4302,7 +4328,7 @@ var ModelPolicyResolver = class {
4302
4328
  {
4303
4329
  provider: "nvidia",
4304
4330
  providerLabel: "NVIDIA NIM API",
4305
- modelName: "nvidia/nemotron-3-ultra-550b-a55b",
4331
+ modelName: "nvidia/nemotron-3-ultra-550b-a55b:free",
4306
4332
  maxTokens: 32768,
4307
4333
  temperature: 0.15,
4308
4334
  reasoningEffort: "high",
@@ -4727,7 +4753,7 @@ var PROVIDER_ENDPOINTS = {
4727
4753
  alibaba: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",
4728
4754
  nvidia: "https://integrate.api.nvidia.com/v1/chat/completions"
4729
4755
  };
4730
- var NVIDIA_DEFAULT_MODEL = "nvidia/nemotron-3-ultra-550b-a55b";
4756
+ var NVIDIA_DEFAULT_MODEL = "nvidia/nemotron-3-ultra-550b-a55b:free";
4731
4757
  function resolveProviderRoute(options) {
4732
4758
  const openrouterKey = options.openrouterKey?.trim() || (typeof process !== "undefined" ? process.env.OPENROUTER_API_KEY || "" : "");
4733
4759
  const deepseekKey = options.deepseekKey?.trim() || (typeof process !== "undefined" ? process.env.DEEPSEEK_API_KEY || "" : "");