@thanh01.pmt/curriculum-kit 1.4.18 → 1.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{gateSettings-L3FR2-MO.d.cts → gateSettings-DabOqP6_.d.cts} +94 -1
- package/dist/{gateSettings-L3FR2-MO.d.ts → gateSettings-DabOqP6_.d.ts} +94 -1
- package/dist/index.cjs +751 -145
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +248 -124
- package/dist/index.d.ts +248 -124
- package/dist/index.mjs +747 -147
- package/dist/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +280 -8
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.d.cts +2 -2
- package/dist/workflow/index.d.ts +2 -2
- package/dist/workflow/index.mjs +280 -8
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +23 -22
- package/LICENSE +0 -21
package/dist/index.cjs
CHANGED
|
@@ -1597,10 +1597,91 @@ var slideProductionWorkflow_exports = {};
|
|
|
1597
1597
|
__export(slideProductionWorkflow_exports, {
|
|
1598
1598
|
GeneratedSlideArraySchema: () => exports.GeneratedSlideArraySchema,
|
|
1599
1599
|
GeneratedSlideSchema: () => exports.GeneratedSlideSchema,
|
|
1600
|
+
HybridBlueprintArraySchema: () => exports.HybridBlueprintArraySchema,
|
|
1601
|
+
HybridBlueprintItemSchema: () => exports.HybridBlueprintItemSchema,
|
|
1602
|
+
HybridDeckSlideArraySchema: () => exports.HybridDeckSlideArraySchema,
|
|
1603
|
+
HybridDeckSlideSchema: () => exports.HybridDeckSlideSchema,
|
|
1604
|
+
HybridPipelineError: () => exports.HybridPipelineError,
|
|
1600
1605
|
SlideBlueprintArraySchema: () => exports.SlideBlueprintArraySchema,
|
|
1601
1606
|
SlideBlueprintItemSchema: () => exports.SlideBlueprintItemSchema,
|
|
1602
|
-
executeSlideProductionWorkflow: () => executeSlideProductionWorkflow
|
|
1607
|
+
executeSlideProductionWorkflow: () => executeSlideProductionWorkflow,
|
|
1608
|
+
extractJsonArray: () => extractJsonArray,
|
|
1609
|
+
validateHybridDeckSlides: () => validateHybridDeckSlides
|
|
1603
1610
|
});
|
|
1611
|
+
function extractJsonArray(raw) {
|
|
1612
|
+
if (!raw) return { error: "empty response" };
|
|
1613
|
+
let text = raw.replace(/<think>[\s\S]*?<\/think>/gi, "").trim();
|
|
1614
|
+
text = text.replace(/^```(?:json)?\s*/m, "").replace(/```\s*$/m, "").trim();
|
|
1615
|
+
const start = text.indexOf("[");
|
|
1616
|
+
const end = text.lastIndexOf("]");
|
|
1617
|
+
if (start < 0 || end <= start) {
|
|
1618
|
+
return {
|
|
1619
|
+
error: "no JSON array span found",
|
|
1620
|
+
head: text.slice(0, 300),
|
|
1621
|
+
tail: text.slice(-300)
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
const span = text.slice(start, end + 1);
|
|
1625
|
+
try {
|
|
1626
|
+
return { value: JSON.parse(span) };
|
|
1627
|
+
} catch {
|
|
1628
|
+
}
|
|
1629
|
+
try {
|
|
1630
|
+
return { value: JSON.parse(jsonrepair.jsonrepair(span)) };
|
|
1631
|
+
} catch (e) {
|
|
1632
|
+
return {
|
|
1633
|
+
error: "JSON.parse/jsonrepair failed: " + String(e?.message || e).slice(0, 120),
|
|
1634
|
+
head: text.slice(0, 300),
|
|
1635
|
+
tail: text.slice(-300)
|
|
1636
|
+
};
|
|
1637
|
+
}
|
|
1638
|
+
}
|
|
1639
|
+
function validateHybridDeckSlides(slides, blueprint) {
|
|
1640
|
+
const v = [];
|
|
1641
|
+
if (blueprint.length > 0 && slides.length !== blueprint.length) {
|
|
1642
|
+
v.push(`slide count mismatch: got ${slides.length}, blueprint requires ${blueprint.length}`);
|
|
1643
|
+
}
|
|
1644
|
+
slides.forEach((s, i) => {
|
|
1645
|
+
const n = i + 1;
|
|
1646
|
+
const title = typeof s?.title === "string" ? s.title : "";
|
|
1647
|
+
if (!title.trim()) v.push(`slide ${n}: missing/empty title`);
|
|
1648
|
+
else if (title.length > 150) v.push(`slide ${n}: title too long (${title.length} chars, max 150) \u2014 repetition-loop guard`);
|
|
1649
|
+
const notes = typeof s?.notes === "string" ? s.notes.trim() : "";
|
|
1650
|
+
if (notes.length < 80) v.push(`slide ${n}: presenter notes missing or too short (${notes.length} chars, min 80)`);
|
|
1651
|
+
const code = s?.slots?.code;
|
|
1652
|
+
if (typeof code === "string") {
|
|
1653
|
+
if (code.length > 6e3) v.push(`slide ${n}: code block too long (${code.length} chars, max 6000)`);
|
|
1654
|
+
if (/\/\/\s*TODO|<CODE>|your code here/i.test(code)) v.push(`slide ${n}: placeholder code detected (TODO/<CODE>)`);
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
return v.slice(0, 10);
|
|
1658
|
+
}
|
|
1659
|
+
async function inferTextJson(schema, systemPrompt, userPrompt, options, label) {
|
|
1660
|
+
const model = getAIModel(options.modelOptions);
|
|
1661
|
+
try {
|
|
1662
|
+
const { text, finishReason } = await ai.generateText({
|
|
1663
|
+
model,
|
|
1664
|
+
system: systemPrompt || void 0,
|
|
1665
|
+
prompt: userPrompt,
|
|
1666
|
+
maxOutputTokens: options.maxOutputTokens ?? 65536
|
|
1667
|
+
});
|
|
1668
|
+
const extracted = extractJsonArray(text);
|
|
1669
|
+
if (!("value" in extracted) || extracted.value === void 0) {
|
|
1670
|
+
console.warn(
|
|
1671
|
+
`[SlideProductionWorkflow] ${label}: JSON extraction failed (${extracted.error}); finish=${finishReason}`,
|
|
1672
|
+
extracted.head ? `head=${String(extracted.head).slice(0, 150)}` : ""
|
|
1673
|
+
);
|
|
1674
|
+
return null;
|
|
1675
|
+
}
|
|
1676
|
+
const validated = schema.safeParse(extracted.value);
|
|
1677
|
+
if (validated.success) return validated.data;
|
|
1678
|
+
console.warn(`[SlideProductionWorkflow] ${label}: output failed schema validation:`, validated.error?.message);
|
|
1679
|
+
return null;
|
|
1680
|
+
} catch (err) {
|
|
1681
|
+
console.warn(`[SlideProductionWorkflow] ${label}: generateText failed:`, err?.message || err);
|
|
1682
|
+
return null;
|
|
1683
|
+
}
|
|
1684
|
+
}
|
|
1604
1685
|
async function inferStructured(schema, systemPrompt, userPrompt, options, label) {
|
|
1605
1686
|
try {
|
|
1606
1687
|
const model = getAIModel(options.modelOptions);
|
|
@@ -1642,9 +1723,142 @@ async function inferStructured(schema, systemPrompt, userPrompt, options, label)
|
|
|
1642
1723
|
return null;
|
|
1643
1724
|
}
|
|
1644
1725
|
}
|
|
1726
|
+
function normalizeBlueprintItems(items) {
|
|
1727
|
+
return items.sort((a, b) => (a.slideIndex ?? 0) - (b.slideIndex ?? 0)).map((item, idx) => ({
|
|
1728
|
+
slideIndex: idx + 1,
|
|
1729
|
+
clusterId: item.clusterId ?? Math.floor(idx / 5) + 1,
|
|
1730
|
+
clusterTitle: item.clusterTitle || "Cluster",
|
|
1731
|
+
lessonPhase: item.lessonPhase || "Content",
|
|
1732
|
+
layoutId: item.layoutId,
|
|
1733
|
+
title: item.title,
|
|
1734
|
+
pedagogicalGoal: item.pedagogicalGoal || "",
|
|
1735
|
+
contentFocus: item.contentFocus || [],
|
|
1736
|
+
codeSnippetIntent: item.codeSnippetIntent ?? void 0,
|
|
1737
|
+
visualIntent: item.visualIntent ?? void 0
|
|
1738
|
+
}));
|
|
1739
|
+
}
|
|
1740
|
+
function buildHybridDeckPrompts(params) {
|
|
1741
|
+
const { lessonFlow, blueprint, skillPrompt, language, languageDirective, headingDirective } = params;
|
|
1742
|
+
const blueprintText = JSON.stringify(
|
|
1743
|
+
blueprint.map((s) => ({
|
|
1744
|
+
slideIndex: s.slideIndex,
|
|
1745
|
+
lessonPhase: s.lessonPhase,
|
|
1746
|
+
layoutId: s.layoutId,
|
|
1747
|
+
title: s.title,
|
|
1748
|
+
pedagogicalGoal: s.pedagogicalGoal,
|
|
1749
|
+
contentFocus: s.contentFocus,
|
|
1750
|
+
codeSnippetIntent: s.codeSnippetIntent ?? void 0,
|
|
1751
|
+
visualIntent: s.visualIntent ?? void 0
|
|
1752
|
+
})),
|
|
1753
|
+
null,
|
|
1754
|
+
1
|
|
1755
|
+
);
|
|
1756
|
+
const phasesContent = lessonFlow.phases.length > 0 ? lessonFlow.phases.map((p) => `### ${p.phaseName}
|
|
1757
|
+
${p.content}`).join("\n\n") : lessonFlow.rawContent;
|
|
1758
|
+
const systemPrompt = [
|
|
1759
|
+
skillPrompt,
|
|
1760
|
+
languageDirective,
|
|
1761
|
+
headingDirective,
|
|
1762
|
+
`
|
|
1763
|
+
### OPERATIONAL GROUND RULES (FULL-DECK AUTHORING):
|
|
1764
|
+
1. **EXACT COUNT: author EXACTLY ${blueprint.length} slide objects \u2014 ONE per blueprint item, SAME ORDER, SAME layoutId.** Do NOT merge, skip, reorder, or add slides.
|
|
1765
|
+
2. **ZERO ABBREVIATION / NO "// TODO"**: All code snippets MUST be real, fully authored, compilable code relevant to "${lessonFlow.lessonTitle}". Never write placeholders, stubs, or "<CODE>".
|
|
1766
|
+
3. **MANDATORY 3-PART PRESENTER NOTES ON EVERY SLIDE (120+ chars)**: SCRIPT (60-90s spoken talk track with an intuitive analogy), COLD CALL / CHECK (one targeted understanding question), SCAFFOLDING / GOTCHA (one common misconception or bug).
|
|
1767
|
+
4. Titles must be < 100 characters \u2014 never repeat or loop text.
|
|
1768
|
+
5. Output ONLY the JSON array. No prose, no markdown fences.
|
|
1769
|
+
`.trim()
|
|
1770
|
+
].filter(Boolean).join("\n\n");
|
|
1771
|
+
const userPrompt = `
|
|
1772
|
+
### BLUEPRINT (${blueprint.length} slides \u2014 AUTHOR ALL OF THEM, in this exact order):
|
|
1773
|
+
${blueprintText}
|
|
1774
|
+
|
|
1775
|
+
### LESSON GROUND TRUTH:
|
|
1776
|
+
- Lesson Title: "${lessonFlow.lessonTitle}"
|
|
1777
|
+
- Target Duration: ${lessonFlow.estimatedDuration}
|
|
1778
|
+
- Pedagogy: "${lessonFlow.pedagogicalModel.toUpperCase()}"
|
|
1779
|
+
- Language: "${language}"
|
|
1780
|
+
|
|
1781
|
+
### LESSON PHASE CONTENT (SOURCE OF TRUTH FOR REAL CONTENT):
|
|
1782
|
+
${phasesContent.slice(0, 16e3)}
|
|
1783
|
+
|
|
1784
|
+
---
|
|
1785
|
+
|
|
1786
|
+
### OUTPUT:
|
|
1787
|
+
A single JSON array of exactly ${blueprint.length} slide objects:
|
|
1788
|
+
\`\`\`json
|
|
1789
|
+
[
|
|
1790
|
+
{
|
|
1791
|
+
"id": "slide-1",
|
|
1792
|
+
"layoutId": "${blueprint[0]?.layoutId || "split-concept-code"}",
|
|
1793
|
+
"title": "${blueprint[0]?.title || "Slide Title"}",
|
|
1794
|
+
"slots": { "...layout-specific slots with REAL content..." },
|
|
1795
|
+
"notes": "SCRIPT: ...\\nCOLD CALL: ...\\nSCAFFOLDING: ..."
|
|
1796
|
+
}
|
|
1797
|
+
]
|
|
1798
|
+
\`\`\`
|
|
1799
|
+
`.trim();
|
|
1800
|
+
return { systemPrompt, userPrompt };
|
|
1801
|
+
}
|
|
1802
|
+
async function runHybridPipeline(ctx) {
|
|
1803
|
+
const { lessonFlow, blueprintPrompt, skillPrompt, language, languageDirective, headingDirective, maxRetries, options, onProgress } = ctx;
|
|
1804
|
+
let blueprint = null;
|
|
1805
|
+
for (let attempt = 1; attempt <= maxRetries && !blueprint; attempt++) {
|
|
1806
|
+
onProgress?.("@illustrator", `[1/4] L\u1EADp D\xE0n \xFD Slides \u2014 hybrid blueprint (l\u1EA7n ${attempt}/${maxRetries})...`);
|
|
1807
|
+
const parsed = await inferTextJson(exports.HybridBlueprintArraySchema, "", blueprintPrompt, options, `hybrid-blueprint#${attempt}`);
|
|
1808
|
+
if (parsed && parsed.length > 0) {
|
|
1809
|
+
blueprint = normalizeBlueprintItems(parsed);
|
|
1810
|
+
} else if (attempt < maxRetries) {
|
|
1811
|
+
onProgress?.("@illustrator", `\u26A0\uFE0F Hybrid blueprint l\u1EA7n ${attempt}/${maxRetries} l\u1ED7i \u2014 th\u1EED l\u1EA1i...`, { type: "warning" });
|
|
1812
|
+
}
|
|
1813
|
+
}
|
|
1814
|
+
if (!blueprint || blueprint.length === 0) {
|
|
1815
|
+
throw new exports.HybridPipelineError(`blueprint failed after ${maxRetries} attempts`);
|
|
1816
|
+
}
|
|
1817
|
+
onProgress?.("@illustrator", `[1/4] D\xE0n \xFD ${blueprint.length} slides ho\xE0n t\u1EA5t \u2014 chuy\u1EC3n sang authoring to\xE0n deck...`);
|
|
1818
|
+
const { systemPrompt, userPrompt } = buildHybridDeckPrompts({
|
|
1819
|
+
lessonFlow,
|
|
1820
|
+
blueprint,
|
|
1821
|
+
skillPrompt,
|
|
1822
|
+
language,
|
|
1823
|
+
languageDirective,
|
|
1824
|
+
headingDirective
|
|
1825
|
+
});
|
|
1826
|
+
let slides = null;
|
|
1827
|
+
let lastViolations = [];
|
|
1828
|
+
for (let attempt = 1; attempt <= maxRetries && !slides; attempt++) {
|
|
1829
|
+
onProgress?.("@illustrator", `[2/4] Sinh chi ti\u1EBFt to\xE0n b\u1ED9 ${blueprint.length} slides trong 1 l\u1EA7n g\u1ECDi (l\u1EA7n ${attempt}/${maxRetries})...`);
|
|
1830
|
+
const feedback = attempt > 1 && lastViolations.length > 0 ? `
|
|
1831
|
+
|
|
1832
|
+
### \u26A0\uFE0F PREVIOUS ATTEMPT REJECTED \u2014 fix these violations:
|
|
1833
|
+
${lastViolations.map((x) => "- " + x).join("\n")}
|
|
1834
|
+
Return exactly ${blueprint.length} slides, same order as the blueprint.` : "";
|
|
1835
|
+
const parsed = await inferTextJson(exports.HybridDeckSlideArraySchema, systemPrompt, userPrompt + feedback, options, `hybrid-author#${attempt}`);
|
|
1836
|
+
if (!parsed || parsed.length === 0) {
|
|
1837
|
+
lastViolations = ["Output missing, empty, or not a valid JSON array of slide objects"];
|
|
1838
|
+
} else {
|
|
1839
|
+
const violations = validateHybridDeckSlides(parsed, blueprint);
|
|
1840
|
+
if (violations.length === 0) {
|
|
1841
|
+
slides = parsed;
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
lastViolations = violations;
|
|
1845
|
+
}
|
|
1846
|
+
if (attempt < maxRetries) {
|
|
1847
|
+
onProgress?.("@illustrator", `\u26A0\uFE0F Deck authoring l\u1EA7n ${attempt}/${maxRetries} vi ph\u1EA1m guardrails \u2014 retry v\u1EDBi corrective feedback...`, {
|
|
1848
|
+
type: "warning",
|
|
1849
|
+
violations: lastViolations
|
|
1850
|
+
});
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
if (!slides) {
|
|
1854
|
+
throw new exports.HybridPipelineError(
|
|
1855
|
+
`deck authoring failed after ${maxRetries} attempts. Last violations: ${lastViolations.slice(0, 3).join("; ")}`
|
|
1856
|
+
);
|
|
1857
|
+
}
|
|
1858
|
+
return { slides, blueprint };
|
|
1859
|
+
}
|
|
1645
1860
|
async function executeSlideProductionWorkflow(options) {
|
|
1646
1861
|
const {
|
|
1647
|
-
lessonMarkdown,
|
|
1648
1862
|
lessonCode,
|
|
1649
1863
|
lessonTitle,
|
|
1650
1864
|
targetSlideCount,
|
|
@@ -1655,6 +1869,7 @@ async function executeSlideProductionWorkflow(options) {
|
|
|
1655
1869
|
maxRetries = 3,
|
|
1656
1870
|
onProgress
|
|
1657
1871
|
} = options;
|
|
1872
|
+
const engineRequested = options.engine ?? "hybrid";
|
|
1658
1873
|
let presentationKitSkills = null;
|
|
1659
1874
|
let presentationKitCore = null;
|
|
1660
1875
|
try {
|
|
@@ -1665,117 +1880,140 @@ async function executeSlideProductionWorkflow(options) {
|
|
|
1665
1880
|
presentationKitCore = await import('@thanh01.pmt/presentation-kit');
|
|
1666
1881
|
} catch {
|
|
1667
1882
|
}
|
|
1668
|
-
const
|
|
1669
|
-
onProgress?.("@illustrator", `[1/4] Ph\xE2n t\xEDch m\u1EA1ch b\xE0i gi\u1EA3ng LESSON & L\u1EADp D\xE0n \xFD ${countLabel}Slides...`);
|
|
1670
|
-
const lessonFlow = parseLessonFlow(lessonMarkdown);
|
|
1883
|
+
const lessonFlow = parseLessonFlow(options.lessonMarkdown);
|
|
1671
1884
|
const getStylePreset = presentationKitSkills?.getStylePreset;
|
|
1672
1885
|
const stylePreset = getStylePreset ? getStylePreset(stylePresetId) : { name: "Blue Professional" };
|
|
1886
|
+
const skillPrompt = presentationKitSkills?.getFrontendSlidesSkillPrompt ? presentationKitSkills.getFrontendSlidesSkillPrompt({ stylePresetId }) : "";
|
|
1673
1887
|
const blueprintPrompt = buildSlideBlueprintPrompt({
|
|
1674
1888
|
lessonFlow,
|
|
1675
1889
|
targetSlideCount,
|
|
1676
1890
|
stylePresetName: stylePreset?.name || "Blue Professional"
|
|
1677
1891
|
});
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1892
|
+
let blueprintItems;
|
|
1893
|
+
let allGeneratedSlides;
|
|
1894
|
+
let engineUsed = engineRequested;
|
|
1895
|
+
const hybridResult = engineRequested === "hybrid" ? await runHybridPipeline({
|
|
1896
|
+
lessonFlow,
|
|
1897
|
+
blueprintPrompt,
|
|
1898
|
+
skillPrompt,
|
|
1899
|
+
language,
|
|
1900
|
+
languageDirective,
|
|
1901
|
+
headingDirective,
|
|
1902
|
+
maxRetries,
|
|
1903
|
+
options,
|
|
1904
|
+
onProgress
|
|
1905
|
+
}).catch((hybridErr) => {
|
|
1906
|
+
console.warn(`[SlideProductionWorkflow] Hybrid engine failed: ${hybridErr?.message || hybridErr} \u2014 falling back to chunked pipeline.`);
|
|
1907
|
+
onProgress?.("@illustrator", `\u26A0\uFE0F Hybrid engine l\u1ED7i \u2014 chuy\u1EC3n sang chunked pipeline (per-cluster)...`, { type: "warning" });
|
|
1908
|
+
return null;
|
|
1909
|
+
}) : null;
|
|
1910
|
+
if (hybridResult) {
|
|
1911
|
+
blueprintItems = hybridResult.blueprint;
|
|
1912
|
+
allGeneratedSlides = hybridResult.slides.map((s, idx) => ({
|
|
1913
|
+
id: s.id || `slide-${idx + 1}`,
|
|
1914
|
+
layoutId: s.layoutId,
|
|
1915
|
+
title: s.title,
|
|
1916
|
+
slots: s.slots || {},
|
|
1917
|
+
notes: s.notes || ""
|
|
1918
|
+
}));
|
|
1919
|
+
} else {
|
|
1920
|
+
engineUsed = "chunked";
|
|
1921
|
+
const countLabel = targetSlideCount ? `${targetSlideCount} ` : "h\u1EEFu c\u01A1 ";
|
|
1922
|
+
onProgress?.("@illustrator", `[1/4] Ph\xE2n t\xEDch m\u1EA1ch b\xE0i gi\u1EA3ng LESSON & L\u1EADp D\xE0n \xFD ${countLabel}Slides...`);
|
|
1923
|
+
blueprintItems = await pRetry__default.default(
|
|
1924
|
+
async () => {
|
|
1925
|
+
const items = await inferStructured(
|
|
1926
|
+
exports.SlideBlueprintArraySchema,
|
|
1927
|
+
"",
|
|
1928
|
+
blueprintPrompt,
|
|
1929
|
+
options,
|
|
1930
|
+
"blueprint"
|
|
1931
|
+
);
|
|
1932
|
+
if (!items || items.length === 0) {
|
|
1933
|
+
throw new Error("Blueprint generation returned empty or schema-invalid output");
|
|
1934
|
+
}
|
|
1935
|
+
return normalizeBlueprintItems(items);
|
|
1936
|
+
},
|
|
1937
|
+
{
|
|
1938
|
+
retries: maxRetries - 1,
|
|
1939
|
+
onFailedAttempt: (err) => {
|
|
1940
|
+
onProgress?.("@illustrator", `\u26A0\uFE0F Blueprint attempt ${err.attemptNumber}/${maxRetries} failed \u2014 retrying...`, {
|
|
1941
|
+
type: "warning"
|
|
1942
|
+
});
|
|
1943
|
+
}
|
|
1706
1944
|
}
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
const matchingPhases = lessonFlow.phases.filter((p) => clusterPhaseNames.has(p.phaseName.toLowerCase()));
|
|
1726
|
-
const lessonExcerpt = matchingPhases.length > 0 ? matchingPhases.map((p) => `### ${p.phaseName}
|
|
1945
|
+
);
|
|
1946
|
+
const clustersMap = /* @__PURE__ */ new Map();
|
|
1947
|
+
for (const item of blueprintItems) {
|
|
1948
|
+
const cId = item.clusterId || Math.floor((item.slideIndex - 1) / 5) + 1;
|
|
1949
|
+
if (!clustersMap.has(cId)) clustersMap.set(cId, []);
|
|
1950
|
+
clustersMap.get(cId).push(item);
|
|
1951
|
+
}
|
|
1952
|
+
const clusters = Array.from(clustersMap.entries()).sort(([a], [b]) => a - b);
|
|
1953
|
+
allGeneratedSlides = [];
|
|
1954
|
+
const failedClusters = [];
|
|
1955
|
+
let clusterIdx = 0;
|
|
1956
|
+
for (const [cId, clusterSlides] of clusters) {
|
|
1957
|
+
clusterIdx++;
|
|
1958
|
+
const clusterTitle = clusterSlides[0]?.clusterTitle || `Giai \u0111o\u1EA1n ${clusterIdx}`;
|
|
1959
|
+
onProgress?.("@illustrator", `[2/4] Sinh chi ti\u1EBFt C\u1EE5m ${clusterIdx}/${clusters.length}: "${clusterTitle}" (${clusterSlides.length} slides)...`);
|
|
1960
|
+
const clusterPhaseNames = new Set(clusterSlides.map((s) => s.lessonPhase.toLowerCase()));
|
|
1961
|
+
const matchingPhases = lessonFlow.phases.filter((p) => clusterPhaseNames.has(p.phaseName.toLowerCase()));
|
|
1962
|
+
const lessonExcerpt = matchingPhases.length > 0 ? matchingPhases.map((p) => `### ${p.phaseName}
|
|
1727
1963
|
${p.content}`).join("\n\n") : lessonFlow.rawContent.slice(0, 3500);
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1964
|
+
const { systemPrompt, userPrompt } = buildSlideBatchPrompt({
|
|
1965
|
+
clusterId: cId,
|
|
1966
|
+
clusterTitle,
|
|
1967
|
+
clusterSlides,
|
|
1968
|
+
lessonFlow,
|
|
1969
|
+
lessonExcerpt,
|
|
1970
|
+
skillPrompt,
|
|
1971
|
+
language,
|
|
1972
|
+
languageDirective,
|
|
1973
|
+
headingDirective
|
|
1974
|
+
});
|
|
1975
|
+
try {
|
|
1976
|
+
const batchSlides = await pRetry__default.default(
|
|
1977
|
+
async () => {
|
|
1978
|
+
const slides = await inferStructured(
|
|
1979
|
+
exports.GeneratedSlideArraySchema,
|
|
1980
|
+
systemPrompt,
|
|
1981
|
+
userPrompt,
|
|
1982
|
+
options,
|
|
1983
|
+
`cluster-${cId}`
|
|
1984
|
+
);
|
|
1985
|
+
if (!slides || slides.length === 0) {
|
|
1986
|
+
throw new Error(`Cluster ${cId} returned empty or schema-invalid output`);
|
|
1987
|
+
}
|
|
1988
|
+
return slides;
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
retries: maxRetries - 1,
|
|
1992
|
+
onFailedAttempt: (err) => {
|
|
1993
|
+
onProgress?.("@illustrator", `\u26A0\uFE0F C\u1EE5m ${clusterIdx} l\u1EA7n ${err.attemptNumber}/${maxRetries} l\u1ED7i \u2014 retry ri\xEAng c\u1EE5m n\xE0y...`, {
|
|
1994
|
+
type: "warning"
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1760
1997
|
}
|
|
1761
|
-
|
|
1998
|
+
);
|
|
1999
|
+
allGeneratedSlides.push(...batchSlides);
|
|
2000
|
+
} catch (clusterErr) {
|
|
2001
|
+
failedClusters.push(cId);
|
|
2002
|
+
console.error(`[SlideProductionWorkflow] Cluster ${cId} permanently failed after ${maxRetries} attempts:`, clusterErr?.message || clusterErr);
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
if (failedClusters.length > 0) {
|
|
2006
|
+
throw new Error(
|
|
2007
|
+
`[SlideProductionWorkflow] Failed to generate ${failedClusters.length}/${clusters.length} cluster(s) (clusterId: ${failedClusters.join(", ")}) after ${maxRetries} attempts each. Aborting to prevent placeholder/degraded slide output. Review provider keys/model availability and retry.`
|
|
1762
2008
|
);
|
|
1763
|
-
allGeneratedSlides.push(...batchSlides);
|
|
1764
|
-
} catch (clusterErr) {
|
|
1765
|
-
failedClusters.push(cId);
|
|
1766
|
-
console.error(`[SlideProductionWorkflow] Cluster ${cId} permanently failed after ${maxRetries} attempts:`, clusterErr?.message || clusterErr);
|
|
1767
2009
|
}
|
|
1768
2010
|
}
|
|
1769
|
-
if (failedClusters.length > 0) {
|
|
1770
|
-
throw new Error(
|
|
1771
|
-
`[SlideProductionWorkflow] Failed to generate ${failedClusters.length}/${clusters.length} cluster(s) (clusterId: ${failedClusters.join(", ")}) after ${maxRetries} attempts each. Aborting to prevent placeholder/degraded slide output. Review provider keys/model availability and retry.`
|
|
1772
|
-
);
|
|
1773
|
-
}
|
|
1774
2011
|
onProgress?.("@illustrator", `[3/4] Chu\u1EA9n h\xF3a b\u1ED1 c\u1EE5c v\xE0 bi\xEAn d\u1ECBch 1920\xD71080 Stage Deck (${allGeneratedSlides.length} slides)...`);
|
|
1775
2012
|
const normalizer = presentationKitCore?.normalizeSlideSlots;
|
|
1776
2013
|
const normalizedSlides = allGeneratedSlides.map((s, idx) => {
|
|
1777
2014
|
const base = normalizer ? normalizer(s) : s;
|
|
1778
2015
|
if (!base.id) base.id = `slide-${idx + 1}`;
|
|
2016
|
+
if (!base.slots || typeof base.slots !== "object") base.slots = {};
|
|
1779
2017
|
return base;
|
|
1780
2018
|
});
|
|
1781
2019
|
const deckJson = {
|
|
@@ -1785,16 +2023,19 @@ ${p.content}`).join("\n\n") : lessonFlow.rawContent.slice(0, 3500);
|
|
|
1785
2023
|
slides: normalizedSlides
|
|
1786
2024
|
};
|
|
1787
2025
|
let compiledHtml;
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
}
|
|
1796
|
-
|
|
2026
|
+
try {
|
|
2027
|
+
let compiled = null;
|
|
2028
|
+
if (typeof presentationKitCore?.compileHtmlDeckAsync === "function") {
|
|
2029
|
+
compiled = await presentationKitCore.compileHtmlDeckAsync(deckJson);
|
|
2030
|
+
}
|
|
2031
|
+
if (!compiled?.html && typeof presentationKitCore?.compileHtmlDeck === "function") {
|
|
2032
|
+
compiled = presentationKitCore.compileHtmlDeck(deckJson);
|
|
2033
|
+
}
|
|
2034
|
+
if (compiled?.html) {
|
|
2035
|
+
compiledHtml = compiled.html;
|
|
1797
2036
|
}
|
|
2037
|
+
} catch (compErr) {
|
|
2038
|
+
console.warn(`[SlideProductionWorkflow] Failed compiling HTML deck:`, compErr?.message || compErr);
|
|
1798
2039
|
}
|
|
1799
2040
|
const markdownWrapper = `---
|
|
1800
2041
|
id: "SLIDE_${lessonCode}"
|
|
@@ -1818,10 +2059,11 @@ ${JSON.stringify(deckJson, null, 2)}
|
|
|
1818
2059
|
compiledHtml,
|
|
1819
2060
|
markdownWrapper,
|
|
1820
2061
|
blueprint: blueprintItems,
|
|
1821
|
-
slideCount: normalizedSlides.length
|
|
2062
|
+
slideCount: normalizedSlides.length,
|
|
2063
|
+
engine: engineUsed
|
|
1822
2064
|
};
|
|
1823
2065
|
}
|
|
1824
|
-
exports.SlideBlueprintItemSchema = void 0; exports.SlideBlueprintArraySchema = void 0; exports.GeneratedSlideSchema = void 0; exports.GeneratedSlideArraySchema = void 0;
|
|
2066
|
+
var LAYOUT_ID_ENUM; exports.SlideBlueprintItemSchema = void 0; exports.SlideBlueprintArraySchema = void 0; exports.GeneratedSlideSchema = void 0; exports.GeneratedSlideArraySchema = void 0; exports.HybridBlueprintItemSchema = void 0; exports.HybridBlueprintArraySchema = void 0; exports.HybridDeckSlideSchema = void 0; exports.HybridDeckSlideArraySchema = void 0; exports.HybridPipelineError = void 0;
|
|
1825
2067
|
var init_slideProductionWorkflow = __esm({
|
|
1826
2068
|
"src/services/slideProductionWorkflow.ts"() {
|
|
1827
2069
|
init_lessonFlowParser();
|
|
@@ -1829,37 +2071,61 @@ var init_slideProductionWorkflow = __esm({
|
|
|
1829
2071
|
init_slideBatchPrompt();
|
|
1830
2072
|
init_provider_factory();
|
|
1831
2073
|
init_streamRunner();
|
|
2074
|
+
LAYOUT_ID_ENUM = zod.z.enum([
|
|
2075
|
+
"hero-cover",
|
|
2076
|
+
"split-concept-code",
|
|
2077
|
+
"two-columns-compare",
|
|
2078
|
+
"three-cards-grid",
|
|
2079
|
+
"timeline-steps",
|
|
2080
|
+
"metric-callout",
|
|
2081
|
+
"checkpoint-quiz",
|
|
2082
|
+
"tiered-practice-3cards",
|
|
2083
|
+
"summary-takeaways"
|
|
2084
|
+
]);
|
|
1832
2085
|
exports.SlideBlueprintItemSchema = zod.z.object({
|
|
1833
2086
|
slideIndex: zod.z.number().int().min(1),
|
|
1834
|
-
clusterId: zod.z.number().int().min(1).default(1),
|
|
1835
|
-
clusterTitle: zod.z.string().default("Cluster"),
|
|
1836
|
-
lessonPhase: zod.z.string().default("Content"),
|
|
1837
|
-
layoutId:
|
|
1838
|
-
"hero-cover",
|
|
1839
|
-
"split-concept-code",
|
|
1840
|
-
"two-columns-compare",
|
|
1841
|
-
"three-cards-grid",
|
|
1842
|
-
"timeline-steps",
|
|
1843
|
-
"metric-callout",
|
|
1844
|
-
"checkpoint-quiz",
|
|
1845
|
-
"tiered-practice-3cards",
|
|
1846
|
-
"summary-takeaways"
|
|
1847
|
-
]),
|
|
2087
|
+
clusterId: zod.z.number().int().min(1).nullish().default(1),
|
|
2088
|
+
clusterTitle: zod.z.string().nullish().default("Cluster"),
|
|
2089
|
+
lessonPhase: zod.z.string().nullish().default("Content"),
|
|
2090
|
+
layoutId: LAYOUT_ID_ENUM,
|
|
1848
2091
|
title: zod.z.string().min(1),
|
|
1849
|
-
pedagogicalGoal: zod.z.string().default(""),
|
|
1850
|
-
contentFocus: zod.z.array(zod.z.string()).default([]),
|
|
1851
|
-
codeSnippetIntent: zod.z.string().
|
|
1852
|
-
visualIntent: zod.z.string().
|
|
2092
|
+
pedagogicalGoal: zod.z.string().nullish().default(""),
|
|
2093
|
+
contentFocus: zod.z.array(zod.z.string()).nullish().default([]),
|
|
2094
|
+
codeSnippetIntent: zod.z.string().nullish(),
|
|
2095
|
+
visualIntent: zod.z.string().nullish()
|
|
1853
2096
|
});
|
|
1854
2097
|
exports.SlideBlueprintArraySchema = zod.z.array(exports.SlideBlueprintItemSchema);
|
|
1855
2098
|
exports.GeneratedSlideSchema = zod.z.object({
|
|
1856
|
-
id: zod.z.string().
|
|
1857
|
-
layoutId: zod.z.string(),
|
|
2099
|
+
id: zod.z.string().nullish(),
|
|
2100
|
+
layoutId: zod.z.string().min(1),
|
|
1858
2101
|
title: zod.z.string().min(1),
|
|
1859
|
-
slots: zod.z.record(zod.z.any()).default({}),
|
|
1860
|
-
notes: zod.z.string().default("")
|
|
2102
|
+
slots: zod.z.record(zod.z.any()).nullish().default({}),
|
|
2103
|
+
notes: zod.z.string().nullish().default("")
|
|
1861
2104
|
});
|
|
1862
2105
|
exports.GeneratedSlideArraySchema = zod.z.array(exports.GeneratedSlideSchema);
|
|
2106
|
+
exports.HybridBlueprintItemSchema = zod.z.object({
|
|
2107
|
+
slideIndex: zod.z.number().int().min(1),
|
|
2108
|
+
clusterId: zod.z.number().int().min(1).nullish(),
|
|
2109
|
+
clusterTitle: zod.z.string().nullish(),
|
|
2110
|
+
lessonPhase: zod.z.string().nullish(),
|
|
2111
|
+
layoutId: LAYOUT_ID_ENUM,
|
|
2112
|
+
title: zod.z.string().min(1).max(300),
|
|
2113
|
+
pedagogicalGoal: zod.z.string().nullish().default(""),
|
|
2114
|
+
contentFocus: zod.z.array(zod.z.string()).nullish().default([]),
|
|
2115
|
+
codeSnippetIntent: zod.z.string().nullish(),
|
|
2116
|
+
visualIntent: zod.z.string().nullish()
|
|
2117
|
+
});
|
|
2118
|
+
exports.HybridBlueprintArraySchema = zod.z.array(exports.HybridBlueprintItemSchema);
|
|
2119
|
+
exports.HybridDeckSlideSchema = zod.z.object({
|
|
2120
|
+
id: zod.z.string().nullish(),
|
|
2121
|
+
layoutId: zod.z.string().min(1),
|
|
2122
|
+
title: zod.z.string().min(1).max(300),
|
|
2123
|
+
slots: zod.z.record(zod.z.any()).nullish().default({}),
|
|
2124
|
+
notes: zod.z.string().nullish().default("")
|
|
2125
|
+
});
|
|
2126
|
+
exports.HybridDeckSlideArraySchema = zod.z.array(exports.HybridDeckSlideSchema);
|
|
2127
|
+
exports.HybridPipelineError = class extends Error {
|
|
2128
|
+
};
|
|
1863
2129
|
}
|
|
1864
2130
|
});
|
|
1865
2131
|
var LearningObjectiveRowSchema = zod.z.object({
|
|
@@ -10688,6 +10954,306 @@ ${lines.join("\n")}
|
|
|
10688
10954
|
- For example: if canonical section is "Computational Thinking Focus", your heading must be "## [REQUIRED] ${headings["Computational Thinking Focus"] || "Computational Thinking Focus"}".`;
|
|
10689
10955
|
}
|
|
10690
10956
|
|
|
10957
|
+
// src/services/curriculumHorizon.ts
|
|
10958
|
+
init_errors();
|
|
10959
|
+
var DETAILED_BRIDGE_WINDOW = 2;
|
|
10960
|
+
var BOUNDARY_PEEK_WINDOW = 2;
|
|
10961
|
+
function parseAllSessions(plan, frameworkMarkdown) {
|
|
10962
|
+
if (plan) {
|
|
10963
|
+
const rawSessions = Array.isArray(plan.sessions) ? plan.sessions : Array.isArray(plan) ? plan : [];
|
|
10964
|
+
if (rawSessions.length > 0) {
|
|
10965
|
+
return rawSessions.map((s, idx) => ({
|
|
10966
|
+
id: s.id || `L${String(idx + 1).padStart(2, "0")}`,
|
|
10967
|
+
order: typeof s.order === "number" ? s.order : idx + 1,
|
|
10968
|
+
title: s.title || "",
|
|
10969
|
+
prose_objective: s.prose_objective || s.objective || "",
|
|
10970
|
+
new_keywords: Array.isArray(s.new_keywords) ? s.new_keywords : Array.isArray(s.keywords) ? s.keywords : [],
|
|
10971
|
+
prerequisite_keywords: Array.isArray(s.prerequisite_keywords) ? s.prerequisite_keywords : [],
|
|
10972
|
+
depth_assignments: Array.isArray(s.depth_assignments) ? s.depth_assignments : []
|
|
10973
|
+
}));
|
|
10974
|
+
}
|
|
10975
|
+
}
|
|
10976
|
+
if (frameworkMarkdown && typeof frameworkMarkdown === "string") {
|
|
10977
|
+
const lines = frameworkMarkdown.split("\n");
|
|
10978
|
+
let headerCols = [];
|
|
10979
|
+
const sessions = [];
|
|
10980
|
+
for (const line of lines) {
|
|
10981
|
+
const trimmed = line.trim();
|
|
10982
|
+
if (!trimmed.startsWith("|")) continue;
|
|
10983
|
+
const cols = trimmed.split("|").slice(1, -1).map((c) => c.trim());
|
|
10984
|
+
const lower = cols.map((c) => c.toLowerCase());
|
|
10985
|
+
if (lower.some((c) => c.includes("lesson code") || c === "m\xE3 b\xE0i" || c.includes("m\xE3 b\xE0i h\u1ECDc"))) {
|
|
10986
|
+
headerCols = cols;
|
|
10987
|
+
continue;
|
|
10988
|
+
}
|
|
10989
|
+
if (/^[-: |]+$/.test(trimmed.slice(1, -1))) continue;
|
|
10990
|
+
if (cols.length < 3) continue;
|
|
10991
|
+
let lessonCode = "";
|
|
10992
|
+
let title = "";
|
|
10993
|
+
let objective = "";
|
|
10994
|
+
let concept = "";
|
|
10995
|
+
let keywordsStr = "";
|
|
10996
|
+
if (headerCols.length > 0) {
|
|
10997
|
+
const col = (name) => {
|
|
10998
|
+
const idx = headerCols.findIndex((h) => h.toLowerCase().includes(name));
|
|
10999
|
+
return idx >= 0 ? cols[idx] || "" : "";
|
|
11000
|
+
};
|
|
11001
|
+
lessonCode = (col("lesson code") || col("m\xE3 b\xE0i") || cols[1] || "").replace(/\*\*/g, "").trim();
|
|
11002
|
+
title = (col("title") || col("t\xEAn") || cols[2] || "").replace(/\*\*/g, "").trim();
|
|
11003
|
+
objective = col("learning objective") || col("objective") || col("m\u1EE5c ti\xEAu") || "";
|
|
11004
|
+
concept = col("key concept") || col("concept") || col("kh\xE1i ni\u1EC7m") || "";
|
|
11005
|
+
keywordsStr = col("keywords") || col("t\u1EEB kh\xF3a") || "";
|
|
11006
|
+
} else {
|
|
11007
|
+
lessonCode = (cols[1] || "").replace(/\*\*/g, "").trim();
|
|
11008
|
+
title = (cols[2] || "").replace(/\*\*/g, "").trim();
|
|
11009
|
+
objective = cols[5] || "";
|
|
11010
|
+
concept = cols[4] || "";
|
|
11011
|
+
}
|
|
11012
|
+
if (lessonCode && /^[A-Za-z0-9_\-]+$/.test(lessonCode)) {
|
|
11013
|
+
const keywords = keywordsStr ? keywordsStr.split(/[,;\n]/).map((k) => k.trim().replace(/^`|`$/g, "")).filter(Boolean) : concept ? concept.split(/[,;\n]/).map((k) => k.trim().replace(/^`|`$/g, "")).filter(Boolean) : [];
|
|
11014
|
+
sessions.push({
|
|
11015
|
+
id: lessonCode,
|
|
11016
|
+
order: sessions.length + 1,
|
|
11017
|
+
title: title || lessonCode,
|
|
11018
|
+
prose_objective: objective,
|
|
11019
|
+
new_keywords: keywords
|
|
11020
|
+
});
|
|
11021
|
+
}
|
|
11022
|
+
}
|
|
11023
|
+
if (sessions.length > 0) {
|
|
11024
|
+
return sessions;
|
|
11025
|
+
}
|
|
11026
|
+
}
|
|
11027
|
+
return [];
|
|
11028
|
+
}
|
|
11029
|
+
async function extractCurriculumHorizon(opts) {
|
|
11030
|
+
const { plan, frameworkMarkdown, targetLessonId, storage, projectId } = opts;
|
|
11031
|
+
const sessions = parseAllSessions(plan, frameworkMarkdown);
|
|
11032
|
+
if (sessions.length === 0) {
|
|
11033
|
+
throw new exports.CurriculumError({
|
|
11034
|
+
errorCode: "ERR_LESSON_NOT_IN_SOT",
|
|
11035
|
+
lessonId: targetLessonId,
|
|
11036
|
+
message: `[CurriculumHorizon] No sessions could be parsed from CURRICULUM_PLAN.json or CURRICULUM_FRAMEWORK.md. Fail fast \u2014 cannot construct curriculum horizon without SOT.`,
|
|
11037
|
+
suggestedAction: "Ensure CURRICULUM_PLAN.json or CURRICULUM_FRAMEWORK.md is generated and contains valid sessions.",
|
|
11038
|
+
retryable: false
|
|
11039
|
+
});
|
|
11040
|
+
}
|
|
11041
|
+
const targetCodePattern = new RegExp("^" + targetLessonId.replace(/_/g, "[_-]") + "$", "i");
|
|
11042
|
+
const targetIndex = sessions.findIndex(
|
|
11043
|
+
(s) => s.id === targetLessonId || targetCodePattern.test(s.id)
|
|
11044
|
+
);
|
|
11045
|
+
if (targetIndex < 0) {
|
|
11046
|
+
throw new exports.CurriculumError({
|
|
11047
|
+
errorCode: "ERR_LESSON_NOT_IN_SOT",
|
|
11048
|
+
lessonId: targetLessonId,
|
|
11049
|
+
message: `[CurriculumHorizon] Lesson "${targetLessonId}" was not found among the ${sessions.length} planned sessions. Fail fast \u2014 refusing to generate unanchored lesson.`,
|
|
11050
|
+
suggestedAction: `Check lesson id against planned sessions: [${sessions.map((s) => s.id).join(", ")}]`,
|
|
11051
|
+
retryable: false
|
|
11052
|
+
});
|
|
11053
|
+
}
|
|
11054
|
+
const currentSession = sessions[targetIndex];
|
|
11055
|
+
const compactEnd = Math.max(0, targetIndex - DETAILED_BRIDGE_WINDOW);
|
|
11056
|
+
const compactSessions = sessions.slice(0, compactEnd);
|
|
11057
|
+
const masteredKeywords = Array.from(
|
|
11058
|
+
new Set(
|
|
11059
|
+
compactSessions.flatMap((s) => s.new_keywords || []).map((k) => k.trim()).filter(Boolean)
|
|
11060
|
+
)
|
|
11061
|
+
);
|
|
11062
|
+
const masteredConcepts = Array.from(
|
|
11063
|
+
new Set(
|
|
11064
|
+
compactSessions.map((s) => s.title || s.prose_objective || "").map((t) => t.trim()).filter(Boolean)
|
|
11065
|
+
)
|
|
11066
|
+
);
|
|
11067
|
+
const bridgeStart = Math.max(0, targetIndex - DETAILED_BRIDGE_WINDOW);
|
|
11068
|
+
const bridgeSessions = sessions.slice(bridgeStart, targetIndex);
|
|
11069
|
+
const detailedBridge = [];
|
|
11070
|
+
for (const session of bridgeSessions) {
|
|
11071
|
+
const bridgeIndex = sessions.indexOf(session) + 1;
|
|
11072
|
+
const bridge = {
|
|
11073
|
+
lessonId: session.id,
|
|
11074
|
+
lessonIndex: bridgeIndex,
|
|
11075
|
+
title: session.title,
|
|
11076
|
+
proseObjective: session.prose_objective,
|
|
11077
|
+
keywords: session.new_keywords || []
|
|
11078
|
+
};
|
|
11079
|
+
if (storage && projectId) {
|
|
11080
|
+
try {
|
|
11081
|
+
const candidates = [
|
|
11082
|
+
`_content/${session.id.replace(/_L\d+$/, "")}/LESSON_${session.id}.md`,
|
|
11083
|
+
`_content/LESSON_${session.id}.md`,
|
|
11084
|
+
`LESSON_${session.id}.md`
|
|
11085
|
+
];
|
|
11086
|
+
let lessonMd = "";
|
|
11087
|
+
for (const c of candidates) {
|
|
11088
|
+
try {
|
|
11089
|
+
const raw = await storage.readArtifact(projectId, c);
|
|
11090
|
+
if (raw) {
|
|
11091
|
+
lessonMd = raw;
|
|
11092
|
+
break;
|
|
11093
|
+
}
|
|
11094
|
+
} catch {
|
|
11095
|
+
}
|
|
11096
|
+
}
|
|
11097
|
+
if (lessonMd) {
|
|
11098
|
+
const ledger = extractSymbolLedger(lessonMd);
|
|
11099
|
+
if (ledger.primarySymbol || ledger.entryFileName || ledger.keySymbols.length > 0) {
|
|
11100
|
+
bridge.symbolLedger = {
|
|
11101
|
+
primaryStructOrClass: ledger.primarySymbol,
|
|
11102
|
+
mainEntryFile: ledger.entryFileName,
|
|
11103
|
+
keyVariables: ledger.keySymbols
|
|
11104
|
+
};
|
|
11105
|
+
}
|
|
11106
|
+
}
|
|
11107
|
+
} catch {
|
|
11108
|
+
}
|
|
11109
|
+
}
|
|
11110
|
+
detailedBridge.push(bridge);
|
|
11111
|
+
}
|
|
11112
|
+
const peekStart = targetIndex + 1;
|
|
11113
|
+
const peekEnd = Math.min(sessions.length, peekStart + BOUNDARY_PEEK_WINDOW);
|
|
11114
|
+
const boundaryPeek = sessions.slice(peekStart, peekEnd).map((s, idx) => ({
|
|
11115
|
+
lessonId: s.id,
|
|
11116
|
+
lessonIndex: peekStart + idx + 1,
|
|
11117
|
+
title: s.title,
|
|
11118
|
+
keywords: s.new_keywords || []
|
|
11119
|
+
}));
|
|
11120
|
+
return {
|
|
11121
|
+
targetLessonId,
|
|
11122
|
+
targetLessonIndex: targetIndex + 1,
|
|
11123
|
+
totalLessons: sessions.length,
|
|
11124
|
+
targetTitle: currentSession.title,
|
|
11125
|
+
targetKeywords: currentSession.new_keywords || [],
|
|
11126
|
+
compactMasterySet: {
|
|
11127
|
+
masteredKeywords,
|
|
11128
|
+
masteredConcepts
|
|
11129
|
+
},
|
|
11130
|
+
detailedBridge,
|
|
11131
|
+
boundaryPeek
|
|
11132
|
+
};
|
|
11133
|
+
}
|
|
11134
|
+
function renderHorizonPromptBlock(horizon) {
|
|
11135
|
+
const {
|
|
11136
|
+
targetLessonId,
|
|
11137
|
+
targetLessonIndex,
|
|
11138
|
+
totalLessons,
|
|
11139
|
+
targetTitle,
|
|
11140
|
+
targetKeywords,
|
|
11141
|
+
compactMasterySet,
|
|
11142
|
+
detailedBridge,
|
|
11143
|
+
boundaryPeek
|
|
11144
|
+
} = horizon;
|
|
11145
|
+
const lines = [
|
|
11146
|
+
`# \u{1F9ED} CURRICULUM HORIZON & SCAFFOLDING MATRIX (Lesson ${targetLessonIndex}/${totalLessons}: "${targetTitle}" [${targetLessonId}])`
|
|
11147
|
+
];
|
|
11148
|
+
if (compactMasterySet.masteredKeywords.length > 0 || compactMasterySet.masteredConcepts.length > 0) {
|
|
11149
|
+
const rawKeywords = compactMasterySet.masteredKeywords;
|
|
11150
|
+
const displayedKeywords = rawKeywords.length > 20 ? rawKeywords.slice(-20) : rawKeywords;
|
|
11151
|
+
const vocab = displayedKeywords.map((k) => `\`${k}\``).join(", ");
|
|
11152
|
+
const moreSuffix = rawKeywords.length > 20 ? ` *(+${rawKeywords.length - 20} earlier terms)*` : "";
|
|
11153
|
+
const concepts = compactMasterySet.masteredConcepts.length > 0 ? `
|
|
11154
|
+
- **Prior Concept Foundations:** ${compactMasterySet.masteredConcepts.slice(-3).join("; ")}` : "";
|
|
11155
|
+
lines.push(
|
|
11156
|
+
`
|
|
11157
|
+
## 1. \u{1F393} MASTERED VOCABULARY (Prior Lessons 1..${Math.max(1, targetLessonIndex - 3)} \u2014 Compact Set):`,
|
|
11158
|
+
`- **Mastered Terms & Syntax:** ${vocab || "(Core fundamentals)"}${moreSuffix}${concepts}`
|
|
11159
|
+
);
|
|
11160
|
+
} else if (targetLessonIndex === 1) {
|
|
11161
|
+
lines.push(
|
|
11162
|
+
`
|
|
11163
|
+
## 1. \u{1F393} PRIOR KNOWLEDGE FRONTIER:`,
|
|
11164
|
+
`- **Entry Point:** Inaugural lesson (Lesson 1/${totalLessons}). Students have no prior course vocabulary. All concepts must be introduced from baseline.`
|
|
11165
|
+
);
|
|
11166
|
+
}
|
|
11167
|
+
if (detailedBridge.length > 0) {
|
|
11168
|
+
lines.push(`
|
|
11169
|
+
## 2. \u{1F309} IMMEDIATE PREDECESSOR CONTEXT (Bridge Lessons):`);
|
|
11170
|
+
for (const bridge of detailedBridge) {
|
|
11171
|
+
lines.push(`### Lesson ${bridge.lessonIndex} (${bridge.lessonId}): ${bridge.title}`);
|
|
11172
|
+
if (bridge.proseObjective) {
|
|
11173
|
+
const obj = bridge.proseObjective.length > 120 ? bridge.proseObjective.slice(0, 117) + "..." : bridge.proseObjective;
|
|
11174
|
+
lines.push(`- **Objective:** ${obj}`);
|
|
11175
|
+
}
|
|
11176
|
+
if (bridge.keywords.length > 0) {
|
|
11177
|
+
lines.push(`- **Keywords:** ${bridge.keywords.map((k) => `\`${k}\``).join(", ")}`);
|
|
11178
|
+
}
|
|
11179
|
+
if (bridge.symbolLedger) {
|
|
11180
|
+
const parts = [];
|
|
11181
|
+
if (bridge.symbolLedger.primaryStructOrClass) {
|
|
11182
|
+
parts.push(`Primary Struct: \`${bridge.symbolLedger.primaryStructOrClass}\``);
|
|
11183
|
+
}
|
|
11184
|
+
if (bridge.symbolLedger.mainEntryFile) {
|
|
11185
|
+
parts.push(`Entry File: \`${bridge.symbolLedger.mainEntryFile}\``);
|
|
11186
|
+
}
|
|
11187
|
+
if (bridge.symbolLedger.keyVariables?.length) {
|
|
11188
|
+
parts.push(`Symbols: ${bridge.symbolLedger.keyVariables.map((v) => `\`${v}\``).join(", ")}`);
|
|
11189
|
+
}
|
|
11190
|
+
if (parts.length > 0) {
|
|
11191
|
+
lines.push(`- **Code Symbol Ledger:** ${parts.join(" | ")}`);
|
|
11192
|
+
}
|
|
11193
|
+
}
|
|
11194
|
+
}
|
|
11195
|
+
lines.push(
|
|
11196
|
+
`\u{1F449} INSTRUCTION: Seamlessly connect the opening Hook and Guided Practice by referencing the student's recent work from Lesson ${detailedBridge[detailedBridge.length - 1]?.lessonIndex}.`
|
|
11197
|
+
);
|
|
11198
|
+
}
|
|
11199
|
+
const currentKeywordsStr = targetKeywords.length > 0 ? targetKeywords.map((k) => `\`${k}\``).join(", ") : "`Current Lesson Concepts`";
|
|
11200
|
+
lines.push(
|
|
11201
|
+
`
|
|
11202
|
+
## 3. \u{1F3AF} ALLOWED DESIGN SPACE (Positive-Only Allow List):`,
|
|
11203
|
+
`- **Student Toolkit:** Mastered Vocabulary + Immediate Bridge Keywords + Current Lesson Scope (${currentKeywordsStr}).`,
|
|
11204
|
+
`- **MANDATE:** ALL extension challenges (EXT), hands-on activities (ACT), and assessment questions (QUIZ) MUST be 100% solvable using ONLY items within this toolkit. Do NOT require unintroduced APIs!`
|
|
11205
|
+
);
|
|
11206
|
+
if (boundaryPeek.length > 0) {
|
|
11207
|
+
const nextLesson = boundaryPeek[0];
|
|
11208
|
+
const nextKeywords = nextLesson.keywords.length > 0 ? nextLesson.keywords.map((k) => `\`${k}\``).join(", ") : "upcoming features";
|
|
11209
|
+
lines.push(
|
|
11210
|
+
`
|
|
11211
|
+
## 4. \u{1F6A7} BOUNDARY (Next Lesson Peek):`,
|
|
11212
|
+
`- **Upcoming Lesson ${nextLesson.lessonIndex} ("${nextLesson.title}"):** Introduces ${nextKeywords}.`,
|
|
11213
|
+
`- **BOUNDARY MANDATE:** These concepts are NOT yet available to the student. Do not introduce or require these future concepts.`
|
|
11214
|
+
);
|
|
11215
|
+
}
|
|
11216
|
+
return lines.join("\n");
|
|
11217
|
+
}
|
|
11218
|
+
function validateHorizonCompliance(artifactContent, horizon) {
|
|
11219
|
+
const issues = [];
|
|
11220
|
+
const forbiddenMatches = [];
|
|
11221
|
+
if (!artifactContent || horizon.boundaryPeek.length === 0) {
|
|
11222
|
+
return { compliant: true, issues: [], forbiddenMatches: [] };
|
|
11223
|
+
}
|
|
11224
|
+
const contentLower = artifactContent.toLowerCase();
|
|
11225
|
+
const immediateNext = horizon.boundaryPeek[0];
|
|
11226
|
+
if (immediateNext && immediateNext.keywords.length > 0) {
|
|
11227
|
+
for (const kw of immediateNext.keywords) {
|
|
11228
|
+
const trimmed = kw.trim().toLowerCase();
|
|
11229
|
+
if (trimmed.length <= 2) continue;
|
|
11230
|
+
const pattern = new RegExp(`\\b${trimmed.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`, "i");
|
|
11231
|
+
if (pattern.test(contentLower)) {
|
|
11232
|
+
const inMastered = horizon.compactMasterySet.masteredKeywords.some(
|
|
11233
|
+
(m) => m.toLowerCase() === trimmed
|
|
11234
|
+
);
|
|
11235
|
+
const inBridge = horizon.detailedBridge.some(
|
|
11236
|
+
(b) => b.keywords.some((bk) => bk.toLowerCase() === trimmed)
|
|
11237
|
+
);
|
|
11238
|
+
const inCurrent = horizon.targetKeywords.some(
|
|
11239
|
+
(ck) => ck.toLowerCase() === trimmed
|
|
11240
|
+
);
|
|
11241
|
+
if (!inMastered && !inBridge && !inCurrent) {
|
|
11242
|
+
forbiddenMatches.push(kw);
|
|
11243
|
+
issues.push(
|
|
11244
|
+
`Artifact contains boundary concept "${kw}" scheduled for future Lesson ${immediateNext.lessonIndex} ("${immediateNext.title}").`
|
|
11245
|
+
);
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
}
|
|
11249
|
+
}
|
|
11250
|
+
return {
|
|
11251
|
+
compliant: issues.length === 0,
|
|
11252
|
+
issues,
|
|
11253
|
+
forbiddenMatches
|
|
11254
|
+
};
|
|
11255
|
+
}
|
|
11256
|
+
|
|
10691
11257
|
// src/services/contextBuilder.ts
|
|
10692
11258
|
var DEFAULT_LESSON_PRIORITIES = [
|
|
10693
11259
|
"Symbol & Identifier Ledger",
|
|
@@ -25502,6 +26068,32 @@ async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
|
|
|
25502
26068
|
|
|
25503
26069
|
[CURRICULUM FRAMEWORK EXCERPT]:
|
|
25504
26070
|
${buildFrameworkExcerptForLesson(framework, lessonId)}`;
|
|
26071
|
+
let horizon = null;
|
|
26072
|
+
let horizonBlock = "";
|
|
26073
|
+
try {
|
|
26074
|
+
let planObj = null;
|
|
26075
|
+
const planRaw = await storage.readArtifact(projectId, "_sot/CURRICULUM_PLAN.json");
|
|
26076
|
+
if (planRaw) {
|
|
26077
|
+
try {
|
|
26078
|
+
planObj = JSON.parse(planRaw);
|
|
26079
|
+
} catch {
|
|
26080
|
+
}
|
|
26081
|
+
}
|
|
26082
|
+
horizon = await extractCurriculumHorizon({
|
|
26083
|
+
plan: planObj,
|
|
26084
|
+
frameworkMarkdown: framework,
|
|
26085
|
+
targetLessonId: lessonCode,
|
|
26086
|
+
storage,
|
|
26087
|
+
projectId
|
|
26088
|
+
});
|
|
26089
|
+
if (horizon) {
|
|
26090
|
+
horizonBlock = `
|
|
26091
|
+
|
|
26092
|
+
${renderHorizonPromptBlock(horizon)}`;
|
|
26093
|
+
}
|
|
26094
|
+
} catch (hErr) {
|
|
26095
|
+
console.warn(`[produceSingleLesson] Notice: Curriculum Horizon extraction:`, hErr?.message || hErr);
|
|
26096
|
+
}
|
|
25505
26097
|
const glossaryBlock = glossaryContext ? `
|
|
25506
26098
|
|
|
25507
26099
|
[GLOSSARY TERMS (use these exact definitions)]:
|
|
@@ -25522,7 +26114,7 @@ ${sessionSliceContext}` : "";
|
|
|
25522
26114
|
${sg}
|
|
25523
26115
|
|
|
25524
26116
|
[REFERENCE PACK GROUND TRUTH]:
|
|
25525
|
-
${ref}${standardsBlock}${glossaryBlock}${expositionBlock}${sessionSliceBlock}`;
|
|
26117
|
+
${ref}${standardsBlock}${glossaryBlock}${expositionBlock}${sessionSliceBlock}${horizonBlock}`;
|
|
25526
26118
|
let commonContext = assembleCommonContext(effectiveRefPack, effectiveStyleGuide);
|
|
25527
26119
|
const MAX_COMPOSITE_PROMPT_CHARS = 3e4;
|
|
25528
26120
|
const runnerOptions = options.customInference ? { customInference: options.customInference } : {};
|
|
@@ -26417,14 +27009,12 @@ ${buildHeadingDirective("CODE", slcMarkdown, targetLang)}`;
|
|
|
26417
27009
|
c3: "### Challenge 3: [Name] (Difficulty: \u2B50\u2B50\u2B50\u2B50\u2B50) \u2014 Extension Milestones (Level 1: Ninja \u2192 Level 2: Guru \u2192 Level 3: Master)",
|
|
26418
27010
|
meta: "## [REQUIRED] Metacognitive Deep Dive & Engineering Trade-offs"
|
|
26419
27011
|
};
|
|
26420
|
-
const
|
|
26421
|
-
|
|
26422
|
-
|
|
26423
|
-
|
|
26424
|
-
|
|
26425
|
-
|
|
26426
|
-
- STRICTLY FORBIDDEN: NEVER introduce advanced mechanisms from future lessons (No complex event buses, No remote network/API calls, No persistent databases, No async concurrency, No out-of-scope hardware/sensors).` : `
|
|
26427
|
-
4. ZPD SCOPE: Focus on architectural edge cases, algorithmic optimization, and synthesis of learned concepts up to Lesson #${lessonIdx}.`;
|
|
27012
|
+
const zpdCeilingPrompt = horizon ? `
|
|
27013
|
+
4. \u{1F3AF} CURRICULUM HORIZON ALLOWED SPACE & BOUNDARY MANDATE:
|
|
27014
|
+
- Student's COMPLETE allowed toolkit = Mastered Vocabulary + Immediate Bridge + Current Lesson Scope (${horizon.targetKeywords.join(", ") || "Current Lesson Concepts"}).
|
|
27015
|
+
- All extension challenges MUST be 100% solvable using ONLY items within this toolkit.
|
|
27016
|
+
${horizon.boundaryPeek.length > 0 ? `- STRICT BOUNDARY: Upcoming Lesson ${horizon.boundaryPeek[0].lessonIndex} introduces "${horizon.boundaryPeek[0].title}" (${horizon.boundaryPeek[0].keywords.join(", ")}). These are STRICTLY OUT OF SCOPE. Do NOT introduce or require these future APIs.` : ""}` : `
|
|
27017
|
+
4. ZPD SCOPE: Focus on architectural edge cases, algorithmic optimization, and creative variations within current and past lesson concepts.`;
|
|
26428
27018
|
const extPrompt = `You are @activity (Lead STEM Specialist & Differentiated Extension Designer).
|
|
26429
27019
|
Based on Master Lesson Plan \`LESSON_${lessonCode}.md\`, author the advanced extension challenge: \`EXT_${lessonCode}.md\`.
|
|
26430
27020
|
|
|
@@ -26996,6 +27586,20 @@ async function generateSingleArtifact(req) {
|
|
|
26996
27586
|
- Entry Source File: \`${symbolLedger.entryFileName || symbolLedger.primarySymbol + ".swift"}\`
|
|
26997
27587
|
- Key Identifiers to inherit: ${symbolLedger.keySymbols.map((s) => `\`${s}\``).join(", ")}
|
|
26998
27588
|
- INVARIANT: You MUST use these exact identifier names in all code examples, exercises, and starter templates. Do NOT invent conflicting struct or class names.` : "";
|
|
27589
|
+
let horizon = contextSot.horizon || null;
|
|
27590
|
+
if (!horizon && (contextSot.plan || contextSot.framework) && lessonId) {
|
|
27591
|
+
try {
|
|
27592
|
+
horizon = await extractCurriculumHorizon({
|
|
27593
|
+
plan: contextSot.plan,
|
|
27594
|
+
frameworkMarkdown: contextSot.framework,
|
|
27595
|
+
targetLessonId: lessonId
|
|
27596
|
+
});
|
|
27597
|
+
} catch {
|
|
27598
|
+
}
|
|
27599
|
+
}
|
|
27600
|
+
const horizonPrompt = horizon ? `
|
|
27601
|
+
|
|
27602
|
+
${renderHorizonPromptBlock(horizon)}` : "";
|
|
26999
27603
|
const systemPrompt = `You are ${meta.persona}, an expert Curriculum & Pedagogical Specialist in the Curriculum OS Multi-Agent Team.
|
|
27000
27604
|
Your task is to author a canonical, publication-grade learning artifact of type "${artifactType.toUpperCase()}".
|
|
27001
27605
|
|
|
@@ -27009,7 +27613,7 @@ ${headingDirective}
|
|
|
27009
27613
|
6. DOMAIN & TECH STACK GUARDRAILS:
|
|
27010
27614
|
${domainGuardrail}
|
|
27011
27615
|
${symbolLedgerPrompt}
|
|
27012
|
-
8. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${mediaPolicy ? `
|
|
27616
|
+
8. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${horizonPrompt}${mediaPolicy ? `
|
|
27013
27617
|
|
|
27014
27618
|
IMAGE PLANNING (media ledger) \u2014 QUOTA GEN: t\u1ED1i \u0111a ${mediaPolicy.maxGenImagesPerArtifact} \u1EA3nh AI cho artifact n\xE0y (\u1EA3nh search kho kh\xF4ng gi\u1EDBi h\u1EA1n).
|
|
27015
27619
|
Khi n\u1ED9i dung c\u1EA7n minh h\u1ECDa (diagram quy tr\xECnh, s\u01A1 \u0111\u1ED3 kh\xE1i ni\u1EC7m, step-by-step visual), ch\xE8n placeholder \u0111\xFAng format [IMAGE: slug] (slug ch\u1EEF th\u01B0\u1EDDng-g\u1EA1ch ngang, unique trong b\xE0i, vd img-for-loop-diagram) T\u1EA0I \u0110\xDANG CH\u1ED6 c\u1EA7n \u1EA3nh, tr\xEAn d\xF2ng ri\xEAng. KH\xD4NG t\u1EF1 sinh \u1EA3nh, KH\xD4NG d\xF9ng markdown image \u2014 placeholder s\u1EBD \u0111\u01B0\u1EE3c thay b\u1EB1ng \u1EA3nh th\u1EADt sau khi Media Curator duy\u1EC7t. Ch\u1EC9 \u0111\u1EB7t cho \u1EA3nh TH\u1EF0C S\u1EF0 c\u1EA7n thi\u1EBFt.` : ""}`;
|
|
@@ -27490,13 +28094,9 @@ ${includeUnitTests ? "- Unit Testing: Provide automated assertions or test runne
|
|
|
27490
28094
|
- Exact quantities calculated for ${studentCount} students.
|
|
27491
28095
|
- Component specifications, estimated unit cost, and affordable alternatives.`;
|
|
27492
28096
|
case "ext": {
|
|
27493
|
-
const
|
|
27494
|
-
|
|
27495
|
-
|
|
27496
|
-
const zpdCeilingRule = isEarlyLesson ? `- \u{1F6D1} ZPD COMPLEXITY CEILING (FOUNDATIONAL LESSON #${lessonIdx}):
|
|
27497
|
-
\u2022 SCOPE LOCK: This is an early foundational lesson. The extension challenge MUST focus on creative design variations, parameterization, or edge cases of the current lesson concepts ONLY.
|
|
27498
|
-
\u2022 STRICTLY FORBIDDEN: NEVER introduce advanced mechanisms from future lessons (No complex event buses, No remote network/API calls, No persistent databases, No async concurrency, No out-of-scope hardware/sensors).` : `- \u{1F680} ZPD ADVANCED CHALLENGE (LESSON #${lessonIdx}):
|
|
27499
|
-
\u2022 Focus on architectural edge cases, algorithmic optimization, and synthesis of learned concepts up to Lesson #${lessonIdx}.`;
|
|
28097
|
+
const zpdCeilingRule = `- \u{1F3AF} CURRICULUM HORIZON ALLOWED SPACE & BOUNDARY MANDATE:
|
|
28098
|
+
\u2022 SCOPE LOCK: All extension challenges MUST be 100% solvable using ONLY items from the student's Mastered Vocabulary and Current Lesson Scope.
|
|
28099
|
+
\u2022 STRICTLY FORBIDDEN: NEVER introduce unintroduced APIs or mechanisms from upcoming lessons (No complex event buses, No remote network/API calls, No persistent databases, No async concurrency, No out-of-scope hardware/sensors unless explicitly part of the allowed toolkit).`;
|
|
27500
28100
|
return `
|
|
27501
28101
|
### \u{1F680} EXTENSION CHALLENGE ARCHITECTURE INVARIANTS:
|
|
27502
28102
|
${zpdCeilingRule}
|
|
@@ -31376,6 +31976,8 @@ exports.executeCurriculumCommand = executeCurriculumCommand;
|
|
|
31376
31976
|
exports.executeSlideProductionWorkflow = executeSlideProductionWorkflow;
|
|
31377
31977
|
exports.exportAllProjectQuizzes = exportAllProjectQuizzes;
|
|
31378
31978
|
exports.expositionCacheKey = expositionCacheKey;
|
|
31979
|
+
exports.extractCurriculumHorizon = extractCurriculumHorizon;
|
|
31980
|
+
exports.extractJsonArray = extractJsonArray;
|
|
31379
31981
|
exports.extractScopeSequenceRows = extractScopeSequenceRows;
|
|
31380
31982
|
exports.extractSectionHeadingsFromSLC = extractSectionHeadingsFromSLC;
|
|
31381
31983
|
exports.extractSessionSlice = extractSessionSlice;
|
|
@@ -31434,6 +32036,7 @@ exports.loadSotTemplate = loadSotTemplate;
|
|
|
31434
32036
|
exports.normalizePlanningGraph = normalizePlanningGraph;
|
|
31435
32037
|
exports.normalizeSlcContract = normalizeSlcContract;
|
|
31436
32038
|
exports.packagerTools = packagerTools;
|
|
32039
|
+
exports.parseAllSessions = parseAllSessions;
|
|
31437
32040
|
exports.parseGateSettings = parseGateSettings;
|
|
31438
32041
|
exports.parseQuizMarkdown = parseQuizMarkdown;
|
|
31439
32042
|
exports.parseRoadmapJsonToProjectPayload = parseRoadmapJsonToProjectPayload;
|
|
@@ -31443,6 +32046,7 @@ exports.publishToGitHub = publishToGitHub;
|
|
|
31443
32046
|
exports.publishToSupabase = publishToSupabase;
|
|
31444
32047
|
exports.rankGenCandidates = rankGenCandidates;
|
|
31445
32048
|
exports.renderFrameworkFromPlan = renderFrameworkFromPlan;
|
|
32049
|
+
exports.renderHorizonPromptBlock = renderHorizonPromptBlock;
|
|
31446
32050
|
exports.renderMediaPlaceholder = renderMediaPlaceholder;
|
|
31447
32051
|
exports.researcherTools = researcherTools;
|
|
31448
32052
|
exports.resolveGateSettings = resolveGateSettings;
|
|
@@ -31479,6 +32083,8 @@ exports.uploadAssetToBucket = uploadAssetToBucket;
|
|
|
31479
32083
|
exports.validateArtifactDependencies = validateArtifactDependencies;
|
|
31480
32084
|
exports.validateCurriculumPlan = validateCurriculumPlan;
|
|
31481
32085
|
exports.validateFrameworkPack = validateFrameworkPack;
|
|
32086
|
+
exports.validateHorizonCompliance = validateHorizonCompliance;
|
|
32087
|
+
exports.validateHybridDeckSlides = validateHybridDeckSlides;
|
|
31482
32088
|
exports.validateMarkdownTables = validateMarkdownTables;
|
|
31483
32089
|
exports.validateMermaidSyntax = validateMermaidSyntax;
|
|
31484
32090
|
exports.withAutoRepair = withAutoRepair;
|