@thanh01.pmt/curriculum-kit 1.0.13 → 1.0.15

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.
@@ -0,0 +1,119 @@
1
+ type ArtifactType = 'lesson' | 'slide' | 'act' | 'quiz' | 'guide' | 'handout' | 'worksheet' | 'rubric' | 'ext' | 'glossary' | 'codelab' | 'bom' | 'exit_ticket' | 'tiered_practice' | 'choice_board' | 'science_lab' | 'task_cards' | 'station_rotation' | 'bell_ringer' | 'review_game' | 'graphic_organizer';
2
+ type ScaffoldingLevel = 'foundation' | 'balanced' | 'advanced';
3
+ interface SingleArtifactRequest {
4
+ artifactType: ArtifactType;
5
+ topic: string;
6
+ lessonId?: string;
7
+ lessonTitle?: string;
8
+ pedagogy?: '5e' | 'edp' | 'pbl' | 'general';
9
+ targetAge?: string;
10
+ scaffoldingLevel?: ScaffoldingLevel;
11
+ hardwarePlatform?: string[];
12
+ gradeLevel?: string;
13
+ studentCount?: string;
14
+ language?: string;
15
+ extraContext?: string;
16
+ config?: Record<string, any>;
17
+ contextSot?: {
18
+ framework?: string;
19
+ learnerProfile?: string;
20
+ lessonPlan?: string;
21
+ handout?: string;
22
+ };
23
+ /**
24
+ * Media Ledger policy (nếu có): agent chèn placeholder [IMAGE: slug], Curator duyệt,
25
+ * Fulfiller thực thi (search Pexels / gen AI). Không truyền → không planning ảnh.
26
+ */
27
+ mediaPolicy?: {
28
+ maxGenImagesPerArtifact: number;
29
+ autoFulfill?: boolean;
30
+ preferredProvider?: 'openai' | 'gemini';
31
+ mode?: 'search_only' | 'gen_only' | 'auto';
32
+ };
33
+ /**
34
+ * Nghiên cứu nền (từ research-kit harvest hoặc preliminary research) — bối cảnh
35
+ * fact-grounded để giảm outdate/hallucination khi sinh artifact standalone.
36
+ */
37
+ researchContext?: string;
38
+ /**
39
+ * Gate settings thô (vd gateModes từ project.config.json của Composer —
40
+ * scratch dùng config của chính nó). Kit tự chuẩn hoá; thiếu key = OFF
41
+ * (không kiểm). LLM_JUDGE → judge sau khi sinh + repair 1 vòng, fail-closed.
42
+ * HITL → chờ human duyệt (caller xử lý pause/resume).
43
+ */
44
+ gateSettings?: unknown;
45
+ options?: {
46
+ model?: string;
47
+ temperature?: number;
48
+ openrouterKey?: string;
49
+ alibabaKey?: string;
50
+ deepseekKey?: string;
51
+ geminiKey?: string;
52
+ nvidiaKey?: string;
53
+ openaiKey?: string;
54
+ anthropicKey?: string;
55
+ };
56
+ onChunk?: (chunk: string, type: 'content' | 'thought') => void;
57
+ }
58
+ interface SingleArtifactResult {
59
+ artifactType: ArtifactType;
60
+ filename: string;
61
+ content: string;
62
+ persona: string;
63
+ thought?: string;
64
+ /** Gate outcome: HITL đang chờ người duyệt; judge_needs_revision → bị từ chối sau repair; judge_error → fail-closed. */
65
+ pausedForReview?: boolean;
66
+ gateStatus?: 'awaiting_approval' | 'judge_needs_revision' | 'judge_error';
67
+ judgeScore?: number;
68
+ judgeCritique?: string;
69
+ }
70
+ /**
71
+ * Maps artifact type to default canonical filename and responsible agent persona
72
+ */
73
+ declare function getArtifactMetadata(type: ArtifactType, lessonId?: string, pedagogy?: string): {
74
+ filename: string;
75
+ persona: string;
76
+ templateFile: string;
77
+ };
78
+ /**
79
+ * Universal Single Artifact Generator Service for all 21 Pedagogical JTBD Artifacts
80
+ */
81
+ declare function generateSingleArtifact(req: SingleArtifactRequest): Promise<SingleArtifactResult>;
82
+
83
+ /**
84
+ * Gate Settings — toàn bộ logic "ai kiểm artifact nào" nằm ở đây, trong kit.
85
+ * Composer chỉ gọi: resolveGateSettings(projectConfig.gateModes) rồi dùng kết quả.
86
+ *
87
+ * Vocabulary chuẩn (duy nhất, không có biến thể thứ hai):
88
+ * 'OFF' — không kiểm
89
+ * 'LLM_JUDGE' — Agent kiểm (LLM-as-Judge)
90
+ * 'HITL' — Human kiểm (human-in-the-loop)
91
+ *
92
+ * Phạm vi phủ: SOT foundation (Learner Profile, Framework, Style Guide — duyệt trước khi
93
+ * sinh content) + toàn bộ content artifacts.
94
+ */
95
+ type CurriculumGateMode = 'OFF' | 'LLM_JUDGE' | 'HITL';
96
+ type CurriculumArtifactType = 'LEARNER_PROFILE' | 'PROJECT_BRIEF' | 'REFERENCE_PACK' | 'CURRICULUM_FRAMEWORK' | 'KNOWLEDGE_EXPOSITION' | 'STYLE_GUIDE' | 'ART_DIRECTION' | 'LESSON' | 'ACT' | 'QUIZ' | 'SLIDE' | 'GUIDE' | 'WKS' | 'HANDOUT' | 'EXT' | 'CODE' | 'MEDIA_SCRIPT' | 'EXIT_TICKET';
97
+ type GateSettings = Partial<Record<CurriculumArtifactType, CurriculumGateMode>>;
98
+ type ResolvedGateSettings = Readonly<Record<CurriculumArtifactType, CurriculumGateMode>>;
99
+ /**
100
+ * Mặc định: KHÔNG KIỂM (all-OFF) — triết lý "config là nguồn duy nhất".
101
+ * Không gate nào được hồi sinh ngầm khi thiếu key trong project.config.json.
102
+ * Composer (apps/web) ghi gateModes đầy đủ tường minh lúc tạo project / lưu settings,
103
+ * và user toàn quyền đổi qua Settings cho project/scratch đang chạy.
104
+ */
105
+ declare const DEFAULT_GATE_SETTINGS: ResolvedGateSettings;
106
+ /**
107
+ * Chuẩn hoá config thô (vd: gateModes đọc từ project.config.json của Composer) thành GateSettings.
108
+ * Key/value không nhận diện được bị bỏ qua — config sai không bao giờ làm workflow chết.
109
+ */
110
+ declare function parseGateSettings(raw: unknown): GateSettings;
111
+ /**
112
+ * Điểm vào DUY NHẤT: raw config (hoặc đã chuẩn hoá) → settings đầy đủ cho mọi artifact type.
113
+ * Key không có trong config nhận DEFAULT_GATE_SETTINGS.
114
+ */
115
+ declare function resolveGateSettings(raw?: unknown): ResolvedGateSettings;
116
+ /** Mode đã resolve cho 1 artifact type. */
117
+ declare function gateModeFor(resolved: ResolvedGateSettings, type: CurriculumArtifactType): CurriculumGateMode;
118
+
119
+ export { type ArtifactType as A, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, type GateSettings as G, type ResolvedGateSettings as R, type SingleArtifactRequest as S, type SingleArtifactResult as a, type CurriculumArtifactType as b, type ScaffoldingLevel as c, getArtifactMetadata as d, generateSingleArtifact as e, gateModeFor as g, parseGateSettings as p, resolveGateSettings as r };
@@ -0,0 +1,119 @@
1
+ type ArtifactType = 'lesson' | 'slide' | 'act' | 'quiz' | 'guide' | 'handout' | 'worksheet' | 'rubric' | 'ext' | 'glossary' | 'codelab' | 'bom' | 'exit_ticket' | 'tiered_practice' | 'choice_board' | 'science_lab' | 'task_cards' | 'station_rotation' | 'bell_ringer' | 'review_game' | 'graphic_organizer';
2
+ type ScaffoldingLevel = 'foundation' | 'balanced' | 'advanced';
3
+ interface SingleArtifactRequest {
4
+ artifactType: ArtifactType;
5
+ topic: string;
6
+ lessonId?: string;
7
+ lessonTitle?: string;
8
+ pedagogy?: '5e' | 'edp' | 'pbl' | 'general';
9
+ targetAge?: string;
10
+ scaffoldingLevel?: ScaffoldingLevel;
11
+ hardwarePlatform?: string[];
12
+ gradeLevel?: string;
13
+ studentCount?: string;
14
+ language?: string;
15
+ extraContext?: string;
16
+ config?: Record<string, any>;
17
+ contextSot?: {
18
+ framework?: string;
19
+ learnerProfile?: string;
20
+ lessonPlan?: string;
21
+ handout?: string;
22
+ };
23
+ /**
24
+ * Media Ledger policy (nếu có): agent chèn placeholder [IMAGE: slug], Curator duyệt,
25
+ * Fulfiller thực thi (search Pexels / gen AI). Không truyền → không planning ảnh.
26
+ */
27
+ mediaPolicy?: {
28
+ maxGenImagesPerArtifact: number;
29
+ autoFulfill?: boolean;
30
+ preferredProvider?: 'openai' | 'gemini';
31
+ mode?: 'search_only' | 'gen_only' | 'auto';
32
+ };
33
+ /**
34
+ * Nghiên cứu nền (từ research-kit harvest hoặc preliminary research) — bối cảnh
35
+ * fact-grounded để giảm outdate/hallucination khi sinh artifact standalone.
36
+ */
37
+ researchContext?: string;
38
+ /**
39
+ * Gate settings thô (vd gateModes từ project.config.json của Composer —
40
+ * scratch dùng config của chính nó). Kit tự chuẩn hoá; thiếu key = OFF
41
+ * (không kiểm). LLM_JUDGE → judge sau khi sinh + repair 1 vòng, fail-closed.
42
+ * HITL → chờ human duyệt (caller xử lý pause/resume).
43
+ */
44
+ gateSettings?: unknown;
45
+ options?: {
46
+ model?: string;
47
+ temperature?: number;
48
+ openrouterKey?: string;
49
+ alibabaKey?: string;
50
+ deepseekKey?: string;
51
+ geminiKey?: string;
52
+ nvidiaKey?: string;
53
+ openaiKey?: string;
54
+ anthropicKey?: string;
55
+ };
56
+ onChunk?: (chunk: string, type: 'content' | 'thought') => void;
57
+ }
58
+ interface SingleArtifactResult {
59
+ artifactType: ArtifactType;
60
+ filename: string;
61
+ content: string;
62
+ persona: string;
63
+ thought?: string;
64
+ /** Gate outcome: HITL đang chờ người duyệt; judge_needs_revision → bị từ chối sau repair; judge_error → fail-closed. */
65
+ pausedForReview?: boolean;
66
+ gateStatus?: 'awaiting_approval' | 'judge_needs_revision' | 'judge_error';
67
+ judgeScore?: number;
68
+ judgeCritique?: string;
69
+ }
70
+ /**
71
+ * Maps artifact type to default canonical filename and responsible agent persona
72
+ */
73
+ declare function getArtifactMetadata(type: ArtifactType, lessonId?: string, pedagogy?: string): {
74
+ filename: string;
75
+ persona: string;
76
+ templateFile: string;
77
+ };
78
+ /**
79
+ * Universal Single Artifact Generator Service for all 21 Pedagogical JTBD Artifacts
80
+ */
81
+ declare function generateSingleArtifact(req: SingleArtifactRequest): Promise<SingleArtifactResult>;
82
+
83
+ /**
84
+ * Gate Settings — toàn bộ logic "ai kiểm artifact nào" nằm ở đây, trong kit.
85
+ * Composer chỉ gọi: resolveGateSettings(projectConfig.gateModes) rồi dùng kết quả.
86
+ *
87
+ * Vocabulary chuẩn (duy nhất, không có biến thể thứ hai):
88
+ * 'OFF' — không kiểm
89
+ * 'LLM_JUDGE' — Agent kiểm (LLM-as-Judge)
90
+ * 'HITL' — Human kiểm (human-in-the-loop)
91
+ *
92
+ * Phạm vi phủ: SOT foundation (Learner Profile, Framework, Style Guide — duyệt trước khi
93
+ * sinh content) + toàn bộ content artifacts.
94
+ */
95
+ type CurriculumGateMode = 'OFF' | 'LLM_JUDGE' | 'HITL';
96
+ type CurriculumArtifactType = 'LEARNER_PROFILE' | 'PROJECT_BRIEF' | 'REFERENCE_PACK' | 'CURRICULUM_FRAMEWORK' | 'KNOWLEDGE_EXPOSITION' | 'STYLE_GUIDE' | 'ART_DIRECTION' | 'LESSON' | 'ACT' | 'QUIZ' | 'SLIDE' | 'GUIDE' | 'WKS' | 'HANDOUT' | 'EXT' | 'CODE' | 'MEDIA_SCRIPT' | 'EXIT_TICKET';
97
+ type GateSettings = Partial<Record<CurriculumArtifactType, CurriculumGateMode>>;
98
+ type ResolvedGateSettings = Readonly<Record<CurriculumArtifactType, CurriculumGateMode>>;
99
+ /**
100
+ * Mặc định: KHÔNG KIỂM (all-OFF) — triết lý "config là nguồn duy nhất".
101
+ * Không gate nào được hồi sinh ngầm khi thiếu key trong project.config.json.
102
+ * Composer (apps/web) ghi gateModes đầy đủ tường minh lúc tạo project / lưu settings,
103
+ * và user toàn quyền đổi qua Settings cho project/scratch đang chạy.
104
+ */
105
+ declare const DEFAULT_GATE_SETTINGS: ResolvedGateSettings;
106
+ /**
107
+ * Chuẩn hoá config thô (vd: gateModes đọc từ project.config.json của Composer) thành GateSettings.
108
+ * Key/value không nhận diện được bị bỏ qua — config sai không bao giờ làm workflow chết.
109
+ */
110
+ declare function parseGateSettings(raw: unknown): GateSettings;
111
+ /**
112
+ * Điểm vào DUY NHẤT: raw config (hoặc đã chuẩn hoá) → settings đầy đủ cho mọi artifact type.
113
+ * Key không có trong config nhận DEFAULT_GATE_SETTINGS.
114
+ */
115
+ declare function resolveGateSettings(raw?: unknown): ResolvedGateSettings;
116
+ /** Mode đã resolve cho 1 artifact type. */
117
+ declare function gateModeFor(resolved: ResolvedGateSettings, type: CurriculumArtifactType): CurriculumGateMode;
118
+
119
+ export { type ArtifactType as A, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, type GateSettings as G, type ResolvedGateSettings as R, type SingleArtifactRequest as S, type SingleArtifactResult as a, type CurriculumArtifactType as b, type ScaffoldingLevel as c, getArtifactMetadata as d, generateSingleArtifact as e, gateModeFor as g, parseGateSettings as p, resolveGateSettings as r };