@thanh01.pmt/curriculum-kit 1.4.42 → 1.4.44

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.
@@ -1,25 +1,25 @@
1
1
  'use strict';
2
2
 
3
- var fs5 = require('fs');
3
+ var fs2 = require('fs');
4
4
  var path = require('path');
5
5
  var google = require('@ai-sdk/google');
6
6
  var openai = require('@ai-sdk/openai');
7
7
  var deepseek = require('@ai-sdk/deepseek');
8
8
  var ai = require('ai');
9
9
  var zod = require('zod');
10
+ var url = require('url');
10
11
  var workflow = require('workflow');
11
- var fs2 = require('fs/promises');
12
+ var fs3 = require('fs/promises');
12
13
  var rest = require('@octokit/rest');
13
14
  var supabaseJs = require('@supabase/supabase-js');
14
15
  require('crypto');
15
- var url = require('url');
16
16
 
17
17
  var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
18
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
19
19
 
20
- var fs5__default = /*#__PURE__*/_interopDefault(fs5);
21
- var path__default = /*#__PURE__*/_interopDefault(path);
22
20
  var fs2__default = /*#__PURE__*/_interopDefault(fs2);
21
+ var path__default = /*#__PURE__*/_interopDefault(path);
22
+ var fs3__default = /*#__PURE__*/_interopDefault(fs3);
23
23
 
24
24
  var __getOwnPropNames = Object.getOwnPropertyNames;
25
25
  var __esm = (fn, res) => function __init() {
@@ -160,8 +160,8 @@ function resolveApiKey(keyName, explicitKey) {
160
160
  path__default.default.resolve(currentDir, "../..", ".env")
161
161
  ];
162
162
  for (const envPath of envPaths) {
163
- if (fs5__default.default.existsSync(envPath)) {
164
- const content = fs5__default.default.readFileSync(envPath, "utf-8");
163
+ if (fs2__default.default.existsSync(envPath)) {
164
+ const content = fs2__default.default.readFileSync(envPath, "utf-8");
165
165
  for (const line of content.split("\n")) {
166
166
  const trimmed = line.trim();
167
167
  if (trimmed && !trimmed.startsWith("#") && trimmed.startsWith(keyName + "=")) {
@@ -2753,467 +2753,70 @@ zod.z.object({
2753
2753
  }),
2754
2754
  phases: zod.z.array(PhaseInputSchema).default([])
2755
2755
  });
2756
-
2757
- // src/templates/lessonTemplate.ts
2758
- var LESSON_PLAN_TEMPLATE = `
2759
- ---
2760
- id: "{{ID}}"
2761
- title: "{{TITLE}}"
2762
- type: "LESSON_5E"
2763
- created_by: "Curriculum OS Builder"
2764
- phase: "{{PHASE}}"
2765
- deliverable: "P3-T1"
2766
- version: "{{VERSION}}"
2767
- date: "{{DATE}}"
2768
- prerequisite: []
2769
- template_contract: "lesson-plan-v2"
2770
- template_required_sections:
2771
- - "A. Lesson Design Plan"
2772
- - "Learning Objectives & Evidence"
2773
- - "Activity Sequence"
2774
- - "Resource Map"
2775
- - "Assessment Map"
2776
- - "Artifact Contract"
2777
- - "B. Lesson Flow"
2778
- ---
2779
- <!-- INJECT_BODY -->
2780
-
2781
- # LESSON [{{LESSON_ID}}]: {{TITLE}} (5E Model)
2782
-
2783
- ## [REQUIRED] A. Lesson Design Plan
2784
-
2785
- ### 1. Learning Objectives & Evidence
2786
- - **Estimated Duration:** {{DURATION}}
2787
- - **Materials & Equipment:** {{MATERIALS_SUMMARY}}
2788
- - **Keywords / Core Concepts:** {{KEYWORDS}}
2789
-
2790
- | LO | Objective (Bloom's) | Student Evidence | Success Criteria |
2791
- |---|---|---|---|
2792
- {{LEARNING_OBJECTIVES_TABLE_ROWS}}
2793
-
2794
- ### 2. Activity Sequence
2795
- > This is the canonical activity contract. Satellite artifacts must expand this sequence and must not invent a different one.
2796
-
2797
- | Seq | 5E Phase | Activity Type | Actor | Purpose | Student Action | Teacher Move | Output/Evidence | LO | Time | Artifact Contract |
2798
- |---|---|---|---|---|---|---|---|---|---|---|
2799
- {{ACTIVITY_SEQUENCE_TABLE_ROWS}}
2800
-
2801
- ### 3. Resource Map
2802
- | Resource | Used In Activity | Purpose | Owner Artifact |
2803
- |---|---|---|---|
2804
- {{RESOURCE_MAP_TABLE_ROWS}}
2805
-
2806
- ### 4. Assessment Map
2807
- | Evidence | Assessed By | Criteria | Follow-up If Missing |
2808
- |---|---|---|---|
2809
- {{ASSESSMENT_MAP_TABLE_ROWS}}
2810
-
2811
- ### 5. Artifact Contract
2812
- - **ACT must expand:** {{ACT_CONTRACT}}
2813
- - **GUIDE must support:** {{GUIDE_CONTRACT}}
2814
- - **SLIDE must visualize:** {{SLIDE_CONTRACT}}
2815
- - **HANDOUT must provide:** {{HANDOUT_CONTRACT}}
2816
- - **WKS must practice:** {{WKS_CONTRACT}}
2817
- - **QUIZ must assess:** {{QUIZ_CONTRACT}}
2818
- - **EXT must extend:** {{EXT_CONTRACT}}
2819
-
2820
- ---
2821
-
2822
- ## [REQUIRED] B. Lesson Flow
2823
-
2824
- ### 1. ENGAGE \u2014 {{ENGAGE_DURATION}} mins
2825
- - **Hook Scenario:** {{HOOK_SCENARIO}}
2826
- - **Open Question:** {{HOOK_OPEN_QUESTION}}
2827
- - **Transition:** {{HOOK_TRANSITION}}
2828
-
2829
- ### 2. EXPLORE \u2014 {{EXPLORE_DURATION}} mins
2830
- - **Activity Reference:** {{EXPLORE_ACTIVITY_REF}}
2831
- - **Student Discovery:** {{EXPLORE_STUDENT_DISCOVERY}}
2832
-
2833
- ### 3. EXPLAIN \u2014 {{EXPLAIN_DURATION}} mins
2834
- - **Definitions:**
2835
- {{EXPLAIN_DEFINITIONS}}
2836
- - **Visual Illustration (REQUIRED):**
2837
- {{EXPLAIN_VISUAL_ILLUSTRATION}}
2838
-
2839
- ### 4. ELABORATE \u2014 {{ELABORATE_DURATION}} mins
2840
- - **Tiered Scaffolding:**
2841
- - \u{1F949} **Bronze:** {{DIFFERENTIATION_BRONZE}}
2842
- - \u{1F948} **Silver:** {{DIFFERENTIATION_SILVER}}
2843
- - \u{1F947} **Gold:** {{DIFFERENTIATION_GOLD}}
2844
-
2845
- > **ACT Contract**: Detailed operational instructions must expand the Activity Sequence above and must not change the planned evidence target.
2846
-
2847
- ### 5. EVALUATE \u2014 {{EVALUATE_DURATION}} mins
2848
- - **Exit Ticket:** {{EXIT_TICKET_CONTENT}}
2849
- - **Closing:** {{CLOSING_REMARKS}}
2850
-
2851
- > **QUIZ Contract**: Detailed assessment criteria and rubrics must assess the evidence and success criteria defined in the Lesson Design Plan.
2852
-
2853
- ---
2854
-
2855
- ## [OPTIONAL] Teacher Notes
2856
- - **Common Pitfalls:**
2857
- {{COMMON_PITFALLS}}
2858
- - **Troubleshooting:**
2859
- {{TROUBLESHOOTING_ROWS}}
2860
-
2861
- ---
2862
-
2863
- ## [REQUIRED] Artifact Linkage (Master Index)
2864
- > List all satellite files used in this lesson.
2865
-
2866
- | Artifact File | Role in the Classroom | When to Use |
2867
- |---|---|---|
2868
- | \`GUIDE_{{LESSON_ID}}.md\` | Detailed Teaching Script | Teacher preparation |
2869
- | \`SLIDE_{{LESSON_ID}}.md\` | Presentation Content | Throughout the session |
2870
- | \`HANDOUT_{{LESSON_ID}}.md\` | Theory Summary for Students | During EXPLAIN phase |
2871
- | \`ACT_{{LESSON_ID}}.md\` | Detailed Learning Activity Operations | During EXPLORE / ELABORATE / checkpoint phases |
2872
- | \`WKS_{{LESSON_ID}}.md\` | Individual Worksheet | Wrap-up or Homework |
2873
- | \`QUIZ_{{LESSON_ID}}.md\` | Assessment Rubric | During EVALUATE phase |
2874
- | \`EXT_{{LESSON_ID}}.md\` | Enrichment Materials | For "Gold" students |
2875
- `.trim();
2876
-
2877
- // src/templates/actTemplate.ts
2878
- var ACT_TEMPLATE = `
2879
- ---
2880
- id: "{{ID}}"
2881
- title: "{{TITLE}}"
2882
- type: "ACT"
2883
- created_by: "Curriculum OS Builder"
2884
- phase: "{{PHASE}}"
2885
- deliverable: "P3-T2"
2886
- version: "{{VERSION}}"
2887
- date: "{{DATE}}"
2888
- template_contract: "artifact-template-v1"
2889
- template_required_sections:
2890
- - "Computational Thinking Focus"
2891
- - "Materials & Setup"
2892
- - "Constraints & Safety"
2893
- - "Active Learning Workflow"
2894
- - "3-Tier Differentiation"
2895
- - "Reflection"
2896
- ---
2897
- <!-- INJECT_BODY -->
2898
-
2899
- # INQUIRY-BASED ACTIVITY: {{TITLE}}
2900
- _Milestone: {{MILESTONE_ID}} | Module: {{MODULE_NAME}} | Lesson: {{LESSON_ID}}_
2901
-
2902
- ## [REQUIRED] Computational Thinking Focus
2903
- - **Problem Statement (Real-world Scenario):** {{PROBLEM_STATEMENT}}
2904
- - **Decomposition:**
2905
- {{DECOMPOSITION_STEPS}}
2906
- - **Algorithm Design:** {{ALGORITHM_DESIGN}}
2907
-
2908
- ## [REQUIRED] Materials & Setup
2909
- - **Reference Material:** Students should use the **HANDOUT** for this lesson as their primary technical reference (lifeline).
2910
- - **Hardware/Software:**
2911
- <!-- [HARDWARE_BOM] -->
2912
- {{HARDWARE_ITEMS}}
2913
- <!-- [/HARDWARE_BOM] -->
2914
- - **Software:** {{SOFTWARE_ITEMS}}
2915
- - **Consumables:** {{CONSUMABLES}}
2916
- - **Other Resources:** {{OTHER_RESOURCES}}
2917
-
2918
- ## [REQUIRED] Constraints & Safety
2919
- - \u26A0\uFE0F **Technical/Safety:** {{SAFETY_WARNING}}
2920
- - \u{1F4A1} **Design Constraint:** {{DESIGN_CONSTRAINT}}
2921
-
2922
- ## [REQUIRED] Active Learning Workflow
2923
-
2924
- ### Phase 1: Planning & Design \u2014 {{PHASE1_DURATION}} mins
2925
- - **Student Task:** Hand-draw (or draft in words) the algorithm flowchart or connection architecture before touching the computer/devices.
2926
- - **Teacher Action:** Walk around to check the logic of each group. Ask inquiry questions:
2927
- {{PHASE1_INQUIRY_QUESTIONS}}
2928
-
2929
- ### Phase 2: Implementation & Discovery \u2014 {{PHASE2_DURATION}} mins
2930
- - **Student Task:** Apply the knowledge from the **HANDOUT** to realize the plan designed in Phase 1. Encourage self-inquiry and documentation lookup.
2931
- - **Teacher Action:** Avoid "hand-holding." Only intervene if a group has been stuck for more than 5 minutes.
2932
- {{PHASE2_GUIDANCE_BLOCK}}
2933
-
2934
- ### Phase 3: Debugging & Testing \u2014 {{PHASE3_DURATION}} mins
2935
- - **Testing:** Students run their system.
2936
- - **Error Analysis:** Ask students to record any error codes or unexpected behaviors and compare them with the Troubleshooting table in the Handout.
2937
- {{PHASE3_TESTING_STEPS}}
2938
-
2939
- ## [REQUIRED] 3-Tier Differentiation
2940
- > MUST design tasks in 3 tiers to support diverse learner groups. Bronze is the minimum requirement for all students.
2941
- - \u{1F949} **Bronze (Foundational):** {{DIFFERENTIATION_BRONZE}}
2942
- - \u{1F948} **Silver (Application):** {{DIFFERENTIATION_SILVER}}
2943
- - \u{1F947} **Gold (Enrichment/Creative):** {{DIFFERENTIATION_GOLD}}
2944
-
2945
- ## [REQUIRED] Reflection
2946
- - **Discussion Question:** {{REFLECTION_QUESTION}}
2947
- `.trim();
2948
-
2949
- // src/templates/codeLabTemplate.ts
2950
- var CODE_LAB_TEMPLATE = `
2951
- ---
2952
- id: "{{ID}}"
2953
- title: "{{TITLE}}"
2954
- type: "LAB"
2955
- created_by: "Curriculum OS Builder"
2956
- phase: "{{PHASE}}"
2957
- deliverable: "P3-T2"
2958
- version: "{{VERSION}}"
2959
- date: "{{DATE}}"
2960
- ---
2961
- <!-- INJECT_BODY -->
2962
-
2963
- # \u{1F468}\u200D\u{1F4BB} CODE LAB: {{TITLE}}
2964
- _Milestone: {{MILESTONE_ID}} | Tech Stack: {{TECH_STACK}}_
2965
-
2966
- ## \u{1F3AF} Overview
2967
- This lab focuses on the practical implementation of core technical concepts, bridging theory into working, robust, and testable code.
2968
-
2969
- ## \u{1F6E0}\uFE0F Environment & Setup
2970
- - **Language / Framework:** {{LANGUAGE_FRAMEWORK}}
2971
- - **IDE / Editor:** {{IDE_EDITOR}}
2972
- - **Required Libraries:** {{REQUIRED_LIBRARIES}}
2973
- - **Hardware / Connection Setup:** {{HARDWARE_ENV_CONNECTION}}
2974
-
2975
- ## \u{1F4DD} Lab Tasks (3-Tier Differentiation)
2976
-
2977
- ### \u{1F949} Bronze (Foundational) \u2014 {{BRONZE_MINS}} mins
2978
- **Objective:** {{BRONZE_OBJECTIVE}}
2979
- - **Task:** {{BRONZE_TASK}}
2980
- - **Requirement:** {{BRONZE_REQUIREMENT}}
2981
-
2982
- ### \u{1F948} Silver (Application) \u2014 {{SILVER_MINS}} mins
2983
- **Objective:** {{SILVER_OBJECTIVE}}
2984
- - **Task:** {{SILVER_TASK}}
2985
- - **Requirement:** {{SILVER_REQUIREMENT}}
2986
-
2987
- ### \u{1F947} Gold (Enrichment/Creative) \u2014 {{GOLD_MINS}} mins
2988
- **Objective:** {{GOLD_OBJECTIVE}}
2989
- - **Task:** {{GOLD_TASK}}
2990
- - **Requirement:** {{GOLD_REQUIREMENT}}
2991
-
2992
- ## \u{1F4BB} Technical Reference ([SME_MANDATE])
2993
- <!-- [SME_MANDATE] -->
2994
- > Any code provided in this section is verified for syntax accuracy and runtime execution.
2995
-
2996
- ### Starter Code Template
2997
- \`\`\`{{CODE_LANGUAGE}}
2998
- {{STARTER_CODE}}
2999
- \`\`\`
3000
-
3001
- ### Solution Code
3002
- \`\`\`{{CODE_LANGUAGE}}
3003
- {{SOLUTION_CODE}}
3004
- \`\`\`
3005
- <!-- [/SME_MANDATE] -->
3006
-
3007
- ## \u{1F50D} Troubleshooting & Debugging Matrix
3008
- | Issue | Potential Cause | Solution |
3009
- | :--- | :--- | :--- |
3010
- {{TROUBLESHOOTING_ROWS}}
3011
-
3012
- ## \u{1F3C1} Submission & Verification Checklist
3013
- {{CHECKLIST_ITEMS}}
3014
- `.trim();
3015
-
3016
- // src/templates/quizTemplate.ts
3017
- var QUIZ_TEMPLATE = `
3018
- ---
3019
- id: "{{ID}}"
3020
- title: "{{TITLE}}"
3021
- type: "QUIZ"
3022
- language: "{{LANGUAGE}}"
3023
- total_questions: {{TOTAL_QUESTIONS}}
3024
- passing_score_pct: {{PASSING_SCORE_PCT}}
3025
- ---
3026
-
3027
- # \u{1F9E0} Diagnostic & Active Recall Quiz: {{TITLE}}
3028
-
3029
- > \u23F1\uFE0F **Recommended Time:** ~10-15 mins
3030
- > \u{1F3AF} **Passing Score:** {{PASSING_SCORE_PCT}}%
3031
- > \u{1F4A1} **Purpose:** Test your conceptual understanding, catch hidden misconceptions, and evaluate architectural trade-offs.
3032
-
3033
- ---
3034
-
3035
- {{QUESTIONS_SECTION}}
3036
-
3037
- ---
3038
-
3039
- ## \u{1F511} Comprehensive Answer Key & Deep Explanation (Expand after completing)
3040
- <details>
3041
- <summary><b>\u{1F449} Click to View Full Explanations & Common Pitfall Analysis</b></summary>
3042
-
3043
- {{ANSWER_KEY_SECTION}}
3044
- </details>
3045
- `.trim();
3046
-
3047
- // src/templates/selfLabTemplate.ts
3048
- var SELF_LAB_TEMPLATE = `
3049
- ---
3050
- id: "{{ID}}"
3051
- title: "{{TITLE}}"
3052
- type: "SELF_LAB"
3053
- language: "{{LANGUAGE}}"
3054
- difficulty: "{{DIFFICULTY}}"
3055
- estimated_minutes: {{ESTIMATED_MINUTES}}
3056
- tech_stack: {{TECH_STACK}}
3057
- ---
3058
-
3059
- # \u{1F680} Self-Paced Hands-On Lab: {{TITLE}}
3060
-
3061
- > \u23F1\uFE0F **Estimated Duration:** ~{{ESTIMATED_MINUTES}} mins
3062
- > \u{1F3AF} **Difficulty Level:** {{DIFFICULTY_UPPER}}
3063
- > \u{1F9F0} **Tech Stack:** {{TECH_STACK_STR}}
3064
- > \u{1F4A1} **Self-Learner Notice:** You are in full control of this lab. Follow the progressive challenges below. If you get stuck at any point, use the **Progressive Hints System** to get unstuck without ruining the learning experience!
3065
-
3066
- ---
3067
-
3068
- ## \u{1F4CB} Mission Briefing & Environment Setup
3069
- {{MISSION_BRIEFING}}
3070
-
3071
- ### \u{1F6EB} Preflight Checklist
3072
- {{PREFLIGHT_CHECKLIST}}
3073
-
3074
- ---
3075
-
3076
- ## \u{1F3AF} Progressive Challenges (3-Tier Differentiation)
3077
-
3078
- ### \u{1F949} Challenge 1: Foundational Core (Bronze) \u2014 ~{{BRONZE_MINS}} mins
3079
- **Objective:** {{BRONZE_OBJECTIVE}}
3080
-
3081
- #### Tasks & Implementation Details:
3082
- {{BRONZE_TASKS}}
3083
-
3084
- #### \u{1F9EA} Self-Verification Command:
3085
- \`\`\`bash
3086
- {{BRONZE_VERIFY_COMMAND}}
3087
- \`\`\`
3088
- *Expected Terminal Output:*
3089
- \`\`\`text
3090
- {{BRONZE_EXPECTED_OUTPUT}}
3091
- \`\`\`
3092
-
3093
- #### \u{1F4A1} Progressive Hints (Expand only if stuck):
3094
- <details>
3095
- <summary><b>\u{1F4A1} Hint Level 1: Conceptual Clue (H\u01B0\u1EDBng t\u01B0 duy)</b></summary>
3096
-
3097
- {{BRONZE_HINT_1}}
3098
- </details>
3099
-
3100
- <details>
3101
- <summary><b>\u{1F50D} Hint Level 2: Structural Skeleton (Khung code m\u1EABu)</b></summary>
3102
-
3103
- \`\`\`{{CODE_LANGUAGE}}
3104
- {{BRONZE_HINT_2}}
3105
- \`\`\`
3106
- </details>
3107
-
3108
- <details>
3109
- <summary><b>\u{1F6A8} Hint Level 3: Full Solution & Explanation (L\u1EDDi gi\u1EA3i tr\u1ECDn v\u1EB9n)</b></summary>
3110
-
3111
- \`\`\`{{CODE_LANGUAGE}}
3112
- {{BRONZE_HINT_3_CODE}}
3113
- \`\`\`
3114
-
3115
- **Why this solution works:**
3116
- {{BRONZE_HINT_3_EXPLANATION}}
3117
- </details>
3118
-
3119
- ---
3120
-
3121
- ### \u{1F948} Challenge 2: Logic & Error Handling (Silver) \u2014 ~{{SILVER_MINS}} mins
3122
- **Objective:** {{SILVER_OBJECTIVE}}
3123
-
3124
- #### Tasks & Implementation Details:
3125
- {{SILVER_TASKS}}
3126
-
3127
- #### \u{1F9EA} Self-Verification Command:
3128
- \`\`\`bash
3129
- {{SILVER_VERIFY_COMMAND}}
3130
- \`\`\`
3131
- *Expected Terminal Output:*
3132
- \`\`\`text
3133
- {{SILVER_EXPECTED_OUTPUT}}
3134
- \`\`\`
3135
-
3136
- #### \u{1F4A1} Progressive Hints (Expand only if stuck):
3137
- <details>
3138
- <summary><b>\u{1F4A1} Hint Level 1: Conceptual Clue (H\u01B0\u1EDBng t\u01B0 duy)</b></summary>
3139
-
3140
- {{SILVER_HINT_1}}
3141
- </details>
3142
-
3143
- <details>
3144
- <summary><b>\u{1F50D} Hint Level 2: Structural Skeleton (Khung code m\u1EABu)</b></summary>
3145
-
3146
- \`\`\`{{CODE_LANGUAGE}}
3147
- {{SILVER_HINT_2}}
3148
- \`\`\`
3149
- </details>
3150
-
3151
- <details>
3152
- <summary><b>\u{1F6A8} Hint Level 3: Full Solution & Explanation (L\u1EDDi gi\u1EA3i tr\u1ECDn v\u1EB9n)</b></summary>
3153
-
3154
- \`\`\`{{CODE_LANGUAGE}}
3155
- {{SILVER_HINT_3_CODE}}
3156
- \`\`\`
3157
-
3158
- **Why this solution works:**
3159
- {{SILVER_HINT_3_EXPLANATION}}
3160
- </details>
3161
-
3162
- ---
3163
-
3164
- ### \u{1F947} Challenge 3: Edge Cases & Optimization (Gold) \u2014 ~{{GOLD_MINS}} mins
3165
- **Objective:** {{GOLD_OBJECTIVE}}
3166
-
3167
- #### Tasks & Implementation Details:
3168
- {{GOLD_TASKS}}
3169
-
3170
- #### \u{1F9EA} Self-Verification Command:
3171
- \`\`\`bash
3172
- {{GOLD_VERIFY_COMMAND}}
3173
- \`\`\`
3174
- *Expected Terminal Output:*
3175
- \`\`\`text
3176
- {{GOLD_EXPECTED_OUTPUT}}
3177
- \`\`\`
3178
-
3179
- #### \u{1F4A1} Progressive Hints (Expand only if stuck):
3180
- <details>
3181
- <summary><b>\u{1F4A1} Hint Level 1: Conceptual Clue (H\u01B0\u1EDBng t\u01B0 duy)</b></summary>
3182
-
3183
- {{GOLD_HINT_1}}
3184
- </details>
3185
-
3186
- <details>
3187
- <summary><b>\u{1F50D} Hint Level 2: Structural Skeleton (Khung code m\u1EABu)</b></summary>
3188
-
3189
- \`\`\`{{CODE_LANGUAGE}}
3190
- {{GOLD_HINT_2}}
3191
- \`\`\`
3192
- </details>
3193
-
3194
- <details>
3195
- <summary><b>\u{1F6A8} Hint Level 3: Full Solution & Explanation (L\u1EDDi gi\u1EA3i tr\u1ECDn v\u1EB9n)</b></summary>
3196
-
3197
- \`\`\`{{CODE_LANGUAGE}}
3198
- {{GOLD_HINT_3_CODE}}
3199
- \`\`\`
3200
-
3201
- **Why this solution works:**
3202
- {{GOLD_HINT_3_EXPLANATION}}
3203
- </details>
3204
-
3205
- ---
3206
-
3207
- ## \u{1F50D} Self-Learner Troubleshooting Matrix
3208
- | Symptom / Error Message | Root Cause | Exact Fix |
3209
- | :--- | :--- | :--- |
3210
- {{TROUBLESHOOTING_ROWS}}
3211
-
3212
- ---
3213
-
3214
- ## \u{1F3C1} Final Lab Submission & Mastery Checklist
3215
- {{FINAL_CHECKLIST}}
3216
- `.trim();
2756
+ function stripTemplateFrontmatter(raw) {
2757
+ let body = raw;
2758
+ if (body.startsWith("---")) {
2759
+ const end = body.indexOf("\n---", 3);
2760
+ if (end !== -1) body = body.slice(end + 4);
2761
+ }
2762
+ return body.split("\n").filter((l) => l.trim() !== "<!-- INJECT_BODY -->").join("\n").replace(/^\s*\n/, "").trimEnd();
2763
+ }
2764
+ var KIT_TEMPLATE_FALLBACK_DIRS = [
2765
+ // Packaged with the npm bundle (dist/templates) — resolves from node_modules.
2766
+ "templates",
2767
+ // Repo checkout layouts.
2768
+ "docs/refs/templates"
2769
+ ];
2770
+ var _moduleDir = (() => {
2771
+ try {
2772
+ if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== "undefined" && typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) === "string") {
2773
+ return path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
2774
+ }
2775
+ } catch {
2776
+ }
2777
+ return typeof __dirname !== "undefined" ? __dirname : process.cwd();
2778
+ })();
2779
+ function candidateDirs(explicitDir) {
2780
+ const dirs = [];
2781
+ if (process.env.CURRICULUM_TEMPLATES_DIR) dirs.push(process.env.CURRICULUM_TEMPLATES_DIR);
2782
+ dirs.push(path__default.default.resolve(process.cwd(), "_templates"));
2783
+ for (const rel of KIT_TEMPLATE_FALLBACK_DIRS) {
2784
+ dirs.push(path__default.default.resolve(_moduleDir, rel));
2785
+ dirs.push(path__default.default.resolve(process.cwd(), rel));
2786
+ dirs.push(path__default.default.resolve(process.cwd(), "packages/curriculum-kit", rel));
2787
+ }
2788
+ return dirs;
2789
+ }
2790
+ function findTemplatePath(templateName, explicitDir) {
2791
+ for (const dir of candidateDirs()) {
2792
+ const p = path__default.default.join(dir, templateName);
2793
+ if (!fs2__default.default.existsSync(p)) continue;
2794
+ try {
2795
+ fs2__default.default.accessSync(p, fs2__default.default.constants.R_OK);
2796
+ return p;
2797
+ } catch {
2798
+ }
2799
+ }
2800
+ return null;
2801
+ }
2802
+ function loadCurriculumTemplate(templateName, templatesDir) {
2803
+ const p = findTemplatePath(templateName);
2804
+ if (!p) return "";
2805
+ try {
2806
+ return fs2__default.default.readFileSync(p, "utf-8");
2807
+ } catch {
2808
+ return "";
2809
+ }
2810
+ }
2811
+ function loadAuthoringTemplate(templateName, templatesDir) {
2812
+ const p = findTemplatePath(templateName);
2813
+ if (!p) return "";
2814
+ try {
2815
+ return stripTemplateFrontmatter(fs2__default.default.readFileSync(p, "utf-8"));
2816
+ } catch {
2817
+ return "";
2818
+ }
2819
+ }
3217
2820
 
3218
2821
  // src/ai/prompts/lessonMasterPrompt.ts
3219
2822
  function buildLessonMasterPrompt(input) {
@@ -3267,7 +2870,7 @@ Build a deep, rigorous, and highly pedagogical Master Lesson Plan (LESSON) that
3267
2870
  # MANDATORY TEMPLATE STRUCTURE
3268
2871
  You MUST generate structured data that will render directly into this exact Markdown template:
3269
2872
  ---
3270
- ${LESSON_PLAN_TEMPLATE}
2873
+ ${loadAuthoringTemplate("LESSON_5E_template.md") ?? "[TEMPLATE FILE NOT FOUND: LESSON_5E_template.md]"}
3271
2874
  ---
3272
2875
 
3273
2876
  # INPUT PARAMETERS
@@ -3345,7 +2948,7 @@ Transform the exact pedagogical flow and activities from the Master Lesson Plan
3345
2948
  # MANDATORY TEMPLATE STRUCTURE
3346
2949
  You MUST generate data aligned with this Markdown template:
3347
2950
  ---
3348
- ${ACT_TEMPLATE}
2951
+ ${loadAuthoringTemplate("ACT_template.md") ?? "[TEMPLATE FILE NOT FOUND: ACT_template.md]"}
3349
2952
  ---
3350
2953
 
3351
2954
  # CANONICAL MASTER LESSON CONTEXT (SOURCE OF TRUTH)
@@ -3440,7 +3043,7 @@ Generate complete, verified source code that satisfies the lesson objectives and
3440
3043
  # MANDATORY TEMPLATE STRUCTURE
3441
3044
  You MUST generate data aligned with this Markdown template:
3442
3045
  ---
3443
- ${CODE_LAB_TEMPLATE}
3046
+ ${loadAuthoringTemplate("LAB_TEMPLATE.md") ?? "[TEMPLATE FILE NOT FOUND: LAB_TEMPLATE.md]"}
3444
3047
  ---
3445
3048
 
3446
3049
  # CANONICAL LESSON CONTEXT (SOURCE OF TRUTH)
@@ -3852,7 +3455,7 @@ Build a complete, engaging Self-Paced Hands-On Lab (SELF_LAB) for autonomous lea
3852
3455
  # MANDATORY TEMPLATE STRUCTURE
3853
3456
  You MUST generate data aligned with this Markdown template:
3854
3457
  ---
3855
- ${SELF_LAB_TEMPLATE}
3458
+ ${loadAuthoringTemplate("SELF_LAB_template.md") ?? "[TEMPLATE FILE NOT FOUND: SELF_LAB_template.md]"}
3856
3459
  ---
3857
3460
 
3858
3461
  # INPUT PARAMETERS
@@ -3989,7 +3592,7 @@ Use this mapping to determine which Bloom level each question truly targets. Mat
3989
3592
  # MANDATORY TEMPLATE STRUCTURE
3990
3593
  You MUST generate data aligned with this Markdown template:
3991
3594
  ---
3992
- ${QUIZ_TEMPLATE}
3595
+ ${loadAuthoringTemplate("QUIZ_v4.6_template.md") ?? "[TEMPLATE FILE NOT FOUND: QUIZ_v4.6_template.md]"}
3993
3596
  ---
3994
3597
 
3995
3598
  # INPUT PARAMETERS
@@ -4972,7 +4575,7 @@ var LocalWorkspaceManager = class {
4972
4575
  }
4973
4576
  async initJobWorkspace(jobId, initialInfo) {
4974
4577
  const jobDir = this.getJobDirectory(jobId);
4975
- await fs2__default.default.mkdir(jobDir, { recursive: true });
4578
+ await fs3__default.default.mkdir(jobDir, { recursive: true });
4976
4579
  const now = (/* @__PURE__ */ new Date()).toISOString();
4977
4580
  const manifest = {
4978
4581
  jobId,
@@ -4992,10 +4595,10 @@ var LocalWorkspaceManager = class {
4992
4595
  async saveArtifact(jobId, milestoneSlug, filename, content, artifactType) {
4993
4596
  const jobDir = this.getJobDirectory(jobId);
4994
4597
  const targetDir = path__default.default.join(jobDir, milestoneSlug);
4995
- await fs2__default.default.mkdir(targetDir, { recursive: true });
4598
+ await fs3__default.default.mkdir(targetDir, { recursive: true });
4996
4599
  const filePath = path__default.default.join(targetDir, filename);
4997
- await fs2__default.default.writeFile(filePath, content, "utf-8");
4998
- const stat = await fs2__default.default.stat(filePath);
4600
+ await fs3__default.default.writeFile(filePath, content, "utf-8");
4601
+ const stat = await fs3__default.default.stat(filePath);
4999
4602
  const manifest = await this.getManifest(jobId);
5000
4603
  if (manifest) {
5001
4604
  manifest.artifacts.push({
@@ -5013,7 +4616,7 @@ var LocalWorkspaceManager = class {
5013
4616
  async getManifest(jobId) {
5014
4617
  const manifestPath = path__default.default.join(this.getJobDirectory(jobId), "manifest.json");
5015
4618
  try {
5016
- const data = await fs2__default.default.readFile(manifestPath, "utf-8");
4619
+ const data = await fs3__default.default.readFile(manifestPath, "utf-8");
5017
4620
  return JSON.parse(data);
5018
4621
  } catch {
5019
4622
  return null;
@@ -5022,7 +4625,7 @@ var LocalWorkspaceManager = class {
5022
4625
  async saveManifest(jobId, manifest) {
5023
4626
  const manifestPath = path__default.default.join(this.getJobDirectory(jobId), "manifest.json");
5024
4627
  manifest.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
5025
- await fs2__default.default.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
4628
+ await fs3__default.default.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
5026
4629
  }
5027
4630
  async markMilestoneCompleted(jobId) {
5028
4631
  const manifest = await this.getManifest(jobId);
@@ -5059,13 +4662,13 @@ async function publishToGitHub(options) {
5059
4662
  try {
5060
4663
  const filesToUpload = [];
5061
4664
  async function scanDir(currentDir) {
5062
- const entries = await fs2__default.default.readdir(currentDir, { withFileTypes: true });
4665
+ const entries = await fs3__default.default.readdir(currentDir, { withFileTypes: true });
5063
4666
  for (const entry of entries) {
5064
4667
  const fullPath = path__default.default.join(currentDir, entry.name);
5065
4668
  if (entry.isDirectory()) {
5066
4669
  await scanDir(fullPath);
5067
4670
  } else if (entry.isFile() && !entry.name.startsWith(".")) {
5068
- const content = await fs2__default.default.readFile(fullPath, "utf-8");
4671
+ const content = await fs3__default.default.readFile(fullPath, "utf-8");
5069
4672
  const relPath = path__default.default.relative(options.localJobDir, fullPath);
5070
4673
  filesToUpload.push({ path: relPath, content });
5071
4674
  }
@@ -19786,53 +19389,6 @@ zod.z.object({
19786
19389
  assessmentMap: zod.z.array(zod.z.record(zod.z.string())).default([]),
19787
19390
  tieredScaffolding: zod.z.object({ bronze: zod.z.string().default(""), silver: zod.z.string().default(""), gold: zod.z.string().default("") }).default({ bronze: "", silver: "", gold: "" })
19788
19391
  });
19789
- var KIT_TEMPLATE_FALLBACK_DIRS = [
19790
- // Packaged with the npm bundle (dist/templates) — resolves from node_modules.
19791
- "templates",
19792
- // Repo checkout layouts.
19793
- "docs/refs/templates"
19794
- ];
19795
- var _moduleDir = (() => {
19796
- try {
19797
- if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) }) !== "undefined" && typeof (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)) === "string") {
19798
- return path__default.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
19799
- }
19800
- } catch {
19801
- }
19802
- return typeof __dirname !== "undefined" ? __dirname : process.cwd();
19803
- })();
19804
- function candidateDirs(explicitDir) {
19805
- const dirs = [];
19806
- if (process.env.CURRICULUM_TEMPLATES_DIR) dirs.push(process.env.CURRICULUM_TEMPLATES_DIR);
19807
- dirs.push(path__default.default.resolve(process.cwd(), "_templates"));
19808
- for (const rel of KIT_TEMPLATE_FALLBACK_DIRS) {
19809
- dirs.push(path__default.default.resolve(_moduleDir, rel));
19810
- dirs.push(path__default.default.resolve(process.cwd(), rel));
19811
- dirs.push(path__default.default.resolve(process.cwd(), "packages/curriculum-kit", rel));
19812
- }
19813
- return dirs;
19814
- }
19815
- function findTemplatePath(templateName, explicitDir) {
19816
- for (const dir of candidateDirs()) {
19817
- const p = path__default.default.join(dir, templateName);
19818
- if (!fs5__default.default.existsSync(p)) continue;
19819
- try {
19820
- fs5__default.default.accessSync(p, fs5__default.default.constants.R_OK);
19821
- return p;
19822
- } catch {
19823
- }
19824
- }
19825
- return null;
19826
- }
19827
- function loadCurriculumTemplate(templateName, templatesDir) {
19828
- const p = findTemplatePath(templateName);
19829
- if (!p) return "";
19830
- try {
19831
- return fs5__default.default.readFileSync(p, "utf-8");
19832
- } catch {
19833
- return "";
19834
- }
19835
- }
19836
19392
 
19837
19393
  // src/services/singleArtifactService.ts
19838
19394
  init_errors();