packagekit

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 15 Imported by: ? 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 packagekit supplies portable manifests and dependency preflight. Hosts own discovery, trust storage and activation; adapters own native tools.

Index

Constants

View Source
const ArtifactTree = "tree"

ArtifactTree marks an Artifact whose Path is a directory. Its SHA256 is plugin.DirectoryDigest of that directory, so one entry covers a large vendored tree whose files are not named individually (and may use any case). Trees hold only regular files; symbolic links and special files are rejected.

View Source
const ExecutableRuntime = "process"

ExecutableRuntime is the entrypoint runtime ExecutableManifest declares; the process backend's Profile uses the same name.

View Source
const MaxAuthoredArtifactBytes = 128 << 20

MaxAuthoredArtifactBytes bounds one file read while authoring a manifest.

View Source
const Version = "ext.io/v1"

Variables

This section is empty.

Functions

func FileDigest

func FileDigest(path string) (string, error)

FileDigest returns the SHA-256 (hex) of a regular file of at most MaxAuthoredArtifactBytes.

func IdentityKey

func IdentityKey(id plugin.Identity) string

IdentityKey is the stable, opaque key of a plugin identity: the SHA-256 of its canonical JSON. Hosts use it to name a plugin in records of their own.

func LoadDescriptor

func LoadDescriptor(path string) (plugin.Descriptor, error)

LoadDescriptor reads a descriptor from a package manifest (ext.io/v1) or from a file holding just a descriptor, bounded by plugin.MaxFrameBytes.

func TreeDigest

func TreeDigest(root, dir string) (string, error)

TreeDigest returns plugin.DirectoryDigest of the directory dir (a slash-separated path) under root, for an artifact of kind ArtifactTree. The directory must hold at least one file and only regular files and directories.

Types

type Artifact

type Artifact struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// Kind is empty for a file, or ArtifactTree.
	Kind   string `json:"kind,omitempty"`
	SHA256 string `json:"sha256"`
	OS     string `json:"os,omitempty"`
	Arch   string `json:"arch,omitempty"`
}

type Asset

type Asset struct {
	Artifact string `json:"artifact"`
	Kind     string `json:"kind"`
	Locale   string `json:"locale,omitempty"`
}

type Dependency

type Dependency struct {
	// OS and Arch condition this requirement on an explicit host target. Empty matches any.
	OS   string `json:"os,omitempty"`
	Arch string `json:"arch,omitempty"`
	// Provider selects a package ID across revisions; it is exclusive with Identity.
	Provider  string             `json:"provider,omitempty"`
	Contract  plugin.ContractRef `json:"contract"`
	Operation string             `json:"operation"`
	Identity  *plugin.Identity   `json:"identity,omitempty"`
}

type Entrypoint

type Entrypoint struct {
	Name      string   `json:"name"`
	Runtime   string   `json:"runtime"`
	Artifact  string   `json:"artifact"`
	Protocols []string `json:"protocols"`
}

type Environment

type Environment struct {
	OS             string
	Arch           string
	Runtimes       map[string]plugin.BackendProfile
	SharedVersions map[string]string
}

Environment is supplied by the host. Runtime profiles describe installed implementations; shared versions describe libraries the host actually serves.

type LaunchSelection

type LaunchSelection struct {
	Entrypoint Entrypoint `json:"entrypoint"`
	Artifact   Artifact   `json:"artifact"`
	Protocol   string     `json:"protocol"`
}

type Manifest

type Manifest struct {
	APIVersion string            `json:"apiVersion"`
	Descriptor plugin.Descriptor `json:"-"`
	// License is an optional SPDX license expression. It is descriptive only.
	License            string             `json:"license,omitempty"`
	Artifacts          []Artifact         `json:"artifacts"`
	Entrypoints        []Entrypoint       `json:"entrypoints,omitempty"`
	Requires           []Dependency       `json:"requires,omitempty"`
	Configuration      *schema.Schema     `json:"configuration,omitempty"`
	Payloads           []PayloadSchema    `json:"payloads,omitempty"`
	Assets             []Asset            `json:"assets,omitempty"`
	SharedDependencies []SharedDependency `json:"sharedDependencies,omitempty"`
	// Metadata carries data defined by a consumer, keyed by a namespaced,
	// versioned name such as "kvlite.module/v1"; each value is a JSON object.
	// ext validates only the key shape and the bounds. It never interprets a
	// value, and a value never grants authority, selects a backend or establishes
	// trust. The manifest is part of the package directory, so the trust digest
	// covers metadata. A consumer reads its own key and ignores the rest.
	Metadata map[string]json.RawMessage `json:"metadata,omitempty"`
}

func Decode

func Decode(data []byte) (Manifest, error)

func ExecutableManifest

func ExecutableManifest(id, version string, contracts []plugin.Contract, executable string) (Manifest, error)

ExecutableManifest describes a one-executable package. The executable sits beside plugin.json under its base name, and the artifact is bound to the running GOOS and GOARCH. The revision is "sha256:<digest of the executable>", so any rebuild is a new immutable revision. The entrypoint "main" runs under the process runtime and speaks plugin.APIVersion over JSON lines.

func SourceManifest

func SourceManifest(id, version string, contracts []plugin.Contract, root string, files []string) (Manifest, error)

SourceManifest describes a package of source files and directories that the consumer runs under a runtime it owns; it declares no entrypoint. files are slash-separated paths relative to root, each listed once as an artifact whose name equals its path. A path that names a directory becomes one ArtifactTree artifact (see TreeDigest), which suits large vendored dependency trees; its files may use any case, while the tree's own path follows the lower-case artifact rules. The revision is "sha256:" over the sorted "path digest" pairs (a tree's path carries a trailing slash), so it follows content and names, not the order given.

func (Manifest) Artifact

func (m Manifest) Artifact(name string) (Artifact, bool)

Artifact returns the listed artifact with the given name.

func (Manifest) MarshalJSON

func (m Manifest) MarshalJSON() ([]byte, error)

func (Manifest) Name

func (m Manifest) Name() string

Name is the package identity ID.

func (Manifest) SelectEntrypoint

func (m Manifest) SelectEntrypoint(name string, env Environment) (LaunchSelection, error)

func (Manifest) SourceOnly

func (m Manifest) SourceOnly() bool

SourceOnly reports whether the package ships payload files with no declared entrypoint. The consumer chooses the runtime and the file that starts it.

func (Manifest) Supports

func (m Manifest) Supports(name, version string) bool

Supports reports whether the package serves an exact contract version.

func (*Manifest) UnmarshalJSON

func (m *Manifest) UnmarshalJSON(data []byte) error

func (Manifest) Validate

func (m Manifest) Validate() error

func (Manifest) VerifyArtifacts

func (m Manifest) VerifyArtifacts(root string) error

VerifyArtifacts checks listed contents only. Callers must protect the package against concurrent replacement and authenticate the reviewed manifest itself. A checksum never establishes publisher trust. No executable is launched.

func (Manifest) Version

func (m Manifest) Version() string

Version is the package release version, which may be empty.

func (Manifest) WithReverse

func (m Manifest) WithReverse(reverse []plugin.Contract) (Manifest, error)

WithReverse returns the manifest declaring the host operations its plugin may call (see plugin.Descriptor.Reverse). Declaring progress needs no helper: set Operation.Progress in the contracts given to ExecutableManifest or SourceManifest. A manifest generator writes both as the descriptor's "reverse" list and each operation's "progress" flag.

type PayloadSchema

type PayloadSchema struct {
	Contract  plugin.ContractRef `json:"contract"`
	Operation string             `json:"operation"`
	Input     *schema.Schema     `json:"input,omitempty"`
	Output    *schema.Schema     `json:"output,omitempty"`
}

type Plan

type Plan struct {
	Order    []plugin.Identity `json:"order"`
	Bindings []Resolution      `json:"bindings"`
}

func Resolve

func Resolve(manifests []Manifest) (Plan, error)

Resolve requires unique exact providers and rejects dependency cycles. It returns provider-before-consumer order; it neither executes nor grants access.

func ResolveFor

func ResolveFor(manifests []Manifest, os, arch string) (Plan, error)

ResolveFor resolves only requirements active for the explicit target. Every manifest and requirement is validated, including inactive declarations.

type Resolution

type Resolution struct {
	Consumer    plugin.Identity `json:"consumer"`
	Requirement Dependency      `json:"requirement"`
	Provider    plugin.Identity `json:"provider"`
}

type SharedDependency

type SharedDependency struct {
	Name     string   `json:"name"`
	Versions []string `json:"versions"`
}

SharedDependency declares exact host-provided frontend versions accepted by this package. Hosts resolve richer release ranges before constructing this.

Directories

Path Synopsis
Package author builds and seals packages without selecting a product or contract.
Package author builds and seals packages without selecting a product or contract.

Jump to

Keyboard shortcuts

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