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
- Variables
- func Decode(data []byte, out any) error
- func ValidEnvironmentEntry(name, value string) bool
- func ValidateInitialFiles(files []InitialFile) error
- func ValidatePlugins(plugins []Plugin) error
- func ValidateSkills(skills []Skill) error
- type InitialFile
- type InitialFileMetadata
- type Plugin
- type Setup
- type SetupCommand
- type Skill
- type SkillMetadata
Constants ¶
const MaxInitialFileBytes = 50 << 20
MaxInitialFileBytes bounds one installed initial file, including a copied source File.
Variables ¶
var ErrInvalid = errors.New("invalid environment configuration")
ErrInvalid reports configuration that breaks a rule of this package.
Functions ¶
func Decode ¶
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
ValidEnvironmentEntry reports whether an environment variable may be set.
func ValidateInitialFiles ¶
func ValidateInitialFiles(files []InitialFile) error
func ValidatePlugins ¶
func ValidateSkills ¶
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) 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 ¶
Validate checks requested configuration, where a Skill may still be an unresolved reference.
func (Setup) ValidateInstalled ¶
ValidateInstalled checks installable configuration: every Skill carries its concrete metadata and frozen archive.
type SetupCommand ¶
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.