config

package
v0.20260520.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvOpenAIBaseURL = "OPENAI_BASE_URL"
	EnvOpenAIAPIKey  = "OPENAI_API_KEY"
	EnvModelID       = "MODEL_ID"
)
View Source
const DefaultCompactionThresholdTokens int64 = 131072
View Source
const DefaultResponseLanguage = "English"
View Source
const DefaultSkillSearchMinNormalizedScore = 0.05
View Source
const DefaultSubagentTimeoutMinutes = 20
View Source
const DefaultWebSearchEngine = "duckduckgo"
View Source
const MinCompactionThresholdTokens int64 = 32768

Variables

This section is empty.

Functions

func AllDigits

func AllDigits(s string) bool

func ApplyOnboardMerge

func ApplyOnboardMerge(dst *Root, res *OnboardResult)

func BackupConfig

func BackupConfig() (string, error)

func ClampTimeoutMinutes

func ClampTimeoutMinutes(n int) error

func ConfigExists

func ConfigExists() (bool, error)

func ConfirmOnboardRerun

func ConfirmOnboardRerun(stdin io.Reader, out io.Writer) (bool, error)

func EffectiveCompactionThresholdTokens

func EffectiveCompactionThresholdTokens(r *Root) int64

func EffectiveSkillSearchMinNorm

func EffectiveSkillSearchMinNorm(r *Root) float64

func NeedsOnboard

func NeedsOnboard(r *Root) bool

func NormalizeAPIBase

func NormalizeAPIBase(raw string) (string, error)

func NoteRecentModelUse

func NoteRecentModelUse(r *Root, providerName, modelID string)

func ParseReasoningEffortToken

func ParseReasoningEffortToken(s string) (string, error)

func PickModelInteractive

func PickModelInteractive(stdin io.Reader, out io.Writer, p *Provider, providerLabel string, ids []string, allowSkip bool) (string, error)

func PrintConfigSkipHint

func PrintConfigSkipHint(out io.Writer, topic string)

func ResolveExecConfig

func ResolveExecConfig(existing *Root, opts ExecResolveOpts) (*Root, *Provider, error)

func RunInitialSetup

func RunInitialSetup(stdin io.Reader, out, errOut io.Writer, cfg *Root, configExists bool) error

func Save

func Save(r *Root) error

func SubagentTimeout

func SubagentTimeout(r *Root) int

func WriteConfigSetupWarning

func WriteConfigSetupWarning(w io.Writer, r *Root)

Types

type Current

type Current struct {
	Provider string `toml:"provider"`
	Model    string `toml:"model"`
}

type ExecResolveOpts

type ExecResolveOpts struct {
	EnvFile string
}

type ModelPickChoice

type ModelPickChoice struct {
	ProviderName string
	ModelID      string
	Changed      bool
}

func PickModelAfterAdd

func PickModelAfterAdd(stdin io.Reader, out io.Writer, prevProv, prevModel, newProvName string, newIDs []string, allowSkip bool) (ModelPickChoice, error)

type OnboardOpts

type OnboardOpts struct {
	RequireProvider bool
}

type OnboardResult

type OnboardResult struct {
	UserName                  string
	ResponseLanguage          string
	SubagentTimeoutMinutes    int
	CompactionThresholdTokens int64
	NewProvider               *Provider
	SwitchCurrent             bool
	CurrentProvider           string
	CurrentModel              string
}

func RunOnboardWizard

func RunOnboardWizard(stdin io.Reader, out io.Writer, existing *Root, opts OnboardOpts) (*OnboardResult, error)

type Provider

type Provider struct {
	Name    string `toml:"name"`
	BaseURL string `toml:"base_url"`
	APIKey  string `toml:"api_key"`
}

func ResolveProvider

func ResolveProvider(r *Root) (*Provider, error)

type RecentModelUse

type RecentModelUse struct {
	Provider string `toml:"provider"`
	Model    string `toml:"model"`
}

type Root

type Root struct {
	UserName                  string           `toml:"user_name"`
	Providers                 []Provider       `toml:"providers"`
	Current                   Current          `toml:"current"`
	RecentModelUses           []RecentModelUse `toml:"recent_model_uses,omitempty"`
	SubagentTimeoutMinutes    int              `toml:"subagent_timeout_minutes"`
	ReasoningEffort           string           `toml:"reasoning_effort"`
	LogLevel                  string           `toml:"log_level"`
	MaxResponseTokens         int              `toml:"max_response_tokens"`
	ShowThinking              bool             `toml:"show_thinking"`
	ShowUsageStats            *bool            `toml:"show_usage_stats"`
	ResponseLanguage          string           `toml:"response_language"`
	CompactionThresholdTokens int64            `toml:"compaction_threshold_tokens"`
	SkillSearchMinNorm        *float64         `toml:"skill_search_min_normalized_score,omitempty"`
	WebSearchEngine           string           `toml:"web_search_engine,omitempty"`
	WebSearchAPIKey           string           `toml:"web_search_api_key,omitempty"`
	WebSearchBaseURL          string           `toml:"web_search_base_url,omitempty"`
	WebSearchCX               string           `toml:"web_search_cx,omitempty"`
}

func EmptyRoot

func EmptyRoot() *Root

func Load

func Load() (*Root, error)

func LoadOptional

func LoadOptional() (*Root, error)

func RunWizardIfNeeded

func RunWizardIfNeeded(stdin io.Reader) (*Root, error)

func (*Root) EffectiveResponseLanguage

func (r *Root) EffectiveResponseLanguage() string

func (*Root) EffectiveWebSearchEngine

func (r *Root) EffectiveWebSearchEngine() string

func (*Root) GlobalReasoningEffort

func (r *Root) GlobalReasoningEffort() shared.ReasoningEffort

func (*Root) ReasoningEffortIsNone

func (r *Root) ReasoningEffortIsNone() bool

func (*Root) ReasoningEffortLabel

func (r *Root) ReasoningEffortLabel() string

func (*Root) UsageStatsEnabled

func (r *Root) UsageStatsEnabled() bool

Jump to

Keyboard shortcuts

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