@thanh01.pmt/curriculum-kit 1.4.11 → 1.4.13

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,493 @@ 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, 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
+ const countGuidance = targetSlideCount ? `The target is approximately ${targetSlideCount} slides.` : `Determine the organic, optimal number of slides (typically 12 to 25 slides) based directly on the number of activities, instructional moves, and depth of content in the LESSON plan.`;
1290
+ return `
1291
+ You are @illustrator, Chief Slide Architect for the Course Builder OS.
1292
+ Your task is to analyze the canonical LESSON plan and architect an authoritative, high-fidelity **SLIDE BLUEPRINT**.
1293
+ ${countGuidance}
1294
+
1295
+ ### \u{1F3DB}\uFE0F PEDAGOGICAL GROUND TRUTH (FROM CANONICAL LESSON):
1296
+ - Lesson Title: "${lessonFlow.lessonTitle}"
1297
+ - Pedagogical Framework: "${lessonFlow.pedagogicalModel.toUpperCase()}"
1298
+ - Target Duration: ${lessonFlow.estimatedDuration}
1299
+ - Active Visual Style: "${stylePresetName}"
1300
+ ${lessonFlow.slideContract ? `- Slide Artifact Contract: "${lessonFlow.slideContract}"` : ""}
1301
+
1302
+ ### \u{1F5FA}\uFE0F CANONICAL ACTIVITY SEQUENCE:
1303
+ ${activitiesSummary || "Standard phased sequence"}
1304
+
1305
+ ### \u{1F4D6} LESSON FLOW EXCERPT:
1306
+ ${phasesSummary || lessonFlow.rawContent.slice(0, 3e3)}
1307
+
1308
+ ---
1309
+
1310
+ ### \u{1F3AF} ARCHITECTURAL RULES (STRICTLY INVARIANT):
1311
+ 1. **ORGANIC PEDAGOGICAL FIDELITY (1-TO-1 PROJECTION)**:
1312
+ - The slide sequence MUST follow the EXACT flow of the LESSON phases (${lessonFlow.pedagogicalModel.toUpperCase()}).
1313
+ - The number of slides is determined by the substance of the lesson \u2014 do NOT stretch thin content or cram rich multi-step labs into too few slides.
1314
+ - Do NOT invent artificial phases that do not exist in the lesson plan.
1315
+ - For example:
1316
+ * If 5E: Engage -> Explore -> Explain -> Elaborate -> Evaluate.
1317
+ * If EDP: Ask/Problem -> Imagine & Plan -> Create & Prototype -> Test & Debug -> Improve & Share.
1318
+ * If PBL: Driving Question -> Inquiry -> Milestone Sprint -> Review & Exhibition.
1319
+
1320
+ 2. **CHUNKY CLUSTERS (4 TO 6 SLIDES PER CLUSTER)**:
1321
+ - Partition the slides into natural clusters corresponding to the major pedagogical transitions in the lesson.
1322
+ - Each cluster MUST contain 4 to 6 slides to ensure downstream token generation remains focused, high-fidelity, and non-repetitive.
1323
+
1324
+ 3. **SEMANTIC LAYOUT SLOTS (CHOOSE FROM VERIFIED TEMPLATES)**:
1325
+ Use one of these valid layoutIds for each slide:
1326
+ - \`hero-cover\`: Title, subtitle, topic badge, metadata.
1327
+ - \`split-concept-code\`: Left side explanation/bullets, right side prominent code card or diagram.
1328
+ - \`two-columns-compare\`: Side-by-side comparison (Before vs After, Scratch vs Swift, Theory vs Practice).
1329
+ - \`three-cards-grid\`: 3 architectural pillars, components, or principles.
1330
+ - \`timeline-steps\`: Step-by-step workflow, pipeline sequence, or execution trace.
1331
+ - \`metric-callout\`: High-impact statistical or performance highlight.
1332
+ - \`checkpoint-quiz\`: Formative diagnostic question with multiple choice.
1333
+ - \`tiered-practice-3cards\`: Bronze, Silver, Gold hands-on challenge specs.
1334
+ - \`summary-takeaways\`: Final recap, key rules, and next milestone.
1335
+
1336
+ ---
1337
+
1338
+ ### \u{1F4E4} OUTPUT FORMAT:
1339
+ Output ONLY a valid JSON array of ${targetSlideCount} objects. Do NOT include markdown text outside the JSON.
1340
+ Format:
1341
+ \`\`\`json
1342
+ [
1343
+ {
1344
+ "slideIndex": 1,
1345
+ "clusterId": 1,
1346
+ "clusterTitle": "Opening & Hook",
1347
+ "lessonPhase": "Engage",
1348
+ "layoutId": "hero-cover",
1349
+ "title": "Title of Slide 1",
1350
+ "pedagogicalGoal": "Specific learning goal of this slide",
1351
+ "contentFocus": ["Bullet 1 focus", "Bullet 2 focus"],
1352
+ "codeSnippetIntent": "Description of code snippet to show, if any",
1353
+ "visualIntent": "Description of visual diagram to display, if any"
1354
+ }
1355
+ ]
1356
+ \`\`\`
1357
+ `.trim();
1358
+ }
1359
+ var init_slideBlueprintPrompt = __esm({
1360
+ "src/ai/prompts/slideBlueprintPrompt.ts"() {
1361
+ }
1362
+ });
1363
+
1364
+ // src/ai/prompts/slideBatchPrompt.ts
1365
+ function buildSlideBatchPrompt(params) {
1366
+ const {
1367
+ clusterId,
1368
+ clusterTitle,
1369
+ clusterSlides,
1370
+ lessonFlow,
1371
+ lessonExcerpt,
1372
+ skillPrompt,
1373
+ language = "Vietnamese",
1374
+ languageDirective = "",
1375
+ headingDirective = ""
1376
+ } = params;
1377
+ const slidesSpec = clusterSlides.map((s) => `
1378
+ - Slide ${s.slideIndex} [Phase: ${s.lessonPhase}] -> Layout: "${s.layoutId}"
1379
+ Title: "${s.title}"
1380
+ Pedagogical Goal: ${s.pedagogicalGoal}
1381
+ Key Bullet Targets: ${s.contentFocus.join("; ")}
1382
+ ${s.codeSnippetIntent ? `Code Focus: ${s.codeSnippetIntent}` : ""}
1383
+ ${s.visualIntent ? `Visual Focus: ${s.visualIntent}` : ""}
1384
+ `).join("\n");
1385
+ const systemPrompt = `
1386
+ ${skillPrompt}
1387
+
1388
+ ---
1389
+ ### OPERATIONAL GROUND RULES FOR CHUNK GENERATION:
1390
+ ${languageDirective}
1391
+ ${headingDirective}
1392
+ 1. **FOCUS ON CLUSTER ${clusterId}: "${clusterTitle}"**:
1393
+ Generate EXACTLY the ${clusterSlides.length} slides requested in the user prompt.
1394
+ 2. **ZERO ABBREVIATION / NO "// TODO"**:
1395
+ All code snippets MUST be real, fully authored, compilable code relevant to ${lessonFlow.lessonTitle}. Never write placeholders, stubs, or "<CODE>".
1396
+ 3. **MANDATORY 3-PART PRESENTER NOTES ON EVERY SLIDE**:
1397
+ Every slide object MUST have a "notes" field formatted with:
1398
+ - SCRIPT: 60-90s spoken teacher talk track with an intuitive analogy.
1399
+ - COLD CALL / CHECK: One targeted question to check for student understanding.
1400
+ - SCAFFOLDING / GOTCHA: One common misconception or bug to watch out for.
1401
+ 4. **OUTPUT FORMAT**:
1402
+ Output ONLY a valid JSON array of ${clusterSlides.length} slide objects.
1403
+ `.trim();
1404
+ const userPrompt = `
1405
+ ### LESSON GROUND TRUTH:
1406
+ - Lesson Title: "${lessonFlow.lessonTitle}"
1407
+ - Target Duration: ${lessonFlow.estimatedDuration}
1408
+ - Pedagogy: "${lessonFlow.pedagogicalModel.toUpperCase()}"
1409
+ - Language: "${language}"
1410
+
1411
+ ### LESSON PHASE CONTENT (SOURCE OF TRUTH):
1412
+ ${lessonExcerpt || lessonFlow.rawContent.slice(0, 4e3)}
1413
+
1414
+ ---
1415
+
1416
+ ### REQUIRED SLIDES TO GENERATE FOR THIS CLUSTER:
1417
+ ${slidesSpec}
1418
+
1419
+ ---
1420
+
1421
+ ### OUTPUT SCHEMA:
1422
+ Output a single JSON array of slide objects strictly matching the layout slots:
1423
+ \`\`\`json
1424
+ [
1425
+ {
1426
+ "id": "slide-${clusterSlides[0]?.slideIndex || 1}",
1427
+ "layoutId": "${clusterSlides[0]?.layoutId || "split-concept-code"}",
1428
+ "title": "${clusterSlides[0]?.title || "Slide Title"}",
1429
+ "slots": {
1430
+ "lead": "One clear, punchy subtitle or thesis statement",
1431
+ "bullets": [
1432
+ "First key insight (8-12 words max)",
1433
+ "Second key insight (8-12 words max)",
1434
+ "Third key insight (8-12 words max)"
1435
+ ],
1436
+ "code": "// Executable code here",
1437
+ "codeLanguage": "swift",
1438
+ "codeHighlight": "1-3",
1439
+ "card1Title": "...",
1440
+ "card1Desc": "..."
1441
+ },
1442
+ "notes": "SCRIPT: ...\\nCOLD CALL: ...\\nSCAFFOLDING: ..."
1443
+ }
1444
+ ]
1445
+ \`\`\`
1446
+ `.trim();
1447
+ return { systemPrompt, userPrompt };
1448
+ }
1449
+ var init_slideBatchPrompt = __esm({
1450
+ "src/ai/prompts/slideBatchPrompt.ts"() {
1451
+ }
1452
+ });
1453
+
1454
+ // src/services/slideProductionWorkflow.ts
1455
+ var slideProductionWorkflow_exports = {};
1456
+ __export(slideProductionWorkflow_exports, {
1457
+ executeSlideProductionWorkflow: () => executeSlideProductionWorkflow
1458
+ });
1459
+ function extractCleanJson(raw) {
1460
+ const fenceMatch = raw.match(/```(?:json)?\s*([\s\S]*?)\s*```/i);
1461
+ const candidate = fenceMatch ? fenceMatch[1] : raw;
1462
+ return candidate.trim();
1463
+ }
1464
+ async function executeSlideProductionWorkflow(options) {
1465
+ const {
1466
+ lessonMarkdown,
1467
+ lessonCode,
1468
+ lessonTitle,
1469
+ targetSlideCount,
1470
+ stylePresetId = "blue-professional",
1471
+ language = "Vietnamese",
1472
+ languageDirective = "",
1473
+ headingDirective = "",
1474
+ satelliteContext,
1475
+ runnerOptions,
1476
+ onProgress
1477
+ } = options;
1478
+ let presentationKitSkills = null;
1479
+ let presentationKitCore = null;
1480
+ try {
1481
+ presentationKitSkills = await import('@thanh01.pmt/presentation-kit/skills');
1482
+ } catch {
1483
+ }
1484
+ try {
1485
+ presentationKitCore = await import('@thanh01.pmt/presentation-kit');
1486
+ } catch {
1487
+ }
1488
+ const countLabel = targetSlideCount ? `${targetSlideCount} ` : "h\u1EEFu c\u01A1 ";
1489
+ onProgress?.("@illustrator", `[1/4] Ph\xE2n t\xEDch m\u1EA1ch b\xE0i gi\u1EA3ng LESSON & L\u1EADp D\xE0n \xFD ${countLabel}Slides...`);
1490
+ const lessonFlow = parseLessonFlow(lessonMarkdown);
1491
+ const stylePreset = presentationKitSkills?.getStylePreset ? presentationKitSkills.getStylePreset(stylePresetId) : { name: "Blue Professional" };
1492
+ const blueprintPrompt = buildSlideBlueprintPrompt({
1493
+ lessonFlow,
1494
+ targetSlideCount,
1495
+ stylePresetName: stylePreset?.name || "Blue Professional"
1496
+ });
1497
+ const rawBlueprint = await runCurriculumAIInference(
1498
+ [{ role: "user", content: blueprintPrompt }],
1499
+ satelliteContext,
1500
+ runnerOptions,
1501
+ (chunk, type) => {
1502
+ onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
1503
+ }
1504
+ );
1505
+ let blueprintItems = [];
1506
+ try {
1507
+ blueprintItems = JSON.parse(extractCleanJson(rawBlueprint));
1508
+ } catch {
1509
+ try {
1510
+ blueprintItems = JSON.parse(jsonrepair(extractCleanJson(rawBlueprint)));
1511
+ } catch (e) {
1512
+ console.warn(`[SlideProductionWorkflow] Failed parsing blueprint JSON, constructing fallback:`, e);
1513
+ const fallbackCount = targetSlideCount || Math.max(12, Math.min(24, Math.max(lessonFlow.phases.length, 4) * 4));
1514
+ blueprintItems = Array.from({ length: fallbackCount }, (_, i) => ({
1515
+ slideIndex: i + 1,
1516
+ clusterId: Math.floor(i / 5) + 1,
1517
+ clusterTitle: `Cluster ${Math.floor(i / 5) + 1}`,
1518
+ lessonPhase: lessonFlow.phases[Math.min(i, lessonFlow.phases.length - 1)]?.phaseName || "Content",
1519
+ layoutId: i === 0 ? "hero-cover" : i === fallbackCount - 1 ? "summary-takeaways" : "split-concept-code",
1520
+ title: `Slide ${i + 1}: ${lessonTitle}`,
1521
+ pedagogicalGoal: `Teach step ${i + 1} of ${lessonTitle}`,
1522
+ contentFocus: ["Key point 1", "Key point 2", "Key point 3"]
1523
+ }));
1524
+ }
1525
+ }
1526
+ const clustersMap = /* @__PURE__ */ new Map();
1527
+ for (const item of blueprintItems) {
1528
+ const cId = item.clusterId || Math.floor((item.slideIndex - 1) / 5) + 1;
1529
+ if (!clustersMap.has(cId)) clustersMap.set(cId, []);
1530
+ clustersMap.get(cId).push(item);
1531
+ }
1532
+ const clusters = Array.from(clustersMap.entries()).sort(([a], [b]) => a - b);
1533
+ const allGeneratedSlides = [];
1534
+ const skillPrompt = presentationKitSkills?.getFrontendSlidesSkillPrompt ? presentationKitSkills.getFrontendSlidesSkillPrompt({ stylePresetId }) : "";
1535
+ let clusterIdx = 0;
1536
+ for (const [cId, clusterSlides] of clusters) {
1537
+ clusterIdx++;
1538
+ const clusterTitle = clusterSlides[0]?.clusterTitle || `Giai \u0111o\u1EA1n ${clusterIdx}`;
1539
+ onProgress?.("@illustrator", `[2/4] Sinh chi ti\u1EBFt C\u1EE5m ${clusterIdx}/${clusters.length}: "${clusterTitle}" (${clusterSlides.length} slides)...`);
1540
+ const clusterPhaseNames = new Set(clusterSlides.map((s) => s.lessonPhase.toLowerCase()));
1541
+ const matchingPhases = lessonFlow.phases.filter(
1542
+ (p) => clusterPhaseNames.has(p.phaseName.toLowerCase())
1543
+ );
1544
+ const lessonExcerpt = matchingPhases.length > 0 ? matchingPhases.map((p) => `### ${p.phaseName}
1545
+ ${p.content}`).join("\n\n") : lessonFlow.rawContent.slice(0, 3500);
1546
+ const { systemPrompt, userPrompt } = buildSlideBatchPrompt({
1547
+ clusterId: cId,
1548
+ clusterTitle,
1549
+ clusterSlides,
1550
+ lessonFlow,
1551
+ lessonExcerpt,
1552
+ skillPrompt,
1553
+ language,
1554
+ languageDirective,
1555
+ headingDirective
1556
+ });
1557
+ const rawBatch = await runCurriculumAIInference(
1558
+ [
1559
+ { role: "system", content: systemPrompt },
1560
+ { role: "user", content: userPrompt }
1561
+ ],
1562
+ satelliteContext,
1563
+ runnerOptions,
1564
+ (chunk, type) => {
1565
+ onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
1566
+ }
1567
+ );
1568
+ let batchSlides = [];
1569
+ try {
1570
+ batchSlides = JSON.parse(extractCleanJson(rawBatch));
1571
+ } catch {
1572
+ try {
1573
+ batchSlides = JSON.parse(jsonrepair(extractCleanJson(rawBatch)));
1574
+ } catch (err) {
1575
+ console.warn(`[SlideProductionWorkflow] Batch ${cId} JSON parse failed, synthesizing slides:`, err);
1576
+ batchSlides = clusterSlides.map((s) => ({
1577
+ id: `slide-${s.slideIndex}`,
1578
+ layoutId: s.layoutId,
1579
+ title: s.title,
1580
+ slots: {
1581
+ lead: s.pedagogicalGoal,
1582
+ bullets: s.contentFocus,
1583
+ code: s.codeSnippetIntent || "// Executable demo code"
1584
+ },
1585
+ notes: `SCRIPT: Spoken explanation for ${s.title}.
1586
+ COLD CALL: What happens when this logic runs?
1587
+ SCAFFOLDING: Ensure proper syntax and indentation.`
1588
+ }));
1589
+ }
1590
+ }
1591
+ if (Array.isArray(batchSlides)) {
1592
+ allGeneratedSlides.push(...batchSlides);
1593
+ }
1594
+ }
1595
+ 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)...`);
1596
+ const normalizer = presentationKitCore?.normalizeSlideSlots;
1597
+ const normalizedSlides = allGeneratedSlides.map((s, idx) => {
1598
+ const base = normalizer ? normalizer(s) : s;
1599
+ if (!base.id) base.id = `slide-${idx + 1}`;
1600
+ return base;
1601
+ });
1602
+ const deckJson = {
1603
+ id: `deck-${lessonCode}`,
1604
+ title: lessonTitle,
1605
+ theme: stylePresetId,
1606
+ slides: normalizedSlides
1607
+ };
1608
+ let compiledHtml;
1609
+ const compiler = presentationKitCore?.compileHtmlDeck;
1610
+ if (compiler) {
1611
+ try {
1612
+ const compiled = compiler(deckJson);
1613
+ if (compiled?.html) {
1614
+ compiledHtml = compiled.html;
1615
+ }
1616
+ } catch (compErr) {
1617
+ console.warn(`[SlideProductionWorkflow] Failed compiling HTML deck:`, compErr);
1618
+ }
1619
+ }
1620
+ const markdownWrapper = `---
1621
+ id: "SLIDE_${lessonCode}"
1622
+ title: "${lessonTitle}"
1623
+ type: "SLIDE"
1624
+ format: "html-deck"
1625
+ engine: "html"
1626
+ phase: "P2"
1627
+ deliverable: "P2-T09"
1628
+ version: "v2.0"
1629
+ date: "${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}"
1630
+ ---
1631
+
1632
+ \`\`\`json
1633
+ ${JSON.stringify(deckJson, null, 2)}
1634
+ \`\`\`
1635
+ `;
1636
+ 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!`);
1637
+ return {
1638
+ deckJson,
1639
+ compiledHtml,
1640
+ markdownWrapper,
1641
+ blueprint: blueprintItems,
1642
+ slideCount: normalizedSlides.length
1643
+ };
1644
+ }
1645
+ var init_slideProductionWorkflow = __esm({
1646
+ "src/services/slideProductionWorkflow.ts"() {
1647
+ init_lessonFlowParser();
1648
+ init_slideBlueprintPrompt();
1649
+ init_slideBatchPrompt();
1650
+ init_streamRunner();
1651
+ }
1652
+ });
1166
1653
  var LearningObjectiveRowSchema = z.object({
1167
1654
  code: z.string().describe('LO code, e.g. "LO1"'),
1168
1655
  objective: z.string().describe("Bloom-tagged learning objective"),
@@ -25329,104 +25816,24 @@ ${buildHeadingDirective("QUIZ", slcMarkdown, targetLang)}`;
25329
25816
  presentationKitCore = await import('@thanh01.pmt/presentation-kit');
25330
25817
  } catch {
25331
25818
  }
25332
- const slidePrompt = buildHtmlDeckSlidePrompt({
25819
+ const { executeSlideProductionWorkflow: executeSlideProductionWorkflow2 } = await Promise.resolve().then(() => (init_slideProductionWorkflow(), slideProductionWorkflow_exports));
25820
+ const workflowResult = await executeSlideProductionWorkflow2({
25821
+ lessonMarkdown: lessonContent || "",
25333
25822
  lessonCode,
25334
25823
  lessonTitle,
25335
- pedagogyLabel,
25824
+ stylePresetId: "blue-professional",
25825
+ language: targetLang || "Vietnamese",
25336
25826
  languageDirective,
25337
25827
  headingDirective: buildHeadingDirective("SLIDE", slcMarkdown, targetLang),
25338
- glossaryBlock: glossaryContext ? `[GLOSSARY TERMS (use these exact definitions)]:
25339
- ${glossaryContext}` : void 0,
25340
- customContract: presentationKitAi?.SLIDE_HTML_PROMPT_CONTRACT
25341
- });
25342
- const rawSlide = await runCurriculumAIInference(
25343
- [{ role: "user", content: slidePrompt }],
25344
25828
  satelliteContext,
25345
25829
  runnerOptions,
25346
- (chunk, type) => {
25347
- options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25830
+ onProgress: (agent, msg, meta) => {
25831
+ options.onProgress?.(agent, msg, meta || { type: "content", artifactType: "SLIDE" });
25348
25832
  }
25349
- );
25350
- if (!rawSlide || rawSlide.startsWith("\u26A0\uFE0F") || rawSlide.length < 200) {
25351
- throw createAiInferenceError({
25352
- errorCode: "ERR_AI_RESPONSE_MALFORMED",
25353
- agent: "@illustrator",
25354
- artifactType: "SLIDE",
25355
- lessonId: lessonCode,
25356
- message: `Agent @illustrator failed to author valid HTML Slides for ${lessonCode}.`,
25357
- rawError: rawSlide || "Empty AI response"
25358
- });
25359
- }
25360
- let deckJson = null;
25361
- const extractCleanJson = (str) => {
25362
- const fenceMatch = str.match(/```(?:json)?\s*([\s\S]*?)\s*```/i);
25363
- const candidate = fenceMatch ? fenceMatch[1] : str;
25364
- return candidate.trim();
25365
- };
25366
- const normalizeDeckSlides = (deck) => {
25367
- const normalizer = presentationKitCore?.normalizeSlideSlots || presentationKitAi?.normalizeSlideSlots;
25368
- if (deck && Array.isArray(deck.slides) && normalizer) {
25369
- deck.slides = deck.slides.map((s) => normalizer(s));
25370
- }
25371
- return deck;
25372
- };
25373
- try {
25374
- deckJson = JSON.parse(extractCleanJson(rawSlide));
25375
- deckJson = normalizeDeckSlides(deckJson);
25376
- } catch {
25377
- try {
25378
- const { jsonrepair: jsonrepair2 } = await import('jsonrepair');
25379
- deckJson = JSON.parse(jsonrepair2(extractCleanJson(rawSlide)));
25380
- deckJson = normalizeDeckSlides(deckJson);
25381
- } catch {
25382
- }
25383
- }
25384
- 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 };
25385
- if (!validation.valid && presentationKitAi?.validateHtmlSlideDeck) {
25386
- const repairIssues = (validation.issues || []).map((i) => `- Slide ${i.slideIndex ?? "?"}: ${i.message}`).join("\n");
25387
- onProgress?.("@illustrator", `\u26A0\uFE0F HTML slide deck failed schema validation \u2014 retrying once with targeted repair feedback...`);
25388
- const repairPrompt = `Your previous slide deck failed strict schema validation:
25389
- ${repairIssues}
25390
-
25391
- Fix ALL issues and output the complete corrected JSON object strictly matching the schema:`;
25392
- const repairedRaw = await runCurriculumAIInference(
25393
- [{ role: "user", content: repairPrompt }],
25394
- satelliteContext,
25395
- runnerOptions,
25396
- (chunk, type) => {
25397
- options.onProgress?.("@illustrator", chunk, { type: type || "content", artifactType: "SLIDE" });
25398
- }
25399
- );
25400
- try {
25401
- deckJson = JSON.parse(extractCleanJson(repairedRaw));
25402
- deckJson = normalizeDeckSlides(deckJson);
25403
- validation = presentationKitAi.validateHtmlSlideDeck(deckJson, true);
25404
- } catch {
25405
- try {
25406
- const { jsonrepair: jsonrepair2 } = await import('jsonrepair');
25407
- deckJson = JSON.parse(jsonrepair2(extractCleanJson(repairedRaw)));
25408
- deckJson = normalizeDeckSlides(deckJson);
25409
- validation = presentationKitAi.validateHtmlSlideDeck(deckJson, true);
25410
- } catch {
25411
- }
25412
- }
25413
- }
25414
- const markdownWrapper = `---
25415
- id: "SLIDE_${lessonCode}"
25416
- title: "${titleHeader(lessonTitle)}"
25417
- type: "SLIDE"
25418
- format: "html-deck"
25419
- engine: "html"
25420
- phase: "P2"
25421
- deliverable: "P2-T09"
25422
- version: "v1.0"
25423
- date: "${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}"
25424
- ---
25425
-
25426
- \`\`\`json
25427
- ${JSON.stringify(deckJson || {}, null, 2)}
25428
- \`\`\`
25429
- `;
25833
+ });
25834
+ let deckJson = workflowResult.deckJson;
25835
+ const markdownWrapper = workflowResult.markdownWrapper;
25836
+ 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};
25430
25837
  await storage.saveArtifact(projectId, slideRelPath, markdownWrapper);
25431
25838
  producedArtifacts.push(`SLIDE_${lessonCode}.md`);
25432
25839
  if (deckJson) {
@@ -28064,6 +28471,9 @@ function isTranslationDue(target, context) {
28064
28471
  const total = context.totalLessonsByUnit[unit] ?? 0;
28065
28472
  return total > 0 && done >= total;
28066
28473
  }
28474
+
28475
+ // src/services/index.ts
28476
+ init_slideProductionWorkflow();
28067
28477
  var LocalWorkspaceManager = class {
28068
28478
  baseDir;
28069
28479
  constructor(baseDir) {
@@ -30412,6 +30822,6 @@ function renderMediaPlaceholder(entry) {
30412
30822
  return `> \u{1F5BC}\uFE0F [\u1EA2nh \u0111ang ch\u1EDD: ${entry.name} \u2014 s\u1EBD \u0111\u01B0\u1EE3c t\u1EA1o sau khi duy\u1EC7t media]`;
30413
30823
  }
30414
30824
 
30415
- 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 };
30825
+ 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 };
30416
30826
  //# sourceMappingURL=index.mjs.map
30417
30827
  //# sourceMappingURL=index.mjs.map