config

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentsConfigFile is the name of the agents configuration file
	AgentsConfigFile = "agents.json"
)
View Source
const (
	// ProjectsConfigFile is the name of the projects configuration file
	ProjectsConfigFile = "projects.json"
)
View Source
const (
	// WorkspaceConfigFile is the name of the workspace configuration file
	WorkspaceConfigFile = "workspace.json"
)

Variables

View Source
var (
	// ErrInvalidPath is returned when a configuration path is invalid or empty
	ErrInvalidPath = errors.New("invalid configuration path")
	// ErrConfigNotFound is returned when the workspace.json file is not found
	ErrConfigNotFound = errors.New("workspace configuration file not found")
	// ErrInvalidConfig is returned when the configuration validation fails
	ErrInvalidConfig = errors.New("invalid workspace configuration")
)
View Source
var (
	// ErrInvalidAgentConfig is returned when the agent configuration is invalid
	ErrInvalidAgentConfig = errors.New("invalid agent configuration")
)
View Source
var (
	// ErrInvalidProjectConfig is returned when the project configuration is invalid
	ErrInvalidProjectConfig = errors.New("invalid project configuration")
)

Functions

func DisplayModelName added in v0.6.0

func DisplayModelName(modelID string) string

DisplayModelName returns just the model name, stripping the provider:: and ::baseURL encoding for human-readable display.

func ParseModelID added in v0.6.0

func ParseModelID(modelID string) (provider, model, baseURL string)

ParseModelID splits a model ID encoded as "provider::model::baseURL" into its components. Returns (provider, model, baseURL). For plain model IDs, provider and baseURL are empty.

Types

type AgentConfigLoader

type AgentConfigLoader interface {
	// Load reads and returns the workspace configuration for the specified agent.
	// Returns an empty configuration (not an error) if the agents.json file doesn't exist.
	// Returns an error if the file exists but is invalid JSON or malformed.
	Load(agentName string) (*workspace.WorkspaceConfiguration, error)
}

AgentConfigLoader loads agent-specific workspace configurations

func NewAgentConfigLoader

func NewAgentConfigLoader(storageDir string) (AgentConfigLoader, error)

NewAgentConfigLoader creates a new agent configuration loader

type Config

type Config interface {
	// Load reads and parses the workspace configuration from workspace.json.
	// Returns ErrConfigNotFound if the workspace.json file doesn't exist.
	// Returns an error if the JSON is malformed or cannot be read.
	Load() (*workspace.WorkspaceConfiguration, error)
}

Config represents a workspace configuration manager. It manages the structure and contents of a workspace configuration directory (typically .kaiden). If the configuration directory does not exist, the config is considered empty.

func NewConfig

func NewConfig(configDir string) (Config, error)

NewConfig creates a new Config for the specified configuration directory. The configDir is converted to an absolute path.

type Merger

type Merger interface {
	// Merge combines two WorkspaceConfiguration objects.
	// The override config takes precedence over the base config.
	// Returns a new merged configuration without modifying the inputs.
	Merge(base, override *workspace.WorkspaceConfiguration) *workspace.WorkspaceConfiguration
}

Merger merges multiple WorkspaceConfiguration objects with proper precedence rules. When merging: - Environment variables: Later configs override earlier ones (by name) - Mounts: Deduplicated by host+target pair (preserves order, no duplicates)

func NewMerger

func NewMerger() Merger

NewMerger creates a new configuration merger

type ProjectConfigLoader

type ProjectConfigLoader interface {
	// Load reads and returns the workspace configuration for the specified project.
	// It first loads the global configuration (empty string "" key), then loads
	// the project-specific configuration, and merges them with project-specific
	// taking precedence.
	// Returns an empty configuration (not an error) if the projects.json file doesn't exist.
	// Returns an error if the file exists but is invalid JSON or malformed.
	Load(projectID string) (*workspace.WorkspaceConfiguration, error)
}

ProjectConfigLoader loads project-specific workspace configurations

func NewProjectConfigLoader

func NewProjectConfigLoader(storageDir string) (ProjectConfigLoader, error)

NewProjectConfigLoader creates a new project configuration loader

Jump to

Keyboard shortcuts

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