@thanh01.pmt/curriculum-kit 1.4.48 → 1.4.49

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
@@ -4875,9 +4875,9 @@ Evaluate the candidate artifact across these 6 dimensions:
4875
4875
  - 0 pts: Missing critical sections.
4876
4876
 
4877
4877
  5. **Technical & Conceptual Accuracy (15 pts):**
4878
- - 15 pts: Code snippets, logic flows, architectural descriptions, and Mermaid diagrams are conceptually sound and valid. If \`canonicalExposition\` or \`[KNOWLEDGE_EXPOSITION]\` is provided, content strictly adheres to canonical concepts without contradicting definitions or examples.
4878
+ - 15 pts: Code snippets, logic flows, architectural descriptions, and Mermaid diagrams are conceptually sound and valid. Every code identifier uses the REAL standard-library/API spelling of the declared stack (grounded in REFERENCE_PACK / canonical LESSON) \u2014 internal consistency with a glossary term name is NOT evidence of correctness. If \`canonicalExposition\` or \`[KNOWLEDGE_EXPOSITION]\` is provided, content strictly adheres to canonical concepts without contradicting definitions or examples.
4879
4879
  - 8 pts: Minor syntax inaccuracies or unidiomatic code that does not break core concepts.
4880
- - 0 pts: Severe technical hallucinations, broken logic, invalid diagrams, or direct contradiction of canonical exposition knowledge.
4880
+ - 0 pts: Severe technical hallucinations, broken logic, invalid diagrams, invented casing/spelling rules for standard-library identifiers, or direct contradiction of canonical exposition knowledge.
4881
4881
 
4882
4882
  6. **Contract Consistency & Zero-Drift (10 pts):**
4883
4883
  - 10 pts: Satellite artifact strictly adheres to the scope, tech stack, and objectives of Lesson ${lessonId} without introducing unrelated topics. If \`canonicalLessonExcerpt\` is present in candidate JSON, all satellite phases/activities strictly operationalize the master Lesson Flow and Activity Sequence without inventing divergent timelines.
@@ -10208,6 +10208,38 @@ function checkScopeDrift(content, scopedKeywords, tolerance = 0) {
10208
10208
  evidence: drift
10209
10209
  };
10210
10210
  }
10211
+ function checkIdentifierCasing(content, refPack) {
10212
+ if (!refPack || !refPack.trim()) return null;
10213
+ const canonical = /* @__PURE__ */ new Map();
10214
+ const remember = (id) => {
10215
+ if (id.length < 2) return;
10216
+ const key = id.toLowerCase().replace(/_/g, "");
10217
+ if (!canonical.has(key)) canonical.set(key, id);
10218
+ };
10219
+ for (const m of refPack.matchAll(/`([A-Za-z_][A-Za-z0-9_]*)\s*\(/g)) remember(m[1]);
10220
+ for (const m of refPack.matchAll(/\b([A-Za-z_][A-Za-z0-9_]*)\s*\(/g)) remember(m[1]);
10221
+ for (const m of refPack.matchAll(/`([A-Za-z_][A-Za-z0-9_]*)`/g)) remember(m[1]);
10222
+ if (canonical.size === 0) return null;
10223
+ const RESERVED = /* @__PURE__ */ new Set(["if", "for", "while", "switch", "func", "return", "guard", "catch", "else", "in"]);
10224
+ const violations = [];
10225
+ const fenceRe = /```[a-zA-Z]*\n([\s\S]*?)```/g;
10226
+ for (const fence of content.matchAll(fenceRe)) {
10227
+ for (const m of fence[1].matchAll(/\b([A-Za-z_][A-Za-z0-9_]*)\s*\(/g)) {
10228
+ const tok = m[1];
10229
+ if (RESERVED.has(tok.toLowerCase())) continue;
10230
+ const real = canonical.get(tok.toLowerCase().replace(/_/g, ""));
10231
+ if (real && real !== tok && !violations.includes(`${tok} \u2192 ${real}`)) {
10232
+ violations.push(`${tok} \u2192 ${real}`);
10233
+ }
10234
+ }
10235
+ }
10236
+ if (violations.length === 0) return null;
10237
+ return {
10238
+ code: "identifier-casing",
10239
+ detail: `Code d\xF9ng identifier l\u1EC7ch casing so v\u1EDBi REFERENCE_PACK (ngu\u1ED3n s\u1EF1 th\u1EADt k\u1EF9 thu\u1EADt): ${violations.join(", ")}. Identifier trong code PH\u1EA2I copy nguy\xEAn d\u1EA1ng t\u1EEB REFERENCE_PACK \u2014 KH\xD4NG suy ra casing t\u1EEB t\xEAn keyword/concept (ch\xFAng l\xE0 nh\xE3n s\u01B0 ph\u1EA1m, kh\xF4ng ph\u1EA3i API).`,
10240
+ evidence: violations.slice(0, 5)
10241
+ };
10242
+ }
10211
10243
  function validateArtifactDeterministic(input) {
10212
10244
  const issues = [];
10213
10245
  const cjk = scanCjkLeaks(input.content);
@@ -10215,6 +10247,8 @@ function validateArtifactDeterministic(input) {
10215
10247
  if (input.refPack) {
10216
10248
  const ver = checkVersionGroundTruth(input.content, input.refPack);
10217
10249
  if (ver) issues.push(ver);
10250
+ const casing = checkIdentifierCasing(input.content, input.refPack);
10251
+ if (casing) issues.push(casing);
10218
10252
  }
10219
10253
  if (input.scopedKeywords && input.scopedKeywords.length > 0) {
10220
10254
  const scope = checkScopeDrift(input.content, input.scopedKeywords);
@@ -10326,9 +10360,10 @@ function buildSystemPrompt(targetLanguage = "vi", techStack, hardwarePlatform) {
10326
10360
  "Rules:",
10327
10361
  "1. Cover EXACTLY the scoped keywords and concepts \u2014 nothing beyond the session scope.",
10328
10362
  "2. Every Key Term definition must be consistent with the glossary entry provided.",
10329
- "3. Respect each concept depth target (ULO/CIO/SIO) \u2014 do not overshoot.",
10330
- "4. Student-facing only: no teacher instructions, no classroom management text.",
10331
- "5. Output the full markdown document following the provided section skeleton exactly (headers and placeholders preserved).",
10363
+ '3. IDENTIFIER GROUND TRUTH: glossary/keyword names are pedagogical concept labels \u2014 NEVER derive code identifier casing or spelling from them. In code samples, copy identifiers EXACTLY from the REFERENCE_PACK ground truth (e.g. the standard library function is `print` lowercase; "Print" as a topic label is not an API symbol).',
10364
+ "4. Respect each concept depth target (ULO/CIO/SIO) \u2014 do not overshoot.",
10365
+ "5. Student-facing only: no teacher instructions, no classroom management text.",
10366
+ "6. Output the full markdown document following the provided section skeleton exactly (headers and placeholders preserved).",
10332
10367
  domainGuardrails,
10333
10368
  langDirective
10334
10369
  ].join("\n");
@@ -27356,6 +27391,7 @@ Your task is to author a canonical, publication-grade learning artifact of type
27356
27391
  ${langDirective}
27357
27392
  ${headingDirective}
27358
27393
  2. NON-MOCK CODE INVARIANT: Any code snippet provided MUST be 100% syntactically valid, idiomatic, and executable without placeholders or fake functions.
27394
+ 2b. IDENTIFIER GROUND TRUTH: Never derive identifier casing/spelling from glossary term or concept names (they are pedagogical labels). Copy identifiers EXACTLY from the canonical LESSON and REFERENCE_PACK ground truth present in the context.
27359
27395
  3. PEDAGOGICAL GROUNDING: Strictly align with the ${pedagogy.toUpperCase()} model, Bloom's Revised Taxonomy, and IEEE/ACM CS2023 guidelines.
27360
27396
  4. SCAFFOLDING LEVEL: "${scaffoldingLevel.toUpperCase()}".${scaffoldingRule}
27361
27397
  5. TARGET AUDIENCE: ${gradeLevel ? `Grade ${gradeLevel}, ` : ""}${targetAge} on ${hwStr}.${deviceRule}${classDynamicsRule}${extraContextRule}