@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
package/dist/ai/index.cjs CHANGED
@@ -175,7 +175,7 @@ function isModelAllowed(model) {
175
175
  }
176
176
  function getDesignatedFallbackChain() {
177
177
  const rawProviders = resolveApiKey("FALLBACK_AI_PROVIDER") || resolveApiKey("FALLBACK_AI_PROVIDERS") || resolveApiKey("DEFAULT_AI_PROVIDER") || "nvidia,openrouter";
178
- 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";
178
+ 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";
179
179
  const providerList = rawProviders.split(",").map((p) => p.trim().toLowerCase()).filter((p) => p.length > 0 && isProviderEnabled(p));
180
180
  const modelList = rawModels.split(",").map((m) => m.trim()).filter((m) => m.length > 0 && isModelAllowed(m));
181
181
  const chain = [];
@@ -184,7 +184,7 @@ function getDesignatedFallbackChain() {
184
184
  if (provider === "nvidia") {
185
185
  providerModels = modelList.filter((m) => m.startsWith("nvidia/") || m.startsWith("meta/") || m.startsWith("mistralai/"));
186
186
  if (providerModels.length === 0) {
187
- providerModels = ["nvidia/nemotron-3-ultra-550b-a55b", "nvidia/nemotron-3.5-lightning-30b-a3b"];
187
+ providerModels = ["nvidia/nemotron-3-ultra-550b-a55b:free", "nvidia/nemotron-3.5-lightning-30b-a3b"];
188
188
  }
189
189
  } else if (provider === "openrouter") {
190
190
  providerModels = modelList.filter((m) => m.startsWith("@") || m.includes("/") || m.includes(":"));
@@ -220,7 +220,7 @@ function getDesignatedFallbackChain() {
220
220
  function getDesignatedFallbackConfig() {
221
221
  const chain = getDesignatedFallbackChain();
222
222
  if (chain.length > 0) return chain[0];
223
- return { provider: "nvidia", model: "nvidia/nemotron-3-ultra-550b-a55b" };
223
+ return { provider: "nvidia", model: "nvidia/nemotron-3-ultra-550b-a55b:free" };
224
224
  }
225
225
  function extractThoughtAndContent(rawText) {
226
226
  let text = rawText || "";
@@ -413,6 +413,32 @@ Guidelines:
413
413
  3. Keep technical terminology and official API symbols intact.
414
414
  4. Format output using clean Markdown, clear sections, bullet points, and code blocks where required.
415
415
  5. Do NOT use emojis in headings, tab titles, or UI navigation labels.`;
416
+ if (options.customInference) {
417
+ try {
418
+ const text = await options.customInference({
419
+ systemInstruction,
420
+ userPrompt: messages.map((m) => m.content).join("\n\n"),
421
+ messages,
422
+ temperature,
423
+ maxTokens,
424
+ onChunk: onChunk ?? (() => {
425
+ })
426
+ });
427
+ if (text && text.trim()) return text;
428
+ throw createAiInferenceError({
429
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
430
+ message: "customInference returned empty output",
431
+ rawError: { customInference: "empty response" }
432
+ });
433
+ } catch (e) {
434
+ if (e?.errorCode || e?.name === "AiInferenceError") throw e;
435
+ throw createAiInferenceError({
436
+ errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
437
+ message: `customInference failed: ${e?.message || e}`,
438
+ rawError: { customInference: String(e?.message || e) }
439
+ });
440
+ }
441
+ }
416
442
  const formattedMessages = [
417
443
  { role: "system", content: systemInstruction },
418
444
  ...messages.map((m) => ({
@@ -425,8 +451,8 @@ Guidelines:
425
451
  const isNvidiaPreferred = requestedModel.startsWith("nvidia/") || Boolean(nvidiaKey && !openrouterKey) && isProviderEnabled("nvidia");
426
452
  if (nvidiaKey && isProviderEnabled("nvidia")) {
427
453
  const candidateNemotronModels = [
428
- requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b",
429
- "nvidia/nemotron-3-ultra-550b-a55b",
454
+ requestedModel.startsWith("nvidia/") ? requestedModel : "nvidia/nemotron-3-ultra-550b-a55b:free",
455
+ "nvidia/nemotron-3-ultra-550b-a55b:free",
430
456
  "nvidia/nemotron-3.5-lightning-30b-a3b",
431
457
  "nvidia/nemotron-3-super-120b-a12b",
432
458
  "nvidia/llama-3.1-nemotron-70b-instruct"
@@ -785,7 +811,7 @@ async function runCurriculumAIInference(messages, projectContext, options = {},
785
811
 
786
812
  // src/ai/provider-factory.ts
787
813
  var DEFAULT_MODELS = {
788
- nvidia: "nvidia/nemotron-3-ultra-550b-a55b",
814
+ nvidia: "nvidia/nemotron-3-ultra-550b-a55b:free",
789
815
  openrouter: "@preset/coding-free",
790
816
  alibaba: "qwen3.7-plus",
791
817
  dashscope: "qwen3.7-plus",
@@ -796,7 +822,7 @@ var DEFAULT_MODELS = {
796
822
  };
797
823
  var NVIDIA_MODELS = {
798
824
  codingFast: "nvidia/nemotron-3.5-lightning-30b-a3b",
799
- reasoningUltra: "nvidia/nemotron-3-ultra-550b-a55b",
825
+ reasoningUltra: "nvidia/nemotron-3-ultra-550b-a55b:free",
800
826
  superMoE: "nvidia/nemotron-3-super-120b-a12b",
801
827
  llamaNemotron: "nvidia/llama-3.1-nemotron-70b-instruct",
802
828
  translation: "nvidia/riva-translate-4b-instruct-v2",
@@ -822,7 +848,7 @@ function getAIModel(options = {}) {
822
848
  apiKey,
823
849
  baseURL: options.baseURL || "https://integrate.api.nvidia.com/v1"
824
850
  });
825
- return nvidia.chat(resolvedModelName || "nvidia/nemotron-3-ultra-550b-a55b");
851
+ return nvidia.chat(resolvedModelName || "nvidia/nemotron-3-ultra-550b-a55b:free");
826
852
  }
827
853
  if (provider === "openrouter") {
828
854
  const apiKey = options.apiKey || process.env.OPENROUTER_API_KEY || process.env.OPENAI_API_KEY || "";
@@ -4309,7 +4335,7 @@ var ModelPolicyResolver = class {
4309
4335
  {
4310
4336
  provider: "nvidia",
4311
4337
  providerLabel: "NVIDIA NIM API",
4312
- modelName: "nvidia/nemotron-3-ultra-550b-a55b",
4338
+ modelName: "nvidia/nemotron-3-ultra-550b-a55b:free",
4313
4339
  maxTokens: 32768,
4314
4340
  temperature: 0.15,
4315
4341
  reasoningEffort: "high",
@@ -4734,7 +4760,7 @@ var PROVIDER_ENDPOINTS = {
4734
4760
  alibaba: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions",
4735
4761
  nvidia: "https://integrate.api.nvidia.com/v1/chat/completions"
4736
4762
  };
4737
- var NVIDIA_DEFAULT_MODEL = "nvidia/nemotron-3-ultra-550b-a55b";
4763
+ var NVIDIA_DEFAULT_MODEL = "nvidia/nemotron-3-ultra-550b-a55b:free";
4738
4764
  function resolveProviderRoute(options) {
4739
4765
  const openrouterKey = options.openrouterKey?.trim() || (typeof process !== "undefined" ? process.env.OPENROUTER_API_KEY || "" : "");
4740
4766
  const deepseekKey = options.deepseekKey?.trim() || (typeof process !== "undefined" ? process.env.DEEPSEEK_API_KEY || "" : "");