@thanh01.pmt/curriculum-kit 1.4.16 → 1.4.18

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.
@@ -18871,6 +18871,8 @@ ${lines.join("\n")}
18871
18871
 
18872
18872
  // src/services/contextBuilder.ts
18873
18873
  var DEFAULT_LESSON_PRIORITIES = [
18874
+ "Symbol & Identifier Ledger",
18875
+ "Artifact Contract",
18874
18876
  "A. Lesson Design Plan",
18875
18877
  "B. Lesson Flow",
18876
18878
  "Learning Objectives & Evidence",
@@ -19089,6 +19091,12 @@ function normalizeHeading(str) {
19089
19091
  return str.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim();
19090
19092
  }
19091
19093
  function findCanonicalFuzzy(norm) {
19094
+ if (norm.includes("symbol") || norm.includes("identifier ledger") || norm.includes("dinh danh")) {
19095
+ return "Symbol & Identifier Ledger";
19096
+ }
19097
+ if (norm.includes("artifact contract") || norm.includes("hop dong hoc lieu")) {
19098
+ return "Artifact Contract";
19099
+ }
19092
19100
  if (norm.includes("lesson design plan") || norm.includes("ke hoach thiet ke")) {
19093
19101
  return "A. Lesson Design Plan";
19094
19102
  }
@@ -19139,6 +19147,54 @@ function deriveArtifactTypeFromFileName(fileName) {
19139
19147
  const token = base.match(/^([A-Z][A-Z0-9_]*?)(?=_|$)/);
19140
19148
  return token ? token[1] : void 0;
19141
19149
  }
19150
+ function extractSymbolLedger(lessonMarkdown) {
19151
+ const result = {
19152
+ keySymbols: [],
19153
+ rawBlock: ""
19154
+ };
19155
+ if (!lessonMarkdown) return result;
19156
+ const ledgerMatch = lessonMarkdown.match(/###?\s*(?:Symbol & Identifier Ledger|Bảng Định Danh|Artifact Contract)[\s\S]*?(?=\n##|\n---|$)/i);
19157
+ if (ledgerMatch) {
19158
+ result.rawBlock = ledgerMatch[0].trim();
19159
+ }
19160
+ const structMatch = lessonMarkdown.match(/(?:Primary Struct|Primary Class|Primary Function|Main Component|Primary Module|Struct chính|Class chính|Hàm chính)[:\s*`]+([A-Za-z0-9_]+)/i);
19161
+ if (structMatch) {
19162
+ result.primarySymbol = structMatch[1];
19163
+ result.keySymbols.push(structMatch[1]);
19164
+ } else {
19165
+ const codeStructMatch = lessonMarkdown.match(/(?:struct|class|interface|type|def|function)\s+([A-Za-z0-9_]+)/);
19166
+ if (codeStructMatch) {
19167
+ const sym = codeStructMatch[1];
19168
+ result.primarySymbol = sym;
19169
+ result.keySymbols.push(sym);
19170
+ }
19171
+ }
19172
+ const fileMatch = lessonMarkdown.match(/(?:Entry File|Source File|Target File|Tên file mã nguồn)[:\s*`]+([A-Za-z0-9_\-\.]+\.[a-z0-9_]+)/i);
19173
+ if (fileMatch) {
19174
+ result.entryFileName = fileMatch[1];
19175
+ } else {
19176
+ const codeFileComment = lessonMarkdown.match(/(?:\/\/\s*|#\s*|\/\*\s*)([A-Za-z0-9_\-]+\.[a-zA-Z0-9]+)/);
19177
+ if (codeFileComment) {
19178
+ result.entryFileName = codeFileComment[1];
19179
+ }
19180
+ }
19181
+ return result;
19182
+ }
19183
+
19184
+ // src/services/knowledgeExpositionService.ts
19185
+ function buildDomainLexiconGuardrail(techStack, hardwarePlatform) {
19186
+ const targetTech = (techStack).trim();
19187
+ const targetHw = (hardwarePlatform || "").trim();
19188
+ const platformAnchor = [targetTech, targetHw].filter(Boolean).join(" | ");
19189
+ if (!platformAnchor) {
19190
+ return `- \u{1F512} TECHNICAL DOMAIN ANCHOR: Strictly adhere to the declared curriculum domain. Use ONLY native, standard, idiomatic syntax and mechanisms. Strictly FORBIDDEN from using foreign paradigms, cross-domain jargon, or hallucinated APIs.`;
19191
+ }
19192
+ return `- \u{1F512} STRICT DOMAIN & TECHNICAL PLATFORM ANCHOR:
19193
+ \u2022 Declared Platform: "${platformAnchor}"
19194
+ \u2022 NATIVE PARADIGM ONLY: You MUST strictly use standard, idiomatic syntax, conventions, naming patterns, and mental models of "${platformAnchor}".
19195
+ \u2022 ANTI-CONTAMINATION INVARIANT: Strictly FORBIDDEN from importing or using syntax, units, keywords, tags, or concepts from unrelated/foreign ecosystems (e.g., do NOT leak Web/HTML/CSS tags or units into native mobile/embedded stacks, do NOT leak dynamic scripting into statically typed systems, do NOT use hardware/circuit terminology in pure-software courses).
19196
+ \u2022 REAL APIS ONLY: Every method, modifier, property, and API referenced must exist in the standard SDK of "${platformAnchor}".`;
19197
+ }
19142
19198
  init_errors();
19143
19199
 
19144
19200
  // src/services/lessonProductionService.ts
@@ -19364,6 +19420,15 @@ async function generateSingleArtifact(req) {
19364
19420
  const artifactSpecializedPrompt = getArtifactSpecializedInvariants(artifactType, {
19365
19421
  ...req,
19366
19422
  studentCount});
19423
+ const techStack = req.config?.techStack || req.hardwarePlatform?.[0] || "Declared Technical Domain";
19424
+ const domainGuardrail = buildDomainLexiconGuardrail(techStack, hwStr);
19425
+ const symbolLedger = contextSot.lessonPlan ? extractSymbolLedger(contextSot.lessonPlan) : null;
19426
+ const symbolLedgerPrompt = symbolLedger?.primarySymbol ? `
19427
+ 7. MANDATORY CODE SYMBOL REGISTRY (Inherited from Canonical LESSON):
19428
+ - Primary Struct / Class: \`${symbolLedger.primarySymbol}\`
19429
+ - Entry Source File: \`${symbolLedger.entryFileName || symbolLedger.primarySymbol + ".swift"}\`
19430
+ - Key Identifiers to inherit: ${symbolLedger.keySymbols.map((s) => `\`${s}\``).join(", ")}
19431
+ - INVARIANT: You MUST use these exact identifier names in all code examples, exercises, and starter templates. Do NOT invent conflicting struct or class names.` : "";
19367
19432
  const systemPrompt = `You are ${meta.persona}, an expert Curriculum & Pedagogical Specialist in the Curriculum OS Multi-Agent Team.
19368
19433
  Your task is to author a canonical, publication-grade learning artifact of type "${artifactType.toUpperCase()}".
19369
19434
 
@@ -19374,7 +19439,10 @@ ${headingDirective}
19374
19439
  3. PEDAGOGICAL GROUNDING: Strictly align with the ${pedagogy.toUpperCase()} model, Bloom's Revised Taxonomy, and IEEE/ACM CS2023 guidelines.
19375
19440
  4. SCAFFOLDING LEVEL: "${scaffoldingLevel.toUpperCase()}".${scaffoldingRule}
19376
19441
  5. TARGET AUDIENCE: ${gradeLevel ? `Grade ${gradeLevel}, ` : ""}${targetAge} on ${hwStr}.${deviceRule}${classDynamicsRule}${extraContextRule}
19377
- 6. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${mediaPolicy ? `
19442
+ 6. DOMAIN & TECH STACK GUARDRAILS:
19443
+ ${domainGuardrail}
19444
+ ${symbolLedgerPrompt}
19445
+ 8. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${mediaPolicy ? `
19378
19446
 
19379
19447
  IMAGE PLANNING (media ledger) \u2014 QUOTA GEN: t\u1ED1i \u0111a ${mediaPolicy.maxGenImagesPerArtifact} \u1EA3nh AI cho artifact n\xE0y (\u1EA3nh search kho kh\xF4ng gi\u1EDBi h\u1EA1n).
19380
19448
  Khi n\u1ED9i dung c\u1EA7n minh h\u1ECDa (diagram quy tr\xECnh, s\u01A1 \u0111\u1ED3 kh\xE1i ni\u1EC7m, step-by-step visual), ch\xE8n placeholder \u0111\xFAng format [IMAGE: slug] (slug ch\u1EEF th\u01B0\u1EDDng-g\u1EA1ch ngang, unique trong b\xE0i, vd img-for-loop-diagram) T\u1EA0I \u0110\xDANG CH\u1ED6 c\u1EA7n \u1EA3nh, tr\xEAn d\xF2ng ri\xEAng. KH\xD4NG t\u1EF1 sinh \u1EA3nh, KH\xD4NG d\xF9ng markdown image \u2014 placeholder s\u1EBD \u0111\u01B0\u1EE3c thay b\u1EB1ng \u1EA3nh th\u1EADt sau khi Media Curator duy\u1EC7t. Ch\u1EC9 \u0111\u1EB7t cho \u1EA3nh TH\u1EF0C S\u1EF0 c\u1EA7n thi\u1EBFt.` : ""}`;
@@ -19854,6 +19922,24 @@ ${includeUnitTests ? "- Unit Testing: Provide automated assertions or test runne
19854
19922
  1. **CLASS-SCALED INVENTORY FOR ${studentCount} STUDENTS**:
19855
19923
  - Exact quantities calculated for ${studentCount} students.
19856
19924
  - Component specifications, estimated unit cost, and affordable alternatives.`;
19925
+ case "ext": {
19926
+ const lessonIdxMatch = (req.lessonId || "").match(/L0*(\d+)/i);
19927
+ const lessonIdx = lessonIdxMatch ? parseInt(lessonIdxMatch[1], 10) : 1;
19928
+ const isEarlyLesson = lessonIdx <= 4;
19929
+ const zpdCeilingRule = isEarlyLesson ? `- \u{1F6D1} ZPD COMPLEXITY CEILING (FOUNDATIONAL LESSON #${lessonIdx}):
19930
+ \u2022 SCOPE LOCK: This is an early foundational lesson. The extension challenge MUST focus on creative design variations, parameterization, or edge cases of the current lesson concepts ONLY.
19931
+ \u2022 STRICTLY FORBIDDEN: NEVER introduce advanced mechanisms from future lessons (No complex event buses, No remote network/API calls, No persistent databases, No async concurrency, No out-of-scope hardware/sensors).` : `- \u{1F680} ZPD ADVANCED CHALLENGE (LESSON #${lessonIdx}):
19932
+ \u2022 Focus on architectural edge cases, algorithmic optimization, and synthesis of learned concepts up to Lesson #${lessonIdx}.`;
19933
+ return `
19934
+ ### \u{1F680} EXTENSION CHALLENGE ARCHITECTURE INVARIANTS:
19935
+ ${zpdCeilingRule}
19936
+ 1. **STRUCTURED 3-TIER CHALLENGES**:
19937
+ - Challenge 1 (Mission Briefing): High-stakes real-world scenario applying today's concepts.
19938
+ - Challenge 2 (Architectural Constraints & Edge Cases): Deeper technical rules without violating prerequisite boundaries.
19939
+ - Challenge 3 (Extension Milestones): Progressive milestones (Level 1: Novice \u2192 Level 2: Advanced \u2192 Level 3: Master).
19940
+ 2. **METACOGNITIVE & ENGINEERING TRADE-OFFS**:
19941
+ - Explicit reflection prompts evaluating architectural choices, code maintainability, and design patterns.`;
19942
+ }
19857
19943
  case "lesson": {
19858
19944
  const lessonDuration = cfg.lessonDuration || 90;
19859
19945
  const pedagogicalModel = cfg.pedagogicalModel || req.pedagogy || "5e";