Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyConnectionEnv(env map[string]string, baseURL, apiKey string)
- func BuildCCProfileOverrides(desired ClaudeCodePrefs, defaultMode string, keys []string) (*typ.ClaudeCodeProfileConfig, error)
- func BuildCCProfileSettings(profileID, scenarioPath, profileName string, env map[string]string, ...) (string, error)
- func BuildClaudeCodeModelConfig(cfg *serverconfig.Config) aiagent.ClaudeCodeModelConfig
- func BuildOpenCodeConfig(configBaseURL, apiKey string, models map[string]interface{}) map[string]interface{}
- func BuildOpenCodeModels(names []string) map[string]interface{}
- func CCProfileSettingsPath(profileID, profileName string) (string, error)
- func ClaudeCodeSlotModels(cfg *serverconfig.Config, scenarioPath string, isProfile bool) (models map[string]string, context1M bool)
- func CollectCodexModels(rules []string) []string
- func DiffCCProfileConfig(base ClaudeCodePrefs, inheritedDefaultMode string, desired ClaudeCodePrefs, ...) (*typ.ClaudeCodeProfileConfig, error)
- func GenerateCCEnv(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, isProfile bool) map[string]string
- func GenerateRoutingEnv(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, isProfile bool) map[string]string
- func InspectCCProfileSettings(profileID, profileName string) (string, bool, error)
- func MCPServerName(p typ.MCPProfile) string
- func MaterializeCCProfileMCPConfig(cfg *serverconfig.Config, baseURL string, profile typ.ProfileMeta) (string, error)
- func MaterializeCCProfileSettings(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, ...) (string, error)
- func NormalizeClaudeCodeCoAuthoredBy(v *bool) bool
- func NormalizeClaudeCodeDefaultMode(mode string) (string, bool)
- func NormalizeClaudeCodeShowThinkingSummaries(v *bool) bool
- func OmitFollowedDefaultModel(env map[string]string)
- func ReadClaudeCodeSettingsEnv(path string) (map[string]string, error)
- func RemoveCCProfileArtifacts(profileID, profileName string) error
- func RemoveRenamedCCProfileArtifacts(profileID, oldName, newName string) error
- type AgentApply
- type AgentConfigPreset
- type AgentConfigRequest
- type AgentInfo
- type AgentType
- type ApplyAgentRequest
- type ApplyAgentResult
- type CCProfileSettingsResolution
- type ClaudeCodePrefs
- type ClaudeCodeSettingsSnapshot
- type ClaudeCodeTier
- type ClaudeCodeTiers
- type ResolvedAgentConfig
- type RestoreAgentRequest
- type RestoreAgentResult
Constants ¶
const ( EnvClaudeCodeAutoModeServer = "CLAUDE_CODE_AUTO_MODE_SERVER" DefaultClaudeCodeAutoModeServer = "0" )
EnvClaudeCodeAutoModeServer asks Claude Code to have the server review auto-mode actions inside its own model requests. tb's gateway can't pass that review through (see .design/claude-code.md), so "0" is the default: classifier calls then go through the gateway like any other request and the "session isn't eligible" notice stays away. The user's choice (the ClaudeCodePrefs field, Extra, a profile) wins; "1" turns the review back on.
const ( // AgentTypeClaudeCode represents Claude Code agent AgentTypeClaudeCode = aiagent.AgentTypeClaudeCode // AgentTypeOpenCode represents OpenCode IDE extension AgentTypeOpenCode = aiagent.AgentTypeOpenCode // AgentTypeCodex represents the OpenAI Codex CLI AgentTypeCodex = aiagent.AgentTypeCodex // AgentTypeDsh represents the DeepSeek Harness CLI AgentTypeDsh = aiagent.AgentTypeDsh )
Re-export constants for backward compatibility
const DefaultClaudeCodeCoAuthoredBy = false
DefaultClaudeCodeCoAuthoredBy is Tingly's default for crediting Claude in commits and PRs. Unlike Claude Code's own default (on), tb leaves the Co-Authored-By trailer out unless the user turns it on.
const DefaultClaudeCodeDefaultMode = "auto"
const DefaultClaudeCodeShowThinkingSummaries = true
DefaultClaudeCodeShowThinkingSummaries mirrors Claude Code's own built-in default for the top-level showThinkingSummaries setting.
Variables ¶
var ( // ParseAgentType parses an agent type string, supporting aliases ParseAgentType = aiagent.ParseAgentType // ListAgentInfo returns information about all supported agent types ListAgentInfo = aiagent.ListAgentInfo // GetAgentInfo returns information about a specific agent type GetAgentInfo = aiagent.GetAgentInfo )
Re-export functions for backward compatibility
var ClaudeCodeRequestModels = []string{
"cc",
"haiku",
"sonnet",
"opus",
"subagent",
"fable",
}
ClaudeCodeRequestModels defines all request models for Claude Code scenario When applying claude-code agent, all these rules should be updated for convenience
var ClaudeCodeTierAliases = []string{"opus", "sonnet", "haiku", "fable"}
ClaudeCodeTierAliases are the --model aliases Claude Code maps to a tier env var. The default tier ("", no --model) is ANTHROPIC_MODEL.
var CodexRequestModels = []string{
"tingly-codex",
}
CodexRequestModels defines the default request models for the Codex scenario. Users typically add additional rules with their own request_model names; this list only seeds the default rule when none exists yet.
var DshRequestModels = []string{
"tingly-dsh",
}
DshRequestModels defines the default request models for the dsh scenario. Users typically add additional rules with their own request_model names; this list only seeds the default rule when none exists yet.
var OpenCodeRequestModels = []string{
"tingly-opencode",
}
OpenCodeRequestModels defines all request models for OpenCode scenario
Functions ¶
func ApplyConnectionEnv ¶ added in v1.261203.1
ApplyConnectionEnv sets the server-owned connection values on an already resolved env map, in place: the gateway base URL and model token (the claude_code scenario), and the loopback hosts added to NO_PROXY. It is the one place a Claude Code launch env gets its routing, shared by the typed preference path (ToEnv), the connection-default launch and the profile resolver, so the same rules apply however the env was assembled.
func BuildCCProfileOverrides ¶ added in v1.261126.1
func BuildCCProfileOverrides(desired ClaudeCodePrefs, defaultMode string, keys []string) (*typ.ClaudeCodeProfileConfig, error)
BuildCCProfileOverrides stores selected values and explicit unsets regardless of the current base settings.
func BuildCCProfileSettings ¶ added in v0.260625.1
func BuildCCProfileSettings(profileID, scenarioPath, profileName string, env map[string]string, opts ...serverconfig.ApplyOption) (string, error)
BuildCCProfileSettings materializes one derived Claude Code profile under ~/.tingly-box/claude/. The local/default profile lives at default/, while a named profile lives at <profileID>--<profileName>/ so both its stable identity and human name are visible without aliases or platform-specific links.
Config remains the source of truth. The directory contains only rebuildable runtime artifacts: settings.json and its statusline.sh wrapper.
func BuildClaudeCodeModelConfig ¶ added in v0.260514.1
func BuildClaudeCodeModelConfig(cfg *serverconfig.Config) aiagent.ClaudeCodeModelConfig
BuildClaudeCodeModelConfig constructs the model configuration for Claude Code: every slot uses the default model except the ones with a rule of their own (config.SetClaudeCodeSlot). Exported for use by HTTP handlers.
func BuildOpenCodeConfig ¶ added in v0.260514.1
func BuildOpenCodeConfig(configBaseURL, apiKey string, models map[string]interface{}) map[string]interface{}
BuildOpenCodeConfig constructs the OpenCode configuration object. This function contains the business logic for OpenCode config structure.
func BuildOpenCodeModels ¶ added in v0.260819.0
BuildOpenCodeModels builds the OpenCode provider "models" map from a list of request-model names, declaring each as attachment/vision-capable (see openCodeModelEntry). An empty list falls back to the single default model "tingly-opencode" so a fresh setup with no routing rules yet still gets a usable config.
func CCProfileSettingsPath ¶ added in v0.260723.1
CCProfileSettingsPath derives the canonical generated settings path from current profile metadata. The path is never persisted; callers recompute it so profile renames and legacy-name fallbacks cannot leave stale locations.
func ClaudeCodeSlotModels ¶ added in v1.261023.0
func ClaudeCodeSlotModels(cfg *serverconfig.Config, scenarioPath string, isProfile bool) (models map[string]string, context1M bool)
ClaudeCodeSlotModels resolves the model id Claude Code sends for each model slot, keyed by env var, and reports whether any of them carries the 1M context marker. It is the one place that maps the Claude Code rules onto the env, shared by the settings file (GenerateCCEnv) and the tbclient env.
scenarioPath is "claude_code" for the main scenario or "claude_code:p1" for a profile. isProfile=true → slot models resolved from profile-scoped built-in UUIDs; isProfile=false → resolved from main-scenario built-in UUIDs (with legacy-UUID fallback for pre-migration configs).
Reading the rule's request_model (instead of assuming the seeded name) keeps the env aligned when a user renames a rule's model; the seeded name is the fallback when the rule is missing or inactive.
func CollectCodexModels ¶ added in v0.260514.1
CollectCodexModels deduplicates and preserves order of model names. This helper processes routing rules to extract unique model names.
func DiffCCProfileConfig ¶ added in v0.260723.1
func DiffCCProfileConfig(base ClaudeCodePrefs, inheritedDefaultMode string, desired ClaudeCodePrefs, desiredDefaultMode string) (*typ.ClaudeCodeProfileConfig, error)
DiffCCProfileConfig keeps the full-configuration update semantics for callers that omit the explicit override selection.
func GenerateCCEnv ¶ added in v0.260625.1
func GenerateCCEnv(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, isProfile bool) map[string]string
GenerateCCEnv builds the env map for Claude Code settings.json; the model slots come from ClaudeCodeSlotModels, plus the historical canonical defaults for the synthetic main profile.
func GenerateRoutingEnv ¶ added in v1.261203.1
func GenerateRoutingEnv(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, isProfile bool) map[string]string
GenerateRoutingEnv builds only the parts of the env tingly-box owns: the scenario-aware gateway URL, the model slot, and the 1M-context auto-compact window. It never adds the canonical preference defaults, so a caller that layers the user's own settings (the resolver) can do so without the defaults overriding them.
func InspectCCProfileSettings ¶ added in v0.260723.1
InspectCCProfileSettings derives the canonical path and reports whether the generated settings file currently exists as a regular file.
func MCPServerName ¶ added in v1.261126.1
func MCPServerName(p typ.MCPProfile) string
MCPServerName is the name an MCP profile is registered under in an agent: "tb" for Default, "tb-<slug of the name>" otherwise. It matches the copy command on the MCP profile page (profileServerName), so a manual registration and a generated one are the same server, not two.
func MaterializeCCProfileMCPConfig ¶ added in v1.261126.1
func MaterializeCCProfileMCPConfig(cfg *serverconfig.Config, baseURL string, profile typ.ProfileMeta) (string, error)
MaterializeCCProfileMCPConfig writes the --mcp-config file that connects a Claude Code profile's launches to the MCP profile it names, and returns its path. It returns "" and removes a stale file when there is nothing to connect: the profile names no MCP profile (the user has not configured one), MCP is off, or the MCP profile is gone or switched off. The server is an ordinary MCP server for Claude Code: its own permissions decide each call, so no permission rule is written.
func MaterializeCCProfileSettings ¶ added in v0.260723.1
func MaterializeCCProfileSettings(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, profile typ.ProfileMeta) (string, error)
MaterializeCCProfileSettings resolves and writes one named profile using its persisted override delta. It is the shared path for HTTP mutations and CLI launch, preventing either surface from generating a different artifact.
func NormalizeClaudeCodeCoAuthoredBy ¶ added in v1.261022.2
NormalizeClaudeCodeCoAuthoredBy applies the Tingly default (off) when the settings file has never said, and passes an explicit value through.
func NormalizeClaudeCodeDefaultMode ¶ added in v0.260723.1
NormalizeClaudeCodeDefaultMode applies the Tingly default for an empty value and rejects values Claude Code does not recognize.
func NormalizeClaudeCodeShowThinkingSummaries ¶ added in v0.260819.0
NormalizeClaudeCodeShowThinkingSummaries applies the Tingly default when the setting has never been written (nil), and passes an explicit value through unchanged.
func OmitFollowedDefaultModel ¶ added in v1.261026.0
OmitFollowedDefaultModel drops ANTHROPIC_MODEL from a Claude Code env when the sonnet slot asks for the same model. Claude Code's /model picker only ticks "Default" when no model is set; with ANTHROPIC_MODEL=cc it ticks the first tier that resolves to cc (Sonnet) instead. Without ANTHROPIC_MODEL the default model is the sonnet tier, which is the same model, so nothing is lost. A split sonnet slot keeps ANTHROPIC_MODEL: Default must stay the main rule there, and the picker shows it as the custom model.
func ReadClaudeCodeSettingsEnv ¶ added in v1.261001.1
ReadClaudeCodeSettingsEnv returns the env block of a Claude Code settings file (a profile's materialized settings.json).
func RemoveCCProfileArtifacts ¶ added in v0.260716.1
RemoveCCProfileArtifacts removes only files generated by Tingly-Box for the selected profile. If users added anything else to the directory, it is left in place rather than recursively deleted.
func RemoveRenamedCCProfileArtifacts ¶ added in v0.260716.1
RemoveRenamedCCProfileArtifacts removes the old derived directory after the new one has been materialized. os.SameFile protects case-only renames on case-insensitive filesystems, where both spellings identify the same path.
Types ¶
type AgentApply ¶
type AgentApply struct {
// contains filtered or unexported fields
}
AgentApply handles agent configuration with routing rules (Tingly-Box specific)
func NewAgentApply ¶
func NewAgentApply(cfg *serverconfig.Config, host string) *AgentApply
NewAgentApply creates a new AgentApply instance
func (*AgentApply) ApplyAgent ¶
func (aa *AgentApply) ApplyAgent(req *ApplyAgentRequest) (*ApplyAgentResult, error)
ApplyAgent applies configuration including routing rules This is the main entry point for Tingly-Box agent configuration
func (*AgentApply) RestoreAgent ¶ added in v0.260507.1
func (aa *AgentApply) RestoreAgent(req *RestoreAgentRequest) (*RestoreAgentResult, error)
RestoreAgent restores configuration files from backup
type AgentConfigPreset ¶ added in v1.261203.1
type AgentConfigPreset int
AgentConfigPreset selects which layers ResolveAgentConfig reads. The composition order is the same for every preset; the preset only decides which sources participate. This is the single pipeline behind the CLI (`tingly-box cc`), Projects threads, folder sessions and the coordinator.
See .design/agent-config-ssot.md.
const ( // AgentConfigCLIDefault is `tingly-box cc` with no named profile. It keeps // Claude Code's own preference defaults and only injects tb's routing and // the historical canonical switches; it does not layer the user's settings // env (the CLI reads that file itself). AgentConfigCLIDefault AgentConfigPreset = iota // AgentConfigProjectDefault is a Projects thread, folder session or // coordinator with no named profile. A sandboxed thread cannot read // ~/.claude/settings.json, so the launch env must carry it: tb's canonical // defaults, then the user's settings env key-for-key, then routing. This // preserves PR #2841's behaviour. AgentConfigProjectDefault // AgentConfigProfile is a named Claude Code profile: the user's settings // env (or tb's defaults when the file is absent), routing, then the // profile's stored overrides. AgentConfigProfile )
type AgentConfigRequest ¶ added in v1.261203.1
type AgentConfigRequest struct {
Preset AgentConfigPreset
ScenarioPath string
Profile *typ.ProfileMeta
BaseURL string
APIKey string
}
AgentConfigRequest is the input to the resolver. ScenarioPath is "claude_code" or "claude_code:<profileID>"; Profile is required for AgentConfigProfile.
type ApplyAgentRequest ¶
type ApplyAgentRequest = aiagent.ApplyAgentRequest
ApplyAgentRequest represents a request to apply agent configuration
type ApplyAgentResult ¶
type ApplyAgentResult = aiagent.ApplyAgentResult
ApplyAgentResult represents the result of applying agent configuration
type CCProfileSettingsResolution ¶ added in v0.260723.1
type CCProfileSettingsResolution struct {
BasePreferences ClaudeCodePrefs
EffectivePreferences ClaudeCodePrefs
InheritedDefaultMode string
EffectiveDefaultMode string
Env map[string]string
OverrideKeys []string
HasOverrides bool
}
CCProfileSettingsResolution contains both the inherited profile base and the effective result after persistent overrides. Env includes server-owned keys and is ready to materialize; the preference fields are safe for API output.
func ResolveCCProfileSettings ¶ added in v0.260723.1
func ResolveCCProfileSettings(cfg *serverconfig.Config, baseURL, apiKey, scenarioPath string, profile typ.ProfileMeta) (CCProfileSettingsResolution, error)
ResolveCCProfileSettings composes main settings, rule-derived profile model slots, stored runtime overrides, and protected connection values in that order. Legacy stored model-slot overrides are ignored. It is a thin view over ResolveAgentConfig (AgentConfigProfile), the single resolution pipeline.
type ClaudeCodePrefs ¶ added in v0.260531.1
type ClaudeCodePrefs struct {
// Model routing
AnthropicModel string `json:"ANTHROPIC_MODEL,omitempty"`
AnthropicDefaultHaikuModel string `json:"ANTHROPIC_DEFAULT_HAIKU_MODEL,omitempty"`
AnthropicDefaultSonnetModel string `json:"ANTHROPIC_DEFAULT_SONNET_MODEL,omitempty"`
AnthropicDefaultOpusModel string `json:"ANTHROPIC_DEFAULT_OPUS_MODEL,omitempty"`
AnthropicDefaultFableModel string `json:"ANTHROPIC_DEFAULT_FABLE_MODEL,omitempty"`
ClaudeCodeSubagentModel string `json:"CLAUDE_CODE_SUBAGENT_MODEL,omitempty"`
// Limits — kept as strings so empty = omit (avoids the "0 means unset"
// ambiguity that a *int would force callers to deal with).
APITimeoutMs string `json:"API_TIMEOUT_MS,omitempty"`
ClaudeCodeMaxOutputTokens string `json:"CLAUDE_CODE_MAX_OUTPUT_TOKENS,omitempty"`
MaxThinkingTokens string `json:"MAX_THINKING_TOKENS,omitempty"`
BashDefaultTimeoutMs string `json:"BASH_DEFAULT_TIMEOUT_MS,omitempty"`
BashMaxTimeoutMs string `json:"BASH_MAX_TIMEOUT_MS,omitempty"`
McpTimeout string `json:"MCP_TIMEOUT,omitempty"`
McpToolTimeout string `json:"MCP_TOOL_TIMEOUT,omitempty"`
MaxMcpOutputTokens string `json:"MAX_MCP_OUTPUT_TOKENS,omitempty"`
// Subagent concurrency — how many subagents Claude Code runs at once and
// how it handles long-running or stalled background work. Names verified
// against the Claude Code 2.1.289 binary.
ClaudeCodeMaxConcurrentSubagents string `json:"CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS,omitempty"`
ClaudeCodeAutoBackgroundTimeoutMs string `json:"CLAUDE_CODE_AUTO_BACKGROUND_TIMEOUT_MS,omitempty"`
ClaudeAutoBackgroundTasks string `json:"CLAUDE_AUTO_BACKGROUND_TASKS,omitempty"`
ClaudeAsyncAgentStallTimeoutMs string `json:"CLAUDE_ASYNC_AGENT_STALL_TIMEOUT_MS,omitempty"`
// Auto-compact settings — control context window compaction
ClaudeCodeAutoCompactWindow string `json:"CLAUDE_CODE_AUTO_COMPACT_WINDOW,omitempty"`
ClaudeAutocompactPctOverride string `json:"CLAUDE_AUTOCOMPACT_PCT_OVERRIDE,omitempty"`
// Privacy / behavior switches — "1" to enable, "" to omit.
DisableTelemetry string `json:"DISABLE_TELEMETRY,omitempty"`
DisableErrorReporting string `json:"DISABLE_ERROR_REPORTING,omitempty"`
ClaudeCodeDisableNonessentialTraffic string `json:"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC,omitempty"`
DisableAutoupdater string `json:"DISABLE_AUTOUPDATER,omitempty"`
UseBuiltinRipgrep string `json:"USE_BUILTIN_RIPGREP,omitempty"`
// Auto mode's server-side classifier review — "1" to ask the server,
// "0" (tb's default, see EnvClaudeCodeAutoModeServer) to keep it off.
// Empty is filled with the default by ToEnv, not omitted.
ClaudeCodeAutoModeServer string `json:"CLAUDE_CODE_AUTO_MODE_SERVER,omitempty"`
// Network proxy. Backend accepts these; the current UI does not surface
// them (too niche for the form, and they overlap with system-level proxy
// settings managed elsewhere). Wire them up if/when a user asks.
HTTPProxy string `json:"HTTP_PROXY,omitempty"`
HTTPSProxy string `json:"HTTPS_PROXY,omitempty"`
NoProxy string `json:"NO_PROXY,omitempty"`
// Extra is an escape hatch for env vars not modeled above. Merged in
// after marshaling; values here override the typed fields if keys collide.
Extra map[string]string `json:"-"`
}
ClaudeCodePrefs is the user-tunable surface of Claude Code's env config. JSON tags map 1:1 to the env var names Claude Code reads, so marshaling produces exactly what should go under "env" in ~/.claude/settings.json. Empty fields are omitted — meaning "don't write this env, let Claude Code fall back to its own default".
func ClaudeCodePrefsFromEnv ¶ added in v0.260723.1
func ClaudeCodePrefsFromEnv(env map[string]string) (ClaudeCodePrefs, error)
ClaudeCodePrefsFromEnv selects the typed preference keys from an env map. Unknown and server-owned keys are ignored.
func DefaultClaudeCodePrefs ¶ added in v0.260531.1
func DefaultClaudeCodePrefs() ClaudeCodePrefs
DefaultClaudeCodePrefs returns tb's canonical defaults: every model slot on the default rule. Used by the CLI harness directly and as the seed value for the GUI quick-config form when no user customization exists yet.
func (ClaudeCodePrefs) ToEnv ¶ added in v0.260531.1
func (p ClaudeCodePrefs) ToEnv(baseURL, apiKey string) (map[string]string, error)
ToEnv materializes prefs into an env map ready to be written under "env" in settings.json. baseURL and apiKey are sourced from the server context (not from prefs) and are always injected.
type ClaudeCodeSettingsSnapshot ¶ added in v0.260723.1
type ClaudeCodeSettingsSnapshot struct {
Exists bool
Env map[string]string
DefaultMode string
StatusLine bool
ShowThinkingSummaries *bool
SkipWebFetchPreflight *bool
// CoAuthoredBy is whether Claude credits itself in commits; nil when the
// file sets neither attribution nor includeCoAuthoredBy.
CoAuthoredBy *bool
}
ClaudeCodeSettingsSnapshot is the relevant subset of a Claude Code settings file. Env may contain keys outside the typed preference surface; callers that expose data through the API must convert it with ClaudeCodePrefsFromEnv.
func ReadMainClaudeCodeSettings ¶ added in v0.260723.1
func ReadMainClaudeCodeSettings() (ClaudeCodeSettingsSnapshot, error)
ReadMainClaudeCodeSettings reads the user's source-of-truth settings file.
type ClaudeCodeTier ¶ added in v1.261001.1
ClaudeCodeTier is one model Claude Code can be asked for: the alias passed as --model ("" for the default) and the gateway model id it requests.
type ClaudeCodeTiers ¶ added in v1.261001.1
type ClaudeCodeTiers struct {
Unified bool
Tiers []ClaudeCodeTier
}
ClaudeCodeTiers is what a Claude Code env offers. Unified means every tier requests the same model; Tiers then holds just the default.
func ClaudeCodeTiersFromEnv ¶ added in v1.261001.1
func ClaudeCodeTiersFromEnv(env map[string]string) ClaudeCodeTiers
ClaudeCodeTiersFromEnv reads the tiers from the env Claude Code is given (GenerateCCEnv's output, the main env or a profile's settings file), so they are exactly what the process will request. The "[1m]" marker is dropped: Claude Code strips it before sending, so the gateway never sees it.
type ResolvedAgentConfig ¶ added in v1.261203.1
type ResolvedAgentConfig struct {
Env map[string]string
BaseEnv map[string]string
// PreferencesEnv is Env before the server-owned connection values are
// forced in, i.e. what the profile's typed preferences represent.
PreferencesEnv map[string]string
DefaultModel string
DefaultMode string
InheritedDefaultMode string
OverrideKeys []string
HasOverrides bool
}
ResolvedAgentConfig is the single output of the resolver. Env is the effective environment; BaseEnv is the pre-override env (profile preset only, for the API's base-vs-effective view). DefaultMode is "" when the preset leaves the user's settings-file mode untouched.
func MaterializeAgentConfig ¶ added in v1.261203.1
func MaterializeAgentConfig(cfg *serverconfig.Config, req AgentConfigRequest) (ResolvedAgentConfig, string, error)
MaterializeAgentConfig resolves and, where the preset has a settings file, writes it. It is the only writer: the CLI and Projects both call it (or BuildCCProfileSettings through it). AgentConfigProjectDefault writes nothing because its env is the carrier; the return path is "".
func ResolveAgentConfig ¶ added in v1.261203.1
func ResolveAgentConfig(cfg *serverconfig.Config, req AgentConfigRequest) (ResolvedAgentConfig, error)
ResolveAgentConfig is the one explicit resolution pipeline. Precedence, low to high:
canonical defaults < user's ~/.claude/settings.json < rule-derived model slots/routing < profile overrides (profile preset) < connection values
The connection values (gateway URL, token, NO_PROXY) always win so the launch reaches this server. Unknown env keys in the user's settings survive untouched (no whitelist).
func (ResolvedAgentConfig) EnvList ¶ added in v1.261203.1
func (r ResolvedAgentConfig) EnvList() []string
EnvList renders the resolved env as sorted KEY=VALUE entries, so callers that hand it to a process (and the launch signature) see a stable order.
type RestoreAgentRequest ¶ added in v0.260507.1
type RestoreAgentRequest = aiagent.RestoreAgentRequest
RestoreAgentRequest represents a request to restore agent configuration
type RestoreAgentResult ¶ added in v0.260507.1
type RestoreAgentResult = aiagent.RestoreAgentResult
RestoreAgentResult represents the result of restoring agent configuration