/**
 * Result Type for Error Handling
 *
 * A lightweight Result type for explicit error handling without exceptions.
 * Provides type-safe error propagation and composition.
 */
/**
 * Represents either a successful value or an error
 */
export type Result<T, E = Error> = {
    readonly ok: true;
    readonly value: T;
} | {
    readonly ok: false;
    readonly error: E;
};
/**
 * Create a successful Result
 */
export declare function Ok<T>(value: T): Result<T, never>;
/**
 * Create a failed Result
 */
export declare function Err<E>(error: E): Result<never, E>;
/**
 * Check if a Result is Ok
 */
export declare function isOk<T, E>(result: Result<T, E>): result is {
    ok: true;
    value: T;
};
/**
 * Check if a Result is Err
 */
export declare function isErr<T, E>(result: Result<T, E>): result is {
    ok: false;
    error: E;
};
/**
 * Wrap a Promise in a Result, catching any thrown errors
 */
export declare function fromPromise<T, E = Error>(promise: Promise<T>, mapError?: (e: unknown) => E): Promise<Result<T, E>>;
/**
 * Wrap a synchronous function in a Result, catching any thrown errors
 */
export declare function fromTry<T, E = Error>(fn: () => T, mapError?: (e: unknown) => E): Result<T, E>;
/**
 * Map over a successful Result value
 */
export declare function map<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
/**
 * Map over a failed Result error
 */
export declare function mapErr<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
/**
 * Chain Results together (flatMap)
 */
export declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
/**
 * Unwrap a Result, throwing if it's an error
 */
export declare function unwrap<T, E>(result: Result<T, E>): T;
/**
 * Unwrap a Result with a default value
 */
export declare function unwrapOr<T, E>(result: Result<T, E>, defaultValue: T): T;
/**
 * Unwrap a Result with a lazy default value
 */
export declare function unwrapOrElse<T, E>(result: Result<T, E>, fn: (error: E) => T): T;
/**
 * Match on a Result, providing handlers for both cases
 */
export declare function match<T, E, U>(result: Result<T, E>, handlers: {
    ok: (value: T) => U;
    err: (error: E) => U;
}): U;
/**
 * Combine multiple Results into a single Result containing an array
 * Returns the first error encountered, or Ok with all values
 */
export declare function all<T, E>(results: Result<T, E>[]): Result<T[], E>;
/**
 * Base class for typed errors with context
 */
export declare class HypenError extends Error {
    readonly code: string;
    readonly context?: Record<string, unknown>;
    readonly cause?: Error;
    constructor(code: string, message: string, options?: {
        context?: Record<string, unknown>;
        cause?: Error;
    });
}
/**
 * Error thrown when an action handler fails
 */
export declare class ActionError extends HypenError {
    readonly actionName: string;
    constructor(actionName: string, cause?: unknown);
}
/**
 * Error thrown when a connection fails
 */
export declare class ConnectionError extends HypenError {
    readonly url: string;
    readonly attempt?: number;
    constructor(url: string, cause?: unknown, attempt?: number);
}
/**
 * Error thrown when state operations fail
 */
export declare class StateError extends HypenError {
    readonly path?: string;
    constructor(message: string, path?: string, cause?: unknown);
}
/**
 * Error thrown when parsing Hypen DSL source fails
 */
export declare class ParseError extends HypenError {
    readonly source?: string;
    constructor(message: string, source?: string, cause?: unknown);
}
/**
 * Error thrown when rendering fails
 */
export declare class RenderError extends HypenError {
    constructor(message: string, cause?: unknown);
}
/**
 * Classify a WASM engine error string into the appropriate HypenError subclass.
 * The engine returns JsValue error strings with known prefixes.
 */
export declare function classifyEngineError(err: unknown): HypenError;
