import { AudioResponse, ChatCompletion, ChatCompletionRequest, ContentWithToolCallsResponse, EmbeddingResponse, ErrorResponse, FixtureResponse, ImageResponse, ResponseOverrides, SSEChunk, TextResponse, ToolCall, ToolCallResponse, TranscriptionResponse, VideoResponse } from "./types.cjs"; import * as http$1 from "node:http"; //#region src/helpers.d.ts /** * Build the strict-mode 503 error message, distinguishing a true no-match from * a sequence/turn-exhausted miss. * * `skippedBySequenceOrTurn` is the count reported by `matchFixtureDiagnostic` * (router.ts): the number of fixtures that matched the request SHAPE but were * rejected ONLY by their `sequenceIndex`/`turnIndex` count state. * * - `0` → `"Strict mode: no fixture matched"` (no candidate had a matching shape) * - `>0` → `"Strict mode: N candidate fixture(s) skipped by sequence/turn state"` * * The HTTP status (503) and error envelope shape are unchanged at every call * site — only this message string differs. Endpoints with no sequence/turn * gates always pass `0` and therefore see the generic message. */ declare function strictNoMatchMessage(skippedBySequenceOrTurn: number): string; /** * Build the strict-mode error LOG line, mirroring {@link strictNoMatchMessage}'s * disambiguation so the error log distinguishes the two miss kinds too. */ declare function strictNoMatchLogLine(method: string, url: string, skippedBySequenceOrTurn: number): string; /** * Resolve the reasoning string to actually emit for a given model. * * aimock synthesizes a reasoning channel whenever a fixture carries a * `reasoning` string, regardless of the requested model. But a non-reasoning * model (e.g. `gpt-4.1`) would emit no reasoning against the real provider, so * replaying it is a false green (see aimock#254). This gates the emission on * the requested model's capability: * * - no fixture reasoning → undefined (no-op, short-circuit) * - reasoning-capable model → emit unchanged, no log * - non-reasoning model, strict OFF → `logger.warn`, still emit (preserves * current behavior) * - non-reasoning model, strict ON → `logger.error`, suppress (return undefined) * * Capability is decided from the REQUESTED model id (what the backend was wired * to), not any `overrides.model` echoed in the payload. */ declare function flattenHeaders(headers: http$1.IncomingHttpHeaders): Record; declare function generateId(prefix?: string): string; declare function generateToolCallId(): string; declare function generateMessageId(): string; declare function generateToolUseId(): string; declare function isTextResponse(r: FixtureResponse): r is TextResponse; declare function isToolCallResponse(r: FixtureResponse): r is ToolCallResponse; declare function isContentWithToolCallsResponse(r: FixtureResponse): r is ContentWithToolCallsResponse; declare function isErrorResponse(r: FixtureResponse): r is ErrorResponse; /** * Serialize an ErrorResponse to JSON, stripping the internal-only `status` * field that controls the HTTP status code but should never appear in the * response body. Real LLM APIs don't include it. */ declare function isEmbeddingResponse(r: FixtureResponse): r is EmbeddingResponse; declare function isImageResponse(r: FixtureResponse): r is ImageResponse; declare function isAudioResponse(r: FixtureResponse): r is AudioResponse; /** * Map audio format shorthand to MIME content types. * Shared between speech, ElevenLabs, and fal audio handlers. */ declare const FORMAT_TO_CONTENT_TYPE: Record; /** * Resolve a format string (e.g. "mp3", "opus") to its MIME content type. * Falls back to "application/octet-stream" for unknown formats. */ declare function formatToMime(format: string): string; declare function isTranscriptionResponse(r: FixtureResponse): r is TranscriptionResponse; declare function isVideoResponse(r: FixtureResponse): r is VideoResponse; declare function extractOverrides(response: TextResponse | ToolCallResponse | ContentWithToolCallsResponse): ResponseOverrides; /** * Rough token count estimation based on character length. * Uses the ~4 characters per token heuristic common for English text. */ declare function buildTextChunks(content: string, model: string, chunkSize: number, reasoning?: string, overrides?: ResponseOverrides): SSEChunk[]; declare function buildToolCallChunks(toolCalls: ToolCall[], model: string, chunkSize: number, reasoning?: string, overrides?: ResponseOverrides): SSEChunk[]; declare function buildTextCompletion(content: string, model: string, reasoning?: string, overrides?: ResponseOverrides, requestMessages?: ChatCompletionRequest["messages"]): ChatCompletion; declare function buildToolCallCompletion(toolCalls: ToolCall[], model: string, reasoning?: string, overrides?: ResponseOverrides, requestMessages?: ChatCompletionRequest["messages"]): ChatCompletion; declare function buildContentWithToolCallsChunks(content: string, toolCalls: ToolCall[], model: string, chunkSize: number, reasoning?: string, overrides?: ResponseOverrides): SSEChunk[]; declare function buildContentWithToolCallsCompletion(content: string, toolCalls: ToolCall[], model: string, reasoning?: string, overrides?: ResponseOverrides, requestMessages?: ChatCompletionRequest["messages"]): ChatCompletion; /** * Generate a deterministic embedding vector from input text. * Hashes the input with SHA-256 and spreads the hash bytes across * the requested number of dimensions, producing values in [-1, 1]. */ declare function generateDeterministicEmbedding(input: string, dimensions?: number): number[]; interface EmbeddingAPIResponse { object: "list"; data: { object: "embedding"; index: number; embedding: number[]; }[]; model: string; usage: { prompt_tokens: number; total_tokens: number; }; } /** * Build an OpenAI-format embeddings API response for one or more inputs. */ declare function buildEmbeddingResponse(embeddings: number[][], model: string, usage?: { prompt_tokens?: number; total_tokens?: number; }): EmbeddingAPIResponse; //# sourceMappingURL=helpers.d.ts.map //#endregion export { EmbeddingAPIResponse, FORMAT_TO_CONTENT_TYPE, buildContentWithToolCallsChunks, buildContentWithToolCallsCompletion, buildEmbeddingResponse, buildTextChunks, buildTextCompletion, buildToolCallChunks, buildToolCallCompletion, extractOverrides, flattenHeaders, formatToMime, generateDeterministicEmbedding, generateId, generateMessageId, generateToolCallId, generateToolUseId, isAudioResponse, isContentWithToolCallsResponse, isEmbeddingResponse, isErrorResponse, isImageResponse, isTextResponse, isToolCallResponse, isTranscriptionResponse, isVideoResponse, strictNoMatchLogLine, strictNoMatchMessage }; //# sourceMappingURL=helpers.d.cts.map