Documentation
¶
Index ¶
- Constants
- Variables
- func AllDigits(s string) bool
- func AppendOrUpdateProvider(r *Root, p Provider)
- func ApplyClaudeOAuthTokens(p *Provider, t claude.TokenSet)
- func ApplyOAuthTokens(p *Provider, t codex.TokenSet)
- func ApplyOnboardMerge(dst *Root, res *OnboardResult)
- func BackupConfig() (string, error)
- func ChooseProviderKind(pio PromptIO, require bool, menuTitle string) (kind int, skipped bool, err error)
- func ClampTimeoutMinutes(n int) error
- func ConfigExists() (bool, error)
- func ConfirmOnboardRerun(pio PromptIO) (bool, error)
- func CursorAPIConfigured(r *Root) bool
- func EffectiveCompactionThresholdTokens(r *Root) int64
- func EffectiveDocSearchFullArticleScore(r *Root) float64
- func EffectiveDocSearchMinNorm(r *Root) float64
- func EffectiveResearchMaxContentChars(r *Root) int
- func EffectiveResearchMaxRounds(r *Root) int
- func EffectiveResearchMaxURLsPerRound(r *Root) int
- func EffectiveSkillSearchMinNorm(r *Root) float64
- func EffectiveWebFetchAcceptLanguage(r *Root) string
- func EffectiveWebFetchBlockedDomains(r *Root) []string
- func EffectiveWebFetchMaxRedirects(r *Root) int
- func EffectiveWebFetchUserAgent(r *Root) string
- func EnsureChatGPTSubBaseURL(p *Provider)
- func EnsureClaudeSubBaseURL(p *Provider)
- func EnsureDefaultFile() error
- func FastModeSupportedByProvider(p *Provider) bool
- func FirstProviderName(r *Root) string
- func IsAnthropicClaudeCodeOAuthToken(token string) bool
- func IsLocalEndpoint(raw string) bool
- func IsOAuthAuthKind(kind string) bool
- func ModelPassesChatGPTSubFilter(modelID string) bool
- func ModelPassesChatGPTSubPickerFilter(modelID string) bool
- func ModelPassesClaudeSubFilter(modelID string) bool
- func NeedsOnboard(r *Root) bool
- func NormalizeAPIBase(raw string) (string, error)
- func NormalizeAnthropicBase(raw string) (string, error)
- func NoteRecentModelUse(r *Root, providerName, modelID string)
- func ParseReasoningEffortToken(s string) (string, error)
- func ParseServeAddrOverride(raw string) (string, error)
- func PickModelInteractive(pio PromptIO, p *Provider, providerLabel string, ids []string, allowSkip bool) (string, error)
- func PrintConfigSkipHint(out io.Writer, topic string)
- func PrintProviderConnectMenu(out io.Writer, title string)
- func ProviderConnectMenuLines() []string
- func ProviderCredentialsReady(p *Provider) bool
- func ReadPromptLine(p PromptIO, prompt string) (string, error)
- func RemoteProviderNames(r *Root) []string
- func ResearchMaxTimeSeconds(r *Root) int
- func ResolveExecConfig(existing *Root, opts ExecResolveOpts) (*Root, *Provider, error)
- func ResolveProviderBearer(ctx context.Context, r *Root, p *Provider) (string, error)
- func Save(r *Root) error
- func SubagentTimeout(r *Root) int
- func ValidateRoles(ctx context.Context, r *Root) error
- func WriteAnthropicClaudeCodeOAuthWarning(out io.Writer)
- func WriteConfigSetupWarning(w io.Writer, r *Root)
- type APIResilienceConfig
- type APIResiliencePolicy
- type Current
- type ExecResolveOpts
- type Export
- type ModelPickChoice
- type OAuthTokenSet
- type OnboardOpts
- type OnboardResult
- type PromptIO
- type Provider
- func (p *Provider) EffectiveAPIProtocol() string
- func (p *Provider) EffectiveAuthKind() string
- func (p *Provider) IsAnthropic() bool
- func (p *Provider) IsChatGPTSub() bool
- func (p *Provider) IsClaudeSub() bool
- func (p *Provider) IsCursorAPI() bool
- func (p *Provider) IsOAuthProvider() bool
- func (p *Provider) UsesAnthropicOAuthBearer() bool
- type ProviderSetupOpts
- type ProviderSetupResult
- type RecentModelUse
- type Roles
- type Root
- func (r *Root) AutoUpdateEnabled() bool
- func (r *Root) CursorInternalToolsEnabled() bool
- func (r *Root) EffectiveExportRoot() (string, error)
- func (r *Root) EffectiveFastMode() bool
- func (r *Root) EffectiveResponseLanguage() string
- func (r *Root) EffectiveServerAddr() string
- func (r *Root) EffectiveServerStaticDir() string
- func (r *Root) EffectiveServerTLSPaths() (cert, key string)
- func (r *Root) EffectiveSubagentReasoningEffort(override string) (canonical string, forceDisable bool)
- func (r *Root) EffectiveWebSearchEngine() string
- func (r *Root) FastModeEnabledForProvider(p *Provider) bool
- func (r *Root) GlobalReasoningEffort() shared.ReasoningEffort
- func (r *Root) LegacyToolsEnabled() bool
- func (r *Root) LegacyToolsForceEnabled() bool
- func (r *Root) ModelDisplayName(p *Provider, model string) string
- func (r *Root) ReasoningEffortDisplayLabel() string
- func (r *Root) ReasoningEffortIsNone() bool
- func (r *Root) ReasoningEffortLabel() string
- func (r *Root) SubagentReasoningEffortDisplayLabel() string
- func (r *Root) SubagentReasoningEffortIsNone() bool
- func (r *Root) SubagentReasoningEffortLabel() string
- func (r *Root) UsageStatsEnabled() bool
- func (r *Root) WebSearchNeedsInternet() bool
- type Server
- type SubagentRoleConfig
- type ToolOutput
- type Tools
- type WebFetchConfig
Constants ¶
View Source
const ( EnvOpenAIBaseURL = "OPENAI_BASE_URL" EnvOpenAIAPIKey = "OPENAI_API_KEY" EnvModelID = "MODEL_ID" )
View Source
const ( ProviderNameChatGPTSub = "ChatGPT Sub" ProviderNameClaudeSub = "Claude Sub" ProviderNameCursorAPI = "Cursor API" CursorAPIDefaultModelID = "composer-2.5" OpenAIPlatformBase = "https://api.openai.com" AnthropicPlatformBase = "https://api.anthropic.com" AuthKindAPIKey = "api_key" AuthKindOAuthChatGPT = "oauth_chatgpt" AuthKindOAuthClaude = "oauth_claude" AuthKindCursorAPI = "cursor_api" AnthropicClaudeCodeOAuthTokenPrefix = "sk-ant-oat" AnthropicClaudeCodeOAuthSetupWarning = "Claude Code OAuth tokens (sk-ant-oat…) are not recommended as API keys." )
View Source
const ( ProviderKindChatGPTSub = 1 ProviderKindOpenAICompatible = 2 ProviderKindAnthropicCompatible = 3 ProviderKindClaudeSub = 4 ProviderKindCursorAPI = 5 )
View Source
const APIProtocolAnthropic = "anthropic"
View Source
const APIProtocolOpenAI = "openai"
View Source
const DefaultAPIBaseDelayMS = 1000
View Source
const DefaultAPICircuitOpenSec = 60
View Source
const DefaultAPIConnectTimeoutSec = 30
View Source
const DefaultAPIMaxDelayMS = 30000
View Source
const DefaultAPIMaxRetries = 3
View Source
const DefaultCompactionThresholdTokens int64 = 131072
View Source
const DefaultDocSearchFullArticleScore = 0.9
View Source
const DefaultDocSearchMinNormalizedScore = 0.05
View Source
const DefaultResearchMaxContentChars = 15000
View Source
const DefaultResearchMaxRounds = 8
View Source
const DefaultResearchMaxURLsPerRound = 3
View Source
const DefaultResearchMinRounds = 2
View Source
const DefaultResponseLanguage = "English"
View Source
const DefaultServerBind = "127.0.0.1"
View Source
const DefaultServerPort = 8443
View Source
const DefaultSkillSearchMinNormalizedScore = 0.05
View Source
const DefaultSubagentRolePoints = 100
View Source
const DefaultSubagentTimeoutMinutes = 20
View Source
const DefaultToolOutputMaxBytes = 65536
View Source
const DefaultToolOutputMaxLines = 2048
View Source
const DefaultWebFetchMaxRedirects = 10
View Source
const DefaultWebSearchEngine = "duckduckgo"
View Source
const MaxModelPickerEntries = 25
View Source
const MinCompactionThresholdTokens int64 = 32768
Variables ¶
View Source
var ErrOnboardProviderSkipped = errors.New("onboard provider skipped")
Functions ¶
func AppendOrUpdateProvider ¶
func ApplyClaudeOAuthTokens ¶ added in v2026.622.0
func ApplyOAuthTokens ¶
func ApplyOnboardMerge ¶
func ApplyOnboardMerge(dst *Root, res *OnboardResult)
func BackupConfig ¶
func ChooseProviderKind ¶
func ClampTimeoutMinutes ¶
func ConfigExists ¶
func ConfirmOnboardRerun ¶
func CursorAPIConfigured ¶ added in v2026.608.0
func EffectiveDocSearchFullArticleScore ¶ added in v2026.608.0
func EffectiveDocSearchMinNorm ¶ added in v2026.608.0
func EffectiveResearchMaxContentChars ¶ added in v2026.617.0
func EffectiveResearchMaxRounds ¶ added in v2026.617.0
func EffectiveResearchMaxURLsPerRound ¶ added in v2026.617.0
func EffectiveWebFetchAcceptLanguage ¶ added in v2026.617.0
func EffectiveWebFetchBlockedDomains ¶ added in v2026.617.0
func EffectiveWebFetchMaxRedirects ¶ added in v2026.617.0
func EffectiveWebFetchUserAgent ¶ added in v2026.617.0
func EnsureChatGPTSubBaseURL ¶
func EnsureChatGPTSubBaseURL(p *Provider)
func EnsureClaudeSubBaseURL ¶
func EnsureClaudeSubBaseURL(p *Provider)
func EnsureDefaultFile ¶ added in v2026.621.0
func EnsureDefaultFile() error
func FirstProviderName ¶
func IsAnthropicClaudeCodeOAuthToken ¶ added in v2026.617.1
func IsLocalEndpoint ¶ added in v2026.609.3
func IsOAuthAuthKind ¶
func NeedsOnboard ¶
func NormalizeAPIBase ¶
func NormalizeAnthropicBase ¶
func NoteRecentModelUse ¶
func ParseServeAddrOverride ¶ added in v2026.708.0
func PickModelInteractive ¶
func PrintConfigSkipHint ¶
func ProviderConnectMenuLines ¶
func ProviderConnectMenuLines() []string
func RemoteProviderNames ¶ added in v2026.609.3
func ResearchMaxTimeSeconds ¶ added in v2026.617.0
func ResolveExecConfig ¶
func ResolveExecConfig(existing *Root, opts ExecResolveOpts) (*Root, *Provider, error)
func ResolveProviderBearer ¶
func SubagentTimeout ¶
func WriteAnthropicClaudeCodeOAuthWarning ¶ added in v2026.617.1
func WriteConfigSetupWarning ¶
Types ¶
type APIResilienceConfig ¶
type APIResilienceConfig struct {
MaxRetries int `toml:"max_retries,omitempty"`
BaseDelayMS int `toml:"base_delay_ms,omitempty"`
MaxDelayMS int `toml:"max_delay_ms,omitempty"`
Jitter *bool `toml:"jitter,omitempty"`
ConnectTimeoutSec int `toml:"connect_timeout_sec,omitempty"`
ReadTimeoutSec int `toml:"read_timeout_sec,omitempty"`
CircuitOpenSec int `toml:"circuit_open_sec,omitempty"`
}
type APIResiliencePolicy ¶
type APIResiliencePolicy struct {
MaxRetries int
BaseDelay time.Duration
MaxDelay time.Duration
Jitter bool
ConnectTimeout time.Duration
ReadTimeout time.Duration
CircuitOpen time.Duration
}
func EffectiveAPIResilience ¶
func EffectiveAPIResilience(r *Root) APIResiliencePolicy
type ExecResolveOpts ¶
type ExecResolveOpts struct {
EnvFile string
}
type ModelPickChoice ¶
func PickModelAfterAdd ¶
type OAuthTokenSet ¶
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(pio PromptIO, existing *Root, opts OnboardOpts) (*OnboardResult, error)
type Provider ¶
type Provider struct {
Name string `toml:"-"`
BaseURL string `toml:"base_url"`
APIKey string `toml:"api_key"`
APIProtocol string `toml:"api_protocol,omitempty"`
AuthKind string `toml:"auth_kind,omitempty"`
OAuthAccessToken string `toml:"oauth_access_token,omitempty"`
OAuthRefreshToken string `toml:"oauth_refresh_token,omitempty"`
OAuthExpiresAt string `toml:"oauth_expires_at,omitempty"`
OAuthAccountID string `toml:"oauth_account_id,omitempty"`
}
func NewChatGPTSubProvider ¶
func NewClaudeSubProvider ¶ added in v2026.622.0
func ProviderByName ¶
func ProviderList ¶
func ResolveProvider ¶
func (*Provider) EffectiveAPIProtocol ¶
func (*Provider) EffectiveAuthKind ¶
func (*Provider) IsAnthropic ¶
func (*Provider) IsChatGPTSub ¶
func (*Provider) IsClaudeSub ¶
func (*Provider) IsCursorAPI ¶
func (*Provider) IsOAuthProvider ¶
func (*Provider) UsesAnthropicOAuthBearer ¶
type ProviderSetupOpts ¶
type ProviderSetupResult ¶
type ProviderSetupResult struct {
Provider Provider
SwitchCurrent bool
CurrentProvider string
CurrentModel string
}
func FinalizeProviderSetup ¶
func FinalizeProviderSetup(pio PromptIO, cfg *Root, existing *Root, opts ProviderSetupOpts, prov Provider, ids []string) (*ProviderSetupResult, error)
func RunProviderSetupByKind ¶
func RunProviderSetupByKind(ctx context.Context, pio PromptIO, cfg *Root, existing *Root, kind int, opts ProviderSetupOpts) (*ProviderSetupResult, error)
type RecentModelUse ¶
func RecentModelUseEntries ¶
func RecentModelUseEntries(r *Root, preferProvider string) []RecentModelUse
type Roles ¶ added in v2026.707.0
type Roles struct {
Subagent []SubagentRoleConfig `toml:"subagent,omitempty"`
}
type Root ¶
type Root struct {
UserName string `toml:"user_name"`
Providers map[string]*Provider `toml:"-"`
Current Current `toml:"current"`
RecentModels map[string][]string `toml:"recent_models,omitempty"`
SubagentTimeoutMinutes int `toml:"subagent_timeout_minutes"`
ReasoningEffort string `toml:"reasoning_effort"`
SubagentReasoningEffort string `toml:"subagent_reasoning_effort"`
FastMode *bool `toml:"fast_mode,omitempty"`
LogLevel string `toml:"log_level"`
MaxResponseTokens int `toml:"max_response_tokens"`
ShowThinking bool `toml:"show_thinking"`
Anonymize bool `toml:"anonymize,omitempty"`
Tools Tools `toml:"tools,omitempty"`
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"`
DocSearchMinNorm *float64 `toml:"doc_search_min_normalized_score,omitempty"`
DocSearchFullArticleScore *float64 `toml:"doc_search_full_article_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"`
ResearchMaxRounds int `toml:"research_max_rounds,omitempty"`
ResearchMaxURLsPerRound int `toml:"research_max_urls_per_round,omitempty"`
ResearchMaxContentChars int `toml:"research_max_content_chars,omitempty"`
ToolOutput ToolOutput `toml:"tool_output,omitempty"`
APIResilience APIResilienceConfig `toml:"api_resilience,omitempty"`
WebFetch WebFetchConfig `toml:"web_fetch,omitempty"`
Export Export `toml:"export,omitempty"`
Server Server `toml:"server,omitempty"`
Roles Roles `toml:"roles,omitempty"`
AutoUpdate *bool `toml:"autoupdate,omitempty"`
PromptTemplates map[string]string `toml:"prompt_templates,omitempty"`
PromptTemplateModTime map[string]int64 `toml:"prompt_template_mtime,omitempty"`
}
func LoadOptional ¶
func LoadStartup ¶ added in v2026.622.0
func (*Root) AutoUpdateEnabled ¶ added in v2026.602.3
func (*Root) CursorInternalToolsEnabled ¶ added in v2026.624.0
func (*Root) EffectiveExportRoot ¶ added in v2026.701.0
func (*Root) EffectiveFastMode ¶
func (*Root) EffectiveResponseLanguage ¶
func (*Root) EffectiveServerAddr ¶ added in v2026.708.0
func (*Root) EffectiveServerStaticDir ¶ added in v2026.708.0
func (*Root) EffectiveServerTLSPaths ¶ added in v2026.708.0
func (*Root) EffectiveSubagentReasoningEffort ¶ added in v2026.615.0
func (*Root) EffectiveWebSearchEngine ¶
func (*Root) FastModeEnabledForProvider ¶
func (*Root) GlobalReasoningEffort ¶
func (r *Root) GlobalReasoningEffort() shared.ReasoningEffort
func (*Root) LegacyToolsEnabled ¶
func (*Root) LegacyToolsForceEnabled ¶
func (*Root) ReasoningEffortDisplayLabel ¶
func (*Root) ReasoningEffortIsNone ¶
func (*Root) ReasoningEffortLabel ¶
func (*Root) SubagentReasoningEffortDisplayLabel ¶ added in v2026.615.0
func (*Root) SubagentReasoningEffortIsNone ¶ added in v2026.615.0
func (*Root) SubagentReasoningEffortLabel ¶ added in v2026.615.0
func (*Root) UsageStatsEnabled ¶
func (*Root) WebSearchNeedsInternet ¶ added in v2026.609.3
type SubagentRoleConfig ¶ added in v2026.707.0
type SubagentRoleConfig struct {
Provider string `toml:"provider"`
Model string `toml:"model"`
Description string `toml:"description,omitempty"`
Points int `toml:"points,omitempty"`
}
func (SubagentRoleConfig) EffectivePoints ¶ added in v2026.707.0
func (e SubagentRoleConfig) EffectivePoints() int
type ToolOutput ¶
Click to show internal directories.
Click to hide internal directories.