artifact

package
v0.1.53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package artifact stores durable chat attachments and tool images beside the workspace registry.

Index

Constants

View Source
const MaxAttachmentBytes = 16 << 20
View Source
const MaxBytes = 8 << 20
View Source
const MaxUploadChunk = 384 << 10
View Source
const UploadVersion = 1

Variables

View Source
var ErrImageLimit = errors.New("capture exceeds the supported image size")
View Source
var ErrStorageFull = errors.New("workspace attachment storage is full; remove unneeded chats before adding more files")
View Source
var ErrUpload = errors.New("invalid attachment upload")
View Source
var ErrUploadConflict = errors.New("attachment upload differs from its saved content")

Functions

This section is empty.

Types

type Content

type Content struct {
	Record
	Data []byte `json:"data"`
}

type Record

type Record struct {
	ID        string    `json:"id"`
	ChatID    string    `json:"chatId,omitempty"`
	Mime      string    `json:"mime"`
	Bytes     int       `json:"bytes"`
	Width     int       `json:"width"`
	Height    int       `json:"height"`
	CreatedAt time.Time `json:"createdAt"`
	Kind      string    `json:"kind,omitempty"`
	Name      string    `json:"name,omitempty"`
	SHA256    string    `json:"sha256,omitempty"`
}

func (Record) FileName

func (r Record) FileName() string

FileName also describes the portable artifact entry. Old captures retain their original .png layout. A safe extension lets native tools recognize uploaded files.

type Store

type Store struct {
	// contains filtered or unexported fields
}

func New

func New(db *registry.Store) (*Store, error)

func (*Store) Delete

func (s *Store) Delete(id string) error

Delete rolls back a capture whose metadata could not be committed.

func (*Store) DeleteChat

func (s *Store) DeleteChat(chatID string, retained ...map[string]string) error

func (*Store) Get

func (s *Store) Get(id string) (Content, error)

func (*Store) Reference

func (s *Store) Reference(chatID, id string) (Record, string, error)

func (*Store) ResolveInputs

func (s *Store) ResolveInputs(chatID string, attachments []agent.Attachment) ([]agent.Attachment, error)

func (*Store) SaveImage

func (s *Store) SaveImage(chatID string, img image.Image) (Record, error)

func (*Store) Upload

func (s *Store) Upload(chatID, id string, req UploadChunk) (UploadState, error)

type UploadChunk

type UploadChunk struct {
	Name   string `json:"name"`
	Mime   string `json:"mime"`
	Bytes  int    `json:"bytes"`
	SHA256 string `json:"sha256"`
	Offset int    `json:"offset"`
	Data   []byte `json:"data"`
}

UploadChunk is replayable after a lost response. Bytes never enter the registry or a turn request; only the completed, verified reference does.

type UploadState

type UploadState struct {
	Record
	Offset   int  `json:"offset"`
	Complete bool `json:"complete"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL