@thanh01.pmt/curriculum-kit 1.0.9 → 1.0.11

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 (41) hide show
  1. package/dist/ai/index.cjs +10 -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 +10 -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 +56 -27
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +11 -8
  12. package/dist/index.d.ts +11 -8
  13. package/dist/index.mjs +56 -27
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/media/index.cjs +4 -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 +4 -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.cts → provider-factory-DxzOVEmh.d.cts} +1 -1
  30. package/dist/{provider-factory-DH3udYlN.d.ts → 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-BTTzbb-l.d.cts → streamRunner-CcpmxOf1.d.cts} +1 -1
  34. package/dist/{streamRunner-BTTzbb-l.d.ts → streamRunner-CcpmxOf1.d.ts} +1 -1
  35. package/dist/workflow/index.cjs +7 -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 +7 -7
  40. package/dist/workflow/index.mjs.map +1 -1
  41. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from './schemas/index.js';
2
- import { M as ModelResolutionOptions } from './provider-factory-DH3udYlN.js';
2
+ import { M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.js';
3
3
  import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from './supabasePublisher-C627qXFT.js';
4
4
  import * as workflow from 'workflow';
5
5
  import { z } from 'zod';
@@ -1,5 +1,5 @@
1
1
  import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from './schemas/index.cjs';
2
- import { M as ModelResolutionOptions } from './provider-factory-DH3udYlN.cjs';
2
+ import { M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.cjs';
3
3
  import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from './supabasePublisher-C627qXFT.cjs';
4
4
  import * as workflow from 'workflow';
5
5
  import { z } from 'zod';
package/dist/index.cjs CHANGED
@@ -212,7 +212,7 @@ function isModelAllowed(model) {
212
212
  }
213
213
  function getDesignatedFallbackChain() {
214
214
  const rawProviders = resolveApiKey("FALLBACK_AI_PROVIDER") || resolveApiKey("FALLBACK_AI_PROVIDERS") || resolveApiKey("DEFAULT_AI_PROVIDER") || "nvidia,openrouter";
215
- 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";
215
+ 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";
216
216
  const providerList = rawProviders.split(",").map((p) => p.trim().toLowerCase()).filter((p) => p.length > 0 && isProviderEnabled(p));
217
217
  const modelList = rawModels.split(",").map((m) => m.trim()).filter((m) => m.length > 0 && isModelAllowed(m));
218
218
  const chain = [];
@@ -221,7 +221,7 @@ function getDesignatedFallbackChain() {
221
221
  if (provider === "nvidia") {
222
222
  providerModels = modelList.filter((m) => m.startsWith("nvidia/") || m.startsWith("meta/") || m.startsWith("mistralai/"));
223
223
  if (providerModels.length === 0) {
224
- providerModels = ["nvidia/nemotron-3-ultra-550b-a55b", "nvidia/nemotron-3.5-lightning-30b-a3b"];
224
+ providerModels = ["nvidia/nemotron-3-ultra-550b-a55b:free", "nvidia/nemotron-3.5-lightning-30b-a3b"];
225
225
  }
226
226
  } else if (provider === "openrouter") {
227
227
  providerModels = modelList.filter((m) => m.startsWith("@") || m.includes("/") || m.includes(":"));
@@ -257,7 +257,7 @@ function getDesignatedFallbackChain() {
257
257
  function getDesignatedFallbackConfig() {
258
258
  const chain = getDesignatedFallbackChain();
259
259
  if (chain.length > 0) return chain[0];
260
- return { provider: "nvidia", model: "nvidia/nemotron-3-ultra-550b-a55b" };
260
+ return { provider: "nvidia", model: "nvidia/nemotron-3-ultra-550b-a55b:free" };
261
261
  }
262
262
  function extractThoughtAndContent(rawText) {
263
263
  let text = rawText || "";
@@ -488,8 +488,8 @@ Guidelines:
488
488
  const isNvidiaPreferred = requestedModel.startsWith("nvidia/") || Boolean(nvidiaKey && !openrouterKey) && isProviderEnabled("nvidia");
489
489
  if (nvidiaKey && isProviderEnabled("nvidia")) {
490
490
  const candidateNemotronModels = [
491
- requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b",
492
- "nvidia/nemotron-3-ultra-550b-a55b",
491
+ requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b:free",
492
+ "nvidia/nemotron-3-ultra-550b-a55b:free",
493
493
  "nvidia/nemotron-3.5-lightning-30b-a3b",
494
494
  "nvidia/nemotron-3-super-120b-a12b",
495
495
  "nvidia/llama-3.1-nemotron-70b-instruct"
@@ -2649,7 +2649,7 @@ var RoadmapInputSchema = zod.z.object({
2649
2649
  // src/ai/provider-factory.ts
2650
2650
  init_streamRunner();
2651
2651
  var DEFAULT_MODELS = {
2652
- nvidia: "nvidia/nemotron-3-ultra-550b-a55b",
2652
+ nvidia: "nvidia/nemotron-3-ultra-550b-a55b:free",
2653
2653
  openrouter: "@preset/coding-free",
2654
2654
  alibaba: "qwen3.7-plus",
2655
2655
  dashscope: "qwen3.7-plus",
@@ -2660,7 +2660,7 @@ var DEFAULT_MODELS = {
2660
2660
  };
2661
2661
  var NVIDIA_MODELS = {
2662
2662
  codingFast: "nvidia/nemotron-3.5-lightning-30b-a3b",
2663
- reasoningUltra: "nvidia/nemotron-3-ultra-550b-a55b",
2663
+ reasoningUltra: "nvidia/nemotron-3-ultra-550b-a55b:free",
2664
2664
  superMoE: "nvidia/nemotron-3-super-120b-a12b",
2665
2665
  llamaNemotron: "nvidia/llama-3.1-nemotron-70b-instruct",
2666
2666
  translation: "nvidia/riva-translate-4b-instruct-v2",
@@ -2686,7 +2686,7 @@ function getAIModel(options = {}) {
2686
2686
  apiKey,
2687
2687
  baseURL: options.baseURL || "https://integrate.api.nvidia.com/v1"
2688
2688
  });
2689
- return nvidia.chat(resolvedModelName || "nvidia/nemotron-3-ultra-550b-a55b");
2689
+ return nvidia.chat(resolvedModelName || "nvidia/nemotron-3-ultra-550b-a55b:free");
2690
2690
  }
2691
2691
  if (provider === "openrouter") {
2692
2692
  const apiKey = options.apiKey || process.env.OPENROUTER_API_KEY || process.env.OPENAI_API_KEY || "";
@@ -6351,7 +6351,7 @@ var ModelPolicyResolver = class {
6351
6351
  {
6352
6352
  provider: "nvidia",
6353
6353
  providerLabel: "NVIDIA NIM API",
6354
- modelName: "nvidia/nemotron-3-ultra-550b-a55b",
6354
+ modelName: "nvidia/nemotron-3-ultra-550b-a55b:free",
6355
6355
  maxTokens: 32768,
6356
6356
  temperature: 0.15,
6357
6357
  reasoningEffort: "high",
@@ -6776,7 +6776,7 @@ var PROVIDER_ENDPOINTS = {
6776
6776
  alibaba: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",
6777
6777
  nvidia: "https://integrate.api.nvidia.com/v1/chat/completions"
6778
6778
  };
6779
- var NVIDIA_DEFAULT_MODEL = "nvidia/nemotron-3-ultra-550b-a55b";
6779
+ var NVIDIA_DEFAULT_MODEL = "nvidia/nemotron-3-ultra-550b-a55b:free";
6780
6780
  function resolveProviderRoute(options) {
6781
6781
  const openrouterKey = options.openrouterKey?.trim() || (typeof process !== "undefined" ? process.env.OPENROUTER_API_KEY || "" : "");
6782
6782
  const deepseekKey = options.deepseekKey?.trim() || (typeof process !== "undefined" ? process.env.DEEPSEEK_API_KEY || "" : "");
@@ -13549,7 +13549,7 @@ function safeParseJson(rawText) {
13549
13549
  return null;
13550
13550
  }
13551
13551
  }
13552
- async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onChunk) {
13552
+ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onChunk, preferredModel, preferredProvider) {
13553
13553
  const alibabaKey = apiKeys.alibaba || apiKeys.dashscope || process.env.ALIBABA_API_KEY || process.env.DASHSCOPE_API_KEY;
13554
13554
  const nvidiaKey = apiKeys.nvidia || process.env.NVIDIA_API_KEY;
13555
13555
  const deepseekKey = apiKeys.deepseek || process.env.DEEPSEEK_API_KEY;
@@ -13557,6 +13557,11 @@ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onC
13557
13557
  const geminiKey = apiKeys.gemini || process.env.GEMINI_API_KEY;
13558
13558
  const openrouterPreset = process.env.OPENROUTER_FREE_PRESET || "@preset/coding-free";
13559
13559
  const candidates = [];
13560
+ if (preferredModel) {
13561
+ const prov = preferredProvider || "openrouter";
13562
+ const key = apiKeys[prov] || (prov === "openrouter" ? openrouterKey : prov === "nvidia" ? nvidiaKey : prov === "alibaba" ? alibabaKey : geminiKey) || "";
13563
+ candidates.push({ provider: prov, model: preferredModel, apiKey: key });
13564
+ }
13560
13565
  if (openrouterKey && isProviderEnabled("openrouter")) {
13561
13566
  const orModels = [
13562
13567
  openrouterPreset,
@@ -13564,11 +13569,12 @@ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onC
13564
13569
  "nvidia/nemotron-3-super-120b-a12b:free",
13565
13570
  "nvidia/nemotron-3-ultra-550b-a55b:free",
13566
13571
  "nvidia/nemotron-3.5-lightning:free",
13567
- "minimax/minimax-m3:free",
13568
13572
  "cohere/north-mini-code:free"
13569
13573
  ].filter((m) => isModelAllowed(m));
13570
13574
  for (const m of Array.from(new Set(orModels))) {
13571
- candidates.push({ provider: "openrouter", model: m, apiKey: openrouterKey });
13575
+ if (!candidates.some((c) => c.provider === "openrouter" && c.model === m)) {
13576
+ candidates.push({ provider: "openrouter", model: m, apiKey: openrouterKey });
13577
+ }
13572
13578
  }
13573
13579
  }
13574
13580
  if (nvidiaKey && isProviderEnabled("nvidia")) {
@@ -13579,25 +13585,33 @@ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onC
13579
13585
  "nvidia/llama-3.1-nemotron-70b-instruct"
13580
13586
  ].filter((m) => isModelAllowed(m));
13581
13587
  for (const m of nemotronModels) {
13582
- candidates.push({ provider: "nvidia", model: m, apiKey: nvidiaKey });
13588
+ if (!candidates.some((c) => c.provider === "nvidia" && c.model === m)) {
13589
+ candidates.push({ provider: "nvidia", model: m, apiKey: nvidiaKey });
13590
+ }
13583
13591
  }
13584
13592
  }
13585
13593
  if (alibabaKey && isProviderEnabled("alibaba")) {
13586
13594
  const aliModels = ["qwen-plus", "qwen-turbo", "qwen3.7-plus"].filter((m) => isModelAllowed(m));
13587
13595
  for (const m of aliModels) {
13588
- candidates.push({ provider: "alibaba", model: m, apiKey: alibabaKey });
13596
+ if (!candidates.some((c) => c.provider === "alibaba" && c.model === m)) {
13597
+ candidates.push({ provider: "alibaba", model: m, apiKey: alibabaKey });
13598
+ }
13589
13599
  }
13590
13600
  }
13591
13601
  if (deepseekKey && isProviderEnabled("deepseek")) {
13592
13602
  const dsModels = ["deepseek-chat", "deepseek-coder"].filter((m) => isModelAllowed(m));
13593
13603
  for (const m of dsModels) {
13594
- candidates.push({ provider: "deepseek", model: m, apiKey: deepseekKey });
13604
+ if (!candidates.some((c) => c.provider === "deepseek" && c.model === m)) {
13605
+ candidates.push({ provider: "deepseek", model: m, apiKey: deepseekKey });
13606
+ }
13595
13607
  }
13596
13608
  }
13597
13609
  if (geminiKey && (isProviderEnabled("gemini") || isProviderEnabled("google"))) {
13598
13610
  const gModels = ["gemini-1.5-flash", "gemini-2.0-flash", "gemini-1.5-pro"].filter((m) => isModelAllowed(m));
13599
13611
  for (const m of gModels) {
13600
- candidates.push({ provider: "google", model: m, apiKey: geminiKey });
13612
+ if (!candidates.some((c) => c.provider === "google" && c.model === m)) {
13613
+ candidates.push({ provider: "google", model: m, apiKey: geminiKey });
13614
+ }
13601
13615
  }
13602
13616
  }
13603
13617
  const fallbackChain = getDesignatedFallbackChain();
@@ -13626,15 +13640,27 @@ THINKING DIRECTIVE: Keep reasoning concise, structured, and focused strictly on
13626
13640
  system: systemInstructions,
13627
13641
  prompt: userPrompt,
13628
13642
  temperature: 0.2,
13629
- abortSignal: AbortSignal.timeout(25e3)
13643
+ includeRawChunks: true,
13644
+ abortSignal: AbortSignal.timeout(6e4)
13630
13645
  });
13631
13646
  let fullContent = "";
13632
13647
  for await (const part of streamResult.fullStream) {
13633
13648
  if (part.type === "reasoning-delta") {
13634
- onChunk?.(part.text, "thought");
13649
+ const thoughtText = part.text ?? part.delta ?? "";
13650
+ if (thoughtText) onChunk?.(thoughtText, "thought");
13651
+ } else if (part.type === "raw") {
13652
+ const raw = part.rawValue;
13653
+ const delta = raw?.choices?.[0]?.delta;
13654
+ const reasoning = delta?.reasoning_content || delta?.reasoning;
13655
+ if (reasoning) {
13656
+ onChunk?.(reasoning, "thought");
13657
+ }
13635
13658
  } else if (part.type === "text-delta") {
13636
- fullContent += part.text;
13637
- onChunk?.(part.text, "content");
13659
+ const textDelta = part.text ?? part.delta ?? "";
13660
+ if (textDelta) {
13661
+ fullContent += textDelta;
13662
+ onChunk?.(textDelta, "content");
13663
+ }
13638
13664
  }
13639
13665
  }
13640
13666
  if (fullContent.trim()) {
@@ -13750,11 +13776,12 @@ ${targetLayer === 1 ? `
13750
13776
  - Field 5 (id: 'entryBridge', type: 'single_choice'): Recommended prerequisite baseline & bridge mechanism for ${targetAge}.
13751
13777
  ` : targetLayer === 2 ? `
13752
13778
  - Layer 2 MUST focus on Teaching Framework, Persona & Lab Logistics (Methodology & Content Style baseline).
13753
- - Field 1 (id: 'pedagogy', type: 'single_choice'): Core pedagogical model (PBL, EDP, 5E, Hybrid 5E+PBL) with pros/cons analyzed in descriptions.
13754
- - Field 2 (id: 'voiceAndTone', type: 'single_choice'): Persona & Teaching Voice (CONTENT_STYLE_GUIDE: Encouraging Mentor vs Industry Engineer vs Storyteller Guide vs Socratic Facilitator).
13755
- - Field 3 (id: 'classDynamic', type: 'single_choice'): Class structure & Kit ratio (1:1 Individual, 2:1 Pair Programming, 3-4 Project Team).
13756
- - Field 4 (id: 'hardwareDeployment', type: 'single_choice'): Lab logistics deployment (Lab kits provided, BYOD, Cloud simulator, Take-home kit).
13757
- - Field 5 (id: 'teacherRole', type: 'single_choice'): Teacher role and instructional modality (Teacher-led step-by-step vs Facilitator vs Mentor).
13779
+ - Field 1 (id: 'lessonPacingModel', type: 'single_choice'): Lesson pacing model (e.g. 1 Session = 1 Independent Lesson vs Multi-session Thematic Units vs Hybrid Modular) with pedagogical pros/cons matching course duration.
13780
+ - Field 2 (id: 'pedagogy', type: 'single_choice'): Core pedagogical model (PBL, EDP, 5E, Hybrid 5E+PBL) with pros/cons analyzed in descriptions.
13781
+ - Field 3 (id: 'voiceAndTone', type: 'single_choice'): Persona & Teaching Voice (CONTENT_STYLE_GUIDE: Encouraging Mentor vs Industry Engineer vs Storyteller Guide vs Socratic Facilitator).
13782
+ - Field 4 (id: 'classDynamic', type: 'single_choice'): Class structure & Kit ratio (1:1 Individual, 2:1 Pair Programming, 3-4 Project Team).
13783
+ - Field 5 (id: 'hardwareDeployment', type: 'single_choice'): Lab logistics deployment (Lab kits provided, BYOD, Cloud simulator, Take-home kit).
13784
+ - Field 6 (id: 'teacherRole', type: 'single_choice'): Teacher role and instructional modality (Teacher-led step-by-step vs Facilitator vs Mentor).
13758
13785
  ` : `
13759
13786
  - Layer 3 MUST focus on Concrete Execution, Art Direction & Packaging (Now that user confirmed Pedagogy '${pedagogy}').
13760
13787
  - Field 1 (id: 'capstoneTheme', type: 'textarea'): Detailed Capstone product theme designed strictly around confirmed '${pedagogy}' model and '${exitVision}'.
@@ -13821,7 +13848,9 @@ REQUIREMENT: Synthesize all parameters above and produce the high-fidelity pre-f
13821
13848
  (chunk, type) => {
13822
13849
  if (type === "content") rawContent += chunk;
13823
13850
  onChunk?.(chunk, type);
13824
- }
13851
+ },
13852
+ options.model,
13853
+ options.provider
13825
13854
  );
13826
13855
  const parsed = safeParseJson(rawContent);
13827
13856
  return {