@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.
@@ -1,5 +1,5 @@
1
- import { F as FrameworkPack, f as FrameworkStatement } from '../standardsCoverageGate-BWAkXY76.cjs';
2
- export { B as BloomHintSchema, C as ClassificationSchema, k as CoverageGateInput, m as CoverageGateReport, g as FrameworkMapping, c as FrameworkMappingSchema, e as FrameworkPackManifest, a as FrameworkPackManifestSchema, d as FrameworkPackSchema, b as FrameworkStatementSchema, G as GradeBandSchema, h as MappingKind, M as MappingKindSchema, P as PackLintIssue, j as PackValidationResult, i as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from '../standardsCoverageGate-BWAkXY76.cjs';
1
+ import { F as FrameworkPack, g as FrameworkStatement } from '../standardsCoverageGate-CsUNzv6C.cjs';
2
+ export { B as BloomHintSchema, a as ClassificationSchema, m as CoverageGateInput, C as CoverageGateReport, h as FrameworkMapping, d as FrameworkMappingSchema, f as FrameworkPackManifest, b as FrameworkPackManifestSchema, e as FrameworkPackSchema, c as FrameworkStatementSchema, G as GradeBandSchema, i as MappingKind, M as MappingKindSchema, P as PackLintIssue, k as PackValidationResult, j as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from '../standardsCoverageGate-CsUNzv6C.cjs';
3
3
  import { SupabaseClient } from '@supabase/supabase-js';
4
4
  import 'zod';
5
5
 
@@ -1,5 +1,5 @@
1
- import { F as FrameworkPack, f as FrameworkStatement } from '../standardsCoverageGate-BWAkXY76.js';
2
- export { B as BloomHintSchema, C as ClassificationSchema, k as CoverageGateInput, m as CoverageGateReport, g as FrameworkMapping, c as FrameworkMappingSchema, e as FrameworkPackManifest, a as FrameworkPackManifestSchema, d as FrameworkPackSchema, b as FrameworkStatementSchema, G as GradeBandSchema, h as MappingKind, M as MappingKindSchema, P as PackLintIssue, j as PackValidationResult, i as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from '../standardsCoverageGate-BWAkXY76.js';
1
+ import { F as FrameworkPack, g as FrameworkStatement } from '../standardsCoverageGate-CsUNzv6C.js';
2
+ export { B as BloomHintSchema, a as ClassificationSchema, m as CoverageGateInput, C as CoverageGateReport, h as FrameworkMapping, d as FrameworkMappingSchema, f as FrameworkPackManifest, b as FrameworkPackManifestSchema, e as FrameworkPackSchema, c as FrameworkStatementSchema, G as GradeBandSchema, i as MappingKind, M as MappingKindSchema, P as PackLintIssue, k as PackValidationResult, j as RecordProvenance, R as RecordProvenanceSchema, S as StatementCoverageRow, n as evaluateStandardsCoverage, l as lintFrameworkPack, v as validateFrameworkPack } from '../standardsCoverageGate-CsUNzv6C.js';
3
3
  import { SupabaseClient } from '@supabase/supabase-js';
4
4
  import 'zod';
5
5
 
@@ -764,4 +764,4 @@ interface CoverageGateReport {
764
764
  }
765
765
  declare function evaluateStandardsCoverage(input: CoverageGateInput): CoverageGateReport;
766
766
 
767
- export { BloomHintSchema as B, ClassificationSchema as C, type FrameworkPack as F, GradeBandSchema as G, MappingKindSchema as M, type PackLintIssue as P, RecordProvenanceSchema as R, type StatementCoverageRow as S, FrameworkPackManifestSchema as a, FrameworkStatementSchema as b, FrameworkMappingSchema as c, FrameworkPackSchema as d, type FrameworkPackManifest as e, type FrameworkStatement as f, type FrameworkMapping as g, type MappingKind as h, type RecordProvenance as i, type PackValidationResult as j, type CoverageGateInput as k, lintFrameworkPack as l, type CoverageGateReport as m, evaluateStandardsCoverage as n, validateFrameworkPack as v };
767
+ export { BloomHintSchema as B, type CoverageGateReport as C, type FrameworkPack as F, GradeBandSchema as G, MappingKindSchema as M, type PackLintIssue as P, RecordProvenanceSchema as R, type StatementCoverageRow as S, ClassificationSchema as a, FrameworkPackManifestSchema as b, FrameworkStatementSchema as c, FrameworkMappingSchema as d, FrameworkPackSchema as e, type FrameworkPackManifest as f, type FrameworkStatement as g, type FrameworkMapping as h, type MappingKind as i, type RecordProvenance as j, type PackValidationResult as k, lintFrameworkPack as l, type CoverageGateInput as m, evaluateStandardsCoverage as n, validateFrameworkPack as v };
@@ -764,4 +764,4 @@ interface CoverageGateReport {
764
764
  }
765
765
  declare function evaluateStandardsCoverage(input: CoverageGateInput): CoverageGateReport;
766
766
 
767
- export { BloomHintSchema as B, ClassificationSchema as C, type FrameworkPack as F, GradeBandSchema as G, MappingKindSchema as M, type PackLintIssue as P, RecordProvenanceSchema as R, type StatementCoverageRow as S, FrameworkPackManifestSchema as a, FrameworkStatementSchema as b, FrameworkMappingSchema as c, FrameworkPackSchema as d, type FrameworkPackManifest as e, type FrameworkStatement as f, type FrameworkMapping as g, type MappingKind as h, type RecordProvenance as i, type PackValidationResult as j, type CoverageGateInput as k, lintFrameworkPack as l, type CoverageGateReport as m, evaluateStandardsCoverage as n, validateFrameworkPack as v };
767
+ export { BloomHintSchema as B, type CoverageGateReport as C, type FrameworkPack as F, GradeBandSchema as G, MappingKindSchema as M, type PackLintIssue as P, RecordProvenanceSchema as R, type StatementCoverageRow as S, ClassificationSchema as a, FrameworkPackManifestSchema as b, FrameworkStatementSchema as c, FrameworkMappingSchema as d, FrameworkPackSchema as e, type FrameworkPackManifest as f, type FrameworkStatement as g, type FrameworkMapping as h, type MappingKind as i, type RecordProvenance as j, type PackValidationResult as k, lintFrameworkPack as l, type CoverageGateInput as m, evaluateStandardsCoverage as n, validateFrameworkPack as v };
@@ -1,8 +1,299 @@
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-DhxvfPoW.cjs';
2
- import '../schemas/index.cjs';
3
- import 'zod';
4
- import '../provider-factory-DxzOVEmh.cjs';
1
+ import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from '../schemas/index.cjs';
2
+ import { M as ModelResolutionOptions } from '../provider-factory-DxzOVEmh.cjs';
3
+ import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from '../supabasePublisher-C627qXFT.cjs';
4
+ import { S as SingleArtifactRequest, a as SingleArtifactResult } from '../gateSettings-DKXRztJy.cjs';
5
+ export { b as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS, G as GateSettings, R as ResolvedGateSettings, g as gateModeFor, p as parseGateSettings, r as resolveGateSettings } from '../gateSettings-DKXRztJy.cjs';
6
+ import * as workflow from 'workflow';
7
+ import { z } from 'zod';
8
+ import { F as FrameworkPack, C as CoverageGateReport } from '../standardsCoverageGate-CsUNzv6C.cjs';
5
9
  import 'ai';
6
- import '../supabasePublisher-C627qXFT.cjs';
7
- import 'workflow';
8
- import '../standardsCoverageGate-BWAkXY76.cjs';
10
+
11
+ interface GenerateMasterLessonStepInput {
12
+ milestone: MilestoneInput;
13
+ language: string;
14
+ topic?: string;
15
+ targetAudience?: string;
16
+ contextContinuity?: string;
17
+ /** Pre-rendered STANDARDS CONTEXT block (verbatim standard statements). */
18
+ standardsContext?: string;
19
+ modelOptions?: ModelResolutionOptions;
20
+ }
21
+ declare function generateMasterLessonStep(input: GenerateMasterLessonStepInput): Promise<LessonPlan>;
22
+ interface JudgeMasterLessonStepInput {
23
+ lessonId: string;
24
+ lesson: LessonPlan;
25
+ language: string;
26
+ targetObjectives: Array<{
27
+ code: string;
28
+ description: string;
29
+ bloomLevel: string;
30
+ }>;
31
+ /** Verbatim standard statements (canonical ID -> text) for the Standards Alignment judge dimension. */
32
+ standardStatements?: Record<string, string>;
33
+ modelOptions?: ModelResolutionOptions;
34
+ }
35
+ declare function judgeMasterLessonStep(input: JudgeMasterLessonStepInput): Promise<CurriculumQualityReport>;
36
+ interface RepairMasterLessonStepInput {
37
+ milestone: MilestoneInput;
38
+ language: string;
39
+ topic?: string;
40
+ targetAudience?: string;
41
+ auditReport: CurriculumQualityReport;
42
+ /** Pre-rendered STANDARDS CONTEXT block — kept across repair so grounding is never lost. */
43
+ standardsContext?: string;
44
+ modelOptions?: ModelResolutionOptions;
45
+ }
46
+ declare function repairMasterLessonStep(input: RepairMasterLessonStepInput): Promise<LessonPlan>;
47
+
48
+ declare function generateActivityStep(options: {
49
+ lesson: LessonPlan;
50
+ language: string;
51
+ modelOptions?: ModelResolutionOptions;
52
+ }): Promise<ActivityLab>;
53
+ declare function generateCodeLabStep(options: {
54
+ lesson: LessonPlan;
55
+ activity: ActivityLab;
56
+ language: string;
57
+ targetTechStack?: string[];
58
+ modelOptions?: ModelResolutionOptions;
59
+ }): Promise<CodeLab>;
60
+ declare function generateSelfLabStep(options: {
61
+ milestone: MilestoneInput;
62
+ language: string;
63
+ targetTechStack?: string[];
64
+ modelOptions?: ModelResolutionOptions;
65
+ }): Promise<SelfLab>;
66
+ declare function generateDiagnosticQuizStep(options: {
67
+ milestone: MilestoneInput;
68
+ language: string;
69
+ modelOptions?: ModelResolutionOptions;
70
+ }): Promise<DiagnosticQuiz>;
71
+ declare function generateSlidesStep(options: {
72
+ lesson: LessonPlan;
73
+ language: string;
74
+ modelOptions?: ModelResolutionOptions;
75
+ }): Promise<SlideDeck>;
76
+ declare function generateHandoutStep(options: {
77
+ lesson: LessonPlan;
78
+ language: string;
79
+ modelOptions?: ModelResolutionOptions;
80
+ }): Promise<Handout>;
81
+ declare function generateWorksheetStep(options: {
82
+ lesson: LessonPlan;
83
+ language: string;
84
+ modelOptions?: ModelResolutionOptions;
85
+ }): Promise<Worksheet>;
86
+ declare function generateTeacherGuideStep(options: {
87
+ lesson: LessonPlan;
88
+ activity: ActivityLab;
89
+ language: string;
90
+ modelOptions?: ModelResolutionOptions;
91
+ }): Promise<TeacherGuide>;
92
+ declare function generateExtensionStep(options: {
93
+ lesson: LessonPlan;
94
+ activity: ActivityLab;
95
+ language: string;
96
+ modelOptions?: ModelResolutionOptions;
97
+ }): Promise<Extension>;
98
+
99
+ interface JudgeSatelliteStepInput {
100
+ artifactType: string;
101
+ artifactId: string;
102
+ artifact: unknown;
103
+ language: string;
104
+ targetObjectives: Array<{
105
+ code: string;
106
+ description: string;
107
+ bloomLevel: string;
108
+ }>;
109
+ standardStatements?: Record<string, string>;
110
+ modelOptions?: ModelResolutionOptions;
111
+ }
112
+ /**
113
+ * Gate step for satellite artifacts (LLM_JUDGE mode).
114
+ * Judges any artifact JSON against the same 6-dimension rubric; returns the report.
115
+ * The workflow decides what to do with the verdict (log / block / store) — gate config stays the single source of truth.
116
+ */
117
+ declare function judgeSatelliteStep(input: JudgeSatelliteStepInput): Promise<CurriculumQualityReport>;
118
+
119
+ interface SaveMilestoneArtifactsInput {
120
+ jobId: string;
121
+ milestoneSlug: string;
122
+ lesson: LessonPlan;
123
+ activity?: ActivityLab;
124
+ codeLab?: CodeLab;
125
+ selfLab?: SelfLab;
126
+ quiz?: DiagnosticQuiz;
127
+ slides?: SlideDeck;
128
+ handout?: Handout;
129
+ worksheet?: Worksheet;
130
+ teacherGuide?: TeacherGuide;
131
+ extension?: Extension;
132
+ cheatSheetMarkdown?: string;
133
+ baseWorkspaceDir?: string;
134
+ }
135
+ interface SavedMilestoneResult {
136
+ milestoneSlug: string;
137
+ savedFiles: string[];
138
+ }
139
+ declare function saveMilestoneToWorkspaceStep(input: SaveMilestoneArtifactsInput): Promise<SavedMilestoneResult>;
140
+ declare function publishToGitStep(options: GitPublishOptions): Promise<GitPublishResult>;
141
+ declare function publishToSupabaseStep(options: SupabasePublishOptions): Promise<SupabasePublishResult>;
142
+
143
+ /**
144
+ * Payload human gửi khi duyệt / từ chối một artifact tại chốt HITL.
145
+ */
146
+ declare const approvalPayloadSchema: z.ZodObject<{
147
+ approved: z.ZodBoolean;
148
+ reviewerName: z.ZodOptional<z.ZodString>;
149
+ feedback: z.ZodOptional<z.ZodString>;
150
+ timestamp: z.ZodOptional<z.ZodString>;
151
+ }, "strip", z.ZodTypeAny, {
152
+ approved: boolean;
153
+ timestamp?: string | undefined;
154
+ feedback?: string | undefined;
155
+ reviewerName?: string | undefined;
156
+ }, {
157
+ approved: boolean;
158
+ timestamp?: string | undefined;
159
+ feedback?: string | undefined;
160
+ reviewerName?: string | undefined;
161
+ }>;
162
+ type ApprovalPayload = z.infer<typeof approvalPayloadSchema>;
163
+ /**
164
+ * Durable HITL hook (Vercel Workflow SDK ≥ 4.x).
165
+ *
166
+ * - TRONG workflow (`'use workflow'`): `const decision = await lessonApprovalHook.create({ token })`
167
+ * → run suspend với chi phí 0 cho tới khi payload được resume.
168
+ * - NGOÀI workflow (API route): `await lessonApprovalHook.resume(token, payload)`
169
+ * → ghi payload vào hook, SDK đánh thức run đang suspend.
170
+ *
171
+ * Token quy ước: `approval:{projectId}:{lessonId}:{artifactType}` — phía API route
172
+ * tái tạo được token từ dữ liệu nó có sẵn.
173
+ */
174
+ declare const lessonApprovalHook: workflow.TypedHook<{
175
+ approved: boolean;
176
+ timestamp?: string | undefined;
177
+ feedback?: string | undefined;
178
+ reviewerName?: string | undefined;
179
+ }, {
180
+ approved: boolean;
181
+ timestamp?: string | undefined;
182
+ feedback?: string | undefined;
183
+ reviewerName?: string | undefined;
184
+ }>;
185
+ /** Tái tạo deterministic hook token cho một chốt duyệt artifact. */
186
+ declare function approvalHookToken(projectId: string, lessonId: string, artifactType: string): string;
187
+
188
+ interface ExecuteWithRateLimitOptions<T> {
189
+ stepName: string;
190
+ fn: () => Promise<T>;
191
+ maxAttempts?: number;
192
+ }
193
+ /**
194
+ * Wraps async LLM functions to automatically catch 429/503/transient network errors
195
+ * and throw a durable RetryableError with exponential backoff for Vercel Workflow runtime.
196
+ */
197
+ declare function withRateLimitBackoff<T>(options: ExecuteWithRateLimitOptions<T>): Promise<T>;
198
+
199
+ interface MilestoneWorkflowInput {
200
+ jobId: string;
201
+ milestone: MilestoneInput;
202
+ language?: string;
203
+ topic?: string;
204
+ targetAudience?: string;
205
+ techStack?: string[];
206
+ bundleTier?: 'minimum' | 'full';
207
+ baseWorkspaceDir?: string;
208
+ modelOptions?: ModelResolutionOptions;
209
+ /** Adopted Framework Packs (hydrated from the Standards Registry) for standards-grounded generation. */
210
+ standardsPacks?: FrameworkPack[];
211
+ /** Hard-block the milestone when standards coverage FAILs (default: true when packs provided). */
212
+ enforceStandardsCoverage?: boolean;
213
+ /** Gate Settings thô (vd: gateModes từ project.config.json) — kit tự chuẩn hoá. */
214
+ gateSettings?: unknown;
215
+ }
216
+ interface MilestoneWorkflowResult {
217
+ milestoneId: string;
218
+ milestoneSlug: string;
219
+ status: 'SUCCESS' | 'FAILED';
220
+ savedResult: SavedMilestoneResult;
221
+ judgeReport?: CurriculumQualityReport;
222
+ /** Per-artifact-type judge reports for satellites (Gate mode LLM_JUDGE only). */
223
+ satelliteJudgeReports?: Record<string, CurriculumQualityReport>;
224
+ /** The resolved gate settings actually applied in this run (for traceability). */
225
+ gatesResolved?: Record<string, string>;
226
+ /** Set when a Gate (e.g. HITL rejection) BLOCKED downstream production. */
227
+ gateBlocked?: {
228
+ artifactType: string;
229
+ reason: 'HITL_REJECTED' | 'HITL_REJECTED_V2';
230
+ feedback?: string;
231
+ };
232
+ standardsCoverage?: CoverageGateReport;
233
+ artifacts: {
234
+ lesson: LessonPlan;
235
+ activity?: ActivityLab;
236
+ codeLab?: CodeLab;
237
+ selfLab?: SelfLab;
238
+ quiz?: DiagnosticQuiz;
239
+ slides?: SlideDeck;
240
+ handout?: Handout;
241
+ worksheet?: Worksheet;
242
+ teacherGuide?: TeacherGuide;
243
+ extension?: Extension;
244
+ };
245
+ }
246
+ /**
247
+ * Child Workflow: Executes fine-grained durable generation for a single Milestone.
248
+ * Uses Step-level memoization, automatic LLM retries, and parallel satellite generation.
249
+ */
250
+ declare function generateMilestoneWorkflow(input: MilestoneWorkflowInput): Promise<MilestoneWorkflowResult>;
251
+
252
+ interface GenerateRoadmapWorkflowInput {
253
+ jobId?: string;
254
+ roadmap: ProjectRoadmap;
255
+ language?: string;
256
+ bundleTier?: 'minimum' | 'full';
257
+ batchSize?: number;
258
+ /** Gate Settings thô (vd: gateModes từ project.config.json) — kit tự chuẩn hoá. */
259
+ gateSettings?: unknown;
260
+ baseWorkspaceDir?: string;
261
+ gitPublishOptions?: Omit<GitPublishOptions, 'jobId' | 'localJobDir'>;
262
+ supabasePublishOptions?: Omit<SupabasePublishOptions, 'jobId' | 'courseTitle' | 'topic' | 'language' | 'milestones'>;
263
+ modelOptions?: ModelResolutionOptions;
264
+ }
265
+ interface RoadmapWorkflowSummary {
266
+ jobId: string;
267
+ courseTitle: string;
268
+ topic: string;
269
+ language: string;
270
+ totalMilestones: number;
271
+ successfulMilestones: number;
272
+ failedMilestones: number;
273
+ results: Array<{
274
+ milestoneId: string;
275
+ status: 'FULFILLED' | 'REJECTED';
276
+ result?: MilestoneWorkflowResult;
277
+ error?: string;
278
+ }>;
279
+ gitPublishResult?: GitPublishResult;
280
+ supabasePublishResult?: SupabasePublishResult;
281
+ workspaceDir: string;
282
+ }
283
+ /**
284
+ * Parent Workflow: Orchestrates durable generation of an entire Curriculum Roadmap.
285
+ * Implements Batching (Pattern 1), Failure Isolation, and Dual-Target Publishing (Git + Supabase).
286
+ */
287
+ declare function generateRoadmapWorkflow(input: GenerateRoadmapWorkflowInput): Promise<RoadmapWorkflowSummary>;
288
+
289
+ /**
290
+ * Step-level durable execution for generating a single standalone artifact.
291
+ */
292
+ declare function executeSingleArtifactStep(request: SingleArtifactRequest): Promise<SingleArtifactResult>;
293
+ /**
294
+ * Workflow for on-demand single artifact generation.
295
+ * Supports Vercel Workflow durable execution, step memoization, and automatic retry.
296
+ */
297
+ declare function generateSingleArtifactWorkflow(request: SingleArtifactRequest): Promise<SingleArtifactResult>;
298
+
299
+ export { type ApprovalPayload, type ExecuteWithRateLimitOptions, type GenerateMasterLessonStepInput, type GenerateRoadmapWorkflowInput, type JudgeMasterLessonStepInput, type JudgeSatelliteStepInput, type MilestoneWorkflowInput, type MilestoneWorkflowResult, type RepairMasterLessonStepInput, type RoadmapWorkflowSummary, type SaveMilestoneArtifactsInput, type SavedMilestoneResult, approvalHookToken, approvalPayloadSchema, executeSingleArtifactStep, generateActivityStep, generateCodeLabStep, generateDiagnosticQuizStep, generateExtensionStep, generateHandoutStep, generateMasterLessonStep, generateMilestoneWorkflow, generateRoadmapWorkflow, generateSelfLabStep, generateSingleArtifactWorkflow, generateSlidesStep, generateTeacherGuideStep, generateWorksheetStep, judgeMasterLessonStep, judgeSatelliteStep, lessonApprovalHook, publishToGitStep, publishToSupabaseStep, repairMasterLessonStep, saveMilestoneToWorkspaceStep, withRateLimitBackoff };
@@ -1,8 +1,299 @@
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-B8lOdFuz.js';
2
- import '../schemas/index.js';
3
- import 'zod';
4
- import '../provider-factory-DxzOVEmh.js';
1
+ import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from '../schemas/index.js';
2
+ import { M as ModelResolutionOptions } from '../provider-factory-DxzOVEmh.js';
3
+ import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from '../supabasePublisher-C627qXFT.js';
4
+ import { S as SingleArtifactRequest, a as SingleArtifactResult } from '../gateSettings-DKXRztJy.js';
5
+ export { b as CurriculumArtifactType, C as CurriculumGateMode, D as DEFAULT_GATE_SETTINGS, G as GateSettings, R as ResolvedGateSettings, g as gateModeFor, p as parseGateSettings, r as resolveGateSettings } from '../gateSettings-DKXRztJy.js';
6
+ import * as workflow from 'workflow';
7
+ import { z } from 'zod';
8
+ import { F as FrameworkPack, C as CoverageGateReport } from '../standardsCoverageGate-CsUNzv6C.js';
5
9
  import 'ai';
6
- import '../supabasePublisher-C627qXFT.js';
7
- import 'workflow';
8
- import '../standardsCoverageGate-BWAkXY76.js';
10
+
11
+ interface GenerateMasterLessonStepInput {
12
+ milestone: MilestoneInput;
13
+ language: string;
14
+ topic?: string;
15
+ targetAudience?: string;
16
+ contextContinuity?: string;
17
+ /** Pre-rendered STANDARDS CONTEXT block (verbatim standard statements). */
18
+ standardsContext?: string;
19
+ modelOptions?: ModelResolutionOptions;
20
+ }
21
+ declare function generateMasterLessonStep(input: GenerateMasterLessonStepInput): Promise<LessonPlan>;
22
+ interface JudgeMasterLessonStepInput {
23
+ lessonId: string;
24
+ lesson: LessonPlan;
25
+ language: string;
26
+ targetObjectives: Array<{
27
+ code: string;
28
+ description: string;
29
+ bloomLevel: string;
30
+ }>;
31
+ /** Verbatim standard statements (canonical ID -> text) for the Standards Alignment judge dimension. */
32
+ standardStatements?: Record<string, string>;
33
+ modelOptions?: ModelResolutionOptions;
34
+ }
35
+ declare function judgeMasterLessonStep(input: JudgeMasterLessonStepInput): Promise<CurriculumQualityReport>;
36
+ interface RepairMasterLessonStepInput {
37
+ milestone: MilestoneInput;
38
+ language: string;
39
+ topic?: string;
40
+ targetAudience?: string;
41
+ auditReport: CurriculumQualityReport;
42
+ /** Pre-rendered STANDARDS CONTEXT block — kept across repair so grounding is never lost. */
43
+ standardsContext?: string;
44
+ modelOptions?: ModelResolutionOptions;
45
+ }
46
+ declare function repairMasterLessonStep(input: RepairMasterLessonStepInput): Promise<LessonPlan>;
47
+
48
+ declare function generateActivityStep(options: {
49
+ lesson: LessonPlan;
50
+ language: string;
51
+ modelOptions?: ModelResolutionOptions;
52
+ }): Promise<ActivityLab>;
53
+ declare function generateCodeLabStep(options: {
54
+ lesson: LessonPlan;
55
+ activity: ActivityLab;
56
+ language: string;
57
+ targetTechStack?: string[];
58
+ modelOptions?: ModelResolutionOptions;
59
+ }): Promise<CodeLab>;
60
+ declare function generateSelfLabStep(options: {
61
+ milestone: MilestoneInput;
62
+ language: string;
63
+ targetTechStack?: string[];
64
+ modelOptions?: ModelResolutionOptions;
65
+ }): Promise<SelfLab>;
66
+ declare function generateDiagnosticQuizStep(options: {
67
+ milestone: MilestoneInput;
68
+ language: string;
69
+ modelOptions?: ModelResolutionOptions;
70
+ }): Promise<DiagnosticQuiz>;
71
+ declare function generateSlidesStep(options: {
72
+ lesson: LessonPlan;
73
+ language: string;
74
+ modelOptions?: ModelResolutionOptions;
75
+ }): Promise<SlideDeck>;
76
+ declare function generateHandoutStep(options: {
77
+ lesson: LessonPlan;
78
+ language: string;
79
+ modelOptions?: ModelResolutionOptions;
80
+ }): Promise<Handout>;
81
+ declare function generateWorksheetStep(options: {
82
+ lesson: LessonPlan;
83
+ language: string;
84
+ modelOptions?: ModelResolutionOptions;
85
+ }): Promise<Worksheet>;
86
+ declare function generateTeacherGuideStep(options: {
87
+ lesson: LessonPlan;
88
+ activity: ActivityLab;
89
+ language: string;
90
+ modelOptions?: ModelResolutionOptions;
91
+ }): Promise<TeacherGuide>;
92
+ declare function generateExtensionStep(options: {
93
+ lesson: LessonPlan;
94
+ activity: ActivityLab;
95
+ language: string;
96
+ modelOptions?: ModelResolutionOptions;
97
+ }): Promise<Extension>;
98
+
99
+ interface JudgeSatelliteStepInput {
100
+ artifactType: string;
101
+ artifactId: string;
102
+ artifact: unknown;
103
+ language: string;
104
+ targetObjectives: Array<{
105
+ code: string;
106
+ description: string;
107
+ bloomLevel: string;
108
+ }>;
109
+ standardStatements?: Record<string, string>;
110
+ modelOptions?: ModelResolutionOptions;
111
+ }
112
+ /**
113
+ * Gate step for satellite artifacts (LLM_JUDGE mode).
114
+ * Judges any artifact JSON against the same 6-dimension rubric; returns the report.
115
+ * The workflow decides what to do with the verdict (log / block / store) — gate config stays the single source of truth.
116
+ */
117
+ declare function judgeSatelliteStep(input: JudgeSatelliteStepInput): Promise<CurriculumQualityReport>;
118
+
119
+ interface SaveMilestoneArtifactsInput {
120
+ jobId: string;
121
+ milestoneSlug: string;
122
+ lesson: LessonPlan;
123
+ activity?: ActivityLab;
124
+ codeLab?: CodeLab;
125
+ selfLab?: SelfLab;
126
+ quiz?: DiagnosticQuiz;
127
+ slides?: SlideDeck;
128
+ handout?: Handout;
129
+ worksheet?: Worksheet;
130
+ teacherGuide?: TeacherGuide;
131
+ extension?: Extension;
132
+ cheatSheetMarkdown?: string;
133
+ baseWorkspaceDir?: string;
134
+ }
135
+ interface SavedMilestoneResult {
136
+ milestoneSlug: string;
137
+ savedFiles: string[];
138
+ }
139
+ declare function saveMilestoneToWorkspaceStep(input: SaveMilestoneArtifactsInput): Promise<SavedMilestoneResult>;
140
+ declare function publishToGitStep(options: GitPublishOptions): Promise<GitPublishResult>;
141
+ declare function publishToSupabaseStep(options: SupabasePublishOptions): Promise<SupabasePublishResult>;
142
+
143
+ /**
144
+ * Payload human gửi khi duyệt / từ chối một artifact tại chốt HITL.
145
+ */
146
+ declare const approvalPayloadSchema: z.ZodObject<{
147
+ approved: z.ZodBoolean;
148
+ reviewerName: z.ZodOptional<z.ZodString>;
149
+ feedback: z.ZodOptional<z.ZodString>;
150
+ timestamp: z.ZodOptional<z.ZodString>;
151
+ }, "strip", z.ZodTypeAny, {
152
+ approved: boolean;
153
+ timestamp?: string | undefined;
154
+ feedback?: string | undefined;
155
+ reviewerName?: string | undefined;
156
+ }, {
157
+ approved: boolean;
158
+ timestamp?: string | undefined;
159
+ feedback?: string | undefined;
160
+ reviewerName?: string | undefined;
161
+ }>;
162
+ type ApprovalPayload = z.infer<typeof approvalPayloadSchema>;
163
+ /**
164
+ * Durable HITL hook (Vercel Workflow SDK ≥ 4.x).
165
+ *
166
+ * - TRONG workflow (`'use workflow'`): `const decision = await lessonApprovalHook.create({ token })`
167
+ * → run suspend với chi phí 0 cho tới khi payload được resume.
168
+ * - NGOÀI workflow (API route): `await lessonApprovalHook.resume(token, payload)`
169
+ * → ghi payload vào hook, SDK đánh thức run đang suspend.
170
+ *
171
+ * Token quy ước: `approval:{projectId}:{lessonId}:{artifactType}` — phía API route
172
+ * tái tạo được token từ dữ liệu nó có sẵn.
173
+ */
174
+ declare const lessonApprovalHook: workflow.TypedHook<{
175
+ approved: boolean;
176
+ timestamp?: string | undefined;
177
+ feedback?: string | undefined;
178
+ reviewerName?: string | undefined;
179
+ }, {
180
+ approved: boolean;
181
+ timestamp?: string | undefined;
182
+ feedback?: string | undefined;
183
+ reviewerName?: string | undefined;
184
+ }>;
185
+ /** Tái tạo deterministic hook token cho một chốt duyệt artifact. */
186
+ declare function approvalHookToken(projectId: string, lessonId: string, artifactType: string): string;
187
+
188
+ interface ExecuteWithRateLimitOptions<T> {
189
+ stepName: string;
190
+ fn: () => Promise<T>;
191
+ maxAttempts?: number;
192
+ }
193
+ /**
194
+ * Wraps async LLM functions to automatically catch 429/503/transient network errors
195
+ * and throw a durable RetryableError with exponential backoff for Vercel Workflow runtime.
196
+ */
197
+ declare function withRateLimitBackoff<T>(options: ExecuteWithRateLimitOptions<T>): Promise<T>;
198
+
199
+ interface MilestoneWorkflowInput {
200
+ jobId: string;
201
+ milestone: MilestoneInput;
202
+ language?: string;
203
+ topic?: string;
204
+ targetAudience?: string;
205
+ techStack?: string[];
206
+ bundleTier?: 'minimum' | 'full';
207
+ baseWorkspaceDir?: string;
208
+ modelOptions?: ModelResolutionOptions;
209
+ /** Adopted Framework Packs (hydrated from the Standards Registry) for standards-grounded generation. */
210
+ standardsPacks?: FrameworkPack[];
211
+ /** Hard-block the milestone when standards coverage FAILs (default: true when packs provided). */
212
+ enforceStandardsCoverage?: boolean;
213
+ /** Gate Settings thô (vd: gateModes từ project.config.json) — kit tự chuẩn hoá. */
214
+ gateSettings?: unknown;
215
+ }
216
+ interface MilestoneWorkflowResult {
217
+ milestoneId: string;
218
+ milestoneSlug: string;
219
+ status: 'SUCCESS' | 'FAILED';
220
+ savedResult: SavedMilestoneResult;
221
+ judgeReport?: CurriculumQualityReport;
222
+ /** Per-artifact-type judge reports for satellites (Gate mode LLM_JUDGE only). */
223
+ satelliteJudgeReports?: Record<string, CurriculumQualityReport>;
224
+ /** The resolved gate settings actually applied in this run (for traceability). */
225
+ gatesResolved?: Record<string, string>;
226
+ /** Set when a Gate (e.g. HITL rejection) BLOCKED downstream production. */
227
+ gateBlocked?: {
228
+ artifactType: string;
229
+ reason: 'HITL_REJECTED' | 'HITL_REJECTED_V2';
230
+ feedback?: string;
231
+ };
232
+ standardsCoverage?: CoverageGateReport;
233
+ artifacts: {
234
+ lesson: LessonPlan;
235
+ activity?: ActivityLab;
236
+ codeLab?: CodeLab;
237
+ selfLab?: SelfLab;
238
+ quiz?: DiagnosticQuiz;
239
+ slides?: SlideDeck;
240
+ handout?: Handout;
241
+ worksheet?: Worksheet;
242
+ teacherGuide?: TeacherGuide;
243
+ extension?: Extension;
244
+ };
245
+ }
246
+ /**
247
+ * Child Workflow: Executes fine-grained durable generation for a single Milestone.
248
+ * Uses Step-level memoization, automatic LLM retries, and parallel satellite generation.
249
+ */
250
+ declare function generateMilestoneWorkflow(input: MilestoneWorkflowInput): Promise<MilestoneWorkflowResult>;
251
+
252
+ interface GenerateRoadmapWorkflowInput {
253
+ jobId?: string;
254
+ roadmap: ProjectRoadmap;
255
+ language?: string;
256
+ bundleTier?: 'minimum' | 'full';
257
+ batchSize?: number;
258
+ /** Gate Settings thô (vd: gateModes từ project.config.json) — kit tự chuẩn hoá. */
259
+ gateSettings?: unknown;
260
+ baseWorkspaceDir?: string;
261
+ gitPublishOptions?: Omit<GitPublishOptions, 'jobId' | 'localJobDir'>;
262
+ supabasePublishOptions?: Omit<SupabasePublishOptions, 'jobId' | 'courseTitle' | 'topic' | 'language' | 'milestones'>;
263
+ modelOptions?: ModelResolutionOptions;
264
+ }
265
+ interface RoadmapWorkflowSummary {
266
+ jobId: string;
267
+ courseTitle: string;
268
+ topic: string;
269
+ language: string;
270
+ totalMilestones: number;
271
+ successfulMilestones: number;
272
+ failedMilestones: number;
273
+ results: Array<{
274
+ milestoneId: string;
275
+ status: 'FULFILLED' | 'REJECTED';
276
+ result?: MilestoneWorkflowResult;
277
+ error?: string;
278
+ }>;
279
+ gitPublishResult?: GitPublishResult;
280
+ supabasePublishResult?: SupabasePublishResult;
281
+ workspaceDir: string;
282
+ }
283
+ /**
284
+ * Parent Workflow: Orchestrates durable generation of an entire Curriculum Roadmap.
285
+ * Implements Batching (Pattern 1), Failure Isolation, and Dual-Target Publishing (Git + Supabase).
286
+ */
287
+ declare function generateRoadmapWorkflow(input: GenerateRoadmapWorkflowInput): Promise<RoadmapWorkflowSummary>;
288
+
289
+ /**
290
+ * Step-level durable execution for generating a single standalone artifact.
291
+ */
292
+ declare function executeSingleArtifactStep(request: SingleArtifactRequest): Promise<SingleArtifactResult>;
293
+ /**
294
+ * Workflow for on-demand single artifact generation.
295
+ * Supports Vercel Workflow durable execution, step memoization, and automatic retry.
296
+ */
297
+ declare function generateSingleArtifactWorkflow(request: SingleArtifactRequest): Promise<SingleArtifactResult>;
298
+
299
+ export { type ApprovalPayload, type ExecuteWithRateLimitOptions, type GenerateMasterLessonStepInput, type GenerateRoadmapWorkflowInput, type JudgeMasterLessonStepInput, type JudgeSatelliteStepInput, type MilestoneWorkflowInput, type MilestoneWorkflowResult, type RepairMasterLessonStepInput, type RoadmapWorkflowSummary, type SaveMilestoneArtifactsInput, type SavedMilestoneResult, approvalHookToken, approvalPayloadSchema, executeSingleArtifactStep, generateActivityStep, generateCodeLabStep, generateDiagnosticQuizStep, generateExtensionStep, generateHandoutStep, generateMasterLessonStep, generateMilestoneWorkflow, generateRoadmapWorkflow, generateSelfLabStep, generateSingleArtifactWorkflow, generateSlidesStep, generateTeacherGuideStep, generateWorksheetStep, judgeMasterLessonStep, judgeSatelliteStep, lessonApprovalHook, publishToGitStep, publishToSupabaseStep, repairMasterLessonStep, saveMilestoneToWorkspaceStep, withRateLimitBackoff };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thanh01.pmt/curriculum-kit",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "A high-fidelity AI curriculum & content generation engine powered by Vercel AI SDK, Zod, and Bloom-aligned pedagogical standards.",
5
5
  "author": "Thanh Pham <https://github.com/thanh01pmt>",
6
6
  "license": "MIT",