/** * FeltDB Deterministic Error Codes * * All FeltDB API responses use these semantic error codes. * Never returns empty {} or untyped errors. * * Clients must handle each code appropriately: * - CONFLICT: Retry with backoff (CAS mismatch) * - PRECONDITION_FAILED: Retry with backoff (stale causal/version precondition) * - TOO_BUSY: Retry with exponential backoff (queue full) * - INTERNAL_ERROR: Log and escalate (server error) */ /** * Semantic error codes matching HTTP status codes */ export declare enum FeltDBErrorCode { INVALID_REQUEST = "INVALID_REQUEST", UNAUTHORIZED = "UNAUTHORIZED", VERSION_CONFLICT = "VERSION_CONFLICT", SCOPE_VIOLATION = "SCOPE_VIOLATION", INVALID_CURSOR = "INVALID_CURSOR", CURSOR_SCOPE_VIOLATION = "CURSOR_SCOPE_VIOLATION", DURABILITY_FAILURE = "DURABILITY_FAILURE", RECOVERY_FAILURE = "RECOVERY_FAILURE", CONTRACT_UNSUPPORTED = "CONTRACT_UNSUPPORTED", /** 200: Request succeeded */ OK = "OK", /** 409: Version conflict; concurrent writer won; retry intelligently */ CONFLICT = "CONFLICT", /** 422: Validation or precondition failed; do not retry */ PRECONDITION_FAILED = "PRECONDITION_FAILED", /** 429: Queue depth exceeded; retry with exponential backoff */ TOO_BUSY = "TOO_BUSY", /** 500: Unrecoverable server error; audit trail available */ INTERNAL_ERROR = "INTERNAL_ERROR", AUTHENTICATION_REQUIRED = "AUTHENTICATION_REQUIRED", AUTHENTICATION_FAILED = "AUTHENTICATION_FAILED", FORBIDDEN = "FORBIDDEN", NOT_FOUND = "NOT_FOUND", VALIDATION_ERROR = "VALIDATION_ERROR", IDEMPOTENCY_CONFLICT = "IDEMPOTENCY_CONFLICT", /** Transport ended after a mutation may have reached the authority. Retry * only with the same durable transaction/idempotency identity. */ COMMIT_OUTCOME_UNKNOWN = "COMMIT_OUTCOME_UNKNOWN", QUERY_INVALID = "QUERY_INVALID", QUERY_LIMIT_EXCEEDED = "QUERY_LIMIT_EXCEEDED", WORKFLOW_NOT_FOUND = "WORKFLOW_NOT_FOUND", AGENT_NOT_FOUND = "AGENT_NOT_FOUND", CAPABILITY_NOT_FOUND = "CAPABILITY_NOT_FOUND", EXECUTION_FAILED = "EXECUTION_FAILED", SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE", AUTHORITY_SCOPE_REQUIRED = "AUTHORITY_SCOPE_REQUIRED", AUTHORITY_SCOPE_INVALID = "AUTHORITY_SCOPE_INVALID", AUTHORITY_SCOPE_MISMATCH = "AUTHORITY_SCOPE_MISMATCH" } export declare class FeltDBServiceError extends Error { readonly code: FeltDBErrorCode | string; readonly requestId?: string | undefined; readonly status?: number | undefined; constructor(message: string, code: FeltDBErrorCode | string, requestId?: string | undefined, status?: number | undefined); } /** * Error response structure that all FeltDB APIs must return */ export interface FeltDBErrorResponse { /** Semantic error code (never empty) */ code: FeltDBErrorCode | string; /** Human-readable message explaining what happened */ message: string; /** Unique request ID for debugging/auditing */ request_id: string; /** Transaction ID if applicable */ transaction_id?: string; /** HTTP status code for routing */ http_status: number; /** Recovery hint for client ("retry", "fail", "queue", etc.) */ recovery_hint?: 'retry_backoff' | 'dont_retry' | 'check_queue_depth' | 'contact_support'; } /** * Determines if a FeltDB error is retryable */ export declare function isRetryableError(code: FeltDBErrorCode | string): boolean; export type FeltDBErrorClassification = 'retryable' | 'non_retryable' | 'requires_reconciliation' | 'requires_caller_correction'; /** Stable recovery classification; callers never need to inspect messages. */ export declare function classifyError(code: FeltDBErrorCode | string): FeltDBErrorClassification; /** * Determines retry strategy based on error code */ export declare function getRetryStrategy(code: FeltDBErrorCode | string): 'exponential_backoff' | 'linear_backoff' | 'dont_retry'; //# sourceMappingURL=error-codes.d.ts.map