/** * Coded errors for pi-search tools. * * Every tool catches thrown errors and returns a structured * `{ content, details: { error: { code, message, ... } } }` shape * so the model can branch on stable `code` strings instead of * parsing free-form error messages. * * Codes are intentionally kebab-style strings and **stable across versions**. * Adding a new code is non-breaking. Changing or removing a code is breaking. */ export type ErrorCode = "config_error" | "missing_api_key" | "validation_error" | "missing_query" | "invalid_query" | "invalid_num_results" | "invalid_max_tokens" | "provider_error" | "exa_unauthorized" | "exa_rate_limited" | "exa_timeout" | "firecrawl_auth_error" | "firecrawl_rate_limited" | "firecrawl_timeout" | "mcp_error" | "mcp_timeout" | "mcp_unavailable" | "fetch_error" | "fetch_blocked" | "fetch_timeout" | "internal_error" | "aborted"; export declare class PiSearchError extends Error { readonly code: ErrorCode; readonly details?: Record; constructor(code: ErrorCode, message: string, details?: Record); toJSON(): { code: ErrorCode; message: string; details?: Record; }; } export declare class ValidationError extends PiSearchError { constructor(message: string, details?: Record); } export declare class ConfigError extends PiSearchError { constructor(message: string, details?: Record); } export declare class ProviderError extends PiSearchError { constructor(message: string, details?: Record); } export declare class McpError extends PiSearchError { constructor(code: Extract, message: string, details?: Record); } export declare class FetchError extends PiSearchError { constructor(code: Extract, message: string, details?: Record); } /** * Map raw error → PiSearchError with a stable code. * Used as the last line of defense in tool execute() handlers. */ export declare function toPiSearchError(error: unknown): PiSearchError; /** * Build the standard error result envelope. * Mirrors pi-exa-search's `buildErrorResult` for consistency. */ export declare function buildErrorResult(error: PiSearchError): { content: Array<{ type: "text"; text: string; }>; details: { error: ReturnType; }; }; //# sourceMappingURL=errors.d.ts.map