config

package
v2.7.0-dev.5 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package config defines the on-disk schema for `.agents/config.json` and the rules for discovering, parsing, and merging it with built-in defaults.

A minimal config.json only needs to set what the consumer wants to override; all other fields fall back to DefaultConfig().

Index

Constants

View Source
const (
	ThemeAuto  = "auto"
	ThemeDark  = "dark"
	ThemeLight = "light"
)

Theme constants for UIConfig.Theme. Reserved buckets; any other lowercase identifier accepted by validateUI is passed through to core-tui as a named-theme lookup.

View Source
const (
	PermissionModeAsk         = "ask"
	PermissionModeAllow       = "allow"
	PermissionModeYolo        = "yolo"
	PermissionModePlan        = "plan"
	PermissionModeAcceptEdits = "acceptEdits"
)

Permission modes.

View Source
const (
	ProviderGemini          = "gemini"
	ProviderVertex          = "vertex"
	ProviderAnthropic       = "anthropic"
	ProviderAnthropicVertex = "anthropic-vertex"
	ProviderEcho            = "echo"
	ProviderScripted        = "scripted"
)

Provider names recognized by the resolver.

View Source
const (
	SmallTierParentWarn   = "warn"
	SmallTierParentRefuse = "refuse"
	SmallTierParentAllow  = "allow"
)

Small-tier-parent mode constants. See SafetyConfig.SmallTierParent for behavior. Exported so consumers (CLI, library) can reference the canonical strings.

View Source
const AgentsDirName = ".agents"

AgentsDirName is the project-local directory we discover, analogous to `.git`. It contains config.json, mcp.json, skills/, sessions/, etc.

View Source
const ConfigFileName = "config.json"

ConfigFileName is the per-project config file inside AgentsDirName.

View Source
const (
	MultiSessionAuthKindBearerTable = "bearer_table"
)

Recognized values for MultiSessionAuthConfig.Kind. Only the bearer table is implemented in v2.4; other kinds are reserved and return a validation error.

View Source
const SchemaVersion = 1

SchemaVersion is the current major version of the on-disk config format. Bump when making a breaking change; older versions are rejected at load time with a clear error suggesting the upgrade path.

Variables

This section is empty.

Functions

func Find

func Find(startDir string) (string, bool, error)

Find walks up from startDir looking for a directory named .agents/. On match it returns the absolute path of that directory and ok=true. When no match is found up to the filesystem root, ok=false (not an error).

func Save

func Save(path string, cfg *Config) error

Save writes cfg to path atomically (temp file in the same directory followed by rename). The output is human-edit-friendly: stable key order, two-space indentation, trailing newline.

Save does not validate; callers should run cfg.Validate() first.

Types

type AgentConfig

type AgentConfig struct {
	MaxSteps int `json:"max_steps,omitempty"`

	// MaxTurnCostUSD caps a single conversation turn's cumulative
	// spend. When the post-turn hook detects spend ≥ this value, the
	// agent emits a structured turn-error (kind=cost_ceiling) and
	// refuses new turns until the operator clears the flag via
	// Agent.ResetCostCeiling. Pointer so unset is distinguishable
	// from the deliberate 0 (which would mean "no budget — refuse
	// every turn", which we treat as "disabled"). 0 or negative ==
	// disabled. Defense against the read-file-loop class of bug
	// (#144) within a single turn.
	MaxTurnCostUSD *float64 `json:"max_turn_cost_usd,omitempty"`

	// MaxSessionCostUSD caps the session's cumulative spend across
	// all turns (parent + subtask). Tripped → same behavior as
	// MaxTurnCostUSD. Useful for long-running autonomous deploys
	// where individual turns are reasonable but the session adds up.
	MaxSessionCostUSD *float64 `json:"max_session_cost_usd,omitempty"`

	// DisplayName overrides the brand line at the top of the TUI. By
	// default the TUI shows the AppName (e.g. "core-agent"); set this
	// to give the agent a human-friendly identity ("Triage Bot",
	// "Code Reviewer", etc.). Empty falls back to AppName.
	DisplayName string `json:"display_name,omitempty"`

	// Description is a one-line summary of what this agent does.
	// Used in two places: (1) ADK's llmagent.Config.Description, which
	// becomes part of the system prompt ("you are an agent named X,
	// description: ..."), and (2) the /.well-known/agent-card.json
	// `description` field if the card endpoint is enabled. Set once,
	// fanned out to both. Empty = no description in the system prompt
	// and the card endpoint stays off unless --agent-card-description
	// overrides.
	Description string `json:"description,omitempty"`
}

AgentConfig tunes runtime agent behavior.

type AnthropicConfig

type AnthropicConfig struct {
	APIKey string        `json:"api_key,omitempty"`
	Vertex *VertexConfig `json:"vertex,omitempty"`
}

AnthropicConfig holds Claude-specific settings for the anthropic provider family. APIKey is used by the first-party "anthropic" provider (api.anthropic.com); Vertex is used by "anthropic-vertex" (Claude served via Google Vertex AI).

type AttachConfig

type AttachConfig struct {
	// Server-side: where the attach listener binds. Set at most one.
	Listen     string `json:"listen,omitempty"`      // e.g. "0.0.0.0:7777"
	UnixSocket string `json:"unix_socket,omitempty"` // e.g. "/var/run/core-agent.sock"

	// TLS material. TLSCert + TLSKey enable HTTPS; ClientCA additionally
	// enables mTLS (client cert required). Paths only — keys live on disk.
	TLSCert  string `json:"tls_cert,omitempty"`
	TLSKey   string `json:"tls_key,omitempty"`
	ClientCA string `json:"client_ca,omitempty"`

	// TokenEnv is the name of the env var that holds the bearer token
	// clients must present. The secret itself never lives in config.
	TokenEnv string `json:"token_env,omitempty"`

	// ReadOnly disables POST /inject and /wake; read endpoints stay open.
	ReadOnly bool `json:"readonly,omitempty"`

	// PeerHub turns on the peer-registration endpoints on this listener.
	PeerHub bool `json:"peer_hub,omitempty"`

	// Peer-side: this agent registers with a remote hub.
	RegisterTo       string `json:"register_to,omitempty"`       // hub URL
	RegisterEndpoint string `json:"register_endpoint,omitempty"` // expanded via os.ExpandEnv
	RegisterName     string `json:"register_name,omitempty"`     // defaults to hostname when empty

	// MultiSession enables per-caller authentication + per-session
	// ACL on the attach listener. Zero value (disabled) keeps the
	// daemon in single-user mode — the listener treats every request
	// as the same anonymous Caller and TokenEnv / BearerToken still
	// gate at the transport layer as today. See
	// docs/multi-session-design.md.
	MultiSession MultiSessionConfig `json:"multi_session,omitempty"`
}

AttachConfig holds defaults for the attach-mode listener and the peer-registration client. Every field is also exposed as a CLI flag (--attach-*); the CLI flag wins when set, otherwise the config value supplies the default. Fields holding URLs / addresses pass through os.ExpandEnv so per-pod values like "https://${POD_IP}:7777" can live in a shared ConfigMap.

BearerToken is intentionally NOT a field here. The CLI flag form is --attach-token=ENVVAR (the name of the env var holding the secret), not the secret itself, and that env-var indirection should not be duplicated in a config file. Configure the env var via your secret manager (K8s Secret, sealed-secret, etc.) and set TokenEnv if you want to nail the env-var name down per-deployment.

type CompactionConfig

type CompactionConfig struct {
	// Threshold overrides the fallback utilization threshold used
	// when the current model's tier isn't classified or isn't in
	// ThresholdByTier. Pointer so absence is distinguishable from
	// the deliberate value 0 (which would disable compaction).
	// Must be in (0, 1) when set.
	Threshold *float64 `json:"threshold,omitempty"`

	// ThresholdByTier overrides per-tier defaults. Keys are tier
	// labels from pkg/modeltier ("frontier", "mid", "small"). Set
	// only the tiers you want to override; the rest take their
	// package defaults (0.85 / 0.65 / 0.35). Values must be in
	// (0, 1).
	//
	// Example — keep frontier sessions on the historical default
	// while compacting Flash/Haiku much earlier:
	//   "compaction": {
	//     "threshold_by_tier": { "small": 0.30 }
	//   }
	ThresholdByTier map[string]float64 `json:"threshold_by_tier,omitempty"`
}

CompactionConfig configures the automatic context-window compaction trigger. Both fields are optional — leave empty for the substrate defaults (per-tier thresholds from pkg/modeltier).

type Config

type Config struct {
	Version     int               `json:"version"`
	Model       ModelConfig       `json:"model"`
	Permissions PermissionsConfig `json:"permissions,omitempty"`
	PathScope   PathScopeConfig   `json:"path_scope,omitempty"`
	Agent       AgentConfig       `json:"agent,omitempty"`
	ToolOutput  ToolOutputConfig  `json:"tool_output,omitempty"`
	Tools       ToolsConfig       `json:"tools,omitempty"`
	Hooks       hooks.Config      `json:"hooks,omitempty"`
	Mock        MockConfig        `json:"mock,omitempty"`
	OTEL        OTELConfig        `json:"otel,omitempty"`
	URLScope    URLScopeConfig    `json:"url_scope,omitempty"`
	Attach      AttachConfig      `json:"attach,omitempty"`
	Pricing     PricingFileConfig `json:"pricing,omitempty"`
	UI          UIConfig          `json:"ui,omitempty"`
	Compaction  CompactionConfig  `json:"compaction,omitempty"`
	Session     SessionConfig     `json:"session,omitempty"`
	Safety      SafetyConfig      `json:"safety,omitempty"`
}

Config is the in-memory representation of `.agents/config.json`.

All sub-sections except Model have sensible zero-valued defaults, so a minimal `config.json` only needs to set what the user wants to override.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a Config with all fields populated by sensible defaults. Override-then-merge happens at Load time.

func Load

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

Load reads <agentsDir>/config.json, merges it over DefaultConfig(), and validates the result. agentsDir must be the absolute path returned by Find. Missing config.json is treated as "use defaults" (not an error) so that an empty .agents/ directory still yields a working config.

func LoadOrDefault

func LoadOrDefault(startDir string) (cfg *Config, agentsDir string, err error)

LoadOrDefault is the convenience entry point used by main: it walks up from startDir, loads `.agents/config.json` if found, otherwise returns pristine defaults. The returned agentsDir is "" when no .agents/ was discovered — callers can use that to skip writes that require a project.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the config is internally inconsistent. Validation here is structural; environmental concerns (is GOOGLE_API_KEY set? does the GCP project exist?) are checked at provider-construction time so test fixtures don't need real creds.

type ContextCacheConfig

type ContextCacheConfig struct {
	// Enabled defaults to true (nil = ON). Set to false to disable
	// caching without touching the other fields.
	Enabled *bool `json:"enabled,omitempty"`
	// TTL is how long each Create/Update requests the cache live for.
	// Format: any string time.ParseDuration accepts (e.g. "6h", "30m").
	// Empty → 6h. Vertex caps at 24h.
	TTL string `json:"ttl,omitempty"`
	// Refresh triggers a background Update when time-to-expiry drops
	// below this value. Format matches TTL. Empty → 30min.
	Refresh string `json:"refresh,omitempty"`
}

ContextCacheConfig tunes Vertex explicit context caching. All fields have sensible defaults — an empty struct enables caching with the design-doc defaults (6h TTL, 30min refresh window).

Enabled is a pointer so the config surface distinguishes "unset" (default ON) from an explicit "off" — operators typing `"enabled": false` disable caching while leaving TTL/Refresh in place for future re-enabling. The --no-context-cache CLI flag takes precedence over both.

func (*ContextCacheConfig) IsEnabled

func (c *ContextCacheConfig) IsEnabled() bool

IsEnabled reports whether caching should be turned on given this config. Nil receiver → true (default ON when the whole block is absent from config.json). Set Enabled to false to disable.

type MockConfig

type MockConfig struct {
	Script string `json:"script,omitempty"`
	Strict bool   `json:"strict,omitempty"`
	Record string `json:"record,omitempty"`
}

MockConfig configures the mock providers (echo, scripted) and the orthogonal recording wrapper.

Script is the path to a JSONL transcript consumed by the scripted provider; it's required when model.provider is "scripted".

Strict makes the scripted provider assert that each incoming request's Contents JSON-equal the recorded request. Off by default — the typical use is replaying without caring about prompt drift.

Record is a path to write a JSONL recording of every LLM turn. Works with any provider, not just the mocks; lives in MockConfig because it shares the file format the scripted provider consumes.

type ModelConfig

type ModelConfig struct {
	Provider  string           `json:"provider,omitempty"`
	Name      string           `json:"name"`
	APIKey    string           `json:"api_key,omitempty"`
	Vertex    *VertexConfig    `json:"vertex,omitempty"`
	Anthropic *AnthropicConfig `json:"anthropic,omitempty"`
	// Pricing is a per-model rate override keyed by model name
	// (case-insensitive). Survives /model switches mid-session —
	// every model the operator routes to can carry its own rates.
	// Layered with .agents/pricing.json + ~/.core-agent/pricing.json
	// + the compiled-in fallback; see internal/pricing for the
	// lookup chain. Previously a single *PricingConfig that matched
	// only Model.Name; PR core-agent/#NN renamed the JSON key
	// `pricing` from "{input_per_mtok, output_per_mtok}" to a map.
	Pricing PricingMap `json:"pricing,omitempty"`
}

ModelConfig selects the LLM provider and model.

Provider: one of "gemini", "vertex", "anthropic". When empty, the resolver auto-detects from the environment (see models.Resolve). Name: a model ID, e.g. "gemini-3.1-pro-preview-customtools" or "claude-opus-4-7". APIKey: optional inline key for Provider="gemini"; usually unset and read from GOOGLE_API_KEY at runtime. Vertex: required when Provider="vertex"; project + location. Anthropic: optional credentials for Provider="anthropic"; usually unset and read from ANTHROPIC_API_KEY at runtime.

type MultiSessionAuthConfig

type MultiSessionAuthConfig struct {
	// Kind selects the Authenticator implementation.
	// Recognized values:
	//   - "" or "bearer_table" — static token → identity table loaded
	//     from TableFile (default; v2.4)
	// Future: "oidc" / "mtls" / "k8s_sa" (interfaces designed; not
	// shipped in v2.4).
	Kind string `json:"kind,omitempty"`

	// TableFile is the path to users.json when Kind="bearer_table".
	// File must be mode 0600 or stricter (the loader rejects anything
	// laxer). Required when Kind="bearer_table" and Enabled=true.
	TableFile string `json:"table_file,omitempty"`
}

MultiSessionAuthConfig selects which Authenticator implementation the multi-session attach listener uses. Only "bearer_table" is shipped in v2.4; the other kinds are designed but deferred (see docs/multi-session-design.md §"Non-goals").

type MultiSessionConfig

type MultiSessionConfig struct {
	// Enabled switches the attach listener from single-user mode
	// (daemon-level bearer token, no per-caller threading) to
	// multi-session mode (per-caller authentication, ACL enforcement,
	// audit log identity threading). Default false.
	Enabled bool `json:"enabled,omitempty"`

	// UsersDir is the directory holding per-caller instruction
	// overlays (Phase 3 / PR γ). Each subdirectory named after a
	// Caller's Identity may contain an .agents/ tree merged on top of
	// the daemon-wide instruction stack for sessions belonging to
	// that Caller. Empty disables the overlay path.
	UsersDir string `json:"users_dir,omitempty"`

	// Auth selects the Authenticator implementation and its
	// configuration. Only "bearer_table" is shipped in v2.4; OIDC /
	// JWT / mTLS / K8s ServiceAccount kinds are designed but
	// deferred.
	Auth MultiSessionAuthConfig `json:"auth,omitempty"`

	// AdminIdentities lists the Caller identities that bypass every
	// per-session authorization check (Admin role). Use sparingly —
	// these identities can read every session in the daemon.
	AdminIdentities []string `json:"admin_identities,omitempty"`

	// AllowAnonymous, when true, lets requests without a valid
	// credential resolve to the DefaultIdentity Caller instead of
	// returning 401. Dangerous in shared environments where every
	// unauthenticated request becomes the same Caller. Default false.
	AllowAnonymous bool `json:"allow_anonymous,omitempty"`

	// DefaultIdentity is the Caller.Identity stamped onto the
	// implicit anonymous Caller (when multi-session is disabled or
	// AllowAnonymous=true). Default "anon".
	DefaultIdentity string `json:"default_identity,omitempty"`

	// ProxyIdentities lists Caller identities permitted to assert
	// other Callers via the AssertedCallerHeader. Typical use:
	// chat-bot service-account identities ("sa:slack-bot") that
	// authenticate as themselves but speak on behalf of human users.
	// Empty disables the proxy path.
	ProxyIdentities []string `json:"proxy_identities,omitempty"`

	// AssertedCallerHeader is the header name a proxy Caller uses to
	// assert the effective identity. Default "X-Asserted-Caller".
	AssertedCallerHeader string `json:"asserted_caller_header,omitempty"`

	// SessionIdleTimeout bounds how long an in-memory session may
	// sit untouched before the eviction sweep removes it. Evicted
	// sessions remain resumable from disk (the ACL row stays);
	// the next Lookup re-resumes them lazily via the SessionResumer.
	//
	// Parsed via time.ParseDuration ("24h", "30m", "7d" all work).
	// Omitted or empty → default 24h. Explicit "0s" DISABLES the
	// sweep entirely — sessions stay in memory until the daemon
	// stops. Use "0s" for tiny local-dev daemons where memory
	// isn't a concern; use a shorter value for tight-budget pods.
	//
	// Only meaningful when Enabled=true and the daemon has an
	// aclStore wired (i.e., --session-db is set). See
	// docs/session-resume-design.md §"Lifecycle primitive".
	SessionIdleTimeout string `json:"session_idle_timeout,omitempty"`
}

MultiSessionConfig configures the per-caller authentication + per-session ACL surface introduced in v2.4. Disabled (zero value) preserves single-user behavior. When enabled, the attach server authenticates every request against the configured Authenticator (typically a bearer table loaded from users.json) and threads the resolved Caller through audit logs, per-session permission grants, and outbound MCP context.

Field-by-field detail in docs/multi-session-design.md §"Config surface".

type OTELConfig

type OTELConfig struct {
	Exporter string `json:"exporter,omitempty"` // "none" | "console" | "otlp"
	Endpoint string `json:"endpoint,omitempty"`
}

OTELConfig configures the OpenTelemetry exporter.

type PathScopeAllowEntry

type PathScopeAllowEntry struct {
	Path   string `json:"path"`
	Access string `json:"access"`
}

PathScopeAllowEntry is one typed allow-list entry. Access is one of "r" / "w" / "rw" (long forms "read" / "write" / "readwrite" also accepted); empty Access fails validation rather than silently broadening to rw. Path uses the same matching rules as Allow: exact path, "/.../" subtree, or filepath.Match glob.

type PathScopeConfig

type PathScopeConfig struct {
	Allow      []string              `json:"allow,omitempty"`
	AllowPaths []PathScopeAllowEntry `json:"allow_paths,omitempty"`
}

PathScopeConfig holds extra paths that file tools may read/write outside the default project + user-home scope. Patterns may be exact paths or directory globs (terminating "/...") and are typically appended via the "Always allow this path/tree" prompt path.

Two shapes coexist:

  • Allow: legacy untyped list; each entry implicitly grants both read and write so behavior matches what existed before the access-level work landed.
  • AllowPaths: typed entries with per-path access spec ("r" / "w" / "rw"). New configurations should prefer this form — it lets the operator say "agent may read this tree but writes still prompt", which the legacy list can't express.

type PermissionsConfig

type PermissionsConfig struct {
	Mode  string   `json:"mode,omitempty"`  // "ask" | "allow" | "yolo" | "plan" | "acceptEdits"
	Allow []string `json:"allow,omitempty"` // pattern allowlist
	Deny  []string `json:"deny,omitempty"`  // pattern denylist

	// UseBuiltinAllow toggles core-agent's built-in conservative
	// read-only allowlist bundle. Defaults to true when nil (the
	// pointer carries an explicit "off" signal vs "unset"). false
	// drops the entire built-in bundle including any opt-ins in
	// BuiltinAllowExtras. See permissions/builtin_allow.go for the
	// bundle catalog.
	UseBuiltinAllow *bool `json:"use_builtin_allow,omitempty"`

	// BuiltinAllowExtras names additional built-in bundles to merge
	// on top of read_only when UseBuiltinAllow is on. Unknown names
	// fail at config-validation time rather than silently dropping
	// permissions. Known bundles: see permissions.KnownBundles().
	BuiltinAllowExtras []string `json:"builtin_allow_extras,omitempty"`

	// RequirePlanArtifact enables the plan-first gating pre-check:
	// mutating tool calls (write/edit/delete/bash, spawn family,
	// MCP tools) are denied until the model calls the record_plan
	// tool. Read-only tools and record_plan itself remain allowed
	// so research happens normally. Composes with every Mode —
	// even ModeYolo denies before a plan is recorded; once
	// recorded, the mode's usual semantics resume.
	// See docs/plan-first-design.md.
	RequirePlanArtifact bool `json:"require_plan_artifact,omitempty"`
}

PermissionsConfig configures the permission gate.

type PricingConfig

type PricingConfig struct {
	InputPerMTok       float64 `json:"input_per_mtok,omitempty"`
	CachedInputPerMTok float64 `json:"cached_input_per_mtok,omitempty"`
	OutputPerMTok      float64 `json:"output_per_mtok,omitempty"`
}

PricingConfig overrides the built-in price table for cost estimation. CachedInputPerMTok is the rate for prompt-cache-hit input tokens; when zero, cache hits are billed at InputPerMTok (no assumed discount).

type PricingFileConfig

type PricingFileConfig struct {
	// Refresh enables the daily background fetch from Source into
	// ~/.core-agent/pricing.json's external section. Defaults to
	// true (most operators want fresh rates). Disable for
	// air-gapped pods or CI where outbound network is blocked or
	// undesirable.
	//
	// Pointer so the JSON unmarshaler can distinguish "unset
	// (default true)" from "explicit false". A bare `null` or
	// missing field yields the default.
	Refresh *bool `json:"refresh,omitempty"`

	// Source overrides the upstream URL the refresher fetches from.
	// Empty defaults to pricing.DefaultRefreshSource (LiteLLM's
	// model_prices_and_context_window.json). Override for mirrors
	// or internal pricing services.
	Source string `json:"source,omitempty"`
}

PricingFileConfig governs the pricing-catalog refresh behavior — distinct from ModelConfig.Pricing (which is the per-model rate override map). Defaults: refresh enabled, daily cadence, LiteLLM upstream. See internal/pricing and docs/pricing-design.md.

type PricingMap

type PricingMap map[string]PricingConfig

PricingMap is the model-keyed override map used by ModelConfig. Aliased so future expansions (per-context rates, cached vs uncached, etc.) localize to one type.

type SafetyConfig

type SafetyConfig struct {
	// SmallTierParent controls what happens when an interactive
	// session starts on a small-tier parent model (Flash/Haiku-class).
	// These models work well as agentic_* subtask workers (#118-122)
	// but loop and stall as the parent for long interactive sessions
	// — see #121 for the smoke that motivated this guard.
	//
	// Values: "warn" (default) logs a one-line operator notice but
	// proceeds; "refuse" exits with a config-error code; "allow"
	// suppresses the check entirely. Empty == "warn".
	//
	// The check is skipped regardless when:
	//   - `-p` one-shot mode (operator knows what they're doing;
	//     might be a script invoking Flash on purpose)
	//   - `--yolo` (trust-the-operator mode)
	//   - The parent's tier doesn't classify (unknown model)
	//
	// CLI override: --small-tier-parent=warn|refuse|allow.
	SmallTierParent string `json:"small_tier_parent,omitempty"`
}

SafetyConfig carries operator-facing safety guardrails — things that are NOT permission gates (those live in PermissionsConfig) but rather "the operator probably misconfigured something" checks. Today: just the small-tier-parent guard (#121).

type SessionConfig

type SessionConfig struct {
	// TaskClass is the operator-declared task class. Must be one
	// of pkg/taskclass.Classes() ("debug" | "implement" | "chat"
	// | "research" | "review") or empty. When set, the CLI applies
	// the matching Profile to whichever flags the operator left
	// unspecified (--model, --ask, compaction threshold, etc.).
	// Explicit CLI flags always win over the task profile.
	//
	// Useful for project-local defaults — e.g. an infra repo's
	// .agents/config.json sets "debug" because debugging is what
	// happens there; operators get the right defaults without
	// having to remember --task=debug on every invocation.
	TaskClass string `json:"task_class,omitempty"`
}

SessionConfig carries per-session presets — currently just the operator-declared task class (#123). CLI flag --task overrides this field; both default to unset, which leaves the substrate defaults in place.

type ToolOutputConfig

type ToolOutputConfig struct {
	MaxBytes int                              `json:"max_bytes,omitempty"`
	MaxLines int                              `json:"max_lines,omitempty"`
	PerTool  map[string]ToolOutputPerToolCaps `json:"per_tool,omitempty"`
}

ToolOutputConfig caps tool result size before it enters model context.

type ToolOutputPerToolCaps

type ToolOutputPerToolCaps struct {
	MaxBytes int `json:"max_bytes,omitempty"`
	MaxLines int `json:"max_lines,omitempty"`
}

ToolOutputPerToolCaps overrides global tool-output limits for one tool.

type ToolsConfig

type ToolsConfig struct {
	Disable []string `json:"disable,omitempty"`
}

ToolsConfig configures the bundled CLI's built-in tool suite.

Disable lists tools to turn off. Names must match the canonical built-in names (see tools.BuiltinToolNames). Unknown names cause a startup error from tools.BuiltinTools.Disable, so typos fail loudly rather than silently leaving a tool on.

The CLI's --disable-tools flag composes with this list by union; --no-builtin-tools disables the entire suite and makes Disable moot.

type UIConfig

type UIConfig struct {
	// Theme picks the rendering style for the core-tui surface.
	// Three reserved buckets:
	//   - "auto"  (default) — detect via terminal background query.
	//   - "dark"            — force dark theme; skips the OSC-11 query.
	//   - "light"           — force light theme; skips the OSC-11 query.
	// Any other lowercase identifier (letters, digits, dash,
	// underscore) is treated as a named theme from core-tui's
	// BuiltinThemes registry (e.g. "gopher", "google"). The /theme
	// picker writes back through PersistThemeChoice using these
	// names, so the field round-trips picker choices. Unknown
	// names fall back to the auto path at launch.
	Theme string `json:"theme,omitempty"`

	// Mouse enables terminal mouse capture so the wheel scrolls the
	// chat viewport. When enabled, plain click-drag no longer selects
	// text — terminals route around the capture when Shift is held
	// (Shift-drag to select, copy as usual). Pointer so unset means
	// "use the default" (true). Toggle at runtime with /mouse.
	Mouse *bool `json:"mouse,omitempty"`
}

UIConfig holds presentation choices for the in-process TUI (both internal/tui and the core-tui adapter). Both fields are optional with sensible defaults — operators only need to set what they want to override.

func (UIConfig) MouseEnabled

func (u UIConfig) MouseEnabled() bool

MouseEnabled reports whether mouse capture should be on at startup. Defaults to true when the field is unset.

type URLScopeConfig

type URLScopeConfig struct {
	Allow          []string                     `json:"allow,omitempty"`
	Deny           []string                     `json:"deny,omitempty"`
	MaxBodyBytes   int                          `json:"max_body_bytes,omitempty"`
	TimeoutSeconds int                          `json:"timeout_seconds,omitempty"`
	Headers        map[string]map[string]string `json:"headers,omitempty"`
}

URLScopeConfig governs which URLs the fetch_url built-in is allowed to reach. Same Allow/Deny grammar + precedence as PathScopeConfig: Deny wins on overlap; an empty Allow list with the tool registered is treated as default-deny (the tool refuses every fetch and returns a clear error pointing at this config field).

Patterns are host-only globs (e.g. "github.com", "*.googleapis.com", "*.svc.cluster.local"). HTTPS is assumed unless the pattern is prefixed with "http://", in which case plain HTTP is allowed for that pattern only (intentionally awkward — operators have to type the prefix to opt out of TLS).

MaxBodyBytes caps the response body the tool returns to the model; zero means use the built-in default (64 KiB). TimeoutSeconds caps the HTTP timeout; zero means 30s.

Headers maps host patterns to header bundles. Header values pass through os.ExpandEnv at request time, so values like "Bearer ${GITHUB_TOKEN}" pick up rotated env vars without a restart. The model never sets headers directly — keeps credential exfiltration off the tool argument surface.

type VertexConfig

type VertexConfig struct {
	Project  string `json:"project"`
	Location string `json:"location"`

	// ContextCache toggles Vertex explicit context caching for the
	// stable request prefix (system instruction + tools). When nil
	// or Enabled != false, caching is ON — the daemon creates a
	// CachedContent resource on the first turn and stamps it onto
	// every subsequent turn's GenerateContentConfig.CachedContent.
	// See docs/vertex-context-caching-design.md and
	// internal/vertexcache/manager.go.
	ContextCache *ContextCacheConfig `json:"context_cache,omitempty"`
}

VertexConfig holds GCP-specific settings for the vertex provider.

Jump to

Keyboard shortcuts

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