/**
 * ASL (Abstract Specification Language)
 *
 * Formal TypeScript schema for deterministic full-stack app compilation.
 * This is the canonical input format for the MyContext compiler.
 *
 * ASL is LLM-generated from natural language, then validated by the Planner,
 * and finally consumed by deterministic script generators.
 */
export interface ASL {
    version: "1.0";
    project: ProjectSpec;
    entities: Record<string, EntitySpec>;
    auth?: AuthSpec;
    permissions?: PermissionSpec[];
    pages: PageSpec[];
    components?: ComponentSpec[];
    relationships?: RelationshipSpec[];
    design?: DesignSpec;
}
export interface ProjectSpec {
    name: string;
    description: string;
    framework: "nextjs";
    backend: "instantdb";
    styling?: "tailwind" | "tailwind-shadcn";
    packageManager?: "npm" | "pnpm" | "yarn" | "bun";
    typescript?: boolean;
}
export interface EntitySpec {
    name: string;
    description?: string;
    fields: FieldSpec[];
    indexes?: string[];
    timestamps?: boolean;
}
export interface FieldSpec {
    name: string;
    type: FieldType;
    required?: boolean;
    unique?: boolean;
    indexed?: boolean;
    default?: any;
    validation?: FieldValidation;
    description?: string;
}
export type FieldType = "string" | "number" | "boolean" | "date" | "json" | "ref";
export interface FieldValidation {
    min?: number;
    max?: number;
    pattern?: string;
    enum?: string[];
    custom?: string;
}
export interface RelationshipSpec {
    name: string;
    from: string;
    to: string;
    type: RelationType;
    fromField?: string;
    cascade?: {
        delete?: boolean;
        update?: boolean;
    };
}
export type RelationType = "one-to-one" | "one-to-many" | "many-to-one" | "many-to-many";
export interface AuthSpec {
    provider: "email" | "oauth-github" | "oauth-google" | "magic-link" | string | string[];
    roles: RoleSpec[];
    defaultRole?: string;
    userEntity?: string;
    features?: AuthFeature[];
}
export interface RoleSpec {
    name: string;
    description: string;
    extends?: string;
}
export type AuthFeature = "email-verification" | "password-reset" | "two-factor" | "social-login" | "magic-link";
export interface PermissionSpec {
    role: string;
    resource: string;
    actions: PermissionAction[];
    condition?: PermissionCondition;
}
export type PermissionAction = "create" | "read" | "update" | "delete" | "manage";
export interface PermissionCondition {
    type: "own" | "role" | "custom";
    field?: string;
    value?: any;
    expression?: string;
}
export interface PageSpec {
    path: string;
    name: string;
    type: PageType;
    title?: string;
    description?: string;
    public?: boolean;
    guards?: PageGuard[];
    permissions?: string[];
    layout?: LayoutSpec;
    queries?: QuerySpec[];
    mutations?: MutationSpec[];
    components?: string[];
}
export type PageType = "page" | "layout" | "route-group";
export type PageGuard = "authenticated" | "role" | "permission" | "custom";
export interface LayoutSpec {
    type: "default" | "dashboard" | "auth" | "minimal";
    sidebar?: boolean;
    header?: boolean;
    footer?: boolean;
}
export interface QuerySpec {
    name: string;
    entity: string;
    type: "one" | "many";
    filters?: FilterSpec[];
    includes?: string[];
    orderBy?: OrderBySpec;
    limit?: number;
}
export interface FilterSpec {
    field: string;
    operator: FilterOperator;
    value: any;
}
export type FilterOperator = "eq" | "ne" | "gt" | "gte" | "lt" | "lte" | "in" | "contains";
export interface OrderBySpec {
    field: string;
    direction: "asc" | "desc";
}
export interface MutationSpec {
    name: string;
    entity: string;
    type: MutationType;
    validation?: string[];
}
export type MutationType = "create" | "update" | "delete";
export interface ComponentSpec {
    name: string;
    type: ComponentType;
    description?: string;
    props?: PropSpec[];
    dependencies?: string[];
    variant?: string;
    dataSource?: string;
}
export type ComponentType = "page" | "layout" | "card" | "list" | "form" | "modal" | "navigation" | "widget" | "custom";
export interface PropSpec {
    name: string;
    type: string;
    required?: boolean;
    default?: any;
    description?: string;
}
export interface DesignSpec {
    theme: "light" | "dark" | "system";
    colors?: ColorSpec;
    typography?: TypographySpec;
    spacing?: SpacingSpec;
    borderRadius?: number;
}
export interface ColorSpec {
    primary: string;
    secondary?: string;
    accent?: string;
    background?: string;
    foreground?: string;
    muted?: string;
    destructive?: string;
}
export interface TypographySpec {
    headingFont?: string;
    bodyFont?: string;
    scale?: "compact" | "normal" | "relaxed";
}
export interface SpacingSpec {
    unit?: number;
    scale?: "compact" | "normal" | "relaxed";
}
export interface ASLValidationResult {
    valid: boolean;
    errors: ASLValidationError[];
    warnings: ASLValidationWarning[];
    completeness: number;
}
export interface ASLValidationError {
    path: string;
    message: string;
    severity: "error";
    fix?: string;
}
export interface ASLValidationWarning {
    path: string;
    message: string;
    severity: "warning";
    suggestion?: string;
}
export interface Question {
    id: string;
    type: QuestionType;
    text: string;
    context?: string;
    options?: QuestionOption[];
    validation?: QuestionValidation;
    dependsOn?: string[];
    category: QuestionCategory;
}
export type QuestionType = "text" | "number" | "boolean" | "select" | "multi-select" | "entity-builder" | "field-builder";
export interface QuestionOption {
    value: string;
    label: string;
    description?: string;
}
export interface QuestionValidation {
    required?: boolean;
    minLength?: number;
    maxLength?: number;
    pattern?: string;
    custom?: (value: any) => boolean;
}
export type QuestionCategory = "project" | "entities" | "auth" | "permissions" | "pages" | "design";
export interface DiffPreview {
    summary: DiffSummary;
    files: FilePreview[];
    registries: RegistryPreview[];
    warnings?: string[];
}
export interface DiffSummary {
    totalFiles: number;
    newFiles: number;
    modifiedFiles: number;
    deletedFiles: number;
    linesAdded: number;
    linesRemoved: number;
}
export interface FilePreview {
    path: string;
    action: "create" | "modify" | "delete";
    type: "schema" | "page" | "component" | "action" | "config" | "type";
    preview?: string;
    size?: number;
}
export interface RegistryPreview {
    type: "components" | "types" | "permissions";
    added: string[];
    modified: string[];
    removed: string[];
}
/**
 * Helper to check if ASL is complete enough for generation
 */
export declare function isASLComplete(asl: Partial<ASL>): asl is ASL;
/**
 * Calculate completeness percentage
 */
export declare function calculateCompleteness(asl: Partial<ASL>): number;
/**
 * Get missing sections from ASL
 */
export declare function getMissingSections(asl: Partial<ASL>): string[];
/**
 * Validate entity references in pages
 */
export declare function validateEntityReferences(asl: Partial<ASL>): string[];
/**
 * Validate permission references
 */
export declare function validatePermissionReferences(asl: Partial<ASL>): string[];
/**
 * Represents a task in the inference decomposition tree
 */
export interface InferenceTask {
    id: string;
    description: string;
    category: QuestionCategory;
    confidence: number;
    dependencies: string[];
    autoInfer: boolean;
    needsConfirmation: boolean;
    needsUserInput: boolean;
    inference?: Partial<ASL>;
    reasoning?: string;
    completed: boolean;
    completedAt?: Date;
}
/**
 * State of the planning and inference process
 */
export interface PlannerState {
    tasks: InferenceTask[];
    completedTasks: string[];
    pendingTasks: string[];
    revealedContext: ContextRevelation[];
    confidenceScore: number;
    learningContext: LearningContext;
    checkpoints: Checkpoint[];
}
/**
 * Context revealed to user during inference
 */
export interface ContextRevelation {
    taskId: string;
    message: string;
    confidence: number;
    timestamp: Date;
    category: QuestionCategory;
}
/**
 * Session-based learning from user corrections
 */
export interface LearningContext {
    corrections: Correction[];
    preferences: Record<string, any>;
    patterns: Pattern[];
}
/**
 * User correction to an inference
 */
export interface Correction {
    taskId: string;
    inferredValue: any;
    correctedValue: any;
    reason?: string;
    timestamp: Date;
}
/**
 * Detected pattern from user behavior
 */
export interface Pattern {
    type: "terminology" | "structure" | "preference";
    description: string;
    examples: string[];
    confidence: number;
}
/**
 * Checkpoint summary before proceeding
 */
export interface Checkpoint {
    id: string;
    timestamp: Date;
    autoInferredTasks: InferenceTask[];
    summary: CheckpointSummary;
    approved: boolean;
}
/**
 * Summary of checkpoint
 */
export interface CheckpointSummary {
    entitiesCreated: string[];
    fieldsAdded: number;
    rolesCreated: string[];
    permissionsAdded: number;
    pagesCreated: string[];
    totalConfidence: number;
}
/**
 * Result of an inference operation
 */
export interface InferenceResult {
    task: InferenceTask;
    result: Partial<ASL>;
    confidence: number;
    reasoning: string;
    critique?: SelfCritique;
}
/**
 * Self-critique of an inference
 */
export interface SelfCritique {
    isValid: boolean;
    confidence: number;
    issues: CritiqueIssue[];
    suggestions: string[];
}
/**
 * Issue found during self-critique
 */
export interface CritiqueIssue {
    severity: "error" | "warning" | "info";
    message: string;
    field?: string;
    suggestion?: string;
}
//# sourceMappingURL=asl.d.ts.map