/** * OpenAI-compatible HTTP plumbing for the headless LLM loops: the single * `chatOnce` completion call, OpenRouter gateway headers/error mapping, and * the `complete` / `completeStream` one-shot helpers. * Split out of llm.ts (1200-line-per-file rule). */ import { type ChatMessage, type LlmOptions, type ToolDef } from './llm-core'; export interface ChatOnceResult { message: ChatMessage | null; usage?: { total_tokens?: number; }; } /** True when this endpoint is the OpenRouter API gateway. */ export declare function isOpenRouterUrl(baseUrl: string): boolean; /** * OpenRouter attribution headers: `HTTP-Referer` + `X-Title` feed the * gateway's app rankings and let OpenRouter-side logs identify the caller. * Injected ONLY for openrouter.ai base URLs - every other provider would see * them as unknown headers. */ export declare function gatewayHeaders(baseUrl: string): Record; export declare function chatOnce(messages: ChatMessage[], opts: LlmOptions, toolDefs: ToolDef[]): Promise; /** * Single-shot chat completion (no tools) - used by the chat-reply loop to * draft a reply to a mention and by the run-report writer. Same env * contract as `--self`. `system` overrides the default chat assistant * persona (e.g. for markdown report generation). */ export declare function complete(prompt: string, opts: Pick, system?: string): Promise; /** * Phase C streaming (IMP-530): OpenAI-compatible SSE `chat/completions` * (stream: true). Calls `onToken` with each content delta as it arrives; * resolves with the full trimmed reply. Works with any OpenAI-compatible * provider (Gemini, DeepSeek, OpenAI, Groq, OpenRouter, Mistral). */ export declare function completeStream(prompt: string, opts: Pick, onToken: (delta: string) => void): Promise;