config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate

func AutoMigrate(cfgPath, currentVersion string) error

AutoMigrate checks the config's meta.lastTouchedVersion and applies any newer migrations. If changes are made, the original config.json is backed up to config.json.bak before the migrated version is written.

func DetectSecretsInConfig added in v1.1.0

func DetectSecretsInConfig(cfg *Root) []string

DetectSecretsInConfig returns field names that appear to contain inline secrets in the config file. Used by the security audit.

func InterpolateEnvVars added in v1.1.0

func InterpolateEnvVars(cfg *Root)

InterpolateEnvVars walks all string fields in the config and expands ${VAR_NAME} patterns using os.Getenv.

func LegacyDir added in v1.1.0

func LegacyDir() (string, error)

LegacyDir returns ~/.roger regardless of XDG state.

func LoadSecretsEnv added in v1.1.0

func LoadSecretsEnv(path string) (int, error)

LoadSecretsEnv reads a secrets.env file and sets each key=value pair as an environment variable (unless already set). Returns the number of variables loaded. Missing file is not an error (returns 0, nil).

func ResolveWellKnownSecrets added in v1.1.0

func ResolveWellKnownSecrets(cfg *Root)

ResolveWellKnownSecrets fills empty secret fields from well-known environment variable names. This lets users set secrets via env vars or secrets.env without touching config.json at all.

func SaveState added in v1.1.0

func SaveState(stateDir string, s *State) error

SaveState writes state.json atomically to the given directory.

Types

type ActiveHoursConfig

type ActiveHoursConfig struct {
	Start    string `json:"start"`    // HH:MM (24h), inclusive (e.g. "09:00")
	End      string `json:"end"`      // HH:MM (24h), exclusive (e.g. "22:00"); "24:00" allowed
	Timezone string `json:"timezone"` // IANA timezone or "local" (default: agents.defaults.userTimezone)
}

ActiveHoursConfig restricts heartbeat execution to a time-of-day window.

type AgentDef

type AgentDef struct {
	ID              string       `json:"id"`
	Default         bool         `json:"default"`
	Identity        Identity     `json:"identity"`
	Capabilities    []Capability `json:"capabilities,omitempty"` // agent skills for capability-based routing
	CLICommand      string       `json:"cliCommand"`             // if set, this agent delegates to a CLI subprocess
	CLIArgs         []string     `json:"cliArgs"`                // args prepended before the message, e.g. ["-p"] for claude -p
	MaxConcurrent   int          `json:"maxConcurrent"`          // orchestrator: max parallel subtasks (default 5)
	ProgressUpdates bool         `json:"progressUpdates"`        // orchestrator: send per-task completion updates
	Async           bool         `json:"async"`                  // if true, runs via TaskManager (non-blocking)
}

type AgentDefaults

type AgentDefaults struct {
	Engine            string                     `json:"engine"`    // "router" (default) or "claude-cli"
	CLIEngine         CLIEngineConfig            `json:"cliEngine"` // config when engine="claude-cli"
	Model             ModelConfig                `json:"model"`
	Models            map[string]ModelAliasEntry `json:"models"` // model-id → {alias}; used for reverse alias lookup
	Subagents         SubagentsConfig            `json:"subagents"`
	Workspace         string                     `json:"workspace"`
	UserTimezone      string                     `json:"userTimezone"`
	TimeoutSeconds    int                        `json:"timeoutSeconds"`
	MaxConcurrent     int                        `json:"maxConcurrent"`
	ContextPruning    ContextPruning             `json:"contextPruning"`
	LoopDetectionN    int                        `json:"loopDetectionN"`    // consecutive identical tool calls to trigger break (default 3)
	ToolLoopDetection ToolLoopDetectionConfig    `json:"toolLoopDetection"` // multi-detector loop detection (REQ-410)
	MaxIterations     int                        `json:"maxIterations"`     // max tool-call rounds per turn (default 200)
	SoftTrimRatio     float64                    `json:"softTrimRatio"`     // fraction of model max tokens to trigger soft trim (default 0.0 = disabled)
	Compaction        CompactionConfig           `json:"compaction"`        // compaction model/timeout overrides
	Thinking          ThinkingConfig             `json:"thinking"`          // extended thinking (Anthropic models)
	Memory            MemoryConfig               `json:"memory"`            // persistent memory files
	Sandbox           SandboxConfig              `json:"sandbox"`           // Docker exec sandbox
	Heartbeat         HeartbeatConfig            `json:"heartbeat"`         // parsed for config compat; not implemented
}

type Agents

type Agents struct {
	Defaults AgentDefaults `json:"defaults"`
	List     []AgentDef    `json:"list"`
}

type BrowserConfig

type BrowserConfig struct {
	Enabled    bool   `json:"enabled"`
	Headless   *bool  `json:"headless"`   // nil = default true when Enabled
	ChromePath string `json:"chromePath"` // empty = auto-detect
	NoSandbox  bool   `json:"noSandbox"`  // launch Chrome with --no-sandbox (required in some containers)
	Width      int    `json:"width"`      // viewport width (default 1280)
	Height     int    `json:"height"`     // viewport height (default 900)
}

BrowserConfig controls the browser automation tool (requires Chrome/Chromium).

func (BrowserConfig) IsHeadless

func (bc BrowserConfig) IsHeadless() bool

IsHeadless returns true if headless mode is enabled (default: true).

type CLIEngineConfig

type CLIEngineConfig struct {
	Command      string   `json:"command"`      // path/name of claude binary (default "claude")
	Model        string   `json:"model"`        // model to request (e.g. "sonnet", "opus")
	MCPConfig    string   `json:"mcpConfig"`    // path to MCP config JSON for Roger tools
	SystemPrompt string   `json:"systemPrompt"` // custom system prompt override
	ExtraArgs    []string `json:"extraArgs"`    // additional CLI flags
	IdleTTLSec   int      `json:"idleTTLSec"`   // idle subprocess reap timeout in seconds (default 1800)
}

CLIEngineConfig holds settings for the "claude-cli" engine mode.

type Capability

type Capability struct {
	Name        string   `json:"name"`                  // e.g. "code-review", "research"
	Description string   `json:"description,omitempty"` // human-readable description
	Tags        []string `json:"tags"`                  // searchable labels
	Strength    float64  `json:"strength"`              // 0.0-1.0, default 1.0
}

Capability describes a skill or area of expertise that an agent can perform. Used for capability-based routing when agent_id is "auto" in task graphs.

type Channels

type Channels struct {
	Telegram TelegramConfig `json:"telegram"`
	Discord  DiscordConfig  `json:"discord"`
	Slack    SlackConfig    `json:"slack"`
}

type CompactionConfig

type CompactionConfig struct {
	Model          string `json:"model"`          // provider/model override for compaction (empty = use primary)
	TimeoutSeconds int    `json:"timeoutSeconds"` // per-compaction timeout (0 = no separate timeout)
}

CompactionConfig controls LLM-powered context compaction overrides.

type ContextPruning

type ContextPruning struct {
	Mode               string  `json:"mode"`
	TTL                string  `json:"ttl"`
	KeepLastAssistants int     `json:"keepLastAssistants"`
	HardClearRatio     float64 `json:"hardClearRatio"`
	SoftTrimRatio      float64 `json:"softTrimRatio"`   // OpenClaw nests this here
	ModelMaxTokens     int     `json:"modelMaxTokens"`  // max context tokens for the model (default 128000)
	SurgicalPruning    *bool   `json:"surgicalPruning"` // prefer trimming tool results over hard clear (default true)
	CacheTTLSeconds    int     `json:"cacheTtlSeconds"` // seconds to defer pruning after last API call (default 0 = immediate)
}

func (ContextPruning) IsSurgicalPruning

func (cp ContextPruning) IsSurgicalPruning() bool

IsSurgicalPruning returns the resolved value of SurgicalPruning (default true).

type ControlUI

type ControlUI struct {
	Enabled  bool   `json:"enabled"`
	BasePath string `json:"basePath"`
}

type DigestConfig

type DigestConfig struct {
	Enabled    bool   `json:"enabled"`
	Schedule   string `json:"schedule"`      // "daily" or "weekly" (default "daily")
	Hour       int    `json:"hour"`          // hour of day to run (0-23), default 8
	Timezone   string `json:"timezone"`      // IANA timezone, default "America/New_York"
	Target     string `json:"target"`        // delivery target: "last" (all paired), "none"
	LookbackH  int    `json:"lookbackHours"` // hours to look back, default 24 for daily
	MaxEntries int    `json:"maxEntries"`    // max entries to summarize, default 50
}

DigestConfig controls periodic memory digest generation. When Enabled is false (the default) no digests are generated.

type Dirs added in v1.1.0

type Dirs struct {
	Config string // user-authored config (no secrets)
	State  string // runtime state, credentials, retry queues
	Data   string // workspace, agents, cron, sessions
}

Dirs holds the resolved directory paths for config, state, and data.

func MigrateToXDG added in v1.1.0

func MigrateToXDG(legacy Dirs) (Dirs, error)

MigrateToXDG moves a legacy ~/.roger/ layout to XDG-compliant directories. It extracts secrets into secrets.env, moves runtime state to state.json, and distributes data files to the appropriate XDG directories. Returns the new Dirs on success.

func ResolveDirs added in v1.1.0

func ResolveDirs() (Dirs, error)

ResolveDirs returns XDG-compliant directories for Roger. It checks for an existing legacy ~/.roger/ layout and returns those paths if the XDG locations don't exist yet (caller handles migration).

func (Dirs) ConfigFile added in v1.1.0

func (d Dirs) ConfigFile() string

func (Dirs) CredentialsDir added in v1.1.0

func (d Dirs) CredentialsDir() string

func (Dirs) CronDir added in v1.1.0

func (d Dirs) CronDir() string

func (Dirs) EnsureDirs added in v1.1.0

func (d Dirs) EnsureDirs() error

EnsureDirs creates all directories if they don't exist.

func (Dirs) IsLegacyLayout added in v1.1.0

func (d Dirs) IsLegacyLayout() bool

IsLegacyLayout returns true if the dirs all point to the same ~/.roger/ directory.

func (Dirs) LogsDir added in v1.1.0

func (d Dirs) LogsDir() string

func (Dirs) RetryQueueFile added in v1.1.0

func (d Dirs) RetryQueueFile() string

func (Dirs) SecretsFile added in v1.1.0

func (d Dirs) SecretsFile() string

func (Dirs) SessionsDir added in v1.1.0

func (d Dirs) SessionsDir() string

func (Dirs) SkillsDir added in v1.1.0

func (d Dirs) SkillsDir() string

func (Dirs) StateFile added in v1.1.0

func (d Dirs) StateFile() string

func (Dirs) WorkspaceDir added in v1.1.0

func (d Dirs) WorkspaceDir() string

type DiscordConfig

type DiscordConfig struct {
	Enabled        bool     `json:"enabled"`
	BotToken       string   `json:"botToken"`
	DMPolicy       string   `json:"dmPolicy"`       // "pairing" or "allowlist"
	AllowUsers     []string `json:"allowUsers"`     // Discord user IDs (snowflakes, for allowlist mode)
	StreamMode     string   `json:"streamMode"`     // "partial" or ""
	ReplyToMode    string   `json:"replyToMode"`    // "first" or ""
	TimeoutSeconds int      `json:"timeoutSeconds"` // agent call timeout (default 300)
	AckEmoji       string   `json:"ackEmoji"`       // default "eyes"
}

type EideticConfig

type EideticConfig struct {
	Enabled         bool    `json:"enabled"`
	BaseURL         string  `json:"baseURL"`              // default "http://localhost:7700"
	APIKey          string  `json:"apiKey"`               // Bearer token
	AgentID         string  `json:"agentID"`              // override agent_id; defaults to agent def ID
	RecentLimit     int     `json:"recentLimit"`          // entries injected into system prompt (default 20)
	SearchLimit     int     `json:"searchLimit"`          // max results for eidetic_search tool (default 10)
	SearchThreshold float64 `json:"searchThreshold"`      // cosine similarity threshold (default 0.5)
	TimeoutSeconds  int     `json:"timeoutSeconds"`       // per-request timeout (default 5)
	RecallEnabled   *bool   `json:"recallEnabled"`        // semantic recall per turn (default true when eidetic enabled)
	RecallLimit     int     `json:"recallLimit"`          // max recalled entries per turn (default 5)
	RecallThreshold float64 `json:"recallThreshold"`      // min relevance for recalled entries (default 0.4)
	RecallTimeoutS  int     `json:"recallTimeoutSeconds"` // per-recall timeout; 0 = use timeoutSeconds (default 5)

	// Embeddings enables client-side vector embedding generation.
	// When configured, Roger generates embeddings before storing memories
	// and uses hybrid (keyword + vector) search for retrieval.
	Embeddings EmbeddingsConfig `json:"embeddings"`
}

EideticConfig controls the optional Eidetic memory sidecar integration. When Enabled is false (the default) the integration is fully disabled and Roger behaves as if this block were absent.

type EmbeddingsConfig

type EmbeddingsConfig struct {
	Enabled    bool   `json:"enabled"`              // generate embeddings on store, use hybrid search
	Provider   string `json:"provider"`             // provider name for base URL lookup (e.g. "ollama", "openai")
	Model      string `json:"model"`                // embedding model ID (e.g. "nomic-embed-text", "text-embedding-3-small")
	BaseURL    string `json:"baseURL"`              // override provider default endpoint
	APIKey     string `json:"apiKey"`               // API key (empty = "no-key" for local providers)
	Dimensions int    `json:"dimensions,omitempty"` // optional truncated dimensions (0 = model default)
}

EmbeddingsConfig controls client-side vector embedding generation for hybrid (keyword + vector) memory search.

type ExecConfig

type ExecConfig struct {
	TimeoutSec          int      `json:"timeoutSec"`
	BackgroundMs        int      `json:"backgroundMs"`
	BackgroundHardTimeM int      `json:"backgroundHardTimeM"` // hard kill for bg processes in minutes (default 30)
	MaxOutputChars      int      `json:"maxOutputChars"`      // output truncation limit (default 100000)
	DenyCommands        []string `json:"denyCommands"`        // empty = no restriction (backward-compatible)
	DangerousPatterns   []string `json:"dangerousPatterns"`   // extra patterns that trigger confirmation (merged with builtins)
	ConfirmTimeoutSec   int      `json:"confirmTimeoutSec"`   // timeout for destructive command confirmation (default 60)
}

type FilesConfig

type FilesConfig struct {
	AllowPaths []string `json:"allowPaths"` // empty = no restriction (backward-compatible)
}

type Gateway

type Gateway struct {
	Port            int             `json:"port"`
	Bind            string          `json:"bind"`
	ControlUI       ControlUI       `json:"controlUi"`
	Auth            GatewayAuth     `json:"auth"`
	Reload          GatewayReload   `json:"reload"`
	RateLimit       RateLimitConfig `json:"rateLimit"`
	WebhookSecret   string          `json:"webhookSecret"`   // HMAC-SHA256 secret for webhook signature validation
	ReadTimeoutSec  int             `json:"readTimeoutSec"`  // HTTP read timeout in seconds (default 300)
	WriteTimeoutSec int             `json:"writeTimeoutSec"` // HTTP write timeout in seconds (default 600)
}

type GatewayAuth

type GatewayAuth struct {
	Mode  string `json:"mode"`
	Token string `json:"token"`
}

type GatewayReload

type GatewayReload struct {
	Mode       string `json:"mode"`       // "hybrid", "poll", ""
	DebounceMs int    `json:"debounceMs"` // e.g. 300
}

type GatewayState added in v1.1.0

type GatewayState struct {
	GeneratedToken string `json:"generatedToken,omitempty"`
}

GatewayState holds auto-generated gateway values.

type GroupConfig

type GroupConfig struct {
	RequireMention bool `json:"requireMention"`
}

type HealthConfig

type HealthConfig struct {
	Enabled          bool `json:"enabled"`          // enable health tracking with circuit breakers (default false)
	FailureThreshold int  `json:"failureThreshold"` // consecutive failures to trip circuit (default 5)
	ResetTimeoutS    int  `json:"resetTimeoutS"`    // seconds before circuit resets to half-open (default 60)
}

HealthConfig controls the health state monitoring and circuit breaker system.

type HeartbeatConfig

type HeartbeatConfig struct {
	Every        string             `json:"every"`        // interval duration string, e.g. "30m", "1h" (default "30m"; empty or "0" = disabled)
	ActiveHours  *ActiveHoursConfig `json:"activeHours"`  // optional time-of-day window
	Target       string             `json:"target"`       // delivery target: "last", "none", channel name (default "none")
	Model        string             `json:"model"`        // optional model override for heartbeat turns
	Prompt       string             `json:"prompt"`       // custom prompt (default: read HEARTBEAT.md)
	AckMaxChars  int                `json:"ackMaxChars"`  // max trailing chars after HEARTBEAT_OK before forcing delivery (default 300)
	LightContext bool               `json:"lightContext"` // minimal bootstrap context (identity + HEARTBEAT.md only)
	DirectPolicy string             `json:"directPolicy"` // "allow" (default) or "block"
}

HeartbeatConfig controls periodic heartbeat agent turns.

func (HeartbeatConfig) HeartbeatAckMaxChars

func (hb HeartbeatConfig) HeartbeatAckMaxChars() int

HeartbeatAckMaxChars returns the configured ack max chars or the default (300).

func (HeartbeatConfig) HeartbeatEnabled

func (hb HeartbeatConfig) HeartbeatEnabled() bool

HeartbeatEnabled returns true if heartbeat is configured with a non-zero interval.

func (HeartbeatConfig) HeartbeatPrompt

func (hb HeartbeatConfig) HeartbeatPrompt() string

HeartbeatPrompt returns the configured prompt or the default.

type Identity

type Identity struct {
	Name  string `json:"name"`
	Theme string `json:"theme"`
	Emoji string `json:"emoji"`
}

type Logging

type Logging struct {
	Level           string `json:"level"`
	File            string `json:"file"`
	ConsoleLevel    string `json:"consoleLevel"`
	RedactSensitive string `json:"redactSensitive"`
}

type MemoryConfig

type MemoryConfig struct {
	Enabled bool `json:"enabled"` // load MEMORY.md into system prompt, enable memory tools
}

MemoryConfig controls the persistent memory system.

type MessageQueue

type MessageQueue struct {
	Mode       string `json:"mode"`       // "collect" or ""
	DebounceMs int    `json:"debounceMs"` // e.g. 300
	Cap        int    `json:"cap"`
}

type Messages

type Messages struct {
	Queue            MessageQueue `json:"queue"`
	AckReactionScope string       `json:"ackReactionScope"` // "group-mentions", "all", ""
	Usage            string       `json:"usage"`            // "off" (default), "tokens"
	StreamEditMs     int          `json:"streamEditMs"`     // streaming message edit interval in ms (default 400)
}

type Meta

type Meta struct {
	LastTouchedVersion string `json:"lastTouchedVersion"`
}

Meta holds bookkeeping fields for config versioning.

type ModelAliasEntry

type ModelAliasEntry struct {
	Alias string `json:"alias"`
}

ModelAliasEntry maps a model ID to a short alias (e.g. "sonnet").

type ModelConfig

type ModelConfig struct {
	Primary   string   `json:"primary"`
	Fallbacks []string `json:"fallbacks"`
}

type PostgresConfig

type PostgresConfig struct {
	DSN string `json:"dsn"` // e.g. "postgres://eidetic:eidetic@localhost:5432/eidetic"
}

PostgresConfig holds the connection string for the surfaces database.

type ProviderConfig

type ProviderConfig struct {
	APIKey  string `json:"apiKey"`
	BaseURL string `json:"baseURL"` // empty = use provider default
}

ProviderConfig holds connection settings for a model provider.

type RateLimitConfig

type RateLimitConfig struct {
	RPS   float64 `json:"rps"`   // max requests per second per IP (0 = disabled)
	Burst int     `json:"burst"` // burst capacity (default max(1, rps))
}

RateLimitConfig controls per-IP request rate limiting.

type ReasoningConfig

type ReasoningConfig struct {
	Enabled   bool   `json:"enabled"`  // run reasoning cycles (default true when surfaces enabled)
	IntervalS string `json:"interval"` // duration string, e.g. "3m" (default "3m")
	Model     string `json:"model"`    // optional model override for reasoning turns
}

ReasoningConfig controls the periodic reasoning loop that creates/expires surfaces.

type Root

type Root struct {
	Env       map[string]string          `json:"env"`
	Providers map[string]*ProviderConfig `json:"providers"`
	Logging   Logging                    `json:"logging"`
	Agents    Agents                     `json:"agents"`
	Tools     Tools                      `json:"tools"`
	Session   Session                    `json:"session"`
	Channels  Channels                   `json:"channels"`
	Gateway   Gateway                    `json:"gateway"`
	Messages  Messages                   `json:"messages"`
	TaskQueue TaskQueueConfig            `json:"taskQueue"`
	Update    UpdateConfig               `json:"update"`
	Eidetic   EideticConfig              `json:"eidetic"`
	Surfaces  SurfacesConfig             `json:"surfaces"`
	Digest    DigestConfig               `json:"digest"`
	Health    HealthConfig               `json:"health"`

	// Path is the filesystem path this config was loaded from (not serialized).
	Path string `json:"-"`
	// Dirs holds the resolved XDG directory layout (not serialized).
	Dirs Dirs `json:"-"`
}

Root is the top-level configuration structure.

func Load

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

Load reads and parses the config file. When path is empty it resolves via XDG directories, falling back to the legacy ~/.roger/config.json. If a legacy layout is detected and XDG paths don't exist, it auto-migrates.

func (*Root) DefaultAgent

func (c *Root) DefaultAgent() *AgentDef

DefaultAgent returns the first agent with default:true, or the first agent.

func (*Root) EnsureAuth

func (c *Root) EnsureAuth() (token string, generated bool, err error)

EnsureAuth ensures a gateway auth token is set. If mode is "token" (the default) and no token is configured, a cryptographically random token is generated, written into the in-memory config, and persisted to state.json. Returns the token in use and whether one was generated.

mode "none" and "trusted-proxy" are explicit opt-outs; EnsureAuth is a no-op.

func (*Root) GatewayListenAddr

func (c *Root) GatewayListenAddr() string

GatewayListenAddr returns the listen address for the gateway.

func (*Root) Reload

func (c *Root) Reload() (*Root, error)

Reload re-reads the config file and applies defaults.

func (*Root) ResolveModelAlias

func (c *Root) ResolveModelAlias(nameOrAlias string) string

ResolveModelAlias resolves a short alias (e.g. "sonnet") to its full model ID (e.g. "github-copilot/claude-sonnet-4.6"). If no matching alias is found, the input is returned unchanged (allowing full model IDs to pass through directly).

type SandboxConfig

type SandboxConfig struct {
	Enabled      bool     `json:"enabled"`
	Image        string   `json:"image"`        // Docker image, e.g. "ubuntu:22.04"
	Mounts       []string `json:"mounts"`       // "host:container:mode" bind mounts
	SetupCommand string   `json:"setupCommand"` // run once after container creation
}

SandboxConfig controls Docker-based exec sandbox for the exec tool.

type Session

type Session struct {
	Scope         string       `json:"scope"`
	ResetTriggers []string     `json:"resetTriggers"`
	Reset         SessionReset `json:"reset"`
	IdleMinutes   int          `json:"idleMinutes"`   // top-level shorthand (default 120)
	MaxConcurrent int          `json:"maxConcurrent"` // max concurrent requests per agent (default 2)
}

type SessionReset

type SessionReset struct {
	Mode        string `json:"mode"`
	AtHour      *int   `json:"atHour"` // nil = default 4 for daily mode
	IdleMinutes int    `json:"idleMinutes"`
}

type SlackConfig

type SlackConfig struct {
	Enabled        bool     `json:"enabled"`
	BotToken       string   `json:"botToken"`       // xoxb-...
	AppToken       string   `json:"appToken"`       // xapp-... (Socket Mode)
	AllowUsers     []string `json:"allowUsers"`     // Slack user IDs; empty = all workspace members
	StreamMode     string   `json:"streamMode"`     // "partial" or ""
	TimeoutSeconds int      `json:"timeoutSeconds"` // agent call timeout (default 300)
	AckEmoji       string   `json:"ackEmoji"`       // default "eyes"
}

type State added in v1.1.0

type State struct {
	Meta    StateMeta    `json:"meta"`
	Wizard  StateWizard  `json:"wizard"`
	Gateway GatewayState `json:"gateway"`
}

State holds runtime data that should not live in the user-authored config. It is stored in state.json under the state directory.

func LoadState added in v1.1.0

func LoadState(stateDir string) (*State, error)

LoadState reads state.json from the given directory. Returns a zero State if the file doesn't exist.

type StateMeta added in v1.1.0

type StateMeta struct {
	LastTouchedAt      string `json:"lastTouchedAt"`
	LastTouchedVersion string `json:"lastTouchedVersion"`
}

StateMeta tracks when Roger last touched the state file.

type StateWizard added in v1.1.0

type StateWizard struct {
	LastRunAt      string `json:"lastRunAt,omitempty"`
	LastRunCommand string `json:"lastRunCommand,omitempty"`
	LastRunMode    string `json:"lastRunMode,omitempty"`
	LastRunVersion string `json:"lastRunVersion,omitempty"`
}

StateWizard records init wizard runs.

type SubagentsConfig

type SubagentsConfig struct {
	Model         string `json:"model"`         // default model for subagent calls (empty = inherit primary)
	MaxConcurrent int    `json:"maxConcurrent"` // max concurrent subagent tasks (default 4)
}

SubagentsConfig controls default model and concurrency for subagent calls.

type SurfacesConfig

type SurfacesConfig struct {
	Enabled   bool            `json:"enabled"`
	Postgres  PostgresConfig  `json:"postgres"`
	Reasoning ReasoningConfig `json:"reasoning"`
}

SurfacesConfig controls the ambient surfaces system (ported from AgenticMe). When Enabled is false (the default) no Postgres connection is made and the surfaces/reasoning subsystems are fully disabled.

type TaskQueueConfig

type TaskQueueConfig struct {
	MaxConcurrent     int `json:"maxConcurrent"`     // max parallel tasks (default 5)
	ResultRetentionM  int `json:"resultRetentionM"`  // minutes to keep completed task results (default 60)
	ProgressThrottleS int `json:"progressThrottleS"` // seconds between progress updates (default 5)
}

TaskQueueConfig holds settings for the background task queue.

type TelegramConfig

type TelegramConfig struct {
	Enabled        bool                   `json:"enabled"`
	BotToken       string                 `json:"botToken"`
	DMPolicy       string                 `json:"dmPolicy"`
	StreamMode     string                 `json:"streamMode"`
	HistoryLimit   int                    `json:"historyLimit"`
	Groups         map[string]GroupConfig `json:"groups"`
	GroupPolicy    string                 `json:"groupPolicy"`
	ReplyToMode    string                 `json:"replyToMode"`    // "first" or ""
	TimeoutSeconds int                    `json:"timeoutSeconds"` // agent call timeout (default 300)
	AckEmoji       string                 `json:"ackEmoji"`       // default "👀"
}

type ThinkingConfig

type ThinkingConfig struct {
	Enabled      bool   `json:"enabled"`
	BudgetTokens int    `json:"budgetTokens"` // tokens reserved for thinking (default 8192)
	Level        string `json:"level"`        // "off", "enabled", "adaptive"; empty = use Enabled field; Claude 4.6 defaults to "adaptive"
}

ThinkingConfig controls extended thinking for providers that support it.

type ToolLoopDetectionConfig

type ToolLoopDetectionConfig struct {
	Enabled                       bool `json:"enabled"`                       // enable multi-detector loop detection (default true)
	HistorySize                   int  `json:"historySize"`                   // sliding window size (default 30)
	WarningThreshold              int  `json:"warningThreshold"`              // repetitions to trigger warning (default 10)
	CriticalThreshold             int  `json:"criticalThreshold"`             // repetitions to trigger hard break (default 20)
	GlobalCircuitBreakerThreshold int  `json:"globalCircuitBreakerThreshold"` // any single hash repeated this many times = stop (default 30)
}

ToolLoopDetectionConfig controls the multi-detector tool loop detection system (REQ-410).

type Tools

type Tools struct {
	Web     Web           `json:"web"`
	Exec    ExecConfig    `json:"exec"`
	Files   FilesConfig   `json:"files"`
	Browser BrowserConfig `json:"browser"`
}

type UpdateConfig

type UpdateConfig struct {
	AutoUpdate bool `json:"autoUpdate"` // if true, binary self-updates on startup when new version available (default: false)
}

UpdateConfig controls self-update behavior.

type Web

type Web struct {
	Search WebSearch `json:"search"`
	Fetch  WebFetch  `json:"fetch"`
}

type WebFetch

type WebFetch struct {
	Enabled        bool `json:"enabled"`
	MaxChars       int  `json:"maxChars"`
	TimeoutSeconds int  `json:"timeoutSeconds"`
}

type WebSearch

type WebSearch struct {
	Enabled        bool `json:"enabled"`
	MaxResults     int  `json:"maxResults"`
	TimeoutSeconds int  `json:"timeoutSeconds"`
}

Jump to

Keyboard shortcuts

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