environmentconfig

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 13 Imported by: 0 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 environmentconfig owns the Environment configuration vocabulary: setup (env, setup commands, packages and capability directories), Skills, Plugins and initial files, with their validation and public metadata projections. Sealing, reference resolution, Session freezing and storage belong to their owners.

Index

Constants

View Source
const MaxInitialFileBytes = 50 << 20

MaxInitialFileBytes bounds one installed initial file, including a copied source File.

Variables

View Source
var ErrInvalid = errors.New("invalid environment configuration")

ErrInvalid reports configuration that breaks a rule of this package.

Functions

func Decode

func Decode(data []byte, out any) error

Decode reads stored configuration JSON into out. It rejects removed configuration fields instead of silently dropping them, and fails with ErrInvalid for invalid JSON, unknown fields or a mismatched shape.

func ValidEnvironmentEntry added in v0.0.13

func ValidEnvironmentEntry(name, value string) bool

ValidEnvironmentEntry reports whether an environment variable may be set.

func ValidateInitialFiles

func ValidateInitialFiles(files []InitialFile) error

func ValidatePlugins

func ValidatePlugins(plugins []Plugin) error

func ValidateSkills

func ValidateSkills(skills []Skill) error

ValidateSkills checks requested Skills, where a reference names a Skill and an optional version or "latest".

Types

type InitialFile

type InitialFile struct {
	Type   string `json:"type"`
	Path   string `json:"path"`
	FileID string `json:"file_id,omitempty"`
	Data   []byte `json:"data,omitempty"`
}

InitialFile keeps confidential input separate from ordinary Session configuration.

type InitialFileMetadata

type InitialFileMetadata struct {
	ID        string `json:"id,omitempty"`
	Type      string `json:"type"`
	Path      string `json:"path"`
	FileID    string `json:"file_id,omitempty"`
	SizeBytes *int64 `json:"size_bytes,omitempty"`
}

InitialFileMetadata is the public description of an initial file. ID is set once a Session freezes the file.

func InitialFilesMetadata

func InitialFilesMetadata(files []InitialFile) []InitialFileMetadata

InitialFilesMetadata describes requested files in order; only inline files know their size before a Session freezes them.

type Plugin

type Plugin struct {
	Metadata proto.PluginMetadata `json:"metadata"`
	Archive  []byte               `json:"archive"`
}

Plugin separates safe identity from confidential immutable input.

type Setup

type Setup struct {
	Env                   map[string]string      `json:"env,omitempty"`
	Commands              []SetupCommand         `json:"setup_commands,omitempty"`
	Packages              v1.EnvironmentPackages `json:"packages"`
	Skills                []Skill                `json:"skills,omitempty"`
	Plugins               []Plugin               `json:"plugins,omitempty"`
	CapabilityDirectories []string               `json:"capability_directories,omitempty"`
}

Setup is confidential input, never ordinary resource metadata. Core freezes it once; the common Runtime initializer executes it in order.

func (Setup) Empty

func (s Setup) Empty() bool

func (Setup) PackageMetadata

func (s Setup) PackageMetadata() v1.EnvironmentPackages

PackageMetadata returns the public package lists, empty rather than null.

func (Setup) PluginMetadata

func (s Setup) PluginMetadata() []proto.PluginMetadata

PluginMetadata returns the public metadata of every Plugin in order.

func (Setup) SkillMetadata

func (s Setup) SkillMetadata() []SkillMetadata

SkillMetadata returns the public metadata of every Skill in order.

func (Setup) Validate

func (s Setup) Validate() error

Validate checks requested configuration, where a Skill may still be an unresolved reference.

func (Setup) ValidateInstalled

func (s Setup) ValidateInstalled() error

ValidateInstalled checks installable configuration: every Skill carries its concrete metadata and frozen archive.

type SetupCommand

type SetupCommand struct {
	Command string `json:"command"`
	CWD     string `json:"cwd,omitempty"`
}

type Skill

type Skill struct {
	Metadata SkillMetadata `json:"metadata"`
	Archive  []byte        `json:"archive,omitempty"`
}

Skill keeps confidential content separate from public metadata. A template reference has no archive; a committed Session always has frozen bytes.

func (Skill) InstallationMetadata

func (s Skill) InstallationMetadata() proto.SkillMetadata

InstallationMetadata removes public reference identity at the installer boundary.

type SkillMetadata

type SkillMetadata struct {
	Type        string `json:"type"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	SkillID     string `json:"skill_id,omitempty"`
	Version     string `json:"version,omitempty"`
}

SkillMetadata is either template intent or concrete installed metadata. References acquire their name, description and concrete version at Session commit.

func (SkillMetadata) ValidateInstalled

func (m SkillMetadata) ValidateInstalled() error

ValidateInstalled checks the metadata of an installed Skill: an inline Skill or a reference resolved to a concrete version.

Jump to

Keyboard shortcuts

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