artifact

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package artifact defines stable storage contracts for binary or textual content referenced by durable Agent messages.

History stores only an artifact ID and safe metadata. Provider adapters open that ID through Store when they need the bytes for a model request. This keeps filesystem paths, object-store details, and encoded binary data out of the provider-neutral message contract.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("artifact: not found")

ErrNotFound reports that an artifact ID is unknown or no longer retained. Store implementations should wrap this value so callers can use errors.Is.

View Source
var StoreSlot = agentslot.One[ArtifactStore]("artifact.store")

StoreSlot is the standard immutable artifact storage ecosystem.

Functions

func NewModule

func NewModule(id string, store ArtifactStore) (agentslot.Module, error)

NewModule wraps one explicit Store implementation for normal AgentSlot assembly. Implementations that own lifecycle resources can instead provide a custom Module with Start and Stop.

Types

type ArtifactStore

type ArtifactStore interface {
	Write(context.Context, WriteRequest) (Metadata, error)
	Open(context.Context, string) (Content, error)
}

ArtifactStore persists immutable content and resolves stable IDs. Write returns only after the content is durable for this Store's documented retention scope. Open never exposes a local path or provider credential.

type Content

type Content struct {
	Metadata Metadata
	Body     io.ReadCloser
}

Content is one opened immutable artifact. The caller must close Body. A successful Store.Open returns metadata whose ID equals the requested ID and whose Size equals the readable content length.

func (Content) Validate

func (c Content) Validate() error

Validate checks the metadata and readable body returned by a Store.

type Metadata

type Metadata struct {
	ID        string
	MediaType string
	Name      string
	Size      int64
}

Metadata is the durable, provider-neutral description of stored content. ID is opaque to consumers. MediaType is a canonical MIME type without parameters. Size is the exact number of stored bytes.

func (Metadata) Validate

func (m Metadata) Validate() error

Validate checks the portable artifact metadata invariants.

type WriteRequest

type WriteRequest struct {
	MediaType string
	Name      string
	Body      io.Reader
}

WriteRequest supplies content for one immutable artifact. Write must consume Body before it returns and must not retain the reader. Name is display-only metadata and may be empty.

func (WriteRequest) Validate

func (r WriteRequest) Validate() error

Validate checks the caller-owned portion of an artifact write.

Directories

Path Synopsis
Package file provides a crash-safe local immutable ArtifactStore.
Package file provides a crash-safe local immutable ArtifactStore.

Jump to

Keyboard shortcuts

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