Documentation
¶
Overview ¶
Package config is the public authoring surface for a plums user config. An external ~/.config/plums/config/config.go imports this package and provides a func Config() config.Config that returns its Opts and the plugins it wants.
config builds on github.com/Ceinl/plums/capabilities (the plugin floor).
Index ¶
Constants ¶
const Dynamic = dynamicSentinel
Dynamic marks a Pref field as runtime-remembered. When no stored value exists, it behaves as "use the default value".
Variables ¶
var DynamicCount = Count{/* contains filtered or unexported fields */}
DynamicCount marks a Count field as runtime-remembered: it counts as set (so it survives Merge), but resolves to the default until the dynamic-prefs store supplies a remembered value.
Functions ¶
func Registered ¶
Registered returns the config-producing function previously registered by Use, and whether one was registered.
Types ¶
type Bool ¶
type Bool int8
Bool is a tri-state boolean: Unset (zero value — inherit the default), True, or False. This removes the ambiguity of a plain bool whose zero value (false) is indistinguishable from "not set".
type Config ¶
Config is the root returned by a user config's func Config() config.Config and by the built-in Default Config. Opts are the non-plugin settings; Plugins are the units of behavior to activate (in slice order, last-wins over defaults).
type Count ¶
type Count struct {
// contains filtered or unexported fields
}
Count is a tri-state integer for fields whose zero value (0) is a meaningful setting and so cannot double as "unset". The zero Count is unset; wrap a real value with Int (including Int(0)). A Count can also be Dynamic (runtime- remembered) via DynamicCount.
func Int ¶
Int constructs a set Count from v (Int(0) is "explicitly zero", distinct from the zero-value Count which is unset).
type Opts ¶
type Opts struct {
// Active selection — typical Dynamic candidates (remembered at runtime).
Backend Pref // backend plugin name, or Dynamic
Model Pref // model id, or Dynamic
DefaultLayout Pref // layout name, or Dynamic
Mode Pref // agent mode, or Dynamic
// Appearance.
Theme Theme
// Input.
Keybinds []Keybind
ClipboardCommand string
// Conversation visibility.
HideThinking Bool // tri-state: True / False / unset
ThinkingVisibility int
ToolCallVisibility int
// Split sizing.
SplitLeftWidth Count // tri-state int: unset inherits
OutputPercent Count
// Sessions.
ClearHistory Bool
// Registry.
Disable []RegistryKey
// Advanced timeouts (milliseconds; unset/0 inherits the default).
HealthTimeoutMS int
QuestionReplyTimeoutMS int
RecentModelTimeoutMS int
ListTimeoutMS int
SpinnerIntervalMS int
}
Opts is the long, typed list of everything that is NOT a plugin: active selection, appearance, input, conversation visibility, split sizing, sessions, registry disables, and advanced timeouts. Fields left at their zero value inherit the Default Config's value when merged (see Merge); use the sentinel tri-state / Dynamic helpers below to express "set" unambiguously for fields whose zero value is otherwise meaningful.
func MergeOpts ¶
MergeOpts overlays the external Opts over the base (Default Config) Opts, last-wins, field by field. A field counts as "set" only when its sentinel tri-state says so (Pref.Set, Bool.Set, Count.Set) or, for plain slices/ints, when it is non-empty/non-zero. Unset fields fall through to the base.
The result is itself an Opts (still expressed in sentinel types) so the resolved value of every field is unambiguous and callers can re-merge.
func (Opts) ToSettings ¶
func (o Opts) ToSettings(def SettingsDefaults) capabilities.Settings
ToSettings projects resolved Opts into the kernel/runtime-facing capabilities.Settings. Tri-state fields resolve through def; Pref fields use their pinned value. Dynamic Pref fields should be seeded from the app-managed state.toml store before this projection.
type Plugin ¶
Plugin pairs a plugin value (Self) with its typed options (Opts). The loader activates Self's capabilities and calls Self.Init(host, Opts).
type Pref ¶
type Pref string
Pref is a string-valued option that distinguishes three states: unset (zero value — inherit the default), Dynamic (remembered at runtime by the app-managed state.toml store), and a pinned literal value. An untyped string constant assigns directly: Backend: "opencode".
type RegistryKey ¶
type RegistryKey = capabilities.RegistryKey
RegistryKey qualifies a registry entry for Opts.Disable.
type SettingsDefaults ¶
type SettingsDefaults struct {
HideThinking bool
SplitLeftWidth int
OutputPercent int
ClearHistory bool
}
SettingsDefaults supplies concrete fallbacks for tri-state Opts fields whose "unset" must resolve to a meaningful value when projecting to capabilities.Settings. These mirror today's hardcoded runtime defaults.
type Theme ¶
type Theme = capabilities.Theme
Theme is the appearance token set (an Opt, not a plugin).