import { MilestoneInput, LessonPlan, CurriculumQualityReport, ActivityLab, CodeLab, SelfLab, DiagnosticQuiz, SlideDeck, Handout, Worksheet, TeacherGuide, Extension, ProjectRoadmap } from '../schemas/index.js'; import { M as ModelResolutionOptions } from '../provider-factory-Bv-eIkhg.js'; import { G as GitPublishOptions, a as GitPublishResult, S as SupabasePublishOptions, b as SupabasePublishResult } from '../supabasePublisher-C627qXFT.js'; import { S as SingleArtifactRequest, a as SingleArtifactResult } from '../gateSettings-CKYr5CyX.js'; 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-CKYr5CyX.js'; import * as workflow from 'workflow'; import { z } from 'zod'; import { F as FrameworkPack, C as CoverageGateReport } from '../standardsCoverageGate-49pJq5t8.js'; import 'ai'; interface GenerateMasterLessonStepInput { milestone: MilestoneInput; language: string; topic?: string; targetAudience?: string; contextContinuity?: string; /** Pre-rendered STANDARDS CONTEXT block (verbatim standard statements). */ standardsContext?: string; modelOptions?: ModelResolutionOptions; } declare function generateMasterLessonStep(input: GenerateMasterLessonStepInput): Promise; interface JudgeMasterLessonStepInput { lessonId: string; lesson: LessonPlan; language: string; targetObjectives: Array<{ code: string; description: string; bloomLevel: string; }>; /** Verbatim standard statements (canonical ID -> text) for the Standards Alignment judge dimension. */ standardStatements?: Record; modelOptions?: ModelResolutionOptions; } declare function judgeMasterLessonStep(input: JudgeMasterLessonStepInput): Promise; interface RepairMasterLessonStepInput { milestone: MilestoneInput; language: string; topic?: string; targetAudience?: string; auditReport: CurriculumQualityReport; /** Pre-rendered STANDARDS CONTEXT block — kept across repair so grounding is never lost. */ standardsContext?: string; modelOptions?: ModelResolutionOptions; } declare function repairMasterLessonStep(input: RepairMasterLessonStepInput): Promise; declare function generateActivityStep(options: { lesson: LessonPlan; language: string; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateCodeLabStep(options: { lesson: LessonPlan; activity: ActivityLab; language: string; targetTechStack?: string[]; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateSelfLabStep(options: { milestone: MilestoneInput; language: string; targetTechStack?: string[]; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateDiagnosticQuizStep(options: { milestone: MilestoneInput; language: string; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateSlidesStep(options: { lesson: LessonPlan; language: string; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateHandoutStep(options: { lesson: LessonPlan; language: string; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateWorksheetStep(options: { lesson: LessonPlan; language: string; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateTeacherGuideStep(options: { lesson: LessonPlan; activity: ActivityLab; language: string; modelOptions?: ModelResolutionOptions; }): Promise; declare function generateExtensionStep(options: { lesson: LessonPlan; activity: ActivityLab; language: string; modelOptions?: ModelResolutionOptions; }): Promise; interface JudgeSatelliteStepInput { artifactType: string; artifactId: string; artifact: unknown; language: string; targetObjectives: Array<{ code: string; description: string; bloomLevel: string; }>; standardStatements?: Record; modelOptions?: ModelResolutionOptions; } /** * Gate step for satellite artifacts (LLM_JUDGE mode). * Judges any artifact JSON against the same 6-dimension rubric; returns the report. * The workflow decides what to do with the verdict (log / block / store) — gate config stays the single source of truth. */ declare function judgeSatelliteStep(input: JudgeSatelliteStepInput): Promise; interface SaveMilestoneArtifactsInput { jobId: string; milestoneSlug: string; lesson: LessonPlan; activity?: ActivityLab; codeLab?: CodeLab; selfLab?: SelfLab; quiz?: DiagnosticQuiz; slides?: SlideDeck; handout?: Handout; worksheet?: Worksheet; teacherGuide?: TeacherGuide; extension?: Extension; cheatSheetMarkdown?: string; baseWorkspaceDir?: string; } interface SavedMilestoneResult { milestoneSlug: string; savedFiles: string[]; } declare function saveMilestoneToWorkspaceStep(input: SaveMilestoneArtifactsInput): Promise; declare function publishToGitStep(options: GitPublishOptions): Promise; declare function publishToSupabaseStep(options: SupabasePublishOptions): Promise; /** * Payload human gửi khi duyệt / từ chối một artifact tại chốt HITL. */ declare const approvalPayloadSchema: z.ZodObject<{ approved: z.ZodBoolean; reviewerName: z.ZodOptional; feedback: z.ZodOptional; timestamp: z.ZodOptional; }, "strip", z.ZodTypeAny, { approved: boolean; timestamp?: string | undefined; feedback?: string | undefined; reviewerName?: string | undefined; }, { approved: boolean; timestamp?: string | undefined; feedback?: string | undefined; reviewerName?: string | undefined; }>; type ApprovalPayload = z.infer; /** * Durable HITL hook (Vercel Workflow SDK ≥ 4.x). * * - TRONG workflow (`'use workflow'`): `const decision = await lessonApprovalHook.create({ token })` * → run suspend với chi phí 0 cho tới khi payload được resume. * - NGOÀI workflow (API route): `await lessonApprovalHook.resume(token, payload)` * → ghi payload vào hook, SDK đánh thức run đang suspend. * * Token quy ước: `approval:{projectId}:{lessonId}:{artifactType}` — phía API route * tái tạo được token từ dữ liệu nó có sẵn. */ declare const lessonApprovalHook: workflow.TypedHook<{ approved: boolean; timestamp?: string | undefined; feedback?: string | undefined; reviewerName?: string | undefined; }, { approved: boolean; timestamp?: string | undefined; feedback?: string | undefined; reviewerName?: string | undefined; }>; /** Tái tạo deterministic hook token cho một chốt duyệt artifact. */ declare function approvalHookToken(projectId: string, lessonId: string, artifactType: string): string; interface ExecuteWithRateLimitOptions { stepName: string; fn: () => Promise; maxAttempts?: number; } /** * Wraps async LLM functions to automatically catch 429/503/transient network errors * and throw a durable RetryableError with exponential backoff for Vercel Workflow runtime. */ declare function withRateLimitBackoff(options: ExecuteWithRateLimitOptions): Promise; interface MilestoneWorkflowInput { jobId: string; milestone: MilestoneInput; language?: string; topic?: string; targetAudience?: string; techStack?: string[]; bundleTier?: 'minimum' | 'full'; baseWorkspaceDir?: string; modelOptions?: ModelResolutionOptions; /** Adopted Framework Packs (hydrated from the Standards Registry) for standards-grounded generation. */ standardsPacks?: FrameworkPack[]; /** Hard-block the milestone when standards coverage FAILs (default: true when packs provided). */ enforceStandardsCoverage?: boolean; /** Gate Settings thô (vd: gateModes từ project.config.json) — kit tự chuẩn hoá. */ gateSettings?: unknown; } interface MilestoneWorkflowResult { milestoneId: string; milestoneSlug: string; status: 'SUCCESS' | 'FAILED'; savedResult: SavedMilestoneResult; judgeReport?: CurriculumQualityReport; /** Per-artifact-type judge reports for satellites (Gate mode LLM_JUDGE only). */ satelliteJudgeReports?: Record; /** The resolved gate settings actually applied in this run (for traceability). */ gatesResolved?: Record; /** Set when a Gate (e.g. HITL rejection) BLOCKED downstream production. */ gateBlocked?: { artifactType: string; reason: 'HITL_REJECTED' | 'HITL_REJECTED_V2'; feedback?: string; }; standardsCoverage?: CoverageGateReport; artifacts: { lesson: LessonPlan; activity?: ActivityLab; codeLab?: CodeLab; selfLab?: SelfLab; quiz?: DiagnosticQuiz; slides?: SlideDeck; handout?: Handout; worksheet?: Worksheet; teacherGuide?: TeacherGuide; extension?: Extension; }; } /** * Child Workflow: Executes fine-grained durable generation for a single Milestone. * Uses Step-level memoization, automatic LLM retries, and parallel satellite generation. */ declare function generateMilestoneWorkflow(input: MilestoneWorkflowInput): Promise; interface GenerateRoadmapWorkflowInput { jobId?: string; roadmap: ProjectRoadmap; language?: string; bundleTier?: 'minimum' | 'full'; batchSize?: number; /** Gate Settings thô (vd: gateModes từ project.config.json) — kit tự chuẩn hoá. */ gateSettings?: unknown; baseWorkspaceDir?: string; gitPublishOptions?: Omit; supabasePublishOptions?: Omit; modelOptions?: ModelResolutionOptions; } interface RoadmapWorkflowSummary { jobId: string; courseTitle: string; topic: string; language: string; totalMilestones: number; successfulMilestones: number; failedMilestones: number; results: Array<{ milestoneId: string; status: 'FULFILLED' | 'REJECTED'; result?: MilestoneWorkflowResult; error?: string; }>; gitPublishResult?: GitPublishResult; supabasePublishResult?: SupabasePublishResult; workspaceDir: string; } /** * Parent Workflow: Orchestrates durable generation of an entire Curriculum Roadmap. * Implements Batching (Pattern 1), Failure Isolation, and Dual-Target Publishing (Git + Supabase). */ declare function generateRoadmapWorkflow(input: GenerateRoadmapWorkflowInput): Promise; /** * Step-level durable execution for generating a single standalone artifact. */ declare function executeSingleArtifactStep(request: SingleArtifactRequest): Promise; /** * Workflow for on-demand single artifact generation. * Supports Vercel Workflow durable execution, step memoization, and automatic retry. */ declare function generateSingleArtifactWorkflow(request: SingleArtifactRequest): Promise; 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 };