export type GatewayProtocol = 'responses' | 'anthropic' | 'chatCompletions'; export type GatewayMessageRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool'; export type GatewayContentPart = { type: 'text'; text: string; } | { type: 'image'; imageUrl?: string; mediaType?: string; data?: string; detail?: string; }; export interface GatewayMessage { role: GatewayMessageRole; content: GatewayContentPart[]; name?: string; toolCallId?: string; protocolExtensions?: Record; } export interface GatewayTool { type: 'function'; name: string; description?: string; inputSchema?: Record; protocolExtensions?: Record; } export interface GatewayReasoningOptions { effort?: string; exposeSummary?: boolean; } export interface GatewayUsage { inputTokens?: number; outputTokens?: number; totalTokens?: number; cacheReadTokens?: number; cacheWriteTokens?: number; } export interface GatewayRequest { model: string; instructions?: string; messages: GatewayMessage[]; tools: GatewayTool[]; reasoning?: GatewayReasoningOptions; maxOutputTokens?: number; previousResponseId?: string; stream: boolean; protocolExtensions: Partial>>; } export type GatewayEvent = { type: 'response.started'; id: string; } | { type: 'text.delta'; text: string; } | { type: 'reasoning.delta'; text: string; } | { type: 'reasoning.signature'; provider: string; signature: string; } | { type: 'tool.started'; callId: string; name: string; } | { type: 'tool.arguments.delta'; callId: string; delta: string; } | { type: 'tool.completed'; callId: string; } | { type: 'usage'; usage: GatewayUsage; } | { type: 'response.completed'; finishReason: string; }; export interface GatewayEventSerializer { serializeEvent(event: GatewayEvent): Record | Record[]; } export interface GatewayProtocolFrontend { readonly protocol: GatewayProtocol; parseRequest(body: unknown): GatewayRequest; createEventSerializer(): GatewayEventSerializer; } export declare function requireObject(value: unknown, context: string): Record; export declare function stringOrUndefined(value: unknown): string | undefined; export declare function booleanValue(value: unknown): boolean; export declare function extractExtension(body: Record, protocol: GatewayProtocol, normalizedKeys: readonly string[]): Partial>>; export declare function extractText(value: unknown): string | undefined; export declare function normalizeContentParts(content: unknown, protocol: GatewayProtocol): GatewayContentPart[]; export declare function normalizeToolFromResponses(tool: unknown): GatewayTool | undefined; export declare function normalizeToolFromAnthropic(tool: unknown): GatewayTool | undefined; export declare function normalizeToolFromChat(tool: unknown): GatewayTool | undefined; export declare function normalizeMessage(message: unknown, protocol: GatewayProtocol): GatewayMessage | undefined; export declare function mapGatewayUsageToOpenAi(usage: GatewayUsage): Record; export declare function mapGatewayUsageToChatCompletions(usage: GatewayUsage): Record; export declare function mapGatewayUsageToAnthropic(usage: GatewayUsage): Record; export declare class ToolArgumentTracker { private readonly chunks; private readonly toolIndexes; private nextIndex; reset(): void; start(callId: string): number; append(callId: string, delta: string): number; argumentsFor(callId: string): string; complete(callId: string): number; private requireStarted; } export declare function unsupportedEvent(event: GatewayEvent): never;