/** Shared inference request identity headers. */ import type { CatalogPolicyInputs } from "@oh-my-pi-zen/pi-catalog/types"; /** Options controlling provider and protocol inference headers. */ export interface InferenceHeaderOptions { /** * Credential-bearing provider id. Wire decisions (protocol session * headers, OpenCode attribution) resolve against the declared backend * instead — see {@link providerType}. */ provider: string; /** * Declared backend identity for a custom provider (`providerType ?? provider`, * the same target the catalog policy cascade resolves). Carried through so * a credential-bearing custom provider declared as an OpenCode backend * gets that backend's wire headers while auth and registry keep using * {@link provider}. */ providerType?: string; protocol: "anthropic" | "google" | "openai"; sessionId?: string; /** * Shared prompt-cache affinity key (see {@link resolveOpenCodeGoCacheAffinity}). * Carried only by `x-opencode-session` on the `opencode-go` backend; * protocol-native session headers and every other backend keep `sessionId`. */ cacheAffinity?: string; } /** * Shared prompt-cache affinity for the OpenCode Go backend: on lanes opted * into KDL `shared-prompt-cache`, related requests (Task siblings, forks, * explicit-key callers) warm and hit the gateway's prefix cache under one * shared key, so Go's session header carries that key instead of the * conversation id. * * `promptCacheKey` MUST be an explicit, already retention-gated cache key — * never the sessionId-derived fallback. The backend identity is * `providerType ?? provider`; catalog policy is the only opt-in authority. */ export declare function resolveOpenCodeGoCacheAffinity(model: CatalogPolicyInputs, promptCacheKey: string | undefined): string | undefined; /** Set a header unless the map already contains that field under any casing. */ export declare function setHeaderIfAbsent(headers: Record, name: string, value: string): void; /** * Label a request with the conversation id under the model's resolved * `compat.sessionHeader` (KDL `session-header`). A header the caller or config * already set wins; without a conversation id nothing is sent. */ export declare function applySessionHeader(headers: Record | Headers, compat: object | undefined, sessionId: string | undefined): void; /** * Project omp's identity and authoritative conversation id onto the headers * understood by the active inference protocol and host. */ export declare function applyInferenceHeaders(headers: Record, options: InferenceHeaderOptions): void; /** * Return `init` with omp's process-wide inference User-Agent default applied. * Any explicit header, including Anthropic and Codex OAuth fingerprints, * remains authoritative. Called per request by `transportFetch`. * * Plain-object headers stay plain objects: custom `fetch` implementations * (proxies, tests) index `init.headers` by name and must not be handed a * `Headers` instance instead. */ export declare function withInferenceUserAgent(input: string | URL | Request, init: RequestInit | undefined): RequestInit | undefined;