/** * Structural request validation at the gateway's wire doors. * * Hostile-input fuzzing showed that malformed bodies (a `model` array, a * `messages` string, an empty body) sailed past the doors, hit deep code, and * surfaced as 502 `upstream_error`s carrying raw TypeError text * ("requested.startsWith is not a function", "body.messages is not iterable") * or internal implementation details. A caller error must be a 400 in the * door's native error envelope, and it must never reach a provider. * * Validation here is *structural only* — field presence and JSON types * matching what the real providers enforce. Semantic rules (role enums, * schema shapes) stay with the providers, so the doors never reject a shape a * real provider would accept. */ export type WireRejection = { status: number; body: unknown; }; import type { AnthropicRequest } from "./anthropic-wire.js"; import type { ResponsesRequest } from "./responses-wire.js"; export declare function decodeValidatedAnthropicRequest(value: unknown): AnthropicRequest; export declare function decodeValidatedResponsesRequest(value: unknown): ResponsesRequest; /** OpenAI Chat Completions door (`/v1/chat/completions`). */ export declare function validateChatRequest(body: unknown): WireRejection | undefined; /** Anthropic Messages door (`/v1/messages`). */ export declare function validateAnthropicRequest(body: unknown): WireRejection | undefined; /** Anthropic `count_tokens` door: same message-shape contract, no minimum length. */ export declare function validateCountTokensRequest(body: unknown): WireRejection | undefined; /** OpenAI Responses door (`/v1/responses`). */ export declare function validateResponsesRequest(body: unknown): WireRejection | undefined;