@thanh01.pmt/curriculum-kit 1.0.6 → 1.0.7
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-BIhxrUEa.d.cts → index-BEicVaQ9.d.cts} +60 -5
- package/dist/{index-BvWC_xXe.d.ts → index-BfDHBO7f.d.ts} +60 -5
- package/dist/index.cjs +293 -234
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +291 -215
- package/dist/index.mjs.map +1 -1
- package/dist/media/index.cjs +30 -0
- package/dist/media/index.cjs.map +1 -1
- package/dist/media/index.d.cts +8 -0
- package/dist/media/index.d.ts +8 -0
- package/dist/media/index.mjs +30 -0
- package/dist/media/index.mjs.map +1 -1
- package/dist/workflow/index.cjs +460 -47
- package/dist/workflow/index.cjs.map +1 -1
- package/dist/workflow/index.d.cts +2 -1
- package/dist/workflow/index.d.ts +2 -1
- package/dist/workflow/index.mjs +457 -27
- package/dist/workflow/index.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { I as ApprovalPayload, y as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS,
|
|
1
|
+
export { I as ApprovalPayload, y as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS, M as ExecuteWithRateLimitOptions, z as GateSettings, G as GenerateMasterLessonStepInput, T as GenerateRoadmapWorkflowInput, J as JudgeMasterLessonStepInput, q as JudgeSatelliteStepInput, O as MilestoneWorkflowInput, P as MilestoneWorkflowResult, e as RepairMasterLessonStepInput, R as ResolvedGateSettings, U as RoadmapWorkflowSummary, t as SaveMilestoneArtifactsInput, u as SavedMilestoneResult, L as approvalHookToken, H as approvalPayloadSchema, W as executeSingleArtifactStep, F as gateModeFor, f as generateActivityStep, h as generateCodeLabStep, k as generateDiagnosticQuizStep, p as generateExtensionStep, m as generateHandoutStep, d as generateMasterLessonStep, Q as generateMilestoneWorkflow, V as generateRoadmapWorkflow, i as generateSelfLabStep, X as generateSingleArtifactWorkflow, l as generateSlidesStep, o as generateTeacherGuideStep, n as generateWorksheetStep, j as judgeMasterLessonStep, s as judgeSatelliteStep, K as lessonApprovalHook, B as parseGateSettings, w as publishToGitStep, x as publishToSupabaseStep, r as repairMasterLessonStep, E as resolveGateSettings, v as saveMilestoneToWorkspaceStep, N as withRateLimitBackoff } from '../index-BEicVaQ9.cjs';
|
|
2
2
|
import '../schemas/index.cjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../provider-factory-DH3udYlN.cjs';
|
|
5
5
|
import 'ai';
|
|
6
6
|
import '../supabasePublisher-C627qXFT.cjs';
|
|
7
|
+
import 'workflow';
|
|
7
8
|
import '../standardsCoverageGate-BWAkXY76.cjs';
|
package/dist/workflow/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export { I as ApprovalPayload, y as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS,
|
|
1
|
+
export { I as ApprovalPayload, y as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS, M as ExecuteWithRateLimitOptions, z as GateSettings, G as GenerateMasterLessonStepInput, T as GenerateRoadmapWorkflowInput, J as JudgeMasterLessonStepInput, q as JudgeSatelliteStepInput, O as MilestoneWorkflowInput, P as MilestoneWorkflowResult, e as RepairMasterLessonStepInput, R as ResolvedGateSettings, U as RoadmapWorkflowSummary, t as SaveMilestoneArtifactsInput, u as SavedMilestoneResult, L as approvalHookToken, H as approvalPayloadSchema, W as executeSingleArtifactStep, F as gateModeFor, f as generateActivityStep, h as generateCodeLabStep, k as generateDiagnosticQuizStep, p as generateExtensionStep, m as generateHandoutStep, d as generateMasterLessonStep, Q as generateMilestoneWorkflow, V as generateRoadmapWorkflow, i as generateSelfLabStep, X as generateSingleArtifactWorkflow, l as generateSlidesStep, o as generateTeacherGuideStep, n as generateWorksheetStep, j as judgeMasterLessonStep, s as judgeSatelliteStep, K as lessonApprovalHook, B as parseGateSettings, w as publishToGitStep, x as publishToSupabaseStep, r as repairMasterLessonStep, E as resolveGateSettings, v as saveMilestoneToWorkspaceStep, N as withRateLimitBackoff } from '../index-BfDHBO7f.js';
|
|
2
2
|
import '../schemas/index.js';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import '../provider-factory-DH3udYlN.js';
|
|
5
5
|
import 'ai';
|
|
6
6
|
import '../supabasePublisher-C627qXFT.js';
|
|
7
|
+
import 'workflow';
|
|
7
8
|
import '../standardsCoverageGate-BWAkXY76.js';
|
package/dist/workflow/index.mjs
CHANGED
|
@@ -5,8 +5,7 @@ import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
|
5
5
|
import { createOpenAI } from '@ai-sdk/openai';
|
|
6
6
|
import { createDeepSeek } from '@ai-sdk/deepseek';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import
|
|
9
|
-
import { getStepMetadata, RetryableError, sleep } from 'workflow';
|
|
8
|
+
import { defineHook, getStepMetadata, RetryableError, sleep } from 'workflow';
|
|
10
9
|
import fs2 from 'fs/promises';
|
|
11
10
|
import { Octokit } from '@octokit/rest';
|
|
12
11
|
import { createClient } from '@supabase/supabase-js';
|
|
@@ -4948,14 +4947,14 @@ async function publishToSupabaseStep(options) {
|
|
|
4948
4947
|
|
|
4949
4948
|
// src/workflow/gateSettings.ts
|
|
4950
4949
|
var DEFAULT_GATE_SETTINGS = Object.freeze({
|
|
4951
|
-
LEARNER_PROFILE: "
|
|
4952
|
-
PROJECT_BRIEF: "
|
|
4953
|
-
REFERENCE_PACK: "
|
|
4954
|
-
CURRICULUM_FRAMEWORK: "
|
|
4955
|
-
KNOWLEDGE_EXPOSITION: "
|
|
4956
|
-
STYLE_GUIDE: "
|
|
4957
|
-
ART_DIRECTION: "
|
|
4958
|
-
LESSON: "
|
|
4950
|
+
LEARNER_PROFILE: "OFF",
|
|
4951
|
+
PROJECT_BRIEF: "OFF",
|
|
4952
|
+
REFERENCE_PACK: "OFF",
|
|
4953
|
+
CURRICULUM_FRAMEWORK: "OFF",
|
|
4954
|
+
KNOWLEDGE_EXPOSITION: "OFF",
|
|
4955
|
+
STYLE_GUIDE: "OFF",
|
|
4956
|
+
ART_DIRECTION: "OFF",
|
|
4957
|
+
LESSON: "OFF",
|
|
4959
4958
|
ACT: "OFF",
|
|
4960
4959
|
QUIZ: "OFF",
|
|
4961
4960
|
SLIDE: "OFF",
|
|
@@ -4963,7 +4962,7 @@ var DEFAULT_GATE_SETTINGS = Object.freeze({
|
|
|
4963
4962
|
WKS: "OFF",
|
|
4964
4963
|
HANDOUT: "OFF",
|
|
4965
4964
|
EXT: "OFF",
|
|
4966
|
-
CODE: "
|
|
4965
|
+
CODE: "OFF",
|
|
4967
4966
|
MEDIA_SCRIPT: "OFF",
|
|
4968
4967
|
EXIT_TICKET: "OFF"
|
|
4969
4968
|
});
|
|
@@ -5024,10 +5023,10 @@ var approvalPayloadSchema = z.object({
|
|
|
5024
5023
|
feedback: z.string().optional().describe("Actionable feedback or required changes if rejected"),
|
|
5025
5024
|
timestamp: z.string().optional().describe("ISO timestamp of the approval action")
|
|
5026
5025
|
});
|
|
5027
|
-
var
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
}
|
|
5026
|
+
var lessonApprovalHook = defineHook();
|
|
5027
|
+
function approvalHookToken(projectId, lessonId, artifactType) {
|
|
5028
|
+
return `approval:${projectId}:${lessonId}:${artifactType}`;
|
|
5029
|
+
}
|
|
5031
5030
|
var BloomHintSchema = z.object({
|
|
5032
5031
|
process: z.enum(["Remember", "Understand", "Apply", "Analyze", "Evaluate", "Create"]).describe("Cognitive process axis"),
|
|
5033
5032
|
knowledge: z.enum(["FACTUAL", "CONCEPTUAL", "PROCEDURAL", "METACOGNITIVE"]).optional().describe("Knowledge dimension axis (optional \u2014 most source standards do not tag it)")
|
|
@@ -5630,9 +5629,9 @@ async function generateMilestoneWorkflow(input) {
|
|
|
5630
5629
|
} else if (lessonGate === "HITL") {
|
|
5631
5630
|
const hookToken = "gate:lesson:" + milestoneId;
|
|
5632
5631
|
console.log(" \u23F8 [Gate] LESSON awaiting HUMAN review (HITL) \u2014 hook " + hookToken);
|
|
5633
|
-
const
|
|
5634
|
-
const
|
|
5635
|
-
const hook =
|
|
5632
|
+
const workflowPkg = await import('workflow');
|
|
5633
|
+
const createHook = workflowPkg.createHook;
|
|
5634
|
+
const hook = createHook({ token: hookToken });
|
|
5636
5635
|
const review = await hook;
|
|
5637
5636
|
console.log(" \u2705 [Gate] Human verdict: " + (review.approved ? "APPROVED" : "REJECTED") + (review.feedback ? " \u2014 " + review.feedback : ""));
|
|
5638
5637
|
if (!review.approved) {
|
|
@@ -5652,7 +5651,7 @@ async function generateMilestoneWorkflow(input) {
|
|
|
5652
5651
|
standardsContext: standardsContext || void 0,
|
|
5653
5652
|
modelOptions: input.modelOptions
|
|
5654
5653
|
});
|
|
5655
|
-
const hook2 =
|
|
5654
|
+
const hook2 = createHook({ token: hookToken + ":v2" });
|
|
5656
5655
|
const review2 = await hook2;
|
|
5657
5656
|
console.log(" \u2705 [Gate] Human verdict (v2): " + (review2.approved ? "APPROVED" : "REJECTED"));
|
|
5658
5657
|
if (!review2.approved) {
|
|
@@ -5888,6 +5887,271 @@ init_streamRunner();
|
|
|
5888
5887
|
|
|
5889
5888
|
// src/services/lessonProductionService.ts
|
|
5890
5889
|
init_streamRunner();
|
|
5890
|
+
|
|
5891
|
+
// src/ai/llmJudgeEngine.ts
|
|
5892
|
+
var LLMJudgeEngine = class {
|
|
5893
|
+
/**
|
|
5894
|
+
* Executes genuine LLM-as-Judge evaluation using the audit flow.
|
|
5895
|
+
*/
|
|
5896
|
+
static async evaluateArtifactWithLLM(input) {
|
|
5897
|
+
try {
|
|
5898
|
+
const report = await auditCurriculumQualityFlow({
|
|
5899
|
+
targetArtifactType: input.targetArtifactType,
|
|
5900
|
+
lessonId: input.lessonId,
|
|
5901
|
+
expectedLanguage: input.expectedLanguage,
|
|
5902
|
+
targetObjectives: input.targetObjectives,
|
|
5903
|
+
generatedContentJson: input.generatedContentJson,
|
|
5904
|
+
standardStatements: input.standardStatements,
|
|
5905
|
+
modelOptions: input.modelOptions
|
|
5906
|
+
});
|
|
5907
|
+
const passed = report.overallVerdict === "PASS" && report.languageAdherencePassed;
|
|
5908
|
+
const failedCriteria = report.criteria.filter((c) => !c.passed);
|
|
5909
|
+
const passedCriteria = report.criteria.filter((c) => c.passed);
|
|
5910
|
+
return {
|
|
5911
|
+
decision: report.overallVerdict === "PASS" ? "APPROVED" : report.overallVerdict === "NEEDS_REVISION" ? "NEEDS_REVISION" : "REJECTED",
|
|
5912
|
+
score: report.totalScore,
|
|
5913
|
+
passed,
|
|
5914
|
+
evaluatedBy: "@agent-as-judge",
|
|
5915
|
+
critique: passed ? `H\u1ECDc li\u1EC7u ${input.targetArtifactType} cho b\xE0i "${input.lessonId}" \u0111\u1EA1t \u0111i\u1EC3m th\u1EA9m \u0111\u1ECBnh ${report.totalScore}/100. \u0110\u1EE7 \u0111i\u1EC1u ki\u1EC7n ph\xEA duy\u1EC7t.` : `H\u1ECDc li\u1EC7u ${input.targetArtifactType} ch\u01B0a \u0111\u1EA1t y\xEAu c\u1EA7u: ${failedCriteria.map((c) => c.feedback).join("; ")}`,
|
|
5916
|
+
strengths: passedCriteria.map((c) => `${c.name}: ${c.feedback}`),
|
|
5917
|
+
weaknesses: failedCriteria.map((c) => `${c.name}: ${c.feedback}`),
|
|
5918
|
+
autoRepairInstructions: report.actionableRepairPrompts.length > 0 ? report.actionableRepairPrompts.join("\n") : void 0
|
|
5919
|
+
};
|
|
5920
|
+
} catch (err) {
|
|
5921
|
+
return {
|
|
5922
|
+
decision: "NEEDS_REVISION",
|
|
5923
|
+
score: 50,
|
|
5924
|
+
passed: false,
|
|
5925
|
+
evaluatedBy: "@agent-as-judge",
|
|
5926
|
+
critique: `L\u1ED7i trong qu\xE1 tr\xECnh th\u1EA9m \u0111\u1ECBnh LLM: ${err.message || String(err)}`,
|
|
5927
|
+
strengths: [],
|
|
5928
|
+
weaknesses: ["Kh\xF4ng th\u1EC3 ho\xE0n t\u1EA5t th\u1EA9m \u0111\u1ECBnh t\u1EF1 \u0111\u1ED9ng do s\u1EF1 c\u1ED1 k\u1EBFt n\u1ED1i m\xF4 h\xECnh."],
|
|
5929
|
+
autoRepairInstructions: "Ch\u1EA1y l\u1EA1i quy tr\xECnh th\u1EA9m \u0111\u1ECBnh ho\u1EB7c ki\u1EC3m tra c\u1EA5u h\xECnh API keys."
|
|
5930
|
+
};
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
/**
|
|
5934
|
+
* Evaluates Gate 1 (SOT Foundation: LEARNER_PROFILE, PROJECT_BRIEF, REFERENCE_PACK)
|
|
5935
|
+
* Calibrated heuristic pre-check.
|
|
5936
|
+
*/
|
|
5937
|
+
static evaluateGate1(learnerProfileMarkdown, referencePackMarkdown) {
|
|
5938
|
+
if (!learnerProfileMarkdown?.trim() || !referencePackMarkdown?.trim()) {
|
|
5939
|
+
return {
|
|
5940
|
+
decision: "REJECTED",
|
|
5941
|
+
score: 0,
|
|
5942
|
+
passed: false,
|
|
5943
|
+
evaluatedBy: "@heuristic-linter",
|
|
5944
|
+
critique: "T\u1EC7p SOT r\u1ED7ng ho\u1EB7c kh\xF4ng t\u1ED3n t\u1EA1i.",
|
|
5945
|
+
strengths: [],
|
|
5946
|
+
weaknesses: ["Thi\u1EBFu n\u1ED9i dung t\u1EC7p SOT c\u01A1 s\u1EDF."],
|
|
5947
|
+
autoRepairInstructions: "Kh\u1EDFi t\u1EA1o v\xE0 bi\xEAn so\u1EA1n \u0111\u1EA7y \u0111\u1EE7 LEARNER_PROFILE.md v\xE0 REFERENCE_PACK.md."
|
|
5948
|
+
};
|
|
5949
|
+
}
|
|
5950
|
+
const hasAgeGroup = /(?:độ tuổi|lứa tuổi|age|grade|thcs|tiểu học|k-12|sinh viên|người đi làm)/i.test(learnerProfileMarkdown);
|
|
5951
|
+
const hasPriorKnowledge = /(?:kiến thức nền|nền tảng|prior knowledge|tiên quyết|prerequisite)/i.test(learnerProfileMarkdown);
|
|
5952
|
+
const hasGroundTruth = /(?:reference|csta|apple|ieee|cs2023|nguồn tham khảo|tài liệu chuẩn|rfc|w3c)/i.test(referencePackMarkdown);
|
|
5953
|
+
const hasClientObjectives = /(?:client objectives|mục tiêu|output|chuẩn đầu ra)/i.test(learnerProfileMarkdown);
|
|
5954
|
+
let score = 30;
|
|
5955
|
+
const strengths = [];
|
|
5956
|
+
const weaknesses = [];
|
|
5957
|
+
if (hasAgeGroup) {
|
|
5958
|
+
score += 20;
|
|
5959
|
+
strengths.push("H\u1ED3 s\u01A1 ng\u01B0\u1EDDi h\u1ECDc x\xE1c \u0111\u1ECBnh r\xF5 \u0111\u1ED1i t\u01B0\u1EE3ng v\xE0 l\u1EE9a tu\u1ED5i m\u1EE5c ti\xEAu.");
|
|
5960
|
+
} else {
|
|
5961
|
+
weaknesses.push("Thi\u1EBFu \u0111\u1ECBnh ngh\u0129a r\xF5 r\xE0ng v\u1EC1 \u0111\u1ED1i t\u01B0\u1EE3ng/\u0111\u1ED9 tu\u1ED5i h\u1ECDc vi\xEAn.");
|
|
5962
|
+
}
|
|
5963
|
+
if (hasPriorKnowledge) {
|
|
5964
|
+
score += 20;
|
|
5965
|
+
strengths.push("C\xF3 ph\xE2n t\xEDch ki\u1EBFn th\u1EE9c n\u1EC1n t\u1EA3ng v\xE0 r\xE0o c\u1EA3n nh\u1EADn th\u1EE9c.");
|
|
5966
|
+
} else {
|
|
5967
|
+
weaknesses.push("Ch\u01B0a l\xE0m r\xF5 ki\u1EBFn th\u1EE9c ti\xEAn quy\u1EBFt (Prerequisites).");
|
|
5968
|
+
}
|
|
5969
|
+
if (hasGroundTruth) {
|
|
5970
|
+
score += 20;
|
|
5971
|
+
strengths.push("REFERENCE_PACK tr\xEDch d\u1EABn t\xE0i li\u1EC7u k\u1EF9 thu\u1EADt chu\u1EA9n m\u1EF1c.");
|
|
5972
|
+
} else {
|
|
5973
|
+
weaknesses.push("T\u1EC7p REFERENCE_PACK thi\u1EBFu danh m\u1EE5c t\xE0i li\u1EC7u tham chi\u1EBFu chu\u1EA9n.");
|
|
5974
|
+
}
|
|
5975
|
+
if (hasClientObjectives) {
|
|
5976
|
+
score += 10;
|
|
5977
|
+
strengths.push("C\xF3 x\xE1c \u0111\u1ECBnh r\xF5 m\u1EE5c ti\xEAu \u0111\u1EA7u ra v\xE0 k\u1EF3 v\u1ECDng kh\xE1ch h\xE0ng.");
|
|
5978
|
+
}
|
|
5979
|
+
const passed = score >= 80;
|
|
5980
|
+
return {
|
|
5981
|
+
decision: passed ? "APPROVED" : score >= 60 ? "NEEDS_REVISION" : "REJECTED",
|
|
5982
|
+
score,
|
|
5983
|
+
passed,
|
|
5984
|
+
evaluatedBy: "@heuristic-linter",
|
|
5985
|
+
critique: passed ? "B\u1ED9 t\xE0i li\u1EC7u n\u1EC1n t\u1EA3ng SOT \u0111\u1EA1t chu\u1EA9n c\u1EA5u tr\xFAc. Cho ph\xE9p chuy\u1EC3n sang Phase 2 (Thi\u1EBFt k\u1EBF Khung ch\u01B0\u01A1ng tr\xECnh)." : "T\xE0i li\u1EC7u SOT c\u1EA7n b\u1ED5 sung th\xEAm c\xE1c tr\u01B0\u1EDDng th\xF4ng tin chu\u1EA9n tr\u01B0\u1EDBc khi ph\xE2n r\xE3 b\xE0i h\u1ECDc.",
|
|
5986
|
+
strengths,
|
|
5987
|
+
weaknesses,
|
|
5988
|
+
autoRepairInstructions: passed ? void 0 : "B\u1ED5 sung \u0111\u1EA7y \u0111\u1EE7 th\xF4ng tin l\u1EE9a tu\u1ED5i, ki\u1EBFn th\u1EE9c ti\xEAn quy\u1EBFt v\xE0 \xEDt nh\u1EA5t 2 ngu\u1ED3n t\xE0i li\u1EC7u k\u1EF9 thu\u1EADt chu\u1EA9n v\xE0o REFERENCE_PACK.md."
|
|
5989
|
+
};
|
|
5990
|
+
}
|
|
5991
|
+
/**
|
|
5992
|
+
* Evaluates Gate 2 (Curriculum Framework: Units, Modules, Lessons, Bloom Progression)
|
|
5993
|
+
*/
|
|
5994
|
+
static evaluateGate2(frameworkMarkdown, targetUnitCount = 4) {
|
|
5995
|
+
if (!frameworkMarkdown?.trim()) {
|
|
5996
|
+
return {
|
|
5997
|
+
decision: "REJECTED",
|
|
5998
|
+
score: 0,
|
|
5999
|
+
passed: false,
|
|
6000
|
+
evaluatedBy: "@heuristic-linter",
|
|
6001
|
+
critique: "T\u1EC7p CURRICULUM_FRAMEWORK.md r\u1ED7ng.",
|
|
6002
|
+
strengths: [],
|
|
6003
|
+
weaknesses: ["Thi\u1EBFu n\u1ED9i dung khung ch\u01B0\u01A1ng tr\xECnh."]
|
|
6004
|
+
};
|
|
6005
|
+
}
|
|
6006
|
+
const unitMatches = frameworkMarkdown.match(/(?:##\s+(?:Unit\s+\d+|U\d{2})|\|\s*U\d{2}\s*:|\|\s*Unit\s+\d+)/gi) || [];
|
|
6007
|
+
const hasBloom = /(?:bloom|nhận biết|thông hiểu|vận dụng|phân tích|đánh giá|sáng tạo|remember|understand|apply|analyze|evaluate|create)/i.test(frameworkMarkdown);
|
|
6008
|
+
const has5E = /(?:5e|engage|explore|explain|elaborate|evaluate|pbl|edp|hybrid)/i.test(frameworkMarkdown);
|
|
6009
|
+
const hasScopeSequence = /(?:scope & sequence|lộ trình|tiến trình|bài học)/i.test(frameworkMarkdown);
|
|
6010
|
+
let score = 30;
|
|
6011
|
+
const strengths = [];
|
|
6012
|
+
const weaknesses = [];
|
|
6013
|
+
if (unitMatches.length >= targetUnitCount) {
|
|
6014
|
+
score += 25;
|
|
6015
|
+
strengths.push(`Ph\xE2n r\xE3 \u0111\u1EE7 ${unitMatches.length} Units theo \u0111\xFAng y\xEAu c\u1EA7u c\u1EA5u tr\xFAc.`);
|
|
6016
|
+
} else {
|
|
6017
|
+
score += Math.min(20, unitMatches.length * 5);
|
|
6018
|
+
weaknesses.push(`S\u1ED1 l\u01B0\u1EE3ng Unit (${unitMatches.length}) ch\u01B0a \u0111\u1EA1t m\u1EE5c ti\xEAu ${targetUnitCount} Units.`);
|
|
6019
|
+
}
|
|
6020
|
+
if (hasBloom) {
|
|
6021
|
+
score += 20;
|
|
6022
|
+
strengths.push("C\xF3 ph\xE2n b\u1ED5 thang \u0111o Bloom r\xF5 r\xE0ng theo ti\u1EBFn tr\xECnh nh\u1EADn th\u1EE9c.");
|
|
6023
|
+
} else {
|
|
6024
|
+
weaknesses.push("Thi\u1EBFu \xE1nh x\u1EA1 m\u1EE9c \u0111\u1ED9 Bloom trong c\xE1c b\xE0i h\u1ECDc.");
|
|
6025
|
+
}
|
|
6026
|
+
if (has5E) {
|
|
6027
|
+
score += 15;
|
|
6028
|
+
strengths.push("C\u1EA5u tr\xFAc b\xE0i h\u1ECDc \u0111\u1ECBnh h\u01B0\u1EDBng chu\u1EA9n m\xF4 h\xECnh s\u01B0 ph\u1EA1m (5E/PBL/EDP).");
|
|
6029
|
+
}
|
|
6030
|
+
if (hasScopeSequence) {
|
|
6031
|
+
score += 10;
|
|
6032
|
+
strengths.push("C\xF3 b\u1EA3ng Scope & Sequence chi ti\u1EBFt.");
|
|
6033
|
+
}
|
|
6034
|
+
const passed = score >= 80;
|
|
6035
|
+
return {
|
|
6036
|
+
decision: passed ? "APPROVED" : score >= 60 ? "NEEDS_REVISION" : "REJECTED",
|
|
6037
|
+
score,
|
|
6038
|
+
passed,
|
|
6039
|
+
evaluatedBy: "@heuristic-linter",
|
|
6040
|
+
critique: passed ? "Khung ch\u01B0\u01A1ng tr\xECnh \u0111\u1EA1t chu\u1EA9n ki\u1EBFn tr\xFAc ph\xE2n r\xE3. Cho ph\xE9p ti\u1EBFn h\xE0nh s\u1EA3n xu\u1EA5t h\u1ECDc li\u1EC7u." : "C\u1EA7n b\u1ED5 sung chi ti\u1EBFt c\u1EA5u tr\xFAc b\xE0i h\u1ECDc, b\u1EA3ng ph\xE2n r\xE3 v\xE0 m\u1EE9c \u0111\u1ED9 Bloom t\u01B0\u01A1ng \u1EE9ng.",
|
|
6041
|
+
strengths,
|
|
6042
|
+
weaknesses
|
|
6043
|
+
};
|
|
6044
|
+
}
|
|
6045
|
+
/**
|
|
6046
|
+
* Evaluates a produced Lesson Artifact (LESSON, ACT, QUIZ, SLIDE) with heuristic structure checks
|
|
6047
|
+
*/
|
|
6048
|
+
static evaluateArtifact(artifactType, content, lessonTitle) {
|
|
6049
|
+
if (!content?.trim() || content.trim().length < 50) {
|
|
6050
|
+
return {
|
|
6051
|
+
decision: "REJECTED",
|
|
6052
|
+
score: 0,
|
|
6053
|
+
passed: false,
|
|
6054
|
+
evaluatedBy: "@heuristic-linter",
|
|
6055
|
+
critique: `N\u1ED9i dung ${artifactType} cho b\xE0i "${lessonTitle}" qu\xE1 ng\u1EAFn ho\u1EB7c r\u1ED7ng.`,
|
|
6056
|
+
strengths: [],
|
|
6057
|
+
weaknesses: ["H\u1ECDc li\u1EC7u kh\xF4ng c\xF3 n\u1ED9i dung th\u1EF1c t\u1EBF."]
|
|
6058
|
+
};
|
|
6059
|
+
}
|
|
6060
|
+
let score = 40;
|
|
6061
|
+
const strengths = [];
|
|
6062
|
+
const weaknesses = [];
|
|
6063
|
+
switch (artifactType.toUpperCase()) {
|
|
6064
|
+
case "LESSON": {
|
|
6065
|
+
const phases = [
|
|
6066
|
+
{ name: "Engage", regex: /(?:Engage|Khởi động|Warm-up|Hook|Mở đầu)/i },
|
|
6067
|
+
{ name: "Explore", regex: /(?:Explore|Khám phá|Demo|Thử nghiệm)/i },
|
|
6068
|
+
{ name: "Explain", regex: /(?:Explain|Giải thích|Core Concepts|Lý thuyết)/i },
|
|
6069
|
+
{ name: "Elaborate", regex: /(?:Elaborate|Vận dụng|Guided Practice|Independent Practice|Challenge|Thực hành)/i },
|
|
6070
|
+
{ name: "Evaluate", regex: /(?:Evaluate|Đánh giá|Wrap-up|Exit Ticket|Tổng kết)/i }
|
|
6071
|
+
];
|
|
6072
|
+
let phaseCount = 0;
|
|
6073
|
+
for (const p of phases) {
|
|
6074
|
+
if (p.regex.test(content)) phaseCount++;
|
|
6075
|
+
}
|
|
6076
|
+
score += phaseCount * 10;
|
|
6077
|
+
if (phaseCount >= 4) {
|
|
6078
|
+
strengths.push(`Gi\xE1o \xE1n bao ph\u1EE7 ${phaseCount}/5 pha c\u1EE7a ti\u1EBFn tr\xECnh 5E.`);
|
|
6079
|
+
} else {
|
|
6080
|
+
weaknesses.push(`Gi\xE1o \xE1n ch\u1EC9 c\xF3 ${phaseCount}/5 pha 5E.`);
|
|
6081
|
+
}
|
|
6082
|
+
if (content.length > 500) score += 10;
|
|
6083
|
+
break;
|
|
6084
|
+
}
|
|
6085
|
+
case "ACT": {
|
|
6086
|
+
const hasSteps = /(?:bước|step\s+\d+|hướng dẫn)/i.test(content);
|
|
6087
|
+
const hasCode = /```[\s\S]*?```/.test(content);
|
|
6088
|
+
const hasObjectives = /(?:mục tiêu|objective|yêu cầu)/i.test(content);
|
|
6089
|
+
if (hasSteps) {
|
|
6090
|
+
score += 20;
|
|
6091
|
+
strengths.push("B\xE0i th\u1EF1c h\xE0nh c\xF3 quy tr\xECnh t\u1EEBng b\u01B0\u1EDBc r\xF5 r\xE0ng.");
|
|
6092
|
+
}
|
|
6093
|
+
if (hasCode) {
|
|
6094
|
+
score += 20;
|
|
6095
|
+
strengths.push("C\xF3 m\xE3 ngu\u1ED3n m\u1EABu/l\u1EC7nh th\u1EF1c thi minh h\u1ECDa.");
|
|
6096
|
+
}
|
|
6097
|
+
if (hasObjectives) {
|
|
6098
|
+
score += 10;
|
|
6099
|
+
strengths.push("C\xF3 x\xE1c \u0111\u1ECBnh m\u1EE5c ti\xEAu th\u1EF1c h\xE0nh.");
|
|
6100
|
+
}
|
|
6101
|
+
break;
|
|
6102
|
+
}
|
|
6103
|
+
case "QUIZ": {
|
|
6104
|
+
const hasQuestions = /(?:question\s*\d+|câu\s*\d+|\?)/i.test(content);
|
|
6105
|
+
const hasOptions = /(?:[A-D]\.|\"options\")/i.test(content);
|
|
6106
|
+
const hasExplanation = /(?:explanation|giải thích|vì sao|đáp án)/i.test(content);
|
|
6107
|
+
if (hasQuestions) {
|
|
6108
|
+
score += 20;
|
|
6109
|
+
strengths.push("C\xF3 c\xE2u h\u1ECFi ch\u1EA9n \u0111o\xE1n.");
|
|
6110
|
+
}
|
|
6111
|
+
if (hasOptions) {
|
|
6112
|
+
score += 20;
|
|
6113
|
+
strengths.push("\u0110\u1EA7y \u0111\u1EE7 c\xE1c l\u1EF1a ch\u1ECDn \u0111\xE1p \xE1n.");
|
|
6114
|
+
}
|
|
6115
|
+
if (hasExplanation) {
|
|
6116
|
+
score += 15;
|
|
6117
|
+
strengths.push("C\xF3 ph\u1EA7n gi\u1EA3i th\xEDch \u0111\xE1p \xE1n chi ti\u1EBFt.");
|
|
6118
|
+
}
|
|
6119
|
+
break;
|
|
6120
|
+
}
|
|
6121
|
+
case "SLIDE": {
|
|
6122
|
+
const hasMarp = /(?:marp:\s*true|---\s*\n)/i.test(content);
|
|
6123
|
+
const slideCount = (content.match(/---\s*\n/g) || []).length;
|
|
6124
|
+
if (hasMarp) {
|
|
6125
|
+
score += 25;
|
|
6126
|
+
strengths.push("\u0110\u1ECBnh d\u1EA1ng t\u01B0\u01A1ng th\xEDch Marp Presentation.");
|
|
6127
|
+
}
|
|
6128
|
+
if (slideCount >= 5) {
|
|
6129
|
+
score += 25;
|
|
6130
|
+
strengths.push(`B\u1ED9 slide c\xF3 dung l\u01B0\u1EE3ng h\u1EE3p l\xFD (${slideCount + 1} slides).`);
|
|
6131
|
+
} else {
|
|
6132
|
+
weaknesses.push(`S\u1ED1 l\u01B0\u1EE3ng slide (${slideCount + 1}) c\xF2n qu\xE1 \xEDt.`);
|
|
6133
|
+
}
|
|
6134
|
+
break;
|
|
6135
|
+
}
|
|
6136
|
+
default: {
|
|
6137
|
+
if (content.length > 200) score += 40;
|
|
6138
|
+
break;
|
|
6139
|
+
}
|
|
6140
|
+
}
|
|
6141
|
+
const passed = score >= 80;
|
|
6142
|
+
return {
|
|
6143
|
+
decision: passed ? "APPROVED" : score >= 60 ? "NEEDS_REVISION" : "REJECTED",
|
|
6144
|
+
score: Math.min(100, score),
|
|
6145
|
+
passed,
|
|
6146
|
+
evaluatedBy: "@heuristic-linter",
|
|
6147
|
+
critique: passed ? `H\u1ECDc li\u1EC7u ${artifactType} cho b\xE0i "${lessonTitle}" \u0111\u1EA1t ki\u1EC3m tra c\u1EA5u tr\xFAc (${score}/100).` : `H\u1ECDc li\u1EC7u ${artifactType} c\u1EA7n ho\xE0n thi\u1EC7n th\xEAm c\u1EA5u tr\xFAc \u0111\u1EC3 \u0111\u1EA1t chu\u1EA9n s\u01B0 ph\u1EA1m (${score}/100).`,
|
|
6148
|
+
strengths,
|
|
6149
|
+
weaknesses
|
|
6150
|
+
};
|
|
6151
|
+
}
|
|
6152
|
+
};
|
|
6153
|
+
|
|
6154
|
+
// src/services/lessonProductionService.ts
|
|
5891
6155
|
init_errors();
|
|
5892
6156
|
|
|
5893
6157
|
// src/services/lessonProductionService.ts
|
|
@@ -5987,6 +6251,8 @@ async function generateSingleArtifact(req) {
|
|
|
5987
6251
|
extraContext,
|
|
5988
6252
|
config,
|
|
5989
6253
|
contextSot = {},
|
|
6254
|
+
mediaPolicy,
|
|
6255
|
+
researchContext,
|
|
5990
6256
|
options = {},
|
|
5991
6257
|
onChunk
|
|
5992
6258
|
} = req;
|
|
@@ -6024,7 +6290,10 @@ ${langRule}
|
|
|
6024
6290
|
3. PEDAGOGICAL GROUNDING: Strictly align with the ${pedagogy.toUpperCase()} model, Bloom's Revised Taxonomy, and IEEE/ACM CS2023 guidelines.
|
|
6025
6291
|
4. SCAFFOLDING LEVEL: "${scaffoldingLevel.toUpperCase()}".${scaffoldingRule}
|
|
6026
6292
|
5. TARGET AUDIENCE: ${gradeLevel ? `Grade ${gradeLevel}, ` : ""}${targetAge} on ${hwStr}.${deviceRule}${classDynamicsRule}${extraContextRule}
|
|
6027
|
-
6. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}
|
|
6293
|
+
6. OUTPUT INTEGRITY: Output clean Markdown starting directly with YAML frontmatter. Do not wrap entire response in triple backticks.${artifactSpecializedPrompt}${mediaPolicy ? `
|
|
6294
|
+
|
|
6295
|
+
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).
|
|
6296
|
+
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.` : ""}`;
|
|
6028
6297
|
const userPrompt = `### CONTEXT GROUND TRUTH:
|
|
6029
6298
|
- Topic / Concept Domain: "${topic}"
|
|
6030
6299
|
- Lesson ID: "${lessonId || "ON_DEMAND"}"
|
|
@@ -6039,6 +6308,9 @@ ${selectedDevices ? `- Device Mode: "${selectedDevices}"
|
|
|
6039
6308
|
` : ""}${extraContext ? `- User Specific Guidance & Requirements: "${extraContext}"
|
|
6040
6309
|
` : ""}${config ? `- Full Task Config: ${JSON.stringify(config)}
|
|
6041
6310
|
` : ""}
|
|
6311
|
+
${researchContext ? `### RESEARCH GROUND TRUTH (fact-checked context \u2014 \u01B0u ti\xEAn d\xF9ng, KH\xD4NG b\u1ECBa s\u1ED1 li\u1EC7u):
|
|
6312
|
+
${researchContext.slice(0, 4e3)}
|
|
6313
|
+
` : ""}
|
|
6042
6314
|
${contextSot.framework ? `### SOT CURRICULUM FRAMEWORK:
|
|
6043
6315
|
${contextSot.framework.slice(0, 1500)}
|
|
6044
6316
|
` : ""}
|
|
@@ -6079,13 +6351,171 @@ Generate the complete, thorough, publication-grade "${artifactType.toUpperCase()
|
|
|
6079
6351
|
}
|
|
6080
6352
|
);
|
|
6081
6353
|
const { thought, content } = extractThoughtAndContent(rawResult);
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6354
|
+
const finalContent = content || accumulatedContent;
|
|
6355
|
+
const finalThought = thought || accumulatedThought;
|
|
6356
|
+
const gates = resolveGateSettings(req.gateSettings);
|
|
6357
|
+
const kitGateType = {
|
|
6358
|
+
lesson: "LESSON",
|
|
6359
|
+
slide: "SLIDE",
|
|
6360
|
+
act: "ACT",
|
|
6361
|
+
quiz: "QUIZ",
|
|
6362
|
+
guide: "GUIDE",
|
|
6363
|
+
handout: "HANDOUT",
|
|
6364
|
+
worksheet: "WKS",
|
|
6365
|
+
ext: "EXT",
|
|
6366
|
+
codelab: "CODE",
|
|
6367
|
+
exit_ticket: "EXIT_TICKET"
|
|
6368
|
+
}[artifactType];
|
|
6369
|
+
const gateMode = kitGateType ? gateModeFor(gates, kitGateType) : "OFF";
|
|
6370
|
+
if (gateMode === "OFF") {
|
|
6371
|
+
return { artifactType, filename: meta.filename, content: finalContent, persona: meta.persona, thought: finalThought };
|
|
6372
|
+
}
|
|
6373
|
+
const injectReviewMeta = (doc, metaMap) => {
|
|
6374
|
+
const fm = doc.match(/^---\s*\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/);
|
|
6375
|
+
if (!fm) {
|
|
6376
|
+
return `---
|
|
6377
|
+
${Object.entries(metaMap).map(([k, v]) => `${k}: "${v}"`).join("\n")}
|
|
6378
|
+
---
|
|
6379
|
+
|
|
6380
|
+
${doc}`;
|
|
6381
|
+
}
|
|
6382
|
+
let yaml = fm[1] ?? "";
|
|
6383
|
+
for (const [k, v] of Object.entries(metaMap)) {
|
|
6384
|
+
const re = new RegExp(`^${k}:.*$`, "m");
|
|
6385
|
+
if (re.test(yaml)) yaml = yaml.replace(re, `${k}: "${v}"`);
|
|
6386
|
+
else yaml += `
|
|
6387
|
+
${k}: "${v}"`;
|
|
6388
|
+
}
|
|
6389
|
+
return doc.replace(fm[0], `---
|
|
6390
|
+
${yaml.trim()}
|
|
6391
|
+
---
|
|
6392
|
+
`);
|
|
6088
6393
|
};
|
|
6394
|
+
if (gateMode === "HITL") {
|
|
6395
|
+
return {
|
|
6396
|
+
artifactType,
|
|
6397
|
+
filename: meta.filename,
|
|
6398
|
+
content: injectReviewMeta(finalContent, { review_status: "PENDING_REVIEW", review_decision: "PENDING" }),
|
|
6399
|
+
persona: meta.persona,
|
|
6400
|
+
thought: finalThought,
|
|
6401
|
+
pausedForReview: true,
|
|
6402
|
+
gateStatus: "awaiting_approval"
|
|
6403
|
+
};
|
|
6404
|
+
}
|
|
6405
|
+
const judgeObjectives = [{ code: "A1", description: `Artifact fulfills its pedagogical contract for topic "${topic}" with complete required sections`, bloomLevel: "Analyze" }];
|
|
6406
|
+
try {
|
|
6407
|
+
const verdict = await LLMJudgeEngine.evaluateArtifactWithLLM({
|
|
6408
|
+
targetArtifactType: artifactType.toUpperCase(),
|
|
6409
|
+
lessonId: lessonId || "ON_DEMAND",
|
|
6410
|
+
expectedLanguage: language.toLowerCase().includes("viet") ? "vietnamese" : "english",
|
|
6411
|
+
targetObjectives: judgeObjectives,
|
|
6412
|
+
generatedContentJson: JSON.stringify({ content: finalContent, artifactType, lessonId: lessonId || "ON_DEMAND", title: displayTitle })
|
|
6413
|
+
});
|
|
6414
|
+
const passed = Boolean(verdict.passed) && verdict.score >= 85;
|
|
6415
|
+
if (passed) {
|
|
6416
|
+
return {
|
|
6417
|
+
artifactType,
|
|
6418
|
+
filename: meta.filename,
|
|
6419
|
+
content: injectReviewMeta(finalContent, {
|
|
6420
|
+
review_status: "APPROVED",
|
|
6421
|
+
reviewed_by: "@reviewer (LLM-as-Judge)",
|
|
6422
|
+
review_decision: "APPROVED"
|
|
6423
|
+
}),
|
|
6424
|
+
persona: meta.persona,
|
|
6425
|
+
thought: finalThought,
|
|
6426
|
+
judgeScore: verdict.score,
|
|
6427
|
+
judgeCritique: verdict.critique
|
|
6428
|
+
};
|
|
6429
|
+
}
|
|
6430
|
+
const repairFeedback = [verdict.autoRepairInstructions, ...verdict.weaknesses || []].filter(Boolean).join("\n");
|
|
6431
|
+
const repairedRaw = await streamCurriculumAIInference(
|
|
6432
|
+
[
|
|
6433
|
+
{ role: "user", content: `You previously authored \`${meta.filename}\` and the academic Judge REJECTED it with the critique below.
|
|
6434
|
+
Rewrite the COMPLETE corrected document: fix every listed issue, keep the mandatory structure, frontmatter and all approved sections. Output 100% clean Markdown only.
|
|
6435
|
+
|
|
6436
|
+
JUDGE CRITIQUE:
|
|
6437
|
+
${repairFeedback}
|
|
6438
|
+
|
|
6439
|
+
CURRENT DOCUMENT:
|
|
6440
|
+
${finalContent}` }
|
|
6441
|
+
],
|
|
6442
|
+
userPrompt,
|
|
6443
|
+
{ ...options, systemPersona: systemPrompt },
|
|
6444
|
+
(chunk, type) => {
|
|
6445
|
+
if (onChunk) onChunk(chunk, type === "thought" ? "thought" : "content");
|
|
6446
|
+
}
|
|
6447
|
+
);
|
|
6448
|
+
const repairedExtract = extractThoughtAndContent(repairedRaw);
|
|
6449
|
+
const repaired = repairedExtract.content || repairedRaw;
|
|
6450
|
+
if (repaired && repaired.trim().length > 100) {
|
|
6451
|
+
const reVerdict = await LLMJudgeEngine.evaluateArtifactWithLLM({
|
|
6452
|
+
targetArtifactType: artifactType.toUpperCase(),
|
|
6453
|
+
lessonId: lessonId || "ON_DEMAND",
|
|
6454
|
+
expectedLanguage: language.toLowerCase().includes("viet") ? "vietnamese" : "english",
|
|
6455
|
+
targetObjectives: judgeObjectives,
|
|
6456
|
+
generatedContentJson: JSON.stringify({ content: repaired, artifactType, lessonId: lessonId || "ON_DEMAND", title: displayTitle })
|
|
6457
|
+
});
|
|
6458
|
+
if (reVerdict.passed && reVerdict.score >= 85) {
|
|
6459
|
+
return {
|
|
6460
|
+
artifactType,
|
|
6461
|
+
filename: meta.filename,
|
|
6462
|
+
content: injectReviewMeta(repaired, {
|
|
6463
|
+
review_status: "APPROVED",
|
|
6464
|
+
reviewed_by: "@reviewer (LLM-as-Judge)",
|
|
6465
|
+
review_decision: "APPROVED"
|
|
6466
|
+
}),
|
|
6467
|
+
persona: meta.persona,
|
|
6468
|
+
thought: repairedExtract.thought || "",
|
|
6469
|
+
judgeScore: reVerdict.score,
|
|
6470
|
+
judgeCritique: reVerdict.critique
|
|
6471
|
+
};
|
|
6472
|
+
}
|
|
6473
|
+
return {
|
|
6474
|
+
artifactType,
|
|
6475
|
+
filename: meta.filename,
|
|
6476
|
+
content: injectReviewMeta(repaired, {
|
|
6477
|
+
review_status: "NEEDS_REVISION",
|
|
6478
|
+
reviewed_by: "@reviewer (LLM-as-Judge)",
|
|
6479
|
+
review_decision: "NEEDS_REVISION"
|
|
6480
|
+
}),
|
|
6481
|
+
persona: meta.persona,
|
|
6482
|
+
thought: repairedExtract.thought || "",
|
|
6483
|
+
pausedForReview: true,
|
|
6484
|
+
gateStatus: "judge_needs_revision",
|
|
6485
|
+
judgeScore: reVerdict.score,
|
|
6486
|
+
judgeCritique: reVerdict.critique
|
|
6487
|
+
};
|
|
6488
|
+
}
|
|
6489
|
+
return {
|
|
6490
|
+
artifactType,
|
|
6491
|
+
filename: meta.filename,
|
|
6492
|
+
content: injectReviewMeta(finalContent, {
|
|
6493
|
+
review_status: "NEEDS_REVISION",
|
|
6494
|
+
reviewed_by: "@reviewer (LLM-as-Judge)",
|
|
6495
|
+
review_decision: "NEEDS_REVISION"
|
|
6496
|
+
}),
|
|
6497
|
+
persona: meta.persona,
|
|
6498
|
+
thought: finalThought,
|
|
6499
|
+
pausedForReview: true,
|
|
6500
|
+
gateStatus: "judge_needs_revision",
|
|
6501
|
+
judgeScore: verdict.score,
|
|
6502
|
+
judgeCritique: verdict.critique
|
|
6503
|
+
};
|
|
6504
|
+
} catch (judgeErr) {
|
|
6505
|
+
return {
|
|
6506
|
+
artifactType,
|
|
6507
|
+
filename: meta.filename,
|
|
6508
|
+
content: injectReviewMeta(finalContent, {
|
|
6509
|
+
review_status: "NEEDS_REVISION",
|
|
6510
|
+
review_decision: "NEEDS_REVISION",
|
|
6511
|
+
critique: `Judge unavailable (fail-closed): ${String(judgeErr?.message || judgeErr).slice(0, 300)}`
|
|
6512
|
+
}),
|
|
6513
|
+
persona: meta.persona,
|
|
6514
|
+
thought: finalThought,
|
|
6515
|
+
pausedForReview: true,
|
|
6516
|
+
gateStatus: "judge_error"
|
|
6517
|
+
};
|
|
6518
|
+
}
|
|
6089
6519
|
} catch (error) {
|
|
6090
6520
|
throw createAiInferenceError({
|
|
6091
6521
|
errorCode: "ERR_AI_ALL_PROVIDERS_FAILED",
|
|
@@ -6359,6 +6789,6 @@ async function generateSingleArtifactWorkflow(request) {
|
|
|
6359
6789
|
return executeSingleArtifactStep(request);
|
|
6360
6790
|
}
|
|
6361
6791
|
|
|
6362
|
-
export { DEFAULT_GATE_SETTINGS, approvalPayloadSchema, executeSingleArtifactStep, gateModeFor, generateActivityStep, generateCodeLabStep, generateDiagnosticQuizStep, generateExtensionStep, generateHandoutStep, generateMasterLessonStep, generateMilestoneWorkflow, generateRoadmapWorkflow, generateSelfLabStep, generateSingleArtifactWorkflow, generateSlidesStep, generateTeacherGuideStep, generateWorksheetStep, judgeMasterLessonStep, judgeSatelliteStep, lessonApprovalHook, parseGateSettings, publishToGitStep, publishToSupabaseStep, repairMasterLessonStep, resolveGateSettings, saveMilestoneToWorkspaceStep, withRateLimitBackoff };
|
|
6792
|
+
export { DEFAULT_GATE_SETTINGS, approvalHookToken, approvalPayloadSchema, executeSingleArtifactStep, gateModeFor, generateActivityStep, generateCodeLabStep, generateDiagnosticQuizStep, generateExtensionStep, generateHandoutStep, generateMasterLessonStep, generateMilestoneWorkflow, generateRoadmapWorkflow, generateSelfLabStep, generateSingleArtifactWorkflow, generateSlidesStep, generateTeacherGuideStep, generateWorksheetStep, judgeMasterLessonStep, judgeSatelliteStep, lessonApprovalHook, parseGateSettings, publishToGitStep, publishToSupabaseStep, repairMasterLessonStep, resolveGateSettings, saveMilestoneToWorkspaceStep, withRateLimitBackoff };
|
|
6363
6793
|
//# sourceMappingURL=index.mjs.map
|
|
6364
6794
|
//# sourceMappingURL=index.mjs.map
|