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_002_config).
Index ¶
- Constants
- Variables
- func ADCFile() string
- func AddMCPServer(prefixDir, workspace string, s MCPServerConfig) (string, error)
- func AddPermissionRule(prefixDir, workspace, effect, rule string) (path, canonical string, err error)
- func AuthMethods(provider string) []string
- func CanonicalWorkspace(dir string) (string, error)
- func ConfigDir(prefixDir string) string
- func ConnectorCategoryDirs(dir string) []string
- func ConnectorFileName(file string) string
- func ConnectorFiles(dir string) []string
- func ConnectorKey(scope, category, name string) string
- func CountsUsage() bool
- func DefaultPricingAt(t time.Time) map[string]ModelPrice
- func DefaultShellMode() string
- func Dir() string
- func EnsureHomeWorkspace(prefixDir string) (string, error)
- func EnterpriseDir(prefixDir, raw string) string
- func ExpandHome(p string) string
- func GlobalConnectorsDir(prefixDir string) string
- func HomeWorkspace(prefixDir string) string
- func IsHomeWorkspace(prefixDir, dir string) bool
- func IsWorkspaceRelative(p string) bool
- func MakeMCPServerGlobal(prefixDir, workspace, name string) (string, error)
- func Managed() bool
- func ManagedSettingsPath() string
- func ModelSection(provider string) string
- func ParseEffort(s string) (string, error)
- func ProviderList() string
- func ReadSettingsFile(prefixDir, workspace string) (string, string, error)
- func RemoveAPIKey(prefixDir, workspace, provider string) (string, error)
- func RemoveMCPServer(prefixDir, workspace, name string) (string, error)
- func RemovePermissionRule(prefixDir, workspace, rule string) (path string, removed int, err error)
- func RemovePermissionRuleFrom(prefixDir, workspace, rule, effect string) (path string, removed int, err error)
- func ReplaceMCPServer(prefixDir, workspace, name string, s MCPServerConfig) (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 SecretScope(prefixDir, workspace string) string
- func SecureAPIKey(prefixDir, workspace, provider string) (string, error)
- func SetAPIKey(prefixDir, workspace, provider, key string) (string, error)
- func SetAuth(prefixDir, workspace, provider string, a ProviderAuth) (string, error)
- func SetEnterpriseURL(prefixDir, u string) (string, error)
- func SetMCPServerDisabled(prefixDir, workspace, name string, disabled bool) (string, error)
- func SetMCPServerEnabled(prefixDir, workspace, name string, on bool) (string, error)
- func SetMCPServerOff(prefixDir, workspace, name string, off bool) (string, error)
- func SetProvider(prefixDir, workspace string, c ProviderChoice) (string, error)
- func SetReadOnlyDefaults(prefixDir, workspace string, on *bool) (string, error)
- func SetValue(prefixDir, workspace, key, value string) (string, error)
- func UnpinAgentModel(dir, agent string, masking bool) (string, error)
- func UserWorkersDir(prefixDir string) string
- func ValidBrowserProfileName(name string) bool
- func ValidConnectorName(name string) bool
- func ValidProvider(p string) bool
- func Vault(prefixDir string) secrets.Vault
- func WorkspaceConnectorsDir(workspace string) string
- func WorkspaceSettingsDir(prefixDir, workspace string) string
- func WriteSettingsFile(prefixDir, workspace, text string) (string, []string, error)
- type APIConfig
- type APIHeader
- type APIHeaderInfo
- type APIProviderInfo
- type APIProviderSettings
- type AgencyLevel
- type AnthropicConfig
- type AudioConfig
- type AuditConfig
- type AutoReviewConfig
- type AzureConfig
- type BackgroundLimits
- type BedrockConfig
- type BlitzConfig
- type BrowserConfig
- type BrowserProfile
- type BrowserProfiles
- func (s *BrowserProfiles) Clear(name string) error
- func (s *BrowserProfiles) Create(name string, now time.Time) (BrowserProfile, error)
- func (s *BrowserProfiles) Delete(name string) error
- func (s *BrowserProfiles) Dir(name string) string
- func (s *BrowserProfiles) ForWorkspace(workspace string) string
- func (s *BrowserProfiles) Get(name string) (BrowserProfile, bool)
- func (s *BrowserProfiles) List() []BrowserProfile
- func (s *BrowserProfiles) SetAllowDomains(name string, domains []string) error
- func (s *BrowserProfiles) SetWorkspace(workspace, name string) error
- type CheckpointConfig
- type CommandsConfig
- type Config
- func (c *Config) AddMCPServer(s MCPServerConfig) error
- func (c *Config) AgentSearchPaths(workspace string) []string
- func (c *Config) EachNamedSecret(f func(name, value string) string)
- func (c *Config) EachSecret(f func(string) string)
- func (c *Config) LSPServers() map[string]LSPServerConfig
- func (c *Config) ModelName() string
- func (c *Config) SearchPriceFor(provider string) float64
- func (c *Config) SecretValues() []string
- func (c *Config) SkillSearchPaths(workspace string) []string
- func (c *Config) UsesADC() bool
- type ConnectorScope
- type ContextConfig
- type EnterpriseConfig
- type GeminiConfig
- type GitConfig
- type HarnessConfig
- type HashTrust
- type HealthConfig
- type HookConfig
- type HooksConfig
- type ImagesConfig
- type KeySource
- type LLMConfig
- type LSPServerConfig
- type LogConfig
- type MCPConfig
- type MCPServerConfig
- type MemoryConfig
- type ModelPrice
- type ModelSettings
- type NPMPolicy
- type NetworkConfig
- type OllamaConfig
- type OpenAIConfig
- type OrgLayer
- type OrgPolicy
- type PDFConfig
- type PackagePolicy
- type PermissionsConfig
- type PluginDir
- type PluginsConfig
- type PriceChange
- type Problem
- type ProcessesConfig
- type Project
- type ProjectItem
- type ProviderAuth
- type ProviderChoice
- type ProviderInfo
- type SandboxConfig
- type ScopeInfo
- type SearchConfig
- type SearchPrice
- type SessionConfig
- type Setting
- type SkillPolicy
- type SkillsConfig
- type SpeakerConfig
- type SuggestionsConfig
- type TelemetryConfig
- type ToolsConfig
- type TrustStore
- type UIConfig
- type UsageConfig
- type WebConfig
- type WorkerPolicy
- type WorkersConfig
Constants ¶
const ( ScriptShell = "shell" ScriptPython = "python" ScriptTypeScript = "typescript" )
The languages a token script can be written in.
const ( // DefaultMaxBackgroundAgents is tools.max_background_agents' default. DefaultMaxBackgroundAgents = 4 // DefaultBackgroundAgentTimeout is tools.background_agent_timeout's // default. DefaultBackgroundAgentTimeout = "30m" // DefaultBackgroundAgentMaxTurns is tools.background_agent_max_turns' // default. DefaultBackgroundAgentMaxTurns = 50 )
The background tasks' defaults (spec_032_background_agents BGA-06), the one place they are defined.
const ( AuthAPIKey = "api_key" AuthADC = "adc" AuthOAuth = "oauth" )
How a provider authenticates: an API key (the default, also for ""), Google Cloud's Application Default Credentials (Gemini through Vertex AI), or an account sign-in (OAuth): a Google account (Gemini, on Vertex AI), an Anthropic Console profile from `ant auth login`, an AWS IAM Identity Center sign-in (Bedrock) or Entra ID (Azure). Signing in adds to API keys; a key keeps working.
const ( PlanReviewAlways = "always" PlanReviewAgent = "agent-decides" PlanReviewNever = "never" )
Plan review policies ([blitz] plan_review).
const ( ConnectorKindsFolder = "kinds" ConnectorCategoriesFolder = "categories" )
Descriptor folders, in a connectors folder: no category takes their names.
const ( ConnectorScopeWorkspace = "workspace" ConnectorScopeGlobal = "global" // The organization's catalog's connections (spec_053 EN-30): a locked // one takes the place of the person's of its name, a default one gives // way to it. Neither is the person's to change. ConnectorScopeOrgLocked = "org-locked" ConnectorScopeOrgDefault = "org-default" )
Connection scopes.
const ( HookCommand = "command" HookHTTP = "http" HookPrompt = "prompt" )
Hook types.
const ( MCPScopeGlobal = "global" MCPScopeWorkspace = "workspace" MCPScopeProject = "project" )
Where an MCP server is configured (MCPServerConfig.Scope).
const ( // DefaultShellTimeoutSeconds is tools.shell_timeout_seconds'. DefaultShellTimeoutSeconds = 120 // DefaultMaxFileSizeBytes is tools.max_file_size_bytes'. DefaultMaxFileSizeBytes = 10 << 20 // DefaultWebMaxBytes is web.max_bytes'. DefaultWebMaxBytes = 2 << 20 // DefaultWebTimeoutSeconds is web.timeout_seconds', and web search's. DefaultWebTimeoutSeconds = 20 )
Defaults the tools fall back on for a setting left at 0, the same as DefaultConfig's, so each is defined once.
const ( ProjectDeny = "deny" // a deny rule (A) ProjectAsk = "ask" // an ask rule (A) ProjectBlockedPath = "blocked_path" // a blocked path (A) ProjectLimit = "limit" // a lower limit (A) ProjectSkillPolicy = "skill_policy" // a stricter skill policy value (A) ProjectWorkerLimit = "worker_limit" // a stricter worker policy value (A) ProjectHook = "hook" // a hook (B) ProjectMCP = "mcp" // an MCP server (B) ProjectAllow = "allow" // an allow rule (B) ProjectWritable = "writable" // a shell-writable path (B) ProjectModel = "model" // the default model (B) ProjectAgentModel = "agent_model" // an agent's model (B) ProjectWorkerAllow = "worker_allow" // a permission kind workers may get (B) ProjectPlugin = "plugin" // an installed plugin to enable (B) ProjectPluginOff = "plugin_off" // an installed plugin to disable (A) ProjectSetting = "setting" // any other key (ignored) )
The kinds of project settings, in ProjectItem.Kind.
const ( ReasonNever = "never" // never taken from a project (credentials, endpoints, loosening the sandbox) ReasonUnknown = "unknown" // not a project setting ReasonNotStricter = "not_stricter" // no stricter than the user's own ReasonOutside = "outside" // a path outside the workspace ReasonProvider = "provider" // a model of a provider the user hasn't set up ReasonUserSet = "user_set" // the user's own settings set it ReasonOrgPolicy = "org_policy" // the organization's policy doesn't allow it (EN-35) )
Why a project setting was ignored, in ProjectItem.Reason.
const ( TrustNone = "none" // nothing to trust: no tier B settings TrustNew = "new" // not asked yet TrustChanged = "changed" // trusted or declined, but the content has changed since TrustTrusted = "trusted" // trusted, as it is now TrustDeclined = "declined" // declined, as it is now )
What a person decided about a workspace's project settings, for the content they saw (Project.Hash).
const AuthEntra = "entra"
AuthEntra is Azure's Entra ID sign-in.
const ConnectorsFolder = "connectors"
ConnectorsFolder is a connectors folder's name.
const DefaultAudioMaxChars = 9_000
DefaultAudioMaxChars is [audio] max_chars when it isn't set.
const DefaultGoalMaxContinues = 20
DefaultGoalMaxContinues is goal_max_continues' default.
const DefaultOpenAIModel = "gpt-4o"
DefaultOpenAIModel is the openai provider's model when none is set.
const DefaultReflectThreshold = 5
DefaultReflectThreshold is [harness] reflect_threshold's default.
const DefaultStallTimeoutSeconds = 600
DefaultStallTimeoutSeconds is llm.stall_timeout_seconds' default, the one place it is defined (spec_015_models MDL-51).
const DefaultTokenThreshold = 120_000
DefaultTokenThreshold is token_threshold's default. Left at it, a conversation is compacted at its model's own point instead: its context window less its maximum output, less 10% (spec_056 CA-110).
const DefaultWorkerTimeout = "30m"
DefaultWorkerTimeout is [workers.policy] default_timeout as shipped, which a job runs under when the setting can't be read.
const ManagedEnv = "BLITZ_MANAGED_SETTINGS"
ManagedEnv names a managed settings file in place of the machine's, for tests and for trying a file before device management sends it.
const ProjectAgentsDir = ".agents/agents"
ProjectAgentsDir holds a workspace's agents, relative to it.
const ProjectScratchDir = ".agents/scratch"
ProjectScratchDir is a workspace's scratch folder for the agents' working files, relative to it; git ignores it (its own .gitignore).
const ProjectScriptsDir = ".agents/scripts"
ProjectScriptsDir holds a workspace's support scripts, relative to it.
const TokenPlaceholder = "{{TOKEN_SCRIPT}}"
TokenPlaceholder, in an [llm.api] header's value or in its base URL's path or query, stands for the token script's output.
const UserAgentsDir = "~/.blitz/agents"
UserAgentsDir holds the user's own agents, for every workspace.
Variables ¶
var BrowserOpens = []string{"ask", "embedded", "system"}
BrowserOpens are browser.open's values.
var BrowserShows = []string{"ask", "watch", "silent"}
BrowserShows are browser.show's values.
var CloudProviders = []string{"bedrock", "azure", "vertex-anthropic"}
CloudProviders are the providers whose credentials come from their cloud's chain: Claude on Bedrock and on Vertex AI, and models on Azure.
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 DefaultLSPServers = map[string]LSPServerConfig{ "go": {Command: []string{"gopls"}, Extensions: []string{".go"}}, "typescript": {Command: []string{"typescript-language-server", "--stdio"}, Extensions: []string{".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"}}, "python": {Command: []string{"pyright-langserver", "--stdio"}, Extensions: []string{".py"}}, "rust": {Command: []string{"rust-analyzer"}, Extensions: []string{".rs"}}, }
DefaultLSPServers are the language servers used when installed.
var DefaultPricing = map[string]ModelPrice{
"gemini-3.8-flash": {InputPerMTok: 0.75, OutputPerMTok: 3.75, CachedInputPerMTok: 0.075},
"gemini-4-argon": {InputPerMTok: 2.00, OutputPerMTok: 10.00, CachedInputPerMTok: 0.10},
"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},
"gemini-2.5-flash-preview-tts": {InputPerMTok: 0.50, OutputPerMTok: 10.00},
"gemini-2.5-pro-preview-tts": {InputPerMTok: 1.00, OutputPerMTok: 20.00},
"gemini-3.1-flash-image": {InputPerMTok: 0.50, OutputPerMTok: 60.00},
"gemini-3.1-flash-lite-image": {InputPerMTok: 0.25, OutputPerMTok: 30.00},
"gemini-3-pro-image": {InputPerMTok: 2.00, OutputPerMTok: 120.00},
"gemini-nano-banana-2.1": {InputPerMTok: 1.50, OutputPerMTok: 30.00, CachedInputPerMTok: 0.15},
}
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 DefaultSearchPricing = map[string]SearchPrice{
"google": {Per1KQueries: 14},
}
DefaultSearchPricing are the providers' published prices past their free tiers: Google's grounding bills each search query Gemini runs.
var Efforts = []string{"minimal", "low", "medium", "high", "max"}
Efforts are the reasoning effort levels, lowest first.
var ErrMCPNameTaken = errors.New("an MCP server of that name exists already")
ErrMCPNameTaken is why an MCP server added after the settings load isn't used: one of its name is there already, and that one stays.
var ErrMCPServerExists = errors.New("an MCP server by that name is already configured")
ErrMCPServerExists means the global settings have a server by that name.
var ErrManaged = errors.New("your organization's device management sets this computer's organization: ask your IT team to change it")
ErrManaged is the refusal to change what device management sets.
var ErrNoBrowserProfile = errors.New("no browser profile by that name")
ErrNoBrowserProfile means no profile has the name.
var ErrNoMCPServer = errors.New("no MCP server by that name")
ErrNoMCPServer means no [[mcp.servers]] entry has that name.
var ErrOrgMCP = errors.New("your organization's policy doesn't allow MCP servers of your own")
ErrOrgMCP is why an MCP server added after the settings load isn't used: the organization's policy doesn't allow MCP servers of the person's own (EN-35).
var ErrOrgPlugins = errors.New("your organization turns off your own plugins")
ErrOrgPlugins is why the person's own plugins aren't loaded: the organization's policy turns them off (EN-35).
var KeyedProviders = []string{"gemini", "anthropic", "openai"}
KeyedProviders are the providers that take an API key.
var MCPProjectFiles = []string{".mcp.json", ".agents/mcp_config.json"}
MCPProjectFiles are the MCP server lists other tools keep in a repository, read as the project's MCP servers (PAR-MCP-06): Claude Code's and Antigravity's.
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}}, {Model: "gemini-4-argon", From: time.Date(2026, 12, 1, 0, 0, 0, 0, time.UTC), Price: ModelPrice{InputPerMTok: 4.00, OutputPerMTok: 20.00, CachedInputPerMTok: 0.20}}, }
PriceChanges are announced changes to DefaultPricing, so a build made before a change still prices correctly after it.
var ProjectFiles = []string{".blitz/settings.toml", ".blitz/settings.local.toml"}
ProjectFiles are a workspace's settings files, relative to it, in the order they apply.
var Providers = []string{"gemini", "anthropic", "openai", "ollama", "bedrock", "azure", "vertex-anthropic", "api"}
Providers are the values llm.provider takes, the one list of them (an organization's provider, "enterprise", comes from the connection, not this setting).
var ReadOnlyCommands = []string{
"ls", "pwd", "cat", "head", "tail", "wc", "stat", "du", "df", "which", "grep", "rg", "diff",
"git status", "git log", "git show", "git diff", "git blame", "git rev-parse",
}
ReadOnlyCommands are the commands that read and don't change anything, with any arguments: allowed without asking unless read_only_defaults is false. Commands that can write through an option (find -delete, sort -o, tree -o, git branch -D) aren't among them; a redirection to a file always asks.
var ReadOnlyGuardLabels = []string{"git … --output", "git … --ext-diff", "rg … --pre"}
ReadOnlyGuardLabels say what ReadOnlyGuards cover, for people.
var ReadOnlyGuards = []string{"re:git .*--(output|ext-diff).*", "re:rg .*--pre.*"}
ReadOnlyGuards are the options with which ReadOnlyCommands write a file or run another program: with read_only_defaults on, they ask even so.
var Reference = sync.OnceValue(func() []Setting { docs := fieldDocs() def := DefaultConfig() def.Sandbox.Shell = DefaultShellMode() home, _ := os.UserHomeDir() var out []Setting var walk func(prefix string, t reflect.Type, v reflect.Value) walk = func(prefix string, t reflect.Type, v reflect.Value) { for i := range t.NumField() { f := t.Field(i) tag, _, _ := strings.Cut(f.Tag.Get("toml"), ",") if tag == "" || tag == "-" { continue } key := prefix + tag doc := docs[t.Name()+"."+f.Name] var fv reflect.Value if v.IsValid() { fv = v.Field(i) } ft := f.Type switch { case ft.Kind() == reflect.Struct: out = append(out, Setting{Key: key, Type: "table", Doc: join(doc, docs[ft.Name()])}) walk(key+".", ft, fv) case ft.Kind() == reflect.Map: name := mapNames[tag] if name == "" { name = "<name>" } elem := ft.Elem() if elem.Kind() == reflect.Struct { out = append(out, Setting{Key: key, Type: "table", Doc: join(doc, docs[elem.Name()])}) out = append(out, Setting{Key: key + "." + name, Type: "table", Doc: docs[elem.Name()]}) walk(key+"."+name+".", elem, reflect.Value{}) } else { out = append(out, Setting{Key: key, Type: "table", Doc: doc}, Setting{Key: key + "." + name, Type: typeName(elem), Doc: doc}) } case ft.Kind() == reflect.Slice && ft.Elem().Kind() == reflect.Struct: out = append(out, Setting{Key: key + "[]", Type: "array of tables", Doc: join(doc, docs[ft.Elem().Name()])}) walk(key+"[].", ft.Elem(), reflect.Value{}) default: s := Setting{Key: key, Type: typeName(ft), Doc: doc} if fv.IsValid() && !strings.HasSuffix(tag, "api_key") { s.Default = strings.ReplaceAll(tomlValue(fv), home, "~") } out = append(out, s) } } } walk("", reflect.TypeFor[Config](), reflect.ValueOf(*def)) return out })
Reference is every setting a settings file can have, in the order of the Config struct, with its type, default and description.
var ScriptLanguages = []string{"python", "typescript", "javascript", "shell", "cmd", "powershell"}
ScriptLanguages are the languages a skill's scripts may be written in (skills.policy.languages): javascript runs with node as typescript does; shell, cmd and powershell with the system's shells.
var SearchSourceNames = []string{"files", "documents", "chats", "notes"}
SearchSourceNames are the sources workspace search knows.
var TokenScriptLanguages = []string{ScriptShell, ScriptPython, ScriptTypeScript}
TokenScriptLanguages are the languages a token script can be written in.
var ValidatePermissionRule func(effect, rule string) (string, error)
ValidatePermissionRule checks a rule and returns its canonical form. The rule parser (pkg/engine/tools, which depends on this package) sets it; unset, rules are taken as written.
var WorkerPermissionKinds = []string{"shell", "write", "delete", "web", "mcp"}
WorkerPermissionKinds are the permission kinds a worker may be given (workers.policy.allow). The desktop page lists them too (workerForm.ts ruleKinds), keeping a kind it doesn't list.
Functions ¶
func ADCFile ¶
func ADCFile() string
ADCFile is the Application Default Credentials file Google's libraries read: GOOGLE_APPLICATION_CREDENTIALS, else gcloud's application-default login in its configuration directory ($CLOUDSDK_CONFIG, else ~/.config/gcloud, %APPDATA%\gcloud on Windows). It's "" when there's no such file, as on a Google Cloud machine, which has its own.
func AddMCPServer ¶
func AddMCPServer(prefixDir, workspace string, s MCPServerConfig) (string, error)
AddMCPServer appends s as a [[mcp.servers]] entry of the global settings (prefixDir as for Load), or of a workspace's own. A server of the same name in that file is refused.
func AddPermissionRule ¶
func AddPermissionRule(prefixDir, workspace, effect, rule string) (path, canonical string, err error)
AddPermissionRule checks a rule and adds it to a scope's file, returning the file and the rule's canonical form. A rule already there is kept.
func AuthMethods ¶ added in v0.3.1
AuthMethods are the sign-in methods provider takes besides an API key, for the forms and the CLI's help.
func CanonicalWorkspace ¶
CanonicalWorkspace is the key a workspace's trust is kept under: its absolute path with symbolic links resolved, and nothing read from the workspace itself.
func ConnectorCategoryDirs ¶ added in v0.8.0
ConnectorCategoryDirs are the category folders in a connectors folder (not the descriptors' folders, nor hidden ones), sorted.
func ConnectorFileName ¶ added in v0.8.0
ConnectorFileName is a connector file's name without its extension: a connection's name, a descriptor's ID.
func ConnectorFiles ¶ added in v0.8.0
ConnectorFiles are a folder's YAML files (.yaml, .yml), sorted; hidden ones aren't.
func ConnectorKey ¶ added in v0.8.0
ConnectorKey names a connection in a workspace's choices (ConnectorScope): <scope>/<category>/<name>.
func CountsUsage ¶ added in v0.8.11
func CountsUsage() bool
CountsUsage is the global settings' [usage] count, for what marks a day's use (the service, the CLI, the desktop app's host): false when the settings can't be read.
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 DefaultShellMode ¶
func DefaultShellMode() string
DefaultShellMode is sandbox.shell when the settings don't set it: "required" on Linux, where a stock system often can't run the sandbox (Ubuntu restricts the user namespaces bubblewrap needs) and "auto" would run commands unsandboxed with only a note in doctor; "auto" elsewhere.
func EnsureHomeWorkspace ¶ added in v0.7.1
EnsureHomeWorkspace makes the home workspace when it's missing and returns it, symlinks resolved (as workspaces are keyed).
func EnterpriseDir ¶ added in v0.9.0
EnterpriseDir is the organization's folder for the service at raw (EN-54): <settings>/enterprise/<the service's host>, so another's never mixes in; "" for no service.
func ExpandHome ¶
ExpandHome expands a leading "~" or "~/" to the user's home directory. Other forms (e.g. "~user") are returned unchanged.
func GlobalConnectorsDir ¶ added in v0.8.0
GlobalConnectorsDir is the global connectors folder.
func HomeWorkspace ¶ added in v0.7.1
HomeWorkspace is the folder the user's global workers run in (~/.blitz/home, spec_023_workers WK-60): a workspace of its own, for work that belongs to no project.
func IsHomeWorkspace ¶ added in v0.7.1
IsHomeWorkspace reports whether dir is the home workspace, symlinks resolved.
func IsWorkspaceRelative ¶
IsWorkspaceRelative reports whether a configured search path points into the current workspace (a relative path) rather than a user-level location.
func MakeMCPServerGlobal ¶ added in v0.8.6
MakeMCPServerGlobal moves a workspace's own server to the global settings, for every workspace: added there first, so a failure leaves it where it was. It returns the global settings file.
func Managed ¶ added in v0.9.1
func Managed() bool
Managed reports whether device management manages this computer's organization: its machine-wide settings set a service, or are there but can't be read (a damaged file doesn't hand the choice back to the person). While it does, the person can't change it (ErrManaged).
func ManagedSettingsPath ¶ added in v0.9.0
func ManagedSettingsPath() string
ManagedSettingsPath is where device management puts the machine-wide settings: /Library/Application Support/Blitz/managed.toml on macOS, %ProgramData%\Blitz\managed.toml on Windows, /etc/blitz/managed.toml elsewhere; BLITZ_MANAGED_SETTINGS names another.
func ModelSection ¶ added in v0.8.8
ModelSection is the settings table holding provider's own model: llm.<provider>, Claude on Vertex AI using anthropic's.
func ParseEffort ¶
ParseEffort reads an effort level (xhigh counts as max).
func ProviderList ¶ added in v0.9.1
func ProviderList() string
ProviderList names the providers, for errors: "gemini, …, or api".
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 RemoveMCPServer ¶
RemoveMCPServer deletes the entry named name.
func RemovePermissionRule ¶
RemovePermissionRule removes a rule, as written or in its canonical form, from every list in a scope's file, returning the file and how many went.
func RemovePermissionRuleFrom ¶ added in v0.9.1
func RemovePermissionRuleFrom(prefixDir, workspace, rule, effect string) (path string, removed int, err error)
RemovePermissionRuleFrom removes a rule as RemovePermissionRule does, from the effect's list alone (allow, ask or deny; "" for every list), so the same rule under another effect stays.
func ReplaceMCPServer ¶ added in v0.7.1
func ReplaceMCPServer(prefixDir, workspace, name string, s MCPServerConfig) (string, error)
ReplaceMCPServer puts s in place of the entry named name (which s may rename), keeping its place in the file. The entry is written afresh, so comments inside it are lost; the rest of the file is kept as it was.
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. Every rule is checked first.
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 SecretScope ¶ added in v0.7.1
SecretScope is the scope of a workspace's own secrets (secrets.URN): its settings folder's name, <name>-<hash8>; "global" for none.
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 SetAuth ¶
func SetAuth(prefixDir, workspace, provider string, a ProviderAuth) (string, error)
SetAuth sets how provider signs in, in a scope. It returns the file written.
func SetEnterpriseURL ¶ added in v0.9.0
SetEnterpriseURL sets [enterprise] url in the global settings, or removes it when u is empty; it's never a workspace's. ErrManaged when the machine-wide settings set it (EN-10). u is the service's address as the caller checked it. It returns the file's path.
func SetMCPServerDisabled ¶
SetMCPServerDisabled turns the entry named name off (disabled = true) or on again.
func SetMCPServerEnabled ¶ added in v0.8.6
SetMCPServerEnabled turns a server on or off where it's configured: in the global settings (workspace ""), or a workspace's own; with a workspace, a global server (not one of its own) is turned off or on in that workspace alone (SetMCPServerOff).
func SetMCPServerOff ¶ added in v0.8.6
SetMCPServerOff turns a global server off in one workspace (its own settings' [mcp] off list), or on again there; the global settings are left alone. A name the global settings don't have is refused.
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 SetReadOnlyDefaults ¶
SetReadOnlyDefaults turns the built-in read-only rules on or off in a scope, or (nil) leaves the choice to the global settings.
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 UnpinAgentModel ¶
UnpinAgentModel removes agent's pin from [agent_models] in dir/.env.toml; with masking, a workspace's settings instead record agent = "", so a global pin for the agent doesn't apply there either.
func UserWorkersDir ¶ added in v0.7.1
UserWorkersDir holds the user's global workers, ~/.blitz/workers/<name>/WORKER.md.
func ValidBrowserProfileName ¶ added in v0.8.4
ValidBrowserProfileName reports whether name can name a profile: lowercase letters, digits, - and _, up to 32.
func ValidConnectorName ¶ added in v0.8.0
ValidConnectorName says whether name can name a connection or a query: lower case letters, digits and _, starting with a letter, at most 40.
func ValidProvider ¶
ValidProvider reports whether p is a provider Blitz can use.
func Vault ¶ added in v0.7.1
Vault is the user's secrets (spec_039_secrets): their values in the OS store, their names beside the settings.
func WorkspaceConnectorsDir ¶ added in v0.8.0
WorkspaceConnectorsDir is a workspace's connectors folder.
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 APIConfig ¶ added in v0.8.1
type APIConfig struct {
// BaseURL is the gateway's address; requests go to <base_url>/responses.
// {{TOKEN_SCRIPT}} may appear in its path or query, never its host.
BaseURL string `toml:"base_url"`
// Model is the model to use.
Model string `toml:"model"`
// Headers are set on every request, by name (at least one);
// {{TOKEN_SCRIPT}} in a value is replaced by the token script's output.
Headers map[string]string `toml:"headers"`
// TokenScript prints the token {{TOKEN_SCRIPT}} stands for, on one
// line. It runs on the service's machine when a session first needs a
// token and again when the gateway rejects it.
TokenScript string `toml:"token_script"`
// TokenScriptLanguage is the script's language: shell (/bin/sh, the
// default), python (python3) or typescript (node 22.6 or later).
TokenScriptLanguage string `toml:"token_script_language"`
}
APIConfig holds settings for the api provider: a gateway that speaks OpenAI's Responses API (requests go to <base_url>/responses), signed with the headers given here.
func (APIConfig) Check ¶ added in v0.8.1
Check reports why the settings can't build a model (spec_015_models MDL-100), or nil.
type APIHeader ¶ added in v0.8.1
APIHeader is a header the provider form saves; Value "" keeps the value the scope's file has for it.
type APIHeaderInfo ¶ added in v0.8.1
type APIHeaderInfo struct {
Name string
// Value is given only when it uses TokenPlaceholder (as UsesToken
// checks, anywhere in it: "Bearer {{TOKEN_SCRIPT}}"), the token then
// being the script's; a header can hold a credential, so other values
// never leave the settings file.
Value string
HasValue bool
}
APIHeaderInfo is one of the api provider's headers, as Describe reports it.
type APIProviderInfo ¶ added in v0.8.1
type APIProviderInfo struct {
BaseURL string
TokenScript string
TokenScriptLanguage string
Headers []APIHeaderInfo // sorted by name
}
APIProviderInfo is the api provider's settings as one scope sets them, header values withheld (CFG-44).
type APIProviderSettings ¶ added in v0.8.1
type APIProviderSettings struct {
BaseURL string
Headers []APIHeader
TokenScript string
TokenScriptLanguage string
}
APIProviderSettings are the api provider's settings the form saves with SetProvider (CFG-45b).
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"`
// APIKeyCommand, when APIKey is empty, is a command whose output is the
// key (a password manager, a gateway's rotating token), run when needed
// and kept for APIKeyTTL (a Go duration; default 5m).
APIKeyCommand string `toml:"api_key_command"`
APIKeyTTL string `toml:"api_key_ttl"`
// Auth is "api_key" ("" too); "oauth": the `ant auth login` profile
// named by Profile (empty: ant's active profile); or "adc": Claude on
// Vertex AI with Application Default Credentials, in ProjectID and
// Location. With either, any API key in the settings or the environment
// is ignored.
Auth string `toml:"auth"`
Profile string `toml:"profile"`
// ProjectID and Location are Vertex AI's (auth = "adc"); empty, they
// come from GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION ("global").
ProjectID string `toml:"project_id"`
Location string `toml:"location"`
// Model is the Claude model to use.
Model string `toml:"model"`
// Models are the models the menus list for it (spec_061_models
// MOD-42); none: its latest.
Models []string `toml:"models"`
BaseURL string `toml:"base_url"` // for gateways/proxies; empty uses the API default
// Fallbacks controls refusal fallback: server-side on models that
// support it (claude-opus-5, claude-fable-5*), where "default" routes
// by refusal category; client-side on Vertex AI, where "default" is
// claude-opus-4-8. A model ID pins one fallback model; "off" disables it.
Fallbacks string `toml:"fallbacks"`
}
AnthropicConfig holds settings for Anthropic Claude.
func (AnthropicConfig) OAuthProfile ¶
func (a AnthropicConfig) OAuthProfile() (dir, name string)
OAuthProfile is the `ant auth login` profile Claude signs in with, and the directory ant keeps it in: Profile, else the one ant would use (ANTHROPIC_PROFILE, its active profile, "default").
func (AnthropicConfig) UsesADC ¶
func (a AnthropicConfig) UsesADC() bool
UsesADC reports whether Claude runs on Vertex AI with Application Default Credentials.
func (AnthropicConfig) UsesOAuth ¶
func (a AnthropicConfig) UsesOAuth() bool
UsesOAuth reports whether Claude authenticates with an `ant auth login` OAuth profile rather than an API key.
type AudioConfig ¶ added in v0.2.1
type AudioConfig struct {
// Model is the speech model as "provider/model": a Gemini text-to-speech
// model ("gemini/gemini-2.5-flash-preview-tts") or an OpenAI one
// ("openai/gpt-4o-mini-tts"). Empty turns generate_audio off.
Model string `toml:"model"`
// Voice is the voice for a single speaker, by the provider's name for
// it ("Kore" for Gemini, "coral" for OpenAI); empty is the provider's
// default.
Voice string `toml:"voice"`
// Speakers are two named voices for a conversation, such as a
// two-host overview, whose lines start "Name: " (Gemini only).
Speakers []SpeakerConfig `toml:"speakers"`
// MaxChars caps the text spoken in one call (DefaultAudioMaxChars,
// about ten minutes; Gemini's audio is uncompressed, about 3 MB a
// minute).
MaxChars int `toml:"max_chars"`
}
AudioConfig is spoken audio: the generate_audio tool reads text aloud with a speech model and writes a sound file.
type AuditConfig ¶
type AuditConfig struct {
// Enabled records every approval and tool action in the audit log.
Enabled bool `toml:"enabled"`
// Dir is where the audit log is kept (owner-only).
Dir string `toml:"dir"`
}
AuditConfig controls the append-only audit log.
type AutoReviewConfig ¶
type AutoReviewConfig struct {
// Model reviews the actions ("provider/model"); empty: the session's
// model. A small, fast model is enough.
Model string `toml:"model"`
// Environment tells the reviewer what to trust: repositories, hosts
// and paths the agent may use freely, and anything else it should
// know.
Environment string `toml:"environment"`
}
AutoReviewConfig is the reviewer model of the auto permission mode: it decides what would otherwise ask the user.
type AzureConfig ¶
type AzureConfig struct {
// Resource is the Azure resource name: <resource>.openai.azure.com
// and <resource>.services.ai.azure.com.
Resource string `toml:"resource"`
// BaseURL replaces the address made from Resource for OpenAI models
// (it ends in /openai/v1/), and AnthropicBaseURL for Claude (it ends in
// /anthropic/).
BaseURL string `toml:"base_url"`
AnthropicBaseURL string `toml:"anthropic_base_url"`
// APIKey is the resource's key (default: AZURE_OPENAI_API_KEY, or
// ANTHROPIC_FOUNDRY_API_KEY for Claude). Auth "entra" (or "oauth", the
// same) uses Entra ID instead: Azure's credential chain (environment,
// workload and managed identity, the Azure CLI's login, az login).
APIKey string `toml:"api_key"`
Auth string `toml:"auth"`
// Model is the deployment to use.
Model string `toml:"model"`
}
AzureConfig holds settings for models on Azure: OpenAI models through Azure OpenAI's v1 API, and Claude through Microsoft Foundry (a model whose name starts with "claude"). Model is the deployment name.
type BackgroundLimits ¶ added in v0.9.1
type BackgroundLimits struct {
// Agents is how many may run at once in a workspace.
Agents int
// Timeout stops one that runs longer.
Timeout time.Duration
// MaxTurns caps one's model calls, unless its agent sets max_turns.
MaxTurns int
}
BackgroundLimits are the limits background tasks run under.
type BedrockConfig ¶
type BedrockConfig struct {
// Region is the AWS region (default: AWS_REGION, then the profile's).
Region string `toml:"region"`
// Profile is the AWS profile to use (default: AWS_PROFILE, "default").
Profile string `toml:"profile"`
// Model is the Bedrock model or inference profile ID, e.g.
// us.anthropic.claude-sonnet-4-5-20250929-v1:0.
Model string `toml:"model"`
// Auth says how the credentials come: "" (access keys, or whatever
// the chain finds) or "oauth", an AWS IAM Identity Center (SSO)
// sign-in, `aws sso login` (blitz auth login aws), for Profile. Both
// go through the same chain; "oauth" says how you sign in.
Auth string `toml:"auth"`
}
BedrockConfig holds settings for Claude on Amazon Bedrock. Credentials come from AWS's standard chain: the environment, the shared config and credentials files (Profile), SSO, and the instance or task role; or a Bedrock API key in AWS_BEARER_TOKEN_BEDROCK.
type BlitzConfig ¶
type BlitzConfig struct {
// DefaultAgent is the agent a session starts with.
DefaultAgent string `toml:"default_agent"`
// DefaultModel, when set, is the model to use instead of the provider's
// own (llm.<provider>.model); "provider/model" picks another provider.
DefaultModel string `toml:"default_model"`
// AgencyLevel is how far the agent goes before checking in: low, medium,
// high or extreme.
AgencyLevel string `toml:"agency_level"`
// Temperature is the sampling temperature, unless [model_settings] sets
// one for the model.
Temperature float64 `toml:"temperature"`
// MaxTokens caps the tokens in one model response, unless [model_settings]
// sets it for the model.
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, auto, 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 is deprecated since v0.2.0: it trusts the workspace's project
// settings (.blitz/settings.toml, its skills' scripts) as they are, for
// each run, without recording it. Use blitz trust instead. Only the
// user's own settings or --trust-workspace can set it.
TrustWorkspace bool `toml:"trust_workspace"`
// GoalMaxContinues caps how often a /goal sends the agent on before it
// stops to ask (0: DefaultGoalMaxContinues).
GoalMaxContinues int `toml:"goal_max_continues"`
}
BlitzConfig controls the core behaviour settings.
type BrowserConfig ¶
type BrowserConfig struct {
// Enabled offers the browser tool (with web.enabled and network
// access).
Enabled bool `toml:"enabled"`
// Path is the browser to run; empty finds Chrome, Chromium, Edge or
// Brave.
Path string `toml:"path"`
// Visible shows the browser's window instead of running headless.
Visible bool `toml:"visible"`
// AllowLocal lets it reach localhost and private addresses, to test
// the user's own app.
AllowLocal bool `toml:"allow_local"`
// AllowScripts runs the agent's page scripts without asking.
AllowScripts bool `toml:"allow_scripts"`
// Width and Height are the viewport (1280×800).
Width int `toml:"width"`
Height int `toml:"height"`
// Show is how the agent browses while the desktop app is open
// (spec_050_agent_browser): "watch", in a tab you see; "silent", off
// screen; or "ask" (the default), the first time in each chat.
// Without the app, the headless browser.
Show string `toml:"show"`
// Open is where a page the user asks to open shows while the desktop
// app is open (AB-10): "embedded", a web tab of the app's; "system",
// the system's browser; or "ask" (the default), the first time in
// each chat. Without the app, the system's browser.
Open string `toml:"open"`
}
BrowserConfig controls the browser tool (spec_027_parity §5.2): a Chromium-family browser the agent drives, in its own profile, reaching what the web rules allow.
type BrowserProfile ¶ added in v0.8.4
type BrowserProfile struct {
Name string `json:"name"`
Created time.Time `json:"created"`
// AllowDomains are the sites the agents may browse with it without
// asking; any other site asks, whatever web.allow_domains says.
AllowDomains []string `json:"allow_domains,omitempty"`
}
BrowserProfile is a named profile.
type BrowserProfiles ¶ added in v0.8.4
type BrowserProfiles struct {
// contains filtered or unexported fields
}
BrowserProfiles keeps the person's browser profiles and which one each workspace browses with (spec_049_browser_profiles): browser-profiles.json in the settings directory, and each profile's data (cookies, sign-ins, local storage) in browser/profiles/<name> beside it, owner-only. A profile's cookies are credentials, so it's the person's, never a project's: no project setting chooses one.
func OpenBrowserProfiles ¶ added in v0.8.4
func OpenBrowserProfiles(dir string) *BrowserProfiles
OpenBrowserProfiles is the store in the settings directory dir.
func (*BrowserProfiles) Clear ¶ added in v0.8.4
func (s *BrowserProfiles) Clear(name string) error
Clear signs profile name out of everything: its data is removed, the profile kept.
func (*BrowserProfiles) Create ¶ added in v0.8.4
func (s *BrowserProfiles) Create(name string, now time.Time) (BrowserProfile, error)
Create makes profile name, empty; its folder is made owner-only.
func (*BrowserProfiles) Delete ¶ added in v0.8.4
func (s *BrowserProfiles) Delete(name string) error
Delete removes profile name, its data, and the workspaces' choice of it.
func (*BrowserProfiles) Dir ¶ added in v0.8.4
func (s *BrowserProfiles) Dir(name string) string
Dir is where profile name keeps its data.
func (*BrowserProfiles) ForWorkspace ¶ added in v0.8.4
func (s *BrowserProfiles) ForWorkspace(workspace string) string
ForWorkspace is the profile workspace browses with ("": none, a throwaway one each time).
func (*BrowserProfiles) Get ¶ added in v0.8.4
func (s *BrowserProfiles) Get(name string) (BrowserProfile, bool)
Get is profile name.
func (*BrowserProfiles) List ¶ added in v0.8.4
func (s *BrowserProfiles) List() []BrowserProfile
List is the profiles, by name.
func (*BrowserProfiles) SetAllowDomains ¶ added in v0.8.4
func (s *BrowserProfiles) SetAllowDomains(name string, domains []string) error
SetAllowDomains is the sites profile name browses without asking.
func (*BrowserProfiles) SetWorkspace ¶ added in v0.8.4
func (s *BrowserProfiles) SetWorkspace(workspace, name string) error
SetWorkspace makes workspace browse with profile name ("": none).
type CheckpointConfig ¶
type CheckpointConfig struct {
// Enabled keeps file snapshots for /undo and /rewind.
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, when set, is the only commands that may run.
Allow []string `toml:"allow"`
// Deny are commands that never run, approved or not.
Deny []string `toml:"deny"`
// AutoApprove are commands that run without asking.
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"`
// Suggestions shape the desktop app's welcome tiles.
Suggestions SuggestionsConfig `toml:"suggestions"`
// Health is the workspace dashboard's judge and its schedule.
Health HealthConfig `toml:"health"`
// Harness is the scheduled reflection on the workspace's runs.
Harness HarnessConfig `toml:"harness"`
// Git is what Blitz does with git in a workspace that's a repository.
Git GitConfig `toml:"git"`
Tools ToolsConfig `toml:"tools"`
// Processes say when an agent's background process looks bad
// (spec_052_processes).
Processes ProcessesConfig `toml:"processes"`
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"`
PDF PDFConfig `toml:"pdf"`
Search SearchConfig `toml:"search"`
Audio AudioConfig `toml:"audio"`
Hooks HooksConfig `toml:"hooks"`
MCP MCPConfig `toml:"mcp"`
Web WebConfig `toml:"web"`
Browser BrowserConfig `toml:"browser"`
Plugins PluginsConfig `toml:"plugins"`
Network NetworkConfig `toml:"network"`
// LSP are the language servers the lsp tool uses, by language: the
// built-in ones (go, typescript, python, rust), changed or turned off,
// and others.
LSP map[string]LSPServerConfig `toml:"lsp"`
// PluginAgentDirs and PluginCommandDirs are what loaded plugins add
// (package plugins; never read from a file).
PluginAgentDirs []string `toml:"-"`
PluginCommandDirs []PluginDir `toml:"-"`
Log LogConfig `toml:"log"`
Telemetry TelemetryConfig `toml:"telemetry"`
// Usage is whether Blitz counts its install as active, once a day it's
// used (spec_054_active_installs).
Usage UsageConfig `toml:"usage"`
// Enterprise is the organization's Blitz service this computer
// connects to (spec_053_enterprise EN-10). Only the global settings
// set it: a workspace's can't.
Enterprise EnterpriseConfig `toml:"enterprise"`
// Org is the organization's catalog on this computer, set as the
// settings load (never read from a file).
Org OrgLayer `toml:"-"`
// Pricing overrides or adds model prices, keyed by model name, for
// /cost and cost limits.
Pricing map[string]ModelPrice `toml:"pricing"`
// SearchPricing prices web search providers' queries, keyed by
// provider ("google"), for /cost; DefaultSearchPricing fills the rest.
SearchPricing map[string]SearchPrice `toml:"search_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"`
// Dir is the settings directory this was loaded from ("" for none).
Dir string `toml:"-"`
// Project is what the workspace's project files say
// (.blitz/settings.toml), for LoadWorkspace; nil otherwise. Its tier
// A settings are applied; tier B only once trusted (ApplyTrusted).
Project *Project `toml:"-"`
// ProjectPermissions are the project files' rules, kept apart from
// the user's so they're listed as the project's.
ProjectPermissions PermissionsConfig `toml:"-"`
// Warnings are what the settings files say that loading didn't use or
// couldn't read (unknown settings, settings in the wrong file, an
// organization policy that can't be read), for the person to see when
// a workspace opens and in blitz doctor.
Warnings []string `toml:"-"`
}
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 from .env.toml in 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) AddMCPServer ¶ added in v0.9.1
func (c *Config) AddMCPServer(s MCPServerConfig) error
AddMCPServer adds s to the MCP servers from a source that comes after the settings load, and so after the organization's policy applies (a trusted project's, a plugin's): every such source goes through here, so the policy holds for them all (EN-35). It's refused with ErrOrgMCP when the organization doesn't allow the person's own servers, and with ErrMCPNameTaken when one of its name is there already.
func (*Config) AgentSearchPaths ¶
AgentSearchPaths returns directories to scan for user-defined agents, resolved like SkillSearchPaths: the user's, then the workspace's.
func (*Config) EachNamedSecret ¶ added in v0.9.1
EachNamedSecret is EachSecret, with each value's name: "" for a single credential (an API key), else its environment variable's or header's name, for callers that treat a map's values by what they're called.
func (*Config) EachSecret ¶ added in v0.9.1
EachSecret calls f with every credential the settings hold and puts back what it returns: the providers' API keys (Azure's included), the web search key, the api gateway's headers, http hooks' headers, and MCP servers' environment and header values. It's the one list of what's secret: `blitz config show` masks with it and the log redactor collects with it. Maps and slices are copied before they're written, so a shallow copy of a Config can be masked without changing the original.
func (*Config) LSPServers ¶
func (c *Config) LSPServers() map[string]LSPServerConfig
LSPServers are the language servers in force: the built-in ones with the settings' changes, then those the settings add (by language name).
func (*Config) ModelName ¶
ModelName returns the model to use: blitz.default_model when set, otherwise the active provider's model.
func (*Config) SearchPriceFor ¶
SearchPriceFor is provider's price per query: the settings', else the default, else 0 (not billed per query, or unknown).
func (*Config) SecretValues ¶ added in v0.9.1
SecretValues lists the credentials EachSecret visits, empty ones left out.
func (*Config) SkillSearchPaths ¶
SkillSearchPaths returns skill directories to scan, expanded, with workspace-relative entries resolved against workspace (the working directory if ""). A project's skills load as prompt text; their scripts run only once the project is trusted (spec_031_project_config).
type ConnectorScope ¶ added in v0.8.0
type ConnectorScope struct {
// contains filtered or unexported fields
}
ConnectorScope keeps which connections the person turned off in each workspace (spec_047_connectors CON-17): connector-scope.json in the settings directory, by the workspace's folder with symbolic links resolved, each workspace's connections off by their key (<scope>/<category>/<name>). It's the person's, never the project's, so a repository can't turn a global connection on or off.
func OpenConnectorScope ¶ added in v0.8.0
func OpenConnectorScope(dir string) *ConnectorScope
OpenConnectorScope is the store in the settings directory dir.
func (*ConnectorScope) Forget ¶ added in v0.8.0
func (s *ConnectorScope) Forget(workspace, conn string) error
Forget drops a deleted connection (its key) from workspace, or from every workspace when it's "".
func (*ConnectorScope) Off ¶ added in v0.8.0
func (s *ConnectorScope) Off(workspace string) map[string]bool
Off is the keys of the connections turned off in workspace. It reads the file each time, so a change made in another process counts at once.
func (*ConnectorScope) Rename ¶ added in v0.8.0
func (s *ConnectorScope) Rename(workspace, from, to string) error
Rename keeps a renamed connection's choice (from, to: keys) in workspace, or in every workspace when it's "" (a global connection's is in each).
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 EnterpriseConfig ¶ added in v0.9.0
type EnterpriseConfig struct {
// URL is the service's address, such as https://blitz.acme.com; empty
// for none. Set it with Settings › Organization or blitz enterprise
// connect.
URL string `toml:"url"`
// WorkspacesDir is where the organization's workspaces are cloned,
// each in <workspaces_dir>/<organization>/<handle>; ~/Blitz when unset.
WorkspacesDir string `toml:"workspaces_dir"`
// Managed says the machine-wide settings set URL (EN-10): the person
// can't change or remove it.
Managed bool `toml:"-"`
}
EnterpriseConfig is the organization's service (spec_053_enterprise).
type GeminiConfig ¶
type GeminiConfig struct {
// APIKey is the Gemini API key (default: GEMINI_API_KEY). Keep it in the
// keychain: set it in the form or with blitz config set-key.
APIKey string `toml:"api_key"`
// APIKeyCommand, when APIKey is empty, is a command whose output is the
// key (a password manager, a gateway's rotating token), run when needed
// and kept for APIKeyTTL (a Go duration; default 5m).
APIKeyCommand string `toml:"api_key_command"`
APIKeyTTL string `toml:"api_key_ttl"`
// Model is the Gemini model to use.
Model string `toml:"model"`
// Models are the models the menus list for it (spec_061_models
// MOD-42); none: its latest.
Models []string `toml:"models"`
// Auth is "api_key" ("" too: the Gemini API), "adc": Vertex AI with
// Application Default Credentials (a service account, a Google Cloud
// machine's, or gcloud's sign-in), or "oauth": Vertex AI with your
// Google account, signed in with gcloud (blitz auth login google); both
// in ProjectID and Location.
Auth string `toml:"auth"`
// ProjectID and Location are Vertex AI's; empty, they come from
// GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (Location: "global").
ProjectID string `toml:"project_id"`
Location string `toml:"location"`
}
GeminiConfig holds settings for Google Gemini / Vertex AI.
func (GeminiConfig) UsesADC ¶
func (g GeminiConfig) UsesADC() bool
UsesADC reports whether Gemini authenticates with Application Default Credentials, through Vertex AI.
type GitConfig ¶
type GitConfig struct {
// AutoAdd adds the files the agent creates in a turn to git (git add)
// when the turn ends, in one batch: not the files it changes, which
// were there before, nor files git ignores or temporary ones (*.tmp,
// *.swp, tmp/ and the like).
AutoAdd bool `toml:"auto_add"`
// TimeoutSeconds is how long a commit (its hooks included), fetch,
// pull or push may take before it's stopped (0: two minutes).
TimeoutSeconds int `toml:"timeout_seconds"`
}
GitConfig is what Blitz does with git in a workspace that's a repository.
type HarnessConfig ¶ added in v0.8.3
type HarnessConfig struct {
// ReflectSchedule is when the reflector reads the evidence on its own
// and keeps its proposals for /reflect, in words or as cron ("off" or
// empty, the default: only /reflect). It never changes the workspace.
ReflectSchedule string `toml:"reflect_schedule"`
// MaxCostUSD stops a scheduled reflection that has cost this much.
MaxCostUSD float64 `toml:"max_cost_usd"`
// ReflectThreshold is the evidence's score that suggests /reflect: its
// patterns, the costly ones twice (default DefaultReflectThreshold; 0
// never suggests it).
ReflectThreshold int `toml:"reflect_threshold"`
}
HarnessConfig is what the harness learns from the workspace's runs (spec_048_harness_learning). As [health], only the user's settings set it: a project may not spend the user's money.
type HashTrust ¶ added in v0.8.0
type HashTrust struct {
// contains filtered or unexported fields
}
HashTrust keeps what the person reviewed and trusted, by path (symbolic links resolved) and at which content (a hash): something changed since needs review again. It holds skills' scripts (skill-trust.json, spec_013_skills SK-108) and workspace connection files (connector-trust.json, spec_047_connectors CON-09).
func OpenConnectorTrust ¶ added in v0.8.0
OpenConnectorTrust is the store of the workspace connection files the person trusted, by file, in the settings directory dir.
func OpenSkillTrust ¶ added in v0.7.1
OpenSkillTrust is the skills' store in the settings directory dir, by each skill's folder.
func (*HashTrust) Forget ¶ added in v0.8.0
Forget drops what was trusted at path (one deleted or moved): its path as given and as it resolved, since a removed file's links can't be.
type HealthConfig ¶ added in v0.7.1
type HealthConfig struct {
// Model judges ("provider/model"; empty: the auto mode's reviewer,
// else the default model).
Model string `toml:"model"`
// Schedule is when the workspace's items that changed are judged again,
// in words or as cron ("off" or empty: only when asked). It waits for
// a first check made by hand.
Schedule string `toml:"schedule"`
// MaxCostUSD is the most a scheduled check may cost, estimated
// beforehand: one that would cost more doesn't run, and says why.
MaxCostUSD float64 `toml:"max_cost_usd"`
}
HealthConfig is the workspace dashboard's judge (spec_044_health): it rates each agent, skill, rule, guardrail, eval, workflow and worker on the evidence, when asked and on a schedule. Only the user's settings (global or a workspace's own) set it: a project may not spend the user's money.
type HookConfig ¶
type HookConfig struct {
Match string `toml:"match"` // tool-name glob for tool hooks; empty matches all
// If is a permission rule, "shell(git push *)" say: a tool hook runs
// only for calls it matches.
If string `toml:"if"`
// Type is how the hook runs: "command" (the default), "http" (the event
// is POSTed to URL) or "prompt" (a model judges it against Prompt).
Type string `toml:"type"`
// Command is run with bash; it gets the event as JSON on stdin.
Command string `toml:"command"`
// Args, instead of Command, run a program directly, without a shell.
Args []string `toml:"args"`
// URL is where an http hook POSTs the event.
URL string `toml:"url"`
// Headers go with an http hook's request; $VAR and ${VAR} are replaced
// by the variables AllowedEnvVars names (others stay as written).
Headers map[string]string `toml:"headers"`
AllowedEnvVars []string `toml:"allowed_env_vars"`
// Prompt is what a prompt hook asks the model to judge the event by.
Prompt string `toml:"prompt"`
// Model is the prompt hook's model ("provider/model"; empty: the
// auto mode's reviewer, else the main model).
Model string `toml:"model"`
// TimeoutSeconds stops the hook after this long (0: 30).
TimeoutSeconds int `toml:"timeout_seconds"`
// FailClosed blocks the action when the hook fails, not only on exit code
// 2.
FailClosed bool `toml:"fail_closed"`
// Source is the project file a hook came from ("": the user's own
// settings).
Source string `toml:"-" json:"-"`
}
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.
func (HookConfig) Describe ¶
func (h HookConfig) Describe() string
Describe is what the hook runs, for people. An http hook's says the headers it sends and the environment variables they may carry, so trusting a project's hook shows what leaves the computer (PRJ-24).
func (HookConfig) Kind ¶
func (h HookConfig) Kind() string
Kind is the hook's type, "command" when unset.
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 AppendHooks ¶
func AppendHooks(h, add HooksConfig) HooksConfig
AppendHooks adds add's hooks after h's, event by event.
func WithSource ¶
func WithSource(h HooksConfig, file string) HooksConfig
WithSource marks each of h's hooks as coming from file.
func (HooksConfig) ByEvent ¶
func (h HooksConfig) ByEvent() map[string][]HookConfig
ByEvent returns the hooks for each event name.
func (*HooksConfig) Events ¶ added in v0.9.1
func (h *HooksConfig) Events() map[string]*[]HookConfig
Events gives a pointer to each event's hooks, by event name: the one list of events that ByEvent, Map and AppendHooks walk (a test holds it to HooksConfig's fields).
func (HooksConfig) Map ¶ added in v0.9.1
func (h HooksConfig) Map(fn func([]HookConfig) []HookConfig) HooksConfig
Map returns h with each event's hooks replaced by fn's result for them.
type ImagesConfig ¶
type ImagesConfig struct {
// Enabled lets images be sent to the model.
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)
// Model is generate_image's image model as "provider/model", a Gemini
// image model ("gemini/gemini-3.1-flash-image"). Empty turns
// generate_image off.
Model string `toml:"model"`
// Folder is where Pictures saves pictures in the workspace ("" for
// pictures/; spec_058_pictures PIC-51).
Folder string `toml:"folder"`
}
ImagesConfig controls pictures sent to the model: @file.png mentions, /attach, /paste, --image and the view_image tool; and the image model the generate_image tool draws with.
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 is the model provider: gemini, openai, anthropic, ollama,
// bedrock, azure, vertex-anthropic or api.
Provider string `toml:"provider"`
// 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.
// 0 or less: DefaultStallTimeoutSeconds.
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"`
// Providers are the active providers, whose models are listed and
// chosen (spec_061_models MOD-40); none: every provider set up.
Providers []string `toml:"providers"`
Gemini GeminiConfig `toml:"gemini"`
OpenAI OpenAIConfig `toml:"openai"`
Ollama OllamaConfig `toml:"ollama"`
Anthropic AnthropicConfig `toml:"anthropic"`
Bedrock BedrockConfig `toml:"bedrock"`
Azure AzureConfig `toml:"azure"`
API APIConfig `toml:"api"`
}
LLMConfig holds provider configurations for LLM backends.
type LSPServerConfig ¶
type LSPServerConfig struct {
// Command and its arguments, e.g. ["gopls"] or
// ["typescript-language-server", "--stdio"].
Command []string `toml:"command"`
// Extensions are the files it serves, with the dot: [".go"].
Extensions []string `toml:"extensions"`
// Disabled turns a built-in server off.
Disabled bool `toml:"disabled"`
}
LSPServerConfig is a language server: the command that runs it (over stdio), and the file extensions it's for.
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"`
// Off names global servers turned off in one workspace: read from the
// workspace's own settings file only (the global file's is ignored),
// so a workspace never changes what the others run.
Off []string `toml:"off"`
}
MCPConfig lists MCP servers.
type MCPServerConfig ¶
type MCPServerConfig struct {
// Name identifies the server, in mcp(server:tool) rules and /mcp.
Name string `toml:"name"`
// Command starts a stdio server.
Command string `toml:"command"`
// Args are the command's arguments.
Args []string `toml:"args"`
// Env are environment variables for the command.
Env map[string]string `toml:"env"`
// URL is a streamable HTTP server's address.
URL string `toml:"url"`
// Headers are sent with every request to an HTTP server.
Headers map[string]string `toml:"headers"`
// Disabled keeps the server configured without starting it
// (blitz mcp disable).
Disabled bool `toml:"disabled"`
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"`
// Scope is where it's configured: global (the settings every workspace
// shares), workspace (one workspace's own, in ~/.blitz) or project (a
// trusted .blitz/settings.toml); "" for one Blitz adds itself.
Scope string `toml:"-"`
// OffHere: a global server this workspace turned off (MCPConfig.Off);
// Disabled is set too.
OffHere bool `toml:"-"`
// InProcess names a server Blitz runs inside its own process, in place
// of a command or URL ("databases", spec_046_databases). Blitz sets it;
// settings files can't.
InProcess string `toml:"-"`
// Fingerprint changes when an in-process server's files do, so a
// reload restarts it.
Fingerprint string `toml:"-"`
// ReadOnlyTools run without asking: tools Blitz knows can't change
// anything (a read-only database's).
ReadOnlyTools []string `toml:"-"`
// FileSettings are an in-process server's settings that name a file,
// by source type (SQLite's database): a relative one is resolved
// where its file belongs (spec_046_databases DB-17).
FileSettings map[string][]string `toml:"-"`
// WorkspaceOnly are an in-process server's files (of Args) whose
// ${NAME}s it fills only from the workspace's own secrets, which Env
// holds apart from the rest (spec_047_connectors CON-09).
WorkspaceOnly []string `toml:"-"`
}
MCPServerConfig describes a Model Context Protocol server. Exactly one of Command (stdio) or URL (streamable HTTP) is set.
func ScopeMCP ¶ added in v0.8.6
func ScopeMCP(prefixDir, workspace string) (servers []MCPServerConfig, off []string, path string, err error)
ScopeMCP reads one scope's file alone (the global settings, or a workspace's own): its servers as written, its off list (a workspace's) and its path. A file that isn't there has none.
type MemoryConfig ¶
type MemoryConfig struct {
// Enabled loads project instruction files (BLITZ.md, AGENTS.md) into the
// prompt.
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"`
// Auto lets the agent save notes across sessions with its remember
// tool, loaded into its instructions (nil: on).
Auto *bool `toml:"auto"`
// Summaries keeps where each session left off, for later sessions to
// pick up (nil: on; off when Auto is).
Summaries *bool `toml:"summaries"`
}
MemoryConfig controls project instruction files loaded into the prompt.
func (MemoryConfig) AutoOn ¶
func (m MemoryConfig) AutoOn() bool
AutoOn reports whether the agent keeps notes (memory.auto).
func (MemoryConfig) SummariesOn ¶ added in v0.8.8
func (m MemoryConfig) SummariesOn() bool
SummariesOn reports whether session summaries are kept (memory.summaries, and memory.auto).
type ModelPrice ¶
type ModelPrice struct {
// InputPerMTok is the price of a million input tokens.
InputPerMTok float64 `toml:"input_per_mtok"`
// OutputPerMTok is the price of a million output tokens.
OutputPerMTok float64 `toml:"output_per_mtok"`
// CachedInputPerMTok is the price of a million input tokens read from the
// prompt cache.
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.
func PriceFor ¶ added in v0.3.1
func PriceFor(pricing map[string]ModelPrice, model string) (ModelPrice, bool)
PriceFor finds model's price in pricing: exact, else the longest configured prefix ("gemini-3.8-flash-001" uses "gemini-3.8-flash").
type ModelSettings ¶
type ModelSettings struct {
// Temperature is the sampling temperature.
Temperature *float64 `toml:"temperature"`
// MaxTokens caps the tokens in one response.
MaxTokens *int `toml:"max_tokens"`
// TopP is nucleus sampling: only the most likely tokens up to this
// probability.
TopP *float64 `toml:"top_p"`
// Seed makes sampling repeatable where the provider allows it.
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. Claude models that
// think adaptively (Opus 4.7 and later, Sonnet 5, Fable) take it as an
// effort level instead, unless reasoning_effort is set.
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 NPMPolicy ¶
type NPMPolicy struct {
Registry string `toml:"registry"` // npm registry URL
// RequireExact requires every dependency to name an exact version
// (name@1.2.3).
RequireExact bool `toml:"require_exact"`
Allow []string `toml:"allow"` // package names (globs, @scope/* too); empty allows any not denied
Deny []string `toml:"deny"` // package names (globs)
}
NPMPolicy limits the npm packages TypeScript skill scripts may install. Installs never run packages' install scripts.
type NetworkConfig ¶
type NetworkConfig struct {
// CAFile is a PEM file of certificate authorities to trust besides the
// system's (a company's TLS-inspecting proxy).
CAFile string `toml:"ca_file"`
}
NetworkConfig is how Blitz reaches the network. Proxies come from the environment (HTTPS_PROXY, HTTP_PROXY, NO_PROXY).
type OllamaConfig ¶ added in v0.8.8
type OllamaConfig struct {
// BaseURL is Ollama's address (default http://localhost:11434/v1).
BaseURL string `toml:"base_url"`
// Model is the model to use; empty: the first one Ollama has.
Model string `toml:"model"`
// Models are the models the menus list for Ollama (MOD-42); none:
// every model it has.
Models []string `toml:"models"`
// AllTools offers a local model every tool its agent has. Without
// it, it gets the core ones (files, the shell, search, the web, the
// connections' and Blitz's own): a small model given ninety tools
// writes its calls as text, or none (spec_061_models MOD-50).
AllTools bool `toml:"all_tools"`
}
OllamaConfig holds the ollama provider's own settings, so choosing a model for it doesn't change OpenAI's (and back). It talks to Ollama's OpenAI-compatible API. Settings left empty fall back to [llm.openai]'s, where older settings files keep them: its model when one is set there (OpenAI's default never applies), its base_url when it isn't OpenAI's.
type OpenAIConfig ¶
type OpenAIConfig struct {
// APIKey is the OpenAI or OpenRouter API key (default: OPENAI_API_KEY;
// Ollama needs none). Keep it in the keychain: set it in the form or with
// blitz config set-key.
APIKey string `toml:"api_key"`
// APIKeyCommand, when APIKey is empty, is a command whose output is the
// key (a password manager, a gateway's rotating token), run when needed
// and kept for APIKeyTTL (a Go duration; default 5m).
APIKeyCommand string `toml:"api_key_command"`
APIKeyTTL string `toml:"api_key_ttl"`
// BaseURL is the API's address: OpenAI's, OpenRouter's or a local
// Ollama's.
BaseURL string `toml:"base_url"`
// Model is the model to use.
Model string `toml:"model"`
// Models are the models the menus list for it (spec_061_models
// MOD-42); none: its latest.
Models []string `toml:"models"`
}
OpenAIConfig holds settings for OpenAI, OpenRouter, or Ollama.
type OrgLayer ¶ added in v0.9.0
type OrgLayer struct {
// Defaults and Locked are the layers' folders, laid out as a
// workspace's .agents folder; "" when there's no catalog.
Defaults, Locked string
Policy OrgPolicy
// Expires is when Blitz stops working under it unrenewed (EN-33).
Expires time.Time
// Problem is why the organization's policy couldn't be read ("" when
// it was): a service is set but its policy.json is missing or
// damaged. Blitz then works under the strictest policy (nothing of
// the person's own allowed), and the organization's work waits, as
// past an expiry (EN-33).
Problem string
}
OrgLayer is the organization's catalog on this computer, as the Blitz service last fetched and checked it (spec_053_enterprise EN-30 to EN-35): its default items, which a workspace or the person may override, its locked ones, which apply over theirs, and its policy. Never read from a file: it's set as the settings load, from [enterprise] url's folder.
func OrgLayerFor ¶ added in v0.9.0
OrgLayerFor is the organization layer the settings in prefixDir last loaded ("" for ~/.blitz); an empty one when there's none.
func (OrgLayer) Expired ¶ added in v0.9.0
Expired reports whether the catalog is past its expiry at now, or its policy couldn't be read: the organization's work waits until it's fetched again (EN-33).
func (OrgLayer) LockOf ¶ added in v0.9.0
LockOf is how the catalog applies the item at path: "locked" or "default" for one of its files, "" for any other.
func (OrgLayer) LockedFirst ¶ added in v0.9.0
LockedFirst is subfolders of the organization's layers around dirs for lists where an earlier folder's item wins (rules): its locked items first and its defaults last.
func (OrgLayer) PluginsOff ¶ added in v0.9.1
PluginsOff reports whether the person's own plugins (installed, from a marketplace or a folder) don't load: the organization's policy says [plugins] own = false, or it couldn't be read (EN-35).
type OrgPolicy ¶ added in v0.9.0
type OrgPolicy struct {
Models struct {
// OwnProviders lets people use their own providers beside the
// organization's models.
OwnProviders bool `json:"own_providers"`
} `json:"models"`
Tools struct {
// Off are tools no agent may use.
Off []string `json:"off"`
// ShellCommands lets people run their own ! commands.
ShellCommands bool `json:"shell_commands"`
} `json:"tools"`
MCP struct {
// Own lets people add their own MCP servers.
Own bool `json:"own"`
} `json:"mcp"`
// Connectors says whether people may have connections of their own,
// and which kinds anyone's may be (every kind when none).
Connectors struct {
Own bool `json:"own"`
Kinds []string `json:"kinds"`
} `json:"connectors"`
// Plugins says whether people's own plugins load (allowed when the
// policy doesn't say, as from a service that predates it).
Plugins struct {
Own *bool `json:"own,omitempty"`
} `json:"plugins"`
Builtins struct {
// Off are Blitz's built-in agents, skills and guardrails switched
// off, by name.
Off []string `json:"off"`
} `json:"builtins"`
}
OrgPolicy is the organization's policy as Blitz applies it (EN-35): what pkg/enterprise decodes from the signed manifest and writes to policy.json, read back here.
type PDFConfig ¶ added in v0.2.1
type PDFConfig struct {
// PageSize is a4, letter, or auto (the default): Letter where the
// locale's country uses it (LC_PAPER, LANG), A4 elsewhere.
PageSize string `toml:"page_size"`
}
PDFConfig shapes the PDFs the export_pdf tool writes.
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)
// NPM limits TypeScript scripts' packages ([skills.policy.packages.npm]).
NPM NPMPolicy `toml:"npm"`
}
PackagePolicy limits the packages skill scripts may install.
type PermissionsConfig ¶
type PermissionsConfig struct {
// Allow rules let matching actions run without asking.
Allow []string `toml:"allow"`
// Ask rules make matching actions always ask.
Ask []string `toml:"ask"`
// Deny rules refuse matching actions in every mode.
Deny []string `toml:"deny"`
// ReadOnlyDefaults allows ReadOnlyCommands without asking (with
// ReadOnlyGuards asking even so); nil means on. A workspace may set it
// either way.
ReadOnlyDefaults *bool `toml:"read_only_defaults"`
// Auto configures the reviewer of the auto permission mode.
Auto AutoReviewConfig `toml:"auto"`
}
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.)
A workspace's rules add to the global ones (Merge).
func ScopePermissions ¶
func ScopePermissions(prefixDir, workspace string) (PermissionsConfig, string, error)
ScopePermissions returns the [permissions] a scope's own settings file sets (workspace "" is global; a workspace's add to the global ones), and the file.
func (PermissionsConfig) DefaultsOn ¶
func (p PermissionsConfig) DefaultsOn() bool
DefaultsOn reports whether the built-in read-only rules apply.
func (PermissionsConfig) Merge ¶
func (p PermissionsConfig) Merge(ws PermissionsConfig) PermissionsConfig
Merge adds a workspace's rules to these, without repeats; the workspace's read_only_defaults, if set, wins.
type PluginDir ¶
type PluginDir struct {
Dir, Plugin string
}
PluginDir is a plugin's command directory.
type PluginsConfig ¶
type PluginsConfig struct {
// Enable turns installed plugins on, by name.
Enable []string `toml:"enable"`
// Disable turns installed plugins off, by name; it wins over Enable.
Disable []string `toml:"disable"`
// Dirs are plugins loaded from directories for a run (--plugin-dir).
Dirs []string `toml:"-"`
}
PluginsConfig chooses plugins beyond those enabled in the store (blitz plugin enable): Enable turns installed ones on (from the user, or a trusted project), Disable off (the user, or any project).
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 Problem ¶
type Problem struct {
Line, Col int
// Error problems stop the file from being saved; warnings don't.
Error bool
Message string
}
Problem is something wrong with a settings file, at a line when it has one (Line 0: the file as a whole).
func CheckSettings ¶
CheckSettings checks a settings file's text without saving it: TOML errors, values of the wrong type, invalid permission rules (errors); settings Blitz doesn't know, likely typos, API keys written as plain text and skill policy settings it can't honour (warnings).
type ProcessesConfig ¶ added in v0.8.5
type ProcessesConfig struct {
// CPUPercent of one core, kept up for BusyFor, flags it as busy
// (default 90 for "2m").
CPUPercent float64 `toml:"cpu_percent"`
BusyFor string `toml:"busy_for"`
// MemoryMB, or memory up by half within GrowthWindow, flags its memory
// (default 2048, "10m").
MemoryMB int `toml:"memory_mb"`
GrowthWindow string `toml:"growth_window"`
// LeftAfter without a turn in the session that started it flags it as
// left running (default "2h").
LeftAfter string `toml:"left_after"`
}
ProcessesConfig says when an agent's background process looks bad: the processes view, /processes and the tray flag it (spec_052_processes). Durations are Go durations ("2m"); unset or 0 keeps the default.
type Project ¶
type Project struct {
// Files are the project files found, relative to the workspace.
Files []string
// Applied are the tier A settings in force.
Applied []ProjectItem
// Pending are the tier B settings, in force only once trusted
// (ApplyTrusted).
Pending []ProjectItem
// Ignored are settings a project may not set, or that change nothing.
Ignored []ProjectItem
// Problems are files that couldn't be read.
Problems []string
// contains filtered or unexported fields
}
Project is what a workspace's project files say, and what came of it.
func LoadProject ¶
LoadProject reads workspace's project files. A file that can't be read is a problem, not an error: the workspace opens without it.
func (*Project) ApplyTightening ¶
ApplyTightening puts the project's tier A settings in cfg: rules and blocked paths add, limits and policy apply only when stricter. Those that change nothing are reported as ignored.
func (*Project) ApplyTrusted ¶
ApplyTrusted puts the project's tier B settings in cfg, once the person has trusted them. The user's own settings win: their hooks run first, their MCP server of the same name and their model choices stay. Writable paths outside the workspace, and models of providers the user hasn't set up, are ignored.
type ProjectItem ¶
type ProjectItem struct {
File string // relative to the workspace
Kind string // Project*
// Key names it: the event of a hook, the MCP server, the agent, the
// setting's key.
Key string
// Value is what it says: a rule, a command, a path, a model, a number.
Value string
// Reason is why it was ignored (Reason*), for ignored items.
Reason string
}
ProjectItem is one setting from a project file.
type ProviderAuth ¶
ProviderAuth is how a provider signs in: Method "api_key" ("" too), "adc" (Gemini, or Claude, on Vertex AI with Application Default Credentials, in ProjectID and Location) or "oauth", an account sign-in: Gemini with a Google account (on Vertex AI, in ProjectID and Location), Claude with the `ant auth login` profile named by Profile (else ant's active one), Bedrock with an AWS IAM Identity Center sign-in for Profile, Azure with Entra ID ("entra" too). Empty fields are removed, so the environment's or the global settings' apply.
type ProviderChoice ¶
type ProviderChoice struct {
Provider string
Model string
Key string
Auth *ProviderAuth
API *APIProviderSettings
// KeepDefault saves the provider's sign-in alone: the provider and
// model in use stay as they are (spec_061_models MOD-40).
KeepDefault bool
}
ProviderChoice is what the provider form saves as one change: a scope's llm.provider ("" removes it, so a workspace follows the global setting again) and Provider's own model (ModelSection's model: each provider keeps its own, so switching back finds it; "" removes it, for the provider's default; with no provider, or naming another provider's model, it's blitz.default_model), how Provider signs in (Auth; nil leaves it as it is), unless Key is "", a new API key for Provider and, for the api provider, its settings (API; nil leaves them as they are).
type ProviderInfo ¶
type ProviderInfo struct {
Name string
KeySource KeySource
// KeyMissing means the file names a stored secret that isn't there.
KeyMissing bool
BaseURL string
Model string
// Auth is how the provider signs in, as set in this scope ("" when not:
// an API key, or a workspace following the global setting), with its
// Vertex AI project and location (adc) or ant profile (oauth).
Auth string
ProjectID string
Location string
Profile string
}
ProviderInfo describes a provider's settings in one scope, without its key.
type SandboxConfig ¶
type SandboxConfig struct {
// AllowedPaths are directories outside the workspace the file tools may
// read and write.
AllowedPaths []string `toml:"allowed_paths"`
// ReadOnlyPaths are directories outside the workspace the file tools may
// read.
ReadOnlyPaths []string `toml:"read_only_paths"`
// BlockedPaths (globs) are never read or written, by file tools or, in the
// OS sandbox, by commands: secrets by default.
BlockedPaths []string `toml:"blocked_paths"`
// ShellWritablePaths are directories sandboxed commands may also write
// (caches).
ShellWritablePaths []string `toml:"shell_writable_paths"`
// Shell is auto, required or off: whether commands the model runs go
// through the OS sandbox. "required" refuses to run them without it;
// "auto" runs them unsandboxed then. Unset, it's "required" on Linux,
// where a stock system often has no sandbox (DefaultShellMode).
Shell string `toml:"shell"`
// AllowNetwork lets sandboxed commands use the network.
AllowNetwork bool `toml:"allow_network"`
// ScrubEnv are environment variables (globs) withheld from commands the
// model runs, so they can't read credentials.
ScrubEnv []string `toml:"scrub_env"`
// ShareADC gives commands the model runs a copy of Google's ADC
// sign-in when a provider signs in with it (auth = "adc"), for code
// that calls Google Cloud. Off, they can't reach it: ~/.config/gcloud
// is blocked and GOOGLE_APPLICATION_CREDENTIALS withheld. A project
// can't turn it on.
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
// API is the api provider's settings, header values withheld.
API APIProviderInfo
// Models are each provider's own model as this scope sets it
// (ModelSection's model), by provider.
Models map[string]string
// Active are the active providers as this scope lists them (none:
// every one set up), and MenuModels each provider's models for the
// menus (spec_061_models MOD-40, MOD-42).
Active []string
MenuModels map[string][]string
}
ScopeInfo describes the settings in one scope (workspace "" is global).
type SearchConfig ¶ added in v0.3.0
type SearchConfig struct {
// Enabled keeps the index (on by default). Off, search finds nothing.
Enabled bool `toml:"enabled"`
// Sources are what a search looks in when it names none: files,
// documents (PDFs and notebooks), chats and notes. The default is
// files and documents.
Sources []string `toml:"sources"`
// EmbeddingModel turns on semantic search: "provider/model", a Gemini
// ("gemini/text-embedding-004"), OpenAI ("openai/text-embedding-3-small")
// or Ollama ("ollama/nomic-embed-text") embedding model. Every indexed
// chunk is sent to that provider, once, and each query; empty (the
// default) keeps search local. A project's settings can't set it.
EmbeddingModel string `toml:"embedding_model"`
// Enrich has a model write a summary and tags for each file and
// document, in the background after indexing, so search finds files by
// what they're about. Off by default: each file it describes is sent
// to that model, once per change. A project's settings can't set it.
Enrich bool `toml:"enrich"`
// EnrichModel is the model that describes files ("provider/model");
// empty uses suggestions.model, else the auto mode's model, else the
// default model.
EnrichModel string `toml:"enrich_model"`
// EnrichDailyLimit is how many files may be described a day, per
// workspace (default 200).
EnrichDailyLimit int `toml:"enrich_daily_limit"`
// IncludeIgnored indexes the text files git ignores too (data files,
// local notes), still skipping dependency, build and cache folders
// (node_modules, vendor, build, dist, target, virtual environments).
// They're hidden: shown only when hidden files are.
IncludeIgnored bool `toml:"include_ignored"`
}
SearchConfig is workspace search: an index of the workspace's files, the text of its PDFs and notebooks, its chats and its notes, kept in ~/.blitz/workspaces and brought up to date as they change.
type SearchPrice ¶
type SearchPrice struct {
// Per1KQueries is the price of a thousand queries.
Per1KQueries float64 `toml:"per_1k_queries"`
}
SearchPrice is what a search provider bills for its queries.
type SessionConfig ¶
type SessionConfig struct {
// StorageDir is where sessions are saved.
StorageDir string `toml:"storage_dir"`
// AutoSave saves the session after every turn.
AutoSave bool `toml:"auto_save"`
}
SessionConfig configures persistence and session storage.
type Setting ¶
type Setting struct {
Key string
// Type is table, string, integer, number, boolean or list of strings.
Type string
// Default is the value when unset, as TOML ("" when there's none to
// show, as for API keys and tables).
Default string
// Doc says what it does, from the doc comment of its field or type.
Doc string
}
Setting is one entry of the settings reference: a table ([llm]) or a setting in one (llm.provider). Keys with <name> stand for any name, as in model_settings.<model>.temperature; [] marks an array of tables (hooks.pre_tool[].command).
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 (ScriptLanguages;
// all six by default).
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"`
// UntrustedRoots are directories whose skills' scripts don't run: the
// workspace, while its project settings aren't trusted.
UntrustedRoots []string `toml:"-"`
// Reviewed reports whether the skill in a folder was reviewed and
// trusted with a content hash (HashTrust; nil: every skill is). A
// skill on disk whose scripts weren't is asked about before each run.
Reviewed func(dir, hash string) bool `toml:"-"`
}
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 loads Agent Skills.
Enabled bool `toml:"enabled"`
// Paths are the directories searched for skills (<name>/SKILL.md).
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 SpeakerConfig ¶ added in v0.2.1
type SpeakerConfig struct {
Name string `toml:"name" json:"name"` // as the text's lines name them
Voice string `toml:"voice" json:"voice"` // the provider's voice name
}
SpeakerConfig is one voice in a conversation.
type SuggestionsConfig ¶
type SuggestionsConfig struct {
// Ideas lets a model write up to three tiles from the workspace's
// recent conversations. They're kept, and written again only after a
// conversation changes.
Ideas bool `toml:"ideas"`
// Model writes the ideas ("provider/model"; empty: the auto mode's
// reviewer, else the main model).
Model string `toml:"model"`
}
SuggestionsConfig shapes the welcome tiles a new chat shows: tiles from the workspace's state (the latest chat, uncommitted changes, a failed worker, setup when it has no agent instructions), and ideas a model writes from the recent conversations.
type TelemetryConfig ¶
type TelemetryConfig struct {
// Enabled exports traces and logs over OTLP/HTTP.
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 stops a shell command that runs longer than this.
ShellTimeoutSeconds int `toml:"shell_timeout_seconds"`
// MaxFileSizeBytes is the largest file the file tools read or write.
MaxFileSizeBytes int64 `toml:"max_file_size_bytes"`
// WorkspaceDir is the workspace: the directory the tools work in (the
// --dir flag, else the current directory).
WorkspaceDir string `toml:"workspace_dir"`
// ReadOnly, set by the service (never a setting), makes the workspace
// read-only for the tools and the editor, saying why: a Viewer's clone
// of an organization workspace (spec_053 EN-60).
ReadOnly string `toml:"-"`
// OrgWorkspace, set by the service (never a setting), is the
// organization's ID for the workspace when it's one of its workspaces:
// each model call carries it, so the service applies the workspace's
// guardrails and limits (spec_053 EN-22).
OrgWorkspace string `toml:"-"`
// AutoApproveCommands runs shell commands without asking (the sandbox and
// deny rules still apply).
AutoApproveCommands bool `toml:"auto_approve_commands"`
// UCToolsDir is where the Universal Constructor (helios) keeps the tools
// it creates.
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"`
// MaxBackgroundAgents caps how many background tasks
// (invoke_agent with background: true) run at once in a workspace.
MaxBackgroundAgents int `toml:"max_background_agents"`
// BackgroundAgentTimeout stops a background task that runs longer
// (a Go duration such as "30m").
BackgroundAgentTimeout string `toml:"background_agent_timeout"`
// BackgroundAgentMaxTurns caps a background task's model calls, unless
// its agent sets max_turns.
BackgroundAgentMaxTurns int `toml:"background_agent_max_turns"`
// BackgroundAgentMaxCostUSD stops a background task that has cost more
// (0: no cap).
BackgroundAgentMaxCostUSD float64 `toml:"background_agent_max_cost_usd"`
// Provider lets models use their provider's own tools (web search, web
// fetch, code execution) in place of Blitz's, where they have them
// (spec_056 CA-80); false keeps Blitz's. Unset: on.
Provider *bool `toml:"provider"`
}
ToolsConfig configures shell execution, file operations, and permissions.
func (ToolsConfig) BackgroundLimits ¶ added in v0.9.1
func (t ToolsConfig) BackgroundLimits() (BackgroundLimits, error)
BackgroundLimits reads the background tasks' settings. A value that isn't one (0, negative, a timeout that isn't a length of time) is an error naming its key, rather than quietly the default; an empty timeout is the default.
func (ToolsConfig) ProviderToolsOn ¶ added in v0.9.2
func (t ToolsConfig) ProviderToolsOn() bool
ProviderToolsOn reports whether models may use their provider's own tools ([tools] provider, on unless set false).
type TrustStore ¶
type TrustStore struct {
// contains filtered or unexported fields
}
TrustStore keeps the decisions in trust.json in the settings directory, by canonical workspace directory. Writes are atomic.
func OpenTrustStore ¶
func OpenTrustStore(dir string) *TrustStore
OpenTrustStore is the store in settings directory dir (as ConfigDir returns).
func (*TrustStore) Forget ¶
func (s *TrustStore) Forget(dir string) error
Forget removes the decision for workspace dir, so it's asked again.
func (*TrustStore) Set ¶
func (s *TrustStore) Set(dir, hash string, trusted bool) error
Set records the decision for workspace dir's content hash.
func (*TrustStore) State ¶
func (s *TrustStore) State(dir, hash string) string
State is the decision for workspace dir's content hash ("" when there is nothing to trust).
type UIConfig ¶
type UIConfig struct {
// Style is the output style sessions start with: default, concise,
// explanatory, or one in ~/.blitz/styles.
Style string `toml:"style"`
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 is how many REPL inputs the history keeps.
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)
// NotifyAfter makes a turn that runs longer than this many seconds tell
// you when it ends, or when an approval or question waits (0: never).
NotifyAfter int `toml:"notify_after"`
// Notify is how the terminal tells you: both (bell and desktop
// notification), bell, desktop or off.
Notify string `toml:"notify"`
// TaskAlerts is how a workflow's human task reaches you when no app
// window is open: "notify" (a notification that opens the task's small
// window), "open" (the window opens at once) or "off".
TaskAlerts string `toml:"task_alerts"`
// StatusLine is the line shown above each prompt: "default" (model,
// mode, context, cost), a shell command that reads the session's state
// as JSON and prints the line, or "" for none.
StatusLine string `toml:"status_line"`
// Editor is how the prompt edits: emacs (the default) or vim.
Editor string `toml:"editor"`
// Keybindings is the file that rebinds the REPL's keys.
Keybindings string `toml:"keybindings"`
}
UIConfig controls terminal presentation.
type UsageConfig ¶ added in v0.8.11
type UsageConfig struct {
// Count sends a daily ping on a day Blitz is used, which counts the
// install as active (a random ID, the day, the front end, the version
// and the platform); false sends nothing. On by default (AI-30).
Count bool `toml:"count"`
}
UsageConfig is whether Blitz counts its install as active (spec_054_active_installs).
type WebConfig ¶
type WebConfig struct {
// Enabled offers the web_fetch tool.
Enabled bool `toml:"enabled"`
AllowDomains []string `toml:"allow_domains"` // fetched without approval (globs like *.go.dev)
// DenyDomains are never fetched (globs).
DenyDomains []string `toml:"deny_domains"`
AllowPrivate bool `toml:"allow_private"` // permit localhost/private network targets
// MaxBytes is the most of a page web_fetch reads.
MaxBytes int64 `toml:"max_bytes"`
// TimeoutSeconds stops a fetch or search that takes longer.
TimeoutSeconds int `toml:"timeout_seconds"`
// BrowserFallback has web_fetch load a page in the browser when a
// plain request gets a bot check or a page that needs JavaScript (with
// [browser] enabled; spec_008_web WEB-09).
BrowserFallback bool `toml:"browser_fallback"`
// 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 is a SearXNG instance's address, for search_provider
// "searxng".
SearchURL string `toml:"search_url"`
// SearchModel is the Gemini model that runs "google" searches
// (default: llm.gemini.model, else gemini-4-argon).
SearchModel string `toml:"search_model"`
// SearchMaxResults is how many results a web search returns (0: 5).
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.
func (WorkerPolicy) Problems ¶ added in v0.9.1
func (p WorkerPolicy) Problems() []string
Problems are the policy's durations that can't be read (a Go duration such as 30m or 1h30m, above zero): never "no limit", they're reported (spec_023 WK-22a).
type WorkersConfig ¶
type WorkersConfig struct {
// Enabled lets workers run.
Enabled bool `toml:"enabled"`
// Paths are the directories holding worker directories, relative to
// the workspace; a name in an earlier one wins. New workers go in the
// first.
Paths []string `toml:"paths"`
// Policy caps what any worker may do and spend.
Policy WorkerPolicy `toml:"policy"`
// Notify is a command run after each scheduled run whose status is in
// NotifyOn, with the run record as JSON on stdin: outside the sandbox,
// like a hook, so only the user's settings may set it.
Notify string `toml:"notify"`
NotifyOn []string `toml:"notify_on"`
}
WorkersConfig controls workers: scheduled workflows a workspace defines in workers/<name>/WORKER.md (see pkg/engine/workers).
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package configtest configures Blitz for tests.
|
Package configtest configures Blitz for tests. |