config

package
v0.0.0-...-237f1dd Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package config manages application configuration from various sources.

Index

Constants

View Source
const (
	// InitFlagFilename is the name of the file that indicates whether the project has been initialized
	InitFlagFilename = "init"
)
View Source
const (
	MaxTokensFallbackDefault = 4096
)

Application constants

Variables

This section is empty.

Functions

func AgencyEnabled

func AgencyEnabled(cfg *Config) bool

func LoadGitHubToken

func LoadGitHubToken() (string, error)

Tries to load Github token from all possible locations

func MarkProjectInitialized

func MarkProjectInitialized() error

MarkProjectInitialized marks the current project as initialized

func ShouldShowInitDialog

func ShouldShowInitDialog() (bool, error)

ShouldShowInitDialog checks if the initialization dialog should be shown for the current directory

func TeamHUDEnabled

func TeamHUDEnabled(cfg *Config) bool

func UpdateAgencyConstitution

func UpdateAgencyConstitution(name string) error

func UpdateAgentModel

func UpdateAgentModel(agentName AgentName, modelID models.ModelID) error

func UpdateTheme

func UpdateTheme(themeName string) error

UpdateTheme updates the theme in the configuration and writes it to the config file.

func Validate

func Validate() error

Validate checks if the configuration is valid and applies defaults where needed.

func ValidateAgencyConfig

func ValidateAgencyConfig(cfg AgencyConfig) error

func WorkingDirectory

func WorkingDirectory() string

WorkingDirectory returns the current working directory from the configuration.

Types

type AgencyConfig

type AgencyConfig struct {
	Enabled             *bool                         `json:"enabled,omitempty"`
	ProductName         string                        `json:"productName,omitempty"`
	CurrentConstitution string                        `json:"currentConstitution,omitempty"`
	SoloConstitution    string                        `json:"soloConstitution,omitempty"`
	Office              OfficeRuntimeConfig           `json:"office,omitempty"`
	Docker              DockerRuntimeConfig           `json:"docker,omitempty"`
	Redis               RedisRuntimeConfig            `json:"redis,omitempty"`
	Ledger              LedgerRuntimeConfig           `json:"ledger,omitempty"`
	Voice               VoiceRuntimeConfig            `json:"voice,omitempty"`
	Schedules           ScheduleDefaultsConfig        `json:"schedules,omitempty"`
	Genesis             GenesisRuntimeConfig          `json:"genesis,omitempty"`
	Constitutions       map[string]AgencyConstitution `json:"constitutions,omitempty"`
}

func DefaultAgencyConfig

func DefaultAgencyConfig(teamCfg TeamConfig, dataDir string) AgencyConfig

type AgencyConstitution

type AgencyConstitution struct {
	Name            string                     `json:"name,omitempty"`
	Description     string                     `json:"description,omitempty"`
	Blueprint       string                     `json:"blueprint,omitempty"`
	TeamTemplate    string                     `json:"teamTemplate,omitempty"`
	Governance      string                     `json:"governance,omitempty"`
	RuntimeMode     string                     `json:"runtimeMode,omitempty"`
	EntryMode       string                     `json:"entryMode,omitempty"`
	DefaultSchedule string                     `json:"defaultSchedule,omitempty"`
	Policies        AgencyConstitutionPolicies `json:"policies,omitempty"`
}

func ActiveConstitution

func ActiveConstitution(cfg *Config) AgencyConstitution

type AgencyConstitutionPolicies

type AgencyConstitutionPolicies struct {
	WakeMode          string `json:"wakeMode,omitempty"`
	ConsensusMode     string `json:"consensusMode,omitempty"`
	PublicationPolicy string `json:"publicationPolicy,omitempty"`
	SpawnMode         string `json:"spawnMode,omitempty"`
	DefaultQuorum     int    `json:"defaultQuorum,omitempty"`
}

type Agent

type Agent struct {
	Model           models.ModelID `json:"model"`
	MaxTokens       int64          `json:"maxTokens"`
	ReasoningEffort string         `json:"reasoningEffort"` // For openai models low,medium,heigh
}

Agent defines configuration for different LLM models and their token limits.

type AgentName

type AgentName string
const (
	AgentCoder      AgentName = "coder"
	AgentSummarizer AgentName = "summarizer"
	AgentTask       AgentName = "task"
	AgentTitle      AgentName = "title"
)

type Config

type Config struct {
	Data         Data                              `json:"data"`
	WorkingDir   string                            `json:"wd,omitempty"`
	MCPServers   map[string]MCPServer              `json:"mcpServers,omitempty"`
	Providers    map[models.ModelProvider]Provider `json:"providers,omitempty"`
	LSP          map[string]LSPConfig              `json:"lsp,omitempty"`
	Agents       map[AgentName]Agent               `json:"agents,omitempty"`
	Team         TeamConfig                        `json:"team,omitempty"`
	Agency       AgencyConfig                      `json:"agency,omitempty"`
	Debug        bool                              `json:"debug,omitempty"`
	DebugLSP     bool                              `json:"debugLSP,omitempty"`
	ContextPaths []string                          `json:"contextPaths,omitempty"`
	TUI          TUIConfig                         `json:"tui"`
	Shell        ShellConfig                       `json:"shell,omitempty"`
	AutoCompact  bool                              `json:"autoCompact,omitempty"`
}

Config is the main configuration structure for the application.

func Get

func Get() *Config

Get returns the current configuration. It's safe to call this function multiple times.

func Load

func Load(workingDir string, debug bool) (*Config, error)

Load initializes the configuration from environment variables and config files. If debug is true, debug mode is enabled and log level is set to debug. It returns an error if configuration loading fails.

type Data

type Data struct {
	Directory string `json:"directory,omitempty"`
}

Data defines storage configuration.

type DockerRuntimeConfig

type DockerRuntimeConfig struct {
	Enabled        *bool  `json:"enabled,omitempty"`
	ComposeProject string `json:"composeProject,omitempty"`
	ComposeFile    string `json:"composeFile,omitempty"`
	Image          string `json:"image,omitempty"`
	SharedVolume   string `json:"sharedVolume,omitempty"`
	Network        string `json:"network,omitempty"`
}

type GenesisRuntimeConfig

type GenesisRuntimeConfig struct {
	ConversationDriven *bool  `json:"conversationDriven,omitempty"`
	AutoResearch       *bool  `json:"autoResearch,omitempty"`
	AutoSkills         *bool  `json:"autoSkills,omitempty"`
	AutoToolBinding    *bool  `json:"autoToolBinding,omitempty"`
	SequentialSpawn    *bool  `json:"sequentialSpawn,omitempty"`
	DefaultTopology    string `json:"defaultTopology,omitempty"`
}

type LSPConfig

type LSPConfig struct {
	Disabled bool     `json:"enabled"`
	Command  string   `json:"command"`
	Args     []string `json:"args"`
	Options  any      `json:"options"`
}

LSPConfig defines configuration for Language Server Protocol integration.

type LedgerRuntimeConfig

type LedgerRuntimeConfig struct {
	Backend        string `json:"backend,omitempty"`
	Path           string `json:"path,omitempty"`
	SnapshotPath   string `json:"snapshotPath,omitempty"`
	ConsensusMode  string `json:"consensusMode,omitempty"`
	DefaultQuorum  int    `json:"defaultQuorum,omitempty"`
	ProjectionFile string `json:"projectionFile,omitempty"`
}

type MCPServer

type MCPServer struct {
	Command string            `json:"command"`
	Env     []string          `json:"env"`
	Args    []string          `json:"args"`
	Type    MCPType           `json:"type"`
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers"`
}

MCPServer defines the configuration for a Model Control Protocol server.

type MCPType

type MCPType string

MCPType defines the type of MCP (Model Control Protocol) server.

const (
	MCPStdio MCPType = "stdio"
	MCPSse   MCPType = "sse"
)

Supported MCP types

type OfficeRuntimeConfig

type OfficeRuntimeConfig struct {
	Enabled              *bool  `json:"enabled,omitempty"`
	Mode                 string `json:"mode,omitempty"`
	AutoBoot             *bool  `json:"autoBoot,omitempty"`
	SharedWorkplace      string `json:"sharedWorkplace,omitempty"`
	StateFile            string `json:"stateFile,omitempty"`
	DefaultWorkspaceMode string `json:"defaultWorkspaceMode,omitempty"`
	AllowSoloFallback    *bool  `json:"allowSoloFallback,omitempty"`
}

type ProjectInitFlag

type ProjectInitFlag struct {
	Initialized bool `json:"initialized"`
}

ProjectInitFlag represents the initialization status for a project directory

type Provider

type Provider struct {
	APIKey   string `json:"apiKey"`
	Disabled bool   `json:"disabled"`
}

Provider defines configuration for an LLM provider.

type RedisRuntimeConfig

type RedisRuntimeConfig struct {
	Enabled       *bool  `json:"enabled,omitempty"`
	Address       string `json:"address,omitempty"`
	DB            int    `json:"db,omitempty"`
	ChannelPrefix string `json:"channelPrefix,omitempty"`
}

type ScheduleDefaultsConfig

type ScheduleDefaultsConfig struct {
	Timezone            string           `json:"timezone,omitempty"`
	DefaultCadence      string           `json:"defaultCadence,omitempty"`
	WakeOnOfficeOpen    *bool            `json:"wakeOnOfficeOpen,omitempty"`
	RequireShiftHandoff *bool            `json:"requireShiftHandoff,omitempty"`
	Windows             []ScheduleWindow `json:"windows,omitempty"`
}

type ScheduleWindow

type ScheduleWindow struct {
	Name  string   `json:"name,omitempty"`
	Days  []string `json:"days,omitempty"`
	Start string   `json:"start,omitempty"`
	End   string   `json:"end,omitempty"`
}

type ShellConfig

type ShellConfig struct {
	Path string   `json:"path,omitempty"`
	Args []string `json:"args,omitempty"`
}

ShellConfig defines the configuration for the shell used by the bash tool.

type TUIConfig

type TUIConfig struct {
	Theme string `json:"theme,omitempty"`
}

TUIConfig defines the configuration for the Terminal User Interface.

type TeamConfig

type TeamConfig struct {
	ActiveTeam       string                  `json:"activeTeam,omitempty"`
	DefaultTemplate  string                  `json:"defaultTemplate,omitempty"`
	DefaultBlueprint string                  `json:"defaultBlueprint,omitempty"`
	CollaborationHUD *bool                   `json:"collaborationHud,omitempty"`
	Templates        map[string]TeamTemplate `json:"templates,omitempty"`
	Blueprints       map[string]TeamTemplate `json:"blueprints,omitempty"`
}

func DefaultTeamConfig

func DefaultTeamConfig() TeamConfig

type TeamPolicies

type TeamPolicies struct {
	CommitMessageFormat  string   `json:"commitMessageFormat,omitempty"`
	MaxWIP               *int     `json:"maxWip,omitempty"`
	HandoffRequires      []string `json:"handoffRequires,omitempty"`
	ReviewRequired       *bool    `json:"reviewRequired,omitempty"`
	AllowsSubagents      *bool    `json:"allowsSubagents,omitempty"`
	DelegationMode       string   `json:"delegationMode,omitempty"`
	LocalChatDefault     string   `json:"localChatDefault,omitempty"`
	ReviewRouting        string   `json:"reviewRouting,omitempty"`
	SynthesisRouting     string   `json:"synthesisRouting,omitempty"`
	AllowsPeerMessaging  *bool    `json:"allowsPeerMessaging,omitempty"`
	AllowsBroadcasts     *bool    `json:"allowsBroadcasts,omitempty"`
	WorkspaceModeDefault string   `json:"workspaceModeDefault,omitempty"`
	LoopStrategy         string   `json:"loopStrategy,omitempty"`
	ConcurrencyBudget    *int     `json:"concurrencyBudget,omitempty"`
	RequiredGates        []string `json:"requiredGates,omitempty"`
}

type TeamRoleTemplate

type TeamRoleTemplate struct {
	Name              string `json:"name"`
	Responsible       string `json:"responsible,omitempty"`
	CurrentFocus      string `json:"currentFocus,omitempty"`
	Profile           string `json:"profile,omitempty"`
	Prompt            string `json:"prompt,omitempty"`
	ReportsTo         string `json:"reportsTo,omitempty"`
	CanSpawnSubagents *bool  `json:"canSpawnSubagents,omitempty"`
}

type TeamTemplate

type TeamTemplate struct {
	Name           string             `json:"name,omitempty"`
	Description    string             `json:"description,omitempty"`
	Category       string             `json:"category,omitempty"`
	Orientation    string             `json:"orientation,omitempty"`
	LeadershipMode string             `json:"leadershipMode,omitempty"`
	SpawnTeammates *bool              `json:"spawnTeammates,omitempty"`
	Roles          []TeamRoleTemplate `json:"roles,omitempty"`
	Policies       TeamPolicies       `json:"policies,omitempty"`
}

type VoiceEngineConfig

type VoiceEngineConfig struct {
	Enabled     *bool    `json:"enabled,omitempty"`
	Command     string   `json:"command,omitempty"`
	Args        []string `json:"args,omitempty"`
	InputMode   string   `json:"inputMode,omitempty"`
	OutputMode  string   `json:"outputMode,omitempty"`
	Language    string   `json:"language,omitempty"`
	Voice       string   `json:"voice,omitempty"`
	AudioFormat string   `json:"audioFormat,omitempty"`
	Timeout     string   `json:"timeout,omitempty"`
}

type VoiceProjectionConfig

type VoiceProjectionConfig struct {
	DefaultRoom           string `json:"defaultRoom,omitempty"`
	TranscriptProjection  *bool  `json:"transcriptProjection,omitempty"`
	AudioProjection       *bool  `json:"audioProjection,omitempty"`
	AutoProjectTranscript *bool  `json:"autoProjectTranscript,omitempty"`
	AutoProjectSynthesis  *bool  `json:"autoProjectSynthesis,omitempty"`
}

type VoiceRuntimeConfig

type VoiceRuntimeConfig struct {
	Enabled              *bool                 `json:"enabled,omitempty"`
	Provider             string                `json:"provider,omitempty"`
	GatewayState         string                `json:"gatewayState,omitempty"`
	AssetDir             string                `json:"assetDir,omitempty"`
	ControlChannel       string                `json:"controlChannel,omitempty"`
	SynthesisChannel     string                `json:"synthesisChannel,omitempty"`
	MeetingTranscriptDir string                `json:"meetingTranscriptDir,omitempty"`
	Projection           VoiceProjectionConfig `json:"projection,omitempty"`
	STT                  VoiceEngineConfig     `json:"stt,omitempty"`
	TTS                  VoiceEngineConfig     `json:"tts,omitempty"`
}

Jump to

Keyboard shortcuts

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