config

package
v0.0.0-...-0f11aa8 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultProviderID

func GetDefaultProviderID() string

GetDefaultProviderID returns the configured default provider ID.

func ResolveAgentsDir

func ResolveAgentsDir(path string) string

ResolveAgentsDir determines the base directory for agents configuration. If path is empty, it returns $XDG_CONFIG_HOME/dux/agents strictly.

Types

type Agent

type Agent struct {
	Name     string        `yaml:"name"`
	Provider string        `yaml:"provider"`
	Context  *AgentContext `yaml:"context,omitempty"`
	Workflow *Workflow     `yaml:"workflow,omitempty"`
	Triggers []Trigger     `yaml:"triggers,omitempty"`
}

Agent defines a distinct interactive role combining a provider and dynamic context.

func GetAgent

func GetAgent(agents []Agent, name string) (Agent, error)

GetAgent extracts a specific agent by name from an array of agents.

func LoadAgents

func LoadAgents(agentsDir string) ([]Agent, error)

LoadAgents enumerates all folders within agentsDir, expecting an agent.yaml inside.

type AgentContext

type AgentContext struct {
	Enrichers []Enricher   `yaml:"enrichers,omitempty"`
	Tools     []ToolConfig `yaml:"tools,omitempty"`
	System    string       `yaml:"system,omitempty"`
}

AgentContext defines dynamic and static context to configure an agent's memory before interaction.

type AgentInfo

type AgentInfo struct {
	Name     string
	Provider string
	Modes    string
	Triggers string
}

AgentInfo holds display-ready agent data.

func ListAgents

func ListAgents(agentsDir string) ([]AgentInfo, error)

ListAgents returns all configured agents with display metadata.

type BinaryTool

type BinaryTool struct {
	Description string               `yaml:"description"`
	Executable  string               `yaml:"executable"`
	Args        []string             `yaml:"args"`
	Inputs      map[string]ToolInput `yaml:"inputs,omitempty"`
}

BinaryTool defines execution requirements for a custom command line binary.

type Config

type Config struct {
	DefaultProvider string           `mapstructure:"default_provider"`
	Providers       []InstanceConfig `mapstructure:"providers"`
}

Config represents the top-level configuration for the LLM subsystem.

type Enricher

type Enricher struct {
	Type string `yaml:"type"`
	Text string `yaml:"text,omitempty"`
}

Enricher defines the configuration for a context enricher.

type InstanceConfig

type InstanceConfig struct {
	ID     string                 `mapstructure:"id"`
	Type   string                 `mapstructure:"type"`
	Config map[string]interface{} `mapstructure:"config"` // Polymorphic config
}

InstanceConfig holds the generic mapping for any provider instance.

func LoadLLMProvider

func LoadLLMProvider(targetID string) (InstanceConfig, error)

LoadLLMProvider reads the LLM deployment mappings from the current Viper context. It applies a generous suite of fallback configurations if the tree is completely missing, and resolves a single instance representation based on target request strings.

func LoadLLMProviders

func LoadLLMProviders() ([]InstanceConfig, error)

LoadLLMProviders returns all configured LLM providers.

type MCPServer

type MCPServer struct {
	Transport string            `yaml:"transport,omitempty"`
	Command   string            `yaml:"command,omitempty"`
	Args      []string          `yaml:"args,omitempty"`
	Env       map[string]string `yaml:"env,omitempty"`
	URL       string            `yaml:"url,omitempty"`
	Headers   map[string]string `yaml:"headers,omitempty"`
}

MCPServer defines configuration for an external Model Context Protocol server. It supports stdio (Command/Args), streamable_http (URL), or explicitly sse (URL) transports.

type Mode

type Mode struct {
	Name        string           `yaml:"name"`
	Use         string           `yaml:"use,omitempty"`
	Provider    string           `yaml:"provider,omitempty"`
	Context     *AgentContext    `yaml:"context,omitempty"`
	Transitions []ModeTransition `yaml:"transitions,omitempty"`
}

Mode represents a specific state in an agent's workflow graph.

func (*Mode) Merge

func (m *Mode) Merge(base *Mode)

Merge structurally inherits properties from the base mode. Local properties take precedence. Arrays (like tools/enrichers) are appended.

type ModeInfo

type ModeInfo struct {
	AgentName   string
	Name        string
	Provider    string
	Transitions string
}

ModeInfo holds display-ready mode data.

func ListModes

func ListModes(agentsDir string) ([]ModeInfo, error)

ListModes returns all workflow modes for all agents with display metadata.

type ModeTransition

type ModeTransition struct {
	To          string `yaml:"to"`
	Description string `yaml:"description"`
}

ModeTransition defines an automated tool injection to transition between workflow modes.

type ProviderInfo

type ProviderInfo struct {
	ID        string
	Type      string
	Details   string
	IsDefault bool
}

ProviderInfo holds display-ready provider data.

func ListProviders

func ListProviders() ([]ProviderInfo, error)

ListProviders returns all configured LLM providers with display metadata.

type SlackUIConfig

type SlackUIConfig struct {
	AppToken       string `mapstructure:"app_token"`
	BotToken       string `mapstructure:"bot_token"`
	SigningSecret  string `mapstructure:"signing_secret"`
	WebhookURL     string `mapstructure:"webhook_url"`
	WebhookAddress string `mapstructure:"webhook_address"`
	ReplyMode      string `mapstructure:"reply_mode"`
}

type TelegramUIConfig

type TelegramUIConfig struct {
	Token          string  `mapstructure:"token"`
	WebhookURL     string  `mapstructure:"webhook_url"`
	WebhookAddress string  `mapstructure:"webhook_address"`
	AllowedUsers   []int64 `mapstructure:"allowed_users"`
}

type ToolConfig

type ToolConfig struct {
	Name           string           `yaml:"name"`
	Enabled        bool             `yaml:"enabled"`
	TimeoutSeconds *int             `yaml:"timeout_seconds,omitempty"`
	Requirements   ToolRequirements `yaml:"requirements,omitempty"`
	MCP            *MCPServer       `yaml:"mcp,omitempty"`
	Binary         *BinaryTool      `yaml:"binary,omitempty"`
	Tools          []ToolConfig     `yaml:"tools,omitempty"`
}

ToolConfig maps a specific tool and its deployment requirements. A tool can be either a locally built-in tool, an external MCP server, or a declarative binary tool. It can also act as a logical "toolset" grouping by nesting additional configurations inside 'Tools'.

func LoadGlobalTools

func LoadGlobalTools() []ToolConfig

LoadGlobalTools retrieves the application-wide defined tools, securely injecting missing mandatory defaults (e.g. 'time').

type ToolDisplayConfig

type ToolDisplayConfig struct {
	Enabled     bool                             `mapstructure:"enabled"`
	DefaultIcon string                           `mapstructure:"default_icon"`
	Tools       map[string]ToolDisplayToolConfig `mapstructure:"tools"`
}

func LoadToolDisplayConfig

func LoadToolDisplayConfig() ToolDisplayConfig

type ToolDisplayToolConfig

type ToolDisplayToolConfig struct {
	Icon         string `mapstructure:"icon"`
	HideArgs     bool   `mapstructure:"hide_args"`
	HideResult   bool   `mapstructure:"hide_result"`
	MaxResultLen int    `mapstructure:"max_result_length"`
}

type ToolInput

type ToolInput struct {
	Type        string `yaml:"type"`
	Description string `yaml:"description"`
	Required    bool   `yaml:"required,omitempty"`
}

ToolInput defines single input parameter expected for a binary tool.

type ToolRequirements

type ToolRequirements struct {
	Supervision any   `yaml:"supervision,omitempty"` // Boolean or CEL string
	Sandbox     *bool `yaml:"sandbox,omitempty"`
}

ToolRequirements details specific execution protections for a given tool.

type Trigger

type Trigger struct {
	Type   string            `yaml:"type"`
	Config map[string]string `yaml:"config,omitempty"`
}

Trigger represents a configuration for defining how an agent starts.

type UIConfig

type UIConfig struct {
	Type          string                 `mapstructure:"type"`
	Agent         string                 `mapstructure:"agent"`
	Provider      string                 `mapstructure:"provider"`
	Configuration map[string]interface{} `mapstructure:"configuration"`
}

func LoadUIs

func LoadUIs() ([]UIConfig, error)

func (*UIConfig) ParseSlackConfig

func (c *UIConfig) ParseSlackConfig() (*SlackUIConfig, error)

func (*UIConfig) ParseTelegramConfig

func (c *UIConfig) ParseTelegramConfig() (*TelegramUIConfig, error)

func (*UIConfig) ParseWebConfig

func (c *UIConfig) ParseWebConfig() (*WebUIConfig, error)

type WebUIConfig

type WebUIConfig struct {
	Address string `mapstructure:"address"`
}

type Workflow

type Workflow struct {
	DefaultMode string `yaml:"default_mode"`
	Modes       []Mode `yaml:"modes"`
}

Workflow defines the graph of modes a context router traverses.

Jump to

Keyboard shortcuts

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