UNPKG

autoagent-cli

Version:

Run autonomous AI agents using Claude or Gemini for task execution

41 lines (40 loc) 2.1 kB
export interface ProviderError { type: string; provider: string; message: string; timestamp: number; code?: string; } export interface UsageLimitError extends ProviderError { type: 'usage_limit'; resetTime?: number; quotaType?: 'daily' | 'monthly' | 'hourly'; } export interface RateLimitError extends ProviderError { type: 'rate_limit'; retryAfter?: number; rateLimitType?: 'requests_per_minute' | 'requests_per_second'; } export interface ExecutionError extends ProviderError { type: 'execution_error'; exitCode?: number; stderr?: string; } export interface AvailabilityError extends ProviderError { type: 'availability_error'; reason: 'not_installed' | 'not_authenticated' | 'network_error' | 'service_unavailable'; } export type AnyProviderError = UsageLimitError | RateLimitError | ExecutionError | AvailabilityError; export declare class ProviderErrorFactory { static createUsageLimitError(provider: string, message: string, resetTime?: number, quotaType?: 'daily' | 'monthly' | 'hourly'): UsageLimitError; static createRateLimitError(provider: string, message: string, retryAfter?: number, rateLimitType?: 'requests_per_minute' | 'requests_per_second'): RateLimitError; static createExecutionError(provider: string, message: string, exitCode?: number, stderr?: string): ExecutionError; static createAvailabilityError(provider: string, message: string, reason: AvailabilityError['reason']): AvailabilityError; } export declare function isUsageLimitError(error: unknown): error is UsageLimitError; export declare function isRateLimitError(error: unknown): error is RateLimitError; export declare function isExecutionError(error: unknown): error is ExecutionError; export declare function isAvailabilityError(error: unknown): error is AvailabilityError; export declare function isProviderError(error: unknown): error is AnyProviderError; export declare function getTimeRemaining(error: UsageLimitError | RateLimitError): number | undefined; export declare function formatProviderError(error: AnyProviderError): string;