config

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 28 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package config loads Blitz's settings: one TOML file, .env.toml, in ~/.blitz (or $MODENV_PREFIX, or --config), with a workspace's own settings laid over it from ~/.blitz/workspaces, API keys resolved from the OS keychain, and environment variables applied last. Nothing is read from the workspace itself, so a cloned repository can't redirect a key or turn off approvals. It also edits the file in place, a line at a time, for the settings the front ends change (spec_config_002).

Index

Constants

View Source
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.

View Source
const (
	PlanReviewAlways = "always"
	PlanReviewAgent  = "agent-decides"
	PlanReviewNever  = "never"
)

Plan review policies ([blitz] plan_review).

View Source
const (
	HookCommand = "command"
	HookHTTP    = "http"
	HookPrompt  = "prompt"
)

Hook types.

View Source
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.

View Source
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
)

Why a project setting was ignored, in ProjectItem.Reason.

View Source
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).

View Source
const AuthEntra = "entra"

AuthEntra is Azure's Entra ID sign-in.

View Source
const ProjectAgentsDir = ".agents/agents"

ProjectAgentsDir holds a workspace's agents, relative to it.

View Source
const UserAgentsDir = "~/.blitz/agents"

UserAgentsDir holds the user's own agents, for every workspace.

Variables

View Source
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.

View Source
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.

View Source
var DefaultDeniedCommands = []string{
	"sudo *", "su *", "doas *",
	"shutdown *", "reboot *", "halt *", "mkfs *", "mkfs.*", "diskutil erase*",
}

DefaultDeniedCommands are refused regardless of approval.

View Source
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.

View Source
var DefaultPricing = map[string]ModelPrice{

	"gemini-3.8-flash": {InputPerMTok: 0.75, OutputPerMTok: 3.75, CachedInputPerMTok: 0.075},
	"gemini-2.5-pro":   {InputPerMTok: 1.25, OutputPerMTok: 10.00, CachedInputPerMTok: 0.31},
	"gpt-4o":           {InputPerMTok: 2.50, OutputPerMTok: 10.00, CachedInputPerMTok: 1.25},

	"claude-opus-5":    {InputPerMTok: 5.00, OutputPerMTok: 25.00, CachedInputPerMTok: 0.50, CacheWritePerMTok: 6.25},
	"claude-sonnet-5":  {InputPerMTok: 2.00, OutputPerMTok: 10.00, CachedInputPerMTok: 0.20, CacheWritePerMTok: 2.50},
	"claude-haiku-4-5": {InputPerMTok: 1.00, OutputPerMTok: 5.00, CachedInputPerMTok: 0.10, CacheWritePerMTok: 1.25},

	"gemini-2.5-flash-preview-tts": {InputPerMTok: 0.50, OutputPerMTok: 10.00},
	"gemini-2.5-pro-preview-tts":   {InputPerMTok: 1.00, OutputPerMTok: 20.00},
}

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.

View Source
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.

View Source
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.

View Source
var Efforts = []string{"minimal", "low", "medium", "high", "max"}

Efforts are the reasoning effort levels, lowest first.

View Source
var ErrNoMCPServer = errors.New("no MCP server by that name")

ErrNoMCPServer means no [[mcp.servers]] entry has that name.

View Source
var KeyedProviders = []string{"gemini", "anthropic", "openai"}

KeyedProviders are the providers that take an API key.

View Source
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.

View Source
var ModelSettingKeys = []string{"temperature", "max_tokens", "top_p", "seed", "reasoning_effort", "thinking_budget"}

ModelSettingKeys are the settings a model can have, in display order.

View Source
var PriceChanges = []PriceChange{

	{Model: "gemini-3.8-flash", From: time.Date(2027, 1, 1, 0, 0, 0, 0, time.UTC),
		Price: ModelPrice{InputPerMTok: 1.50, OutputPerMTok: 7.50, CachedInputPerMTok: 0.15}},
}

PriceChanges are announced changes to DefaultPricing, so a build made before a change still prices correctly after it.

View Source
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.

View Source
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.

View Source
var ReadOnlyGuardLabels = []string{"git … --output", "git … --ext-diff", "rg … --pre"}

ReadOnlyGuardLabels say what ReadOnlyGuards cover, for people.

View Source
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.

View Source
var Reference = sync.OnceValue(func() []Setting {
	docs := fieldDocs()
	def := DefaultConfig()
	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.

View Source
var SearchSourceNames = []string{"files", "documents", "chats", "notes"}

SearchSourceNames are the sources workspace search knows.

View Source
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.

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 string, s MCPServerConfig) (string, error)

AddMCPServer appends s as a [[mcp.servers]] entry of the global settings (prefixDir as for Load). A server of the same name 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

func AuthMethods(provider string) []string

AuthMethods are the sign-in methods provider takes besides an API key, for the forms and the CLI's help.

func CanonicalWorkspace

func CanonicalWorkspace(dir string) (string, error)

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 ConfigDir

func ConfigDir(prefixDir string) string

ConfigDir returns the trusted directory to load .env.toml from, or "" if none.

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 Dir

func Dir() string

Dir returns the Blitz home directory (~/.blitz).

func ExpandHome

func ExpandHome(p string) string

ExpandHome expands a leading "~" or "~/" to the user's home directory. Other forms (e.g. "~user") are returned unchanged.

func IsWorkspaceRelative

func IsWorkspaceRelative(p string) bool

IsWorkspaceRelative reports whether a configured search path points into the current workspace (a relative path) rather than a user-level location.

func ParseEffort

func ParseEffort(s string) (string, error)

ParseEffort reads an effort level (xhigh counts as max).

func ReadSettingsFile

func ReadSettingsFile(prefixDir, workspace string) (string, string, error)

ReadSettingsFile returns a scope's settings file and its text ("" when it doesn't exist yet).

func RemoveAPIKey

func RemoveAPIKey(prefixDir, workspace, provider string) (string, error)

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

func RemoveMCPServer(prefixDir, name string) (string, error)

RemoveMCPServer deletes the entry named name.

func RemovePermissionRule

func RemovePermissionRule(prefixDir, workspace, rule string) (path string, removed int, err error)

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 SaveAgentModel

func SaveAgentModel(dir, agent, ref string) (string, error)

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

func SavePermissionRules(dir, effect string, rules []string) (string, error)

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

func SaveUILocale(dir, locale string) (string, error)

SaveUILocale records locale as [ui] locale in dir/.env.toml, editing only that line so comments, ordering and encrypted values are kept. The file is created (mode 600) if missing. It returns the file written.

func SecureAPIKey

func SecureAPIKey(prefixDir, workspace, provider string) (string, error)

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

func SetAPIKey(prefixDir, workspace, provider, key string) (string, error)

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 SetMCPServerDisabled

func SetMCPServerDisabled(prefixDir, name string, disabled bool) (string, error)

SetMCPServerDisabled turns the entry named name off (disabled = true) or on again.

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

func SetReadOnlyDefaults(prefixDir, workspace string, on *bool) (string, error)

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

func SetValue(prefixDir, workspace, key, value string) (string, error)

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

func UnpinAgentModel(dir, agent string, masking bool) (string, error)

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 ValidProvider

func ValidProvider(p string) bool

ValidProvider reports whether p is a provider Blitz can use.

func WorkspaceSettingsDir

func WorkspaceSettingsDir(prefixDir, workspace string) string

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

func WriteSettingsFile(prefixDir, workspace, text string) (string, []string, error)

WriteSettingsFile replaces a scope's settings file with text, after checking that it's valid TOML that fits Blitz's settings. It returns the file written and warnings: keys Blitz doesn't know (likely typos), and API keys written in plain text.

Types

type AgencyLevel

type AgencyLevel string

AgencyLevel determines how autonomously the agent operates.

const (
	AgencyLow     AgencyLevel = "low"     // Stop after each meaningful unit of work and ask
	AgencyMedium  AgencyLevel = "medium"  // Complete routine tasks; pause at major milestones
	AgencyHigh    AgencyLevel = "high"    // Complete tasks autonomously; ask only when blocked
	AgencyExtreme AgencyLevel = "extreme" // Maximally autonomous, polling background tasks
)

type AnthropicConfig

type AnthropicConfig struct {
	// APIKey is optional: without it the SDK also accepts ANTHROPIC_AUTH_TOKEN
	// and `ant auth login` profiles.
	APIKey string `toml:"api_key"`
	// 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"`
	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 (default 9000, 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 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, 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: 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.
	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"`
}

BrowserConfig controls the browser tool (spec_parity_027 §5.2): a Chromium-family browser the agent drives, in its own profile, reaching what the web rules allow.

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"`
	// Git is what Blitz does with git in a workspace that's a repository.
	Git     GitConfig     `toml:"git"`
	Tools   ToolsConfig   `toml:"tools"`
	Session SessionConfig `toml:"session"`
	Sandbox SandboxConfig `toml:"sandbox"`
	// Permissions are allow, ask and deny rules for actions, as
	// "kind(pattern)" (see tools.ParsePermissionRule).
	Permissions PermissionsConfig `toml:"permissions"`

	UI          UIConfig         `toml:"ui"`
	Memory      MemoryConfig     `toml:"memory"`
	Context     ContextConfig    `toml:"context"`
	Audit       AuditConfig      `toml:"audit"`
	Checkpoints CheckpointConfig `toml:"checkpoints"`
	Images      ImagesConfig     `toml:"images"`
	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"`
	// 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:"-"`
}

Config represents the complete Blitz configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a fully initialized Config with sensible production defaults.

func Load

func Load(prefixDir string) (*Config, error)

Load loads configuration using modenv from a trusted directory, falling back to DefaultConfig with environment variable overrides.

The config directory is, in order: prefixDir (the --config flag), the MODENV_PREFIX environment variable, then ~/.blitz. The current working directory is deliberately NOT consulted: a cloned repository could otherwise ship a .env.toml that redirects llm.openai.base_url to an attacker's server and receive the user's API key, or enable auto-approval. Pass --config . to opt in to a workspace config explicitly.

func LoadWorkspace

func LoadWorkspace(prefixDir, workspace string) (*Config, error)

LoadWorkspace is Load with the workspace's own settings over the global ones. It doesn't set Tools.WorkspaceDir: the caller does.

func (*Config) AgentSearchPaths

func (c *Config) AgentSearchPaths(workspace string) []string

AgentSearchPaths returns directories to scan for user-defined agents, resolved like SkillSearchPaths: the user's, then the workspace's.

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

func (c *Config) ModelName() string

ModelName returns the model to use: blitz.default_model when set, otherwise the active provider's model.

func (*Config) SearchPriceFor

func (c *Config) SearchPriceFor(provider string) float64

SearchPriceFor is provider's price per query: the settings', else the default, else 0 (not billed per query, or unknown).

func (*Config) SkillSearchPaths

func (c *Config) SkillSearchPaths(workspace string) []string

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_project_config_031).

func (*Config) UsesADC

func (c *Config) UsesADC() bool

UsesADC reports whether a provider signs in with Google's Application Default Credentials.

type ContextConfig

type ContextConfig struct {
	// Compaction summarises older history once a prompt reaches
	// TokenThreshold tokens, keeping the RetainEvents most recent events raw.
	Compaction     bool `toml:"compaction"`
	TokenThreshold int  `toml:"token_threshold"`
	RetainEvents   int  `toml:"retain_events"`
}

ContextConfig controls conversation compaction.

type GeminiConfig

type GeminiConfig struct {
	// APIKey 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"`
	// 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"`
}

GitConfig is what Blitz does with git in a workspace that's a repository.

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.

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) All

func (h HooksConfig) All() []HookConfig

All returns every configured hook.

func (HooksConfig) ByEvent

func (h HooksConfig) ByEvent() map[string][]HookConfig

ByEvent returns the hooks for each event name.

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)
}

ImagesConfig controls pictures sent to the model: @file.png mentions, /attach, /paste, --image and the view_image tool.

type KeySource

type KeySource string

KeySource says where a provider's key comes from.

const (
	KeyNone        KeySource = "none"
	KeyKeychain    KeySource = "keychain"    // a reference to the OS store
	KeyPlain       KeySource = "plain"       // written in the file as is
	KeyObfuscated  KeySource = "obfuscated"  // modenv's xor: (not encryption)
	KeyEnvironment KeySource = "environment" // an environment variable
	KeyInherited   KeySource = "inherited"   // a workspace using the global key
)

Where a key can come from, as Describe reports it.

type LLMConfig

type LLMConfig struct {
	// Provider is the model provider: gemini, openai, anthropic or ollama.
	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.
	StallTimeoutSeconds int `toml:"stall_timeout_seconds"`
	// FallbackModels are tried in order when the model in use fails before
	// answering (after its retries): "provider/model" (e.g.
	// "anthropic/claude-sonnet-5") or just "model" for the same provider.
	// Credentials come from each provider's own section. For names that
	// contain a slash (OpenRouter), write the provider first:
	// "openai/anthropic/claude-sonnet-5".
	FallbackModels []string `toml:"fallback_models"`

	Gemini    GeminiConfig    `toml:"gemini"`
	OpenAI    OpenAIConfig    `toml:"openai"`
	Anthropic AnthropicConfig `toml:"anthropic"`
	Bedrock   BedrockConfig   `toml:"bedrock"`
	Azure     AzureConfig     `toml:"azure"`
}

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"`
}

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"`
}

MCPServerConfig describes a Model Context Protocol server. Exactly one of Command (stdio) or URL (streamable HTTP) is set.

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"`
}

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).

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 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"`
}

OpenAIConfig holds settings for OpenAI, OpenRouter, or Ollama.

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

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

func CheckSettings(text string) []Problem

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).

func (Problem) String

func (p Problem) String() string

String is the problem as "line N: message".

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

func LoadProject(workspace string) *Project

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

func (p *Project) ApplyTightening(cfg *Config)

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

func (p *Project) ApplyTrusted(cfg *Config)

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.

func (*Project) Hash

func (p *Project) Hash(extra ...string) string

Hash identifies the tier B content: the settings that need trust, each tagged with its file, the content of the workspace files they run, and extra (the hashes of the project's skills with scripts, which the engine adds). "" when there is nothing to trust.

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

type ProviderAuth struct {
	Method    string
	ProjectID string
	Location  string
	Profile   string
}

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
}

ProviderChoice is what the provider form saves as one change: a scope's llm.provider and blitz.default_model ("" removes either, so a workspace follows the global setting again), how Provider signs in (Auth; nil leaves it as it is) and, unless Key is "", a new API key for Provider.

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.
	ShareADC bool           `toml:"share_adc"`
	Commands CommandsConfig `toml:"commands"`
}

SandboxConfig bounds what tools may touch.

File tools are confined to the workspace plus AllowedPaths (read-write) and ReadOnlyPaths, minus BlockedPaths. Shell commands are checked against the command policy and, when Shell is "auto" or "required", run under the OS sandbox (macOS Seatbelt): writes are limited to the writable roots, ShellWritablePaths and temp/cache dirs, blocked paths can't be read, and network access follows AllowNetwork.

type ScopeInfo

type ScopeInfo struct {
	Path         string // the settings file (it may not exist yet)
	Provider     string // llm.provider as set in this scope ("" if not)
	DefaultModel string // blitz.default_model as set in this scope
	Providers    []ProviderInfo
	SecretStore  string // where keys go
}

ScopeInfo describes the settings in one scope (workspace "" is global).

func Describe

func Describe(prefixDir, workspace string) (ScopeInfo, error)

Describe reports the settings of a scope: what the file sets, and for each provider where its key comes from.

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: python, typescript.
	Languages []string `toml:"languages"`
	// Sandbox runs scripts under gvisor, the OS sandbox (os), or whichever
	// is available (auto).
	Sandbox string `toml:"sandbox"`
	// Network is "none" (no script gets the network) or "allowlist" (only
	// skills in NetworkAllow that ask for it).
	Network      string   `toml:"network"`
	NetworkAllow []string `toml:"network_allow"`
	// EnvPassthrough lists the environment variables (globs allowed) a
	// skill may receive from the host when it asks for them. Nothing else
	// is passed.
	EnvPassthrough []string `toml:"env_passthrough"`
	// MaxTimeoutSeconds caps every script's run time.
	MaxTimeoutSeconds int `toml:"max_timeout_seconds"`
	// TrustedHashes, when set, are the only skill contents (ContentHash,
	// "sha256:…") whose scripts may run.
	TrustedHashes []string `toml:"trusted_hashes"`
	// DenyTools refuses tool requirements by tool or "tool:scope" (globs,
	// e.g. "Bash:sudo*"); scripts of a skill that needs one don't run.
	DenyTools []string `toml:"deny_tools"`
	// Packages limits script dependencies.
	Packages PackagePolicy `toml:"packages"`
	// UntrustedRoots are directories whose skills' scripts don't run: the
	// workspace, while its project settings aren't trusted.
	UntrustedRoots []string `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"`
	// 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"`
}

ToolsConfig configures shell execution, file operations, and permissions.

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"`
	// 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 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"`
	// 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-3.8-flash).
	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.

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).

Directories

Path Synopsis
Package configtest configures Blitz for tests.
Package configtest configures Blitz for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL