configapply

package
v1.261109.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MPL-2.0 Imports: 16 Imported by: 0 modules, 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

Index

Constants

View Source
const (
	ClientConfigNotApplied = "not_applied" // no file, or it doesn't route through this gateway
	ClientConfigApplied    = "applied"     // routes through this gateway with the expected values
	ClientConfigOutdated   = "outdated"    // routes through this gateway, but some values differ
)

Client config status: is the tool's config on this machine what the gateway would write now? Mode changes, 1M toggles and request-model renames all change the expected values without touching the file, so the Agent page shows this instead of a one-off "please reapply" toast (.design/agent-page-redesign.md §3.2).

View Source
const DefaultClaudeCodeDefaultMode = agent.DefaultClaudeCodeDefaultMode

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyClaudeConfigRequest added in v0.260531.1

type ApplyClaudeConfigRequest struct {
	InstallStatusLine bool                   `json:"installStatusLine,omitempty"`
	Preferences       *agent.ClaudeCodePrefs `json:"preferences"`
	DefaultMode       string                 `json:"defaultMode,omitempty"`
	// ShowThinkingSummaries controls the top-level showThinkingSummaries key in
	// settings.json. nil falls back to agent.DefaultClaudeCodeShowThinkingSummaries.
	ShowThinkingSummaries *bool `json:"showThinkingSummaries,omitempty"`
	// CoAuthoredBy controls both includeCoAuthoredBy and attribution in
	// settings.json. nil, or the value the file already has, leaves them as
	// written; a file that says nothing gets agent.DefaultClaudeCodeCoAuthoredBy
	// (off).
	CoAuthoredBy *bool `json:"coAuthoredBy,omitempty"`
}

ApplyClaudeConfigRequest is the request body for ApplyClaudeConfig.

`preferences` is the source of truth: each field's JSON tag is the Claude Code env var it controls, and ToEnv emits exactly the map written under "env" in ~/.claude/settings.json. `installStatusLine` is orthogonal — it just toggles the statusLine stanza in settings.json.

type ApplyCodexConfigRequest added in v0.260531.1

type ApplyCodexConfigRequest struct {
	Preferences  *config.CodexPrefs `json:"preferences"`
	WriteCatalog *bool              `json:"writeCatalog"`

	// AuthMode selects how ~/.codex/auth.json and the gateway credential are
	// wired:
	//   - "" / "apikey": gateway routing, key written to auth.json (OPENAI_API_KEY).
	//   - "chatgpt": no gateway; exports the OAuth tokens of OAuthProviderUUID
	//     to auth.json so codex CLI talks directly to OpenAI. tingly-box stops
	//     managing the tokens after apply — codex CLI owns refresh from then on.
	//   - "hybrid": gateway routing WITH the key kept in config.toml's provider
	//     stanza (experimental_bearer_token), leaving auth.json free to hold a
	//     native ChatGPT login so Codex App still sees the official account.
	AuthMode string `json:"authMode,omitempty"`

	// OAuthProviderUUID identifies the Codex OAuth provider whose tokens
	// should be exported to auth.json. Required when AuthMode == "chatgpt";
	// optional when "hybrid" (omit to leave any existing auth.json untouched).
	OAuthProviderUUID string `json:"oauthProviderUuid,omitempty"`
}

ApplyCodexConfigRequest is the request body for the Codex apply and preview endpoints. `preferences` is the typed, whitelisted set of Codex config.toml keys (see config.CodexPrefs). nil means "use built-in defaults". `writeCatalog` controls whether ~/.codex/tingly-model-catalog.json is written and model_catalog_json is set in config.toml. nil defaults to true.

type ApplyCodexConfigResponse added in v0.260514.1

type ApplyCodexConfigResponse struct {
	Success        bool               `json:"success"`
	ConfigResult   config.ApplyResult `json:"configResult"`
	AuthResult     config.ApplyResult `json:"authResult"`
	CatalogWritten bool               `json:"catalogWritten"`
	Models         []string           `json:"models"`
	Message        string             `json:"message,omitempty"`
}

ApplyCodexConfigResponse is the response for ApplyCodexConfigFromState.

type ApplyConfigResponse

type ApplyConfigResponse struct {
	Success          bool               `json:"success"`
	SettingsResult   config.ApplyResult `json:"settingsResult"`
	OnboardingResult config.ApplyResult `json:"onboardingResult"`
	CreatedFiles     []string           `json:"createdFiles"`
	UpdatedFiles     []string           `json:"updatedFiles"`
	BackupPaths      []string           `json:"backupPaths"`
}

ApplyConfigResponse is the response for ApplyClaudeConfig

type ApplyDshConfigRequest added in v0.260819.0

type ApplyDshConfigRequest struct {
	Preferences *config.DshPrefs `json:"preferences"`
}

ApplyDshConfigRequest is the request body for the DeepSeek Harness (dsh) apply and preview endpoints. `preferences` is the typed, whitelisted set of settings.yaml provider-stanza keys (see config.DshPrefs). nil means "use built-in defaults".

type ApplyDshConfigResponse added in v0.260819.0

type ApplyDshConfigResponse struct {
	Success           bool               `json:"success"`
	SettingsResult    config.ApplyResult `json:"settingsResult"`
	CredentialsResult config.ApplyResult `json:"credentialsResult"`
	Models            []string           `json:"models"`
	Message           string             `json:"message,omitempty"`
}

ApplyDshConfigResponse is the response for ApplyDshConfigFromState.

type ApplyOpenCodeConfigResponse

type ApplyOpenCodeConfigResponse struct {
	config.ApplyResult
}

ApplyOpenCodeConfigResponse is the response for ApplyOpenCodeConfigFromState

type ApplyWorkBuddyConfigResponse added in v1.261022.1

type ApplyWorkBuddyConfigResponse struct {
	config.WorkBuddyApplyResult
}

ApplyWorkBuddyConfigResponse is the response for ApplyWorkBuddyConfigFromState.

type ClaudeCodeEnvResponse added in v0.260903.1

type ClaudeCodeEnvResponse struct {
	Success bool     `json:"success"`
	Env     []string `json:"env,omitempty"`
	Error   string   `json:"error,omitempty"`
}

ClaudeCodeEnvResponse returns the gateway-routing environment variables for the Claude Code CLI (ANTHROPIC_BASE_URL, model tiers, etc.).

type ClaudeConfigResponse added in v0.260723.1

type ClaudeConfigResponse struct {
	Success               bool                  `json:"success"`
	Exists                bool                  `json:"exists"`
	Preferences           agent.ClaudeCodePrefs `json:"preferences"`
	DefaultMode           string                `json:"defaultMode"`
	InstallStatusLine     bool                  `json:"installStatusLine"`
	ShowThinkingSummaries bool                  `json:"showThinkingSummaries"`
	CoAuthoredBy          bool                  `json:"coAuthoredBy"`
}

ClaudeConfigResponse returns the typed values currently persisted in the user's main ~/.claude/settings.json so the frontend can restore Apply state.

type ClientConfigDifference added in v1.261001.1

type ClientConfigDifference struct {
	Key      string `json:"key"`
	Applied  string `json:"applied"`
	Expected string `json:"expected"`
}

ClientConfigDifference is one value that differs from what would be applied now.

type ClientConfigStatusResponse added in v1.261001.1

type ClientConfigStatusResponse struct {
	Success     bool                     `json:"success"`
	State       string                   `json:"state" example:"outdated"`
	Path        string                   `json:"path,omitempty" example:"~/.claude/settings.json"`
	Differences []ClientConfigDifference `json:"differences"`
	Error       string                   `json:"error,omitempty"`
}

ClientConfigStatusResponse reports how a tool's on-disk config relates to the gateway's current state.

type CodexConfigPreviewResponse added in v0.260514.1

type CodexConfigPreviewResponse struct {
	Success     bool     `json:"success"`
	ConfigToml  string   `json:"configToml"`
	AuthJson    string   `json:"authJson"`
	CatalogJson string   `json:"catalogJson,omitempty"`
	Models      []string `json:"models"`
	Message     string   `json:"message,omitempty"`
}

CodexConfigPreviewResponse is the response for GetCodexConfigPreview.

type CodexConfigResponse added in v0.260801.1

type CodexConfigResponse struct {
	Success      bool              `json:"success"`
	Exists       bool              `json:"exists"`
	Preferences  config.CodexPrefs `json:"preferences"`
	WriteCatalog bool              `json:"writeCatalog"`
}

CodexConfigResponse returns the typed values currently persisted in the user's ~/.codex/config.toml so the frontend can restore Apply state on reopen. Routing/auth-owned fields (model, model_provider, the gateway token) are NOT returned — same safety stance as ClaudeConfigResponse. writeCatalog is inferred from the presence of model_catalog_json in config.toml.

type DshConfigPreviewResponse added in v0.260819.0

type DshConfigPreviewResponse struct {
	Success         bool     `json:"success"`
	SettingsYaml    string   `json:"settingsYaml"`
	CredentialsYaml string   `json:"credentialsYaml"`
	Models          []string `json:"models"`
	Message         string   `json:"message,omitempty"`
}

DshConfigPreviewResponse is the response for GetDshConfigPreview.

type DshConfigResponse added in v0.260819.0

type DshConfigResponse struct {
	Success     bool            `json:"success"`
	Exists      bool            `json:"exists"`
	Preferences config.DshPrefs `json:"preferences"`
}

DshConfigResponse returns the typed values currently persisted in the user's $DSH_HOME/settings.yaml so the frontend can restore Apply state on reopen. Routing/auth-owned fields (models, baseURL, the gateway token) are NOT returned — same safety stance as CodexConfigResponse.

type HTTPTransportConfigUpdate added in v0.260409.1540

type HTTPTransportConfigUpdate struct {
	RespectEnvProxy *bool   `json:"respect_env_proxy"` // nil = no change
	GlobalProxyURL  *string `json:"global_proxy_url"`  // nil = no change; "" = clear
}

HTTPTransportConfigUpdate represents the update request for HTTP transport settings

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler handles config apply HTTP requests

func NewHandler

func NewHandler(cfg *config.Config, host string) *Handler

NewHandler creates a new configapply handler

func (*Handler) ApplyClaudeConfig

func (h *Handler) ApplyClaudeConfig(c *gin.Context)

ApplyClaudeConfig generates and applies Claude Code configuration from system state

func (*Handler) ApplyCodexConfigFromState added in v0.260514.1

func (h *Handler) ApplyCodexConfigFromState(c *gin.Context)

ApplyCodexConfigFromState applies the Codex CLI configuration derived from the active Codex scenario rules. Mirrors the OpenCode endpoint: it does NOT touch routing rules — those are managed via the rules UI.

func (*Handler) ApplyDshConfigFromState added in v0.260819.0

func (h *Handler) ApplyDshConfigFromState(c *gin.Context)

ApplyDshConfigFromState applies the DeepSeek Harness (dsh) configuration derived from the active dsh scenario rules. Mirrors the Codex endpoint: it does NOT touch routing rules — those are managed via the rules UI.

func (*Handler) ApplyOpenCodeConfigFromState

func (h *Handler) ApplyOpenCodeConfigFromState(c *gin.Context)

ApplyOpenCodeConfig generates and applies OpenCode configuration from system state

func (*Handler) ApplyWorkBuddyConfigFromState added in v1.261022.1

func (h *Handler) ApplyWorkBuddyConfigFromState(c *gin.Context)

ApplyWorkBuddyConfigFromState writes the active WorkBuddy-scenario rules into the models.json of every installed WorkBuddy edition. Like the other agents it does NOT touch routing rules, and unlike OpenCode it does not invent a default model: with no rules there is nothing to write, which is reported instead of creating a phantom entry.

func (*Handler) GetClaudeCodeEnv added in v0.260903.1

func (h *Handler) GetClaudeCodeEnv(c *gin.Context)

GetClaudeCodeEnv returns the gateway-routing environment variables for the Claude Code CLI (ANTHROPIC_BASE_URL, model tiers, etc.) as KEY=VALUE strings.

func (*Handler) GetClaudeConfig added in v0.260723.1

func (h *Handler) GetClaudeConfig(c *gin.Context)

GetClaudeConfig reads the values previously applied to the user's main Claude Code settings so reopening the editor restores durable state.

func (*Handler) GetClaudeConfigStatus added in v1.261001.1

func (h *Handler) GetClaudeConfigStatus(c *gin.Context)

GetClaudeConfigStatus compares ~/.claude/settings.json with what Auto Config would write for the current mode and rules.

func (*Handler) GetCodexConfig added in v0.260801.1

func (h *Handler) GetCodexConfig(c *gin.Context)

GetCodexConfig reads the values previously applied to the user's ~/.codex/config.toml so reopening the editor restores durable state. Routing/auth fields are not returned (see CodexConfigResponse).

func (*Handler) GetCodexConfigPreview added in v0.260514.1

func (h *Handler) GetCodexConfigPreview(c *gin.Context)

GetCodexConfigPreview returns the TOML/JSON that ApplyCodexConfigFromState would write to a fresh file. The real apply still merges into any existing ~/.codex/config.toml; this preview just shows the managed slice.

func (*Handler) GetCodexConfigStatus added in v1.261001.1

func (h *Handler) GetCodexConfigStatus(c *gin.Context)

GetCodexConfigStatus compares ~/.codex (config.toml + the tingly model catalog) with the models and context windows the Codex rules produce now.

func (*Handler) GetConfig added in v0.260409.1540

func (h *Handler) GetConfig(c *gin.Context)

GetConfig returns the current system configuration Only returns settings that are safe to expose to the UI

func (*Handler) GetDshConfig added in v0.260819.0

func (h *Handler) GetDshConfig(c *gin.Context)

GetDshConfig reads the values previously applied to the user's $DSH_HOME/settings.yaml so reopening the editor restores durable state. Routing/auth fields are not returned (see DshConfigResponse).

func (*Handler) GetDshConfigPreview added in v0.260819.0

func (h *Handler) GetDshConfigPreview(c *gin.Context)

GetDshConfigPreview returns the YAML that ApplyDshConfigFromState would write to fresh files. The real apply still merges into any existing $DSH_HOME/settings.yaml / .credentials.yaml; this preview just shows the managed slice.

func (*Handler) GetDshConfigStatus added in v1.261001.1

func (h *Handler) GetDshConfigStatus(c *gin.Context)

GetDshConfigStatus compares $DSH_HOME/settings.yaml with the models the dsh rules produce now.

func (*Handler) GetOpenCodeConfigPreview

func (h *Handler) GetOpenCodeConfigPreview(c *gin.Context)

GetOpenCodeConfigPreview generates OpenCode configuration preview from system state This endpoint returns the config JSON for display purposes without applying it

func (*Handler) GetWorkBuddyConfigPreview added in v1.261022.1

func (h *Handler) GetWorkBuddyConfigPreview(c *gin.Context)

GetWorkBuddyConfigPreview returns the models.json entries Auto Config would write now, with the API key masked.

func (*Handler) GetWorkBuddyConfigStatus added in v1.261022.1

func (h *Handler) GetWorkBuddyConfigStatus(c *gin.Context)

GetWorkBuddyConfigStatus compares the installed editions' models.json with the models the WorkBuddy rules produce now.

func (*Handler) RegisterRoutes added in v1.261002.1

func (h *Handler) RegisterRoutes(rt *module.Routes)

func (*Handler) RestoreClaudeConfig added in v0.260507.1

func (h *Handler) RestoreClaudeConfig(c *gin.Context)

RestoreClaudeConfig rolls back Claude Code config files to their most recent backup. Mirrors the CLI 'agent restore claude-code' flow.

func (*Handler) RestoreCodexConfig added in v0.260514.1

func (h *Handler) RestoreCodexConfig(c *gin.Context)

RestoreCodexConfig rolls back Codex config files to their most recent backup.

func (*Handler) RestoreDshConfig added in v0.260819.0

func (h *Handler) RestoreDshConfig(c *gin.Context)

RestoreDshConfig rolls back dsh config files to their most recent backup.

func (*Handler) RestoreOpenCodeConfig added in v0.260507.1

func (h *Handler) RestoreOpenCodeConfig(c *gin.Context)

RestoreOpenCodeConfig rolls back OpenCode config files to their most recent backup. Mirrors the CLI 'agent restore opencode' flow.

func (*Handler) RestoreWorkBuddyConfig added in v1.261022.1

func (h *Handler) RestoreWorkBuddyConfig(c *gin.Context)

RestoreWorkBuddyConfig rolls each installed edition's models.json back to its most recent backup (the pre-restore state is itself backed up first).

func (*Handler) UpdateConfig added in v0.260409.1540

func (h *Handler) UpdateConfig(c *gin.Context)

UpdateConfig updates the system configuration Only allows updating specific safe fields

type OpenCodeConfigPreviewResponse

type OpenCodeConfigPreviewResponse struct {
	Success    bool   `json:"success"`
	ConfigJSON string `json:"configJson"`
	ScriptWin  string `json:"scriptWindows"`
	ScriptUnix string `json:"scriptUnix"`
	Message    string `json:"message,omitempty"`
}

OpenCodeConfigPreviewResponse is the response for GetOpenCodeConfigPreview

type RestoreConfigResponse added in v0.260507.1

type RestoreConfigResponse struct {
	Success           bool     `json:"success"`
	AgentType         string   `json:"agentType"`
	RestoredFiles     []string `json:"restoredFiles"`
	PreRestoreBackups []string `json:"preRestoreBackups"`
	Failures          []string `json:"failures,omitempty"`
	Message           string   `json:"message"`
}

RestoreConfigResponse is the response for the restore endpoints. It mirrors the agent.RestoreAgentResult so callers can drive UI from the same data the CLI prints.

type WorkBuddyConfigPreviewResponse added in v1.261022.1

type WorkBuddyConfigPreviewResponse struct {
	Success    bool     `json:"success"`
	ConfigJSON string   `json:"configJson"`
	Path       string   `json:"path,omitempty"`
	Models     []string `json:"models"`
	Message    string   `json:"message,omitempty"`
}

WorkBuddyConfigPreviewResponse is the response for GetWorkBuddyConfigPreview. ConfigJSON is the models.json content Auto Config would merge in, API key masked.

Jump to

Keyboard shortcuts

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