@thanh01.pmt/curriculum-kit 1.4.45 → 1.4.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.d.cts +77 -77
- package/dist/ai/index.d.ts +77 -77
- package/dist/{gateSettings-oo5tCUS_.d.cts → gateSettings-JoqERuS1.d.cts} +0 -1
- package/dist/{gateSettings-oo5tCUS_.d.ts → gateSettings-JoqERuS1.d.ts} +0 -1
- package/dist/index.cjs +38 -168
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -36
- package/dist/index.d.ts +25 -36
- package/dist/index.mjs +38 -167
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/index.d.cts +1052 -1052
- package/dist/schemas/index.d.ts +1052 -1052
- package/dist/standards/index.d.cts +2 -2
- package/dist/standards/index.d.ts +2 -2
- package/dist/{standardsCoverageGate-CLnq0d0s.d.cts → standardsCoverageGate-49pJq5t8.d.cts} +12 -12
- package/dist/{standardsCoverageGate-CLnq0d0s.d.ts → standardsCoverageGate-49pJq5t8.d.ts} +12 -12
- package/dist/storage/index.cjs +0 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.mjs +0 -1
- package/dist/storage/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +18 -133
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.d.cts +3 -3
- package/dist/workflow/index.d.ts +3 -3
- package/dist/workflow/index.mjs +18 -133
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/templates/SECTION_LANGUAGE_CONTRACT_template.md +0 -44
- package/docs/refs/templates/SECTION_LANGUAGE_CONTRACT_template.md +0 -44
package/dist/index.cjs
CHANGED
|
@@ -7959,7 +7959,6 @@ var STANDARD_SOT_FILES = [
|
|
|
7959
7959
|
"REFERENCE_PACK.md",
|
|
7960
7960
|
"PROJECT_GRAPH.json",
|
|
7961
7961
|
"HYBRID_GRAPH.json",
|
|
7962
|
-
"SECTION_LANGUAGE_CONTRACT.md",
|
|
7963
7962
|
"CURRICULUM_FRAMEWORK.md",
|
|
7964
7963
|
"CONTENT_STYLE_GUIDE.md",
|
|
7965
7964
|
"ART_DIRECTION.md",
|
|
@@ -9458,17 +9457,6 @@ function buildLanguageDirective(targetLanguage) {
|
|
|
9458
9457
|
${exampleLine}` : ""}
|
|
9459
9458
|
- CJK / NON-LATIN SCRIPT BAN (ABSOLUTE): NEVER output characters from Chinese (\u6C49\u5B57), Japanese (\u304B\u306A/\u6F22\u5B57), or Korean (\uD55C\uAE00) scripts ANYWHERE in the document \u2014 not even a single glyph spliced inside a ${name} sentence. Observed past violations that are STRICTLY forbidden: \u6392\u67E5, \u5305\u542B, \u5BFC\u81F4, \u662F\u591A\u5C11, \u6280\u672F, \u771F\u673A, \u4F11\u606F, \u7EB8\u8D28. To express such meaning write it fully in ${name} or keep the ENGLISH technical term (e.g. write "t\u1EF1 ki\u1EC3m tra l\u1ED7i" / "self-debugging", "bao g\u1ED3m" / "includes"). A mechanical scanner rejects any document containing even one CJK character.`;
|
|
9460
9459
|
}
|
|
9461
|
-
function matchesArtifactType(candidate, target) {
|
|
9462
|
-
const c = candidate.trim().toUpperCase();
|
|
9463
|
-
const t = target.trim().toUpperCase();
|
|
9464
|
-
if (c === t) return true;
|
|
9465
|
-
if (c.startsWith("LESSON") && t.startsWith("LESSON")) return true;
|
|
9466
|
-
if ((c === "CODE" || c === "CODE_LAB") && (t === "CODE" || t === "CODE_LAB")) return true;
|
|
9467
|
-
if ((c === "EXPOSITION" || c === "KNOWLEDGE_EXPOSITION") && (t === "EXPOSITION" || t === "KNOWLEDGE_EXPOSITION")) return true;
|
|
9468
|
-
if ((c === "WKS" || c === "WORKSHEET") && (t === "WKS" || t === "WORKSHEET")) return true;
|
|
9469
|
-
if ((c === "EXT" || c === "EXTENSION") && (t === "EXT" || t === "EXTENSION")) return true;
|
|
9470
|
-
return false;
|
|
9471
|
-
}
|
|
9472
9460
|
var TEMPLATE_BY_TYPE = {
|
|
9473
9461
|
LESSON: "LESSON_5E_template.md",
|
|
9474
9462
|
LESSON_5E: "LESSON_5E_template.md",
|
|
@@ -9477,7 +9465,7 @@ var TEMPLATE_BY_TYPE = {
|
|
|
9477
9465
|
ACT: "ACT_template.md",
|
|
9478
9466
|
CODE: "CODE_template.md",
|
|
9479
9467
|
// JSON-first code lab shares the CODE label set (the serializer renders its
|
|
9480
|
-
// own headings; this lookup only feeds the
|
|
9468
|
+
// own headings; this lookup only feeds the directive fallback path).
|
|
9481
9469
|
CODE_LAB: "CODE_template.md",
|
|
9482
9470
|
QUIZ: "QUIZ_v4.6_template.md",
|
|
9483
9471
|
GUIDE: "GUIDE_template.md",
|
|
@@ -9489,87 +9477,21 @@ var TEMPLATE_BY_TYPE = {
|
|
|
9489
9477
|
LEARNER_PROFILE: "LEARNER_PROFILE_template.md",
|
|
9490
9478
|
PROJECT_BRIEF: "PROJECT_BRIEF_template.md",
|
|
9491
9479
|
CURRICULUM_FRAMEWORK: "CURRICULUM_FRAMEWORK_template.md",
|
|
9492
|
-
CONTENT_STYLE_GUIDE: "CONTENT_STYLE_GUIDE_template.md"
|
|
9493
|
-
SECTION_LANGUAGE_CONTRACT: "SECTION_LANGUAGE_CONTRACT_template.md"
|
|
9480
|
+
CONTENT_STYLE_GUIDE: "CONTENT_STYLE_GUIDE_template.md"
|
|
9494
9481
|
};
|
|
9495
|
-
function
|
|
9482
|
+
function extractSectionHeadings(artifactType, opts) {
|
|
9496
9483
|
const templateFile = TEMPLATE_BY_TYPE[artifactType.trim().toUpperCase()];
|
|
9497
|
-
if (!templateFile) return
|
|
9498
|
-
const resolved = resolveArtifactTemplate(templateFile);
|
|
9499
|
-
if (!resolved) return
|
|
9500
|
-
|
|
9501
|
-
const kept = {};
|
|
9502
|
-
for (const [k, v] of Object.entries(mapping)) {
|
|
9503
|
-
if (contract.has(stripHeadingKey(k))) kept[k] = v;
|
|
9504
|
-
}
|
|
9505
|
-
return kept;
|
|
9506
|
-
}
|
|
9507
|
-
function extractSectionHeadingsFromSLC(slcInput, artifactType, targetLanguage = "vi") {
|
|
9508
|
-
const upperType = artifactType.trim().toUpperCase();
|
|
9509
|
-
const getFallback = () => {
|
|
9510
|
-
const templateFile = TEMPLATE_BY_TYPE[upperType];
|
|
9511
|
-
if (!templateFile) return {};
|
|
9512
|
-
const resolved = resolveArtifactTemplate(templateFile);
|
|
9513
|
-
if (!resolved) return {};
|
|
9514
|
-
return Object.fromEntries(resolved.sections.map((s) => [s, s]));
|
|
9515
|
-
};
|
|
9516
|
-
if (!slcInput) return getFallback();
|
|
9517
|
-
if (typeof slcInput === "object") {
|
|
9518
|
-
if (slcInput[upperType] && Object.keys(slcInput[upperType]).length > 0) {
|
|
9519
|
-
return keepContractEntries(upperType, slcInput[upperType]);
|
|
9520
|
-
}
|
|
9521
|
-
for (const [key, mapping] of Object.entries(slcInput)) {
|
|
9522
|
-
if (matchesArtifactType(key, upperType) && Object.keys(mapping).length > 0) {
|
|
9523
|
-
return keepContractEntries(upperType, mapping);
|
|
9524
|
-
}
|
|
9525
|
-
}
|
|
9526
|
-
return getFallback();
|
|
9527
|
-
}
|
|
9528
|
-
const slcMarkdown = slcInput;
|
|
9529
|
-
const blocks = slcMarkdown.split(/\n(?=#{2,3}\s+[A-Z0-9_]+)/g);
|
|
9530
|
-
for (const block of blocks) {
|
|
9531
|
-
const headerMatch = block.match(/^#{2,3}\s+([A-Z0-9_]+)/);
|
|
9532
|
-
if (!headerMatch) continue;
|
|
9533
|
-
const blockType = headerMatch[1].trim().toUpperCase();
|
|
9534
|
-
if (matchesArtifactType(blockType, upperType)) {
|
|
9535
|
-
const mapping = {};
|
|
9536
|
-
const lines = block.split("\n");
|
|
9537
|
-
for (const line of lines) {
|
|
9538
|
-
const trimmed = line.trim();
|
|
9539
|
-
if (trimmed.startsWith("|") && !trimmed.includes("---")) {
|
|
9540
|
-
const cells = trimmed.split("|").map((c) => c.trim()).filter((_, idx, arr) => idx > 0 && idx < arr.length - 1);
|
|
9541
|
-
if (cells.length >= 2 && !cells[0].toLowerCase().includes("canonical") && !cells[1].toLowerCase().includes("localized")) {
|
|
9542
|
-
mapping[cells[0]] = cells[1];
|
|
9543
|
-
}
|
|
9544
|
-
} else {
|
|
9545
|
-
const bullet = line.match(/^[-*]\s+([^:]+):\s+(.+)$/);
|
|
9546
|
-
if (bullet) {
|
|
9547
|
-
mapping[bullet[1].trim()] = bullet[2].trim();
|
|
9548
|
-
}
|
|
9549
|
-
}
|
|
9550
|
-
}
|
|
9551
|
-
if (Object.keys(mapping).length > 0) return keepContractEntries(upperType, mapping);
|
|
9552
|
-
}
|
|
9553
|
-
}
|
|
9554
|
-
return getFallback();
|
|
9484
|
+
if (!templateFile) return {};
|
|
9485
|
+
const resolved = resolveArtifactTemplate(templateFile, opts);
|
|
9486
|
+
if (!resolved) return {};
|
|
9487
|
+
return Object.fromEntries(resolved.sections.map((s) => [s, s]));
|
|
9555
9488
|
}
|
|
9556
|
-
function buildHeadingDirective(artifactType,
|
|
9557
|
-
const
|
|
9558
|
-
const templateFile = TEMPLATE_BY_TYPE[upperType];
|
|
9559
|
-
const resolved = templateFile ? resolveArtifactTemplate(templateFile, opts) : null;
|
|
9560
|
-
const baked = !!resolved && resolved.declaredLang !== "en";
|
|
9561
|
-
const headings = resolved ? Object.fromEntries(
|
|
9562
|
-
resolved.sections.map((s) => [
|
|
9563
|
-
s,
|
|
9564
|
-
baked ? s : extractSectionHeadingsFromSLC(slcMarkdown, upperType, targetLanguage)[s] || s
|
|
9565
|
-
])
|
|
9566
|
-
) : extractSectionHeadingsFromSLC(baked ? null : slcMarkdown, upperType, targetLanguage);
|
|
9489
|
+
function buildHeadingDirective(artifactType, opts) {
|
|
9490
|
+
const headings = extractSectionHeadings(artifactType, opts);
|
|
9567
9491
|
if (Object.keys(headings).length === 0) {
|
|
9568
9492
|
return "";
|
|
9569
9493
|
}
|
|
9570
|
-
const lines = Object.
|
|
9571
|
-
([heading, display]) => heading === display ? ` - "${display}"` : ` - "${heading}" -> Use Display Heading: "${display}"`
|
|
9572
|
-
);
|
|
9494
|
+
const lines = Object.keys(headings).map((heading) => ` - "${heading}"`);
|
|
9573
9495
|
return `MANDATORY SECTION HEADINGS (SOURCE: RESOLVED ARTIFACT TEMPLATE):
|
|
9574
9496
|
- Copy the template's YAML frontmatter \`template_required_sections\` list VERBATIM into the artifact frontmatter \u2014 never translate, reorder, or invent entries.
|
|
9575
9497
|
- In the markdown body, section headers MUST be exactly the Display Headings below (do NOT translate, paraphrase, or re-marker them):
|
|
@@ -9933,9 +9855,8 @@ function buildSectionAwareExcerpt(markdown, opts = {}) {
|
|
|
9933
9855
|
};
|
|
9934
9856
|
}
|
|
9935
9857
|
const minContentChars = opts.minContentChars !== void 0 ? opts.minContentChars : Math.min(400, source.length);
|
|
9936
|
-
const slcMap = normalizeSlcContract(opts.sectionLanguageContract);
|
|
9937
9858
|
const effectiveArtifactType = opts.artifactType || deriveArtifactTypeFromFileName(opts.fileName);
|
|
9938
|
-
const sections = parseMarkdownSections(source
|
|
9859
|
+
const sections = parseMarkdownSections(source);
|
|
9939
9860
|
const metaBlock = buildMetaBlock(source, effectiveArtifactType);
|
|
9940
9861
|
if (sections.length === 0) {
|
|
9941
9862
|
issues.push("parse:no-sections");
|
|
@@ -10058,48 +9979,16 @@ function buildLessonExcerpt(markdown, opts = {}) {
|
|
|
10058
9979
|
priorities: DEFAULT_LESSON_PRIORITIES
|
|
10059
9980
|
});
|
|
10060
9981
|
}
|
|
10061
|
-
function
|
|
10062
|
-
if (!slc) return void 0;
|
|
10063
|
-
if (typeof slc !== "string") return slc;
|
|
10064
|
-
const out = {};
|
|
10065
|
-
const blocks = slc.split(/\n(?=#{2,3}\s+[A-Z0-9_]+)/g);
|
|
10066
|
-
for (const block of blocks) {
|
|
10067
|
-
const header = block.match(/^#{2,3}\s+([A-Z0-9_]+)/);
|
|
10068
|
-
if (!header?.[1]) continue;
|
|
10069
|
-
const mapping = {};
|
|
10070
|
-
for (const line of block.split("\n")) {
|
|
10071
|
-
const t = line.trim();
|
|
10072
|
-
if (!t.startsWith("|") || t.includes("---")) continue;
|
|
10073
|
-
const cells = t.split("|").map((c) => c.trim()).filter((_, i, a) => i > 0 && i < a.length - 1);
|
|
10074
|
-
const [c0, c1] = cells;
|
|
10075
|
-
if (c0 && c1 && !c0.toLowerCase().includes("canonical") && !c1.toLowerCase().includes("localized")) {
|
|
10076
|
-
mapping[c0] = c1;
|
|
10077
|
-
}
|
|
10078
|
-
}
|
|
10079
|
-
if (Object.keys(mapping).length > 0) out[header[1]] = mapping;
|
|
10080
|
-
}
|
|
10081
|
-
return Object.keys(out).length > 0 ? out : void 0;
|
|
10082
|
-
}
|
|
10083
|
-
function parseMarkdownSections(markdown, slcMap, artifactType) {
|
|
9982
|
+
function parseMarkdownSections(markdown) {
|
|
10084
9983
|
const sections = [];
|
|
10085
9984
|
const lines = markdown.split("\n");
|
|
10086
9985
|
let currentHeading = "";
|
|
10087
9986
|
let currentBody = [];
|
|
10088
|
-
const reverseMap = /* @__PURE__ */ new Map();
|
|
10089
|
-
if (slcMap) {
|
|
10090
|
-
const maps = artifactType && slcMap[artifactType] ? [slcMap[artifactType]] : Object.values(slcMap);
|
|
10091
|
-
for (const m of maps) {
|
|
10092
|
-
for (const [canonical, localized] of Object.entries(m)) {
|
|
10093
|
-
reverseMap.set(normalizeHeading(localized), canonical);
|
|
10094
|
-
reverseMap.set(normalizeHeading(canonical), canonical);
|
|
10095
|
-
}
|
|
10096
|
-
}
|
|
10097
|
-
}
|
|
10098
9987
|
const flush = () => {
|
|
10099
9988
|
if (!currentHeading) return;
|
|
10100
9989
|
const cleanTitle = currentHeading.replace(/^#{1,4}\s+/, "").trim();
|
|
10101
9990
|
const norm2 = normalizeHeading(cleanTitle);
|
|
10102
|
-
const canonicalKey =
|
|
9991
|
+
const canonicalKey = findCanonicalFuzzy(norm2);
|
|
10103
9992
|
sections.push({
|
|
10104
9993
|
rawHeading: currentHeading,
|
|
10105
9994
|
cleanTitle,
|
|
@@ -10198,7 +10087,7 @@ function buildMetaBlock(source, artifactType) {
|
|
|
10198
10087
|
function deriveArtifactTypeFromFileName(fileName) {
|
|
10199
10088
|
if (!fileName) return void 0;
|
|
10200
10089
|
const base = fileName.replace(/\.md$/i, "");
|
|
10201
|
-
const multiWord = base.match(/^(KNOWLEDGE_EXPOSITION|
|
|
10090
|
+
const multiWord = base.match(/^(KNOWLEDGE_EXPOSITION|CONTENT_STYLE_GUIDE|CURRICULUM_FRAMEWORK|LEARNER_PROFILE|PROJECT_BRIEF|REFERENCE_PACK|CURRICULUM_PLAN)/i);
|
|
10202
10091
|
if (multiWord) return multiWord[1].toUpperCase();
|
|
10203
10092
|
const token = base.match(/^([A-Z][A-Z0-9_]*?)(?=_|$)/);
|
|
10204
10093
|
return token ? token[1] : void 0;
|
|
@@ -10425,10 +10314,10 @@ function buildSystemPrompt(targetLanguage = "vi", techStack, hardwarePlatform) {
|
|
|
10425
10314
|
langDirective
|
|
10426
10315
|
].join("\n");
|
|
10427
10316
|
}
|
|
10428
|
-
function buildUserPrompt(session, plan, glossary, targetLanguage = "vi",
|
|
10317
|
+
function buildUserPrompt(session, plan, glossary, targetLanguage = "vi", refPack) {
|
|
10429
10318
|
const depthLines = session.depth_assignments.map((d) => "- " + d.node_id + " [" + d.depth.toUpperCase() + "]: " + DEPTH_RULES[d.depth]).join("\n");
|
|
10430
10319
|
const termLines = glossary.map((g) => "- " + g.term + (g.definition ? " \u2014 " + g.definition : "") + (g.example ? " (example: " + g.example + ")" : "")).join("\n");
|
|
10431
|
-
const headings =
|
|
10320
|
+
const headings = extractSectionHeadings("KNOWLEDGE_EXPOSITION");
|
|
10432
10321
|
const hScope = headings["Session Scope"] || "Session Scope";
|
|
10433
10322
|
const hTerms = headings["Key Terms"] || "Key Terms";
|
|
10434
10323
|
const hNarratives = headings["Concept Narratives"] || "Concept Narratives";
|
|
@@ -10436,7 +10325,7 @@ function buildUserPrompt(session, plan, glossary, targetLanguage = "vi", slcMark
|
|
|
10436
10325
|
const hMistakes = headings["Common Mistakes"] || "Common Mistakes";
|
|
10437
10326
|
const hQuestions = headings["Self-Check Questions"] || "Self-Check Questions";
|
|
10438
10327
|
const skeleton = `## ${hScope} / ## ${hTerms} / ## ${hNarratives} / ## ${hExamples} / ## ${hMistakes} / ## ${hQuestions}`;
|
|
10439
|
-
const headingDirective = buildHeadingDirective("KNOWLEDGE_EXPOSITION"
|
|
10328
|
+
const headingDirective = buildHeadingDirective("KNOWLEDGE_EXPOSITION");
|
|
10440
10329
|
let refPackBlock = "";
|
|
10441
10330
|
if (refPack && refPack.trim()) {
|
|
10442
10331
|
const refExcerpt = buildSectionAwareExcerpt(refPack, {
|
|
@@ -10502,7 +10391,7 @@ async function ensureKnowledgeExposition(options) {
|
|
|
10502
10391
|
skipToolchainList: true
|
|
10503
10392
|
// same RefPack excerpt already in [GROUND TRUTH]
|
|
10504
10393
|
});
|
|
10505
|
-
const originalUserPrompt = buildUserPrompt(session, plan, glossary, targetLanguage,
|
|
10394
|
+
const originalUserPrompt = buildUserPrompt(session, plan, glossary, targetLanguage, refPack) + (productSpecBlock ? "\n\n" + productSpecBlock : "");
|
|
10506
10395
|
const content = (await llmFn(
|
|
10507
10396
|
originalSystemPrompt,
|
|
10508
10397
|
originalUserPrompt
|
|
@@ -10640,7 +10529,6 @@ async function ensureExpositionForLesson(storage, projectId, lessonCode, options
|
|
|
10640
10529
|
plan,
|
|
10641
10530
|
glossary,
|
|
10642
10531
|
targetLanguage: targetLang,
|
|
10643
|
-
slcMarkdown: options.slcMarkdown,
|
|
10644
10532
|
techStack: tech,
|
|
10645
10533
|
hardwarePlatform: hw,
|
|
10646
10534
|
refPack: refPackContent,
|
|
@@ -25009,7 +24897,6 @@ function buildSatelliteContext(input) {
|
|
|
25009
24897
|
lessonContent,
|
|
25010
24898
|
lessonExcerpt,
|
|
25011
24899
|
expositionContent,
|
|
25012
|
-
slcMarkdown,
|
|
25013
24900
|
symbolLedgerBlock,
|
|
25014
24901
|
pedagogyLabel,
|
|
25015
24902
|
lessonEntity,
|
|
@@ -25045,7 +24932,6 @@ ${lessonExcerpt.excerpt}${symbolLedgerBlock}`;
|
|
|
25045
24932
|
const kxExcerpt = buildSectionAwareExcerpt(expositionContent, {
|
|
25046
24933
|
priorities: KX_SLOT_PRIORITIES[type] ?? ["Key Terms", "Concept Narratives", "Worked Micro-Examples"],
|
|
25047
24934
|
budget: 4500,
|
|
25048
|
-
sectionLanguageContract: slcMarkdown,
|
|
25049
24935
|
artifactType: "KNOWLEDGE_EXPOSITION"
|
|
25050
24936
|
});
|
|
25051
24937
|
parts.push(`
|
|
@@ -25077,7 +24963,6 @@ ${slots}`;
|
|
|
25077
24963
|
const excerpt = buildSectionAwareExcerpt(lessonContent, {
|
|
25078
24964
|
priorities: spec.priorities ?? ["Artifact Contract", "A. Lesson Design Plan", "B. Lesson Flow", "Learning Objectives & Evidence", "Activity Sequence"],
|
|
25079
24965
|
budget: spec.budget,
|
|
25080
|
-
sectionLanguageContract: slcMarkdown,
|
|
25081
24966
|
artifactType: "LESSON"
|
|
25082
24967
|
});
|
|
25083
24968
|
const excerptBlock = `
|
|
@@ -25372,7 +25257,7 @@ ${nextRow}`
|
|
|
25372
25257
|
].filter(Boolean);
|
|
25373
25258
|
return parts.join("\n\n") || framework.slice(0, 1500);
|
|
25374
25259
|
}
|
|
25375
|
-
function buildLessonPrompt(pedagogy, lessonCode, unitCode, lessonTitle, concept, bloomLevel, dateStr, targetLanguage = "vi"
|
|
25260
|
+
function buildLessonPrompt(pedagogy, lessonCode, unitCode, lessonTitle, concept, bloomLevel, dateStr, targetLanguage = "vi") {
|
|
25376
25261
|
const templateFile = LESSON_TEMPLATE_BY_PEDAGOGY[pedagogy] ?? "LESSON_5E_template.md";
|
|
25377
25262
|
const artifactType = templateFile.replace("_template.md", "");
|
|
25378
25263
|
const contract = resolveArtifactTemplate(templateFile)?.sections ?? [];
|
|
@@ -25415,9 +25300,7 @@ type: "${artifactType}"
|
|
|
25415
25300
|
${NO_VERBATIM_COPYING}`;
|
|
25416
25301
|
const langDirective = buildLanguageDirective(targetLanguage);
|
|
25417
25302
|
const headingDirective = buildHeadingDirective(
|
|
25418
|
-
pedagogy === "edp" ? "LESSON_EDP" : pedagogy === "general" || pedagogy === "pbl" ? "LESSON_GENERAL" : "LESSON_5E"
|
|
25419
|
-
sectionLanguageContract,
|
|
25420
|
-
targetLanguage
|
|
25303
|
+
pedagogy === "edp" ? "LESSON_EDP" : pedagogy === "general" || pedagogy === "pbl" ? "LESSON_GENERAL" : "LESSON_5E"
|
|
25421
25304
|
);
|
|
25422
25305
|
const body = buildArtifactPrompt({ directive, templateFile });
|
|
25423
25306
|
return `${body}
|
|
@@ -25470,7 +25353,6 @@ async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
|
|
|
25470
25353
|
if (!currentPlanHash || content.includes('plan_hash: "' + currentPlanHash + '"')) return content;
|
|
25471
25354
|
return content + '\n---\nplan_hash: "' + currentPlanHash + '"\n- **Plan reference:** ' + currentPlanHash + "\n";
|
|
25472
25355
|
};
|
|
25473
|
-
const slcMarkdown = options.sectionLanguageContract || await storage.readSotDocument(projectId, "SECTION_LANGUAGE_CONTRACT.md") || "";
|
|
25474
25356
|
let targetLang = options.targetLanguage;
|
|
25475
25357
|
if (!targetLang) {
|
|
25476
25358
|
try {
|
|
@@ -25493,13 +25375,11 @@ async function produceSingleLesson(storage, projectId, lessonId, options = {}) {
|
|
|
25493
25375
|
gates: resolveGateSettings(options.gateSettings),
|
|
25494
25376
|
force: options.force,
|
|
25495
25377
|
targetLanguage: targetLang,
|
|
25496
|
-
slcMarkdown,
|
|
25497
25378
|
customInference: options.customInference
|
|
25498
25379
|
});
|
|
25499
25380
|
if (exposition) {
|
|
25500
25381
|
const expoExcerpt = buildExpositionExcerpt(exposition.rawContent || exposition.context, {
|
|
25501
25382
|
budget: 6e3,
|
|
25502
|
-
sectionLanguageContract: slcMarkdown,
|
|
25503
25383
|
artifactType: "KNOWLEDGE_EXPOSITION"
|
|
25504
25384
|
});
|
|
25505
25385
|
expositionContext = expoExcerpt.excerpt || exposition.context;
|
|
@@ -25708,8 +25588,7 @@ Khi n\u1ED9i dung c\u1EA7n minh h\u1ECDa (diagram quy tr\xECnh, s\u01A1 \u0111\u
|
|
|
25708
25588
|
concept,
|
|
25709
25589
|
bloomLevel,
|
|
25710
25590
|
dateStr,
|
|
25711
|
-
targetLang
|
|
25712
|
-
slcMarkdown
|
|
25591
|
+
targetLang
|
|
25713
25592
|
) + mediaDirective;
|
|
25714
25593
|
const rawLesson = await runCurriculumAIInference(
|
|
25715
25594
|
[{ role: "user", content: lessonPrompt }],
|
|
@@ -25827,7 +25706,7 @@ ${yamlBlock.trim()}
|
|
|
25827
25706
|
});
|
|
25828
25707
|
}
|
|
25829
25708
|
const judgeObjectives = parseLessonObjectives(lessonContent, concept, bloomLevel);
|
|
25830
|
-
const judgeExpositionExcerpt = expositionContext ? buildExpositionExcerpt(expositionContext, { budget: 3e3,
|
|
25709
|
+
const judgeExpositionExcerpt = expositionContext ? buildExpositionExcerpt(expositionContext, { budget: 3e3, artifactType: "KNOWLEDGE_EXPOSITION" }).excerpt : void 0;
|
|
25831
25710
|
const judgeResult = await LLMJudgeEngine.evaluateArtifactWithLLM({
|
|
25832
25711
|
targetArtifactType: "LESSON",
|
|
25833
25712
|
lessonId: lessonCode,
|
|
@@ -25897,7 +25776,6 @@ ${currentContent}` }],
|
|
|
25897
25776
|
const repairedExcerptCheck = buildSectionAwareExcerpt(repairedRaw, {
|
|
25898
25777
|
priorities: DEFAULT_LESSON_PRIORITIES,
|
|
25899
25778
|
budget: 12e3,
|
|
25900
|
-
sectionLanguageContract: slcMarkdown,
|
|
25901
25779
|
artifactType: "LESSON"
|
|
25902
25780
|
});
|
|
25903
25781
|
if (repairedExcerptCheck.issues.includes("parse:no-priority-resolution")) {
|
|
@@ -25928,7 +25806,7 @@ ${currentContent}` }],
|
|
|
25928
25806
|
title: lessonTitle,
|
|
25929
25807
|
frameworkExcerpt: framework ? buildFrameworkExcerptForLesson(framework, lessonId) : void 0,
|
|
25930
25808
|
styleGuideExcerpt: effectiveStyleGuide || void 0,
|
|
25931
|
-
canonicalExposition: expositionContext ? buildExpositionExcerpt(expositionContext, { budget: 3e3,
|
|
25809
|
+
canonicalExposition: expositionContext ? buildExpositionExcerpt(expositionContext, { budget: 3e3, artifactType: "KNOWLEDGE_EXPOSITION" }).excerpt : void 0
|
|
25932
25810
|
}),
|
|
25933
25811
|
standardStatements: Object.keys(standardStatements).length > 0 ? standardStatements : void 0
|
|
25934
25812
|
});
|
|
@@ -26058,7 +25936,6 @@ ${currentContent}` }],
|
|
|
26058
25936
|
const lessonExcerptResult = buildSectionAwareExcerpt(lessonContent, {
|
|
26059
25937
|
priorities: SATELLITE_LESSON_PRIORITIES,
|
|
26060
25938
|
budget: 12e3,
|
|
26061
|
-
sectionLanguageContract: slcMarkdown,
|
|
26062
25939
|
artifactType: "LESSON"
|
|
26063
25940
|
});
|
|
26064
25941
|
const lessonExcerpt = lessonExcerptResult.excerpt;
|
|
@@ -26088,7 +25965,6 @@ ${currentContent}` }],
|
|
|
26088
25965
|
lessonContent,
|
|
26089
25966
|
lessonExcerpt: lessonExcerptResult,
|
|
26090
25967
|
expositionContent: expositionContext,
|
|
26091
|
-
slcMarkdown,
|
|
26092
25968
|
symbolLedgerBlock,
|
|
26093
25969
|
pedagogyLabel,
|
|
26094
25970
|
lessonEntity,
|
|
@@ -26202,7 +26078,7 @@ ${NO_VERBATIM_COPYING}`;
|
|
|
26202
26078
|
|
|
26203
26079
|
${languageDirective}
|
|
26204
26080
|
|
|
26205
|
-
${buildHeadingDirective("ACT"
|
|
26081
|
+
${buildHeadingDirective("ACT")}`;
|
|
26206
26082
|
const rawAct = await runCurriculumAIInference(
|
|
26207
26083
|
[{ role: "user", content: actPrompt }],
|
|
26208
26084
|
satelliteContextFor("ACT"),
|
|
@@ -26273,7 +26149,7 @@ ${NO_VERBATIM_COPYING}`;
|
|
|
26273
26149
|
|
|
26274
26150
|
${languageDirective}
|
|
26275
26151
|
|
|
26276
|
-
${buildHeadingDirective("QUIZ"
|
|
26152
|
+
${buildHeadingDirective("QUIZ")}`;
|
|
26277
26153
|
const rawQuiz = await runCurriculumAIInference(
|
|
26278
26154
|
[{ role: "user", content: quizPrompt }],
|
|
26279
26155
|
satelliteContextFor("QUIZ"),
|
|
@@ -26326,7 +26202,7 @@ ${buildHeadingDirective("QUIZ", slcMarkdown, targetLang)}`;
|
|
|
26326
26202
|
stylePresetId: "blue-professional",
|
|
26327
26203
|
language: targetLang || "Vietnamese",
|
|
26328
26204
|
languageDirective,
|
|
26329
|
-
headingDirective: buildHeadingDirective("SLIDE"
|
|
26205
|
+
headingDirective: buildHeadingDirective("SLIDE"),
|
|
26330
26206
|
groundContext: slideGroundContext,
|
|
26331
26207
|
productSpecBlock: productSpecBlock || void 0,
|
|
26332
26208
|
satelliteContext: satelliteContextFor("SLIDE"),
|
|
@@ -26409,7 +26285,7 @@ footer: "Curriculum OS \u2022 ${lessonCode} (${pedagogyLabel})"
|
|
|
26409
26285
|
lessonCode,
|
|
26410
26286
|
templateScaffold,
|
|
26411
26287
|
languageDirective,
|
|
26412
|
-
headingDirective: buildHeadingDirective("SLIDE"
|
|
26288
|
+
headingDirective: buildHeadingDirective("SLIDE")
|
|
26413
26289
|
});
|
|
26414
26290
|
const rawSlide = await runCurriculumAIInference(
|
|
26415
26291
|
[{ role: "user", content: slidePrompt }],
|
|
@@ -26478,7 +26354,7 @@ ${NO_VERBATIM_COPYING}`;
|
|
|
26478
26354
|
|
|
26479
26355
|
${languageDirective}
|
|
26480
26356
|
|
|
26481
|
-
${buildHeadingDirective("GUIDE"
|
|
26357
|
+
${buildHeadingDirective("GUIDE")}`;
|
|
26482
26358
|
const rawGuide = await runCurriculumAIInference(
|
|
26483
26359
|
[{ role: "user", content: guidePrompt }],
|
|
26484
26360
|
satelliteContextFor("GUIDE"),
|
|
@@ -26534,7 +26410,7 @@ ${NO_VERBATIM_COPYING}`;
|
|
|
26534
26410
|
|
|
26535
26411
|
${languageDirective}
|
|
26536
26412
|
|
|
26537
|
-
${buildHeadingDirective("HANDOUT"
|
|
26413
|
+
${buildHeadingDirective("HANDOUT")}`;
|
|
26538
26414
|
const rawHandout = await runCurriculumAIInference(
|
|
26539
26415
|
[{ role: "user", content: handoutPrompt }],
|
|
26540
26416
|
satelliteContextFor("HANDOUT"),
|
|
@@ -26590,7 +26466,7 @@ ${NO_VERBATIM_COPYING}`;
|
|
|
26590
26466
|
|
|
26591
26467
|
${languageDirective}
|
|
26592
26468
|
|
|
26593
|
-
${buildHeadingDirective("WKS"
|
|
26469
|
+
${buildHeadingDirective("WKS")}`;
|
|
26594
26470
|
const rawWks = await runCurriculumAIInference(
|
|
26595
26471
|
[{ role: "user", content: wksPrompt }],
|
|
26596
26472
|
satelliteContextFor("WKS"),
|
|
@@ -26653,7 +26529,7 @@ ${NO_VERBATIM_COPYING}`;
|
|
|
26653
26529
|
|
|
26654
26530
|
${languageDirective}
|
|
26655
26531
|
|
|
26656
|
-
${buildHeadingDirective("CODE"
|
|
26532
|
+
${buildHeadingDirective("CODE")}`;
|
|
26657
26533
|
const rawCode = await runCurriculumAIInference(
|
|
26658
26534
|
[{ role: "user", content: codePrompt }],
|
|
26659
26535
|
satelliteContextFor("CODE"),
|
|
@@ -26740,7 +26616,7 @@ ${zpdCeilingPrompt}
|
|
|
26740
26616
|
|
|
26741
26617
|
${languageDirective}
|
|
26742
26618
|
|
|
26743
|
-
${buildHeadingDirective("EXT"
|
|
26619
|
+
${buildHeadingDirective("EXT")}`;
|
|
26744
26620
|
const rawExt = await runCurriculumAIInference(
|
|
26745
26621
|
[{ role: "user", content: extPrompt }],
|
|
26746
26622
|
satelliteContextFor("EXT"),
|
|
@@ -27236,11 +27112,7 @@ async function generateSingleArtifact(req) {
|
|
|
27236
27112
|
language.toLowerCase().includes("bilingual") || language.toLowerCase().includes("song");
|
|
27237
27113
|
const targetLang = resolveTargetLanguageCode(language);
|
|
27238
27114
|
const langDirective = buildLanguageDirective(language);
|
|
27239
|
-
const headingDirective = buildHeadingDirective(
|
|
27240
|
-
artifactType.toUpperCase(),
|
|
27241
|
-
req.sectionLanguageContract,
|
|
27242
|
-
targetLang
|
|
27243
|
-
);
|
|
27115
|
+
const headingDirective = buildHeadingDirective(artifactType.toUpperCase());
|
|
27244
27116
|
const availableSources = {
|
|
27245
27117
|
KNOWLEDGE_EXPOSITION: contextSot.exposition || researchContext,
|
|
27246
27118
|
CANONICAL_LESSON: contextSot.lessonPlan,
|
|
@@ -27307,11 +27179,10 @@ ${symbolLedgerPrompt}
|
|
|
27307
27179
|
|
|
27308
27180
|
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).
|
|
27309
27181
|
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.` : ""}`;
|
|
27310
|
-
const
|
|
27311
|
-
const
|
|
27312
|
-
const
|
|
27313
|
-
const
|
|
27314
|
-
const expositionExcerpt = contextSot.exposition ? buildExpositionExcerpt(contextSot.exposition, { budget: 6e3, sectionLanguageContract: slcContract }).excerpt : "";
|
|
27182
|
+
const frameworkExcerpt = contextSot.framework ? buildSectionAwareExcerpt(contextSot.framework, { budget: 2500 }).excerpt : "";
|
|
27183
|
+
const lessonPlanExcerpt = contextSot.lessonPlan ? buildLessonExcerpt(contextSot.lessonPlan, { budget: 8e3, artifactType: "LESSON" }).excerpt : "";
|
|
27184
|
+
const handoutExcerpt = contextSot.handout ? buildSectionAwareExcerpt(contextSot.handout, { budget: 2e3 }).excerpt : "";
|
|
27185
|
+
const expositionExcerpt = contextSot.exposition ? buildExpositionExcerpt(contextSot.exposition, { budget: 6e3 }).excerpt : "";
|
|
27315
27186
|
const userPrompt = `### CONTEXT GROUND TRUTH:
|
|
27316
27187
|
- Topic / Concept Domain: "${topic}"
|
|
27317
27188
|
- Lesson ID: "${lessonId || "ON_DEMAND"}"
|
|
@@ -31928,7 +31799,7 @@ exports.extractEchoSections = extractEchoSections;
|
|
|
31928
31799
|
exports.extractJsonArray = extractJsonArray;
|
|
31929
31800
|
exports.extractRequiredSections = extractRequiredSections;
|
|
31930
31801
|
exports.extractScopeSequenceRows = extractScopeSequenceRows;
|
|
31931
|
-
exports.
|
|
31802
|
+
exports.extractSectionHeadings = extractSectionHeadings;
|
|
31932
31803
|
exports.extractSessionSlice = extractSessionSlice;
|
|
31933
31804
|
exports.extractStandardRefs = extractStandardRefs;
|
|
31934
31805
|
exports.extractStreamChunk = extractStreamChunk;
|
|
@@ -31984,7 +31855,6 @@ exports.loadAuthoringTemplate = loadAuthoringTemplate;
|
|
|
31984
31855
|
exports.loadCurriculumTemplate = loadCurriculumTemplate;
|
|
31985
31856
|
exports.loadSotTemplate = loadSotTemplate;
|
|
31986
31857
|
exports.normalizePlanningGraph = normalizePlanningGraph;
|
|
31987
|
-
exports.normalizeSlcContract = normalizeSlcContract;
|
|
31988
31858
|
exports.packagerTools = packagerTools;
|
|
31989
31859
|
exports.parseAllSessions = parseAllSessions;
|
|
31990
31860
|
exports.parseGateSettings = parseGateSettings;
|