config

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthMethodsByType = map[ProviderType][]AuthMethod{
	ProviderTypeAnthropic:        {AuthMethodAPIKey},
	ProviderTypeOpenAI:           {AuthMethodAPIKey},
	ProviderTypeGoogle:           {AuthMethodAPIKey, AuthMethodOAuth},
	ProviderTypeOpenAICompatible: {AuthMethodAPIKey, AuthMethodNone},
}

AuthMethodsByType maps provider type to valid auth methods. Note: OAuth is only offered for Google (which has a public device flow). Anthropic and OpenAI do not support OAuth for third-party apps.

View Source
var DefaultModelByType = map[ProviderType]string{
	ProviderTypeAnthropic: "claude-sonnet-4-20250514",
	ProviderTypeOpenAI:    "gpt-4o",
	ProviderTypeGoogle:    "gemini-2.5-pro",
}

DefaultModelByType maps provider type to its most popular model.

Functions

func ClearSession added in v0.2.0

func ClearSession() error

ClearSession removes the saved session file.

func ConfigDir

func ConfigDir() string

func ConfigPath

func ConfigPath() string

func ExportSession added in v1.4.0

func ExportSession(s *Session, path string) error

ExportSession writes the session as JSON to the given file path.

func FormatCapabilities added in v1.1.0

func FormatCapabilities(m ModelSummary) string

FormatCapabilities returns a human-readable capability string. e.g. "200K context | tools | vision | reasoning"

func SaveSession added in v0.2.0

func SaveSession(s *Session) error

SaveSession writes the session to disk.

func SessionPath added in v0.2.0

func SessionPath() string

SessionPath returns the path to the session file.

Types

type AuthMethod

type AuthMethod string
const (
	AuthMethodAPIKey AuthMethod = "api_key"
	AuthMethodOAuth  AuthMethod = "oauth"
	AuthMethodNone   AuthMethod = "none"
)

type Config

type Config struct {
	Providers   []ProviderConfig `yaml:"providers"`
	Consensus   ConsensusConfig  `yaml:"consensus"`
	TUI         TUIConfig        `yaml:"tui"`
	Metadata    MetadataConfig   `yaml:"metadata,omitempty"`
	Roles       RolesConfig      `yaml:"roles,omitempty"`
	Routing     RoutingConfig    `yaml:"routing,omitempty"`
	Hooks       HooksConfig      `yaml:"hooks,omitempty"`
	DefaultMode string           `yaml:"mode,omitempty"`
	MCP         MCPConfig        `yaml:"mcp,omitempty"`
}

func DefaultConfig

func DefaultConfig() Config

func Load

func Load() (*Config, error)

func LoadFrom added in v1.0.0

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

LoadFrom reads and parses a config file from the given path.

func (*Config) PrimaryProvider

func (c *Config) PrimaryProvider() *ProviderConfig

func (*Config) Save

func (c *Config) Save() error

func (*Config) Validate

func (c *Config) Validate() error

type ConsensusConfig

type ConsensusConfig struct {
	Timeout       time.Duration `yaml:"-"`
	TimeoutRaw    string        `yaml:"timeout"`
	MinResponses  int           `yaml:"min_responses"`
	Verify        bool          `yaml:"verify,omitempty"`
	VerifyCommand string        `yaml:"verify_command,omitempty"`
}

type HooksConfig added in v1.0.0

type HooksConfig struct {
	PreQuery  string `yaml:"pre_query,omitempty"`
	PostQuery string `yaml:"post_query,omitempty"`
	PostTool  string `yaml:"post_tool,omitempty"`
	OnError   string `yaml:"on_error,omitempty"`
}

HooksConfig defines shell commands to run at lifecycle events.

type MCPConfig added in v1.0.0

type MCPConfig struct {
	Servers []MCPServerConfig `yaml:"servers,omitempty"`
}

MCPConfig holds MCP client configuration.

type MCPServerConfig added in v1.0.0

type MCPServerConfig struct {
	Name    string   `yaml:"name"`
	Command string   `yaml:"command,omitempty"` // for stdio transport
	Args    []string `yaml:"args,omitempty"`
	URL     string   `yaml:"url,omitempty"` // for SSE transport
}

MCPServerConfig defines an external MCP server to connect to.

type MetadataConfig

type MetadataConfig struct {
	URL         string        `yaml:"url,omitempty"`
	CacheTTLRaw string        `yaml:"cache_ttl,omitempty"`
	CacheTTL    time.Duration `yaml:"-"`
}

type ModelSummary added in v1.1.0

type ModelSummary struct {
	Name                    string
	MaxInputTokens          int
	SupportsFunctionCalling bool
	SupportsVision          bool
	SupportsReasoning       bool
}

ModelSummary holds display info for a model in the wizard.

type ProviderConfig

type ProviderConfig struct {
	Name           string       `yaml:"name"`
	Type           ProviderType `yaml:"type"`
	Auth           AuthMethod   `yaml:"auth"`
	Model          string       `yaml:"model"`
	Primary        bool         `yaml:"primary,omitempty"`
	BaseURL        string       `yaml:"base_url,omitempty"`
	MaxContext     int          `yaml:"max_context,omitempty"`
	OAuthClientID  string       `yaml:"oauth_client_id,omitempty"`
	OAuthDeviceURL string       `yaml:"oauth_device_url,omitempty"`
	OAuthTokenURL  string       `yaml:"oauth_token_url,omitempty"`
}

type ProviderType

type ProviderType string
const (
	ProviderTypeAnthropic        ProviderType = "anthropic"
	ProviderTypeOpenAI           ProviderType = "openai"
	ProviderTypeGoogle           ProviderType = "google"
	ProviderTypeOpenAICompatible ProviderType = "openai_compatible"
)

type RolesConfig added in v0.2.0

type RolesConfig struct {
	Planner     string `yaml:"planner,omitempty"`
	Researcher  string `yaml:"researcher,omitempty"`
	Implementer string `yaml:"implementer,omitempty"`
	Tester      string `yaml:"tester,omitempty"`
	Reviewer    string `yaml:"reviewer,omitempty"`
}

type RoutingConfig added in v0.2.0

type RoutingConfig struct {
	CalibrationInterval int `yaml:"calibration_interval,omitempty"` // default 10
}

type Session added in v0.2.0

type Session struct {
	Messages  []SessionMessage  `json:"messages"`
	Exchanges []SessionExchange `json:"exchanges"`
	UpdatedAt time.Time         `json:"updated_at"`
}

Session holds the full conversation state for persistence.

func LoadSession added in v0.2.0

func LoadSession() (*Session, error)

LoadSession reads a saved session from disk. Returns nil (no error) if no session file exists.

type SessionExchange added in v0.2.0

type SessionExchange struct {
	Prompt            string            `json:"prompt"`
	ConsensusResponse string            `json:"consensus_response"`
	Individual        map[string]string `json:"individual,omitempty"`
}

SessionExchange is a serializable prompt/response pair for display history.

type SessionMessage added in v0.2.0

type SessionMessage struct {
	Role       string            `json:"role"`
	Content    string            `json:"content"`
	ToolCalls  []ToolCallRecord  `json:"tool_calls,omitempty"`
	ToolResult *ToolResultRecord `json:"tool_result,omitempty"`
}

SessionMessage is a serializable conversation message.

type TUIConfig

type TUIConfig struct {
	Theme          string `yaml:"theme"`
	ShowIndividual bool   `yaml:"show_individual"`
}

type ToolCallRecord added in v0.2.0

type ToolCallRecord struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

ToolCallRecord is a serializable tool call.

type ToolResultRecord added in v0.2.0

type ToolResultRecord struct {
	ToolCallID string `json:"tool_call_id"`
	Output     string `json:"output"`
	Error      string `json:"error,omitempty"`
}

ToolResultRecord is a serializable tool result.

Jump to

Keyboard shortcuts

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