/** * Shared broker-connection discovery for the attach-style CLI verbs * (`view`, `drive`, `passthrough`). * * Resolution order matches `agent-relay-broker dump-pty` so users don't * have to learn two patterns: * * 1. `--broker-url` / `--api-key` CLI flags * 2. `RELAY_BROKER_URL` / `RELAY_BROKER_API_KEY` environment variables * 3. `/connection.json` (default `.agent-relay/connection.json`) */ /** Connection metadata discovered from `connection.json` or CLI/env overrides. */ export interface BrokerConnection { url: string; apiKey?: string; } /** Options the caller may have parsed from CLI flags. */ export interface BrokerConnectionOptions { brokerUrl?: string; apiKey?: string; stateDir?: string; } /** Injectable bits — tests stub these out instead of touching disk / env. */ export interface BrokerConnectionDeps { readConnectionFile: (stateDir: string) => unknown; getDefaultStateDir: () => string; env: NodeJS.ProcessEnv; } /** Read `/connection.json` from disk, returning the parsed JSON or `null`. */ export declare function readConnectionFileFromDisk(stateDir: string): unknown; /** Default state-directory: `.agent-relay/` under the resolved project root. */ export declare function defaultStateDir(): string; /** * Resolve the broker connection in priority order. Returns `null` when no * source provides a URL — the caller decides how to surface that. */ export declare function resolveBrokerConnection(options: BrokerConnectionOptions, deps: BrokerConnectionDeps): BrokerConnection | null; /** Convert an `http(s)://host:port` base URL to the matching `ws(s)://…/ws`. */ export declare function toWsUrl(baseUrl: string): string; //# sourceMappingURL=broker-connection.d.ts.map