import type { ChatMessage, ChatTurn, ToolSpec } from "@boardwalk-labs/engine/core"; import type { NormalizedReasoning } from "@boardwalk-labs/workflow"; import { type ByoInferenceProvider } from "../contract.js"; /** Parse the claim-delivered registry (BOARDWALK_BYO_PROVIDERS). Absent/malformed ⇒ empty — * the run still works; BYO calls simply fall back to the broker's clear error. */ export declare function parseByoProviders(raw: string | undefined): ByoInferenceProvider[]; /** The registry entry for a per-`agent()` provider name, when the runtime may call it * directly. Null ⇒ use the broker (managed lane, unknown provider, or a brokered-only * source like bedrock). */ export declare function directProviderFor(registry: readonly ByoInferenceProvider[], provider: string | undefined): ByoInferenceProvider | null; /** * The claim-delivered registry, plus the one re-read it will do per unknown provider name. * * The registry is a SNAPSHOT taken when the run was dispatched, so a provider created while a long * run is in flight is simply absent: the runtime would broker that call and the broker refuses it * as direct-eligible, failing an hours-old run over a provider that exists. On a genuine miss we * re-read the live registry — once per distinct name, so a typo'd provider inside a loop costs one * fetch rather than one per turn. A name that's present but brokered (bedrock) never refetches, and * a failed refresh falls through to the broker, whose error already names the problem. */ export declare class ByoProviderRegistry { /** Reads the org's live registry (the broker's run-scoped providers endpoint). Absent ⇒ the * snapshot is all there is (embedded/self-hosted callers with no control plane). */ private readonly refresh?; private entries; private readonly refetched; constructor(entries: readonly ByoInferenceProvider[], /** Reads the org's live registry (the broker's run-scoped providers endpoint). Absent ⇒ the * snapshot is all there is (embedded/self-hosted callers with no control plane). */ refresh?: (() => Promise) | undefined); /** The entry to dial directly for a per-`agent()` provider name; null ⇒ use the broker. */ direct(provider: string | undefined): Promise; } export interface DirectTurnRequest { model: string; messages: readonly ChatMessage[]; tools: readonly ToolSpec[]; reasoning?: NormalizedReasoning; } export interface DirectInferenceDeps { /** The org's providers + the refresh-on-miss re-read (see {@link ByoProviderRegistry}). */ registry: ByoProviderRegistry; /** Resolves the provider's auth secret by NAME (the run's RecordingSecretResolver, so the * value registers with the redactor). */ resolveSecret: (name: string) => Promise; fetchImpl?: typeof fetch; } /** One model turn, straight to the org's endpoint. Returns the ChatTurn + canonical model ref; * BYO carries no platform cost (costMicros stays 0 — BYO is never metered). */ export declare function streamDirectTurn(deps: DirectInferenceDeps, entry: ByoInferenceProvider, req: DirectTurnRequest, onDelta: ((text: string) => void) | undefined, onReasoningDelta: ((text: string) => void) | undefined, /** Register the resolved key with the CURRENT leaf's engine redactor, before the model call. * The key resolves mid-leaf (after the leaf's redactor snapshot is seeded), so without this a * provider that echoes the Authorization header in an error body would leak it into that * leaf's error run event. The run-level redactor already has it via resolveSecret; this closes * the per-leaf gap. */ registerSecret?: (value: string) => void): Promise<{ turn: ChatTurn; modelRef: string; }>;