distribution

package
v1.0.98 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 30 Imported by: 0

Documentation

Overview

Package distribution owns fixed-schema manifest loading and verified artifact installation for wrapper distributions.

Index

Constants

View Source
const (
	SkillsKey = "skills"
)

Variables

View Source
var DefaultClient *http.Client

DefaultClient overrides the manifest/artifact client in tests. Production uses a standalone net/http client so distribution URLs bypass extensions.

Functions

func CaptureSource

func CaptureSource(ctx context.Context) context.Context

CaptureSource resolves the provider once and stores the result in ctx.

func CurrentPlatformKey

func CurrentPlatformKey() string

CurrentPlatformKey returns the artifact key for this binary.

func Install

func Install(ctx context.Context, manifest *Manifest, opts InstallOptions) errs.TypedError

Install downloads, verifies, and commits the configured Skills and binary resources as one rollback-capable local transaction. The executable is committed last.

func PlatformKey

func PlatformKey(goos, goarch string) string

PlatformKey returns the manifest artifact key for a platform.

func SyncSkills

func SyncSkills(ctx context.Context, manifest *Manifest, opts InstallOptions) errs.TypedError

SyncSkills repairs the managed Skills from a manifest without replacing an already-matching binary.

Types

type Artifact

type Artifact struct {
	URL      string `json:"url"`
	Checksum string `json:"checksum"`
}

Artifact identifies one downloadable resource.

type InstallOptions

type InstallOptions struct {
	ExecutablePath string
	// SkillsDir overrides automatic Agent directory discovery when non-empty.
	SkillsDir    string
	VerifyBinary func(path, version string) error
}

InstallOptions supplies destinations and test seams for a distribution update.

type Manifest

type Manifest struct {
	Schema    int                 `json:"schema"`
	Version   string              `json:"version"`
	Artifacts map[string]Artifact `json:"artifacts"`
	// contains filtered or unexported fields
}

Manifest is schema 1 of the distribution protocol. Unknown JSON fields are ignored so producers can attach metadata without breaking older CLIs; the required fields and artifacts are still validated before use.

type Source

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

Source describes the active update source. The zero value is the npm registry flow; a non-zero Source selects manifest-based distribution.

func ResolveSource

func ResolveSource(ctx context.Context) (Source, errs.TypedError)

ResolveSource reads the optional distribution manifest URL from the registered transport provider. Providers that do not implement exttransport.DistributionProvider, or return an empty URL, yield the zero (npm) Source.

func (Source) FetchManifest

func (s Source) FetchManifest(ctx context.Context) (*Manifest, errs.TypedError)

FetchManifest synchronously loads and validates the source's manifest. Fetch failures are network errors; a fetched body that fails validation is an invalid response.

func (Source) Identity

func (s Source) Identity() string

Identity is a stable fingerprint of the source used to attribute persisted state without storing the URL. The npm source has the empty identity, which also matches state files written before source tracking existed.

func (Source) ManifestMode

func (s Source) ManifestMode() bool

ManifestMode reports whether this source is a manifest distribution.

type SourceSnapshot

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

SourceSnapshot freezes source resolution for one command invocation.

Jump to

Keyboard shortcuts

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