/** * Agent Proxy — Shared HTTP client for agent.crowdlisten.com * * All agent-proxied tools route through these helpers. * Supports POST, GET, and SSE streaming endpoints. */ /** * Returns the CROWDLISTEN_API_KEY or throws with a sign-in prompt. * Priority: env var override → stored auth from ~/.crowdlisten/auth.json. * Login is free — `npx -y -p @crowdlisten/harness crowdlisten-harness login` sets this up automatically. */ export declare function requireApiKey(): string; /** * Returns the Supabase access_token (JWT) for endpoints that use require_user() auth. * Entity endpoints, analysis endpoints, and channel ingestion all expect a Supabase JWT, * NOT a cl_live_* API key. */ export declare function requireAccessToken(): string; /** * GBrain-style structured error with actionable suggestion and docs link. */ export interface AgentApiError { error: string; suggestion: string; docs: string; status?: number; details?: unknown; } export declare function agentPost(path: string, body: Record, apiKey?: string, requestHeaders?: Record): Promise; export declare function agentGet(path: string, apiKey?: string): Promise; export declare function agentPut(path: string, body: Record, apiKey?: string): Promise; export declare function agentPatch(path: string, body: Record, apiKey?: string): Promise; export declare function agentDelete(path: string, apiKey?: string): Promise; /** * Connects to a streaming endpoint, collects all events, and returns * the aggregated result. Used for long-running operations like * analysis/run and PRD generation. * * Production analysis currently emits newline-delimited JSON while older * deployments and local mocks emit SSE `data:` lines. Accept both wire * formats so the harness cannot silently discard a valid production result. * Completion requires an explicit completed/partial terminal record. Failed or * interrupted streams remain failures, with the saved analysis ID when known. */ export declare function agentStream(path: string, body: Record, apiKey?: string, timeoutMs?: number): Promise;