@thanh01.pmt/curriculum-kit 1.4.17 → 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.
@@ -18880,6 +18880,8 @@ ${lines.join("\n")}
18880
18880
 
18881
18881
  // src/services/contextBuilder.ts
18882
18882
  var DEFAULT_LESSON_PRIORITIES = [
18883
+ "Symbol & Identifier Ledger",
18884
+ "Artifact Contract",
18883
18885
  "A. Lesson Design Plan",
18884
18886
  "B. Lesson Flow",
18885
18887
  "Learning Objectives & Evidence",
@@ -19098,6 +19100,12 @@ function normalizeHeading(str) {
19098
19100
  return str.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^\w\s]/g, " ").replace(/\s+/g, " ").trim();
19099
19101
  }
19100
19102
  function findCanonicalFuzzy(norm) {
19103
+ if (norm.includes("symbol") || norm.includes("identifier ledger") || norm.includes("dinh danh")) {
19104
+ return "Symbol & Identifier Ledger";
19105
+ }
19106
+ if (norm.includes("artifact contract") || norm.includes("hop dong hoc lieu")) {
19107
+ return "Artifact Contract";
19108
+ }
19101
19109
  if (norm.includes("lesson design plan") || norm.includes("ke hoach thiet ke")) {
19102
19110
  return "A. Lesson Design Plan";
19103
19111
  }
@@ -19148,6 +19156,54 @@ function deriveArtifactTypeFromFileName(fileName) {
19148
19156
  const token = base.match(/^([A-Z][A-Z0-9_]*?)(?=_|$)/);
19149
19157
  return token ? token[1] : void 0;
19150
19158
  }
19159
+ function extractSymbolLedger(lessonMarkdown) {
19160
+ const result = {
19161
+ keySymbols: [],
19162
+ rawBlock: ""
19163
+ };
19164
+ if (!lessonMarkdown) return result;
19165
+ const ledgerMatch = lessonMarkdown.match(/###?\s*(?:Symbol & Identifier Ledger|Bảng Định Danh|Artifact Contract)[\s\S]*?(?=\n##|\n---|$)/i);
19166
+ if (ledgerMatch) {
19167
+ result.rawBlock = ledgerMatch[0].trim();
19168
+ }
19169
+ 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);
19170
+ if (structMatch) {
19171
+ result.primarySymbol = structMatch[1];
19172
+ result.keySymbols.push(structMatch[1]);
19173
+ } else {
19174
+ const codeStructMatch = lessonMarkdown.match(/(?:struct|class|interface|type|def|function)\s+([A-Za-z0-9_]+)/);
19175
+ if (codeStructMatch) {
19176
+ const sym = codeStructMatch[1];
19177
+ result.primarySymbol = sym;
19178
+ result.keySymbols.push(sym);
19179
+ }
19180
+ }
19181
+ 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);
19182
+ if (fileMatch) {
19183
+ result.entryFileName = fileMatch[1];
19184
+ } else {
19185
+ const codeFileComment = lessonMarkdown.match(/(?:\/\/\s*|#\s*|\/\*\s*)([A-Za-z0-9_\-]+\.[a-zA-Z0-9]+)/);
19186
+ if (codeFileComment) {
19187
+ result.entryFileName = codeFileComment[1];
19188
+ }
19189
+ }
19190
+ return result;
19191
+ }
19192
+
19193
+ // src/services/knowledgeExpositionService.ts
19194
+ function buildDomainLexiconGuardrail(techStack, hardwarePlatform) {
19195
+ const targetTech = (techStack).trim();
19196
+ const targetHw = (hardwarePlatform || "").trim();
19197
+ const platformAnchor = [targetTech, targetHw].filter(Boolean).join(" | ");
19198
+ if (!platformAnchor) {
19199
+ 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.`;
19200
+ }
19201
+ return `- \u{1F512} STRICT DOMAIN & TECHNICAL PLATFORM ANCHOR:
19202
+ \u2022 Declared Platform: "${platformAnchor}"
19203
+ \u2022 NATIVE PARADIGM ONLY: You MUST strictly use standard, idiomatic syntax, conventions, naming patterns, and mental models of "${platformAnchor}".
19204
+ \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).
19205
+ \u2022 REAL APIS ONLY: Every method, modifier, property, and API referenced must exist in the standard SDK of "${platformAnchor}".`;
19206
+ }
19151
19207
  init_errors();
19152
19208
 
19153
19209
  // src/services/lessonProductionService.ts
@@ -19373,6 +19429,15 @@ async function generateSingleArtifact(req) {
19373
19429
  const artifactSpecializedPrompt = getArtifactSpecializedInvariants(artifactType, {
19374
19430
  ...req,
19375
19431
  studentCount});
19432
+ const techStack = req.config?.techStack || req.hardwarePlatform?.[0] || "Declared Technical Domain";
19433
+ const domainGuardrail = buildDomainLexiconGuardrail(techStack, hwStr);
19434
+ const symbolLedger = contextSot.lessonPlan ? extractSymbolLedger(contextSot.lessonPlan) : null;
19435
+ const symbolLedgerPrompt = symbolLedger?.primarySymbol ? `
19436
+ 7. MANDATORY CODE SYMBOL REGISTRY (Inherited from Canonical LESSON):
19437
+ - Primary Struct / Class: \`${symbolLedger.primarySymbol}\`
19438
+ - Entry Source File: \`${symbolLedger.entryFileName || symbolLedger.primarySymbol + ".swift"}\`
19439
+ - Key Identifiers to inherit: ${symbolLedger.keySymbols.map((s) => `\`${s}\``).join(", ")}
19440
+ - INVARIANT: You MUST use these exact identifier names in all code examples, exercises, and starter templates. Do NOT invent conflicting struct or class names.` : "";
19376
19441
  const systemPrompt = `You are ${meta.persona}, an expert Curriculum & Pedagogical Specialist in the Curriculum OS Multi-Agent Team.
19377
19442
  Your task is to author a canonical, publication-grade learning artifact of type "${artifactType.toUpperCase()}".
19378
19443
 
@@ -19383,7 +19448,10 @@ ${headingDirective}
19383
19448
  3. PEDAGOGICAL GROUNDING: Strictly align with the ${pedagogy.toUpperCase()} model, Bloom's Revised Taxonomy, and IEEE/ACM CS2023 guidelines.
19384
19449
  4. SCAFFOLDING LEVEL: "${scaffoldingLevel.toUpperCase()}".${scaffoldingRule}
19385
19450
  5. TARGET AUDIENCE: ${gradeLevel ? `Grade ${gradeLevel}, ` : ""}${targetAge} on ${hwStr}.${deviceRule}${classDynamicsRule}${extraContextRule}
19386
- 6. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${mediaPolicy ? `
19451
+ 6. DOMAIN & TECH STACK GUARDRAILS:
19452
+ ${domainGuardrail}
19453
+ ${symbolLedgerPrompt}
19454
+ 8. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${mediaPolicy ? `
19387
19455
 
19388
19456
  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).
19389
19457
  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.` : ""}`;
@@ -19863,6 +19931,24 @@ ${includeUnitTests ? "- Unit Testing: Provide automated assertions or test runne
19863
19931
  1. **CLASS-SCALED INVENTORY FOR ${studentCount} STUDENTS**:
19864
19932
  - Exact quantities calculated for ${studentCount} students.
19865
19933
  - Component specifications, estimated unit cost, and affordable alternatives.`;
19934
+ case "ext": {
19935
+ const lessonIdxMatch = (req.lessonId || "").match(/L0*(\d+)/i);
19936
+ const lessonIdx = lessonIdxMatch ? parseInt(lessonIdxMatch[1], 10) : 1;
19937
+ const isEarlyLesson = lessonIdx <= 4;
19938
+ const zpdCeilingRule = isEarlyLesson ? `- \u{1F6D1} ZPD COMPLEXITY CEILING (FOUNDATIONAL LESSON #${lessonIdx}):
19939
+ \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.
19940
+ \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}):
19941
+ \u2022 Focus on architectural edge cases, algorithmic optimization, and synthesis of learned concepts up to Lesson #${lessonIdx}.`;
19942
+ return `
19943
+ ### \u{1F680} EXTENSION CHALLENGE ARCHITECTURE INVARIANTS:
19944
+ ${zpdCeilingRule}
19945
+ 1. **STRUCTURED 3-TIER CHALLENGES**:
19946
+ - Challenge 1 (Mission Briefing): High-stakes real-world scenario applying today's concepts.
19947
+ - Challenge 2 (Architectural Constraints & Edge Cases): Deeper technical rules without violating prerequisite boundaries.
19948
+ - Challenge 3 (Extension Milestones): Progressive milestones (Level 1: Novice \u2192 Level 2: Advanced \u2192 Level 3: Master).
19949
+ 2. **METACOGNITIVE & ENGINEERING TRADE-OFFS**:
19950
+ - Explicit reflection prompts evaluating architectural choices, code maintainability, and design patterns.`;
19951
+ }
19866
19952
  case "lesson": {
19867
19953
  const lessonDuration = cfg.lessonDuration || 90;
19868
19954
  const pedagogicalModel = cfg.pedagogicalModel || req.pedagogy || "5e";