export type BareAgentErrorOptions = { /** * - Stable error code (e.g. 'PROVIDER_ERROR'). */ code?: string | undefined; /** * - Whether the operation may be safely retried. */ retryable?: boolean | undefined; /** * - Arbitrary structured context. */ context?: Record | undefined; }; export type ProviderErrorOptions = { /** * - HTTP status from the provider. */ status?: number | undefined; /** * - Raw response body. */ body?: any; /** * - Override the status-derived retryability (for transport-class failures with no status). */ retryable?: boolean | undefined; /** * - Arbitrary structured context. */ context?: Record | undefined; }; export type HaltErrorOptions = { /** * - The bareguard rule that triggered the halt. */ rule?: string | undefined; /** * - The full bareguard decision object. */ decision?: any; /** * - Arbitrary structured context. */ context?: Record | undefined; }; /** * @typedef {object} BareAgentErrorOptions * @property {string} [code] - Stable error code (e.g. 'PROVIDER_ERROR'). * @property {boolean} [retryable] - Whether the operation may be safely retried. * @property {Record} [context] - Arbitrary structured context. */ /** * @typedef {object} ProviderErrorOptions * @property {number} [status] - HTTP status from the provider. * @property {any} [body] - Raw response body. * @property {boolean} [retryable] - Override the status-derived retryability (for transport-class failures with no status). * @property {Record} [context] - Arbitrary structured context. */ /** * @typedef {object} HaltErrorOptions * @property {string} [rule] - The bareguard rule that triggered the halt. * @property {any} [decision] - The full bareguard decision object. * @property {Record} [context] - Arbitrary structured context. */ export class BareAgentError extends Error { /** * @param {string} message * @param {BareAgentErrorOptions} [options] */ constructor(message: string, { code, retryable, context }?: BareAgentErrorOptions); code: string | undefined; retryable: boolean; context: Record; } export class ProviderError extends BareAgentError { /** * @param {string} message * @param {ProviderErrorOptions} [options] */ constructor(message: string, { status, body, retryable, context }?: ProviderErrorOptions); status: number | undefined; body: any; } export class ToolError extends BareAgentError { } export class TimeoutError extends BareAgentError { /** * @param {string} [message] * @param {BareAgentErrorOptions} [opts] */ constructor(message?: string, opts?: BareAgentErrorOptions); } export class ValidationError extends BareAgentError { } export class CircuitOpenError extends BareAgentError { /** * @param {string} [message] * @param {BareAgentErrorOptions} [opts] */ constructor(message?: string, opts?: BareAgentErrorOptions); } export class HaltError extends BareAgentError { /** * @param {string} [message] * @param {HaltErrorOptions} [options] */ constructor(message?: string, { rule, decision, context }?: HaltErrorOptions); rule: string | null; decision: any; }