aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
63 lines • 1.61 kB
TypeScript
/**
* Base API client with rate limiting and retry logic
*
* @module research/clients/base
*/
import { ClientConfig, RateLimitConfig, RetryConfig } from '../types.js';
/**
* Token bucket rate limiter
*/
export declare class RateLimiter {
private config;
private tokens;
private lastRefill;
constructor(config: RateLimitConfig);
/**
* Refill tokens based on elapsed time
*/
private refill;
/**
* Acquire a token, waiting if necessary
*/
acquire(): Promise<void>;
private sleep;
/**
* Get current token count (for testing)
*/
getCurrentTokens(): number;
}
/**
* Base API client with common functionality
*/
export declare abstract class BaseClient {
protected config: ClientConfig;
protected rateLimiter: RateLimiter;
protected retryConfig: RetryConfig;
constructor(config: ClientConfig);
/**
* Execute an HTTP request with rate limiting and retry logic
*/
protected request<T>(url: string, options?: RequestInit): Promise<T>;
/**
* Execute request with exponential backoff retry
*/
private executeWithRetry;
/**
* Handle HTTP error responses
*/
private handleHttpError;
/**
* Determine if an error is retriable
*/
private isRetriable;
/**
* Calculate exponential backoff delay
*/
private calculateBackoff;
private sleep;
/**
* Build URL with query parameters
*/
protected buildUrl(path: string, params: Record<string, string | number | boolean | undefined>): string;
}
//# sourceMappingURL=base.d.ts.map