@thanh01.pmt/curriculum-kit 1.4.44 → 1.4.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/ai/index.cjs.map +1 -1
  2. package/dist/ai/index.mjs.map +1 -1
  3. package/dist/{gateSettings-oo5tCUS_.d.cts → gateSettings-JoqERuS1.d.cts} +0 -1
  4. package/dist/{gateSettings-oo5tCUS_.d.ts → gateSettings-JoqERuS1.d.ts} +0 -1
  5. package/dist/index.cjs +362 -395
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +111 -33
  8. package/dist/index.d.ts +111 -33
  9. package/dist/index.mjs +356 -392
  10. package/dist/index.mjs.map +1 -1
  11. package/dist/pipeline/index.cjs +33 -14
  12. package/dist/pipeline/index.cjs.map +1 -1
  13. package/dist/pipeline/index.mjs +33 -14
  14. package/dist/pipeline/index.mjs.map +1 -1
  15. package/dist/storage/index.cjs +0 -1
  16. package/dist/storage/index.cjs.map +1 -1
  17. package/dist/storage/index.mjs +0 -1
  18. package/dist/storage/index.mjs.map +1 -1
  19. package/dist/templates/ACT_template.md +18 -9
  20. package/dist/templates/ALIGNMENT_MATRIX_template.md +5 -0
  21. package/dist/templates/ART_DIRECTION_template.md +7 -0
  22. package/dist/templates/ASSET_MANIFEST_template.md +5 -0
  23. package/dist/templates/BASELINE_STANDARD.md +5 -0
  24. package/dist/templates/BELL_RINGER_template.md +13 -13
  25. package/dist/templates/CHANGELOG_template.md +3 -0
  26. package/dist/templates/CHOICE_BOARD_template.md +8 -5
  27. package/dist/templates/CODE_template.md +5 -6
  28. package/dist/templates/CONTENT_CONTINUITY_template.md +6 -0
  29. package/dist/templates/CONTENT_STYLE_GUIDE_template.md +4 -5
  30. package/dist/templates/CURRICULUM_FRAMEWORK_template.md +5 -6
  31. package/dist/templates/DEPENDENCY_MAP_template.md +3 -4
  32. package/dist/templates/EXIT_TICKET_template.md +8 -8
  33. package/dist/templates/EXT_template.md +3 -0
  34. package/dist/templates/GLOSSARY_template.md +1 -2
  35. package/dist/templates/GRAPHIC_ORGANIZER_template.md +8 -8
  36. package/dist/templates/GUIDE_template.md +5 -6
  37. package/dist/templates/HANDOUT_template.md +5 -6
  38. package/dist/templates/HANDOVER_DOCUMENT_template.md +8 -0
  39. package/dist/templates/KNOWLEDGE_EXPOSITION_template.md +16 -6
  40. package/dist/templates/LAB_TEMPLATE.md +20 -3
  41. package/dist/templates/LEARNER_PROFILE_template.md +4 -5
  42. package/dist/templates/LESSONS_LEARNED_template.md +8 -0
  43. package/dist/templates/LESSON_5E_template.md +24 -9
  44. package/dist/templates/LESSON_EDP_template.md +26 -10
  45. package/dist/templates/LESSON_GENERAL_template.md +22 -8
  46. package/dist/templates/OUTPUT_CONSTRAINTS_template.md +7 -0
  47. package/dist/templates/PACKAGING_SPEC_template.md +8 -0
  48. package/dist/templates/PILOT_FEEDBACK_template.md +6 -0
  49. package/dist/templates/PROJECT_BRIEF_template.md +8 -0
  50. package/dist/templates/PROJECT_STATUS_template.md +9 -0
  51. package/dist/templates/QUIZ_template.md +7 -0
  52. package/dist/templates/QUIZ_v4.6_template.md +4 -5
  53. package/dist/templates/REFERENCE_PACK_template.md +4 -0
  54. package/dist/templates/REVIEW_GAME_template.md +11 -8
  55. package/dist/templates/RUBRIC_template.md +2 -3
  56. package/dist/templates/SCIENCE_LAB_template.md +11 -5
  57. package/dist/templates/SELF_LAB_template.md +7 -0
  58. package/dist/templates/SLIDE_template.md +23 -0
  59. package/dist/templates/STATION_ROTATION_template.md +11 -11
  60. package/dist/templates/TASK_CARDS_template.md +8 -8
  61. package/dist/templates/TIERED_PRACTICE_template.md +14 -10
  62. package/dist/templates/UPDATE_ROADMAP_template.md +7 -0
  63. package/dist/templates/WKS_template.md +5 -6
  64. package/dist/workflow/index.cjs +214 -307
  65. package/dist/workflow/index.cjs.map +1 -1
  66. package/dist/workflow/index.d.cts +2 -2
  67. package/dist/workflow/index.d.ts +2 -2
  68. package/dist/workflow/index.mjs +214 -307
  69. package/dist/workflow/index.mjs.map +1 -1
  70. package/docs/refs/templates/ACT_template.md +18 -9
  71. package/docs/refs/templates/ALIGNMENT_MATRIX_template.md +5 -0
  72. package/docs/refs/templates/ART_DIRECTION_template.md +7 -0
  73. package/docs/refs/templates/ASSET_MANIFEST_template.md +5 -0
  74. package/docs/refs/templates/BASELINE_STANDARD.md +5 -0
  75. package/docs/refs/templates/BELL_RINGER_template.md +13 -13
  76. package/docs/refs/templates/CHANGELOG_template.md +3 -0
  77. package/docs/refs/templates/CHOICE_BOARD_template.md +8 -5
  78. package/docs/refs/templates/CODE_template.md +5 -6
  79. package/docs/refs/templates/CONTENT_CONTINUITY_template.md +6 -0
  80. package/docs/refs/templates/CONTENT_STYLE_GUIDE_template.md +4 -5
  81. package/docs/refs/templates/CURRICULUM_FRAMEWORK_template.md +5 -6
  82. package/docs/refs/templates/DEPENDENCY_MAP_template.md +3 -4
  83. package/docs/refs/templates/EXIT_TICKET_template.md +8 -8
  84. package/docs/refs/templates/EXT_template.md +3 -0
  85. package/docs/refs/templates/GLOSSARY_template.md +1 -2
  86. package/docs/refs/templates/GRAPHIC_ORGANIZER_template.md +8 -8
  87. package/docs/refs/templates/GUIDE_template.md +5 -6
  88. package/docs/refs/templates/HANDOUT_template.md +5 -6
  89. package/docs/refs/templates/HANDOVER_DOCUMENT_template.md +8 -0
  90. package/docs/refs/templates/KNOWLEDGE_EXPOSITION_template.md +16 -6
  91. package/docs/refs/templates/LAB_TEMPLATE.md +20 -3
  92. package/docs/refs/templates/LEARNER_PROFILE_template.md +4 -5
  93. package/docs/refs/templates/LESSONS_LEARNED_template.md +8 -0
  94. package/docs/refs/templates/LESSON_5E_template.md +24 -9
  95. package/docs/refs/templates/LESSON_EDP_template.md +26 -10
  96. package/docs/refs/templates/LESSON_GENERAL_template.md +22 -8
  97. package/docs/refs/templates/OUTPUT_CONSTRAINTS_template.md +7 -0
  98. package/docs/refs/templates/PACKAGING_SPEC_template.md +8 -0
  99. package/docs/refs/templates/PILOT_FEEDBACK_template.md +6 -0
  100. package/docs/refs/templates/PROJECT_BRIEF_template.md +8 -0
  101. package/docs/refs/templates/PROJECT_STATUS_template.md +9 -0
  102. package/docs/refs/templates/QUIZ_template.md +7 -0
  103. package/docs/refs/templates/QUIZ_v4.6_template.md +4 -5
  104. package/docs/refs/templates/REFERENCE_PACK_template.md +4 -0
  105. package/docs/refs/templates/REVIEW_GAME_template.md +11 -8
  106. package/docs/refs/templates/RUBRIC_template.md +2 -3
  107. package/docs/refs/templates/SCIENCE_LAB_template.md +11 -5
  108. package/docs/refs/templates/SELF_LAB_template.md +7 -0
  109. package/docs/refs/templates/SLIDE_template.md +23 -0
  110. package/docs/refs/templates/STATION_ROTATION_template.md +11 -11
  111. package/docs/refs/templates/TASK_CARDS_template.md +8 -8
  112. package/docs/refs/templates/TIERED_PRACTICE_template.md +14 -10
  113. package/docs/refs/templates/UPDATE_ROADMAP_template.md +7 -0
  114. package/docs/refs/templates/WKS_template.md +5 -6
  115. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -13,8 +13,8 @@ export { FileSystemCurriculumAdapter, FileSystemStorageOptions, STANDARD_SOT_FIL
13
13
  import { F as FrameworkPack, C as CoverageGateReport } from './standardsCoverageGate-49pJq5t8.cjs';
14
14
  export { B as BloomHintSchema, a as ClassificationSchema, m as CoverageGateInput, h as FrameworkMapping, d as FrameworkMappingSchema, f as FrameworkPackManifest, b as FrameworkPackManifestSchema, e as FrameworkPackSchema, g as FrameworkStatement, c as FrameworkStatementSchema, G as GradeBandSchema, i as MappingKind, M as MappingKindSchema, P as PackLintIssue, k as PackValidationResult, j as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from './standardsCoverageGate-49pJq5t8.cjs';
15
15
  import { z } from 'zod';
16
- import { R as ResolvedGateSettings } from './gateSettings-oo5tCUS_.cjs';
17
- export { A as ArtifactType, B as BoundaryPeek, b as CurriculumArtifactType, C as CurriculumGateMode, h as CurriculumHorizon, D as DEFAULT_GATE_SETTINGS, f as DetailedLessonBridge, E as ExtractCurriculumHorizonOptions, G as GateSettings, H as HorizonSessionSnapshot, i as HorizonValidationResult, c as ScaffoldingLevel, S as SingleArtifactRequest, a as SingleArtifactResult, k as extractCurriculumHorizon, g as gateModeFor, e as generateSingleArtifact, d as getArtifactMetadata, j as parseAllSessions, p as parseGateSettings, l as renderHorizonPromptBlock, r as resolveGateSettings, v as validateHorizonCompliance } from './gateSettings-oo5tCUS_.cjs';
16
+ import { R as ResolvedGateSettings } from './gateSettings-JoqERuS1.cjs';
17
+ export { A as ArtifactType, B as BoundaryPeek, b as CurriculumArtifactType, C as CurriculumGateMode, h as CurriculumHorizon, D as DEFAULT_GATE_SETTINGS, f as DetailedLessonBridge, E as ExtractCurriculumHorizonOptions, G as GateSettings, H as HorizonSessionSnapshot, i as HorizonValidationResult, c as ScaffoldingLevel, S as SingleArtifactRequest, a as SingleArtifactResult, k as extractCurriculumHorizon, g as gateModeFor, e as generateSingleArtifact, d as getArtifactMetadata, j as parseAllSessions, p as parseGateSettings, l as renderHorizonPromptBlock, r as resolveGateSettings, v as validateHorizonCompliance } from './gateSettings-JoqERuS1.cjs';
18
18
  export { DeliveryPackResult, JobManifest, LocalWorkspaceManager, ParsedQuizQuestion, buildDeliveryPackages, exportAllProjectQuizzes, formatQuizzesToCsv, parseQuizMarkdown } from './publishers/index.cjs';
19
19
  export { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult, p as publishToGitHub, c as publishToSupabase, u as uploadAssetToBucket } from './supabasePublisher-C627qXFT.cjs';
20
20
  export { BUNDLED_STANDARDS_PACK_IDS, HydratedPack, ImportPackResult, STANDARD_REF_REGEX, SelectedStatement, StandardStackOptions, StandardsRegistryAdapter, StandardsRegistryConfig, StandardsSelectionInput, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, extractStandardRefs, findStandardStatement, resolveStandardsPacks, selectStatementsForLesson } from './standards/index.cjs';
@@ -176,11 +176,6 @@ interface ExcerptOptions {
176
176
  priorities?: string[];
177
177
  /** Character budget for the excerpt (default 12_000, ~3k tokens). */
178
178
  budget?: number;
179
- /**
180
- * Section Language Contract mapping (Record or raw contract markdown).
181
- * Used to resolve localized headings (e.g. Vietnamese) to canonical keys.
182
- */
183
- sectionLanguageContract?: Record<string, Record<string, string>> | string;
184
179
  /** File name or artifact type hint (e.g. 'LESSON', 'KNOWLEDGE_EXPOSITION'). */
185
180
  artifactType?: string;
186
181
  /**
@@ -218,10 +213,6 @@ declare const DEFAULT_KX_PRIORITIES: string[];
218
213
  declare function buildSectionAwareExcerpt(markdown: string, opts?: ExcerptOptions): ExcerptResult;
219
214
  declare function buildExpositionExcerpt(markdown: string, opts?: Omit<ExcerptOptions, 'priorities'>): ExcerptResult;
220
215
  declare function buildLessonExcerpt(markdown: string, opts?: Omit<ExcerptOptions, 'priorities'>): ExcerptResult;
221
- /**
222
- * Normalizes SLC input into a two-level map: Record<ArtifactType, Record<CanonicalKey, LocalizedLabel>>
223
- */
224
- declare function normalizeSlcContract(slc: Record<string, Record<string, string>> | string | undefined): Record<string, Record<string, string>> | undefined;
225
216
  /**
226
217
  * Extracts code symbol & identifier contracts from LESSON markdown.
227
218
  * Provides deterministic symbol names (Primary Struct/Class, Entry File, Key Functions)
@@ -445,8 +436,6 @@ interface SatelliteContextInput {
445
436
  * markdown excerpt becomes the fallback, not the parser target.
446
437
  */
447
438
  lessonEntity?: LessonEntity | null;
448
- /** Section Language Contract raw markdown (bilingual heading resolution). */
449
- slcMarkdown?: string;
450
439
  /** Symbol ledger block already rendered by the caller (appended to LESSON-primary and CODE contexts). */
451
440
  symbolLedgerBlock: string;
452
441
  /** Pedagogy label for the legacy composite heading (byte-compat with pre-P49). */
@@ -493,7 +482,7 @@ interface ActivityAlignmentResult {
493
482
  declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined, generatedContent: string, now?: Date): ActivityAlignmentResult;
494
483
 
495
484
  /**
496
- * P52 — Runtime artifact-template loading (single source of truth).
485
+ * P52/P53 — Runtime artifact-template loading (single source of truth).
497
486
  *
498
487
  * Restores the curriculum-mcp architecture that was lost when prompt
499
488
  * skeletons were retyped as hardcoded strings inside
@@ -502,20 +491,46 @@ declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined,
502
491
  * - methodology directives stay in the prompt-builder;
503
492
  * - project-local `_templates/` may override any template (MCP parity).
504
493
  *
505
- * A template file = YAML frontmatter (may declare `template_required_sections`,
506
- * the canonical contract echoed by generated artifacts) + fill-in body whose
507
- * headers the LLM must keep verbatim.
494
+ * P53 rev3 (echo model): a template file = YAML frontmatter (system-owned
495
+ * cached echo: `template_language`, `template_required_sections`) + fill-in
496
+ * body. The BODY headings are the single source of structure — the
497
+ * frontmatter list is regenerated mechanically (assembleTranslatedTemplate /
498
+ * editor save), never hand-maintained.
499
+ *
500
+ * Heading standard (H1–H3 only; H4+ do not exist):
501
+ * - every heading is REQUIRED by default → the `[REQUIRED]` marker is
502
+ * stripped everywhere (bundled + baked + generated artifacts);
503
+ * - `[OPTIONAL]` → still a heading, but excluded from the echo/contract;
504
+ * - `[CONDITIONAL]` → required echo + exposed as semantic metadata;
505
+ * - a heading containing a VARIABLE part (`{{placeholder}}` or bracket
506
+ * `[guidance]`) is not a section at all — it is an instance/guidance
507
+ * header (Q1, Challenge 1, Term Name, phase timing) → excluded from the
508
+ * echo. Static durations belong on a `**Duration:**` line under the
509
+ * heading, never inside it.
508
510
  */
509
511
  interface ResolvedTemplate {
510
512
  /** Fill-in body (frontmatter + leading HTML comments stripped). */
511
513
  content: string;
512
514
  /**
513
- * Canonical section contract: template frontmatter
514
- * `template_required_sections` when declared, else normalized H2 headings.
515
+ * P53 rev3 mechanical echo of the template BODY headings (H2/H3, static
516
+ * text only, `[OPTIONAL]` excluded, markers/ordinals stripped). This IS the
517
+ * contract; the frontmatter list is just its cached copy.
515
518
  */
516
519
  sections: string[];
520
+ /** Headings explicitly marked `[OPTIONAL]` (excluded from `sections`). */
521
+ optionalSections: string[];
517
522
  /** Absolute path the template was loaded from (telemetry / debugging). */
518
523
  sourcePath: string;
524
+ /**
525
+ * P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body.
526
+ */
527
+ conditionals: string[];
528
+ /**
529
+ * P53 — declared authoring language of the template body
530
+ * (`template_language:` frontmatter, default "en"). "en" = bundled source;
531
+ * anything else = translated project copy (bake-aware regime downstream).
532
+ */
533
+ declaredLang: string;
519
534
  }
520
535
  /**
521
536
  * Strip YAML frontmatter from a template document.
@@ -525,13 +540,30 @@ interface ResolvedTemplate {
525
540
  */
526
541
  declare function stripTemplateFrontmatter(raw: string): string;
527
542
  /**
528
- * Minimal reader for the `template_required_sections:` YAML list.
529
- * Deliberately not a full YAML parser the contract is one flat list of
530
- * quoted strings; anything else falls back to H2 extraction.
543
+ * Legacy reader for the `template_required_sections:` YAML list (the cached
544
+ * echo). Kept for app-side consumers reading artifact frontmatter; the kit
545
+ * itself now derives structure from the body (extractEchoSections).
531
546
  */
532
547
  declare function extractRequiredSections(raw: string): string[] | null;
533
- /** H2 headings of the template body (frontmatter-stripped), normalized. */
534
- declare function extractBodySections(raw: string): string[];
548
+ /**
549
+ * P53 — canonical heading key: strips contract markers AND ordinal prefixes
550
+ * so `### 1. Learning Objectives & Evidence` and `1) Learning Objectives…`
551
+ * both normalize to the same key. Users may renumber headings without
552
+ * breaking matching.
553
+ */
554
+ declare function stripHeadingKey(h: string): string;
555
+ /**
556
+ * P53 rev3 — the contract echo of a template/artifact document: required
557
+ * sections (default) and explicitly-optional ones, straight from the body.
558
+ */
559
+ declare function extractEchoSections(raw: string): {
560
+ required: string[];
561
+ optional: string[];
562
+ };
563
+ /** P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body. */
564
+ declare function extractConditionalSections(raw: string): string[];
565
+ /** P53 — `template_language:` frontmatter value (default "en"). */
566
+ declare function extractDeclaredLanguage(raw: string): string;
535
567
  /**
536
568
  * Resolve a canonical template by file name. First existing candidate wins:
537
569
  * explicit dir → CURRICULUM_TEMPLATES_DIR → <cwd>/_templates → packaged
@@ -541,6 +573,42 @@ declare function extractBodySections(raw: string): string[];
541
573
  declare function resolveArtifactTemplate(templateName: string, opts?: {
542
574
  templatesDir?: string;
543
575
  }): ResolvedTemplate | null;
576
+ /** AI runner contract for template translation (injected — kit stays provider-agnostic). */
577
+ type TemplateTranslateRunner = (prompt: string) => Promise<string>;
578
+ interface AssembledTemplate {
579
+ /** Full document: REGENERATED frontmatter echo + translated body. */
580
+ raw: string;
581
+ /** Contract echo of the translated body (= the regenerated FM list). */
582
+ sections: string[];
583
+ templateLanguage: string;
584
+ }
585
+ /**
586
+ * P53 rev3 — assemble a project template copy from an AI-translated BODY.
587
+ * The frontmatter is never AI-edited: it is regenerated mechanically —
588
+ * `template_language` stamp + `template_required_sections` echoed from the
589
+ * translated headings (the body is the single source; the FM list follows it).
590
+ *
591
+ * Structural verification: heading count, order, and levels must survive
592
+ * translation 1:1 (required AND optional). Any drift → null; the caller
593
+ * falls back to the bundled English template rather than shipping a broken
594
+ * contract. `{{placeholder}}` / marker preservation is verified here too.
595
+ */
596
+ declare function assembleTranslatedTemplate(templateName: string, translatedBody: string, targetLanguage: string, opts?: {
597
+ templatesDir?: string;
598
+ }): AssembledTemplate | null;
599
+ /**
600
+ * P53 — full-body template translation (AI, once per language + content hash;
601
+ * caching is the caller's job). The kit stays language-neutral: bundled
602
+ * templates are never translated in-repo.
603
+ *
604
+ * Pipeline: split frontmatter (never sent to AI) → prompt the runner with
605
+ * preservation rules → assembleTranslatedTemplate regenerates the frontmatter
606
+ * echo and structurally verifies the result. Returns null on any violation;
607
+ * the caller falls back to the bundled English template.
608
+ */
609
+ declare function translateTemplate(templateName: string, targetLanguage: string, runner: TemplateTranslateRunner, opts?: {
610
+ templatesDir?: string;
611
+ }): Promise<AssembledTemplate | null>;
544
612
  /**
545
613
  * Legacy raw-content lookup retained for existing callers
546
614
  * (`singleArtifactService`, SLIDE workflow). Returns the file verbatim —
@@ -583,7 +651,6 @@ interface ProduceLessonOptions {
583
651
  force?: boolean;
584
652
  pedagogy?: PedagogicalModel;
585
653
  targetLanguage?: string;
586
- sectionLanguageContract?: string;
587
654
  slidesEngine?: 'html' | 'marp';
588
655
  /** Chiến lược batch (chỉ produceBatchLessons dùng). */
589
656
  batchStrategy?: 'depth_first_lesson' | 'breadth_first_artifact';
@@ -1155,7 +1222,6 @@ interface GenerateExpositionOptions {
1155
1222
  storage: ExpositionStorage;
1156
1223
  gates?: ResolvedGateSettings;
1157
1224
  targetLanguage?: string;
1158
- slcMarkdown?: Record<string, Record<string, string>> | string | null;
1159
1225
  techStack?: string;
1160
1226
  hardwarePlatform?: string;
1161
1227
  /** REFERENCE_PACK.md raw content — technical ground truth (versions, APIs).
@@ -1195,7 +1261,6 @@ declare function ensureExpositionForLesson(storage: ICurriculumStorage, projectI
1195
1261
  gates?: ResolvedGateSettings;
1196
1262
  force?: boolean;
1197
1263
  targetLanguage?: string;
1198
- slcMarkdown?: Record<string, Record<string, string>> | string | null;
1199
1264
  customInference?: StreamRunnerOptions['customInference'];
1200
1265
  techStack?: string;
1201
1266
  hardwarePlatform?: string;
@@ -1236,17 +1301,30 @@ declare function isTranslationDue(target: TranslationTarget, context: {
1236
1301
  }): boolean;
1237
1302
 
1238
1303
  /**
1239
- * Language Directive and Section Language Contract (SLC) resolution for Curriculum Generation.
1304
+ * Language Directive and section-heading resolution for Curriculum Generation.
1240
1305
  */
1241
1306
  declare function resolveTargetLanguageCode(language?: string | null): string;
1242
1307
  declare function targetLanguageDisplayName(code: string): string;
1243
1308
  declare function buildLanguageDirective(targetLanguage?: string | null): string;
1244
- declare const DEFAULT_VIETNAMESE_SECTION_HEADINGS: Record<string, Record<string, string>>;
1245
- declare function extractSectionHeadingsFromSLC(slcInput: Record<string, Record<string, string>> | string | undefined | null, artifactType: string, targetLanguage?: string): Record<string, string>;
1246
1309
  /**
1247
- * Builds the heading directive block to instruct LLM on verbatim section headings.
1310
+ * Identity heading map from the resolved template's echo (canonical = display).
1248
1311
  */
1249
- declare function buildHeadingDirective(artifactType: string, slcMarkdown?: Record<string, Record<string, string>> | string | null, targetLanguage?: string): string;
1312
+ declare function extractSectionHeadings(artifactType: string, opts?: {
1313
+ templatesDir?: string;
1314
+ }): Record<string, string>;
1315
+ /**
1316
+ * Builds the heading directive block to instruct the LLM on section headings.
1317
+ *
1318
+ * P53 rev3 — one regime only: the resolved template's ECHO is the source.
1319
+ * - Translated project copy (declaredLang ≠ "en"): headings are already the
1320
+ * display strings.
1321
+ * - Bundled English template: echo = English headings.
1322
+ * The frontmatter list is system-owned (it IS the echo), so the directive
1323
+ * tells the LLM to copy it verbatim — never to translate or invent entries.
1324
+ */
1325
+ declare function buildHeadingDirective(artifactType: string, opts?: {
1326
+ templatesDir?: string;
1327
+ }): string;
1250
1328
 
1251
1329
  /**
1252
1330
  * Curriculum OS - Standardized Error Taxonomy & Traceability System
@@ -1793,4 +1871,4 @@ declare class MisconceptionEvaluator {
1793
1871
  static evaluateQuiz(quiz: DiagnosticQuiz): DimensionScore;
1794
1872
  }
1795
1873
 
1796
- export { AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, type ActivityAlignmentResult, ActivityLab, ActivitySeqRow, type ArtifactDependencyRule, type ArtifactProductionSpec, type ArtifactPromptParts, type AuditBundleInput, BLOOM_ACTION_VERBS, BloomTaxonomyEvaluator, type BuildContextOptions, CURRICULUM_SLASH_COMMANDS, ChunkType, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConceptPrerequisiteEdge, ConceptSpiralEncounter, ConstructiveAlignmentEvaluator, type ContextInjectionMeta, type ContextRoutingMode, type ContextSourceKey, CoverageGateReport, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_OVERHEAD_RATIO, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DEFAULT_VIETNAMESE_SECTION_HEADINGS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, ENVIRONMENT_PROVISIONING_MODELS, EXPOSITION_REL, type EnvironmentProvisioningModel, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedJson, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, type GenerateExpositionOptions, GeneratedSlideArraySchema, GeneratedSlideSchema, HybridBlueprintArraySchema, HybridBlueprintItemSchema, HybridDeckSlideArraySchema, HybridDeckSlideSchema, HybridPipelineError, ICurriculumStorage, JUDGE_AUTO_APPROVE_THRESHOLD, JUDGE_ESCALATE_THRESHOLD, LAYER_IDLE_BUDGET_MS, LAYER_TOTAL_BUDGET_MS, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LessonEntity, LessonEntitySchema, LessonPlan, MAX_AUTONOMOUS_REPAIR_TURNS, MAX_IN_SESSION_SETUP_MINUTES, MAX_NEW_CONCEPTS_PER_SESSION_ADULT, MAX_NEW_CONCEPTS_PER_SESSION_K12, MasteryGate, MisconceptionEvaluator, ModelResolutionOptions, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PrefillProviderEvent, type PreliminaryResearchResult, PrerequisiteDecision, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QualityAuditReport, ResolvedGateSettings, type ResolvedTemplate, SATELLITE_LESSON_PRIORITIES, STUDENT_FRICTION_MULTIPLIER, type SatContextResult, type SatelliteContextInput, SessionZpdStatus, type SlashCommandDefinition, SlideBlueprintArraySchema, SlideBlueprintItemSchema, SlideDeck, type SlideEngine, type SlideProductionWorkflowOptions, type SlideProductionWorkflowResult, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, StreamRunnerOptions, type SymbolLedgerResult, TranslationPolicy, type TranslationTarget, type TranslationTrigger, UnitPlan, type ValidationOptions, WalkingSkeleton, analyzeProjectCreationIntent, assertAcyclic, assignDepths, auditQualityReport, buildArtifactPrompt, buildConceptPrerequisites, buildCurriculumContext, buildCurriculumPlan, buildDomainLexiconGuardrail, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonEntityJson, buildLessonExcerpt, buildMasteryGates, buildSatelliteContext, buildSectionAwareExcerpt, buildSessionSliceContext, buildWalkingSkeleton, checkSessionZpd, closeTruncatedJson, computeConceptSpiralProgression, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, dropCyclicConceptEdges, emitUsage, ensureExpositionForLesson, ensureKnowledgeExposition, entityRowAssignedTo, evaluateActivityAlignment, executeCurriculumCommand, executeSlideProductionWorkflow, expositionCacheKey, extractActivityContractRows, extractAssessmentMap, extractBodySections, extractJsonArray, extractRequiredSections, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, extractSymbolLedger, extractTieredScaffoldingBlock, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isActivityAlignmentLogOnly, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadAuthoringTemplate, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderAssignedRowsTable, renderEntitySlotsForType, renderFrameworkFromPlan, resolveArtifactTemplate, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, stripTemplateFrontmatter, targetLanguageDisplayName, topoSort, validateArtifactDependencies, validateHybridDeckSlides };
1874
+ export { AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, type ActivityAlignmentResult, ActivityLab, ActivitySeqRow, type ArtifactDependencyRule, type ArtifactProductionSpec, type ArtifactPromptParts, type AssembledTemplate, type AuditBundleInput, BLOOM_ACTION_VERBS, BloomTaxonomyEvaluator, type BuildContextOptions, CURRICULUM_SLASH_COMMANDS, ChunkType, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConceptPrerequisiteEdge, ConceptSpiralEncounter, ConstructiveAlignmentEvaluator, type ContextInjectionMeta, type ContextRoutingMode, type ContextSourceKey, CoverageGateReport, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_OVERHEAD_RATIO, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, ENVIRONMENT_PROVISIONING_MODELS, EXPOSITION_REL, type EnvironmentProvisioningModel, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedJson, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, type GenerateExpositionOptions, GeneratedSlideArraySchema, GeneratedSlideSchema, HybridBlueprintArraySchema, HybridBlueprintItemSchema, HybridDeckSlideArraySchema, HybridDeckSlideSchema, HybridPipelineError, ICurriculumStorage, JUDGE_AUTO_APPROVE_THRESHOLD, JUDGE_ESCALATE_THRESHOLD, LAYER_IDLE_BUDGET_MS, LAYER_TOTAL_BUDGET_MS, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LessonEntity, LessonEntitySchema, LessonPlan, MAX_AUTONOMOUS_REPAIR_TURNS, MAX_IN_SESSION_SETUP_MINUTES, MAX_NEW_CONCEPTS_PER_SESSION_ADULT, MAX_NEW_CONCEPTS_PER_SESSION_K12, MasteryGate, MisconceptionEvaluator, ModelResolutionOptions, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PrefillProviderEvent, type PreliminaryResearchResult, PrerequisiteDecision, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QualityAuditReport, ResolvedGateSettings, type ResolvedTemplate, SATELLITE_LESSON_PRIORITIES, STUDENT_FRICTION_MULTIPLIER, type SatContextResult, type SatelliteContextInput, SessionZpdStatus, type SlashCommandDefinition, SlideBlueprintArraySchema, SlideBlueprintItemSchema, SlideDeck, type SlideEngine, type SlideProductionWorkflowOptions, type SlideProductionWorkflowResult, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, StreamRunnerOptions, type SymbolLedgerResult, type TemplateTranslateRunner, TranslationPolicy, type TranslationTarget, type TranslationTrigger, UnitPlan, type ValidationOptions, WalkingSkeleton, analyzeProjectCreationIntent, assembleTranslatedTemplate, assertAcyclic, assignDepths, auditQualityReport, buildArtifactPrompt, buildConceptPrerequisites, buildCurriculumContext, buildCurriculumPlan, buildDomainLexiconGuardrail, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonEntityJson, buildLessonExcerpt, buildMasteryGates, buildSatelliteContext, buildSectionAwareExcerpt, buildSessionSliceContext, buildWalkingSkeleton, checkSessionZpd, closeTruncatedJson, computeConceptSpiralProgression, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, dropCyclicConceptEdges, emitUsage, ensureExpositionForLesson, ensureKnowledgeExposition, entityRowAssignedTo, evaluateActivityAlignment, executeCurriculumCommand, executeSlideProductionWorkflow, expositionCacheKey, extractActivityContractRows, extractAssessmentMap, extractConditionalSections, extractDeclaredLanguage, extractEchoSections, extractJsonArray, extractRequiredSections, extractScopeSequenceRows, extractSectionHeadings, extractSessionSlice, extractStreamChunk, extractSymbolLedger, extractTieredScaffoldingBlock, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isActivityAlignmentLogOnly, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadAuthoringTemplate, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderAssignedRowsTable, renderEntitySlotsForType, renderFrameworkFromPlan, resolveArtifactTemplate, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripHeadingKey, stripLlmJsonWrappers, stripTemplateFrontmatter, targetLanguageDisplayName, topoSort, translateTemplate, validateArtifactDependencies, validateHybridDeckSlides };
package/dist/index.d.ts CHANGED
@@ -13,8 +13,8 @@ export { FileSystemCurriculumAdapter, FileSystemStorageOptions, STANDARD_SOT_FIL
13
13
  import { F as FrameworkPack, C as CoverageGateReport } from './standardsCoverageGate-49pJq5t8.js';
14
14
  export { B as BloomHintSchema, a as ClassificationSchema, m as CoverageGateInput, h as FrameworkMapping, d as FrameworkMappingSchema, f as FrameworkPackManifest, b as FrameworkPackManifestSchema, e as FrameworkPackSchema, g as FrameworkStatement, c as FrameworkStatementSchema, G as GradeBandSchema, i as MappingKind, M as MappingKindSchema, P as PackLintIssue, k as PackValidationResult, j as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from './standardsCoverageGate-49pJq5t8.js';
15
15
  import { z } from 'zod';
16
- import { R as ResolvedGateSettings } from './gateSettings-oo5tCUS_.js';
17
- export { A as ArtifactType, B as BoundaryPeek, b as CurriculumArtifactType, C as CurriculumGateMode, h as CurriculumHorizon, D as DEFAULT_GATE_SETTINGS, f as DetailedLessonBridge, E as ExtractCurriculumHorizonOptions, G as GateSettings, H as HorizonSessionSnapshot, i as HorizonValidationResult, c as ScaffoldingLevel, S as SingleArtifactRequest, a as SingleArtifactResult, k as extractCurriculumHorizon, g as gateModeFor, e as generateSingleArtifact, d as getArtifactMetadata, j as parseAllSessions, p as parseGateSettings, l as renderHorizonPromptBlock, r as resolveGateSettings, v as validateHorizonCompliance } from './gateSettings-oo5tCUS_.js';
16
+ import { R as ResolvedGateSettings } from './gateSettings-JoqERuS1.js';
17
+ export { A as ArtifactType, B as BoundaryPeek, b as CurriculumArtifactType, C as CurriculumGateMode, h as CurriculumHorizon, D as DEFAULT_GATE_SETTINGS, f as DetailedLessonBridge, E as ExtractCurriculumHorizonOptions, G as GateSettings, H as HorizonSessionSnapshot, i as HorizonValidationResult, c as ScaffoldingLevel, S as SingleArtifactRequest, a as SingleArtifactResult, k as extractCurriculumHorizon, g as gateModeFor, e as generateSingleArtifact, d as getArtifactMetadata, j as parseAllSessions, p as parseGateSettings, l as renderHorizonPromptBlock, r as resolveGateSettings, v as validateHorizonCompliance } from './gateSettings-JoqERuS1.js';
18
18
  export { DeliveryPackResult, JobManifest, LocalWorkspaceManager, ParsedQuizQuestion, buildDeliveryPackages, exportAllProjectQuizzes, formatQuizzesToCsv, parseQuizMarkdown } from './publishers/index.js';
19
19
  export { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult, p as publishToGitHub, c as publishToSupabase, u as uploadAssetToBucket } from './supabasePublisher-C627qXFT.js';
20
20
  export { BUNDLED_STANDARDS_PACK_IDS, HydratedPack, ImportPackResult, STANDARD_REF_REGEX, SelectedStatement, StandardStackOptions, StandardsRegistryAdapter, StandardsRegistryConfig, StandardsSelectionInput, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, extractStandardRefs, findStandardStatement, resolveStandardsPacks, selectStatementsForLesson } from './standards/index.js';
@@ -176,11 +176,6 @@ interface ExcerptOptions {
176
176
  priorities?: string[];
177
177
  /** Character budget for the excerpt (default 12_000, ~3k tokens). */
178
178
  budget?: number;
179
- /**
180
- * Section Language Contract mapping (Record or raw contract markdown).
181
- * Used to resolve localized headings (e.g. Vietnamese) to canonical keys.
182
- */
183
- sectionLanguageContract?: Record<string, Record<string, string>> | string;
184
179
  /** File name or artifact type hint (e.g. 'LESSON', 'KNOWLEDGE_EXPOSITION'). */
185
180
  artifactType?: string;
186
181
  /**
@@ -218,10 +213,6 @@ declare const DEFAULT_KX_PRIORITIES: string[];
218
213
  declare function buildSectionAwareExcerpt(markdown: string, opts?: ExcerptOptions): ExcerptResult;
219
214
  declare function buildExpositionExcerpt(markdown: string, opts?: Omit<ExcerptOptions, 'priorities'>): ExcerptResult;
220
215
  declare function buildLessonExcerpt(markdown: string, opts?: Omit<ExcerptOptions, 'priorities'>): ExcerptResult;
221
- /**
222
- * Normalizes SLC input into a two-level map: Record<ArtifactType, Record<CanonicalKey, LocalizedLabel>>
223
- */
224
- declare function normalizeSlcContract(slc: Record<string, Record<string, string>> | string | undefined): Record<string, Record<string, string>> | undefined;
225
216
  /**
226
217
  * Extracts code symbol & identifier contracts from LESSON markdown.
227
218
  * Provides deterministic symbol names (Primary Struct/Class, Entry File, Key Functions)
@@ -445,8 +436,6 @@ interface SatelliteContextInput {
445
436
  * markdown excerpt becomes the fallback, not the parser target.
446
437
  */
447
438
  lessonEntity?: LessonEntity | null;
448
- /** Section Language Contract raw markdown (bilingual heading resolution). */
449
- slcMarkdown?: string;
450
439
  /** Symbol ledger block already rendered by the caller (appended to LESSON-primary and CODE contexts). */
451
440
  symbolLedgerBlock: string;
452
441
  /** Pedagogy label for the legacy composite heading (byte-compat with pre-P49). */
@@ -493,7 +482,7 @@ interface ActivityAlignmentResult {
493
482
  declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined, generatedContent: string, now?: Date): ActivityAlignmentResult;
494
483
 
495
484
  /**
496
- * P52 — Runtime artifact-template loading (single source of truth).
485
+ * P52/P53 — Runtime artifact-template loading (single source of truth).
497
486
  *
498
487
  * Restores the curriculum-mcp architecture that was lost when prompt
499
488
  * skeletons were retyped as hardcoded strings inside
@@ -502,20 +491,46 @@ declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined,
502
491
  * - methodology directives stay in the prompt-builder;
503
492
  * - project-local `_templates/` may override any template (MCP parity).
504
493
  *
505
- * A template file = YAML frontmatter (may declare `template_required_sections`,
506
- * the canonical contract echoed by generated artifacts) + fill-in body whose
507
- * headers the LLM must keep verbatim.
494
+ * P53 rev3 (echo model): a template file = YAML frontmatter (system-owned
495
+ * cached echo: `template_language`, `template_required_sections`) + fill-in
496
+ * body. The BODY headings are the single source of structure — the
497
+ * frontmatter list is regenerated mechanically (assembleTranslatedTemplate /
498
+ * editor save), never hand-maintained.
499
+ *
500
+ * Heading standard (H1–H3 only; H4+ do not exist):
501
+ * - every heading is REQUIRED by default → the `[REQUIRED]` marker is
502
+ * stripped everywhere (bundled + baked + generated artifacts);
503
+ * - `[OPTIONAL]` → still a heading, but excluded from the echo/contract;
504
+ * - `[CONDITIONAL]` → required echo + exposed as semantic metadata;
505
+ * - a heading containing a VARIABLE part (`{{placeholder}}` or bracket
506
+ * `[guidance]`) is not a section at all — it is an instance/guidance
507
+ * header (Q1, Challenge 1, Term Name, phase timing) → excluded from the
508
+ * echo. Static durations belong on a `**Duration:**` line under the
509
+ * heading, never inside it.
508
510
  */
509
511
  interface ResolvedTemplate {
510
512
  /** Fill-in body (frontmatter + leading HTML comments stripped). */
511
513
  content: string;
512
514
  /**
513
- * Canonical section contract: template frontmatter
514
- * `template_required_sections` when declared, else normalized H2 headings.
515
+ * P53 rev3 mechanical echo of the template BODY headings (H2/H3, static
516
+ * text only, `[OPTIONAL]` excluded, markers/ordinals stripped). This IS the
517
+ * contract; the frontmatter list is just its cached copy.
515
518
  */
516
519
  sections: string[];
520
+ /** Headings explicitly marked `[OPTIONAL]` (excluded from `sections`). */
521
+ optionalSections: string[];
517
522
  /** Absolute path the template was loaded from (telemetry / debugging). */
518
523
  sourcePath: string;
524
+ /**
525
+ * P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body.
526
+ */
527
+ conditionals: string[];
528
+ /**
529
+ * P53 — declared authoring language of the template body
530
+ * (`template_language:` frontmatter, default "en"). "en" = bundled source;
531
+ * anything else = translated project copy (bake-aware regime downstream).
532
+ */
533
+ declaredLang: string;
519
534
  }
520
535
  /**
521
536
  * Strip YAML frontmatter from a template document.
@@ -525,13 +540,30 @@ interface ResolvedTemplate {
525
540
  */
526
541
  declare function stripTemplateFrontmatter(raw: string): string;
527
542
  /**
528
- * Minimal reader for the `template_required_sections:` YAML list.
529
- * Deliberately not a full YAML parser the contract is one flat list of
530
- * quoted strings; anything else falls back to H2 extraction.
543
+ * Legacy reader for the `template_required_sections:` YAML list (the cached
544
+ * echo). Kept for app-side consumers reading artifact frontmatter; the kit
545
+ * itself now derives structure from the body (extractEchoSections).
531
546
  */
532
547
  declare function extractRequiredSections(raw: string): string[] | null;
533
- /** H2 headings of the template body (frontmatter-stripped), normalized. */
534
- declare function extractBodySections(raw: string): string[];
548
+ /**
549
+ * P53 — canonical heading key: strips contract markers AND ordinal prefixes
550
+ * so `### 1. Learning Objectives & Evidence` and `1) Learning Objectives…`
551
+ * both normalize to the same key. Users may renumber headings without
552
+ * breaking matching.
553
+ */
554
+ declare function stripHeadingKey(h: string): string;
555
+ /**
556
+ * P53 rev3 — the contract echo of a template/artifact document: required
557
+ * sections (default) and explicitly-optional ones, straight from the body.
558
+ */
559
+ declare function extractEchoSections(raw: string): {
560
+ required: string[];
561
+ optional: string[];
562
+ };
563
+ /** P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body. */
564
+ declare function extractConditionalSections(raw: string): string[];
565
+ /** P53 — `template_language:` frontmatter value (default "en"). */
566
+ declare function extractDeclaredLanguage(raw: string): string;
535
567
  /**
536
568
  * Resolve a canonical template by file name. First existing candidate wins:
537
569
  * explicit dir → CURRICULUM_TEMPLATES_DIR → <cwd>/_templates → packaged
@@ -541,6 +573,42 @@ declare function extractBodySections(raw: string): string[];
541
573
  declare function resolveArtifactTemplate(templateName: string, opts?: {
542
574
  templatesDir?: string;
543
575
  }): ResolvedTemplate | null;
576
+ /** AI runner contract for template translation (injected — kit stays provider-agnostic). */
577
+ type TemplateTranslateRunner = (prompt: string) => Promise<string>;
578
+ interface AssembledTemplate {
579
+ /** Full document: REGENERATED frontmatter echo + translated body. */
580
+ raw: string;
581
+ /** Contract echo of the translated body (= the regenerated FM list). */
582
+ sections: string[];
583
+ templateLanguage: string;
584
+ }
585
+ /**
586
+ * P53 rev3 — assemble a project template copy from an AI-translated BODY.
587
+ * The frontmatter is never AI-edited: it is regenerated mechanically —
588
+ * `template_language` stamp + `template_required_sections` echoed from the
589
+ * translated headings (the body is the single source; the FM list follows it).
590
+ *
591
+ * Structural verification: heading count, order, and levels must survive
592
+ * translation 1:1 (required AND optional). Any drift → null; the caller
593
+ * falls back to the bundled English template rather than shipping a broken
594
+ * contract. `{{placeholder}}` / marker preservation is verified here too.
595
+ */
596
+ declare function assembleTranslatedTemplate(templateName: string, translatedBody: string, targetLanguage: string, opts?: {
597
+ templatesDir?: string;
598
+ }): AssembledTemplate | null;
599
+ /**
600
+ * P53 — full-body template translation (AI, once per language + content hash;
601
+ * caching is the caller's job). The kit stays language-neutral: bundled
602
+ * templates are never translated in-repo.
603
+ *
604
+ * Pipeline: split frontmatter (never sent to AI) → prompt the runner with
605
+ * preservation rules → assembleTranslatedTemplate regenerates the frontmatter
606
+ * echo and structurally verifies the result. Returns null on any violation;
607
+ * the caller falls back to the bundled English template.
608
+ */
609
+ declare function translateTemplate(templateName: string, targetLanguage: string, runner: TemplateTranslateRunner, opts?: {
610
+ templatesDir?: string;
611
+ }): Promise<AssembledTemplate | null>;
544
612
  /**
545
613
  * Legacy raw-content lookup retained for existing callers
546
614
  * (`singleArtifactService`, SLIDE workflow). Returns the file verbatim —
@@ -583,7 +651,6 @@ interface ProduceLessonOptions {
583
651
  force?: boolean;
584
652
  pedagogy?: PedagogicalModel;
585
653
  targetLanguage?: string;
586
- sectionLanguageContract?: string;
587
654
  slidesEngine?: 'html' | 'marp';
588
655
  /** Chiến lược batch (chỉ produceBatchLessons dùng). */
589
656
  batchStrategy?: 'depth_first_lesson' | 'breadth_first_artifact';
@@ -1155,7 +1222,6 @@ interface GenerateExpositionOptions {
1155
1222
  storage: ExpositionStorage;
1156
1223
  gates?: ResolvedGateSettings;
1157
1224
  targetLanguage?: string;
1158
- slcMarkdown?: Record<string, Record<string, string>> | string | null;
1159
1225
  techStack?: string;
1160
1226
  hardwarePlatform?: string;
1161
1227
  /** REFERENCE_PACK.md raw content — technical ground truth (versions, APIs).
@@ -1195,7 +1261,6 @@ declare function ensureExpositionForLesson(storage: ICurriculumStorage, projectI
1195
1261
  gates?: ResolvedGateSettings;
1196
1262
  force?: boolean;
1197
1263
  targetLanguage?: string;
1198
- slcMarkdown?: Record<string, Record<string, string>> | string | null;
1199
1264
  customInference?: StreamRunnerOptions['customInference'];
1200
1265
  techStack?: string;
1201
1266
  hardwarePlatform?: string;
@@ -1236,17 +1301,30 @@ declare function isTranslationDue(target: TranslationTarget, context: {
1236
1301
  }): boolean;
1237
1302
 
1238
1303
  /**
1239
- * Language Directive and Section Language Contract (SLC) resolution for Curriculum Generation.
1304
+ * Language Directive and section-heading resolution for Curriculum Generation.
1240
1305
  */
1241
1306
  declare function resolveTargetLanguageCode(language?: string | null): string;
1242
1307
  declare function targetLanguageDisplayName(code: string): string;
1243
1308
  declare function buildLanguageDirective(targetLanguage?: string | null): string;
1244
- declare const DEFAULT_VIETNAMESE_SECTION_HEADINGS: Record<string, Record<string, string>>;
1245
- declare function extractSectionHeadingsFromSLC(slcInput: Record<string, Record<string, string>> | string | undefined | null, artifactType: string, targetLanguage?: string): Record<string, string>;
1246
1309
  /**
1247
- * Builds the heading directive block to instruct LLM on verbatim section headings.
1310
+ * Identity heading map from the resolved template's echo (canonical = display).
1248
1311
  */
1249
- declare function buildHeadingDirective(artifactType: string, slcMarkdown?: Record<string, Record<string, string>> | string | null, targetLanguage?: string): string;
1312
+ declare function extractSectionHeadings(artifactType: string, opts?: {
1313
+ templatesDir?: string;
1314
+ }): Record<string, string>;
1315
+ /**
1316
+ * Builds the heading directive block to instruct the LLM on section headings.
1317
+ *
1318
+ * P53 rev3 — one regime only: the resolved template's ECHO is the source.
1319
+ * - Translated project copy (declaredLang ≠ "en"): headings are already the
1320
+ * display strings.
1321
+ * - Bundled English template: echo = English headings.
1322
+ * The frontmatter list is system-owned (it IS the echo), so the directive
1323
+ * tells the LLM to copy it verbatim — never to translate or invent entries.
1324
+ */
1325
+ declare function buildHeadingDirective(artifactType: string, opts?: {
1326
+ templatesDir?: string;
1327
+ }): string;
1250
1328
 
1251
1329
  /**
1252
1330
  * Curriculum OS - Standardized Error Taxonomy & Traceability System
@@ -1793,4 +1871,4 @@ declare class MisconceptionEvaluator {
1793
1871
  static evaluateQuiz(quiz: DiagnosticQuiz): DimensionScore;
1794
1872
  }
1795
1873
 
1796
- export { AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, type ActivityAlignmentResult, ActivityLab, ActivitySeqRow, type ArtifactDependencyRule, type ArtifactProductionSpec, type ArtifactPromptParts, type AuditBundleInput, BLOOM_ACTION_VERBS, BloomTaxonomyEvaluator, type BuildContextOptions, CURRICULUM_SLASH_COMMANDS, ChunkType, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConceptPrerequisiteEdge, ConceptSpiralEncounter, ConstructiveAlignmentEvaluator, type ContextInjectionMeta, type ContextRoutingMode, type ContextSourceKey, CoverageGateReport, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_OVERHEAD_RATIO, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DEFAULT_VIETNAMESE_SECTION_HEADINGS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, ENVIRONMENT_PROVISIONING_MODELS, EXPOSITION_REL, type EnvironmentProvisioningModel, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedJson, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, type GenerateExpositionOptions, GeneratedSlideArraySchema, GeneratedSlideSchema, HybridBlueprintArraySchema, HybridBlueprintItemSchema, HybridDeckSlideArraySchema, HybridDeckSlideSchema, HybridPipelineError, ICurriculumStorage, JUDGE_AUTO_APPROVE_THRESHOLD, JUDGE_ESCALATE_THRESHOLD, LAYER_IDLE_BUDGET_MS, LAYER_TOTAL_BUDGET_MS, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LessonEntity, LessonEntitySchema, LessonPlan, MAX_AUTONOMOUS_REPAIR_TURNS, MAX_IN_SESSION_SETUP_MINUTES, MAX_NEW_CONCEPTS_PER_SESSION_ADULT, MAX_NEW_CONCEPTS_PER_SESSION_K12, MasteryGate, MisconceptionEvaluator, ModelResolutionOptions, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PrefillProviderEvent, type PreliminaryResearchResult, PrerequisiteDecision, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QualityAuditReport, ResolvedGateSettings, type ResolvedTemplate, SATELLITE_LESSON_PRIORITIES, STUDENT_FRICTION_MULTIPLIER, type SatContextResult, type SatelliteContextInput, SessionZpdStatus, type SlashCommandDefinition, SlideBlueprintArraySchema, SlideBlueprintItemSchema, SlideDeck, type SlideEngine, type SlideProductionWorkflowOptions, type SlideProductionWorkflowResult, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, StreamRunnerOptions, type SymbolLedgerResult, TranslationPolicy, type TranslationTarget, type TranslationTrigger, UnitPlan, type ValidationOptions, WalkingSkeleton, analyzeProjectCreationIntent, assertAcyclic, assignDepths, auditQualityReport, buildArtifactPrompt, buildConceptPrerequisites, buildCurriculumContext, buildCurriculumPlan, buildDomainLexiconGuardrail, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonEntityJson, buildLessonExcerpt, buildMasteryGates, buildSatelliteContext, buildSectionAwareExcerpt, buildSessionSliceContext, buildWalkingSkeleton, checkSessionZpd, closeTruncatedJson, computeConceptSpiralProgression, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, dropCyclicConceptEdges, emitUsage, ensureExpositionForLesson, ensureKnowledgeExposition, entityRowAssignedTo, evaluateActivityAlignment, executeCurriculumCommand, executeSlideProductionWorkflow, expositionCacheKey, extractActivityContractRows, extractAssessmentMap, extractBodySections, extractJsonArray, extractRequiredSections, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStreamChunk, extractSymbolLedger, extractTieredScaffoldingBlock, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isActivityAlignmentLogOnly, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadAuthoringTemplate, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderAssignedRowsTable, renderEntitySlotsForType, renderFrameworkFromPlan, resolveArtifactTemplate, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripLlmJsonWrappers, stripTemplateFrontmatter, targetLanguageDisplayName, topoSort, validateArtifactDependencies, validateHybridDeckSlides };
1874
+ export { AIProviderName, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, type AcademicAuditFinding, AcademicAuditor, type AcademicDimension, type ActivityAlignmentResult, ActivityLab, ActivitySeqRow, type ArtifactDependencyRule, type ArtifactProductionSpec, type ArtifactPromptParts, type AssembledTemplate, type AuditBundleInput, BLOOM_ACTION_VERBS, BloomTaxonomyEvaluator, type BuildContextOptions, CURRICULUM_SLASH_COMMANDS, ChunkType, CodeHardwareFeasibilityEvaluator, CodeLab, type ComprehensiveAcademicReport, ConceptPrerequisiteEdge, ConceptSpiralEncounter, ConstructiveAlignmentEvaluator, type ContextInjectionMeta, type ContextRoutingMode, type ContextSourceKey, CoverageGateReport, CrossArtifactDriftEvaluator, CurriculumError, type CurriculumErrorCode, type CurriculumErrorDetail, CurriculumPlan, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_OVERHEAD_RATIO, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DependencyEdge, type DependencyValidationResult, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuiz, DiagnosticQuizInput, type DimensionScore, ENVIRONMENT_PROVISIONING_MODELS, EXPOSITION_REL, type EnvironmentProvisioningModel, type ExcerptOptions, type ExcerptResult, type ExecuteCommandResult, ExpositionApprovalError, type ExpositionLlmFn, type ExpositionResult, type ExpositionStorage, type ExtractedJson, type ExtractedStreamChunk, type FindingSeverity, FiveEInstructionalEvaluator, type FrameworkLintFinding, type FrameworkLintReport, FrameworkPack, type GenerateExpositionOptions, GeneratedSlideArraySchema, GeneratedSlideSchema, HybridBlueprintArraySchema, HybridBlueprintItemSchema, HybridDeckSlideArraySchema, HybridDeckSlideSchema, HybridPipelineError, ICurriculumStorage, JUDGE_AUTO_APPROVE_THRESHOLD, JUDGE_ESCALATE_THRESHOLD, LAYER_IDLE_BUDGET_MS, LAYER_TOTAL_BUDGET_MS, type LayerChunkCallback, type LayerPrefillOptions, type LayerPrefillResult, type LessonEntity, LessonEntitySchema, LessonPlan, MAX_AUTONOMOUS_REPAIR_TURNS, MAX_IN_SESSION_SETUP_MINUTES, MAX_NEW_CONCEPTS_PER_SESSION_ADULT, MAX_NEW_CONCEPTS_PER_SESSION_K12, MasteryGate, MisconceptionEvaluator, ModelResolutionOptions, type PackingSpec, type PedagogicalModel, type PipelineExecutionProgress, PlanConstraints, type PlanOptions, type PlanResult, type PlannerLlmFn, PlanningGraph, PlanningNode, type PrefillProviderEvent, type PreliminaryResearchResult, PrerequisiteDecision, type ProduceLessonOptions, type ProduceLessonResult, type ProjectBriefingData, type ProjectClarification, type ProjectCreationPayload, type ProjectIntentAnalysisResult, ProjectStatusReport, type ProjectionMeta, QualityAuditReport, ResolvedGateSettings, type ResolvedTemplate, SATELLITE_LESSON_PRIORITIES, STUDENT_FRICTION_MULTIPLIER, type SatContextResult, type SatelliteContextInput, SessionZpdStatus, type SlashCommandDefinition, SlideBlueprintArraySchema, SlideBlueprintItemSchema, SlideDeck, type SlideEngine, type SlideProductionWorkflowOptions, type SlideProductionWorkflowResult, SmartResumeContext, type StreamAbortHandle, type StreamBudget, type StreamChunkExtractor, StreamRunnerOptions, type SymbolLedgerResult, type TemplateTranslateRunner, TranslationPolicy, type TranslationTarget, type TranslationTrigger, UnitPlan, type ValidationOptions, WalkingSkeleton, analyzeProjectCreationIntent, assembleTranslatedTemplate, assertAcyclic, assignDepths, auditQualityReport, buildArtifactPrompt, buildConceptPrerequisites, buildCurriculumContext, buildCurriculumPlan, buildDomainLexiconGuardrail, buildExpositionContext, buildExpositionExcerpt, buildHeadingDirective, buildLanguageDirective, buildLessonEntityJson, buildLessonExcerpt, buildMasteryGates, buildSatelliteContext, buildSectionAwareExcerpt, buildSessionSliceContext, buildWalkingSkeleton, checkSessionZpd, closeTruncatedJson, computeConceptSpiralProgression, computePackingSpec, conductPreliminaryResearch, createAiInferenceError, createContextMissingError, createStreamAbortSignal, createStreamChunkExtractor, detectProjectPedagogy, dropCyclicConceptEdges, emitUsage, ensureExpositionForLesson, ensureKnowledgeExposition, entityRowAssignedTo, evaluateActivityAlignment, executeCurriculumCommand, executeSlideProductionWorkflow, expositionCacheKey, extractActivityContractRows, extractAssessmentMap, extractConditionalSections, extractDeclaredLanguage, extractEchoSections, extractJsonArray, extractRequiredSections, extractScopeSequenceRows, extractSectionHeadings, extractSessionSlice, extractStreamChunk, extractSymbolLedger, extractTieredScaffoldingBlock, generatePhase1SotArtifacts, generatePhase2SotArtifacts, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSmartResumeContext, glossaryTermsForSession, ingestProjectGraphIntoProject, initializeProjectInStorage, isActivityAlignmentLogOnly, isExpositionFresh, isTranslationDue, lintCurriculumFramework, loadAuthoringTemplate, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, renderAssignedRowsTable, renderEntitySlotsForType, renderFrameworkFromPlan, resolveArtifactTemplate, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, safeParseJson, slugifyProjectName, streamLLMWithFallback, streamLayerPrefillWithFallback, stripHeadingKey, stripLlmJsonWrappers, stripTemplateFrontmatter, targetLanguageDisplayName, topoSort, translateTemplate, validateArtifactDependencies, validateHybridDeckSlides };