config

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionConfig

type ActionConfig struct {
	// Type identifies the kind of action (e.g., "llm", "retriever").
	Type string `yaml:"type" mapstructure:"type"`

	// Provider specifies the implementation provider (e.g., "google", "openai").
	Provider string `yaml:"provider" mapstructure:"provider"`

	// FailOnStartup determines if the application should crash if this action fails to load.
	FailOnStartup bool `yaml:"fail_on_startup" mapstructure:"fail_on_startup"`

	// Options contains arbitrary provider-specific settings.
	Options map[string]interface{} `yaml:"options" mapstructure:"options"`
}

ActionConfig defines a static action configuration.

type Config

type Config struct {
	// Policy configuration for the Datalog engine.
	Policy PolicyConfig `yaml:"policy" mapstructure:"policy"`

	// Observability configuration (Logging and Tracing).
	Observability ObservabilityConfig `yaml:"observability" mapstructure:"observability"`

	// Actions defines pre-configured actions that can be referenced by name.
	// This maps action names to their configuration.
	Actions map[string]ActionConfig `yaml:"actions" mapstructure:"actions"`

	// MCP defines a list of Model Context Protocol servers to connect to.
	MCP []MCPServerConfig `yaml:"mcp" mapstructure:"mcp"`

	// Knowledge configuration for static RDF facts.
	Knowledge KnowledgeConfig `yaml:"knowledge" mapstructure:"knowledge"`

	// Memory configuration for Semantic Memory (RAG).
	Memory MemoryConfig `yaml:"memory" mapstructure:"memory"`
}

Config is the root configuration structure for Manglekit. It maps to the YAML configuration file and defines all settings for the system.

func Load

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

Load reads a YAML configuration file from the given path and returns a Config object. It also expands environment variables in the YAML content. This function ports the legacy loading logic to the new architecture.

Environment variable expansion supports the standard ${VAR_NAME} syntax. Example: ${API_KEY} will be replaced with the value of the API_KEY environment variable.

func LoadFromReader

func LoadFromReader(r io.Reader) (*Config, error)

LoadFromReader reads a YAML configuration from the provided reader and returns a Config object. It also expands environment variables in the YAML content.

func ParseConfig

func ParseConfig(data []byte) (*Config, error)

ParseConfig unmarshals a byte slice into a Config object. It expands environment variables referenced with ${VAR_NAME} or ${VAR_NAME:-default} syntax before unmarshaling. Only explicitly referenced variables are expanded.

func (*Config) Validate added in v0.5.0

func (c *Config) Validate() error

Validate checks the configuration for invalid values.

type KnowledgeConfig

type KnowledgeConfig struct {
	// Path to the RDF Turtle (.ttl) file containing static facts.
	Path string `yaml:"path" mapstructure:"path"`
}

KnowledgeConfig settings for loading static knowledge bases.

type MCPServerConfig

type MCPServerConfig struct {
	// Name is a unique identifier for this MCP server connection.
	Name string `yaml:"name" mapstructure:"name"`
	// Transport specifies the connection method: "stdio" or "sse".
	Transport string `yaml:"transport" mapstructure:"transport"`
	// Command is the executable command (for stdio) or URL (for sse).
	Command string `yaml:"command" mapstructure:"command"`
	// Args are command-line arguments (for stdio).
	Args []string `yaml:"args" mapstructure:"args"`
	// Env specifies environment variables for the process (for stdio).
	Env []string `yaml:"env" mapstructure:"env"`
	// FailOnStartup determines if the application should crash if this server fails to connect.
	FailOnStartup bool `yaml:"fail_on_startup" mapstructure:"fail_on_startup"`
	// Tools lists expected tool names for resilience.
	// If the server fails to connect, these tools will be registered as "Unhealthy"
	// so the agent knows they exist but are unavailable.
	Tools []string `yaml:"tools" mapstructure:"tools"`
}

MCPServerConfig defines how to connect to an MCP server.

type MemoryConfig

type MemoryConfig struct {
	// Provider specifies the memory backend (e.g., "inmem", "qdrant").
	Provider string `yaml:"provider" mapstructure:"provider"`

	// Path is a file path or connection string for the provider.
	Path string `yaml:"path" mapstructure:"path"`

	// Options contains arbitrary provider-specific settings.
	Options map[string]interface{} `yaml:"options" mapstructure:"options"`
}

MemoryConfig settings for Semantic Memory provider.

type ObservabilityConfig

type ObservabilityConfig struct {
	// Enabled toggles all observability features.
	Enabled bool `yaml:"enabled" mapstructure:"enabled"`

	// ServiceName is the application name used in traces and logs.
	ServiceName string `yaml:"service_name,omitempty" mapstructure:"service_name"`

	// LogLevel sets the minimum log severity ("debug", "info", "warn", "error").
	LogLevel string `yaml:"log_level,omitempty" mapstructure:"log_level"`

	// OTLPEndpoint is the URL of the OpenTelemetry collector (gRPC/HTTP).
	OTLPEndpoint string `yaml:"otlp_endpoint,omitempty" mapstructure:"otlp_endpoint"`
}

ObservabilityConfig settings for telemetry.

type PolicyConfig

type PolicyConfig struct {
	// Path to the Datalog policy source file (.dl or .dlog) or directory.
	Path string `yaml:"path" mapstructure:"path"`

	// EvaluationTimeout is the max duration (in seconds) for rule evaluation.
	EvaluationTimeout int `yaml:"evaluation_timeout,omitempty" mapstructure:"evaluation_timeout"`

	// MaxSteps limits the total number of loop iterations in the Semantic State Machine.
	// Zero means use the SDK default (10). YAML key: max_steps.
	MaxSteps int `yaml:"max_steps,omitempty" mapstructure:"max_steps"`

	// SteeringEnabled controls whether EAST (Entropic Activation Steering) prompt
	// injection is active. When false, prompts pass through unmodified.
	// Default: false (disabled until validated). YAML key: steering_enabled.
	SteeringEnabled bool `yaml:"steering_enabled,omitempty" mapstructure:"steering_enabled"`

	// ParadoxThreshold is the EAST magnitude above which cognitive paradox injection
	// is triggered. Only effective when SteeringEnabled is true.
	// Default: 0.8. YAML key: paradox_threshold.
	ParadoxThreshold float64 `yaml:"paradox_threshold,omitempty" mapstructure:"paradox_threshold"`
}

PolicyConfig settings for the Datalog Policy Engine.

Jump to

Keyboard shortcuts

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