/** * Custom error types for the Qoder Agent SDK. */ import type { SDKResultMessage } from '../protocol/messages.js'; /** JSONL 帧超过传输预算;输入与输出使用不同错误码,避免把执行端输出问题归因于用户输入。 */ export declare class FrameTooLargeError extends Error { readonly direction: 'input' | 'output'; readonly limit: number; readonly actualBytes: number; readonly source: string; /** 写入前被拒绝的用户输入 UUID;输出帧或控制帧不提供此字段。 */ readonly inputMessageUuid?: string | undefined; readonly code: 'SDK_INPUT_TOO_LARGE' | 'SDK_OUTPUT_TOO_LARGE'; constructor(direction: 'input' | 'output', limit: number, actualBytes: number, source: string, /** 写入前被拒绝的用户输入 UUID;输出帧或控制帧不提供此字段。 */ inputMessageUuid?: string | undefined); } /** CLI 在初始化完成前返回失败结果时抛出,保留原始提示、错误码和结果。 */ export declare class QoderCliInitializationError extends Error { readonly code: number | string | undefined; readonly result: SDKResultMessage; constructor(result: SDKResultMessage); } /** * Thrown when an operation is aborted, typically via an AbortSignal. * Mirrors the built-in DOMException AbortError semantics. */ export declare class AbortError extends Error { constructor(message?: string); } /** * Thrown when the CLI's wire protocol version is incompatible with the * version this SDK was built against (cross-major mismatch). * * The major version of `WIRE_PROTOCOL_VERSION` (defined in `src/protocol/version.ts`) * is the compatibility boundary: any breaking change to a wire field * (rename / removal / type semantics) forces a major bump. SDK builds * against a specific major and refuses to communicate with CLIs that * announce a different one. */ /** * Thrown when the resolveModel callback does not return within * the configured `resolveModelTimeoutMs` window. The SDK does NOT * silently fall back — callers must handle this error (retry with a * fixed model, surface to the user, etc.). */ export declare class ModelPolicyTimeoutError extends Error { readonly timeoutMs: number; constructor(timeoutMs: number); } export declare class ProtocolVersionMismatchError extends Error { readonly cliProtocolVersion: string; readonly sdkProtocolVersion: string; constructor(cliProtocolVersion: string, sdkProtocolVersion: string); } /** * Thrown when an SDK operation requires a protocol capability that the * running qodercli process did not advertise in its system/init message. */ export declare class UnsupportedCliCapabilityError extends Error { readonly capability: string; constructor(capability: string); } /** Stable code for an outbound control request whose local timeout elapsed. */ export declare const CONTROL_REQUEST_TIMEOUT_CODE = "CONTROL_REQUEST_TIMEOUT"; /** * Thrown when the runtime rejects an SDK control request. * * `retryable` is true only when the runtime guarantees that retrying the * original control operation will not duplicate an operation already applied * by the Worker. */ export declare class ControlRequestError extends Error { readonly requestId: string; readonly code: string | undefined; readonly retryable: boolean; readonly details: Record | undefined; constructor(options: { requestId: string; message: string; code?: string; retryable?: boolean; details?: Record; }); }