@thanh01.pmt/curriculum-kit 1.0.10 → 1.0.12

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
@@ -1,7 +1,7 @@
1
1
  import { PlanConstraints, TranslationPolicy, CurriculumPlan, PlanningGraph, PlanningNode, DependencyEdge, LessonPlan, DiagnosticQuizInput, ActivityLab, SlideDeck, CodeLab, DiagnosticQuiz } from './schemas/index.cjs';
2
2
  export { ActiveLearningWorkflow, ActiveLearningWorkflowSchema, ActivityLabSchema, ActivitySeqRow, ActivitySeqRowSchema, ActivityStepSchema, ArtifactContractRowSchema, AssessmentMapRowSchema, AssessmentObjective, AssessmentObjectiveSchema, BellRinger, BellRingerDay, BellRingerDaySchema, BellRingerInput, BellRingerSchema, BloomLevel, BloomLevelSchema, BronzeTier, BronzeTierSchema, CERConclusion, CERConclusionSchema, CardTierEnum, ChoiceBoard, ChoiceBoardInput, ChoiceBoardRubricRowSchema, ChoiceBoardSchema, ChoiceRuleSchema, ChoiceSquare, ChoiceSquareSchema, CodeLabSchema, CodeSnippet, CodeSnippetSchema, CompetencyRubricRow, CompetencyRubricRowSchema, ComputationalThinking, ComputationalThinkingSchema, CoreConcept, CoreConceptSchema, CourseObjective, CourseObjectiveSchema, CoverageReport, CoverageReportSchema, CurriculumArtifact, CurriculumArtifactSchema, CurriculumPlanSchema, CurriculumQualityReport, CurriculumQualityReportSchema, DependencyEdgeSchema, DepthAssignment, DepthAssignmentSchema, DepthLevel, DepthLevelSchema, DiagnosticQuestion, DiagnosticQuestionInput, DiagnosticQuestionSchema, DiagnosticQuizSchema, EDPPhaseEnum, EntryLevelSchema, ExitTicket, ExitTicketBugHunt, ExitTicketBugHuntSchema, ExitTicketMetacognitionSchema, ExitTicketQuickItemSchema, ExitTicketRecallPromptSchema, ExitTicketSchema, ExperimentalDesignSchema, Extension, ExtensionChallengeSchema, ExtensionSchema, FiveEFlowPhaseSchema, FiveEPhaseEnum, Glossary, GlossaryInput, GlossaryQuickRefRowSchema, GlossarySchema, GlossaryTerm, GlossaryTermSchema, GoldTier, GoldTierSchema, GraphicOrganizer, GraphicOrganizerInput, GraphicOrganizerItem, GraphicOrganizerItemSchema, GraphicOrganizerSchema, Handout, HandoutSchema, HandoutSection, HandoutSectionSchema, InstructionSection, InstructionSectionSchema, InstructionStep, InstructionStepSchema, JudgeCriterionSchema, LabTierTask, LabTierTaskSchema, LearningObjectiveInput, LearningObjectiveInputSchema, LearningObjectiveRow, LearningObjectiveRowSchema, LessonFlowPhase, LessonFlowPhaseSchema, LessonPlan5E, LessonPlan5ESchema, LessonPlanEDP, LessonPlanEDPSchema, LessonPlanSchema, LessonSectionSchema, MarpSlide, MarpSlideSchema, MentorCheatsheetSchema, MilestoneInput, MilestoneInputSchema, Misconception, MisconceptionSchema, NodeKindSchema, OrganizerTypeEnum, PhaseInput, PhaseInputSchema, PlanConstraintsSchema, PlannerInput, PlannerInputSchema, PlanningGraphSchema, PlanningNodeSchema, PlanningPhase, PrerequisiteDecision, PrerequisiteDecisionEntry, PrerequisiteDecisionEntrySchema, PrerequisiteDecisionSchema, ProductGoalSchema, ProgressiveHints, ProgressiveHintsSchema, ProjectGraph, ProjectGraphSchema, ProjectInstruction, ProjectInstructionSchema, ProjectProfile, ProjectProfileSchema, ProjectRoadmap, QualityAuditVerdictSchema, QuizOption, QuizOptionSchema, ResourceMapRowSchema, ReviewGame, ReviewGameExportRowSchema, ReviewGameInput, ReviewGameQuestion, ReviewGameQuestionSchema, ReviewGameSchema, RoadmapInput, RoadmapInputSchema, RotationStation, RotationStationSchema, Rubric, RubricCriteria, RubricCriteriaSchema, RubricSchema, ScaffoldDecision, ScaffoldDecisionEntry, ScaffoldDecisionEntrySchema, ScaffoldDecisionSchema, ScienceLab, ScienceLabInput, ScienceLabSchema, ScoringRubricRowSchema, SelfLab, SelfLabSchema, SelfPacedBundle, SelfPacedBundleSchema, SelfPacedChallenge, SelfPacedChallengeSchema, SessionPlan, SessionPlanSchema, SilverTier, SilverTierSchema, SlideDeckSchema, StandardizedTermRowSchema, StationRecordRowSchema, StationRotation, StationRotationInput, StationRotationSchema, StationTypeEnum, TaskCard, TaskCardSchema, TaskCards, TaskCardsInput, TaskCardsSchema, TeacherGuide, TeacherGuideSchema, TeachingScriptPhase, TeachingScriptPhaseSchema, TierLevelEnum, TierObjectiveSchema, TieredPractice, TieredPracticeSchema, TranslationPolicySchema, TroubleshootingEntry, TroubleshootingEntrySchema, TroubleshootingRow, TroubleshootingRowSchema, UnitPlan, UnitPlanSchema, UserJourneySchema, Worksheet, WorksheetItem, WorksheetItemSchema, WorksheetItemTypeEnum, WorksheetPart, WorksheetPartSchema, WorksheetSchema, validateCurriculumPlan } from './schemas/index.cjs';
3
- import { M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.cjs';
4
- export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from './provider-factory-DxzOVEmh.cjs';
3
+ import { A as AIProviderName, M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.cjs';
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
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';
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';
@@ -333,6 +333,8 @@ interface LayerPrefillOptions {
333
333
  /** Target language for pre-filled wizard values: 'vi' | 'en' (default: 'vi'). */
334
334
  language?: string;
335
335
  stream?: boolean;
336
+ model?: string;
337
+ provider?: AIProviderName;
336
338
  }
337
339
  interface PreliminaryResearchResult {
338
340
  groundTruthSummary: string;
@@ -353,10 +355,11 @@ type LayerChunkCallback = (chunk: string, type: 'thought' | 'content') => void;
353
355
  * Robust JSON extraction and repair helper
354
356
  */
355
357
  declare function safeParseJson<T = any>(rawText: string | null): T | null;
358
+
356
359
  /**
357
360
  * Multi-tiered resilient streaming inference helper using 100% Vercel AI SDK.
358
361
  */
359
- declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback): Promise<string | null>;
362
+ declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback, preferredModel?: string, preferredProvider?: AIProviderName): Promise<string | null>;
360
363
  /**
361
364
  * Conducts preliminary ecosystem research for a course project.
362
365
  */
@@ -855,4 +858,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
855
858
  */
856
859
  declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
857
860
 
858
- export { ACT_TEMPLATE, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
861
+ export { ACT_TEMPLATE, AIProviderName, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { PlanConstraints, TranslationPolicy, CurriculumPlan, PlanningGraph, PlanningNode, DependencyEdge, LessonPlan, DiagnosticQuizInput, ActivityLab, SlideDeck, CodeLab, DiagnosticQuiz } from './schemas/index.js';
2
2
  export { ActiveLearningWorkflow, ActiveLearningWorkflowSchema, ActivityLabSchema, ActivitySeqRow, ActivitySeqRowSchema, ActivityStepSchema, ArtifactContractRowSchema, AssessmentMapRowSchema, AssessmentObjective, AssessmentObjectiveSchema, BellRinger, BellRingerDay, BellRingerDaySchema, BellRingerInput, BellRingerSchema, BloomLevel, BloomLevelSchema, BronzeTier, BronzeTierSchema, CERConclusion, CERConclusionSchema, CardTierEnum, ChoiceBoard, ChoiceBoardInput, ChoiceBoardRubricRowSchema, ChoiceBoardSchema, ChoiceRuleSchema, ChoiceSquare, ChoiceSquareSchema, CodeLabSchema, CodeSnippet, CodeSnippetSchema, CompetencyRubricRow, CompetencyRubricRowSchema, ComputationalThinking, ComputationalThinkingSchema, CoreConcept, CoreConceptSchema, CourseObjective, CourseObjectiveSchema, CoverageReport, CoverageReportSchema, CurriculumArtifact, CurriculumArtifactSchema, CurriculumPlanSchema, CurriculumQualityReport, CurriculumQualityReportSchema, DependencyEdgeSchema, DepthAssignment, DepthAssignmentSchema, DepthLevel, DepthLevelSchema, DiagnosticQuestion, DiagnosticQuestionInput, DiagnosticQuestionSchema, DiagnosticQuizSchema, EDPPhaseEnum, EntryLevelSchema, ExitTicket, ExitTicketBugHunt, ExitTicketBugHuntSchema, ExitTicketMetacognitionSchema, ExitTicketQuickItemSchema, ExitTicketRecallPromptSchema, ExitTicketSchema, ExperimentalDesignSchema, Extension, ExtensionChallengeSchema, ExtensionSchema, FiveEFlowPhaseSchema, FiveEPhaseEnum, Glossary, GlossaryInput, GlossaryQuickRefRowSchema, GlossarySchema, GlossaryTerm, GlossaryTermSchema, GoldTier, GoldTierSchema, GraphicOrganizer, GraphicOrganizerInput, GraphicOrganizerItem, GraphicOrganizerItemSchema, GraphicOrganizerSchema, Handout, HandoutSchema, HandoutSection, HandoutSectionSchema, InstructionSection, InstructionSectionSchema, InstructionStep, InstructionStepSchema, JudgeCriterionSchema, LabTierTask, LabTierTaskSchema, LearningObjectiveInput, LearningObjectiveInputSchema, LearningObjectiveRow, LearningObjectiveRowSchema, LessonFlowPhase, LessonFlowPhaseSchema, LessonPlan5E, LessonPlan5ESchema, LessonPlanEDP, LessonPlanEDPSchema, LessonPlanSchema, LessonSectionSchema, MarpSlide, MarpSlideSchema, MentorCheatsheetSchema, MilestoneInput, MilestoneInputSchema, Misconception, MisconceptionSchema, NodeKindSchema, OrganizerTypeEnum, PhaseInput, PhaseInputSchema, PlanConstraintsSchema, PlannerInput, PlannerInputSchema, PlanningGraphSchema, PlanningNodeSchema, PlanningPhase, PrerequisiteDecision, PrerequisiteDecisionEntry, PrerequisiteDecisionEntrySchema, PrerequisiteDecisionSchema, ProductGoalSchema, ProgressiveHints, ProgressiveHintsSchema, ProjectGraph, ProjectGraphSchema, ProjectInstruction, ProjectInstructionSchema, ProjectProfile, ProjectProfileSchema, ProjectRoadmap, QualityAuditVerdictSchema, QuizOption, QuizOptionSchema, ResourceMapRowSchema, ReviewGame, ReviewGameExportRowSchema, ReviewGameInput, ReviewGameQuestion, ReviewGameQuestionSchema, ReviewGameSchema, RoadmapInput, RoadmapInputSchema, RotationStation, RotationStationSchema, Rubric, RubricCriteria, RubricCriteriaSchema, RubricSchema, ScaffoldDecision, ScaffoldDecisionEntry, ScaffoldDecisionEntrySchema, ScaffoldDecisionSchema, ScienceLab, ScienceLabInput, ScienceLabSchema, ScoringRubricRowSchema, SelfLab, SelfLabSchema, SelfPacedBundle, SelfPacedBundleSchema, SelfPacedChallenge, SelfPacedChallengeSchema, SessionPlan, SessionPlanSchema, SilverTier, SilverTierSchema, SlideDeckSchema, StandardizedTermRowSchema, StationRecordRowSchema, StationRotation, StationRotationInput, StationRotationSchema, StationTypeEnum, TaskCard, TaskCardSchema, TaskCards, TaskCardsInput, TaskCardsSchema, TeacherGuide, TeacherGuideSchema, TeachingScriptPhase, TeachingScriptPhaseSchema, TierLevelEnum, TierObjectiveSchema, TieredPractice, TieredPracticeSchema, TranslationPolicySchema, TroubleshootingEntry, TroubleshootingEntrySchema, TroubleshootingRow, TroubleshootingRowSchema, UnitPlan, UnitPlanSchema, UserJourneySchema, Worksheet, WorksheetItem, WorksheetItemSchema, WorksheetItemTypeEnum, WorksheetPart, WorksheetPartSchema, WorksheetSchema, validateCurriculumPlan } from './schemas/index.js';
3
- import { M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.js';
4
- export { A as AIProviderName, N as NVIDIA_MODELS, g as getAIModel } from './provider-factory-DxzOVEmh.js';
3
+ import { A as AIProviderName, M as ModelResolutionOptions } from './provider-factory-DxzOVEmh.js';
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
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';
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';
@@ -333,6 +333,8 @@ interface LayerPrefillOptions {
333
333
  /** Target language for pre-filled wizard values: 'vi' | 'en' (default: 'vi'). */
334
334
  language?: string;
335
335
  stream?: boolean;
336
+ model?: string;
337
+ provider?: AIProviderName;
336
338
  }
337
339
  interface PreliminaryResearchResult {
338
340
  groundTruthSummary: string;
@@ -353,10 +355,11 @@ type LayerChunkCallback = (chunk: string, type: 'thought' | 'content') => void;
353
355
  * Robust JSON extraction and repair helper
354
356
  */
355
357
  declare function safeParseJson<T = any>(rawText: string | null): T | null;
358
+
356
359
  /**
357
360
  * Multi-tiered resilient streaming inference helper using 100% Vercel AI SDK.
358
361
  */
359
- declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback): Promise<string | null>;
362
+ declare function streamLLMWithFallback(systemPrompt: string, userPrompt: string, apiKeys?: Record<string, string>, onChunk?: LayerChunkCallback, preferredModel?: string, preferredProvider?: AIProviderName): Promise<string | null>;
360
363
  /**
361
364
  * Conducts preliminary ecosystem research for a course project.
362
365
  */
@@ -855,4 +858,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
855
858
  */
856
859
  declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
857
860
 
858
- export { ACT_TEMPLATE, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
861
+ export { ACT_TEMPLATE, AIProviderName, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, ActivityLab, type ArtifactProductionSpec, type AuditBundleInput, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BloomTaxonomyEvaluator, type BuildContextOptions, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConstructiveAlignmentEvaluator, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LESSON_PLAN_TEMPLATE, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LayoutBoxConfig, LessonPlan, MisconceptionEvaluator, ModelResolutionOptions, PROJECT_INSTRUCTION_TEMPLATE, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PreliminaryResearchResult, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QUIZ_TEMPLATE, QualityAuditReport, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, ResolvedGateSettings, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STATION_ROTATION_TEMPLATE, type SlashCommandDefinition, SlideDeck, type SlideLayoutCategory, type SlideLayoutData, type SlideLayoutPreset, SmartResumeContext, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, topoSort };
package/dist/index.mjs CHANGED
@@ -13538,7 +13538,7 @@ function safeParseJson(rawText) {
13538
13538
  return null;
13539
13539
  }
13540
13540
  }
13541
- async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onChunk) {
13541
+ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onChunk, preferredModel, preferredProvider) {
13542
13542
  const alibabaKey = apiKeys.alibaba || apiKeys.dashscope || process.env.ALIBABA_API_KEY || process.env.DASHSCOPE_API_KEY;
13543
13543
  const nvidiaKey = apiKeys.nvidia || process.env.NVIDIA_API_KEY;
13544
13544
  const deepseekKey = apiKeys.deepseek || process.env.DEEPSEEK_API_KEY;
@@ -13546,6 +13546,11 @@ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onC
13546
13546
  const geminiKey = apiKeys.gemini || process.env.GEMINI_API_KEY;
13547
13547
  const openrouterPreset = process.env.OPENROUTER_FREE_PRESET || "@preset/coding-free";
13548
13548
  const candidates = [];
13549
+ if (preferredModel) {
13550
+ const prov = preferredProvider || "openrouter";
13551
+ const key = apiKeys[prov] || (prov === "openrouter" ? openrouterKey : prov === "nvidia" ? nvidiaKey : prov === "alibaba" ? alibabaKey : geminiKey) || "";
13552
+ candidates.push({ provider: prov, model: preferredModel, apiKey: key });
13553
+ }
13549
13554
  if (openrouterKey && isProviderEnabled("openrouter")) {
13550
13555
  const orModels = [
13551
13556
  openrouterPreset,
@@ -13553,40 +13558,49 @@ async function streamLLMWithFallback(systemPrompt, userPrompt, apiKeys = {}, onC
13553
13558
  "nvidia/nemotron-3-super-120b-a12b:free",
13554
13559
  "nvidia/nemotron-3-ultra-550b-a55b:free",
13555
13560
  "nvidia/nemotron-3.5-lightning:free",
13556
- "minimax/minimax-m3:free",
13557
13561
  "cohere/north-mini-code:free"
13558
13562
  ].filter((m) => isModelAllowed(m));
13559
13563
  for (const m of Array.from(new Set(orModels))) {
13560
- candidates.push({ provider: "openrouter", model: m, apiKey: openrouterKey });
13564
+ if (!candidates.some((c) => c.provider === "openrouter" && c.model === m)) {
13565
+ candidates.push({ provider: "openrouter", model: m, apiKey: openrouterKey });
13566
+ }
13561
13567
  }
13562
13568
  }
13563
13569
  if (nvidiaKey && isProviderEnabled("nvidia")) {
13564
13570
  const nemotronModels = [
13565
- "nvidia/nemotron-3-ultra-550b-a55b:free",
13571
+ "nvidia/nemotron-3-ultra-550b-a55b",
13566
13572
  "nvidia/nemotron-3.5-lightning-30b-a3b",
13567
13573
  "nvidia/nemotron-3-super-120b-a12b",
13568
13574
  "nvidia/llama-3.1-nemotron-70b-instruct"
13569
13575
  ].filter((m) => isModelAllowed(m));
13570
13576
  for (const m of nemotronModels) {
13571
- candidates.push({ provider: "nvidia", model: m, apiKey: nvidiaKey });
13577
+ if (!candidates.some((c) => c.provider === "nvidia" && c.model === m)) {
13578
+ candidates.push({ provider: "nvidia", model: m, apiKey: nvidiaKey });
13579
+ }
13572
13580
  }
13573
13581
  }
13574
13582
  if (alibabaKey && isProviderEnabled("alibaba")) {
13575
13583
  const aliModels = ["qwen-plus", "qwen-turbo", "qwen3.7-plus"].filter((m) => isModelAllowed(m));
13576
13584
  for (const m of aliModels) {
13577
- candidates.push({ provider: "alibaba", model: m, apiKey: alibabaKey });
13585
+ if (!candidates.some((c) => c.provider === "alibaba" && c.model === m)) {
13586
+ candidates.push({ provider: "alibaba", model: m, apiKey: alibabaKey });
13587
+ }
13578
13588
  }
13579
13589
  }
13580
13590
  if (deepseekKey && isProviderEnabled("deepseek")) {
13581
13591
  const dsModels = ["deepseek-chat", "deepseek-coder"].filter((m) => isModelAllowed(m));
13582
13592
  for (const m of dsModels) {
13583
- candidates.push({ provider: "deepseek", model: m, apiKey: deepseekKey });
13593
+ if (!candidates.some((c) => c.provider === "deepseek" && c.model === m)) {
13594
+ candidates.push({ provider: "deepseek", model: m, apiKey: deepseekKey });
13595
+ }
13584
13596
  }
13585
13597
  }
13586
13598
  if (geminiKey && (isProviderEnabled("gemini") || isProviderEnabled("google"))) {
13587
13599
  const gModels = ["gemini-1.5-flash", "gemini-2.0-flash", "gemini-1.5-pro"].filter((m) => isModelAllowed(m));
13588
13600
  for (const m of gModels) {
13589
- candidates.push({ provider: "google", model: m, apiKey: geminiKey });
13601
+ if (!candidates.some((c) => c.provider === "google" && c.model === m)) {
13602
+ candidates.push({ provider: "google", model: m, apiKey: geminiKey });
13603
+ }
13590
13604
  }
13591
13605
  }
13592
13606
  const fallbackChain = getDesignatedFallbackChain();
@@ -13615,15 +13629,27 @@ THINKING DIRECTIVE: Keep reasoning concise, structured, and focused strictly on
13615
13629
  system: systemInstructions,
13616
13630
  prompt: userPrompt,
13617
13631
  temperature: 0.2,
13618
- abortSignal: AbortSignal.timeout(25e3)
13632
+ includeRawChunks: true,
13633
+ abortSignal: AbortSignal.timeout(6e4)
13619
13634
  });
13620
13635
  let fullContent = "";
13621
13636
  for await (const part of streamResult.fullStream) {
13622
13637
  if (part.type === "reasoning-delta") {
13623
- onChunk?.(part.text, "thought");
13638
+ const thoughtText = part.text ?? part.delta ?? "";
13639
+ if (thoughtText) onChunk?.(thoughtText, "thought");
13640
+ } else if (part.type === "raw") {
13641
+ const raw = part.rawValue;
13642
+ const delta = raw?.choices?.[0]?.delta;
13643
+ const reasoning = delta?.reasoning_content || delta?.reasoning;
13644
+ if (reasoning) {
13645
+ onChunk?.(reasoning, "thought");
13646
+ }
13624
13647
  } else if (part.type === "text-delta") {
13625
- fullContent += part.text;
13626
- onChunk?.(part.text, "content");
13648
+ const textDelta = part.text ?? part.delta ?? "";
13649
+ if (textDelta) {
13650
+ fullContent += textDelta;
13651
+ onChunk?.(textDelta, "content");
13652
+ }
13627
13653
  }
13628
13654
  }
13629
13655
  if (fullContent.trim()) {
@@ -13686,6 +13712,68 @@ Return concise JSON matching:
13686
13712
  }
13687
13713
  return parsedResearch;
13688
13714
  }
13715
+ var CONTEXT_KEY_LABELS = {
13716
+ domain: "Domain",
13717
+ customDomain: "Custom Domain",
13718
+ context: "Educational Context (Tier)",
13719
+ contextLabel: "Educational Context",
13720
+ customContext: "Custom Educational Context",
13721
+ targetAgeTier: "Target Age Tier",
13722
+ targetAge: "Target Age & Audience",
13723
+ customAge: "Custom Age Group",
13724
+ courseDurationTier: "Course Duration Tier",
13725
+ courseDuration: "Planned Course Duration",
13726
+ customDuration: "Custom Course Duration",
13727
+ hardwareReadinessTier: "Hardware Readiness Tier",
13728
+ hardwareReadiness: "Hardware & Tool Readiness",
13729
+ customHardware: "Custom Hardware Setup",
13730
+ language: "Artifact Output Language",
13731
+ totalWeeks: "Total Weeks",
13732
+ sessionsPerWeek: "Sessions Per Week",
13733
+ sessionDurationMinutes: "Session Duration (minutes)",
13734
+ totalSessions: "Total Sessions",
13735
+ isConsecutiveSessions: "Consecutive (Block) Sessions",
13736
+ projectName: "Course Title",
13737
+ projectCode: "Project Identifier",
13738
+ courseDescription: "Idea Description"
13739
+ };
13740
+ var STRUCTURED_PROMPT_KEYS = /* @__PURE__ */ new Set([
13741
+ "projectName",
13742
+ "projectCode",
13743
+ "courseDescription",
13744
+ "language",
13745
+ "primaryGoal",
13746
+ "exitVision",
13747
+ "cognitiveDepth",
13748
+ "valueAndCertification",
13749
+ "entryBridge",
13750
+ "pedagogy",
13751
+ "classDynamic",
13752
+ "hardwareDeployment",
13753
+ "teacherRole",
13754
+ "lessonPacingModel",
13755
+ "voiceAndTone"
13756
+ ]);
13757
+ function buildRemainingContextBlock(accumulatedData) {
13758
+ const lines = [];
13759
+ for (const [key, rawVal] of Object.entries(accumulatedData)) {
13760
+ if (STRUCTURED_PROMPT_KEYS.has(key)) continue;
13761
+ if (rawVal === void 0 || rawVal === null || rawVal === "") continue;
13762
+ if (key.endsWith("_ids") || key.endsWith("_id")) continue;
13763
+ const label = CONTEXT_KEY_LABELS[key] || key.replace(/([A-Z])/g, " $1").replace(/_/g, " ").replace(/^./, (c) => c.toUpperCase()).trim();
13764
+ let valueStr;
13765
+ if (Array.isArray(rawVal)) {
13766
+ valueStr = rawVal.map((v) => typeof v === "object" ? JSON.stringify(v) : String(v)).join("; ");
13767
+ } else if (typeof rawVal === "object") {
13768
+ valueStr = JSON.stringify(rawVal);
13769
+ } else {
13770
+ valueStr = String(rawVal);
13771
+ }
13772
+ if (!valueStr.trim()) continue;
13773
+ lines.push(`- ${label}: ${valueStr}`);
13774
+ }
13775
+ return lines.join("\n");
13776
+ }
13689
13777
  async function streamLayerPrefillWithFallback(options, onChunk) {
13690
13778
  const { action = "prefill", targetLayer = 1, accumulatedData = {}, apiKeys = {} } = options;
13691
13779
  if (action === "research") {
@@ -13696,26 +13784,21 @@ async function streamLayerPrefillWithFallback(options, onChunk) {
13696
13784
  projectName = "Curriculum Course",
13697
13785
  projectCode = "curriculum-course",
13698
13786
  courseDescription = "",
13699
- domain = "tech",
13700
- context = "center",
13701
- contextLabel = "STEM Academy",
13702
13787
  targetAgeTier = "secondary",
13703
13788
  targetAge = "Secondary (Ages 11-15 / Grades 6-9)",
13704
13789
  courseDurationTier = "standard",
13705
13790
  courseDuration = "Standard Course (16-24 sessions / 24-36 hours)",
13706
- hardwareReadinessTier = "none_budget",
13707
- hardwareReadiness = "No dedicated hardware (Plug-and-play simulator or economical kit)",
13708
13791
  primaryGoal = "",
13709
13792
  exitVision = "",
13710
13793
  valueAndCertification = "",
13711
- coreLearningOutcomes = "",
13794
+ entryBridge = "",
13712
13795
  pedagogy = "5E Instructional Model",
13713
- capstoneTheme = "",
13714
- teacherProfile = "Facilitator / STEM Teacher",
13715
- instructionalModality = "Teacher-led step-by-step",
13716
- cognitiveDepth = "Apply",
13717
- budgetOrExistingSpecs = "",
13718
- cognitiveScaffolding = ""
13796
+ lessonPacingModel = "",
13797
+ voiceAndTone = "",
13798
+ classDynamic = "",
13799
+ hardwareDeployment = "",
13800
+ teacherRole = "",
13801
+ cognitiveDepth = "Apply"
13719
13802
  } = accumulatedData;
13720
13803
  const language = typeof options.language === "string" && options.language ? options.language : typeof accumulatedData.language === "string" && accumulatedData.language ? accumulatedData.language : "vi";
13721
13804
  const textLangMandate = language === "vi" ? "natural, fluent Vietnamese (Ti\u1EBFng Vi\u1EC7t)" : language === "en" ? "natural, fluent English" : `natural, fluent ${language}`;
@@ -13751,7 +13834,7 @@ ${targetLayer === 1 ? `
13751
13834
  - Field 2 (id: 'brandingAndTone', type: 'single_choice'): Art Direction & Visual Mood (ART_DIRECTION: Future Maker Lab high-contrast vs Clean Minimalist Studio vs Gamified Playful).
13752
13835
  - Field 3 (id: 'differentiationStrategy', type: 'single_choice'): Differentiation & Scaffolding Strategy (CONTENT_STYLE_GUIDE: Tier 1/2/3 Bronze/Silver/Gold + EXT Challenges vs Open-ended Rubric Studio).
13753
13836
  - Field 4 (id: 'cognitiveScaffolding', type: 'textarea'): Concrete scaffolding methods (Starter Code, color-coded breadboards, 4-step debug poster, simulator preview).
13754
- - Field 5 (id: 'recommendedToolchain', type: 'single_choice'): 3 concrete toolchain/IDE options matching '${hardwareReadiness}'.
13837
+ - Field 5 (id: 'recommendedToolchain', type: 'single_choice'): 3 concrete toolchain/IDE options matching the confirmed Hardware & Tool Readiness from FULL ACCUMULATED CONTEXT.
13755
13838
  - Field 6 (id: 'artifactScope', type: 'multi_choice'): Deliverable artifacts (LESSON mandatory + ACT, QUIZ, SLIDE, WKS, HANDOUT, GUIDE, CODE).
13756
13839
  - Field 7 (id: 'assessmentStrategy', type: 'single_choice'): Grading weights (e.g. 40% Formative Process + 60% Capstone Rubric).
13757
13840
  `}
@@ -13781,10 +13864,8 @@ RETURN STRICT VALID JSON ONLY adhering exactly to this format:
13781
13864
  - Course Title: "${projectName}"
13782
13865
  - Project Identifier: "${projectCode}"
13783
13866
  - Idea Description: "${courseDescription}"
13784
- - Target Age & Audience: ${targetAge} (Tier: ${targetAgeTier})
13785
- - Planned Course Duration: ${courseDuration} (Tier: ${courseDurationTier})
13786
- - Hardware & Tool Readiness: ${hardwareReadiness} (Tier: ${hardwareReadinessTier})
13787
- - Educational Context: ${contextLabel || context} | Domain: ${domain}
13867
+ - Target Age & Audience: ${targetAge}
13868
+ - Planned Course Duration: ${courseDuration}
13788
13869
 
13789
13870
  ${targetLayer >= 2 ? `
13790
13871
  APPROVED PARAMETERS FROM LAYER 1 (STRATEGIC INTENT & OUTCOMES):
@@ -13792,17 +13873,23 @@ APPROVED PARAMETERS FROM LAYER 1 (STRATEGIC INTENT & OUTCOMES):
13792
13873
  - Competency Exit Vision: "${exitVision}"
13793
13874
  - Target Cognitive Depth: "${cognitiveDepth}"
13794
13875
  - Value & Recognition: "${valueAndCertification}"
13876
+ - Prerequisite Entry Bridge: "${entryBridge}"
13795
13877
  ` : ""}
13796
13878
 
13797
13879
  ${targetLayer >= 3 ? `
13798
13880
  APPROVED PARAMETERS FROM LAYER 2 (PEDAGOGY & LOGISTICS):
13799
- - Selected Pedagogy Model: ${pedagogy}
13800
- - Class Dynamics / Hardware Ratio: ${accumulatedData.classDynamic || "1:1 Individual"}
13801
- - Lab Deployment Mode: ${accumulatedData.hardwareDeployment || "Lab provided"}
13802
- - Instructional Role: ${accumulatedData.teacherRole || "Teacher-led"}
13881
+ - Lesson Pacing Model: "${lessonPacingModel}"
13882
+ - Selected Pedagogy Model: "${pedagogy}"
13883
+ - Voice & Tone: "${voiceAndTone}"
13884
+ - Class Dynamics / Hardware Ratio: "${classDynamic}"
13885
+ - Lab Deployment Mode: "${hardwareDeployment}"
13886
+ - Instructional Role: "${teacherRole}"
13803
13887
  ` : ""}
13804
13888
 
13805
- REQUIREMENT: Synthesize all parameters above and produce the high-fidelity pre-fill configuration for LAYER ${targetLayer}.`;
13889
+ FULL ACCUMULATED CONTEXT (ALL CONFIRMED PARAMETERS FROM EVERY PREVIOUS STEP \u2014 user decisions, organization/instructor/template profiles, schedules and constraints; every line below MUST be honored in your output):
13890
+ ${buildRemainingContextBlock(accumulatedData) || "(no additional context)"}
13891
+
13892
+ REQUIREMENT: Synthesize ALL parameters above \u2014 every single line in FULL ACCUMULATED CONTEXT is a confirmed user decision or system constraint and MUST influence the generated configuration. Produce the high-fidelity pre-fill configuration for LAYER ${targetLayer}.`;
13806
13893
  let rawContent = "";
13807
13894
  await streamLLMWithFallback(
13808
13895
  systemPrompt,
@@ -13811,7 +13898,9 @@ REQUIREMENT: Synthesize all parameters above and produce the high-fidelity pre-f
13811
13898
  (chunk, type) => {
13812
13899
  if (type === "content") rawContent += chunk;
13813
13900
  onChunk?.(chunk, type);
13814
- }
13901
+ },
13902
+ options.model,
13903
+ options.provider
13815
13904
  );
13816
13905
  const parsed = safeParseJson(rawContent);
13817
13906
  return {