/** * OpenCode Zen/Go session headers for every direct HTTP call the bridge makes. * * The Go gateway (`https://opencode.ai/zen/go/v1/...`) rejects requests that * carry no `x-opencode-session` header with HTTP 400 `MissingSessionID` — the * id must be STABLE for the whole conversation so the gateway can route and * cache prompts. Zen does not enforce it yet, but the docs ask every client * to send it, so we send it for both `opencode/*` and `opencode-go/*`. * * Harness CLIs (opencode/claude/gemini/...) make their OWN HTTP calls: the * first-party opencode CLI already sends a valid session header itself, and * the other CLIs never talk to the Go gateway at all — so this helper is for * the bridge's own `fetch` calls only (browser vision loop, stealth loop, * `--self` headless loop). Harness spawns receive the same stable id through * `SpawnOpts.opencodeSessionId` / `VisionHarness.sessionId` as env * (`X_OPENCODE_SESSION`) for forward-compat, never as a CLI flag. */ export declare const OPENCODE_SESSION_HEADER = "x-opencode-session"; /** Env var carrying the stable session id into harness child processes. */ export declare const OPENCODE_SESSION_ENV = "X_OPENCODE_SESSION"; /** * Identifying User-Agent for OpenCode calls (the Go docs ask clients to send * their own UA instead of a generic SDK/library name). */ export declare function bridgeUserAgent(): string; /** True for the OpenCode Zen/Go gateway (both roots — one rule, no drift). */ export declare function isOpencodeUrl(url: string): boolean; /** * Headers identifying this bridge to the OpenCode gateway. The session id is * sent ONLY on opencode URLs (other providers would see it as an unknown * header); the User-Agent rides with it for the same scope. */ export declare function opencodeSessionHeaders(url: string, sessionId?: string | null): Record; /** * One stable id per run/conversation — generate once at run start and reuse * for every turn. An existing id (resume, retry of the same run) always wins. */ export declare function ensureOpencodeSessionId(existing?: string | null): string; /** True when a failed call is the gateway's missing-session refusal. */ export declare function isMissingSessionError(status: number, body: string): boolean;