agentconfig

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package agentconfig contains the configuration for abyss agents, including loading and validating it from YAML files.

Index

Constants

View Source
const (
	DefaultTLSServerCertPath = "/etc/abyss/tls/server.crt"
	DefaultTLSServerKeyPath  = "/etc/abyss/tls/server.key"
	DefaultTLSCACertPath     = "/etc/abyss/tls/ca.crt"
	DefaultTLSClientCertPath = "/etc/abyss/tls/client.crt"
	DefaultTLSClientKeyPath  = "/etc/abyss/tls/client.key"
)

Default paths where the agent's TLS certificates are stored inside the agent container. The client certificate and key are also stored there so persistent containers can be reconnected to in later sessions.

View Source
const DefaultImage = "ghcr.io/sethcurry/abyss-pi:latest"

DefaultImage is the Docker image used when the agent config does not specify one.

View Source
const DefaultServerPort = 8080

DefaultServerPort is the container port the agent's API server listens on when the config does not specify one.

View Source
const DefaultStartFilePath = "/tmp/abyss.start"

DefaultStartFilePath is the path inside the agent container whose existence signals that the agent has finished starting up.

View Source
const WaitForStartFileSleepDuration = time.Second

WaitForStartFileSleepDuration is how long the client waits between checks for the start file to appear.

Variables

This section is empty.

Functions

func BuildAgentProxyArgs added in v0.0.2

func BuildAgentProxyArgs(cfg *AgentConfig) string

BuildAgentProxyArgs converts the configuration options from a *AgentConfig into a string containing the bash command to run to start the agent proxy inside the container.

Types

type ACPConfig

type ACPConfig struct {
	ToolsOnHost ToolsOnHostConfig `yaml:"tools_on_host"`
}

ACPConfig is the root of the ACP-specific agent configuration.

func (ACPConfig) Validate added in v0.0.2

func (a ACPConfig) Validate() error

Validate implements types.Validator by validating the nested tools-on-host config.

type AgentConfig

type AgentConfig struct {
	Docker       DockerConfig         `yaml:"docker"`
	SetupScripts []SetupScriptsConfig `yaml:"setup_scripts"`
	CopyFiles    []FileCopyConfig     `yaml:"copy_files"`
	ACP          ACPConfig            `yaml:"acp"`
	Websocket    WebsocketConfig      `yaml:"websocket"`
	Plugins      PluginConfig         `yaml:"plugins"`
}

AgentConfig stores the entirety of a single agent's configuration. Its 2 uses are:

  1. To be used in unmarshalling an agent config from YAML
  2. To validate that an unmarshalled config is valid via Validate()

func FromYAMLFile

func FromYAMLFile(path string) (*AgentConfig, error)

FromYAMLFile reads the YAML file at the given path and unmarshals it into an *AgentConfig. Paths are not normalized, so ~ characters will not be expanded.

func (AgentConfig) Validate added in v0.0.2

func (a AgentConfig) Validate() error

Validate implements types.Validator by validating each nested config. Returns an error if any of its attributes return an error from their Validate function.

type DockerConfig

type DockerConfig struct {
	// The Docker image to use.  Can be short or long, Docker will
	// resolve it for short names.
	Image           string          `yaml:"image"`
	ImagePullPolicy ImagePullPolicy `yaml:"image_pull_policy"`
	HostMounts      []HostMount     `yaml:"host_mounts"`
	AgentCommand    []string        `yaml:"agent_command"`

	// PersistentName controls whether a new container is created for each
	// connection, or if the same container is left running and re-used.
	// If empty, a new container is created for each connection.
	PersistentName string `yaml:"persistent_name"`
}

DockerConfig holds the Docker-specific configuration for an agent.

func (DockerConfig) Validate added in v0.0.2

func (d DockerConfig) Validate() error

Validate implements types.Validator by checking the image and each host mount.

type FileCopyConfig

type FileCopyConfig struct {
	// Type is currently either "inline" or "path"
	Type FileCopyType `yaml:"type"`
	// Source is the content or file path of the source
	Source string `yaml:"source"`
	// Target is the destination path on the agent
	Target string `yaml:"target"`
}

FileCopyConfig represents a file to be copied onto an agent, either with inline content or from a source path.

func (FileCopyConfig) Validate added in v0.0.2

func (f FileCopyConfig) Validate() error

Validate implements types.Validator by checking the source, target, and type.

type FileCopyType

type FileCopyType string

FileCopyType is an enum type. It exists solely so UnmarshalYAML can validate the type field.

const (
	// FileCopyTypeInline indicates the file's content is inlined in the config.
	FileCopyTypeInline FileCopyType = "inline"
	// FileCopyTypePath indicates the file's content is read from a path.
	FileCopyTypePath FileCopyType = "path"
)

func (*FileCopyType) UnmarshalYAML

func (t *FileCopyType) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML validates that the Type field is either "inline" or "path".

type HostMount

type HostMount struct {
	Source      string `yaml:"source"`
	Destination string `yaml:"destination"`
}

HostMount maps a directory on the host into the Docker container.

func (HostMount) Validate added in v0.0.2

func (h HostMount) Validate() error

Validate implements types.Validator by checking that the mount source exists and that both source and destination are non-empty.

type ImagePullPolicy added in v0.0.2

type ImagePullPolicy string

ImagePullPolicy controls when Docker pulls the configured image.

const (
	// ImagePullPolicyAlways always pulls the configured image.
	ImagePullPolicyAlways ImagePullPolicy = "Always"
	// ImagePullPolicyIfNotPresent pulls the image only when it is not
	// present locally.
	ImagePullPolicyIfNotPresent ImagePullPolicy = "IfNotPresent"
	// ImagePullPolicyNever never pulls the image.
	ImagePullPolicyNever ImagePullPolicy = "Never"
)

func (ImagePullPolicy) Validate added in v0.0.2

func (p ImagePullPolicy) Validate() error

Validate implements types.Validator by rejecting values outside the allowed set. An empty value is treated as unset and is valid.

type PluginConfig added in v0.0.3

type PluginConfig struct {
	Client []PluginConfigOptions `yaml:"client"`
}

PluginConfig stores configuration for all plugins.

type PluginConfigOptions added in v0.0.3

type PluginConfigOptions struct {
	Path string `yaml:"path"`
}

PluginConfigOptions contains the config for a single plugin.

type SetupScriptType

type SetupScriptType string

SetupScriptType is an enum type. It exists solely so UnmarshalYAML can validate the type field.

const (
	// SetupScriptTypeFile loads the script from a file path.
	SetupScriptTypeFile SetupScriptType = "file"
	// SetupScriptTypeInline treats the source as inline script content.
	SetupScriptTypeInline SetupScriptType = "inline"
)

The valid setup script types.

func (*SetupScriptType) UnmarshalYAML

func (t *SetupScriptType) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML validates that the Type field is either "file" or "inline".

type SetupScriptsConfig

type SetupScriptsConfig struct {
	// Type is either "inline" or "file"
	Type SetupScriptType `yaml:"type"`
	// Source is the script content or file path
	Source string `yaml:"source"`
}

SetupScriptsConfig represents a setup script defined in agent configuration.

func (SetupScriptsConfig) Validate added in v0.0.2

func (s SetupScriptsConfig) Validate() error

Validate implements types.Validator by checking the source and type. An empty type is allowed and treated as inline.

type ToolsOnHostConfig

type ToolsOnHostConfig struct {
	Files    bool `yaml:"files"`
	Terminal bool `yaml:"terminal"`
}

ToolsOnHostConfig holds the boolean flags that toggle the ACP tools that run on the host, such as file and terminal access.

func (ToolsOnHostConfig) Validate added in v0.0.2

func (t ToolsOnHostConfig) Validate() error

Validate implements types.Validator. There is nothing to validate for boolean flags.

type WebsocketConfig added in v0.0.2

type WebsocketConfig struct {
	DisableTLS bool `yaml:"disable_tls"`
}

WebsocketConfig stores websocket-related configuration options like whether TLS is enabled or not.

Jump to

Keyboard shortcuts

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