config

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ProjectConfigDir = ".aimux"

ProjectConfigDir is the directory name for project-local config.

Variables

View Source
var SupportedProviders = []string{"claude", "codex"}

SupportedProviders is the canonical list of provider names aimux recognises. Add a new entry here when onboarding a new provider — tests and validation derive from this list automatically.

Functions

func AgentConfigNames added in v0.13.0

func AgentConfigNames(agents []AgentConfig) []string

AgentConfigNames returns sorted names from a list of agent configs.

func DefaultPath

func DefaultPath() string

DefaultPath returns the default config file path: ~/.aimux/config.yaml

func ModeFlags added in v0.13.0

func ModeFlags(mode string) []string

ModeFlags returns the CLI flags for a given permission mode. Used by provider.SpawnCommand, controller.ResumeCommand, and CLI spawn.

func ShellRCPrefix

func ShellRCPrefix(shell string) string

ShellRCPrefix returns a shell command prefix that sources the user's RC file. This ensures shell functions and env vars are available when running commands via login shell (zsh -lc alone doesn't source .zshrc for non-interactive shells).

Types

type APNsConfig added in v0.14.0

type APNsConfig struct {
	KeyFile string `yaml:"key_file"` // token signing key (.p8) from the Apple Developer account
	KeyID   string `yaml:"key_id"`
	TeamID  string `yaml:"team_id"`
	Topic   string `yaml:"topic"` // the app's bundle id
}

APNsConfig sends approvals to the aimux iPhone app through Apple.

type AgentConfig added in v0.13.0

type AgentConfig struct {
	Name      string   `yaml:"name"`
	Runtime   string   `yaml:"runtime"`
	Inference string   `yaml:"inference,omitempty"`
	Model     string   `yaml:"model,omitempty"`
	Prompt    string   `yaml:"prompt,omitempty"`
	MCP       []string `yaml:"mcp,omitempty"`
	Skills    []string `yaml:"skills,omitempty"`
	Policy    string   `yaml:"policy,omitempty"`
}

AgentConfig defines a named agent configuration loaded from agents.yaml.

func LoadAgents added in v0.13.0

func LoadAgents(path string) ([]AgentConfig, error)

LoadAgents reads agent configs from a YAML file. Returns nil, nil if the file does not exist.

func LoadAgentsMerged added in v0.13.0

func LoadAgentsMerged(globalPath, projectPath string) []AgentConfig

LoadAgentsMerged loads agents from global and project-local files, merging them with project-local configs overriding global ones by name.

type BadgeRule added in v0.11.0

type BadgeRule struct {
	Path     string `yaml:"path"`
	JSONPath string `yaml:"json_path"`
	Label    string `yaml:"label"`
	Color    string `yaml:"color"`
}

BadgeRule maps a project file path to a badge display.

type Config

type Config struct {
	Providers        map[string]ProviderConfig    `yaml:"providers"`
	RefreshInterval  string                       `yaml:"refresh_interval"`
	Runtime          string                       `yaml:"runtime"`            // WHERE: "local" or "container" (default: local)
	Execution        string                       `yaml:"execution"`          // WHERE tools run: "local" or "hybrid" (default: local)
	Shell            string                       `yaml:"shell"`              // WHICH shell: e.g. "/bin/zsh" (default: $SHELL)
	SessionManager   string                       `yaml:"session_manager"`    // SESSION: "tmux" or "direct" (default: tmux)
	DefaultMode      string                       `yaml:"default_mode"`       // PERMISSIONS: "default", "bypass", "plan", "acceptEdits", "dontAsk"
	Export           ExportConfig                 `yaml:"export"`             // OTEL export settings
	OTELReceiver     OTELReceiverConfig           `yaml:"otel"`               // OTEL receiver settings
	Resume           ResumeConfig                 `yaml:"resume"`             // resume defaults
	Sessions         SessionsConfig               `yaml:"sessions"`           // session history settings
	Notifications    NotificationsConfig          `yaml:"notifications"`      // macOS notification settings
	Kubernetes       K8sProviderConfig            `yaml:"kubernetes"`         // Kubernetes provider settings
	Remote           RemoteConfig                 `yaml:"remote"`             // Remote backend (OpenShell or K8s)
	RemoteAccess     RemoteAccessConfig           `yaml:"remote_access"`      // API for clients on other devices
	QuickLaunch      QuickLaunchConfig            `yaml:"quick_launch"`       // quick launch directories
	Tasks            TasksConfig                  `yaml:"tasks"`              // Google Tasks integration
	AutoArchiveAfter string                       `yaml:"auto_archive_after"` // idle duration before auto-archiving (e.g. "1h", "30m")
	Badges           []BadgeRule                  `yaml:"badges"`             // project file badge rules
	Runtimes         map[string]RuntimeConfig     `yaml:"runtimes"`           // named runtime environments
	ROI              ROIConfig                    `yaml:"roi"`                // per-session ROI settings
	Coordination     CoordinationConfig           `yaml:"coordination"`       // coordination backend settings
	Environments     map[string]EnvironmentConfig `yaml:"environments"`       // named environments for agent execution
	AgentConfigs     []AgentConfig                `yaml:"-"`                  // loaded from agents.yaml, not config.yaml
}

Config holds the aimux configuration.

func Default

func Default() Config

Default returns the configuration used when no config file is present. All known providers are enabled. The Kubernetes provider is disabled by default because it requires a Redis URL and team ID to be useful. A default "local" environment is always created.

func Load

func Load(path string) (Config, error)

Load reads a YAML config file and merges it with the defaults. If the file does not exist, Default() is returned with no error.

func LoadProject added in v0.11.0

func LoadProject(projectDir string, global Config) (Config, error)

LoadProject reads project-local config from dir/.aimux/config.yaml and merges it over the global config. Project values override global values. If no project config exists, the global config is returned unchanged.

func (Config) ArchiveThreshold added in v0.11.0

func (c Config) ArchiveThreshold() time.Duration

ArchiveThreshold returns the parsed auto-archive duration. Returns 0 if the field is empty, unparseable, or explicitly set to "0".

func (Config) IsProviderEnabled

func (c Config) IsProviderEnabled(name string) bool

IsProviderEnabled returns true if the named provider is enabled in the config. Unknown providers (not in the map) are enabled by default.

func (Config) OTELEndpoint

func (c Config) OTELEndpoint() string

OTELEndpoint returns the OTEL receiver endpoint URL, or "" if disabled.

func (Config) OTELReceiverPort

func (c Config) OTELReceiverPort() int

OTELReceiverPort returns the configured OTEL receiver port, defaulting to 4318.

func (Config) ResolveShell

func (c Config) ResolveShell() string

ResolveShell returns the shell to use for spawning agents in tmux sessions. Priority: config shell > $SHELL env var > /bin/sh (POSIX fallback).

type CoordinationConfig added in v0.13.0

type CoordinationConfig struct {
	RedisURL string `yaml:"redis_url"`
	TeamID   string `yaml:"team_id"`
}

CoordinationConfig holds settings for the multi-agent coordination backend.

type EnvironmentConfig added in v0.13.0

type EnvironmentConfig struct {
	Type       string `yaml:"type"`    // "local", "openshell", "k8s"
	Gateway    string `yaml:"gateway"` // OpenShell gateway URL
	Insecure   bool   `yaml:"insecure"`
	Image      string `yaml:"image"`
	RedisURL   string `yaml:"redis_url"` // K8s only
	Namespace  string `yaml:"namespace"`
	Kubeconfig string `yaml:"kubeconfig"`
}

EnvironmentConfig holds settings for a named environment where agents can execute.

type ExportConfig

type ExportConfig struct {
	Endpoint string            `yaml:"endpoint"`          // OTLP/HTTP endpoint, e.g., "localhost:5001"
	Insecure bool              `yaml:"insecure"`          // true for HTTP (no TLS), default true
	Headers  map[string]string `yaml:"headers,omitempty"` // extra HTTP headers for the export endpoint

	// Backend-specific settings
	MLflow MLflowConfig `yaml:"mlflow,omitempty"` // MLflow-specific config
}

ExportConfig holds settings for exporting traces via OTLP/HTTP.

type K8sMCPConfig added in v0.13.0

type K8sMCPConfig struct {
	AutoRegister bool `yaml:"auto_register"`
}

K8sMCPConfig holds settings for auto-registering the MCP server.

type K8sProviderConfig added in v0.7.0

type K8sProviderConfig struct {
	Enabled      bool         `yaml:"enabled"`
	RedisURL     string       `yaml:"redis_url"`     // e.g. "redis://:pass@localhost:6380"
	TeamID       string       `yaml:"team_id"`       // Redis team key prefix, e.g. "my-team"
	Namespace    string       `yaml:"namespace"`     // K8s namespace, e.g. "agents"
	Kubeconfig   string       `yaml:"kubeconfig"`    // path to kubeconfig; empty = KUBECONFIG env or in-cluster
	OTELEndpoint string       `yaml:"otel_endpoint"` // e.g. "http://<elb>:4318" — OTel Collector for remote agent traces
	MaxAgents    int          `yaml:"max_agents"`
	MaxCostUSD   float64      `yaml:"max_cost_usd"`
	MCP          K8sMCPConfig `yaml:"mcp"`
}

K8sProviderConfig holds connection settings for the Kubernetes agent provider. Agents are discovered via Redis heartbeats rather than local process scanning.

K8s is considered enabled when RedisURL is set (Enabled field is kept for backward compatibility but RedisURL is the real gate).

func (K8sProviderConfig) IsActive added in v0.7.0

func (c K8sProviderConfig) IsActive() bool

IsActive returns true when K8s is configured and usable. Requires both enabled flag and a Redis URL.

type LinksConfig added in v0.14.0

type LinksConfig struct {
	JiraBase     string   `yaml:"jira_base"`     // e.g. https://issues.example.com
	JiraProjects []string `yaml:"jira_projects"` // project keys, e.g. [WID, OPS]
}

LinksConfig tells clients which Jira keys to link. Nothing is linked unless jira_base is set; only keys of a listed project become links, so "UTF-8" never does.

type MLflowConfig

type MLflowConfig struct {
	ExperimentID string `yaml:"experiment_id"` // MLflow experiment ID
}

MLflowConfig holds MLflow-specific export settings.

type NotificationsConfig added in v0.8.0

type NotificationsConfig struct {
	Enabled   bool `yaml:"enabled"`    // master switch (default: true)
	OnWaiting bool `yaml:"on_waiting"` // agent needs permission (default: true)
	OnError   bool `yaml:"on_error"`   // agent crashed (default: true)
	OnIdle    bool `yaml:"on_idle"`    // agent finished turn (default: false)
	OnDone    bool `yaml:"on_done"`    // agent finished (default: true)
	Sound     bool `yaml:"sound"`      // play macOS sound (default: false)
	Bell      bool `yaml:"bell"`       // terminal bell on attention events (default: true)
	Desktop   bool `yaml:"desktop"`    // macOS notification center (default: true)
}

NotificationsConfig controls macOS notification behavior.

type NtfyConfig added in v0.14.0

type NtfyConfig struct {
	Server   string `yaml:"server"`    // default https://ntfy.sh
	Topic    string `yaml:"topic"`     // anyone who knows it can read it on a public server
	TokenEnv string `yaml:"token_env"` // environment variable holding an access token; optional
	ClickURL string `yaml:"click_url"` // web client opened by a tap (default https://<tailnet name>:8443/app/)
}

NtfyConfig publishes approvals to an ntfy topic.

type OTELReceiverConfig

type OTELReceiverConfig struct {
	Enabled bool `yaml:"enabled"` // false by default
	Port    int  `yaml:"port"`    // default 4318
}

OTELReceiverConfig holds settings for the embedded OTLP/HTTP receiver.

type ProviderConfig

type ProviderConfig struct {
	Enabled bool   `yaml:"enabled"`
	Binary  string `yaml:"binary,omitempty"`
}

ProviderConfig controls a single provider's behaviour.

type PushConfig added in v0.14.0

type PushConfig struct {
	Ntfy NtfyConfig `yaml:"ntfy"`
	APNs APNsConfig `yaml:"apns"`
}

PushConfig turns on approval notifications; each sender is on when its topic is set.

type QuickLaunchConfig added in v0.9.0

type QuickLaunchConfig struct {
	Directories []string `yaml:"directories"`
}

QuickLaunchConfig holds directories for quick agent launch.

type ROIConfig added in v0.12.0

type ROIConfig struct {
	HourlyRate float64 `yaml:"hourly_rate"` // developer hourly rate in USD (default: 150)
}

ROIConfig holds settings for per-session ROI calculation.

type RemoteAccessConfig added in v0.14.0

type RemoteAccessConfig struct {
	Port            int        `yaml:"port"`             // on 127.0.0.1 (default 7382)
	AllowedLogins   []string   `yaml:"allowed_logins"`   // Tailscale logins admitted; empty admits nobody
	Hostnames       []string   `yaml:"hostnames"`        // trusted Host names (this machine's tailnet names); default: detected from tailscale
	Adapter         string     `yaml:"adapter"`          // ACP adapter command for Claude sessions
	MaxRuns         int        `yaml:"max_runs"`         // live adapters at once (default 2)
	ApprovalTimeout string     `yaml:"approval_timeout"` // unanswered approvals are denied after this (default 10m)
	Push            PushConfig `yaml:"push"`             // notify phones of approvals; off unless configured

	TerminalInput TerminalInputConfig `yaml:"terminal_input"` // type phone messages into terminal sessions; off unless enabled
	Links         LinksConfig         `yaml:"links"`          // where clients link Jira keys in replies

	// DeviceLogin requires a paired device and Face ID on top of the tailnet
	// check; nil (unset) means on. Read it with DeviceLoginOn.
	DeviceLogin *bool `yaml:"device_login"`
}

func (RemoteAccessConfig) DeviceLoginOn added in v0.14.0

func (c RemoteAccessConfig) DeviceLoginOn() bool

DeviceLoginOn reports whether the remote API requires device login: true unless remote_access.device_login is set to false.

type RemoteConfig added in v0.13.0

type RemoteConfig struct {
	Backend  string `yaml:"backend"`   // "openshell" or "k8s"
	Gateway  string `yaml:"gateway"`   // OpenShell gateway URL
	Image    string `yaml:"image"`     // default sandbox image
	WarmPool int    `yaml:"warm_pool"` // number of pre-created sandboxes
}

type ResumeConfig added in v0.10.0

type ResumeConfig struct {
	SkipPermissions bool `yaml:"skip_permissions"` // always pass --dangerously-skip-permissions
}

ResumeConfig holds defaults for the resume command.

type RuntimeConfig added in v0.11.0

type RuntimeConfig struct {
	Type    string `yaml:"type"`              // "local", "container", "openshell"
	Engine  string `yaml:"engine,omitempty"`  // container engine: "podman" or "docker"
	Image   string `yaml:"image,omitempty"`   // container image
	Sandbox bool   `yaml:"sandbox,omitempty"` // enable sandbox policy (openshell)
}

RuntimeConfig holds settings for a named runtime environment.

type SessionsConfig added in v0.5.0

type SessionsConfig struct {
	AutoTitle  bool   `yaml:"auto_title"`  // generate titles via LLM on discovery
	TitleModel string `yaml:"title_model"` // "haiku" (default), "sonnet", "opus"
	APIKey     string `yaml:"api_key"`     // API key for title generation (overrides env vars)
	// NamingDailyLimit caps automatic titles and descriptions per local day
	// (sessions sent to the model); "Update summary" is not limited.
	NamingDailyLimit int `yaml:"naming_daily_limit"`
}

SessionsConfig holds settings for the session history feature.

type TasksConfig added in v0.9.0

type TasksConfig struct {
	Backend        string `yaml:"backend"`         // "auto", "mcp", or "api"
	MCPEndpoint    string `yaml:"mcp_endpoint"`    // MCP server endpoint URL
	DefaultList    string `yaml:"default_list"`    // default task list ID
	PromptTemplate string `yaml:"prompt_template"` // template for agent prompts
}

TasksConfig holds settings for Google Tasks integration.

type TerminalInputConfig added in v0.14.0

type TerminalInputConfig struct {
	Enabled         bool `yaml:"enabled"`
	AllowWhileInUse bool `yaml:"allow_while_in_use"` // skip the 120 s Mac-idle check
	// AllowSlashCommands lets a message start with "/" (a Claude Code slash
	// command such as /clear). A leading "!" (bash mode) is always refused.
	AllowSlashCommands bool `yaml:"allow_slash_commands"`
	// KeepDrafts keeps a draft left in the input box: a message is refused
	// (draft_in_box) instead of replacing it. Claude Code's grey suggestion
	// is never a draft and is always typed over.
	KeepDrafts bool `yaml:"keep_drafts"`
}

TerminalInputConfig controls typing phone messages into Claude Code sessions open in a terminal. Everything is off by default.

Jump to

Keyboard shortcuts

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