@thanh01.pmt/curriculum-kit 1.4.44 → 1.4.45

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 (119) hide show
  1. package/dist/ai/index.cjs.map +1 -1
  2. package/dist/ai/index.d.cts +77 -77
  3. package/dist/ai/index.d.ts +77 -77
  4. package/dist/ai/index.mjs.map +1 -1
  5. package/dist/index.cjs +362 -265
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +117 -28
  8. package/dist/index.d.ts +117 -28
  9. package/dist/index.mjs +357 -264
  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/schemas/index.d.cts +1064 -1064
  16. package/dist/schemas/index.d.ts +1064 -1064
  17. package/dist/standards/index.d.cts +2 -2
  18. package/dist/standards/index.d.ts +2 -2
  19. package/dist/{standardsCoverageGate-49pJq5t8.d.cts → standardsCoverageGate-CLnq0d0s.d.cts} +12 -12
  20. package/dist/{standardsCoverageGate-49pJq5t8.d.ts → standardsCoverageGate-CLnq0d0s.d.ts} +12 -12
  21. package/dist/templates/ACT_template.md +18 -9
  22. package/dist/templates/ALIGNMENT_MATRIX_template.md +5 -0
  23. package/dist/templates/ART_DIRECTION_template.md +7 -0
  24. package/dist/templates/ASSET_MANIFEST_template.md +5 -0
  25. package/dist/templates/BASELINE_STANDARD.md +5 -0
  26. package/dist/templates/BELL_RINGER_template.md +13 -13
  27. package/dist/templates/CHANGELOG_template.md +3 -0
  28. package/dist/templates/CHOICE_BOARD_template.md +8 -5
  29. package/dist/templates/CODE_template.md +5 -6
  30. package/dist/templates/CONTENT_CONTINUITY_template.md +6 -0
  31. package/dist/templates/CONTENT_STYLE_GUIDE_template.md +4 -5
  32. package/dist/templates/CURRICULUM_FRAMEWORK_template.md +5 -6
  33. package/dist/templates/DEPENDENCY_MAP_template.md +3 -4
  34. package/dist/templates/EXIT_TICKET_template.md +8 -8
  35. package/dist/templates/EXT_template.md +3 -0
  36. package/dist/templates/GLOSSARY_template.md +1 -2
  37. package/dist/templates/GRAPHIC_ORGANIZER_template.md +8 -8
  38. package/dist/templates/GUIDE_template.md +5 -6
  39. package/dist/templates/HANDOUT_template.md +5 -6
  40. package/dist/templates/HANDOVER_DOCUMENT_template.md +8 -0
  41. package/dist/templates/KNOWLEDGE_EXPOSITION_template.md +16 -6
  42. package/dist/templates/LAB_TEMPLATE.md +20 -3
  43. package/dist/templates/LEARNER_PROFILE_template.md +4 -5
  44. package/dist/templates/LESSONS_LEARNED_template.md +8 -0
  45. package/dist/templates/LESSON_5E_template.md +24 -9
  46. package/dist/templates/LESSON_EDP_template.md +26 -10
  47. package/dist/templates/LESSON_GENERAL_template.md +22 -8
  48. package/dist/templates/OUTPUT_CONSTRAINTS_template.md +7 -0
  49. package/dist/templates/PACKAGING_SPEC_template.md +8 -0
  50. package/dist/templates/PILOT_FEEDBACK_template.md +6 -0
  51. package/dist/templates/PROJECT_BRIEF_template.md +8 -0
  52. package/dist/templates/PROJECT_STATUS_template.md +9 -0
  53. package/dist/templates/QUIZ_template.md +7 -0
  54. package/dist/templates/QUIZ_v4.6_template.md +4 -5
  55. package/dist/templates/REFERENCE_PACK_template.md +4 -0
  56. package/dist/templates/REVIEW_GAME_template.md +11 -8
  57. package/dist/templates/RUBRIC_template.md +2 -3
  58. package/dist/templates/SCIENCE_LAB_template.md +11 -5
  59. package/dist/templates/SECTION_LANGUAGE_CONTRACT_template.md +44 -0
  60. package/dist/templates/SELF_LAB_template.md +7 -0
  61. package/dist/templates/SLIDE_template.md +23 -0
  62. package/dist/templates/STATION_ROTATION_template.md +11 -11
  63. package/dist/templates/TASK_CARDS_template.md +8 -8
  64. package/dist/templates/TIERED_PRACTICE_template.md +14 -10
  65. package/dist/templates/UPDATE_ROADMAP_template.md +7 -0
  66. package/dist/templates/WKS_template.md +5 -6
  67. package/dist/workflow/index.cjs +231 -209
  68. package/dist/workflow/index.cjs.map +1 -1
  69. package/dist/workflow/index.d.cts +1 -1
  70. package/dist/workflow/index.d.ts +1 -1
  71. package/dist/workflow/index.mjs +231 -209
  72. package/dist/workflow/index.mjs.map +1 -1
  73. package/docs/refs/templates/ACT_template.md +18 -9
  74. package/docs/refs/templates/ALIGNMENT_MATRIX_template.md +5 -0
  75. package/docs/refs/templates/ART_DIRECTION_template.md +7 -0
  76. package/docs/refs/templates/ASSET_MANIFEST_template.md +5 -0
  77. package/docs/refs/templates/BASELINE_STANDARD.md +5 -0
  78. package/docs/refs/templates/BELL_RINGER_template.md +13 -13
  79. package/docs/refs/templates/CHANGELOG_template.md +3 -0
  80. package/docs/refs/templates/CHOICE_BOARD_template.md +8 -5
  81. package/docs/refs/templates/CODE_template.md +5 -6
  82. package/docs/refs/templates/CONTENT_CONTINUITY_template.md +6 -0
  83. package/docs/refs/templates/CONTENT_STYLE_GUIDE_template.md +4 -5
  84. package/docs/refs/templates/CURRICULUM_FRAMEWORK_template.md +5 -6
  85. package/docs/refs/templates/DEPENDENCY_MAP_template.md +3 -4
  86. package/docs/refs/templates/EXIT_TICKET_template.md +8 -8
  87. package/docs/refs/templates/EXT_template.md +3 -0
  88. package/docs/refs/templates/GLOSSARY_template.md +1 -2
  89. package/docs/refs/templates/GRAPHIC_ORGANIZER_template.md +8 -8
  90. package/docs/refs/templates/GUIDE_template.md +5 -6
  91. package/docs/refs/templates/HANDOUT_template.md +5 -6
  92. package/docs/refs/templates/HANDOVER_DOCUMENT_template.md +8 -0
  93. package/docs/refs/templates/KNOWLEDGE_EXPOSITION_template.md +16 -6
  94. package/docs/refs/templates/LAB_TEMPLATE.md +20 -3
  95. package/docs/refs/templates/LEARNER_PROFILE_template.md +4 -5
  96. package/docs/refs/templates/LESSONS_LEARNED_template.md +8 -0
  97. package/docs/refs/templates/LESSON_5E_template.md +24 -9
  98. package/docs/refs/templates/LESSON_EDP_template.md +26 -10
  99. package/docs/refs/templates/LESSON_GENERAL_template.md +22 -8
  100. package/docs/refs/templates/OUTPUT_CONSTRAINTS_template.md +7 -0
  101. package/docs/refs/templates/PACKAGING_SPEC_template.md +8 -0
  102. package/docs/refs/templates/PILOT_FEEDBACK_template.md +6 -0
  103. package/docs/refs/templates/PROJECT_BRIEF_template.md +8 -0
  104. package/docs/refs/templates/PROJECT_STATUS_template.md +9 -0
  105. package/docs/refs/templates/QUIZ_template.md +7 -0
  106. package/docs/refs/templates/QUIZ_v4.6_template.md +4 -5
  107. package/docs/refs/templates/REFERENCE_PACK_template.md +4 -0
  108. package/docs/refs/templates/REVIEW_GAME_template.md +11 -8
  109. package/docs/refs/templates/RUBRIC_template.md +2 -3
  110. package/docs/refs/templates/SCIENCE_LAB_template.md +11 -5
  111. package/docs/refs/templates/SECTION_LANGUAGE_CONTRACT_template.md +44 -0
  112. package/docs/refs/templates/SELF_LAB_template.md +7 -0
  113. package/docs/refs/templates/SLIDE_template.md +23 -0
  114. package/docs/refs/templates/STATION_ROTATION_template.md +11 -11
  115. package/docs/refs/templates/TASK_CARDS_template.md +8 -8
  116. package/docs/refs/templates/TIERED_PRACTICE_template.md +14 -10
  117. package/docs/refs/templates/UPDATE_ROADMAP_template.md +7 -0
  118. package/docs/refs/templates/WKS_template.md +5 -6
  119. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -10,8 +10,8 @@ export { A as AutoRepairOptions, a as AutoRepairResult, B as BundleTier, G as Ge
10
10
  import { I as ICurriculumStorage, P as ProjectStatusReport, S as SmartResumeContext, Q as QualityAuditReport } from './types-Bgk-C4K2.cjs';
11
11
  export { b as ArtifactLifecycleInfo, A as ArtifactLifecycleState, L as LessonArtifactSummary, c as PipelineState, R as ReviewRecord, a as SotDocument, T as TaskLifecycleState } from './types-Bgk-C4K2.cjs';
12
12
  export { FileSystemCurriculumAdapter, FileSystemStorageOptions, STANDARD_SOT_FILES, StorageFactoryOptions, SupabaseCurriculumAdapter, SupabaseStorageConfig, atomicWriteFileSync, computeContentHash, createCurriculumStorage } from './storage/index.cjs';
13
- import { F as FrameworkPack, C as CoverageGateReport } from './standardsCoverageGate-49pJq5t8.cjs';
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';
13
+ import { F as FrameworkPack, C as CoverageGateReport } from './standardsCoverageGate-CLnq0d0s.cjs';
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-CLnq0d0s.cjs';
15
15
  import { z } from 'zod';
16
16
  import { R as ResolvedGateSettings } from './gateSettings-oo5tCUS_.cjs';
17
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';
@@ -249,16 +249,16 @@ declare const LessonEntitySchema: z.ZodObject<{
249
249
  conceptRefs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
250
250
  }, "strip", z.ZodTypeAny, {
251
251
  code: string;
252
- objective: string;
253
- evidence: string;
254
252
  successCriteria: string;
255
253
  standardRefs: string[];
256
254
  conceptRefs: string[];
255
+ objective: string;
256
+ evidence: string;
257
257
  }, {
258
258
  code: string;
259
+ successCriteria: string;
259
260
  objective: string;
260
261
  evidence: string;
261
- successCriteria: string;
262
262
  standardRefs?: string[] | undefined;
263
263
  conceptRefs?: string[] | undefined;
264
264
  }>, "many">>;
@@ -275,6 +275,7 @@ declare const LessonEntitySchema: z.ZodObject<{
275
275
  durationMinutes: z.ZodDefault<z.ZodNumber>;
276
276
  artifactContract: z.ZodString;
277
277
  }, "strip", z.ZodTypeAny, {
278
+ durationMinutes: number;
278
279
  seq: number;
279
280
  phase: string;
280
281
  activityType: string;
@@ -284,7 +285,6 @@ declare const LessonEntitySchema: z.ZodObject<{
284
285
  teacherMove: string;
285
286
  outputEvidence: string;
286
287
  lo: string[];
287
- durationMinutes: number;
288
288
  artifactContract: string;
289
289
  }, {
290
290
  seq: number;
@@ -317,16 +317,17 @@ declare const LessonEntitySchema: z.ZodObject<{
317
317
  }, "strip", z.ZodTypeAny, {
318
318
  lessonId: string;
319
319
  title: string;
320
- estimatedDuration: string;
321
320
  learningObjectives: {
322
321
  code: string;
323
- objective: string;
324
- evidence: string;
325
322
  successCriteria: string;
326
323
  standardRefs: string[];
327
324
  conceptRefs: string[];
325
+ objective: string;
326
+ evidence: string;
328
327
  }[];
328
+ estimatedDuration: string;
329
329
  activitySequence: {
330
+ durationMinutes: number;
330
331
  seq: number;
331
332
  phase: string;
332
333
  activityType: string;
@@ -336,7 +337,6 @@ declare const LessonEntitySchema: z.ZodObject<{
336
337
  teacherMove: string;
337
338
  outputEvidence: string;
338
339
  lo: string[];
339
- durationMinutes: number;
340
340
  artifactContract: string;
341
341
  }[];
342
342
  assessmentMap: Record<string, string>[];
@@ -349,15 +349,15 @@ declare const LessonEntitySchema: z.ZodObject<{
349
349
  }, {
350
350
  lessonId: string;
351
351
  title: string;
352
- estimatedDuration?: string | undefined;
353
352
  learningObjectives?: {
354
353
  code: string;
354
+ successCriteria: string;
355
355
  objective: string;
356
356
  evidence: string;
357
- successCriteria: string;
358
357
  standardRefs?: string[] | undefined;
359
358
  conceptRefs?: string[] | undefined;
360
359
  }[] | undefined;
360
+ estimatedDuration?: string | undefined;
361
361
  activitySequence?: {
362
362
  seq: number;
363
363
  phase: string;
@@ -493,7 +493,7 @@ interface ActivityAlignmentResult {
493
493
  declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined, generatedContent: string, now?: Date): ActivityAlignmentResult;
494
494
 
495
495
  /**
496
- * P52 — Runtime artifact-template loading (single source of truth).
496
+ * P52/P53 — Runtime artifact-template loading (single source of truth).
497
497
  *
498
498
  * Restores the curriculum-mcp architecture that was lost when prompt
499
499
  * skeletons were retyped as hardcoded strings inside
@@ -502,20 +502,46 @@ declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined,
502
502
  * - methodology directives stay in the prompt-builder;
503
503
  * - project-local `_templates/` may override any template (MCP parity).
504
504
  *
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.
505
+ * P53 rev3 (echo model): a template file = YAML frontmatter (system-owned
506
+ * cached echo: `template_language`, `template_required_sections`) + fill-in
507
+ * body. The BODY headings are the single source of structure — the
508
+ * frontmatter list is regenerated mechanically (assembleTranslatedTemplate /
509
+ * editor save), never hand-maintained.
510
+ *
511
+ * Heading standard (H1–H3 only; H4+ do not exist):
512
+ * - every heading is REQUIRED by default → the `[REQUIRED]` marker is
513
+ * stripped everywhere (bundled + baked + generated artifacts);
514
+ * - `[OPTIONAL]` → still a heading, but excluded from the echo/contract;
515
+ * - `[CONDITIONAL]` → required echo + exposed as semantic metadata;
516
+ * - a heading containing a VARIABLE part (`{{placeholder}}` or bracket
517
+ * `[guidance]`) is not a section at all — it is an instance/guidance
518
+ * header (Q1, Challenge 1, Term Name, phase timing) → excluded from the
519
+ * echo. Static durations belong on a `**Duration:**` line under the
520
+ * heading, never inside it.
508
521
  */
509
522
  interface ResolvedTemplate {
510
523
  /** Fill-in body (frontmatter + leading HTML comments stripped). */
511
524
  content: string;
512
525
  /**
513
- * Canonical section contract: template frontmatter
514
- * `template_required_sections` when declared, else normalized H2 headings.
526
+ * P53 rev3 mechanical echo of the template BODY headings (H2/H3, static
527
+ * text only, `[OPTIONAL]` excluded, markers/ordinals stripped). This IS the
528
+ * contract; the frontmatter list is just its cached copy.
515
529
  */
516
530
  sections: string[];
531
+ /** Headings explicitly marked `[OPTIONAL]` (excluded from `sections`). */
532
+ optionalSections: string[];
517
533
  /** Absolute path the template was loaded from (telemetry / debugging). */
518
534
  sourcePath: string;
535
+ /**
536
+ * P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body.
537
+ */
538
+ conditionals: string[];
539
+ /**
540
+ * P53 — declared authoring language of the template body
541
+ * (`template_language:` frontmatter, default "en"). "en" = bundled source;
542
+ * anything else = translated project copy (bake-aware regime downstream).
543
+ */
544
+ declaredLang: string;
519
545
  }
520
546
  /**
521
547
  * Strip YAML frontmatter from a template document.
@@ -525,13 +551,30 @@ interface ResolvedTemplate {
525
551
  */
526
552
  declare function stripTemplateFrontmatter(raw: string): string;
527
553
  /**
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.
554
+ * Legacy reader for the `template_required_sections:` YAML list (the cached
555
+ * echo). Kept for app-side consumers reading artifact frontmatter; the kit
556
+ * itself now derives structure from the body (extractEchoSections).
531
557
  */
532
558
  declare function extractRequiredSections(raw: string): string[] | null;
533
- /** H2 headings of the template body (frontmatter-stripped), normalized. */
534
- declare function extractBodySections(raw: string): string[];
559
+ /**
560
+ * P53 — canonical heading key: strips contract markers AND ordinal prefixes
561
+ * so `### 1. Learning Objectives & Evidence` and `1) Learning Objectives…`
562
+ * both normalize to the same key. Users may renumber headings without
563
+ * breaking matching.
564
+ */
565
+ declare function stripHeadingKey(h: string): string;
566
+ /**
567
+ * P53 rev3 — the contract echo of a template/artifact document: required
568
+ * sections (default) and explicitly-optional ones, straight from the body.
569
+ */
570
+ declare function extractEchoSections(raw: string): {
571
+ required: string[];
572
+ optional: string[];
573
+ };
574
+ /** P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body. */
575
+ declare function extractConditionalSections(raw: string): string[];
576
+ /** P53 — `template_language:` frontmatter value (default "en"). */
577
+ declare function extractDeclaredLanguage(raw: string): string;
535
578
  /**
536
579
  * Resolve a canonical template by file name. First existing candidate wins:
537
580
  * explicit dir → CURRICULUM_TEMPLATES_DIR → <cwd>/_templates → packaged
@@ -541,6 +584,42 @@ declare function extractBodySections(raw: string): string[];
541
584
  declare function resolveArtifactTemplate(templateName: string, opts?: {
542
585
  templatesDir?: string;
543
586
  }): ResolvedTemplate | null;
587
+ /** AI runner contract for template translation (injected — kit stays provider-agnostic). */
588
+ type TemplateTranslateRunner = (prompt: string) => Promise<string>;
589
+ interface AssembledTemplate {
590
+ /** Full document: REGENERATED frontmatter echo + translated body. */
591
+ raw: string;
592
+ /** Contract echo of the translated body (= the regenerated FM list). */
593
+ sections: string[];
594
+ templateLanguage: string;
595
+ }
596
+ /**
597
+ * P53 rev3 — assemble a project template copy from an AI-translated BODY.
598
+ * The frontmatter is never AI-edited: it is regenerated mechanically —
599
+ * `template_language` stamp + `template_required_sections` echoed from the
600
+ * translated headings (the body is the single source; the FM list follows it).
601
+ *
602
+ * Structural verification: heading count, order, and levels must survive
603
+ * translation 1:1 (required AND optional). Any drift → null; the caller
604
+ * falls back to the bundled English template rather than shipping a broken
605
+ * contract. `{{placeholder}}` / marker preservation is verified here too.
606
+ */
607
+ declare function assembleTranslatedTemplate(templateName: string, translatedBody: string, targetLanguage: string, opts?: {
608
+ templatesDir?: string;
609
+ }): AssembledTemplate | null;
610
+ /**
611
+ * P53 — full-body template translation (AI, once per language + content hash;
612
+ * caching is the caller's job). The kit stays language-neutral: bundled
613
+ * templates are never translated in-repo.
614
+ *
615
+ * Pipeline: split frontmatter (never sent to AI) → prompt the runner with
616
+ * preservation rules → assembleTranslatedTemplate regenerates the frontmatter
617
+ * echo and structurally verifies the result. Returns null on any violation;
618
+ * the caller falls back to the bundled English template.
619
+ */
620
+ declare function translateTemplate(templateName: string, targetLanguage: string, runner: TemplateTranslateRunner, opts?: {
621
+ templatesDir?: string;
622
+ }): Promise<AssembledTemplate | null>;
544
623
  /**
545
624
  * Legacy raw-content lookup retained for existing callers
546
625
  * (`singleArtifactService`, SLIDE workflow). Returns the file verbatim —
@@ -1241,12 +1320,22 @@ declare function isTranslationDue(target: TranslationTarget, context: {
1241
1320
  declare function resolveTargetLanguageCode(language?: string | null): string;
1242
1321
  declare function targetLanguageDisplayName(code: string): string;
1243
1322
  declare function buildLanguageDirective(targetLanguage?: string | null): string;
1244
- declare const DEFAULT_VIETNAMESE_SECTION_HEADINGS: Record<string, Record<string, string>>;
1245
1323
  declare function extractSectionHeadingsFromSLC(slcInput: Record<string, Record<string, string>> | string | undefined | null, artifactType: string, targetLanguage?: string): Record<string, string>;
1246
1324
  /**
1247
- * Builds the heading directive block to instruct LLM on verbatim section headings.
1248
- */
1249
- declare function buildHeadingDirective(artifactType: string, slcMarkdown?: Record<string, Record<string, string>> | string | null, targetLanguage?: string): string;
1325
+ * Builds the heading directive block to instruct the LLM on section headings.
1326
+ *
1327
+ * P53 rev3 one regime only: the resolved template's ECHO is the source.
1328
+ * - Translated project copy (declaredLang ≠ "en"): headings are already the
1329
+ * display strings → identity mapping, "use verbatim".
1330
+ * - Bundled English template: echo = English headings; the legacy SLC
1331
+ * (old projects) may still supply localized display labels, intersected
1332
+ * against the echo so stale entries are dropped.
1333
+ * The frontmatter list is system-owned (it IS the echo), so the directive
1334
+ * tells the LLM to copy it verbatim — never to translate or invent entries.
1335
+ */
1336
+ declare function buildHeadingDirective(artifactType: string, slcMarkdown?: Record<string, Record<string, string>> | string | null, targetLanguage?: string, opts?: {
1337
+ templatesDir?: string;
1338
+ }): string;
1250
1339
 
1251
1340
  /**
1252
1341
  * Curriculum OS - Standardized Error Taxonomy & Traceability System
@@ -1793,4 +1882,4 @@ declare class MisconceptionEvaluator {
1793
1882
  static evaluateQuiz(quiz: DiagnosticQuiz): DimensionScore;
1794
1883
  }
1795
1884
 
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 };
1885
+ 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, 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, stripHeadingKey, stripLlmJsonWrappers, stripTemplateFrontmatter, targetLanguageDisplayName, topoSort, translateTemplate, validateArtifactDependencies, validateHybridDeckSlides };
package/dist/index.d.ts CHANGED
@@ -10,8 +10,8 @@ export { A as AutoRepairOptions, a as AutoRepairResult, B as BundleTier, G as Ge
10
10
  import { I as ICurriculumStorage, P as ProjectStatusReport, S as SmartResumeContext, Q as QualityAuditReport } from './types-Bgk-C4K2.js';
11
11
  export { b as ArtifactLifecycleInfo, A as ArtifactLifecycleState, L as LessonArtifactSummary, c as PipelineState, R as ReviewRecord, a as SotDocument, T as TaskLifecycleState } from './types-Bgk-C4K2.js';
12
12
  export { FileSystemCurriculumAdapter, FileSystemStorageOptions, STANDARD_SOT_FILES, StorageFactoryOptions, SupabaseCurriculumAdapter, SupabaseStorageConfig, atomicWriteFileSync, computeContentHash, createCurriculumStorage } from './storage/index.js';
13
- import { F as FrameworkPack, C as CoverageGateReport } from './standardsCoverageGate-49pJq5t8.js';
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';
13
+ import { F as FrameworkPack, C as CoverageGateReport } from './standardsCoverageGate-CLnq0d0s.js';
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-CLnq0d0s.js';
15
15
  import { z } from 'zod';
16
16
  import { R as ResolvedGateSettings } from './gateSettings-oo5tCUS_.js';
17
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';
@@ -249,16 +249,16 @@ declare const LessonEntitySchema: z.ZodObject<{
249
249
  conceptRefs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
250
250
  }, "strip", z.ZodTypeAny, {
251
251
  code: string;
252
- objective: string;
253
- evidence: string;
254
252
  successCriteria: string;
255
253
  standardRefs: string[];
256
254
  conceptRefs: string[];
255
+ objective: string;
256
+ evidence: string;
257
257
  }, {
258
258
  code: string;
259
+ successCriteria: string;
259
260
  objective: string;
260
261
  evidence: string;
261
- successCriteria: string;
262
262
  standardRefs?: string[] | undefined;
263
263
  conceptRefs?: string[] | undefined;
264
264
  }>, "many">>;
@@ -275,6 +275,7 @@ declare const LessonEntitySchema: z.ZodObject<{
275
275
  durationMinutes: z.ZodDefault<z.ZodNumber>;
276
276
  artifactContract: z.ZodString;
277
277
  }, "strip", z.ZodTypeAny, {
278
+ durationMinutes: number;
278
279
  seq: number;
279
280
  phase: string;
280
281
  activityType: string;
@@ -284,7 +285,6 @@ declare const LessonEntitySchema: z.ZodObject<{
284
285
  teacherMove: string;
285
286
  outputEvidence: string;
286
287
  lo: string[];
287
- durationMinutes: number;
288
288
  artifactContract: string;
289
289
  }, {
290
290
  seq: number;
@@ -317,16 +317,17 @@ declare const LessonEntitySchema: z.ZodObject<{
317
317
  }, "strip", z.ZodTypeAny, {
318
318
  lessonId: string;
319
319
  title: string;
320
- estimatedDuration: string;
321
320
  learningObjectives: {
322
321
  code: string;
323
- objective: string;
324
- evidence: string;
325
322
  successCriteria: string;
326
323
  standardRefs: string[];
327
324
  conceptRefs: string[];
325
+ objective: string;
326
+ evidence: string;
328
327
  }[];
328
+ estimatedDuration: string;
329
329
  activitySequence: {
330
+ durationMinutes: number;
330
331
  seq: number;
331
332
  phase: string;
332
333
  activityType: string;
@@ -336,7 +337,6 @@ declare const LessonEntitySchema: z.ZodObject<{
336
337
  teacherMove: string;
337
338
  outputEvidence: string;
338
339
  lo: string[];
339
- durationMinutes: number;
340
340
  artifactContract: string;
341
341
  }[];
342
342
  assessmentMap: Record<string, string>[];
@@ -349,15 +349,15 @@ declare const LessonEntitySchema: z.ZodObject<{
349
349
  }, {
350
350
  lessonId: string;
351
351
  title: string;
352
- estimatedDuration?: string | undefined;
353
352
  learningObjectives?: {
354
353
  code: string;
354
+ successCriteria: string;
355
355
  objective: string;
356
356
  evidence: string;
357
- successCriteria: string;
358
357
  standardRefs?: string[] | undefined;
359
358
  conceptRefs?: string[] | undefined;
360
359
  }[] | undefined;
360
+ estimatedDuration?: string | undefined;
361
361
  activitySequence?: {
362
362
  seq: number;
363
363
  phase: string;
@@ -493,7 +493,7 @@ interface ActivityAlignmentResult {
493
493
  declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined, generatedContent: string, now?: Date): ActivityAlignmentResult;
494
494
 
495
495
  /**
496
- * P52 — Runtime artifact-template loading (single source of truth).
496
+ * P52/P53 — Runtime artifact-template loading (single source of truth).
497
497
  *
498
498
  * Restores the curriculum-mcp architecture that was lost when prompt
499
499
  * skeletons were retyped as hardcoded strings inside
@@ -502,20 +502,46 @@ declare function evaluateActivityAlignment(canonicalExcerpt: string | undefined,
502
502
  * - methodology directives stay in the prompt-builder;
503
503
  * - project-local `_templates/` may override any template (MCP parity).
504
504
  *
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.
505
+ * P53 rev3 (echo model): a template file = YAML frontmatter (system-owned
506
+ * cached echo: `template_language`, `template_required_sections`) + fill-in
507
+ * body. The BODY headings are the single source of structure — the
508
+ * frontmatter list is regenerated mechanically (assembleTranslatedTemplate /
509
+ * editor save), never hand-maintained.
510
+ *
511
+ * Heading standard (H1–H3 only; H4+ do not exist):
512
+ * - every heading is REQUIRED by default → the `[REQUIRED]` marker is
513
+ * stripped everywhere (bundled + baked + generated artifacts);
514
+ * - `[OPTIONAL]` → still a heading, but excluded from the echo/contract;
515
+ * - `[CONDITIONAL]` → required echo + exposed as semantic metadata;
516
+ * - a heading containing a VARIABLE part (`{{placeholder}}` or bracket
517
+ * `[guidance]`) is not a section at all — it is an instance/guidance
518
+ * header (Q1, Challenge 1, Term Name, phase timing) → excluded from the
519
+ * echo. Static durations belong on a `**Duration:**` line under the
520
+ * heading, never inside it.
508
521
  */
509
522
  interface ResolvedTemplate {
510
523
  /** Fill-in body (frontmatter + leading HTML comments stripped). */
511
524
  content: string;
512
525
  /**
513
- * Canonical section contract: template frontmatter
514
- * `template_required_sections` when declared, else normalized H2 headings.
526
+ * P53 rev3 mechanical echo of the template BODY headings (H2/H3, static
527
+ * text only, `[OPTIONAL]` excluded, markers/ordinals stripped). This IS the
528
+ * contract; the frontmatter list is just its cached copy.
515
529
  */
516
530
  sections: string[];
531
+ /** Headings explicitly marked `[OPTIONAL]` (excluded from `sections`). */
532
+ optionalSections: string[];
517
533
  /** Absolute path the template was loaded from (telemetry / debugging). */
518
534
  sourcePath: string;
535
+ /**
536
+ * P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body.
537
+ */
538
+ conditionals: string[];
539
+ /**
540
+ * P53 — declared authoring language of the template body
541
+ * (`template_language:` frontmatter, default "en"). "en" = bundled source;
542
+ * anything else = translated project copy (bake-aware regime downstream).
543
+ */
544
+ declaredLang: string;
519
545
  }
520
546
  /**
521
547
  * Strip YAML frontmatter from a template document.
@@ -525,13 +551,30 @@ interface ResolvedTemplate {
525
551
  */
526
552
  declare function stripTemplateFrontmatter(raw: string): string;
527
553
  /**
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.
554
+ * Legacy reader for the `template_required_sections:` YAML list (the cached
555
+ * echo). Kept for app-side consumers reading artifact frontmatter; the kit
556
+ * itself now derives structure from the body (extractEchoSections).
531
557
  */
532
558
  declare function extractRequiredSections(raw: string): string[] | null;
533
- /** H2 headings of the template body (frontmatter-stripped), normalized. */
534
- declare function extractBodySections(raw: string): string[];
559
+ /**
560
+ * P53 — canonical heading key: strips contract markers AND ordinal prefixes
561
+ * so `### 1. Learning Objectives & Evidence` and `1) Learning Objectives…`
562
+ * both normalize to the same key. Users may renumber headings without
563
+ * breaking matching.
564
+ */
565
+ declare function stripHeadingKey(h: string): string;
566
+ /**
567
+ * P53 rev3 — the contract echo of a template/artifact document: required
568
+ * sections (default) and explicitly-optional ones, straight from the body.
569
+ */
570
+ declare function extractEchoSections(raw: string): {
571
+ required: string[];
572
+ optional: string[];
573
+ };
574
+ /** P53 — canonical sections carrying a `[CONDITIONAL]` marker in the body. */
575
+ declare function extractConditionalSections(raw: string): string[];
576
+ /** P53 — `template_language:` frontmatter value (default "en"). */
577
+ declare function extractDeclaredLanguage(raw: string): string;
535
578
  /**
536
579
  * Resolve a canonical template by file name. First existing candidate wins:
537
580
  * explicit dir → CURRICULUM_TEMPLATES_DIR → <cwd>/_templates → packaged
@@ -541,6 +584,42 @@ declare function extractBodySections(raw: string): string[];
541
584
  declare function resolveArtifactTemplate(templateName: string, opts?: {
542
585
  templatesDir?: string;
543
586
  }): ResolvedTemplate | null;
587
+ /** AI runner contract for template translation (injected — kit stays provider-agnostic). */
588
+ type TemplateTranslateRunner = (prompt: string) => Promise<string>;
589
+ interface AssembledTemplate {
590
+ /** Full document: REGENERATED frontmatter echo + translated body. */
591
+ raw: string;
592
+ /** Contract echo of the translated body (= the regenerated FM list). */
593
+ sections: string[];
594
+ templateLanguage: string;
595
+ }
596
+ /**
597
+ * P53 rev3 — assemble a project template copy from an AI-translated BODY.
598
+ * The frontmatter is never AI-edited: it is regenerated mechanically —
599
+ * `template_language` stamp + `template_required_sections` echoed from the
600
+ * translated headings (the body is the single source; the FM list follows it).
601
+ *
602
+ * Structural verification: heading count, order, and levels must survive
603
+ * translation 1:1 (required AND optional). Any drift → null; the caller
604
+ * falls back to the bundled English template rather than shipping a broken
605
+ * contract. `{{placeholder}}` / marker preservation is verified here too.
606
+ */
607
+ declare function assembleTranslatedTemplate(templateName: string, translatedBody: string, targetLanguage: string, opts?: {
608
+ templatesDir?: string;
609
+ }): AssembledTemplate | null;
610
+ /**
611
+ * P53 — full-body template translation (AI, once per language + content hash;
612
+ * caching is the caller's job). The kit stays language-neutral: bundled
613
+ * templates are never translated in-repo.
614
+ *
615
+ * Pipeline: split frontmatter (never sent to AI) → prompt the runner with
616
+ * preservation rules → assembleTranslatedTemplate regenerates the frontmatter
617
+ * echo and structurally verifies the result. Returns null on any violation;
618
+ * the caller falls back to the bundled English template.
619
+ */
620
+ declare function translateTemplate(templateName: string, targetLanguage: string, runner: TemplateTranslateRunner, opts?: {
621
+ templatesDir?: string;
622
+ }): Promise<AssembledTemplate | null>;
544
623
  /**
545
624
  * Legacy raw-content lookup retained for existing callers
546
625
  * (`singleArtifactService`, SLIDE workflow). Returns the file verbatim —
@@ -1241,12 +1320,22 @@ declare function isTranslationDue(target: TranslationTarget, context: {
1241
1320
  declare function resolveTargetLanguageCode(language?: string | null): string;
1242
1321
  declare function targetLanguageDisplayName(code: string): string;
1243
1322
  declare function buildLanguageDirective(targetLanguage?: string | null): string;
1244
- declare const DEFAULT_VIETNAMESE_SECTION_HEADINGS: Record<string, Record<string, string>>;
1245
1323
  declare function extractSectionHeadingsFromSLC(slcInput: Record<string, Record<string, string>> | string | undefined | null, artifactType: string, targetLanguage?: string): Record<string, string>;
1246
1324
  /**
1247
- * Builds the heading directive block to instruct LLM on verbatim section headings.
1248
- */
1249
- declare function buildHeadingDirective(artifactType: string, slcMarkdown?: Record<string, Record<string, string>> | string | null, targetLanguage?: string): string;
1325
+ * Builds the heading directive block to instruct the LLM on section headings.
1326
+ *
1327
+ * P53 rev3 one regime only: the resolved template's ECHO is the source.
1328
+ * - Translated project copy (declaredLang ≠ "en"): headings are already the
1329
+ * display strings → identity mapping, "use verbatim".
1330
+ * - Bundled English template: echo = English headings; the legacy SLC
1331
+ * (old projects) may still supply localized display labels, intersected
1332
+ * against the echo so stale entries are dropped.
1333
+ * The frontmatter list is system-owned (it IS the echo), so the directive
1334
+ * tells the LLM to copy it verbatim — never to translate or invent entries.
1335
+ */
1336
+ declare function buildHeadingDirective(artifactType: string, slcMarkdown?: Record<string, Record<string, string>> | string | null, targetLanguage?: string, opts?: {
1337
+ templatesDir?: string;
1338
+ }): string;
1250
1339
 
1251
1340
  /**
1252
1341
  * Curriculum OS - Standardized Error Taxonomy & Traceability System
@@ -1793,4 +1882,4 @@ declare class MisconceptionEvaluator {
1793
1882
  static evaluateQuiz(quiz: DiagnosticQuiz): DimensionScore;
1794
1883
  }
1795
1884
 
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 };
1885
+ 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, 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, stripHeadingKey, stripLlmJsonWrappers, stripTemplateFrontmatter, targetLanguageDisplayName, topoSort, translateTemplate, validateArtifactDependencies, validateHybridDeckSlides };