Documentation
¶
Overview ¶
Package attachment owns session-authorized attachment reads. It has no agent, tool, database or sandbox dependency; adapters supply storage and projections.
Index ¶
- type Description
- type DescriptionCache
- type ImageReader
- type Projection
- type Reader
- func (r *Reader) List(ctx context.Context) ([]interfaces.AttachmentDocument, error)
- func (r *Reader) ReadImages(ctx context.Context, documentID string, numbers []int, detail, focus string) ([]interfaces.AttachmentImageRead, error)
- func (r *Reader) Resolve(ctx context.Context, ref string, wait bool) (*interfaces.AttachmentDocument, error)
- func (r *Reader) WaitTimeout() time.Duration
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Description ¶
type Description struct {
Text string `json:"text"`
Detail string `json:"detail"`
Focus string `json:"focus,omitempty"`
Model string `json:"model"`
CreatedAt time.Time `json:"created_at"`
}
Description records the scope of an observation; it is never merged into parsed document text or treated as a complete reading of the image.
type DescriptionCache ¶
type DescriptionCache interface {
Get(ctx context.Context, documentID, key string) (*Description, error)
Put(ctx context.Context, documentID, key string, value Description) error
}
DescriptionCache persists scoped observations alongside their owning document.
type ImageReader ¶
type ImageReader struct {
Model string
Describe func(context.Context, []byte, string) (string, error)
Cache DescriptionCache
// contains filtered or unexported fields
}
ImageReader describes requested images and reuses equivalent prior observations.
type Projection ¶
type Projection interface {
Document(context.Context, *types.TemporaryDocument) (string, error)
Image(
ctx context.Context, doc *types.TemporaryDocument, number int,
data []byte, mime, key string, description *Description,
) (map[string]string, error)
}
Projection is optional. The durable document and cache remain usable when the sandbox is absent, expires, or fails to accept a copy.
type Reader ¶
type Reader struct {
Images *ImageReader
Projection Projection
// contains filtered or unexported fields
}
Reader coordinates authorized attachment reads independently of tools and sandboxes.
func NewReader ¶
func NewReader(store Store, wait time.Duration, readImage func(context.Context, string) ([]byte, error)) *Reader
NewReader binds durable storage to one conversation and its parse wait budget.
func (*Reader) List ¶
func (r *Reader) List(ctx context.Context) ([]interfaces.AttachmentDocument, error)
List loads the authorized inventory once, then resolves each document without waiting or projecting files. Listing must not reload the message history per item.
func (*Reader) ReadImages ¶
func (r *Reader) ReadImages( ctx context.Context, documentID string, numbers []int, detail, focus string, ) ([]interfaces.AttachmentImageRead, error)
ReadImages authorizes the document once, then prepares, describes and projects the requested images concurrently.
func (*Reader) Resolve ¶
func (r *Reader) Resolve(ctx context.Context, ref string, wait bool) (*interfaces.AttachmentDocument, error)
Resolve opens a session attachment, optionally waiting for parsing and syncing its text.
func (*Reader) WaitTimeout ¶
WaitTimeout bounds parsing plus one image batch: the batch is described concurrently, with room for one queue round behind other reads.