Documentation
¶
Index ¶
- Constants
- Variables
- func BrainInstructions() string
- func BrainPath() string
- func Dir() (string, error)
- func Exists() bool
- func ExpandTemplate(v string) (string, error)
- func IsWholeRef(v string) bool
- func LoadCatalogs() map[string]Catalog
- func LogEvent(op, detail string)
- func MarkSetupDone()
- func MigrateProjectDir(project string) error
- func Path() (string, error)
- func ProjectDir(project string) string
- func ProjectGoalMaxRounds(dir string) int
- func ProjectID(dir string) string
- func ReadJSON(name string, v any) error
- func ResolveEnvMap(env map[string]string) (map[string]string, error)
- func ResolveEnvMapContext(ctx context.Context, env map[string]string) (map[string]string, error)
- func ResolveHeader(v string) (string, error)
- func ResolveHeaderContext(ctx context.Context, v string) (string, error)
- func ResolveSecret(v string) (string, error)
- func ResolveSecretContext(ctx context.Context, v string) (string, error)
- func SaveCatalogs(cats map[string]Catalog) error
- func SetProjectGoalMaxRounds(dir string, n int) error
- func SetupDone() bool
- func SystemInstructions() string
- func SystemPath() string
- func Trust(dir string) error
- func Trusted(dir string) bool
- func TrustedPath() (string, error)
- func UserDir() (string, error)
- func WriteJSON(name string, v any) error
- type AIApprovalConfig
- type BrowserConfig
- type Catalog
- func (c Catalog) ContextLength(id string) int
- func (c Catalog) Efforts(id string) []string
- func (c Catalog) Find(id string) *ModelInfoLite
- func (c Catalog) MaxCompletionTokens(id string) int
- func (c Catalog) Pricing(id string) (ai.TokenRates, bool)
- func (c Catalog) Stale() bool
- func (c Catalog) SupportsVision(id string) (vision, found bool)
- type ComputerConfig
- type Config
- func (c *Config) AdoptMemory(from *Config)
- func (c *Config) ImageConfigUnavailable() bool
- func (c *Config) OrderedProviderIDs() []string
- func (c *Config) RemoveProvider(name string)
- func (c *Config) Resolve(model, provider string) (Provider, Model, string, error)
- func (c *Config) Save() error
- func (c *Config) SaveFile(filename string) error
- func (c *Config) Snapshot() *Config
- type CustomHeader
- type Hook
- type LSPServer
- type MCPServer
- type MemoryConfig
- type Model
- type ModelInfoLite
- type PiModel
- type PromptFile
- type Provider
- type RulesCompatConfig
- type SamplingParams
- type SandboxConfig
- type UnknownModelError
Constants ¶
const DefaultCompactModel = "model1"
const DefaultCompactPct = 50
const DefaultGoalMaxRounds = 100
const SecretCmdTimeout = 5 * time.Second
const SystemSeed = `` /* 5834-byte string literal not displayed */
Variables ¶
var HookEvents = []string{
"SessionStart", "UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure",
"PreCompact", "PostCompact", "Stop", "SessionEnd",
}
HookEvents lists the lifecycle events a hooks entry may name.
Functions ¶
func BrainInstructions ¶ added in v0.103.0
func BrainInstructions() string
func ExpandTemplate ¶
func IsWholeRef ¶
func LoadCatalogs ¶
func MarkSetupDone ¶
func MarkSetupDone()
func MigrateProjectDir ¶ added in v0.107.0
func ProjectDir ¶ added in v0.107.0
func ProjectGoalMaxRounds ¶
func ResolveEnvMapContext ¶ added in v0.103.0
func ResolveHeader ¶
func ResolveHeaderContext ¶ added in v0.103.0
func ResolveSecret ¶
func ResolveSecretContext ¶ added in v0.103.0
func SaveCatalogs ¶
func SetProjectGoalMaxRounds ¶
func SystemInstructions ¶ added in v0.106.0
func SystemInstructions() string
func SystemPath ¶ added in v0.106.0
func SystemPath() string
func TrustedPath ¶ added in v0.103.0
Types ¶
type AIApprovalConfig ¶ added in v0.107.6
type AIApprovalConfig struct {
Mode string `json:"mode"`
Provider string `json:"provider,omitempty"`
Model string `json:"model,omitempty"`
}
func (AIApprovalConfig) Enabled ¶ added in v0.107.6
func (c AIApprovalConfig) Enabled() bool
func (*AIApprovalConfig) UnmarshalJSON ¶ added in v0.107.6
func (c *AIApprovalConfig) UnmarshalJSON(data []byte) error
UnmarshalJSON accepts the read-only perRun marker that /v1/settings adds (capability ai_review_per_run), so a host can write back exactly what it read. The marker is never stored; any other unknown field is still rejected.
func (AIApprovalConfig) Validate ¶ added in v0.107.6
func (c AIApprovalConfig) Validate() error
type BrowserConfig ¶
type Catalog ¶
type Catalog struct {
FetchedAt time.Time `json:"fetchedAt"`
BaseURL string `json:"baseUrl"`
Models []ModelInfoLite `json:"models"`
}
func (Catalog) ContextLength ¶
func (Catalog) Find ¶
func (c Catalog) Find(id string) *ModelInfoLite
func (Catalog) MaxCompletionTokens ¶
func (Catalog) SupportsVision ¶
type ComputerConfig ¶
type ComputerConfig struct {
Backend string `json:"backend,omitempty"`
Command []string `json:"command,omitempty"`
ApprovalPolicy string `json:"approvalPolicy,omitempty"`
Allow []string `json:"allow,omitempty"`
Deny []string `json:"deny,omitempty"`
DefaultDeny *bool `json:"defaultDeny,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}
type Config ¶
type Config struct {
// Image is optional. Public JSON is redacted; marshalConfig uses private disk types.
Image *imaging.ImageSettings `json:"image,omitempty"`
Language string `json:"language,omitempty"`
DefaultModel string `json:"defaultModel"`
DefaultProvider string `json:"defaultProvider,omitempty"`
DefaultEffort string `json:"defaultEffort,omitempty"`
CompactModel string `json:"compactModel,omitempty"`
CompactProvider string `json:"compactProvider,omitempty"`
CompactPct int `json:"compactPct,omitempty"`
TaskModel string `json:"taskModel,omitempty"`
TaskProvider string `json:"taskProvider,omitempty"`
Theme string `json:"theme,omitempty"`
Mouse *bool `json:"mouse,omitempty"`
Thinking *bool `json:"thinking,omitempty"`
CollapsePaste *bool `json:"collapsePaste,omitempty"`
GoalMaxRounds int `json:"goalMaxRounds,omitempty"`
WorktreeSubagents *bool `json:"worktreeSubagents,omitempty"`
MaxRetries int `json:"maxRetries,omitempty"`
Experimental []string `json:"experimental,omitempty"`
Providers map[string]Provider `json:"providers"`
// ProviderOrder is the user's display order. It is persisted per provider inside
// metadata (see providerOrderMetadataKey); empty means providers sort by ID.
ProviderOrder []string `json:"-"`
Models map[string]Model `json:"-"`
MCPServers map[string]MCPServer `json:"mcp,omitempty"`
LSPServers map[string]LSPServer `json:"lsp,omitempty"`
Browser BrowserConfig `json:"browser,omitzero"`
// Memory is persisted in the memorySwitchSuffix file, never in config.json; the key is still
// read so values written by earlier builds of the switch carry over.
Memory MemoryConfig `json:"memory,omitzero"`
AIApproval AIApprovalConfig `json:"aiApproval,omitzero"`
Computer ComputerConfig `json:"computer,omitzero"`
Sandbox SandboxConfig `json:"sandbox,omitzero"`
Hooks map[string][]Hook `json:"hooks,omitempty"`
RulesCompat RulesCompatConfig `json:"rulesCompat,omitzero"`
// contains filtered or unexported fields
}
func LoadFile ¶ added in v0.107.0
LoadFile reads a configuration without changing the user's default file.
func (*Config) AdoptMemory ¶ added in v0.107.6
AdoptMemory takes the switch from a freshly loaded config, with the disk state that load observed, so this config shows it and a later Save writes it only when the disk needs it (a legacy config.json value still moves into the switch file).
func (*Config) ImageConfigUnavailable ¶ added in v0.107.6
ImageConfigUnavailable reports an isolated optional configuration failure. The original image document is retained privately for subsequent saves.
func (*Config) OrderedProviderIDs ¶ added in v0.107.6
OrderedProviderIDs returns every configured provider ID in display order: IDs listed in ProviderOrder first, then any remaining providers sorted by ID.
func (*Config) RemoveProvider ¶
type CustomHeader ¶ added in v0.107.0
type MCPServer ¶
type MCPServer struct {
Command []string `json:"command,omitempty"`
Env map[string]string `json:"env,omitempty"`
Cwd string `json:"cwd,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Note string `json:"note,omitempty"`
StartupTimeout int `json:"startupTimeout,omitempty"`
ToolTimeout int `json:"toolTimeout,omitempty"`
}
type MemoryConfig ¶ added in v0.107.6
type MemoryConfig struct {
Enabled *bool `json:"enabled,omitempty"`
}
MemoryConfig is the memory master switch. Off stops memory injection, hidden extraction and the agent memory tools; stored memories and the memory management API stay available.
func (MemoryConfig) IsEnabled ¶ added in v0.107.6
func (m MemoryConfig) IsEnabled() bool
IsEnabled defaults to true so configurations written before the switch keep memory on.
type Model ¶
type Model struct {
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
OwnedBy string `json:"ownedBy,omitempty"`
LimitsSource string `json:"limitsSource,omitempty"`
OutputModalities []string `json:"outputModalities,omitempty"`
// ImageAdapter explicitly selects an image protocol; "disabled" opts out of discovery.
ImageAdapter string `json:"imageAdapter,omitempty"`
InputModalities []string `json:"inputModalities,omitempty"`
Providers []string `json:"providers"`
ID string `json:"id,omitempty"`
Context int `json:"context,omitempty"`
MaxOut int `json:"maxOut,omitempty"`
Vision bool `json:"vision,omitempty"`
SamplingParams *SamplingParams `json:"samplingParams,omitempty"`
// ProviderMetadata holds per-provider metadata that differs from the
// shared fields above; use ForProvider to read a provider's view of the model.
ProviderMetadata map[string]Model `json:"providerMetadata,omitempty"`
}
func (Model) ContextWindow ¶
func (*Model) DropProvider ¶ added in v0.107.6
DropProvider removes provider from m. When the remaining providers all carry overrides, the first one is promoted to the shared metadata so the record stays as small as possible.
func (Model) ForProvider ¶ added in v0.107.6
ForProvider returns m with the metadata the given provider declared for it. Models are keyed globally by ID, so two providers serving the same ID may disagree on context window, max output or modalities; the shared record holds one variant and ProviderMetadata holds the rest.
func (Model) Metadata ¶ added in v0.107.6
Metadata returns the provider-independent part of m: everything except the provider list, ID and per-provider overrides.
func (*Model) SetProviderMetadata ¶ added in v0.107.6
SetProviderMetadata records meta as provider's view of m, storing an override only when it differs from the shared metadata.
type ModelInfoLite ¶
type ModelInfoLite struct {
ID string `json:"id"`
ContextLength int `json:"contextLength,omitempty"`
MaxCompletionTokens int `json:"maxCompletionTokens,omitempty"`
ReasoningEfforts []string `json:"reasoningEfforts,omitempty"`
Pricing *ai.TokenRates `json:"pricing,omitempty"`
InputModalities []string `json:"inputModalities,omitempty"`
}
type PiModel ¶
type PiModel struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
DisplayName string `json:"displayName,omitempty"`
OwnedBy string `json:"ownedBy,omitempty"`
LimitsSource string `json:"limitsSource,omitempty"`
OutputModalities []string `json:"outputModalities,omitempty"`
// ImageAdapter explicitly selects an image protocol; "disabled" opts out of discovery.
ImageAdapter string `json:"imageAdapter,omitempty"`
InputModalities []string `json:"inputModalities,omitempty"`
API string `json:"api,omitempty"`
Reasoning bool `json:"reasoning,omitempty"`
Input []string `json:"input,omitempty"`
ContextWindow int `json:"contextWindow,omitempty"`
MaxTokens int `json:"maxTokens,omitempty"`
SamplingParams *SamplingParams `json:"samplingParams,omitempty"`
}
type PromptFile ¶ added in v0.106.0
type PromptFile struct {
Scope string
Path string
Text string
// User marks the user's own standing rules (for example ~/.claude/CLAUDE.md), as
// opposed to rules that belong to the project tree.
User bool
}
func InstructionFiles ¶ added in v0.107.13
func InstructionFiles(wd string) []PromptFile
InstructionFiles returns every instruction file that applies to wd, in prompt order: user-level compatibility files first, then each directory from the project root down to wd. Within a directory the order is AGENTS.md, CLAUDE.md, .claude/CLAUDE.md, CLAUDE.local.md, .claude/CLAUDE.local.md, .cursorrules, .cursor/rules and finally the native .liveagent/brain.md, so later (deeper, more local) files win on conflicts.
A file reachable through several names (symlinks, hard links, case-insensitive filesystems) and a file whose text repeats an earlier one are included once.
func ProjectPromptFiles ¶ added in v0.106.0
func ProjectPromptFiles(wd string) []PromptFile
ProjectPromptFiles returns the project-tree instruction files, root first.
type Provider ¶
type Provider struct {
Name string `json:"name,omitempty"`
Type string `json:"type,omitempty"`
BaseURL string `json:"baseUrl"`
IsFullURL bool `json:"isFullUrl,omitempty"`
ModelsURL string `json:"modelsUrl,omitempty"`
API string `json:"api"`
APIKey string `json:"apiKey"`
CustomHeaders []CustomHeader `json:"customHeaders,omitempty"`
ActiveModels []string `json:"activeModels"`
ModelOrder []string `json:"modelOrder,omitempty"`
RequestFormat string `json:"requestFormat,omitempty"`
Reasoning string `json:"reasoning,omitempty"`
PromptCacheHintMode string `json:"promptCacheHintMode,omitempty"`
NativeWebSearchEnabled bool `json:"nativeWebSearchEnabled,omitempty"`
UseSystemProxy bool `json:"useSystemProxy,omitempty"`
Metadata map[string]any `json:"metadata,omitempty"`
PromptCachingEnabled *bool `json:"promptCachingEnabled,omitempty"`
PromptCacheRetention string `json:"promptCacheRetention,omitempty"`
RetryPolicy map[string]any `json:"retryPolicy,omitempty"`
UsageQuery map[string]any `json:"usageQuery,omitempty"`
CacheSessionAffinity *bool `json:"cacheSessionAffinity,omitempty"`
CacheControlFormat string `json:"cacheControlFormat,omitempty"`
CacheCapabilities ai.CacheCapabilities `json:"cacheCapabilities,omitzero"`
Models []PiModel `json:"models"`
}
func (Provider) ModelActive ¶ added in v0.107.0
func (Provider) ResolveKey ¶
type RulesCompatConfig ¶ added in v0.107.13
type RulesCompatConfig struct {
Claude *bool `json:"claude,omitempty"`
Cursor *bool `json:"cursor,omitempty"`
}
RulesCompatConfig toggles discovery of instruction files written for other agent harnesses. Both sources default to on; set a field to false to opt out.
claude: CLAUDE.md, CLAUDE.local.md, .claude/CLAUDE*.md, ~/.claude/CLAUDE.md, .claude/skills cursor: .cursor/rules/*.md|*.mdc and the legacy .cursorrules
func RulesCompatSettings ¶ added in v0.107.13
func RulesCompatSettings() RulesCompatConfig
RulesCompatSettings reads the rulesCompat switches straight from config.json. It never writes defaults, so prompt assembly stays free of side effects; any read or parse problem falls back to the defaults (everything on).
func (RulesCompatConfig) ClaudeEnabled ¶ added in v0.107.13
func (r RulesCompatConfig) ClaudeEnabled() bool
func (RulesCompatConfig) CursorEnabled ¶ added in v0.107.13
func (r RulesCompatConfig) CursorEnabled() bool
type SamplingParams ¶
type SandboxConfig ¶ added in v0.103.0
type UnknownModelError ¶
type UnknownModelError struct {
Model string
// contains filtered or unexported fields
}
func (*UnknownModelError) Error ¶
func (e *UnknownModelError) Error() string