@thanh01.pmt/curriculum-kit 1.0.15 → 1.0.17

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.d.cts CHANGED
@@ -3,7 +3,7 @@ export { ActiveLearningWorkflow, ActiveLearningWorkflowSchema, ActivityLabSchema
3
3
  import { A as AIProviderName, M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.cjs';
4
4
  export { N as NVIDIA_MODELS, g as getAIModel } from './provider-factory-DxzOVEmh.cjs';
5
5
  export { ActivityPromptInput, AggregatedToolCall, AsyncLLMJudgeInput, AuditCurriculumQualityInput, CodeLabPromptInput, DEFAULT_ENABLED_PROVIDERS, DiagnosticQuizPromptInput, ExtensionPromptInput, GenerateActivityInput, GenerateCodeLabInput, GenerateDiagnosticQuizInput, GenerateExtensionInput, GenerateHandoutInput, GenerateLessonMasterInput, GenerateProjectInstructionInput, GenerateSelfLabInput, GenerateSlidesInput, GenerateTeacherGuideInput, GenerateWorksheetInput, HandoutPromptInput, JudgeEvaluationResult, JudgePromptInput, LLMJudgeEngine, LessonPromptInput, ModelPolicyResolution, ModelPolicyResolver, ModelProviderKey, MultiProviderPolicyResolution, ProjectInstructionPromptInput, SelfLabPromptInput, SlidesPromptInput, StreamDiagnosticQuizInput, StreamLessonMasterInput, StreamSelfLabInput, TeacherGuidePromptInput, ToolDefinition, ToolExecutionResult, ToolExecutor, ToolLoopConfig, WorksheetPromptInput, activityTools, analystTools, assessorTools, auditCurriculumQualityFlow, buildActivityPrompt, buildCodeLabPrompt, buildDiagnosticQuizPrompt, buildExtensionPrompt, buildHandoutPrompt, buildJudgePrompt, buildLessonMasterPrompt, buildProjectInstructionPrompt, buildSelfLabPrompt, buildSlidesPrompt, buildTeacherGuidePrompt, buildWorksheetPrompt, contentTools, designerTools, generateActivityFlow, generateCodeLabFlow, generateDiagnosticQuizFlow, generateExtensionFlow, generateHandoutFlow, generateLessonMasterFlow, generateProjectInstructionFlow, generateSelfLabFlow, generateSlidesFlow, generateTeacherGuideFlow, generateWorksheetFlow, illustratorTools, packagerTools, researcherTools, reviewerTools, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLessonMasterFlow, streamSelfLabFlow, techSmeTools } from './ai/index.cjs';
6
- export { C as ChatMessage, c as ChunkType, F as FallbackTarget, S as StreamRunnerOptions, 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';
6
+ export { C as ChatMessage, c as ChunkType, D as DEFAULT_ARTIFACT_STREAM_IDLE_MS, d as DEFAULT_ARTIFACT_STREAM_TOTAL_MS, F as FallbackTarget, I as IdleAbort, f as StreamAbortController, S as StreamRunnerOptions, j as createIdleAbortController, h as createStreamAbortController, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from './streamRunner-DtQq0HV_.cjs';
7
7
  export { ArtifactLintReport, ConvertedSotBundle, GenerateProjectInstructionOptions, GenerateRoadmapCurriculumOptions, GenerateSelfPacedBundleInput, LintIssue, ProjectInstructionResult, RoadmapCurriculumOutput, SelfPacedBundleOutput, convertRoadmapToFoundationSot, generateProjectInstruction, generateRoadmapCurriculum, generateSelfPacedBundle, importRoadmapToProject, lintAndSanitizeArtifact, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, validateMarkdownTables, validateMermaidSyntax } from './pipeline/index.cjs';
8
8
  export { A as AutoRepairOptions, a as AutoRepairResult, B as BundleTier, G as GenerateMilestoneBundleOptions, M as MilestoneCurriculumBundle, g as generateMilestoneCurriculumBundle, w as withAutoRepair } from './milestoneBundleGenerator-CzSOeAzU.cjs';
9
9
  import { I as ICurriculumStorage, P as ProjectStatusReport, S as SmartResumeContext, Q as QualityAuditReport } from './types-BUJGYiep.cjs';
@@ -407,12 +407,15 @@ interface ExtractedStreamChunk {
407
407
  * Pure function so the extraction contract is unit-testable.
408
408
  *
409
409
  * Reasoning arrives through provider-specific shapes:
410
- * - `reasoning-delta` / legacy `reasoning` parts (mapped by SDK providers),
411
- * - `raw` parts (emitted when `includeRawChunks: true`) whose `rawValue` is the
412
- * provider's OpenAI-compatible SSE chunk: NVIDIA NIM & DeepSeek put thinking
413
- * in `choices[0].delta.reasoning_content`, OpenRouter in `choices[0].delta.reasoning`.
414
- * Without this extraction the entire thinking phase renders as a blank UI
415
- * (only text-delta reaches the caller) the observed ~30s silent wait.
410
+ * - `reasoning-delta` / legacy `reasoning` parts (mapped by SDK providers).
411
+ *
412
+ * DUP-STREAM FIX (measured live against NVIDIA NIM nemotron-ultra, 2026-09-10):
413
+ * with `includeRawChunks: true` the SDK emits BOTH the mapped `text-delta`
414
+ * /`reasoning-delta` part AND the `raw` provider chunk carrying the SAME
415
+ * token. Extracting text from `raw` parts therefore duplicated every token
416
+ * ("Lớp 1ớp 1 (6-7 (6-7 tuổi)…"), destroying the JSON and causing the ~90%
417
+ * wizard prefill failure. The mapped parts are the single source of truth —
418
+ * `raw` parts must contribute NOTHING here.
416
419
  */
417
420
  declare function extractStreamChunk(part: any): ExtractedStreamChunk;
418
421
  declare function createStreamAbortSignal(budget: Required<StreamBudget>): StreamAbortHandle;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { ActiveLearningWorkflow, ActiveLearningWorkflowSchema, ActivityLabSchema
3
3
  import { A as AIProviderName, M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.js';
4
4
  export { N as NVIDIA_MODELS, g as getAIModel } from './provider-factory-DxzOVEmh.js';
5
5
  export { ActivityPromptInput, AggregatedToolCall, AsyncLLMJudgeInput, AuditCurriculumQualityInput, CodeLabPromptInput, DEFAULT_ENABLED_PROVIDERS, DiagnosticQuizPromptInput, ExtensionPromptInput, GenerateActivityInput, GenerateCodeLabInput, GenerateDiagnosticQuizInput, GenerateExtensionInput, GenerateHandoutInput, GenerateLessonMasterInput, GenerateProjectInstructionInput, GenerateSelfLabInput, GenerateSlidesInput, GenerateTeacherGuideInput, GenerateWorksheetInput, HandoutPromptInput, JudgeEvaluationResult, JudgePromptInput, LLMJudgeEngine, LessonPromptInput, ModelPolicyResolution, ModelPolicyResolver, ModelProviderKey, MultiProviderPolicyResolution, ProjectInstructionPromptInput, SelfLabPromptInput, SlidesPromptInput, StreamDiagnosticQuizInput, StreamLessonMasterInput, StreamSelfLabInput, TeacherGuidePromptInput, ToolDefinition, ToolExecutionResult, ToolExecutor, ToolLoopConfig, WorksheetPromptInput, activityTools, analystTools, assessorTools, auditCurriculumQualityFlow, buildActivityPrompt, buildCodeLabPrompt, buildDiagnosticQuizPrompt, buildExtensionPrompt, buildHandoutPrompt, buildJudgePrompt, buildLessonMasterPrompt, buildProjectInstructionPrompt, buildSelfLabPrompt, buildSlidesPrompt, buildTeacherGuidePrompt, buildWorksheetPrompt, contentTools, designerTools, generateActivityFlow, generateCodeLabFlow, generateDiagnosticQuizFlow, generateExtensionFlow, generateHandoutFlow, generateLessonMasterFlow, generateProjectInstructionFlow, generateSelfLabFlow, generateSlidesFlow, generateTeacherGuideFlow, generateWorksheetFlow, illustratorTools, packagerTools, researcherTools, reviewerTools, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLessonMasterFlow, streamSelfLabFlow, techSmeTools } from './ai/index.js';
6
- export { C as ChatMessage, c as ChunkType, F as FallbackTarget, S as StreamRunnerOptions, 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';
6
+ export { C as ChatMessage, c as ChunkType, D as DEFAULT_ARTIFACT_STREAM_IDLE_MS, d as DEFAULT_ARTIFACT_STREAM_TOTAL_MS, F as FallbackTarget, I as IdleAbort, f as StreamAbortController, S as StreamRunnerOptions, j as createIdleAbortController, h as createStreamAbortController, e as extractThoughtAndContent, g as getDesignatedFallbackChain, b as getDesignatedFallbackConfig, a as isModelAllowed, i as isProviderEnabled, r as runCurriculumAIInference, s as streamCurriculumAIInference } from './streamRunner-DtQq0HV_.js';
7
7
  export { ArtifactLintReport, ConvertedSotBundle, GenerateProjectInstructionOptions, GenerateRoadmapCurriculumOptions, GenerateSelfPacedBundleInput, LintIssue, ProjectInstructionResult, RoadmapCurriculumOutput, SelfPacedBundleOutput, convertRoadmapToFoundationSot, generateProjectInstruction, generateRoadmapCurriculum, generateSelfPacedBundle, importRoadmapToProject, lintAndSanitizeArtifact, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, validateMarkdownTables, validateMermaidSyntax } from './pipeline/index.js';
8
8
  export { A as AutoRepairOptions, a as AutoRepairResult, B as BundleTier, G as GenerateMilestoneBundleOptions, M as MilestoneCurriculumBundle, g as generateMilestoneCurriculumBundle, w as withAutoRepair } from './milestoneBundleGenerator-Bkba8OPG.js';
9
9
  import { I as ICurriculumStorage, P as ProjectStatusReport, S as SmartResumeContext, Q as QualityAuditReport } from './types-BUJGYiep.js';
@@ -407,12 +407,15 @@ interface ExtractedStreamChunk {
407
407
  * Pure function so the extraction contract is unit-testable.
408
408
  *
409
409
  * Reasoning arrives through provider-specific shapes:
410
- * - `reasoning-delta` / legacy `reasoning` parts (mapped by SDK providers),
411
- * - `raw` parts (emitted when `includeRawChunks: true`) whose `rawValue` is the
412
- * provider's OpenAI-compatible SSE chunk: NVIDIA NIM & DeepSeek put thinking
413
- * in `choices[0].delta.reasoning_content`, OpenRouter in `choices[0].delta.reasoning`.
414
- * Without this extraction the entire thinking phase renders as a blank UI
415
- * (only text-delta reaches the caller) the observed ~30s silent wait.
410
+ * - `reasoning-delta` / legacy `reasoning` parts (mapped by SDK providers).
411
+ *
412
+ * DUP-STREAM FIX (measured live against NVIDIA NIM nemotron-ultra, 2026-09-10):
413
+ * with `includeRawChunks: true` the SDK emits BOTH the mapped `text-delta`
414
+ * /`reasoning-delta` part AND the `raw` provider chunk carrying the SAME
415
+ * token. Extracting text from `raw` parts therefore duplicated every token
416
+ * ("Lớp 1ớp 1 (6-7 (6-7 tuổi)…"), destroying the JSON and causing the ~90%
417
+ * wizard prefill failure. The mapped parts are the single source of truth —
418
+ * `raw` parts must contribute NOTHING here.
416
419
  */
417
420
  declare function extractStreamChunk(part: any): ExtractedStreamChunk;
418
421
  declare function createStreamAbortSignal(budget: Required<StreamBudget>): StreamAbortHandle;
package/dist/index.mjs CHANGED
@@ -129,6 +129,10 @@ var init_errors = __esm({
129
129
  // src/ai/streamRunner.ts
130
130
  var streamRunner_exports = {};
131
131
  __export(streamRunner_exports, {
132
+ DEFAULT_ARTIFACT_STREAM_IDLE_MS: () => DEFAULT_ARTIFACT_STREAM_IDLE_MS,
133
+ DEFAULT_ARTIFACT_STREAM_TOTAL_MS: () => DEFAULT_ARTIFACT_STREAM_TOTAL_MS,
134
+ createIdleAbortController: () => createIdleAbortController,
135
+ createStreamAbortController: () => createStreamAbortController,
132
136
  extractThoughtAndContent: () => extractThoughtAndContent,
133
137
  getDesignatedFallbackChain: () => getDesignatedFallbackChain,
134
138
  getDesignatedFallbackConfig: () => getDesignatedFallbackConfig,
@@ -280,29 +284,44 @@ function extractThoughtAndContent(rawText) {
280
284
  content: content.trim()
281
285
  };
282
286
  }
283
- function createIdleAbortController(idleMs) {
287
+ function createStreamAbortController(options) {
288
+ const envIdle = Number(process.env.ARTIFACT_STREAM_IDLE_TIMEOUT_MS || process.env.STREAM_IDLE_TIMEOUT_MS);
289
+ const envTotal = Number(process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS || process.env.STREAM_TOTAL_TIMEOUT_MS);
290
+ const idleMs = Number.isFinite(options?.idleMs) && options.idleMs > 0 ? options.idleMs : Number.isFinite(envIdle) && envIdle > 0 ? envIdle : DEFAULT_ARTIFACT_STREAM_IDLE_MS;
291
+ const totalMs = Number.isFinite(options?.totalMs) && options.totalMs > 0 ? options.totalMs : Number.isFinite(envTotal) && envTotal > 0 ? envTotal : DEFAULT_ARTIFACT_STREAM_TOTAL_MS;
284
292
  const controller = new AbortController();
285
- let timer = null;
286
- const arm = () => {
287
- if (timer) clearTimeout(timer);
288
- timer = setTimeout(
293
+ let idleTimer = null;
294
+ let totalTimer = null;
295
+ const armIdle = () => {
296
+ if (idleTimer) clearTimeout(idleTimer);
297
+ idleTimer = setTimeout(
289
298
  () => controller.abort(new Error(`Idle timeout: no data for ${Math.round(idleMs / 1e3)}s`)),
290
299
  idleMs
291
300
  );
292
- timer?.unref?.();
301
+ idleTimer?.unref?.();
293
302
  };
294
- arm();
303
+ armIdle();
304
+ if (totalMs > 0) {
305
+ totalTimer = setTimeout(
306
+ () => controller.abort(new Error(`Total stream timeout after ${Math.round(totalMs / 1e3)}s`)),
307
+ totalMs
308
+ );
309
+ totalTimer?.unref?.();
310
+ }
295
311
  return {
296
312
  signal: controller.signal,
297
- /** Reset the idle window (call on every received chunk). */
298
- kick: arm,
299
- /** Clear the pending timer once the request lifecycle is over. */
313
+ kick: armIdle,
300
314
  dispose: () => {
301
- if (timer) clearTimeout(timer);
302
- timer = null;
315
+ if (idleTimer) clearTimeout(idleTimer);
316
+ if (totalTimer) clearTimeout(totalTimer);
317
+ idleTimer = null;
318
+ totalTimer = null;
303
319
  }
304
320
  };
305
321
  }
322
+ function createIdleAbortController(idleMs, totalMs) {
323
+ return createStreamAbortController({ idleMs, totalMs });
324
+ }
306
325
  async function processOpenAISSEStream(response, onChunk, idle, toolCallCollector) {
307
326
  if (!response.body) return "";
308
327
  const reader = response.body.getReader();
@@ -486,7 +505,7 @@ Guidelines:
486
505
  if (isNvidiaPreferred || uniqueNvidiaModels.length > 0) {
487
506
  for (const model of uniqueNvidiaModels) {
488
507
  try {
489
- const idle = createIdleAbortController(18e4);
508
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
490
509
  const res = await fetch("https://integrate.api.nvidia.com/v1/chat/completions", {
491
510
  method: "POST",
492
511
  headers: {
@@ -530,7 +549,7 @@ Guidelines:
530
549
  const uniqueOrModels = Array.from(new Set(openrouterModels));
531
550
  for (const model of uniqueOrModels) {
532
551
  try {
533
- const idle = createIdleAbortController(18e4);
552
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
534
553
  const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
535
554
  method: "POST",
536
555
  headers: {
@@ -569,7 +588,7 @@ Guidelines:
569
588
  const dsModel = options.model?.includes("deepseek-reasoner") ? "deepseek-reasoner" : "deepseek-chat";
570
589
  if (isModelAllowed(dsModel)) {
571
590
  try {
572
- const idle = createIdleAbortController(18e4);
591
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
573
592
  const res = await fetch("https://api.deepseek.com/chat/completions", {
574
593
  method: "POST",
575
594
  headers: {
@@ -604,7 +623,7 @@ Guidelines:
604
623
  const baseUrl = alibabaKey.startsWith("sk-sp-") ? "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions" : "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions";
605
624
  for (const qwenModel of qwenModels) {
606
625
  try {
607
- const idle = createIdleAbortController(18e4);
626
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
608
627
  const payload = {
609
628
  model: qwenModel,
610
629
  messages: formattedMessages,
@@ -647,7 +666,7 @@ Guidelines:
647
666
  ];
648
667
  for (const gModel of geminiModels) {
649
668
  try {
650
- const idle = createIdleAbortController(18e4);
669
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
651
670
  const res = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${gModel}:streamGenerateContent?alt=sse&key=${geminiKey}`, {
652
671
  method: "POST",
653
672
  headers: { "Content-Type": "application/json" },
@@ -683,7 +702,7 @@ Guidelines:
683
702
  const { provider, model } = target;
684
703
  if (provider === "nvidia" && nvidiaKey && isProviderEnabled("nvidia")) {
685
704
  try {
686
- const idle = createIdleAbortController(18e4);
705
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
687
706
  const res = await fetch("https://integrate.api.nvidia.com/v1/chat/completions", {
688
707
  method: "POST",
689
708
  headers: {
@@ -715,7 +734,7 @@ Guidelines:
715
734
  }
716
735
  } else if (provider === "openrouter" && openrouterKey && isProviderEnabled("openrouter")) {
717
736
  try {
718
- const idle = createIdleAbortController(18e4);
737
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
719
738
  const res = await fetch("https://openrouter.ai/api/v1/chat/completions", {
720
739
  method: "POST",
721
740
  headers: {
@@ -750,7 +769,7 @@ Guidelines:
750
769
  } else if ((provider === "alibaba" || provider === "dashscope") && alibabaKey && isProviderEnabled("alibaba")) {
751
770
  const baseUrl = alibabaKey.startsWith("sk-sp-") ? "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1/chat/completions" : "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions";
752
771
  try {
753
- const idle = createIdleAbortController(18e4);
772
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
754
773
  const res = await fetch(baseUrl, {
755
774
  method: "POST",
756
775
  headers: {
@@ -782,7 +801,7 @@ Guidelines:
782
801
  }
783
802
  } else if ((provider === "google" || provider === "gemini") && geminiKey && (isProviderEnabled("gemini") || isProviderEnabled("google"))) {
784
803
  try {
785
- const idle = createIdleAbortController(18e4);
804
+ const idle = createStreamAbortController({ idleMs: options.idleTimeoutMs, totalMs: options.timeoutMs });
786
805
  const res = await fetch(
787
806
  `https://generativelanguage.googleapis.com/v1beta/models/${model}:streamGenerateContent?alt=sse&key=${geminiKey}`,
788
807
  {
@@ -833,9 +852,12 @@ Guidelines:
833
852
  async function runCurriculumAIInference(messages, projectContext, options = {}, onChunk) {
834
853
  return await streamCurriculumAIInference(messages, projectContext, options, onChunk);
835
854
  }
855
+ var DEFAULT_ARTIFACT_STREAM_IDLE_MS, DEFAULT_ARTIFACT_STREAM_TOTAL_MS;
836
856
  var init_streamRunner = __esm({
837
857
  "src/ai/streamRunner.ts"() {
838
858
  init_errors();
859
+ DEFAULT_ARTIFACT_STREAM_IDLE_MS = 45e3;
860
+ DEFAULT_ARTIFACT_STREAM_TOTAL_MS = 42e4;
839
861
  }
840
862
  });
841
863
 
@@ -13539,15 +13561,6 @@ function extractStreamChunk(part) {
13539
13561
  const content = part.text ?? part.delta ?? "";
13540
13562
  return content ? { content } : {};
13541
13563
  }
13542
- if (part.type === "raw") {
13543
- const raw = part.rawValue;
13544
- const delta = raw?.choices?.[0]?.delta;
13545
- const reasoning = delta?.reasoning_content ?? delta?.reasoning ?? raw?.delta?.reasoning_content ?? raw?.delta?.reasoning;
13546
- if (typeof reasoning === "string" && reasoning) return { thought: reasoning };
13547
- const text = delta?.content ?? raw?.delta?.content;
13548
- if (typeof text === "string" && text) return { content: text };
13549
- return {};
13550
- }
13551
13564
  return {};
13552
13565
  }
13553
13566
  function createStreamAbortSignal(budget) {
@@ -16202,6 +16215,10 @@ function resolveApiKey2(options) {
16202
16215
  }
16203
16216
  return { provider, key };
16204
16217
  }
16218
+ function resolveImageTimeout(options) {
16219
+ const envTimeout = Number(process.env.IMAGE_GEN_TIMEOUT_MS || process.env.ARTIFACT_STREAM_TOTAL_TIMEOUT_MS);
16220
+ return Number.isFinite(options.timeoutMs) && options.timeoutMs > 0 ? options.timeoutMs : Number.isFinite(envTimeout) && envTimeout > 0 ? envTimeout : 42e4;
16221
+ }
16205
16222
  async function generateWithGemini(options, key) {
16206
16223
  const finalPrompt = buildImagePrompt(options);
16207
16224
  const model = "gemini-2.0-flash-exp";
@@ -16212,7 +16229,7 @@ async function generateWithGemini(options, key) {
16212
16229
  contents: [{ parts: [{ text: finalPrompt }] }],
16213
16230
  generationConfig: { responseModalities: ["TEXT", "IMAGE"] }
16214
16231
  }),
16215
- signal: AbortSignal.timeout(9e4)
16232
+ signal: AbortSignal.timeout(resolveImageTimeout(options))
16216
16233
  });
16217
16234
  if (!res.ok) {
16218
16235
  const body = await res.text().catch(() => "");
@@ -16245,7 +16262,7 @@ async function generateWithOpenAI(options, key) {
16245
16262
  size: sizeMap[options.aspectRatio || "1:1"] || "1024x1024",
16246
16263
  n: 1
16247
16264
  }),
16248
- signal: AbortSignal.timeout(9e4)
16265
+ signal: AbortSignal.timeout(resolveImageTimeout(options))
16249
16266
  });
16250
16267
  if (!res.ok) {
16251
16268
  const body = await res.text().catch(() => "");
@@ -16649,6 +16666,6 @@ function renderMediaPlaceholder(entry) {
16649
16666
  return `> \u{1F5BC}\uFE0F [\u1EA2nh \u0111ang ch\u1EDD: ${entry.name} \u2014 s\u1EBD \u0111\u01B0\u1EE3c t\u1EA1o sau khi duy\u1EC7t media]`;
16650
16667
  }
16651
16668
 
16652
- export { ACT_TEMPLATE, ARTIFACT_EXECUTION_ORDER, AcademicAuditor, ActiveLearningWorkflowSchema, ActivityLabSchema, ActivitySeqRowSchema, ActivityStepSchema, ArtifactContractRowSchema, AssessmentMapRowSchema, AssessmentObjectiveSchema, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BUNDLED_STANDARDS_PACK_IDS, BellRingerDaySchema, BellRingerSchema, BloomHintSchema, BloomLevelSchema, BloomTaxonomyEvaluator, BronzeTierSchema, CERConclusionSchema, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CardTierEnum, ChoiceBoardRubricRowSchema, ChoiceBoardSchema, ChoiceRuleSchema, ChoiceSquareSchema, ClassificationSchema, CodeHardwareFeasibilityEvaluator, CodeLabSchema, CodeSnippetSchema, CompetencyRubricRowSchema, ComputationalThinkingSchema, ConstructiveAlignmentEvaluator, CoreConceptSchema, CourseObjectiveSchema, CoverageReportSchema, CrossArtifactDriftEvaluator, CurriculumArtifactSchema, CurriculumError, CurriculumPlanSchema, CurriculumQualityReportSchema, DEFAULT_ENABLED_PROVIDERS, DEFAULT_GATE_SETTINGS, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdgeSchema, DepthAssignmentSchema, DepthLevelSchema, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuestionSchema, DiagnosticQuizSchema, EDPPhaseEnum, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, EntryLevelSchema, ExitTicketBugHuntSchema, ExitTicketMetacognitionSchema, ExitTicketQuickItemSchema, ExitTicketRecallPromptSchema, ExitTicketSchema, ExperimentalDesignSchema, ExpositionApprovalError, ExtensionChallengeSchema, ExtensionSchema, FileSystemCurriculumAdapter, FiveEFlowPhaseSchema, FiveEInstructionalEvaluator, FiveEPhaseEnum, FrameworkMappingSchema, FrameworkPackManifestSchema, FrameworkPackSchema, FrameworkStatementSchema, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, GlossaryQuickRefRowSchema, GlossarySchema, GlossaryTermSchema, GoldTierSchema, GradeBandSchema, GraphicOrganizerItemSchema, GraphicOrganizerSchema, HANDOUT_TEMPLATE, HandoutSchema, HandoutSectionSchema, InstructionSectionSchema, InstructionStepSchema, JudgeCriterionSchema, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, LLMJudgeEngine, LabTierTaskSchema, LearningObjectiveInputSchema, LearningObjectiveRowSchema, LessonFlowPhaseSchema, LessonPlan5ESchema, LessonPlanEDPSchema, LessonPlanSchema, LessonSectionSchema, LocalWorkspaceManager, MappingKindSchema, MarpSlideSchema, MediaError, MediaLedger, MentorCheatsheetSchema, MilestoneInputSchema, MisconceptionEvaluator, MisconceptionSchema, ModelPolicyResolver, NVIDIA_MODELS, NodeKindSchema, OrganizerTypeEnum, PROJECT_INSTRUCTION_TEMPLATE, PhaseInputSchema, PlanConstraintsSchema, PlannerInputSchema, PlanningGraphSchema, PlanningNodeSchema, PrerequisiteDecisionEntrySchema, PrerequisiteDecisionSchema, ProductGoalSchema, ProgressiveHintsSchema, ProjectGraphSchema, ProjectInstructionSchema, ProjectProfileSchema, QUIZ_TEMPLATE, QualityAuditVerdictSchema, QuizOptionSchema, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, RecordProvenanceSchema, ResourceMapRowSchema, ReviewGameExportRowSchema, ReviewGameQuestionSchema, ReviewGameSchema, RoadmapInputSchema, RotationStationSchema, RubricCriteriaSchema, RubricSchema, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STANDARD_SOT_FILES, STATION_ROTATION_TEMPLATE, ScaffoldDecisionEntrySchema, ScaffoldDecisionSchema, ScienceLabSchema, ScoringRubricRowSchema, SelfLabSchema, SelfPacedBundleSchema, SelfPacedChallengeSchema, SessionPlanSchema, SilverTierSchema, SlideDeckSchema, StandardizedTermRowSchema, StandardsRegistryAdapter, StationRecordRowSchema, StationRotationSchema, StationTypeEnum, SupabaseCurriculumAdapter, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TaskCardSchema, TaskCardsSchema, TeacherGuideSchema, TeachingScriptPhaseSchema, TierLevelEnum, TierObjectiveSchema, TieredPracticeSchema, TranslationPolicySchema, TroubleshootingEntrySchema, TroubleshootingRowSchema, UnitPlanSchema, UserJourneySchema, WORKSHEET_TEMPLATE, WorksheetItemSchema, WorksheetItemTypeEnum, WorksheetPartSchema, WorksheetSchema, activityTools, analystTools, analyzeProjectCreationIntent, assertAcyclic, assessorTools, auditCurriculumQualityFlow, auditQualityReport, buildActivityPrompt, buildCodeLabPrompt, buildCurriculumContext, buildCurriculumPlan, buildDeliveryPackages, buildDiagnosticQuizPrompt, buildExpositionContext, buildExtensionPrompt, buildHandoutPrompt, buildImagePrompt, buildJudgePrompt, buildLessonMasterPrompt, buildProjectInstructionPrompt, buildSelfLabPrompt, buildSessionSliceContext, buildSlidesPrompt, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, buildTeacherGuidePrompt, buildWorksheetPrompt, closeTruncatedJson, computeContentHash, computePackingSpec, conductPreliminaryResearch, contentTools, convertRoadmapToFoundationSot, createAiInferenceError, createCurriculumStorage, createStreamAbortSignal, curateMediaLedger, designerTools, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, evaluateStandardsCoverage, executeCurriculumCommand, exportAllProjectQuizzes, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, extractStreamChunk, extractThoughtAndContent, formatQuizzesToCsv, fulfillMediaLedger, gateModeFor, generateActivityFlow, generateCodeLabFlow, generateDiagnosticQuizFlow, generateEducationalImage, generateExtensionFlow, generateHandoutFlow, generateLessonMasterFlow, generateMilestoneCurriculumBundle, generatePhase1SotArtifacts, generatePhase2SotArtifacts, generateProjectInstruction, generateProjectInstructionFlow, generateRoadmapCurriculum, generateSelfLabFlow, generateSelfPacedBundle, generateSingleArtifact, generateSlidesFlow, generateTeacherGuideFlow, generateWorksheetFlow, getAIModel, getArtifactMetadata, getDesignatedFallbackChain, getDesignatedFallbackConfig, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, illustratorTools, importRoadmapToProject, ingestProjectGraphIntoProject, initializeProjectInStorage, injectMediaIntoMarkdown, isExpositionFresh, isModelAllowed, isProviderEnabled, isTranslationDue, lintAndSanitizeArtifact, lintCurriculumFramework, lintFrameworkPack, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, packagerTools, parseGateSettings, parseQuizMarkdown, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, publishToGitHub, publishToSupabase, rankGenCandidates, renderFrameworkFromPlan, renderMediaPlaceholder, researcherTools, resolveGateSettings, resolveStandardsPacks, resolveStreamBudget, resolveTranslationTargets, reviewerTools, runCurriculumAIInference, safeParseJson, searchEducationalImages, searchEducationalVideos, selectStatementsForLesson, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, slugifyProjectName, streamCurriculumAIInference, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLLMWithFallback, streamLayerPrefillWithFallback, streamLessonMasterFlow, streamSelfLabFlow, stripLlmJsonWrappers, techSmeTools, topoSort, uploadAssetToBucket, validateCurriculumPlan, validateFrameworkPack, validateMarkdownTables, validateMermaidSyntax, withAutoRepair };
16669
+ export { ACT_TEMPLATE, ARTIFACT_EXECUTION_ORDER, AcademicAuditor, ActiveLearningWorkflowSchema, ActivityLabSchema, ActivitySeqRowSchema, ActivityStepSchema, ArtifactContractRowSchema, AssessmentMapRowSchema, AssessmentObjectiveSchema, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BUNDLED_STANDARDS_PACK_IDS, BellRingerDaySchema, BellRingerSchema, BloomHintSchema, BloomLevelSchema, BloomTaxonomyEvaluator, BronzeTierSchema, CERConclusionSchema, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CardTierEnum, ChoiceBoardRubricRowSchema, ChoiceBoardSchema, ChoiceRuleSchema, ChoiceSquareSchema, ClassificationSchema, CodeHardwareFeasibilityEvaluator, CodeLabSchema, CodeSnippetSchema, CompetencyRubricRowSchema, ComputationalThinkingSchema, ConstructiveAlignmentEvaluator, CoreConceptSchema, CourseObjectiveSchema, CoverageReportSchema, CrossArtifactDriftEvaluator, CurriculumArtifactSchema, CurriculumError, CurriculumPlanSchema, CurriculumQualityReportSchema, DEFAULT_ARTIFACT_STREAM_IDLE_MS, DEFAULT_ARTIFACT_STREAM_TOTAL_MS, DEFAULT_ENABLED_PROVIDERS, DEFAULT_GATE_SETTINGS, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdgeSchema, DepthAssignmentSchema, DepthLevelSchema, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuestionSchema, DiagnosticQuizSchema, EDPPhaseEnum, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, EntryLevelSchema, ExitTicketBugHuntSchema, ExitTicketMetacognitionSchema, ExitTicketQuickItemSchema, ExitTicketRecallPromptSchema, ExitTicketSchema, ExperimentalDesignSchema, ExpositionApprovalError, ExtensionChallengeSchema, ExtensionSchema, FileSystemCurriculumAdapter, FiveEFlowPhaseSchema, FiveEInstructionalEvaluator, FiveEPhaseEnum, FrameworkMappingSchema, FrameworkPackManifestSchema, FrameworkPackSchema, FrameworkStatementSchema, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, GlossaryQuickRefRowSchema, GlossarySchema, GlossaryTermSchema, GoldTierSchema, GradeBandSchema, GraphicOrganizerItemSchema, GraphicOrganizerSchema, HANDOUT_TEMPLATE, HandoutSchema, HandoutSectionSchema, InstructionSectionSchema, InstructionStepSchema, JudgeCriterionSchema, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, LLMJudgeEngine, LabTierTaskSchema, LearningObjectiveInputSchema, LearningObjectiveRowSchema, LessonFlowPhaseSchema, LessonPlan5ESchema, LessonPlanEDPSchema, LessonPlanSchema, LessonSectionSchema, LocalWorkspaceManager, MappingKindSchema, MarpSlideSchema, MediaError, MediaLedger, MentorCheatsheetSchema, MilestoneInputSchema, MisconceptionEvaluator, MisconceptionSchema, ModelPolicyResolver, NVIDIA_MODELS, NodeKindSchema, OrganizerTypeEnum, PROJECT_INSTRUCTION_TEMPLATE, PhaseInputSchema, PlanConstraintsSchema, PlannerInputSchema, PlanningGraphSchema, PlanningNodeSchema, PrerequisiteDecisionEntrySchema, PrerequisiteDecisionSchema, ProductGoalSchema, ProgressiveHintsSchema, ProjectGraphSchema, ProjectInstructionSchema, ProjectProfileSchema, QUIZ_TEMPLATE, QualityAuditVerdictSchema, QuizOptionSchema, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, RecordProvenanceSchema, ResourceMapRowSchema, ReviewGameExportRowSchema, ReviewGameQuestionSchema, ReviewGameSchema, RoadmapInputSchema, RotationStationSchema, RubricCriteriaSchema, RubricSchema, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STANDARD_SOT_FILES, STATION_ROTATION_TEMPLATE, ScaffoldDecisionEntrySchema, ScaffoldDecisionSchema, ScienceLabSchema, ScoringRubricRowSchema, SelfLabSchema, SelfPacedBundleSchema, SelfPacedChallengeSchema, SessionPlanSchema, SilverTierSchema, SlideDeckSchema, StandardizedTermRowSchema, StandardsRegistryAdapter, StationRecordRowSchema, StationRotationSchema, StationTypeEnum, SupabaseCurriculumAdapter, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TaskCardSchema, TaskCardsSchema, TeacherGuideSchema, TeachingScriptPhaseSchema, TierLevelEnum, TierObjectiveSchema, TieredPracticeSchema, TranslationPolicySchema, TroubleshootingEntrySchema, TroubleshootingRowSchema, UnitPlanSchema, UserJourneySchema, WORKSHEET_TEMPLATE, WorksheetItemSchema, WorksheetItemTypeEnum, WorksheetPartSchema, WorksheetSchema, activityTools, analystTools, analyzeProjectCreationIntent, assertAcyclic, assessorTools, auditCurriculumQualityFlow, auditQualityReport, buildActivityPrompt, buildCodeLabPrompt, buildCurriculumContext, buildCurriculumPlan, buildDeliveryPackages, buildDiagnosticQuizPrompt, buildExpositionContext, buildExtensionPrompt, buildHandoutPrompt, buildImagePrompt, buildJudgePrompt, buildLessonMasterPrompt, buildProjectInstructionPrompt, buildSelfLabPrompt, buildSessionSliceContext, buildSlidesPrompt, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, buildTeacherGuidePrompt, buildWorksheetPrompt, closeTruncatedJson, computeContentHash, computePackingSpec, conductPreliminaryResearch, contentTools, convertRoadmapToFoundationSot, createAiInferenceError, createCurriculumStorage, createIdleAbortController, createStreamAbortController, createStreamAbortSignal, curateMediaLedger, designerTools, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, evaluateStandardsCoverage, executeCurriculumCommand, exportAllProjectQuizzes, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, extractStreamChunk, extractThoughtAndContent, formatQuizzesToCsv, fulfillMediaLedger, gateModeFor, generateActivityFlow, generateCodeLabFlow, generateDiagnosticQuizFlow, generateEducationalImage, generateExtensionFlow, generateHandoutFlow, generateLessonMasterFlow, generateMilestoneCurriculumBundle, generatePhase1SotArtifacts, generatePhase2SotArtifacts, generateProjectInstruction, generateProjectInstructionFlow, generateRoadmapCurriculum, generateSelfLabFlow, generateSelfPacedBundle, generateSingleArtifact, generateSlidesFlow, generateTeacherGuideFlow, generateWorksheetFlow, getAIModel, getArtifactMetadata, getDesignatedFallbackChain, getDesignatedFallbackConfig, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, illustratorTools, importRoadmapToProject, ingestProjectGraphIntoProject, initializeProjectInStorage, injectMediaIntoMarkdown, isExpositionFresh, isModelAllowed, isProviderEnabled, isTranslationDue, lintAndSanitizeArtifact, lintCurriculumFramework, lintFrameworkPack, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, packagerTools, parseGateSettings, parseQuizMarkdown, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, publishToGitHub, publishToSupabase, rankGenCandidates, renderFrameworkFromPlan, renderMediaPlaceholder, researcherTools, resolveGateSettings, resolveStandardsPacks, resolveStreamBudget, resolveTranslationTargets, reviewerTools, runCurriculumAIInference, safeParseJson, searchEducationalImages, searchEducationalVideos, selectStatementsForLesson, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, slugifyProjectName, streamCurriculumAIInference, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLLMWithFallback, streamLayerPrefillWithFallback, streamLessonMasterFlow, streamSelfLabFlow, stripLlmJsonWrappers, techSmeTools, topoSort, uploadAssetToBucket, validateCurriculumPlan, validateFrameworkPack, validateMarkdownTables, validateMermaidSyntax, withAutoRepair };
16653
16670
  //# sourceMappingURL=index.mjs.map
16654
16671
  //# sourceMappingURL=index.mjs.map