Documentation
¶
Index ¶
- func ConfigDir() string
- func ConfigPath() string
- func HistoryFilePath() (string, error)
- func Logger() *log.Logger
- func MemoryCooldownHours(c *Config) int
- func MemoryDailyTokenBudget(c *Config) int
- func MemoryEnabled(c *Config) bool
- func MemoryGenerate(c *Config) bool
- func MemoryGenerateSetting(c *Config) bool
- func MemoryMaxAgeDays(c *Config) int
- func MemoryMaxUnusedDays(c *Config) int
- func MemoryPhase2TopN(c *Config) int
- func MemorySummaryInjectTokens(c *Config) int
- func NeedsSetup() bool
- func ResolveEffort(prov, mod, providerEffort string) string
- func SaveConfig(cfg *Config) error
- func SaveModelState(state *ModelState) error
- func SessionsDir() (string, error)
- func SessionsIndexPath() (string, error)
- func ToolSearchEnabled(c *Config) bool
- func UsageDir() (string, error)
- func UsageEventsPath() (string, error)
- type ApprovalReviewConfig
- type BrowserConfig
- type BrowserSitePermission
- type BudgetConfig
- type ChannelConfig
- type CompactionConfig
- type ComputerAppPermission
- type ComputerConfig
- type Config
- func (c *Config) ApprovalReviewSettings() ApprovalReviewConfig
- func (c *Config) CompactionThreshold() float64
- func (c *Config) GetProviderModel() (provider, model string)
- func (c *Config) GetProviders() map[string]*ProviderConfig
- func (c *Config) MemoryConfigSnapshot() *MemoryConfig
- func (c *Config) MemoryPipelineSnapshot() *Config
- func (c *Config) MemorySettings() MemoryConfig
- func (c *Config) SetApprovalReview(rc *ApprovalReviewConfig)
- func (c *Config) SetMemory(mc *MemoryConfig)
- func (c *Config) SetToolSearch(tc *ToolSearchConfig)
- func (c *Config) ToolSearchConfigSnapshot() *ToolSearchConfig
- func (c *Config) ToolSearchSettings() ToolSearchConfig
- type CustomModelConfig
- type DockerAlias
- type LangfuseConfig
- type MCPOAuthConfig
- type MCPServer
- type MemoryConfig
- type ModelRef
- type ModelState
- func (s *ModelState) AddRecent(ref ModelRef)
- func (s *ModelState) GetEffortOverride(ref ModelRef) string
- func (s *ModelState) IsFavorite(ref ModelRef) bool
- func (s *ModelState) IsModelEnabled(ref ModelRef, defaultEnabled bool) bool
- func (s *ModelState) SetEffortOverride(ref ModelRef, effort string)
- func (s *ModelState) SetModelEnabled(ref ModelRef, enabled bool)
- func (s *ModelState) ToggleFavorite(ref ModelRef) bool
- type PromptConfig
- type ProviderConfig
- type SSHAlias
- type SubagentConfig
- type TeamConfig
- type TelemetryConfig
- type ToolSearchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigDir ¶
func ConfigDir() string
ConfigDir returns the full path to the config directory (~/.jcode).
func ConfigPath ¶
func ConfigPath() string
ConfigPath returns the expected path of the config file (for display purposes)
func HistoryFilePath ¶
HistoryFilePath returns the full path to the history file
func Logger ¶
Logger returns the shared application logger that writes to ~/.jcode/debug.log. It is initialised lazily and is safe for concurrent use.
func MemoryCooldownHours ¶ added in v0.8.1
MemoryCooldownHours returns the pipeline cooldown (default 6).
func MemoryDailyTokenBudget ¶ added in v0.8.1
MemoryDailyTokenBudget returns the pipeline daily token budget (default 300k).
func MemoryEnabled ¶ added in v0.8.1
MemoryEnabled reports whether the memory system is on (default true).
func MemoryGenerate ¶ added in v0.8.1
MemoryGenerate reports whether the distillation pipeline may run (default true).
func MemoryGenerateSetting ¶ added in v0.10.1
MemoryGenerateSetting reports the stored auto-distillation preference independently of the master Memory switch. Settings UIs must use this value so temporarily disabling Memory does not erase the user's Dream preference.
func MemoryMaxAgeDays ¶ added in v0.8.1
MemoryMaxAgeDays returns the extraction window (default 30).
func MemoryMaxUnusedDays ¶ added in v0.8.1
MemoryMaxUnusedDays returns the unused-expiry window (default 45).
func MemoryPhase2TopN ¶ added in v0.8.1
MemoryPhase2TopN returns the consolidation input cap (default 40).
func MemorySummaryInjectTokens ¶ added in v0.8.1
MemorySummaryInjectTokens returns the summary injection cap (default 1200).
func NeedsSetup ¶
func NeedsSetup() bool
NeedsSetup returns true if the config file does not exist or is incomplete.
func ResolveEffort ¶ added in v0.7.2
ResolveEffort returns the effective reasoning effort for a model: the per-model override (from the chat picker) if set, otherwise the provider-level fallback from ProviderConfig. Empty ("") means "send no effort parameter". This is the single place that defines override precedence so every entrypoint (web/TUI/ACP) applies the same value.
func SaveConfig ¶
SaveConfig writes the config to $HOME/.jcode/config.json.
func SaveModelState ¶ added in v0.3.10
func SaveModelState(state *ModelState) error
SaveModelState writes the model state to disk.
func SessionsDir ¶
SessionsDir returns the path to the sessions directory (~/.jcode/sessions).
func SessionsIndexPath ¶
SessionsIndexPath returns the path to the sessions index file (~/.jcode/sessions/session.json).
func ToolSearchEnabled ¶ added in v0.10.1
ToolSearchEnabled reports whether progressive tool disclosure is enabled. It is disabled by default, including for absent config blocks and nil values.
func UsageDir ¶ added in v0.6.3
UsageDir returns the path to the usage-statistics directory (~/.jcode/usage).
func UsageEventsPath ¶ added in v0.6.3
UsageEventsPath returns the path to the append-only usage event log (~/.jcode/usage/events.jsonl), one JSON line per recorded agent turn.
Types ¶
type ApprovalReviewConfig ¶ added in v0.9.6
type ApprovalReviewConfig struct {
// Model is the "provider/model" (or "small" alias) the reviewer runs on.
// Empty resolves to small_model, then to the main model — so the reviewer
// always has a working model even if small_model is unset.
Model string `json:"model,omitempty"`
// Policy is extra workspace-specific policy text appended to the built-in
// risk policy (e.g. trusted internal hosts, stricter deny rules).
Policy string `json:"policy,omitempty"`
// TimeoutSeconds bounds a single review. 0 uses the built-in default.
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
// Investigate lets the reviewer run read-only tools (read/grep/glob) to
// gather evidence before deciding (V2). Off by default (single-shot).
Investigate bool `json:"investigate,omitempty"`
// ReuseSession keeps a cached reviewer conversation so the large policy
// prefix is served from the provider's prompt cache across reviews (V3).
ReuseSession bool `json:"reuse_session,omitempty"`
// AuditPath overrides the verdict log location. Empty →
// <config dir>/approval-review.jsonl.
AuditPath string `json:"audit_path,omitempty"`
}
ApprovalReviewConfig holds tuning knobs for jcode's LLM approval reviewer. The reviewer is active only in Auto session mode; these settings control its model, policy, timeout, investigation behavior, prompt-cache reuse, and audit log location. See internal-doc/approval-review-design.md.
type BrowserConfig ¶ added in v0.8.1
type BrowserConfig struct {
Enabled bool `json:"enabled,omitempty"`
Backend string `json:"backend,omitempty"` // auto | managed | extension (default auto)
ChromePath string `json:"chrome_path,omitempty"` // empty → auto-discover
Headless bool `json:"headless,omitempty"` // managed backend
Viewport string `json:"viewport,omitempty"` // e.g. "1280x720"
// Approval holds per-class defaults: "navigate" and "interact" map to
// "ask" (default) or "always_allow".
Approval map[string]string `json:"approval,omitempty"`
// SitePermissions overrides Approval defaults per origin.
SitePermissions []BrowserSitePermission `json:"site_permissions,omitempty"`
// DevMode unlocks browser_eval / raw CDP (high-risk). Off by default.
DevMode bool `json:"dev_mode,omitempty"`
}
BrowserConfig controls the browser-use capability. Browser use is opt-in: an absent block and Enabled=false both keep its tools out of the agent schema.
type BrowserSitePermission ¶ added in v0.8.1
type BrowserSitePermission struct {
Origin string `json:"origin"`
Interact string `json:"interact,omitempty"` // ask | allow
}
BrowserSitePermission is a per-origin approval override.
type BudgetConfig ¶
type BudgetConfig struct {
MaxTokensPerTurn int64 `json:"max_tokens_per_turn,omitempty"`
MaxCostPerSession float64 `json:"max_cost_per_session,omitempty"`
WarningThreshold float64 `json:"warning_threshold,omitempty"`
}
BudgetConfig controls token and cost budget limits.
type ChannelConfig ¶ added in v0.1.1
type ChannelConfig struct {
// WebEnabled enables WeChat channel in web mode (default false).
WebEnabled bool `json:"web_enabled,omitempty"`
// BLEEnabled enables BLE device notifications (default false).
BLEEnabled bool `json:"ble_enabled,omitempty"`
}
ChannelConfig controls external messaging channel behavior.
type CompactionConfig ¶
type CompactionConfig struct {
Enabled bool `json:"enabled,omitempty"`
Threshold float64 `json:"threshold,omitempty"`
KeepRecent int `json:"keep_recent,omitempty"`
}
CompactionConfig controls automatic context compaction. Compaction always runs on the session's main model: summary quality directly bounds the agent's post-compaction performance, so it is deliberately not routed to SmallModel (a former "summary_model" key was parsed but never honored, and has been removed).
type ComputerAppPermission ¶ added in v0.10.1
type ComputerAppPermission struct {
BundleID string `json:"bundle_id"`
Tier string `json:"tier,omitempty"` // read | click | full; "" = built-in default
Launch string `json:"launch,omitempty"` // ask | allow
Interact string `json:"interact,omitempty"` // ask | allow
}
ComputerAppPermission is a per-app approval override.
Tier may only tighten the built-in tier for that app; a row that tries to loosen one is ignored (internal/computer.Manager.TierOverrides). Loosening is a deliberate act the settings UI gates behind a warning — a hand-edited config file is not that gate.
type ComputerConfig ¶ added in v0.10.1
type ComputerConfig struct {
Enabled bool `json:"enabled,omitempty"`
// Backend is retained only to migrate configurations written before computer
// use became macOS-helper-only. Runtime backend selection must not consult it.
//
// Deprecated: safe legacy values (empty, auto, helper) are discarded. Any
// other value fails closed via MigrateLegacyBackend so a configuration that
// expected a fake screen can never start controlling the real desktop after an
// upgrade.
Backend string `json:"backend,omitempty"`
// Approval holds per-class defaults: "launch" and "interact" map to
// "ask" (default) or "always_allow".
Approval map[string]string `json:"approval,omitempty"`
// AppPermissions overrides Approval defaults, and optionally the tier, per app.
AppPermissions []ComputerAppPermission `json:"app_permissions,omitempty"`
// MaxActionsPerBatch bounds a computer_act batch (default 20).
MaxActionsPerBatch int `json:"max_actions_per_batch,omitempty"`
// Grant flags, orthogonal to the app allowlist. All off by default: an app
// grant is not a clipboard grant.
ClipboardRead bool `json:"clipboard_read,omitempty"`
ClipboardWrite bool `json:"clipboard_write,omitempty"`
SystemKeyCombos bool `json:"system_key_combos,omitempty"`
}
ComputerConfig controls the computer-use capability (native desktop app control). See internal-doc/computer-use-design.md.
Enabled defaults to false. Like browser use, computer use is opt-in; it also requires native OS permissions because it can reach anything on the machine.
func (*ComputerConfig) MigrateLegacyBackend ¶ added in v0.10.1
func (c *ComputerConfig) MigrateLegacyBackend() (rejected string)
MigrateLegacyBackend removes the obsolete computer backend selector.
Empty, auto, and helper all meant the shipping native helper and therefore preserve the surrounding policy. fake, osa, and unknown values are unsafe to reinterpret: mapping an enabled fake configuration to the real helper would unexpectedly turn a test screen into real desktop control. Those values fail closed by disabling computer use and clearing every persisted preapproval and ambient grant. The rejected normalized value is returned for diagnostics.
type Config ¶
type Config struct {
// Provider settings: map of provider name → config (api_key, base_url)
Providers map[string]*ProviderConfig `json:"providers"`
// Deprecated: use Providers instead. Kept for backward compatibility.
Models map[string]*ProviderConfig `json:"models,omitempty"`
// Active model in "provider/model" format (e.g. "openai/gpt-4o")
Model string `json:"model"`
// SmallModel is an optional lightweight model in "provider/model" format.
// It backs the "small" model alias (subagent/flow model params) and LLM
// session-title generation. Unset → those paths use the main model /
// truncated titles; behavior is unchanged.
SmallModel string `json:"small_model,omitempty"`
// ContextLimits overrides the resolved context window (in tokens) for a model.
// Keys may be "provider/model" (preferred) or a bare model id. Use this to teach
// jcode the window of a brand-new or custom model the registry doesn't know yet.
ContextLimits map[string]int `json:"context_limits,omitempty"`
// DefaultContextLimit is the fallback context window (in tokens) assumed when a
// model's limit is unknown from the registry and built-in tables. Defaults to 200000.
DefaultContextLimit int `json:"default_context_limit,omitempty"`
// Deprecated: use Model field with "provider/model" format instead.
Provider string `json:"provider,omitempty"`
MaxIterations int `json:"max_iterations,omitempty"`
SSHAliases []SSHAlias `json:"ssh_aliases,omitempty"`
DockerAliases []DockerAlias `json:"docker_aliases,omitempty"`
MCPServers map[string]*MCPServer `json:"mcp_servers,omitempty"`
Telemetry *TelemetryConfig `json:"telemetry,omitempty"`
Budget *BudgetConfig `json:"budget,omitempty"`
Compaction *CompactionConfig `json:"compaction,omitempty"`
Prompt *PromptConfig `json:"prompt,omitempty"`
Subagent *SubagentConfig `json:"subagent,omitempty"`
Team *TeamConfig `json:"team,omitempty"`
Memory *MemoryConfig `json:"memory,omitempty"`
// AutoApprove sets the default approval mode to auto on startup.
//
// Deprecated: superseded by DefaultMode; still honored as a fallback when
// DefaultMode is empty (true → "full_access").
AutoApprove bool `json:"auto_approve,omitempty"`
// DefaultMode is the unified session mode to start in: "approval" (default),
// "plan", or "full_access". When empty, AutoApprove is used as a fallback.
DefaultMode string `json:"default_mode,omitempty"`
// Theme is the built-in color theme name for the terminal UI (e.g.
// "jcode-dark", "nord-dark", "github-light"). Empty auto-selects a default
// from the detected terminal background. See internal/theme for the catalog.
Theme string `json:"theme,omitempty"`
// Channel controls external messaging channel behavior.
Channel *ChannelConfig `json:"channel,omitempty"`
// DisabledProviders lists provider IDs to exclude from registry
DisabledProviders []string `json:"disabled_providers,omitempty"`
// DisabledSkills lists skill names to exclude from the agent (slash commands,
// system-prompt descriptions, and the load_skill tool).
DisabledSkills []string `json:"disabled_skills,omitempty"`
// ToolSearch controls progressive tool disclosure. It is opt-in so existing
// configurations keep exposing the complete static tool set.
ToolSearch *ToolSearchConfig `json:"tool_search,omitempty"`
// Browser controls the browser-use capability (CDP-driven page control).
Browser *BrowserConfig `json:"browser,omitempty"`
// Computer controls the computer-use capability (native desktop app control).
Computer *ComputerConfig `json:"computer,omitempty"`
// ApprovalReview holds tuning knobs for the LLM approval reviewer used in
// Auto session mode. It does not contain an on/off switch — the reviewer is
// active whenever the session is in Auto mode.
ApprovalReview *ApprovalReviewConfig `json:"approval_review,omitempty"`
}
Config represents the application configuration
func LoadConfig ¶
LoadConfig loads configuration from $HOME/.jcode/config.json.
func (*Config) ApprovalReviewSettings ¶ added in v0.9.6
func (c *Config) ApprovalReviewSettings() ApprovalReviewConfig
ApprovalReviewSettings returns a snapshot of the reviewer tuning knobs, or zero values when unset. The copy means callers never hold a pointer into the live config, so a later SetApprovalReview cannot mutate what they read.
func (*Config) CompactionThreshold ¶ added in v0.5.1
CompactionThreshold returns the configured fraction (0-1) of the context window at which automatic compaction/summarization triggers, or 0.75 when unset/invalid.
func (*Config) GetProviderModel ¶
GetProviderModel returns the provider name and model name from the active Model field. If Model is in "provider/model" format, it splits them. Otherwise it falls back to the legacy Provider + Model fields.
func (*Config) GetProviders ¶
func (c *Config) GetProviders() map[string]*ProviderConfig
GetProviders returns the effective provider map, merging legacy Models field into Providers.
func (*Config) MemoryConfigSnapshot ¶ added in v0.10.1
func (c *Config) MemoryConfigSnapshot() *MemoryConfig
MemoryConfigSnapshot returns a detached copy of the stored block while preserving the distinction between an absent block and an explicit empty block. Settings handlers use it for exact rollback when persistence fails.
func (*Config) MemoryPipelineSnapshot ¶ added in v0.10.1
MemoryPipelineSnapshot returns a Config copy whose Memory block is detached from the live settings. A pipeline run may retain this snapshot for its whole lifetime without racing a Settings update or observing a half-updated block.
func (*Config) MemorySettings ¶ added in v0.10.1
func (c *Config) MemorySettings() MemoryConfig
MemorySettings returns a detached snapshot of the memory settings. A zero value represents an absent block and is interpreted by the helpers below using the documented defaults.
func (*Config) SetApprovalReview ¶ added in v0.9.6
func (c *Config) SetApprovalReview(rc *ApprovalReviewConfig)
SetApprovalReview publishes a new reviewer tuning block onto the live config so reviewers built after this call pick it up. rc must not be mutated after being handed over.
func (*Config) SetMemory ¶ added in v0.10.1
func (c *Config) SetMemory(mc *MemoryConfig)
SetMemory atomically publishes a detached copy of mc. Callers may safely reuse or mutate mc after this method returns. Passing nil removes the block.
func (*Config) SetToolSearch ¶ added in v0.10.1
func (c *Config) SetToolSearch(tc *ToolSearchConfig)
SetToolSearch atomically publishes a detached copy of tc. Passing nil removes the block and restores the disabled default.
func (*Config) ToolSearchConfigSnapshot ¶ added in v0.10.1
func (c *Config) ToolSearchConfigSnapshot() *ToolSearchConfig
ToolSearchConfigSnapshot returns a detached copy of the stored block while preserving nil. This lets a failed Settings save restore the exact prior representation rather than replacing an absent block with an empty one.
func (*Config) ToolSearchSettings ¶ added in v0.10.1
func (c *Config) ToolSearchSettings() ToolSearchConfig
ToolSearchSettings returns a detached settings snapshot. Its zero value is the disabled-by-default configuration.
type CustomModelConfig ¶ added in v0.4.8
type CustomModelConfig struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
ToolCall bool `json:"tool_call,omitempty"`
Reasoning bool `json:"reasoning,omitempty"`
Context int `json:"context,omitempty"`
// Attachment marks the model as accepting image inputs. When false (the
// default) the model inherits the provider-level Vision override (if set) or
// the registry default (allow images).
Attachment bool `json:"attachment,omitempty"`
// EffortTiers are the selectable reasoning-effort levels for a reasoning
// model, e.g. ["minimal","low","medium","high","max"]. When Reasoning is true
// and this is non-empty, it overrides the default standard effort options;
// when empty the standard set (minimal/low/medium/high) is used.
EffortTiers []string `json:"effort_tiers,omitempty"`
}
CustomModelConfig defines a model that can be added via config.
type DockerAlias ¶ added in v0.6.4
type DockerAlias struct {
Name string `json:"name"`
Container string `json:"container"` // container name or id
Path string `json:"path,omitempty"` // working directory inside the container
}
DockerAlias represents a saved Docker container alias
type LangfuseConfig ¶
type LangfuseConfig struct {
Host string `json:"LANGFUSE_BASE_URL,omitempty"`
PublicKey string `json:"LANGFUSE_PUBLIC_KEY,omitempty"`
SecretKey string `json:"LANGFUSE_SECRET_KEY,omitempty"`
}
LangfuseConfig holds Langfuse telemetry credentials.
type MCPOAuthConfig ¶ added in v0.5.2
type MCPOAuthConfig struct {
// Enabled turns on the OAuth bearer-token flow for this server.
Enabled bool `json:"enabled,omitempty"`
// ClientID is the OAuth client id. Empty → attempt dynamic registration.
ClientID string `json:"client_id,omitempty"`
// ClientSecret is set for confidential clients (manual fallback).
ClientSecret string `json:"client_secret,omitempty"`
// Scopes is the list of OAuth scopes to request.
Scopes []string `json:"scopes,omitempty"`
// AuthServerMetadataURL optionally overrides automatic metadata discovery.
AuthServerMetadataURL string `json:"auth_server_metadata_url,omitempty"`
}
MCPOAuthConfig holds OAuth 2.0 settings for an MCP server. Tokens are NOT stored here — they live in ~/.jcode/oauth/<server>.json. ClientID/ClientSecret are the manual fallback used when the authorization server does not support dynamic client registration (RFC 7591).
type MCPServer ¶
type MCPServer struct {
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env []string `json:"env,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
// TimeoutSeconds is the request timeout for HTTP/SSE transports. 0 → default (180s).
TimeoutSeconds int `json:"timeout_seconds,omitempty"`
// Disabled, when true, excludes this server from tool loading without deleting it.
Disabled bool `json:"disabled,omitempty"`
// OAuth configures OAuth 2.0 authorization for HTTP/SSE transports (MCP
// authorization spec). When nil, only static Headers are used.
OAuth *MCPOAuthConfig `json:"oauth,omitempty"`
}
MCPServer represents a configured MCP server connection
type MemoryConfig ¶ added in v0.8.1
type MemoryConfig struct {
Enabled *bool `json:"enabled,omitempty"` // default true; false disables read+write
// Generate gates only the offline distillation pipeline (M2+). When false,
// reading/injection and memory_note inbox writes remain available.
Generate *bool `json:"generate,omitempty"` // default true
// Model for pipeline extraction, "provider/model". Empty → main Model.
// Deliberately not routed through SmallModel: distilled memories persist
// across sessions, so extraction quality matters more than the token cost.
Model string `json:"model,omitempty"`
// DailyTokenBudget caps pipeline token spend per day (BYOM guard).
DailyTokenBudget int `json:"daily_token_budget,omitempty"` // default 300000
CooldownHours int `json:"cooldown_hours,omitempty"` // default 6
MaxAgeDays int `json:"max_age_days,omitempty"` // default 30
MaxUnusedDays int `json:"max_unused_days,omitempty"` // default 45
Phase2TopN int `json:"phase2_top_n,omitempty"` // default 40
// SummaryInjectTokens caps the memory summary injected into the system prompt.
SummaryInjectTokens int `json:"summary_inject_tokens,omitempty"` // default 1200
}
MemoryConfig controls cross-session learned memory (the file-based store under ~/.jcode/memory). See internal-doc/agent-memory-design.md. All fields have defaults so zero config works; Enabled/Generate are pointers because their default is true.
type ModelState ¶ added in v0.3.10
type ModelState struct {
Recent []ModelRef `json:"recent,omitempty"`
Favorite []ModelRef `json:"favorite,omitempty"`
// EnabledModels lists models explicitly enabled by the user (shown in model selector).
// If nil/empty, default-enabled models from the registry are used.
EnabledModels []ModelRef `json:"enabled_models,omitempty"`
// DisabledModels lists models explicitly disabled by the user (hidden from model selector).
DisabledModels []ModelRef `json:"disabled_models,omitempty"`
// EffortOverrides holds per-"provider/model" reasoning-effort choices made
// from the chat model picker. An empty value ("") means "use the model's
// default / unset" and clears any earlier override. This takes precedence
// over the provider-level ProviderConfig.ReasoningEffort when present.
EffortOverrides map[string]string `json:"effort_overrides,omitempty"`
}
ModelState tracks recent, favorite, and visibility settings for models.
func LoadModelState ¶ added in v0.3.10
func LoadModelState() (*ModelState, error)
LoadModelState loads the model state from disk.
func (*ModelState) AddRecent ¶ added in v0.3.10
func (s *ModelState) AddRecent(ref ModelRef)
AddRecent adds a model to the recent list (deduped, max 10).
func (*ModelState) GetEffortOverride ¶ added in v0.7.2
func (s *ModelState) GetEffortOverride(ref ModelRef) string
GetEffortOverride returns the user's per-model reasoning-effort choice, or "" when none is set (callers then fall back to the provider-level setting).
func (*ModelState) IsFavorite ¶ added in v0.3.10
func (s *ModelState) IsFavorite(ref ModelRef) bool
IsFavorite returns whether the given model is in the favorites list.
func (*ModelState) IsModelEnabled ¶ added in v0.3.10
func (s *ModelState) IsModelEnabled(ref ModelRef, defaultEnabled bool) bool
IsModelEnabled returns whether the given model should be shown in the model selector. Logic: if the model is in EnabledModels, it's enabled. If the model is in DisabledModels, it's disabled. Otherwise, fallback to the defaultEnabled parameter (from registry).
func (*ModelState) SetEffortOverride ¶ added in v0.7.2
func (s *ModelState) SetEffortOverride(ref ModelRef, effort string)
SetEffortOverride records the user's reasoning-effort choice for a model. An empty effort clears the override, restoring the default behavior.
func (*ModelState) SetModelEnabled ¶ added in v0.3.10
func (s *ModelState) SetModelEnabled(ref ModelRef, enabled bool)
SetModelEnabled explicitly enables or disables a model in the model selector.
func (*ModelState) ToggleFavorite ¶ added in v0.3.10
func (s *ModelState) ToggleFavorite(ref ModelRef) bool
ToggleFavorite adds or removes a model from favorites. Returns true if now favorite.
type PromptConfig ¶
type PromptConfig struct {
Compaction *CompactionConfig `json:"compaction,omitempty"`
MemoryMaxChars int `json:"memory_max_chars,omitempty"`
MemoryMaxDepth int `json:"memory_max_depth,omitempty"`
CacheEnabled bool `json:"cache_enabled,omitempty"`
AsyncEnvTimeout string `json:"async_env_timeout,omitempty"`
}
PromptConfig controls prompt system behavior.
type ProviderConfig ¶
type ProviderConfig struct {
APIKey string `json:"api_key"`
BaseURL string `json:"base_url,omitempty"`
// Name is an optional display name for custom providers not in the registry.
Name string `json:"name,omitempty"`
// Headers are extra HTTP headers injected into every request to this
// provider's endpoint (e.g. a gateway's "X-Api-Key" or "X-Org-Id"). Values
// may be secrets — they are masked by the API and never logged.
Headers map[string]string `json:"headers,omitempty"`
// Vision, when non-nil, overrides registry detection of image-input support
// for this provider. nil ⇒ defer to registry metadata (default: allow images).
Vision *bool `json:"vision,omitempty"`
// Thinking, when non-nil, explicitly toggles extended reasoning for this
// provider. It is sent as the OpenAI-compatible chat_template_kwargs
// {"enable_thinking": <bool>} extension (e.g. qwen3 gateways). nil ⇒ omit.
Thinking *bool `json:"thinking,omitempty"`
// ReasoningEffort controls thinking depth via the OpenAI-compatible
// "reasoning_effort" parameter. One of "", "low", "medium", "high".
// Empty ⇒ omit the parameter.
ReasoningEffort string `json:"reasoning_effort,omitempty"`
// Deprecated: model lists are now sourced from the models.dev registry.
// Preserved for backward compatibility with existing config files.
Models []string `json:"models,omitempty"`
// CustomModels defines additional models for this provider.
// These are merged into the registry and treated identically to built-in models.
CustomModels []CustomModelConfig `json:"custom_models,omitempty"`
}
type SSHAlias ¶
type SSHAlias struct {
Name string `json:"name"`
Addr string `json:"addr"` // user@host
Path string `json:"path,omitempty"` // remote working directory
}
SSHAlias represents a saved SSH connection alias
type SubagentConfig ¶
type SubagentConfig struct {
MaxParallel int `json:"max_parallel,omitempty"`
MaxCompleted int `json:"max_completed,omitempty"`
MaxDepth int `json:"max_depth,omitempty"`
}
SubagentConfig controls subagent behavior.
type TeamConfig ¶
type TeamConfig struct {
MaxTeammates int `json:"max_teammates,omitempty"` // max teammates per team (default 5)
MailboxPollMs int `json:"mailbox_poll_ms,omitempty"` // mailbox poll interval in ms (default 500)
MessageCap int `json:"message_cap,omitempty"` // max messages in UI per teammate (default 50)
}
TeamConfig controls agent team behavior.
type TelemetryConfig ¶
type TelemetryConfig struct {
Langfuse *LangfuseConfig `json:"langfuse,omitempty"`
}
TelemetryConfig holds optional observability integrations.
type ToolSearchConfig ¶ added in v0.10.1
type ToolSearchConfig struct {
Enabled *bool `json:"enabled,omitempty"`
}
ToolSearchConfig controls progressive tool disclosure. Enabled is a pointer so config round-trips preserve an explicitly disabled value while an absent value remains distinguishable for future compatibility.