import { AudioResponse, ChatCompletion, ChatCompletionRequest, ContentWithToolCallsResponse, EmbeddingResponse, ErrorResponse, FixtureBlock, FixtureFileBlock, FixtureResponse, ImageResponse, ResponseOverrides, SSEChunk, TextResponse, ToolCall, ToolCallResponse, TranscriptionResponse, VideoResponse } from "./types.js";
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<string, string>;
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;
/**
 * Validate and pass through the ordered `blocks` field of a combined
 * content+toolCalls fixture. Used ONLY on the new block-iteration path (when a
 * fixture explicitly sets `blocks`); it is NOT a legacy-order reconstructor —
 * fixtures without `blocks` never reach this function and keep their unchanged
 * text-first path.
 *
 * An EMPTY `blocks` array is treated as "no blocks" by every builder's
 * streaming gate (`blocks && blocks.length > 0`), so it falls back to the
 * legacy `{content, toolCalls}` path and never reaches this function — the gate
 * is the single source of truth for "has blocks". This validator therefore only
 * ever runs on a non-empty array.
 *
 * Accepts the relaxed on-disk {@link FixtureFileBlock} input shape — a
 * `toolCall` block's `arguments` may be a string OR a JSON object/array — which
 * makes the object-tolerance below type-visible and mirrors how
 * normalizeResponse types its file-form input (see {@link FixtureFileBlock} /
 * {@link FixtureFileContentWithToolCallsResponse}). The in-memory
 * {@link FixtureBlock} form (string `arguments`) is a structural subtype, so
 * existing callers that pass `FixtureBlock[]` continue to type-check.
 *
 * Returns the blocks in array order, NORMALIZED to {@link FixtureBlock}: a
 * `text` block with a string `text`, or a `toolCall` block with string `name` +
 * string `arguments` (object/array `arguments` is JSON.stringified) and an
 * optional string `id`. The return type guarantees `arguments: string` — every
 * caller relies on that. Throws on a malformed array or entry — same fail-fast
 * idiom as the other fixture validators in this module (see e.g. the factory
 * guard at {@link resolveResponse}).
 */
declare function resolveFixtureBlocks(blocks: FixtureFileBlock[]): FixtureBlock[];
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<string, string>;
/**
 * 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, blocks?: FixtureBlock[]): 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, resolveFixtureBlocks, strictNoMatchLogLine, strictNoMatchMessage };
//# sourceMappingURL=helpers.d.ts.map