import type { Tool as OpenAITool, ResponseCreateParamsStreaming, ResponseInput, ResponseStreamEvent } from "openai/resources/responses/responses.js"; import type { Api, AssistantMessage, Model, StreamOptions, Tool, TranscriptContext, Usage } from "../types.ts"; import type { AssistantMessageEventStream } from "../utils/event-stream.ts"; import { type TranscriptToolSupport } from "../utils/transcript.ts"; export interface OpenAIResponsesStreamOptions { onProviderStreamEvent?: StreamOptions["onProviderStreamEvent"]; serviceTier?: ResponseCreateParamsStreaming["service_tier"]; grammarToolInputProperties?: ReadonlyMap; resolveServiceTier?: (responseServiceTier: ResponseCreateParamsStreaming["service_tier"] | undefined, requestServiceTier: ResponseCreateParamsStreaming["service_tier"] | undefined) => ResponseCreateParamsStreaming["service_tier"] | undefined; applyServiceTierPricing?: (usage: Usage, serviceTier: ResponseCreateParamsStreaming["service_tier"] | undefined) => void; } export interface ConvertResponsesMessagesOptions { grammarToolInputProperties?: ReadonlyMap; /** Whether later system messages are sent in place; otherwise they are folded into the leading prompt. */ supportsMidConvoSystemMessages?: boolean; supportsAdditionalTools?: boolean; supportsToolSearch?: boolean; toolOptions?: ConvertResponsesToolsOptions; /** * Effort for the reply being generated. When set, the thinking level is sent as * configuration_update items instead of a changing reasoning.effort, which would invalidate the * prompt cache. Each item sets the effort from that point on: one goes before every earlier * reply with the level recorded on it (`providerThinkingLevel`), and one with this effort goes * at the end. Earlier input therefore never changes. OpenAI documents the item before user * messages only. After tool results it was verified on gpt-6-luna (October 2026) to be accepted * and to apply to the next reply. */ configurationUpdateEffort?: string; } export interface ConvertResponsesToolsOptions { strict?: boolean | null; supportsStrictMode?: boolean; supportsOpenAIGrammarTools?: boolean; toolSearchResult?: boolean; } /** * How a Responses transport expresses tool changes. * * `additional_tools` items accumulate: a later item adds tools and replaces same-name * definitions from earlier items, but it cannot replace a top-level tool and cannot remove any * tool (verified with strict schemas on the OpenAI, Codex, and Copilot backends, October 2026). * Like Codex, every tool is therefore declared in `additional_tools` items, starting with one * at the head of the input, and removals are announced as text. Synthetic tool search can * only add tools. Without mid-conversation system messages there is nothing to anchor. */ export declare function getResponsesToolSupport(options: { supportsMidConvoSystemMessages?: boolean; supportsAdditionalTools?: boolean; supportsToolSearch?: boolean; }): TranscriptToolSupport; /** Render input items for replay, as used by Codex WebSocket continuation. Use `prepareResponsesPrompt` to build a request. */ export declare function convertResponsesMessages(model: Model, context: TranscriptContext, allowedToolCallProviders: ReadonlySet, options?: ConvertResponsesMessagesOptions): ResponseInput; /** Place transcript-derived declarations and effort changes consistently in input and top-level request fields. */ export declare function prepareResponsesPrompt(model: Model, context: TranscriptContext, allowedToolCallProviders: ReadonlySet, options?: ConvertResponsesMessagesOptions & { effortBaseline?: "initial"; }): { input: ResponseInput; requestTools: OpenAITool[]; requestEffortBaseline: string | undefined; }; export declare function convertResponsesTools(tools: readonly Tool[], options?: ConvertResponsesToolsOptions): OpenAITool[]; export declare function processResponsesStream(openaiStream: AsyncIterable, output: AssistantMessage, stream: AssistantMessageEventStream, model: Model, options?: OpenAIResponsesStreamOptions): Promise; //# sourceMappingURL=openai-responses-shared.d.ts.map