import { ParamDef, ColorDef, RendererType, SketchState, CanvasSpec, SketchDefinition, DesignLayer, LayerTransform, BlendMode, RendererSpec, ThemeDef, TabDef, SketchComponentValue, Snapshot } from '@genart-dev/format';
export * from '@genart-dev/format';
import { ResolvedComponent } from '@genart-dev/components';
export { COMPONENT_REGISTRY, ComponentCategory, ComponentEntry, RendererTarget, ResolvedComponent, resolveComponents } from '@genart-dev/components';

/** A design knowledge skill definition. */
interface SkillDefinition {
    /** Unique skill identifier (kebab-case). */
    readonly id: string;
    /** Human-readable skill name. */
    readonly name: string;
    /** Skill category. */
    readonly category: "composition" | "color" | "painting" | "illustration" | "process";
    /** Complexity level. */
    readonly complexity: "beginner" | "intermediate" | "advanced";
    /** Brief description. */
    readonly description: string;
    /** Core design theory (markdown). */
    readonly theory: string;
    /** Key principles. */
    readonly principles: readonly string[];
    /** Academic references. */
    readonly references: readonly SkillReference[];
    /** Suggested parameters for sketches using this skill. */
    readonly suggestedParameters?: readonly ParamDef[];
    /** Suggested color definitions. */
    readonly suggestedColors?: readonly ColorDef[];
    /** Renderer-specific example algorithms. */
    readonly examples?: Readonly<Partial<Record<RendererType, string>>>;
}
/** An academic reference for a skill. */
interface SkillReference {
    /** Book or paper title. */
    readonly title: string;
    /** Author name. */
    readonly author: string;
    /** Year of publication. */
    readonly year?: number;
}
/** Result of validating an algorithm string. */
interface ValidationResult {
    /** Whether the algorithm is valid. */
    readonly valid: boolean;
    /** Validation error messages, if any. */
    readonly errors: readonly string[];
}
/** Opaque compiled algorithm handle. */
type CompiledAlgorithm = unknown;
/** A runtime dependency required by a renderer. */
interface RuntimeDependency {
    /** Package or CDN name. */
    readonly name: string;
    /** Version constraint. */
    readonly version: string;
    /** CDN URL for standalone HTML export. */
    readonly cdnUrl: string;
}
/** Options for frame capture. */
interface CaptureOptions {
    /** Output format. */
    readonly format?: "png" | "jpeg" | "webp";
    /** Quality (0-1) for lossy formats. */
    readonly quality?: number;
    /** Scale multiplier. */
    readonly scale?: number;
}
/**
 * Renderer adapter — pluggable rendering engine interface.
 * Each renderer type (p5, Three.js, GLSL, Canvas 2D, SVG) implements this.
 */
interface RendererAdapter {
    /** The renderer type this adapter handles. */
    readonly type: RendererType;
    /** Human-readable renderer name. */
    readonly displayName: string;
    /** Language used for the algorithm field. */
    readonly algorithmLanguage: "javascript" | "glsl" | "typescript";
    /** Validate algorithm source without executing it. */
    validate(algorithm: string): ValidationResult;
    /** Compile an algorithm string into a runnable form.
     *  @param components — Pre-resolved component source to prepend (from resolveComponents). */
    compile(algorithm: string, components?: ResolvedComponent[]): Promise<CompiledAlgorithm>;
    /** Create a live sketch instance from compiled algorithm + state. */
    createInstance(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec): SketchInstance;
    /** Render a single frame offscreen (for capture/export). */
    renderOffscreen(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec, options?: CaptureOptions): Promise<Uint8Array | Blob>;
    /** Generate a standalone HTML page embedding the sketch. */
    generateStandaloneHTML(sketch: SketchDefinition): string;
    /** Generate an interactive HTML page with parameter controls, seed navigation, and color pickers. */
    generateInteractiveHTML(sketch: SketchDefinition): string;
    /** Return a starter algorithm template for this renderer. */
    getAlgorithmTemplate(): string;
    /** List runtime dependencies needed for standalone export. */
    getRuntimeDependencies(): RuntimeDependency[];
}
/**
 * A live sketch instance mounted in the DOM.
 * Created by RendererAdapter.createInstance().
 */
interface SketchInstance {
    /** Mount the sketch into a DOM container. */
    mount(container: HTMLElement): void;
    /** Unmount and remove from DOM. */
    unmount(): void;
    /** Update runtime state (params, colors, seed). */
    updateState(state: SketchState): void;
    /** Trigger a redraw with current state. */
    redraw(): void;
    /** Pause animation/rendering. */
    pause(): void;
    /** Resume animation/rendering. */
    resume(): void;
    /** Whether the sketch is currently animating. */
    readonly isAnimating: boolean;
    /** Capture the current frame as a data URL. */
    captureFrame(options?: CaptureOptions): Promise<string>;
    /** Capture raw ImageData from the current frame. */
    captureImageData(): Promise<ImageData>;
    /** Dispose all resources (WebGL contexts, event listeners, etc.). */
    dispose(): void;
}

/** JSON Schema (subset used for MCP tool input schemas). */
type JsonSchema = Record<string, unknown>;
/**
 * A Design Mode plugin that extends the editor with new layer types,
 * interactive tools, export formats, and MCP tool definitions.
 */
interface DesignPlugin {
    readonly id: string;
    readonly name: string;
    readonly version: string;
    readonly tier?: "free" | "pro";
    readonly description?: string;
    readonly dependencies?: readonly string[];
    readonly layerTypes: LayerTypeDefinition[];
    readonly tools: DesignToolDefinition[];
    readonly exportHandlers: ExportHandlerDefinition[];
    readonly mcpTools: McpToolDefinition[];
    initialize(context: PluginContext): Promise<void>;
    dispose(): void;
}
interface LayerTypeDefinition {
    readonly typeId: string;
    readonly displayName: string;
    readonly icon: string;
    readonly category: LayerCategory;
    readonly properties: LayerPropertySchema[];
    createDefault(): LayerProperties;
    render(properties: LayerProperties, ctx: CanvasRenderingContext2D, bounds: LayerBounds, resources: RenderResources): void;
    renderSVG?(properties: LayerProperties, bounds: LayerBounds, resources: RenderResources): string;
    validate(properties: LayerProperties): ValidationError[] | null;
    renderThumbnail?(properties: LayerProperties, ctx: CanvasRenderingContext2D, size: number): void;
    readonly propertyEditorId: string;
}
type LayerCategory = "text" | "shape" | "image" | "filter" | "adjustment" | "guide" | "draw" | "group";
interface LayerPropertySchema {
    readonly key: string;
    readonly label: string;
    readonly type: LayerPropertyType;
    readonly default: LayerPropertyValue;
    readonly group?: string;
    readonly min?: number;
    readonly max?: number;
    readonly step?: number;
    readonly options?: SelectOption[];
    readonly animatable?: boolean;
}
type LayerPropertyType = "string" | "number" | "boolean" | "color" | "point" | "size" | "font" | "select" | "path" | "image" | "gradient";
type LayerPropertyValue = string | number | boolean | PointValue | SizeValue | FontValue | PathValue | GradientValue | null;
interface PointValue {
    readonly x: number;
    readonly y: number;
}
interface SizeValue {
    readonly width: number;
    readonly height: number;
}
interface FontValue {
    readonly family: string;
    readonly weight: number;
    readonly style: "normal" | "italic";
}
interface PathValue {
    readonly points: PathPoint[];
    readonly closed: boolean;
}
interface PathPoint {
    readonly x: number;
    readonly y: number;
    readonly pressure?: number;
}
interface GradientValue {
    readonly type: "linear" | "radial";
    readonly angle?: number;
    readonly center?: PointValue;
    readonly radius?: number;
    readonly stops: GradientStop[];
}
interface GradientStop {
    readonly offset: number;
    readonly color: string;
}
interface SelectOption {
    readonly value: string;
    readonly label: string;
}
type LayerProperties = Record<string, LayerPropertyValue>;
interface LayerBounds {
    readonly x: number;
    readonly y: number;
    readonly width: number;
    readonly height: number;
    readonly rotation: number;
    readonly scaleX: number;
    readonly scaleY: number;
}
interface ValidationError {
    readonly property: string;
    readonly message: string;
}
interface DesignToolDefinition {
    readonly toolId: string;
    readonly displayName: string;
    readonly icon: string;
    readonly shortcut?: string;
    readonly section: ToolSection;
    readonly cursor: string;
    onActivate(context: ToolContext): void;
    onDeactivate(context: ToolContext): void;
    onPointerDown?(event: DesignPointerEvent, context: ToolContext): void;
    onPointerMove?(event: DesignPointerEvent, context: ToolContext): void;
    onPointerUp?(event: DesignPointerEvent, context: ToolContext): void;
    onFrame?(context: ToolContext): void;
    renderOverlay?(ctx: CanvasRenderingContext2D, context: ToolContext): void;
}
type ToolSection = "select" | "draw" | "shape" | "text" | "transform" | "utility";
interface DesignPointerEvent {
    readonly canvasX: number;
    readonly canvasY: number;
    readonly viewportX: number;
    readonly viewportY: number;
    readonly pressure: number;
    readonly shiftKey: boolean;
    readonly ctrlKey: boolean;
    readonly altKey: boolean;
    readonly metaKey: boolean;
}
interface ToolContext {
    readonly layers: LayerStackAccessor;
    readonly selection: readonly string[];
    selectLayer(layerId: string): void;
    readonly canvasWidth: number;
    readonly canvasHeight: number;
    readonly zoom: number;
    requestRedraw(): void;
    commitAction(label: string): void;
}
interface ExportHandlerDefinition {
    readonly formatId: string;
    readonly displayName: string;
    readonly extension: string;
    readonly mimeType: string;
    canExport(layers: readonly DesignLayer[]): boolean;
    readonly optionsSchema?: LayerPropertySchema[];
    export(layers: readonly DesignLayer[], baseCanvas: HTMLCanvasElement | OffscreenCanvas, options: Record<string, LayerPropertyValue>): Promise<Blob>;
}
interface McpToolDefinition {
    readonly name: string;
    readonly description: string;
    readonly inputSchema: JsonSchema;
    handler(input: Record<string, unknown>, context: McpToolContext): Promise<McpToolResult>;
}
interface McpToolContext {
    readonly layers: LayerStackAccessor;
    readonly sketchState: SketchStateAccessor;
    readonly sketch: SketchMutator;
    readonly canvasWidth: number;
    readonly canvasHeight: number;
    resolveAsset(assetId: string): Promise<Buffer | null>;
    captureComposite(format?: "png" | "jpeg"): Promise<Buffer>;
    emitChange(changeType: DesignChangeType): void;
}
interface SketchMutator {
    getSymbols(): Readonly<Record<string, unknown>>;
    setSymbols(symbols: Record<string, unknown> | undefined): void;
    getComponents(): Readonly<Record<string, unknown>>;
    setComponents(components: Record<string, unknown>): void;
    getThirdParty(): readonly Record<string, unknown>[];
    setThirdParty(notices: Record<string, unknown>[] | undefined): void;
    getRenderer(): string;
    getGenartVersion(): string;
    setGenartVersion(version: string): void;
}
type DesignChangeType = "layer-added" | "layer-removed" | "layer-updated" | "layer-reordered" | "selection-changed" | "composite-changed" | "sketch-updated";
interface McpToolResult {
    readonly content: McpToolContent[];
    readonly isError?: boolean;
}
type McpToolContent = {
    readonly type: "text";
    readonly text: string;
} | {
    readonly type: "image";
    readonly data: string;
    readonly mimeType: string;
};
/**
 * Mutable version of DesignLayer for runtime use in the layer stack.
 * Extends the format's readonly interface with writable fields.
 */
interface MutableDesignLayer {
    readonly id: string;
    readonly type: string;
    name: string;
    visible: boolean;
    locked: boolean;
    opacity: number;
    blendMode: BlendMode;
    transform: LayerTransform;
    properties: LayerProperties;
    children?: MutableDesignLayer[];
}
interface LayerStackAccessor {
    getAll(): readonly DesignLayer[];
    get(layerId: string): DesignLayer | null;
    add(layer: DesignLayer, index?: number): void;
    remove(layerId: string): boolean;
    updateProperties(layerId: string, properties: Partial<LayerProperties>): void;
    updateTransform(layerId: string, transform: Partial<LayerTransform>): void;
    updateBlend(layerId: string, blendMode?: BlendMode, opacity?: number): void;
    /** Update top-level layer fields (visible, locked, name). */
    updateMeta(layerId: string, fields: {
        visible?: boolean;
        locked?: boolean;
        name?: string;
    }): void;
    reorder(layerId: string, newIndex: number): void;
    duplicate(layerId: string): string;
    readonly count: number;
}
interface SketchStateAccessor {
    readonly seed: number;
    readonly params: Readonly<Record<string, number>>;
    readonly colorPalette: readonly string[];
    readonly canvasWidth: number;
    readonly canvasHeight: number;
    readonly rendererId: string;
}
interface PluginContext {
    registerComponent(componentId: string, component: unknown): void;
    registerAsset(assetId: string, data: Buffer | Uint8Array, mimeType: string): void;
    log: PluginLogger;
    readonly host: PluginHostInfo;
}
interface PluginLogger {
    info(message: string): void;
    warn(message: string): void;
    error(message: string): void;
}
interface PluginHostInfo {
    readonly surface: "desktop" | "vscode" | "web" | "mcp";
    readonly supportsInteractiveTools: boolean;
    readonly supportsRendering: boolean;
}
interface RenderResources {
    getFont(family: string): FontFace | null;
    getImage(assetId: string): HTMLImageElement | ImageBitmap | null;
    readonly theme: "dark" | "light";
    readonly pixelRatio: number;
}
interface PluginRegistry {
    register(plugin: DesignPlugin): Promise<void>;
    unregister(pluginId: string): void;
    get(pluginId: string): DesignPlugin | null;
    getAll(): readonly DesignPlugin[];
    getLayerTypes(): readonly LayerTypeDefinition[];
    resolveLayerType(typeId: string): LayerTypeDefinition | null;
    getMcpTools(): readonly PrefixedMcpTool[];
    getDesignTools(): readonly DesignToolDefinition[];
    getExportHandlers(): readonly ExportHandlerDefinition[];
}
interface PrefixedMcpTool {
    readonly name: string;
    readonly pluginId: string;
    readonly definition: McpToolDefinition;
}

/**
 * P5 Renderer Adapter — full implementation.
 *
 * Validates algorithms for the `sketch(p, state)` instance-mode signature,
 * compiles them into executable factories, and creates live sketch instances.
 */
declare class P5RendererAdapter implements RendererAdapter {
    readonly type: RendererType;
    readonly displayName = "p5.js";
    readonly algorithmLanguage: "javascript";
    validate(algorithm: string): ValidationResult;
    compile(algorithm: string, components?: ResolvedComponent[]): Promise<CompiledAlgorithm>;
    createInstance(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec): SketchInstance;
    renderOffscreen(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec, options?: CaptureOptions): Promise<Uint8Array | Blob>;
    generateStandaloneHTML(sketch: SketchDefinition): string;
    generateInteractiveHTML(sketch: SketchDefinition): string;
    getAlgorithmTemplate(): string;
    getRuntimeDependencies(): RuntimeDependency[];
}

/**
 * Canvas 2D Renderer Adapter — full implementation.
 *
 * Validates algorithms for the `sketch(ctx, state)` function signature,
 * compiles them into executable factories, and creates live sketch instances.
 */
declare class Canvas2DRendererAdapter implements RendererAdapter {
    readonly type: RendererType;
    readonly displayName = "Canvas 2D";
    readonly algorithmLanguage: "javascript";
    validate(algorithm: string): ValidationResult;
    compile(algorithm: string, components?: ResolvedComponent[]): Promise<CompiledAlgorithm>;
    createInstance(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec): SketchInstance;
    renderOffscreen(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec, options?: CaptureOptions): Promise<Uint8Array | Blob>;
    generateStandaloneHTML(sketch: SketchDefinition): string;
    generateInteractiveHTML(sketch: SketchDefinition): string;
    getAlgorithmTemplate(): string;
    getRuntimeDependencies(): RuntimeDependency[];
}

/**
 * Three.js Renderer Adapter — full implementation.
 *
 * Validates algorithms for the `sketch(THREE, state, container)` signature,
 * compiles them into executable factories, and creates live sketch instances.
 */
declare class ThreeRendererAdapter implements RendererAdapter {
    readonly type: RendererType;
    readonly displayName = "Three.js";
    readonly algorithmLanguage: "javascript";
    validate(algorithm: string): ValidationResult;
    compile(algorithm: string, components?: ResolvedComponent[]): Promise<CompiledAlgorithm>;
    createInstance(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec): SketchInstance;
    renderOffscreen(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec, options?: CaptureOptions): Promise<Uint8Array | Blob>;
    generateStandaloneHTML(sketch: SketchDefinition): string;
    generateInteractiveHTML(sketch: SketchDefinition): string;
    getAlgorithmTemplate(): string;
    getRuntimeDependencies(): RuntimeDependency[];
}

/**
 * Parse a hex color string to RGB floats in [0, 1] range.
 * Accepts "#rrggbb" or "rrggbb" format.
 */
declare function hexToVec3(hex: string): [number, number, number];
/**
 * GLSL Renderer Adapter — full implementation.
 *
 * Validates GLSL fragment shaders, compiles them with a fullscreen quad
 * vertex shader, and creates live sketch instances using WebGL2.
 */
declare class GLSLRendererAdapter implements RendererAdapter {
    readonly type: RendererType;
    readonly displayName = "GLSL Shader";
    readonly algorithmLanguage: "glsl";
    validate(algorithm: string): ValidationResult;
    compile(algorithm: string, components?: ResolvedComponent[]): Promise<CompiledAlgorithm>;
    createInstance(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec): SketchInstance;
    renderOffscreen(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec, options?: CaptureOptions): Promise<Uint8Array | Blob>;
    generateStandaloneHTML(sketch: SketchDefinition): string;
    generateInteractiveHTML(sketch: SketchDefinition): string;
    getAlgorithmTemplate(): string;
    getRuntimeDependencies(): RuntimeDependency[];
}

/**
 * SVG Renderer Adapter — full implementation.
 *
 * Validates algorithms for the `sketch(state)` function signature,
 * compiles them into executable factories, and creates live sketch instances.
 * SVG sketches are static — there is no animation loop.
 */
declare class SVGRendererAdapter implements RendererAdapter {
    readonly type: RendererType;
    readonly displayName = "SVG";
    readonly algorithmLanguage: "javascript";
    validate(algorithm: string): ValidationResult;
    compile(algorithm: string, components?: ResolvedComponent[]): Promise<CompiledAlgorithm>;
    createInstance(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec): SketchInstance;
    renderOffscreen(compiled: CompiledAlgorithm, state: SketchState, canvas: CanvasSpec, _options?: CaptureOptions): Promise<Uint8Array | Blob>;
    generateStandaloneHTML(sketch: SketchDefinition): string;
    generateInteractiveHTML(sketch: SketchDefinition): string;
    getAlgorithmTemplate(): string;
    getRuntimeDependencies(): RuntimeDependency[];
}

/**
 * Registry for renderer adapters. Manages registration and lookup
 * of RendererAdapter implementations by renderer type.
 */
declare class RendererRegistry {
    private readonly adapters;
    private defaultType;
    /**
     * Register a renderer adapter. Replaces any existing adapter for the same type.
     */
    register(adapter: RendererAdapter): void;
    /**
     * Resolve a renderer adapter by type.
     * If type is undefined, returns the default adapter (p5 — v1.0 compat).
     *
     * @throws Error if the type is not registered.
     */
    resolve(type?: RendererType): RendererAdapter;
    /**
     * List all registered renderer types.
     */
    list(): RendererType[];
    /**
     * Get the default renderer adapter (p5).
     */
    getDefault(): RendererAdapter;
    /**
     * Check if a renderer type is registered.
     */
    has(type: RendererType): boolean;
}
/**
 * Create a RendererRegistry pre-loaded with all 5 renderer adapters.
 * This is the standard way to get a registry instance.
 */
declare function createDefaultRegistry(): RendererRegistry;

/**
 * Registry for design knowledge skills.
 * Mirrors the RendererRegistry pattern.
 */
declare class SkillRegistry {
    private readonly skills;
    /** Register a skill definition. */
    register(skill: SkillDefinition): void;
    /** Resolve a skill by ID. Throws if not found. */
    resolve(id: string): SkillDefinition;
    /** Get a skill by ID, or undefined if not found. */
    get(id: string): SkillDefinition | undefined;
    /** List all skills, optionally filtered by category. */
    list(category?: string): SkillDefinition[];
    /** Check if a skill ID is registered. */
    has(id: string): boolean;
    /** Return unique categories across all registered skills. */
    categories(): string[];
}
/**
 * Create a skill registry pre-loaded with all built-in skills.
 */
declare function createDefaultSkillRegistry(): SkillRegistry;

declare const COMPOSITION_SKILLS: readonly SkillDefinition[];
declare const COLOR_SKILLS: readonly SkillDefinition[];

declare const PROCESS_SKILLS: readonly SkillDefinition[];

/**
 * Create a plugin registry that manages plugin lifecycle and lookup.
 * Mirrors the RendererRegistry / SkillRegistry pattern.
 */
declare function createPluginRegistry(host: PluginHostInfo): PluginRegistry;

/**
 * Create a mutable layer stack accessor.
 * Fires onChange callbacks on every mutation for UI reactivity.
 */
declare function createLayerStack(initialLayers: DesignLayer[], onChange: (changeType: DesignChangeType) => void): LayerStackAccessor;

/**
 * Composite design layers on top of the sketch output.
 *
 * 1. Draw rasterized sketch output to the output canvas (base layer).
 * 2. Iterate layers bottom-to-top.
 * 3. For each visible layer: set blend mode, opacity, apply transform,
 *    resolve layer type from registry, call render().
 * 4. Restore context state between layers.
 *
 * Guide layers (category "guide") are skipped unless `includeGuides` is true.
 */
declare function compositeDesignLayers(sketchCanvas: HTMLCanvasElement | OffscreenCanvas, layers: readonly DesignLayer[], registry: PluginRegistry, resources: RenderResources, output: CanvasRenderingContext2D, options?: {
    includeGuides?: boolean;
}): void;

/**
 * Mapping from sketch file extension to renderer algorithm language.
 * Used by `discoverProject()` to determine which file is the sketch source.
 */
declare const SKETCH_EXTENSIONS: Record<string, "javascript" | "glsl">;
/** Ordered list of sketch filenames to look for during discovery. */
declare const SKETCH_FILE_NAMES: readonly ["sketch.js", "sketch.ts", "sketch.frag"];
/** The meta sidecar filename. */
declare const META_FILE_NAME = "sketch.meta.json";
/** The compiled output filename. */
declare const OUTPUT_FILE_NAME = "sketch.genart";
/** Components directory name. */
declare const COMPONENTS_DIR_NAME = "components";
/**
 * A discovered developer project on disk.
 * Returned by `discoverProject()`.
 */
interface DevProject {
    /** Absolute path to the project directory. */
    readonly projectDir: string;
    /** Sketch source filename relative to projectDir (e.g. "sketch.js"). */
    readonly sketchFile: string;
    /** Meta sidecar filename relative to projectDir ("sketch.meta.json"). */
    readonly metaFile: string;
    /** Component filenames relative to projectDir (e.g. "components/utils.js"). */
    readonly componentFiles: readonly string[];
}
/** Options for `compileProject()`. */
interface CompileOptions {
    /** Absolute path to the project directory containing sketch.js and sketch.meta.json. */
    readonly projectDir: string;
    /** Output path for the .genart file. Defaults to `<projectDir>/sketch.genart`. */
    readonly outputPath?: string;
    /** Carry forward `state` from existing .genart output. Default: true. */
    readonly preserveState?: boolean;
    /** Carry forward `layers` from existing .genart output. Default: true. */
    readonly preserveLayers?: boolean;
}
/** Successful compilation result. */
interface CompileResult {
    /** The assembled SketchDefinition. */
    readonly sketch: SketchDefinition;
    /** Path where the .genart file was written. */
    readonly outputPath: string;
    /** Non-fatal warnings encountered during compilation. */
    readonly warnings: readonly string[];
    /** Compilation duration in milliseconds. */
    readonly duration: number;
}
/** A single compilation error with source location. */
interface CompileError {
    /** Source file path (relative to project directory). */
    readonly file: string;
    /** Line number (1-based), if available. */
    readonly line?: number;
    /** Column number (1-based), if available. */
    readonly column?: number;
    /** Error message. */
    readonly message: string;
}
/** Thrown when compilation fails. Contains one or more errors. */
declare class CompileFailure extends Error {
    readonly errors: readonly CompileError[];
    constructor(errors: readonly CompileError[]);
}
/** Options for `watchProject()`. */
interface WatchOptions {
    /** Debounce interval in milliseconds. Default: 150. */
    readonly debounce?: number;
    /** Output path for the .genart file. */
    readonly outputPath?: string;
    /** Carry forward `state` from existing .genart output. Default: true. */
    readonly preserveState?: boolean;
    /** Carry forward `layers` from existing .genart output. Default: true. */
    readonly preserveLayers?: boolean;
}
/** Handle returned by `watchProject()` to stop the watcher. */
interface FileWatcher {
    /** Stop watching and clean up. */
    close(): void;
}
/**
 * Parsed `sketch.meta.json` contents.
 * A subset of `SketchDefinition` fields — everything except `algorithm`
 * and inline component code.
 */
interface SketchMeta {
    readonly title: string;
    /** Auto-generated from title if absent. */
    readonly id?: string;
    readonly renderer: RendererSpec;
    readonly canvas: CanvasSpec;
    readonly parameters?: readonly ParamDef[];
    readonly colors?: readonly ColorDef[];
    readonly themes?: readonly ThemeDef[];
    readonly tabs?: readonly TabDef[];
    /** Registry component references (string version ranges). */
    readonly components?: Readonly<Record<string, SketchComponentValue>>;
    readonly philosophy?: string;
    readonly skills?: readonly string[];
    readonly agent?: string;
    readonly model?: string;
    /** Preserved from previous compilation. */
    readonly state?: SketchState;
    readonly layers?: readonly DesignLayer[];
    readonly snapshots?: readonly Snapshot[];
}

/**
 * Discover a developer project in the given directory.
 *
 * Looks for sketch source files (`sketch.js`, `sketch.ts`, `sketch.frag`)
 * and the metadata sidecar (`sketch.meta.json`).
 *
 * @param projectDir - Absolute path to the project directory.
 * @returns Discovered project structure.
 * @throws If the required files are not found.
 */
declare function discoverProject(projectDir: string): Promise<DevProject>;
/**
 * Compile a developer project directory to a `.genart` file.
 *
 * Pipeline:
 * 1. Discover project files
 * 2. Parse metadata sidecar
 * 3. Read and optionally transpile sketch source
 * 4. Validate algorithm via renderer adapter
 * 5. Read and parse local component files
 * 6. Resolve registry components
 * 7. Merge local + registry components
 * 8. Optionally carry forward state/layers from previous output
 * 9. Assemble SketchDefinition and serialize
 *
 * @param options - Compilation options.
 * @returns Compilation result with the assembled sketch and output path.
 * @throws {CompileFailure} On compilation errors.
 */
declare function compileProject(options: CompileOptions): Promise<CompileResult>;

/**
 * Eject a `.genart` file into a developer project directory.
 *
 * Creates:
 * - `sketch.js` (or `sketch.frag` for GLSL) from the algorithm field
 * - `components/<name>.js` for each inline component (with `@exports` header)
 * - `sketch.meta.json` with remaining metadata
 *
 * Registry-only components (string version ranges) are preserved in the meta
 * as-is. Inline components (with `code` + `exports`) are extracted to files.
 *
 * @param sketch - The SketchDefinition to eject.
 * @param outputDir - Directory to write the project files to.
 * @throws If the directory cannot be created or files cannot be written.
 */
declare function ejectProject(sketch: SketchDefinition, outputDir: string): Promise<void>;

/**
 * Watch a developer project directory and recompile on file changes.
 *
 * Uses Node 20+ `fs.watch` with `recursive: true` — no external dependencies.
 * Changes are debounced (default 150ms) before triggering recompilation.
 * The compiled output file (`sketch.genart`) is ignored to avoid loops.
 *
 * @param projectDir - Absolute path to the project directory.
 * @param onChange - Callback invoked with compile result or error after each recompilation.
 * @param options - Watch configuration.
 * @returns A `FileWatcher` handle to stop watching.
 */
declare function watchProject(projectDir: string, onChange: (result: CompileResult | {
    errors: readonly CompileError[];
}) => void, options?: WatchOptions): FileWatcher;

/**
 * Parse and validate a `sketch.meta.json` object.
 *
 * Required fields: `title`, `renderer`.
 * Defaults: `canvas` → square-1200, `parameters` → [], `colors` → [].
 *
 * @param json - Parsed JSON value from `sketch.meta.json`.
 * @returns Validated `SketchMeta`.
 * @throws On validation failure.
 */
declare function parseSketchMeta(json: unknown): SketchMeta;

/**
 * Parses the `// @exports: fn1, fn2` leading comment from component source files.
 *
 * The comment must appear within the first 10 lines of the file. Supports
 * both single-line (`// @exports:`) and block (`/* @exports: *​/`) syntax.
 *
 * @param source - Component source code.
 * @returns Array of exported names, or `null` if no @exports comment is found.
 * @throws If @exports comment is found but contains invalid identifiers.
 */
declare function parseExportsComment(source: string): string[] | null;

export { COLOR_SKILLS, COMPONENTS_DIR_NAME, COMPOSITION_SKILLS, Canvas2DRendererAdapter, type CaptureOptions, type CompileError, CompileFailure, type CompileOptions, type CompileResult, type CompiledAlgorithm, type DesignChangeType, type DesignPlugin, type DesignPointerEvent, type DesignToolDefinition, type DevProject, type ExportHandlerDefinition, type FileWatcher, type FontValue, GLSLRendererAdapter, type GradientStop, type GradientValue, type JsonSchema, type LayerBounds, type LayerCategory, type LayerProperties, type LayerPropertySchema, type LayerPropertyType, type LayerPropertyValue, type LayerStackAccessor, type LayerTypeDefinition, META_FILE_NAME, type McpToolContent, type McpToolContext, type McpToolDefinition, type McpToolResult, type MutableDesignLayer, OUTPUT_FILE_NAME, P5RendererAdapter, PROCESS_SKILLS, type PathPoint, type PathValue, type PluginContext, type PluginHostInfo, type PluginLogger, type PluginRegistry, type PointValue, type PrefixedMcpTool, type RenderResources, type RendererAdapter, RendererRegistry, type RuntimeDependency, SKETCH_EXTENSIONS, SKETCH_FILE_NAMES, SVGRendererAdapter, type SelectOption, type SizeValue, type SketchInstance, type SketchMeta, type SketchMutator, type SketchStateAccessor, type SkillDefinition, type SkillReference, SkillRegistry, ThreeRendererAdapter, type ToolContext, type ToolSection, type ValidationError, type ValidationResult, type WatchOptions, compileProject, compositeDesignLayers, createDefaultRegistry, createDefaultSkillRegistry, createLayerStack, createPluginRegistry, discoverProject, ejectProject, hexToVec3, parseExportsComment, parseSketchMeta, watchProject };
