@thanh01.pmt/curriculum-kit 1.4.38 → 1.4.40

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/ai/index.cjs CHANGED
@@ -2273,6 +2273,111 @@ Please return a single JSON object matching these exact keys:
2273
2273
  - "actionableRepairPrompts": string[]
2274
2274
  `.trim();
2275
2275
  }
2276
+ function buildCurriculumPlanJudgePrompt(input) {
2277
+ const { planJson, briefingContext, expectedLanguage = "Vietnamese", linterFindings = [] } = input;
2278
+ return `
2279
+ # System Methodology: Principal Curriculum SME & Macro-Pedagogical Quality Judge (@sme_judge)
2280
+
2281
+ You are the **Lead Curriculum Architect & Classroom Practicum SME**. Your role is to rigorously evaluate a candidate \`CURRICULUM_PLAN\` (Schema v3) against empirical pedagogical science, cognitive load capacity, and real classroom delivery constraints.
2282
+
2283
+ ## COURSE BRIEFING & TARGET CONSTRAINTS
2284
+ ${briefingContext}
2285
+
2286
+ ${linterFindings.length > 0 ? `## DETERMINISTIC PRE-LINT FINDINGS (0-TOKEN LINTER)
2287
+ The deterministic structural linter detected the following issues in advance:
2288
+ ${linterFindings.map((f) => `- [${f.severity}] ${f.id}: ${f.title} \u2014 ${f.description}`).join("\n")}
2289
+ Consider these deterministic findings when scoring and issuing actionable repair prescriptions.` : ""}
2290
+
2291
+ ## CANDIDATE CURRICULUM PLAN JSON
2292
+ \`\`\`json
2293
+ ${planJson}
2294
+ \`\`\`
2295
+
2296
+ ## EVALUATION RUBRICS & 5 CRITICAL DIMENSIONS (TOTAL 100 POINTS)
2297
+
2298
+ 1. **Step Incrementality & Single Leap Principle (20 pts):**
2299
+ - 20 pts: Every session introduces at most ONE new syntax or algorithmic concept. No massive cognitive leaps (e.g. going from basic variables directly to asynchronous networking).
2300
+ - 10 pts: Minor leap detected in 1 session that can be mitigated with starter code.
2301
+ - 0 pts: Severe cognitive gap (e.g. multiple compound paradigms combined in one session).
2302
+
2303
+ 2. **Vygotsky ZPD Saturation & Cognitive Capacity (20 pts):**
2304
+ - 20 pts: New concept count <= 2 per session (K-12) / 3 (Adults), with explicit prior concept anchor or recap slot.
2305
+ - 10 pts: Session introduces 3 concepts without adequate bridge.
2306
+ - 0 pts: Severe overload (>3 new concepts in a single session) or unanchored concepts.
2307
+
2308
+ 3. **Classroom Friction-Adjusted Time Budget (20 pts):**
2309
+ - 20 pts: Incorporates 2.5x student friction multiplier. Total content minutes <= 85% of session duration (15% overhead reserved). No step > 76 minutes.
2310
+ - 10 pts: Content is slightly packed, leaving < 10% buffer time.
2311
+ - 0 pts: Overpacked content that will cause students to run out of time in a standard classroom.
2312
+
2313
+ 4. **Reigeluth Walking Skeleton & Milestone Agency (20 pts):**
2314
+ - 20 pts: Unit 1 culminates in an end-to-end runnable MVP (Epitome). Subsequent units provide modular elaborations.
2315
+ - 10 pts: Walking skeleton present but delayed to Unit 2.
2316
+ - 0 pts: Pure theoretical silo teaching where no working product appears until the end of the course.
2317
+
2318
+ 5. **Exit Evidence Specificity (20 pts):**
2319
+ - 20 pts: Every session produces an explicit, tangible, user-visible deliverable (e.g. running UI screen, passing test suite, physical LED sequence).
2320
+ - 10 pts: Some sessions have generic deliverables ("completed practice exercise").
2321
+ - 0 pts: Vague or absent deliverables ("student understands topic").
2322
+
2323
+ ## DECISION RULES
2324
+ - **PASS & AUTO-APPROVE:** Total Score >= 85 AND overallVerdict is "PASS" AND no CRITICAL actionable repairs.
2325
+ - **NEEDS_REVISION:** Total Score between 70 and 84, or fixable flaws. Prescribe concrete structured \`actionableRepairs\` (\`SPLIT_STEP\`, \`INSERT_RECAP\`, \`ADJUST_TIME_BUDGET\`, \`REVISE_EXIT_EVIDENCE\`).
2326
+ - **FAIL:** Total Score < 70, structural collapse, or unbridgeable pedagogical gaps.
2327
+
2328
+ ## OUTPUT FORMAT
2329
+ Return a valid JSON object matching the MacroPedagogyPlanAuditSchema.
2330
+ `.trim();
2331
+ }
2332
+ function buildProjectGraphJudgePrompt(input) {
2333
+ const { bundleJson, briefingContext, linterFindings = [] } = input;
2334
+ return `
2335
+ # System Methodology: Lead Systems Engineer & Lab Infrastructure Auditor (@infra_judge)
2336
+
2337
+ You are the **Lead Lab Systems Engineer**. Your role is to rigorously evaluate a candidate \`PROJECT_GRAPH\` and its associated \`technology_scope\` against real-world lab environment feasibility, toolchain friction, and hardware constraints.
2338
+
2339
+ ## COURSE BRIEFING & INFRASTRUCTURE CONSTRAINTS
2340
+ ${briefingContext}
2341
+
2342
+ ${linterFindings.length > 0 ? `## DETERMINISTIC PRE-LINT FINDINGS
2343
+ ${linterFindings.map((f) => `- [${f.severity}] ${f.id}: ${f.title} \u2014 ${f.description}`).join("\n")}` : ""}
2344
+
2345
+ ## CANDIDATE PROJECT GRAPH BUNDLE JSON
2346
+ \`\`\`json
2347
+ ${bundleJson}
2348
+ \`\`\`
2349
+
2350
+ ## EVALUATION RUBRICS & 4 DIMENSIONS (TOTAL 100 POINTS)
2351
+
2352
+ 1. **Toolchain & Installation Feasibility (25 pts):**
2353
+ - 25 pts: Toolchain installs cleanly without complex admin rights, OS friction, or fragile build scripts.
2354
+ - 10 pts: Toolchain requires moderate admin setup, suitable for guided lab but risky for BYOD.
2355
+ - 0 pts: High-friction setup that frequently breaks in student environments.
2356
+
2357
+ 2. **Environment Provisioning Strategy (25 pts):**
2358
+ - 25 pts: Heavy technologies (PostgreSQL, Docker, ROS2, etc.) declare an explicit, realistic provisioning model (\`PRE_INSTALLED_LAB\`, \`CLOUD_MANAGED\`, or \`DEDICATED_SETUP\`). Core course topics are NEVER downgraded; instead, proper infrastructure is specified.
2359
+ - 10 pts: Heavy tech used with ambiguous provisioning plan.
2360
+ - 0 pts: Heavy tech dumped on students with no provisioning strategy, causing setup collapse.
2361
+
2362
+ 3. **Hardware & Runtime Envelope (25 pts):**
2363
+ - 25 pts: Code, libraries, and algorithms fit comfortably within target device RAM, Flash, and pinout budget (<= 75% envelope).
2364
+ - 10 pts: Memory or resource limits are tight.
2365
+ - 0 pts: Guaranteed hardware crash or pinout conflict.
2366
+
2367
+ 4. **Time to Hello World (25 pts):**
2368
+ - 25 pts: First working runnable milestone achieved in <= 15 minutes of student effort.
2369
+ - 10 pts: First milestone takes 20-30 minutes.
2370
+ - 0 pts: Student spends the entire first session on environment configuration without seeing running code.
2371
+
2372
+ ## DECISION RULES
2373
+ - **PASS:** Score >= 85 AND overallVerdict is "PASS".
2374
+ - **NEEDS_REVISION:** Score between 70 and 84. Prescribe structured actionable repairs.
2375
+ - **FAIL:** Score < 70 or critical environment blocker.
2376
+
2377
+ ## OUTPUT FORMAT
2378
+ Return a valid JSON object matching ProjectGraphAuditSchema.
2379
+ `.trim();
2380
+ }
2276
2381
 
2277
2382
  // src/ai/prompts/projectInstructionPrompt.ts
2278
2383
  function buildProjectInstructionPrompt(input) {
@@ -3084,11 +3189,51 @@ var ExtensionSchema = zod.z.object({
3084
3189
  });
3085
3190
  var QualityAuditVerdictSchema = zod.z.enum(["PASS", "NEEDS_REVISION", "FAIL"]);
3086
3191
  var JudgeCriterionSchema = zod.z.object({
3087
- name: zod.z.string().describe("Criterion name, e.g. Bloom Alignment, Code Validity, Word Count Gate, Language Adherence"),
3192
+ name: zod.z.string().describe("Criterion name, e.g. Bloom Alignment, Code Validity, Word Count Gate, Language Adherence, Step Incrementality"),
3088
3193
  passed: zod.z.boolean(),
3089
3194
  score: zod.z.number().min(0).max(100).describe("Score out of 100"),
3090
3195
  feedback: zod.z.string().describe("Constructive feedback or citation of issues")
3091
3196
  });
3197
+ var ActionableRepairActionSchema = zod.z.enum([
3198
+ "SPLIT_STEP",
3199
+ "REVISE_PROVISIONING",
3200
+ "INSERT_RECAP",
3201
+ "ADJUST_TIME_BUDGET",
3202
+ "SUBSTITUTE_FALLBACK",
3203
+ "REVISE_EXIT_EVIDENCE"
3204
+ ]);
3205
+ var ActionableRepairPromptSchema = zod.z.object({
3206
+ action: ActionableRepairActionSchema,
3207
+ targetId: zod.z.string().describe("ID of the session, feature, or step requiring repair, e.g. U01_M01_L02 or F1-S3"),
3208
+ severity: zod.z.enum(["CRITICAL", "WARNING", "INFO"]).default("WARNING"),
3209
+ rationale: zod.z.string().describe("Pedagogical or technical rationale for why this repair is mandated"),
3210
+ instruction: zod.z.string().describe("Exact, actionable text instruction for the planner/generator in the next turn")
3211
+ });
3212
+ var ProjectGraphAuditSchema = zod.z.object({
3213
+ schema_version: zod.z.number().default(1),
3214
+ projectId: zod.z.string(),
3215
+ overallVerdict: QualityAuditVerdictSchema,
3216
+ totalScore: zod.z.number().min(0).max(100),
3217
+ toolchainFeasibility: JudgeCriterionSchema.describe("Installation friction, admin rights, IDE/compiler matrix"),
3218
+ provisioningStrategy: JudgeCriterionSchema.describe("Clear model for heavy runtimes: Pre-installed lab, Cloud instance, or Dedicated setup"),
3219
+ hardwareRuntimeEnvelope: JudgeCriterionSchema.describe("Memory/Flash limits, pinout conflicts, hardware platform alignment"),
3220
+ timeToHelloWorld: JudgeCriterionSchema.describe("Student time to achieve first working feedback loop (target <= 15 mins)"),
3221
+ actionableRepairs: zod.z.array(ActionableRepairPromptSchema).default([])
3222
+ });
3223
+ var MacroPedagogyPlanAuditSchema = zod.z.object({
3224
+ schema_version: zod.z.number().default(1),
3225
+ planHash: zod.z.string(),
3226
+ overallVerdict: QualityAuditVerdictSchema,
3227
+ totalScore: zod.z.number().min(0).max(100),
3228
+ autoApproved: zod.z.boolean().default(false).describe("True if totalScore >= 85 and overallVerdict is PASS"),
3229
+ stepIncrementality: JudgeCriterionSchema.describe("Single leap principle: <= 1 new syntax or 1 new algorithm per step"),
3230
+ zpdSaturation: JudgeCriterionSchema.describe("Vygotsky ZPD: <= 2 new concepts per session (K-12) / 3 (Adults), with prior anchor"),
3231
+ frictionAdjustedBudget: JudgeCriterionSchema.describe("Student time multiplier (2.5x): total content <= 85% session minutes"),
3232
+ epitomeViability: JudgeCriterionSchema.describe("Reigeluth Walking Skeleton: Unit 1 produces an end-to-end runnable MVP"),
3233
+ exitEvidenceSpecificity: JudgeCriterionSchema.describe("Tangible, measurable student deliverable for every session"),
3234
+ actionableRepairs: zod.z.array(ActionableRepairPromptSchema).default([]),
3235
+ summary: zod.z.string().describe("High-level executive evaluation summary")
3236
+ });
3092
3237
  var CurriculumQualityReportSchema = zod.z.object({
3093
3238
  targetArtifactType: zod.z.string().describe("Type of artifact audited, e.g. LESSON, ACT, CODE, WKS, SLIDE"),
3094
3239
  lessonId: zod.z.string(),
@@ -3096,7 +3241,8 @@ var CurriculumQualityReportSchema = zod.z.object({
3096
3241
  totalScore: zod.z.number().min(0).max(100),
3097
3242
  languageAdherencePassed: zod.z.boolean().describe("True if content strictly matches the requested target language"),
3098
3243
  criteria: zod.z.array(JudgeCriterionSchema).min(3),
3099
- actionableRepairPrompts: zod.z.array(zod.z.string()).default([]).describe("Concrete instruction prompts to fix detected issues in the next repair turn")
3244
+ actionableRepairPrompts: zod.z.array(zod.z.string()).default([]).describe("Concrete instruction prompts to fix detected issues in the next repair turn"),
3245
+ structuredRepairs: zod.z.array(ActionableRepairPromptSchema).optional()
3100
3246
  });
3101
3247
  var ProjectProfileSchema = zod.z.object({
3102
3248
  id: zod.z.string().optional(),
@@ -4256,6 +4402,11 @@ async function generateExtensionFlow(input) {
4256
4402
  });
4257
4403
  return object;
4258
4404
  }
4405
+
4406
+ // src/constants/pedagogy.ts
4407
+ var JUDGE_AUTO_APPROVE_THRESHOLD = 85;
4408
+
4409
+ // src/ai/flows/auditCurriculumQualityFlow.ts
4259
4410
  async function auditCurriculumQualityFlow(input) {
4260
4411
  const model = getAIModel(input.modelOptions);
4261
4412
  const prompt = buildJudgePrompt({
@@ -4271,6 +4422,43 @@ async function auditCurriculumQualityFlow(input) {
4271
4422
  schema: CurriculumQualityReportSchema,
4272
4423
  prompt: `${prompt}
4273
4424
 
4425
+ Respond with a valid JSON object matching the schema.`
4426
+ });
4427
+ return object;
4428
+ }
4429
+ async function auditCurriculumPlanFlow(input) {
4430
+ const model = getAIModel(input.modelOptions);
4431
+ const prompt = buildCurriculumPlanJudgePrompt({
4432
+ planJson: input.planJson,
4433
+ briefingContext: input.briefingContext,
4434
+ expectedLanguage: input.expectedLanguage,
4435
+ linterFindings: input.linterFindings
4436
+ });
4437
+ const { object } = await ai.generateObject({
4438
+ model,
4439
+ schema: MacroPedagogyPlanAuditSchema,
4440
+ prompt: `${prompt}
4441
+
4442
+ Respond with a valid JSON object matching the schema.`
4443
+ });
4444
+ const autoApproved = object.totalScore >= JUDGE_AUTO_APPROVE_THRESHOLD && object.overallVerdict === "PASS";
4445
+ return {
4446
+ ...object,
4447
+ autoApproved
4448
+ };
4449
+ }
4450
+ async function auditProjectGraphFlow(input) {
4451
+ const model = getAIModel(input.modelOptions);
4452
+ const prompt = buildProjectGraphJudgePrompt({
4453
+ bundleJson: input.bundleJson,
4454
+ briefingContext: input.briefingContext,
4455
+ linterFindings: input.linterFindings
4456
+ });
4457
+ const { object } = await ai.generateObject({
4458
+ model,
4459
+ schema: ProjectGraphAuditSchema,
4460
+ prompt: `${prompt}
4461
+
4274
4462
  Respond with a valid JSON object matching the schema.`
4275
4463
  });
4276
4464
  return object;
@@ -5385,9 +5573,12 @@ exports.SLIDE_CANONICAL_METHODOLOGY = SLIDE_CANONICAL_METHODOLOGY;
5385
5573
  exports.activityTools = activityTools;
5386
5574
  exports.analystTools = analystTools;
5387
5575
  exports.assessorTools = assessorTools;
5576
+ exports.auditCurriculumPlanFlow = auditCurriculumPlanFlow;
5388
5577
  exports.auditCurriculumQualityFlow = auditCurriculumQualityFlow;
5578
+ exports.auditProjectGraphFlow = auditProjectGraphFlow;
5389
5579
  exports.buildActivityPrompt = buildActivityPrompt;
5390
5580
  exports.buildCodeLabPrompt = buildCodeLabPrompt;
5581
+ exports.buildCurriculumPlanJudgePrompt = buildCurriculumPlanJudgePrompt;
5391
5582
  exports.buildDiagnosticQuizPrompt = buildDiagnosticQuizPrompt;
5392
5583
  exports.buildExtensionPrompt = buildExtensionPrompt;
5393
5584
  exports.buildHandoutPrompt = buildHandoutPrompt;
@@ -5395,6 +5586,7 @@ exports.buildHtmlDeckSlidePrompt = buildHtmlDeckSlidePrompt;
5395
5586
  exports.buildJudgePrompt = buildJudgePrompt;
5396
5587
  exports.buildLessonMasterPrompt = buildLessonMasterPrompt;
5397
5588
  exports.buildMarpMarkdownSlidePrompt = buildMarpMarkdownSlidePrompt;
5589
+ exports.buildProjectGraphJudgePrompt = buildProjectGraphJudgePrompt;
5398
5590
  exports.buildProjectInstructionPrompt = buildProjectInstructionPrompt;
5399
5591
  exports.buildSelfLabPrompt = buildSelfLabPrompt;
5400
5592
  exports.buildSlidesPrompt = buildSlidesPrompt;