@thanh01.pmt/curriculum-kit 1.0.5 → 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 +401 -341
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.mjs +399 -322
- 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,6 +1,7 @@
|
|
|
1
1
|
import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from './schemas/index.cjs';
|
|
2
2
|
import { M as ModelResolutionOptions } from './provider-factory-DH3udYlN.cjs';
|
|
3
3
|
import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from './supabasePublisher-C627qXFT.cjs';
|
|
4
|
+
import * as workflow from 'workflow';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import { F as FrameworkPack, m as CoverageGateReport } from './standardsCoverageGate-BWAkXY76.cjs';
|
|
6
7
|
|
|
@@ -26,6 +27,28 @@ interface SingleArtifactRequest {
|
|
|
26
27
|
lessonPlan?: string;
|
|
27
28
|
handout?: string;
|
|
28
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Media Ledger policy (nếu có): agent chèn placeholder [IMAGE: slug], Curator duyệt,
|
|
32
|
+
* Fulfiller thực thi (search Pexels / gen AI). Không truyền → không planning ảnh.
|
|
33
|
+
*/
|
|
34
|
+
mediaPolicy?: {
|
|
35
|
+
maxGenImagesPerArtifact: number;
|
|
36
|
+
autoFulfill?: boolean;
|
|
37
|
+
preferredProvider?: 'openai' | 'gemini';
|
|
38
|
+
mode?: 'search_only' | 'gen_only' | 'auto';
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Nghiên cứu nền (từ research-kit harvest hoặc preliminary research) — bối cảnh
|
|
42
|
+
* fact-grounded để giảm outdate/hallucination khi sinh artifact standalone.
|
|
43
|
+
*/
|
|
44
|
+
researchContext?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Gate settings thô (vd gateModes từ project.config.json của Composer —
|
|
47
|
+
* scratch dùng config của chính nó). Kit tự chuẩn hoá; thiếu key = OFF
|
|
48
|
+
* (không kiểm). LLM_JUDGE → judge sau khi sinh + repair 1 vòng, fail-closed.
|
|
49
|
+
* HITL → chờ human duyệt (caller xử lý pause/resume).
|
|
50
|
+
*/
|
|
51
|
+
gateSettings?: unknown;
|
|
29
52
|
options?: {
|
|
30
53
|
model?: string;
|
|
31
54
|
temperature?: number;
|
|
@@ -45,6 +68,11 @@ interface SingleArtifactResult {
|
|
|
45
68
|
content: string;
|
|
46
69
|
persona: string;
|
|
47
70
|
thought?: string;
|
|
71
|
+
/** Gate outcome: HITL đang chờ người duyệt; judge_needs_revision → bị từ chối sau repair; judge_error → fail-closed. */
|
|
72
|
+
pausedForReview?: boolean;
|
|
73
|
+
gateStatus?: 'awaiting_approval' | 'judge_needs_revision' | 'judge_error';
|
|
74
|
+
judgeScore?: number;
|
|
75
|
+
judgeCritique?: string;
|
|
48
76
|
}
|
|
49
77
|
/**
|
|
50
78
|
* Maps artifact type to default canonical filename and responsible agent persona
|
|
@@ -75,7 +103,12 @@ type CurriculumGateMode = 'OFF' | 'LLM_JUDGE' | 'HITL';
|
|
|
75
103
|
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';
|
|
76
104
|
type GateSettings = Partial<Record<CurriculumArtifactType, CurriculumGateMode>>;
|
|
77
105
|
type ResolvedGateSettings = Readonly<Record<CurriculumArtifactType, CurriculumGateMode>>;
|
|
78
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Mặc định: KHÔNG KIỂM (all-OFF) — triết lý "config là nguồn duy nhất".
|
|
108
|
+
* Không gate nào được hồi sinh ngầm khi thiếu key trong project.config.json.
|
|
109
|
+
* Composer (apps/web) ghi gateModes đầy đủ tường minh lúc tạo project / lưu settings,
|
|
110
|
+
* và user toàn quyền đổi qua Settings cho project/scratch đang chạy.
|
|
111
|
+
*/
|
|
79
112
|
declare const DEFAULT_GATE_SETTINGS: ResolvedGateSettings;
|
|
80
113
|
/**
|
|
81
114
|
* Chuẩn hoá config thô (vd: gateModes đọc từ project.config.json của Composer) thành GateSettings.
|
|
@@ -222,6 +255,9 @@ declare function saveMilestoneToWorkspaceStep(input: SaveMilestoneArtifactsInput
|
|
|
222
255
|
declare function publishToGitStep(options: GitPublishOptions): Promise<GitPublishResult>;
|
|
223
256
|
declare function publishToSupabaseStep(options: SupabasePublishOptions): Promise<SupabasePublishResult>;
|
|
224
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Payload human gửi khi duyệt / từ chối một artifact tại chốt HITL.
|
|
260
|
+
*/
|
|
225
261
|
declare const approvalPayloadSchema: z.ZodObject<{
|
|
226
262
|
approved: z.ZodBoolean;
|
|
227
263
|
reviewerName: z.ZodOptional<z.ZodString>;
|
|
@@ -240,10 +276,29 @@ declare const approvalPayloadSchema: z.ZodObject<{
|
|
|
240
276
|
}>;
|
|
241
277
|
type ApprovalPayload = z.infer<typeof approvalPayloadSchema>;
|
|
242
278
|
/**
|
|
243
|
-
* Durable
|
|
244
|
-
*
|
|
279
|
+
* Durable HITL hook (Vercel Workflow SDK ≥ 4.x).
|
|
280
|
+
*
|
|
281
|
+
* - TRONG workflow (`'use workflow'`): `const decision = await lessonApprovalHook.create({ token })`
|
|
282
|
+
* → run suspend với chi phí 0 cho tới khi payload được resume.
|
|
283
|
+
* - NGOÀI workflow (API route): `await lessonApprovalHook.resume(token, payload)`
|
|
284
|
+
* → ghi payload vào hook, SDK đánh thức run đang suspend.
|
|
285
|
+
*
|
|
286
|
+
* Token quy ước: `approval:{projectId}:{lessonId}:{artifactType}` — phía API route
|
|
287
|
+
* tái tạo được token từ dữ liệu nó có sẵn.
|
|
245
288
|
*/
|
|
246
|
-
declare const lessonApprovalHook:
|
|
289
|
+
declare const lessonApprovalHook: workflow.TypedHook<{
|
|
290
|
+
approved: boolean;
|
|
291
|
+
feedback?: string | undefined;
|
|
292
|
+
timestamp?: string | undefined;
|
|
293
|
+
reviewerName?: string | undefined;
|
|
294
|
+
}, {
|
|
295
|
+
approved: boolean;
|
|
296
|
+
feedback?: string | undefined;
|
|
297
|
+
timestamp?: string | undefined;
|
|
298
|
+
reviewerName?: string | undefined;
|
|
299
|
+
}>;
|
|
300
|
+
/** Tái tạo deterministic hook token cho một chốt duyệt artifact. */
|
|
301
|
+
declare function approvalHookToken(projectId: string, lessonId: string, artifactType: string): string;
|
|
247
302
|
|
|
248
303
|
interface ExecuteWithRateLimitOptions<T> {
|
|
249
304
|
stepName: string;
|
|
@@ -356,4 +411,4 @@ declare function executeSingleArtifactStep(request: SingleArtifactRequest): Prom
|
|
|
356
411
|
*/
|
|
357
412
|
declare function generateSingleArtifactWorkflow(request: SingleArtifactRequest): Promise<SingleArtifactResult>;
|
|
358
413
|
|
|
359
|
-
export { type ArtifactType as A, parseGateSettings as B, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, resolveGateSettings as E, gateModeFor as F, type GenerateMasterLessonStepInput as G, approvalPayloadSchema as H, type ApprovalPayload as I, type JudgeMasterLessonStepInput as J, lessonApprovalHook as K, type ExecuteWithRateLimitOptions as
|
|
414
|
+
export { type ArtifactType as A, parseGateSettings as B, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, resolveGateSettings as E, gateModeFor as F, type GenerateMasterLessonStepInput as G, approvalPayloadSchema as H, type ApprovalPayload as I, type JudgeMasterLessonStepInput as J, lessonApprovalHook as K, approvalHookToken as L, type ExecuteWithRateLimitOptions as M, withRateLimitBackoff as N, type MilestoneWorkflowInput as O, type MilestoneWorkflowResult as P, generateMilestoneWorkflow as Q, type ResolvedGateSettings as R, type ScaffoldingLevel as S, type GenerateRoadmapWorkflowInput as T, type RoadmapWorkflowSummary as U, generateRoadmapWorkflow as V, executeSingleArtifactStep as W, generateSingleArtifactWorkflow as X, type SingleArtifactRequest as a, type SingleArtifactResult as b, generateSingleArtifact as c, generateMasterLessonStep as d, type RepairMasterLessonStepInput as e, generateActivityStep as f, getArtifactMetadata as g, generateCodeLabStep as h, generateSelfLabStep as i, judgeMasterLessonStep as j, generateDiagnosticQuizStep as k, generateSlidesStep as l, generateHandoutStep as m, generateWorksheetStep as n, generateTeacherGuideStep as o, generateExtensionStep as p, type JudgeSatelliteStepInput as q, repairMasterLessonStep as r, judgeSatelliteStep as s, type SaveMilestoneArtifactsInput as t, type SavedMilestoneResult as u, saveMilestoneToWorkspaceStep as v, publishToGitStep as w, publishToSupabaseStep as x, type CurriculumArtifactType as y, type GateSettings as z };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from './schemas/index.js';
|
|
2
2
|
import { M as ModelResolutionOptions } from './provider-factory-DH3udYlN.js';
|
|
3
3
|
import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from './supabasePublisher-C627qXFT.js';
|
|
4
|
+
import * as workflow from 'workflow';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import { F as FrameworkPack, m as CoverageGateReport } from './standardsCoverageGate-BWAkXY76.js';
|
|
6
7
|
|
|
@@ -26,6 +27,28 @@ interface SingleArtifactRequest {
|
|
|
26
27
|
lessonPlan?: string;
|
|
27
28
|
handout?: string;
|
|
28
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Media Ledger policy (nếu có): agent chèn placeholder [IMAGE: slug], Curator duyệt,
|
|
32
|
+
* Fulfiller thực thi (search Pexels / gen AI). Không truyền → không planning ảnh.
|
|
33
|
+
*/
|
|
34
|
+
mediaPolicy?: {
|
|
35
|
+
maxGenImagesPerArtifact: number;
|
|
36
|
+
autoFulfill?: boolean;
|
|
37
|
+
preferredProvider?: 'openai' | 'gemini';
|
|
38
|
+
mode?: 'search_only' | 'gen_only' | 'auto';
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Nghiên cứu nền (từ research-kit harvest hoặc preliminary research) — bối cảnh
|
|
42
|
+
* fact-grounded để giảm outdate/hallucination khi sinh artifact standalone.
|
|
43
|
+
*/
|
|
44
|
+
researchContext?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Gate settings thô (vd gateModes từ project.config.json của Composer —
|
|
47
|
+
* scratch dùng config của chính nó). Kit tự chuẩn hoá; thiếu key = OFF
|
|
48
|
+
* (không kiểm). LLM_JUDGE → judge sau khi sinh + repair 1 vòng, fail-closed.
|
|
49
|
+
* HITL → chờ human duyệt (caller xử lý pause/resume).
|
|
50
|
+
*/
|
|
51
|
+
gateSettings?: unknown;
|
|
29
52
|
options?: {
|
|
30
53
|
model?: string;
|
|
31
54
|
temperature?: number;
|
|
@@ -45,6 +68,11 @@ interface SingleArtifactResult {
|
|
|
45
68
|
content: string;
|
|
46
69
|
persona: string;
|
|
47
70
|
thought?: string;
|
|
71
|
+
/** Gate outcome: HITL đang chờ người duyệt; judge_needs_revision → bị từ chối sau repair; judge_error → fail-closed. */
|
|
72
|
+
pausedForReview?: boolean;
|
|
73
|
+
gateStatus?: 'awaiting_approval' | 'judge_needs_revision' | 'judge_error';
|
|
74
|
+
judgeScore?: number;
|
|
75
|
+
judgeCritique?: string;
|
|
48
76
|
}
|
|
49
77
|
/**
|
|
50
78
|
* Maps artifact type to default canonical filename and responsible agent persona
|
|
@@ -75,7 +103,12 @@ type CurriculumGateMode = 'OFF' | 'LLM_JUDGE' | 'HITL';
|
|
|
75
103
|
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';
|
|
76
104
|
type GateSettings = Partial<Record<CurriculumArtifactType, CurriculumGateMode>>;
|
|
77
105
|
type ResolvedGateSettings = Readonly<Record<CurriculumArtifactType, CurriculumGateMode>>;
|
|
78
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* Mặc định: KHÔNG KIỂM (all-OFF) — triết lý "config là nguồn duy nhất".
|
|
108
|
+
* Không gate nào được hồi sinh ngầm khi thiếu key trong project.config.json.
|
|
109
|
+
* Composer (apps/web) ghi gateModes đầy đủ tường minh lúc tạo project / lưu settings,
|
|
110
|
+
* và user toàn quyền đổi qua Settings cho project/scratch đang chạy.
|
|
111
|
+
*/
|
|
79
112
|
declare const DEFAULT_GATE_SETTINGS: ResolvedGateSettings;
|
|
80
113
|
/**
|
|
81
114
|
* Chuẩn hoá config thô (vd: gateModes đọc từ project.config.json của Composer) thành GateSettings.
|
|
@@ -222,6 +255,9 @@ declare function saveMilestoneToWorkspaceStep(input: SaveMilestoneArtifactsInput
|
|
|
222
255
|
declare function publishToGitStep(options: GitPublishOptions): Promise<GitPublishResult>;
|
|
223
256
|
declare function publishToSupabaseStep(options: SupabasePublishOptions): Promise<SupabasePublishResult>;
|
|
224
257
|
|
|
258
|
+
/**
|
|
259
|
+
* Payload human gửi khi duyệt / từ chối một artifact tại chốt HITL.
|
|
260
|
+
*/
|
|
225
261
|
declare const approvalPayloadSchema: z.ZodObject<{
|
|
226
262
|
approved: z.ZodBoolean;
|
|
227
263
|
reviewerName: z.ZodOptional<z.ZodString>;
|
|
@@ -240,10 +276,29 @@ declare const approvalPayloadSchema: z.ZodObject<{
|
|
|
240
276
|
}>;
|
|
241
277
|
type ApprovalPayload = z.infer<typeof approvalPayloadSchema>;
|
|
242
278
|
/**
|
|
243
|
-
* Durable
|
|
244
|
-
*
|
|
279
|
+
* Durable HITL hook (Vercel Workflow SDK ≥ 4.x).
|
|
280
|
+
*
|
|
281
|
+
* - TRONG workflow (`'use workflow'`): `const decision = await lessonApprovalHook.create({ token })`
|
|
282
|
+
* → run suspend với chi phí 0 cho tới khi payload được resume.
|
|
283
|
+
* - NGOÀI workflow (API route): `await lessonApprovalHook.resume(token, payload)`
|
|
284
|
+
* → ghi payload vào hook, SDK đánh thức run đang suspend.
|
|
285
|
+
*
|
|
286
|
+
* Token quy ước: `approval:{projectId}:{lessonId}:{artifactType}` — phía API route
|
|
287
|
+
* tái tạo được token từ dữ liệu nó có sẵn.
|
|
245
288
|
*/
|
|
246
|
-
declare const lessonApprovalHook:
|
|
289
|
+
declare const lessonApprovalHook: workflow.TypedHook<{
|
|
290
|
+
approved: boolean;
|
|
291
|
+
feedback?: string | undefined;
|
|
292
|
+
timestamp?: string | undefined;
|
|
293
|
+
reviewerName?: string | undefined;
|
|
294
|
+
}, {
|
|
295
|
+
approved: boolean;
|
|
296
|
+
feedback?: string | undefined;
|
|
297
|
+
timestamp?: string | undefined;
|
|
298
|
+
reviewerName?: string | undefined;
|
|
299
|
+
}>;
|
|
300
|
+
/** Tái tạo deterministic hook token cho một chốt duyệt artifact. */
|
|
301
|
+
declare function approvalHookToken(projectId: string, lessonId: string, artifactType: string): string;
|
|
247
302
|
|
|
248
303
|
interface ExecuteWithRateLimitOptions<T> {
|
|
249
304
|
stepName: string;
|
|
@@ -356,4 +411,4 @@ declare function executeSingleArtifactStep(request: SingleArtifactRequest): Prom
|
|
|
356
411
|
*/
|
|
357
412
|
declare function generateSingleArtifactWorkflow(request: SingleArtifactRequest): Promise<SingleArtifactResult>;
|
|
358
413
|
|
|
359
|
-
export { type ArtifactType as A, parseGateSettings as B, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, resolveGateSettings as E, gateModeFor as F, type GenerateMasterLessonStepInput as G, approvalPayloadSchema as H, type ApprovalPayload as I, type JudgeMasterLessonStepInput as J, lessonApprovalHook as K, type ExecuteWithRateLimitOptions as
|
|
414
|
+
export { type ArtifactType as A, parseGateSettings as B, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, resolveGateSettings as E, gateModeFor as F, type GenerateMasterLessonStepInput as G, approvalPayloadSchema as H, type ApprovalPayload as I, type JudgeMasterLessonStepInput as J, lessonApprovalHook as K, approvalHookToken as L, type ExecuteWithRateLimitOptions as M, withRateLimitBackoff as N, type MilestoneWorkflowInput as O, type MilestoneWorkflowResult as P, generateMilestoneWorkflow as Q, type ResolvedGateSettings as R, type ScaffoldingLevel as S, type GenerateRoadmapWorkflowInput as T, type RoadmapWorkflowSummary as U, generateRoadmapWorkflow as V, executeSingleArtifactStep as W, generateSingleArtifactWorkflow as X, type SingleArtifactRequest as a, type SingleArtifactResult as b, generateSingleArtifact as c, generateMasterLessonStep as d, type RepairMasterLessonStepInput as e, generateActivityStep as f, getArtifactMetadata as g, generateCodeLabStep as h, generateSelfLabStep as i, judgeMasterLessonStep as j, generateDiagnosticQuizStep as k, generateSlidesStep as l, generateHandoutStep as m, generateWorksheetStep as n, generateTeacherGuideStep as o, generateExtensionStep as p, type JudgeSatelliteStepInput as q, repairMasterLessonStep as r, judgeSatelliteStep as s, type SaveMilestoneArtifactsInput as t, type SavedMilestoneResult as u, saveMilestoneToWorkspaceStep as v, publishToGitStep as w, publishToSupabaseStep as x, type CurriculumArtifactType as y, type GateSettings as z };
|