@thanh01.pmt/curriculum-kit 1.4.10 → 1.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import fs2 from 'fs';
2
2
  import path3 from 'path';
3
+ import { jsonrepair } from 'jsonrepair';
3
4
  import { z } from 'zod';
4
5
  import { createGoogleGenerativeAI } from '@ai-sdk/google';
5
6
  import { createOpenAI } from '@ai-sdk/openai';
@@ -10,7 +11,6 @@ import fsPromises from 'fs/promises';
10
11
  import crypto, { createHash } from 'crypto';
11
12
  import { createClient } from '@supabase/supabase-js';
12
13
  import { fileURLToPath } from 'url';
13
- import { jsonrepair } from 'jsonrepair';
14
14
  import { Octokit } from '@octokit/rest';
15
15
 
16
16
  var __defProp = Object.defineProperty;
@@ -1163,6 +1163,488 @@ var init_artifactLinter = __esm({
1163
1163
  "src/pipeline/artifactLinter.ts"() {
1164
1164
  }
1165
1165
  });
1166
+
1167
+ // src/parsers/lessonFlowParser.ts
1168
+ function parseLessonFlow(lessonMarkdown) {
1169
+ const result = {
1170
+ lessonId: "",
1171
+ lessonTitle: "",
1172
+ pedagogicalModel: "5e",
1173
+ estimatedDuration: "90 mins",
1174
+ activities: [],
1175
+ phases: [],
1176
+ rawContent: lessonMarkdown
1177
+ };
1178
+ if (!lessonMarkdown || typeof lessonMarkdown !== "string") {
1179
+ return result;
1180
+ }
1181
+ const fmMatch = lessonMarkdown.match(/^---\s*\n([\s\S]*?)\n---/);
1182
+ if (fmMatch) {
1183
+ const fm = fmMatch[1];
1184
+ const idMatch = fm.match(/id:\s*["']?([^"'\n]+)["']?/i);
1185
+ if (idMatch) result.lessonId = idMatch[1].trim();
1186
+ const titleMatch = fm.match(/title:\s*["']?([^"'\n]+)["']?/i);
1187
+ if (titleMatch) result.lessonTitle = titleMatch[1].trim();
1188
+ const typeMatch = fm.match(/type:\s*["']?([^"'\n]+)["']?/i);
1189
+ if (typeMatch) {
1190
+ const t = typeMatch[1].toLowerCase();
1191
+ if (t.includes("edp")) result.pedagogicalModel = "edp";
1192
+ else if (t.includes("pbl")) result.pedagogicalModel = "pbl";
1193
+ else if (t.includes("cra")) result.pedagogicalModel = "cra";
1194
+ else if (t.includes("5e")) result.pedagogicalModel = "5e";
1195
+ else result.pedagogicalModel = typeMatch[1].trim();
1196
+ }
1197
+ }
1198
+ const durMatch = lessonMarkdown.match(/Estimated Duration:\s*([^\n]+)/i);
1199
+ if (durMatch) result.estimatedDuration = durMatch[1].trim();
1200
+ const contractMatch = lessonMarkdown.match(/SLIDE must visualize:?\s*([^\n]+)/i);
1201
+ if (contractMatch) result.slideContract = contractMatch[1].trim();
1202
+ const actSeqSectionMatch = lessonMarkdown.match(/###\s*(?:\d+\.\s*)?Activity Sequence[\s\S]*?(?=(?:###|\n##\s+|$))/i);
1203
+ if (actSeqSectionMatch) {
1204
+ const tableText = actSeqSectionMatch[0];
1205
+ const lines = tableText.split("\n");
1206
+ let inTable = false;
1207
+ let headerParsed = false;
1208
+ for (const line of lines) {
1209
+ const trimmed = line.trim();
1210
+ if (trimmed.startsWith("|") && trimmed.endsWith("|")) {
1211
+ if (!inTable) {
1212
+ inTable = true;
1213
+ continue;
1214
+ }
1215
+ if (trimmed.includes("---")) {
1216
+ headerParsed = true;
1217
+ continue;
1218
+ }
1219
+ if (headerParsed) {
1220
+ const cells = trimmed.split("|").map((c) => c.trim()).filter((_, idx, arr) => idx > 0 && idx < arr.length - 1);
1221
+ if (cells.length >= 7) {
1222
+ const seqNum = parseInt(cells[0], 10) || result.activities.length + 1;
1223
+ result.activities.push({
1224
+ seq: seqNum,
1225
+ phase: cells[1] || `Phase ${seqNum}`,
1226
+ activityType: cells[2] || "",
1227
+ actor: cells[3] || "",
1228
+ purpose: cells[4] || "",
1229
+ studentAction: cells[5] || "",
1230
+ teacherMove: cells[6] || "",
1231
+ time: cells[9] || cells[cells.length - 2] || "",
1232
+ artifactContract: cells[cells.length - 1] || ""
1233
+ });
1234
+ }
1235
+ }
1236
+ } else if (inTable && trimmed.length > 0 && !trimmed.startsWith(">")) {
1237
+ inTable = false;
1238
+ }
1239
+ }
1240
+ }
1241
+ const flowMatch = lessonMarkdown.match(/##\s*\[?REQUIRED\]?\s*B\.\s*Lesson Flow([\s\S]*?)$/i);
1242
+ const flowSection = flowMatch ? flowMatch[1] : lessonMarkdown;
1243
+ const phaseRegex = /###\s*(?:(\d+)\.\s*)?([^\n—\-]+)(?:[—\-]\s*\[?([^\]\n]+)\]?)?\s*\n([\s\S]*?)(?=(?:###\s*(?:\d+\.)?|$))/gi;
1244
+ let pMatch;
1245
+ while ((pMatch = phaseRegex.exec(flowSection)) !== null) {
1246
+ const rawPhaseName = pMatch[2].trim();
1247
+ const timing = pMatch[3]?.trim();
1248
+ const content = pMatch[4].trim();
1249
+ const codeSnippets = [];
1250
+ const codeRegex = /```(?:[a-zA-Z0-9_\-]+)?\s*\n([\s\S]*?)```/g;
1251
+ let cMatch;
1252
+ while ((cMatch = codeRegex.exec(content)) !== null) {
1253
+ if (!cMatch[1].includes("graph TD") && !cMatch[1].includes("graph LR")) {
1254
+ codeSnippets.push(cMatch[1].trim());
1255
+ }
1256
+ }
1257
+ const mermaidDiagrams = [];
1258
+ const mermaidRegex = /```mermaid\s*\n([\s\S]*?)```/g;
1259
+ let mMatch;
1260
+ while ((mMatch = mermaidRegex.exec(content)) !== null) {
1261
+ mermaidDiagrams.push(mMatch[1].trim());
1262
+ }
1263
+ result.phases.push({
1264
+ phaseName: rawPhaseName,
1265
+ title: rawPhaseName,
1266
+ timing,
1267
+ content,
1268
+ codeSnippets,
1269
+ mermaidDiagrams
1270
+ });
1271
+ }
1272
+ return result;
1273
+ }
1274
+ var init_lessonFlowParser = __esm({
1275
+ "src/parsers/lessonFlowParser.ts"() {
1276
+ }
1277
+ });
1278
+
1279
+ // src/ai/prompts/slideBlueprintPrompt.ts
1280
+ function buildSlideBlueprintPrompt(params) {
1281
+ const { lessonFlow, targetSlideCount = 20, stylePresetName = "Blue Professional" } = params;
1282
+ const activitiesSummary = lessonFlow.activities.map(
1283
+ (a) => `Seq ${a.seq} [${a.phase}]: ${a.purpose} (Teacher: ${a.teacherMove} | Student: ${a.studentAction} | Time: ${a.time})`
1284
+ ).join("\n");
1285
+ const phasesSummary = lessonFlow.phases.map(
1286
+ (p) => `Phase "${p.phaseName}" (${p.timing || "Standard"}):
1287
+ ${p.content.slice(0, 500)}...`
1288
+ ).join("\n\n");
1289
+ return `
1290
+ You are @illustrator, Chief Slide Architect for the Course Builder OS.
1291
+ Your task is to analyze the canonical LESSON plan and architect an authoritative, high-fidelity **SLIDE BLUEPRINT** of EXACTLY ${targetSlideCount} slides.
1292
+
1293
+ ### \u{1F3DB}\uFE0F PEDAGOGICAL GROUND TRUTH (FROM CANONICAL LESSON):
1294
+ - Lesson Title: "${lessonFlow.lessonTitle}"
1295
+ - Pedagogical Framework: "${lessonFlow.pedagogicalModel.toUpperCase()}"
1296
+ - Target Duration: ${lessonFlow.estimatedDuration}
1297
+ - Active Visual Style: "${stylePresetName}"
1298
+ ${lessonFlow.slideContract ? `- Slide Artifact Contract: "${lessonFlow.slideContract}"` : ""}
1299
+
1300
+ ### \u{1F5FA}\uFE0F CANONICAL ACTIVITY SEQUENCE:
1301
+ ${activitiesSummary || "Standard phased sequence"}
1302
+
1303
+ ### \u{1F4D6} LESSON FLOW EXCERPT:
1304
+ ${phasesSummary || lessonFlow.rawContent.slice(0, 3e3)}
1305
+
1306
+ ---
1307
+
1308
+ ### \u{1F3AF} ARCHITECTURAL RULES (STRICTLY INVARIANT):
1309
+ 1. **PEDAGOGICAL FIDELITY (1-TO-1 PROJECTION)**:
1310
+ - The slide sequence MUST follow the EXACT flow of the LESSON phases (${lessonFlow.pedagogicalModel.toUpperCase()}).
1311
+ - Do NOT invent artificial phases that do not exist in the lesson plan.
1312
+ - For example:
1313
+ * If 5E: Engage (slides 1-4) -> Explore (slides 5-8) -> Explain (slides 9-13) -> Elaborate (slides 14-17) -> Evaluate (slides 18-20).
1314
+ * If EDP: Ask/Problem (slides 1-4) -> Imagine & Plan (slides 5-8) -> Create & Prototype (slides 9-14) -> Test & Debug (slides 15-17) -> Improve & Share (slides 18-20).
1315
+ * If PBL: Driving Question (slides 1-4) -> Inquiry (slides 5-9) -> Milestone Sprint (slides 10-15) -> Review & Exhibition (slides 16-20).
1316
+
1317
+ 2. **CHUNKY CLUSTERS (3 TO 4 CLUSTERS)**:
1318
+ - Group the ${targetSlideCount} slides into 3 to 4 natural clusters (each cluster contains 4 to 6 slides).
1319
+ - Each cluster corresponds to a major pedagogical transition in the lesson.
1320
+
1321
+ 3. **SEMANTIC LAYOUT SLOTS (CHOOSE FROM VERIFIED TEMPLATES)**:
1322
+ Use one of these valid layoutIds for each slide:
1323
+ - \`hero-cover\`: Title, subtitle, topic badge, metadata.
1324
+ - \`split-concept-code\`: Left side explanation/bullets, right side prominent code card or diagram.
1325
+ - \`two-columns-compare\`: Side-by-side comparison (Before vs After, Scratch vs Swift, Theory vs Practice).
1326
+ - \`three-cards-grid\`: 3 architectural pillars, components, or principles.
1327
+ - \`timeline-steps\`: Step-by-step workflow, pipeline sequence, or execution trace.
1328
+ - \`metric-callout\`: High-impact statistical or performance highlight.
1329
+ - \`checkpoint-quiz\`: Formative diagnostic question with multiple choice.
1330
+ - \`tiered-practice-3cards\`: Bronze, Silver, Gold hands-on challenge specs.
1331
+ - \`summary-takeaways\`: Final recap, key rules, and next milestone.
1332
+
1333
+ ---
1334
+
1335
+ ### \u{1F4E4} OUTPUT FORMAT:
1336
+ Output ONLY a valid JSON array of ${targetSlideCount} objects. Do NOT include markdown text outside the JSON.
1337
+ Format:
1338
+ \`\`\`json
1339
+ [
1340
+ {
1341
+ "slideIndex": 1,
1342
+ "clusterId": 1,
1343
+ "clusterTitle": "Opening & Hook",
1344
+ "lessonPhase": "Engage",
1345
+ "layoutId": "hero-cover",
1346
+ "title": "Title of Slide 1",
1347
+ "pedagogicalGoal": "Specific learning goal of this slide",
1348
+ "contentFocus": ["Bullet 1 focus", "Bullet 2 focus"],
1349
+ "codeSnippetIntent": "Description of code snippet to show, if any",
1350
+ "visualIntent": "Description of visual diagram to display, if any"
1351
+ }
1352
+ ]
1353
+ \`\`\`
1354
+ `.trim();
1355
+ }
1356
+ var init_slideBlueprintPrompt = __esm({
1357
+ "src/ai/prompts/slideBlueprintPrompt.ts"() {
1358
+ }
1359
+ });
1360
+
1361
+ // src/ai/prompts/slideBatchPrompt.ts
1362
+ function buildSlideBatchPrompt(params) {
1363
+ const {
1364
+ clusterId,
1365
+ clusterTitle,
1366
+ clusterSlides,
1367
+ lessonFlow,
1368
+ lessonExcerpt,
1369
+ skillPrompt,
1370
+ language = "Vietnamese",
1371
+ languageDirective = "",
1372
+ headingDirective = ""
1373
+ } = params;
1374
+ const slidesSpec = clusterSlides.map((s) => `
1375
+ - Slide ${s.slideIndex} [Phase: ${s.lessonPhase}] -> Layout: "${s.layoutId}"
1376
+ Title: "${s.title}"
1377
+ Pedagogical Goal: ${s.pedagogicalGoal}
1378
+ Key Bullet Targets: ${s.contentFocus.join("; ")}
1379
+ ${s.codeSnippetIntent ? `Code Focus: ${s.codeSnippetIntent}` : ""}
1380
+ ${s.visualIntent ? `Visual Focus: ${s.visualIntent}` : ""}
1381
+ `).join("\n");
1382
+ const systemPrompt = `
1383
+ ${skillPrompt}
1384
+
1385
+ ---
1386
+ ### OPERATIONAL GROUND RULES FOR CHUNK GENERATION:
1387
+ ${languageDirective}
1388
+ ${headingDirective}
1389
+ 1. **FOCUS ON CLUSTER ${clusterId}: "${clusterTitle}"**:
1390
+ Generate EXACTLY the ${clusterSlides.length} slides requested in the user prompt.
1391
+ 2. **ZERO ABBREVIATION / NO "// TODO"**:
1392
+ All code snippets MUST be real, fully authored, compilable code relevant to ${lessonFlow.lessonTitle}. Never write placeholders, stubs, or "<CODE>".
1393
+ 3. **MANDATORY 3-PART PRESENTER NOTES ON EVERY SLIDE**:
1394
+ Every slide object MUST have a "notes" field formatted with:
1395
+ - SCRIPT: 60-90s spoken teacher talk track with an intuitive analogy.
1396
+ - COLD CALL / CHECK: One targeted question to check for student understanding.
1397
+ - SCAFFOLDING / GOTCHA: One common misconception or bug to watch out for.
1398
+ 4. **OUTPUT FORMAT**:
1399
+ Output ONLY a valid JSON array of ${clusterSlides.length} slide objects.
1400
+ `.trim();
1401
+ const userPrompt = `
1402
+ ### LESSON GROUND TRUTH:
1403
+ - Lesson Title: "${lessonFlow.lessonTitle}"
1404
+ - Target Duration: ${lessonFlow.estimatedDuration}
1405
+ - Pedagogy: "${lessonFlow.pedagogicalModel.toUpperCase()}"
1406
+ - Language: "${language}"
1407
+
1408
+ ### LESSON PHASE CONTENT (SOURCE OF TRUTH):
1409
+ ${lessonExcerpt || lessonFlow.rawContent.slice(0, 4e3)}
1410
+
1411
+ ---
1412
+
1413
+ ### REQUIRED SLIDES TO GENERATE FOR THIS CLUSTER:
1414
+ ${slidesSpec}
1415
+
1416
+ ---
1417
+
1418
+ ### OUTPUT SCHEMA:
1419
+ Output a single JSON array of slide objects strictly matching the layout slots:
1420
+ \`\`\`json
1421
+ [
1422
+ {
1423
+ "id": "slide-${clusterSlides[0]?.slideIndex || 1}",
1424
+ "layoutId": "${clusterSlides[0]?.layoutId || "split-concept-code"}",
1425
+ "title": "${clusterSlides[0]?.title || "Slide Title"}",
1426
+ "slots": {
1427
+ "lead": "One clear, punchy subtitle or thesis statement",
1428
+ "bullets": [
1429
+ "First key insight (8-12 words max)",
1430
+ "Second key insight (8-12 words max)",
1431
+ "Third key insight (8-12 words max)"
1432
+ ],
1433
+ "code": "// Executable code here",
1434
+ "codeLanguage": "swift",
1435
+ "codeHighlight": "1-3",
1436
+ "card1Title": "...",
1437
+ "card1Desc": "..."
1438
+ },
1439
+ "notes": "SCRIPT: ...\\nCOLD CALL: ...\\nSCAFFOLDING: ..."
1440
+ }
1441
+ ]
1442
+ \`\`\`
1443
+ `.trim();
1444
+ return { systemPrompt, userPrompt };
1445
+ }
1446
+ var init_slideBatchPrompt = __esm({
1447
+ "src/ai/prompts/slideBatchPrompt.ts"() {
1448
+ }
1449
+ });
1450
+
1451
+ // src/services/slideProductionWorkflow.ts
1452
+ var slideProductionWorkflow_exports = {};
1453
+ __export(slideProductionWorkflow_exports, {
1454
+ executeSlideProductionWorkflow: () => executeSlideProductionWorkflow
1455
+ });
1456
+ function extractCleanJson(raw) {
1457
+ const fenceMatch = raw.match(/```(?:json)?\s*([\s\S]*?)\s*```/i);
1458
+ const candidate = fenceMatch ? fenceMatch[1] : raw;
1459
+ return candidate.trim();
1460
+ }
1461
+ async function executeSlideProductionWorkflow(options) {
1462
+ const {
1463
+ lessonMarkdown,
1464
+ lessonCode,
1465
+ lessonTitle,
1466
+ targetSlideCount = 20,
1467
+ stylePresetId = "blue-professional",
1468
+ language = "Vietnamese",
1469
+ languageDirective = "",
1470
+ headingDirective = "",
1471
+ satelliteContext,
1472
+ runnerOptions,
1473
+ onProgress
1474
+ } = options;
1475
+ let presentationKitSkills = null;
1476
+ let presentationKitCore = null;
1477
+ try {
1478
+ presentationKitSkills = await import('@thanh01.pmt/presentation-kit/skills');
1479
+ } catch {
1480
+ }
1481
+ try {
1482
+ presentationKitCore = await import('@thanh01.pmt/presentation-kit');
1483
+ } catch {
1484
+ }
1485
+ onProgress?.("@illustrator", `[1/4] Ph\xE2n t\xEDch m\u1EA1ch b\xE0i gi\u1EA3ng LESSON & L\u1EADp D\xE0n \xFD ${targetSlideCount} Slides...`);
1486
+ const lessonFlow = parseLessonFlow(lessonMarkdown);
1487
+ const stylePreset = presentationKitSkills?.getStylePreset ? presentationKitSkills.getStylePreset(stylePresetId) : { name: "Blue Professional" };
1488
+ const blueprintPrompt = buildSlideBlueprintPrompt({
1489
+ lessonFlow,
1490
+ targetSlideCount,
1491
+ stylePresetName: stylePreset?.name || "Blue Professional"
1492
+ });
1493
+ const rawBlueprint = await runCurriculumAIInference(
1494
+ [{ role: "user", content: blueprintPrompt }],
1495
+ satelliteContext,
1496
+ runnerOptions,
1497
+ (chunk, type) => {
1498
+ onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
1499
+ }
1500
+ );
1501
+ let blueprintItems = [];
1502
+ try {
1503
+ blueprintItems = JSON.parse(extractCleanJson(rawBlueprint));
1504
+ } catch {
1505
+ try {
1506
+ blueprintItems = JSON.parse(jsonrepair(extractCleanJson(rawBlueprint)));
1507
+ } catch (e) {
1508
+ console.warn(`[SlideProductionWorkflow] Failed parsing blueprint JSON, constructing fallback:`, e);
1509
+ blueprintItems = Array.from({ length: targetSlideCount }, (_, i) => ({
1510
+ slideIndex: i + 1,
1511
+ clusterId: Math.floor(i / 5) + 1,
1512
+ clusterTitle: `Cluster ${Math.floor(i / 5) + 1}`,
1513
+ lessonPhase: lessonFlow.phases[Math.min(i, lessonFlow.phases.length - 1)]?.phaseName || "Content",
1514
+ layoutId: i === 0 ? "hero-cover" : i === targetSlideCount - 1 ? "summary-takeaways" : "split-concept-code",
1515
+ title: `Slide ${i + 1}: ${lessonTitle}`,
1516
+ pedagogicalGoal: `Teach step ${i + 1} of ${lessonTitle}`,
1517
+ contentFocus: ["Key point 1", "Key point 2", "Key point 3"]
1518
+ }));
1519
+ }
1520
+ }
1521
+ const clustersMap = /* @__PURE__ */ new Map();
1522
+ for (const item of blueprintItems) {
1523
+ const cId = item.clusterId || Math.floor((item.slideIndex - 1) / 5) + 1;
1524
+ if (!clustersMap.has(cId)) clustersMap.set(cId, []);
1525
+ clustersMap.get(cId).push(item);
1526
+ }
1527
+ const clusters = Array.from(clustersMap.entries()).sort(([a], [b]) => a - b);
1528
+ const allGeneratedSlides = [];
1529
+ const skillPrompt = presentationKitSkills?.getFrontendSlidesSkillPrompt ? presentationKitSkills.getFrontendSlidesSkillPrompt({ stylePresetId }) : "";
1530
+ let clusterIdx = 0;
1531
+ for (const [cId, clusterSlides] of clusters) {
1532
+ clusterIdx++;
1533
+ const clusterTitle = clusterSlides[0]?.clusterTitle || `Giai \u0111o\u1EA1n ${clusterIdx}`;
1534
+ onProgress?.("@illustrator", `[2/4] Sinh chi ti\u1EBFt C\u1EE5m ${clusterIdx}/${clusters.length}: "${clusterTitle}" (${clusterSlides.length} slides)...`);
1535
+ const clusterPhaseNames = new Set(clusterSlides.map((s) => s.lessonPhase.toLowerCase()));
1536
+ const matchingPhases = lessonFlow.phases.filter(
1537
+ (p) => clusterPhaseNames.has(p.phaseName.toLowerCase())
1538
+ );
1539
+ const lessonExcerpt = matchingPhases.length > 0 ? matchingPhases.map((p) => `### ${p.phaseName}
1540
+ ${p.content}`).join("\n\n") : lessonFlow.rawContent.slice(0, 3500);
1541
+ const { systemPrompt, userPrompt } = buildSlideBatchPrompt({
1542
+ clusterId: cId,
1543
+ clusterTitle,
1544
+ clusterSlides,
1545
+ lessonFlow,
1546
+ lessonExcerpt,
1547
+ skillPrompt,
1548
+ language,
1549
+ languageDirective,
1550
+ headingDirective
1551
+ });
1552
+ const rawBatch = await runCurriculumAIInference(
1553
+ [
1554
+ { role: "system", content: systemPrompt },
1555
+ { role: "user", content: userPrompt }
1556
+ ],
1557
+ satelliteContext,
1558
+ runnerOptions,
1559
+ (chunk, type) => {
1560
+ onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
1561
+ }
1562
+ );
1563
+ let batchSlides = [];
1564
+ try {
1565
+ batchSlides = JSON.parse(extractCleanJson(rawBatch));
1566
+ } catch {
1567
+ try {
1568
+ batchSlides = JSON.parse(jsonrepair(extractCleanJson(rawBatch)));
1569
+ } catch (err) {
1570
+ console.warn(`[SlideProductionWorkflow] Batch ${cId} JSON parse failed, synthesizing slides:`, err);
1571
+ batchSlides = clusterSlides.map((s) => ({
1572
+ id: `slide-${s.slideIndex}`,
1573
+ layoutId: s.layoutId,
1574
+ title: s.title,
1575
+ slots: {
1576
+ lead: s.pedagogicalGoal,
1577
+ bullets: s.contentFocus,
1578
+ code: s.codeSnippetIntent || "// Executable demo code"
1579
+ },
1580
+ notes: `SCRIPT: Spoken explanation for ${s.title}.
1581
+ COLD CALL: What happens when this logic runs?
1582
+ SCAFFOLDING: Ensure proper syntax and indentation.`
1583
+ }));
1584
+ }
1585
+ }
1586
+ if (Array.isArray(batchSlides)) {
1587
+ allGeneratedSlides.push(...batchSlides);
1588
+ }
1589
+ }
1590
+ 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)...`);
1591
+ const normalizer = presentationKitCore?.normalizeSlideSlots;
1592
+ const normalizedSlides = allGeneratedSlides.map((s, idx) => {
1593
+ const base = normalizer ? normalizer(s) : s;
1594
+ if (!base.id) base.id = `slide-${idx + 1}`;
1595
+ return base;
1596
+ });
1597
+ const deckJson = {
1598
+ id: `deck-${lessonCode}`,
1599
+ title: lessonTitle,
1600
+ theme: stylePresetId,
1601
+ slides: normalizedSlides
1602
+ };
1603
+ let compiledHtml;
1604
+ const compiler = presentationKitCore?.compileHtmlDeck;
1605
+ if (compiler) {
1606
+ try {
1607
+ const compiled = compiler(deckJson);
1608
+ if (compiled?.html) {
1609
+ compiledHtml = compiled.html;
1610
+ }
1611
+ } catch (compErr) {
1612
+ console.warn(`[SlideProductionWorkflow] Failed compiling HTML deck:`, compErr);
1613
+ }
1614
+ }
1615
+ const markdownWrapper = `---
1616
+ id: "SLIDE_${lessonCode}"
1617
+ title: "${lessonTitle}"
1618
+ type: "SLIDE"
1619
+ format: "html-deck"
1620
+ engine: "html"
1621
+ phase: "P2"
1622
+ deliverable: "P2-T09"
1623
+ version: "v2.0"
1624
+ date: "${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}"
1625
+ ---
1626
+
1627
+ \`\`\`json
1628
+ ${JSON.stringify(deckJson, null, 2)}
1629
+ \`\`\`
1630
+ `;
1631
+ onProgress?.("@illustrator", `[4/4] Ho\xE0n t\u1EA5t b\u1ED9 tr\xECnh chi\u1EBFu HTML 20 trang \u0111\u1EA1t chu\u1EA9n Fixed 16:9 Stage!`);
1632
+ return {
1633
+ deckJson,
1634
+ compiledHtml,
1635
+ markdownWrapper,
1636
+ blueprint: blueprintItems,
1637
+ slideCount: normalizedSlides.length
1638
+ };
1639
+ }
1640
+ var init_slideProductionWorkflow = __esm({
1641
+ "src/services/slideProductionWorkflow.ts"() {
1642
+ init_lessonFlowParser();
1643
+ init_slideBlueprintPrompt();
1644
+ init_slideBatchPrompt();
1645
+ init_streamRunner();
1646
+ }
1647
+ });
1166
1648
  var LearningObjectiveRowSchema = z.object({
1167
1649
  code: z.string().describe('LO code, e.g. "LO1"'),
1168
1650
  objective: z.string().describe("Bloom-tagged learning objective"),
@@ -5448,6 +5930,11 @@ Every slide MUST include notes with:
5448
5930
  - Cold-Call: 1 check question
5449
5931
  - Scaffolding Tip: 1 analogy or hint
5450
5932
 
5933
+ ### \u26A0\uFE0F STRICT SLIDE FORMATTING INVARIANTS:
5934
+ 1. Every slide MUST store its content fields inside "slots": { ... }. NEVER put "title", "content", or points at the top level of a slide!
5935
+ 2. All code slots MUST contain real, executable, high-fidelity code. Never use placeholders like "<CODE>" or "...".
5936
+ 3. All point and card slots MUST contain concrete, rich pedagogical explanations. Never use placeholder dots or empty cards.
5937
+
5451
5938
  ### Output JSON Format:
5452
5939
  \`\`\`json
5453
5940
  {
@@ -25315,106 +25802,44 @@ ${buildHeadingDirective("QUIZ", slcMarkdown, targetLang)}`;
25315
25802
  const isHtmlEngine = options.slidesEngine === "html";
25316
25803
  if (isHtmlEngine) {
25317
25804
  let presentationKitAi = null;
25805
+ let presentationKitCore = null;
25318
25806
  try {
25319
25807
  presentationKitAi = await import('@thanh01.pmt/presentation-kit/ai');
25320
25808
  } catch {
25321
25809
  }
25322
- const slidePrompt = buildHtmlDeckSlidePrompt({
25810
+ try {
25811
+ presentationKitCore = await import('@thanh01.pmt/presentation-kit');
25812
+ } catch {
25813
+ }
25814
+ const { executeSlideProductionWorkflow: executeSlideProductionWorkflow2 } = await Promise.resolve().then(() => (init_slideProductionWorkflow(), slideProductionWorkflow_exports));
25815
+ const workflowResult = await executeSlideProductionWorkflow2({
25816
+ lessonMarkdown: lessonContent || "",
25323
25817
  lessonCode,
25324
25818
  lessonTitle,
25325
- pedagogyLabel,
25819
+ targetSlideCount: 20,
25820
+ stylePresetId: "blue-professional",
25821
+ language: targetLang || "Vietnamese",
25326
25822
  languageDirective,
25327
25823
  headingDirective: buildHeadingDirective("SLIDE", slcMarkdown, targetLang),
25328
- glossaryBlock: glossaryContext ? `[GLOSSARY TERMS (use these exact definitions)]:
25329
- ${glossaryContext}` : void 0,
25330
- customContract: presentationKitAi?.SLIDE_HTML_PROMPT_CONTRACT
25331
- });
25332
- const rawSlide = await runCurriculumAIInference(
25333
- [{ role: "user", content: slidePrompt }],
25334
25824
  satelliteContext,
25335
25825
  runnerOptions,
25336
- (chunk, type) => {
25337
- options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25338
- }
25339
- );
25340
- if (!rawSlide || rawSlide.startsWith("\u26A0\uFE0F") || rawSlide.length < 200) {
25341
- throw createAiInferenceError({
25342
- errorCode: "ERR_AI_RESPONSE_MALFORMED",
25343
- agent: "@illustrator",
25344
- artifactType: "SLIDE",
25345
- lessonId: lessonCode,
25346
- message: `Agent @illustrator failed to author valid HTML Slides for ${lessonCode}.`,
25347
- rawError: rawSlide || "Empty AI response"
25348
- });
25349
- }
25350
- let deckJson = null;
25351
- const extractCleanJson = (str) => {
25352
- const fenceMatch = str.match(/```(?:json)?\s*([\s\S]*?)\s*```/i);
25353
- const candidate = fenceMatch ? fenceMatch[1] : str;
25354
- return candidate.trim();
25355
- };
25356
- try {
25357
- deckJson = JSON.parse(extractCleanJson(rawSlide));
25358
- } catch {
25359
- try {
25360
- const { jsonrepair: jsonrepair2 } = await import('jsonrepair');
25361
- deckJson = JSON.parse(jsonrepair2(extractCleanJson(rawSlide)));
25362
- } catch {
25363
- }
25364
- }
25365
- let validation = presentationKitAi?.validateHtmlSlideDeck ? presentationKitAi.validateHtmlSlideDeck(deckJson, true) : deckJson && Array.isArray(deckJson.slides) ? { valid: true, score: 95, issues: [], slideCount: deckJson.slides.length, notesCoveragePercent: 100 } : { valid: false, score: 0, issues: [{ message: "Malformed JSON slide deck" }], slideCount: 0, notesCoveragePercent: 0 };
25366
- if (!validation.valid && presentationKitAi?.validateHtmlSlideDeck) {
25367
- const repairIssues = (validation.issues || []).map((i) => `- Slide ${i.slideIndex ?? "?"}: ${i.message}`).join("\n");
25368
- onProgress?.("@illustrator", `\u26A0\uFE0F HTML slide deck failed schema validation \u2014 retrying once with targeted repair feedback...`);
25369
- const repairPrompt = `Your previous slide deck failed strict schema validation:
25370
- ${repairIssues}
25371
-
25372
- Fix ALL issues and output the complete corrected JSON object strictly matching the schema:`;
25373
- const repairedRaw = await runCurriculumAIInference(
25374
- [{ role: "user", content: repairPrompt }],
25375
- satelliteContext,
25376
- runnerOptions,
25377
- (chunk, type) => {
25378
- options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25379
- }
25380
- );
25381
- try {
25382
- deckJson = JSON.parse(extractCleanJson(repairedRaw));
25383
- validation = presentationKitAi.validateHtmlSlideDeck(deckJson, true);
25384
- } catch {
25385
- try {
25386
- const { jsonrepair: jsonrepair2 } = await import('jsonrepair');
25387
- deckJson = JSON.parse(jsonrepair2(extractCleanJson(repairedRaw)));
25388
- validation = presentationKitAi.validateHtmlSlideDeck(deckJson, true);
25389
- } catch {
25390
- }
25826
+ onProgress: (agent, msg, meta) => {
25827
+ options.onProgress?.(agent, msg, meta || { type: "content", artifactType: "SLIDE" });
25391
25828
  }
25392
- }
25393
- const markdownWrapper = `---
25394
- id: "SLIDE_${lessonCode}"
25395
- title: "${titleHeader(lessonTitle)}"
25396
- type: "SLIDE"
25397
- format: "html-deck"
25398
- engine: "html"
25399
- phase: "P2"
25400
- deliverable: "P2-T09"
25401
- version: "v1.0"
25402
- date: "${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}"
25403
- ---
25404
-
25405
- \`\`\`json
25406
- ${JSON.stringify(deckJson || {}, null, 2)}
25407
- \`\`\`
25408
- `;
25829
+ });
25830
+ let deckJson = workflowResult.deckJson;
25831
+ const markdownWrapper = workflowResult.markdownWrapper;
25832
+ let validation = presentationKitAi?.validateHtmlSlideDeck ? presentationKitAi.validateHtmlSlideDeck(deckJson, true) : deckJson && Array.isArray(deckJson.slides) ? { valid: true, score: 95, issues: [], slideCount: deckJson.slides.length} : { valid: false, score: 0, issues: [{ message: "Malformed JSON slide deck" }], slideCount: 0};
25409
25833
  await storage.saveArtifact(projectId, slideRelPath, markdownWrapper);
25410
25834
  producedArtifacts.push(`SLIDE_${lessonCode}.md`);
25411
25835
  if (deckJson) {
25412
25836
  const deckJsonStr = JSON.stringify(deckJson, null, 2);
25413
25837
  await storage.saveArtifact(projectId, `_content/${unitCode}/SLIDE_${lessonCode}.deck.json`, deckJsonStr);
25414
25838
  producedArtifacts.push(`SLIDE_${lessonCode}.deck.json`);
25415
- if (presentationKitAi?.compileHtmlDeck) {
25839
+ const compiler = presentationKitCore?.compileHtmlDeck || presentationKitAi?.compileHtmlDeck;
25840
+ if (compiler) {
25416
25841
  try {
25417
- const compiled = presentationKitAi.compileHtmlDeck(deckJson);
25842
+ const compiled = compiler(deckJson);
25418
25843
  if (compiled?.html) {
25419
25844
  await storage.saveArtifact(projectId, `_content/${unitCode}/SLIDE_${lessonCode}.html`, compiled.html);
25420
25845
  producedArtifacts.push(`SLIDE_${lessonCode}.html`);
@@ -28042,6 +28467,9 @@ function isTranslationDue(target, context) {
28042
28467
  const total = context.totalLessonsByUnit[unit] ?? 0;
28043
28468
  return total > 0 && done >= total;
28044
28469
  }
28470
+
28471
+ // src/services/index.ts
28472
+ init_slideProductionWorkflow();
28045
28473
  var LocalWorkspaceManager = class {
28046
28474
  baseDir;
28047
28475
  constructor(baseDir) {
@@ -30390,6 +30818,6 @@ function renderMediaPlaceholder(entry) {
30390
30818
  return `> \u{1F5BC}\uFE0F [\u1EA2nh \u0111ang ch\u1EDD: ${entry.name} \u2014 s\u1EBD \u0111\u01B0\u1EE3c t\u1EA1o sau khi duy\u1EC7t media]`;
30391
30819
  }
30392
30820
 
30393
- export { ACT_TEMPLATE, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, AcademicAuditor, ActiveLearningWorkflowSchema, ActivityLabSchema, ActivitySeqRowSchema, ActivityStepSchema, ArtifactContractRowSchema, AssessmentMapRowSchema, AssessmentObjectiveSchema, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BUNDLED_STANDARDS_PACK_IDS, BellRingerDaySchema, BellRingerSchema, BloomHintSchema, BloomLevelSchema, BloomTaxonomyEvaluator, BronzeTierSchema, CERConclusionSchema, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CardTierEnum, ChoiceBoardRubricRowSchema, ChoiceBoardSchema, ChoiceRuleSchema, ChoiceSquareSchema, ClassificationSchema, CodeHardwareFeasibilityEvaluator, CodeLabSchema, CodeSnippetSchema, CompetencyRubricRowSchema, ComputationalThinkingSchema, ConstructiveAlignmentEvaluator, CoreConceptSchema, CourseObjectiveSchema, CoverageReportSchema, CrossArtifactDriftEvaluator, CurriculumArtifactSchema, CurriculumError, CurriculumPlanSchema, CurriculumQualityReportSchema, DEFAULT_ARTIFACT_STREAM_IDLE_MS, DEFAULT_ARTIFACT_STREAM_TOTAL_MS, DEFAULT_ENABLED_PROVIDERS, DEFAULT_GATE_SETTINGS, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DEFAULT_VIETNAMESE_SECTION_HEADINGS, DependencyEdgeSchema, DepthAssignmentSchema, DepthLevelSchema, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuestionSchema, DiagnosticQuizSchema, EDPPhaseEnum, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, EntryLevelSchema, ExitTicketBugHuntSchema, ExitTicketMetacognitionSchema, ExitTicketQuickItemSchema, ExitTicketRecallPromptSchema, ExitTicketSchema, ExperimentalDesignSchema, ExpositionApprovalError, ExtensionChallengeSchema, ExtensionSchema, FileSystemCurriculumAdapter, FiveEFlowPhaseSchema, FiveEInstructionalEvaluator, FiveEPhaseEnum, FrameworkMappingSchema, FrameworkPackManifestSchema, FrameworkPackSchema, FrameworkStatementSchema, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, GlossaryQuickRefRowSchema, GlossarySchema, GlossaryTermSchema, GoldTierSchema, GradeBandSchema, GraphicOrganizerItemSchema, GraphicOrganizerSchema, HANDOUT_TEMPLATE, HandoutSchema, HandoutSectionSchema, InstructionSectionSchema, InstructionStepSchema, JudgeCriterionSchema, LAYER_IDLE_BUDGET_MS, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, LLMJudgeEngine, LabTierTaskSchema, LearningObjectiveInputSchema, LearningObjectiveRowSchema, LessonFlowPhaseSchema, LessonPlan5ESchema, LessonPlanEDPSchema, LessonPlanSchema, LessonSectionSchema, LocalWorkspaceManager, MappingKindSchema, MarpSlideSchema, MediaError, MediaLedger, MentorCheatsheetSchema, MilestoneInputSchema, MisconceptionEvaluator, MisconceptionSchema, ModelPolicyResolver, NVIDIA_MODELS, NodeKindSchema, OrganizerTypeEnum, PROJECT_INSTRUCTION_TEMPLATE, PhaseInputSchema, PlanConstraintsSchema, PlannerInputSchema, PlanningGraphSchema, PlanningNodeSchema, PrerequisiteDecisionEntrySchema, PrerequisiteDecisionSchema, ProductGoalSchema, ProgressiveHintsSchema, ProjectGraphSchema, ProjectInstructionSchema, ProjectProfileSchema, QUIZ_TEMPLATE, QualityAuditVerdictSchema, QuizOptionSchema, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, RecordProvenanceSchema, ResourceMapRowSchema, ReviewGameExportRowSchema, ReviewGameQuestionSchema, ReviewGameSchema, RoadmapInputSchema, RotationStationSchema, RubricCriteriaSchema, RubricSchema, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_CANONICAL_METHODOLOGY, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STANDARD_REF_REGEX, STANDARD_SOT_FILES, STATION_ROTATION_TEMPLATE, ScaffoldDecisionEntrySchema, ScaffoldDecisionSchema, ScienceLabSchema, ScoringRubricRowSchema, SelfLabSchema, SelfPacedBundleSchema, SelfPacedChallengeSchema, SessionPlanSchema, SilverTierSchema, SlideDeckSchema, StandardizedTermRowSchema, StandardsRegistryAdapter, StationRecordRowSchema, StationRotationSchema, StationTypeEnum, SupabaseCurriculumAdapter, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TaskCardSchema, TaskCardsSchema, TeacherGuideSchema, TeachingScriptPhaseSchema, TierLevelEnum, TierObjectiveSchema, TieredPracticeSchema, TranslationPolicySchema, TroubleshootingEntrySchema, TroubleshootingRowSchema, UnitPlanSchema, UserJourneySchema, WORKSHEET_TEMPLATE, WorksheetItemSchema, WorksheetItemTypeEnum, WorksheetPartSchema, WorksheetSchema, activityTools, analystTools, analyzeProjectCreationIntent, assertAcyclic, assessorTools, auditCurriculumQualityFlow, auditQualityReport, buildActivityPrompt, buildCodeLabPrompt, buildCurriculumContext, buildCurriculumPlan, buildDeliveryPackages, buildDiagnosticQuizPrompt, buildExpositionContext, buildExpositionExcerpt, buildExtensionPrompt, buildHandoutPrompt, buildHeadingDirective, buildHtmlDeckSlidePrompt, buildImagePrompt, buildJudgePrompt, buildLanguageDirective, buildLessonExcerpt, buildLessonMasterPrompt, buildMarpMarkdownSlidePrompt, buildProjectInstructionPrompt, buildSectionAwareExcerpt, buildSelfLabPrompt, buildSessionSliceContext, buildSlidesPrompt, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, buildTeacherGuidePrompt, buildWorksheetPrompt, closeTruncatedJson, computeContentHash, computePackingSpec, conductPreliminaryResearch, contentTools, convertRoadmapToFoundationSot, createAiInferenceError, createContextMissingError, createCurriculumStorage, createIdleAbortController, createStreamAbortController, createStreamAbortSignal, createStreamChunkExtractor, curateMediaLedger, designerTools, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, evaluateStandardsCoverage, executeCurriculumCommand, exportAllProjectQuizzes, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStandardRefs, extractStreamChunk, extractThoughtAndContent, findStandardStatement, formatQuizzesToCsv, fulfillMediaLedger, gateModeFor, generateActivityFlow, generateCodeLabFlow, generateDiagnosticQuizFlow, generateEducationalImage, generateExtensionFlow, generateHandoutFlow, generateLessonMasterFlow, generateMilestoneCurriculumBundle, generatePhase1SotArtifacts, generatePhase2SotArtifacts, generateProjectInstruction, generateProjectInstructionFlow, generateRoadmapCurriculum, generateSelfLabFlow, generateSelfPacedBundle, generateSingleArtifact, generateSlidesFlow, generateTeacherGuideFlow, generateWorksheetFlow, getAIModel, getArtifactMetadata, getDesignatedFallbackChain, getDesignatedFallbackConfig, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, illustratorTools, importRoadmapToProject, ingestProjectGraphIntoProject, initializeProjectInStorage, injectMediaIntoMarkdown, isExpositionFresh, isModelAllowed, isProviderEnabled, isTranslationDue, lintAndSanitizeArtifact, lintCurriculumFramework, lintFrameworkPack, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, packagerTools, parseGateSettings, parseQuizMarkdown, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, publishToGitHub, publishToSupabase, rankGenCandidates, renderFrameworkFromPlan, renderMediaPlaceholder, researcherTools, resolveGateSettings, resolveStandardsPacks, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, reviewerTools, runCurriculumAIInference, safeParseJson, searchEducationalImages, searchEducationalVideos, selectStatementsForLesson, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, slugifyProjectName, streamCurriculumAIInference, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLLMWithFallback, streamLayerPrefillWithFallback, streamLessonMasterFlow, streamSelfLabFlow, stripLlmJsonWrappers, targetLanguageDisplayName, techSmeTools, topoSort, uploadAssetToBucket, validateArtifactDependencies, validateCurriculumPlan, validateFrameworkPack, validateMarkdownTables, validateMermaidSyntax, withAutoRepair };
30821
+ export { ACT_TEMPLATE, ARTIFACT_DEPENDENCY_ROUTING, ARTIFACT_EXECUTION_ORDER, AcademicAuditor, ActiveLearningWorkflowSchema, ActivityLabSchema, ActivitySeqRowSchema, ActivityStepSchema, ArtifactContractRowSchema, AssessmentMapRowSchema, AssessmentObjectiveSchema, BELL_RINGER_TEMPLATE, BLOOM_ACTION_VERBS, BOM_TEMPLATE, BUNDLED_STANDARDS_PACK_IDS, BellRingerDaySchema, BellRingerSchema, BloomHintSchema, BloomLevelSchema, BloomTaxonomyEvaluator, BronzeTierSchema, CERConclusionSchema, CHOICE_BOARD_TEMPLATE, CODE_LAB_TEMPLATE, CURRICULUM_SLASH_COMMANDS, CardTierEnum, ChoiceBoardRubricRowSchema, ChoiceBoardSchema, ChoiceRuleSchema, ChoiceSquareSchema, ClassificationSchema, CodeHardwareFeasibilityEvaluator, CodeLabSchema, CodeSnippetSchema, CompetencyRubricRowSchema, ComputationalThinkingSchema, ConstructiveAlignmentEvaluator, CoreConceptSchema, CourseObjectiveSchema, CoverageReportSchema, CrossArtifactDriftEvaluator, CurriculumArtifactSchema, CurriculumError, CurriculumPlanSchema, CurriculumQualityReportSchema, DEFAULT_ARTIFACT_STREAM_IDLE_MS, DEFAULT_ARTIFACT_STREAM_TOTAL_MS, DEFAULT_ENABLED_PROVIDERS, DEFAULT_GATE_SETTINGS, DEFAULT_KX_PRIORITIES, DEFAULT_LESSON_PRIORITIES, DEFAULT_STREAM_IDLE_MS, DEFAULT_STREAM_TOTAL_MS, DEFAULT_VIETNAMESE_SECTION_HEADINGS, DependencyEdgeSchema, DepthAssignmentSchema, DepthLevelSchema, DeterministicPipelineRunner, DeterministicStructuralLinter, DiagnosticQuestionSchema, DiagnosticQuizSchema, EDPPhaseEnum, EXIT_TICKET_TEMPLATE, EXPOSITION_REL, EXT_TEMPLATE, EntryLevelSchema, ExitTicketBugHuntSchema, ExitTicketMetacognitionSchema, ExitTicketQuickItemSchema, ExitTicketRecallPromptSchema, ExitTicketSchema, ExperimentalDesignSchema, ExpositionApprovalError, ExtensionChallengeSchema, ExtensionSchema, FileSystemCurriculumAdapter, FiveEFlowPhaseSchema, FiveEInstructionalEvaluator, FiveEPhaseEnum, FrameworkMappingSchema, FrameworkPackManifestSchema, FrameworkPackSchema, FrameworkStatementSchema, GLOSSARY_TEMPLATE, GRAPHIC_ORGANIZER_TEMPLATE, GlossaryQuickRefRowSchema, GlossarySchema, GlossaryTermSchema, GoldTierSchema, GradeBandSchema, GraphicOrganizerItemSchema, GraphicOrganizerSchema, HANDOUT_TEMPLATE, HandoutSchema, HandoutSectionSchema, InstructionSectionSchema, InstructionStepSchema, JudgeCriterionSchema, LAYER_IDLE_BUDGET_MS, LAYER_TOTAL_BUDGET_MS, LESSON_PLAN_TEMPLATE, LLMJudgeEngine, LabTierTaskSchema, LearningObjectiveInputSchema, LearningObjectiveRowSchema, LessonFlowPhaseSchema, LessonPlan5ESchema, LessonPlanEDPSchema, LessonPlanSchema, LessonSectionSchema, LocalWorkspaceManager, MappingKindSchema, MarpSlideSchema, MediaError, MediaLedger, MentorCheatsheetSchema, MilestoneInputSchema, MisconceptionEvaluator, MisconceptionSchema, ModelPolicyResolver, NVIDIA_MODELS, NodeKindSchema, OrganizerTypeEnum, PROJECT_INSTRUCTION_TEMPLATE, PhaseInputSchema, PlanConstraintsSchema, PlannerInputSchema, PlanningGraphSchema, PlanningNodeSchema, PrerequisiteDecisionEntrySchema, PrerequisiteDecisionSchema, ProductGoalSchema, ProgressiveHintsSchema, ProjectGraphSchema, ProjectInstructionSchema, ProjectProfileSchema, QUIZ_TEMPLATE, QualityAuditVerdictSchema, QuizOptionSchema, REVIEW_GAME_TEMPLATE, RUBRIC_TEMPLATE, RecordProvenanceSchema, ResourceMapRowSchema, ReviewGameExportRowSchema, ReviewGameQuestionSchema, ReviewGameSchema, RoadmapInputSchema, RotationStationSchema, RubricCriteriaSchema, RubricSchema, SCIENCE_LAB_TEMPLATE, SELF_LAB_TEMPLATE, SLIDE_CANONICAL_METHODOLOGY, SLIDE_LAYOUT_PRESETS, SLIDE_TEMPLATE, STANDARD_REF_REGEX, STANDARD_SOT_FILES, STATION_ROTATION_TEMPLATE, ScaffoldDecisionEntrySchema, ScaffoldDecisionSchema, ScienceLabSchema, ScoringRubricRowSchema, SelfLabSchema, SelfPacedBundleSchema, SelfPacedChallengeSchema, SessionPlanSchema, SilverTierSchema, SlideDeckSchema, StandardizedTermRowSchema, StandardsRegistryAdapter, StationRecordRowSchema, StationRotationSchema, StationTypeEnum, SupabaseCurriculumAdapter, TASK_CARDS_TEMPLATE, TEACHER_GUIDE_TEMPLATE, TIERED_PRACTICE_TEMPLATE, TaskCardSchema, TaskCardsSchema, TeacherGuideSchema, TeachingScriptPhaseSchema, TierLevelEnum, TierObjectiveSchema, TieredPracticeSchema, TranslationPolicySchema, TroubleshootingEntrySchema, TroubleshootingRowSchema, UnitPlanSchema, UserJourneySchema, WORKSHEET_TEMPLATE, WorksheetItemSchema, WorksheetItemTypeEnum, WorksheetPartSchema, WorksheetSchema, activityTools, analystTools, analyzeProjectCreationIntent, assertAcyclic, assessorTools, auditCurriculumQualityFlow, auditQualityReport, buildActivityPrompt, buildCodeLabPrompt, buildCurriculumContext, buildCurriculumPlan, buildDeliveryPackages, buildDiagnosticQuizPrompt, buildExpositionContext, buildExpositionExcerpt, buildExtensionPrompt, buildHandoutPrompt, buildHeadingDirective, buildHtmlDeckSlidePrompt, buildImagePrompt, buildJudgePrompt, buildLanguageDirective, buildLessonExcerpt, buildLessonMasterPrompt, buildMarpMarkdownSlidePrompt, buildProjectInstructionPrompt, buildSectionAwareExcerpt, buildSelfLabPrompt, buildSessionSliceContext, buildSlidesPrompt, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, buildTeacherGuidePrompt, buildWorksheetPrompt, closeTruncatedJson, computeContentHash, computePackingSpec, conductPreliminaryResearch, contentTools, convertRoadmapToFoundationSot, createAiInferenceError, createContextMissingError, createCurriculumStorage, createIdleAbortController, createStreamAbortController, createStreamAbortSignal, createStreamChunkExtractor, curateMediaLedger, designerTools, detectProjectPedagogy, ensureExpositionForLesson, ensureKnowledgeExposition, evaluateStandardsCoverage, executeCurriculumCommand, executeSlideProductionWorkflow, exportAllProjectQuizzes, expositionCacheKey, extractScopeSequenceRows, extractSectionHeadingsFromSLC, extractSessionSlice, extractStandardRefs, extractStreamChunk, extractThoughtAndContent, findStandardStatement, formatQuizzesToCsv, fulfillMediaLedger, gateModeFor, generateActivityFlow, generateCodeLabFlow, generateDiagnosticQuizFlow, generateEducationalImage, generateExtensionFlow, generateHandoutFlow, generateLessonMasterFlow, generateMilestoneCurriculumBundle, generatePhase1SotArtifacts, generatePhase2SotArtifacts, generateProjectInstruction, generateProjectInstructionFlow, generateRoadmapCurriculum, generateSelfLabFlow, generateSelfPacedBundle, generateSingleArtifact, generateSlidesFlow, generateTeacherGuideFlow, generateWorksheetFlow, getAIModel, getArtifactMetadata, getDesignatedFallbackChain, getDesignatedFallbackConfig, getLessonMetadata, getProjectArtifactScope, getProjectStatusReport, getSlideLayoutPresetById, getSlideLayoutPresetsByCategory, getSmartResumeContext, glossaryTermsForSession, illustratorTools, importRoadmapToProject, ingestProjectGraphIntoProject, initializeProjectInStorage, injectMediaIntoMarkdown, isExpositionFresh, isModelAllowed, isProviderEnabled, isTranslationDue, lintAndSanitizeArtifact, lintCurriculumFramework, lintFrameworkPack, loadCurriculumTemplate, loadSotTemplate, normalizePlanningGraph, normalizeSlcContract, packagerTools, parseGateSettings, parseQuizMarkdown, parseRoadmapJsonToProjectPayload, produceBatchLessons, produceSingleLesson, publishToGitHub, publishToSupabase, rankGenCandidates, renderFrameworkFromPlan, renderMediaPlaceholder, researcherTools, resolveGateSettings, resolveStandardsPacks, resolveStreamBudget, resolveTargetLanguageCode, resolveTranslationTargets, reviewerTools, runCurriculumAIInference, safeParseJson, searchEducationalImages, searchEducationalVideos, selectStatementsForLesson, serializeActivityToMarkdown, serializeCodeLabToMarkdown, serializeDiagnosticQuizToMarkdown, serializeHandoutToMarkdown, serializeLessonToMarkdown, serializeProjectInstructionToMarkdown, serializeSelfLabToMarkdown, slugifyProjectName, streamCurriculumAIInference, streamCurriculumAIInferenceWithTools, streamDiagnosticQuizFlow, streamLLMWithFallback, streamLayerPrefillWithFallback, streamLessonMasterFlow, streamSelfLabFlow, stripLlmJsonWrappers, targetLanguageDisplayName, techSmeTools, topoSort, uploadAssetToBucket, validateArtifactDependencies, validateCurriculumPlan, validateFrameworkPack, validateMarkdownTables, validateMermaidSyntax, withAutoRepair };
30394
30822
  //# sourceMappingURL=index.mjs.map
30395
30823
  //# sourceMappingURL=index.mjs.map