/** * Typed Error Classes for Network-AI * * Provides specific error types so consumers can catch and handle * different failure modes independently (e.g., retry on rate limit, * re-authenticate on token expiry, alert on namespace violation). * * All errors extend NetworkAIError, which extends Error. * * @module Errors * @version 1.0.0 * @license MIT */ /** * Base error class for all Network-AI errors. * Every error includes a machine-readable `code` and optional `details`. * * @example * ```typescript * try { * blackboard.write('key', value, 'agent'); * } catch (err) { * if (err instanceof NetworkAIError) { * console.log(err.code); // e.g., 'IDENTITY_VERIFICATION_FAILED' * console.log(err.details); // { agentId: 'agent' } * } * } * ``` */ export declare class NetworkAIError extends Error { /** Machine-readable error code */ readonly code: string; /** Additional structured context */ readonly details?: Record; constructor(message: string, code: string, details?: Record); } /** * Thrown when an agent fails identity verification on blackboard write. */ export declare class IdentityVerificationError extends NetworkAIError { constructor(agentId: string); } /** * Thrown when an agent tries to write to a namespace it doesn't have access to. */ export declare class NamespaceViolationError extends NetworkAIError { constructor(agentId: string, key: string); } /** * Thrown when a value fails size or structure validation before write. */ export declare class ValidationError extends NetworkAIError { constructor(reason: string); } /** * Thrown when a file-system lock cannot be acquired within the timeout. */ export declare class LockAcquisitionError extends NetworkAIError { constructor(operation: string); } /** * Thrown when a conflict is detected during the atomic commit workflow. */ export declare class ConflictError extends NetworkAIError { constructor(key: string, expectedHash: string | null, actualHash: string | null); } /** * Thrown when an adapter is already registered under the same name. */ export declare class AdapterAlreadyRegisteredError extends NetworkAIError { constructor(adapterName: string); } /** * Thrown when referencing an adapter name that isn't in the registry. */ export declare class AdapterNotFoundError extends NetworkAIError { constructor(adapterName: string); } /** * Thrown when calling executeAgent on an adapter before it has been initialized. */ export declare class AdapterNotInitializedError extends NetworkAIError { constructor(adapterName: string); } /** * Thrown when too many parallel agents are requested. */ export declare class ParallelLimitError extends NetworkAIError { constructor(requested: number, maximum: number); } /** * Thrown when an operation exceeds its timeout. */ export declare class TimeoutError extends NetworkAIError { constructor(timeoutMs: number); } /** * Convert any error to a standardised SkillResult with `success: false`. * * For {@link NetworkAIError} subclasses the machine-readable `code` and * `details` are preserved. Unknown errors are wrapped as `INTERNAL_ERROR`. */ export declare function mapErrorToSkillResult(error: unknown): { success: false; error: { code: string; message: string; recoverable: boolean; trace?: Record; }; }; //# sourceMappingURL=errors.d.ts.map