config

package
v2.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 6 Imported by: 0 modules, 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

Overview

Package config holds every knob lectern reads from the environment.

Values are resolved once at startup into a Config, then passed explicitly. Tests build their own Config instead of mutating globals, which is what makes the whole suite able to run in parallel against isolated databases.

Index

Constants

View Source
const EnvPrefix = "LECTERN_"

EnvPrefix is the prefix every setting carries now.

View Source
const LegacyEnvPrefix = "AGENTDECK_"

LegacyEnvPrefix is the prefix every setting carried before the project was renamed. An installed instance still has its unit file, drop-ins and shell profiles written with it, and a session launched by the previous binary still exports its identity under it.

Variables

This section is empty.

Functions

func AliasLegacyEnv

func AliasLegacyEnv() []string

AliasLegacyEnv makes every AGENTDECK_* variable readable under its LECTERN_* name for the rest of this process, without overriding a LECTERN_* value that is already set. It returns the names it aliased so the server can say so once at startup; the CLI and the MCP child stay quiet.

func LegacyEnvAliased

func LegacyEnvAliased() []string

LegacyEnvAliased lists the AGENTDECK_* names this process is reading through their LECTERN_* equivalents.

Types

type Config

type Config struct {
	DBPath  string
	Port    int
	Host    string
	BaseURL string // what a target uses to reach the control plane (hook callbacks)
	// WorktreeNamespace scopes automatically-created local worktrees and
	// branches to one durable local runtime. Empty preserves hosted behavior.
	WorktreeNamespace string

	// Mock swaps every executor for the scripted MockExecutor: no real git,
	// tmux or agent binary. Powers the hermetic suite and the UI demo mode.
	Mock bool

	AuthToken string // single bearer for the API/PWA; empty = open

	TickInterval   time.Duration
	ApprovalPoll   time.Duration
	ApprovalExpire time.Duration
	JanitorDays    float64
	// ScratchDays is how long an empty, unowned scratch workspace sits idle
	// before the sweep trashes it (0 disables the sweep); ScratchTrashDays is how
	// long it stays recoverable after that.
	ScratchDays      float64
	ScratchTrashDays float64
	// Live turns on forwarded ports and live desktops. They open listening
	// ports of their own and let an agent start a desktop that can be driven
	// from the network, so an operator asks for them; they are not a default.
	Live           bool
	MockAgentDelay time.Duration

	VAPIDPrivateKey string
	VAPIDPublicKey  string
	VAPIDEmail      string

	// HostClaudeConfig is the control plane user's own Claude Code config. It is
	// read ONLY to learn which MCP servers a local-target agent already inherits,
	// so the parity profile can grant permission to call them. Never copied
	// anywhere — it holds live credentials.
	HostClaudeConfig string

	ClaudeBin string
	// Agent binaries often live in ~/.local/bin, which a systemd unit's PATH does
	// not include — set these when a probe reports an agent missing that you know
	// is installed.
	CodexBin  string
	GeminiBin string

	// AnthropicAPIKey is rotation-proof agent auth. When set it is injected as
	// ANTHROPIC_API_KEY into every launch and no OAuth credentials are pushed to
	// targets. When empty, the control plane's current OAuth creds are pushed at
	// dispatch instead.
	AnthropicAPIKey string

	// ClaudeCredsPath / CodexCredsPath are where the control plane keeps agent
	// OAuth credentials. Overridable so tests never depend on a real ~/.claude.
	ClaudeCredsPath string
	CodexCredsPath  string

	// GrimoireURL points at a Grimoire instance for durable project memory.
	// Empty means lectern runs with no memory provider, which is a supported
	// configuration and not a degraded one — the two tools compose, they do not
	// depend on each other.
	GrimoireURL             string
	GrimoireToken           string
	GrimoireContextMode     string
	GrimoireContextProjects string

	// SessionPoll is how often live interactive sessions are refreshed. It is
	// separate from TickInterval because a session poll costs one exec per
	// target, whether or not anything is dispatched.
	SessionPoll time.Duration

	// MediaPath overrides MediaDir; MediaMaxBytes caps one posted file.
	MediaPath     string
	MediaMaxBytes int64
}

Config is the fully resolved runtime configuration.

func Load

func Load() *Config

Load resolves configuration from the process environment.

func (*Config) DiffDir

func (c *Config) DiffDir() string

DiffDir is where captured patches live — derived from the DB path so each database (including every test's temp DB) gets its own store. Attempt ids collide across databases, and a shared store once let a mock run overwrite production diffs.

func (*Config) MediaDir

func (c *Config) MediaDir() string

MediaDir holds what agents post back for the operator to look at: recordings, screenshots, reports. It sits beside the database for the same reason DiffDir does, but is overridable because a demo video is far larger than a patch and an operator may want it on a bulk volume.

func (*Config) MediaLimit

func (c *Config) MediaLimit() int64

MediaLimit is the largest single file an agent may post. A Config built by hand, as tests do, gets the same default Load applies.

Jump to

Keyboard shortcuts

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