attachment.ts 1.3 KB

123456789101112131415161718192021222324252627282930
  1. export * as ConfigAttachment from "./attachment"
  2. import { Schema } from "effect"
  3. import { zod } from "@opencode-ai/core/effect-zod"
  4. import { PositiveInt, withStatics } from "@opencode-ai/core/schema"
  5. export const Image = Schema.Struct({
  6. auto_resize: Schema.optional(Schema.Boolean).annotate({
  7. description: "Resize images before sending them to the model when they exceed configured limits (default: true)",
  8. }),
  9. max_width: Schema.optional(PositiveInt).annotate({
  10. description: "Maximum image width before resizing or rejecting the attachment (default: 2000)",
  11. }),
  12. max_height: Schema.optional(PositiveInt).annotate({
  13. description: "Maximum image height before resizing or rejecting the attachment (default: 2000)",
  14. }),
  15. max_base64_bytes: Schema.optional(PositiveInt).annotate({
  16. description: "Maximum base64 payload bytes for an image attachment (default: 4718592)",
  17. }),
  18. })
  19. .annotate({ identifier: "ImageAttachmentConfig" })
  20. .pipe(withStatics((s) => ({ zod: zod(s) })))
  21. export type Image = Schema.Schema.Type<typeof Image>
  22. export const Info = Schema.Struct({
  23. image: Schema.optional(Image).annotate({ description: "Image attachment configuration" }),
  24. })
  25. .annotate({ identifier: "AttachmentConfig" })
  26. .pipe(withStatics((s) => ({ zod: zod(s) })))
  27. export type Info = Schema.Schema.Type<typeof Info>