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 MCPServerEnabled(srv MCPServer) bool
- 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
- func ValidateEnvName(name string) 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 MaintenanceSettings
- type ModelCompat
- type ModelConfig
- type ProviderConfig
- type ResponsesConfig
- type ResponsesHostedToolsConfig
- type ResponsesStructuredOutputConfig
- type ResponsesToolControlConfig
- type RetrySettings
- type SandboxSettings
- type Settings
- func (s *Settings) AttachmentStorageReclaimSchedule() string
- 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) IsACPArtifactEnabled() bool
- func (s *Settings) IsArtifactEnabled() bool
- func (s *Settings) IsAttachmentStorageReclaimEnabled() bool
- func (s *Settings) IsImageGenerationEnabled() bool
- func (s *Settings) IsPlanToolEnabled() bool
- func (s *Settings) IsUpdateCheckEnabled() bool
- func (s *Settings) IsWebSearchEnabled() bool
- func (s *Settings) IsWorktreeEnabled() 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) SkillsDisabled() []string
- func (s *Settings) UnmarshalJSON(data []byte) error
- func (s *Settings) WorktreeBranchPrefix() string
- func (s *Settings) WorktreeESMEnabled() bool
- func (s *Settings) WorktreePerChildSubagents() bool
- func (s *Settings) WorktreeStartCommand() string
- type SkillHubMarketSettings
- type SkillHubSettings
- type SkillsSettings
- type StatusLineSettings
- type ToolExecutionSettings
- type WebSearchSettings
- type WorktreeSettings
Constants ¶
const DefaultModelContextWindow = 256000
DefaultModelContextWindow is the conservative context-window fallback used when a model ID is not present in the built-in catalog.
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 ¶
func GlobalEnvPath() string
func GlobalSettingsPath ¶
func GlobalSettingsPath() string
func IsProjectDir ¶
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 MCPServerEnabled ¶
MCPServerEnabled reports whether a configured server entry is enabled. A nil Enabled value means enabled, preserving backwards compatibility with mcp.json files written before the management toggle existed.
func NormalizeMCPConfig ¶
func NormalizeMCPConfig(cfg *MCPConfig)
NormalizeMCPConfig applies basic defaults.
func NormalizeSamplingPtr ¶
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 ¶
ProjectPath returns a project-level path under .mothx in the current working directory.
func ProjectPathFor ¶
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 ¶
SaveProjectSettingsPatch updates only the given top-level keys in the project settings file without expanding defaults.
func ValidateEnvName ¶
ValidateEnvName checks whether a name is acceptable for a global environment variable. It mirrors the rules enforced by EnvConfig.Set.
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 ¶
EnvConfig contains environment variables injected into bash and skill tools.
func (*EnvConfig) ApplyPatch ¶
ApplyPatch atomically applies a set of variable assignments and a set of deletions. It validates every name, rejects duplicates or conflicts, and writes the result once. Values are preserved as-is, including empty strings.
type ImageGenerationSettings ¶
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"`
// Enabled is an additive management toggle. nil keeps every pre-existing
// mcp.json entry enabled so older files and writers behave unchanged.
Enabled *bool `json:"enabled,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 MaintenanceSettings ¶
type MaintenanceSettings struct {
// ReclaimAttachmentStorage gates the private attachment-store reconciliation.
// nil/true = enabled, false = the scheduled job is removed and the work is
// refused even if a stale job row still exists.
ReclaimAttachmentStorage *bool `json:"reclaimAttachmentStorage,omitempty"`
// StorageReconcileSchedule overrides the cadence of that reconciliation
// (for example "@every 12h" or "0 4 * * *"). Empty uses the Runtime default,
// and an invalid value falls back to it with a cron log line.
StorageReconcileSchedule string `json:"storageReconcileSchedule,omitempty"`
}
MaintenanceSettings configures Runtime-owned housekeeping that is scheduled through the shared cron lifecycle but is not a user automation task. Absent means every default applies, and the defaults keep the previous behavior: attachment storage reconciliation runs once a day.
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 PresetModelConfig ¶
func PresetModelConfig(providerID, modelID string, runtime *Settings) ModelConfig
PresetModelConfig returns the best available draft defaults for modelID. The current provider wins, followed by an exact model-ID match elsewhere in the built-in catalog. Unknown IDs receive safe generic defaults. This helper is for creating new model entries; it does not alter existing configuration.
func ResolveModelConfig ¶
func ResolveModelConfig(providerID, modelID string, runtime *Settings) *ModelConfig
ResolveModelConfig merges built-in model defaults with runtime overrides.
func (ModelConfig) MarshalJSON ¶
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 ¶
func (mc ModelConfig) MaxTokensWasSet() bool
func (*ModelConfig) SetMaxTokens ¶
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", "thinking-only", "kimi", "qwen", "doubao-seed"
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 ¶
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 ¶
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 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) EffectiveLevel ¶ added in v1.3.103
func (s SandboxSettings) EffectiveLevel() sandbox.Level
EffectiveLevel resolves the configured sandbox level, defaulting to direct execution when the sandbox is disabled.
func (SandboxSettings) Options ¶
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"`
EnableArtifact *bool `json:"enableArtifact,omitempty"`
EnableACPArtifact *bool `json:"enableACPArtifact,omitempty"`
WebSearch WebSearchSettings `json:"webSearch"`
ImageGeneration ImageGenerationSettings `json:"imageGeneration"`
MaxContextTokens int `json:"maxContextTokens,omitempty"`
ContextFiles ContextFilesSettings `json:"contextFiles"`
SkillsDir string `json:"skillsDir,omitempty"`
Skills *SkillsSettings `json:"skills,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"`
Worktree WorktreeSettings `json:"worktree,omitempty"`
Maintenance *MaintenanceSettings `json:"maintenance,omitempty"`
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 ¶
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) AttachmentStorageReclaimSchedule ¶
AttachmentStorageReclaimSchedule returns the configured cadence for the attachment storage reconciliation, or "" when the Runtime default applies. The value is intentionally not validated here: the scheduler that owns the schedule grammar validates it, so config does not grow a second parser.
func (*Settings) EffectiveImageGeneration ¶
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) IsACPArtifactEnabled ¶
IsACPArtifactEnabled reports whether ACP/Desktop sessions may publish generated artifacts. It is intentionally independent from terminal use.
func (*Settings) IsArtifactEnabled ¶
IsArtifactEnabled reports whether terminal (TUI and print-mode CLI) sessions may publish generated artifacts. The capability is opt-in.
func (*Settings) IsAttachmentStorageReclaimEnabled ¶
IsAttachmentStorageReclaimEnabled reports whether the Runtime-owned reconciliation of unreferenced attachment storage is scheduled and allowed to run. It defaults to true when unset, matching updateCheck: the work is bounded by the attachment retention window and only removes bytes the durable store no longer claims, so it is on unless an operator turns it off.
func (*Settings) IsImageGenerationEnabled ¶
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) IsWorktreeEnabled ¶ added in v1.3.103
IsWorktreeEnabled reports whether creating new worktrees is allowed. Absent configuration means enabled.
func (Settings) MarshalJSON ¶
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 ¶
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) SkillsDisabled ¶
SkillsDisabled returns the configured disabled skill names. It is nil-safe and returns a copy so callers cannot mutate the settings value.
func (*Settings) UnmarshalJSON ¶
func (*Settings) WorktreeBranchPrefix ¶ added in v1.3.103
WorktreeBranchPrefix returns the default branch prefix for created worktrees, falling back to "mothx".
func (*Settings) WorktreeESMEnabled ¶ added in v1.3.103
WorktreeESMEnabled reports whether ESM roles should share one isolated worktree per objective.
func (*Settings) WorktreePerChildSubagents ¶ added in v1.3.103
WorktreePerChildSubagents reports whether every sub-agent should run in its own isolated worktree.
func (*Settings) WorktreeStartCommand ¶ added in v1.3.103
WorktreeStartCommand returns the default start command for created worktrees.
type SkillHubMarketSettings ¶
type SkillHubSettings ¶
type SkillHubSettings struct {
DefaultMarket string `json:"defaultMarket,omitempty"`
DefaultInstallScope string `json:"defaultInstallScope,omitempty"`
OfficialHandles []string `json:"officialHandles,omitempty"`
Markets []SkillHubMarketSettings `json:"markets,omitempty"`
}
type SkillsSettings ¶
type SkillsSettings struct {
Disabled []string `json:"disabled,omitempty"`
}
SkillsSettings controls skill activation. Names listed in Disabled are hidden from every skill discovery surface (system prompt listing, /skill commands, management views) after the next skills load. A nil or absent section keeps every discovered skill enabled, preserving the historical behavior of settings files written before this field existed.
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 ¶
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 ¶
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 ¶
func (s ToolExecutionSettings) EffectiveMode() string
EffectiveMode returns the normalized local tool execution mode.
type WebSearchSettings ¶
type WorktreeSettings ¶ added in v1.3.103
type WorktreeSettings struct {
// Enabled gates creating new worktrees. nil/true = enabled, false = only
// list/remove/reset existing worktrees.
Enabled *bool `json:"enabled,omitempty"`
// BranchPrefix is the default branch prefix for created worktrees.
BranchPrefix string `json:"branchPrefix,omitempty"`
// StartCommand is the default command run after a worktree is created or
// reset. Empty means no start command runs.
StartCommand string `json:"startCommand,omitempty"`
// PerChildSubagents makes every sub-agent run in its own isolated worktree
// (the policy-driven trigger). Explicit per-spawn requests work regardless.
PerChildSubagents bool `json:"perChildSubagents,omitempty"`
// ESM makes ESM worker/critic/audit roles share one isolated worktree per
// objective. Off by default; falls back to the session workspace outside a
// git repository.
ESM bool `json:"esm,omitempty"`
}
WorktreeSettings configures managed git worktrees (see docs/proposal/git-worktree-workspaces-proposal.md). Every field is optional and falls back to the documented default; no existing field meaning changes.