import type { ReadStream } from "node:fs"; import type { H3Event } from "h3"; /** * Default maximum chat-POST body size (25 MB uncompressed). The agent chat * body carries base64-encoded attachments so a 25 MB cap is generous while * still protecting against runaway payloads. Override per-route by passing a * different `maxBytes` value to `readBodyWithSizeLimit`. */ export declare const DEFAULT_CHAT_MAX_BODY_BYTES: number; /** * Maximum file size for upload routes (25 MB). Mirrors Whisper's hard limit * so audio, image, and document uploads share a consistent ceiling. */ export declare const DEFAULT_UPLOAD_MAX_FILE_BYTES: number; /** * Maximum number of attachments per chat message. Guards against pathological * requests that would fan out into hundreds of parallel model content-parts. */ export declare const MAX_CHAT_ATTACHMENTS_PER_MESSAGE = 20; /** * MIME types allowed on the file-upload routes. Executables and scripts are * explicitly excluded; everything else is allowed at the default tier. * Pass `allowedMimeTypes` to `assertAllowedMimeType` to enforce on a route. */ export declare const UPLOAD_ALLOWED_MIME_PREFIXES: string[]; /** * Returns true when the given MIME type is acceptable for uploads. * Blocks executables and scripts; allows everything else in the allow-prefix list. */ export declare function isAllowedUploadMimeType(mimeType: string): boolean; /** * Parse a JSON request body. Returns `{}` if the body is empty or absent * so callers don't have to null-check before destructuring. * * Defaults T to `any` for ergonomic field access. Pass an explicit type * argument when you want a typed result: * * const { email, password } = await readBody(event); */ export declare function readBody(event: H3Event): Promise; /** * Like `readBody` but rejects with a 413 response when the declared * `content-length` (or the actual buffered body) exceeds `maxBytes`. * * @param event - H3 event * @param maxBytes - Maximum allowed body size in bytes (default: 25 MB) * @returns Parsed body or `{}` when absent * @throws Never — on over-size it sets status 413 and throws an object with * `{ statusCode: 413, message }` so the h3 handler can propagate it. */ export declare function readBodyWithSizeLimit(event: H3Event, maxBytes?: number): Promise; /** * Convert a Node `ReadStream` (e.g. from `fs.createReadStream`) into a web * `ReadableStream`, suitable for returning directly from an h3 v2 handler. * * import { streamFile } from "@agent-native/core/server"; * import fs from "node:fs"; * * return streamFile(fs.createReadStream(filePath)); */ export declare function streamFile(stream: ReadStream): ReadableStream; //# sourceMappingURL=h3-helpers.d.ts.map