Documentation
¶
Index ¶
- func ConfigDir() string
- func ConfigPath() string
- func HistoryFilePath() (string, error)
- func Logger() *log.Logger
- func NeedsSetup() bool
- func SaveConfig(cfg *Config) error
- func SessionsDir() (string, error)
- func SessionsIndexPath() (string, error)
- type BudgetConfig
- type ChannelConfig
- type CompactionConfig
- type Config
- type LangfuseConfig
- type MCPServer
- type PromptConfig
- type ProviderConfig
- type SSHAlias
- type SubagentConfig
- type TeamConfig
- type TelemetryConfig
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 NeedsSetup ¶
func NeedsSetup() bool
NeedsSetup returns true if the config file does not exist or is incomplete.
func SaveConfig ¶
SaveConfig writes the config to $HOME/.jcode/config.json.
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).
Types ¶
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"`
}
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"`
SummaryModel string `json:"summary_model,omitempty"`
}
CompactionConfig controls automatic context compaction.
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 for lightweight tasks (summaries, compaction) in "provider/model" format
SmallModel string `json:"small_model,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"`
MCPServers map[string]*MCPServer `json:"mcp_servers,omitempty"`
Telemetry *TelemetryConfig `json:"telemetry,omitempty"`
Budget *BudgetConfig `json:"budget,omitempty"`
FallbackModel string `json:"fallback_model,omitempty"`
Compaction *CompactionConfig `json:"compaction,omitempty"`
Prompt *PromptConfig `json:"prompt,omitempty"`
Subagent *SubagentConfig `json:"subagent,omitempty"`
Team *TeamConfig `json:"team,omitempty"`
// AutoApprove sets the default approval mode to auto on startup.
AutoApprove bool `json:"auto_approve,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"`
}
Config represents the application configuration
func LoadConfig ¶
LoadConfig loads configuration from $HOME/.jcode/config.json.
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.
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 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"`
}
MCPServer represents a configured MCP server connection
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 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.