config

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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 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"`
	DefaultMode string           `yaml:"mode,omitempty"`
}

func DefaultConfig

func DefaultConfig() Config

func Load

func Load() (*Config, error)

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 MetadataConfig

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

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