interface DetailedLessonBridge { lessonId: string; lessonIndex: number; title: string; proseObjective?: string; keywords: string[]; /** Physical SOT symbol ledger extracted from disk (if physical artifact exists) */ symbolLedger?: { primaryStructOrClass?: string; mainEntryFile?: string; keyVariables?: string[]; }; } interface BoundaryPeek { lessonId: string; lessonIndex: number; title: string; keywords: string[]; } interface HorizonSessionSnapshot { id: string; order?: number; title: string; prose_objective?: string; new_keywords?: string[]; prerequisite_keywords?: string[]; depth_assignments?: Array<{ node_id: string; depth: 'ulo' | 'cio' | 'sio'; }>; zpd_status?: { verdict: 'OK' | 'TOO_MANY_NEW' | 'NO_ZPD_BRIDGE'; new_concept_count?: number; known_concept_count?: number; new_keyword_count?: number; known_keyword_count?: number; issues?: string[]; }; } interface CurriculumHorizon { targetLessonId: string; targetLessonIndex: number; totalLessons: number; targetTitle: string; targetKeywords: string[]; zpdStatus?: { verdict: 'OK' | 'TOO_MANY_NEW' | 'NO_ZPD_BRIDGE'; new_concept_count?: number; known_concept_count?: number; new_keyword_count?: number; known_keyword_count?: number; issues?: string[]; }; spiralProgression?: Array<{ concept_code: string; encounter_index: number; bloom_cap: string; depth: string; }>; /** * TIER 2: Compact Mastery Set (L_1 .. L_{N-3}) * Flat deduplicated keyword and concept sets without per-lesson overhead. * Target footprint: ~50-100 tokens. */ compactMasterySet: { masteredKeywords: string[]; masteredConcepts: string[]; }; /** * TIER 1: Detailed Bridge (L_{N-2} and L_{N-1}) * Full lesson metadata and physical symbol ledger. * Target footprint: ~120-200 tokens. */ detailedBridge: DetailedLessonBridge[]; /** * BOUNDARY PEEK: L_{N+1} (and optionally L_{N+2}) * Upcoming lesson concepts used for positive-only boundary enforcement. * Target footprint: ~30-50 tokens. */ boundaryPeek: BoundaryPeek[]; } interface ExtractCurriculumHorizonOptions { plan?: any | null; frameworkMarkdown?: string | null; targetLessonId: string; storage?: any; projectId?: string; } interface HorizonValidationResult { compliant: boolean; issues: string[]; forbiddenMatches: string[]; } /** * Parses all sessions deterministically from either CurriculumPlan JSON or CURRICULUM_FRAMEWORK.md Scope & Sequence. */ declare function parseAllSessions(plan?: any | null, frameworkMarkdown?: string | null): HorizonSessionSnapshot[]; /** * Extracts the 3-Tier Curriculum Horizon for a target lesson. * Enforces fail-fast if the target lesson cannot be resolved from the SOT plan or framework. */ declare function extractCurriculumHorizon(opts: ExtractCurriculumHorizonOptions): Promise; /** * Serializes the CurriculumHorizon into a token-efficient (~200-350 tokens) * Positive-Only Markdown prompt block. */ declare function renderHorizonPromptBlock(horizon: CurriculumHorizon): string; /** * Validates whether an artifact output adheres to the Curriculum Horizon boundary * (detects accidental future concept leaks). */ declare function validateHorizonCompliance(artifactContent: string, horizon: CurriculumHorizon): HorizonValidationResult; 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'; type ScaffoldingLevel = 'foundation' | 'balanced' | 'advanced'; interface SingleArtifactRequest { artifactType: ArtifactType; topic: string; lessonId?: string; lessonTitle?: string; pedagogy?: '5e' | 'edp' | 'pbl' | 'general'; targetAge?: string; scaffoldingLevel?: ScaffoldingLevel; hardwarePlatform?: string[]; gradeLevel?: string; studentCount?: string; language?: string; slidesEngine?: 'html' | 'marp'; failClosedContext?: boolean; extraContext?: string; config?: Record; contextSot?: { framework?: string; learnerProfile?: string; lessonPlan?: string; handout?: string; exposition?: string; plan?: any; horizon?: CurriculumHorizon; }; /** * Media Ledger policy (nếu có): agent chèn placeholder [IMAGE: slug], Curator duyệt, * Fulfiller thực thi (search Pexels / gen AI). Không truyền → không planning ảnh. */ mediaPolicy?: { maxGenImagesPerArtifact: number; autoFulfill?: boolean; preferredProvider?: 'openai' | 'gemini'; mode?: 'search_only' | 'gen_only' | 'auto'; }; /** * Nghiên cứu nền (từ research-kit harvest hoặc preliminary research) — bối cảnh * fact-grounded để giảm outdate/hallucination khi sinh artifact standalone. */ researchContext?: string; /** * Gate settings thô (vd gateModes từ project.config.json của Composer — * scratch dùng config của chính nó). Kit tự chuẩn hoá; thiếu key = OFF * (không kiểm). LLM_JUDGE → judge sau khi sinh + repair 1 vòng, fail-closed. * HITL → chờ human duyệt (caller xử lý pause/resume). */ gateSettings?: unknown; options?: { model?: string; temperature?: number; openrouterKey?: string; alibabaKey?: string; deepseekKey?: string; geminiKey?: string; nvidiaKey?: string; openaiKey?: string; anthropicKey?: string; }; onChunk?: (chunk: string, type: 'content' | 'thought') => void; } interface SingleArtifactResult { artifactType: ArtifactType; filename: string; content: string; persona: string; thought?: string; /** Phase 2 & 4: Structured entity and validation outcome from registry */ entity?: unknown; validation?: any; /** Gate outcome: HITL đang chờ người duyệt; judge_needs_revision → bị từ chối sau repair; judge_error → fail-closed. */ pausedForReview?: boolean; gateStatus?: 'awaiting_approval' | 'judge_needs_revision' | 'judge_error'; judgeScore?: number; judgeCritique?: string; } /** * Maps artifact type to default canonical filename and responsible agent persona */ declare function getArtifactMetadata(type: ArtifactType, lessonId?: string, pedagogy?: string): { filename: string; persona: string; templateFile: string; }; interface PromptSlotBreakdown { slotKey: string; label: string; charCount: number; estimatedTokens: number; /** * True only when a section the slot PRIORITIZED could not ship (budget * drop/truncation). It used to be hardcoded false on every AST slot, so a * slot that kept 4,7% of an 18k framework read as complete in the prompt * inspector. An AST excerpt that selects only its priorities is NOT * truncation — see `issues`, which is the only loss signal. */ truncated: boolean; contentSnippet: string; /** Excerpt provenance: lossless AST projection or the markdown fallback builder. */ source?: 'AST' | 'MARKDOWN'; /** Size of the source document the excerpt was taken from, when known. */ originalChars?: number; /** * Why this slot is smaller than its source. `section:dropped:` / * `section:truncated:` entries mean content was LOST; other entries * (`parse:no-sections`, `empty-source`, …) are parse diagnostics. Empty list * means the excerpt is as complete as the slot's priorities intend. */ issues?: string[]; } interface AssembledPromptResult { artifactType: ArtifactType; displayTitle: string; topic: string; lessonId: string; meta: { filename: string; persona: string; templateFile: string; }; systemPrompt: string; userPrompt: string; excerpts: { lessonPlanExcerpt?: string; expositionExcerpt?: string; frameworkExcerpt?: string; handoutExcerpt?: string; }; slots: PromptSlotBreakdown[]; totalChars: number; estimatedTokens: number; templateContent: string; } /** * Pure prompt assembler: shapes the complete System & User prompt for any artifact * without calling any LLM API (zero-token dry-run / X-Ray inspection). */ declare function assembleSingleArtifactPrompt(req: SingleArtifactRequest): Promise; /** * Universal Single Artifact Generator Service for all 21 Pedagogical JTBD Artifacts */ declare function generateSingleArtifact(req: SingleArtifactRequest): Promise; /** * Gate Settings — toàn bộ logic "ai kiểm artifact nào" nằm ở đây, trong kit. * Composer chỉ gọi: resolveGateSettings(projectConfig.gateModes) rồi dùng kết quả. * * Vocabulary chuẩn (duy nhất, không có biến thể thứ hai): * 'OFF' — không kiểm * 'LLM_JUDGE' — Agent kiểm (LLM-as-Judge) * 'HITL' — Human kiểm (human-in-the-loop) * * Phạm vi phủ: SOT foundation (Learner Profile, Framework, Style Guide — duyệt trước khi * sinh content) + toàn bộ content artifacts. */ type CurriculumGateMode = 'OFF' | 'LLM_JUDGE' | 'HITL'; 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'; type GateSettings = Partial>; type ResolvedGateSettings = Readonly>; /** * Mặc định: KHÔNG KIỂM (all-OFF) — triết lý "config là nguồn duy nhất". * Không gate nào được hồi sinh ngầm khi thiếu key trong project.config.json. * Composer (apps/web) ghi gateModes đầy đủ tường minh lúc tạo project / lưu settings, * và user toàn quyền đổi qua Settings cho project/scratch đang chạy. */ declare const DEFAULT_GATE_SETTINGS: ResolvedGateSettings; /** * Chuẩn hoá config thô (vd: gateModes đọc từ project.config.json của Composer) thành GateSettings. * Key/value không nhận diện được bị bỏ qua — config sai không bao giờ làm workflow chết. */ declare function parseGateSettings(raw: unknown): GateSettings; /** * Điểm vào DUY NHẤT: raw config (hoặc đã chuẩn hoá) → settings đầy đủ cho mọi artifact type. * Key không có trong config nhận DEFAULT_GATE_SETTINGS. */ declare function resolveGateSettings(raw?: unknown): ResolvedGateSettings; /** Mode đã resolve cho 1 artifact type. */ declare function gateModeFor(resolved: ResolvedGateSettings, type: CurriculumArtifactType): CurriculumGateMode; export { type ArtifactType as A, type BoundaryPeek as B, type CurriculumGateMode as C, DEFAULT_GATE_SETTINGS as D, type ExtractCurriculumHorizonOptions as E, type GateSettings as G, type HorizonSessionSnapshot as H, type PromptSlotBreakdown as P, type ResolvedGateSettings as R, type SingleArtifactRequest as S, type SingleArtifactResult as a, type CurriculumArtifactType as b, type ScaffoldingLevel as c, getArtifactMetadata as d, type AssembledPromptResult as e, assembleSingleArtifactPrompt as f, gateModeFor as g, generateSingleArtifact as h, type DetailedLessonBridge as i, type CurriculumHorizon as j, type HorizonValidationResult as k, parseAllSessions as l, extractCurriculumHorizon as m, renderHorizonPromptBlock as n, parseGateSettings as p, resolveGateSettings as r, validateHorizonCompliance as v };