Documentation
¶
Overview ¶
Package config loads Blitz's settings: one TOML file, .env.toml, in ~/.blitz (or $MODENV_PREFIX, or --config), with a workspace's own settings laid over it from ~/.blitz/workspaces, API keys resolved from the OS keychain, and environment variables applied last. Nothing is read from the workspace itself, so a cloned repository can't redirect a key or turn off approvals. It also edits the file in place, a line at a time, for the settings the front ends change (spec_config_002).
Index ¶
- Constants
- Variables
- func ConfigDir(prefixDir string) string
- func DefaultPricingAt(t time.Time) map[string]ModelPrice
- func Dir() string
- func ExpandHome(p string) string
- func IsWorkspaceRelative(p string) bool
- func ParseEffort(s string) (string, error)
- func ReadSettingsFile(prefixDir, workspace string) (string, string, error)
- func RemoveAPIKey(prefixDir, workspace, provider string) (string, error)
- func SaveAgentModel(dir, agent, ref string) (string, error)
- func SaveModelSettings(dir, model string, s ModelSettings) (string, error)
- func SavePermissionRules(dir, effect string, rules []string) (string, error)
- func SaveUILocale(dir, locale string) (string, error)
- func SecureAPIKey(prefixDir, workspace, provider string) (string, error)
- func SetAPIKey(prefixDir, workspace, provider, key string) (string, error)
- func SetProvider(prefixDir, workspace string, c ProviderChoice) (string, error)
- func SetValue(prefixDir, workspace, key, value string) (string, error)
- func WorkspaceSettingsDir(prefixDir, workspace string) string
- func WriteSettingsFile(prefixDir, workspace, text string) (string, []string, error)
- type AgencyLevel
- type AnthropicConfig
- type AuditConfig
- type BlitzConfig
- type CheckpointConfig
- type CommandsConfig
- type Config
- type ContextConfig
- type GeminiConfig
- type HookConfig
- type HooksConfig
- type ImagesConfig
- type KeySource
- type LLMConfig
- type LogConfig
- type MCPConfig
- type MCPServerConfig
- type MemoryConfig
- type ModelPrice
- type ModelSettings
- type OpenAIConfig
- type PackagePolicy
- type PermissionsConfig
- type PriceChange
- type ProviderChoice
- type ProviderInfo
- type SandboxConfig
- type ScopeInfo
- type SessionConfig
- type SkillPolicy
- type SkillsConfig
- type TelemetryConfig
- type ToolsConfig
- type UIConfig
- type WebConfig
- type WorkerPolicy
- type WorkersConfig
Constants ¶
const ( PlanReviewAlways = "always" PlanReviewAgent = "agent-decides" PlanReviewNever = "never" )
Plan review policies ([blitz] plan_review).
Variables ¶
var DefaultBlockedPaths = []string{
".env", ".env.local", ".env.*.local", ".env.toml", ".env.*.toml",
"*.pem", "*.key", "*.p12", "id_rsa*", "id_ecdsa*", "id_ed25519*",
"~/.ssh", "~/.aws", "~/.gnupg", "~/.config/gcloud", "~/.azure", "~/.kube",
"~/.docker/config.json", "~/.netrc",
}
DefaultBlockedPaths are secrets that tools never read or write.
var DefaultDeniedCommands = []string{
"sudo *", "su *", "doas *",
"shutdown *", "reboot *", "halt *", "mkfs *", "mkfs.*", "diskutil erase*",
}
DefaultDeniedCommands are refused regardless of approval.
var DefaultPricing = map[string]ModelPrice{
"gemini-3.8-flash": {InputPerMTok: 0.75, OutputPerMTok: 3.75, CachedInputPerMTok: 0.075},
"gemini-2.5-pro": {InputPerMTok: 1.25, OutputPerMTok: 10.00, CachedInputPerMTok: 0.31},
"gpt-4o": {InputPerMTok: 2.50, OutputPerMTok: 10.00, CachedInputPerMTok: 1.25},
"claude-opus-5": {InputPerMTok: 5.00, OutputPerMTok: 25.00, CachedInputPerMTok: 0.50, CacheWritePerMTok: 6.25},
"claude-sonnet-5": {InputPerMTok: 2.00, OutputPerMTok: 10.00, CachedInputPerMTok: 0.20, CacheWritePerMTok: 2.50},
"claude-haiku-4-5": {InputPerMTok: 1.00, OutputPerMTok: 5.00, CachedInputPerMTok: 0.10, CacheWritePerMTok: 1.25},
}
DefaultPricing holds estimated list prices for the default models, as of the start of PriceChanges. They change over time; override them under [pricing."model-name"]. Use DefaultPricingAt for the prices in effect.
var DefaultScrubEnv = []string{
"*_API_KEY", "*_API_TOKEN", "*_SECRET", "*_SECRET_KEY", "*_ACCESS_KEY",
"AWS_SESSION_TOKEN", "GOOGLE_APPLICATION_CREDENTIALS", "MODENV_*",
}
DefaultScrubEnv are environment variables withheld from commands the model runs, so they can't read Blitz's own credentials.
var Efforts = []string{"minimal", "low", "medium", "high", "max"}
Efforts are the reasoning effort levels, lowest first.
var KeyedProviders = []string{"gemini", "anthropic", "openai"}
KeyedProviders are the providers that take an API key.
var ModelSettingKeys = []string{"temperature", "max_tokens", "top_p", "seed", "reasoning_effort", "thinking_budget"}
ModelSettingKeys are the settings a model can have, in display order.
var PriceChanges = []PriceChange{ {Model: "gemini-3.8-flash", From: time.Date(2027, 1, 1, 0, 0, 0, 0, time.UTC), Price: ModelPrice{InputPerMTok: 1.50, OutputPerMTok: 7.50, CachedInputPerMTok: 0.15}}, }
PriceChanges are announced changes to DefaultPricing, so a build made before a change still prices correctly after it.
Functions ¶
func DefaultPricingAt ¶
func DefaultPricingAt(t time.Time) map[string]ModelPrice
DefaultPricingAt returns DefaultPricing with every price change in effect at t applied (a fresh map the caller may change).
func ExpandHome ¶
ExpandHome expands a leading "~" or "~/" to the user's home directory. Other forms (e.g. "~user") are returned unchanged.
func IsWorkspaceRelative ¶
IsWorkspaceRelative reports whether a configured search path points into the current workspace (a relative path) rather than a user-level location.
func ParseEffort ¶
ParseEffort reads an effort level (xhigh counts as max).
func ReadSettingsFile ¶
ReadSettingsFile returns a scope's settings file and its text ("" when it doesn't exist yet).
func RemoveAPIKey ¶
RemoveAPIKey removes the scope's key for provider: from the file, and from the OS store when the file referred to it. A workspace then uses the global key again.
func SaveAgentModel ¶
SaveAgentModel pins agent to model ref ("provider/model") under [agent_models] in dir/.env.toml, or removes the pin when ref is "". Only that line changes; comments and other settings are kept.
func SaveModelSettings ¶
func SaveModelSettings(dir, model string, s ModelSettings) (string, error)
SaveModelSettings writes s as [model_settings."<model>"] in dir/.env.toml: set keys are written, unset ones removed, and the table is dropped when nothing is left. Other lines, and their comments, are kept.
func SavePermissionRules ¶
SavePermissionRules writes one [permissions] list (allow, ask or deny) in dir/.env.toml, replacing that key's line only; an empty list removes it. Comments and other settings are kept.
func SaveUILocale ¶
SaveUILocale records locale as [ui] locale in dir/.env.toml, editing only that line so comments, ordering and encrypted values are kept. The file is created (mode 600) if missing. It returns the file written.
func SecureAPIKey ¶
SecureAPIKey moves a provider's key written in the scope's file (plain or modenv's xor:) into the OS store, leaving a reference. It returns the file written.
func SetAPIKey ¶
SetAPIKey stores key in the OS store and makes the scope's settings file refer to it. It returns the file written.
func SetProvider ¶
func SetProvider(prefixDir, workspace string, c ProviderChoice) (string, error)
SetProvider saves a ProviderChoice in a scope as one change: everything is checked before anything is written, the key goes to the OS store, and the file is written once. It returns the file written.
func SetValue ¶
SetValue sets one of the form's settings in a scope (value "" removes it, so a workspace follows the global setting again). It returns the file written.
func WorkspaceSettingsDir ¶
WorkspaceSettingsDir is where the workspace's own settings live, inside the global settings directory (prefixDir as for Load): readable ("shop-1a2b3c4d") and unique per directory.
func WriteSettingsFile ¶
WriteSettingsFile replaces a scope's settings file with text, after checking that it's valid TOML that fits Blitz's settings. It returns the file written and warnings: keys Blitz doesn't know (likely typos), and API keys written in plain text.
Types ¶
type AgencyLevel ¶
type AgencyLevel string
AgencyLevel determines how autonomously the agent operates.
const ( AgencyLow AgencyLevel = "low" // Stop after each meaningful unit of work and ask AgencyMedium AgencyLevel = "medium" // Complete routine tasks; pause at major milestones AgencyHigh AgencyLevel = "high" // Complete tasks autonomously; ask only when blocked AgencyExtreme AgencyLevel = "extreme" // Maximally autonomous, polling background tasks )
type AnthropicConfig ¶
type AnthropicConfig struct {
// APIKey is optional: without it the SDK also accepts ANTHROPIC_AUTH_TOKEN
// and `ant auth login` profiles.
APIKey string `toml:"api_key"`
Model string `toml:"model"`
BaseURL string `toml:"base_url"` // for gateways/proxies; empty uses the API default
// Fallbacks controls server-side refusal fallback on models that support
// it (claude-opus-5, claude-fable-5*): "default" routes by refusal
// category, a model ID pins one fallback model, "off" disables it.
Fallbacks string `toml:"fallbacks"`
}
AnthropicConfig holds settings for Anthropic Claude.
type AuditConfig ¶
AuditConfig controls the append-only audit log.
type BlitzConfig ¶
type BlitzConfig struct {
DefaultAgent string `toml:"default_agent"`
DefaultModel string `toml:"default_model"`
AgencyLevel string `toml:"agency_level"`
Temperature float64 `toml:"temperature"`
MaxTokens int `toml:"max_tokens"`
// AutoApprove is the older spelling of PermissionMode = "bypass".
AutoApprove bool `toml:"auto_approve"`
// PermissionMode is the starting permission mode: default,
// accept-edits, plan, dont-ask or bypass (which needs the OS sandbox).
PermissionMode string `toml:"permission_mode"`
// PlanReview decides when the agent plans for approval before changing
// anything: always (every prompt), agent-decides (it may choose to, with
// enter_plan_mode) or never (only in plan mode and /plan).
PlanReview string `toml:"plan_review"`
// TrustWorkspace allows agents and skills found inside the current
// workspace (./agents, ./skills, .agents/skills) to be loaded. Workspace
// content can inject prompts, so it is off by default and can only be
// enabled from trusted config or the --trust-workspace flag.
TrustWorkspace bool `toml:"trust_workspace"`
}
BlitzConfig controls the core behaviour settings.
type CheckpointConfig ¶
type CheckpointConfig struct {
Enabled bool `toml:"enabled"`
MaxBytes int64 `toml:"max_bytes"` // total snapshot size before the oldest turns are dropped
// Dir keeps checkpoints between runs, one directory per workspace ("":
// in memory only).
Dir string `toml:"dir"`
// MaxAgeDays drops kept checkpoints older than this.
MaxAgeDays int `toml:"max_age_days"`
}
CheckpointConfig controls file snapshots used by /undo and /rewind.
type CommandsConfig ¶
type CommandsConfig struct {
Allow []string `toml:"allow"`
Deny []string `toml:"deny"`
AutoApprove []string `toml:"auto_approve"`
}
CommandsConfig holds shell command patterns. Patterns match a whole simple command ("git status"); "*" matches anything and a trailing " *" also matches the bare command. Deny wins over Allow; if Allow is non-empty only matching commands may run; AutoApprove skips the approval prompt.
type Config ¶
type Config struct {
Blitz BlitzConfig `toml:"blitz"`
LLM LLMConfig `toml:"llm"`
Skills SkillsConfig `toml:"skills"`
Workers WorkersConfig `toml:"workers"`
Tools ToolsConfig `toml:"tools"`
Session SessionConfig `toml:"session"`
Sandbox SandboxConfig `toml:"sandbox"`
// Permissions are allow, ask and deny rules for actions, as
// "kind(pattern)" (see tools.ParsePermissionRule).
Permissions PermissionsConfig `toml:"permissions"`
UI UIConfig `toml:"ui"`
Memory MemoryConfig `toml:"memory"`
Context ContextConfig `toml:"context"`
Audit AuditConfig `toml:"audit"`
Checkpoints CheckpointConfig `toml:"checkpoints"`
Images ImagesConfig `toml:"images"`
Hooks HooksConfig `toml:"hooks"`
MCP MCPConfig `toml:"mcp"`
Web WebConfig `toml:"web"`
Log LogConfig `toml:"log"`
Telemetry TelemetryConfig `toml:"telemetry"`
Pricing map[string]ModelPrice `toml:"pricing"`
// AgentModels pins agents to models: agent name -> "provider/model".
// A pin wins over the agent's own default_model; unpinned agents use
// the configured model. Set with /pin_model, removed with /unpin.
AgentModels map[string]string `toml:"agent_models"`
// ModelSettings are per-model generation settings, keyed by model name
// (a "provider/" prefix is ignored). They win over the global
// temperature and max_tokens. Set with /model_settings.
ModelSettings map[string]ModelSettings `toml:"model_settings"`
}
Config represents the complete Blitz configuration.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a fully initialized Config with sensible production defaults.
func Load ¶
Load loads configuration using modenv from a trusted directory, falling back to DefaultConfig with environment variable overrides.
The config directory is, in order: prefixDir (the --config flag), the MODENV_PREFIX environment variable, then ~/.blitz. The current working directory is deliberately NOT consulted: a cloned repository could otherwise ship a .env.toml that redirects llm.openai.base_url to an attacker's server and receive the user's API key, or enable auto-approval. Pass --config . to opt in to a workspace config explicitly.
func LoadWorkspace ¶
LoadWorkspace is Load with the workspace's own settings over the global ones. It doesn't set Tools.WorkspaceDir: the caller does.
func (*Config) AgentSearchPaths ¶
AgentSearchPaths returns directories to scan for user-defined agents, resolved like SkillSearchPaths.
func (*Config) ModelName ¶
ModelName returns the model to use: blitz.default_model when set, otherwise the active provider's model.
func (*Config) SkillSearchPaths ¶
SkillSearchPaths returns skill directories to scan, expanded, with workspace-relative entries removed unless the workspace is trusted, and otherwise resolved against workspace (the working directory if "").
type ContextConfig ¶
type ContextConfig struct {
// Compaction summarises older history once a prompt reaches
// TokenThreshold tokens, keeping the RetainEvents most recent events raw.
Compaction bool `toml:"compaction"`
TokenThreshold int `toml:"token_threshold"`
RetainEvents int `toml:"retain_events"`
}
ContextConfig controls conversation compaction.
type GeminiConfig ¶
type GeminiConfig struct {
APIKey string `toml:"api_key"`
Model string `toml:"model"`
ProjectID string `toml:"project_id"`
Location string `toml:"location"`
}
GeminiConfig holds settings for Google Gemini / Vertex AI.
type HookConfig ¶
type HookConfig struct {
Match string `toml:"match"` // tool-name glob for tool hooks; empty matches all
Command string `toml:"command"`
TimeoutSeconds int `toml:"timeout_seconds"`
FailClosed bool `toml:"fail_closed"`
}
HookConfig runs a command at a lifecycle point. The command receives a JSON event on stdin. Exit code 2 blocks the action (stderr is the reason); any other non-zero exit is reported and ignored unless FailClosed is set.
type HooksConfig ¶
type HooksConfig struct {
PreTool []HookConfig `toml:"pre_tool"`
PostTool []HookConfig `toml:"post_tool"`
PromptSubmit []HookConfig `toml:"prompt_submit"`
// Lifecycle events. session_start and prompt_submit output (plain
// text, or additional_context) is given to the agent; stop may ask the
// agent to continue; permission_request may answer an approval. The
// rest only observe and run in the background.
SessionStart []HookConfig `toml:"session_start"`
SessionEnd []HookConfig `toml:"session_end"`
Stop []HookConfig `toml:"stop"`
PostToolFailure []HookConfig `toml:"post_tool_failure"`
SubagentStart []HookConfig `toml:"subagent_start"`
SubagentStop []HookConfig `toml:"subagent_stop"`
PreCompact []HookConfig `toml:"pre_compact"`
PostCompact []HookConfig `toml:"post_compact"`
Notification []HookConfig `toml:"notification"`
PermissionRequest []HookConfig `toml:"permission_request"`
}
HooksConfig lists hooks per event.
func (HooksConfig) ByEvent ¶
func (h HooksConfig) ByEvent() map[string][]HookConfig
ByEvent returns the hooks for each event name.
type ImagesConfig ¶
type ImagesConfig struct {
Enabled bool `toml:"enabled"`
Dir string `toml:"dir"` // where prepared images are kept (owner-only)
MaxDimension int `toml:"max_dimension"` // longest edge sent to the model, in pixels
MaxInputMB int `toml:"max_input_mb"` // largest file accepted
RetainDays int `toml:"retain_days"` // unused images are deleted after this (0 = keep)
}
ImagesConfig controls pictures sent to the model: @file.png mentions, /attach, /paste, --image and the view_image tool.
type KeySource ¶
type KeySource string
KeySource says where a provider's key comes from.
const ( KeyNone KeySource = "none" KeyKeychain KeySource = "keychain" // a reference to the OS store KeyPlain KeySource = "plain" // written in the file as is KeyObfuscated KeySource = "obfuscated" // modenv's xor: (not encryption) KeyEnvironment KeySource = "environment" // an environment variable KeyInherited KeySource = "inherited" // a workspace using the global key )
Where a key can come from, as Describe reports it.
type LLMConfig ¶
type LLMConfig struct {
Provider string `toml:"provider"` // gemini, openai, anthropic, ollama
// MaxRetries is how often a failed model request is retried (rate
// limits, overload, 5xx, connection errors), with exponential backoff
// that honours Retry-After. 0 disables retries.
MaxRetries int `toml:"max_retries"`
// StallTimeoutSeconds fails a model request that sends nothing (no
// headers, or no streamed data) for this long, so a hung connection
// can't block a turn forever. It must exceed the longest non-streamed
// generation.
StallTimeoutSeconds int `toml:"stall_timeout_seconds"`
// FallbackModels are tried in order when the model in use fails before
// answering (after its retries): "provider/model" (e.g.
// "anthropic/claude-sonnet-5") or just "model" for the same provider.
// Credentials come from each provider's own section. For names that
// contain a slash (OpenRouter), write the provider first:
// "openai/anthropic/claude-sonnet-5".
FallbackModels []string `toml:"fallback_models"`
Gemini GeminiConfig `toml:"gemini"`
OpenAI OpenAIConfig `toml:"openai"`
Anthropic AnthropicConfig `toml:"anthropic"`
}
LLMConfig holds provider configurations for LLM backends.
type LogConfig ¶
type LogConfig struct {
Level string `toml:"level"` // debug, info, warn, error, or off
Dir string `toml:"dir"` // owner-only
RetainDays int `toml:"retain_days"` // older log files are deleted (0 = keep)
}
LogConfig controls the diagnostic log (<dir>/blitz-YYYY-MM-DD.jsonl). Secrets are masked before writing, as in the audit log.
type MCPConfig ¶
type MCPConfig struct {
Servers []MCPServerConfig `toml:"servers"`
}
MCPConfig lists MCP servers.
type MCPServerConfig ¶
type MCPServerConfig struct {
Name string `toml:"name"`
Command string `toml:"command"`
Args []string `toml:"args"`
Env map[string]string `toml:"env"`
URL string `toml:"url"`
Tools []string `toml:"tools"` // optional allow-list of tool names
AutoApprove bool `toml:"auto_approve"` // skip approval for this server's tools
Sandbox *bool `toml:"sandbox"` // run stdio servers in the OS sandbox (default true)
// Prefix namespaces the server's tools: prefix "gh" exposes create_issue
// as gh__create_issue, avoiding collisions with other servers and built-ins.
Prefix string `toml:"prefix"`
// Agents lists the agents offered this server's tools: empty means the
// active primary agent only, "*" means every agent (including ones run
// through invoke_agent).
Agents []string `toml:"agents"`
// TimeoutSeconds bounds one tool call (default 300). A server that fails
// or times out twice in a row is paused, with growing back-off.
TimeoutSeconds int `toml:"timeout_seconds"`
}
MCPServerConfig describes a Model Context Protocol server. Exactly one of Command (stdio) or URL (streamable HTTP) is set.
type MemoryConfig ¶
type MemoryConfig struct {
Enabled bool `toml:"enabled"`
Files []string `toml:"files"` // names searched from the workspace up to the repo root
Global string `toml:"global"` // user-wide instructions file
MaxBytes int `toml:"max_bytes"` // per file
// LocalFiles are personal instruction files (not to be committed),
// loaded after Files in each directory.
LocalFiles []string `toml:"local_files"`
// RuleDirs hold rule files (*.md), relative to each directory from the
// repo root to the workspace; a rule with frontmatter "paths" applies
// only to matching files. GlobalRules is the user's own rule directory.
RuleDirs []string `toml:"rule_dirs"`
GlobalRules string `toml:"global_rules"`
}
MemoryConfig controls project instruction files loaded into the prompt.
type ModelPrice ¶
type ModelPrice struct {
InputPerMTok float64 `toml:"input_per_mtok"`
OutputPerMTok float64 `toml:"output_per_mtok"`
CachedInputPerMTok float64 `toml:"cached_input_per_mtok"`
// CacheWritePerMTok prices tokens written to the prompt cache (Anthropic
// bills these above the input rate); 0 means the input rate.
CacheWritePerMTok float64 `toml:"cache_write_per_mtok"`
}
ModelPrice is the cost per million tokens, in USD.
type ModelSettings ¶
type ModelSettings struct {
Temperature *float64 `toml:"temperature"`
MaxTokens *int `toml:"max_tokens"`
TopP *float64 `toml:"top_p"`
Seed *int `toml:"seed"`
// ReasoningEffort is how hard the model thinks: minimal, low, medium,
// high or max (providers map it to their own levels).
ReasoningEffort *string `toml:"reasoning_effort"`
// ThinkingBudget is the most tokens the model may spend thinking; 0
// turns thinking off where the model allows it.
ThinkingBudget *int `toml:"thinking_budget"`
}
ModelSettings are generation settings for one model, from [model_settings."<model>"]. Unset (nil) fields fall back to the global blitz.temperature and max_tokens, or the provider's default.
func (ModelSettings) Get ¶
func (s ModelSettings) Get(key string) (string, bool)
Get returns key's value as written in TOML, and whether it is set.
func (ModelSettings) IsZero ¶
func (s ModelSettings) IsZero() bool
IsZero reports whether no setting is set.
func (*ModelSettings) Set ¶
func (s *ModelSettings) Set(key, text string) error
Set parses and validates text for key; "" clears the setting.
type OpenAIConfig ¶
type OpenAIConfig struct {
APIKey string `toml:"api_key"`
BaseURL string `toml:"base_url"`
Model string `toml:"model"`
}
OpenAIConfig holds settings for OpenAI, OpenRouter, or Ollama.
type PackagePolicy ¶
type PackagePolicy struct {
Index string `toml:"index"` // package index URL
// WheelsOnly installs pre-built packages only, so no package code runs
// during installation.
WheelsOnly bool `toml:"wheels_only"`
// RequireHashes requires every dependency to be pinned with "==", so
// installs can be checked against hashes.
RequireHashes bool `toml:"require_hashes"`
Allow []string `toml:"allow"` // package names (globs); empty allows any not denied
Deny []string `toml:"deny"` // package names (globs)
}
PackagePolicy limits the packages skill scripts may install.
type PermissionsConfig ¶
type PermissionsConfig struct {
Allow []string `toml:"allow"`
Ask []string `toml:"ask"`
Deny []string `toml:"deny"`
}
PermissionsConfig lists permission rules. Deny wins over ask, ask over allow: an allow rule lets a matching action run without asking; an ask rule makes it ask even when a mode or a saved approval would let it through; a deny rule refuses it in every mode. (Unlike sandbox.commands.allow, which is an allow-list of the only commands that may run, permissions.allow only skips the question.)
type PriceChange ¶
type PriceChange struct {
Model string
From time.Time // UTC
Price ModelPrice
}
PriceChange is a published list price that takes effect on a date.
type ProviderChoice ¶
ProviderChoice is what the provider form saves as one change: a scope's llm.provider and blitz.default_model ("" removes either, so a workspace follows the global setting again) and, unless Key is "", a new API key for Provider.
type ProviderInfo ¶
type ProviderInfo struct {
Name string
KeySource KeySource
// KeyMissing: the file names a stored secret that isn't there.
KeyMissing bool
BaseURL string
Model string
}
ProviderInfo describes a provider's settings in one scope, without its key.
type SandboxConfig ¶
type SandboxConfig struct {
AllowedPaths []string `toml:"allowed_paths"`
ReadOnlyPaths []string `toml:"read_only_paths"`
BlockedPaths []string `toml:"blocked_paths"`
ShellWritablePaths []string `toml:"shell_writable_paths"`
Shell string `toml:"shell"` // auto | required | off
AllowNetwork bool `toml:"allow_network"`
ScrubEnv []string `toml:"scrub_env"`
Commands CommandsConfig `toml:"commands"`
}
SandboxConfig bounds what tools may touch.
File tools are confined to the workspace plus AllowedPaths (read-write) and ReadOnlyPaths, minus BlockedPaths. Shell commands are checked against the command policy and, when Shell is "auto" or "required", run under the OS sandbox (macOS Seatbelt): writes are limited to the writable roots, ShellWritablePaths and temp/cache dirs, blocked paths can't be read, and network access follows AllowNetwork.
type ScopeInfo ¶
type ScopeInfo struct {
Path string // the settings file (it may not exist yet)
Provider string // llm.provider as set in this scope ("" if not)
DefaultModel string // blitz.default_model as set in this scope
Providers []ProviderInfo
SecretStore string // where keys go
}
ScopeInfo describes the settings in one scope (workspace "" is global).
type SessionConfig ¶
type SessionConfig struct {
StorageDir string `toml:"storage_dir"`
AutoSave bool `toml:"auto_save"`
}
SessionConfig configures persistence and session storage.
type SkillPolicy ¶
type SkillPolicy struct {
// MinHITLTier is the lowest approval tier a skill gets (0-3): 1 runs
// automatically with an audit entry, 2 also takes a checkpoint, 3 asks
// every time. A skill may ask for a higher tier, never a lower one.
MinHITLTier int `toml:"min_hitl_tier"`
// AllowHITLBypass lets a skill that declares tier 0 and
// allow_hitl_bypass skip approval (e.g. in CI). Off: tier 0 is tier 3.
AllowHITLBypass bool `toml:"allow_hitl_bypass"`
// Languages are the script languages that may run: python, typescript.
Languages []string `toml:"languages"`
// Sandbox runs scripts under gvisor, the OS sandbox (os), or whichever
// is available (auto).
Sandbox string `toml:"sandbox"`
// Network is "none" (no script gets the network) or "allowlist" (only
// skills in NetworkAllow that ask for it).
Network string `toml:"network"`
NetworkAllow []string `toml:"network_allow"`
// EnvPassthrough lists the environment variables (globs allowed) a
// skill may receive from the host when it asks for them. Nothing else
// is passed.
EnvPassthrough []string `toml:"env_passthrough"`
// MaxTimeoutSeconds caps every script's run time.
MaxTimeoutSeconds int `toml:"max_timeout_seconds"`
// TrustedHashes, when set, are the only skill contents (ContentHash,
// "sha256:…") whose scripts may run.
TrustedHashes []string `toml:"trusted_hashes"`
// DenyTools refuses tool requirements by tool or "tool:scope" (globs,
// e.g. "Bash:sudo*"); scripts of a skill that needs one don't run.
DenyTools []string `toml:"deny_tools"`
// Packages limits script dependencies.
Packages PackagePolicy `toml:"packages"`
}
SkillPolicy is the host's limit on what skills' scripts may do. For each setting the stricter of the skill's request and this policy applies.
func (SkillPolicy) Problems ¶
func (p SkillPolicy) Problems() []string
Problems reports settings the policy can't honour as written.
type SkillsConfig ¶
type SkillsConfig struct {
Enabled bool `toml:"enabled"`
Paths []string `toml:"paths"`
// Policy caps what skills may ask for; a skill can make its own
// settings stricter but never looser.
Policy SkillPolicy `toml:"policy"`
}
SkillsConfig controls Agent Skills discovery and paths.
type TelemetryConfig ¶
type TelemetryConfig struct {
Enabled bool `toml:"enabled"`
// Endpoint is the collector's base URL, e.g. http://localhost:4318.
// Empty uses OTEL_EXPORTER_OTLP_ENDPOINT, then the OTLP default.
Endpoint string `toml:"endpoint"`
// CaptureContent exports prompts, model replies, tool arguments and tool
// results (secrets masked). Off, spans carry only names, timings, token
// counts and outcomes.
CaptureContent bool `toml:"capture_content"`
}
TelemetryConfig controls OpenTelemetry trace and log export over OTLP/HTTP. It is off by default; BLITZ_TELEMETRY=1 also turns it on. Standard OTEL_EXPORTER_OTLP_* variables (headers, timeouts) apply.
type ToolsConfig ¶
type ToolsConfig struct {
ShellTimeoutSeconds int `toml:"shell_timeout_seconds"`
MaxFileSizeBytes int64 `toml:"max_file_size_bytes"`
WorkspaceDir string `toml:"workspace_dir"`
AutoApproveCommands bool `toml:"auto_approve_commands"`
UCToolsDir string `toml:"uc_tools_dir"`
// ApprovalsFile stores "always allow" decisions.
ApprovalsFile string `toml:"approvals_file"`
// MaxParallel caps how many tool calls from one model response run at
// once (0 = unlimited). Nested batches (sub-agents) get their own cap.
MaxParallel int `toml:"max_parallel"`
}
ToolsConfig configures shell execution, file operations, and permissions.
type UIConfig ¶
type UIConfig struct {
Markdown bool `toml:"markdown"` // render model output as Markdown (TTY only)
Spinner bool `toml:"spinner"` // show progress while waiting (TTY only)
// TerminalTitle shows the session's name in the terminal window title (TTY only).
TerminalTitle bool `toml:"terminal_title"`
HistoryFile string `toml:"history_file"` // REPL input history
HistorySize int `toml:"history_size"`
DiffLines int `toml:"diff_lines"` // max diff lines shown in approval prompts
Theme string `toml:"theme"` // glamour style: auto, dark, light, notty
Locale string `toml:"locale"` // interface language, e.g. en-US, es, fr-CA
LocalesDir string `toml:"locales_dir"` // extra translation catalogs (*.json)
}
UIConfig controls terminal presentation.
type WebConfig ¶
type WebConfig struct {
Enabled bool `toml:"enabled"`
AllowDomains []string `toml:"allow_domains"` // fetched without approval (globs like *.go.dev)
DenyDomains []string `toml:"deny_domains"`
AllowPrivate bool `toml:"allow_private"` // permit localhost/private network targets
MaxBytes int64 `toml:"max_bytes"`
TimeoutSeconds int `toml:"timeout_seconds"`
// SearchProvider enables web_search and /search web: "brave",
// "tavily", "searxng" (self-hosted, needs SearchURL), or "google"
// (Gemini's grounding with Google Search; uses the Gemini API key).
// Empty disables it.
SearchProvider string `toml:"search_provider"`
SearchAPIKey string `toml:"search_api_key"` // or BRAVE_API_KEY / TAVILY_API_KEY / GEMINI_API_KEY
SearchURL string `toml:"search_url"`
// SearchModel is the Gemini model that runs "google" searches
// (default: llm.gemini.model, else gemini-3.8-flash).
SearchModel string `toml:"search_model"`
SearchMaxResults int `toml:"search_max_results"`
}
WebConfig controls the web_fetch tool.
type WorkerPolicy ¶
type WorkerPolicy struct {
// Allow are the permission kinds workers may be given: shell, write,
// delete, web, mcp.
Allow []string `toml:"allow"`
// Default limits fill in what a worker leaves out; Max caps them.
DefaultMaxTurns int `toml:"default_max_turns"`
DefaultMaxCostUSD float64 `toml:"default_max_cost_usd"`
DefaultTimeout string `toml:"default_timeout"`
MaxTurns int `toml:"max_turns"`
MaxCostUSD float64 `toml:"max_cost_usd"`
MaxTimeout string `toml:"max_timeout"`
// MaxConcurrent is how many worker runs may go at once, across
// workspaces.
MaxConcurrent int `toml:"max_concurrent"`
}
WorkerPolicy is the host's limit on workers. A worker asks for permissions and limits; the policy removes what it doesn't allow and caps the rest.
type WorkersConfig ¶
type WorkersConfig struct {
Enabled bool `toml:"enabled"`
// Paths are the directories holding worker directories, relative to
// the workspace.
Paths []string `toml:"paths"`
// Policy caps what any worker may do and spend.
Policy WorkerPolicy `toml:"policy"`
}
WorkersConfig controls workers: scheduled workflows a workspace defines in workers/<name>/WORKER.md (see pkg/engine/workers).