Documentation
¶
Index ¶
- Constants
- Variables
- func BoolPtr(v bool) *bool
- func CloneBoolPtr(src *bool) *bool
- func CloneFloat64Ptr(src *float64) *float64
- func CloneStringMap(src map[string]string) map[string]string
- func CloneStringSlice(src []string) []string
- func ConfigDir() string
- func DefaultProviderConfigs() map[string]*ProviderConfig
- func GlobalAllowPath() string
- func GlobalEnvPath() string
- func GlobalMCPPath() string
- func GlobalSettingsPath() string
- func IsProjectDir(path string) bool
- func LoadSettingsWithMeta() (*Settings, LoadMeta, error)
- func NormalizeMCPConfig(cfg *MCPConfig)
- func NormalizeSamplingPtr(src *float64) *float64
- func ProjectAllowPath() string
- func ProjectMCPPath() string
- func ProjectPath(elem ...string) string
- func ProjectPathFor(cwd string, elem ...string) string
- func ProjectSettingsPath() string
- func SaveGlobalSettings(s *Settings) error
- func SaveGlobalSettingsPatch(updates map[string]any) error
- func SaveMCPConfig(path string, cfg *MCPConfig) error
- func SaveProjectSettings(s *Settings) error
- func SaveProjectSettingsPatch(updates map[string]any) error
- type AllowConfig
- func (c *AllowConfig) AddBashCommand(command string) bool
- func (c *AllowConfig) AddBashPrefix(prefix string) bool
- func (c *AllowConfig) AddEditPath(glob string) bool
- func (c *AllowConfig) ClearEditPaths()
- func (c *AllowConfig) EditPathList() []string
- func (c *AllowConfig) GetAutoEdit() bool
- func (c *AllowConfig) MatchBashCommand(command string) bool
- func (c *AllowConfig) MatchEditPath(path string) bool
- func (c *AllowConfig) RemoveBashCommand(command string) bool
- func (c *AllowConfig) RemoveBashPrefix(prefix string) bool
- func (c *AllowConfig) RemoveEditPath(glob string) bool
- func (c *AllowConfig) SaveGlobalAutoEdit() error
- func (c *AllowConfig) SaveGlobalAutoEditValue(v bool) error
- func (c *AllowConfig) SaveProject() error
- func (c *AllowConfig) SetAutoEdit(v bool)
- func (c *AllowConfig) SetGlobalAutoEdit(v bool) bool
- func (c *AllowConfig) SetProjectAutoEdit(v bool)
- type ApprovalSettings
- type CompactionSettings
- type ContextFilesSettings
- type CostConfig
- type EnvConfig
- type ImageGenerationSettings
- type LoadMeta
- type MCPConfig
- type MCPServer
- type ModelCompat
- type ModelConfig
- type ProviderConfig
- type ResponsesConfig
- type ResponsesHostedToolsConfig
- type ResponsesStructuredOutputConfig
- type ResponsesToolControlConfig
- type RetrySettings
- type SandboxSettings
- type Settings
- func (s *Settings) EffectiveImageGeneration() ImageGenerationSettings
- func (s *Settings) GetGlobalSkillsDir() string
- func (s *Settings) GetModelConfig(providerName, modelID string) *ModelConfig
- func (s *Settings) GetProviderConfig(name string) *ProviderConfig
- func (s *Settings) GetSessionDir() string
- func (s *Settings) GetShell() string
- func (s *Settings) IsImageGenerationEnabled() bool
- func (s *Settings) IsPlanToolEnabled() bool
- func (s *Settings) IsUpdateCheckEnabled() bool
- func (s *Settings) IsWebSearchEnabled() bool
- func (s Settings) MarshalJSON() ([]byte, error)
- func (s *Settings) ResolveImageGenerationToken() string
- func (s *Settings) ResolveKey(providerName string) string
- func (s *Settings) ResolveProviderHeaders(providerName string) map[string]string
- func (s *Settings) UnmarshalJSON(data []byte) error
- type SkillHubMarketSettings
- type SkillHubSettings
- type StatusLineSettings
- type ToolExecutionSettings
- type WebSearchSettings
Constants ¶
const DefaultSkillHubOfficialHandle = "user_0064faa7"
const DefaultToolExecutionMaxConcurrency = 10
DefaultToolExecutionMaxConcurrency is the default number of local tool calls that may execute concurrently in one agent turn.
const ProjectDirName = ".mothx"
Variables ¶
var Verbose bool
Verbose controls whether config loading prints diagnostic messages to stderr.
Functions ¶
func CloneBoolPtr ¶
CloneBoolPtr returns a deep copy of a bool pointer, or nil if src is nil.
func CloneFloat64Ptr ¶
CloneFloat64Ptr returns a deep copy of a float64 pointer, or nil if src is nil.
func CloneStringMap ¶
CloneStringMap returns a deep copy of a string map, or nil if src is nil.
func CloneStringSlice ¶
CloneStringSlice returns a deep copy of a string slice, or nil if src is nil.
func DefaultProviderConfigs ¶
func DefaultProviderConfigs() map[string]*ProviderConfig
DefaultProviderConfigs returns a deep copy of all built-in provider presets. The returned map is safe for callers to modify without affecting the global defaults.
func GlobalAllowPath ¶
func GlobalAllowPath() string
GlobalAllowPath returns the global allow.json path.
func GlobalEnvPath ¶ added in v1.1.78
func GlobalEnvPath() string
func GlobalSettingsPath ¶
func GlobalSettingsPath() string
func IsProjectDir ¶ added in v1.1.82
func LoadSettingsWithMeta ¶
LoadSettingsWithMeta loads settings and reports whether the global settings file was created during this call. The loaded schema is the same as LoadSettings.
func NormalizeMCPConfig ¶
func NormalizeMCPConfig(cfg *MCPConfig)
NormalizeMCPConfig applies basic defaults.
func NormalizeSamplingPtr ¶ added in v1.1.77
NormalizeSamplingPtr returns nil if src points to zero; otherwise returns a clone of src. This prevents zero-valued temperature/top_p from being serialized to API requests, which some providers reject.
func ProjectAllowPath ¶
func ProjectAllowPath() string
ProjectAllowPath returns the project-level allow.json path.
func ProjectMCPPath ¶
func ProjectMCPPath() string
ProjectMCPPath returns the project-local mcp.json path.
func ProjectPath ¶ added in v1.1.59
ProjectPath returns a project-level path under .mothx in the current working directory.
func ProjectPathFor ¶ added in v1.1.59
ProjectPathFor returns a project-level path under cwd/.mothx.
func ProjectSettingsPath ¶
func ProjectSettingsPath() string
func SaveGlobalSettings ¶
SaveGlobalSettings writes settings.json atomically with private permissions.
func SaveGlobalSettingsPatch ¶
SaveGlobalSettingsPatch updates only the given top-level keys in the global settings file. It preserves keys that are already present without expanding defaults into settings.json.
func SaveMCPConfig ¶
SaveMCPConfig writes mcp.json to path.
func SaveProjectSettings ¶
SaveProjectSettings writes .mothx/settings.json atomically with private permissions.
func SaveProjectSettingsPatch ¶ added in v1.1.82
SaveProjectSettingsPatch updates only the given top-level keys in the project settings file without expanding defaults.
Types ¶
type AllowConfig ¶
type AllowConfig struct {
AutoEdit bool `json:"autoEdit,omitempty"`
EditPaths []string `json:"editPaths,omitempty"`
BashCommands []string `json:"bashCommands,omitempty"`
BashPrefixes []string `json:"bashPrefixes,omitempty"`
// contains filtered or unexported fields
}
AllowConfig holds runtime auto-approval settings that are persisted separately from settings.json in allow.json.
- AutoEdit: when true, write/edit tools auto-approve in agent mode.
- EditPaths: glob whitelist of paths whose write/edit auto-approve in agent mode. Supports "**" (cross-directory) and "*" (single segment).
- BashCommands/BashPrefixes: project-level command allow rules for bash auto-approval in agent mode.
Loading follows the same global->project override order as settings.json: AutoEdit is taken from the project file when present, otherwise the global file. EditPaths and bash allow rules are project-level only.
func LoadAllow ¶
func LoadAllow() *AllowConfig
LoadAllow loads allow configuration with global->project override semantics. AutoEdit defaults to enabled unless global or project allow.json explicitly sets it; EditPaths and bash allow rules are project-level only.
func (*AllowConfig) AddBashCommand ¶
func (c *AllowConfig) AddBashCommand(command string) bool
AddBashCommand appends an exact bash command allow rule if not already present.
func (*AllowConfig) AddBashPrefix ¶
func (c *AllowConfig) AddBashPrefix(prefix string) bool
AddBashPrefix appends a bash command prefix allow rule if not already present. Trailing spaces are preserved because command prefixes are matched literally.
func (*AllowConfig) AddEditPath ¶
func (c *AllowConfig) AddEditPath(glob string) bool
AddEditPath appends a glob to the whitelist if not already present. Returns true when the list changed.
func (*AllowConfig) ClearEditPaths ¶
func (c *AllowConfig) ClearEditPaths()
ClearEditPaths empties the whitelist.
func (*AllowConfig) EditPathList ¶
func (c *AllowConfig) EditPathList() []string
EditPathList returns a copy of the current edit-path whitelist.
func (*AllowConfig) GetAutoEdit ¶
func (c *AllowConfig) GetAutoEdit() bool
GetAutoEdit reports the current AutoEdit flag.
func (*AllowConfig) MatchBashCommand ¶
func (c *AllowConfig) MatchBashCommand(command string) bool
MatchBashCommand reports whether command matches any project bash allow rule.
func (*AllowConfig) MatchEditPath ¶
func (c *AllowConfig) MatchEditPath(path string) bool
MatchEditPath reports whether path matches any whitelist glob.
func (*AllowConfig) RemoveBashCommand ¶
func (c *AllowConfig) RemoveBashCommand(command string) bool
RemoveBashCommand removes an exact bash command allow rule if present.
func (*AllowConfig) RemoveBashPrefix ¶
func (c *AllowConfig) RemoveBashPrefix(prefix string) bool
RemoveBashPrefix removes a bash command prefix allow rule if present.
func (*AllowConfig) RemoveEditPath ¶
func (c *AllowConfig) RemoveEditPath(glob string) bool
RemoveEditPath removes a glob from the whitelist. Returns true when removed.
func (*AllowConfig) SaveGlobalAutoEdit ¶
func (c *AllowConfig) SaveGlobalAutoEdit() error
SaveGlobalAutoEdit persists only autoEdit to the global file, preserving any other keys that may exist there.
func (*AllowConfig) SaveGlobalAutoEditValue ¶
func (c *AllowConfig) SaveGlobalAutoEditValue(v bool) error
SaveGlobalAutoEditValue persists the provided global autoEdit value without changing project-scoped effective state in memory.
func (*AllowConfig) SaveProject ¶
func (c *AllowConfig) SaveProject() error
SaveProject persists the project config. The project autoEdit key is written only when it was explicitly set at project scope; inherited global state is never copied into .mothx/allow.json as a side effect of editing path rules.
func (*AllowConfig) SetAutoEdit ¶
func (c *AllowConfig) SetAutoEdit(v bool)
SetAutoEdit updates the in-memory AutoEdit flag.
func (*AllowConfig) SetGlobalAutoEdit ¶
func (c *AllowConfig) SetGlobalAutoEdit(v bool) bool
SetGlobalAutoEdit updates the effective AutoEdit flag only when the project file does not explicitly override it. It returns the current effective value.
func (*AllowConfig) SetProjectAutoEdit ¶
func (c *AllowConfig) SetProjectAutoEdit(v bool)
SetProjectAutoEdit updates the AutoEdit flag and marks it as explicitly set at project scope, so SaveProject can persist false as an intentional override.
type ApprovalSettings ¶
type ApprovalSettings struct {
// BashWhitelist is a list of command prefixes that auto-approve in agent mode
BashWhitelist []string `json:"bashWhitelist,omitempty"`
// BashBlacklist is a list of command prefixes that always require approval (even in yolo mode if configured)
BashBlacklist []string `json:"bashBlacklist,omitempty"`
// ConfirmBeforeWrite requires user approval before write/edit tools run in agent mode.
ConfirmBeforeWrite *bool `json:"confirmBeforeWrite,omitempty"`
}
type CompactionSettings ¶
type ContextFilesSettings ¶
type CostConfig ¶
type EnvConfig ¶ added in v1.1.78
EnvConfig contains environment variables injected into bash and skill tools.
type ImageGenerationSettings ¶ added in v1.1.78
type ImageGenerationSettings struct {
Enabled *bool `json:"enabled,omitempty"`
Provider string `json:"provider,omitempty"`
APIType string `json:"apiType,omitempty"`
BaseURL string `json:"baseUrl,omitempty"`
Token string `json:"token,omitempty"`
Model string `json:"model,omitempty"`
}
ImageGenerationSettings configures the standalone local image_generation tool. The endpoint and credential are independent from the chat provider.
type MCPConfig ¶
type MCPConfig struct {
MCPServers []MCPServer `json:"mcpServers,omitempty"`
}
MCPConfig is the standalone MCP configuration file schema.
func DefaultMCPConfig ¶
func DefaultMCPConfig() *MCPConfig
DefaultMCPConfig returns a starter mcp.json template.
func FullMCPConfigTemplate ¶
func FullMCPConfigTemplate() *MCPConfig
FullMCPConfigTemplate returns a comprehensive multi-transport template.
func LoadMCPConfig ¶
LoadMCPConfig reads and parses mcp.json from path.
type MCPServer ¶
type MCPServer struct {
Name string `json:"name"`
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
URL string `json:"url,omitempty"`
MessageURL string `json:"messageUrl,omitempty"`
Args []string `json:"args,omitempty"`
Headers []struct {
Name string `json:"name"`
Value string `json:"value"`
} `json:"headers,omitempty"`
Env []struct {
Name string `json:"name"`
Value string `json:"value"`
} `json:"env,omitempty"`
}
MCPServer defines one MCP server entry in mcp.json.
type ModelCompat ¶
type ModelCompat struct {
// Thinking/reasoning
ThinkingFormat string `json:"thinkingFormat,omitempty"`
RequiresReasoningContentOnAssistant bool `json:"requiresReasoningContentOnAssistant,omitempty"`
RequiresReasoningContentOnAssistantMessages bool `json:"requiresReasoningContentOnAssistantMessages,omitempty"`
ForceAdaptiveThinking bool `json:"forceAdaptiveThinking,omitempty"`
// ParseReasoningInContent extracts reasoning wrapped in <think>...</think>
// tags from the content stream (for models that inline thinking in the body
// instead of using a separate reasoning_content field).
ParseReasoningInContent bool `json:"parseReasoningInContent,omitempty"`
// API parameter compatibility
SupportsDeveloperRole *bool `json:"supportsDeveloperRole,omitempty"`
SupportsStore *bool `json:"supportsStore,omitempty"`
SupportsResponses *bool `json:"supportsResponses,omitempty"`
SupportsPreviousResponseID *bool `json:"supportsPreviousResponseId,omitempty"`
SupportsConversation *bool `json:"supportsConversation,omitempty"`
SupportsBackground *bool `json:"supportsBackground,omitempty"`
SupportsStructuredOutput *bool `json:"supportsStructuredOutput,omitempty"`
SupportsServiceTier *bool `json:"supportsServiceTier,omitempty"`
SupportsParallelToolCalls *bool `json:"supportsParallelToolCalls,omitempty"`
SupportsToolChoice *bool `json:"supportsToolChoice,omitempty"`
SupportsHostedTools map[string]bool `json:"supportsHostedTools,omitempty"`
SupportedInclude []string `json:"supportedInclude,omitempty"`
SupportsReasoningEffort *bool `json:"supportsReasoningEffort,omitempty"`
SupportsStrictMode *bool `json:"supportsStrictMode,omitempty"`
MaxTokensField string `json:"maxTokensField,omitempty"`
// DisableSamplingParams omits temperature/top_p from requests. It defaults
// to true (nil): sampling parameters are only sent when explicitly set to
// false for models that accept them.
DisableSamplingParams *bool `json:"disableSamplingParams,omitempty"`
// Cache
SupportsCacheControlOnTools *bool `json:"supportsCacheControlOnTools,omitempty"`
SupportsLongCacheRetention *bool `json:"supportsLongCacheRetention,omitempty"`
SupportsPromptCacheKey *bool `json:"supportsPromptCacheKey,omitempty"`
SupportsReasoningSummary *bool `json:"supportsReasoningSummary,omitempty"`
SendSessionAffinityHeaders bool `json:"sendSessionAffinityHeaders,omitempty"`
// Streaming
SupportsEagerToolInputStreaming *bool `json:"supportsEagerToolInputStreaming,omitempty"`
}
ModelCompat defines per-model compatibility flags (Decision 14). Reference: pi/packages/ai/src/models.generated.ts compat field
type ModelConfig ¶
type ModelConfig struct {
ID string `json:"id"`
Name string `json:"name"`
Reasoning bool `json:"reasoning,omitempty"`
ContextWindow int `json:"contextWindow,omitempty"`
MaxTokens int `json:"maxTokens,omitempty"`
Temperature *float64 `json:"temperature,omitempty"` // nil = use API default
TopP *float64 `json:"top_p,omitempty"` // nil = use API default
Cost *CostConfig `json:"cost,omitempty"`
Input []string `json:"input,omitempty"`
Compat *ModelCompat `json:"compat,omitempty"` // Vendor compatibility flags (Decision 14)
// contains filtered or unexported fields
}
func DefaultModelConfig ¶
func DefaultModelConfig(providerID, modelID string) *ModelConfig
DefaultModelConfig returns a deep copy of a specific model's built-in config under a given provider. Returns nil if the provider or model is unknown.
func ResolveModelConfig ¶
func ResolveModelConfig(providerID, modelID string, runtime *Settings) *ModelConfig
ResolveModelConfig merges built-in model defaults with runtime overrides.
func (ModelConfig) MarshalJSON ¶ added in v1.1.71
func (mc ModelConfig) MarshalJSON() ([]byte, error)
MarshalJSON preserves an explicitly configured zero maxTokens value. This lets the TUI and WebUI express "do not send an output token limit" while keeping ordinary omitted values sparse.
func (ModelConfig) MaxTokensWasSet ¶ added in v1.1.59
func (mc ModelConfig) MaxTokensWasSet() bool
func (*ModelConfig) SetMaxTokens ¶ added in v1.1.71
func (mc *ModelConfig) SetMaxTokens(value int)
SetMaxTokens records an explicit output-token setting. A value of zero means use the provider default and must remain distinguishable from an omitted value.
func (*ModelConfig) UnmarshalJSON ¶
func (mc *ModelConfig) UnmarshalJSON(data []byte) error
type ProviderConfig ¶
type ProviderConfig struct {
Vendor string `json:"vendor,omitempty"` // Explicit vendor adapter (Decision 12/13)
APIKey string `json:"apiKey,omitempty"` // API key or env/shell reference
BaseURL string `json:"baseUrl,omitempty"` // API base URL
HTTPProxy string `json:"httpProxy,omitempty"` // optional per-provider HTTP proxy URL, e.g. http://127.0.0.1:7890
ForceHTTP11 bool `json:"forceHTTP11,omitempty"`
Headers map[string]string `json:"headers,omitempty"` // optional per-provider HTTP headers
API string `json:"api,omitempty"`
ThinkingFormat string `json:"thinkingFormat,omitempty"` // "", "openai", "anthropic", "deepseek", "xiaomi"
CacheControl *bool `json:"cacheControl,omitempty"` // enable Anthropic prompt caching (nil/false=off, true=on; set true for Claude models)
// MaxImagesPerRequest limits image blocks sent to OpenAI-compatible APIs.
// Zero uses the provider default; -1 disables the client-side limit.
MaxImagesPerRequest int `json:"maxImagesPerRequest,omitempty"`
Responses ResponsesConfig `json:"responses,omitempty"`
Models []ModelConfig `json:"models"`
// contains filtered or unexported fields
}
func DefaultProviderConfig ¶
func DefaultProviderConfig(providerID string) *ProviderConfig
DefaultProviderConfig returns a deep copy of a single built-in provider preset, or nil if the provider ID has no built-in default.
func ResolveProviderConfig ¶
func ResolveProviderConfig(providerID string, runtime *Settings) *ProviderConfig
ResolveProviderConfig merges built-in provider defaults with runtime overrides. Priority: runtime settings > built-in defaults > safe generic defaults.
func (*ProviderConfig) UnmarshalJSON ¶
func (pc *ProviderConfig) UnmarshalJSON(data []byte) error
type ResponsesConfig ¶
type ResponsesConfig struct {
ReasoningSummary string `json:"reasoningSummary,omitempty"` // "auto" (default), "concise", or "detailed"
ReasoningContext string `json:"reasoningContext,omitempty"` // auto, current_turn, all_turns
ReasoningMode string `json:"reasoningMode,omitempty"` // standard, pro
PromptCacheEnabled *bool `json:"promptCacheEnabled,omitempty"` // nil/true = on, false = off
PromptCacheKey string `json:"promptCacheKey,omitempty"` // optional explicit cache key; defaults to provider/model stable key
PromptCacheRetention string `json:"promptCacheRetention,omitempty"` // optional OpenAI prompt cache retention value
PromptCacheMode string `json:"promptCacheMode,omitempty"` // implicit, explicit
PromptCacheTTL string `json:"promptCacheTTL,omitempty"` // e.g. 5m, 1h
SafetyIdentifier string `json:"safetyIdentifier,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
StateMode string `json:"stateMode,omitempty"` // replay, previous_response_id, conversation
Store *bool `json:"store,omitempty"`
Conversation string `json:"conversation,omitempty"`
Truncation string `json:"truncation,omitempty"`
Background *bool `json:"background,omitempty"`
Include []string `json:"include,omitempty"`
ServiceTier string `json:"serviceTier,omitempty"`
StructuredOutput ResponsesStructuredOutputConfig `json:"structuredOutput,omitempty"`
ToolControl ResponsesToolControlConfig `json:"toolControl,omitempty"`
HostedTools ResponsesHostedToolsConfig `json:"hostedTools,omitempty"`
}
type ResponsesHostedToolsConfig ¶ added in v1.1.77
type ResponsesHostedToolsConfig struct {
WebSearch map[string]any `json:"webSearch,omitempty"`
FileSearch map[string]any `json:"fileSearch,omitempty"`
CodeInterpreter map[string]any `json:"codeInterpreter,omitempty"`
ComputerUse map[string]any `json:"computerUse,omitempty"`
ImageGeneration map[string]any `json:"imageGeneration,omitempty"`
RemoteMCP []map[string]any `json:"remoteMCP,omitempty"`
}
type ResponsesStructuredOutputConfig ¶ added in v1.1.77
type ResponsesStructuredOutputConfig struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Strict *bool `json:"strict,omitempty"`
Schema json.RawMessage `json:"schema,omitempty"`
}
type ResponsesToolControlConfig ¶ added in v1.1.77
type RetrySettings ¶
type SandboxSettings ¶
type SandboxSettings struct {
Enabled bool `json:"enabled"`
Level string `json:"level"`
BwrapPath string `json:"bwrapPath,omitempty"`
AllowNetwork bool `json:"allowNetwork"`
AllowedRead []string `json:"allowedRead,omitempty"`
AllowedWrite []string `json:"allowedWrite,omitempty"`
DeniedPaths []string `json:"deniedPaths,omitempty"`
PassEnv []string `json:"passEnv,omitempty"`
TmpSize string `json:"tmpSize,omitempty"`
ProtectGit bool `json:"protectGit,omitempty"`
}
func (SandboxSettings) Options ¶ added in v1.1.68
func (s SandboxSettings) Options() sandbox.Options
type Settings ¶
type Settings struct {
Providers map[string]*ProviderConfig `json:"providers,omitempty"`
DefaultProvider string `json:"defaultProvider,omitempty"`
DefaultModel string `json:"defaultModel,omitempty"`
DefaultThinkingLevel string `json:"defaultThinkingLevel,omitempty"`
DefaultMode string `json:"defaultMode,omitempty"`
Authored bool `json:"authored,omitempty"`
TUILang string `json:"tuilang,omitempty"`
ToolExecution ToolExecutionSettings `json:"toolExecution,omitempty"`
StatusLine StatusLineSettings `json:"statusLine,omitempty"`
EnablePlanTool *bool `json:"enablePlanTool,omitempty"`
WebSearch WebSearchSettings `json:"webSearch"`
ImageGeneration ImageGenerationSettings `json:"imageGeneration"`
MaxContextTokens int `json:"maxContextTokens,omitempty"`
ContextFiles ContextFilesSettings `json:"contextFiles"`
SkillsDir string `json:"skillsDir,omitempty"`
SkillHub SkillHubSettings `json:"skillHub,omitempty"`
Compaction CompactionSettings `json:"compaction"`
Sandbox SandboxSettings `json:"sandbox"`
SessionDir string `json:"sessionDir,omitempty"`
ShellPath string `json:"shellPath,omitempty"`
ShellCommandPrefix string `json:"shellCommandPrefix,omitempty"`
Theme string `json:"theme,omitempty"`
Retry RetrySettings `json:"retry"`
Approval ApprovalSettings `json:"approval"`
UpdateCheck *bool `json:"updateCheck,omitempty"` // nil/true = check npm for updates on startup, false = disabled
}
Settings holds all configuration for vibecoding.
func DefaultSettings ¶
func DefaultSettings() *Settings
func LoadGlobalSettingsOrDefault ¶
LoadGlobalSettingsOrDefault loads only the global settings file over defaults. It intentionally does not apply project settings or environment overrides, so callers that need a full runnable global config can avoid persisting runtime state.
func LoadGlobalSettingsSparse ¶
LoadGlobalSettingsSparse loads only fields explicitly present in the global settings file. If the file does not exist, it returns an empty Settings. Use this for patch-style writes so defaults are not expanded into settings.json.
func LoadProjectSettingsSparse ¶
LoadProjectSettingsSparse loads only fields explicitly present in the project settings file. If the file does not exist, it returns an empty Settings.
func LoadSettings ¶
func LoadSettingsFor ¶ added in v1.2.95
LoadSettingsFor loads the same settings schema as LoadSettings, but applies project settings from cwd instead of the process working directory. It is intentionally side-effect free so diagnostics can inspect an arbitrary cwd without changing process-global state or creating a config file.
func (*Settings) EffectiveImageGeneration ¶ added in v1.1.78
func (s *Settings) EffectiveImageGeneration() ImageGenerationSettings
EffectiveImageGeneration returns the standalone image-generation config, filling omitted endpoint/API/token fields from the selected provider.
func (*Settings) GetGlobalSkillsDir ¶
func (*Settings) GetModelConfig ¶
func (s *Settings) GetModelConfig(providerName, modelID string) *ModelConfig
func (*Settings) GetProviderConfig ¶
func (s *Settings) GetProviderConfig(name string) *ProviderConfig
func (*Settings) GetSessionDir ¶
func (*Settings) IsImageGenerationEnabled ¶ added in v1.1.78
func (*Settings) IsPlanToolEnabled ¶
func (*Settings) IsUpdateCheckEnabled ¶
IsUpdateCheckEnabled reports whether startup update checks against the npm registry are enabled. Defaults to true when unset.
func (*Settings) IsWebSearchEnabled ¶
func (Settings) MarshalJSON ¶ added in v1.2.87
MarshalJSON keeps sparse settings files sparse. encoding/json does not omit a zero-value struct with omitempty, so handle the toolExecution object explicitly while preserving the existing Settings value API.
func (*Settings) ResolveImageGenerationToken ¶ added in v1.1.78
ResolveImageGenerationToken resolves environment/shell references in the standalone image-generation token without exposing the resolver itself.
func (*Settings) ResolveKey ¶
func (*Settings) ResolveProviderHeaders ¶
ResolveProviderHeaders resolves configured per-provider HTTP header values. Header values use the same env-var and shell-command resolution rules as apiKey.
func (*Settings) UnmarshalJSON ¶
type SkillHubMarketSettings ¶ added in v1.1.68
type SkillHubSettings ¶ added in v1.1.66
type SkillHubSettings struct {
DefaultMarket string `json:"defaultMarket,omitempty"`
DefaultInstallScope string `json:"defaultInstallScope,omitempty"`
OfficialHandles []string `json:"officialHandles,omitempty"`
Markets []SkillHubMarketSettings `json:"markets,omitempty"`
}
type StatusLineSettings ¶
type StatusLineSettings struct {
Enabled bool `json:"enabled,omitempty"`
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
Padding int `json:"padding,omitempty"`
RefreshInterval int `json:"refreshInterval,omitempty"`
TimeoutMs int `json:"timeoutMs,omitempty"`
Fallback string `json:"fallback,omitempty"`
}
type ToolExecutionSettings ¶ added in v1.2.87
type ToolExecutionSettings struct {
Mode string `json:"mode,omitempty"`
MaxConcurrency int `json:"maxConcurrency,omitempty"`
}
ToolExecutionSettings controls local function/custom tool execution. It is separate from provider Responses tool controls, which govern provider-side call generation and quotas rather than local workers.
func (ToolExecutionSettings) EffectiveMaxConcurrency ¶ added in v1.2.87
func (s ToolExecutionSettings) EffectiveMaxConcurrency() int
EffectiveMaxConcurrency returns the configured local tool concurrency, using the product default when the setting is omitted or non-positive.
func (ToolExecutionSettings) EffectiveMode ¶ added in v1.2.87
func (s ToolExecutionSettings) EffectiveMode() string
EffectiveMode returns the normalized local tool execution mode.