import { F as FrameworkPack, g as FrameworkStatement } from '../standardsCoverageGate-49pJq5t8.js'; 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-49pJq5t8.js'; import { SupabaseClient } from '@supabase/supabase-js'; import 'zod'; /** * Standards Context Injector — Grounding layer (tầng 1 của cơ chế bám chuẩn). * * Selects the standard statements RELEVANT to a lesson (by grade band overlap + * keyword/concept match) and renders them as a prompt context block containing * VERBATIM canonical text. The model must SEE the real standard text — prompt * labels like "operating under CSTA" are exactly the anti-pattern this replaces. * * Pure function: pack data in, markdown block out. No I/O, no LLM. */ interface StandardsSelectionInput { /** Packs adopted by the org / course (already validated + activated). */ packs: FrameworkPack[]; /** Lesson grade level or band, canonical numeric (single grade or [min,max]). */ gradeBand: [number, number] | number; /** Lesson topic text: title + concept names + keywords. Matched against statement keywords + texts. */ topicText: string; /** Optional explicit ontora concept codes for the lesson (concept_code from MilestoneInput). */ conceptCodes?: string[]; /** Hard cap on injected statements to protect the context budget. */ maxStatements?: number; } interface SelectedStatement { packId: string; statement: FrameworkStatement; score: number; matchedBy: Array<'band' | 'keyword' | 'concept' | 'text'>; } /** * Rank + select statements for a lesson. * Scoring: band overlap is a GATE (statements outside the grade are dropped), * keyword/concept/text overlap is the ranking signal. */ declare function selectStatementsForLesson(input: StandardsSelectionInput): SelectedStatement[]; /** * Render the STANDARDS CONTEXT prompt block (verbatim statements + binding rules). * Mirrors the shape of the proven CUMULATIVE CONTEXT block in lessonMasterPrompt. */ declare function buildStandardsContextBlock(selected: SelectedStatement[], opts?: { language?: string; }): string; /** * One-call convenience: packs + lesson info → context block (empty string if nothing matches). */ declare function buildStandardsContext(input: StandardsSelectionInput & { language?: string; }): { block: string; selected: SelectedStatement[]; }; /** * Standards Registry Adapter — Supabase-backed runtime plane for Framework Packs. * * Read path (generation): loadPacksForCourse() → FrameworkPack[] hydrated from * standards_frameworks + standards_statements + standards_mappings (+ overrides * applied with resolution order override > pack-embedded, 'retired' removes). * Write path (intake): importPack() persists a validated pack; adopt/deprecate * manage lifecycle. Write access uses a service-role client (intake runs * server-side); RLS governs client-side reads. */ interface StandardsRegistryConfig { supabaseUrl?: string; supabaseServiceRoleKey?: string; supabaseAnonKey?: string; client?: SupabaseClient; } interface HydratedPack extends FrameworkPack { /** DB id of the standards_frameworks row */ dbId: string; status: 'draft' | 'active' | 'deprecated'; organizationCode: string | null; } interface ImportPackResult { frameworkDbId: string; statementsInserted: number; mappingsInserted: number; } declare class StandardsRegistryAdapter { private client; constructor(config?: StandardsRegistryConfig); /** Persist a schema-validated pack as a new framework (status=draft). */ importPack(pack: FrameworkPack, opts?: { organizationCode?: string | null; createdBy?: string; originalFilePath?: string; }): Promise; /** Activate a draft framework (immutable version is now live). */ activatePack(frameworkDbId: string): Promise; deprecatePack(frameworkDbId: string): Promise; adoptPack(frameworkDbId: string, organizationCode: string, adoptedBy?: string): Promise; /** * Load all packs usable by an org: platform packs (verified, org IS NULL) + * org packs + org adoptions. Hydrated into the same FrameworkPack shape the * in-memory Phase-1 components consume (injector / coverage gate / judge). */ loadPacksForOrg(organizationCode: string | null): Promise; } /** * Deterministic STANDARD_STACK.md generator (Phase 2). * * Replaces the old anti-pattern where @researcher was asked to "cite authentic * standards" from memory (hallucinated IDs). The SOT document is now RENDERED * from the Standards Registry packs adopted for the course — verbatim statements, * canonical IDs, zero LLM involvement. */ interface StandardStackOptions { projectId: string; packs: FrameworkPack[]; /** Overall course grade band (canonical numeric) for coverage scoping. */ courseGradeBand?: [number, number]; language?: string; } declare function buildStandardStackMarkdown(opts: StandardStackOptions): string; /** Pack ids mà kit đóng gói sẵn (để UI settings hiển thị đúng danh sách khả dụng). */ declare const BUNDLED_STANDARDS_PACK_IDS: string[]; /** * Resolve danh sách pack id → FrameworkPack[] đã validate. Id không biết được bỏ qua (log warn), * config sai không bao giờ làm pipeline chết. */ declare function resolveStandardsPacks(packIds: string[] | undefined | null): FrameworkPack[]; /** * Tìm statement theo id (ví dụ "1B-AP-10" hoặc "csta-k12-2017:1B-AP-10") trong tất cả các pack kèm sẵn. */ declare function findStandardStatement(statementIdOrRef: string): { packId: string; packTitle: string; statementId: string; description: string; category?: string; gradeBand?: string; } | null; /** * Biểu thức chính quy phát hiện mã chuẩn giáo dục (CSTA PK–12 2026, CSTA K-12 2017, và ACM/IEEE CS2023). */ declare const STANDARD_REF_REGEX: RegExp; /** * Trích xuất toàn bộ các standard statement ref duy nhất từ văn bản. */ declare function extractStandardRefs(text: string | undefined | null): string[]; export { BUNDLED_STANDARDS_PACK_IDS, FrameworkPack, FrameworkStatement, type HydratedPack, type ImportPackResult, STANDARD_REF_REGEX, type SelectedStatement, type StandardStackOptions, StandardsRegistryAdapter, type StandardsRegistryConfig, type StandardsSelectionInput, buildStandardStackMarkdown, buildStandardsContext, buildStandardsContextBlock, extractStandardRefs, findStandardStatement, resolveStandardsPacks, selectStatementsForLesson };