config

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package config loads and represents amux configuration: assistant definitions, UI settings, and resolved on-disk paths.

Index

Constants

View Source
const WorkspacesRootEnvVar = "AMUX_WORKSPACES_ROOT"

Variables

View Source
var AgentRegistry = []AgentDef{
	{Name: "claude", DefaultCommand: "claude", InterruptCount: 2, InterruptDelayMs: 200},
	{Name: "codex", DefaultCommand: "codex", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "gemini", DefaultCommand: "gemini", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "amp", DefaultCommand: "amp", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "opencode", DefaultCommand: "opencode", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "droid", DefaultCommand: "droid", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "cline", DefaultCommand: "cline", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "cursor", DefaultCommand: "agent", InterruptCount: 1, InterruptDelayMs: 0},
	{Name: "pi", DefaultCommand: "pi", InterruptCount: 1, InterruptDelayMs: 0},
}

AgentRegistry is the ordered roster of supported agents. The order here defines the preferred display order used throughout the UI. Keep it as the only place new agents are declared.

Functions

func AgentNames added in v0.0.20

func AgentNames() []string

AgentNames returns the canonical agent identifiers in registry (preferred display) order.

func IsRegisteredAgent added in v0.0.20

func IsRegisteredAgent(name string) bool

IsRegisteredAgent reports whether name is a built-in supported agent. It matches the exact (already canonical/lowercase) registry name.

Types

type AgentDef added in v0.0.20

type AgentDef struct {
	Name             string // canonical (lowercase) agent identifier
	DefaultCommand   string // shell command used to launch the agent
	InterruptCount   int    // number of Ctrl-C signals to send (claude needs 2)
	InterruptDelayMs int    // delay between interrupts in milliseconds
}

AgentDef is one entry in the canonical, ordered agent registry. It is the single source of truth for the supported-agent roster: the preferred display order, the built-in default assistant config, the "is this a known chat agent" membership check, and the brand-color lookup are all derived from it. Adding, removing, or renaming an agent here updates every consumer at once.

type AssistantConfig

type AssistantConfig struct {
	Command          string // Shell command to launch the assistant
	InterruptCount   int    // Number of Ctrl-C signals to send (default 1, claude needs 2)
	InterruptDelayMs int    // Delay between interrupts in milliseconds
}

AssistantConfig defines how to launch an AI assistant

type Config

type Config struct {
	Paths         *Paths
	PortStart     int
	PortRangeSize int
	Assistants    map[string]AssistantConfig
	UI            UISettings
}

Config holds the application configuration

func DefaultConfig

func DefaultConfig() (*Config, error)

DefaultConfig returns the default configuration

func (*Config) AssistantNames added in v0.0.14

func (c *Config) AssistantNames() []string

AssistantNames returns assistant IDs in deterministic display order.

func (*Config) IsAssistantKnown added in v0.0.14

func (c *Config) IsAssistantKnown(assistant string) bool

IsAssistantKnown reports whether assistant exists in loaded config.

func (*Config) IsChatAssistant added in v0.0.20

func (c *Config) IsChatAssistant(name string) bool

IsChatAssistant reports whether name should be treated as a chat agent. It is the single source of truth for this predicate so activity detection and the center renderer agree even on the empty-config path: when assistants are loaded it consults the config map; otherwise it falls back to the canonical agent registry rather than reporting false for every agent.

func (*Config) PersistedUISettings added in v0.0.16

func (c *Config) PersistedUISettings() UISettings

PersistedUISettings reads UI settings from disk without mutating in-memory config state.

func (*Config) ResolvedDefaultAssistant added in v0.0.14

func (c *Config) ResolvedDefaultAssistant() string

ResolvedDefaultAssistant returns a valid default assistant name.

func (*Config) SaveAssistants added in v0.0.20

func (c *Config) SaveAssistants() error

SaveAssistants persists the current in-memory Assistants map to the "assistants" config-file section, so a Settings-dialog edit to an assistant's command survives a restart. It mirrors SaveUISettings (the only existing config-save path before this): read-modify-write via fsatomic.WriteJSON, refusing to touch a malformed existing file rather than silently dropping the unrelated "ui" section a hand-edit may have added.

func (*Config) SaveUISettings

func (c *Config) SaveUISettings() error

SaveUISettings persists UI settings to the config file.

type Paths

type Paths struct {
	Home           string // ~/.amux
	WorkspacesRoot string // ~/.amux/workspaces
	RegistryPath   string // ~/.amux/projects.json
	MetadataRoot   string // ~/.amux/workspaces-metadata
	ConfigPath     string // ~/.amux/config.json
}

Paths holds all the file system paths used by the application

func DefaultPaths

func DefaultPaths() (*Paths, error)

DefaultPaths returns the default paths configuration

func (*Paths) EnsureDirectories

func (p *Paths) EnsureDirectories() error

EnsureDirectories creates all required directories if they don't exist

type UISettings

type UISettings struct {
	ShowKeymapHints  bool
	Theme            string // Theme ID, defaults to "gruvbox"
	TmuxServer       string
	TmuxConfigPath   string
	TmuxSyncInterval string
	// NotifyOnDone rings a terminal bell when an agent finishes. Default off so
	// existing users are not surprised by sound.
	NotifyOnDone bool
}

UISettings stores user-facing display preferences.

Jump to

Keyboard shortcuts

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