Documentation
¶
Overview ¶
Package attachment owns bounded Workspace attachment discovery and resolution.
Index ¶
- Constants
- Variables
- type Image
- func (i Image) Bytes() []byte
- func (i Image) Clone() Image
- func (i Image) Digest() [sha256.Size]byte
- func (i Image) Equal(other Image) bool
- func (i Image) Height() int
- func (i Image) MIMEType() string
- func (i Image) Name() string
- func (i Image) Part() ai.ImagePart
- func (i Image) Size() int
- func (i Image) Valid() bool
- func (i Image) Width() int
- type Kind
- type Reference
- type Resolved
- type Snapshot
- type Summary
- type Text
Constants ¶
const ( // MaxTextBytes is the largest Workspace text file accepted as prompt context. MaxTextBytes = 512 << 10 // MaxPathBytes bounds Workspace-relative attachment paths and provenance. MaxPathBytes = 4 << 10 // MaxEncodedImageBytes is the largest encoded image accepted at ingress. MaxEncodedImageBytes = 20 << 20 // MaxImageBytes is the largest normalized inline image accepted by Coding. MaxImageBytes = 1 << 20 // MaxImagePixels bounds decoded image work before a full decode is attempted. MaxImagePixels = 40_000_000 // MaxImagesPerMessage bounds images in one assembled user message. MaxImagesPerMessage = 4 // MaxImageBytesPerMessage bounds aggregate inline image data in one message. MaxImageBytesPerMessage = 2 << 20 )
Variables ¶
var ( // ErrDenied means a path enters private VCS metadata. ErrDenied = errors.New("coding attachment: path denied") // ErrLimit means a discovery or text-content boundary was exceeded. ErrLimit = errors.New("coding attachment: limit exceeded") // ErrBinaryText means a selected text file is not valid NUL-free UTF-8. ErrBinaryText = errors.New("coding attachment: binary text file") // ErrInvalidImage means encoded image data or metadata is malformed. ErrInvalidImage = errors.New("coding attachment: invalid image") // ErrUnsupportedImage means the encoded image format is not accepted. ErrUnsupportedImage = errors.New("coding attachment: unsupported image format") )
Functions ¶
This section is empty.
Types ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image is immutable normalized inline image data. Byte-returning methods detach their result so callers cannot mutate retained Composer snapshots.
func NormalizeImage ¶
NormalizeImage validates and normalizes one encoded PNG, JPEG, or GIF. GIF input uses only its first frame. Valid PNG/JPEG input at or below the inline limit is preserved byte-for-byte; all other accepted input follows a fixed deterministic resize/JPEG sequence.
func NormalizeImageContext ¶
NormalizeImageContext is NormalizeImage with cancellation checks around decode and throughout bounded resize work.
func ResolveImage ¶
ResolveImage opens and normalizes one stable Workspace image reference.
type Kind ¶
type Kind uint8
Kind classifies a Workspace attachment without reading its content eagerly.
type Reference ¶
Reference is the immutable path and kind retained by a Composer element.
func NormalizeReference ¶
NormalizeReference validates a Workspace-relative reference, denies private VCS metadata, and derives its kind from the normalized path.
type Resolved ¶
type Resolved struct {
// contains filtered or unexported fields
}
Resolved is one final-handle-resolved Workspace attachment. Exactly one content accessor succeeds according to Kind.
func NewResolvedImage ¶
NewResolvedImage validates a normalized Workspace image result for resolver adapters and tests. Production Workspace reads are created by Resolve.
func NewResolvedText ¶
NewResolvedText validates a detached text result for resolver adapters and tests. Production Workspace reads are created by Resolve.
type Snapshot ¶
Snapshot is one bounded, detached discovery result.
func Discover ¶
Discover returns bounded, path-sorted regular Workspace files without following symbolic links or reading file contents.
type Text ¶
Text is one final-handle-resolved Workspace text attachment.
func ResolveText ¶
ResolveText opens and reads one stable text reference through the Workspace tree.
func (Text) PromptText ¶
PromptText returns a provider-neutral text part with bounded provenance.