mesnadaconfig

package
v0.100.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mesnadaconfig handles Mesnada application configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfig

func InitConfig(path string) error

InitConfig creates a new configuration file using the embedded template. If path is empty, it uses the default path (~/.mesnada/config.yaml).

Types

type ACPAgentConfig

type ACPAgentConfig struct {
	Name         string            `json:"name" yaml:"name"`
	Title        string            `json:"title" yaml:"title"`
	Command      string            `json:"command" yaml:"command"`
	Args         []string          `json:"args,omitempty" yaml:"args,omitempty"`
	Env          map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	MCPServers   []MCPServerRef    `json:"mcp_servers,omitempty" yaml:"mcp_servers,omitempty"`
	Capabilities ACPCapabilities   `json:"capabilities" yaml:"capabilities"`
}

ACPAgentConfig configuration for a specific ACP agent.

type ACPCapabilities

type ACPCapabilities struct {
	Terminals   bool `json:"terminals" yaml:"terminals"`
	FileAccess  bool `json:"file_access" yaml:"file_access"`
	Permissions bool `json:"permissions" yaml:"permissions"`
}

ACPCapabilities defines what an ACP agent can do.

type ACPConfig

type ACPConfig struct {
	Enabled        bool                      `json:"enabled" yaml:"enabled"`
	DefaultAgent   string                    `json:"default_agent,omitempty" yaml:"default_agent,omitempty"`
	DefaultMode    string                    `json:"default_mode,omitempty" yaml:"default_mode,omitempty"`
	Agents         map[string]ACPAgentConfig `json:"agents,omitempty" yaml:"agents,omitempty"`
	AutoPermission bool                      `json:"auto_permission" yaml:"auto_permission"`
	Server         ACPServerConfig           `json:"server,omitempty" yaml:"server,omitempty"`
}

ACPConfig global ACP configuration.

type ACPServerConfig added in v0.7.0

type ACPServerConfig struct {
	Enabled        bool     `json:"enabled" yaml:"enabled"`
	Transports     []string `json:"transports" yaml:"transports"` // ["stdio", "http"]
	Host           string   `json:"host" yaml:"host"`
	Port           int      `json:"port" yaml:"port"`
	MaxSessions    int      `json:"max_sessions" yaml:"max_sessions"`
	SessionTimeout string   `json:"session_timeout" yaml:"session_timeout"`
	RequireAuth    bool     `json:"require_auth" yaml:"require_auth"`
}

ACPServerConfig holds configuration for the ACP server.

type Config

type Config struct {
	DefaultModel string                  `json:"default_model" yaml:"default_model"`
	Models       []ModelConfig           `json:"models" yaml:"models"`
	Engines      map[string]EngineConfig `json:"engines,omitempty" yaml:"engines,omitempty"`
	ACP          ACPConfig               `json:"acp,omitempty" yaml:"acp,omitempty"`
	TUI          TUIConfig               `json:"tui,omitempty" yaml:"tui,omitempty"`
	Server       ServerConfig            `json:"server" yaml:"server"`
	Orchestrator OrchestratorConfig      `json:"orchestrator" yaml:"orchestrator"`
}

Config holds the application configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

func Load

func Load(path string) (*Config, error)

Load loads configuration from a file (supports JSON and YAML).

func (*Config) Address

func (c *Config) Address() string

Address returns the server address.

func (*Config) GetDefaultModelForEngine

func (c *Config) GetDefaultModelForEngine(engine string) string

GetDefaultModelForEngine returns the default model for an engine.

func (*Config) GetModelByID

func (c *Config) GetModelByID(id string) *ModelConfig

GetModelByID returns a model configuration by ID.

func (*Config) GetModelForEngine

func (c *Config) GetModelForEngine(engine, modelID string) *ModelConfig

GetModelForEngine returns a specific model config for an engine.

func (*Config) GetModelIDsForEngine

func (c *Config) GetModelIDsForEngine(engine string) []string

GetModelIDsForEngine returns a list of model IDs for an engine.

func (*Config) GetModelsForEngine

func (c *Config) GetModelsForEngine(engine string) []ModelConfig

GetModelsForEngine returns the list of available models for a specific engine. If engine-specific models are configured, returns those; otherwise returns the global models list.

func (*Config) Save

func (c *Config) Save(path string) error

Save saves configuration to a file.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the configuration and returns any errors.

func (*Config) ValidateModel

func (c *Config) ValidateModel(id string) bool

ValidateModel checks if a model ID is valid.

func (*Config) ValidateModelForEngine

func (c *Config) ValidateModelForEngine(engine, modelID string) bool

ValidateModelForEngine checks if a model ID is valid for a specific engine.

type EngineConfig

type EngineConfig struct {
	DefaultModel string        `json:"default_model" yaml:"default_model"`
	Models       []ModelConfig `json:"models" yaml:"models"`
}

EngineConfig holds engine-specific configuration.

type MCPServerRef

type MCPServerRef struct {
	Name    string            `json:"name" yaml:"name"`
	Command string            `json:"command" yaml:"command"`
	Args    []string          `json:"args,omitempty" yaml:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
}

MCPServerRef references an MCP server for ACP agents.

type ModelConfig

type ModelConfig struct {
	ID          string `json:"id" yaml:"id"`
	Description string `json:"description" yaml:"description"`
}

ModelConfig defines a model with its description.

type OrchestratorConfig

type OrchestratorConfig struct {
	StorePath        string `json:"store_path" yaml:"store_path"`
	LogDir           string `json:"log_dir" yaml:"log_dir"`
	MaxParallel      int    `json:"max_parallel" yaml:"max_parallel"`
	DefaultMCPConfig string `json:"default_mcp_config" yaml:"default_mcp_config"`
	DefaultEngine    string `json:"default_engine" yaml:"default_engine"`
	PersonaPath      string `json:"persona_path,omitempty" yaml:"persona_path,omitempty"`
}

OrchestratorConfig holds orchestrator configuration.

type ServerConfig

type ServerConfig struct {
	Host string `json:"host" yaml:"host"`
	Port int    `json:"port" yaml:"port"`
}

ServerConfig holds HTTP server configuration.

type TUIConfig

type TUIConfig struct {
	Enabled                     bool `json:"enabled" yaml:"enabled"`
	WebUI                       bool `json:"webui" yaml:"webui"`
	AutoDetectTerminal          bool `json:"auto_detect_terminal" yaml:"auto_detect_terminal"`
	ConfirmQuitWithRunningTasks bool `json:"confirm_quit_with_running_tasks" yaml:"confirm_quit_with_running_tasks"`
}

TUIConfig holds TUI/WebUI integration settings.

Jump to

Keyboard shortcuts

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