feat(contracts): add ChatFileAttachment variant to attachment unions

Additive union member: existing image rows/drafts decode unchanged.
Limits shared with images (10 MB, 8 per message).

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Andrei Drăgan RădulețandClaude Fable 5 authored and Julius Marminge committed 2026-07-20 18:08:18 +02:00
1 parent 5d34f9ff23
commit cca513e2ab
1 file changed
+22 -2
+22 -2
View File
@@ -173,9 +173,29 @@ const UploadChatImageAttachment = Schema.Struct({
});
export type UploadChatImageAttachment = typeof UploadChatImageAttachment.Type;
export const ChatAttachment = Schema.Union([ChatImageAttachment]);
export const ChatFileAttachment = Schema.Struct({
type: Schema.Literal("file"),
id: ChatAttachmentId,
name: TrimmedNonEmptyString.check(Schema.isMaxLength(255)),
mimeType: TrimmedNonEmptyString.check(Schema.isMaxLength(100)),
sizeBytes: NonNegativeInt.check(Schema.isLessThanOrEqualTo(PROVIDER_SEND_TURN_MAX_IMAGE_BYTES)),
});
export type ChatFileAttachment = typeof ChatFileAttachment.Type;
const UploadChatFileAttachment = Schema.Struct({
type: Schema.Literal("file"),
name: TrimmedNonEmptyString.check(Schema.isMaxLength(255)),
mimeType: TrimmedNonEmptyString.check(Schema.isMaxLength(100)),
sizeBytes: NonNegativeInt.check(Schema.isLessThanOrEqualTo(PROVIDER_SEND_TURN_MAX_IMAGE_BYTES)),
dataUrl: TrimmedNonEmptyString.check(
Schema.isMaxLength(PROVIDER_SEND_TURN_MAX_IMAGE_DATA_URL_CHARS),
),
});
export type UploadChatFileAttachment = typeof UploadChatFileAttachment.Type;
export const ChatAttachment = Schema.Union([ChatImageAttachment, ChatFileAttachment]);
export type ChatAttachment = typeof ChatAttachment.Type;
const UploadChatAttachment = Schema.Union([UploadChatImageAttachment]);
const UploadChatAttachment = Schema.Union([UploadChatImageAttachment, UploadChatFileAttachment]);
export type UploadChatAttachment = typeof UploadChatAttachment.Type;
export const ProjectScriptIcon = Schema.Literals([