/** * Transport layer types for CLI ↔ Daemon/Gateway communication. * * The CLI can talk to either: * - A local daemon directly (no auth needed, localhost HTTP) * - A remote daemon through the gateway (auth + relay) * * The Transport interface abstracts this so CLI commands don't care which mode is active. */ import http from 'http'; export interface TransportConfig { /** Connection mode: local daemon or remote via gateway */ mode: 'local' | 'gateway'; /** Daemon base URL (local mode: http://localhost:2756) */ daemonUrl: string; /** Gateway base URL (gateway mode) */ gatewayUrl?: string; /** Target daemon ID (gateway mode) */ daemonId?: string; /** API key for daemon authentication (local mode with HTTP_API_KEY) */ apiKey?: string; } export interface TransportResponse { status: number; body: any; } export interface Transport { /** GET request, parse response as JSON */ get(path: string): Promise; /** POST request with JSON body, parse response as JSON */ post(path: string, body?: any): Promise; /** PUT request with JSON body, parse response as JSON */ put(path: string, body?: any): Promise; /** PATCH request with JSON body, parse response as JSON */ patch(path: string, body?: any): Promise; /** DELETE request with optional JSON body, parse response as JSON */ delete(path: string, body?: any): Promise; /** * POST a chat message and receive an SSE stream back. * Returns the raw http.IncomingMessage for the caller to * parse SSE events from the response body. */ chatStream(path: string, body: any): Promise; }