@thanh01.pmt/curriculum-kit 1.0.22 → 1.1.0

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
@@ -132,6 +132,8 @@ interface ProduceLessonOptions {
132
132
  artifactScope?: string[];
133
133
  force?: boolean;
134
134
  pedagogy?: PedagogicalModel;
135
+ targetLanguage?: string;
136
+ sectionLanguageContract?: string;
135
137
  /** Chiến lược batch (chỉ produceBatchLessons dùng). */
136
138
  batchStrategy?: 'depth_first_lesson' | 'breadth_first_artifact';
137
139
  /**
@@ -615,13 +617,29 @@ declare function isTranslationDue(target: TranslationTarget, context: {
615
617
  publishRequested: boolean;
616
618
  }): boolean;
617
619
 
620
+ /**
621
+ * Language Directive and Section Language Contract (SLC) resolution for Curriculum Generation.
622
+ */
623
+ declare function resolveTargetLanguageCode(language?: string | null): string;
624
+ declare function targetLanguageDisplayName(code: string): string;
625
+ declare function buildLanguageDirective(targetLanguage?: string | null): string;
626
+ /**
627
+ * Parses markdown table or lines from SECTION_LANGUAGE_CONTRACT.md to extract
628
+ * mapping for a specific artifact type.
629
+ */
630
+ declare function extractSectionHeadingsFromSLC(slcMarkdown: string | undefined | null, artifactType: string): Record<string, string>;
631
+ /**
632
+ * Builds the heading directive block to instruct LLM on verbatim section headings.
633
+ */
634
+ declare function buildHeadingDirective(artifactType: string, slcMarkdown?: string | null, targetLanguage?: string): string;
635
+
618
636
  /**
619
637
  * Curriculum OS - Standardized Error Taxonomy & Traceability System
620
638
  *
621
639
  * Provides typed, structured, and traceable error codes for all pipeline failures,
622
640
  * API exceptions, safeguard blocks, and contract violations.
623
641
  */
624
- type CurriculumErrorCode = 'ERR_AI_NO_API_KEY' | 'ERR_AI_RATE_LIMIT' | 'ERR_AI_AUTH_FAILED' | 'ERR_AI_NETWORK_TIMEOUT' | 'ERR_AI_RESPONSE_MALFORMED' | 'ERR_AI_ALL_PROVIDERS_FAILED' | 'ERR_SOT_MISSING' | 'ERR_SOT_INVALID_SCHEMA' | 'ERR_TASK_GATE_BLOCKED' | 'ERR_METERED_LIMIT_EXCEEDED' | 'ERR_SCHEMA_CONTRACT_VIOLATION' | 'ERR_STORAGE_IO_FAILED';
642
+ type CurriculumErrorCode = 'ERR_AI_NO_API_KEY' | 'ERR_AI_RATE_LIMIT' | 'ERR_AI_AUTH_FAILED' | 'ERR_AI_NETWORK_TIMEOUT' | 'ERR_AI_RESPONSE_MALFORMED' | 'ERR_AI_ALL_PROVIDERS_FAILED' | 'ERR_SOT_MISSING' | 'ERR_SOT_INVALID_SCHEMA' | 'ERR_TASK_GATE_BLOCKED' | 'ERR_METERED_LIMIT_EXCEEDED' | 'ERR_SCHEMA_CONTRACT_VIOLATION' | 'ERR_STORAGE_IO_FAILED' | 'ERR_LESSON_NOT_IN_SOT';
625
643
  interface CurriculumErrorDetail {
626
644
  errorCode: CurriculumErrorCode;
627
645
  agent?: string;
@@ -957,4 +975,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
957
975
  */
958
976
  declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
959
977
 
960
- 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, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, 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, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, topoSort };
978
+ 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, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, 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, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildHeadingDirective, buildLanguageDirective, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, targetLanguageDisplayName, topoSort };
package/dist/index.d.ts CHANGED
@@ -132,6 +132,8 @@ interface ProduceLessonOptions {
132
132
  artifactScope?: string[];
133
133
  force?: boolean;
134
134
  pedagogy?: PedagogicalModel;
135
+ targetLanguage?: string;
136
+ sectionLanguageContract?: string;
135
137
  /** Chiến lược batch (chỉ produceBatchLessons dùng). */
136
138
  batchStrategy?: 'depth_first_lesson' | 'breadth_first_artifact';
137
139
  /**
@@ -615,13 +617,29 @@ declare function isTranslationDue(target: TranslationTarget, context: {
615
617
  publishRequested: boolean;
616
618
  }): boolean;
617
619
 
620
+ /**
621
+ * Language Directive and Section Language Contract (SLC) resolution for Curriculum Generation.
622
+ */
623
+ declare function resolveTargetLanguageCode(language?: string | null): string;
624
+ declare function targetLanguageDisplayName(code: string): string;
625
+ declare function buildLanguageDirective(targetLanguage?: string | null): string;
626
+ /**
627
+ * Parses markdown table or lines from SECTION_LANGUAGE_CONTRACT.md to extract
628
+ * mapping for a specific artifact type.
629
+ */
630
+ declare function extractSectionHeadingsFromSLC(slcMarkdown: string | undefined | null, artifactType: string): Record<string, string>;
631
+ /**
632
+ * Builds the heading directive block to instruct LLM on verbatim section headings.
633
+ */
634
+ declare function buildHeadingDirective(artifactType: string, slcMarkdown?: string | null, targetLanguage?: string): string;
635
+
618
636
  /**
619
637
  * Curriculum OS - Standardized Error Taxonomy & Traceability System
620
638
  *
621
639
  * Provides typed, structured, and traceable error codes for all pipeline failures,
622
640
  * API exceptions, safeguard blocks, and contract violations.
623
641
  */
624
- type CurriculumErrorCode = 'ERR_AI_NO_API_KEY' | 'ERR_AI_RATE_LIMIT' | 'ERR_AI_AUTH_FAILED' | 'ERR_AI_NETWORK_TIMEOUT' | 'ERR_AI_RESPONSE_MALFORMED' | 'ERR_AI_ALL_PROVIDERS_FAILED' | 'ERR_SOT_MISSING' | 'ERR_SOT_INVALID_SCHEMA' | 'ERR_TASK_GATE_BLOCKED' | 'ERR_METERED_LIMIT_EXCEEDED' | 'ERR_SCHEMA_CONTRACT_VIOLATION' | 'ERR_STORAGE_IO_FAILED';
642
+ type CurriculumErrorCode = 'ERR_AI_NO_API_KEY' | 'ERR_AI_RATE_LIMIT' | 'ERR_AI_AUTH_FAILED' | 'ERR_AI_NETWORK_TIMEOUT' | 'ERR_AI_RESPONSE_MALFORMED' | 'ERR_AI_ALL_PROVIDERS_FAILED' | 'ERR_SOT_MISSING' | 'ERR_SOT_INVALID_SCHEMA' | 'ERR_TASK_GATE_BLOCKED' | 'ERR_METERED_LIMIT_EXCEEDED' | 'ERR_SCHEMA_CONTRACT_VIOLATION' | 'ERR_STORAGE_IO_FAILED' | 'ERR_LESSON_NOT_IN_SOT';
625
643
  interface CurriculumErrorDetail {
626
644
  errorCode: CurriculumErrorCode;
627
645
  agent?: string;
@@ -957,4 +975,4 @@ declare function getSlideLayoutPresetById(id: string): SlideLayoutPreset | undef
957
975
  */
958
976
  declare function getSlideLayoutPresetsByCategory(category: SlideLayoutCategory): SlideLayoutPreset[];
959
977
 
960
- 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, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, 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, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, topoSort };
978
+ 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, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, type GenerateExpositionOptions, HANDOUT_TEMPLATE, ICurriculumStorage, LAYER_TOTAL_BUDGET_MS, 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, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TranslationPolicy, type TranslationTarget, type TranslationTrigger, WORKSHEET_TEMPLATE, analyzeProjectCreationIntent, assertAcyclic, auditQualityReport, buildCurriculumContext, buildCurriculumPlan, buildExpositionContext, buildHeadingDirective, buildLanguageDirective, buildSessionSliceContext, closeTruncatedJson, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, executeCurriculumCommand, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderFrameworkFromPlan, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, targetLanguageDisplayName, topoSort };
package/dist/index.mjs CHANGED
@@ -2421,9 +2421,20 @@ var SessionPlanSchema = z.object({
2421
2421
  differentiation: z.object({ bronze: z.string(), silver: z.string(), gold: z.string() })
2422
2422
  });
2423
2423
  var TranslationPolicySchema = z.object({
2424
- policy: z.enum(["after_artifact", "end_of_unit", "at_publish"]).default("at_publish"),
2424
+ policy: z.enum(["after_artifact", "end_of_unit", "at_publish", "native"]).default("native"),
2425
2425
  target_language: z.string().nullable().default(null)
2426
- });
2426
+ }).refine(
2427
+ (data) => {
2428
+ if (data.policy === "native") {
2429
+ return typeof data.target_language === "string" && data.target_language.trim().length > 0;
2430
+ }
2431
+ return true;
2432
+ },
2433
+ {
2434
+ message: "When translation policy is 'native', target_language must be a non-empty string",
2435
+ path: ["target_language"]
2436
+ }
2437
+ );
2427
2438
  var CoverageReportSchema = z.object({
2428
2439
  assigned_node_ids: z.array(z.string()),
2429
2440
  unassigned_node_ids: z.array(z.string()),
@@ -9844,6 +9855,7 @@ async function ensureExpositionForLesson(storage, projectId, lessonCode, options
9844
9855
  });
9845
9856
  return { relPath: result.relPath, context: buildExpositionContext(result.content), reused: result.reused };
9846
9857
  }
9858
+ init_errors();
9847
9859
  var asArr = (v) => Array.isArray(v) ? v : [];
9848
9860
  var asStr = (v, dflt = "") => typeof v === "string" ? v : dflt;
9849
9861
  var asNum = (v, dflt) => typeof v === "number" && Number.isFinite(v) ? v : dflt;
@@ -10486,7 +10498,15 @@ function extractSessionSlice(plan, lessonCode) {
10486
10498
  }
10487
10499
  function buildSessionSliceContext(plan, lessonCode) {
10488
10500
  const s = plan.sessions.find((x) => x.id === lessonCode);
10489
- if (!s) return "";
10501
+ if (!s) {
10502
+ throw new CurriculumError({
10503
+ errorCode: "ERR_LESSON_NOT_IN_SOT",
10504
+ message: `Session "${lessonCode}" not found in CURRICULUM_PLAN.json (${plan.plan_hash})`,
10505
+ suggestedAction: "\u0110\u1ED3ng b\u1ED9 CURRICULUM_PLAN r\u1ED3i ch\u1EA1y l\u1EA1i",
10506
+ retryable: false,
10507
+ lessonId: lessonCode
10508
+ });
10509
+ }
10490
10510
  const lines = [];
10491
10511
  lines.push("[SESSION SLICE (from CURRICULUM_PLAN " + plan.plan_hash + ")]");
10492
10512
  lines.push("- Objective: " + s.prose_objective);
@@ -11053,6 +11073,80 @@ function resolveStandardsPacks(packIds) {
11053
11073
  return packs;
11054
11074
  }
11055
11075
 
11076
+ // src/services/languageDirective.ts
11077
+ function resolveTargetLanguageCode(language) {
11078
+ const raw = String(language || "vi").trim().toLowerCase();
11079
+ if (raw.startsWith("vi")) return "vi";
11080
+ if (raw.startsWith("en")) return "en";
11081
+ return raw || "vi";
11082
+ }
11083
+ function targetLanguageDisplayName(code) {
11084
+ const map = {
11085
+ vi: "Vietnamese (Ti\u1EBFng Vi\u1EC7t)",
11086
+ en: "English (US)"
11087
+ };
11088
+ return map[code] || code;
11089
+ }
11090
+ function buildLanguageDirective(targetLanguage) {
11091
+ const code = resolveTargetLanguageCode(targetLanguage);
11092
+ const name = targetLanguageDisplayName(code);
11093
+ const perLanguageExamples = {
11094
+ vi: `- V\xED d\u1EE5 ti\xEAu \u0111\u1EC1 b\xE0i h\u1ECDc \u0111\xFAng chu\u1EA9n: "B\xE0i 1: Kh\xE1m ph\xE1 m\u1EA1ch \u0111i\u1EC7n c\u01A1 b\u1EA3n", "B\xE0i 2: \u0110i\u1EC1u khi\u1EC3n \u0111\xE8n LED nh\u1EA5p nh\xE1y" \u2014 KH\xD4NG d\xF9ng ti\xEAu \u0111\u1EC1 ti\u1EBFng Anh.`,
11095
+ en: `- Example compliant lesson title: "Lesson 1: Exploring Basic Circuits" \u2014 natural, idiomatic English throughout.`
11096
+ };
11097
+ const exampleLine = perLanguageExamples[code] || "";
11098
+ return `MANDATORY LANGUAGE DIRECTIVE (TARGET OUTPUT LANGUAGE: ${name}):
11099
+ - The TARGET OUTPUT LANGUAGE for this course is ${name}. You MUST author the ENTIRE document in ${name}.
11100
+ - All section titles, table headers, table cells, lesson names, learning objectives, pedagogical narratives, and cognitive analyses MUST be written in natural, fluent, academic ${name}.
11101
+ - Technical identifiers, code keywords (e.g. setup(), loop(), pinMode()), standard protocols (I2C, SPI, UART, GPIO), and component model numbers (ESP32, Arduino Uno) remain in standard technical notation, but all surrounding explanations MUST be in ${name}.
11102
+ - DO NOT mix in paragraphs, tables, or titles written in any other language. Strict adherence is required.${exampleLine ? `
11103
+ ${exampleLine}` : ""}`;
11104
+ }
11105
+ function extractSectionHeadingsFromSLC(slcMarkdown, artifactType) {
11106
+ if (!slcMarkdown) return {};
11107
+ const upperType = artifactType.trim().toUpperCase();
11108
+ const blocks = slcMarkdown.split(/\n(?=#{2,3}\s+[A-Z0-9_]+)/g);
11109
+ for (const block of blocks) {
11110
+ const headerMatch = block.match(/^#{2,3}\s+([A-Z0-9_]+)/);
11111
+ if (!headerMatch) continue;
11112
+ const blockType = headerMatch[1].trim().toUpperCase();
11113
+ if (blockType === upperType || upperType.startsWith("LESSON") && blockType.startsWith("LESSON")) {
11114
+ const mapping = {};
11115
+ const lines = block.split("\n");
11116
+ for (const line of lines) {
11117
+ const trimmed = line.trim();
11118
+ if (trimmed.startsWith("|") && !trimmed.includes("---")) {
11119
+ const cells = trimmed.split("|").map((c) => c.trim()).filter((_, idx, arr) => idx > 0 && idx < arr.length - 1);
11120
+ if (cells.length >= 2 && !cells[0].toLowerCase().includes("canonical") && !cells[1].toLowerCase().includes("localized")) {
11121
+ mapping[cells[0]] = cells[1];
11122
+ }
11123
+ } else {
11124
+ const bullet = line.match(/^[-*]\s+([^:]+):\s+(.+)$/);
11125
+ if (bullet) {
11126
+ mapping[bullet[1].trim()] = bullet[2].trim();
11127
+ }
11128
+ }
11129
+ }
11130
+ if (Object.keys(mapping).length > 0) return mapping;
11131
+ }
11132
+ }
11133
+ return {};
11134
+ }
11135
+ function buildHeadingDirective(artifactType, slcMarkdown, targetLanguage = "vi") {
11136
+ const headings = extractSectionHeadingsFromSLC(slcMarkdown, artifactType);
11137
+ if (Object.keys(headings).length === 0) {
11138
+ return "";
11139
+ }
11140
+ const lines = Object.entries(headings).map(
11141
+ ([canonical, localized]) => ` - "${canonical}" -> Use Display Heading: "${localized}"`
11142
+ );
11143
+ return `MANDATORY SECTION HEADINGS FROM SECTION_LANGUAGE_CONTRACT:
11144
+ - The YAML frontmatter \`template_required_sections\` MUST preserve the exact English canonical keys.
11145
+ - In the markdown body, section headers MUST use the EXACT Localized Display Labels below (do NOT translate or paraphrase):
11146
+ ${lines.join("\n")}
11147
+ - For example: if canonical section is "Computational Thinking Focus", your heading must be "## [REQUIRED] ${headings["Computational Thinking Focus"] || "Computational Thinking Focus"}".`;
11148
+ }
11149
+
11056
11150
  // src/services/lessonProductionService.ts
11057
11151
  var __filename2 = typeof import.meta?.url === "string" ? fileURLToPath(import.meta.url) : "";
11058
11152
  var _resolvedDir = __filename2 ? path3.dirname(__filename2) : typeof __dirname !== "undefined" ? __dirname : process.cwd();
@@ -11094,11 +11188,44 @@ function detectProjectPedagogy(frameworkText, styleGuideText, explicitPedagogy)
11094
11188
  return "5e";
11095
11189
  }
11096
11190
  async function getLessonMetadata(storage, projectId, lessonId) {
11097
- const framework = await storage.readSotDocument(projectId, "CURRICULUM_FRAMEWORK.md") || "";
11098
11191
  const parts = lessonId.split("_");
11099
11192
  const unitCode = parts[0] || "U01";
11100
11193
  const moduleCode = parts.length >= 2 ? `${parts[0]}_${parts[1]}` : `${unitCode}_M01`;
11101
11194
  const lessonCode = lessonId;
11195
+ let planStr = null;
11196
+ try {
11197
+ planStr = await storage.readSotDocument(projectId, "CURRICULUM_PLAN.json") || await storage.readArtifact(projectId, "_sot/CURRICULUM_PLAN.json") || await storage.readArtifact(projectId, "CURRICULUM_PLAN.json");
11198
+ } catch {
11199
+ }
11200
+ if (planStr) {
11201
+ try {
11202
+ const plan = JSON.parse(planStr);
11203
+ if (Array.isArray(plan.sessions)) {
11204
+ const session = plan.sessions.find((s) => s.id === lessonId);
11205
+ if (session) {
11206
+ const lessonTitle2 = session.title || `Lesson ${lessonId}`;
11207
+ const keywords = Array.isArray(session.new_keywords) && session.new_keywords.length > 0 ? ` T\u1EEB kh\xF3a: ${session.new_keywords.join(", ")}` : "";
11208
+ const objective2 = session.prose_objective || session.title || "";
11209
+ const concept2 = objective2 ? `${objective2}.${keywords}` : session.title || "Core Technical Competency";
11210
+ const prerequisites2 = session.anchor_type ? `Anchor: ${session.anchor_type}` : "None";
11211
+ const depth = Array.isArray(session.depth_assignments) ? session.depth_assignments[0]?.depth : session.depth_assignments?.knowledge_depth;
11212
+ const bloomLevel2 = depth === "sio" ? "Create" : depth === "cio" ? "Apply" : "Understand";
11213
+ return {
11214
+ unitCode: session.unit_id || unitCode,
11215
+ moduleCode,
11216
+ lessonCode,
11217
+ lessonTitle: lessonTitle2,
11218
+ concept: `M\u1EE5c ti\xEAu bu\u1ED5i h\u1ECDc: ${concept2}`,
11219
+ prerequisites: prerequisites2,
11220
+ bloomLevel: bloomLevel2
11221
+ };
11222
+ }
11223
+ }
11224
+ } catch (planErr) {
11225
+ console.warn(`[getLessonMetadata] Error parsing CURRICULUM_PLAN.json for ${projectId}:`, planErr);
11226
+ }
11227
+ }
11228
+ const framework = await storage.readSotDocument(projectId, "CURRICULUM_FRAMEWORK.md") || "";
11102
11229
  let lessonTitle = `Lesson ${lessonId}`;
11103
11230
  let concept = "Core Technical Competency";
11104
11231
  let prerequisites = "None";
@@ -11143,15 +11270,24 @@ async function getLessonMetadata(storage, projectId, lessonId) {
11143
11270
  }
11144
11271
  if (found) break;
11145
11272
  }
11146
- return {
11147
- unitCode,
11148
- moduleCode,
11149
- lessonCode,
11150
- lessonTitle,
11151
- concept: objective ? `${concept}. M\u1EE5c ti\xEAu bu\u1ED5i h\u1ECDc: ${objective}` : concept,
11152
- prerequisites: deliverable ? `${prerequisites}. S\u1EA3n ph\u1EA9m hands-on c\u1EE7a bu\u1ED5i: ${deliverable}` : prerequisites,
11153
- bloomLevel
11154
- };
11273
+ if (found) {
11274
+ return {
11275
+ unitCode,
11276
+ moduleCode,
11277
+ lessonCode,
11278
+ lessonTitle,
11279
+ concept: objective ? `${concept}. M\u1EE5c ti\xEAu bu\u1ED5i h\u1ECDc: ${objective}` : concept,
11280
+ prerequisites: deliverable ? `${prerequisites}. S\u1EA3n ph\u1EA9m hands-on c\u1EE7a bu\u1ED5i: ${deliverable}` : prerequisites,
11281
+ bloomLevel
11282
+ };
11283
+ }
11284
+ throw new CurriculumError({
11285
+ errorCode: "ERR_LESSON_NOT_IN_SOT",
11286
+ lessonId,
11287
+ message: `ERR_LESSON_NOT_IN_SOT: B\xE0i h\u1ECDc "${lessonId}" kh\xF4ng t\u1ED3n t\u1EA1i trong CURRICULUM_PLAN.json ho\u1EB7c CURRICULUM_FRAMEWORK.md c\u1EE7a d\u1EF1 \xE1n "${projectId}".`,
11288
+ suggestedAction: "\u0110\u1ED3ng b\u1ED9 CURRICULUM_PLAN r\u1ED3i ch\u1EA1y l\u1EA1i",
11289
+ retryable: false
11290
+ });
11155
11291
  }
11156
11292
  function buildFrameworkExcerptForLesson(framework, lessonId) {
11157
11293
  if (!framework) return "";
@@ -11193,7 +11329,7 @@ ${nextRow}`
11193
11329
  ].filter(Boolean);
11194
11330
  return parts.join("\n\n") || framework.slice(0, 1500);
11195
11331
  }
11196
- function buildLessonPrompt(pedagogy, lessonCode, unitCode, lessonTitle, concept, bloomLevel, dateStr) {
11332
+ function buildLessonPrompt(pedagogy, lessonCode, unitCode, lessonTitle, concept, bloomLevel, dateStr, targetLanguage = "vi", sectionLanguageContract) {
11197
11333
  const commonFrontmatter = `id: "LESSON_${lessonCode}"
11198
11334
  title: "${lessonTitle}"
11199
11335
  created_by: "Curriculum OS Builder"
@@ -11213,8 +11349,9 @@ template_required_sections:
11213
11349
  - "Artifact Contract"
11214
11350
  - "B. Lesson Flow"
11215
11351
  - "Artifact Linkage"`;
11352
+ let prompt = "";
11216
11353
  if (pedagogy === "edp") {
11217
- return `You are @content (Educational Content Editor & EDP Engineering Design Process Specialist).
11354
+ prompt = `You are @content (Educational Content Editor & EDP Engineering Design Process Specialist).
11218
11355
  Author the comprehensive Master Lesson Plan adhering strictly to \`LESSON_EDP_template.md\` standards for:
11219
11356
  - Lesson Code: ${lessonCode}
11220
11357
  - Title: ${lessonTitle}
@@ -11263,9 +11400,8 @@ Linkage ledger mapping all satellite artifacts (\`ACT_...\`, \`QUIZ_...\`, \`SLI
11263
11400
 
11264
11401
  3. Ensure all sample code and schemas are 100% syntax-valid and executable.
11265
11402
  4. Output 100% clean Markdown directly.`;
11266
- }
11267
- if (pedagogy === "pbl" || pedagogy === "general") {
11268
- return `You are @content (Educational Content Editor & PBL/General Pedagogy Specialist).
11403
+ } else if (pedagogy === "pbl" || pedagogy === "general") {
11404
+ prompt = `You are @content (Educational Content Editor & PBL/General Pedagogy Specialist).
11269
11405
  Author the comprehensive Master Lesson Plan adhering strictly to \`LESSON_GENERAL_template.md\` standards for:
11270
11406
  - Lesson Code: ${lessonCode}
11271
11407
  - Title: ${lessonTitle}
@@ -11312,8 +11448,8 @@ type: "LESSON_GENERAL"
11312
11448
  Linkage ledger mapping all satellite artifacts (\`ACT_...\`, \`QUIZ_...\`, \`SLIDE_...\`).
11313
11449
 
11314
11450
  3. Output 100% clean Markdown directly.`;
11315
- }
11316
- return `You are @content (Educational Content Editor & 5E Instructional Model Specialist).
11451
+ } else {
11452
+ prompt = `You are @content (Educational Content Editor & 5E Instructional Model Specialist).
11317
11453
  Author the comprehensive Master Lesson Plan adhering strictly to \`LESSON_5E_template.md\` standards for:
11318
11454
  - Lesson Code: ${lessonCode}
11319
11455
  - Title: ${lessonTitle}
@@ -11361,6 +11497,18 @@ Linkage ledger mapping all satellite artifacts (\`GUIDE_...\`, \`SLIDE_...\`, \`
11361
11497
 
11362
11498
  3. Ensure all sample code and syntax are 100% verified and runnable.
11363
11499
  4. Output 100% clean Markdown directly.`;
11500
+ }
11501
+ const langDirective = buildLanguageDirective(targetLanguage);
11502
+ const headingDirective = buildHeadingDirective(
11503
+ pedagogy === "edp" ? "LESSON_EDP" : pedagogy === "general" || pedagogy === "pbl" ? "LESSON_GENERAL" : "LESSON_5E",
11504
+ sectionLanguageContract,
11505
+ targetLanguage
11506
+ );
11507
+ return `${prompt}
11508
+
11509
+ ${langDirective}${headingDirective ? `
11510
+
11511
+ ${headingDirective}` : ""}`;
11364
11512
  }
11365
11513
  async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
11366
11514
  const {
@@ -11391,6 +11539,20 @@ async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
11391
11539
  const styleGuide = await storage.readSotDocument(projectId, "CONTENT_STYLE_GUIDE.md") || "";
11392
11540
  const refPack = await storage.readSotDocument(projectId, "REFERENCE_PACK.md") || "";
11393
11541
  await storage.readSotDocument(projectId, "LEARNER_PROFILE.md") || "";
11542
+ const slcMarkdown = options.sectionLanguageContract || await storage.readSotDocument(projectId, "SECTION_LANGUAGE_CONTRACT.md") || "";
11543
+ let targetLang = options.targetLanguage;
11544
+ if (!targetLang) {
11545
+ try {
11546
+ const planRaw = await storage.readArtifact(projectId, "_sot/CURRICULUM_PLAN.json");
11547
+ if (planRaw) {
11548
+ const p = JSON.parse(planRaw);
11549
+ targetLang = p?.translation?.target_language;
11550
+ }
11551
+ } catch {
11552
+ }
11553
+ }
11554
+ targetLang = targetLang || "vi";
11555
+ const languageDirective = buildLanguageDirective(targetLang);
11394
11556
  let expositionContext = "";
11395
11557
  let sessionSliceContext = "";
11396
11558
  try {
@@ -11460,7 +11622,9 @@ Khi n\u1ED9i dung c\u1EA7n minh h\u1ECDa (diagram quy tr\xECnh, s\u01A1 \u0111\u
11460
11622
  lessonTitle,
11461
11623
  concept,
11462
11624
  bloomLevel,
11463
- dateStr
11625
+ dateStr,
11626
+ targetLang,
11627
+ slcMarkdown
11464
11628
  ) + mediaDirective;
11465
11629
  const rawLesson = await runCurriculumAIInference(
11466
11630
  [{ role: "user", content: lessonPrompt }],
@@ -11801,7 +11965,11 @@ template_required_sections:
11801
11965
  - ### Phase 3: Debugging & Testing
11802
11966
  - ## [REQUIRED] 3-Tier Differentiation (Bronze/Silver/Gold tasks)
11803
11967
  - ## [REQUIRED] Reflection (Discussion question)
11804
- 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.`;
11968
+ 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.
11969
+
11970
+ ${languageDirective}
11971
+
11972
+ ${buildHeadingDirective("ACT", slcMarkdown, targetLang)}`;
11805
11973
  const rawAct = await runCurriculumAIInference(
11806
11974
  [{ role: "user", content: actPrompt }],
11807
11975
  satelliteContext,
@@ -11873,7 +12041,11 @@ template_required_sections:
11873
12041
  - ## [REQUIRED] Multiple-Choice Question Bank (\u22655 scenario-based 4-option questions with: Question text, A/B/C/D options, Correct answer, Bloom level, Detailed distractor rationale)
11874
12042
  - ## [REQUIRED] Code Analysis / Debugging Question (1 deep code tracing question requiring students to predict output or identify bugs)
11875
12043
  - ## [REQUIRED] Competency Rubric (4-tier matrix: Developing \u2192 Proficient \u2192 Advanced \u2192 Exemplary)
11876
- 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.`;
12044
+ 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.
12045
+
12046
+ ${languageDirective}
12047
+
12048
+ ${buildHeadingDirective("QUIZ", slcMarkdown, targetLang)}`;
11877
12049
  const rawQuiz = await runCurriculumAIInference(
11878
12050
  [{ role: "user", content: quizPrompt }],
11879
12051
  satelliteContext,
@@ -11952,7 +12124,11 @@ Mandatory Canvas & Presentation Invariants:
11952
12124
  * COLD CALL / CHECK: Specific diagnostic question to ask students.
11953
12125
  * SCAFFOLDING / GOTCHA: Guidance for students who get stuck.
11954
12126
  * PACING: Recommended minutes for the slide.
11955
- - Output 100% valid Marp Markdown.`;
12127
+ - Output 100% valid Marp Markdown.
12128
+
12129
+ ${languageDirective}
12130
+
12131
+ ${buildHeadingDirective("SLIDE", slcMarkdown, targetLang)}`;
11956
12132
  const rawSlide = await runCurriculumAIInference(
11957
12133
  [{ role: "user", content: slidePrompt }],
11958
12134
  satelliteContext,
@@ -12019,7 +12195,11 @@ template_contract: "artifact-template-v1"
12019
12195
  - ## [REQUIRED] Facilitation Script & Timeline (Phase-by-phase teacher moves, inquiry questions, transitions)
12020
12196
  - ## [REQUIRED] Common Misconceptions & Diagnostic Remediation Matrix
12021
12197
  - ## [REQUIRED] Differentiated Support Strategies (Support scaffolds vs Extension challenges)
12022
- 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.`;
12198
+ 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.
12199
+
12200
+ ${languageDirective}
12201
+
12202
+ ${buildHeadingDirective("GUIDE", slcMarkdown, targetLang)}`;
12023
12203
  const rawGuide = await runCurriculumAIInference(
12024
12204
  [{ role: "user", content: guidePrompt }],
12025
12205
  satelliteContext,
@@ -12078,7 +12258,11 @@ template_contract: "artifact-template-v1"
12078
12258
  - ## [REQUIRED] Visual Mental Model / Architecture Diagram (Mermaid or ASCII diagram)
12079
12259
  - ## [REQUIRED] Step-by-Step Practical Quick-Start Guide
12080
12260
  - ## [REQUIRED] Self-Check Diagnostic Checklist (Can-do statements for student self-assessment)
12081
- 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.`;
12261
+ 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.
12262
+
12263
+ ${languageDirective}
12264
+
12265
+ ${buildHeadingDirective("HANDOUT", slcMarkdown, targetLang)}`;
12082
12266
  const rawHandout = await runCurriculumAIInference(
12083
12267
  [{ role: "user", content: handoutPrompt }],
12084
12268
  satelliteContext,
@@ -12141,7 +12325,11 @@ template_contract: "artifact-template-v1"
12141
12325
  - ## [REQUIRED] Part 3: Code Analysis & Bug Hunting Challenge
12142
12326
  - ## [REQUIRED] Part 4: Synthesis & Problem-Solving Application
12143
12327
  - ## [REQUIRED] Part 5: Self-Reflection & Learning Log
12144
- 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.`;
12328
+ 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.
12329
+
12330
+ ${languageDirective}
12331
+
12332
+ ${buildHeadingDirective("WKS", slcMarkdown, targetLang)}`;
12145
12333
  const rawWks = await runCurriculumAIInference(
12146
12334
  [{ role: "user", content: wksPrompt }],
12147
12335
  satelliteContext,
@@ -12208,7 +12396,11 @@ template_required_sections:
12208
12396
  - ## [REQUIRED] Verified Reference Solution Code (100% syntactically valid, production-ready, fully commented)
12209
12397
  - ## [REQUIRED] Automated Test / Verification Script (How to compile, flash, or unit test)
12210
12398
  - ## [REQUIRED] Common Syntax & Runtime Pitfalls Matrix
12211
- 3. Output 100% clean Markdown directly with runnable code snippets \u2014 NO outer code fences around the document.`;
12399
+ 3. Output 100% clean Markdown directly with runnable code snippets \u2014 NO outer code fences around the document.
12400
+
12401
+ ${languageDirective}
12402
+
12403
+ ${buildHeadingDirective("CODE", slcMarkdown, targetLang)}`;
12212
12404
  const rawCode = await runCurriculumAIInference(
12213
12405
  [{ role: "user", content: codePrompt }],
12214
12406
  satelliteContext,
@@ -12274,7 +12466,11 @@ template_contract: "artifact-template-v1"
12274
12466
  - ### Challenge 2: [Name] (Difficulty: \u2B50\u2B50\u2B50\u2B50) \u2014 Advanced Architectural Constraints & Edge Cases
12275
12467
  - ### Challenge 3: [Name] (Difficulty: \u2B50\u2B50\u2B50\u2B50\u2B50) \u2014 Extension Milestones (Level 1: Ninja \u2192 Level 2: Guru \u2192 Level 3: Master)
12276
12468
  - ## [REQUIRED] Metacognitive Deep Dive & Engineering Trade-offs
12277
- 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.`;
12469
+ 3. Output 100% clean Markdown directly \u2014 NO code fences around the document.
12470
+
12471
+ ${languageDirective}
12472
+
12473
+ ${buildHeadingDirective("EXT", slcMarkdown, targetLang)}`;
12278
12474
  const rawExt = await runCurriculumAIInference(
12279
12475
  [{ role: "user", content: extPrompt }],
12280
12476
  satelliteContext,
@@ -16718,6 +16914,6 @@ function renderMediaPlaceholder(entry) {
16718
16914
  return `> \u{1F5BC}\uFE0F [\u1EA2nh \u0111ang ch\u1EDD: ${entry.name} \u2014 s\u1EBD \u0111\u01B0\u1EE3c t\u1EA1o sau khi duy\u1EC7t media]`;
16719
16915
  }
16720
16916
 
16721
- 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, createStreamChunkExtractor, 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 };
16917
+ 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, buildHeadingDirective, buildImagePrompt, buildJudgePrompt, buildLanguageDirective, buildLessonMasterPrompt, buildProjectInstructionPrompt, buildSelfLabPrompt, buildSessionSliceContext, buildSlidesPrompt, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, buildTeacherGuidePrompt, buildWorksheetPrompt, closeTruncatedJson, computeContentHash, computePackingSpec, conductPreliminaryResearch, contentTools, convertRoadmapToFoundationSot, createAiInferenceError, createCurriculumStorage, createIdleAbortController, createStreamAbortController, createStreamAbortSignal, createStreamChunkExtractor, curateMediaLedger, designerTools, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, evaluateStandardsCoverage, executeCurriculumCommand, exportAllProjectQuizzes, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, 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, resolveTargetLanguageCode, resolveTranslationTargets, reviewerTools, runCurriculumAIInference, safeParseJson, searchEducationalImages, searchEducationalVideos, selectStatementsForLesson, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, slugifyProjectName, streamCurriculumAIInference, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLLMWithFallback, streamLayerPrefillWithFallback, streamLessonMasterFlow, streamSelfLabFlow, stripLlmJsonWrappers, targetLanguageDisplayName, techSmeTools, topoSort, uploadAssetToBucket, validateCurriculumPlan, validateFrameworkPack, validateMarkdownTables, validateMermaidSyntax, withAutoRepair };
16722
16918
  //# sourceMappingURL=index.mjs.map
16723
16919
  //# sourceMappingURL=index.mjs.map