import { I as ICurriculumStorage, a as SotDocument, L as LessonArtifactSummary, P as ProjectStatusReport, c as PipelineState, b as ArtifactLifecycleInfo } from '../types-Bgk-C4K2.cjs'; export { A as ArtifactLifecycleState, Q as QualityAuditReport, R as ReviewRecord, S as SmartResumeContext, T as TaskLifecycleState } from '../types-Bgk-C4K2.cjs'; import { SupabaseClient } from '@supabase/supabase-js'; import { M as MilestoneCurriculumBundle } from '../milestoneBundleGenerator-AZY4wI4F.cjs'; import '../schemas/index.cjs'; import 'zod'; import '../provider-factory-Bv-eIkhg.cjs'; import 'ai'; declare function computeContentHash(content: string): string; declare const STANDARD_SOT_FILES: string[]; interface FileSystemStorageOptions { baseDir?: string; } /** * Atomic single-file write (5-Whys RC-race, 2026-09-13): write to a unique * temp file in the SAME directory, then `rename` over the target. On POSIX a * rename within a filesystem is atomic — a concurrent reader sees either the * old or the new complete file, never a torn write, and two racing writers * each land a complete file (last rename wins) instead of interleaved halves. * Previously a direct writeFileSync let the double-run race truncate/clobber * companion files (deck.json / .html disappeared while the .md survived). */ declare function atomicWriteFileSync(targetPath: string, content: string): void; declare class FileSystemCurriculumAdapter implements ICurriculumStorage { private baseDir; constructor(options?: FileSystemStorageOptions); private getProjectDir; /** Ensures the resolved path stays within the project directory (prevents path traversal). */ private assertInsideProject; projectExists(projectId: string): Promise; readSotDocument(projectId: string, filename: string): Promise; listSotDocuments(projectId: string): Promise; readArtifact(projectId: string, relPathOrIdentifier: string): Promise; saveArtifact(projectId: string, relPath: string, content: string): Promise; listLessons(projectId: string): Promise; getProjectStatus(projectId: string): Promise; getPipelineState(projectId: string): Promise; savePipelineState(projectId: string, state: PipelineState): Promise; updateArtifactState(projectId: string, taskId: string, artifactType: string, update: Partial): Promise; /** Disk adapter: purge = rm the file (best-effort, mirrors cloud deleteArtifact). */ deleteArtifact(projectId: string, relPath: string): Promise; } interface SupabaseStorageConfig { supabaseUrl?: string; supabaseServiceRoleKey?: string; bucketName?: string; client?: SupabaseClient; } /** * Supabase Curriculum Adapter — Syncs Markdown artifacts to Storage & Database * Implements ICurriculumStorage for multi-tenant Cloud deployment (Vercel, Netlify, Cloudflare, etc.). */ declare class SupabaseCurriculumAdapter implements ICurriculumStorage { private client; private bucketName; constructor(config?: SupabaseStorageConfig); projectExists(projectId: string): Promise; readSotDocument(projectId: string, filename: string): Promise; listSotDocuments(projectId: string): Promise; readArtifact(projectId: string, relPathOrIdentifier: string): Promise; saveArtifact(projectId: string, relPath: string, content: string): Promise; /** * Split-brain root-cause fix (2026-09-14): purge must reach the cloud copy * too. Removes the storage object AND the indexed `curriculum_artifacts` * row (the row is what `readArtifact`-style indexed readers resolve first). * Best-effort / no-throw per the interface contract. */ deleteArtifact(projectId: string, relPath: string): Promise; listLessons(projectId: string): Promise; getProjectStatus(projectId: string): Promise; /** * Uploads a complete milestone bundle (Markdown files) to Supabase Storage */ uploadMilestoneBundle(projectSlug: string, bundle: MilestoneCurriculumBundle): Promise<{ lessonUrl?: string; activityUrl?: string; handoutUrl?: string; }>; getPipelineState(projectId: string): Promise; savePipelineState(projectId: string, state: PipelineState): Promise; updateArtifactState(projectId: string, taskId: string, artifactType: string, update: Partial): Promise; } interface StorageFactoryOptions { provider?: 'filesystem' | 'supabase' | 'auto'; fileSystemOptions?: FileSystemStorageOptions; supabaseConfig?: SupabaseStorageConfig; } /** * Creates and returns the appropriate ICurriculumStorage instance based on environment or explicit config. */ declare function createCurriculumStorage(options?: StorageFactoryOptions): ICurriculumStorage; export { ArtifactLifecycleInfo, FileSystemCurriculumAdapter, type FileSystemStorageOptions, ICurriculumStorage, LessonArtifactSummary, PipelineState, ProjectStatusReport, STANDARD_SOT_FILES, SotDocument, type StorageFactoryOptions, SupabaseCurriculumAdapter, type SupabaseStorageConfig, atomicWriteFileSync, computeContentHash, createCurriculumStorage };