config

package
v0.1.61 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleConfig []byte
View Source
var ProjectExampleConfig []byte
View Source
var SlackManifest []byte
View Source
var Templates embed.FS

Functions

func IsNamedVolume added in v0.1.7

func IsNamedVolume(source string) bool

IsNamedVolume returns true if the source part of a mount looks like a Docker named volume rather than a host path (no slashes, doesn't start with ~ or .).

func TestSetReadFile

func TestSetReadFile(fn func(string) ([]byte, error)) func(string) ([]byte, error)

TestSetReadFile is a test helper to override the readFile function. Returns the original function so it can be restored.

Types

type Config

type Config struct {
	PlatformType         types.Platform
	DiscordToken         string
	DiscordAppID         string
	SlackBotToken        string
	SlackAppToken        string
	ClaudeBinPath        string
	DBPath               string
	LogFile              string
	LogLevel             string
	LogFormat            string
	ContainerImage       string
	ContainerTimeout     time.Duration
	ContainerMemoryMB    int64
	ContainerCPUs        float64
	ContainerKeepAlive   time.Duration
	PollInterval         time.Duration
	APIAddr              string
	ClaudeCodeOAuthToken string
	AnthropicAPIKey      string
	DiscordGuildID       string
	LoopDir              string
	MCPServers           map[string]MCPServerConfig
	TaskTemplates        []TaskTemplate
	Mounts               []string
	CopyFiles            []string
	Envs                 map[string]string
	ClaudeModel          string
	StreamingEnabled     bool
	Memory               MemoryConfig
	Permissions          types.Permissions
}

Config holds all application configuration loaded from config.json.

func Load

func Load() (*Config, error)

Load reads configuration from ~/.loop/config.json and returns a Config.

func LoadProjectConfig

func LoadProjectConfig(workDir string, mainConfig *Config) (*Config, error)

LoadProjectConfig loads project-specific config from {workDir}/.loop/config.json and merges it with the main config. Only mounts, mcp_servers, and claude_model are loaded from the project config for security reasons.

Merge behavior: - Mounts: Project mounts replace global mounts entirely - MCP Servers: Merged with project servers taking precedence over main config

Relative paths in project mounts are resolved relative to workDir. If the project config file doesn't exist, returns the main config unchanged.

func (*Config) Platform added in v0.1.18

func (c *Config) Platform() types.Platform

Platform returns the configured chat platform.

type EmbeddingsConfig added in v0.1.33

type EmbeddingsConfig struct {
	Provider  string `json:"provider"`   // "ollama"
	Model     string `json:"model"`      // e.g. "nomic-embed-text"
	OllamaURL string `json:"ollama_url"` // default "http://localhost:11434"
}

EmbeddingsConfig configures the embedding provider for semantic memory search.

type MCPServerConfig

type MCPServerConfig struct {
	Command string            `json:"command"`
	Args    []string          `json:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty"`
}

MCPServerConfig represents a single MCP server entry in the config.

type MemoryConfig added in v0.1.33

type MemoryConfig struct {
	Enabled            bool
	Paths              []string
	MaxChunkChars      int
	ReindexIntervalSec int
	Embeddings         EmbeddingsConfig
}

MemoryConfig groups all memory-related settings: enable flag, paths, and embeddings.

type TaskTemplate

type TaskTemplate struct {
	Name          string `json:"name"`
	Description   string `json:"description"`
	Schedule      string `json:"schedule"`
	Type          string `json:"type"`
	Prompt        string `json:"prompt"`
	PromptPath    string `json:"prompt_path"`
	AutoDeleteSec int    `json:"auto_delete_sec"`
}

TaskTemplate represents a reusable task template with schedule and prompt.

func (*TaskTemplate) ResolvePrompt added in v0.1.8

func (t *TaskTemplate) ResolvePrompt(loopDir string) (string, error)

ResolvePrompt returns the prompt text for the template. If Prompt is set, it is returned directly. If PromptPath is set, the file is read from {loopDir}/templates/{prompt_path}. Exactly one of Prompt or PromptPath must be set.

Jump to

Keyboard shortcuts

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