import { CommandContext } from '../types/index.js'; export type ApiErrorCode = 'USAGE_ERROR' | 'AUTH_ERROR' | 'PERMISSION_ERROR' | 'NOT_FOUND' | 'NETWORK_ERROR' | 'BACKEND_ERROR' | 'UNKNOWN_ERROR'; export declare class CliError extends Error { readonly code: ApiErrorCode; readonly exitCode: number; readonly requestId?: string | undefined; readonly details?: unknown | undefined; constructor(message: string, code?: ApiErrorCode, exitCode?: number, requestId?: string | undefined, details?: unknown | undefined); } export interface CoreApiConfig { baseUrl: string; orgId: string; userId: string; apiKey: string; } export interface ApiResult { data: T; requestId?: string; status: number; } export declare function getCoreApiConfig(context: CommandContext): CoreApiConfig; export declare function requireCoreApiConfig(context: CommandContext): CoreApiConfig; export declare function successEnvelope(data: T): { success: true; data: T; }; export declare function errorEnvelope(error: unknown): { success: false; error: { code: string; message: string; requestId?: string; }; }; export declare function writeJsonSuccess(context: CommandContext, data: unknown): void; export declare function writeJsonError(context: CommandContext, error: unknown): void; export declare function exitCodeFor(error: unknown): number; export declare class KablewyApiClient { private readonly config; private readonly telemetryCommand?; constructor(config: CoreApiConfig, telemetryCommand?: string | undefined); request(method: string, path: string, options?: { body?: unknown; query?: Record; headers?: Record; }): Promise>; } export declare function createApiClient(context: CommandContext): KablewyApiClient;