@thanh01.pmt/curriculum-kit 1.0.2 → 1.0.3
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-PDw11tpD.d.cts → index-BIhxrUEa.d.cts} +6 -1
- package/dist/{index-BAUtASfr.d.ts → index-BvWC_xXe.d.ts} +6 -1
- package/dist/index.cjs +294 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +294 -18
- package/dist/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +320 -44
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.d.cts +1 -1
- package/dist/workflow/index.d.ts +1 -1
- package/dist/workflow/index.mjs +319 -43
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/workflow/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var fs = require('fs');
|
|
4
|
-
var
|
|
4
|
+
var path4 = require('path');
|
|
5
5
|
var ai = require('ai');
|
|
6
6
|
var google = require('@ai-sdk/google');
|
|
7
7
|
var openai = require('@ai-sdk/openai');
|
|
@@ -36,7 +36,7 @@ function _interopNamespace(e) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
var fs__default = /*#__PURE__*/_interopDefault(fs);
|
|
39
|
-
var
|
|
39
|
+
var path4__default = /*#__PURE__*/_interopDefault(path4);
|
|
40
40
|
var workflowPkg__namespace = /*#__PURE__*/_interopNamespace(workflowPkg);
|
|
41
41
|
var fs2__default = /*#__PURE__*/_interopDefault(fs2);
|
|
42
42
|
|
|
@@ -155,14 +155,14 @@ function resolveApiKey(keyName, explicitKey) {
|
|
|
155
155
|
try {
|
|
156
156
|
const currentDir = process.cwd();
|
|
157
157
|
const envPaths = [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
158
|
+
path4__default.default.resolve(currentDir, ".env.local"),
|
|
159
|
+
path4__default.default.resolve(currentDir, ".env"),
|
|
160
|
+
path4__default.default.resolve(currentDir, "apps/web/.env.local"),
|
|
161
|
+
path4__default.default.resolve(currentDir, "packages/learnwell-platform/.env"),
|
|
162
|
+
path4__default.default.resolve(currentDir, "..", ".env.local"),
|
|
163
|
+
path4__default.default.resolve(currentDir, "..", ".env"),
|
|
164
|
+
path4__default.default.resolve(currentDir, "../..", ".env.local"),
|
|
165
|
+
path4__default.default.resolve(currentDir, "../..", ".env")
|
|
166
166
|
];
|
|
167
167
|
for (const envPath of envPaths) {
|
|
168
168
|
if (fs__default.default.existsSync(envPath)) {
|
|
@@ -4601,10 +4601,10 @@ ${answerKeySection}
|
|
|
4601
4601
|
var LocalWorkspaceManager = class {
|
|
4602
4602
|
baseDir;
|
|
4603
4603
|
constructor(baseDir) {
|
|
4604
|
-
this.baseDir = baseDir ||
|
|
4604
|
+
this.baseDir = baseDir || path4__default.default.resolve(process.cwd(), "output", "workspace-jobs");
|
|
4605
4605
|
}
|
|
4606
4606
|
getJobDirectory(jobId) {
|
|
4607
|
-
return
|
|
4607
|
+
return path4__default.default.join(this.baseDir, jobId);
|
|
4608
4608
|
}
|
|
4609
4609
|
async initJobWorkspace(jobId, initialInfo) {
|
|
4610
4610
|
const jobDir = this.getJobDirectory(jobId);
|
|
@@ -4627,9 +4627,9 @@ var LocalWorkspaceManager = class {
|
|
|
4627
4627
|
}
|
|
4628
4628
|
async saveArtifact(jobId, milestoneSlug, filename, content, artifactType) {
|
|
4629
4629
|
const jobDir = this.getJobDirectory(jobId);
|
|
4630
|
-
const targetDir =
|
|
4630
|
+
const targetDir = path4__default.default.join(jobDir, milestoneSlug);
|
|
4631
4631
|
await fs2__default.default.mkdir(targetDir, { recursive: true });
|
|
4632
|
-
const filePath =
|
|
4632
|
+
const filePath = path4__default.default.join(targetDir, filename);
|
|
4633
4633
|
await fs2__default.default.writeFile(filePath, content, "utf-8");
|
|
4634
4634
|
const stat = await fs2__default.default.stat(filePath);
|
|
4635
4635
|
const manifest = await this.getManifest(jobId);
|
|
@@ -4637,7 +4637,7 @@ var LocalWorkspaceManager = class {
|
|
|
4637
4637
|
manifest.artifacts.push({
|
|
4638
4638
|
milestoneId: milestoneSlug,
|
|
4639
4639
|
artifactType,
|
|
4640
|
-
filePath:
|
|
4640
|
+
filePath: path4__default.default.relative(jobDir, filePath),
|
|
4641
4641
|
sizeBytes: stat.size,
|
|
4642
4642
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4643
4643
|
});
|
|
@@ -4647,7 +4647,7 @@ var LocalWorkspaceManager = class {
|
|
|
4647
4647
|
return filePath;
|
|
4648
4648
|
}
|
|
4649
4649
|
async getManifest(jobId) {
|
|
4650
|
-
const manifestPath =
|
|
4650
|
+
const manifestPath = path4__default.default.join(this.getJobDirectory(jobId), "manifest.json");
|
|
4651
4651
|
try {
|
|
4652
4652
|
const data = await fs2__default.default.readFile(manifestPath, "utf-8");
|
|
4653
4653
|
return JSON.parse(data);
|
|
@@ -4656,7 +4656,7 @@ var LocalWorkspaceManager = class {
|
|
|
4656
4656
|
}
|
|
4657
4657
|
}
|
|
4658
4658
|
async saveManifest(jobId, manifest) {
|
|
4659
|
-
const manifestPath =
|
|
4659
|
+
const manifestPath = path4__default.default.join(this.getJobDirectory(jobId), "manifest.json");
|
|
4660
4660
|
manifest.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4661
4661
|
await fs2__default.default.writeFile(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
4662
4662
|
}
|
|
@@ -4697,12 +4697,12 @@ async function publishToGitHub(options) {
|
|
|
4697
4697
|
async function scanDir(currentDir) {
|
|
4698
4698
|
const entries = await fs2__default.default.readdir(currentDir, { withFileTypes: true });
|
|
4699
4699
|
for (const entry of entries) {
|
|
4700
|
-
const fullPath =
|
|
4700
|
+
const fullPath = path4__default.default.join(currentDir, entry.name);
|
|
4701
4701
|
if (entry.isDirectory()) {
|
|
4702
4702
|
await scanDir(fullPath);
|
|
4703
4703
|
} else if (entry.isFile() && !entry.name.startsWith(".")) {
|
|
4704
4704
|
const content = await fs2__default.default.readFile(fullPath, "utf-8");
|
|
4705
|
-
const relPath =
|
|
4705
|
+
const relPath = path4__default.default.relative(options.localJobDir, fullPath);
|
|
4706
4706
|
filesToUpload.push({ path: relPath, content });
|
|
4707
4707
|
}
|
|
4708
4708
|
}
|
|
@@ -5919,16 +5919,18 @@ init_errors();
|
|
|
5919
5919
|
|
|
5920
5920
|
// src/services/lessonProductionService.ts
|
|
5921
5921
|
var __filename$1 = 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" ? 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))) : "";
|
|
5922
|
-
var _resolvedDir = __filename$1 ?
|
|
5922
|
+
var _resolvedDir = __filename$1 ? path4__default.default.dirname(__filename$1) : typeof __dirname !== "undefined" ? __dirname : process.cwd();
|
|
5923
5923
|
function loadCurriculumTemplate(templateName) {
|
|
5924
5924
|
const candidatePaths = [
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5925
|
+
path4__default.default.resolve("/Users/tonypham/MEGA/WebApp/WIP/learnwell-platform/packages/curriculum-kit/docs/refs/templates", templateName),
|
|
5926
|
+
path4__default.default.resolve(process.cwd(), "packages/curriculum-kit/docs/refs/templates", templateName),
|
|
5927
|
+
path4__default.default.resolve(process.cwd(), "_templates", templateName),
|
|
5928
|
+
path4__default.default.resolve(process.cwd(), "docs/refs/templates", templateName),
|
|
5929
|
+
path4__default.default.resolve(_resolvedDir, "../docs/refs/templates", templateName),
|
|
5930
|
+
path4__default.default.resolve(_resolvedDir, "../../docs/refs/templates", templateName),
|
|
5931
|
+
path4__default.default.resolve(_resolvedDir, "../../../docs/refs/templates", templateName),
|
|
5932
|
+
path4__default.default.resolve("/Users/tonypham/MEGA/WebApp/content-gen/the-ultimate-curriculum-agent-os/_templates", templateName),
|
|
5933
|
+
path4__default.default.resolve(_resolvedDir, "../../../../the-ultimate-curriculum-agent-os/_templates", templateName)
|
|
5932
5934
|
];
|
|
5933
5935
|
for (const p of candidatePaths) {
|
|
5934
5936
|
if (fs__default.default.existsSync(p)) {
|
|
@@ -5944,11 +5946,14 @@ function loadCurriculumTemplate(templateName) {
|
|
|
5944
5946
|
|
|
5945
5947
|
// src/services/singleArtifactService.ts
|
|
5946
5948
|
init_errors();
|
|
5947
|
-
function getArtifactMetadata(type, lessonId) {
|
|
5949
|
+
function getArtifactMetadata(type, lessonId, pedagogy) {
|
|
5948
5950
|
const id = lessonId || "ON_DEMAND";
|
|
5949
5951
|
switch (type) {
|
|
5950
|
-
case "lesson":
|
|
5951
|
-
|
|
5952
|
+
case "lesson": {
|
|
5953
|
+
const p = (pedagogy || "").toLowerCase();
|
|
5954
|
+
const templateFile = p === "edp" ? "LESSON_EDP_template.md" : p === "general" ? "LESSON_GENERAL_template.md" : "LESSON_5E_template.md";
|
|
5955
|
+
return { filename: `LESSON_${id}.md`, persona: "@content", templateFile };
|
|
5956
|
+
}
|
|
5952
5957
|
case "slide":
|
|
5953
5958
|
return { filename: `SLIDE_${id}.md`, persona: "@illustrator", templateFile: "SLIDE_template.md" };
|
|
5954
5959
|
case "act":
|
|
@@ -5989,6 +5994,8 @@ function getArtifactMetadata(type, lessonId) {
|
|
|
5989
5994
|
return { filename: `REVIEW_GAME_${id}.md`, persona: "@assessor", templateFile: "REVIEW_GAME_template.md" };
|
|
5990
5995
|
case "graphic_organizer":
|
|
5991
5996
|
return { filename: `GRAPHIC_ORGANIZER_${id}.md`, persona: "@illustrator", templateFile: "GRAPHIC_ORGANIZER_template.md" };
|
|
5997
|
+
default:
|
|
5998
|
+
return { filename: `ARTIFACT_${id}.md`, persona: "@content", templateFile: "LESSON_5E_template.md" };
|
|
5992
5999
|
}
|
|
5993
6000
|
}
|
|
5994
6001
|
async function generateSingleArtifact(req) {
|
|
@@ -6001,24 +6008,50 @@ async function generateSingleArtifact(req) {
|
|
|
6001
6008
|
targetAge = "14-18 years old (High School / Early College)",
|
|
6002
6009
|
scaffoldingLevel = "balanced",
|
|
6003
6010
|
hardwarePlatform = ["MacBook Lab (macOS 14+ / Swift 6)"],
|
|
6011
|
+
gradeLevel,
|
|
6012
|
+
studentCount,
|
|
6013
|
+
language = "Vietnamese",
|
|
6014
|
+
extraContext,
|
|
6015
|
+
config,
|
|
6004
6016
|
contextSot = {},
|
|
6005
6017
|
options = {},
|
|
6006
6018
|
onChunk
|
|
6007
6019
|
} = req;
|
|
6008
|
-
const meta = getArtifactMetadata(artifactType, lessonId);
|
|
6009
|
-
const templateContent = loadCurriculumTemplate(meta.templateFile);
|
|
6020
|
+
const meta = getArtifactMetadata(artifactType, lessonId, pedagogy || config?.pedagogicalModel);
|
|
6010
6021
|
const displayTitle = lessonTitle || topic;
|
|
6022
|
+
const loadedTemplate = loadCurriculumTemplate(meta.templateFile);
|
|
6023
|
+
const templateContent = loadedTemplate || getDefaultFallbackTemplate(artifactType, displayTitle, lessonId || "ON_DEMAND");
|
|
6011
6024
|
const hwStr = hardwarePlatform.join(", ");
|
|
6025
|
+
const selectedDevices = (config?.devices || (hardwarePlatform[0]?.toLowerCase().includes("paper") ? "paper-only" : "laptop")).toLowerCase();
|
|
6026
|
+
const isBilingual = language.toLowerCase().includes("bilingual") || language.toLowerCase().includes("song");
|
|
6027
|
+
const isVietnamese = !isBilingual && language.toLowerCase().includes("viet");
|
|
6028
|
+
const langRule = isBilingual ? `1. AUTHORING LANGUAGE: Bilingual (Vietnamese - English). Headings and core conceptual definitions should be presented in Vietnamese with English technical terms in parentheses. Explanations and instructional text are in Vietnamese. Key code terms, comments, and challenge summaries are presented bilingually.` : isVietnamese ? `1. AUTHORING LANGUAGE: Vietnamese for all instructional text, explanations, questions, rubrics, and presenter notes. Programming code, syntax keywords, and standard API identifiers remain in standard English (with Vietnamese explanation comments/notes).` : `1. AUTHORING LANGUAGE: 100% English (Plan C Canonical Specification).`;
|
|
6029
|
+
const isPaperOnly = selectedDevices === "paper-only" || hwStr.toLowerCase().includes("paper") || hwStr.toLowerCase().includes("print-ready");
|
|
6030
|
+
const deviceRule = isPaperOnly ? `
|
|
6031
|
+
- \u{1F4C4} PAPER-ONLY / NO-DEVICE ENVIRONMENT: The learning space has NO computers or screens. All exercises, worksheets, task cards, exit tickets, and code analyses MUST be 100% printable. Provide write-in blank boxes, printed code snippets with line numbers, tracing tables, and physical manipulative instructions.` : selectedDevices === "tablet" || selectedDevices === "smartphone" ? `
|
|
6032
|
+
- \u{1F4F1} MOBILE/TABLET ENVIRONMENT: Activities should be optimized for touch interfaces and mobile/tablet sandboxes (e.g. Swift Playgrounds, Web IDEs, tap/touch interactions).` : `
|
|
6033
|
+
- \u{1F4BB} LAPTOP/DESKTOP ENVIRONMENT: Full keyboard, terminal, multi-file code editing, and browser developer tooling are available.`;
|
|
6034
|
+
const classDynamicsRule = studentCount ? `
|
|
6035
|
+
- \u{1F465} CLASS SIZE LOGISTICS: Class has exactly ${studentCount} students. Structure group sizes, pair-programming pairs, station rotations, and material distribution to realistically accommodate ${studentCount} students without bottlenecks.` : "";
|
|
6036
|
+
const scaffoldingRule = scaffoldingLevel === "foundation" ? `
|
|
6037
|
+
- \u{1FA9C} FOUNDATION SCAFFOLDING: High instructional support. Provide step-by-step numbered breakdowns, concrete real-world analogies, hints for every problem, scaffolded starter code/fill-in-the-blanks, and frequent check-for-understanding prompts.` : scaffoldingLevel === "advanced" ? `
|
|
6038
|
+
- \u{1F680} ADVANCED CHALLENGE: Minimal scaffolding. Focus on deeper system architecture, edge case handling, computational complexity, performance optimization, and open-ended extension challenges.` : `
|
|
6039
|
+
- \u2696\uFE0F BALANCED SCAFFOLDING: Balanced approach combining structured teacher guidance with independent inquiry and problem solving.`;
|
|
6040
|
+
const extraContextRule = extraContext ? `
|
|
6041
|
+
- \u{1F3AF} CRITICAL USER INSTRUCTIONS (MANDATORY): "${extraContext}". You MUST directly reflect and satisfy every point of this user guidance in the generated artifact!` : "";
|
|
6042
|
+
const artifactSpecializedPrompt = getArtifactSpecializedInvariants(artifactType, {
|
|
6043
|
+
...req,
|
|
6044
|
+
studentCount});
|
|
6012
6045
|
const systemPrompt = `You are ${meta.persona}, an expert Curriculum & Pedagogical Specialist in the Curriculum OS Multi-Agent Team.
|
|
6013
6046
|
Your task is to author a canonical, publication-grade learning artifact of type "${artifactType.toUpperCase()}".
|
|
6014
6047
|
|
|
6015
6048
|
### CORE OPERATIONAL INVARIANTS:
|
|
6016
|
-
|
|
6049
|
+
${langRule}
|
|
6017
6050
|
2. NON-MOCK CODE INVARIANT: Any code snippet provided MUST be 100% syntactically valid, idiomatic, and executable without placeholders or fake functions.
|
|
6018
6051
|
3. PEDAGOGICAL GROUNDING: Strictly align with the ${pedagogy.toUpperCase()} model, Bloom's Revised Taxonomy, and IEEE/ACM CS2023 guidelines.
|
|
6019
|
-
4. SCAFFOLDING LEVEL: "${scaffoldingLevel.toUpperCase()}"
|
|
6020
|
-
5. TARGET AUDIENCE: ${targetAge} on ${hwStr}
|
|
6021
|
-
6. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks
|
|
6052
|
+
4. SCAFFOLDING LEVEL: "${scaffoldingLevel.toUpperCase()}".${scaffoldingRule}
|
|
6053
|
+
5. TARGET AUDIENCE: ${gradeLevel ? `Grade ${gradeLevel}, ` : ""}${targetAge} on ${hwStr}.${deviceRule}${classDynamicsRule}${extraContextRule}
|
|
6054
|
+
6. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}`;
|
|
6022
6055
|
const userPrompt = `### CONTEXT GROUND TRUTH:
|
|
6023
6056
|
- Topic / Concept Domain: "${topic}"
|
|
6024
6057
|
- Lesson ID: "${lessonId || "ON_DEMAND"}"
|
|
@@ -6026,7 +6059,13 @@ Your task is to author a canonical, publication-grade learning artifact of type
|
|
|
6026
6059
|
- Pedagogy: "${pedagogy.toUpperCase()}"
|
|
6027
6060
|
- Scaffolding Level: "${scaffoldingLevel}"
|
|
6028
6061
|
- Hardware Environment: "${hwStr}"
|
|
6029
|
-
|
|
6062
|
+
${gradeLevel ? `- Target Grade Level: "${gradeLevel}"
|
|
6063
|
+
` : ""}${studentCount ? `- Class Size: "${studentCount} students"
|
|
6064
|
+
` : ""}- Target Language: "${language}"
|
|
6065
|
+
${selectedDevices ? `- Device Mode: "${selectedDevices}"
|
|
6066
|
+
` : ""}${extraContext ? `- User Specific Guidance & Requirements: "${extraContext}"
|
|
6067
|
+
` : ""}${config ? `- Full Task Config: ${JSON.stringify(config)}
|
|
6068
|
+
` : ""}
|
|
6030
6069
|
${contextSot.framework ? `### SOT CURRICULUM FRAMEWORK:
|
|
6031
6070
|
${contextSot.framework.slice(0, 1500)}
|
|
6032
6071
|
` : ""}
|
|
@@ -6040,15 +6079,10 @@ ${contextSot.handout.slice(0, 1e3)}
|
|
|
6040
6079
|
### MANDATORY CANONICAL TEMPLATE CONTRACT:
|
|
6041
6080
|
Use the following reference template structure as the exact specification:
|
|
6042
6081
|
|
|
6043
|
-
${templateContent
|
|
6044
|
-
id: "${lessonId || "ON_DEMAND"}"
|
|
6045
|
-
title: "${displayTitle}"
|
|
6046
|
-
type: "${artifactType.toUpperCase()}"
|
|
6047
|
-
---
|
|
6048
|
-
# ${displayTitle}`}
|
|
6082
|
+
${templateContent}
|
|
6049
6083
|
|
|
6050
6084
|
### TASK INSTRUCTION:
|
|
6051
|
-
Generate the complete, thorough,
|
|
6085
|
+
Generate the complete, thorough, publication-grade "${artifactType.toUpperCase()}" artifact for "${displayTitle}". Ensure all [REQUIRED] sections are fully developed with realistic, detailed pedagogical and technical content. Strictly follow the specialized invariants for "${artifactType.toUpperCase()}".`;
|
|
6052
6086
|
let accumulatedContent = "";
|
|
6053
6087
|
let accumulatedThought = "";
|
|
6054
6088
|
try {
|
|
@@ -6087,6 +6121,248 @@ Generate the complete, thorough, production-grade "${artifactType.toUpperCase()}
|
|
|
6087
6121
|
});
|
|
6088
6122
|
}
|
|
6089
6123
|
}
|
|
6124
|
+
function getArtifactSpecializedInvariants(type, req) {
|
|
6125
|
+
const cfg = req.config || {};
|
|
6126
|
+
const isPaperOnly = cfg.devices === "paper-only" || req.hardwarePlatform?.some((h) => h.toLowerCase().includes("paper"));
|
|
6127
|
+
const studentCount = req.studentCount || "25";
|
|
6128
|
+
switch (type) {
|
|
6129
|
+
case "slide": {
|
|
6130
|
+
const slideCount = cfg.slideCount || 10;
|
|
6131
|
+
const presentationStyle = cfg.presentationStyle || "modern";
|
|
6132
|
+
const presentationDuration = cfg.presentationDuration || 45;
|
|
6133
|
+
const includeSpeakerNotes = cfg.includeSpeakerNotes !== false;
|
|
6134
|
+
return `
|
|
6135
|
+
### \u{1F3AC} SLIDE PRESENTATION & MARP ARCHITECTURE INVARIANTS:
|
|
6136
|
+
1. **SLIDE COUNT & TIMING TARGET**:
|
|
6137
|
+
- Generate EXACTLY ${slideCount} slides separated by \`---\` horizontal rules.
|
|
6138
|
+
- Pacing: Target total duration is ${presentationDuration} minutes (~${Math.round(Number(presentationDuration) / Number(slideCount))} mins per slide).
|
|
6139
|
+
- Visual Style: "${presentationStyle.toUpperCase()}". Maintain high visual clarity, contrasting accents, and executive polish.
|
|
6140
|
+
2. **STRICT CONCISENESS & 6x6 RULE (ABSOLUTELY NO TEXT WALLS)**:
|
|
6141
|
+
- A slide is a VISUAL PROJECTION CANVAS, NOT a textbook or lesson plan!
|
|
6142
|
+
- Maximum 4\u20136 bullet points per slide.
|
|
6143
|
+
- Maximum 8\u201312 words per bullet point. Forbid dense multi-sentence paragraphs on the slide surface.
|
|
6144
|
+
3. **SPEAKER NOTES FOR ALL SPOKEN WORDS (<!-- Presenter Notes: ... -->)**:
|
|
6145
|
+
${includeSpeakerNotes ? "- MANDATORY: Every single slide MUST contain comprehensive presenter notes in `<!-- Presenter Notes: ... -->` at the bottom, giving the teacher the exact verbal talking points, analogies, and pacing tips." : "- Optional brief presenter notes."}
|
|
6146
|
+
4. **CLICK-TO-REVEAL SYSTEM**:
|
|
6147
|
+
- Use \`<!-- clicks -->\` before bulleted lists (\`<ul>\` or \`<ol>\`) for incremental click-to-reveal.
|
|
6148
|
+
- Use \`<!-- click -->\` before answers, code reveals, or key callouts.
|
|
6149
|
+
5. **2-COLUMN / SPLIT LAYOUT**:
|
|
6150
|
+
- Use <div class="columns"><div>...</div><div>...</div></div> for side-by-side concept vs. code or problem vs. solution comparisons.
|
|
6151
|
+
6. **CONCISE CODE SNIPPETS**:
|
|
6152
|
+
- Maximum 6\u201310 lines of clean code per snippet with inline comments. Never paste whole files.
|
|
6153
|
+
7. **MERMAID VISUALS**:
|
|
6154
|
+
- Use Mermaid flowcharts or sequence diagrams for workflows and control loops.`;
|
|
6155
|
+
}
|
|
6156
|
+
case "tiered_practice": {
|
|
6157
|
+
const techStack = cfg.techStack || (req.hardwarePlatform?.[0] || "Modern Programming Language");
|
|
6158
|
+
const includeUnitTests = cfg.includeUnitTests !== false;
|
|
6159
|
+
return `
|
|
6160
|
+
### \u{1FA9C} TIERED PRACTICE ARCHITECTURE INVARIANTS (3-TIER ADAPTIVE):
|
|
6161
|
+
- Target Technology Stack: "${techStack}"
|
|
6162
|
+
${includeUnitTests ? "- Automated Testing: Include explicit executable Unit Tests / Assertions for verifying Bronze, Silver, and Gold tiers." : ""}
|
|
6163
|
+
1. **3 EXPLICIT RIGOR TIERS**:
|
|
6164
|
+
- **\u{1F949} Tier 1 (Bronze / C\u01A1 b\u1EA3n)**: 70% starter boilerplate / 30% fill-in. Direct recall, scaffolded fill-in-the-blanks, single-concept recognition with starter hints.
|
|
6165
|
+
- **\u{1F948} Tier 2 (Silver / Ti\xEAu chu\u1EA9n)**: 30% starter boilerplate / 70% implementation. Independent multi-step problem solving, bug identification, synthesis of 2+ concepts.
|
|
6166
|
+
- **\u{1F947} Tier 3 (Gold / Th\u1EED th\xE1ch)**: 0% code / open architecture. Edge case handling, algorithmic optimization, open-ended architectural design or extension.
|
|
6167
|
+
2. **COMPLETE WORKED SOLUTIONS & ANSWER KEYS**:
|
|
6168
|
+
- Provide step-by-step worked solutions for every problem across all 3 tiers.
|
|
6169
|
+
3. **SELF-DIAGNOSTIC RUBRIC**:
|
|
6170
|
+
- Include a clear student rubric with criteria for when a student is ready to level up from Bronze \u2794 Silver \u2794 Gold.`;
|
|
6171
|
+
}
|
|
6172
|
+
case "exit_ticket": {
|
|
6173
|
+
const questionCount = cfg.questionCount || 3;
|
|
6174
|
+
const diagnosticFocus = cfg.diagnosticFocus || "misconceptions";
|
|
6175
|
+
return `
|
|
6176
|
+
### \u{1F39F}\uFE0F EXIT TICKET ARCHITECTURE INVARIANTS:
|
|
6177
|
+
1. **EXACTLY ${questionCount} TARGETED ITEMS (3\u20135 MINUTE DURATION)**:
|
|
6178
|
+
- Item 1: Quick diagnostic checking mastery of the core objective.
|
|
6179
|
+
- Item 2: Application with diagnostic trap focusing on: "${diagnosticFocus}".
|
|
6180
|
+
- Item 3: Metacognitive self-check (Confidence rating 1\u20135 + "Explain what is still fuzzy").
|
|
6181
|
+
2. **TEACHER DIAGNOSTIC INTERVENTION GUIDE**:
|
|
6182
|
+
- Provide a quick lookup table: "If student chooses/writes X \u2794 Misconception is Y \u2794 Quick remedy is Z".${isPaperOnly ? "\n3. **PRINTABLE CUT-OUT FORMAT**: Include student name/date line and cut-border dashed line." : ""}`;
|
|
6183
|
+
}
|
|
6184
|
+
case "quiz": {
|
|
6185
|
+
const questionCount = cfg.questionCount || 5;
|
|
6186
|
+
const questionTypes = Array.isArray(cfg.questionTypes) ? cfg.questionTypes.join(", ") : cfg.questionTypes || "multiple_choice";
|
|
6187
|
+
const diagnosticFocus = cfg.diagnosticFocus || "balanced";
|
|
6188
|
+
return `
|
|
6189
|
+
### \u{1F4DD} BLOOM-ALIGNED QUIZ ARCHITECTURE INVARIANTS:
|
|
6190
|
+
1. **EXACTLY ${questionCount} QUESTIONS (${questionTypes.toUpperCase()})**:
|
|
6191
|
+
- Diagnostic emphasis: "${diagnosticFocus}".
|
|
6192
|
+
- 40% Remember/Understand (Conceptual foundations).
|
|
6193
|
+
- 40% Apply/Analyze (Bug finding, code tracing, scenario application).
|
|
6194
|
+
- 20% Evaluate/Create (Algorithmic reasoning, trade-off evaluation).
|
|
6195
|
+
2. **HIGH-QUALITY DISTRACTORS WITH RATIONALE**:
|
|
6196
|
+
- For every multiple choice item, explain WHY each incorrect option is a plausible misconception and WHY the key is correct.
|
|
6197
|
+
3. **COMPLETE ANSWER KEY & SCORING RUBRIC**:
|
|
6198
|
+
- Explicit point distribution, partial credit guidelines, and sample ideal answers for open-ended questions.`;
|
|
6199
|
+
}
|
|
6200
|
+
case "task_cards": {
|
|
6201
|
+
const cardCount = cfg.cardCount || 12;
|
|
6202
|
+
const cardUsage = cfg.cardUsage || "stations";
|
|
6203
|
+
return `
|
|
6204
|
+
### \u{1F4CB} TASK CARDS ARCHITECTURE INVARIANTS:
|
|
6205
|
+
1. **SET OF EXACTLY ${cardCount} NUMBERED CARDS (Optimized for ${cardUsage.toUpperCase()})**:
|
|
6206
|
+
- Clearly mark each card: Card # (1 to ${cardCount}), Difficulty (Foundation / Standard / Challenge), and Target Skill.
|
|
6207
|
+
2. **STUDENT RECORDING SHEET (B\u1EA2NG GHI \u0110\xC1P \xC1N)**:
|
|
6208
|
+
- Include a structured printable grid where students record answers for Cards 1\u2013${cardCount}.
|
|
6209
|
+
3. **TEACHER MASTER KEY**:
|
|
6210
|
+
- Quick reference key with verified answers and explanations.${isPaperOnly ? "\n4. **PRINT-READY CARD BORDERS**: Layout with clean visual borders ready for physical printing and cutting." : ""}`;
|
|
6211
|
+
}
|
|
6212
|
+
case "graphic_organizer": {
|
|
6213
|
+
const diagramType = cfg.diagramType || "concept_map";
|
|
6214
|
+
const includeFillIn = cfg.includeFillInExercise !== false;
|
|
6215
|
+
return `
|
|
6216
|
+
### \u{1F4CA} GRAPHIC ORGANIZER ARCHITECTURE INVARIANTS:
|
|
6217
|
+
1. **VISUAL MODEL TYPE: "${diagramType.toUpperCase()}"**:
|
|
6218
|
+
- Structure a clear cognitive thinking tool: Concept Map, Flowchart, Venn Diagram, Hierarchy Tree, or Cause-Effect Matrix.
|
|
6219
|
+
2. **VALID MERMAID SYNTAX**:
|
|
6220
|
+
- Embed complete, 100% syntactically correct Mermaid diagrams showing the knowledge structure.
|
|
6221
|
+
3. **ACTIVE STUDENT INTERACTION PROMPTS**:
|
|
6222
|
+
${includeFillIn ? "- Include interactive fill-in-the-blank nodes and connection articulation challenges." : "- Include synthesis and reflection prompts based on the visual model."}`;
|
|
6223
|
+
}
|
|
6224
|
+
case "choice_board": {
|
|
6225
|
+
const gridSize = cfg.gridSize || "3x3";
|
|
6226
|
+
const completionRule = cfg.completionRule || "row_column_diagonal";
|
|
6227
|
+
return `
|
|
6228
|
+
### \u{1F3AF} CHOICE BOARD ARCHITECTURE INVARIANTS (UDL ${gridSize.toUpperCase()} MATRIX):
|
|
6229
|
+
1. **${gridSize.toUpperCase()} MENU (UDL MULTIPLE MEANS OF EXPRESSION)**:
|
|
6230
|
+
- Option tasks spanning practical coding, architectural diagrams, analytical writing, and real-world scenarios.
|
|
6231
|
+
2. **COMPLETION CONTRACT: "${completionRule.toUpperCase()}"**:
|
|
6232
|
+
- Explicit rule (e.g. Tic-Tac-Toe 3-in-a-row/column/diagonal, or Point Bounty system).
|
|
6233
|
+
3. **UNIFIED EVALUATION RUBRIC**:
|
|
6234
|
+
- Consistent grading criteria applicable across all task choices on the board.`;
|
|
6235
|
+
}
|
|
6236
|
+
case "station_rotation": {
|
|
6237
|
+
const stationCount = cfg.stationCount || 3;
|
|
6238
|
+
const stationDuration = cfg.stationDuration || 15;
|
|
6239
|
+
return `
|
|
6240
|
+
### \u{1F504} STATION ROTATION ARCHITECTURE INVARIANTS:
|
|
6241
|
+
1. **EXACTLY ${stationCount} STATIONS SCALED FOR ${studentCount} STUDENTS**:
|
|
6242
|
+
- Group size: ~${Math.ceil(Number(studentCount) / Number(stationCount)) || 7} students per group.
|
|
6243
|
+
- Distinct station roles: Teacher-Led Small Group, Independent Practical Lab, Collaborative / Unplugged Peer Challenge.
|
|
6244
|
+
2. **TIMING & TRANSITIONS (${stationDuration} MINS/STATION)**:
|
|
6245
|
+
- ${stationDuration} minutes per station + 3-minute structured rotation protocol.
|
|
6246
|
+
3. **STATION DELIVERABLES & ACCOUNTABILITY**:
|
|
6247
|
+
- Clear check-in deliverable required at each station to ensure on-task accountability.`;
|
|
6248
|
+
}
|
|
6249
|
+
case "act":
|
|
6250
|
+
case "codelab":
|
|
6251
|
+
case "science_lab": {
|
|
6252
|
+
const techStack = cfg.techStack || (req.hardwarePlatform?.[0] || "Modern Programming Language");
|
|
6253
|
+
const includeUnitTests = cfg.includeUnitTests !== false;
|
|
6254
|
+
return `
|
|
6255
|
+
### \u{1F4BB} HANDS-ON LAB & CODE ACTIVITY ARCHITECTURE INVARIANTS:
|
|
6256
|
+
- Technology Stack: "${techStack}"
|
|
6257
|
+
${includeUnitTests ? "- Unit Testing: Provide automated assertions or test runner checks." : ""}
|
|
6258
|
+
1. **100% RUNNABLE CODE / RIGOROUS PROCEDURE**:
|
|
6259
|
+
- Absolutely no fake APIs, mock functions, or non-executable pseudocode.
|
|
6260
|
+
2. **STRUCTURED LAB PHASES**:
|
|
6261
|
+
- Objective & Environmental Prerequisites.
|
|
6262
|
+
- Starter Skeleton Code with clear \`// TODO [Student Task]\` comments.
|
|
6263
|
+
- Step-by-step Guided Challenges (Level 1 \u2794 Level 2 \u2794 Level 3).
|
|
6264
|
+
- Automated Verification / Test Cases.
|
|
6265
|
+
- Complete Reference Solution with design explanation.`;
|
|
6266
|
+
}
|
|
6267
|
+
case "bell_ringer":
|
|
6268
|
+
return `
|
|
6269
|
+
### \u{1F514} BELL RINGER ARCHITECTURE INVARIANTS (3\u20135 MIN WARM-UP):
|
|
6270
|
+
1. **3 QUICK HOOK QUESTIONS**:
|
|
6271
|
+
- 2 rapid-fire recall questions activating previous knowledge.
|
|
6272
|
+
- 1 curiosity hook question bridging into today's core topic.
|
|
6273
|
+
2. **60-SECOND TEACHER REVIEW KEY**:
|
|
6274
|
+
- Quick-glance answer key for instant whole-class review.`;
|
|
6275
|
+
case "review_game":
|
|
6276
|
+
return `
|
|
6277
|
+
### \u{1F3AE} REVIEW GAME ARCHITECTURE INVARIANTS:
|
|
6278
|
+
1. **GAMIFIED STRUCTURE**:
|
|
6279
|
+
- Jeopardy-style board (3\u20134 Categories x 3 Point Values: 100 / 200 / 300) OR 3-Round Interactive Trivia.
|
|
6280
|
+
2. **CLEAR RULES & TEAM DYNAMICS**:
|
|
6281
|
+
- Team scoring rules, buzz-in protocol, and tie-breaker challenge.
|
|
6282
|
+
3. **COMPLETE QUESTION & ANSWER DECK**:
|
|
6283
|
+
- Verified answers and point values for the host/teacher.`;
|
|
6284
|
+
case "guide": {
|
|
6285
|
+
const lessonDuration = cfg.lessonDuration || 90;
|
|
6286
|
+
return `
|
|
6287
|
+
### \u{1F4D6} TEACHER GUIDE ARCHITECTURE INVARIANTS (${lessonDuration} MINS LESSON):
|
|
6288
|
+
1. **MINUTE-BY-MINUTE PACING TIMELINE**:
|
|
6289
|
+
- Pacing broken down for ${lessonDuration} minutes (Hook, Modeling, Guided Practice, Independent Practice, Debrief).
|
|
6290
|
+
2. **SOCRATIC QUESTIONS & PROMPTS**:
|
|
6291
|
+
- Cold-call questions with anticipated student misconceptions and remediation scripts.
|
|
6292
|
+
3. **DIFFERENTIATION STRATEGIES**:
|
|
6293
|
+
- Specific adaptations for students needing support vs. high-flyers needing extension.`;
|
|
6294
|
+
}
|
|
6295
|
+
case "worksheet":
|
|
6296
|
+
case "handout":
|
|
6297
|
+
return `
|
|
6298
|
+
### \u{1F4D1} WORKSHEET / HANDOUT ARCHITECTURE INVARIANTS:
|
|
6299
|
+
1. **I DO \u2794 WE DO \u2794 YOU DO SCAFFOLDING**:
|
|
6300
|
+
- Part 1 (I Do): Fully worked and annotated example.
|
|
6301
|
+
- Part 2 (We Do): Guided problem with fill-in hints and scaffolding scaffolds.
|
|
6302
|
+
- Part 3 (You Do): Independent mastery challenge.
|
|
6303
|
+
2. **SELF-CHECK RUBRIC**:
|
|
6304
|
+
- End-of-worksheet self-evaluation checklist.${isPaperOnly ? "\n3. **PRINTABLE WORKSPACES**: Include spacious, clean write-in boxes and workspace for calculations/code." : ""}`;
|
|
6305
|
+
case "rubric": {
|
|
6306
|
+
const rubricScale = cfg.rubricScale || "4_levels";
|
|
6307
|
+
return `
|
|
6308
|
+
### \u{1F4CA} ANALYTIC RUBRIC ARCHITECTURE INVARIANTS (${rubricScale.toUpperCase()} SCALE):
|
|
6309
|
+
1. **RIGOROUS PROFICIENCY LEVELS**:
|
|
6310
|
+
- 4 Proficiency Levels: Level 4 (Exemplary) | Level 3 (Proficient) | Level 2 (Developing) | Level 1 (Beginning).
|
|
6311
|
+
2. **CONCRETE OBSERVABLE CRITERIA**:
|
|
6312
|
+
- Each cell MUST describe concrete, observable behavioral evidence, not vague words like "good" or "average".`;
|
|
6313
|
+
}
|
|
6314
|
+
case "glossary":
|
|
6315
|
+
return `
|
|
6316
|
+
### \u{1F4DA} TECHNICAL GLOSSARY ARCHITECTURE INVARIANTS:
|
|
6317
|
+
1. **COMPREHENSIVE TERM PROFILES**:
|
|
6318
|
+
- For every key term: Technical Definition, Real-world Analogy, Code Syntax Example, and Common Misconception.`;
|
|
6319
|
+
case "bom":
|
|
6320
|
+
return `
|
|
6321
|
+
### \u{1F4E6} BILL OF MATERIALS (BOM) ARCHITECTURE INVARIANTS:
|
|
6322
|
+
1. **CLASS-SCALED INVENTORY FOR ${studentCount} STUDENTS**:
|
|
6323
|
+
- Exact quantities calculated for ${studentCount} students.
|
|
6324
|
+
- Component specifications, estimated unit cost, and affordable alternatives.`;
|
|
6325
|
+
case "lesson": {
|
|
6326
|
+
const lessonDuration = cfg.lessonDuration || 90;
|
|
6327
|
+
const pedagogicalModel = cfg.pedagogicalModel || req.pedagogy || "5e";
|
|
6328
|
+
return `
|
|
6329
|
+
### \u{1F393} CANONICAL LESSON PLAN INVARIANTS (${pedagogicalModel.toUpperCase()} MODEL, ${lessonDuration} MINS):
|
|
6330
|
+
1. **A. LESSON DESIGN PLAN**:
|
|
6331
|
+
- Learning Objectives (Bloom-aligned) & Observable Student Evidence.
|
|
6332
|
+
- Activity Sequence mapping every phase with timing totaling ${lessonDuration} minutes.
|
|
6333
|
+
- Resource Map & Assessment Map with explicit Artifact Contracts.
|
|
6334
|
+
2. **B. LESSON FLOW**:
|
|
6335
|
+
- Detailed teacher moves, student actions, scripted key questions, and check-for-understanding points for every activity phase.`;
|
|
6336
|
+
}
|
|
6337
|
+
default:
|
|
6338
|
+
return "";
|
|
6339
|
+
}
|
|
6340
|
+
}
|
|
6341
|
+
function getDefaultFallbackTemplate(type, title, id) {
|
|
6342
|
+
const upperType = type.toUpperCase();
|
|
6343
|
+
return `---
|
|
6344
|
+
id: "${id}"
|
|
6345
|
+
title: "${title}"
|
|
6346
|
+
type: "${upperType}"
|
|
6347
|
+
version: "1.0.0"
|
|
6348
|
+
date: "${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}"
|
|
6349
|
+
---
|
|
6350
|
+
|
|
6351
|
+
# ${title}
|
|
6352
|
+
|
|
6353
|
+
## 1. Overview & Learning Objectives
|
|
6354
|
+
<!-- [REQUIRED] State 2-3 measurable, Bloom-aligned learning objectives -->
|
|
6355
|
+
|
|
6356
|
+
## 2. Core Pedagogical Content
|
|
6357
|
+
<!-- [REQUIRED] Provide the core educational substance, questions, problems, and diagrams -->
|
|
6358
|
+
|
|
6359
|
+
## 3. Practice & Differentiation
|
|
6360
|
+
<!-- [REQUIRED] Tiered support, worked examples, and challenges -->
|
|
6361
|
+
|
|
6362
|
+
## 4. Assessment & Answer Key
|
|
6363
|
+
<!-- [REQUIRED] Complete solutions, rubrics, and diagnostic teacher feedback -->
|
|
6364
|
+
`;
|
|
6365
|
+
}
|
|
6090
6366
|
|
|
6091
6367
|
// src/workflow/workflows/singleArtifactWorkflow.ts
|
|
6092
6368
|
async function executeSingleArtifactStep(request) {
|