/**
 * Typed error classes for QuantRisk MCP.
 * All errors carry a machine-readable `code` matching the spec's error code enum,
 * a human-readable `message`, and an optional `upgradeUrl` for tier-related errors.
 *
 * Error codes (per Appendix C):
 *   TIER_LIMIT_EXCEEDED   — input exceeds a free-tier numeric limit
 *   TIER_REQUIRED         — tool is paid-only, user is on free tier
 *   RATE_LIMITED          — per-minute or per-day call budget exhausted
 *   INVALID_INPUT         — request fails validation (bad ticker, bad date, etc.)
 *   DATA_FETCH_FAILED     — external data source (Alpha Vantage) unavailable
 *   COMPUTATION_ERROR     — internal math/engine failure
 *   AUTH_REQUIRED         — missing or invalid API key
 */
export type QuantRiskErrorCode = "TIER_LIMIT_EXCEEDED" | "TIER_REQUIRED" | "RATE_LIMITED" | "INVALID_INPUT" | "DATA_FETCH_FAILED" | "COMPUTATION_ERROR" | "AUTH_REQUIRED";
/** Serialised shape placed inside MCP error content. */
export interface QuantRiskErrorPayload {
    error: QuantRiskErrorCode;
    message: string;
    upgrade_url?: string;
    [key: string]: unknown;
}
/** Base class — all QuantRisk errors extend this. */
export declare class QuantRiskError extends Error {
    readonly code: QuantRiskErrorCode;
    readonly upgradeUrl?: string;
    constructor(code: QuantRiskErrorCode, message: string, upgradeUrl?: string);
    /** Produces the structured payload consumed by MCP error responses (Appendix C). */
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Thrown when the user's tier does not permit a specific tool.
 *
 * @example
 *   throw new TierError("optimize_portfolio");
 */
export declare class TierError extends QuantRiskError {
    readonly tool: string;
    constructor(tool: string, upgradeUrl?: string);
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Thrown when a numeric input (positions count, path count, etc.) exceeds
 * what the user's tier allows.
 *
 * @example
 *   throw new TierLimitError("positions", 45, 20);
 */
export declare class TierLimitError extends QuantRiskError {
    readonly limitName: string;
    readonly actual: number;
    readonly limit: number;
    constructor(limitName: string, actual: number, limit: number, upgradeUrl?: string);
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Thrown when a user has exceeded their per-minute or per-day call budget.
 *
 * @example
 *   throw new RateLimitError("minute", 10, 60);
 */
export declare class RateLimitError extends QuantRiskError {
    readonly window: "minute" | "day";
    readonly limit: number;
    /** Unix timestamp (seconds) after which the budget resets. */
    readonly retryAfter: number;
    constructor(window: "minute" | "day", limit: number, retryAfter: number);
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Thrown when an external data source (Alpha Vantage) fails or is unavailable.
 *
 * @example
 *   throw new DataFetchError("AAPL", "API rate limit exceeded");
 */
export declare class DataFetchError extends QuantRiskError {
    readonly ticker?: string;
    constructor(tickerOrContext: string, detail?: string);
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Thrown when an internal computation fails (e.g., singular covariance matrix,
 * optimizer convergence failure, etc.).
 */
export declare class ComputationError extends QuantRiskError {
    readonly detail?: string;
    constructor(message: string, detail?: string);
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Thrown when the API key is missing, expired, or invalid.
 */
export declare class AuthError extends QuantRiskError {
    constructor(message?: string);
}
/**
 * Thrown when user input fails validation (bad ticker format, invalid date, etc.).
 *
 * @example
 *   throw new InvalidInputError("ticker", "aapl", "Must be uppercase 1-10 chars");
 */
export declare class InvalidInputError extends QuantRiskError {
    readonly field?: string;
    readonly received?: unknown;
    constructor(field: string, received?: unknown, detail?: string);
    toPayload(): QuantRiskErrorPayload;
}
/**
 * Normalises any thrown value into a structured MCP error response body.
 * Preserves typed payload for QuantRiskError subclasses; wraps unknown errors
 * in a generic COMPUTATION_ERROR envelope.
 */
export declare function toMcpError(err: unknown): {
    isError: true;
    content: [{
        type: "text";
        text: string;
    }];
};
//# sourceMappingURL=errors.d.ts.map