config

package
v0.1.8-rc.13 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Overview

Package config provides loading and aggregation of Genie configuration.

It solves the problem of unifying all component settings (model, MCP, tools, messenger, cron, data sources, security, etc.) from files (.genie.toml, .genie.yaml) and environment variables. LoadGenieConfig resolves secret placeholders (${VAR}) via a SecretProvider and applies defaults so the rest of the application receives a single GenieConfig struct. Without this package, each component would read config independently and secret resolution would be scattered.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   = "dev"
	BuildDate = ""
)

Functions

func LoadMCPConfig

func LoadMCPConfig(ctx context.Context, sp security.SecretProvider, path string) (mcp.MCPConfig, error)

LoadMCPConfig loads only the MCP section from the config file at path. It uses the same path resolution as LoadGenieConfig (path can be empty to mean "no config") and expands ${VAR} via the given SecretProvider. This allows "genie mcp validate" to run without requiring model provider API keys.

func WarnMissingTokens

func WarnMissingTokens(ctx context.Context, cfg GenieConfig, configPath string)

WarnMissingTokens logs a warning for each model provider that typically requires an API key but has an empty token. Call this after the final config pass so that runtimevar-backed secrets have been resolved. Without this separation, the two-pass loading in cmd/root.go would emit spurious warnings during the preliminary env-only pass.

Types

type DashboardConfig

type DashboardConfig struct {
	// Enabled activates the admin dashboard. Disabled by default.
	Enabled bool `yaml:"enabled,omitempty" toml:"enabled,omitempty"`
	// RefreshInterval is the dashboard auto-refresh interval in seconds.
	// The frontend polls GET /api/v1/dashboard at this rate. Defaults to 30.
	RefreshInterval int `yaml:"refresh_interval,omitempty" toml:"refresh_interval,omitempty"`
}

DashboardConfig configures the opt-in admin/ops dashboard. When enabled, the AG-UI server serves a dashboard API (GET /api/v1/dashboard) and a frontend page (/ui/admin.html) showing real-time agent health, active sessions, capabilities, and cron status.

type DryRunConfig

type DryRunConfig struct {
	// Enabled activates dry-run simulation. When true, write tools are
	// wrapped to simulate execution without side-effects.
	Enabled bool `yaml:"enabled,omitempty" toml:"enabled,omitempty"`
}

DryRunConfig configures dry-run simulation mode.

type FeaturesConfig

type FeaturesConfig struct {
	// DryRun enables dry-run simulation mode. When true, write tools are
	// wrapped to simulate execution without side-effects. Useful for
	// testing and auditing agent behavior before going live.
	DryRun DryRunConfig `yaml:"dry_run,omitempty" toml:"dry_run,omitempty"`

	// Dashboard enables the admin/ops dashboard (GET /api/v1/dashboard
	// and /ui/admin.html). The route is always registered; when
	// disabled (default) the handler returns a JSON 404 with zero
	// collection overhead.
	Dashboard DashboardConfig `yaml:"dashboard,omitempty" toml:"dashboard,omitempty"`
}

FeaturesConfig holds opt-in feature configurations that control enterprise capabilities. Tool blocking is handled by HITL (see hitl package); these settings cover features that are orthogonal to tool approval.

type GenieConfig

type GenieConfig struct {
	// AgentName is the user-chosen name for the agent. It gives the agent a
	// personality and is used for the default audit log path
	// (~/.genie/{agent_name}.<yyyy_mm_dd>.ndjson).
	AgentName string `yaml:"agent_name,omitempty" toml:"agent_name,omitempty"`
	// Persona configures the project-level coding standards and agent capabilities file.
	Persona PersonaConfig `yaml:"persona,omitempty" toml:"persona,omitempty"`
	// PersonaTokenThreshold is the maximum recommended token length for the
	// persona/system prompt. If exceeded at boot, a warning is emitted.
	// Defaults to 2000.
	PersonaTokenThreshold int `yaml:"persona_token_threshold,omitempty" toml:"persona_token_threshold,omitempty"`
	// AuditPath overrides the default audit log path. When set, the auditor
	// writes to this single file (no date rotation). Used for tests or custom paths.
	AuditPath       string                    `yaml:"audit_path,omitempty" toml:"audit_path,omitempty"`
	ModelConfig     modelprovider.ModelConfig `yaml:"model_config,omitempty" toml:"model_config,omitempty"`
	SkillLoadConfig tools.SkillLoadConfig     `yaml:"skill_load,omitempty" toml:"skill_load,omitempty"`
	MCP             mcp.MCPConfig             `yaml:"mcp,omitempty" toml:"mcp,omitempty"`
	WebSearch       websearch.Config          `yaml:"web_search,omitempty" toml:"web_search,omitempty"`
	VectorMemory    vector.Config             `yaml:"vector_memory,omitempty" toml:"vector_memory,omitempty"`
	Graph           graph.Config              `yaml:"graph,omitempty" toml:"graph,omitempty"`
	Messenger       messenger.Config          `yaml:"messenger,omitempty" toml:"messenger,omitempty"`
	Browser         browser.Config            `yaml:"browser,omitempty" toml:"browser,omitempty"`
	SCM             scm.Config                `yaml:"scm,omitempty" toml:"scm,omitempty"`
	ExecutableTools executable.Configs        `yaml:"executable_tools,omitempty" toml:"executable_tools,omitempty"`

	ProjectManagement pm.Config `yaml:"project_management,omitempty" toml:"project_management,omitempty"`

	Email        email.Config        `yaml:"email,omitempty" toml:"email,omitempty"`
	GDrive       gdrive.Config       `yaml:"google_drive,omitempty" toml:"google_drive,omitempty"`
	Notification notification.Config `yaml:"notification,omitempty" toml:"notification,omitempty"`
	HITL         hitl.Config         `yaml:"hitl,omitempty" toml:"hitl,omitempty"`
	DBConfig     db.Config           `yaml:"db_config,omitempty" toml:"db_config,omitempty"`
	Langfuse     langfuse.Config     `yaml:"langfuse,omitempty" toml:"langfuse,omitempty"`

	Cron cron.Config `yaml:"cron,omitempty" toml:"cron,omitempty"`
	// Unified data sources configuration
	DataSources datasource.Config `yaml:"data_sources,omitempty" toml:"data_sources,omitempty"`

	// DocParser configures the multi-backend document parser used to convert
	// files (PDF, DOCX, images) into NormalizedItems for vectorization.
	DocParser docparser.Config `yaml:"doc_parser,omitempty" toml:"doc_parser,omitempty"`

	Security security.Config           `yaml:"security,omitempty" toml:"security,omitempty"`
	PII      pii.Config                `yaml:"pii,omitempty" toml:"pii,omitempty"`
	Toolwrap toolwrap.MiddlewareConfig `yaml:"toolwrap,omitempty" toml:"toolwrap,omitempty"`

	// ShellTool configures the run_shell tool's security behaviour.
	// Use shell_tool.allowed_env to control which environment variables
	// are visible to shell commands (principle of least privilege). When
	// shell_tool.allowed_env is unset or empty, only PATH is exposed to
	// shell commands; any additional environment variables must be listed
	// explicitly.
	ShellTool unixtools.ShellToolConfig `yaml:"shell_tool,omitempty" toml:"shell_tool,omitempty"`

	// DisablePensieve disables the Pensieve context management tools
	// (delete_context, check_budget, note, read_notes) from arXiv:2602.12108.
	// When true, the agent can actively manage its own context window.
	// delete_context and note require HITL approval; check_budget and
	// read_notes are read-only and auto-approved.
	DisablePensieve bool `yaml:"disable_pensieve,omitempty" toml:"disable_pensieve,omitempty"`

	// HalGuard configures the hallucination guard that validates
	// sub-agent goals (pre-check) and outputs (post-check).
	// See halguard.DefaultConfig() for defaults.
	HalGuard halguard.Config `yaml:"halguard,omitempty" toml:"halguard,omitempty"`

	// SemanticRouter configures the fast embedding-based intent routing,
	// jailbreak detection, and response semantic caching.
	SemanticRouter semanticrouter.Config `yaml:"semantic_router,omitempty" toml:"semantic_router,omitempty"`

	// Features holds opt-in feature toggles for enterprise capabilities
	// such as dry-run simulation. Tool blocking is handled by HITL.
	Features FeaturesConfig `yaml:"features,omitempty" toml:"features,omitempty"`

	// Learning configures the post-session learning loop that distills
	// completed tasks into reusable skills.
	Learning LearningConfig `yaml:"learning,omitempty" toml:"learning,omitempty"`
}

func LoadGenieConfig

func LoadGenieConfig(ctx context.Context, sp security.SecretProvider, path string) (GenieConfig, error)

LoadGenieConfig loads the Genie configuration from a file, resolving secret-dependent defaults and ${VAR} placeholders through the given SecretProvider. Each ${NAME} occurrence in the config file is resolved by calling sp.GetSecret(ctx, NAME), which may consult runtimevar backends (GCP Secret Manager, AWS Secrets Manager, mounted files, etc.) or fall back to os.Getenv depending on the provider.

Passing security.NewEnvProvider() preserves the legacy os.Getenv behavior. Passing a security.Manager created from the config's [security.secrets] section enables runtimevar-backed resolution.

After interpolation, secret values are resolved via sp.GetSecret; empty or missing values are not logged here (use WarnMissingTokens or provider-specific validation if early surfacing of typos is needed).

type LearningConfig

type LearningConfig struct {
	// MinimumNoveltyScore is the LLM-assigned novelty score (1-10) above
	// which a completed task is considered novel enough to distill into a
	// reusable skill. Lower values create more skills; higher values are
	// more selective. Default is 7.
	MinimumNoveltyScore int `yaml:"minimum_novelty_score,omitempty" toml:"minimum_novelty_score,omitempty"`
}

LearningConfig tunes the post-session skill distillation pipeline. This is the config-file representation; it is converted to learning.Config in the application layer to avoid import cycles.

type PersonaConfig added in v0.1.7

type PersonaConfig struct {
	// File is an optional path to a file whose contents are appended
	// to the agent's system prompt as project-level coding standards.
	// When empty, no persona content is loaded.
	File string `yaml:"file,omitempty" toml:"file,omitempty"`

	// DisableResume makes the generation of the agent's resume optional.
	// If disabled, the persona file is used as is.
	DisableResume bool `yaml:"disable_resume,omitempty" toml:"disable_resume,omitempty"`

	// AccomplishmentConfidenceThreshold is the minimum confidence score
	// (0.0–1.0) required for a tree result to be stored as an accomplishment.
	// Results below this threshold are discarded to prevent storing
	// error outputs or low-quality responses. Default is 0.5.
	AccomplishmentConfidenceThreshold float64 `yaml:"accomplishment_confidence_threshold,omitempty" toml:"accomplishment_confidence_threshold,omitempty"`
}

Jump to

Keyboard shortcuts

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