Documentation
¶
Index ¶
Constants ¶
const (
// AgentsConfigFile is the name of the agents configuration file
AgentsConfigFile = "agents.json"
)
const (
// ProjectsConfigFile is the name of the projects configuration file
ProjectsConfigFile = "projects.json"
)
const (
// WorkspaceConfigFile is the name of the workspace configuration file
WorkspaceConfigFile = "workspace.json"
)
Variables ¶
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") )
var ( // ErrInvalidAgentConfig is returned when the agent configuration is invalid ErrInvalidAgentConfig = errors.New("invalid agent configuration") )
var ( // ErrInvalidProjectConfig is returned when the project configuration is invalid ErrInvalidProjectConfig = errors.New("invalid project configuration") )
Functions ¶
func DisplayModelName ¶ added in v0.6.0
DisplayModelName returns just the model name, stripping the provider:: and ::baseURL encoding for human-readable display.
func ParseModelID ¶ added in v0.6.0
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.
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)
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
type ProjectConfigUpdater ¶ added in v0.9.0
type ProjectConfigUpdater interface {
// AddSecret appends secretName to the Secrets list of the given project.
// projectID is "" for the global configuration.
// The call is idempotent: if the secret is already present it is not duplicated.
AddSecret(projectID string, secretName string) error
}
ProjectConfigUpdater adds entries to the per-project configuration file.
func NewProjectConfigUpdater ¶ added in v0.9.0
func NewProjectConfigUpdater(storageDir string) (ProjectConfigUpdater, error)
NewProjectConfigUpdater returns a ProjectConfigUpdater backed by <storageDir>/config/projects.json.
type WorkspaceConfigUpdater ¶ added in v0.9.0
type WorkspaceConfigUpdater interface {
// AddSecret appends secretName to the Secrets list of the workspace config,
// creating the file and directory if they do not yet exist.
// The call is idempotent: if the secret is already present it is not duplicated.
AddSecret(secretName string) error
}
WorkspaceConfigUpdater manages the local workspace configuration file.
func NewWorkspaceConfigUpdater ¶ added in v0.9.0
func NewWorkspaceConfigUpdater(configDir string) (WorkspaceConfigUpdater, error)
NewWorkspaceConfigUpdater returns a WorkspaceConfigUpdater backed by <configDir>/workspace.json.