agentconfig

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AgentTypeGenericACP is the type for custom ACP CLI executables.
	AgentTypeGenericACP = "generic_acp"

	// AgentTypeGeminiACP is the alias for Gemini CLI ACP mode.
	AgentTypeGeminiACP = "gemini_acp"
	// AgentTypeCodexACP is the alias for Codex ACP bridge mode.
	AgentTypeCodexACP = "codex_acp"
	// AgentTypeOpenCodeACP is the alias for OpenCode CLI ACP mode.
	AgentTypeOpenCodeACP = "opencode_acp"
	// AgentTypeCopilotACP is the alias for Copilot CLI ACP mode.
	AgentTypeCopilotACP = "copilot_acp"
	// AgentTypeClaudeCodeACP is the alias for Claude Code ACP mode.
	AgentTypeClaudeCodeACP = "claude_code_acp"
	// AgentTypeOpenAI is the type for local OpenAI-backed providers.
	AgentTypeOpenAI = "openai"
	// AgentTypeAIStudio is the type for local Google AI Studio-backed providers.
	AgentTypeAIStudio = "aistudio"
	// AgentTypePool is the pool type with ordered failover.
	AgentTypePool = "pool"
)

Variables

This section is empty.

Functions

func IsACPType

func IsACPType(agentType string) bool

IsACPType reports whether an agent type uses the ACP runtime.

func IsPlannerSupportedType

func IsPlannerSupportedType(agentType string) bool

IsPlannerSupportedType reports whether planner mode supports the agent type.

func IsPoolType

func IsPoolType(agentType string) bool

IsPoolType reports whether an agent type is a pool.

func IsValidAgentType

func IsValidAgentType(agentType string) bool

IsValidAgentType reports whether the given type is a valid agent type.

func IsValidMCPServerType

func IsValidMCPServerType(serverType MCPServerType) bool

IsValidMCPServerType reports whether the given type is a valid MCP server type.

func NormalizeACPConfigs

func NormalizeACPConfigs(cfgs map[string]Config, executablePath string) (map[string]ResolvedConfig, error)

NormalizeACPConfigs is kept for compatibility and delegates to NormalizeConfigs.

func NormalizeConfigs

func NormalizeConfigs(cfgs map[string]Config, executablePath string) (map[string]ResolvedConfig, error)

NormalizeConfigs canonicalizes agent configs for a map of named config blocks.

func SupportedAgentTypes

func SupportedAgentTypes() []string

SupportedAgentTypes returns all supported agent types.

func ValidateMCPServerConfig

func ValidateMCPServerConfig(cfg MCPServerConfig) error

ValidateMCPServerConfig validates an MCP server configuration.

Types

type ACPConfig

type ACPConfig struct {
	Cmd       []string `json:"cmd,omitempty"        yaml:"cmd,omitempty"        mapstructure:"cmd"        validate:"omitempty,dive,notblank"`
	ExtraArgs []string `json:"extra_args,omitempty" yaml:"extra_args,omitempty" mapstructure:"extra_args" validate:"omitempty,dive,notblank"`
	Model     string   `json:"model,omitempty"      yaml:"model,omitempty"      mapstructure:"model"      validate:"omitempty,notblank"`
	Mode      string   `json:"mode,omitempty"       yaml:"mode,omitempty"       mapstructure:"mode"       validate:"omitempty,notblank"`
}

ACPConfig is an ACP runtime configuration block used by generic and alias types.

type Config

type Config struct {
	Type               string   `` /* 244-byte string literal not displayed */
	MCPServers         []string `` /* 145-byte string literal not displayed */
	SystemInstructions string   `` /* 140-byte string literal not displayed */

	GenericACP    *ACPConfig      `json:"generic_acp,omitempty"     yaml:"generic_acp,omitempty"     mapstructure:"generic_acp"`
	GeminiACP     *ACPConfig      `json:"gemini_acp,omitempty"      yaml:"gemini_acp,omitempty"      mapstructure:"gemini_acp"`
	CodexACP      *ACPConfig      `json:"codex_acp,omitempty"       yaml:"codex_acp,omitempty"       mapstructure:"codex_acp"`
	OpenCodeACP   *ACPConfig      `json:"opencode_acp,omitempty"    yaml:"opencode_acp,omitempty"    mapstructure:"opencode_acp"`
	CopilotACP    *ACPConfig      `json:"copilot_acp,omitempty"     yaml:"copilot_acp,omitempty"     mapstructure:"copilot_acp"`
	ClaudeCodeACP *ACPConfig      `json:"claude_code_acp,omitempty" yaml:"claude_code_acp,omitempty" mapstructure:"claude_code_acp"`
	OpenAI        *LocalAPIConfig `json:"openai,omitempty"         yaml:"openai,omitempty"          mapstructure:"openai"`
	AIStudio      *LocalAPIConfig `json:"aistudio,omitempty"       yaml:"aistudio,omitempty"        mapstructure:"aistudio"`
	PoolConfig    *PoolConfig     `json:"pool,omitempty"           yaml:"pool,omitempty"            mapstructure:"pool"`
}

Config describes how to run an agent.

The schema is strict and discriminated by type:

type: <agent_type>
<agent_type>:
  ...type-specific config...

func (Config) Description

func (c Config) Description(name string) string

Description returns a human-readable description of the agent config. Format: "name: type=<type> model=<model> mode=<mode>" with missing parts omitted.

func (Config) Validate

func (c Config) Validate() error

Validate validates the agent configuration.

type LocalAPIConfig

type LocalAPIConfig struct {
	APIKey string `json:"api_key,omitempty" yaml:"api_key,omitempty" mapstructure:"api_key"`
	Model  string `json:"model,omitempty"   yaml:"model,omitempty"   mapstructure:"model"   validate:"omitempty,notblank"`
}

LocalAPIConfig is a local API-backed runtime configuration block.

type MCPServerConfig

type MCPServerConfig struct {
	Type       MCPServerType     `` /* 150-byte string literal not displayed */
	Cmd        []string          `` /* 127-byte string literal not displayed */
	Args       []string          `` /* 127-byte string literal not displayed */
	Env        map[string]string `json:"env,omitempty"         yaml:"env,omitempty"         mapstructure:"env"`
	WorkingDir string            `json:"working_dir,omitempty" yaml:"working_dir,omitempty" mapstructure:"working_dir"         validate:"omitempty,notblank"`
	URL        string            `json:"url,omitempty"         yaml:"url,omitempty"         mapstructure:"url"`
	Headers    map[string]string `json:"headers,omitempty"     yaml:"headers,omitempty"     mapstructure:"headers"`
}

MCPServerConfig describes how to connect to an MCP server.

type MCPServerType

type MCPServerType string

MCPServerType represents the transport type for an MCP server.

const (
	// MCPServerTypeStdio is the stdio transport type.
	MCPServerTypeStdio MCPServerType = "stdio"
	// MCPServerTypeHTTP is the HTTP transport type.
	MCPServerTypeHTTP MCPServerType = "http"
	// MCPServerTypeSSE is the SSE (Server-Sent Events) transport type.
	MCPServerTypeSSE MCPServerType = "sse"
)

func SupportedMCPServerTypes

func SupportedMCPServerTypes() []MCPServerType

SupportedMCPServerTypes returns all supported MCP server types.

type PoolConfig

type PoolConfig struct {
	Members []string `json:"members,omitempty" yaml:"members,omitempty" mapstructure:"members" validate:"omitempty,dive,notblank"`
}

PoolConfig is the pool runtime configuration block.

type ResolvedConfig

type ResolvedConfig struct {
	Type               string
	MCPServers         []string
	SystemInstructions string

	Command     []string
	APIKey      string
	Model       string
	Mode        string
	PoolMembers []string
}

ResolvedConfig is a runtime-ready agent configuration produced from Config normalization.

func NormalizeACPConfig

func NormalizeACPConfig(cfg Config, executablePath string) (ResolvedConfig, error)

NormalizeACPConfig is kept for compatibility and delegates to NormalizeConfig.

func NormalizeConfig

func NormalizeConfig(cfg Config, executablePath string) (ResolvedConfig, error)

NormalizeConfig canonicalizes aliases and returns a runtime-ready configuration.

func (ResolvedConfig) Description

func (c ResolvedConfig) Description(name string) string

Description returns a human-readable description of the resolved runtime config.

Jump to

Keyboard shortcuts

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