/** * Largest attachment body copied into SQL `resources` for `read-attachment`. * Only text with no storage URL is copied; an upload keeps a reference and is * re-read from storage, so large file bodies stay out of SQL. */ export declare const MAX_ATTACHMENT_RESOURCE_BODY_CHARS = 1000000; /** Total body copies one request may write into SQL. */ export declare const MAX_ATTACHMENT_RESOURCE_BODY_TOTAL_CHARS = 2000000; export declare const ATTACHMENT_REFERENCE_MIME_TYPE = "application/vnd.agent-native.attachment-reference+json"; /** Most characters of one text attachment the prompt shows inline. */ export declare const MAX_INLINE_TEXT_ATTACHMENT_CHARS = 60000; /** Most characters of all text attachments in one prompt. */ export declare const MAX_INLINE_TEXT_ATTACHMENTS_TOTAL_CHARS = 80000; /** * Largest text or SVG file read on any path: browser reads, owned-URL * hydration and data URLs a caller sends directly all stop here. */ export declare const MAX_TEXT_ATTACHMENT_BYTES: number; export declare function isTextLikeMimeType(contentType: string | undefined): boolean; export declare function isTextLikeFilename(name: string | undefined): boolean; export declare function isSvgTextAttachment(att: { name?: string; contentType?: string; }): boolean; /** * Unwraps the composer's envelope only when it names this very file, so a * stored or legacy upload that kept its wrapper reads as its body, while a * real document that merely looks like one is left as written. Every path * that reads attachment text uses this one function, so the prompt, the * stored copy and read-attachment offsets agree. */ export declare function unwrapOwnAttachmentEnvelope(text: string, name: string | undefined): string; export type DecodedAttachmentText = { kind: "text"; text: string; } | { kind: "not-text"; } | { kind: "undecodable"; mediaType: string; reason: "invalid-base64" | "not-utf8" | "too-large"; }; export declare function decodeTextAttachmentData(att: { name?: string | undefined; contentType?: string | undefined; data?: string | undefined; }): DecodedAttachmentText; /** Cuts at `end` without leaving half of a surrogate pair at the edge. */ export declare function sliceTextHead(text: string, end: number): string; /** * The one size check for text attachments, whether the bytes arrive as a data * URL or as composer text. Pre-upload runs it before encoding or uploading, * and the prompt and persistence run it so all three agree the file is too * large. */ export declare function isOverTextAttachmentLimit(att: { name?: string | undefined; contentType?: string | undefined; data?: string | undefined; text?: string | undefined; }): boolean; export type TextAttachmentStorage = { kind: "stored"; resourceId: string; path: string; totalChars: number; } | { kind: "failed"; reason: "too-large" | "write-failed"; error?: string; };