import type { ErrorCode, ErrorSeverity, ToolResponse } from '../response.js'; /** * ErrorBuilder — Fluent API for Self-Healing Errors * * Provides a chaining interface to construct structured tool errors * with recovery suggestions, available actions, and metadata. * * Designed to be used via `f.error()` in a tool handler. * * @example * ```typescript * return f.error('NOT_FOUND', `Project "${id}" missing`) * .suggest('Check the ID and try again') * .actions('projects.list') * .critical(); * ``` */ export declare class ErrorBuilder { private _message; private _code; private _suggestion?; private _actions; private _severity; private _details; private _retryAfter?; /** @internal Cached build result — invalidated by any setter */ private _cached; constructor(code: ErrorCode, message: string); /** Add a recovery suggestion for the LLM agent */ suggest(suggestion: string): this; /** List tool names the agent should try instead */ actions(...names: string[]): this; /** Set error severity (default: 'error') */ severity(level: ErrorSeverity): this; /** Set severity to 'critical' (stops agent execution) */ critical(): this; /** Set severity to 'warning' (non-fatal guidance) */ warning(): this; /** Add structured metadata details about the error */ details(data: Record): this; /** Suggest a retry delay in seconds for transient errors */ retryAfter(seconds: number): this; /** * Build the final {@link ToolResponse}. * * Note: The execution pipeline also accepts the builder instance * directly and calls this method automatically. */ build(): ToolResponse; /** @internal Ensure the response is built and cached */ private _ensureBuilt; /** Implementation of ToolResponse for direct return in handlers */ get content(): readonly { readonly type: "text"; readonly text: string; }[]; get isError(): boolean | undefined; } //# sourceMappingURL=ErrorBuilder.d.ts.map