import type { Base64, InterruptHandler } from "./etc/types";
import { HakoRuntime } from "./host/runtime";
/**
 * Generic fetch-like function type
 *
 * @template TOptions - Type for fetch options
 * @template TResponse - Type for fetch response
 * @param url - URL to fetch
 * @param options - Optional fetch options
 * @returns Response or promise of response
 */
type FetchLike<TOptions, TResponse> = (url: string, options?: TOptions) => TResponse | PromiseLike<TResponse>;
/**
 * Standard I/O interface for redirecting stdout and stderr
 */
type StandardIO = {
    /**
     * Function to handle stdout output
     * @param lines - Output content as string or Uint8Array
     */
    stdout: (lines: string | Uint8Array) => void;
    /**
     * Function to handle stderr output
     * @param lines - Error content as string or Uint8Array
     */
    stderr: (lines: string | Uint8Array) => void;
};
/**
 * Configuration options for initializing a Hako runtime
 *
 * @template TOptions - Type for fetch options
 * @template TResponse - Type for fetch response
 */
export interface HakoOptions<TOptions, TResponse> {
    wasm?: {
        /** Command line arguments to pass to the WASI environment */
        args?: string[];
        /** Environment variables to set in the WASI environment */
        env?: Record<string, string>;
        /** File system paths to pre-open in the WASI environment */
        preopens?: Record<string, string>;
        /** Standard I/O configuration for redirecting stdout and stderr */
        io?: StandardIO;
        /** Memory configuration for the WebAssembly instance */
        memory?: {
            /** Initial memory size in bytes */
            initial?: number;
            /** Maximum memory size in bytes */
            maximum?: number;
            /** Bring Your Own Memory - use an existing WebAssembly memory instance */
            byom?: WebAssembly.Memory;
        };
    };
    runtime?: {
        /** Memory limit for the runtime */
        memoryLimit?: number;
        /** Handler for interrupting execution */
        interruptHandler?: InterruptHandler;
    };
    loader: {
        /** WebAssembly binary as a buffer source */
        binary?: BufferSource;
        /** Fetch function for loading the WebAssembly module */
        fetch?: FetchLike<TOptions, TResponse>;
        /** Source URL for fetching the WebAssembly module */
        src?: string;
    };
}
/**
 * Initializes Hako and creates a runtime with the provided options
 *
 * @template TOptions - Type for fetch options
 * @template TResponse - Type for fetch response
 * @param options - Configuration options for initializing the runtime
 * @returns A promise that resolves to a Hako runtime instance
 * @throws {HakoError} If no WebAssembly binary is provided or if runtime creation fails
 */
export declare function createHakoRuntime<TOptions, TResponse>(options: HakoOptions<TOptions, TResponse>): Promise<HakoRuntime>;
/**
 * Decodes a Base64-encoded WebAssembly module and validates its header
 *
 * @param encoded - Base64-encoded WebAssembly module
 * @returns Decoded WebAssembly module as Uint8Array
 * @throws {HakoError} If the buffer is too small or if the WebAssembly module is invalid or has an unsupported version
 */
export declare const decodeVariant: (encoded: Base64) => Uint8Array;
export { default as HAKO_PROD } from "./variants/hako.g";
export { default as HAKO_DEBUG } from "./variants/hako-debug.g";
//# sourceMappingURL=index.d.ts.map