/** * ThinkHive SDK v3.0 - HTTP Client * * Centralized HTTP client with authentication and error handling */ export interface RequestOptions { method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE'; body?: unknown; headers?: Record; /** Override API version for this request. Use 'none' for unversioned routes (e.g., /api/agents). */ apiVersion?: 'v1' | 'v2' | 'v3' | 'none'; /** Override max retries for this request */ maxRetries?: number; /** Request timeout in milliseconds */ timeout?: number; /** Use path as-is without prepending /api/ prefix (for routes like /v1/guardrails/scan) */ rawPath?: boolean; } /** * Make an authenticated API request with retry logic */ export declare function apiRequest(path: string, options?: RequestOptions): Promise; /** * Make an API request and extract data from response wrapper */ export declare function apiRequestWithData(path: string, options?: RequestOptions): Promise; /** * Base error class for ThinkHive SDK errors */ export declare class ThinkHiveError extends Error { readonly code: string; readonly statusCode?: number | undefined; readonly details?: Record | undefined; constructor(message: string, code: string, statusCode?: number | undefined, details?: Record | undefined); } /** * API request error - returned from ThinkHive server */ export declare class ThinkHiveApiError extends ThinkHiveError { constructor(message: string, statusCode: number, code?: string); } /** * Validation error - invalid input parameters */ export declare class ThinkHiveValidationError extends ThinkHiveError { readonly field?: string | undefined; constructor(message: string, field?: string | undefined); } /** * Permission denied error - API key lacks required permissions * @example * ```typescript * try { * await thinkHive.traces.create(...); * } catch (error) { * if (error instanceof PermissionDeniedError) { * console.log('API key needs write permission'); * } * } * ``` */ export declare class PermissionDeniedError extends ThinkHiveError { constructor(message: string, details?: Record); } /** * Agent scope violation error - API key not authorized for this agent * @example * ```typescript * // Create key scoped to specific agents * const key = await thinkHive.apiKeys.create({ * name: 'Agent A Key', * allowedAgentIds: ['agent-a-id'] * }); * * // Attempting to use for Agent B will throw AgentScopeError * ``` */ export declare class AgentScopeError extends ThinkHiveError { constructor(agentId: string, allowedAgents: string[]); } /** * Rate limit exceeded error * @example * ```typescript * try { * await thinkHive.traces.create(...); * } catch (error) { * if (error instanceof RateLimitError) { * // Wait and retry * await sleep(error.retryAfter); * await thinkHive.traces.create(...); * } * } * ``` */ export declare class RateLimitError extends ThinkHiveError { readonly retryAfter: number; constructor(messageOrRetryAfter: string | number, retryAfterMs?: number); } /** * IP whitelist violation error */ export declare class IpWhitelistError extends ThinkHiveError { constructor(clientIp: string); }