packaging

package
v0.4.1-0...-f3557d3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package packaging handles agent package creation, verification, and installation.

Index

Constants

View Source
const (
	ManifestFile  = "manifest.json"
	ContentFile   = "content.tar.gz"
	SignatureFile = "signature"
	FormatVersion = 1
)

Variables

This section is empty.

Functions

func GenerateKeyPair

func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)

GenerateKeyPair generates a new Ed25519 key pair.

func LoadPrivateKey

func LoadPrivateKey(path string) (ed25519.PrivateKey, error)

LoadPrivateKey loads a private key from a PEM file.

func LoadPublicKey

func LoadPublicKey(path string) (ed25519.PublicKey, error)

LoadPublicKey loads a public key from a PEM file.

func SavePrivateKey

func SavePrivateKey(path string, key ed25519.PrivateKey) error

SavePrivateKey saves a private key to a PEM file.

func SavePublicKey

func SavePublicKey(path string, key ed25519.PublicKey) error

SavePublicKey saves a public key to a PEM file.

func Verify

func Verify(pkg *Package, publicKey ed25519.PublicKey) error

Verify verifies package signature.

Types

type Author

type Author struct {
	Name           string `json:"name,omitempty"`
	Email          string `json:"email,omitempty"`
	KeyFingerprint string `json:"key_fingerprint,omitempty"`
}

Author represents package author information.

type Input

type Input struct {
	Required    bool     `json:"required,omitempty"`
	Default     string   `json:"default,omitempty"`
	Type        string   `json:"type,omitempty"`
	Description string   `json:"description,omitempty"`
	Enum        []string `json:"enum,omitempty"`
}

Input represents a package input parameter.

type InstallOptions

type InstallOptions struct {
	PackagePath string
	TargetDir   string // Default: ~/.agent/packages/
	PublicKey   ed25519.PublicKey
	NoDeps      bool
	DryRun      bool
}

InstallOptions configures package installation.

type InstallResult

type InstallResult struct {
	Installed    []string // Package names installed
	Dependencies []string // Dependency names (for display)
	InstallPath  string   // Where package was installed
}

InstallResult contains installation results.

func Install

func Install(opts InstallOptions) (*InstallResult, error)

Install installs a package.

type Manifest

type Manifest struct {
	Format       int               `json:"format"`
	Name         string            `json:"name"`
	Version      string            `json:"version"`
	Description  string            `json:"description,omitempty"`
	Author       *Author           `json:"author,omitempty"`
	License      string            `json:"license,omitempty"`
	Inputs       map[string]Input  `json:"inputs,omitempty"`
	Outputs      map[string]Output `json:"outputs,omitempty"`
	Requires     *Requirements     `json:"requires,omitempty"`
	Dependencies map[string]string `json:"dependencies,omitempty"`
	CreatedAt    string            `json:"created_at"`
}

Manifest represents the public API of an agent package.

type Output

type Output struct {
	Type        string `json:"type,omitempty"`
	Description string `json:"description,omitempty"`
}

Output represents a package output.

type PackOptions

type PackOptions struct {
	SourceDir   string
	OutputPath  string
	PrivateKey  ed25519.PrivateKey
	Author      *Author
	Description string
	License     string
}

PackOptions configures package creation.

type Package

type Package struct {
	Manifest  *Manifest
	Content   []byte // tar.gz of agent files
	Signature []byte // Raw Ed25519 signature (64 bytes)
	Path      string
}

Package represents a loaded agent package.

func Load

func Load(path string) (*Package, error)

Load loads a package from a .agent file.

func LoadByName

func LoadByName(baseDir, name string) (*Package, error)

LoadByName loads a package by name from a base directory.

func LoadFromPath

func LoadFromPath(path string) (*Package, error)

LoadFromPath loads a package from a file path (convenience wrapper for Load).

func Pack

func Pack(opts PackOptions) (*Package, error)

Pack creates an agent package from a directory.

func (*Package) ExtractToTemp

func (p *Package) ExtractToTemp() (string, error)

ExtractToTemp extracts package contents to a temporary directory.

func (*Package) GetAgentfile

func (p *Package) GetAgentfile() ([]byte, error)

GetAgentfile returns the Agentfile content from the package.

func (*Package) GetConfig

func (p *Package) GetConfig() ([]byte, error)

GetConfig returns the agent.json config from the package.

func (*Package) GetFile

func (p *Package) GetFile(name string) ([]byte, error)

GetFile reads a specific file from the package content.

func (*Package) GetPolicy

func (p *Package) GetPolicy() ([]byte, error)

GetPolicy returns the policy.toml from the package.

type Requirements

type Requirements struct {
	Profiles []string `json:"profiles,omitempty"`
	Tools    []string `json:"tools,omitempty"`
}

Requirements represents runtime requirements.

Jump to

Keyboard shortcuts

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