/** * Error codes for Conversationalist errors (kebab-case with `error:` prefix). */ export type ConversationalistErrorCode = 'error:locked' | 'error:invalid-input' | 'error:invalid-position' | 'error:invalid-tool-reference' | 'error:duplicate-id' | 'error:not-found' | 'error:serialization' | 'error:validation' | 'error:integrity'; /** * Base error class for all Conversationalist errors. * * Provides structured error information with error codes, context data, * and cause chains for better debugging. */ export declare class ConversationalistError extends Error { /** Structured error code */ readonly code: ConversationalistErrorCode; /** Additional context data */ readonly context?: Record | undefined; /** Underlying cause (if any) */ readonly cause?: Error | undefined; constructor(code: ConversationalistErrorCode, message: string, options?: { context?: Record | undefined; cause?: Error | undefined; }); /** * Formats the error as a detailed string with code and context. */ toDetailedString(): string; } /** * Creates a lock error (ERR_LOCKED). * Thrown when a conversation is already being modified. */ export declare function createLockedError(conversationId: string): ConversationalistError; /** * Creates an invalid input error (ERR_INVALID_INPUT). * Thrown when message input data is invalid. */ export declare function createInvalidInputError(message: string, context?: Record): ConversationalistError; /** * Creates an invalid position error (ERR_INVALID_POSITION). * Thrown when positions are non-contiguous or invalid. */ export declare function createInvalidPositionError(expected: number, actual: number): ConversationalistError; /** * Creates an invalid tool reference error (ERR_INVALID_TOOL_REFERENCE). * Thrown when a tool result references a non-existent tool-use message. */ export declare function createInvalidToolReferenceError(callId: string): ConversationalistError; /** * Creates a duplicate ID error (ERR_DUPLICATE_ID). * Thrown when a conversation with the given ID already exists. */ export declare function createDuplicateIdError(id: string): ConversationalistError; /** * Creates a not found error (ERR_NOT_FOUND). * Thrown when a conversation cannot be found. */ export declare function createNotFoundError(id: string): ConversationalistError; /** * Creates a serialization error (ERR_SERIALIZATION). * Thrown when JSON serialization/deserialization fails. */ export declare function createSerializationError(message: string, cause?: Error): ConversationalistError; /** * Creates a validation error (ERR_VALIDATION). * Thrown when data validation fails (e.g., Zod schema validation). */ export declare function createValidationError(message: string, context?: Record, cause?: Error): ConversationalistError; /** * Creates an integrity error (ERR_INTEGRITY). * Thrown when conversation invariants are violated. */ export declare function createIntegrityError(message: string, context?: Record): ConversationalistError; //# sourceMappingURL=errors.d.ts.map