oci

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaTypeSkillArtifact = "application/vnd.agentskills.skill.v1"
	MediaTypeSkillConfig   = "application/vnd.agentskills.skill.config.v1+json"
	MediaTypeSkillContent  = "application/vnd.agentskills.skill.content.v1.tar+gzip"
	MediaTypeCollection    = "application/vnd.agentskills.collection.v1"

	AnnotationSkillName          = "io.agentskills.skill.name"
	AnnotationSkillCompatibility = "io.agentskills.skill.compatibility"
	AnnotationSkillRef           = "io.agentskills.skill.ref"
	AnnotationCollectionName     = "io.agentskills.collection.name"
)
View Source
const SupportedSchemaVersion = "1"

SupportedSchemaVersion is the only schemaVersion this implementation understands. Per §4.2, clients must reject unknown values rather than guessing at forward compatibility.

Variables

View Source
var (
	ErrInvalidConfig        = errors.New("invalid skill config")
	ErrUnsupportedSchemaVer = fmt.Errorf("%w: unsupported schemaVersion", ErrInvalidConfig)
	ErrInvalidName          = fmt.Errorf("%w: invalid name", ErrInvalidConfig)
	ErrFieldTooLong         = fmt.Errorf("%w: field exceeds maximum length", ErrInvalidConfig)
)

Validation errors. Sentinels so callers can branch with errors.Is.

View Source
var (
	ErrNotFound     = errors.New("skill: artifact not found")
	ErrNotSkill     = errors.New("skill: artifact is not a skill.v1")
	ErrUnauthorized = errors.New("skill: unauthorized")
)

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	Config  Config
	Content io.ReadCloser
	Digest  string
	Tag     string
}

func Pack

func Pack(skillDir string) (Artifact, error)

Pack tars a skill directory into an Artifact. The skill's SKILL.md must have YAML frontmatter; its parsed contents become the Config. Symlinks, "..", and non-regular files are rejected (mirrors the security stance of Extractor).

type Client

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

func NewClient

func NewClient() (*Client, error)

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, ref string) (Artifact, error)

func (*Client) PullIndex

func (c *Client) PullIndex(ctx context.Context, ref string) (Index, error)

PullIndex fetches a Skills Collection (an OCI Image Index per §5.1) and returns its parsed contents. The skill artifacts the index references are not pulled — only the index itself.

func (*Client) Push

func (c *Client) Push(ctx context.Context, ref string, art Artifact) (Descriptor, error)

Push uploads a packed skill Artifact to the registry at ref. The ref must include a tag; that tag becomes the skill's version in the published config (spec §4.2).

func (*Client) PushIndex

func (c *Client) PushIndex(ctx context.Context, ref string, index Index) (Descriptor, error)

PushIndex publishes a Skills Collection (an OCI Image Index per §5.1) to a registry. The index references skill manifests by digest; the skills themselves must already be published.

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, ref string) (Descriptor, error)

type Config

type Config struct {
	SchemaVersion string         `json:"schemaVersion"`
	Name          string         `json:"name"`
	Version       string         `json:"version,omitempty"`
	Description   string         `json:"description,omitempty"`
	License       string         `json:"license,omitempty"`
	Compatibility string         `json:"compatibility,omitempty"`
	AllowedTools  []string       `json:"allowedTools,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
}

4.2 https://github.com/ThomasVitale/agents-skills-oci-artifacts-spec#42-config-object-schema

func (Config) Validate

func (c Config) Validate() error

type Descriptor

type Descriptor struct {
	MediaType    string
	ArtifactType string
	Digest       string
	Size         int64
	Annotations  map[string]string
}

type Index

type Index struct {
	Annotations map[string]string `json:"annotations,omitempty"`
	Manifests   []IndexEntry      `json:"manifests"`
}

type IndexEntry

type IndexEntry struct {
	Name        string `json:"name"`                  // from io.agentskills.skill.name
	Ref         string `json:"ref"`                   // from io.agentskills.skill.ref
	Version     string `json:"version,omitempty"`     // from io.agentskills.skill.Version
	Description string `json:"description,omitempty"` // from io.agentskills.skill.description
	Digest      string `json:"digest"`
	Size        int64  `json:"size,omitempty"`
}

type Reference

type Reference struct {
	Registry   string
	Repository string
	Tag        string
	Digest     string
}

func ParseReference

func ParseReference(s string) (Reference, error)

Jump to

Keyboard shortcuts

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