Documentation
¶
Index ¶
- Constants
- Variables
- func AllDigits(s string) bool
- func AppendOrUpdateProvider(r *Root, p Provider)
- 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 EffectiveSkillSearchMinNorm(r *Root) float64
- func EnsureChatGPTSubBaseURL(p *Provider)
- func EnsureClaudeSubBaseURL(p *Provider)
- func FastModeSupportedByProvider(p *Provider) bool
- func FirstProviderName(r *Root) string
- 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 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 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 WriteConfigSetupWarning(w io.Writer, r *Root)
- type APIResilienceConfig
- type APIResiliencePolicy
- type Current
- type ExecResolveOpts
- 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 Root
- func (r *Root) AutoUpdateEnabled() bool
- func (r *Root) EffectiveFastMode() bool
- func (r *Root) EffectiveResponseLanguage() string
- 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) UsageStatsEnabled() bool
- type ToolOutput
- type Tools
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" ClaudeSubExpectedDate = "2026-06-15" )
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 DefaultResponseLanguage = "English"
View Source
const DefaultSkillSearchMinNormalizedScore = 0.05
View Source
const DefaultSubagentTimeoutMinutes = 20
View Source
const DefaultToolOutputMaxBytes = 65536
View Source
const DefaultToolOutputMaxLines = 2048
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 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 EnsureChatGPTSubBaseURL ¶
func EnsureChatGPTSubBaseURL(p *Provider)
func EnsureClaudeSubBaseURL ¶
func EnsureClaudeSubBaseURL(p *Provider)
func FirstProviderName ¶
func IsOAuthAuthKind ¶
func NeedsOnboard ¶
func NormalizeAPIBase ¶
func NormalizeAnthropicBase ¶
func NoteRecentModelUse ¶
func PickModelInteractive ¶
func PrintConfigSkipHint ¶
func ProviderConnectMenuLines ¶
func ProviderConnectMenuLines() []string
func ResolveExecConfig ¶
func ResolveExecConfig(existing *Root, opts ExecResolveOpts) (*Root, *Provider, error)
func ResolveProviderBearer ¶
func SubagentTimeout ¶
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 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 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"`
FastMode *bool `toml:"fast_mode,omitempty"`
LogLevel string `toml:"log_level"`
MaxResponseTokens int `toml:"max_response_tokens"`
ShowThinking bool `toml:"show_thinking"`
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"`
ToolOutput ToolOutput `toml:"tool_output,omitempty"`
APIResilience APIResilienceConfig `toml:"api_resilience,omitempty"`
AutoUpdate *bool `toml:"autoupdate,omitempty"`
}
func LoadOptional ¶
func (*Root) AutoUpdateEnabled ¶ added in v2026.602.3
func (*Root) EffectiveFastMode ¶
func (*Root) EffectiveResponseLanguage ¶
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) UsageStatsEnabled ¶
type ToolOutput ¶
Click to show internal directories.
Click to hide internal directories.