@thanh01.pmt/curriculum-kit 1.4.10 → 1.4.11

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.cjs CHANGED
@@ -5459,6 +5459,11 @@ Every slide MUST include notes with:
5459
5459
  - Cold-Call: 1 check question
5460
5460
  - Scaffolding Tip: 1 analogy or hint
5461
5461
 
5462
+ ### \u26A0\uFE0F STRICT SLIDE FORMATTING INVARIANTS:
5463
+ 1. Every slide MUST store its content fields inside "slots": { ... }. NEVER put "title", "content", or points at the top level of a slide!
5464
+ 2. All code slots MUST contain real, executable, high-fidelity code. Never use placeholders like "<CODE>" or "...".
5465
+ 3. All point and card slots MUST contain concrete, rich pedagogical explanations. Never use placeholder dots or empty cards.
5466
+
5462
5467
  ### Output JSON Format:
5463
5468
  \`\`\`json
5464
5469
  {
@@ -25326,10 +25331,15 @@ ${buildHeadingDirective("QUIZ", slcMarkdown, targetLang)}`;
25326
25331
  const isHtmlEngine = options.slidesEngine === "html";
25327
25332
  if (isHtmlEngine) {
25328
25333
  let presentationKitAi = null;
25334
+ let presentationKitCore = null;
25329
25335
  try {
25330
25336
  presentationKitAi = await import('@thanh01.pmt/presentation-kit/ai');
25331
25337
  } catch {
25332
25338
  }
25339
+ try {
25340
+ presentationKitCore = await import('@thanh01.pmt/presentation-kit');
25341
+ } catch {
25342
+ }
25333
25343
  const slidePrompt = buildHtmlDeckSlidePrompt({
25334
25344
  lessonCode,
25335
25345
  lessonTitle,
@@ -25364,12 +25374,21 @@ ${glossaryContext}` : void 0,
25364
25374
  const candidate = fenceMatch ? fenceMatch[1] : str;
25365
25375
  return candidate.trim();
25366
25376
  };
25377
+ const normalizeDeckSlides = (deck) => {
25378
+ const normalizer = presentationKitCore?.normalizeSlideSlots || presentationKitAi?.normalizeSlideSlots;
25379
+ if (deck && Array.isArray(deck.slides) && normalizer) {
25380
+ deck.slides = deck.slides.map((s) => normalizer(s));
25381
+ }
25382
+ return deck;
25383
+ };
25367
25384
  try {
25368
25385
  deckJson = JSON.parse(extractCleanJson(rawSlide));
25386
+ deckJson = normalizeDeckSlides(deckJson);
25369
25387
  } catch {
25370
25388
  try {
25371
25389
  const { jsonrepair: jsonrepair2 } = await import('jsonrepair');
25372
25390
  deckJson = JSON.parse(jsonrepair2(extractCleanJson(rawSlide)));
25391
+ deckJson = normalizeDeckSlides(deckJson);
25373
25392
  } catch {
25374
25393
  }
25375
25394
  }
@@ -25391,11 +25410,13 @@ Fix ALL issues and output the complete corrected JSON object strictly matching t
25391
25410
  );
25392
25411
  try {
25393
25412
  deckJson = JSON.parse(extractCleanJson(repairedRaw));
25413
+ deckJson = normalizeDeckSlides(deckJson);
25394
25414
  validation = presentationKitAi.validateHtmlSlideDeck(deckJson, true);
25395
25415
  } catch {
25396
25416
  try {
25397
25417
  const { jsonrepair: jsonrepair2 } = await import('jsonrepair');
25398
25418
  deckJson = JSON.parse(jsonrepair2(extractCleanJson(repairedRaw)));
25419
+ deckJson = normalizeDeckSlides(deckJson);
25399
25420
  validation = presentationKitAi.validateHtmlSlideDeck(deckJson, true);
25400
25421
  } catch {
25401
25422
  }
@@ -25423,9 +25444,10 @@ ${JSON.stringify(deckJson || {}, null, 2)}
25423
25444
  const deckJsonStr = JSON.stringify(deckJson, null, 2);
25424
25445
  await storage.saveArtifact(projectId, `_content/${unitCode}/SLIDE_${lessonCode}.deck.json`, deckJsonStr);
25425
25446
  producedArtifacts.push(`SLIDE_${lessonCode}.deck.json`);
25426
- if (presentationKitAi?.compileHtmlDeck) {
25447
+ const compiler = presentationKitCore?.compileHtmlDeck || presentationKitAi?.compileHtmlDeck;
25448
+ if (compiler) {
25427
25449
  try {
25428
- const compiled = presentationKitAi.compileHtmlDeck(deckJson);
25450
+ const compiled = compiler(deckJson);
25429
25451
  if (compiled?.html) {
25430
25452
  await storage.saveArtifact(projectId, `_content/${unitCode}/SLIDE_${lessonCode}.html`, compiled.html);
25431
25453
  producedArtifacts.push(`SLIDE_${lessonCode}.html`);