Documentation
¶
Index ¶
- Constants
- func CleanupExpiredEntries()
- func ClearCache()
- func ClearCacheEntry(key string)
- func ExampleAdvancedOptions()
- func ExampleBasicUsage()
- func ExampleConfigurationPreview()
- func ExampleErrorHandling()
- func ExampleExplicitSources()
- func ExampleMigrationFromOldAPI()
- func ExampleWithVariables()
- func GetCacheStats() map[string]int
- func LoadAgentAuto(ctx context.Context, agentName, environment string, options ...agent.Option) (*agent.Agent, error)deprecated
- func LoadAgentConfig(_ context.Context, agentName, environment string, options ...LoadOption) (*agent.AgentConfig, error)
- func LoadAgentFromLocal(ctx context.Context, agentName, environment string, options ...agent.Option) (*agent.Agent, error)
- func LoadAgentWithOptions(ctx context.Context, agentName, environment string, loadOptions []LoadOption, ...) (*agent.Agent, error)
- func LoadAgentWithVariables(ctx context.Context, agentName, environment string, ...) (*agent.Agent, error)
- func MergeAgentConfig(primary, base *agent.AgentConfig, strategy MergeStrategy) *agent.AgentConfig
- func PreviewAgentConfig(ctx context.Context, agentName, environment string) (*agent.AgentConfig, error)
- type ConfigSource
- type LoadOption
- type LoadOptions
- type MergeStrategy
Constants ¶
const ( // MergeStrategyRemotePriority is retained for source compatibility. // // Deprecated: remote configuration loading was removed; there is no remote // config to prioritise. Use MergeStrategyPrimaryPriority. MergeStrategyRemotePriority = MergeStrategyPrimaryPriority // MergeStrategyLocalPriority is retained for source compatibility. // // Deprecated: remote configuration loading was removed; both inputs to // MergeAgentConfig are now local. Use MergeStrategyBasePriority. MergeStrategyLocalPriority = MergeStrategyBasePriority )
Variables ¶
This section is empty.
Functions ¶
func CleanupExpiredEntries ¶ added in v0.2.10
func CleanupExpiredEntries()
CleanupExpiredEntries removes expired cache entries
func ClearCacheEntry ¶ added in v0.2.10
func ClearCacheEntry(key string)
ClearCacheEntry removes a specific cache entry
func ExampleAdvancedOptions ¶ added in v0.2.10
func ExampleAdvancedOptions()
ExampleAdvancedOptions shows advanced configuration options
func ExampleBasicUsage ¶ added in v0.2.10
func ExampleBasicUsage()
ExampleBasicUsage shows the simplest way to load an agent with automatic source detection
func ExampleConfigurationPreview ¶ added in v0.2.10
func ExampleConfigurationPreview()
ExampleConfigurationPreview shows how to preview configurations without creating agents
func ExampleErrorHandling ¶ added in v0.2.10
func ExampleErrorHandling()
ExampleErrorHandling shows proper error handling patterns
func ExampleExplicitSources ¶ added in v0.2.10
func ExampleExplicitSources()
ExampleExplicitSources shows how to load from a specific configuration file
func ExampleMigrationFromOldAPI ¶ added in v0.2.10
func ExampleMigrationFromOldAPI()
ExampleMigrationFromOldAPI shows how to migrate from old file-based loading
func ExampleWithVariables ¶ added in v0.2.10
func ExampleWithVariables()
ExampleWithVariables shows how to pass custom variables
func GetCacheStats ¶ added in v0.2.10
GetCacheStats returns cache statistics for monitoring
func LoadAgentAuto
deprecated
added in
v0.2.10
func LoadAgentAuto(ctx context.Context, agentName, environment string, options ...agent.Option) (*agent.Agent, error)
LoadAgentAuto loads and creates an agent from local configuration.
Deprecated: this previously tried a remote config service before falling back to local. Remote configuration loading has been removed, so this is now identical to LoadAgentFromLocal. Use that instead.
func LoadAgentConfig ¶ added in v0.2.10
func LoadAgentConfig(_ context.Context, agentName, environment string, options ...LoadOption) (*agent.AgentConfig, error)
LoadAgentConfig is the main entry point for loading agent configurations.
Configuration is loaded from a local YAML file. Remote configuration loading was removed: it fetched YAML over HTTP and unmarshalled it straight into an AgentConfig whose MCP section names a local executable to run, which handed the config server arbitrary command execution inside the agent process.
func LoadAgentFromLocal ¶ added in v0.2.10
func LoadAgentFromLocal(ctx context.Context, agentName, environment string, options ...agent.Option) (*agent.Agent, error)
LoadAgentFromLocal is a convenience function that loads and creates an agent from local file
func LoadAgentWithOptions ¶ added in v0.2.10
func LoadAgentWithOptions(ctx context.Context, agentName, environment string, loadOptions []LoadOption, agentOptions ...agent.Option) (*agent.Agent, error)
LoadAgentWithOptions provides full control over loading options
func LoadAgentWithVariables ¶ added in v0.2.10
func LoadAgentWithVariables(ctx context.Context, agentName, environment string, variables map[string]string, options ...agent.Option) (*agent.Agent, error)
LoadAgentWithVariables loads an agent and applies variable substitutions
func MergeAgentConfig ¶ added in v0.2.11
func MergeAgentConfig(primary, base *agent.AgentConfig, strategy MergeStrategy) *agent.AgentConfig
MergeAgentConfig merges two AgentConfig structs based on the specified strategy For RemotePriority: primary values override base values (remote overrides local) For LocalPriority: base values override primary values (local overrides remote)
func PreviewAgentConfig ¶ added in v0.2.10
func PreviewAgentConfig(ctx context.Context, agentName, environment string) (*agent.AgentConfig, error)
PreviewAgentConfig returns the resolved configuration without creating an agent
Types ¶
type ConfigSource ¶ added in v0.2.10
type ConfigSource string
ConfigSource indicates where the configuration came from
const ( ConfigSourceLocal ConfigSource = "local" ConfigSourceCache ConfigSource = "cache" // ConfigSourceMerged marks a config produced by MergeAgentConfig. ConfigSourceMerged ConfigSource = "merged" )
type LoadOption ¶ added in v0.2.10
type LoadOption func(*LoadOptions)
LoadOption is a functional option
func WithCache ¶ added in v0.2.10
func WithCache(timeout time.Duration) LoadOption
WithCache enables caching with specified timeout
func WithEnvOverrides ¶ added in v0.2.10
func WithEnvOverrides() LoadOption
WithEnvOverrides enables environment variable overrides
func WithLocalFallback
deprecated
added in
v0.2.10
func WithLocalFallback(path string) LoadOption
WithLocalFallback sets an explicit config file path.
Deprecated: configuration is always loaded locally; there is no remote source to fall back from. Use WithLocalPath.
func WithLocalOnly
deprecated
added in
v0.2.10
func WithLocalOnly() LoadOption
WithLocalOnly is a no-op.
Deprecated: configuration is always loaded locally. This option has no effect.
func WithLocalPath ¶ added in v0.2.71
func WithLocalPath(path string) LoadOption
WithLocalPath sets an explicit config file path.
func WithVerbose ¶ added in v0.2.10
func WithVerbose() LoadOption
WithVerbose enables verbose logging
type LoadOptions ¶ added in v0.2.10
type LoadOptions struct {
// LocalPath is a specific config file path. When empty, a set of
// conventional locations is searched.
LocalPath string
// Caching
EnableCache bool
CacheTimeout time.Duration
// Behavior
EnableEnvOverrides bool
Verbose bool // Log loading steps
}
LoadOptions configures how agent configurations are loaded
func DefaultLoadOptions ¶ added in v0.2.10
func DefaultLoadOptions() *LoadOptions
DefaultLoadOptions returns sensible defaults
type MergeStrategy ¶ added in v0.2.11
type MergeStrategy string
MergeStrategy determines which of two configs wins when MergeAgentConfig combines them.
const ( // MergeStrategyNone - no merging. MergeStrategyNone MergeStrategy = "none" // MergeStrategyPrimaryPriority - the primary config wins; base fills gaps. MergeStrategyPrimaryPriority MergeStrategy = "primary_priority" // MergeStrategyBasePriority - the base config wins; primary fills gaps. MergeStrategyBasePriority MergeStrategy = "base_priority" )